本文整理汇总了PHP中Typecho_Widget::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Typecho_Widget::__construct方法的具体用法?PHP Typecho_Widget::__construct怎么用?PHP Typecho_Widget::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Typecho_Widget
的用法示例。
在下文中一共展示了Typecho_Widget::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 构造函数,初始化组件
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
* @return void
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/** 初始化常用组件 */
$this->options = $this->widget('Widget_Options');
$this->user = $this->widget('Widget_User');
}
示例2: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/* 获取数据库对象、配置及用户 */
$this->_db = Typecho_Db::get();
$this->_options = Typecho_Widget::widget('Widget_Options');
}
示例3: __construct
/**
* 构造函数
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->notice = parent::widget('Widget_Notice');
$this->options = parent::widget('Widget_Options');
$this->config = $this->options->plugin('Passport');
}
示例4: __construct
/**
* 构造函数,初始化组件
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/** 初始化数据库 */
$this->db = Typecho_Db::get();
$this->options = $this->widget('Widget_Options');
}
示例5: __construct
/**
* 构造函数,初始化组件
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
* @return void
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/** 初始化数据库 */
$this->db = Typecho_Db::get();
/** 初始化常用组件 */
$this->user = $this->widget('Widget_User');
}
示例6: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->db = Typecho_Db::get();
$this->options = Helper::options();
//$this->pluginRootUrl = Typecho_Common::url('Api/', $this->options->pluginUrl);
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();
}
示例7: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->_db = Typecho_Db::get();
$this->_options = Helper::options()->plugin('WeChatHelper');
$this->_textTpl = "<xml>\n <ToUserName><![CDATA[%s]]></ToUserName>\n <FromUserName><![CDATA[%s]]></FromUserName>\n <CreateTime>%s</CreateTime>\n <MsgType><![CDATA[text]]></MsgType>\n <Content><![CDATA[%s]]></Content>\n <FuncFlag>0</FuncFlag>\n </xml>";
$this->_imageTpl = "<xml>\n <ToUserName><![CDATA[%s]]></ToUserName>\n <FromUserName><![CDATA[%s]]></FromUserName>\n <CreateTime>%s</CreateTime>\n <MsgType><![CDATA[news]]></MsgType>\n <ArticleCount>%s</ArticleCount>\n <Articles>%s</Articles>\n <FuncFlag>1</FuncFlag>\n </xml>";
$this->_itemTpl = "<item>\n <Title><![CDATA[%s]]></Title> \n <Description><![CDATA[%s]]></Description>\n <PicUrl><![CDATA[%s]]></PicUrl>\n <Url><![CDATA[%s]]></Url>\n </item>";
}
示例8: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->_db = Typecho_Db::get();
$this->_dir = '.' . __TYPECHO_PLUGIN_DIR__ . '/CommentToMail/';
$this->_set = Helper::options()->plugin('CommentToMail');
require_once $this->_dir . 'class.phpmailer.php';
$this->mail = new PHPMailer();
}
示例9: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->parameter->setDefault(array('type' => NULL));
/** 初始化常用组件 */
$this->options = $this->widget('Widget_Options');
$this->user = $this->widget('Widget_User');
/** 初始化皮肤路径 */
$this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/';
if (NULL == $this->parameter->type) {
$this->parameter->type = Typecho_Router::$current;
}
}
示例10: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->db = Typecho_Db::get();
$this->options = $this->widget('Widget_Options');
$this->bakpath = dirname(__FILE__) . DIRECTORY_SEPARATOR . $this->bakdir . DIRECTORY_SEPARATOR;
$baknum = intval(Typecho_Widget::widget('Widget_Options')->plugin('TEDbBak')->baknum);
if ($baknum > 0) {
$this->limit = $baknum;
}
if (!is_dir($this->bakpath)) {
mkdir($this->bakpath);
}
}
示例11: __construct
/**
* 构造函数,初始化组件
*
* @access public
* @param mixed $request request对象
* @param mixed $response response对象
* @param mixed $params 参数列表
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/** 初始化数据库 */
$this->db = Typecho_Db::get();
/** 初始化常用组件 */
$this->options = $this->widget('Widget_Options');
$this->user = $this->widget('Widget_User');
$this->security = $this->widget('Widget_Security');
$this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/';
/** 加载皮肤函数 */
$functionsFile = $this->_themeDir . 'functions.php';
if (!$this->_invokeFromOutside && file_exists($functionsFile)) {
require_once $functionsFile;
}
}
示例12: __construct
/**
* 构造方法
*
* @access public
* @var void
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/* 获取插件配置 */
$options = parent::widget('Widget_Options');
$this->_config = $options->plugin('Remix');
/* 初始服务标识 */
if (isset($request->serve) && !empty($request->serve)) {
static::$serve = $request->filter('strip_tags', 'trim', 'xss')->serve;
} else {
static::$serve = 'xiami';
}
/* 判断来路 */
$siteParts = parse_url($options->siteUrl);
$refParts = parse_url($request->getReferer());
$hash = $request->getServer('HTTP_REMIX_HASH');
if (!$request->isAjax() || $siteParts['host'] != $refParts['host'] || !Typecho_Common::hashValidate($this->_config->hash, $hash)) {
throw new Typecho_Widget_Exception(_t('Bad Request!'), 403);
}
}
示例13: __construct
/**
* 构造函数
*
* @param mixed $request
* @param mixed $response
* @param null $params
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
//检测是否可以自动下载安装
$tempDir = __TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__ . '/.app_store/';
if (!@touch($tempDir . '.installable' . time())) {
$this->installale = false;
} else {
unlink($tempDir . '.installable' . time());
}
//如果没有json库,加载兼容包
!extension_loaded('json') and (include 'libs/compat_json.php');
//加载unzip包
include 'libs/unzip.php';
//加载助手
include 'helpers/helpers.php';
//加载异常类
include 'libs/exceptions.php';
//从插件设置中读取应用商店服务器地址
$this->server = Typecho_Widget::widget('Widget_Options')->plugin('AppStore')->server;
define('TYPEHO_ADMIN_PATH', __TYPECHO_ROOT_DIR__ . __TYPECHO_ADMIN_DIR__ . '/');
}
示例14: __construct
/**
* 构造方法
*
* @access public
* @var void
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
/* 获取插件配置 */
$this->_config = parent::widget('Widget_Options')->plugin('BaiduSlug');
}
示例15: __construct
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
$this->config = Helper::options()->plugin(self::$pluginName);
$this->db = Typecho_Db::get();
}