@@ -20,76 +20,76 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Wordlift_Entity_Type_Admin_Service { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Create a {@link Wordlift_Entity_List_Service} instance. |
|
| 25 | - * |
|
| 26 | - * Set up the relevant filters and actions. |
|
| 27 | - * |
|
| 28 | - * @since 3.15.0 |
|
| 29 | - */ |
|
| 30 | - public function __construct() { |
|
| 23 | + /** |
|
| 24 | + * Create a {@link Wordlift_Entity_List_Service} instance. |
|
| 25 | + * |
|
| 26 | + * Set up the relevant filters and actions. |
|
| 27 | + * |
|
| 28 | + * @since 3.15.0 |
|
| 29 | + */ |
|
| 30 | + public function __construct() { |
|
| 31 | 31 | |
| 32 | - add_action( 'admin_init', array( $this, 'hide_entity_type_metabox', ) ); |
|
| 33 | - add_action( 'admin_init', array( |
|
| 34 | - $this, |
|
| 35 | - 'set_filters_to_hide_entity_type_from_lists', |
|
| 36 | - ) ); |
|
| 37 | - } |
|
| 32 | + add_action( 'admin_init', array( $this, 'hide_entity_type_metabox', ) ); |
|
| 33 | + add_action( 'admin_init', array( |
|
| 34 | + $this, |
|
| 35 | + 'set_filters_to_hide_entity_type_from_lists', |
|
| 36 | + ) ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Hide the entity type metabox from non entity edit screens if user is not |
|
| 41 | - * allowed to configure entity types. |
|
| 42 | - * |
|
| 43 | - * @since 3.15.0 |
|
| 44 | - */ |
|
| 45 | - public function hide_entity_type_metabox() { |
|
| 39 | + /** |
|
| 40 | + * Hide the entity type metabox from non entity edit screens if user is not |
|
| 41 | + * allowed to configure entity types. |
|
| 42 | + * |
|
| 43 | + * @since 3.15.0 |
|
| 44 | + */ |
|
| 45 | + public function hide_entity_type_metabox() { |
|
| 46 | 46 | |
| 47 | - // Bail out if the user can edit entities. |
|
| 48 | - if ( current_user_can( 'edit_wordlift_entity' ) ) { |
|
| 49 | - return; |
|
| 50 | - } |
|
| 47 | + // Bail out if the user can edit entities. |
|
| 48 | + if ( current_user_can( 'edit_wordlift_entity' ) ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // Loop over all the non entity post types which support entities and turn off the metabox. |
|
| 53 | - foreach ( $this->get_types_no_entity() as $type ) { |
|
| 54 | - remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' ); |
|
| 55 | - } |
|
| 52 | + // Loop over all the non entity post types which support entities and turn off the metabox. |
|
| 53 | + foreach ( $this->get_types_no_entity() as $type ) { |
|
| 54 | + remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Hide the entity type metabox from non entity list screens if user is not |
|
| 61 | - * allowed to configure entity types. |
|
| 62 | - * |
|
| 63 | - * @since 3.15.0 |
|
| 64 | - */ |
|
| 65 | - function set_filters_to_hide_entity_type_from_lists() { |
|
| 59 | + /** |
|
| 60 | + * Hide the entity type metabox from non entity list screens if user is not |
|
| 61 | + * allowed to configure entity types. |
|
| 62 | + * |
|
| 63 | + * @since 3.15.0 |
|
| 64 | + */ |
|
| 65 | + function set_filters_to_hide_entity_type_from_lists() { |
|
| 66 | 66 | |
| 67 | - // Bail out if the user can edit entities. |
|
| 68 | - if ( current_user_can( 'edit_wordlift_entity' ) ) { |
|
| 69 | - return; |
|
| 70 | - } |
|
| 67 | + // Bail out if the user can edit entities. |
|
| 68 | + if ( current_user_can( 'edit_wordlift_entity' ) ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - // Loop over all the non entity post types which support entities and turn off the taxonomy column. |
|
| 73 | - foreach ( $this->get_types_no_entity() as $type ) { |
|
| 74 | - add_filter( 'manage_taxonomies_for_' . $type . '_columns', function ( $taxonomies ) { |
|
| 75 | - unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] ); |
|
| 72 | + // Loop over all the non entity post types which support entities and turn off the taxonomy column. |
|
| 73 | + foreach ( $this->get_types_no_entity() as $type ) { |
|
| 74 | + add_filter( 'manage_taxonomies_for_' . $type . '_columns', function ( $taxonomies ) { |
|
| 75 | + unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] ); |
|
| 76 | 76 | |
| 77 | - return $taxonomies; |
|
| 78 | - } ); |
|
| 79 | - } |
|
| 77 | + return $taxonomies; |
|
| 78 | + } ); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Get the types which are not the entity post type. |
|
| 85 | - * |
|
| 86 | - * @since 3.15.0 |
|
| 87 | - * |
|
| 88 | - * @return array An array of types' names. |
|
| 89 | - */ |
|
| 90 | - private function get_types_no_entity() { |
|
| 83 | + /** |
|
| 84 | + * Get the types which are not the entity post type. |
|
| 85 | + * |
|
| 86 | + * @since 3.15.0 |
|
| 87 | + * |
|
| 88 | + * @return array An array of types' names. |
|
| 89 | + */ |
|
| 90 | + private function get_types_no_entity() { |
|
| 91 | 91 | |
| 92 | - return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME ); |
|
| 93 | - } |
|
| 92 | + return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME ); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct() { |
| 31 | 31 | |
| 32 | - add_action( 'admin_init', array( $this, 'hide_entity_type_metabox', ) ); |
|
| 33 | - add_action( 'admin_init', array( |
|
| 32 | + add_action('admin_init', array($this, 'hide_entity_type_metabox',)); |
|
| 33 | + add_action('admin_init', array( |
|
| 34 | 34 | $this, |
| 35 | 35 | 'set_filters_to_hide_entity_type_from_lists', |
| 36 | - ) ); |
|
| 36 | + )); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | public function hide_entity_type_metabox() { |
| 46 | 46 | |
| 47 | 47 | // Bail out if the user can edit entities. |
| 48 | - if ( current_user_can( 'edit_wordlift_entity' ) ) { |
|
| 48 | + if (current_user_can('edit_wordlift_entity')) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Loop over all the non entity post types which support entities and turn off the metabox. |
| 53 | - foreach ( $this->get_types_no_entity() as $type ) { |
|
| 54 | - remove_meta_box( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . 'div', $type, 'side' ); |
|
| 53 | + foreach ($this->get_types_no_entity() as $type) { |
|
| 54 | + remove_meta_box(Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME.'div', $type, 'side'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | } |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | function set_filters_to_hide_entity_type_from_lists() { |
| 66 | 66 | |
| 67 | 67 | // Bail out if the user can edit entities. |
| 68 | - if ( current_user_can( 'edit_wordlift_entity' ) ) { |
|
| 68 | + if (current_user_can('edit_wordlift_entity')) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Loop over all the non entity post types which support entities and turn off the taxonomy column. |
| 73 | - foreach ( $this->get_types_no_entity() as $type ) { |
|
| 74 | - add_filter( 'manage_taxonomies_for_' . $type . '_columns', function ( $taxonomies ) { |
|
| 75 | - unset( $taxonomies[ Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ] ); |
|
| 73 | + foreach ($this->get_types_no_entity() as $type) { |
|
| 74 | + add_filter('manage_taxonomies_for_'.$type.'_columns', function($taxonomies) { |
|
| 75 | + unset($taxonomies[Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME]); |
|
| 76 | 76 | |
| 77 | 77 | return $taxonomies; |
| 78 | 78 | } ); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function get_types_no_entity() { |
| 91 | 91 | |
| 92 | - return array_diff( Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME ); |
|
| 92 | + return array_diff(Wordlift_Entity_Service::valid_entity_post_types(), (array) Wordlift_Entity_Service::TYPE_NAME); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | } |
@@ -18,210 +18,210 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Storage_Factory { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The {@link Wordlift_Entity_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.15.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $entity_service; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * The {@link Wordlift_User_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.15.0 |
|
| 34 | - * @access private |
|
| 35 | - * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private $user_service; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * The {@link Wordlift_Property_Getter} instance. |
|
| 41 | - * |
|
| 42 | - * @since 3.15.0 |
|
| 43 | - * @access private |
|
| 44 | - * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} instance. |
|
| 45 | - */ |
|
| 46 | - private $property_getter; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * The singleton instance. |
|
| 50 | - * |
|
| 51 | - * @since 3.15.0 |
|
| 52 | - * @access private |
|
| 53 | - * @var \Wordlift_Storage_Factory $instance The singleton instance. |
|
| 54 | - */ |
|
| 55 | - private static $instance; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Create a {@link Wordlift_Storage_Factory} instance. |
|
| 59 | - * |
|
| 60 | - * @since 3.15.0 |
|
| 61 | - * |
|
| 62 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 63 | - * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 64 | - * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} instance. |
|
| 65 | - */ |
|
| 66 | - public function __construct( $entity_service, $user_service, $property_getter ) { |
|
| 67 | - |
|
| 68 | - $this->entity_service = $entity_service; |
|
| 69 | - $this->user_service = $user_service; |
|
| 70 | - $this->property_getter = $property_getter; |
|
| 71 | - |
|
| 72 | - self::$instance = $this; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Get the singleton instance. |
|
| 77 | - * |
|
| 78 | - * @since 3.15.0 |
|
| 79 | - * |
|
| 80 | - * @return \Wordlift_Storage_Factory The singleton instance. |
|
| 81 | - */ |
|
| 82 | - public static function get_instance() { |
|
| 83 | - |
|
| 84 | - return self::$instance; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 89 | - * titles. |
|
| 90 | - * |
|
| 91 | - * @since 3.15.0 |
|
| 92 | - * |
|
| 93 | - * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 94 | - * instance. |
|
| 95 | - */ |
|
| 96 | - public function post_title() { |
|
| 97 | - |
|
| 98 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::TITLE ); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 103 | - * descriptions stripped of tags and shortcodes. |
|
| 104 | - * |
|
| 105 | - * @since 3.15.0 |
|
| 106 | - * |
|
| 107 | - * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 108 | - * instance. |
|
| 109 | - */ |
|
| 110 | - public function post_description_no_tags_no_shortcodes() { |
|
| 111 | - |
|
| 112 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES ); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 117 | - * authors. |
|
| 118 | - * |
|
| 119 | - * @since 3.15.0 |
|
| 120 | - * |
|
| 121 | - * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 122 | - * instance. |
|
| 123 | - */ |
|
| 124 | - public function post_author() { |
|
| 125 | - |
|
| 126 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 131 | - * metas. |
|
| 132 | - * |
|
| 133 | - * @since 3.15.0 |
|
| 134 | - * |
|
| 135 | - * @param string $meta_key The meta key to read. |
|
| 136 | - * |
|
| 137 | - * @return Wordlift_Post_Meta_Storage A {@link Wordlift_Post_Meta_Storage} |
|
| 138 | - * instance. |
|
| 139 | - */ |
|
| 140 | - public function post_meta( $meta_key ) { |
|
| 141 | - |
|
| 142 | - return new Wordlift_Post_Meta_Storage( $meta_key ); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Get a {@link Wordlift_Post_Schema_Class_Storage} to read {@link WP_Post}s' |
|
| 147 | - * entity type class. |
|
| 148 | - * |
|
| 149 | - * @since 3.15.0 |
|
| 150 | - * |
|
| 151 | - * @return Wordlift_Post_Schema_Class_Storage A {@link Wordlift_Post_Schema_Class_Storage} |
|
| 152 | - * instance. |
|
| 153 | - */ |
|
| 154 | - public function schema_class() { |
|
| 155 | - |
|
| 156 | - return new Wordlift_Post_Schema_Class_Storage(); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Get a {@link Wordlift_Post_Author_Storage} instance able to turn an author |
|
| 161 | - * id into a URI. |
|
| 162 | - * |
|
| 163 | - * @since 3.15.0 |
|
| 164 | - * |
|
| 165 | - * @return \Wordlift_Post_Author_Storage A {@link Wordlift_Post_Author_Storage} |
|
| 166 | - * instance. |
|
| 167 | - */ |
|
| 168 | - public function author_uri() { |
|
| 169 | - |
|
| 170 | - return new Wordlift_Post_Author_Storage( $this->entity_service, $this->user_service ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Get a {@link Wordlift_Post_Meta_Uri_Storage} instance which reads {@link WP_Post} |
|
| 175 | - * ids and maps them to URI. |
|
| 176 | - * |
|
| 177 | - * @param string $meta_key The {@link WP_Post}'s meta key. |
|
| 178 | - * |
|
| 179 | - * @return \Wordlift_Post_Meta_Uri_Storage A {@link Wordlift_Post_Meta_Uri_Storage} |
|
| 180 | - * instance. |
|
| 181 | - */ |
|
| 182 | - public function post_meta_to_uri( $meta_key ) { |
|
| 183 | - |
|
| 184 | - return new Wordlift_Post_Meta_Uri_Storage( $meta_key, $this->entity_service ); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Get a list of {@link WP_Post}'s images URI. |
|
| 189 | - * |
|
| 190 | - * @since 3.15.0 |
|
| 191 | - * |
|
| 192 | - * @return \Wordlift_Post_Image_Storage A {@link Wordlift_Post_Image_Storage} |
|
| 193 | - * instance. |
|
| 194 | - */ |
|
| 195 | - public function post_images() { |
|
| 196 | - |
|
| 197 | - return new Wordlift_Post_Image_Storage(); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Get a {@link Wordlift_Post_Related_Storage} instance to get related |
|
| 202 | - * {@link WP_Post}s. |
|
| 203 | - * |
|
| 204 | - * @since 3.15.0 |
|
| 205 | - * |
|
| 206 | - * @return \Wordlift_Post_Related_Storage A {@link Wordlift_Post_Related_Storage} |
|
| 207 | - * instance. |
|
| 208 | - */ |
|
| 209 | - public function relations() { |
|
| 210 | - |
|
| 211 | - return new Wordlift_Post_Related_Storage( $this->entity_service ); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * Get the {@link Wordlift_Url_Property_Storage} instance. |
|
| 216 | - * |
|
| 217 | - * @since 3.15.0 |
|
| 218 | - * |
|
| 219 | - * @return \Wordlift_Url_Property_Storage The {@link Wordlift_Url_Property_Storage} |
|
| 220 | - * instance. |
|
| 221 | - */ |
|
| 222 | - public function url_property() { |
|
| 223 | - |
|
| 224 | - return new Wordlift_Url_Property_Storage( $this->property_getter ); |
|
| 225 | - } |
|
| 21 | + /** |
|
| 22 | + * The {@link Wordlift_Entity_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.15.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $entity_service; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * The {@link Wordlift_User_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.15.0 |
|
| 34 | + * @access private |
|
| 35 | + * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private $user_service; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * The {@link Wordlift_Property_Getter} instance. |
|
| 41 | + * |
|
| 42 | + * @since 3.15.0 |
|
| 43 | + * @access private |
|
| 44 | + * @var \Wordlift_Property_Getter The {@link Wordlift_Property_Getter} instance. |
|
| 45 | + */ |
|
| 46 | + private $property_getter; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * The singleton instance. |
|
| 50 | + * |
|
| 51 | + * @since 3.15.0 |
|
| 52 | + * @access private |
|
| 53 | + * @var \Wordlift_Storage_Factory $instance The singleton instance. |
|
| 54 | + */ |
|
| 55 | + private static $instance; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Create a {@link Wordlift_Storage_Factory} instance. |
|
| 59 | + * |
|
| 60 | + * @since 3.15.0 |
|
| 61 | + * |
|
| 62 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 63 | + * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
| 64 | + * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} instance. |
|
| 65 | + */ |
|
| 66 | + public function __construct( $entity_service, $user_service, $property_getter ) { |
|
| 67 | + |
|
| 68 | + $this->entity_service = $entity_service; |
|
| 69 | + $this->user_service = $user_service; |
|
| 70 | + $this->property_getter = $property_getter; |
|
| 71 | + |
|
| 72 | + self::$instance = $this; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Get the singleton instance. |
|
| 77 | + * |
|
| 78 | + * @since 3.15.0 |
|
| 79 | + * |
|
| 80 | + * @return \Wordlift_Storage_Factory The singleton instance. |
|
| 81 | + */ |
|
| 82 | + public static function get_instance() { |
|
| 83 | + |
|
| 84 | + return self::$instance; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 89 | + * titles. |
|
| 90 | + * |
|
| 91 | + * @since 3.15.0 |
|
| 92 | + * |
|
| 93 | + * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 94 | + * instance. |
|
| 95 | + */ |
|
| 96 | + public function post_title() { |
|
| 97 | + |
|
| 98 | + return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::TITLE ); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 103 | + * descriptions stripped of tags and shortcodes. |
|
| 104 | + * |
|
| 105 | + * @since 3.15.0 |
|
| 106 | + * |
|
| 107 | + * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 108 | + * instance. |
|
| 109 | + */ |
|
| 110 | + public function post_description_no_tags_no_shortcodes() { |
|
| 111 | + |
|
| 112 | + return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES ); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 117 | + * authors. |
|
| 118 | + * |
|
| 119 | + * @since 3.15.0 |
|
| 120 | + * |
|
| 121 | + * @return \Wordlift_Post_Property_Storage A {@link Wordlift_Post_Property_Storage} |
|
| 122 | + * instance. |
|
| 123 | + */ |
|
| 124 | + public function post_author() { |
|
| 125 | + |
|
| 126 | + return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Get a {@link Wordlift_Post_Property_Storage} to read {@link WP_Post}s' |
|
| 131 | + * metas. |
|
| 132 | + * |
|
| 133 | + * @since 3.15.0 |
|
| 134 | + * |
|
| 135 | + * @param string $meta_key The meta key to read. |
|
| 136 | + * |
|
| 137 | + * @return Wordlift_Post_Meta_Storage A {@link Wordlift_Post_Meta_Storage} |
|
| 138 | + * instance. |
|
| 139 | + */ |
|
| 140 | + public function post_meta( $meta_key ) { |
|
| 141 | + |
|
| 142 | + return new Wordlift_Post_Meta_Storage( $meta_key ); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Get a {@link Wordlift_Post_Schema_Class_Storage} to read {@link WP_Post}s' |
|
| 147 | + * entity type class. |
|
| 148 | + * |
|
| 149 | + * @since 3.15.0 |
|
| 150 | + * |
|
| 151 | + * @return Wordlift_Post_Schema_Class_Storage A {@link Wordlift_Post_Schema_Class_Storage} |
|
| 152 | + * instance. |
|
| 153 | + */ |
|
| 154 | + public function schema_class() { |
|
| 155 | + |
|
| 156 | + return new Wordlift_Post_Schema_Class_Storage(); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Get a {@link Wordlift_Post_Author_Storage} instance able to turn an author |
|
| 161 | + * id into a URI. |
|
| 162 | + * |
|
| 163 | + * @since 3.15.0 |
|
| 164 | + * |
|
| 165 | + * @return \Wordlift_Post_Author_Storage A {@link Wordlift_Post_Author_Storage} |
|
| 166 | + * instance. |
|
| 167 | + */ |
|
| 168 | + public function author_uri() { |
|
| 169 | + |
|
| 170 | + return new Wordlift_Post_Author_Storage( $this->entity_service, $this->user_service ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Get a {@link Wordlift_Post_Meta_Uri_Storage} instance which reads {@link WP_Post} |
|
| 175 | + * ids and maps them to URI. |
|
| 176 | + * |
|
| 177 | + * @param string $meta_key The {@link WP_Post}'s meta key. |
|
| 178 | + * |
|
| 179 | + * @return \Wordlift_Post_Meta_Uri_Storage A {@link Wordlift_Post_Meta_Uri_Storage} |
|
| 180 | + * instance. |
|
| 181 | + */ |
|
| 182 | + public function post_meta_to_uri( $meta_key ) { |
|
| 183 | + |
|
| 184 | + return new Wordlift_Post_Meta_Uri_Storage( $meta_key, $this->entity_service ); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Get a list of {@link WP_Post}'s images URI. |
|
| 189 | + * |
|
| 190 | + * @since 3.15.0 |
|
| 191 | + * |
|
| 192 | + * @return \Wordlift_Post_Image_Storage A {@link Wordlift_Post_Image_Storage} |
|
| 193 | + * instance. |
|
| 194 | + */ |
|
| 195 | + public function post_images() { |
|
| 196 | + |
|
| 197 | + return new Wordlift_Post_Image_Storage(); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Get a {@link Wordlift_Post_Related_Storage} instance to get related |
|
| 202 | + * {@link WP_Post}s. |
|
| 203 | + * |
|
| 204 | + * @since 3.15.0 |
|
| 205 | + * |
|
| 206 | + * @return \Wordlift_Post_Related_Storage A {@link Wordlift_Post_Related_Storage} |
|
| 207 | + * instance. |
|
| 208 | + */ |
|
| 209 | + public function relations() { |
|
| 210 | + |
|
| 211 | + return new Wordlift_Post_Related_Storage( $this->entity_service ); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * Get the {@link Wordlift_Url_Property_Storage} instance. |
|
| 216 | + * |
|
| 217 | + * @since 3.15.0 |
|
| 218 | + * |
|
| 219 | + * @return \Wordlift_Url_Property_Storage The {@link Wordlift_Url_Property_Storage} |
|
| 220 | + * instance. |
|
| 221 | + */ |
|
| 222 | + public function url_property() { |
|
| 223 | + |
|
| 224 | + return new Wordlift_Url_Property_Storage( $this->property_getter ); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
| 64 | 64 | * @param \Wordlift_Property_Getter $property_getter The {@link Wordlift_Property_Getter} instance. |
| 65 | 65 | */ |
| 66 | - public function __construct( $entity_service, $user_service, $property_getter ) { |
|
| 66 | + public function __construct($entity_service, $user_service, $property_getter) { |
|
| 67 | 67 | |
| 68 | 68 | $this->entity_service = $entity_service; |
| 69 | 69 | $this->user_service = $user_service; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function post_title() { |
| 97 | 97 | |
| 98 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::TITLE ); |
|
| 98 | + return new Wordlift_Post_Property_Storage(Wordlift_Post_Property_Storage::TITLE); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function post_description_no_tags_no_shortcodes() { |
| 111 | 111 | |
| 112 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES ); |
|
| 112 | + return new Wordlift_Post_Property_Storage(Wordlift_Post_Property_Storage::DESCRIPTION_NO_TAGS_NO_SHORTCODES); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function post_author() { |
| 125 | 125 | |
| 126 | - return new Wordlift_Post_Property_Storage( Wordlift_Post_Property_Storage::AUTHOR ); |
|
| 126 | + return new Wordlift_Post_Property_Storage(Wordlift_Post_Property_Storage::AUTHOR); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | * @return Wordlift_Post_Meta_Storage A {@link Wordlift_Post_Meta_Storage} |
| 138 | 138 | * instance. |
| 139 | 139 | */ |
| 140 | - public function post_meta( $meta_key ) { |
|
| 140 | + public function post_meta($meta_key) { |
|
| 141 | 141 | |
| 142 | - return new Wordlift_Post_Meta_Storage( $meta_key ); |
|
| 142 | + return new Wordlift_Post_Meta_Storage($meta_key); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function author_uri() { |
| 169 | 169 | |
| 170 | - return new Wordlift_Post_Author_Storage( $this->entity_service, $this->user_service ); |
|
| 170 | + return new Wordlift_Post_Author_Storage($this->entity_service, $this->user_service); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | * @return \Wordlift_Post_Meta_Uri_Storage A {@link Wordlift_Post_Meta_Uri_Storage} |
| 180 | 180 | * instance. |
| 181 | 181 | */ |
| 182 | - public function post_meta_to_uri( $meta_key ) { |
|
| 182 | + public function post_meta_to_uri($meta_key) { |
|
| 183 | 183 | |
| 184 | - return new Wordlift_Post_Meta_Uri_Storage( $meta_key, $this->entity_service ); |
|
| 184 | + return new Wordlift_Post_Meta_Uri_Storage($meta_key, $this->entity_service); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function relations() { |
| 210 | 210 | |
| 211 | - return new Wordlift_Post_Related_Storage( $this->entity_service ); |
|
| 211 | + return new Wordlift_Post_Related_Storage($this->entity_service); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function url_property() { |
| 223 | 223 | |
| 224 | - return new Wordlift_Url_Property_Storage( $this->property_getter ); |
|
| 224 | + return new Wordlift_Url_Property_Storage($this->property_getter); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | } |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * Loads the buttons in TinyMCE. |
| 10 | 10 | */ |
| 11 | 11 | function wl_admin_shortcode_buttons() { |
| 12 | - // Only add hooks when the current user has permissions AND is in Rich Text editor mode |
|
| 13 | - if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) { |
|
| 14 | - // add_filter( 'mce_external_plugins', 'wl_admin_shortcode_buttons_register_tinymce_javascript' ); |
|
| 15 | - add_filter( 'mce_buttons', 'wl_admin_shortcode_register_buttons' ); |
|
| 16 | - } |
|
| 12 | + // Only add hooks when the current user has permissions AND is in Rich Text editor mode |
|
| 13 | + if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) { |
|
| 14 | + // add_filter( 'mce_external_plugins', 'wl_admin_shortcode_buttons_register_tinymce_javascript' ); |
|
| 15 | + add_filter( 'mce_buttons', 'wl_admin_shortcode_register_buttons' ); |
|
| 16 | + } |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | * @return array The buttons array including the *wl_shortcodes_menu*. |
| 25 | 25 | */ |
| 26 | 26 | function wl_admin_shortcode_register_buttons( $buttons ) { |
| 27 | - array_push( $buttons, 'wl_shortcodes_menu' ); |
|
| 27 | + array_push( $buttons, 'wl_shortcodes_menu' ); |
|
| 28 | 28 | |
| 29 | - return $buttons; |
|
| 29 | + return $buttons; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // init process for button control |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | function wl_admin_shortcode_buttons() { |
| 12 | 12 | // Only add hooks when the current user has permissions AND is in Rich Text editor mode |
| 13 | - if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) { |
|
| 13 | + if ((current_user_can('edit_posts') || current_user_can('edit_pages')) && get_user_option('rich_editing')) { |
|
| 14 | 14 | // add_filter( 'mce_external_plugins', 'wl_admin_shortcode_buttons_register_tinymce_javascript' ); |
| 15 | - add_filter( 'mce_buttons', 'wl_admin_shortcode_register_buttons' ); |
|
| 15 | + add_filter('mce_buttons', 'wl_admin_shortcode_register_buttons'); |
|
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array The buttons array including the *wl_shortcodes_menu*. |
| 25 | 25 | */ |
| 26 | -function wl_admin_shortcode_register_buttons( $buttons ) { |
|
| 27 | - array_push( $buttons, 'wl_shortcodes_menu' ); |
|
| 26 | +function wl_admin_shortcode_register_buttons($buttons) { |
|
| 27 | + array_push($buttons, 'wl_shortcodes_menu'); |
|
| 28 | 28 | |
| 29 | 29 | return $buttons; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // init process for button control |
| 33 | -add_action( 'admin_init', 'wl_admin_shortcode_buttons' ); |
|
| 33 | +add_action('admin_init', 'wl_admin_shortcode_buttons'); |
|
@@ -15,47 +15,47 @@ discard block |
||
| 15 | 15 | * @subpackage Wordlift/install |
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Install_3_18_3 extends Wordlift_Install { |
| 18 | - /** |
|
| 19 | - * @inheritdoc |
|
| 20 | - */ |
|
| 21 | - protected static $version = '3.18.3'; |
|
| 18 | + /** |
|
| 19 | + * @inheritdoc |
|
| 20 | + */ |
|
| 21 | + protected static $version = '3.18.3'; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @inheritdoc |
|
| 25 | - */ |
|
| 26 | - public function install() { |
|
| 27 | - $this->set_article_term_to_posts(); |
|
| 28 | - } |
|
| 23 | + /** |
|
| 24 | + * @inheritdoc |
|
| 25 | + */ |
|
| 26 | + public function install() { |
|
| 27 | + $this->set_article_term_to_posts(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Set default article term to posts |
|
| 32 | - * that exists in `wl_relation_instances` table. |
|
| 33 | - * |
|
| 34 | - * @since 3.18.3 |
|
| 35 | - * |
|
| 36 | - * @return mixed False if the `article` doesn't exists. |
|
| 37 | - */ |
|
| 38 | - public function set_article_term_to_posts() { |
|
| 39 | - // Load the global $wpdb; |
|
| 40 | - global $wpdb; |
|
| 30 | + /** |
|
| 31 | + * Set default article term to posts |
|
| 32 | + * that exists in `wl_relation_instances` table. |
|
| 33 | + * |
|
| 34 | + * @since 3.18.3 |
|
| 35 | + * |
|
| 36 | + * @return mixed False if the `article` doesn't exists. |
|
| 37 | + */ |
|
| 38 | + public function set_article_term_to_posts() { |
|
| 39 | + // Load the global $wpdb; |
|
| 40 | + global $wpdb; |
|
| 41 | 41 | |
| 42 | - // Get the article term. |
|
| 43 | - $term = get_term_by( |
|
| 44 | - 'slug', |
|
| 45 | - 'article', |
|
| 46 | - Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME |
|
| 47 | - ); |
|
| 42 | + // Get the article term. |
|
| 43 | + $term = get_term_by( |
|
| 44 | + 'slug', |
|
| 45 | + 'article', |
|
| 46 | + Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | - // Bail if term doesn't exist. |
|
| 50 | - if ( empty( $term ) ) { |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 49 | + // Bail if term doesn't exist. |
|
| 50 | + if ( empty( $term ) ) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // Set `article` term to all posts that exists in |
|
| 55 | - // `wl_relation_instances` table and don't have `article` term set. |
|
| 56 | - $post_ids = $wpdb->get_results( |
|
| 57 | - $wpdb->prepare( |
|
| 58 | - " |
|
| 54 | + // Set `article` term to all posts that exists in |
|
| 55 | + // `wl_relation_instances` table and don't have `article` term set. |
|
| 56 | + $post_ids = $wpdb->get_results( |
|
| 57 | + $wpdb->prepare( |
|
| 58 | + " |
|
| 59 | 59 | SELECT DISTINCT p.ID |
| 60 | 60 | FROM $wpdb->posts AS p |
| 61 | 61 | INNER JOIN {$wpdb->prefix}wl_relation_instances AS ri |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | ) |
| 71 | 71 | ) |
| 72 | 72 | ", |
| 73 | - 'post', |
|
| 74 | - $term->term_id |
|
| 75 | - ) |
|
| 76 | - ); |
|
| 73 | + 'post', |
|
| 74 | + $term->term_id |
|
| 75 | + ) |
|
| 76 | + ); |
|
| 77 | 77 | |
| 78 | - // Loop through all posts and set `article` term for each one. |
|
| 79 | - foreach ($post_ids as $p) { |
|
| 80 | - wp_set_object_terms( |
|
| 81 | - (int) $p->ID, |
|
| 82 | - $term->term_id, |
|
| 83 | - Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME |
|
| 84 | - ); |
|
| 85 | - } |
|
| 86 | - } |
|
| 78 | + // Loop through all posts and set `article` term for each one. |
|
| 79 | + foreach ($post_ids as $p) { |
|
| 80 | + wp_set_object_terms( |
|
| 81 | + (int) $p->ID, |
|
| 82 | + $term->term_id, |
|
| 83 | + Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME |
|
| 84 | + ); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | 49 | // Bail if term doesn't exist. |
| 50 | - if ( empty( $term ) ) { |
|
| 50 | + if (empty($term)) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -15,68 +15,68 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Wordlift_Website_Jsonld_Converter extends Wordlift_Post_To_Jsonld_Converter { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Convert the home/blog page to a JSON-LD array. |
|
| 20 | - * |
|
| 21 | - * @since 3.14.0 |
|
| 22 | - * |
|
| 23 | - * @return array A JSON-LD array. |
|
| 24 | - */ |
|
| 25 | - public function create_schema() { |
|
| 18 | + /** |
|
| 19 | + * Convert the home/blog page to a JSON-LD array. |
|
| 20 | + * |
|
| 21 | + * @since 3.14.0 |
|
| 22 | + * |
|
| 23 | + * @return array A JSON-LD array. |
|
| 24 | + */ |
|
| 25 | + public function create_schema() { |
|
| 26 | 26 | |
| 27 | - // Create new jsonld. |
|
| 28 | - $home_url = home_url( '/' ); |
|
| 27 | + // Create new jsonld. |
|
| 28 | + $home_url = home_url( '/' ); |
|
| 29 | 29 | |
| 30 | - $jsonld = array( |
|
| 31 | - '@context' => 'http://schema.org', |
|
| 32 | - '@type' => 'WebSite', |
|
| 33 | - '@id' => "$home_url#website", |
|
| 34 | - 'name' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), |
|
| 35 | - 'alternateName' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ), |
|
| 36 | - 'url' => $home_url, |
|
| 37 | - ); |
|
| 30 | + $jsonld = array( |
|
| 31 | + '@context' => 'http://schema.org', |
|
| 32 | + '@type' => 'WebSite', |
|
| 33 | + '@id' => "$home_url#website", |
|
| 34 | + 'name' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), |
|
| 35 | + 'alternateName' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ), |
|
| 36 | + 'url' => $home_url, |
|
| 37 | + ); |
|
| 38 | 38 | |
| 39 | - // Add publisher information. |
|
| 40 | - $this->set_publisher( $jsonld ); |
|
| 39 | + // Add publisher information. |
|
| 40 | + $this->set_publisher( $jsonld ); |
|
| 41 | 41 | |
| 42 | - // Add search action. |
|
| 43 | - $this->set_search_action( $jsonld ); |
|
| 42 | + // Add search action. |
|
| 43 | + $this->set_search_action( $jsonld ); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Call the `wl_website_jsonld` filter. |
|
| 47 | - * |
|
| 48 | - * @api |
|
| 49 | - * |
|
| 50 | - * @since 3.14.0 |
|
| 51 | - * |
|
| 52 | - * @param array $jsonld The JSON-LD structure. |
|
| 53 | - */ |
|
| 54 | - return apply_filters( 'wl_website_jsonld', $jsonld ); |
|
| 55 | - } |
|
| 45 | + /** |
|
| 46 | + * Call the `wl_website_jsonld` filter. |
|
| 47 | + * |
|
| 48 | + * @api |
|
| 49 | + * |
|
| 50 | + * @since 3.14.0 |
|
| 51 | + * |
|
| 52 | + * @param array $jsonld The JSON-LD structure. |
|
| 53 | + */ |
|
| 54 | + return apply_filters( 'wl_website_jsonld', $jsonld ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Add SearchAction part to the schema |
|
| 59 | - * |
|
| 60 | - * @since 3.14.0 |
|
| 61 | - * |
|
| 62 | - * @param array $params The parameters array. |
|
| 63 | - */ |
|
| 64 | - private function set_search_action( &$params ) { |
|
| 65 | - /** |
|
| 66 | - * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL. |
|
| 67 | - * |
|
| 68 | - * @since 3.14.0 |
|
| 69 | - * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
|
| 70 | - */ |
|
| 71 | - $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 57 | + /** |
|
| 58 | + * Add SearchAction part to the schema |
|
| 59 | + * |
|
| 60 | + * @since 3.14.0 |
|
| 61 | + * |
|
| 62 | + * @param array $params The parameters array. |
|
| 63 | + */ |
|
| 64 | + private function set_search_action( &$params ) { |
|
| 65 | + /** |
|
| 66 | + * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL. |
|
| 67 | + * |
|
| 68 | + * @since 3.14.0 |
|
| 69 | + * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
|
| 70 | + */ |
|
| 71 | + $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 72 | 72 | |
| 73 | - // Add search action |
|
| 74 | - $params['potentialAction'] = array( |
|
| 75 | - '@type' => 'SearchAction', |
|
| 76 | - 'target' => $search_url, |
|
| 77 | - 'query-input' => 'required name=search_term_string', |
|
| 78 | - ); |
|
| 73 | + // Add search action |
|
| 74 | + $params['potentialAction'] = array( |
|
| 75 | + '@type' => 'SearchAction', |
|
| 76 | + 'target' => $search_url, |
|
| 77 | + 'query-input' => 'required name=search_term_string', |
|
| 78 | + ); |
|
| 79 | 79 | |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | } |
@@ -25,22 +25,22 @@ discard block |
||
| 25 | 25 | public function create_schema() { |
| 26 | 26 | |
| 27 | 27 | // Create new jsonld. |
| 28 | - $home_url = home_url( '/' ); |
|
| 28 | + $home_url = home_url('/'); |
|
| 29 | 29 | |
| 30 | 30 | $jsonld = array( |
| 31 | 31 | '@context' => 'http://schema.org', |
| 32 | 32 | '@type' => 'WebSite', |
| 33 | 33 | '@id' => "$home_url#website", |
| 34 | - 'name' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), |
|
| 35 | - 'alternateName' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ), |
|
| 34 | + 'name' => html_entity_decode(get_bloginfo('name'), ENT_QUOTES), |
|
| 35 | + 'alternateName' => html_entity_decode(get_bloginfo('description'), ENT_QUOTES), |
|
| 36 | 36 | 'url' => $home_url, |
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | // Add publisher information. |
| 40 | - $this->set_publisher( $jsonld ); |
|
| 40 | + $this->set_publisher($jsonld); |
|
| 41 | 41 | |
| 42 | 42 | // Add search action. |
| 43 | - $this->set_search_action( $jsonld ); |
|
| 43 | + $this->set_search_action($jsonld); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Call the `wl_website_jsonld` filter. |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @param array $jsonld The JSON-LD structure. |
| 53 | 53 | */ |
| 54 | - return apply_filters( 'wl_website_jsonld', $jsonld ); |
|
| 54 | + return apply_filters('wl_website_jsonld', $jsonld); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @param array $params The parameters array. |
| 63 | 63 | */ |
| 64 | - private function set_search_action( &$params ) { |
|
| 64 | + private function set_search_action(&$params) { |
|
| 65 | 65 | /** |
| 66 | 66 | * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL. |
| 67 | 67 | * |
| 68 | 68 | * @since 3.14.0 |
| 69 | 69 | * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
| 70 | 70 | */ |
| 71 | - $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 71 | + $search_url = apply_filters('wl_jsonld_search_url', home_url('/').'?s={search_term_string}'); |
|
| 72 | 72 | |
| 73 | 73 | // Add search action |
| 74 | 74 | $params['potentialAction'] = array( |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php $articles = $this->get_last_wordlift_articles(); ?> |
| 2 | 2 | <div id='news_container'> |
| 3 | - <?php if ( ! empty( $articles['posts_data'] ) ) { ?> |
|
| 4 | - <?php foreach ( $articles['posts_data'] as $key => $item ) { ?> |
|
| 3 | + <?php if ( ! empty($articles['posts_data'])) { ?> |
|
| 4 | + <?php foreach ($articles['posts_data'] as $key => $item) { ?> |
|
| 5 | 5 | <div> |
| 6 | 6 | <a target="_blank" |
| 7 | - href="<?php echo esc_url( $item['post_url'] ); ?>"><?php echo esc_html( $item['post_title'] ); ?></a> |
|
| 7 | + href="<?php echo esc_url($item['post_url']); ?>"><?php echo esc_html($item['post_title']); ?></a> |
|
| 8 | 8 | <p><?php echo $item['post_description']; ?></p> |
| 9 | 9 | </div> |
| 10 | 10 | <?php } ?> |
| 11 | 11 | <?php } ?> |
| 12 | 12 | <div> |
| 13 | 13 | <a href="#" id="max_posts_count_3" |
| 14 | - class="wl_more_posts"><?php echo esc_html__( 'More posts', 'wordlift' ); ?></a> |
|
| 14 | + class="wl_more_posts"><?php echo esc_html__('More posts', 'wordlift'); ?></a> |
|
| 15 | 15 | </div> |
| 16 | 16 | </div> |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | <br> |
| 7 | 7 | <p class="page-txt"> |
| 8 | 8 | <?php |
| 9 | - esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' ); |
|
| 10 | - ?> |
|
| 9 | + esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' ); |
|
| 10 | + ?> |
|
| 11 | 11 | </p> |
| 12 | 12 | <input |
| 13 | 13 | type="checkbox" |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <!-- Pane 2 content --> |
| 2 | 2 | <script type="text/html" id="page-1"> |
| 3 | 3 | <h2 class="page-title"> |
| 4 | - <?php esc_html_e( 'Diagnostic', 'wordlift' ); ?> |
|
| 4 | + <?php esc_html_e('Diagnostic', 'wordlift'); ?> |
|
| 5 | 5 | </h2> |
| 6 | 6 | <br> |
| 7 | 7 | <p class="page-txt"> |
| 8 | 8 | <?php |
| 9 | - esc_html_e( 'Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift' ); |
|
| 9 | + esc_html_e('Help us improve our product by automatically sending diagnostic and usage data.', 'wordlift'); |
|
| 10 | 10 | ?> |
| 11 | 11 | </p> |
| 12 | 12 | <input |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | checked |
| 18 | 18 | > |
| 19 | 19 | <label for="share-diagnostic"> |
| 20 | - <?php esc_html_e( 'Share diagnostic data', 'wordlift' ); ?> |
|
| 20 | + <?php esc_html_e('Share diagnostic data', 'wordlift'); ?> |
|
| 21 | 21 | </label> |
| 22 | 22 | |
| 23 | 23 | <p class="privacy-policy-details"> |
| 24 | 24 | <a href="https://wordlift.io/privacy-policy/" target="_blank"> |
| 25 | - <?php esc_html_e( 'About our privacy policy...', 'wordlift' ); ?> |
|
| 25 | + <?php esc_html_e('About our privacy policy...', 'wordlift'); ?> |
|
| 26 | 26 | </a> |
| 27 | 27 | </p> |
| 28 | 28 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | type="button" |
| 32 | 32 | data-wl-next="wl-next" |
| 33 | 33 | class="wl-default-action" |
| 34 | - value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>" |
|
| 34 | + value="<?php esc_attr_e('Next', 'wordlift'); ?>" |
|
| 35 | 35 | > |
| 36 | 36 | </div> |
| 37 | 37 | </script> |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <!-- Pane 6 content --> |
| 2 | 2 | <script type="text/html" id="page-5"> |
| 3 | 3 | <h2 class="page-title"> |
| 4 | - <?php esc_html_e( 'Publisher', 'wordlift' ); ?> |
|
| 4 | + <?php esc_html_e('Publisher', 'wordlift'); ?> |
|
| 5 | 5 | </h2> |
| 6 | 6 | |
| 7 | 7 | <p class="page-txt"> |
| 8 | - <?php esc_html_e( 'Are you going to publish as an individual or as a company?', 'wordlift' ); ?> |
|
| 8 | + <?php esc_html_e('Are you going to publish as an individual or as a company?', 'wordlift'); ?> |
|
| 9 | 9 | </p> |
| 10 | 10 | |
| 11 | 11 | <div class="radio-wrapper"> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | <span class="radio"><span class="check"></span></span> |
| 21 | 21 | |
| 22 | 22 | <span class="label"> |
| 23 | - <?php esc_html_e( 'Personal', 'wordlift' ); ?> |
|
| 23 | + <?php esc_html_e('Personal', 'wordlift'); ?> |
|
| 24 | 24 | </span> |
| 25 | 25 | </label> |
| 26 | 26 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | <span class="radio"><span class="check"></span></span> |
| 36 | 36 | |
| 37 | 37 | <span class="label"> |
| 38 | - <?php esc_html_e( 'Company', 'wordlift' ); ?> |
|
| 38 | + <?php esc_html_e('Company', 'wordlift'); ?> |
|
| 39 | 39 | </span> |
| 40 | 40 | </label> |
| 41 | 41 | </div> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | value="" |
| 48 | 48 | autocomplete="off" |
| 49 | 49 | class="untouched invalid" |
| 50 | - placeholder="<?php esc_attr_e( "What's your name?", 'wordlift' ); ?>" |
|
| 50 | + placeholder="<?php esc_attr_e("What's your name?", 'wordlift'); ?>" |
|
| 51 | 51 | > |
| 52 | 52 | |
| 53 | 53 | <div data-wl-logo="wl-logo"> |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | class="add-logo" |
| 66 | 66 | href="javascript:void(0);" |
| 67 | 67 | > |
| 68 | - <?php esc_html_e( 'Add your logo', 'wordlift' ); ?> |
|
| 68 | + <?php esc_html_e('Add your logo', 'wordlift'); ?> |
|
| 69 | 69 | </a> |
| 70 | 70 | </div> |
| 71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | type="submit" |
| 75 | 75 | id="btn-finish" |
| 76 | 76 | class="wl-default-action" |
| 77 | - value="<?php esc_attr_e( 'Finish', 'wordlift' ); ?>" |
|
| 77 | + value="<?php esc_attr_e('Finish', 'wordlift'); ?>" |
|
| 78 | 78 | > |
| 79 | 79 | </div> |
| 80 | 80 | </script> |
@@ -18,113 +18,113 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Schemaorg_Class_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The term meta key holding the CamelCase name for the term. The term has also a WP_Term->name |
|
| 23 | - * property which however is to be considered a customizable label (especially for languages other |
|
| 24 | - * than English). |
|
| 25 | - * |
|
| 26 | - * @since 3.20.0 |
|
| 27 | - */ |
|
| 28 | - const NAME_META_KEY = '_wl_name'; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * The term meta key holding the term URI. |
|
| 32 | - * |
|
| 33 | - * @since 3.20.0 |
|
| 34 | - */ |
|
| 35 | - const URI_META_KEY = '_wl_uri'; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * The term meta key holding the list of children terms ids. |
|
| 39 | - * |
|
| 40 | - * @since 3.20.0 |
|
| 41 | - */ |
|
| 42 | - const PARENT_OF_META_KEY = '_wl_parent_of'; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * The singleton instance. |
|
| 46 | - * |
|
| 47 | - * @since 3.20.0 |
|
| 48 | - * @access private |
|
| 49 | - * @var \Wordlift_Schemaorg_Class_Service $instance The singleton instance. |
|
| 50 | - */ |
|
| 51 | - private static $instance; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Create a {@link Wordlift_Schema_Class} instance. |
|
| 55 | - * |
|
| 56 | - * @since 3.20.0 |
|
| 57 | - */ |
|
| 58 | - public function __construct() { |
|
| 59 | - |
|
| 60 | - add_action( 'wp_ajax_wl_schemaorg_class', array( $this, 'schemaorg_class' ) ); |
|
| 61 | - |
|
| 62 | - self::$instance = $this; |
|
| 63 | - |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Get the singleton instance. |
|
| 68 | - * |
|
| 69 | - * @since 3.20.0 |
|
| 70 | - * @return \Wordlift_Schemaorg_Class_Service The singleton instance. |
|
| 71 | - */ |
|
| 72 | - public static function get_instance() { |
|
| 73 | - |
|
| 74 | - return self::$instance; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * The end-point to output the list of terms from the `wl_entity_taxonomy`. |
|
| 79 | - * |
|
| 80 | - * Example output: |
|
| 81 | - * ``` |
|
| 82 | - * { |
|
| 83 | - * "name": "AMRadioChannel", |
|
| 84 | - * "dashname": "am-radio-channel", |
|
| 85 | - * "description": "A radio channel that uses AM.", |
|
| 86 | - * "children": [] |
|
| 87 | - * } |
|
| 88 | - * ``` |
|
| 89 | - * |
|
| 90 | - * @since 3.20.0 |
|
| 91 | - */ |
|
| 92 | - public function schemaorg_class() { |
|
| 93 | - |
|
| 94 | - // Since we want to be compatible with WP 4.4, we use the pre-4.5.0 style when |
|
| 95 | - // calling `get_terms`. |
|
| 96 | - $terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array( 'get' => 'all', ) ); |
|
| 97 | - |
|
| 98 | - // PHP 5.3 compat. |
|
| 99 | - $name_meta_key = Wordlift_Schemaorg_Class_Service::NAME_META_KEY; |
|
| 100 | - $parent_of_meta_key = Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY; |
|
| 101 | - |
|
| 102 | - $json = array_map( |
|
| 103 | - function ( $term ) use ( $name_meta_key, $parent_of_meta_key ) { |
|
| 104 | - // Do not change the following, the `name` is used to reference the correct |
|
| 105 | - // Schema.org class (CamelCase name). Do not use WP_Term->name. |
|
| 106 | - $camel_case_name = get_term_meta( $term->term_id, $name_meta_key, true ); |
|
| 107 | - |
|
| 108 | - return array( |
|
| 109 | - 'id' => $term->term_id, |
|
| 110 | - // Do not change the following, the `name` is used to reference the correct |
|
| 111 | - // Schema.org class (CamelCase name). Do not use WP_Term->name. |
|
| 112 | - 'name' => $camel_case_name, |
|
| 113 | - 'dashname' => $term->slug, |
|
| 114 | - 'description' => $term->description, |
|
| 115 | - 'children' => array_map( function ( $child ) { |
|
| 116 | - // Map the slug to the term id. |
|
| 117 | - $child_term = get_term_by( 'slug', $child, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 118 | - |
|
| 119 | - return array( 'id' => $child_term->term_id ); |
|
| 120 | - }, get_term_meta( $term->term_id, $parent_of_meta_key ) ), |
|
| 121 | - ); |
|
| 122 | - |
|
| 123 | - }, $terms ); |
|
| 124 | - |
|
| 125 | - // Finally send the data. |
|
| 126 | - wp_send_json_success( array( 'schemaClasses' => $json ) ); |
|
| 127 | - |
|
| 128 | - } |
|
| 21 | + /** |
|
| 22 | + * The term meta key holding the CamelCase name for the term. The term has also a WP_Term->name |
|
| 23 | + * property which however is to be considered a customizable label (especially for languages other |
|
| 24 | + * than English). |
|
| 25 | + * |
|
| 26 | + * @since 3.20.0 |
|
| 27 | + */ |
|
| 28 | + const NAME_META_KEY = '_wl_name'; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * The term meta key holding the term URI. |
|
| 32 | + * |
|
| 33 | + * @since 3.20.0 |
|
| 34 | + */ |
|
| 35 | + const URI_META_KEY = '_wl_uri'; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * The term meta key holding the list of children terms ids. |
|
| 39 | + * |
|
| 40 | + * @since 3.20.0 |
|
| 41 | + */ |
|
| 42 | + const PARENT_OF_META_KEY = '_wl_parent_of'; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * The singleton instance. |
|
| 46 | + * |
|
| 47 | + * @since 3.20.0 |
|
| 48 | + * @access private |
|
| 49 | + * @var \Wordlift_Schemaorg_Class_Service $instance The singleton instance. |
|
| 50 | + */ |
|
| 51 | + private static $instance; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Create a {@link Wordlift_Schema_Class} instance. |
|
| 55 | + * |
|
| 56 | + * @since 3.20.0 |
|
| 57 | + */ |
|
| 58 | + public function __construct() { |
|
| 59 | + |
|
| 60 | + add_action( 'wp_ajax_wl_schemaorg_class', array( $this, 'schemaorg_class' ) ); |
|
| 61 | + |
|
| 62 | + self::$instance = $this; |
|
| 63 | + |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Get the singleton instance. |
|
| 68 | + * |
|
| 69 | + * @since 3.20.0 |
|
| 70 | + * @return \Wordlift_Schemaorg_Class_Service The singleton instance. |
|
| 71 | + */ |
|
| 72 | + public static function get_instance() { |
|
| 73 | + |
|
| 74 | + return self::$instance; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * The end-point to output the list of terms from the `wl_entity_taxonomy`. |
|
| 79 | + * |
|
| 80 | + * Example output: |
|
| 81 | + * ``` |
|
| 82 | + * { |
|
| 83 | + * "name": "AMRadioChannel", |
|
| 84 | + * "dashname": "am-radio-channel", |
|
| 85 | + * "description": "A radio channel that uses AM.", |
|
| 86 | + * "children": [] |
|
| 87 | + * } |
|
| 88 | + * ``` |
|
| 89 | + * |
|
| 90 | + * @since 3.20.0 |
|
| 91 | + */ |
|
| 92 | + public function schemaorg_class() { |
|
| 93 | + |
|
| 94 | + // Since we want to be compatible with WP 4.4, we use the pre-4.5.0 style when |
|
| 95 | + // calling `get_terms`. |
|
| 96 | + $terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array( 'get' => 'all', ) ); |
|
| 97 | + |
|
| 98 | + // PHP 5.3 compat. |
|
| 99 | + $name_meta_key = Wordlift_Schemaorg_Class_Service::NAME_META_KEY; |
|
| 100 | + $parent_of_meta_key = Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY; |
|
| 101 | + |
|
| 102 | + $json = array_map( |
|
| 103 | + function ( $term ) use ( $name_meta_key, $parent_of_meta_key ) { |
|
| 104 | + // Do not change the following, the `name` is used to reference the correct |
|
| 105 | + // Schema.org class (CamelCase name). Do not use WP_Term->name. |
|
| 106 | + $camel_case_name = get_term_meta( $term->term_id, $name_meta_key, true ); |
|
| 107 | + |
|
| 108 | + return array( |
|
| 109 | + 'id' => $term->term_id, |
|
| 110 | + // Do not change the following, the `name` is used to reference the correct |
|
| 111 | + // Schema.org class (CamelCase name). Do not use WP_Term->name. |
|
| 112 | + 'name' => $camel_case_name, |
|
| 113 | + 'dashname' => $term->slug, |
|
| 114 | + 'description' => $term->description, |
|
| 115 | + 'children' => array_map( function ( $child ) { |
|
| 116 | + // Map the slug to the term id. |
|
| 117 | + $child_term = get_term_by( 'slug', $child, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 118 | + |
|
| 119 | + return array( 'id' => $child_term->term_id ); |
|
| 120 | + }, get_term_meta( $term->term_id, $parent_of_meta_key ) ), |
|
| 121 | + ); |
|
| 122 | + |
|
| 123 | + }, $terms ); |
|
| 124 | + |
|
| 125 | + // Finally send the data. |
|
| 126 | + wp_send_json_success( array( 'schemaClasses' => $json ) ); |
|
| 127 | + |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | 130 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function __construct() { |
| 59 | 59 | |
| 60 | - add_action( 'wp_ajax_wl_schemaorg_class', array( $this, 'schemaorg_class' ) ); |
|
| 60 | + add_action('wp_ajax_wl_schemaorg_class', array($this, 'schemaorg_class')); |
|
| 61 | 61 | |
| 62 | 62 | self::$instance = $this; |
| 63 | 63 | |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // Since we want to be compatible with WP 4.4, we use the pre-4.5.0 style when |
| 95 | 95 | // calling `get_terms`. |
| 96 | - $terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array( 'get' => 'all', ) ); |
|
| 96 | + $terms = get_terms(Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array('get' => 'all',)); |
|
| 97 | 97 | |
| 98 | 98 | // PHP 5.3 compat. |
| 99 | 99 | $name_meta_key = Wordlift_Schemaorg_Class_Service::NAME_META_KEY; |
| 100 | 100 | $parent_of_meta_key = Wordlift_Schemaorg_Class_Service::PARENT_OF_META_KEY; |
| 101 | 101 | |
| 102 | 102 | $json = array_map( |
| 103 | - function ( $term ) use ( $name_meta_key, $parent_of_meta_key ) { |
|
| 103 | + function($term) use ($name_meta_key, $parent_of_meta_key) { |
|
| 104 | 104 | // Do not change the following, the `name` is used to reference the correct |
| 105 | 105 | // Schema.org class (CamelCase name). Do not use WP_Term->name. |
| 106 | - $camel_case_name = get_term_meta( $term->term_id, $name_meta_key, true ); |
|
| 106 | + $camel_case_name = get_term_meta($term->term_id, $name_meta_key, true); |
|
| 107 | 107 | |
| 108 | 108 | return array( |
| 109 | 109 | 'id' => $term->term_id, |
@@ -112,18 +112,18 @@ discard block |
||
| 112 | 112 | 'name' => $camel_case_name, |
| 113 | 113 | 'dashname' => $term->slug, |
| 114 | 114 | 'description' => $term->description, |
| 115 | - 'children' => array_map( function ( $child ) { |
|
| 115 | + 'children' => array_map(function($child) { |
|
| 116 | 116 | // Map the slug to the term id. |
| 117 | - $child_term = get_term_by( 'slug', $child, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 117 | + $child_term = get_term_by('slug', $child, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
| 118 | 118 | |
| 119 | - return array( 'id' => $child_term->term_id ); |
|
| 120 | - }, get_term_meta( $term->term_id, $parent_of_meta_key ) ), |
|
| 119 | + return array('id' => $child_term->term_id); |
|
| 120 | + }, get_term_meta($term->term_id, $parent_of_meta_key)), |
|
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | 123 | }, $terms ); |
| 124 | 124 | |
| 125 | 125 | // Finally send the data. |
| 126 | - wp_send_json_success( array( 'schemaClasses' => $json ) ); |
|
| 126 | + wp_send_json_success(array('schemaClasses' => $json)); |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |