/** * IP location API field. * * Field callback, renders a checkbox input, note the name and value. * * @since 2.0.0 */ public function field_ip_location_support() { ?> <label for="ip_location_support"> <input type="checkbox" id="gf_support" name="zerospam_general_settings[ip_location_support]" value="1" <?php if (isset($this->settings['ip_location_support'])) { checked($this->settings['ip_location_support']); } ?> /> <?php echo __('Enabled', 'zerospam'); ?> <p class="description"> <?php echo __('IP location data provided by', 'zerospam'); ?> <a href="http://freegeoip.net/" target="_blank">freegeoip.net</a>. <?php echo __('API usage is limited to 10,000 queries per hour.', 'zerospam'); ?> <br> <?php echo __('Disable this option if you experience slow load times on the', 'zerospam'); ?> <a href="<?php echo zerospam_admin_url() . '?page=zerospam&tab=zerospam_spammer_logs'; ?> "><?php echo __('Spammer Log', 'zerospam'); ?> </a> <?php echo __('page', 'zerospam'); ?> . </p> </label> <?php }
function zerospam_pager($limit = 10, $total_num, $page, $tab) { $max_pages = 11; $num_pages = ceil($total_num / $limit); $cnt = 0; $start = 1; if ($page > 5) { $start = $page - 4; } $pre_html = ''; if (1 != $page) { if (2 != $page) { $pre_html = '<li><a href="' . zerospam_admin_url() . '?page=zerospam&tab=' . $tab . '&p=1"><i class="fa fa-angle-double-left"></i></a>'; } $pre_html .= '<li><a href="' . zerospam_admin_url() . '?page=zerospam&tab=' . $tab . '&p=' . ($page - 1) . '"><i class="fa fa-angle-left"></i></a>'; } echo '<ul class="zero-spam__pager">'; if (isset($pre_html)) { echo $pre_html; } for ($i = $start; $i <= $num_pages; $i++) { $cnt++; if ($cnt >= $max_pages) { break; } if ($num_pages != $page) { $post_html = '<li><a href="' . zerospam_admin_url() . '?page=zerospam&tab=' . $tab . '&p=' . ($page + 1) . '"><i class="fa fa-angle-right"></i></a>'; if ($page + 1 != $num_pages) { $post_html .= '<li><a href="' . zerospam_admin_url() . '?page=zerospam&tab=' . $tab . '&p=1"><i class="fa fa-angle-double-right"></i></a>'; } } $class = ''; if ($page == $i) { $class = ' class="zero-spam__page-selected"'; } echo '<li><a href="' . zerospam_admin_url() . '?page=zerospam&tab=' . $tab . '&p=' . $i . '"' . $class . '>' . $i . '</a>'; } if (isset($post_html)) { echo $post_html; } echo '</ul>'; ?> <div class="zero-spam__page-info"> <?php echo __('Page ', 'zerospam') . number_format($page, 0) . ' of ' . number_format($num_pages, 0); ?> (<?php echo number_format($total_num, 0) . __(' total records found', 'zerospam'); ?> ) </div> <?php }
/** * Add setting link to plugin. * * Applied to the list of links to display on the plugins page (beside the activate/deactivate links). * * @since 2.0.0 * * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name) */ public function plugin_action_links($links) { $link = array('<a href="' . zerospam_admin_url() . '?page=zerospam">' . __('Settings', 'zerospam') . '</a>'); return array_merge($links, $link); }