Changeset 1965337
- Timestamp:
- 10/29/2018 07:14:34 PM (7 years ago)
- Location:
- evo-seo/trunk
- Files:
-
- 9 edited
-
admin/includes/class-evo-seo-post-metabox.php (modified) (2 diffs)
-
admin/includes/dashboard/overview/class-evo-seo-organic-traffic-handlers.php (modified) (4 diffs)
-
admin/includes/dashboard/overview/class-evo-seo-top-landing-pages-handlers.php (modified) (1 diff)
-
admin/includes/dashboard/overview/class-evo-seo-top-performing-keywords-handlers.php (modified) (2 diffs)
-
admin/includes/dashboard/redirect-manager/class-evo-seo-redirect-manager-handlers.php (modified) (2 diffs)
-
admin/js/evo-seo-post-metabox.js (modified) (3 diffs)
-
admin/views/dashboard/redirect-manager/index.php (modified) (2 diffs)
-
evo-seo.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
evo-seo/trunk/admin/includes/class-evo-seo-post-metabox.php
r1949891 r1965337 201 201 $screen = array_merge( $built_in_post_types, $custom_post_types ), 202 202 $context = 'normal', 203 $priority = 'high' 203 $priority = 'high', 204 $callback_args = array( 205 '__block_editor_compatible_meta_box' => true, 206 ) 204 207 ); 205 208 } … … 268 271 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 269 272 'wpNonce' => wp_create_nonce( self::NONCE_ACTION ), 273 'isGutenbergPage' => function_exists( 'is_gutenberg_page' ) && is_gutenberg_page(), 270 274 ) 271 275 ); -
evo-seo/trunk/admin/includes/dashboard/overview/class-evo-seo-organic-traffic-handlers.php
r1949891 r1965337 70 70 $data_ga = $this->_get_ga_traffic_data(); 71 71 72 if ( ( 401 === $data_gsc['code'] ) && ( 401 === $data_ga['code'] ) ) { 73 status_header( 401 ); 74 wp_send_json_error( null ); 75 wp_die(); 76 } 77 78 if ( ( 403 === $data_gsc['code'] ) && ( 403 === $data_ga['code'] ) ) { 79 status_header( 403 ); 80 wp_send_json_error( null ); 81 wp_die(); 72 // Respond with HTTP 401 or 403 if there was a problem fetching the data. 73 if ( isset( $data_gsc['code'] ) && isset( $data_ga['code'] ) ) { 74 if ( ( 401 === $data_gsc['code'] ) && ( 401 === $data_ga['code'] ) ) { 75 status_header( 401 ); 76 wp_send_json_error( null ); 77 wp_die(); 78 } 79 80 if ( ( 403 === $data_gsc['code'] ) && ( 403 === $data_ga['code'] ) ) { 81 status_header( 403 ); 82 wp_send_json_error( null ); 83 wp_die(); 84 } 82 85 } 83 86 … … 132 135 ); 133 136 134 // Get the traffic counts for the current date from the Search Console and 135 // Analytics data. 136 $traffic_gsc = $data_gsc[ $date_string ]; 137 $traffic_ga = $data_ga[ $date_string ]; 137 // Get the traffic count for the current date from Search Console data. 138 $traffic_gsc = null; 139 if ( isset( $data_gsc[ $date_string ] ) ) { 140 $traffic_gsc = $data_gsc[ $date_string ]; 141 } else { 142 $traffic_gsc = 0; 143 } 144 145 // Get the traffic counts for the current date from the Analytics data. 146 $traffic_ga = null; 147 if ( isset( $data_ga[ $date_string ] ) ) { 148 $traffic_ga = $data_ga[ $date_string ]; 149 } else { 150 $traffic_ga = 0; 151 } 138 152 139 153 // Store the traffic counts in the current data point. 140 $data_point['traffic_gsc'] = $traffic_gsc ? $traffic_gsc : 0;141 $data_point['traffic_ga'] = $traffic_ga ? $traffic_ga : 0;154 $data_point['traffic_gsc'] = $traffic_gsc; 155 $data_point['traffic_ga'] = $traffic_ga; 142 156 143 157 // Store chart data for the current date. … … 181 195 for ( $i = 0; $i < $num_data; $i++ ) { 182 196 $date_string = $data[ $i ]['keys'][0]; 183 $count = $data[ $i ]['clicks']; 197 198 // Current data point. 199 $data_i = $data[ $i ]; 200 201 // Number of clicks. 202 $count = 0; 203 if ( isset( $data_i['clicks'] ) ) { 204 $count = $data[ $i ]['clicks']; 205 } 184 206 185 207 $new_data[ $date_string ] = $count; … … 211 233 212 234 // Return null if no data was returned. 213 $data = $response['body']['reports'][0]['data']['rows']; 214 if ( ! $data ) { 235 $data = $response['body']['reports'][0]['data']; 236 if ( isset( $data['rows'] ) ) { 237 $data = $data['rows']; 238 } else { 215 239 return null; 216 240 } -
evo-seo/trunk/admin/includes/dashboard/overview/class-evo-seo-top-landing-pages-handlers.php
r1908787 r1965337 59 59 */ 60 60 public function get_top_landing_pages() { 61 // @codingStandardsIgnoreStart WordPress.VIP.ValidatedSanitizedInput.InputNotValidated62 // Extract nonce from the request.63 $nonce = sanitize_text_field( wp_unslash( $_POST[ self::NONCE_NAME ] ) );64 // @codingStandardsIgnoreEnd WordPress.VIP.ValidatedSanitizedInput.InputNotValidated65 66 61 // @codingStandardsIgnoreStart WordPress.CSRF.NonceVerification.NoNonceVerification 67 62 // Check nonce, will return HTTP Status Code 403 if nonce is invalid. -
evo-seo/trunk/admin/includes/dashboard/overview/class-evo-seo-top-performing-keywords-handlers.php
r1908787 r1965337 62 62 */ 63 63 public function get_top_performing_keywords() { 64 // @codingStandardsIgnoreStart WordPress.VIP.ValidatedSanitizedInput.InputNotValidated65 // Extract nonce from the request.66 $nonce = sanitize_text_field( wp_unslash( $_POST[ self::NONCE_NAME ] ) );67 // @codingStandardsIgnoreEnd WordPress.VIP.ValidatedSanitizedInput.InputNotValidated68 69 64 // @codingStandardsIgnoreStart WordPress.CSRF.NonceVerification.NoNonceVerification 70 65 // Check nonce, will return HTTP Status Code 403 if nonce is invalid. … … 76 71 77 72 // Return response to the front-end. 78 status_header( $response['code'] ); 73 $status_code = $response['code']; 74 status_header( $status_code ); 79 75 $status_code < 400 ? wp_send_json( $response['body'] ) : wp_send_json_error( $response ); 80 76 wp_die(); -
evo-seo/trunk/admin/includes/dashboard/redirect-manager/class-evo-seo-redirect-manager-handlers.php
r1908787 r1965337 1247 1247 } 1248 1248 1249 // Checks if URL contains Home URL. 1250 $is_full_url = strpos( $new_url, $home_url ); 1251 // If is full URL. 1252 if ( false !== $is_full_url ) { 1253 return $this->_get_page_by_url( $new_url ); 1254 } 1255 1256 // If there is no `/` at the beginning of $new_url, add it. 1257 $slash_position = strpos( $new_url, '/' ); 1258 if ( $slash_position > 0 || false === $slash_position ) { 1259 $new_url = '/' . $new_url; 1260 } 1261 1262 return $this->_get_page_by_path( $new_url ); 1249 // Try to get the post ID from the new URL. 1250 $post_id = $this->_get_post_id_from_url( $new_url ); 1251 1252 // If no post ID could be found, return an error. 1253 if ( 0 === $post_id ) { 1254 return array( 1255 'is_valid' => false, 1256 'id' => '', 1257 ); 1258 } 1259 1260 // If a post ID was found, return relative URL. 1261 return array( 1262 'is_valid' => true, 1263 'id' => $post_id, 1264 'slug' => wp_make_link_relative( get_permalink( $post_id ) ), 1265 ); 1263 1266 } 1264 1267 … … 1417 1420 return $wpdb->prefix . 'evo_seo_redirect'; 1418 1421 } 1422 1423 /** 1424 * Function: _get_post_id_from_url. 1425 * 1426 * Returns the Post ID associated with a post slug/URL. 1427 * 1428 * @param string $url URL or slug. 1429 * 1430 * @access private 1431 * @return int Post ID. 1432 */ 1433 private function _get_post_id_from_url( $url ) { 1434 // Attempt to parse the given URL into components. 1435 $parsed = wp_parse_url( $url ); 1436 1437 // Check for a path. 1438 if ( array_key_exists( 'path', $parsed ) ) { 1439 // Build a full URL. 1440 // Remove trailing slash from the site URL. 1441 $site_url = get_site_url(); 1442 1443 // Remove leading slash from the path. 1444 $path = ltrim( $parsed['path'], '/' ); 1445 1446 // Add path to the site URL. 1447 $permalink = $site_url . '/' . $path; 1448 1449 // Get the post ID from the permalink. 1450 return url_to_postid( $permalink ); 1451 } 1452 1453 // Return a post ID of 0 if no path was found. 1454 return 0; 1455 } 1419 1456 } -
evo-seo/trunk/admin/js/evo-seo-post-metabox.js
r1957099 r1965337 1140 1140 newPost = _EVO_SEO_WP.newPost; 1141 1141 1142 var isGutenbergPage = EVO_SEO_WP.isGutenbergPage === '1'; 1143 1142 1144 // Exit early if not editing a Post or a Page. 1143 1144 1145 if (!(editPost || newPost)) { 1145 1146 return; … … 1274 1275 var slug = event.target.value; 1275 1276 1277 // Update SERP with new Permalink URL if the Gutenberg Editor is used. 1278 if (isGutenbergPage) { 1279 // Permalink URL. 1280 var _permalink = void 0; 1281 1282 // Click on the page title block. 1283 var $pageTitleBlock = $('textarea#post-title-0'); 1284 1285 // Set focus to the page title block to expose the Permalink input box. 1286 $pageTitleBlock.trigger('focus'); 1287 1288 // Create reference on the `Edit` permalink button. 1289 var $btnEditPermalink = $('button.editor-post-permalink__edit'); 1290 1291 // If there is an `Edit` permalink button, then a non-Plain permalink 1292 // structure is set. 1293 if ($btnEditPermalink && $btnEditPermalink.length === 1) { 1294 // Click on the `Edit` permalink button. 1295 $btnEditPermalink.trigger('click'); 1296 1297 // Create a new permalink URL using the updated slug. 1298 var $formPermalinkEditor = $('.editor-post-permalink-editor'); 1299 var prefix = $formPermalinkEditor.find('.editor-post-permalink-editor__prefix').text(); 1300 var suffix = $formPermalinkEditor.find('.editor-post-permalink-editor__suffix').text(); 1301 _permalink = '' + prefix + slug + suffix; 1302 } else { 1303 // If there is no `Edit` permalink button, then a Plain permalink structure 1304 // is set. Changes to the slug will not change the permalink URL. 1305 // Use existing permalink URL. 1306 _permalink = $('a.editor-post-permalink__link').attr('href'); 1307 } 1308 1309 // Update SERP with new permalink. 1310 $preview.all.permalink.html(_permalink); 1311 1312 // Set focus to the EVO `Slug` input box. 1313 $inputSlug.trigger('focus'); 1314 1315 return; 1316 } 1317 1276 1318 // Hold a reference to the sample permalink DOM node. 1277 1319 // There are three cases: … … 1423 1465 if (title.length === 0) { 1424 1466 // If the SEO title is blank, use title from the editor. 1425 $inputTitle.val($('input[name="post_title"]').val()); 1467 var editorText = isGutenbergPage ? $('textarea#post-title-0').val() : $('input[name="post_title"]').val(); 1468 $inputTitle.val(editorText); 1426 1469 } else { 1427 1470 $inputTitle.val(title); -
evo-seo/trunk/admin/views/dashboard/redirect-manager/index.php
r1908787 r1965337 15 15 ), 16 16 ); 17 18 global $evo_seo_compatibility_check; 19 $prerequisites = array( 20 $evo_seo_compatibility_check->is_permalink_structure_set(), 21 ); 22 $warnings = $evo_seo_compatibility_check->generate_warnings( $prerequisites ); 23 $has_warnings = ! empty( $warnings ); 24 17 25 ?> 18 26 … … 29 37 <div class="page-content"> 30 38 <?php 31 include $evo_seo_redirect_manager_view_index['path'][' redirect_manager'] . 'redirect-alert-banner.php';39 include $evo_seo_redirect_manager_view_index['path']['partials'] . 'pages-navbar.php'; 32 40 ?> 33 41 </div> 34 42 35 <div class="page-content"> 36 <?php 37 include $evo_seo_redirect_manager_view_index['path']['partials'] . 'pages-navbar.php'; 38 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'redirect-manager.php'; 39 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'plain-redirects.php'; 40 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'list-404s-and-redirects.php'; 41 ?> 42 </div> 43 <?php if ( $has_warnings ) : ?> 44 <div class="page-content"> 45 <div class="container-warnings"> 46 <?php foreach ( $warnings as $warning ) : ?> 47 <?php // @codingStandardsIgnoreStart WordPress.XSS.EscapeOutput.OutputNotEscaped ?> 48 <?php echo $warning; ?> 49 <?php // @codingStandardsIgnoreEnd WordPress.XSS.EscapeOutput.OutputNotEscaped ?> 50 <?php endforeach; ?> 51 </div> 52 </div> 53 54 <?php else : ?> 55 <div class="page-content"> 56 <?php 57 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'redirect-alert-banner.php'; 58 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'redirect-manager.php'; 59 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'plain-redirects.php'; 60 include $evo_seo_redirect_manager_view_index['path']['redirect_manager'] . 'list-404s-and-redirects.php'; 61 ?> 62 </div> 63 <?php endif; ?> 64 65 43 66 </div> -
evo-seo/trunk/evo-seo.php
r1957099 r1965337 12 12 * Plugin URI: https://wordpress.org/plugins/evo-seo/ 13 13 * Description: EVO is a powerful, all-in-one SEO tool made by SEOs. 14 * Version: 1.0. 714 * Version: 1.0.8 15 15 * Author: evoseo 16 16 * Author URI: https://evoplugin.com/ -
evo-seo/trunk/readme.txt
r1957099 r1965337 6 6 Loop Chain Detector, Fix 404, Robots.txt, htaccess, Cache, SERP, Search Engine Result Preview, Social, Sharing, 7 7 Facebook, Twitter, JSON-LD, Schema 8 Version: 1.0. 78 Version: 1.0.8 9 9 Requires at least: 4.8.0 10 10 Tested up to: 4.9.8 … … 110 110 == Changelog == 111 111 112 = 1.0.8 = 113 * Minimal Gutenberg Compatibility 114 * Redirect Manager Compatibility and Prerequisite Checks 115 * Redirect Manager Export and Import Support Custom Post Types 116 112 117 = 1.0.7 = 113 118 * Custom Post Type Support in XML Sitemaps … … 154 159 == Upgrade Notice == 155 160 161 = 1.0.8 = 162 * None 163 156 164 = 1.0.7 = 157 165 * None
Note: See TracChangeset
for help on using the changeset viewer.