Skip to content

Commit

Permalink
Merge pull request #91 from firetreedesign/v1.4.3
Browse files Browse the repository at this point in the history
V1.4.3
  • Loading branch information
danielmilner authored Jul 16, 2021
2 parents 67789aa + 41d26f4 commit 4e1cfbf
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 39 deletions.
6 changes: 3 additions & 3 deletions ccbpress-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Church Data Connect for Church Community Builder
* Plugin URI: https://churchdataconnect.com/
* Description: Display information from Church Community Builder on your WordPress site.
* Version: 1.4.2
* Version: 1.4.3
* Author: FireTree Design, LLC <[email protected]>
* Author URI: https://firetreedesign.com/
* Text Domain: ccbpress-core
Expand Down Expand Up @@ -66,7 +66,7 @@ class CCBPress_Core {
* @var string
* @since 1.0.0
*/
public $version = '1.4.2';
public $version = '1.4.3';

/**
* Main CCBPress_Core Instance
Expand Down Expand Up @@ -172,7 +172,7 @@ private function includes() {
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-rest-api.php';

// Blocks.
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/blocks.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-core-blocks.php';

if ( is_admin() ) {
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-page-tabs.php';
Expand Down
79 changes: 52 additions & 27 deletions includes/blocks.php → includes/class-ccbpress-core-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* Enqueue CSS/JS of all the blocks.
*
* @since 1.0.0
* @package CGB
* @since 1.0.0
* @package CCBPress
*/

// Exit if accessed directly.
Expand All @@ -17,7 +17,7 @@
* CCBPress Core Blocks class
*/
class CCBPress_Core_Blocks {

/**
* Initialize the class
*
Expand All @@ -29,91 +29,116 @@ public static function init() {
add_action( 'enqueue_block_assets', 'CCBPress_Core_Blocks::enqueue_block_assets' );
add_action( 'enqueue_block_editor_assets', 'CCBPress_Core_Blocks::enqueue_block_editor_assets' );

add_filter( 'block_categories', __CLASS__ . '::block_categories', 10, 2 );
if ( version_compare( $GLOBALS['wp_version'], '5.8alpha', '>=' ) ) {
add_filter( 'block_categories_all', __CLASS__ . '::block_categories_all', 10, 2 );
} else {
add_filter( 'block_categories', __CLASS__ . '::block_categories', 10, 2 );
}

require_once CCBPRESS_CORE_PLUGIN_DIR . 'src/group-info/index.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'src/login/index.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'src/online-giving/index.php';
}
}

/**
* Enqueue Gutenberg block assets for both frontend + backend.
*
* @since 1.2.0
*
* @return void
*/
public static function enqueue_block_assets() {

// $block_path = '/dist/blocks.build.js';
$style_path = '/dist/blocks.style.build.css';
$style_path = '/dist/blocks.style.build.css';

// Styles.
wp_enqueue_style(
'ccbpress-core-blocks-css', // Handle.
plugins_url( $style_path, CCBPRESS_CORE_PLUGIN_FILE ), // Block style CSS.
array(), // Dependency to include the CSS after it.
filemtime( plugin_dir_path( CCBPRESS_CORE_PLUGIN_FILE ) . $style_path )
array(), // Dependency to include the CSS after it.
filemtime( plugin_dir_path( CCBPRESS_CORE_PLUGIN_FILE ) . $style_path )
);
}

/**
* Enqueue Gutenberg block assets for both frontend + backend.
*
* @since 1.2.0
*
* @return void
*/
public static function enqueue_block_editor_assets() {
$editor_block_path = '/dist/blocks.build.js';
$editor_style_path = '/dist/blocks.style.build.css';

$editor_block_path = '/dist/blocks.build.js';
$editor_style_path = '/dist/blocks.style.build.css';

// Scripts.
wp_enqueue_script(
'ccbpress-core-block-js', // Handle.
plugins_url( $editor_block_path, CCBPRESS_CORE_PLUGIN_FILE ), // Block.build.js: We register the block here. Built with Webpack.
array('wp-i18n', 'wp-element', 'wp-components', 'wp-blocks', 'wp-editor' ), // Dependencies, defined above.
filemtime( plugin_dir_path( CCBPRESS_CORE_PLUGIN_FILE ) . $editor_block_path )
array( 'wp-i18n', 'wp-element', 'wp-components', 'wp-blocks', 'wp-editor' ), // Dependencies, defined above.
filemtime( plugin_dir_path( CCBPRESS_CORE_PLUGIN_FILE ) . $editor_block_path ),
true
);

// Scripts.
wp_localize_script(
'ccbpress-core-block-js',
'ccbpress_core_blocks',
array(
'api_url' => site_url( '/wp-json/' ),
'api_nonce' => wp_create_nonce( 'wp_rest' ),
'api_url' => site_url( '/wp-json/' ),
'api_nonce' => wp_create_nonce( 'wp_rest' ),
)
);

// Styles.
wp_enqueue_style(
'ccbpress-core-block-editor-css', // Handle.
plugins_url( $editor_style_path, CCBPRESS_CORE_PLUGIN_FILE ), // Block editor CSS.
array(), // Dependency to include the CSS after it.
filemtime( plugin_dir_path( CCBPRESS_CORE_PLUGIN_FILE ) . $editor_style_path )
array(), // Dependency to include the CSS after it.
filemtime( plugin_dir_path( CCBPRESS_CORE_PLUGIN_FILE ) . $editor_style_path )
);
}

/**
* Register a new block category for CCBPress.
* Register a new block category for Church Data Connect.
*
* @since 1.3.0
*
* @return void
* @deprecated 1.4.3 As of WordPress 5.8
* @see CCBPress_Core_Blocks::block_categories_all()
* @param array $categories Block categories.
* @param object $post Post object.
* @return array
*/
public static function block_categories( $categories, $post ) {
return array_merge(
$categories,
array(
array(
'slug' => 'ccbpress',
'slug' => 'ccbpress',
'title' => __( 'Church Data Connect for Church Community Builder', 'ccbpress-core' ),
'icon' => null,
'icon' => null,
),
)
);
}

/**
* Register a new block category for Church Data Connect.
*
* @since 1.4.3
* @param array $block_categories Block categories.
* @param object $editor_context Editor context.
* @return array
*/
public static function block_categories_all( $block_categories, $editor_context ) {
array_push(
$block_categories,
array(
'slug' => 'ccbpress',
'title' => __( 'Church Data Connect for Church Community Builder', 'ccbpress-core' ),
'icon' => null,
)
);
return $block_categories;
}
}
CCBPress_Core_Blocks::init();

CCBPress_Core_Blocks::init();
9 changes: 3 additions & 6 deletions 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,6 +1,6 @@
{
"name": "ccbpress-core",
"version": "1.3.10",
"version": "1.4.3",
"private": true,
"scripts": {
"start": "cgb-scripts start",
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: firetree, danielmilner
Tags: church, ccb, church community builder, chms, gutenberg
Requires at least: 4.3
Tested up to: 5.7
Tested up to: 5.8
Requires PHP: 5.3
Stable tag: 1.4.2
Stable tag: 1.4.3
License: GPLv2 or later
License URI: http://ww.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -45,6 +45,9 @@ Extend the capabilities of Church Data Connect for Church Community Builder with

== Changelog ==

= 1.4.3 =
* Added compatibility with WordPress 5.8.

= 1.4.2 =
* Fixed an error when viewing the Add-ons page.

Expand Down
51 changes: 51 additions & 0 deletions src/group-info/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "ccbpress/group-info",
"title": "Group Information",
"category": "ccbpress",
"description": "Display group information from Church Community Builder.",
"keywords": [ "church community builder", "ccb", "ccbpress" ],
"textdomain": "ccbpress-core",
"supports": {
"html": false
},
"attributes": {
"groupId": {
"type": "integer",
"default": null
},
"showGroupImage": {
"type": "boolean",
"default": true
},
"showGroupName": {
"type": "boolean",
"default": true
},
"showGroupDesc": {
"type": "boolean",
"default": true
},
"showMainLeader": {
"type": "boolean",
"default": true
},
"showMainLeaderEmail": {
"type": "boolean",
"default": true
},
"showMainLeaderPhone": {
"type": "boolean",
"default": true
},
"showRegistrationForms": {
"type": "boolean",
"default": true
},
"boxBackgroundColor": {
"type": "string"
},
"boxBorderColor": {
"type": "string"
}
}
}
27 changes: 27 additions & 0 deletions src/login/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "ccbpress/login",
"title": "CCB Login",
"category": "ccbpress",
"description": "Login form for Church Community Builder.",
"keywords": [ "church community builder", "ccb", "ccbpress" ],
"textdomain": "ccbpress-core",
"supports": {
"html": false
},
"attributes": {
"showForgotPassword": {
"type": "boolean",
"default": true
},
"buttonBackgroundColor": {
"type": "string"
},
"buttonTextColor": {
"type": "string"
},
"buttonText": {
"type": "string",
"default": "Login"
}
}
}
23 changes: 23 additions & 0 deletions src/online-giving/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "ccbpress/online-giving",
"title": "Online Giving",
"category": "ccbpress",
"description": "Link to online giving for Church Community Builder.",
"keywords": [ "church community builder", "ccb", "ccbpress" ],
"textdomain": "ccbpress-core",
"supports": {
"html": false
},
"attributes": {
"buttonText": {
"type": "string",
"default": "Give Now"
},
"backgroundColor": {
"type": "string"
},
"textColor": {
"type": "string"
}
}
}

0 comments on commit 4e1cfbf

Please sign in to comment.