@@ -1,16 +1,16 @@ |
||
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 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,16 +1,16 @@ |
||
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 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,2 +1,2 @@ |
||
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 |
@@ -1,3 +1,5 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <p><?php echo $content; ?></p> |
4 | 6 | \ No newline at end of file |
@@ -1,4 +1,6 @@ discard block |
||
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 |
||
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 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,9 +1,9 @@ |
||
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> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de gestion du modèle des taxinomies / File for term model management |
4 | 6 | * |
@@ -113,8 +115,7 @@ discard block |
||
113 | 115 | } |
114 | 116 | |
115 | 117 | return $object; |
116 | - } |
|
117 | - else { |
|
118 | + } else { |
|
118 | 119 | /** |
119 | 120 | * @todo return error when creation does not work |
120 | 121 | */ |
@@ -1,4 +1,4 @@ discard block |
||
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 |
||
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(); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * @author ALLEGRE Jérôme - Eoxia dev team <[email protected]> |
4 | 4 | * @version 0.1 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | /** Template Global vars **/ |
10 | 10 | DEFINE('WPS_MESSAGE_VERSION', '0.1'); |
11 | 11 | DEFINE('WPS_MESSAGE_DIR', basename(dirname(__FILE__))); |
12 | -DEFINE('WPS_MESSAGE_PATH', str_replace( "\\", "/", str_replace( WPS_MESSAGE_DIR, "", dirname( __FILE__ ) ) ) ); |
|
13 | -DEFINE('WPS_MESSAGE_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPS_MESSAGE_PATH ) ); |
|
12 | +DEFINE('WPS_MESSAGE_PATH', str_replace("\\", "/", str_replace(WPS_MESSAGE_DIR, "", dirname(__FILE__)))); |
|
13 | +DEFINE('WPS_MESSAGE_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPS_MESSAGE_PATH)); |
|
14 | 14 | |
15 | 15 | /** Require */ |
16 | -require_once( plugin_dir_path( __FILE__ ).'/controller/wps_message_ctr.php' ); |
|
17 | -require_once( plugin_dir_path( __FILE__ ).'/model/wps_message_mdl.php' ); |
|
16 | +require_once(plugin_dir_path(__FILE__) . '/controller/wps_message_ctr.php'); |
|
17 | +require_once(plugin_dir_path(__FILE__) . '/model/wps_message_mdl.php'); |
|
18 | 18 | |
19 | 19 | $wps_message = new wps_message_ctr(); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ 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 | - foreach( $messages_histo as $first_send_date => $messages ) : ?> |
|
12 | - <?php foreach( $messages as $key => $message ) : ?> |
|
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 | + foreach ($messages_histo as $first_send_date => $messages) : ?> |
|
12 | + <?php foreach ($messages as $key => $message) : ?> |
|
13 | 13 | |
14 | 14 | <div class="wps-table-content wps-table-row" data-date="<?php echo substr($first_send_date, 0, 7); ?>" > |
15 | 15 | <div class="wps-table-cell wps-message-title-container"> |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | <div id="wps-customer-message-<?php echo $message_special_id; ?>" style="display:none;" ><?php echo $message['message']; ?></div> |
19 | 19 | </div> |
20 | 20 | <div class="wps-table-cell"> |
21 | - <?php if( !empty($message['dates']) ) : ?> |
|
21 | + <?php if (!empty($message['dates'])) : ?> |
|
22 | 22 | <ul> |
23 | - <?php foreach( $message['dates'] as $date ) : ?> |
|
24 | - <li><?php echo mysql2date( get_option('date_format') . ' ' . get_option('time_format') , $date, true ); ?></li> |
|
23 | + <?php foreach ($message['dates'] as $date) : ?> |
|
24 | + <li><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $date, true); ?></li> |
|
25 | 25 | <?php endforeach; ?> |
26 | 26 | </ul> |
27 | 27 | <?php endif; ?> |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | <?php endforeach; |
31 | 31 | endforeach; ?> |
32 | 32 | </div> |
33 | - <?php if( $nb_pages_messages_histo != 1 ) { |
|
34 | - for( $i = 1; $i <= $nb_pages_messages_histo; $i++ ) { ?> |
|
35 | - <?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' ) . '>'; ?> |
|
33 | + <?php if ($nb_pages_messages_histo != 1) { |
|
34 | + for ($i = 1; $i <= $nb_pages_messages_histo; $i++) { ?> |
|
35 | + <?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') . '>'; ?> |
|
36 | 36 | <?php } |
37 | 37 | } ?> |
38 | 38 | <?php else: ?> |
39 | 39 | <div class="wps-alert-info"> |
40 | - <?php _e( 'No email was sent.', 'wpshop' ); ?> |
|
40 | + <?php _e('No email was sent.', 'wpshop'); ?> |
|
41 | 41 | </div> |
42 | 42 | <?php endif; ?> |
43 | 43 | \ No newline at end of file |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | if( !empty($messages_histo) && is_array($messages_histo) ) :?> |
3 | 5 | <div class="wps-table wps-my-message"> |
4 | 6 | <div class="wps-table-header wps-table-row"> |
@@ -35,8 +37,11 @@ discard block |
||
35 | 37 | <?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' ) . '>'; ?> |
36 | 38 | <?php } |
37 | 39 | } ?> |
38 | -<?php else: ?> |
|
40 | +<?php else { |
|
41 | + : ?> |
|
39 | 42 | <div class="wps-alert-info"> |
40 | - <?php _e( 'No email was sent.', 'wpshop' ); ?> |
|
43 | + <?php _e( 'No email was sent.', 'wpshop' ); |
|
44 | +} |
|
45 | +?> |
|
41 | 46 | </div> |
42 | 47 | <?php endif; ?> |
43 | 48 | \ No newline at end of file |