PluginProbe
Polylang / 2.6.3
Polylang v2.6.3
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | modules/wpml/wpml-compat.php +17 -13 2.7.42.6.3 View file →
@@ -101,10 +101,9 @@
101 101
102 102 // Registers the string if it does not exist yet (multiline as in WPML).
103 103 $to_register = array( 'context' => $context, 'name' => $name, 'string' => $string, 'multiline' => true, 'icl' => true );
104 104 if ( ! in_array( $to_register, self::$strings ) && $to_register['string'] ) {
105 - $key = md5( "$context | $name" );
106 - self::$strings[ $key ] = $to_register;
105 + self::$strings[] = $to_register;
107 106 update_option( 'polylang_wpml_strings', self::$strings );
108 107 }
109 108 }
110 109
@@ -112,16 +111,17 @@
112 111 * Removes a string from the registered strings list
113 112 *
114 113 * @since 1.0.2
115 114 *
116 - * @param string $context The group in which the string is registered.
117 - * @param string $name A unique name for the string.
115 + * @param string $context the group in which the string is registered, defaults to 'polylang'
116 + * @param string $name a unique name for the string
118 117 */
119 118 public function unregister_string( $context, $name ) {
120 - $key = md5( "$context | $name" );
121 - if ( isset( self::$strings[ $key ] ) ) {
122 - unset( self::$strings[ $key ] );
123 - update_option( 'polylang_wpml_strings', self::$strings );
119 + foreach ( self::$strings as $key => $string ) {
120 + if ( $string['context'] == $context && $string['name'] == $name ) {
121 + unset( self::$strings[ $key ] );
122 + update_option( 'polylang_wpml_strings', self::$strings );
123 + }
124 124 }
125 125 }
126 126
127 127 /**
@@ -140,13 +140,17 @@
140 140 * Get a registered string by its context and name
141 141 *
142 142 * @since 2.0
143 143 *
144 - * @param string $context The group in which the string is registered.
145 - * @param string $name A unique name for the string.
146 - * @return bool|string The registered string, false if none was found.
144 + * @param string $context the group in which the string is registered
145 + * @param string $name a unique name for the string
146 + * @return bool|string the registered string, false if none was found
147 147 */
148 148 public function get_string_by_context_and_name( $context, $name ) {
149 - $key = md5( "$context | $name" );
150 - return isset( self::$strings[ $key ] ) ? self::$strings[ $key ]['string'] : false;
149 + foreach ( self::$strings as $string ) {
150 + if ( $string['context'] == $context && $string['name'] == $name ) {
151 + return $string['string'];
152 + }
153 + }
154 + return false;
151 155 }
152 156 }