Skip to content

Commit

Permalink
release: version 2.2.1
Browse files Browse the repository at this point in the history
- Form Block Redesign & Enhancements
- Introduce Pro Patterns
- Improve how content blocks behave with darker backgrounds
- Fix Popup behaviour with Sticky elements
- Fix Sticky feature not working properly with Tabs Block
- Fix some minor issues with various themes
- Fix PHP 8.2 issues
  • Loading branch information
HardeepAsrani authored Jan 30, 2023
2 parents 2cf1d9e + 5788e42 commit a00f34f
Show file tree
Hide file tree
Showing 142 changed files with 6,256 additions and 4,745 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ phpcs.xml
.releaserc.yml
.browserslistrc
.editorconfig
.wp-env.override.json
blocks.json
docker-compose.yml
webpack.config.js
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: "! contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [14.x]
node-version: [16.x]
steps:
- uses: actions/checkout@master
with:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/e2e-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,24 @@ jobs:
run: |
npm run build-dev
- name: setup wp env
- name: Create License File
run: |
printf "{\"key\":\"${{ secrets.OTTER_PRO_LICENSE }}\"}" > license.json
- name: Setup WP Env
run: |
npm run wp-env start
# run the node.js puppeteer script (which takes the screenshots and controls chrome)
- run: npm run test:e2e

- name: Upload video files
if: always()
uses: actions/upload-artifact@v2
with:
name: artifacts
path: ./artifacts/tests/
retention-days: 1

