| 1 |
<?php |
| 2 |
/** |
| 3 |
* Additional PHP for blocks. |
| 4 |
* |
| 5 |
* @package ghostkit |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Register all blocks. |
| 14 |
*/ |
| 15 |
function ghostkit_register_blocks() { |
| 16 |
// Find all json and php files of blocks. |
| 17 |
$all_block_json = glob( ghostkit()->plugin_path . 'gutenberg/blocks/*/block.json' ); |
| 18 |
$all_block_php = glob( ghostkit()->plugin_path . 'gutenberg/blocks/*/block.php' ); |
| 19 |
|
| 20 |
foreach ( $all_block_json as $path ) { |
| 21 |
$php_file_path = str_replace( '.json', '.php', $path ); |
| 22 |
$there_is_php = in_array( $php_file_path, $all_block_php, true ); |
| 23 |
|
| 24 |
// Don't register block if there is php file, |
| 25 |
// which already should contains the registration code. |
| 26 |
if ( ! $there_is_php ) { |
| 27 |
register_block_type_from_metadata( $path ); |
| 28 |
} |
| 29 |
} |
| 30 |
} |
| 31 |
add_action( 'init', 'ghostkit_register_blocks' ); |
| 32 |
|
| 33 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/icon/block.php'; |
| 34 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/widgetized-area/block.php'; |
| 35 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/instagram/block.php'; |
| 36 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/twitter/block.php'; |
| 37 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/table-of-contents/block.php'; |
| 38 |
|
| 39 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/block.php'; |
| 40 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/text/block.php'; |
| 41 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/email/block.php'; |
| 42 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/name/block.php'; |
| 43 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/url/block.php'; |
| 44 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/phone/block.php'; |
| 45 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/number/block.php'; |
| 46 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/date/block.php'; |
| 47 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/textarea/block.php'; |
| 48 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/select/block.php'; |
| 49 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/submit/block.php'; |
| 50 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/checkbox/block.php'; |
| 51 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/radio/block.php'; |
| 52 |
require_once ghostkit()->plugin_path . 'gutenberg/blocks/form/fields/hidden/block.php'; |
| 53 |
|
| 54 |
require_once ghostkit()->plugin_path . 'gutenberg/utils/rest-meta-auth/index.php'; |
| 55 |
|
| 56 |
require_once ghostkit()->plugin_path . 'gutenberg/plugins/color-palette/index.php'; |
| 57 |
require_once ghostkit()->plugin_path . 'gutenberg/plugins/customizer/index.php'; |
| 58 |
require_once ghostkit()->plugin_path . 'gutenberg/plugins/custom-code/index.php'; |
| 59 |
require_once ghostkit()->plugin_path . 'gutenberg/plugins/typography/index.php'; |
| 60 |
|