Completed
Push — master ( 957be0...c9782b )
by David
08:25
created
src/includes/class-wordlift.php 2 patches
Indentation   +517 added lines, -517 removed lines patch added patch discarded remove patch
@@ -29,545 +29,545 @@
 block discarded – undo
29 29
  */
30 30
 class Wordlift {
31 31
 
32
-	/**
33
-	 * The loader that's responsible for maintaining and registering all hooks that power
34
-	 * the plugin.
35
-	 *
36
-	 * @since    1.0.0
37
-	 * @access   protected
38
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
-	 */
40
-	protected $loader;
41
-
42
-	/**
43
-	 * The unique identifier of this plugin.
44
-	 *
45
-	 * @since    1.0.0
46
-	 * @access   protected
47
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
48
-	 */
49
-	protected $plugin_name;
50
-
51
-	/**
52
-	 * The current version of the plugin.
53
-	 *
54
-	 * @since    1.0.0
55
-	 * @access   protected
56
-	 * @var      string $version The current version of the plugin.
57
-	 */
58
-	protected $version;
59
-
60
-	/**
61
-	 * The Thumbnail service.
62
-	 *
63
-	 * @since 3.1.5
64
-	 * @access private
65
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
66
-	 */
67
-	private $thumbnail_service;
68
-
69
-	/**
70
-	 * The UI service.
71
-	 *
72
-	 * @since 3.2.0
73
-	 * @access private
74
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
75
-	 */
76
-	private $ui_service;
77
-
78
-	/**
79
-	 * The Schema service.
80
-	 *
81
-	 * @since 3.3.0
82
-	 * @access private
83
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
84
-	 */
85
-	private $schema_service;
86
-
87
-	/**
88
-	 * The Entity service.
89
-	 *
90
-	 * @since 3.1.0
91
-	 * @access private
92
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
93
-	 */
94
-	private $entity_service;
95
-
96
-	/**
97
-	 * The Topic Taxonomy service.
98
-	 *
99
-	 * @since 3.5.0
100
-	 * @access private
101
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
102
-	 */
103
-	private $topic_taxonomy_service;
104
-
105
-	/**
106
-	 * The User service.
107
-	 *
108
-	 * @since 3.1.7
109
-	 * @access private
110
-	 * @var \Wordlift_User_Service $user_service The User service.
111
-	 */
112
-	private $user_service;
113
-
114
-	/**
115
-	 * The Timeline service.
116
-	 *
117
-	 * @since 3.1.0
118
-	 * @access private
119
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
120
-	 */
121
-	private $timeline_service;
122
-
123
-	/**
124
-	 * The Redirect service.
125
-	 *
126
-	 * @since 3.2.0
127
-	 * @access private
128
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
129
-	 */
130
-	private $redirect_service;
131
-
132
-	/**
133
-	 * The Notice service.
134
-	 *
135
-	 * @since 3.3.0
136
-	 * @access private
137
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
138
-	 */
139
-	private $notice_service;
140
-
141
-	/**
142
-	 * The Entity list customization.
143
-	 *
144
-	 * @since 3.3.0
145
-	 * @access private
146
-	 * @var \Wordlift_List_Service $entity_list_service The Entity list service.
147
-	 */
148
-	private $entity_list_service;
149
-
150
-	/**
151
-	 * The Entity Types Taxonomy Walker.
152
-	 *
153
-	 * @since 3.1.0
154
-	 * @access private
155
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
156
-	 */
157
-	private $entity_types_taxonomy_walker;
158
-
159
-	/**
160
-	 * The ShareThis service.
161
-	 *
162
-	 * @since 3.2.0
163
-	 * @access private
164
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
165
-	 */
166
-	private $sharethis_service;
167
-
168
-	/**
169
-	 * The PrimaShop adapter.
170
-	 *
171
-	 * @since 3.2.3
172
-	 * @access private
173
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
174
-	 */
175
-	private $primashop_adapter;
176
-
177
-	/**
178
-	 * The WordLift Dashboard adapter.
179
-	 *
180
-	 * @since 3.4.0
181
-	 * @access private
182
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
183
-	 */
184
-	private $dashboard_service;
185
-
186
-	/**
187
-	 * @var
188
-	 */
189
-	private $page_service;
190
-
191
-	/**
192
-	 * Define the core functionality of the plugin.
193
-	 *
194
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
195
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
196
-	 * the public-facing side of the site.
197
-	 *
198
-	 * @since    1.0.0
199
-	 */
200
-	public function __construct() {
201
-
202
-		$this->plugin_name = 'wordlift';
203
-		$this->version     = '3.5.4';
204
-		$this->load_dependencies();
205
-		$this->set_locale();
206
-		$this->define_admin_hooks();
207
-		$this->define_public_hooks();
208
-
209
-	}
210
-
211
-	/**
212
-	 * Load the required dependencies for this plugin.
213
-	 *
214
-	 * Include the following files that make up the plugin:
215
-	 *
216
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
217
-	 * - Wordlift_i18n. Defines internationalization functionality.
218
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
219
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
220
-	 *
221
-	 * Create an instance of the loader which will be used to register the hooks
222
-	 * with WordPress.
223
-	 *
224
-	 * @since    1.0.0
225
-	 * @access   private
226
-	 */
227
-	private function load_dependencies() {
228
-
229
-		/**
230
-		 * The class responsible for orchestrating the actions and filters of the
231
-		 * core plugin.
232
-		 */
233
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
234
-
235
-		/**
236
-		 * The class responsible for defining internationalization functionality
237
-		 * of the plugin.
238
-		 */
239
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
240
-
241
-		/**
242
-		 * Provide support functions to sanitize data.
243
-		 */
244
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
245
-
246
-		/**
247
-		 * The Redirect service.
248
-		 */
249
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
250
-
251
-		/**
252
-		 * The Log service.
253
-		 */
254
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
255
-
256
-		/**
257
-		 * The Query builder.
258
-		 */
259
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
260
-
261
-		/**
262
-		 * The Schema service.
263
-		 */
264
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
265
-
266
-		/**
267
-		 * The UI service.
268
-		 */
269
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
270
-
271
-		/**
272
-		 * The Thumbnail service.
273
-		 */
274
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
275
-
276
-		/**
277
-		 * The Entity Types Taxonomy service.
278
-		 */
279
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
280
-
281
-		/**
282
-		 * The Entity service.
283
-		 */
284
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
285
-
286
-		/**
287
-		 * The User service.
288
-		 */
289
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
290
-
291
-		/**
292
-		 * The Timeline service.
293
-		 */
294
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
295
-
296
-		/**
297
-		 * The Topic Taxonomy service.
298
-		 */
299
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
300
-
301
-
302
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php';
303
-
304
-		/**
305
-		 * The class responsible for defining all actions that occur in the admin area.
306
-		 */
307
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
308
-
309
-		/**
310
-		 * The class to customize the entity list admin page.
311
-		 */
312
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
313
-
314
-		/**
315
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
316
-		 */
317
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
318
-
319
-		/**
320
-		 * The Notice service.
321
-		 */
322
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
323
-
324
-		/**
325
-		 * The PrimaShop adapter.
326
-		 */
327
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
328
-
329
-		/**
330
-		 * The WordLift Dashboard service.
331
-		 */
332
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
333
-
334
-		/**
335
-		 * The class responsible for defining all actions that occur in the public-facing
336
-		 * side of the site.
337
-		 */
338
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
339
-
340
-		/**
341
-		 * The shortcode abstract class.
342
-		 */
343
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
344
-
345
-		/**
346
-		 * The Timeline shortcode.
347
-		 */
348
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
349
-
350
-		/**
351
-		 * The Navigator shortcode.
352
-		 */
353
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
354
-
355
-		/**
356
-		 * The chord shortcode.
357
-		 */
358
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
32
+    /**
33
+     * The loader that's responsible for maintaining and registering all hooks that power
34
+     * the plugin.
35
+     *
36
+     * @since    1.0.0
37
+     * @access   protected
38
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
+     */
40
+    protected $loader;
41
+
42
+    /**
43
+     * The unique identifier of this plugin.
44
+     *
45
+     * @since    1.0.0
46
+     * @access   protected
47
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
48
+     */
49
+    protected $plugin_name;
50
+
51
+    /**
52
+     * The current version of the plugin.
53
+     *
54
+     * @since    1.0.0
55
+     * @access   protected
56
+     * @var      string $version The current version of the plugin.
57
+     */
58
+    protected $version;
59
+
60
+    /**
61
+     * The Thumbnail service.
62
+     *
63
+     * @since 3.1.5
64
+     * @access private
65
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
66
+     */
67
+    private $thumbnail_service;
68
+
69
+    /**
70
+     * The UI service.
71
+     *
72
+     * @since 3.2.0
73
+     * @access private
74
+     * @var \Wordlift_UI_Service $ui_service The UI service.
75
+     */
76
+    private $ui_service;
77
+
78
+    /**
79
+     * The Schema service.
80
+     *
81
+     * @since 3.3.0
82
+     * @access private
83
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
84
+     */
85
+    private $schema_service;
86
+
87
+    /**
88
+     * The Entity service.
89
+     *
90
+     * @since 3.1.0
91
+     * @access private
92
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
93
+     */
94
+    private $entity_service;
95
+
96
+    /**
97
+     * The Topic Taxonomy service.
98
+     *
99
+     * @since 3.5.0
100
+     * @access private
101
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
102
+     */
103
+    private $topic_taxonomy_service;
104
+
105
+    /**
106
+     * The User service.
107
+     *
108
+     * @since 3.1.7
109
+     * @access private
110
+     * @var \Wordlift_User_Service $user_service The User service.
111
+     */
112
+    private $user_service;
113
+
114
+    /**
115
+     * The Timeline service.
116
+     *
117
+     * @since 3.1.0
118
+     * @access private
119
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
120
+     */
121
+    private $timeline_service;
122
+
123
+    /**
124
+     * The Redirect service.
125
+     *
126
+     * @since 3.2.0
127
+     * @access private
128
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
129
+     */
130
+    private $redirect_service;
131
+
132
+    /**
133
+     * The Notice service.
134
+     *
135
+     * @since 3.3.0
136
+     * @access private
137
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
138
+     */
139
+    private $notice_service;
140
+
141
+    /**
142
+     * The Entity list customization.
143
+     *
144
+     * @since 3.3.0
145
+     * @access private
146
+     * @var \Wordlift_List_Service $entity_list_service The Entity list service.
147
+     */
148
+    private $entity_list_service;
149
+
150
+    /**
151
+     * The Entity Types Taxonomy Walker.
152
+     *
153
+     * @since 3.1.0
154
+     * @access private
155
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
156
+     */
157
+    private $entity_types_taxonomy_walker;
158
+
159
+    /**
160
+     * The ShareThis service.
161
+     *
162
+     * @since 3.2.0
163
+     * @access private
164
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
165
+     */
166
+    private $sharethis_service;
167
+
168
+    /**
169
+     * The PrimaShop adapter.
170
+     *
171
+     * @since 3.2.3
172
+     * @access private
173
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
174
+     */
175
+    private $primashop_adapter;
176
+
177
+    /**
178
+     * The WordLift Dashboard adapter.
179
+     *
180
+     * @since 3.4.0
181
+     * @access private
182
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
183
+     */
184
+    private $dashboard_service;
185
+
186
+    /**
187
+     * @var
188
+     */
189
+    private $page_service;
190
+
191
+    /**
192
+     * Define the core functionality of the plugin.
193
+     *
194
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
195
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
196
+     * the public-facing side of the site.
197
+     *
198
+     * @since    1.0.0
199
+     */
200
+    public function __construct() {
201
+
202
+        $this->plugin_name = 'wordlift';
203
+        $this->version     = '3.5.4';
204
+        $this->load_dependencies();
205
+        $this->set_locale();
206
+        $this->define_admin_hooks();
207
+        $this->define_public_hooks();
208
+
209
+    }
210
+
211
+    /**
212
+     * Load the required dependencies for this plugin.
213
+     *
214
+     * Include the following files that make up the plugin:
215
+     *
216
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
217
+     * - Wordlift_i18n. Defines internationalization functionality.
218
+     * - Wordlift_Admin. Defines all hooks for the admin area.
219
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
220
+     *
221
+     * Create an instance of the loader which will be used to register the hooks
222
+     * with WordPress.
223
+     *
224
+     * @since    1.0.0
225
+     * @access   private
226
+     */
227
+    private function load_dependencies() {
228
+
229
+        /**
230
+         * The class responsible for orchestrating the actions and filters of the
231
+         * core plugin.
232
+         */
233
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
234
+
235
+        /**
236
+         * The class responsible for defining internationalization functionality
237
+         * of the plugin.
238
+         */
239
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
240
+
241
+        /**
242
+         * Provide support functions to sanitize data.
243
+         */
244
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
245
+
246
+        /**
247
+         * The Redirect service.
248
+         */
249
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
250
+
251
+        /**
252
+         * The Log service.
253
+         */
254
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
255
+
256
+        /**
257
+         * The Query builder.
258
+         */
259
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
260
+
261
+        /**
262
+         * The Schema service.
263
+         */
264
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
265
+
266
+        /**
267
+         * The UI service.
268
+         */
269
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
270
+
271
+        /**
272
+         * The Thumbnail service.
273
+         */
274
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
275
+
276
+        /**
277
+         * The Entity Types Taxonomy service.
278
+         */
279
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
280
+
281
+        /**
282
+         * The Entity service.
283
+         */
284
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
285
+
286
+        /**
287
+         * The User service.
288
+         */
289
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
290
+
291
+        /**
292
+         * The Timeline service.
293
+         */
294
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
295
+
296
+        /**
297
+         * The Topic Taxonomy service.
298
+         */
299
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
300
+
301
+
302
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php';
303
+
304
+        /**
305
+         * The class responsible for defining all actions that occur in the admin area.
306
+         */
307
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
308
+
309
+        /**
310
+         * The class to customize the entity list admin page.
311
+         */
312
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
313
+
314
+        /**
315
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
316
+         */
317
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
318
+
319
+        /**
320
+         * The Notice service.
321
+         */
322
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
323
+
324
+        /**
325
+         * The PrimaShop adapter.
326
+         */
327
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
328
+
329
+        /**
330
+         * The WordLift Dashboard service.
331
+         */
332
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
333
+
334
+        /**
335
+         * The class responsible for defining all actions that occur in the public-facing
336
+         * side of the site.
337
+         */
338
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
339
+
340
+        /**
341
+         * The shortcode abstract class.
342
+         */
343
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
344
+
345
+        /**
346
+         * The Timeline shortcode.
347
+         */
348
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
349
+
350
+        /**
351
+         * The Navigator shortcode.
352
+         */
353
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
354
+
355
+        /**
356
+         * The chord shortcode.
357
+         */
358
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
359 359
 
360
-		/**
361
-		 * The geomap shortcode.
362
-		 */
363
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
360
+        /**
361
+         * The geomap shortcode.
362
+         */
363
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
364 364
 
365
-		/**
366
-		 * The ShareThis service.
367
-		 */
368
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
365
+        /**
366
+         * The ShareThis service.
367
+         */
368
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
369 369
 
370
-		$this->loader = new Wordlift_Loader();
370
+        $this->loader = new Wordlift_Loader();
371 371
 
372
-		// Instantiate a global logger.
373
-		global $wl_logger;
374
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
372
+        // Instantiate a global logger.
373
+        global $wl_logger;
374
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
375 375
 
376
-		// Create an instance of the UI service.
377
-		$this->ui_service = new Wordlift_UI_Service();
376
+        // Create an instance of the UI service.
377
+        $this->ui_service = new Wordlift_UI_Service();
378 378
 
379
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
380
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
379
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
380
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
381 381
 
382
-		// Create an instance of the Schema service.
383
-		$this->schema_service = new Wordlift_Schema_Service();
382
+        // Create an instance of the Schema service.
383
+        $this->schema_service = new Wordlift_Schema_Service();
384 384
 
385
-		// Create an instance of the Notice service.
386
-		$this->notice_service = new Wordlift_Notice_Service();
385
+        // Create an instance of the Notice service.
386
+        $this->notice_service = new Wordlift_Notice_Service();
387 387
 
388
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
389
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
388
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
389
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
390 390
 
391
-		// Create an instance of the User service.
392
-		$this->user_service = new Wordlift_User_Service();
391
+        // Create an instance of the User service.
392
+        $this->user_service = new Wordlift_User_Service();
393 393
 
394
-		// Create a new instance of the Timeline service and Timeline shortcode.
395
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
394
+        // Create a new instance of the Timeline service and Timeline shortcode.
395
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
396 396
 
397
-		// Create a new instance of the Redirect service.
398
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
397
+        // Create a new instance of the Redirect service.
398
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
399 399
 
400
-		// Create a new instance of the Redirect service.
401
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
400
+        // Create a new instance of the Redirect service.
401
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
402 402
 
403
-		// Initialize the shortcodes.
404
-		new Wordlift_Navigator_Shortcode();
405
-		new Wordlift_Chord_Shortcode();
406
-		new Wordlift_Geomap_Shortcode();
407
-		new Wordlift_Timeline_Shortcode();
403
+        // Initialize the shortcodes.
404
+        new Wordlift_Navigator_Shortcode();
405
+        new Wordlift_Chord_Shortcode();
406
+        new Wordlift_Geomap_Shortcode();
407
+        new Wordlift_Timeline_Shortcode();
408 408
 
409
-		// Create entity list customization (wp-admin/edit.php)
410
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
411
-
412
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
413
-
414
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
415
-
416
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
417
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
409
+        // Create entity list customization (wp-admin/edit.php)
410
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
411
+
412
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
413
+
414
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
415
+
416
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
417
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
418 418
 
419
-		// Create an instance of the PrimaShop adapter.
420
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
419
+        // Create an instance of the PrimaShop adapter.
420
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
421 421
 
422
-		$this->page_service = new Wordlift_Page_Service();
423
-	}
422
+        $this->page_service = new Wordlift_Page_Service();
423
+    }
424 424
 
425
-	/**
426
-	 * Define the locale for this plugin for internationalization.
427
-	 *
428
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
429
-	 * with WordPress.
430
-	 *
431
-	 * @since    1.0.0
432
-	 * @access   private
433
-	 */
434
-	private function set_locale() {
425
+    /**
426
+     * Define the locale for this plugin for internationalization.
427
+     *
428
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
429
+     * with WordPress.
430
+     *
431
+     * @since    1.0.0
432
+     * @access   private
433
+     */
434
+    private function set_locale() {
435 435
 
436
-		$plugin_i18n = new Wordlift_i18n();
437
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
436
+        $plugin_i18n = new Wordlift_i18n();
437
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
438 438
 
439
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
439
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
440 440
 
441
-	}
441
+    }
442 442
 
443
-	/**
444
-	 * Register all of the hooks related to the admin area functionality
445
-	 * of the plugin.
446
-	 *
447
-	 * @since    1.0.0
448
-	 * @access   private
449
-	 */
450
-	private function define_admin_hooks() {
451
-
452
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
443
+    /**
444
+     * Register all of the hooks related to the admin area functionality
445
+     * of the plugin.
446
+     *
447
+     * @since    1.0.0
448
+     * @access   private
449
+     */
450
+    private function define_admin_hooks() {
451
+
452
+        $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
453 453
 
454
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
455
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
456
-
457
-		// Hook the init action to the Topic Taxonomy service.
458
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
459
-
460
-		// Hook the deleted_post_meta action to the Thumbnail service.
461
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
462
-
463
-		// Hook the added_post_meta action to the Thumbnail service.
464
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
465
-
466
-		// Hook the updated_post_meta action to the Thumbnail service.
467
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
468
-
469
-		// Hook posts inserts (or updates) to the user service.
470
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
471
-
472
-		// Hook the AJAX wl_timeline action to the Timeline service.
473
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
474
-
475
-		// Register custom allowed redirect hosts.
476
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
477
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
478
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
479
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
480
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
481
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
482
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
483
-
484
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
485
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
486
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
487
-		$this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
488
-
489
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
490
-		$this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
491
-
492
-		// Entity listing customization (wp-admin/edit.php)
493
-		// Add custom columns
494
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
495
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
496
-		// Add 4W selection
497
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
498
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
499
-
500
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
501
-
502
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
503
-		// entities.
504
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
505
-	}
506
-
507
-	/**
508
-	 * Register all of the hooks related to the public-facing functionality
509
-	 * of the plugin.
510
-	 *
511
-	 * @since    1.0.0
512
-	 * @access   private
513
-	 */
514
-	private function define_public_hooks() {
515
-
516
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
517
-
518
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
519
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
520
-
521
-		// Hook the AJAX wl_timeline action to the Timeline service.
522
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
523
-
524
-		// Hook the ShareThis service.
525
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
526
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
527
-
528
-		$this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX );
529
-		$this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX );
530
-
531
-	}
532
-
533
-	/**
534
-	 * Run the loader to execute all of the hooks with WordPress.
535
-	 *
536
-	 * @since    1.0.0
537
-	 */
538
-	public function run() {
539
-		$this->loader->run();
540
-	}
541
-
542
-	/**
543
-	 * The name of the plugin used to uniquely identify it within the context of
544
-	 * WordPress and to define internationalization functionality.
545
-	 *
546
-	 * @since     1.0.0
547
-	 * @return    string    The name of the plugin.
548
-	 */
549
-	public function get_plugin_name() {
550
-		return $this->plugin_name;
551
-	}
552
-
553
-	/**
554
-	 * The reference to the class that orchestrates the hooks with the plugin.
555
-	 *
556
-	 * @since     1.0.0
557
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
558
-	 */
559
-	public function get_loader() {
560
-		return $this->loader;
561
-	}
562
-
563
-	/**
564
-	 * Retrieve the version number of the plugin.
565
-	 *
566
-	 * @since     1.0.0
567
-	 * @return    string    The version number of the plugin.
568
-	 */
569
-	public function get_version() {
570
-		return $this->version;
571
-	}
454
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
455
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
456
+
457
+        // Hook the init action to the Topic Taxonomy service.
458
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
459
+
460
+        // Hook the deleted_post_meta action to the Thumbnail service.
461
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
462
+
463
+        // Hook the added_post_meta action to the Thumbnail service.
464
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
465
+
466
+        // Hook the updated_post_meta action to the Thumbnail service.
467
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
468
+
469
+        // Hook posts inserts (or updates) to the user service.
470
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
471
+
472
+        // Hook the AJAX wl_timeline action to the Timeline service.
473
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
474
+
475
+        // Register custom allowed redirect hosts.
476
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
477
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
478
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
479
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
480
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
481
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
482
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
483
+
484
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
485
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
486
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
487
+        $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
488
+
489
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
490
+        $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
491
+
492
+        // Entity listing customization (wp-admin/edit.php)
493
+        // Add custom columns
494
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
495
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
496
+        // Add 4W selection
497
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
498
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
499
+
500
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
501
+
502
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
503
+        // entities.
504
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
505
+    }
506
+
507
+    /**
508
+     * Register all of the hooks related to the public-facing functionality
509
+     * of the plugin.
510
+     *
511
+     * @since    1.0.0
512
+     * @access   private
513
+     */
514
+    private function define_public_hooks() {
515
+
516
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
517
+
518
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
519
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
520
+
521
+        // Hook the AJAX wl_timeline action to the Timeline service.
522
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
523
+
524
+        // Hook the ShareThis service.
525
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
526
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
527
+
528
+        $this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX );
529
+        $this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX );
530
+
531
+    }
532
+
533
+    /**
534
+     * Run the loader to execute all of the hooks with WordPress.
535
+     *
536
+     * @since    1.0.0
537
+     */
538
+    public function run() {
539
+        $this->loader->run();
540
+    }
541
+
542
+    /**
543
+     * The name of the plugin used to uniquely identify it within the context of
544
+     * WordPress and to define internationalization functionality.
545
+     *
546
+     * @since     1.0.0
547
+     * @return    string    The name of the plugin.
548
+     */
549
+    public function get_plugin_name() {
550
+        return $this->plugin_name;
551
+    }
552
+
553
+    /**
554
+     * The reference to the class that orchestrates the hooks with the plugin.
555
+     *
556
+     * @since     1.0.0
557
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
558
+     */
559
+    public function get_loader() {
560
+        return $this->loader;
561
+    }
562
+
563
+    /**
564
+     * Retrieve the version number of the plugin.
565
+     *
566
+     * @since     1.0.0
567
+     * @return    string    The version number of the plugin.
568
+     */
569
+    public function get_version() {
570
+        return $this->version;
571
+    }
572 572
 
