예제 #1
0
 /**
  * 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
0
 /**
  * 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
0
									<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
0
$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
0
/**
 * @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
0
파일: blog.php 프로젝트: rutvikd/ak-recipes
        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
0
 /**
  * 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
0
">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
0
						</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
0
    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
0
				 							 			
							<img class="img-thumbnail" src="<?php 
        echo $image;
        ?>
" alt="<?php 
        echo $recipe->recipe_name;
        ?>
" />
						</a>
						<?php 
        if ($params->get('show_recipe_description', 0) == 1) {
            ?>
						<div class="caption">
							<p>
								<?php 
            echo AkrecipesFrontendHelper::truncate_text($recipe->recipe_description, $params->get('recipe_description_limit', 100));
            ?>
							</p>						
						</div>
						<?php 
        }
        ?>
				 </div>
			</div>
			<?php 
        $count++;
        ?>
		<?php 
    }
    ?>
	</div>
예제 #12
0
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;
예제 #13
0
 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>&nbsp;</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>&nbsp;</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;
 }
예제 #14
0
 ratings.</span>
		</div>
		<?php 
}
?>
     
	</div>

	<div class="row recipe-image">
		<?php 
// 			$image = $this->item->image ;
// 			if (strpos($image, '/') === 0 ) {
// 				$image = substr($image, 1);
// 			}
// error_log("Recipe image is -> " . $this->item->image );
$image = AkrecipesFrontendHelper::resizeImageWidth($this->item->image);
//error_log("Recipe image is -> " . $this->item->image );
?>
		<img class="img-thumbnail" itemprop="image" style="width:100%;" src="<?php 
echo $image;
?>
" alt="<?php 
echo $this->item->recipe_name;
?>
" title="<?php 
echo $this->item->recipe_name;
?>
" />
         <div itemscope itemtype="http://schema.org/ImageObject">
            <link itemprop="contentUrl" src="<?php 
echo $image;
예제 #15
0
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;
    ?>
예제 #16
0
 /**
  * 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;
 }
예제 #17
0
 /**
  * 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;
 }
예제 #18
0
 /**
  * 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');
 }
예제 #19
0
$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;
예제 #20
0
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);
예제 #21
0
"><!-- 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;
예제 #22
0
 /**
  * Prepares the document
  *
  * @return void
  *
  * @throws Exception
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     // 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->item->recipe_name;
     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'));
     }
     $this->document->setTitle($title);
     // now set the meta description
     $metadesc = $this->item->metadesc;
     // if their is a menu meta, use that
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     } elseif ($metadesc) {
         $this->document->setDescription($metadesc);
     } else {
         $metadesc = AkrecipesFrontendHelper::truncate_text($this->item->recipe_description, 150);
         $this->document->setDescription($metadesc);
     }
     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');
     $this->document->addStylesheet('media/com_akrecipes/css/star-rating/star-rating.css');
     $this->document->addStylesheet('media/com_akrecipes/css/star-rating/theme-krajee-fa.css');
     // $this->document->addScript('media/com_akrecipes/js/star-rating/star-rating.js');
     // $this->document->addScript('media/com_akrecipes/js/rating.js');
     // $this->document->addScript('media/com_akrecipes/js/hits.js');
     if ($this->params->get('social_media_optimization')) {
         $this->_prepareSocialMedia();
     }
 }
예제 #23
0
 /**
  * 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;
             }
         }
     }
     return $vars;
 }
예제 #24
0
<?php 
if (!empty($users)) {
    ?>
	<div class="container-fluid mod_akrecipes_featured_users">
		<?php 
    $user_count = count($users);
    ?>
		<?php 
    foreach ($users as $key => $user) {
        ?>
			<?php 
        $image_size = $params->get('image_size', 'Small');
        $showimages = $params->get('showimages', true);
        $image = $user->userprofile->akprofile['image'];
        if ($image) {
            $image = AkrecipesFrontendHelper::resizeImageToCache($image, "Small");
        } else {
            $image = 'media/com_akrecipes/images/user.png';
        }
        $user_url = AkrecipesHelperRoute::getAuthorRoute($user->id);
        $num_cols = $params->get('num_cols', 4);
        $colspan = 12 / $num_cols;
        ?>

			<?php 
        echo $key % $num_cols == 0 ? '<div class="row">' : '';
        ?>

				 <div class="col-md-<?php 
        echo $colspan;
        ?>
예제 #25
0
    ?>
				<div class="contest-introtext">
					<?php 
    echo $contest_intro_text;
    ?>
				</div>
				<div class="contest-fulltext">
					<?php 
    echo $contest_full_text;
    ?>
				</div>				
			</div>
		</div>

		<?php 
    if (AkrecipesFrontendHelper::isContestLive($this->item) && $this->item->add_recipe == 1) {
        ?>
			<?php 
        $add_recipe_url = JRoute::_(AkrecipesHelperRoute::getAddRecipeRoute());
        ?>

			<div class="row contest-participate">
				<div class="col-md-10 col-md-offset-1">
					<div class="btn-group btn-group-justified">
						<a class="btn btn-primary" role="button" href="<?php 
        echo $add_recipe_url;
        ?>
" title="<?php 
        echo 'Add New Recipe & Participate in  ' . $this->item->contest_name;
        ?>
">
예제 #26
0
$item = $this->recipe;
?>


<!-- get recipe image -->
<?php 
$imagesize = array();
$imagesize['width'] = 140;
$imagesize['height'] = 112;
// 112 = 140/1.25
$image = AkrecipesFrontendHelper::resizeImageToCache($item->image, $imagesize);
$item_url = AkrecipesHelperRoute::getRecipeRoute($item->id, $item->catid);
// JRoute::_('index.php?option=com_akrecipes&view=recipe&id='.(int) $item->id);
$published = $item->state;
$unpublished = AkrecipesFrontendHelper::getRecipeUnpublishedText($item);
$canEdit = AkrecipesFrontendHelper::canEdit($item);
?>

<div class="media brandRecipe mobile">

	<div class="pull-left">
		<a href="<?php 
echo $item_url;
?>
">
			<img class="img-thumbnail" src="<?php 
echo $image;
?>
"></img>
		</a>		
	</div>
예제 #27
0
$recipes = ModAkrecipesrecipesHelper::getList($params);
?>

<?php 
if (!empty($recipes)) {
    ?>
	<div class="container-fluid mod_akrecipes_recipe horizontal_4">
		<?php 
    $recipe_count = count($recipes);
    ?>
		<?php 
    foreach ($recipes as $key => $recipe) {
        ?>
			<?php 
        $image_size = $params->get('image_size', 'Small');
        $image = AkrecipesFrontendHelper::resizeImageToCache($recipe->image, $image_size);
        // $image = $recipe->image ;
        // if (strpos($image, '/') === 0 ) {
        // 	$image = substr($image, 1);
        // }
        $recipe_url = JRoute::_(AkrecipesHelperRoute::getRecipeRoute($recipe->id, $recipe->catid));
        $author_url = JRoute::_(AkrecipesHelperRoute::getAuthorRoute($recipe->created_by));
        $num_cols = 4;
        ?>

			<?php 
        echo $key % $num_cols == 0 ? '<div class="row">' : '';
        ?>

				 <div class="col-md-3 col-xs-3">
				 	<div class="thumbnail">
예제 #28
0
defined('_JEXEC') or die;
JLoader::register('TagsHelperRoute', JPATH_BASE . '/components/com_tags/helpers/route.php');
require_once JPATH_ROOT . '/components/com_akrecipes/helpers/akrecipes.php';
//$item = $this->item;
//error_log("Item is --> " . print_r($item,true));
$images = json_decode($item->core_images);
if ($images == false) {
    $images = new stdclass();
    $images->image_intro = $item->core_images;
    $images->image_intro_alt = $item->core_title;
    // if (strpos($images->image_intro, '/') === 0 ) {
    // 	$images->image_intro = substr($images->image_intro, 1);
    // }
}
//error_log("Image Intro --> " . $images->image_intro );
$image = AkrecipesFrontendHelper::resizeImageToCache($images->image_intro, "XSmall");
//error_log("ResizedImage  --> " . $image );
$item_url = JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router));
?>

<a href="<?php 
echo $item_url;
?>
" title="<?php 
echo htmlspecialchars($item->core_title);
?>
">
	<div class="media tagssimilarRecipe mobile">
		<div class="pull-left">
				<img src="<?php 
echo $image;