Пример #1
0
function iriStatPressOptions()
{
    if ($_POST['saveit'] == 'yes') {
        update_option('statpress_collectloggeduser', $_POST['statpress_collectloggeduser']);
        update_option('statpress_autodelete', $_POST['statpress_autodelete']);
        update_option('statpress_daysinoverviewgraph', $_POST['statpress_daysinoverviewgraph']);
        update_option('statpress_mincap', $_POST['statpress_mincap']);
        update_option('statpress_donotcollectspider', $_POST['statpress_donotcollectspider']);
        update_option('statpress_autodelete_spider', $_POST['statpress_autodelete_spider']);
        // update database too
        iri_StatPress_CreateTable();
        print "<br /><div class='updated'><p>" . __('Saved', 'statpress') . "!</p></div>";
    } else {
        ?>
  <div class='wrap'><h2><?php 
        _e('Options', 'statpress');
        ?>
</h2>
  <form method=post><table width=100%>
<?php 
        print "<tr><td><input type=checkbox name='statpress_collectloggeduser' value='checked' " . get_option('statpress_collectloggeduser') . "> " . __('Collect data about logged users, too.', 'statpress') . "</td></tr>";
        print "<tr><td><input type=checkbox name='statpress_donotcollectspider' value='checked' " . get_option('statpress_donotcollectspider') . "> " . __('Do not collect spiders visits', 'statpress') . "</td></tr>";
        ?>
  <tr><td><?php 
        _e('Automatically delete visits older than', 'statpress');
        ?>
  <select name="statpress_autodelete">
  <option value="" <?php 
        if (get_option('statpress_autodelete') == '') {
            print "selected";
        }
        ?>
><?php 
        _e('Never delete!', 'statpress');
        ?>
</option>
  <option value="1 month" <?php 
        if (get_option('statpress_autodelete') == "1 month") {
            print "selected";
        }
        ?>
>1 <?php 
        _e('month', 'statpress');
        ?>
</option>
  <option value="3 months" <?php 
        if (get_option('statpress_autodelete') == "3 months") {
            print "selected";
        }
        ?>
>3 <?php 
        _e('months', 'statpress');
        ?>
</option>
  <option value="6 months" <?php 
        if (get_option('statpress_autodelete') == "6 months") {
            print "selected";
        }
        ?>
>6 <?php 
        _e('months', 'statpress');
        ?>
</option>
  <option value="1 year" <?php 
        if (get_option('statpress_autodelete') == "1 year") {
            print "selected";
        }
        ?>
>1 <?php 
        _e('year', 'statpress');
        ?>
</option>
  </select></td></tr>
  
  <tr><td><?php 
        _e('Automatically delete spider visits older than', 'statpress');
        ?>
  <select name="statpress_autodelete_spider">
  <option value="" <?php 
        if (get_option('statpress_autodelete_spider') == '') {
            print "selected";
        }
        ?>
><?php 
        _e('Never delete!', 'statpress');
        ?>
</option>
  <option value="1 day" <?php 
        if (get_option('statpress_autodelete_spider') == "1 day") {
            print "selected";
        }
        ?>
>1 <?php 
        _e('day', 'statpress');
        ?>
</option>
  <option value="1 week" <?php 
        if (get_option('statpress_autodelete_spider') == "1 week") {
            print "selected";
        }
        ?>
>1 <?php 
        _e('week', 'statpress');
        ?>
</option>
  <option value="1 month" <?php 
        if (get_option('statpress_autodelete_spider') == "1 month") {
            print "selected";
        }
        ?>
>1 <?php 
        _e('month', 'statpress');
        ?>
</option>
  <option value="1 year" <?php 
        if (get_option('statpress_autodelete_spider') == "1 year") {
            print "selected";
        }
        ?>
>1 <?php 
        _e('year', 'statpress');
        ?>
</option>
  </select></td></tr>

  <tr><td><?php 
        _e('Days in Overview graph', 'statpress');
        ?>
  <select name="statpress_daysinoverviewgraph">
  <option value="7" <?php 
        if (get_option('statpress_daysinoverviewgraph') == 7) {
            print "selected";
        }
        ?>
>7</option>
  <option value="10" <?php 
        if (get_option('statpress_daysinoverviewgraph') == 10) {
            print "selected";
        }
        ?>
>10</option>
  <option value="20" <?php 
        if (get_option('statpress_daysinoverviewgraph') == 20) {
            print "selected";
        }
        ?>
>20</option>
  <option value="30" <?php 
        if (get_option('statpress_daysinoverviewgraph') == 30) {
            print "selected";
        }
        ?>
>30</option>
  <option value="50" <?php 
        if (get_option('statpress_daysinoverviewgraph') == 50) {
            print "selected";
        }
        ?>
>50</option>
  </select></td></tr>

  <tr><td><?php 
        _e('Minimum capability to view stats', 'statpress');
        ?>
  <select name="statpress_mincap">
<?php 
        iri_dropdown_caps(get_option('statpress_mincap'));
        ?>
  </select> 
  <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank"><?php 
        _e("more info", 'statpress');
        ?>
</a>
  </td></tr>
  
  <tr><td><br><input type=submit value="<?php 
        _e('Save options', 'statpress');
        ?>
"></td></tr>
  </tr>
  </table>
  <input type=hidden name=saveit value=yes>
  <input type=hidden name=page value=statpress><input type=hidden name=statpress_action value=options>
  </form>
  </div>
<?php 
    }
    // chiude saveit
}
Пример #2
0
function iriStatPressOptions()
{
    if ($_POST['saveit'] == 'yes') {
        //$_POST,HTTP POST变量
        update_option('statpress_collectloggeduser', $_POST['statpress_collectloggeduser']);
        update_option('statpress_autodelete', $_POST['statpress_autodelete']);
        update_option('statpress_daysinoverviewgraph', $_POST['statpress_daysinoverviewgraph']);
        update_option('statpress_mincap', $_POST['statpress_mincap']);
        update_option('statpress_collectspider', $_POST['statpress_collectspider']);
        update_option('statpress_showhotdepth', $_POST['statpress_showhotdepth']);
        update_option('statpress_showrelated', $_POST['statpress_showrelated']);
        update_option('statpress_showspyonwidget', $_POST['statpress_showspyonwidget']);
        update_option('statpress_notshowcreditonwidget', $_POST['statpress_notshowcreditonwidget']);
        update_option('statpress_ipsearchtools', $_POST['statpress_ipsearchtools']);
        update_option('statpress_spynumber', $_POST['statpress_spynumber']);
        update_option('statpress_friendsnumber', $_POST['statpress_friendsnumber']);
        update_option('statpress_details_period', $_POST['statpress_details_period']);
        update_option('statpress_show404onmenu', $_POST['statpress_show404onmenu']);
        update_option('statpress_showexportonmenu', $_POST['statpress_showexportonmenu']);
        update_option('statpress_showupdateonmenu', $_POST['statpress_showupdateonmenu']);
        update_option('statpress_showbaniponmenu', $_POST['statpress_showbaniponmenu']);
        update_option('statpress_showdefiponmenu', $_POST['statpress_showdefiponmenu']);
        update_option('statpress_showspideronmenu', $_POST['statpress_showspideronmenu']);
        update_option('statpress_delete_options_when_deactivating', $_POST['statpress_delete_options_when_deactivating']);
        update_option('statpress_delete_table_when_deactivating', $_POST['statpress_delete_table_when_deactivating']);
        # update database too
        iri_StatPress_CreateTable();
        //        iri_add_pages();
        print "<br /><div class='updated'><p>" . __('Saved', 'statpresscn') . "!</p></div>";
    }
    ?>
<div class='wrap'>
    <style type="text/css">
        TABLE {
            width: 100%;
            border-collapse: separate;
            border-spacing: 10pt;}
        TD {
            /* background: white; */
            border-bottom: ridge 1pt white;
        }
        TH { border: outset 4pt white; }
    </style>
    <form method=post>
        <table>
            <COLGROUP><COL WIDTH=50% ALIGN=left ><COL ALIGN=left></COLGROUP>
            <th colspan=2><?php 
    _e('Frontend Setting', 'statpresscn');
    ?>
</th>
            <tr>
                <td><input type=checkbox name='statpress_showhotdepth' value='checked' <?php 
    echo get_option('statpress_showhotdepth');
    ?>
> <?php 
    _e('Show HotDepth on the head', 'statpresscn');
    ?>
</td>
                <td><input type=checkbox name='statpress_showrelated' value='checked' <?php 
    echo get_option('statpress_showrelated');
    global $wpdb;
    $table_name = $wpdb->prefix . "statpress";
    $setnum = $wpdb->get_var("select count(*) from {$table_name}");
    if ($setnum < 1000) {
        echo " disabled='disabled'";
        update_option('statpress_showrelated', '');
    }
    ?>
> <?php 
    _e('Show related post at the tail', 'statpresscn');
    ?>
                    (<font color=blue><strong>Notice:</strong></font>
                    You can use this function After your blog being visited 1000 times, Now the number is
                        <?php 
    echo $setnum;
    ?>
)</td>
            </tr>
            <tr>
                <td><input type=checkbox name='statpress_showspyonwidget' value='checked' <?php 
    echo get_option('statpress_showspyonwidget');
    ?>
> <?php 
    _e('Show spy on widget, default number is 8', 'statpresscn');
    ?>
</td>
                <td><input type=checkbox name='statpress_notshowcreditonwidget' value='checked' <?php 
    echo get_option('statpress_notshowcreditonwidget');
    ?>
> <?php 
    _e('Not show StatPressCN\'s credit on widget', 'statpresscn');
    ?>
</td>
            </tr>

            <th colspan=2><?php 
    _e('Backend Setting', 'statpresscn');
    ?>
</th>
            <tr><td><?php 
    _e('Days in Overview graph', 'statpresscn');
    ?>
                    <select name="statpress_daysinoverviewgraph">
                        <option value="7" <?php 
    if (get_option('statpress_daysinoverviewgraph') == 7) {
        print "selected";
    }
    ?>
>7</option>
                        <option value="10" <?php 
    if (get_option('statpress_daysinoverviewgraph') == 10) {
        print "selected";
    }
    ?>
>10</option>
                        <option value="20" <?php 
    if (get_option('statpress_daysinoverviewgraph') == 20) {
        print "selected";
    }
    ?>
>20</option>
                        <option value="30" <?php 
    if (get_option('statpress_daysinoverviewgraph') == 30) {
        print "selected";
    }
    ?>
>30</option>
                        <option value="50" <?php 
    if (get_option('statpress_daysinoverviewgraph') == 50) {
        print "selected";
    }
    ?>
>50</option>
                    </select></td>
                <td><?php 
    _e('Number in Spy', 'statpresscn');
    ?>
                    <select name="statpress_spynumber">
                        <option value="10" <?php 
    if (get_option('statpress_spynumber') == 10) {
        print "selected";
    }
    ?>
>10</option>
                        <option value="20" <?php 
    if (get_option('statpress_spynumber') == 20) {
        print "selected";
    }
    ?>
>20</option>
                        <option value="30" <?php 
    if (get_option('statpress_spynumber') == 30) {
        print "selected";
    }
    ?>
>30</option>
                        <option value="50" <?php 
    if (get_option('statpress_spynumber') == 50) {
        print "selected";
    }
    ?>
>50</option>
                    </select></td>
            </tr>
            <tr>
                <td><?php 
    _e('Number in Friends', 'statpresscn');
    ?>
                    <select name="statpress_friendsnumber">
                        <option value="5" <?php 
    if (get_option('statpress_friendsnumber') == 5) {
        print "selected";
    }
    ?>
>5</option>
                        <option value="10" <?php 
    if (get_option('statpress_friendsnumber') == 10) {
        print "selected";
    }
    ?>
>10</option>
                        <option value="20" <?php 
    if (get_option('statpress_friendsnumber') == 20) {
        print "selected";
    }
    ?>
>20</option>
                        <option value="50" <?php 
    if (get_option('statpress_friendsnumber') == 50) {
        print "selected";
    }
    ?>
>50</option>
                    </select></td>
                <td><?php 
    _e('left details page stat period setting is ', 'statpresscn');
    ?>
                    <select name="statpress_details_period">
                        <option value="1 month" <?php 
    if (get_option('statpress_details_period') == "1 month") {
        print "selected";
    }
    ?>
>1 <?php 
    _e('month', 'statpresscn');
    ?>
</option>
                        <option value="2 weeks" <?php 
    if (get_option('statpress_details_period') == "2 weeks") {
        print "selected";
    }
    ?>
>2 <?php 
    _e('weeks', 'statpresscn');
    ?>
</option>
                        <option value="1 week" <?php 
    if (get_option('statpress_details_period') == "1 week") {
        print "selected";
    }
    ?>
>1 <?php 
    _e('week', 'statpresscn');
    ?>
</option>
                        <option value="1 day" <?php 
    if (get_option('statpress_details_period') == "1 day") {
        print "selected";
    }
    ?>
>1 <?php 
    _e('day', 'statpresscn');
    ?>
</option>
                    </select></td>
            </tr>

            <th colspan=2><?php 
    _e('Functions Extended', 'statpresscn');
    ?>
</th>
            <tr>
                <td><input type=checkbox name='statpress_showspideronmenu' value='checked' <?php 
    echo get_option('statpress_showspideronmenu');
    ?>
> <?php 
    _e('Show Spider DIY on menu', 'statpresscn');
    ?>
 </td>
                <td><input type=checkbox name='statpress_showbaniponmenu' value='checked' <?php 
    echo get_option('statpress_showbaniponmenu');
    ?>
> <?php 
    _e('Show BanIP DIY on menu', 'statpresscn');
    ?>
</td>
            </tr>
            <tr>
                <td><input type=checkbox name='statpress_showexportonmenu' value='checked' <?php 
    echo get_option('statpress_showexportonmenu');
    ?>
> <?php 
    _e('Show Export on menu', 'statpresscn');
    ?>
 </td>
                <td><input type=checkbox name='statpress_showupdateonmenu' value='checked' <?php 
    echo get_option('statpress_showupdateonmenu');
    ?>
> <?php 
    _e('Show StatUpdate on menu', 'statpresscn');
    ?>
 </td>
            </tr>
            <tr>
                <td><input type=checkbox name='statpress_show404onmenu' value='checked' <?php 
    echo get_option('statpress_show404onmenu');
    ?>
> <?php 
    _e('Show 404 on menu', 'statpresscn');
    ?>
 </td>
                <td><input type=checkbox name='statpress_showdefiponmenu' value='checked' <?php 
    echo get_option('statpress_showdefiponmenu');
    ?>
> <?php 
    _e('Show Define IP on menu', 'statpresscn');
    ?>
</td>
            </tr>
            <th colspan=2><?php 
    _e('System Setting', 'statpresscn');
    ?>
</th>
            <tr>
                <td><?php 
    _e('Automatically delete visits older than', 'statpresscn');
    ?>
                    <select name="statpress_autodelete">
                        <option value="" <?php 
    if (get_option('statpress_autodelete') == '') {
        print "selected";
    }
    ?>
><?php 
    _e('Never delete!', 'statpresscn');
    ?>
</option>
                        <option value="1 week" <?php 
    if (get_option('statpress_autodelete') == "1 week") {
        print "selected";
    }
    ?>
>1 <?php 
    _e('week', 'statpresscn');
    ?>
</option>
                        <option value="2 weeks" <?php 
    if (get_option('statpress_autodelete') == "2 weeks") {
        print "selected";
    }
    ?>
>2 <?php 
    _e('weeks', 'statpresscn');
    ?>
</option>
                        <option value="1 month" <?php 
    if (get_option('statpress_autodelete') == "1 month") {
        print "selected";
    }
    ?>
>1 <?php 
    _e('month', 'statpresscn');
    ?>
</option>
                        <option value="3 months" <?php 
    if (get_option('statpress_autodelete') == "3 months") {
        print "selected";
    }
    ?>
>3 <?php 
    _e('months', 'statpresscn');
    ?>
</option>
                        <option value="6 months" <?php 
    if (get_option('statpress_autodelete') == "6 months") {
        print "selected";
    }
    ?>
>6 <?php 
    _e('months', 'statpresscn');
    ?>
</option>
                        <option value="1 year" <?php 
    if (get_option('statpress_autodelete') == "1 year") {
        print "selected";
    }
    ?>
>1 <?php 
    _e('year', 'statpresscn');
    ?>
</option>
                    </select></td>

            </tr>
            <tr><td><input type=checkbox name='statpress_collectloggeduser' value='checked' <?php 
    echo get_option('statpress_collectloggeduser');
    ?>
><?php 
    _e('Collect data about logged users, too.', 'statpresscn');
    ?>
 </td>
                <td><input type=checkbox name='statpress_collectspider' value='checked' <?php 
    echo get_option('statpress_collectspider');
    ?>
><?php 
    _e('Also collect spiders visits', 'statpresscn');
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('IP Info Query Tools', 'statpresscn');
    ?>
:
                    <select name="statpress_ipsearchtools">
                        <option value="http://en.utrace.de/?query=" <?php 
    if (get_option('statpress_ipsearchtools') == "http://en.utrace.de/?query=") {
        print "selected";
    }
    ?>
>http://en.utrace.de</option>
                        <option value="http://whois.domaintools.com/" <?php 
    if (get_option('statpress_ipsearchtools') == "http://whois.domaintools.com/") {
        print "selected";
    }
    ?>
>http://whois.domaintools.com</option>
                        <option value="http://api.hostip.info/get_html.php?ip=" <?php 
    if (get_option('statpress_ipsearchtools') == "http://api.hostip.info/get_html.php?ip=") {
        print "selected";
    }
    ?>
>http://api.hostip.info</option>
                        <option value="http://www.youdao.com/smartresult-xml/search.s?type=ip&q=" <?php 
    if (get_option('statpress_ipsearchtools') == "http://www.youdao.com/smartresult-xml/search.s?type=ip&q=") {
        print "selected";
    }
    ?>
>http://www.youdao.com (中文用户专用)</option>
                    </select></td>
                <td><?php 
    _e('Minimum capability to view stats', 'statpresscn');
    ?>
                    <select name="statpress_mincap">
                            <?php 
    iri_dropdown_caps(get_option('statpress_mincap'));
    ?>
                    </select>
                    <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank"><?php 
    _e("more info", 'statpresscn');
    ?>
</a>
                </td>
            </tr>
            <tr>
                <td><input type=checkbox name='statpress_delete_options_when_deactivating' value='checked' <?php 
    echo get_option('statpress_delete_options_when_deactivating');
    ?>
>
                        <?php 
    _e('Delete options when deactivating', 'statpresscn');
    ?>
                    (<font color=red><strong><?php 
    _e('Warning', 'statpresscn');
    ?>
</strong></font>:<?php 
    _e('Options or setting will be reset to default when StatpressCN being deactivated', 'statpresscn');
    ?>
)
                </td>
                <td><input type=checkbox name='statpress_delete_table_when_deactivating' value='checked' <?php 
    echo get_option('statpress_delete_table_when_deactivating');
    ?>
>
                        <?php 
    _e('Delete table when deactivating', 'statpresscn');
    ?>
                    (<font color=red><strong><?php 
    _e('Warning', 'statpresscn');
    ?>
</strong></font>:<?php 
    _e('All record will be deleted when StatpressCN being deactivated, including the table\' structure', 'statpresscn');
    ?>
)
                </td>
            </tr>
            <tr><td align=center colspan=2 style="border:dashed 1px blue;"><input type=submit value="<?php 
    _e('Save options', 'statpresscn');
    ?>
"></td></tr>
        </table>
        <input type=hidden name=saveit value=yes>
        <input type=hidden name=page value=statpresscn><input type=hidden name=statpress_action value=options>
    </form>
</div>
    <?php 
    heart5_print_spc_footer();
}