/**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['include_entries'] = JArrayHelper::getValue($params, 'include_entries', 1);
     $params['include_entries'] = $params['include_entries'] == 1 || $params['include_entries'] == 2 && $xmap->view == 'xml' || $params['include_entries'] == 3 && $xmap->view == 'html';
     $params['include_expired_entries'] = JArrayHelper::getValue($params, 'include_expired_entries', 0);
     $params['include_expired_entries'] = $params['include_expired_entries'] == 1 || $params['include_expired_entries'] == 2 && $xmap->view == 'xml' || $params['include_expired_entries'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['entry_priority'] = JArrayHelper::getValue($params, 'entry_priority', $parent->priority);
     $params['entry_changefreq'] = JArrayHelper::getValue($params, 'entry_changefreq', $parent->changefreq);
     if ($params['entry_priority'] == -1) {
         $params['entry_priority'] = $parent->priority;
     }
     if ($params['entry_changefreq'] == -1) {
         $params['entry_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'front':
             self::getCategoryTree($xmap, $parent, $params, 0);
             break;
         case 'list':
             self::getEntries($xmap, $parent, $params, $uri->getVar('catid'));
             break;
     }
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['include_events'] = JArrayHelper::getValue($params, 'include_events', 1);
     $params['include_events'] = $params['include_events'] == 1 || $params['include_events'] == 2 && $xmap->view == 'xml' || $params['include_events'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['event_priority'] = JArrayHelper::getValue($params, 'event_priority', $parent->priority);
     $params['event_changefreq'] = JArrayHelper::getValue($params, 'event_changefreq', $parent->changefreq);
     if ($params['event_priority'] == -1) {
         $params['event_priority'] = $parent->priority;
     }
     if ($params['event_changefreq'] == -1) {
         $params['event_changefreq'] = $parent->changefreq;
     }
     self::getEvents($xmap, $parent, $params, $uri->getVar('catid'));
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if ($xmap->isNews || !self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['include_topics'] = JArrayHelper::getValue($params, 'include_topics', 1);
     $params['include_topics'] = $params['include_topics'] == 1 || $params['include_topics'] == 2 && $xmap->view == 'xml' || $params['include_topics'] == 3 && $xmap->view == 'html';
     $params['include_pagination'] = JArrayHelper::getValue($params, 'include_pagination', 0);
     $params['include_pagination'] = $params['include_pagination'] == 1 || $params['include_pagination'] == 2 && $xmap->view == 'xml' || $params['include_pagination'] == 3 && $xmap->view == 'html';
     $params['cat_priority'] = JArrayHelper::getValue($params, 'cat_priority', $parent->priority);
     $params['cat_priority'] = $params['cat_priority'] == -1 ? $parent->priority : $params['cat_priority'];
     $params['cat_changefreq'] = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq);
     $params['cat_changefreq'] = $params['cat_changefreq'] == -1 ? $parent->changefreq : $params['cat_changefreq'];
     $params['topic_priority'] = JArrayHelper::getValue($params, 'topic_priority', $parent->changefreq);
     $params['topic_priority'] = $params['topic_priority'] == -1 ? $parent->priority : $params['topic_priority'];
     $params['topic_changefreq'] = JArrayHelper::getValue($params, 'topic_changefreq', $parent->changefreq);
     $params['topic_changefreq'] = $params['topic_changefreq'] == -1 ? $parent->changefreq : $params['topic_changefreq'];
     if ($params['include_topics']) {
         if ((int) ($limit = JArrayHelper::getValue($params, 'max_topics', 0))) {
             $params['limit'] = $limit;
         } else {
             $params['limit'] = 0;
         }
         if ((int) ($days = JArrayHelper::getValue($params, 'max_age', 0))) {
             $params['days'] = JFactory::getDate()->toUnix() - intval($days) * 86400;
         } else {
             $params['days'] = '';
         }
     }
     self::getCategoryTree($xmap, $parent, $params, $uri->getVar('catid', 0));
 }
Example #4
0
 /**
  * route
  *
  * @return  void
  *
  * @throws \Exception
  */
 public static function quickRouting()
 {
     $app = \JFactory::getApplication();
     $input = $app->input;
     if ($app->isSite()) {
         $closure = function (\JRouterSite $router, \JUri $uri) use($input, $app) {
             $route = $uri->getPath();
             $route = trim($route, '/');
             // Admin
             if ($route == 'admin') {
                 $uri = \JUri::getInstance();
                 $target = new \JUri(\JUri::root() . 'administrator');
                 $target->setQuery($uri->getQuery());
                 $app->redirect($target);
             }
             return array();
         };
         $router = $app::getRouter();
         $router->attachParseRule($closure, JVERSION >= 3.4 ? $router::PROCESS_BEFORE : null);
     } else {
         if ($input->get('goezset') !== null) {
             $plugin = \JTable::getInstance('Extension');
             if ($plugin->load(array('name' => 'plg_system_ezset'))) {
                 $extId = $plugin->extension_id;
                 $app->redirect(\JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $extId, false));
                 exit;
             }
         }
     }
 }
