Sync plugins from current page
Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
/*
|
||||
This is a list of all known country codes and their country names.
|
||||
|
||||
It is used in several places in the plugin and is therefore centralized here for ease of update.
|
||||
*/
|
||||
$ISOCountryCode['000'] = _x( 'Unknown', 'Country', 'wp-statistics' );
|
||||
$ISOCountryCode['AF'] = "Afghanistan";
|
||||
$ISOCountryCode['AX'] = "Åland Islands";
|
||||
$ISOCountryCode['AL'] = "Albania";
|
||||
$ISOCountryCode['DZ'] = "Algeria";
|
||||
$ISOCountryCode['AS'] = "American Samoa";
|
||||
$ISOCountryCode['AD'] = "Andorra";
|
||||
$ISOCountryCode['AO'] = "Angola";
|
||||
$ISOCountryCode['AI'] = "Anguilla";
|
||||
$ISOCountryCode['AQ'] = "Antarctica";
|
||||
$ISOCountryCode['AG'] = "Antigua and Barbuda";
|
||||
$ISOCountryCode['AR'] = "Argentina";
|
||||
$ISOCountryCode['AM'] = "Armenia";
|
||||
$ISOCountryCode['AW'] = "Aruba";
|
||||
$ISOCountryCode['AU'] = "Australia";
|
||||
$ISOCountryCode['AT'] = "Austria";
|
||||
$ISOCountryCode['AZ'] = "Azerbaijan";
|
||||
$ISOCountryCode['BS'] = "Bahamas";
|
||||
$ISOCountryCode['BH'] = "Bahrain";
|
||||
$ISOCountryCode['BD'] = "Bangladesh";
|
||||
$ISOCountryCode['BB'] = "Barbados";
|
||||
$ISOCountryCode['BY'] = "Belarus";
|
||||
$ISOCountryCode['BE'] = "Belgium";
|
||||
$ISOCountryCode['BZ'] = "Belize";
|
||||
$ISOCountryCode['BJ'] = "Benin";
|
||||
$ISOCountryCode['BM'] = "Bermuda";
|
||||
$ISOCountryCode['BT'] = "Bhutan";
|
||||
$ISOCountryCode['BO'] = "Bolivia, Plurinational State of";
|
||||
$ISOCountryCode['BQ'] = "Bonaire, Sint Eustatius and Saba";
|
||||
$ISOCountryCode['BA'] = "Bosnia and Herzegovina";
|
||||
$ISOCountryCode['BW'] = "Botswana";
|
||||
$ISOCountryCode['BV'] = "Bouvet Island";
|
||||
$ISOCountryCode['BR'] = "Brazil";
|
||||
$ISOCountryCode['BQ'] = "British Antarctic Territory";
|
||||
$ISOCountryCode['IO'] = "British Indian Ocean Territory";
|
||||
$ISOCountryCode['BN'] = "Brunei Darussalam";
|
||||
$ISOCountryCode['BG'] = "Bulgaria";
|
||||
$ISOCountryCode['BF'] = "Burkina Faso";
|
||||
$ISOCountryCode['BU'] = "Burma";
|
||||
$ISOCountryCode['BI'] = "Burundi";
|
||||
$ISOCountryCode['BY'] = "Belarus";
|
||||
$ISOCountryCode['KH'] = "Cambodia";
|
||||
$ISOCountryCode['CM'] = "Cameroon";
|
||||
$ISOCountryCode['CA'] = "Canada";
|
||||
$ISOCountryCode['CT'] = "Canton and Enderbury Islands";
|
||||
$ISOCountryCode['CV'] = "Cape Verde";
|
||||
$ISOCountryCode['KY'] = "Cayman Islands";
|
||||
$ISOCountryCode['CF'] = "Central African Republic";
|
||||
$ISOCountryCode['TD'] = "Chad";
|
||||
$ISOCountryCode['CL'] = "Chile";
|
||||
$ISOCountryCode['CN'] = "China";
|
||||
$ISOCountryCode['CX'] = "Christmas Island";
|
||||
$ISOCountryCode['CC'] = "Cocos (Keeling) Islands";
|
||||
$ISOCountryCode['CO'] = "Colombia";
|
||||
$ISOCountryCode['KM'] = "Comoros";
|
||||
$ISOCountryCode['CG'] = "Congo";
|
||||
$ISOCountryCode['CD'] = "Congo (the Democratic Republic of the)";
|
||||
$ISOCountryCode['CK'] = "Cook Islands";
|
||||
$ISOCountryCode['CR'] = "Costa Rica";
|
||||
$ISOCountryCode['CI'] = "Côte d’Ivoire";
|
||||
$ISOCountryCode['HR'] = "Croatia";
|
||||
$ISOCountryCode['CU'] = "Cuba";
|
||||
$ISOCountryCode['CW'] = "Curaçao";
|
||||
$ISOCountryCode['CY'] = "Cyprus";
|
||||
$ISOCountryCode['CZ'] = "Czech Republic";
|
||||
$ISOCountryCode['CS'] = "Czechoslovakia";
|
||||
$ISOCountryCode['DY'] = "Dahomey";
|
||||
$ISOCountryCode['DK'] = "Denmark";
|
||||
$ISOCountryCode['DJ'] = "Djibouti";
|
||||
$ISOCountryCode['DM'] = "Dominica";
|
||||
$ISOCountryCode['DO'] = "Dominican Republic";
|
||||
$ISOCountryCode['NQ'] = "Dronning Maud Land";
|
||||
$ISOCountryCode['TP'] = "East Timor";
|
||||
$ISOCountryCode['EC'] = "Ecuador";
|
||||
$ISOCountryCode['EG'] = "Egypt";
|
||||
$ISOCountryCode['SV'] = "El Salvador";
|
||||
$ISOCountryCode['GQ'] = "Equatorial Guinea";
|
||||
$ISOCountryCode['ER'] = "Eritrea";
|
||||
$ISOCountryCode['EE'] = "Estonia";
|
||||
$ISOCountryCode['ET'] = "Ethiopia";
|
||||
$ISOCountryCode['FK'] = "Falkland Islands [Malvinas]";
|
||||
$ISOCountryCode['FO'] = "Faroe Islands";
|
||||
$ISOCountryCode['FJ'] = "Fiji";
|
||||
$ISOCountryCode['FI'] = "Finland";
|
||||
$ISOCountryCode['FR'] = "France";
|
||||
$ISOCountryCode['FX'] = "France, Metropolitan";
|
||||
$ISOCountryCode['AI'] = "French Afars and Issas";
|
||||
$ISOCountryCode['GF'] = "French Guiana";
|
||||
$ISOCountryCode['PF'] = "French Polynesia";
|
||||
$ISOCountryCode['FQ'] = "French Southern and Antarctic Territories";
|
||||
$ISOCountryCode['TF'] = "French Southern Territories";
|
||||
$ISOCountryCode['GA'] = "Gabon";
|
||||
$ISOCountryCode['GM'] = "Gambia";
|
||||
$ISOCountryCode['GE'] = "Georgia";
|
||||
$ISOCountryCode['DD'] = "German Democratic Republic";
|
||||
$ISOCountryCode['DE'] = "Germany";
|
||||
$ISOCountryCode['GH'] = "Ghana";
|
||||
$ISOCountryCode['GI'] = "Gibraltar";
|
||||
$ISOCountryCode['GR'] = "Greece";
|
||||
$ISOCountryCode['GL'] = "Greenland";
|
||||
$ISOCountryCode['GD'] = "Grenada";
|
||||
$ISOCountryCode['GP'] = "Guadeloupe";
|
||||
$ISOCountryCode['GU'] = "Guam";
|
||||
$ISOCountryCode['GT'] = "Guatemala";
|
||||
$ISOCountryCode['GG'] = "Guernsey";
|
||||
$ISOCountryCode['GN'] = "Guinea";
|
||||
$ISOCountryCode['GW'] = "Guinea-Bissau";
|
||||
$ISOCountryCode['GY'] = "Guyana";
|
||||
$ISOCountryCode['HT'] = "Haiti";
|
||||
$ISOCountryCode['HM'] = "Heard Island and McDonald Islands";
|
||||
$ISOCountryCode['VA'] = "Holy See [Vatican City State]";
|
||||
$ISOCountryCode['HN'] = "Honduras";
|
||||
$ISOCountryCode['HK'] = "Hong Kong";
|
||||
$ISOCountryCode['HU'] = "Hungary";
|
||||
$ISOCountryCode['IS'] = "Iceland";
|
||||
$ISOCountryCode['IN'] = "India";
|
||||
$ISOCountryCode['ID'] = "Indonesia";
|
||||
$ISOCountryCode['IR'] = "Iran";
|
||||
$ISOCountryCode['IQ'] = "Iraq";
|
||||
$ISOCountryCode['IE'] = "Ireland";
|
||||
$ISOCountryCode['IM'] = "Isle of Man";
|
||||
$ISOCountryCode['IL'] = "Israel";
|
||||
$ISOCountryCode['IT'] = "Italy";
|
||||
$ISOCountryCode['JM'] = "Jamaica";
|
||||
$ISOCountryCode['JP'] = "Japan";
|
||||
$ISOCountryCode['JE'] = "Jersey";
|
||||
$ISOCountryCode['JT'] = "Johnston Island";
|
||||
$ISOCountryCode['JO'] = "Jordan";
|
||||
$ISOCountryCode['KZ'] = "Kazakhstan";
|
||||
$ISOCountryCode['KE'] = "Kenya";
|
||||
$ISOCountryCode['KI'] = "Kiribati";
|
||||
$ISOCountryCode['KP'] = "Korea (the Democratic People's Republic of)";
|
||||
$ISOCountryCode['KR'] = "Korea (the Republic of)";
|
||||
$ISOCountryCode['KW'] = "Kuwait";
|
||||
$ISOCountryCode['KG'] = "Kyrgyzstan";
|
||||
$ISOCountryCode['LA'] = "Lao People's Democratic Republic";
|
||||
$ISOCountryCode['LV'] = "Latvia";
|
||||
$ISOCountryCode['LB'] = "Lebanon";
|
||||
$ISOCountryCode['LS'] = "Lesotho";
|
||||
$ISOCountryCode['LR'] = "Liberia";
|
||||
$ISOCountryCode['LY'] = "Libya";
|
||||
$ISOCountryCode['LI'] = "Liechtenstein";
|
||||
$ISOCountryCode['LT'] = "Lithuania";
|
||||
$ISOCountryCode['LU'] = "Luxembourg";
|
||||
$ISOCountryCode['MO'] = "Macao";
|
||||
$ISOCountryCode['MK'] = "Macedonia (the former Yugoslav Republic of)";
|
||||
$ISOCountryCode['MG'] = "Madagascar";
|
||||
$ISOCountryCode['MW'] = "Malawi";
|
||||
$ISOCountryCode['MY'] = "Malaysia";
|
||||
$ISOCountryCode['MV'] = "Maldives";
|
||||
$ISOCountryCode['ML'] = "Mali";
|
||||
$ISOCountryCode['MT'] = "Malta";
|
||||
$ISOCountryCode['MH'] = "Marshall Islands";
|
||||
$ISOCountryCode['MQ'] = "Martinique";
|
||||
$ISOCountryCode['MR'] = "Mauritania";
|
||||
$ISOCountryCode['MU'] = "Mauritius";
|
||||
$ISOCountryCode['YT'] = "Mayotte";
|
||||
$ISOCountryCode['MX'] = "Mexico";
|
||||
$ISOCountryCode['FM'] = "Micronesia (the Federated States of)";
|
||||
$ISOCountryCode['MI'] = "Midway Islands";
|
||||
$ISOCountryCode['MD'] = "Moldova (the Republic of)";
|
||||
$ISOCountryCode['MC'] = "Monaco";
|
||||
$ISOCountryCode['MN'] = "Mongolia";
|
||||
$ISOCountryCode['ME'] = "Montenegro";
|
||||
$ISOCountryCode['MS'] = "Montserrat";
|
||||
$ISOCountryCode['MA'] = "Morocco";
|
||||
$ISOCountryCode['MZ'] = "Mozambique";
|
||||
$ISOCountryCode['MM'] = "Myanmar";
|
||||
$ISOCountryCode['NA'] = "Namibia";
|
||||
$ISOCountryCode['NR'] = "Nauru";
|
||||
$ISOCountryCode['NP'] = "Nepal";
|
||||
$ISOCountryCode['NL'] = "Netherlands";
|
||||
$ISOCountryCode['AN'] = "Netherlands Antilles";
|
||||
$ISOCountryCode['NT'] = "Neutral Zone";
|
||||
$ISOCountryCode['NC'] = "New Caledonia";
|
||||
$ISOCountryCode['NH'] = "New Hebrides";
|
||||
$ISOCountryCode['NZ'] = "New Zealand";
|
||||
$ISOCountryCode['NI'] = "Nicaragua";
|
||||
$ISOCountryCode['NE'] = "Niger";
|
||||
$ISOCountryCode['NG'] = "Nigeria";
|
||||
$ISOCountryCode['NU'] = "Niue";
|
||||
$ISOCountryCode['NF'] = "Norfolk Island";
|
||||
$ISOCountryCode['MP'] = "Northern Mariana Islands";
|
||||
$ISOCountryCode['NO'] = "Norway";
|
||||
$ISOCountryCode['OM'] = "Oman";
|
||||
$ISOCountryCode['PC'] = "Pacific Islands (Trust Territory)";
|
||||
$ISOCountryCode['PK'] = "Pakistan";
|
||||
$ISOCountryCode['PW'] = "Palau";
|
||||
$ISOCountryCode['PS'] = "Palestine, State of";
|
||||
$ISOCountryCode['PA'] = "Panama";
|
||||
$ISOCountryCode['PZ'] = "Panama Canal Zone";
|
||||
$ISOCountryCode['PG'] = "Papua New Guinea";
|
||||
$ISOCountryCode['PY'] = "Paraguay";
|
||||
$ISOCountryCode['PE'] = "Peru";
|
||||
$ISOCountryCode['PH'] = "Philippines";
|
||||
$ISOCountryCode['PN'] = "Pitcairn";
|
||||
$ISOCountryCode['PL'] = "Poland";
|
||||
$ISOCountryCode['PT'] = "Portugal";
|
||||
$ISOCountryCode['PR'] = "Puerto Rico";
|
||||
$ISOCountryCode['QA'] = "Qatar";
|
||||
$ISOCountryCode['RE'] = "Réunion";
|
||||
$ISOCountryCode['RO'] = "Romania";
|
||||
$ISOCountryCode['RU'] = "Russian Federation";
|
||||
$ISOCountryCode['RW'] = "Rwanda";
|
||||
$ISOCountryCode['BL'] = "Saint Barthélemy";
|
||||
$ISOCountryCode['SH'] = "Saint Helena, Ascension and Tristan da Cunha";
|
||||
$ISOCountryCode['KN'] = "Saint Kitts and Nevis";
|
||||
$ISOCountryCode['LC'] = "Saint Lucia";
|
||||
$ISOCountryCode['MF'] = "Saint Martin (French part)";
|
||||
$ISOCountryCode['PM'] = "Saint Pierre and Miquelon";
|
||||
$ISOCountryCode['VC'] = "Saint Vincent and the Grenadines";
|
||||
$ISOCountryCode['WS'] = "Samoa";
|
||||
$ISOCountryCode['SM'] = "San Marino";
|
||||
$ISOCountryCode['ST'] = "Sao Tome and Principe";
|
||||
$ISOCountryCode['SA'] = "Saudi Arabia";
|
||||
$ISOCountryCode['SN'] = "Senegal";
|
||||
$ISOCountryCode['RS'] = "Serbia";
|
||||
$ISOCountryCode['CS'] = "Serbia and Montenegro";
|
||||
$ISOCountryCode['SC'] = "Seychelles";
|
||||
$ISOCountryCode['SL'] = "Sierra Leone";
|
||||
$ISOCountryCode['SK'] = "Sikkim";
|
||||
$ISOCountryCode['SG'] = "Singapore";
|
||||
$ISOCountryCode['SX'] = "Sint Maarten (Dutch part)";
|
||||
$ISOCountryCode['SK'] = "Slovakia";
|
||||
$ISOCountryCode['SI'] = "Slovenia";
|
||||
$ISOCountryCode['SB'] = "Solomon Islands";
|
||||
$ISOCountryCode['SO'] = "Somalia";
|
||||
$ISOCountryCode['ZA'] = "South Africa";
|
||||
$ISOCountryCode['GS'] = "South Georgia and the South Sandwich Islands";
|
||||
$ISOCountryCode['SS'] = "South Sudan ";
|
||||
$ISOCountryCode['RH'] = "Southern Rhodesia";
|
||||
$ISOCountryCode['ES'] = "Spain";
|
||||
$ISOCountryCode['LK'] = "Sri Lanka";
|
||||
$ISOCountryCode['SD'] = "Sudan";
|
||||
$ISOCountryCode['SR'] = "Suriname";
|
||||
$ISOCountryCode['SJ'] = "Svalbard and Jan Mayen";
|
||||
$ISOCountryCode['SZ'] = "Swaziland";
|
||||
$ISOCountryCode['SE'] = "Sweden";
|
||||
$ISOCountryCode['CH'] = "Switzerland";
|
||||
$ISOCountryCode['SY'] = "Syrian Arab Republic";
|
||||
$ISOCountryCode['TW'] = "Taiwan";
|
||||
$ISOCountryCode['TJ'] = "Tajikistan";
|
||||
$ISOCountryCode['TZ'] = "Tanzania, United Republic of";
|
||||
$ISOCountryCode['TH'] = "Thailand";
|
||||
$ISOCountryCode['TL'] = "Timor-Leste";
|
||||
$ISOCountryCode['TG'] = "Togo";
|
||||
$ISOCountryCode['TK'] = "Tokelau";
|
||||
$ISOCountryCode['TO'] = "Tonga";
|
||||
$ISOCountryCode['TT'] = "Trinidad and Tobago";
|
||||
$ISOCountryCode['TN'] = "Tunisia";
|
||||
$ISOCountryCode['TR'] = "Turkey";
|
||||
$ISOCountryCode['TM'] = "Turkmenistan";
|
||||
$ISOCountryCode['TC'] = "Turks and Caicos Islands";
|
||||
$ISOCountryCode['TV'] = "Tuvalu";
|
||||
$ISOCountryCode['UG'] = "Uganda";
|
||||
$ISOCountryCode['UA'] = "Ukraine";
|
||||
$ISOCountryCode['AE'] = "United Arab Emirates";
|
||||
$ISOCountryCode['GB'] = "United Kingdom";
|
||||
$ISOCountryCode['US'] = "United States";
|
||||
$ISOCountryCode['UM'] = "United States Minor Outlying Islands";
|
||||
$ISOCountryCode['PU'] = "United States Miscellaneous Pacific Islands";
|
||||
$ISOCountryCode['HV'] = "Upper Volta";
|
||||
$ISOCountryCode['UY'] = "Uruguay";
|
||||
$ISOCountryCode['SU'] = "USSR";
|
||||
$ISOCountryCode['UZ'] = "Uzbekistan";
|
||||
$ISOCountryCode['VU'] = "Vanuatu";
|
||||
$ISOCountryCode['VE'] = "Venezuela, Bolivarian Republic of ";
|
||||
$ISOCountryCode['VN'] = "Viet Nam";
|
||||
$ISOCountryCode['VD'] = "Viet-Nam, Democratic Republic of";
|
||||
$ISOCountryCode['VG'] = "Virgin Islands (British)";
|
||||
$ISOCountryCode['VI'] = "Virgin Islands (U.S.)";
|
||||
$ISOCountryCode['WK'] = "Wake Island";
|
||||
$ISOCountryCode['WF'] = "Wallis and Futuna";
|
||||
$ISOCountryCode['EH'] = "Western Sahara";
|
||||
$ISOCountryCode['XK'] = "Kosovo";
|
||||
$ISOCountryCode['YE'] = "Yemen";
|
||||
$ISOCountryCode['YD'] = "Yemen, Democratic";
|
||||
$ISOCountryCode['YU'] = "Yugoslavia";
|
||||
$ISOCountryCode['ZR'] = "Zaire";
|
||||
$ISOCountryCode['ZM'] = "Zambia";
|
||||
$ISOCountryCode['ZW'] = "Zimbabwe";
|
||||
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
/*
|
||||
This is a list of all known country codes and their latitue/longitude values.
|
||||
|
||||
It is used for the map in the overview page.
|
||||
*/
|
||||
$CountryCoordinates["AF"] = array( "lat" => "33", "lng" => "65" );
|
||||
$CountryCoordinates["AL"] = array( "lat" => "41", "lng" => "20" );
|
||||
$CountryCoordinates["DZ"] = array( "lat" => "28", "lng" => "3" );
|
||||
$CountryCoordinates["AS"] = array( "lat" => "-14.3333", "lng" => "-170" );
|
||||
$CountryCoordinates["AD"] = array( "lat" => "42.5", "lng" => "1.6" );
|
||||
$CountryCoordinates["AO"] = array( "lat" => "-12.5", "lng" => "18.5" );
|
||||
$CountryCoordinates["AI"] = array( "lat" => "18.25", "lng" => "-63.1667" );
|
||||
$CountryCoordinates["AQ"] = array( "lat" => "-90", "lng" => "0" );
|
||||
$CountryCoordinates["AG"] = array( "lat" => "17.05", "lng" => "-61.8" );
|
||||
$CountryCoordinates["AR"] = array( "lat" => "-34", "lng" => "-64" );
|
||||
$CountryCoordinates["AM"] = array( "lat" => "40", "lng" => "45" );
|
||||
$CountryCoordinates["AW"] = array( "lat" => "12.5", "lng" => "-69.9667" );
|
||||
$CountryCoordinates["AU"] = array( "lat" => "-27", "lng" => "133" );
|
||||
$CountryCoordinates["AT"] = array( "lat" => "47.3333", "lng" => "13.3333" );
|
||||
$CountryCoordinates["AZ"] = array( "lat" => "40.5", "lng" => "47.5" );
|
||||
$CountryCoordinates["BS"] = array( "lat" => "24.25", "lng" => "-76" );
|
||||
$CountryCoordinates["BH"] = array( "lat" => "26", "lng" => "50.55" );
|
||||
$CountryCoordinates["BD"] = array( "lat" => "24", "lng" => "90" );
|
||||
$CountryCoordinates["BB"] = array( "lat" => "13.1667", "lng" => "-59.5333" );
|
||||
$CountryCoordinates["BY"] = array( "lat" => "53", "lng" => "28" );
|
||||
$CountryCoordinates["BE"] = array( "lat" => "50.8333", "lng" => "4" );
|
||||
$CountryCoordinates["BZ"] = array( "lat" => "17.25", "lng" => "-88.75" );
|
||||
$CountryCoordinates["BJ"] = array( "lat" => "9.5", "lng" => "2.25" );
|
||||
$CountryCoordinates["BM"] = array( "lat" => "32.3333", "lng" => "-64.75" );
|
||||
$CountryCoordinates["BT"] = array( "lat" => "27.5", "lng" => "90.5" );
|
||||
$CountryCoordinates["BO"] = array( "lat" => "-17", "lng" => "-65" );
|
||||
$CountryCoordinates["BA"] = array( "lat" => "44", "lng" => "18" );
|
||||
$CountryCoordinates["BW"] = array( "lat" => "-22", "lng" => "24" );
|
||||
$CountryCoordinates["BV"] = array( "lat" => "-54.4333", "lng" => "3.4" );
|
||||
$CountryCoordinates["BR"] = array( "lat" => "-10", "lng" => "-55" );
|
||||
$CountryCoordinates["IO"] = array( "lat" => "-6", "lng" => "71.5" );
|
||||
$CountryCoordinates["BN"] = array( "lat" => "4.5", "lng" => "114.6667" );
|
||||
$CountryCoordinates["BG"] = array( "lat" => "43", "lng" => "25" );
|
||||
$CountryCoordinates["BF"] = array( "lat" => "13", "lng" => "-2" );
|
||||
$CountryCoordinates["BI"] = array( "lat" => "-3.5", "lng" => "30" );
|
||||
$CountryCoordinates["KH"] = array( "lat" => "13", "lng" => "105" );
|
||||
$CountryCoordinates["CM"] = array( "lat" => "6", "lng" => "12" );
|
||||
$CountryCoordinates["CA"] = array( "lat" => "60", "lng" => "-95" );
|
||||
$CountryCoordinates["CV"] = array( "lat" => "16", "lng" => "-24" );
|
||||
$CountryCoordinates["KY"] = array( "lat" => "19.5", "lng" => "-80.5" );
|
||||
$CountryCoordinates["CF"] = array( "lat" => "7", "lng" => "21" );
|
||||
$CountryCoordinates["TD"] = array( "lat" => "15", "lng" => "19" );
|
||||
$CountryCoordinates["CL"] = array( "lat" => "-30", "lng" => "-71" );
|
||||
$CountryCoordinates["CN"] = array( "lat" => "35", "lng" => "105" );
|
||||
$CountryCoordinates["CX"] = array( "lat" => "-10.5", "lng" => "105.6667" );
|
||||
$CountryCoordinates["CC"] = array( "lat" => "-12.5", "lng" => "96.8333" );
|
||||
$CountryCoordinates["CO"] = array( "lat" => "4", "lng" => "-72" );
|
||||
$CountryCoordinates["KM"] = array( "lat" => "-12.1667", "lng" => "44.25" );
|
||||
$CountryCoordinates["CG"] = array( "lat" => "-1", "lng" => "15" );
|
||||
$CountryCoordinates["CD"] = array( "lat" => "0", "lng" => "25" );
|
||||
$CountryCoordinates["CK"] = array( "lat" => "-21.2333", "lng" => "-159.7667" );
|
||||
$CountryCoordinates["CR"] = array( "lat" => "10", "lng" => "-84" );
|
||||
$CountryCoordinates["CI"] = array( "lat" => "8", "lng" => "-5" );
|
||||
$CountryCoordinates["HR"] = array( "lat" => "45.1667", "lng" => "15.5" );
|
||||
$CountryCoordinates["CU"] = array( "lat" => "21.5", "lng" => "-80" );
|
||||
$CountryCoordinates["CY"] = array( "lat" => "35", "lng" => "33" );
|
||||
$CountryCoordinates["CZ"] = array( "lat" => "49.75", "lng" => "15.5" );
|
||||
$CountryCoordinates["DK"] = array( "lat" => "56", "lng" => "10" );
|
||||
$CountryCoordinates["DJ"] = array( "lat" => "11.5", "lng" => "43" );
|
||||
$CountryCoordinates["DM"] = array( "lat" => "15.4167", "lng" => "-61.3333" );
|
||||
$CountryCoordinates["DO"] = array( "lat" => "19", "lng" => "-70.6667" );
|
||||
$CountryCoordinates["EC"] = array( "lat" => "-2", "lng" => "-77.5" );
|
||||
$CountryCoordinates["EG"] = array( "lat" => "27", "lng" => "30" );
|
||||
$CountryCoordinates["SV"] = array( "lat" => "13.8333", "lng" => "-88.9167" );
|
||||
$CountryCoordinates["GQ"] = array( "lat" => "2", "lng" => "10" );
|
||||
$CountryCoordinates["ER"] = array( "lat" => "15", "lng" => "39" );
|
||||
$CountryCoordinates["EE"] = array( "lat" => "59", "lng" => "26" );
|
||||
$CountryCoordinates["ET"] = array( "lat" => "8", "lng" => "38" );
|
||||
$CountryCoordinates["FK"] = array( "lat" => "-51.75", "lng" => "-59" );
|
||||
$CountryCoordinates["FO"] = array( "lat" => "62", "lng" => "-7" );
|
||||
$CountryCoordinates["FJ"] = array( "lat" => "-18", "lng" => "175" );
|
||||
$CountryCoordinates["FI"] = array( "lat" => "64", "lng" => "26" );
|
||||
$CountryCoordinates["FR"] = array( "lat" => "46", "lng" => "2" );
|
||||
$CountryCoordinates["GF"] = array( "lat" => "4", "lng" => "-53" );
|
||||
$CountryCoordinates["PF"] = array( "lat" => "-15", "lng" => "-140" );
|
||||
$CountryCoordinates["TF"] = array( "lat" => "-43", "lng" => "67" );
|
||||
$CountryCoordinates["GA"] = array( "lat" => "-1", "lng" => "11.75" );
|
||||
$CountryCoordinates["GM"] = array( "lat" => "13.4667", "lng" => "-16.5667" );
|
||||
$CountryCoordinates["GE"] = array( "lat" => "42", "lng" => "43.5" );
|
||||
$CountryCoordinates["DE"] = array( "lat" => "51", "lng" => "9" );
|
||||
$CountryCoordinates["GH"] = array( "lat" => "8", "lng" => "-2" );
|
||||
$CountryCoordinates["GI"] = array( "lat" => "36.1833", "lng" => "-5.3667" );
|
||||
$CountryCoordinates["GR"] = array( "lat" => "39", "lng" => "22" );
|
||||
$CountryCoordinates["GL"] = array( "lat" => "72", "lng" => "-40" );
|
||||
$CountryCoordinates["GD"] = array( "lat" => "12.1167", "lng" => "-61.6667" );
|
||||
$CountryCoordinates["GP"] = array( "lat" => "16.25", "lng" => "-61.5833" );
|
||||
$CountryCoordinates["GU"] = array( "lat" => "13.4667", "lng" => "144.7833" );
|
||||
$CountryCoordinates["GT"] = array( "lat" => "15.5", "lng" => "-90.25" );
|
||||
$CountryCoordinates["GG"] = array( "lat" => "49.5", "lng" => "-2.56" );
|
||||
$CountryCoordinates["GN"] = array( "lat" => "11", "lng" => "-10" );
|
||||
$CountryCoordinates["GW"] = array( "lat" => "12", "lng" => "-15" );
|
||||
$CountryCoordinates["GY"] = array( "lat" => "5", "lng" => "-59" );
|
||||
$CountryCoordinates["HT"] = array( "lat" => "19", "lng" => "-72.4167" );
|
||||
$CountryCoordinates["HM"] = array( "lat" => "-53.1", "lng" => "72.5167" );
|
||||
$CountryCoordinates["VA"] = array( "lat" => "41.9", "lng" => "12.45" );
|
||||
$CountryCoordinates["HN"] = array( "lat" => "15", "lng" => "-86.5" );
|
||||
$CountryCoordinates["HK"] = array( "lat" => "22.25", "lng" => "114.1667" );
|
||||
$CountryCoordinates["HU"] = array( "lat" => "47", "lng" => "20" );
|
||||
$CountryCoordinates["IS"] = array( "lat" => "65", "lng" => "-18" );
|
||||
$CountryCoordinates["IN"] = array( "lat" => "20", "lng" => "77" );
|
||||
$CountryCoordinates["ID"] = array( "lat" => "-5", "lng" => "120" );
|
||||
$CountryCoordinates["IR"] = array( "lat" => "32", "lng" => "53" );
|
||||
$CountryCoordinates["IQ"] = array( "lat" => "33", "lng" => "44" );
|
||||
$CountryCoordinates["IE"] = array( "lat" => "53", "lng" => "-8" );
|
||||
$CountryCoordinates["IM"] = array( "lat" => "54.23", "lng" => "-4.55" );
|
||||
$CountryCoordinates["IL"] = array( "lat" => "31.5", "lng" => "34.75" );
|
||||
$CountryCoordinates["IT"] = array( "lat" => "42.8333", "lng" => "12.8333" );
|
||||
$CountryCoordinates["JM"] = array( "lat" => "18.25", "lng" => "-77.5" );
|
||||
$CountryCoordinates["JP"] = array( "lat" => "36", "lng" => "138" );
|
||||
$CountryCoordinates["JE"] = array( "lat" => "49.21", "lng" => "-2.13" );
|
||||
$CountryCoordinates["JO"] = array( "lat" => "31", "lng" => "36" );
|
||||
$CountryCoordinates["KZ"] = array( "lat" => "48", "lng" => "68" );
|
||||
$CountryCoordinates["KE"] = array( "lat" => "1", "lng" => "38" );
|
||||
$CountryCoordinates["KI"] = array( "lat" => "1.4167", "lng" => "173" );
|
||||
$CountryCoordinates["KP"] = array( "lat" => "40", "lng" => "127" );
|
||||
$CountryCoordinates["KR"] = array( "lat" => "37", "lng" => "127.5" );
|
||||
$CountryCoordinates["KW"] = array( "lat" => "29.3375", "lng" => "47.6581" );
|
||||
$CountryCoordinates["KG"] = array( "lat" => "41", "lng" => "75" );
|
||||
$CountryCoordinates["LA"] = array( "lat" => "18", "lng" => "105" );
|
||||
$CountryCoordinates["LV"] = array( "lat" => "57", "lng" => "25" );
|
||||
$CountryCoordinates["LB"] = array( "lat" => "33.8333", "lng" => "35.8333" );
|
||||
$CountryCoordinates["LS"] = array( "lat" => "-29.5", "lng" => "28.5" );
|
||||
$CountryCoordinates["LR"] = array( "lat" => "6.5", "lng" => "-9.5" );
|
||||
$CountryCoordinates["LY"] = array( "lat" => "25", "lng" => "17" );
|
||||
$CountryCoordinates["LI"] = array( "lat" => "47.1667", "lng" => "9.5333" );
|
||||
$CountryCoordinates["LT"] = array( "lat" => "56", "lng" => "24" );
|
||||
$CountryCoordinates["LU"] = array( "lat" => "49.75", "lng" => "6.1667" );
|
||||
$CountryCoordinates["MO"] = array( "lat" => "22.1667", "lng" => "113.55" );
|
||||
$CountryCoordinates["MK"] = array( "lat" => "41.8333", "lng" => "22" );
|
||||
$CountryCoordinates["MG"] = array( "lat" => "-20", "lng" => "47" );
|
||||
$CountryCoordinates["MW"] = array( "lat" => "-13.5", "lng" => "34" );
|
||||
$CountryCoordinates["MY"] = array( "lat" => "2.5", "lng" => "112.5" );
|
||||
$CountryCoordinates["MV"] = array( "lat" => "3.25", "lng" => "73" );
|
||||
$CountryCoordinates["ML"] = array( "lat" => "17", "lng" => "-4" );
|
||||
$CountryCoordinates["MT"] = array( "lat" => "35.8333", "lng" => "14.5833" );
|
||||
$CountryCoordinates["MH"] = array( "lat" => "9", "lng" => "168" );
|
||||
$CountryCoordinates["MQ"] = array( "lat" => "14.6667", "lng" => "-61" );
|
||||
$CountryCoordinates["MR"] = array( "lat" => "20", "lng" => "-12" );
|
||||
$CountryCoordinates["MU"] = array( "lat" => "-20.2833", "lng" => "57.55" );
|
||||
$CountryCoordinates["YT"] = array( "lat" => "-12.8333", "lng" => "45.1667" );
|
||||
$CountryCoordinates["MX"] = array( "lat" => "23", "lng" => "-102" );
|
||||
$CountryCoordinates["FM"] = array( "lat" => "6.9167", "lng" => "158.25" );
|
||||
$CountryCoordinates["MD"] = array( "lat" => "47", "lng" => "29" );
|
||||
$CountryCoordinates["MC"] = array( "lat" => "43.7333", "lng" => "7.4" );
|
||||
$CountryCoordinates["MN"] = array( "lat" => "46", "lng" => "105" );
|
||||
$CountryCoordinates["ME"] = array( "lat" => "42", "lng" => "19" );
|
||||
$CountryCoordinates["MS"] = array( "lat" => "16.75", "lng" => "-62.2" );
|
||||
$CountryCoordinates["MA"] = array( "lat" => "32", "lng" => "-5" );
|
||||
$CountryCoordinates["MZ"] = array( "lat" => "-18.25", "lng" => "35" );
|
||||
$CountryCoordinates["MM"] = array( "lat" => "22", "lng" => "98" );
|
||||
$CountryCoordinates["NA"] = array( "lat" => "-22", "lng" => "17" );
|
||||
$CountryCoordinates["NR"] = array( "lat" => "-0.5333", "lng" => "166.9167" );
|
||||
$CountryCoordinates["NP"] = array( "lat" => "28", "lng" => "84" );
|
||||
$CountryCoordinates["NL"] = array( "lat" => "52.5", "lng" => "5.75" );
|
||||
$CountryCoordinates["AN"] = array( "lat" => "12.25", "lng" => "-68.75" );
|
||||
$CountryCoordinates["NC"] = array( "lat" => "-21.5", "lng" => "165.5" );
|
||||
$CountryCoordinates["NZ"] = array( "lat" => "-41", "lng" => "174" );
|
||||
$CountryCoordinates["NI"] = array( "lat" => "13", "lng" => "-85" );
|
||||
$CountryCoordinates["NE"] = array( "lat" => "16", "lng" => "8" );
|
||||
$CountryCoordinates["NG"] = array( "lat" => "10", "lng" => "8" );
|
||||
$CountryCoordinates["NU"] = array( "lat" => "-19.0333", "lng" => "-169.8667" );
|
||||
$CountryCoordinates["NF"] = array( "lat" => "-29.0333", "lng" => "167.95" );
|
||||
$CountryCoordinates["MP"] = array( "lat" => "15.2", "lng" => "145.75" );
|
||||
$CountryCoordinates["NO"] = array( "lat" => "62", "lng" => "10" );
|
||||
$CountryCoordinates["OM"] = array( "lat" => "21", "lng" => "57" );
|
||||
$CountryCoordinates["PK"] = array( "lat" => "30", "lng" => "70" );
|
||||
$CountryCoordinates["PW"] = array( "lat" => "7.5", "lng" => "134.5" );
|
||||
$CountryCoordinates["PS"] = array( "lat" => "32", "lng" => "35.25" );
|
||||
$CountryCoordinates["PA"] = array( "lat" => "9", "lng" => "-80" );
|
||||
$CountryCoordinates["PG"] = array( "lat" => "-6", "lng" => "147" );
|
||||
$CountryCoordinates["PY"] = array( "lat" => "-23", "lng" => "-58" );
|
||||
$CountryCoordinates["PE"] = array( "lat" => "-10", "lng" => "-76" );
|
||||
$CountryCoordinates["PH"] = array( "lat" => "13", "lng" => "122" );
|
||||
$CountryCoordinates["PN"] = array( "lat" => "-24.7", "lng" => "-127.4" );
|
||||
$CountryCoordinates["PL"] = array( "lat" => "52", "lng" => "20" );
|
||||
$CountryCoordinates["PT"] = array( "lat" => "39.5", "lng" => "-8" );
|
||||
$CountryCoordinates["PR"] = array( "lat" => "18.25", "lng" => "-66.5" );
|
||||
$CountryCoordinates["QA"] = array( "lat" => "25.5", "lng" => "51.25" );
|
||||
$CountryCoordinates["RE"] = array( "lat" => "-21.1", "lng" => "55.6" );
|
||||
$CountryCoordinates["RO"] = array( "lat" => "46", "lng" => "25" );
|
||||
$CountryCoordinates["RU"] = array( "lat" => "60", "lng" => "100" );
|
||||
$CountryCoordinates["RW"] = array( "lat" => "-2", "lng" => "30" );
|
||||
$CountryCoordinates["SH"] = array( "lat" => "-15.9333", "lng" => "-5.7" );
|
||||
$CountryCoordinates["KN"] = array( "lat" => "17.3333", "lng" => "-62.75" );
|
||||
$CountryCoordinates["LC"] = array( "lat" => "13.8833", "lng" => "-61.1333" );
|
||||
$CountryCoordinates["PM"] = array( "lat" => "46.8333", "lng" => "-56.3333" );
|
||||
$CountryCoordinates["VC"] = array( "lat" => "13.25", "lng" => "-61.2" );
|
||||
$CountryCoordinates["WS"] = array( "lat" => "-13.5833", "lng" => "-172.3333" );
|
||||
$CountryCoordinates["SM"] = array( "lat" => "43.7667", "lng" => "12.4167" );
|
||||
$CountryCoordinates["ST"] = array( "lat" => "1", "lng" => "7" );
|
||||
$CountryCoordinates["SA"] = array( "lat" => "25", "lng" => "45" );
|
||||
$CountryCoordinates["SN"] = array( "lat" => "14", "lng" => "-14" );
|
||||
$CountryCoordinates["RS"] = array( "lat" => "44", "lng" => "21" );
|
||||
$CountryCoordinates["SC"] = array( "lat" => "-4.5833", "lng" => "55.6667" );
|
||||
$CountryCoordinates["SL"] = array( "lat" => "8.5", "lng" => "-11.5" );
|
||||
$CountryCoordinates["SG"] = array( "lat" => "1.3667", "lng" => "103.8" );
|
||||
$CountryCoordinates["SK"] = array( "lat" => "48.6667", "lng" => "19.5" );
|
||||
$CountryCoordinates["SI"] = array( "lat" => "46", "lng" => "15" );
|
||||
$CountryCoordinates["SB"] = array( "lat" => "-8", "lng" => "159" );
|
||||
$CountryCoordinates["SO"] = array( "lat" => "10", "lng" => "49" );
|
||||
$CountryCoordinates["ZA"] = array( "lat" => "-29", "lng" => "24" );
|
||||
$CountryCoordinates["GS"] = array( "lat" => "-54.5", "lng" => "-37" );
|
||||
$CountryCoordinates["ES"] = array( "lat" => "40", "lng" => "-4" );
|
||||
$CountryCoordinates["LK"] = array( "lat" => "7", "lng" => "81" );
|
||||
$CountryCoordinates["SD"] = array( "lat" => "15", "lng" => "30" );
|
||||
$CountryCoordinates["SR"] = array( "lat" => "4", "lng" => "-56" );
|
||||
$CountryCoordinates["SJ"] = array( "lat" => "78", "lng" => "20" );
|
||||
$CountryCoordinates["SZ"] = array( "lat" => "-26.5", "lng" => "31.5" );
|
||||
$CountryCoordinates["SE"] = array( "lat" => "62", "lng" => "15" );
|
||||
$CountryCoordinates["CH"] = array( "lat" => "47", "lng" => "8" );
|
||||
$CountryCoordinates["SY"] = array( "lat" => "35", "lng" => "38" );
|
||||
$CountryCoordinates["TW"] = array( "lat" => "23.5", "lng" => "121" );
|
||||
$CountryCoordinates["TJ"] = array( "lat" => "39", "lng" => "71" );
|
||||
$CountryCoordinates["TZ"] = array( "lat" => "-6", "lng" => "35" );
|
||||
$CountryCoordinates["TH"] = array( "lat" => "15", "lng" => "100" );
|
||||
$CountryCoordinates["TL"] = array( "lat" => "-8.55", "lng" => "125.5167" );
|
||||
$CountryCoordinates["TG"] = array( "lat" => "8", "lng" => "1.1667" );
|
||||
$CountryCoordinates["TK"] = array( "lat" => "-9", "lng" => "-172" );
|
||||
$CountryCoordinates["TO"] = array( "lat" => "-20", "lng" => "-175" );
|
||||
$CountryCoordinates["TT"] = array( "lat" => "11", "lng" => "-61" );
|
||||
$CountryCoordinates["TN"] = array( "lat" => "34", "lng" => "9" );
|
||||
$CountryCoordinates["TR"] = array( "lat" => "39", "lng" => "35" );
|
||||
$CountryCoordinates["TM"] = array( "lat" => "40", "lng" => "60" );
|
||||
$CountryCoordinates["TC"] = array( "lat" => "21.75", "lng" => "-71.5833" );
|
||||
$CountryCoordinates["TV"] = array( "lat" => "-8", "lng" => "178" );
|
||||
$CountryCoordinates["UG"] = array( "lat" => "1", "lng" => "32" );
|
||||
$CountryCoordinates["UA"] = array( "lat" => "49", "lng" => "32" );
|
||||
$CountryCoordinates["AE"] = array( "lat" => "24", "lng" => "54" );
|
||||
$CountryCoordinates["GB"] = array( "lat" => "54", "lng" => "-2" );
|
||||
$CountryCoordinates["US"] = array( "lat" => "38", "lng" => "-97" );
|
||||
$CountryCoordinates["UM"] = array( "lat" => "19.2833", "lng" => "166.6" );
|
||||
$CountryCoordinates["UY"] = array( "lat" => "-33", "lng" => "-56" );
|
||||
$CountryCoordinates["UZ"] = array( "lat" => "41", "lng" => "64" );
|
||||
$CountryCoordinates["VU"] = array( "lat" => "-16", "lng" => "167" );
|
||||
$CountryCoordinates["VE"] = array( "lat" => "8", "lng" => "-66" );
|
||||
$CountryCoordinates["VN"] = array( "lat" => "16", "lng" => "106" );
|
||||
$CountryCoordinates["VG"] = array( "lat" => "18.5", "lng" => "-64.5" );
|
||||
$CountryCoordinates["VI"] = array( "lat" => "18.3333", "lng" => "-64.8333" );
|
||||
$CountryCoordinates["WF"] = array( "lat" => "-13.3", "lng" => "-176.2" );
|
||||
$CountryCoordinates["EH"] = array( "lat" => "24.5", "lng" => "-13" );
|
||||
$CountryCoordinates["YE"] = array( "lat" => "15", "lng" => "48" );
|
||||
$CountryCoordinates["ZM"] = array( "lat" => "-15", "lng" => "30" );
|
||||
$CountryCoordinates["ZW"] = array( "lat" => "-20", "lng" => "30" );
|
||||
2264
wp-content/plugins/wp-statistics/includes/functions/functions.php
Normal file
2264
wp-content/plugins/wp-statistics/includes/functions/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
function wp_statistics_purge_visitor_hits( $purge_hits ) {
|
||||
GLOBAL $wpdb, $WP_Statistics;
|
||||
|
||||
// If it's less than 10 hits, don't do anything.
|
||||
if ( $purge_hits > 9 ) {
|
||||
// Purge the visitor's with more than the defined hits.
|
||||
$result = $wpdb->get_results(
|
||||
$wpdb->prepare( "SELECT * FROM {$wpdb->prefix}statistics_visitor WHERE `hits` > %s", $purge_hits )
|
||||
);
|
||||
|
||||
$to_delete = array();
|
||||
|
||||
// Loop through the results and store the requried information in an array. We don't just process it now as deleting
|
||||
// the rows from the visitor table will mess up the results from our first query.
|
||||
foreach ( $result as $row ) {
|
||||
$to_delete[] = array( $row->ID, $row->last_counter, $row->hits );
|
||||
}
|
||||
if ( count( $to_delete ) > 0 ) {
|
||||
foreach ( $to_delete as $item ) {
|
||||
// First update the daily hit count.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"UPDATE {$wpdb->prefix}statistics_visit SET `visit` = `visit` - %d WHERE `last_counter` = %s;",
|
||||
$item[2],
|
||||
$item[1]
|
||||
)
|
||||
);
|
||||
// Next remove the visitor. Note we can't do both in a single query, looks like $wpdb doesn't like executing them together.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare( "DELETE FROM {$wpdb->prefix}statistics_visitor WHERE `id` = %s;", $item[0] )
|
||||
);
|
||||
}
|
||||
|
||||
$result_string = sprintf(
|
||||
__( '%s records purged successfully.', 'wp-statistics' ),
|
||||
'<code>' . count( $to_delete ) . '</code>'
|
||||
);
|
||||
} else {
|
||||
$result_string = __( 'No visitors found to purge.', 'wp-statistics' );
|
||||
}
|
||||
} else {
|
||||
$result_string = __( 'Number of hits must be greater than or equal to 10!', 'wp-statistics' );
|
||||
}
|
||||
|
||||
if ( $WP_Statistics->get_option( 'prune_report' ) == true ) {
|
||||
$blogname = get_bloginfo( 'name' );
|
||||
$blogemail = get_bloginfo( 'admin_email' );
|
||||
|
||||
$headers[] = "From: $blogname <$blogemail>";
|
||||
$headers[] = "MIME-Version: 1.0";
|
||||
$headers[] = "Content-type: text/html; charset=utf-8";
|
||||
|
||||
if ( $WP_Statistics->get_option( 'email_list' ) == '' ) {
|
||||
$WP_Statistics->update_option( 'email_list', $blogemail );
|
||||
}
|
||||
|
||||
wp_mail(
|
||||
$WP_Statistics->get_option( 'email_list' ),
|
||||
__( 'Database pruned on', 'wp-statistics' ) . ' ' . $blogname,
|
||||
$result_string,
|
||||
$headers
|
||||
);
|
||||
}
|
||||
|
||||
return $result_string;
|
||||
}
|
||||
154
wp-content/plugins/wp-statistics/includes/functions/purge.php
Normal file
154
wp-content/plugins/wp-statistics/includes/functions/purge.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
function wp_statistics_purge_data( $purge_days ) {
|
||||
global $wpdb, $WP_Statistics;
|
||||
|
||||
// If it's less than 30 days, don't do anything.
|
||||
if ( $purge_days > 30 ) {
|
||||
// Purge the visit data.
|
||||
$table_name = $wpdb->prefix . 'statistics_visit';
|
||||
$date_string = $WP_Statistics->current_date( 'Y-m-d', '-' . $purge_days );
|
||||
|
||||
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE `last_counter` < %s", $date_string ) );
|
||||
|
||||
if ( $result ) {
|
||||
// Update the historical count with what we purged.
|
||||
$historical_result = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}statistics_historical SET value = value + %d WHERE `category` = 'visits'", $result ) );
|
||||
if ( $historical_result == 0 ) {
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "statistics_historical",
|
||||
array(
|
||||
'value' => $result,
|
||||
'category' => 'visits',
|
||||
'page_id' => - 2,
|
||||
'uri' => '-2',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$result_string = sprintf( __( '%s data older than %s days purged successfully.', 'wp-statistics' ), '<code>' . $table_name . '</code>', '<code>' . $purge_days . '</code>' );
|
||||
} else {
|
||||
$result_string = sprintf( __( 'No records found to purge from %s!', 'wp-statistics' ), '<code>' . $table_name . '</code>' );
|
||||
}
|
||||
|
||||
// Purge the visitors data.
|
||||
$table_name = $wpdb->prefix . 'statistics_visitor';
|
||||
|
||||
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE `last_counter` < %s", $date_string ) );
|
||||
|
||||
if ( $result ) {
|
||||
// Update the historical count with what we purged.
|
||||
$historical_result = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}statistics_historical SET value = value + %d WHERE `category` = 'visitors'", $result ) );
|
||||
if ( $historical_result == 0 ) {
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "statistics_historical",
|
||||
array(
|
||||
'value' => $result,
|
||||
'category' => 'visitors',
|
||||
'page_id' => - 1,
|
||||
'uri' => '-1',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$result_string .= '<br>' . sprintf( __( '%s data older than %s days purged successfully.', 'wp-statistics' ), '<code>' . $table_name . '</code>', '<code>' . $purge_days . '</code>' );
|
||||
} else {
|
||||
$result_string .= '<br>' . sprintf( __( 'No records found to purge from %s!', 'wp-statistics' ), '<code>' . $table_name . '</code>' );
|
||||
}
|
||||
|
||||
// Purge the exclusions data.
|
||||
$table_name = $wpdb->prefix . 'statistics_exclusions';
|
||||
|
||||
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE `date` < %s", $date_string ) );
|
||||
|
||||
if ( $result ) {
|
||||
$result_string .= '<br>' . sprintf( __( '%s data older than %s days purged successfully.', 'wp-statistics' ), '<code>' . $table_name . '</code>', '<code>' . $purge_days . '</code>' );
|
||||
} else {
|
||||
$result_string .= '<br>' . sprintf( __( 'No records found to purge from %s!', 'wp-statistics' ), '<code>' . $table_name . '</code>' );
|
||||
}
|
||||
|
||||
// Purge the search data.
|
||||
$table_name = $wpdb->prefix . 'statistics_search';
|
||||
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE `last_counter` < %s", $date_string ) );
|
||||
|
||||
if ( $result ) {
|
||||
$result_string .= '<br>' . sprintf( __( '%s data older than %s days purged successfully.', 'wp-statistics' ), '<code>' . $table_name . '</code>', '<code>' . $purge_days . '</code>' );
|
||||
} else {
|
||||
$result_string .= '<br>' . sprintf( __( 'No records found to purge from %s!', 'wp-statistics' ), '<code>' . $table_name . '</code>' );
|
||||
}
|
||||
|
||||
// Purge the pages data, this is more complex as we want to save the historical data per page.
|
||||
$table_name = $wpdb->prefix . 'statistics_pages';
|
||||
$historical = 0;
|
||||
|
||||
// The first thing we need to do is update the historical data by finding all the unique pages.
|
||||
$result = $wpdb->get_results(
|
||||
$wpdb->prepare( "SELECT DISTINCT uri FROM {$table_name} WHERE `date` < %s", $date_string )
|
||||
);
|
||||
|
||||
// If we have a result, let's store the historical data.
|
||||
if ( $result ) {
|
||||
// Loop through all the unique rows that were returned.
|
||||
foreach ( $result as $row ) {
|
||||
// Use the unique rows to get a total count from the database of all the data from the given URIs/Pageids that we're going to delete later.
|
||||
$historical = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT sum(count) FROM {$table_name} WHERE `uri` = %s AND `date` < %s",
|
||||
$row->uri,
|
||||
$date_string
|
||||
)
|
||||
);
|
||||
|
||||
// Do an update of the historical data.
|
||||
$uresult = $wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"UPDATE {$wpdb->prefix}statistics_historical SET `value` = value + %d WHERE `uri` = %s AND `category` = 'uri'",
|
||||
$historical,
|
||||
$row->uri,
|
||||
$date_string
|
||||
)
|
||||
);
|
||||
|
||||
// If we failed it's because this is the first time we've seen this URI/pageid so let's create a historical row for it.
|
||||
if ( $uresult == 0 ) {
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "statistics_historical",
|
||||
array(
|
||||
'value' => $historical,
|
||||
'category' => 'uri',
|
||||
'uri' => $row->uri,
|
||||
'page_id' => wp_statistics_uri_to_id( $row->uri ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now that we've done all of the required historical data storage, we can actually delete the data from the database.
|
||||
$result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE `date` < %s", $date_string ) );
|
||||
|
||||
if ( $result ) {
|
||||
$result_string .= '<br>' . sprintf( __( '%s data older than %s days purged successfully.', 'wp-statistics' ), '<code>' . $table_name . '</code>', '<code>' . $purge_days . '</code>' );
|
||||
} else {
|
||||
$result_string .= '<br>' . sprintf( __( 'No records found to purge from %s!', 'wp-statistics' ), '<code>' . $table_name . '</code>' );
|
||||
}
|
||||
|
||||
if ( $WP_Statistics->get_option( 'prune_report' ) == true ) {
|
||||
$blogname = get_bloginfo( 'name' );
|
||||
$blogemail = get_bloginfo( 'admin_email' );
|
||||
|
||||
$headers[] = "From: $blogname <$blogemail>";
|
||||
$headers[] = "MIME-Version: 1.0";
|
||||
$headers[] = "Content-type: text/html; charset=utf-8";
|
||||
|
||||
if ( $WP_Statistics->get_option( 'email_list' ) == '' ) {
|
||||
$WP_Statistics->update_option( 'email_list', $blogemail );
|
||||
}
|
||||
|
||||
wp_mail( $WP_Statistics->get_option( 'email_list' ), __( 'Database pruned on', 'wp-statistics' ) . ' ' . WP_Statistics_Admin_Pages::sanitize_mail_subject( $blogname ), $result_string, $headers );
|
||||
}
|
||||
|
||||
return $result_string;
|
||||
} else {
|
||||
return __( 'Please select a value over 30 days.', 'wp-statistics' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) )
|
||||
exit;
|
||||
|
||||
function wp_statistic_tinymce_plugin_translation() {
|
||||
$lang = WP_Statistics_TinyMCE::lang();
|
||||
$translated = $lang['translate'];
|
||||
return $translated;
|
||||
}
|
||||
$strings = wp_statistic_tinymce_plugin_translation();
|
||||
Reference in New Issue
Block a user