Changeset 1650593
- Timestamp:
- 05/03/2017 09:25:48 PM (9 years ago)
- Location:
- publish-to-apple-news/trunk
- Files:
-
- 6 edited
-
admin/apple-actions/index/class-push.php (modified) (2 diffs)
-
admin/class-admin-apple-themes.php (modified) (2 diffs)
-
apple-news.php (modified) (1 diff)
-
includes/apple-exporter/components/class-component.php (modified) (2 diffs)
-
includes/class-apple-news.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
publish-to-apple-news/trunk/admin/apple-actions/index/class-push.php
r1596636 r1650593 155 155 $this->process_errors( $errors ); 156 156 157 // Validate the data before using since it's filterable. 158 // JSON should just be a string. 159 // Apple News format is complex and has too many options to validate otherwise. 160 // Let's just make sure it's not doing anything bad and is the right data type. 161 $json = sanitize_text_field( $json ); 157 // Sanitize the data before using since it's filterable. 158 $json = $this->sanitize_json( $json ); 162 159 163 160 // Bundles should be an array of URLs … … 387 384 return array( $this->exporter->get_json(), $this->exporter->get_bundles(), $this->exporter->get_errors() ); 388 385 } 386 387 /** 388 * Sanitize the JSON output based on whether HTML or markdown is used. 389 * 390 * @access private 391 * @param string $json 392 * @return string 393 * @since 1.2.7 394 */ 395 private function sanitize_json( $json ) { 396 // Apple News format is complex and has too many options to validate otherwise. 397 // Let's just make sure the JSON is valid 398 $decoded = json_decode( $json ); 399 if ( ! $decoded ) { 400 throw new \Apple_Actions\Action_Exception( __( 'The Apple News JSON is invalid and cannot be published.', 'apple-news' ) ); 401 } else { 402 return wp_json_encode( $decoded ); 403 } 404 } 389 405 } -
publish-to-apple-news/trunk/admin/class-admin-apple-themes.php
r1642765 r1650593 694 694 private function validate_data( $data ) { 695 695 $settings = new \Apple_Exporter\Settings(); 696 $ valid_settings = array_keys( $settings->all());696 $default_settings = $settings->all(); 697 697 $clean_settings = array(); 698 698 … … 719 719 foreach ( $valid_settings as $setting ) { 720 720 if ( ! isset( $data[ $setting ] ) ) { 721 return sprintf( 722 __( 'The theme was missing the required setting %s', 'apple-news' ), 723 $setting 724 ); 721 // Get the default value instead. 722 // This ensures backwards compatiblity with theme files 723 // when new settings are added in future plugin versions. 724 if ( isset( $default_settings[ $setting ] ) ) { 725 $data[ $setting ] = $default_settings[ $setting ]; 726 } else { 727 return sprintf( 728 __( 'The theme was missing the required setting %s and no default was found', 'apple-news' ), 729 $setting 730 ); 731 } 725 732 } 726 733 -
publish-to-apple-news/trunk/apple-news.php
r1642765 r1650593 13 13 * Plugin URI: http://github.com/alleyinteractive/apple-news 14 14 * Description: Export and sync posts to Apple format. 15 * Version: 1.2. 615 * Version: 1.2.7 16 16 * Author: Alley Interactive 17 17 * Author URI: https://www.alleyinteractive.com -
publish-to-apple-news/trunk/includes/apple-exporter/components/class-component.php
r1642765 r1650593 145 145 146 146 /** 147 * Allowed HTML tags for components that support it. 148 * 149 * @since 1.2.7 150 * @var array 151 * @access public 152 */ 153 public $allowed_html = array( 154 'p' => array(), 155 'strong' => array(), 156 'b' => array(), 157 'em' => array(), 158 'i' => array(), 159 'a' => array( 160 'href' => array(), 161 ), 162 'ul' => array(), 163 'ol' => array(), 164 'li' => array(), 165 'br' => array(), 166 'sub' => array(), 167 'sup' => array(), 168 'del' => array(), 169 's' => array(), 170 'pre' => array(), 171 'code' => array(), 172 'samp' => array(), 173 'footer' => array(), 174 'aside' => array(), 175 'blockquote' => array(), 176 ); 177 178 /** 147 179 * Constructor. 148 180 * … … 234 266 */ 235 267 public function to_array() { 268 // If HTML support is enabled, provide an extra level of validation for supported tags. 269 if ( ! empty( $this->json['text'] ) && $this->html_enabled() ) { 270 $this->json['text'] = wp_kses( $this->json['text'], $this->allowed_html ); 271 } 272 236 273 return apply_filters( 'apple_news_' . $this->get_component_name() . '_json', $this->json ); 237 274 } -
publish-to-apple-news/trunk/includes/class-apple-news.php
r1642765 r1650593 40 40 * @access public 41 41 */ 42 public static $version = '1.2. 6';42 public static $version = '1.2.7'; 43 43 44 44 /** -
publish-to-apple-news/trunk/readme.txt
r1642765 r1650593 4 4 Tags: publish, apple, news, iOS 5 5 Requires at least: 4.0 6 Tested up to: 4.7. 37 Stable tag: 1.2. 66 Tested up to: 4.7.4 7 Stable tag: 1.2.7 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl.html … … 45 45 46 46 == Changelog == 47 48 = 1.2.7 = 49 * Fixed a bug where HTML tags were being stripped before being sent to the API. 50 * Fixed a bug where older theme files couldn't be imported if new formatting settings were added. 47 51 48 52 = 1.2.6 =
Note: See TracChangeset
for help on using the changeset viewer.