本文整理汇总了PHP中FlexicontentHelperRoute类的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperRoute类的具体用法?PHP FlexicontentHelperRoute怎么用?PHP FlexicontentHelperRoute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlexicontentHelperRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLoc
public static function getLoc(&$params)
{
$catid = $params->get('catid');
$fieldaddressid = $params->get('fieldaddressid');
//var_dump ($catid);
global $globalcats;
//var_dump ($globalcats);
$catlist = !empty($globalcats[$catid]->descendants) ? $globalcats[$catid]->descendants : $catid;
$catids_join = 'JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = a.id ';
//var_dump ($catlist);
$catids_where = ' rel.catid IN (' . $catlist . ') ';
//var_dump ($catids_where);
// recupere la connexion à la BD
if (!empty($fieldaddressid)) {
$count = $params->get('count');
$forced_itemid = $params->get('forced_itemid', '');
$db = JFactory::getDbo();
$queryLoc = 'SELECT a.id, a.title, b.field_id, b.value , a.catid FROM #__content AS a LEFT JOIN #__flexicontent_fields_item_relations AS b ON a.id = b.item_id ' . $catids_join . ' WHERE b.field_id = ' . $fieldaddressid . ' AND ' . $catids_where . ' AND state = 1 ORDER BY title ' . $count;
//var_dump ($queryLoc);
$db->setQuery($queryLoc);
$itemsLoc = $db->loadObjectList();
//var_dump ($itemsLoc);
foreach ($itemsLoc as &$itemLoc) {
$id = $itemLoc->id;
//$itemLoc->link = JRoute::_( FlexicontentHelperRoute::getItemRoute($id, $catid ) );
$itemLoc->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($itemLoc->id, $itemLoc->catid, $forced_itemid, $itemLoc));
}
return $itemsLoc;
} else {
echo JText::_('FLEXI_GOOGLEMAP_ADRESSFORGOT');
}
}
示例2: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);
$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'item') {
if ($id) {
//$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);
$associations = FlexicontentHelperAssociation::getItemAssociations($id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = FlexicontentHelperRoute::getItemRoute($item->id, $item->catid, 0, $item);
}
return $return;
}
} else {
if ($view == 'category') {
$cid = $jinput->getInt('cid');
if ($cid) {
$associations = FlexicontentHelperAssociation::getCatAssociations($cid);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = FlexicontentHelperRoute::getCategoryRoute($item->catid, 0, array(), $item);
}
return $return;
}
}
}
return array();
}
示例3: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
//initialise variables
$document = JFactory::getDocument();
$user = JFactory::getUser();
$bar = JToolBar::getInstance('toolbar');
$cparams = JComponentHelper::getParams('com_flexicontent');
//get vars
$cid = JRequest::getVar('cid');
//add css to document
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VERSION);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VERSION);
// Add JS frameworks
//flexicontent_html::loadFramework('select2');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VERSION);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VERSION);
//Get data from the model
$model = $this->getModel();
$row = $this->get('Tag');
//create the toolbar
if ($cid) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_TAG'), 'tagedit');
$base = str_replace('administrator/', '', JURI::base());
$autologin = '';
// $cparams->get('autoflogin', 1) ? '&fcu='.$user->username . '&fcp='.$user->password : '';
// Add a preview button
$previewlink = $base . JRoute::_(FlexicontentHelperRoute::getTagRoute($row->id)) . $autologin;
$bar->appendButton('Custom', '<a class="preview" href="' . $previewlink . '" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-32-preview"></span>' . JText::_('Preview') . '</a>', 'preview');
} else {
JToolBarHelper::title(JText::_('FLEXI_NEW_TAG'), 'tagadd');
}
if (FLEXI_J16GE) {
JToolBarHelper::apply('tags.apply');
JToolBarHelper::save('tags.save');
JToolBarHelper::custom('tags.saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel('tags.cancel');
} else {
JToolBarHelper::apply();
JToolBarHelper::save();
JToolBarHelper::custom('saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel();
}
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$mainframe->redirect('index.php?option=com_flexicontent&view=tags');
}
}
//clean data
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
//assign data to template
$this->assignRef('row', $row);
parent::display($tpl);
}
示例4: getObjectLink
function getObjectLink($id)
{
require_once JPATH_ROOT . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'route.php';
$db =& JFactory::getDBO();
$query = 'SELECT CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as slug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ' FROM #__content AS i' . ' LEFT JOIN #__categories AS c ON c.id = i.catid' . ' WHERE i.id = ' . $id;
$db->setQuery($query);
$row = $db->loadObject();
$link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->categoryslug));
return $link;
}
示例5: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
static $author_links = array();
if (!isset($author_links[$item->created_by])) {
$author_links[$item->created_by] = JRoute::_(FlexicontentHelperRoute::getCategoryRoute(0, 0, array('layout' => 'author', 'authorid' => $item->created_by)));
}
$field->{$prop} = '<a href="' . $author_links[$item->created_by] . '" itemprop="author">' . JText::_('FLEXI_FIELD_AI_MORE_ITEMS_BY_THIS_AUTHOR') . '</a>';
}
示例6: getObjectInfo
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$routerHelper = JPATH_ROOT . '/components/com_flexicontent/helpers/route.php';
if (is_file($routerHelper)) {
require_once $routerHelper;
$db = JFactory::getDBO();
$query = 'SELECT i.id, i.title, i.access, i.created_by ' . ' , CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as slug' . ' , CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__content AS i' . ' LEFT JOIN #__categories AS c ON c.id = i.catid' . ' WHERE i.id = ' . $id;
$db->setQuery($query);
$row = $db->loadObject();
if (!empty($row)) {
$info->title = $row->title;
$info->access = $row->access;
$info->userid = $row->created_by;
$info->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->catslug));
}
}
return $info;
}
示例7: getLinks
public function getLinks($args)
{
$view = isset($args->view) ? $args->view : '';
if (!($view = 'tags')) {
return array();
}
$items = array();
require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'route.php';
$db =& JFactory::getDBO();
$query = $db->getQuery(true);
$query->clear();
$query->select('t.name, t.id, CASE WHEN CHAR_LENGTH(t.alias) THEN CONCAT_WS(\':\', t.id, t.alias) ELSE t.id END as slug ');
$query->from('#__flexicontent_tags AS t ');
$query->where('t.published = 1 ');
$query->order('t.name ASC');
$db->setQuery($query);
$tags = $db->loadObjectList();
foreach ($tags as $tag) {
$items[] = array('id' => FlexicontentHelperRoute::getTagRoute($tag->slug), 'name' => $tag->name, 'class' => 'fileflexitag');
}
return $items;
}
示例8: onContentSearch
//.........这里部分代码省略.........
$and_where_filters = count($filters_where) ? implode(" ", $filters_where) : '';
// ************************************************
// Set variables used by filters creation mechanism
// ************************************************
global $fc_searchview;
$fc_searchview['join_clauses'] = $join_clauses;
$fc_searchview['join_clauses_with_text'] = $join_clauses_with_text;
$fc_searchview['where_conf_only'] = $where_conf;
// WHERE of the view (mainly configuration dependent)
$fc_searchview['filters_where'] = $filters_where;
// WHERE of the filters
$fc_searchview['search'] = $text_where;
// WHERE for text search
$fc_searchview['params'] = $params;
// view's parameters
// *****************************************************************************************************
// Execute search query. NOTE this is skipped it if (a) no text-search and no (b) no filters are active
// *****************************************************************************************************
// Do not check for 'contentypes' this are based on configuration and not on form submitted data,
// considering contenttypes or other configuration based parameters, will return all items on initial search view display !
if (!count($filters_where) && !strlen($text)) {
return array();
}
$print_logging_info = $params->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
// *****************************************
// Overcome possible group concat limitation
// *****************************************
$query = "SET SESSION group_concat_max_len = 9999999";
$db->setQuery($query);
$db->execute();
// *************
// Get the items
// *************
$query = 'SELECT SQL_CALC_FOUND_ROWS i.id' . $orderby_col . ' FROM #__content AS i' . $join_clauses_with_text . $orderby_join . $joinaccess . $where_conf . $and_where_filters . ' GROUP BY i.id ' . $orderby;
//echo "Adv search plugin main SQL query: ".nl2br($query)."<br/><br/>";
// NOTE: The plugin will return a PRECONFIGURED limited number of results, the SEARCH VIEW to do the pagination, splicing (appropriately) the data returned by all search plugins
try {
// Get items, we use direct query because some extensions break the SQL_CALC_FOUND_ROWS, so let's bypass them (at this point it is OK)
// *** Usage of FOUND_ROWS() will fail when (e.g.) Joom!Fish or Falang are installed, in this case we will be forced to re-execute the query ...
// PLUS, we don't need Joom!Fish or Falang layer at --this-- STEP which may slow down the query considerably in large sites
$query_limited = $query . ' LIMIT ' . $search_limit . ' OFFSET 0';
$rows = flexicontent_db::directQuery($query_limited);
$item_ids = array();
foreach ($rows as $row) {
$item_ids[] = $row->id;
}
// Get current items total for pagination
$db->setQuery("SELECT FOUND_ROWS()");
$fc_searchview['view_total'] = $db->loadResult();
$app->setUserState('fc_view_total_' . $view, $fc_searchview['view_total']);
} catch (Exception $e) {
// Get items via normal joomla SQL layer
$db->setQuery(str_replace('SQL_CALC_FOUND_ROWS', '', $query), 0, $search_limit);
$item_ids = $db->loadColumn(0);
}
if (!count($item_ids)) {
return array();
}
// No items found
// *****************
// Get the item data
// *****************
$query_data = 'SELECT i.id, i.title AS title, i.created, i.id AS fc_item_id, i.access, ie.type_id, i.language' . (!$txtmode ? ', ie.search_index AS text' : ', GROUP_CONCAT(ts.search_index ORDER BY f.ordering ASC SEPARATOR \' \') AS text') . ', CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as slug' . ', CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as categoryslug' . ', CONCAT_WS( " / ", ' . $db->Quote($searchFlexicontent) . ', c.title, i.title ) AS section' . $select_access . ' FROM #__content AS i' . $join_clauses . $join_textsearch . $join_textfields . ' WHERE i.id IN (' . implode(',', $item_ids) . ') ' . ' GROUP BY i.id ' . ' ORDER BY FIELD(i.id, ' . implode(',', $item_ids) . ')';
//echo nl2br($query)."<br/><br/>";
$db->setQuery($query_data);
$list = $db->loadObjectList();
if ($db->getErrorNum()) {
echo $db->getErrorMsg();
}
if ($print_logging_info) {
@($fc_run_times['search_query_runtime'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
// *************************************
// Create item links and other variables
// *************************************
//echo "<pre>"; print_r($list); echo "</pre>";
if ($list) {
if (count($list) >= $search_limit) {
$app->setUserState('fc_view_limit_max_' . $view, $search_limit);
}
$item_cats = FlexicontentFields::_getCategories($list);
foreach ($list as $key => $item) {
$item->text = preg_replace('/\\b' . $search_prefix . '/', '', $item->text);
$item->categories = isset($item_cats[$item->id]) ? $item_cats[$item->id] : array();
// in case of item categories missing
// If joomla article view is allowed allowed and then search view may optional create Joomla article links
if ($typeData[$item->type_id]->params->get('allow_jview', 0) && $typeData[$item->type_id]->params->get('search_jlinks', 1)) {
$item->href = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->categoryslug, $item->language));
} else {
$item->href = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item));
}
$item->browsernav = $browsernav;
}
}
return $list;
}
示例9: display
//.........这里部分代码省略.........
// Add css to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
// Add js function to overload the joomla submitform
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/admin.js');
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/validate.js');
// ********************
// Initialise variables
// ********************
$editor_name = $user->getParam('editor', $app->getCfg('editor'));
$editor = JFactory::getEditor($editor_name);
$cparams = JComponentHelper::getParams('com_flexicontent');
$bar = JToolBar::getInstance('toolbar');
if (!FLEXI_J16GE) {
$pane = JPane::getInstance('sliders');
$tpane = JPane::getInstance('tabs', array('startOffset' => 0, 'allowAllClose' => true, 'opacityTransition' => true, 'duration' => 600));
}
$categories = $globalcats;
// ******************
// Create the toolbar
// ******************
// Create Toolbar title and add the preview button
if (!$isnew) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_CATEGORY'), 'fc_categoryedit');
$autologin = $cparams->get('autoflogin', 1) ? '&fcu=' . $user->username . '&fcp=' . $user->password : '';
$previewlink = JRoute::_(JURI::root() . FlexicontentHelperRoute::getCategoryRoute($categories[$cid]->slug)) . $autologin;
// Add a preview button
$bar->appendButton('Custom', '<a class="preview btn btn-small" href="' . $previewlink . '" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-32-preview"></span>' . JText::_('Preview') . '</a>', 'preview');
} else {
JToolBarHelper::title(JText::_('FLEXI_NEW_CATEGORY'), 'fc_categoryadd');
}
// Add apply and save buttons
if (FLEXI_J16GE) {
JToolBarHelper::apply('category.apply');
JToolBarHelper::save('category.save');
} else {
JToolBarHelper::apply();
JToolBarHelper::save();
}
// Add a save and new button, if user can create inside at least one (com_content) category
if ($cancreate_cat) {
if (FLEXI_J16GE) {
JToolBarHelper::save2new('category.save2new');
} else {
JToolBarHelper::custom('saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
}
}
// Add a save as copy button, if editing an existing category (J2.5 only)
if (FLEXI_J16GE && !$isnew && $cancreate_cat) {
JToolBarHelper::save2copy('category.save2copy');
}
// Add a cancel or close button
if ($isnew) {
if (FLEXI_J16GE) {
JToolBarHelper::cancel('category.cancel');
} else {
JToolBarHelper::cancel();
}
示例10: display
//.........这里部分代码省略.........
}
// Set remaining META keys
$mdata = $item->metadata->toArray();
foreach ($mdata as $k => $v) {
if ($v) {
$document->setMetadata($k, $v);
}
}
// Overwrite with menu META data if menu matched
if ($menu_matches) {
if ($_mp = $menu->params->get('menu-meta_description')) {
$document->setDescription($_mp);
}
if ($_mp = $menu->params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $_mp);
}
if ($_mp = $menu->params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
if ($_mp = $menu->params->get('secure')) {
$document->setMetadata('secure', $_mp);
}
}
// ****************************************************************
// Make sure Joomla SEF plugin has inserted a correct REL canonical
// or that it has not insert any REL if current URL is sufficient
// ****************************************************************
if ($params->get('add_canonical')) {
// Get canonical URL that SEF plugin adds, also $domain passed by reference, to get the domain configured in SEF plugin (multi-domain website)
$domain = null;
$defaultCanonical = flexicontent_html::getDefaultCanonical($domain);
$domain = $domain ? $domain : $uri->toString(array('scheme', 'host', 'port'));
// Create desired REL canonical URL
$ucanonical = $domain . JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $globalcats[$item->maincatid]->slug, 0, $item));
// $item->categoryslug
// Check if SEF plugin inserted a different REL canonical
if ($defaultCanonical != $ucanonical) {
// Add REL canonical only if different than current URL
$head_obj = $document->addHeadLink(htmlspecialchars($ucanonical), 'canonical', 'rel', '');
if ($uri->toString() == $ucanonical) {
unset($head_obj->_links[htmlspecialchars($ucanonical)]);
}
// Remove canonical inserted by SEF plugin
unset($head_obj->_links[htmlspecialchars($defaultCanonical)]);
}
}
// *************************
// increment the hit counter
// *************************
// MOVED to flexisystem plugin due to ...
/*if (FLEXIUtilities::count_new_hit($item->id) ) {
$model->hit();
}*/
// Load template css/js and set template data variable
$tmplvar = $themes->items->{$ilayout}->tmplvar;
if ($ilayout) {
// Add the templates css files if availables
if (isset($themes->items->{$ilayout}->css)) {
foreach ($themes->items->{$ilayout}->css as $css) {
$document->addStyleSheet($this->baseurl . '/' . $css);
}
}
// Add the templates js files if availables
if (isset($themes->items->{$ilayout}->js)) {
foreach ($themes->items->{$ilayout}->js as $js) {
$document->addScript($this->baseurl . '/' . $js);
示例11: flexi_submit
<button class="<?php
echo $btn_class;
?>
btn-success" type="button" onclick="return flexi_submit('save_a_preview', 'flexi_form_submit_btns', 'flexi_form_submit_msg');">
<span class="fcbutton_preview_save"><?php
echo JText::_(!$isnew ? 'FLEXI_SAVE_A_PREVIEW' : 'FLEXI_ADD_A_PREVIEW');
?>
</span>
</button>
<?php
}
?>
<?php
$params = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,left=50,width=\'+((screen.width-100) > 1360 ? 1360 : (screen.width-100))+\',top=20,height=\'+((screen.width-160) > 100 ? 1000 : (screen.width-160))+\',directories=no,location=no';
$link = JRoute::_(FlexicontentHelperRoute::getItemRoute($this->item->id . ':' . $this->item->alias, $this->item->catid, 0, $this->item) . '&preview=1');
?>
<?php
if (in_array('preview_latest', $allowbuttons_fe) && !$isredirected_after_submit && !$isnew) {
?>
<button class="<?php
echo $btn_class;
?>
btn-default" type="button" onclick="window.open('<?php
echo $link;
?>
','preview2','<?php
echo $params;
?>
'); return false;">
示例12: foreach
<?php
foreach ($categories as $category) {
$catid = $category->id;
// Exclude the "noroute" categories (e.g. "Main slideshow", or other special categories that should NOT be displayed !)
if (in_array($catid, @$globalnoroute)) {
continue;
}
// Performance concern, only do routing once per category
if ($link_to_view && !isset($cat_links[$catid])) {
$cat_links[$catid] = JRoute::_(FlexicontentHelperRoute::getCategoryRoute($category->slug));
}
// With / without link
$isMain = $catid == $item->catid;
$display = $link_to_view ? '<a class="fc_categories fc_category_' . $catid . ' ' . ($isMain ? 'fc_ismain_cat' : '') . ' link_' . $field->name . '" href="' . $cat_links[$catid] . '">' . $category->title . '</a>' : '<span class="fc_categories fc_category_' . $catid . ' ' . ($isMain ? 'fc_ismain_cat' : '') . ' nolink_' . $field->name . '">' . $category->title . '</span>';
$isMain ? array_unshift($field->{$prop}, $pretext . $display . $posttext) : ($field->{$prop}[] = $pretext . $display . $posttext);
// Some extra data
$field->value[] = $category->title;
}
示例13: _replaceContent
private function _replaceContent(&$tag)
{
$oldFormat = empty($tag->format);
if (!ACYMAILING_J16) {
$query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, c.image AS catpict, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
$query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
$query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
$query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
$query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
} else {
$query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, c.params AS catparams FROM ' . acymailing_table('content', false) . ' as a ';
$query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
$query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
$query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
}
$this->db->setQuery($query);
$article = $this->db->loadObject();
if (empty($article)) {
$app = JFactory::getApplication();
if ($app->isAdmin()) {
$app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
}
return '';
}
if (empty($tag->lang) && !empty($this->newslanguage) && !empty($this->newslanguage->lang_code)) {
$tag->lang = $this->newslanguage->lang_code . ',' . $this->newslanguage->lang_id;
}
$this->acypluginsHelper->translateItem($article, $tag, 'content');
$varFields = array();
foreach ($article as $fieldName => $oneField) {
$varFields['{' . $fieldName . '}'] = $oneField;
}
$this->acypluginsHelper->cleanHtml($article->introtext);
$this->acypluginsHelper->cleanHtml($article->fulltext);
if ($this->params->get('integration') == 'jreviews' && !empty($article->images)) {
$firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
if (!empty($firstpict[0])) {
$picturePath = file_exists(ACYMAILING_ROOT . 'images' . DS . 'stories' . DS . str_replace('/', DS, $firstpict[0])) ? ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] : ACYMAILING_LIVE . 'images/' . $firstpict[0];
$myPict = '<img src="' . $picturePath . '" alt="" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
$article->introtext = $myPict . $article->introtext;
}
}
$completeId = $article->id;
$completeCat = $article->catid;
if (!empty($article->alias)) {
$completeId .= ':' . $article->alias;
}
if (!empty($article->catalias)) {
$completeCat .= ':' . $article->catalias;
}
if (empty($tag->itemid)) {
if (!ACYMAILING_J16) {
$completeSec = $article->sectionid;
if (!empty($article->secalias)) {
$completeSec .= ':' . $article->secalias;
}
if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
$link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
} else {
$link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
}
} else {
if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
$link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
} else {
$link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
}
}
} else {
$link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
}
if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
$link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
} elseif ($this->params->get('integration') == 'jaggyblog') {
$link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
}
if (!empty($tag->itemid)) {
$link .= '&Itemid=' . $tag->itemid;
}
if (!empty($tag->lang)) {
$link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
}
if (!empty($tag->autologin)) {
$link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
}
if (empty($tag->lang) && !empty($article->language) && $article->language != '*') {
if (!isset($this->langcodes[$article->language])) {
$this->db->setQuery('SELECT sef FROM #__languages WHERE lang_code = ' . $this->db->Quote($article->language) . ' ORDER BY `published` DESC LIMIT 1');
$this->langcodes[$article->language] = $this->db->loadResult();
if (empty($this->langcodes[$article->language])) {
$this->langcodes[$article->language] = $article->language;
}
}
$link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . $this->langcodes[$article->language];
}
$link = acymailing_frontendLink($link);
$varFields['{link}'] = $link;
$afterTitle = '';
$afterArticle = '';
$contentText = '';
//.........这里部分代码省略.........
示例14: display
/**
* Creates the RSS for the View
*
* @since 1.0
*/
function display($tpl = null)
{
$db = JFactory::getDBO();
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$params = $this->get('Params');
$doc->link = JRoute::_('index.php?option=com_flexicontent&view=flexicontent&rootcat=' . (int) $params->get('rootcat', FLEXI_J16GE ? 1 : 0));
JRequest::setVar('limit', $params->get('feed_limit'));
// Force a specific limit, this will be moved to the model
$cats = $this->get('Feed');
//$feed_summary = $params->get('feed_summary', 0);
$feed_summary_cut = $params->get('feed_summary_cut', 200);
$feed_use_image = $params->get('feed_use_image', 1);
$feed_image_source = $params->get('feed_image_source', '');
$feed_link_image = $params->get('feed_link_image', 1);
$feed_image_method = $params->get('feed_image_method', 1);
$feed_image_width = $params->get('feed_image_width', 100);
$feed_image_height = $params->get('feed_image_height', 80);
// Retrieve default image for the image field
if ($feed_use_image && $feed_image_source) {
$query = 'SELECT attribs, name FROM #__flexicontent_fields WHERE id = ' . (int) $feed_image_source;
$db->setQuery($query);
$image_dbdata = $db->loadObject();
//$image_dbdata->params = FLEXI_J16GE ? new JRegistry($image_dbdata->params) : new JParameter($image_dbdata->params);
$img_size_map = array('l' => 'large', 'm' => 'medium', 's' => 'small', '' => '');
$img_field_size = $img_size_map[$image_size];
$img_field_name = $image_dbdata->name;
}
foreach ($cats as $cat) {
// strip html from feed item title
$title = $this->escape($cat->title);
$title = html_entity_decode($title);
// url link to article
// & used instead of & as this is converted by feed creator
$link = JRoute::_(FlexicontentHelperRoute::getCategoryRoute($cat->slug));
// strip html from feed item description text
$description = $cat->description;
//$feed_summary ? $cat->description : '';
$description = flexicontent_html::striptagsandcut($description, $feed_summary_cut);
if ($feed_use_image) {
// feed image is enabled
// Get some variables
$joomla_image_path = $app->getCfg('image_path', FLEXI_J16GE ? '' : 'images' . DS . 'stories');
$joomla_image_url = str_replace(DS, '/', $joomla_image_path);
$joomla_image_path = $joomla_image_path ? $joomla_image_path . DS : '';
$joomla_image_url = $joomla_image_url ? $joomla_image_url . '/' : '';
// **************
// CATEGORY IMAGE
// **************
// category image params
$show_cat_image = $params->get('show_description_image', 0);
// we use different name for variable
$cat_image_source = $params->get('cat_image_source', 2);
// 0: extract, 1: use param, 2: use both
$cat_link_image = $params->get('cat_link_image', 1);
$cat_image_method = $params->get('cat_image_method', 1);
$cat_image_width = $params->get('cat_image_width', 80);
$cat_image_height = $params->get('cat_image_height', 80);
$cat =& $category;
$thumb = "";
if ($cat->id && $show_cat_image) {
$cat->image = FLEXI_J16GE ? $params->get('image') : $cat->image;
$thumb = "";
$cat->introtext =& $cat->description;
$cat->fulltext = "";
if ($cat_image_source && $cat->image && JFile::exists(JPATH_SITE . DS . $joomla_image_path . $cat->image)) {
$src = JURI::base(true) . "/" . $joomla_image_url . $cat->image;
$h = '&h=' . $cat_image_height;
$w = '&w=' . $cat_image_width;
$aoe = '&aoe=1';
$q = '&q=95';
$zc = $cat_image_method ? '&zc=' . $cat_image_method : '';
$ext = pathinfo($src, PATHINFO_EXTENSION);
$f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : '';
$conf = $w . $h . $aoe . $q . $zc . $f;
$thumb = JURI::base(true) . '/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $src . $conf;
} else {
if ($cat_image_source != 1 && ($src = flexicontent_html::extractimagesrc($cat))) {
$h = '&h=' . $feed_image_height;
$w = '&w=' . $feed_image_width;
$aoe = '&aoe=1';
$q = '&q=95';
$zc = $feed_image_method ? '&zc=' . $feed_image_method : '';
$ext = pathinfo($src, PATHINFO_EXTENSION);
$f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : '';
$conf = $w . $h . $aoe . $q . $zc . $f;
$base_url = !preg_match("#^http|^https|^ftp|^/#i", $src) ? JURI::base(true) . '/' : '';
$src = $base_url . $src;
$thumb = JURI::base(true) . '/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $src . $conf;
}
}
}
if ($thumb) {
$description = "<a href='" . $link . "'><img src='" . $thumb . "' alt='" . $title . "' title='" . $title . "' align='left'/></a><p>" . $description . "</p>";
}
//.........这里部分代码省略.........
示例15: display
//.........这里部分代码省略.........
$params->set('page_heading', $default_heading);
$params->set('show_page_heading', $show_default_heading);
$params->set('show_page_title', $show_default_heading);
}
// Prevent showing the page heading if ... currently no reason
if (0) {
$params->set('show_page_heading', 0);
$params->set('show_page_title', 0);
}
// ************************************************************
// Create the document title, by from page title and other data
// ************************************************************
// Use the page heading as document title, (already calculated above via 'appropriate' logic ...)
$doc_title = $params->get('page_title');
// Check and prepend or append site name
if (FLEXI_J16GE) {
// Not available in J1.5
// Add Site Name to page title
if ($app->getCfg('sitename_pagetitles', 0) == 1) {
$doc_title = $app->getCfg('sitename') . " - " . $doc_title;
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$doc_title = $doc_title . " - " . $app->getCfg('sitename');
}
}
// Finally, set document title
$document->setTitle($doc_title);
// ************************
// Set document's META tags
// ************************
// Workaround for Joomla not setting the default value for 'robots', so component must do it
$app_params = $app->getParams();
if ($_mp = $app_params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
// Overwrite with menu META data if menu matched
if (FLEXI_J16GE) {
if ($menu_matches) {
if ($_mp = $menu->params->get('menu-meta_description')) {
$document->setDescription($_mp);
}
if ($_mp = $menu->params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $_mp);
}
if ($_mp = $menu->params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
if ($_mp = $menu->params->get('secure')) {
$document->setMetadata('secure', $_mp);
}
}
}
// ************************************
// Add rel canonical html head link tag (TODO: improve multi-page handing)
// ************************************
$base = $uri->getScheme() . '://' . $uri->getHost();
$start = JRequest::getVar('start', '');
$start = $start ? "&start=" . $start : "";
$ucanonical = $base . JRoute::_(FlexicontentHelperRoute::getTagRoute($tag->id) . $start);
if ($params->get('add_canonical')) {
$head_obj = $document->addHeadLink($ucanonical, 'canonical', 'rel', '');
$defaultCanonical = flexicontent_html::getDefaultCanonical();
if (FLEXI_J30GE && $defaultCanonical != $ucanonical) {
unset($head_obj->_links[$defaultCanonical]);
}
}
//ordering
$filter_order = JRequest::getCmd('filter_order', 'i.title');
$filter_order_Dir = JRequest::getCmd('filter_order_Dir', 'ASC');
$filter = JRequest::getString('filter');
$lists = array();
$lists['filter_order'] = $filter_order;
$lists['filter_order_Dir'] = $filter_order_Dir;
$lists['filter'] = $filter;
// Create the pagination object
$pageNav = $this->get('pagination');
// Create links, etc
$link = JRoute::_(FlexicontentHelperRoute::getTagRoute($tag->slug), false);
//$print_link = JRoute::_('index.php?view=tags&id='.$tag->slug.'&pop=1&tmpl=component');
$curr_url = $_SERVER['REQUEST_URI'];
$print_link = $curr_url . (strstr($curr_url, '?') ? '&' : '?') . 'pop=1&tmpl=component&print=1';
$pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->assignRef('action', $link);
// $uri->toString()
$this->assignRef('print_link', $print_link);
$this->assignRef('tag', $tag);
$this->assignRef('items', $items);
$this->assignRef('lists', $lists);
$this->assignRef('params', $params);
$this->assignRef('pageNav', $pageNav);
$this->assignRef('pageclass_sfx', $pageclass_sfx);
$print_logging_info = $params->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
parent::display($tpl);
if ($print_logging_info) {
@($fc_run_times['template_render'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
}