示例#1
0
 public static function allowRewrite($task, $dst = '')
 {
     if (!jbetoloHelper::isApache()) {
         // TODO: Make nginx.conf.txt available
         $src = dirname(__FILE__) . '/assets/nginx.conf.txt';
         $msg = JText::sprintf('PLG_JBETOLO_HTACCESS_NGINX', $src);
         JLog::add($msg, JLog::WARNING, 'jerror');
         if (class_exists('JError')) {
             JError::raiseWarning(1, 'jbetolo::allowRewrite: ' . $msg);
         } else {
             throw new Exception('jbetolo::allowRewrite: ' . $msg);
         }
         return false;
     }
     if ((bool) plgSystemJBetolo::param('htaccess')) {
         if (JFactory::getApplication()->isSite()) {
             $result = self::createHTACCESS('create', JBETOLO_CACHE_DIR);
             if ($task == 'serve') {
                 return JFile::exists(JBETOLO_CACHE_DIR . '.htaccess');
             } else {
                 if ($task == 'create' || $task == 'cdn') {
                     return $result;
                 }
             }
         }
     }
     return false;
 }