first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,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';
}
}