Example #5
0
 /**
  * Get the access token or redict to the authentication URL.
  *
  * @return  string  The access token
  *
  * @since   12.3
  */
 public function authenticate()
 {
     if ($data['code'] = $this->input->get('code', false, 'raw')) {
         $data['grant_type'] = 'authorization_code';
         $data['redirect_uri'] = $this->getOption('redirecturi');
         $data['client_id'] = $this->getOption('clientid');
         $data['client_secret'] = $this->getOption('clientsecret');
         if ($this->provider->systemName == 'linkedin') {
             $data['redirect_uri'] = urlencode($this->getOption('redirecturi'));
             $uri = new JUri($this->getOption('tokenurl'));
             $uri->setQuery($data);
             $response = $this->transport->request('POST', $uri, null, array());
         } else {
             $response = $this->http->post($this->getOption('tokenurl'), $data);
         }
         if ($response->code >= 200 && $response->code < 400) {
             if (strpos($response->headers['Content-Type'], 'application/json') !== false) {
                 $token = array_merge(json_decode($response->body, true), array('created' => time()));
             } else {
                 parse_str($response->body, $token);
                 $token = array_merge($token, array('created' => time()));
             }
             $this->setToken($token);
             return $token;
         } else {
             throw new RuntimeException('Error code ' . $response->code . ' received requesting access token: ' . $response->body . '.');
         }
     }
     if ($this->getOption('sendheaders')) {
         $this->application->redirect($this->createUrl());
     }
     return false;
 }
Example #6
0
 /**
  * @param   string $layout
  *
  * @return JUri
  */
 public static function getUri($layout = null)
 {
     $uri = new JUri('index.php?option=com_kunena&view=announcement');
     if ($layout) {
         $uri->setVar('layout', $layout);
     }
     return $uri;
 }
Example #7
0
 public function getBattleNetUrl()
 {
     $uri = new JUri();
     $uri->setScheme($this->params->get('scheme', 'http'));
     $uri->setHost($this->params->get('region') . '.battle.net');
     $uri->setPath('/wow/' . $this->params->get('locale') . '/guild/' . rawurlencode($this->params->get('realm')) . '/' . rawurlencode($this->params->get('guild')) . '/');
     return $uri->toString();
 }
Example #8
0
 /**
  * Method to build and return a full request URL for the request.
  *
  * @param   string  $path  URL to inflect
  *
  * @return  string   The request URL.
  *
  * @since   12.3
  */
 protected function fetchUrl($path)
 {
     // Append the path with output format
     $path .= '&format=xml';
     $uri = new JUri($this->options->get('api.url') . '/api.php' . $path);
     if ($this->options->get('api.username', false)) {
         $uri->setUser($this->options->get('api.username'));
     }
     if ($this->options->get('api.password', false)) {
         $uri->setPass($this->options->get('api.password'));
     }
     return (string) $uri;
 }
