PluginProbe
Blocks to Shortcode – Use blocks everywhere: in page templates, Elementor, etc. / 0.13
Blocks to Shortcode – Use blocks everywhere: in page templates, Elementor, etc. v0.13
trunk 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13
blocks-to-shortcode / blocks-to-shortcode.php

blocks-to-shortcode.php in Blocks to Shortcode – Use blocks everywhere: in page templates, Elementor, etc. 0.13, at blocks-to-shortcode.php

71 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Plugin Name: Blocks to Shortcode
4 * Plugin URI: https://pluginenvision.com/plugins/blocks-to-shortcode
5 * Description: Use gutenberg blocks in anywhere using blocks to shortcode.
6 * Version: 0.13
7 * Requires at least: 6.2
8 * Requires PHP: 7.2
9 * Author: Plugin Envision
10 * Author URI: https://pluginenvision.com
11 * License: GPLv3 or later
12 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13 * Text Domain: blocks-to-shortcode
14 */
15
16 if ( !defined( 'ABSPATH' ) ) { exit; }
17
18 if( function_exists( 'btsc_fs' ) ) {
19 btsc_fs()->set_basename( false, __FILE__ );
20 }else {
21 define( 'BTSC_VERSION', isset( $_SERVER['HTTP_HOST'] ) && 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '0.13' );
22 define( 'BTSC_DIR_URL', plugin_dir_url( __FILE__ ) );
23 define( 'BTSC_DIR_PATH', plugin_dir_path( __FILE__ ) );
24 define( 'BTSC_HAS_FS', file_exists( BTSC_DIR_PATH . 'vendor/freemius/start.php' ) );
25
26 if( BTSC_HAS_FS ) {
27 require_once BTSC_DIR_PATH . 'includes/fs-config.php';
28 }
29
30 function btscWusul() {
31 if( BTSC_HAS_FS ) {
32 return btsc_fs()->can_use_premium_code();
33 }else {
34 return false;
35 }
36 }
37
38 include_once BTSC_DIR_PATH . 'includes/Admin/Submenu.php';
39 require_once BTSC_DIR_PATH . 'includes/Register.php';
40 require_once BTSC_DIR_PATH . 'includes/Helper.php';
41 include_once BTSC_DIR_PATH . 'includes/Tools/AdvancedTab.php';
42
43 if( !class_exists( 'BTSCPlugin' ) ) {
44 class BTSCPlugin {
45 public function __construct() {
46 add_action( 'init', [ $this, 'onInit' ] );
47 add_action( 'enqueue_block_assets', [ $this, 'enqueueBlockAssets' ] );
48 add_action( 'enqueue_block_editor_assets', [ $this, 'enqueueBlockEditorAssets' ] );
49 }
50
51 function onInit() {
52 register_block_type( __DIR__ . '/build' );
53 }
54
55 function enqueueBlockAssets() {
56 wp_register_style( 'aos', BTSC_DIR_URL . 'public/css/aos.css', [], '2.3.1' );
57 wp_register_script( 'aos', BTSC_DIR_URL . 'public/js/aos.js', [], '2.3.1', false );
58 wp_set_script_translations( 'aos', 'blocks-to-shortcode', BTSC_DIR_PATH . 'languages' );
59 }
60
61 function enqueueBlockEditorAssets() {
62 wp_set_script_translations( 'btsc-shortcode-selector-editor-script', 'blocks-to-shortcode', BTSC_DIR_PATH . 'languages' );
63
64 $inline_js = "const btscAdminUrl = '" . esc_url( admin_url() ) . "'; const btscWusul = '" . btscWusul() . "';";
65 wp_add_inline_script( 'btsc-shortcode-selector-editor-script', $inline_js );
66 }
67 }
68 new BTSCPlugin();
69 }
70 }
71