Skip to content

Commit

Permalink
Merge pull request #490 from CakeWP/fix/post-saving-bug
Browse files Browse the repository at this point in the history
Fix critical bug
  • Loading branch information
ZafarKamal123 authored Mar 31, 2023
2 parents 4874b21 + da22ab8 commit a9da779
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 209 deletions.
2 changes: 1 addition & 1 deletion build/admin.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '1071f28ee559d4887e52b03ae8289ec0');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '5496598accb2d96bbe3df69bd7eaf29d');
2 changes: 1 addition & 1 deletion build/admin.js

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

2 changes: 1 addition & 1 deletion build/devtools.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-polyfill'), 'version' => 'b5729b1cefd96e2869cfeed2586068d2');
<?php return array('dependencies' => array('react', 'wp-polyfill'), 'version' => '0ae5fe59468db178d498d95c67ea6da6');
2 changes: 1 addition & 1 deletion build/devtools.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '6c75247c73a9d282d6f46a9dca8379a5');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'eae324fbdc9739c68047621768860536');
2 changes: 1 addition & 1 deletion build/editor.build.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-wordcount'), 'version' => '05474ab5654705f3206b6b4da054e044');
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '284552132e83f89f477bc4a3a251c5d6');
4 changes: 2 additions & 2 deletions build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/settings.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => 'bd55da33f766aba9070ec698be1f296a');
<?php return array('dependencies' => array('lodash', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives'), 'version' => 'f2aa9fe54225dbd749a41def501c5a9b');
2 changes: 1 addition & 1 deletion build/settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/style.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'e41716980274d82fe4b2a5e3b7129cf3');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'be1768d5e5ecad95903f66bb5b45a991');
52 changes: 25 additions & 27 deletions includes/class-editorskit-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,41 +85,39 @@ public function wordcount( $atts, $content ) {
}

$returned_content = '';
$reading_time = get_post_meta( $post->ID, '_editorskit_reading_time', true );

if ( ! $reading_time && isset( $atts['fallback'] ) && 'true' === $atts['fallback'] ) {
$blocks = '';
if ( function_exists( 'has_blocks' ) && has_blocks( $post->post_content ) ) {
$blocks = parse_blocks( $post->post_content );
}
$text = trim( wp_strip_all_tags( $post->post_content ) );
$text = strip_shortcodes( $text );
$wordcount = str_word_count( $text );

$word_per_seconds = ( $wordcount / 275 ) * 60;
$media_blocks = array( 'core/image', 'core/gallery', 'core/cover' );

if ( ! empty( $blocks ) ) {
$i = 12;
foreach ( $blocks as $key => $block ) {
if ( in_array( $block['blockName'], $media_blocks ) ) { // phpcs:ignore
$word_per_seconds = $word_per_seconds + $i;
if ( $i > 3 ) {
$i--;
}
$blocks = '';

if ( function_exists( 'has_blocks' ) && has_blocks( $post->post_content ) ) {
$blocks = parse_blocks( $post->post_content );
}
$text = trim( wp_strip_all_tags( $post->post_content ) );
$text = strip_shortcodes( $text );
$wordcount = str_word_count( $text );

$word_per_seconds = ( $wordcount / 275 ) * 60;
$media_blocks = array( 'core/image', 'core/gallery', 'core/cover' );

if ( ! empty( $blocks ) ) {
$i = 12;
foreach ( $blocks as $key => $block ) {
if ( in_array( $block['blockName'], $media_blocks ) ) { // phpcs:ignore
$word_per_seconds = $word_per_seconds + $i;
if ( $i > 3 ) {
$i--;
}
}
}
}

$word_per_minute = $word_per_seconds / 60;

if ( $word_per_minute < 1 ) {
$word_per_minute = 1;
}
$word_per_minute = $word_per_seconds / 60;

$reading_time = round( $word_per_minute );
if ( $word_per_minute < 1 ) {
$word_per_minute = 1;
}

$reading_time = round( $word_per_minute );

if ( ! $reading_time ) {
return false;
}
Expand Down
8 changes: 2 additions & 6 deletions languages/editorskit.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the EditorsKit plugin.
msgid ""
msgstr ""
"Project-Id-Version: EditorsKit 1.34.6\n"
"Project-Id-Version: EditorsKit 1.34.7\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/block-options\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-03-07T10:47:34+00:00\n"
"POT-Creation-Date: 2023-03-31T10:16:11+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.7.1\n"
"X-Domain: block-options\n"
Expand Down Expand Up @@ -1271,10 +1271,6 @@ msgstr ""
msgid "Keyboard Shortcuts"
msgstr ""

#: src/extensions/components/reading-time/components/controls.js:53
msgid "Reading Time"
msgstr ""

#: src/extensions/components/url-popover/url-input-ui.js:113
#: src/extensions/formats/link/components/inline.js:281
msgid "No Follow"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "editorskit",
"title": "EditorsKit",
"version": "1.34.6",
"version": "1.34.7",
"private": false,
"author": "Jeffrey Carandang from EditorsKit",
"author_shop": "EditorsKit",
Expand Down
4 changes: 2 additions & 2 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: EditorsKit
* Plugin URI: https://editorskit.com/
* Description: EditorsKit is a suite of <strong>page building block options</strong> for the Gutenberg block editor.
* Version: 1.34.6
* Version: 1.34.7
* Author: Munir Kamal
* Author URI: https://www.munirkamal.com/
* Text Domain: block-options
Expand Down Expand Up @@ -95,7 +95,7 @@ public function __wakeup() {
*/
private function setup_constants() {
$this->define( 'EDITORSKIT_DEBUG', true );
$this->define( 'EDITORSKIT_VERSION', '1.34.6' );
$this->define( 'EDITORSKIT_VERSION', '1.34.7' );
$this->define( 'EDITORSKIT_HAS_PRO', false );
$this->define( 'EDITORSKIT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
$this->define( 'EDITORSKIT_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Plugin URI: https://editorskit.com
Contributors: munirkamal
Tags: Gutenberg blocks, WordPress blocks, gutenberg, blocks, Gutenberg editor
Requires at least: 5.0
Tested up to: 6.1
Tested up to: 6.2
Requires PHP: 5.6
Stable tag: 1.34.6
Stable tag: 1.34.7
License: GPL-3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -191,6 +191,9 @@ e.g.

== Changelog ==

= 1.34.7 =
* Fix: Critical bug that prevents the page from updating.

= 1.34.6 =
* Fix: Show Support link on other plugins.
* Fix: PHP Errors on older WP versions.
Expand Down
1 change: 0 additions & 1 deletion src/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import './extensions/components/manager';
import './extensions/components/code-editor';
import './extensions/components/heading-label';
import './extensions/components/featured-image';
import './extensions/components/reading-time';
import './extensions/components/help-tips';
import './extensions/components/selected-block';
import './extensions/components/gradient-controls';
Expand Down
1 change: 0 additions & 1 deletion src/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@import "./src/extensions/components/guidelines/styles/editor.scss";
@import "./src/extensions/components/manager/styles/editor.scss";
@import "./src/extensions/components/featured-image/styles/editor.scss";
@import "./src/extensions/components/reading-time/styles/editor.scss";
@import "./src/extensions/components/help-tips/styles/editor.scss";
@import "./src/extensions/components/gradient-controls/styles/editor.scss";
@import "./src/extensions/movable-block-options/styles/editor.scss";
Expand Down
136 changes: 0 additions & 136 deletions src/extensions/components/reading-time/components/controls.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/extensions/components/reading-time/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/extensions/components/reading-time/styles/editor.scss

This file was deleted.

0 comments on commit a9da779

Please sign in to comment.