本文整理汇总了PHP中AkrecipesFrontendHelper类的典型用法代码示例。如果您正苦于以下问题:PHP AkrecipesFrontendHelper类的具体用法?PHP AkrecipesFrontendHelper怎么用?PHP AkrecipesFrontendHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AkrecipesFrontendHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: onContentPrepare
/**
* prepare content method, search for string {loadcontest_##} , where ## is the contest id.
* if found render the contest.
*
* Method is called by the view
*
* @param string The context of the content being passed to the plugin.
* @param object The content object. Note $article->text is also available
* @param object The content params
* @param integer The 'page' number
* @since 1.6
*/
public function onContentPrepare($context, &$article, &$params, $limitstart)
{
//error_log("In plgContentAkcontests::onContentPrepare");
// Don't run this plugin when the content is being indexed
if ($context == 'com_finder.indexer') {
return true;
}
$app = JFactory::getApplication();
// Simple performance check to determine whether bot should process further
if (strpos($article->text, 'loadcontest') === false) {
return true;
}
// Expression to search for (positions)
$regex = '/{loadcontest\\s(.*?)}/i';
// Find all instances of plugin and put in $matchesmod for loadmodule
preg_match_all($regex, $article->text, $matches, PREG_SET_ORDER);
// If no matches, skip this
if ($matches) {
foreach ($matches as $matchedcontest) {
$contest_id = $matchedcontest[1];
$contest_model = AkrecipesFrontendHelper::getModel('Contest');
$contest_item = $contest_model->getData($contest_id);
$output = $this->renderContest($contest_item);
// We should replace only first occurrence in order to allow positions with the same name to regenerate their content:
$article->text = preg_replace("|{$matchedcontest['0']}|", addcslashes($output, '\\$'), $article->text, 1);
}
}
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:40,代码来源:akcontests.php
示例2: parse
/**
* Parse method for URLs
* This method is meant to transform the human readable URL back into
* query parameters. It is only executed when SEF mode is switched on.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$vars = array();
// View is always the first element of the array
$vars['view'] = array_shift($segments);
$model = AkrecipesFrontendHelper::getModel($vars['view']);
while (!empty($segments)) {
$segment = array_pop($segments);
// If it's the ID, let's put on the request
if (is_numeric($segment)) {
$vars['id'] = $segment;
} else {
$vars['task'] = $vars['view'] . '.' . $segment;
}
}
return $vars;
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:28,代码来源:router.php
示例3:
<h3><?php
echo $item->contest_name;
?>
</h3>
</a>
<?php
echo $contest_state;
?>
<p><?php
echo $contest_introtext;
?>
</p>
<?php
if (AkrecipesFrontendHelper::isContestLive($item)) {
?>
<div class="contest-participate-btn">
<a class="btn btn-primary btn-xs" role="button" href="<?php
echo $contest_url;
?>
" title="<?php
echo 'Add New Recipe & Participate in ' . $item->contest_name;
?>
">
Participate Now
</a>
<p>Contest Ends : <?php
echo JHtml::_('date', $contest_start_date, JText::_('DATE_FORMAT_LC3'));
?>
</p>
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default.php
示例4: json_decode
$item = $this->item;
require_once JPATH_COMPONENT_SITE . '/helpers/akrecipes.php';
?>
<!-- get article image -->
<?php
$images = json_decode($item->image);
$imagesize = array();
$imagesize['width'] = 140;
$imagesize['height'] = 112;
// 112 = 140/1.25
$image = AkrecipesFrontendHelper::resizeImageToCache($images->image_intro, $imagesize);
$item_url = JRoute::_('index.php?option=com_content&view=article&id=' . (int) $item->id);
$published = $item->state;
$unpublished = AkrecipesFrontendHelper::getRecipeUnpublishedText($item);
?>
<div class="media userArticle mobile <?php
echo $unpublished ? ' system-unpublished ' : '';
?>
">
<div class="pull-left">
<a href="<?php
echo $item_url;
?>
">
<img class="img-thumbnail" src="<?php
echo $image;
?>
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_article_mobile.php
示例5: defined
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Create a shortcut for params.
$params = $this->item->params;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$canEdit = $this->item->params->get('access-edit');
$info = $params->get('info_block_position', 0);
require_once JPATH_SITE . '/components/com_akrecipes/helpers/akrecipeshelper.php';
require_once JPATH_SITE . '/components/com_akrecipes/helpers/akrecipes.php';
$author_url = AkrecipesFrontendHelper::getAuthorURL($this->item->created_by);
$author_obj = AkrecipesHelper::getUserObject($this->item->created_by);
$images = json_decode($this->item->images);
if ($params->get('link_titles')) {
$item_url = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
} else {
$item_url = '#';
}
$item = $this->item;
$colspan = $this->colspan;
?>
<div class="col-md-<?php
echo $colspan;
?>
">
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:blog_item.php
示例6: substr
if (strpos($image, '/') === 0) {
$image = substr($image, 1);
}
$recipe_url = JRoute::_(AkrecipesHelperRoute::getRecipeRoute((int) $item->id, $item->catid));
?>
<a href="<?php
echo $recipe_url;
?>
" class="list-group-item">
<h4 class="list-group-item-heading"><?php
echo $item->recipe_name;
?>
</h4>
<p><?php
echo AkrecipesFrontendHelper::truncate_text($item->recipe_description, 100, true);
?>
</p>
</a>
<?php
}
?>
</div>
<?php
}
?>
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:29,代码来源:blog.php
示例7: _prepareDocument
/**
* Prepares the document
*
* @return void
*
* @throws Exception
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
$this->getUser();
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu) {
$menulink = $menu->link;
}
//error_log("Active menu -->" . print_r($menu,true));
if ($menu && strpos($menulink, 'option=com_akrecipes&view=recipesbyuser') !== false) {
// menu is set and menu is pointing to user page
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
$title = $this->params->get('page_title', '');
} else {
//$this->params->def('page_heading', JText::_('COM_AKRECIPES_DEFAULT_PAGE_TITLE'));
$this->params->def('page_heading', $this->user->name);
}
//error_log("Page Heading = " . $this->params->get('page_heading')) ;
$sitename = $app->get('sitename');
if (empty($title) || $title == $sitename) {
$title = $this->user->name;
} elseif ($app->get('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
} elseif ($app->get('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
if ($this->pagination->pagesCurrent > 1) {
$this->document->setTitle($this->pagination->getPagesCounter() . ' ' . $title);
} else {
$this->document->setTitle($title);
}
// now set the meta description
if ($menu && strpos($menulink, 'option=com_akrecipes&view=recipesbyuser') !== false) {
$meta_description = $this->params->get('menu-meta_description');
}
if (empty($meta_description)) {
$meta_description = AkrecipesFrontendHelper::truncate_text($this->user->akprofile['aboutme'], 150);
}
$metaDescription_prefix = '';
if ($this->pagination->pagesCurrent > 1) {
$metaDescription_prefix = $this->pagination->getPagesCounter() . ' for ';
}
if (!empty($meta_description)) {
$this->document->setDescription($metaDescription_prefix . $meta_description);
}
if ($this->params->get('menu-meta_keywords')) {
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots')) {
$this->document->setMetadata('robots', $this->params->get('robots'));
}
//$this->document->addStylesheet('media/com_akrecipes/css/recipe.css');
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:64,代码来源:view.html.php
示例8:
">Edit</a>
<?php
}
?>
<?php
}
?>
<div class="recipedate">
<?php
echo JHTML::_('date', $recipe->publish_up, JText::_('DATE_FORMAT_LC2'));
?>
</div>
<div class="recipedescription">
<p><?php
echo AkrecipesFrontendHelper::truncate_text($recipe->recipe_description, 300, true);
?>
</p>
</div>
<div class="col-md-12 catBlock">
<?php
$caturl = AkrecipesHelperRoute::getCategoryRoute($recipe->catid);
?>
<span><i class="fa fa-folder"></i> Published in <a href="<?php
echo $caturl;
?>
" title="View more recipes in <?php
echo $recipe->catid_title;
?>
"><?php
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_recipe.php
示例9:
</h2>
<a href="<?php
echo $user_url;
?>
">
<img class="img-thumbnail" src="<?php
echo $image;
?>
" alt="<?php
echo $user->name;
?>
" />
</a>
<div class="caption">
<p>
<?php
echo AkrecipesFrontendHelper::truncate_text($user->userprofile->akprofile['aboutme'], $params->get('author_profile_limit', 100));
?>
</p>
</div>
</div>
</div>
<?php
$count++;
?>
<?php
}
?>
</div>
<?php
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:listicle.php
示例10:
echo $unpublished;
?>
</span>
<?php
}
?>
<div class="recipedate">
<?php
echo JHTML::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC2'));
?>
</div>
<div class="articledescription">
<p><?php
echo AkrecipesFrontendHelper::truncate_text($item->introtext, 300);
?>
</p>
</div>
<div class="col-md-12 catBlock">
<?php
$caturl = JRoute::_('index.php?option=com_content&view=category&id=' . $item->catid);
?>
<span><i class="fa fa-folder"></i> Published in <a href="<?php
echo $caturl;
?>
" title="View more articles in <?php
echo $item->category_title;
?>
"><?php
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_article.php
示例11: foreach
require_once JPATH_SITE . '/components/com_akrecipes/helpers/akrecipes.php';
?>
<?php
if (!empty($users)) {
?>
<div class="container-fluid mod_akrecipes_featured_users horizontal_2">
<?php
foreach ($users as $key => $user) {
?>
<?php
$image_size = $params->get('image_size', 'Large');
$showimages = $params->get('showimages', true);
$image = $user->userprofile->akprofile['image'];
if ($image) {
$image = AkrecipesFrontendHelper::resizeImageToCache($image, "Large");
} else {
$image = 'media/com_akrecipes/images/user.png';
}
$user_url = AkrecipesHelperRoute::getAuthorRoute($user->id);
$num_cols = 2;
?>
<?php
echo $key % $num_cols == 0 ? '<div class="row">' : '';
?>
<div class="col-md-6 col-xs-6">
<div class="thumbnail">
<a href="<?php
echo $user_url;
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:horizontal_2.php
示例12: getFullDescription
protected function getFullDescription($item)
{
$recipe_model = AkrecipesFrontendHelper::getModel('recipe');
$recipe_item = $recipe_model->getData($item->id);
$feed_description = '';
$feed_description = $feed_description . '<div class="recipe-description">' . $recipe_item->recipe_description . $recipe_item->pre_ingredient_notes . '</div>';
$feed_description = $feed_description . '<div class="recipe_ingredients><h3>Ingredients for ' . $recipe_item->recipe_name . '</h3>';
$ingredients_list = '';
if (isset($recipe_item->ingredient) && is_array($recipe_item->ingredient)) {
$ingredients_list = '<ul>';
foreach ($recipe_item->ingredient as $key => $ingredient_item) {
$ingredient_description = trim($recipe_item->ingredient_description[$key]);
if (strpos($ingredient_description, '*') === 0 || strpos($ingredient_description, '<p>*') === 0) {
$ingredients_list = $ingredients_list . '<li><b>' . str_replace('*', '', $ingredient_description) . '</b></li>';
} else {
$qty = trim($recipe_item->qty[$key]);
$unit = trim($recipe_item->unit[$key]);
$ingredient = trim($recipe_item->ingredient[$key]);
$ingredient_tooltip = trim($recipe_item->ingredient_tooltip[$key]);
$ingredient_description = trim($recipe_item->ingredient_description[$key]);
$ingredient_url = trim($recipe_item->ingredient_url[$key]);
$ingredient_qty_unit = (!empty($qty) ? $qty . ' ' : '') . (!empty($unit) ? $unit . ' ' : '');
$ingredients_list = $ingredients_list . '<li>';
$ingredients_list = $ingredients_list . $ingredient_qty_unit . ' ' . $ingredient;
if (!empty($ingredient_description)) {
$qty_unit_ing = $qty . $unit . $ingredient;
$ingredients_list = $ingredients_list . (!empty($qty_unit_ing) ? ', ' : ' ') . $ingredient_description;
}
$ingredients_list = $ingredients_list . '</li>';
}
}
$ingredients_list = $ingredients_list . '</ul>';
} else {
$ingredients_list = '<ul>';
$ingredients = explode("\n", $recipe_item->ingredients_list);
foreach ($ingredients as $key => $ingredient) {
if (strpos($ingredient, '*') === 0 || strpos($ingredient, "<p>*") === 0) {
$ingredient = str_replace('*', "", $ingredient);
$ingredients_list = $ingredients_list . '<b class="ingredientssubtitle">' . trim(strip_tags($ingredient)) . '</b>';
} else {
if (trim($ingredient) != '<p> </p>') {
$ingredients_list = $ingredients_list . trim(strip_tags($ingredient, '<a>')) . '</li>';
}
}
}
$ingredients_list = $ingredients_list . '</ul>';
}
$feed_description = $feed_description . $ingredients_list . '</div>';
$feed_description = $feed_description . '<div class="recipe_instructions">';
$feed_description = $feed_description . '<h3 class="recipeinstructionstitle">Directions for ' . $recipe_item->recipe_name . '</h3>';
$recipe_instruction_list = explode("\n", $recipe_item->recipe_instructions);
$ulopened = false;
$ulclosed = false;
foreach ($recipe_instruction_list as $instructions) {
if (strpos($instructions, '*') === 0 || strpos($instructions, "<p>*") === 0) {
$instructions = str_replace('*', "", $instructions);
if ($ulopened) {
$feed_description = $feed_description . '</ol>';
$ulopened = false;
$ulclosed = true;
}
$feed_description = $feed_description . '<b class="recipeinstructionssubtitle">' . trim(strip_tags($instructions)) . '</b>';
} else {
if (!$ulopened) {
$feed_description = $feed_description . '<ol>';
$ulopened = true;
$ulclosed = false;
}
if (trim($instructions) != '<p> </p>') {
$feed_description = $feed_description . '<li itemprop="recipeInstructions">' . trim($instructions) . '</li>';
}
}
}
if (!$ulclosed) {
$feed_description = $feed_description . '</ol>';
}
$feed_description = $feed_description . '</div>';
$feed_description = $feed_description . '<div class="footnote">' . $recipe_item->recipe_footnote . '</div>';
return $feed_description;
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:80,代码来源:view.feed.php
示例13: defined
defined('_JEXEC') or die;
require_once JPATH_SITE . '/components/com_akrecipes/helpers/route.php';
require_once JPATH_SITE . '/components/com_akrecipes/helpers/akrecipes.php';
?>
<?php
if (!empty($users)) {
?>
<div class="container-fluid mod_akrecipes_featured_users single">
<?php
$user = $users[0];
$image_size = $params->get('image_size', 'MediumRectangle');
$showimages = $params->get('showimages', true);
$image = $user->userprofile->akprofile['image'];
if ($image) {
$image = AkrecipesFrontendHelper::resizeImageToCache($image, "MediumRectangle");
} else {
$image = 'media/com_akrecipes/images/user.png';
}
$user_url = AkrecipesHelperRoute::getAuthorRoute($user->id);
?>
<div class="row">
<div class="col-md-12 col-xs-12">
<div class="thumbnail">
<a href="<?php
echo $user_url;
?>
">
<img src="<?php
echo $image;
?>
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:single.php
示例14: getItems
/**
* Method to get an array of data items
*
* @return mixed An array of data on success, false on failure.
*/
public function getItems()
{
$items = parent::getItems();
foreach ($items as $item) {
if (isset($item->tags)) {
// Catch the item tags (string with ',' coma glue)
$tags = explode(",", $item->tags);
$db = JFactory::getDbo();
// Cleaning and initalization of named tags array
$namedTags = array();
// Get the tag names of each tag id
foreach ($tags as $tag) {
$query = $db->getQuery(true);
$query->select("title");
$query->from('`#__tags`');
$query->where("id=" . intval($tag));
$db->setQuery($query);
$row = $db->loadObjectList();
// Read the row and get the tag name (title)
if (!is_null($row)) {
foreach ($row as $value) {
if ($value && isset($value->title)) {
$namedTags[] = trim($value->title);
}
}
}
}
// Finally replace the data object with proper information
$item->tags = !empty($namedTags) ? implode(', ', $namedTags) : $item->tags;
}
if (isset($item->catid)) {
// Get the title of that particular template
$title = AkrecipesFrontendHelper::getCategoryNameByCategoryId($item->catid);
// Finally replace the data object with proper information
$item->catid = !empty($title) ? $title : $item->catid;
}
if (isset($item->cuisines_id) && $item->cuisines_id != '') {
if (is_object($item->cuisines_id)) {
$item->cuisines_id = ArrayHelper::fromObject($item->cuisines_id);
}
$values = is_array($item->cuisines_id) ? $item->cuisines_id : explode(',', $item->cuisines_id);
$textValue = array();
foreach ($values as $value) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('name'))->from('`#__akrecipes_cuisines`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
$db->setQuery($query);
$results = $db->loadObject();
if ($results) {
$textValue[] = $results->name;
}
}
$item->cuisines_id = !empty($textValue) ? implode(', ', $textValue) : $item->cuisines_id;
}
if (isset($item->meal_course_id) && $item->meal_course_id != '') {
if (is_object($item->meal_course_id)) {
$item->meal_course_id = ArrayHelper::fromObject($item->meal_course_id);
}
$values = is_array($item->meal_course_id) ? $item->meal_course_id : explode(',', $item->meal_course_id);
$textValue = array();
foreach ($values as $value) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('name'))->from('`#__akrecipes_meal_course`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
$db->setQuery($query);
$results = $db->loadObject();
if ($results) {
$textValue[] = $results->name;
}
}
$item->meal_course_id = !empty($textValue) ? implode(', ', $textValue) : $item->meal_course_id;
}
}
return $items;
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:80,代码来源:recipes.php
示例15: getItems
/**
* Method to get an array of data items
*
* @return mixed An array of data on success, false on failure.
*/
public function getItems()
{
$items = parent::getItems();
//error_log("In AkrecipesModelRecipesbyuser::getItems Count == " . count($items) ) ;
foreach ($items as $item) {
//get the tags
$item->tags = new JHelperTags();
//$item->tags->getItemTags('com_akrecipes.recipe',$item->id);
$item->tags->getItemTags($item->type_alias, $item->id);
if (isset($item->catid)) {
// Get the title of that particular template
$title = AkrecipesFrontendHelper::getCategoryNameByCategoryId($item->catid);
// Finally replace the data object with proper information
$item->catid = !empty($title) ? $title : $item->catid;
}
if (isset($item->cuisines_id) && $item->cuisines_id != '') {
if (is_object($item->cuisines_id)) {
$item->cuisines_id = ArrayHelper::fromObject($item->cuisines_id);
}
$values = is_array($item->cuisines_id) ? $item->cuisines_id : explode(',', $item->cuisines_id);
$textValue = array();
foreach ($values as $value) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('name'))->from('`#__akrecipes_cuisines`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
$db->setQuery($query);
$results = $db->loadObject();
if ($results) {
$textValue[] = $results->name;
}
}
$item->cuisines_id = !empty($textValue) ? implode(', ', $textValue) : $item->cuisines_id;
}
// set meal_course values
if (isset($item->meal_course_id) && $item->meal_course_id != '') {
if (is_object($item->meal_course_id)) {
$item->meal_course_id = ArrayHelper::fromObject($item->meal_course_id);
}
$values = is_array($item->meal_course_id) ? $item->meal_course_id : explode(',', $item->meal_course_id);
$textValue = array();
foreach ($values as $value) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('name'))->from('`#__akrecipes_meal_course`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
$db->setQuery($query);
$results = $db->loadObject();
if ($results) {
$textValue[] = $results->name;
}
}
$item->meal_course_id = !empty($textValue) ? implode(', ', $textValue) : $item->meal_course_id;
}
// set brand values
if (isset($item->brand_id) && $item->brand_id != '') {
if (is_object($item->brand_id)) {
$item->brand_id = ArrayHelper::fromObject($item->brand_id);
}
$values = is_array($item->brand_id) ? $item->brand_id : explode(',', $item->brand_id);
$textValue = array();
foreach ($values as $value) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('brand_name'))->from('`#__akrecipes_brands`')->where($db->quoteName('id') . ' = ' . $db->quote($db->escape($value)));
$db->setQuery($query);
$results = $db->loadObject();
if ($results) {
$textValue[] = $results->brand_name;
}
}
$item->brand_id = !empty($textValue) ? implode(', ', $textValue) : $item->brand_id;
}
}
return $items;
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:79,代码来源:recipesbyuser.php
示例16: _prepareDocument
/**
* Prepares the document
*
* @return void
*
* @throws Exception
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
//error_log("Preparing document --> " . print_r($this->category->metadesc,true) );
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu) {
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
} else {
$this->params->def('page_heading', JText::_('COM_AKRECIPES_DEFAULT_PAGE_TITLE'));
}
//$title = $this->params->get('page_title', '');
$title = $this->category->title;
//$sitename = $app->get('sitename');
if (empty($title)) {
$title = $app->get('sitename');
} elseif ($app->get('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
} elseif ($app->get('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
if ($this->pagination->pagesCurrent > 1) {
$this->document->setTitle($this->pagination->getPagesCounter() . ' for ' . $title);
} else {
$this->document->setTitle($title);
}
//now set metadescription
$metaDescription_prefix = '';
if ($this->pagination->pagesCurrent > 1) {
$metaDescription_prefix = $this->pagination->getPagesCounter() . ' for ';
}
// check if meta description available from menu
$metadesc = $this->params->get('menu-meta_description');
// get the category's meta description
if (empty($metadesc)) {
$metadesc = $this->category->metadesc;
}
// still empty use the category description
if (empty($metadesc) && !empty($this->category->description)) {
$metadesc = AkrecipesFrontendHelper::truncate_text($this->category->description, 150);
}
$metadesc = $metaDescription_prefix . $metadesc;
$this->document->setDescription($metadesc);
$meta_keywords = $this->params->get('menu-meta_keywords');
if (empty($meta_keywords)) {
$meta_keywords = $this->category->metakey;
}
if ($this->params->get('menu-meta_keywords')) {
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots')) {
$this->document->setMetadata('robots', $this->params->get('robots'));
}
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
//$this->document->addStylesheet('media/com_akrecipes/css/recipe.css');
}
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:66,代码来源:view.html.php
示例17: foreach
$products = ModAkrecipesproductHelper::getList($params);
?>
<?php
if (!empty($products)) {
?>
<div class="mod_akrecipes_product vertical">
<ul class="media-list">
<?php
foreach ($products as $product) {
?>
<?php
$image_size = $params->get('image_size', 'Small');
$showimages = $params->get('showimages', false);
if ($showimages) {
$image = AkrecipesFrontendHelper::resizeImageToCache($product->product_image, $image_size);
}
$product_url = $product->product_link;
?>
<li class="media">
<?php
if ($showimages) {
?>
<div class="pull-left">
<a href="<?php
echo $product_url;
?>
">
<img class="media-object module-image-100" src="<?php
echo $image;
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:vertical.php
示例18: DateTime
echo $item->title;
?>
"></img>
<div class="caption">
<div class="catBlock">
<?php
echo $item->catid_title;
?>
</div>
<h3 itemprop="name" class="recipe_title"><?php
echo $item->title;
?>
</h3>
<div class="recipedescription">
<p itemprop="description"><?php
echo AkrecipesFrontendHelper::truncate_text($item->intro_text, 150, true);
?>
</p>
</div>
<div class="authorDateBlock">
<div class="recipe_author" itemprop="author">
<?php
echo $item->author;
?>
</div>
<?php
$published_datetime = new DateTime(JHTML::_('date', $item->publish_up, 'Y-m-d H:i:s'));
?>
<div class="recipedate" itemprop="datePublished" content="<?php
echo $published_datetime->format(DateTime::ISO8601);
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_recipe_mobile.php
示例19: json_decode
"><!-- begin row -->
<?php
}
?>
<?php
$images = json_decode($item->core_images);
if ($images == false) {
$images = new stdclass();
$images->image_intro = $item->core_images;
$image = AkrecipesFrontendHelper::resizeImageToCache($item->core_images, 'Medium');
$images->image_intro_alt = $item->core_title;
if (strpos($images->image_intro, '/') === 0) {
$images->image_intro = substr($images->image_intro, 1);
}
} else {
$image = AkrecipesFrontendHelper::resizeImageToCache($images->image_intro, 'Medium');
}
$item_url = JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router));
$author_id = $item->core_created_user_id;
$author = JFactory::getUser($author_id);
// Unset the passwords.
unset($author->password);
unset($author->password_clear);
// Get the dispatcher and load the users plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $author));
$author_url = JRoute::_('index.php?option=com_akrecipes&view=recipesbyuser&task=recipesbyuser.display&id=' . (int) $item->core_created_user_id);
//$canEdit = AkrecipesFrontendHelper::canEdit($item);
$unpublished = $item->core_state == 0;
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:31,代码来源:default_items.php
示例20: parse
/**
* Parse method for URLs
* This method is meant to transform the human readable URL back into
* query parameters. It is only executed when SEF mode is switched on.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
error_log("IN AkrecipesRouter::parse segments == " . print_r($segments, true));
$vars = array();
$total = count($segments);
// if segment is 1, then it is a recipe
if ($total == 1) {
// check if it is contests or brands list
switch ($segments[0]) {
case 'contests':
$vars['view'] = 'contests';
break;
case 'brands':
$vars['view'] = 'brands';
break;
default:
$vars['view'] = 'recipe';
// $model = AkrecipesFrontendHelper::getModel($vars['view']);
// $id = $model->getItemIdByAlias($segments[0]);
$id = AkrecipesFrontendHelper::getItemIdByAlias($segments[0], 'recipe');
$vars['id'] = $id;
break;
}
return $vars;
} elseif ($total == 2) {
// check if it is a contest/brand page. If not assume it is category
$iscat = false;
$table_name = null;
switch ($segments[0]) {
case 'contests':
$vars['view'] = 'contest';
$table_name = 'contests';
break;
case 'brands':
$vars['view'] = 'brand';
$table_name = 'brands';
break;
case 'author':
$vars['view'] = 'recipesbyuser';
$table_name = 'users';
break;
default:
$iscat = true;
break;
}
if (!$iscat) {
// $model = AkrecipesFrontendHelper::getModel($vars['view']);
// $id = $model->getItemIdByAlias($segments[1]);
$id = AkrecipesFrontendHelper::getItemIdByAlias($segments[1], $table_name);
$vars['id'] = $id;
return $vars;
}
}
// reached here, assume it is a category
// We get the category id from the menu item and search from there
$id = $item->query['id'];
$category = JCategories::getInstance('Akrecipes')->get($id);
if (!$category) {
JError::raiseError(404, JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND'));
return $vars;
}
$categories = $category->getChildren();
$vars['catid'] = $id;
$vars['id'] = $id;
$vars['layout'] = 'blog';
$found = 0;
foreach ($segments as $segment) {
$segment = str_replace(':', '-', $segment);
foreach ($categories as $category) {
if ($category->alias == $segment) {
$vars['id'] = $category->id;
$vars['view'] = 'recipes';
$categories = $category->getChildren();
$found = 1;
break;
}
|
请发表评论