@@ -1,19 +1,19 @@ discard block |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 2 | - if( !empty($messages_histo) && is_array($messages_histo) ) :?> |
|
| 1 | +<?php if (!defined('ABSPATH')) exit; |
|
| 2 | + if (!empty($messages_histo) && is_array($messages_histo)) :?> |
|
| 3 | 3 | <div class="wps-table wps-my-message"> |
| 4 | 4 | <div class="wps-table-header wps-table-row"> |
| 5 | - <div class="wps-table-cell"><?php _e( 'Message title', 'wpshop' ); ?></div> |
|
| 6 | - <div class="wps-table-cell"><?php _e( 'Send date', 'wpshop' ); ?></div> |
|
| 5 | + <div class="wps-table-cell"><?php _e('Message title', 'wpshop'); ?></div> |
|
| 6 | + <div class="wps-table-cell"><?php _e('Send date', 'wpshop'); ?></div> |
|
| 7 | 7 | </div> |
| 8 | - <?php $page_message_histo = isset( $_GET['page_message_histo'] ) ? (int) $_GET['page_message_histo'] : 1; |
|
| 9 | - $nb_pages_messages_histo = ceil( count( $messages_histo ) / wps_message_ctr::$mails_display ); |
|
| 10 | - $messages_histo = array_slice( $messages_histo, ( $page_message_histo - 1 ) * wps_message_ctr::$mails_display, wps_message_ctr::$mails_display ); |
|
| 11 | - reset( $messages_histo ); |
|
| 12 | - while( $messages = current( $messages_histo ) ) : |
|
| 13 | - $first_send_date = key( $messages_histo ); |
|
| 14 | - reset( $messages ); |
|
| 15 | - while( $message = current( $messages ) ) : |
|
| 16 | - $key = key( $messages ); ?> |
|
| 8 | + <?php $page_message_histo = isset($_GET['page_message_histo']) ? (int)$_GET['page_message_histo'] : 1; |
|
| 9 | + $nb_pages_messages_histo = ceil(count($messages_histo) / wps_message_ctr::$mails_display); |
|
| 10 | + $messages_histo = array_slice($messages_histo, ($page_message_histo - 1) * wps_message_ctr::$mails_display, wps_message_ctr::$mails_display); |
|
| 11 | + reset($messages_histo); |
|
| 12 | + while ($messages = current($messages_histo)) : |
|
| 13 | + $first_send_date = key($messages_histo); |
|
| 14 | + reset($messages); |
|
| 15 | + while ($message = current($messages)) : |
|
| 16 | + $key = key($messages); ?> |
|
| 17 | 17 | <div class="wps-table-content wps-table-row" data-date="<?php echo substr($first_send_date, 0, 7); ?>" > |
| 18 | 18 | <div class="wps-table-cell wps-message-title-container"> |
| 19 | 19 | <?php $message_special_id = rand(); ?> |
@@ -21,27 +21,27 @@ discard block |
||
| 21 | 21 | <div id="wps-customer-message-<?php echo $message_special_id; ?>" style="display:none;" ><?php echo $message['message']; ?></div> |
| 22 | 22 | </div> |
| 23 | 23 | <div class="wps-table-cell"> |
| 24 | - <?php if( !empty($message['dates']) ) : ?> |
|
| 24 | + <?php if (!empty($message['dates'])) : ?> |
|
| 25 | 25 | <ul> |
| 26 | - <?php foreach( $message['dates'] as $date ) : ?> |
|
| 27 | - <li><?php echo mysql2date( get_option('date_format') . ' ' . get_option('time_format') , $date, true ); ?></li> |
|
| 26 | + <?php foreach ($message['dates'] as $date) : ?> |
|
| 27 | + <li><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $date, true); ?></li> |
|
| 28 | 28 | <?php endforeach; ?> |
| 29 | 29 | </ul> |
| 30 | 30 | <?php endif; ?> |
| 31 | 31 | </div> |
| 32 | 32 | </div> |
| 33 | - <?php next( $messages ); |
|
| 33 | + <?php next($messages); |
|
| 34 | 34 | endwhile; |
| 35 | - next( $messages_histo ); |
|
| 35 | + next($messages_histo); |
|
| 36 | 36 | endwhile; ?> |
| 37 | 37 | </div> |
| 38 | - <?php if( $nb_pages_messages_histo != 1 ) { |
|
| 39 | - for( $i = 1; $i <= $nb_pages_messages_histo; $i++ ) { ?> |
|
| 40 | - <?php echo '<' . ( ( $page_message_histo == $i ) ? 'span' : 'a href="' . add_query_arg( array( 'page_message_histo' => $i ) ) . '"' ) . ' class="page-numbers">' . $i . '</' . ( ( $page_message_histo == $i ) ? 'span' : 'a' ) . '>'; ?> |
|
| 38 | + <?php if ($nb_pages_messages_histo != 1) { |
|
| 39 | + for ($i = 1; $i <= $nb_pages_messages_histo; $i++) { ?> |
|
| 40 | + <?php echo '<' . (($page_message_histo == $i) ? 'span' : 'a href="' . add_query_arg(array('page_message_histo' => $i)) . '"') . ' class="page-numbers">' . $i . '</' . (($page_message_histo == $i) ? 'span' : 'a') . '>'; ?> |
|
| 41 | 41 | <?php } |
| 42 | 42 | } ?> |
| 43 | 43 | <?php else: ?> |
| 44 | 44 | <div class="wps-alert-info"> |
| 45 | - <?php _e( 'No email was sent.', 'wpshop' ); ?> |
|
| 45 | + <?php _e('No email was sent.', 'wpshop'); ?> |
|
| 46 | 46 | </div> |
| 47 | 47 | <?php endif; ?> |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 1 | +<?php if (!defined('ABSPATH')) exit; |
|
| 2 | 2 | class wps_message_ctr { |
| 3 | 3 | /** Define the main directory containing the template for the current plugin |
| 4 | 4 | * @var string |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | $this->template_dir = WPS_MESSAGE_PATH . WPS_MESSAGE_DIR . "/templates/"; |
| 21 | 21 | |
| 22 | 22 | // WP General actions |
| 23 | - add_action( 'admin_init', array( $this, 'wps_messages_init_actions') ); |
|
| 24 | - add_action('add_meta_boxes', array( $this, 'add_meta_boxes') ); |
|
| 25 | - add_action('manage_'.WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE.'_posts_custom_column', array( $this, 'messages_custom_columns')); |
|
| 26 | - add_filter('manage_edit-'.WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE.'_columns', array( $this, 'messages_edit_columns')); |
|
| 23 | + add_action('admin_init', array($this, 'wps_messages_init_actions')); |
|
| 24 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes')); |
|
| 25 | + add_action('manage_' . WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE . '_posts_custom_column', array($this, 'messages_custom_columns')); |
|
| 26 | + add_filter('manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE . '_columns', array($this, 'messages_edit_columns')); |
|
| 27 | 27 | |
| 28 | 28 | // Shortcodes |
| 29 | - add_shortcode( 'wps_message_histo', array( $this, 'display_message_histo_per_customer') ); |
|
| 30 | - add_shortcode( 'order_customer_personnal_informations', array( $this, 'order_personnal_informations') ); |
|
| 29 | + add_shortcode('wps_message_histo', array($this, 'display_message_histo_per_customer')); |
|
| 30 | + add_shortcode('order_customer_personnal_informations', array($this, 'order_personnal_informations')); |
|
| 31 | 31 | |
| 32 | 32 | /** Ajax */ |
| 33 | 33 | add_action('wp_ajax_get_content_message', array($this, 'get_content_message')); |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | public function enqueue_scripts() { |
| 40 | 40 | /** Css */ |
| 41 | 41 | add_thickbox(); |
| 42 | - wp_register_style( 'wpeo-message-css', WPS_MESSAGE_URL . WPS_MESSAGE_DIR . '/assets/css/frontend.css', '', WPS_MESSAGE_VERSION ); |
|
| 43 | - wp_enqueue_style( 'wpeo-message-css' ); |
|
| 42 | + wp_register_style('wpeo-message-css', WPS_MESSAGE_URL . WPS_MESSAGE_DIR . '/assets/css/frontend.css', '', WPS_MESSAGE_VERSION); |
|
| 43 | + wp_enqueue_style('wpeo-message-css'); |
|
| 44 | 44 | |
| 45 | 45 | /** My js */ |
| 46 | - wp_enqueue_script( 'wps-message-js', WPS_MESSAGE_URL . WPS_MESSAGE_DIR . '/assets/js/frontend.js', array("jquery", 'thickbox'), WPS_MESSAGE_VERSION); |
|
| 46 | + wp_enqueue_script('wps-message-js', WPS_MESSAGE_URL . WPS_MESSAGE_DIR . '/assets/js/frontend.js', array("jquery", 'thickbox'), WPS_MESSAGE_VERSION); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'show_in_nav_menus' => false, |
| 85 | 85 | 'rewrite' => false, |
| 86 | 86 | 'query_var' => true, |
| 87 | - 'supports' => array('title','editor'), |
|
| 87 | + 'supports' => array('title', 'editor'), |
|
| 88 | 88 | 'has_archive' => false |
| 89 | 89 | )); |
| 90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | add_meta_box( |
| 98 | 98 | 'wpshop_message_histo', |
| 99 | 99 | __('Message historic', 'wpshop'), |
| 100 | - array( $this, 'message_histo_box'), |
|
| 100 | + array($this, 'message_histo_box'), |
|
| 101 | 101 | WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE, 'normal', 'high' |
| 102 | 102 | ); |
| 103 | 103 | } |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | * @param integer $message_type_id : Message type ID |
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | - function get_historic_message_by_type( $message_type_id ) { |
|
| 122 | + function get_historic_message_by_type($message_type_id) { |
|
| 123 | 123 | global $wpdb; |
| 124 | 124 | $output = ''; |
| 125 | - if ( !empty($message_type_id) ) { |
|
| 125 | + if (!empty($message_type_id)) { |
|
| 126 | 126 | // Recover all sended messages |
| 127 | 127 | $wps_message_mdl = new wps_message_mdl(); |
| 128 | - $messages = $wps_message_mdl->get_messages_histo( $message_type_id ); |
|
| 128 | + $messages = $wps_message_mdl->get_messages_histo($message_type_id); |
|
| 129 | 129 | ob_start(); |
| 130 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "backend", "message_historic") ); |
|
| 130 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "backend", "message_historic")); |
|
| 131 | 131 | $output .= ob_get_contents(); |
| 132 | 132 | ob_end_clean(); |
| 133 | 133 | } |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public static function create_default_message() { |
| 141 | 141 | // Get default messages defined into xml files |
| 142 | - $xml_default_emails = file_get_contents( WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/assets/datas/default_emails.xml' ); |
|
| 143 | - $default_emails = new SimpleXMLElement( $xml_default_emails ); |
|
| 142 | + $xml_default_emails = file_get_contents(WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/assets/datas/default_emails.xml'); |
|
| 143 | + $default_emails = new SimpleXMLElement($xml_default_emails); |
|
| 144 | 144 | |
| 145 | 145 | //Read default emails for options creation |
| 146 | - foreach ( $default_emails->xpath( '//emails/email' ) as $email ) { |
|
| 147 | - if ( ( WPSHOP_DEFINED_SHOP_TYPE == (string)$email->attributes()->shop_type ) || ( 'sale' == WPSHOP_DEFINED_SHOP_TYPE ) ) { |
|
| 148 | - self::createMessage( (string)$email->attributes()->code, (string)$email->subject, (string)$email->content ); |
|
| 146 | + foreach ($default_emails->xpath('//emails/email') as $email) { |
|
| 147 | + if ((WPSHOP_DEFINED_SHOP_TYPE == (string)$email->attributes()->shop_type) || ('sale' == WPSHOP_DEFINED_SHOP_TYPE)) { |
|
| 148 | + self::createMessage((string)$email->attributes()->code, (string)$email->subject, (string)$email->content); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -157,24 +157,24 @@ discard block |
||
| 157 | 157 | * @param string $message : Message content |
| 158 | 158 | * @return integer message ID |
| 159 | 159 | */ |
| 160 | - public static function createMessage( $code, $object = "", $message = "" ) { |
|
| 160 | + public static function createMessage($code, $object = "", $message = "") { |
|
| 161 | 161 | $id = 0; |
| 162 | 162 | |
| 163 | - $object = empty( $object ) ? constant( $code . '_OBJECT' ) : $object; |
|
| 164 | - $message = empty( $message ) ? constant( $code ) : $message; |
|
| 165 | - $message_option = get_option( $code, null ); |
|
| 163 | + $object = empty($object) ? constant($code . '_OBJECT') : $object; |
|
| 164 | + $message = empty($message) ? constant($code) : $message; |
|
| 165 | + $message_option = get_option($code, null); |
|
| 166 | 166 | |
| 167 | - if ( empty( $message_option ) && !empty( $object ) && !empty( $message ) ) { |
|
| 167 | + if (empty($message_option) && !empty($object) && !empty($message)) { |
|
| 168 | 168 | $new_message = array( |
| 169 | - 'post_title' => __( $object , 'wpshop'), |
|
| 170 | - 'post_content' => self::customize_message( __( $message, 'wpshop' ) ), |
|
| 169 | + 'post_title' => __($object, 'wpshop'), |
|
| 170 | + 'post_content' => self::customize_message(__($message, 'wpshop')), |
|
| 171 | 171 | 'post_status' => 'publish', |
| 172 | 172 | 'post_author' => 1, |
| 173 | 173 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE |
| 174 | 174 | ); |
| 175 | - $id = wp_insert_post( $new_message ); |
|
| 175 | + $id = wp_insert_post($new_message); |
|
| 176 | 176 | |
| 177 | - update_option( $code, $id ); |
|
| 177 | + update_option($code, $id); |
|
| 178 | 178 | } |
| 179 | 179 | else { |
| 180 | 180 | $id = $message_option; |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | function messages_custom_columns($column) { |
| 191 | 191 | global $post; |
| 192 | 192 | $metadata = get_post_custom(); |
| 193 | - switch($column){ |
|
| 193 | + switch ($column) { |
|
| 194 | 194 | case "extract": |
| 195 | 195 | echo wp_trim_words($post->post_content, 55); |
| 196 | 196 | break; |
| 197 | 197 | case "last_dispatch_date": |
| 198 | - if(!empty($metadata['wpshop_message_last_dispatch_date'][0])) |
|
| 199 | - echo mysql2date('d F Y, H:i:s',$metadata['wpshop_message_last_dispatch_date'][0], true); |
|
| 198 | + if (!empty($metadata['wpshop_message_last_dispatch_date'][0])) |
|
| 199 | + echo mysql2date('d F Y, H:i:s', $metadata['wpshop_message_last_dispatch_date'][0], true); |
|
| 200 | 200 | else |
| 201 | 201 | echo '-'; |
| 202 | 202 | break; |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | $columns = array( |
| 212 | 212 | 'cb' => '<input type="checkbox" />', |
| 213 | 213 | 'title' => __('Name', 'wpshop'), |
| 214 | - 'extract' =>__('Extract from the message','wpshop'), |
|
| 215 | - 'date' => __('Creation date','wpshop'), |
|
| 216 | - 'last_dispatch_date' => __('Last dispatch date','wpshop') |
|
| 214 | + 'extract' =>__('Extract from the message', 'wpshop'), |
|
| 215 | + 'date' => __('Creation date', 'wpshop'), |
|
| 216 | + 'last_dispatch_date' => __('Last dispatch date', 'wpshop') |
|
| 217 | 217 | ); |
| 218 | 218 | |
| 219 | 219 | return $columns; |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE, |
| 230 | 230 | 'posts_per_page' => '-1', |
| 231 | 231 | )); |
| 232 | - $options=''; |
|
| 232 | + $options = ''; |
|
| 233 | 233 | if (!empty($posts)) { |
| 234 | - $options = '<option value="0">' .__('Select values from list', 'wpshop'). '</option>'; |
|
| 234 | + $options = '<option value="0">' . __('Select values from list', 'wpshop') . '</option>'; |
|
| 235 | 235 | foreach ($posts as $p) { |
| 236 | - $selected = $p->ID==$current ? ' selected="selected"': ''; |
|
| 237 | - $options .= '<option value="'.$p->ID.'"'.$selected.'>'.$p->post_title.'</option>'; |
|
| 236 | + $selected = $p->ID == $current ? ' selected="selected"' : ''; |
|
| 237 | + $options .= '<option value="' . $p->ID . '"' . $selected . '>' . $p->post_title . '</option>'; |
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | wp_reset_query(); |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | * @param integer $customer_id : ID to identifiate the customer |
| 248 | 248 | * @return string |
| 249 | 249 | */ |
| 250 | - function display_message_histo_per_customer( $args, $customer_id = '' ) { |
|
| 251 | - $customer_id = ( !empty($customer_id) ) ? $customer_id : get_current_user_id(); |
|
| 252 | - $message_id = ( !empty($args) && !empty($args['message_id']) ) ? $args['message_id'] : ''; |
|
| 250 | + function display_message_histo_per_customer($args, $customer_id = '') { |
|
| 251 | + $customer_id = (!empty($customer_id)) ? $customer_id : get_current_user_id(); |
|
| 252 | + $message_id = (!empty($args) && !empty($args['message_id'])) ? $args['message_id'] : ''; |
|
| 253 | 253 | $message_elements = ''; |
| 254 | 254 | |
| 255 | 255 | $wps_message_mdl = new wps_message_mdl(); |
| 256 | - $messages_data = $wps_message_mdl->get_messages_histo( $message_id, $customer_id ); |
|
| 256 | + $messages_data = $wps_message_mdl->get_messages_histo($message_id, $customer_id); |
|
| 257 | 257 | |
| 258 | 258 | // ob_start(); |
| 259 | 259 | // require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "frontend", "messages") ); |
@@ -262,22 +262,22 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | /** Order emails */ |
| 264 | 264 | $messages_histo = array(); |
| 265 | - foreach( $messages_data as $meta_id => $messages ) : |
|
| 265 | + foreach ($messages_data as $meta_id => $messages) : |
|
| 266 | 266 | $i = 0; |
| 267 | - foreach ( $messages as $message ) : |
|
| 268 | - $messages_histo[ $message[ 'mess_dispatch_date' ][ 0 ] ][ $i ][ 'title' ] = $message[ 'mess_title' ]; |
|
| 269 | - $messages_histo[ $message[ 'mess_dispatch_date' ][ 0 ] ][ $i ][ 'message' ] = $message[ 'mess_message' ]; |
|
| 270 | - $messages_histo[ $message[ 'mess_dispatch_date' ][ 0 ] ][ $i ][ 'dates' ] = $message[ 'mess_dispatch_date' ]; |
|
| 271 | - if ( !empty( $message[ 'mess_object_id' ] ) ) { |
|
| 272 | - $messages_histo[ $message[ 'mess_dispatch_date' ][ 0 ] ][ $i ][ 'object' ] = $message[ 'mess_object_id' ]; |
|
| 267 | + foreach ($messages as $message) : |
|
| 268 | + $messages_histo[$message['mess_dispatch_date'][0]][$i]['title'] = $message['mess_title']; |
|
| 269 | + $messages_histo[$message['mess_dispatch_date'][0]][$i]['message'] = $message['mess_message']; |
|
| 270 | + $messages_histo[$message['mess_dispatch_date'][0]][$i]['dates'] = $message['mess_dispatch_date']; |
|
| 271 | + if (!empty($message['mess_object_id'])) { |
|
| 272 | + $messages_histo[$message['mess_dispatch_date'][0]][$i]['object'] = $message['mess_object_id']; |
|
| 273 | 273 | } |
| 274 | 274 | $i++; |
| 275 | 275 | endforeach; |
| 276 | 276 | endforeach; |
| 277 | - ksort( $messages_histo ); |
|
| 278 | - $messages_histo = array_reverse( $messages_histo ); |
|
| 277 | + ksort($messages_histo); |
|
| 278 | + $messages_histo = array_reverse($messages_histo); |
|
| 279 | 279 | ob_start(); |
| 280 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "frontend", "customer", "messages") ); |
|
| 280 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "frontend", "customer", "messages")); |
|
| 281 | 281 | $output = ob_get_contents(); |
| 282 | 282 | ob_end_clean(); |
| 283 | 283 | |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | * @param string $message : message content |
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | - public static function customize_message( $message ) { |
|
| 293 | - if( !empty($message) ) { |
|
| 292 | + public static function customize_message($message) { |
|
| 293 | + if (!empty($message)) { |
|
| 294 | 294 | ob_start(); |
| 295 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, WPS_MESSAGE_PATH . WPS_MESSAGE_DIR . '/templates/', "backend", "message_html_structure") ); |
|
| 295 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, WPS_MESSAGE_PATH . WPS_MESSAGE_DIR . '/templates/', "backend", "message_html_structure")); |
|
| 296 | 296 | $message = ob_get_contents(); |
| 297 | 297 | ob_end_clean(); |
| 298 | 298 | } |
@@ -302,12 +302,12 @@ discard block |
||
| 302 | 302 | /** Store a new message |
| 303 | 303 | * @return boolean |
| 304 | 304 | */ |
| 305 | - function add_message($recipient_id=0, $email, $title, $message, $model_id, $object, $date = null) { |
|
| 305 | + function add_message($recipient_id = 0, $email, $title, $message, $model_id, $object, $date = null) { |
|
| 306 | 306 | $date = empty($date) ? current_time('mysql', 0) : $date; |
| 307 | - $object_empty = array('object_type'=>'','object_id'=>0); |
|
| 307 | + $object_empty = array('object_type'=>'', 'object_id'=>0); |
|
| 308 | 308 | $object = array_merge($object_empty, $object); |
| 309 | 309 | |
| 310 | - $historic = get_post_meta($recipient_id, '_wpshop_messages_histo_' .$model_id. '_' .substr($date, 0, 7), true); |
|
| 310 | + $historic = get_post_meta($recipient_id, '_wpshop_messages_histo_' . $model_id . '_' . substr($date, 0, 7), true); |
|
| 311 | 311 | $data_to_insert = array( |
| 312 | 312 | 'mess_user_id' => $recipient_id, |
| 313 | 313 | 'mess_user_email' => $email, |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | ); |
| 320 | 320 | $historic[] = $data_to_insert; |
| 321 | 321 | |
| 322 | - update_post_meta($recipient_id, '_wpshop_messages_histo_' .$model_id. '_' .substr($date, 0, 7), $historic); |
|
| 322 | + update_post_meta($recipient_id, '_wpshop_messages_histo_' . $model_id . '_' . substr($date, 0, 7), $historic); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -330,37 +330,37 @@ discard block |
||
| 330 | 330 | * @param boolean $duplicate_message : Duplicate a light message for historic storage |
| 331 | 331 | * @return string |
| 332 | 332 | */ |
| 333 | - function customMessage($string, $data, $model_name='', $duplicate_message=false) { |
|
| 333 | + function customMessage($string, $data, $model_name = '', $duplicate_message = false) { |
|
| 334 | 334 | $avant = array(); |
| 335 | 335 | $apres = array(); |
| 336 | 336 | |
| 337 | - $logo_option = get_option( 'wpshop_logo' ); |
|
| 337 | + $logo_option = get_option('wpshop_logo'); |
|
| 338 | 338 | |
| 339 | - $data['your_shop_logo'] = ( !empty($logo_option) ) ? '<img src="'.$logo_option.'" alt="' .get_bloginfo('name'). '" />' : ''; |
|
| 339 | + $data['your_shop_logo'] = (!empty($logo_option)) ? '<img src="' . $logo_option . '" alt="' . get_bloginfo('name') . '" />' : ''; |
|
| 340 | 340 | |
| 341 | - foreach($data as $key => $value) { |
|
| 342 | - $avant[] = '['.$key.']'; |
|
| 341 | + foreach ($data as $key => $value) { |
|
| 342 | + $avant[] = '[' . $key . ']'; |
|
| 343 | 343 | switch ($key) { |
| 344 | 344 | case 'order_content' : |
| 345 | - $apres[] = ( $duplicate_message ) ? '[order_content]' : $this->order_content_template_for_mail ( $data['order_id'] ); |
|
| 345 | + $apres[] = ($duplicate_message) ? '[order_content]' : $this->order_content_template_for_mail($data['order_id']); |
|
| 346 | 346 | break; |
| 347 | 347 | case 'order_addresses' : |
| 348 | - $apres[] = ( $duplicate_message ) ? '[order_addresses]' : $this->order_addresses_template_for_mail ( $data['order_id'] ); |
|
| 348 | + $apres[] = ($duplicate_message) ? '[order_addresses]' : $this->order_addresses_template_for_mail($data['order_id']); |
|
| 349 | 349 | break; |
| 350 | 350 | |
| 351 | 351 | case 'order_billing_address' : |
| 352 | - $apres[] = ( $duplicate_message ) ? '[order_billing_address]' : $this->order_addresses_template_for_mail ( $data['order_id'], 'billing' ); |
|
| 352 | + $apres[] = ($duplicate_message) ? '[order_billing_address]' : $this->order_addresses_template_for_mail($data['order_id'], 'billing'); |
|
| 353 | 353 | break; |
| 354 | 354 | |
| 355 | 355 | case 'order_shipping_address' : |
| 356 | - $apres[] = ( $duplicate_message ) ? '[order_shipping_address]' : $this->order_addresses_template_for_mail ( $data['order_id'], 'shipping' ); |
|
| 356 | + $apres[] = ($duplicate_message) ? '[order_shipping_address]' : $this->order_addresses_template_for_mail($data['order_id'], 'shipping'); |
|
| 357 | 357 | break; |
| 358 | 358 | |
| 359 | 359 | case 'order_customer_comments' : |
| 360 | - $apres[] = ( $duplicate_message ) ? '[order_customer_comments]' : $this->order_customer_comment_template_for_mail ( $data['order_id'] ); |
|
| 360 | + $apres[] = ($duplicate_message) ? '[order_customer_comments]' : $this->order_customer_comment_template_for_mail($data['order_id']); |
|
| 361 | 361 | break; |
| 362 | 362 | case 'order_personnal_informations' : |
| 363 | - $apres[] = ( $duplicate_message ) ? '[order_personnal_informations]' : $this->order_personnal_informations(); |
|
| 363 | + $apres[] = ($duplicate_message) ? '[order_personnal_informations]' : $this->order_personnal_informations(); |
|
| 364 | 364 | break; |
| 365 | 365 | default : |
| 366 | 366 | $apres[] = $value; |
@@ -369,9 +369,9 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | $string = str_replace($avant, $apres, $string); |
| 371 | 371 | |
| 372 | - $string = apply_filters( 'wps_more_customized_message', $string, $data, $duplicate_message ); |
|
| 372 | + $string = apply_filters('wps_more_customized_message', $string, $data, $duplicate_message); |
|
| 373 | 373 | |
| 374 | - if ( ($model_name != 'WPSHOP_NEW_ORDER_ADMIN_MESSAGE') ) { |
|
| 374 | + if (($model_name != 'WPSHOP_NEW_ORDER_ADMIN_MESSAGE')) { |
|
| 375 | 375 | $string = preg_replace("/\[(.*)\]/Usi", '', $string); |
| 376 | 376 | } |
| 377 | 377 | |
@@ -386,21 +386,21 @@ discard block |
||
| 386 | 386 | * @param string $object : message object |
| 387 | 387 | * @param file $attached_file : File to attached to e-mail |
| 388 | 388 | */ |
| 389 | - function wpshop_prepared_email($email, $model_name, $data=array(), $object=array(), $attached_file = '') { |
|
| 389 | + function wpshop_prepared_email($email, $model_name, $data = array(), $object = array(), $attached_file = '') { |
|
| 390 | 390 | global $wpdb; |
| 391 | - $data = apply_filters( 'wps_extra_data_to_send_in_email', $data ); |
|
| 391 | + $data = apply_filters('wps_extra_data_to_send_in_email', $data); |
|
| 392 | 392 | $model_id = get_option($model_name, 0); |
| 393 | - $query = $wpdb->prepare( 'SELECT * FROM ' .$wpdb->posts. ' WHERE ID = %s', $model_id); |
|
| 394 | - $post_message = $wpdb->get_row( $query ); |
|
| 393 | + $query = $wpdb->prepare('SELECT * FROM ' . $wpdb->posts . ' WHERE ID = %s', $model_id); |
|
| 394 | + $post_message = $wpdb->get_row($query); |
|
| 395 | 395 | $duplicate_message = ''; |
| 396 | - if ( !empty($post_message) ) { |
|
| 396 | + if (!empty($post_message)) { |
|
| 397 | 397 | $title = $this->customMessage($post_message->post_title, $data, $model_name); |
| 398 | 398 | $message = $this->customMessage($post_message->post_content, $data, $model_name); |
| 399 | 399 | /* On envoie le mail */ |
| 400 | - if ( array_key_exists('order_content', $data) || array_key_exists('order_addresses', $data) || array_key_exists('order_customer_comments', $data) ) { |
|
| 400 | + if (array_key_exists('order_content', $data) || array_key_exists('order_addresses', $data) || array_key_exists('order_customer_comments', $data)) { |
|
| 401 | 401 | $duplicate_message = $this->customMessage($post_message->post_content, $data, $model_name, true); |
| 402 | 402 | } |
| 403 | - if ( !empty($email) ) { |
|
| 403 | + if (!empty($email)) { |
|
| 404 | 404 | $this->wpshop_email($email, $title, $message, true, $model_id, $object, $attached_file, $duplicate_message); |
| 405 | 405 | } |
| 406 | 406 | } |
@@ -420,17 +420,17 @@ discard block |
||
| 420 | 420 | function wpshop_email($email, $title, $message, $save = true, $model_id, $object = array(), $attachments = '', $duplicate_message = '') { |
| 421 | 421 | global $wpdb; |
| 422 | 422 | // Sauvegarde |
| 423 | - if($save) { |
|
| 424 | - $user = $wpdb->get_row('SELECT ID FROM '.$wpdb->users.' WHERE user_email="'.$email.'";'); |
|
| 423 | + if ($save) { |
|
| 424 | + $user = $wpdb->get_row('SELECT ID FROM ' . $wpdb->users . ' WHERE user_email="' . $email . '";'); |
|
| 425 | 425 | $user_id = $user ? $user->ID : get_current_user_id(); |
| 426 | - $query = $wpdb->prepare('SELECT ID FROM ' .$wpdb->posts. ' WHERE post_author = %d AND post_type = %s ', $user_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
| 427 | - $user_post_id = $wpdb->get_var( $query ); |
|
| 426 | + $query = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_author = %d AND post_type = %s ', $user_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
| 427 | + $user_post_id = $wpdb->get_var($query); |
|
| 428 | 428 | |
| 429 | - if ( !empty($duplicate_message) ) { |
|
| 430 | - $this->add_message( $user_post_id, $email, $title, $duplicate_message, $model_id, $object ); |
|
| 429 | + if (!empty($duplicate_message)) { |
|
| 430 | + $this->add_message($user_post_id, $email, $title, $duplicate_message, $model_id, $object); |
|
| 431 | 431 | } |
| 432 | 432 | else { |
| 433 | - $this->add_message( $user_post_id, $email, $title, $message, $model_id, $object ); |
|
| 433 | + $this->add_message($user_post_id, $email, $title, $message, $model_id, $object); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | } |
@@ -438,19 +438,19 @@ discard block |
||
| 438 | 438 | $emails = get_option('wpshop_emails', array()); |
| 439 | 439 | $noreply_email = $emails['noreply_email']; |
| 440 | 440 | // Split the email to get the name |
| 441 | - $vers_nom = substr($email, 0, strpos($email,'@')); |
|
| 441 | + $vers_nom = substr($email, 0, strpos($email, '@')); |
|
| 442 | 442 | |
| 443 | 443 | // Headers du mail |
| 444 | 444 | $headers = "MIME-Version: 1.0\r\n"; |
| 445 | 445 | $headers .= "Content-type: text/html; charset=UTF-8\r\n"; |
| 446 | - $headers .= 'From: '.get_bloginfo('name').' <'.$noreply_email.'>' . "\r\n"; |
|
| 446 | + $headers .= 'From: ' . get_bloginfo('name') . ' <' . $noreply_email . '>' . "\r\n"; |
|
| 447 | 447 | |
| 448 | 448 | // Mail en HTML |
| 449 | 449 | @wp_mail($email, $title, $message, $headers, $attachments); |
| 450 | 450 | |
| 451 | 451 | |
| 452 | - if ( !empty($attachments) ) { |
|
| 453 | - unlink( $attachments ); |
|
| 452 | + if (!empty($attachments)) { |
|
| 453 | + unlink($attachments); |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | |
@@ -459,13 +459,13 @@ discard block |
||
| 459 | 459 | * @param integer $order_id : Order ID |
| 460 | 460 | * @return string |
| 461 | 461 | */ |
| 462 | - function order_content_template_for_mail ( $order_id ) { |
|
| 462 | + function order_content_template_for_mail($order_id) { |
|
| 463 | 463 | $message = ''; |
| 464 | - if ( !empty($order_id) ) { |
|
| 464 | + if (!empty($order_id)) { |
|
| 465 | 465 | $currency_code = wpshop_tools::wpshop_get_currency(false); |
| 466 | 466 | $orders_infos = get_post_meta($order_id, '_order_postmeta', true); |
| 467 | 467 | ob_start(); |
| 468 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_content_mail_template" ) ); |
|
| 468 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_content_mail_template")); |
|
| 469 | 469 | $message .= ob_get_contents(); |
| 470 | 470 | ob_end_clean(); |
| 471 | 471 | } |
@@ -478,44 +478,44 @@ discard block |
||
| 478 | 478 | * @param integer $address_type : Address type ID |
| 479 | 479 | * @return string |
| 480 | 480 | */ |
| 481 | - function order_addresses_template_for_mail ( $order_id, $address_type = '' ) { |
|
| 481 | + function order_addresses_template_for_mail($order_id, $address_type = '') { |
|
| 482 | 482 | global $wpdb; |
| 483 | - $shipping_option = get_option( 'wpshop_shipping_address_choice' ); |
|
| 484 | - $display_shipping = ( !empty($shipping_option) && !empty($shipping_option['activate']) ) ? true : false; |
|
| 483 | + $shipping_option = get_option('wpshop_shipping_address_choice'); |
|
| 484 | + $display_shipping = (!empty($shipping_option) && !empty($shipping_option['activate'])) ? true : false; |
|
| 485 | 485 | $message = ''; |
| 486 | - if ( !empty($order_id) ) { |
|
| 486 | + if (!empty($order_id)) { |
|
| 487 | 487 | $order_addresses = get_post_meta($order_id, '_order_info', true); |
| 488 | - if ( !empty($order_addresses) ) { |
|
| 489 | - foreach ( $order_addresses as $key=>$order_address ) { |
|
| 490 | - if ( !empty($order_address) && ( empty($address_type) || $address_type == $key ) ) { |
|
| 488 | + if (!empty($order_addresses)) { |
|
| 489 | + foreach ($order_addresses as $key=>$order_address) { |
|
| 490 | + if (!empty($order_address) && (empty($address_type) || $address_type == $key)) { |
|
| 491 | 491 | |
| 492 | - if( $key != 'shipping' || ($key == 'shipping' && $display_shipping) ) { |
|
| 493 | - $address_type_title = ( !empty($key) && $key == 'billing' ) ? __('Billing address', 'wpshop') : __('Shipping address', 'wpshop'); |
|
| 492 | + if ($key != 'shipping' || ($key == 'shipping' && $display_shipping)) { |
|
| 493 | + $address_type_title = (!empty($key) && $key == 'billing') ? __('Billing address', 'wpshop') : __('Shipping address', 'wpshop'); |
|
| 494 | 494 | $civility = ''; |
| 495 | - if ( !empty($order_address['address']['civility']) ) { |
|
| 496 | - $query = $wpdb->prepare('SELECT label FROM ' .WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS. ' WHERE id = %d', $order_address['address']['civility']); |
|
| 497 | - $civility = $wpdb->get_var( $query ); |
|
| 495 | + if (!empty($order_address['address']['civility'])) { |
|
| 496 | + $query = $wpdb->prepare('SELECT label FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . ' WHERE id = %d', $order_address['address']['civility']); |
|
| 497 | + $civility = $wpdb->get_var($query); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | // Address informations |
| 501 | - $customer_last_name = (!empty($order_address['address']['address_last_name']) ) ? $order_address['address']['address_last_name'] : ''; |
|
| 502 | - $customer_firtsname = (!empty($order_address['address']['address_first_name']) ) ? $order_address['address']['address_first_name'] : ''; |
|
| 503 | - $customer_company = (!empty($order_address['address']['company']) ) ? $order_address['address']['company'] : ''; |
|
| 504 | - $customer_address = (!empty($order_address['address']['address']) ) ? $order_address['address']['address'] : ''; |
|
| 505 | - $customer_zip_code = (!empty($order_address['address']['postcode']) ) ? $order_address['address']['postcode'] : ''; |
|
| 506 | - $customer_city = (!empty($order_address['address']['city']) ) ? $order_address['address']['city'] : ''; |
|
| 507 | - $customer_state = (!empty($order_address['address']['state']) ) ? $order_address['address']['state'] : ''; |
|
| 508 | - $customer_phone = (!empty($order_address['address']['phone']) ) ? ' Tel. : '.$order_address['address']['phone'] : ''; |
|
| 501 | + $customer_last_name = (!empty($order_address['address']['address_last_name'])) ? $order_address['address']['address_last_name'] : ''; |
|
| 502 | + $customer_firtsname = (!empty($order_address['address']['address_first_name'])) ? $order_address['address']['address_first_name'] : ''; |
|
| 503 | + $customer_company = (!empty($order_address['address']['company'])) ? $order_address['address']['company'] : ''; |
|
| 504 | + $customer_address = (!empty($order_address['address']['address'])) ? $order_address['address']['address'] : ''; |
|
| 505 | + $customer_zip_code = (!empty($order_address['address']['postcode'])) ? $order_address['address']['postcode'] : ''; |
|
| 506 | + $customer_city = (!empty($order_address['address']['city'])) ? $order_address['address']['city'] : ''; |
|
| 507 | + $customer_state = (!empty($order_address['address']['state'])) ? $order_address['address']['state'] : ''; |
|
| 508 | + $customer_phone = (!empty($order_address['address']['phone'])) ? ' Tel. : ' . $order_address['address']['phone'] : ''; |
|
| 509 | 509 | $country = ''; |
| 510 | - foreach ( unserialize(WPSHOP_COUNTRY_LIST) as $key => $value ) { |
|
| 511 | - if ( !empty($order_address['address']['country']) && $key == $order_address['address']['country']) { |
|
| 510 | + foreach (unserialize(WPSHOP_COUNTRY_LIST) as $key => $value) { |
|
| 511 | + if (!empty($order_address['address']['country']) && $key == $order_address['address']['country']) { |
|
| 512 | 512 | $country = $value; |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | $customer_country = $country; |
| 516 | 516 | |
| 517 | 517 | ob_start(); |
| 518 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_addresses_template_for_mail") ); |
|
| 518 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_addresses_template_for_mail")); |
|
| 519 | 519 | $message .= ob_get_contents(); |
| 520 | 520 | ob_end_clean(); |
| 521 | 521 | } |
@@ -531,21 +531,21 @@ discard block |
||
| 531 | 531 | * @param integer $order_id : Order ID |
| 532 | 532 | * @return string |
| 533 | 533 | */ |
| 534 | - function order_customer_comment_template_for_mail ( $order_id ) { |
|
| 534 | + function order_customer_comment_template_for_mail($order_id) { |
|
| 535 | 535 | global $wpdb; |
| 536 | 536 | $message = ''; |
| 537 | - if ( !empty($order_id) ) { |
|
| 538 | - $query = $wpdb->prepare('SELECT post_excerpt FROM ' .$wpdb->posts. ' WHERE ID = %d', $order_id); |
|
| 539 | - $comment = $wpdb->get_var( $query ); |
|
| 537 | + if (!empty($order_id)) { |
|
| 538 | + $query = $wpdb->prepare('SELECT post_excerpt FROM ' . $wpdb->posts . ' WHERE ID = %d', $order_id); |
|
| 539 | + $comment = $wpdb->get_var($query); |
|
| 540 | 540 | $order_infos = get_post_meta($order_id, '_order_postmeta', true); |
| 541 | - if ( !empty($order_infos['order_key']) ) { |
|
| 542 | - $comment_title = __('Comments about the order', 'wpshop'); |
|
| 541 | + if (!empty($order_infos['order_key'])) { |
|
| 542 | + $comment_title = __('Comments about the order', 'wpshop'); |
|
| 543 | 543 | } |
| 544 | 544 | else { |
| 545 | - $comment_title = __('Comments about the quotation', 'wpshop'); |
|
| 545 | + $comment_title = __('Comments about the quotation', 'wpshop'); |
|
| 546 | 546 | } |
| 547 | 547 | ob_start(); |
| 548 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_email_customer_comments") ); |
|
| 548 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_email_customer_comments")); |
|
| 549 | 549 | $message .= ob_get_contents(); |
| 550 | 550 | ob_end_clean(); |
| 551 | 551 | } |
@@ -560,15 +560,15 @@ discard block |
||
| 560 | 560 | global $wpdb; |
| 561 | 561 | $user_id = get_current_user_id(); |
| 562 | 562 | $message = ''; |
| 563 | - $customer_entity = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ); |
|
| 564 | - if( !empty($customer_entity) ) { |
|
| 563 | + $customer_entity = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
| 564 | + if (!empty($customer_entity)) { |
|
| 565 | 565 | |
| 566 | - $query = $wpdb->prepare( 'SELECT * FROM '.WPSHOP_DBT_ATTRIBUTE_SET. ' WHERE entity_id = %d AND status = %s', $customer_entity, 'valid' ); |
|
| 567 | - $attributes_sets = $wpdb->get_results( $query ); |
|
| 566 | + $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d AND status = %s', $customer_entity, 'valid'); |
|
| 567 | + $attributes_sets = $wpdb->get_results($query); |
|
| 568 | 568 | |
| 569 | - if( !empty($attributes_sets) ) { |
|
| 569 | + if (!empty($attributes_sets)) { |
|
| 570 | 570 | ob_start(); |
| 571 | - require( wpshop_tools::get_template_part( WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_personnal_informations_template_for_mail") ); |
|
| 571 | + require(wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_personnal_informations_template_for_mail")); |
|
| 572 | 572 | $message .= ob_get_contents(); |
| 573 | 573 | ob_end_clean(); |
| 574 | 574 | } |
@@ -579,15 +579,15 @@ discard block |
||
| 579 | 579 | /** |
| 580 | 580 | * Support historic messages |
| 581 | 581 | */ |
| 582 | - function wpshop_messages_historic_correction () { |
|
| 582 | + function wpshop_messages_historic_correction() { |
|
| 583 | 583 | global $wpdb; |
| 584 | - $query = $wpdb->prepare('SELECT * FROM ' .$wpdb->postmeta. ' WHERE meta_key LIKE %s', '_wpshop_messages_histo_%'); |
|
| 585 | - $messages_histo = $wpdb->get_results( $query ); |
|
| 584 | + $query = $wpdb->prepare('SELECT * FROM ' . $wpdb->postmeta . ' WHERE meta_key LIKE %s', '_wpshop_messages_histo_%'); |
|
| 585 | + $messages_histo = $wpdb->get_results($query); |
|
| 586 | 586 | |
| 587 | - foreach ( $messages_histo as $message ) { |
|
| 588 | - $query_user = $wpdb->prepare( 'SELECT ID FROM ' .$wpdb->posts. ' WHERE post_author = %d AND post_type = %s', $message->post_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
| 589 | - $user_post_id = $wpdb->get_var( $query_user ); |
|
| 590 | - $wpdb->update($wpdb->postmeta, array('post_id' => $user_post_id ), array('meta_id' => $message->meta_id ) ); |
|
| 587 | + foreach ($messages_histo as $message) { |
|
| 588 | + $query_user = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_author = %d AND post_type = %s', $message->post_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
| 589 | + $user_post_id = $wpdb->get_var($query_user); |
|
| 590 | + $wpdb->update($wpdb->postmeta, array('post_id' => $user_post_id), array('meta_id' => $message->meta_id)); |
|
| 591 | 591 | } |
| 592 | 592 | } |
| 593 | 593 | |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | * Récupères le contenu du message |
| 597 | 597 | */ |
| 598 | 598 | public function get_content_message() { |
| 599 | - $_wpnonce = !empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : ''; |
|
| 599 | + $_wpnonce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : ''; |
|
| 600 | 600 | |
| 601 | - if ( !wp_verify_nonce( $_wpnonce, 'get_content_message' ) ) |
|
| 601 | + if (!wp_verify_nonce($_wpnonce, 'get_content_message')) |
|
| 602 | 602 | wp_die(); |
| 603 | 603 | |
| 604 | 604 | global $wpdb; |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | $result = unserialize($result[0]->meta_value); |
| 609 | 609 | $result = $result[0]['mess_message']; |
| 610 | 610 | |
| 611 | - wp_die( $result ); |
|
| 611 | + wp_die($result); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | } |