本文整理汇总了PHP中JParameter::def方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::def方法的具体用法?PHP JParameter::def怎么用?PHP JParameter::def使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::def方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
static function &geTtoolbarParams($editor, $args = array())
{
if (count($args) > 1) {
$row = $args[1];
}
if (is_a($args[0], 'JParameter')) {
$params = $args[0];
} else {
if ($row) {
$params = new JParameter($row->params);
} else {
$row =& JCKHelper::getTable('toolbar');
// load the row from the db table
$row->load($args[0]);
//get toolbar parameter
$params = new JParameter($row->params);
}
}
$editor_params = new JParameter($editor->params);
$toolbar = $params->get('toolbar', $row->name);
$skins = $params->get('skin', $editor_params->def('skin', 'office2003'));
$width = $params->get('wwidth', $editor_params->def('wwidth', '100%'));
$editor_params->set('toolbar', $toolbar);
$editor_params->set('skin', $skins);
$editor_params->set('wwidth', $width);
$editor_params->Set('hheight', 300);
return $editor_params;
}
示例2: testDef
/**
* Test the JParameter::def method
*
* @return void
*
* @since 11.1
*/
public function testDef()
{
$p = new JParameter('');
$p->set('foo1', 'bar1');
$this->assertThat($p->def('foo1', 'bar2'), $this->equalTo('bar1'));
$this->assertThat($p->def('foo2', 'bar2'), $this->equalTo('bar2'));
}
示例3: getParameters
public function getParameters()
{
$active = $this->getObject('application.pages')->getActive();
$parameters = new JParameter($active->params);
$parameters->def('description_login_text', 'LOGIN_DESCRIPTION');
$parameters->def('registration', $this->getObject('application.extensions')->users->params->get('allowUserRegistration'));
return $parameters;
}
示例4: onContentSearch
/**
* Tags Search method
*
* The sql must return the following fields that are
* used in a common display routine: href, title, section, created, text,
* browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if restricted to areas, null if search all
*/
function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$searchText = $text;
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchTagsAreas()))) {
return array();
}
}
// load plugin params info
$plugin = JPluginHelper::getPlugin('search', 'cedtags');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$rows = $this->searchForText($text, $limit);
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$link = 'index.php?option=com_cedtag&task=tag&tag=' . CedTagsHelper::urlTagname($rows[$i]->name);
$rows[$i]->href = JRoute::_($link);
$rows[$i]->section = JText::_('TAG');
}
$return = array();
foreach ($rows as $key => $tag) {
if (searchHelper::checkNoHTML($tag, $searchText, array('name', 'title', 'text'))) {
$return[] = $tag;
}
}
return $return;
}
示例5: plgSearchEvents
function plgSearchEvents($text, $phrase = '', $ordering = '', $areas = null)
{
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_search' . DS . 'helpers' . DS . 'search.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchEventsAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'events');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$events = KService::get('com://admin/calendar.model.events')->sort('tbl.start_date')->direction('ASC')->limit($limit)->search($text)->getList();
$return = array();
foreach ($events as $event) {
if (searchHelper::checkNoHTML($event, $text, array('title', 'description'))) {
$event->text = $event->description;
$event->origin = 'events';
$event->href = 'index.php?option=com_calendar&view=event&id=' . $event->id . '&slug=' . $event->slug;
$event->section = JText::_('Events');
$return[] = $event->getData();
}
}
return $return;
}
示例6: onPrepareContent
function onPrepareContent(&$article, &$params, $limitstart)
{
global $mainframe;
// 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 JParameter($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);
}
}
示例7: plgSearchArticles
function plgSearchArticles($text, $phrase = '', $ordering = '', $areas = null)
{
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_search' . DS . 'helpers' . DS . 'search.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchArticlesAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'articles');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$articles = KService::get('com://admin/news.model.articles')->sort('tbl.created_on')->direction('DESC')->limit($limit)->search($text)->getList();
$return = array();
foreach ($articles as $article) {
if (searchHelper::checkNoHTML($article, $text, array('title', 'text'))) {
$article->origin = 'articles';
$article->href = 'index.php?option=com_news&view=article&id=' . $article->id . '&slug=' . $article->slug;
$article->section = $article->category_title;
$return[] = $article->getData();
}
}
return $return;
}
示例8: plgContentLoadModule
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule(&$row, &$params, $page = 0)
{
$db =& JFactory::getDBO();
// simple performance check to determine whether bot should process further
if (JString::strpos($row->text, 'loadposition') === false) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
// expression to search for
$regex = '/{loadposition\\s*.*?}/i';
$pluginParams = new JParameter($plugin->params);
// check whether plugin has been unpublished
if (!$pluginParams->get('enabled', 1)) {
$row->text = preg_replace($regex, '', $row->text);
return true;
}
// find all instances of plugin and put in $matches
preg_match_all($regex, $row->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);
plgContentProcessPositions($row, $matches, $count, $regex, $style);
}
}
示例9: plgSearchJFContacts
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function plgSearchJFContacts($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$registry =& JFactory::getConfig();
$lang = $registry->getValue("config.jflang");
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchContactAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'jfcontacts');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$activeLang = $pluginParams->def('active_language_only', 0);
$text = trim($text);
if ($text == '') {
return array();
}
$section = JText::_('Contact');
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$query = 'SELECT a.id as contid, b.id as catid, a.name AS title, "" AS created,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, ' . ' a.name, a.con_position, a.misc,' . ' "2" AS browsernav,' . ' jfl.code as jflang, jfl.name as jflname' . ' FROM #__contact_details AS a' . ' INNER JOIN #__categories AS b ON b.id = a.catid' . "\n LEFT JOIN #__jf_content as jfc ON reference_id = a.id" . "\n LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.id" . ' WHERE jfc.value LIKE ' . $text . ' AND a.published = 1' . ' AND b.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . ' AND b.access <= ' . (int) $user->get('aid') . "\n AND jfc.reference_table = 'contact_details'" . ($activeLang ? "\n AND jfl.code = '{$lang}'" : '') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
foreach ($rows as $key => $row) {
$rows[$key]->text = $row->name . "/" . $row->con_position . "/" . $row->misc;
$rows[$key]->section = $section . "/" . $row->title . " - " . $row->jflname;
$rows[$key]->href = 'index.php?option=com_contact&view=contact&id=' . $row->slug . '&catid=' . $row->catslug;
}
return $rows;
}
示例10: plgSearchJFCategories
/**
* Categories Search method
*
* The sql must return the following fields that are
* used in a common display routine: href, title, section, created, text,
* browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchJFCategories($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$registry =& JFactory::getConfig();
$lang = $registry->getValue("config.jflang");
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchCategoryAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'jfcategories');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$activeLang = $pluginParams->def('active_language_only', 0);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$query = 'SELECT a.title, a.description AS text, "" AS created,' . ' "2" AS browsernav,' . ' s.id AS secid, a.id AS catid,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,' . ' jfl.code as jflang, jfl.name as jflname' . ' FROM #__categories AS a' . ' INNER JOIN #__sections AS s ON s.id = a.section' . "\n LEFT JOIN #__jf_content as jfc ON reference_id = a.id" . "\n LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.id" . ' WHERE jfc.value LIKE ' . $text . ' AND a.published = 1' . ' AND s.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . ' AND s.access <= ' . (int) $user->get('aid') . "\n AND jfc.reference_table = 'categories'" . ($activeLang ? "\n AND jfl.code = '{$lang}'" : '') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getCategoryRoute($rows[$i]->slug, $rows[$i]->secid);
$rows[$i]->section = JText::_('Category') . " - " . $rows[$i]->jflname;
}
return $rows;
}
示例11: 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 JParameter($link->attribs);
$params->def('show_review', $mtconf->get('show_review'));
$params->def('show_rating', $mtconf->get('show_rating'));
return $link;
}
示例12: onSearch
/**
* Categories Search method
*
* The sql must return the following fields that are
* used in a common display routine: href, title, section, created, text,
* browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if restricted to areas, null if search all
*/
function onSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDbo();
$user =& JFactory::getUser();
$groups = implode(',', $user->authorisedLevels());
$searchText = $text;
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchCategoryAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'categories');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.title DESC';
}
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$query = 'SELECT a.title, a.description AS text, "" AS created, "2" AS browsernav, a.id AS catid,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug' . ' FROM #__categories AS a' . ' WHERE (a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ')' . ' AND a.published = 1' . ' AND a.access IN (' . $groups . ')' . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getCategoryRoute($rows[$i]->slug);
$rows[$i]->section = JText::_('Category');
}
$return = array();
foreach ($rows as $key => $category) {
if (searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
$return[] = $category;
}
}
return $return;
}
示例13: plgSearchSections
/**
* Sections Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchSections($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchSectionAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'sections');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$query = 'SELECT a.title AS title, a.description AS text, a.name, ' . ' "" AS created,' . ' "2" AS browsernav,' . ' a.id AS secid' . ' FROM #__sections AS a' . ' WHERE ( a.name LIKE ' . $text . ' OR a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ' )' . ' AND a.published = 1' . ' AND a.access <= ' . (int) $user->get('aid') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
$rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
$rows[$i]->section = JText::_('Section');
}
$return = array();
foreach ($rows as $key => $section) {
if (searchHelper::checkNoHTML($section, $searchText, array('name', 'title', 'text'))) {
$return[] = $section;
}
}
return $return;
}
示例14: plgSearchNinjaboard
/**
* Ninjaboard Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function plgSearchNinjaboard($text, $phrase = '', $ordering = '', $areas = null)
{
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchNinjaboardAreas()))) {
return array();
}
}
// load plugin params info
$pluginParams = new JParameter(JPluginHelper::getPlugin('search', 'ninjaboard')->params);
$limit = $pluginParams->def('search_limit', 50);
if (($text = trim($text)) == '') {
return array();
}
$order = 'created_time';
$direction = 'desc';
switch ($ordering) {
case 'alpha':
$order = 'subject';
$direction = 'asc';
break;
case 'category':
$order = array('forum', 'topic');
$direction = 'desc';
break;
case 'popular':
$order = array('hits', 'created_time');
$direction = 'asc';
break;
case 'newest':
$order = 'created_time';
$direction = 'desc';
break;
case 'oldest':
$order = 'created_time';
$direction = 'asc';
}
$posts = KFactory::tmp('admin::com.ninjaboard.model.posts')->search($text)->limit($limit)->sort($order)->direction($direction)->getList();
// Bit hackish. Don't blame me, com_search is a piece of M**bo crap
$results = array();
foreach ($posts as $post) {
$results[] = (object) array('href' => 'index.php?option=com_ninjaboard&view=topic&id=' . $post->topic . '&post=' . $post->id . '#p' . $post->id . '', 'title' => $post->subject, 'created' => $post->created_on, 'section' => $post->forum, 'text' => KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $post->text)), 'browsernav' => 0);
}
return $results;
}
示例15: GantryMenu
function GantryMenu($params)
{
if (empty($params)) {
$params = new JParameter('');
}
$params->def('menutype', 'mainmenu');
$params->def('class_sfx', '');
$params->def('menu_images', 0);
// Added in 1.5
$params->def('startLevel', 0);
$params->def('endLevel', 0);
$params->def('showAllChildren', 0);
$this->_menudata = GantryMenu::_getMenuData($params);
}