Completed
Push — master ( dfa672...d75d5d )
by David
06:41 queued 03:24
created
src/includes/class-wordlift-thumbnail-service.php 2 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -7,124 +7,124 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Thumbnail_Service {
9 9
 
10
-	/**
11
-	 * The Thumbnail id meta key.
12
-	 *
13
-	 * @since 3.1.5
14
-	 */
15
-	const THUMBNAIL_ID_META_KEY = '_thumbnail_id';
16
-
17
-	/**
18
-	 * The predicate used in RDF to describe the thumbnail.
19
-	 *
20
-	 * @since 3.1.5
21
-	 */
22
-	const THUMBNAIL_RDF_PREDICATE = 'http://schema.org/image';
23
-
24
-	/**
25
-	 * The Log service.
26
-	 *
27
-	 * @since 3.1.5
28
-	 * @access private
29
-	 * @var \Wordlift_Log_Service The Log service.
30
-	 */
31
-	private $log_service;
32
-
33
-	/**
34
-	 * Create an instance of the Thumbnail service.
35
-	 *
36
-	 * @since 3.1.5
37
-	 */
38
-	public function __construct() {
39
-
40
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Thumbnail_Service' );
41
-
42
-	}
43
-
44
-	/**
45
-	 * Receive post meta events immediately after a post metadata has been deleted.
46
-	 *
47
-	 * @since 3.1.5
48
-	 *
49
-	 * @param array $meta_ids An array of deleted metadata entry IDs.
50
-	 * @param int $object_id Object ID.
51
-	 * @param string $meta_key Meta key.
52
-	 * @param mixed $_meta_value Meta value.
53
-	 */
54
-	public function deleted_post_meta( $meta_ids, $object_id, $meta_key, $_meta_value ) {
55
-
56
-		// Return if it's not the Thumbnail id meta key.
57
-		if ( self::THUMBNAIL_ID_META_KEY !== $meta_key ) {
58
-			return;
59
-		}
60
-
61
-		// Do not perform any action is the post is not published.
62
-		if ( 'publish' !== get_post_status( $object_id ) ) {
63
-			return;
64
-		}
65
-
66
-		// Get the post uri and return if it's null.
67
-		if ( null === ( $uri = wl_get_entity_uri( $object_id ) ) ) {
68
-			return;
69
-		}
70
-
71
-		// Prepare the query and execute it. We don't buffer the query since we're not going to reindex.
72
-		$query = sprintf( 'DELETE { <%s> <%s> ?o . } WHERE  { <%1$s> <%2$s> ?o . };', $uri, self::THUMBNAIL_RDF_PREDICATE );
73
-		if ( false === rl_execute_sparql_update_query( $query, false ) ) {
74
-
75
-			$this->log_service->error( "An error occurred removing the post thumbnail [ meta ids :: " . ( is_array( $meta_ids ) ? implode( ',', $meta_ids ) : $meta_ids ) . " ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . ( is_array( $_meta_value ) ? implode( ',', $_meta_value ) : $_meta_value ) . " ][ query :: $query ]" );
76
-
77
-		}
78
-
79
-	}
80
-
81
-	/**
82
-	 * Receive post meta events immediately after a post metadata has been added.
83
-	 *
84
-	 * @since 3.1.5
85
-	 *
86
-	 * @param int $mid The meta ID after successful update.
87
-	 * @param int $object_id Object ID.
88
-	 * @param string $meta_key Meta key.
89
-	 * @param mixed $_meta_value Meta value.
90
-	 */
91
-	public function added_post_meta( $mid, $object_id, $meta_key, $_meta_value ) {
92
-
93
-		$this->log_service->trace( "A post meta has been updated [ meta id :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . var_export( $_meta_value, true ) . " ]" );
94
-
95
-		// Return if it's not the Thumbnail id meta key.
96
-		if ( self::THUMBNAIL_ID_META_KEY !== $meta_key ) {
97
-			return;
98
-		}
99
-
100
-		// The meta value must be the numeric id of the attachment. If it isn't, return.
101
-		if ( ! is_numeric( $_meta_value ) ) {
102
-			return;
103
-		}
104
-
105
-		// Do not perform any action is the post is not published.
106
-		if ( 'publish' !== get_post_status( $object_id ) ) {
107
-			return;
108
-		}
109
-
110
-		// Get the post uri and return if it's null.
111
-		if ( null === ( $uri = wl_get_entity_uri( $object_id ) ) ) {
112
-			return;
113
-		}
114
-
115
-		// Get the attachment url and return if not found.
116
-		if ( false === ( $attachment_url = wp_get_attachment_url( $_meta_value ) ) ) {
117
-			return;
118
-		};
119
-
120
-		// Prepare the query and execute it. We don't buffer the query since we're not going to reindex.
121
-		$query = sprintf( 'DELETE { <%1$s> <%2$s> ?o . } WHERE  { <%1$s> <%2$s> ?o . }; INSERT DATA { <%1$s> <%2$s> <%3$s> . };', $uri, self::THUMBNAIL_RDF_PREDICATE, $attachment_url );
122
-		if ( false === rl_execute_sparql_update_query( $query, false ) ) {
123
-
124
-			$this->log_service->error( "An error occurred removing the post thumbnail [ meta ids :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . var_export( $_meta_value, true ) . " ][ query :: $query ]" );
125
-
126
-		}
127
-
128
-	}
10
+    /**
11
+     * The Thumbnail id meta key.
12
+     *
13
+     * @since 3.1.5
14
+     */
15
+    const THUMBNAIL_ID_META_KEY = '_thumbnail_id';
16
+
17
+    /**
18
+     * The predicate used in RDF to describe the thumbnail.
19
+     *
20
+     * @since 3.1.5
21
+     */
22
+    const THUMBNAIL_RDF_PREDICATE = 'http://schema.org/image';
23
+
24
+    /**
25
+     * The Log service.
26
+     *
27
+     * @since 3.1.5
28
+     * @access private
29
+     * @var \Wordlift_Log_Service The Log service.
30
+     */
31
+    private $log_service;
32
+
33
+    /**
34
+     * Create an instance of the Thumbnail service.
35
+     *
36
+     * @since 3.1.5
37
+     */
38
+    public function __construct() {
39
+
40
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Thumbnail_Service' );
41
+
42
+    }
43
+
44
+    /**
45
+     * Receive post meta events immediately after a post metadata has been deleted.
46
+     *
47
+     * @since 3.1.5
48
+     *
49
+     * @param array $meta_ids An array of deleted metadata entry IDs.
50
+     * @param int $object_id Object ID.
51
+     * @param string $meta_key Meta key.
52
+     * @param mixed $_meta_value Meta value.
53
+     */
54
+    public function deleted_post_meta( $meta_ids, $object_id, $meta_key, $_meta_value ) {
55
+
56
+        // Return if it's not the Thumbnail id meta key.
57
+        if ( self::THUMBNAIL_ID_META_KEY !== $meta_key ) {
58
+            return;
59
+        }
60
+
61
+        // Do not perform any action is the post is not published.
62
+        if ( 'publish' !== get_post_status( $object_id ) ) {
63
+            return;
64
+        }
65
+
66
+        // Get the post uri and return if it's null.
67
+        if ( null === ( $uri = wl_get_entity_uri( $object_id ) ) ) {
68
+            return;
69
+        }
70
+
71
+        // Prepare the query and execute it. We don't buffer the query since we're not going to reindex.
72
+        $query = sprintf( 'DELETE { <%s> <%s> ?o . } WHERE  { <%1$s> <%2$s> ?o . };', $uri, self::THUMBNAIL_RDF_PREDICATE );
73
+        if ( false === rl_execute_sparql_update_query( $query, false ) ) {
74
+
75
+            $this->log_service->error( "An error occurred removing the post thumbnail [ meta ids :: " . ( is_array( $meta_ids ) ? implode( ',', $meta_ids ) : $meta_ids ) . " ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . ( is_array( $_meta_value ) ? implode( ',', $_meta_value ) : $_meta_value ) . " ][ query :: $query ]" );
76
+
77
+        }
78
+
79
+    }
80
+
81
+    /**
82
+     * Receive post meta events immediately after a post metadata has been added.
83
+     *
84
+     * @since 3.1.5
85
+     *
86
+     * @param int $mid The meta ID after successful update.
87
+     * @param int $object_id Object ID.
88
+     * @param string $meta_key Meta key.
89
+     * @param mixed $_meta_value Meta value.
90
+     */
91
+    public function added_post_meta( $mid, $object_id, $meta_key, $_meta_value ) {
92
+
93
+        $this->log_service->trace( "A post meta has been updated [ meta id :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . var_export( $_meta_value, true ) . " ]" );
94
+
95
+        // Return if it's not the Thumbnail id meta key.
96
+        if ( self::THUMBNAIL_ID_META_KEY !== $meta_key ) {
97
+            return;
98
+        }
99
+
100
+        // The meta value must be the numeric id of the attachment. If it isn't, return.
101
+        if ( ! is_numeric( $_meta_value ) ) {
102
+            return;
103
+        }
104
+
105
+        // Do not perform any action is the post is not published.
106
+        if ( 'publish' !== get_post_status( $object_id ) ) {
107
+            return;
108
+        }
109
+
110
+        // Get the post uri and return if it's null.
111
+        if ( null === ( $uri = wl_get_entity_uri( $object_id ) ) ) {
112
+            return;
113
+        }
114
+
115
+        // Get the attachment url and return if not found.
116
+        if ( false === ( $attachment_url = wp_get_attachment_url( $_meta_value ) ) ) {
117
+            return;
118
+        };
119
+
120
+        // Prepare the query and execute it. We don't buffer the query since we're not going to reindex.
121
+        $query = sprintf( 'DELETE { <%1$s> <%2$s> ?o . } WHERE  { <%1$s> <%2$s> ?o . }; INSERT DATA { <%1$s> <%2$s> <%3$s> . };', $uri, self::THUMBNAIL_RDF_PREDICATE, $attachment_url );
122
+        if ( false === rl_execute_sparql_update_query( $query, false ) ) {
123
+
124
+            $this->log_service->error( "An error occurred removing the post thumbnail [ meta ids :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . var_export( $_meta_value, true ) . " ][ query :: $query ]" );
125
+
126
+        }
127
+
128
+    }
129 129
 
130 130
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function __construct() {
39 39
 
40
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Thumbnail_Service' );
40
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Thumbnail_Service');
41 41
 
42 42
 	}
43 43
 
@@ -51,28 +51,28 @@  discard block
 block discarded – undo
51 51
 	 * @param string $meta_key Meta key.
52 52
 	 * @param mixed $_meta_value Meta value.
53 53
 	 */
54
-	public function deleted_post_meta( $meta_ids, $object_id, $meta_key, $_meta_value ) {
54
+	public function deleted_post_meta($meta_ids, $object_id, $meta_key, $_meta_value) {
55 55
 
56 56
 		// Return if it's not the Thumbnail id meta key.
57
-		if ( self::THUMBNAIL_ID_META_KEY !== $meta_key ) {
57
+		if (self::THUMBNAIL_ID_META_KEY !== $meta_key) {
58 58
 			return;
59 59
 		}
60 60
 
61 61
 		// Do not perform any action is the post is not published.
62
-		if ( 'publish' !== get_post_status( $object_id ) ) {
62
+		if ('publish' !== get_post_status($object_id)) {
63 63
 			return;
64 64
 		}
65 65
 
66 66
 		// Get the post uri and return if it's null.
67
-		if ( null === ( $uri = wl_get_entity_uri( $object_id ) ) ) {
67
+		if (null === ($uri = wl_get_entity_uri($object_id))) {
68 68
 			return;
69 69
 		}
70 70
 
71 71
 		// Prepare the query and execute it. We don't buffer the query since we're not going to reindex.
72
-		$query = sprintf( 'DELETE { <%s> <%s> ?o . } WHERE  { <%1$s> <%2$s> ?o . };', $uri, self::THUMBNAIL_RDF_PREDICATE );
73
-		if ( false === rl_execute_sparql_update_query( $query, false ) ) {
72
+		$query = sprintf('DELETE { <%s> <%s> ?o . } WHERE  { <%1$s> <%2$s> ?o . };', $uri, self::THUMBNAIL_RDF_PREDICATE);
73
+		if (false === rl_execute_sparql_update_query($query, false)) {
74 74
 
75
-			$this->log_service->error( "An error occurred removing the post thumbnail [ meta ids :: " . ( is_array( $meta_ids ) ? implode( ',', $meta_ids ) : $meta_ids ) . " ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . ( is_array( $_meta_value ) ? implode( ',', $_meta_value ) : $_meta_value ) . " ][ query :: $query ]" );
75
+			$this->log_service->error("An error occurred removing the post thumbnail [ meta ids :: ".(is_array($meta_ids) ? implode(',', $meta_ids) : $meta_ids)." ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: ".(is_array($_meta_value) ? implode(',', $_meta_value) : $_meta_value)." ][ query :: $query ]");
76 76
 
77 77
 		}
78 78
 
@@ -88,40 +88,40 @@  discard block
 block discarded – undo
88 88
 	 * @param string $meta_key Meta key.
89 89
 	 * @param mixed $_meta_value Meta value.
90 90
 	 */
91
-	public function added_post_meta( $mid, $object_id, $meta_key, $_meta_value ) {
91
+	public function added_post_meta($mid, $object_id, $meta_key, $_meta_value) {
92 92
 
93
-		$this->log_service->trace( "A post meta has been updated [ meta id :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . var_export( $_meta_value, true ) . " ]" );
93
+		$this->log_service->trace("A post meta has been updated [ meta id :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: ".var_export($_meta_value, true)." ]");
94 94
 
95 95
 		// Return if it's not the Thumbnail id meta key.
96
-		if ( self::THUMBNAIL_ID_META_KEY !== $meta_key ) {
96
+		if (self::THUMBNAIL_ID_META_KEY !== $meta_key) {
97 97
 			return;
98 98
 		}
99 99
 
100 100
 		// The meta value must be the numeric id of the attachment. If it isn't, return.
101
-		if ( ! is_numeric( $_meta_value ) ) {
101
+		if ( ! is_numeric($_meta_value)) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// Do not perform any action is the post is not published.
106
-		if ( 'publish' !== get_post_status( $object_id ) ) {
106
+		if ('publish' !== get_post_status($object_id)) {
107 107
 			return;
108 108
 		}
109 109
 
110 110
 		// Get the post uri and return if it's null.
111
-		if ( null === ( $uri = wl_get_entity_uri( $object_id ) ) ) {
111
+		if (null === ($uri = wl_get_entity_uri($object_id))) {
112 112
 			return;
113 113
 		}
114 114
 
115 115
 		// Get the attachment url and return if not found.
116
-		if ( false === ( $attachment_url = wp_get_attachment_url( $_meta_value ) ) ) {
116
+		if (false === ($attachment_url = wp_get_attachment_url($_meta_value))) {
117 117
 			return;
118 118
 		};
119 119
 
120 120
 		// Prepare the query and execute it. We don't buffer the query since we're not going to reindex.
121
-		$query = sprintf( 'DELETE { <%1$s> <%2$s> ?o . } WHERE  { <%1$s> <%2$s> ?o . }; INSERT DATA { <%1$s> <%2$s> <%3$s> . };', $uri, self::THUMBNAIL_RDF_PREDICATE, $attachment_url );
122
-		if ( false === rl_execute_sparql_update_query( $query, false ) ) {
121
+		$query = sprintf('DELETE { <%1$s> <%2$s> ?o . } WHERE  { <%1$s> <%2$s> ?o . }; INSERT DATA { <%1$s> <%2$s> <%3$s> . };', $uri, self::THUMBNAIL_RDF_PREDICATE, $attachment_url);
122
+		if (false === rl_execute_sparql_update_query($query, false)) {
123 123
 
124
-			$this->log_service->error( "An error occurred removing the post thumbnail [ meta ids :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: " . var_export( $_meta_value, true ) . " ][ query :: $query ]" );
124
+			$this->log_service->error("An error occurred removing the post thumbnail [ meta ids :: $mid ][ object id :: $object_id ][ meta key :: $meta_key ][ meta value :: ".var_export($_meta_value, true)." ][ query :: $query ]");
125 125
 
126 126
 		}
127 127
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 1 patch
Indentation   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -29,298 +29,298 @@
 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 Timeline service.
80
-	 *
81
-	 * @since 3.1.0
82
-	 * @access private
83
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
84
-	 */
85
-	private $timeline_service;
86
-
87
-	/**
88
-	 * The Entity Types Taxonomy Walker.
89
-	 *
90
-	 * @since 3.1.0
91
-	 * @access private
92
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
93
-	 */
94
-	private $entity_types_taxonomy_walker;
95
-
96
-	/**
97
-	 * Define the core functionality of the plugin.
98
-	 *
99
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
100
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
101
-	 * the public-facing side of the site.
102
-	 *
103
-	 * @since    1.0.0
104
-	 */
105
-	public function __construct() {
106
-
107
-		$this->plugin_name = 'wordlift';
108
-		$this->version     = '3.1.6';
109
-
110
-		$this->load_dependencies();
111
-		$this->set_locale();
112
-		$this->define_admin_hooks();
113
-		$this->define_public_hooks();
114
-
115
-	}
116
-
117
-	/**
118
-	 * Load the required dependencies for this plugin.
119
-	 *
120
-	 * Include the following files that make up the plugin:
121
-	 *
122
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
123
-	 * - Wordlift_i18n. Defines internationalization functionality.
124
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
125
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
126
-	 *
127
-	 * Create an instance of the loader which will be used to register the hooks
128
-	 * with WordPress.
129
-	 *
130
-	 * @since    1.0.0
131
-	 * @access   private
132
-	 */
133
-	private function load_dependencies() {
134
-
135
-		/**
136
-		 * The class responsible for orchestrating the actions and filters of the
137
-		 * core plugin.
138
-		 */
139
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
140
-
141
-		/**
142
-		 * The class responsible for defining internationalization functionality
143
-		 * of the plugin.
144
-		 */
145
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
146
-
147
-		/**
148
-		 * The Log service.
149
-		 */
150
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
151
-
152
-		/**
153
-		 * The Schema service.
154
-		 */
155
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
156
-
157
-		/**
158
-		 * The Thumbnail service.
159
-		 */
160
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
161
-
162
-		/**
163
-		 * The Entity Types Taxonomy service.
164
-		 */
165
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
166
-
167
-		/**
168
-		 * The Entity service.
169
-		 */
170
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
171
-
172
-		/**
173
-		 * The Timeline service.
174
-		 */
175
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
176
-
177
-		/**
178
-		 * The class responsible for defining all actions that occur in the admin area.
179
-		 */
180
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
181
-
182
-		/**
183
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
184
-		 */
185
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
186
-
187
-		/**
188
-		 * The class responsible for defining all actions that occur in the public-facing
189
-		 * side of the site.
190
-		 */
191
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
192
-
193
-		/**
194
-		 * The Timeline shortcode.
195
-		 */
196
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
197
-
198
-		$this->loader = new Wordlift_Loader();
199
-
200
-		// Instantiate a global logger.
201
-		global $wl_logger;
202
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
203
-
204
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
205
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
206
-
207
-		// Create an instance of the Schema service.
208
-		new Wordlift_Schema_Service();
209
-
210
-		$this->entity_service = new Wordlift_Entity_Service();
211
-
212
-		// Create a new instance of the Timeline service and Timeline shortcode.
213
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
214
-
215
-		// Create an instance of the Timeline shortcode.
216
-		new Wordlift_Timeline_Shortcode();
217
-
218
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
219
-
220
-	}
221
-
222
-	/**
223
-	 * Define the locale for this plugin for internationalization.
224
-	 *
225
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
226
-	 * with WordPress.
227
-	 *
228
-	 * @since    1.0.0
229
-	 * @access   private
230
-	 */
231
-	private function set_locale() {
232
-
233
-		$plugin_i18n = new Wordlift_i18n();
234
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
235
-
236
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
237
-
238
-	}
239
-
240
-	/**
241
-	 * Register all of the hooks related to the admin area functionality
242
-	 * of the plugin.
243
-	 *
244
-	 * @since    1.0.0
245
-	 * @access   private
246
-	 */
247
-	private function define_admin_hooks() {
248
-
249
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
250
-
251
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
252
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
253
-
254
-		// Hook the deleted_post_meta action to the Thumbnail service.
255
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
256
-
257
-		// Hook the added_post_meta action to the Thumbnail service.
258
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 );
259
-
260
-		// Hook the AJAX wl_timeline action to the Timeline service.
261
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
262
-
263
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
264
-
265
-	}
266
-
267
-	/**
268
-	 * Register all of the hooks related to the public-facing functionality
269
-	 * of the plugin.
270
-	 *
271
-	 * @since    1.0.0
272
-	 * @access   private
273
-	 */
274
-	private function define_public_hooks() {
275
-
276
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
277
-
278
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
279
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
280
-
281
-		// Hook the AJAX wl_timeline action to the Timeline service.
282
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
283
-
284
-	}
285
-
286
-	/**
287
-	 * Run the loader to execute all of the hooks with WordPress.
288
-	 *
289
-	 * @since    1.0.0
290
-	 */
291
-	public function run() {
292
-		$this->loader->run();
293
-	}
294
-
295
-	/**
296
-	 * The name of the plugin used to uniquely identify it within the context of
297
-	 * WordPress and to define internationalization functionality.
298
-	 *
299
-	 * @since     1.0.0
300
-	 * @return    string    The name of the plugin.
301
-	 */
302
-	public function get_plugin_name() {
303
-		return $this->plugin_name;
304
-	}
305
-
306
-	/**
307
-	 * The reference to the class that orchestrates the hooks with the plugin.
308
-	 *
309
-	 * @since     1.0.0
310
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
311
-	 */
312
-	public function get_loader() {
313
-		return $this->loader;
314
-	}
315
-
316
-	/**
317
-	 * Retrieve the version number of the plugin.
318
-	 *
319
-	 * @since     1.0.0
320
-	 * @return    string    The version number of the plugin.
321
-	 */
322
-	public function get_version() {
323
-		return $this->version;
324
-	}
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 Timeline service.
80
+     *
81
+     * @since 3.1.0
82
+     * @access private
83
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
84
+     */
85
+    private $timeline_service;
86
+
87
+    /**
88
+     * The Entity Types Taxonomy Walker.
89
+     *
90
+     * @since 3.1.0
91
+     * @access private
92
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
93
+     */
94
+    private $entity_types_taxonomy_walker;
95
+
96
+    /**
97
+     * Define the core functionality of the plugin.
98
+     *
99
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
100
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
101
+     * the public-facing side of the site.
102
+     *
103
+     * @since    1.0.0
104
+     */
105
+    public function __construct() {
106
+
107
+        $this->plugin_name = 'wordlift';
108
+        $this->version     = '3.1.6';
109
+
110
+        $this->load_dependencies();
111
+        $this->set_locale();
112
+        $this->define_admin_hooks();
113
+        $this->define_public_hooks();
114
+
115
+    }
116
+
117
+    /**
118
+     * Load the required dependencies for this plugin.
119
+     *
120
+     * Include the following files that make up the plugin:
121
+     *
122
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
123
+     * - Wordlift_i18n. Defines internationalization functionality.
124
+     * - Wordlift_Admin. Defines all hooks for the admin area.
125
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
126
+     *
127
+     * Create an instance of the loader which will be used to register the hooks
128
+     * with WordPress.
129
+     *
130
+     * @since    1.0.0
131
+     * @access   private
132
+     */
133
+    private function load_dependencies() {
134
+
135
+        /**
136
+         * The class responsible for orchestrating the actions and filters of the
137
+         * core plugin.
138
+         */
139
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
140
+
141
+        /**
142
+         * The class responsible for defining internationalization functionality
143
+         * of the plugin.
144
+         */
145
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
146
+
147
+        /**
148
+         * The Log service.
149
+         */
150
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
151
+
152
+        /**
153
+         * The Schema service.
154
+         */
155
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
156
+
157
+        /**
158
+         * The Thumbnail service.
159
+         */
160
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
161
+
162
+        /**
163
+         * The Entity Types Taxonomy service.
164
+         */
165
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
166
+
167
+        /**
168
+         * The Entity service.
169
+         */
170
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
171
+
172
+        /**
173
+         * The Timeline service.
174
+         */
175
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
176
+
177
+        /**
178
+         * The class responsible for defining all actions that occur in the admin area.
179
+         */
180
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
181
+
182
+        /**
183
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
184
+         */
185
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
186
+
187
+        /**
188
+         * The class responsible for defining all actions that occur in the public-facing
189
+         * side of the site.
190
+         */
191
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
192
+
193
+        /**
194
+         * The Timeline shortcode.
195
+         */
196
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
197
+
198
+        $this->loader = new Wordlift_Loader();
199
+
200
+        // Instantiate a global logger.
201
+        global $wl_logger;
202
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
203
+
204
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
205
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
206
+
207
+        // Create an instance of the Schema service.
208
+        new Wordlift_Schema_Service();
209
+
210
+        $this->entity_service = new Wordlift_Entity_Service();
211
+
212
+        // Create a new instance of the Timeline service and Timeline shortcode.
213
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
214
+
215
+        // Create an instance of the Timeline shortcode.
216
+        new Wordlift_Timeline_Shortcode();
217
+
218
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
219
+
220
+    }
221
+
222
+    /**
223
+     * Define the locale for this plugin for internationalization.
224
+     *
225
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
226
+     * with WordPress.
227
+     *
228
+     * @since    1.0.0
229
+     * @access   private
230
+     */
231
+    private function set_locale() {
232
+
233
+        $plugin_i18n = new Wordlift_i18n();
234
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
235
+
236
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
237
+
238
+    }
239
+
240
+    /**
241
+     * Register all of the hooks related to the admin area functionality
242
+     * of the plugin.
243
+     *
244
+     * @since    1.0.0
245
+     * @access   private
246
+     */
247
+    private function define_admin_hooks() {
248
+
249
+        $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
250
+
251
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
252
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
253
+
254
+        // Hook the deleted_post_meta action to the Thumbnail service.
255
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
256
+
257
+        // Hook the added_post_meta action to the Thumbnail service.
258
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 );
259
+
260
+        // Hook the AJAX wl_timeline action to the Timeline service.
261
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
262
+
263
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
264
+
265
+    }
266
+
267
+    /**
268
+     * Register all of the hooks related to the public-facing functionality
269
+     * of the plugin.
270
+     *
271
+     * @since    1.0.0
272
+     * @access   private
273
+     */
274
+    private function define_public_hooks() {
275
+
276
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
277
+
278
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
279
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
280
+
281
+        // Hook the AJAX wl_timeline action to the Timeline service.
282
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
283
+
284
+    }
285
+
286
+    /**
287
+     * Run the loader to execute all of the hooks with WordPress.
288
+     *
289
+     * @since    1.0.0
290
+     */
291
+    public function run() {
292
+        $this->loader->run();
293
+    }
294
+
295
+    /**
296
+     * The name of the plugin used to uniquely identify it within the context of
297
+     * WordPress and to define internationalization functionality.
298
+     *
299
+     * @since     1.0.0
300
+     * @return    string    The name of the plugin.
301
+     */
302
+    public function get_plugin_name() {
303
+        return $this->plugin_name;
304
+    }
305
+
306
+    /**
307
+     * The reference to the class that orchestrates the hooks with the plugin.
308
+     *
309
+     * @since     1.0.0
310
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
311
+     */
312
+    public function get_loader() {
313
+        return $this->loader;
314
+    }
315
+
316
+    /**
317
+     * Retrieve the version number of the plugin.
318
+     *
319
+     * @since     1.0.0
320
+     * @return    string    The version number of the plugin.
321
+     */
322
+    public function get_version() {
323
+        return $this->version;
324
+    }
325 325
 
326 326
 }
Please login to merge, or discard this patch.