Esempio n. 1
0
 /**
  * execute
  *
  * @return  void
  */
 public static function execute()
 {
     $app = \JFactory::getApplication();
     $input = $app->input;
     $option = $input->get('option');
     if ($option) {
         return;
     }
     if ($app->isSite() && !\Ezset::isHome()) {
         return;
     }
     $cmd = $input->getCmd('cmd');
     if ($cmd) {
         $cmd = str_replace('.', '/', $cmd);
         $file = EZSET_FRONT . '/cmd/' . $cmd . '.php';
         if (!file_exists($file)) {
             $file = EZSET_ROOT . '/cmd/' . $cmd . '.php';
         }
         if (file_exists($file)) {
             include $file;
         }
         jexit();
     }
 }
Esempio n. 2
0
 /**
  * setTitle
  *
  * @return  void
  */
 public static function setTitle()
 {
     $input = \JFactory::getApplication()->input;
     $ezset = \Ezset::getInstance();
     $doc = \JFactory::getDocument();
     $config = \JFactory::getConfig();
     $siteName = $config->get('sitename');
     $view = $input->get('view');
     $title = $doc->getTitle();
     // Fix for YOOTheme
     $title = explode('|', $title);
     $title = $title[0];
     $ezset->data->originTitle = $title;
     if (\Ezset::isHome()) {
         $ezset->data->siteTitle = $config->get('sitename');
     } else {
         $separator = trim($ezset->params->get('titleSeparator'));
         $replace['{%SITE%}'] = $siteName;
         $replace['{%TITLE%}'] = $title;
         if ('category' == $view || 'categories' == $view) {
             $replace['{%CATEGORY%}'] = '';
         } else {
             $replace['{%CATEGORY%}'] = $ezset->data->catName;
         }
         $siteTitle = strtr($ezset->params->get('titleFix'), $replace);
         $siteTitle = explode('|', $siteTitle);
         foreach ($siteTitle as $k => $v) {
             if (!trim($v)) {
                 unset($siteTitle[$k]);
                 continue;
             }
             $siteTitle[$k] = trim($siteTitle[$k]);
         }
         $siteTitle = implode(" {$separator} ", $siteTitle);
         $ezset->data->siteTitle = $siteTitle;
     }
 }
Esempio n. 3
0
 /**
  * register
  *
  * @return  void
  */
 public static function register()
 {
     $easyset = \Ezset::getInstance();
     $doc = \JFactory::getDocument();
     if ($easyset->app->isAdmin() || $doc->getType() != 'html') {
         return;
     }
     /** @var $params \JRegistry */
     $params = $easyset->params;
     $config = \JFactory::getConfig();
     $siteName = $config->get('sitename');
     $metaDesc = '';
     if ($params->get('getMeta')) {
         if ($easyset->data->metaDesc) {
             $doc->setDescription($easyset->data->metaDesc);
         }
     }
     // SEO Title
     $easyset->call(array('Seo\\ContentSeo', 'setTitle'));
     if ($params->get('titleFix') && $easyset->data->siteTitle) {
         $doc->setTitle($easyset->data->siteTitle);
     }
     // Set Generator
     if ($generator = $params->get('generator')) {
         $doc->setGenerator($generator);
     }
     // Set Open Graph
     if ($params->get('openGraph', 1)) {
         $meta = array();
         // Og:image
         if (\Ezset::isHome()) {
             if ($params->get('ogDefaultImage')) {
                 $meta[] = '<meta property="og:image" content="' . UriHelper::pathAddHost($params->get('ogDefaultImage')) . '"/>';
             }
         } elseif ($easyset->data->ogImages) {
             $count = $params->get('ogGetInnerPageImageCount', 1);
             foreach ($easyset->data->ogImages as $k => $image) {
                 if ($k + 1 > $count) {
                     break;
                 }
                 $meta[] = '<meta property="og:image" content="' . UriHelper::pathAddHost($image) . '"/>';
             }
         }
         // Others
         $url = $doc->getBase() ?: \JUri::base();
         $admin_id = $params->get('ogAdminId');
         $page_id = $params->get('ogPageId');
         $app_id = $params->get('ogAppId');
         $title = $params->get('ogOnlyTitle', 1) && !\Ezset::isHome() ? $easyset->data->originTitle : $doc->getTitle();
         $meta[] = '<meta property="og:title" content="' . $title . '"/>';
         $meta[] = '<meta property="og:site_name" content="' . $siteName . '"/>';
         if ($metaDesc) {
             $meta[] = '<meta property="og:description" content="' . $metaDesc . '"/>';
         }
         $meta[] = '<meta property="og:url" content="' . $url . '"/>';
         // Admin, page, user ids
         if ($admin_id) {
             $meta[] = '<meta property="fb:admins" content="' . $admin_id . '"/>';
         }
         if ($page_id) {
             $meta[] = '<meta property="fb:page_id" content="' . $page_id . '"/>';
         }
         if ($app_id) {
             $meta[] = '<meta property="fb:app_id" content="' . $app_id . '"/>';
         }
         foreach ($meta as $v) {
             /** @var $doc \JDocumentHtml */
             $doc->addCustomTag($v);
         }
     }
 }