Plugin Directory

Changeset 2215789


Ignore:
Timestamp:
12/20/2019 03:24:14 PM (6 years ago)
Author:
hallsofmontezuma
Message:

releasing version 3.3.3

Location:
all-in-one-seo-pack
Files:
2 added
6 deleted
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • all-in-one-seo-pack/tags/3.3.4/aioseop_class.php

    r2190206 r2215789  
    566566                    ),
    567567                    'aiosp_ga_advanced_options' => 'on',
    568                     'aiosp_gtm_container_id'    => array(
    569                         'lhs' => 'aiosp_gtm_container_id',
    570                         'op'  => '==',
    571                         'rhs' => '',
    572                     ),
    573568                ),
    574569            ),
     
    597592                    ),
    598593                    'aiosp_ga_advanced_options' => 'on',
    599                     'aiosp_gtm_container_id'    => array(
    600                         'lhs' => 'aiosp_gtm_container_id',
    601                         'op'  => '==',
    602                         'rhs' => '',
    603                     ),
    604594                ),
    605595            ),
     
    36673657        global $current_screen;
    36683658        global $aioseop_options;
    3669         $current_screen = get_current_screen();
    3670         $is_gutenberg   = 'false';
    3671 
    3672         if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
    3673             $is_gutenberg = 'true';
    3674         }
    36753659
    36763660        add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
     
    36973681
    36983682                $snippet_preview_data = array(
    3699                     'isGutenberg'              => $is_gutenberg,
    37003683                    'autogenerateDescriptions' => $aioseop_options['aiosp_generate_descriptions'],
    37013684                    'skipExcerpt'              => $aioseop_options['aiosp_skip_excerpt'],
     
    37033686
    37043687                $count_chars_data['extraTitleLength']         = $extra_title_length;
    3705                 $count_chars_data['isGutenberg']              = $is_gutenberg;
    37063688                $count_chars_data['autogenerateDescriptions'] = $aioseop_options['aiosp_generate_descriptions'];
    37073689
     
    37243706                $count_chars_data['pluginDirName'] = AIOSEOP_PLUGIN_DIRNAME;
    37253707                $count_chars_data['currentPage']   = $hook_suffix;
     3708
     3709                wp_enqueue_script(
     3710                    'aioseop-admin-functions',
     3711                    AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js',
     3712                    array(),
     3713                    AIOSEOP_VERSION
     3714                );
    37263715
    37273716                wp_enqueue_script(
  • all-in-one-seo-pack/tags/3.3.4/all_in_one_seo_pack.php

    r2195818 r2215789  
    44Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
    55Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007.
    6 Version: 3.3.3
     6Version: 3.3.4
    77Author: Michael Torbert
    88Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
     
    3232 *
    3333 * @package All-in-One-SEO-Pack
    34  * @version 3.3.3
     34 * @version 3.3.4
    3535 */
    3636
     
    4646}
    4747if ( ! defined( 'AIOSEOP_VERSION' ) ) {
    48     define( 'AIOSEOP_VERSION', '3.3.3' );
     48    define( 'AIOSEOP_VERSION', '3.3.4' );
    4949}
    5050
  • all-in-one-seo-pack/tags/3.3.4/js/admin/aioseop-count-chars.js

    r2195818 r2215789  
    1111    "use strict";
    1212
    13     let isGutenberg;
    14     let autogenerateDescriptions;
     13    let inputField;
     14    let counterField;
     15    let fieldSize;
    1516    let extraTitleLength;
    1617    let pluginDirName;
    1718    let currentPage;
    18     let inputField;
    19     let counterField;
    20     let fieldSize;
    21     let timeout = 0;
     19    let autogenerateDescriptions;
     20    let isGutenbergEditor = aioseopIsGutenbergEditor();
    2221
    2322    if ('undefined' !== typeof aioseopCharacterCounter) {
    24         isGutenberg              = aioseopCharacterCounter.isGutenberg;
    25         autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;
    2623        extraTitleLength         = +aioseopCharacterCounter.extraTitleLength;
    2724        pluginDirName            = aioseopCharacterCounter.pluginDirName;
    2825        currentPage              = aioseopCharacterCounter.currentPage;
     26        autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;
    2927    }
    3028    else if ('undefined' !== typeof aioseopOGCharacterCounter) {
    31         isGutenberg   = aioseopOGCharacterCounter.isGutenberg;
    3229        pluginDirName = aioseopOGCharacterCounter.pluginDirName;
    3330        currentPage   = aioseopOGCharacterCounter.currentPage;
    3431    }
     32
    3533    aioseopAddEventListeners();
    3634    // Fire once on page load.
     
    4543     */
    4644    function aioseopAddEventListeners() {
    47         aioseopAddGeneralListener();
     45
     46        aioseopSetInputEventListeners();
    4847
    4948        if (!aioseopIsEditPage()) {
     
    5150        }
    5251
    53         if ('false' === isGutenberg) {
    54             aioseopAddClassicEditorListener();
     52        if (!isGutenbergEditor) {
     53            aioseopSetClassicEditorListeners();
    5554        } else {
    56             aioseopAddGutenbergEditorListener();
    57         }
    58     }
    59 
    60     /**
    61      * Adds the general/shared events listeners.
     55            aioseopSetGutenbergEditorEventListener(aioseopCountChars);
     56        }
     57    }
     58
     59    /**
     60     * Adds the event listener to the input field of the character counter.
    6261     *
    6362     * @since 3.3.0
     
    6564     * @return void
    6665     */
    67     function aioseopAddGeneralListener() {
     66    function aioseopSetInputEventListeners() {
    6867        $('.aioseop_count_chars').on('keyup', function () {
    6968            aioseopCountChars();
     
    7574     *
    7675     * @since 3.3.0
    77      *
    78      * @return void
    79      */
    80     function aioseopAddClassicEditorListener() {
    81         setTimeout(function () {
    82             tinymce.editors[0].on('KeyUp', function () {
    83                 aioseopCountChars();
    84             });
    85         }, 1000);
     76     * @since 3.3.4 Add support for text tab of Classic Editor.
     77     *
     78     * @return void
     79     */
     80    function aioseopSetClassicEditorListeners() {
     81
     82        aioseopSetClassicEditorEventListener(aioseopCountChars);
    8683
    8784        $('#title, #excerpt').on('keyup', function () {
    8885            aioseopCountChars();
    89         });
    90     }
    91 
    92     /**
    93      * Adds the event listener for the Gutenberg Editor.
    94      *
    95      * @since 3.3.0
    96      *
    97      * @return void
    98      */
    99     function aioseopAddGutenbergEditorListener() {
    100         window._wpLoadBlockEditor.then(function () {
    101             setTimeout(function () {
    102                 // https://developer.wordpress.org/block-editor/packages/packages-data/
    103                 wp.data.subscribe(function () {
    104                     clearTimeout(timeout);
    105                     timeout = setTimeout(function () {
    106                         aioseopCountChars();
    107                     }, 200);
    108                 });
    109             });
    11086        });
    11187    }
  • all-in-one-seo-pack/tags/3.3.4/js/admin/aioseop-preview-snippet.js

    r2192264 r2215789  
    1818    let aioseopDescription       = $('textarea[name="aiosp_description"]');
    1919    let timeout                  = 0;
    20     let isGutenberg              = aioseop_preview_snippet.isGutenberg;
    2120    let autogenerateDescriptions = aioseop_preview_snippet.autogenerateDescriptions;
    2221    let skipExcerpt              = aioseop_preview_snippet.skipExcerpt;
     22    let isGutenbergEditor        = aioseopIsGutenbergEditor();
    2323
    24     aioseopUpdateMetabox();
     24    aioseopInitPreviewSnippet();
    2525
    2626    /**
    27      * The aioseopUpdateMetabox() function.
    28      *
    29      * Updates the preview snippet and input field placeholders in the meta box when a change happens.
     27     * Defines the relevant fields and adds the relevant event listeners based on which editor is active.
    3028     *
    3129     * @since 3.3.0
     30     * @since 3.3.4 Add support for text tab in Classic Editor.
    3231     */
    33     function aioseopUpdateMetabox() {
     32    function aioseopInitPreviewSnippet() {
    3433        let inputFields = [aioseopTitle, aioseopDescription];
    3534
    36         if ('false' === isGutenberg) {
     35        if (!isGutenbergEditor) {
    3736            docTitle = $('#title');
    3837            let postExcerpt = $('#excerpt');
     
    4039            inputFields.push(docTitle, postExcerpt);
    4140
    42             setTimeout(function () {
    43                 tinymce.editors[0].on('KeyUp', function () {
    44                     aioseopUpdatePreviewSnippet();
    45                 });
    46             }, 1000);
     41            aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet);
     42            aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet);
    4743        }
    4844        else {
    49             window._wpLoadBlockEditor.then(function () {
    50                 setTimeout(function () {
    51                     // https://developer.wordpress.org/block-editor/packages/packages-data/
    52                     wp.data.subscribe(function () {
    53                         clearTimeout(timeout);
    54                         // This is needed because the code otherwise is triggered dozens of times.
    55                         timeout = setTimeout(function () {
    56                             aioseopUpdatePreviewSnippet();
    57                         }, 200);
    58                     });
    59                 });
    60             });
     45            aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet);
    6146        }
    6247
     
    6853        }
    6954
    70         //Run once on page load.
     55        // Run once on page load.
    7156        timeout = setTimeout(function () {
    7257            aioseopUpdatePreviewSnippet();
     
    7560
    7661    /**
    77      * AIOSEOP Update Preview Snippet
     62     * Updates the preview snippet and input field placeholders in the meta box when a change happens.
    7863     *
    7964     * @uses wp.data.select().getEditedPostAttribute()
    8065     * @link https://developer.wordpress.org/block-editor/data/data-core-editor/#getEditedPostAttribute
    8166     *
    82      * @since 3.3
     67     * @since 3.3.0
    8368     */
    8469    function aioseopUpdatePreviewSnippet() {
     
    8772        let postExcerpt = '';
    8873
    89         if ('false' === isGutenberg) {
     74        if (aioseopEditorUndefined) {
     75            return;
     76        }
     77       
     78        if (!isGutenbergEditor) {
    9079            postTitle   = aioseopStripMarkup($.trim($('#title').val()));
    91             postContent = aioseopShortenDescription($('#content_ifr').contents().find('body')[0].innerHTML);
    92             postExcerpt = aioseopShortenDescription($.trim($('#excerpt').val()));
     80            postContent = aioseopGetDescription(aioseopGetClassicEditorContent());
     81            postExcerpt = aioseopGetDescription($.trim($('#excerpt').val()));
    9382        }
    9483        else {
    9584            postTitle   = aioseopStripMarkup($.trim($('#post-title-0').val()));
    96             postContent = aioseopShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));
    97             postExcerpt = aioseopShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));
     85            postContent = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));
     86            postExcerpt = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));
    9887        }
    9988
     
    128117
    129118    /**
    130      * The aioseopShortenDescription() function.
    131      *
    132      * Shortens the description to max. 160 characters without truncation.
     119     * Shortens the description to 160 characters without truncation.
    133120     *
    134121     * @since 3.3.0
     122     * @since 3.3.4 Shorten post content to improve performance.
    135123     *
    136      * @param string description
     124     * @param string postContent
     125     * @return string description
    137126     */
    138     function aioseopShortenDescription(description) {
     127    function aioseopGetDescription(postContent) {
     128        // Shorten content first to avoid performance drops.
     129        let description = postContent.substring(0, 5000);
     130
    139131        description = aioseopStripMarkup(description);
    140132        if (160 < description.length) {
     
    148140
    149141    /**
    150      * The aioseopStripMarkup() function.
    151      *
    152142     * Strips all editor markup from a string.
    153143     *
     
    161151        content = content.replace(/(<[^ >][^>]*>)?/gm, '');
    162152        // Remove all line breaks.
    163         content = content.replace(/\s\s+/g, ' ');
     153        content = content.replace(/[\r\n]+/gm, ' ');
    164154        return aioseopDecodeHtmlEntities(content.trim());
    165155    }
    166156
    167157    /**
    168      * The aioseopDecodeHtmlEntities() function.
    169      *
    170158     * Decodes HTML entities to characters.
    171159     *
  • all-in-one-seo-pack/tags/3.3.4/modules/aioseop_opengraph.php

    r2195818 r2215789  
    18851885         */
    18861886        public function admin_enqueue_scripts( $hook_suffix ) {
    1887             global $current_screen;
    1888 
    1889             $is_gutenberg = 'false';
    1890             if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
    1891                 $is_gutenberg = 'true';
    1892             }
    18931887
    18941888            switch ( $hook_suffix ) {
     
    19191913                    );
    19201914
     1915                   
     1916                    wp_enqueue_script(
     1917                        'aioseop-admin-functions',
     1918                        AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js',
     1919                        array(),
     1920                        AIOSEOP_VERSION
     1921                    );
     1922
    19211923                    $count_chars_data = array(
    1922                         'isGutenberg'   => $is_gutenberg,
    19231924                        'pluginDirName' => AIOSEOP_PLUGIN_DIRNAME,
    19241925                        'currentPage'   => $hook_suffix,
  • all-in-one-seo-pack/tags/3.3.4/readme.txt

    r2195818 r2215789  
    44Requires at least: 4.9
    55Tested up to: 5.3
    6 Stable tag: 3.3.3
     6Stable tag: 3.3.4
    77License: GPLv2 or later
    88Requires PHP: 5.2.4
  • all-in-one-seo-pack/trunk/aioseop_class.php

    r2190206 r2215789  
    566566                    ),
    567567                    'aiosp_ga_advanced_options' => 'on',
    568                     'aiosp_gtm_container_id'    => array(
    569                         'lhs' => 'aiosp_gtm_container_id',
    570                         'op'  => '==',
    571                         'rhs' => '',
    572                     ),
    573568                ),
    574569            ),
     
    597592                    ),
    598593                    'aiosp_ga_advanced_options' => 'on',
    599                     'aiosp_gtm_container_id'    => array(
    600                         'lhs' => 'aiosp_gtm_container_id',
    601                         'op'  => '==',
    602                         'rhs' => '',
    603                     ),
    604594                ),
    605595            ),
     
    36673657        global $current_screen;
    36683658        global $aioseop_options;
    3669         $current_screen = get_current_screen();
    3670         $is_gutenberg   = 'false';
    3671 
    3672         if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
    3673             $is_gutenberg = 'true';
    3674         }
    36753659
    36763660        add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
     
    36973681
    36983682                $snippet_preview_data = array(
    3699                     'isGutenberg'              => $is_gutenberg,
    37003683                    'autogenerateDescriptions' => $aioseop_options['aiosp_generate_descriptions'],
    37013684                    'skipExcerpt'              => $aioseop_options['aiosp_skip_excerpt'],
     
    37033686
    37043687                $count_chars_data['extraTitleLength']         = $extra_title_length;
    3705                 $count_chars_data['isGutenberg']              = $is_gutenberg;
    37063688                $count_chars_data['autogenerateDescriptions'] = $aioseop_options['aiosp_generate_descriptions'];
    37073689
     
    37243706                $count_chars_data['pluginDirName'] = AIOSEOP_PLUGIN_DIRNAME;
    37253707                $count_chars_data['currentPage']   = $hook_suffix;
     3708
     3709                wp_enqueue_script(
     3710                    'aioseop-admin-functions',
     3711                    AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js',
     3712                    array(),
     3713                    AIOSEOP_VERSION
     3714                );
    37263715
    37273716                wp_enqueue_script(
  • all-in-one-seo-pack/trunk/all_in_one_seo_pack.php

    r2195818 r2215789  
    44Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
    55Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007.
    6 Version: 3.3.3
     6Version: 3.3.4
    77Author: Michael Torbert
    88Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
     
    3232 *
    3333 * @package All-in-One-SEO-Pack
    34  * @version 3.3.3
     34 * @version 3.3.4
    3535 */
    3636
     
    4646}
    4747if ( ! defined( 'AIOSEOP_VERSION' ) ) {
    48     define( 'AIOSEOP_VERSION', '3.3.3' );
     48    define( 'AIOSEOP_VERSION', '3.3.4' );
    4949}
    5050
  • all-in-one-seo-pack/trunk/js/admin/aioseop-count-chars.js

    r2195818 r2215789  
    1111    "use strict";
    1212
    13     let isGutenberg;
    14     let autogenerateDescriptions;
     13    let inputField;
     14    let counterField;
     15    let fieldSize;
    1516    let extraTitleLength;
    1617    let pluginDirName;
    1718    let currentPage;
    18     let inputField;
    19     let counterField;
    20     let fieldSize;
    21     let timeout = 0;
     19    let autogenerateDescriptions;
     20    let isGutenbergEditor = aioseopIsGutenbergEditor();
    2221
    2322    if ('undefined' !== typeof aioseopCharacterCounter) {
    24         isGutenberg              = aioseopCharacterCounter.isGutenberg;
    25         autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;
    2623        extraTitleLength         = +aioseopCharacterCounter.extraTitleLength;
    2724        pluginDirName            = aioseopCharacterCounter.pluginDirName;
    2825        currentPage              = aioseopCharacterCounter.currentPage;
     26        autogenerateDescriptions = aioseopCharacterCounter.autogenerateDescriptions;
    2927    }
    3028    else if ('undefined' !== typeof aioseopOGCharacterCounter) {
    31         isGutenberg   = aioseopOGCharacterCounter.isGutenberg;
    3229        pluginDirName = aioseopOGCharacterCounter.pluginDirName;
    3330        currentPage   = aioseopOGCharacterCounter.currentPage;
    3431    }
     32
    3533    aioseopAddEventListeners();
    3634    // Fire once on page load.
     
    4543     */
    4644    function aioseopAddEventListeners() {
    47         aioseopAddGeneralListener();
     45
     46        aioseopSetInputEventListeners();
    4847
    4948        if (!aioseopIsEditPage()) {
     
    5150        }
    5251
    53         if ('false' === isGutenberg) {
    54             aioseopAddClassicEditorListener();
     52        if (!isGutenbergEditor) {
     53            aioseopSetClassicEditorListeners();
    5554        } else {
    56             aioseopAddGutenbergEditorListener();
    57         }
    58     }
    59 
    60     /**
    61      * Adds the general/shared events listeners.
     55            aioseopSetGutenbergEditorEventListener(aioseopCountChars);
     56        }
     57    }
     58
     59    /**
     60     * Adds the event listener to the input field of the character counter.
    6261     *
    6362     * @since 3.3.0
     
    6564     * @return void
    6665     */
    67     function aioseopAddGeneralListener() {
     66    function aioseopSetInputEventListeners() {
    6867        $('.aioseop_count_chars').on('keyup', function () {
    6968            aioseopCountChars();
     
    7574     *
    7675     * @since 3.3.0
    77      *
    78      * @return void
    79      */
    80     function aioseopAddClassicEditorListener() {
    81         setTimeout(function () {
    82             tinymce.editors[0].on('KeyUp', function () {
    83                 aioseopCountChars();
    84             });
    85         }, 1000);
     76     * @since 3.3.4 Add support for text tab of Classic Editor.
     77     *
     78     * @return void
     79     */
     80    function aioseopSetClassicEditorListeners() {
     81
     82        aioseopSetClassicEditorEventListener(aioseopCountChars);
    8683
    8784        $('#title, #excerpt').on('keyup', function () {
    8885            aioseopCountChars();
    89         });
    90     }
    91 
    92     /**
    93      * Adds the event listener for the Gutenberg Editor.
    94      *
    95      * @since 3.3.0
    96      *
    97      * @return void
    98      */
    99     function aioseopAddGutenbergEditorListener() {
    100         window._wpLoadBlockEditor.then(function () {
    101             setTimeout(function () {
    102                 // https://developer.wordpress.org/block-editor/packages/packages-data/
    103                 wp.data.subscribe(function () {
    104                     clearTimeout(timeout);
    105                     timeout = setTimeout(function () {
    106                         aioseopCountChars();
    107                     }, 200);
    108                 });
    109             });
    11086        });
    11187    }
  • all-in-one-seo-pack/trunk/js/admin/aioseop-preview-snippet.js

    r2192264 r2215789  
    1818    let aioseopDescription       = $('textarea[name="aiosp_description"]');
    1919    let timeout                  = 0;
    20     let isGutenberg              = aioseop_preview_snippet.isGutenberg;
    2120    let autogenerateDescriptions = aioseop_preview_snippet.autogenerateDescriptions;
    2221    let skipExcerpt              = aioseop_preview_snippet.skipExcerpt;
     22    let isGutenbergEditor        = aioseopIsGutenbergEditor();
    2323
    24     aioseopUpdateMetabox();
     24    aioseopInitPreviewSnippet();
    2525
    2626    /**
    27      * The aioseopUpdateMetabox() function.
    28      *
    29      * Updates the preview snippet and input field placeholders in the meta box when a change happens.
     27     * Defines the relevant fields and adds the relevant event listeners based on which editor is active.
    3028     *
    3129     * @since 3.3.0
     30     * @since 3.3.4 Add support for text tab in Classic Editor.
    3231     */
    33     function aioseopUpdateMetabox() {
     32    function aioseopInitPreviewSnippet() {
    3433        let inputFields = [aioseopTitle, aioseopDescription];
    3534
    36         if ('false' === isGutenberg) {
     35        if (!isGutenbergEditor) {
    3736            docTitle = $('#title');
    3837            let postExcerpt = $('#excerpt');
     
    4039            inputFields.push(docTitle, postExcerpt);
    4140
    42             setTimeout(function () {
    43                 tinymce.editors[0].on('KeyUp', function () {
    44                     aioseopUpdatePreviewSnippet();
    45                 });
    46             }, 1000);
     41            aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet);
     42            aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet);
    4743        }
    4844        else {
    49             window._wpLoadBlockEditor.then(function () {
    50                 setTimeout(function () {
    51                     // https://developer.wordpress.org/block-editor/packages/packages-data/
    52                     wp.data.subscribe(function () {
    53                         clearTimeout(timeout);
    54                         // This is needed because the code otherwise is triggered dozens of times.
    55                         timeout = setTimeout(function () {
    56                             aioseopUpdatePreviewSnippet();
    57                         }, 200);
    58                     });
    59                 });
    60             });
     45            aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet);
    6146        }
    6247
     
    6853        }
    6954
    70         //Run once on page load.
     55        // Run once on page load.
    7156        timeout = setTimeout(function () {
    7257            aioseopUpdatePreviewSnippet();
     
    7560
    7661    /**
    77      * AIOSEOP Update Preview Snippet
     62     * Updates the preview snippet and input field placeholders in the meta box when a change happens.
    7863     *
    7964     * @uses wp.data.select().getEditedPostAttribute()
    8065     * @link https://developer.wordpress.org/block-editor/data/data-core-editor/#getEditedPostAttribute
    8166     *
    82      * @since 3.3
     67     * @since 3.3.0
    8368     */
    8469    function aioseopUpdatePreviewSnippet() {
     
    8772        let postExcerpt = '';
    8873
    89         if ('false' === isGutenberg) {
     74        if (aioseopEditorUndefined) {
     75            return;
     76        }
     77       
     78        if (!isGutenbergEditor) {
    9079            postTitle   = aioseopStripMarkup($.trim($('#title').val()));
    91             postContent = aioseopShortenDescription($('#content_ifr').contents().find('body')[0].innerHTML);
    92             postExcerpt = aioseopShortenDescription($.trim($('#excerpt').val()));
     80            postContent = aioseopGetDescription(aioseopGetClassicEditorContent());
     81            postExcerpt = aioseopGetDescription($.trim($('#excerpt').val()));
    9382        }
    9483        else {
    9584            postTitle   = aioseopStripMarkup($.trim($('#post-title-0').val()));
    96             postContent = aioseopShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));
    97             postExcerpt = aioseopShortenDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));
     85            postContent = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('content'));
     86            postExcerpt = aioseopGetDescription(wp.data.select('core/editor').getEditedPostAttribute('excerpt'));
    9887        }
    9988
     
    128117
    129118    /**
    130      * The aioseopShortenDescription() function.
    131      *
    132      * Shortens the description to max. 160 characters without truncation.
     119     * Shortens the description to 160 characters without truncation.
    133120     *
    134121     * @since 3.3.0
     122     * @since 3.3.4 Shorten post content to improve performance.
    135123     *
    136      * @param string description
     124     * @param string postContent
     125     * @return string description
    137126     */
    138     function aioseopShortenDescription(description) {
     127    function aioseopGetDescription(postContent) {
     128        // Shorten content first to avoid performance drops.
     129        let description = postContent.substring(0, 5000);
     130
    139131        description = aioseopStripMarkup(description);
    140132        if (160 < description.length) {
     
    148140
    149141    /**
    150      * The aioseopStripMarkup() function.
    151      *
    152142     * Strips all editor markup from a string.
    153143     *
     
    161151        content = content.replace(/(<[^ >][^>]*>)?/gm, '');
    162152        // Remove all line breaks.
    163         content = content.replace(/\s\s+/g, ' ');
     153        content = content.replace(/[\r\n]+/gm, ' ');
    164154        return aioseopDecodeHtmlEntities(content.trim());
    165155    }
    166156
    167157    /**
    168      * The aioseopDecodeHtmlEntities() function.
    169      *
    170158     * Decodes HTML entities to characters.
    171159     *
  • all-in-one-seo-pack/trunk/modules/aioseop_opengraph.php

    r2195818 r2215789  
    18851885         */
    18861886        public function admin_enqueue_scripts( $hook_suffix ) {
    1887             global $current_screen;
    1888 
    1889             $is_gutenberg = 'false';
    1890             if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
    1891                 $is_gutenberg = 'true';
    1892             }
    18931887
    18941888            switch ( $hook_suffix ) {
     
    19191913                    );
    19201914
     1915                   
     1916                    wp_enqueue_script(
     1917                        'aioseop-admin-functions',
     1918                        AIOSEOP_PLUGIN_URL . 'js/admin/aioseop-admin-functions.js',
     1919                        array(),
     1920                        AIOSEOP_VERSION
     1921                    );
     1922
    19211923                    $count_chars_data = array(
    1922                         'isGutenberg'   => $is_gutenberg,
    19231924                        'pluginDirName' => AIOSEOP_PLUGIN_DIRNAME,
    19241925                        'currentPage'   => $hook_suffix,
  • all-in-one-seo-pack/trunk/readme.txt

    r2195818 r2215789  
    44Requires at least: 4.9
    55Tested up to: 5.3
    6 Stable tag: 3.3.3
     6Stable tag: 3.3.4
    77License: GPLv2 or later
    88Requires PHP: 5.2.4
Note: See TracChangeset for help on using the changeset viewer.