@@ -13,179 +13,179 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class Wordlift_Entity_List_Service { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Size of the entity thumbnail in pixels |
|
| 18 | - * |
|
| 19 | - * @since 3.3.0 |
|
| 20 | - */ |
|
| 21 | - const THUMB_SIZE = 50; |
|
| 16 | + /** |
|
| 17 | + * Size of the entity thumbnail in pixels |
|
| 18 | + * |
|
| 19 | + * @since 3.3.0 |
|
| 20 | + */ |
|
| 21 | + const THUMB_SIZE = 50; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * The Entity service. |
|
| 25 | - * |
|
| 26 | - * @since 3.3.0 |
|
| 27 | - * @access private |
|
| 28 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 29 | - */ |
|
| 30 | - private $entity_service; |
|
| 23 | + /** |
|
| 24 | + * The Entity service. |
|
| 25 | + * |
|
| 26 | + * @since 3.3.0 |
|
| 27 | + * @access private |
|
| 28 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 29 | + */ |
|
| 30 | + private $entity_service; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Create a Wordlift_Entity_List_Service. |
|
| 34 | - * |
|
| 35 | - * @since 3.3.0 |
|
| 36 | - * |
|
| 37 | - * @param \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 38 | - */ |
|
| 39 | - public function __construct( $entity_service ) { |
|
| 32 | + /** |
|
| 33 | + * Create a Wordlift_Entity_List_Service. |
|
| 34 | + * |
|
| 35 | + * @since 3.3.0 |
|
| 36 | + * |
|
| 37 | + * @param \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 38 | + */ |
|
| 39 | + public function __construct( $entity_service ) { |
|
| 40 | 40 | |
| 41 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_List_Service' ); |
|
| 41 | + $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_List_Service' ); |
|
| 42 | 42 | |
| 43 | - $this->entity_service = $entity_service; |
|
| 43 | + $this->entity_service = $entity_service; |
|
| 44 | 44 | |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Register custom columns for entity listing in backend |
|
| 49 | - * @see https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column |
|
| 50 | - * |
|
| 51 | - * @since 3.3.0 |
|
| 52 | - * |
|
| 53 | - * @param array $columns the default columns. |
|
| 54 | - * |
|
| 55 | - * @return array Enhanced columns array. |
|
| 56 | - */ |
|
| 57 | - public function register_custom_columns( $columns ) { |
|
| 47 | + /** |
|
| 48 | + * Register custom columns for entity listing in backend |
|
| 49 | + * @see https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column |
|
| 50 | + * |
|
| 51 | + * @since 3.3.0 |
|
| 52 | + * |
|
| 53 | + * @param array $columns the default columns. |
|
| 54 | + * |
|
| 55 | + * @return array Enhanced columns array. |
|
| 56 | + */ |
|
| 57 | + public function register_custom_columns( $columns ) { |
|
| 58 | 58 | |
| 59 | - // Take away first column and keep a reference, |
|
| 60 | - // so we can later insert the thumbnail between the first and the rest of columns. |
|
| 61 | - $columns_cb = $columns['cb']; |
|
| 62 | - unset( $columns['cb'] ); |
|
| 59 | + // Take away first column and keep a reference, |
|
| 60 | + // so we can later insert the thumbnail between the first and the rest of columns. |
|
| 61 | + $columns_cb = $columns['cb']; |
|
| 62 | + unset( $columns['cb'] ); |
|
| 63 | 63 | |
| 64 | - // Thumbnails column is inserted in second place, while the related posts on the end. |
|
| 65 | - $columns = array_merge( |
|
| 66 | - array( 'cb' => $columns_cb ), // re-add first column |
|
| 67 | - array( 'wl_column_thumbnail' => __( 'Image', 'wordlift' ) ), // thumb |
|
| 68 | - $columns, // default columns (without the first) |
|
| 69 | - array( 'wl_column_related_posts' => __( 'Related Posts', 'wordlift' ) ), // related posts |
|
| 70 | - array( 'wl_column_rating' => __( 'Rating', 'wordlift' ) ) // related posts |
|
| 71 | - ); |
|
| 64 | + // Thumbnails column is inserted in second place, while the related posts on the end. |
|
| 65 | + $columns = array_merge( |
|
| 66 | + array( 'cb' => $columns_cb ), // re-add first column |
|
| 67 | + array( 'wl_column_thumbnail' => __( 'Image', 'wordlift' ) ), // thumb |
|
| 68 | + $columns, // default columns (without the first) |
|
| 69 | + array( 'wl_column_related_posts' => __( 'Related Posts', 'wordlift' ) ), // related posts |
|
| 70 | + array( 'wl_column_rating' => __( 'Rating', 'wordlift' ) ) // related posts |
|
| 71 | + ); |
|
| 72 | 72 | |
| 73 | - return $columns; |
|
| 74 | - } |
|
| 73 | + return $columns; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Render custom columns |
|
| 78 | - * @see https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column |
|
| 79 | - * |
|
| 80 | - * @since 3.3.0 |
|
| 81 | - * |
|
| 82 | - * @param string $column the current column. |
|
| 83 | - * @param int $entity_id An entity post id. |
|
| 84 | - * |
|
| 85 | - * @return true if the post is an entity otherwise false. |
|
| 86 | - */ |
|
| 87 | - public function render_custom_columns( $column, $entity_id ) { |
|
| 76 | + /** |
|
| 77 | + * Render custom columns |
|
| 78 | + * @see https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column |
|
| 79 | + * |
|
| 80 | + * @since 3.3.0 |
|
| 81 | + * |
|
| 82 | + * @param string $column the current column. |
|
| 83 | + * @param int $entity_id An entity post id. |
|
| 84 | + * |
|
| 85 | + * @return true if the post is an entity otherwise false. |
|
| 86 | + */ |
|
| 87 | + public function render_custom_columns( $column, $entity_id ) { |
|
| 88 | 88 | |
| 89 | - switch ( $column ) { |
|
| 89 | + switch ( $column ) { |
|
| 90 | 90 | |
| 91 | - case 'wl_column_related_posts': |
|
| 92 | - echo count( wl_core_get_related_post_ids( $entity_id ) ); |
|
| 93 | - break; |
|
| 91 | + case 'wl_column_related_posts': |
|
| 92 | + echo count( wl_core_get_related_post_ids( $entity_id ) ); |
|
| 93 | + break; |
|
| 94 | 94 | |
| 95 | - case 'wl_column_thumbnail': |
|
| 95 | + case 'wl_column_thumbnail': |
|
| 96 | 96 | |
| 97 | - $edit_link = get_edit_post_link( $entity_id ); |
|
| 98 | - $thumb = get_the_post_thumbnail( $entity_id, array( self::THUMB_SIZE, self::THUMB_SIZE ) ); |
|
| 97 | + $edit_link = get_edit_post_link( $entity_id ); |
|
| 98 | + $thumb = get_the_post_thumbnail( $entity_id, array( self::THUMB_SIZE, self::THUMB_SIZE ) ); |
|
| 99 | 99 | |
| 100 | - if( ! $thumb ) { |
|
| 101 | - $thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />"; |
|
| 102 | - } |
|
| 103 | - echo "<a href='$edit_link'>$thumb</a>"; |
|
| 104 | - break; |
|
| 100 | + if( ! $thumb ) { |
|
| 101 | + $thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />"; |
|
| 102 | + } |
|
| 103 | + echo "<a href='$edit_link'>$thumb</a>"; |
|
| 104 | + break; |
|
| 105 | 105 | |
| 106 | - case 'wl_column_rating': |
|
| 106 | + case 'wl_column_rating': |
|
| 107 | 107 | |
| 108 | - $rating = $this->entity_service->get_rating_for( $entity_id ); |
|
| 109 | - echo '<i class="wl-traffic-light wl-tl-'. $rating[ 'traffic_light_score' ] . '">' . $rating[ 'percentage_score' ] . '%</i>'; |
|
| 110 | - break; |
|
| 111 | - } |
|
| 108 | + $rating = $this->entity_service->get_rating_for( $entity_id ); |
|
| 109 | + echo '<i class="wl-traffic-light wl-tl-'. $rating[ 'traffic_light_score' ] . '">' . $rating[ 'percentage_score' ] . '%</i>'; |
|
| 110 | + break; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Add wl-classification-scope select box before the 'Filter' button. |
|
| 117 | - * |
|
| 118 | - * @since 3.3.0 |
|
| 119 | - */ |
|
| 120 | - public function restrict_manage_posts_classification_scope() { |
|
| 115 | + /** |
|
| 116 | + * Add wl-classification-scope select box before the 'Filter' button. |
|
| 117 | + * |
|
| 118 | + * @since 3.3.0 |
|
| 119 | + */ |
|
| 120 | + public function restrict_manage_posts_classification_scope() { |
|
| 121 | 121 | |
| 122 | - // Only show on entity list page |
|
| 123 | - $screen = get_current_screen(); |
|
| 124 | - if( $screen->post_type !== Wordlift_Entity_Service::TYPE_NAME ){ |
|
| 125 | - return; |
|
| 126 | - } |
|
| 122 | + // Only show on entity list page |
|
| 123 | + $screen = get_current_screen(); |
|
| 124 | + if( $screen->post_type !== Wordlift_Entity_Service::TYPE_NAME ){ |
|
| 125 | + return; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - // Was a W already selected? |
|
| 129 | - $selected = isset( $_GET['wl-classification-scope'] ) ? $_GET['wl-classification-scope'] : '' ; |
|
| 128 | + // Was a W already selected? |
|
| 129 | + $selected = isset( $_GET['wl-classification-scope'] ) ? $_GET['wl-classification-scope'] : '' ; |
|
| 130 | 130 | |
| 131 | - // Print select box with the 4W |
|
| 132 | - $all_w = array( |
|
| 133 | - __( "All 'W'" ), |
|
| 134 | - WL_WHAT_RELATION, |
|
| 135 | - WL_WHO_RELATION, |
|
| 136 | - WL_WHERE_RELATION, |
|
| 137 | - WL_WHEN_RELATION |
|
| 138 | - ); |
|
| 139 | - echo '<select name="wl-classification-scope" id="wl-dropdown-classification-scope">'; |
|
| 140 | - foreach ( $all_w as $w ) { |
|
| 141 | - $default = ( $selected === $w ) ? 'selected' : ''; |
|
| 142 | - echo sprintf( '<option value="%s" %s >%s</option>', $w, $default, __( $w ) ); |
|
| 143 | - } |
|
| 144 | - echo '</select>'; |
|
| 145 | - } |
|
| 131 | + // Print select box with the 4W |
|
| 132 | + $all_w = array( |
|
| 133 | + __( "All 'W'" ), |
|
| 134 | + WL_WHAT_RELATION, |
|
| 135 | + WL_WHO_RELATION, |
|
| 136 | + WL_WHERE_RELATION, |
|
| 137 | + WL_WHEN_RELATION |
|
| 138 | + ); |
|
| 139 | + echo '<select name="wl-classification-scope" id="wl-dropdown-classification-scope">'; |
|
| 140 | + foreach ( $all_w as $w ) { |
|
| 141 | + $default = ( $selected === $w ) ? 'selected' : ''; |
|
| 142 | + echo sprintf( '<option value="%s" %s >%s</option>', $w, $default, __( $w ) ); |
|
| 143 | + } |
|
| 144 | + echo '</select>'; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * Server side response operations for the classification filter set in *restrict_manage_posts_classification_scope_filter* |
|
| 149 | - * |
|
| 150 | - * @since 3.3.0 |
|
| 151 | - * |
|
| 152 | - * @param array $clauses WP main query clauses. |
|
| 153 | - * |
|
| 154 | - * @return array Modified clauses. |
|
| 155 | - */ |
|
| 156 | - public function posts_clauses_classification_scope( $clauses ) { |
|
| 147 | + /** |
|
| 148 | + * Server side response operations for the classification filter set in *restrict_manage_posts_classification_scope_filter* |
|
| 149 | + * |
|
| 150 | + * @since 3.3.0 |
|
| 151 | + * |
|
| 152 | + * @param array $clauses WP main query clauses. |
|
| 153 | + * |
|
| 154 | + * @return array Modified clauses. |
|
| 155 | + */ |
|
| 156 | + public function posts_clauses_classification_scope( $clauses ) { |
|
| 157 | 157 | |
| 158 | - // Run only on admin page |
|
| 159 | - if( ! is_admin() ) { |
|
| 160 | - return $clauses; |
|
| 161 | - } |
|
| 158 | + // Run only on admin page |
|
| 159 | + if( ! is_admin() ) { |
|
| 160 | + return $clauses; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - // Only apply on entity list page, only if this is the main query and if the wl-classification-scope query param is set |
|
| 164 | - $screen = get_current_screen(); |
|
| 165 | - if( ! ( $screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset( $_GET['wl-classification-scope'] ) ) ) { |
|
| 166 | - return $clauses; |
|
| 167 | - } |
|
| 163 | + // Only apply on entity list page, only if this is the main query and if the wl-classification-scope query param is set |
|
| 164 | + $screen = get_current_screen(); |
|
| 165 | + if( ! ( $screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset( $_GET['wl-classification-scope'] ) ) ) { |
|
| 166 | + return $clauses; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - // Check a valid W was requested |
|
| 170 | - $requested_w = $_GET['wl-classification-scope']; |
|
| 171 | - $all_w = array( |
|
| 172 | - WL_WHAT_RELATION, |
|
| 173 | - WL_WHO_RELATION, |
|
| 174 | - WL_WHERE_RELATION, |
|
| 175 | - WL_WHEN_RELATION |
|
| 176 | - ); |
|
| 177 | - if ( ! in_array( $requested_w, $all_w ) ) { |
|
| 178 | - return $clauses; |
|
| 179 | - } |
|
| 169 | + // Check a valid W was requested |
|
| 170 | + $requested_w = $_GET['wl-classification-scope']; |
|
| 171 | + $all_w = array( |
|
| 172 | + WL_WHAT_RELATION, |
|
| 173 | + WL_WHO_RELATION, |
|
| 174 | + WL_WHERE_RELATION, |
|
| 175 | + WL_WHEN_RELATION |
|
| 176 | + ); |
|
| 177 | + if ( ! in_array( $requested_w, $all_w ) ) { |
|
| 178 | + return $clauses; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - global $wpdb; |
|
| 182 | - $wl_relation_table = wl_core_get_relation_instances_table_name(); |
|
| 181 | + global $wpdb; |
|
| 182 | + $wl_relation_table = wl_core_get_relation_instances_table_name(); |
|
| 183 | 183 | |
| 184 | - // Change WP main query clauses |
|
| 185 | - $clauses['join'] .= "INNER JOIN {$wl_relation_table} ON {$wpdb->posts}.ID = {$wl_relation_table}.object_id"; |
|
| 186 | - $clauses['where'] .= $wpdb->prepare( "AND {$wl_relation_table}.predicate = %s", $requested_w ); |
|
| 187 | - $clauses['distinct'] .= "DISTINCT"; |
|
| 184 | + // Change WP main query clauses |
|
| 185 | + $clauses['join'] .= "INNER JOIN {$wl_relation_table} ON {$wpdb->posts}.ID = {$wl_relation_table}.object_id"; |
|
| 186 | + $clauses['where'] .= $wpdb->prepare( "AND {$wl_relation_table}.predicate = %s", $requested_w ); |
|
| 187 | + $clauses['distinct'] .= "DISTINCT"; |
|
| 188 | 188 | |
| 189 | - return $clauses; |
|
| 190 | - } |
|
| 189 | + return $clauses; |
|
| 190 | + } |
|
| 191 | 191 | } |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param \Wordlift_Entity_Service $entity_service The Entity service. |
| 38 | 38 | */ |
| 39 | - public function __construct( $entity_service ) { |
|
| 39 | + public function __construct($entity_service) { |
|
| 40 | 40 | |
| 41 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_List_Service' ); |
|
| 41 | + $this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Entity_List_Service'); |
|
| 42 | 42 | |
| 43 | 43 | $this->entity_service = $entity_service; |
| 44 | 44 | |
@@ -54,20 +54,20 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return array Enhanced columns array. |
| 56 | 56 | */ |
| 57 | - public function register_custom_columns( $columns ) { |
|
| 57 | + public function register_custom_columns($columns) { |
|
| 58 | 58 | |
| 59 | 59 | // Take away first column and keep a reference, |
| 60 | 60 | // so we can later insert the thumbnail between the first and the rest of columns. |
| 61 | 61 | $columns_cb = $columns['cb']; |
| 62 | - unset( $columns['cb'] ); |
|
| 62 | + unset($columns['cb']); |
|
| 63 | 63 | |
| 64 | 64 | // Thumbnails column is inserted in second place, while the related posts on the end. |
| 65 | 65 | $columns = array_merge( |
| 66 | - array( 'cb' => $columns_cb ), // re-add first column |
|
| 67 | - array( 'wl_column_thumbnail' => __( 'Image', 'wordlift' ) ), // thumb |
|
| 68 | - $columns, // default columns (without the first) |
|
| 69 | - array( 'wl_column_related_posts' => __( 'Related Posts', 'wordlift' ) ), // related posts |
|
| 70 | - array( 'wl_column_rating' => __( 'Rating', 'wordlift' ) ) // related posts |
|
| 66 | + array('cb' => $columns_cb), // re-add first column |
|
| 67 | + array('wl_column_thumbnail' => __('Image', 'wordlift')), // thumb |
|
| 68 | + $columns, // default columns (without the first) |
|
| 69 | + array('wl_column_related_posts' => __('Related Posts', 'wordlift')), // related posts |
|
| 70 | + array('wl_column_rating' => __('Rating', 'wordlift')) // related posts |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | return $columns; |
@@ -84,29 +84,29 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return true if the post is an entity otherwise false. |
| 86 | 86 | */ |
| 87 | - public function render_custom_columns( $column, $entity_id ) { |
|
| 87 | + public function render_custom_columns($column, $entity_id) { |
|
| 88 | 88 | |
| 89 | - switch ( $column ) { |
|
| 89 | + switch ($column) { |
|
| 90 | 90 | |
| 91 | 91 | case 'wl_column_related_posts': |
| 92 | - echo count( wl_core_get_related_post_ids( $entity_id ) ); |
|
| 92 | + echo count(wl_core_get_related_post_ids($entity_id)); |
|
| 93 | 93 | break; |
| 94 | 94 | |
| 95 | 95 | case 'wl_column_thumbnail': |
| 96 | 96 | |
| 97 | - $edit_link = get_edit_post_link( $entity_id ); |
|
| 98 | - $thumb = get_the_post_thumbnail( $entity_id, array( self::THUMB_SIZE, self::THUMB_SIZE ) ); |
|
| 97 | + $edit_link = get_edit_post_link($entity_id); |
|
| 98 | + $thumb = get_the_post_thumbnail($entity_id, array(self::THUMB_SIZE, self::THUMB_SIZE)); |
|
| 99 | 99 | |
| 100 | - if( ! $thumb ) { |
|
| 101 | - $thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />"; |
|
| 100 | + if ( ! $thumb) { |
|
| 101 | + $thumb = "<img src='".WL_DEFAULT_THUMBNAIL_PATH."' width='".self::THUMB_SIZE."' />"; |
|
| 102 | 102 | } |
| 103 | 103 | echo "<a href='$edit_link'>$thumb</a>"; |
| 104 | 104 | break; |
| 105 | 105 | |
| 106 | 106 | case 'wl_column_rating': |
| 107 | 107 | |
| 108 | - $rating = $this->entity_service->get_rating_for( $entity_id ); |
|
| 109 | - echo '<i class="wl-traffic-light wl-tl-'. $rating[ 'traffic_light_score' ] . '">' . $rating[ 'percentage_score' ] . '%</i>'; |
|
| 108 | + $rating = $this->entity_service->get_rating_for($entity_id); |
|
| 109 | + echo '<i class="wl-traffic-light wl-tl-'.$rating['traffic_light_score'].'">'.$rating['percentage_score'].'%</i>'; |
|
| 110 | 110 | break; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -121,25 +121,25 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | // Only show on entity list page |
| 123 | 123 | $screen = get_current_screen(); |
| 124 | - if( $screen->post_type !== Wordlift_Entity_Service::TYPE_NAME ){ |
|
| 124 | + if ($screen->post_type !== Wordlift_Entity_Service::TYPE_NAME) { |
|
| 125 | 125 | return; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Was a W already selected? |
| 129 | - $selected = isset( $_GET['wl-classification-scope'] ) ? $_GET['wl-classification-scope'] : '' ; |
|
| 129 | + $selected = isset($_GET['wl-classification-scope']) ? $_GET['wl-classification-scope'] : ''; |
|
| 130 | 130 | |
| 131 | 131 | // Print select box with the 4W |
| 132 | 132 | $all_w = array( |
| 133 | - __( "All 'W'" ), |
|
| 133 | + __("All 'W'"), |
|
| 134 | 134 | WL_WHAT_RELATION, |
| 135 | 135 | WL_WHO_RELATION, |
| 136 | 136 | WL_WHERE_RELATION, |
| 137 | 137 | WL_WHEN_RELATION |
| 138 | 138 | ); |
| 139 | 139 | echo '<select name="wl-classification-scope" id="wl-dropdown-classification-scope">'; |
| 140 | - foreach ( $all_w as $w ) { |
|
| 141 | - $default = ( $selected === $w ) ? 'selected' : ''; |
|
| 142 | - echo sprintf( '<option value="%s" %s >%s</option>', $w, $default, __( $w ) ); |
|
| 140 | + foreach ($all_w as $w) { |
|
| 141 | + $default = ($selected === $w) ? 'selected' : ''; |
|
| 142 | + echo sprintf('<option value="%s" %s >%s</option>', $w, $default, __($w)); |
|
| 143 | 143 | } |
| 144 | 144 | echo '</select>'; |
| 145 | 145 | } |
@@ -153,16 +153,16 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @return array Modified clauses. |
| 155 | 155 | */ |
| 156 | - public function posts_clauses_classification_scope( $clauses ) { |
|
| 156 | + public function posts_clauses_classification_scope($clauses) { |
|
| 157 | 157 | |
| 158 | 158 | // Run only on admin page |
| 159 | - if( ! is_admin() ) { |
|
| 159 | + if ( ! is_admin()) { |
|
| 160 | 160 | return $clauses; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Only apply on entity list page, only if this is the main query and if the wl-classification-scope query param is set |
| 164 | 164 | $screen = get_current_screen(); |
| 165 | - if( ! ( $screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset( $_GET['wl-classification-scope'] ) ) ) { |
|
| 165 | + if ( ! ($screen->post_type === Wordlift_Entity_Service::TYPE_NAME && is_main_query() && isset($_GET['wl-classification-scope']))) { |
|
| 166 | 166 | return $clauses; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | WL_WHERE_RELATION, |
| 175 | 175 | WL_WHEN_RELATION |
| 176 | 176 | ); |
| 177 | - if ( ! in_array( $requested_w, $all_w ) ) { |
|
| 177 | + if ( ! in_array($requested_w, $all_w)) { |
|
| 178 | 178 | return $clauses; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | // Change WP main query clauses |
| 185 | 185 | $clauses['join'] .= "INNER JOIN {$wl_relation_table} ON {$wpdb->posts}.ID = {$wl_relation_table}.object_id"; |
| 186 | - $clauses['where'] .= $wpdb->prepare( "AND {$wl_relation_table}.predicate = %s", $requested_w ); |
|
| 186 | + $clauses['where'] .= $wpdb->prepare("AND {$wl_relation_table}.predicate = %s", $requested_w); |
|
| 187 | 187 | $clauses['distinct'] .= "DISTINCT"; |
| 188 | 188 | |
| 189 | 189 | return $clauses; |
@@ -29,462 +29,462 @@ |
||
| 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 User service. |
|
| 98 | - * |
|
| 99 | - * @since 3.1.7 |
|
| 100 | - * @access private |
|
| 101 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 102 | - */ |
|
| 103 | - private $user_service; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The Timeline service. |
|
| 107 | - * |
|
| 108 | - * @since 3.1.0 |
|
| 109 | - * @access private |
|
| 110 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 111 | - */ |
|
| 112 | - private $timeline_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The Redirect service. |
|
| 116 | - * |
|
| 117 | - * @since 3.2.0 |
|
| 118 | - * @access private |
|
| 119 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 120 | - */ |
|
| 121 | - private $redirect_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The Notice service. |
|
| 125 | - * |
|
| 126 | - * @since 3.3.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 129 | - */ |
|
| 130 | - private $notice_service; |
|
| 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 User service. |
|
| 98 | + * |
|
| 99 | + * @since 3.1.7 |
|
| 100 | + * @access private |
|
| 101 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 102 | + */ |
|
| 103 | + private $user_service; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The Timeline service. |
|
| 107 | + * |
|
| 108 | + * @since 3.1.0 |
|
| 109 | + * @access private |
|
| 110 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 111 | + */ |
|
| 112 | + private $timeline_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The Redirect service. |
|
| 116 | + * |
|
| 117 | + * @since 3.2.0 |
|
| 118 | + * @access private |
|
| 119 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 120 | + */ |
|
| 121 | + private $redirect_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The Notice service. |
|
| 125 | + * |
|
| 126 | + * @since 3.3.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 129 | + */ |
|
| 130 | + private $notice_service; |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * The Entity list customization. |
|
| 134 | - * |
|
| 135 | - * @since 3.3.0 |
|
| 136 | - * @access private |
|
| 137 | - * @var \Wordlift_List_Service $entity_list_service The Entity list service. |
|
| 138 | - */ |
|
| 139 | - private $entity_list_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Entity Types Taxonomy Walker. |
|
| 143 | - * |
|
| 144 | - * @since 3.1.0 |
|
| 145 | - * @access private |
|
| 146 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 147 | - */ |
|
| 148 | - private $entity_types_taxonomy_walker; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The ShareThis service. |
|
| 152 | - * |
|
| 153 | - * @since 3.2.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 156 | - */ |
|
| 157 | - private $sharethis_service; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The PrimaShop adapter. |
|
| 161 | - * |
|
| 162 | - * @since 3.2.3 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 165 | - */ |
|
| 166 | - private $primashop_adapter; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Define the core functionality of the plugin. |
|
| 170 | - * |
|
| 171 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 172 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 173 | - * the public-facing side of the site. |
|
| 174 | - * |
|
| 175 | - * @since 1.0.0 |
|
| 176 | - */ |
|
| 177 | - public function __construct() { |
|
| 178 | - |
|
| 179 | - $this->plugin_name = 'wordlift'; |
|
| 180 | - |
|
| 181 | - $this->version = '3.3.0-dev'; |
|
| 182 | - |
|
| 183 | - $this->load_dependencies(); |
|
| 184 | - $this->set_locale(); |
|
| 185 | - $this->define_admin_hooks(); |
|
| 186 | - $this->define_public_hooks(); |
|
| 187 | - |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * Load the required dependencies for this plugin. |
|
| 192 | - * |
|
| 193 | - * Include the following files that make up the plugin: |
|
| 194 | - * |
|
| 195 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 196 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 197 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 198 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 199 | - * |
|
| 200 | - * Create an instance of the loader which will be used to register the hooks |
|
| 201 | - * with WordPress. |
|
| 202 | - * |
|
| 203 | - * @since 1.0.0 |
|
| 204 | - * @access private |
|
| 205 | - */ |
|
| 206 | - private function load_dependencies() { |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * The class responsible for orchestrating the actions and filters of the |
|
| 210 | - * core plugin. |
|
| 211 | - */ |
|
| 212 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * The class responsible for defining internationalization functionality |
|
| 216 | - * of the plugin. |
|
| 217 | - */ |
|
| 218 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 219 | - |
|
| 220 | - /** |
|
| 221 | - * The Redirect service. |
|
| 222 | - */ |
|
| 223 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * The Log service. |
|
| 227 | - */ |
|
| 228 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * The Query builder. |
|
| 232 | - */ |
|
| 233 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * The Schema service. |
|
| 237 | - */ |
|
| 238 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * The UI service. |
|
| 242 | - */ |
|
| 243 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * The Thumbnail service. |
|
| 247 | - */ |
|
| 248 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * The Entity Types Taxonomy service. |
|
| 252 | - */ |
|
| 253 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 254 | - |
|
| 255 | - /** |
|
| 256 | - * The Entity service. |
|
| 257 | - */ |
|
| 258 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * The User service. |
|
| 262 | - */ |
|
| 263 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * The Timeline service. |
|
| 267 | - */ |
|
| 268 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 269 | - |
|
| 270 | - /** |
|
| 271 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 272 | - */ |
|
| 273 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 132 | + /** |
|
| 133 | + * The Entity list customization. |
|
| 134 | + * |
|
| 135 | + * @since 3.3.0 |
|
| 136 | + * @access private |
|
| 137 | + * @var \Wordlift_List_Service $entity_list_service The Entity list service. |
|
| 138 | + */ |
|
| 139 | + private $entity_list_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Entity Types Taxonomy Walker. |
|
| 143 | + * |
|
| 144 | + * @since 3.1.0 |
|
| 145 | + * @access private |
|
| 146 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 147 | + */ |
|
| 148 | + private $entity_types_taxonomy_walker; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The ShareThis service. |
|
| 152 | + * |
|
| 153 | + * @since 3.2.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 156 | + */ |
|
| 157 | + private $sharethis_service; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The PrimaShop adapter. |
|
| 161 | + * |
|
| 162 | + * @since 3.2.3 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 165 | + */ |
|
| 166 | + private $primashop_adapter; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Define the core functionality of the plugin. |
|
| 170 | + * |
|
| 171 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 172 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 173 | + * the public-facing side of the site. |
|
| 174 | + * |
|
| 175 | + * @since 1.0.0 |
|
| 176 | + */ |
|
| 177 | + public function __construct() { |
|
| 178 | + |
|
| 179 | + $this->plugin_name = 'wordlift'; |
|
| 180 | + |
|
| 181 | + $this->version = '3.3.0-dev'; |
|
| 182 | + |
|
| 183 | + $this->load_dependencies(); |
|
| 184 | + $this->set_locale(); |
|
| 185 | + $this->define_admin_hooks(); |
|
| 186 | + $this->define_public_hooks(); |
|
| 187 | + |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * Load the required dependencies for this plugin. |
|
| 192 | + * |
|
| 193 | + * Include the following files that make up the plugin: |
|
| 194 | + * |
|
| 195 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 196 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 197 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 198 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 199 | + * |
|
| 200 | + * Create an instance of the loader which will be used to register the hooks |
|
| 201 | + * with WordPress. |
|
| 202 | + * |
|
| 203 | + * @since 1.0.0 |
|
| 204 | + * @access private |
|
| 205 | + */ |
|
| 206 | + private function load_dependencies() { |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * The class responsible for orchestrating the actions and filters of the |
|
| 210 | + * core plugin. |
|
| 211 | + */ |
|
| 212 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * The class responsible for defining internationalization functionality |
|
| 216 | + * of the plugin. |
|
| 217 | + */ |
|
| 218 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 219 | + |
|
| 220 | + /** |
|
| 221 | + * The Redirect service. |
|
| 222 | + */ |
|
| 223 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * The Log service. |
|
| 227 | + */ |
|
| 228 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * The Query builder. |
|
| 232 | + */ |
|
| 233 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * The Schema service. |
|
| 237 | + */ |
|
| 238 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * The UI service. |
|
| 242 | + */ |
|
| 243 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * The Thumbnail service. |
|
| 247 | + */ |
|
| 248 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * The Entity Types Taxonomy service. |
|
| 252 | + */ |
|
| 253 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * The Entity service. |
|
| 257 | + */ |
|
| 258 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * The User service. |
|
| 262 | + */ |
|
| 263 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * The Timeline service. |
|
| 267 | + */ |
|
| 268 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 269 | + |
|
| 270 | + /** |
|
| 271 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 272 | + */ |
|
| 273 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 274 | 274 | |
| 275 | - /** |
|
| 276 | - * The class to customize the entity list admin page. |
|
| 277 | - */ |
|
| 278 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 275 | + /** |
|
| 276 | + * The class to customize the entity list admin page. |
|
| 277 | + */ |
|
| 278 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 279 | 279 | |
| 280 | - /** |
|
| 281 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 282 | - */ |
|
| 283 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 280 | + /** |
|
| 281 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 282 | + */ |
|
| 283 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 284 | 284 | |
| 285 | - /** |
|
| 286 | - * The Notice service. |
|
| 287 | - */ |
|
| 288 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 285 | + /** |
|
| 286 | + * The Notice service. |
|
| 287 | + */ |
|
| 288 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * The PrimaShop adapter. |
|
| 292 | - */ |
|
| 293 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 290 | + /** |
|
| 291 | + * The PrimaShop adapter. |
|
| 292 | + */ |
|
| 293 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 297 | - * side of the site. |
|
| 298 | - */ |
|
| 299 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 295 | + /** |
|
| 296 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 297 | + * side of the site. |
|
| 298 | + */ |
|
| 299 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 300 | 300 | |
| 301 | - /** |
|
| 302 | - * The Timeline shortcode. |
|
| 303 | - */ |
|
| 304 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 301 | + /** |
|
| 302 | + * The Timeline shortcode. |
|
| 303 | + */ |
|
| 304 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 305 | 305 | |
| 306 | - /** |
|
| 307 | - * The ShareThis service. |
|
| 308 | - */ |
|
| 309 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 306 | + /** |
|
| 307 | + * The ShareThis service. |
|
| 308 | + */ |
|
| 309 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 310 | 310 | |
| 311 | - $this->loader = new Wordlift_Loader(); |
|
| 311 | + $this->loader = new Wordlift_Loader(); |
|
| 312 | 312 | |
| 313 | - // Instantiate a global logger. |
|
| 314 | - global $wl_logger; |
|
| 315 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 313 | + // Instantiate a global logger. |
|
| 314 | + global $wl_logger; |
|
| 315 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 316 | 316 | |
| 317 | - // Create an instance of the UI service. |
|
| 318 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 317 | + // Create an instance of the UI service. |
|
| 318 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 319 | 319 | |
| 320 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 321 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 320 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 321 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 322 | 322 | |
| 323 | - // Create an instance of the Schema service. |
|
| 324 | - $this->schema_service = new Wordlift_Schema_Service(); |
|
| 323 | + // Create an instance of the Schema service. |
|
| 324 | + $this->schema_service = new Wordlift_Schema_Service(); |
|
| 325 | 325 | |
| 326 | - // Create an instance of the Notice service. |
|
| 327 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 326 | + // Create an instance of the Notice service. |
|
| 327 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 328 | 328 | |
| 329 | - // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 330 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service ); |
|
| 329 | + // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 330 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service ); |
|
| 331 | 331 | |
| 332 | - // Create an instance of the User service. |
|
| 333 | - $this->user_service = new Wordlift_User_Service(); |
|
| 332 | + // Create an instance of the User service. |
|
| 333 | + $this->user_service = new Wordlift_User_Service(); |
|
| 334 | 334 | |
| 335 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 336 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 335 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 336 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 337 | 337 | |
| 338 | - // Create a new instance of the Redirect service. |
|
| 339 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 338 | + // Create a new instance of the Redirect service. |
|
| 339 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 340 | 340 | |
| 341 | - // Create an instance of the Timeline shortcode. |
|
| 342 | - new Wordlift_Timeline_Shortcode(); |
|
| 341 | + // Create an instance of the Timeline shortcode. |
|
| 342 | + new Wordlift_Timeline_Shortcode(); |
|
| 343 | 343 | |
| 344 | - // Create entity list customization (wp-admin/edit.php) |
|
| 345 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service ); |
|
| 344 | + // Create entity list customization (wp-admin/edit.php) |
|
| 345 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service ); |
|
| 346 | 346 | |
| 347 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 347 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 348 | 348 | |
| 349 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 350 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 349 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 350 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 351 | 351 | |
| 352 | - // Create an instance of the PrimaShop adapter. |
|
| 353 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 354 | - } |
|
| 352 | + // Create an instance of the PrimaShop adapter. |
|
| 353 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | - /** |
|
| 357 | - * Define the locale for this plugin for internationalization. |
|
| 358 | - * |
|
| 359 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 360 | - * with WordPress. |
|
| 361 | - * |
|
| 362 | - * @since 1.0.0 |
|
| 363 | - * @access private |
|
| 364 | - */ |
|
| 365 | - private function set_locale() { |
|
| 356 | + /** |
|
| 357 | + * Define the locale for this plugin for internationalization. |
|
| 358 | + * |
|
| 359 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 360 | + * with WordPress. |
|
| 361 | + * |
|
| 362 | + * @since 1.0.0 |
|
| 363 | + * @access private |
|
| 364 | + */ |
|
| 365 | + private function set_locale() { |
|
| 366 | 366 | |
| 367 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 368 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 367 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 368 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 369 | 369 | |
| 370 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 370 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 371 | 371 | |
| 372 | - } |
|
| 372 | + } |
|
| 373 | 373 | |
| 374 | - /** |
|
| 375 | - * Register all of the hooks related to the admin area functionality |
|
| 376 | - * of the plugin. |
|
| 377 | - * |
|
| 378 | - * @since 1.0.0 |
|
| 379 | - * @access private |
|
| 380 | - */ |
|
| 381 | - private function define_admin_hooks() { |
|
| 374 | + /** |
|
| 375 | + * Register all of the hooks related to the admin area functionality |
|
| 376 | + * of the plugin. |
|
| 377 | + * |
|
| 378 | + * @since 1.0.0 |
|
| 379 | + * @access private |
|
| 380 | + */ |
|
| 381 | + private function define_admin_hooks() { |
|
| 382 | 382 | |
| 383 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 383 | + $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 384 | 384 | |
| 385 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 386 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 385 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 386 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 387 | 387 | |
| 388 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 389 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 388 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 389 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 390 | 390 | |
| 391 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 392 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 ); |
|
| 391 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 392 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 ); |
|
| 393 | 393 | |
| 394 | - // Hook posts inserts (or updates) to the user service. |
|
| 395 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 394 | + // Hook posts inserts (or updates) to the user service. |
|
| 395 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 396 | 396 | |
| 397 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 398 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 397 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 398 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 399 | 399 | |
| 400 | - // Register custom allowed redirect hosts. |
|
| 401 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 402 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 403 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 400 | + // Register custom allowed redirect hosts. |
|
| 401 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 402 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 403 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 404 | 404 | |
| 405 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 406 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 407 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 408 | - $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 ); |
|
| 405 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 406 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 407 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 408 | + $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 ); |
|
| 409 | 409 | |
| 410 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 411 | - $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' ); |
|
| 412 | - |
|
| 413 | - // Entity listing customization (wp-admin/edit.php) |
|
| 414 | - // Add custom columns |
|
| 415 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 416 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 417 | - // Add 4W selection |
|
| 418 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 419 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 410 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 411 | + $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' ); |
|
| 412 | + |
|
| 413 | + // Entity listing customization (wp-admin/edit.php) |
|
| 414 | + // Add custom columns |
|
| 415 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 416 | + $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 417 | + // Add 4W selection |
|
| 418 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 419 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 420 | 420 | |
| 421 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 422 | - |
|
| 423 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 424 | - // entities. |
|
| 425 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - /** |
|
| 429 | - * Register all of the hooks related to the public-facing functionality |
|
| 430 | - * of the plugin. |
|
| 431 | - * |
|
| 432 | - * @since 1.0.0 |
|
| 433 | - * @access private |
|
| 434 | - */ |
|
| 435 | - private function define_public_hooks() { |
|
| 436 | - |
|
| 437 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 438 | - |
|
| 439 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 440 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 441 | - |
|
| 442 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 443 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 444 | - |
|
| 445 | - // Hook the ShareThis service. |
|
| 446 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 447 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - /** |
|
| 451 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 452 | - * |
|
| 453 | - * @since 1.0.0 |
|
| 454 | - */ |
|
| 455 | - public function run() { |
|
| 456 | - $this->loader->run(); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - /** |
|
| 460 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 461 | - * WordPress and to define internationalization functionality. |
|
| 462 | - * |
|
| 463 | - * @since 1.0.0 |
|
| 464 | - * @return string The name of the plugin. |
|
| 465 | - */ |
|
| 466 | - public function get_plugin_name() { |
|
| 467 | - return $this->plugin_name; |
|
| 468 | - } |
|
| 469 | - |
|
| 470 | - /** |
|
| 471 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 472 | - * |
|
| 473 | - * @since 1.0.0 |
|
| 474 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 475 | - */ |
|
| 476 | - public function get_loader() { |
|
| 477 | - return $this->loader; |
|
| 478 | - } |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * Retrieve the version number of the plugin. |
|
| 482 | - * |
|
| 483 | - * @since 1.0.0 |
|
| 484 | - * @return string The version number of the plugin. |
|
| 485 | - */ |
|
| 486 | - public function get_version() { |
|
| 487 | - return $this->version; |
|
| 488 | - } |
|
| 421 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 422 | + |
|
| 423 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 424 | + // entities. |
|
| 425 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + /** |
|
| 429 | + * Register all of the hooks related to the public-facing functionality |
|
| 430 | + * of the plugin. |
|
| 431 | + * |
|
| 432 | + * @since 1.0.0 |
|
| 433 | + * @access private |
|
| 434 | + */ |
|
| 435 | + private function define_public_hooks() { |
|
| 436 | + |
|
| 437 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 438 | + |
|
| 439 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 440 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 441 | + |
|
| 442 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 443 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 444 | + |
|
| 445 | + // Hook the ShareThis service. |
|
| 446 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 447 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + /** |
|
| 451 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 452 | + * |
|
| 453 | + * @since 1.0.0 |
|
| 454 | + */ |
|
| 455 | + public function run() { |
|
| 456 | + $this->loader->run(); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + /** |
|
| 460 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 461 | + * WordPress and to define internationalization functionality. |
|
| 462 | + * |
|
| 463 | + * @since 1.0.0 |
|
| 464 | + * @return string The name of the plugin. |
|
| 465 | + */ |
|
| 466 | + public function get_plugin_name() { |
|
| 467 | + return $this->plugin_name; |
|
| 468 | + } |
|
| 469 | + |
|
| 470 | + /** |
|
| 471 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 472 | + * |
|
| 473 | + * @since 1.0.0 |
|
| 474 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 475 | + */ |
|
| 476 | + public function get_loader() { |
|
| 477 | + return $this->loader; |
|
| 478 | + } |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * Retrieve the version number of the plugin. |
|
| 482 | + * |
|
| 483 | + * @since 1.0.0 |
|
| 484 | + * @return string The version number of the plugin. |
|
| 485 | + */ |
|
| 486 | + public function get_version() { |
|
| 487 | + return $this->version; |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | 490 | } |
@@ -209,110 +209,110 @@ discard block |
||
| 209 | 209 | * The class responsible for orchestrating the actions and filters of the |
| 210 | 210 | * core plugin. |
| 211 | 211 | */ |
| 212 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 212 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * The class responsible for defining internationalization functionality |
| 216 | 216 | * of the plugin. |
| 217 | 217 | */ |
| 218 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 218 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * The Redirect service. |
| 222 | 222 | */ |
| 223 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 223 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 224 | 224 | |
| 225 | 225 | /** |
| 226 | 226 | * The Log service. |
| 227 | 227 | */ |
| 228 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 228 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * The Query builder. |
| 232 | 232 | */ |
| 233 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 233 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * The Schema service. |
| 237 | 237 | */ |
| 238 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 238 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 239 | 239 | |
| 240 | 240 | /** |
| 241 | 241 | * The UI service. |
| 242 | 242 | */ |
| 243 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 243 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * The Thumbnail service. |
| 247 | 247 | */ |
| 248 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 248 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * The Entity Types Taxonomy service. |
| 252 | 252 | */ |
| 253 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 253 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * The Entity service. |
| 257 | 257 | */ |
| 258 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 258 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * The User service. |
| 262 | 262 | */ |
| 263 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 263 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * The Timeline service. |
| 267 | 267 | */ |
| 268 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 268 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | 271 | * The class responsible for defining all actions that occur in the admin area. |
| 272 | 272 | */ |
| 273 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 273 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | 276 | * The class to customize the entity list admin page. |
| 277 | 277 | */ |
| 278 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 278 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | 281 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 282 | 282 | */ |
| 283 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 283 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 284 | 284 | |
| 285 | 285 | /** |
| 286 | 286 | * The Notice service. |
| 287 | 287 | */ |
| 288 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 288 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | 291 | * The PrimaShop adapter. |
| 292 | 292 | */ |
| 293 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 293 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | 296 | * The class responsible for defining all actions that occur in the public-facing |
| 297 | 297 | * side of the site. |
| 298 | 298 | */ |
| 299 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 299 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * The Timeline shortcode. |
| 303 | 303 | */ |
| 304 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 304 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * The ShareThis service. |
| 308 | 308 | */ |
| 309 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 309 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 310 | 310 | |
| 311 | 311 | $this->loader = new Wordlift_Loader(); |
| 312 | 312 | |
| 313 | 313 | // Instantiate a global logger. |
| 314 | 314 | global $wl_logger; |
| 315 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 315 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 316 | 316 | |
| 317 | 317 | // Create an instance of the UI service. |
| 318 | 318 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -327,22 +327,22 @@ discard block |
||
| 327 | 327 | $this->notice_service = new Wordlift_Notice_Service(); |
| 328 | 328 | |
| 329 | 329 | // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
| 330 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service ); |
|
| 330 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->schema_service, $this->notice_service); |
|
| 331 | 331 | |
| 332 | 332 | // Create an instance of the User service. |
| 333 | 333 | $this->user_service = new Wordlift_User_Service(); |
| 334 | 334 | |
| 335 | 335 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 336 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 336 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service); |
|
| 337 | 337 | |
| 338 | 338 | // Create a new instance of the Redirect service. |
| 339 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 339 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_service); |
|
| 340 | 340 | |
| 341 | 341 | // Create an instance of the Timeline shortcode. |
| 342 | 342 | new Wordlift_Timeline_Shortcode(); |
| 343 | 343 | |
| 344 | 344 | // Create entity list customization (wp-admin/edit.php) |
| 345 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service ); |
|
| 345 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->entity_service); |
|
| 346 | 346 | |
| 347 | 347 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 348 | 348 | |
@@ -365,9 +365,9 @@ discard block |
||
| 365 | 365 | private function set_locale() { |
| 366 | 366 | |
| 367 | 367 | $plugin_i18n = new Wordlift_i18n(); |
| 368 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 368 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 369 | 369 | |
| 370 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 370 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 371 | 371 | |
| 372 | 372 | } |
| 373 | 373 | |
@@ -380,49 +380,49 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | private function define_admin_hooks() { |
| 382 | 382 | |
| 383 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 383 | + $plugin_admin = new Wordlift_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 384 | 384 | |
| 385 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 386 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 385 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 386 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 387 | 387 | |
| 388 | 388 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 389 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 389 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 390 | 390 | |
| 391 | 391 | // Hook the added_post_meta action to the Thumbnail service. |
| 392 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4 ); |
|
| 392 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_post_meta', 10, 4); |
|
| 393 | 393 | |
| 394 | 394 | // Hook posts inserts (or updates) to the user service. |
| 395 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 395 | + $this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3); |
|
| 396 | 396 | |
| 397 | 397 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 398 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 398 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 399 | 399 | |
| 400 | 400 | // Register custom allowed redirect hosts. |
| 401 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 401 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 402 | 402 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 403 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 403 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 404 | 404 | |
| 405 | 405 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 406 | 406 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 407 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 408 | - $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 ); |
|
| 407 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 408 | + $this->loader->add_action('save_post_entity', $this->entity_service, 'set_rating_for', 10, 1); |
|
| 409 | 409 | |
| 410 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 411 | - $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' ); |
|
| 410 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 411 | + $this->loader->add_action('in_admin_header', $this->entity_service, 'in_admin_header'); |
|
| 412 | 412 | |
| 413 | 413 | // Entity listing customization (wp-admin/edit.php) |
| 414 | 414 | // Add custom columns |
| 415 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 416 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 415 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 416 | + $this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 417 | 417 | // Add 4W selection |
| 418 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 419 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 418 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 419 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 420 | 420 | |
| 421 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 421 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 422 | 422 | |
| 423 | 423 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 424 | 424 | // entities. |
| 425 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 425 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
@@ -434,17 +434,17 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | private function define_public_hooks() { |
| 436 | 436 | |
| 437 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 437 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 438 | 438 | |
| 439 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 440 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 439 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 440 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 441 | 441 | |
| 442 | 442 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 443 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 443 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 444 | 444 | |
| 445 | 445 | // Hook the ShareThis service. |
| 446 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 447 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 446 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 447 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |