当前位置: 首页>>代码示例>>PHP>>正文


PHP templates_path函数代码示例

本文整理汇总了PHP中templates_path函数的典型用法代码示例。如果您正苦于以下问题:PHP templates_path函数的具体用法?PHP templates_path怎么用?PHP templates_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了templates_path函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: installTemplateContent

 private function installTemplateContent($template_name)
 {
     $default_content_folder = mw_includes_path() . 'install' . DIRECTORY_SEPARATOR;
     $default_content_file = $default_content_folder . 'mw_default_content.zip';
     if ($template_name) {
         if (function_exists('templates_path')) {
             $template_dir = templates_path() . DS . $template_name;
             $template_dir = normalize_path($template_dir, true);
             if (is_dir($template_dir)) {
                 $template_default_content = $template_dir . 'mw_default_content.zip';
                 if (is_file($template_default_content) and is_readable($template_default_content)) {
                     $default_content_file = $template_default_content;
                     $default_content_folder = $template_dir;
                 }
             }
         }
     }
     if (is_file($default_content_file)) {
         $restore = new \Microweber\Utils\Backup();
         $restore->backups_folder = $default_content_folder;
         $restore->backup_file = 'mw_default_content.zip';
         ob_start();
         try {
             $rest = $restore->exec_restore();
         } catch (Exception $e) {
             return false;
         }
         ob_get_clean();
         return true;
     } else {
         return false;
     }
 }
开发者ID:Git-Host,项目名称:microweber,代码行数:33,代码来源:TemplateInstaller.php

示例2: site_templates

 /**
  * @desc  Get the template layouts info under the layouts subdir on your active template
  * @param $options
  * $options ['type'] - 'layout' is the default type if you dont define any. You can define your own types as post/form, etc in the layout.txt file
  * @return array
  * @author    Microweber Dev Team
  * @since Version 1.0
  */
 public function site_templates($options = false)
 {
     $args = func_get_args();
     $function_cache_id = '';
     foreach ($args as $k => $v) {
         $function_cache_id = $function_cache_id . serialize($k) . serialize($v);
     }
     $cache_id = __FUNCTION__ . crc32($function_cache_id);
     $cache_group = 'templates';
     $cache_content = false;
     //  $cache_content = $this->app->cache_manager->get($cache_id, $cache_group);
     if ($cache_content != false) {
         // return $cache_content;
     }
     if (!isset($options['path'])) {
         $path = templates_path();
     } else {
         $path = $options['path'];
     }
     $path_to_layouts = $path;
     $layout_path = $path;
     $map = $this->directory_map($path, TRUE, TRUE);
     $to_return = array();
     if (!is_array($map) or empty($map)) {
         return false;
     }
     foreach ($map as $dir) {
         //$filename = $path . $dir . DIRECTORY_SEPARATOR . 'layout.php';
         $filename = $path . DIRECTORY_SEPARATOR . $dir;
         $filename_location = false;
         $filename_dir = false;
         $filename = normalize_path($filename);
         $filename = rtrim($filename, '\\');
         $filename = substr($filename, 0, 1) === '.' ? substr($filename, 1) : $filename;
         if (!@is_file($filename) and @is_dir($filename)) {
             $fn1 = normalize_path($filename, true) . 'config.php';
             $fn2 = normalize_path($filename);
             if (is_file($fn1)) {
                 $config = false;
                 include $fn1;
                 if (!empty($config)) {
                     $c = $config;
                     $c['dir_name'] = $dir;
                     $screensshot_file = $fn2 . '/screenshot.png';
                     $screensshot_file = normalize_path($screensshot_file, false);
                     if (is_file($screensshot_file)) {
                         $c['screenshot'] = $this->app->url_manager->link_to_file($screensshot_file);
                     }
                     $to_return[] = $c;
                 }
             } else {
                 $filename_dir = false;
             }
             //	$path = $filename;
         }
     }
     //$this->app->cache_manager->save($to_return, $cache_id, $cache_group, 'files');
     return $to_return;
 }
开发者ID:newaltcoin,项目名称:microweber,代码行数:67,代码来源:TemplateManager.php

示例3: define_constants