- name: Print the results
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
node-version: [16.x]
name: JS Test
steps:
- uses: actions/checkout@master
Expand Down
6 changes: 6 additions & 0 deletions .wp-env.override.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"core": null,
"plugins": [
"."
],
"config": {
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": true,
"FS_METHOD": "direct"
},
"env": {
"development": {
"themes": [
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions development.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,34 @@ function ( $message ) {
add_filter( 'otter_pro_hide_license_field', '__return_true' );

\ThemeIsle\OtterPro\Main::instance();

if ( class_exists( '\ThemeIsle\OtterPro\Plugins\License' ) && ! ThemeIsle\OtterPro\Plugins\License::has_active_license() ) {
add_action( 'init', function() {
$license_file = dirname( __FILE__ ) . '/license.json';

global $wp_filesystem;

if ( ! is_file( $license_file ) ) {
return false;
}

require_once ABSPATH . '/wp-admin/includes/file.php';

\WP_Filesystem();

$content = json_decode( $wp_filesystem->get_contents( $license_file ) );

if ( ! is_object( $content ) ) {
return false;
}

if ( ! isset( $content->key ) ) {
return false;
}

$license_key = $content->key;

apply_filters( 'themeisle_sdk_license_process_otter', $license_key, 'activate' );
} );
}
}
12 changes: 1 addition & 11 deletions inc/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ class Main {
*/
protected static $instance = null;

/**
* GutenbergBlocks constructor.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
$this->name = __( 'Otter', 'otter-blocks' );
$this->description = __( 'Blocks for Gutenberg', 'otter-blocks' );
}

/**
* Method to define hooks needed.
*
Expand Down Expand Up @@ -427,6 +416,7 @@ public function after_update_migration() {

if ( version_compare( $db_version, OTTER_BLOCKS_VERSION, '<' ) ) {
Dashboard_Server::regenerate_styles();
do_action( 'otter_blocks_plugin_update' );
}

return update_option( 'themeisle_blocks_db_version', OTTER_BLOCKS_VERSION );
Expand Down
16 changes: 4 additions & 12 deletions inc/class-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ public function init() {
*
* @access public
*/
public static function register_patterns() {
public function register_patterns() {
$block_pattern_categories = array(
'otter-blocks' => array( 'label' => __( 'Otter Blocks', 'otter-blocks' ) ),
'cta' => array( 'label' => __( 'Call to Action', 'otter-blocks' ) ),
'team' => array( 'label' => __( 'Team', 'otter-blocks' ) ),
'pricing' => array( 'label' => __( 'Pricing', 'otter-blocks' ) ),
'testimonials' => array( 'label' => __( 'Testimonials', 'otter-blocks' ) ),
);

$block_pattern_categories = apply_filters( 'otter_blocks_block_pattern_categories', $block_pattern_categories );

foreach ( $block_pattern_categories as $name => $properties ) {
if ( ! \WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
Expand Down Expand Up @@ -142,17 +144,7 @@ public static function register_patterns() {
'minimum' => 5.8,
),
);

/**
* Filters,
*), the theme block patterns.
*
* @since Twenty Twenty-Two 1.0
*
* @param array $block_patterns List of block patterns by name.
*/
$block_patterns = apply_filters( 'otter_blocks_block_patterns', $block_patterns );


foreach ( $block_patterns as $block_pattern ) {
if ( ! version_compare( get_bloginfo( 'version' ), $block_pattern['minimum'], '>=' ) ) {
continue;
Expand Down
134 changes: 0 additions & 134 deletions inc/class-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function init_upsells() {
add_action( 'wp', array( $this, 'schedule_cron_events' ) );
add_action( 'otter_montly_scheduled_events', array( $this, 'reset_dashboard_notice' ) );
add_action( 'admin_init', array( $this, 'should_show_dashboard_upsell' ), 11 );
add_action( 'admin_init', array( $this, 'should_show_bf_upsell' ), 11 );
add_filter( 'plugin_action_links_' . plugin_basename( OTTER_BLOCKS_BASEFILE ), array( $this, 'add_pro_link' ) );
}

Expand Down Expand Up @@ -163,10 +162,6 @@ public function should_show_dashboard_upsell() {
$show_upsell = false;
}

if ( self::bf_deal() ) {
$show_upsell = false;
}

if ( defined( 'OTTER_BLOCKS_SHOW_NOTICES' ) && true === OTTER_BLOCKS_SHOW_NOTICES ) {
$show_upsell = true;
}
Expand All @@ -177,30 +172,6 @@ public function should_show_dashboard_upsell() {
}
}

/**
* Check if we show BFUpsell notification or not
*
* @since 2.0.8
* @access public
*/
public function should_show_bf_upsell() {
$show_upsell = self::bf_deal();
$notifications = get_option( 'themeisle_blocks_settings_notifications', array() );

if ( defined( 'NEVE_VERSION' ) || defined( 'NEVE_PRO_VERSION' ) ) {
$show_upsell = false;
}

if ( isset( $notifications['2022_bf_notice'] ) && true === boolval( $notifications['2022_bf_notice'] ) ) {
$show_upsell = false;
}

if ( $show_upsell ) {
add_action( 'admin_notices', array( $this, 'dashboard_upsell_bf_notice' ) );
add_action( 'wp_ajax_dismiss_otter_bf_notice', array( $this, 'dismiss_dashboard_bf_notice' ) );
}
}

/**
* Register Metabox
*
Expand Down Expand Up @@ -342,57 +313,6 @@ public function dashboard_upsell_notice() {
);
}

/**
* Notice for BF upsell.
*
* @access public
*/
public function dashboard_upsell_bf_notice() {
$current_screen = get_current_screen();

if ( isset( $current_screen->base ) && 'settings_page_otter' === $current_screen->base ) {
return;
}
?>
<script type="text/javascript">
const disableBFNotice = $ => {
const button = document.querySelector( '.o-dismiss-bf-notice' );

if ( null !== button ) {
$( button ).on( 'click', e => {
e.preventDefault()
$.post(
'<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
{
nonce: '<?php echo esc_attr( wp_create_nonce( 'dismiss_otter_bf_notice' ) ); ?>',
action: 'dismiss_otter_bf_notice',
success: function () {
$( '.o-notice' ).fadeOut()
}
}
)
})
}
};

jQuery( document ).ready( () => disableBFNotice( jQuery ) );
</script>
<?php
$prefix = __( 'Otter Black Friday Sale', 'otter-blocks' );
$notice = printf(
'<div class="o-notice notice notice-info is-dismissible">
<svg style="float: left; margin: .5em 0; padding: 2px; padding-right: 10px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 32" width="20" height="20" class"otter-icon"><path d="M19.831 7.877c0.001-0.003 0.001-0.005 0.001-0.009s-0-0.006-0.001-0.009l0 0c-0.047-0.081-0.092-0.164-0.132-0.247l-0.057-0.115c-0.277-0.498-0.381-0.99-1.033-1.064h-0.045c-0.001 0-0.002 0-0.003 0-0.486 0-0.883 0.382-0.908 0.862l-0 0.002c0.674 0.126 1.252 0.278 1.813 0.468l-0.092-0.027 0.283 0.096 0.147 0.053s0.028 0 0.028-0.011z" /><path d="M23.982 13.574c-0.008-2.41-0.14-4.778-0.39-7.112l0.026 0.299 0.070-0.019c0.459-0.139 0.787-0.558 0.787-1.053 0-0.479-0.307-0.887-0.735-1.037l-0.008-0.002h-0.026c-0.479-0.164-0.874-0.468-1.149-0.861l-0.005-0.007c-2.7-3.96-8.252-3.781-8.252-3.781s-5.55-0.179-8.25 3.781c-0.28 0.401-0.676 0.704-1.14 0.862l-0.016 0.005c-0.441 0.148-0.754 0.557-0.754 1.040 0 0.009 0 0.017 0 0.026l-0-0.001c-0 0.010-0.001 0.022-0.001 0.034 0 0.493 0.335 0.907 0.789 1.029l0.007 0.002 0.045 0.011c-0.224 2.034-0.356 4.403-0.364 6.801l-0 0.012s-9.493 13.012-1.277 17.515c4.733 2.431 6.881-0.769 6.881-0.769s1.397-1.661-1.784-3.355v-4.609c0.006-0.344 0.282-0.621 0.625-0.628h1.212v-0.59c0-0.275 0.223-0.498 0.498-0.498v0h1.665c0.274 0.001 0.496 0.224 0.496 0.498 0 0 0 0 0 0v0 0.59h2.721v-0.59c0-0.275 0.223-0.498 0.498-0.498v0h1.665c0.271 0.005 0.49 0.226 0.49 0.498 0 0 0 0 0 0v0 0.59h1.209c0 0 0 0 0 0 0.349 0 0.633 0.28 0.639 0.627v4.584c-3.193 1.703-1.784 3.355-1.784 3.355s2.148 3.193 6.879 0.769c8.222-4.503-1.269-17.515-1.269-17.515zM22.586 10.261c-0.097 1.461-0.67 2.772-1.563 3.797l0.007-0.008c-1.703 2.010-4.407 3.249-6.721 4.432v0c-2.325-1.177-5.026-2.416-6.736-4.432-0.883-1.019-1.455-2.329-1.555-3.769l-0.001-0.020c-0.126-2.22 0.583-5.929 3.044-6.74 2.416-0.788 3.947 1.288 4.494 2.227 0.152 0.258 0.429 0.428 0.745 0.428s0.593-0.17 0.743-0.424l0.002-0.004c0.551-0.932 2.080-3.008 4.494-2.22 2.474 0.805 3.174 4.513 3.046 6.734z" /><path d="M19.463 10.087h-0.028c-0.192 0.026-0.121 0.251-0.047 0.356 0.254 0.349 0.407 0.787 0.407 1.26 0 0.006-0 0.012-0 0.018v-0.001c-0.001 0.469-0.255 0.878-0.633 1.1l-0.006 0.003c-0.739 0.426-1.377-0.145-2.054-0.398-0.72-0.269-1.552-0.434-2.42-0.455l-0.009-0v-1.033c1.020-0.233 1.894-0.76 2.551-1.486l0.004-0.004c0.151-0.163 0.244-0.383 0.244-0.623 0-0.316-0.159-0.595-0.402-0.76l-0.003-0.002c-0.768-0.551-1.728-0.881-2.764-0.881-1.054 0-2.029 0.341-2.819 0.92l0.013-0.009c-0.224 0.166-0.367 0.429-0.367 0.726 0 0.226 0.083 0.433 0.221 0.591l-0.001-0.001c0.665 0.751 1.55 1.295 2.553 1.53l0.033 0.007v1.050c-0.742 0.021-1.448 0.14-2.118 0.343l0.057-0.015c-0.341 0.103-0.631 0.219-0.908 0.358l0.033-0.015c-0.519 0.26-1.037 0.436-1.58 0.121-0.371-0.213-0.617-0.607-0.617-1.058 0-0.002 0-0.004 0-0.007v0c0-0.002 0-0.004 0-0.007 0-0.47 0.153-0.905 0.411-1.257l-0.004 0.006c0.047-0.068 0.089-0.17 0.026-0.241s-0.189 0-0.27 0.030c-0.189 0.099-0.348 0.227-0.479 0.381l-0.002 0.002c-0.245 0.296-0.394 0.679-0.394 1.097 0 0.004 0 0.007 0 0.011v-0.001c0.008 0.706 0.393 1.321 0.964 1.651l0.009 0.005c0.296 0.178 0.654 0.283 1.036 0.283 0.364 0 0.706-0.095 1.001-0.263l-0.010 0.005c0.877-0.461 1.917-0.731 3.019-0.731 0.069 0 0.137 0.001 0.206 0.003l-0.010-0h0.030c1.277 0 2.382 0.266 3.266 0.775 0.27 0.159 0.594 0.253 0.94 0.253 0.001 0 0.002 0 0.003 0h-0c0.355-0.002 0.688-0.098 0.974-0.265l-0.009 0.005c0.606-0.357 1.007-1.007 1.007-1.75 0-0.001 0-0.003 0-0.004v0c0.001-0.026 0.002-0.056 0.002-0.086 0-0.625-0.34-1.171-0.846-1.462l-0.008-0.004c-0.056-0.040-0.125-0.065-0.199-0.070l-0.001-0zM13.101 8.831c-0.238 0.213-0.468 0.581-0.832 0.345-0.061-0.041-0.114-0.086-0.161-0.136l-0-0c-0.063-0.063-0.101-0.15-0.101-0.247 0-0.133 0.074-0.248 0.182-0.308l0.002-0.001c0.594-0.309 1.203-0.543 1.884-0.49-0.324 0.281-0.649 0.56-0.973 0.837z" /><path d="M15.89 13.578c-0.367 0.483-0.941 0.792-1.588 0.792s-1.221-0.309-1.585-0.787l-0.004-0.005c-0.064-0.103-0.177-0.171-0.306-0.171-0.199 0-0.36 0.161-0.36 0.36 0 0.091 0.034 0.174 0.090 0.238l-0-0c0.499 0.659 1.283 1.080 2.164 1.080s1.665-0.421 2.159-1.073l0.005-0.007c0.043-0.059 0.068-0.132 0.068-0.212 0-0.116-0.055-0.22-0.14-0.286l-0.001-0.001c-0.059-0.045-0.134-0.072-0.215-0.072-0.117 0-0.221 0.056-0.286 0.143l-0.001 0.001z" /><path d="M18.507 11.707c0 0.194-0.157 0.351-0.351 0.351s-0.351-0.157-0.351-0.351c0-0.194 0.157-0.351 0.351-0.351s0.351 0.157 0.351 0.351z" /><path d="M17.389 11.049c0 0.194-0.157 0.351-0.351 0.351s-0.351-0.157-0.351-0.351c0-0.194 0.157-0.351 0.351-0.351s0.351 0.157 0.351 0.351z" /><path d="M10.798 11.707c0 0.194-0.157 0.351-0.351 0.351s-0.351-0.157-0.351-0.351c0-0.194 0.157-0.351 0.351-0.351s0.351 0.157 0.351 0.351z" /><path d="M11.918 11.049c0 0.194-0.157 0.351-0.351 0.351s-0.351-0.157-0.351-0.351c0-0.194 0.157-0.351 0.351-0.351s0.351 0.157 0.351 0.351z" /><path d="M8.773 7.877c-0.001-0.003-0.002-0.005-0.002-0.009s0.001-0.006 0.002-0.009l-0 0c0.047-0.081 0.089-0.164 0.132-0.247 0.019-0.038 0.036-0.079 0.057-0.115 0.275-0.498 0.379-0.99 1.033-1.064h0.045c0 0 0.001 0 0.001 0 0.487 0 0.884 0.382 0.91 0.862l0 0.002c-0.678 0.124-1.261 0.277-1.827 0.468l0.092-0.027-0.275 0.096-0.1 0.036-0.045 0.017s-0.023 0-0.023-0.011z" /></svg>
<p>
<b>%1$s</b> Save big with a <b>Lifetime License</b> on all Otter Pro Plans. <b>Only 100 licenses</b> will be available! <a target="_blank" href="%2$s">%3$s</a> <a class="notice-dismiss o-dismiss-bf-notice" href="#"><span class="screen-reader-text">%4$s</span></a>
</p>
</div>',
esc_html( $prefix ),
esc_url_raw( 'https://bit.ly/otter-2022bf' ),
esc_html__( 'Learn more', 'otter-blocks' ),
esc_html__( 'Dismiss notice', 'otter-blocks' )
);
}

/**
* Dismiss Dashboard upsell.
*
Expand All @@ -414,26 +334,6 @@ public function dismiss_dashboard_notice() {
wp_die();
}

/**
* Dismiss Dashboard bf upsell.
*
* @access public
*/
public function dismiss_dashboard_bf_notice() {
if ( ! isset( $_POST['nonce'] ) ) {
return;
}

if ( ! wp_verify_nonce( sanitize_text_field( $_POST['nonce'] ), 'dismiss_otter_bf_notice' ) ) {
return;
}

$notifications = get_option( 'themeisle_blocks_settings_notifications', array() );
$notifications['2022_bf_notice'] = true;
update_option( 'themeisle_blocks_settings_notifications', $notifications );
wp_die();
}

/**
* Add new cron schedule.
*
Expand Down Expand Up @@ -479,40 +379,6 @@ public function reset_dashboard_notice() {
}
}

/**
* Should show BF Deal?.
*
* @param bool $days To show in bool or days.
*
* @since 2.1.1
* @access public
*/
public static function bf_deal( $days = false ) {
$start_time = '2022-11-21T00:00:00';
$end_time = '2022-11-28T23:59:00';
$offset = 60 * get_option( 'gmt_offset' );
$sign = $offset < 0 ? '-' : '+';
$absmin = abs( $offset );
$timezone = sprintf( '%s%02d:%02d', $sign, $absmin / 60, $absmin % 60 );
$start_date = strtotime( $start_time . $timezone );
$current_time = time();
$end_date = strtotime( $end_time . $timezone );

if ( $days ) {
$days_between = ceil( abs( $end_date - $current_time ) / 86400 );
return $days_between;
}

$start_date = $current_time > $start_date;
$end_date = $current_time < $end_date;

if ( $start_date && $end_date && ! self::is_pro_installed() ) {
return true;
}

return false;
}

/**
* Add Pro Link to Plugins Page
*
Expand Down
1 change: 0 additions & 1 deletion inc/class-registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ public function enqueue_block_editor_assets() {
'isLegacyPre59' => version_compare( get_bloginfo( 'version' ), '5.8.22', '<=' ),
'isAncestorTypeAvailable' => version_compare( get_bloginfo( 'version' ), '5.9.22', '>=' ),
'version' => OTTER_BLOCKS_VERSION,
'showBFDeal' => Pro::bf_deal(),
'isRTL' => is_rtl(),
)
);
Expand Down
Loading

0 comments on commit a00f34f

Please sign in to comment.