573 573
 }
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -230,148 +230,148 @@  discard block
 block discarded – undo
230 230
 		 * The class responsible for orchestrating the actions and filters of the
231 231
 		 * core plugin.
232 232
 		 */
233
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
233
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
234 234
 
235 235
 		/**
236 236
 		 * The class responsible for defining internationalization functionality
237 237
 		 * of the plugin.
238 238
 		 */
239
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
239
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
240 240
 
241 241
 		/**
242 242
 		 * Provide support functions to sanitize data.
243 243
 		 */
244
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
244
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
245 245
 
246 246
 		/**
247 247
 		 * The Redirect service.
248 248
 		 */
249
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
249
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
250 250
 
251 251
 		/**
252 252
 		 * The Log service.
253 253
 		 */
254
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
254
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
255 255
 
256 256
 		/**
257 257
 		 * The Query builder.
258 258
 		 */
259
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
259
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
260 260
 
261 261
 		/**
262 262
 		 * The Schema service.
263 263
 		 */
264
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
264
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
265 265
 
266 266
 		/**
267 267
 		 * The UI service.
268 268
 		 */
269
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
269
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
270 270
 
271 271
 		/**
272 272
 		 * The Thumbnail service.
273 273
 		 */
274
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
274
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
275 275
 
276 276
 		/**
277 277
 		 * The Entity Types Taxonomy service.
278 278
 		 */
279
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
279
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
280 280
 
281 281
 		/**
282 282
 		 * The Entity service.
283 283
 		 */
284
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
284
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
285 285
 
286 286
 		/**
287 287
 		 * The User service.
288 288
 		 */
289
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
289
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
290 290
 
291 291
 		/**
292 292
 		 * The Timeline service.
293 293
 		 */
294
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
294
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
295 295
 
296 296
 		/**
297 297
 		 * The Topic Taxonomy service.
298 298
 		 */
299
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
299
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
300 300
 
301 301
 
302
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php';
302
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-page-service.php';
303 303
 
304 304
 		/**
305 305
 		 * The class responsible for defining all actions that occur in the admin area.
306 306
 		 */
307
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
307
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
308 308
 
309 309
 		/**
310 310
 		 * The class to customize the entity list admin page.
311 311
 		 */
312
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
312
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
313 313
 
314 314
 		/**
315 315
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
316 316
 		 */
317
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
317
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
318 318
 
319 319
 		/**
320 320
 		 * The Notice service.
321 321
 		 */
322
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
322
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
323 323
 
324 324
 		/**
325 325
 		 * The PrimaShop adapter.
326 326
 		 */
327
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
327
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
328 328
 
329 329
 		/**
330 330
 		 * The WordLift Dashboard service.
331 331
 		 */
332
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
332
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
333 333
 
334 334
 		/**
335 335
 		 * The class responsible for defining all actions that occur in the public-facing
336 336
 		 * side of the site.
337 337
 		 */
338
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
338
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
339 339
 
340 340
 		/**
341 341
 		 * The shortcode abstract class.
342 342
 		 */
343
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
343
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
344 344
 
345 345
 		/**
346 346
 		 * The Timeline shortcode.
347 347
 		 */
348
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
348
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
349 349
 
350 350
 		/**
351 351
 		 * The Navigator shortcode.
352 352
 		 */
353
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
353
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
354 354
 
355 355
 		/**
356 356
 		 * The chord shortcode.
357 357
 		 */
358
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
358
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
359 359
 
360 360
 		/**
361 361
 		 * The geomap shortcode.
362 362
 		 */
363
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
363
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
364 364
 
365 365
 		/**
366 366
 		 * The ShareThis service.
367 367
 		 */
368
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
368
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
369 369
 
370 370
 		$this->loader = new Wordlift_Loader();
371 371
 
372 372
 		// Instantiate a global logger.
373 373
 		global $wl_logger;
374
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
374
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
375 375
 
376 376
 		// Create an instance of the UI service.
377 377
 		$this->ui_service = new Wordlift_UI_Service();
@@ -386,19 +386,19 @@  discard block
 block discarded – undo
386 386
 		$this->notice_service = new Wordlift_Notice_Service();
387 387
 
388 388
 		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
389
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
389
+		$this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->schema_service, $this->notice_service);
390 390
 
391 391
 		// Create an instance of the User service.
392 392
 		$this->user_service = new Wordlift_User_Service();
393 393
 
394 394
 		// Create a new instance of the Timeline service and Timeline shortcode.
395
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
395
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service);
396 396
 
397 397
 		// Create a new instance of the Redirect service.
398
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
398
+		$this->redirect_service = new Wordlift_Redirect_Service($this->entity_service);
399 399
 
400 400
 		// Create a new instance of the Redirect service.
401
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
401
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->entity_service);
402 402
 
403 403
 		// Initialize the shortcodes.
404 404
 		new Wordlift_Navigator_Shortcode();
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		new Wordlift_Timeline_Shortcode();
408 408
 
409 409
 		// Create entity list customization (wp-admin/edit.php)
410
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
410
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->entity_service);
411 411
 
412 412
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
413 413
 
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
 	private function set_locale() {
435 435
 
436 436
 		$plugin_i18n = new Wordlift_i18n();
437
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
437
+		$plugin_i18n->set_domain($this->get_plugin_name());
438 438
 
439
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
439
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
440 440
 
441 441
 	}
442 442
 