Example #9
0
function getBlogItemLink($item)
{
    if ($item->params->get('access-view')) {
        $link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
    } else {
        $menu = JFactory::getApplication()->getMenu();
        $active = $menu->getActive();
        $itemId = $active->id;
        $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
        $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
        $link = new JUri($link1);
        $link->setVar('return', base64_encode($returnURL));
    }
    return $link;
}
Example #10
0
 public function search()
 {
     $model = $this->getModel('user');
     $uri = new JUri('index.php?option=com_kunena&view=user&layout=list');
     $state = $model->getState();
     $search = $state->get('list.search');
     $limitstart = $state->get('list.start');
     if ($search) {
         $uri->setVar('search', $search);
     }
     if ($limitstart) {
         $uri->setVar('limitstart', $search);
     }
     $this->setRedirect(KunenaRoute::_($uri, false));
 }
Example #11
0
 /**
  * Build by resource.
  *
  * @param   string   $resource The resource key to find our route.
  * @param   array    $data     The url query data.
  * @param   boolean  $xhtml    Replace & by &amp; for XML compilance.
  * @param   integer  $ssl      Secure state for the resolved URI.
  *                             1: Make URI secure using global secure site URI.
  *                             2: Make URI unsecure using the global unsecure site URI.
  *
  * @return  string Route url.
  */
 public static function _($resource, $data = array(), $xhtml = true, $ssl = null)
 {
     $resource = explode('.', $resource, 2);
     if (count($resource) == 2) {
         $data['option'] = $resource[0];
         $data['_resource'] = $resource[1];
     } elseif (count($resource) == 1) {
         $data['option'] = $resource[0];
         $data['_resource'] = null;
     }
     $url = new \JUri();
     $url->setQuery($data);
     $url->setPath('index.php');
     return \JRoute::_((string) $url, $xhtml, $ssl);
 }
Example #12
0
 /**
  * Loads the configuration from the Joomla! global configuration itself. The component's options are loaded into
  * the options key. For example, an option called foobar is accessible as $config->get('options.foobar');
  *
  * @param string  $filePath Ignored
  * @param Phpfunc $phpfunc  Ignored
  *
  * @return  void
  */
 public function loadConfiguration($filePath = null, Phpfunc $phpfunc = null)
 {
     // Get the Joomla! configuration object
     $jConfig = \JFactory::getConfig();
     // Create the basic configuration data
     $data = array('timezone' => $jConfig->get('offset', 'UTC'), 'fs' => array('driver' => 'file'), 'dateformat' => \JText::_('DATE_FORMAT_LC2'), 'base_url' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'live_site' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'cms_url' => \JUri::base(), 'options' => array());
     // Get the Joomla! FTP layer options
     if (!class_exists('JClientHelper')) {
         \JLoader::import('joomla.client.helper');
     }
     $ftpOptions = \JClientHelper::getCredentials('ftp');
     // If the FTP layer is enabled, enable the Hybrid filesystem engine
     if ($ftpOptions['enabled'] == 1) {
         $data['fs'] = array('driver' => 'hybrid', 'host' => $ftpOptions['host'], 'port' => empty($ftpOptions['port']) ? '21' : $ftpOptions['port'], 'directory' => rtrim($ftpOptions['root'], '/\\'), 'ssl' => false, 'passive' => true, 'username' => $ftpOptions['user'], 'password' => $ftpOptions['pass']);
     }
     // Populate the options key with the component configuration
     $db = $this->container->db;
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_' . strtolower($this->container->application_name)));
     try {
         $configJson = $db->setQuery($sql)->loadResult();
     } catch (\Exception $e) {
         $configJson = null;
     }
     if (!empty($configJson)) {
         $data['options'] = json_decode($configJson, true);
     }
     // Finally, load the data to the registry class
     $this->data = new \stdClass();
     $this->loadArray($data);
 }
