* * @param array $current_demo_list Current demo list. * @return array */ public function add_template_library( $current_demo_list ) { /* Common check */ if ( advanced_import_get_current_theme_author() !== $this->theme_author ) { return $current_demo_list; } /* Prepare API arguments */ $args = array( 'theme-slug' => esc_attr( advanced_import_get_current_theme_slug() ), ); $args = apply_filters( 'advanced_import_theme_api_args', $args ); $url = add_query_arg( $args, $this->api_url ); /* Fetch cached or fresh API data */ $templates_list = advanced_import_get_api_data( $url ); if ( is_array( $templates_list ) ) { return array_merge( $current_demo_list, $templates_list ); } return $current_demo_list; } /** * Load template library * * @since 1.4.6 * @package Acmethemes * @author Acmethemes * * @param array $args Existing args. * @return array */ public function add_args( $args ) { /* Common check */ if ( advanced_import_get_current_theme_author() !== $this->theme_author ) { return $args; } $current_theme_slug = advanced_import_get_current_theme_slug(); $license = trim( get_option( $current_theme_slug . '_license_key' ) ); if ( $license ) { $args['license-info'][ $current_theme_slug ] = array( 'author' => $this->theme_author, /* * Send both plaintext 'license' and hashed 'license-hash'. * The remote API is still being updated to accept 'license-hash' * (the new, secure format). Sending both fields keeps the * plugin working with both old and new API versions. Once the * remote side is fully migrated, the 'license' field can be removed. */ 'license' => $license, 'url' => home_url(), 'environment' => function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : 'production', ); } return $args; } } }