| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | 16 | // Current SDK version and path. |
| 17 | -$themeisle_sdk_version = '3.3.61'; | |
| 17 | +$themeisle_sdk_version = '3.3.13'; | |
| 18 | 18 | $themeisle_sdk_path = dirname( __FILE__ ); |
| 19 | 19 | |
| 20 | 20 | global $themeisle_sdk_max_version; |
| 21 | 21 | global $themeisle_sdk_max_path; |
| @@ -71,87 +71,8 @@ | ||
| 71 | 71 | } |
| 72 | 72 | endif; |
| 73 | 73 | add_action( 'init', 'themeisle_sdk_load_latest' ); |
| 74 | 74 | |
| 75 | -if ( ! function_exists( 'themeisle_sdk_crash_sentinel' ) ) : | |
| 76 | - /** | |
| 77 | - * Early crash sentinel: minimal shutdown-time capture of fatal errors | |
| 78 | - * originating from a registered ThemeIsle product directory. | |
| 79 | - * | |
| 80 | - * Runs only when the full crash reporter module never registered (e.g. the | |
| 81 | - * fatal happened during plugin bootstrap, before the SDK loaded on init). | |
| 82 | - * Stores one raw record locally; the module sanitizes and adopts it on the | |
| 83 | - * next normal load. Never outputs, never exits, fails silently. | |
| 84 | - * | |
| 85 | - * Must stay parseable on PHP 5.4, like the rest of this file. | |
| 86 | - */ | |
| 87 | - function themeisle_sdk_crash_sentinel() { | |
| 88 | - if ( defined( 'THEMEISLE_SDK_CRASH_HANDLER' ) ) { | |
| 89 | - return; | |
| 90 | - } | |
| 91 | - if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) { | |
| 92 | - return; | |
| 93 | - } | |
| 94 | - if ( ! function_exists( 'apply_filters' ) || ! function_exists( 'get_option' ) || ! function_exists( 'update_option' ) || ! function_exists( 'add_option' ) ) { | |
| 95 | - return; | |
| 96 | - } | |
| 97 | - $error = error_get_last(); | |
| 98 | - if ( empty( $error ) || ! isset( $error['type'] ) || ! in_array( (int) $error['type'], array( E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR ), true ) ) { | |
| 99 | - return; | |
| 100 | - } | |
| 101 | - $error_file = isset( $error['file'] ) ? str_replace( '\\', '/', (string) $error['file'] ) : ''; | |
| 102 | - if ( '' === $error_file ) { | |
| 103 | - return; | |
| 104 | - } | |
| 105 | - $products = apply_filters( 'themeisle_sdk_products', array() ); | |
| 106 | - if ( empty( $products ) || ! is_array( $products ) ) { | |
| 107 | - return; | |
| 108 | - } | |
| 109 | - foreach ( $products as $basefile ) { | |
| 110 | - $product_dir = rtrim( str_replace( '\\', '/', dirname( (string) $basefile ) ), '/' ) . '/'; | |
| 111 | - if ( '/' === $product_dir || 0 !== strpos( $error_file, $product_dir ) ) { | |
| 112 | - continue; | |
| 113 | - } | |
| 114 | - $key = str_replace( '-', '_', strtolower( trim( basename( $product_dir ) ) ) ); | |
| 115 | - $option = $key . '_crash_data'; | |
| 116 | - $data = get_option( $option, array() ); | |
| 117 | - if ( ! is_array( $data ) ) { | |
| 118 | - $data = array(); | |
| 119 | - } | |
| 120 | - if ( ! isset( $data['raw'] ) || ! is_array( $data['raw'] ) ) { | |
| 121 | - $data['raw'] = array(); | |
| 122 | - } | |
| 123 | - if ( count( $data['raw'] ) >= 3 ) { | |
| 124 | - return; | |
| 125 | - } | |
| 126 | - foreach ( $data['raw'] as $record ) { | |
| 127 | - if ( isset( $record['file'] ) && isset( $record['line'] ) && $record['file'] === $error_file && (int) $record['line'] === (int) $error['line'] ) { | |
| 128 | - return; | |
| 129 | - } | |
| 130 | - } | |
| 131 | - $data['raw'][] = array( | |
| 132 | - 'type' => (int) $error['type'], | |
| 133 | - 'message' => substr( isset( $error['message'] ) ? (string) $error['message'] : '', 0, 2000 ), | |
| 134 | - 'file' => $error_file, | |
| 135 | - 'line' => isset( $error['line'] ) ? (int) $error['line'] : 0, | |
| 136 | - 'time' => time(), | |
| 137 | - ); | |
| 138 | - if ( false === get_option( $option, false ) ) { | |
| 139 | - add_option( $option, $data, '', 'no' ); | |
| 140 | - } else { | |
| 141 | - update_option( $option, $data ); | |
| 142 | - } | |
| 143 | - | |
| 144 | - return; | |
| 145 | - } | |
| 146 | - } | |
| 147 | -endif; | |
| 148 | - | |
| 149 | -if ( empty( $GLOBALS['themeisle_sdk_crash_sentinel'] ) ) { | |
| 150 | - $GLOBALS['themeisle_sdk_crash_sentinel'] = true; | |
| 151 | - register_shutdown_function( 'themeisle_sdk_crash_sentinel' ); | |
| 152 | -} | |
| 153 | - | |
| 154 | 75 | if ( ! function_exists( 'tsdk_utmify' ) ) { |
| 155 | 76 | /** |
| 156 | 77 | * Utmify a link. |
| 157 | 78 | * |
| @@ -169,9 +90,8 @@ | ||
| 169 | 90 | $current_page = isset( $screen->id ) ? $screen->id : ( ( $screen === null ) ? 'non-admin' : $screen ); |
| 170 | 91 | $current_page = sanitize_key( str_replace( '.php', '', $current_page ) ); |
| 171 | 92 | } |
| 172 | 93 | $location = $location === null ? $current_page : $location; |
| 173 | - $is_upgrade_url = strpos( $url, '/upgrade' ) !== false; | |
| 174 | 94 | $content = sanitize_key( |
| 175 | 95 | trim( |
| 176 | 96 | str_replace( |
| 177 | 97 | [ |
| @@ -200,29 +120,8 @@ | ||
| 200 | 120 | $query_arguments, |
| 201 | 121 | $url |
| 202 | 122 | ) |
| 203 | 123 | ); |
| 204 | - | |
| 205 | - /** | |
| 206 | - * Check if there is an affiliate URL for this upgrade link, if so use it. | |
| 207 | - */ | |
| 208 | - if ( $is_upgrade_url ) { | |
| 209 | - $option_content_key = str_replace( '-', '_', $filter_key ); | |
| 210 | - $theme_upgrade_option_name = 'themeisle_af_' . $option_content_key . '_themes_upgrade'; | |
| 211 | - $plugin_upgrade_option_name = 'themeisle_af_' . $option_content_key . '_plugins_upgrade'; | |
| 212 | - | |
| 213 | - $theme_option_url = get_option( $theme_upgrade_option_name, false ); | |
| 214 | - if ( ! empty( $theme_option_url ) ) { | |
| 215 | - $utmify_url = esc_url_raw( $theme_option_url ); | |
| 216 | - } | |
| 217 | - $plugin_option_url = get_option( $plugin_upgrade_option_name, false ); | |
| 218 | - if ( ! empty( $plugin_option_url ) ) { | |
| 219 | - $utmify_url = esc_url_raw( $plugin_option_url ); | |
| 220 | - } | |
| 221 | - } | |
| 222 | - | |
| 223 | - | |
| 224 | - | |
| 225 | 124 | return apply_filters( 'tsdk_utmify_url_' . $filter_key, $utmify_url, $url ); |
| 226 | 125 | } |
| 227 | 126 | |
| 228 | 127 | add_filter( 'tsdk_utmify', 'tsdk_utmify', 10, 3 ); |
| @@ -275,55 +174,8 @@ | ||
| 275 | 174 | * @return string Key. |
| 276 | 175 | */ |
| 277 | 176 | function tsdk_lkey( $file ) { |
| 278 | 177 | return \ThemeisleSDK\Modules\Licenser::key( $file ); |
| 279 | - } | |
| 280 | -} | |
| 281 | - | |
| 282 | -if ( ! function_exists( 'tsdk_translate_link' ) ) { | |
| 283 | - | |
| 284 | - /** | |
| 285 | - * Function to translate a link based on the current language. | |
| 286 | - * | |
| 287 | - * @param string $url URL to translate. | |
| 288 | - * @param string{'path'|'query'|'domain'} $type Type of localization. Supports path, query and domain. | |
| 289 | - * @param array $available_languages Available language to choose from. | |
| 290 | - * | |
| 291 | - * @return string | |
| 292 | - */ | |
| 293 | - function tsdk_translate_link( | |
| 294 | - $url, $type = 'path', $available_languages = [ | |
| 295 | - 'de_DE' => 'de', | |
| 296 | - 'de_DE_formal' => 'de', | |
| 297 | - 'es_ES' => 'es', | |
| 298 | - 'fr_FR' => 'fr', | |
| 299 | - 'it_IT' => 'it', | |
| 300 | - 'ja' => 'ja', | |
| 301 | - 'nl_NL' => 'nl', | |
| 302 | - 'nl_NL_formal' => 'nl', | |
| 303 | - 'ro_RO' => 'ro', | |
| 304 | - ] | |
| 305 | - ) { | |
| 306 | - $language = get_user_locale(); | |
| 307 | - if ( ! isset( $available_languages[ $language ] ) ) { | |
| 308 | - return $url; | |
| 309 | - } | |
| 310 | - $code = $available_languages[ $language ]; | |
| 311 | - // We asume that false is based on query and add the code via query arg. | |
| 312 | - if ( $type === 'query' ) { | |
| 313 | - return add_query_arg( 'lang', $code, $url ); | |
| 314 | - } | |
| 315 | - | |
| 316 | - $parsed_url = wp_parse_url( $url ); | |
| 317 | - // we replace the domain here based on the localized one. | |
| 318 | - if ( $type === 'domain' ) { | |
| 319 | - return $parsed_url['scheme'] . '://' . $code . ( isset( $parsed_url['path'] ) ? $parsed_url['path'] : '' ) . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' ) . ( isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '' ); | |
| 320 | - } | |
| 321 | - // default is the path based approach. | |
| 322 | - $new_path = isset( $parsed_url['path'] ) ? "/$code" . $parsed_url['path'] : "/$code"; | |
| 323 | - | |
| 324 | - return $parsed_url['scheme'] . '://' . $parsed_url['host'] . $new_path . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' ) . ( isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '' ); | |
| 325 | - | |
| 326 | 178 | } |
| 327 | 179 | } |
| 328 | 180 | if ( ! function_exists( 'tsdk_support_link' ) ) { |
| 329 | 181 | |