Example #13
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since  11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set document type
     $this->_type = 'opensearch';
     // Set mime type
     $this->_mime = 'application/opensearchdescription+xml';
     // Add the URL for self updating
     $update = new JOpenSearchUrl();
     $update->type = 'application/opensearchdescription+xml';
     $update->rel = 'self';
     $update->template = JRoute::_(JUri::getInstance());
     $this->addUrl($update);
     // Add the favicon as the default image
     // Try to find a favicon by checking the template and root folder
     $app = JFactory::getApplication();
     $dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
     foreach ($dirs as $dir) {
         if (file_exists($dir . '/favicon.ico')) {
             $path = str_replace(JPATH_BASE . '/', '', $dir);
             $path = str_replace('\\', '/', $path);
             $favicon = new JOpenSearchImage();
             $favicon->data = JUri::base() . $path . '/favicon.ico';
             $favicon->height = '16';
             $favicon->width = '16';
             $favicon->type = 'image/vnd.microsoft.icon';
             $this->addImage($favicon);
             break;
         }
     }
 }
Example #14
0
function image_compareYTShortcode($atts = null, $content = null)
{
    $atts = ytshortcode_atts(array('before_image' => '', 'after_image' => '', 'orientation' => '', 'before_text' => 'Original', 'after_text' => 'Modified', 'class' => ''), $atts, 'image_compare');
    // Unique Id
    $id = uniqid("ytic") . rand() . time();
    if (yt_image_media($atts['before_image']) && yt_image_media($atts['after_image'])) {
        $orientation = $atts['orientation'] == 'horizontal' ? 'data-orientation="horizontal"' : '';
        $css = '#' . $id . ' .twentytwenty-before-label:before {content: "' . $atts['before_text'] . '"}';
        $css .= '#' . $id . ' .twentytwenty-after-label:before {content: "' . $atts['after_text'] . '"}';
        // Css Adding in Head
        JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/image_compare/css/image_compare.css", 'text/css');
        // JavaScipt additon in Head
        JHtml::_('jquery.framework');
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.twentytwenty.js");
        JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.event.move.js");
        // OUtput Structure in  here
        $return = '
            <div id="' . $id . '" class="twentytwenty-container' . trim($atts['class']) . '" data-orientation="horizontal">
                <img src="' . yt_image_media($atts['before_image']) . '" alt="' . $atts['before_text'] . '">
                <img src="' . yt_image_media($atts['after_image']) . '" alt="' . $atts['before_text'] . '">
            </div>';
        $js = 'jQuery(window).load(function(){
              jQuery("#' . $id . '").twentytwenty({orientation: \'' . $atts['orientation'] . '\'});
            });';
        $doc = JFactory::getDocument();
        $doc->addStyleDeclaration($css);
        $doc->addScriptDeclaration($js);
    } else {
        $return = yt_alert_box('You can compare two images by using this shortcode', 'warning');
    }
    return $return;
}
Example #15
0
function blockquoteYTShortcode($atts, $content = null)
{
    extract(ytshortcode_atts(array("title" => '', "align" => 'none', 'border' => '#666', 'color' => '#fff', 'width' => 'auto'), $atts));
    JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/blockquote/css/blockquote.css");
    $source_title = $title != '' ? "<small>" . $title . "</small>" : '';
    return '<blockquote class="yt-clearfix yt-boxquote pull-' . $align . '" style="width:' . $width . '%;border-color:' . $border . ';color:' . $color . '">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . $source_title . '</blockquote>';
}
 function onPromoteData($id)
 {
     $db = JFactory::getDBO();
     $Itemid = JRequest::getInt('Itemid');
     $jschk = $this->_chkextension();
     if (!empty($jschk)) {
         $query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id;
         $db->setQuery($query);
         $fieldid = $db->loadresult();
         $query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id;
         if ($fieldid) {
             $query .= " AND cfv.field_id=" . $fieldid;
         }
         $db->setQuery($query);
         $previewdata = $db->loadObjectlist();
         if (!$fieldid) {
             $previewdata[0]->bodytext = '';
         }
         // Include Jomsocial core
         $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
         include_once $jspath . DS . 'libraries' . DS . 'core.php';
         $previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1);
         if ($previewdata[0]->image == '') {
             $previewdata[0]->image = 'components/com_community/assets/user-Male.png';
         }
         return $previewdata;
     } else {
         return '';
     }
 }
