Plugin Directory

Changeset 2420259


Ignore:
Timestamp:
11/17/2020 06:22:30 PM (5 years ago)
Author:
milanmk
Message:

Release 1.17.2

Location:
schema-app-structured-data-for-schemaorg
Files:
27 added
4 edited

Legend:

Unmodified
Added
Removed
  • schema-app-structured-data-for-schemaorg/trunk/hunch-schema.php

    r2416619 r2420259  
    55 * Plugin URI: http://www.schemaapp.com
    66 * Description: This plugin adds http://schema.org structured data to your website
    7  * Version: 1.17.1
     7 * Version: 1.17.2
    88 * Author: Hunch Manifest
    99 * Author URI: https://www.hunchmanifest.com
  • schema-app-structured-data-for-schemaorg/trunk/lib/SchemaServer.php

    r2416619 r2420259  
    8686
    8787
    88             // Check to avoid triggering of schedule event when request is originated from WP Cron
    89             if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) {
    90                 // Delegate API schema fetching to cron and pass requested resource as argument
    91                 wp_schedule_single_event( time(), 'schema_app_cron_resource_from_api', array( $resource ) );
     88            if ( ! empty( $this->options['SchemaDefaultEditorMarkupBackgroundSync'] ) ) {
     89                // Check to avoid triggering of schedule event when request is originated from WP Cron
     90                if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) {
     91                    // Delegate API schema fetching to cron and pass requested resource as argument
     92                    wp_schedule_single_event( time(), 'schema_app_cron_resource_from_api', array( $resource ) );
     93                }
     94            } else {
     95                return $this->getResourceFromAPI();
    9296            }
    9397
     
    103107         * @uses wp_remote_get()
    104108         * @uses set_transient()
    105          * @param string $uri Post/Page permalink.
     109         * @param string $uri Post/Page permalink. For Cron event supplying $uri will prepare necessary resource attributes by calling SchemaServer->getResource().
    106110         * @return string JSON encoded schema markup.
    107111         */
    108112        public function getResourceFromAPI( $uri = '' ) {
    109             // Prepare necessary resource attributes
    110             $this->getResource( $uri );
     113            if ( $uri ) {
     114                // Prepare necessary resource attributes
     115                $this->getResource( $uri );
     116            }
    111117
    112118            $schema_data = '';
  • schema-app-structured-data-for-schemaorg/trunk/lib/SchemaSettings.php

    r2411907 r2420259  
    6161        $Settings['Version'] = $this->PluginVersion;
    6262
     63        // Set default setting values for plugin updates
    6364        if ( ! isset( $Settings['SchemaDefaultShowOnPost'] ) ) {
    6465            $Settings['SchemaDefaultShowOnPost'] = 1;
     
    6970        if ( ! isset( $Settings['SchemaDefaultVideoMarkup'] ) ) {
    7071            $Settings['SchemaDefaultVideoMarkup'] = 1;
     72        }
     73        if ( ! isset( $Settings['SchemaDefaultEditorMarkupBackgroundSync'] ) ) {
     74            $Settings['SchemaDefaultEditorMarkupBackgroundSync'] = 0;
    7175        }
    7276
     
    337341        add_settings_field( 'SchemaDefaultTypePage', 'Page Default Schema Type', array( $this, 'SettingsFieldSchemaDefaultTypePage' ), 'schema-app-setting', 'schema-default' );
    338342        add_settings_field( 'SchemaDefaultVideoMarkup', 'Show video markup', array( $this, 'SettingsFieldSchemaDefaultVideoMarkup' ), 'schema-app-setting', 'schema-default' );
     343        add_settings_field( 'SchemaDefaultEditorMarkupBackgroundSync', 'Background sync of Schema Editor markup', array( $this, 'SettingsFieldSchemaDefaultEditorMarkupBackgroundSync' ), 'schema-app-setting', 'schema-default' );
    339344        add_settings_field( 'SchemaDefaultImage', 'Default Image', array( $this, 'SettingsFieldSchemaDefaultImage' ), 'schema-app-setting', 'schema-default' );
    340345
     
    547552
    548553
    549         foreach ( array( 'publisher_type', 'publisher_name', 'publisher_image', 'SchemaDefaultShowOnPost', 'SchemaDefaultShowOnPage', 'SchemaDefaultLocation', 'SchemaDefaultTypePost', 'SchemaDefaultTypePage', 'SchemaDefaultVideoMarkup', 'SchemaDefaultImage', 'Debug', 'ToolbarShowTestSchema', 'SchemaBreadcrumb', 'SchemaWebSite', 'SchemaArticleBody', 'SchemaHideComments', 'SchemaLinkedOpenData', 'SchemaRemoveMicrodata', 'SchemaRemoveWPSEOMarkup', 'Version', 'NoticeDismissWooCommerceAddon' ) as $FieldName )
     554        foreach ( array( 'publisher_type', 'publisher_name', 'publisher_image', 'SchemaDefaultShowOnPost', 'SchemaDefaultShowOnPage', 'SchemaDefaultLocation', 'SchemaDefaultTypePost', 'SchemaDefaultTypePage', 'SchemaDefaultVideoMarkup', 'SchemaDefaultEditorMarkupBackgroundSync', 'SchemaDefaultImage', 'Debug', 'ToolbarShowTestSchema', 'SchemaBreadcrumb', 'SchemaWebSite', 'SchemaArticleBody', 'SchemaHideComments', 'SchemaLinkedOpenData', 'SchemaRemoveMicrodata', 'SchemaRemoveWPSEOMarkup', 'Version', 'NoticeDismissWooCommerceAddon' ) as $FieldName )
    550555        {
    551556            if ( isset( $input[$FieldName] ) && $input[$FieldName] != '' )
     
    666671
    667672
    668         print '<h3>Scheduled resources from API</h3>';
    669 
    670         if ( ! empty( _get_cron_array() ) ) {
    671             print '<ol>';
    672 
    673             foreach ( _get_cron_array() as $item ) {
    674                 foreach ( $item as $key => $value ) {
    675                     if ( $key != 'schema_app_cron_resource_from_api' ) {
    676                         continue 2;
     673        if ( ! empty( $this->Settings['SchemaDefaultEditorMarkupBackgroundSync'] ) ) {
     674            print '<h3>Scheduled resources from API</h3>';
     675
     676            if ( ! empty( _get_cron_array() ) ) {
     677                print '<ol>';
     678
     679                foreach ( _get_cron_array() as $item ) {
     680                    foreach ( $item as $key => $value ) {
     681                        if ( $key != 'schema_app_cron_resource_from_api' ) {
     682                            continue 2;
     683                        }
     684
     685                        $event = reset( $value );
     686                        $argument = reset( $event['args'] );
    677687                    }
    678688
    679                     $event = reset( $value );
    680                     $argument = reset( $event['args'] );
     689                    printf( '<li> <p>%s</p> </li>', $argument );
    681690                }
    682691
    683                 printf( '<li> <p>%s</p> </li>', $argument );
     692                print '</ol>';
     693            } else {
     694                print '<p>No scheduled items found.</p>';
    684695            }
    685696
    686             print '</ol>';
    687         } else {
    688             print '<p>No scheduled items found.</p>';
     697            print '<br><br> <hr>';
    689698        }
    690699
     
    693702
    694703
    695         print '<br><br> <hr> <h3>Cached schema data</h3>';
     704        print '<h3>Cached schema data</h3>';
    696705
    697706        if ( $transients ) {
     
    903912                <option value="0" <?php selected( $Value, 0 ); ?>>Disabled</option>
    904913            </select>
     914
     915        <?php
     916    }
     917   
     918
     919    public function SettingsFieldSchemaDefaultEditorMarkupBackgroundSync( $Options ) {
     920        // Default disabled
     921        $Value = ! empty( $this->Settings['SchemaDefaultEditorMarkupBackgroundSync'] ) ? $this->Settings['SchemaDefaultEditorMarkupBackgroundSync'] : 0;
     922
     923        ?>
     924
     925            <select name="schema_option_name[SchemaDefaultEditorMarkupBackgroundSync]">
     926                <option value="1" <?php selected( $Value, 1 ); ?>>Enabled</option>
     927                <option value="0" <?php selected( $Value, 0 ); ?>>Disabled</option>
     928            </select>
     929            <p>Use background WP Cron task to fetch Editor Schema markup through API.</p>
    905930
    906931        <?php
  • schema-app-structured-data-for-schemaorg/trunk/readme.txt

    r2416619 r2420259  
    99Requires PHP: 5.4
    1010Tested up to: 5.5
    11 Stable tag: 1.17.1
     11Stable tag: 1.17.2
    1212License: GPL2
    1313License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8888== Changelog ==
    8989
     90= 1.17.2 =
     91- Improve, Added option to enable/disable background sync of Schema Editor markup
     92
    9093= 1.17.1 =
    9194- Improve, Caching of API response when no schema data is available for a resource
     
    436439== Upgrade Notice ==
    437440
    438 = 1.17.1 =
    439  - Schema data fetching from API is now handled by WP Cron, updated get permalink routine for detecting correct urls
     441= 1.17.2 =
     442 - Added option to enable/disable background sync of Schema Editor markup
Note: See TracChangeset for help on using the changeset viewer.