Skip to content

Commit

Permalink
Merge pull request #192 from ConvertKit/release/1.7.3
Browse files Browse the repository at this point in the history
Release/1.7.3
  • Loading branch information
tnorthcutt authored Mar 26, 2019
2 parents 6e27824 + 8090bc7 commit 1176adf
Show file tree
Hide file tree
Showing 13 changed files with 366 additions and 722 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tests
.git
.travis.yml
circle.yml
codeception.dist.yml
composer.json
composer.lock
Gruntfile.js
Expand Down
87 changes: 59 additions & 28 deletions admin/class-convertkit-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,68 @@ public function display_settings_page() {
} else {
$active_section = $this->sections[0]->name;
}

?>
<div class="wrap convertkit-settings-wrap">
<?php
if ( count( $this->sections ) > 1 ) {
$this->display_section_nav( $active_section );
} else {
?>
<h2><?php esc_html_e( 'ConvertKit', 'convertkit' ); ?></h2>
<div class="wrap convertkit-settings-wrap">
<?php
}
?>

<form method="post" action="options.php">
<?php
foreach ( $this->sections as $section ) :
if ( $active_section === $section->name ) :
$section->render();
endif;
endforeach;
if ( count( $this->sections ) > 1 ) {
$this->display_section_nav( $active_section );
} else {
?>
<h2><?php esc_html_e( 'ConvertKit', 'convertkit' ); ?></h2>
<?php
}
?>

// Check for Multibyte string PHP extension.
if ( ! extension_loaded( 'mbstring' ) ) {
?><p><strong><?php
echo sprintf( __( 'Note: Your server does not support the %s functions - this is required for better character encoding. Please contact your webhost to have it installed.', 'woocommerce' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ) . '</mark>';
?></strong></p><?php
}
?><p class="description"><?php
printf( 'If you need help setting up the plugin please refer to the %s plugin documentation.</a>', '<a href="http://help.convertkit.com/article/99-the-convertkit-wordpress-plugin" target="_blank">' ); ?></p>
</form>
</div>
<form method="post" action="options.php">
<?php
foreach ( $this->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' ) {
?>
<div class="inline notice notice-warning">
<p>
<strong>
<?php
echo sprintf( __( 'Notice: Your database does not appear to support the %s. If you experience difficulties connecting to ConvertKit this may be why. Please contact your webhost to have your database upgraded.',
'convertkit' ),
'<a href="https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/">utf8mb4 character set</a>' );
?>
</strong>
</p>
</div>
<?php
}

// Check for Multibyte string PHP extension.
if ( ! extension_loaded( 'mbstring' ) ) {
?>
<div class="inline notice notice-warning">
<p>
<strong>
<?php
echo sprintf( __( 'Notice: Your server does not support the %s function - this is required for better character encoding. Please contact your webhost to have it installed.',
'convertkit' ),
'<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' );
?>
</strong>
</p>
</div>
<?php
}
?><p class="description"><?php
printf( 'If you need help setting up the plugin please refer to the %s plugin documentation.</a>',
'<a href="http://help.convertkit.com/article/99-the-convertkit-wordpress-plugin" target="_blank">' ); ?></p>
</form>
</div>
<?php
}

Expand Down
21 changes: 16 additions & 5 deletions admin/section/class-convertkit-settings-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,27 @@ public function refresh_resources() {
wp_die();
}

$this->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 <code>https://api.convertkit.com</code>','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();
Expand Down
2 changes: 1 addition & 1 deletion admin/section/class-convertkit-settings-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 11 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading

0 comments on commit 1176adf

Please sign in to comment.