@@ -449,59 +449,59 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	private function define_admin_hooks() {
451 451
 
452
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
452
+		$plugin_admin = new Wordlift_Admin($this->get_plugin_name(), $this->get_version());
453 453
 
454
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
455
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
454
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
455
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
456 456
 
457 457
 		// Hook the init action to the Topic Taxonomy service.
458
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
458
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
459 459
 
460 460
 		// Hook the deleted_post_meta action to the Thumbnail service.
461
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
461
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
462 462
 
463 463
 		// Hook the added_post_meta action to the Thumbnail service.
464
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
464
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
465 465
 
466 466
 		// Hook the updated_post_meta action to the Thumbnail service.
467
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
467
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
468 468
 
469 469
 		// Hook posts inserts (or updates) to the user service.
470
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
470
+		$this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3);
471 471
 
472 472
 		// Hook the AJAX wl_timeline action to the Timeline service.
473
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
473
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
474 474
 
475 475
 		// Register custom allowed redirect hosts.
476
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
476
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
477 477
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
478
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
478
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
479 479
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
480
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
480
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
481 481
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
482
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
482
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
483 483
 
484 484
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
485 485
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
486
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
487
-		$this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
486
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
487
+		$this->loader->add_action('save_post_entity', $this->entity_service, 'set_rating_for', 10, 1);
488 488
 
489
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
490
-		$this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
489
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
490
+		$this->loader->add_action('in_admin_header', $this->entity_service, 'in_admin_header');
491 491
 
492 492
 		// Entity listing customization (wp-admin/edit.php)
493 493
 		// Add custom columns
494
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
495
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
494
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
495
+		$this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
496 496
 		// Add 4W selection
497
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
498
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
497
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
498
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
499 499
 
500
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
500
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
501 501
 
502 502
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
503 503
 		// entities.
504
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
504
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
505 505
 	}
506 506
 
507 507
 	/**
@@ -513,20 +513,20 @@  discard block
 block discarded – undo
513 513
 	 */
514 514
 	private function define_public_hooks() {
515 515
 
516
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
516
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
517 517
 
518
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
519
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
518
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
519
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
520 520
 
521 521
 		// Hook the AJAX wl_timeline action to the Timeline service.
522
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
522
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
523 523
 
524 524
 		// Hook the ShareThis service.
525
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
526
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
525
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
526
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
527 527
 
528
-		$this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX );
529
-		$this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX );
528
+		$this->loader->add_action('wp_head', $this->page_service, 'wp_head', PHP_INT_MAX);
529
+		$this->loader->add_action('wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX);
530 530
 
531 531
 	}
532 532
 
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_navigator.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -8,89 +8,89 @@
 block discarded – undo
8 8
 
9 9
 function wl_shortcode_navigator_ajax( $http_raw_data = NULL ) {
10 10
 
11
-	// Post ID must be defined
12
-	if ( ! isset( $_GET['post_id'] ) ) {
13
-		wp_die( 'No post_id given' );
14
-
15
-		return;
16
-	}
17
-
18
-	$current_post_id = $_GET['post_id'];
19
-	$current_post    = get_post( $current_post_id );
20
-
21
-	// Post ID has to match an existing item
22
-	if ( NULL === $current_post ) {
23
-		wp_die( 'No valid post_id given' );
24
-
25
-		return;
26
-	}
27
-
28
-	// prepare structures to memorize other related posts
29
-	$results          = array();
30
-	$blacklist_ids    = array( $current_post_id );
31
-	$related_entities = array();
32
-
33
-	// Get the related entities, ordering them by WHO, WHAT, WHERE, WHEN 
34
-	// TODO Replace with a single query if it is possible
35
-	// We select in inverse order to give priority to less used entities 
36
-	foreach (
37
-		array(
38
-			WL_WHEN_RELATION,
39
-			WL_WHERE_RELATION,
40
-			WL_WHAT_RELATION,
41
-			WL_WHO_RELATION
42
-		) as $predicate
43
-	) {
44
-
45
-		$related_entities = array_merge( $related_entities, wl_core_get_related_entities( $current_post_id, array(
46
-			'predicate' => $predicate,
47
-			'status'    => 'publish'
48
-		) ) );
49
-
50
-	}
51
-
52
-	foreach ( $related_entities as $related_entity ) {
53
-
54
-		// take the id of posts referencing the entity
55
-		$referencing_posts = wl_core_get_related_posts( $related_entity->ID, array(
56
-			'status' => 'publish'
57
-		) );
58
-
59
-		// loop over them and take the first one which is not already in the $related_posts
60
-		foreach ( $referencing_posts as $referencing_post ) {
61
-
62
-			if ( ! in_array( $referencing_post->ID, $blacklist_ids ) ) {
63
-
64
-				$blacklist_ids[]   = $referencing_post->ID;
65
-				$serialized_entity = wl_serialize_entity( $related_entity );
66
-				$thumbnail         = wp_get_attachment_url( get_post_thumbnail_id( $referencing_post->ID, 'thumbnail' ) );
67
-
68
-				if ( $thumbnail ) {
69
-
70
-					$results[] = array(
71
-						'post'   => array(
72
-							'permalink' => get_post_permalink( $referencing_post->ID ),
73
-							'title'     => $referencing_post->post_title,
74
-							'thumbnail' => $thumbnail
75
-						),
76
-						'entity' => array(
77
-							'label'     => $serialized_entity['label'],
78
-							'mainType'  => $serialized_entity['mainType'],
79
-							'permalink' => get_post_permalink( $related_entity->ID )
80
-						)
81
-					);
82
-
83
-					// Be sure no more than 1 post for entity is returned
84
-					break;
85
-				}
86
-			}
87
-		}
88
-	}
89
-
90
-	// Return first 4 results in json accordingly to 4 columns layout
91
-	wl_core_send_json(
92
-		array_slice( array_reverse( $results ), 0, 4 )
93
-	);
11
+    // Post ID must be defined
12
+    if ( ! isset( $_GET['post_id'] ) ) {
13
+        wp_die( 'No post_id given' );
14
+
15
+        return;
16
+    }
17
+
18
+    $current_post_id = $_GET['post_id'];
19
+    $current_post    = get_post( $current_post_id );
20
+
21
+    // Post ID has to match an existing item
22
+    if ( NULL === $current_post ) {
23
+        wp_die( 'No valid post_id given' );
24
+
25
+        return;
26
+    }
27
+
28
+    // prepare structures to memorize other related posts
29
+    $results          = array();
30
+    $blacklist_ids    = array( $current_post_id );
31
+    $related_entities = array();
32
+
33
+    // Get the related entities, ordering them by WHO, WHAT, WHERE, WHEN 
34
+    // TODO Replace with a single query if it is possible
35
+    // We select in inverse order to give priority to less used entities 
36
+    foreach (
37
+        array(
38
+            WL_WHEN_RELATION,
39
+            WL_WHERE_RELATION,
40
+            WL_WHAT_RELATION,
41
+            WL_WHO_RELATION
42
+        ) as $predicate
43
+    ) {
44
+
45
+        $related_entities = array_merge( $related_entities, wl_core_get_related_entities( $current_post_id, array(
46
+            'predicate' => $predicate,
47
+            'status'    => 'publish'
48
+        ) ) );
49
+
50
+    }
51
+
52
+    foreach ( $related_entities as $related_entity ) {
53
+
54
+        // take the id of posts referencing the entity
55
+        $referencing_posts = wl_core_get_related_posts( $related_entity->ID, array(
56
+            'status' => 'publish'
57
+        ) );
58
+
59
+        // loop over them and take the first one which is not already in the $related_posts
60
+        foreach ( $referencing_posts as $referencing_post ) {
61
+
62
+            if ( ! in_array( $referencing_post->ID, $blacklist_ids ) ) {
63
+
64
+                $blacklist_ids[]   = $referencing_post->ID;
65
+                $serialized_entity = wl_serialize_entity( $related_entity );
66
+                $thumbnail         = wp_get_attachment_url( get_post_thumbnail_id( $referencing_post->ID, 'thumbnail' ) );
67
+
68
+                if ( $thumbnail ) {
69
+
70
+                    $results[] = array(
71
+                        'post'   => array(
72
+                            'permalink' => get_post_permalink( $referencing_post->ID ),
73
+                            'title'     => $referencing_post->post_title,
74
+                            'thumbnail' => $thumbnail
75
+                        ),
76
+                        'entity' => array(
77
+                            'label'     => $serialized_entity['label'],
78
+                            'mainType'  => $serialized_entity['mainType'],
79
+                            'permalink' => get_post_permalink( $related_entity->ID )
80
+                        )
81
+                    );
82
+
83
+                    // Be sure no more than 1 post for entity is returned
84
+                    break;
85
+                }
86
+            }
87
+        }
88
+    }
89
+
90
+    // Return first 4 results in json accordingly to 4 columns layout
91
+    wl_core_send_json(
92
+        array_slice( array_reverse( $results ), 0, 4 )
93
+    );
94 94
 }
95 95
 
96 96
 ///**
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 //	add_shortcode( 'wl_navigator', 'wordlift_shortcode_navigator' );
7 7
 //}
8 8
 
