Changeset 3268962
- Timestamp:
- 04/08/2025 02:17:39 PM (12 months ago)
- Location:
- skyword-publishing-api
- Files:
-
- 9 edited
-
tags/1.1.4/readme.txt (modified) (1 diff)
-
trunk/php/class-skyword-shortcode.php (modified) (4 diffs)
-
trunk/php/class-skyword-sitemaps.php (modified) (6 diffs)
-
trunk/php/options.php (modified) (1 diff)
-
trunk/php/routes/class-skyword-authors.php (modified) (1 diff)
-
trunk/php/routes/class-skyword-images.php (modified) (1 diff)
-
trunk/php/routes/class-skyword-posts.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/skyword.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
skyword-publishing-api/tags/1.1.4/readme.txt
r3234975 r3268962 3 3 Tags: skyword, api 4 4 Requires at least: 3.3 5 Tested up to: 6. 7.15 Tested up to: 6.8 6 6 Stable tag: 1.1.4 7 7 License: GPLv2 or later -
skyword-publishing-api/trunk/php/class-skyword-shortcode.php
r3078729 r3268962 34 34 else 35 35 $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');; 37 37 } 38 38 … … 48 48 else 49 49 $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');; 51 51 } 52 52 … … 92 92 } 93 93 if (in_array($k, $validattrs, true) && isset($v)) { 94 $iframeattrs .= " " . $k . "=\"" . $v. "\"";94 $iframeattrs .= " " . esc_attr($k) . "=\"" . esc_attr($v) . "\""; 95 95 } 96 96 } … … 99 99 } 100 100 101 function 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 106 add_action( 'wp_enqueue_scripts', 'register_api_tracking_scripts' ); 107 101 108 global $custom_shortcodes; 102 109 $custom_shortcodes = new Skyword_API_Shortcode; -
skyword-publishing-api/trunk/php/class-skyword-sitemaps.php
r3078729 r3268962 14 14 public function skyword_sitemaps_generator() { 15 15 $options = get_option( 'skyword_api_plugin_options' ); 16 $request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI'); 16 17 //echo "<pre>";print_r($options); 17 18 //check all requests for if they are for autogenerated robots.txt or sitemaps 18 19 19 if ( strpos( esc_attr(empty($_SERVER['REQUEST_URI'])), 'skyword-sitemap.xml') !== false) {20 if ( strpos($request_uri, 'skyword-sitemap.xml') !== false) { 20 21 if ( $options['skyword_api_generate_all_sitemaps'] ) { 21 22 header( 'Content-type: text/xml' ); … … 27 28 return; 28 29 } 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) { 30 31 if ( $options['skyword_api_generate_pages_sitemaps'] ) { 31 32 header( 'Content-type: text/xml' ); … … 37 38 return; 38 39 } 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) { 40 41 if ( $options['skyword_api_generate_categories_sitemaps'] ) { 41 42 header( 'Content-type: text/xml' ); … … 47 48 return; 48 49 } 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) { 50 51 if ( $options['skyword_api_generate_tags_sitemaps'] ) { 51 52 header( 'Content-type: text/xml' ); … … 57 58 return; 58 59 } 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'] ) { 61 62 header( 'Content-type: text/xml' ); 62 63 // Below function returns appropriately sanitized XML … … 68 69 } 69 70 die; 70 } else if ( strpos( esc_attr(empty($_SERVER['REQUEST_URI'])), 'robots.txt') !== false) {71 } else if ( strpos($request_uri, 'robots.txt') !== false) { 71 72 header( 'Content-type: text/plain' ); 72 73 print "User-agent: * \n"; -
skyword-publishing-api/trunk/php/options.php
r3127599 r3268962 38 38 <p class="submit"> 39 39 <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' ); ?>"/> 41 41 </p> 42 42 </form> -
skyword-publishing-api/trunk/php/routes/class-skyword-authors.php
r3097544 r3268962 189 189 $upload = wp_upload_bits($fields['fileName']['value'], null, base64_decode($fields['imageData']['value'])); 190 190 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'] ); 192 192 return new WP_REST_Response($errorString, 500); 193 193 } -
skyword-publishing-api/trunk/php/routes/class-skyword-images.php
r3097544 r3268962 183 183 184 184 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'] ); 186 186 return new WP_REST_Response($errorString, 500); 187 187 } -
skyword-publishing-api/trunk/php/routes/class-skyword-posts.php
r3127599 r3268962 282 282 //'created' => $post->post_date, 283 283 //'updated' => $post->post_modified, 284 'url' => $post->guid,284 'url' => get_permalink( $id ), 285 285 'author' => $post->post_author, 286 286 'trackingTag' => '', … … 377 377 } 378 378 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 379 394 $options = get_option( 'skyword_api_plugin_options' ); 380 395 if ($options['skyword_align_class_conversion']) { 381 396 // Adjust to WP align attributes 382 $html = wp_kses_post($fields['body']['value']);383 397 // Make sure BR tags are balanced 398 $html = isset($newBody) ? $newBody : wp_kses_post($fields['body']['value']); 384 399 $html = str_replace("<br>", "<br/>", $html); 385 400 $doc = new DomDocument(); … … 400 415 } else { 401 416 // No change needed 402 $newBody = $fields['body']['value'];417 $newBody = isset($newBody) ? $newBody : wp_kses_post($fields['body']['value']); 403 418 } 404 419 … … 438 453 } 439 454 440 wp_set_post_tags( $postId, $t ags);455 wp_set_post_tags( $postId, $this->convertTags($tags) ); 441 456 442 457 $imageFields = array_filter($fields, array($this, 'filterImages')); … … 474 489 protected function createCustomFields($postId, $fields ) { 475 490 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 } 478 497 } 479 498 } … … 644 663 */ 645 664 protected function checkContentExists($skywordId, $postType ) { 646 $query = array(665 $queryParms = array( 647 666 'ignore_sticky_posts' => true, 648 667 'meta_key' => 'skywordId', … … 664 683 ) 665 684 ); 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(); 669 690 $str = get_the_ID(); 670 691 … … 672 693 endwhile; 673 694 else : 674 $query = array(695 $queryParms = array( 675 696 'ignore_sticky_posts' => true, 676 697 'meta_key' => 'skyword_content_id', … … 692 713 ) 693 714 ); 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(); 697 720 $str = get_the_ID(); 698 721 -
skyword-publishing-api/trunk/readme.txt
r3127599 r3268962 3 3 Tags: skyword, api 4 4 Requires at least: 3.3 5 Tested up to: 6. 5.26 Stable tag: 1.1. 35 Tested up to: 6.8 6 Stable tag: 1.1.4 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 21 21 22 22 == 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 23 29 24 30 = 1.1.3 = -
skyword-publishing-api/trunk/skyword.php
r3127599 r3268962 3 3 Plugin Name: Skyword Publishing API 4 4 Description: Integration with the Skyword360 content publication platform. 5 Version: 1.1. 35 Version: 1.1.4 6 6 Author: Skyword, Inc. 7 7 Author URI: http://www.skyword.com … … 17 17 define( 'SKYWORD_REST_API_VERSION', "Skyword REST API plugin " . $plugin_version ); 18 18 if ( !defined('SKYWORD_VN') ) 19 define( 'SKYWORD_VN', "1.1 3" ); //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. 21 21 22 22 register_activation_hook(__FILE__, 'get_skyword_api_defaults');
Note: See TracChangeset
for help on using the changeset viewer.