if ( empty( $addons ) ) { return []; } $default_args = [ 'category' => '', 'license' => '', ]; $args = wp_parse_args( $args, $default_args ); $filtered_addons = []; foreach ( $addons as $addon ) { foreach ( [ 'category', 'license' ] as $arg_key ) { if ( ! empty( $args[ $arg_key ] ) && ! empty( $addon[ $arg_key ] ) && is_array( $addon[ $arg_key ] ) && in_array( strtolower( $args[ $arg_key ] ), $addon[ $arg_key ], true ) ) { $filtered_addons[] = $addon; } } } return $filtered_addons; } /** * Get available addons data by category. * * @since 1.6.6 * * @param string $category Addon category. * * @return array. */ public function get_by_category( string $category ) { return $this->get_filtered( $this->get_available(), [ 'category' => $category ] ); } /** * Get available addons data by license. * * @since 1.6.6 * * @param string $license Addon license. * * @return array. * @noinspection PhpUnused */ public function get_by_license( string $license ) { return $this->get_filtered( $this->get_available(), [ 'license' => $license ] ); } /** * Get available addons data by slugs. * * @since 1.6.8 * * @param array|mixed $slugs Addon slugs. * * @return array */ public function get_by_slugs( $slugs ) { if ( empty( $slugs ) || ! is_array( $slugs ) ) { return []; } $result_addons = []; foreach ( $slugs as $slug ) { $addon = $this->get_addon( $slug ); if ( ! empty( $addon ) ) { $result_addons[] = $addon; } } return $result_addons; } /** * Get available addon data by slug. * * @since 1.6.6 * * @param string|bool $slug Addon slug can be both "wpforms-drip" and "drip". * * @return array Single addon data. Empty array if addon is not found. */ public function get_addon( $slug ) { $slug = (string) $slug; $slug = 'wpforms-' . str_replace( 'wpforms-', '', sanitize_key( $slug ) ); $addon = $this->get_available()[ $slug ] ?? []; // In case if addon is "not available" let's try to get and prepare addon data from all addons. if ( empty( $addon ) ) { $addon = ! empty( $this->addons[ $slug ] ) ? $this->prepare_addon_data( $this->addons[ $slug ] ) : []; } return $addon; } /** * Check if addon is active. * * @since 1.8.9 * * @param string $slug Addon slug. * * @return bool */ public function is_active( string $slug ): bool { $addon = $this->get_addon( $slug ); return isset( $addon['status'] ) && $addon['status'] === 'active'; } /** * Get license level of the addon. * * @since 1.6.6 * * @param array|string $addon Addon data array OR addon slug. * * @return string License level: pro | elite. */ private function get_license_level( $addon ) { if ( empty( $addon ) ) { return ''; } $levels = [ self::BASIC, self::PLUS, self::PRO, self::ELITE, self::AGENCY, self::ULTIMATE ]; $license = ''; $addon_license = $this->get_addon_license( $addon ); foreach ( $levels as $level ) { if ( in_array( $level, $addon_license, true ) ) { $license = $level; break; } } if ( empty( $license ) ) { return ''; } return in_array( $license, [ self::BASIC, self::PLUS, self::PRO ], true ) ? self::PRO : self::ELITE; } /** * Get addon license. * * @since 1.8.2 * * @param array|string $addon Addon data array OR addon slug. * * @return array */ private function get_addon_license( $addon ) { $addon = is_string( $addon ) ? $this->get_addon( $addon ) : $addon; return $this->default_data( $addon, 'license', [] ); } /** * Determine if a user's license level has access. * * @since 1.6.6 * * @param array|string $addon Addon data array OR addon slug. * * @return bool */ protected function has_access( $addon ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found return false; } /** * Return array of addons available to display. All data is prepared and normalized. * "Available to display" means that addon needs to be displayed as an education item (addon is not installed or not activated). * * @since 1.6.6 * * @return array */ public function get_available() { static $available_addons = []; if ( $available_addons ) { return $available_addons; } if ( empty( $this->addons ) || ! is_array( $this->addons ) ) { return []; } $available_addons = array_map( [ $this, 'prepare_addon_data' ], $this->addons ); $available_addons = array_filter( $available_addons, static function ( $addon ) { return isset( $addon['status'], $addon['plugin_allow'] ) && ( $addon['status'] !== 'active' || ! $addon['plugin_allow'] ); } ); return $available_addons; } /** * Prepare addon data. * * @since 1.6.6 * * @param array|mixed $addon Addon data. * * @return array Extended addon data. */ protected function prepare_addon_data( $addon ) { if ( empty( $addon ) ) { return []; } $addon['title'] = $this->default_data( $addon, 'title', '' ); $addon['slug'] = $this->default_data( $addon, 'slug', '' ); // We need the cleared name of the addon, without the 'addon' suffix, for further use. $addon['name'] = preg_replace( '/ addon$/i', '', $addon['title'] ); $addon['modal_name'] = sprintf( /* translators: %s - addon name. */ esc_html__( '%s addon', 'wpforms-lite' ), $addon['name'] ); $addon['clear_slug'] = str_replace( 'wpforms-', '', $addon['slug'] ); $addon['utm_content'] = ucwords( str_replace( '-', ' ', $addon['clear_slug'] ) ); $addon['license'] = $this->default_data( $addon, 'license', [] ); $addon['license_level'] = $this->get_license_level( $addon ); $addon['icon'] = $this->default_data( $addon, 'icon', '' ); $addon['path'] = sprintf( '%1$s/%1$s.php', $addon['slug'] ); $addon['video'] = $this->default_data( $addon, 'video', '' ); $addon['plugin_allow'] = $this->has_access( $addon ); $addon['status'] = 'missing'; $addon['action'] = 'upgrade'; $addon['page_url'] = $this->default_data( $addon, 'url', '' ); $addon['doc_url'] = $this->default_data( $addon, 'doc', '' ); $addon['url'] = ''; static $nonce = ''; $nonce = empty( $nonce ) ? wp_create_nonce( 'wpforms-admin' ) : $nonce; $addon['nonce'] = $nonce; return $addon; } /** * Get default data. * * @since 1.8.2 * * @param array|mixed $addon Addon data. * @param string $key Key. * @param mixed $default_data Default data. * * @return array|string|mixed */ private function default_data( $addon, string $key, $default_data ) { if ( is_string( $default_data ) ) { return ! empty( $addon[ $key ] ) ? $addon[ $key ] : $default_data; } if ( is_array( $default_data ) ) { return ! empty( $addon[ $key ] ) ? (array) $addon[ $key ] : $default_data; } return $addon[ $key ] ?? ''; } }
Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/wp-content/plugins/wpforms-lite/src/Admin/Addons/Addons.php:1) in /htdocs/wp-includes/rest-api/class-wp-rest-server.php on line 1831
1.0JavaMarket | Vente en ligne Vetement Chaussure, Santé, Electroménagé Hygiène, Téléphones, TV, Jeux Vidéoshttps://java-market.comJavaMarket | Vente en ligne Vetement Chaussure, Santé, Electroménagé Hygiène, Téléphones, TV, Jeux Vidéoshttps://java-market.comSky Crown Australiarich600338<blockquote class="wp-embedded-content" data-secret="PQvss7xhno"><a href="https://java-market.com/sky-crown-australia/">Sky Crown Australia</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://java-market.com/sky-crown-australia/embed/#?secret=PQvss7xhno" width="600" height="338" title="« Sky Crown Australia » — JavaMarket | Vente en ligne Vetement Chaussure, Santé, Electroménagé Hygiène, Téléphones, TV, Jeux Vidéos" data-secret="PQvss7xhno" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script type="text/javascript"> /* <![CDATA[ */ /*! This file is auto-generated */ !function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document); /* ]]> */ </script>