示例#1
0
文件: base.php 项目: cjhgithub/ctheme
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');
}
示例#2
0
function git_options_page()
{
    global $options;
    $optionsSetup = git_get_option('git_options_setup') != '';
    if ($_REQUEST['update']) {
        echo '<div class="updated"><p><strong>设置已保存。</strong></p></div>';
    }
    if ($_REQUEST['reset']) {
        echo '<div class="updated"><p><strong>设置已重置。</strong></p></div>';
    }
    ?>

<div class="wrap">
    <h2>Git 主题选项&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="button-primary" type="button" value="主题主页" onclick="window.open('http://googlo.me/archives/3011.html')">&nbsp;&nbsp;<input class="button-primary" type="button" value="邮箱反馈" onclick="window.open('http://googlo.me/go/mail')">&nbsp;&nbsp;<input class="button-primary" type="button" value="支持主题" onclick="window.open('http://googlo.me/pay')">&nbsp;&nbsp;<input class="button-primary" type="button" value="功能建议" onclick="window.open('http://googlo.me/about.html')">&nbsp;&nbsp;<input class="button-primary" type="button" value="食用文档" onclick="window.open('http://googlo.me/archives/3275.html')">&nbsp;&nbsp;<input class="button-primary" type="button" value="定制修改" onclick="window.open('http://googlo.me/go/qq')">&nbsp;&nbsp;<input class="button-primary" type="button" value="加入QQ群" onclick="window.open('http://googlo.me/go/qun')"></h2>
    <input placeholder="筛选主题选项…" type="search" id="theme-options-search" />
    <div class="yunluotips"><?php 
    echo file_get_contents("https://coding.net/u/googlo/p/api/git/raw/master/notice.txt");
    ?>
</div>
    <div class="catlist">您的网站分类列表:<?php 
    echo Bing_show_category();
    ?>
</div>
    <form method="post">
        <h2 class="nav-tab-wrapper">
<?php 
    $panelIndex = 0;
    foreach ($options as $value) {
        if ($value['type'] == 'panelstart') {
            echo '<a href="#' . $value['id'] . '" class="nav-tab' . ($panelIndex == 0 ? ' nav-tab-active' : '') . '">' . $value['title'] . '</a>';
        }
        $panelIndex++;
    }
    echo '<a href="#about_theme" class="nav-tab">关于主题</a>';
    ?>
</h2>

<?php 
    $panelIndex = 0;
    foreach ($options as $value) {
        switch ($value['type']) {
            case 'panelstart':
                echo '<div class="panel" id="' . $value['id'] . '" ' . ($panelIndex == 0 ? ' style="display:block"' : '') . '><table class="form-table">';
                $panelIndex++;
                break;
            case 'panelend':
                echo '</table></div>';
                break;
            case 'subtitle':
                echo '<tr><th colspan="2"><h3>' . $value['title'] . '</h3></th></tr>';
                break;
            case 'text':
                ?>
<tr>
    <th><label for="<?php 
                echo $value['id'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</label></th>
    <td>
        <label>
        <input name="<?php 
                echo $value['id'];
                ?>
" class="regular-text" id="<?php 
                echo $value['id'];
                ?>
" type='text' value="<?php 
                if ($optionsSetup || get_option($value['id']) != '') {
                    echo stripslashes(get_option($value['id']));
                } else {
                    echo $value['std'];
                }
                ?>
" />
        <span class="description"><?php 
                echo $value['desc'];
                ?>
</span>
        </label>
    </td>
</tr>
<?php 
                break;
            case 'number':
                ?>
<tr>
    <th><label for="<?php 
                echo $value['id'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</label></th>
    <td>
        <label>
        <input name="<?php 
                echo $value['id'];
                ?>
" class="small-text" id="<?php 
                echo $value['id'];
                ?>
" type="number" value="<?php 
                if ($optionsSetup || get_option($value['id']) != '') {
                    echo get_option($value['id']);
                } else {
                    echo $value['std'];
                }
                ?>
" />
        <span class="description"><?php 
                echo $value['desc'];
                ?>
</span>
        </label>
    </td>
</tr>
<?php 
                break;
            case 'textarea':
                ?>
<tr>
    <th><?php 
                echo $value['name'];
                ?>
</th>
    <td>
        <p><label for="<?php 
                echo $value['id'];
                ?>
"><?php 
                echo $value['desc'];
                ?>
</label></p>
        <p><textarea name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" rows="5" cols="50" class="large-text code"><?php 
                if ($optionsSetup || get_option($value['id']) != '') {
                    echo stripslashes(get_option($value['id']));
                } else {
                    echo $value['std'];
                }
                ?>
</textarea></p>
    </td>
</tr>
<?php 
                break;
            case 'select':
                ?>
<tr>
    <th><label for="<?php 
                echo $value['id'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</label></th>
    <td>
        <label>
            <select name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
">
                <?php 
                foreach ($value['options'] as $option) {
                    ?>
                <option value="<?php 
                    echo $option;
                    ?>
" <?php 
                    selected(get_option($value['id']), $option);
                    ?>
>
                    <?php 
                    echo $option;
                    ?>
                </option>
                <?php 
                }
                ?>
            </select>
            <span class="description"><?php 
                echo $value['desc'];
                ?>
</span>
        </label>
    </td>
</tr>

<?php 
                break;
            case 'radio':
                ?>
<tr>
    <th><label for="<?php 
                echo $value['id'];
                ?>
"><?php 
                echo $value['name'];
                ?>
</label></th>
    <td>
        <?php 
                foreach ($value['options'] as $name => $option) {
                    ?>
        <label>
            <input type="radio" name="<?php 
                    echo $value['id'];
                    ?>
" id="<?php 
                    echo $value['id'];
                    ?>
" value="<?php 
                    echo $option;
                    ?>
" <?php 
                    checked(get_option($value['id']), $option);
                    ?>
>
            <?php 
                    echo $name;
                    ?>
        </label>
        <?php 
                }
                ?>
        <p><span class="description"><?php 
                echo $value['desc'];
                ?>
</span></p>
    </td>
</tr>
 
<?php 
                break;
            case 'checkbox':
                ?>
<tr>
    <th><?php 
                echo $value['name'];
                ?>
</th>
    <td>
        <label>
            <input type='checkbox' name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" value="1" <?php 
                echo checked(get_option($value['id']), 1);
                ?>
 />
            <span><?php 
                echo $value['desc'];
                ?>
</span>
        </label>
    </td>
</tr>

<?php 
                break;
            case 'checkboxs':
                ?>
<tr>
    <th><?php 
                echo $value['name'];
                ?>
</th>
    <td>
        <?php 
                $checkboxsValue = get_option($value['id']);
                if (!is_array($checkboxsValue)) {
                    $checkboxsValue = array();
                }
                foreach ($value['options'] as $id => $title) {
                    ?>
        <label>
            <input type="checkbox" name="<?php 
                    echo $value['id'];
                    ?>
[]" id="<?php 
                    echo $value['id'];
                    ?>
[]" value="<?php 
                    echo $id;
                    ?>
" <?php 
                    checked(in_array($id, $checkboxsValue), true);
                    ?>
>
            <?php 
                    echo $title;
                    ?>
        </label>
        <?php 
                }
                ?>
        <span class="description"><?php 
                echo $value['desc'];
                ?>
</span>
    </td>
</tr>
 
<?php 
                break;
        }
    }
    ?>
<div class="panel" id="about_theme">
<h2>主题的那些事</h2>
        <p>&nbsp;&nbsp;这款主题一开始来自于大前端的D8主题,优秀的D8主题在经过欲思这里,欲思对这款主题进行了大量的修改,对本款主题的流行起到了非常重要的作用。</p>
        <p>&nbsp;&nbsp;云落在正式建站的时候选择了这款主题并且一直使用到现在,期间对这款主题进行了N次的代码修改,有的地方是小修改,有的地方事一些大的修改,在欲思主题的基础上面做了很多二次开发,随着主题的修改进程,个人对WordPress的理解也随之加深,对于WordPress的应用也较以前有了更深的熟练。</p>
        <p>&nbsp;&nbsp;故,在经过多次修改后,自觉主题修改的足够对其更名以将其与欲思主题以区分,并且将其代码托管至<a href="http://git.oschina.net/yunluo/git" target="_blank">开源中国</a>,并且将其更名为:Git !</p>
        <p>&nbsp;&nbsp;定名为Git,首先是因为主题采用Git版本系统管理代码的,写的最多的代码就是git了,另外G代表我的Googlo.Me,并且一直采用开源中国托管代码,遂定名为Git。</p>
        <p>&nbsp;&nbsp;感谢大前端的D8主题,感谢欲思的欲思主题,感谢小影的主题,感谢知更鸟的主题,感谢露兜博客,感谢devework,感谢开源中国,感谢一直跟随主题版本升级的朋友们</p>
<h2>支持云落</h2>
<p>如果您觉的这款主题很赞,欢迎您扫码支持云落</p>
<img style="width :300px;height :300px" src="http://i1.tietuku.com/d6c43b39f0c3c64c.jpg"></img>
<h2>联系云落</h2>
<a href="http://googlo.me/about.html" target="_blank">乐趣公园留言板</a>
</div>
<p class="submit">
    <input name="submit" type="submit" class="button button-primary" value="保存选项"/>
    <input type="hidden" name="action" value="update" />
</p>
</form>
<form method="post">
<p>
    <input name="reset" type="submit" class="button button-secondary" value="重置选项" onclick="return confirm('你确定要重置选项吗?');"/>
    <input type="hidden" name="action" value="reset" />
</p>
</form>
</div>
<style>.catlist{background-color:#FFB6C1;border:2px solid #FFB6C1;padding:5px;margin-top: 12px;text-align: center;color:#FFFFFF;}.catlist:hover{background-color:transparent;color: #000000}.yunluotips{border: 2px solid #FFCC33;padding: 20px}.yunluotips:hover{background: #FFCC33;}.panel{display:none}.panel h3{margin:0;font-size:1.2em}#panel_update ul{list-style-type:disc}.nav-tab-wrapper{clear:both}.nav-tab{position:relative}.nav-tab i:before{position:absolute;top:-10px;right:-8px;display:inline-block;padding:2px;border-radius:50%;background:#e14d43;color:#fff;content:"\f463";vertical-align:text-bottom;font:400 18px/1 dashicons;speak:none}#theme-options-search{display:none;float:right;margin-top:-34px;width:280px;font-weight:300;font-size:16px;line-height:1.5}.updated+#theme-options-search{margin-top:-91px}.wrap.searching .nav-tab-wrapper a,.wrap.searching .panel tr,#attrselector{display:none}.wrap.searching .panel{display:block !important}#attrselector[attrselector*=ok]{display:block}</style>
<style id="theme-options-filter"></style>
<div id="attrselector" attrselector="ok" ></div>
<script>
jQuery(function ($) {
    $(".nav-tab").click(function () {
        $(this).addClass("nav-tab-active").siblings().removeClass("nav-tab-active");
        $(".panel").hide();
        $($(this).attr("href")).show();
        return false;
    });

    var themeOptionsFilter = $("#theme-options-filter");
    themeOptionsFilter.text("ok");
    if ($("#attrselector").is(":visible") && themeOptionsFilter.text() != "") {
        $(".panel tr").each(function (el) {
            $(this).attr("data-searchtext", $(this).text().replace(/\r|\n/g, '').replace(/ +/g, ' ').toLowerCase());
        });

        var wrap = $(".wrap");
        $("#theme-options-search").show().on("input propertychange", function () {
            var text = $(this).val().replace(/^ +| +$/, "").toLowerCase();
            if (text != "") {
                wrap.addClass("searching");
                themeOptionsFilter.text(".wrap.searching .panel tr[data-searchtext*='" + text + "']{display:block}");
            } else {
                wrap.removeClass("searching");
                themeOptionsFilter.text("");
            };
        });
    };
});
</script>

<?php 
}