@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | |
13 | 13 | class Ingredients { |
14 | 14 | |
15 | - /** |
|
16 | - * Get Ingredients Data. |
|
17 | - * |
|
18 | - * @param int $limit The number of items to return. |
|
19 | - * @param int $offset The offset. |
|
20 | - */ |
|
21 | - public function get_data( $limit = 20, $offset = 0 ) { |
|
22 | - global $wpdb; |
|
15 | + /** |
|
16 | + * Get Ingredients Data. |
|
17 | + * |
|
18 | + * @param int $limit The number of items to return. |
|
19 | + * @param int $offset The offset. |
|
20 | + */ |
|
21 | + public function get_data( $limit = 20, $offset = 0 ) { |
|
22 | + global $wpdb; |
|
23 | 23 | |
24 | - $ingredients = $wpdb->get_results( |
|
25 | - $wpdb->prepare( |
|
26 | - "SELECT p1.ID AS recipe_ID, |
|
24 | + $ingredients = $wpdb->get_results( |
|
25 | + $wpdb->prepare( |
|
26 | + "SELECT p1.ID AS recipe_ID, |
|
27 | 27 | p1.post_title AS recipe_name, |
28 | 28 | p2.ID AS post_ID, |
29 | 29 | p2.post_title |
@@ -33,43 +33,43 @@ discard block |
||
33 | 33 | INNER JOIN $wpdb->postmeta pm2 |
34 | 34 | ON pm2.post_ID = pm1.content_id AND pm2.meta_key = 'wprm_parent_post_id' |
35 | 35 | INNER JOIN $wpdb->posts p2" |
36 | - // The following ignore rule is used against the `LIKE CONCAT`. We only have const values. |
|
37 | - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery |
|
38 | - . " ON p2.post_status = 'publish' AND p2.ID = pm2.meta_value |
|
36 | + // The following ignore rule is used against the `LIKE CONCAT`. We only have const values. |
|
37 | + // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery |
|
38 | + . " ON p2.post_status = 'publish' AND p2.ID = pm2.meta_value |
|
39 | 39 | WHERE pm1.content_type = 0 AND pm1.about_jsonld IS NOT NULL |
40 | 40 | LIMIT %d |
41 | 41 | OFFSET %d", |
42 | - $limit, |
|
43 | - $offset |
|
44 | - ) |
|
45 | - ); |
|
42 | + $limit, |
|
43 | + $offset |
|
44 | + ) |
|
45 | + ); |
|
46 | 46 | |
47 | - if ( empty( $ingredients ) ) { |
|
48 | - return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) ); |
|
49 | - } |
|
47 | + if ( empty( $ingredients ) ) { |
|
48 | + return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) ); |
|
49 | + } |
|
50 | 50 | |
51 | - $data = array(); |
|
52 | - $content_service = Wordpress_Content_Service::get_instance(); |
|
53 | - foreach ( $ingredients as $ingredient ) { |
|
54 | - // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
55 | - $recipe_id = $ingredient->recipe_ID; |
|
56 | - $content_id = Wordpress_Content_Id::create_post( $recipe_id ); |
|
57 | - $recipe_json_ld = $content_service->get_about_jsonld( $content_id ); |
|
58 | - $recipe = json_decode( $recipe_json_ld, true ); |
|
51 | + $data = array(); |
|
52 | + $content_service = Wordpress_Content_Service::get_instance(); |
|
53 | + foreach ( $ingredients as $ingredient ) { |
|
54 | + // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
55 | + $recipe_id = $ingredient->recipe_ID; |
|
56 | + $content_id = Wordpress_Content_Id::create_post( $recipe_id ); |
|
57 | + $recipe_json_ld = $content_service->get_about_jsonld( $content_id ); |
|
58 | + $recipe = json_decode( $recipe_json_ld, true ); |
|
59 | 59 | |
60 | - // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
61 | - $data[] = array( |
|
62 | - 'main_ingredient_item_id' => $recipe ? $recipe['@id'] : null, |
|
63 | - 'main_ingredient_name' => $recipe ? $recipe['name'] : null, |
|
64 | - 'recipe_id' => (int) $recipe_id, |
|
65 | - 'recipe_name' => htmlspecialchars_decode( $ingredient->recipe_name ), |
|
66 | - 'post_id' => (int) $ingredient->post_ID, |
|
67 | - 'post_name' => $ingredient->post_title, |
|
68 | - 'post_url' => get_the_permalink( $ingredient->post_ID ), |
|
69 | - ); |
|
70 | - // phpcs:enable |
|
71 | - } |
|
60 | + // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
61 | + $data[] = array( |
|
62 | + 'main_ingredient_item_id' => $recipe ? $recipe['@id'] : null, |
|
63 | + 'main_ingredient_name' => $recipe ? $recipe['name'] : null, |
|
64 | + 'recipe_id' => (int) $recipe_id, |
|
65 | + 'recipe_name' => htmlspecialchars_decode( $ingredient->recipe_name ), |
|
66 | + 'post_id' => (int) $ingredient->post_ID, |
|
67 | + 'post_name' => $ingredient->post_title, |
|
68 | + 'post_url' => get_the_permalink( $ingredient->post_ID ), |
|
69 | + ); |
|
70 | + // phpcs:enable |
|
71 | + } |
|
72 | 72 | |
73 | - return $data; |
|
74 | - } |
|
73 | + return $data; |
|
74 | + } |
|
75 | 75 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param int $limit The number of items to return. |
19 | 19 | * @param int $offset The offset. |
20 | 20 | */ |
21 | - public function get_data( $limit = 20, $offset = 0 ) { |
|
21 | + public function get_data($limit = 20, $offset = 0) { |
|
22 | 22 | global $wpdb; |
23 | 23 | |
24 | 24 | $ingredients = $wpdb->get_results( |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | ) |
45 | 45 | ); |
46 | 46 | |
47 | - if ( empty( $ingredients ) ) { |
|
48 | - return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) ); |
|
47 | + if (empty($ingredients)) { |
|
48 | + return new \WP_Error('no_ingredients', __('No ingredients found.', 'wordlift'), array('status' => 404)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $data = array(); |
52 | 52 | $content_service = Wordpress_Content_Service::get_instance(); |
53 | - foreach ( $ingredients as $ingredient ) { |
|
53 | + foreach ($ingredients as $ingredient) { |
|
54 | 54 | // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
55 | 55 | $recipe_id = $ingredient->recipe_ID; |
56 | - $content_id = Wordpress_Content_Id::create_post( $recipe_id ); |
|
57 | - $recipe_json_ld = $content_service->get_about_jsonld( $content_id ); |
|
58 | - $recipe = json_decode( $recipe_json_ld, true ); |
|
56 | + $content_id = Wordpress_Content_Id::create_post($recipe_id); |
|
57 | + $recipe_json_ld = $content_service->get_about_jsonld($content_id); |
|
58 | + $recipe = json_decode($recipe_json_ld, true); |
|
59 | 59 | |
60 | 60 | // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
61 | 61 | $data[] = array( |
62 | 62 | 'main_ingredient_item_id' => $recipe ? $recipe['@id'] : null, |
63 | 63 | 'main_ingredient_name' => $recipe ? $recipe['name'] : null, |
64 | 64 | 'recipe_id' => (int) $recipe_id, |
65 | - 'recipe_name' => htmlspecialchars_decode( $ingredient->recipe_name ), |
|
65 | + 'recipe_name' => htmlspecialchars_decode($ingredient->recipe_name), |
|
66 | 66 | 'post_id' => (int) $ingredient->post_ID, |
67 | 67 | 'post_name' => $ingredient->post_title, |
68 | - 'post_url' => get_the_permalink( $ingredient->post_ID ), |
|
68 | + 'post_url' => get_the_permalink($ingredient->post_ID), |
|
69 | 69 | ); |
70 | 70 | // phpcs:enable |
71 | 71 | } |
@@ -6,21 +6,21 @@ |
||
6 | 6 | |
7 | 7 | class Food_Kg_Recipe_Post_Store implements Store { |
8 | 8 | |
9 | - public function list_items( $id_greater_than, $batch_size ) { |
|
10 | - global $wpdb; |
|
9 | + public function list_items( $id_greater_than, $batch_size ) { |
|
10 | + global $wpdb; |
|
11 | 11 | |
12 | - return array_map( |
|
13 | - function ( $value ) { |
|
14 | - return (int) $value; |
|
15 | - }, |
|
16 | - $wpdb->get_col( |
|
17 | - $wpdb->prepare( |
|
18 | - "SELECT ID FROM $wpdb->posts WHERE ID > %d AND post_type = 'wprm_recipe' ORDER BY ID ASC LIMIT %d", |
|
19 | - $id_greater_than, |
|
20 | - $batch_size |
|
21 | - ) |
|
22 | - ) |
|
23 | - ); |
|
24 | - } |
|
12 | + return array_map( |
|
13 | + function ( $value ) { |
|
14 | + return (int) $value; |
|
15 | + }, |
|
16 | + $wpdb->get_col( |
|
17 | + $wpdb->prepare( |
|
18 | + "SELECT ID FROM $wpdb->posts WHERE ID > %d AND post_type = 'wprm_recipe' ORDER BY ID ASC LIMIT %d", |
|
19 | + $id_greater_than, |
|
20 | + $batch_size |
|
21 | + ) |
|
22 | + ) |
|
23 | + ); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | |
7 | 7 | class Food_Kg_Recipe_Post_Store implements Store { |
8 | 8 | |
9 | - public function list_items( $id_greater_than, $batch_size ) { |
|
9 | + public function list_items($id_greater_than, $batch_size) { |
|
10 | 10 | global $wpdb; |
11 | 11 | |
12 | 12 | return array_map( |
13 | - function ( $value ) { |
|
13 | + function($value) { |
|
14 | 14 | return (int) $value; |
15 | 15 | }, |
16 | 16 | $wpdb->get_col( |
@@ -10,94 +10,94 @@ |
||
10 | 10 | |
11 | 11 | class Food_Kg_Main_Entity_Runner implements Runner { |
12 | 12 | |
13 | - /** |
|
14 | - * @var Content_Service |
|
15 | - */ |
|
16 | - private $content_service; |
|
13 | + /** |
|
14 | + * @var Content_Service |
|
15 | + */ |
|
16 | + private $content_service; |
|
17 | 17 | |
18 | - /** |
|
19 | - * @var Store |
|
20 | - */ |
|
21 | - private $store; |
|
18 | + /** |
|
19 | + * @var Store |
|
20 | + */ |
|
21 | + private $store; |
|
22 | 22 | |
23 | - /** |
|
24 | - * @var Ingredients_Client |
|
25 | - */ |
|
26 | - private $ingredients_client; |
|
23 | + /** |
|
24 | + * @var Ingredients_Client |
|
25 | + */ |
|
26 | + private $ingredients_client; |
|
27 | 27 | |
28 | - public function __construct( Content_Service $content_service, Ingredients_Client $ingredients_client, Store $store ) { |
|
29 | - $this->store = $store; |
|
30 | - $this->ingredients_client = $ingredients_client; |
|
31 | - $this->content_service = $content_service; |
|
32 | - } |
|
28 | + public function __construct( Content_Service $content_service, Ingredients_Client $ingredients_client, Store $store ) { |
|
29 | + $this->store = $store; |
|
30 | + $this->ingredients_client = $ingredients_client; |
|
31 | + $this->content_service = $content_service; |
|
32 | + } |
|
33 | 33 | |
34 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
35 | - public function run( $last_id ) { |
|
36 | - $items = $this->store->list_items( $last_id, 100 ); |
|
34 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
35 | + public function run( $last_id ) { |
|
36 | + $items = $this->store->list_items( $last_id, 100 ); |
|
37 | 37 | |
38 | - // Count the processed items. |
|
39 | - $count_items = count( $items ); |
|
38 | + // Count the processed items. |
|
39 | + $count_items = count( $items ); |
|
40 | 40 | |
41 | - foreach ( $items as $recipe_id ) { |
|
42 | - $this->process( $recipe_id ); |
|
43 | - } |
|
41 | + foreach ( $items as $recipe_id ) { |
|
42 | + $this->process( $recipe_id ); |
|
43 | + } |
|
44 | 44 | |
45 | - // Get the last ID. |
|
46 | - $last_id = end( $items ); |
|
45 | + // Get the last ID. |
|
46 | + $last_id = end( $items ); |
|
47 | 47 | |
48 | - // Finally return the count. |
|
49 | - return array( $count_items, $last_id ); |
|
50 | - } |
|
48 | + // Finally return the count. |
|
49 | + return array( $count_items, $last_id ); |
|
50 | + } |
|
51 | 51 | |
52 | - public function process( $post_id ) { |
|
52 | + public function process( $post_id ) { |
|
53 | 53 | |
54 | - $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
54 | + $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
55 | 55 | |
56 | - // Skip posts with existing data. |
|
57 | - $existing = $this->content_service->get_about_jsonld( $content_id ); |
|
58 | - if ( ! empty( $existing ) ) { |
|
59 | - return true; |
|
60 | - } |
|
56 | + // Skip posts with existing data. |
|
57 | + $existing = $this->content_service->get_about_jsonld( $content_id ); |
|
58 | + if ( ! empty( $existing ) ) { |
|
59 | + return true; |
|
60 | + } |
|
61 | 61 | |
62 | - $post = get_post( $post_id ); |
|
62 | + $post = get_post( $post_id ); |
|
63 | 63 | |
64 | - $jsonld = $this->ingredients_client->main_ingredient( $post->post_title ); |
|
64 | + $jsonld = $this->ingredients_client->main_ingredient( $post->post_title ); |
|
65 | 65 | |
66 | - if ( $this->validate( $jsonld ) ) { |
|
67 | - $this->content_service->set_about_jsonld( $content_id, $jsonld ); |
|
66 | + if ( $this->validate( $jsonld ) ) { |
|
67 | + $this->content_service->set_about_jsonld( $content_id, $jsonld ); |
|
68 | 68 | |
69 | - return true; |
|
70 | - } else { |
|
71 | - // No ingredient found. |
|
72 | - $this->content_service->set_about_jsonld( $content_id, null ); |
|
69 | + return true; |
|
70 | + } else { |
|
71 | + // No ingredient found. |
|
72 | + $this->content_service->set_about_jsonld( $content_id, null ); |
|
73 | 73 | |
74 | - return false; |
|
75 | - } |
|
74 | + return false; |
|
75 | + } |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - private function validate( $jsonld_string ) { |
|
79 | + private function validate( $jsonld_string ) { |
|
80 | 80 | |
81 | - try { |
|
82 | - $json = json_decode( $jsonld_string ); |
|
83 | - if ( ! isset( $json->{'@type'} ) || ! isset( $json->name ) ) { |
|
84 | - return false; |
|
85 | - } |
|
86 | - } catch ( \Exception $e ) { |
|
87 | - return false; |
|
88 | - } |
|
81 | + try { |
|
82 | + $json = json_decode( $jsonld_string ); |
|
83 | + if ( ! isset( $json->{'@type'} ) || ! isset( $json->name ) ) { |
|
84 | + return false; |
|
85 | + } |
|
86 | + } catch ( \Exception $e ) { |
|
87 | + return false; |
|
88 | + } |
|
89 | 89 | |
90 | - return true; |
|
91 | - } |
|
90 | + return true; |
|
91 | + } |
|
92 | 92 | |
93 | - public function get_total() { |
|
94 | - global $wpdb; |
|
93 | + public function get_total() { |
|
94 | + global $wpdb; |
|
95 | 95 | |
96 | - return $wpdb->get_var( |
|
97 | - " |
|
96 | + return $wpdb->get_var( |
|
97 | + " |
|
98 | 98 | SELECT COUNT(1) FROM $wpdb->posts WHERE post_type = 'wprm_recipe' |
99 | 99 | " |
100 | - ); |
|
101 | - } |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | |
103 | 103 | } |
@@ -25,65 +25,65 @@ |
||
25 | 25 | */ |
26 | 26 | private $ingredients_client; |
27 | 27 | |
28 | - public function __construct( Content_Service $content_service, Ingredients_Client $ingredients_client, Store $store ) { |
|
28 | + public function __construct(Content_Service $content_service, Ingredients_Client $ingredients_client, Store $store) { |
|
29 | 29 | $this->store = $store; |
30 | 30 | $this->ingredients_client = $ingredients_client; |
31 | 31 | $this->content_service = $content_service; |
32 | 32 | } |
33 | 33 | |
34 | 34 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
35 | - public function run( $last_id ) { |
|
36 | - $items = $this->store->list_items( $last_id, 100 ); |
|
35 | + public function run($last_id) { |
|
36 | + $items = $this->store->list_items($last_id, 100); |
|
37 | 37 | |
38 | 38 | // Count the processed items. |
39 | - $count_items = count( $items ); |
|
39 | + $count_items = count($items); |
|
40 | 40 | |
41 | - foreach ( $items as $recipe_id ) { |
|
42 | - $this->process( $recipe_id ); |
|
41 | + foreach ($items as $recipe_id) { |
|
42 | + $this->process($recipe_id); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Get the last ID. |
46 | - $last_id = end( $items ); |
|
46 | + $last_id = end($items); |
|
47 | 47 | |
48 | 48 | // Finally return the count. |
49 | - return array( $count_items, $last_id ); |
|
49 | + return array($count_items, $last_id); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function process( $post_id ) { |
|
52 | + public function process($post_id) { |
|
53 | 53 | |
54 | - $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
54 | + $content_id = Wordpress_Content_Id::create_post($post_id); |
|
55 | 55 | |
56 | 56 | // Skip posts with existing data. |
57 | - $existing = $this->content_service->get_about_jsonld( $content_id ); |
|
58 | - if ( ! empty( $existing ) ) { |
|
57 | + $existing = $this->content_service->get_about_jsonld($content_id); |
|
58 | + if ( ! empty($existing)) { |
|
59 | 59 | return true; |
60 | 60 | } |
61 | 61 | |
62 | - $post = get_post( $post_id ); |
|
62 | + $post = get_post($post_id); |
|
63 | 63 | |
64 | - $jsonld = $this->ingredients_client->main_ingredient( $post->post_title ); |
|
64 | + $jsonld = $this->ingredients_client->main_ingredient($post->post_title); |
|
65 | 65 | |
66 | - if ( $this->validate( $jsonld ) ) { |
|
67 | - $this->content_service->set_about_jsonld( $content_id, $jsonld ); |
|
66 | + if ($this->validate($jsonld)) { |
|
67 | + $this->content_service->set_about_jsonld($content_id, $jsonld); |
|
68 | 68 | |
69 | 69 | return true; |
70 | 70 | } else { |
71 | 71 | // No ingredient found. |
72 | - $this->content_service->set_about_jsonld( $content_id, null ); |
|
72 | + $this->content_service->set_about_jsonld($content_id, null); |
|
73 | 73 | |
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
78 | 78 | |
79 | - private function validate( $jsonld_string ) { |
|
79 | + private function validate($jsonld_string) { |
|
80 | 80 | |
81 | 81 | try { |
82 | - $json = json_decode( $jsonld_string ); |
|
83 | - if ( ! isset( $json->{'@type'} ) || ! isset( $json->name ) ) { |
|
82 | + $json = json_decode($jsonld_string); |
|
83 | + if ( ! isset($json->{'@type'} ) || ! isset($json->name)) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | - } catch ( \Exception $e ) { |
|
86 | + } catch (\Exception $e) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 |
@@ -7,100 +7,100 @@ |
||
7 | 7 | |
8 | 8 | class Main_Ingredient_Recipe_Lift_Strategy implements Recipe_Lift_Strategy { |
9 | 9 | |
10 | - /** |
|
11 | - * @var Ingredients_Client |
|
12 | - */ |
|
13 | - private $ingredients_client; |
|
14 | - |
|
15 | - /** |
|
16 | - * @var Notices |
|
17 | - */ |
|
18 | - private $notices; |
|
19 | - |
|
20 | - public function __construct( Ingredients_Client $ingredients_client, Notices $notices ) { |
|
21 | - $this->ingredients_client = $ingredients_client; |
|
22 | - $this->notices = $notices; |
|
23 | - } |
|
24 | - |
|
25 | - public function get_json_ld_data( $ingredient ) { |
|
26 | - // Get JSON LD Data. |
|
27 | - return $this->ingredients_client->main_ingredient( $ingredient ); |
|
28 | - } |
|
29 | - |
|
30 | - public function run() { |
|
31 | - $this->notices->queue( 'info', __( 'WordLift detected WP Recipe Maker and, it is lifting the ingredients...', 'wordlift' ) ); |
|
32 | - |
|
33 | - $recipes = get_posts( |
|
34 | - array( |
|
35 | - 'post_type' => 'wprm_recipe', |
|
36 | - 'numberposts' => - 1, |
|
37 | - ) |
|
38 | - ); |
|
39 | - $count = count( $recipes ); |
|
40 | - |
|
41 | - $count_lifted = 0; |
|
42 | - foreach ( $recipes as $recipe ) { |
|
43 | - /* translators: 1: The number of lifted recipes, 2: The total number of recipes. */ |
|
44 | - $this->notices->queue( 'info', sprintf( __( 'WordLift is adding the main ingredient to recipes. So far it lifted %1$d of %2$d recipe(s).', 'wordlift' ), $count_lifted, $count ) ); |
|
45 | - |
|
46 | - // Emit something to keep the connection alive. |
|
47 | - echo esc_html( "$count_lifted\n" ); |
|
48 | - |
|
49 | - if ( $this->process( $recipe->ID ) ) { |
|
50 | - $count_lifted ++; |
|
51 | - } |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @@todo add notification that procedure is complete, with information about the number of processed items vs |
|
56 | - * total items |
|
57 | - */ |
|
58 | - /* translators: 1: The number of lifted recipes, 2: The total number of recipes. */ |
|
59 | - $this->notices->queue( 'info', sprintf( __( 'WordLift lifted %1$d of %2$d recipe(s).', 'wordlift' ), $count_lifted, $count ) ); |
|
60 | - } |
|
61 | - |
|
62 | - public function process( $post_id ) { |
|
63 | - |
|
64 | - $content_service = Wordpress_Content_Service::get_instance(); |
|
65 | - $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
66 | - |
|
67 | - // Skip posts with existing data. |
|
68 | - $existing = $content_service->get_about_jsonld( $content_id ); |
|
69 | - if ( ! empty( $existing ) ) { |
|
70 | - return true; |
|
71 | - } |
|
72 | - |
|
73 | - $post = get_post( $post_id ); |
|
74 | - |
|
75 | - $jsonld = $this->ingredients_client->main_ingredient( $post->post_title ); |
|
76 | - $content_service = Wordpress_Content_Service::get_instance(); |
|
77 | - $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
78 | - |
|
79 | - if ( $this->validate( $jsonld ) ) { |
|
80 | - $content_service->set_about_jsonld( $content_id, $jsonld ); |
|
81 | - |
|
82 | - return true; |
|
83 | - } else { |
|
84 | - // No ingredient found. |
|
85 | - $content_service->set_about_jsonld( $content_id, null ); |
|
86 | - |
|
87 | - return false; |
|
88 | - } |
|
89 | - |
|
90 | - } |
|
91 | - |
|
92 | - private function validate( $jsonld_string ) { |
|
93 | - |
|
94 | - try { |
|
95 | - $json = json_decode( $jsonld_string ); |
|
96 | - if ( ! isset( $json->{'@type'} ) || ! isset( $json->name ) ) { |
|
97 | - return false; |
|
98 | - } |
|
99 | - } catch ( \Exception $e ) { |
|
100 | - return false; |
|
101 | - } |
|
102 | - |
|
103 | - return true; |
|
104 | - } |
|
10 | + /** |
|
11 | + * @var Ingredients_Client |
|
12 | + */ |
|
13 | + private $ingredients_client; |
|
14 | + |
|
15 | + /** |
|
16 | + * @var Notices |
|
17 | + */ |
|
18 | + private $notices; |
|
19 | + |
|
20 | + public function __construct( Ingredients_Client $ingredients_client, Notices $notices ) { |
|
21 | + $this->ingredients_client = $ingredients_client; |
|
22 | + $this->notices = $notices; |
|
23 | + } |
|
24 | + |
|
25 | + public function get_json_ld_data( $ingredient ) { |
|
26 | + // Get JSON LD Data. |
|
27 | + return $this->ingredients_client->main_ingredient( $ingredient ); |
|
28 | + } |
|
29 | + |
|
30 | + public function run() { |
|
31 | + $this->notices->queue( 'info', __( 'WordLift detected WP Recipe Maker and, it is lifting the ingredients...', 'wordlift' ) ); |
|
32 | + |
|
33 | + $recipes = get_posts( |
|
34 | + array( |
|
35 | + 'post_type' => 'wprm_recipe', |
|
36 | + 'numberposts' => - 1, |
|
37 | + ) |
|
38 | + ); |
|
39 | + $count = count( $recipes ); |
|
40 | + |
|
41 | + $count_lifted = 0; |
|
42 | + foreach ( $recipes as $recipe ) { |
|
43 | + /* translators: 1: The number of lifted recipes, 2: The total number of recipes. */ |
|
44 | + $this->notices->queue( 'info', sprintf( __( 'WordLift is adding the main ingredient to recipes. So far it lifted %1$d of %2$d recipe(s).', 'wordlift' ), $count_lifted, $count ) ); |
|
45 | + |
|
46 | + // Emit something to keep the connection alive. |
|
47 | + echo esc_html( "$count_lifted\n" ); |
|
48 | + |
|
49 | + if ( $this->process( $recipe->ID ) ) { |
|
50 | + $count_lifted ++; |
|
51 | + } |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @@todo add notification that procedure is complete, with information about the number of processed items vs |
|
56 | + * total items |
|
57 | + */ |
|
58 | + /* translators: 1: The number of lifted recipes, 2: The total number of recipes. */ |
|
59 | + $this->notices->queue( 'info', sprintf( __( 'WordLift lifted %1$d of %2$d recipe(s).', 'wordlift' ), $count_lifted, $count ) ); |
|
60 | + } |
|
61 | + |
|
62 | + public function process( $post_id ) { |
|
63 | + |
|
64 | + $content_service = Wordpress_Content_Service::get_instance(); |
|
65 | + $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
66 | + |
|
67 | + // Skip posts with existing data. |
|
68 | + $existing = $content_service->get_about_jsonld( $content_id ); |
|
69 | + if ( ! empty( $existing ) ) { |
|
70 | + return true; |
|
71 | + } |
|
72 | + |
|
73 | + $post = get_post( $post_id ); |
|
74 | + |
|
75 | + $jsonld = $this->ingredients_client->main_ingredient( $post->post_title ); |
|
76 | + $content_service = Wordpress_Content_Service::get_instance(); |
|
77 | + $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
78 | + |
|
79 | + if ( $this->validate( $jsonld ) ) { |
|
80 | + $content_service->set_about_jsonld( $content_id, $jsonld ); |
|
81 | + |
|
82 | + return true; |
|
83 | + } else { |
|
84 | + // No ingredient found. |
|
85 | + $content_service->set_about_jsonld( $content_id, null ); |
|
86 | + |
|
87 | + return false; |
|
88 | + } |
|
89 | + |
|
90 | + } |
|
91 | + |
|
92 | + private function validate( $jsonld_string ) { |
|
93 | + |
|
94 | + try { |
|
95 | + $json = json_decode( $jsonld_string ); |
|
96 | + if ( ! isset( $json->{'@type'} ) || ! isset( $json->name ) ) { |
|
97 | + return false; |
|
98 | + } |
|
99 | + } catch ( \Exception $e ) { |
|
100 | + return false; |
|
101 | + } |
|
102 | + |
|
103 | + return true; |
|
104 | + } |
|
105 | 105 | } |
106 | 106 |
@@ -17,37 +17,37 @@ discard block |
||
17 | 17 | */ |
18 | 18 | private $notices; |
19 | 19 | |
20 | - public function __construct( Ingredients_Client $ingredients_client, Notices $notices ) { |
|
20 | + public function __construct(Ingredients_Client $ingredients_client, Notices $notices) { |
|
21 | 21 | $this->ingredients_client = $ingredients_client; |
22 | 22 | $this->notices = $notices; |
23 | 23 | } |
24 | 24 | |
25 | - public function get_json_ld_data( $ingredient ) { |
|
25 | + public function get_json_ld_data($ingredient) { |
|
26 | 26 | // Get JSON LD Data. |
27 | - return $this->ingredients_client->main_ingredient( $ingredient ); |
|
27 | + return $this->ingredients_client->main_ingredient($ingredient); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function run() { |
31 | - $this->notices->queue( 'info', __( 'WordLift detected WP Recipe Maker and, it is lifting the ingredients...', 'wordlift' ) ); |
|
31 | + $this->notices->queue('info', __('WordLift detected WP Recipe Maker and, it is lifting the ingredients...', 'wordlift')); |
|
32 | 32 | |
33 | 33 | $recipes = get_posts( |
34 | 34 | array( |
35 | 35 | 'post_type' => 'wprm_recipe', |
36 | - 'numberposts' => - 1, |
|
36 | + 'numberposts' => -1, |
|
37 | 37 | ) |
38 | 38 | ); |
39 | - $count = count( $recipes ); |
|
39 | + $count = count($recipes); |
|
40 | 40 | |
41 | 41 | $count_lifted = 0; |
42 | - foreach ( $recipes as $recipe ) { |
|
42 | + foreach ($recipes as $recipe) { |
|
43 | 43 | /* translators: 1: The number of lifted recipes, 2: The total number of recipes. */ |
44 | - $this->notices->queue( 'info', sprintf( __( 'WordLift is adding the main ingredient to recipes. So far it lifted %1$d of %2$d recipe(s).', 'wordlift' ), $count_lifted, $count ) ); |
|
44 | + $this->notices->queue('info', sprintf(__('WordLift is adding the main ingredient to recipes. So far it lifted %1$d of %2$d recipe(s).', 'wordlift'), $count_lifted, $count)); |
|
45 | 45 | |
46 | 46 | // Emit something to keep the connection alive. |
47 | - echo esc_html( "$count_lifted\n" ); |
|
47 | + echo esc_html("$count_lifted\n"); |
|
48 | 48 | |
49 | - if ( $this->process( $recipe->ID ) ) { |
|
50 | - $count_lifted ++; |
|
49 | + if ($this->process($recipe->ID)) { |
|
50 | + $count_lifted++; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -56,47 +56,47 @@ discard block |
||
56 | 56 | * total items |
57 | 57 | */ |
58 | 58 | /* translators: 1: The number of lifted recipes, 2: The total number of recipes. */ |
59 | - $this->notices->queue( 'info', sprintf( __( 'WordLift lifted %1$d of %2$d recipe(s).', 'wordlift' ), $count_lifted, $count ) ); |
|
59 | + $this->notices->queue('info', sprintf(__('WordLift lifted %1$d of %2$d recipe(s).', 'wordlift'), $count_lifted, $count)); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function process( $post_id ) { |
|
62 | + public function process($post_id) { |
|
63 | 63 | |
64 | 64 | $content_service = Wordpress_Content_Service::get_instance(); |
65 | - $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
65 | + $content_id = Wordpress_Content_Id::create_post($post_id); |
|
66 | 66 | |
67 | 67 | // Skip posts with existing data. |
68 | - $existing = $content_service->get_about_jsonld( $content_id ); |
|
69 | - if ( ! empty( $existing ) ) { |
|
68 | + $existing = $content_service->get_about_jsonld($content_id); |
|
69 | + if ( ! empty($existing)) { |
|
70 | 70 | return true; |
71 | 71 | } |
72 | 72 | |
73 | - $post = get_post( $post_id ); |
|
73 | + $post = get_post($post_id); |
|
74 | 74 | |
75 | - $jsonld = $this->ingredients_client->main_ingredient( $post->post_title ); |
|
75 | + $jsonld = $this->ingredients_client->main_ingredient($post->post_title); |
|
76 | 76 | $content_service = Wordpress_Content_Service::get_instance(); |
77 | - $content_id = Wordpress_Content_Id::create_post( $post_id ); |
|
77 | + $content_id = Wordpress_Content_Id::create_post($post_id); |
|
78 | 78 | |
79 | - if ( $this->validate( $jsonld ) ) { |
|
80 | - $content_service->set_about_jsonld( $content_id, $jsonld ); |
|
79 | + if ($this->validate($jsonld)) { |
|
80 | + $content_service->set_about_jsonld($content_id, $jsonld); |
|
81 | 81 | |
82 | 82 | return true; |
83 | 83 | } else { |
84 | 84 | // No ingredient found. |
85 | - $content_service->set_about_jsonld( $content_id, null ); |
|
85 | + $content_service->set_about_jsonld($content_id, null); |
|
86 | 86 | |
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | - private function validate( $jsonld_string ) { |
|
92 | + private function validate($jsonld_string) { |
|
93 | 93 | |
94 | 94 | try { |
95 | - $json = json_decode( $jsonld_string ); |
|
96 | - if ( ! isset( $json->{'@type'} ) || ! isset( $json->name ) ) { |
|
95 | + $json = json_decode($jsonld_string); |
|
96 | + if ( ! isset($json->{'@type'} ) || ! isset($json->name)) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | - } catch ( \Exception $e ) { |
|
99 | + } catch (\Exception $e) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 |
@@ -9,69 +9,69 @@ |
||
9 | 9 | |
10 | 10 | class Food_Kg_Term_Entity_Runner implements Runner { |
11 | 11 | |
12 | - /** |
|
13 | - * @var Food_Kg_Ingredients_Term_Store |
|
14 | - */ |
|
15 | - private $store; |
|
16 | - |
|
17 | - /** |
|
18 | - * @var Content_Service |
|
19 | - */ |
|
20 | - private $content_service; |
|
21 | - |
|
22 | - /** |
|
23 | - * @var Ingredients_Client |
|
24 | - */ |
|
25 | - private $ingredients_client; |
|
26 | - |
|
27 | - public function __construct( Food_Kg_Ingredients_Term_Store $store, Content_Service $content_service, Ingredients_Client $ingredients_client ) { |
|
28 | - $this->store = $store; |
|
29 | - $this->content_service = $content_service; |
|
30 | - $this->ingredients_client = $ingredients_client; |
|
31 | - } |
|
32 | - |
|
33 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
34 | - public function run( $last_id ) { |
|
35 | - |
|
36 | - $items = $this->store->list_items( $last_id, 100 ); |
|
37 | - $names = array_column( |
|
38 | - array_map( |
|
39 | - function ( $item ) { |
|
40 | - return (array) $item; |
|
41 | - }, |
|
42 | - $items |
|
43 | - ), |
|
44 | - 'name' |
|
45 | - ); |
|
46 | - |
|
47 | - $ingredients = $this->ingredients_client->ingredients( $names ); |
|
48 | - |
|
49 | - foreach ( $ingredients as $key => $value ) { |
|
50 | - $term = get_term_by( 'name', $key, 'wprm_ingredient' ); |
|
51 | - if ( ! isset( $term ) ) { |
|
52 | - continue; |
|
53 | - } |
|
54 | - |
|
55 | - $content_id = Wordpress_Content_Id::create_term( $term->term_id ); |
|
56 | - $this->content_service->set_about_jsonld( $content_id, $value ); |
|
57 | - } |
|
58 | - |
|
59 | - $count = count( $items ); |
|
60 | - $last_item = end( $items ); |
|
61 | - $last_item_id = ( isset( $last_item->term_id ) ? $last_item->term_id : null ); |
|
62 | - |
|
63 | - return array( $count, $last_item_id ); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Get the total number of posts to process. |
|
68 | - * |
|
69 | - * We only count published posts. |
|
70 | - * |
|
71 | - * @return int |
|
72 | - */ |
|
73 | - public function get_total() { |
|
74 | - return $this->store->get_total(); |
|
75 | - } |
|
12 | + /** |
|
13 | + * @var Food_Kg_Ingredients_Term_Store |
|
14 | + */ |
|
15 | + private $store; |
|
16 | + |
|
17 | + /** |
|
18 | + * @var Content_Service |
|
19 | + */ |
|
20 | + private $content_service; |
|
21 | + |
|
22 | + /** |
|
23 | + * @var Ingredients_Client |
|
24 | + */ |
|
25 | + private $ingredients_client; |
|
26 | + |
|
27 | + public function __construct( Food_Kg_Ingredients_Term_Store $store, Content_Service $content_service, Ingredients_Client $ingredients_client ) { |
|
28 | + $this->store = $store; |
|
29 | + $this->content_service = $content_service; |
|
30 | + $this->ingredients_client = $ingredients_client; |
|
31 | + } |
|
32 | + |
|
33 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
34 | + public function run( $last_id ) { |
|
35 | + |
|
36 | + $items = $this->store->list_items( $last_id, 100 ); |
|
37 | + $names = array_column( |
|
38 | + array_map( |
|
39 | + function ( $item ) { |
|
40 | + return (array) $item; |
|
41 | + }, |
|
42 | + $items |
|
43 | + ), |
|
44 | + 'name' |
|
45 | + ); |
|
46 | + |
|
47 | + $ingredients = $this->ingredients_client->ingredients( $names ); |
|
48 | + |
|
49 | + foreach ( $ingredients as $key => $value ) { |
|
50 | + $term = get_term_by( 'name', $key, 'wprm_ingredient' ); |
|
51 | + if ( ! isset( $term ) ) { |
|
52 | + continue; |
|
53 | + } |
|
54 | + |
|
55 | + $content_id = Wordpress_Content_Id::create_term( $term->term_id ); |
|
56 | + $this->content_service->set_about_jsonld( $content_id, $value ); |
|
57 | + } |
|
58 | + |
|
59 | + $count = count( $items ); |
|
60 | + $last_item = end( $items ); |
|
61 | + $last_item_id = ( isset( $last_item->term_id ) ? $last_item->term_id : null ); |
|
62 | + |
|
63 | + return array( $count, $last_item_id ); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Get the total number of posts to process. |
|
68 | + * |
|
69 | + * We only count published posts. |
|
70 | + * |
|
71 | + * @return int |
|
72 | + */ |
|
73 | + public function get_total() { |
|
74 | + return $this->store->get_total(); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | } |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | */ |
25 | 25 | private $ingredients_client; |
26 | 26 | |
27 | - public function __construct( Food_Kg_Ingredients_Term_Store $store, Content_Service $content_service, Ingredients_Client $ingredients_client ) { |
|
27 | + public function __construct(Food_Kg_Ingredients_Term_Store $store, Content_Service $content_service, Ingredients_Client $ingredients_client) { |
|
28 | 28 | $this->store = $store; |
29 | 29 | $this->content_service = $content_service; |
30 | 30 | $this->ingredients_client = $ingredients_client; |
31 | 31 | } |
32 | 32 | |
33 | 33 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
34 | - public function run( $last_id ) { |
|
34 | + public function run($last_id) { |
|
35 | 35 | |
36 | - $items = $this->store->list_items( $last_id, 100 ); |
|
36 | + $items = $this->store->list_items($last_id, 100); |
|
37 | 37 | $names = array_column( |
38 | 38 | array_map( |
39 | - function ( $item ) { |
|
39 | + function($item) { |
|
40 | 40 | return (array) $item; |
41 | 41 | }, |
42 | 42 | $items |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | 'name' |
45 | 45 | ); |
46 | 46 | |
47 | - $ingredients = $this->ingredients_client->ingredients( $names ); |
|
47 | + $ingredients = $this->ingredients_client->ingredients($names); |
|
48 | 48 | |
49 | - foreach ( $ingredients as $key => $value ) { |
|
50 | - $term = get_term_by( 'name', $key, 'wprm_ingredient' ); |
|
51 | - if ( ! isset( $term ) ) { |
|
49 | + foreach ($ingredients as $key => $value) { |
|
50 | + $term = get_term_by('name', $key, 'wprm_ingredient'); |
|
51 | + if ( ! isset($term)) { |
|
52 | 52 | continue; |
53 | 53 | } |
54 | 54 | |
55 | - $content_id = Wordpress_Content_Id::create_term( $term->term_id ); |
|
56 | - $this->content_service->set_about_jsonld( $content_id, $value ); |
|
55 | + $content_id = Wordpress_Content_Id::create_term($term->term_id); |
|
56 | + $this->content_service->set_about_jsonld($content_id, $value); |
|
57 | 57 | } |
58 | 58 | |
59 | - $count = count( $items ); |
|
60 | - $last_item = end( $items ); |
|
61 | - $last_item_id = ( isset( $last_item->term_id ) ? $last_item->term_id : null ); |
|
59 | + $count = count($items); |
|
60 | + $last_item = end($items); |
|
61 | + $last_item_id = (isset($last_item->term_id) ? $last_item->term_id : null); |
|
62 | 62 | |
63 | - return array( $count, $last_item_id ); |
|
63 | + return array($count, $last_item_id); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | |
7 | 7 | class Food_Kg_Ingredients_Term_Store implements Store { |
8 | 8 | |
9 | - public function list_items( $id_greater_than, $batch_size ) { |
|
10 | - global $wpdb; |
|
9 | + public function list_items( $id_greater_than, $batch_size ) { |
|
10 | + global $wpdb; |
|
11 | 11 | |
12 | - return $wpdb->get_results( |
|
13 | - $wpdb->prepare( |
|
14 | - " |
|
12 | + return $wpdb->get_results( |
|
13 | + $wpdb->prepare( |
|
14 | + " |
|
15 | 15 | SELECT t.term_id, t.name FROM $wpdb->terms t |
16 | 16 | INNER JOIN $wpdb->term_taxonomy tt |
17 | 17 | ON tt.term_id = t.term_id AND tt.taxonomy = 'wprm_ingredient' |
@@ -19,29 +19,29 @@ discard block |
||
19 | 19 | ORDER BY t.term_id |
20 | 20 | LIMIT %d |
21 | 21 | ", |
22 | - $id_greater_than, |
|
23 | - $batch_size |
|
24 | - ) |
|
25 | - ); |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * Get the total number of posts to process. |
|
30 | - * |
|
31 | - * We only count published posts. |
|
32 | - * |
|
33 | - * @return int |
|
34 | - */ |
|
35 | - public function get_total() { |
|
36 | - global $wpdb; |
|
37 | - |
|
38 | - return $wpdb->get_var( |
|
39 | - " |
|
22 | + $id_greater_than, |
|
23 | + $batch_size |
|
24 | + ) |
|
25 | + ); |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * Get the total number of posts to process. |
|
30 | + * |
|
31 | + * We only count published posts. |
|
32 | + * |
|
33 | + * @return int |
|
34 | + */ |
|
35 | + public function get_total() { |
|
36 | + global $wpdb; |
|
37 | + |
|
38 | + return $wpdb->get_var( |
|
39 | + " |
|
40 | 40 | SELECT COUNT(1) FROM $wpdb->terms t |
41 | 41 | INNER JOIN $wpdb->term_taxonomy tt |
42 | 42 | ON tt.term_id = t.term_id AND tt.taxonomy = 'wprm_ingredient' |
43 | 43 | " |
44 | - ); |
|
45 | - } |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class Food_Kg_Ingredients_Term_Store implements Store { |
8 | 8 | |
9 | - public function list_items( $id_greater_than, $batch_size ) { |
|
9 | + public function list_items($id_greater_than, $batch_size) { |
|
10 | 10 | global $wpdb; |
11 | 11 | |
12 | 12 | return $wpdb->get_results( |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | // autoload.php @generated by Composer |
4 | 4 | |
5 | 5 | if (PHP_VERSION_ID < 50600) { |
6 | - if (!headers_sent()) { |
|
6 | + if ( ! headers_sent()) { |
|
7 | 7 | header('HTTP/1.1 500 Internal Server Error'); |
8 | 8 | } |
9 | 9 | $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; |
10 | - if (!ini_get('display_errors')) { |
|
10 | + if ( ! ini_get('display_errors')) { |
|
11 | 11 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
12 | 12 | fwrite(STDERR, $err); |
13 | - } elseif (!headers_sent()) { |
|
13 | + } elseif ( ! headers_sent()) { |
|
14 | 14 | echo $err; |
15 | 15 | } |
16 | 16 | } |
@@ -20,6 +20,6 @@ discard block |
||
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
23 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
24 | 24 | |
25 | 25 | return ComposerAutoloaderInit8bd2b6d4ccd6b50e0809e5ba62169420::getLoader(); |
@@ -6,18 +6,18 @@ |
||
6 | 6 | $baseDir = dirname($vendorDir); |
7 | 7 | |
8 | 8 | return array( |
9 | - 'ComposerAutoloaderInit8bd2b6d4ccd6b50e0809e5ba62169420' => $vendorDir . '/composer/autoload_real.php', |
|
10 | - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', |
|
11 | - 'Wordlift\\Modules\\Common\\Api\\Cursor' => $baseDir . '/Api/Cursor.php', |
|
12 | - 'Wordlift\\Modules\\Common\\Api\\Cursor_Page' => $baseDir . '/Api/Cursor_Page.php', |
|
13 | - 'Wordlift\\Modules\\Common\\Date_Utils' => $baseDir . '/Date_Utils.php', |
|
14 | - 'Wordlift\\Modules\\Common\\Installer' => $baseDir . '/Installer.php', |
|
15 | - 'Wordlift\\Modules\\Common\\Plugin' => $baseDir . '/Plugin.php', |
|
16 | - 'Wordlift\\Modules\\Common\\Quiet_Skin' => $baseDir . '/Quiet_Skin.php', |
|
17 | - 'Wordlift\\Modules\\Common\\Remote_Plugin' => $baseDir . '/Remote_Plugin.php', |
|
18 | - 'Wordlift\\Modules\\Common\\Synchronization\\Runner' => $baseDir . '/Synchronization/Runner.php', |
|
19 | - 'Wordlift\\Modules\\Common\\Synchronization\\Runner_State' => $baseDir . '/Synchronization/Runner_State.php', |
|
20 | - 'Wordlift\\Modules\\Common\\Synchronization\\Store' => $baseDir . '/Synchronization/Store.php', |
|
21 | - 'Wordlift_Modules_Common_Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php', |
|
22 | - 'Wordlift_Modules_Common_Composer\\Autoload\\ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420' => $vendorDir . '/composer/autoload_static.php', |
|
9 | + 'ComposerAutoloaderInit8bd2b6d4ccd6b50e0809e5ba62169420' => $vendorDir.'/composer/autoload_real.php', |
|
10 | + 'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php', |
|
11 | + 'Wordlift\\Modules\\Common\\Api\\Cursor' => $baseDir.'/Api/Cursor.php', |
|
12 | + 'Wordlift\\Modules\\Common\\Api\\Cursor_Page' => $baseDir.'/Api/Cursor_Page.php', |
|
13 | + 'Wordlift\\Modules\\Common\\Date_Utils' => $baseDir.'/Date_Utils.php', |
|
14 | + 'Wordlift\\Modules\\Common\\Installer' => $baseDir.'/Installer.php', |
|
15 | + 'Wordlift\\Modules\\Common\\Plugin' => $baseDir.'/Plugin.php', |
|
16 | + 'Wordlift\\Modules\\Common\\Quiet_Skin' => $baseDir.'/Quiet_Skin.php', |
|
17 | + 'Wordlift\\Modules\\Common\\Remote_Plugin' => $baseDir.'/Remote_Plugin.php', |
|
18 | + 'Wordlift\\Modules\\Common\\Synchronization\\Runner' => $baseDir.'/Synchronization/Runner.php', |
|
19 | + 'Wordlift\\Modules\\Common\\Synchronization\\Runner_State' => $baseDir.'/Synchronization/Runner_State.php', |
|
20 | + 'Wordlift\\Modules\\Common\\Synchronization\\Store' => $baseDir.'/Synchronization/Store.php', |
|
21 | + 'Wordlift_Modules_Common_Composer\\Autoload\\ClassLoader' => $vendorDir.'/composer/ClassLoader.php', |
|
22 | + 'Wordlift_Modules_Common_Composer\\Autoload\\ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420' => $vendorDir.'/composer/autoload_static.php', |
|
23 | 23 | ); |
@@ -6,26 +6,26 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420 |
8 | 8 | { |
9 | - public static $classMap = array ( |
|
10 | - 'ComposerAutoloaderInit8bd2b6d4ccd6b50e0809e5ba62169420' => __DIR__ . '/..' . '/composer/autoload_real.php', |
|
11 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
12 | - 'Wordlift\\Modules\\Common\\Api\\Cursor' => __DIR__ . '/../..' . '/Api/Cursor.php', |
|
13 | - 'Wordlift\\Modules\\Common\\Api\\Cursor_Page' => __DIR__ . '/../..' . '/Api/Cursor_Page.php', |
|
14 | - 'Wordlift\\Modules\\Common\\Date_Utils' => __DIR__ . '/../..' . '/Date_Utils.php', |
|
15 | - 'Wordlift\\Modules\\Common\\Installer' => __DIR__ . '/../..' . '/Installer.php', |
|
16 | - 'Wordlift\\Modules\\Common\\Plugin' => __DIR__ . '/../..' . '/Plugin.php', |
|
17 | - 'Wordlift\\Modules\\Common\\Quiet_Skin' => __DIR__ . '/../..' . '/Quiet_Skin.php', |
|
18 | - 'Wordlift\\Modules\\Common\\Remote_Plugin' => __DIR__ . '/../..' . '/Remote_Plugin.php', |
|
19 | - 'Wordlift\\Modules\\Common\\Synchronization\\Runner' => __DIR__ . '/../..' . '/Synchronization/Runner.php', |
|
20 | - 'Wordlift\\Modules\\Common\\Synchronization\\Runner_State' => __DIR__ . '/../..' . '/Synchronization/Runner_State.php', |
|
21 | - 'Wordlift\\Modules\\Common\\Synchronization\\Store' => __DIR__ . '/../..' . '/Synchronization/Store.php', |
|
22 | - 'Wordlift_Modules_Common_Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php', |
|
23 | - 'Wordlift_Modules_Common_Composer\\Autoload\\ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420' => __DIR__ . '/..' . '/composer/autoload_static.php', |
|
9 | + public static $classMap = array( |
|
10 | + 'ComposerAutoloaderInit8bd2b6d4ccd6b50e0809e5ba62169420' => __DIR__.'/..'.'/composer/autoload_real.php', |
|
11 | + 'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php', |
|
12 | + 'Wordlift\\Modules\\Common\\Api\\Cursor' => __DIR__.'/../..'.'/Api/Cursor.php', |
|
13 | + 'Wordlift\\Modules\\Common\\Api\\Cursor_Page' => __DIR__.'/../..'.'/Api/Cursor_Page.php', |
|
14 | + 'Wordlift\\Modules\\Common\\Date_Utils' => __DIR__.'/../..'.'/Date_Utils.php', |
|
15 | + 'Wordlift\\Modules\\Common\\Installer' => __DIR__.'/../..'.'/Installer.php', |
|
16 | + 'Wordlift\\Modules\\Common\\Plugin' => __DIR__.'/../..'.'/Plugin.php', |
|
17 | + 'Wordlift\\Modules\\Common\\Quiet_Skin' => __DIR__.'/../..'.'/Quiet_Skin.php', |
|
18 | + 'Wordlift\\Modules\\Common\\Remote_Plugin' => __DIR__.'/../..'.'/Remote_Plugin.php', |
|
19 | + 'Wordlift\\Modules\\Common\\Synchronization\\Runner' => __DIR__.'/../..'.'/Synchronization/Runner.php', |
|
20 | + 'Wordlift\\Modules\\Common\\Synchronization\\Runner_State' => __DIR__.'/../..'.'/Synchronization/Runner_State.php', |
|
21 | + 'Wordlift\\Modules\\Common\\Synchronization\\Store' => __DIR__.'/../..'.'/Synchronization/Store.php', |
|
22 | + 'Wordlift_Modules_Common_Composer\\Autoload\\ClassLoader' => __DIR__.'/..'.'/composer/ClassLoader.php', |
|
23 | + 'Wordlift_Modules_Common_Composer\\Autoload\\ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420' => __DIR__.'/..'.'/composer/autoload_static.php', |
|
24 | 24 | ); |
25 | 25 | |
26 | 26 | public static function getInitializer(ClassLoader $loader) |
27 | 27 | { |
28 | - return \Closure::bind(function () use ($loader) { |
|
28 | + return \Closure::bind(function() use ($loader) { |
|
29 | 29 | $loader->classMap = ComposerStaticInit8bd2b6d4ccd6b50e0809e5ba62169420::$classMap; |
30 | 30 | |
31 | 31 | }, null, ClassLoader::class); |