Example #17
0
    /**
     * Renders the view
     *
     * @param   string  $tpl  Template name
     *
     * @return void
     */
    public function display($tpl = null)
    {
        $password = JFactory::getApplication()->getUserState('com_joomlaupdate.password', null);
        $filesize = JFactory::getApplication()->getUserState('com_joomlaupdate.filesize', null);
        $ajaxUrl = JUri::base() . 'components/com_joomlaupdate/restore.php';
        $returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise';
        // Set the toolbar information
        JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'install');
        JToolBarHelper::divider();
        JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE');
        // Add toolbar buttons
        if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate')) {
            JToolbarHelper::preferences('com_joomlaupdate');
        }
        // Load mooTools
        JHtml::_('behavior.framework', true);
        $updateScript = <<<ENDSCRIPT
var joomlaupdate_password = '******';
var joomlaupdate_totalsize = '{$filesize}';
var joomlaupdate_ajax_url = '{$ajaxUrl}';
var joomlaupdate_return_url = '{$returnUrl}';

ENDSCRIPT;
        // Load our Javascript
        $document = JFactory::getDocument();
        $document->addScript('../media/com_joomlaupdate/json2.js');
        $document->addScript('../media/com_joomlaupdate/encryption.js');
        $document->addScript('../media/com_joomlaupdate/update.js');
        JHtml::_('script', 'system/progressbar.js', true, true);
        JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
        $document->addScriptDeclaration($updateScript);
        // Render the view
        parent::display($tpl);
    }
Example #18
0
 /**
  * After a person replies a topic
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public function onAfterReply($message)
 {
     $length = JString::strlen($message->message);
     // Assign points for replying a thread
     if ($length > $this->params->get('activity_points_limit', 0)) {
         $this->assignPoints('thread.reply');
     }
     // Assign badge for replying to a thread
     if ($length > $this->params->get('activity_badge_limit', 0)) {
         $this->assignBadge('thread.reply', JText::_('PLG_KUNENA_EASYSOCIAL_BADGE_REPLY_TITLE'));
     }
     $stream = FD::stream();
     $tmpl = $stream->getTemplate();
     $tmpl->setActor($message->userid, SOCIAL_TYPE_USER);
     $tmpl->setContext($message->id, 'kunena');
     $tmpl->setVerb('reply');
     $tmpl->setAccess('core.view');
     // Add into stream
     $stream->add($tmpl);
     // Get a list of subscribers
     $recipients = $this->getSubscribers($message);
     if (!$recipients) {
         return;
     }
     $permalink = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $message->getPermaUrl(null);
     $options = array('uid' => $message->id, 'actor_id' => $message->userid, 'title' => '', 'type' => 'post', 'url' => $permalink, 'image' => '');
     // Add notifications in EasySocial
     FD::notify('post.reply', $recipients, array(), $options);
 }
Example #19
0
 /**
  * Retrieve path to file in hard disk based from file URL
  *
  * @param   string  $file  URL to the file
  * @return  string
  */
 public static function getFilePath($file)
 {
     // Located file from root
     if (strpos($file, '/') === 0) {
         if (file_exists($tmp = realpath(str_replace(JUri::root(true), JPATH_ROOT, $file)))) {
             return $tmp;
         } elseif (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $file))) {
             return $tmp;
         } elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $file))) {
             return $tmp;
         }
     }
     if (strpos($file, '://') !== false && JURI::isInternal($file)) {
         $path = parse_url($file, PHP_URL_PATH);
         if (file_exists($tmp = realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $path))) {
             return $tmp;
         } elseif (file_exists($tmp = realpath(JPATH_ROOT . '/' . $path))) {
             return $tmp;
         }
     }
     $rootURL = JUri::root();
     $currentURL = JUri::current();
     $currentPath = JPATH_ROOT . '/' . substr($currentURL, strlen($rootURL));
     $currentPath = str_replace(DIRECTORY_SEPARATOR, '/', $currentPath);
     $currentPath = dirname($currentPath);
     return JPath::clean($currentPath . '/' . $file);
 }
