@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | public function __construct() { |
25 | 25 | $this->set_vars(); |
26 | 26 | |
27 | - add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
28 | - add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
27 | + add_filter('lsx_get_post-types_configs', array($this, 'post_type_config'), 10, 1); |
|
28 | + add_filter('lsx_get_metaboxes_configs', array($this, 'meta_box_config'), 10, 1); |
|
29 | 29 | |
30 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
31 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
30 | + add_filter('lsx_to_destination_custom_fields', array($this, 'custom_fields')); |
|
31 | + add_filter('lsx_to_tour_custom_fields', array($this, 'custom_fields')); |
|
32 | + add_filter('lsx_to_accommodation_custom_fields', array($this, 'custom_fields')); |
|
33 | 33 | |
34 | - add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); |
|
34 | + add_filter('lsx_to_team_custom_fields', array($this, 'custom_fields')); |
|
35 | + add_filter('lsx_to_special_custom_fields', array($this, 'custom_fields')); |
|
36 | + add_filter('lsx_to_activity_custom_fields', array($this, 'custom_fields')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param $objects |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function post_type_config( $objects ) { |
|
45 | + public function post_type_config($objects) { |
|
46 | 46 | |
47 | - foreach ( $this->post_types as $key => $label ) { |
|
48 | - if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
49 | - $objects[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
47 | + foreach ($this->post_types as $key => $label) { |
|
48 | + if (file_exists(LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php')) { |
|
49 | + $objects[$key] = include LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @param $meta_boxes |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function meta_box_config( $meta_boxes ) { |
|
63 | - foreach ( $this->post_types as $key => $label ) { |
|
64 | - if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
65 | - $meta_boxes[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
62 | + public function meta_box_config($meta_boxes) { |
|
63 | + foreach ($this->post_types as $key => $label) { |
|
64 | + if (file_exists(LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php')) { |
|
65 | + $meta_boxes[$key] = include LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | return $meta_boxes; |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | /** |
72 | 72 | * Adds in the fields to the Tour Operators Post Types. |
73 | 73 | */ |
74 | - public function custom_fields( $fields ) { |
|
74 | + public function custom_fields($fields) { |
|
75 | 75 | global $post, $typenow, $current_screen; |
76 | 76 | |
77 | 77 | $post_type = false; |
78 | - if ( $post && $post->post_type ) { |
|
78 | + if ($post && $post->post_type) { |
|
79 | 79 | $post_type = $post->post_type; |
80 | - } elseif ( $typenow ) { |
|
80 | + } elseif ($typenow) { |
|
81 | 81 | $post_type = $typenow; |
82 | - } elseif ( $current_screen && $current_screen->post_type ) { |
|
82 | + } elseif ($current_screen && $current_screen->post_type) { |
|
83 | 83 | $post_type = $current_screen->post_type; |
84 | - } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
85 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
86 | - } elseif ( isset( $_REQUEST['post'] ) ) { |
|
87 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
84 | + } elseif (isset($_REQUEST['post_type'])) { |
|
85 | + $post_type = sanitize_key($_REQUEST['post_type']); |
|
86 | + } elseif (isset($_REQUEST['post'])) { |
|
87 | + $post_type = get_post_type(sanitize_key($_REQUEST['post'])); |
|
88 | 88 | } |
89 | - if ( false !== $post_type ) { |
|
89 | + if (false !== $post_type) { |
|
90 | 90 | $fields[] = array( |
91 | 91 | 'id' => 'review_title', |
92 | 92 | 'name' => 'Reviews', |
@@ -18,99 +18,99 @@ |
||
18 | 18 | |
19 | 19 | class LSX_TO_Reviews_Admin extends LSX_TO_Reviews { |
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - */ |
|
24 | - public function __construct() { |
|
25 | - $this->set_vars(); |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + */ |
|
24 | + public function __construct() { |
|
25 | + $this->set_vars(); |
|
26 | 26 | |
27 | - add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
28 | - add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
27 | + add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
28 | + add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
29 | 29 | |
30 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
31 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
30 | + add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
31 | + add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | + add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
33 | 33 | |
34 | - add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); |
|
37 | - } |
|
34 | + add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | + add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | + add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Register the activity post type config |
|
41 | - * |
|
42 | - * @param $objects |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function post_type_config( $objects ) { |
|
39 | + /** |
|
40 | + * Register the activity post type config |
|
41 | + * |
|
42 | + * @param $objects |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function post_type_config( $objects ) { |
|
46 | 46 | |
47 | - foreach ( $this->post_types as $key => $label ) { |
|
48 | - if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
49 | - $objects[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
50 | - } |
|
51 | - } |
|
47 | + foreach ( $this->post_types as $key => $label ) { |
|
48 | + if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
49 | + $objects[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - return $objects; |
|
54 | - } |
|
53 | + return $objects; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Register the activity metabox config |
|
58 | - * |
|
59 | - * @param $meta_boxes |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - public function meta_box_config( $meta_boxes ) { |
|
63 | - foreach ( $this->post_types as $key => $label ) { |
|
64 | - if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
65 | - $meta_boxes[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
66 | - } |
|
67 | - } |
|
68 | - return $meta_boxes; |
|
69 | - } |
|
56 | + /** |
|
57 | + * Register the activity metabox config |
|
58 | + * |
|
59 | + * @param $meta_boxes |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + public function meta_box_config( $meta_boxes ) { |
|
63 | + foreach ( $this->post_types as $key => $label ) { |
|
64 | + if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
65 | + $meta_boxes[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
66 | + } |
|
67 | + } |
|
68 | + return $meta_boxes; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Adds in the fields to the Tour Operators Post Types. |
|
73 | - */ |
|
74 | - public function custom_fields( $fields ) { |
|
75 | - global $post, $typenow, $current_screen; |
|
71 | + /** |
|
72 | + * Adds in the fields to the Tour Operators Post Types. |
|
73 | + */ |
|
74 | + public function custom_fields( $fields ) { |
|
75 | + global $post, $typenow, $current_screen; |
|
76 | 76 | |
77 | - $post_type = false; |
|
78 | - if ( $post && $post->post_type ) { |
|
79 | - $post_type = $post->post_type; |
|
80 | - } elseif ( $typenow ) { |
|
81 | - $post_type = $typenow; |
|
82 | - } elseif ( $current_screen && $current_screen->post_type ) { |
|
83 | - $post_type = $current_screen->post_type; |
|
84 | - } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
85 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
86 | - } elseif ( isset( $_REQUEST['post'] ) ) { |
|
87 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
88 | - } |
|
89 | - if ( false !== $post_type ) { |
|
90 | - $fields[] = array( |
|
91 | - 'id' => 'review_title', |
|
92 | - 'name' => 'Reviews', |
|
93 | - 'type' => 'title', |
|
94 | - 'cols' => 12, |
|
95 | - ); |
|
96 | - $fields[] = array( |
|
97 | - 'id' => 'review_to_' . $post_type, |
|
98 | - 'name' => 'Reviews related with this ' . $post_type, |
|
99 | - 'type' => 'post_select', |
|
100 | - 'use_ajax' => false, |
|
101 | - 'query' => array( |
|
102 | - 'post_type' => 'review', |
|
103 | - 'nopagin' => true, |
|
104 | - 'posts_per_page' => '-1', |
|
105 | - 'orderby' => 'title', |
|
106 | - 'order' => 'ASC', |
|
107 | - ), |
|
108 | - 'repeatable' => true, |
|
109 | - 'allow_none' => true, |
|
110 | - 'cols' => 12, |
|
111 | - ); |
|
112 | - } |
|
113 | - return $fields; |
|
114 | - } |
|
77 | + $post_type = false; |
|
78 | + if ( $post && $post->post_type ) { |
|
79 | + $post_type = $post->post_type; |
|
80 | + } elseif ( $typenow ) { |
|
81 | + $post_type = $typenow; |
|
82 | + } elseif ( $current_screen && $current_screen->post_type ) { |
|
83 | + $post_type = $current_screen->post_type; |
|
84 | + } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
85 | + $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
86 | + } elseif ( isset( $_REQUEST['post'] ) ) { |
|
87 | + $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
88 | + } |
|
89 | + if ( false !== $post_type ) { |
|
90 | + $fields[] = array( |
|
91 | + 'id' => 'review_title', |
|
92 | + 'name' => 'Reviews', |
|
93 | + 'type' => 'title', |
|
94 | + 'cols' => 12, |
|
95 | + ); |
|
96 | + $fields[] = array( |
|
97 | + 'id' => 'review_to_' . $post_type, |
|
98 | + 'name' => 'Reviews related with this ' . $post_type, |
|
99 | + 'type' => 'post_select', |
|
100 | + 'use_ajax' => false, |
|
101 | + 'query' => array( |
|
102 | + 'post_type' => 'review', |
|
103 | + 'nopagin' => true, |
|
104 | + 'posts_per_page' => '-1', |
|
105 | + 'orderby' => 'title', |
|
106 | + 'order' => 'ASC', |
|
107 | + ), |
|
108 | + 'repeatable' => true, |
|
109 | + 'allow_none' => true, |
|
110 | + 'cols' => 12, |
|
111 | + ); |
|
112 | + } |
|
113 | + return $fields; |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | new LSX_TO_Reviews_Admin(); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @link |
9 | 9 | * @copyright 2016 LightSpeedDevelopment |
10 | 10 | */ |
11 | -if (!class_exists( 'LSX_TO_Reviews' ) ) { |
|
11 | +if ( ! class_exists('LSX_TO_Reviews')) { |
|
12 | 12 | /** |
13 | 13 | * Main plugin class. |
14 | 14 | * |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | $this->lsx_to_search_integration(); |
57 | 57 | |
58 | 58 | // Make TO last plugin to load. |
59 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
59 | + add_action('activated_plugin', array($this, 'activated_plugin')); |
|
60 | 60 | |
61 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
61 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
62 | 62 | |
63 | - if ( false !== $this->post_types ) { |
|
64 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); |
|
65 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); |
|
66 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); |
|
67 | - add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); |
|
63 | + if (false !== $this->post_types) { |
|
64 | + add_filter('lsx_to_framework_post_types', array($this, 'post_types_filter')); |
|
65 | + add_filter('lsx_to_post_types', array($this, 'post_types_filter')); |
|
66 | + add_filter('lsx_to_post_types_singular', array($this, 'post_types_singular_filter')); |
|
67 | + add_filter('lsx_to_settings_path', array($this, 'plugin_path'), 10, 2); |
|
68 | 68 | } |
69 | - if ( false !== $this->taxonomies ) { |
|
70 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
71 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); |
|
69 | + if (false !== $this->taxonomies) { |
|
70 | + add_filter('lsx_to_framework_taxonomies', array($this, 'taxonomies_filter')); |
|
71 | + add_filter('lsx_to_framework_taxonomies_plural', array($this, 'taxonomies_plural_filter')); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-admin.php'; |
@@ -76,25 +76,25 @@ discard block |
||
76 | 76 | require_once LSX_TO_REVIEWS_PATH . '/includes/template-tags.php'; |
77 | 77 | |
78 | 78 | // flush_rewrite_rules. |
79 | - register_activation_hook( LSX_TO_REVIEWS_CORE, array( $this, 'register_activation_hook' ) ); |
|
80 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
79 | + register_activation_hook(LSX_TO_REVIEWS_CORE, array($this, 'register_activation_hook')); |
|
80 | + add_action('admin_init', array($this, 'register_activation_hook_check')); |
|
81 | 81 | |
82 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
82 | + add_filter('wpseo_schema_graph_pieces', array($this, 'add_graph_pieces'), 11, 2); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Include the post type for the search integration |
87 | 87 | */ |
88 | - public function lsx_to_search_integration(){ |
|
89 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); |
|
90 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
88 | + public function lsx_to_search_integration() { |
|
89 | + add_filter('lsx_to_search_post_types', array($this, 'post_types_filter')); |
|
90 | + add_filter('lsx_to_search_taxonomies', array($this, 'taxonomies_filter')); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Load the plugin text domain for translation. |
95 | 95 | */ |
96 | 96 | public function load_plugin_textdomain() { |
97 | - load_plugin_textdomain( 'to-reviews', FALSE, basename( LSX_TO_REVIEWS_PATH ) . '/languages'); |
|
97 | + load_plugin_textdomain('to-reviews', FALSE, basename(LSX_TO_REVIEWS_PATH) . '/languages'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function set_vars() { |
104 | 104 | $this->post_types = array( |
105 | - 'review' => __('Reviews','to-reviews') |
|
105 | + 'review' => __('Reviews', 'to-reviews') |
|
106 | 106 | ); |
107 | 107 | $this->post_types_singular = array( |
108 | - 'review' => __('Review','to-reviews') |
|
108 | + 'review' => __('Review', 'to-reviews') |
|
109 | 109 | ); |
110 | 110 | $this->post_type_slugs = array_keys($this->post_types); |
111 | 111 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * Adds our post types to an array via a filter |
115 | 115 | */ |
116 | - public function plugin_path($path,$post_type){ |
|
117 | - if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
116 | + public function plugin_path($path, $post_type) { |
|
117 | + if (false !== $this->post_types && array_key_exists($post_type, $this->post_types)) { |
|
118 | 118 | $path = LSX_TO_REVIEWS_PATH; |
119 | 119 | } |
120 | 120 | return $path; |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | /** |
124 | 124 | * Adds our post types to an array via a filter |
125 | 125 | */ |
126 | - public function post_types_slugs_filter($post_types){ |
|
127 | - if(is_array($post_types)){ |
|
128 | - $post_types = array_merge($post_types,$this->post_type_slugs); |
|
129 | - }else{ |
|
126 | + public function post_types_slugs_filter($post_types) { |
|
127 | + if (is_array($post_types)) { |
|
128 | + $post_types = array_merge($post_types, $this->post_type_slugs); |
|
129 | + }else { |
|
130 | 130 | $post_types = $this->post_type_slugs; |
131 | 131 | } |
132 | 132 | return $post_types; |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * Adds our post types to an array via a filter |
137 | 137 | */ |
138 | - public function post_types_filter( $post_types ) { |
|
139 | - if ( is_array( $post_types ) && is_array( $this->post_types ) ) { |
|
140 | - $post_types = array_merge( $post_types, $this->post_types ); |
|
141 | - } elseif ( is_array( $this->post_types ) ) { |
|
138 | + public function post_types_filter($post_types) { |
|
139 | + if (is_array($post_types) && is_array($this->post_types)) { |
|
140 | + $post_types = array_merge($post_types, $this->post_types); |
|
141 | + } elseif (is_array($this->post_types)) { |
|
142 | 142 | $post_types = $this->post_types; |
143 | 143 | } |
144 | 144 | return $post_types; |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * Adds our post types to an array via a filter |
149 | 149 | */ |
150 | - public function post_types_singular_filter( $post_types_singular ) { |
|
151 | - if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { |
|
152 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); |
|
153 | - } elseif ( is_array( $this->post_types_singular ) ) { |
|
150 | + public function post_types_singular_filter($post_types_singular) { |
|
151 | + if (is_array($post_types_singular) && is_array($this->post_types_singular)) { |
|
152 | + $post_types_singular = array_merge($post_types_singular, $this->post_types_singular); |
|
153 | + } elseif (is_array($this->post_types_singular)) { |
|
154 | 154 | $post_types_singular = $this->post_types_singular; |
155 | 155 | } |
156 | 156 | return $post_types_singular; |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * Adds our taxonomies to an array via a filter |
161 | 161 | */ |
162 | - public function taxonomies_filter( $taxonomies ) { |
|
163 | - if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { |
|
164 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); |
|
165 | - } elseif ( is_array( $this->taxonomies ) ) { |
|
162 | + public function taxonomies_filter($taxonomies) { |
|
163 | + if (is_array($taxonomies) && is_array($this->taxonomies)) { |
|
164 | + $taxonomies = array_merge($taxonomies, $this->taxonomies); |
|
165 | + } elseif (is_array($this->taxonomies)) { |
|
166 | 166 | $taxonomies = $this->taxonomies; |
167 | 167 | } |
168 | 168 | return $taxonomies; |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Adds our taxonomies_plural to an array via a filter |
173 | 173 | */ |
174 | - public function taxonomies_plural_filter( $taxonomies_plural ) { |
|
175 | - if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { |
|
176 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); |
|
177 | - } elseif ( is_array( $this->taxonomies_plural ) ) { |
|
174 | + public function taxonomies_plural_filter($taxonomies_plural) { |
|
175 | + if (is_array($taxonomies_plural) && is_array($this->taxonomies_plural)) { |
|
176 | + $taxonomies_plural = array_merge($taxonomies_plural, $this->taxonomies_plural); |
|
177 | + } elseif (is_array($this->taxonomies_plural)) { |
|
178 | 178 | $taxonomies_plural = $this->taxonomies_plural; |
179 | 179 | } |
180 | 180 | return $taxonomies_plural; |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | * Make TO last plugin to load. |
185 | 185 | */ |
186 | 186 | public function activated_plugin() { |
187 | - if ( $plugins = get_option( 'active_plugins' ) ) { |
|
188 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
189 | - $key = array_search( $search, $plugins ); |
|
190 | - |
|
191 | - if ( is_array( $search ) && count( $search ) ) { |
|
192 | - foreach ( $search as $key => $path ) { |
|
193 | - array_splice( $plugins, $key, 1 ); |
|
194 | - array_push( $plugins, $path ); |
|
195 | - update_option( 'active_plugins', $plugins ); |
|
187 | + if ($plugins = get_option('active_plugins')) { |
|
188 | + $search = preg_grep('/.*\/tour-operator\.php/', $plugins); |
|
189 | + $key = array_search($search, $plugins); |
|
190 | + |
|
191 | + if (is_array($search) && count($search)) { |
|
192 | + foreach ($search as $key => $path) { |
|
193 | + array_splice($plugins, $key, 1); |
|
194 | + array_push($plugins, $path); |
|
195 | + update_option('active_plugins', $plugins); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | * On plugin activation |
203 | 203 | */ |
204 | 204 | public function register_activation_hook() { |
205 | - if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
206 | - set_transient( '_tour_operators_reviews_flush_rewrite_rules', 1, 30 ); |
|
205 | + if ( ! is_network_admin() && ! isset($_GET['activate-multi'])) { |
|
206 | + set_transient('_tour_operators_reviews_flush_rewrite_rules', 1, 30); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | * On plugin activation (check) |
212 | 212 | */ |
213 | 213 | public function register_activation_hook_check() { |
214 | - if ( ! get_transient( '_tour_operators_reviews_flush_rewrite_rules' ) ) { |
|
214 | + if ( ! get_transient('_tour_operators_reviews_flush_rewrite_rules')) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - delete_transient( '_tour_operators_reviews_flush_rewrite_rules' ); |
|
218 | + delete_transient('_tour_operators_reviews_flush_rewrite_rules'); |
|
219 | 219 | flush_rewrite_rules(); |
220 | 220 | } |
221 | 221 | /** |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return array $pieces Graph pieces to output. |
228 | 228 | */ |
229 | - public function add_graph_pieces( $pieces, $context ) { |
|
230 | - if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { |
|
229 | + public function add_graph_pieces($pieces, $context) { |
|
230 | + if (class_exists('LSX_TO_Schema_Graph_Piece')) { |
|
231 | 231 | require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-review-schema.php'; |
232 | - $pieces[] = new LSX_TO_Schema_Review( $context ); |
|
232 | + $pieces[] = new LSX_TO_Schema_Review($context); |
|
233 | 233 | } |
234 | 234 | return $pieces; |
235 | 235 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | public function post_types_slugs_filter($post_types){ |
127 | 127 | if(is_array($post_types)){ |
128 | 128 | $post_types = array_merge($post_types,$this->post_type_slugs); |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | $post_types = $this->post_type_slugs; |
131 | 131 | } |
132 | 132 | return $post_types; |
@@ -9,230 +9,230 @@ |
||
9 | 9 | * @copyright 2016 LightSpeedDevelopment |
10 | 10 | */ |
11 | 11 | if (!class_exists( 'LSX_TO_Reviews' ) ) { |
12 | - /** |
|
13 | - * Main plugin class. |
|
14 | - * |
|
15 | - * @package LSX_TO_Reviews |
|
16 | - * @author LightSpeed |
|
17 | - */ |
|
18 | - class LSX_TO_Reviews { |
|
12 | + /** |
|
13 | + * Main plugin class. |
|
14 | + * |
|
15 | + * @package LSX_TO_Reviews |
|
16 | + * @author LightSpeed |
|
17 | + */ |
|
18 | + class LSX_TO_Reviews { |
|
19 | 19 | |
20 | - /** |
|
21 | - * The plugins id |
|
22 | - */ |
|
23 | - public $plugin_slug = 'to-reviews'; |
|
24 | - |
|
25 | - /** |
|
26 | - * The post types the plugin registers |
|
27 | - */ |
|
28 | - public $post_types = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * The singular post types the plugin registers |
|
32 | - */ |
|
33 | - public $post_types_singular = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * An array of the post types slugs plugin registers |
|
37 | - */ |
|
38 | - public $post_type_slugs = false; |
|
39 | - |
|
40 | - /** |
|
41 | - * The taxonomies the plugin registers |
|
42 | - */ |
|
43 | - public $taxonomies = false; |
|
44 | - |
|
45 | - /** |
|
46 | - * The taxonomies the plugin registers (plural) |
|
47 | - */ |
|
48 | - public $taxonomies_plural = false; |
|
49 | - |
|
50 | - /** |
|
51 | - * Constructor |
|
52 | - */ |
|
53 | - public function __construct() { |
|
54 | - //Set the variables |
|
55 | - $this->set_vars(); |
|
56 | - $this->lsx_to_search_integration(); |
|
57 | - |
|
58 | - // Make TO last plugin to load. |
|
59 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
60 | - |
|
61 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
62 | - |
|
63 | - if ( false !== $this->post_types ) { |
|
64 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); |
|
65 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); |
|
66 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); |
|
67 | - add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); |
|
68 | - } |
|
69 | - if ( false !== $this->taxonomies ) { |
|
70 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
71 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); |
|
72 | - } |
|
73 | - |
|
74 | - require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-admin.php'; |
|
75 | - require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-frontend.php'; |
|
76 | - require_once LSX_TO_REVIEWS_PATH . '/includes/template-tags.php'; |
|
77 | - |
|
78 | - // flush_rewrite_rules. |
|
79 | - register_activation_hook( LSX_TO_REVIEWS_CORE, array( $this, 'register_activation_hook' ) ); |
|
80 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
81 | - |
|
82 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Include the post type for the search integration |
|
87 | - */ |
|
88 | - public function lsx_to_search_integration(){ |
|
89 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); |
|
90 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
91 | - } |
|
20 | + /** |
|
21 | + * The plugins id |
|
22 | + */ |
|
23 | + public $plugin_slug = 'to-reviews'; |
|
24 | + |
|
25 | + /** |
|
26 | + * The post types the plugin registers |
|
27 | + */ |
|
28 | + public $post_types = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * The singular post types the plugin registers |
|
32 | + */ |
|
33 | + public $post_types_singular = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * An array of the post types slugs plugin registers |
|
37 | + */ |
|
38 | + public $post_type_slugs = false; |
|
39 | + |
|
40 | + /** |
|
41 | + * The taxonomies the plugin registers |
|
42 | + */ |
|
43 | + public $taxonomies = false; |
|
44 | + |
|
45 | + /** |
|
46 | + * The taxonomies the plugin registers (plural) |
|
47 | + */ |
|
48 | + public $taxonomies_plural = false; |
|
49 | + |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + */ |
|
53 | + public function __construct() { |
|
54 | + //Set the variables |
|
55 | + $this->set_vars(); |
|
56 | + $this->lsx_to_search_integration(); |
|
57 | + |
|
58 | + // Make TO last plugin to load. |
|
59 | + add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
60 | + |
|
61 | + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
62 | + |
|
63 | + if ( false !== $this->post_types ) { |
|
64 | + add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); |
|
65 | + add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); |
|
66 | + add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); |
|
67 | + add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); |
|
68 | + } |
|
69 | + if ( false !== $this->taxonomies ) { |
|
70 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
71 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); |
|
72 | + } |
|
73 | + |
|
74 | + require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-admin.php'; |
|
75 | + require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-frontend.php'; |
|
76 | + require_once LSX_TO_REVIEWS_PATH . '/includes/template-tags.php'; |
|
77 | + |
|
78 | + // flush_rewrite_rules. |
|
79 | + register_activation_hook( LSX_TO_REVIEWS_CORE, array( $this, 'register_activation_hook' ) ); |
|
80 | + add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
81 | + |
|
82 | + add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Include the post type for the search integration |
|
87 | + */ |
|
88 | + public function lsx_to_search_integration(){ |
|
89 | + add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); |
|
90 | + add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Load the plugin text domain for translation. |
|
95 | - */ |
|
96 | - public function load_plugin_textdomain() { |
|
97 | - load_plugin_textdomain( 'to-reviews', FALSE, basename( LSX_TO_REVIEWS_PATH ) . '/languages'); |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * Sets the plugins variables |
|
102 | - */ |
|
103 | - public function set_vars() { |
|
104 | - $this->post_types = array( |
|
105 | - 'review' => __('Reviews','to-reviews') |
|
106 | - ); |
|
107 | - $this->post_types_singular = array( |
|
108 | - 'review' => __('Review','to-reviews') |
|
109 | - ); |
|
110 | - $this->post_type_slugs = array_keys($this->post_types); |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * Adds our post types to an array via a filter |
|
115 | - */ |
|
116 | - public function plugin_path($path,$post_type){ |
|
117 | - if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
118 | - $path = LSX_TO_REVIEWS_PATH; |
|
119 | - } |
|
120 | - return $path; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Adds our post types to an array via a filter |
|
125 | - */ |
|
126 | - public function post_types_slugs_filter($post_types){ |
|
127 | - if(is_array($post_types)){ |
|
128 | - $post_types = array_merge($post_types,$this->post_type_slugs); |
|
129 | - }else{ |
|
130 | - $post_types = $this->post_type_slugs; |
|
131 | - } |
|
132 | - return $post_types; |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Adds our post types to an array via a filter |
|
137 | - */ |
|
138 | - public function post_types_filter( $post_types ) { |
|
139 | - if ( is_array( $post_types ) && is_array( $this->post_types ) ) { |
|
140 | - $post_types = array_merge( $post_types, $this->post_types ); |
|
141 | - } elseif ( is_array( $this->post_types ) ) { |
|
142 | - $post_types = $this->post_types; |
|
143 | - } |
|
144 | - return $post_types; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * Adds our post types to an array via a filter |
|
149 | - */ |
|
150 | - public function post_types_singular_filter( $post_types_singular ) { |
|
151 | - if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { |
|
152 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); |
|
153 | - } elseif ( is_array( $this->post_types_singular ) ) { |
|
154 | - $post_types_singular = $this->post_types_singular; |
|
155 | - } |
|
156 | - return $post_types_singular; |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Adds our taxonomies to an array via a filter |
|
161 | - */ |
|
162 | - public function taxonomies_filter( $taxonomies ) { |
|
163 | - if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { |
|
164 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); |
|
165 | - } elseif ( is_array( $this->taxonomies ) ) { |
|
166 | - $taxonomies = $this->taxonomies; |
|
167 | - } |
|
168 | - return $taxonomies; |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * Adds our taxonomies_plural to an array via a filter |
|
173 | - */ |
|
174 | - public function taxonomies_plural_filter( $taxonomies_plural ) { |
|
175 | - if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { |
|
176 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); |
|
177 | - } elseif ( is_array( $this->taxonomies_plural ) ) { |
|
178 | - $taxonomies_plural = $this->taxonomies_plural; |
|
179 | - } |
|
180 | - return $taxonomies_plural; |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * Make TO last plugin to load. |
|
185 | - */ |
|
186 | - public function activated_plugin() { |
|
187 | - if ( $plugins = get_option( 'active_plugins' ) ) { |
|
188 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
189 | - $key = array_search( $search, $plugins ); |
|
190 | - |
|
191 | - if ( is_array( $search ) && count( $search ) ) { |
|
192 | - foreach ( $search as $key => $path ) { |
|
193 | - array_splice( $plugins, $key, 1 ); |
|
194 | - array_push( $plugins, $path ); |
|
195 | - update_option( 'active_plugins', $plugins ); |
|
196 | - } |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * On plugin activation |
|
203 | - */ |
|
204 | - public function register_activation_hook() { |
|
205 | - if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
206 | - set_transient( '_tour_operators_reviews_flush_rewrite_rules', 1, 30 ); |
|
207 | - } |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * On plugin activation (check) |
|
212 | - */ |
|
213 | - public function register_activation_hook_check() { |
|
214 | - if ( ! get_transient( '_tour_operators_reviews_flush_rewrite_rules' ) ) { |
|
215 | - return; |
|
216 | - } |
|
217 | - |
|
218 | - delete_transient( '_tour_operators_reviews_flush_rewrite_rules' ); |
|
219 | - flush_rewrite_rules(); |
|
220 | - } |
|
221 | - /** |
|
222 | - * Adds Schema pieces to our output. |
|
223 | - * |
|
224 | - * @param array $pieces Graph pieces to output. |
|
225 | - * @param \WPSEO_Schema_Context $context Object with context variables. |
|
226 | - * |
|
227 | - * @return array $pieces Graph pieces to output. |
|
228 | - */ |
|
229 | - public function add_graph_pieces( $pieces, $context ) { |
|
230 | - if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { |
|
231 | - require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-review-schema.php'; |
|
232 | - $pieces[] = new LSX_TO_Schema_Review( $context ); |
|
233 | - } |
|
234 | - return $pieces; |
|
235 | - } |
|
236 | - } |
|
237 | - new LSX_TO_Reviews(); |
|
93 | + /** |
|
94 | + * Load the plugin text domain for translation. |
|
95 | + */ |
|
96 | + public function load_plugin_textdomain() { |
|
97 | + load_plugin_textdomain( 'to-reviews', FALSE, basename( LSX_TO_REVIEWS_PATH ) . '/languages'); |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * Sets the plugins variables |
|
102 | + */ |
|
103 | + public function set_vars() { |
|
104 | + $this->post_types = array( |
|
105 | + 'review' => __('Reviews','to-reviews') |
|
106 | + ); |
|
107 | + $this->post_types_singular = array( |
|
108 | + 'review' => __('Review','to-reviews') |
|
109 | + ); |
|
110 | + $this->post_type_slugs = array_keys($this->post_types); |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * Adds our post types to an array via a filter |
|
115 | + */ |
|
116 | + public function plugin_path($path,$post_type){ |
|
117 | + if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
118 | + $path = LSX_TO_REVIEWS_PATH; |
|
119 | + } |
|
120 | + return $path; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Adds our post types to an array via a filter |
|
125 | + */ |
|
126 | + public function post_types_slugs_filter($post_types){ |
|
127 | + if(is_array($post_types)){ |
|
128 | + $post_types = array_merge($post_types,$this->post_type_slugs); |
|
129 | + }else{ |
|
130 | + $post_types = $this->post_type_slugs; |
|
131 | + } |
|
132 | + return $post_types; |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Adds our post types to an array via a filter |
|
137 | + */ |
|
138 | + public function post_types_filter( $post_types ) { |
|
139 | + if ( is_array( $post_types ) && is_array( $this->post_types ) ) { |
|
140 | + $post_types = array_merge( $post_types, $this->post_types ); |
|
141 | + } elseif ( is_array( $this->post_types ) ) { |
|
142 | + $post_types = $this->post_types; |
|
143 | + } |
|
144 | + return $post_types; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * Adds our post types to an array via a filter |
|
149 | + */ |
|
150 | + public function post_types_singular_filter( $post_types_singular ) { |
|
151 | + if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { |
|
152 | + $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); |
|
153 | + } elseif ( is_array( $this->post_types_singular ) ) { |
|
154 | + $post_types_singular = $this->post_types_singular; |
|
155 | + } |
|
156 | + return $post_types_singular; |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Adds our taxonomies to an array via a filter |
|
161 | + */ |
|
162 | + public function taxonomies_filter( $taxonomies ) { |
|
163 | + if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { |
|
164 | + $taxonomies = array_merge( $taxonomies, $this->taxonomies ); |
|
165 | + } elseif ( is_array( $this->taxonomies ) ) { |
|
166 | + $taxonomies = $this->taxonomies; |
|
167 | + } |
|
168 | + return $taxonomies; |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * Adds our taxonomies_plural to an array via a filter |
|
173 | + */ |
|
174 | + public function taxonomies_plural_filter( $taxonomies_plural ) { |
|
175 | + if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { |
|
176 | + $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); |
|
177 | + } elseif ( is_array( $this->taxonomies_plural ) ) { |
|
178 | + $taxonomies_plural = $this->taxonomies_plural; |
|
179 | + } |
|
180 | + return $taxonomies_plural; |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * Make TO last plugin to load. |
|
185 | + */ |
|
186 | + public function activated_plugin() { |
|
187 | + if ( $plugins = get_option( 'active_plugins' ) ) { |
|
188 | + $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
189 | + $key = array_search( $search, $plugins ); |
|
190 | + |
|
191 | + if ( is_array( $search ) && count( $search ) ) { |
|
192 | + foreach ( $search as $key => $path ) { |
|
193 | + array_splice( $plugins, $key, 1 ); |
|
194 | + array_push( $plugins, $path ); |
|
195 | + update_option( 'active_plugins', $plugins ); |
|
196 | + } |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * On plugin activation |
|
203 | + */ |
|
204 | + public function register_activation_hook() { |
|
205 | + if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
206 | + set_transient( '_tour_operators_reviews_flush_rewrite_rules', 1, 30 ); |
|
207 | + } |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * On plugin activation (check) |
|
212 | + */ |
|
213 | + public function register_activation_hook_check() { |
|
214 | + if ( ! get_transient( '_tour_operators_reviews_flush_rewrite_rules' ) ) { |
|
215 | + return; |
|
216 | + } |
|
217 | + |
|
218 | + delete_transient( '_tour_operators_reviews_flush_rewrite_rules' ); |
|
219 | + flush_rewrite_rules(); |
|
220 | + } |
|
221 | + /** |
|
222 | + * Adds Schema pieces to our output. |
|
223 | + * |
|
224 | + * @param array $pieces Graph pieces to output. |
|
225 | + * @param \WPSEO_Schema_Context $context Object with context variables. |
|
226 | + * |
|
227 | + * @return array $pieces Graph pieces to output. |
|
228 | + */ |
|
229 | + public function add_graph_pieces( $pieces, $context ) { |
|
230 | + if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { |
|
231 | + require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-review-schema.php'; |
|
232 | + $pieces[] = new LSX_TO_Schema_Review( $context ); |
|
233 | + } |
|
234 | + return $pieces; |
|
235 | + } |
|
236 | + } |
|
237 | + new LSX_TO_Reviews(); |
|
238 | 238 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | 16 | if ( ! defined( 'WPINC' ) ) { |
17 | - die; |
|
17 | + die; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | define( 'LSX_TO_REVIEWS_PATH', plugin_dir_path( __FILE__ ) ); |
@@ -13,14 +13,14 @@ |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | -if ( ! defined( 'WPINC' ) ) { |
|
16 | +if ( ! defined('WPINC')) { |
|
17 | 17 | die; |
18 | 18 | } |
19 | 19 | |
20 | -define( 'LSX_TO_REVIEWS_PATH', plugin_dir_path( __FILE__ ) ); |
|
21 | -define( 'LSX_TO_REVIEWS_CORE', __FILE__ ); |
|
22 | -define( 'LSX_TO_REVIEWS_URL', plugin_dir_url( __FILE__ ) ); |
|
23 | -define( 'LSX_TO_REVIEWS_VER', '1.2.3' ); |
|
20 | +define('LSX_TO_REVIEWS_PATH', plugin_dir_path(__FILE__)); |
|
21 | +define('LSX_TO_REVIEWS_CORE', __FILE__); |
|
22 | +define('LSX_TO_REVIEWS_URL', plugin_dir_url(__FILE__)); |
|
23 | +define('LSX_TO_REVIEWS_VER', '1.2.3'); |
|
24 | 24 | |
25 | 25 | /* ======================= Below is the Plugin Class init ========================= */ |
26 | 26 |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | $permalink = ''; |
14 | 14 | |
15 | 15 | if ( $has_single ) { |
16 | - $permalink = get_the_permalink(); |
|
16 | + $permalink = get_the_permalink(); |
|
17 | 17 | } elseif ( ! is_post_type_archive( 'review' ) ) { |
18 | - $has_single = true; |
|
19 | - $permalink = get_post_type_archive_link( 'review' ) . '#review-' . $post->post_name; |
|
18 | + $has_single = true; |
|
19 | + $permalink = get_post_type_archive_link( 'review' ) . '#review-' . $post->post_name; |
|
20 | 20 | } |
21 | 21 | ?> |
22 | 22 | <article <?php post_class(); ?>> |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | <?php if ( empty( $disable_text ) ) { ?> |
38 | 38 | <blockquote class="lsx-to-widget-blockquote"> |
39 | 39 | <?php |
40 | - $excerpt = get_the_excerpt(); |
|
41 | - if ( empty( $excerpt ) || '' === $excerpt ) { |
|
42 | - $tooltip = apply_filters( 'get_the_excerpt', get_the_content() ); |
|
43 | - $tooltip = strip_tags( $tooltip ); |
|
44 | - echo wp_kses_post( wpautop( $tooltip ) ); |
|
45 | - } else { |
|
46 | - echo wp_kses_post( $excerpt ); |
|
47 | - } |
|
48 | - ?> |
|
40 | + $excerpt = get_the_excerpt(); |
|
41 | + if ( empty( $excerpt ) || '' === $excerpt ) { |
|
42 | + $tooltip = apply_filters( 'get_the_excerpt', get_the_content() ); |
|
43 | + $tooltip = strip_tags( $tooltip ); |
|
44 | + echo wp_kses_post( wpautop( $tooltip ) ); |
|
45 | + } else { |
|
46 | + echo wp_kses_post( $excerpt ); |
|
47 | + } |
|
48 | + ?> |
|
49 | 49 | </blockquote> |
50 | 50 | <?php } ?> |
51 | 51 | |
52 | 52 | <div class="lsx-to-widget-meta-data"> |
53 | 53 | <?php |
54 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
54 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
55 | 55 | |
56 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
57 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
58 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
59 | - if ( function_exists( 'lsx_to_connected_team' ) ) { |
|
60 | - lsx_to_connected_team( '<span class="' . $meta_class . 'team"><span class="lsx-to-meta-data-key">' . __( 'Advised by', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
61 | - } |
|
62 | - ?> |
|
56 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
57 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
58 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
59 | + if ( function_exists( 'lsx_to_connected_team' ) ) { |
|
60 | + lsx_to_connected_team( '<span class="' . $meta_class . 'team"><span class="lsx-to-meta-data-key">' . __( 'Advised by', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
61 | + } |
|
62 | + ?> |
|
63 | 63 | </div> |
64 | 64 | |
65 | 65 | </article> |
@@ -12,38 +12,38 @@ discard block |
||
12 | 12 | $has_single = ! lsx_to_is_single_disabled(); |
13 | 13 | $permalink = ''; |
14 | 14 | |
15 | -if ( $has_single ) { |
|
15 | +if ($has_single) { |
|
16 | 16 | $permalink = get_the_permalink(); |
17 | -} elseif ( ! is_post_type_archive( 'review' ) ) { |
|
17 | +} elseif ( ! is_post_type_archive('review')) { |
|
18 | 18 | $has_single = true; |
19 | - $permalink = get_post_type_archive_link( 'review' ) . '#review-' . $post->post_name; |
|
19 | + $permalink = get_post_type_archive_link('review') . '#review-' . $post->post_name; |
|
20 | 20 | } |
21 | 21 | ?> |
22 | 22 | <article <?php post_class(); ?>> |
23 | - <?php if ( empty( $disable_placeholder ) ) { ?> |
|
23 | + <?php if (empty($disable_placeholder)) { ?> |
|
24 | 24 | <div class="lsx-to-widget-thumb"> |
25 | - <?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> |
|
26 | - <?php lsx_thumbnail( 'lsx-thumbnail-wide' ); ?> |
|
27 | - <?php if ( $has_single ) { ?></a><?php } ?> |
|
25 | + <?php if ($has_single) { ?><a href="<?php echo esc_url($permalink); ?>"><?php } ?> |
|
26 | + <?php lsx_thumbnail('lsx-thumbnail-wide'); ?> |
|
27 | + <?php if ($has_single) { ?></a><?php } ?> |
|
28 | 28 | </div> |
29 | 29 | <?php } ?> |
30 | 30 | |
31 | 31 | <h4 class="lsx-to-widget-title text-center"> |
32 | - <?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> |
|
32 | + <?php if ($has_single) { ?><a href="<?php echo esc_url($permalink); ?>"><?php } ?> |
|
33 | 33 | <?php the_title(); ?> |
34 | - <?php if ( $has_single ) { ?></a><?php } ?> |
|
34 | + <?php if ($has_single) { ?></a><?php } ?> |
|
35 | 35 | </h4> |
36 | 36 | |
37 | - <?php if ( empty( $disable_text ) ) { ?> |
|
37 | + <?php if (empty($disable_text)) { ?> |
|
38 | 38 | <blockquote class="lsx-to-widget-blockquote"> |
39 | 39 | <?php |
40 | 40 | $excerpt = get_the_excerpt(); |
41 | - if ( empty( $excerpt ) || '' === $excerpt ) { |
|
42 | - $tooltip = apply_filters( 'get_the_excerpt', get_the_content() ); |
|
43 | - $tooltip = strip_tags( $tooltip ); |
|
44 | - echo wp_kses_post( wpautop( $tooltip ) ); |
|
45 | - } else { |
|
46 | - echo wp_kses_post( $excerpt ); |
|
41 | + if (empty($excerpt) || '' === $excerpt) { |
|
42 | + $tooltip = apply_filters('get_the_excerpt', get_the_content()); |
|
43 | + $tooltip = strip_tags($tooltip); |
|
44 | + echo wp_kses_post(wpautop($tooltip)); |
|
45 | + }else { |
|
46 | + echo wp_kses_post($excerpt); |
|
47 | 47 | } |
48 | 48 | ?> |
49 | 49 | </blockquote> |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | <?php |
54 | 54 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
55 | 55 | |
56 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
57 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
58 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
59 | - if ( function_exists( 'lsx_to_connected_team' ) ) { |
|
60 | - lsx_to_connected_team( '<span class="' . $meta_class . 'team"><span class="lsx-to-meta-data-key">' . __( 'Advised by', 'to-reviews' ) . ':</span> ', '</span>' ); |
|
56 | + lsx_to_connected_accommodation('<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __('Accommodation', 'to-reviews') . ':</span> ', '</span>'); |
|
57 | + lsx_to_connected_tours('<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __('Tours', 'to-reviews') . ':</span> ', '</span>'); |
|
58 | + lsx_to_connected_destinations('<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __('Destinations', 'to-reviews') . ':</span> ', '</span>'); |
|
59 | + if (function_exists('lsx_to_connected_team')) { |
|
60 | + lsx_to_connected_team('<span class="' . $meta_class . 'team"><span class="lsx-to-meta-data-key">' . __('Advised by', 'to-reviews') . ':</span> ', '</span>'); |
|
61 | 61 | } |
62 | 62 | ?> |
63 | 63 | </div> |