Changeset 1681124
- Timestamp:
- 06/19/2017 12:40:02 PM (9 years ago)
- Location:
- mailify
- Files:
-
- 28 edited
- 1 copied
-
tags/1.4.7 (copied) (copied from mailify/trunk)
-
tags/1.4.7/class.sarbacane-about.php (modified) (1 diff)
-
tags/1.4.7/class.sarbacane-content.php (modified) (4 diffs)
-
tags/1.4.7/class.sarbacane-lists-sync.php (modified) (7 diffs)
-
tags/1.4.7/class.sarbacane-medias.php (modified) (1 diff)
-
tags/1.4.7/class.sarbacane-newsletterwidget.php (modified) (7 diffs)
-
tags/1.4.7/class.sarbacane-settings.php (modified) (1 diff)
-
tags/1.4.7/class.sarbacane.php (modified) (32 diffs)
-
tags/1.4.7/js/sarbacane-widget.js (modified) (1 diff)
-
tags/1.4.7/readme.txt (modified) (3 diffs)
-
tags/1.4.7/sarbacane.php (modified) (1 diff)
-
tags/1.4.7/views/sarbacane-adminpanel.php (modified) (1 diff)
-
tags/1.4.7/views/sarbacane-lists-sync.php (modified) (6 diffs)
-
tags/1.4.7/views/sarbacane-widget-adminpanel.php (modified) (3 diffs)
-
tags/1.4.7/views/sarbacane-widget.php (modified) (1 diff)
-
trunk/class.sarbacane-about.php (modified) (1 diff)
-
trunk/class.sarbacane-content.php (modified) (4 diffs)
-
trunk/class.sarbacane-lists-sync.php (modified) (7 diffs)
-
trunk/class.sarbacane-medias.php (modified) (1 diff)
-
trunk/class.sarbacane-newsletterwidget.php (modified) (7 diffs)
-
trunk/class.sarbacane-settings.php (modified) (1 diff)
-
trunk/class.sarbacane.php (modified) (32 diffs)
-
trunk/js/sarbacane-widget.js (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/sarbacane.php (modified) (1 diff)
-
trunk/views/sarbacane-adminpanel.php (modified) (1 diff)
-
trunk/views/sarbacane-lists-sync.php (modified) (6 diffs)
-
trunk/views/sarbacane-widget-adminpanel.php (modified) (3 diffs)
-
trunk/views/sarbacane-widget.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mailify/tags/1.4.7/class.sarbacane-about.php
r1677274 r1681124 14 14 return; 15 15 } 16 wp_enqueue_style ( "sarbacane_global.css", plugins_url ( "css/sarbacane_global.css", __FILE__ ), array(), '1.4.6' );17 wp_enqueue_style ( "sarbacane_about.css", plugins_url ( "css/sarbacane_about.css", __FILE__ ), array(), '1.4.6' );18 require_once( "views/sarbacane-about.php");16 wp_enqueue_style ( 'sarbacane_global.css', plugins_url ( 'css/sarbacane_global.css', __FILE__ ), array(), '1.4.7' ); 17 wp_enqueue_style ( 'sarbacane_about.css', plugins_url ( 'css/sarbacane_about.css', __FILE__ ), array(), '1.4.7' ); 18 require_once( 'views/sarbacane-about.php' ); 19 19 } 20 20 -
mailify/tags/1.4.7/class.sarbacane-content.php
r1576277 r1681124 5 5 private function get_rss_header() { 6 6 return '<?xml version="1.0" encoding="UTF-8"?> 7 <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" 8 xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> 7 <rss version="2.0" 8 xmlns:content="http://purl.org/rss/1.0/modules/content/" 9 xmlns:wfw="http://wellformedweb.org/CommentAPI/" 10 xmlns:dc="http://purl.org/dc/elements/1.1/" 11 xmlns:atom="http://www.w3.org/2005/Atom" 12 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 13 xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> 9 14 <channel> 10 15 <title>' . get_bloginfo_rss( 'name' ) . '</title> … … 14 19 15 20 private function get_rss_footer() { 16 return '</channel></rss>'; 21 return ' 22 </channel> 23 </rss>'; 17 24 } 18 25 … … 27 34 while ( $query->have_posts() ) { 28 35 $query->the_post(); 29 $items .= '<item> 36 if ( post_password_required() ) { 37 continue; 38 } 39 $items .= "\n\t\t" . '<item> 30 40 <title>' . get_the_title_rss() . '</title> 31 41 <link>' . esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ) . '</link> 32 42 <id>' . get_the_ID() . '</id> 33 43 <pubDate>' . mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ) . '</pubDate> 34 <dc:creator><![CDATA[' . get_the_author() . ']]></dc:creator> 35 '. get_the_category_rss( 'rss2' );44 <dc:creator><![CDATA[' . get_the_author() . ']]></dc:creator>' . 45 "\n\t" . get_the_category_rss( 'rss2' ); 36 46 if ( $option === 'posts' ) { 37 $items .= '<description><![CDATA[' . apply_filters( 'the_excerpt_rss', get_the_excerpt() ) . ']]></description>';47 $items .= "\t\t\t" . '<description><![CDATA[' . apply_filters( 'the_excerpt_rss', get_the_excerpt() ) . ']]></description>' . "\n"; 38 48 } 39 $content = get_the_content_feed( 'rss2' ); 40 $items .= '<content:encoded><![CDATA[' . $content . ']]></content:encoded>'; 41 $items .= '<slash:comments>' . get_comments_number() . '</slash:comments>'; 49 $items .= "\t\t\t" . '<content:encoded><![CDATA[' . get_the_content_feed( 'rss2' ) . ']]></content:encoded> 50 <slash:comments>' . get_comments_number() . '</slash:comments>'; 42 51 $media = get_attached_media( 'image' ); 43 52 if ( is_array( $media ) && count( $media ) > 0 ) { 44 53 $all_medias_key = array_keys( $media ); 45 $items .= '<enclosure url="' . $media [ $all_medias_key [0] ]->guid . '" type="' . $media [ $all_medias_key [0] ]->post_mime_type . '" />';54 $items .= "\n\t\t\t" . '<enclosure url="' . $media [ $all_medias_key [0] ]->guid . '" type="' . $media [ $all_medias_key [0] ]->post_mime_type . '" />'; 46 55 } 47 $items .= rss_enclosure(); 48 do_action( 'rss2_item' ); 49 $items .= '</item>'; 56 $items .= "\n\t\t" . '</item>'; 50 57 } 51 58 return $items; … … 57 64 echo $this->get_rss_header() . $this->get_rss_content( 'post', $post_id ) . $this->get_rss_footer(); 58 65 } else { 59 header( "HTTP/1.1 404 Bad item");60 header( "Content-Type: application/json ; charset=utf-8");61 die ( 'FAILED_ID' );66 header( 'HTTP/1.1 404 Bad item' ); 67 header( 'Content-Type: application/json; charset=utf-8' ); 68 die( 'FAILED_ID' ); 62 69 } 63 70 } -
mailify/tags/1.4.7/class.sarbacane-lists-sync.php
r1677274 r1681124 31 31 } 32 32 global $wpdb; 33 $table_name = $wpdb->prefix . 'sd_updates'; 34 $wpdb->query( "TRUNCATE TABLE `$table_name`" ); 33 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 35 34 } 36 35 37 if ( isset( $_POST['sarbacane_news_list'] ) && "true" == $_POST['sarbacane_news_list']) {36 if ( isset( $_POST['sarbacane_news_list'] ) && $_POST['sarbacane_news_list'] == 'true' ) { 38 37 update_option( 'sarbacane_news_list', true, false ); 39 38 $fields = get_option( 'sarbacane_news_fields' ); 40 39 if ( ! is_array( $fields ) || count( $fields ) == 0 ) { 41 $default_email = new stdClass ();40 $default_email = new stdClass(); 42 41 $default_email->label = 'email'; 43 42 $default_email->placeholder = ''; … … 53 52 } 54 53 55 if ( isset( $_POST['sarbacane_theme_sync'] ) && "true" == $_POST['sarbacane_theme_sync']) {54 if ( isset( $_POST['sarbacane_theme_sync'] ) && $_POST['sarbacane_theme_sync'] == 'true' ) { 56 55 update_option( 'sarbacane_theme_sync', true, false ); 57 56 } else { … … 59 58 } 60 59 61 if ( isset( $_POST['sarbacane_blog_content'] ) && "true" == $_POST['sarbacane_blog_content']) {60 if ( isset( $_POST['sarbacane_blog_content'] ) && $_POST['sarbacane_blog_content'] == 'true' ) { 62 61 update_option( 'sarbacane_blog_content', true, false ); 63 62 } else { … … 65 64 } 66 65 67 if ( isset( $_POST['sarbacane_media_content'] ) && "true" == $_POST['sarbacane_media_content']) {66 if ( isset( $_POST['sarbacane_media_content'] ) && $_POST['sarbacane_media_content'] == 'true' ) { 68 67 update_option( 'sarbacane_media_content', true, false ); 69 68 } else { … … 71 70 } 72 71 73 if ( isset( $_POST['sarbacane_rss_data'] ) && "true" == $_POST['sarbacane_rss_data']) {72 if ( isset( $_POST['sarbacane_rss_data'] ) && $_POST['sarbacane_rss_data'] == 'true' ) { 74 73 update_option( 'sarbacane_rss_data', true, false ); 75 74 } else { … … 77 76 } 78 77 } 79 wp_enqueue_style ( "sarbacane_global.css", plugins_url ( "css/sarbacane_global.css" , __FILE__ ), array(), '1.4.6' );80 wp_enqueue_style ( "sarbacane_lists_config.css", plugins_url ( "css/sarbacane_lists_config.css", __FILE__ ), array(), '1.4.6' );81 wp_enqueue_script( "sarbacane-lists-sync.js", plugins_url( "js/sarbacane-lists-sync.js", __FILE__ ), array( 'jquery' ), '1.4.6' );78 wp_enqueue_style ( 'sarbacane_global.css', plugins_url ( 'css/sarbacane_global.css', __FILE__ ), array(), '1.4.7' ); 79 wp_enqueue_style ( 'sarbacane_lists_config.css', plugins_url ( 'css/sarbacane_lists_config.css', __FILE__ ), array(), '1.4.7' ); 80 wp_enqueue_script( 'sarbacane-lists-sync.js', plugins_url( 'js/sarbacane-lists-sync.js', __FILE__ ), array( 'jquery' ), '1.4.7' ); 82 81 $sarbacane_news_list = get_option( 'sarbacane_news_list', false ); 83 82 $sarbacane_users_list = get_option( 'sarbacane_users_list', false ); … … 88 87 $sarbacane_rss_data = get_option( 'sarbacane_rss_data', false ); 89 88 90 require_once( "views/sarbacane-lists-sync.php");89 require_once( 'views/sarbacane-lists-sync.php' ); 91 90 } 92 91 -
mailify/tags/1.4.7/class.sarbacane-medias.php
r1576277 r1681124 5 5 public function get_medias() { 6 6 $wp_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit' ) ); 7 $ return_string = '{"medias":[';7 $medias = array(); 8 8 if ( $wp_query->have_posts() ) { 9 9 while ( $wp_query->have_posts() ) { 10 10 $wp_query->the_post(); 11 11 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail' ); 12 $return_string .= ' 13 {"name":"' . get_the_title() . '", 14 "url":"' . get_the_guid() . '", 15 "mime_type":"' . get_post_mime_type() . '", 16 "thumbnail":"' . $thumbnail[0] . '"},'; 12 $medias[] = ' 13 { 14 "name":"' . get_the_title() . '", 15 "url":"' . get_the_guid() . '", 16 "mime_type":"' . get_post_mime_type() . '", 17 "thumbnail":"' . $thumbnail[0] . '" 18 }'; 17 19 } 18 20 } 19 $return_string = rtrim( $return_string, ',' ); 20 $return_string .= ' 21 ] 22 }'; 23 echo $return_string; 21 $medias = implode( ',', $medias ); 22 echo '{"medias":[' . $medias . "\n\t" . ']' . "\n" . '}'; 24 23 } 25 24 -
mailify/tags/1.4.7/class.sarbacane-newsletterwidget.php
r1677274 r1681124 24 24 public function sarbacane_save_widget() { 25 25 $valid = false; 26 if ( isset ( $_POST ['email'] ) ) { 27 $user_registring = new stdClass (); 28 $user_registring->email = sanitize_email( $_POST ['email'] ); 29 if ( is_email( $user_registring->email ) ) { 30 $fields = get_option( 'sarbacane_news_fields', array() ); 31 $columns = array(); 32 foreach ( $fields as $field ) { 33 if ( strtolower( $field->label ) == 'email' ) { 34 continue; 35 } 36 $field_label = $field->label; 37 $field_label_html = str_replace( ' ', '_', $field->label ); 38 $field_label = strtolower( $field_label ); 39 if ( isset ( $_POST [ $field_label_html ] ) ) { 40 $fieldValue = stripslashes( sanitize_text_field( $_POST [ $field_label_html ] ) ); 41 } else { 42 $fieldValue = ''; 43 } 44 $user_registring->$field_label = $fieldValue; 45 $columns [ $field_label ] = $fieldValue; 26 if ( isset ( $_POST ['sarbacane_form_value'] ) && isset ( $_POST ['email'] ) ) { 27 $sarbacane_form_value = sanitize_text_field( $_POST ['sarbacane_form_value'] ); 28 if ($sarbacane_form_value == 'sarbacane_desktop_widget' ) { 29 $user_registering = new stdClass(); 30 $user_registering->email = sanitize_email( $_POST ['email'] ); 31 if ( is_email( $user_registering->email ) ) { 32 $fields = get_option( 'sarbacane_news_fields', array() ); 33 $columns = array(); 34 foreach ( $fields as $field ) { 35 if ( strtolower( $field->label ) == 'email' ) { 36 continue; 37 } 38 $field_label = $field->label; 39 $field_label_html = str_replace( ' ', '_', $field->label ); 40 $field_label = strtolower( $field_label ); 41 if ( isset ( $_POST [ $field_label_html ] ) ) { 42 $fieldValue = stripslashes( sanitize_text_field( $_POST [ $field_label_html ] ) ); 43 } else { 44 $fieldValue = ''; 45 } 46 $user_registering->$field_label = $fieldValue; 47 $columns [ $field_label ] = $fieldValue; 48 } 49 $user_registering->registration_date = gmdate( 'Y-m-d H:i:s' ); 50 $version = get_option( 'sarbacane_version' ); 51 $result = true; 52 if ( $version !== false ) { 53 global $wpdb; 54 $sql = "INSERT INTO `{$wpdb->prefix}sd_subscribers` (`email`, `columns`, `registration_date`) VALUES (%s, %s, %s);"; 55 $result = $wpdb->query( $wpdb->prepare( $sql, $user_registering->email, json_encode( $columns ), $user_registering->registration_date ) ); 56 } 57 if ( $version === false || $result === false ) { 58 $users_registered = get_option( 'sarbacane_newsletter_list', array() ); 59 $users_registered[] = $user_registering; 60 update_option( 'sarbacane_newsletter_list', $users_registered, false ); 61 } 62 $valid = true; 46 63 } 47 $user_registring->registration_date = gmdate( 'Y-m-d H:i:s' );48 $version = get_option( 'sarbacane_version' );49 $result = true;50 if ( $version !== false ) {51 global $wpdb;52 $table_name = $wpdb->prefix . 'sd_subscribers';53 $sql = "INSERT INTO `$table_name` (`email`, `columns`, `registration_date`) VALUES (%s, %s, %s);";54 $result = $wpdb->query( $wpdb->prepare( $sql, $user_registring->email, json_encode( $columns ), $user_registring->registration_date ) );55 }56 if ( $version === false || $result === false ) {57 $users_registred = get_option( 'sarbacane_newsletter_list', array() );58 $users_registred[] = $user_registring;59 update_option( 'sarbacane_newsletter_list', $users_registred, false );60 }61 $valid = true;62 64 } 63 65 } … … 84 86 $fields = get_option( 'sarbacane_news_fields', array() ); 85 87 if ( ! is_array( $fields ) || count( $fields ) == 0 ) { 86 $default_email = new stdClass ();88 $default_email = new stdClass(); 87 89 $default_email->label = 'email'; 88 90 $default_email->placeholder = ''; … … 95 97 $list_type = 'N'; 96 98 $rand = mt_rand( 0, 1000000 ); 97 wp_enqueue_script( "sarbacane-widget.js", plugins_url( "js/sarbacane-widget.js", __FILE__ ), array( 'jquery' ), '1.4.6' );98 wp_enqueue_style( "sarbacane_widget.css", plugins_url( "css/sarbacane_widget.css", __FILE__ ), array(), '1.4.6' );99 include( "views/sarbacane-widget.php");99 wp_enqueue_script( 'sarbacane-widget.js', plugins_url( 'js/sarbacane-widget.js', __FILE__ ), array( 'jquery' ), '1.4.7' ); 100 wp_enqueue_style( 'sarbacane_widget.css', plugins_url( 'css/sarbacane_widget.css', __FILE__ ), array(), '1.4.7' ); 101 include( 'views/sarbacane-widget.php' ); 100 102 } 101 103 … … 119 121 return; 120 122 } 121 wp_enqueue_style( "sarbacane_global.css", plugins_url( "css/sarbacane_global.css", __FILE__ ), array( 'wp-admin' ), '1.4.6' );122 wp_enqueue_style( "sarbacane_widget_admin_panel.css", plugins_url( "css/sarbacane_widget_admin_panel.css", __FILE__ ), array( 'wp-admin' ), '1.4.6' );123 wp_enqueue_script( "sarbacane-widget-adminpanel.js", plugins_url( "js/sarbacane-widget-adminpanel.js", __FILE__ ), array( 'jquery', 'underscore' ), '1.4.6' );123 wp_enqueue_style( 'sarbacane_global.css', plugins_url( 'css/sarbacane_global.css', __FILE__ ), array( 'wp-admin' ), '1.4.7' ); 124 wp_enqueue_style( 'sarbacane_widget_admin_panel.css', plugins_url( 'css/sarbacane_widget_admin_panel.css', __FILE__ ), array( 'wp-admin' ), '1.4.7' ); 125 wp_enqueue_script( 'sarbacane-widget-adminpanel.js', plugins_url( 'js/sarbacane-widget-adminpanel.js', __FILE__ ), array( 'jquery', 'underscore' ), '1.4.7' ); 124 126 $nonce_ok = false; 125 127 if ( isset( $_POST ['sarbacane_token'] ) ) { … … 148 150 $fields = get_option( 'sarbacane_news_fields', array() ); 149 151 if ( ! is_array( $fields ) || count( $fields ) == 0 ) { 150 $default_email = new stdClass ();152 $default_email = new stdClass(); 151 153 $default_email->label = 'email'; 152 154 $default_email->placeholder = ''; … … 156 158 } 157 159 158 require_once 'views/sarbacane-widget-adminpanel.php';160 require_once( 'views/sarbacane-widget-adminpanel.php' ); 159 161 } 160 162 … … 173 175 if ( isset ( $field_number ) && $field_number > 0 ) { 174 176 for ( $i = 0; $i < $field_number; $i ++ ) { 175 $field_config = new stdClass ();177 $field_config = new stdClass(); 176 178 if ( isset ( $sanitized_post [ 'sarbacane_label_' . $i ] ) && '' != $sanitized_post [ 'sarbacane_label_' . $i ] ) { 177 179 $field_config->label = $sanitized_post [ 'sarbacane_label_' . $i ]; -
mailify/tags/1.4.7/class.sarbacane-settings.php
r1576277 r1681124 10 10 $media_content = get_option( 'sarbacane_media_content', false ); 11 11 $rss_data = get_option( 'sarbacane_rss_data', false ); 12 $rss_url = get_feed_link( "rss2");12 $rss_url = get_feed_link( 'rss2' ); 13 13 $posts_per_rss = get_option( 'posts_per_rss', 10 ); 14 14 //forcing boolean to display as int to get 0 when false. Impossible otherwise -
mailify/tags/1.4.7/class.sarbacane.php
r1677274 r1681124 8 8 /** 9 9 * Method called on plugin activation. 10 * Initiate some options, creates the sd updates table11 10 */ 12 11 public static function activation() { 13 update_option( 'sarbacane_version', '1.4. 6', false );12 update_option( 'sarbacane_version', '1.4.7', false ); 14 13 update_option( 'sarbacane_sd_token', '', false ); 15 14 update_option( 'sarbacane_sd_id_list', array(), false ); … … 17 16 18 17 global $wpdb; 19 $table_name = $wpdb->prefix . 'sd_updates'; 20 $sql = "DROP TABLE IF EXISTS `$table_name`"; 18 $sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_updates`"; 21 19 $wpdb->query( $sql ); 22 20 $charset_collate = $wpdb->get_charset_collate(); 23 $sql = "CREATE TABLE IF NOT EXISTS ` $table_name` (21 $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sd_updates` ( 24 22 `id` mediumint(9) NOT NULL AUTO_INCREMENT, 25 23 `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', … … 28 26 `action` text NOT NULL, 29 27 UNIQUE KEY `id` (`id`) 30 ) $charset_collate;";28 ) {$charset_collate};"; 31 29 $wpdb->query( $sql ); 32 $table_name = $wpdb->prefix . 'sd_subscribers'; 33 //$sql = "DROP TABLE IF EXISTS `$table_name`"; 30 //$sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_subscribers`"; 34 31 //$wpdb->query( $sql ); 35 $charset_collate = $wpdb->get_charset_collate(); 36 $sql = "CREATE TABLE IF NOT EXISTS `$table_name` ( 32 $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sd_subscribers` ( 37 33 `id` mediumint(9) NOT NULL AUTO_INCREMENT, 38 34 `email` varchar(255) DEFAULT NULL, … … 40 36 `registration_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 41 37 UNIQUE KEY `id` (`id`) 42 ) $charset_collate;";38 ) {$charset_collate};"; 43 39 $wpdb->query( $sql ); 44 40 } … … 46 42 /** 47 43 * Method called on plugin deactivation. 48 * Deletes all options created by the plugin and drops the sd_updates table49 44 */ 50 45 public static function deactivation() { … … 80 75 81 76 global $wpdb; 82 $table_name = $wpdb->prefix . 'sd_updates'; 83 $sql = "DROP TABLE IF EXISTS `$table_name`"; 77 $sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_updates`"; 84 78 $wpdb->query( $sql ); 85 //$table_name = $wpdb->prefix . 'sd_subscribers'; 86 //$sql = "DROP TABLE IF EXISTS `$table_name`"; 79 //$sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_subscribers`"; 87 80 //$wpdb->query( $sql ); 88 81 } … … 90 83 public function update_data_1_4_5() { 91 84 if ( get_option( 'sarbacane_version' ) === false ) { 92 update_option( 'sarbacane_version', '1.4. 6', false );85 update_option( 'sarbacane_version', '1.4.7', false ); 93 86 try { 94 87 global $wpdb; 95 $table_name = $wpdb->prefix . 'sd_subscribers';96 88 $charset_collate = $wpdb->get_charset_collate(); 97 $sql = "CREATE TABLE IF NOT EXISTS ` $table_name` (89 $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sd_subscribers` ( 98 90 `id` mediumint(9) NOT NULL AUTO_INCREMENT, 99 91 `email` varchar(255) DEFAULT NULL, … … 101 93 `registration_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 102 94 UNIQUE KEY `id` (`id`) 103 ) $charset_collate;";95 ) {$charset_collate};"; 104 96 $result = $wpdb->query( $sql ); 105 97 if ( $result !== false ) { … … 109 101 $insert_request = array(); 110 102 $insert_data = array(); 111 $sql = "SELECT COUNT(*) FROM ` $table_name`";103 $sql = "SELECT COUNT(*) FROM `{$wpdb->prefix}sd_subscribers`"; 112 104 $count = $wpdb->get_var( $sql ); 113 105 if ( $count == 0) { … … 129 121 $insert_data[] = $registration_date; 130 122 if ( $key % 1000 == 0 || $key + 1 == $nb_subscribers ) { 131 $sql = "INSERT INTO ` $table_name` (`email`, `columns`, `registration_date`) VALUES " . implode( ',', $insert_request ) . ";";123 $sql = "INSERT INTO `{$wpdb->prefix}sd_subscribers` (`email`, `columns`, `registration_date`) VALUES " . implode( ',', $insert_request ) . ";"; 132 124 $wpdb->query( $wpdb->prepare( $sql, $insert_data ) ); 133 125 $insert_request = array(); … … 146 138 } 147 139 update_option( 'sarbacane_sd_id_list', array(), false ); 148 $table_name = $wpdb->prefix . 'sd_updates'; 149 $wpdb->query( "TRUNCATE TABLE `$table_name`" ); 140 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 150 141 } else { 151 142 delete_option( 'sarbacane_version' ); … … 202 193 } 203 194 if ( $sd_list_id != '' ) { 204 if ( "U" == $sd_list_id) {195 if ( $sd_list_id == 'U' ) { 205 196 $this->get_users_list( $sd_id ); 206 } else if ( "N" == $sd_list_id) {197 } else if ( $sd_list_id == 'N' ) { 207 198 $this->get_newsletter_list( $sd_id ); 208 199 } … … 213 204 214 205 private function generate_available_lists( $sd_id, $user_sync, $newsletter_sync ) { 215 echo 'list_id;name;reset;is_updated;type;version' . "\r\n"; 216 206 echo 'list_id;name;reset;is_updated;type;version' . "\n"; 217 207 $last_call_date_N = get_option( 'sarbacane_news_call_' . $sd_id ); 218 208 $last_call_date_C = get_option( 'sarbacane_user_call_' . $sd_id ); … … 240 230 } 241 231 if ( $user_sync ) { 242 echo 'U;' . get_bloginfo( 'name' ) . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\ r\n";232 echo 'U;' . get_bloginfo( 'name' ) . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 243 233 } 244 234 if ( $newsletter_sync ) { 245 echo 'N;' . get_bloginfo( 'name' ) . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\ r\n";235 echo 'N;' . get_bloginfo( 'name' ) . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 246 236 } 247 237 } … … 256 246 private function check_users_list( $last_call_date ) { 257 247 global $wpdb; 258 $wp_prefix = $wpdb->prefix; 259 $table_name = $wpdb->prefix . 'sd_updates'; 260 261 $new_users_since_last_call = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM `' . $wp_prefix . 'users` AS `wu` WHERE `wu`.`user_registered` >= %s', $last_call_date ) ); 262 $update_users_since_last_call = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM `' . $table_name . '` AS `wsu` WHERE `wsu`.`time` >= %s', $last_call_date ) ); 248 $sql = "SELECT COUNT(*) FROM `{$wpdb->prefix}users` AS `wu` WHERE `wu`.`user_registered` >= %s"; 249 $new_users_since_last_call = $wpdb->get_var( $wpdb->prepare( $sql, $last_call_date ) ); 250 $sql = "SELECT COUNT(*) FROM `{$wpdb->prefix}sd_updates` AS `wsu` WHERE `wsu`.`time` >= %s"; 251 $update_users_since_last_call = $wpdb->get_var( $wpdb->prepare( $sql, $last_call_date ) ); 263 252 return $new_users_since_last_call > 0 || $update_users_since_last_call > 0; 264 253 } … … 273 262 private function check_newsletter_list( $last_call_date = '' ) { 274 263 global $wpdb; 275 $table_name = $wpdb->prefix . 'sd_subscribers'; 276 $sql_subscribers = 'SELECT COUNT(*) FROM `' . $table_name . '`'; 264 $sql_subscribers = "SELECT COUNT(*) FROM `{$wpdb->prefix}sd_subscribers`"; 277 265 if ( $last_call_date != '' ) { 278 $sql_subscribers .= ' WHERE `registration_date` > %s';266 $sql_subscribers .= " WHERE `registration_date` > %s"; 279 267 $count = $wpdb->get_var( $wpdb->prepare( $sql_subscribers, $last_call_date ) ); 280 268 } else { … … 335 323 if ( "N" == $list_type ) { 336 324 $fields = get_option( 'sarbacane_news_fields', array() ); 337 $csv_string = "email;";325 $csv_string = 'email;'; 338 326 foreach ( $fields as $field ) { 339 327 if ( strtolower( $field->label ) != 'email' ) { … … 341 329 } 342 330 } 343 $csv_string .= "action\r\n";331 $csv_string .= 'action' . "\n"; 344 332 foreach ( $new_or_updated_users as $one_user_updated ) { 345 333 if ( isset( $one_user_updated->email ) ) { … … 358 346 } 359 347 } 360 $csv_string .= 'S' . "\ r\n";361 } 362 } else { 363 $csv_string = 'email;lastname;firstname;login;role;post_count;action' . "\ r\n";348 $csv_string .= 'S' . "\n"; 349 } 350 } else { 351 $csv_string = 'email;lastname;firstname;login;role;post_count;action' . "\n"; 364 352 if ( count( $new_or_updated_users ) > 0 ) { 365 353 foreach ( $new_or_updated_users as $one_user_updated ) { … … 376 364 $csv_string .= $this->d_quote( $one_user_updated->email ) . ';' . $this->d_quote( $one_user_updated->lastname ) . ';'; 377 365 $csv_string .= $this->d_quote( $one_user_updated->firstname ) . ';' . $this->d_quote( $one_user_updated->user_login ) . ';'; 378 $csv_string .= $this->d_quote( $role ) . ';' . $this->d_quote( $one_user_updated->user_posts ) . ';S' . "\ r\n";366 $csv_string .= $this->d_quote( $role ) . ';' . $this->d_quote( $one_user_updated->user_posts ) . ';S' . "\n"; 379 367 } 380 368 } 381 369 if ( count( $deleted_users ) > 0 ) { 382 370 foreach ( $deleted_users as $deleted_user ) { 383 $csv_string .= $deleted_user->user_email . ';;;;;;U' . "\ r\n";371 $csv_string .= $deleted_user->user_email . ';;;;;;U' . "\n"; 384 372 } 385 373 } … … 403 391 private function sarbacanedesktop_get_all_users( $last_call_date ) { 404 392 global $wpdb; 405 $wp_prefix = $wpdb->prefix; 406 $table_name = $wpdb->prefix . 'sd_updates'; 407 $sql = 'SELECT `wu`.`id` AS `user_id`, `wu`.`user_login` AS `user_login`, `wu`.`user_email` AS `email`, `wmf`.`meta_value` AS `firstname`, `wml`.`meta_value` AS `lastname`, `wum`.`meta_value` AS `user_role` 408 FROM `' . $wp_prefix . 'users` AS `wu` LEFT JOIN `' . $wp_prefix . 'usermeta` AS `wmf` ON `wu`.`id` = `wmf`.`user_id` AND `wmf`.`meta_key` = "first_name" 409 LEFT JOIN `' . $wp_prefix . 'usermeta` AS `wml` ON `wu`.`id` = `wml`.`user_id` AND `wml`.`meta_key` = "last_name" 410 LEFT JOIN `' . $wp_prefix . 'usermeta` AS `wum` ON `wu`.`id` = `wum`.`user_id` AND `wum`.`meta_key` = "' . $wp_prefix . 'capabilities"'; 393 $sql = "SELECT `wu`.`id` AS `user_id`, `wu`.`user_login` AS `user_login`, `wu`.`user_email` AS `email`, `wmf`.`meta_value` AS `firstname`, `wml`.`meta_value` AS `lastname`, `wum`.`meta_value` AS `user_role` 394 FROM `{$wpdb->prefix}users` AS `wu` LEFT JOIN `{$wpdb->prefix}usermeta` AS `wmf` ON `wu`.`id` = `wmf`.`user_id` AND `wmf`.`meta_key` = 'first_name' 395 LEFT JOIN `{$wpdb->prefix}usermeta` AS `wml` ON `wu`.`id` = `wml`.`user_id` AND `wml`.`meta_key` = 'last_name' 396 LEFT JOIN `{$wpdb->prefix}usermeta` AS `wum` ON `wu`.`id` = `wum`.`user_id` AND `wum`.`meta_key` = '{$wpdb->prefix}capabilities'"; 411 397 if ( $last_call_date == '' ) { 412 398 $all_users = $wpdb->get_results( $sql ); 413 399 } else { 414 $sql = $sql . ' LEFT JOIN `' . $table_name . '` AS `wsu` ON `wsu`.`user_id` = `wu`.`id` AND `wsu`.`action` = "S" WHERE `wu`.`user_registered` >= %s OR `wsu`.`time` >= %s';400 $sql = $sql . " LEFT JOIN `{$wpdb->prefix}sd_updates` AS `wsu` ON `wsu`.`user_id` = `wu`.`id` AND `wsu`.`action` = 'S' WHERE `wu`.`user_registered` >= %s OR `wsu`.`time` >= %s"; 415 401 $all_users = $wpdb->get_results( $wpdb->prepare( $sql, $last_call_date, $last_call_date ) ); 416 402 } … … 425 411 private function sarbacanedesktop_get_all_deleted_users( $last_call_date ) { 426 412 global $wpdb; 427 $ table_name = $wpdb->prefix . 'sd_updates';428 $deleted_users = $wpdb->get_results( $wpdb->prepare( 'SELECT `user_email` FROM `' . $table_name . '` AS `wsu` WHERE `wsu`.`action` = "U" AND `wsu`.`time` >= %s', $last_call_date ) );413 $sql = "SELECT `user_email` FROM `{$wpdb->prefix}sd_updates` AS `wsu` WHERE `wsu`.`action` = 'U' AND `wsu`.`time` >= %s"; 414 $deleted_users = $wpdb->get_results( $wpdb->prepare( $sql, $last_call_date ) ); 429 415 return $deleted_users; 430 416 } … … 437 423 private function get_subscribers( $last_call_date ) { 438 424 global $wpdb; 439 $table_name = $wpdb->prefix . 'sd_subscribers';440 425 if ( $last_call_date != '' ) { 441 $sql _subscribers = 'SELECT * FROM `' . $table_name . '` WHERE `registration_date` > %s ORDER BY `registration_date` ASC';442 $all_subscribers = $wpdb->get_results( $wpdb->prepare( $sql _subscribers, $last_call_date ) );443 } else { 444 $sql _subscribers = 'SELECT * FROM `' . $table_name . '` ORDER BY `registration_date` ASC';445 $all_subscribers = $wpdb->get_results( $sql _subscribers);426 $sql = "SELECT * FROM `{$wpdb->prefix}sd_subscribers` WHERE `registration_date` > %s ORDER BY `registration_date` ASC"; 427 $all_subscribers = $wpdb->get_results( $wpdb->prepare( $sql, $last_call_date ) ); 428 } else { 429 $sql = "SELECT * FROM `{$wpdb->prefix}sd_subscribers` ORDER BY `registration_date` ASC"; 430 $all_subscribers = $wpdb->get_results( $sql ); 446 431 } 447 432 $new_or_updated_users = array(); 448 433 foreach ( $all_subscribers as $one_subscriber ) { 449 434 if ( isset( $one_subscriber->email ) ) { 450 $values = new stdClass();435 $values = new stdClass(); 451 436 $values->email = $one_subscriber->email; 452 437 $columns = json_decode( $one_subscriber->columns ); … … 471 456 delete_option( 'sarbacane_news_call_' . $sd_id ); 472 457 473 $sd id_array= get_option( 'sarbacane_sd_id_list' );474 $index = array_search( $sd_id, $sd id_array);458 $sd_ids_saved = get_option( 'sarbacane_sd_id_list' ); 459 $index = array_search( $sd_id, $sd_ids_saved ); 475 460 if ( $index !== false ) { 476 unset ( $sdid_array[ $index ] );477 update_option( 'sarbacane_sd_id_list', $sd id_array, false );461 unset( $sd_ids_saved [ $index ] ); 462 update_option( 'sarbacane_sd_id_list', $sd_ids_saved, false ); 478 463 } 479 464 } … … 524 509 private function clear_update_history() { 525 510 global $wpdb; 526 $ table_name = $wpdb->prefix . 'sd_updates';527 $option_table = $wpdb->prefix . 'options';528 $sql = "DELETE FROM `$table_name` WHERE `time` <= (SELECT MIN(`option_value`) FROM `$option_table` WHERE `option_name` LIKE 'sarbacane_%_call_%')";511 $sql = "DELETE FROM `{$wpdb->prefix}sd_updates` WHERE `time` <= ( 512 SELECT MIN(`option_value`) FROM `{$wpdb->prefix}options` WHERE `option_name` LIKE 'sarbacane_%_call_%' 513 )"; 529 514 $wpdb->query( $sql ); 530 515 } … … 564 549 update_option( 'sarbacane_sd_id_list', array(), false ); 565 550 global $wpdb; 566 $table_name = $wpdb->prefix . 'sd_updates'; 567 $wpdb->query( "TRUNCATE TABLE `$table_name`" ); 551 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 568 552 $this->sarbacane_params_saved(); 569 553 } … … 574 558 } 575 559 $sd_list_news = get_option( 'sarbacane_news_list', false ); 576 $sdid_array = get_option( 'sarbacane_sd_id_list', array() ); 560 $is_connected = false; 561 if ( count( get_option( 'sarbacane_sd_id_list', array() ) ) > 0 ) { 562 $is_connected = true; 563 } 577 564 $is_failed = (int) get_option( 'sarbacane_failed', 0 ) < 1000000 ? false : true; 578 wp_enqueue_style ( "sarbacane_global.css", plugins_url ( "css/sarbacane_global.css", __FILE__ ), array(), '1.4.6' );579 wp_enqueue_style ( "sarbacane_admin_panel.css", plugins_url ( "css/sarbacane_admin_panel.css", __FILE__ ), array(), '1.4.6' );565 wp_enqueue_style ( 'sarbacane_global.css', plugins_url ( 'css/sarbacane_global.css', __FILE__ ), array(), '1.4.7' ); 566 wp_enqueue_style ( 'sarbacane_admin_panel.css', plugins_url ( 'css/sarbacane_admin_panel.css', __FILE__ ), array(), '1.4.7' ); 580 567 require_once( 'views/sarbacane-adminpanel.php' ); 581 568 } … … 612 599 return; 613 600 } 614 if ( isset ( $wp->query_vars ['sarbacane_form_token'] ) && '' != $wp->query_vars ['sarbacane_form_token']&& wp_verify_nonce( $wp->query_vars['sarbacane_form_token'], 'newsletter_registration' ) ) {601 if ( isset ( $wp->query_vars ['sarbacane_form_token'] ) && $wp->query_vars ['sarbacane_form_token'] != '' && wp_verify_nonce( $wp->query_vars['sarbacane_form_token'], 'newsletter_registration' ) ) { 615 602 $save_widget = true; 616 603 } 617 if ( isset ( $wp->query_vars ['sdid'] ) && '' != $wp->query_vars ['sdid']) {604 if ( isset ( $wp->query_vars ['sdid'] ) && $wp->query_vars ['sdid'] != '' ) { 618 605 $sd_id = sanitize_text_field( $wp->query_vars ['sdid'] ); 619 606 } 620 if ( isset ( $wp->query_vars ['sd_token'] ) && '' != $wp->query_vars ['sd_token']) {607 if ( isset ( $wp->query_vars ['sd_token'] ) && $wp->query_vars ['sd_token'] != '' ) { 621 608 $sd_token = sanitize_text_field( $wp->query_vars ['sd_token'] ); 622 609 } 623 610 $sd_list_id = ''; 624 if ( isset ( $wp->query_vars ['list'] ) && '' != $wp->query_vars ['list']) {611 if ( isset ( $wp->query_vars ['list'] ) && $wp->query_vars ['list'] != '' ) { 625 612 $sd_list_id = sanitize_text_field( $wp->query_vars ['list'] ); 626 613 } 627 614 $action = ''; 628 if ( isset ( $wp->query_vars ['action'] ) && '' != $wp->query_vars ['action']) {615 if ( isset ( $wp->query_vars ['action'] ) && $wp->query_vars ['action'] != '' ) { 629 616 $action = sanitize_text_field( $wp->query_vars ['action'] ); 630 617 } 631 if ( isset ( $wp->query_vars ['type'] ) && '' != $wp->query_vars ['type']) {618 if ( isset ( $wp->query_vars ['type'] ) && $wp->query_vars ['type'] != '' ) { 632 619 $type = sanitize_text_field( $wp->query_vars ['type'] ); 633 620 } 634 if ( isset ( $wp->query_vars ['id'] ) && '' != $wp->query_vars ['id']) {621 if ( isset ( $wp->query_vars ['id'] ) && $wp->query_vars ['id'] != '' ) { 635 622 $id = sanitize_text_field( $wp->query_vars ['id'] ); 636 623 } 637 624 $limit = - 1; 638 if ( isset ( $wp->query_vars ['limit'] ) && '' != $wp->query_vars ['limit']) {625 if ( isset ( $wp->query_vars ['limit'] ) && $wp->query_vars ['limit'] != '' ) { 639 626 $limit = $wp->query_vars ['limit']; 640 627 } 641 628 if ( isset( $save_widget ) ) { 642 header( "Content-Type: text/html; charset=utf-8");629 header( 'Content-Type: text/html; charset=utf-8' ); 643 630 $this->update_data_1_4_5(); 644 631 $widget = new SarbacaneNewsWidget(); … … 647 634 } 648 635 if ( ! isset ( $sd_id ) ) { 649 header( "HTTP/1.1 400 Bad request");650 header( "Content-type: application/json; charset=utf-8");651 die ( 'FAILED_SDID' );636 header( 'HTTP/1.1 400 Bad request' ); 637 header( 'Content-type: application/json; charset=utf-8' ); 638 die( 'FAILED_SDID' ); 652 639 } 653 640 if ( ! isset ( $sd_token ) ) { 654 header( "HTTP/1.1 400 Bad request");655 header( "Content-type: application/json; charset=utf-8");656 die ( 'FAILED_SDTOKEN' );641 header( 'HTTP/1.1 400 Bad request' ); 642 header( 'Content-type: application/json; charset=utf-8' ); 643 die( 'FAILED_SDTOKEN' ); 657 644 } 658 645 $failed = (int) get_option( 'sarbacane_failed', 0 ); … … 663 650 update_option( 'sarbacane_failed', $failed + 1, false ); 664 651 } 665 header( "HTTP/1.1 403 Unauthorized");666 header( "Content-type: application/json; charset=utf-8");667 die ( 'FAILED_SDTOKEN' );652 header( 'HTTP/1.1 403 Unauthorized' ); 653 header( 'Content-type: application/json; charset=utf-8' ); 654 die( 'FAILED_SDTOKEN' ); 668 655 } else { 669 656 // Content retrieving 670 657 if ( isset ( $type ) ) { 671 if ( "posts" == $type) {672 header( "Content-Type: application/rss+xml ; charset=utf-8");658 if ( $type == 'posts' ) { 659 header( 'Content-Type: application/rss+xml; charset=utf-8' ); 673 660 $content = new SarbacaneContent(); 674 661 if ( isset ( $id ) ) { … … 677 664 $content->get_articles_rss( $limit ); 678 665 } 679 } else if ( "settings" == $type) {680 header( "Content-Type: application/json ; charset=utf-8");681 header( "Content-Transfer-Encoding: binary");666 } else if ( $type == 'settings' ) { 667 header( 'Content-Type: application/json; charset=utf-8' ); 668 header( 'Content-Transfer-Encoding: binary' ); 682 669 $settings = new SarbacaneSettings(); 683 670 $settings->get_settings(); 684 } else if ( "medias" == $type) {685 header( "Content-Type: application/json ; charset=utf-8");671 } else if ( $type == 'medias' ) { 672 header( 'Content-Type: application/json; charset=utf-8' ); 686 673 $medias = new SarbacaneMedias(); 687 674 $medias->get_medias(); … … 690 677 $this->update_data_1_4_5(); 691 678 // List retrieving 692 header( "Content-Type: text/plain ; charset=utf-8");693 header( "Content-Transfer-Encoding: binary");694 if ( "delete" == $action) {679 header( 'Content-Type: text/plain; charset=utf-8' ); 680 header( 'Content-Transfer-Encoding: binary' ); 681 if ( $action == 'delete' ) { 695 682 $this->sarbacane_delete_sdid( $sd_id ); 696 683 } else { 697 if ( $sd_list_id != '' && $sd_list_id != "N" && $sd_list_id != "U") {698 header( "HTTP/1.1 404 Not found");699 header( "Content-type: application/json ; charset=utf-8");700 die ( 'FAILED_ID' );684 if ( $sd_list_id != '' && $sd_list_id != 'N' && $sd_list_id != 'U' ) { 685 header( 'HTTP/1.1 404 Not found' ); 686 header( 'Content-type: application/json; charset=utf-8' ); 687 die( 'FAILED_ID' ); 701 688 } 702 689 $this->sarbacane_get_list( $sd_id, $sd_list_id ); -
mailify/tags/1.4.7/js/sarbacane-widget.js
r1629810 r1681124 16 16 } 17 17 if ( isSubmitable ) { 18 jQuery( "#sarbacane_desktop_widget_form_" + list_type + " .sarbacane_form_value" ).val( "sarbacane_desktop_widget" ); 18 19 jQuery( "#sarbacane_desktop_widget_form_" + list_type ).submit(); 19 20 } -
mailify/tags/1.4.7/readme.txt
r1677274 r1681124 3 3 Tags: marketing, mail, email, mailing 4 4 Requires at least: 4.0 5 Tested up to: 4. 75 Tested up to: 4.8 6 6 License: GPLv2 or later 7 Stable tag: 1.4. 67 Stable tag: 1.4.7 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 … … 85 85 == Changelog == 86 86 87 = 1.4.7 = 88 Widget optimizations. 89 87 90 = 1.4.6 = 88 91 Customize widget mandatory fields message. … … 129 132 = Spanish = 130 133 134 = 1.4.7 = 135 Widget Optimización. 136 131 137 = 1.4.6 = 132 138 Personalizar el mensaje de los campos obligatorios del widget. -
mailify/tags/1.4.7/sarbacane.php
r1677274 r1681124 5 5 Description: This plugin allows you to synchronize your WordPress data in Mailify 6 6 Author: Sarbacane Software 7 Version: 1.4. 67 Version: 1.4.7 8 8 Author URI: http://mailify.com/?utm_source=module-wordpress&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=wordpress 9 9 Text Domain: mailify -
mailify/tags/1.4.7/views/sarbacane-adminpanel.php
r1629810 r1681124 17 17 <?php _e( 'Synchronization key to enter in Mailify', 'mailify' ) ?> : 18 18 <span class="sarbacane_desktop_connection_status"> 19 <?php if ( is_array( $sdid_array ) && count( $sdid_array ) > 0) { ?>19 <?php if ( $is_connected ) { ?> 20 20 <span class='sarbacane_desktop_connection_ok'><?php _e( 'Connected', 'mailify' ) ?></span> 21 21 <?php } else { ?> -
mailify/tags/1.4.7/views/sarbacane-lists-sync.php
r1629810 r1681124 13 13 </p> 14 14 <p class="sarbacane_desktop_config_label"> 15 <input type="checkbox" name="sarbacane_users_list" id="sarbacane_users_list" value="true" <?php if ( $sarbacane_users_list ) { echo 'checked="checked"' ; } ?>/>15 <input type="checkbox" name="sarbacane_users_list" id="sarbacane_users_list" value="true"<?php if ( $sarbacane_users_list ) { ?> checked="checked"<?php } ?>/> 16 16 <label for="sarbacane_users_list"><?php _e( 'Synchronize a \'\'WordPress Users\'\' list', 'mailify' ) ?></label> 17 17 <br /> … … 19 19 </p> 20 20 <p class="sarbacane_desktop_config_label"> 21 <input type="checkbox" name="sarbacane_news_list" onclick="sarbacaneNewsListChangePopup()" id="sarbacane_news_list" value="true" <?php if ( $sarbacane_news_list ) { echo 'checked="checked"'; } ?>/>21 <input type="checkbox" name="sarbacane_news_list" onclick="sarbacaneNewsListChangePopup()" id="sarbacane_news_list" value="true" <?php if ( $sarbacane_news_list ) { ?> checked="checked"<?php } ?>/> 22 22 <label for="sarbacane_news_list"><?php _e( 'Automatically synchronize your subscriber list', 'mailify' ) ?></label> 23 23 <br /> … … 31 31 </p> 32 32 <p class="sarbacane_desktop_config_label"> 33 <input type="checkbox" name="sarbacane_theme_sync" id="sarbacane_theme_sync" value="true" <?php if ( $sarbacane_theme_sync ) { echo 'checked="checked"'; } ?>/>33 <input type="checkbox" name="sarbacane_theme_sync" id="sarbacane_theme_sync" value="true"<?php if ( $sarbacane_theme_sync ) { ?> checked="checked"<?php } ?>/> 34 34 <label for="sarbacane_theme_sync"><?php _e( 'Synchronize your WordPress theme', 'mailify' ) ?></label> 35 35 <br /> … … 37 37 </p> 38 38 <p class="sarbacane_desktop_config_label"> 39 <input type="checkbox" name="sarbacane_blog_content" id="sarbacane_blog_content" value="true" <?php if ( $sarbacane_blog_content ) { echo 'checked="checked"'; } ?>/>39 <input type="checkbox" name="sarbacane_blog_content" id="sarbacane_blog_content" value="true"<?php if ( $sarbacane_blog_content ) { ?> checked="checked"<?php } ?>/> 40 40 <label for="sarbacane_blog_content"><?php _e( 'Synchronize blog content', 'mailify' ) ?></label> 41 41 <br /> … … 43 43 </p> 44 44 <p class="sarbacane_desktop_config_label" style="display:none;"> 45 <input type="checkbox" name="sarbacane_media_content" id="sarbacane_media_content" value="true" <?php if ( $sarbacane_media_content ) { echo 'checked="checked"'; } ?>/>45 <input type="checkbox" name="sarbacane_media_content" id="sarbacane_media_content" value="true"<?php if ( $sarbacane_media_content ) { ?> checked="checked"<?php } ?>/> 46 46 <label for="sarbacane_media_content"><?php _e( 'Synchronize media library', 'mailify' ) ?></label> 47 47 <br /> … … 49 49 </p> 50 50 <p class="sarbacane_desktop_config_label"> 51 <input type="checkbox" name="sarbacane_rss_data" id="sarbacane_rss_data" value="true" <?php if ( $sarbacane_rss_data ) { echo 'checked="checked"'; } ?>/>51 <input type="checkbox" name="sarbacane_rss_data" id="sarbacane_rss_data" value="true"<?php if ( $sarbacane_rss_data ) { ?> checked="checked"<?php } ?>/> 52 52 <label for="sarbacane_rss_data"><?php _e( 'Synchronize RSS data', 'mailify' ) ?></label> 53 53 <br /> -
mailify/tags/1.4.7/views/sarbacane-widget-adminpanel.php
r1677274 r1681124 50 50 <label class="sarbacane_desktop_field_number"><?php echo __( 'Field', 'mailify' ) . ' ' . ( $i + 1 ) ?></label> 51 51 <ul class="sarbacane_widget_menu"> 52 <li class="sarbacane_desktop_menu_item sarbacane_desktop_trash <?php if ( $isEmail ) { echo "sarbacane_desktop_menu_item_disabled_email";} ?>"<?php if ( !$isEmail ) { ?> onclick="sarbacaneDeleteField( <?php echo $i ?> )" <?php } ?>></li>52 <li class="sarbacane_desktop_menu_item sarbacane_desktop_trash<?php if ( $isEmail ) { ?> sarbacane_desktop_menu_item_disabled_email<?php } ?>"<?php if ( !$isEmail ) { ?> onclick="sarbacaneDeleteField( <?php echo $i ?> )" <?php } ?>></li> 53 53 <li class="sarbacane_desktop_menu_item sarbacane_desktop_down" onclick="sarbacaneMoveDown( <?php echo $i ?> )"></li> 54 54 <li class="sarbacane_desktop_menu_item sarbacane_desktop_up" onclick="sarbacaneMoveUp( <?php echo $i ?> )"></li> … … 67 67 <br /> 68 68 <label class="sarbacane_desktop_inline_configuration_label " for="sarbacane_desktop_mandatory_<?php echo $i ?>"><?php _e( 'Mandatory', 'mailify' ) ?> : </label> 69 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_true_<?php echo $i ?>" value="true" <?php if ( $field->mandatory ) { echo ' checked="checked" '; } ?> <?php if ( $isEmail ) { echo 'disabled="disabled"';} ?> onclick="sarbacaneDisplayPreview()"/>69 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_true_<?php echo $i ?>" value="true"<?php if ( $field->mandatory ) { ?> checked="checked"<?php } ?><?php if ( $isEmail ) { ?> disabled="disabled"<?php } ?> onclick="sarbacaneDisplayPreview()"/> 70 70 <label class="sarbacane_desktop_yes_no_label" for="sarbacane_desktop_mandatory_true_<?php echo $i ?>"><?php _e( 'Yes', 'mailify' ) ?></label> 71 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_false_<?php echo $i ?>" value="false" <?php if ( !$field->mandatory ) { echo ' checked="checked" '; } ?> <?php if ( $isEmail ) { echo 'disabled="disabled"';} ?> onclick="sarbacaneDisplayPreview()"/>71 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_false_<?php echo $i ?>" value="false"<?php if ( !$field->mandatory ) { ?> checked="checked"<?php } ?><?php if ( $isEmail ) { ?> disabled="disabled"<?php } ?> onclick="sarbacaneDisplayPreview()"/> 72 72 <label class="sarbacane_desktop_yes_no_label" for="sarbacane_desktop_mandatory_false_<?php echo $i ?>"><?php _e( 'No', 'mailify' ) ?></label> 73 73 </p> … … 116 116 <div id="sarbacane_widget_preview"> 117 117 <p class="sarbacane_widget_configuration_title"><?php _e( 'Preview', 'mailify' ) ?></p> 118 <div id="sarbacane_preview">< ?php _e( 'Fields marked with * are mandatory', 'mailify' ) ?></div>118 <div id="sarbacane_preview"></div> 119 119 </div> 120 120 <div id="sarbacane_desktop_vertical_splitter"></div> -
mailify/tags/1.4.7/views/sarbacane-widget.php
r1677274 r1681124 22 22 ?> 23 23 <p> 24 <label><?php echo $label ?> <?php if ( $field->mandatory ) { echo '*';} ?></label>24 <label><?php echo $label ?><?php if ( $field->mandatory ) { ?> *<?php } ?></label> 25 25 <br /> 26 <input type="<?php echo $field_type ?>" id="<?php echo $id ?>" name="<?php echo $name ?>" placeholder="<?php esc_attr_e( $field->placeholder ) ?>" <?php if ( $field->mandatory ) { echo 'required class="required"'; } ?>/>26 <input type="<?php echo $field_type ?>" id="<?php echo $id ?>" name="<?php echo $name ?>" placeholder="<?php esc_attr_e( $field->placeholder ) ?>"<?php if ( $field->mandatory ) { ?> required class="required"<?php } ?>/> 27 27 </p> 28 28 <?php } ?> 29 29 <p><?php esc_html_e( $registration_mandatory_fields ) ?></p> 30 30 <?php wp_nonce_field( 'newsletter_registration', 'sarbacane_form_token' ) ?> 31 <input type="button" value="<?php esc_attr_e( $registration_button ) ?>" onclick="sarbacaneSubmitWidget( '<?php echo $list_type . $rand ?>' )" /> 31 <input type="hidden" name="sarbacane_form_value" class="sarbacane_form_value" value=""/> 32 <input type="button" value="<?php esc_attr_e( $registration_button ) ?>" onclick="sarbacaneSubmitWidget( '<?php echo $list_type . $rand ?>' )"/> 32 33 </form> 33 34 </aside> -
mailify/trunk/class.sarbacane-about.php
r1677274 r1681124 14 14 return; 15 15 } 16 wp_enqueue_style ( "sarbacane_global.css", plugins_url ( "css/sarbacane_global.css", __FILE__ ), array(), '1.4.6' );17 wp_enqueue_style ( "sarbacane_about.css", plugins_url ( "css/sarbacane_about.css", __FILE__ ), array(), '1.4.6' );18 require_once( "views/sarbacane-about.php");16 wp_enqueue_style ( 'sarbacane_global.css', plugins_url ( 'css/sarbacane_global.css', __FILE__ ), array(), '1.4.7' ); 17 wp_enqueue_style ( 'sarbacane_about.css', plugins_url ( 'css/sarbacane_about.css', __FILE__ ), array(), '1.4.7' ); 18 require_once( 'views/sarbacane-about.php' ); 19 19 } 20 20 -
mailify/trunk/class.sarbacane-content.php
r1576277 r1681124 5 5 private function get_rss_header() { 6 6 return '<?xml version="1.0" encoding="UTF-8"?> 7 <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" 8 xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> 7 <rss version="2.0" 8 xmlns:content="http://purl.org/rss/1.0/modules/content/" 9 xmlns:wfw="http://wellformedweb.org/CommentAPI/" 10 xmlns:dc="http://purl.org/dc/elements/1.1/" 11 xmlns:atom="http://www.w3.org/2005/Atom" 12 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 13 xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> 9 14 <channel> 10 15 <title>' . get_bloginfo_rss( 'name' ) . '</title> … … 14 19 15 20 private function get_rss_footer() { 16 return '</channel></rss>'; 21 return ' 22 </channel> 23 </rss>'; 17 24 } 18 25 … … 27 34 while ( $query->have_posts() ) { 28 35 $query->the_post(); 29 $items .= '<item> 36 if ( post_password_required() ) { 37 continue; 38 } 39 $items .= "\n\t\t" . '<item> 30 40 <title>' . get_the_title_rss() . '</title> 31 41 <link>' . esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ) . '</link> 32 42 <id>' . get_the_ID() . '</id> 33 43 <pubDate>' . mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ) . '</pubDate> 34 <dc:creator><![CDATA[' . get_the_author() . ']]></dc:creator> 35 '. get_the_category_rss( 'rss2' );44 <dc:creator><![CDATA[' . get_the_author() . ']]></dc:creator>' . 45 "\n\t" . get_the_category_rss( 'rss2' ); 36 46 if ( $option === 'posts' ) { 37 $items .= '<description><![CDATA[' . apply_filters( 'the_excerpt_rss', get_the_excerpt() ) . ']]></description>';47 $items .= "\t\t\t" . '<description><![CDATA[' . apply_filters( 'the_excerpt_rss', get_the_excerpt() ) . ']]></description>' . "\n"; 38 48 } 39 $content = get_the_content_feed( 'rss2' ); 40 $items .= '<content:encoded><![CDATA[' . $content . ']]></content:encoded>'; 41 $items .= '<slash:comments>' . get_comments_number() . '</slash:comments>'; 49 $items .= "\t\t\t" . '<content:encoded><![CDATA[' . get_the_content_feed( 'rss2' ) . ']]></content:encoded> 50 <slash:comments>' . get_comments_number() . '</slash:comments>'; 42 51 $media = get_attached_media( 'image' ); 43 52 if ( is_array( $media ) && count( $media ) > 0 ) { 44 53 $all_medias_key = array_keys( $media ); 45 $items .= '<enclosure url="' . $media [ $all_medias_key [0] ]->guid . '" type="' . $media [ $all_medias_key [0] ]->post_mime_type . '" />';54 $items .= "\n\t\t\t" . '<enclosure url="' . $media [ $all_medias_key [0] ]->guid . '" type="' . $media [ $all_medias_key [0] ]->post_mime_type . '" />'; 46 55 } 47 $items .= rss_enclosure(); 48 do_action( 'rss2_item' ); 49 $items .= '</item>'; 56 $items .= "\n\t\t" . '</item>'; 50 57 } 51 58 return $items; … … 57 64 echo $this->get_rss_header() . $this->get_rss_content( 'post', $post_id ) . $this->get_rss_footer(); 58 65 } else { 59 header( "HTTP/1.1 404 Bad item");60 header( "Content-Type: application/json ; charset=utf-8");61 die ( 'FAILED_ID' );66 header( 'HTTP/1.1 404 Bad item' ); 67 header( 'Content-Type: application/json; charset=utf-8' ); 68 die( 'FAILED_ID' ); 62 69 } 63 70 } -
mailify/trunk/class.sarbacane-lists-sync.php
r1677274 r1681124 31 31 } 32 32 global $wpdb; 33 $table_name = $wpdb->prefix . 'sd_updates'; 34 $wpdb->query( "TRUNCATE TABLE `$table_name`" ); 33 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 35 34 } 36 35 37 if ( isset( $_POST['sarbacane_news_list'] ) && "true" == $_POST['sarbacane_news_list']) {36 if ( isset( $_POST['sarbacane_news_list'] ) && $_POST['sarbacane_news_list'] == 'true' ) { 38 37 update_option( 'sarbacane_news_list', true, false ); 39 38 $fields = get_option( 'sarbacane_news_fields' ); 40 39 if ( ! is_array( $fields ) || count( $fields ) == 0 ) { 41 $default_email = new stdClass ();40 $default_email = new stdClass(); 42 41 $default_email->label = 'email'; 43 42 $default_email->placeholder = ''; … … 53 52 } 54 53 55 if ( isset( $_POST['sarbacane_theme_sync'] ) && "true" == $_POST['sarbacane_theme_sync']) {54 if ( isset( $_POST['sarbacane_theme_sync'] ) && $_POST['sarbacane_theme_sync'] == 'true' ) { 56 55 update_option( 'sarbacane_theme_sync', true, false ); 57 56 } else { … … 59 58 } 60 59 61 if ( isset( $_POST['sarbacane_blog_content'] ) && "true" == $_POST['sarbacane_blog_content']) {60 if ( isset( $_POST['sarbacane_blog_content'] ) && $_POST['sarbacane_blog_content'] == 'true' ) { 62 61 update_option( 'sarbacane_blog_content', true, false ); 63 62 } else { … … 65 64 } 66 65 67 if ( isset( $_POST['sarbacane_media_content'] ) && "true" == $_POST['sarbacane_media_content']) {66 if ( isset( $_POST['sarbacane_media_content'] ) && $_POST['sarbacane_media_content'] == 'true' ) { 68 67 update_option( 'sarbacane_media_content', true, false ); 69 68 } else { … … 71 70 } 72 71 73 if ( isset( $_POST['sarbacane_rss_data'] ) && "true" == $_POST['sarbacane_rss_data']) {72 if ( isset( $_POST['sarbacane_rss_data'] ) && $_POST['sarbacane_rss_data'] == 'true' ) { 74 73 update_option( 'sarbacane_rss_data', true, false ); 75 74 } else { … … 77 76 } 78 77 } 79 wp_enqueue_style ( "sarbacane_global.css", plugins_url ( "css/sarbacane_global.css" , __FILE__ ), array(), '1.4.6' );80 wp_enqueue_style ( "sarbacane_lists_config.css", plugins_url ( "css/sarbacane_lists_config.css", __FILE__ ), array(), '1.4.6' );81 wp_enqueue_script( "sarbacane-lists-sync.js", plugins_url( "js/sarbacane-lists-sync.js", __FILE__ ), array( 'jquery' ), '1.4.6' );78 wp_enqueue_style ( 'sarbacane_global.css', plugins_url ( 'css/sarbacane_global.css', __FILE__ ), array(), '1.4.7' ); 79 wp_enqueue_style ( 'sarbacane_lists_config.css', plugins_url ( 'css/sarbacane_lists_config.css', __FILE__ ), array(), '1.4.7' ); 80 wp_enqueue_script( 'sarbacane-lists-sync.js', plugins_url( 'js/sarbacane-lists-sync.js', __FILE__ ), array( 'jquery' ), '1.4.7' ); 82 81 $sarbacane_news_list = get_option( 'sarbacane_news_list', false ); 83 82 $sarbacane_users_list = get_option( 'sarbacane_users_list', false ); … … 88 87 $sarbacane_rss_data = get_option( 'sarbacane_rss_data', false ); 89 88 90 require_once( "views/sarbacane-lists-sync.php");89 require_once( 'views/sarbacane-lists-sync.php' ); 91 90 } 92 91 -
mailify/trunk/class.sarbacane-medias.php
r1576277 r1681124 5 5 public function get_medias() { 6 6 $wp_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit' ) ); 7 $ return_string = '{"medias":[';7 $medias = array(); 8 8 if ( $wp_query->have_posts() ) { 9 9 while ( $wp_query->have_posts() ) { 10 10 $wp_query->the_post(); 11 11 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail' ); 12 $return_string .= ' 13 {"name":"' . get_the_title() . '", 14 "url":"' . get_the_guid() . '", 15 "mime_type":"' . get_post_mime_type() . '", 16 "thumbnail":"' . $thumbnail[0] . '"},'; 12 $medias[] = ' 13 { 14 "name":"' . get_the_title() . '", 15 "url":"' . get_the_guid() . '", 16 "mime_type":"' . get_post_mime_type() . '", 17 "thumbnail":"' . $thumbnail[0] . '" 18 }'; 17 19 } 18 20 } 19 $return_string = rtrim( $return_string, ',' ); 20 $return_string .= ' 21 ] 22 }'; 23 echo $return_string; 21 $medias = implode( ',', $medias ); 22 echo '{"medias":[' . $medias . "\n\t" . ']' . "\n" . '}'; 24 23 } 25 24 -
mailify/trunk/class.sarbacane-newsletterwidget.php
r1677274 r1681124 24 24 public function sarbacane_save_widget() { 25 25 $valid = false; 26 if ( isset ( $_POST ['email'] ) ) { 27 $user_registring = new stdClass (); 28 $user_registring->email = sanitize_email( $_POST ['email'] ); 29 if ( is_email( $user_registring->email ) ) { 30 $fields = get_option( 'sarbacane_news_fields', array() ); 31 $columns = array(); 32 foreach ( $fields as $field ) { 33 if ( strtolower( $field->label ) == 'email' ) { 34 continue; 35 } 36 $field_label = $field->label; 37 $field_label_html = str_replace( ' ', '_', $field->label ); 38 $field_label = strtolower( $field_label ); 39 if ( isset ( $_POST [ $field_label_html ] ) ) { 40 $fieldValue = stripslashes( sanitize_text_field( $_POST [ $field_label_html ] ) ); 41 } else { 42 $fieldValue = ''; 43 } 44 $user_registring->$field_label = $fieldValue; 45 $columns [ $field_label ] = $fieldValue; 26 if ( isset ( $_POST ['sarbacane_form_value'] ) && isset ( $_POST ['email'] ) ) { 27 $sarbacane_form_value = sanitize_text_field( $_POST ['sarbacane_form_value'] ); 28 if ($sarbacane_form_value == 'sarbacane_desktop_widget' ) { 29 $user_registering = new stdClass(); 30 $user_registering->email = sanitize_email( $_POST ['email'] ); 31 if ( is_email( $user_registering->email ) ) { 32 $fields = get_option( 'sarbacane_news_fields', array() ); 33 $columns = array(); 34 foreach ( $fields as $field ) { 35 if ( strtolower( $field->label ) == 'email' ) { 36 continue; 37 } 38 $field_label = $field->label; 39 $field_label_html = str_replace( ' ', '_', $field->label ); 40 $field_label = strtolower( $field_label ); 41 if ( isset ( $_POST [ $field_label_html ] ) ) { 42 $fieldValue = stripslashes( sanitize_text_field( $_POST [ $field_label_html ] ) ); 43 } else { 44 $fieldValue = ''; 45 } 46 $user_registering->$field_label = $fieldValue; 47 $columns [ $field_label ] = $fieldValue; 48 } 49 $user_registering->registration_date = gmdate( 'Y-m-d H:i:s' ); 50 $version = get_option( 'sarbacane_version' ); 51 $result = true; 52 if ( $version !== false ) { 53 global $wpdb; 54 $sql = "INSERT INTO `{$wpdb->prefix}sd_subscribers` (`email`, `columns`, `registration_date`) VALUES (%s, %s, %s);"; 55 $result = $wpdb->query( $wpdb->prepare( $sql, $user_registering->email, json_encode( $columns ), $user_registering->registration_date ) ); 56 } 57 if ( $version === false || $result === false ) { 58 $users_registered = get_option( 'sarbacane_newsletter_list', array() ); 59 $users_registered[] = $user_registering; 60 update_option( 'sarbacane_newsletter_list', $users_registered, false ); 61 } 62 $valid = true; 46 63 } 47 $user_registring->registration_date = gmdate( 'Y-m-d H:i:s' );48 $version = get_option( 'sarbacane_version' );49 $result = true;50 if ( $version !== false ) {51 global $wpdb;52 $table_name = $wpdb->prefix . 'sd_subscribers';53 $sql = "INSERT INTO `$table_name` (`email`, `columns`, `registration_date`) VALUES (%s, %s, %s);";54 $result = $wpdb->query( $wpdb->prepare( $sql, $user_registring->email, json_encode( $columns ), $user_registring->registration_date ) );55 }56 if ( $version === false || $result === false ) {57 $users_registred = get_option( 'sarbacane_newsletter_list', array() );58 $users_registred[] = $user_registring;59 update_option( 'sarbacane_newsletter_list', $users_registred, false );60 }61 $valid = true;62 64 } 63 65 } … … 84 86 $fields = get_option( 'sarbacane_news_fields', array() ); 85 87 if ( ! is_array( $fields ) || count( $fields ) == 0 ) { 86 $default_email = new stdClass ();88 $default_email = new stdClass(); 87 89 $default_email->label = 'email'; 88 90 $default_email->placeholder = ''; … … 95 97 $list_type = 'N'; 96 98 $rand = mt_rand( 0, 1000000 ); 97 wp_enqueue_script( "sarbacane-widget.js", plugins_url( "js/sarbacane-widget.js", __FILE__ ), array( 'jquery' ), '1.4.6' );98 wp_enqueue_style( "sarbacane_widget.css", plugins_url( "css/sarbacane_widget.css", __FILE__ ), array(), '1.4.6' );99 include( "views/sarbacane-widget.php");99 wp_enqueue_script( 'sarbacane-widget.js', plugins_url( 'js/sarbacane-widget.js', __FILE__ ), array( 'jquery' ), '1.4.7' ); 100 wp_enqueue_style( 'sarbacane_widget.css', plugins_url( 'css/sarbacane_widget.css', __FILE__ ), array(), '1.4.7' ); 101 include( 'views/sarbacane-widget.php' ); 100 102 } 101 103 … … 119 121 return; 120 122 } 121 wp_enqueue_style( "sarbacane_global.css", plugins_url( "css/sarbacane_global.css", __FILE__ ), array( 'wp-admin' ), '1.4.6' );122 wp_enqueue_style( "sarbacane_widget_admin_panel.css", plugins_url( "css/sarbacane_widget_admin_panel.css", __FILE__ ), array( 'wp-admin' ), '1.4.6' );123 wp_enqueue_script( "sarbacane-widget-adminpanel.js", plugins_url( "js/sarbacane-widget-adminpanel.js", __FILE__ ), array( 'jquery', 'underscore' ), '1.4.6' );123 wp_enqueue_style( 'sarbacane_global.css', plugins_url( 'css/sarbacane_global.css', __FILE__ ), array( 'wp-admin' ), '1.4.7' ); 124 wp_enqueue_style( 'sarbacane_widget_admin_panel.css', plugins_url( 'css/sarbacane_widget_admin_panel.css', __FILE__ ), array( 'wp-admin' ), '1.4.7' ); 125 wp_enqueue_script( 'sarbacane-widget-adminpanel.js', plugins_url( 'js/sarbacane-widget-adminpanel.js', __FILE__ ), array( 'jquery', 'underscore' ), '1.4.7' ); 124 126 $nonce_ok = false; 125 127 if ( isset( $_POST ['sarbacane_token'] ) ) { … … 148 150 $fields = get_option( 'sarbacane_news_fields', array() ); 149 151 if ( ! is_array( $fields ) || count( $fields ) == 0 ) { 150 $default_email = new stdClass ();152 $default_email = new stdClass(); 151 153 $default_email->label = 'email'; 152 154 $default_email->placeholder = ''; … … 156 158 } 157 159 158 require_once 'views/sarbacane-widget-adminpanel.php';160 require_once( 'views/sarbacane-widget-adminpanel.php' ); 159 161 } 160 162 … … 173 175 if ( isset ( $field_number ) && $field_number > 0 ) { 174 176 for ( $i = 0; $i < $field_number; $i ++ ) { 175 $field_config = new stdClass ();177 $field_config = new stdClass(); 176 178 if ( isset ( $sanitized_post [ 'sarbacane_label_' . $i ] ) && '' != $sanitized_post [ 'sarbacane_label_' . $i ] ) { 177 179 $field_config->label = $sanitized_post [ 'sarbacane_label_' . $i ]; -
mailify/trunk/class.sarbacane-settings.php
r1576277 r1681124 10 10 $media_content = get_option( 'sarbacane_media_content', false ); 11 11 $rss_data = get_option( 'sarbacane_rss_data', false ); 12 $rss_url = get_feed_link( "rss2");12 $rss_url = get_feed_link( 'rss2' ); 13 13 $posts_per_rss = get_option( 'posts_per_rss', 10 ); 14 14 //forcing boolean to display as int to get 0 when false. Impossible otherwise -
mailify/trunk/class.sarbacane.php
r1677274 r1681124 8 8 /** 9 9 * Method called on plugin activation. 10 * Initiate some options, creates the sd updates table11 10 */ 12 11 public static function activation() { 13 update_option( 'sarbacane_version', '1.4. 6', false );12 update_option( 'sarbacane_version', '1.4.7', false ); 14 13 update_option( 'sarbacane_sd_token', '', false ); 15 14 update_option( 'sarbacane_sd_id_list', array(), false ); … … 17 16 18 17 global $wpdb; 19 $table_name = $wpdb->prefix . 'sd_updates'; 20 $sql = "DROP TABLE IF EXISTS `$table_name`"; 18 $sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_updates`"; 21 19 $wpdb->query( $sql ); 22 20 $charset_collate = $wpdb->get_charset_collate(); 23 $sql = "CREATE TABLE IF NOT EXISTS ` $table_name` (21 $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sd_updates` ( 24 22 `id` mediumint(9) NOT NULL AUTO_INCREMENT, 25 23 `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', … … 28 26 `action` text NOT NULL, 29 27 UNIQUE KEY `id` (`id`) 30 ) $charset_collate;";28 ) {$charset_collate};"; 31 29 $wpdb->query( $sql ); 32 $table_name = $wpdb->prefix . 'sd_subscribers'; 33 //$sql = "DROP TABLE IF EXISTS `$table_name`"; 30 //$sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_subscribers`"; 34 31 //$wpdb->query( $sql ); 35 $charset_collate = $wpdb->get_charset_collate(); 36 $sql = "CREATE TABLE IF NOT EXISTS `$table_name` ( 32 $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sd_subscribers` ( 37 33 `id` mediumint(9) NOT NULL AUTO_INCREMENT, 38 34 `email` varchar(255) DEFAULT NULL, … … 40 36 `registration_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 41 37 UNIQUE KEY `id` (`id`) 42 ) $charset_collate;";38 ) {$charset_collate};"; 43 39 $wpdb->query( $sql ); 44 40 } … … 46 42 /** 47 43 * Method called on plugin deactivation. 48 * Deletes all options created by the plugin and drops the sd_updates table49 44 */ 50 45 public static function deactivation() { … … 80 75 81 76 global $wpdb; 82 $table_name = $wpdb->prefix . 'sd_updates'; 83 $sql = "DROP TABLE IF EXISTS `$table_name`"; 77 $sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_updates`"; 84 78 $wpdb->query( $sql ); 85 //$table_name = $wpdb->prefix . 'sd_subscribers'; 86 //$sql = "DROP TABLE IF EXISTS `$table_name`"; 79 //$sql = "DROP TABLE IF EXISTS `{$wpdb->prefix}sd_subscribers`"; 87 80 //$wpdb->query( $sql ); 88 81 } … … 90 83 public function update_data_1_4_5() { 91 84 if ( get_option( 'sarbacane_version' ) === false ) { 92 update_option( 'sarbacane_version', '1.4. 6', false );85 update_option( 'sarbacane_version', '1.4.7', false ); 93 86 try { 94 87 global $wpdb; 95 $table_name = $wpdb->prefix . 'sd_subscribers';96 88 $charset_collate = $wpdb->get_charset_collate(); 97 $sql = "CREATE TABLE IF NOT EXISTS ` $table_name` (89 $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sd_subscribers` ( 98 90 `id` mediumint(9) NOT NULL AUTO_INCREMENT, 99 91 `email` varchar(255) DEFAULT NULL, … … 101 93 `registration_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 102 94 UNIQUE KEY `id` (`id`) 103 ) $charset_collate;";95 ) {$charset_collate};"; 104 96 $result = $wpdb->query( $sql ); 105 97 if ( $result !== false ) { … … 109 101 $insert_request = array(); 110 102 $insert_data = array(); 111 $sql = "SELECT COUNT(*) FROM ` $table_name`";103 $sql = "SELECT COUNT(*) FROM `{$wpdb->prefix}sd_subscribers`"; 112 104 $count = $wpdb->get_var( $sql ); 113 105 if ( $count == 0) { … … 129 121 $insert_data[] = $registration_date; 130 122 if ( $key % 1000 == 0 || $key + 1 == $nb_subscribers ) { 131 $sql = "INSERT INTO ` $table_name` (`email`, `columns`, `registration_date`) VALUES " . implode( ',', $insert_request ) . ";";123 $sql = "INSERT INTO `{$wpdb->prefix}sd_subscribers` (`email`, `columns`, `registration_date`) VALUES " . implode( ',', $insert_request ) . ";"; 132 124 $wpdb->query( $wpdb->prepare( $sql, $insert_data ) ); 133 125 $insert_request = array(); … … 146 138 } 147 139 update_option( 'sarbacane_sd_id_list', array(), false ); 148 $table_name = $wpdb->prefix . 'sd_updates'; 149 $wpdb->query( "TRUNCATE TABLE `$table_name`" ); 140 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 150 141 } else { 151 142 delete_option( 'sarbacane_version' ); … … 202 193 } 203 194 if ( $sd_list_id != '' ) { 204 if ( "U" == $sd_list_id) {195 if ( $sd_list_id == 'U' ) { 205 196 $this->get_users_list( $sd_id ); 206 } else if ( "N" == $sd_list_id) {197 } else if ( $sd_list_id == 'N' ) { 207 198 $this->get_newsletter_list( $sd_id ); 208 199 } … … 213 204 214 205 private function generate_available_lists( $sd_id, $user_sync, $newsletter_sync ) { 215 echo 'list_id;name;reset;is_updated;type;version' . "\r\n"; 216 206 echo 'list_id;name;reset;is_updated;type;version' . "\n"; 217 207 $last_call_date_N = get_option( 'sarbacane_news_call_' . $sd_id ); 218 208 $last_call_date_C = get_option( 'sarbacane_user_call_' . $sd_id ); … … 240 230 } 241 231 if ( $user_sync ) { 242 echo 'U;' . get_bloginfo( 'name' ) . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\ r\n";232 echo 'U;' . get_bloginfo( 'name' ) . ';' . $sd_list_users_reset . ';' . $user_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 243 233 } 244 234 if ( $newsletter_sync ) { 245 echo 'N;' . get_bloginfo( 'name' ) . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\ r\n";235 echo 'N;' . get_bloginfo( 'name' ) . ';' . $sd_list_news_reset . ';' . $newsletter_updated . ';Wordpress;' . get_bloginfo( 'version' ) . "\n"; 246 236 } 247 237 } … … 256 246 private function check_users_list( $last_call_date ) { 257 247 global $wpdb; 258 $wp_prefix = $wpdb->prefix; 259 $table_name = $wpdb->prefix . 'sd_updates'; 260 261 $new_users_since_last_call = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM `' . $wp_prefix . 'users` AS `wu` WHERE `wu`.`user_registered` >= %s', $last_call_date ) ); 262 $update_users_since_last_call = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM `' . $table_name . '` AS `wsu` WHERE `wsu`.`time` >= %s', $last_call_date ) ); 248 $sql = "SELECT COUNT(*) FROM `{$wpdb->prefix}users` AS `wu` WHERE `wu`.`user_registered` >= %s"; 249 $new_users_since_last_call = $wpdb->get_var( $wpdb->prepare( $sql, $last_call_date ) ); 250 $sql = "SELECT COUNT(*) FROM `{$wpdb->prefix}sd_updates` AS `wsu` WHERE `wsu`.`time` >= %s"; 251 $update_users_since_last_call = $wpdb->get_var( $wpdb->prepare( $sql, $last_call_date ) ); 263 252 return $new_users_since_last_call > 0 || $update_users_since_last_call > 0; 264 253 } … … 273 262 private function check_newsletter_list( $last_call_date = '' ) { 274 263 global $wpdb; 275 $table_name = $wpdb->prefix . 'sd_subscribers'; 276 $sql_subscribers = 'SELECT COUNT(*) FROM `' . $table_name . '`'; 264 $sql_subscribers = "SELECT COUNT(*) FROM `{$wpdb->prefix}sd_subscribers`"; 277 265 if ( $last_call_date != '' ) { 278 $sql_subscribers .= ' WHERE `registration_date` > %s';266 $sql_subscribers .= " WHERE `registration_date` > %s"; 279 267 $count = $wpdb->get_var( $wpdb->prepare( $sql_subscribers, $last_call_date ) ); 280 268 } else { … … 335 323 if ( "N" == $list_type ) { 336 324 $fields = get_option( 'sarbacane_news_fields', array() ); 337 $csv_string = "email;";325 $csv_string = 'email;'; 338 326 foreach ( $fields as $field ) { 339 327 if ( strtolower( $field->label ) != 'email' ) { … … 341 329 } 342 330 } 343 $csv_string .= "action\r\n";331 $csv_string .= 'action' . "\n"; 344 332 foreach ( $new_or_updated_users as $one_user_updated ) { 345 333 if ( isset( $one_user_updated->email ) ) { … … 358 346 } 359 347 } 360 $csv_string .= 'S' . "\ r\n";361 } 362 } else { 363 $csv_string = 'email;lastname;firstname;login;role;post_count;action' . "\ r\n";348 $csv_string .= 'S' . "\n"; 349 } 350 } else { 351 $csv_string = 'email;lastname;firstname;login;role;post_count;action' . "\n"; 364 352 if ( count( $new_or_updated_users ) > 0 ) { 365 353 foreach ( $new_or_updated_users as $one_user_updated ) { … … 376 364 $csv_string .= $this->d_quote( $one_user_updated->email ) . ';' . $this->d_quote( $one_user_updated->lastname ) . ';'; 377 365 $csv_string .= $this->d_quote( $one_user_updated->firstname ) . ';' . $this->d_quote( $one_user_updated->user_login ) . ';'; 378 $csv_string .= $this->d_quote( $role ) . ';' . $this->d_quote( $one_user_updated->user_posts ) . ';S' . "\ r\n";366 $csv_string .= $this->d_quote( $role ) . ';' . $this->d_quote( $one_user_updated->user_posts ) . ';S' . "\n"; 379 367 } 380 368 } 381 369 if ( count( $deleted_users ) > 0 ) { 382 370 foreach ( $deleted_users as $deleted_user ) { 383 $csv_string .= $deleted_user->user_email . ';;;;;;U' . "\ r\n";371 $csv_string .= $deleted_user->user_email . ';;;;;;U' . "\n"; 384 372 } 385 373 } … … 403 391 private function sarbacanedesktop_get_all_users( $last_call_date ) { 404 392 global $wpdb; 405 $wp_prefix = $wpdb->prefix; 406 $table_name = $wpdb->prefix . 'sd_updates'; 407 $sql = 'SELECT `wu`.`id` AS `user_id`, `wu`.`user_login` AS `user_login`, `wu`.`user_email` AS `email`, `wmf`.`meta_value` AS `firstname`, `wml`.`meta_value` AS `lastname`, `wum`.`meta_value` AS `user_role` 408 FROM `' . $wp_prefix . 'users` AS `wu` LEFT JOIN `' . $wp_prefix . 'usermeta` AS `wmf` ON `wu`.`id` = `wmf`.`user_id` AND `wmf`.`meta_key` = "first_name" 409 LEFT JOIN `' . $wp_prefix . 'usermeta` AS `wml` ON `wu`.`id` = `wml`.`user_id` AND `wml`.`meta_key` = "last_name" 410 LEFT JOIN `' . $wp_prefix . 'usermeta` AS `wum` ON `wu`.`id` = `wum`.`user_id` AND `wum`.`meta_key` = "' . $wp_prefix . 'capabilities"'; 393 $sql = "SELECT `wu`.`id` AS `user_id`, `wu`.`user_login` AS `user_login`, `wu`.`user_email` AS `email`, `wmf`.`meta_value` AS `firstname`, `wml`.`meta_value` AS `lastname`, `wum`.`meta_value` AS `user_role` 394 FROM `{$wpdb->prefix}users` AS `wu` LEFT JOIN `{$wpdb->prefix}usermeta` AS `wmf` ON `wu`.`id` = `wmf`.`user_id` AND `wmf`.`meta_key` = 'first_name' 395 LEFT JOIN `{$wpdb->prefix}usermeta` AS `wml` ON `wu`.`id` = `wml`.`user_id` AND `wml`.`meta_key` = 'last_name' 396 LEFT JOIN `{$wpdb->prefix}usermeta` AS `wum` ON `wu`.`id` = `wum`.`user_id` AND `wum`.`meta_key` = '{$wpdb->prefix}capabilities'"; 411 397 if ( $last_call_date == '' ) { 412 398 $all_users = $wpdb->get_results( $sql ); 413 399 } else { 414 $sql = $sql . ' LEFT JOIN `' . $table_name . '` AS `wsu` ON `wsu`.`user_id` = `wu`.`id` AND `wsu`.`action` = "S" WHERE `wu`.`user_registered` >= %s OR `wsu`.`time` >= %s';400 $sql = $sql . " LEFT JOIN `{$wpdb->prefix}sd_updates` AS `wsu` ON `wsu`.`user_id` = `wu`.`id` AND `wsu`.`action` = 'S' WHERE `wu`.`user_registered` >= %s OR `wsu`.`time` >= %s"; 415 401 $all_users = $wpdb->get_results( $wpdb->prepare( $sql, $last_call_date, $last_call_date ) ); 416 402 } … … 425 411 private function sarbacanedesktop_get_all_deleted_users( $last_call_date ) { 426 412 global $wpdb; 427 $ table_name = $wpdb->prefix . 'sd_updates';428 $deleted_users = $wpdb->get_results( $wpdb->prepare( 'SELECT `user_email` FROM `' . $table_name . '` AS `wsu` WHERE `wsu`.`action` = "U" AND `wsu`.`time` >= %s', $last_call_date ) );413 $sql = "SELECT `user_email` FROM `{$wpdb->prefix}sd_updates` AS `wsu` WHERE `wsu`.`action` = 'U' AND `wsu`.`time` >= %s"; 414 $deleted_users = $wpdb->get_results( $wpdb->prepare( $sql, $last_call_date ) ); 429 415 return $deleted_users; 430 416 } … … 437 423 private function get_subscribers( $last_call_date ) { 438 424 global $wpdb; 439 $table_name = $wpdb->prefix . 'sd_subscribers';440 425 if ( $last_call_date != '' ) { 441 $sql _subscribers = 'SELECT * FROM `' . $table_name . '` WHERE `registration_date` > %s ORDER BY `registration_date` ASC';442 $all_subscribers = $wpdb->get_results( $wpdb->prepare( $sql _subscribers, $last_call_date ) );443 } else { 444 $sql _subscribers = 'SELECT * FROM `' . $table_name . '` ORDER BY `registration_date` ASC';445 $all_subscribers = $wpdb->get_results( $sql _subscribers);426 $sql = "SELECT * FROM `{$wpdb->prefix}sd_subscribers` WHERE `registration_date` > %s ORDER BY `registration_date` ASC"; 427 $all_subscribers = $wpdb->get_results( $wpdb->prepare( $sql, $last_call_date ) ); 428 } else { 429 $sql = "SELECT * FROM `{$wpdb->prefix}sd_subscribers` ORDER BY `registration_date` ASC"; 430 $all_subscribers = $wpdb->get_results( $sql ); 446 431 } 447 432 $new_or_updated_users = array(); 448 433 foreach ( $all_subscribers as $one_subscriber ) { 449 434 if ( isset( $one_subscriber->email ) ) { 450 $values = new stdClass();435 $values = new stdClass(); 451 436 $values->email = $one_subscriber->email; 452 437 $columns = json_decode( $one_subscriber->columns ); … … 471 456 delete_option( 'sarbacane_news_call_' . $sd_id ); 472 457 473 $sd id_array= get_option( 'sarbacane_sd_id_list' );474 $index = array_search( $sd_id, $sd id_array);458 $sd_ids_saved = get_option( 'sarbacane_sd_id_list' ); 459 $index = array_search( $sd_id, $sd_ids_saved ); 475 460 if ( $index !== false ) { 476 unset ( $sdid_array[ $index ] );477 update_option( 'sarbacane_sd_id_list', $sd id_array, false );461 unset( $sd_ids_saved [ $index ] ); 462 update_option( 'sarbacane_sd_id_list', $sd_ids_saved, false ); 478 463 } 479 464 } … … 524 509 private function clear_update_history() { 525 510 global $wpdb; 526 $ table_name = $wpdb->prefix . 'sd_updates';527 $option_table = $wpdb->prefix . 'options';528 $sql = "DELETE FROM `$table_name` WHERE `time` <= (SELECT MIN(`option_value`) FROM `$option_table` WHERE `option_name` LIKE 'sarbacane_%_call_%')";511 $sql = "DELETE FROM `{$wpdb->prefix}sd_updates` WHERE `time` <= ( 512 SELECT MIN(`option_value`) FROM `{$wpdb->prefix}options` WHERE `option_name` LIKE 'sarbacane_%_call_%' 513 )"; 529 514 $wpdb->query( $sql ); 530 515 } … … 564 549 update_option( 'sarbacane_sd_id_list', array(), false ); 565 550 global $wpdb; 566 $table_name = $wpdb->prefix . 'sd_updates'; 567 $wpdb->query( "TRUNCATE TABLE `$table_name`" ); 551 $wpdb->query( "TRUNCATE TABLE `{$wpdb->prefix}sd_updates`" ); 568 552 $this->sarbacane_params_saved(); 569 553 } … … 574 558 } 575 559 $sd_list_news = get_option( 'sarbacane_news_list', false ); 576 $sdid_array = get_option( 'sarbacane_sd_id_list', array() ); 560 $is_connected = false; 561 if ( count( get_option( 'sarbacane_sd_id_list', array() ) ) > 0 ) { 562 $is_connected = true; 563 } 577 564 $is_failed = (int) get_option( 'sarbacane_failed', 0 ) < 1000000 ? false : true; 578 wp_enqueue_style ( "sarbacane_global.css", plugins_url ( "css/sarbacane_global.css", __FILE__ ), array(), '1.4.6' );579 wp_enqueue_style ( "sarbacane_admin_panel.css", plugins_url ( "css/sarbacane_admin_panel.css", __FILE__ ), array(), '1.4.6' );565 wp_enqueue_style ( 'sarbacane_global.css', plugins_url ( 'css/sarbacane_global.css', __FILE__ ), array(), '1.4.7' ); 566 wp_enqueue_style ( 'sarbacane_admin_panel.css', plugins_url ( 'css/sarbacane_admin_panel.css', __FILE__ ), array(), '1.4.7' ); 580 567 require_once( 'views/sarbacane-adminpanel.php' ); 581 568 } … … 612 599 return; 613 600 } 614 if ( isset ( $wp->query_vars ['sarbacane_form_token'] ) && '' != $wp->query_vars ['sarbacane_form_token']&& wp_verify_nonce( $wp->query_vars['sarbacane_form_token'], 'newsletter_registration' ) ) {601 if ( isset ( $wp->query_vars ['sarbacane_form_token'] ) && $wp->query_vars ['sarbacane_form_token'] != '' && wp_verify_nonce( $wp->query_vars['sarbacane_form_token'], 'newsletter_registration' ) ) { 615 602 $save_widget = true; 616 603 } 617 if ( isset ( $wp->query_vars ['sdid'] ) && '' != $wp->query_vars ['sdid']) {604 if ( isset ( $wp->query_vars ['sdid'] ) && $wp->query_vars ['sdid'] != '' ) { 618 605 $sd_id = sanitize_text_field( $wp->query_vars ['sdid'] ); 619 606 } 620 if ( isset ( $wp->query_vars ['sd_token'] ) && '' != $wp->query_vars ['sd_token']) {607 if ( isset ( $wp->query_vars ['sd_token'] ) && $wp->query_vars ['sd_token'] != '' ) { 621 608 $sd_token = sanitize_text_field( $wp->query_vars ['sd_token'] ); 622 609 } 623 610 $sd_list_id = ''; 624 if ( isset ( $wp->query_vars ['list'] ) && '' != $wp->query_vars ['list']) {611 if ( isset ( $wp->query_vars ['list'] ) && $wp->query_vars ['list'] != '' ) { 625 612 $sd_list_id = sanitize_text_field( $wp->query_vars ['list'] ); 626 613 } 627 614 $action = ''; 628 if ( isset ( $wp->query_vars ['action'] ) && '' != $wp->query_vars ['action']) {615 if ( isset ( $wp->query_vars ['action'] ) && $wp->query_vars ['action'] != '' ) { 629 616 $action = sanitize_text_field( $wp->query_vars ['action'] ); 630 617 } 631 if ( isset ( $wp->query_vars ['type'] ) && '' != $wp->query_vars ['type']) {618 if ( isset ( $wp->query_vars ['type'] ) && $wp->query_vars ['type'] != '' ) { 632 619 $type = sanitize_text_field( $wp->query_vars ['type'] ); 633 620 } 634 if ( isset ( $wp->query_vars ['id'] ) && '' != $wp->query_vars ['id']) {621 if ( isset ( $wp->query_vars ['id'] ) && $wp->query_vars ['id'] != '' ) { 635 622 $id = sanitize_text_field( $wp->query_vars ['id'] ); 636 623 } 637 624 $limit = - 1; 638 if ( isset ( $wp->query_vars ['limit'] ) && '' != $wp->query_vars ['limit']) {625 if ( isset ( $wp->query_vars ['limit'] ) && $wp->query_vars ['limit'] != '' ) { 639 626 $limit = $wp->query_vars ['limit']; 640 627 } 641 628 if ( isset( $save_widget ) ) { 642 header( "Content-Type: text/html; charset=utf-8");629 header( 'Content-Type: text/html; charset=utf-8' ); 643 630 $this->update_data_1_4_5(); 644 631 $widget = new SarbacaneNewsWidget(); … … 647 634 } 648 635 if ( ! isset ( $sd_id ) ) { 649 header( "HTTP/1.1 400 Bad request");650 header( "Content-type: application/json; charset=utf-8");651 die ( 'FAILED_SDID' );636 header( 'HTTP/1.1 400 Bad request' ); 637 header( 'Content-type: application/json; charset=utf-8' ); 638 die( 'FAILED_SDID' ); 652 639 } 653 640 if ( ! isset ( $sd_token ) ) { 654 header( "HTTP/1.1 400 Bad request");655 header( "Content-type: application/json; charset=utf-8");656 die ( 'FAILED_SDTOKEN' );641 header( 'HTTP/1.1 400 Bad request' ); 642 header( 'Content-type: application/json; charset=utf-8' ); 643 die( 'FAILED_SDTOKEN' ); 657 644 } 658 645 $failed = (int) get_option( 'sarbacane_failed', 0 ); … … 663 650 update_option( 'sarbacane_failed', $failed + 1, false ); 664 651 } 665 header( "HTTP/1.1 403 Unauthorized");666 header( "Content-type: application/json; charset=utf-8");667 die ( 'FAILED_SDTOKEN' );652 header( 'HTTP/1.1 403 Unauthorized' ); 653 header( 'Content-type: application/json; charset=utf-8' ); 654 die( 'FAILED_SDTOKEN' ); 668 655 } else { 669 656 // Content retrieving 670 657 if ( isset ( $type ) ) { 671 if ( "posts" == $type) {672 header( "Content-Type: application/rss+xml ; charset=utf-8");658 if ( $type == 'posts' ) { 659 header( 'Content-Type: application/rss+xml; charset=utf-8' ); 673 660 $content = new SarbacaneContent(); 674 661 if ( isset ( $id ) ) { … … 677 664 $content->get_articles_rss( $limit ); 678 665 } 679 } else if ( "settings" == $type) {680 header( "Content-Type: application/json ; charset=utf-8");681 header( "Content-Transfer-Encoding: binary");666 } else if ( $type == 'settings' ) { 667 header( 'Content-Type: application/json; charset=utf-8' ); 668 header( 'Content-Transfer-Encoding: binary' ); 682 669 $settings = new SarbacaneSettings(); 683 670 $settings->get_settings(); 684 } else if ( "medias" == $type) {685 header( "Content-Type: application/json ; charset=utf-8");671 } else if ( $type == 'medias' ) { 672 header( 'Content-Type: application/json; charset=utf-8' ); 686 673 $medias = new SarbacaneMedias(); 687 674 $medias->get_medias(); … … 690 677 $this->update_data_1_4_5(); 691 678 // List retrieving 692 header( "Content-Type: text/plain ; charset=utf-8");693 header( "Content-Transfer-Encoding: binary");694 if ( "delete" == $action) {679 header( 'Content-Type: text/plain; charset=utf-8' ); 680 header( 'Content-Transfer-Encoding: binary' ); 681 if ( $action == 'delete' ) { 695 682 $this->sarbacane_delete_sdid( $sd_id ); 696 683 } else { 697 if ( $sd_list_id != '' && $sd_list_id != "N" && $sd_list_id != "U") {698 header( "HTTP/1.1 404 Not found");699 header( "Content-type: application/json ; charset=utf-8");700 die ( 'FAILED_ID' );684 if ( $sd_list_id != '' && $sd_list_id != 'N' && $sd_list_id != 'U' ) { 685 header( 'HTTP/1.1 404 Not found' ); 686 header( 'Content-type: application/json; charset=utf-8' ); 687 die( 'FAILED_ID' ); 701 688 } 702 689 $this->sarbacane_get_list( $sd_id, $sd_list_id ); -
mailify/trunk/js/sarbacane-widget.js
r1629810 r1681124 16 16 } 17 17 if ( isSubmitable ) { 18 jQuery( "#sarbacane_desktop_widget_form_" + list_type + " .sarbacane_form_value" ).val( "sarbacane_desktop_widget" ); 18 19 jQuery( "#sarbacane_desktop_widget_form_" + list_type ).submit(); 19 20 } -
mailify/trunk/readme.txt
r1677274 r1681124 3 3 Tags: marketing, mail, email, mailing 4 4 Requires at least: 4.0 5 Tested up to: 4. 75 Tested up to: 4.8 6 6 License: GPLv2 or later 7 Stable tag: 1.4. 67 Stable tag: 1.4.7 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 … … 85 85 == Changelog == 86 86 87 = 1.4.7 = 88 Widget optimizations. 89 87 90 = 1.4.6 = 88 91 Customize widget mandatory fields message. … … 129 132 = Spanish = 130 133 134 = 1.4.7 = 135 Widget Optimización. 136 131 137 = 1.4.6 = 132 138 Personalizar el mensaje de los campos obligatorios del widget. -
mailify/trunk/sarbacane.php
r1677274 r1681124 5 5 Description: This plugin allows you to synchronize your WordPress data in Mailify 6 6 Author: Sarbacane Software 7 Version: 1.4. 67 Version: 1.4.7 8 8 Author URI: http://mailify.com/?utm_source=module-wordpress&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=wordpress 9 9 Text Domain: mailify -
mailify/trunk/views/sarbacane-adminpanel.php
r1629810 r1681124 17 17 <?php _e( 'Synchronization key to enter in Mailify', 'mailify' ) ?> : 18 18 <span class="sarbacane_desktop_connection_status"> 19 <?php if ( is_array( $sdid_array ) && count( $sdid_array ) > 0) { ?>19 <?php if ( $is_connected ) { ?> 20 20 <span class='sarbacane_desktop_connection_ok'><?php _e( 'Connected', 'mailify' ) ?></span> 21 21 <?php } else { ?> -
mailify/trunk/views/sarbacane-lists-sync.php
r1629810 r1681124 13 13 </p> 14 14 <p class="sarbacane_desktop_config_label"> 15 <input type="checkbox" name="sarbacane_users_list" id="sarbacane_users_list" value="true" <?php if ( $sarbacane_users_list ) { echo 'checked="checked"' ; } ?>/>15 <input type="checkbox" name="sarbacane_users_list" id="sarbacane_users_list" value="true"<?php if ( $sarbacane_users_list ) { ?> checked="checked"<?php } ?>/> 16 16 <label for="sarbacane_users_list"><?php _e( 'Synchronize a \'\'WordPress Users\'\' list', 'mailify' ) ?></label> 17 17 <br /> … … 19 19 </p> 20 20 <p class="sarbacane_desktop_config_label"> 21 <input type="checkbox" name="sarbacane_news_list" onclick="sarbacaneNewsListChangePopup()" id="sarbacane_news_list" value="true" <?php if ( $sarbacane_news_list ) { echo 'checked="checked"'; } ?>/>21 <input type="checkbox" name="sarbacane_news_list" onclick="sarbacaneNewsListChangePopup()" id="sarbacane_news_list" value="true" <?php if ( $sarbacane_news_list ) { ?> checked="checked"<?php } ?>/> 22 22 <label for="sarbacane_news_list"><?php _e( 'Automatically synchronize your subscriber list', 'mailify' ) ?></label> 23 23 <br /> … … 31 31 </p> 32 32 <p class="sarbacane_desktop_config_label"> 33 <input type="checkbox" name="sarbacane_theme_sync" id="sarbacane_theme_sync" value="true" <?php if ( $sarbacane_theme_sync ) { echo 'checked="checked"'; } ?>/>33 <input type="checkbox" name="sarbacane_theme_sync" id="sarbacane_theme_sync" value="true"<?php if ( $sarbacane_theme_sync ) { ?> checked="checked"<?php } ?>/> 34 34 <label for="sarbacane_theme_sync"><?php _e( 'Synchronize your WordPress theme', 'mailify' ) ?></label> 35 35 <br /> … … 37 37 </p> 38 38 <p class="sarbacane_desktop_config_label"> 39 <input type="checkbox" name="sarbacane_blog_content" id="sarbacane_blog_content" value="true" <?php if ( $sarbacane_blog_content ) { echo 'checked="checked"'; } ?>/>39 <input type="checkbox" name="sarbacane_blog_content" id="sarbacane_blog_content" value="true"<?php if ( $sarbacane_blog_content ) { ?> checked="checked"<?php } ?>/> 40 40 <label for="sarbacane_blog_content"><?php _e( 'Synchronize blog content', 'mailify' ) ?></label> 41 41 <br /> … … 43 43 </p> 44 44 <p class="sarbacane_desktop_config_label" style="display:none;"> 45 <input type="checkbox" name="sarbacane_media_content" id="sarbacane_media_content" value="true" <?php if ( $sarbacane_media_content ) { echo 'checked="checked"'; } ?>/>45 <input type="checkbox" name="sarbacane_media_content" id="sarbacane_media_content" value="true"<?php if ( $sarbacane_media_content ) { ?> checked="checked"<?php } ?>/> 46 46 <label for="sarbacane_media_content"><?php _e( 'Synchronize media library', 'mailify' ) ?></label> 47 47 <br /> … … 49 49 </p> 50 50 <p class="sarbacane_desktop_config_label"> 51 <input type="checkbox" name="sarbacane_rss_data" id="sarbacane_rss_data" value="true" <?php if ( $sarbacane_rss_data ) { echo 'checked="checked"'; } ?>/>51 <input type="checkbox" name="sarbacane_rss_data" id="sarbacane_rss_data" value="true"<?php if ( $sarbacane_rss_data ) { ?> checked="checked"<?php } ?>/> 52 52 <label for="sarbacane_rss_data"><?php _e( 'Synchronize RSS data', 'mailify' ) ?></label> 53 53 <br /> -
mailify/trunk/views/sarbacane-widget-adminpanel.php
r1677274 r1681124 50 50 <label class="sarbacane_desktop_field_number"><?php echo __( 'Field', 'mailify' ) . ' ' . ( $i + 1 ) ?></label> 51 51 <ul class="sarbacane_widget_menu"> 52 <li class="sarbacane_desktop_menu_item sarbacane_desktop_trash <?php if ( $isEmail ) { echo "sarbacane_desktop_menu_item_disabled_email";} ?>"<?php if ( !$isEmail ) { ?> onclick="sarbacaneDeleteField( <?php echo $i ?> )" <?php } ?>></li>52 <li class="sarbacane_desktop_menu_item sarbacane_desktop_trash<?php if ( $isEmail ) { ?> sarbacane_desktop_menu_item_disabled_email<?php } ?>"<?php if ( !$isEmail ) { ?> onclick="sarbacaneDeleteField( <?php echo $i ?> )" <?php } ?>></li> 53 53 <li class="sarbacane_desktop_menu_item sarbacane_desktop_down" onclick="sarbacaneMoveDown( <?php echo $i ?> )"></li> 54 54 <li class="sarbacane_desktop_menu_item sarbacane_desktop_up" onclick="sarbacaneMoveUp( <?php echo $i ?> )"></li> … … 67 67 <br /> 68 68 <label class="sarbacane_desktop_inline_configuration_label " for="sarbacane_desktop_mandatory_<?php echo $i ?>"><?php _e( 'Mandatory', 'mailify' ) ?> : </label> 69 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_true_<?php echo $i ?>" value="true" <?php if ( $field->mandatory ) { echo ' checked="checked" '; } ?> <?php if ( $isEmail ) { echo 'disabled="disabled"';} ?> onclick="sarbacaneDisplayPreview()"/>69 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_true_<?php echo $i ?>" value="true"<?php if ( $field->mandatory ) { ?> checked="checked"<?php } ?><?php if ( $isEmail ) { ?> disabled="disabled"<?php } ?> onclick="sarbacaneDisplayPreview()"/> 70 70 <label class="sarbacane_desktop_yes_no_label" for="sarbacane_desktop_mandatory_true_<?php echo $i ?>"><?php _e( 'Yes', 'mailify' ) ?></label> 71 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_false_<?php echo $i ?>" value="false" <?php if ( !$field->mandatory ) { echo ' checked="checked" '; } ?> <?php if ( $isEmail ) { echo 'disabled="disabled"';} ?> onclick="sarbacaneDisplayPreview()"/>71 <input type="radio" name="sarbacane_mandatory_<?php echo $i ?>" id="sarbacane_desktop_mandatory_false_<?php echo $i ?>" value="false"<?php if ( !$field->mandatory ) { ?> checked="checked"<?php } ?><?php if ( $isEmail ) { ?> disabled="disabled"<?php } ?> onclick="sarbacaneDisplayPreview()"/> 72 72 <label class="sarbacane_desktop_yes_no_label" for="sarbacane_desktop_mandatory_false_<?php echo $i ?>"><?php _e( 'No', 'mailify' ) ?></label> 73 73 </p> … … 116 116 <div id="sarbacane_widget_preview"> 117 117 <p class="sarbacane_widget_configuration_title"><?php _e( 'Preview', 'mailify' ) ?></p> 118 <div id="sarbacane_preview">< ?php _e( 'Fields marked with * are mandatory', 'mailify' ) ?></div>118 <div id="sarbacane_preview"></div> 119 119 </div> 120 120 <div id="sarbacane_desktop_vertical_splitter"></div> -
mailify/trunk/views/sarbacane-widget.php
r1677274 r1681124 22 22 ?> 23 23 <p> 24 <label><?php echo $label ?> <?php if ( $field->mandatory ) { echo '*';} ?></label>24 <label><?php echo $label ?><?php if ( $field->mandatory ) { ?> *<?php } ?></label> 25 25 <br /> 26 <input type="<?php echo $field_type ?>" id="<?php echo $id ?>" name="<?php echo $name ?>" placeholder="<?php esc_attr_e( $field->placeholder ) ?>" <?php if ( $field->mandatory ) { echo 'required class="required"'; } ?>/>26 <input type="<?php echo $field_type ?>" id="<?php echo $id ?>" name="<?php echo $name ?>" placeholder="<?php esc_attr_e( $field->placeholder ) ?>"<?php if ( $field->mandatory ) { ?> required class="required"<?php } ?>/> 27 27 </p> 28 28 <?php } ?> 29 29 <p><?php esc_html_e( $registration_mandatory_fields ) ?></p> 30 30 <?php wp_nonce_field( 'newsletter_registration', 'sarbacane_form_token' ) ?> 31 <input type="button" value="<?php esc_attr_e( $registration_button ) ?>" onclick="sarbacaneSubmitWidget( '<?php echo $list_type . $rand ?>' )" /> 31 <input type="hidden" name="sarbacane_form_value" class="sarbacane_form_value" value=""/> 32 <input type="button" value="<?php esc_attr_e( $registration_button ) ?>" onclick="sarbacaneSubmitWidget( '<?php echo $list_type . $rand ?>' )"/> 32 33 </form> 33 34 </aside>
Note: See TracChangeset
for help on using the changeset viewer.