| @@ -10,10 +10,25 @@ | ||
| 10 | 10 | * |
| 11 | 11 | * @since 1.0.2 |
| 12 | 12 | */ |
| 13 | 13 | class PLL_WPML_Compat { |
| 14 | - protected static $instance; // For singleton | |
| 15 | - protected static $strings; // Used for cache | |
| 14 | + /** | |
| 15 | + * Singleton instance | |
| 16 | + * | |
| 17 | + * @var PLL_WPML_Compat | |
| 18 | + */ | |
| 19 | + protected static $instance; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * Stores the strings registered with the WPML API. | |
| 23 | + * | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | + protected static $strings; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * @var PLL_WPML_API | |
| 30 | + */ | |
| 16 | 31 | public $api; |
| 17 | 32 | |
| 18 | 33 | /** |
| 19 | 34 | * Constructor |
| @@ -36,9 +51,9 @@ | ||
| 36 | 51 | * Access to the single instance of the class |
| 37 | 52 | * |
| 38 | 53 | * @since 1.7 |
| 39 | 54 | * |
| 40 | - * @return object | |
| 55 | + * @return PLL_WPML_Compat | |
| 41 | 56 | */ |
| 42 | 57 | public static function instance() { |
| 43 | 58 | if ( empty( self::$instance ) ) { |
| 44 | 59 | self::$instance = new self(); |
| @@ -51,8 +66,10 @@ | ||
| 51 | 66 | * The compatibility with WPML is not perfect on admin side as the constants are defined |
| 52 | 67 | * in 'setup_theme' by Polylang ( based on user info ) and 'plugins_loaded' by WPML ( based on cookie ) |
| 53 | 68 | * |
| 54 | 69 | * @since 0.9.5 |
| 70 | + * | |
| 71 | + * @return void | |
| 55 | 72 | */ |
| 56 | 73 | public function define_constants() { |
| 57 | 74 | if ( ! empty( PLL()->curlang ) ) { |
| 58 | 75 | if ( ! defined( 'ICL_LANGUAGE_CODE' ) ) { |
| @@ -82,8 +99,9 @@ | ||
| 82 | 99 | * |
| 83 | 100 | * @param string $context The group in which the string is registered. |
| 84 | 101 | * @param string $name A unique name for the string. |
| 85 | 102 | * @param string $string The string to register. |
| 103 | + * @return void | |
| 86 | 104 | */ |
| 87 | 105 | public function register_string( $context, $name, $string ) { |
| 88 | 106 | // If a string has already been registered with the same name and context, let's replace it. |
| 89 | 107 | $exist_string = $this->get_string_by_context_and_name( $context, $name ); |
| @@ -117,8 +135,9 @@ | ||
| 117 | 135 | * @since 1.0.2 |
| 118 | 136 | * |
| 119 | 137 | * @param string $context The group in which the string is registered. |
| 120 | 138 | * @param string $name A unique name for the string. |
| 139 | + * @return void | |
| 121 | 140 | */ |
| 122 | 141 | public function unregister_string( $context, $name ) { |
| 123 | 142 | $key = md5( "$context | $name" ); |
| 124 | 143 | if ( isset( self::$strings[ $key ] ) ) { |