Пример #1
0
 public static function getTranslateParams($type = '', $original, $translation, $fieldname, $fields = null)
 {
     JoomFishManager::addIncludePath(JOOMFISH_LIBPATH . DS . 'translateparams', 'translateparams');
     JoomFishManager::addIncludePath(JOOMFISH_LIBPATH . DS . 'contentelement' . DS . 'contentelements', 'translateparams');
     $paramsclass = "TranslateParams_" . $type;
     if (!class_exists($paramsclass)) {
         // Search for the class file in the include paths.
         jimport('joomla.filesystem.path');
         if ($path = JPath::find(JoomFishManager::addIncludePath('', 'translateparams'), strtolower($type) . '.php')) {
             include_once $path;
         } else {
             if ($path = JPath::find(JoomFishManager::addIncludePath('', 'translateparams'), $paramsclass . '.php')) {
                 include_once $path;
             }
         }
     }
     if (!class_exists($paramsclass)) {
         jimport('joomfish.translateparams.translateparams');
         $paramsclass = "TranslateParams";
     }
     return new $paramsclass($original, $translation, $fieldname, $fields);
 }
 /**
  * Load and instantiate all necessary translation fitler classes 
  */
 public static function getTranslationFilters($catid, $contentElement)
 {
     JoomFishManager::addIncludePath(JOOMFISH_LIBPATH . DS . 'translationfilter', 'translationfilter');
     JoomFishManager::addIncludePath(JOOMFISH_LIBPATH . DS . 'contentelement' . DS . 'contentelements', 'translationfilter');
     if (!$contentElement) {
         return array();
     }
     $filterNames = $contentElement->getAllFilters();
     if (count($filterNames) > 0) {
         $filterNames["reset"] = "reset";
     }
     $filters = array();
     foreach ($filterNames as $key => $value) {
         $filterType = "translation" . ucfirst(strtolower($key)) . "Filter";
         //$classFile =  JOOMFISH_LIBPATH .DS. 'contentelement' .DS. 'contentelements'.DS. "$filterType.php";
         if (!class_exists($filterType)) {
             /*if (file_exists($classFile))
             		include_once($classFile);*/
             // Search for the class file in the include paths.
             jimport('joomla.filesystem.path');
             if ($path = JPath::find(JoomFishManager::addIncludePath('', 'translationfilter'), strtolower($key) . '.php')) {
                 include_once $path;
             } else {
                 if ($path = JPath::find(JoomFishManager::addIncludePath('', 'translationfilter'), $filterType . '.php')) {
                     include_once $path;
                 }
             }
             if (!class_exists($filterType)) {
                 continue;
             }
         }
         $filters[strtolower($key)] = new $filterType($contentElement);
     }
     return $filters;
 }