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


PHP Theme::init方法代码示例

本文整理汇总了PHP中Theme::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::init方法的具体用法?PHP Theme::init怎么用?PHP Theme::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme的用法示例。


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

示例1: glob

 function _load_themes()
 {
     $this->themes = [];
     $themes = glob("{$this->theme_dir}*.{{$this->theme_ext}}", GLOB_BRACE);
     $p_exts = $this->theme_ext;
     $p_exts = preg_split('/,/i', $p_exts);
     foreach ($p_exts as &$ext) {
         $ext = preg_quote('.' . trim($ext));
     }
     $p_exts = join('|', $p_exts);
     foreach ($themes as $theme_dir) {
         $theme = new Theme($theme_dir, $this->theme_file, ['class' => preg_replace('/([^\\/]+\\/(?=[^$])|(' . $p_exts . ')|\\/\\s?$)/i', '', $theme_dir) . "\\" . $this->theme_class]);
         $this->themes[] = $theme;
     }
     foreach ($this->themes as $index => $theme) {
         $result = $theme->init();
         if (!$result) {
             $this->themes[$index] = false;
         }
     }
     $loaded = $this->themes;
     $this->themes = [];
     foreach ($loaded as $theme) {
         if ($theme) {
             $this->themes[] = $theme;
         }
     }
 }
开发者ID:aravindanve,项目名称:batch-certificate-maker,代码行数:28,代码来源:themeloader.php

示例2: Theme

<?php

