@@ -10,10 +10,10 @@ |
||
10 | 10 | */ |
11 | 11 | interface Provider { |
12 | 12 | |
13 | - /** |
|
14 | - * @param $videos array<Embedded_Video> |
|
15 | - * @return array<Video> |
|
16 | - */ |
|
17 | - public function get_videos_data( $videos ); |
|
13 | + /** |
|
14 | + * @param $videos array<Embedded_Video> |
|
15 | + * @return array<Video> |
|
16 | + */ |
|
17 | + public function get_videos_data( $videos ); |
|
18 | 18 | |
19 | 19 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | * @param $videos array<Embedded_Video> |
15 | 15 | * @return array<Video> |
16 | 16 | */ |
17 | - public function get_videos_data( $videos ); |
|
17 | + public function get_videos_data($videos); |
|
18 | 18 | |
19 | 19 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @param $api_client |
23 | 23 | */ |
24 | - public function __construct( $api_client ) { |
|
24 | + public function __construct($api_client) { |
|
25 | 25 | $this->api_client = $api_client; |
26 | 26 | } |
27 | 27 |
@@ -11,18 +11,18 @@ |
||
11 | 11 | */ |
12 | 12 | abstract class Api_Provider implements Provider { |
13 | 13 | |
14 | - /** |
|
15 | - * @var Client |
|
16 | - */ |
|
17 | - protected $api_client; |
|
14 | + /** |
|
15 | + * @var Client |
|
16 | + */ |
|
17 | + protected $api_client; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Api_Provider constructor. |
|
21 | - * |
|
22 | - * @param $api_client |
|
23 | - */ |
|
24 | - public function __construct( $api_client ) { |
|
25 | - $this->api_client = $api_client; |
|
26 | - } |
|
19 | + /** |
|
20 | + * Api_Provider constructor. |
|
21 | + * |
|
22 | + * @param $api_client |
|
23 | + */ |
|
24 | + public function __construct( $api_client ) { |
|
25 | + $this->api_client = $api_client; |
|
26 | + } |
|
27 | 27 | |
28 | 28 | } |
@@ -13,6 +13,6 @@ |
||
13 | 13 | * |
14 | 14 | * @return array<Embedded_Video> |
15 | 15 | */ |
16 | - public function get_videos( $post_id ); |
|
16 | + public function get_videos($post_id); |
|
17 | 17 | |
18 | 18 | } |
@@ -9,11 +9,11 @@ |
||
9 | 9 | */ |
10 | 10 | interface Parser { |
11 | 11 | |
12 | - /** |
|
13 | - * @param int $post_id Post id. |
|
14 | - * |
|
15 | - * @return array<Embedded_Video> |
|
16 | - */ |
|
17 | - public function get_videos( $post_id ); |
|
12 | + /** |
|
13 | + * @param int $post_id Post id. |
|
14 | + * |
|
15 | + * @return array<Embedded_Video> |
|
16 | + */ |
|
17 | + public function get_videos( $post_id ); |
|
18 | 18 | |
19 | 19 | } |
@@ -6,40 +6,40 @@ |
||
6 | 6 | use Wordlift\Videoobject\Video_Processor; |
7 | 7 | |
8 | 8 | class Videoobject_Background_Process extends Background_Process { |
9 | - /** |
|
10 | - * @var Video_Processor |
|
11 | - */ |
|
12 | - private $video_processor; |
|
13 | - |
|
14 | - /** |
|
15 | - * Videoobject_Background_Process constructor. |
|
16 | - * |
|
17 | - * @param $video_processor Video_Processor |
|
18 | - * @param $data_source |
|
19 | - */ |
|
20 | - public function __construct( $video_processor, $data_source ) { |
|
21 | - $this->video_processor = $video_processor; |
|
22 | - parent::__construct( $data_source ); |
|
23 | - } |
|
24 | - |
|
25 | - protected function get_state_storage_key() { |
|
26 | - return '__wl_videoobject_import_state'; |
|
27 | - } |
|
28 | - |
|
29 | - protected function get_action_key() { |
|
30 | - return 'wl_videoobject_import_background_action'; |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * @param $items |
|
35 | - * |
|
36 | - * @return bool|void |
|
37 | - */ |
|
38 | - protected function process_items( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - $this->video_processor->process_video_urls( get_post( $item ), $item ); |
|
41 | - } |
|
42 | - return true; |
|
43 | - } |
|
9 | + /** |
|
10 | + * @var Video_Processor |
|
11 | + */ |
|
12 | + private $video_processor; |
|
13 | + |
|
14 | + /** |
|
15 | + * Videoobject_Background_Process constructor. |
|
16 | + * |
|
17 | + * @param $video_processor Video_Processor |
|
18 | + * @param $data_source |
|
19 | + */ |
|
20 | + public function __construct( $video_processor, $data_source ) { |
|
21 | + $this->video_processor = $video_processor; |
|
22 | + parent::__construct( $data_source ); |
|
23 | + } |
|
24 | + |
|
25 | + protected function get_state_storage_key() { |
|
26 | + return '__wl_videoobject_import_state'; |
|
27 | + } |
|
28 | + |
|
29 | + protected function get_action_key() { |
|
30 | + return 'wl_videoobject_import_background_action'; |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * @param $items |
|
35 | + * |
|
36 | + * @return bool|void |
|
37 | + */ |
|
38 | + protected function process_items( $items ) { |
|
39 | + foreach ( $items as $item ) { |
|
40 | + $this->video_processor->process_video_urls( get_post( $item ), $item ); |
|
41 | + } |
|
42 | + return true; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | * @param $video_processor Video_Processor |
18 | 18 | * @param $data_source |
19 | 19 | */ |
20 | - public function __construct( $video_processor, $data_source ) { |
|
20 | + public function __construct($video_processor, $data_source) { |
|
21 | 21 | $this->video_processor = $video_processor; |
22 | - parent::__construct( $data_source ); |
|
22 | + parent::__construct($data_source); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | protected function get_state_storage_key() { |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|void |
37 | 37 | */ |
38 | - protected function process_items( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - $this->video_processor->process_video_urls( get_post( $item ), $item ); |
|
38 | + protected function process_items($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + $this->video_processor->process_video_urls(get_post($item), $item); |
|
41 | 41 | } |
42 | 42 | return true; |
43 | 43 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | private $state_storage_key; |
12 | 12 | |
13 | - public function __construct( $state_storage_key ) { |
|
13 | + public function __construct($state_storage_key) { |
|
14 | 14 | $this->state_storage_key = $state_storage_key; |
15 | 15 | } |
16 | 16 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | public function get_state() { |
38 | 38 | try { |
39 | - return get_option( $this->state_storage_key, Sync_State::unknown() ); |
|
40 | - } catch ( \Exception $e ) { |
|
39 | + return get_option($this->state_storage_key, Sync_State::unknown()); |
|
40 | + } catch (\Exception $e) { |
|
41 | 41 | return Sync_State::unknown(); |
42 | 42 | } |
43 | 43 |
@@ -3,46 +3,46 @@ |
||
3 | 3 | |
4 | 4 | abstract class Data_Source { |
5 | 5 | |
6 | - /** |
|
7 | - * @var string The key which is provided to the background process |
|
8 | - * in order to retrieve its state, it should be the same as the one provided to |
|
9 | - * background process. |
|
10 | - */ |
|
11 | - private $state_storage_key; |
|
12 | - |
|
13 | - public function __construct( $state_storage_key ) { |
|
14 | - $this->state_storage_key = $state_storage_key; |
|
15 | - } |
|
16 | - |
|
17 | - /** |
|
18 | - * A list of item ids. |
|
19 | - * |
|
20 | - * @return int[] |
|
21 | - */ |
|
22 | - abstract public function next(); |
|
23 | - |
|
24 | - /** |
|
25 | - * The count of total items which needs to be processed. |
|
26 | - * |
|
27 | - * @return int[] |
|
28 | - */ |
|
29 | - abstract public function count(); |
|
30 | - |
|
31 | - /** |
|
32 | - * A numerical value indicating how many items should be processed per |
|
33 | - * background call. |
|
34 | - * |
|
35 | - * @return int |
|
36 | - */ |
|
37 | - abstract public function get_batch_size(); |
|
38 | - |
|
39 | - public function get_state() { |
|
40 | - try { |
|
41 | - return get_option( $this->state_storage_key, Sync_State::unknown() ); |
|
42 | - } catch ( \Exception $e ) { |
|
43 | - return Sync_State::unknown(); |
|
44 | - } |
|
45 | - |
|
46 | - } |
|
6 | + /** |
|
7 | + * @var string The key which is provided to the background process |
|
8 | + * in order to retrieve its state, it should be the same as the one provided to |
|
9 | + * background process. |
|
10 | + */ |
|
11 | + private $state_storage_key; |
|
12 | + |
|
13 | + public function __construct( $state_storage_key ) { |
|
14 | + $this->state_storage_key = $state_storage_key; |
|
15 | + } |
|
16 | + |
|
17 | + /** |
|
18 | + * A list of item ids. |
|
19 | + * |
|
20 | + * @return int[] |
|
21 | + */ |
|
22 | + abstract public function next(); |
|
23 | + |
|
24 | + /** |
|
25 | + * The count of total items which needs to be processed. |
|
26 | + * |
|
27 | + * @return int[] |
|
28 | + */ |
|
29 | + abstract public function count(); |
|
30 | + |
|
31 | + /** |
|
32 | + * A numerical value indicating how many items should be processed per |
|
33 | + * background call. |
|
34 | + * |
|
35 | + * @return int |
|
36 | + */ |
|
37 | + abstract public function get_batch_size(); |
|
38 | + |
|
39 | + public function get_state() { |
|
40 | + try { |
|
41 | + return get_option( $this->state_storage_key, Sync_State::unknown() ); |
|
42 | + } catch ( \Exception $e ) { |
|
43 | + return Sync_State::unknown(); |
|
44 | + } |
|
45 | + |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | private $term; |
20 | 20 | |
21 | - public function __construct( $term, $entities ) { |
|
21 | + public function __construct($term, $entities) { |
|
22 | 22 | $this->term = $term; |
23 | 23 | $this->entities = $entities; |
24 | 24 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | 'tagName' => $this->term->name, |
31 | 31 | 'tagDescription' => $this->term->description, |
32 | 32 | // Before 4.5.0 taxonomy parameter **must** be passed to this function. |
33 | - 'tagLink' => get_edit_term_link( $this->term->term_id, $this->term->taxonomy ), |
|
33 | + 'tagLink' => get_edit_term_link($this->term->term_id, $this->term->taxonomy), |
|
34 | 34 | 'tagPostCount' => $this->term->count, |
35 | - 'tagTaxonomy' => get_taxonomy( $this->term->taxonomy )->label, |
|
35 | + 'tagTaxonomy' => get_taxonomy($this->term->taxonomy)->label, |
|
36 | 36 | 'entities' => $this->entities, |
37 | 37 | ); |
38 | 38 | } |
@@ -9,31 +9,31 @@ |
||
9 | 9 | |
10 | 10 | class Default_Term_Data implements Term_Data { |
11 | 11 | |
12 | - /** |
|
13 | - * @var array An array of entities bound to the term. |
|
14 | - */ |
|
15 | - private $entities; |
|
16 | - /** |
|
17 | - * @var \WP_Term |
|
18 | - */ |
|
19 | - private $term; |
|
12 | + /** |
|
13 | + * @var array An array of entities bound to the term. |
|
14 | + */ |
|
15 | + private $entities; |
|
16 | + /** |
|
17 | + * @var \WP_Term |
|
18 | + */ |
|
19 | + private $term; |
|
20 | 20 | |
21 | - public function __construct( $term, $entities ) { |
|
22 | - $this->term = $term; |
|
23 | - $this->entities = $entities; |
|
24 | - } |
|
21 | + public function __construct( $term, $entities ) { |
|
22 | + $this->term = $term; |
|
23 | + $this->entities = $entities; |
|
24 | + } |
|
25 | 25 | |
26 | - public function get_data() { |
|
26 | + public function get_data() { |
|
27 | 27 | |
28 | - return array( |
|
29 | - 'tagId' => $this->term->term_id, |
|
30 | - 'tagName' => $this->term->name, |
|
31 | - 'tagDescription' => $this->term->description, |
|
32 | - // Before 4.5.0 taxonomy parameter **must** be passed to this function. |
|
33 | - 'tagLink' => get_edit_term_link( $this->term->term_id, $this->term->taxonomy ), |
|
34 | - 'tagPostCount' => $this->term->count, |
|
35 | - 'tagTaxonomy' => get_taxonomy( $this->term->taxonomy )->label, |
|
36 | - 'entities' => $this->entities, |
|
37 | - ); |
|
38 | - } |
|
28 | + return array( |
|
29 | + 'tagId' => $this->term->term_id, |
|
30 | + 'tagName' => $this->term->name, |
|
31 | + 'tagDescription' => $this->term->description, |
|
32 | + // Before 4.5.0 taxonomy parameter **must** be passed to this function. |
|
33 | + 'tagLink' => get_edit_term_link( $this->term->term_id, $this->term->taxonomy ), |
|
34 | + 'tagPostCount' => $this->term->count, |
|
35 | + 'tagTaxonomy' => get_taxonomy( $this->term->taxonomy )->label, |
|
36 | + 'entities' => $this->entities, |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | } |
@@ -17,9 +17,9 @@ |
||
17 | 17 | * |
18 | 18 | * @return array|array[]|mixed |
19 | 19 | */ |
20 | - public static function get_matched_entities_for_term( $term_id ) { |
|
20 | + public static function get_matched_entities_for_term($term_id) { |
|
21 | 21 | |
22 | - $entity = Entity_List_Factory::get_instance( $term_id ); |
|
22 | + $entity = Entity_List_Factory::get_instance($term_id); |
|
23 | 23 | |
24 | 24 | return $entity->get_jsonld_data(); |
25 | 25 | } |
@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | class Jsonld_Utils { |
12 | 12 | |
13 | - /** |
|
14 | - * @param $term_id |
|
15 | - * |
|
16 | - * @return array|array[]|mixed |
|
17 | - */ |
|
18 | - public static function get_matched_entities_for_term( $term_id ) { |
|
13 | + /** |
|
14 | + * @param $term_id |
|
15 | + * |
|
16 | + * @return array|array[]|mixed |
|
17 | + */ |
|
18 | + public static function get_matched_entities_for_term( $term_id ) { |
|
19 | 19 | |
20 | - $entity = Entity_List_Factory::get_instance( $term_id ); |
|
20 | + $entity = Entity_List_Factory::get_instance( $term_id ); |
|
21 | 21 | |
22 | - return $entity->get_jsonld_data(); |
|
23 | - } |
|
22 | + return $entity->get_jsonld_data(); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | } |
@@ -29,6 +29,6 @@ |
||
29 | 29 | * @since 3.16.0 $references argument added. |
30 | 30 | * @since 3.10.0 |
31 | 31 | */ |
32 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ); |
|
32 | + public function convert($post_id, &$references = array(), &$references_infos = array()); |
|
33 | 33 | |
34 | 34 | } |
@@ -17,17 +17,17 @@ |
||
17 | 17 | */ |
18 | 18 | interface Wordlift_Post_Converter { |
19 | 19 | |
20 | - /** |
|
21 | - * Convert the specified post id. |
|
22 | - * |
|
23 | - * @param int $post_id The post id. |
|
24 | - * @param array $references An array of posts referenced by the specified post. |
|
25 | - * @param array $references_infos |
|
26 | - * |
|
27 | - * @return mixed The conversion result. |
|
28 | - * @since 3.16.0 $references argument added. |
|
29 | - * @since 3.10.0 |
|
30 | - */ |
|
31 | - public function convert( $post_id, &$references = array(), &$references_infos = array() ); |
|
20 | + /** |
|
21 | + * Convert the specified post id. |
|
22 | + * |
|
23 | + * @param int $post_id The post id. |
|
24 | + * @param array $references An array of posts referenced by the specified post. |
|
25 | + * @param array $references_infos |
|
26 | + * |
|
27 | + * @return mixed The conversion result. |
|
28 | + * @since 3.16.0 $references argument added. |
|
29 | + * @since 3.10.0 |
|
30 | + */ |
|
31 | + public function convert( $post_id, &$references = array(), &$references_infos = array() ); |
|
32 | 32 | |
33 | 33 | } |
@@ -10,15 +10,15 @@ |
||
10 | 10 | |
11 | 11 | interface Reference { |
12 | 12 | |
13 | - /** |
|
14 | - * @return int |
|
15 | - */ |
|
16 | - public function get_type(); |
|
13 | + /** |
|
14 | + * @return int |
|
15 | + */ |
|
16 | + public function get_type(); |
|
17 | 17 | |
18 | - /** |
|
19 | - * @return int Identifier |
|
20 | - */ |
|
21 | - public function get_id(); |
|
18 | + /** |
|
19 | + * @return int Identifier |
|
20 | + */ |
|
21 | + public function get_id(); |
|
22 | 22 | |
23 | 23 | } |
24 | 24 |