20 function GoogleSitemapGeneratorStatus() { |
20 function GoogleSitemapGeneratorStatus() { |
21 $this->_startTime = $this->GetMicrotimeFloat(); |
21 $this->_startTime = $this->GetMicrotimeFloat(); |
22 |
22 |
23 $exists = get_option("sm_status"); |
23 $exists = get_option("sm_status"); |
24 |
24 |
25 if($exists === false) add_option("sm_status","","Status","no"); |
25 if($exists === false) add_option("sm_status","",null,"no"); |
26 |
26 |
27 $this->Save(); |
27 $this->Save(); |
28 } |
28 } |
29 |
29 |
30 function Save() { |
30 function Save() { |
34 /** |
34 /** |
35 * Returns the last saved status object or null |
35 * Returns the last saved status object or null |
36 * |
36 * |
37 * @return GoogleSitemapGeneratorStatus |
37 * @return GoogleSitemapGeneratorStatus |
38 */ |
38 */ |
39 function Load() { |
39 function &Load() { |
40 $status = @get_option("sm_status"); |
40 $status = @get_option("sm_status"); |
41 if(is_a($status,"GoogleSitemapGeneratorStatus")) return $status; |
41 if(is_a($status,"GoogleSitemapGeneratorStatus")) return $status; |
42 else return null; |
42 else return null; |
43 } |
43 } |
44 |
44 |
184 $this->Save(); |
184 $this->Save(); |
185 } |
185 } |
186 |
186 |
187 function GetGoogleTime() { |
187 function GetGoogleTime() { |
188 return round($this->_googleEndTime - $this->_googleStartTime,2); |
188 return round($this->_googleEndTime - $this->_googleStartTime,2); |
189 } |
|
190 |
|
191 var $_usedYahoo = false; |
|
192 var $_yahooUrl = ''; |
|
193 var $_yahooSuccess = false; |
|
194 var $_yahooStartTime = 0; |
|
195 var $_yahooEndTime = 0; |
|
196 |
|
197 function StartYahooPing($url) { |
|
198 $this->_yahooUrl = $url; |
|
199 $this->_usedYahoo = true; |
|
200 $this->_yahooStartTime = $this->GetMicrotimeFloat(); |
|
201 |
|
202 $this->Save(); |
|
203 } |
|
204 |
|
205 function EndYahooPing($success) { |
|
206 $this->_yahooEndTime = $this->GetMicrotimeFloat(); |
|
207 $this->_yahooSuccess = $success; |
|
208 |
|
209 $this->Save(); |
|
210 } |
|
211 |
|
212 function GetYahooTime() { |
|
213 return round($this->_yahooEndTime - $this->_yahooStartTime,2); |
|
214 } |
|
215 |
|
216 var $_usedAsk = false; |
|
217 var $_askUrl = ''; |
|
218 var $_askSuccess = false; |
|
219 var $_askStartTime = 0; |
|
220 var $_askEndTime = 0; |
|
221 |
|
222 function StartAskPing($url) { |
|
223 $this->_usedAsk = true; |
|
224 $this->_askUrl = $url; |
|
225 $this->_askStartTime = $this->GetMicrotimeFloat(); |
|
226 |
|
227 $this->Save(); |
|
228 } |
|
229 |
|
230 function EndAskPing($success) { |
|
231 $this->_askEndTime = $this->GetMicrotimeFloat(); |
|
232 $this->_askSuccess = $success; |
|
233 |
|
234 $this->Save(); |
|
235 } |
|
236 |
|
237 function GetAskTime() { |
|
238 return round($this->_askEndTime - $this->_askStartTime,2); |
|
239 } |
189 } |
240 |
190 |
241 var $_usedMsn = false; |
191 var $_usedMsn = false; |
242 var $_msnUrl = ''; |
192 var $_msnUrl = ''; |
243 var $_msnSuccess = false; |
193 var $_msnSuccess = false; |
744 */ |
694 */ |
745 class GoogleSitemapGenerator { |
695 class GoogleSitemapGenerator { |
746 /** |
696 /** |
747 * @var Version of the generator in SVN |
697 * @var Version of the generator in SVN |
748 */ |
698 */ |
749 var $_svnVersion = '$Id: sitemap-core.php 175664 2009-11-20 21:21:09Z arnee $'; |
699 var $_svnVersion = '$Id: sitemap-core.php 583237 2012-08-08 21:06:12Z arnee $'; |
750 |
700 |
751 /** |
701 /** |
752 * @var array The unserialized array with the stored options |
702 * @var array The unserialized array with the stored options |
753 */ |
703 */ |
754 var $_options = array(); |
704 var $_options = array(); |
829 //get_home_path() is not available, but we can't include the admin |
779 //get_home_path() is not available, but we can't include the admin |
830 //libraries because many plugins check for the "check_admin_referer" |
780 //libraries because many plugins check for the "check_admin_referer" |
831 //function to detect if you are on an admin page. So we have to copy |
781 //function to detect if you are on an admin page. So we have to copy |
832 //the get_home_path function in our own... |
782 //the get_home_path function in our own... |
833 $home = get_option( 'home' ); |
783 $home = get_option( 'home' ); |
834 if ( $home != '' && $home != get_option( 'siteurl' ) ) { |
784 if ( $home != '' && $home != get_option( 'url' ) ) { |
835 $home_path = parse_url( $home ); |
785 $home_path = parse_url( $home ); |
836 $home_path = $home_path['path']; |
786 $home_path = $home_path['path']; |
837 $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] ); |
787 $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] ); |
838 $home_path = trailingslashit( $root.$home_path ); |
788 $home_path = trailingslashit( $root.$home_path ); |
839 } else { |
789 } else { |
908 $this->_options["sm_b_filename"]="sitemap.xml"; //Name of the Sitemap file |
858 $this->_options["sm_b_filename"]="sitemap.xml"; //Name of the Sitemap file |
909 $this->_options["sm_b_debug"]=true; //Write debug messages in the xml file |
859 $this->_options["sm_b_debug"]=true; //Write debug messages in the xml file |
910 $this->_options["sm_b_xml"]=true; //Create a .xml file |
860 $this->_options["sm_b_xml"]=true; //Create a .xml file |
911 $this->_options["sm_b_gzip"]=true; //Create a gzipped .xml file(.gz) file |
861 $this->_options["sm_b_gzip"]=true; //Create a gzipped .xml file(.gz) file |
912 $this->_options["sm_b_ping"]=true; //Auto ping Google |
862 $this->_options["sm_b_ping"]=true; //Auto ping Google |
913 $this->_options["sm_b_pingyahoo"]=false; //Auto ping YAHOO |
|
914 $this->_options["sm_b_yahookey"]=''; //YAHOO Application Key |
|
915 $this->_options["sm_b_pingask"]=true; //Auto ping Ask.com |
|
916 $this->_options["sm_b_pingmsn"]=true; //Auto ping MSN |
863 $this->_options["sm_b_pingmsn"]=true; //Auto ping MSN |
917 $this->_options["sm_b_manual_enabled"]=false; //Allow manual creation of the sitemap via GET request |
864 $this->_options["sm_b_manual_enabled"]=false; //Allow manual creation of the sitemap via GET request |
918 $this->_options["sm_b_auto_enabled"]=true; //Rebuild sitemap when content is changed |
865 $this->_options["sm_b_auto_enabled"]=true; //Rebuild sitemap when content is changed |
919 $this->_options["sm_b_auto_delay"]=true; //Use WP Cron to execute the building process in the background |
866 $this->_options["sm_b_auto_delay"]=true; //Use WP Cron to execute the building process in the background |
920 $this->_options["sm_b_manual_key"]=md5(microtime());//The secret key to build the sitemap via GET request |
867 $this->_options["sm_b_manual_key"]=md5(microtime());//The secret key to build the sitemap via GET request |
938 $this->_options["sm_in_cats"]=false; //Include categories |
885 $this->_options["sm_in_cats"]=false; //Include categories |
939 $this->_options["sm_in_arch"]=false; //Include archives |
886 $this->_options["sm_in_arch"]=false; //Include archives |
940 $this->_options["sm_in_auth"]=false; //Include author pages |
887 $this->_options["sm_in_auth"]=false; //Include author pages |
941 $this->_options["sm_in_tags"]=false; //Include tag pages |
888 $this->_options["sm_in_tags"]=false; //Include tag pages |
942 $this->_options["sm_in_tax"]=array(); //Include additional taxonomies |
889 $this->_options["sm_in_tax"]=array(); //Include additional taxonomies |
|
890 $this->_options["sm_in_customtypes"]=array(); //Include custom post types |
943 $this->_options["sm_in_lastmod"]=true; //Include the last modification date |
891 $this->_options["sm_in_lastmod"]=true; //Include the last modification date |
944 |
892 |
945 $this->_options["sm_cf_home"]="daily"; //Change frequency of the homepage |
893 $this->_options["sm_cf_home"]="daily"; //Change frequency of the homepage |
946 $this->_options["sm_cf_posts"]="monthly"; //Change frequency of posts |
894 $this->_options["sm_cf_posts"]="monthly"; //Change frequency of posts |
947 $this->_options["sm_cf_pages"]="weekly"; //Change frequency of static pages |
895 $this->_options["sm_cf_pages"]="weekly"; //Change frequency of static pages |
1157 * @return true if supported |
1105 * @return true if supported |
1158 */ |
1106 */ |
1159 function IsTaxonomySupported() { |
1107 function IsTaxonomySupported() { |
1160 return (function_exists("get_taxonomy") && function_exists("get_terms")); |
1108 return (function_exists("get_taxonomy") && function_exists("get_terms")); |
1161 } |
1109 } |
|
1110 |
|
1111 /** |
|
1112 * Returns if this version of WordPress supports custom post types |
|
1113 * |
|
1114 * @since 3.2.5 |
|
1115 * @access private |
|
1116 * @author Lee Willis |
|
1117 * @return true if supported |
|
1118 */ |
|
1119 function IsCustomPostTypesSupported() { |
|
1120 return (function_exists("get_post_types") && function_exists("register_post_type")); |
|
1121 } |
1162 |
1122 |
1163 /** |
1123 /** |
1164 * Returns the list of custom taxonies. These are basically all taxonomies without categories and post tags |
1124 * Returns the list of custom taxonies. These are basically all taxonomies without categories and post tags |
1165 * |
1125 * |
1166 * @since 3.1.7 |
1126 * @since 3.1.7 |
1167 * @return array Array of names of user-defined taxonomies |
1127 * @return array Array of names of user-defined taxonomies |
1168 */ |
1128 */ |
1169 function GetCustomTaxonomies() { |
1129 function GetCustomTaxonomies() { |
1170 $taxonomies = get_object_taxonomies('post'); |
1130 $taxonomies = get_object_taxonomies('post'); |
1171 return array_diff($taxonomies,array("category","post_tag")); |
1131 return array_diff($taxonomies,array("category","post_tag","post_format")); |
|
1132 } |
|
1133 |
|
1134 /** |
|
1135 * Returns the list of custom post types. These are all custome post types except post, page and attachment |
|
1136 * |
|
1137 * @since 3.2.5 |
|
1138 * @author Lee Willis |
|
1139 * @return array Array of custom post types as per get_post_types |
|
1140 */ |
|
1141 function GetCustomPostTypes() { |
|
1142 $post_types = get_post_types(array("public"=>1)); |
|
1143 |
|
1144 $post_types = array_diff($post_types,array("post","page","attachment")); |
|
1145 return $post_types; |
1172 } |
1146 } |
1173 |
1147 |
1174 /** |
1148 /** |
1175 * Enables the Google Sitemap Generator and registers the WordPress hooks |
1149 * Enables the Google Sitemap Generator and registers the WordPress hooks |
1176 * |
1150 * |
1331 if($oldvalue == $this->_pages) { |
1305 if($oldvalue == $this->_pages) { |
1332 return true; |
1306 return true; |
1333 } else { |
1307 } else { |
1334 delete_option("sm_cpages"); |
1308 delete_option("sm_cpages"); |
1335 //Add the option, Note the autoload=false because when the autoload happens, our class GoogleSitemapGeneratorPage doesn't exist |
1309 //Add the option, Note the autoload=false because when the autoload happens, our class GoogleSitemapGeneratorPage doesn't exist |
1336 add_option("sm_cpages",$this->_pages,"Storage for custom pages of the sitemap plugin","no"); |
1310 add_option("sm_cpages",$this->_pages,null,"no"); |
1337 return true; |
1311 return true; |
1338 } |
1312 } |
1339 } |
1313 } |
1340 |
1314 |
1341 |
1315 |
1351 function GetXmlUrl($forceAuto=false) { |
1325 function GetXmlUrl($forceAuto=false) { |
1352 |
1326 |
1353 if(!$forceAuto && $this->GetOption("b_location_mode")=="manual") { |
1327 if(!$forceAuto && $this->GetOption("b_location_mode")=="manual") { |
1354 return $this->GetOption("b_fileurl_manual"); |
1328 return $this->GetOption("b_fileurl_manual"); |
1355 } else { |
1329 } else { |
1356 return trailingslashit(get_bloginfo('siteurl')). $this->GetOption("b_filename"); |
1330 return trailingslashit(get_bloginfo('url')). $this->GetOption("b_filename"); |
1357 } |
1331 } |
1358 } |
1332 } |
1359 |
1333 |
1360 /** |
1334 /** |
1361 * Returns the URL for the gzipped sitemap file |
1335 * Returns the URL for the gzipped sitemap file |
1697 //Pre 2.1 compatibility. 2.1 introduced 'future' as post_status so we don't need to check post_date |
1671 //Pre 2.1 compatibility. 2.1 introduced 'future' as post_status so we don't need to check post_date |
1698 $wpCompat = (floatval($wp_version) < 2.1); |
1672 $wpCompat = (floatval($wp_version) < 2.1); |
1699 |
1673 |
1700 $useQTransLate = false; //function_exists('qtrans_convertURL') && function_exists('qtrans_getEnabledLanguages'); Not really working yet |
1674 $useQTransLate = false; //function_exists('qtrans_convertURL') && function_exists('qtrans_getEnabledLanguages'); Not really working yet |
1701 |
1675 |
1702 $excludes = $this->GetOption('b_exclude'); //Excluded posts |
1676 $excludes = $this->GetOption('b_exclude'); //Excluded posts and pages (user enetered ID) |
1703 |
1677 |
1704 $exclCats = $this->GetOption("b_exclude_cats"); // Excluded cats |
1678 $exclCats = $this->GetOption("b_exclude_cats"); // Excluded cats |
1705 |
1679 |
1706 if($exclCats && count($exclCats)>0 && $this->IsTaxonomySupported()) { |
1680 if($exclCats && count($exclCats)>0 && $this->IsTaxonomySupported()) { |
1707 |
1681 |
1708 $exPosts = get_objects_in_term($exclCats,"category"); // Get all posts in excl. cats |
1682 $excludedCatPosts = get_objects_in_term($exclCats,"category"); // Get all posts in excl. cats. Unforttunately this also gives us pages, revisions and so on... |
1709 |
1683 |
1710 if(is_array($exPosts) && count($exPosts) > 0) { //Merge it with the list of user excluded posts |
1684 //Remove the pages, revisions etc from the exclude by category list, because they are always in the uncategorized one. |
1711 $excludes = array_merge($excludes, $exPosts); |
1685 if(count($excludedCatPosts)>0) { |
|
1686 $exclPages = $wpdb->get_col("SELECT ID FROM `" . $wpdb->posts . "` WHERE post_type!='post' AND ID IN ('" . implode("','",$excludedCatPosts) . "')"); |
|
1687 |
|
1688 $exclPages = array_map('intval', $exclPages); |
|
1689 |
|
1690 //Remove the pages from the exlusion list before |
|
1691 if(count($exclPages)>0) $excludedCatPosts = array_diff($excludedCatPosts, $exclPages); |
|
1692 |
|
1693 //Merge the category exclusion list with the users one |
|
1694 if(count($excludedCatPosts)>0) $excludes = array_merge($excludes, $excludedCatPosts); |
1712 } |
1695 } |
1713 } |
1696 } |
1714 |
1697 |
1715 |
1698 |
1716 $contentStmt = ''; |
1699 $contentStmt = ''; |
1733 |
1716 |
1734 if($this->GetOption('in_posts')) { |
1717 if($this->GetOption('in_posts')) { |
1735 //WP < 2.1: posts are post_status = publish |
1718 //WP < 2.1: posts are post_status = publish |
1736 //WP >= 2.1: post_type must be 'post', no date check required because future posts are post_status='future' |
1719 //WP >= 2.1: post_type must be 'post', no date check required because future posts are post_status='future' |
1737 if($wpCompat) $where.="(post_status = 'publish' AND post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "')"; |
1720 if($wpCompat) $where.="(post_status = 'publish' AND post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "')"; |
1738 else $where.=" (post_status = 'publish' AND (post_type = 'post' OR post_type = '')) "; |
1721 else if ($this->IsCustomPostTypesSupported() && count($this->GetOption('in_customtypes'))>0) { |
|
1722 $where.=" (post_status = 'publish' AND (post_type in ('','post'"; |
|
1723 foreach ($this->GetOption('in_customtypes') as $customType) { |
|
1724 $where.= ",'$customType'"; |
|
1725 } |
|
1726 $where .= "))) "; |
|
1727 } else { |
|
1728 $where.=" (post_status = 'publish' AND (post_type = 'post' OR post_type = '')) "; |
|
1729 } |
1739 } |
1730 } |
1740 |
1731 |
1741 if($this->GetOption('in_pages')) { |
1732 if($this->GetOption('in_pages')) { |
1742 if($this->GetOption('in_posts')) { |
1733 if($this->GetOption('in_posts')) { |
1743 $where.=" OR "; |
1734 $where.=" OR "; |
2036 if($linkFunc !== null) { |
2027 if($linkFunc !== null) { |
2037 //Unfortunately there is no API function to get all authors, so we have to do it the dirty way... |
2028 //Unfortunately there is no API function to get all authors, so we have to do it the dirty way... |
2038 //We retrieve only users with published and not password protected posts (and not pages) |
2029 //We retrieve only users with published and not password protected posts (and not pages) |
2039 //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt |
2030 //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt |
2040 $sql = "SELECT DISTINCT |
2031 $sql = "SELECT DISTINCT |
2041 p.ID, |
2032 u.ID, |
2042 u.user_nicename, |
2033 u.user_nicename, |
2043 MAX(p.post_modified_gmt) AS last_post |
2034 MAX(p.post_modified_gmt) AS last_post |
2044 FROM |
2035 FROM |
2045 {$wpdb->users} u, |
2036 {$wpdb->users} u, |
2046 {$wpdb->posts} p |
2037 {$wpdb->posts} p |
2126 t.term_id"; |
2117 t.term_id"; |
2127 |
2118 |
2128 $termInfo = $wpdb->get_results($sql); |
2119 $termInfo = $wpdb->get_results($sql); |
2129 |
2120 |
2130 foreach($termInfo AS $term) { |
2121 foreach($termInfo AS $term) { |
2131 $this->AddUrl(get_term_link($term,$term->_taxonomy),$term->_mod_date ,$this->GetOption("cf_tags"),$this->GetOption("pr_tags")); |
2122 $this->AddUrl(get_term_link($term->slug,$term->_taxonomy),$term->_mod_date ,$this->GetOption("cf_tags"),$this->GetOption("pr_tags")); |
2132 } |
2123 } |
2133 } |
2124 } |
2134 |
2125 |
2135 if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End custom taxonomies")); |
2126 if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End custom taxonomies")); |
2136 } |
2127 } |
2185 } else { |
2176 } else { |
2186 $status->EndGooglePing(true); |
2177 $status->EndGooglePing(true); |
2187 } |
2178 } |
2188 } |
2179 } |
2189 |
2180 |
2190 //Ping Ask.com |
|
2191 if($this->GetOption("b_pingask") && !empty($pingUrl)) { |
|
2192 $sPingUrl="http://submissions.ask.com/ping?sitemap=" . urlencode($pingUrl); |
|
2193 $status->StartAskPing($sPingUrl); |
|
2194 $pingres=$this->RemoteOpen($sPingUrl); |
|
2195 |
|
2196 if($pingres==NULL || $pingres===false || strpos($pingres,"successfully received and added")===false) { //Ask.com returns 200 OK even if there was an error, so we need to check the content. |
|
2197 $status->EndAskPing(false,$this->_lastError); |
|
2198 trigger_error("Failed to ping Ask.com: " . htmlspecialchars(strip_tags($pingres)),E_USER_NOTICE); |
|
2199 } else { |
|
2200 $status->EndAskPing(true); |
|
2201 } |
|
2202 } |
|
2203 |
|
2204 //Ping YAHOO |
|
2205 if($this->GetOption("b_pingyahoo")===true && $this->GetOption("b_yahookey")!="" && !empty($pingUrl)) { |
|
2206 $sPingUrl="http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=" . $this->GetOption("b_yahookey") . "&url=" . urlencode($pingUrl); |
|
2207 $status->StartYahooPing($sPingUrl); |
|
2208 $pingres=$this->RemoteOpen($sPingUrl); |
|
2209 |
|
2210 if($pingres==NULL || $pingres===false || strpos(strtolower($pingres),"success")===false) { |
|
2211 trigger_error("Failed to ping YAHOO: " . htmlspecialchars(strip_tags($pingres)),E_USER_NOTICE); |
|
2212 $status->EndYahooPing(false,$this->_lastError); |
|
2213 } else { |
|
2214 $status->EndYahooPing(true); |
|
2215 } |
|
2216 } |
|
2217 |
2181 |
2218 //Ping Bing |
2182 //Ping Bing |
2219 if($this->GetOption("b_pingmsn") && !empty($pingUrl)) { |
2183 if($this->GetOption("b_pingmsn") && !empty($pingUrl)) { |
2220 $sPingUrl="http://www.bing.com/webmaster/ping.aspx?siteMap=" . urlencode($pingUrl); |
2184 $sPingUrl="http://www.bing.com/webmaster/ping.aspx?siteMap=" . urlencode($pingUrl); |
2221 $status->StartMsnPing($sPingUrl); |
2185 $status->StartMsnPing($sPingUrl); |
2222 $pingres=$this->RemoteOpen($sPingUrl); |
2186 $pingres=$this->RemoteOpen($sPingUrl); |
2223 |
2187 //Bing returns ip/country-based success messages, so there is no way to check the content. Rely on HTTP 500 only then... |
2224 if($pingres==NULL || $pingres===false || strpos($pingres,"Thanks for submitting your sitemap")===false) { |
2188 if($pingres==NULL || $pingres===false || strpos($pingres," ")===false) { |
2225 trigger_error("Failed to ping Bing: " . htmlspecialchars(strip_tags($pingres)),E_USER_NOTICE); |
2189 trigger_error("Failed to ping Bing: " . htmlspecialchars(strip_tags($pingres)),E_USER_NOTICE); |
2226 $status->EndMsnPing(false,$this->_lastError); |
2190 $status->EndMsnPing(false,$this->_lastError); |
2227 } else { |
2191 } else { |
2228 $status->EndMsnPing(true); |
2192 $status->EndMsnPing(true); |
2229 } |
2193 } |
2252 return; |
2216 return; |
2253 } |
2217 } |
2254 |
2218 |
2255 $service = !empty($_GET["sm_ping_service"])?$_GET["sm_ping_service"]:null; |
2219 $service = !empty($_GET["sm_ping_service"])?$_GET["sm_ping_service"]:null; |
2256 |
2220 |
2257 $status = GoogleSitemapGeneratorStatus::Load(); |
2221 $status = &GoogleSitemapGeneratorStatus::Load(); |
2258 |
2222 |
2259 if(!$status) die("No build status yet. Build the sitemap first."); |
2223 if(!$status) die("No build status yet. Build the sitemap first."); |
2260 |
2224 |
2261 $url = null; |
2225 $url = null; |
2262 |
2226 |
2263 switch($service) { |
2227 switch($service) { |
2264 case "google": |
2228 case "google": |
2265 $url = $status->_googleUrl; |
2229 $url = $status->_googleUrl; |
2266 break; |
2230 break; |
2267 case "yahoo": |
|
2268 $url = $status->_yahooUrl; |
|
2269 break; |
|
2270 case "msn": |
2231 case "msn": |
2271 $url = $status->_msnUrl; |
2232 $url = $status->_msnUrl; |
2272 break; |
2233 break; |
2273 case "ask": |
|
2274 $url = $status->_askUrl; |
|
2275 break; |
|
2276 } |
2234 } |
2277 |
2235 |
2278 if(empty($url)) die("Invalid ping url"); |
2236 if(empty($url)) die("Invalid ping url"); |
2279 |
2237 |
2280 echo '<html><head><title>Ping Test</title>'; |
2238 echo '<html><head><title>Ping Test</title>'; |
2503 * |
2461 * |
2504 * @param The value in the mysql datetime format |
2462 * @param The value in the mysql datetime format |
2505 * @return int The time in seconds |
2463 * @return int The time in seconds |
2506 */ |
2464 */ |
2507 function GetTimestampFromMySql($mysqlDateTime) { |
2465 function GetTimestampFromMySql($mysqlDateTime) { |
2508 list($date, $hours) = split(' ', $mysqlDateTime); |
2466 list($date, $hours) = explode(' ', $mysqlDateTime); |
2509 list($year,$month,$day) = split('-',$date); |
2467 list($year,$month,$day) = explode('-',$date); |
2510 list($hour,$min,$sec) = split(':',$hours); |
2468 list($hour,$min,$sec) = explode(':',$hours); |
2511 return mktime(intval($hour), intval($min), intval($sec), intval($month), intval($day), intval($year)); |
2469 return mktime(intval($hour), intval($min), intval($sec), intval($month), intval($day), intval($year)); |
2512 } |
2470 } |
2513 |
2471 |
2514 /** |
2472 /** |
2515 * Returns a link pointing to a spcific page of the authors website |
2473 * Returns a link pointing to a spcific page of the authors website |
2527 * |
2485 * |
2528 * @since 3.0 |
2486 * @since 3.0 |
2529 * @return string The full url |
2487 * @return string The full url |
2530 */ |
2488 */ |
2531 function GetBackLink() { |
2489 function GetBackLink() { |
|
2490 global $wp_version; |
|
2491 $url = ''; |
2532 //admin_url was added in WP 2.6.0 |
2492 //admin_url was added in WP 2.6.0 |
2533 if(function_exists("admin_url")) return admin_url("options-general.php?page=" . GoogleSitemapGeneratorLoader::GetBaseName()); |
2493 if(function_exists("admin_url")) $url = admin_url("options-general.php?page=" . GoogleSitemapGeneratorLoader::GetBaseName()); |
2534 else return $_SERVER['PHP_SELF'] . "?page=" . GoogleSitemapGeneratorLoader::GetBaseName(); |
2494 else $url = $_SERVER['PHP_SELF'] . "?page=" . GoogleSitemapGeneratorLoader::GetBaseName(); |
|
2495 |
|
2496 //Some browser cache the page... great! So lets add some no caching params depending on the WP and plugin version |
|
2497 $url.='&sm_wpv=' . $wp_version . '&sm_pv=' . GoogleSitemapGeneratorLoader::GetVersion(); |
|
2498 |
|
2499 return $url; |
2535 } |
2500 } |
2536 |
2501 |
2537 /** |
2502 /** |
2538 * Shows the option page of the plugin. Before 3.1.1, this function was basically the UI, afterwards the UI was outsourced to another class |
2503 * Shows the option page of the plugin. Before 3.1.1, this function was basically the UI, afterwards the UI was outsourced to another class |
2539 * |
2504 * |