first commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace WPML\ST;
|
||||
|
||||
class Actions {
|
||||
|
||||
public static function get() {
|
||||
return array(
|
||||
'WPML_ST_Theme_Plugin_Localization_Resources_Factory',
|
||||
'WPML_ST_Theme_Plugin_Localization_Options_UI_Factory',
|
||||
'WPML_ST_Theme_Plugin_Localization_Options_Settings_Factory',
|
||||
'WPML_ST_Theme_Plugin_Scan_Dir_Ajax_Factory',
|
||||
'WPML_ST_Theme_Plugin_Scan_Files_Ajax_Factory',
|
||||
'WPML_ST_Update_File_Hash_Ajax_Factory',
|
||||
'WPML_ST_Theme_Plugin_Hooks_Factory',
|
||||
'WPML_ST_Taxonomy_Labels_Translation_Factory',
|
||||
'WPML_ST_String_Translation_AJAX_Hooks_Factory',
|
||||
'WPML_ST_Remote_String_Translation_Factory',
|
||||
'WPML_ST_Privacy_Content_Factory',
|
||||
'WPML_ST_String_Tracking_AJAX_Factory',
|
||||
\WPML_ST_Translation_Memory::class,
|
||||
'WPML_ST_Script_Translations_Hooks_Factory',
|
||||
\WPML\ST\MO\Scan\UI\Factory::class,
|
||||
'WPML\ST\Rest\FactoryLoader',
|
||||
\WPML\ST\Gettext\HooksFactory::class,
|
||||
\WPML_ST_Support_Info_Filter::class,
|
||||
\WPML\ST\Troubleshooting\BackendHooks::class,
|
||||
\WPML\ST\Troubleshooting\AjaxFactory::class,
|
||||
\WPML\ST\MO\File\FailureHooksFactory::class,
|
||||
\WPML\ST\DB\Mappers\Hooks::class,
|
||||
\WPML\ST\Shortcode\Hooks::class,
|
||||
\WPML\ST\AdminTexts\UI::class,
|
||||
\WPML\ST\PackageTranslation\Hooks::class,
|
||||
\WPML\ST\Main\UI::class,
|
||||
\WPML\ST\StringsCleanup\UI::class,
|
||||
\WPML\ST\DisplayAsTranslated\CheckRedirect::class,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class WPML_ST_Remote_String_Translation_Factory implements IWPML_Backend_Action_Loader, IWPML_Action {
|
||||
|
||||
public function create() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function add_hooks() {
|
||||
if ( did_action( 'wpml_tm_loaded' ) ) {
|
||||
$this->on_tm_loaded();
|
||||
} else {
|
||||
add_action( 'wpml_tm_loaded', array( $this, 'on_tm_loaded' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function on_tm_loaded() {
|
||||
if ( ! class_exists( 'WPML_Manage_Translations_Role' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( current_user_can( WPML_Manage_Translations_Role::CAPABILITY ) ) {
|
||||
add_action( 'wpml_st_below_menu', array( 'WPML_Remote_String_Translation', 'display_string_menu' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class WPML_ST_WP_Loaded_Action extends WPML_SP_User {
|
||||
|
||||
/** @var WPML_String_Translation $st_instance */
|
||||
private $st_instance;
|
||||
|
||||
/** @var string $pagenow */
|
||||
private $pagenow;
|
||||
|
||||
/** @var string $get_page */
|
||||
private $get_page;
|
||||
|
||||
public function __construct( &$sitepress, &$st_instance, &$pagenow, $get_page ) {
|
||||
parent::__construct( $sitepress );
|
||||
$this->st_instance = &$st_instance;
|
||||
$this->pagenow = &$pagenow;
|
||||
$this->get_page = $get_page;
|
||||
}
|
||||
|
||||
public function run() {
|
||||
$string_settings = $this->sitepress->get_setting( 'st', array() );
|
||||
if ( ! isset( $string_settings['sw'] )
|
||||
|| ( $this->pagenow === 'admin.php'
|
||||
&& strpos( $this->get_page, 'theme-localization.php' ) !== false ) ) {
|
||||
$string_settings['sw'] = isset( $string_settings['sw'] )
|
||||
? $string_settings['sw'] : array();
|
||||
$this->sitepress->set_setting( 'st', $string_settings, true );
|
||||
$this->st_instance->initialize_wp_and_widget_strings();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user