LSX_Activities::lsx_to_search_integration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * LSX_Activities
4
 *
5
 * @package   LSX_Activities
6
 * @author    LightSpeed
7
 * @license   GPL-2.0+
8
 * @link      
9
 * @copyright 2018 LightSpeedDevelopment
10
 */
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line after the file comment
Loading history...
11
if (!class_exists( 'LSX_Activities' ) ) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
12
	/**
13
	 * Main plugin class.
14
	 *
15
	 * @package LSX_Activities
16
	 * @author  LightSpeed
17
	 */
18
	class LSX_Activities {
19
		
20
		/**
21
		 * The plugins id
22
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
23
		public $plugin_slug = 'lsx-activities';
24
25
		/**
26
		 * The post types the plugin registers
27
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
28
		public $post_types = false;	
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
29
30
		/**
31
		 * The singular post types the plugin registers
32
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
33
		public $post_types_singular = false;	
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
34
35
		/**
36
		 * An array of the post types slugs plugin registers
37
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
38
		public $post_type_slugs = false;			
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
39
40
		/**
41
		 * The taxonomies the plugin registers
42
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
43
		public $taxonomies = false;				
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
44
45
		/**
46
		 * The taxonomies the plugin registers (plural)
47
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
48
		public $taxonomies_plural = false;
49
50
		/**
51
		 * Hold the TO options
52
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
53
		public $options = array();
54
55
		/**
56
		 * Hold the GoogleMaps API key
57
		 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
58
		public $api_key = false;
59
60
		/**
61
		 * Constructor
62
		 */
63
		public function __construct() {
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
64
			//Set the variables
0 ignored issues
show
Coding Style introduced by
No space found before comment text; expected "// Set the variables" but found "//Set the variables"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
65
			$this->set_vars();
66
			$this->lsx_to_search_integration();
67
68
			// Make TO last plugin to load
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
69
			add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
70
			
71
			add_action('init',array($this,'load_plugin_textdomain'));
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
Missing space after array opener.
Loading history...
introduced by
Expected 1 space between comma and "'load_plugin_textdomain'"; 0 found
Loading history...
introduced by
Missing space before array closer.
Loading history...
72
73
			if(false !== $this->post_types){
0 ignored issues
show
introduced by
The condition false !== $this->post_types is always true.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
74
				add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
75
				add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
76
				add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
77
				add_filter('lsx_to_settings_path',array( $this, 'plugin_path'),10,2);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
Missing space before array closer.
Loading history...
78
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
79
			if(false !== $this->taxonomies){
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
80
				add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
81
				add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
82
			}	
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
83
84
			require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-admin.php');
0 ignored issues
show
Coding Style introduced by
"require_once" is a statement not a function; no parentheses are required
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
85
			require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-frontend.php');
0 ignored issues
show
Coding Style introduced by
"require_once" is a statement not a function; no parentheses are required
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
86
			require_once(LSX_ACTIVITIES_PATH . '/includes/template-tags.php');
0 ignored issues
show
Coding Style introduced by
"require_once" is a statement not a function; no parentheses are required
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
87
88
			// flush_rewrite_rules()
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
89
			register_activation_hook( LSX_ACTIVITIES_CORE, array( $this, 'register_activation_hook' ) );
90
			add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) );
91
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
92
93
		/**
94
		 * Include the post type for the search integration
95
		 */
96
		public function lsx_to_search_integration(){
0 ignored issues
show
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
97
			add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
98
			add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter') );
0 ignored issues
show
introduced by
Missing space before array closer.
Loading history...
99
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
100
	
101
		/**
102
		 * Load the plugin text domain for translation.
103
		 */
104
		public function load_plugin_textdomain() {
105
			load_plugin_textdomain( 'lsx-activities', FALSE, basename( LSX_ACTIVITIES_PATH ) . '/languages');
0 ignored issues
show
introduced by
The parameter "FALSE" at position #2 of load_plugin_textdomain() has been deprecated since WordPress version 2.7.0. Use "" instead.
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL must be lowercase; expected false, but found FALSE.
Loading history...
106
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
107
108
		/**
109
		 * Sets the plugins variables
110
		 */
111
		public function set_vars() {
112
			$this->post_types = array(
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
113
				'activity'	=>	__('Activities','lsx-activities')
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 1 space(s) between "'activity'" and double arrow, but found 2.
Loading history...
introduced by
Expected 1 space after "=>"; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
Each array item in a multi-line array declaration must end in a comma
Loading history...
114
			);
115
			$this->post_types_singular = array(
116
				'activity'	=>	__('Activity','lsx-activities')
0 ignored issues
show
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
introduced by
Array double arrow not aligned correctly; expected 1 space(s) between "'activity'" and double arrow, but found 2.
Loading history...
introduced by
Expected 1 space after "=>"; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
Each array item in a multi-line array declaration must end in a comma
Loading history...
117
			);
118
			$this->post_type_slugs = array_keys($this->post_types);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
119
120
			$this->options = get_option('_lsx-to_settings',false);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
121
			if((false !== $this->options && isset($this->options['api']['googlemaps_key'])) || defined('GOOGLEMAPS_API_KEY')) {
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 space after open parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 space before close parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
122
123
				if (!defined('GOOGLEMAPS_API_KEY')) {
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
introduced by
Expected 1 space before "!"; 0 found
Loading history...
introduced by
Expected 1 space after "!"; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
124
					$this->api_key = $this->options['api']['googlemaps_key'];
125
				} else {
126
					$this->api_key = GOOGLEMAPS_API_KEY;
0 ignored issues
show
Bug introduced by
The constant GOOGLEMAPS_API_KEY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
127
				}
128
			}
129
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
130
131
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$path" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$post_type" missing
Loading history...
132
		 * Adds our post types to an array via a filter
133
		 */
134
		public function plugin_path($path,$post_type){
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 space between comma and argument "$post_type"; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
135
			if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
Bug introduced by
$this->post_types of type true is incompatible with the type ArrayObject|array expected by parameter $array of array_key_exists(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

135
			if(false !== $this->post_types && array_key_exists($post_type,/** @scrutinizer ignore-type */ $this->post_types)){
Loading history...
136
				$path = LSX_ACTIVITIES_PATH;
137
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
138
			return $path;
139
		}	
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
140
141
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$post_types" missing
Loading history...
142
		 * Adds our post types to an array via a filter
143
		 */
144
		public function post_types_slugs_filter($post_types){
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
145
			if(is_array($post_types)){
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
146
				$post_types = array_merge($post_types,$this->post_type_slugs);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
Bug introduced by
$this->post_type_slugs of type boolean is incompatible with the type array expected by parameter $arrays of array_merge(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

146
				$post_types = array_merge($post_types,/** @scrutinizer ignore-type */ $this->post_type_slugs);
Loading history...
147
			}else{
0 ignored issues
show
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after ELSE keyword; 0 found
Loading history...
148
				$post_types = $this->post_type_slugs;
149
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
150
			return $post_types;
151
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
152
153
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$post_types" missing
Loading history...
154
		 * Adds our post types to an array via a filter
155
		 */
156
		public function post_types_filter($post_types){
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
157
			if(is_array($post_types) && is_array($this->post_types)){
0 ignored issues
show
introduced by
The condition is_array($this->post_types) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
158
				$post_types = array_merge($post_types,$this->post_types);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
159
			}elseif(is_array($this->post_types)){
0 ignored issues
show
introduced by
The condition is_array($this->post_types) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after ELSEIF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
160
				$post_types = $this->post_types;
161
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
162
			return $post_types;
163
		}	
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
164
165
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$post_types_singular" missing
Loading history...
166
		 * Adds our post types to an array via a filter
167
		 */
168
		public function post_types_singular_filter($post_types_singular){
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
169
			if(is_array($post_types_singular) && is_array($this->post_types_singular)){
0 ignored issues
show
introduced by
The condition is_array($this->post_types_singular) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
170
				$post_types_singular = array_merge($post_types_singular,$this->post_types_singular);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
171
			}elseif(is_array($this->post_types_singular)){
0 ignored issues
show
introduced by
The condition is_array($this->post_types_singular) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after ELSEIF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
172
				$post_types_singular = $this->post_types_singular;
173
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
174
			return $post_types_singular;
175
		}	
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
176
177
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$taxonomies" missing
Loading history...
178
		 * Adds our taxonomies to an array via a filter
179
		 */
180
		public function taxonomies_filter($taxonomies){
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
181
			if(is_array($taxonomies) && is_array($this->taxonomies)){
0 ignored issues
show
introduced by
The condition is_array($this->taxonomies) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
182
				$taxonomies = array_merge($taxonomies,$this->taxonomies);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
183
			}elseif(is_array($this->taxonomies)){
0 ignored issues
show
introduced by
The condition is_array($this->taxonomies) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after ELSEIF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
184
				$taxonomies = $this->taxonomies;
185
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
186
			return $taxonomies;
187
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
188
189
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$taxonomies_plural" missing
Loading history...
190
		 * Adds our taxonomies_plural to an array via a filter
191
		 */
192
		public function taxonomies_plural_filter($taxonomies_plural){
0 ignored issues
show
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
193
			if(is_array($taxonomies_plural) && is_array($this->taxonomies_plural)){
0 ignored issues
show
introduced by
The condition is_array($this->taxonomies_plural) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
194
				$taxonomies_plural = array_merge($taxonomies_plural,$this->taxonomies_plural);
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
195
			}elseif(is_array($this->taxonomies_plural)){
0 ignored issues
show
introduced by
The condition is_array($this->taxonomies_plural) is always false.
Loading history...
introduced by
Space after opening control structure is required
Loading history...
introduced by
No space before opening parenthesis is prohibited
Loading history...
introduced by
No space after opening parenthesis is prohibited
Loading history...
Coding Style introduced by
Expected 1 space(s) after ELSEIF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
introduced by
No space before closing parenthesis is prohibited
Loading history...
introduced by
Space between opening control structure and closing parenthesis is required
Loading history...
196
				$taxonomies_plural = $this->taxonomies_plural;
197
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
198
			return $taxonomies_plural;
199
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
200
	
201
		/**
202
		 * Make TO last plugin to load.
203
		 */
204
		public function activated_plugin() {
205
			if ( $plugins = get_option( 'active_plugins' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Variable assignment found within a condition. Did you mean to do a comparison?
Loading history...
Coding Style introduced by
Assignments must be the first block of code on a line
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
206
				$search = preg_grep( '/.*\/tour-operator\.php/', $plugins );
207
				$key = array_search( $search, $plugins );
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
introduced by
Not using strict comparison for array_search; supply true for third argument.
Loading history...
208
209
				if ( is_array( $search ) && count( $search ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
210
					foreach ( $search as $key => $path ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
211
						array_splice( $plugins, $key, 1 );
212
						array_push( $plugins, $path );
213
						update_option( 'active_plugins', $plugins );
214
					}
215
				}
216
			}
217
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
218
	
219
		/**
220
		 * On plugin activation
221
		 */
222
		public function register_activation_hook() {
223
			if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Processing form data without nonce verification.
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
224
				set_transient( '_tour_operators_activities_flush_rewrite_rules', 1, 30 );
225
			}
226
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
227
		
228
		/**
229
		 * On plugin activation (check)
230
		 */
231
		public function register_activation_hook_check() {
232
			if ( ! get_transient( '_tour_operators_activities_flush_rewrite_rules' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
233
				return;
234
			}
235
236
			delete_transient( '_tour_operators_activities_flush_rewrite_rules' );
237
			flush_rewrite_rules();
238
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
239
240
	}
241
	new LSX_Activities();
242
}