//.........这里部分代码省略.........
         } else {
             if (isset($content) and isset($content['active_site_template']) and $content['active_site_template'] != '' and strtolower($content['active_site_template']) != 'default') {
                 $the_active_site_template = $content['active_site_template'];
             } else {
                 $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
                 //
             }
         }
     }
     if (isset($content['parent']) and $content['parent'] != 0 and isset($content['layout_file']) and $content['layout_file'] == 'inherit') {
         $inh = $this->get_inherited_parent($content['id']);
         if ($inh != false) {
             $inh_parent = $this->get_by_id($inh);
             if (isset($inh_parent['active_site_template']) and $inh_parent['active_site_template'] != '' and strtolower($inh_parent['active_site_template']) != 'default') {
                 $the_active_site_template = $inh_parent['active_site_template'];
             } else {
                 if (isset($inh_parent['active_site_template']) and $inh_parent['active_site_template'] != '' and strtolower($inh_parent['active_site_template']) == 'default') {
                     $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
                 } else {
                     if (isset($inh_parent['active_site_template']) and $inh_parent['active_site_template'] == '') {
                         $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
                     }
                 }
             }
         }
     }
     if (isset($the_active_site_template) and $the_active_site_template != 'default' and $the_active_site_template == 'mw_default') {
         $the_active_site_template = 'default';
     }
     if ($the_active_site_template == false) {
         $the_active_site_template = 'default';
     }
     if (defined('THIS_TEMPLATE_DIR') == false and $the_active_site_template != false) {
         define('THIS_TEMPLATE_DIR', templates_path() . $the_active_site_template . DS);
     }
     if (defined('THIS_TEMPLATE_FOLDER_NAME') == false and $the_active_site_template != false) {
         define('THIS_TEMPLATE_FOLDER_NAME', $the_active_site_template);
     }
     $the_active_site_template_dir = normalize_path(templates_path() . $the_active_site_template . DS);
     if (defined('DEFAULT_TEMPLATE_DIR') == false) {
         define('DEFAULT_TEMPLATE_DIR', templates_path() . 'default' . DS);
     }
     if (defined('DEFAULT_TEMPLATE_URL') == false) {
         define('DEFAULT_TEMPLATE_URL', templates_url() . '/default/');
     }
     if (trim($the_active_site_template) != 'default') {
         if (!strstr($the_active_site_template, DEFAULT_TEMPLATE_DIR)) {
             $use_default_layouts = $the_active_site_template_dir . 'use_default_layouts.php';
             if (is_file($use_default_layouts)) {
                 if (isset($page['layout_file'])) {
                     $template_view = DEFAULT_TEMPLATE_DIR . $page['layout_file'];
                 } else {
                     $template_view = DEFAULT_TEMPLATE_DIR;
                 }
                 if (isset($page)) {
                     if (!isset($page['layout_file']) or (isset($page['layout_file']) and $page['layout_file'] == 'inherit' or $page['layout_file'] == '')) {
                         $par_page = $this->get_inherited_parent($page['id']);
                         if ($par_page != false) {
                             $par_page = $this->get_by_id($par_page);
                         }
                         if (isset($par_page['layout_file'])) {
                             $the_active_site_template = $par_page['active_site_template'];
                             $page['layout_file'] = $par_page['layout_file'];
                             $page['active_site_template'] = $par_page['active_site_template'];
                             $template_view = templates_path() . $page['active_site_template'] . DS . $page['layout_file'];
                         }
开发者ID:Git-Host,项目名称:microweber,代码行数:67,代码来源:ContentManager.php

示例4: frontend


//.........这里部分代码省略.........
             $page_url_segment_1 = $this->app->url_manager->segment(0, $page_url);
             if ($preview_module != false) {
                 $page_url = $preview_module;
             }
             if ($the_active_site_template == false or $the_active_site_template == '') {
                 $the_active_site_template = 'default';
             }
             if ($page_exact == false and $found_mod == false and $this->app->modules->is_installed($page_url) and $page_url != 'settings' and $page_url != 'admin') {
                 $found_mod = true;
                 $page['id'] = 0;
                 $page['content_type'] = 'page';
                 $page['parent'] = '0';
                 $page['url'] = $this->app->url_manager->string();
                 $page['active_site_template'] = $the_active_site_template;
                 template_var('no_edit', 1);
                 $mod_params = '';
                 if ($preview_module_template != false) {
                     $mod_params = $mod_params . " template='{$preview_module_template}' ";
                 }
                 if ($preview_module_id != false) {
                     $mod_params = $mod_params . " id='{$preview_module_id}' ";
                 }
                 $found_mod = $page_url;
                 $page['content'] = '<microweber module="' . $page_url . '" ' . $mod_params . '  />';
                 //  $page['simply_a_file'] = 'clean.php';
                 $page['layout_file'] = 'clean.php';
                 template_var('content', $page['content']);
                 template_var('new_page', $page);
             }
             if ($found_mod == false) {
                 if (empty($page)) {
                     $the_new_page_file = false;
                     $page_url_segment_1 = $this->app->url_manager->segment(0, $page_url);
                     $td = templates_path() . $page_url_segment_1;
                     $td_base = $td;
                     $page_url_segment_2 = $this->app->url_manager->segment(1, $page_url);
                     $directly_to_file = false;
                     $page_url_segment_3 = $this->app->url_manager->segment(-1, $page_url);
                     $page_url_segment_1 = $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
                     $td_base = templates_path() . $the_active_site_template . DS;
                     $page_url_segment_3_str = implode(DS, $page_url_segment_3);
                     if ($page_url_segment_3_str != '') {
                         $page_url_segment_3_str = rtrim($page_url_segment_3_str, DS);
                         $page_url_segment_3_str = rtrim($page_url_segment_3_str, '\\');
                         $page_url_segment_3_str_copy = $page_url_segment_3_str;
                         $is_ext = get_file_extension($page_url_segment_3_str);
                         if ($is_ext == false or $is_ext != 'php') {
                             $page_url_segment_3_str = $page_url_segment_3_str . '.php';
                         }
                         $td_f = $td_base . DS . $page_url_segment_3_str;
                         $td_fd = $td_base . DS . $page_url_segment_3_str_copy;
                         $td_fd2 = $td_base . DS . $page_url_segment_3[0];
                         if (is_file($td_f)) {
                             $the_new_page_file = $page_url_segment_3_str;
                             $simply_a_file = $directly_to_file = $td_f;
                         } else {
                             if (is_dir($td_fd)) {
                                 $td_fd_index = $td_fd . DS . 'index.php';
                                 if (is_file($td_fd_index)) {
                                     $the_new_page_file = $td_fd_index;
                                     $simply_a_file = $directly_to_file = $td_fd_index;
                                 }
                             } else {
                                 $is_ext = get_file_extension($td_fd);
                                 if ($is_ext == false or $is_ext != 'php') {
                                     $td_fd = $td_fd . '.php';
开发者ID:microweber,项目名称:microweber,代码行数:67,代码来源:DefaultController.php

示例5: install_from_market

 private function install_from_market($item)
 {
     if (isset($item['url']) and !isset($item['download'])) {
         $item['download'] = $item['url'];
     } elseif (isset($item['download_url']) and !isset($item['download'])) {
         $item['download'] = $item['download_url'];
     }
     $download_target = false;
     if (isset($item['download']) and !isset($item['size'])) {
         $url = $item['download'];
         $download_target = $this->temp_dir . md5($url) . basename($url);
         $download_target_extract_lock = $this->temp_dir . md5($url) . basename($url) . '.unzip_lock';
         $this->_log_msg('Downloading from marketplace');
         //if (!is_file($download_target)){
         $dl = $this->http()->url($url)->download($download_target);
         //}
     } else {
         if (isset($item['download']) and isset($item['size'])) {
             $expected = intval($item['size']);
             $download_link = $item['download'];
             $ext = get_file_extension($download_link);
             if ($ext != 'zip') {
                 return;
             }
             if ($download_link != false and $expected > 0) {
                 $text = $download_link;
                 $regex = '/\\b((?:[\\w\\d]+\\:\\/\\/)?(?:[\\w\\-\\d]+\\.)+[\\w\\-\\d]+(?:\\/[\\w\\-\\d]+)*(?:\\/|\\.[\\w\\-\\d]+)?(?:\\?[\\w\\-\\d]+\\=[\\w\\-\\d]+\\&?)?(?:\\#[\\w\\-\\d]*)?)\\b/';
                 preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
                 foreach ($matches as $match) {
                     if (isset($match[0])) {
                         $url = $download_link;
                         $download_target = $this->temp_dir . basename($download_link);
                         $download_target_extract_lock = $this->temp_dir . basename($download_link) . '.unzip_lock';
                         $expectd_item_size = $item['size'];
                         if (!is_file($download_target) or filesize($download_target) != $item['size']) {
                             $dl = $this->http()->url($url)->download($download_target);
                             if ($dl == false) {
                                 if (is_file($download_target) and filesize($download_target) != $item['size']) {
                                     $fs = filesize($download_target);
                                     return array('size' => $fs, 'expected_size' => $expected, 'try_again' => "true", 'warning' => "Only " . $fs . ' bytes downloaded of total ' . $expected);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($download_target != false and is_file($download_target)) {
         $where_to_unzip = MW_ROOTPATH;
         if (isset($item['item_type'])) {
             if ($item['item_type'] == 'module') {
                 $where_to_unzip = modules_path();
             } elseif ($item['item_type'] == 'module_template') {
                 $where_to_unzip = modules_path();
             } elseif ($item['item_type'] == 'template') {
                 $where_to_unzip = templates_path();
             } elseif ($item['item_type'] == 'element') {
                 $where_to_unzip = elements_path();
             }
             if (isset($item['install_path']) and $item['install_path'] != false) {
                 if ($item['item_type'] == 'module_template') {
                     $where_to_unzip = $where_to_unzip . DS . $item['install_path'] . DS . 'templates' . DS;
                 } else {
                     $where_to_unzip = $where_to_unzip . DS . $item['install_path'];
                 }
             }
             $where_to_unzip = str_replace('..', '', $where_to_unzip);
             $where_to_unzip = normalize_path($where_to_unzip, true);
             $this->_log_msg('Unzipping in ' . $where_to_unzip);
             $unzip = new \Microweber\Utils\Unzip();
             $target_dir = $where_to_unzip;
             $result = $unzip->extract($download_target, $target_dir, $preserve_filepath = true);
             $new_composer = $target_dir . 'composer.json';
             if (is_file($new_composer)) {
                 // $this->composer_merge($new_composer);
             }
             $num_files = count($result);
             return array('files' => $result, 'location' => $where_to_unzip, 'success' => "Item is installed. {$num_files} files extracted in {$where_to_unzip}");
         }
     }
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:82,代码来源:UpdateManager.php

示例6: index


//.........这里部分代码省略.........
         }
     }
     if (isset($data['module'])) {
         $mod_n = $data['data-type'] = $data['module'];
         unset($data['module']);
     }
     if (isset($data['type'])) {
         $mod_n = $data['data-type'] = $data['type'];
         unset($data['type']);
     }
     if (isset($data['data-type']) != false) {
         $data['data-type'] = rtrim($data['data-type'], '/');
         $data['data-type'] = rtrim($data['data-type'], '\\');
         $data['data-type'] = str_replace('__', '/', $data['data-type']);
     }
     if (!isset($data)) {
         $data = $_REQUEST;
     }
     if (!isset($data['module']) and isset($mod_from_url) and $mod_from_url != false) {
         $data['module'] = $mod_from_url;
     }
     if (!isset($data['id']) and isset($_REQUEST['id']) == true) {
         $data['id'] = $_REQUEST['id'];
     }
     if (isset($data['ondrop'])) {
         if (!defined('MW_MODULE_ONDROP')) {
             define('MW_MODULE_ONDROP', true);
         }
         unset($data['ondrop']);
     }
     if ($mod_n == 'layout') {
         if (isset($data['template'])) {
             $t = str_replace('..', '', $data['template']);
             $possible_layout = templates_path() . $t;
             $possible_layout = normalize_path($possible_layout, false);
             if (is_file($possible_layout)) {
                 $l = new \Microweber\View($possible_layout);
                 $layout = $l->__toString();
                 $layout = $this->app->parser->process($layout, $options = false);
                 echo $layout;
                 return;
             }
         }
     }
     $has_id = false;
     if (isset($data) and is_array($data)) {
         foreach ($data as $k => $v) {
             if ($k != 'ondrop') {
                 if ($k == 'id') {
                     $has_id = true;
                 }
                 if (is_array($v)) {
                     $v1 = $this->app->format->array_to_base64($v);
                     $tags .= "{$k}=\"{$v1}\" ";
                 } else {
                     $v = $this->app->format->clean_html($v);
                     //$v = $this->app->database_manager->escape_string($v);
                     $tags .= "{$k}=\"{$v}\" ";
                 }
             }
         }
     }
     if ($has_id == false) {
         //	$mod_n = $this->app->url_manager->slug($mod_n) . '-' . date("YmdHis");
         //	$tags .= "id=\"$mod_n\" ";
     }
开发者ID:microweber,项目名称:microweber,代码行数:67,代码来源:ModuleController.php

示例7: templates

 /**
  * module_templates
  *
  * Gets all templates for a module
  *
  * @package        modules
  * @subpackage     functions
  * @category       modules api
  */
 public function templates($module_name, $template_name = false, $get_settings_file = false)
 {
     $module_name = str_replace('admin', '', $module_name);
     $module_name_l = $this->locate($module_name);
     if ($module_name_l == false) {
         $module_name_l = modules_path() . DS . $module_name . DS;
         $module_name_l = normalize_path($module_name_l, 1);
     } else {
         $module_name_l = dirname($module_name_l) . DS . 'templates' . DS;
         $module_name_l = normalize_path($module_name_l, 1);
     }
     $module_name_l_theme = ACTIVE_TEMPLATE_DIR . 'modules' . DS . $module_name . DS . 'templates' . DS;
     $module_name_l_theme = normalize_path($module_name_l_theme, 1);
     if (!is_dir($module_name_l) and !is_dir($module_name_l_theme)) {
         return false;
     } else {
         if ($template_name == false) {
             $options = array();
             $options['for_modules'] = 1;
             $options['no_cache'] = 1;
             $options['path'] = $module_name_l;
             $module_name_l = $this->app->layouts_manager->scan($options);
             if (is_dir($module_name_l_theme)) {
                 $options['path'] = $module_name_l_theme;
                 $module_skins_from_theme = $this->app->layouts_manager->scan($options);
                 if (is_array($module_skins_from_theme)) {
                     if (!is_array($module_name_l)) {
                         $module_name_l = array();
                     }
                     $file_names_found = array();
                     if (is_array($module_skins_from_theme)) {
                         $comb = array_merge($module_skins_from_theme, $module_name_l);
                         if (is_array($comb) and !empty($comb)) {
                             foreach ($comb as $k1 => $itm) {
                                 if (!in_array($itm['layout_file'], $file_names_found)) {
                                     if (isset($itm['visible'])) {
                                         if ($itm['visible'] == 'false' or $itm['visible'] == 'no' or $itm['visible'] == 'n') {
                                             // skip
                                         } else {
                                             $file_names_found[] = $itm['layout_file'];
                                         }
                                     } else {
                                         $file_names_found[] = $itm['layout_file'];
                                     }
                                 } else {
                                     unset($comb[$k1]);
                                 }
                             }
                         }
                         $module_name_l = $comb;
                     }
                 }
             }
             return $module_name_l;
         } else {
             $template_name = str_replace('..', '', $template_name);
             $template_name_orig = $template_name;
             if ($get_settings_file == true) {
                 $is_dot_php = get_file_extension($template_name);
                 if ($is_dot_php != false and $is_dot_php == 'php') {
                     $template_name = str_ireplace('.php', '', $template_name);
                 }
                 $template_name = $template_name . '_settings';
             }
             $is_dot_php = get_file_extension($template_name);
             if ($is_dot_php != false and $is_dot_php != 'php') {
                 $template_name = $template_name . '.php';
             }
             $tf = $module_name_l . $template_name;
             $tf_theme = $module_name_l_theme . $template_name;
             $tf_from_other_theme = templates_path() . $template_name;
             $tf_from_other_theme = normalize_path($tf_from_other_theme, false);
             $tf_other_module = modules_path() . $template_name;
             $tf_other_module = normalize_path($tf_other_module, false);
             if (strstr($tf_from_other_theme, 'modules') and is_file($tf_from_other_theme)) {
                 return $tf_from_other_theme;
             } else {
                 if (is_file($tf_theme)) {
                     return $tf_theme;
                 } else {
                     if (is_file($tf)) {
                         return $tf;
                     } else {
                         if (strtolower($template_name_orig) != 'default' and is_file($tf_other_module)) {
                             return $tf_other_module;
                         } else {
                             return false;
                         }
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:101,代码来源:Modules.php

示例8: modules_url

  </tr>
  <tr>
    <td>userfiles_folder</td>
    <td><?php 
print modules_url();
?>
</td>
  </tr>
  <tr>
    <td>site_url</td>
    <td><?php 
print site_url();
?>
</td>
  </tr>
  <tr>
    <td>templates_path</td>
    <td><?php 
print templates_path();
?>
</td>
  </tr>
  <tr>
    <td>templates_url</td>
    <td><?php 
print templates_url();
?>
</td>
  </tr>
</table>
开发者ID:hyrmedia,项目名称:microweber,代码行数:30,代码来源:variables.php

示例9: template_save_css

 function template_save_css($params)
 {
     $is_admin = $this->app->user_manager->is_admin();
     if ($is_admin == false) {
         return false;
     }
     if (is_string($params)) {
         $params = parse_params($params);
     }
     $ref_page = false;
     if (!isset($params['active_site_template'])) {
         if (!isset($params['content_id'])) {
             if (isset($_SERVER['HTTP_REFERER'])) {
                 $ref_page_url = $_SERVER['HTTP_REFERER'];
                 if ($ref_page_url != '') {
                     $ref_page_url_rel = str_ireplace(site_url(), '', $ref_page_url);
                     if ($ref_page_url_rel == '') {
                         $ref_page1 = $this->app->content_manager->homepage();
                     } else {
                         $ref_page1 = $this->app->content_manager->get_by_url($ref_page_url, true);
                     }
                     if (isset($ref_page1['id'])) {
                         $ref_page = $this->app->content_manager->get_by_id(intval($ref_page1['id']));
                     }
                 }
             }
         } else {
             $ref_page = $this->app->content_manager->get_by_id(intval($params['content_id']));
         }
         if (isset($ref_page['id']) and isset($ref_page['content_type']) and $ref_page['content_type'] != 'page') {
             $ref_page_parent = $this->app->content_manager->get_by_id(intval($ref_page['id']));
             if (isset($ref_page_partent['parent']) and intval($ref_page_partent['parent']) != 0) {
                 $ref_page = $this->app->content_manager->get_by_id(intval($ref_page_partent['id']));
             } else {
                 $ref_page_parents = $this->app->content_manager->get_parents(intval($ref_page['id']));
                 if (!empty($ref_page_parents)) {
                     $ref_page_parent = array_pop($ref_page_parents);
                     $ref_page = $this->app->content_manager->get_by_id($ref_page_parent);
                 }
             }
         }
     } else {
         $ref_page = $params;
     }
     if (!is_array($ref_page) or empty($ref_page)) {
         return false;
     }
     $pd = $ref_page;
     if ($is_admin == true and is_array($pd)) {
         $save_page = $pd;
         if (isset($save_page["layout_file"]) and $save_page["layout_file"] == 'inherit') {
             $inherit_from_id = $this->app->content_manager->get_inherited_parent($save_page["id"]);
             $inherit_from = $this->app->content_manager->get_by_id($inherit_from_id);
             if (is_array($inherit_from) and isset($inherit_from['active_site_template'])) {
                 $save_page['active_site_template'] = $inherit_from['active_site_template'];
                 $save_page['layout_file'] = $inherit_from['layout_file'];
             }
         }
         $template = false;
         if (!isset($save_page['active_site_template']) or $save_page['active_site_template'] == '') {
             $template = 'default';
         } else {
             if (isset($save_page['active_site_template'])) {
                 $template = $save_page['active_site_template'];
             }
         }
         if ($template == 'default') {
             $site_template_settings = $this->app->option_manager->get('current_template', 'template');
             if ($site_template_settings != false and $site_template_settings != 'default') {
                 $template = $site_template_settings;
             }
         }
         $final_file_blocks = array();
         if ($template != false) {
             if (isset($_POST['save_template_settings'])) {
                 $json = json_encode($_POST);
                 $option = array();
                 $option['option_value'] = $json;
                 $option['option_key'] = 'template_settings';
                 $option['option_group'] = 'template_' . $template;
                 save_option($option);
             }
             $template_folder = templates_path() . $template . DS;
             $template_url = templates_url() . $template . '/';
             $this_template_url = THIS_TEMPLATE_URL;
             $template_folder = userfiles_path() . 'css' . DS . $template . DS;
             if (!is_dir($template_folder)) {
                 mkdir_recursive($template_folder);
             }
             $live_edit_css = $template_folder . 'live_edit.css';
             $fcont = '';
             if (is_file($live_edit_css)) {
                 $fcont = file_get_contents($live_edit_css);
             }
             $css_cont = $fcont;
             $css_cont_new = $css_cont;
             //@import on top
             $sort_params = array();
             $sort_params2 = array();
             foreach ($params as $item) {
//.........这里部分代码省略.........
开发者ID:hyrmedia,项目名称:microweber,代码行数:101,代码来源:LayoutsManager.php

示例10: foreach

     }
     ?>
         <?php 
 }
 ?>
         <?php 
 if (is_array($site_templates)) {
     ?>
             <?php 
     foreach ($site_templates as $site_template) {
         ?>
                 <?php 
         if (isset($site_template['dir_name'])) {
             ?>
                     <?php 
             $template_dir = templates_path() . $site_template['dir_name'];
             $possible_dir = $template_dir . DS . 'modules' . DS . $mod_name . DS;
             $possible_dir = normalize_path($possible_dir, false);
             ?>
                     <?php 
             if (is_dir($possible_dir)) {
                 ?>
                         <?php 
                 $options = array();
                 $options['for_modules'] = 1;
                 $options['path'] = $possible_dir;
                 $templates = mw()->layouts_manager->get_all($options);
                 ?>
                         <?php 
                 if (is_array($templates)) {
                     ?>
开发者ID:newaltcoin,项目名称:microweber,代码行数:31,代码来源:templates.php

示例11: get_layout


//.........这里部分代码省略.........
         $page['content_type'] = trim(str_replace('..', '', $page['content_type']));
         $template_view = ACTIVE_TEMPLATE_DIR . strtolower($page['content_type']) . '.php';
         if (is_file($template_view) == true) {
             $render_file = $template_view;
         }
     }
     if (isset($page['active_site_template']) and $render_file == false and (strtolower($page['active_site_template']) == 'default' or $page['active_site_template'] == $site_template_settings)) {
         if ($render_file == false and isset($page['active_site_template']) and isset($page['id'])) {
             if (isset($look_for_post) and $look_for_post != false) {
                 if (isset($look_for_post['content_type'])) {
                     $ct = str_replace('..', '', $look_for_post['content_type']);
                     $template_view = ACTIVE_TEMPLATE_DIR . $ct . '.php';
                     if ($render_file == false and is_file($template_view) == true) {
                         $render_file = $template_view;
                     }
                 }
                 $template_view = ACTIVE_TEMPLATE_DIR . 'index_inner.php';
                 if ($render_file == false and is_file($template_view) == true) {
                     $render_file = $template_view;
                 }
                 if (isset($look_for_post['content_type']) and $look_for_post['content_type'] != 'page') {
                     $template_view = ACTIVE_TEMPLATE_DIR . 'inner.php';
                     if ($render_file == false and is_file($template_view) == true) {
                         $render_file = $template_view;
                     }
                 }
             }
         }
         //
         if ($render_file == false and isset($page['parent']) and $page['parent'] == 0) {
             if ($render_file == false and isset($page['layout_file']) and $page['layout_file'] == 'inherit') {
                 $t_dir = ACTIVE_TEMPLATE_DIR;
                 if (isset($page['active_site_template'])) {
                     $t_dir = templates_path() . DS . $page['active_site_template'] . DS;
                     $t_dir = normalize_path($t_dir, 1);
                 }
                 $template_view_cl = $t_dir . 'clean.php';
                 $template_view_cl2 = $t_dir . 'layouts/clean.php';
                 if ($render_file == false and is_file($template_view_cl) == true) {
                     $render_file = $template_view_cl;
                 }
                 if ($render_file == false and is_file($template_view_cl2) == true) {
                     $render_file = $template_view_cl2;
                 }
             }
         }
         if ($render_file == false and isset($page['layout_file']) and $page['layout_file'] != false and $page['layout_file'] != 'index.php' and $page['layout_file'] != 'inherit') {
             if ($render_file == false and isset($page['layout_file']) and $page['layout_file'] != false) {
                 $page['layout_file'] = str_replace('__', DS, $page['layout_file']);
                 $template_view = ACTIVE_TEMPLATE_DIR . DS . $page['layout_file'];
                 $template_view = normalize_path($template_view, false);
                 if (is_file($template_view) == true) {
                     $render_file = $template_view;
                 } else {
                     if (!isset($page['is_home']) or $page['is_home'] != 1) {
                         $template_view = ACTIVE_TEMPLATE_DIR . DS . 'clean.php';
                         if (is_file($template_view) == true) {
                             $render_file = $template_view;
                         }
                     }
                 }
             }
         }
         $template_view = ACTIVE_TEMPLATE_DIR . 'index.php';
         if ($render_file == false and is_file($template_view) == true) {
             $render_file = $template_view;
开发者ID:hyrmedia,项目名称:microweber,代码行数:67,代码来源:MicroweberTemplate.php

示例12: modules_url

  </tr>
  <tr>
    <td>userfiles_folder</td>
    <td><?php 
echo modules_url();
?>
</td>
  </tr>
  <tr>
    <td>site_url</td>
    <td><?php 
echo site_url();
?>
</td>
  </tr>
  <tr>
    <td>templates_path</td>
    <td><?php 
echo templates_path();
?>
</td>
  </tr>
  <tr>
    <td>templates_url</td>
    <td><?php 
echo templates_url();
?>
</td>
  </tr>
</table>
开发者ID:microweber,项目名称:microweber,代码行数:30,代码来源:variables.php

示例13: event_trigger

 event_trigger('mw_db_init_modules');
 __mw_install_log('Scanning for modules');
 mw()->modules->scan_for_modules("skip_cache=1&cleanup_db=1");
 __mw_install_log('Installing modules');
 mw()->modules->update_db();
 __mw_install_log('Loading modules');
 event_trigger('mw_scan_for_modules');
 clearstatcache();
 _reload_c();
 if (isset($to_save['with_default_content'])) {
     if ($to_save['with_default_content'] != '{with_default_content}' and $to_save['with_default_content'] != 'no') {
         $default_content_folder = mw_includes_path() . 'install' . DIRECTORY_SEPARATOR;
         $default_content_file = $default_content_folder . 'mw_default_content.zip';
         if (isset($to_save['default_template']) and $to_save['default_template'] != false and $to_save['default_template'] != '{default_template}') {
             if (defined('templates_path()')) {
                 $template_dir = templates_path() . DS . $to_save['default_template'];
                 $template_dir = normalize_path($template_dir, true);
                 if (is_dir($template_dir)) {
                     $template_default_content = $template_dir . 'mw_default_content.zip';
                     if (is_file($template_default_content) and is_readable($template_default_content)) {
                         $default_content_file = $template_default_content;
                         $default_content_folder = $template_dir;
                     }
                 }
             }
         }
         if (is_file($default_content_file)) {
             __mw_install_log('Installing default content');
             define("MW_NO_DEFAULT_CONTENT", true);
             $restore = new \Microweber\Utils\Backup();
             $restore->backups_folder = $default_content_folder;
开发者ID:newaltcoin,项目名称:microweber,代码行数:31,代码来源:index+-+Copy.php


注:本文中的templates_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。