本文整理汇总了PHP中Hubzero\Utility\String::ampReplace方法的典型用法代码示例。如果您正苦于以下问题:PHP String::ampReplace方法的具体用法?PHP String::ampReplace怎么用?PHP String::ampReplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hubzero\Utility\String
的用法示例。
在下文中一共展示了String::ampReplace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: citationAssociation
/**
* Output a citation's associations
*
* @param object $config Component config
* @param object $citation Citation
* @return string HTML
*/
public function citationAssociation($config, $citation)
{
$html = '';
$internally_cited_image = $config->get('citation_cited', 0);
$internally_cited_image_single = $config->get('citation_cited_single', '');
$internally_cited_image_multiple = $config->get('citation_cited_multiple', '');
//database
$database = \App::get('db');
// Get the associations
$assoc = new Association($database);
$assocs = $assoc->getRecords(array('cid' => $citation->id));
if (count($assocs) > 0) {
if (count($assocs) > 1) {
$html .= '<span>|</span> <span style="line-height:1.6em;color:#444">' . \Lang::txt('COM_CITATIONS_RESOURCES_CITED') . ':</span> ';
$k = 0;
$rrs = array();
foreach ($assocs as $rid) {
if ($rid->tbl == 'resource') {
$database->setQuery("SELECT published FROM `#__resources` WHERE id=" . $rid->oid);
$state = $database->loadResult();
if ($state == 1) {
$k++;
if ($internally_cited_image) {
$rrs[] = '<a class="internally-cited" href="' . \Route::url('index.php?option=com_resources&id=' . $rid->oid) . '">[<img src="' . $internally_cited_image_multiple . '" alt="' . \Lang::txt('COM_CITATIONS_RESOURCES_CITED') . '" />]</a>';
} else {
$rrs[] = '<a class="internally-cited" href="' . \Route::url('index.php?option=com_resources&id=' . $rid->oid) . '">[' . $k . ']</a>';
}
}
}
}
$html .= implode(', ', $rrs);
} else {
if ($assocs[0]->tbl == 'resource') {
$database->setQuery("SELECT published FROM `#__resources` WHERE id=" . $assocs[0]->oid);
$state = $database->loadResult();
if ($state == 1) {
if ($internally_cited_image) {
$html .= ' <span>|</span> <a class="internally-cited" href="' . \Route::url('index.php?option=com_resources&id=' . $assocs[0]->oid) . '"><img src="' . $internally_cited_image_single . '" alt="' . \Lang::txt('COM_CITATIONS_RESOURCES_CITED') . '" /></a>';
} else {
$html .= ' <span>|</span> <a class="internally-cited" href="' . \Route::url('index.php?option=com_resources&id=' . $assocs[0]->oid) . '">' . \Lang::txt('COM_CITATIONS_RESOURCES_CITED') . '</a>';
}
}
}
}
}
if ($citation->eprint) {
$html .= '<span>|</span>';
$html .= '<a href="' . String::ampReplace($citation->eprint) . '">' . \Lang::txt('Electronic Paper') . '</a>';
}
return $html;
}
示例2: save
/**
* Method to save the configuration data.
*
* @param array An array containing all global config data.
* @return bool True on success, false on failure.
* @since 1.6
*/
public function save($data)
{
// Save the rules
if (isset($data['rules'])) {
$rules = new JAccessRules($data['rules']);
// Check that we aren't removing our Super User permission
// Need to get groups from database, since they might have changed
$myGroups = JAccess::getGroupsByUser(\User::get('id'));
$myRules = $rules->getData();
$hasSuperAdmin = $myRules['core.admin']->allow($myGroups);
if (!$hasSuperAdmin) {
$this->setError(Lang::txt('COM_CONFIG_ERROR_REMOVING_SUPER_ADMIN'));
return false;
}
$asset = JTable::getInstance('asset');
if ($asset->loadByName('root.1')) {
$asset->rules = (string) $rules;
if (!$asset->check() || !$asset->store()) {
Notify::error('SOME_ERROR_CODE', $asset->getError());
}
} else {
$this->setError(Lang::txt('COM_CONFIG_ERROR_ROOT_ASSET_NOT_FOUND'));
return false;
}
unset($data['rules']);
}
// Save the text filters
if (isset($data['filters'])) {
$registry = new Registry(array('filters' => $data['filters']));
$extension = JTable::getInstance('extension');
// Get extension_id
$extension_id = $extension->find(array('name' => 'com_config'));
if ($extension->load((int) $extension_id)) {
$extension->params = (string) $registry;
if (!$extension->check() || !$extension->store()) {
Notify::error('SOME_ERROR_CODE', $extension->getError());
}
} else {
$this->setError(Lang::txt('COM_CONFIG_ERROR_CONFIG_EXTENSION_NOT_FOUND'));
return false;
}
unset($data['filters']);
}
// Get the previous configuration.
$config = new \Hubzero\Config\Repository('site');
$prev = $config->toArray();
/*$extras = array();
foreach ($prev as $key => $val)
{
$found = false;
foreach ($data as $group => $values)
{
if (in_array($key, $values))
{
$found = true;
}
}
if (!$found)
{
$extras[$key] = $val;
}
}
// Merge the new data in. We do this to preserve values that were not in the form.
$data['app'] = array_merge($data['app'], $extras);*/
// Perform miscellaneous options based on configuration settings/changes.
// Escape the offline message if present.
if (isset($data['offline']['offline_message'])) {
$data['offline']['offline_message'] = \Hubzero\Utility\String::ampReplace($data['offline']['offline_message']);
}
// Purge the database session table if we are changing to the database handler.
if ($prev['session']['session_handler'] != 'database' && $data['session']['session_handler'] == 'database') {
$table = JTable::getInstance('session');
$table->purge(-1);
}
if (empty($data['cache']['cache_handler'])) {
$data['cache']['caching'] = 0;
}
// Clean the cache if disabled but previously enabled.
if (!$data['cache']['caching'] && $prev['cache']['caching']) {
\Cache::clean();
}
foreach ($data as $group => $values) {
foreach ($values as $key => $value) {
if (!isset($prev[$group])) {
$prev[$group] = array();
}
$prev[$group][$key] = $value;
}
}
// Create the new configuration object.
//.........这里部分代码省略.........
示例3: __construct
/**
* Constructor
*
* @return void
*/
public function __construct($title, $link = null, $class = null, $active = false, $target = null, $titleicon = null)
{
$this->title = $titleicon ? $title . $titleicon : $title;
if ($link && substr($link, 0, strlen('index.php')) == 'index.php') {
$link = Route::url($link);
}
$this->link = \Hubzero\Utility\String::ampReplace($link);
$this->class = $class;
$this->active = $active;
$this->id = null;
if (!empty($link) && $link !== '#') {
$params = with(new \Hubzero\Utility\Uri($link))->getQuery(true);
$parts = array();
foreach ($params as $name => $value) {
$parts[] = str_replace(array('.', '_'), '-', $value);
}
$this->id = implode('-', $parts);
}
$this->target = $target;
}
示例4: defined
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @copyright Copyright 2005-2014 Open Source Matters, Inc.
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2
*/
// No direct access.
defined('_HZEXEC_') or die;
// Note. It is important to remove spaces between elements.
$class = $item->anchor_css ? 'class="' . $item->anchor_css . '" ' : '';
$title = $item->anchor_title ? 'title="' . $item->anchor_title . '" ' : '';
if ($item->menu_image) {
$item->params->get('menu_text', 1) ? $linktype = '<img src="' . $item->menu_image . '" alt="' . $item->title . '" /><span class="image-title">' . $item->title . '</span> ' : ($linktype = '<img src="' . $item->menu_image . '" alt="' . $item->title . '" />');
} else {
$linktype = $item->title;
}
$flink = $item->flink;
$flink = \Hubzero\Utility\String::ampReplace(htmlspecialchars($flink));
switch ($item->browserNav) {
default:
case 0:
?>
<a <?php
echo $class;
?>
href="<?php
echo $flink;
?>
" <?php
echo $title;
?>
><?php
echo $linktype;
示例5:
}
} else {
if (strlen($item[1])) {
if (isset($item[2]) && $item[2] == 1) {
?>
<a class="active" href="<?php
echo \Hubzero\Utility\String::ampReplace($item[1]);
?>
"><?php
echo $item[0];
?>
</a><?php
} else {
?>
<a href="<?php
echo \Hubzero\Utility\String::ampReplace($item[1]);
?>
"><?php
echo $item[0];
?>
</a><?php
}
} else {
echo $item[0];
}
}
?>
</li>
<?php
}
?>