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


PHP Typecho_Common::url方法代码示例

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


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

示例1: theme

 public function theme()
 {
     if ($theme = $this->request->get('theme')) {
         $this->db->query($this->db->update('table.options')->rows(array('value' => $theme))->where('name=?', 'Duoshuo_theme'));
         $this->response->redirect(Typecho_Common::url('extending.php?panel=Duoshuo/manage-duoshuo.php&do=manage-theme', $this->options->adminUrl));
     }
 }
开发者ID:wujunze,项目名称:wujunze.com,代码行数:7,代码来源:Action.php

示例2: setPrefix

 /**
  * 设置前缀 
  * 
  * @param string $url
  * @access public
  * @return void
  */
 public static function setPrefix($url)
 {
     self::$_prefix = md5($url);
     $parsed = parse_url($url);
     /** 在路径后面强制加上斜杠 */
     self::$_path = empty($parsed['path']) ? '/' : Typecho_Common::url(NULL, $parsed['path']);
 }
开发者ID:hongweipeng,项目名称:typecho,代码行数:14,代码来源:Cookie.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: execute

 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     $themes = glob(__TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . '/*');
     if ($themes) {
         $options = $this->widget('Widget_Options');
         $siteUrl = $options->siteUrl;
         $adminUrl = $options->adminUrl;
         $activated = 0;
         $result = array();
         foreach ($themes as $key => $theme) {
             $themeFile = $theme . '/index.php';
             if (file_exists($themeFile)) {
                 $info = Typecho_Plugin::parseInfo($themeFile);
                 $info['name'] = basename($theme);
                 if ($info['activated'] = $options->theme == $info['name']) {
                     $activated = $key;
                 }
                 $screen = glob($theme . '/screen*.{jpg,png,gif,bmp,jpeg,JPG,PNG,GIF,BMG,JPEG}', GLOB_BRACE);
                 if ($screen) {
                     $info['screen'] = Typecho_Common::url(trim(__TYPECHO_THEME_DIR__, '/') . '/' . $info['name'] . '/' . basename(current($screen)), $siteUrl);
                 } else {
                     $info['screen'] = Typecho_Common::url('/images/noscreen.gif', $adminUrl);
                 }
                 $result[$key] = $info;
             }
         }
         $clone = $result[$activated];
         unset($result[$activated]);
         array_unshift($result, $clone);
         array_filter($result, array($this, 'push'));
     }
 }
开发者ID:raindali,项目名称:express,代码行数:38,代码来源:List.php

示例5: writePage

 /**
  * 发布文章
  *
  * @access public
  * @return void
  */
 public function writePage()
 {
     $contents = $this->request->from('text', 'template', 'allowComment', 'allowPing', 'allowFeed', 'slug', 'order');
     $contents['type'] = 'page';
     $contents['title'] = $this->request->get('title', _t('未命名页面'));
     $contents['created'] = $this->getCreated();
     $contents = $this->pluginHandle()->write($contents, $this);
     if ($this->request->is('do=publish')) {
         /** 重新发布已经存在的文章 */
         $this->publish($contents);
         /** 发送ping */
         $this->widget('Widget_Service')->sendPing($this->cid);
         /** 设置提示信息 */
         $this->widget('Widget_Notice')->set(_t('页面 "<a href="%s">%s</a>" 已经发布', $this->permalink, $this->title), NULL, 'success');
         /** 设置高亮 */
         $this->widget('Widget_Notice')->highlight($this->theId);
         /** 页面跳转 */
         $this->response->redirect(Typecho_Common::url('manage-pages.php?', $this->options->adminUrl));
     } else {
         /** 保存文章 */
         $this->save($contents);
         if ($this->request->isAjax()) {
             $created = new Typecho_Date($this->options->gmtTime);
             $this->response->throwJson(array('success' => 1, 'message' => _t('文章保存于 %s', $created->format('H:i A')), 'cid' => $this->cid));
         } else {
             /** 设置提示信息 */
             $this->widget('Widget_Notice')->set(_t('草稿 "%s" 已经被保存', $this->title), NULL, 'success');
             /** 返回原页面 */
             $this->response->redirect(Typecho_Common::url('write-page.php?cid=' . $this->cid, $this->options->adminUrl));
         }
     }
 }
