本文整理汇总了PHP中JLanguage::getTag方法的典型用法代码示例。如果您正苦于以下问题:PHP JLanguage::getTag方法的具体用法?PHP JLanguage::getTag怎么用?PHP JLanguage::getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLanguage
的用法示例。
在下文中一共展示了JLanguage::getTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Gets menu items by attribute
*
* @param string $attributes The field name
* @param string $values The value of the field
* @param boolean $firstonly If true, only returns the first item found
*
* @return array
*
* @since 1.6
*/
public function getItems($attributes, $values, $firstonly = false)
{
$attributes = (array) $attributes;
$values = (array) $values;
if ($this->app->isSite()) {
// Filter by language if not set
if (($key = array_search('language', $attributes)) === false) {
if (JLanguageMultilang::isEnabled()) {
$attributes[] = 'language';
$values[] = array($this->language->getTag(), '*');
}
} elseif ($values[$key] === null) {
unset($attributes[$key]);
unset($values[$key]);
}
// Filter by access level if not set
if (($key = array_search('access', $attributes)) === false) {
$attributes[] = 'access';
$values[] = $this->user->getAuthorisedViewLevels();
} elseif ($values[$key] === null) {
unset($attributes[$key]);
unset($values[$key]);
}
}
// Reset arrays or we get a notice if some values were unset
$attributes = array_values($attributes);
$values = array_values($values);
return parent::getItems($attributes, $values, $firstonly);
}
示例2: testGetTag
/**
* Test...
*
* @covers JLanguage::getTag
* @todo Implement testGetTag().
*
* @return void
*/
public function testGetTag()
{
$this->assertEquals(
'en-GB',
$this->object->getTag()
);
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
示例3: testGetTag
/**
* Test...
*
* @return void
*/
public function testGetTag()
{
$this->assertEquals('en-GB', $this->object->getTag());
}
示例4: parseMessageForRowHolder
/**
* Iterates through string to replace every
* {placeholder} with row data
* (added by hugh, does the same thing as parseMessageForPlaceHolder in parent
* class, but for rows instead of forms)
*
* NOTE - I can't remember why I added this way back when in 2.x, instead of using the helper function,
* I just know there was a good reason, to do with the helper func making assumptions about something
* (I think to do with how form data is formatted) which weren't true when rendering list data. I have
* a suspicion that in the intervening years, the helper func and the way we format data may now be
* copacetic, and we could do away with this separation, and just use the normal helper func. Might be
* worth testing, as this code looks like it has suffered bitrot, and doesn't do a number of things the main
* helper func now does.
*
* @param string $msg text to parse
* @param array &$row of row data
* @param bool $addSlashes add slashes to the replaced data (default = false) set to true in fabrikcalc element
*
* @return string parsed message
*/
public function parseMessageForRowHolder($msg, &$row, $addSlashes = false)
{
$this->aRow = $row;
if (!strstr($msg, '{')) {
return $msg;
}
$this->parseAddSlases = $addSlashes;
$msg = FabrikWorker::replaceWithUserData($msg);
$msg = FabrikWorker::replaceWithGlobals($msg);
$msg = preg_replace("/{}/", "", $msg);
$this->rowIdentifierAdded = false;
/* replace {element name} with form data */
/* $$$ hugh - testing changing the regex so we don't blow away PHP structures! Added the \s so
* we only match non-space chars in {}'s. So unless you have some code like "if (blah) {foo;}", PHP
* block level {}'s should remain unmolested.
*/
$msg = preg_replace_callback("/{[^}\\s]+}/i", array($this, 'replaceWithRowData'), $msg);
$lang = $this->lang->getTag();
$lang = str_replace('-', '_', $lang);
$msg = str_replace('{lang}', $lang, $msg);
return $msg;
}
示例5: testGetTag
/**
* @todo Implement testGetTag().
*/
public function testGetTag()
{
// This method get language tag
$lang = new JLanguage('');
// In this case, returns en-GB (default language)
// - same operation of get method with tag property
$this->assertEquals('en-GB', $lang->getTag(), 'Line: ' . __LINE__);
$this->assertNotEquals('es-ES', $lang->getTag(), 'Line: ' . __LINE__);
}