Plugin Directory

Changeset 2725617


Ignore:
Timestamp:
05/17/2022 07:49:55 PM (4 years ago)
Author:
sophidev
Message:

Update to version 1.1.1 from GitHub

Location:
sophi
Files:
2 added
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sophi/tags/1.1.1/includes/blocks/site-automation-block/register.php

    r2648442 r2725617  
    4343    $curated_posts_transient_key = 'sophi_curated_posts_' . $page_name . '_' . $widget_name;
    4444
     45    /**
     46     * Whether to bypass caching.
     47     *
     48     * @since 1.1.1
     49     * @hook sophi_bypass_curated_posts_cache
     50     *
     51     * @param {bool} $bypass_cache True or false.
     52     * @param {string} $page Page name.
     53     * @param {string} $widget Widget name.
     54     *
     55     * @return {bool} Whether to bypass cache.
     56     */
     57    $bypass_cache = apply_filters( 'sophi_bypass_curated_posts_cache', false, $page_name, $widget_name );
     58
    4559    $curated_posts = get_transient( $curated_posts_transient_key );
    4660
    47     if ( false === $curated_posts ) {
     61    if ( $bypass_cache || false === $curated_posts ) {
    4862        // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts
    4963        $curated_posts = get_posts(
  • sophi/tags/1.1.1/includes/classes/SiteAutomation/Auth.php

    r2719676 r2725617  
    8181        $args = apply_filters( 'sophi_request_args', $args, $auth_url );
    8282
    83         $request = wp_remote_post( $auth_url, $args );
     83        $result = wp_remote_post( $auth_url, $args );
    8484
    8585        /** This filter is documented in includes/classes/SiteAutomation/Request.php */
    86         $request = apply_filters( 'sophi_request_result', $request, $args, $auth_url );
     86        $result = apply_filters( 'sophi_request_result', $result, $args, $auth_url );
    8787
    88         if ( is_wp_error( $request ) ) {
    89             return $request;
     88        if ( is_wp_error( $result ) ) {
     89            return $result;
    9090        }
    9191
    92         if ( 401 === wp_remote_retrieve_response_code( $request ) ) {
     92        if ( 401 === wp_remote_retrieve_response_code( $result ) ) {
    9393            return new \WP_Error( 401, __( 'Invalid credentials! Please confirm your client ID and secret then try again.', 'sophi-wp' ) );
    9494        }
    9595
    96         if ( 200 !== wp_remote_retrieve_response_code( $request ) ) {
    97             return new \WP_Error( $request['response']['code'], $request['response']['message'] );
     96        if ( 200 !== wp_remote_retrieve_response_code( $result ) ) {
     97            return new \WP_Error( $result['response']['code'], $result['response']['message'] );
    9898        }
    9999
    100         $response = wp_remote_retrieve_body( $request );
    101         $response = json_decode( $response, true );
     100        $response = wp_remote_retrieve_body( $result );
    102101
    103         return $response;
     102        return json_decode( $response, true );
    104103    }
    105104
  • sophi/tags/1.1.1/includes/classes/SiteAutomation/Request.php

    r2719676 r2725617  
    226226         * @param {array}   $args HTTP request arguments.
    227227         * @param {string}  $url  The request URL.
    228          * 
     228         *
    229229         * @return {array} HTTP request arguments.
    230230         */
     
    232232
    233233        if ( function_exists( 'vip_safe_wp_remote_get' ) ) {
    234             $request = vip_safe_wp_remote_get( $this->api_url, '', 3, $timeout, 20, $args );
     234            $result = vip_safe_wp_remote_get( $this->api_url, '', 3, $timeout, 20, $args );
    235235        } else {
    236236            $args['timeout'] = $timeout;
    237             $request         = wp_remote_get( $this->api_url, $args ); // phpcs:ignore
     237            $result          = wp_remote_get( $this->api_url, $args ); // phpcs:ignore
    238238        }
    239239
     
    244244         * @hook sophi_request_result
    245245         *
    246          * @param {array|WP_Error}  $request Result of HTTP request.
     246         * @param {array|WP_Error}  $result Result of HTTP request.
    247247         * @param {array}           $args     HTTP request arguments.
    248248         * @param {string}          $url      The request URL.
    249          * 
     249         *
    250250         * @return {array|WP_Error} Result of HTTP request.
    251251         */
    252         $request = apply_filters( 'sophi_request_result', $request, $args, $this->api_url );
    253 
    254         if ( is_wp_error( $request ) ) {
    255             return $request;
    256         }
    257 
    258         if ( wp_remote_retrieve_response_code( $request ) !== 200 ) {
    259             return new \WP_Error( wp_remote_retrieve_response_code( $request ), $request['response']['message'] );
    260         }
    261 
    262         return json_decode( wp_remote_retrieve_body( $request ), true );
     252        $result = apply_filters( 'sophi_request_result', $result, $args, $this->api_url );
     253
     254        if ( is_wp_error( $result ) ) {
     255            return $result;
     256        }
     257
     258        if ( wp_remote_retrieve_response_code( $result ) !== 200 ) {
     259            return new \WP_Error( wp_remote_retrieve_response_code( $result ), $result['response']['message'] );
     260        }
     261
     262        return json_decode( wp_remote_retrieve_body( $result ), true );
    263263    }
    264264
  • sophi/tags/1.1.1/includes/functions/content-sync.php

    r2719676 r2725617  
    1616use Snowplow\Tracker\Tracker;
    1717use Snowplow\Tracker\Subject;
    18 use Snowplow\Tracker\Emitters\SyncEmitter;
     18use SophiWP\Emitter;
    1919
    2020/**
     
    136136     *
    137137     * @since 1.0.14
    138      * @hook sophi_tracking_data
     138     * @hook sophi_cms_tracking_request_data
    139139     *
    140140     * @param {array}   $data    Tracking data to send.
    141141     * @param {Tracker} $tracker Tracker being used.
    142      * @param {string}  $url     Post object.
     142     * @param {string}  $post    Post object.
    143143     * @param {string}  $action  Publishing action.
    144144     *
     
    146146     */
    147147    $data = apply_filters_ref_array( 'sophi_cms_tracking_request_data', array( $data, &$tracker, $post, $action ) );
     148
     149    /** This filter is documented in includes/functions/content-sync.php */
     150    $debug = apply_filters( 'sophi_tracker_emitter_debug', false );
     151
     152    // Suppress stdout from Emitters in debug mode.
     153    if ( true === $debug ) {
     154        ob_start();
     155    }
     156
    148157    $tracker->trackUnstructEvent(
    149158        [
     
    162171    );
    163172
     173    if ( true === $debug ) {
     174        ob_end_clean();
     175    }
     176
    164177    /**
    165178     * Fires after tracker sends the request.
    166179     *
    167180     * @since 1.0.14
    168      * @hook sophi_tracking_result
     181     * @hook sophi_cms_tracking_result
    169182     *
    170183     * @param {array}   $data    Tracked data.
     
    212225
    213226    $app_id  = sprintf( '%s:cms', $tracker_client_id );
    214     $emitter = new SyncEmitter( $collector_url, 'https', 'POST', 1, $debug );
     227    $emitter = new Emitter( $collector_url, 'https', 'POST', 1, $debug );
    215228    $subject = new Subject();
    216229    return new Tracker( $emitter, $subject, 'sophiTag', $app_id, false );
     
    257270        'plainText'           => wp_strip_all_tags( $content ),
    258271        'size'                => str_word_count( wp_strip_all_tags( $content ) ),
     272        'allSections'         => Utils\get_post_categories_paths( $post->ID ),
    259273        'sectionNames'        => Utils\get_post_categories( $post->ID ),
    260274        'modifiedAt'          => gmdate( \DateTime::RFC3339, strtotime( $post->post_modified_gmt ) ),
  • sophi/tags/1.1.1/includes/functions/utils.php

    r2719676 r2725617  
    399399
    400400/**
     401 * Return an array of category paths from a given post.
     402 *
     403 * @param int $post_id The post ID.
     404 * @return array The array of category paths, or an empty array if no categories.
     405 */
     406function get_post_categories_paths( $post_id ) {
     407    $categories    = get_the_category( $post_id );
     408    $paths         = [];
     409
     410    foreach ( $categories as $category ) {
     411        if ( is_a( $category, 'WP_Term' ) && 'category' === $category->taxonomy ) {
     412            $hierarchical_slugs = [];
     413            $ancestors          = get_ancestors( $category->term_id, $category->taxonomy, 'taxonomy' );
     414            foreach ( (array) $ancestors as $ancestor ) {
     415                $ancestor_term        = get_term( $ancestor, $category->taxonomy );
     416                $hierarchical_slugs[] = $ancestor_term->slug;
     417            }
     418            $hierarchical_slugs   = array_reverse( $hierarchical_slugs );
     419            $hierarchical_slugs[] = $category->slug;
     420            $paths[] = '/' . implode( '/', $hierarchical_slugs );
     421        }
     422    }
     423
     424    return $paths;
     425}
     426
     427/**
    401428 * Get the post categories preserving the hierarchical order
    402429 *
  • sophi/tags/1.1.1/readme.txt

    r2719676 r2725617  
    33Tags:              Sophi, Site Automation, Curator, Collector, AI, Artifical Intelligence, ML, Machine Learning, Content Curation
    44Tested up to:      5.9
    5 Stable tag:        1.1.0
     5Stable tag:        1.1.1
    66License:           GPLv2 or later
    77License URI:       http://www.gnu.org/licenses/gpl-2.0.html
     
    149149Sophi for WordPress has an in-depth documentation site that details the available actions and filters found within the plugin. [Visit the developer docs ☞](https://globeandmail.github.io/sophi-for-wordpress/)
    150150
     151== Debugging ==
     152
     153If you are having difficulties with your Sophi integration, then we recommend utilizing the [Debug Bar for Sophi](https://wordpress.org/plugins/debug-bar-for-sophi/) plugin to help triage your Sophi Authentication, Sophi API integration, and CMS publish/update events.
     154
    151155== Frequently Asked Questions ==
    152156
     
    174178
    175179== Changelog ==
     180
     181= 1.1.1 - 2022-05-17 =
     182* **Added:** `sophi_bypass_curated_posts_cache` filter to bypess curated posts cache (props [@cadic](https://github.com/cadic)).
     183* **Added:** Send all Categories in new `allSections` field to Sophi (props [@oscarssanchez](https://github.com/oscarssanchez), [@jeffpaul](https://github.com/jeffpaul), [@tott](https://github.com/tott)).
     184* **Changed:** `$result` is used instead of `$request` to store return value of the `sophi_request_result` filter (props [@faisal-alvi](https://github.com/faisal-alvi), [@Sidsector9](https://github.com/Sidsector9), [@cadic](https://github.com/cadic)).
     185* **Changed:** Suppress Emitter debug output and writing logs (props [@cadic](https://github.com/cadic)).
     186* **Fixed:** [Hook Docs](https://globeandmail.github.io/sophi-for-wordpress/) deployment GitHub Action and included filter docs (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@cadic](https://github.com/cadic)).
    176187
    177188= 1.1.0 - 2022-05-06 =
  • sophi/tags/1.1.1/sophi.php

    r2719676 r2725617  
    44 * Plugin URI:        https://github.com/globeandmail/sophi-for-wordpress
    55 * Description:       WordPress VIP-compatible plugin for the Sophi.io Site Automation service.
    6  * Version:           1.1.0
     6 * Version:           1.1.1
    77 * Requires at least: 5.6
    88 * Requires PHP:      7.4
     
    1717
    1818// Useful global constants.
    19 define( 'SOPHI_WP_VERSION', '1.1.0' );
     19define( 'SOPHI_WP_VERSION', '1.1.1' );
    2020define( 'SOPHI_WP_URL', plugin_dir_url( __FILE__ ) );
    2121define( 'SOPHI_WP_PATH', plugin_dir_path( __FILE__ ) );
  • sophi/tags/1.1.1/vendor/autoload.php

    r2719676 r2725617  
    1010require_once __DIR__ . '/composer/autoload_real.php';
    1111
    12 return ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221::getLoader();
     12return ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b::getLoader();
  • sophi/tags/1.1.1/vendor/composer/autoload_real.php

    r2719676 r2725617  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221
     5class ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInitedebab5f8c141d80dad48983397e451b::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $includeFiles = \Composer\Autoload\ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$files;
     36        $includeFiles = \Composer\Autoload\ComposerStaticInitedebab5f8c141d80dad48983397e451b::$files;
    3737        foreach ($includeFiles as $fileIdentifier => $file) {
    38             composerRequirebdfd77ff5462663cbbe04b8ffeb39221($fileIdentifier, $file);
     38            composerRequireedebab5f8c141d80dad48983397e451b($fileIdentifier, $file);
    3939        }
    4040
     
    4848 * @return void
    4949 */
    50 function composerRequirebdfd77ff5462663cbbe04b8ffeb39221($fileIdentifier, $file)
     50function composerRequireedebab5f8c141d80dad48983397e451b($fileIdentifier, $file)
    5151{
    5252    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • sophi/tags/1.1.1/vendor/composer/autoload_static.php

    r2719676 r2725617  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221
     7class ComposerStaticInitedebab5f8c141d80dad48983397e451b
    88{
    99    public static $files = array (
     
    8181    {
    8282        return \Closure::bind(function () use ($loader) {
    83             $loader->prefixLengthsPsr4 = ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$prefixLengthsPsr4;
    84             $loader->prefixDirsPsr4 = ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$prefixDirsPsr4;
    85             $loader->classMap = ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$classMap;
     83            $loader->prefixLengthsPsr4 = ComposerStaticInitedebab5f8c141d80dad48983397e451b::$prefixLengthsPsr4;
     84            $loader->prefixDirsPsr4 = ComposerStaticInitedebab5f8c141d80dad48983397e451b::$prefixDirsPsr4;
     85            $loader->classMap = ComposerStaticInitedebab5f8c141d80dad48983397e451b::$classMap;
    8686
    8787        }, null, ClassLoader::class);
  • sophi/tags/1.1.1/vendor/composer/installed.php

    r2719676 r2725617  
    11<?php return array(
    22    'root' => array(
    3         'pretty_version' => '1.1.0',
    4         'version' => '1.1.0.0',
     3        'pretty_version' => '1.1.1',
     4        'version' => '1.1.1.0',
    55        'type' => 'wordpress-plugin',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'd84a89aaba7208a28828807ba338aa7dfbf8246e',
     8        'reference' => '4bd4a394893a598c7fe75a10b6704d8312a57969',
    99        'name' => 'globeandmail/sophi-for-wordpress',
    1010        'dev' => false,
     
    2121        ),
    2222        'globeandmail/sophi-for-wordpress' => array(
    23             'pretty_version' => '1.1.0',
    24             'version' => '1.1.0.0',
     23            'pretty_version' => '1.1.1',
     24            'version' => '1.1.1.0',
    2525            'type' => 'wordpress-plugin',
    2626            'install_path' => __DIR__ . '/../../',
    2727            'aliases' => array(),
    28             'reference' => 'd84a89aaba7208a28828807ba338aa7dfbf8246e',
     28            'reference' => '4bd4a394893a598c7fe75a10b6704d8312a57969',
    2929            'dev_requirement' => false,
    3030        ),
  • sophi/trunk/includes/blocks/site-automation-block/register.php

    r2648442 r2725617  
    4343    $curated_posts_transient_key = 'sophi_curated_posts_' . $page_name . '_' . $widget_name;
    4444
     45    /**
     46     * Whether to bypass caching.
     47     *
     48     * @since 1.1.1
     49     * @hook sophi_bypass_curated_posts_cache
     50     *
     51     * @param {bool} $bypass_cache True or false.
     52     * @param {string} $page Page name.
     53     * @param {string} $widget Widget name.
     54     *
     55     * @return {bool} Whether to bypass cache.
     56     */
     57    $bypass_cache = apply_filters( 'sophi_bypass_curated_posts_cache', false, $page_name, $widget_name );
     58
    4559    $curated_posts = get_transient( $curated_posts_transient_key );
    4660
    47     if ( false === $curated_posts ) {
     61    if ( $bypass_cache || false === $curated_posts ) {
    4862        // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts
    4963        $curated_posts = get_posts(
  • sophi/trunk/includes/classes/SiteAutomation/Auth.php

    r2719676 r2725617  
    8181        $args = apply_filters( 'sophi_request_args', $args, $auth_url );
    8282
    83         $request = wp_remote_post( $auth_url, $args );
     83        $result = wp_remote_post( $auth_url, $args );
    8484
    8585        /** This filter is documented in includes/classes/SiteAutomation/Request.php */
    86         $request = apply_filters( 'sophi_request_result', $request, $args, $auth_url );
     86        $result = apply_filters( 'sophi_request_result', $result, $args, $auth_url );
    8787
    88         if ( is_wp_error( $request ) ) {
    89             return $request;
     88        if ( is_wp_error( $result ) ) {
     89            return $result;
    9090        }
    9191
    92         if ( 401 === wp_remote_retrieve_response_code( $request ) ) {
     92        if ( 401 === wp_remote_retrieve_response_code( $result ) ) {
    9393            return new \WP_Error( 401, __( 'Invalid credentials! Please confirm your client ID and secret then try again.', 'sophi-wp' ) );
    9494        }
    9595
    96         if ( 200 !== wp_remote_retrieve_response_code( $request ) ) {
    97             return new \WP_Error( $request['response']['code'], $request['response']['message'] );
     96        if ( 200 !== wp_remote_retrieve_response_code( $result ) ) {
     97            return new \WP_Error( $result['response']['code'], $result['response']['message'] );
    9898        }
    9999
    100         $response = wp_remote_retrieve_body( $request );
    101         $response = json_decode( $response, true );
     100        $response = wp_remote_retrieve_body( $result );
    102101
    103         return $response;
     102        return json_decode( $response, true );
    104103    }
    105104
  • sophi/trunk/includes/classes/SiteAutomation/Request.php

    r2719676 r2725617  
    226226         * @param {array}   $args HTTP request arguments.
    227227         * @param {string}  $url  The request URL.
    228          * 
     228         *
    229229         * @return {array} HTTP request arguments.
    230230         */
     
    232232
    233233        if ( function_exists( 'vip_safe_wp_remote_get' ) ) {
    234             $request = vip_safe_wp_remote_get( $this->api_url, '', 3, $timeout, 20, $args );
     234            $result = vip_safe_wp_remote_get( $this->api_url, '', 3, $timeout, 20, $args );
    235235        } else {
    236236            $args['timeout'] = $timeout;
    237             $request         = wp_remote_get( $this->api_url, $args ); // phpcs:ignore
     237            $result          = wp_remote_get( $this->api_url, $args ); // phpcs:ignore
    238238        }
    239239
     
    244244         * @hook sophi_request_result
    245245         *
    246          * @param {array|WP_Error}  $request Result of HTTP request.
     246         * @param {array|WP_Error}  $result Result of HTTP request.
    247247         * @param {array}           $args     HTTP request arguments.
    248248         * @param {string}          $url      The request URL.
    249          * 
     249         *
    250250         * @return {array|WP_Error} Result of HTTP request.
    251251         */
    252         $request = apply_filters( 'sophi_request_result', $request, $args, $this->api_url );
    253 
    254         if ( is_wp_error( $request ) ) {
    255             return $request;
    256         }
    257 
    258         if ( wp_remote_retrieve_response_code( $request ) !== 200 ) {
    259             return new \WP_Error( wp_remote_retrieve_response_code( $request ), $request['response']['message'] );
    260         }
    261 
    262         return json_decode( wp_remote_retrieve_body( $request ), true );
     252        $result = apply_filters( 'sophi_request_result', $result, $args, $this->api_url );
     253
     254        if ( is_wp_error( $result ) ) {
     255            return $result;
     256        }
     257
     258        if ( wp_remote_retrieve_response_code( $result ) !== 200 ) {
     259            return new \WP_Error( wp_remote_retrieve_response_code( $result ), $result['response']['message'] );
     260        }
     261
     262        return json_decode( wp_remote_retrieve_body( $result ), true );
    263263    }
    264264
  • sophi/trunk/includes/functions/content-sync.php

    r2719676 r2725617  
    1616use Snowplow\Tracker\Tracker;
    1717use Snowplow\Tracker\Subject;
    18 use Snowplow\Tracker\Emitters\SyncEmitter;
     18use SophiWP\Emitter;
    1919
    2020/**
     
    136136     *
    137137     * @since 1.0.14
    138      * @hook sophi_tracking_data
     138     * @hook sophi_cms_tracking_request_data
    139139     *
    140140     * @param {array}   $data    Tracking data to send.
    141141     * @param {Tracker} $tracker Tracker being used.
    142      * @param {string}  $url     Post object.
     142     * @param {string}  $post    Post object.
    143143     * @param {string}  $action  Publishing action.
    144144     *
     
    146146     */
    147147    $data = apply_filters_ref_array( 'sophi_cms_tracking_request_data', array( $data, &$tracker, $post, $action ) );
     148
     149    /** This filter is documented in includes/functions/content-sync.php */
     150    $debug = apply_filters( 'sophi_tracker_emitter_debug', false );
     151
     152    // Suppress stdout from Emitters in debug mode.
     153    if ( true === $debug ) {
     154        ob_start();
     155    }
     156
    148157    $tracker->trackUnstructEvent(
    149158        [
     
    162171    );
    163172
     173    if ( true === $debug ) {
     174        ob_end_clean();
     175    }
     176
    164177    /**
    165178     * Fires after tracker sends the request.
    166179     *
    167180     * @since 1.0.14
    168      * @hook sophi_tracking_result
     181     * @hook sophi_cms_tracking_result
    169182     *
    170183     * @param {array}   $data    Tracked data.
     
    212225
    213226    $app_id  = sprintf( '%s:cms', $tracker_client_id );
    214     $emitter = new SyncEmitter( $collector_url, 'https', 'POST', 1, $debug );
     227    $emitter = new Emitter( $collector_url, 'https', 'POST', 1, $debug );
    215228    $subject = new Subject();
    216229    return new Tracker( $emitter, $subject, 'sophiTag', $app_id, false );
     
    257270        'plainText'           => wp_strip_all_tags( $content ),
    258271        'size'                => str_word_count( wp_strip_all_tags( $content ) ),
     272        'allSections'         => Utils\get_post_categories_paths( $post->ID ),
    259273        'sectionNames'        => Utils\get_post_categories( $post->ID ),
    260274        'modifiedAt'          => gmdate( \DateTime::RFC3339, strtotime( $post->post_modified_gmt ) ),
  • sophi/trunk/includes/functions/utils.php

    r2719676 r2725617  
    399399
    400400/**
     401 * Return an array of category paths from a given post.
     402 *
     403 * @param int $post_id The post ID.
     404 * @return array The array of category paths, or an empty array if no categories.
     405 */
     406function get_post_categories_paths( $post_id ) {
     407    $categories    = get_the_category( $post_id );
     408    $paths         = [];
     409
     410    foreach ( $categories as $category ) {
     411        if ( is_a( $category, 'WP_Term' ) && 'category' === $category->taxonomy ) {
     412            $hierarchical_slugs = [];
     413            $ancestors          = get_ancestors( $category->term_id, $category->taxonomy, 'taxonomy' );
     414            foreach ( (array) $ancestors as $ancestor ) {
     415                $ancestor_term        = get_term( $ancestor, $category->taxonomy );
     416                $hierarchical_slugs[] = $ancestor_term->slug;
     417            }
     418            $hierarchical_slugs   = array_reverse( $hierarchical_slugs );
     419            $hierarchical_slugs[] = $category->slug;
     420            $paths[] = '/' . implode( '/', $hierarchical_slugs );
     421        }
     422    }
     423
     424    return $paths;
     425}
     426
     427/**
    401428 * Get the post categories preserving the hierarchical order
    402429 *
  • sophi/trunk/readme.txt

    r2719676 r2725617  
    33Tags:              Sophi, Site Automation, Curator, Collector, AI, Artifical Intelligence, ML, Machine Learning, Content Curation
    44Tested up to:      5.9
    5 Stable tag:        1.1.0
     5Stable tag:        1.1.1
    66License:           GPLv2 or later
    77License URI:       http://www.gnu.org/licenses/gpl-2.0.html
     
    149149Sophi for WordPress has an in-depth documentation site that details the available actions and filters found within the plugin. [Visit the developer docs ☞](https://globeandmail.github.io/sophi-for-wordpress/)
    150150
     151== Debugging ==
     152
     153If you are having difficulties with your Sophi integration, then we recommend utilizing the [Debug Bar for Sophi](https://wordpress.org/plugins/debug-bar-for-sophi/) plugin to help triage your Sophi Authentication, Sophi API integration, and CMS publish/update events.
     154
    151155== Frequently Asked Questions ==
    152156
     
    174178
    175179== Changelog ==
     180
     181= 1.1.1 - 2022-05-17 =
     182* **Added:** `sophi_bypass_curated_posts_cache` filter to bypess curated posts cache (props [@cadic](https://github.com/cadic)).
     183* **Added:** Send all Categories in new `allSections` field to Sophi (props [@oscarssanchez](https://github.com/oscarssanchez), [@jeffpaul](https://github.com/jeffpaul), [@tott](https://github.com/tott)).
     184* **Changed:** `$result` is used instead of `$request` to store return value of the `sophi_request_result` filter (props [@faisal-alvi](https://github.com/faisal-alvi), [@Sidsector9](https://github.com/Sidsector9), [@cadic](https://github.com/cadic)).
     185* **Changed:** Suppress Emitter debug output and writing logs (props [@cadic](https://github.com/cadic)).
     186* **Fixed:** [Hook Docs](https://globeandmail.github.io/sophi-for-wordpress/) deployment GitHub Action and included filter docs (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@cadic](https://github.com/cadic)).
    176187
    177188= 1.1.0 - 2022-05-06 =
  • sophi/trunk/sophi.php

    r2719676 r2725617  
    44 * Plugin URI:        https://github.com/globeandmail/sophi-for-wordpress
    55 * Description:       WordPress VIP-compatible plugin for the Sophi.io Site Automation service.
    6  * Version:           1.1.0
     6 * Version:           1.1.1
    77 * Requires at least: 5.6
    88 * Requires PHP:      7.4
     
    1717
    1818// Useful global constants.
    19 define( 'SOPHI_WP_VERSION', '1.1.0' );
     19define( 'SOPHI_WP_VERSION', '1.1.1' );
    2020define( 'SOPHI_WP_URL', plugin_dir_url( __FILE__ ) );
    2121define( 'SOPHI_WP_PATH', plugin_dir_path( __FILE__ ) );
  • sophi/trunk/vendor/autoload.php

    r2719676 r2725617  
    1010require_once __DIR__ . '/composer/autoload_real.php';
    1111
    12 return ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221::getLoader();
     12return ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b::getLoader();
  • sophi/trunk/vendor/composer/autoload_real.php

    r2719676 r2725617  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221
     5class ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitbdfd77ff5462663cbbe04b8ffeb39221', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitedebab5f8c141d80dad48983397e451b', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInitedebab5f8c141d80dad48983397e451b::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $includeFiles = \Composer\Autoload\ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$files;
     36        $includeFiles = \Composer\Autoload\ComposerStaticInitedebab5f8c141d80dad48983397e451b::$files;
    3737        foreach ($includeFiles as $fileIdentifier => $file) {
    38             composerRequirebdfd77ff5462663cbbe04b8ffeb39221($fileIdentifier, $file);
     38            composerRequireedebab5f8c141d80dad48983397e451b($fileIdentifier, $file);
    3939        }
    4040
     
    4848 * @return void
    4949 */
    50 function composerRequirebdfd77ff5462663cbbe04b8ffeb39221($fileIdentifier, $file)
     50function composerRequireedebab5f8c141d80dad48983397e451b($fileIdentifier, $file)
    5151{
    5252    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • sophi/trunk/vendor/composer/autoload_static.php

    r2719676 r2725617  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221
     7class ComposerStaticInitedebab5f8c141d80dad48983397e451b
    88{
    99    public static $files = array (
     
    8181    {
    8282        return \Closure::bind(function () use ($loader) {
    83             $loader->prefixLengthsPsr4 = ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$prefixLengthsPsr4;
    84             $loader->prefixDirsPsr4 = ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$prefixDirsPsr4;
    85             $loader->classMap = ComposerStaticInitbdfd77ff5462663cbbe04b8ffeb39221::$classMap;
     83            $loader->prefixLengthsPsr4 = ComposerStaticInitedebab5f8c141d80dad48983397e451b::$prefixLengthsPsr4;
     84            $loader->prefixDirsPsr4 = ComposerStaticInitedebab5f8c141d80dad48983397e451b::$prefixDirsPsr4;
     85            $loader->classMap = ComposerStaticInitedebab5f8c141d80dad48983397e451b::$classMap;
    8686
    8787        }, null, ClassLoader::class);
  • sophi/trunk/vendor/composer/installed.php

    r2719676 r2725617  
    11<?php return array(
    22    'root' => array(
    3         'pretty_version' => '1.1.0',
    4         'version' => '1.1.0.0',
     3        'pretty_version' => '1.1.1',
     4        'version' => '1.1.1.0',
    55        'type' => 'wordpress-plugin',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'd84a89aaba7208a28828807ba338aa7dfbf8246e',
     8        'reference' => '4bd4a394893a598c7fe75a10b6704d8312a57969',
    99        'name' => 'globeandmail/sophi-for-wordpress',
    1010        'dev' => false,
     
    2121        ),
    2222        'globeandmail/sophi-for-wordpress' => array(
    23             'pretty_version' => '1.1.0',
    24             'version' => '1.1.0.0',
     23            'pretty_version' => '1.1.1',
     24            'version' => '1.1.1.0',
    2525            'type' => 'wordpress-plugin',
    2626            'install_path' => __DIR__ . '/../../',
    2727            'aliases' => array(),
    28             'reference' => 'd84a89aaba7208a28828807ba338aa7dfbf8246e',
     28            'reference' => '4bd4a394893a598c7fe75a10b6704d8312a57969',
    2929            'dev_requirement' => false,
    3030        ),
Note: See TracChangeset for help on using the changeset viewer.