| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Language function file for tinymce. |
| 4 |
* |
| 5 |
* @link http://themeisle.com |
| 6 |
* @since 3.0.0 |
| 7 |
*/ |
| 8 |
/** |
| 9 |
* |
| 10 |
* SECURITY : Exit if accessed directly |
| 11 |
*/ |
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
die( 'Direct access not allowed!' ); |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* |
| 18 |
* Translation for TinyMCE |
| 19 |
*/ |
| 20 |
|
| 21 |
if ( ! class_exists( '_WP_Editors' ) ) { |
| 22 |
require ABSPATH . WPINC . '/class-wp-editor.php'; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* The module for all languages stuff. |
| 27 |
* |
| 28 |
* @category Visualizer |
| 29 |
* @package Module |
| 30 |
* |
| 31 |
* @since 1.0.0 |
| 32 |
*/ |
| 33 |
class Visualizer_Module_Language extends Visualizer_Module { |
| 34 |
|
| 35 |
/** |
| 36 |
* The strings for translation. |
| 37 |
* |
| 38 |
* @access protected |
| 39 |
* @var array $strings The ID of this plugin. |
| 40 |
*/ |
| 41 |
protected $strings; |
| 42 |
|
| 43 |
/** |
| 44 |
* Initialize the class and set its properties. |
| 45 |
* |
| 46 |
* @since 3.0.0 |
| 47 |
* @access public |
| 48 |
*/ |
| 49 |
public function __construct() { |
| 50 |
$this->strings = array( |
| 51 |
'plugin_label' => __( 'Insert Chart', 'visualizer' ), |
| 52 |
'plugin_title' => __( 'Insert Chart', 'visualizer' ), |
| 53 |
); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* |
| 58 |
* The method that returns the translation array |
| 59 |
* |
| 60 |
* @access public |
| 61 |
* @return string |
| 62 |
*/ |
| 63 |
public function tinymce_translation() { |
| 64 |
|
| 65 |
$locale = _WP_Editors::$mce_locale; |
| 66 |
$translated = 'tinyMCE.addI18n("' . $locale . '.visualizer_tinymce_plugin", ' . json_encode( $this->strings ) . ");\n"; |
| 67 |
|
| 68 |
return $translated; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* |
| 73 |
* The method that returns the strings array |
| 74 |
* |
| 75 |
* @since ? |
| 76 |
* @access public |
| 77 |
* @return array |
| 78 |
*/ |
| 79 |
public function get_strings() { |
| 80 |
return $this->strings; |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
$visualizerLangClass = new Visualizer_Module_Language(); |
| 85 |
$strings = $visualizerLangClass->tinymce_translation(); |
| 86 |
|