开发者ID:raindali,项目名称:express,代码行数:38,代码来源:Edit.php

示例6: config

 /**
  * 获取插件配置面板
  * 
  * @access public
  * @param Typecho_Widget_Helper_Form $form 配置面板
  * @return void
  */
 public static function config(Typecho_Widget_Helper_Form $form)
 {
     if (isset($_GET['action']) && $_GET['action'] == 'deletefile') {
         self::deletefile();
     }
     $listexpire = new Typecho_Widget_Helper_Form_Element_Text('listexpire', null, '43200', _t('歌单更新周期'), _t('设置歌单的缓存时间(单位:秒),超过设定时间后歌单将自动更新'));
     $form->addInput($listexpire);
     $maintheme = new Typecho_Widget_Helper_Form_Element_Text('maintheme', null, '#e6d0b2', _t('默认主题颜色'), _t('播放器默认的主题颜色,如 #372e21、#75c、red、blue,该设定会被[player]标签中的theme属性覆盖,默认为 #e6d0b2'));
     $form->addInput($maintheme);
     $nolyric = new Typecho_Widget_Helper_Form_Element_Text('nolyric', null, '找不到歌词', _t('找不到歌词时显示的文字'), _t('找不到歌词时显示的文字'));
     $form->addInput($nolyric);
     $mutex = new Typecho_Widget_Helper_Form_Element_Radio('mutex', array('false' => _t('是'), 'true' => _t('否')), 'true', _t('是否允许在一个页面中多个播放器同时播放'), _t('若选择否,当页面中存在多个播放器时,点击其中一个播放器的播放按钮,其它播放器将自动暂停'));
     $form->addInput($mutex);
     $preload = new Typecho_Widget_Helper_Form_Element_Radio('preload', array('false' => _t('自动'), 'none' => _t('none'), 'metadata' => _t('metadata'), 'auto' => _t('auto')), 'false', _t('音频预加载(preload)属性'), '自动:移动端为none,桌面端为metadata; none:页面加载后不预加载音频; metadata:当页面加载后仅加载音频的元数据; auto:一旦页面加载,则开始加载音频。');
     $form->addInput($preload);
     $cache = new Typecho_Widget_Helper_Form_Element_Radio('cache', array('false' => _t('否')), 'false', _t('清空缓存'), _t('清空插件生成的缓存文件,必要时可以使用'));
     $form->addInput($cache);
     $submit = new Typecho_Widget_Helper_Form_Element_Submit();
     $submit->value(_t('清空歌词,专辑图片链接,在线歌曲缓存'));
     $submit->setAttribute('style', 'position:relative;');
     $submit->input->setAttribute('style', 'position:absolute;bottom:37px;');
     $submit->input->setAttribute('class', 'btn btn-s btn-warn btn-operate');
     $submit->input->setAttribute('formaction', Typecho_Common::url('/options-plugin.php?config=APlayer&action=deletefile', Helper::options()->adminUrl));
     $form->addItem($submit);
 }
开发者ID:zgq354,项目名称:APlayer-Typecho-Plugin,代码行数:32,代码来源:Plugin.php

示例7: execute

 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     $themes = $this->getThemes();
     if ($themes) {
         $options = $this->widget('Widget_Options');
         $siteUrl = $options->siteUrl;
         $adminUrl = $options->adminUrl;
         $activated = 0;
         $result = array();
         foreach ($themes as $key => $theme) {
             $themeFile = $theme . '/index.php';
             if (file_exists($themeFile)) {
                 $info = Typecho_Plugin::parseInfo($themeFile);
                 $info['name'] = $this->getTheme($theme, $key);
                 if ($info['activated'] = $options->theme == $info['name']) {
                     $activated = $key;
                 }
                 $screen = glob($theme . '/screen*.{jpg,png,gif,bmp,jpeg,JPG,PNG,GIF,BMG,JPEG}', GLOB_BRACE);
                 if ($screen) {
                     $info['screen'] = $options->themeUrl(basename(current($screen)), $info['name']);
                 } else {
                     $info['screen'] = Typecho_Common::url('noscreen.png', $options->adminStaticUrl('img'));
                 }
                 $result[$key] = $info;
             }
         }
         $clone = $result[$activated];
         unset($result[$activated]);
         array_unshift($result, $clone);
         array_filter($result, array($this, 'push'));
     }
 }
