本文整理汇总了PHP中ArrayHelper::clean_r方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayHelper::clean_r方法的具体用法?PHP ArrayHelper::clean_r怎么用?PHP ArrayHelper::clean_r使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper::clean_r方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
public function getInput()
{
$app = JFactory::getApplication();
$model = JModelLegacy::getInstance('Form', 'CobaltModel');
$type = $model->getRecordType($app->input->getInt('type_id'));
if (!$this->value) {
$value = array();
} else {
$value = json_decode($this->value, 1);
if (empty($value)) {
$value = $this->value;
}
}
if (!is_array($value) && !empty($value)) {
$value = explode(',', $this->value);
}
ArrayHelper::clean_r($value);
$default = array();
foreach ($value as $tag) {
$default[$tag] = $tag;
}
/*$query = $db->getQuery(true);
$query->select('tag');
$query->from('#__js_res_tags');
$query->order('tag ASC');
$db->setQuery($query);
$list = $db->loadColumn();
*/
$this->params = new JRegistry();
$options['coma_separate'] = 0;
$options['only_values'] = 0;
$options['min_length'] = 1;
$options['max_result'] = 10;
$options['case_sensitive'] = 0;
$options['unique'] = 1;
$options['highlight'] = 1;
$options['max_width'] = $this->params->get('params.max_width', 500);
$options['min_width'] = $this->params->get('params.min_width', 400);
$options['max_items'] = $type->params->get('general.item_tags_max', 25);
$options['ajax_url'] = 'index.php?option=com_cobalt&task=ajax.tags_list&tmpl=component';
$options['ajax_data'] = '';
return JHtml::_('mrelements.listautocomplete', "jform[tags]", "tags", $default, NULL, $options);
}
示例2: getGroups
protected function getGroups()
{
static $groups = array();
static $nums = 0;
if (empty($groups)) {
$db = JFactory::getDBO();
$query = "SELECT sp.id AS value,\n\t\t\t\t\t\t sp.name AS text,\n\t\t\t\t\t\t sp.group_id,\n\t\t\t\t\t\t g.name AS cat_title\n\t\t\t\t FROM #__jcs_plans AS sp\n\t\t\t LEFT JOIN #__jcs_groups AS g ON g.id = sp.group_id\n\t\t\t \t WHERE sp.published = 1\n\t\t\t\tORDER BY g.id, sp.name";
$db->setQuery($query);
$plans = $db->loadObjectList();
ArrayHelper::clean_r($plans);
foreach ($plans as $plan) {
$groups[$plan->cat_title][] = JHtml::_('select.option', $plan->value, $plan->text, 'value', 'text');
$nums++;
}
$nums += count($groups);
$groups = array_merge(parent::getGroups(), $groups);
}
$this->num = $nums;
ArrayHelper::clean_r($groups);
return $groups;
}
示例3: defined
/**
* Cobalt by MintJoomla
* a component for Joomla! 1.7 - 2.5 CMS (http://www.joomla.org)
* Author Website: http://www.mintjoomla.com/
* @copyright Copyright (C) 2012 MintJoomla (http://www.mintjoomla.com). All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
$document->addStyleDeclaration('
.catselect{
width:' . $params->get('select_width') . 'px;
}
');
$levels = explode("\r\n", $params->get('levels'));
ArrayHelper::clean_r($levels);
$max_level = count($levels);
?>
<script type="text/javascript">
var max_level = <?php
echo $max_level;
?>
;
!(function($){
}).jQuery;
function redirectToCategory(cat_id)
{
示例4: onContentSearch
function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$out = array();
$text = trim($text);
if ($text == '') {
return $out;
}
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$tag = JFactory::getLanguage()->getTag();
require_once JPATH_SITE . '/components/com_cobalt/library/php/helpers/helper.php';
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
require_once JPATH_SITE . '/administrator/components/com_search/helpers/search.php';
$searchText = $text;
$intersect = array_keys($this->onContentSearchAreas());
if (is_array($areas)) {
$intersect = array_intersect($areas, array_keys($this->onContentSearchAreas()));
}
if (!$intersect) {
return $out;
}
JArrayHelper::toInteger($intersect);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$query = $db->getQuery(TRUE);
$query->select('*');
$query->from('#__js_res_record');
$query->where('published = 1');
$query->where('section_id IN (' . implode(',', $intersect) . ')');
$search_mode = NULL;
$scount = explode(" ", $text);
ArrayHelper::clean_r($scount);
$search = $db->quote($db->escape($text));
if (count($scount) > 2) {
$search_mode = ' IN NATURAL LANGUAGE MODE';
foreach ($scount as $word) {
if (in_array(substr($word, 0, 1), array('+', '-'))) {
$search_mode = ' IN BOOLEAN MODE';
break;
}
}
$query->where("MATCH (fieldsdata) AGAINST ({$search}{$search_mode})");
} elseif (count($scount) == 1) {
$query->where("fieldsdata LIKE '%{$text}%'");
}
//$query->select("MATCH (fieldsdata) AGAINST ({$search}{$search_mode}) AS searchresult");
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('langs IN (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
switch ($ordering) {
case 'oldest':
$order = 'ctime ASC';
break;
case 'popular':
$order = 'hits DESC';
break;
case 'alpha':
$order = 'title ASC';
break;
case 'category':
$order = 'title ASC';
break;
case 'newest':
default:
$order = 'ctime DESC';
}
$query->order($order);
//echo $query;
$db->setQuery($query, 0, $limit);
$result = $db->loadObjectList();
settype($result, 'array');
$out = array();
foreach ($result as $key => $record) {
$out[$key] = new stdClass();
$out[$key]->title = $record->title;
$out[$key]->text = $record->fieldsdata;
$out[$key]->created = $record->ctime;
$out[$key]->href = Url::record($record);
$areas = $this->onContentSearchAreas();
$out[$key]->section = $areas[$record->section_id . '_section'];
$out[$key]->browsernav = 0;
}
return $out;
}