Example #20
0
 /**
  * Method to get the field input markup for a generic list.
  * Use the multiple attribute to enable multiselect.
  *
  * @return  string  The field input markup.
  *
  * @since   1.0
  */
 protected function getInput()
 {
     // Receive ajax URL
     $ajaxUrl = isset($this->element['url']) ? (string) $this->element['url'] : null;
     if ($ajaxUrl) {
         $siteUrl = JUri::root();
         $adminUrl = $siteUrl . 'administrator';
         $this->ajaxchildOptions['ajaxUrl'] = str_replace(array('{admin}', '{backend}', '{site}', '{frontend}'), array($adminUrl, $adminUrl, $siteUrl, $siteUrl), $ajaxUrl);
     }
     // Receive child field selector
     $childSelector = isset($this->element['child_selector']) ? (string) $this->element['child_selector'] : null;
     if ($childSelector) {
         $this->ajaxchildOptions['childSelector'] = $childSelector;
     }
     // Receive parent field selector
     $parentSelector = isset($this->element['parent_selector']) ? (string) $this->element['parent_selector'] : null;
     if ($parentSelector) {
         $this->ajaxchildOptions['parentSelector'] = $parentSelector;
     }
     // Receive parent request var
     $parentVarName = isset($this->element['parent_varname']) ? (string) $this->element['parent_varname'] : null;
     if ($parentVarName) {
         $this->ajaxchildOptions['parentVarName'] = $parentVarName;
     }
     return parent::getInput();
 }
Example #21
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     if (!$app->isAdmin()) {
         return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
     }
     // Do not allow cache
     $app->allowCache(false);
     JHtml::_('behavior.framework', true);
     JFactory::getDocument()->addScriptDeclaration("\r\n\t\twindow.addEvent('domready', function()\r\n\t\t{\r\n\t\t\twindow.parent.document.updateUploader();\r\n\t\t\t\$\$('a.img-preview').each(function(el)\r\n\t\t\t{\r\n\t\t\t\tel.addEvent('click', function(e)\r\n\t\t\t\t{\r\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});");
     $images = $this->get('images');
     $documents = $this->get('documents');
     $folders = $this->get('folders');
     $state = $this->get('state');
     // Check for invalid folder name
     if (empty($state->folder)) {
         $dirname = JRequest::getVar('folder', '', '', 'string');
         if (!empty($dirname)) {
             $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8');
             JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname));
         }
     }
     $this->baseURL = JUri::root();
     $this->images =& $images;
     $this->documents =& $documents;
     $this->folders =& $folders;
     $this->state =& $state;
     parent::display($tpl);
 }
Example #22
0
function columnsYTShortcode($atts, $content = null)
{
    extract(ytshortcode_atts(array("grid" => 'no'), $atts));
    $show_grid = $grid == 'yes' ? 'show-grid' : '';
    JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/columns/css/columns.css");
    return '<div class="yt-clearfix yt-show-grid ' . $show_grid . ' ">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</div>';
}
Example #23
0
 /**
  * render MegaMene
  * 
  * @return string
  */
 public static function render()
 {
     $tempParams = self::$_templateParameters;
     $html = '';
     $uri = JUri::root(true);
     if ((string) $tempParams->get('enableMegamenu') == '1') {
         $doc = JFactory::getDocument();
         $doc->addStyleSheet($uri . '/plugins/system/jsntplframework/assets/3rd-party/bootstrap3/css/bootstrap.css');
         $doc->addStyleSheet($uri . '/plugins/system/jsntplframework/assets/joomlashine/css/jsn-megamenu-frontend.css');
         $doc->addScript($uri . '/plugins/system/jsntplframework/assets/joomlashine/js/megamenu/megamenu-frontend.js');
         $templateName = isset($doc->template) ? $doc->template : null;
         if (empty($templateName) or $templateName == 'system') {
             $templateDetails = JFactory::getApplication()->getTemplate(true);
             $templateName = $templateDetails->template;
         }
         $templateUrl = $uri . '/templates/' . $templateName;
         // Load megamenu Template CSS
         if (is_readable(JPATH_ROOT . '/templates/' . $templateName . '/css/megamenu/jsn_megamenu.css')) {
             $doc->addStylesheet($templateUrl . '/css/megamenu/jsn_megamenu.css');
         }
         $mmItems = self::megamenuItems();
         $renderShortcodeItems = self::renderShortcode($mmItems);
         $items = self::getMenuList();
         $html .= self::beginMegamenu();
         if (count($items)) {
             $html .= self::middleMegamenu($items, $mmItems, $renderShortcodeItems);
         }
         $html .= self::endMegamenu();
     }
     return $html;
 }
