| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | class wp_slimstat_ex_options { |
|---|
| 4 | var $page, $wpssop, $url, $pinpage, $adminpage, $exclusionpage, $admin_url; |
|---|
| 5 | |
|---|
| 6 | function wp_slimstat_ex_options() { |
|---|
| 7 | global $SlimCfg; |
|---|
| 8 | $this->page = $_GET['page']; |
|---|
| 9 | $this->wpssop = isset($_GET['wpssop']) ? $_GET['wpssop'] : false; |
|---|
| 10 | $this->url = 'options-general.php?page=wp-slimstat-ex-options'; |
|---|
| 11 | $this->admin_url = get_option('siteurl') . '/wp-content/plugins/' . $SlimCfg->basedir . '/lib/ss-admin'; |
|---|
| 12 | $this->pinpage = $this->wpssop == 'pin'; |
|---|
| 13 | $this->adminpage = $this->wpssop == 'admin'; |
|---|
| 14 | $this->exclusionpage = $this->wpssop == 'exclusion'; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | function update_options() { |
|---|
| 18 | global $SlimCfg; |
|---|
| 19 | if(!$this->wpssop) { |
|---|
| 20 | if ( !isset($_POST['ssex_op']) || !is_array($_POST['ssex_op']) )// Main Options |
|---|
| 21 | return; |
|---|
| 22 | $intvals = array( 'tracking', 'usepins', 'guesstitle', 'cachelimit', 'limitrows', 'dbmaxage', 'iptohost', 'whois', 'meta', 'time_offset', 'use_ajax', 'nice_titles' ); |
|---|
| 23 | foreach($_POST['ssex_op'] as $key=>$value) { |
|---|
| 24 | $SlimCfg->option[$key] = (in_array($key, $intvals)) ? (int)$value : stripslashes(trim($value)); |
|---|
| 25 | } |
|---|
| 26 | update_option('wp_slimstat_ex', $SlimCfg->option); |
|---|
| 27 | echo '<div id="message" class="updated fade"><p>'.__('Wp-SlimStat-Ex options updated', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 28 | } elseif ($this->pinpage) |
|---|
| 29 | $this->manage_pins(); |
|---|
| 30 | elseif ($this->exclusionpage) |
|---|
| 31 | $this->manage_exclusions(); |
|---|
| 32 | elseif ($this->adminpage) |
|---|
| 33 | $this->manage_admin_options(); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | function manage_admin_options() { |
|---|
| 37 | if ( isset($_POST['do_reimport']) ) { |
|---|
| 38 | require(SLIMSTATPATH . 'lib/setup.php'); |
|---|
| 39 | $rebuild = SSSetup::rebuild_iptc_db(); |
|---|
| 40 | if($rebuild) |
|---|
| 41 | echo '<div id="message" class="updated fade"><p>'.__('ip-to-country data imported successfully.', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 42 | else |
|---|
| 43 | echo '<div id="message" class="updated fade"><p>'.__('Failed to import ip-to-country data.', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 44 | } |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | function manage_exclusions() { |
|---|
| 48 | global $SlimCfg; |
|---|
| 49 | if ( isset($_POST['ig_op']) && is_array($_POST['ig_op']) ) { |
|---|
| 50 | $checkboxes = array('ig_bots', 'ig_feeds', 'ig_validators', 'ig_tools'); |
|---|
| 51 | foreach($checkboxes as $box) |
|---|
| 52 | $SlimCfg->exclude[$box] = isset($_POST['ig_op'][$box]); |
|---|
| 53 | $intvals = array('ignore_bots'); |
|---|
| 54 | foreach($_POST['ig_op'] as $key=>$value) { |
|---|
| 55 | if(!in_array($key, $checkboxes)) |
|---|
| 56 | $SlimCfg->exclude[$key] = (in_array($key, $intvals))?(int)$value:stripslashes(trim($value)); |
|---|
| 57 | } |
|---|
| 58 | update_option('wp_slimstat_ex_exclude', $SlimCfg->exclude); |
|---|
| 59 | echo '<div id="message" class="updated fade"><p>'.__('Wp-SlimStat-Ex options updated', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 60 | } |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | function manage_pins() { |
|---|
| 64 | global $SlimCfg, $wpdb; |
|---|
| 65 | if ( isset($_GET["pinact"]) && $_GET["pinact"] != '' ) { |
|---|
| 66 | $pin_id = (int)$_GET['pinid']; |
|---|
| 67 | $pin_active = (int)$_GET['pinact']; |
|---|
| 68 | |
|---|
| 69 | // require_once(SLIMSTATPATH . 'lib/pins.php'); |
|---|
| 70 | $pin = SSPins::getPin($pin_id); |
|---|
| 71 | if(!$pin) { |
|---|
| 72 | echo '<div id="message" class="updated fade"><p>'.__('Invalid Pin ID.', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 73 | return; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | $pin_file = SLIMSTATPATH . 'pins/'.$pin->name.'/pin.php'; |
|---|
| 77 | if(!file_exists($pin_file)) { |
|---|
| 78 | SSPins::delete_pin("`id` = $pin->id"); |
|---|
| 79 | echo '<div id="message" class="updated fade"><p>'.__('Pin file does not exists.', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 80 | return; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | if($pin_active) { |
|---|
| 84 | if($pin->active) { |
|---|
| 85 | echo '<div id="message" class="updated fade"><p>'.__('Pin already activated.', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 86 | return; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | $default_compatible = SSPins::pin_compatible(); |
|---|
| 90 | |
|---|
| 91 | ob_start(); |
|---|
| 92 | @include_once($pin_file); |
|---|
| 93 | if(!class_exists($pin->name)) { |
|---|
| 94 | ob_end_clean(); |
|---|
| 95 | echo '<div id="message" class="updated fade"><p>'.$default_compatible['message'].'</p></div>'; |
|---|
| 96 | return; |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | eval('$temp_pin = new $pin->name();'); |
|---|
| 100 | if('SSPins' != get_parent_class($temp_pin)) { |
|---|
| 101 | ob_end_clean(); |
|---|
| 102 | echo '<div id="message" class="updated fade"><p>'.$default_compatible['message'].'</p></div>'; |
|---|
| 103 | return; |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | $compatible = $temp_pin->pin_compatible(); |
|---|
| 107 | if(!$compatible['compatible']) { |
|---|
| 108 | ob_end_clean(); |
|---|
| 109 | if(isset($compatible['message']) && !empty($compatible['message'])) |
|---|
| 110 | echo '<div id="message" class="updated fade"><p>'.$compatible['message'].'</p></div>'; |
|---|
| 111 | else |
|---|
| 112 | echo '<div id="message" class="updated fade"><p>'.$default_compatible['message'].'</p></div>'; |
|---|
| 113 | return; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | $actions = $temp_pin->pin_actions(); |
|---|
| 117 | if( $actions['extra_table'] && isset($temp_pin->extra_table) && |
|---|
| 118 | is_array($temp_pin->extra_table) && !empty($temp_pin->extra_table)) {// dobule check if Pin really needs extra table |
|---|
| 119 | $create_table = SSPins::maybe_create_extra_table($temp_pin->extra_table); |
|---|
| 120 | if(!$create_table) { |
|---|
| 121 | ob_end_clean(); |
|---|
| 122 | echo '<div id="message" class="updated fade"><p>'.__('Failed to activate Pin', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 123 | return; |
|---|
| 124 | } |
|---|
| 125 | } |
|---|
| 126 | $temp_pin->activate_action(); |
|---|
| 127 | ob_end_clean(); |
|---|
| 128 | } else { |
|---|
| 129 | if(!$pin->active) { |
|---|
| 130 | echo '<div id="message" class="updated fade"><p>'.__('Pin already deactivated.', 'wp-slimstat-ex').'</p></div>'; |
|---|
| 131 | return; |
|---|
| 132 | } |
|---|
| 133 | ob_start(); |
|---|
| 134 | @include_once($pin_file); |
|---|
| 135 | if(class_exists($pin->name)) { |
|---|
| 136 | eval('$temp_pin = new $pin->name();'); |
|---|
| 137 | if('SSPins' == get_parent_class($temp_pin)) |
|---|
| 138 | $temp_pin->deactivate_action(); |
|---|
| 139 | } |
|---|
| 140 | ob_end_clean(); |
|---|
| 141 | } |
|---|
| 142 | $query = "UPDATE $SlimCfg->table_pins SET active = $pin_active WHERE id = $pin_id LIMIT 1"; |
|---|
| 143 | if($wpdb->query($query) !== false) { |
|---|
| 144 | if($pin_active) |
|---|
| 145 | $message = __('Pin activated', 'wp-slimstat-ex'); |
|---|
| 146 | else |
|---|
| 147 | $message = __('Pin deactivated', 'wp-slimstat-ex'); |
|---|
| 148 | } else { |
|---|
| 149 | if($pin_active) |
|---|
| 150 | $message = __('Failed to activate Pin', 'wp-slimstat-ex'); |
|---|
| 151 | else |
|---|
| 152 | $message = __('Failed to deactivate Pin', 'wp-slimstat-ex'); |
|---|
| 153 | } |
|---|
| 154 | echo '<div id="message" class="updated fade"><p>'.$message.'</p></div>'; |
|---|
| 155 | return; |
|---|
| 156 | } |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | function nav_bar() { |
|---|
| 160 | global $SlimCfg; |
|---|
| 161 | ?> |
|---|
| 162 | <div id="wpssoptionselector" style="font-size:18px;"> |
|---|
| 163 | <?php |
|---|
| 164 | echo ' |
|---|
| 165 | <span>'.($this->wpssop ? '<a href="'.$this->url.'" title="'.__('General Options').'">':'').__('General Options', 'wp-slimstat-ex').($this->wpssop ? '</a>':'').'</span> | '; |
|---|
| 166 | if($SlimCfg->option['usepins']) { |
|---|
| 167 | echo ' |
|---|
| 168 | <span>'.(!$this->pinpage ?'<a href="'.$this->url.'&wpssop=pin" title="'.__('Pins', 'wp-slimstat-ex').'">':'').__('Pins', 'wp-slimstat-ex').(!$this->pinpage ? '</a>':'').'</span> | '; |
|---|
| 169 | } |
|---|
| 170 | echo ' |
|---|
| 171 | <span>'.(!$this->exclusionpage ?'<a href="'.$this->url.'&wpssop=exclusion" title="'.__('Exclusions', 'wp-slimstat-ex').'">':'').__('Exclusions', 'wp-slimstat-ex').(!$this->exclusionpage ? '</a>':'').'</span> | '; |
|---|
| 172 | echo ' |
|---|
| 173 | <span>'.(!$this->adminpage ?'<a href="'.$this->url.'&wpssop=admin" title="'.__('SlimStat-Admin', 'wp-slimstat-ex').'">':'').__('SlimStat-Admin', 'wp-slimstat-ex').(!$this->adminpage ? '</a>':'').'</span>'; |
|---|
| 174 | ?> |
|---|
| 175 | </div> |
|---|
| 176 | <br /> |
|---|
| 177 | <?php |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | function options_page() { |
|---|
| 181 | global $SlimCfg; |
|---|
| 182 | $this->update_options(); |
|---|
| 183 | if ($SlimCfg->option['update_check'] && ($remote = $SlimCfg->version_check()) == 1 ) { |
|---|
| 184 | echo '<div id="message" class="updated fade"><p><a href="'.$SlimCfg->plugin_home.'">'.__('There is a plugin update available', 'wp-slimstat-ex').'</a></p></div>'; |
|---|
| 185 | } |
|---|
| 186 | ?> |
|---|
| 187 | <div class="wrap"> |
|---|
| 188 | <h2><?php _e('Wp-SlimStat-Ex', 'wp-slimstat-ex') ?></h2> |
|---|
| 189 | |
|---|
| 190 | <?php $this->nav_bar(); ?> |
|---|
| 191 | |
|---|
| 192 | <?php /********** Main Option Page ***********/ |
|---|
| 193 | if(!$this->wpssop) { ?> |
|---|
| 194 | <form name="slimstat_option" method="post" action="<?php echo $this->url; ?>"> |
|---|
| 195 | <!-- <p class="submit" style="float:right;"><input type="submit" name="update_options" value="<?php _e('Update Options', 'wp-slimstat-ex') ?> »" /></p> --> |
|---|
| 196 | |
|---|
| 197 | <fieldset class="options"> |
|---|
| 198 | <!-- General Options Start --> |
|---|
| 199 | <legend><?php _e('General Options'); ?></legend> |
|---|
| 200 | <table width="100%" cellspacing="2" cellpadding="5" class="editform" id="optiontable1"> |
|---|
| 201 | <tr valign="top"> |
|---|
| 202 | <th width="25%" scope="row"><?php _e('Enable Tracking?:', 'wp-slimstat-ex') ?></th> |
|---|
| 203 | <td><select name="ssex_op[tracking]"> |
|---|
| 204 | <option value="1"<?php if ($SlimCfg->option['tracking']) { ?> selected="selected"<?php } ?>>enable</option> |
|---|
| 205 | <option value="0"<?php if (!$SlimCfg->option['tracking']) { ?> selected="selected"<?php } ?>>disable</option> |
|---|
| 206 | </select><br /> |
|---|
| 207 | <?php _e('— If you want to track blog visitors select "enable"', 'wp-slimstat-ex') ?></td> |
|---|
| 208 | </tr> |
|---|
| 209 | <tr valign="top"> |
|---|
| 210 | <th width="25%" scope="row"><?php _e('Update Check:', 'wp-slimstat-ex') ?></th> |
|---|
| 211 | <td><select name="ssex_op[update_check]"> |
|---|
| 212 | <option value="1"<?php if ($SlimCfg->option['update_check']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 213 | <option value="0"<?php if (!$SlimCfg->option['update_check']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 214 | </select><br /> |
|---|
| 215 | <?php _e('— Automatically check if plugin update is available', 'wp-slimstat-ex') ?></td> |
|---|
| 216 | </tr> |
|---|
| 217 | <tr valign="top"> |
|---|
| 218 | <th width="25%" scope="row"><?php _e('Use Pins?:', 'wp-slimstat-ex') ?></th> |
|---|
| 219 | <td><select name="ssex_op[usepins]"> |
|---|
| 220 | <option value="1"<?php if ($SlimCfg->option['usepins']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 221 | <option value="0"<?php if (!$SlimCfg->option['usepins']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 222 | </select><br /> |
|---|
| 223 | <?php _e('— If you want to use Pins select "true"', 'wp-slimstat-ex') ?></td> |
|---|
| 224 | </tr> |
|---|
| 225 | <tr valign="top"> |
|---|
| 226 | <th width="25%" scope="row"><?php _e('Use AJAX?:', 'wp-slimstat-ex') ?></th> |
|---|
| 227 | <td><select name="ssex_op[use_ajax]"> |
|---|
| 228 | <option value="1"<?php if ($SlimCfg->option['use_ajax']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 229 | <option value="0"<?php if (!$SlimCfg->option['use_ajax']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 230 | </select><br /> |
|---|
| 231 | <?php _e('— Use "AJAX" or not?. Setting it to false will disable some modules.', 'wp-slimstat-ex') ?></td> |
|---|
| 232 | </tr> |
|---|
| 233 | <?php if($SlimCfg->option['use_ajax']) { ?> |
|---|
| 234 | <tr valign="top"> |
|---|
| 235 | <th width="25%" scope="row"><?php echo __('Ajax cache limit:', 'wp-slimstat-ex') ?></th> |
|---|
| 236 | <td><input name="ssex_op[cachelimit]" type="text" value="<?php echo $SlimCfg->option['cachelimit']; ?>" size="3" /> |
|---|
| 237 | <?php echo __('minutes', 'wp-slimstat-ex'); ?><br /> |
|---|
| 238 | <?php echo __('— Cache time of Ajax result page by minutes. (disable cache = 0)', 'wp-slimstat-ex') ?></td> |
|---|
| 239 | </tr> |
|---|
| 240 | <?php } ?> |
|---|
| 241 | <tr valign="top"> |
|---|
| 242 | <th width="25%" scope="row"><?php _e('SQL limit rows:', 'wp-slimstat-ex') ?></th> |
|---|
| 243 | <td><input name="ssex_op[limitrows]" type="text" value="<?php echo $SlimCfg->option['limitrows']; ?>" size="3" /> |
|---|
| 244 | <?php _e('rows', 'wp-slimstat-ex'); ?><br /> |
|---|
| 245 | <?php _e('— Limit rows of each modules', 'wp-slimstat-ex') ?></td> |
|---|
| 246 | </tr> |
|---|
| 247 | <tr valign="top"> |
|---|
| 248 | <th width="25%" scope="row"><?php _e('DB max-age:', 'wp-slimstat-ex') ?></th> |
|---|
| 249 | <td><input name="ssex_op[dbmaxage]" type="text" value="<?php echo $SlimCfg->option['dbmaxage']; ?>" size="3" /> |
|---|
| 250 | <?php _e('days', 'wp-slimstat-ex'); ?><br /> |
|---|
| 251 | <?php _e('— Set database max-age by days (disable reduce DB : 0)', 'wp-slimstat-ex') ?><br /> |
|---|
| 252 | <?php _e('— You can reduce DB from ', 'wp-slimstat-ex') ?>"<a href="<?php echo $this->admin_url; ?>/admin.php">ss-admin</a>"<?php _e(' page', 'wp-slimstat-ex') ?></td> |
|---|
| 253 | </tr> |
|---|
| 254 | </table> |
|---|
| 255 | <!-- General Options End --> |
|---|
| 256 | <!-- Display Options Start --> |
|---|
| 257 | <legend><?php _e('Display Options'); ?></legend> |
|---|
| 258 | <table width="100%" cellspacing="2" cellpadding="5" class="editform" id="optiontable2"> |
|---|
| 259 | <tr valign="top"> |
|---|
| 260 | <th width="25%" scope="row"><?php _e('Visit type:', 'wp-slimstat-ex') ?></th> |
|---|
| 261 | <td><select name="ssex_op[visit_type]"> |
|---|
| 262 | <option value="uniques"<?php if ($SlimCfg->option['visit_type'] == 'uniques') { ?> selected="selected"<?php } ?>>uniques</option> |
|---|
| 263 | <option value="visits"<?php if ($SlimCfg->option['visit_type'] == 'visits') { ?> selected="selected"<?php } ?>>visits</option> |
|---|
| 264 | </select><br /> |
|---|
| 265 | <?php _e('— Select visit type. uniques: count unique ip, visits: 30-minute intervals', 'wp-slimstat-ex') ?></td> |
|---|
| 266 | </tr> |
|---|
| 267 | <tr valign="top"> |
|---|
| 268 | <th width="25%" scope="row"><?php _e('Guess post title?:', 'wp-slimstat-ex') ?></th> |
|---|
| 269 | <td><select name="ssex_op[guesstitle]"> |
|---|
| 270 | <option value="1"<?php if ($SlimCfg->option['guesstitle']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 271 | <option value="0"<?php if (!$SlimCfg->option['guesstitle']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 272 | </select><br /> |
|---|
| 273 | <?php _e('— Get post title from resource(page address)', 'wp-slimstat-ex') ?></td> |
|---|
| 274 | </tr> |
|---|
| 275 | <tr valign="top"> |
|---|
| 276 | <th width="25%" scope="row"><?php _e('Get host name?:', 'wp-slimstat-ex') ?></th> |
|---|
| 277 | <td><select name="ssex_op[iptohost]"> |
|---|
| 278 | <option value="1"<?php if ($SlimCfg->option['iptohost']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 279 | <option value="0"<?php if (!$SlimCfg->option['iptohost']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 280 | </select><br /> |
|---|
| 281 | <?php _e('— Get host name from remote address', 'wp-slimstat-ex') ?>(IP)</td> |
|---|
| 282 | </tr> |
|---|
| 283 | <tr valign="top"> |
|---|
| 284 | <th width="25%" scope="row"><?php _e('Use Whois link?:', 'wp-slimstat-ex') ?></th> |
|---|
| 285 | <td><select name="ssex_op[whois]"> |
|---|
| 286 | <option value="1"<?php if ($SlimCfg->option['whois']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 287 | <option value="0"<?php if (!$SlimCfg->option['whois']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 288 | </select><br /> |
|---|
| 289 | <?php _e('— Use "Whois" link on "Visitors" modules', 'wp-slimstat-ex') ?></td> |
|---|
| 290 | </tr> |
|---|
| 291 | </table> |
|---|
| 292 | <!-- Display Options End --> |
|---|
| 293 | <!-- Extra Options Start --> |
|---|
| 294 | <legend><?php _e('Extra Options'); ?></legend> |
|---|
| 295 | <table width="100%" cellspacing="2" cellpadding="5" class="editform" id="optiontable3"> |
|---|
| 296 | <tr valign="top"> |
|---|
| 297 | <th width="25%" scope="row"><?php _e('Nice Titles:', 'wp-slimstat-ex') ?></th> |
|---|
| 298 | <td><select name="ssex_op[nice_titles]"> |
|---|
| 299 | <option value="1"<?php if ($SlimCfg->option['nice_titles']) { ?> selected="selected"<?php } ?>>true</option> |
|---|
| 300 | <option value="0"<?php if (!$SlimCfg->option['nice_titles']) { ?> selected="selected"<?php } ?>>false</option> |
|---|
| 301 | </select><br /> |
|---|
| 302 | <?php _e('— Enable or disable "Nice Titles". Powered by <a href="http://www.dustindiaz.com/sweet-titles-finalized">SweetTitles</a>', 'wp-slimstat-ex') ?></td> |
|---|
| 303 | </tr> |
|---|
| 304 | <tr valign="top"> |
|---|
| 305 | <th width="25%" scope="row"><?php _e('Your server time is:', 'wp-slimstat-ex') ?></th> |
|---|
| 306 | <td><?php echo date('Y-m-d g:i:s a', time()); ?></td> |
|---|
| 307 | </tr> |
|---|
| 308 | <tr valign="top"> |
|---|
| 309 | <th width="25%" scope="row"><?php _e('Time Offset:', 'wp-slimstat-ex') ?></th> |
|---|
| 310 | <td><input name="ssex_op[time_offset]" type="text" value="<?php echo $SlimCfg->option['time_offset']; ?>" size="3" /> |
|---|
| 311 | <?php _e('hours', 'wp-slimstat-ex'); ?> |
|---|
| 312 | <?php _e('— Time offset from server time by hours.(NOT gmt offset)', 'wp-slimstat-ex') ?></td> |
|---|
| 313 | </tr> |
|---|
| 314 | <tr valign="top"> |
|---|
| 315 | <th width="25%" scope="row"><?php _e('Your blog time is:', 'wp-slimstat-ex') ?></th> |
|---|
| 316 | <td><?php echo date('Y-m-d g:i:s a', (time() + ($SlimCfg->option['time_offset'] * 60 * 60))); ?></td> |
|---|
| 317 | </tr> |
|---|
| 318 | </table> |
|---|
| 319 | <!-- Extra Options End --> |
|---|
| 320 | </fieldset> |
|---|
| 321 | <p class="submit"> |
|---|
| 322 | <input type="submit" name="update_options" value="<?php _e('Update Options', 'wp-slimstat-ex') ?> »" /> |
|---|
| 323 | </p> |
|---|
| 324 | </form> |
|---|
| 325 | <?php |
|---|
| 326 | } /********** Pin Option Page ***********/ |
|---|
| 327 | elseif( $SlimCfg->option['usepins'] && $this->pinpage ) { |
|---|
| 328 | $_optin_page = $this->option_pins(); |
|---|
| 329 | } /********** Exclusion Option Page ***********/ |
|---|
| 330 | elseif($this->exclusionpage) { |
|---|
| 331 | $_optin_page = $this->option_exclusions(); |
|---|
| 332 | } /********** Admin Option Page ***********/ |
|---|
| 333 | elseif($this->adminpage) { |
|---|
| 334 | $_optin_page = $this->option_admin(); |
|---|
| 335 | } |
|---|
| 336 | ?> |
|---|
| 337 | </div><!-- wrap --> |
|---|
| 338 | <?php |
|---|
| 339 | } |
|---|
| 340 | |
|---|
| 341 | function option_pins() { |
|---|
| 342 | global $SlimCfg; |
|---|
| 343 | // require_once(SLIMSTATPATH . 'lib/pins.php'); |
|---|
| 344 | SSPins::findPins(); |
|---|
| 345 | $pins = SSPins::_getPins(0,5,true);// get all pins |
|---|
| 346 | ?> |
|---|
| 347 | <fieldset class="options"> |
|---|
| 348 | <legend><?php _e('Pins', 'wp-slimstat-ex') ?></legend> |
|---|
| 349 | <?php |
|---|
| 350 | if ( empty($pins) ) { |
|---|
| 351 | echo '<p>There is no Pins available</p>'; |
|---|
| 352 | } else { |
|---|
| 353 | ?> |
|---|
| 354 | <table width="100%" cellpadding="3" cellspacing="3"> |
|---|
| 355 | <tr> |
|---|
| 356 | <th class="vers"><?php _e('ID', 'wp-slimstat-ex'); ?></th> |
|---|
| 357 | <th class="name"><?php _e('Name (version)', 'wp-slimstat-ex'); ?></th> |
|---|
| 358 | <th class="vers"><?php _e('Author', 'wp-slimstat-ex'); ?></th> |
|---|
| 359 | <th class="desc"><?php _e('Description', 'wp-slimstat-ex'); ?></th> |
|---|
| 360 | <th class="togl"><?php _e('Acitve', 'wp-slimstat-ex'); ?></th> |
|---|
| 361 | </tr> |
|---|
| 362 | <?php |
|---|
| 363 | $alt = ''; |
|---|
| 364 | $get_page = $_GET['page']; |
|---|
| 365 | foreach($pins as $pin) { |
|---|
| 366 | $alt = ($alt == ' alternate')?'':' alternate'; |
|---|
| 367 | $class_tr = ($pin->active == 1)?'active':'waitingpin'; |
|---|
| 368 | $class_act = ($pin->active == 1)?'delete':'edit'; |
|---|
| 369 | $act_text = ($pin->active == 1)?__('Deactivate', 'wp-slimstat-ex'):__('Activate', 'wp-slimstat-ex'); |
|---|
| 370 | ?> |
|---|
| 371 | <tr class="<?php echo $class_tr . $alt; ?>"> |
|---|
| 372 | <td class="vers"><?php echo $pin->id; ?></td> |
|---|
| 373 | <td class="name"><?php echo $pin->title . " ( " . $pin->version . " )"; ?></td> |
|---|
| 374 | <td class="vers"><a href="<?php echo $pin->url; ?>" title="Author URL"><?php echo $pin->author; ?></a></td> |
|---|
| 375 | <td class="desc" width="50%"><?php echo $pin->text; ?></td> |
|---|
| 376 | <td class="togl"><a class="<?php echo $class_act; ?>" href="<?php echo $this->url; ?>&wpssop=pin&pinact=<?php echo (($pin->active == 1)?'0':'1'); ?>&pinid=<?php echo $pin->id; ?>"><?php echo $act_text; ?></a></td> |
|---|
| 377 | </tr> |
|---|
| 378 | <?php |
|---|
| 379 | } /* foreach */ |
|---|
| 380 | ?> |
|---|
| 381 | </table> |
|---|
| 382 | </fieldset> |
|---|
| 383 | <?php |
|---|
| 384 | $active_pins = SSPins::_getPins(1,5);// get all active pins |
|---|
| 385 | if(empty($active_pins)) |
|---|
| 386 | return; |
|---|
| 387 | $include_pins = SSPins::_incPins(0);// include all active pins - funtionable pins are already included. |
|---|
| 388 | $i = 0; |
|---|
| 389 | $_opt_pins = array(); |
|---|
| 390 | foreach($active_pins as $pin) { |
|---|
| 391 | if(!class_exists($pin->name)) |
|---|
| 392 | continue; |
|---|
| 393 | eval('$_pin{$i} = new $pin->name();'); |
|---|
| 394 | if(get_parent_class($_pin{$i}) != 'SSPins') |
|---|
| 395 | continue; |
|---|
| 396 | $_pin_opt = $_pin{$i}->pin_actions(); |
|---|
| 397 | if(!$_pin_opt['options']) |
|---|
| 398 | continue; |
|---|
| 399 | $_opt_pins[] = array($_pin{$i}, $pin); |
|---|
| 400 | $i++; |
|---|
| 401 | } |
|---|
| 402 | if(empty($_opt_pins)) |
|---|
| 403 | return; |
|---|
| 404 | ?> |
|---|
| 405 | <hr /> |
|---|
| 406 | <?php SSPins::update_pin_options($_opt_pins); ?> |
|---|
| 407 | <?php SSPins::pin_option_menu_bar($_opt_pins); ?> |
|---|
| 408 | |
|---|
| 409 | <form name="slimstat_pin_options" id="slimstat_pin_options" style="font-size: 86%;" method="post" action="<?php echo $this->url; ?>&wpssop=pin#slimstat_pin_options"> |
|---|
| 410 | <?php |
|---|
| 411 | $first_option = true; |
|---|
| 412 | foreach($_opt_pins as $pin) { |
|---|
| 413 | $display = $first_option ? '' : ' style="display:none;"'; |
|---|
| 414 | $first_option = false; |
|---|
| 415 | ?> |
|---|
| 416 | <fieldset<?php echo $display; ?> class="options" id="pin_option_<?php echo $pin[1]->id; ?>"> |
|---|
| 417 | <legend><?php echo wp_specialchars($pin[1]->title, 1); ?> Options</legend> |
|---|
| 418 | <?php $pin[0]->pin_options(); ?> |
|---|
| 419 | </fieldset> |
|---|
| 420 | <?php |
|---|
| 421 | } |
|---|
| 422 | ?> |
|---|
| 423 | <p class="submit"> |
|---|
| 424 | <input type="submit" name="slimstat_pin_options_submit" value="<?php _e('Update Options »') ?>" /> |
|---|
| 425 | </p> |
|---|
| 426 | </form> |
|---|
| 427 | <?php |
|---|
| 428 | } /* is there any pins? */ |
|---|
| 429 | } |
|---|
| 430 | |
|---|
| 431 | function option_exclusions() { |
|---|
| 432 | global $SlimCfg; |
|---|
| 433 | ?> |
|---|
| 434 | <form name="slimstat_option_exclusion" method="post" action="<?php echo $this->url; ?>&wpssop=exclusion"> |
|---|
| 435 | <fieldset class="options"> |
|---|
| 436 | <!-- Exclusion Options Start --> |
|---|
| 437 | <legend><?php _e('Exclusion Options'); ?></legend> |
|---|
| 438 | <table width="100%" cellspacing="2" cellpadding="5" class="editform" id="optiontable4"> |
|---|
| 439 | <tr valign="top"> |
|---|
| 440 | <th width="25%" scope="row"><?php _e('Ignore IP-List:', 'wp-slimstat-ex') ?></th> |
|---|
| 441 | <td><?php _e('This setting define which remote ip will <em>always</em> not to be tracked.', 'wp-slimstat-ex'); ?><br /> |
|---|
| 442 | <?php _e('Seperate multiple ip with semi-colon( ; )', 'wp-slimstat-ex'); ?><br /><br /> |
|---|
| 443 | <textarea name="ig_op[ignore_ip]" cols="60" rows="4" style="width: 98%; font-size: 12px;"><?php echo wp_specialchars($SlimCfg->exclude['ignore_ip'],true); ?></textarea></td> |
|---|
| 444 | </tr> |
|---|
| 445 | <tr valign="top"> |
|---|
| 446 | <th width="25%" scope="row"><?php _e('Ignore Bots?:', 'wp-slimstat-ex') ?></th> |
|---|
| 447 | |
|---|