Completed
Push — develop ( e22e79...744247 )
by David
03:50
created
src/includes/class-wordlift.php 2 patches
Indentation   +338 added lines, -338 removed lines patch added patch discarded remove patch
@@ -29,343 +29,343 @@
 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 Entity service.
71
-	 *
72
-	 * @since 3.1.0
73
-	 * @access private
74
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
75
-	 */
76
-	private $entity_service;
77
-
78
-	/**
79
-	 * The User service.
80
-	 *
81
-	 * @since 3.1.7
82
-	 * @access private
83
-	 * @var \Wordlift_User_Service $user_service The User service.
84
-	 */
85
-	private $user_service;
86
-
87
-	/**
88
-	 * The Timeline service.
89
-	 *
90
-	 * @since 3.1.0
91
-	 * @access private
92
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
93
-	 */
94
-	private $timeline_service;
95
-
96
-	/**
97
-	 * The Entity Types Taxonomy Walker.
98
-	 *
99
-	 * @since 3.1.0
100
-	 * @access private
101
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
102
-	 */
103
-	private $entity_types_taxonomy_walker;
104
-
105
-	/**
106
-	 * The ShareThis service.
107
-	 *
108
-	 * @since 3.2.0
109
-	 * @access private
110
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
111
-	 */
112
-	private $sharethis_service;
113
-
114
-	/**
115
-	 * Define the core functionality of the plugin.
116
-	 *
117
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
118
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
119
-	 * the public-facing side of the site.
120
-	 *
121
-	 * @since    1.0.0
122
-	 */
123
-	public function __construct() {
124
-
125
-		$this->plugin_name = 'wordlift';
126
-
127
-		$this->version = '3.2.0-dev';
128
-
129
-		$this->load_dependencies();
130
-		$this->set_locale();
131
-		$this->define_admin_hooks();
132
-		$this->define_public_hooks();
133
-
134
-	}
135
-
136
-	/**
137
-	 * Load the required dependencies for this plugin.
138
-	 *
139
-	 * Include the following files that make up the plugin:
140
-	 *
141
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
142
-	 * - Wordlift_i18n. Defines internationalization functionality.
143
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
144
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
145
-	 *
146
-	 * Create an instance of the loader which will be used to register the hooks
147
-	 * with WordPress.
148
-	 *
149
-	 * @since    1.0.0
150
-	 * @access   private
151
-	 */
152
-	private function load_dependencies() {
153
-
154
-		/**
155
-		 * The class responsible for orchestrating the actions and filters of the
156
-		 * core plugin.
157
-		 */
158
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
159
-
160
-		/**
161
-		 * The class responsible for defining internationalization functionality
162
-		 * of the plugin.
163
-		 */
164
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
165
-
166
-		/**
167
-		 * The Log service.
168
-		 */
169
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
170
-
171
-		/**
172
-		 * The Query builder.
173
-		 */
174
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
175
-
176
-		/**
177
-		 * The Schema service.
178
-		 */
179
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
180
-
181
-		/**
182
-		 * The Thumbnail service.
183
-		 */
184
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
185
-
186
-		/**
187
-		 * The Entity Types Taxonomy service.
188
-		 */
189
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
190
-
191
-		/**
192
-		 * The Entity service.
193
-		 */
194
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
195
-
196
-		/**
197
-		 * The User service.
198
-		 */
199
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
200
-
201
-		/**
202
-		 * The Timeline service.
203
-		 */
204
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
205
-
206
-		/**
207
-		 * The class responsible for defining all actions that occur in the admin area.
208
-		 */
209
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
210
-
211
-		/**
212
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
213
-		 */
214
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
215
-
216
-		/**
217
-		 * The class responsible for defining all actions that occur in the public-facing
218
-		 * side of the site.
219
-		 */
220
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
221
-
222
-		/**
223
-		 * The Timeline shortcode.
224
-		 */
225
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
226
-
227
-		/**
228
-		 * The ShareThis service.
229
-		 */
230
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
231
-
232
-		$this->loader = new Wordlift_Loader();
233
-
234
-		// Instantiate a global logger.
235
-		global $wl_logger;
236
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
237
-
238
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
239
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
240
-
241
-		// Create an instance of the Schema service.
242
-		new Wordlift_Schema_Service();
243
-
244
-		$this->entity_service = new Wordlift_Entity_Service();
245
-
246
-		// Create an instance of the User service.
247
-		$this->user_service = new Wordlift_User_Service();
248
-
249
-		// Create a new instance of the Timeline service and Timeline shortcode.
250
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
251
-
252
-		// Create an instance of the Timeline shortcode.
253
-		new Wordlift_Timeline_Shortcode();
254
-
255
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
256
-
257
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
258
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
259
-	}
260
-
261
-	/**
262
-	 * Define the locale for this plugin for internationalization.
263
-	 *
264
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
265
-	 * with WordPress.
266
-	 *
267
-	 * @since    1.0.0
268
-	 * @access   private
269
-	 */
270
-	private function set_locale() {
271
-
272
-		$plugin_i18n = new Wordlift_i18n();
273
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
274
-
275
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
276
-
277
-	}
278
-
279
-	/**
280
-	 * Register all of the hooks related to the admin area functionality
281
-	 * of the plugin.
282
-	 *
283
-	 * @since    1.0.0
284
-	 * @access   private
285
-	 */
286
-	private function define_admin_hooks() {
287
-
288
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
289
-
290
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
291
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
292
-
293
-		// Hook the deleted_post_meta action to the Thumbnail service.
294
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
295
-
296
-		// Hook the added_post_meta action to the Thumbnail service.
297
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 );
298
-
299
-		// Hook posts inserts (or updates) to the user service.
300
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
301
-
302
-		// Hook the AJAX wl_timeline action to the Timeline service.
303
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
304
-
305
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
306
-
307
-	}
308
-
309
-	/**
310
-	 * Register all of the hooks related to the public-facing functionality
311
-	 * of the plugin.
312
-	 *
313
-	 * @since    1.0.0
314
-	 * @access   private
315
-	 */
316
-	private function define_public_hooks() {
317
-
318
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
319
-
320
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
321
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
322
-
323
-		// Hook the AJAX wl_timeline action to the Timeline service.
324
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
325
-
326
-		// Hook the ShareThis service.
327
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
328
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
329
-	}
330
-
331
-	/**
332
-	 * Run the loader to execute all of the hooks with WordPress.
333
-	 *
334
-	 * @since    1.0.0
335
-	 */
336
-	public function run() {
337
-		$this->loader->run();
338
-	}
339
-
340
-	/**
341
-	 * The name of the plugin used to uniquely identify it within the context of
342
-	 * WordPress and to define internationalization functionality.
343
-	 *
344
-	 * @since     1.0.0
345
-	 * @return    string    The name of the plugin.
346
-	 */
347
-	public function get_plugin_name() {
348
-		return $this->plugin_name;
349
-	}
350
-
351
-	/**
352
-	 * The reference to the class that orchestrates the hooks with the plugin.
353
-	 *
354
-	 * @since     1.0.0
355
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
356
-	 */
357
-	public function get_loader() {
358
-		return $this->loader;
359
-	}
360
-
361
-	/**
362
-	 * Retrieve the version number of the plugin.
363
-	 *
364
-	 * @since     1.0.0
365
-	 * @return    string    The version number of the plugin.
366
-	 */
367
-	public function get_version() {
368
-		return $this->version;
369
-	}
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 Entity service.
71
+     *
72
+     * @since 3.1.0
73
+     * @access private
74
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
75
+     */
76
+    private $entity_service;
77
+
78
+    /**
79
+     * The User service.
80
+     *
81
+     * @since 3.1.7
82
+     * @access private
83
+     * @var \Wordlift_User_Service $user_service The User service.
84
+     */
85
+    private $user_service;
86
+
87
+    /**
88
+     * The Timeline service.
89
+     *
90
+     * @since 3.1.0
91
+     * @access private
92
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
93
+     */
94
+    private $timeline_service;
95
+
96
+    /**
97
+     * The Entity Types Taxonomy Walker.
98
+     *
99
+     * @since 3.1.0
100
+     * @access private
101
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
102
+     */
103
+    private $entity_types_taxonomy_walker;
104
+
105
+    /**
106
+     * The ShareThis service.
107
+     *
108
+     * @since 3.2.0
109
+     * @access private
110
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
111
+     */
112
+    private $sharethis_service;
113
+
114
+    /**
115
+     * Define the core functionality of the plugin.
116
+     *
117
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
118
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
119
+     * the public-facing side of the site.
120
+     *
121
+     * @since    1.0.0
122
+     */
123
+    public function __construct() {
124
+
125
+        $this->plugin_name = 'wordlift';
126
+
127
+        $this->version = '3.2.0-dev';
128
+
129
+        $this->load_dependencies();
130
+        $this->set_locale();
131
+        $this->define_admin_hooks();
132
+        $this->define_public_hooks();
133
+
134
+    }
135
+
136
+    /**
137
+     * Load the required dependencies for this plugin.
138
+     *
139
+     * Include the following files that make up the plugin:
140
+     *
141
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
142
+     * - Wordlift_i18n. Defines internationalization functionality.
143
+     * - Wordlift_Admin. Defines all hooks for the admin area.
144
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
145
+     *
146
+     * Create an instance of the loader which will be used to register the hooks
147
+     * with WordPress.
148
+     *
149
+     * @since    1.0.0
150
+     * @access   private
151
+     */
152
+    private function load_dependencies() {
153
+
154
+        /**
155
+         * The class responsible for orchestrating the actions and filters of the
156
+         * core plugin.
157
+         */
158
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
159
+
160
+        /**
161
+         * The class responsible for defining internationalization functionality
162
+         * of the plugin.
163
+         */
164
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
165
+
166
+        /**
167
+         * The Log service.
168
+         */
169
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
170
+
171
+        /**
172
+         * The Query builder.
173
+         */
174
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
175
+
176
+        /**
177
+         * The Schema service.
178
+         */
179
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
180
+
181
+        /**
182
+         * The Thumbnail service.
183
+         */
184
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
185
+
186
+        /**
187
+         * The Entity Types Taxonomy service.
188
+         */
189
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
190
+
191
+        /**
192
+         * The Entity service.
193
+         */
194
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
195
+
196
+        /**
197
+         * The User service.
198
+         */
199
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
200
+
201
+        /**
202
+         * The Timeline service.
203
+         */
204
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
205
+
206
+        /**
207
+         * The class responsible for defining all actions that occur in the admin area.
208
+         */
209
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
210
+
211
+        /**
212
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
213
+         */
214
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
215
+
216
+        /**
217
+         * The class responsible for defining all actions that occur in the public-facing
218
+         * side of the site.
219
+         */
220
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
221
+
222
+        /**
223
+         * The Timeline shortcode.
224
+         */
225
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
226
+
227
+        /**
228
+         * The ShareThis service.
229
+         */
230
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
231
+
232
+        $this->loader = new Wordlift_Loader();
233
+
234
+        // Instantiate a global logger.
235
+        global $wl_logger;
236
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
237
+
238
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
239
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
240
+
241
+        // Create an instance of the Schema service.
242
+        new Wordlift_Schema_Service();
243
+
244
+        $this->entity_service = new Wordlift_Entity_Service();
245
+
246
+        // Create an instance of the User service.
247
+        $this->user_service = new Wordlift_User_Service();
248
+
249
+        // Create a new instance of the Timeline service and Timeline shortcode.
250
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
251
+
252
+        // Create an instance of the Timeline shortcode.
253
+        new Wordlift_Timeline_Shortcode();
254
+
255
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
256
+
257
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
258
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
259
+    }
260
+
261
+    /**
262
+     * Define the locale for this plugin for internationalization.
263
+     *
264
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
265
+     * with WordPress.
266
+     *
267
+     * @since    1.0.0
268
+     * @access   private
269
+     */
270
+    private function set_locale() {
271
+
272
+        $plugin_i18n = new Wordlift_i18n();
273
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
274
+
275
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
276
+
277
+    }
278
+
279
+    /**
280
+     * Register all of the hooks related to the admin area functionality
281
+     * of the plugin.
282
+     *
283
+     * @since    1.0.0
284
+     * @access   private
285
+     */
286
+    private function define_admin_hooks() {
287
+
288
+        $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
289
+
290
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
291
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
292
+
293
+        // Hook the deleted_post_meta action to the Thumbnail service.
294
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
295
+
296
+        // Hook the added_post_meta action to the Thumbnail service.
297
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 );
298
+
299
+        // Hook posts inserts (or updates) to the user service.
300
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
301
+
302
+        // Hook the AJAX wl_timeline action to the Timeline service.
303
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
304
+
305
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
306
+
307
+    }
308
+
309
+    /**
310
+     * Register all of the hooks related to the public-facing functionality
311
+     * of the plugin.
312
+     *
313
+     * @since    1.0.0
314
+     * @access   private
315
+     */
316
+    private function define_public_hooks() {
317
+
318
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
319
+
320
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
321
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
322
+
323
+        // Hook the AJAX wl_timeline action to the Timeline service.
324
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
325
+
326
+        // Hook the ShareThis service.
327
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
328
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
329
+    }
330
+
331
+    /**
332
+     * Run the loader to execute all of the hooks with WordPress.
333
+     *
334
+     * @since    1.0.0
335
+     */
336
+    public function run() {
337
+        $this->loader->run();
338
+    }
339
+
340
+    /**
341
+     * The name of the plugin used to uniquely identify it within the context of
342
+     * WordPress and to define internationalization functionality.
343
+     *
344
+     * @since     1.0.0
345
+     * @return    string    The name of the plugin.
346
+     */
347
+    public function get_plugin_name() {
348
+        return $this->plugin_name;
349
+    }
350
+
351
+    /**
352
+     * The reference to the class that orchestrates the hooks with the plugin.
353
+     *
354
+     * @since     1.0.0
355
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
356
+     */
357
+    public function get_loader() {
358
+        return $this->loader;
359
+    }
360
+
361
+    /**
362
+     * Retrieve the version number of the plugin.
363
+     *
364
+     * @since     1.0.0
365
+     * @return    string    The version number of the plugin.
366
+     */
367
+    public function get_version() {
368
+        return $this->version;
369
+    }
370 370
 
