Changeset 1898992
- Timestamp:
- 06/26/2018 07:18:32 AM (8 years ago)
- Location:
- sarbacane-desktop
- Files:
-
- 1 deleted
- 14 edited
- 1 copied
-
tags/1.4.11 (copied) (copied from sarbacane-desktop/trunk)
-
tags/1.4.11/class.sarbacane-content.php (modified) (1 diff)
-
tags/1.4.11/class.sarbacane-medias.php (modified) (1 diff)
-
tags/1.4.11/class.sarbacane-newsletterwidget.php (modified) (2 diffs)
-
tags/1.4.11/class.sarbacane-settings.php (modified) (1 diff)
-
tags/1.4.11/class.sarbacane.php (modified) (18 diffs)
-
tags/1.4.11/readme.txt (modified) (3 diffs)
-
tags/1.4.11/sarbacane.php (modified) (1 diff)
-
tags/1.4.9 (deleted)
-
trunk/class.sarbacane-content.php (modified) (1 diff)
-
trunk/class.sarbacane-medias.php (modified) (1 diff)
-
trunk/class.sarbacane-newsletterwidget.php (modified) (2 diffs)
-
trunk/class.sarbacane-settings.php (modified) (1 diff)
-
trunk/class.sarbacane.php (modified) (18 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/sarbacane.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sarbacane-desktop/tags/1.4.11/class.sarbacane-content.php
r1681123 r1898992 62 62 $query = new WP_Query ( 'post_type=post&p=' . $post_id ); 63 63 if ( $query->have_posts() ) { 64 echo$this->get_rss_header() . $this->get_rss_content( 'post', $post_id ) . $this->get_rss_footer();64 return $this->get_rss_header() . $this->get_rss_content( 'post', $post_id ) . $this->get_rss_footer(); 65 65 } else { 66 header( 'HTTP/1.1 404 Bad item' ); 67 header( 'Content-Type: application/json; charset=utf-8' ); 68 die( 'FAILED_ID' ); 66 return false; 69 67 } 70 68 } 71 69 72 70 public function get_articles_rss( $limit ) { 73 echo$this->get_rss_header() . $this->get_rss_content( 'posts', $limit ) . $this->get_rss_footer();71 return $this->get_rss_header() . $this->get_rss_content( 'posts', $limit ) . $this->get_rss_footer(); 74 72 } 75 73 -
sarbacane-desktop/tags/1.4.11/class.sarbacane-medias.php
r1681123 r1898992 20 20 } 21 21 $medias = implode( ',', $medias ); 22 echo'{"medias":[' . $medias . "\n\t" . ']' . "\n" . '}';22 return '{"medias":[' . $medias . "\n\t" . ']' . "\n" . '}'; 23 23 } 24 24 -
sarbacane-desktop/tags/1.4.11/class.sarbacane-newsletterwidget.php
r1817959 r1898992 64 64 } 65 65 } 66 $this->display_registration_message($valid);66 return $this->display_registration_message($valid); 67 67 } 68 68 … … 73 73 $message = json_encode( array( 'message' => __( 'Email isn\'t valid.', 'sarbacane-desktop' ) ) ); 74 74 } 75 echo'75 return ' 76 76 <script type="text/javascript"> 77 77 var registration_message = ' . $message . '; -
sarbacane-desktop/tags/1.4.11/class.sarbacane-settings.php
r1681123 r1898992 12 12 $rss_url = get_feed_link( 'rss2' ); 13 13 $posts_per_rss = get_option( 'posts_per_rss', 10 ); 14 //forcing boolean to display as int to get 0 when false. Impossible otherwise 15 echo '{ 14 return '{ 16 15 "settings":{ 17 16 "general_settings":{ -
sarbacane-desktop/tags/1.4.11/class.sarbacane.php
r1817959 r1898992 3 3 class Sarbacane { 4 4 5 /**6 * Method called on plugin activation.7 */8 5 public static function activation() { 9 6 update_option( 'sarbacane_version', '1.4.9', false ); … … 37 34 } 38 35 39 /**40 * Method called on plugin deactivation.41 */42 36 public static function deactivation() { 43 37 delete_option( 'sarbacane_version' ); … … 145 139 } 146 140 147 /**148 * Called on menu generation (admin_menu hook).149 */150 141 public function add_admin_menu() { 151 142 add_submenu_page( 'sarbacane', __( 'Connection', 'sarbacane-desktop' ), __( 'Connection', 'sarbacane-desktop' ), 'administrator', 'wp_interconnection', array( … … 155 146 } 156 147 157 /**158 * Loads this plugin locale159 */160 148 public function sarbacane_load_locales() { 161 149 load_plugin_textdomain( 'sarbacane-desktop', false, dirname( plugin_basename( __FILE__ ) ) . '/locales' ); 162 150 } 163 151 164 /**165 * Display message when key generated166 */167 152 private function sarbacane_params_saved() { 168 echo '<div class="updated">' . __( 'A new key has been generated', 'sarbacane-desktop' ) . '</div>'; 169 } 170 171 /** 172 * Get new subscribers 173 * 174 * @param string $sd_id 175 * @param string $sd_list_id 176 * If empty, get lists vide else get email for the list 177 * 178 * @throws WP_Error 179 */ 153 return '<div class="updated">' . __( 'A new key has been generated', 'sarbacane-desktop' ) . '</div>'; 154 } 155 180 156 private function sarbacane_get_list( $sd_id, $sd_list_id ) { 181 157 … … 191 167 if ( $sd_list_id != '' ) { 192 168 if ( $sd_list_id == 'U' ) { 193 $this->get_users_list( $sd_id );169 return $this->get_users_list( $sd_id ); 194 170 } else if ( $sd_list_id == 'N' ) { 195 $this->get_newsletter_list( $sd_id );171 return $this->get_newsletter_list( $sd_id ); 196 172 } 197 173 } else { 198 $this->generate_available_lists( $sd_id, $sd_list_users, $sd_list_news );174 return $this->generate_available_lists( $sd_id, $sd_list_users, $sd_list_news ); 199 175 } 200 176 } 201 177 202 178 private function generate_available_lists( $sd_id, $user_sync, $newsletter_sync ) { 203 echo'list_id;name;reset;is_updated;type;version' . "\n";179 $content = 'list_id;name;reset;is_updated;type;version' . "\n"; 204 180 $last_call_date_N = get_option( 'sarbacane_news_call_' . $sd_id ); 205 181 $last_call_date_C = get_option( 'sarbacane_user_call_' . $sd_id ); … … 229 205 $name = $this->d_quote( str_replace( ''', '\'', $name ) ); 230 206 if ( $user_sync ) { 231 echo'U;' . $name . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n";207 $content .= 'U;' . $name . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 232 208 } 233 209 if ( $newsletter_sync ) { 234 echo 'N;' . $name . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 235 } 236 } 237 238 /** 239 * Check new users since last call 240 * 241 * @param string $last_call_date 242 * 243 * @return boolean 244 */ 210 $content .= 'N;' . $name . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 211 } 212 return $content; 213 } 214 245 215 private function check_users_list( $last_call_date ) { 246 216 global $wpdb; … … 252 222 } 253 223 254 /**255 * Check new newsletter subcribers since last call256 *257 * @param string $last_call_date258 *259 * @return boolean260 */261 224 private function check_newsletter_list( $last_call_date = '' ) { 262 225 global $wpdb; … … 274 237 } 275 238 276 /**277 * Generate newsletter subscribers CSV278 *279 * @param string $sd_id280 */281 239 private function get_newsletter_list( $sd_id ) { 282 240 if ( ! get_option( 'sarbacane_news_list' ) ) { 283 echo $this->generate_csv( array(), array(), 'N' ); 284 return; 241 return $this->generate_csv( array(), array(), 'N' ); 285 242 } 286 243 $last_call_date = get_option( 'sarbacane_news_call_' . $sd_id, '' ); … … 288 245 $new_or_updated_users = $this->get_subscribers( $last_call_date ); 289 246 $this->clear_update_history(); 290 echo $this->generate_csv( $new_or_updated_users, array(), 'N' ); 291 } 292 293 /** 294 * Generate users CSV 295 * 296 * @param string $sd_id 297 */ 247 return $this->generate_csv( $new_or_updated_users, array(), 'N' ); 248 } 249 298 250 private function get_users_list( $sd_id ) { 299 251 if ( ! get_option( 'sarbacane_users_list' ) ) { 300 echo $this->generate_csv( array(), array(), 'U' ); 301 return; 252 return $this->generate_csv( array(), array(), 'U' ); 302 253 } 303 254 $last_call_date = get_option( 'sarbacane_user_call_' . $sd_id, '' ); … … 307 258 $deleted_users = $this->sarbacanedesktop_get_all_deleted_users( $last_call_date ); 308 259 $this->clear_update_history(); 309 echo $this->generate_csv( $all_users, $deleted_users, 'U' ); 310 } 311 312 /** 313 * Generate CSV 314 * 315 * @param array $new_or_updated_users 316 * @param array $deleted_users 317 * @param string $list_type 318 * 319 * @return CSV 320 */ 260 return $this->generate_csv( $all_users, $deleted_users, 'U' ); 261 } 262 321 263 private function generate_csv( $new_or_updated_users, $deleted_users = array(), $list_type ) { 322 264 if ( "N" == $list_type ) { … … 383 325 } 384 326 385 /**386 * Get users387 *388 * @return array389 */390 327 private function sarbacanedesktop_get_all_users( $last_call_date ) { 391 328 global $wpdb; … … 415 352 } 416 353 417 /**418 * Get newsletter subscribers419 *420 * @return array421 */422 354 private function get_subscribers( $last_call_date ) { 423 355 global $wpdb; … … 463 395 } 464 396 465 /**466 * Called on user update.467 */468 397 public function trigger_user_update( $user_id ) { 469 398 if ( get_option( 'sarbacane_users_list' ) ) { … … 483 412 } 484 413 485 /**486 * Called on user delete.487 */488 414 public function trigger_user_delete( $user_id ) { 489 415 if ( get_option( 'sarbacane_users_list' ) ) { … … 549 475 global $wpdb; 550 476 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 551 $this->sarbacane_params_saved();477 echo $this->sarbacane_params_saved(); 552 478 } 553 479 $sd_token = get_option( 'sarbacane_sd_token', false ); … … 629 555 $this->update_data_1_4_5(); 630 556 $widget = new SarbacaneNewsWidget(); 631 $widget->sarbacane_save_widget();557 echo $widget->sarbacane_save_widget(); 632 558 exit; 633 559 } 634 560 if ( ! isset ( $sd_id ) ) { 635 header( 'HTTP/1.1 40 0 Bad request' );636 header( 'Content-type: application/json; charset=utf-8' );637 die( 'FAILED_SDID' );561 header( 'HTTP/1.1 404 Not Found' ); 562 header( 'Content-type: text/plain; charset=utf-8' ); 563 exit( 'FAILED_ID' ); 638 564 } 639 565 if ( ! isset ( $sd_token ) ) { 640 header( 'HTTP/1.1 40 0 Bad request' );641 header( 'Content-type: application/json; charset=utf-8' );642 die( 'FAILED_SDTOKEN' );566 header( 'HTTP/1.1 403 Forbidden' ); 567 header( 'Content-type: text/plain; charset=utf-8' ); 568 exit( 'FAILED' ); 643 569 } 644 570 $failed = (int) get_option( 'sarbacane_failed', 0 ); … … 649 575 update_option( 'sarbacane_failed', $failed + 1, false ); 650 576 } 651 header( 'HTTP/1.1 403 Unauthorized' ); 652 header( 'Content-type: application/json; charset=utf-8' ); 653 die( 'FAILED_SDTOKEN' ); 654 } else { 655 // Content retrieving 577 header( 'HTTP/1.1 403 Forbidden' ); 578 header( 'Content-type: text/plain; charset=utf-8' ); 579 exit( 'FAILED' ); 580 } else if ( $sd_token == $sd_token_saved && strlen( $sd_token_saved ) > 20 && ! $is_failed ) { 656 581 if ( isset ( $type ) ) { 657 582 if ( $type == 'posts' ) { 658 header( 'Content-Type: application/rss+xml; charset=utf-8' );659 583 $content = new SarbacaneContent(); 660 584 if ( isset ( $id ) ) { 661 $content->get_article_rss( $id ); 585 $text = $content->get_article_rss( $id ); 586 if ($text === false) { 587 header( 'HTTP/1.1 404 Not Found' ); 588 header( 'Content-Type: text/plain; charset=utf-8' ); 589 exit( 'FAILED_ID' ); 590 } else { 591 header( 'Content-Type: application/rss+xml; charset=utf-8' ); 592 echo $text; 593 } 662 594 } else { 663 $content->get_articles_rss( $limit ); 595 header( 'Content-Type: application/rss+xml; charset=utf-8' ); 596 echo $content->get_articles_rss( $limit ); 664 597 } 665 598 } else if ( $type == 'settings' ) { 666 599 header( 'Content-Type: application/json; charset=utf-8' ); 667 header( 'Content-Transfer-Encoding: binary' );668 600 $settings = new SarbacaneSettings(); 669 $settings->get_settings();601 echo $settings->get_settings(); 670 602 } else if ( $type == 'medias' ) { 671 603 header( 'Content-Type: application/json; charset=utf-8' ); 672 604 $medias = new SarbacaneMedias(); 673 $medias->get_medias();605 echo $medias->get_medias(); 674 606 } 675 607 } else { 676 608 $this->update_data_1_4_5(); 677 // List retrieving678 609 header( 'Content-Type: text/plain; charset=utf-8' ); 679 header( 'Content-Transfer-Encoding: binary' );680 610 if ( $action == 'delete' ) { 681 611 $this->sarbacane_delete_sdid( $sd_id ); … … 683 613 if ( $sd_list_id != '' && $sd_list_id != 'N' && $sd_list_id != 'U' ) { 684 614 header( 'HTTP/1.1 404 Not found' ); 685 header( 'Content-type: application/json; charset=utf-8' ); 686 die( 'FAILED_ID' ); 615 exit( 'FAILED_ID' ); 687 616 } 688 $this->sarbacane_get_list( $sd_id, $sd_list_id );617 echo $this->sarbacane_get_list( $sd_id, $sd_list_id ); 689 618 } 690 619 } -
sarbacane-desktop/tags/1.4.11/readme.txt
r1886659 r1898992 5 5 Tested up to: 4.9 6 6 License: GPLv2 or later 7 Stable tag: 1.4.1 07 Stable tag: 1.4.11 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 … … 79 79 == Changelog == 80 80 81 = 1.4.10 =81 = 1.4.10 & 1.4.11 = 82 82 Modification du widget. 83 83 … … 132 132 = English = 133 133 134 = 1.4.10 =134 = 1.4.10 & 1.4.11 = 135 135 Widget modifications. 136 136 -
sarbacane-desktop/tags/1.4.11/sarbacane.php
r1886659 r1898992 5 5 Description: This plugin allows you to synchronize your WordPress data in Sarbacane 6 6 Author: Sarbacane Software 7 Version: 1.4.1 07 Version: 1.4.11 8 8 Author URI: http://sarbacane.com/?utm_source=module-wordpress&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=wordpress 9 9 Text Domain: sarbacane-desktop -
sarbacane-desktop/trunk/class.sarbacane-content.php
r1681123 r1898992 62 62 $query = new WP_Query ( 'post_type=post&p=' . $post_id ); 63 63 if ( $query->have_posts() ) { 64 echo$this->get_rss_header() . $this->get_rss_content( 'post', $post_id ) . $this->get_rss_footer();64 return $this->get_rss_header() . $this->get_rss_content( 'post', $post_id ) . $this->get_rss_footer(); 65 65 } else { 66 header( 'HTTP/1.1 404 Bad item' ); 67 header( 'Content-Type: application/json; charset=utf-8' ); 68 die( 'FAILED_ID' ); 66 return false; 69 67 } 70 68 } 71 69 72 70 public function get_articles_rss( $limit ) { 73 echo$this->get_rss_header() . $this->get_rss_content( 'posts', $limit ) . $this->get_rss_footer();71 return $this->get_rss_header() . $this->get_rss_content( 'posts', $limit ) . $this->get_rss_footer(); 74 72 } 75 73 -
sarbacane-desktop/trunk/class.sarbacane-medias.php
r1681123 r1898992 20 20 } 21 21 $medias = implode( ',', $medias ); 22 echo'{"medias":[' . $medias . "\n\t" . ']' . "\n" . '}';22 return '{"medias":[' . $medias . "\n\t" . ']' . "\n" . '}'; 23 23 } 24 24 -
sarbacane-desktop/trunk/class.sarbacane-newsletterwidget.php
r1817959 r1898992 64 64 } 65 65 } 66 $this->display_registration_message($valid);66 return $this->display_registration_message($valid); 67 67 } 68 68 … … 73 73 $message = json_encode( array( 'message' => __( 'Email isn\'t valid.', 'sarbacane-desktop' ) ) ); 74 74 } 75 echo'75 return ' 76 76 <script type="text/javascript"> 77 77 var registration_message = ' . $message . '; -
sarbacane-desktop/trunk/class.sarbacane-settings.php
r1681123 r1898992 12 12 $rss_url = get_feed_link( 'rss2' ); 13 13 $posts_per_rss = get_option( 'posts_per_rss', 10 ); 14 //forcing boolean to display as int to get 0 when false. Impossible otherwise 15 echo '{ 14 return '{ 16 15 "settings":{ 17 16 "general_settings":{ -
sarbacane-desktop/trunk/class.sarbacane.php
r1817959 r1898992 3 3 class Sarbacane { 4 4 5 /**6 * Method called on plugin activation.7 */8 5 public static function activation() { 9 6 update_option( 'sarbacane_version', '1.4.9', false ); … … 37 34 } 38 35 39 /**40 * Method called on plugin deactivation.41 */42 36 public static function deactivation() { 43 37 delete_option( 'sarbacane_version' ); … … 145 139 } 146 140 147 /**148 * Called on menu generation (admin_menu hook).149 */150 141 public function add_admin_menu() { 151 142 add_submenu_page( 'sarbacane', __( 'Connection', 'sarbacane-desktop' ), __( 'Connection', 'sarbacane-desktop' ), 'administrator', 'wp_interconnection', array( … … 155 146 } 156 147 157 /**158 * Loads this plugin locale159 */160 148 public function sarbacane_load_locales() { 161 149 load_plugin_textdomain( 'sarbacane-desktop', false, dirname( plugin_basename( __FILE__ ) ) . '/locales' ); 162 150 } 163 151 164 /**165 * Display message when key generated166 */167 152 private function sarbacane_params_saved() { 168 echo '<div class="updated">' . __( 'A new key has been generated', 'sarbacane-desktop' ) . '</div>'; 169 } 170 171 /** 172 * Get new subscribers 173 * 174 * @param string $sd_id 175 * @param string $sd_list_id 176 * If empty, get lists vide else get email for the list 177 * 178 * @throws WP_Error 179 */ 153 return '<div class="updated">' . __( 'A new key has been generated', 'sarbacane-desktop' ) . '</div>'; 154 } 155 180 156 private function sarbacane_get_list( $sd_id, $sd_list_id ) { 181 157 … … 191 167 if ( $sd_list_id != '' ) { 192 168 if ( $sd_list_id == 'U' ) { 193 $this->get_users_list( $sd_id );169 return $this->get_users_list( $sd_id ); 194 170 } else if ( $sd_list_id == 'N' ) { 195 $this->get_newsletter_list( $sd_id );171 return $this->get_newsletter_list( $sd_id ); 196 172 } 197 173 } else { 198 $this->generate_available_lists( $sd_id, $sd_list_users, $sd_list_news );174 return $this->generate_available_lists( $sd_id, $sd_list_users, $sd_list_news ); 199 175 } 200 176 } 201 177 202 178 private function generate_available_lists( $sd_id, $user_sync, $newsletter_sync ) { 203 echo'list_id;name;reset;is_updated;type;version' . "\n";179 $content = 'list_id;name;reset;is_updated;type;version' . "\n"; 204 180 $last_call_date_N = get_option( 'sarbacane_news_call_' . $sd_id ); 205 181 $last_call_date_C = get_option( 'sarbacane_user_call_' . $sd_id ); … … 229 205 $name = $this->d_quote( str_replace( ''', '\'', $name ) ); 230 206 if ( $user_sync ) { 231 echo'U;' . $name . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n";207 $content .= 'U;' . $name . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 232 208 } 233 209 if ( $newsletter_sync ) { 234 echo 'N;' . $name . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 235 } 236 } 237 238 /** 239 * Check new users since last call 240 * 241 * @param string $last_call_date 242 * 243 * @return boolean 244 */ 210 $content .= 'N;' . $name . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 211 } 212 return $content; 213 } 214 245 215 private function check_users_list( $last_call_date ) { 246 216 global $wpdb; … … 252 222 } 253 223 254 /**255 * Check new newsletter subcribers since last call256 *257 * @param string $last_call_date258 *259 * @return boolean260 */261 224 private function check_newsletter_list( $last_call_date = '' ) { 262 225 global $wpdb; … … 274 237 } 275 238 276 /**277 * Generate newsletter subscribers CSV278 *279 * @param string $sd_id280 */281 239 private function get_newsletter_list( $sd_id ) { 282 240 if ( ! get_option( 'sarbacane_news_list' ) ) { 283 echo $this->generate_csv( array(), array(), 'N' ); 284 return; 241 return $this->generate_csv( array(), array(), 'N' ); 285 242 } 286 243 $last_call_date = get_option( 'sarbacane_news_call_' . $sd_id, '' ); … … 288 245 $new_or_updated_users = $this->get_subscribers( $last_call_date ); 289 246 $this->clear_update_history(); 290 echo $this->generate_csv( $new_or_updated_users, array(), 'N' ); 291 } 292 293 /** 294 * Generate users CSV 295 * 296 * @param string $sd_id 297 */ 247 return $this->generate_csv( $new_or_updated_users, array(), 'N' ); 248 } 249 298 250 private function get_users_list( $sd_id ) { 299 251 if ( ! get_option( 'sarbacane_users_list' ) ) { 300 echo $this->generate_csv( array(), array(), 'U' ); 301 return; 252 return $this->generate_csv( array(), array(), 'U' ); 302 253 } 303 254 $last_call_date = get_option( 'sarbacane_user_call_' . $sd_id, '' ); … … 307 258 $deleted_users = $this->sarbacanedesktop_get_all_deleted_users( $last_call_date ); 308 259 $this->clear_update_history(); 309 echo $this->generate_csv( $all_users, $deleted_users, 'U' ); 310 } 311 312 /** 313 * Generate CSV 314 * 315 * @param array $new_or_updated_users 316 * @param array $deleted_users 317 * @param string $list_type 318 * 319 * @return CSV 320 */ 260 return $this->generate_csv( $all_users, $deleted_users, 'U' ); 261 } 262 321 263 private function generate_csv( $new_or_updated_users, $deleted_users = array(), $list_type ) { 322 264 if ( "N" == $list_type ) { … … 383 325 } 384 326 385 /**386 * Get users387 *388 * @return array389 */390 327 private function sarbacanedesktop_get_all_users( $last_call_date ) { 391 328 global $wpdb; … … 415 352 } 416 353 417 /**418 * Get newsletter subscribers419 *420 * @return array421 */422 354 private function get_subscribers( $last_call_date ) { 423 355 global $wpdb; … … 463 395 } 464 396 465 /**466 * Called on user update.467 */468 397 public function trigger_user_update( $user_id ) { 469 398 if ( get_option( 'sarbacane_users_list' ) ) { … … 483 412 } 484 413 485 /**486 * Called on user delete.487 */488 414 public function trigger_user_delete( $user_id ) { 489 415 if ( get_option( 'sarbacane_users_list' ) ) { … … 549 475 global $wpdb; 550 476 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 551 $this->sarbacane_params_saved();477 echo $this->sarbacane_params_saved(); 552 478 } 553 479 $sd_token = get_option( 'sarbacane_sd_token', false ); … … 629 555 $this->update_data_1_4_5(); 630 556 $widget = new SarbacaneNewsWidget(); 631 $widget->sarbacane_save_widget();557 echo $widget->sarbacane_save_widget(); 632 558 exit; 633 559 } 634 560 if ( ! isset ( $sd_id ) ) { 635 header( 'HTTP/1.1 40 0 Bad request' );636 header( 'Content-type: application/json; charset=utf-8' );637 die( 'FAILED_SDID' );561 header( 'HTTP/1.1 404 Not Found' ); 562 header( 'Content-type: text/plain; charset=utf-8' ); 563 exit( 'FAILED_ID' ); 638 564 } 639 565 if ( ! isset ( $sd_token ) ) { 640 header( 'HTTP/1.1 40 0 Bad request' );641 header( 'Content-type: application/json; charset=utf-8' );642 die( 'FAILED_SDTOKEN' );566 header( 'HTTP/1.1 403 Forbidden' ); 567 header( 'Content-type: text/plain; charset=utf-8' ); 568 exit( 'FAILED' ); 643 569 } 644 570 $failed = (int) get_option( 'sarbacane_failed', 0 ); … … 649 575 update_option( 'sarbacane_failed', $failed + 1, false ); 650 576 } 651 header( 'HTTP/1.1 403 Unauthorized' ); 652 header( 'Content-type: application/json; charset=utf-8' ); 653 die( 'FAILED_SDTOKEN' ); 654 } else { 655 // Content retrieving 577 header( 'HTTP/1.1 403 Forbidden' ); 578 header( 'Content-type: text/plain; charset=utf-8' ); 579 exit( 'FAILED' ); 580 } else if ( $sd_token == $sd_token_saved && strlen( $sd_token_saved ) > 20 && ! $is_failed ) { 656 581 if ( isset ( $type ) ) { 657 582 if ( $type == 'posts' ) { 658 header( 'Content-Type: application/rss+xml; charset=utf-8' );659 583 $content = new SarbacaneContent(); 660 584 if ( isset ( $id ) ) { 661 $content->get_article_rss( $id ); 585 $text = $content->get_article_rss( $id ); 586 if ($text === false) { 587 header( 'HTTP/1.1 404 Not Found' ); 588 header( 'Content-Type: text/plain; charset=utf-8' ); 589 exit( 'FAILED_ID' ); 590 } else { 591 header( 'Content-Type: application/rss+xml; charset=utf-8' ); 592 echo $text; 593 } 662 594 } else { 663 $content->get_articles_rss( $limit ); 595 header( 'Content-Type: application/rss+xml; charset=utf-8' ); 596 echo $content->get_articles_rss( $limit ); 664 597 } 665 598 } else if ( $type == 'settings' ) { 666 599 header( 'Content-Type: application/json; charset=utf-8' ); 667 header( 'Content-Transfer-Encoding: binary' );668 600 $settings = new SarbacaneSettings(); 669 $settings->get_settings();601 echo $settings->get_settings(); 670 602 } else if ( $type == 'medias' ) { 671 603 header( 'Content-Type: application/json; charset=utf-8' ); 672 604 $medias = new SarbacaneMedias(); 673 $medias->get_medias();605 echo $medias->get_medias(); 674 606 } 675 607 } else { 676 608 $this->update_data_1_4_5(); 677 // List retrieving678 609 header( 'Content-Type: text/plain; charset=utf-8' ); 679 header( 'Content-Transfer-Encoding: binary' );680 610 if ( $action == 'delete' ) { 681 611 $this->sarbacane_delete_sdid( $sd_id ); … … 683 613 if ( $sd_list_id != '' && $sd_list_id != 'N' && $sd_list_id != 'U' ) { 684 614 header( 'HTTP/1.1 404 Not found' ); 685 header( 'Content-type: application/json; charset=utf-8' ); 686 die( 'FAILED_ID' ); 615 exit( 'FAILED_ID' ); 687 616 } 688 $this->sarbacane_get_list( $sd_id, $sd_list_id );617 echo $this->sarbacane_get_list( $sd_id, $sd_list_id ); 689 618 } 690 619 } -
sarbacane-desktop/trunk/readme.txt
r1886659 r1898992 5 5 Tested up to: 4.9 6 6 License: GPLv2 or later 7 Stable tag: 1.4.1 07 Stable tag: 1.4.11 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 … … 79 79 == Changelog == 80 80 81 = 1.4.10 =81 = 1.4.10 & 1.4.11 = 82 82 Modification du widget. 83 83 … … 132 132 = English = 133 133 134 = 1.4.10 =134 = 1.4.10 & 1.4.11 = 135 135 Widget modifications. 136 136 -
sarbacane-desktop/trunk/sarbacane.php
r1886659 r1898992 5 5 Description: This plugin allows you to synchronize your WordPress data in Sarbacane 6 6 Author: Sarbacane Software 7 Version: 1.4.1 07 Version: 1.4.11 8 8 Author URI: http://sarbacane.com/?utm_source=module-wordpress&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=wordpress 9 9 Text Domain: sarbacane-desktop
Note: See TracChangeset
for help on using the changeset viewer.