diff --git a/.distignore b/.distignore index 496f0083d..495335e43 100644 --- a/.distignore +++ b/.distignore @@ -7,6 +7,7 @@ tests .git .travis.yml circle.yml +codeception.dist.yml composer.json composer.lock Gruntfile.js diff --git a/admin/class-convertkit-settings.php b/admin/class-convertkit-settings.php index c6a431097..953294756 100644 --- a/admin/class-convertkit-settings.php +++ b/admin/class-convertkit-settings.php @@ -99,37 +99,68 @@ public function display_settings_page() { } else { $active_section = $this->sections[0]->name; } - ?> -
- sections ) > 1 ) { - $this->display_section_nav( $active_section ); - } else { - ?> -

+
- -
- sections as $section ) : - if ( $active_section === $section->name ) : - $section->render(); - endif; - endforeach; + if ( count( $this->sections ) > 1 ) { + $this->display_section_nav( $active_section ); + } else { + ?> +

+ - // Check for Multibyte string PHP extension. - if ( ! extension_loaded( 'mbstring' ) ) { - ?>

mbstring' ) . ''; - ?>

', '' ); ?>

- -
+
+ sections as $section ) : + if ( $active_section === $section->name ) : + $section->render(); + endif; + endforeach; + + /** + * Check for utf8mb4 support. + * Lack of support will cause problems if any content pulled in from ConvertKit contains emoji characters + */ + global $wpdb; + if ( $wpdb->get_col_charset( 'wp_options', 'option_value' ) !== 'utf8mb4' ) { + ?> + + +
+

+ + mbstring' ); + ?> + +

+
+

', + '' ); ?>

+ +
api->update_resources( $api_key ); + $update_resources = $this->api->update_resources( $api_key ); $forms = get_option( 'convertkit_forms', array() ); - if ( isset( $forms[0] ) && isset( $forms[0]['id'] ) && '-2' === $forms[0]['id'] ) { - wp_send_json_error( __( 'Error connecting to API. Please verify your site can connect to https://api.convertkit.com','convertkit' ) ); + if ( $update_resources && isset( $forms[0] ) && isset( $forms[0]['id'] ) && '-2' === $forms[0]['id'] ) { + wp_send_json_error( __( 'Error connecting to API. Please verify your site can connect to https://api.convertkit.com','convertkit' ) ); wp_die(); + } else if ( ! $update_resources ) { + /** + * There are two reasons $update_resources could be false: + * 1) Saving failed because the wp_options table does not use the utf8mb4 character set + * 2) No updates were needed (values passed to update_option() were the same as current values) for one of forms, landing pages, or tags + * + * So, if $update_resources is false, we check the character set, and if it's not utf8mb4 then we show a warning + */ + global $wpdb; + if ( $wpdb->get_col_charset( 'wp_options', 'option_value' ) !== 'utf8mb4' ) { + wp_send_json_error( __( 'Updating forms from ConvertKit may have failed. If so, this may be because your database uses the out of date utf8 character set, instead of the newer utf8mb4 character set. Please contact your host to upgrade your database.','convertkit' ) ); + wp_die(); + } } - $html = ''; - ob_start(); $this->default_form_callback( $forms ); $html = ob_get_clean(); diff --git a/admin/section/class-convertkit-settings-tools.php b/admin/section/class-convertkit-settings-tools.php index 155c97a0c..9038d5d81 100644 --- a/admin/section/class-convertkit-settings-tools.php +++ b/admin/section/class-convertkit-settings-tools.php @@ -170,7 +170,7 @@ function get_system_info() { global $wpdb; if ( ! class_exists( 'Browser' ) ) { - require_once CONVERTKIT_PLUGIN_PATH . 'lib/browser.php'; + require_once CONVERTKIT_PLUGIN_PATH . '/lib/browser.php'; } $browser = new Browser(); diff --git a/composer.json b/composer.json index 712b61370..06f6b37d0 100644 --- a/composer.json +++ b/composer.json @@ -3,12 +3,21 @@ "description": "ConvertKit WordPress plugin", "type": "project", "license": "GPLv3", + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/ConvertKit/relative-to-absolute-url" + } + ], "require": { - "kub-at/php-simple-html-dom-parser": "^1.7" + "kub-at/php-simple-html-dom-parser": "~1.7.1", + "oldmine/relative-to-absolute-url": "dev-master" }, "require-dev": { "phpunit/phpunit": "^6.5", "vlucas/phpdotenv": "^2.4", "lucatume/wp-browser": "^2.2" - } + }, + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/composer.lock b/composer.lock index 5db2f76f9..231b0f81d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "08931ae4249791a349248f888e4bf028", + "content-hash": "f38a489983ceebfdce4bbf86999b2e0c", "packages": [ { "name": "kub-at/php-simple-html-dom-parser", @@ -51,6 +51,36 @@ "html" ], "time": "2019-01-02T14:33:28+00:00" + }, + { + "name": "oldmine/relative-to-absolute-url", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/ConvertKit/relative-to-absolute-url.git", + "reference": "66426fa7afee86f1e6ff4f103e461aa6ec952c9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ConvertKit/relative-to-absolute-url/zipball/66426fa7afee86f1e6ff4f103e461aa6ec952c9b", + "reference": "66426fa7afee86f1e6ff4f103e461aa6ec952c9b", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^7" + }, + "type": "library", + "autoload": { + "psr-4": { + "oldmine\\RelativeToAbsoluteUrl\\": "src", + "oldmine\\RelativeToAbsoluteUrl\\Tests\\": "tests" + } + }, + "description": "Library adaptation to translate relative url to absolute. Original library: https://sourceforge.net/projects/absoluteurl/", + "support": { + "source": "https://github.com/tnorthcutt/relative-to-absolute-url/tree/master" + }, + "time": "2019-03-13T17:21:57+00:00" } ], "packages-dev": [ @@ -209,16 +239,16 @@ }, { "name": "codeception/codeception", - "version": "2.5.2", + "version": "2.5.4", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "4f89de32929fef53ca6d83b159fe329b6d484c1c" + "reference": "a2ecfe2f3ad36cc29904d2d566b0d7280854e6c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/4f89de32929fef53ca6d83b159fe329b6d484c1c", - "reference": "4f89de32929fef53ca6d83b159fe329b6d484c1c", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/a2ecfe2f3ad36cc29904d2d566b0d7280854e6c9", + "reference": "a2ecfe2f3ad36cc29904d2d566b0d7280854e6c9", "shasum": "" }, "require": { @@ -250,7 +280,7 @@ "predis/predis": "^1.0", "squizlabs/php_codesniffer": "~2.0", "symfony/process": ">=2.7 <5.0", - "vlucas/phpdotenv": "^2.4.0" + "vlucas/phpdotenv": "^3.0" }, "suggest": { "aws/aws-sdk-php": "For using AWS Auth in REST module and Queue module", @@ -297,20 +327,20 @@ "functional testing", "unit testing" ], - "time": "2019-01-02T10:28:51+00:00" + "time": "2019-02-20T20:45:25+00:00" }, { "name": "codeception/phpunit-wrapper", - "version": "6.5.1", + "version": "6.6.1", "source": { "type": "git", "url": "https://github.com/Codeception/phpunit-wrapper.git", - "reference": "d78f9eb9c4300a5924cc27dee03e8c1a96fcf5f3" + "reference": "d0da25a98bcebeb15d97c2ad3b2de6166b6e7a0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/d78f9eb9c4300a5924cc27dee03e8c1a96fcf5f3", - "reference": "d78f9eb9c4300a5924cc27dee03e8c1a96fcf5f3", + "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/d0da25a98bcebeb15d97c2ad3b2de6166b6e7a0c", + "reference": "d0da25a98bcebeb15d97c2ad3b2de6166b6e7a0c", "shasum": "" }, "require": { @@ -324,7 +354,7 @@ }, "require-dev": { "codeception/specify": "*", - "vlucas/phpdotenv": "^2.4" + "vlucas/phpdotenv": "^3.0" }, "type": "library", "autoload": { @@ -343,24 +373,24 @@ } ], "description": "PHPUnit classes used by Codeception", - "time": "2019-01-13T10:34:55+00:00" + "time": "2019-02-26T20:47:39+00:00" }, { "name": "codeception/stub", - "version": "2.0.4", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Codeception/Stub.git", - "reference": "f50bc271f392a2836ff80690ce0c058efe1ae03e" + "reference": "853657f988942f7afb69becf3fd0059f192c705a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Stub/zipball/f50bc271f392a2836ff80690ce0c058efe1ae03e", - "reference": "f50bc271f392a2836ff80690ce0c058efe1ae03e", + "url": "https://api.github.com/repos/Codeception/Stub/zipball/853657f988942f7afb69becf3fd0059f192c705a", + "reference": "853657f988942f7afb69becf3fd0059f192c705a", "shasum": "" }, "require": { - "phpunit/phpunit": ">=4.8 <8.0" + "codeception/phpunit-wrapper": ">6.0.15 <6.1.0 | ^6.6.1 | ^7.7.1 | ^8.0.3" }, "type": "library", "autoload": { @@ -373,20 +403,20 @@ "MIT" ], "description": "Flexible Stub wrapper for PHPUnit's Mock Builder", - "time": "2018-07-26T11:55:37+00:00" + "time": "2019-03-02T15:35:10+00:00" }, { "name": "composer/ca-bundle", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660" + "reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660", - "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/558f321c52faeb4828c03e7dc0cfe39a09e09a2d", + "reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d", "shasum": "" }, "require": { @@ -429,20 +459,20 @@ "ssl", "tls" ], - "time": "2018-10-18T06:09:13+00:00" + "time": "2019-01-28T09:30:10+00:00" }, { "name": "composer/composer", - "version": "1.8.0", + "version": "1.8.4", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "d8aef3af866b28786ce9b8647e52c42496436669" + "reference": "bc364c2480c17941e2135cfc568fa41794392534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/d8aef3af866b28786ce9b8647e52c42496436669", - "reference": "d8aef3af866b28786ce9b8647e52c42496436669", + "url": "https://api.github.com/repos/composer/composer/zipball/bc364c2480c17941e2135cfc568fa41794392534", + "reference": "bc364c2480c17941e2135cfc568fa41794392534", "shasum": "" }, "require": { @@ -509,20 +539,20 @@ "dependency", "package" ], - "time": "2018-12-03T09:31:16+00:00" + "time": "2019-02-11T09:52:10+00:00" }, { "name": "composer/semver", - "version": "1.4.2", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", "shasum": "" }, "require": { @@ -571,7 +601,7 @@ "validation", "versioning" ], - "time": "2016-08-30T16:08:34+00:00" + "time": "2019-03-19T17:25:45+00:00" }, { "name": "composer/spdx-licenses", @@ -636,16 +666,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "dc523135366eb68f22268d069ea7749486458562" + "reference": "d17708133b6c276d6e42ef887a877866b909d892" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/dc523135366eb68f22268d069ea7749486458562", - "reference": "dc523135366eb68f22268d069ea7749486458562", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/d17708133b6c276d6e42ef887a877866b909d892", + "reference": "d17708133b6c276d6e42ef887a877866b909d892", "shasum": "" }, "require": { @@ -676,7 +706,7 @@ "Xdebug", "performance" ], - "time": "2018-11-29T10:59:02+00:00" + "time": "2019-01-28T20:25:53+00:00" }, { "name": "dg/mysql-dump", @@ -1183,16 +1213,16 @@ }, { "name": "illuminate/contracts", - "version": "v5.7.21", + "version": "v5.8.4", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "3d67e2d7c9087ae3a2a53d9b102697e5f482d6d0" + "reference": "3e3a9a654adbf798e05491a5dbf90112df1effde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/3d67e2d7c9087ae3a2a53d9b102697e5f482d6d0", - "reference": "3d67e2d7c9087ae3a2a53d9b102697e5f482d6d0", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/3e3a9a654adbf798e05491a5dbf90112df1effde", + "reference": "3e3a9a654adbf798e05491a5dbf90112df1effde", "shasum": "" }, "require": { @@ -1203,7 +1233,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7-dev" + "dev-master": "5.8-dev" } }, "autoload": { @@ -1223,43 +1253,45 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2019-01-09T10:34:49+00:00" + "time": "2019-02-18T18:37:54+00:00" }, { "name": "illuminate/support", - "version": "v5.7.20", + "version": "v5.8.4", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1" + "reference": "07062f5750872a31e086ff37a7c50ac18b8c417c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/ea3f30dd824bba52bcff4290dc7431b0ffb478e1", - "reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1", + "url": "https://api.github.com/repos/illuminate/support/zipball/07062f5750872a31e086ff37a7c50ac18b8c417c", + "reference": "07062f5750872a31e086ff37a7c50ac18b8c417c", "shasum": "" }, "require": { "doctrine/inflector": "^1.1", + "ext-json": "*", "ext-mbstring": "*", - "illuminate/contracts": "5.7.*", - "nesbot/carbon": "^1.26.3", + "illuminate/contracts": "5.8.*", + "nesbot/carbon": "^1.26.3 || ^2.0", "php": "^7.1.3" }, "conflict": { "tightenco/collect": "<5.5.33" }, "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.7.*).", + "illuminate/filesystem": "Required to use the composer class (5.8.*).", "moontoast/math": "Required to use ordered UUIDs (^1.1).", "ramsey/uuid": "Required to use Str::uuid() (^3.7).", - "symfony/process": "Required to use the composer class (^4.1).", - "symfony/var-dumper": "Required to use the dd function (^4.1)." + "symfony/process": "Required to use the composer class (^4.2).", + "symfony/var-dumper": "Required to use the dd function (^4.2).", + "vlucas/phpdotenv": "Required to use the env helper (^3.3)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7-dev" + "dev-master": "5.8-dev" } }, "autoload": { @@ -1282,7 +1314,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2019-01-07T13:39:07+00:00" + "time": "2019-03-12T13:17:00+00:00" }, { "name": "justinrainbow/json-schema", @@ -1655,28 +1687,30 @@ }, { "name": "nesbot/carbon", - "version": "1.36.2", + "version": "2.16.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9" + "reference": "dd16fedc022180ea4292a03aabe95e9895677911" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9", - "reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/dd16fedc022180ea4292a03aabe95e9895677911", + "reference": "dd16fedc022180ea4292a03aabe95e9895677911", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/translation": "^3.4 || ^4.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "suggest": { - "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", - "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "kylekatarnls/multi-tester": "^0.1", + "phpmd/phpmd": "^2.6", + "phpstan/phpstan": "^0.10.8", + "phpunit/phpunit": "^7.5 || ^8.0", + "squizlabs/php_codesniffer": "^3.4" }, "type": "library", "extra": { @@ -1688,7 +1722,7 @@ }, "autoload": { "psr-4": { - "": "src/" + "Carbon\\": "src/Carbon/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1709,7 +1743,7 @@ "datetime", "time" ], - "time": "2018-12-28T10:07:33+00:00" + "time": "2019-03-12T09:31:40+00:00" }, { "name": "phar-io/manifest", @@ -2279,16 +2313,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.5.13", + "version": "6.5.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0973426fb012359b2f18d3bd1e90ef1172839693" + "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693", - "reference": "0973426fb012359b2f18d3bd1e90ef1172839693", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", "shasum": "" }, "require": { @@ -2359,7 +2393,7 @@ "testing", "xunit" ], - "time": "2018-09-08T15:10:43+00:00" + "time": "2019-02-01T05:22:47+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -2418,6 +2452,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2018-08-09T05:50:03+00:00" }, { @@ -3403,16 +3438,16 @@ }, { "name": "symfony/browser-kit", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "313512c878805971aebddb5d1707bcf3f4e25df7" + "reference": "61d85c5af2fc058014c7c89504c3944e73a086f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/313512c878805971aebddb5d1707bcf3f4e25df7", - "reference": "313512c878805971aebddb5d1707bcf3f4e25df7", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/61d85c5af2fc058014c7c89504c3944e73a086f0", + "reference": "61d85c5af2fc058014c7c89504c3944e73a086f0", "shasum": "" }, "require": { @@ -3456,20 +3491,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-02-23T15:17:42+00:00" }, { "name": "symfony/config", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "17c5d8941eb75a03d19bc76a43757738632d87b3" + "reference": "177a276c01575253c95cefe0866e3d1b57637fe0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/17c5d8941eb75a03d19bc76a43757738632d87b3", - "reference": "17c5d8941eb75a03d19bc76a43757738632d87b3", + "url": "https://api.github.com/repos/symfony/config/zipball/177a276c01575253c95cefe0866e3d1b57637fe0", + "reference": "177a276c01575253c95cefe0866e3d1b57637fe0", "shasum": "" }, "require": { @@ -3520,20 +3555,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/console", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a700b874d3692bc8342199adfb6d3b99f62cc61a" + "reference": "71ce77f37af0c5ffb9590e43cc4f70e426945c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a700b874d3692bc8342199adfb6d3b99f62cc61a", - "reference": "a700b874d3692bc8342199adfb6d3b99f62cc61a", + "url": "https://api.github.com/repos/symfony/console/zipball/71ce77f37af0c5ffb9590e43cc4f70e426945c5e", + "reference": "71ce77f37af0c5ffb9590e43cc4f70e426945c5e", "shasum": "" }, "require": { @@ -3545,6 +3580,9 @@ "symfony/dependency-injection": "<3.4", "symfony/process": "<3.3" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.3|~4.0", @@ -3554,7 +3592,7 @@ "symfony/process": "~3.3|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -3589,20 +3627,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-01-04T04:42:43+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/css-selector", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "76dac1dbe2830213e95892c7c2ec1edd74113ea4" + "reference": "48eddf66950fa57996e1be4a55916d65c10c604a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/76dac1dbe2830213e95892c7c2ec1edd74113ea4", - "reference": "76dac1dbe2830213e95892c7c2ec1edd74113ea4", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/48eddf66950fa57996e1be4a55916d65c10c604a", + "reference": "48eddf66950fa57996e1be4a55916d65c10c604a", "shasum": "" }, "require": { @@ -3642,20 +3680,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-16T20:31:39+00:00" }, { "name": "symfony/debug", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "26d7f23b9bd0b93bee5583e4d6ca5cb1ab31b186" + "reference": "8d8a9e877b3fcdc50ddecf8dcea146059753f782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/26d7f23b9bd0b93bee5583e4d6ca5cb1ab31b186", - "reference": "26d7f23b9bd0b93bee5583e4d6ca5cb1ab31b186", + "url": "https://api.github.com/repos/symfony/debug/zipball/8d8a9e877b3fcdc50ddecf8dcea146059753f782", + "reference": "8d8a9e877b3fcdc50ddecf8dcea146059753f782", "shasum": "" }, "require": { @@ -3698,20 +3736,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2019-02-24T15:45:11+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "928a38b18bd632d67acbca74d0b2eed09915e83e" + "reference": "c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/928a38b18bd632d67acbca74d0b2eed09915e83e", - "reference": "928a38b18bd632d67acbca74d0b2eed09915e83e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11", + "reference": "c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11", "shasum": "" }, "require": { @@ -3769,20 +3807,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-01-05T12:26:58+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "8dc06251d5ad98d8494e1f742bec9cfdb9e42044" + "reference": "53c97769814c80a84a8403efcf3ae7ae966d53bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/8dc06251d5ad98d8494e1f742bec9cfdb9e42044", - "reference": "8dc06251d5ad98d8494e1f742bec9cfdb9e42044", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/53c97769814c80a84a8403efcf3ae7ae966d53bb", + "reference": "53c97769814c80a84a8403efcf3ae7ae966d53bb", "shasum": "" }, "require": { @@ -3826,20 +3864,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-02-23T15:17:42+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d1cdd46c53c264a2bd42505bd0e8ce21423bd0e2" + "reference": "ec625e2fff7f584eeb91754821807317b2e79236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d1cdd46c53c264a2bd42505bd0e8ce21423bd0e2", - "reference": "d1cdd46c53c264a2bd42505bd0e8ce21423bd0e2", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ec625e2fff7f584eeb91754821807317b2e79236", + "reference": "ec625e2fff7f584eeb91754821807317b2e79236", "shasum": "" }, "require": { @@ -3889,20 +3927,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-01-01T18:08:36+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c24ce3d18ccc9bb9d7e1d6ce9330fcc6061cafde" + "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c24ce3d18ccc9bb9d7e1d6ce9330fcc6061cafde", - "reference": "c24ce3d18ccc9bb9d7e1d6ce9330fcc6061cafde", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/acf99758b1df8e9295e6b85aa69f294565c9fedb", + "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb", "shasum": "" }, "require": { @@ -3939,20 +3977,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2019-02-04T21:34:32+00:00" }, { "name": "symfony/finder", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e" + "reference": "fcdde4aa38f48190ce70d782c166f23930084f9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e", - "reference": "3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e", + "url": "https://api.github.com/repos/symfony/finder/zipball/fcdde4aa38f48190ce70d782c166f23930084f9b", + "reference": "fcdde4aa38f48190ce70d782c166f23930084f9b", "shasum": "" }, "require": { @@ -3988,7 +4026,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2019-02-22T14:44:53+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4109,16 +4147,16 @@ }, { "name": "symfony/process", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0d41dd7d95ed179aed6a13393b0f4f97bfa2d25c" + "reference": "009f8dda80930e89e8344a4e310b08f9ff07dd2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0d41dd7d95ed179aed6a13393b0f4f97bfa2d25c", - "reference": "0d41dd7d95ed179aed6a13393b0f4f97bfa2d25c", + "url": "https://api.github.com/repos/symfony/process/zipball/009f8dda80930e89e8344a4e310b08f9ff07dd2e", + "reference": "009f8dda80930e89e8344a4e310b08f9ff07dd2e", "shasum": "" }, "require": { @@ -4154,20 +4192,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-01-02T21:24:08+00:00" + "time": "2019-01-16T13:27:11+00:00" }, { "name": "symfony/translation", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "5f357063f4907cef47e5cf82fa3187fbfb700456" + "reference": "3e2966209567ffed8825905b53fc8548446130aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/5f357063f4907cef47e5cf82fa3187fbfb700456", - "reference": "5f357063f4907cef47e5cf82fa3187fbfb700456", + "url": "https://api.github.com/repos/symfony/translation/zipball/3e2966209567ffed8825905b53fc8548446130aa", + "reference": "3e2966209567ffed8825905b53fc8548446130aa", "shasum": "" }, "require": { @@ -4222,20 +4260,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.21", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "554a59a1ccbaac238a89b19c8e551a556fd0e2ea" + "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/554a59a1ccbaac238a89b19c8e551a556fd0e2ea", - "reference": "554a59a1ccbaac238a89b19c8e551a556fd0e2ea", + "url": "https://api.github.com/repos/symfony/yaml/zipball/57f1ce82c997f5a8701b89ef970e36bb657fd09c", + "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c", "shasum": "" }, "require": { @@ -4281,7 +4319,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "theseer/tokenizer", @@ -4325,20 +4363,21 @@ }, { "name": "vlucas/phpdotenv", - "version": "v2.5.2", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "cfd5dc225767ca154853752abc93aeec040fcf36" + "reference": "2a7dcf7e3e02dc5e701004e51a6f304b713107d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/cfd5dc225767ca154853752abc93aeec040fcf36", - "reference": "cfd5dc225767ca154853752abc93aeec040fcf36", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2a7dcf7e3e02dc5e701004e51a6f304b713107d5", + "reference": "2a7dcf7e3e02dc5e701004e51a6f304b713107d5", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.3.9", + "symfony/polyfill-ctype": "^1.9" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.0" @@ -4346,7 +4385,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -4371,7 +4410,7 @@ "env", "environment" ], - "time": "2018-10-30T17:29:25+00:00" + "time": "2019-01-29T11:11:52+00:00" }, { "name": "webmozart/assert", @@ -6238,9 +6277,11 @@ } ], "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, + "minimum-stability": "dev", + "stability-flags": { + "oldmine/relative-to-absolute-url": 20 + }, + "prefer-stable": true, "prefer-lowest": false, "platform": [], "platform-dev": [] diff --git a/includes/class-convertkit-api.php b/includes/class-convertkit-api.php index f7dc95337..dcd1a4b32 100644 --- a/includes/class-convertkit-api.php +++ b/includes/class-convertkit-api.php @@ -6,6 +6,9 @@ * @author ConvertKit */ +use oldmine\RelativeToAbsoluteUrl\RelativeToAbsoluteUrl; +use KubAT\PhpSimple\HtmlDomParser; + /** * ConvertKit_API Class * Establishes API connection to ConvertKit App @@ -122,9 +125,10 @@ public function update_resources( $api_key ) { 'id' => '-2', 'name' => 'Error contacting API', ); - update_option( 'convertkit_forms', $forms ); - update_option( 'convertkit_landing_pages', $landing_pages ); - update_option( 'convertkit_tags', $tags ); + + $update_forms = update_option( 'convertkit_forms', $forms ); + $update_landing_pages = update_option( 'convertkit_landing_pages', $landing_pages ); + $update_tags = update_option( 'convertkit_tags', $tags ); } else { @@ -140,8 +144,8 @@ public function update_resources( $api_key ) { $forms[ $form['id'] ] = $form; } } - update_option( 'convertkit_forms', $forms ); - update_option( 'convertkit_landing_pages', $landing_pages ); + $update_forms = update_option( 'convertkit_forms', $forms ); + $update_landing_pages = update_option( 'convertkit_landing_pages', $landing_pages ); // Tags $api_response = $this->_get_api_response( 'tags' ); @@ -149,8 +153,10 @@ public function update_resources( $api_key ) { foreach ( $response as $tag ) { $tags[] = $tag; } - update_option( 'convertkit_tags', $tags ); + $update_tags = update_option( 'convertkit_tags', $tags ); } + + return $update_forms && $update_landing_pages && $update_tags; } /** @@ -396,10 +402,6 @@ public function get_resource( $url ) { if ( ! is_wp_error( $response ) ) { - if ( ! function_exists( 'url_to_absolute' ) ) { - require_once( CONVERTKIT_PLUGIN_PATH . '/lib/url-to-absolute/url-to-absolute.php' ); - } - // Maybe inflate response body. // @see https://wordpress.stackexchange.com/questions/10088/how-do-i-troubleshoot-responses-with-wp-http-api $inflate = @gzinflate( $response['body'] ); @@ -410,22 +412,22 @@ public function get_resource( $url ) { $body = wp_remote_retrieve_body( $response ); /** @var \simple_html_dom\simple_html_dom $html */ - $html = \KubAT\PhpSimple\HtmlDomParser::str_get_html( $body ); + $html = HtmlDomParser::str_get_html( $body ); foreach ( $html->find( 'a, link' ) as $element ) { if ( isset( $element->href ) ) { - $element->href = url_to_absolute( $url, $element->href ); + $element->href = RelativeToAbsoluteUrl::urlToAbsolute( $url, $element->href ); } } foreach ( $html->find( 'img, script' ) as $element ) { if ( isset( $element->src ) ) { - $element->src = url_to_absolute( $url, $element->src ); + $element->src = RelativeToAbsoluteUrl::urlToAbsolute( $url, $element->src ); } } foreach ( $html->find( 'form' ) as $element ) { if ( isset( $element->action ) ) { - $element->action = url_to_absolute( $url, $element->action ); + $element->action = RelativeToAbsoluteUrl::urlToAbsolute( $url, $element->action ); } else { $element->action = $url; } diff --git a/includes/class-convertkit.php b/includes/class-convertkit.php index 5b49f58c9..7e085e297 100644 --- a/includes/class-convertkit.php +++ b/includes/class-convertkit.php @@ -201,7 +201,7 @@ public static function append_form( $content ) { // Get category form $form_id = self::get_category_form( get_the_ID() ); - if ( 0 === $form_id ) { + if ( 0 === $form_id || 'default' === $form_id ) { // Get global default form if ( '-1' === $attributes['form'] ) { $form_id = self::_get_settings( 'default_form' ); diff --git a/lib/url-to-absolute/url-to-absolute.php b/lib/url-to-absolute/url-to-absolute.php deleted file mode 100644 index f3705c6d4..000000000 --- a/lib/url-to-absolute/url-to-absolute.php +++ /dev/null @@ -1,485 +0,0 @@ - '!%3A!ui', - "/" => '!%2F!ui', - "?" => '!%3F!ui', - "#" => '!%23!ui', - "[" => '!%5B!ui', - "]" => '!%5D!ui', - "@" => '!%40!ui', - "!" => '!%21!ui', - "$" => '!%24!ui', - "&" => '!%26!ui', - "'" => '!%27!ui', - "(" => '!%28!ui', - ")" => '!%29!ui', - "*" => '!%2A!ui', - "+" => '!%2B!ui', - "," => '!%2C!ui', - ";" => '!%3B!ui', - "=" => '!%3D!ui', - "%" => '!%25!ui', - ); - - $url = rawurlencode($url); - $url = preg_replace(array_values($reserved), array_keys($reserved), $url); - return $url; -} - -?> diff --git a/package.json b/package.json index 6af928cb4..017bb062f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "ConvertKit", "author": "ConvertKit", "license": "GPL-2.0", - "version": "1.7.2", + "version": "1.7.3", "description": "", "homepage": "https://github.com/convertkit/ConvertKit-WordPress", "main": "Gruntfile.js", diff --git a/readme.txt b/readme.txt index f3a292bcf..9a32d2d93 100755 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: nathanbarry, growdev, travisnorthcutt Donate link: https://convertkit.com Tags: email, marketing, embed form, convertkit, capture Requires at least: 3.6 -Tested up to: 5.0.3 -Stable tag: 1.7.2 +Tested up to: 5.1.1 +Stable tag: 1.7.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -46,6 +46,13 @@ Yes, for it to work you must first have an account on ConvertKit.com == Changelog == +### 1.7.3 2019-03-26 +* Adds checks and notices for outdated character set (utf8 vs. utf8mb4) use +* Add notice to metabox on blog archive page that our plugin does not do anything on this page +* Update library to make plugin work with PHP 7.3 (previously, landing pages did not work) +* Fix issue where global default form would never show for some categories +* Fix include path for system status box on tools tab + ### 1.7.2 2019-02-18 * Fix bug that caused fatal error on upgrade diff --git a/views/backend/meta-boxes/meta-box.php b/views/backend/meta-boxes/meta-box.php index 00dad88df..cddc3fdd2 100644 --- a/views/backend/meta-boxes/meta-box.php +++ b/views/backend/meta-boxes/meta-box.php @@ -8,68 +8,95 @@ ?> + ID == get_option( 'page_for_posts' ) ) : ?> - + + + + + post_type ) { ?> - - - - + + + + + $meta_tag = isset( $meta['tag'] ) ? $meta['tag'] : ''; + ?> +
+

+ +

+
+

Default to use the form specified on the settings page,', 'convertkit' ), esc_attr( esc_url( $settings_link ) ) ); // WPCS: XSS ok. - echo __( 'None to not display a form, or any other option to specify a particular form for this piece of content.', 'convertkit' ); // WPCS: XSS ok. + printf( __( 'Choose Default to use the form specified on the settings page,', + 'convertkit' ), esc_attr( esc_url( $settings_link ) ) ); // WPCS: XSS ok. + echo __( 'None to not display a form, or any other option to specify a particular form for this piece of content.', + 'convertkit' ); // WPCS: XSS ok. ?>

- +

- -

-
+ +

+
-

+

diff --git a/wp-convertkit.php b/wp-convertkit.php index 1a32cc8d2..08c298c1a 100644 --- a/wp-convertkit.php +++ b/wp-convertkit.php @@ -3,7 +3,7 @@ * Plugin Name: ConvertKit * Plugin URI: https://convertkit.com/ * Description: Quickly and easily integrate ConvertKit forms into your site. - * Version: 1.7.2 + * Version: 1.7.3 * Author: ConvertKit * Author URI: https://convertkit.com/ * Text Domain: convertkit @@ -16,7 +16,7 @@ define( 'CONVERTKIT_PLUGIN_FILE', plugin_basename( __FILE__ ) ); define( 'CONVERTKIT_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'CONVERTKIT_PLUGIN_PATH', __DIR__ ); -define( 'CONVERTKIT_PLUGIN_VERSION', '1.7.2' ); +define( 'CONVERTKIT_PLUGIN_VERSION', '1.7.3' ); require_once CONVERTKIT_PLUGIN_PATH . '/vendor/autoload.php';