Version Description
- Initial Release
- Forked from cbnet Ping Optimizer plugin version 2.2.5
=
Download this release
Release Info
Developer | chipbennett |
Plugin | cbnet Ping Optimizer |
Version | 2.3 |
Comparing to | |
See all releases |
Version 2.3
- cbnet-ping-optimizer.php +604 -0
- include/OneNote Table Of Contents.onetoc2 +0 -0
- include/images/OneNote Table Of Contents.onetoc2 +0 -0
- include/images/arr_blue1.gif +0 -0
- include/images/arr_green1.gif +0 -0
- include/images/arr_green2.gif +0 -0
- include/images/comment.gif +0 -0
- include/images/delete.gif +0 -0
- include/images/help.gif +0 -0
- include/images/how.gif +0 -0
- include/options-pg.php +46 -0
- include/tooltip.css +16 -0
- include/tooltip.js +74 -0
- readme.txt +67 -0
cbnet-ping-optimizer.php
ADDED
@@ -0,0 +1,604 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Plugin Name: cbnet Ping Optimizer
|
4 |
+
* Plugin URI: http://www.chipbennett.net/wordpress/plugins/cbnet-ping-optimizer/
|
5 |
+
* Description: Saves your wordpress blog from getting tagged as ping spammer. (Note: this plugin is a fork of the cbnet Favicon plugin, with registration/activiation functionality removed.) Adjust settings <a href="options-general.php?page=cbnet-ping-optimizer/cbnet-ping-optimizer.php">here</a>.
|
6 |
+
* Version: 2.3
|
7 |
+
* Author: Chip Bennett
|
8 |
+
* Author URI: http://www.chipbennett.net//
|
9 |
+
*
|
10 |
+
* License: GNU General Public License, v2 (or newer)
|
11 |
+
* License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
+
*
|
13 |
+
* This program is free software; you can redistribute it and/or modify
|
14 |
+
* it under the terms of the GNU General Public License as published by
|
15 |
+
* the Free Software Foundation; either version 2 of the License, or
|
16 |
+
* (at your option) any later version.
|
17 |
+
*
|
18 |
+
* This program was modified from MaxBlogPress Favicon plugin, version 2.2.5,
|
19 |
+
* Copyright (C) 2007 www.maxblogpress.com, released under the GNU General Public License.
|
20 |
+
*/
|
21 |
+
|
22 |
+
define('cbnetpo_NAME', 'cbnet Ping Optimizer'); // Name of the Plugin
|
23 |
+
define('cbnetpo_VERSION', '2.3'); // Current version of the Plugin
|
24 |
+
define("cbnetpo_LOG", true); // Set to 'true' to keep log, else 'false'.
|
25 |
+
|
26 |
+
/**
|
27 |
+
* PingOptimizer - cbnet Ping Optimizer Class
|
28 |
+
* Holds all the necessary functions and variables
|
29 |
+
*/
|
30 |
+
class PingOptimizer
|
31 |
+
{
|
32 |
+
var $cbnetpo_ping_option = 0; // cbnet Ping Optimizer option
|
33 |
+
var $cbnetpo_ping_sites = ''; // cbnet Ping Optimizer pinging URLs
|
34 |
+
var $cbnetpo_future_pings = array(); // List of future posts to be pinged
|
35 |
+
var $cbnetpo_future_ping_time = ''; // Last updated time for future ping
|
36 |
+
var $cbnetpo_current_date = ''; // Holds the current date and time
|
37 |
+
var $cbnetpo_post_title = ""; // Title of the post
|
38 |
+
var $cbnetpo_edited = ""; // Set if post is edited
|
39 |
+
var $cbnetpo_pvt_to_pub = ""; // Set if post status changes from private to published
|
40 |
+
var $cbnetpo_max_log = 1000; // Maximum lines of log data to be stored
|
41 |
+
var $cbnetpo_rows_to_show = 35; // Number of log rows to be displayed in options page
|
42 |
+
var $cbnetpo_pinglog_tbl = 'mbp_ping_optimizer'; // Ping log table
|
43 |
+
// Pinging action/type
|
44 |
+
var $cbnetpo_type = array(1 => 'none', 2 => 'new', 3 => 'future', 4 => 'forced', 5 => 'edited', 6 => 'disabled', 7 => 'noservices', 8 => 'excessive');
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Constructor. Add cbnet Ping Optimizer plugin actions/filters and gets the user defined options.
|
48 |
+
* Also removes the default WordPress pinging services.
|
49 |
+
*/
|
50 |
+
function PingOptimizer() {
|
51 |
+
global $wp_version, $table_prefix;
|
52 |
+
$this->cbnetpo_pinglog_tbl = $table_prefix.$this->cbnetpo_pinglog_tbl;
|
53 |
+
$this->cbnetpo_siteurl = get_bloginfo('wpurl');
|
54 |
+
$this->cbnetpo_siteurl = (strpos($this->cbnetpo_siteurl,'http://') === false) ? get_bloginfo('siteurl') : $this->cbnetpo_siteurl;
|
55 |
+
$this->cbnetpo_path = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
|
56 |
+
$this->cbnetpo_path = str_replace('\\','/',$this->cbnetpo_path);
|
57 |
+
$this->cbnetpo_fullpath = $this->cbnetpo_siteurl.'/wp-content/plugins/'.substr($this->cbnetpo_path,0,strrpos($this->cbnetpo_path,'/')).'/';
|
58 |
+
$this->cbnetpo_incpath = $this->cbnetpo_fullpath.'include/';
|
59 |
+
$this->cbnetpo_abspath = str_replace("\\","/",ABSPATH);
|
60 |
+
$this->img_how = '<img src="'.$this->cbnetpo_incpath.'images/how.gif" border="0" align="absmiddle">';
|
61 |
+
$this->img_comment = '<img src="'.$this->cbnetpo_incpath.'images/comment.gif" border="0" align="absmiddle">';
|
62 |
+
$this->cbnetpo_wp_version = $wp_version.
|
63 |
+
|
64 |
+
add_action('activate_'.$this->cbnetpo_path, array(&$this, 'cbnetpoActivate'));
|
65 |
+
add_action('deactivate_'.$this->cbnetpo_path, array(&$this, 'cbnetpoDeactivate'));
|
66 |
+
add_action('admin_menu', array(&$this, 'cbnetpoAddMenu'));
|
67 |
+
add_action('wp_head', array(&$this, 'cbnetpoFuturePing'));
|
68 |
+
add_filter('title_save_pre', array(&$this, 'cbnetpoGetPostTitle'));
|
69 |
+
add_action('edit_post', array(&$this, 'cbnetpoEditPost'));
|
70 |
+
add_action('private_to_published', array(&$this, 'cbnetpoPrivateToPublished'));
|
71 |
+
add_action('save_post', array(&$this, 'cbnetpoPing'));
|
72 |
+
add_action("delete_post", array(&$this, 'cbnetpoFuturePingDelete'));
|
73 |
+
do_action('cbnetpo_ping', $post_title, $post_type);
|
74 |
+
add_action('cbnetpo_ping', array(&$this, 'cbnetpoPingServices'), 5, 2);
|
75 |
+
remove_action('do_pings', 'do_all_pings');
|
76 |
+
remove_action("publish_post", "generic_ping");
|
77 |
+
|
78 |
+
$this->cbnetpo_current_date = current_time('mysql');
|
79 |
+
$this->cbnetpo_ping_sites = get_option("ping_sites");
|
80 |
+
$this->cbnetpo_ping_option = get_option('cbnetpo_ping_optimizer');
|
81 |
+
$this->cbnetpo_future_pings = get_option('cbnetpo_future_pings');
|
82 |
+
$this->cbnetpo_options = get_option('cbnetpo_options');
|
83 |
+
if ( $this->cbnetpo_wp_version < 2.1 ) {
|
84 |
+
if( !is_array($this->cbnetpo_future_pings) ) {
|
85 |
+
$this->cbnetpo_future_pings = array();
|
86 |
+
}
|
87 |
+
if( !$this->cbnetpo_future_ping_time = get_option('cbnetpo_future_ping_time') ) {
|
88 |
+
$this->cbnetpo_future_ping_time = date('Y-m-d-H-i-s');
|
89 |
+
}
|
90 |
+
}
|
91 |
+
// Check if ping limit reached
|
92 |
+
if ( $this->cbnetpo_options['limit_ping'] == 1 ) {
|
93 |
+
$last_ping_time = get_option('cbnetpo_last_ping_time');
|
94 |
+
$curr_time = current_time('mysql');
|
95 |
+
$limit_time = $this->cbnetpo_options['limit_time'] * 60;
|
96 |
+
$limit_number = $this->cbnetpo_options['limit_number'];
|
97 |
+
$_last_ping_time = intval(strtotime($last_ping_time));
|
98 |
+
$_curr_time = intval(strtotime($curr_time));
|
99 |
+
$cbnetpo_ping_num = get_option('cbnetpo_ping_num');
|
100 |
+
if ( $_last_ping_time <= 0 ) $_last_ping_time = $_curr_time;
|
101 |
+
if ( ($limit_time >= ($_curr_time - $_last_ping_time)) && ($cbnetpo_ping_num >= $limit_number) ) {
|
102 |
+
$this->excessive_pinging = 1;
|
103 |
+
} else {
|
104 |
+
if ( $cbnetpo_ping_num >= $limit_number ) update_option('cbnetpo_ping_num',0);
|
105 |
+
$this->excessive_pinging = 0;
|
106 |
+
}
|
107 |
+
} else {
|
108 |
+
$this->excessive_pinging = 0;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Called when plugin is activated. Adds option_value to the options table.
|
114 |
+
*/
|
115 |
+
function cbnetpoActivate() {
|
116 |
+
$default_options = array('cbnetpo_version' => cbnetpo_VERSION, 'limit_ping' => 0, 'limit_number' => 1, 'limit_time' => 15);
|
117 |
+
add_option('cbnetpo_options', $default_options);
|
118 |
+
add_option('cbnetpo_ping_optimizer', 1, 'cbnet Ping Optimizer plugin options', 'no');
|
119 |
+
if ( $this->cbnetpo_wp_version < 2.1 ) {
|
120 |
+
add_option('cbnetpo_future_ping_time', date('Y-m-d-H-i-s'), 'cbnet Ping Optimizer plugin options', 'no');
|
121 |
+
}
|
122 |
+
$this->cbnetpoCreateLogTable();
|
123 |
+
return true;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Called when plugin is deactivated. Deletes cbnet Ping Optimizer option from the options table.
|
128 |
+
*/
|
129 |
+
function cbnetpoDeactivate() {
|
130 |
+
delete_option('cbnetpo_future_ping_time');
|
131 |
+
delete_option('cbnetpo_future_pings');
|
132 |
+
return true;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Creates ping log table
|
137 |
+
* @access public
|
138 |
+
*/
|
139 |
+
function cbnetpoCreateLogTable() {
|
140 |
+
global $wpdb;
|
141 |
+
if ( $wpdb->get_var("show tables like '$this->cbnetpo_pinglog_tbl'") != $this->cbnetpo_pinglog_tbl ) {
|
142 |
+
if ( file_exists(ABSPATH . 'wp-admin/includes/upgrade.php') ) {
|
143 |
+
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
|
144 |
+
} else { // Wordpress <= 2.2
|
145 |
+
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
|
146 |
+
}
|
147 |
+
dbDelta("CREATE TABLE `{$this->cbnetpo_pinglog_tbl}` (
|
148 |
+
`id` int(11) NOT NULL auto_increment,
|
149 |
+
`date_time` datetime NOT NULL,
|
150 |
+
`post_title` text,
|
151 |
+
`log_data` text,
|
152 |
+
`type` tinyint(4) DEFAULT 1,
|
153 |
+
PRIMARY KEY (`id`)
|
154 |
+
);
|
155 |
+
");
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Adds "cbnet Ping Optimizer" link to admin Options menu
|
161 |
+
*/
|
162 |
+
function cbnetpoAddMenu() {
|
163 |
+
add_options_page(cbnetpo_NAME, 'cbnet Ping Optimizer', 'manage_options', $this->cbnetpo_path, array(&$this, 'cbnetpoOptionsPg'));
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Page Header
|
168 |
+
*/
|
169 |
+
function cbnetpoHeader() {
|
170 |
+
echo '<h2>'.cbnetpo_NAME.' '.cbnetpo_VERSION.'</h2>';
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Page Footer
|
175 |
+
*/
|
176 |
+
function cbnetpoFooter() {
|
177 |
+
echo '<p style="text-align:center;margin-top:3em;"><strong>'.cbnetpo_NAME.' '.cbnetpo_VERSION.' by <a href="http://www.chipbennett.net/" target="_blank" >Chip Bennett</a></strong></p>';
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Displays the options page
|
182 |
+
* Carries out all the operations in options page
|
183 |
+
*/
|
184 |
+
function cbnetpoOptionsPg() {
|
185 |
+
global $wpdb;
|
186 |
+
$this->cbnetpo_request = $_REQUEST['cbnetpo'];
|
187 |
+
$msg ='';
|
188 |
+
|
189 |
+
if ( $this->cbnetpo_request['pingnow'] ) {
|
190 |
+
if ( $this->cbnetpo_wp_version >= 2.1 ) {
|
191 |
+
if ( $this->cbnetpo_ping_sites == "" ) {
|
192 |
+
$this->cbnetpoLog("NOT Pinging (no ping sites in services lists)", 7);
|
193 |
+
} else if ( $this->cbnetpo_ping_option != 1 ) {
|
194 |
+
$this->cbnetpoLog("NOT Pinging (disabled by administrator)", 6);
|
195 |
+
} else {
|
196 |
+
// schedule ping for now (forced ping)
|
197 |
+
wp_schedule_single_event(time(), 'cbnetpo_ping', array('',4));
|
198 |
+
}
|
199 |
+
} else {
|
200 |
+
$this->cbnetpoPingServices('',4);
|
201 |
+
}
|
202 |
+
} else if ( $this->cbnetpo_request['save'] ) {
|
203 |
+
$this->cbnetpo_ping_sites = $this->cbnetpo_request['uris'];
|
204 |
+
$this->cbnetpo_ping_option = 0;
|
205 |
+
if ( $this->cbnetpo_request['ping'] == 1 ) {
|
206 |
+
$this->cbnetpo_ping_option = 1;
|
207 |
+
}
|
208 |
+
update_option("cbnetpo_ping_optimizer", $this->cbnetpo_ping_option);
|
209 |
+
update_option("ping_sites", $this->cbnetpo_ping_sites);
|
210 |
+
$this->cbnetpo_options = array('limit_ping' => $this->cbnetpo_request['limit_ping'], 'limit_number' => $this->cbnetpo_request['limit_number'], 'limit_time' => $this->cbnetpo_request['limit_time']);
|
211 |
+
update_option('cbnetpo_options', $this->cbnetpo_options);
|
212 |
+
$msg = 'Options saved.';
|
213 |
+
} else if ( $_GET['d'] == 'yes' ) {
|
214 |
+
$wpdb->query("DELETE FROM $this->cbnetpo_pinglog_tbl");
|
215 |
+
$msg = 'Ping Log Deleted.';
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( $this->cbnetpo_options['limit_ping'] == 1 ) {
|
219 |
+
$limit_ping_chk = 'checked';
|
220 |
+
$limit_ping_display = 'block ';
|
221 |
+
} else {
|
222 |
+
$limit_ping_chk = '';
|
223 |
+
$limit_ping_display = 'none ';
|
224 |
+
}
|
225 |
+
if ( $this->cbnetpo_ping_option == 1 ) $ping_enable_chk = 'checked';
|
226 |
+
else $ping_enable_chk = '';
|
227 |
+
if ( $wpdb->get_var("show tables like '$this->cbnetpo_pinglog_tbl'") != $this->cbnetpo_pinglog_tbl ) {
|
228 |
+
if ( $msg != '' ) $msg .= "<br>";
|
229 |
+
$msg .= "<font color='#ff0000'>Plugin NOT upgraded properly. Please reactivate the plugin.</font>";
|
230 |
+
}
|
231 |
+
if ( trim($msg) != '' ) {
|
232 |
+
echo '<div id="message" class="updated fade"><p><strong>'.$msg.'</strong></p></div>';
|
233 |
+
}
|
234 |
+
require_once('include/options-pg.php');
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Sets flag if post is edited
|
239 |
+
* @param integer $id The Post ID
|
240 |
+
*/
|
241 |
+
function cbnetpoEditPost($id = 0) {
|
242 |
+
if ( $id == 0 ) return;
|
243 |
+
$this->cbnetpo_edited = 1;
|
244 |
+
return $id;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Sets flag if post status changes from private to published
|
249 |
+
* @param integer $id The Post ID
|
250 |
+
*/
|
251 |
+
function cbnetpoPrivateToPublished($id = 0) {
|
252 |
+
if ( $id == 0 ) return;
|
253 |
+
$this->cbnetpo_pvt_to_pub = 1;
|
254 |
+
return $id;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Gets the post title before publishing
|
259 |
+
* @param string $title
|
260 |
+
* @return string $title
|
261 |
+
*/
|
262 |
+
function cbnetpoGetPostTitle($title) {
|
263 |
+
$this->cbnetpo_post_title = $title;
|
264 |
+
return $title;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Formats the date to mm-dd-yyyy format
|
269 |
+
* @param datetime $datetime
|
270 |
+
* @return datetime $datetime. Formatted Date
|
271 |
+
*/
|
272 |
+
function cbnetpoFormatDate($datetime) {
|
273 |
+
if ( $datetime != '' ) {
|
274 |
+
$datetime_parts = explode(' ',$datetime);
|
275 |
+
$date_parts = explode('-',$datetime_parts[0]);
|
276 |
+
$datetime = $date_parts[1].'-'.$date_parts[2].'-'.$date_parts[0].' '.$datetime_parts[1];
|
277 |
+
}
|
278 |
+
return $datetime;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Copy of WP's "generic_ping".
|
283 |
+
* Uses another function to send the actual XML-RPC messages.
|
284 |
+
* @param string $post_title Title of the post
|
285 |
+
* @param integer $post_type Future post or current post
|
286 |
+
*/
|
287 |
+
function cbnetpoPingServices($post_title, $post_type) {
|
288 |
+
global $wpdb;
|
289 |
+
|
290 |
+
$this->already_pinged = array();
|
291 |
+
$this->_post_type = $post_type;
|
292 |
+
if ( strpos($post_title,'~#') !== false ) {
|
293 |
+
$post_id_title = explode('~#',$post_title);
|
294 |
+
$this->_post_title = $post_id_title[1];
|
295 |
+
$this->_post_url = get_permalink($post_id_title[0]);
|
296 |
+
} else {
|
297 |
+
$this->_post_title = $post_title;
|
298 |
+
$this->_post_url = '';
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( $this->cbnetpo_wp_version >= 2.1 ) {
|
302 |
+
// Do pingbacks
|
303 |
+
while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
|
304 |
+
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
|
305 |
+
pingback($ping->post_content, $ping->ID);
|
306 |
+
}
|
307 |
+
// Do Enclosures
|
308 |
+
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
|
309 |
+
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
|
310 |
+
do_enclose($enclosure->post_content, $enclosure->ID);
|
311 |
+
}
|
312 |
+
// Do Trackbacks
|
313 |
+
$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'");
|
314 |
+
if ( is_array($trackbacks) ) {
|
315 |
+
foreach ( $trackbacks as $trackback )
|
316 |
+
do_trackbacks($trackback->ID);
|
317 |
+
}
|
318 |
+
}
|
319 |
+
$services = get_settings('ping_sites');
|
320 |
+
$services = preg_replace("|(\s)+|", '$1', $services);
|
321 |
+
$services = trim($services);
|
322 |
+
if ( '' != $services ) {
|
323 |
+
set_time_limit(300);
|
324 |
+
$services = explode("\n", $services);
|
325 |
+
foreach ($services as $service) {
|
326 |
+
$this->cbnetpoSendXmlrpc($service);
|
327 |
+
}
|
328 |
+
}
|
329 |
+
unset($this->already_pinged);
|
330 |
+
set_time_limit(60);
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* A modified version of WP's ping functionality "weblog_ping" in functions.php
|
335 |
+
* Uses correct extended Ping format and logs response from service.
|
336 |
+
* @param string $server
|
337 |
+
* @param string $path
|
338 |
+
*/
|
339 |
+
function cbnetpoSendXmlrpc($server = '', $path = '') {
|
340 |
+
include_once (ABSPATH . WPINC . '/class-IXR.php');
|
341 |
+
|
342 |
+
// using a timeout of 3 seconds should be enough to cover slow servers
|
343 |
+
$client = new IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path));
|
344 |
+
$client->timeout = 3;
|
345 |
+
$client->useragent .= ' -- WordPress/'.$this->cbnetpo_wp_version;
|
346 |
+
|
347 |
+
// when set to true, this outputs debug messages by itself
|
348 |
+
$client->debug = false;
|
349 |
+
$home = trailingslashit(get_option('home'));
|
350 |
+
$check_url = ($this->_post_url != '') ? $this->_post_url : get_bloginfo('rss2_url');
|
351 |
+
|
352 |
+
if ( !in_array($server,$this->already_pinged) ) {
|
353 |
+
$this->already_pinged[] = $server;
|
354 |
+
///$this->_post_title = $this->_post_title.'###'.$check_url;///
|
355 |
+
// the extendedPing format should be "blog name", "blog url", "check url" (post url), and "feed url",
|
356 |
+
// but it would seem as if the standard has been mixed up. It's therefore good to repeat the feed url.
|
357 |
+
// $this->_post_type = 2 if new post and 3 if future post
|
358 |
+
if ( $client->query('weblogUpdates.extendedPing', get_settings('blogname'), $home, $check_url, get_bloginfo('rss2_url')) ) {
|
359 |
+
$this->cbnetpoLog($server." was successfully pinged (extended format)", $this->_post_type, $this->_post_title);
|
360 |
+
} else {
|
361 |
+
if ( $client->query('weblogUpdates.ping', get_settings('blogname'), $home) ) {
|
362 |
+
$this->cbnetpoLog($server." was successfully pinged", $this->_post_type, $this->_post_title);
|
363 |
+
} else {
|
364 |
+
$this->cbnetpoLog($server." could not be pinged. Error message: \"".$client->error->message."\"", $this->_post_type, $this->_post_title);
|
365 |
+
}
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Pings if the post is published.
|
372 |
+
* Doesn't ping if the post is edited or if future post
|
373 |
+
* @param integer $id The Post ID
|
374 |
+
*/
|
375 |
+
function cbnetpoPing($id) {
|
376 |
+
global $wpdb;
|
377 |
+
|
378 |
+
$row = $wpdb->get_row("SELECT ID,post_date,post_date_gmt,post_modified,post_status FROM $wpdb->posts WHERE id=$id", ARRAY_A);
|
379 |
+
|
380 |
+
if ( $this->cbnetpo_ping_sites != "" ) {
|
381 |
+
if ( $this->cbnetpo_ping_option == 1 ) {
|
382 |
+
// if post is edited and not turned from private/draft to published
|
383 |
+
if ( $this->cbnetpo_edited == 1 && $this->cbnetpo_pvt_to_pub == 0 && $row['post_status'] != 'draft' && $this->cbnetpo_post_title != '' && ($row['post_date'] <= current_time('mysql')) ) {
|
384 |
+
$this->cbnetpoLog("NOT Pinging (%title% was edited)", 5, $this->cbnetpo_post_title);
|
385 |
+
} else if ( $row['post_status'] != 'draft' ) {
|
386 |
+
$post_id_title = $row['ID'].'~#'.$this->cbnetpo_post_title;
|
387 |
+
// if post_date is greater than current time/date then its a future post (don't ping it)
|
388 |
+
if ( ($row['post_date'] > current_time('mysql')) ) {
|
389 |
+
if ( $this->excessive_pinging != 1 ) {
|
390 |
+
if ( $this->cbnetpo_wp_version >= 2.1 ) {
|
391 |
+
// schedule ping for future post
|
392 |
+
wp_schedule_single_event(strtotime($row['post_date_gmt'].' GMT'), 'cbnetpo_ping', array($post_id_title,3));
|
393 |
+
} else {
|
394 |
+
$this->cbnetpo_future_pings[$id] = $id;
|
395 |
+
update_option('cbnetpo_future_pings', $this->cbnetpo_future_pings);
|
396 |
+
}
|
397 |
+
$this->cbnetpoLog("NOT Pinging (future post: %title%). Will ping after ".$this->cbnetpoFormatDate($row['post_date']), 1, $this->cbnetpo_post_title);
|
398 |
+
update_option('cbnetpo_last_ping_time',current_time('mysql'));
|
399 |
+
update_option('cbnetpo_ping_num', get_option('cbnetpo_ping_num')+1);
|
400 |
+
} else {
|
401 |
+
$this->cbnetpoLog("NOT Pinging (Excessive Pinging Limit Reached)", 8);
|
402 |
+
}
|
403 |
+
} else if ( ($this->cbnetpo_pvt_to_pub == 1 || $row["post_status"] == 'publish') && $this->cbnetpo_post_title != '' ) {
|
404 |
+
if ( $this->excessive_pinging != 1 ) {
|
405 |
+
if ( $this->cbnetpo_wp_version >= 2.1 ) {
|
406 |
+
// schedule ping for new post
|
407 |
+
wp_schedule_single_event(time(), 'cbnetpo_ping', array($post_id_title,2));
|
408 |
+
} else {
|
409 |
+
$this->cbnetpoPingServices($post_id_title, 2);
|
410 |
+
}
|
411 |
+
update_option('cbnetpo_last_ping_time',current_time('mysql'));
|
412 |
+
update_option('cbnetpo_ping_num', get_option('cbnetpo_ping_num')+1);
|
413 |
+
} else {
|
414 |
+
$this->cbnetpoLog("NOT Pinging (Excessive Pinging Limit Reached)", 8);
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
} else {
|
419 |
+
if ( $row['post_status'] != 'draft' ) {
|
420 |
+
if ( $this->cbnetpo_edited == 1 && $this->cbnetpo_pvt_to_pub == 0 && $row['post_status'] != 'draft' && $this->cbnetpo_post_title != '' && ($row['post_date'] <= current_time('mysql')) ) {
|
421 |
+
$extra_msg = "It would NOT have pinged even if the ping was enabled.<br><br>Reason: %title% was edited";
|
422 |
+
} else if ( ($row['post_date'] > current_time('mysql')) ) {
|
423 |
+
$extra_msg = "It would have been scheduled for future ping if the ping was enabled.<br><br>Reason: future post %title%";
|
424 |
+
} else if ( ($this->cbnetpo_pvt_to_pub == 1 || $row["post_status"] == 'publish') && $this->cbnetpo_post_title != '' ) {
|
425 |
+
$extra_msg = "It would have pinged if the ping was enabled.<br><br>Reason: new post %title%";
|
426 |
+
}
|
427 |
+
$this->cbnetpoLog("NOT Pinging (disabled by administrator)~^$extra_msg", 6, $this->cbnetpo_post_title);
|
428 |
+
}
|
429 |
+
}
|
430 |
+
} else {
|
431 |
+
if ( $row['post_status'] != 'draft' ) {
|
432 |
+
if ( $this->cbnetpo_edited == 1 && $this->cbnetpo_pvt_to_pub == 0 && $row['post_status'] != 'draft' && $this->cbnetpo_post_title != '' && ($row['post_date'] <= current_time('mysql')) ) {
|
433 |
+
$extra_msg = "It would NOT have pinged even if ping sites were available.<br><br>Reason: %title% was edited";
|
434 |
+
} else if ( ($row['post_date'] > current_time('mysql')) ) {
|
435 |
+
$extra_msg = "It would have been scheduled for future ping if ping sites were available.<br><br>Reason: future post %title%";
|
436 |
+
} else if ( ($this->cbnetpo_pvt_to_pub == 1 || $row["post_status"] == 'publish') && $this->cbnetpo_post_title != '' ) {
|
437 |
+
$extra_msg = "It would have pinged if ping sites were available.<br><br>Reason: new post %title%";
|
438 |
+
}
|
439 |
+
$this->cbnetpoLog("NOT Pinging (no ping sites in services lists)~^$extra_msg", 7, $this->cbnetpo_post_title);
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Checks if time elasped for future post, and if so, removes post form the ping list and pings
|
446 |
+
* For wordpress versions below 2.1
|
447 |
+
*/
|
448 |
+
function cbnetpoFuturePing() {
|
449 |
+
global $wpdb;
|
450 |
+
|
451 |
+
// future ping list is empty
|
452 |
+
if ( count($this->cbnetpo_future_pings) <= 0 || $this->cbnetpo_wp_version >= 2.1) {
|
453 |
+
return true;
|
454 |
+
}
|
455 |
+
$maxbpddc_data_recent = $this->cbnetpo_future_ping_time;
|
456 |
+
|
457 |
+
// Check last updated date and update it if more than 15 min, and ping if any future post's time elasped
|
458 |
+
$prev_time = $this->cbnetpo_future_ping_time;
|
459 |
+
$prev_time_parts = explode('-',$prev_time);
|
460 |
+
$_prev_time = mktime((int)$prev_time_parts[3], (int)$prev_time_parts[4], (int)$prev_time_parts[5], (int)$prev_time_parts[1], (int)$prev_time_parts[2], (int)$prev_time_parts[0]);
|
461 |
+
$_now_time = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
|
462 |
+
$elapsed_min = ($_now_time-$_prev_time)/(60);
|
463 |
+
$do_ping = 0;
|
464 |
+
|
465 |
+
/// if last update/ping time more than 5 minutes
|
466 |
+
if ( $elapsed_min > 5 ) {
|
467 |
+
if ( is_array($this->cbnetpo_future_pings) ) {
|
468 |
+
foreach ( $this->cbnetpo_future_pings as $id ) {
|
469 |
+
$sql = "SELECT ID,post_date,post_status,post_title FROM $wpdb->posts WHERE id=$id";
|
470 |
+
$row = $wpdb->get_row($sql, ARRAY_A);
|
471 |
+
|
472 |
+
// if future published post later has been changed to draft or other status
|
473 |
+
// then delete it from the ping list (It will be automatically be pinged when its status changes to publish)
|
474 |
+
if ( $row['post_status'] != 'publish' && $row['post_status'] != 'future' ) {
|
475 |
+
unset($this->cbnetpo_future_pings[$id]);
|
476 |
+
}
|
477 |
+
if ( $row["post_date"] <= current_time('mysql') && ($row['post_status'] == 'publish' || $row['post_status'] == 'future') ) {
|
478 |
+
unset($this->cbnetpo_future_pings[$id]);
|
479 |
+
$do_ping = 1;
|
480 |
+
$post_title = $row['post_title'];
|
481 |
+
}
|
482 |
+
}
|
483 |
+
}
|
484 |
+
update_option("cbnetpo_future_pings", $this->cbnetpo_future_pings);
|
485 |
+
update_option('cbnetpo_future_ping_time', date('Y-m-d-H-i-s'));
|
486 |
+
if ( $do_ping == 1 ) {
|
487 |
+
$post_id_title = $row['ID'].'~#'.$post_title;
|
488 |
+
$this->cbnetpoPingServices($post_id_title,3);
|
489 |
+
}
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Deletes post from future ping list if deleted
|
495 |
+
* @param integer $id The Post ID
|
496 |
+
* @return integer $id
|
497 |
+
*/
|
498 |
+
function cbnetpoFuturePingDelete($id) {
|
499 |
+
global $wpdb;
|
500 |
+
if ( $this->cbnetpo_wp_version >= 2.1 ) {
|
501 |
+
$row = $wpdb->get_row("SELECT ID,post_date_gmt,post_title FROM $wpdb->posts WHERE id=$id", ARRAY_A);
|
502 |
+
$post_id_title = $row['ID'].'~#'.$row['post_title'];
|
503 |
+
wp_unschedule_event(strtotime($row['post_date_gmt'].' GMT'), 'cbnetpo_ping', array($post_id_title,2));
|
504 |
+
return $id;
|
505 |
+
}
|
506 |
+
if ( count($this->cbnetpo_future_pings) <= 0 ) {
|
507 |
+
return $id;
|
508 |
+
}
|
509 |
+
unset($this->cbnetpo_future_pings[$id]);
|
510 |
+
update_option('cbnetpo_future_pings', $this->cbnetpo_future_pings);
|
511 |
+
return $id;
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Saves the current plugin action
|
516 |
+
*/
|
517 |
+
function cbnetpoLog($log_data,$type,$post_title='') {
|
518 |
+
global $wpdb;
|
519 |
+
$date_time = $this->cbnetpo_current_date;
|
520 |
+
if ( cbnetpo_LOG == true ) {
|
521 |
+
$query = "INSERT INTO $this->cbnetpo_pinglog_tbl (date_time, post_title, log_data, type)
|
522 |
+
VALUES ('$date_time', '$post_title', '$log_data', '$type')";
|
523 |
+
$wpdb->query($query);
|
524 |
+
}
|
525 |
+
return true;
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Gets log data and displays it
|
530 |
+
* @param integer $total_logs Total lines of log data to be shown
|
531 |
+
* @return string
|
532 |
+
*/
|
533 |
+
function cbnetpoGetLogData() {
|
534 |
+
global $wpdb;
|
535 |
+
$query = "SELECT * FROM $this->cbnetpo_pinglog_tbl ORDER BY date_time DESC";
|
536 |
+
$results = $wpdb->get_results($query,'ARRAY_A');
|
537 |
+
$noof_records = count($results);
|
538 |
+
|
539 |
+
// Delete old records form log table if max limit exceeds
|
540 |
+
if ( $noof_records > $this->cbnetpo_max_log ) {
|
541 |
+
$sql = "SELECT date_time FROM $this->cbnetpo_pinglog_tbl ORDER BY date_time DESC, id DESC LIMIT {$this->cbnetpo_max_log},1";
|
542 |
+
$date_time = $wpdb->get_var($sql);
|
543 |
+
$sql = "DELETE FROM $this->cbnetpo_pinglog_tbl WHERE date_time <= '$date_time'";
|
544 |
+
$wpdb->query($sql);
|
545 |
+
}
|
546 |
+
|
547 |
+
if ( $noof_records <= 0 ) {
|
548 |
+
$exists = 0;
|
549 |
+
$msg = '<br>No ping log recorded yet.';
|
550 |
+
} else {
|
551 |
+
$exists = 1;
|
552 |
+
$ping_data = array();
|
553 |
+
foreach ( (array) $results as $key => $details ) {
|
554 |
+
$ping_data[$details[date_time]][] = array($details['post_title'],$details['log_data'],$details['type']);
|
555 |
+
}
|
556 |
+
$count = 0;
|
557 |
+
foreach ( (array) $ping_data as $ping_date => $_ping_data_arr ) {
|
558 |
+
$ping_date = $this->cbnetpoFormatDate($ping_date);
|
559 |
+
$count++; $cnt = 0;
|
560 |
+
$bgcol = ($count%2 == 0) ? '#f8f8f8' : '#ffffff';
|
561 |
+
foreach ( $_ping_data_arr as $key => $ping_data_arr ) {
|
562 |
+
$ping_data = str_replace('%title%', '"'.$ping_data_arr[0].'"', $ping_data_arr[1]);
|
563 |
+
if ( $ping_data_arr[2] == 2 || $ping_data_arr[2] == 3 || $ping_data_arr[2] == 4 ) {
|
564 |
+
if ( $ping_data_arr[2] == 2 ) { // new post ping
|
565 |
+
$_data = "Pinging (new post: \"$ping_data_arr[0]\")";
|
566 |
+
} else if ( $ping_data_arr[2] == 3 ) { // future post ping
|
567 |
+
$_data = "Pinging (future post appeared in your blog: \"$ping_data_arr[0]\")";
|
568 |
+
} else if ( $ping_data_arr[2] == 4 ) { // forced ping
|
569 |
+
$_data = "Pinging (forced ping)";
|
570 |
+
}
|
571 |
+
if ( strpos($ping_data,'(extended format)') !== false ) {
|
572 |
+
$_ping_data = '<font color="#009207">'.$ping_data.'</font>';
|
573 |
+
} else if ( strpos($ping_data,'Error message:') !== false ) {
|
574 |
+
$_ping_data = '<font color="#FF0000">'.$ping_data.'</font>';
|
575 |
+
} else {
|
576 |
+
$_ping_data = '<font color="#0273A8">'.$ping_data.'</font>';
|
577 |
+
}
|
578 |
+
if ( $cnt == 0 ) $msg .= '<div style="padding:4px;background-color:'.$bgcol.'" id="parent'.$count.'"><b><a style="cursor:hand;cursor:pointer;border-bottom:0px" onclick="cbnetpoShowHide(\'child'.$count.'\',\'img'.$count.'\');"><img src="'.$this->cbnetpo_incpath.'images/arr_green1.gif" id="img'.$count.'" align="absmiddle"> <u>'.$ping_date.'</u></a></b> - '.$_data.'</div><div id="child'.$count.'" style="display:none;">';
|
579 |
+
$msg .= ' » '.$_ping_data.'<br />';
|
580 |
+
$cnt++;
|
581 |
+
if ( count($_ping_data_arr) == $cnt ) $msg .= '<br></div>';
|
582 |
+
} else {
|
583 |
+
if ( strpos($ping_data,'~^') !== false ) {
|
584 |
+
$msg_parts = explode('~^', $ping_data);
|
585 |
+
$msg_part1 = $msg_parts[0];
|
586 |
+
$msg_part2 = htmlspecialchars($msg_parts[1]);
|
587 |
+
$msg .= '<div style="padding:4px;background-color:'.$bgcol.'"><img src="'.$this->cbnetpo_incpath.'images/arr_blue1.gif" align="absmiddle"> <b>'.$ping_date.'</b> - '.$msg_part1;
|
588 |
+
$msg .= ' <a href="#" onMouseover="tooltip(\''.$msg_part2.'\',200)" onMouseout="hidetooltip()" style="border-bottom:none;"><img src="'.$this->cbnetpo_incpath.'images/help.gif" border="0" align="absmiddle" /></a></div>';
|
589 |
+
} else {
|
590 |
+
$msg .= '<div style="padding:4px;background-color:'.$bgcol.'"><img src="'.$this->cbnetpo_incpath.'images/arr_blue1.gif" align="absmiddle"> <b>'.$ping_date.'</b> - '.$ping_data.'</div>';
|
591 |
+
}
|
592 |
+
}
|
593 |
+
}
|
594 |
+
if ( $count >= $this->cbnetpo_rows_to_show ) return array($msg,$exists);
|
595 |
+
}
|
596 |
+
}
|
597 |
+
return array($msg,$exists);
|
598 |
+
}
|
599 |
+
|
600 |
+
|
601 |
+
} // Eof Class
|
602 |
+
|
603 |
+
$PingOptimizer = new PingOptimizer();
|
604 |
+
?>
|
include/OneNote Table Of Contents.onetoc2
ADDED
Binary file
|
include/images/OneNote Table Of Contents.onetoc2
ADDED
Binary file
|
include/images/arr_blue1.gif
ADDED
Binary file
|
include/images/arr_green1.gif
ADDED
Binary file
|
include/images/arr_green2.gif
ADDED
Binary file
|
include/images/comment.gif
ADDED
Binary file
|
include/images/delete.gif
ADDED
Binary file
|
include/images/help.gif
ADDED
Binary file
|
include/images/how.gif
ADDED
Binary file
|
include/options-pg.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript" src="<?php echo $this->cbnet_incpath;?>tooltip.js"></script>
|
2 |
+
<link href="<?php echo $this->cbnet_incpath;?>tooltip.css" rel="stylesheet" type="text/css">
|
3 |
+
<script><!--//
|
4 |
+
function cbnetShowHide(Div,Img) {
|
5 |
+
var divCtrl = document.getElementById(Div);
|
6 |
+
if ( Img != '' ) var theImg = document.getElementById(Img);
|
7 |
+
if ( divCtrl.style == "" || divCtrl.style.display == "none" ) {
|
8 |
+
divCtrl.style.display = "block";
|
9 |
+
if ( Img != '' ) theImg.src = '<?php echo $this->cbnet_incpath;?>images/arr_green2.gif';
|
10 |
+
} else if ( divCtrl.style != "" || divCtrl.style.display == "block" ) {
|
11 |
+
divCtrl.style.display = "none";
|
12 |
+
if ( Img != '' ) theImg.src = '<?php echo $this->cbnet_incpath;?>images/arr_green1.gif';
|
13 |
+
}
|
14 |
+
}//--></script>
|
15 |
+
<div class="wrap">
|
16 |
+
<?php $this->cbnetpoHeader(); ?>
|
17 |
+
<h3><?php _e('URIs to Ping', 'cbnet'); ?></h3>
|
18 |
+
<p>The following services will automatically be pinged when you publish new posts or drafts.
|
19 |
+
<strong>Not</strong> when you publish future posts or edit previously published posts, as WordPress does by default.</p>
|
20 |
+
<p><strong>NB:</strong> This list is synchronized with the <a href="options-writing.php" target="_blank">original update services list</a>.</p>
|
21 |
+
<form method="post">
|
22 |
+
<p><?php _e('Separate multiple service URIs with line breaks:', 'cbnet'); ?><br />
|
23 |
+
<textarea name="cbnet[uris]" cols="60" rows="10"><?php echo $this->cbnet_ping_sites;?></textarea></p>
|
24 |
+
<p><input type="checkbox" name="cbnet[ping]" id="ping_checkbox" value="1" <?php echo $ping_enable_chk;?> /> Enable pinging</p>
|
25 |
+
<p>
|
26 |
+
<input type="checkbox" name="cbnet[limit_ping]" id="limit_ping" value="1" <?php echo $limit_ping_chk;?> onclick="cbnetShowHide('limit_ping_dv','')" /> Limit excessive pinging in short time
|
27 |
+
<span id="limit_ping_dv" style="display:<?php echo $limit_ping_display;?>"> Ping at most <input type="text" name="cbnet[limit_number]" value="<?php echo $this->mpo_options['limit_number'];?>" style="width:25px" maxlength="5" /> time(s) within
|
28 |
+
<input type="text" name="cbnet[limit_time]" value="<?php echo $this->mpo_options['limit_time'];?>" style="width:25px" maxlength="5" /> minute(s)</span>
|
29 |
+
</p>
|
30 |
+
<p>
|
31 |
+
<input type="submit" name="cbnet[save]" value="<?php _e('Save Settings', 'cbnet'); ?>" class="button" />
|
32 |
+
<input type="submit" name="cbnet[pingnow]" value="<?php _e('Ping Now', 'cbnet'); ?>" class="button" onclick="return confirm('Are you sure you want to ping these services now? Pinging too often could get you banned for spamming.');" />
|
33 |
+
</p>
|
34 |
+
</form><br />
|
35 |
+
<?php if ( cbnet_LOG == true ) { ?>
|
36 |
+
<h3><?php _e('Ping Log', 'cbnet'); ?></h3>
|
37 |
+
<p><strong><?php _e('Following are the lastest actions performed by the plugin:', 'cbnet'); ?></strong>
|
38 |
+
<?php
|
39 |
+
list($pinglog,$exists) = $this->cbnetpoGetLogData();
|
40 |
+
echo $pinglog;
|
41 |
+
?>
|
42 |
+
</p>
|
43 |
+
<?php if($exists){?><p><a href="?page=<?php echo $this->cbnet_path;?>&d=yes" onclick="return confirm('All ping log data will be deleted. Are you sure?')" style="color:#FF0000;font-weight:bold"><img src="<?php echo $this->cbnet_incpath;?>images/delete.gif" border="0" align="absmiddle"> Clear Log</a></p><?php }?>
|
44 |
+
<?php } ?>
|
45 |
+
<?php $this->cbnetpoFooter(); ?>
|
46 |
+
</div>
|
include/tooltip.css
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ddctooltip{
|
2 |
+
position: absolute;
|
3 |
+
left: -300px;
|
4 |
+
width: 150px;
|
5 |
+
border: 1px solid black;
|
6 |
+
padding: 2px;
|
7 |
+
background-color: lightyellow;
|
8 |
+
visibility: hidden;
|
9 |
+
z-index: 100;
|
10 |
+
}
|
11 |
+
#ddcpointer{
|
12 |
+
position:absolute;
|
13 |
+
left: -300px;
|
14 |
+
z-index: 101;
|
15 |
+
visibility: hidden;
|
16 |
+
}
|
include/tooltip.js
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var offsetfromcursorX=10
|
2 |
+
var offsetfromcursorY=7
|
3 |
+
var offsetdivfrompointerX=10
|
4 |
+
var offsetdivfrompointerY=14
|
5 |
+
document.write('<div id="ddctooltip"></div>')
|
6 |
+
document.write('<div id="ddcpointer"></div>')
|
7 |
+
var ie=document.all
|
8 |
+
var ns6=document.getElementById && !document.all
|
9 |
+
var enabletip=false
|
10 |
+
if (ie||ns6)
|
11 |
+
var tipobj=document.all? document.all["ddctooltip"] : document.getElementById? document.getElementById("ddctooltip") : ""
|
12 |
+
var pointerobj=document.all? document.all["ddcpointer"] : document.getElementById? document.getElementById("ddcpointer") : ""
|
13 |
+
|
14 |
+
function ietruebody(){
|
15 |
+
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
|
16 |
+
}
|
17 |
+
|
18 |
+
function tooltip(thetext, thewidth, thecolor){
|
19 |
+
if (ns6||ie){
|
20 |
+
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
|
21 |
+
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
|
22 |
+
tipobj.innerHTML=thetext
|
23 |
+
enabletip=true
|
24 |
+
return false
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
function positiontip(e){
|
29 |
+
if (enabletip){
|
30 |
+
var nondefaultpos=false
|
31 |
+
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
|
32 |
+
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
|
33 |
+
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
|
34 |
+
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
|
35 |
+
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
|
36 |
+
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
|
37 |
+
var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
|
38 |
+
if (rightedge<tipobj.offsetWidth){
|
39 |
+
tipobj.style.left=curX-tipobj.offsetWidth+"px"
|
40 |
+
nondefaultpos=true
|
41 |
+
}
|
42 |
+
else if (curX<leftedge)
|
43 |
+
tipobj.style.left="5px"
|
44 |
+
else{
|
45 |
+
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
|
46 |
+
pointerobj.style.left=curX+offsetfromcursorX+"px"
|
47 |
+
}
|
48 |
+
if (bottomedge<tipobj.offsetHeight){
|
49 |
+
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
|
50 |
+
nondefaultpos=true
|
51 |
+
}
|
52 |
+
else{
|
53 |
+
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
|
54 |
+
pointerobj.style.top=curY+offsetfromcursorY+"px"
|
55 |
+
}
|
56 |
+
tipobj.style.visibility="visible"
|
57 |
+
if (!nondefaultpos)
|
58 |
+
pointerobj.style.visibility="visible"
|
59 |
+
else
|
60 |
+
pointerobj.style.visibility="hidden"
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
function hidetooltip(){
|
65 |
+
if (ns6||ie){
|
66 |
+
enabletip=false
|
67 |
+
tipobj.style.visibility="hidden"
|
68 |
+
pointerobj.style.visibility="hidden"
|
69 |
+
tipobj.style.left="-1000px"
|
70 |
+
tipobj.style.backgroundColor=''
|
71 |
+
tipobj.style.width=''
|
72 |
+
}
|
73 |
+
}
|
74 |
+
document.onmousemove=positiontip
|
readme.txt
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== cbnet Ping Optimizer ===
|
2 |
+
Contributors: Chip Bennett
|
3 |
+
Donate link: http://www.chipbennett.net/
|
4 |
+
Tags: cbnet, Ping Optimizer, images, plugin, generator, picture, icon, admin, maxblogpress
|
5 |
+
Requires at least: 2.9
|
6 |
+
Tested up to: 2.9.1
|
7 |
+
Stable tag: 2.3
|
8 |
+
|
9 |
+
Save your wordpress blog from getting tagged as ping spammer. Activation/subscription-free fork of MaxBlogPress Ping Optimizer plugin
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Even the latest version of WordPress (ver. 2.7) has this problem.
|
14 |
+
|
15 |
+
Do you know your WordPress blog pings unnecessarily every time you edit a post? Think how many times you click on "Save and Continue Editing" or "Save" button. Your blog will ping unnecessarily that many times you click on those buttons.
|
16 |
+
|
17 |
+
Save your blog from getting tagged as ping spammer by installing this plugin.
|
18 |
+
|
19 |
+
**After you install cbnet Ping Optimizer:**
|
20 |
+
|
21 |
+
* When you create a new post, your blog will ping and notify all the ping services that it has been updated. This encourages search engines and different blog directories/services to index your updated blog properly.
|
22 |
+
|
23 |
+
* When you edit an existing post, it won't send any unnecessary ping to ping services and saves your blog from getting banned by such services.
|
24 |
+
|
25 |
+
* When you post a future post by editing the time stamp, it will ping only when your post appears in future. It won't unnecessarily ping many times when you schedule posts as WordPress does by default.
|
26 |
+
|
27 |
+
== Installation ==
|
28 |
+
|
29 |
+
Manual installation:
|
30 |
+
|
31 |
+
1. Upload the `cbnet-Ping Optimizer` folder to the `/wp-content/plugins/` directory
|
32 |
+
|
33 |
+
Installation using "Add New Plugin"
|
34 |
+
|
35 |
+
1. From your Admin UI (Dashboard), use the menu to select Plugins -> Add New
|
36 |
+
2. Search for 'cbnet Ping Optimizer'
|
37 |
+
3. Click the 'Install' button to open the plugin's repository listing
|
38 |
+
4. Click the 'Install' button
|
39 |
+
|
40 |
+
Activiation and Use
|
41 |
+
|
42 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
43 |
+
2. From your Admin UI (Dashboard), use the menu to select Options -> cbnet Ping Optimizer
|
44 |
+
3. Configure settings, and save
|
45 |
+
|
46 |
+
== Frequently Asked Questions ==
|
47 |
+
|
48 |
+
= Coming Soon =
|
49 |
+
|
50 |
+
Let me know what questions you have!
|
51 |
+
|
52 |
+
== Screenshots ==
|
53 |
+
|
54 |
+
Screenshots coming soon.
|
55 |
+
|
56 |
+
|
57 |
+
== Changelog ==
|
58 |
+
|
59 |
+
= 2.3 =
|
60 |
+
* Initial Release
|
61 |
+
* Forked from cbnet Ping Optimizer plugin version 2.2.5
|
62 |
+
|
63 |
+
|
64 |
+
== Upgrade Notice ==
|
65 |
+
|
66 |
+
= 2.3 =
|
67 |
+
Initial Release. Forked from cbnet Ping Optimizer plugin version 2.2.5.
|