PluginProbe
Flipbox / 1.2.3
Flipbox v1.2.3
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.3, at flipbox.php

124 lines 3.5 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.3
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 {
31 define('EB_FLIPBOX_BLOCKS_VERSION', "1.2.3");
32 define('EB_FLIPBOX_BLOCKS_ADMIN_URL', plugin_dir_url(__FILE__));
33 define('EB_FLIPBOX_BLOCKS_ADMIN_PATH', dirname(__FILE__));
34
35 $script_asset_path = EB_FLIPBOX_BLOCKS_ADMIN_PATH . "/dist/index.asset.php";
36 if (!file_exists($script_asset_path)) {
37 throw new Error(
38 'You need to run `npm start` or `npm run build` for the "flipbox/flipbox-block" block first.'
39 );
40 }
41 $index_js = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'dist/index.js';
42 $script_asset = require($script_asset_path);
43 $all_dependencies = array_merge($script_asset['dependencies'], array(
44 'wp-blocks',
45 'wp-i18n',
46 'wp-element',
47 'wp-block-editor',
48 'eb-flipbox-blocks-controls-util',
49 'essential-blocks-eb-animation'
50 ));
51
52 wp_register_script(
53 'eb-flipbox-block-editor-js',
54 $index_js,
55 $all_dependencies,
56 $script_asset['version']
57 );
58
59 $load_animation_js = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'assets/js/eb-animation-load.js';
60 wp_register_script(
61 'essential-blocks-eb-animation',
62 $load_animation_js,
63 array(),
64 EB_FLIPBOX_BLOCKS_VERSION,
65 true
66 );
67
68 $animate_css = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'assets/css/animate.min.css';
69 wp_register_style(
70 'essential-blocks-animation',
71 $animate_css,
72 array(),
73 EB_FLIPBOX_BLOCKS_VERSION
74 );
75
76
77 $fontpicker_theme = 'assets/css/fonticonpicker.base-theme.react.css';
78 wp_register_style(
79 'fontpicker-default-theme',
80 plugins_url($fontpicker_theme, __FILE__),
81 array()
82 );
83
84 $fontpicker_material_theme = 'assets/css/fonticonpicker.material-theme.react.css';
85 wp_register_style(
86 'fontpicker-matetial-theme',
87 plugins_url($fontpicker_material_theme, __FILE__),
88 array()
89 );
90
91
92 $fontawesome_css = 'assets/css/font-awesome5.css';
93 wp_register_style(
94 'fontawesome-frontend-css',
95 plugins_url($fontawesome_css, __FILE__),
96 array()
97 );
98
99 $style_css = EB_FLIPBOX_BLOCKS_ADMIN_URL . 'dist/style.css';
100 wp_register_style(
101 'eb-flipbox-block-frontend-style',
102 $style_css,
103 array('fontawesome-frontend-css', 'essential-blocks-animation'),
104 filemtime(EB_FLIPBOX_BLOCKS_ADMIN_PATH . '/dist/style.css')
105 );
106
107 if (!WP_Block_Type_Registry::get_instance()->is_registered('essential-blocks/flipbox')) {
108 register_block_type(
109 Flipbox_Helper::get_block_register_path('flipbox/flipbox-block', EB_FLIPBOX_BLOCKS_ADMIN_PATH),
110 array(
111 'editor_script' => 'eb-flipbox-block-editor-js',
112 'style' => 'eb-flipbox-block-frontend-style',
113 'render_callback' => function ($attributes, $content) {
114 if (!is_admin()) {
115 wp_enqueue_script('essential-blocks-eb-animation');
116 }
117 return $content;
118 }
119 )
120 );
121 }
122 }
123 add_action('init', 'create_block_flipbox_block_init', 99);
124