Example #1
0
 private static function get_class_dinamic_path($class)
 {
     //$file = '';
     // контроллеры панели управления
     if (strpos($class, 'actionsAdmin', 0) === 0) {
         $name = str_replace('actionsAdmin', '', $class);
         $name = joosInflector::underscore($name);
         $file = 'app' . DS . 'components' . DS . $name . DS . 'controller.admin.' . $name . '.php';
         // аякс-контроллеры панели управления
     } elseif (strpos($class, 'actionsAjaxAdmin', 0) === 0) {
         $name = str_replace('actionsAjaxAdmin', '', $class);
         $name = strtolower($name);
         $file = 'app' . DS . 'components' . DS . $name . DS . 'controller.admin.' . $name . '.ajax.php';
         // аякс-контроллеры фронта
     } elseif (strpos($class, 'actionsAjax', 0) === 0) {
         $name = str_replace('actionsAjax', '', $class);
         $name = strtolower($name);
         $file = 'app' . DS . 'components' . DS . $name . DS . 'controller.' . $name . '.ajax.php';
         // контроллеры фронта
     } elseif (strpos($class, 'actions', 0) === 0) {
         $name = str_replace('actions', '', $class);
         $name = strtolower($name);
         $file = 'app' . DS . 'components' . DS . $name . DS . 'controller.' . $name . '.php';
         // системные библиотеки
     } elseif (strpos($class, 'joos', 0) === 0) {
         $name = str_replace('joos', '', $class);
         $name = strtolower($name);
         $file = 'core' . DS . 'libraries' . DS . $name . '.php';
         // модели панели управления
     } elseif (strpos($class, 'modelAdmin', 0) === 0) {
         $name = str_replace('modelAdmin', '', $class);
         $name = strtolower($name);
         $file = 'app' . DS . 'components' . DS . $name . DS . 'models' . DS . 'model.admin.' . $name . '.php';
         // модели сайта
     } elseif (strpos($class, 'model', 0) === 0) {
         $name = str_replace('model', '', $class);
         $name = strtolower($name);
         $file = 'app' . DS . 'components' . DS . $name . DS . 'models' . DS . 'model.' . $name . '.php';
         // хелперы модулей
     } elseif (strpos($class, 'modulesHelper', 0) === 0) {
         $name = str_replace('modulesHelper', '', $class);
         $name = strtolower($name);
         $file = 'app' . DS . 'modules' . DS . $name . DS . 'helper.' . $name . '.php';
         // модели фронта
     } else {
         throw new joosAutoloaderFileNotFoundException('Правило загрузки для класса :class_name не обнаружено', array(':class_name' => $class));
     }
     return $file;
 }
Example #2
0
 /**
  * Построение карты
  *
  * @return $map Объект карты
  */
 public function get_map($xml = false)
 {
     //Создаем экземпляр класса
     $map = new self();
     // Создаем текстовую копию сайтмапа
     $links = array();
     //Проходимся по всем пространствам карты (каждое пространство - компонент)
     foreach ($map->spaces as $space) {
         //Подключаем плагин для компонента
         require_once JPATH_APP_PLUGINS_BASE . DS . 'sitemap' . DS . $space . '.php';
         //По несложному правилу определяем имя модельки
         $model = 'pluginSitemap' . joosInflector::camelize($space);
         //Настройки плагина
         $params = $model::get_params();
         $params['xml'] = $xml;
         //Получаем схему (массив с блоками), согласно которой перебираем блоки
         //(блоки отличаются, в основном, правилами формирования ссылок и аттрибутами)
         foreach ($model::get_mapdata_scheme($params) as $map_block) {
             //У каждого блока задан тип: 'single' - одиночная ссылка, 'list' - набор однотипных ссылок
             //Если тип  = 'list' - получаем массив объектов с ссылками из соответствующего метода плагина
             // - название метода, с помощью которого мы получаем массив содержится в элемента массива, описывающего блок (ключ элемента - 'id')
             $data = $map_block['type'] == 'single' ? null : call_user_func($map_block['call_from'], isset($map_block['call_params']) ? $map_block['call_params'] : null);
             // Достаем ссылки
             foreach ($data as $item) {
                 $links[] = $item->loc;
             }
             //Добавляем блок в общий массив с ссылками карты сайта
             $map->add_mapblock($space, $map_block, $data);
         }
     }
     // Записываем массив с ссылками в файл
     $filename = JPATH_BASE . DS . 'sitemap.txt';
     joosFile::exists($filename) ? joosFile::delete($filename) : null;
     joosFile::put_content($filename, implode("\n", $links));
     return $map;
 }
Example #3
0
 private static function get_plugin_name($string)
 {
     return joosInflector::camelize($string);
 }
 public function codegenerator()
 {
     $template_vars_default = array('component_title' => '', 'component_name' => '', 'component_description' => '', 'component_author' => 'Joostina Team', 'component_authoremail' => '*****@*****.**', 'component_copyright' => '(C) 2007-2012 Joostina Team');
     $template_vars = array();
     foreach ($template_vars_default as $var => $default_value) {
         $value = joosRequest::post($var, false);
         $template_vars[':' . $var] = $value ? $value : $default_value;
     }
     $template_vars[':component_name_camelcase'] = joosInflector::camelize($template_vars[':component_name']);
     $template_path_root = JPATH_BASE . DS . 'app' . DS . 'components' . DS . 'coder' . DS . 'templates' . DS . 'component' . DS;
     $template_files = array('controller.component_name', 'controller.component_name.ajax', 'controller.admin.component_name', 'controller.admin.component_name.ajax');
     $return = array();
     $create_files = array();
     foreach ($template_files as $template_file) {
         $template_body = joosFile::get_content($template_path_root . $template_file);
         $file_body = strtr($template_body, $template_vars);
         $file_name = str_replace('component_name', $template_vars[':component_name'], $template_file);
         $return[$template_file] = sprintf('%s.php<br /><textarea class="span10" rows="10">%s</textarea>', $file_name, $file_body);
         $create_files[$file_name] = $file_body;
     }
     return array('success' => true, 'body' => implode("\n", $return), 'component_name' => $template_vars[':component_name'], 'files_body' => $create_files);
 }
Example #5
0
 /**
  * Установка содержимого редактора в определённое место (выделеноое или под курсором)
  *
  * @param string $field_name название поля на котором инициализирован редактор
  * @param string $content    текст, устанавливаемый в редактор
  *
  * @return mixed js код получения содержмиого, либо js код и комплект необходимого HTML кода
  */
 public static function insert_content($field_name, $content)
 {
     $editor_class = 'pluginEditor' . joosInflector::camelize(self::$editor);
     return call_user_func_array("{$editor_class}::set_content", array($field_name, $content));
 }