public function __construct() { $this->devices = (object) array(); foreach (MobileDetector::devices() as $type => $device) { $this->devices->{$type} = (object) array('detected' => false, 'captures' => (object) array()); } }
public static function instance($class) { if (!isset($class->{$instance})) { $instance = new $class(); $instance->initialize(); MobileDetector::registerDevice($instance); } return $instance; }
public function execute($param_pool) { $data = MobileDetector::detect(); $result = new XMLElement('device'); $result->setAttribute('is-mobile', 'no'); if ($data->passed()) { $result->setAttribute('is-mobile', 'yes'); } foreach ($data->devices() as $type => $values) { if (!$values->detected) { continue; } $item = new XMLElement($type); foreach ($values->captures as $name => $value) { $item->setAttribute($name, $value); } $result->appendChild($item); } return $result; }
/** * @version CVS: 1.0.1 * @package com_akrecipes * @subpackage mod_akrecipes * @author Rutvik Doshi <*****@*****.**> * @copyright Copyright (C) 2015. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; require_once JPATH_SITE . '/components/com_akrecipes/helpers/route.php'; require_once JPATH_SITE . '/components/com_akrecipes/helpers/akrecipes.php'; //$recipes = ModAkrecipesrecipesHelper::getList($params); $isMobile = 0; if (class_exists('MobileDetector')) { $isMobile = MobileDetector::isMobile(); } ?> <?php if (!empty($recipes)) { ?> <div class="container-fluid mod_akrecipes_recipe horizontal_2"> <?php foreach ($recipes as $key => $recipe) { ?> <?php $image_size = $params->get('image_size', 'Large'); $image = AkrecipesFrontendHelper::resizeImageToCache($recipe->image, $image_size); // $image = $recipe->image ; // if (strpos($image, '/') === 0 ) {
public static function hideSidebar() { /* hide sidebar for the following combinations Category Page: Option = com_k2, View = itemlist, Task = category Tag Page: Option = com_k2, View = itemlist, Task = tag Author Page: Option = com_k2, View = itemlist, Task = user Multi Category Page: Option = com_k2, View = itemlist, Task = "" HomePage: active menu item and default are the same */ $isMobile = 0; if (class_exists('MobileDetector')) { $isMobile = MobileDetector::isMobile(); } if ($isMobile) { return true; } $app = JFactory::getApplication(); $menu = $app->getMenu(); $option = JRequest::getVar('option'); $view = JRequest::getVar('view'); $task = JRequest::getVar('task'); // error_log("Active Menu Item --> " . print_r($menu->getActive(),true)) ; // error_log("Default Menu Item --> " . print_r($menu->getDefault(),true) ) ; // if ($menu->getActive() == $menu->getDefault() ) { // if ( $task == 'tag' || $task == 'user') { // return true; // } // // 'This is the front page'; // return false; // } //if ( $option == 'com_users' && $view == 'registration' ) return true ; if ($option == 'com_users') { return true; } if ($option == 'com_tags' && $view == 'tag') { return true; } //if ( $option != 'com_k2') return false ; //if ( $view != 'itemlist') return false ; $hideSidebar = false; if ($option == 'com_akrecipes') { switch ($view) { case 'frontpage': $hideSidebar = false; break; case 'recipes': $hideSidebar = true; break; case 'recipeform': $hideSidebar = true; break; case 'recipesbyuser': $hideSidebar = true; break; case 'brands': $hideSidebar = true; break; case 'brand': $hideSidebar = true; break; case 'contest': $hideSidebar = false; break; case 'contests': $hideSidebar = true; break; default: $hideSidebar = false; break; } } elseif ($option == 'com_content') { switch ($view) { case 'category': $hideSidebar = true; break; default: $hideSidebar = false; break; } } // echo "<p> Option = " . $option . "</p>" ; // echo "<p> View = " . $view . "</p>" ; // echo "<p> Task = " . $task . "</p>" ; // echo "<p> hideSidebar = " . ( ($hideSidebar) ? 'true' : 'false' ) . "</p>" ; // if ( $task == 'category' || $task == 'tag' || $task == 'user') { // return true; // } // return true for all tasks of com_k2 & itemlist return $hideSidebar; }
public function appendPreferences($context) { $conf = Symphony::Configuration(); $group = new XMLElement('fieldset'); $group->setAttribute('class', 'settings'); $group->appendChild(new XMLElement('legend', __('Mobile Device Detection'))); // No Redirect Cookie: $label = Widget::Label(__('No Redirect Cookie')); $label->appendChild(Widget::Input('settings[' . self::CONF . '][' . self::CONF_COOKIE . ']', General::Sanitize($conf->get(self::CONF_COOKIE, self::CONF)))); $group->appendChild($label); // Redirect URL: $label = Widget::Label(__('Redirect URL')); $label->appendChild(Widget::Input('settings[' . self::CONF . '][' . self::CONF_URL . ']', General::Sanitize($conf->get(self::CONF_URL, self::CONF)))); $group->appendChild($label); // Redirect Devices: $label = Widget::Label(__('Redirect Devices')); $label->appendChild(Widget::Input('settings[' . self::CONF . '][' . self::CONF_DEVICES . ']', General::Sanitize($conf->get(self::CONF_DEVICES, self::CONF)))); $group->appendChild($label); $list = new XMLElement('ul'); $list->setAttribute('class', 'tags'); foreach (MobileDetector::devices() as $type => $device) { $item = new XMLElement('li', $type); $list->appendChild($item); $list->setAttribute('data-interactive', 'data-interactive'); } $group->appendChild($list); $context['wrapper']->appendChild($group); }