371 371
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -155,85 +155,85 @@  discard block
 block discarded – undo
155 155
 		 * The class responsible for orchestrating the actions and filters of the
156 156
 		 * core plugin.
157 157
 		 */
158
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
158
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
159 159
 
160 160
 		/**
161 161
 		 * The class responsible for defining internationalization functionality
162 162
 		 * of the plugin.
163 163
 		 */
164
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
164
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
165 165
 
166 166
 		/**
167 167
 		 * The Log service.
168 168
 		 */
169
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
169
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
170 170
 
171 171
 		/**
172 172
 		 * The Query builder.
173 173
 		 */
174
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
174
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
175 175
 
176 176
 		/**
177 177
 		 * The Schema service.
178 178
 		 */
179
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
179
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
180 180
 
181 181
 		/**
182 182
 		 * The Thumbnail service.
183 183
 		 */
184
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
184
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
185 185
 
186 186
 		/**
187 187
 		 * The Entity Types Taxonomy service.
188 188
 		 */
189
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
189
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
190 190
 
191 191
 		/**
192 192
 		 * The Entity service.
193 193
 		 */
194
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
194
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
195 195
 
196 196
 		/**
197 197
 		 * The User service.
198 198
 		 */
199
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
199
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
200 200
 
201 201
 		/**
202 202
 		 * The Timeline service.
203 203
 		 */