Example #24
0
 /**
  * Load common assets.
  *
  * @param   boolean  $inline  Whether to load assets inline or load in header?
  *
  * @return  void
  */
 public static function loadAssets($inline = false)
 {
     // Define common stylesheets
     $stylesheets = array();
     if (JSNVersion::isJoomlaCompatible('3.0')) {
         $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css';
         if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) {
             $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery.ui.1.9.0.ie.css';
         }
     } else {
         $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/bootstrap/css/bootstrap.min.css';
         $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.custom.css';
         if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) {
             $stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.ie.css';
         }
     }
     $stylesheets[] = JSN_URL_ASSETS . '/joomlashine/css/jsn-gui.css';
     // Load stylesheets
     if (!$inline) {
         JSNHtmlAsset::addStyle($stylesheets);
     } else {
         foreach ($stylesheets as $stylesheet) {
             $html[] = '<link type="text/css" href="' . $stylesheet . '" rel="stylesheet" />';
         }
         echo implode("\n", $html);
     }
     // Load scripts
     if (JSNVersion::isJoomlaCompatible('3.2')) {
         JSNHtmlAsset::addScript(JUri::root(true) . '/media/jui/js/jquery.min.js');
     }
 }
Example #25
0
 /**
  * This event is triggered after the framework has loaded and the application initialise method has been called.
  *
  * @return	void
  */
 public function onAfterDispatch()
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $input = $app->input;
     // Check to make sure we are loading an HTML view and there is a main component area
     if ($document->getType() !== 'html' || $input->get('tmpl', '', 'cmd') === 'component' || $app->isAdmin()) {
         return true;
     }
     // Get additional data to send
     $attrs = array();
     $attrs['title'] = $document->title;
     $attrs['language'] = $document->language;
     $attrs['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : JUri::current();
     $attrs['url'] = JURI::getInstance()->toString();
     $user = JFactory::getUser();
     // Get info about the user if logged in
     if (!$user->guest) {
         $attrs['email'] = $user->email;
         $name = explode(' ', $user->name);
         if (isset($name[0])) {
             $attrs['firstname'] = $name[0];
         }
         if (isset($name[count($name) - 1])) {
             $attrs['lastname'] = $name[count($name) - 1];
         }
     }
     $encodedAttrs = urlencode(base64_encode(serialize($attrs)));
     $buffer = $document->getBuffer('component');
     $image = '<img style="display:none" src="' . trim($this->params->get('base_url'), ' \\t\\n\\r\\0\\x0B/') . '/mtracking.gif?d=' . $encodedAttrs . '" />';
     $buffer .= $image;
     $document->setBuffer($buffer, 'component');
     return true;
 }
