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


PHP Helper::options方法代码示例

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


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

示例1: install

 public static function install()
 {
     $configLink = '<a href="' . Helper::options()->adminUrl . 'options-plugin.php?config=Access' . '">请设置</a>';
     if (substr(trim(dirname(__FILE__), '/'), -6) != 'Access') {
         throw new Typecho_Plugin_Exception('插件目录名必须为Access');
     }
     $installDb = Typecho_Db::get();
     $type = explode('_', $installDb->getAdapterName());
     $type = array_pop($type);
     $prefix = $installDb->getPrefix();
     $scripts = "CREATE TABLE `typecho_access` (\r\n  `id` int(10) unsigned NOT NULL auto_increment,\r\n  `ua` varchar(255) default NULL,\r\n  `url` varchar(64) default NULL,\r\n  `ip` varchar(16) default NULL,\r\n  `referer` varchar(255) default NULL,\r\n  `referer_domain` varchar(100) default NULL,\r\n  `date` int(10) unsigned default '0',\r\n  PRIMARY KEY  (`id`)\r\n) ENGINE=MYISAM  DEFAULT CHARSET=%charset%;";
     $scripts = str_replace('typecho_', $prefix, $scripts);
     $scripts = str_replace('%charset%', 'utf8', $scripts);
     $scripts = explode(';', $scripts);
     try {
         foreach ($scripts as $script) {
             $script = trim($script);
             if ($script) {
                 $installDb->query($script, Typecho_Db::WRITE);
             }
         }
         return '成功创建数据表,插件启用成功,' . $configLink;
     } catch (Typecho_Db_Exception $e) {
         $code = $e->getCode();
         if ('Mysql' == $type && $code == (1050 || '42S01')) {
             $script = 'SELECT * from `' . $prefix . 'access`';
             $installDb->query($script, Typecho_Db::READ);
             return '数据表已存在,插件启用成功,' . $configLink;
         } else {
             throw new Typecho_Plugin_Exception('数据表建立失败,插件启用失败。错误号:' . $code);
         }
     }
 }
开发者ID:kokororin,项目名称:typecho-plugin-Access,代码行数:33,代码来源:Plugin.php

