debug
9 years ago
entities
9 years ago
managers
9 years ago
sdk
9 years ago
supplements
9 years ago
class-freemius-abstract.php
9 years ago
class-freemius.php
9 years ago
class-fs-api.php
9 years ago
class-fs-logger.php
9 years ago
class-fs-plugin-updater.php
9 years ago
class-fs-security.php
9 years ago
fs-core-functions.php
9 years ago
fs-essential-functions.php
9 years ago
fs-plugin-info-dialog.php
9 years ago
i18n.php
9 years ago
index.php
9 years ago
l10n.php
9 years ago
fs-core-functions.php
595 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 6 | * @since 1.0.3 |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | global $fs_core_logger; |
| 14 | |
| 15 | $fs_core_logger = FS_Logger::get_logger( WP_FS__SLUG . '_core', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK ); |
| 16 | |
| 17 | if ( ! function_exists( 'fs_dummy' ) ) { |
| 18 | function fs_dummy() { |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | /* Url. |
| 23 | --------------------------------------------------------------------------------------------*/ |
| 24 | function fs_get_url_daily_cache_killer() { |
| 25 | return date( '\YY\Mm\Dd' ); |
| 26 | } |
| 27 | |
| 28 | /* Templates / Views. |
| 29 | --------------------------------------------------------------------------------------------*/ |
| 30 | if ( ! function_exists( 'fs_get_template_path' ) ) { |
| 31 | function fs_get_template_path( $path ) { |
| 32 | return WP_FS__DIR_TEMPLATES . '/' . trim( $path, '/' ); |
| 33 | } |
| 34 | |
| 35 | function fs_include_template( $path, &$params = null ) { |
| 36 | $VARS = &$params; |
| 37 | include fs_get_template_path( $path ); |
| 38 | } |
| 39 | |
| 40 | function fs_include_once_template( $path, &$params = null ) { |
| 41 | $VARS = &$params; |
| 42 | include_once fs_get_template_path( $path ); |
| 43 | } |
| 44 | |
| 45 | function fs_require_template( $path, &$params = null ) { |
| 46 | $VARS = &$params; |
| 47 | require fs_get_template_path( $path ); |
| 48 | } |
| 49 | |
| 50 | function fs_require_once_template( $path, &$params = null ) { |
| 51 | $VARS = &$params; |
| 52 | require_once fs_get_template_path( $path ); |
| 53 | } |
| 54 | |
| 55 | function fs_get_template( $path, &$params = null ) { |
| 56 | ob_start(); |
| 57 | |
| 58 | $VARS = &$params; |
| 59 | require fs_get_template_path( $path ); |
| 60 | |
| 61 | return ob_get_clean(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /* Scripts and styles including. |
| 66 | --------------------------------------------------------------------------------------------*/ |
| 67 | function fs_enqueue_local_style( $handle, $path, $deps = array(), $ver = false, $media = 'all' ) { |
| 68 | global $fs_core_logger; |
| 69 | if ( $fs_core_logger->is_on() ) { |
| 70 | $fs_core_logger->info( 'handle = ' . $handle . '; path = ' . $path . ';' ); |
| 71 | $fs_core_logger->info( 'plugin_basename = ' . plugins_url( WP_FS__DIR_CSS . trim( $path, '/' ) ) ); |
| 72 | $fs_core_logger->info( 'plugins_url = ' . plugins_url( plugin_basename( WP_FS__DIR_CSS . '/' . trim( $path, '/' ) ) ) ); |
| 73 | } |
| 74 | |
| 75 | wp_enqueue_style( $handle, plugins_url( plugin_basename( WP_FS__DIR_CSS . '/' . trim( $path, '/' ) ) ), $deps, $ver, $media ); |
| 76 | } |
| 77 | |
| 78 | function fs_enqueue_local_script( $handle, $path, $deps = array(), $ver = false, $in_footer = 'all' ) { |
| 79 | global $fs_core_logger; |
| 80 | if ( $fs_core_logger->is_on() ) { |
| 81 | $fs_core_logger->info( 'handle = ' . $handle . '; path = ' . $path . ';' ); |
| 82 | $fs_core_logger->info( 'plugin_basename = ' . plugins_url( WP_FS__DIR_JS . trim( $path, '/' ) ) ); |
| 83 | $fs_core_logger->info( 'plugins_url = ' . plugins_url( plugin_basename( WP_FS__DIR_JS . '/' . trim( $path, '/' ) ) ) ); |
| 84 | } |
| 85 | |
| 86 | wp_enqueue_script( $handle, plugins_url( plugin_basename( WP_FS__DIR_JS . '/' . trim( $path, '/' ) ) ), $deps, $ver, $in_footer ); |
| 87 | } |
| 88 | |
| 89 | function fs_img_url( $path, $img_dir = WP_FS__DIR_IMG ) { |
| 90 | return plugins_url( plugin_basename( $img_dir . '/' . trim( $path, '/' ) ) ); |
| 91 | } |
| 92 | |
| 93 | /* Request handlers. |
| 94 | --------------------------------------------------------------------------------------------*/ |
| 95 | /** |
| 96 | * @param string $key |
| 97 | * @param mixed $def |
| 98 | * |
| 99 | * @return mixed |
| 100 | */ |
| 101 | function fs_request_get( $key, $def = false ) { |
| 102 | return isset( $_REQUEST[ $key ] ) ? $_REQUEST[ $key ] : $def; |
| 103 | } |
| 104 | |
| 105 | function fs_request_has( $key ) { |
| 106 | return isset( $_REQUEST[ $key ] ); |
| 107 | } |
| 108 | |
| 109 | function fs_request_get_bool( $key, $def = false ) { |
| 110 | if ( ! isset( $_REQUEST[ $key ] ) ) { |
| 111 | return $def; |
| 112 | } |
| 113 | |
| 114 | if ( 1 == $_REQUEST[ $key ] || 'true' === strtolower( $_REQUEST[ $key ] ) ) { |
| 115 | return true; |
| 116 | } |
| 117 | |
| 118 | if ( 0 == $_REQUEST[ $key ] || 'false' === strtolower( $_REQUEST[ $key ] ) ) { |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | return $def; |
| 123 | } |
| 124 | |
| 125 | function fs_request_is_post() { |
| 126 | return ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) ); |
| 127 | } |
| 128 | |
| 129 | function fs_request_is_get() { |
| 130 | return ( 'get' === strtolower( $_SERVER['REQUEST_METHOD'] ) ); |
| 131 | } |
| 132 | |
| 133 | function fs_get_action( $action_key = 'action' ) { |
| 134 | if ( ! empty( $_REQUEST[ $action_key ] ) ) { |
| 135 | return strtolower( $_REQUEST[ $action_key ] ); |
| 136 | } |
| 137 | |
| 138 | if ( 'action' == $action_key ) { |
| 139 | $action_key = 'fs_action'; |
| 140 | |
| 141 | if ( ! empty( $_REQUEST[ $action_key ] ) ) { |
| 142 | return strtolower( $_REQUEST[ $action_key ] ); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | return false; |
| 147 | } |
| 148 | |
| 149 | function fs_request_is_action( $action, $action_key = 'action' ) { |
| 150 | return ( strtolower( $action ) === fs_get_action( $action_key ) ); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * @author Vova Feldman (@svovaf) |
| 155 | * @since 1.0.0 |
| 156 | * |
| 157 | * @since 1.2.1.5 Allow nonce verification. |
| 158 | * |
| 159 | * @param string $action |
| 160 | * @param string $action_key |
| 161 | * @param string $nonce_key |
| 162 | * |
| 163 | * @return bool |
| 164 | */ |
| 165 | function fs_request_is_action_secure( |
| 166 | $action, |
| 167 | $action_key = 'action', |
| 168 | $nonce_key = 'nonce' |
| 169 | ) { |
| 170 | if ( strtolower( $action ) !== fs_get_action( $action_key ) ) { |
| 171 | return false; |
| 172 | } |
| 173 | |
| 174 | $nonce = ! empty( $_REQUEST[ $nonce_key ] ) ? |
| 175 | $_REQUEST[ $nonce_key ] : |
| 176 | ''; |
| 177 | |
| 178 | if ( empty( $nonce ) || |
| 179 | ( false === wp_verify_nonce( $nonce, $action ) ) |
| 180 | ) { |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | return true; |
| 185 | } |
| 186 | |
| 187 | function fs_is_plugin_page( $menu_slug ) { |
| 188 | return ( is_admin() && $_REQUEST['page'] === $menu_slug ); |
| 189 | } |
| 190 | |
| 191 | /* Core UI. |
| 192 | --------------------------------------------------------------------------------------------*/ |
| 193 | /** |
| 194 | * @param string $slug |
| 195 | * @param string $page |
| 196 | * @param string $action |
| 197 | * @param string $title |
| 198 | * @param array $params |
| 199 | * @param bool $is_primary |
| 200 | * @param string|bool $icon_class Optional class for an icon (since 1.1.7). |
| 201 | * @param string|bool $confirmation Optional confirmation message before submit (since 1.1.7). |
| 202 | * @param string $method Since 1.1.7 |
| 203 | * |
| 204 | * @uses fs_ui_get_action_button() |
| 205 | */ |
| 206 | function fs_ui_action_button( |
| 207 | $slug, |
| 208 | $page, |
| 209 | $action, |
| 210 | $title, |
| 211 | $params = array(), |
| 212 | $is_primary = true, |
| 213 | $icon_class = false, |
| 214 | $confirmation = false, |
| 215 | $method = 'GET' |
| 216 | ) { |
| 217 | echo fs_ui_get_action_button( |
| 218 | $slug, |
| 219 | $page, |
| 220 | $action, |
| 221 | $title, |
| 222 | $params, |
| 223 | $is_primary, |
| 224 | $icon_class, |
| 225 | $confirmation, |
| 226 | $method |
| 227 | ); |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * @author Vova Feldman (@svovaf) |
| 232 | * @since 1.1.7 |
| 233 | * |
| 234 | * @param string $slug |
| 235 | * @param string $page |
| 236 | * @param string $action |
| 237 | * @param string $title |
| 238 | * @param array $params |
| 239 | * @param bool $is_primary |
| 240 | * @param string|bool $icon_class Optional class for an icon. |
| 241 | * @param string|bool $confirmation Optional confirmation message before submit. |
| 242 | * @param string $method |
| 243 | * |
| 244 | * @return string |
| 245 | */ |
| 246 | function fs_ui_get_action_button( |
| 247 | $slug, |
| 248 | $page, |
| 249 | $action, |
| 250 | $title, |
| 251 | $params = array(), |
| 252 | $is_primary = true, |
| 253 | $icon_class = false, |
| 254 | $confirmation = false, |
| 255 | $method = 'GET' |
| 256 | ) { |
| 257 | // Prepend icon (if set). |
| 258 | $title = ( is_string( $icon_class ) ? '<i class="' . $icon_class . '"></i> ' : '' ) . $title; |
| 259 | |
| 260 | if ( is_string( $confirmation ) ) { |
| 261 | return sprintf( '<form action="%s" method="%s"><input type="hidden" name="fs_action" value="%s">%s<a href="#" class="%s" onclick="if (confirm(\'%s\')) this.parentNode.submit(); return false;">%s</a></form>', |
| 262 | freemius( $slug )->_get_admin_page_url( $page, $params ), |
| 263 | $method, |
| 264 | $action, |
| 265 | wp_nonce_field( $action, '_wpnonce', true, false ), |
| 266 | 'button' . ( $is_primary ? ' button-primary' : '' ), |
| 267 | $confirmation, |
| 268 | $title |
| 269 | ); |
| 270 | } else if ( 'GET' !== strtoupper( $method ) ) { |
| 271 | return sprintf( '<form action="%s" method="%s"><input type="hidden" name="fs_action" value="%s">%s<a href="#" class="%s" onclick="this.parentNode.submit(); return false;">%s</a></form>', |
| 272 | freemius( $slug )->_get_admin_page_url( $page, $params ), |
| 273 | $method, |
| 274 | $action, |
| 275 | wp_nonce_field( $action, '_wpnonce', true, false ), |
| 276 | 'button' . ( $is_primary ? ' button-primary' : '' ), |
| 277 | $title |
| 278 | ); |
| 279 | } else { |
| 280 | return sprintf( '<a href="%s" class="%s">%s</a></form>', |
| 281 | wp_nonce_url( freemius( $slug )->_get_admin_page_url( $page, array_merge( $params, array( 'fs_action' => $action ) ) ), $action ), |
| 282 | 'button' . ( $is_primary ? ' button-primary' : '' ), |
| 283 | $title |
| 284 | ); |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | function fs_ui_action_link( $slug, $page, $action, $title, $params = array() ) { |
| 289 | ?><a class="" |
| 290 | href="<?php echo wp_nonce_url( freemius( $slug )->_get_admin_page_url( $page, array_merge( $params, array( 'fs_action' => $action ) ) ), $action ) ?>"><?php echo $title ?></a><?php |
| 291 | } |
| 292 | |
| 293 | /*function fs_error_handler($errno, $errstr, $errfile, $errline) |
| 294 | { |
| 295 | if (false === strpos($errfile, 'freemius/')) |
| 296 | { |
| 297 | // @todo Dump Freemius errors to local log. |
| 298 | } |
| 299 | |
| 300 | // switch ($errno) { |
| 301 | // case E_USER_ERROR: |
| 302 | // break; |
| 303 | // case E_WARNING: |
| 304 | // case E_USER_WARNING: |
| 305 | // break; |
| 306 | // case E_NOTICE: |
| 307 | // case E_USER_NOTICE: |
| 308 | // break; |
| 309 | // default: |
| 310 | // break; |
| 311 | // } |
| 312 | } |
| 313 | |
| 314 | set_error_handler('fs_error_handler');*/ |
| 315 | |
| 316 | if ( ! function_exists( 'fs_nonce_url' ) ) { |
| 317 | /** |
| 318 | * Retrieve URL with nonce added to URL query. |
| 319 | * |
| 320 | * Originally was using `wp_nonce_url()` but the new version |
| 321 | * changed the return value to escaped URL, that's not the expected |
| 322 | * behaviour. |
| 323 | * |
| 324 | * @author Vova Feldman (@svovaf) |
| 325 | * @since ~1.1.3 |
| 326 | * |
| 327 | * @param string $actionurl URL to add nonce action. |
| 328 | * @param int|string $action Optional. Nonce action name. Default -1. |
| 329 | * @param string $name Optional. Nonce name. Default '_wpnonce'. |
| 330 | * |
| 331 | * @return string Escaped URL with nonce action added. |
| 332 | */ |
| 333 | function fs_nonce_url( $actionurl, $action = - 1, $name = '_wpnonce' ) { |
| 334 | return add_query_arg( $name, wp_create_nonce( $action ), $actionurl ); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | if ( ! function_exists( 'fs_starts_with' ) ) { |
| 339 | /** |
| 340 | * Check if string starts with. |
| 341 | * |
| 342 | * @author Vova Feldman (@svovaf) |
| 343 | * @since 1.1.3 |
| 344 | * |
| 345 | * @param string $haystack |
| 346 | * @param string $needle |
| 347 | * |
| 348 | * @return bool |
| 349 | */ |
| 350 | function fs_starts_with( $haystack, $needle ) { |
| 351 | $length = strlen( $needle ); |
| 352 | |
| 353 | return ( substr( $haystack, 0, $length ) === $needle ); |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | #region Url Canonization ------------------------------------------------------------------ |
| 358 | |
| 359 | if ( ! function_exists( 'fs_canonize_url' ) ) { |
| 360 | /** |
| 361 | * @author Vova Feldman (@svovaf) |
| 362 | * @since 1.1.3 |
| 363 | * |
| 364 | * @param string $url |
| 365 | * @param bool $omit_host |
| 366 | * @param array $ignore_params |
| 367 | * |
| 368 | * @return string |
| 369 | */ |
| 370 | function fs_canonize_url( $url, $omit_host = false, $ignore_params = array() ) { |
| 371 | $parsed_url = parse_url( strtolower( $url ) ); |
| 372 | |
| 373 | // if ( ! isset( $parsed_url['host'] ) ) { |
| 374 | // return $url; |
| 375 | // } |
| 376 | |
| 377 | $canonical = ( ( $omit_host || ! isset( $parsed_url['host'] ) ) ? '' : $parsed_url['host'] ) . $parsed_url['path']; |
| 378 | |
| 379 | if ( isset( $parsed_url['query'] ) ) { |
| 380 | parse_str( $parsed_url['query'], $queryString ); |
| 381 | $canonical .= '?' . fs_canonize_query_string( $queryString, $ignore_params ); |
| 382 | } |
| 383 | |
| 384 | return $canonical; |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | if ( ! function_exists( 'fs_canonize_query_string' ) ) { |
| 389 | /** |
| 390 | * @author Vova Feldman (@svovaf) |
| 391 | * @since 1.1.3 |
| 392 | * |
| 393 | * @param array $params |
| 394 | * @param array $ignore_params |
| 395 | * @param bool $params_prefix |
| 396 | * |
| 397 | * @return string |
| 398 | */ |
| 399 | function fs_canonize_query_string( array $params, array &$ignore_params, $params_prefix = false ) { |
| 400 | if ( ! is_array( $params ) || 0 === count( $params ) ) { |
| 401 | return ''; |
| 402 | } |
| 403 | |
| 404 | // Url encode both keys and values |
| 405 | $keys = fs_urlencode_rfc3986( array_keys( $params ) ); |
| 406 | $values = fs_urlencode_rfc3986( array_values( $params ) ); |
| 407 | $params = array_combine( $keys, $values ); |
| 408 | |
| 409 | // Parameters are sorted by name, using lexicographical byte value ordering. |
| 410 | // Ref: Spec: 9.1.1 (1) |
| 411 | uksort( $params, 'strcmp' ); |
| 412 | |
| 413 | $pairs = array(); |
| 414 | foreach ( $params as $parameter => $value ) { |
| 415 | $lower_param = strtolower( $parameter ); |
| 416 | |
| 417 | // Skip ignore params. |
| 418 | if ( in_array( $lower_param, $ignore_params ) || |
| 419 | ( false !== $params_prefix && fs_starts_with( $lower_param, $params_prefix ) ) |
| 420 | ) { |
| 421 | continue; |
| 422 | } |
| 423 | |
| 424 | if ( is_array( $value ) ) { |
| 425 | // If two or more parameters share the same name, they are sorted by their value |
| 426 | // Ref: Spec: 9.1.1 (1) |
| 427 | natsort( $value ); |
| 428 | foreach ( $value as $duplicate_value ) { |
| 429 | $pairs[] = $lower_param . '=' . $duplicate_value; |
| 430 | } |
| 431 | } else { |
| 432 | $pairs[] = $lower_param . '=' . $value; |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | if ( 0 === count( $pairs ) ) { |
| 437 | return ''; |
| 438 | } |
| 439 | |
| 440 | return implode( "&", $pairs ); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | if ( ! function_exists( 'fs_urlencode_rfc3986' ) ) { |
| 445 | /** |
| 446 | * @author Vova Feldman (@svovaf) |
| 447 | * @since 1.1.3 |
| 448 | * |
| 449 | * @param string|string[] $input |
| 450 | * |
| 451 | * @return array|mixed|string |
| 452 | */ |
| 453 | function fs_urlencode_rfc3986( $input ) { |
| 454 | if ( is_array( $input ) ) { |
| 455 | return array_map( 'fs_urlencode_rfc3986', $input ); |
| 456 | } else if ( is_scalar( $input ) ) { |
| 457 | return str_replace( '+', ' ', str_replace( '%7E', '~', rawurlencode( $input ) ) ); |
| 458 | } |
| 459 | |
| 460 | return ''; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | #endregion Url Canonization ------------------------------------------------------------------ |
| 465 | |
| 466 | function fs_download_image( $from, $to ) { |
| 467 | $ch = curl_init( $from ); |
| 468 | $fp = fopen( fs_normalize_path( $to ), 'wb' ); |
| 469 | curl_setopt( $ch, CURLOPT_FILE, $fp ); |
| 470 | curl_setopt( $ch, CURLOPT_HEADER, 0 ); |
| 471 | curl_exec( $ch ); |
| 472 | curl_close( $ch ); |
| 473 | fclose( $fp ); |
| 474 | } |
| 475 | |
| 476 | /* General Utilities |
| 477 | --------------------------------------------------------------------------------------------*/ |
| 478 | |
| 479 | /** |
| 480 | * Sorts an array by the value of the priority key. |
| 481 | * |
| 482 | * @author Daniel Iser (@danieliser) |
| 483 | * @since 1.1.7 |
| 484 | * |
| 485 | * @param $a |
| 486 | * @param $b |
| 487 | * |
| 488 | * @return int |
| 489 | */ |
| 490 | function fs_sort_by_priority( $a, $b ) { |
| 491 | |
| 492 | // If b has a priority and a does not, b wins. |
| 493 | if ( ! isset( $a['priority'] ) && isset( $b['priority'] ) ) { |
| 494 | return 1; |
| 495 | } // If b has a priority and a does not, b wins. |
| 496 | elseif ( isset( $a['priority'] ) && ! isset( $b['priority'] ) ) { |
| 497 | return - 1; |
| 498 | } // If neither has a priority or both priorities are equal its a tie. |
| 499 | elseif ( ( ! isset( $a['priority'] ) && ! isset( $b['priority'] ) ) || $a['priority'] === $b['priority'] ) { |
| 500 | return 0; |
| 501 | } |
| 502 | |
| 503 | // If both have priority return the winner. |
| 504 | return ( $a['priority'] < $b['priority'] ) ? - 1 : 1; |
| 505 | } |
| 506 | |
| 507 | #-------------------------------------------------------------------------------- |
| 508 | #region Localization |
| 509 | #-------------------------------------------------------------------------------- |
| 510 | |
| 511 | /** |
| 512 | * @author Vova Feldman |
| 513 | * @since 1.2.1.6 |
| 514 | * |
| 515 | * @param string $key |
| 516 | * @param string $slug |
| 517 | * |
| 518 | * @return string |
| 519 | */ |
| 520 | function fs_esc_attr($key, $slug) { |
| 521 | return esc_attr( __fs( $key, $slug ) ); |
| 522 | } |
| 523 | |
| 524 | /** |
| 525 | * @author Vova Feldman |
| 526 | * @since 1.2.1.6 |
| 527 | * |
| 528 | * @param string $key |
| 529 | * @param string $slug |
| 530 | */ |
| 531 | function fs_esc_attr_echo($key, $slug) { |
| 532 | echo esc_attr( __fs( $key, $slug ) ); |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * @author Vova Feldman |
| 537 | * @since 1.2.1.6 |
| 538 | * |
| 539 | * @param string $key |
| 540 | * @param string $slug |
| 541 | * |
| 542 | * @return string |
| 543 | */ |
| 544 | function fs_esc_js($key, $slug) { |
| 545 | return esc_js( __fs( $key, $slug ) ); |
| 546 | } |
| 547 | |
| 548 | /** |
| 549 | * @author Vova Feldman |
| 550 | * @since 1.2.1.6 |
| 551 | * |
| 552 | * @param string $key |
| 553 | * @param string $slug |
| 554 | */ |
| 555 | function fs_esc_js_echo($key, $slug) { |
| 556 | echo esc_js( __fs( $key, $slug ) ); |
| 557 | } |
| 558 | |
| 559 | /** |
| 560 | * @author Vova Feldman |
| 561 | * @since 1.2.1.6 |
| 562 | * |
| 563 | * @param string $key |
| 564 | * @param string $slug |
| 565 | */ |
| 566 | function fs_json_encode_echo($key, $slug) { |
| 567 | echo json_encode( __fs( $key, $slug ) ); |
| 568 | } |
| 569 | |
| 570 | /** |
| 571 | * @author Vova Feldman |
| 572 | * @since 1.2.1.6 |
| 573 | * |
| 574 | * @param string $key |
| 575 | * @param string $slug |
| 576 | * |
| 577 | * @return string |
| 578 | */ |
| 579 | function fs_esc_html($key, $slug) { |
| 580 | return esc_html( __fs( $key, $slug ) ); |
| 581 | } |
| 582 | |
| 583 | /** |
| 584 | * @author Vova Feldman |
| 585 | * @since 1.2.1.6 |
| 586 | * |
| 587 | * @param string $key |
| 588 | * @param string $slug |
| 589 | */ |
| 590 | function fs_esc_html_echo($key, $slug) { |
| 591 | echo esc_html( __fs( $key, $slug ) ); |
| 592 | } |
| 593 | |
| 594 | #endregion |
| 595 |