| @@ -112,8 +112,9 @@ | ||
| 112 | 112 | if(($post['type'] == 'conversions') && !empty($post['link_button'])){ |
| 113 | 113 | $meta['link_button_text'] = ['Link Button Text', 'LINE']; |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 116 | 117 | return apply_filters('nx_wpml_translate_field', $meta, $post); |
| 117 | 118 | } |
| 118 | 119 | |
| 119 | 120 | public function localize_moment($nx_ids = null, $return_url = false){ |
| @@ -145,8 +146,9 @@ | ||
| 145 | 146 | $_key = isset($param[2]) ? $param[2] : $key; |
| 146 | 147 | if($value = $settings->get($_key)){ |
| 147 | 148 | $title = $param[0]; |
| 148 | 149 | $type = $param[1]; |
| 150 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 149 | 151 | do_action('wpml_register_string', $value, $key, $package, $title, $type); |
| 150 | 152 | } |
| 151 | 153 | } |
| 152 | 154 | |
| @@ -169,8 +171,9 @@ | ||
| 169 | 171 | |
| 170 | 172 | foreach ($this->template as $key => $param) { |
| 171 | 173 | $_key = "notification-template.$key"; |
| 172 | 174 | if($value = $settings->get($_key)){ |
| 175 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 173 | 176 | do_action('wpml_register_string', $value, $key, $package, $param, 'LINE'); |
| 174 | 177 | } |
| 175 | 178 | } |
| 176 | 179 | } |
| @@ -177,8 +180,9 @@ | ||
| 177 | 180 | |
| 178 | 181 | } |
| 179 | 182 | |
| 180 | 183 | public function translate_values($post){ |
| 184 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 181 | 185 | if(empty($_GET['frontend']) && !did_action( "nx_inline" )){ |
| 182 | 186 | // checking if request came from frontend. |
| 183 | 187 | return $post; |
| 184 | 188 | } |
| @@ -189,8 +193,9 @@ | ||
| 189 | 193 | |
| 190 | 194 | foreach ($this->get_meta($post) as $key => $param) { |
| 191 | 195 | $_key = isset($param[2]) ? $param[2] : $key; |
| 192 | 196 | if($value = $settings->get($_key)){ |
| 197 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 193 | 198 | $value = apply_filters( 'wpml_translate_string', $value, $key, $package ); |
| 194 | 199 | $settings->set($_key, $value); |
| 195 | 200 | } |
| 196 | 201 | } |
| @@ -198,8 +203,9 @@ | ||
| 198 | 203 | if($post['source'] != 'press_bar'){ |
| 199 | 204 | foreach ($this->template as $key => $param) { |
| 200 | 205 | $_key = "notification-template.$key"; |
| 201 | 206 | if($value = $settings->get($_key)){ |
| 207 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 202 | 208 | $value = apply_filters( 'wpml_translate_string', $value, $key, $package ); |
| 203 | 209 | $settings->set($_key, $value); |
| 204 | 210 | } |
| 205 | 211 | } |
| @@ -208,8 +214,9 @@ | ||
| 208 | 214 | } |
| 209 | 215 | |
| 210 | 216 | public function delete_translation($nx_id, $post){ |
| 211 | 217 | $package = $this->generate_package($post, $nx_id); |
| 218 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 212 | 219 | do_action( 'wpml_delete_package', $package['name'], $package['kind'] ); |
| 213 | 220 | } |
| 214 | 221 | |
| 215 | 222 | /** |
| @@ -218,10 +225,12 @@ | ||
| 218 | 225 | * @param [type] $request |
| 219 | 226 | * @return void |
| 220 | 227 | */ |
| 221 | 228 | public function translate($request){ |
| 229 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 222 | 230 | if(!empty($_GET['id'])){ |
| 223 | - $nx_id = sanitize_text_field( $_GET['id'] ); | |
| 231 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 232 | + $nx_id = sanitize_text_field( wp_unslash( $_GET['id'] ) ); | |
| 224 | 233 | $post = PostType::get_instance()->get_post($nx_id); |
| 225 | 234 | if($post['source'] == 'press_bar' && !empty($post['elementor_id'])){ |
| 226 | 235 | $cookie = new \WPML_Cookie(); |
| 227 | 236 | $cookie_data = filter_var( http_build_query( ['type' => 'nx_bar'] ), FILTER_SANITIZE_URL ); |
| @@ -226,9 +235,9 @@ | ||
| 226 | 235 | $cookie = new \WPML_Cookie(); |
| 227 | 236 | $cookie_data = filter_var( http_build_query( ['type' => 'nx_bar'] ), FILTER_SANITIZE_URL ); |
| 228 | 237 | $cookie->set_cookie( 'wp-translation_dashboard_filter', $cookie_data, time() + HOUR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); |
| 229 | 238 | |
| 230 | - wp_redirect(admin_url("admin.php?page=wpml-translation-management/menu/main.php&sm=dashboard")); | |
| 239 | + wp_safe_redirect(admin_url("admin.php?page=wpml-translation-management/menu/main.php&sm=dashboard")); | |
| 231 | 240 | die; |
| 232 | 241 | } |
| 233 | 242 | else if($post){ |
| 234 | 243 | $post['is_translated'] = true; |
| @@ -236,9 +245,9 @@ | ||
| 236 | 245 | 'data' => $post, |
| 237 | 246 | ], $nx_id); |
| 238 | 247 | |
| 239 | 248 | $this->register_package($post, [], $nx_id); |
| 240 | - wp_redirect(admin_url("admin.php?page=wpml-string-translation/menu/string-translation.php&context=notificationx-$nx_id")); | |
| 249 | + wp_safe_redirect(admin_url("admin.php?page=wpml-string-translation/menu/string-translation.php&context=notificationx-$nx_id")); | |
| 241 | 250 | die; |
| 242 | 251 | } |
| 243 | 252 | } |
| 244 | 253 | return new WP_Error(); |
| @@ -253,9 +262,11 @@ | ||
| 253 | 262 | * @param [type] $rest |
| 254 | 263 | * @return void |
| 255 | 264 | */ |
| 256 | 265 | public function rest_data($rest){ |
| 266 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 257 | 267 | $my_default_lang = apply_filters('wpml_default_language', NULL ); |
| 268 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 258 | 269 | $my_current_lang = apply_filters( 'wpml_current_language', NULL ); |
| 259 | 270 | if($my_default_lang != $my_current_lang){ |
| 260 | 271 | $rest['lang'] = $my_current_lang; |
| 261 | 272 | } |