|
| 1 | +<?php |
| 2 | +if (!defined('__TYPECHO_ROOT_DIR__')) exit; |
| 3 | +/** |
| 4 | + * 有丰富自定义选项的动态聚合线条特效插件 |
| 5 | + * |
| 6 | + * @package DynamicLines |
| 7 | + * @author 长江 |
| 8 | + * @link http://www.changjiangblog.top |
| 9 | + * @version 1.0.0 |
| 10 | + */ |
| 11 | +class DynamicLines_Plugin implements Typecho_Plugin_Interface |
| 12 | +{ |
| 13 | + /** |
| 14 | + * 激活插件方法,如果激活失败,直接抛出异常 |
| 15 | + * |
| 16 | + * @access public |
| 17 | + * @return void |
| 18 | + * @throws Typecho_Plugin_Exception |
| 19 | + */ |
| 20 | + public static function activate() |
| 21 | + { |
| 22 | + Typecho_Plugin::factory('Widget_Archive')->footer = array('DynamicLines_Plugin', 'footer'); |
| 23 | + } |
| 24 | + |
| 25 | + /** |
| 26 | + * 禁用插件方法,如果禁用失败,直接抛出异常 |
| 27 | + * |
| 28 | + * @static |
| 29 | + * @access public |
| 30 | + * @return void |
| 31 | + * @throws Typecho_Plugin_Exception |
| 32 | + */ |
| 33 | + public static function deactivate() |
| 34 | + { |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * 获取插件配置面板 |
| 39 | + * |
| 40 | + * @access public |
| 41 | + * @param Typecho_Widget_Helper_Form $form 配置面板 |
| 42 | + * @return void |
| 43 | + */ |
| 44 | + public static function config(Typecho_Widget_Helper_Form $form) |
| 45 | + { |
| 46 | + $mobile = new Typecho_Widget_Helper_Form_Element_Radio('mobile', array('1' => '是', '0' => '否'), 0, _t('移动端是否加载'), _t('配置移动端是否加载,默认不加载')); |
| 47 | + $form->addInput($mobile); |
| 48 | + /** 分类名称 */ |
| 49 | + $color = new Typecho_Widget_Helper_Form_Element_Text('color', NULL, '0,0,255', _t('线条颜色'), _t("输入RGB颜色值(数字之间使用英文逗号隔开),默认是0,0,255(蓝色)")); |
| 50 | + $form->addInput($color); |
| 51 | + $count = new Typecho_Widget_Helper_Form_Element_Text('count', NULL, '99', _t("线条数"), _t("页面上的线条数量,建议为50~200")); |
| 52 | + $form->addInput($count); |
| 53 | + $opacity = new Typecho_Widget_Helper_Form_Element_Text('opacity', NULL, '0.7', _t("线条透明度"), _t("填入0~1之间的数,默认是0.7")); |
| 54 | + $form->addInput($opacity); |
| 55 | + |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * 个人用户的配置面板 |
| 60 | + * |
| 61 | + * @access public |
| 62 | + * @param Typecho_Widget_Helper_Form $form |
| 63 | + * @return void |
| 64 | + */ |
| 65 | + public static function personalConfig(Typecho_Widget_Helper_Form $form) |
| 66 | + { |
| 67 | + } |
| 68 | + |
| 69 | + |
| 70 | + /** |
| 71 | + * 输出底部 |
| 72 | + * |
| 73 | + * @access public |
| 74 | + * @return void |
| 75 | + */ |
| 76 | + public static function footer() |
| 77 | + { |
| 78 | + $options = Typecho_Widget::widget('Widget_Options')->plugin('DynamicLines'); |
| 79 | + echo '<script type="text/javascript" color="' . $options->color . '" opacity="' . $options->opacity . '" zIndex="-2" count="' . $options->count . '" src="usr/plugins/DynamicLines/canvas-nest.js"></script>'; |
| 80 | + } |
| 81 | + |
| 82 | +} |
0 commit comments