9
-function wl_shortcode_navigator_ajax( $http_raw_data = NULL ) {
9
+function wl_shortcode_navigator_ajax($http_raw_data = NULL) {
10 10
 
11 11
 	// Post ID must be defined
12
-	if ( ! isset( $_GET['post_id'] ) ) {
13
-		wp_die( 'No post_id given' );
12
+	if ( ! isset($_GET['post_id'])) {
13
+		wp_die('No post_id given');
14 14
 
15 15
 		return;
16 16
 	}
17 17
 
18 18
 	$current_post_id = $_GET['post_id'];
19
-	$current_post    = get_post( $current_post_id );
19
+	$current_post    = get_post($current_post_id);
20 20
 
21 21
 	// Post ID has to match an existing item
22
-	if ( NULL === $current_post ) {
23
-		wp_die( 'No valid post_id given' );
22
+	if (NULL === $current_post) {
23
+		wp_die('No valid post_id given');
24 24
 
25 25
 		return;
26 26
 	}
27 27
 
28 28
 	// prepare structures to memorize other related posts
29 29
 	$results          = array();
30
-	$blacklist_ids    = array( $current_post_id );
30
+	$blacklist_ids    = array($current_post_id);
31 31
 	$related_entities = array();
32 32
 
33 33
 	// Get the related entities, ordering them by WHO, WHAT, WHERE, WHEN 
@@ -42,41 +42,41 @@  discard block
 block discarded – undo
42 42
 		) as $predicate
43 43
 	) {
44 44
 
45
-		$related_entities = array_merge( $related_entities, wl_core_get_related_entities( $current_post_id, array(
45
+		$related_entities = array_merge($related_entities, wl_core_get_related_entities($current_post_id, array(
46 46
 			'predicate' => $predicate,
47 47
 			'status'    => 'publish'
48
-		) ) );
48
+		)));
49 49
 
50 50
 	}
51 51
 
52
-	foreach ( $related_entities as $related_entity ) {
52
+	foreach ($related_entities as $related_entity) {
53 53
 
54 54
 		// take the id of posts referencing the entity
55
-		$referencing_posts = wl_core_get_related_posts( $related_entity->ID, array(
55
+		$referencing_posts = wl_core_get_related_posts($related_entity->ID, array(
56 56
 			'status' => 'publish'
57
-		) );
57
+		));
58 58
 
59 59
 		// loop over them and take the first one which is not already in the $related_posts
60
-		foreach ( $referencing_posts as $referencing_post ) {
60
+		foreach ($referencing_posts as $referencing_post) {
61 61
 
62
-			if ( ! in_array( $referencing_post->ID, $blacklist_ids ) ) {
62
+			if ( ! in_array($referencing_post->ID, $blacklist_ids)) {
63 63
 
64 64
 				$blacklist_ids[]   = $referencing_post->ID;
65
-				$serialized_entity = wl_serialize_entity( $related_entity );
66
-				$thumbnail         = wp_get_attachment_url( get_post_thumbnail_id( $referencing_post->ID, 'thumbnail' ) );
65
+				$serialized_entity = wl_serialize_entity($related_entity);
66
+				$thumbnail         = wp_get_attachment_url(get_post_thumbnail_id($referencing_post->ID, 'thumbnail'));
67 67
 
68
-				if ( $thumbnail ) {
68
+				if ($thumbnail) {
69 69
 
70 70
 					$results[] = array(
71 71
 						'post'   => array(
72
-							'permalink' => get_post_permalink( $referencing_post->ID ),
72
+							'permalink' => get_post_permalink($referencing_post->ID),
73 73
 							'title'     => $referencing_post->post_title,
74 74
 							'thumbnail' => $thumbnail
75 75
 						),
76 76
 						'entity' => array(
77 77
 							'label'     => $serialized_entity['label'],
78 78
 							'mainType'  => $serialized_entity['mainType'],
79
-							'permalink' => get_post_permalink( $related_entity->ID )
79
+							'permalink' => get_post_permalink($related_entity->ID)
80 80
 						)
81 81
 					);
82 82
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 	// Return first 4 results in json accordingly to 4 columns layout
91 91
 	wl_core_send_json(
92
-		array_slice( array_reverse( $results ), 0, 4 )
92
+		array_slice(array_reverse($results), 0, 4)
93 93
 	);
94 94
 }
95 95
 
@@ -145,6 +145,6 @@  discard block
 block discarded – undo
145 145
 //}
146 146
 
147 147
 //add_action( 'init', 'wordlift_register_shortcode_navigator' );
148
-add_action( 'wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax' );
149
-add_action( 'wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax' );
148
+add_action('wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax');
149
+add_action('wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax');
150 150
 
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_chord.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -8,33 +8,33 @@  discard block
 block discarded – undo
8 8
  * @return mixed
9 9
  */
10 10
 function wl_shortcode_chord_most_referenced_entity_id() {
11
-	// Get the last 20 posts by post date.
12
-	// For each post get the entities they reference.
13
-	$post_ids = get_posts( array(
14
-		'numberposts' => 20,
15
-		'post_type'   => 'post',
16
-		'fields'      => 'ids', //only get post IDs
17
-		'post_status' => 'published',
18
-		'orderby'     => 'post_date',
19
-		'order'       => 'DESC',
20
-	) );
21
-
22
-	if ( empty( $post_ids ) ) {
23
-		return NULL;
24
-	}
25
-
26
-	$entities = array();
27
-	foreach ( $post_ids as $id ) {
28
-		$entities = array_merge( $entities, wl_core_get_related_entity_ids( $id ) );
29
-	}
30
-
31
-	$famous_entities = array_count_values( $entities );
32
-	arsort( $famous_entities );
33
-	if ( sizeof( $famous_entities ) >= 1 ) {
34
-		return key( $famous_entities );
35
-	} else {
36
-		return $post_ids[0];
37
-	}
11
+    // Get the last 20 posts by post date.
12
+    // For each post get the entities they reference.
13
+    $post_ids = get_posts( array(
14
+        'numberposts' => 20,
15
+        'post_type'   => 'post',
16
+        'fields'      => 'ids', //only get post IDs
17
+        'post_status' => 'published',
18
+        'orderby'     => 'post_date',
19
+        'order'       => 'DESC',
20
+    ) );
21
+
22
+    if ( empty( $post_ids ) ) {
23
+        return NULL;
24
+    }
25
+
26
+    $entities = array();
27
+    foreach ( $post_ids as $id ) {
28
+        $entities = array_merge( $entities, wl_core_get_related_entity_ids( $id ) );
29
+    }
30
+
31
+    $famous_entities = array_count_values( $entities );
32
+    arsort( $famous_entities );
33
+    if ( sizeof( $famous_entities ) >= 1 ) {
34
+        return key( $famous_entities );
35
+    } else {
36
+        return $post_ids[0];
37
+    }
38 38
 
39 39
 }
40 40
 
@@ -52,60 +52,60 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function wl_shortcode_chord_get_relations( $entity_id, $depth = 2, $related = NULL, $max_size = 9 ) {
54 54
 
55
-	if ( ! is_null( $related ) ) {
56
-		if ( 0 === $depth ) {
57
-			return $related;
58
-		}
59
-	}
55
+    if ( ! is_null( $related ) ) {
56
+        if ( 0 === $depth ) {
57
+            return $related;
58
+        }
59
+    }
60 60
 
61
-	wl_write_log( "wl_shortcode_chord_get_relations [ post id :: $entity_id ][ depth :: $depth ][ related? :: " . ( is_null( $related ) ? 'yes' : 'no' ) . " ]" );
61
+    wl_write_log( "wl_shortcode_chord_get_relations [ post id :: $entity_id ][ depth :: $depth ][ related? :: " . ( is_null( $related ) ? 'yes' : 'no' ) . " ]" );
62 62
 
63
-	// Create a related array which will hold entities and relations.
64
-	if ( is_null( $related ) ) {
65
-		$related = array(
66
-			'entities'  => array( $entity_id ),
67
-			'relations' => array()
68
-		);
69
-	}
63
+    // Create a related array which will hold entities and relations.
64
+    if ( is_null( $related ) ) {
65
+        $related = array(
66
+            'entities'  => array( $entity_id ),
67
+            'relations' => array()
68
+        );
69
+    }
70 70
 
71
-	// Get related entities
72
-	$related_entity_ids = wl_core_get_related_entity_ids( $entity_id, array(
73
-		'status' => 'publish'
74
-	) );
71
+    // Get related entities
72
+    $related_entity_ids = wl_core_get_related_entity_ids( $entity_id, array(
73
+        'status' => 'publish'
74
+    ) );
75 75
 
76
-	// If the current node is an entity, add related posts too
77
-	$related_post_ids = ( Wordlift_Entity_Service::get_instance()
78
-	                                             ->is_entity( $entity_id ) ) ?
79
-		wl_core_get_related_post_ids( $entity_id, array(
80
-			'status' => 'publish'
81
-		) ) :
82
-		array();
76
+    // If the current node is an entity, add related posts too
77
+    $related_post_ids = ( Wordlift_Entity_Service::get_instance()
78
+                                                    ->is_entity( $entity_id ) ) ?
79
+        wl_core_get_related_post_ids( $entity_id, array(
80
+            'status' => 'publish'
81
+        ) ) :
82
+        array();
83 83
 
84
-	// Merge results and remove duplicated entries
85
-	$related_ids = array_unique( array_merge( $related_post_ids, $related_entity_ids ) );
84
+    // Merge results and remove duplicated entries
85
+    $related_ids = array_unique( array_merge( $related_post_ids, $related_entity_ids ) );
86 86
 
87
-	// TODO: List of entities ($rel) should be ordered by interest factors.
88
-	shuffle( $related_ids );
87
+    // TODO: List of entities ($rel) should be ordered by interest factors.
88
+    shuffle( $related_ids );
89 89
 
90
-	// Now we have all the related IDs.
91
-	foreach ( $related_ids as $related_id ) {
90
+    // Now we have all the related IDs.
91
+    foreach ( $related_ids as $related_id ) {
92 92
 
93
-		if ( count( $related['entities'] ) >= $max_size ) {
94
-			return $related;
95
-		}
93
+        if ( count( $related['entities'] ) >= $max_size ) {
94
+            return $related;
95
+        }
96 96
 
97
-		$related['relations'][] = array( $entity_id, $related_id );
97
+        $related['relations'][] = array( $entity_id, $related_id );
98 98
 
99
-		if ( ! in_array( $related_id, $related['entities'] ) ) {
100
-			// Found new related entity!
101
-			$related['entities'][] = $related_id;
99
+        if ( ! in_array( $related_id, $related['entities'] ) ) {
100
+            // Found new related entity!
101
+            $related['entities'][] = $related_id;
102 102
 
103
-			$related = wl_shortcode_chord_get_relations( $related_id, ( $depth - 1 ), $related, $max_size );
104
-		}
105
-	}
103
+            $related = wl_shortcode_chord_get_relations( $related_id, ( $depth - 1 ), $related, $max_size );
104
+        }
105
+    }
106 106
 
107
-	// End condition 2: no more entities to search for.
108
-	return $related;
107
+    // End condition 2: no more entities to search for.
108
+    return $related;
109 109
 }
110 110
 
111 111
 /**
@@ -119,56 +119,56 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function wl_shortcode_chord_get_graph( $data ) {
121 121
 
122
-	// Refactor the entities array in order to provide entities relevant data (uri, url, label, type, css_class).
123
-	array_walk( $data['entities'], function ( &$item ) {
124
-		$post = get_post( $item );
125
-
126
-		// Skip non-existing posts.
127
-		if ( is_null( $post ) ) {
128
-			wl_write_log( "wl_shortcode_chord_get_graph : post not found [ post id :: $item ]" );
129
-
130
-			return $item;
131
-		}
132
-
133
-		// Get the entity taxonomy bound to this post (if there's no taxonomy, no stylesheet will be set).
134
-		$term = wl_entity_type_taxonomy_get_type( $item );
135
-
136
-		wl_write_log( "wl_shortcode_chord_get_graph [ post id :: $post->ID ][ term :: " . var_export( $term, TRUE ) . " ]" );
137
-
138
-		// TODO: get all images
139
-		$thumbnail    = NULL;
140
-		$thumbnail_id = get_post_thumbnail_id( $post->ID );
141
-		if ( '' !== $thumbnail_id ) {
142
-			$attachment = wp_get_attachment_image_src( $thumbnail_id );
143
-			if ( FALSE !== $attachment ) {
144
-				$thumbnail = esc_attr( $attachment[0] );
145
-			}
146
-		}
147
-
148
-		$entity = array(
149
-			'uri'        => wl_get_entity_uri( $item ),
150
-			'url'        => get_permalink( $item ),
151
-			'label'      => $post->post_title,
152
-			'type'       => $post->post_type,
153
-			'thumbnails' => array( $thumbnail ),
154
-			'css_class'  => ( isset( $term['css_class'] ) ? $term['css_class'] : '' )
155
-		);
156
-
157
-		$item = $entity;
158
-	} );
159
-
160
-	// Refactor the relations.
161
-	array_walk( $data['relations'], function ( &$item ) {
162
-		$relation = array(
163
-			's' => wl_get_entity_uri( $item[0] ),
164
-			'o' => wl_get_entity_uri( $item[1] )
165
-		);
166
-
167
-		$item = $relation;
168
-	} );
169
-
170
-	// Return the JSON representation.
171
-	return $data;
122
+    // Refactor the entities array in order to provide entities relevant data (uri, url, label, type, css_class).
123
+    array_walk( $data['entities'], function ( &$item ) {
124
+        $post = get_post( $item );
125
+
126
+        // Skip non-existing posts.
127
+        if ( is_null( $post ) ) {
128
+            wl_write_log( "wl_shortcode_chord_get_graph : post not found [ post id :: $item ]" );
129
+
130
+            return $item;
131
+        }
132
+
133
+        // Get the entity taxonomy bound to this post (if there's no taxonomy, no stylesheet will be set).
134
+        $term = wl_entity_type_taxonomy_get_type( $item );
135
+
136
+        wl_write_log( "wl_shortcode_chord_get_graph [ post id :: $post->ID ][ term :: " . var_export( $term, TRUE ) . " ]" );
137
+
138
+        // TODO: get all images
139
+        $thumbnail    = NULL;
140
+        $thumbnail_id = get_post_thumbnail_id( $post->ID );
141
+        if ( '' !== $thumbnail_id ) {
142
+            $attachment = wp_get_attachment_image_src( $thumbnail_id );
143
+            if ( FALSE !== $attachment ) {
144
+                $thumbnail = esc_attr( $attachment[0] );
145
+            }
146
+        }
147
+
148
+        $entity = array(
149
+            'uri'        => wl_get_entity_uri( $item ),
150
+            'url'        => get_permalink( $item ),
151
+            'label'      => $post->post_title,
152
+            'type'       => $post->post_type,
153
+            'thumbnails' => array( $thumbnail ),
154
+            'css_class'  => ( isset( $term['css_class'] ) ? $term['css_class'] : '' )
155
+        );
156
+
157
+        $item = $entity;
158
+    } );
159
+
160
+    // Refactor the relations.
161
+    array_walk( $data['relations'], function ( &$item ) {
162
+        $relation = array(
163
+            's' => wl_get_entity_uri( $item[0] ),
164
+            'o' => wl_get_entity_uri( $item[1] )
165
+        );
166
+
167
+        $item = $relation;
168
+    } );
169
+
170
+    // Return the JSON representation.
171
+    return $data;
172 172
 }
173 173
 
174 174
 /**
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
  */
180 180
 function wl_shortcode_chord_ajax() {
181 181
 
182
-	$post_id = $_REQUEST['post_id'];
183
-	$depth   = $_REQUEST['depth'];
182
+    $post_id = $_REQUEST['post_id'];
183
+    $depth   = $_REQUEST['depth'];
184 184
 
185
-	$relations = wl_shortcode_chord_get_relations( $post_id, $depth );
186
-	$graph     = wl_shortcode_chord_get_graph( $relations );
185
+    $relations = wl_shortcode_chord_get_relations( $post_id, $depth );
186
+    $graph     = wl_shortcode_chord_get_graph( $relations );
187 187
 
188
-	wl_core_send_json( $graph );
188
+    wl_core_send_json( $graph );
189 189
 }
190 190
 
191 191
 add_action( 'wp_ajax_wl_chord', 'wl_shortcode_chord_ajax' );
Please login to merge, or discard this patch.
Spacing   +52 added lines, -53 removed lines patch added patch discarded remove patch
@@ -10,28 +10,28 @@  discard block
 block discarded – undo
10 10
 function wl_shortcode_chord_most_referenced_entity_id() {
11 11
 	// Get the last 20 posts by post date.
12 12
 	// For each post get the entities they reference.
13
-	$post_ids = get_posts( array(
13
+	$post_ids = get_posts(array(
14 14
 		'numberposts' => 20,
15 15
 		'post_type'   => 'post',
16 16
 		'fields'      => 'ids', //only get post IDs
17 17
 		'post_status' => 'published',
18 18
 		'orderby'     => 'post_date',
19 19
 		'order'       => 'DESC',
20
-	) );
20
+	));
21 21
 
22
-	if ( empty( $post_ids ) ) {
22
+	if (empty($post_ids)) {
23 23
 		return NULL;
24 24
 	}
25 25
 
26 26
 	$entities = array();
27
-	foreach ( $post_ids as $id ) {
28
-		$entities = array_merge( $entities, wl_core_get_related_entity_ids( $id ) );
27
+	foreach ($post_ids as $id) {
28
+		$entities = array_merge($entities, wl_core_get_related_entity_ids($id));
29 29
 	}
30 30
 
31
-	$famous_entities = array_count_values( $entities );
32
-	arsort( $famous_entities );
33
-	if ( sizeof( $famous_entities ) >= 1 ) {
34
-		return key( $famous_entities );
31
+	$famous_entities = array_count_values($entities);
32
+	arsort($famous_entities);
33
+	if (sizeof($famous_entities) >= 1) {
34
+		return key($famous_entities);
35 35
 	} else {
36 36
 		return $post_ids[0];
37 37
 	}
@@ -50,57 +50,56 @@  discard block
 block discarded – undo
50 50
  *
51 51
  * @return array
52 52
  */
53
-function wl_shortcode_chord_get_relations( $entity_id, $depth = 2, $related = NULL, $max_size = 9 ) {
53
+function wl_shortcode_chord_get_relations($entity_id, $depth = 2, $related = NULL, $max_size = 9) {
54 54
 
55
-	if ( ! is_null( $related ) ) {
56
-		if ( 0 === $depth ) {
55
+	if ( ! is_null($related)) {
56
+		if (0 === $depth) {
57 57
 			return $related;
58 58
 		}
59 59
 	}
60 60
 
61
-	wl_write_log( "wl_shortcode_chord_get_relations [ post id :: $entity_id ][ depth :: $depth ][ related? :: " . ( is_null( $related ) ? 'yes' : 'no' ) . " ]" );
61
+	wl_write_log("wl_shortcode_chord_get_relations [ post id :: $entity_id ][ depth :: $depth ][ related? :: ".(is_null($related) ? 'yes' : 'no')." ]");
62 62
 
63 63
 	// Create a related array which will hold entities and relations.
64
-	if ( is_null( $related ) ) {
64
+	if (is_null($related)) {
65 65
 		$related = array(
66
-			'entities'  => array( $entity_id ),
66
+			'entities'  => array($entity_id),
67 67
 			'relations' => array()
68 68
 		);
69 69
 	}
70 70
 
71 71
 	// Get related entities
72
-	$related_entity_ids = wl_core_get_related_entity_ids( $entity_id, array(
72
+	$related_entity_ids = wl_core_get_related_entity_ids($entity_id, array(
73 73
 		'status' => 'publish'
74
-	) );
74
+	));
75 75
 
76 76
 	// If the current node is an entity, add related posts too
77
-	$related_post_ids = ( Wordlift_Entity_Service::get_instance()
78
-	                                             ->is_entity( $entity_id ) ) ?
79
-		wl_core_get_related_post_ids( $entity_id, array(
77
+	$related_post_ids = (Wordlift_Entity_Service::get_instance()
78
+	                                             ->is_entity($entity_id)) ?
79
+		wl_core_get_related_post_ids($entity_id, array(
80 80
 			'status' => 'publish'
81
-		) ) :
82
-		array();
81
+		)) : array();
83 82
 
84 83
 	// Merge results and remove duplicated entries
85
-	$related_ids = array_unique( array_merge( $related_post_ids, $related_entity_ids ) );
84
+	$related_ids = array_unique(array_merge($related_post_ids, $related_entity_ids));
86 85
 
87 86
 	// TODO: List of entities ($rel) should be ordered by interest factors.
88
-	shuffle( $related_ids );
87
+	shuffle($related_ids);
89 88
 
90 89
 	// Now we have all the related IDs.
91
-	foreach ( $related_ids as $related_id ) {
90
+	foreach ($related_ids as $related_id) {
92 91
 
93
-		if ( count( $related['entities'] ) >= $max_size ) {
92
+		if (count($related['entities']) >= $max_size) {
94 93
 			return $related;
95 94
 		}
96 95
 
97
-		$related['relations'][] = array( $entity_id, $related_id );
96
+		$related['relations'][] = array($entity_id, $related_id);
98 97
 
99
-		if ( ! in_array( $related_id, $related['entities'] ) ) {
98
+		if ( ! in_array($related_id, $related['entities'])) {
100 99
 			// Found new related entity!
101 100
 			$related['entities'][] = $related_id;
102 101
 
103
-			$related = wl_shortcode_chord_get_relations( $related_id, ( $depth - 1 ), $related, $max_size );
102
+			$related = wl_shortcode_chord_get_relations($related_id, ($depth - 1), $related, $max_size);
104 103
 		}
105 104
 	}
106 105
 
@@ -117,51 +116,51 @@  discard block
 block discarded – undo
117 116
  *
118 117
  * @return mixed|string|void
119 118
  */
120
-function wl_shortcode_chord_get_graph( $data ) {
119
+function wl_shortcode_chord_get_graph($data) {
121 120
 
122 121
 	// Refactor the entities array in order to provide entities relevant data (uri, url, label, type, css_class).
123
-	array_walk( $data['entities'], function ( &$item ) {
124
-		$post = get_post( $item );
122
+	array_walk($data['entities'], function(&$item) {
123
+		$post = get_post($item);
125 124
 
126 125
 		// Skip non-existing posts.
127
-		if ( is_null( $post ) ) {
128
-			wl_write_log( "wl_shortcode_chord_get_graph : post not found [ post id :: $item ]" );
126
+		if (is_null($post)) {
127
+			wl_write_log("wl_shortcode_chord_get_graph : post not found [ post id :: $item ]");
129 128
 
130 129
 			return $item;
131 130
 		}
132 131
 
133 132
 		// Get the entity taxonomy bound to this post (if there's no taxonomy, no stylesheet will be set).
134
-		$term = wl_entity_type_taxonomy_get_type( $item );
133
+		$term = wl_entity_type_taxonomy_get_type($item);
135 134
 
136
-		wl_write_log( "wl_shortcode_chord_get_graph [ post id :: $post->ID ][ term :: " . var_export( $term, TRUE ) . " ]" );
135
+		wl_write_log("wl_shortcode_chord_get_graph [ post id :: $post->ID ][ term :: ".var_export($term, TRUE)." ]");
137 136
 
138 137
 		// TODO: get all images
139 138
 		$thumbnail    = NULL;
140
-		$thumbnail_id = get_post_thumbnail_id( $post->ID );
141
-		if ( '' !== $thumbnail_id ) {
142
-			$attachment = wp_get_attachment_image_src( $thumbnail_id );
143
-			if ( FALSE !== $attachment ) {
144
-				$thumbnail = esc_attr( $attachment[0] );
139
+		$thumbnail_id = get_post_thumbnail_id($post->ID);
140
+		if ('' !== $thumbnail_id) {
141
+			$attachment = wp_get_attachment_image_src($thumbnail_id);
142
+			if (FALSE !== $attachment) {
143
+				$thumbnail = esc_attr($attachment[0]);
145 144
 			}
146 145
 		}
147 146
 
148 147
 		$entity = array(
149
-			'uri'        => wl_get_entity_uri( $item ),
150
-			'url'        => get_permalink( $item ),
148
+			'uri'        => wl_get_entity_uri($item),
149
+			'url'        => get_permalink($item),
151 150
 			'label'      => $post->post_title,
152 151
 			'type'       => $post->post_type,
153
-			'thumbnails' => array( $thumbnail ),
154
-			'css_class'  => ( isset( $term['css_class'] ) ? $term['css_class'] : '' )
152
+			'thumbnails' => array($thumbnail),
153
+			'css_class'  => (isset($term['css_class']) ? $term['css_class'] : '')
155 154
 		);
156 155
 
157 156
 		$item = $entity;
158 157
 	} );
159 158
 
160 159
 	// Refactor the relations.
161
-	array_walk( $data['relations'], function ( &$item ) {
160
+	array_walk($data['relations'], function(&$item) {
162 161
 		$relation = array(
163
-			's' => wl_get_entity_uri( $item[0] ),
164
-			'o' => wl_get_entity_uri( $item[1] )
162
+			's' => wl_get_entity_uri($item[0]),
163
+			'o' => wl_get_entity_uri($item[1])
165 164
 		);
166 165
 
167 166
 		$item = $relation;
@@ -182,14 +181,14 @@  discard block
 block discarded – undo
182 181
 	$post_id = $_REQUEST['post_id'];
183 182
 	$depth   = $_REQUEST['depth'];
184 183
 
185
-	$relations = wl_shortcode_chord_get_relations( $post_id, $depth );
186
-	$graph     = wl_shortcode_chord_get_graph( $relations );
184
+	$relations = wl_shortcode_chord_get_relations($post_id, $depth);
185
+	$graph     = wl_shortcode_chord_get_graph($relations);
187 186
 
188
-	wl_core_send_json( $graph );
187
+	wl_core_send_json($graph);
189 188
 }
190 189
 
191
-add_action( 'wp_ajax_wl_chord', 'wl_shortcode_chord_ajax' );
192
-add_action( 'wp_ajax_nopriv_wl_chord', 'wl_shortcode_chord_ajax' );
190
+add_action('wp_ajax_wl_chord', 'wl_shortcode_chord_ajax');
191
+add_action('wp_ajax_nopriv_wl_chord', 'wl_shortcode_chord_ajax');
193 192
 
194 193
 //
195 194
 ///**
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_geomap.php 2 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -14,56 +14,56 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function wl_shortcode_geomap_get_places( $post_id = null ) {
16 16
 
17
-	// If $post_id is null or is not numeric it means this is a global geomap
18
-	$is_global = is_null( $post_id ) || ! is_numeric( $post_id );
17
+    // If $post_id is null or is not numeric it means this is a global geomap
18
+    $is_global = is_null( $post_id ) || ! is_numeric( $post_id );
19 19
 
20
-	// If the current one is not a global geomap, retrieve related entities ids
21
-	if ( $is_global ) {
22
-		$related_ids = array();
23
-	} else {
24
-		$related_ids = wl_core_get_related_entity_ids( $post_id, array(
25
-			'status' => 'publish'
26
-		) );
20
+    // If the current one is not a global geomap, retrieve related entities ids
21
+    if ( $is_global ) {
22
+        $related_ids = array();
23
+    } else {
24
+        $related_ids = wl_core_get_related_entity_ids( $post_id, array(
25
+            'status' => 'publish'
26
+        ) );
27 27
 		
28
-		// Also include current entity
29
-		if ( Wordlift_Entity_Service::get_instance()->is_entity( $post_id ) ) {
30
-			$related_ids[] = $post_id;
31
-		}
32
-	}
28
+        // Also include current entity
29
+        if ( Wordlift_Entity_Service::get_instance()->is_entity( $post_id ) ) {
30
+            $related_ids[] = $post_id;
31
+        }
32
+    }
33 33
 
34
-	// If is not a global geomap, an empty $related_ids means that no entities are related to the post
35
-	// An empty array can be returned in this case
36
-	if ( ! $is_global && empty( $related_ids ) ) {
37
-		return array();
38
-	}
34
+    // If is not a global geomap, an empty $related_ids means that no entities are related to the post
35
+    // An empty array can be returned in this case
36
+    if ( ! $is_global && empty( $related_ids ) ) {
37
+        return array();
38
+    }
39 39
 
40
-	// Retrieve all 'published' places with geo coordinates defined
41
-	// If $related_ids is not empty, it's used to limit query results to the current post related places
42
-	// Please note that when $place_ids is an empty array, the 'post__in' parameter is not considered in the query
43
-	return get_posts( array(
44
-		'post__in'    => $related_ids,
45
-		'post_type'   => Wordlift_Entity_Service::TYPE_NAME,
46
-		'nopaging'    => true,
47
-		'post_status' => 'publish',
48
-		'meta_query'  => array(
49
-			'relation' => 'AND',
50
-			array(
51
-				'key'     => Wordlift_Schema_Service::FIELD_GEO_LATITUDE,
52
-				'value'   => null,
53
-				'compare' => '!=',
54
-			),
55
-			array(
56
-				'key'     => Wordlift_Schema_Service::FIELD_GEO_LONGITUDE,
57
-				'value'   => null,
58
-				'compare' => '!=',
59
-			)
60
-		),
61
-		'tax_query'      => array(
62
-			'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
63
-			'field'    => 'slug',
64
-			'terms'    => 'place'
65
-		)
66
-	) );
40
+    // Retrieve all 'published' places with geo coordinates defined
41
+    // If $related_ids is not empty, it's used to limit query results to the current post related places
42
+    // Please note that when $place_ids is an empty array, the 'post__in' parameter is not considered in the query
43
+    return get_posts( array(
44
+        'post__in'    => $related_ids,
45
+        'post_type'   => Wordlift_Entity_Service::TYPE_NAME,
46
+        'nopaging'    => true,
47
+        'post_status' => 'publish',
48
+        'meta_query'  => array(
49
+            'relation' => 'AND',
50
+            array(
51
+                'key'     => Wordlift_Schema_Service::FIELD_GEO_LATITUDE,
52
+                'value'   => null,
53
+                'compare' => '!=',
54
+            ),
55
+            array(
56
+                'key'     => Wordlift_Schema_Service::FIELD_GEO_LONGITUDE,
57
+                'value'   => null,
58
+                'compare' => '!=',
59
+            )
60
+        ),
61
+        'tax_query'      => array(
62
+            'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
63
+            'field'    => 'slug',
64
+            'terms'    => 'place'
65
+        )
66
+    ) );
67 67
 }
68 68
 
69 69
 /**
@@ -78,88 +78,88 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function wl_shortcode_geomap_prepare_map( $places ) {
80 80
 
81
-	// Prepare for min/max lat/long in case we need to define a view boundary for the client JavaScript.
82
-	$min_latitude  = PHP_INT_MAX;
83
-	$min_longitude = PHP_INT_MAX;
84
-	$max_latitude  = ~PHP_INT_MAX;
85
-	$max_longitude = ~PHP_INT_MAX;
81
+    // Prepare for min/max lat/long in case we need to define a view boundary for the client JavaScript.
82
+    $min_latitude  = PHP_INT_MAX;
83
+    $min_longitude = PHP_INT_MAX;
84
+    $max_latitude  = ~PHP_INT_MAX;
85
+    $max_longitude = ~PHP_INT_MAX;
86 86
 
87
-	// Prepare an empty array of POIs in geoJSON format.
88
-	$pois = array();
89
-	// And store list of points to allow Leaflet compute the optimal bounding box.
90
-	// The main reason for this is that geoJSON has swapped coordinates (lon. lat)
91
-	$boundaries = array();
87
+    // Prepare an empty array of POIs in geoJSON format.
88
+    $pois = array();
89
+    // And store list of points to allow Leaflet compute the optimal bounding box.
90
+    // The main reason for this is that geoJSON has swapped coordinates (lon. lat)
91
+    $boundaries = array();
92 92
 
93
-	// Add a POI for each entity that has coordinates.
94
-	foreach ( $places as $entity ) {
93
+    // Add a POI for each entity that has coordinates.
94
+    foreach ( $places as $entity ) {
95 95
 
96
-		// Get the coordinates.
97
-		$coordinates = wl_get_coordinates( $entity->ID );
96
+        // Get the coordinates.
97
+        $coordinates = wl_get_coordinates( $entity->ID );
98 98
 
99
-		// Don't show the widget if the coordinates aren't set.
100
-		if ( $coordinates['latitude'] == 0 || $coordinates['longitude'] == 0 ) {
101
-			continue;
102
-		}
99
+        // Don't show the widget if the coordinates aren't set.
100
+        if ( $coordinates['latitude'] == 0 || $coordinates['longitude'] == 0 ) {
101
+            continue;
102
+        }
103 103
 
104
-		// TODO Map html rendering should be delegated to the wordlift js ui layer
105
-		// This function should be focused on returning pure data instead
104
+        // TODO Map html rendering should be delegated to the wordlift js ui layer
105
+        // This function should be focused on returning pure data instead
106 106
 
107
-		// Get the title, URL and thumb of the entity.
108
-		$title = esc_attr( $entity->post_title );
109
-		$link  = esc_attr( get_permalink( $entity->ID ) );
110
-		if ( '' !== ( $thumbnail_id = get_post_thumbnail_id( $entity->ID ) ) &&
111
-		     false !== ( $attachment = wp_get_attachment_image_src( $thumbnail_id ) )
112
-		) {
113
-			$img_src = esc_attr( $attachment[0] );
114
-		}
107
+        // Get the title, URL and thumb of the entity.
108
+        $title = esc_attr( $entity->post_title );
109
+        $link  = esc_attr( get_permalink( $entity->ID ) );
110
+        if ( '' !== ( $thumbnail_id = get_post_thumbnail_id( $entity->ID ) ) &&
111
+             false !== ( $attachment = wp_get_attachment_image_src( $thumbnail_id ) )
112
+        ) {
113
+            $img_src = esc_attr( $attachment[0] );
114
+        }
115 115
 
116
-		// Build HTML popup. TODO: move thumb width in css
117
-		$content = "<a href=$link><h6>$title</h6>";
118
-		if ( isset( $img_src ) ) {
119
-			$content = $content . "<img src=$img_src style='width:100%'/>";
120
-		}
121
-		$content = $content . "</a><ul>";
122
-		// Get the related posts (published) and print them in the popup.
123
-		$related_posts = wl_core_get_related_post_ids( $entity->ID, array(
124
-			'status' => 'publish'
125
-		) );
126
-		foreach ( $related_posts as $rp_id ) {
116
+        // Build HTML popup. TODO: move thumb width in css
117
+        $content = "<a href=$link><h6>$title</h6>";
118
+        if ( isset( $img_src ) ) {
119
+            $content = $content . "<img src=$img_src style='width:100%'/>";
120
+        }
121
+        $content = $content . "</a><ul>";
122
+        // Get the related posts (published) and print them in the popup.
123
+        $related_posts = wl_core_get_related_post_ids( $entity->ID, array(
124
+            'status' => 'publish'
125
+        ) );
126
+        foreach ( $related_posts as $rp_id ) {
127 127
 
128
-			$rp      = get_post( $rp_id );
129
-			$title   = esc_attr( $rp->post_title );
130
-			$link    = esc_attr( get_permalink( $rp->ID ) );
131
-			$content = $content . "<li><a href=$link>$title</a></li>";
132
-		}
133
-		$content = $content . "</ul>";
128
+            $rp      = get_post( $rp_id );
129
+            $title   = esc_attr( $rp->post_title );
130
+            $link    = esc_attr( get_permalink( $rp->ID ) );
131
+            $content = $content . "<li><a href=$link>$title</a></li>";
132
+        }
133
+        $content = $content . "</ul>";
134 134
 
135
-		// Formatting POI in geoJSON.
136
-		// http://leafletjs.com/examples/geojson.html
137
-		$poi = array(
138
-			'type'       => 'Feature',
139
-			'properties' => array( 'popupContent' => $content ),
140
-			'geometry'   => array(
141
-				'type'        => 'Point',
142
-				'coordinates' => array(
143
-					// Leaflet geoJSON wants them swapped
144
-					$coordinates['longitude'],
145
-					$coordinates['latitude']
146
-				)
147
-			)
148
-		);
135
+        // Formatting POI in geoJSON.
136
+        // http://leafletjs.com/examples/geojson.html
137
+        $poi = array(
138
+            'type'       => 'Feature',
139
+            'properties' => array( 'popupContent' => $content ),
140
+            'geometry'   => array(
141
+                'type'        => 'Point',
142
+                'coordinates' => array(
143
+                    // Leaflet geoJSON wants them swapped
144
+                    $coordinates['longitude'],
145
+                    $coordinates['latitude']
146
+                )
147
+            )
148
+        );
149 149
 
150
-		$pois[] = $poi;
150
+        $pois[] = $poi;
151 151
 
152
-		// Formatting boundaries in a Leaflet-like format (see LatLngBounds).
153
-		// http://leafletjs.com/reference.html#latlngbounds
154
-		$boundaries[] = array( $coordinates['latitude'], $coordinates['longitude'] );
152
+        // Formatting boundaries in a Leaflet-like format (see LatLngBounds).
153
+        // http://leafletjs.com/reference.html#latlngbounds
154
+        $boundaries[] = array( $coordinates['latitude'], $coordinates['longitude'] );
155 155
 
156
-	}
156
+    }
157 157
 
158
-	$map_data               = array();
159
-	$map_data['features']   = $pois;
160
-	$map_data['boundaries'] = $boundaries;
158
+    $map_data               = array();
159
+    $map_data['features']   = $pois;
160
+    $map_data['boundaries'] = $boundaries;
161 161
 
162
-	return $map_data;
162
+    return $map_data;
163 163
 }
164 164
 
165 165
 /**
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
  * @return array An array of place posts.
174 174
  */
175 175
 function wl_shortcode_geomap_ajax() {
176
-	// Get the post Id.
177
-	$post_id = ( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : null );
176
+    // Get the post Id.
177
+    $post_id = ( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : null );
178 178
 
179
-	$places   = wl_shortcode_geomap_get_places( $post_id );
180
-	$map_data = wl_shortcode_geomap_prepare_map( $places );
179
+    $places   = wl_shortcode_geomap_get_places( $post_id );
180
+    $map_data = wl_shortcode_geomap_prepare_map( $places );
181 181
 
182
-	wl_core_send_json( $map_data );
182
+    wl_core_send_json( $map_data );
183 183
 }
184 184
 
185 185
 add_action( 'wp_ajax_wl_geomap', 'wl_shortcode_geomap_ajax' );
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,35 +12,35 @@  discard block
 block discarded – undo
12 12
  *
13 13
  * @return array An array of place posts.
14 14
  */
15
-function wl_shortcode_geomap_get_places( $post_id = null ) {
15
+function wl_shortcode_geomap_get_places($post_id = null) {
16 16
 
17 17
 	// If $post_id is null or is not numeric it means this is a global geomap
18
-	$is_global = is_null( $post_id ) || ! is_numeric( $post_id );
18
+	$is_global = is_null($post_id) || ! is_numeric($post_id);
19 19
 
20 20
 	// If the current one is not a global geomap, retrieve related entities ids
21
-	if ( $is_global ) {
21
+	if ($is_global) {
22 22
 		$related_ids = array();
23 23
 	} else {
24
-		$related_ids = wl_core_get_related_entity_ids( $post_id, array(
24
+		$related_ids = wl_core_get_related_entity_ids($post_id, array(
25 25
 			'status' => 'publish'
26
-		) );
26
+		));
27 27
 		
28 28
 		// Also include current entity
29
-		if ( Wordlift_Entity_Service::get_instance()->is_entity( $post_id ) ) {
29
+		if (Wordlift_Entity_Service::get_instance()->is_entity($post_id)) {
30 30
 			$related_ids[] = $post_id;
31 31
 		}
32 32
 	}
33 33
 
34 34
 	// If is not a global geomap, an empty $related_ids means that no entities are related to the post
35 35
 	// An empty array can be returned in this case
36
-	if ( ! $is_global && empty( $related_ids ) ) {
36
+	if ( ! $is_global && empty($related_ids)) {
37 37
 		return array();
38 38
 	}
39 39
 
40 40
 	// Retrieve all 'published' places with geo coordinates defined
41 41
 	// If $related_ids is not empty, it's used to limit query results to the current post related places
42 42
 	// Please note that when $place_ids is an empty array, the 'post__in' parameter is not considered in the query
43
-	return get_posts( array(
43
+	return get_posts(array(
44 44
 		'post__in'    => $related_ids,
45 45
 		'post_type'   => Wordlift_Entity_Service::TYPE_NAME,
46 46
 		'nopaging'    => true,
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'field'    => 'slug',
64 64
 			'terms'    => 'place'
65 65
 		)
66
-	) );
66
+	));
67 67
 }
68 68
 
69 69
 /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * @return array An array of markers and boundaries for Leaflet.
78 78
  */
79
-function wl_shortcode_geomap_prepare_map( $places ) {
79
+function wl_shortcode_geomap_prepare_map($places) {
80 80
 
81 81
 	// Prepare for min/max lat/long in case we need to define a view boundary for the client JavaScript.
82 82
 	$min_latitude  = PHP_INT_MAX;
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	$boundaries = array();
92 92
 
93 93
 	// Add a POI for each entity that has coordinates.
94
-	foreach ( $places as $entity ) {
94
+	foreach ($places as $entity) {
95 95
 
96 96
 		// Get the coordinates.
97
-		$coordinates = wl_get_coordinates( $entity->ID );
97
+		$coordinates = wl_get_coordinates($entity->ID);
98 98
 
99 99
 		// Don't show the widget if the coordinates aren't set.
100
-		if ( $coordinates['latitude'] == 0 || $coordinates['longitude'] == 0 ) {
100
+		if ($coordinates['latitude'] == 0 || $coordinates['longitude'] == 0) {
101 101
 			continue;
102 102
 		}
103 103
 
@@ -105,38 +105,38 @@  discard block
 block discarded – undo
105 105
 		// This function should be focused on returning pure data instead
106 106
 
107 107
 		// Get the title, URL and thumb of the entity.
108
-		$title = esc_attr( $entity->post_title );
109
-		$link  = esc_attr( get_permalink( $entity->ID ) );
110
-		if ( '' !== ( $thumbnail_id = get_post_thumbnail_id( $entity->ID ) ) &&
111
-		     false !== ( $attachment = wp_get_attachment_image_src( $thumbnail_id ) )
108
+		$title = esc_attr($entity->post_title);
109
+		$link  = esc_attr(get_permalink($entity->ID));
110
+		if ('' !== ($thumbnail_id = get_post_thumbnail_id($entity->ID)) &&
111
+		     false !== ($attachment = wp_get_attachment_image_src($thumbnail_id))
112 112
 		) {
113
-			$img_src = esc_attr( $attachment[0] );
113
+			$img_src = esc_attr($attachment[0]);
114 114
 		}
115 115
 
116 116
 		// Build HTML popup. TODO: move thumb width in css
117 117
 		$content = "<a href=$link><h6>$title</h6>";
118
-		if ( isset( $img_src ) ) {
119
-			$content = $content . "<img src=$img_src style='width:100%'/>";
118
+		if (isset($img_src)) {
119
+			$content = $content."<img src=$img_src style='width:100%'/>";
120 120
 		}
121
-		$content = $content . "</a><ul>";
121
+		$content = $content."</a><ul>";
122 122
 		// Get the related posts (published) and print them in the popup.
123
-		$related_posts = wl_core_get_related_post_ids( $entity->ID, array(
123
+		$related_posts = wl_core_get_related_post_ids($entity->ID, array(
124 124
 			'status' => 'publish'
125
-		) );
126
-		foreach ( $related_posts as $rp_id ) {
125
+		));
126
+		foreach ($related_posts as $rp_id) {
127 127
 
128
-			$rp      = get_post( $rp_id );
129
-			$title   = esc_attr( $rp->post_title );
130
-			$link    = esc_attr( get_permalink( $rp->ID ) );
131
-			$content = $content . "<li><a href=$link>$title</a></li>";
128
+			$rp      = get_post($rp_id);
129
+			$title   = esc_attr($rp->post_title);
130
+			$link    = esc_attr(get_permalink($rp->ID));
131
+			$content = $content."<li><a href=$link>$title</a></li>";
132 132
 		}
133
-		$content = $content . "</ul>";
133
+		$content = $content."</ul>";
134 134
 
135 135
 		// Formatting POI in geoJSON.
136 136
 		// http://leafletjs.com/examples/geojson.html
137 137
 		$poi = array(
138 138
 			'type'       => 'Feature',
139
-			'properties' => array( 'popupContent' => $content ),
139
+			'properties' => array('popupContent' => $content),
140 140
 			'geometry'   => array(
141 141
 				'type'        => 'Point',
142 142
 				'coordinates' => array(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 		// Formatting boundaries in a Leaflet-like format (see LatLngBounds).
153 153
 		// http://leafletjs.com/reference.html#latlngbounds
154
-		$boundaries[] = array( $coordinates['latitude'], $coordinates['longitude'] );
154
+		$boundaries[] = array($coordinates['latitude'], $coordinates['longitude']);
155 155
 
156 156
 	}
157 157
 
@@ -174,16 +174,16 @@  discard block
 block discarded – undo
174 174
  */
175 175
 function wl_shortcode_geomap_ajax() {
176 176
 	// Get the post Id.
177
-	$post_id = ( isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : null );
177
+	$post_id = (isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : null);
178 178
 
179
-	$places   = wl_shortcode_geomap_get_places( $post_id );
180
-	$map_data = wl_shortcode_geomap_prepare_map( $places );
179
+	$places   = wl_shortcode_geomap_get_places($post_id);
180
+	$map_data = wl_shortcode_geomap_prepare_map($places);
181 181
 
182
-	wl_core_send_json( $map_data );
182
+	wl_core_send_json($map_data);
183 183
 }
184 184
 
185
-add_action( 'wp_ajax_wl_geomap', 'wl_shortcode_geomap_ajax' );
186
-add_action( 'wp_ajax_nopriv_wl_geomap', 'wl_shortcode_geomap_ajax' );
185
+add_action('wp_ajax_wl_geomap', 'wl_shortcode_geomap_ajax');
186
+add_action('wp_ajax_nopriv_wl_geomap', 'wl_shortcode_geomap_ajax');
187 187
 
188 188
 ///**
189 189
 // * Print geomap shortcode
Please login to merge, or discard this patch.
src/public/class-wordlift-chord-shortcode.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -7,64 +7,64 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Chord_Shortcode extends Wordlift_Shortcode {
9 9
 
10
-	/**
11
-	 * {@inheritdoc}
12
-	 */
13
-	const SHORTCODE = 'wl_chord';
10
+    /**
11
+     * {@inheritdoc}
12
+     */
13
+    const SHORTCODE = 'wl_chord';
14 14
 
15
-	/**
16
-	 * {@inheritdoc}
17
-	 */
18
-	public function render( $atts ) {
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    public function render( $atts ) {
19 19
 
20
-		//extract attributes and set default values
21
-		$chord_atts = shortcode_atts( array(
22
-			'width'      => '100%',
23
-			'height'     => '500px',
24
-			'main_color' => '000',
25
-			'depth'      => 2,
26
-			'global'     => FALSE
27
-		), $atts );
20
+        //extract attributes and set default values
21
+        $chord_atts = shortcode_atts( array(
22
+            'width'      => '100%',
23
+            'height'     => '500px',
24
+            'main_color' => '000',
25
+            'depth'      => 2,
26
+            'global'     => FALSE
27
+        ), $atts );
28 28
 
29
-		if ( $chord_atts['global'] ) {
30
-			$post_id = wl_shortcode_chord_most_referenced_entity_id();
31
-			if ( $post_id == NULL ) {
32
-				return "WordLift Chord: no entities found.";
33
-			}
34
-			$widget_id            = 'wl_chord_global';
35
-			$chord_atts['height'] = '200px';
36
-		} else {
37
-			$post_id   = get_the_ID();
38
-			$widget_id = 'wl_chord_' . $post_id;
39
-		}
29
+        if ( $chord_atts['global'] ) {
30
+            $post_id = wl_shortcode_chord_most_referenced_entity_id();
31
+            if ( $post_id == NULL ) {
32
+                return "WordLift Chord: no entities found.";
33
+            }
34
+            $widget_id            = 'wl_chord_global';
35
+            $chord_atts['height'] = '200px';
36
+        } else {
37
+            $post_id   = get_the_ID();
38
+            $widget_id = 'wl_chord_' . $post_id;
39
+        }
40 40
 
41
-		// Adding css
42
-		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
41
+        // Adding css
42
+        wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
43 43
 
44
-		// Adding javascript code
45
-		wp_enqueue_script( 'd3', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/d3/d3.min.js' );
44
+        // Adding javascript code
45
+        wp_enqueue_script( 'd3', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/d3/d3.min.js' );
46 46
 
47
-		$this->enqueue_scripts();
47
+        $this->enqueue_scripts();
48 48
 
49
-		wp_localize_script( 'wordlift-ui', 'wl_chord_params', array(
50
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
51
-				'action'   => 'wl_chord'
52
-			)
53
-		);
49
+        wp_localize_script( 'wordlift-ui', 'wl_chord_params', array(
50
+                'ajax_url' => admin_url( 'admin-ajax.php' ),
51
+                'action'   => 'wl_chord'
52
+            )
53
+        );
54 54
 
55
-		// Escaping atts.
56
-		$esc_class  = esc_attr( 'wl-chord' );
57
-		$esc_id     = esc_attr( $widget_id );
58
-		$esc_width  = esc_attr( $chord_atts['width'] );
59
-		$esc_height = esc_attr( $chord_atts['height'] );
55
+        // Escaping atts.
56
+        $esc_class  = esc_attr( 'wl-chord' );
57
+        $esc_id     = esc_attr( $widget_id );
58
+        $esc_width  = esc_attr( $chord_atts['width'] );
59
+        $esc_height = esc_attr( $chord_atts['height'] );
60 60
 
61
-		$esc_post_id    = esc_attr( $post_id );
62
-		$esc_depth      = esc_attr( $chord_atts['depth'] );
63
-		$esc_main_color = esc_attr( $chord_atts['main_color'] );
61
+        $esc_post_id    = esc_attr( $post_id );
62
+        $esc_depth      = esc_attr( $chord_atts['depth'] );
63
+        $esc_main_color = esc_attr( $chord_atts['main_color'] );
64 64
 
65
-		// Building template.
66
-		// TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
67
-		return <<<EOF
65
+        // Building template.
66
+        // TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
67
+        return <<<EOF
68 68
 <div class="$esc_class" 
69 69
 	id="$esc_id"
70 70
 	data-post-id="$esc_post_id"
@@ -77,6 +77,6 @@  discard block
 block discarded – undo
77 77
         margin-bottom:10px">
78 78
 </div>
79 79
 EOF;
80
-	}
80
+    }
81 81
 
82 82
 }
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,52 +15,52 @@
 block discarded – undo
15 15
 	/**
16 16
 	 * {@inheritdoc}
17 17
 	 */
18
-	public function render( $atts ) {
18
+	public function render($atts) {
19 19
 
20 20
 		//extract attributes and set default values
21
-		$chord_atts = shortcode_atts( array(
21
+		$chord_atts = shortcode_atts(array(
22 22
 			'width'      => '100%',
23 23
 			'height'     => '500px',
24 24
 			'main_color' => '000',
25 25
 			'depth'      => 2,
26 26
 			'global'     => FALSE
27
-		), $atts );
27
+		), $atts);
28 28
 
29
-		if ( $chord_atts['global'] ) {
29
+		if ($chord_atts['global']) {
30 30
 			$post_id = wl_shortcode_chord_most_referenced_entity_id();
31
-			if ( $post_id == NULL ) {
31
+			if ($post_id == NULL) {
32 32
 				return "WordLift Chord: no entities found.";
33 33
 			}
34 34
 			$widget_id            = 'wl_chord_global';
35 35
 			$chord_atts['height'] = '200px';
36 36
 		} else {
37 37
 			$post_id   = get_the_ID();
38
-			$widget_id = 'wl_chord_' . $post_id;
38
+			$widget_id = 'wl_chord_'.$post_id;
39 39
 		}
40 40
 
41 41
 		// Adding css
42
-		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
42
+		wp_enqueue_style('wordlift-ui', dirname(plugin_dir_url(__FILE__)).'/css/wordlift-ui.min.css');
43 43
 
44 44
 		// Adding javascript code
45
-		wp_enqueue_script( 'd3', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/d3/d3.min.js' );
45
+		wp_enqueue_script('d3', dirname(plugin_dir_url(__FILE__)).'/bower_components/d3/d3.min.js');
46 46
 
47 47
 		$this->enqueue_scripts();
48 48
 
49
-		wp_localize_script( 'wordlift-ui', 'wl_chord_params', array(
50
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
49
+		wp_localize_script('wordlift-ui', 'wl_chord_params', array(
50
+				'ajax_url' => admin_url('admin-ajax.php'),
51 51
 				'action'   => 'wl_chord'
52 52
 			)
53 53
 		);
54 54
 
55 55
 		// Escaping atts.
56
-		$esc_class  = esc_attr( 'wl-chord' );
57
-		$esc_id     = esc_attr( $widget_id );
58
-		$esc_width  = esc_attr( $chord_atts['width'] );
59
-		$esc_height = esc_attr( $chord_atts['height'] );
56
+		$esc_class  = esc_attr('wl-chord');
57
+		$esc_id     = esc_attr($widget_id);
58
+		$esc_width  = esc_attr($chord_atts['width']);
59
+		$esc_height = esc_attr($chord_atts['height']);
60 60
 
61
-		$esc_post_id    = esc_attr( $post_id );
62
-		$esc_depth      = esc_attr( $chord_atts['depth'] );
63
-		$esc_main_color = esc_attr( $chord_atts['main_color'] );
61
+		$esc_post_id    = esc_attr($post_id);
62
+		$esc_depth      = esc_attr($chord_atts['depth']);
63
+		$esc_main_color = esc_attr($chord_atts['main_color']);
64 64
 
65 65
 		// Building template.
66 66
 		// TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
Please login to merge, or discard this patch.
src/public/class-wordlift-timeline-shortcode.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,79 +7,79 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Timeline_Shortcode extends Wordlift_Shortcode {
9 9
 
10
-	const SHORTCODE = 'wl_timeline';
11
-
12
-	/**
13
-	 * The Log service.
14
-	 *
15
-	 * @since 3.1.0
16
-	 * @access private
17
-	 * @var \Wordlift_Log_Service $log_service The Log service.
18
-	 */
19
-	private $log_service;
20
-
21
-	/**
22
-	 * Create a Wordlift_Timeline_Shortcode instance.
23
-	 *
24
-	 * @since 3.1.0
25
-	 */
26
-	public function __construct() {
27
-		parent::__construct();
28
-
29
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Timeline_Shortcode' );
30
-
31
-	}
32
-
33
-	/**
34
-	 * Renders the Timeline.
35
-	 *
36
-	 * @since 3.1.0
37
-	 * @return string The rendered HTML.
38
-	 */
39
-	public function render( $atts ) {
40
-
41
-		//extract attributes and set default values
42
-		$timeline_atts = shortcode_atts( array(
43
-			'width'  => '100%',
44
-			'height' => '600px',
45
-			'global' => false
46
-		), $atts );
47
-
48
-		// Add timeline library.
49
-		wp_enqueue_script( 'timelinejs-storyjs-embed', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/TimelineJS.build/build/js/storyjs-embed.js' );
50
-		wp_enqueue_script( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/TimelineJS.build/build/js/timeline-min.js' );
51
-
52
-		// Enqueue the scripts for the timeline.
53
-		$this->enqueue_scripts();
54
-
55
-		wp_localize_script( 'wordlift-ui', 'wl_timeline_params', array(
56
-			'ajax_url' => admin_url( 'admin-ajax.php' ), // TODO: this parameter is already provided by WP
57
-			'action'   => 'wl_timeline'
58
-		) );
59
-
60
-		// Get the current post id or set null if global is set to true.
61
-		$post_id = ( $timeline_atts['global'] ? null : get_the_ID() );
62
-
63
-		// Generate a unique ID for this timeline.
64
-		$element_id = uniqid( 'wl-timeline-' );
65
-
66
-		// Escaping atts.
67
-		$esc_width    = esc_attr( $timeline_atts['width'] );
68
-		$esc_height   = esc_attr( $timeline_atts['height'] );
69
-		$data_post_id = ( isset( $post_id ) ? "data-post-id='$post_id'" : '' );
70
-
71
-		if ( WP_DEBUG ) {
72
-			$this->log_service->trace( "Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]" );
73
-		}
74
-
75
-		// Building template.
76
-		// TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
77
-		return <<<EOF
10
+    const SHORTCODE = 'wl_timeline';
11
+
12
+    /**
13
+     * The Log service.
14
+     *
15
+     * @since 3.1.0
16
+     * @access private
17
+     * @var \Wordlift_Log_Service $log_service The Log service.
18
+     */
19
+    private $log_service;
20
+
21
+    /**
22
+     * Create a Wordlift_Timeline_Shortcode instance.
23
+     *
24
+     * @since 3.1.0
25
+     */
26
+    public function __construct() {
27
+        parent::__construct();
28
+
29
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Timeline_Shortcode' );
30
+
31
+    }
32
+
33
+    /**
34
+     * Renders the Timeline.
35
+     *
36
+     * @since 3.1.0
37
+     * @return string The rendered HTML.
38
+     */
39
+    public function render( $atts ) {
40
+
41
+        //extract attributes and set default values
42
+        $timeline_atts = shortcode_atts( array(
43
+            'width'  => '100%',
44
+            'height' => '600px',
45
+            'global' => false
46
+        ), $atts );
47
+
48
+        // Add timeline library.
49
+        wp_enqueue_script( 'timelinejs-storyjs-embed', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/TimelineJS.build/build/js/storyjs-embed.js' );
50
+        wp_enqueue_script( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/TimelineJS.build/build/js/timeline-min.js' );
51
+
52
+        // Enqueue the scripts for the timeline.
53
+        $this->enqueue_scripts();
54
+
55
+        wp_localize_script( 'wordlift-ui', 'wl_timeline_params', array(
56
+            'ajax_url' => admin_url( 'admin-ajax.php' ), // TODO: this parameter is already provided by WP
57
+            'action'   => 'wl_timeline'
58
+        ) );
59
+
60
+        // Get the current post id or set null if global is set to true.
61
+        $post_id = ( $timeline_atts['global'] ? null : get_the_ID() );
62
+
63
+        // Generate a unique ID for this timeline.
64
+        $element_id = uniqid( 'wl-timeline-' );
65
+
66
+        // Escaping atts.
67
+        $esc_width    = esc_attr( $timeline_atts['width'] );
68
+        $esc_height   = esc_attr( $timeline_atts['height'] );
69
+        $data_post_id = ( isset( $post_id ) ? "data-post-id='$post_id'" : '' );
70
+
71
+        if ( WP_DEBUG ) {
72
+            $this->log_service->trace( "Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]" );
73
+        }
74
+
75
+        // Building template.
76
+        // TODO: in the HTML code there are static CSS rules. Move them to the CSS file.
77
+        return <<<EOF
78 78
 <div class="wl-timeline" id="$element_id" $data_post_id
79 79
 	style="width:$esc_width; height:$esc_height; margin-top:10px; margin-bottom:10px">
80 80
 </div>
81 81
 EOF;
82 82
 
83
-	}
83
+    }
84 84
 
85 85
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		parent::__construct();
28 28
 
29
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Timeline_Shortcode' );
29
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Timeline_Shortcode');
30 30
 
31 31
 	}
32 32
 
@@ -36,40 +36,40 @@  discard block
 block discarded – undo
36 36
 	 * @since 3.1.0
37 37
 	 * @return string The rendered HTML.
38 38
 	 */
39
-	public function render( $atts ) {
39
+	public function render($atts) {
40 40
 
41 41
 		//extract attributes and set default values
42
-		$timeline_atts = shortcode_atts( array(
42
+		$timeline_atts = shortcode_atts(array(
43 43
 			'width'  => '100%',
44 44
 			'height' => '600px',
45 45
 			'global' => false
46
-		), $atts );
46
+		), $atts);
47 47
 
48 48
 		// Add timeline library.
49
-		wp_enqueue_script( 'timelinejs-storyjs-embed', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/TimelineJS.build/build/js/storyjs-embed.js' );
50
-		wp_enqueue_script( 'timelinejs', dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/TimelineJS.build/build/js/timeline-min.js' );
49
+		wp_enqueue_script('timelinejs-storyjs-embed', dirname(plugin_dir_url(__FILE__)).'/bower_components/TimelineJS.build/build/js/storyjs-embed.js');
50
+		wp_enqueue_script('timelinejs', dirname(plugin_dir_url(__FILE__)).'/bower_components/TimelineJS.build/build/js/timeline-min.js');
51 51
 
52 52
 		// Enqueue the scripts for the timeline.
53 53
 		$this->enqueue_scripts();
54 54
 
55
-		wp_localize_script( 'wordlift-ui', 'wl_timeline_params', array(
56
-			'ajax_url' => admin_url( 'admin-ajax.php' ), // TODO: this parameter is already provided by WP
55
+		wp_localize_script('wordlift-ui', 'wl_timeline_params', array(
56
+			'ajax_url' => admin_url('admin-ajax.php'), // TODO: this parameter is already provided by WP
57 57
 			'action'   => 'wl_timeline'
58
-		) );
58
+		));
59 59
 
60 60
 		// Get the current post id or set null if global is set to true.
61
-		$post_id = ( $timeline_atts['global'] ? null : get_the_ID() );
61
+		$post_id = ($timeline_atts['global'] ? null : get_the_ID());
62 62
 
63 63
 		// Generate a unique ID for this timeline.
64
-		$element_id = uniqid( 'wl-timeline-' );
64
+		$element_id = uniqid('wl-timeline-');
65 65
 
66 66
 		// Escaping atts.
67
-		$esc_width    = esc_attr( $timeline_atts['width'] );
68
-		$esc_height   = esc_attr( $timeline_atts['height'] );
69
-		$data_post_id = ( isset( $post_id ) ? "data-post-id='$post_id'" : '' );
67
+		$esc_width    = esc_attr($timeline_atts['width']);
68
+		$esc_height   = esc_attr($timeline_atts['height']);
69
+		$data_post_id = (isset($post_id) ? "data-post-id='$post_id'" : '');
70 70
 
71
-		if ( WP_DEBUG ) {
72
-			$this->log_service->trace( "Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]" );
71
+		if (WP_DEBUG) {
72
+			$this->log_service->trace("Creating a timeline widget [ element id :: $element_id ][ post id :: $post_id ]");
73 73
 		}
74 74
 
75 75
 		// Building template.
Please login to merge, or discard this patch.
src/public/class-wordlift-shortcode.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -8,50 +8,50 @@
 block discarded – undo
8 8
  */
9 9
 abstract class Wordlift_Shortcode {
10 10
 
11
-	/**
12
-	 * The shortcode, set by extending classes.
13
-	 */
14
-	const SHORTCODE = NULL;
15
-
16
-	/**
17
-	 * Create a shortcode instance by registering the shortcode with the render
18
-	 * function.
19
-	 *
20
-	 * @since 3.5.4
21
-	 */
22
-	public function __construct() {
23
-
24
-		add_shortcode( static::SHORTCODE, array( $this, 'render' ) );
25
-
26
-	}
27
-
28
-	/**
29
-	 * Render the shortcode.
30
-	 *
31
-	 * @since 3.5.4
32
-	 *
33
-	 * @param array $atts An array of shortcode attributes as set by the editor.
34
-	 *
35
-	 * @return string The output html code.
36
-	 */
37
-	public abstract function render( $atts );
38
-
39
-	/**
40
-	 * Enqueue scripts. Called by the shortcode implementations in their render
41
-	 * method.
42
-	 *
43
-	 * @since 3.5.4
44
-	 */
45
-	protected function enqueue_scripts() {
46
-
47
-		wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
48
-		wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js', array( 'angularjs' ) );
49
-		wp_enqueue_script( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-ui.min.js', array(
50
-			'jquery',
51
-			'angularjs',
52
-			'angularjs-touch'
53
-		) );
54
-
55
-	}
11
+    /**
12
+     * The shortcode, set by extending classes.
13
+     */
14
+    const SHORTCODE = NULL;
15
+
16
+    /**
17
+     * Create a shortcode instance by registering the shortcode with the render
18
+     * function.
19
+     *
20
+     * @since 3.5.4
21
+     */
22
+    public function __construct() {
23
+
24
+        add_shortcode( static::SHORTCODE, array( $this, 'render' ) );
25
+
26
+    }
27
+
28
+    /**
29
+     * Render the shortcode.
30
+     *
31
+     * @since 3.5.4
32
+     *
33
+     * @param array $atts An array of shortcode attributes as set by the editor.
34
+     *
35
+     * @return string The output html code.
36
+     */
37
+    public abstract function render( $atts );
38
+
39
+    /**
40
+     * Enqueue scripts. Called by the shortcode implementations in their render
41
+     * method.
42
+     *
43
+     * @since 3.5.4
44
+     */
45
+    protected function enqueue_scripts() {
46
+
47
+        wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
48
+        wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js', array( 'angularjs' ) );
49
+        wp_enqueue_script( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-ui.min.js', array(
50
+            'jquery',
51
+            'angularjs',
52
+            'angularjs-touch'
53
+        ) );
54
+
55
+    }
56 56
 
57 57
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		add_shortcode( static::SHORTCODE, array( $this, 'render' ) );
24
+		add_shortcode(static::SHORTCODE, array($this, 'render'));
25 25
 
26 26
 	}
27 27
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @return string The output html code.
36 36
 	 */
37
-	public abstract function render( $atts );
37
+	public abstract function render($atts);
38 38
 
39 39
 	/**
40 40
 	 * Enqueue scripts. Called by the shortcode implementations in their render
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected function enqueue_scripts() {
46 46
 
47
-		wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
48
-		wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js', array( 'angularjs' ) );
49
-		wp_enqueue_script( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-ui.min.js', array(
47
+		wp_enqueue_script('angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js');
48
+		wp_enqueue_script('angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js', array('angularjs'));
49
+		wp_enqueue_script('wordlift-ui', dirname(plugin_dir_url(__FILE__)).'/js/wordlift-ui.min.js', array(
50 50
 			'jquery',
51 51
 			'angularjs',
52 52
 			'angularjs-touch'
53
-		) );
53
+		));
54 54
 
55 55
 	}
56 56
 
Please login to merge, or discard this patch.
src/public/class-wordlift-geomap-shortcode.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -7,67 +7,67 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Geomap_Shortcode extends Wordlift_Shortcode {
9 9
 
10
-	const SHORTCODE = 'wl_geomap';
10
+    const SHORTCODE = 'wl_geomap';
11 11
 
12
-	/**
13
-	 * Render the shortcode.
14
-	 *
15
-	 * @since 3.5.4
16
-	 *
17
-	 * @param array $atts An array of shortcode attributes as set by the editor.
18
-	 *
19
-	 * @return string The output html code.
20
-	 */
21
-	public function render( $atts ) {
12
+    /**
13
+     * Render the shortcode.
14
+     *
15
+     * @since 3.5.4
16
+     *
17
+     * @param array $atts An array of shortcode attributes as set by the editor.
18
+     *
19
+     * @return string The output html code.
20
+     */
21
+    public function render( $atts ) {
22 22
 
23
-		// Extract attributes and set default values.
24
-		$geomap_atts = shortcode_atts( array(
25
-			'width'  => '100%',
26
-			'height' => '300px',
27
-			'global' => FALSE
28
-		), $atts );
23
+        // Extract attributes and set default values.
24
+        $geomap_atts = shortcode_atts( array(
25
+            'width'  => '100%',
26
+            'height' => '300px',
27
+            'global' => FALSE
28
+        ), $atts );
29 29
 
30
-		// Get id of the post
31
-		$post_id = get_the_ID();
30
+        // Get id of the post
31
+        $post_id = get_the_ID();
32 32
 
33
-		if ( $geomap_atts['global'] || is_null( $post_id ) ) {
34
-			// Global geomap
35
-			$geomap_id = 'wl_geomap_global';
36
-			$post_id   = NULL;
37
-		} else {
38
-			// Post-specific geomap
39
-			$geomap_id = 'wl_geomap_' . $post_id;
40
-		}
33
+        if ( $geomap_atts['global'] || is_null( $post_id ) ) {
34
+            // Global geomap
35
+            $geomap_id = 'wl_geomap_global';
36
+            $post_id   = NULL;
37
+        } else {
38
+            // Post-specific geomap
39
+            $geomap_id = 'wl_geomap_' . $post_id;
40
+        }
41 41
 
42
-		// Add leaflet css and library.
43
-		wp_enqueue_style(
44
-			'leaflet',
45
-			dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/leaflet/dist/leaflet.css'
46
-		);
47
-		wp_enqueue_script(
48
-			'leaflet',
49
-			dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/leaflet/dist/leaflet.js'
50
-		);
42
+        // Add leaflet css and library.
43
+        wp_enqueue_style(
44
+            'leaflet',
45
+            dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/leaflet/dist/leaflet.css'
46
+        );
47
+        wp_enqueue_script(
48
+            'leaflet',
49
+            dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/leaflet/dist/leaflet.js'
50
+        );
51 51
 
52
-		// Add wordlift-ui css and library.
53
-		wp_enqueue_style( 'wordlift-ui-css', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
52
+        // Add wordlift-ui css and library.
53
+        wp_enqueue_style( 'wordlift-ui-css', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
54 54
 
55
-		$this->enqueue_scripts();
55
+        $this->enqueue_scripts();
56 56
 
57
-		wp_localize_script( 'wordlift-ui', 'wl_geomap_params', array(
58
-			'ajax_url' => admin_url( 'admin-ajax.php' ),    // Global param
59
-			'action'   => 'wl_geomap'            // Global param
60
-		) );
57
+        wp_localize_script( 'wordlift-ui', 'wl_geomap_params', array(
58
+            'ajax_url' => admin_url( 'admin-ajax.php' ),    // Global param
59
+            'action'   => 'wl_geomap'            // Global param
60
+        ) );
61 61
 
62
-		// Escaping atts.
63
-		$esc_class   = esc_attr( 'wl-geomap' );
64
-		$esc_id      = esc_attr( $geomap_id );
65
-		$esc_width   = esc_attr( $geomap_atts['width'] );
66
-		$esc_height  = esc_attr( $geomap_atts['height'] );
67
-		$esc_post_id = esc_attr( $post_id );
62
+        // Escaping atts.
63
+        $esc_class   = esc_attr( 'wl-geomap' );
64
+        $esc_id      = esc_attr( $geomap_id );
65
+        $esc_width   = esc_attr( $geomap_atts['width'] );
66
+        $esc_height  = esc_attr( $geomap_atts['height'] );
67
+        $esc_post_id = esc_attr( $post_id );
68 68
 
69
-		// Return HTML template.
70
-		return <<<EOF
69
+        // Return HTML template.
70
+        return <<<EOF
71 71
 <div class="$esc_class" 
72 72
 	id="$esc_id"
73 73
 	data-post-id="$esc_post_id"
@@ -77,6 +77,6 @@  discard block
 block discarded – undo
77 77
         ">
78 78
 </div>
79 79
 EOF;
80
-	}
80
+    }
81 81
 
82 82
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,53 +18,53 @@
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The output html code.
20 20
 	 */
21
-	public function render( $atts ) {
21
+	public function render($atts) {
22 22
 
23 23
 		// Extract attributes and set default values.
24
-		$geomap_atts = shortcode_atts( array(
24
+		$geomap_atts = shortcode_atts(array(
25 25
 			'width'  => '100%',
26 26
 			'height' => '300px',
27 27
 			'global' => FALSE
28
-		), $atts );
28
+		), $atts);
29 29
 
30 30
 		// Get id of the post
31 31
 		$post_id = get_the_ID();
32 32
 
33
-		if ( $geomap_atts['global'] || is_null( $post_id ) ) {
33
+		if ($geomap_atts['global'] || is_null($post_id)) {
34 34
 			// Global geomap
35 35
 			$geomap_id = 'wl_geomap_global';
36 36
 			$post_id   = NULL;
37 37
 		} else {
38 38
 			// Post-specific geomap
39
-			$geomap_id = 'wl_geomap_' . $post_id;
39
+			$geomap_id = 'wl_geomap_'.$post_id;
40 40
 		}
41 41
 
42 42
 		// Add leaflet css and library.
43 43
 		wp_enqueue_style(
44 44
 			'leaflet',
45
-			dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/leaflet/dist/leaflet.css'
45
+			dirname(plugin_dir_url(__FILE__)).'/bower_components/leaflet/dist/leaflet.css'
46 46
 		);
47 47
 		wp_enqueue_script(
48 48
 			'leaflet',
49
-			dirname( plugin_dir_url( __FILE__ ) ) . '/bower_components/leaflet/dist/leaflet.js'
49
+			dirname(plugin_dir_url(__FILE__)).'/bower_components/leaflet/dist/leaflet.js'
50 50
 		);
51 51
 
52 52
 		// Add wordlift-ui css and library.
53
-		wp_enqueue_style( 'wordlift-ui-css', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
53
+		wp_enqueue_style('wordlift-ui-css', dirname(plugin_dir_url(__FILE__)).'/css/wordlift-ui.min.css');
54 54
 
55 55
 		$this->enqueue_scripts();
56 56
 
57
-		wp_localize_script( 'wordlift-ui', 'wl_geomap_params', array(
58
-			'ajax_url' => admin_url( 'admin-ajax.php' ),    // Global param
57
+		wp_localize_script('wordlift-ui', 'wl_geomap_params', array(
58
+			'ajax_url' => admin_url('admin-ajax.php'), // Global param
59 59
 			'action'   => 'wl_geomap'            // Global param
60
-		) );
60
+		));
61 61
 
62 62
 		// Escaping atts.
63
-		$esc_class   = esc_attr( 'wl-geomap' );
64
-		$esc_id      = esc_attr( $geomap_id );
65
-		$esc_width   = esc_attr( $geomap_atts['width'] );
66
-		$esc_height  = esc_attr( $geomap_atts['height'] );
67
-		$esc_post_id = esc_attr( $post_id );
63
+		$esc_class   = esc_attr('wl-geomap');
64
+		$esc_id      = esc_attr($geomap_id);
65
+		$esc_width   = esc_attr($geomap_atts['width']);
66
+		$esc_height  = esc_attr($geomap_atts['height']);
67
+		$esc_post_id = esc_attr($post_id);
68 68
 
69 69
 		// Return HTML template.
70 70
 		return <<<EOF
Please login to merge, or discard this patch.
src/public/class-wordlift-navigator-shortcode.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -7,59 +7,59 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Navigator_Shortcode extends Wordlift_Shortcode {
9 9
 
10
-	/**
11
-	 * {@inheritdoc}
12
-	 */
13
-	const SHORTCODE = 'wl_navigator';
10
+    /**
11
+     * {@inheritdoc}
12
+     */
13
+    const SHORTCODE = 'wl_navigator';
14 14
 
15
-	/**
16
-	 * {@inheritdoc}
17
-	 */
18
-	public function render( $atts ) {
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    public function render( $atts ) {
19 19
 
20
-		// Extract attributes and set default values.
21
-		$shortcode_atts = shortcode_atts( array(
22
-			'title'          => __( 'Related articles', 'wordlift' ),
23
-			'with_carousel'  => TRUE,
24
-			'squared_thumbs' => FALSE
25
-		), $atts );
20
+        // Extract attributes and set default values.
21
+        $shortcode_atts = shortcode_atts( array(
22
+            'title'          => __( 'Related articles', 'wordlift' ),
23
+            'with_carousel'  => TRUE,
24
+            'squared_thumbs' => FALSE
25
+        ), $atts );
26 26
 
27
-		foreach (
28
-			array(
29
-				'with_carousel',
30
-				'squared_thumbs'
31
-			) as $att
32
-		) {
27
+        foreach (
28
+            array(
29
+                'with_carousel',
30
+                'squared_thumbs'
31
+            ) as $att
32
+        ) {
33 33
 
34
-			// See http://wordpress.stackexchange.com/questions/119294/pass-boolean-value-in-shortcode
35
-			$shortcode_atts[ $att ] = filter_var(
36
-				$shortcode_atts[ $att ], FILTER_VALIDATE_BOOLEAN
37
-			);
38
-		}
34
+            // See http://wordpress.stackexchange.com/questions/119294/pass-boolean-value-in-shortcode
35
+            $shortcode_atts[ $att ] = filter_var(
36
+                $shortcode_atts[ $att ], FILTER_VALIDATE_BOOLEAN
37
+            );
38
+        }
39 39
 
40
-		// avoid building the widget when there is a list of posts.
41
-		if ( ! is_single() ) {
42
-			return '';
43
-		}
40
+        // avoid building the widget when there is a list of posts.
41
+        if ( ! is_single() ) {
42
+            return '';
43
+        }
44 44
 
45
-		$current_post = get_post();
45
+        $current_post = get_post();
46 46
 
47
-		// Enqueue common shortcode scripts.
48
-		$this->enqueue_scripts();
47
+        // Enqueue common shortcode scripts.
48
+        $this->enqueue_scripts();
49 49
 
50
-		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
50
+        wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
51 51
 
52
-		$navigator_id = uniqid( 'wl-navigator-widget-' );
52
+        $navigator_id = uniqid( 'wl-navigator-widget-' );
53 53
 
54
-		wp_localize_script( 'wordlift-ui', 'wl_navigator_params', array(
55
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
56
-				'action'   => 'wl_navigator',
57
-				'post_id'  => $current_post->ID,
58
-				'attrs'    => $shortcode_atts
59
-			)
60
-		);
54
+        wp_localize_script( 'wordlift-ui', 'wl_navigator_params', array(
55
+                'ajax_url' => admin_url( 'admin-ajax.php' ),
56
+                'action'   => 'wl_navigator',
57
+                'post_id'  => $current_post->ID,
58
+                'attrs'    => $shortcode_atts
59
+            )
60
+        );
61 61
 
62
-		return "<div id='$navigator_id' class='wl-navigator-widget'></div>";
63
-	}
62
+        return "<div id='$navigator_id' class='wl-navigator-widget'></div>";
63
+    }
64 64
 
65 65
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * {@inheritdoc}
17 17
 	 */
18
-	public function render( $atts ) {
18
+	public function render($atts) {
19 19
 
20 20
 		// Extract attributes and set default values.
21
-		$shortcode_atts = shortcode_atts( array(
22
-			'title'          => __( 'Related articles', 'wordlift' ),
21
+		$shortcode_atts = shortcode_atts(array(
22
+			'title'          => __('Related articles', 'wordlift'),
23 23
 			'with_carousel'  => TRUE,
24 24
 			'squared_thumbs' => FALSE
25
-		), $atts );
25
+		), $atts);
26 26
 
27 27
 		foreach (
28 28
 			array(
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 		) {
33 33
 
34 34
 			// See http://wordpress.stackexchange.com/questions/119294/pass-boolean-value-in-shortcode
35
-			$shortcode_atts[ $att ] = filter_var(
36
-				$shortcode_atts[ $att ], FILTER_VALIDATE_BOOLEAN
35
+			$shortcode_atts[$att] = filter_var(
36
+				$shortcode_atts[$att], FILTER_VALIDATE_BOOLEAN
37 37
 			);
38 38
 		}
39 39
 
40 40
 		// avoid building the widget when there is a list of posts.
41
-		if ( ! is_single() ) {
41
+		if ( ! is_single()) {
42 42
 			return '';
43 43
 		}
44 44
 
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 		// Enqueue common shortcode scripts.
48 48
 		$this->enqueue_scripts();
49 49
 
50
-		wp_enqueue_style( 'wordlift-ui', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-ui.min.css' );
50
+		wp_enqueue_style('wordlift-ui', dirname(plugin_dir_url(__FILE__)).'/css/wordlift-ui.min.css');
51 51
 
52
-		$navigator_id = uniqid( 'wl-navigator-widget-' );
52
+		$navigator_id = uniqid('wl-navigator-widget-');
53 53
 
54
-		wp_localize_script( 'wordlift-ui', 'wl_navigator_params', array(
55
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
54
+		wp_localize_script('wordlift-ui', 'wl_navigator_params', array(
55
+				'ajax_url' => admin_url('admin-ajax.php'),
56 56
 				'action'   => 'wl_navigator',
57 57
 				'post_id'  => $current_post->ID,
58 58
 				'attrs'    => $shortcode_atts
Please login to merge, or discard this patch.