本文整理汇总了PHP中JPlugin类的典型用法代码示例。如果您正苦于以下问题:PHP JPlugin类的具体用法?PHP JPlugin怎么用?PHP JPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
if (!isset($this->params)) {
$plugin = JPluginHelper::getPlugin('system', 'hikashopuser');
if (version_compare(JVERSION, '2.5', '<')) {
jimport('joomla.html.parameter');
$this->params = new JParameter($plugin->params);
} else {
$this->params = new JRegistry($plugin->params);
}
}
$app = JFactory::getApplication();
$this->cart = $app->getUserState('com_hikashop.cart_id');
$this->wishlist = $app->getUserState('com_hikashop.wishlist_id');
$this->currency = $app->getUserState('com_hikashop.currency_id');
$this->entries = $app->getUserState('com_hikashop.entries_fields');
$this->checkout_fields_ok = $app->getUserState('com_hikashop.checkout_fields_ok', 0);
$this->checkout_fields = $app->getUserState('com_hikashop.checkout_fields');
$app = JFactory::getApplication();
if ($app->isAdmin() && @$_GET['option'] == 'com_plugins' && @$_GET['view'] == 'plugin' && (@$_GET['layout'] == 'edit' || @$_GET['task'] == 'edit')) {
$lang = JFactory::getLanguage();
$lang->load('com_hikashop', JPATH_SITE, null, true);
}
}
示例2: plgSystemmyApiOpenGraph
function plgSystemmyApiOpenGraph(&$subject, $config){
parent::__construct($subject, $config);
if(!class_exists('plgSystemmyApiConnect')) return;
$cache = & JFactory::getCache('plgSystemmyApiOpenGraph - FB Admins query');
$cache->setCaching( 1 );
$config =& JFactory::getConfig();
$connect_plugin =& JPluginHelper::getPlugin('system', 'myApiConnect');
$connect_params = new JParameter( $connect_plugin->params );
$plugin =& JPluginHelper::getPlugin('system', 'myApiOpenGraph');
$plugin_params = new JParameter( $plugin->params );
$db_admins = $cache->call( array( 'plgSystemmyApiOpenGraph', 'getFbAdmins'));
$param_admins = ($plugin_params->get('fbadmins') != '') ? explode(',',$plugin_params->get('fbadmins')) : array();
$admins = array_merge($db_admins,$param_admins);
$ogptags_default = array();
$ogptags_default['og:title'] = $config->getValue( 'config.sitename' );
$ogptags_default['og:type'] = 'website';
$ogptags_default['og:url'] = JURI::getInstance()->toString();
$ogptags_default['og:site_name'] = $config->getValue( 'config.sitename' );
$ogptags_default['fb:app_id'] = $connect_params->get('appId');
$ogptags_default['fb:admins'] = implode(',',$admins);
if($plugin_params->get('ogimage') != '' && $plugin_params->get('ogimage') != -1) $ogptags_default['og:image'] = JURI::base().'images/'.$plugin_params->get('ogimage');
if($plugin_params->get('fbpageid') != '') $ogptags_default['fb:page_id'] = $plugin_params->get('fbpageid');
plgSystemmyApiOpenGraph::setTags($ogptags_default);
}
示例3: onContentPrepare
public function onContentPrepare($context, &$article, &$params, $limitstart)
{
$app = JFactory::getApplication();
/* @var $app JApplication */
// Do not render the buttons in administration area
if ($app->isAdmin()) {
return;
}
$doc = JFactory::getDocument();
/* @var $doc JDocumentHtml */
$docType = $doc->getType();
// Joomla! must render content of this plugin only in HTML document
if (strcmp("html", $docType) != 0) {
return;
}
$currentOption = JRequest::getCmd("option");
if ($currentOption != "com_content" or !isset($article) or empty($article->id) or !isset($this->params)) {
return;
}
JPlugin::loadLanguage('plg_mvsocialbuttons');
$buttons = $this->getButtons($article);
$position = $this->params->get('position');
switch ($position) {
case 1:
$article->text = $buttons . $article->text;
break;
case 2:
$article->text = $article->text . $buttons;
break;
default:
$article->text = $buttons . $article->text . $buttons;
break;
}
return true;
}
示例4: __construct
/**
*
* Construct method
* @param object $subject
* @param object $config
*/
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
JHTML::_('behavior.framework', true);
$this->plugin = JPluginHelper::getPlugin('content', 'jadisqus_debate_echo');
$this->plgParams = new JRegistry();
$this->plgParams->loadString($this->plugin->params);
$this->source = $this->plgParams->get('source', 'both');
$provider = $this->plgParams->get('provider', 'intensedebate');
$this->postion_display_listing = $this->plgParams->get('postion_display_listing', 'onContentBeforeDisplay');
$this->postion_display_details = $this->plgParams->get('postion_display_details', 'onContentBeforeDisplay');
$this->position = $this->plgParams->get('position', 'onContentAfterDisplay');
switch ($provider) {
case 'disqus':
$provider = 'disqus';
break;
case 'jskit':
$provider = 'jskit';
break;
case 'intensdebate':
$provider = 'intensedebate';
break;
default:
$provider = 'intensedebate';
break;
}
$this->provider = $provider;
if ($this->provider == 'disqus') {
$countscript = $this->loadLayout($this->plugin, 'disqus_count');
//$body = str_replace('</body>', $countscript . "\n</body>", $body);
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($countscript);
}
$this->stylesheet($this->plugin);
}
示例5: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_events', JPATH_ADMINISTRATOR);
$config = CFactory::getConfig();
if (!$config->get('enableevents')) {
return JText::_('PLG_EVENTS_EVENT_DISABLED');
}
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$user = CFactory::getRequestUser();
$caching = $this->params->get('cache', 1);
$model = CFactory::getModel('Events');
$my = CFactory::getUser();
$this->loadUserParams();
//CFactory::load( 'helpers' , 'event' );
$event = JTable::getInstance('Event', 'CTable');
$handler = CEventHelper::getHandler($event);
$events = $model->getEvents(null, $user->id, $this->params->get('sorting', 'latest'), null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId(), $this->userparams->get('count', 5));
if ($this->params->get('hide_empty', 0) && !count($events)) {
return '';
}
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$creatable = $my->canCreateEvents();
$cache = JFactory::getCache('plgCommunityEvents');
$cache->setCaching($caching);
$callback = array($this, '_getEventsHTML');
$content = $cache->call($callback, true, $events, $user, $config, $model->getEventsCount($user->id), $creatable);
return $content;
}
示例6: onProfileDisplay
/**
* Ajax function to save a new wall entry
*
* @param message A message that is submitted by the user
* @param uniqueId The unique id for this group
*
**/
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_mytaggedvideos', JPATH_ADMINISTRATOR);
$mainframe = JFactory::getApplication();
// Attach CSS
$document = JFactory::getDocument();
// $css = JURI::base() . 'plugins/community/myvideos/style.css';
// $document->addStyleSheet($css);
$user = CFactory::getRequestUser();
$userid = $user->id;
$this->loadUserParams();
$def_limit = $this->params->get('count', 10);
$limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$row = $this->getVideos($userid);
$total = count($row);
if ($this->params->get('hide_empty', 0) && !$total) {
return '';
}
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyTaggedVideos');
$cache->setCaching($caching);
$callback = array('plgCommunityMyTaggedVideos', '_getLatestVideosHTML');
$content = $cache->call($callback, $userid, $this->userparams->get('count', 5), $limitstart, $row, $total);
return $content;
}
示例7: JVersion
function __construct(& $subject, $config) {
// Check if Kunena API exists
$api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
if (! is_file ( $api ))
return false;
jimport ( 'joomla.application.component.helper' );
// Check if Kunena component is installed/enabled
if (! JComponentHelper::isEnabled ( 'com_kunena', true )) {
return false;
}
// Load Kunena API
require_once $api;
// Fix Joomla 1.5 bugs and bad performance
$version = new JVersion();
if ($version->RELEASE == '1.5') {
$lang = JFactory::getLanguage();
if (JFactory::getApplication()->isAdmin()) {
$lang->load('com_kunena.menu', JPATH_ADMINISTRATOR);
} else {
$filename = JLanguage::getLanguagePath( JPATH_BASE, $lang->_lang)."/{$lang->_lang}.com_kunena.ini";
$lang->_paths['com_kunena'][$filename] = 1;
}
}
parent::__construct ( $subject, $config );
}
示例8: array
function plgHikashopMassaction_category(&$subject, $config)
{
parent::__construct($subject, $config);
$this->massaction = hikashop_get('class.massaction');
$this->massaction->datecolumns = array('category_created', 'category_modified');
$this->category = hikashop_get('class.category');
}
示例9: array
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$config = array_merge($config, array('ppName' => 'epaydk', 'ppKey' => 'PLG_PAYMENT_EPAYDK_TITLE', 'ppImage' => ''));
//Define Payment Status codes in eway And Respective Alias in Framework
$this->responseStatus = array('C' => 'C', 'ERROR' => 'E');
}
示例10: __construct
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
$this->_jqpath = '';
$this->_jquipath = '';
$this->_jquicsspath = '';
$this->_jqnoconflictpath = '';
$this->_jqmigratepath = '';
$this->_supplement_scripts = array();
$this->_supplement_stylesheets = array();
$this->_showreport = false;
$this->_verbose_array = array();
$this->_usejQuery = false;
$this->_usejQueryUI = false;
//$this->_usejQueryfromJoomla = false;
//$this->_usejQueryUIfromJoomla = false;
$this->_enabled = true;
$this->_timeafterroute = 0;
$this->_timebeforerender = 0;
$this->_timeafterrender = 0;
$this->_jquery_loaded_by_template = false;
$this->_jqueryui_loaded_by_template = false;
$this->_bootstrap_loaded_by_template = false;
$this->_back_compat_path = false;
}
示例11:
function __construct( &$subject, $config )
{
parent::__construct( $subject, $config );
$app = JFactory::getApplication();
if ( $app->isSite() ) {
return;
}
$template = $app->getTemplate();
if ( $template == 'adminpraise3' ) {
$document = JFactory::getDocument();
$document->addStyleSheet( JURI::root( true ).'/plugins/system/nnframework/css/ap3.css?v='.$this->_version );
}
if ( in_array( JRequest::getCmd( 'option' ), array(
'com_advancedmodules',
'com_contenttemplater',
'com_nonumbermanager',
'com_rereplacer',
'com_snippets',
) )
) {
$document = JFactory::getDocument();
$document->addScriptDeclaration( 'var is_nn = 1;' );
}
}
示例12: __construct
public function __construct(&$subject, $config)
{
// Do not load if Kunena version is not supported or Kunena is offline
if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) {
return;
}
$app = JFactory::getApplication();
// Do not load if CommunityBuilder is not installed
$path = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
if (!is_file($path)) {
return;
}
require_once $path;
cbimport('cb.database');
cbimport('cb.tables');
cbimport('language.front');
cbimport('cb.tabs');
cbimport('cb.field');
global $ueConfig;
parent::__construct($subject, $config);
$this->loadLanguage('plg_kunena_comprofiler.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_comprofiler.sys', KPATH_ADMIN);
require_once __DIR__ . "/integration.php";
if ($app->isAdmin() && (!isset($ueConfig['version']) || version_compare($ueConfig['version'], $this->minCBVersion) < 0)) {
$app->enqueueMessage(JText::sprintf('PLG_KUNENA_COMPROFILER_WARN_VERSION', $this->minCBVersion), 'notice');
}
}
示例13: plgSystemFabrik
/**
* Constructor
*
* For php4 compatibility we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object &$subject The object to observe
* @param array $config An array that holds the plugin configuration
*
* @since 1.0
*/
public function plgSystemFabrik(&$subject, $config)
{
/**
* Moved these from defines.php to here, to fix an issue with Kunena. Kunena imports the J!
* JForm class in their system plugin, in the class constructor So if we wait till onAfterInitialize
* to do this, we blow up. So, import them here, and make sure the Fabrik plugin has a lower ordering
* than Kunena's. We might want to set our default to -1.
*/
$app = JFactory::getApplication();
$version = new JVersion();
$base = 'components.com_fabrik.classes.' . str_replace('.', '', $version->RELEASE);
// Test if Kunena is loaded - if so notify admins
if (class_exists('KunenaAccess')) {
$msg = 'Fabrik: Please ensure the Fabrik System plug-in is ordered before the Kunena system plugin';
if ($app->isAdmin()) {
$app->enqueueMessage($msg, 'error');
}
} else {
JLoader::import($base . '.field', JPATH_SITE . '/administrator', 'administrator.');
JLoader::import($base . '.form', JPATH_SITE . '/administrator', 'administrator.');
}
if (version_compare($version->RELEASE, '3.1', '<=')) {
JLoader::import($base . '.layout.layout', JPATH_SITE . '/administrator', 'administrator.');
JLoader::import($base . '.layout.base', JPATH_SITE . '/administrator', 'administrator.');
JLoader::import($base . '.layout.file', JPATH_SITE . '/administrator', 'administrator.');
JLoader::import($base . '.layout.helper', JPATH_SITE . '/administrator', 'administrator.');
}
parent::__construct($subject, $config);
}
示例14:
function __construct($subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
$this->app = JFactory::getApplication();
$this->_params = $this->params;
}
示例15: __construct
/**
* Constructor.
*
* @param object &$subject The object to observe
* @param array $config An optional associative array of configuration settings.
*
* @since 1.6
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Set the error handler for E_ERROR to be the class handleError method.
JError::setErrorHandling(E_ERROR, 'callback', array('PlgSystemRedirect', 'handleError'));
set_exception_handler(array('PlgSystemRedirect', 'handleError'));
}