$theme = new Theme();
$theme->init(array("theme_name" => "Jupiter", "theme_slug" => "JP"));
if (!isset($content_width)) {
    $content_width = 1140;
}
class Theme
{
    function init($options)
    {
        $this->constants($options);
        add_action('init', array(&$this, 'language'));
        $this->functions();
        $this->plugins();
        $this->post_types();
        add_action('admin_menu', array(&$this, 'admin_menus'));
        add_action('init', array(&$this, 'add_metaboxes'));
        $this->theme_activated();
        add_action('after_setup_theme', array(&$this, 'supports'));
        add_action('widgets_init', array(&$this, 'widgets'));
    }
    function constants($options)
    {
        define("THEME_DIR", get_template_directory());
        define("THEME_DIR_URI", get_template_directory_uri());
        define("THEME_NAME", $options["theme_name"]);
        if (defined("ICL_LANGUAGE_CODE")) {
            $lang = "_" . ICL_LANGUAGE_CODE;
        } else {
            $lang = "";
开发者ID:kevalbaxi,项目名称:dosomething-blog,代码行数:31,代码来源:functions.php

示例3: __construct

 /**
  * Set initial theme name
  */
 public function __construct()
 {
     Theme::init(config('theme.name'));
 }
开发者ID:siganurame,项目名称:laravel-5-1-starter,代码行数:7,代码来源:Controller.php

示例4: setup_theme

 function setup_theme()
 {
     Theme::init();
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:4,代码来源:core.php

示例5: Theme

<?php

/* Load the Theme class. */
require_once TEMPLATEPATH . '/framework/theme.php';
$theme = new Theme();
$theme->init(array('theme_name' => 'Travel', 'theme_slug' => 'travel'));
require_once TEMPLATEPATH . '/travel/travel.php';
开发者ID:blocher,项目名称:oneholyname,代码行数:7,代码来源:functions.php

示例6: init

require __DIR__ . '/bootstrap/start.php';
use Kps3\Theme\BaseTheme;
class Theme extends \Kps3\Theme\BaseTheme
{
    public function init()
    {
        $this->_addThemeSupport($this->config->get('theme.ThemeSupports', []));
        $this->_addImageSizes($this->config->get('theme.ImageSizes', []));
        $this->_registerPostTypes($this->config->get('theme.PostTypes', []));
        $this->_registerTaxonomies($this->config->get('theme.Taxonomies', []));
        $this->_registerMetaBoxes($this->config->get('theme.MetaBoxes', []));
        $this->_registerStylesheets($this->config->get('theme.Stylesheets', []), $this->config->get('cachebuster', []));
        $this->_registerScripts($this->config->get('theme.Scripts', []), $this->config->get('cachebuster', []));
        $this->_registerNavMenus($this->config->get('theme.NavMenus', []));
        $this->_registerSidebars($this->config->get('theme.Sidebars', []));
        $this->_registerWidgets($this->config->get('theme.Widgets', []));
        $this->_addShortcodes($this->config->get('theme.Shortcodes', []));
        $this->_addActions();
        $this->_addFilters();
    }
    private function _addActions()
    {
    }
    private function _addFilters()
    {
    }
}
$theme = new Theme();
$theme->init();
开发者ID:kps3,项目名称:wordpress-base,代码行数:29,代码来源:functions.php

示例7: init

 /**
  * @brief init LogX 全局初始化方法
  *
  * @return void
  */
 public static function init()
 {
     // 输出 Logo
     if (isset($_GET['591E-D5FC-8065-CD36-D3E8-E45C-DB86-9197'])) {
         Response::logo();
     }
     // 非 DEBUG 模式下关闭错误输出
     if (defined('LOGX_DEBUG')) {
         error_reporting(E_ALL);
     } else {
         error_reporting(0);
     }
     // 设置自动载入函数
     function __autoLoad($className)
     {
         if (substr($className, -7) == 'Library' && is_file(LOGX_LIB . $className . '.php')) {
             @(require_once LOGX_LIB . $className . '.php');
         }
     }
     // 设置错误与异常处理函数
     set_error_handler(array(__CLASS__, 'error'));
     set_exception_handler(array(__CLASS__, 'exception'));
     // 运行环境检查
     if (!version_compare(PHP_VERSION, '5.0.0', '>=')) {
         throw new LogXException(sprintf(_t('LogX needs PHP 5.0.x or higher to run. You are currently running PHP %s.'), PHP_VERSION));
     }
     if (!version_compare(PHP_VERSION, '5.2.0', '>=')) {
         // 针对低版本 PHP 的兼容代码
         @(require_once LOGX_CORE . 'Compat.php');
     }
     // 设置语言
     if (defined('LOGX_LANGUAGE')) {
         Language::set(LOGX_LANGUAGE);
     } else {
         Language::set('zh-cn');
     }
     // 预编译核心文件
     global $coreFiles;
     if (!defined('LOGX_DEBUG') && !file_exists(LOGX_CACHE . '~core.php')) {
         Compile::build(LOGX_CACHE, $coreFiles, 'core');
     } elseif (!defined('LOGX_DEBUG')) {
         $file_time = filemtime(LOGX_CACHE . '~core.php');
         foreach ($coreFiles as $file) {
             if (filemtime($file) > $file_time) {
                 Compile::build(LOGX_CACHE, $coreFiles, 'core');
                 break;
             }
         }
     }
     self::$_globalVars = array('RUN' => array('TIME' => microtime(TRUE), 'MEM' => function_exists('memory_get_usage') ? memory_get_usage() : 0, 'LANG' => 'zh-cn'), 'SYSTEM' => array('OS' => PHP_OS, 'HTTP' => Request::S('SERVER_SOFTWARE', 'string'), 'PHP' => PHP_VERSION, 'MYSQL' => ''), 'SUPPORT' => array('MYSQL' => function_exists('mysql_connect'), 'GD' => function_exists('imagecreate'), 'MEMCACHE' => function_exists('memcache_connect'), 'SHMOP' => function_exists('shmop_open'), 'GZIP' => function_exists('ob_gzhandler'), 'TIMEZONE' => function_exists('date_default_timezone_set'), 'AUTOLOAD' => function_exists('spl_autoload_register')), 'INI' => array('ALLOW_CALL_TIME_PASS_REFERENCE' => ini_get('allow_call_time_pass_reference'), 'MAGIC_QUOTES_GPC' => ini_get('magic_quotes_gpc'), 'REGISTER_GLOBALS' => ini_get('register_globals'), 'ALLOW_URL_FOPEN' => ini_get('allow_url_fopen'), 'ALLOW_URL_INCLUDE' => ini_get('allow_url_include'), 'SAFE_MODE' => ini_get('safe_mode'), 'MAX_EXECUTION_TIME' => ini_get('max_execution_time'), 'MEMORY_LIMIT' => ini_get('memory_limit'), 'POST_MAX_SIZE' => ini_get('post_max_size'), 'FILE_UPLOADS' => ini_get('file_uploads'), 'UPLOAD_MAX_FILESIZE' => ini_get('upload_max_filesize'), 'MAX_FILE_UPLOADS' => ini_get('max_file_uploads')));
     // 清除不需要的变量,防止变量注入
     $defined_vars = get_defined_vars();
     foreach ($defined_vars as $key => $value) {
         if (!in_array($key, array('_POST', '_GET', '_COOKIE', '_SERVER', '_FILES'))) {
             ${$key} = '';
             unset(${$key});
         }
     }
     // 对用户输入进行转义处理
     if (!get_magic_quotes_gpc()) {
         $_GET = self::addSlashes($_GET);
         $_POST = self::addSlashes($_POST);
         $_COOKIE = self::addSlashes($_COOKIE);
     }
     // 开启输出缓存
     if (defined('LOGX_GZIP') && self::$_globalVars['SUPPORT']['GZIP']) {
         ob_start('ob_gzhandler');
     } else {
         ob_start();
     }
     // 连接到数据库
     Database::connect(DB_HOST, DB_USER, DB_PWD, DB_NAME, DB_PCONNECT);
     self::$_globalVars['SYSTEM']['MYSQL'] = Database::version();
     // 设定时区
     if (self::$_globalVars['SUPPORT']['TIMEZONE']) {
         date_default_timezone_set(OptionLibrary::get('timezone'));
     }
     // 连接到缓存
     Cache::connect(CACHE_TYPE);
     // 初始化路由表
     Router::init();
     // 初始化主题控制器
     Theme::init();
     // 初始化 Plugin
     Plugin::initPlugins();
     // 初始化全局组件
     Widget::initWidget('Global');
     Widget::initWidget('Widget');
     Widget::initWidget('Page');
     Widget::initWidget('User');
     // 尝试自动登录
     Widget::getWidget('User')->autoLogin();
     // 启动路由分发
     Router::dispatch();
 }
开发者ID:ZJU-Shaonian-Biancheng-Tuan,项目名称:logx,代码行数:100,代码来源:LogX.php


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