| @@ 88-96 (lines=9) @@ | ||
| 85 | * |
|
| 86 | * @return array An array with the updated JSON-LD and references. |
|
| 87 | */ |
|
| 88 | public function wl_term_jsonld_array( $value, $term_id ) { |
|
| 89 | $jsonld = $value['jsonld']; |
|
| 90 | $references = $value['references']; |
|
| 91 | ||
| 92 | return array( |
|
| 93 | 'jsonld' => $this->build_jsonld( $jsonld, $term_id, $references, self::TERM ), |
|
| 94 | 'references' => $references, |
|
| 95 | ); |
|
| 96 | } |
|
| 97 | ||
| 98 | ||
| 99 | /** |
|
| @@ 116-125 (lines=10) @@ | ||
| 113 | * |
|
| 114 | * @return array An array with the updated JSON-LD and references. |
|
| 115 | */ |
|
| 116 | public function wl_post_jsonld_array( $value, $post_id ) { |
|
| 117 | ||
| 118 | $jsonld = $value['jsonld']; |
|
| 119 | $references = $value['references']; |
|
| 120 | ||
| 121 | return array( |
|
| 122 | 'jsonld' => $this->build_jsonld( $jsonld, $post_id, $references, self::POST ), |
|
| 123 | 'references' => $references, |
|
| 124 | ); |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * Returns JSON-LD data after applying transformation functions. |
|
| @@ 19-31 (lines=13) @@ | ||
| 16 | add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 11, 2 ); |
|
| 17 | } |
|
| 18 | ||
| 19 | public function wl_post_jsonld_array( $arr, $post_id ) { |
|
| 20 | ||
| 21 | $jsonld = $arr['jsonld']; |
|
| 22 | $references = $arr['references']; |
|
| 23 | ||
| 24 | $this->add_mentions( $post_id, $jsonld, $references ); |
|
| 25 | ||
| 26 | return array( |
|
| 27 | 'jsonld' => $jsonld, |
|
| 28 | 'references' => $references |
|
| 29 | ); |
|
| 30 | ||
| 31 | } |
|
| 32 | ||
| 33 | public function add_mentions( $post_id, &$jsonld, &$references ) { |
|
| 34 | ||