Changeset 2330673
- Timestamp:
- 06/25/2020 01:16:58 PM (6 years ago)
- Location:
- rest-client-tap/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
admin/class-rest-client-tap-admin.php (modified) (1 diff)
-
includes/class-rest-client-tap.php (modified) (1 diff)
-
public/class-rest-client-tap-public.php (modified) (4 diffs)
-
rest-client-tap.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rest-client-tap/trunk/README.txt
r1810593 r2330673 4 4 Tags: api rest, tipster, pick 5 5 Requires at least: 3.5 6 Tested up to: 4.9.27 Stable tag: 1. 0.16 Tested up to: 5.4.2 7 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 54 54 55 55 = 1.0.1 = 56 * Added required filters for AlinkTap plugin 57 * Added some improvements 58 59 = 1.0.1 = 56 60 * Added unique function names in main plugin file. 57 61 -
rest-client-tap/trunk/admin/class-rest-client-tap-admin.php
r1810593 r2330673 113 113 114 114 $wp_customize->add_setting( 'tap_base_url', array( 115 'default' => 'http ://todoapuestas.com',115 'default' => 'https://todoapuestas.com', 116 116 'capability' => 'edit_theme_options', 117 117 'sanitize_callback' => 'sanitize_text_field', -
rest-client-tap/trunk/includes/class-rest-client-tap.php
r1810593 r2330673 178 178 $this->loader->add_filter( 'rest_client_tap_oauth_access_token', $plugin_public, 'get_oauth_access_token' ); 179 179 $this->loader->add_filter( 'rest_client_tap_get_result_from_api', $plugin_public, 'get_result_from_api', 10, 3 ); 180 180 181 $this->loader->add_filter('rest_client_tap_check_ip', $plugin_public, 'check_ip', 10, 2); 181 182 $this->loader->add_filter( 'rest_client_tap_request_block_bookies', $plugin_public, 'request_block_bookies' ); 182 183 } -
rest-client-tap/trunk/public/class-rest-client-tap-public.php
r1810593 r2330673 172 172 public function get_result_from_api($url, $assoc = true, $intention = 'Request result') 173 173 { 174 $apiResponse = wp_remote_get($url );174 $apiResponse = wp_remote_get($url, array('timeout' => 30)); 175 175 $apiResponseCode = wp_remote_retrieve_response_code($apiResponse); 176 176 $apiResponseBody = wp_remote_retrieve_body($apiResponse); … … 186 186 $error = sprintf( __( '[%s] Invalid response. %s', $this->plugin_name ), $intention, $error ); 187 187 $_SESSION['REST_CLIENT_TAP_ERRORS'][] = $error; 188 log_error($error);188 // log_error($error); 189 189 return null; 190 190 } … … 251 251 } 252 252 253 public function check_ip($ip) 254 { 253 public function check_ip($session_name, $ip = null) 254 { 255 $session_id = session_id(); 256 if(empty($session_id) && !headers_sent()) @session_start(); 257 if(is_null($ip)) { 258 $ip = $_SERVER['REMOTE_ADDR']; 259 if (array_key_exists('HTTP_X_REAL_IP', $_SERVER)) { 260 $ip = $_SERVER['HTTP_X_REAL_IP']; 261 } 262 } 263 if(isset($_SESSION[$session_name])){ 264 if(strcmp($ip, $_SESSION[$session_name]['client_ip']) === 0){ 265 $country = $_SESSION[$session_name]['client_country']; 266 return $country; 267 } 268 unset($_SESSION[$session_name]); 269 } 270 255 271 $url_check_ip = '%s/api/geoip/country-by-ip.json/%s/?access_token=%s&_=%s'; 256 272 $baseUrl = get_theme_mod( 'tap_base_url' ); … … 260 276 $apiUrl = esc_url(sprintf($url_check_ip, $baseUrl, $ip, $oauthAccessToken, $now->getTimestamp())); 261 277 $result = $this->get_result_from_api($apiUrl, true, 'Request Country by IP'); 262 // TODO: revisar funcionamiento. 263 return $result; 278 279 if ( ! isset( $_SESSION[$session_name] ) ) { 280 $_SESSION[$session_name] = array( 281 'client_ip' => $ip, 282 'client_country' => $result 283 ); 284 } 285 286 return $result; 264 287 } 265 288 } -
rest-client-tap/trunk/rest-client-tap.php
r1810593 r2330673 3 3 /** 4 4 * @link http://www.linkedin.com/in/mrbrazzi/ 5 * @since 1. 0.15 * @since 1.1 6 6 * @package RestClientTap 7 7 * … … 10 10 * Plugin URI: https://www.wordpress.org/plugins/rest-client-tap 11 11 * Description: Rest client plugin to TodoApuestas API services 12 * Version: 1. 0.012 * Version: 1.1 13 13 * Author: Alain Sanchez <luka.ghost@gmail.com> 14 14 * Author URI: http://www.linkedin.com/in/mrbrazzi/
Note: See TracChangeset
for help on using the changeset viewer.