Changeset 3364907
- Timestamp:
- 09/20/2025 09:07:16 AM (6 months ago)
- Location:
- outrank
- Files:
-
- 4 edited
- 10 copied
-
tags/1.0.2 (copied) (copied from outrank/trunk)
-
tags/1.0.2/css (copied) (copied from outrank/trunk/css)
-
tags/1.0.2/images (copied) (copied from outrank/trunk/images)
-
tags/1.0.2/includes (copied) (copied from outrank/trunk/includes)
-
tags/1.0.2/index.php (copied) (copied from outrank/trunk/index.php)
-
tags/1.0.2/libs (copied) (copied from outrank/trunk/libs)
-
tags/1.0.2/libs/api.php (modified) (3 diffs)
-
tags/1.0.2/outrank.php (copied) (copied from outrank/trunk/outrank.php) (1 diff)
-
tags/1.0.2/pages (copied) (copied from outrank/trunk/pages)
-
tags/1.0.2/readme.txt (copied) (copied from outrank/trunk/readme.txt) (2 diffs)
-
tags/1.0.2/script (copied) (copied from outrank/trunk/script)
-
trunk/libs/api.php (modified) (3 diffs)
-
trunk/outrank.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
outrank/tags/1.0.2/libs/api.php
r3337904 r3364907 4 4 define('OUTRANK_API_SECRET', '7d775a0fd0bc1d92e4d3db1fe313d72e'); 5 5 require_once plugin_dir_path(__FILE__) . '../includes/image-functions.php'; 6 7 function sanitize_content($content) { 8 $allowed_html = wp_kses_allowed_html('post'); 9 10 $allowed_html['iframe'] = array( 11 'src' => array(), 12 'width' => array(), 13 'height' => array(), 14 'frameborder' => array(), 15 'allowfullscreen' => array(), 16 'allow' => array(), 17 'style' => array(), 18 ); 19 20 $sanitized = wp_kses($content, $allowed_html); 21 22 $sanitized = preg_replace_callback( 23 '/<iframe[^>]*>/i', 24 function($matches) { 25 $iframe = $matches[0]; 26 27 if (preg_match('/src=["\']([^"\']*)["\']/', $iframe, $src_matches)) { 28 $src = trim($src_matches[1]); 29 30 if (preg_match('/^https:\/\/(www\.)?youtube\.com\/embed\/[a-zA-Z0-9_-]{11}(\?[^"\'<>]*)?$/i', $src) || 31 preg_match('/^https:\/\/(www\.)?youtube-nocookie\.com\/embed\/[a-zA-Z0-9_-]{11}(\?[^"\'<>]*)?$/i', $src)) { 32 return $iframe; 33 } 34 } 35 36 return ''; 37 }, 38 $sanitized 39 ); 40 41 return $sanitized; 42 } 6 43 7 44 add_action('rest_api_init', function () { … … 103 140 } 104 141 142 remove_filter('content_save_pre', 'wp_filter_post_kses'); 143 144 $sanitized_content = sanitize_content($params['content'] ?? ''); 145 105 146 // Insert post 106 147 $post_id = wp_insert_post([ 107 148 'post_title' => $title, 108 'post_content' => wp_kses_post($params['content'] ?? ''),149 'post_content' => $sanitized_content, 109 150 'post_status' => get_option('outrank_post_as_draft', 'yes') === 'yes' ? 'draft' : 'publish', 110 151 'post_type' => 'post', … … 114 155 'post_author' => $author_id, 115 156 ]); 157 158 add_filter('content_save_pre', 'wp_filter_post_kses'); 116 159 117 160 if (is_wp_error($post_id)) { -
outrank/tags/1.0.2/outrank.php
r3337904 r3364907 6 6 * Plugin URI: https://outrank.so 7 7 * Description: Get traffic and outrank competitors with automatic SEO-optimized content generation published to your WordPress site. 8 * Version: 1.0. 18 * Version: 1.0.2 9 9 * Author: Outrank 10 10 * License: GPLv2 or later -
outrank/tags/1.0.2/readme.txt
r3337904 r3364907 5 5 Tested up to: 6.8 6 6 Requires PHP: 8.0 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 74 74 == Changelog == 75 75 76 = 1.0.2 = 77 * Fixed YouTube video embedding in synced articles 78 76 79 = 1.0.1 = 77 80 * Added posts fetching endpoint for retrieving published blog posts -
outrank/trunk/libs/api.php
r3337904 r3364907 4 4 define('OUTRANK_API_SECRET', '7d775a0fd0bc1d92e4d3db1fe313d72e'); 5 5 require_once plugin_dir_path(__FILE__) . '../includes/image-functions.php'; 6 7 function sanitize_content($content) { 8 $allowed_html = wp_kses_allowed_html('post'); 9 10 $allowed_html['iframe'] = array( 11 'src' => array(), 12 'width' => array(), 13 'height' => array(), 14 'frameborder' => array(), 15 'allowfullscreen' => array(), 16 'allow' => array(), 17 'style' => array(), 18 ); 19 20 $sanitized = wp_kses($content, $allowed_html); 21 22 $sanitized = preg_replace_callback( 23 '/<iframe[^>]*>/i', 24 function($matches) { 25 $iframe = $matches[0]; 26 27 if (preg_match('/src=["\']([^"\']*)["\']/', $iframe, $src_matches)) { 28 $src = trim($src_matches[1]); 29 30 if (preg_match('/^https:\/\/(www\.)?youtube\.com\/embed\/[a-zA-Z0-9_-]{11}(\?[^"\'<>]*)?$/i', $src) || 31 preg_match('/^https:\/\/(www\.)?youtube-nocookie\.com\/embed\/[a-zA-Z0-9_-]{11}(\?[^"\'<>]*)?$/i', $src)) { 32 return $iframe; 33 } 34 } 35 36 return ''; 37 }, 38 $sanitized 39 ); 40 41 return $sanitized; 42 } 6 43 7 44 add_action('rest_api_init', function () { … … 103 140 } 104 141 142 remove_filter('content_save_pre', 'wp_filter_post_kses'); 143 144 $sanitized_content = sanitize_content($params['content'] ?? ''); 145 105 146 // Insert post 106 147 $post_id = wp_insert_post([ 107 148 'post_title' => $title, 108 'post_content' => wp_kses_post($params['content'] ?? ''),149 'post_content' => $sanitized_content, 109 150 'post_status' => get_option('outrank_post_as_draft', 'yes') === 'yes' ? 'draft' : 'publish', 110 151 'post_type' => 'post', … … 114 155 'post_author' => $author_id, 115 156 ]); 157 158 add_filter('content_save_pre', 'wp_filter_post_kses'); 116 159 117 160 if (is_wp_error($post_id)) { -
outrank/trunk/outrank.php
r3337904 r3364907 6 6 * Plugin URI: https://outrank.so 7 7 * Description: Get traffic and outrank competitors with automatic SEO-optimized content generation published to your WordPress site. 8 * Version: 1.0. 18 * Version: 1.0.2 9 9 * Author: Outrank 10 10 * License: GPLv2 or later -
outrank/trunk/readme.txt
r3337904 r3364907 5 5 Tested up to: 6.8 6 6 Requires PHP: 8.0 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 74 74 == Changelog == 75 75 76 = 1.0.2 = 77 * Fixed YouTube video embedding in synced articles 78 76 79 = 1.0.1 = 77 80 * Added posts fetching endpoint for retrieving published blog posts
Note: See TracChangeset
for help on using the changeset viewer.