@@ -7,29 +7,29 @@ |
||
| 7 | 7 | |
| 8 | 8 | class FieldDefinitionFactory { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * @var $schema Schema |
|
| 12 | - */ |
|
| 13 | - private $schema; |
|
| 10 | + /** |
|
| 11 | + * @var $schema Schema |
|
| 12 | + */ |
|
| 13 | + private $schema; |
|
| 14 | 14 | |
| 15 | - public function __construct( $schema ) { |
|
| 16 | - $this->schema = $schema; |
|
| 17 | - } |
|
| 15 | + public function __construct( $schema ) { |
|
| 16 | + $this->schema = $schema; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - public function get_field_definition() { |
|
| 20 | + public function get_field_definition() { |
|
| 21 | 21 | |
| 22 | - $context_type = $this->schema->get_context_type(); |
|
| 22 | + $context_type = $this->schema->get_context_type(); |
|
| 23 | 23 | |
| 24 | - switch ( $context_type ) { |
|
| 25 | - case Context::POST: |
|
| 26 | - return new PostTypeDefinition( $this->schema ); |
|
| 27 | - case Context::TERM: |
|
| 28 | - return new TaxonomyDefinition( $this->schema ); |
|
| 29 | - default: |
|
| 30 | - return new AllPodsDefiniton( $this->schema ); |
|
| 31 | - } |
|
| 32 | - } |
|
| 24 | + switch ( $context_type ) { |
|
| 25 | + case Context::POST: |
|
| 26 | + return new PostTypeDefinition( $this->schema ); |
|
| 27 | + case Context::TERM: |
|
| 28 | + return new TaxonomyDefinition( $this->schema ); |
|
| 29 | + default: |
|
| 30 | + return new AllPodsDefiniton( $this->schema ); |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | private $schema; |
| 14 | 14 | |
| 15 | - public function __construct( $schema ) { |
|
| 15 | + public function __construct($schema) { |
|
| 16 | 16 | $this->schema = $schema; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -21,13 +21,13 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $context_type = $this->schema->get_context_type(); |
| 23 | 23 | |
| 24 | - switch ( $context_type ) { |
|
| 24 | + switch ($context_type) { |
|
| 25 | 25 | case Context::POST: |
| 26 | - return new PostTypeDefinition( $this->schema ); |
|
| 26 | + return new PostTypeDefinition($this->schema); |
|
| 27 | 27 | case Context::TERM: |
| 28 | - return new TaxonomyDefinition( $this->schema ); |
|
| 28 | + return new TaxonomyDefinition($this->schema); |
|
| 29 | 29 | default: |
| 30 | - return new AllPodsDefiniton( $this->schema ); |
|
| 30 | + return new AllPodsDefiniton($this->schema); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
@@ -4,14 +4,14 @@ |
||
| 4 | 4 | |
| 5 | 5 | class PostTypeDefinition extends AbstractFieldDefiniton { |
| 6 | 6 | |
| 7 | - public function register() { |
|
| 8 | - $that = $this; |
|
| 9 | - add_action( |
|
| 10 | - 'init', |
|
| 11 | - function () use ( $that ) { |
|
| 12 | - $context = $that->schema->get(); |
|
| 13 | - $that->register_pod( $context->get_pod_name(), $context->get_pod_type(), $context ); |
|
| 14 | - } |
|
| 15 | - ); |
|
| 16 | - } |
|
| 7 | + public function register() { |
|
| 8 | + $that = $this; |
|
| 9 | + add_action( |
|
| 10 | + 'init', |
|
| 11 | + function () use ( $that ) { |
|
| 12 | + $context = $that->schema->get(); |
|
| 13 | + $that->register_pod( $context->get_pod_name(), $context->get_pod_type(), $context ); |
|
| 14 | + } |
|
| 15 | + ); |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | $that = $this; |
| 9 | 9 | add_action( |
| 10 | 10 | 'init', |
| 11 | - function () use ( $that ) { |
|
| 11 | + function() use ($that) { |
|
| 12 | 12 | $context = $that->schema->get(); |
| 13 | - $that->register_pod( $context->get_pod_name(), $context->get_pod_type(), $context ); |
|
| 13 | + $that->register_pod($context->get_pod_name(), $context->get_pod_type(), $context); |
|
| 14 | 14 | } |
| 15 | 15 | ); |
| 16 | 16 | } |
@@ -4,14 +4,14 @@ |
||
| 4 | 4 | |
| 5 | 5 | class TaxonomyDefinition extends AbstractFieldDefiniton { |
| 6 | 6 | |
| 7 | - public function register() { |
|
| 8 | - $that = $this; |
|
| 9 | - add_action( |
|
| 10 | - 'setup_theme', |
|
| 11 | - function () use ( $that ) { |
|
| 12 | - $context = $that->schema->get(); |
|
| 13 | - $that->register_pod( $context->get_pod_name(), $context->get_pod_type(), $context ); |
|
| 14 | - } |
|
| 15 | - ); |
|
| 16 | - } |
|
| 7 | + public function register() { |
|
| 8 | + $that = $this; |
|
| 9 | + add_action( |
|
| 10 | + 'setup_theme', |
|
| 11 | + function () use ( $that ) { |
|
| 12 | + $context = $that->schema->get(); |
|
| 13 | + $that->register_pod( $context->get_pod_name(), $context->get_pod_type(), $context ); |
|
| 14 | + } |
|
| 15 | + ); |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | $that = $this; |
| 9 | 9 | add_action( |
| 10 | 10 | 'setup_theme', |
| 11 | - function () use ( $that ) { |
|
| 11 | + function() use ($that) { |
|
| 12 | 12 | $context = $that->schema->get(); |
| 13 | - $that->register_pod( $context->get_pod_name(), $context->get_pod_type(), $context ); |
|
| 13 | + $that->register_pod($context->get_pod_name(), $context->get_pod_type(), $context); |
|
| 14 | 14 | } |
| 15 | 15 | ); |
| 16 | 16 | } |
@@ -4,100 +4,100 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Schema { |
| 6 | 6 | |
| 7 | - public function get_context_type() { |
|
| 8 | - |
|
| 9 | - if ( isset( $_REQUEST['post'] ) ) { |
|
| 10 | - return Context::POST; |
|
| 11 | - } |
|
| 12 | - if ( isset( $_REQUEST['tag_ID'] ) ) { |
|
| 13 | - return Context::TERM; |
|
| 14 | - } |
|
| 15 | - |
|
| 16 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 17 | - return Context::ADMIN_AJAX; |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - return Context::UNKNOWN; |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @return Context |
|
| 26 | - */ |
|
| 27 | - public function get() { |
|
| 28 | - // we need to identify the context to filter the results. |
|
| 29 | - |
|
| 30 | - $identifier = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) : ''; |
|
| 31 | - |
|
| 32 | - if ( $identifier ) { |
|
| 33 | - // If post identifier, get schema. |
|
| 34 | - return new Context( Context::POST, $identifier, $this->get_fields_for_post( $identifier ) ); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - $identifier = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : ''; |
|
| 38 | - |
|
| 39 | - if ( $identifier ) { |
|
| 40 | - // If post identifier, get schema. |
|
| 41 | - return new Context( Context::TERM, $identifier, $this->get_fields_for_term( $identifier ) ); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 45 | - return new Context( Context::UNKNOWN, null, null ); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - return new Context( Context::ADMIN_AJAX, null, $this->get_all_fields() ); |
|
| 49 | - |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @return Schema_Field_Group[] |
|
| 54 | - */ |
|
| 55 | - private function get_fields_for_post( $identifier ) { |
|
| 56 | - $types = \Wordlift_Entity_Type_Service::get_instance()->get_names( $identifier ); |
|
| 57 | - $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
| 58 | - |
|
| 59 | - return array_map( |
|
| 60 | - function ( $schema_type ) use ( $schema_classes ) { |
|
| 61 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 62 | - |
|
| 63 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 64 | - }, |
|
| 65 | - $types |
|
| 66 | - ); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @return Schema_Field_Group[] |
|
| 71 | - */ |
|
| 72 | - private function get_fields_for_term( $identifier ) { |
|
| 73 | - $term_entity_types = get_term_meta( (int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 74 | - $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
| 75 | - |
|
| 76 | - return array_map( |
|
| 77 | - function ( $schema_type ) use ( $schema_classes ) { |
|
| 78 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 79 | - |
|
| 80 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 81 | - }, |
|
| 82 | - $term_entity_types |
|
| 83 | - ); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - private function get_all_fields() { |
|
| 87 | - $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
| 88 | - $all_schema_slugs = $schema_classes->get_all_schema_slugs(); |
|
| 89 | - |
|
| 90 | - return array_filter( |
|
| 91 | - array_map( |
|
| 92 | - function ( $schema_type ) use ( $schema_classes ) { |
|
| 93 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 94 | - |
|
| 95 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 96 | - }, |
|
| 97 | - $all_schema_slugs |
|
| 98 | - ) |
|
| 99 | - ); |
|
| 100 | - } |
|
| 7 | + public function get_context_type() { |
|
| 8 | + |
|
| 9 | + if ( isset( $_REQUEST['post'] ) ) { |
|
| 10 | + return Context::POST; |
|
| 11 | + } |
|
| 12 | + if ( isset( $_REQUEST['tag_ID'] ) ) { |
|
| 13 | + return Context::TERM; |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 17 | + return Context::ADMIN_AJAX; |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + return Context::UNKNOWN; |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @return Context |
|
| 26 | + */ |
|
| 27 | + public function get() { |
|
| 28 | + // we need to identify the context to filter the results. |
|
| 29 | + |
|
| 30 | + $identifier = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) : ''; |
|
| 31 | + |
|
| 32 | + if ( $identifier ) { |
|
| 33 | + // If post identifier, get schema. |
|
| 34 | + return new Context( Context::POST, $identifier, $this->get_fields_for_post( $identifier ) ); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + $identifier = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : ''; |
|
| 38 | + |
|
| 39 | + if ( $identifier ) { |
|
| 40 | + // If post identifier, get schema. |
|
| 41 | + return new Context( Context::TERM, $identifier, $this->get_fields_for_term( $identifier ) ); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 45 | + return new Context( Context::UNKNOWN, null, null ); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + return new Context( Context::ADMIN_AJAX, null, $this->get_all_fields() ); |
|
| 49 | + |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @return Schema_Field_Group[] |
|
| 54 | + */ |
|
| 55 | + private function get_fields_for_post( $identifier ) { |
|
| 56 | + $types = \Wordlift_Entity_Type_Service::get_instance()->get_names( $identifier ); |
|
| 57 | + $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
| 58 | + |
|
| 59 | + return array_map( |
|
| 60 | + function ( $schema_type ) use ( $schema_classes ) { |
|
| 61 | + $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 62 | + |
|
| 63 | + return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 64 | + }, |
|
| 65 | + $types |
|
| 66 | + ); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @return Schema_Field_Group[] |
|
| 71 | + */ |
|
| 72 | + private function get_fields_for_term( $identifier ) { |
|
| 73 | + $term_entity_types = get_term_meta( (int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 74 | + $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
| 75 | + |
|
| 76 | + return array_map( |
|
| 77 | + function ( $schema_type ) use ( $schema_classes ) { |
|
| 78 | + $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 79 | + |
|
| 80 | + return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 81 | + }, |
|
| 82 | + $term_entity_types |
|
| 83 | + ); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + private function get_all_fields() { |
|
| 87 | + $schema_classes = \Wordlift_Schema_Service::get_instance(); |
|
| 88 | + $all_schema_slugs = $schema_classes->get_all_schema_slugs(); |
|
| 89 | + |
|
| 90 | + return array_filter( |
|
| 91 | + array_map( |
|
| 92 | + function ( $schema_type ) use ( $schema_classes ) { |
|
| 93 | + $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 94 | + |
|
| 95 | + return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 96 | + }, |
|
| 97 | + $all_schema_slugs |
|
| 98 | + ) |
|
| 99 | + ); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | } |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | public function get_context_type() { |
| 8 | 8 | |
| 9 | - if ( isset( $_REQUEST['post'] ) ) { |
|
| 9 | + if (isset($_REQUEST['post'])) { |
|
| 10 | 10 | return Context::POST; |
| 11 | 11 | } |
| 12 | - if ( isset( $_REQUEST['tag_ID'] ) ) { |
|
| 12 | + if (isset($_REQUEST['tag_ID'])) { |
|
| 13 | 13 | return Context::TERM; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 16 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
| 17 | 17 | return Context::ADMIN_AJAX; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -27,40 +27,40 @@ discard block |
||
| 27 | 27 | public function get() { |
| 28 | 28 | // we need to identify the context to filter the results. |
| 29 | 29 | |
| 30 | - $identifier = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) : ''; |
|
| 30 | + $identifier = isset($_REQUEST['post']) ? sanitize_text_field(wp_unslash($_REQUEST['post'])) : ''; |
|
| 31 | 31 | |
| 32 | - if ( $identifier ) { |
|
| 32 | + if ($identifier) { |
|
| 33 | 33 | // If post identifier, get schema. |
| 34 | - return new Context( Context::POST, $identifier, $this->get_fields_for_post( $identifier ) ); |
|
| 34 | + return new Context(Context::POST, $identifier, $this->get_fields_for_post($identifier)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $identifier = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : ''; |
|
| 37 | + $identifier = isset($_REQUEST['tag_ID']) ? sanitize_text_field(wp_unslash($_REQUEST['tag_ID'])) : ''; |
|
| 38 | 38 | |
| 39 | - if ( $identifier ) { |
|
| 39 | + if ($identifier) { |
|
| 40 | 40 | // If post identifier, get schema. |
| 41 | - return new Context( Context::TERM, $identifier, $this->get_fields_for_term( $identifier ) ); |
|
| 41 | + return new Context(Context::TERM, $identifier, $this->get_fields_for_term($identifier)); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
| 45 | - return new Context( Context::UNKNOWN, null, null ); |
|
| 44 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
| 45 | + return new Context(Context::UNKNOWN, null, null); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return new Context( Context::ADMIN_AJAX, null, $this->get_all_fields() ); |
|
| 48 | + return new Context(Context::ADMIN_AJAX, null, $this->get_all_fields()); |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @return Schema_Field_Group[] |
| 54 | 54 | */ |
| 55 | - private function get_fields_for_post( $identifier ) { |
|
| 56 | - $types = \Wordlift_Entity_Type_Service::get_instance()->get_names( $identifier ); |
|
| 55 | + private function get_fields_for_post($identifier) { |
|
| 56 | + $types = \Wordlift_Entity_Type_Service::get_instance()->get_names($identifier); |
|
| 57 | 57 | $schema_classes = \Wordlift_Schema_Service::get_instance(); |
| 58 | 58 | |
| 59 | 59 | return array_map( |
| 60 | - function ( $schema_type ) use ( $schema_classes ) { |
|
| 61 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 60 | + function($schema_type) use ($schema_classes) { |
|
| 61 | + $data = $schema_classes->get_schema(strtolower($schema_type)); |
|
| 62 | 62 | |
| 63 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 63 | + return new Schema_Field_Group($schema_type, $data['custom_fields']); |
|
| 64 | 64 | }, |
| 65 | 65 | $types |
| 66 | 66 | ); |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @return Schema_Field_Group[] |
| 71 | 71 | */ |
| 72 | - private function get_fields_for_term( $identifier ) { |
|
| 73 | - $term_entity_types = get_term_meta( (int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 72 | + private function get_fields_for_term($identifier) { |
|
| 73 | + $term_entity_types = get_term_meta((int) $identifier, \Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
| 74 | 74 | $schema_classes = \Wordlift_Schema_Service::get_instance(); |
| 75 | 75 | |
| 76 | 76 | return array_map( |
| 77 | - function ( $schema_type ) use ( $schema_classes ) { |
|
| 78 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 77 | + function($schema_type) use ($schema_classes) { |
|
| 78 | + $data = $schema_classes->get_schema(strtolower($schema_type)); |
|
| 79 | 79 | |
| 80 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 80 | + return new Schema_Field_Group($schema_type, $data['custom_fields']); |
|
| 81 | 81 | }, |
| 82 | 82 | $term_entity_types |
| 83 | 83 | ); |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | return array_filter( |
| 91 | 91 | array_map( |
| 92 | - function ( $schema_type ) use ( $schema_classes ) { |
|
| 93 | - $data = $schema_classes->get_schema( strtolower( $schema_type ) ); |
|
| 92 | + function($schema_type) use ($schema_classes) { |
|
| 93 | + $data = $schema_classes->get_schema(strtolower($schema_type)); |
|
| 94 | 94 | |
| 95 | - return new Schema_Field_Group( $schema_type, $data['custom_fields'] ); |
|
| 95 | + return new Schema_Field_Group($schema_type, $data['custom_fields']); |
|
| 96 | 96 | }, |
| 97 | 97 | $all_schema_slugs |
| 98 | 98 | ) |
@@ -31,25 +31,25 @@ discard block |
||
| 31 | 31 | use Wordlift\Features\Features_Registry; |
| 32 | 32 | use Wordlift\Post\Post_Adapter; |
| 33 | 33 | |
| 34 | -add_filter('wl_feature__enable__pods-integration', '__return_true' ); |
|
| 34 | +add_filter('wl_feature__enable__pods-integration', '__return_true'); |
|
| 35 | 35 | |
| 36 | 36 | // If this file is called directly, abort. |
| 37 | -if ( ! defined( 'WPINC' ) ) { |
|
| 37 | +if ( ! defined('WPINC')) { |
|
| 38 | 38 | die; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -define( 'WORDLIFT_VERSION', '3.38.0' ); |
|
| 41 | +define('WORDLIFT_VERSION', '3.38.0'); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Filter to disable WLP on any request, defaults to true. |
| 45 | 45 | * |
| 46 | 46 | * @since 3.33.6 |
| 47 | 47 | */ |
| 48 | -if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
|
| 48 | +if ( ! apply_filters('wl_is_enabled', true)) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
| 52 | +require_once plugin_dir_path(__FILE__).'vendor/autoload.php'; |
|
| 53 | 53 | |
| 54 | 54 | /* |
| 55 | 55 | * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http. |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | wordlift_plugin_autoload_register(); |
| 60 | 60 | |
| 61 | 61 | // Include WordLift constants. |
| 62 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php'; |
|
| 62 | +require_once plugin_dir_path(__FILE__).'wordlift-constants.php'; |
|
| 63 | 63 | |
| 64 | 64 | // Load modules. |
| 65 | -require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php'; |
|
| 65 | +require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php'; |
|
| 66 | 66 | |
| 67 | -require_once plugin_dir_path( __FILE__ ) . 'deprecations.php'; |
|
| 67 | +require_once plugin_dir_path(__FILE__).'deprecations.php'; |
|
| 68 | 68 | |
| 69 | 69 | // Load early to enable/disable features. |
| 70 | -require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php'; |
|
| 70 | +require_once plugin_dir_path(__FILE__).'wordlift/features/index.php'; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * The code that runs during plugin activation. |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | function activate_wordlift() { |
| 77 | 77 | |
| 78 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
| 78 | + $log = Wordlift_Log_Service::get_logger('activate_wordlift'); |
|
| 79 | 79 | |
| 80 | - $log->info( 'Activating WordLift...' ); |
|
| 80 | + $log->info('Activating WordLift...'); |
|
| 81 | 81 | |
| 82 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 82 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
| 83 | 83 | Wordlift_Activator::activate(); |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | function deactivate_wordlift() { |
| 108 | 108 | |
| 109 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 109 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
| 110 | 110 | Wordlift_Deactivator::deactivate(); |
| 111 | 111 | Wordlift_Http_Api::deactivate(); |
| 112 | 112 | Ttl_Cache_Cleaner::deactivate(); |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
| 128 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
| 127 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
| 128 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * The core plugin class that is used to define internationalization, |
| 132 | 132 | * admin-specific hooks, and public-facing site hooks. |
| 133 | 133 | */ |
| 134 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
| 134 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Begins execution of the plugin. |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | * @return bool |
| 152 | 152 | * @since 3.27.6 |
| 153 | 153 | */ |
| 154 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
| 155 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
| 156 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
| 157 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
| 154 | + if (apply_filters('wl_feature__enable__widgets', true)) { |
|
| 155 | + add_action('widgets_init', 'wl_register_chord_widget'); |
|
| 156 | + add_action('widgets_init', 'wl_register_geo_widget'); |
|
| 157 | + add_action('widgets_init', 'wl_register_timeline_widget'); |
|
| 158 | 158 | } |
| 159 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
| 159 | + add_filter('widget_text', 'do_shortcode'); |
|
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * Filter: wl_feature__enable__analysis |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | * @return bool |
| 167 | 167 | * @since 3.27.6 |
| 168 | 168 | */ |
| 169 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
| 170 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
| 169 | + if (apply_filters('wl_feature__enable__analysis', true)) { |
|
| 170 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action'); |
|
| 171 | 171 | } else { |
| 172 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
| 172 | + add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $plugin = new Wordlift(); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | add_action( |
| 188 | 188 | 'plugins_loaded', |
| 189 | - function () { |
|
| 189 | + function() { |
|
| 190 | 190 | // All features from registry should be initialized here. |
| 191 | 191 | $features_registry = Features_Registry::get_instance(); |
| 192 | 192 | $features_registry->initialize_all_features(); |
@@ -197,27 +197,27 @@ discard block |
||
| 197 | 197 | add_action( |
| 198 | 198 | 'plugins_loaded', |
| 199 | 199 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 200 | - function () use ( $plugin ) { |
|
| 200 | + function() use ($plugin) { |
|
| 201 | 201 | |
| 202 | 202 | new Wordlift_Products_Navigator_Shortcode_REST(); |
| 203 | 203 | |
| 204 | 204 | // Register the Dataset module, requires `$api_service`. |
| 205 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
| 206 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
| 205 | + require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php'; |
|
| 206 | + require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php'; |
|
| 207 | 207 | |
| 208 | 208 | /* |
| 209 | 209 | * Require the Entity annotation cleanup module. |
| 210 | 210 | * |
| 211 | 211 | * @since 3.34.6 |
| 212 | 212 | */ |
| 213 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
| 213 | + require_once plugin_dir_path(__FILE__).'wordlift/cleanup/index.php'; |
|
| 214 | 214 | |
| 215 | 215 | /* |
| 216 | 216 | * Import LOD entities. |
| 217 | 217 | * |
| 218 | 218 | * @since 3.35.0 |
| 219 | 219 | */ |
| 220 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
| 220 | + require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php'; |
|
| 221 | 221 | |
| 222 | 222 | } |
| 223 | 223 | ); |
@@ -235,23 +235,23 @@ discard block |
||
| 235 | 235 | function wordlift_plugin_autoload_register() { |
| 236 | 236 | |
| 237 | 237 | spl_autoload_register( |
| 238 | - function ( $class_name ) { |
|
| 238 | + function($class_name) { |
|
| 239 | 239 | |
| 240 | 240 | // Bail out if these are not our classes. |
| 241 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
| 241 | + if (0 !== strpos($class_name, 'Wordlift\\')) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
| 245 | + $class_name_lc = strtolower(str_replace('_', '-', $class_name)); |
|
| 246 | 246 | |
| 247 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
| 247 | + preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches); |
|
| 248 | 248 | |
| 249 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
| 250 | - $file = 'class-' . $matches[2] . '.php'; |
|
| 249 | + $path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]); |
|
| 250 | + $file = 'class-'.$matches[2].'.php'; |
|
| 251 | 251 | |
| 252 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
| 252 | + $full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file; |
|
| 253 | 253 | |
| 254 | - if ( ! file_exists( $full_path ) ) { |
|
| 254 | + if ( ! file_exists($full_path)) { |
|
| 255 | 255 | return false; |
| 256 | 256 | } |
| 257 | 257 | |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | -function wl_block_categories( $categories ) { |
|
| 266 | +function wl_block_categories($categories) { |
|
| 267 | 267 | return array_merge( |
| 268 | 268 | $categories, |
| 269 | 269 | array( |
| 270 | 270 | array( |
| 271 | 271 | 'slug' => 'wordlift', |
| 272 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
| 272 | + 'title' => __('WordLift', 'wordlift'), |
|
| 273 | 273 | ), |
| 274 | 274 | ) |
| 275 | 275 | ); |
@@ -279,22 +279,22 @@ discard block |
||
| 279 | 279 | * This function is created temporarily to handle the legacy library, |
| 280 | 280 | * this has to be removed when removing the legacy fields from the ui. |
| 281 | 281 | */ |
| 282 | -function wl_enqueue_leaflet( $in_footer = false ) { |
|
| 282 | +function wl_enqueue_leaflet($in_footer = false) { |
|
| 283 | 283 | // Leaflet. |
| 284 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
| 285 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
| 284 | + wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0'); |
|
| 285 | + wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | -add_filter( 'block_categories', 'wl_block_categories', 10 ); |
|
| 288 | +add_filter('block_categories', 'wl_block_categories', 10); |
|
| 289 | 289 | |
| 290 | 290 | // Temporary fix for a typo in WooCommerce Extension. |
| 291 | 291 | add_filter( |
| 292 | 292 | 'wl_feature__enable__dataset', |
| 293 | - function ( $value ) { |
|
| 294 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
| 293 | + function($value) { |
|
| 294 | + return apply_filters('wl_features__enable__dataset', $value); |
|
| 295 | 295 | } |
| 296 | 296 | ); |
| 297 | 297 | |
| 298 | -require_once __DIR__ . '/modules/food-kg/load.php'; |
|
| 299 | -require_once __DIR__ . '/modules/acf4so/load.php'; |
|
| 300 | -require_once __DIR__ . '/modules/pods/load.php'; |
|
| 298 | +require_once __DIR__.'/modules/food-kg/load.php'; |
|
| 299 | +require_once __DIR__.'/modules/acf4so/load.php'; |
|
| 300 | +require_once __DIR__.'/modules/pods/load.php'; |
|