204
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
204
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
205 205
 
206 206
 		/**
207 207
 		 * The class responsible for defining all actions that occur in the admin area.
208 208
 		 */
209
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
209
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
210 210
 
211 211
 		/**
212 212
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
213 213
 		 */
214
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
214
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
215 215
 
216 216
 		/**
217 217
 		 * The class responsible for defining all actions that occur in the public-facing
218 218
 		 * side of the site.
219 219
 		 */
220
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
220
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
221 221
 
222 222
 		/**
223 223
 		 * The Timeline shortcode.
224 224
 		 */
225
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
225
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
226 226
 
227 227
 		/**
228 228
 		 * The ShareThis service.
229 229
 		 */
230
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
230
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
231 231
 
232 232
 		$this->loader = new Wordlift_Loader();
233 233
 
234 234
 		// Instantiate a global logger.
235 235
 		global $wl_logger;
236
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
236
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
237 237
 
238 238
 		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
239 239
 		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		$this->user_service = new Wordlift_User_Service();
248 248
 
249 249
 		// Create a new instance of the Timeline service and Timeline shortcode.
250
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
250
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service);
251 251
 
252 252
 		// Create an instance of the Timeline shortcode.
253 253
 		new Wordlift_Timeline_Shortcode();
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	private function set_locale() {
271 271
 
272 272
 		$plugin_i18n = new Wordlift_i18n();
273
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
273
+		$plugin_i18n->set_domain($this->get_plugin_name());
274 274
 
275
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
275
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
276 276
 
277 277
 	}
278 278
 
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 	 */
286 286
 	private function define_admin_hooks() {
287 287
 
288
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
288
+		$plugin_admin = new Wordlift_Admin($this->get_plugin_name(), $this->get_version());
289 289
 
290
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
291
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
290
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
291
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
292 292
 
293 293
 		// Hook the deleted_post_meta action to the Thumbnail service.
294
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
294
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
295 295
 
296 296
 		// Hook the added_post_meta action to the Thumbnail service.
297
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 );
297
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4);
298 298
 
299 299
 		// Hook posts inserts (or updates) to the user service.
300
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
300
+		$this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3);
301 301
 
302 302
 		// Hook the AJAX wl_timeline action to the Timeline service.
303
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
303
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
304 304
 
305
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
305
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
306 306
 
307 307
 	}
308 308
 
@@ -315,17 +315,17 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	private function define_public_hooks() {
317 317
 
318
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
318
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
319 319
 
320
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
321
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
320
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
321
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
322 322
 
323 323
 		// Hook the AJAX wl_timeline action to the Timeline service.
324
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
324
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
325 325
 
326 326
 		// Hook the ShareThis service.
327
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
328
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
327
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
328
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
329 329
 	}
330 330
 
331 331
 	/**
Please login to merge, or discard this patch.
src/public/class-wordlift-sharethis-service.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -7,103 +7,103 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_ShareThis_Service {
9 9
 
10
-	/**
11
-	 * The ShareThis function which prints the buttons.
12
-	 *
13
-	 * @since 3.2.0
14
-	 */
15
-	const ADD_WIDGET_FUNCTION_NAME = 'st_add_widget';
16
-
17
-	/**
18
-	 * The Log service.
19
-	 *
20
-	 * @since 3.2.0
21
-	 * @access private
22
-	 * @var \Wordlift_Log_Service $log_service The Log service.
23
-	 */
24
-	private $log_service;
25
-
26
-	/**
27
-	 * Create an instance of the ShareThis service.
28
-	 *
29
-	 * @since 3.2.0
30
-	 */
31
-	public function __construct() {
32
-
33
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_ShareThis_Service' );
34
-
35
-	}
36
-
37
-	/**
38
-	 * Receive <em>the_content</em> filter calls from WordPress.
39
-	 *
40
-	 * @since 3.2.0
41
-	 *
42
-	 * @param string $content The post content.
43
-	 *
44
-	 * @return string The updated post content.
45
-	 */
46
-	public function the_content( $content ) {
47
-
48
-		return $this->call_sharethis( 'the_content', $content );
49
-	}
50
-
51
-	/**
52
-	 * Receive <em>the_excerpt</em> filter calls from WordPress.
53
-	 *
54
-	 * @since 3.2.0
55
-	 *
56
-	 * @param string $content The post excerpt.
57
-	 *
58
-	 * @return string The updated post excerpt.
59
-	 */
60
-	public function the_excerpt( $content ) {
61
-
62
-		return $this->call_sharethis( 'the_excerpt', $content );
63
-	}
64
-
65
-	/**
66
-	 * Call the ShareThis function.
67
-	 *
68
-	 * @since 3.2.0
69
-	 *
70
-	 * @param string $tag The filter tag.
71
-	 * @param string $content The post content.
72
-	 *
73
-	 * @return string The updated post content.
74
-	 */
75
-	private function call_sharethis( $tag, $content ) {
76
-
77
-		// Get the current post.
78
-		global $post;
79
-
80
-		// If it's not the entity type, return.
81
-		if ( Wordlift_Entity_Service::TYPE_NAME !== $post->post_type ) {
82
-			return $content;
83
-		}
84
-
85
-		// If the ShareThis function doesn't exist, return.
86
-		if ( ! function_exists( self::ADD_WIDGET_FUNCTION_NAME ) ) {
87
-			return $content;
88
-		}
89
-
90
-		// If ShareThis hasn't been added as a filter, return.
91
-		if ( ! has_filter( $tag, self::ADD_WIDGET_FUNCTION_NAME ) ) {
92
-			return $content;
93
-		}
94
-
95
-		// Temporary pop the post type and replace it with post.
96
-		$post_type       = $post->post_type;
97
-		$post->post_type = 'post';
98
-
99
-		// Call ShareThis (disguised as a post).
100
-		$content = call_user_func_array( self::ADD_WIDGET_FUNCTION_NAME, array( $content ) );
101
-
102
-		// Restore our post type.
103
-		$post->post_type = $post_type;
104
-
105
-		// Finally return the content.
106
-		return $content;
107
-	}
10
+    /**
11
+     * The ShareThis function which prints the buttons.
12
+     *
13
+     * @since 3.2.0
14
+     */
15
+    const ADD_WIDGET_FUNCTION_NAME = 'st_add_widget';
16
+
17
+    /**
18
+     * The Log service.
19
+     *
20
+     * @since 3.2.0
21
+     * @access private
22
+     * @var \Wordlift_Log_Service $log_service The Log service.
23
+     */
24
+    private $log_service;
25
+
26
+    /**
27
+     * Create an instance of the ShareThis service.
28
+     *
29
+     * @since 3.2.0
30
+     */
31
+    public function __construct() {
32
+
33
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_ShareThis_Service' );
34
+
35
+    }
36
+
37
+    /**
38
+     * Receive <em>the_content</em> filter calls from WordPress.
39
+     *
40
+     * @since 3.2.0
41
+     *
42
+     * @param string $content The post content.
43
+     *
44
+     * @return string The updated post content.
45
+     */
46
+    public function the_content( $content ) {
47
+
48
+        return $this->call_sharethis( 'the_content', $content );
49
+    }
50
+
51
+    /**
52
+     * Receive <em>the_excerpt</em> filter calls from WordPress.
53
+     *
54
+     * @since 3.2.0
55
+     *
56
+     * @param string $content The post excerpt.
57
+     *
58
+     * @return string The updated post excerpt.
59
+     */
60
+    public function the_excerpt( $content ) {
61
+
62
+        return $this->call_sharethis( 'the_excerpt', $content );
63
+    }
64
+
65
+    /**
66
+     * Call the ShareThis function.
67
+     *
68
+     * @since 3.2.0
69
+     *
70
+     * @param string $tag The filter tag.
71
+     * @param string $content The post content.
72
+     *
73
+     * @return string The updated post content.
74
+     */
75
+    private function call_sharethis( $tag, $content ) {
76
+
77
+        // Get the current post.
78
+        global $post;
79
+
80
+        // If it's not the entity type, return.
81
+        if ( Wordlift_Entity_Service::TYPE_NAME !== $post->post_type ) {
82
+            return $content;
83
+        }
84
+
85
+        // If the ShareThis function doesn't exist, return.
86
+        if ( ! function_exists( self::ADD_WIDGET_FUNCTION_NAME ) ) {
87
+            return $content;
88
+        }
89
+
90
+        // If ShareThis hasn't been added as a filter, return.
91
+        if ( ! has_filter( $tag, self::ADD_WIDGET_FUNCTION_NAME ) ) {
92
+            return $content;
93
+        }
94
+
95
+        // Temporary pop the post type and replace it with post.
96
+        $post_type       = $post->post_type;
97
+        $post->post_type = 'post';
98
+
99
+        // Call ShareThis (disguised as a post).
100
+        $content = call_user_func_array( self::ADD_WIDGET_FUNCTION_NAME, array( $content ) );
101
+
102
+        // Restore our post type.
103
+        $post->post_type = $post_type;
104
+
105
+        // Finally return the content.
106
+        return $content;
107
+    }
108 108
 
