当前位置: 首页>>代码示例>>PHP>>正文


PHP JRegistry::def方法代码示例

本文整理汇总了PHP中JRegistry::def方法的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry::def方法的具体用法?PHP JRegistry::def怎么用?PHP JRegistry::def使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JRegistry的用法示例。


在下文中一共展示了JRegistry::def方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareDocument

 /**
  * Prepares the document
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = NULL;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     }
     $title = $this->params->get('page_title', '');
     if ($this->folder->getDisplayName()) {
         $title = $this->folder->getDisplayName();
     }
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     if (empty($title)) {
         $title = $this->folder->getDisplayName();
     }
     $this->document->setTitle($title);
     if ($this->folder->getText()) {
         $this->document->setDescription($this->folder->getText());
     } elseif (!$this->folder->getText() && $this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
 }
开发者ID:sansandeep143,项目名称:av,代码行数:36,代码来源:view.html.php

示例2: loadLink

function loadLink( $link_id, &$savantConf, &$fields, &$params ) {
	global $_MAMBOTS, $mtconf;

	$database	=& JFactory::getDBO();
	$jdate		= JFactory::getDate();
	$now		= $jdate->toMySQL();
	$nullDate	= $database->getNullDate();

	# Get all link data
	$database->setQuery( "SELECT l.*, u.username AS username, u.name AS owner, u.email AS owner_email, cl.cat_id AS cat_id, c.cat_name AS cat_name, img.filename AS link_image, img.img_id FROM (#__mt_links AS l, #__mt_cl AS cl)"
		. "\n LEFT JOIN #__users AS u ON u.id = l.user_id"
		. "\n LEFT JOIN #__mt_cats AS c ON c.cat_id = cl.cat_id"
		. "\n LEFT JOIN #__mt_images AS img ON img.link_id = l.link_id AND img.ordering = 1"
		. "\n WHERE link_published='1' AND link_approved > 0 AND l.link_id='".$link_id."' " 
		. "\n AND ( publish_up = ".$database->Quote($nullDate)." OR publish_up <= '$now'  ) "
		. "\n AND ( publish_down = ".$database->Quote($nullDate)." OR publish_down >= '$now' ) "
		. "\n AND l.link_id = cl.link_id"
		. "\n LIMIT 1"
	);
	$link = $database->loadObject();
	
	if(count($link)==0) return false;
	
	# Use owner's email address is listing e-mail is not available
	if ( $mtconf->get('use_owner_email') && empty($link->email) && $link->user_id > 0 ) {
		$link->email = $link->owner_email;
	}

	# Load link's template
	if ( empty($link->link_template) ) {
		// Get link's template
		$database->setQuery( "SELECT cat_template FROM #__mt_cats WHERE cat_id='".$link->cat_id."' LIMIT 1" );
		$cat_template = $database->loadResult();

		if ( !empty($cat_template) ) {
			loadCustomTemplate(null,$savantConf,$cat_template);
		}
	} else {
		loadCustomTemplate(null,$savantConf,$link->link_template);
	}
	
	# Load fields
	$fields = loadFields( $link );
	
	# Load custom fields' value from #__mt_cfvalues to $link
	$database->setQuery( "SELECT CONCAT('cust_',cf_id) as varname, value FROM #__mt_cfvalues WHERE link_id = '".$link_id."'" );
	$cfvalues = $database->loadObjectList('varname');
	foreach( $cfvalues as $cfkey => $cfvalue )
	{
		$link->$cfkey = $cfvalue->value;
	}

	# Parameters
	$params = new JRegistry( $link->attribs );
	$params->def( 'show_review', $mtconf->get('show_review'));
	$params->def( 'show_rating', $mtconf->get('show_rating' ));

	return $link;

}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:60,代码来源:mtree.tools.php

示例3: display

 public function display($tpl = null)
 {
     require_once JPATH_SITE . '/modules/mod_k2_tools/helper.php';
     $application = JFactory::getApplication();
     $params = new JRegistry();
     $params->def('calendarCategory', $application->input->get('category', 0, 'int'));
     $params->def('month', $application->input->get('month', 0, 'int'));
     $params->def('year', $application->input->get('year', 0, 'int'));
     echo ModK2ToolsHelper::getCalendar($params);
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:10,代码来源:view.raw.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param   JRegistry  $options  JOpenstreetmapOauth options object.
  * @param   JHttp      $client   The HTTP client object.
  * @param   JInput     $input    The input object
  *
  * @since   13.1
  */
 public function __construct(JRegistry $options = null, JHttp $client = null, JInput $input = null)
 {
     $this->options = isset($options) ? $options : new JRegistry();
     $this->options->def('accessTokenURL', 'http://www.openstreetmap.org/oauth/access_token');
     $this->options->def('authoriseURL', 'http://www.openstreetmap.org/oauth/authorize');
     $this->options->def('requestTokenURL', 'http://www.openstreetmap.org/oauth/request_token');
     /*
     $this->options->def('accessTokenURL', 'http://api06.dev.openstreetmap.org/oauth/access_token');
     $this->options->def('authoriseURL', 'http://api06.dev.openstreetmap.org/oauth/authorize');
     $this->options->def('requestTokenURL', 'http://api06.dev.openstreetmap.org/oauth/request_token');
     */
     // Call the JOauth1Client constructor to setup the object.
     parent::__construct($this->options, $client, $input, null, '1.0');
 }