示例2: show

    public static function show()
    {
        $curl = curl_init(Helper::options()->index . "/action/ajax?do=checkVersion");
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $version = json_decode(curl_exec($curl), true);
        curl_close($curl);
        if (!$version['avaliable']) {
            $url = Helper::options()->index . "/update/zero";
            ?>
            <script>
            window.onload = function() {
                document.querySelector(".update-check strong") && (document.querySelector(".update-check strong").innerHTML += '<a href="<?php 
            echo $url;
            ?>
" class="update message error" style="margin-left:15px;">升级到新版!</a>');
            }
            </script>
            <style>
            .update-check a.update {
                padding:5px 10px;
            }
            .update-check a.update:hover {
                color:#8A1F11!important;
                text-decoration:underline;
            }
            </style>
            <?php 
        }
    }
开发者ID:duxiangfei,项目名称:plugins,代码行数:31,代码来源:Plugin.php

示例3: render

 /**
  * 插件实现方法
  * 
  * @access public
  * @return void
  */
 public static function render($post)
 {
     $options = Helper::options();
     $js = Typecho_Common::url('TinyMCE/tiny_mce/tiny_mce.js', $options->pluginUrl);
     $langs = Typecho_Common::url('extending.php?panel=TinyMCE/tiny_mce/langs.php', $options->adminUrl);
     echo "<script type=\"text/javascript\" src=\"{$js}\"></script>\n<script type=\"text/javascript\" src=\"{$langs}\"></script>\n<script type=\"text/javascript\">\n    var insertImageToEditor = function (title, url, link) {\n        tinyMCE.activeEditor.execCommand('mceInsertContent', false,\n        '<a href=\"' + link + '\" title=\"' + title + '\"><img src=\"' + url + '\" alt=\"' + title + '\" /></a>');\n        new Fx.Scroll(window).toElement(\$(document).getElement('.mceEditor'));\n    };\n    \n    var insertLinkToEditor = function (title, url, link) {\n        tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href=\"' + url + '\" title=\"' + title + '\">' + title + '</a>');\n        new Fx.Scroll(window).toElement(\$(document).getElement('.mceEditor'));\n    };\n\n    //自动保存\n    var autoSave;\n    \n    tinyMCE.init({\n    // General options\n    mode : 'exact',\n    elements : 'text',\n    theme : 'advanced',\n    skin : 'typecho',\n    plugins : 'safari,morebreak,inlinepopups,media,coder',\n    extended_valid_elements : 'code[*],pre[*],script[*],iframe[*]',\n    \n    init_instance_callback : function(ed) {\n        \n        ed.setContent(\"" . str_replace(array("\n", "\r"), array("\\n", ""), addslashes($post->content)) . "\");\n        " . ($options->autoSave ? "autoSave = new Typecho.autoSave(\$('text').getParent('form').getProperty('action'), {\n            time: 60,\n            getContentHandle: tinyMCE.activeEditor.getContent.bind(ed),\n            messageElement: 'auto-save-message',\n            leaveMessage: '" . _t('您的内容尚未保存, 是否离开此页面?') . "',\n            form: \$('text').getParent('form')\n        });" : "") . "\n    },\n    \n    onchange_callback: function (inst) {\n        if ('undefined' != typeof(autoSave)) {\n            autoSave.onContentChange();\n        }\n    },\n    \n    save_callback: function (element_id, html, body) {\n        if ('undefined' != typeof(autoSave)) {\n            autoSave.saveRev = autoSave.rev;\n        }\n        \n        return html;\n    },\n    \n    // Theme options\n    theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,blockquote,|,link,unlink,image,media,|,forecolor,backcolor,|,morebreak,code',\n    theme_advanced_buttons2 : '',\n    theme_advanced_buttons3 : '',\n    theme_advanced_toolbar_location : 'top',\n    theme_advanced_toolbar_align : 'left',\n    convert_urls : false,\n    language : 'typecho'\n});\n</script>";
 }
开发者ID:luobenyu,项目名称:plugins,代码行数:13,代码来源:Plugin.php

示例4: Change

    public static function Change()
    {
        $options = Helper::options();
        $cssUrl = Typecho_Common::url('LREditor/lr.css', $options->pluginUrl);
        $jsUrl = Typecho_Common::url('LREditor/prettify.js', $options->pluginUrl);
        echo '<link rel="stylesheet" type="text/css" href="' . $cssUrl . '" />';
        echo '<script type="text/javascript" src="' . $jsUrl . '"></script>';
        ?>

 		<script>
            function prettify() {
                $("pre").addClass("prettyprint");
                prettyPrint();
            }
 			$(function() {
 				setInterval("$('#wmd-preview').css('height', (parseInt($('#text').height()) - 5)+'px');", 500);
                setInterval("prettify()", 10);

 				//Typecho.editorResize('wmd-preview', '<?php 
        $options->index('/action/ajax?do=editorResize');
        ?>
');
 				//$('#wmd-preview').remove();
 				//$('textarea').after('<div id="wmd-preview"></div>');
 			});
 		</script>
 		<?php 
    }
开发者ID:duxiangfei,项目名称:plugins,代码行数:28,代码来源:plugin.php

示例5: footlink

 /**
  * 底部脚本
  *
  * @access public
  * @param unknown $footlink
  * @return unknown
  */
 public static function footlink($links)
 {
     $settings = Helper::options()->plugin('Prism');
     $url = Helper::options()->pluginUrl . '/Prism/';
     $links = '<script type="text/javascript" src="' . $url . 'js/prism.js"></script>';
     echo $links;
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:14,代码来源:Plugin.php

示例6: footer

 /**
  * 输出尾部js
  * 
  * @access public
  * @param unknown $footer
  * @return unknown
  */
 public static function footer()
 {
     $jsUrl = Helper::options()->pluginUrl . '/LaTex/latex.js';
     echo '<script type="text/javascript" src="' . $jsUrl . '"></script>';
     $mark = Typecho_Widget::widget('Widget_Options')->plugin('LaTex')->mark;
     echo '<script type="text/javascript">latex.parse("' . $mark . '");</script>';
 }
开发者ID:luobenyu,项目名称:plugins,代码行数:14,代码来源:Plugin.php

示例7: render

 /**
  * 插件实现方法
  * 
  * @access public
  * @return void
  */
 public static function render()
 {
     $options = Helper::options();
     echo '<a href="';
     $options->adminUrl('extending.php?panel=DevTool%2Findex.php');
     echo '">' . self::NAME . '</a>';
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:13,代码来源:Plugin.php

示例8: insertScript

 public static function insertScript()
 {
     if (self::$flag) {
         echo "\n<script type=\"text/javascript\">\nvar ymplayer_params = " . json_encode(array('url' => Helper::options()->index . '/ymplayer.json', 'song_id' => self::$song_id)) . ";\n</script>";
         echo "\n<script src=\"" . Helper::options()->pluginUrl . "/ymplayer/dist/ymplayer.min.js\"></script>";
         echo "\n<script src=\"" . Helper::options()->pluginUrl . "/ymplayer/init.js\"></script>";
     }
 }
开发者ID:changlor,项目名称:typecho-plugin-ymplayer,代码行数:8,代码来源:Plugin.php

示例9: footer

 public static function footer()
 {
     if (Helper::options()->plugin('Prismjs')->showln) {
         echo "<script>var pres = document.getElementsByTagName('pre');\n                for (var i = 0; i < pres.length; i++)\n                    if (pres[i].getElementsByTagName('code').length > 0)\n                        pres[i].className  = 'line-numbers';\n                </script>";
     }
     $jsUrl = Helper::options()->pluginUrl . '/Prismjs/prism.js';
     echo '<script src="' . $jsUrl . '"></script>';
 }
开发者ID:messikiller,项目名称:Prismjs,代码行数:8,代码来源:Plugin.php

示例10: footer

 public static function footer()
 {
     if (Helper::options()->plugin('GithubWidgetUser')->jq_import) {
         echo '<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>';
     }
     $jsUrl = Helper::options()->pluginUrl . '/GithubWidgetUser/jquery-github-user-widget.js';
     echo '<script type="text/javascript" src="' . $jsUrl . '"></script>';
 }
开发者ID:istobran,项目名称:github-widget-user,代码行数:8,代码来源:Plugin.php

示例11: SinaAuth

 /**
  *  是否已经获取到了token,未获取则显示获取token的图标,否则显示当前登录账号
  *
  * @access public
  * @param 
  * @return string
  */
 public static function SinaAuth()
 {
     self::getPubFile();
     $sina_auth = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
     $authurl = $sina_auth->getAuthorizeURL(WB_CALLBACK_URL, 'code');
     $img_path = Helper::options()->pluginUrl . '/WeiboSync/weibo.png';
     echo $sina_profile = '<ul class="typecho-option"><li><a href="' . $authurl . '"><img src="' . $img_path . '"></a>&nbsp;&nbsp;<b>点击左边图标获取微博Access_token信息</b></li></ul>';
 }
开发者ID:vfhky,项目名称:WeiboSync,代码行数:15,代码来源:Plugin.php

示例12: action

 public function action()
 {
     /** 验证合法性 */
     if (!isset($_SERVER['HTTP_GOOGLE_CODE_PROJECT_HOSTING_HOOK_HMAC'])) {
         return;
     }
     $googleSecretInfo = $_SERVER['HTTP_GOOGLE_CODE_PROJECT_HOSTING_HOOK_HMAC'];
     $revisionData = file_get_contents('php://input');
     if (empty($revisionData)) {
         return;
     }
     $secretVerify = hash_hmac("md5", $revisionData, Helper::options()->plugin('GoogleCodeSVN')->secretKey);
     if ($googleSecretInfo != $secretVerify) {
         return;
     }
     $data = Typecho_Json::decode($revisionData);
     if (!$data) {
         return;
     }
     /** 登录用户 */
     $master = $this->db->fetchRow($this->db->select()->from('table.users')->where('group = ?', 'administrator')->order('uid', Typecho_Db::SORT_ASC)->limit(1));
     if (empty($master)) {
         return false;
     } else {
         if (!$this->user->simpleLogin($master['uid'])) {
             return false;
         }
     }
     if (isset($data->revisions) && is_array($data->revisions)) {
         foreach ($data->revisions as $revision) {
             if (!empty($revision->added)) {
                 foreach ($revision->added as $file) {
                     $input = $this->parseFileName($file, $data->repository_path);
                     if ($input) {
                         $this->widget('Widget_Contents_Post_Edit', NULL, $input, false)->action();
                     }
                 }
             }
             if (!empty($revision->modified)) {
                 foreach ($revision->modified as $file) {
                     $input = $this->parseFileName($file, $data->repository_path);
                     if ($input) {
                         $this->widget('Widget_Contents_Post_Edit', NULL, $input, false)->action();
                     }
                 }
             }
             if (!empty($revision->removed)) {
                 foreach ($revision->removed as $file) {
                     $input = $this->parseFileName($file, $data->repository_path);
                     if ($input && isset($input['cid'])) {
                         $postId = $input['cid'];
                         $this->widget('Widget_Contents_Post_Edit', NULL, "cid={$postId}", false)->deletePost();
                     }
                 }
             }
         }
     }
 }
开发者ID:luobenyu,项目名称:plugins,代码行数:58,代码来源:Action.php

示例13: render

 /**
  * 插件实现方法
  * 
  * @access public
  * @return void
  */
 public static function render($post)
 {
     $options = Helper::options();
     $plugin_options = Typecho_Widget::widget('Widget_Options')->plugin('KEditor');
     $newlineTag = $plugin_options->newlineTag;
     $themesTab = $plugin_options->themesTab;
     $editor_path = Typecho_Common::url('KEditor/editor', $options->pluginUrl);
     echo "\n<script type=\"text/javascript\" charset=\"utf-8\" src=\"{$editor_path}/kindeditor.js\"></script> \n<script type=\"text/javascript\">\n    KE.show({\n\t\tresizeMode : 1,\n\t    themesPath : '{$themesTab}',\n\t\tlangPath : 'zh_CN',\n\t    newlineTag : '{$newlineTag}',\n        id : 'text'\n    });\n\t\$('btn-save').addEvent('mouseover', function (e) {\n\t\tKE.util.setData('text'); \n\t});\n\t\$('btn-submit').addEvent('mouseover', function (e) {\n\t\tKE.util.setData('text'); \n\t});\n    function insertHtml(id, html) {\n        KE.util.focus(id);\n        KE.util.selection(id);\n        KE.util.insertHtml(id, html);\n    }\n    /** 附件插入实现 */\n    var insertImageToEditor = function (title, url, link) {\n        insertHtml('text', '<a href=\"' + link + '\" title=\"' + title + '\"><img src=\"' + url + '\" alt=\"' + title + '\" /></a>');\n    };\n    var insertLinkToEditor = function (title, url, link) {\n        insertHtml('text', '<a href=\"' + url + '\" title=\"' + title + '\">' + title + '</a>');\n    };\n</script>";
 }
开发者ID:daixl2010,项目名称:Typecho-Nesoft-Theme,代码行数:15,代码来源:Plugin.php

示例14: __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();
 }
开发者ID:daixl2010,项目名称:Typecho-Nesoft-Theme,代码行数:9,代码来源:Action.php

示例15: __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();
 }
开发者ID:jiusanzhou,项目名称:spacms,代码行数:9,代码来源:Action.php


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