本文整理汇总了PHP中FinderHelperLanguage::loadPluginLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP FinderHelperLanguage::loadPluginLanguage方法的具体用法?PHP FinderHelperLanguage::loadPluginLanguage怎么用?PHP FinderHelperLanguage::loadPluginLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FinderHelperLanguage
的用法示例。
在下文中一共展示了FinderHelperLanguage::loadPluginLanguage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
$this->items = $this->get('Items');
$this->total = $this->get('Total');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->pluginState = $this->get('pluginState');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
FinderHelper::addSubmenu('index');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
if (!$this->pluginState['plg_content_finder']->enabled) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED'), 'warning');
} elseif ($this->get('TotalIndexed') === 0) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_NO_DATA') . ' ' . JText::_('COM_FINDER_INDEX_TIP'), 'notice');
}
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Configure the toolbar.
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例2: display
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached. [optional]
* @param array $urlparams An array of safe url parameters and their variable types,
* for valid values see {@link JFilterInput::clean()}. [optional]
*
* @return JControllerLegacy This object is to support chaining.
*
* @since 2.5
*/
public function display($cachable = false, $urlparams = array())
{
$input = JFactory::getApplication()->input;
$cachable = true;
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
// Set the default view name and format from the Request.
$viewName = $input->get('view', 'search', 'word');
$input->set('view', $viewName);
// Don't cache view for search queries
if ($input->get('q', null, 'string') || $input->get('f', null, 'int') || $input->get('t', null, 'array')) {
$cachable = false;
}
$safeurlparams = array('f' => 'INT', 'lang' => 'CMD');
return parent::display($cachable, $safeurlparams);
}
示例3: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
// Load the view data.
$this->items = $this->get('Items');
$this->total = $this->get('Total');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Prepare the view.
$this->addToolbar();
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
parent::display($tpl);
}
示例4: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
$this->items = $this->get('Items');
$this->total = $this->get('Total');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->pluginState = $this->get('pluginState');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
FinderHelper::addSubmenu('index');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Configure the toolbar.
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例5: define
// Include the helper.
require_once __DIR__ . '/helper.php';
if (!defined('FINDER_PATH_INDEXER')) {
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer');
}
JLoader::register('FinderIndexerQuery', FINDER_PATH_INDEXER . '/query.php');
// Check for OpenSearch
if ($params->get('opensearch', 1)) {
/*
This code intentionally commented
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$ostitle = $params->get('opensearch_title', JText::_('MOD_FINDER_SEARCHBUTTON_TEXT') . ' ' . $app->getCfg('sitename'));
$doc->addHeadLink(
JURI::getInstance()->toString(array('scheme', 'host', 'port')) . JRoute::_('&option=com_finder&format=opensearch'),
'search', 'rel', array('title' => $ostitle, 'type' => 'application/opensearchdescription+xml')
);
*/
}
// Initialize module parameters.
$params->def('field_size', 20);
// Get the route.
$route = FinderHelperRoute::getSearchRoute($params->get('searchfilter', null));
// Load component language file.
FinderHelperLanguage::loadComponentLanguage();
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
// Get Smart Search query object.
$query = modFinderHelper::getQuery($params);
require JModuleHelper::getLayoutPath('mod_finder', $params->get('layout', 'default'));
示例6: slider
/**
* Method to generate filters using the slider widget and decorated
* with the FinderFilter JavaScript behaviors.
*
* @param array $options An array of configuration options. [optional]
*
* @return mixed A rendered HTML widget on success, null otherwise.
*
* @since 2.5
*/
public static function slider($options = array())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$html = '';
$filter = null;
// Get the configuration options.
$filterId = array_key_exists('filter_id', $options) ? $options['filter_id'] : null;
$activeNodes = array_key_exists('selected_nodes', $options) ? $options['selected_nodes'] : array();
$classSuffix = array_key_exists('class_suffix', $options) ? $options['class_suffix'] : '';
// Load the predefined filter if specified.
if (!empty($filterId)) {
$query->select('f.data, f.params')->from($db->quoteName('#__finder_filters') . ' AS f')->where('f.filter_id = ' . (int) $filterId);
// Load the filter data.
$db->setQuery($query);
try {
$filter = $db->loadObject();
} catch (RuntimeException $e) {
return null;
}
// Initialize the filter parameters.
if ($filter) {
$registry = new Registry();
$registry->loadString($filter->params);
$filter->params = $registry;
}
}
// Build the query to get the branch data and the number of child nodes.
$query->clear()->select('t.*, count(c.id) AS children')->from($db->quoteName('#__finder_taxonomy') . ' AS t')->join('INNER', $db->quoteName('#__finder_taxonomy') . ' AS c ON c.parent_id = t.id')->where('t.parent_id = 1')->where('t.state = 1')->where('t.access IN (' . $groups . ')')->group('t.id, t.parent_id, t.state, t.access, t.ordering, t.title, c.parent_id')->order('t.ordering, t.title');
// Limit the branch children to a predefined filter.
if ($filter) {
$query->where('c.id IN(' . $filter->data . ')');
}
// Load the branches.
$db->setQuery($query);
try {
$branches = $db->loadObjectList('id');
} catch (RuntimeException $e) {
return null;
}
// Check that we have at least one branch.
if (count($branches) === 0) {
return null;
}
$branch_keys = array_keys($branches);
$html .= JHtml::_('bootstrap.startAccordion', 'accordion', array('parent' => true, 'active' => 'accordion-' . $branch_keys[0]));
// Load plugin language files.
FinderHelperLanguage::loadPluginLanguage();
// Iterate through the branches and build the branch groups.
foreach ($branches as $bk => $bv) {
// If the multi-lang plugin is enabled then drop the language branch.
if ($bv->title == 'Language' && JLanguageMultilang::isEnabled()) {
continue;
}
// Build the query to get the child nodes for this branch.
$query->clear()->select('t.*')->from($db->quoteName('#__finder_taxonomy') . ' AS t')->where('t.parent_id = ' . (int) $bk)->where('t.state = 1')->where('t.access IN (' . $groups . ')')->order('t.ordering, t.title');
// Self-join to get the parent title.
$query->select('e.title AS parent_title')->join('LEFT', $db->quoteName('#__finder_taxonomy', 'e') . ' ON ' . $db->quoteName('e.id') . ' = ' . $db->quoteName('t.parent_id'));
// Load the branches.
$db->setQuery($query);
try {
$nodes = $db->loadObjectList('id');
} catch (RuntimeException $e) {
return null;
}
// Translate node titles if possible.
$lang = JFactory::getLanguage();
foreach ($nodes as $nk => $nv) {
if (trim($nv->parent_title, '**') == 'Language') {
$title = FinderHelperLanguage::branchLanguageTitle($nv->title);
} else {
$key = FinderHelperLanguage::branchPlural($nv->title);
$title = $lang->hasKey($key) ? JText::_($key) : $nv->title;
}
$nodes[$nk]->title = $title;
}
// Adding slides
$html .= JHtml::_('bootstrap.addSlide', 'accordion', JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL', JText::_(FinderHelperLanguage::branchSingular($bv->title)) . ' - ' . count($nodes)), 'accordion-' . $bk);
// Populate the toggle button.
$html .= "<button class=\"btn\" type=\"button\" class=\"jform-rightbtn\" onclick=\"jQuery('[id=tax-" . $bk . "]').each(function(){this.click();});\"><span class=\"icon-checkbox-partial\"></span> " . JText::_('JGLOBAL_SELECTION_INVERT') . "</button><hr/>";
// Populate the group with nodes.
foreach ($nodes as $nk => $nv) {
// Determine if the node should be checked.
$checked = in_array($nk, $activeNodes) ? ' checked="checked"' : '';
// Build a node.
$html .= '<div class="control-group">';
$html .= '<div class="controls">';
$html .= '<label class="checkbox" tax-' . $bk . '>';
//.........这里部分代码省略.........
示例7: slider
/**
* Method to generate filters using the slider widget and decorated
* with the FinderFilter JavaScript behaviors.
*
* @param array $options An array of configuration options. [optional]
*
* @return mixed A rendered HTML widget on success, null otherwise.
*
* @since 2.5
*/
public static function slider($options = array())
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$html = '';
$filter = null;
// Get the configuration options.
$filterId = array_key_exists('filter_id', $options) ? $options['filter_id'] : null;
$activeNodes = array_key_exists('selected_nodes', $options) ? $options['selected_nodes'] : array();
$classSuffix = array_key_exists('class_suffix', $options) ? $options['class_suffix'] : '';
$loadMedia = array_key_exists('load_media', $options) ? $options['load_media'] : true;
// Load the predefined filter if specified.
if (!empty($filterId)) {
$query->select($db->quoteName('f.data') . ', ' . $db->quoteName('f.params'));
$query->from($db->quoteName('#__finder_filters') . ' AS f');
$query->where($db->quoteName('f.filter_id') . ' = ' . (int) $filterId);
// Load the filter data.
$db->setQuery($query);
try {
$filter = $db->loadObject();
} catch (RuntimeException $e) {
return null;
}
// Initialize the filter parameters.
if ($filter) {
$registry = new JRegistry();
$registry->loadString($filter->params);
$filter->params = $registry;
}
}
// Build the query to get the branch data and the number of child nodes.
$query->clear();
$query->select('t.*, count(c.id) AS children');
$query->from($db->quoteName('#__finder_taxonomy') . ' AS t');
$query->join('INNER', $db->quoteName('#__finder_taxonomy') . ' AS c ON c.parent_id = t.id');
$query->where($db->quoteName('t.parent_id') . ' = 1');
$query->where($db->quoteName('t.state') . ' = 1');
$query->where($db->quoteName('t.access') . ' IN (' . $groups . ')');
$query->where($db->quoteName('c.state') . ' = 1');
$query->where($db->quoteName('c.access') . ' IN (' . $groups . ')');
$query->group('t.id, t.parent_id, t.state, t.access, t.ordering, t.title, c.parent_id');
$query->order('t.ordering, t.title');
// Limit the branch children to a predefined filter.
if ($filter) {
$query->where('c.id IN(' . $filter->data . ')');
}
// Load the branches.
$db->setQuery($query);
try {
$branches = $db->loadObjectList('id');
} catch (RuntimeException $e) {
return null;
}
// Check that we have at least one branch.
if (count($branches) === 0) {
return null;
}
// Load the CSS/JS resources.
if ($loadMedia) {
JHtml::stylesheet('com_finder/sliderfilter.css', false, true, false);
JHtml::script('com_finder/sliderfilter.js', false, true);
}
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
// Start the widget.
$html .= '<div id="finder-filter-container">';
$html .= '<dl id="branch-selectors">';
$html .= '<dt>';
$html .= '<label for="tax-select-all" class="checkbox">';
$html .= '<input type="checkbox" id="tax-select-all" />';
$html .= JText::_('COM_FINDER_FILTER_SELECT_ALL_LABEL');
$html .= '</label>';
$html .= '</dt>';
$html .= '<div class="control-group">';
// Iterate through the branches to build the branch selector.
foreach ($branches as $bk => $bv) {
// If the multi-lang plug-in is enabled then drop the language branch.
if ($bv->title == 'Language' && JLanguageMultilang::isEnabled()) {
continue;
}
$html .= '<label for="tax-' . $bk . '" class="checkbox">';
$html .= '<input type="checkbox" class="toggler" id="tax-' . $bk . '"/>';
$html .= JText::sprintf('COM_FINDER_FILTER_BRANCH_LABEL', JText::_(FinderHelperLanguage::branchSingular($bv->title)));
$html .= '</label>';
}
$html .= '</div>';
$html .= '</dl>';
$html .= '<div id="finder-filter-container">';
//.........这里部分代码省略.........