function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $output = outputHtml(); echo $output . $after_widget; }
function viewSetting() { $options = array(array('label' => '选择主题', 'type' => 'radio', 'id' => "themes", 'desc' => '选择一个色调作为您网站的主色调,如果这里的色彩还不够,您可以使用下面的自定义色彩', 'options' => array('默认(程序猿主题)', '蓝色经典', '绿色生机', '紫色高雅', '灰色稳重', '红色喜庆', '粉红回忆', '碧蓝色', '黄色', '橙色', '文艺', '小清新', '喵星人', '简约', '极简')), array('label' => '主题颜色', 'type' => 'text', 'id' => 'theme_color', 'desc' => '格式:#xxx或xxxxxxx,界面整体颜色,设置不好会影响整个网站的整体风格。'), array('label' => '主题搭配颜色', 'type' => 'text', 'id' => 'theme_color2', 'desc' => '导航栏下拉菜单的子菜单背景颜色'), array('label' => '主题超链接颜色', 'type' => 'text', 'id' => 'theme_a_color'), array('label' => '背景颜色', 'type' => 'text', 'id' => 'bg_color', 'desc' => '常用颜色:#eee,有背景图片时会被覆盖。'), array('label' => '背景图片', 'type' => 'textarea', 'id' => 'bg_image', 'desc' => '会覆盖背景颜色。'), array('label' => '导航栏背景颜色', 'type' => 'text', 'id' => 'nav_bg_color', 'desc' => ''), array('label' => '头部设置', 'type' => 'title'), array('label' => '网站头部高度', 'type' => 'text', 'id' => 'header_height', 'desc' => '单位px'), array('label' => '头部背景图片', 'type' => 'textarea', 'id' => 'header_image', 'desc' => '会覆盖头部背景颜色。'), array('label' => '头部背景固定', 'type' => 'checkbox', 'id' => 'header_bg_fixed', 'desc' => '开启 【开启后,头部背景图片高度不能伸缩适应,请在上面的头部高度输入框里填写头部背景图片的高度。】'), array('label' => '头部文字颜色', 'type' => 'text', 'id' => 'header_text_color', 'desc' => ''), array('label' => '页脚背景颜色', 'type' => 'text', 'id' => 'footer_bg_color', 'desc' => ''), array('label' => '网站宽度', 'type' => 'text', 'id' => 'max_width', 'desc' => '单位px,默认1250px'), array('label' => '评论设置', 'type' => 'title'), array('label' => '评论输入框显示的文字', 'type' => 'text', 'id' => 'comment_text', 'desc' => '如:大侠,请留步,关于这篇文章,说点什么吧!'), array('label' => '特效设置', 'type' => 'title'), array('label' => '飘雪特效', 'type' => 'checkbox', 'id' => 'show_snow', 'desc' => '开启 【开启后会有点影响性能,不过影响不大】'), array('label' => '网页点击特效', 'type' => 'checkbox', 'id' => 'show_click_count', 'desc' => '开启 【开启后点击网页任意位置就可以看到效果了。没卵用,无聊时做着玩玩的。】')); if ($_POST['update_options'] == 'true') { foreach ($options as $opt) { if ($opt['type'] == 'checkbox') { $display = $_POST[$opt['id']] == 'on' ? true : false; update_option($opt['id'], $display); } else { update_option($opt['id'], $_POST[$opt['id']]); } } echo SuccessInfo; } if ($_POST['update_options2'] == 'true') { update_option('post_recommend', $_POST['post_recommend']); echo SuccessInfo; } ?> <div class="wrap"> <h2>界面设置</h2><span>更多主题,请访问<a href="http://www.chenjianhang.com/" target="_blank">陈建杭个人博客</a></span> <form method="POST" action=""> <input type="hidden" name="update_options" value="true" /> <table class="form-table"> <tbody> <?php outputHtml($options); ?> </tbody> </table> <p><input type="submit" class="button-primary" name="admin_options" value="更新数据"/></p> </form> <h2>功能设置</h2> <form method="POST" action=""> <input type="hidden" name="update_options2" value="true" /> <table class="form-table"> <tbody> <?php //echo 'PHP版本' . phpinfo(); $check = get_option('post_recommend') ? 'checked' : ''; ?> <tr valign="top"> <th scope="row"><label for="d_hamster">底部文章随机推荐</label></th> <td><input type="checkbox" name="post_recommend" <?php echo $check; ?> /> 开启</td> </tr> </tbody> </table> <p><input type="submit" class="button-primary" name="admin_options" value="更新数据"/></p> </form> </div> <?php add_action('admin_menu', 'viewSetting'); }
$tmp_urls = ''; while (!$result->EOF) { $tmp_urls .= "\n\t<url>\n\t <loc>" . zen_href_link('product_info', 'products_id=' . $result->fields['products_id']) . "</loc>\n\t <changefreq>weekly</changefreq>\n\t</url>"; $result->MoveNext(); } if (strlen($tmp_urls) == 0) { die('empty products found.'); } $sitemap_content = $head . $tmp_urls . $tail; if (!is_dir('sitemaps')) { mkdir('sitemaps'); } file_put_contents('sitemaps/' . $sitemap_name, $sitemap_content); echo "<br><br><br>finish.<br>"; echo HTTP_SERVER . DIR_WS_CATALOG . 'sitemaps/' . $sitemap_name; outputHtml(); exit; function outputHtml() { echo '<form style="margin:100px;" method="post" action="">'; echo '<fieldset><legend>begin products id</legend>'; echo '<input type="hidden" name="action" value="gen_sitemap_by_pid" /><br>'; echo 'begin products id:<input type="text" name="begin_products_id" value="" /><br>'; echo 'sitemap name suffix:<input type="text" name="name_suffix" value="" /><br>'; echo '<input type="submit" name="submit" value="submit" />'; echo '</fieldset>'; echo '</form>'; echo '<form style="margin:100px;" method="post" action="">'; echo '<fieldset><legend>begin products id</legend>'; echo '<input type="hidden" name="action" value="gen_sitemap_by_catid" />'; echo 'category id:<input type="text" name="category_id" value="" /><br>';
function BaseSettings() { $options = array(array('label' => '首页公告', 'type' => 'checkbox', 'id' => 'show_notice', 'desc' => '开启 【开启后,请在左边菜单选择:公告->添加公告】'), array('label' => '首页幻灯片', 'type' => 'checkbox', 'id' => 'close_slide', 'desc' => '关闭'), array('label' => '作品展示', 'type' => 'textarea', 'id' => 'works_ids', 'desc' => '作品展示页面的分类ID,ID之间用英文逗号分隔(如13,64)'), array('label' => '文章列表属性', 'type' => 'title'), array('label' => '列表文章新窗口打开', 'type' => 'checkbox', 'id' => 'link_new_window', 'desc' => '开启'), array('label' => '列表显示分类', 'type' => 'checkbox', 'id' => 'hide_category', 'desc' => '关闭'), array('label' => '显示百度收录', 'type' => 'checkbox', 'id' => 'baidu_record', 'desc' => '开启 【玩玩就好,感觉不准的】'), array('label' => '列表显示作者', 'type' => 'checkbox', 'id' => 'hide_author', 'desc' => '关闭'), array('label' => '文章目录', 'type' => 'checkbox', 'id' => 'post_catalog', 'desc' => '开启'), array('label' => '文章内容属性【文章内容页上面显示的属性】', 'type' => 'title'), array('label' => '显示最后编辑时间', 'type' => 'checkbox', 'id' => 'show_edit_time', 'desc' => '开启【开启后,如果文章的最后编辑日期与创建日期不一致,会显示“最后编辑于XXX”】'), array('label' => '显示评论', 'type' => 'checkbox', 'id' => 'content_show_comment', 'desc' => '开启'), array('label' => '文章二维码', 'type' => 'checkbox', 'id' => 'show_qrcode', 'desc' => '开启 【开启后,用户可以扫描二维码在手机看文章。会耗一点点性能,如果不是必须的,就不要开启】'), array('label' => '版权相关', 'type' => 'title'), array('label' => '禁止复制', 'type' => 'checkbox', 'id' => 'prevent_copy', 'desc' => '开启 【开启后用户无法复制网站上的内容,可选择文字,但复制不成功】'), array('label' => '复制弹窗提示', 'type' => 'checkbox', 'id' => 'copy_tip', 'desc' => '开启 【开启后,复制之后会弹窗提示。开启时应该关闭“禁止复制”选项】'), array('label' => '页脚版权信息', 'type' => 'textarea', 'id' => 'copyright', 'desc' => '如:Copyright © 2015-2016 陈建杭'), array('label' => '其他', 'type' => 'title'), array('label' => '图片延迟加载', 'type' => 'checkbox', 'id' => 'close_lazy', 'desc' => '关闭 【除非是图片站点,否则不建议关闭】'), array('label' => '网站图标', 'type' => 'textarea', 'id' => 'web_shortcut_icon', 'desc' => '网站图标地址。浏览器中地址栏左侧显示的图标,一般大小为16x16,后缀名为.icon。如果不设置,默认图标是网站根目录下的favicon.ico。'), array('label' => '网站图标', 'type' => 'textarea', 'id' => 'web_icon', 'desc' => '网站图标地址。格式可为PNG\\GIF\\JPEG,尺寸一般为16x16、24x24、36x36等。不设置也无所谓。')); if ($_POST['update_options'] == 'true') { // 数据更新验证 foreach ($options as $opt) { if ($opt['type'] == 'checkbox') { $display = $_POST[$opt['id']] == 'on' ? true : false; update_option($opt['id'], $display); } else { if ($opt['type'] == 'title') { // do nothing } else { update_option($opt['id'], $_POST[$opt['id']]); } } } update_option('select-demo', $_POST['select-demo']); //select echo SuccessInfo; } ?> <div class="wrap"> <h2>基本设置</h2><span>更多主题,请访问<a href="http://www.chenjianhang.com/" target="_blank">陈建杭个人博客</a></span> <br/> <br/> <?php if (function_exists('mail')) { echo "您的主机/空间支持mail()函数^_^"; } else { echo "您的主机/空间不支持mail()函数!"; } ?> <br/> <br/> <?php echo Bing_show_category(); ?> <form method="POST" action=""> <input type="hidden" name="update_options" value="true" /> <table class="form-table"> <tbody> <?php outputHtml($options); ?> <tr valign="top"> <th scope="row"><label>下拉列表(Select)示例</label></th> <td><select name ="select-demo"> <?php $colour = get_option('select-demo'); ?> <option value="gray" <?php if ($colour == 'gray') { echo 'selected'; } ?> >灰色</option> <option value="blue" <?php if ($colour == 'blue') { echo 'selected'; } ?> >浅蓝</option> </select></td> </tr> </tbody> </table> <p><input type="submit" class="button-primary" name="admin_options" value="更新数据"/></p> </form> </div> <?php add_action('admin_menu', 'BaseSettings'); }