@@ -13,64 +13,64 @@ |
||
13 | 13 | */ |
14 | 14 | class Wordlift_Debug_Service { |
15 | 15 | |
16 | - /** |
|
17 | - * The {@link Wordlift_Entity_Service} instance. |
|
18 | - * |
|
19 | - * @since 3.7.2 |
|
20 | - * @access private |
|
21 | - * @var Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
22 | - */ |
|
23 | - private $entity_service; |
|
16 | + /** |
|
17 | + * The {@link Wordlift_Entity_Service} instance. |
|
18 | + * |
|
19 | + * @since 3.7.2 |
|
20 | + * @access private |
|
21 | + * @var Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
22 | + */ |
|
23 | + private $entity_service; |
|
24 | 24 | |
25 | - /** |
|
26 | - * A {@link Wordlift_Uri_Service} instance. |
|
27 | - * |
|
28 | - * @since 3.10.0 |
|
29 | - * @access private |
|
30 | - * @var \Wordlift_Uri_Service $uri_service A {@link Wordlift_Uri_Service} instance. |
|
31 | - */ |
|
32 | - private $uri_service; |
|
25 | + /** |
|
26 | + * A {@link Wordlift_Uri_Service} instance. |
|
27 | + * |
|
28 | + * @since 3.10.0 |
|
29 | + * @access private |
|
30 | + * @var \Wordlift_Uri_Service $uri_service A {@link Wordlift_Uri_Service} instance. |
|
31 | + */ |
|
32 | + private $uri_service; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Wordlift_Debug_Service constructor. |
|
36 | - * |
|
37 | - * @since 3.7.2 |
|
38 | - * |
|
39 | - * @param Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
40 | - * @param \Wordlift_Uri_Service $uri_service A {@link Wordlift_Uri_Service} instance. |
|
41 | - */ |
|
42 | - public function __construct( $entity_service, $uri_service ) { |
|
34 | + /** |
|
35 | + * Wordlift_Debug_Service constructor. |
|
36 | + * |
|
37 | + * @since 3.7.2 |
|
38 | + * |
|
39 | + * @param Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
40 | + * @param \Wordlift_Uri_Service $uri_service A {@link Wordlift_Uri_Service} instance. |
|
41 | + */ |
|
42 | + public function __construct( $entity_service, $uri_service ) { |
|
43 | 43 | |
44 | - $this->entity_service = $entity_service; |
|
45 | - $this->uri_service = $uri_service; |
|
44 | + $this->entity_service = $entity_service; |
|
45 | + $this->uri_service = $uri_service; |
|
46 | 46 | |
47 | - add_action( 'wp_ajax_wl_dump_uri', array( $this, 'dump_uri' ) ); |
|
47 | + add_action( 'wp_ajax_wl_dump_uri', array( $this, 'dump_uri' ) ); |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public function dump_uri() { |
|
51 | + public function dump_uri() { |
|
52 | 52 | |
53 | - if ( ! isset( $_GET['id'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
54 | - wp_send_json_error( 'id not set' ); |
|
55 | - } |
|
53 | + if ( ! isset( $_GET['id'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
54 | + wp_send_json_error( 'id not set' ); |
|
55 | + } |
|
56 | 56 | |
57 | - $post_id = (int) $_GET['id']; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
57 | + $post_id = (int) $_GET['id']; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
58 | 58 | |
59 | - $post = get_post( $post_id ); |
|
59 | + $post = get_post( $post_id ); |
|
60 | 60 | |
61 | - $uri = $this->entity_service->get_uri( $post_id ); |
|
62 | - $build_uri = $this->uri_service->build_uri( $post->post_title, $post->post_type ); |
|
61 | + $uri = $this->entity_service->get_uri( $post_id ); |
|
62 | + $build_uri = $this->uri_service->build_uri( $post->post_title, $post->post_type ); |
|
63 | 63 | |
64 | - wp_send_json_success( |
|
65 | - array( |
|
66 | - 'uri' => $uri, |
|
67 | - 'post_title' => sprintf( '%s (%s)', $post->post_title, mb_detect_encoding( $post->post_title ) ), |
|
68 | - 'post_title_ascii' => mb_convert_encoding( $post->post_title, 'ASCII' ), |
|
69 | - 'build_uri' => $build_uri, |
|
70 | - 'build_uri_convert' => mb_convert_encoding( $build_uri, 'ASCII' ), |
|
71 | - ) |
|
72 | - ); |
|
64 | + wp_send_json_success( |
|
65 | + array( |
|
66 | + 'uri' => $uri, |
|
67 | + 'post_title' => sprintf( '%s (%s)', $post->post_title, mb_detect_encoding( $post->post_title ) ), |
|
68 | + 'post_title_ascii' => mb_convert_encoding( $post->post_title, 'ASCII' ), |
|
69 | + 'build_uri' => $build_uri, |
|
70 | + 'build_uri_convert' => mb_convert_encoding( $build_uri, 'ASCII' ), |
|
71 | + ) |
|
72 | + ); |
|
73 | 73 | |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | } |
@@ -39,35 +39,35 @@ |
||
39 | 39 | * @param Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
40 | 40 | * @param \Wordlift_Uri_Service $uri_service A {@link Wordlift_Uri_Service} instance. |
41 | 41 | */ |
42 | - public function __construct( $entity_service, $uri_service ) { |
|
42 | + public function __construct($entity_service, $uri_service) { |
|
43 | 43 | |
44 | 44 | $this->entity_service = $entity_service; |
45 | 45 | $this->uri_service = $uri_service; |
46 | 46 | |
47 | - add_action( 'wp_ajax_wl_dump_uri', array( $this, 'dump_uri' ) ); |
|
47 | + add_action('wp_ajax_wl_dump_uri', array($this, 'dump_uri')); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
51 | 51 | public function dump_uri() { |
52 | 52 | |
53 | - if ( ! isset( $_GET['id'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
54 | - wp_send_json_error( 'id not set' ); |
|
53 | + if ( ! isset($_GET['id'])) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
54 | + wp_send_json_error('id not set'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $post_id = (int) $_GET['id']; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
58 | 58 | |
59 | - $post = get_post( $post_id ); |
|
59 | + $post = get_post($post_id); |
|
60 | 60 | |
61 | - $uri = $this->entity_service->get_uri( $post_id ); |
|
62 | - $build_uri = $this->uri_service->build_uri( $post->post_title, $post->post_type ); |
|
61 | + $uri = $this->entity_service->get_uri($post_id); |
|
62 | + $build_uri = $this->uri_service->build_uri($post->post_title, $post->post_type); |
|
63 | 63 | |
64 | 64 | wp_send_json_success( |
65 | 65 | array( |
66 | 66 | 'uri' => $uri, |
67 | - 'post_title' => sprintf( '%s (%s)', $post->post_title, mb_detect_encoding( $post->post_title ) ), |
|
68 | - 'post_title_ascii' => mb_convert_encoding( $post->post_title, 'ASCII' ), |
|
67 | + 'post_title' => sprintf('%s (%s)', $post->post_title, mb_detect_encoding($post->post_title)), |
|
68 | + 'post_title_ascii' => mb_convert_encoding($post->post_title, 'ASCII'), |
|
69 | 69 | 'build_uri' => $build_uri, |
70 | - 'build_uri_convert' => mb_convert_encoding( $build_uri, 'ASCII' ), |
|
70 | + 'build_uri_convert' => mb_convert_encoding($build_uri, 'ASCII'), |
|
71 | 71 | ) |
72 | 72 | ); |
73 | 73 |
@@ -11,58 +11,58 @@ |
||
11 | 11 | */ |
12 | 12 | class Wordlift_Property_Factory { |
13 | 13 | |
14 | - /** |
|
15 | - * The default {@link Wordlift_Property_Service}. |
|
16 | - * |
|
17 | - * @since 3.7.0 |
|
18 | - * @access private |
|
19 | - * @var \Wordlift_Property_Service $default_property_service The default {@link Wordlift_Property_Service}. |
|
20 | - */ |
|
21 | - private $default_property_service; |
|
14 | + /** |
|
15 | + * The default {@link Wordlift_Property_Service}. |
|
16 | + * |
|
17 | + * @since 3.7.0 |
|
18 | + * @access private |
|
19 | + * @var \Wordlift_Property_Service $default_property_service The default {@link Wordlift_Property_Service}. |
|
20 | + */ |
|
21 | + private $default_property_service; |
|
22 | 22 | |
23 | - private $property_services = array(); |
|
23 | + private $property_services = array(); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Wordlift_Property_Factory constructor. |
|
27 | - * |
|
28 | - * @since 3.7.0 |
|
29 | - * |
|
30 | - * @param \Wordlift_Property_Service $default_property_service |
|
31 | - */ |
|
32 | - public function __construct( $default_property_service ) { |
|
25 | + /** |
|
26 | + * Wordlift_Property_Factory constructor. |
|
27 | + * |
|
28 | + * @since 3.7.0 |
|
29 | + * |
|
30 | + * @param \Wordlift_Property_Service $default_property_service |
|
31 | + */ |
|
32 | + public function __construct( $default_property_service ) { |
|
33 | 33 | |
34 | - $this->default_property_service = $default_property_service; |
|
34 | + $this->default_property_service = $default_property_service; |
|
35 | 35 | |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Set the {@link Wordlift_Property_Service} which handles that meta key. |
|
40 | - * |
|
41 | - * @since 3.7.0 |
|
42 | - * |
|
43 | - * @param string $meta_key WordPress' meta key. |
|
44 | - * @param \Wordlift_Property_Service $property_service A {@link Wordlift_Property_Service} instance. |
|
45 | - */ |
|
46 | - public function register( $meta_key, $property_service ) { |
|
38 | + /** |
|
39 | + * Set the {@link Wordlift_Property_Service} which handles that meta key. |
|
40 | + * |
|
41 | + * @since 3.7.0 |
|
42 | + * |
|
43 | + * @param string $meta_key WordPress' meta key. |
|
44 | + * @param \Wordlift_Property_Service $property_service A {@link Wordlift_Property_Service} instance. |
|
45 | + */ |
|
46 | + public function register( $meta_key, $property_service ) { |
|
47 | 47 | |
48 | - $this->property_services[ $meta_key ] = $property_service; |
|
48 | + $this->property_services[ $meta_key ] = $property_service; |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get the {@link Wordlift_Property_Service} which handles the specified meta key. |
|
54 | - * |
|
55 | - * @since 3.7.0 |
|
56 | - * |
|
57 | - * @param $meta_key |
|
58 | - * |
|
59 | - * @return \Wordlift_Property_Service The {@link Wordlift_Property_Service} which handles the specified meta key. |
|
60 | - */ |
|
61 | - public function get( $meta_key ) { |
|
52 | + /** |
|
53 | + * Get the {@link Wordlift_Property_Service} which handles the specified meta key. |
|
54 | + * |
|
55 | + * @since 3.7.0 |
|
56 | + * |
|
57 | + * @param $meta_key |
|
58 | + * |
|
59 | + * @return \Wordlift_Property_Service The {@link Wordlift_Property_Service} which handles the specified meta key. |
|
60 | + */ |
|
61 | + public function get( $meta_key ) { |
|
62 | 62 | |
63 | - $service = $this->property_services[ $meta_key ]; |
|
63 | + $service = $this->property_services[ $meta_key ]; |
|
64 | 64 | |
65 | - return $service ? $service : $this->default_property_service; |
|
66 | - } |
|
65 | + return $service ? $service : $this->default_property_service; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param \Wordlift_Property_Service $default_property_service |
31 | 31 | */ |
32 | - public function __construct( $default_property_service ) { |
|
32 | + public function __construct($default_property_service) { |
|
33 | 33 | |
34 | 34 | $this->default_property_service = $default_property_service; |
35 | 35 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param string $meta_key WordPress' meta key. |
44 | 44 | * @param \Wordlift_Property_Service $property_service A {@link Wordlift_Property_Service} instance. |
45 | 45 | */ |
46 | - public function register( $meta_key, $property_service ) { |
|
46 | + public function register($meta_key, $property_service) { |
|
47 | 47 | |
48 | - $this->property_services[ $meta_key ] = $property_service; |
|
48 | + $this->property_services[$meta_key] = $property_service; |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return \Wordlift_Property_Service The {@link Wordlift_Property_Service} which handles the specified meta key. |
60 | 60 | */ |
61 | - public function get( $meta_key ) { |
|
61 | + public function get($meta_key) { |
|
62 | 62 | |
63 | - $service = $this->property_services[ $meta_key ]; |
|
63 | + $service = $this->property_services[$meta_key]; |
|
64 | 64 | |
65 | 65 | return $service ? $service : $this->default_property_service; |
66 | 66 | } |
@@ -18,46 +18,46 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Post_Image_Storage extends Wordlift_Storage { |
20 | 20 | |
21 | - /** |
|
22 | - * Get the property value. |
|
23 | - * |
|
24 | - * @param int $post_id The {@link WP_Post}'s id. |
|
25 | - * |
|
26 | - * @return array|string|null A single string, or an array of values or null |
|
27 | - * if the property isn't recognized. |
|
28 | - * @since 3.15.0 |
|
29 | - */ |
|
30 | - public function get( $post_id ) { |
|
31 | - |
|
32 | - // Prepare the return array. |
|
33 | - $image_urls = array(); |
|
34 | - |
|
35 | - // If there is a featured image it has the priority. |
|
36 | - $featured_image_id = get_post_thumbnail_id( $post_id ); |
|
37 | - if ( is_numeric( $featured_image_id ) && 0 < $featured_image_id ) { |
|
38 | - $image_url = wp_get_attachment_url( $featured_image_id ); |
|
39 | - |
|
40 | - $image_urls[] = $image_url; |
|
41 | - } |
|
42 | - |
|
43 | - $images = get_children( |
|
44 | - array( |
|
45 | - 'post_parent' => $post_id, |
|
46 | - 'post_type' => 'attachment', |
|
47 | - 'post_mime_type' => 'image', |
|
48 | - ) |
|
49 | - ); |
|
50 | - |
|
51 | - // Collect the URLs. |
|
52 | - foreach ( $images as $attachment_id => $attachment ) { |
|
53 | - $image_url = wp_get_attachment_url( $attachment_id ); |
|
54 | - // Ensure the URL isn't collected already. |
|
55 | - if ( ! in_array( $image_url, $image_urls, true ) ) { |
|
56 | - array_push( $image_urls, $image_url ); |
|
57 | - } |
|
58 | - } |
|
59 | - |
|
60 | - return $image_urls; |
|
61 | - } |
|
21 | + /** |
|
22 | + * Get the property value. |
|
23 | + * |
|
24 | + * @param int $post_id The {@link WP_Post}'s id. |
|
25 | + * |
|
26 | + * @return array|string|null A single string, or an array of values or null |
|
27 | + * if the property isn't recognized. |
|
28 | + * @since 3.15.0 |
|
29 | + */ |
|
30 | + public function get( $post_id ) { |
|
31 | + |
|
32 | + // Prepare the return array. |
|
33 | + $image_urls = array(); |
|
34 | + |
|
35 | + // If there is a featured image it has the priority. |
|
36 | + $featured_image_id = get_post_thumbnail_id( $post_id ); |
|
37 | + if ( is_numeric( $featured_image_id ) && 0 < $featured_image_id ) { |
|
38 | + $image_url = wp_get_attachment_url( $featured_image_id ); |
|
39 | + |
|
40 | + $image_urls[] = $image_url; |
|
41 | + } |
|
42 | + |
|
43 | + $images = get_children( |
|
44 | + array( |
|
45 | + 'post_parent' => $post_id, |
|
46 | + 'post_type' => 'attachment', |
|
47 | + 'post_mime_type' => 'image', |
|
48 | + ) |
|
49 | + ); |
|
50 | + |
|
51 | + // Collect the URLs. |
|
52 | + foreach ( $images as $attachment_id => $attachment ) { |
|
53 | + $image_url = wp_get_attachment_url( $attachment_id ); |
|
54 | + // Ensure the URL isn't collected already. |
|
55 | + if ( ! in_array( $image_url, $image_urls, true ) ) { |
|
56 | + array_push( $image_urls, $image_url ); |
|
57 | + } |
|
58 | + } |
|
59 | + |
|
60 | + return $image_urls; |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | * if the property isn't recognized. |
28 | 28 | * @since 3.15.0 |
29 | 29 | */ |
30 | - public function get( $post_id ) { |
|
30 | + public function get($post_id) { |
|
31 | 31 | |
32 | 32 | // Prepare the return array. |
33 | 33 | $image_urls = array(); |
34 | 34 | |
35 | 35 | // If there is a featured image it has the priority. |
36 | - $featured_image_id = get_post_thumbnail_id( $post_id ); |
|
37 | - if ( is_numeric( $featured_image_id ) && 0 < $featured_image_id ) { |
|
38 | - $image_url = wp_get_attachment_url( $featured_image_id ); |
|
36 | + $featured_image_id = get_post_thumbnail_id($post_id); |
|
37 | + if (is_numeric($featured_image_id) && 0 < $featured_image_id) { |
|
38 | + $image_url = wp_get_attachment_url($featured_image_id); |
|
39 | 39 | |
40 | 40 | $image_urls[] = $image_url; |
41 | 41 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | ); |
50 | 50 | |
51 | 51 | // Collect the URLs. |
52 | - foreach ( $images as $attachment_id => $attachment ) { |
|
53 | - $image_url = wp_get_attachment_url( $attachment_id ); |
|
52 | + foreach ($images as $attachment_id => $attachment) { |
|
53 | + $image_url = wp_get_attachment_url($attachment_id); |
|
54 | 54 | // Ensure the URL isn't collected already. |
55 | - if ( ! in_array( $image_url, $image_urls, true ) ) { |
|
56 | - array_push( $image_urls, $image_url ); |
|
55 | + if ( ! in_array($image_url, $image_urls, true)) { |
|
56 | + array_push($image_urls, $image_url); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |
@@ -18,53 +18,53 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Post_Meta_Uri_Storage extends Wordlift_Post_Meta_Storage { |
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; |
|
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 | 29 | |
30 | - /** |
|
31 | - * Create a {@link Wordlift_Post_Meta_Uri_Storage} instance. |
|
32 | - * |
|
33 | - * @since 3.15.0 |
|
34 | - * |
|
35 | - * @param string $meta_key The meta key to read data from. |
|
36 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
37 | - */ |
|
38 | - public function __construct( $meta_key, $entity_service ) { |
|
39 | - parent::__construct( $meta_key ); |
|
30 | + /** |
|
31 | + * Create a {@link Wordlift_Post_Meta_Uri_Storage} instance. |
|
32 | + * |
|
33 | + * @since 3.15.0 |
|
34 | + * |
|
35 | + * @param string $meta_key The meta key to read data from. |
|
36 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
37 | + */ |
|
38 | + public function __construct( $meta_key, $entity_service ) { |
|
39 | + parent::__construct( $meta_key ); |
|
40 | 40 | |
41 | - $this->entity_service = $entity_service; |
|
41 | + $this->entity_service = $entity_service; |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Get the value for the specified meta key. |
|
47 | - * |
|
48 | - * The value is expected to be an entity post, for which the URI is loaded |
|
49 | - * and returned. |
|
50 | - * |
|
51 | - * @since 3.15.0 |
|
52 | - * |
|
53 | - * @param int $post_id The {@link WP_Post}'s id. |
|
54 | - * |
|
55 | - * @return array An array of URIs (or an empty array if nothing is set). |
|
56 | - */ |
|
57 | - public function get( $post_id ) { |
|
58 | - $values = parent::get( $post_id ); |
|
45 | + /** |
|
46 | + * Get the value for the specified meta key. |
|
47 | + * |
|
48 | + * The value is expected to be an entity post, for which the URI is loaded |
|
49 | + * and returned. |
|
50 | + * |
|
51 | + * @since 3.15.0 |
|
52 | + * |
|
53 | + * @param int $post_id The {@link WP_Post}'s id. |
|
54 | + * |
|
55 | + * @return array An array of URIs (or an empty array if nothing is set). |
|
56 | + */ |
|
57 | + public function get( $post_id ) { |
|
58 | + $values = parent::get( $post_id ); |
|
59 | 59 | |
60 | - $entity_service = $this->entity_service; |
|
60 | + $entity_service = $this->entity_service; |
|
61 | 61 | |
62 | - return array_map( |
|
63 | - function ( $item ) use ( $entity_service ) { |
|
64 | - return $entity_service->get_uri( $item ); |
|
65 | - }, |
|
66 | - $values |
|
67 | - ); |
|
68 | - } |
|
62 | + return array_map( |
|
63 | + function ( $item ) use ( $entity_service ) { |
|
64 | + return $entity_service->get_uri( $item ); |
|
65 | + }, |
|
66 | + $values |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param string $meta_key The meta key to read data from. |
36 | 36 | * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
37 | 37 | */ |
38 | - public function __construct( $meta_key, $entity_service ) { |
|
39 | - parent::__construct( $meta_key ); |
|
38 | + public function __construct($meta_key, $entity_service) { |
|
39 | + parent::__construct($meta_key); |
|
40 | 40 | |
41 | 41 | $this->entity_service = $entity_service; |
42 | 42 | |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return array An array of URIs (or an empty array if nothing is set). |
56 | 56 | */ |
57 | - public function get( $post_id ) { |
|
58 | - $values = parent::get( $post_id ); |
|
57 | + public function get($post_id) { |
|
58 | + $values = parent::get($post_id); |
|
59 | 59 | |
60 | 60 | $entity_service = $this->entity_service; |
61 | 61 | |
62 | 62 | return array_map( |
63 | - function ( $item ) use ( $entity_service ) { |
|
64 | - return $entity_service->get_uri( $item ); |
|
63 | + function($item) use ($entity_service) { |
|
64 | + return $entity_service->get_uri($item); |
|
65 | 65 | }, |
66 | 66 | $values |
67 | 67 | ); |
@@ -18,52 +18,52 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Post_Taxonomy_Storage extends Wordlift_Storage { |
20 | 20 | |
21 | - /** |
|
22 | - * The taxonomy name. |
|
23 | - * |
|
24 | - * @since 3.15.0 |
|
25 | - * @access private |
|
26 | - * @var string $taxonomy The taxonomy name. |
|
27 | - */ |
|
28 | - private $taxonomy; |
|
21 | + /** |
|
22 | + * The taxonomy name. |
|
23 | + * |
|
24 | + * @since 3.15.0 |
|
25 | + * @access private |
|
26 | + * @var string $taxonomy The taxonomy name. |
|
27 | + */ |
|
28 | + private $taxonomy; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Create a {@link Wordlift_Post_Taxonomy_Storage} with the specified |
|
32 | - * taxonomy name. |
|
33 | - * |
|
34 | - * @since 3.15.0 |
|
35 | - * |
|
36 | - * @param string $taxonomy The taxonomy name. |
|
37 | - */ |
|
38 | - public function __construct( $taxonomy ) { |
|
30 | + /** |
|
31 | + * Create a {@link Wordlift_Post_Taxonomy_Storage} with the specified |
|
32 | + * taxonomy name. |
|
33 | + * |
|
34 | + * @since 3.15.0 |
|
35 | + * |
|
36 | + * @param string $taxonomy The taxonomy name. |
|
37 | + */ |
|
38 | + public function __construct( $taxonomy ) { |
|
39 | 39 | |
40 | - $this->taxonomy = $taxonomy; |
|
41 | - } |
|
40 | + $this->taxonomy = $taxonomy; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the taxonomy's terms associated with the specified {@link WP_Post}. |
|
45 | - * |
|
46 | - * @since 3.15.0 |
|
47 | - * |
|
48 | - * @param int $post_id The {@link WP_Post}'s id. |
|
49 | - * |
|
50 | - * @return array|WP_Error An array of terms or {@link WP_Error} in case of error. |
|
51 | - */ |
|
52 | - public function get( $post_id ) { |
|
43 | + /** |
|
44 | + * Get the taxonomy's terms associated with the specified {@link WP_Post}. |
|
45 | + * |
|
46 | + * @since 3.15.0 |
|
47 | + * |
|
48 | + * @param int $post_id The {@link WP_Post}'s id. |
|
49 | + * |
|
50 | + * @return array|WP_Error An array of terms or {@link WP_Error} in case of error. |
|
51 | + */ |
|
52 | + public function get( $post_id ) { |
|
53 | 53 | |
54 | - return wp_get_post_terms( |
|
55 | - $post_id, |
|
56 | - $this->taxonomy, |
|
57 | - array( |
|
58 | - 'hide_empty' => false, |
|
59 | - // Because of #334 (and the AAM plugin) we changed fields from 'id=>slug' to 'all'. |
|
60 | - // An issue has been opened with the AAM plugin author as well. |
|
61 | - // |
|
62 | - // see https://github.com/insideout10/wordlift-plugin/issues/334 |
|
63 | - // see https://wordpress.org/support/topic/idslug-not-working-anymore?replies=1#post-8806863 |
|
64 | - 'fields' => 'all', |
|
65 | - ) |
|
66 | - ); |
|
67 | - } |
|
54 | + return wp_get_post_terms( |
|
55 | + $post_id, |
|
56 | + $this->taxonomy, |
|
57 | + array( |
|
58 | + 'hide_empty' => false, |
|
59 | + // Because of #334 (and the AAM plugin) we changed fields from 'id=>slug' to 'all'. |
|
60 | + // An issue has been opened with the AAM plugin author as well. |
|
61 | + // |
|
62 | + // see https://github.com/insideout10/wordlift-plugin/issues/334 |
|
63 | + // see https://wordpress.org/support/topic/idslug-not-working-anymore?replies=1#post-8806863 |
|
64 | + 'fields' => 'all', |
|
65 | + ) |
|
66 | + ); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $taxonomy The taxonomy name. |
37 | 37 | */ |
38 | - public function __construct( $taxonomy ) { |
|
38 | + public function __construct($taxonomy) { |
|
39 | 39 | |
40 | 40 | $this->taxonomy = $taxonomy; |
41 | 41 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return array|WP_Error An array of terms or {@link WP_Error} in case of error. |
51 | 51 | */ |
52 | - public function get( $post_id ) { |
|
52 | + public function get($post_id) { |
|
53 | 53 | |
54 | 54 | return wp_get_post_terms( |
55 | 55 | $post_id, |
@@ -18,37 +18,37 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Post_Schema_Class_Storage extends Wordlift_Storage { |
20 | 20 | |
21 | - /** |
|
22 | - * Get the schema class for the specified {@link WP_Post}. |
|
23 | - * |
|
24 | - * @since 3.15.0 |
|
25 | - * |
|
26 | - * @param int $post_id The {@link WP_Post}'s id. |
|
27 | - * |
|
28 | - * @return string|array An array of schema classes. |
|
29 | - */ |
|
30 | - public function get( $post_id ) { |
|
31 | - |
|
32 | - // Get the type names (CamelCase). |
|
33 | - $names = Wordlift_Entity_Type_Service::get_instance()->get_names( $post_id ); |
|
34 | - |
|
35 | - // If we don't find any type use the legacy function to get the URI. |
|
36 | - if ( empty( $names ) ) { |
|
37 | - $type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id ); |
|
38 | - |
|
39 | - return $type['uri']; |
|
40 | - } |
|
41 | - |
|
42 | - // Prepend the `schema.org` base URI. |
|
43 | - $uris = array_map( |
|
44 | - function ( $item ) { |
|
45 | - return "http://schema.org/$item"; |
|
46 | - }, |
|
47 | - $names |
|
48 | - ); |
|
49 | - |
|
50 | - // Finally return the schema uri. |
|
51 | - return 1 === count( $uris ) ? $uris[0] : $uris; |
|
52 | - } |
|
21 | + /** |
|
22 | + * Get the schema class for the specified {@link WP_Post}. |
|
23 | + * |
|
24 | + * @since 3.15.0 |
|
25 | + * |
|
26 | + * @param int $post_id The {@link WP_Post}'s id. |
|
27 | + * |
|
28 | + * @return string|array An array of schema classes. |
|
29 | + */ |
|
30 | + public function get( $post_id ) { |
|
31 | + |
|
32 | + // Get the type names (CamelCase). |
|
33 | + $names = Wordlift_Entity_Type_Service::get_instance()->get_names( $post_id ); |
|
34 | + |
|
35 | + // If we don't find any type use the legacy function to get the URI. |
|
36 | + if ( empty( $names ) ) { |
|
37 | + $type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id ); |
|
38 | + |
|
39 | + return $type['uri']; |
|
40 | + } |
|
41 | + |
|
42 | + // Prepend the `schema.org` base URI. |
|
43 | + $uris = array_map( |
|
44 | + function ( $item ) { |
|
45 | + return "http://schema.org/$item"; |
|
46 | + }, |
|
47 | + $names |
|
48 | + ); |
|
49 | + |
|
50 | + // Finally return the schema uri. |
|
51 | + return 1 === count( $uris ) ? $uris[0] : $uris; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
@@ -27,28 +27,28 @@ |
||
27 | 27 | * |
28 | 28 | * @return string|array An array of schema classes. |
29 | 29 | */ |
30 | - public function get( $post_id ) { |
|
30 | + public function get($post_id) { |
|
31 | 31 | |
32 | 32 | // Get the type names (CamelCase). |
33 | - $names = Wordlift_Entity_Type_Service::get_instance()->get_names( $post_id ); |
|
33 | + $names = Wordlift_Entity_Type_Service::get_instance()->get_names($post_id); |
|
34 | 34 | |
35 | 35 | // If we don't find any type use the legacy function to get the URI. |
36 | - if ( empty( $names ) ) { |
|
37 | - $type = Wordlift_Entity_Type_Service::get_instance()->get( $post_id ); |
|
36 | + if (empty($names)) { |
|
37 | + $type = Wordlift_Entity_Type_Service::get_instance()->get($post_id); |
|
38 | 38 | |
39 | 39 | return $type['uri']; |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Prepend the `schema.org` base URI. |
43 | 43 | $uris = array_map( |
44 | - function ( $item ) { |
|
44 | + function($item) { |
|
45 | 45 | return "http://schema.org/$item"; |
46 | 46 | }, |
47 | 47 | $names |
48 | 48 | ); |
49 | 49 | |
50 | 50 | // Finally return the schema uri. |
51 | - return 1 === count( $uris ) ? $uris[0] : $uris; |
|
51 | + return 1 === count($uris) ? $uris[0] : $uris; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |
@@ -21,56 +21,56 @@ |
||
21 | 21 | */ |
22 | 22 | class Wordlift_Post_Related_Storage extends Wordlift_Storage { |
23 | 23 | |
24 | - /** |
|
25 | - * The {@link Wordlift_Entity_Service} instance. |
|
26 | - * |
|
27 | - * @since 3.15.0 |
|
28 | - * @access private |
|
29 | - * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
30 | - */ |
|
31 | - private $entity_service; |
|
24 | + /** |
|
25 | + * The {@link Wordlift_Entity_Service} instance. |
|
26 | + * |
|
27 | + * @since 3.15.0 |
|
28 | + * @access private |
|
29 | + * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
30 | + */ |
|
31 | + private $entity_service; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Create a {@link Wordlift_Post_Related_Storage} instance. |
|
35 | - * |
|
36 | - * @since 3.15.0 |
|
37 | - * |
|
38 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
39 | - */ |
|
40 | - public function __construct( $entity_service ) { |
|
33 | + /** |
|
34 | + * Create a {@link Wordlift_Post_Related_Storage} instance. |
|
35 | + * |
|
36 | + * @since 3.15.0 |
|
37 | + * |
|
38 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
39 | + */ |
|
40 | + public function __construct( $entity_service ) { |
|
41 | 41 | |
42 | - $this->entity_service = $entity_service; |
|
42 | + $this->entity_service = $entity_service; |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the property value. |
|
48 | - * |
|
49 | - * There is no filter for entities or posts, the returned data here can |
|
50 | - * be used for `relations` and `references` according to the client. |
|
51 | - * |
|
52 | - * @since 3.15.0 |
|
53 | - * |
|
54 | - * @param int $post_id The {@link WP_Post}'s id. |
|
55 | - * |
|
56 | - * @return array|string|null A single string, or an array of values or null |
|
57 | - * if the property isn't recognized. |
|
58 | - */ |
|
59 | - public function get( $post_id ) { |
|
46 | + /** |
|
47 | + * Get the property value. |
|
48 | + * |
|
49 | + * There is no filter for entities or posts, the returned data here can |
|
50 | + * be used for `relations` and `references` according to the client. |
|
51 | + * |
|
52 | + * @since 3.15.0 |
|
53 | + * |
|
54 | + * @param int $post_id The {@link WP_Post}'s id. |
|
55 | + * |
|
56 | + * @return array|string|null A single string, or an array of values or null |
|
57 | + * if the property isn't recognized. |
|
58 | + */ |
|
59 | + public function get( $post_id ) { |
|
60 | 60 | |
61 | - // get related entities. |
|
62 | - $related = wl_core_get_related_entity_ids( $post_id ); |
|
61 | + // get related entities. |
|
62 | + $related = wl_core_get_related_entity_ids( $post_id ); |
|
63 | 63 | |
64 | - // A reference to the entity service. |
|
65 | - $entity_service = $this->entity_service; |
|
64 | + // A reference to the entity service. |
|
65 | + $entity_service = $this->entity_service; |
|
66 | 66 | |
67 | - // Map the related posts' ids to URIs. |
|
68 | - return array_map( |
|
69 | - function ( $item ) use ( $entity_service ) { |
|
70 | - return $entity_service->get_uri( $item ); |
|
71 | - }, |
|
72 | - $related |
|
73 | - ); |
|
74 | - } |
|
67 | + // Map the related posts' ids to URIs. |
|
68 | + return array_map( |
|
69 | + function ( $item ) use ( $entity_service ) { |
|
70 | + return $entity_service->get_uri( $item ); |
|
71 | + }, |
|
72 | + $related |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
39 | 39 | */ |
40 | - public function __construct( $entity_service ) { |
|
40 | + public function __construct($entity_service) { |
|
41 | 41 | |
42 | 42 | $this->entity_service = $entity_service; |
43 | 43 | |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | * @return array|string|null A single string, or an array of values or null |
57 | 57 | * if the property isn't recognized. |
58 | 58 | */ |
59 | - public function get( $post_id ) { |
|
59 | + public function get($post_id) { |
|
60 | 60 | |
61 | 61 | // get related entities. |
62 | - $related = wl_core_get_related_entity_ids( $post_id ); |
|
62 | + $related = wl_core_get_related_entity_ids($post_id); |
|
63 | 63 | |
64 | 64 | // A reference to the entity service. |
65 | 65 | $entity_service = $this->entity_service; |
66 | 66 | |
67 | 67 | // Map the related posts' ids to URIs. |
68 | 68 | return array_map( |
69 | - function ( $item ) use ( $entity_service ) { |
|
70 | - return $entity_service->get_uri( $item ); |
|
69 | + function($item) use ($entity_service) { |
|
70 | + return $entity_service->get_uri($item); |
|
71 | 71 | }, |
72 | 72 | $related |
73 | 73 | ); |
@@ -14,77 +14,77 @@ |
||
14 | 14 | */ |
15 | 15 | class Wordlift_Tinymce_Adapter { |
16 | 16 | |
17 | - /** |
|
18 | - * The {@link Wordlift} plugin instance. |
|
19 | - * |
|
20 | - * @since 3.12.0 |
|
21 | - * @access private |
|
22 | - * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
23 | - */ |
|
24 | - private $plugin; |
|
17 | + /** |
|
18 | + * The {@link Wordlift} plugin instance. |
|
19 | + * |
|
20 | + * @since 3.12.0 |
|
21 | + * @access private |
|
22 | + * @var \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
23 | + */ |
|
24 | + private $plugin; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Wordlift_Tinymce_Adapter constructor. |
|
28 | - * |
|
29 | - * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
30 | - */ |
|
31 | - public function __construct( $plugin ) { |
|
26 | + /** |
|
27 | + * Wordlift_Tinymce_Adapter constructor. |
|
28 | + * |
|
29 | + * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
|
30 | + */ |
|
31 | + public function __construct( $plugin ) { |
|
32 | 32 | |
33 | - $this->plugin = $plugin; |
|
33 | + $this->plugin = $plugin; |
|
34 | 34 | |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook. |
|
39 | - * |
|
40 | - * @param array $plugins The existing plugins array. |
|
41 | - * |
|
42 | - * @return array The modified plugins array. |
|
43 | - * @since 3.12.0 |
|
44 | - */ |
|
45 | - public function mce_external_plugins( $plugins ) { |
|
37 | + /** |
|
38 | + * Load the TinyMCE plugin. This method is called by the WP mce_external_plugins hook. |
|
39 | + * |
|
40 | + * @param array $plugins The existing plugins array. |
|
41 | + * |
|
42 | + * @return array The modified plugins array. |
|
43 | + * @since 3.12.0 |
|
44 | + */ |
|
45 | + public function mce_external_plugins( $plugins ) { |
|
46 | 46 | |
47 | - /** |
|
48 | - * Bail out if you are on Media Library |
|
49 | - * |
|
50 | - * @since 3.27.1 |
|
51 | - * |
|
52 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1122 |
|
53 | - */ |
|
54 | - if ( isset( get_current_screen()->base ) && get_current_screen()->base === 'upload' ) { |
|
55 | - return $plugins; |
|
56 | - } |
|
47 | + /** |
|
48 | + * Bail out if you are on Media Library |
|
49 | + * |
|
50 | + * @since 3.27.1 |
|
51 | + * |
|
52 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1122 |
|
53 | + */ |
|
54 | + if ( isset( get_current_screen()->base ) && get_current_screen()->base === 'upload' ) { |
|
55 | + return $plugins; |
|
56 | + } |
|
57 | 57 | |
58 | - /* |
|
58 | + /* |
|
59 | 59 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
60 | 60 | * |
61 | 61 | * @since 3.20.3 |
62 | 62 | * |
63 | 63 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
64 | 64 | */ |
65 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
66 | - return $plugins; |
|
67 | - } |
|
65 | + if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
66 | + return $plugins; |
|
67 | + } |
|
68 | 68 | |
69 | - // Get WordLift's version as a cache killer. |
|
70 | - $version = $this->plugin->get_version(); |
|
69 | + // Get WordLift's version as a cache killer. |
|
70 | + $version = $this->plugin->get_version(); |
|
71 | 71 | |
72 | - // User can edit? |
|
73 | - $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
72 | + // User can edit? |
|
73 | + $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
74 | 74 | |
75 | - // If user can't edit or rich editing isn't enabled, bail out. |
|
76 | - if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
77 | - return $plugins; |
|
78 | - } |
|
75 | + // If user can't edit or rich editing isn't enabled, bail out. |
|
76 | + if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
77 | + return $plugins; |
|
78 | + } |
|
79 | 79 | |
80 | - // Add our own JavaScript file to TinyMCE's extensions. |
|
81 | - // DO NOT use the minified version, it'll yield errors with AngularJS. |
|
82 | - $plugins['wordlift'] = plugin_dir_url( __DIR__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
83 | - $plugins['wl_shortcodes'] = plugin_dir_url( __DIR__ ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
84 | - $plugins['wl_tinymce'] = plugin_dir_url( __DIR__ ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
85 | - $plugins['wl_tinymce_2'] = plugin_dir_url( __DIR__ ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
80 | + // Add our own JavaScript file to TinyMCE's extensions. |
|
81 | + // DO NOT use the minified version, it'll yield errors with AngularJS. |
|
82 | + $plugins['wordlift'] = plugin_dir_url( __DIR__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
83 | + $plugins['wl_shortcodes'] = plugin_dir_url( __DIR__ ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
84 | + $plugins['wl_tinymce'] = plugin_dir_url( __DIR__ ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
85 | + $plugins['wl_tinymce_2'] = plugin_dir_url( __DIR__ ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
86 | 86 | |
87 | - return $plugins; |
|
88 | - } |
|
87 | + return $plugins; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param \Wordlift $plugin The {@link Wordlift} plugin instance. |
30 | 30 | */ |
31 | - public function __construct( $plugin ) { |
|
31 | + public function __construct($plugin) { |
|
32 | 32 | |
33 | 33 | $this->plugin = $plugin; |
34 | 34 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return array The modified plugins array. |
43 | 43 | * @since 3.12.0 |
44 | 44 | */ |
45 | - public function mce_external_plugins( $plugins ) { |
|
45 | + public function mce_external_plugins($plugins) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Bail out if you are on Media Library |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @see https://github.com/insideout10/wordlift-plugin/issues/1122 |
53 | 53 | */ |
54 | - if ( isset( get_current_screen()->base ) && get_current_screen()->base === 'upload' ) { |
|
54 | + if (isset(get_current_screen()->base) && get_current_screen()->base === 'upload') { |
|
55 | 55 | return $plugins; |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
64 | 64 | */ |
65 | - if ( ! apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
65 | + if ( ! apply_filters('wl_can_see_classification_box', true)) { |
|
66 | 66 | return $plugins; |
67 | 67 | } |
68 | 68 | |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | $version = $this->plugin->get_version(); |
71 | 71 | |
72 | 72 | // User can edit? |
73 | - $can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); |
|
73 | + $can_edit = current_user_can('edit_posts') || current_user_can('edit_pages'); |
|
74 | 74 | |
75 | 75 | // If user can't edit or rich editing isn't enabled, bail out. |
76 | - if ( ! $can_edit || ! get_user_option( 'rich_editing' ) ) { |
|
76 | + if ( ! $can_edit || ! get_user_option('rich_editing')) { |
|
77 | 77 | return $plugins; |
78 | 78 | } |
79 | 79 | |
80 | 80 | // Add our own JavaScript file to TinyMCE's extensions. |
81 | 81 | // DO NOT use the minified version, it'll yield errors with AngularJS. |
82 | - $plugins['wordlift'] = plugin_dir_url( __DIR__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
83 | - $plugins['wl_shortcodes'] = plugin_dir_url( __DIR__ ) . 'admin/js/wordlift_shortcode_tinymce_plugin.js?ver=' . $version; |
|
84 | - $plugins['wl_tinymce'] = plugin_dir_url( __DIR__ ) . 'admin/js/1/tinymce.js?ver=' . $version; |
|
85 | - $plugins['wl_tinymce_2'] = plugin_dir_url( __DIR__ ) . 'js/dist/tiny-mce.js?ver=' . $version; |
|
82 | + $plugins['wordlift'] = plugin_dir_url(__DIR__).'js/wordlift-reloaded.js?ver='.$version; |
|
83 | + $plugins['wl_shortcodes'] = plugin_dir_url(__DIR__).'admin/js/wordlift_shortcode_tinymce_plugin.js?ver='.$version; |
|
84 | + $plugins['wl_tinymce'] = plugin_dir_url(__DIR__).'admin/js/1/tinymce.js?ver='.$version; |
|
85 | + $plugins['wl_tinymce_2'] = plugin_dir_url(__DIR__).'js/dist/tiny-mce.js?ver='.$version; |
|
86 | 86 | |
87 | 87 | return $plugins; |
88 | 88 | } |
@@ -14,118 +14,118 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class Wordlift_Property_Service { |
16 | 16 | |
17 | - protected static $instance; |
|
18 | - |
|
19 | - public function __construct() { |
|
20 | - |
|
21 | - static::$instance = $this; |
|
22 | - } |
|
23 | - |
|
24 | - /** |
|
25 | - * Get the field singleton. |
|
26 | - * |
|
27 | - * @since 3.6.0 |
|
28 | - * @return \Wordlift_Schema_Url_Property_Service The singleton instance. |
|
29 | - */ |
|
30 | - public static function get_instance() { |
|
31 | - |
|
32 | - return static::$instance; |
|
33 | - } |
|
34 | - |
|
35 | - /** |
|
36 | - * Get the value for the specified post/entity. |
|
37 | - * |
|
38 | - * @since 3.6.0 |
|
39 | - * |
|
40 | - * @param int $post_id The post id. |
|
41 | - * |
|
42 | - * @return mixed |
|
43 | - */ |
|
44 | - abstract public function get( $post_id ); |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize the provided value. |
|
48 | - * |
|
49 | - * @since 3.6.0 |
|
50 | - * |
|
51 | - * @param mixed $value The value to sanitize. |
|
52 | - * |
|
53 | - * @return mixed|NULL The sanitized value or NULL avoid saving this value (see {@link Wl_Metabox_Field}). |
|
54 | - */ |
|
55 | - abstract public function sanitize( $value ); |
|
56 | - |
|
57 | - /** |
|
58 | - * The RDF predicate for the property. |
|
59 | - * |
|
60 | - * @since 3.6.0 |
|
61 | - * @return string The RDF predicate. |
|
62 | - */ |
|
63 | - abstract public function get_rdf_predicate(); |
|
64 | - |
|
65 | - /** |
|
66 | - * The RDF data type. |
|
67 | - * |
|
68 | - * @since 3.6.0 |
|
69 | - * @return string The RDF data type. |
|
70 | - */ |
|
71 | - abstract public function get_rdf_data_type(); |
|
72 | - |
|
73 | - /** |
|
74 | - * The internal data type. |
|
75 | - * |
|
76 | - * @since 3.6.0 |
|
77 | - * @return string The internal data type. |
|
78 | - */ |
|
79 | - abstract public function get_data_type(); |
|
80 | - |
|
81 | - /** |
|
82 | - * The cardinality. |
|
83 | - * |
|
84 | - * @since 3.6.0 |
|
85 | - * @return mixed The cardinality. |
|
86 | - */ |
|
87 | - abstract public function get_cardinality(); |
|
88 | - |
|
89 | - /** |
|
90 | - * The metabox field class name. |
|
91 | - * |
|
92 | - * @since 3.6.0 |
|
93 | - * @return string The metabox field class name. |
|
94 | - */ |
|
95 | - abstract public function get_metabox_class(); |
|
96 | - |
|
97 | - /** |
|
98 | - * The untranslated metabox field label. |
|
99 | - * |
|
100 | - * @since 3.6.0 |
|
101 | - * @return string The untranslated metabox field label. |
|
102 | - */ |
|
103 | - abstract public function get_metabox_label(); |
|
104 | - |
|
105 | - /** |
|
106 | - * The definition of the property returned as a compatible array. |
|
107 | - * |
|
108 | - * @deprecated |
|
109 | - * |
|
110 | - * @since 3.6.0 |
|
111 | - * @return array An array of property definitions. |
|
112 | - */ |
|
113 | - public function get_compat_definition() { |
|
114 | - |
|
115 | - return array( |
|
116 | - 'type' => $this->get_data_type(), |
|
117 | - 'predicate' => $this->get_rdf_predicate(), |
|
118 | - 'export_type' => $this->get_rdf_data_type(), |
|
119 | - 'constraints' => array( |
|
120 | - 'cardinality' => $this->get_cardinality(), |
|
121 | - ), |
|
122 | - // Use the standard metabox for these URI (the URI metabox creates local entities). |
|
123 | - 'metabox' => array( |
|
124 | - 'class' => $this->get_metabox_class(), |
|
125 | - 'label' => $this->get_metabox_label(), |
|
126 | - ), |
|
127 | - 'sanitize' => array( $this, 'sanitize' ), |
|
128 | - ); |
|
129 | - } |
|
17 | + protected static $instance; |
|
18 | + |
|
19 | + public function __construct() { |
|
20 | + |
|
21 | + static::$instance = $this; |
|
22 | + } |
|
23 | + |
|
24 | + /** |
|
25 | + * Get the field singleton. |
|
26 | + * |
|
27 | + * @since 3.6.0 |
|
28 | + * @return \Wordlift_Schema_Url_Property_Service The singleton instance. |
|
29 | + */ |
|
30 | + public static function get_instance() { |
|
31 | + |
|
32 | + return static::$instance; |
|
33 | + } |
|
34 | + |
|
35 | + /** |
|
36 | + * Get the value for the specified post/entity. |
|
37 | + * |
|
38 | + * @since 3.6.0 |
|
39 | + * |
|
40 | + * @param int $post_id The post id. |
|
41 | + * |
|
42 | + * @return mixed |
|
43 | + */ |
|
44 | + abstract public function get( $post_id ); |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize the provided value. |
|
48 | + * |
|
49 | + * @since 3.6.0 |
|
50 | + * |
|
51 | + * @param mixed $value The value to sanitize. |
|
52 | + * |
|
53 | + * @return mixed|NULL The sanitized value or NULL avoid saving this value (see {@link Wl_Metabox_Field}). |
|
54 | + */ |
|
55 | + abstract public function sanitize( $value ); |
|
56 | + |
|
57 | + /** |
|
58 | + * The RDF predicate for the property. |
|
59 | + * |
|
60 | + * @since 3.6.0 |
|
61 | + * @return string The RDF predicate. |
|
62 | + */ |
|
63 | + abstract public function get_rdf_predicate(); |
|
64 | + |
|
65 | + /** |
|
66 | + * The RDF data type. |
|
67 | + * |
|
68 | + * @since 3.6.0 |
|
69 | + * @return string The RDF data type. |
|
70 | + */ |
|
71 | + abstract public function get_rdf_data_type(); |
|
72 | + |
|
73 | + /** |
|
74 | + * The internal data type. |
|
75 | + * |
|
76 | + * @since 3.6.0 |
|
77 | + * @return string The internal data type. |
|
78 | + */ |
|
79 | + abstract public function get_data_type(); |
|
80 | + |
|
81 | + /** |
|
82 | + * The cardinality. |
|
83 | + * |
|
84 | + * @since 3.6.0 |
|
85 | + * @return mixed The cardinality. |
|
86 | + */ |
|
87 | + abstract public function get_cardinality(); |
|
88 | + |
|
89 | + /** |
|
90 | + * The metabox field class name. |
|
91 | + * |
|
92 | + * @since 3.6.0 |
|
93 | + * @return string The metabox field class name. |
|
94 | + */ |
|
95 | + abstract public function get_metabox_class(); |
|
96 | + |
|
97 | + /** |
|
98 | + * The untranslated metabox field label. |
|
99 | + * |
|
100 | + * @since 3.6.0 |
|
101 | + * @return string The untranslated metabox field label. |
|
102 | + */ |
|
103 | + abstract public function get_metabox_label(); |
|
104 | + |
|
105 | + /** |
|
106 | + * The definition of the property returned as a compatible array. |
|
107 | + * |
|
108 | + * @deprecated |
|
109 | + * |
|
110 | + * @since 3.6.0 |
|
111 | + * @return array An array of property definitions. |
|
112 | + */ |
|
113 | + public function get_compat_definition() { |
|
114 | + |
|
115 | + return array( |
|
116 | + 'type' => $this->get_data_type(), |
|
117 | + 'predicate' => $this->get_rdf_predicate(), |
|
118 | + 'export_type' => $this->get_rdf_data_type(), |
|
119 | + 'constraints' => array( |
|
120 | + 'cardinality' => $this->get_cardinality(), |
|
121 | + ), |
|
122 | + // Use the standard metabox for these URI (the URI metabox creates local entities). |
|
123 | + 'metabox' => array( |
|
124 | + 'class' => $this->get_metabox_class(), |
|
125 | + 'label' => $this->get_metabox_label(), |
|
126 | + ), |
|
127 | + 'sanitize' => array( $this, 'sanitize' ), |
|
128 | + ); |
|
129 | + } |
|
130 | 130 | |
131 | 131 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | - abstract public function get( $post_id ); |
|
44 | + abstract public function get($post_id); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Sanitize the provided value. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return mixed|NULL The sanitized value or NULL avoid saving this value (see {@link Wl_Metabox_Field}). |
54 | 54 | */ |
55 | - abstract public function sanitize( $value ); |
|
55 | + abstract public function sanitize($value); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * The RDF predicate for the property. |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'class' => $this->get_metabox_class(), |
125 | 125 | 'label' => $this->get_metabox_label(), |
126 | 126 | ), |
127 | - 'sanitize' => array( $this, 'sanitize' ), |
|
127 | + 'sanitize' => array($this, 'sanitize'), |
|
128 | 128 | ); |
129 | 129 | } |
130 | 130 |