first commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* @author OnTheGo Systems
|
||||
*/
|
||||
class WPML_TM_Shortcodes_Catcher_Factory implements IWPML_Frontend_Action_Loader, IWPML_Backend_Action_Loader, IWPML_AJAX_Action_Loader {
|
||||
|
||||
/**
|
||||
* @return IWPML_Action|IWPML_Action[]|null
|
||||
*/
|
||||
public function create() {
|
||||
return new WPML_TM_Shortcodes_Catcher();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author OnTheGo Systems
|
||||
*/
|
||||
class WPML_TM_Shortcodes_Catcher implements IWPML_Action {
|
||||
|
||||
public function add_hooks() {
|
||||
add_filter( 'pre_do_shortcode_tag', array( $this, 'register_shortcode' ), 10, 2 );
|
||||
}
|
||||
|
||||
public function register_shortcode( $return, $tag ) {
|
||||
if ( $tag ) {
|
||||
$registered_shortcodes = get_option( WPML_TM_XLIFF_Shortcodes::SHORTCODE_STORE_OPTION_KEY, array() );
|
||||
if ( ! in_array( $tag, $registered_shortcodes, true ) ) {
|
||||
$registered_shortcodes[] = $tag;
|
||||
update_option( WPML_TM_XLIFF_Shortcodes::SHORTCODE_STORE_OPTION_KEY, $registered_shortcodes, false );
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user