| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Section Collection |
| 4 |
* Description: A versatile section collection plugin featuring essential UI blocks to craft impactful, engaging, and user-centric web pages. |
| 5 |
* Version: 1.0.7 |
| 6 |
* Author: bPlugins |
| 7 |
* Author URI: https://bplugins.com |
| 8 |
* License: GPLv3 |
| 9 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 10 |
* Text Domain: b-blocks |
| 11 |
*/ |
| 12 |
|
| 13 |
// ABS PATH |
| 14 |
if ( !defined( 'ABSPATH' ) ) { exit; } |
| 15 |
|
| 16 |
// Constant |
| 17 |
define( 'BPSC_VERSION', isset( $_SERVER['HTTP_HOST'] ) && 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '1.0.7' ); |
| 18 |
define( 'BPSC_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| 19 |
define( 'BPSC_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 20 |
|
| 21 |
|
| 22 |
// require_once BPSC_DIR_PATH . '/includes/Utils.php'; |
| 23 |
// require_once BPSC_DIR_PATH . '/includes/GetCSS.php'; |
| 24 |
// require_once BPSC_DIR_PATH . '/includes/EnqueueAssets.php'; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
if( !class_exists( 'BPSCPlugin' ) ){ |
| 29 |
class BPSCPlugin{ |
| 30 |
function __construct(){ |
| 31 |
add_action( 'init', [ $this, 'onInit' ] ); |
| 32 |
add_action( 'enqueue_block_editor_assets', [ $this, 'enqueueAssets' ] ); |
| 33 |
add_action( 'wp_enqueue_scripts', [ $this, 'enqueueScripts' ] ); |
| 34 |
add_filter( 'block_categories_all', [$this, 'registerCategories'] ); |
| 35 |
} |
| 36 |
|
| 37 |
function onInit(){ |
| 38 |
$blocks =['testimonial_block', 'timeline_block', 'ticker', 'about-us', 'team-section', 'faq', 'call-to-actions', 'info-list-block', 'hero-section', 'pricing-table-section', 'feature-details', 'info-grid', 'feature-overview-section', 'modern-faq-section']; |
| 39 |
foreach ( $blocks as $block ) { |
| 40 |
register_block_type( __DIR__ . "/build/".$block ); |
| 41 |
} |
| 42 |
} |
| 43 |
function enqueueAssets(){ |
| 44 |
wp_enqueue_style( 'bndl-style', BPSC_DIR_URL . 'build/index.css', [], BPSC_VERSION ); |
| 45 |
wp_enqueue_script( 'bndl-script', BPSC_DIR_URL . 'build/index.js', ['wp-blocks'], BPSC_VERSION, true ); |
| 46 |
} |
| 47 |
|
| 48 |
function enqueueScripts(){ |
| 49 |
wp_enqueue_script( 'bndl-advanced-script', BPSC_DIR_URL . 'build/advanced.js', [], BPSC_VERSION, true ); |
| 50 |
} |
| 51 |
|
| 52 |
function registerCategories( $categories ){ |
| 53 |
return array_merge( [ [ |
| 54 |
'slug' => 'bPlugins', |
| 55 |
'title' => __( 'Section Collection', 'b-plugins' ), |
| 56 |
] ], $categories ); |
| 57 |
} |
| 58 |
} |
| 59 |
new BPSCPlugin(); |
| 60 |
} |
| 61 |
|
| 62 |
|