diff --git a/backend/changelog_handler.php b/backend/changelog_handler.php index 9d0d887b..05c0bcba 100644 --- a/backend/changelog_handler.php +++ b/backend/changelog_handler.php @@ -58,8 +58,8 @@ private function parse_changelog( $changelog_path ) { preg_match( '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $changelog_line, $found_v ); preg_match( '/[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/', $changelog_line, $found_d ); $releases[ $release_count ] = array( - 'version' => $found_v[0], - 'date' => $found_d[0], + 'version' => ! empty( $found_v ) ? $found_v[0] : '', + 'date' => ! empty( $found_d ) ? $found_d[0] : '', ); continue; } diff --git a/classes/admin.class.php b/classes/admin.class.php index 779a0b99..85a9ffa9 100644 --- a/classes/admin.class.php +++ b/classes/admin.class.php @@ -134,7 +134,7 @@ function add_menu_pages() { if ( ! current_user_can( 'administrator' ) ) { $cap = 'ppom_options_page'; // Menu page for roles set by PPOM Permission Settings - add_menu_page( + $menu = add_menu_page( __( $page ['page_title'], 'woocommerce-product-addon' ), __( 'PPOM Fields', 'woocommerce-product-addon' ), $cap, @@ -145,6 +145,8 @@ function add_menu_pages() { ) ); } + + add_action( "load-$menu", array( $this, 'load_admin_menu' ) ); } } @@ -396,5 +398,14 @@ class="select_none button" href="#">init(); + } + } diff --git a/classes/fields.class.php b/classes/fields.class.php index ab209828..4d00a5b6 100644 --- a/classes/fields.class.php +++ b/classes/fields.class.php @@ -1040,7 +1040,7 @@ function render_all_input_types( $name, $data, $fields_type, $field_index, $valu * @since 7.1 */ case 'bulk-quantity': - $bulk_data = json_decode( $values, true ); + $bulk_data = is_string( $values ) ? json_decode( $values, true ) : (array) $values; // ppom_pa($bulk_data[0]); $html_input .= '
'; $html_input .= '
'; @@ -1059,7 +1059,7 @@ function render_all_input_types( $name, $data, $fields_type, $field_index, $valu $html_input .= ''; $html_input .= ''; - if ( $values ) { + if ( ! empty( $bulk_data ) ) { foreach ( $bulk_data[0] as $title => $value ) { $deleteIcon = ( $title != 'Quantity Range' && $title != 'Base Price' ) ? '' : ''; $html_input .= '' . $title . ' ' . $deleteIcon . ''; @@ -1073,7 +1073,7 @@ function render_all_input_types( $name, $data, $fields_type, $field_index, $valu $html_input .= ''; $html_input .= ''; - if ( $values ) { + if ( ! empty( $bulk_data ) ) { foreach ( $bulk_data as $row => $data ) { $html_input .= ''; foreach ( $data as $key => $value ) { @@ -1109,8 +1109,8 @@ function render_all_input_types( $name, $data, $fields_type, $field_index, $valu $html_input .= ' '; $html_input .= ''; - if ( $values ) { - $html_input .= ""; + if ( ! empty( $bulk_data ) ) { + $html_input .= ""; } else { $html_input .= ""; } diff --git a/classes/ppom.class.php b/classes/ppom.class.php index acc5a79c..78691342 100644 --- a/classes/ppom.class.php +++ b/classes/ppom.class.php @@ -133,6 +133,11 @@ function __construct( $product_id = null ) { } } + // Retrieve fields with the repeater enabled. + $is_cloned = is_array( $this->fields ) ? array_filter( array_column( $this->fields, 'is_cloned' ) ) : array(); + if ( isset( $this->ppom_settings->productmeta_validation ) && ! empty( $is_cloned ) ) { + $this->ppom_settings->productmeta_validation = 'on'; + } } public static function get_instance( $product_id ) { diff --git a/classes/survey.class.php b/classes/survey.class.php new file mode 100644 index 00000000..689a4b3a --- /dev/null +++ b/classes/survey.class.php @@ -0,0 +1,134 @@ +key ) ? $license_data->key : preg_replace( '/[^\w\d]*/', '', get_site_url() ) ); // Use a normalized version of the site URL as a user ID for free users. + + $days_since_install = round( ( time() - get_option( 'woocommerce_product_addon_install', 0 ) ) / DAY_IN_SECONDS ); + $install_category = 0; // Normalized value. + if ( 0 === $days_since_install || 1 === $days_since_install ) { + $install_category = 0; + } elseif ( 1 < $days_since_install && 8 > $days_since_install ) { + $install_category = 7; + } elseif ( 8 <= $days_since_install && 31 > $days_since_install ) { + $install_category = 30; + } elseif ( 30 < $days_since_install && 90 > $days_since_install ) { + $install_category = 90; + } elseif ( 90 <= $days_since_install ) { + $install_category = 91; + } + + $attributes['days_since_install'] = strval( $install_category ); + $attributes['license_status'] = ! empty( $license_data->license ) ? $license_data->license : 'invalid'; + $attributes['free_version'] = PPOM_VERSION; + + if ( ! empty( $license_data->plan ) ) { + $attributes['plan'] = $this->plan_category( $license_data ); + } + + if ( defined( 'PPOM_PRO_VERSION' ) ) { + $attributes['pro_version'] = PPOM_PRO_VERSION; + } + + return array( + 'userId' => $user_id, + 'attributes' => $attributes, + ); + } + + /** + * Enqueue scripts. + */ + public function enqueue_scripts() { + + if ( defined( 'CYPRESS_TESTING' ) ) { + return; + } + + $survey_handler = apply_filters( 'themeisle_sdk_dependency_script_handler', 'survey' ); + if ( empty( $survey_handler ) ) { + return; + } + + do_action( 'themeisle_sdk_dependency_enqueue_script', 'survey' ); + wp_enqueue_script( 'ppom_survey', PPOM_URL . '/js/survey.js', array( $survey_handler ), PPOM_VERSION, true ); + wp_localize_script( 'ppom_survey', 'PPOMSurveyData', $this->get_survey_metadata() ); + } + + /** + * Get the plan category for the product plan ID. + * + * @param object $license_data The license data. + * @return int + */ + private static function plan_category( $license_data ) { + + if ( ! isset( $license_data->plan ) || ! is_numeric( $license_data->plan ) ) { + return 0; // Free. + } + + $plan = (int) $license_data->plan; + $current_category = -1; + + $categories = array( + '1' => array( 1, 4, 9 ), // Personal. + '2' => array( 2, 5, 8 ), // Business/Developer. + '3' => array( 3, 6, 7, 10 ), // Agency. + ); + + foreach ( $categories as $category => $plans ) { + if ( in_array( $plan, $plans, true ) ) { + $current_category = (int) $category; + break; + } + } + + return $current_category; + } + } +} diff --git a/composer.lock b/composer.lock index edf11715..3cc56b72 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "codeinwp/themeisle-sdk", - "version": "3.3.25", + "version": "3.3.28", "source": { "type": "git", "url": "https://github.com/Codeinwp/themeisle-sdk.git", - "reference": "29b7c81f8ccd039f49d62ef7427a4cc06369becc" + "reference": "cd35fd5356ba169b9a0419ba879764ffeb811b63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/29b7c81f8ccd039f49d62ef7427a4cc06369becc", - "reference": "29b7c81f8ccd039f49d62ef7427a4cc06369becc", + "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/cd35fd5356ba169b9a0419ba879764ffeb811b63", + "reference": "cd35fd5356ba169b9a0419ba879764ffeb811b63", "shasum": "" }, "require-dev": { @@ -42,36 +42,36 @@ ], "support": { "issues": "https://github.com/Codeinwp/themeisle-sdk/issues", - "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.25" + "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.28" }, - "time": "2024-07-08T13:49:14+00:00" + "time": "2024-08-09T08:54:15+00:00" } ], "packages-dev": [ { "name": "automattic/vipwpcs", - "version": "2.3.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b" + "reference": "b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", - "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6", + "reference": "b8610e3837f49c5f2fcc4b663b6c0a7c9b3509b6", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "sirbrillig/phpcs-variable-analysis": "^2.11.1", - "squizlabs/php_codesniffer": "^3.5.5", + "sirbrillig/phpcs-variable-analysis": "^2.11.17", + "squizlabs/php_codesniffer": "^3.7.1", "wp-coding-standards/wpcs": "^2.3" }, "require-dev": { - "php-parallel-lint/php-console-highlighter": "^0.5", - "php-parallel-lint/php-parallel-lint": "^1.0", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9", "phpcsstandards/phpcsdevtools": "^1.0", "phpunit/phpunit": "^4 || ^5 || ^6 || ^7" @@ -91,6 +91,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -98,7 +99,7 @@ "source": "https://github.com/Automattic/VIP-Coding-Standards", "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" }, - "time": "2021-09-29T16:20:23+00:00" + "time": "2023-08-24T15:11:13+00:00" }, { "name": "codeinwp/phpcs-ruleset", @@ -282,16 +283,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -299,11 +300,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -329,7 +331,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -337,7 +339,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "phar-io/manifest", @@ -521,28 +523,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", - "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "paragonie/random_compat": "dev-master", "paragonie/sodium_compat": "dev-master" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -572,22 +574,37 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2022-10-25T01:46:02+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.4", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", "shasum": "" }, "require": { @@ -595,10 +612,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -627,9 +644,24 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2022-10-24T09:00:36+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" }, { "name": "phpunit/php-code-coverage", @@ -930,42 +962,42 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.38", + "version": "8.5.39", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1ecad678646c817a29e55a32c930f3601c3f5a8c" + "reference": "172ba97bcf97ae6ef86ca256adf77aece8a143fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1ecad678646c817a29e55a32c930f3601c3f5a8c", - "reference": "1ecad678646c817a29e55a32c930f3601c3f5a8c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/172ba97bcf97ae6ef86ca256adf77aece8a143fe", + "reference": "172ba97bcf97ae6ef86ca256adf77aece8a143fe", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.5.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.0", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.2", - "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.4", + "phpunit/php-code-coverage": "^7.0.17", + "phpunit/php-file-iterator": "^2.0.6", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", + "phpunit/php-timer": "^2.1.4", "sebastian/comparator": "^3.0.5", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.3", - "sebastian/exporter": "^3.1.5", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", + "sebastian/diff": "^3.0.6", + "sebastian/environment": "^4.2.5", + "sebastian/exporter": "^3.1.6", + "sebastian/global-state": "^3.0.5", + "sebastian/object-enumerator": "^3.0.5", + "sebastian/resource-operations": "^2.0.3", + "sebastian/type": "^1.1.5", "sebastian/version": "^2.0.1" }, "suggest": { @@ -1008,7 +1040,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.38" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.39" }, "funding": [ { @@ -1024,7 +1056,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:31:23+00:00" + "time": "2024-07-10T11:43:00+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1756,16 +1788,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.10", + "version": "v2.11.19", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "0f25a3766f26df91d6bdda0c8931303fc85499d7" + "reference": "bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/0f25a3766f26df91d6bdda0c8931303fc85499d7", - "reference": "0f25a3766f26df91d6bdda0c8931303fc85499d7", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1", + "reference": "bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1", "shasum": "" }, "require": { @@ -1810,20 +1842,20 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2023-01-05T18:45:16+00:00" + "time": "2024-06-26T20:08:34+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.10.2", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -1833,11 +1865,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -1852,22 +1884,45 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-07-21T23:26:44+00:00" }, { "name": "theseer/tokenizer", diff --git a/inc/functions.php b/inc/functions.php index 2422040f..6751eab0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2313,6 +2313,13 @@ function ppom_get_conditional_data_attributes( $meta ) { $bound = isset( $conditions['bound'] ) ? ppom_wpml_translate( $conditions['bound'], 'PPOM' ) : ''; $visibility = isset( $conditions['visibility'] ) ? ppom_wpml_translate( $conditions['visibility'], 'PPOM' ) : ''; + $conditions['rules'] = array_filter( + $conditions['rules'], + function( $rule ) { + return ! empty( $rule['element_values'] ); + } + ); + $attr_html .= ' data-cond="1"'; $attr_html .= ' data-cond-total="' . esc_attr( count( $conditions['rules'] ) ) . '"'; $attr_html .= ' data-cond-bind="' . esc_attr( $bound ) . '"'; diff --git a/js/ppom-simple-popup.js b/js/ppom-simple-popup.js index eef463d3..27a7d2b1 100644 --- a/js/ppom-simple-popup.js +++ b/js/ppom-simple-popup.js @@ -56,7 +56,7 @@ }; } if ( $('[data-ppom-tooltip~=ppom_tooltip]').length > 0 ) { - $('[data-ppom-tooltip~=ppom_tooltip]').ppom_tooltipster(tooltip_options); + $('[data-ppom-tooltip~=ppom_tooltip]').ppom_tooltipster?.(tooltip_options); } // Plugin name and prefix @@ -64,7 +64,7 @@ var prefix = 'ppom-popup'; function pluploadRefresh() { - if( ! uploaderInstances ) { + if( typeof uploaderInstances !== 'object' ) { return; } const instances = Object.values(uploaderInstances); diff --git a/js/survey.js b/js/survey.js new file mode 100644 index 00000000..c059dc4c --- /dev/null +++ b/js/survey.js @@ -0,0 +1,12 @@ +/** + * Initialize the formbricks survey. + * + * @see https://github.com/formbricks/setup-examples/tree/main/html + */ +window.addEventListener('themeisle:survey:loaded', function () { + window?.tsdk_formbricks?.init?.({ + environmentId: "clza3s4zm000h10km1699nlli", + apiHost: "https://app.formbricks.com", + ...(window?.PPOMSurveyData ?? {}), + }); +}); \ No newline at end of file