PluginProbe
Flipbox / 1.2.5
Flipbox v1.2.5
trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.4.0
flipbox / flipbox.php

flipbox.php in Flipbox 1.2.5, at flipbox.php

121 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Flipbox
5 * Plugin URI: https://essential-blocks.com
6 * Description: Deliver your content beautifully to grab attention with an animated Flipbox block.
7 * Version: 1.2.5
8 * Author: WPDeveloper
9 * Author URI: https://wpdeveloper.net
10 * License: GPL-2.0-or-later
11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 * Text Domain: flipbox
13 *
14 * @package flipbox
15 */
16
17 /**
18 * Registers all block assets so that they can be enqueued through the block editor
19 * in the corresponding context.
20 *
21 * @see https://developer.wordpress.org/block-editor/tutorials/block-tutorial/applying-styles-with-stylesheets/
22 */
23
24 require_once __DIR__ . '/includes/font-loader.php';
25 require_once __DIR__ . '/includes/post-meta.php';
26 require_once __DIR__ . '/includes/helpers.php';
27 require_once __DIR__ . '/lib/style-handler/style-handler.php';
28
29 function create_block_flipbox_block_init() {
30 define( 'EB_FLIPBOX_BLOCKS_VERSION', "1.2.5" );
31 define( 'EB_FLIPBOX_BLOCKS_ADMIN_URL', plugin_dir_url( __FILE__ ) );
32 define( 'EB_FLIPBOX_BLOCKS_ADMIN_PATH', dirname( __FILE__ ) );
33
34 $script_asset_path = EB_FLIPBOX_BLOCKS_ADMIN_PATH . "/dist/index.asset.php";
35 if ( ! file_exists( $script_asset_path ) ) {
36 throw new Error(
37 'You need to run `npm start` or `npm run build` for the "flipbox/flipbox-block" block first.'
38 );
39 }
40 $index_js = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'dist/index.js';
41 $script_asset = require $script_asset_path;
42 $all_dependencies = array_merge( $script_asset['dependencies'], [
43 'wp-blocks',
44 'wp-i18n',
45 'wp-element',
46 'wp-block-editor',
47 'eb-flipbox-blocks-controls-util',
48 'essential-blocks-eb-animation'
49 ] );
50
51 wp_register_script(
52 'eb-flipbox-block-editor-js',
53 $index_js,
54 $all_dependencies,
55 $script_asset['version']
56 );
57
58 $load_animation_js = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'assets/js/eb-animation-load.js';
59 wp_register_script(
60 'essential-blocks-eb-animation',
61 $load_animation_js,
62 [],
63 EB_FLIPBOX_BLOCKS_VERSION,
64 true
65 );
66
67 $animate_css = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'assets/css/animate.min.css';
68 wp_register_style(
69 'essential-blocks-animation',
70 $animate_css,
71 [],
72 EB_FLIPBOX_BLOCKS_VERSION
73 );
74
75 $fontpicker_theme = 'assets/css/fonticonpicker.base-theme.react.css';
76 wp_register_style(
77 'fontpicker-default-theme',
78 plugins_url( $fontpicker_theme, __FILE__ ),
79 []
80 );
81
82 $fontpicker_material_theme = 'assets/css/fonticonpicker.material-theme.react.css';
83 wp_register_style(
84 'fontpicker-matetial-theme',
85 plugins_url( $fontpicker_material_theme, __FILE__ ),
86 []
87 );
88
89 $fontawesome_css = 'assets/css/font-awesome5.css';
90 wp_register_style(
91 'fontawesome-frontend-css',
92 plugins_url( $fontawesome_css, __FILE__ ),
93 []
94 );
95
96 $style_css = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'dist/style.css';
97 wp_register_style(
98 'eb-flipbox-block-frontend-style',
99 $style_css,
100 ['fontawesome-frontend-css', 'essential-blocks-animation'],
101 filemtime( EB_FLIPBOX_BLOCKS_ADMIN_PATH . '/dist/style.css' )
102 );
103
104 if ( ! WP_Block_Type_Registry::get_instance()->is_registered( 'essential-blocks/flipbox' ) ) {
105 register_block_type(
106 Flipbox_Helper::get_block_register_path( 'flipbox/flipbox-block', EB_FLIPBOX_BLOCKS_ADMIN_PATH ),
107 [
108 'editor_script' => 'eb-flipbox-block-editor-js',
109 'style' => 'eb-flipbox-block-frontend-style',
110 'render_callback' => function ( $attributes, $content ) {
111 if ( ! is_admin() ) {
112 wp_enqueue_script( 'essential-blocks-eb-animation' );
113 }
114 return $content;
115 }
116 ]
117 );
118 }
119 }
120 add_action( 'init', 'create_block_flipbox_block_init', 99 );
121