Plugin Directory

Changeset 3268962


Ignore:
Timestamp:
04/08/2025 02:17:39 PM (12 months ago)
Author:
skyword
Message:

Promote 1.1.4 to stable version

Location:
skyword-publishing-api
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • skyword-publishing-api/tags/1.1.4/readme.txt

    r3234975 r3268962  
    33Tags: skyword, api
    44Requires at least: 3.3
    5 Tested up to: 6.7.1
     5Tested up to: 6.8
    66Stable tag: 1.1.4
    77License: GPLv2 or later
  • skyword-publishing-api/trunk/php/class-skyword-shortcode.php

    r3078729 r3268962  
    3434        else
    3535            $id = get_post_meta(get_the_ID(), 'skyword_content_id', true);
    36         return "<script async='' type='text/javascript' src='//tracking.skyword.com/tracker.js?contentId={$id}'></script>";
     36        return wp_enqueue_script('skyword-api-tracking');;
    3737    }
    3838
     
    4848        else
    4949            $id = get_post_meta(get_the_ID(), 'skyword_content_id', true);
    50         return "<script async='' type='text/javascript' src='//tracking.skyword.com/tracker.js?contentId={$id}&anonymize=yes'></script>";
     50        return wp_enqueue_script('skyword-api-anonymous-tracking');;
    5151    }
    5252
     
    9292            }
    9393            if (in_array($k, $validattrs, true) && isset($v)) {
    94                 $iframeattrs .= " " . $k . "=\"" . $v . "\"";
     94                $iframeattrs .= " " . esc_attr($k) . "=\"" . esc_attr($v) . "\"";
    9595            }
    9696        }
     
    9999}
    100100
     101function register_api_tracking_scripts() {
     102    wp_register_script( 'skyword-api-tracking', '//tracking.skyword.com/tracker.js', array(), null, array("strategy" => "async"));
     103    wp_register_script( 'skyword-api-anonymous-tracking', '//tracking.skyword.com/tracker.js?anonymize=yes', array(), null, array("strategy" => "async"));
     104}
     105
     106add_action( 'wp_enqueue_scripts', 'register_api_tracking_scripts' );
     107
    101108global $custom_shortcodes;
    102109$custom_shortcodes = new Skyword_API_Shortcode;
  • skyword-publishing-api/trunk/php/class-skyword-sitemaps.php

    r3078729 r3268962  
    1414    public function skyword_sitemaps_generator() {
    1515        $options = get_option( 'skyword_api_plugin_options' );
     16        $request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
    1617        //echo "<pre>";print_r($options);
    1718        //check all requests for if they are for autogenerated robots.txt or sitemaps
    1819
    19         if  ( strpos(esc_attr(empty($_SERVER['REQUEST_URI'])), 'skyword-sitemap.xml') !== false) {
     20        if  ( strpos($request_uri, 'skyword-sitemap.xml') !== false) {
    2021            if ( $options['skyword_api_generate_all_sitemaps'] ) {
    2122                header( 'Content-type: text/xml' );
     
    2728                return;
    2829            }
    29         } else if ( strpos(esc_attr(empty($_SERVER['REQUEST_URI'])), 'skyword-pages-sitemap.xml') !== false) {
     30        } else if ( strpos($request_uri, 'skyword-pages-sitemap.xml') !== false) {
    3031            if ( $options['skyword_api_generate_pages_sitemaps'] ) {
    3132                header( 'Content-type: text/xml' );
     
    3738                return;
    3839            }
    39         } else if ( strpos(esc_attr(empty($_SERVER['REQUEST_URI'])), 'skyword-categories-sitemap.xml') !== false) {
     40        } else if ( strpos($request_uri, 'skyword-categories-sitemap.xml') !== false) {
    4041            if ( $options['skyword_api_generate_categories_sitemaps'] ) {
    4142                header( 'Content-type: text/xml' );
     
    4748                return;
    4849            }
    49         } else if ( strpos(esc_attr(empty($_SERVER['REQUEST_URI'])), 'skyword-tags-sitemap.xml') !== false) {
     50        } else if ( strpos($request_uri, 'skyword-tags-sitemap.xml') !== false) {
    5051            if ( $options['skyword_api_generate_tags_sitemaps'] ) {
    5152                header( 'Content-type: text/xml' );
     
    5758                return;
    5859            }
    59         } else if ( strpos(esc_attr(empty($_SERVER['REQUEST_URI'])), 'skyword-google-news-sitemap.xml') !== false) {
    60             if ( $options['skyword_api_sgenerate_news_sitemaps'] ) {
     60        } else if ( strpos($request_uri, 'skyword-google-news-sitemap.xml') !== false) {
     61            if ( $options['skyword_api_generate_news_sitemaps'] ) {
    6162                header( 'Content-type: text/xml' );
    6263                // Below function returns appropriately sanitized XML
     
    6869            }
    6970            die;
    70         } else if ( strpos(esc_attr(empty($_SERVER['REQUEST_URI'])), 'robots.txt') !== false) {
     71        } else if ( strpos($request_uri, 'robots.txt') !== false) {
    7172            header( 'Content-type: text/plain' );
    7273            print "User-agent: * \n";
  • skyword-publishing-api/trunk/php/options.php

    r3127599 r3268962  
    3838            <p class="submit">
    3939                <input name="Submit" type="submit" class="button-primary"
    40                        value="<?php esc_attr_e( 'Save Changes' ); ?>"/>
     40                       value="<?php esc_attr_e( 'Save Changes', 'skyword-publishing-api' ); ?>"/>
    4141            </p>
    4242        </form>
  • skyword-publishing-api/trunk/php/routes/class-skyword-authors.php

    r3097544 r3268962  
    189189                    $upload = wp_upload_bits($fields['fileName']['value'], null, base64_decode($fields['imageData']['value']));
    190190                    if ( ! empty( $upload['error'] ) ) {
    191                         $errorString = sprintf( __( 'Could not write file %1$s (%2$s)' ), 'author-'.$userId, $upload['error'] );
     191                        $errorString = sprintf( 'Could not write file %1$s (%2$s)' , 'author-'.$userId, $upload['error'] );
    192192                        return new WP_REST_Response($errorString, 500);
    193193                    }
  • skyword-publishing-api/trunk/php/routes/class-skyword-images.php

    r3097544 r3268962  
    183183
    184184        if ( ! empty( $upload['error'] ) ) {
    185             $errorString = sprintf( __( 'could not write file %1$s (%2$s)' ), $name, $upload['error'] );
     185            $errorString = sprintf('could not write file %1$s (%2$s)', $name, $upload['error'] );
    186186            return new WP_REST_Response($errorString, 500);
    187187        }
  • skyword-publishing-api/trunk/php/routes/class-skyword-posts.php

    r3127599 r3268962  
    282282            //'created' => $post->post_date,
    283283            //'updated' => $post->post_modified,
    284             'url' => $post->guid,
     284            'url' => get_permalink( $id ),
    285285            'author' => $post->post_author,
    286286            'trackingTag' => '',
     
    377377            }
    378378
     379            if($trackingTagShortcode !== '') {
     380                // Append data div after the last <p> element
     381                $trackDoc = new DomDocument();
     382                $html = wp_kses_post($fields['body']['value']);
     383                $trackDoc->loadHTML($html, LIBXML_NOERROR);
     384                $xpath = new DOMXpath($trackDoc);
     385                if($elements = $xpath->query("//p[last()]")) {
     386                    $frag = $trackDoc->createElement("div", "");
     387                    $frag->setAttribute("id", "NC-Skyword-CID");
     388                    $frag->setAttribute("data-skyword_id", $skywordContentId);
     389                    $elements->item(0)->appendChild($frag);
     390                    $newBody = $trackDoc->saveHTML();
     391                }
     392            }
     393
    379394            $options = get_option( 'skyword_api_plugin_options' );
    380395            if ($options['skyword_align_class_conversion']) {
    381396                // Adjust to WP align attributes
    382                 $html = wp_kses_post($fields['body']['value']);
    383397                // Make sure BR tags are balanced
     398                $html = isset($newBody) ? $newBody : wp_kses_post($fields['body']['value']);
    384399                $html = str_replace("<br>", "<br/>", $html);
    385400                $doc = new DomDocument();
     
    400415            } else {
    401416                // No change needed
    402                 $newBody = $fields['body']['value'];
     417                $newBody = isset($newBody) ? $newBody : wp_kses_post($fields['body']['value']);
    403418            }
    404419
     
    438453        }
    439454
    440         wp_set_post_tags( $postId, $tags );
     455        wp_set_post_tags( $postId, $this->convertTags($tags) );
    441456
    442457        $imageFields = array_filter($fields, array($this, 'filterImages'));
     
    474489    protected function createCustomFields($postId, $fields ) {
    475490        foreach ( $fields as $field ) {
    476             delete_post_meta( $postId, urldecode($field['name'] ) );
    477             add_post_meta( $postId, urldecode($field['name']), urldecode($field['value'] ) );
     491            if($field['type'] === 'TAXONOMY') {
     492                wp_set_object_terms( $postId, $this->convertTags($field['value']), $field['name']);
     493            } else {
     494                delete_post_meta( $postId, urldecode($field['name'] ) );
     495                add_post_meta( $postId, urldecode($field['name']), urldecode($field['value'] ) );
     496            }
    478497        }
    479498    }
     
    644663     */
    645664    protected function checkContentExists($skywordId, $postType ) {
    646         $query = array(
     665        $queryParms = array(
    647666            'ignore_sticky_posts' => true,
    648667            'meta_key'            => 'skywordId',
     
    664683            )
    665684        );
    666         query_posts( $query );
    667         if ( have_posts() ) :
    668             while ( have_posts() ) : the_post();
     685        $query = new WP_Query();
     686        $query->parse_query($queryParms);
     687        $posts = $query->get_posts();
     688        if ( $query->have_posts() ) :
     689            while ( $query->have_posts() ) : $query->the_post();
    669690                $str = get_the_ID();
    670691
     
    672693            endwhile;
    673694        else :
    674             $query = array(
     695            $queryParms = array(
    675696                'ignore_sticky_posts' => true,
    676697                'meta_key'            => 'skyword_content_id',
     
    692713                )
    693714            );
    694             query_posts( $query );
    695             if ( have_posts() ) :
    696                 while ( have_posts() ) : the_post();
     715            $query = new WP_Query();
     716            $query->parse_query($queryParms);
     717            $posts = $query->get_posts();
     718            if ( $query->have_posts() ) :
     719                while ( $query->have_posts() ) : $query->the_post();
    697720                    $str = get_the_ID();
    698721
  • skyword-publishing-api/trunk/readme.txt

    r3127599 r3268962  
    33Tags: skyword, api
    44Requires at least: 3.3
    5 Tested up to: 6.5.2
    6 Stable tag: 1.1.3
     5Tested up to: 6.8
     6Stable tag: 1.1.4
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2121
    2222== Changelog ==
     23
     24= 1.1.4 =
     25* Convert tags to array before setting post tags
     26* Handling of custom tag fields
     27* Adjustments to sitemaps
     28* Respond to plugin checker reports
    2329
    2430= 1.1.3 =
  • skyword-publishing-api/trunk/skyword.php

    r3127599 r3268962  
    33Plugin Name: Skyword Publishing API
    44Description: Integration with the Skyword360 content publication platform.
    5 Version: 1.1.3
     5Version: 1.1.4
    66Author: Skyword, Inc.
    77Author URI: http://www.skyword.com
     
    1717define( 'SKYWORD_REST_API_VERSION', "Skyword REST API plugin " . $plugin_version );
    1818if ( !defined('SKYWORD_VN') )
    19     define( 'SKYWORD_VN', "1.13" ); //This CANNOT have two decimal places.
    20 //.1.4 is NOT valid.
     19    define( 'SKYWORD_VN', "1.14" ); //This CANNOT have two decimal points.
     20//1.1.4 is NOT valid.
    2121
    2222register_activation_hook(__FILE__, 'get_skyword_api_defaults');
Note: See TracChangeset for help on using the changeset viewer.