PluginProbe
Typing Text / 1.0.3
Typing Text v1.0.3
trunk 0.1.2.6 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.7 1.3.0
typing-text / typing-text.php

typing-text.php in Typing Text 1.0.3, at typing-text.php

77 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Typing Text
4 * Description: Make Your Website Interactive With Typing Text Animation
5 * Version: 1.0.3
6 * Author: WPDeveloper
7 * Author URI: https://wpdeveloper.net
8 * License: GPL-3.0-or-later
9 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
10 * Text Domain: typing-text
11 *
12 * @package typing-text
13 */
14
15 /**
16 * Registers all block assets so that they can be enqueued through the block editor
17 * in the corresponding context.
18 *
19 * @see https://developer.wordpress.org/block-editor/tutorials/block-tutorial/applying-styles-with-stylesheets/
20 */
21
22 require_once __DIR__ . '/includes/font-loader.php';
23 require_once __DIR__ . '/includes/post-meta.php';
24
25 function create_block_typing_text_block_init() {
26 $dir = dirname( __FILE__ );
27
28 $script_asset_path = "$dir/build/index.asset.php";
29 if ( ! file_exists( $script_asset_path ) ) {
30 throw new Error(
31 'You need to run `npm start` or `npm run build` for the "typing-text/typing-text-block" block first.'
32 );
33 }
34 $index_js = 'build/index.js';
35 $script_asset = require( $script_asset_path );
36 wp_register_script(
37 'create-block-typing-text-block-editor',
38 plugins_url( $index_js, __FILE__ ),
39 $script_asset['dependencies'],
40 $script_asset['version']
41 );
42
43 $style_css = 'build/style-index.css';
44 wp_register_style(
45 'create-block-typing-text-block',
46 plugins_url( $style_css, __FILE__ ),
47 array(),
48 filemtime( "$dir/$style_css" )
49 );
50
51 $typed_js = 'src/js/typed.min.js';
52 wp_register_script(
53 'essential-blocks-typedjs',
54 plugins_url($typed_js, __FILE__),
55 array( "jquery"),
56 true
57 );
58
59 $frontend_js = 'src/frontend.js';
60 wp_register_script(
61 'essential-blocks-typing-text-frontend',
62 plugins_url($frontend_js, __FILE__),
63 array( "jquery","essential-blocks-typedjs"),
64 true
65 );
66
67
68 if( ! WP_Block_Type_Registry::get_instance()->is_registered( 'essential-blocks/typing-text' ) ) {
69 register_block_type( 'typing-text/typing-text-block', array(
70 'editor_script' => 'create-block-typing-text-block-editor',
71 'style' => 'create-block-typing-text-block',
72 'script' => 'essential-blocks-typing-text-frontend'
73 ) );
74 }
75 }
76 add_action( 'init', 'create_block_typing_text_block_init' );
77