开发者ID:01J,项目名称:topm,代码行数:23,代码来源:oauth.php

示例5: onContentPrepare

 function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     // simple performance check to determine whether bot should process further
     if (strpos($article->text, 'rokbox') === false) {
         return true;
     }
     // Get plugin info
     $plugin =& JPluginHelper::getPlugin('content', 'rokbox');
     // define the regular expression for the bot
     $regex = "#{rokbox(.*?)}(.*?){/rokbox}#s";
     $pluginParams = new JRegistry($plugin->params);
     // check whether plugin has been unpublished
     if (!$pluginParams->get('enabled', 1)) {
         $article->text = preg_replace($regex, '', $row->text);
         return true;
     }
     // find all instances of plugin and put in $matches
     preg_match_all($regex, $article->text, $matches);
     // Number of plugins
     $count = count($matches[0]);
     // plugin only processes if there are any instances of the plugin in the text
     if ($count) {
         // Get plugin parameters
         $style = $pluginParams->def('style', -2);
         $this->plgContentProcessRokboxImages($article, $matches, $count, $regex, $pluginParams);
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:27,代码来源:rokbox.php

示例6: getParams

 public static function getParams($module_id = 0)
 {
     $module_id = $module_id ? $module_id : self::$module_id;
     if (!isset(self::$params[$module_id])) {
         jimport('joomla.registry.registry');
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         $query->select('params')->from('#__modules')->where('id=' . (int) $module_id);
         $db->setQuery($query);
         try {
             $params_str = $db->loadResult();
         } catch (RuntimeException $e) {
             $params_str = null;
             if (defined('PWEBCONTACT_DEBUG') and PWEBCONTACT_DEBUG) {
                 self::setLog('Database query error: ' . $e->getMessage());
             }
         }
         $params = new JRegistry($params_str);
         $params->def('id', (int) $module_id);
         self::$params[$module_id] = $params;
         if (!self::$module_id and $module_id) {
             self::$module_id = $module_id;
         }
     }
     return self::$params[$module_id];
 }
开发者ID:01J,项目名称:topm,代码行数:26,代码来源:helper.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param   JRegistry    $options  Google options object
  * @param   JGoogleAuth  $auth     Google data http client object
  *
  * @since   1234
  */
 public function __construct(JRegistry $options = null, JGoogleAuth $auth = null)
 {
     // Setup the default API url if not already set.
     $options->def('api.url', 'https://www.googleapis.com/plus/v1/');
     parent::__construct($options, $auth);
     if (isset($this->auth) && !$this->auth->getOption('scope')) {
         $this->auth->setOption('scope', 'https://www.googleapis.com/auth/plus.me');
     }
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:17,代码来源:plus.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param   JOpenstreetmapOauth  $oauth    Openstreetmap oauth client
  * @param   JRegistry            $options  Openstreetmap options object
  * @param   JHttp                $client   The HTTP client object
  *
  * @since   13.1
  */
 public function __construct(JOpenstreetmapOauth $oauth = null, JRegistry $options = null, JHttp $client = null)
 {
     $this->oauth = $oauth;
     $this->options = isset($options) ? $options : new JRegistry();
     $this->client = isset($client) ? $client : new JHttp($this->options);
     // Setup the default API url if not already set.
     $this->options->def('api.url', 'http://api.openstreetmap.org/api/0.6/');
     // $this->options->def('api.url', 'http://api06.dev.openstreetmap.org/api/0.6/');
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:18,代码来源:openstreetmap.php

示例9: __construct

 public function __construct($config = array())
 {
     //Change the column_name1,2,3 to the column names you want sortable
     $config['filter_fields'] = array('column_name_1', 'column_name_2', 'column_name_3');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin("socialpromoter", "stilerospflickr", false);
     $className = 'plgSocialpromoter' . ucfirst('Stilerospflickr');
     $pluginClass = new $className($dispatcher, array());
     $plg = JPluginHelper::getPlugin('socialpromoter', 'stilerospflickr');
     $plg_params = new JRegistry();
     $plg_params->loadString($plg->params);
     $this->api_key = $plg_params->def('api_key');
     $this->api_secret = $plg_params->def('api_secret');
     $this->auth_token = $plg_params->def('auth_token');
     $this->Flickr = new StileroFlickr($this->api_key, $this->api_secret);
     $this->Flickr->setAccessToken($this->auth_token);
     $this->Flickr->init();
     parent::__construct($config);
 }
开发者ID:stilero,项目名称:com_followers,代码行数:19,代码来源:flickr.php

示例10: setupAuthentication

 function setupAuthentication()
 {
     $options = new JRegistry();
     $options->def('accessTokenURL', 'https://api.login.yahoo.com/oauth/v2/get_token');
     $options->def('authenticateURL', 'https://api.login.yahoo.com/oauth/v2/request_auth');
     $options->def('authoriseURL', 'https://api.login.yahoo.com/oauth/v2/request_auth');
     $options->def('requestTokenURL', 'https://api.login.yahoo.com/oauth/v2/get_request_token');
     $options->set('consumer_key', $this->appId);
     $options->set('consumer_secret', $this->secretKey);
     $options->set('callback', JURI::base() . 'index.php?option=com_jfbconnect&task=authenticate.callback&provider=yahoo&state=' . JSession::getFormToken());
     $options->set('sendheaders', true);
     // Enabled for now. Should probably switch to force the redirect so we can just detect if user is logged in
     $headers = array();
     $headers['Content-Type'] = 'application/xml';
     $options->set('headers', $headers);
     $this->client = new JFBConnectProviderYahooOauth1($options);
     $token = JFactory::getApplication()->getUserState('com_jfbconnect.' . strtolower($this->name) . '.token', null);
     if ($token) {
         $token = (array) json_decode($token);
         $this->client->setToken($token);
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:22,代码来源:yahoo.php

示例11: testDef

	public function testDef()
	{
		$a = new JRegistry();

		$this->assertThat(
			$a->def('foo', 'bar'),
			$this->equalTo('bar'),
			'Line: '.__LINE__.'. def should return default value'
		);

		$this->assertThat(
			$a->get('foo'),
			$this->equalTo('bar'),
			'Line: '.__LINE__.'. default should now be the current value'
		);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:16,代码来源:JRegistryTest.php

示例12: defParam

 /**
  * Method to set a default parameter if it does not exist
  *
  * @param   string  $key    Parameter key
  * @param   mixed   $value  Parameter value
  *
  * @return  mixed  Set parameter value
  *
  * @since   11.1
  */
 public function defParam($key, $value)
 {
     return $this->_params->def($key, $value);
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:14,代码来源:user.php

示例13: foreach

    $document->addScriptDeclaration('
      dojo.addOnLoad(function() {
        if (window.Skinchanger) window.skin = new Skinchanger({theme: "' . $params->get('theme', 'default') . '",skins: ' . json_encode($sks) . '});
      });
    ');
    if (isset($_REQUEST['skin']) && $skins->{$_REQUEST['skin']}) {
        $skin = $skins->{$_REQUEST['skin']}[0];
        foreach ($skin as $s) {
            $name = $s->getName();
            $value = (string) $s;
            $params->set($name, $value);
        }
        $_SESSION[$module->module . "_params"] = $params->toString();
    }
}
$params->def('theme', 'elegant');
$theme = $params->get('theme', 'elegant');
if (is_object($theme)) {
    //For 1.6, 1.7, 2.5
    $params->merge(new JRegistry($params->get('theme')));
    $params->set('theme', $theme->theme);
    $theme = $params->get('theme');
}
$searchresultwidth = $params->get('resultareawidth', 250);
$dynamicresult = $params->get('dynamicresult', 0);
$productimageheight = $params->get('productimageheight', 40);
$productsperplugin = $params->get('itemsperplugin', 3);
$minchars = $params->get('minchars', 2);
$resultalign = $params->get('resultalign', 0);
// 0-left 1-right
$scrolling = $params->get('scrolling', 1);
开发者ID:knigherrant,项目名称:decopatio,代码行数:31,代码来源:mod_universal_ajaxlivesearch.php

示例14: getConfig


//.........这里部分代码省略.........
             $config = new JRegistry();
             $config->loadArray($converted);
             return $config;
         } else {
             // Invalid plugin
             throw new InvalidArgumentException(JText::sprintf('LIB_SHLDAPHELPER_ERR_10603', $name), 10603);
         }
     } elseif ($source === self::CONFIG_FILE) {
         // Define some default variables
         $namespace = '';
         $position = 0;
         $fileInc = false;
         // Grab the LDAP configuration file path from the registry and include it
         if ($file = $registry->get('ldap.file', JPATH_CONFIGURATION . '/ldap.php')) {
             $fileInc = @(include_once $file);
         }
         // Lets find all classes in the LDAP configuration file
         $classes = array_values(preg_grep('/(' . self::CONFIG_PREFIX . '){1}\\w*/i', get_declared_classes()));
         if (empty($classes)) {
             $fileInc = $fileInc ? JText::_('LIB_SHLDAPHELPER_INFO_10624') : JText::_('LIB_SHLDAPHELPER_INFO_10625');
             // Either file not lopaded or file has no valid classes
             throw new RuntimeException(JText::sprintf('LIB_SHLDAPHELPER_ERR_10623', $id, $fileInc), 10623);
         }
         $namespaces = $classes;
         // Retrieve the namespaces from the classes
         foreach ($namespaces as &$namespace) {
             $namespace = strtolower(str_ireplace(self::CONFIG_PREFIX, '', $namespace));
         }
         if (is_null($id)) {
             if (count($namespaces) === 1) {
                 // We will use a single namespace here
                 $nsKeys = array(0);
             } elseif (count($namespaces) > 1) {
                 // We will return an array of configs
                 $nsKeys = array_keys($namespaces);
             }
         } else {
             if (is_numeric($id)) {
                 // Need to treat the ID as a position - check if it exists
                 if (isset($namespaces[$id])) {
                     $nsKeys = array($id);
                 } else {
                     // Unable to load the file namespace specified
                     throw new InvalidArgumentException(JText::sprintf('LIB_SHLDAPHELPER_ERR_10609', $id), 10609);
                 }
             } elseif (is_string($id)) {
                 $key = array_search(strtolower($id), $namespaces, false);
                 if ($key !== false) {
                     $nsKeys = array($key);
                 } else {
                     // Unable to load the file namespace specified
                     throw new InvalidArgumentException(JText::sprintf('LIB_SHLDAPHELPER_ERR_10609', $id), 10609);
                 }
             } else {
                 // Invalid id argument
                 throw new InvalidArgumentException(JText::_('LIB_SHLDAPHELPER_ERR_10610'), 10610);
             }
         }
         $configs = array();
         // We need to instantiate the config classes from the file and store them in the configs
         foreach ($nsKeys as $nsKey) {
             $class = $classes[$nsKey];
             $config = new JRegistry();
             // Create the JConfig object
             $params = new $class();
             // Load the configuration values into the registry
             $config->loadObject($params);
             // Inject the domain ID into the config
             $config->def('domain', empty($namespaces[$nsKey]) ? 'default' : $namespaces[$nsKey]);
             $hostParams = array();
             $userParams = array();
             $groupParams = array();
             foreach ($config->toArray() as $key => $value) {
                 if (substr($key, 0, 5) == 'user_') {
                     $userParams[$key] = $value;
                 } elseif (substr($key, 0, 6) == 'group_') {
                     $groupParams[$key] = $value;
                 } else {
                     $hostParams[$key] = $value;
                 }
             }
             $config = new JRegistry($hostParams);
             // Inject the user_params and group_params
             $config->set('user_params', json_encode($userParams));
             $config->set('group_params', json_encode($groupParams));
             if (isset($userParams['user_qry'])) {
                 // Backwards compatibility with 2.0
                 $config->set('user_qry', $userParams['user_qry']);
             }
             $configs[] = $config;
         }
         // We only return an array when the ID is null
         return !is_null($id) ? $configs[0] : $configs;
     } else {
         // Invalid source
         throw new InvalidArgumentException(JText::_('LIB_SHLDAPHELPER_ERR_10601'), 10601);
     }
     // Failed to find a valid config
     return false;
 }
开发者ID:philbertphotos,项目名称:JMapMyLDAP,代码行数:101,代码来源:helper.php

示例15: JRegistry

 /**
  * Method to load content article parameters
  *
  * @access	private
  * @return	void
  * @since	1.5
  */
 function _loadItemParams($force = false)
 {
     if (!$force && !empty($this->_item->parameters)) {
         return;
     }
     $app = JFactory::getApplication();
     $menu = $app->getMenu()->getActive();
     // Retrieve currently active menu item (NOTE: this applies when Itemid variable or menu item alias exists in the URL)
     $isnew = !$this->_id;
     // **********************************************************************
     // Retrieve RELATED parameters that will be merged into item's parameters
     // **********************************************************************
     // Retrieve COMPONENT parameters
     $compParams = JComponentHelper::getComponent('com_flexicontent')->params;
     // Retrieve parameters of current category (NOTE: this applies when cid variable exists in the URL)
     $catParams = "";
     if ($this->_cid) {
         $query = 'SELECT c.title, c.params FROM #__categories AS c WHERE c.id = ' . (int) $this->_cid;
         $this->_db->setQuery($query);
         $catData = $this->_db->loadObject();
         $catParams = $catData->params;
         $this->_item->category_title = $catData->title;
     }
     $catParams = new JRegistry($catParams);
     // Retrieve/Create item's Content Type parameters
     $typeParams = $this->getTypeparams();
     $typeParams = new JRegistry($typeParams);
     // Create item parameters
     if (!is_object($this->_item->attribs)) {
         $itemParams = new JRegistry($this->_item->attribs);
     } else {
         $itemParams = $this->_item->attribs;
     }
     // Retrieve Layout's parameters, also deciding the layout
     $this->decideLayout($compParams, $typeParams, $itemParams);
     $layoutParams = $this->getLayoutparams();
     $layoutParams = new JRegistry($layoutParams);
     //print_r($layoutParams);
     // ***************************************************************************************************
     // Merge parameters in order: component, menu, (item 's) current category, (item's) content type, item
     // ***************************************************************************************************
     // a. Start with empty registry, then merge COMPONENT parameters
     $params = new JRegistry();
     $params->merge($compParams);
     // b. Merge parameters from current category
     $catParams->set('show_title', '');
     // Prevent show_title from propagating ... to the item, it is meant for category view only
     $catParams->set('title_linkable', '');
     // Prevent title_linkable from propagating ... to the item, it is meant for category view only
     $catParams->set('show_editbutton', '');
     // Prevent title_linkable from propagating ... to the item, it is meant for category view only
     $params->merge($catParams);
     // c0. Merge Layout parameters into the page configuration
     $params->merge($layoutParams);
     // c1. Merge TYPE parameters into the page configuration
     $params->merge($typeParams);
     // d. Merge ITEM parameters into the page configuration
     $params->merge($itemParams);
     // e. Merge ACCESS permissions into the page configuration
     $accessperms = $this->getItemAccess();
     $params->merge($accessperms);
     // d. Merge the active menu parameters, verify menu item points to current FLEXIcontent object
     if ($menu && !empty($this->mergeMenuParams)) {
         if (!empty($this->isForm)) {
             $this->menu_matches = false;
             $view_ok = FLEXI_ITEMVIEW == @$menu->query['view'] || 'article' == @$menu->query['view'];
             $this->menu_matches = $view_ok;
         } else {
             $view_ok = FLEXI_ITEMVIEW == @$menu->query['view'] || 'article' == @$menu->query['view'];
             $cid_ok = JRequest::getInt('cid') == (int) @$menu->query['cid'];
             $id_ok = JRequest::getInt('id') == (int) @$menu->query['id'];
             $this->menu_matches = $view_ok && $id_ok;
         }
     } else {
         $this->menu_matches = false;
     }
     // MENU ITEM matched, merge parameters and use its page heading (but use menu title if the former is not set)
     if ($this->menu_matches) {
         $params->merge($menu->params);
         $default_heading = $menu->title;
         // Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
         $params->def('page_heading', $params->get('page_title', $default_heading));
         $params->def('page_title', $params->get('page_heading', $default_heading));
         $params->def('show_page_heading', $params->get('show_page_title', 0));
         $params->def('show_page_title', $params->get('show_page_heading', 0));
     } else {
         // Clear some menu parameters
         //$params->set('pageclass_sfx',	'');  // CSS class SUFFIX is behavior, so do not clear it ?
         // Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ...
         $default_heading = empty($this->isForm) ? $this->_item->title : (!$isnew ? JText::_('FLEXI_EDIT') : JText::_('FLEXI_NEW'));
         // Decide to show page heading (=J1.5 page title), there is no need for this in item view
         $show_default_heading = 0;
         // Set both (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:item.php


注:本文中的JRegistry::def方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。