Version Description
- Fix: don't show raw shortcodes in auto-generated meta description
- Fix: better compatibility of readability and SEO analysis with page builders
- Fix: made Google preview in the SC metabox more accurate
Download this release
Release Info
| Developer | khaxan |
| Plugin | |
| Version | 2.2.2.4 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2.2.3 to 2.2.2.4
- changelog.txt +6 -0
- class-mappings.php +1 -0
- includes/admin/admin.php +2 -0
- includes/admin/metabox.php +2 -6
- includes/admin/templates/metabox/metabox-preview.php +9 -39
- includes/core/class-wds-compatibility.php +97 -0
- includes/core/class-wds-controller-cron-free.php +0 -395
- includes/core/class-wds-controller-hub-free.php +0 -174
- includes/core/core.php +1 -1
- includes/core/service/class-wds-checkup-rest-service-free.php +0 -148
- includes/core/service/class-wds-seo-service-free.php +0 -216
- includes/js/wds-metabox.js +7 -3
- languages/wpmu-dev-seo.pot +27 -35
- readme.txt +7 -1
- wpmu-dev-seo.php +2 -2
changelog.txt
CHANGED
|
@@ -2,6 +2,12 @@ Plugin Name: SmartCrawl SEO
|
|
| 2 |
|
| 3 |
Change Log:
|
| 4 |
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
2.2.2.3 - 2018-08-31
|
| 6 |
----------------------------------------------------------------------
|
| 7 |
- Fix: fixed SEO checkup for free version
|
| 2 |
|
| 3 |
Change Log:
|
| 4 |
----------------------------------------------------------------------
|
| 5 |
+
2.2.2.4 - 2018-09-25
|
| 6 |
+
----------------------------------------------------------------------
|
| 7 |
+
- Fix: don't show raw shortcodes in auto-generated meta description
|
| 8 |
+
- Fix: better compatibility of readability and SEO analysis with page builders
|
| 9 |
+
- Fix: made Google preview in the SC metabox more accurate
|
| 10 |
+
|
| 11 |
2.2.2.3 - 2018-08-31
|
| 12 |
----------------------------------------------------------------------
|
| 13 |
- Fix: fixed SEO checkup for free version
|
class-mappings.php
CHANGED
|
@@ -4,6 +4,7 @@ return array(
|
|
| 4 |
// Classes in includes/core/
|
| 5 |
'Smartcrawl_AIOSEOP_Importer' => '/core/class-wds-aioseop-importer.php',
|
| 6 |
'Smartcrawl_Checks' => '/core/class-wds-checks.php',
|
|
|
|
| 7 |
'Smartcrawl_Controller_Analysis' => '/core/class-wds-controller-analysis.php',
|
| 8 |
'Smartcrawl_Controller_Cron' => '/core/class-wds-controller-cron.php',
|
| 9 |
'Smartcrawl_Controller_Hub' => '/core/class-wds-controller-hub.php',
|
| 4 |
// Classes in includes/core/
|
| 5 |
'Smartcrawl_AIOSEOP_Importer' => '/core/class-wds-aioseop-importer.php',
|
| 6 |
'Smartcrawl_Checks' => '/core/class-wds-checks.php',
|
| 7 |
+
'Smartcrawl_Compatibility' => '/core/class-wds-compatibility.php',
|
| 8 |
'Smartcrawl_Controller_Analysis' => '/core/class-wds-controller-analysis.php',
|
| 9 |
'Smartcrawl_Controller_Cron' => '/core/class-wds-controller-cron.php',
|
| 10 |
'Smartcrawl_Controller_Hub' => '/core/class-wds-controller-hub.php',
|
includes/admin/admin.php
CHANGED
|
@@ -111,6 +111,8 @@ class Smartcrawl_Admin extends Smartcrawl_Renderable {
|
|
| 111 |
Smartcrawl_Metabox::run();
|
| 112 |
Smartcrawl_Taxonomy::run();
|
| 113 |
}
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
|
| 116 |
/**
|
| 111 |
Smartcrawl_Metabox::run();
|
| 112 |
Smartcrawl_Taxonomy::run();
|
| 113 |
}
|
| 114 |
+
|
| 115 |
+
Smartcrawl_Compatibility::run();
|
| 116 |
}
|
| 117 |
|
| 118 |
/**
|
includes/admin/metabox.php
CHANGED
|
@@ -85,12 +85,10 @@ class Smartcrawl_Metabox extends Smartcrawl_Renderable {
|
|
| 85 |
*/
|
| 86 |
public function json_create_preview() {
|
| 87 |
$data = $this->get_request_data();
|
| 88 |
-
$title = sanitize_text_field( smartcrawl_get_array_value( $data, 'title' ) );
|
| 89 |
-
$description = sanitize_text_field( smartcrawl_get_array_value( $data, 'description' ) );
|
| 90 |
$post_id = (int) smartcrawl_get_array_value( $data, 'post_id' );
|
| 91 |
$result = array( 'success' => false );
|
| 92 |
|
| 93 |
-
if (
|
| 94 |
wp_send_json( $result );
|
| 95 |
|
| 96 |
return;
|
|
@@ -99,9 +97,7 @@ class Smartcrawl_Metabox extends Smartcrawl_Renderable {
|
|
| 99 |
$latest_post_version = smartcrawl_get_latest_post_version( $post_id );
|
| 100 |
$result['success'] = true;
|
| 101 |
$result['markup'] = $this->_load( 'metabox/metabox-preview', array(
|
| 102 |
-
'post'
|
| 103 |
-
'title' => $title,
|
| 104 |
-
'description' => $description,
|
| 105 |
) );
|
| 106 |
|
| 107 |
wp_send_json( $result );
|
| 85 |
*/
|
| 86 |
public function json_create_preview() {
|
| 87 |
$data = $this->get_request_data();
|
|
|
|
|
|
|
| 88 |
$post_id = (int) smartcrawl_get_array_value( $data, 'post_id' );
|
| 89 |
$result = array( 'success' => false );
|
| 90 |
|
| 91 |
+
if ( empty( $post_id ) ) {
|
| 92 |
wp_send_json( $result );
|
| 93 |
|
| 94 |
return;
|
| 97 |
$latest_post_version = smartcrawl_get_latest_post_version( $post_id );
|
| 98 |
$result['success'] = true;
|
| 99 |
$result['markup'] = $this->_load( 'metabox/metabox-preview', array(
|
| 100 |
+
'post' => $latest_post_version,
|
|
|
|
|
|
|
| 101 |
) );
|
| 102 |
|
| 103 |
wp_send_json( $result );
|
includes/admin/templates/metabox/metabox-preview.php
CHANGED
|
@@ -6,53 +6,23 @@
|
|
| 6 |
*/
|
| 7 |
|
| 8 |
$post = empty( $post ) ? null : $post;
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
$date = $post ? date( 'M j, Y', strtotime( $post->post_date ) ) : date( 'M j, Y' );
|
| 12 |
-
// Title.
|
| 13 |
-
$title = empty( $title ) ? smartcrawl_get_value( 'title' ) : $title;
|
| 14 |
-
if ( empty( $title ) && $post ) {
|
| 15 |
-
$title = $post->post_title;
|
| 16 |
-
}
|
| 17 |
-
if ( empty( $title ) ) {
|
| 18 |
-
$title = esc_html__( 'Dummy Title', 'wds' );
|
| 19 |
-
}
|
| 20 |
-
if ( is_object( $post ) ) {
|
| 21 |
-
$title = smartcrawl_replace_vars( $title, (array) $post );
|
| 22 |
}
|
| 23 |
|
| 24 |
-
|
| 25 |
-
$
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
}
|
| 32 |
-
if ( empty( $description ) ) {
|
| 33 |
-
$description = __( 'Dummy description', 'wds' );
|
| 34 |
-
}
|
| 35 |
-
if ( is_object( $post ) ) {
|
| 36 |
-
$description = smartcrawl_replace_vars( $description, (array) $post );
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
// Slug.
|
| 40 |
-
$slug = ! empty( $post->post_name ) ? $post->post_name : sanitize_title( $title );
|
| 41 |
?>
|
| 42 |
<div class="wds-metabox-preview">
|
| 43 |
<label class="wds-label"><?php esc_html_e( 'Google Preview' ); ?></label>
|
| 44 |
|
| 45 |
<?php
|
| 46 |
if ( apply_filters( 'wds-metabox-visible_parts-preview_area', true ) ) {
|
| 47 |
-
$link = sprintf(
|
| 48 |
-
'%s/%s/',
|
| 49 |
-
str_replace( 'http://', '', get_bloginfo( 'url' ) ),
|
| 50 |
-
$slug
|
| 51 |
-
);
|
| 52 |
-
if ( ! empty( $post ) && is_object( $post ) && ! empty( $post->ID ) ) {
|
| 53 |
-
$link = get_permalink( $post->ID );
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
$this->_render( 'onpage/onpage-preview', array(
|
| 57 |
'link' => esc_url( $link ),
|
| 58 |
'title' => esc_html( $title ),
|
| 6 |
*/
|
| 7 |
|
| 8 |
$post = empty( $post ) ? null : $post;
|
| 9 |
+
if ( ! $post ) {
|
| 10 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
}
|
| 12 |
|
| 13 |
+
$post_parent = wp_is_post_revision( $post->ID );
|
| 14 |
+
$link = empty( $post_parent ) ? get_permalink( $post->ID ) : get_permalink( $post_parent );
|
| 15 |
+
$resolver = Smartcrawl_Endpoint_Resolver::resolve();
|
| 16 |
+
$resolver->simulate_post( $post->ID );
|
| 17 |
+
$title = Smartcrawl_OnPage::get()->get_title();
|
| 18 |
+
$description = Smartcrawl_OnPage::get()->get_description();
|
| 19 |
+
$resolver->stop_simulation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
?>
|
| 21 |
<div class="wds-metabox-preview">
|
| 22 |
<label class="wds-label"><?php esc_html_e( 'Google Preview' ); ?></label>
|
| 23 |
|
| 24 |
<?php
|
| 25 |
if ( apply_filters( 'wds-metabox-visible_parts-preview_area', true ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
$this->_render( 'onpage/onpage-preview', array(
|
| 27 |
'link' => esc_url( $link ),
|
| 28 |
'title' => esc_html( $title ),
|
includes/core/class-wds-compatibility.php
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Class Smartcrawl_Compatibility
|
| 5 |
+
*
|
| 6 |
+
* Fixes third-party compatibility issues
|
| 7 |
+
*/
|
| 8 |
+
class Smartcrawl_Compatibility {
|
| 9 |
+
/**
|
| 10 |
+
* Singleton instance
|
| 11 |
+
*
|
| 12 |
+
* @var Smartcrawl_Compatibility
|
| 13 |
+
*/
|
| 14 |
+
private static $_instance;
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Currently running state flag
|
| 18 |
+
*
|
| 19 |
+
* @var bool
|
| 20 |
+
*/
|
| 21 |
+
private $_is_running = false;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Constructor
|
| 25 |
+
*/
|
| 26 |
+
private function __construct() {
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Boot controller listeners
|
| 31 |
+
*
|
| 32 |
+
* Do it only once, if they're already up do nothing
|
| 33 |
+
*
|
| 34 |
+
* @return bool Status
|
| 35 |
+
*/
|
| 36 |
+
public static function run() {
|
| 37 |
+
$me = self::get();
|
| 38 |
+
if ( $me->is_running() ) {
|
| 39 |
+
return false;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return $me->_add_hooks();
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Obtain instance without booting up
|
| 47 |
+
*
|
| 48 |
+
* @return Smartcrawl_Compatibility instance
|
| 49 |
+
*/
|
| 50 |
+
public static function get() {
|
| 51 |
+
if ( empty( self::$_instance ) ) {
|
| 52 |
+
self::$_instance = new self();
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
return self::$_instance;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Check if we already have the actions bound
|
| 60 |
+
*
|
| 61 |
+
* @return bool Status
|
| 62 |
+
*/
|
| 63 |
+
public function is_running() {
|
| 64 |
+
return $this->_is_running;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Bind listening actions
|
| 69 |
+
*
|
| 70 |
+
* @return bool
|
| 71 |
+
*/
|
| 72 |
+
private function _add_hooks() {
|
| 73 |
+
add_action( 'init', array( $this, 'load_divi_in_ajax' ), - 10 );
|
| 74 |
+
|
| 75 |
+
$this->_is_running = true;
|
| 76 |
+
|
| 77 |
+
return true;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Divi doesn't usually load its shortcodes during ajax requests but we need these shortcodes in order to
|
| 82 |
+
* render an accurate preview.
|
| 83 |
+
*
|
| 84 |
+
* Force Divi to load during our requests.
|
| 85 |
+
*/
|
| 86 |
+
public function load_divi_in_ajax() {
|
| 87 |
+
$data = isset( $_POST['_wds_nonce'] )
|
| 88 |
+
&& (
|
| 89 |
+
wp_verify_nonce( $_POST['_wds_nonce'], 'wds-metabox-nonce' )
|
| 90 |
+
|| wp_verify_nonce( $_POST['_wds_nonce'], 'wds-onpage-nonce' )
|
| 91 |
+
);
|
| 92 |
+
|
| 93 |
+
if ( ! empty( $data ) && is_admin() && smartcrawl_is_switch_active( 'DOING_AJAX' ) ) {
|
| 94 |
+
$_POST['et_load_builder_modules'] = '1';
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
}
|
includes/core/class-wds-controller-cron-free.php
DELETED
|
@@ -1,395 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Periodical execution module
|
| 4 |
-
*
|
| 5 |
-
* @package wpmu-dev-seo
|
| 6 |
-
*/
|
| 7 |
-
|
| 8 |
-
/**
|
| 9 |
-
* Cron controller
|
| 10 |
-
*/
|
| 11 |
-
class Smartcrawl_Controller_Cron {
|
| 12 |
-
|
| 13 |
-
const ACTION_CRAWL = 'wds-cron-start_service';
|
| 14 |
-
const ACTION_CHECKUP = 'wds-cron-start_checkup';
|
| 15 |
-
const ACTION_CHECKUP_RESULT = 'wds-cron-checkup_result';
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Singleton instance
|
| 19 |
-
*
|
| 20 |
-
* @var Smartcrawl_Controller_Cron
|
| 21 |
-
*/
|
| 22 |
-
private static $_instance;
|
| 23 |
-
|
| 24 |
-
/**
|
| 25 |
-
* Controller actively running flag
|
| 26 |
-
*
|
| 27 |
-
* @var bool
|
| 28 |
-
*/
|
| 29 |
-
private $_is_running = false;
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* Constructor
|
| 33 |
-
*/
|
| 34 |
-
private function __construct() {
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
/**
|
| 38 |
-
* Singleton instance getter
|
| 39 |
-
*
|
| 40 |
-
* @return object Smartcrawl_Controller_Cron instance
|
| 41 |
-
*/
|
| 42 |
-
public static function get() {
|
| 43 |
-
if ( empty( self::$_instance ) ) {
|
| 44 |
-
self::$_instance = new self();
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
return self::$_instance;
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
/**
|
| 51 |
-
* Boots controller interface
|
| 52 |
-
*
|
| 53 |
-
* @return bool
|
| 54 |
-
*/
|
| 55 |
-
public function run() {
|
| 56 |
-
if ( ! $this->is_running() ) {
|
| 57 |
-
$this->_add_hooks();
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
return $this->is_running();
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* Check whether controller interface is active
|
| 65 |
-
*
|
| 66 |
-
* @return bool
|
| 67 |
-
*/
|
| 68 |
-
public function is_running() {
|
| 69 |
-
return ! ! $this->_is_running;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
/**
|
| 73 |
-
* Sets up controller listening interface
|
| 74 |
-
*
|
| 75 |
-
* Also sets up controller running flag approprietly.
|
| 76 |
-
*
|
| 77 |
-
* @return void
|
| 78 |
-
*/
|
| 79 |
-
private function _add_hooks() {
|
| 80 |
-
|
| 81 |
-
add_filter( 'cron_schedules', array( $this, 'add_cron_schedule_intervals' ) );
|
| 82 |
-
|
| 83 |
-
$copts = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_SITEMAP );
|
| 84 |
-
if ( ! empty( $copts['crawler-cron-enable'] ) ) {
|
| 85 |
-
add_action( $this->get_filter( self::ACTION_CRAWL ), array( $this, 'start_crawl' ) );
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
$chopts = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_CHECKUP );
|
| 89 |
-
if ( ! empty( $chopts['checkup-cron-enable'] ) ) {
|
| 90 |
-
add_action( $this->get_filter( self::ACTION_CHECKUP ), array( $this, 'start_checkup' ) );
|
| 91 |
-
add_action( $this->get_filter( self::ACTION_CHECKUP_RESULT ), array( $this, 'check_checkup_result' ) );
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
$this->_is_running = true;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/**
|
| 98 |
-
* Gets prefixed filter action
|
| 99 |
-
*
|
| 100 |
-
* @param string $what Filter action suffix.
|
| 101 |
-
*
|
| 102 |
-
* @return string Full filter action
|
| 103 |
-
*/
|
| 104 |
-
public function get_filter( $what ) {
|
| 105 |
-
return 'wds-controller-cron-' . $what;
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
/**
|
| 109 |
-
* Controller interface stop
|
| 110 |
-
*
|
| 111 |
-
* @return bool
|
| 112 |
-
*/
|
| 113 |
-
public function stop() {
|
| 114 |
-
if ( $this->is_running() ) {
|
| 115 |
-
$this->_remove_hooks();
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
return $this->is_running();
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
/**
|
| 122 |
-
* Tears down controller listening interface
|
| 123 |
-
*
|
| 124 |
-
* Also sets up controller running flag approprietly.
|
| 125 |
-
*
|
| 126 |
-
* @return void
|
| 127 |
-
*/
|
| 128 |
-
private function _remove_hooks() {
|
| 129 |
-
|
| 130 |
-
remove_action( $this->get_filter( self::ACTION_CRAWL ), array( $this, 'start_crawl' ) );
|
| 131 |
-
remove_action( $this->get_filter( self::ACTION_CHECKUP ), array( $this, 'start_checkup' ) );
|
| 132 |
-
remove_filter( 'cron_schedules', array( $this, 'add_cron_schedule_intervals' ) );
|
| 133 |
-
|
| 134 |
-
$this->_is_running = false;
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
/**
|
| 138 |
-
* Gets estimated next event time based on parameters
|
| 139 |
-
*
|
| 140 |
-
* @param int $pivot Pivot time - base estimation relative to this (UNIX timestamp).
|
| 141 |
-
* @param strng $frequency Valid frequency interval.
|
| 142 |
-
* @param int $dow Day of the week (0-6).
|
| 143 |
-
* @param int $tod Time of day (0-23).
|
| 144 |
-
*
|
| 145 |
-
* @return int Estimated next event time as UNIX timestamp
|
| 146 |
-
*/
|
| 147 |
-
public function get_estimated_next_event( $pivot, $frequency, $dow, $tod ) {
|
| 148 |
-
$start = $this->get_initial_pivot_time( $pivot, $frequency );
|
| 149 |
-
$offset = $start + ( $dow * DAY_IN_SECONDS );
|
| 150 |
-
$time = strtotime( date( "Y-m-d {$tod}:00", $offset ) );
|
| 151 |
-
$freqs = array(
|
| 152 |
-
'daily' => DAY_IN_SECONDS,
|
| 153 |
-
'weekly' => 7 * DAY_IN_SECONDS,
|
| 154 |
-
'monthly' => 30 * DAY_IN_SECONDS,
|
| 155 |
-
);
|
| 156 |
-
if ( $time > $pivot ) {
|
| 157 |
-
return $time;
|
| 158 |
-
}
|
| 159 |
-
|
| 160 |
-
$freq = $freqs[ $this->get_valid_frequency( $frequency ) ];
|
| 161 |
-
|
| 162 |
-
return $time + $freq;
|
| 163 |
-
}
|
| 164 |
-
|
| 165 |
-
/**
|
| 166 |
-
* Gets primed pivot time for a given frequency value
|
| 167 |
-
*
|
| 168 |
-
* @param int $pivot Raw pivot UNIX timestamp.
|
| 169 |
-
* @param string $frequency Frequency interval.
|
| 170 |
-
*
|
| 171 |
-
* @return int Zeroed pivot time for given frequency interval
|
| 172 |
-
*/
|
| 173 |
-
public function get_initial_pivot_time( $pivot, $frequency ) {
|
| 174 |
-
$frequency = $this->get_valid_frequency( $frequency );
|
| 175 |
-
|
| 176 |
-
if ( 'daily' === $frequency ) {
|
| 177 |
-
return strtotime( date( 'Y-m-d 00:00', $pivot ) );
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
if ( 'weekly' === $frequency ) {
|
| 181 |
-
$monday = strtotime( 'this monday', $pivot );
|
| 182 |
-
if ( $monday > $pivot ) {
|
| 183 |
-
return $monday - ( 7 * DAY_IN_SECONDS );
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
return $monday;
|
| 187 |
-
}
|
| 188 |
-
|
| 189 |
-
if ( 'monthly' === $frequency ) {
|
| 190 |
-
$day = (int) date( 'd', $pivot );
|
| 191 |
-
$today = strtotime( date( 'Y-m-d H:i', $pivot ) );
|
| 192 |
-
|
| 193 |
-
return $today - ( $day * DAY_IN_SECONDS );
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
return $pivot;
|
| 197 |
-
}
|
| 198 |
-
|
| 199 |
-
/**
|
| 200 |
-
* Gets validated frequency interval
|
| 201 |
-
*
|
| 202 |
-
* @param string $freq Raw frequency string.
|
| 203 |
-
*
|
| 204 |
-
* @return string
|
| 205 |
-
*/
|
| 206 |
-
public function get_valid_frequency( $freq ) {
|
| 207 |
-
if ( in_array( $freq, array_keys( $this->get_frequencies() ), true ) ) {
|
| 208 |
-
return $freq;
|
| 209 |
-
}
|
| 210 |
-
|
| 211 |
-
return $this->get_default_frequency();
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
/**
|
| 215 |
-
* Gets a list of frequency intervals
|
| 216 |
-
*
|
| 217 |
-
* @return array
|
| 218 |
-
*/
|
| 219 |
-
public function get_frequencies() {
|
| 220 |
-
return array(
|
| 221 |
-
'daily' => __( 'Daily', 'wds' ),
|
| 222 |
-
'weekly' => __( 'Weekly', 'wds' ),
|
| 223 |
-
'monthly' => __( 'Monthly', 'wds' ),
|
| 224 |
-
);
|
| 225 |
-
}
|
| 226 |
-
|
| 227 |
-
/**
|
| 228 |
-
* Gets default frequency interval (fallback)
|
| 229 |
-
*
|
| 230 |
-
* @return string
|
| 231 |
-
*/
|
| 232 |
-
public function get_default_frequency() {
|
| 233 |
-
return 'weekly';
|
| 234 |
-
}
|
| 235 |
-
|
| 236 |
-
/**
|
| 237 |
-
* Checks whether we have a next event scheduled
|
| 238 |
-
*
|
| 239 |
-
* @param string $event Optional event name, defaults to service start.
|
| 240 |
-
*
|
| 241 |
-
* @return bool
|
| 242 |
-
*/
|
| 243 |
-
public function has_next_event( $event = false ) {
|
| 244 |
-
return ! ! $this->get_next_event( $event );
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
/**
|
| 248 |
-
* Gets next scheduled event time
|
| 249 |
-
*
|
| 250 |
-
* @param string $event Optional event name, defaults to service start.
|
| 251 |
-
*
|
| 252 |
-
* @return int|bool UNIX timestamp or false if no next event
|
| 253 |
-
*/
|
| 254 |
-
public function get_next_event( $event = false ) {
|
| 255 |
-
$event = ! empty( $event ) ? $event : self::ACTION_CRAWL;
|
| 256 |
-
|
| 257 |
-
return wp_next_scheduled( $this->get_filter( $event ) );
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
/**
|
| 261 |
-
* Unschedules a particular event
|
| 262 |
-
*
|
| 263 |
-
* @param string $event Optional event name, defaults to service start.
|
| 264 |
-
*
|
| 265 |
-
* @return bool
|
| 266 |
-
*/
|
| 267 |
-
public function unschedule( $event = false ) {
|
| 268 |
-
return false; // Not in the free version.
|
| 269 |
-
}
|
| 270 |
-
|
| 271 |
-
/**
|
| 272 |
-
* Schedules a particular event
|
| 273 |
-
*
|
| 274 |
-
* @param string $event Event name.
|
| 275 |
-
* @param int $time UNIX timestamp.
|
| 276 |
-
* @param string $recurrence Event recurrence.
|
| 277 |
-
*
|
| 278 |
-
* @return bool
|
| 279 |
-
*/
|
| 280 |
-
public function schedule( $event, $time, $recurrence = false ) {
|
| 281 |
-
return false; // Not in the free version.
|
| 282 |
-
}
|
| 283 |
-
|
| 284 |
-
/**
|
| 285 |
-
* Sets up overall schedules
|
| 286 |
-
*
|
| 287 |
-
* @uses Smartcrawl_Controller_Cron::set_up_checkup_schedule()
|
| 288 |
-
* @uses Smartcrawl_Controller_Cron::set_up_crawler_schedule()
|
| 289 |
-
*
|
| 290 |
-
* @return void
|
| 291 |
-
*/
|
| 292 |
-
public function set_up_schedule() {
|
| 293 |
-
Smartcrawl_Logger::debug( 'Setting up schedules' );
|
| 294 |
-
$this->set_up_crawler_schedule();
|
| 295 |
-
$this->set_up_checkup_schedule();
|
| 296 |
-
}
|
| 297 |
-
|
| 298 |
-
/**
|
| 299 |
-
* Sets up crawl service schedule
|
| 300 |
-
*
|
| 301 |
-
* @return bool
|
| 302 |
-
*/
|
| 303 |
-
public function set_up_crawler_schedule() {
|
| 304 |
-
return false; // Not in the free version.
|
| 305 |
-
}
|
| 306 |
-
|
| 307 |
-
/**
|
| 308 |
-
* Sets up checkup service schedule
|
| 309 |
-
*
|
| 310 |
-
* @return bool
|
| 311 |
-
*/
|
| 312 |
-
public function set_up_checkup_schedule() {
|
| 313 |
-
return false; // Not in the free version.
|
| 314 |
-
}
|
| 315 |
-
|
| 316 |
-
/**
|
| 317 |
-
* Starts crawl
|
| 318 |
-
*
|
| 319 |
-
* @return bool
|
| 320 |
-
*/
|
| 321 |
-
public function start_crawl() {
|
| 322 |
-
return false; // Not in the free version.
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
/**
|
| 326 |
-
* Starts checkup
|
| 327 |
-
*
|
| 328 |
-
* @return bool
|
| 329 |
-
*/
|
| 330 |
-
public function start_checkup() {
|
| 331 |
-
return false; // Not in the free version.
|
| 332 |
-
}
|
| 333 |
-
|
| 334 |
-
/**
|
| 335 |
-
* Checks checkup result for cron action
|
| 336 |
-
*
|
| 337 |
-
* Schedules another singular check after timeout if not ready yet.
|
| 338 |
-
*
|
| 339 |
-
* @return bool
|
| 340 |
-
*/
|
| 341 |
-
public function check_checkup_result() {
|
| 342 |
-
return false; // Not in the free version.
|
| 343 |
-
}
|
| 344 |
-
|
| 345 |
-
/**
|
| 346 |
-
* Gets time delay for checkup ping individual requests
|
| 347 |
-
*
|
| 348 |
-
* @return int
|
| 349 |
-
*/
|
| 350 |
-
public function get_checkup_ping_delay() {
|
| 351 |
-
return 600;
|
| 352 |
-
}
|
| 353 |
-
|
| 354 |
-
/**
|
| 355 |
-
* Set up cron schedule intervals
|
| 356 |
-
*
|
| 357 |
-
* @param array $intervals Intervals known this far.
|
| 358 |
-
*
|
| 359 |
-
* @return array
|
| 360 |
-
*/
|
| 361 |
-
public function add_cron_schedule_intervals( $intervals ) {
|
| 362 |
-
if ( ! is_array( $intervals ) ) {
|
| 363 |
-
return $intervals;
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
-
if ( ! isset( $intervals['daily'] ) ) {
|
| 367 |
-
$intervals['daily'] = array(
|
| 368 |
-
'display' => __( 'SmartCrawl Daily', 'wds' ),
|
| 369 |
-
'interval' => DAY_IN_SECONDS,
|
| 370 |
-
);
|
| 371 |
-
}
|
| 372 |
-
|
| 373 |
-
if ( ! isset( $intervals['weekly'] ) ) {
|
| 374 |
-
$intervals['weekly'] = array(
|
| 375 |
-
'display' => __( 'SmartCrawl Weekly', 'wds' ),
|
| 376 |
-
'interval' => 7 * DAY_IN_SECONDS,
|
| 377 |
-
);
|
| 378 |
-
}
|
| 379 |
-
|
| 380 |
-
if ( ! isset( $intervals['monthly'] ) ) {
|
| 381 |
-
$intervals['monthly'] = array(
|
| 382 |
-
'display' => __( 'SmartCrawl Monthly', 'wds' ),
|
| 383 |
-
'interval' => 30 * DAY_IN_SECONDS,
|
| 384 |
-
);
|
| 385 |
-
}
|
| 386 |
-
|
| 387 |
-
return $intervals;
|
| 388 |
-
}
|
| 389 |
-
|
| 390 |
-
/**
|
| 391 |
-
* Clone
|
| 392 |
-
*/
|
| 393 |
-
private function __clone() {
|
| 394 |
-
}
|
| 395 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/class-wds-controller-hub-free.php
DELETED
|
@@ -1,174 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Smartcrawl_Controller_Hub {
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
private static $_instance;
|
| 7 |
-
|
| 8 |
-
private $_is_running = false;
|
| 9 |
-
|
| 10 |
-
private function __construct() {
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
/**
|
| 14 |
-
* Boot controller listeners
|
| 15 |
-
*
|
| 16 |
-
* Do it only once, if they're already up do nothing
|
| 17 |
-
*
|
| 18 |
-
* @return bool Status
|
| 19 |
-
*/
|
| 20 |
-
public static function serve() {
|
| 21 |
-
$me = self::get();
|
| 22 |
-
if ( $me->is_running() ) {
|
| 23 |
-
return false;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
$me->_add_hooks();
|
| 27 |
-
|
| 28 |
-
return true;
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* Obtain instance without booting up
|
| 33 |
-
*
|
| 34 |
-
* @return Smartcrawl_Controller_Hub instance
|
| 35 |
-
*/
|
| 36 |
-
public static function get() {
|
| 37 |
-
if ( empty( self::$_instance ) ) {
|
| 38 |
-
self::$_instance = new self();
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
return self::$_instance;
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
/**
|
| 45 |
-
* Check if we already have the actions bound
|
| 46 |
-
*
|
| 47 |
-
* @return bool Status
|
| 48 |
-
*/
|
| 49 |
-
public function is_running() {
|
| 50 |
-
return $this->_is_running;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Bind listening actions
|
| 55 |
-
*/
|
| 56 |
-
private function _add_hooks() {
|
| 57 |
-
// Passthrough.
|
| 58 |
-
$this->_is_running = true;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
/**
|
| 62 |
-
* Registers Hub action listeners
|
| 63 |
-
*
|
| 64 |
-
* @param array $actions All the Hub actions registered this far
|
| 65 |
-
*
|
| 66 |
-
* @return array Augmented actions
|
| 67 |
-
*/
|
| 68 |
-
public function register_hub_actions( $actions ) {
|
| 69 |
-
// Passthrough.
|
| 70 |
-
return $actions;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
/**
|
| 74 |
-
* Fresh ignores from the Hub action handler
|
| 75 |
-
*
|
| 76 |
-
* Updates local ignores list when the Hub storage is updated.
|
| 77 |
-
*
|
| 78 |
-
* @param object $params Hub-provided parameters
|
| 79 |
-
* @param string $action Action called
|
| 80 |
-
*
|
| 81 |
-
* @return bool Status
|
| 82 |
-
*/
|
| 83 |
-
public function sync_ignores_list( $params = array(), $action = '' ) {
|
| 84 |
-
return false; // Not in the free version.
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
/**
|
| 88 |
-
* Fresh ignores from the Hub action handler
|
| 89 |
-
*
|
| 90 |
-
* Updates local ignores list when the Hub storage is updated.
|
| 91 |
-
*
|
| 92 |
-
* @param object $params Hub-provided parameters
|
| 93 |
-
* @param string $action Action called
|
| 94 |
-
*/
|
| 95 |
-
public function json_sync_ignores_list( $params = array(), $action = '' ) {
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
/**
|
| 99 |
-
* Purge ignores from the Hub action handler
|
| 100 |
-
*
|
| 101 |
-
* Purges local ignores list when the Hub storage is purged.
|
| 102 |
-
*
|
| 103 |
-
* @param object $params Hub-provided parameters
|
| 104 |
-
* @param string $action Action called
|
| 105 |
-
*
|
| 106 |
-
* @return bool Status
|
| 107 |
-
*/
|
| 108 |
-
public function purge_ignores_list( $params = array(), $action = '' ) {
|
| 109 |
-
return false; // Not in the free version.
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
/**
|
| 113 |
-
* Purge ignores from the Hub action handler
|
| 114 |
-
*
|
| 115 |
-
* Purges local ignores list when the Hub storage is purged.
|
| 116 |
-
*
|
| 117 |
-
* @param object $params Hub-provided parameters
|
| 118 |
-
* @param string $action Action called
|
| 119 |
-
*/
|
| 120 |
-
public function json_purge_ignores_list( $params = array(), $action = '' ) {
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
/**
|
| 124 |
-
* Fresh extras from the Hub action handler
|
| 125 |
-
*
|
| 126 |
-
* Updates local extra URLs list when the Hub storage is updated.
|
| 127 |
-
*
|
| 128 |
-
* @param object $params Hub-provided parameters
|
| 129 |
-
* @param string $action Action called
|
| 130 |
-
*
|
| 131 |
-
* @return bool Status
|
| 132 |
-
*/
|
| 133 |
-
public function sync_extras_list( $params = array(), $action = '' ) {
|
| 134 |
-
return false; // Not in the free version.
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
/**
|
| 138 |
-
* Fresh extras from the Hub action handler
|
| 139 |
-
*
|
| 140 |
-
* Updates local extra URLs list when the Hub storage is updated.
|
| 141 |
-
*
|
| 142 |
-
* @param object $params Hub-provided parameters
|
| 143 |
-
* @param string $action Action called
|
| 144 |
-
*/
|
| 145 |
-
public function json_sync_extras_list( $params = array(), $action = '' ) {
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
/**
|
| 149 |
-
* Purge extras from the Hub action handler
|
| 150 |
-
*
|
| 151 |
-
* Purges local extra URLs list when the Hub storage is updated.
|
| 152 |
-
*
|
| 153 |
-
* @param object $params Hub-provided parameters
|
| 154 |
-
* @param string $action Action called
|
| 155 |
-
*
|
| 156 |
-
* @return bool Status
|
| 157 |
-
*/
|
| 158 |
-
public function purge_extras_list( $params = array(), $action = '' ) {
|
| 159 |
-
return false; // Not in the free version.
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
/**
|
| 163 |
-
* Purge extras from the Hub action handler
|
| 164 |
-
*
|
| 165 |
-
* Purges local extra URLs list when the Hub storage is updated.
|
| 166 |
-
*
|
| 167 |
-
* @param object $params Hub-provided parameters
|
| 168 |
-
* @param string $action Action called
|
| 169 |
-
*/
|
| 170 |
-
public function json_purge_extras_list( $params = array(), $action = '' ) {
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/core.php
CHANGED
|
@@ -356,7 +356,7 @@ function _wds_hb_convert_tri( $num, $tri ) {
|
|
| 356 |
*/
|
| 357 |
function smartcrawl_get_trimmed_excerpt( $excerpt, $contents ) {
|
| 358 |
$string = $excerpt ? $excerpt : $contents;
|
| 359 |
-
$string = trim( preg_replace( '/\r|\n/', ' ', strip_shortcodes( htmlspecialchars( wp_strip_all_tags(
|
| 360 |
|
| 361 |
return ( preg_match( '/.{156,}/um', $string ) )
|
| 362 |
? preg_replace( '/(.{0,152}).*/um', '$1', $string ) . '...'
|
| 356 |
*/
|
| 357 |
function smartcrawl_get_trimmed_excerpt( $excerpt, $contents ) {
|
| 358 |
$string = $excerpt ? $excerpt : $contents;
|
| 359 |
+
$string = trim( preg_replace( '/\r|\n/', ' ', strip_shortcodes( htmlspecialchars( wp_strip_all_tags( do_shortcode( $string ) ), ENT_QUOTES ) ) ) );
|
| 360 |
|
| 361 |
return ( preg_match( '/.{156,}/um', $string ) )
|
| 362 |
? preg_replace( '/(.{0,152}).*/um', '$1', $string ) . '...'
|
includes/core/service/class-wds-checkup-rest-service-free.php
DELETED
|
@@ -1,148 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* REST implementation of the checkup service, v1.0
|
| 4 |
-
*
|
| 5 |
-
* @package wpmu-dev-seo
|
| 6 |
-
*/
|
| 7 |
-
|
| 8 |
-
/**
|
| 9 |
-
* Checkup service REST implementation
|
| 10 |
-
*/
|
| 11 |
-
class Smartcrawl_Checkup_Rest_Service extends Smartcrawl_Checkup_Service_Implementation {
|
| 12 |
-
|
| 13 |
-
/**
|
| 14 |
-
* Gets all verbs known by the service
|
| 15 |
-
*
|
| 16 |
-
* @return array
|
| 17 |
-
*/
|
| 18 |
-
public function get_known_verbs() {
|
| 19 |
-
return array( 'start', 'result' );
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
/**
|
| 23 |
-
* Checks if service verb supports results caching
|
| 24 |
-
*
|
| 25 |
-
* @param string $verb Service verb.
|
| 26 |
-
*
|
| 27 |
-
* @return bool
|
| 28 |
-
*/
|
| 29 |
-
public function is_cacheable_verb( $verb ) {
|
| 30 |
-
return false;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
/**
|
| 34 |
-
* Gets full request URL for a service verb
|
| 35 |
-
*
|
| 36 |
-
* @param string $verb Service verb.
|
| 37 |
-
*
|
| 38 |
-
* @return string|bool
|
| 39 |
-
*/
|
| 40 |
-
public function get_request_url( $verb ) {
|
| 41 |
-
if ( empty( $verb ) ) {
|
| 42 |
-
return false;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
$domain = apply_filters(
|
| 46 |
-
$this->get_filter( 'domain' ),
|
| 47 |
-
network_site_url()
|
| 48 |
-
);
|
| 49 |
-
if ( empty( $domain ) ) {
|
| 50 |
-
return false;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
$query_url = http_build_query( array(
|
| 54 |
-
'domain' => $domain,
|
| 55 |
-
) );
|
| 56 |
-
$query_url = $query_url && preg_match( '/^\?/', $query_url ) ? $query_url : "?{$query_url}";
|
| 57 |
-
|
| 58 |
-
$request_url = trailingslashit( $this->get_service_base_url() ) .
|
| 59 |
-
$verb .
|
| 60 |
-
$query_url;
|
| 61 |
-
|
| 62 |
-
return $request_url;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
/**
|
| 66 |
-
* Gets service base URL
|
| 67 |
-
*
|
| 68 |
-
* @return string
|
| 69 |
-
*/
|
| 70 |
-
public function get_service_base_url() {
|
| 71 |
-
$base_url = 'https://premium.wpmudev.org/';
|
| 72 |
-
|
| 73 |
-
if ( defined( 'WPMUDEV_CUSTOM_API_SERVER' ) && WPMUDEV_CUSTOM_API_SERVER ) {
|
| 74 |
-
$base_url = trailingslashit( WPMUDEV_CUSTOM_API_SERVER );
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
$api = apply_filters(
|
| 78 |
-
$this->get_filter( 'api-endpoint' ),
|
| 79 |
-
'api'
|
| 80 |
-
);
|
| 81 |
-
|
| 82 |
-
$namespace = apply_filters(
|
| 83 |
-
$this->get_filter( 'api-namespace' ),
|
| 84 |
-
'seo-checkup/v1'
|
| 85 |
-
);
|
| 86 |
-
|
| 87 |
-
return trailingslashit( $base_url ) . trailingslashit( $api ) . trailingslashit( $namespace );
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
/**
|
| 91 |
-
* Gets request arguments array for a verb
|
| 92 |
-
*
|
| 93 |
-
* @param string $verb Service verb.
|
| 94 |
-
*
|
| 95 |
-
* @return array
|
| 96 |
-
*/
|
| 97 |
-
public function get_request_arguments( $verb ) {
|
| 98 |
-
$args = array(
|
| 99 |
-
'method' => 'GET',
|
| 100 |
-
'timeout' => 40,
|
| 101 |
-
'sslverify' => false,
|
| 102 |
-
);
|
| 103 |
-
|
| 104 |
-
return $args;
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
/**
|
| 108 |
-
* Handles service error response
|
| 109 |
-
*
|
| 110 |
-
* @param object $response WP HTTP API response.
|
| 111 |
-
*/
|
| 112 |
-
public function handle_error_response( $response, $verb ) {
|
| 113 |
-
if ( 'emails' === $verb ) {
|
| 114 |
-
return false;
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
$body = wp_remote_retrieve_body( $response );
|
| 118 |
-
if ( empty( $body ) ) {
|
| 119 |
-
return false;
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
$error = json_decode( $body, true );
|
| 123 |
-
if ( empty( $error['message'] ) ) {
|
| 124 |
-
return false;
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
$this->set_cached_error( 'checkup', $error['message'] );
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
/**
|
| 131 |
-
* Gets crawl starting verb
|
| 132 |
-
*
|
| 133 |
-
* @return string
|
| 134 |
-
*/
|
| 135 |
-
public function get_start_verb() {
|
| 136 |
-
return 'start';
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
/**
|
| 140 |
-
* Gets results fetching verb
|
| 141 |
-
*
|
| 142 |
-
* @return string
|
| 143 |
-
*/
|
| 144 |
-
public function get_result_verb() {
|
| 145 |
-
return 'result';
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/service/class-wds-seo-service-free.php
DELETED
|
@@ -1,216 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Smartcrawl_Seo_Service extends Smartcrawl_Service {
|
| 4 |
-
|
| 5 |
-
const ERR_BASE_API_ISSUE = 40;
|
| 6 |
-
const ERR_BASE_CRAWL_RUN = 51;
|
| 7 |
-
const ERR_BASE_COOLDOWN = 52;
|
| 8 |
-
const ERR_BASE_CRAWL_ERR = 53;
|
| 9 |
-
const ERR_BASE_GENERIC = 59;
|
| 10 |
-
|
| 11 |
-
public function get_known_verbs() {
|
| 12 |
-
return array();
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
public function is_cacheable_verb( $verb ) {
|
| 16 |
-
return false;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
public function get_service_base_url() {
|
| 20 |
-
return false;
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
public function get_request_url( $verb ) {
|
| 24 |
-
return false;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
public function get_request_arguments( $verb ) {
|
| 28 |
-
return array();
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* Local ignores list sync handler
|
| 33 |
-
*
|
| 34 |
-
* @return bool Status
|
| 35 |
-
*/
|
| 36 |
-
public function sync_ignores() {
|
| 37 |
-
return false;
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
/**
|
| 41 |
-
* Checks whether a call is currently being processed
|
| 42 |
-
*
|
| 43 |
-
* @return bool
|
| 44 |
-
*/
|
| 45 |
-
public function in_progress() {
|
| 46 |
-
$flag = $this->get_progress_flag();
|
| 47 |
-
|
| 48 |
-
$expected_timeout = intval( $flag ) + ( HOUR_IN_SECONDS / 4 );
|
| 49 |
-
if ( ! empty( $flag ) && is_numeric( $flag ) && time() > $expected_timeout ) {
|
| 50 |
-
// Over timeout threshold, clear flag forcefully
|
| 51 |
-
$this->stop();
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
return ! ! $flag;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
/**
|
| 58 |
-
* Gets progress flag state
|
| 59 |
-
*
|
| 60 |
-
* @return bool
|
| 61 |
-
*/
|
| 62 |
-
public function get_progress_flag() {
|
| 63 |
-
return get_option( $this->get_filter( 'seo-progress' ), false );
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
/**
|
| 67 |
-
* Stops expecting response
|
| 68 |
-
*
|
| 69 |
-
* @return bool
|
| 70 |
-
*/
|
| 71 |
-
public function stop() {
|
| 72 |
-
$this->set_progress_flag( false );
|
| 73 |
-
|
| 74 |
-
return true;
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
/**
|
| 78 |
-
* Sets progress flag state
|
| 79 |
-
*
|
| 80 |
-
* param bool $flag Whether the service check is in progress
|
| 81 |
-
*
|
| 82 |
-
* @return bool
|
| 83 |
-
*/
|
| 84 |
-
public function set_progress_flag( $flag ) {
|
| 85 |
-
if ( ! empty( $flag ) ) {
|
| 86 |
-
$flag = time();
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
return ! ! update_option( $this->get_filter( 'seo-progress' ), $flag );
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
/**
|
| 93 |
-
* Public wrapper for start service method call
|
| 94 |
-
*
|
| 95 |
-
* @return mixed Service response hash on success, (bool) on failure
|
| 96 |
-
*/
|
| 97 |
-
public function start() {
|
| 98 |
-
$this->stop();
|
| 99 |
-
|
| 100 |
-
return false;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
/**
|
| 104 |
-
* Public wrapper for status service method call
|
| 105 |
-
*
|
| 106 |
-
* @return mixed Service response hash on success, (bool)false on failure
|
| 107 |
-
*/
|
| 108 |
-
public function status() {
|
| 109 |
-
return false;
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
/**
|
| 113 |
-
* Public wrapper for result service method call
|
| 114 |
-
*
|
| 115 |
-
* @return mixed Service response hash on success, (bool)false on failure
|
| 116 |
-
*/
|
| 117 |
-
public function result() {
|
| 118 |
-
return false;
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
/**
|
| 122 |
-
* Sets result to new value
|
| 123 |
-
*
|
| 124 |
-
* Sets both cache and permanent result
|
| 125 |
-
*
|
| 126 |
-
* @return bool
|
| 127 |
-
*/
|
| 128 |
-
public function set_result( $result ) {
|
| 129 |
-
return ! ! update_option( $this->get_filter( 'seo-service-result' ), $result );
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
/**
|
| 133 |
-
* Returns last service run time
|
| 134 |
-
*
|
| 135 |
-
* Returns either time embedded in results, or the timestamp
|
| 136 |
-
* from the results service, whichever is greater.
|
| 137 |
-
*
|
| 138 |
-
* @return int UNIX timestamp
|
| 139 |
-
*/
|
| 140 |
-
public function get_last_run_timestamp() {
|
| 141 |
-
$recorded = (int) get_option( $this->get_filter( 'seo-service-last_runtime' ), 0 );
|
| 142 |
-
|
| 143 |
-
$raw = $this->get_result();
|
| 144 |
-
$embedded = ! empty( $raw['end'] ) ? (int) $raw['end'] : 0;
|
| 145 |
-
if ( empty( $embedded ) && ! empty( $raw['issues']['previous']['timestamp'] ) ) {
|
| 146 |
-
$embedded = (int) $raw['issues']['previous']['timestamp'];
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
return max( $recorded, $embedded );
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
-
/**
|
| 153 |
-
* Public result getter
|
| 154 |
-
*
|
| 155 |
-
* @return mixed result
|
| 156 |
-
*/
|
| 157 |
-
public function get_result() {
|
| 158 |
-
$result = get_option( $this->get_filter( 'seo-service-result' ), false );
|
| 159 |
-
|
| 160 |
-
return $result;
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
/**
|
| 164 |
-
* Sets service last run time
|
| 165 |
-
*
|
| 166 |
-
* Attempts to use embedded result, and falls back
|
| 167 |
-
* to current timestamp
|
| 168 |
-
*
|
| 169 |
-
* @return bool
|
| 170 |
-
*/
|
| 171 |
-
public function set_last_run_timestamp() {
|
| 172 |
-
$raw = $this->get_result();
|
| 173 |
-
$timestamp = ! empty( $raw['end'] ) ? (int) $raw['end'] : 0;
|
| 174 |
-
if ( empty( $timestamp ) && ! empty( $raw['issues']['previous']['timestamp'] ) ) {
|
| 175 |
-
$timestamp = (int) $raw['issues']['previous']['timestamp'];
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
if ( empty( $timestamp ) ) {
|
| 179 |
-
$timestamp = time();
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
return ! ! update_option( $this->get_filter( 'seo-service-last_runtime' ), $timestamp );
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
public function handle_error_response( $response, $verb ) {
|
| 186 |
-
$body = wp_remote_retrieve_body( $response );
|
| 187 |
-
$data = json_decode( $body, true );
|
| 188 |
-
if ( empty( $body ) || empty( $data ) ) {
|
| 189 |
-
$this->_set_error( __( 'Unspecified error', 'wds' ) );
|
| 190 |
-
|
| 191 |
-
return true;
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
$msg = '';
|
| 195 |
-
if ( ! empty( $data['message'] ) ) {
|
| 196 |
-
$msg = $data['message'];
|
| 197 |
-
}
|
| 198 |
-
|
| 199 |
-
if ( ! empty( $data['data']['manage_link'] ) ) {
|
| 200 |
-
$url = esc_url( $data['data']['manage_link'] );
|
| 201 |
-
$msg .= ' <a href="' . $url . '">' . __( 'Manage', 'wds' ) . '</a>';
|
| 202 |
-
}
|
| 203 |
-
|
| 204 |
-
if ( ! empty( $msg ) ) {
|
| 205 |
-
$this->_set_error( $msg );
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
return true;
|
| 209 |
-
}
|
| 210 |
-
|
| 211 |
-
private function _clear_result() {
|
| 212 |
-
return ! ! delete_option( $this->get_filter( 'seo-service-result' ) );
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/wds-metabox.js
CHANGED
|
@@ -137,9 +137,13 @@
|
|
| 137 |
$('.wds-analysis-working', $metabox).remove();
|
| 138 |
});
|
| 139 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
var save = (((wp || {}).autosave || {}).server || {}).triggerSave;
|
| 141 |
if (save) {
|
| 142 |
-
$(document).one('
|
| 143 |
wp.autosave.server.triggerSave();
|
| 144 |
} else cback();
|
| 145 |
}
|
|
@@ -277,8 +281,8 @@
|
|
| 277 |
|
| 278 |
$.post(ajaxurl, {
|
| 279 |
action: "wds-metabox-preview",
|
| 280 |
-
|
| 281 |
-
|
| 282 |
post_id: post_id,
|
| 283 |
_wds_nonce: _wds_metabox.nonce
|
| 284 |
}, 'json').done(function (data) {
|
| 137 |
$('.wds-analysis-working', $metabox).remove();
|
| 138 |
});
|
| 139 |
};
|
| 140 |
+
var editorSync = (tinyMCE || {}).triggerSave;
|
| 141 |
+
if (editorSync) {
|
| 142 |
+
editorSync();
|
| 143 |
+
}
|
| 144 |
var save = (((wp || {}).autosave || {}).server || {}).triggerSave;
|
| 145 |
if (save) {
|
| 146 |
+
$(document).one('heartbeat-tick.autosave', cback);
|
| 147 |
wp.autosave.server.triggerSave();
|
| 148 |
} else cback();
|
| 149 |
}
|
| 281 |
|
| 282 |
$.post(ajaxurl, {
|
| 283 |
action: "wds-metabox-preview",
|
| 284 |
+
wds_title: title,
|
| 285 |
+
wds_description: description,
|
| 286 |
post_id: post_id,
|
| 287 |
_wds_nonce: _wds_metabox.nonce
|
| 288 |
}, 'json').done(function (data) {
|
languages/wpmu-dev-seo.pot
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
# This file is distributed under the same license as the SmartCrawl package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: SmartCrawl 2.2.2.
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpmu-dev-seo\n"
|
| 7 |
-
"POT-Creation-Date: 2018-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -13,14 +13,14 @@ msgstr ""
|
|
| 13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
"X-Generator: grunt-wp-i18n1.0.2\n"
|
| 15 |
|
| 16 |
-
#: includes/admin/admin.php:
|
| 17 |
#: includes/admin/settings/settings.php:319
|
| 18 |
#: includes/admin/templates/advanced-tools/advanced-tools-settings.php:49
|
| 19 |
#: includes/admin/templates/onpage/onpage-settings.php:246
|
| 20 |
msgid "Settings"
|
| 21 |
msgstr ""
|
| 22 |
|
| 23 |
-
#: includes/admin/admin.php:
|
| 24 |
msgid "Error: options page not found."
|
| 25 |
msgstr ""
|
| 26 |
|
|
@@ -28,97 +28,97 @@ msgstr ""
|
|
| 28 |
msgid "SmartCrawl"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
-
#: includes/admin/admin.php:
|
| 32 |
#: includes/admin/templates/dashboard/dashboard.php:18
|
| 33 |
msgid "Dashboard"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
-
#: includes/admin/admin.php:
|
| 37 |
msgid ""
|
| 38 |
"This site discourages search engines from indexing the pages, which will "
|
| 39 |
"affect your SEO efforts."
|
| 40 |
msgstr ""
|
| 41 |
|
| 42 |
-
#: includes/admin/admin.php:
|
| 43 |
msgid "You can fix this here"
|
| 44 |
msgstr ""
|
| 45 |
|
| 46 |
-
#: includes/admin/metabox.php:
|
| 47 |
msgid "{TOTAL_LEFT} characters left"
|
| 48 |
msgstr ""
|
| 49 |
|
| 50 |
-
#: includes/admin/metabox.php:
|
| 51 |
msgid "Over {MAX_COUNT} characters ({CURRENT_COUNT})"
|
| 52 |
msgstr ""
|
| 53 |
|
| 54 |
-
#: includes/admin/metabox.php:
|
| 55 |
msgid ""
|
| 56 |
"Over {MAX_COUNT} characters ({CURRENT_COUNT}) - make sure your SEO title is "
|
| 57 |
"shorter"
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
-
#: includes/admin/metabox.php:
|
| 61 |
msgid "Analyzing content, please wait a few moments"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
-
#: includes/admin/metabox.php:
|
| 65 |
msgid "NO ODP (Block Open Directory Project description of the page)"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#: includes/admin/metabox.php:
|
| 69 |
msgid "NO YDIR (Don't display the Yahoo! Directory titles and abstracts)"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#: includes/admin/metabox.php:
|
| 73 |
msgid "No Archive"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
-
#: includes/admin/metabox.php:
|
| 77 |
msgid "No Snippet"
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
-
#: includes/admin/metabox.php:
|
| 81 |
msgid "Automatic prioritization"
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
-
#: includes/admin/metabox.php:
|
| 85 |
msgid "1 - Highest priority"
|
| 86 |
msgstr ""
|
| 87 |
|
| 88 |
-
#: includes/admin/metabox.php:
|
| 89 |
msgid "High priority (root pages default)"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
-
#: includes/admin/metabox.php:
|
| 93 |
msgid "Secondary priority (subpages default)"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
-
#: includes/admin/metabox.php:
|
| 97 |
msgid "Medium priority"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
-
#: includes/admin/metabox.php:
|
| 101 |
msgid "Lowest priority"
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
-
#: includes/admin/metabox.php:
|
| 105 |
#: includes/admin/templates/quick-edit-title.php:5
|
| 106 |
msgid "Title Tag"
|
| 107 |
msgstr ""
|
| 108 |
|
| 109 |
-
#: includes/admin/metabox.php:
|
| 110 |
msgid "Robots Meta"
|
| 111 |
msgstr ""
|
| 112 |
|
| 113 |
-
#: includes/admin/metabox.php:
|
| 114 |
msgid "Redirects to %s"
|
| 115 |
msgstr ""
|
| 116 |
|
| 117 |
-
#: includes/admin/metabox.php:
|
| 118 |
msgid "No ODP"
|
| 119 |
msgstr ""
|
| 120 |
|
| 121 |
-
#: includes/admin/metabox.php:
|
| 122 |
msgid "No YDIR"
|
| 123 |
msgstr ""
|
| 124 |
|
|
@@ -1822,15 +1822,7 @@ msgid ""
|
|
| 1822 |
"keywords you enter in the text box."
|
| 1823 |
msgstr ""
|
| 1824 |
|
| 1825 |
-
#: includes/admin/templates/metabox/metabox-preview.php:
|
| 1826 |
-
msgid "Dummy Title"
|
| 1827 |
-
msgstr ""
|
| 1828 |
-
|
| 1829 |
-
#: includes/admin/templates/metabox/metabox-preview.php:33
|
| 1830 |
-
msgid "Dummy description"
|
| 1831 |
-
msgstr ""
|
| 1832 |
-
|
| 1833 |
-
#: includes/admin/templates/metabox/metabox-preview.php:43
|
| 1834 |
msgid "Google Preview"
|
| 1835 |
msgstr ""
|
| 1836 |
|
| 2 |
# This file is distributed under the same license as the SmartCrawl package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: SmartCrawl 2.2.2.4\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpmu-dev-seo\n"
|
| 7 |
+
"POT-Creation-Date: 2018-09-25 17:41:55+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
"X-Generator: grunt-wp-i18n1.0.2\n"
|
| 15 |
|
| 16 |
+
#: includes/admin/admin.php:133 includes/admin/settings/settings.php:248
|
| 17 |
#: includes/admin/settings/settings.php:319
|
| 18 |
#: includes/admin/templates/advanced-tools/advanced-tools-settings.php:49
|
| 19 |
#: includes/admin/templates/onpage/onpage-settings.php:246
|
| 20 |
msgid "Settings"
|
| 21 |
msgstr ""
|
| 22 |
|
| 23 |
+
#: includes/admin/admin.php:168
|
| 24 |
msgid "Error: options page not found."
|
| 25 |
msgstr ""
|
| 26 |
|
| 28 |
msgid "SmartCrawl"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
+
#: includes/admin/admin.php:320 includes/admin/settings/dashboard.php:32
|
| 32 |
#: includes/admin/templates/dashboard/dashboard.php:18
|
| 33 |
msgid "Dashboard"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
+
#: includes/admin/admin.php:382
|
| 37 |
msgid ""
|
| 38 |
"This site discourages search engines from indexing the pages, which will "
|
| 39 |
"affect your SEO efforts."
|
| 40 |
msgstr ""
|
| 41 |
|
| 42 |
+
#: includes/admin/admin.php:383
|
| 43 |
msgid "You can fix this here"
|
| 44 |
msgstr ""
|
| 45 |
|
| 46 |
+
#: includes/admin/metabox.php:115
|
| 47 |
msgid "{TOTAL_LEFT} characters left"
|
| 48 |
msgstr ""
|
| 49 |
|
| 50 |
+
#: includes/admin/metabox.php:116
|
| 51 |
msgid "Over {MAX_COUNT} characters ({CURRENT_COUNT})"
|
| 52 |
msgstr ""
|
| 53 |
|
| 54 |
+
#: includes/admin/metabox.php:117
|
| 55 |
msgid ""
|
| 56 |
"Over {MAX_COUNT} characters ({CURRENT_COUNT}) - make sure your SEO title is "
|
| 57 |
"shorter"
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
+
#: includes/admin/metabox.php:130
|
| 61 |
msgid "Analyzing content, please wait a few moments"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
+
#: includes/admin/metabox.php:164
|
| 65 |
msgid "NO ODP (Block Open Directory Project description of the page)"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
+
#: includes/admin/metabox.php:165
|
| 69 |
msgid "NO YDIR (Don't display the Yahoo! Directory titles and abstracts)"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
+
#: includes/admin/metabox.php:166 includes/admin/metabox.php:432
|
| 73 |
msgid "No Archive"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
+
#: includes/admin/metabox.php:167 includes/admin/metabox.php:433
|
| 77 |
msgid "No Snippet"
|
| 78 |
msgstr ""
|
| 79 |
|
| 80 |
+
#: includes/admin/metabox.php:170
|
| 81 |
msgid "Automatic prioritization"
|
| 82 |
msgstr ""
|
| 83 |
|
| 84 |
+
#: includes/admin/metabox.php:171
|
| 85 |
msgid "1 - Highest priority"
|
| 86 |
msgstr ""
|
| 87 |
|
| 88 |
+
#: includes/admin/metabox.php:173
|
| 89 |
msgid "High priority (root pages default)"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
+
#: includes/admin/metabox.php:175
|
| 93 |
msgid "Secondary priority (subpages default)"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
+
#: includes/admin/metabox.php:176
|
| 97 |
msgid "Medium priority"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
+
#: includes/admin/metabox.php:180
|
| 101 |
msgid "Lowest priority"
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
+
#: includes/admin/metabox.php:388
|
| 105 |
#: includes/admin/templates/quick-edit-title.php:5
|
| 106 |
msgid "Title Tag"
|
| 107 |
msgstr ""
|
| 108 |
|
| 109 |
+
#: includes/admin/metabox.php:390
|
| 110 |
msgid "Robots Meta"
|
| 111 |
msgstr ""
|
| 112 |
|
| 113 |
+
#: includes/admin/metabox.php:411
|
| 114 |
msgid "Redirects to %s"
|
| 115 |
msgstr ""
|
| 116 |
|
| 117 |
+
#: includes/admin/metabox.php:430
|
| 118 |
msgid "No ODP"
|
| 119 |
msgstr ""
|
| 120 |
|
| 121 |
+
#: includes/admin/metabox.php:431
|
| 122 |
msgid "No YDIR"
|
| 123 |
msgstr ""
|
| 124 |
|
| 1822 |
"keywords you enter in the text box."
|
| 1823 |
msgstr ""
|
| 1824 |
|
| 1825 |
+
#: includes/admin/templates/metabox/metabox-preview.php:22
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1826 |
msgid "Google Preview"
|
| 1827 |
msgstr ""
|
| 1828 |
|
readme.txt
CHANGED
|
@@ -7,7 +7,7 @@ Author URI: https://premium.wpmudev.org/
|
|
| 7 |
Author: WPMU DEV
|
| 8 |
Requires at least: 4.6
|
| 9 |
Tested up to: 4.9.8
|
| 10 |
-
Stable tag: 2.2.2.
|
| 11 |
|
| 12 |
The SEO checker and optimization tool that helps you rank higher and get discovered in search engines.
|
| 13 |
|
|
@@ -86,6 +86,12 @@ SmartCrawl works with any normal WP content and page builders shouldn’t be an
|
|
| 86 |
|
| 87 |
== Changelog ==
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
= 2.2.2.3 =
|
| 90 |
|
| 91 |
* Fix: fixed SEO checkup for free version
|
| 7 |
Author: WPMU DEV
|
| 8 |
Requires at least: 4.6
|
| 9 |
Tested up to: 4.9.8
|
| 10 |
+
Stable tag: 2.2.2.4
|
| 11 |
|
| 12 |
The SEO checker and optimization tool that helps you rank higher and get discovered in search engines.
|
| 13 |
|
| 86 |
|
| 87 |
== Changelog ==
|
| 88 |
|
| 89 |
+
= 2.2.2.4 =
|
| 90 |
+
|
| 91 |
+
* Fix: don't show raw shortcodes in auto-generated meta description
|
| 92 |
+
* Fix: better compatibility of readability and SEO analysis with page builders
|
| 93 |
+
* Fix: made Google preview in the SC metabox more accurate
|
| 94 |
+
|
| 95 |
= 2.2.2.3 =
|
| 96 |
|
| 97 |
* Fix: fixed SEO checkup for free version
|
wpmu-dev-seo.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: SmartCrawl
|
| 4 |
* Plugin URI: http://premium.wpmudev.org/project/wpmu-dev-seo/
|
| 5 |
* Description: Every SEO option that a site requires, in one easy bundle.
|
| 6 |
-
* Version: 2.2.2.
|
| 7 |
* Network: true
|
| 8 |
* Text Domain: wds
|
| 9 |
* Author: WPMU DEV
|
|
@@ -30,7 +30,7 @@
|
|
| 30 |
*/
|
| 31 |
|
| 32 |
|
| 33 |
-
define( 'SMARTCRAWL_VERSION', '2.2.2.
|
| 34 |
|
| 35 |
class Smartcrawl_Loader {
|
| 36 |
|
| 3 |
* Plugin Name: SmartCrawl
|
| 4 |
* Plugin URI: http://premium.wpmudev.org/project/wpmu-dev-seo/
|
| 5 |
* Description: Every SEO option that a site requires, in one easy bundle.
|
| 6 |
+
* Version: 2.2.2.4
|
| 7 |
* Network: true
|
| 8 |
* Text Domain: wds
|
| 9 |
* Author: WPMU DEV
|
| 30 |
*/
|
| 31 |
|
| 32 |
|
| 33 |
+
define( 'SMARTCRAWL_VERSION', '2.2.2.4' );
|
| 34 |
|
| 35 |
class Smartcrawl_Loader {
|
| 36 |
|
