本文整理汇总了PHP中AkrecipesFrontendHelper类的典型用法代码示例。如果您正苦于以下问题:PHP AkrecipesFrontendHelper类的具体用法?PHP AkrecipesFrontendHelper怎么用?PHP AkrecipesFrontendHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AkrecipesFrontendHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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;
}
示例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>
示例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;
?>
示例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;
?>
">
示例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
}
?>
示例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');
}
示例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
示例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
}
示例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
示例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;
示例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;
}
示例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;
?>
示例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;
}
示例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;
}