diff --git a/Plugin.php b/Plugin.php index 3bc742d..d3d8b2b 100644 --- a/Plugin.php +++ b/Plugin.php @@ -1,15 +1,15 @@ @Jad 的项目上 - * + * * @package Pio * @author Dreamer-Paul - * @version 1.0.1 + * @version 1.1 * @link https://paugram.com */ - + class Pio_Plugin implements Typecho_Plugin_Interface{ - + /* 激活插件方法 */ public static function activate(){ Typecho_Plugin::factory('Widget_Archive')->header = array('Pio_Plugin', 'header'); @@ -18,13 +18,41 @@ public static function activate(){ /* 禁用插件方法 */ public static function deactivate(){} - + /* 插件配置方法 */ public static function config(Typecho_Widget_Helper_Form $form){ + + // 插件信息与更新检测 + function paul_update($name, $version){ + echo ""; + echo "
"; + echo "

Pio 看版娘插件 (".$version.")

"; + echo "

By: Dreamer-Paul

"; + echo "

项目介绍 + 更新日志

"; + + $update = file_get_contents("https://api.paugram.com/update/?name=".$name."¤t=".$version."&site=".$_SERVER['HTTP_HOST']); + $update = json_decode($update, true); + + if($update['text']){echo "

".$update['text']."

"; }; + if($update['message']){echo "

".$update['message']."

"; }; + + echo "
"; + } + paul_update("Pio", "1.1"); + + // 自定义宽高 + $custom_width = new Typecho_Widget_Helper_Form_Element_Text('custom_width', NULL, NULL, _t('自定义宽度'), _t('在这里填入自定义宽度,部分模型需要修改')); + $form->addInput($custom_width); + + $custom_height = new Typecho_Widget_Helper_Form_Element_Text('custom_height', NULL, NULL, _t('自定义高度'), _t('在这里填入自定义高度,部分模型需要修改')); + $form->addInput($custom_height); + + // 自定义模型 $custom_model = new Typecho_Widget_Helper_Form_Element_Text('custom_model', NULL, NULL, _t('自定义配置文件地址'), _t('在这里填入一个模型 JSON 配置文件地址,可供更换模型,不填则使用默认配置文件')); $form->addInput($custom_model); } - + /* 个人用户的配置方法 */ public static function personalConfig(Typecho_Widget_Helper_Form $form){} @@ -33,16 +61,29 @@ public static function header(){ echo ""; } public static function footer(){ - $ppd = Helper::options()->pluginUrl; + $height = Typecho_Widget::widget('Widget_Options')->Plugin('Pio')->custom_height; + $width = Typecho_Widget::widget('Widget_Options')->Plugin('Pio')->custom_width; + + if($height && $width){ + echo ""; + } + else if($height){ + echo ""; + } + else if($width){ + echo ""; + } + else{ + echo ""; + } + + echo "" . "\n"; - echo ""; - echo "" . "\n"; - if(Typecho_Widget::widget('Widget_Options')->Plugin('Pio')->custom_model){ echo "". "\n"; } else{ - echo "". "\n"; + echo "". "\n"; } } } \ No newline at end of file