Completed
Push — master ( f161aa...d0d50d )
by
unknown
15:24
created
wps-pos-addon/modules/wps_customer_quick_add/wps_customer_quick_add.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3
-DEFINE( 'WPSPOSCLTQUICK_VERSION', 1.0 );
4
-DEFINE( 'WPSPOSCLTQUICK_DIR', basename( dirname( __FILE__ ) ) );
5
-DEFINE( 'WPSPOSCLTQUICK_PATH', str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) );
6
-DEFINE( 'WPSPOSCLTQUICK_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPSPOSCLTQUICK_PATH ) );
3
+DEFINE('WPSPOSCLTQUICK_VERSION', 1.0);
4
+DEFINE('WPSPOSCLTQUICK_DIR', basename(dirname(__FILE__)));
5
+DEFINE('WPSPOSCLTQUICK_PATH', str_replace("\\", "/", plugin_dir_path(__FILE__)));
6
+DEFINE('WPSPOSCLTQUICK_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPSPOSCLTQUICK_PATH));
7 7
 
8 8
 /**	Définition du chemin absolu vers les templates / Define the templates absolute directories	*/
9
-DEFINE( 'WPSPOSCLTQUICK_TEMPLATES_MAIN_DIR', WPSPOSCLTQUICK_PATH . '/templates/');
9
+DEFINE('WPSPOSCLTQUICK_TEMPLATES_MAIN_DIR', WPSPOSCLTQUICK_PATH . '/templates/');
10 10
 
11 11
 
12 12
 /** Inclusion des différents composants / Include plugin components */
13
-require_once( WPSPOSCLTQUICK_PATH . 'controller/wps_customer_quick_add.ctr.php' );
13
+require_once(WPSPOSCLTQUICK_PATH . 'controller/wps_customer_quick_add.ctr.php');
14 14
 /**	Instanciation du controlleur principal / Main controller instanciation	*/
15 15
 $wpspos_customer_quick_add = new wpspos_customer_quick_add();
16 16
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 DEFINE( 'WPSPOSCLTQUICK_VERSION', 1.0 );
4 6
 DEFINE( 'WPSPOSCLTQUICK_DIR', basename( dirname( __FILE__ ) ) );
Please login to merge, or discard this patch.
modules/wps_customer_quick_add/templates/backend/customer-creation.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <div class="wps-customer-quick-add-alert-box wps-alert hidden" ></div>
4 6
 <form id="create_new_customer_pos_addon" action="<?php echo admin_url('admin-ajax.php'); ?>" method="post" >
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <div class="wps-customer-quick-add-alert-box wps-alert hidden" ></div>
4 4
 <form id="create_new_customer_pos_addon" action="<?php echo admin_url('admin-ajax.php'); ?>" method="post" >
5 5
 <?php
6 6
 	global $wpdb;
7
-	$query = $wpdb->prepare( "SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE name = %s", __( 'Billing address', 'wpshop' ) );
8
-	$attribute_set_id = $wpdb->get_var( $query );
7
+	$query = $wpdb->prepare("SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE name = %s", __('Billing address', 'wpshop'));
8
+	$attribute_set_id = $wpdb->get_var($query);
9 9
 ?>
10 10
 	<input type="hidden" name="action" value="wpspos-customer-quick-add" />
11
-	<?php wp_nonce_field( 'create_customer' ); ?>
11
+	<?php wp_nonce_field('create_customer'); ?>
12 12
 	<input type="hidden" name="wps-customer-account-set-id" value="<?php echo $attribute_set_id; ?>" />
13 13
 
14
-	<?php if ( !empty( $customer_attributes ) ) : ?>
15
-		<?php foreach ( $customer_attributes as $customer_attribute_group ) : ?>
14
+	<?php if (!empty($customer_attributes)) : ?>
15
+		<?php foreach ($customer_attributes as $customer_attribute_group) : ?>
16 16
 	<div class="wps-boxed">
17
-		<span class="wps-h5"><?php echo stripslashes( $customer_attribute_group['name'] ); ?></span>
17
+		<span class="wps-h5"><?php echo stripslashes($customer_attribute_group['name']); ?></span>
18 18
 <?php
19
-		foreach ( $customer_attribute_group[ 'attribut' ] as $attribute ) :
20
-			if( !empty($attribute->code) ) {
21
-				$output = wpshop_attributes::display_attribute( $attribute->code );
22
-				if( empty($output['field_definition']['type']) || $output['field_definition']['type'] != 'hidden' ) {
23
-					echo $output[ 'field' ];
19
+		foreach ($customer_attribute_group['attribut'] as $attribute) :
20
+			if (!empty($attribute->code)) {
21
+				$output = wpshop_attributes::display_attribute($attribute->code);
22
+				if (empty($output['field_definition']['type']) || $output['field_definition']['type'] != 'hidden') {
23
+					echo $output['field'];
24 24
 				}
25 25
 			}
26 26
 		endforeach;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		<?php endforeach; ?>
30 30
 	<?php endif; ?>
31 31
 
32
-	<button class="wps-bton-first-mini-rounded alignRight wps-bton-loader" id="wps-customer-quick-creation-button" ><?php _e( 'Add customer', 'wpshop'); ?></button>
32
+	<button class="wps-bton-first-mini-rounded alignRight wps-bton-loader" id="wps-customer-quick-creation-button" ><?php _e('Add customer', 'wpshop'); ?></button>
33 33
 </form>
34 34
 <script type="text/javascript" >
35 35
 	jQuery( document ).ready( function() {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			        }
45 45
 			    }
46 46
 			    if ( has_error ) {
47
-		            alert( wpshopConvertAccentTojs( "<?php _e( 'Please fill all fields mark as required', 'wpshop' ); ?>" ) );
47
+		            alert( wpshopConvertAccentTojs( "<?php _e('Please fill all fields mark as required', 'wpshop'); ?>" ) );
48 48
 		            return false;
49 49
 			    }
50 50
 			},
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				if ( responseText[ 'status' ] ) {
54 54
 					message_status = 'wps-alert-success';
55 55
 					$form[0].reset();
56
-					wpspos_set_customer_for_order( responseText[ 'customer_id' ], '<?php echo wp_create_nonce( 'ajax_pos_customer_choice' ); ?>' );
56
+					wpspos_set_customer_for_order( responseText[ 'customer_id' ], '<?php echo wp_create_nonce('ajax_pos_customer_choice'); ?>' );
57 57
 
58 58
 					if ( jQuery( ".wps-pos-customer-letter-choice-" + responseText[ 'letter' ] ).hasClass( "wps-bton-third-rounded" ) ) {
59 59
 						jQuery( ".wps-pos-customer-letter-choice-" + responseText[ 'letter' ] ).click();
Please login to merge, or discard this patch.
modules/wps_product_quick_add/templates/backend/attribute-list.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 	<div id="wps-product-quick-creation-form-attributes" class="wps-bloc-loader" >
4
-		<?php $attribute_list = wpshop_attributes_set::getAttributeSetDetails( $chosen_set ); ?>
5
-		<?php if ( !empty( $attribute_list ) ) : ?>
6
-			<?php foreach( $attribute_list as $attribute_set ) : ?>
4
+		<?php $attribute_list = wpshop_attributes_set::getAttributeSetDetails($chosen_set); ?>
5
+		<?php if (!empty($attribute_list)) : ?>
6
+			<?php foreach ($attribute_list as $attribute_set) : ?>
7 7
 			<?php
8 8
 				$attributes = '';
9
-				foreach($attribute_set['attribut'] as $attribute_key => $attribute) {
10
-					if( !empty( $attribute_key ) && ( $attribute->status == 'valid' ) && ( 'yes' == $attribute->is_used_in_quick_add_form ) ) {
11
-						$output = wpshop_attributes::display_attribute( $attribute->code );
9
+				foreach ($attribute_set['attribut'] as $attribute_key => $attribute) {
10
+					if (!empty($attribute_key) && ($attribute->status == 'valid') && ('yes' == $attribute->is_used_in_quick_add_form)) {
11
+						$output = wpshop_attributes::display_attribute($attribute->code);
12 12
 						$attributes .= $output['field'];
13 13
 					}
14 14
 				}
15 15
 			?>
16
-			<?php if ( !empty( $attributes ) ) : ?>
16
+			<?php if (!empty($attributes)) : ?>
17 17
 	<div class="wps-boxed">
18 18
 		<span class="wps-h5"><?php echo $attribute_set['name']; ?></span>
19 19
 		<?php echo $attributes; ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 	<div id="wps-product-quick-creation-form-attributes" class="wps-bloc-loader" >
4 6
 		<?php $attribute_list = wpshop_attributes_set::getAttributeSetDetails( $chosen_set ); ?>
Please login to merge, or discard this patch.
wps-pos-addon/modules/wps_product_quick_add/wps_product_quick_add.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3
-DEFINE( 'WPSPOSPDTQUICK_VERSION', 1.0 );
4
-DEFINE( 'WPSPOSPDTQUICK_DIR', basename( dirname( __FILE__ ) ) );
5
-DEFINE( 'WPSPOSPDTQUICK_PATH', str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) );
6
-DEFINE( 'WPSPOSPDTQUICK_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPSPOSPDTQUICK_PATH ) );
3
+DEFINE('WPSPOSPDTQUICK_VERSION', 1.0);
4
+DEFINE('WPSPOSPDTQUICK_DIR', basename(dirname(__FILE__)));
5
+DEFINE('WPSPOSPDTQUICK_PATH', str_replace("\\", "/", plugin_dir_path(__FILE__)));
6
+DEFINE('WPSPOSPDTQUICK_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPSPOSPDTQUICK_PATH));
7 7
 
8 8
 /**	Définition du chemin absolu vers les templates / Define the templates absolute directories	*/
9
-DEFINE( 'WPSPOSPDTQUICK_TEMPLATES_MAIN_DIR', WPSPOSPDTQUICK_PATH . '/templates/');
9
+DEFINE('WPSPOSPDTQUICK_TEMPLATES_MAIN_DIR', WPSPOSPDTQUICK_PATH . '/templates/');
10 10
 
11 11
 
12 12
 /** Inclusion des différents composants / Include plugin components */
13
-require_once( WPSPOSPDTQUICK_PATH . 'controller/wps_product_quick_add.ctr.php' );
13
+require_once(WPSPOSPDTQUICK_PATH . 'controller/wps_product_quick_add.ctr.php');
14 14
 /**	Instanciation du controlleur principal / Main controller instanciation	*/
15 15
 $wpspos_product_quick_add = new wpspos_product_quick_add();
16 16
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 DEFINE( 'WPSPOSPDTQUICK_VERSION', 1.0 );
4 6
 DEFINE( 'WPSPOSPDTQUICK_DIR', basename( dirname( __FILE__ ) ) );
Please login to merge, or discard this patch.
includes/modules/wps_highlighting/config/config.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,2 +1,2 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
-DEFINE( 'WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING', 'wps_highlighting');
3 1
\ No newline at end of file
2
+<?php if (!defined('ABSPATH')) exit;
3
+DEFINE('WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING', 'wps_highlighting');
4 4
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,2 +1,4 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 DEFINE( 'WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING', 'wps_highlighting');
3 5
\ No newline at end of file
Please login to merge, or discard this patch.
includes/modules/wps_highlighting/controller/wps_highlighting_ctr.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 class wps_highlighting_ctr {
3 5
 
4 6
 	/** Define the main directory containing the template for the current plugin
@@ -80,8 +82,7 @@  discard block
 block discarded – undo
80 82
 				$wps_pos_menu_ordered[] = 'edit.php?post_type=wps_highlighting';
81 83
 
82 84
 				unset( $current_menu_order[ array_search( 'edit.php?post_type=wps_highlighting', $current_menu_order ) ] );
83
-			}
84
-			else if ( 'edit.php?post_type=wps_highlighting' != $menu_item ) {
85
+			} else if ( 'edit.php?post_type=wps_highlighting' != $menu_item ) {
85 86
 				$wps_pos_menu_ordered[] = $menu_item;
86 87
 			}
87 88
 		}
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 class wps_highlighting_ctr {
3 3
 
4 4
 	/** Define the main directory containing the template for the current plugin
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 
14 14
 	function __construct() {
15 15
 		$this->template_dir = WPS_HIGHLIGHTING_PATH . WPS_HIGHLIGHTING_DIR . "/templates/";
16
-		add_action( 'init', array($this, 'register_post_type') );
17
-		add_action( 'add_meta_boxes', array($this, 'add_meta_boxes') );
18
-		add_action( 'save_post', array($this, 'save_post_action') );
16
+		add_action('init', array($this, 'register_post_type'));
17
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
18
+		add_action('save_post', array($this, 'save_post_action'));
19 19
 
20 20
 		/**	Red�finition de l'ordre des menus / Arrangements for displaying menu under wpshop menu	*/
21
-		add_action( 'menu_order', array( $this, 'admin_menu_order' ), 11 );
21
+		add_action('menu_order', array($this, 'admin_menu_order'), 11);
22 22
 
23
-		add_shortcode( 'wps_highlighting', array( $this, 'display_highlightings' ) );
23
+		add_shortcode('wps_highlighting', array($this, 'display_highlightings'));
24 24
 	}
25 25
 
26 26
 	/**
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	function register_post_type() {
30 30
 		$labels = array(
31
-				'name'               => __( 'Highlighting', 'wps_highlighting' ),
32
-				'singular_name'      => __( 'Highlighting', 'wps_highlighting' ),
33
-				'menu_name'          => __( 'Highlightings', 'wps_highlighting' ),
34
-				'add_new'            => __( 'Add new highlighting', 'wps_highlighting' ),
35
-				'add_new_item'       => __( 'Add new highlighting', 'wps_highlighting' ),
36
-				'new_item'           => __( 'New Highlighting', 'wps_highlighting' ),
37
-				'edit_item'          => __( 'Edit Highlighting', 'wps_highlighting' ),
38
-				'view_item'          => __( 'View Highlighting', 'wps_highlighting' ),
39
-				'all_items'          => __( 'All Highlightings', 'wps_highlighting' ),
40
-				'search_items'       => __( 'Search Highlighting', 'wps_highlighting' ),
41
-				'parent_item_colon'  => __( 'Parent Highlighting :', 'wps_highlighting' ),
42
-				'not_found'          => __( 'No Highlighting found.', 'wps_highlighting' ),
43
-				'not_found_in_trash' => __( 'No Highlightings found in Trash.', 'wps_highlighting' ),
31
+				'name'               => __('Highlighting', 'wps_highlighting'),
32
+				'singular_name'      => __('Highlighting', 'wps_highlighting'),
33
+				'menu_name'          => __('Highlightings', 'wps_highlighting'),
34
+				'add_new'            => __('Add new highlighting', 'wps_highlighting'),
35
+				'add_new_item'       => __('Add new highlighting', 'wps_highlighting'),
36
+				'new_item'           => __('New Highlighting', 'wps_highlighting'),
37
+				'edit_item'          => __('Edit Highlighting', 'wps_highlighting'),
38
+				'view_item'          => __('View Highlighting', 'wps_highlighting'),
39
+				'all_items'          => __('All Highlightings', 'wps_highlighting'),
40
+				'search_items'       => __('Search Highlighting', 'wps_highlighting'),
41
+				'parent_item_colon'  => __('Parent Highlighting :', 'wps_highlighting'),
42
+				'not_found'          => __('No Highlighting found.', 'wps_highlighting'),
43
+				'not_found_in_trash' => __('No Highlightings found in Trash.', 'wps_highlighting'),
44 44
 		);
45 45
 
46 46
 		$args = array(
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 				'show_in_menu'       => false,
52 52
 				'menu_icon'			 => 'dashicons-star-filled',
53 53
 				'query_var'          => true,
54
-				'rewrite'            => array( 'slug' => WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING ),
54
+				'rewrite'            => array('slug' => WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING),
55 55
 				'capability_type'    => 'post',
56 56
 				'has_archive'        => false,
57 57
 				'hierarchical'       => true,
58 58
 				'menu_position'      => null,
59
-				'supports'           => array( 'title', 'editor', 'thumbnail' )
59
+				'supports'           => array('title', 'editor', 'thumbnail')
60 60
 		);
61 61
 
62
-		register_post_type( WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING, $args );
62
+		register_post_type(WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING, $args);
63 63
 	}
64 64
 
65 65
 	/**
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return array The new admin menu order with the POS addon placed
71 71
 	 */
72
-	function admin_menu_order( $current_menu_order ) {
72
+	function admin_menu_order($current_menu_order) {
73 73
 		/**	Create a new menu order	*/
74 74
 		$wps_pos_menu_ordered = array();
75 75
 
76 76
 		/**	Read the current existing menu order for rearrange it	*/
77
-		foreach ( $current_menu_order as $menu_item ) {
78
-			if ( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS == $menu_item ) {
77
+		foreach ($current_menu_order as $menu_item) {
78
+			if ('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS == $menu_item) {
79 79
 				$wps_pos_menu_ordered[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS;
80 80
 				$wps_pos_menu_ordered[] = 'edit.php?post_type=wps_highlighting';
81 81
 
82
-				unset( $current_menu_order[ array_search( 'edit.php?post_type=wps_highlighting', $current_menu_order ) ] );
82
+				unset($current_menu_order[array_search('edit.php?post_type=wps_highlighting', $current_menu_order)]);
83 83
 			}
84
-			else if ( 'edit.php?post_type=wps_highlighting' != $menu_item ) {
84
+			else if ('edit.php?post_type=wps_highlighting' != $menu_item) {
85 85
 				$wps_pos_menu_ordered[] = $menu_item;
86 86
 			}
87 87
 		}
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * Add Meta Box
94 94
 	 */
95 95
 	function add_meta_boxes() {
96
-		add_meta_box( 'wps_highlighting_meta_box', __( 'Select the hook', 'wps_highlighting'), array( $this, 'meta_box_content' ), WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING, 'side', 'default');
97
-		add_meta_box( 'wps_highlighting_meta_box_link', __( 'Link of Highlighting', 'wps_highlighting'), array( $this, 'meta_box_content_link' ), WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING, 'side', 'default');
96
+		add_meta_box('wps_highlighting_meta_box', __('Select the hook', 'wps_highlighting'), array($this, 'meta_box_content'), WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING, 'side', 'default');
97
+		add_meta_box('wps_highlighting_meta_box_link', __('Link of Highlighting', 'wps_highlighting'), array($this, 'meta_box_content_link'), WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING, 'side', 'default');
98 98
 	}
99 99
 
100 100
 	/**
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
 	function meta_box_content() {
104 104
 		global $post;
105 105
 
106
-		$hook = get_post_meta( $post->ID, '_wps_highlighting_hook', true );
106
+		$hook = get_post_meta($post->ID, '_wps_highlighting_hook', true);
107 107
 		$output  = '<select name="wps_highlighting_hook">';
108
-		$output .= '<option value="sidebar" ' .( ( !empty($hook) && $hook == 'sidebar' ) ? 'selected="selected"' : '' ). '>' .__( 'Sidebar', 'wps_highlighting' ). '</option>';
109
-		$output .= '<option value="home" ' .( ( !empty($hook) && $hook == 'home' ) ? 'selected="selected"' : '' ). '>' .__( 'HomePage Content', 'wps_highlighting' ). '</option>';
108
+		$output .= '<option value="sidebar" ' . ((!empty($hook) && $hook == 'sidebar') ? 'selected="selected"' : '') . '>' . __('Sidebar', 'wps_highlighting') . '</option>';
109
+		$output .= '<option value="home" ' . ((!empty($hook) && $hook == 'home') ? 'selected="selected"' : '') . '>' . __('HomePage Content', 'wps_highlighting') . '</option>';
110 110
 		$output .= '</select>';
111 111
 		$output .= '<hr/>';
112
-		$output .= '<div style="padding : 5px; background #CCC;"><u><strong>' .__( 'shortcode for display Highlightings', 'wpshop'). '</strong></u><ul><li><u>Home page content :</u> [wps_highlighting hook_name="home"]</li><li><u>Sidebar :</u> [wps_highlighting hook_name="sidebar"]</li><ul></div>';
112
+		$output .= '<div style="padding : 5px; background #CCC;"><u><strong>' . __('shortcode for display Highlightings', 'wpshop') . '</strong></u><ul><li><u>Home page content :</u> [wps_highlighting hook_name="home"]</li><li><u>Sidebar :</u> [wps_highlighting hook_name="sidebar"]</li><ul></div>';
113 113
 		echo $output;
114 114
 	}
115 115
 
116 116
 	function meta_box_content_link() {
117 117
 		global $post;
118
-		$link = get_post_meta( $post->ID, '_wps_highlighting_link', true );
119
-		$output  = '<label for="wps_highlighting_link">' .__( 'Link of Highlighting', 'wps_highlighting' ). '</label><br/>';
120
-		$output .= '<input type="text" id="wps_highlighting_link" name="wps_highlighting_link" value="' .$link. '" />';
118
+		$link = get_post_meta($post->ID, '_wps_highlighting_link', true);
119
+		$output  = '<label for="wps_highlighting_link">' . __('Link of Highlighting', 'wps_highlighting') . '</label><br/>';
120
+		$output .= '<input type="text" id="wps_highlighting_link" name="wps_highlighting_link" value="' . $link . '" />';
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 * Save action
126 126
 	 */
127 127
 	function save_post_action() {
128
-		$post_type = !empty( $_POST['post_type'] ) ? sanitize_text_field( $_POST['post_type'] ) : '';
129
-		if( !empty($post_type) && !empty($post_type) && $post_type == WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING ) {
130
-			$wps_highlighting_hook = !empty( $_POST['wps_highlighting_hook'] ) ? sanitize_text_field( $_POST['wps_highlighting_hook'] ) : '';
131
-			$wps_highlighting_link = !empty( $_POST['wps_highlighting_link'] ) ? sanitize_text_field( $_POST['wps_highlighting_link'] ) : '';
132
-			$post_ID = !empty( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
133
-			if( !empty($wps_highlighting_hook) ) {
134
-				update_post_meta( $post_ID, '_wps_highlighting_hook', $wps_highlighting_hook );
128
+		$post_type = !empty($_POST['post_type']) ? sanitize_text_field($_POST['post_type']) : '';
129
+		if (!empty($post_type) && !empty($post_type) && $post_type == WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING) {
130
+			$wps_highlighting_hook = !empty($_POST['wps_highlighting_hook']) ? sanitize_text_field($_POST['wps_highlighting_hook']) : '';
131
+			$wps_highlighting_link = !empty($_POST['wps_highlighting_link']) ? sanitize_text_field($_POST['wps_highlighting_link']) : '';
132
+			$post_ID = !empty($_POST['post_ID']) ? (int)$_POST['post_ID'] : 0;
133
+			if (!empty($wps_highlighting_hook)) {
134
+				update_post_meta($post_ID, '_wps_highlighting_hook', $wps_highlighting_hook);
135 135
 			}
136
-			update_post_meta( $post_ID, '_wps_highlighting_link', $wps_highlighting_link );
136
+			update_post_meta($post_ID, '_wps_highlighting_link', $wps_highlighting_link);
137 137
 		}
138 138
 	}
139 139
 
140
-	function get_data_for_hook( $hook ) {
140
+	function get_data_for_hook($hook) {
141 141
 		$highlightings_datas = array();
142
-		if( !empty($hook) ) {
142
+		if (!empty($hook)) {
143 143
 			$wps_highlighting_mdl = new wps_highlighting_model();
144
-			$highlightings = $wps_highlighting_mdl->get_highlighting( $hook );
145
-			if( !empty($highlightings) ) {
146
-				foreach( $highlightings as $highlighting ) {
147
-					$wps_highlighting = new wps_highlighting_model( $highlighting['post_data']->ID, $highlighting['post_data']->post_title, $highlighting['post_meta']['hook'], $highlighting['post_meta']['link'] );
144
+			$highlightings = $wps_highlighting_mdl->get_highlighting($hook);
145
+			if (!empty($highlightings)) {
146
+				foreach ($highlightings as $highlighting) {
147
+					$wps_highlighting = new wps_highlighting_model($highlighting['post_data']->ID, $highlighting['post_data']->post_title, $highlighting['post_meta']['hook'], $highlighting['post_meta']['link']);
148 148
 					$wps_highlighting->post_content = $highlighting['post_data']->post_content;
149 149
 					$highlightings_datas[] = $wps_highlighting;
150 150
 				}
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 		return $highlightings_datas;
154 154
 	}
155 155
 
156
-	function display_highlightings( $args ) {
156
+	function display_highlightings($args) {
157 157
 		$output = $highlightings = '';
158
-		if( !empty($args) && !empty($args['hook_name']) ) {
159
-			$datas = $this->get_data_for_hook( $args['hook_name'] );
158
+		if (!empty($args) && !empty($args['hook_name'])) {
159
+			$datas = $this->get_data_for_hook($args['hook_name']);
160 160
 			//Display in Template
161
-			if( !empty($datas) ) {
162
-				foreach( $datas as $data ) {
161
+			if (!empty($datas)) {
162
+				foreach ($datas as $data) {
163 163
 					ob_start();
164
-					require( wpshop_tools::get_template_part( WPS_HIGHLIGHTING_DIR, $this->template_dir,"frontend", "highlighting") );
164
+					require(wpshop_tools::get_template_part(WPS_HIGHLIGHTING_DIR, $this->template_dir, "frontend", "highlighting"));
165 165
 					$highlightings .= ob_get_contents();
166 166
 					ob_end_clean();
167 167
 				}
Please login to merge, or discard this patch.
includes/modules/wps_highlighting/templates/frontend/highlighting.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <div>
4
-	<a href="<?php echo ( ( !empty($data->link) ) ? $data->link : '#' ); ?>" title="<?php echo ( ($data->title) ? $data->title : '' ); ?>">
5
-		<?php if( !empty($data->id) ) : ?>
6
-		<?php echo get_the_post_thumbnail( $data->id, 'medium' ); ?>
4
+	<a href="<?php echo ((!empty($data->link)) ? $data->link : '#'); ?>" title="<?php echo (($data->title) ? $data->title : ''); ?>">
5
+		<?php if (!empty($data->id)) : ?>
6
+		<?php echo get_the_post_thumbnail($data->id, 'medium'); ?>
7 7
 		<?php echo $data->post_content; ?>
8 8
 		<?php endif; ?>
9 9
 	</a>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <div>
4 6
 	<a href="<?php echo ( ( !empty($data->link) ) ? $data->link : '#' ); ?>" title="<?php echo ( ($data->title) ? $data->title : '' ); ?>">
Please login to merge, or discard this patch.
includes/modules/wps_highlighting/model/wps_highlighting_model.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 class wps_highlighting_model {
3 3
 	
4 4
 	var $id;
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 	var $hook;
7 7
 	var $link;
8 8
 	
9
-	function __construct( $id = '',  $title = '', $hook = '', $link = '') {
10
-		if( !empty($id) ) {
9
+	function __construct($id = '', $title = '', $hook = '', $link = '') {
10
+		if (!empty($id)) {
11 11
 			$this->id = $id;
12 12
 			$this->title = $title;
13 13
 			$this->hook = $hook;
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 		}
16 16
 	}
17 17
 	
18
-	function Create( $title, $hook, $link ) {
19
-		if( empty($this->id) ) {
20
-			if( !empty($title) && !empty($hook) && !empty($link) ) {
18
+	function Create($title, $hook, $link) {
19
+		if (empty($this->id)) {
20
+			if (!empty($title) && !empty($hook) && !empty($link)) {
21 21
 				$this->title = $title;
22 22
 				$this->hook = $hook;
23 23
 				$this->link = $link;
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
 		}
26 26
 	}
27 27
 	
28
-	function get_highlighting( $hook = '', $id = '' ) {
28
+	function get_highlighting($hook = '', $id = '') {
29 29
 		global $wpdb;
30 30
 		$data = array();
31
-		if( !empty($id) ) {
32
-			$highlighting  = get_post( $id );
33
-			$hook_metadata = get_post_meta( $id, '_wps_highlighting_hook', true );
34
-			$link_metadata = get_post_meta( $id, '_wps_highlighting_link', true );
31
+		if (!empty($id)) {
32
+			$highlighting  = get_post($id);
33
+			$hook_metadata = get_post_meta($id, '_wps_highlighting_hook', true);
34
+			$link_metadata = get_post_meta($id, '_wps_highlighting_link', true);
35 35
 			// Fill Data
36 36
 			$data[0]['post_data'] = $highlighting;
37 37
 			$data[0]['post_meta']['hook'] = $hook_metadata;
38 38
 			$data[0]['post_meta']['link'] = $link_metadata;
39 39
 		}
40 40
 		else {
41
-			$highlightings = get_posts( array( 'posts_per_page' => -1, 'post_type' => WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING ) );
42
-			foreach( $highlightings as $highlighting ) {
43
-				$hook_metadata = get_post_meta( $highlighting->ID, '_wps_highlighting_hook', true );
44
-				$link_metadata = get_post_meta( $highlighting->ID, '_wps_highlighting_link', true );
41
+			$highlightings = get_posts(array('posts_per_page' => -1, 'post_type' => WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING));
42
+			foreach ($highlightings as $highlighting) {
43
+				$hook_metadata = get_post_meta($highlighting->ID, '_wps_highlighting_hook', true);
44
+				$link_metadata = get_post_meta($highlighting->ID, '_wps_highlighting_link', true);
45 45
 				// Fill Data
46
-				if( empty($hook) || ( !empty($hook) && $hook == $hook_metadata ) ) {
46
+				if (empty($hook) || (!empty($hook) && $hook == $hook_metadata)) {
47 47
 					$data[$highlighting->ID]['post_data'] = $highlighting;
48 48
 					$data[$highlighting->ID]['post_meta']['hook'] = $hook_metadata;
49 49
 					$data[$highlighting->ID]['post_meta']['link'] = $link_metadata;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 class wps_highlighting_model {
3 5
 	
4 6
 	var $id;
@@ -36,8 +38,7 @@  discard block
 block discarded – undo
36 38
 			$data[0]['post_data'] = $highlighting;
37 39
 			$data[0]['post_meta']['hook'] = $hook_metadata;
38 40
 			$data[0]['post_meta']['link'] = $link_metadata;
39
-		}
40
-		else {
41
+		} else {
41 42
 			$highlightings = get_posts( array( 'posts_per_page' => -1, 'post_type' => WPS_NEWTYPE_IDENTIFIER_HIGHLIGHTING ) );
42 43
 			foreach( $highlightings as $highlighting ) {
43 44
 				$hook_metadata = get_post_meta( $highlighting->ID, '_wps_highlighting_hook', true );
Please login to merge, or discard this patch.
includes/modules/wps_highlighting/wps_highlighting.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /**
4 4
  * Bootstrap file
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
  * @version 1.0
7 7
  */
8 8
 
9
-DEFINE('WPS_HIGHLIGHTING_DIR', basename(dirname(__FILE__)) );
10
-DEFINE('WPS_HIGHLIGHTING_PATH', str_replace( "\\", "/", str_replace( WPS_HIGHLIGHTING_DIR, "", dirname( __FILE__ ) ) ) );
11
-DEFINE('WPS_HIGHLIGHTING_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPS_HIGHLIGHTING_PATH ) );
9
+DEFINE('WPS_HIGHLIGHTING_DIR', basename(dirname(__FILE__)));
10
+DEFINE('WPS_HIGHLIGHTING_PATH', str_replace("\\", "/", str_replace(WPS_HIGHLIGHTING_DIR, "", dirname(__FILE__))));
11
+DEFINE('WPS_HIGHLIGHTING_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPS_HIGHLIGHTING_PATH));
12 12
 
13
-load_plugin_textdomain( 'wps_highlighting', false, dirname(plugin_basename( __FILE__ )).'/languages/' );
13
+load_plugin_textdomain('wps_highlighting', false, dirname(plugin_basename(__FILE__)) . '/languages/');
14 14
 
15
-include( plugin_dir_path( __FILE__ ).'/config/config.php' );
16
-include( plugin_dir_path( __FILE__ ).'/controller/wps_highlighting_ctr.php' );
17
-include( plugin_dir_path( __FILE__ ).'/model/wps_highlighting_model.php' );
15
+include(plugin_dir_path(__FILE__) . '/config/config.php');
16
+include(plugin_dir_path(__FILE__) . '/controller/wps_highlighting_ctr.php');
17
+include(plugin_dir_path(__FILE__) . '/model/wps_highlighting_model.php');
18 18
 
19 19
 $wps_highlight = new wps_highlighting_ctr();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /**
4 6
  * Bootstrap file
Please login to merge, or discard this patch.