Changeset 65

Show
Ignore:
Timestamp:
02/20/07 18:16:59 (5 years ago)
Author:
yann
Message:

Enable variable for comment statistics in admin panel

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp_iminr.php

    r58 r65  
    2626Author URI: http://www.sans-savoir.net 
    2727*/ 
     28 
     29require_once(dirname(__FILE__) . '/lib/nusoap.php'); 
    2830 
    2931// print current tracker without other tags 
     
    8789                 
    8890                // defaults values 
    89                 $wp_iminr_default_options['account_id']               = ''; 
    90                  
    91                 $wp_iminr_default_options['enable_tracker']           = false; 
    92                 $wp_iminr_default_options['tracker_in_meta']          = true; 
    93                 $wp_iminr_default_options['tracker_in_meta_before']   = '<li>'; 
    94                 $wp_iminr_default_options['tracker_in_meta_after']    = '</li>'; 
    95                 $wp_iminr_default_options['tracker_in_footer']        = false; 
     91                $wp_iminr_default_options['wsap_uri'] = 'http://www.iminr.com/mining/wsMining.asmx?WSDL'; 
     92                 
     93                $wp_iminr_default_options['account_id'] = ''; 
     94                 
     95                $wp_iminr_default_options['enable_tracker'] = false; 
     96                $wp_iminr_default_options['tracker_in_meta'] = true; 
     97                $wp_iminr_default_options['tracker_in_meta_before']  = '<li>'; 
     98                $wp_iminr_default_options['tracker_in_meta_after'] = '</li>'; 
     99                $wp_iminr_default_options['tracker_in_footer'] = false; 
    96100                $wp_iminr_default_options['tracker_in_footer_before'] = '<br />'; 
    97                 $wp_iminr_default_options['tracker_in_footer_after']  = ''; 
    98                 $wp_iminr_default_options['desable_for_roles']        = array('administrator'); 
     101                $wp_iminr_default_options['tracker_in_footer_after'] = ''; 
     102                $wp_iminr_default_options['desable_for_roles'] = array('administrator'); 
     103                 
     104                $wp_iminr_default_options['enable_wp_comments'] = false; 
     105                $wp_iminr_default_options['enable_wp_comment_posts'] = false; 
     106                $wp_iminr_default_options['enable_wp_comment_authors'] = false; 
     107                $wp_iminr_default_options['enable_wp_trackbacks'] = false; 
     108                $wp_iminr_default_options['enable_wp_trackback_posts'] = false; 
     109                $wp_iminr_default_options['enable_wp_trackback_domains'] = false; 
     110                 
     111                $wp_iminr_default_options['error_variables'] = array(); 
    99112                 
    100113                // add default options to the database unless options already exist 
     
    123136                $wp_iminr_options = get_option('wp_iminr_options'); 
    124137                 
    125                 $wp_iminr_options['account_id']               =  $_POST['account_id']; 
    126                  
    127                 $wp_iminr_options['enable_tracker']           = ($_POST['enable_tracker']            == 'true'  ? true : false); 
    128                 $wp_iminr_options['tracker_in_meta']          = ($_POST['tracker_in']                == 'meta'  ? true : false); 
    129                 $wp_iminr_options['tracker_in_meta_before']   =  $_POST['tracker_in_meta_before']; 
    130                 $wp_iminr_options['tracker_in_meta_after']    =  $_POST['tracker_in_meta_after']; 
    131                 $wp_iminr_options['tracker_in_footer']        = ($_POST['tracker_in']                == 'footer' ? true : false); 
     138                $wp_iminr_options['account_id'] =  $_POST['account_id']; 
     139                 
     140                $wp_iminr_options['enable_tracker'] = ($_POST['enable_tracker'] == 'true' ? true : false); 
     141                $wp_iminr_options['tracker_in_meta'] = ($_POST['tracker_in'] == 'meta' ? true : false); 
     142                $wp_iminr_options['tracker_in_meta_before'] =  $_POST['tracker_in_meta_before']; 
     143                $wp_iminr_options['tracker_in_meta_after'] =  $_POST['tracker_in_meta_after']; 
     144                $wp_iminr_options['tracker_in_footer'] = ($_POST['tracker_in'] == 'footer' ? true : false); 
    132145                $wp_iminr_options['tracker_in_footer_before'] =  $_POST['tracker_in_footer_before']; 
    133                 $wp_iminr_options['tracker_in_footer_after']  =  $_POST['tracker_in_footer_after']; 
    134                 $wp_iminr_options['desable_for_roles']        = ($_POST['desable_for_roles']         == NULL     ? array() : $_POST['desable_for_roles']); 
    135                                  
     146                $wp_iminr_options['tracker_in_footer_after'] =  $_POST['tracker_in_footer_after']; 
     147                $wp_iminr_options['desable_for_roles'] = ($_POST['desable_for_roles'] == NULL ? array() : $_POST['desable_for_roles']); 
     148                 
     149                $wp_iminr_options['enable_wp_comments'] = ($_POST['enable_wp_comments'] == 'true' ? true : false); 
     150                $wp_iminr_options['enable_wp_comment_posts'] = ($_POST['enable_wp_comment_posts'] == 'true' ? true : false); 
     151                $wp_iminr_options['enable_wp_comment_authors'] = ($_POST['enable_wp_comment_authors'] == 'true' ? true : false); 
     152                $wp_iminr_options['enable_wp_trackbacks'] = ($_POST['enable_wp_trackbacks'] == 'true' ? true : false); 
     153                $wp_iminr_options['enable_wp_trackback_posts'] = ($_POST['enable_wp_trackback_posts'] == 'true' ? true : false); 
     154                $wp_iminr_options['enable_wp_trackback_domains'] = ($_POST['enable_wp_trackback_domains'] == 'true' ? true : false); 
     155                 
    136156                update_option('wp_iminr_options', $wp_iminr_options); 
    137157                 
     
    140160        } 
    141161        ?> 
    142 <div class=wrap
    143         <form method="post"> 
     162<div class="wrap"
     163        <form action="" method="post"> 
    144164                <h2><?php _e('iMinR for WordPress'); ?></h2> 
    145                 <fieldset class="options" name="general"> 
     165                <fieldset class="options" id="general"> 
    146166                <legend><?php _e('General settings', 'wp_iminr') ?></legend> 
    147167                 
    148168                <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
    149169                        <tr> 
    150                                 <th nowrap valign="top"><label for="account_id"><?php _e('Account ID', 'wp_iminr') ?></label></th> 
     170                                <th valign="top" style="white-space: nowrap"><label for="account_id"><?php _e('Account ID', 'wp_iminr') ?></label></th> 
    151171                                <td valign="top"> 
    152172                                        <input type="text" name="account_id" id="account_id" value="<?php echo wp_iminr_get_option('account_id'); ?>" size="50" /> 
     
    157177                 
    158178                </fieldset> 
    159                 <fieldset class="options" name="integration"> 
     179                <fieldset class="options" id="integration"> 
    160180                        <legend><?php _e('Tracker integration', 'wp_iminr') ?></legend> 
    161181                        <p><?php _e('Enable tracker inclusion or copy this code in your template to activate iMinR for this site: <code>&lt;?php iMinR(); ?></code> ', 'wp_iminr') ?></p> 
    162                          
     182 
    163183                        <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
    164184                                <tr> 
    165                                         <th nowrap valign="top"><label for="enable_tracker"><?php _e('Enable tracker', 'wp_iminr') ?></label></th> 
    166                                         <td valign="top"
     185                                        <th valign="top" style="white-space: nowrap"><label for="enable_tracker"><?php _e('Enable tracker', 'wp_iminr') ?></label></th> 
     186                                        <td valign="top" width="100%"
    167187                                                <input type="checkbox" name="enable_tracker" id="enable_tracker" value="true" <?php if (wp_iminr_get_option('enable_tracker')) echo 'checked="checked"'; ?> /> 
    168188                                                <br /><small><?php _e('By unchecking this checkbox tracker will be not included on the page.', 'wp_iminr') ?></small> 
     
    170190                                </tr> 
    171191                                <tr> 
    172                                         <th nowrap valign="top"><label for="tracker_in_meta"><?php _e('Add in sidebar', 'wp_iminr') ?></label></th> 
    173                                         <td valign="top"
     192                                        <th valign="top" style="white-space: nowrap"><label for="tracker_in_meta"><?php _e('Add in sidebar', 'wp_iminr') ?></label></th> 
     193                                        <td valign="top" width="100%"
    174194                                                <input type="radio" name="tracker_in" id="tracker_in_meta" value="meta" <?php if (wp_iminr_get_option('tracker_in_meta')) echo 'checked="checked"'; ?> /> 
    175195                                                <small><?php _e('By checking this radio button tracker will be included in meta (if template implemente this option).', 'wp_iminr') ?></small> 
    176                                                 <br /><input type="text" name="tracker_in_meta_before" id="tracker_in_meta_before" value="<?php echo wp_iminr_get_option('tracker_in_meta_before'); ?>" size="25" style="text-align: right;" /> 
     196                                                <br /><input type="text" name="tracker_in_meta_before" id="tracker_in_meta_before" value="<?php echo htmlspecialchars(wp_iminr_get_option('tracker_in_meta_before')); ?>" size="25" style="text-align: right;" /> 
    177197                                                <img src="" alt="iMinR" /> 
    178                                                 <input type="text" name="tracker_in_meta_after" id="tracker_in_meta_after" value="<?php echo wp_iminr_get_option('tracker_in_meta_after'); ?>" size="25" /> 
     198                                                <input type="text" name="tracker_in_meta_after" id="tracker_in_meta_after" value="<?php echo htmlspecialchars(wp_iminr_get_option('tracker_in_meta_after')); ?>" size="25" /> 
    179199                                                <br /><small><?php _e('This tags inclose iMinR javascript, useful with logo.', 'wp_iminr') ?></small> 
    180200                                        </td> 
    181201                                </tr> 
    182202                                <tr> 
    183                                         <th nowrap valign="top"><label for="tracker_in_footer"><?php _e('Add in footer', 'wp_iminr') ?></label></th> 
    184                                         <td valign="top"
     203                                        <th valign="top" style="white-space: nowrap"><label for="tracker_in_footer"><?php _e('Add in footer', 'wp_iminr') ?></label></th> 
     204                                        <td valign="top" width="100%"
    185205                                                <input type="radio" name="tracker_in" id="tracker_in_footer" value="footer" <?php if (wp_iminr_get_option('tracker_in_footer')) echo 'checked="checked"'; ?> /> 
    186206                                                <small><?php _e('By checking this radio button tracker will be included in footer.', 'wp_iminr') ?></small> 
    187207                                                <br /> 
    188                                                 <input type="text" name="tracker_in_footer_before" id="tracker_in_footer_before" value="<?php echo wp_iminr_get_option('tracker_in_footer_before'); ?>" size="25" style="text-align: right;" /> 
     208                                                <input type="text" name="tracker_in_footer_before" id="tracker_in_footer_before" value="<?php echo htmlspecialchars(wp_iminr_get_option('tracker_in_footer_before')); ?>" size="25" style="text-align: right;" /> 
    189209                                                <img src="" alt="iMinR" /> 
    190                                                 <input type="text" name="tracker_in_footer_after" id="tracker_in_footer_after" value="<?php echo wp_iminr_get_option('tracker_in_footer_after'); ?>" size="25" /> 
     210                                                <input type="text" name="tracker_in_footer_after" id="tracker_in_footer_after" value="<?php echo htmlspecialchars(wp_iminr_get_option('tracker_in_footer_after')); ?>" size="25" /> 
    191211                                                <br /><small><?php _e('This tags inclose iMinR javascript, useful with logo.', 'wp_iminr') ?></small> 
    192212                                        </td> 
    193213                                </tr> 
    194214                                <tr> 
    195                                         <th nowrap valign="top"><?php _e('Desable for roles', 'wp_iminr') ?></th> 
    196                                         <td valign="top"
     215                                        <th valign="top" style="white-space: nowrap"><?php _e('Desable for roles', 'wp_iminr') ?></th> 
     216                                        <td valign="top" width="100%"
    197217                                                <select name="desable_for_roles[]" id="desable_for_roles" multiple="multiple"> 
    198218                                                <?php wp_iminr_roles_options_for_select(wp_iminr_get_option('desable_for_roles')); ?> 
    199219                                                </select> 
    200220                                                <br /><small><?php _e('Desable tracker for selected roles. Use CTRL+Click to select multiple entries', 'wp_iminr') ?></small> 
    201                                                 <?php 
    202                                                 ?> 
    203                                         </td> 
    204                                 </tr> 
     221                                        </td> 
    205222                        </table> 
    206223                 
    207224                </fieldset> 
    208                  
    209           <div class="submit"> 
     225                <fieldset class="options" id="variables"> 
     226                        <legend><?php _e('Enable statistics for comment', 'wp_iminr') ?></legend> 
     227                        <p><?php _e('Create variables with iMinR interface before checking the checkbox.', 'wp_iminr') ?></p> 
     228                         
     229                        <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
     230                                <tr> 
     231                                        <th valign="top" style="white-space: nowrap"><label for="enable_wp_comments"><?php _e('wp_comments (integer)', 'wp_iminr') ?></label></th> 
     232                                        <td valign="top" width="100%"> 
     233                                                <input type="checkbox" name="enable_wp_comments" id="enable_wp_comments" value="true" <?php if (wp_iminr_get_option('enable_wp_comments')) echo 'checked="checked"'; ?> /> 
     234                                                <br /><small><?php _e('Comment count', 'wp_iminr') ?></small> 
     235                                        </td> 
     236                                </tr> 
     237                                <tr> 
     238                                        <th valign="top" style="white-space: nowrap"><label for="enable_wp_comment_posts"><?php _e('wp_comment_posts (text)', 'wp_iminr') ?></label></th> 
     239                                        <td valign="top" width="100%"> 
     240                                                <input type="checkbox" name="enable_wp_comment_posts" id="enable_wp_comment_posts" value="true" <?php if (wp_iminr_get_option('enable_wp_comment_posts')) echo 'checked="checked"'; ?> /> 
     241                                                <br /><small><?php _e('Comment per post', 'wp_iminr') ?></small> 
     242                                        </td> 
     243                                </tr> 
     244                                <tr> 
     245                                        <th valign="top" style="white-space: nowrap"><label for="enable_wp_comment_authors"><?php _e('wp_comment_authors (text)', 'wp_iminr') ?></label></th> 
     246                                        <td valign="top" width="100%"> 
     247                                                <input type="checkbox" name="enable_wp_comment_authors" id="enable_wp_comment_authors" value="true" <?php if (wp_iminr_get_option('enable_wp_comment_authors')) echo 'checked="checked"'; ?> /> 
     248                                                <br /><small><?php _e('Comment pet author', 'wp_iminr') ?></small> 
     249                                        </td> 
     250                                </tr> 
     251                                <tr> 
     252                                        <th valign="top" style="white-space: nowrap"><label for="enable_wp_trackbacks"><?php _e('wp_trackbacks (integer)', 'wp_iminr') ?></label></th> 
     253                                        <td valign="top" width="100%"> 
     254                                                <input type="checkbox" name="enable_wp_trackbacks" id="enable_wp_trackbacks" value="true" <?php if (wp_iminr_get_option('enable_wp_trackbacks')) echo 'checked="checked"'; ?> /> 
     255                                                <br /><small><?php _e('Trackback/Pingback count', 'wp_iminr') ?></small> 
     256                                        </td> 
     257                                </tr> 
     258                                <tr> 
     259                                        <th valign="top" style="white-space: nowrap"><label for="enable_wp_trackback_posts"><?php _e('wp_trackback_posts (text)', 'wp_iminr') ?></label></th> 
     260                                        <td valign="top" width="100%"> 
     261                                                <input type="checkbox" name="enable_wp_trackback_posts" id="enable_wp_trackback_posts" value="true" <?php if (wp_iminr_get_option('enable_wp_trackback_posts')) echo 'checked="checked"'; ?> /> 
     262                                                <br /><small><?php _e('Trackback/Pingback per post', 'wp_iminr') ?></small> 
     263                                        </td> 
     264                                </tr> 
     265                                <tr> 
     266                                        <th valign="top" style="white-space: nowrap"><label for="enable_wp_trackback_domains"><?php _e('wp_trackback_domains (text)', 'wp_iminr') ?></label></th> 
     267                                        <td valign="top" width="100%"> 
     268                                                <input type="checkbox" name="enable_wp_trackback_domains" id="enable_wp_trackback_domains" value="true" <?php if (wp_iminr_get_option('enable_wp_trackback_domains')) echo 'checked="checked"'; ?> /> 
     269                                                <br /><small><?php _e('Trackback/Pingback per domain', 'wp_iminr') ?></small> 
     270                                        </td> 
     271                                </tr> 
     272                        </table> 
     273                 
     274                </fieldset> 
     275                 
     276                <div class="submit"> 
    210277                        <input type="submit" name="info_update" value="<?php _e('Update options', 'wp_iminr') ?>" /> 
    211278                </div></form>