本文整理汇总了PHP中Joomla\Registry\Registry::def方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::def方法的具体用法?PHP Registry::def怎么用?PHP Registry::def使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joomla\Registry\Registry
的用法示例。
在下文中一共展示了Registry::def方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param Registry $options JOpenstreetmapOauth options object.
* @param JHttp $client The HTTP client object.
* @param JInput $input The input object
*
* @since 13.1
*/
public function __construct(Registry $options = null, JHttp $client = null, JInput $input = null)
{
$this->options = isset($options) ? $options : new Registry();
$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');
}
示例2: __construct
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 12.3
*/
public function __construct(Registry $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');
}
}
示例3: __construct
/**
* Constructor.
*
* @param JOpenstreetmapOauth $oauth Openstreetmap oauth client
* @param Registry $options Openstreetmap options object
* @param JHttp $client The HTTP client object
*
* @since 13.1
*/
public function __construct(JOpenstreetmapOauth $oauth = null, Registry $options = null, JHttp $client = null)
{
$this->oauth = $oauth;
$this->options = isset($options) ? $options : new Registry();
$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/');
}
示例4: prepareDocument
/**
* Prepares the document
*
* @return void
*
* @since 1.7.2
*/
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->def('page_title', $menu->title));
}
else
{
$this->params->def('page_heading', JText::_('COM_CHURCHDIRECTORY_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
}
}
示例5: 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);
}
示例6: testDef
/**
* Test the Joomla\Registry\Registry::def method.
*
* @return void
*
* @covers Joomla\Registry\Registry::def
* @since 1.0
*/
public function testDef()
{
$a = new Registry();
$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');
}
示例7: testDoNotDefineADefaultValueIfKeyIsSet
/**
* @testdox A default value is not assigned to a key if already set
*
* @covers Joomla\Registry\Registry::def
*/
public function testDoNotDefineADefaultValueIfKeyIsSet()
{
$a = new Registry(array('foo' => 'bar'));
$this->assertSame($a->def('foo', 'car'), 'bar', 'Calling def() on a key with a value should return the current value.');
}