Example #26
0
 /**
  * @return string
  */
 public function run()
 {
     $config = CRM_Core_Config::singleton();
     switch ($config->userFramework) {
         case 'Drupal':
             $this->assign('ufAccessURL', url('admin/people/permissions'));
             break;
         case 'Drupal6':
             $this->assign('ufAccessURL', url('admin/user/permissions'));
             break;
         case 'Joomla':
             //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
             if (version_compare(JVERSION, '3.0', 'lt')) {
                 JHTML::_('behavior.modal');
                 $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
                 $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
                 $this->assign('ufAccessURL', $url);
                 $this->assign('jAccessParams', $jparams);
             } else {
                 $uri = (string) JUri::getInstance();
                 $return = urlencode(base64_encode($uri));
                 $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&return=' . $return;
                 $this->assign('ufAccessURL', $url);
                 $this->assign('jAccessParams', '');
             }
             break;
         case 'WordPress':
             $this->assign('ufAccessURL', CRM_Utils_System::url('civicrm/admin/access/wp-permissions', 'reset=1'));
             break;
     }
     return parent::run();
 }
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  * @since   1.6
  */
 protected function getInput()
 {
     JHtml::_('jquery.framework');
     $itemid = JFactory::getApplication()->input->getInt('id', 0);
     $document = JFactory::getDocument();
     $document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js');
     JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS');
     JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS');
     JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP');
     $html = '<div 
                 id="' . $this->id . '" 
                 class="form-horizontal customfield" 
                 data-fieldname="' . $this->fieldname . '" 
                 data-controller="' . $this->element['controller'] . '" 
                 data-itemid="' . $itemid . '">
                 <div class="form-container"></div>
                 <img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" />
                 <div class="control-group">
                     <div class="controls">
                         <button class="btn btn-primary btn-reload"><span class="icon-refresh"></span>&nbsp;' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button>
                     </div>
                 </div>
             </div>';
     return $html;
 }
Example #28
0
 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Load Akeeba Strapper
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::$tag = AKEEBAMEDIATAG;
         AkeebaStrapper::bootstrap();
         AkeebaStrapper::jQueryUI();
         AkeebaStrapper::addJSfile('media://com_akeeba/js/gui-helpers.js');
         AkeebaStrapper::addJSfile('media://com_akeeba/js/akeebaui.js');
         AkeebaStrapper::addJSfile('media://com_akeeba/js/piecon.min.js');
         jimport('joomla.filesystem.file');
         if (JFile::exists(F0FTemplateUtils::parsePath('media://com_akeeba/plugins/js/akeebaui.js', true))) {
             AkeebaStrapper::addJSfile('media://com_akeeba/plugins/js/akeebaui.js');
         }
         AkeebaStrapper::addCSSfile('media://com_akeeba/theme/akeebaui.css');
         // Control Check
         $view = F0FInflector::singularize($this->input->getCmd('view', $this->defaultView));
         if ($view == 'liveupdate') {
             $url = JUri::base() . 'index.php?option=com_akeeba';
             JFactory::getApplication()->redirect($url);
             return;
         }
     }
     return $result;
 }
Example #29
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('jquery.framework');
     NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/script.min.js');
     if ($file = $this->get('file')) {
         $label = $this->get('label', 'the main extension');
         NNFieldDependency::setMessage($file, $label);
         return '';
     }
     $path = $this->get('path') == 'site' ? '' : '/administrator';
     $label = $this->get('label');
     $file = $this->get('alias', $label);
     $file = preg_replace('#[^a-z-]#', '', strtolower($file));
     $extension = $this->get('extension');
     switch ($extension) {
         case 'com':
             $file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
             break;
         case 'mod':
             $file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
             break;
         case 'plg_editors-xtd':
             $file = '/plugins/editors-xtd/' . $file . '.xml';
             break;
         default:
             $file = '/plugins/system/' . $file . '.xml';
             break;
     }
     $label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')';
     NNFieldDependency::setMessage($file, $label);
     return '';
 }
Example #30
0
function frameYTShortcode($atts = null, $content = null)
{
    $atts = ytshortcode_atts(array('style' => 'default', 'align' => 'left', 'class' => ''), $atts, 'yt_frame');
    JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/frame/css/frame.css", 'text/css');
    JHtml::script("plugins/system/ytshortcodes/shortcodes/frame/js/frame.js");
    return '<span class="yt-frame yt-frame-align-' . $atts['align'] . ' yt-frame-style-' . $atts['style'] . '"><span class="yt-frame-inner">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</span></span><div class="clear clearfix"></div>';
}