class-wpml-tm-xliff-shortcodes.php
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @author OnTheGo Systems
*/
class WPML_TM_XLIFF_Shortcodes extends WPML_TM_XLIFF_Phase {
const SHORTCODE_STORE_OPTION_KEY = 'wpml_xliff_shortcodes';
/**
* @return string
*/
protected function get_data() {
return implode( ',', $this->get_shortcodes() );
}
/**
* @return array
*/
private function get_shortcodes() {
global $shortcode_tags;
$registered_shortcodes = array();
if ( $shortcode_tags ) {
$registered_shortcodes = array_keys( $shortcode_tags );
}
$stored_shortcodes = get_option( self::SHORTCODE_STORE_OPTION_KEY, array() );
return $this->get_sanitized_shortcodes( $registered_shortcodes, $stored_shortcodes );
}
private function get_sanitized_shortcodes( array $shortcodes1, array $shortcodes2 ) {
return array_unique( array_filter( apply_filters( 'wpml_shortcode_list', array_merge( $shortcodes1, $shortcodes2 ) ) ) );
}
protected function get_phase_name() {
return 'shortcodes';
}
protected function get_process_name() {
return 'Shortcodes identification';
}
}