109 109
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function __construct() {
32 32
 
33
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_ShareThis_Service' );
33
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_ShareThis_Service');
34 34
 
35 35
 	}
36 36
 
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return string The updated post content.
45 45
 	 */
46
-	public function the_content( $content ) {
46
+	public function the_content($content) {
47 47
 
48
-		return $this->call_sharethis( 'the_content', $content );
48
+		return $this->call_sharethis('the_content', $content);
49 49
 	}
50 50
 
51 51
 	/**
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @return string The updated post excerpt.
59 59
 	 */
60
-	public function the_excerpt( $content ) {
60
+	public function the_excerpt($content) {
61 61
 
62
-		return $this->call_sharethis( 'the_excerpt', $content );
62
+		return $this->call_sharethis('the_excerpt', $content);
63 63
 	}
64 64
 
65 65
 	/**
@@ -72,23 +72,23 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string The updated post content.
74 74
 	 */
75
-	private function call_sharethis( $tag, $content ) {
75
+	private function call_sharethis($tag, $content) {
76 76
 
77 77
 		// Get the current post.
78 78
 		global $post;
79 79
 
80 80
 		// If it's not the entity type, return.
81
-		if ( Wordlift_Entity_Service::TYPE_NAME !== $post->post_type ) {
81
+		if (Wordlift_Entity_Service::TYPE_NAME !== $post->post_type) {
82 82
 			return $content;
83 83
 		}
84 84
 
85 85
 		// If the ShareThis function doesn't exist, return.
86
-		if ( ! function_exists( self::ADD_WIDGET_FUNCTION_NAME ) ) {
86
+		if ( ! function_exists(self::ADD_WIDGET_FUNCTION_NAME)) {
87 87
 			return $content;
88 88
 		}
89 89
 
90 90
 		// If ShareThis hasn't been added as a filter, return.
91
-		if ( ! has_filter( $tag, self::ADD_WIDGET_FUNCTION_NAME ) ) {
91
+		if ( ! has_filter($tag, self::ADD_WIDGET_FUNCTION_NAME)) {
92 92
 			return $content;
93 93
 		}
94 94
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		$post->post_type = 'post';
98 98
 
99 99
 		// Call ShareThis (disguised as a post).
100
-		$content = call_user_func_array( self::ADD_WIDGET_FUNCTION_NAME, array( $content ) );
100
+		$content = call_user_func_array(self::ADD_WIDGET_FUNCTION_NAME, array($content));
101 101
 
102 102
 		// Restore our post type.
103 103
 		$post->post_type = $post_type;
Please login to merge, or discard this patch.