當前位置: 首頁>>代碼示例>>PHP>>正文


PHP theme::uses方法代碼示例

本文整理匯總了PHP中theme::uses方法的典型用法代碼示例。如果您正苦於以下問題:PHP theme::uses方法的具體用法?PHP theme::uses怎麽用?PHP theme::uses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在theme的用法示例。


在下文中一共展示了theme::uses方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: page

 /**
  * page
  *
  * @param  boolean $realpath
  * @return base_view_object_interface | string
  */
 public function page($view = null, $data = array())
 {
     $themeName = $params['theme'] ? $params['theme'] : kernel::single('site_theme_base')->get_default('wap');
     $theme = theme::uses($themeName);
     $layout = $this->layout;
     if (!$layout) {
         $layoutFlag = !is_null($this->layoutFlag) ? $this->layoutFlag : 'defalut';
         $tmplObj = kernel::single('site_theme_tmpl');
         $layout = $tmplObj->get_default($this->layoutFlag, $themeName);
         $layout = $layout ? $layout : (($tmpl_default = $tmplObj->get_default('default', $themeName)) ? $tmpl_default : 'default.html');
     }
     $theme->layout($layout);
     if (!is_null($view)) {
         $theme->of($view, $data);
     }
     return $theme->render();
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:23,代碼來源:controller.php

示例2: preview

 public function preview()
 {
     $themeName = input::get('theme');
     $layout = input::get('file');
     /** 清空widgets數據緩存 **/
     if ($_SESSION['WIDGET_TMP_DATA'][$themeName . '/' . $file]) {
         $_SESSION['WIDGET_TMP_DATA'][$themeName . '/' . $file] = array();
     }
     if ($_SESSION['WIDGET_TMP_DATA'][$themeName . '/block/header.html']) {
         $_SESSION['WIDGET_TMP_DATA'][$themeName . '/block/header.html'] = array();
     }
     if ($_SESSION['WIDGET_TMP_DATA'][$themeName . '/block/footer.html']) {
         $_SESSION['WIDGET_TMP_DATA'][$themeName . '/block/footer.html'] = array();
     }
     header('Content-Type: text/html; charset=utf-8');
     kernel::single('base_session')->close();
     $compiler = view::getEngine()->getCompiler();
     $compiler->loadCompileHelper(kernel::single('site_theme_complier'));
     $compiler->loadViewHelper(kernel::single('site_theme_helper'));
     $theme = theme::uses($themeName)->preview();
     return $theme->layout($layout)->render();
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:22,代碼來源:widget.php

示例3: editor

 public function editor($widgets, $widgets_app, $widgets_theme, $theme, $values = false)
 {
     $return = array();
     $widgets_config = $this->widgets_config($widgets, $widgets_app, $widgets_theme);
     $widgets_dir = $widgets_config['dir'];
     $setting = $this->widgets_info($widgets, $widgets_app, $widgets_theme);
     is_array($values) or $values = array();
     $values = array_merge($setting, $values);
     if (!empty($setting['template'])) {
         if (!is_array($setting['template'])) {
             $setting['template'] = array($setting['template'] => 'DEFAULT');
         }
         $return['tpls'][$file] = $setting['template'];
     } else {
         if ($widgets == 'html') {
             $widgets = 'usercustom';
             if (!$values['usercustom']) {
                 $values['usercustom'] = $values['html'];
             }
         }
         if ($handle = opendir($widgets_dir)) {
             while (false !== ($file = readdir($handle))) {
                 if (substr($file, 0, 1) != '_' && strtolower(substr($file, -5)) == '.html' && file_exists($widgets_dir . '/' . $file)) {
                     $return['tpls'][$file] = $file;
                 }
             }
             closedir($handle);
         } else {
             return false;
         }
     }
     $cur_theme = $theme;
     try {
         $isFind = true;
         theme::uses($theme);
         $configPath = theme::getThemeNamespace('widgets/' . $widgets . '/_config.html');
         view::getFinder()->find($configPath);
     } catch (\InvalidArgumentException $e) {
         $isFind = false;
     }
     if ($isFind) {
         $sFunc = $widgets_config['crun'];
         $sFuncFile = $widgets_config['cfg'];
         if (file_exists($sFuncFile)) {
             include_once $sFuncFile;
             if (function_exists($sFunc)) {
                 $pagedata['data'] = $sFunc($widgets_config['app']);
             }
         }
         $pagedata['setting'] =& $values;
         //$compile_code = $smarty->fetch_admin_widget($widgets_dir.'/_config.html',$widgets_app);
         $compile_code = view::make($configPath, $pagedata)->render();
         if ($compile_code) {
             $compile_code = ecos_cactus('site', 'theme_widget_prefix_content', $compile_code, $widgets_config['url']);
         }
         $return['html'] = $compile_code;
     }
     return $return;
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:59,代碼來源:widget.php

示例4: __site_parse_widget_instance

 public function __site_parse_widget_instance($widget, &$wg_compiler, $type)
 {
     static $a = 0;
     $a++;
     $output = '';
     $widgets_config = kernel::single('site_theme_widget')->widgets_config($widget['widgets_type'], $widget['app'], $widget['theme']);
     // widget 目錄路徑
     $widget_dir = $widgets_config['dir'];
     // widget 標識唯一來源
     $widget_flag = $widgets_config['flag'];
     // widget 函數名
     $widget_run = $widgets_config['run'];
     // widget url地址
     $widgets_url = $widgets_config['url'];
     // widget 處理函數所在文件完整路徑
     $func_file = $widgets_config['func'];
     // widget 模板文件完整路徑
     $tpl = $widget_dir . '/' . $widget['tpl'];
     //如果不存在模板, 則返回空
     if (!file_exists($tpl)) {
         return '';
     }
     $params = is_array($widget['params']) ? $widget['params'] : array();
     $output .= '$__widgets_setting = ' . var_export($params, 1) . ';';
     static $_widgets = array();
     if (file_exists($func_file)) {
         if (!isset($_widgets[$tpl])) {
             $output .= 'require(\'' . $func_file . '\');';
             $_widgets[$tpl] = true;
         }
         //todo:最簡單的方式取一下數據,否則緩存控製器無法得知widgets_instance會影響到緩存
         $output .= 'if(function_exists("' . $widget_run . '")) $__widgets_data = ' . $widget_run . '($__widgets_setting);';
     }
     $output .= sprintf('$__widgets_id = \'%s\';', $widget['widgets_id']);
     $pattern_from = array('/(\'|\\")(images\\/)/is', '/((?:background|src|href)\\s*=\\s*["|\'])(?:\\.\\/|\\.\\.\\/)?(images\\/.*?["|\'])/is', '/((?:background|background-image):\\s*?url\\()(?:\\.\\/|\\.\\.\\/)?(images\\/)/is');
     $pattern_to = array("\$1" . $widgets_url . '/' . "\$2", "\$1" . $widgets_url . '/' . "\$2", "\$1" . $widgets_url . '/' . "\$2");
     $content = preg_replace($pattern_from, $pattern_to, $content);
     theme::uses($widgets['theme']);
     $path = theme::getThemeNamespace('widgets/' . $widget['widgets_type'] . '/' . $widget['tpl']);
     $output .= sprintf('ob_start(); echo view::make(\'%s\', array(\'data\' => $__widgets_data, \'setting\' => $__widgets_setting, \'widgets_id\' => $__widgets_id))->render();', $path);
     $output .= '$body = str_replace(\'%THEME%\',$__THEME_URL,ob_get_contents());ob_end_clean();';
     $output .= 'echo $body;unset($body);';
     return $output;
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:44,代碼來源:compiler.php


注:本文中的theme::uses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。