繁体   English   中英

jimport在Joomla 1.5中不起作用

[英]jimport not working in Joomla 1.5

我已经在Joomla 1.5中下载了一些openId的示例代码。 我正在学习有关Joomla的东西,并重新学习了一些PHP东西。 因此,我基本上对整个Content Manager领域都是陌生的。 我正在尝试使用openid制作一些用于身份验证的插件,但这似乎是错误的。

我已经在eclipse中成功调试了项目,发现错误来自我的jimport。

class plgAuthenticationOpenId extends JPlugin{
    /**
     * OpenId Atributes.
     */
    private static $attribute;

    private static $proxyHost;
    private static $proxyPort;
    private static $proxyUser;
    private static $proxyPassword;
    private static $appId;
    private static $appPassword;


function plgAuthenticationOpenId(& $subject, $config){
        parent::__construct($subject, $config);


         plgAuthenticationOpenId::$appId=$this->params->get('userKey', '');
         plgAuthenticationOpenId::$appPassword = $this->params->get('apiKey', '');

        define('Auth_OpenID_RAND_SOURCE', null);

        jimport('openid.consumer'); 
        jimport('openid.Auth.OpenID.AX');

        //Basic Attributes
        plgAuthenticationOpenId::$attribute = array();

        //more code messing with plgAuthenticationOpenId [...]

我尝试将库放在php include路径中,将其放置在PEAR路径中,我尝试了required_once(它在那里制动而不是在jimport中制动),我尝试了jimport整个路径,并尝试直接使用include 。 我还定义了目录分隔符和JPATH_BASE。 似乎没有任何作用。

我认为这应该是一个非常简单的解决方案,因为我已经复制/粘贴了代码(不是我自己创建的),并且是简单的jimport。 但是,尽管如此,我还是陌生的。 所以请帮忙。

非常感谢。

问题是jimport('openid.consumer'); 更改了include_path

这是一个测试来证明它。

<?php
// I executed code below in the view to obtain output
var_dump(ini_get('include_path'));
jimport('openid.consumer');
jimport('openid.Auth.OpenID.AX');
var_dump(ini_get('include_path'));

// OUTPUT
string '.:/opt/lampp/lib/php' (length=20)
string '/opt/lampp/htdocs/promark_eblaster/libraries/openid/.:/opt/lampp/lib/php' (length=72)
?>

如您所见,include_path已更改。

您可以尝试以下解决方法。

<?php 
// Remember the Original Path
$oldPath = ini_get('include_path');

// Include OpenID Stuff
jimport('openid.consumer');
jimport('openid.Auth.OpenID.AX');

// Set back the include_path so Joomla can import files with old include path
ini_set('include_path', $oldPath);

// Check if Success
JFactory::getApplication()->enqueueMessage("Hellow World");

// The rest of your code...
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM