Skip to content

Commit

Permalink
Merge pull request #19 from mototeam/sprint15
Browse files Browse the repository at this point in the history
1.6.0, Jun 25 2020
  • Loading branch information
mototeam authored Jun 25, 2020
2 parents c5376e9 + 68ee103 commit 5d79c75
Show file tree
Hide file tree
Showing 237 changed files with 16,535 additions and 6,792 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
insert_final_newline = false
trim_trailing_whitespace = true
indent_style = tab
indent_style = tab
8 changes: 4 additions & 4 deletions getwid.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Getwid
* Plugin URI: https://motopress.com/products/getwid/
* Description: Extra Gutenberg blocks for building seamless and aesthetic websites in the WordPress block editor.
* Version: 1.5.4
* Version: 1.6.0
* Author: MotoPress
* Author URI: https://motopress.com/
* License: GPLv2 or later
Expand All @@ -13,7 +13,7 @@
*/

// Exit if accessed directly.
if ( !defined( 'ABSPATH' ) ) {
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

Expand All @@ -32,7 +32,7 @@
define( 'GETWID_DEBUG', false );
}

require_once plugin_dir_path( __FILE__ ) . 'includes/load.php';
include_once GETWID_PLUGIN_DIR . 'includes/getwid.php';

function getwid() {
return \Getwid\Getwid::getInstance();
Expand All @@ -41,4 +41,4 @@ function getwid() {
// Init Getwid
getwid();

}
}
12 changes: 1 addition & 11 deletions includes/allowed-css-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,15 @@
*/
class AllowedCssTags {

private static $instance = null;

/**
* AllowedCssTags constructor.
*/
public function __construct() {

add_filter( 'safe_style_css', [ $this, 'allowed_css' ], 20);
$this->allowed_tags();
}

public static function getInstance()
{
if (self::$instance == null)
{
self::$instance = new AllowedCssTags();
}
return self::$instance;
}

public function allowed_tags() {
global $allowedposttags;

Expand Down
16 changes: 4 additions & 12 deletions includes/blocks-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
*/
class BlocksManager {

private static $instance = null;

private $blocks = array();
private $enabledBlocks = array();
private $disabledBlocks = array();
Expand All @@ -24,15 +22,6 @@ public function __construct() {
add_action( 'init', [$this, 'includeBlocks'] );
}

public static function getInstance()
{
if (self::$instance == null)
{
self::$instance = new BlocksManager();
}
return self::$instance;
}

public function block_categories( $categories, $post ) {

//Add Getwid blocks category
Expand All @@ -47,7 +36,7 @@ public function block_categories( $categories, $post ) {
);

//Add Getwid post-block category (Only on Templates page)
if ( $post && ( $post->post_type == PostTemplatePart::$postType ) ) {
if ( $post && ( $post->post_type == getwid()->postTemplatePart()->postType ) ) {
$categories = array_merge(
$categories,
array(
Expand All @@ -66,6 +55,8 @@ public function includeBlocks() {

$block_files = array(
'abstract-block',

'anchor',
'accordion',
'advanced-heading',
'advanced-spacer',
Expand Down Expand Up @@ -94,6 +85,7 @@ public function includeBlocks() {
'tabs',
'testimonial',
'toggle',
'table-of-contents',
'video-popup',
'image-hotspot',
'countdown',
Expand Down
4 changes: 2 additions & 2 deletions includes/blocks/accordion.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function block_frontend_styles($styles) {
getwid_log( self::$blockName . '::hasBlock', $this->hasBlock() );

//fontawesome
$styles = \Getwid\FontIconsManager::getInstance()->enqueueFonts( $styles );
$styles = getwid()->fontIconsManager()->enqueueFonts( $styles );

return $styles;
}
Expand All @@ -68,6 +68,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\Accordion()
);
2 changes: 1 addition & 1 deletion includes/blocks/advanced-heading.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\AdvancedHeading()
);
2 changes: 1 addition & 1 deletion includes/blocks/advanced-spacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function getLabel() {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\AdvancedSpacer()
);
26 changes: 26 additions & 0 deletions includes/blocks/anchor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Getwid\Blocks;

class Anchor extends \Getwid\Blocks\AbstractBlock {

protected static $blockName = 'getwid/anchor';

public function __construct() {

parent::__construct( self::$blockName );

register_block_type(
'getwid/anchor'
);

}

public function getLabel() {
return __('Anchor', 'getwid');
}
}

getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\Anchor()
);
2 changes: 1 addition & 1 deletion includes/blocks/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function getLabel() {

}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\Banner()
);
2 changes: 1 addition & 1 deletion includes/blocks/button-group.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function getLabel() {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\ButtonGroup()
);
2 changes: 1 addition & 1 deletion includes/blocks/circle-progress-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\CircleProgressBar()
);
12 changes: 6 additions & 6 deletions includes/blocks/contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ public function recaptcha_api_key_manage() {
wp_send_json_error();
}

$data = $_POST['data' ];
$data = $_POST['data'];
$option = $_POST['option'];

$site_api_key = $data['site_api_key' ];
$secret_api_key = $data['secret_api_key'];
$site_api_key = trim( $data['site_api_key'] );
$secret_api_key = trim( $data['secret_api_key'] );

$response = false;
if ( $option == 'set' ) {
Expand All @@ -234,8 +234,8 @@ public function recaptcha_api_key_manage() {
$response = update_option( 'getwid_recaptcha_v2_secret_key', $secret_api_key );
}
} elseif ( $option == 'delete' ) {
$response = delete_option( 'getwid_recaptcha_v2_site_key' );
$response = delete_option( 'getwid_recaptcha_v2_secret_key');
$response = delete_option( 'getwid_recaptcha_v2_site_key' );
$response = delete_option( 'getwid_recaptcha_v2_secret_key' );
}

wp_send_json_success( $response );
Expand Down Expand Up @@ -284,6 +284,6 @@ private function get_error( $error_code ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\ContactForm()
);
2 changes: 1 addition & 1 deletion includes/blocks/content-timeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function getLabel() {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\ContentTimeline()
);
2 changes: 1 addition & 1 deletion includes/blocks/countdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\Countdown()
);
2 changes: 1 addition & 1 deletion includes/blocks/counter.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\Counter()
);
12 changes: 10 additions & 2 deletions includes/blocks/custom-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public function __construct() {
'postsToShow' => array(
'type' => 'number',
'default' => 5
),
'offset' => array(
'type' => 'number',
'default' => 0
),
'pagination' => array(
'type' => 'boolean',
Expand All @@ -39,6 +43,10 @@ public function __construct() {
),
'excludeCurrentPost' => array(
'type' => 'boolean',
'default' => false
),
'childPagesCurrentPage' => array(
'type' => 'boolean',
'default' => false
),
'parentPageId' => array(
Expand Down Expand Up @@ -113,7 +121,7 @@ public function block_frontend_styles($styles) {

//fontawesome
// for /template-parts/*
$styles = \Getwid\FontIconsManager::getInstance()->enqueueFonts( $styles );
$styles = getwid()->fontIconsManager()->enqueueFonts( $styles );

return $styles;
}
Expand Down Expand Up @@ -247,6 +255,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\CustomPostType()
);
7 changes: 4 additions & 3 deletions includes/blocks/google-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ public function block_editor_scripts($scripts) {
}

public function get_google_api_key() {

$nonce = $_POST['nonce'];
$action = $_POST['option'];
$data = $_POST['data'];
$nonce = $_POST['nonce'];
$data = trim( $_POST['data'] );

if ( ! wp_verify_nonce( $nonce, 'getwid_nonce_google_api_key' ) ) {
wp_send_json_error();
Expand Down Expand Up @@ -116,6 +117,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\GoogleMap()
);
4 changes: 2 additions & 2 deletions includes/blocks/icon-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function block_frontend_styles($styles) {
getwid_log( self::$blockName . '::hasBlock', $this->hasBlock() );

//fontawesome
$styles = \Getwid\FontIconsManager::getInstance()->enqueueFonts( $styles );
$styles = getwid()->fontIconsManager()->enqueueFonts( $styles );

//animate.min.css
if ( is_admin() && ! in_array( 'animate', $styles ) ) {
Expand Down Expand Up @@ -69,6 +69,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\IconBox()
);
4 changes: 2 additions & 2 deletions includes/blocks/icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function block_frontend_styles($styles) {
getwid_log( self::$blockName . '::hasBlock', $this->hasBlock() );

//fontawesome
$styles = \Getwid\FontIconsManager::getInstance()->enqueueFonts( $styles );
$styles = getwid()->fontIconsManager()->enqueueFonts( $styles );

//animate.min.css
if ( is_admin() && ! in_array( 'animate', $styles ) ) {
Expand Down Expand Up @@ -70,6 +70,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\Icon()
);
2 changes: 1 addition & 1 deletion includes/blocks/image-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public function render_callback( $attributes, $content ) {
}
}

\Getwid\BlocksManager::getInstance()->addBlock(
getwid()->blocksManager()->addBlock(
new \Getwid\Blocks\ImageBox()
);
Loading

0 comments on commit 5d79c75

Please sign in to comment.