开发者ID:hongweipeng,项目名称:typecho,代码行数:38,代码来源:List.php

示例8: setBody

 private function setBody()
 {
     if (empty($this->parameter->confirm)) {
         throw new Typecho_Widget_Exception(_t('收件人不存在'), 404);
     }
     $this->parameter->siteTitle = $this->options->title;
     $this->parameter->token = strtolower(Typecho_Common::randString(8));
     $this->parameter->subject = $this->_type[$this->parameter->type];
     switch ($this->parameter->type) {
         case 'reset':
             $url = '/forgot';
             break;
         case 'register':
             $url = '/activate';
             break;
         default:
             $url = '';
             break;
     }
     if (!empty($url)) {
         $this->parameter->url = Typecho_Common::url($url . '?token=' . $this->parameter->token, $this->options->index);
     } else {
         $this->parameter->url = $this->parameter->token;
     }
     $this->parameter->body = $this->parseBody();
     return $this;
 }
开发者ID:dccecc,项目名称:typecho,代码行数:27,代码来源:Verify.php

示例9: 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

示例10: setTheme

 /**
  * 插件实现方法
  *
  * @access public
  * @return void
  */
 public static function setTheme($widget)
 {
     $cookie = array('name' => '__typecho_theme', 'expire' => 86400);
     $options = Typecho_Widget::widget('Widget_Options');
     if (isset($widget->request->theme) && $widget->request->isGet()) {
         if ($widget->request->theme) {
             $theme = $widget->request->theme;
             if (static::check($theme)) {
                 Typecho_Cookie::set($cookie['name'], $widget->request->theme, $options->gmtTime + $cookie['expire'], $options->siteUrl);
             } else {
                 $widget->response->redirect(Typecho_Common::url($widget->request->getPathInfo(), $options->siteUrl));
             }
         } else {
             Typecho_Cookie::delete($cookie['name']);
             //直接提交?theme将删除cookie,恢复默认主题
             return;
         }
     } else {
         $theme = Typecho_Cookie::get($cookie['name']);
         if (!$theme) {
             return;
         }
         if (!static::check($theme)) {
             Typecho_Cookie::delete($cookie['name']);
             return;
         }
     }
     /** 删除旧主题的相关设置 */
     $themeRow = 'theme:' . $options->theme;
     if (isset($options->{$themeRow})) {
         $config = unserialize($options->{$themeRow});
         $options->{$themeRow} = '';
         foreach ($config as $row => $value) {
             $options->{$row} = '';
         }
     }
     /** 载入新主题的相关设置 参考var/Widget/Themes/Edit.php */
     $themeDir = __TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR;
     $configFile = $themeDir . 'functions.php';
     if (file_exists($configFile)) {
         require_once $configFile;
         if (function_exists('themeConfig')) {
             $form = new Typecho_Widget_Helper_Form();
             themeConfig($form);
             $config = $form->getValues();
             if ($config) {
                 $options->{'theme:' . $theme} = serialize($config);
                 foreach ($config as $row => $value) {
                     $options->{$row} = $value;
                 }
             }
         }
     }
     /** 修改$this->options->theme */
     $options->theme = $theme;
     /** 修改$this->_themeDir */
     $widget->setThemeDir($themeDir);
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:64,代码来源:Plugin.php

示例11: 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

示例12: deleteFile

 /**
  * 执行清空缓存
  *
  * @access public
  * @return void
  */
 public function deleteFile()
 {
     $path = __TYPECHO_ROOT_DIR__ . '/usr/plugins/Avatars/cache/';
     foreach (glob($path . '*') as $filename) {
         unlink($filename);
     }
     $this->widget('Widget_Notice')->set('读者墙头像缓存已清空!', NULL, 'success');
     $this->response->redirect(Typecho_Common::url('options-plugin.php?config=Avatars', $this->options->adminUrl));
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:15,代码来源:Action.php

示例13: render

    /**
     * 插件实现方法
     * 
     * @access public
     * @return void
     */
    public static function render()
    {
        $options = Helper::options();
        $cssUrl = Typecho_Common::url('EditorLR/lr.css', $options->pluginUrl);
        $jsUrl = Typecho_Common::url('EditorLR/prettify.js', $options->pluginUrl);
        $lrjs = Typecho_Common::url('EditorLR/lr.js', $options->pluginUrl);
        echo <<<HTML
            <link rel="stylesheet" type="text/css" href="{$cssUrl}" />
            <script type="text/javascript" src="{$jsUrl}"></script>
            <script type="text/javascript" src="{$lrjs}"></script>
HTML;
    }
开发者ID:xyh968200,项目名称:typecho,代码行数:18,代码来源:Plugin.php

示例14: updategallery

 /**
  * 更新相册图片
  *
  * @access public
  * @return void
  */
 public function updategallery()
 {
     if (HighSlide_Plugin::form('update')->validate()) {
         $this->response->goBack();
     }
     $gallery = $this->request->from('gid', 'thumb', 'image', 'description', 'sort', 'name');
     $this->db->query($this->db->update($this->prefix . 'gallery')->rows($gallery)->where('gid=?', $gallery['gid']));
     //返回原页并提示信息
     $this->widget('Widget_Notice')->highlight('gallery-' . $gallery['gid']);
     $this->widget('Widget_Notice')->set(_t('相册组%s: 图片%s 更新成功', $gallery['sort'], $gallery['name']), NULL, 'success');
     $this->response->redirect(Typecho_Common::url('extending.php?panel=HighSlide%2Fmanage-gallery.php&group=' . $gallery['sort'], $this->options->adminUrl));
 }
开发者ID:duxiangfei,项目名称:plugins,代码行数:18,代码来源:Action.php

示例15: uploadHandle

 /**
  * 上传文件处理函数,如果需要实现自己的文件哈希或者特殊的文件系统,请在options表里把uploadHandle改成自己的函数
  *
  * @access public
  * @param array $file 上传的文件
  * @return mixed
  */
 public static function uploadHandle($file)
 {
     if (empty($file['name'])) {
         return '请选择文件!';
     }
     $result = Typecho_Plugin::factory('Widget_Upload')->trigger($hasUploaded)->uploadHandle($file);
     if ($hasUploaded) {
         return $result;
     }
     $fileName = preg_split("(\\/|\\|:)", $file['name']);
     $file['name'] = array_pop($fileName);
     //获取扩展名
     $ext = '';
     $part = explode('.', $file['name']);
     if (($length = count($part)) > 1) {
         $ext = strtolower($part[$length - 1]);
     }
     if (!self::checkFileType($ext)) {
         return $ext . '类型文件不允许上传!';
     }
     $options = Typecho_Widget::widget('Widget_Options');
     $date = new Typecho_Date($options->gmtTime);
     $path = Typecho_Common::url(defined('__TYPECHO_UPLOAD_DIR__') ? __TYPECHO_UPLOAD_DIR__ : parent::UPLOAD_DIR, __TYPECHO_ROOT_DIR__) . '/' . $date->year . '/' . $date->month;
     //创建上传目录
     if (!is_dir($path)) {
         if (!self::makeUploadDir($path)) {
             return '不能创建上传目录!';
         }
     }
     //获取文件名
     $fileName = sprintf('%u', crc32(uniqid())) . '.' . $ext;
     $path = $path . '/' . $fileName;
     if (isset($file['tmp_name'])) {
         //移动上传文件
         if (!move_uploaded_file($file['tmp_name'], $path)) {
             return '上传文件失败!';
         }
     } else {
         if (isset($file['bytes'])) {
             //直接写入文件
             if (!file_put_contents($path, $file['bytes'])) {
                 return '上传文件失败!';
             }
         } else {
             return '上传文件失败!';
         }
     }
     if (!isset($file['size'])) {
         $file['size'] = filesize($path);
     }
     //返回相对存储路径
     return array('name' => $file['name'], 'path' => (defined('__TYPECHO_UPLOAD_DIR__') ? __TYPECHO_UPLOAD_DIR__ : self::UPLOAD_DIR) . '/' . $date->year . '/' . $date->month . '/' . $fileName, 'size' => $file['size'], 'type' => $ext, 'mime' => Typecho_Common::mimeContentType($path));
 }
开发者ID:liutongju,项目名称:KindEditor,代码行数:60,代码来源:Upload.php


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