| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Animated Blocks on Scroll |
| 5 |
* Plugin URI: https://wordpress.org/plugins/animated-blocks/ |
| 6 |
* Description: Add scroll based animations to Gutenberg blocks. |
| 7 |
* Author: Virgiliu Diaconu |
| 8 |
* Author URI: http://virgiliudiaconu.com/ |
| 9 |
* Requires at least: 5.9 |
| 10 |
* Requires PHP: 7.0 |
| 11 |
* Version: 1.1.6 |
| 12 |
* License: GPL-2.0-or-later |
| 13 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 14 |
* Text Domain: animated-blocks |
| 15 |
* |
| 16 |
* @package AnimatedBlocks |
| 17 |
*/ |
| 18 |
|
| 19 |
if (! defined('ABSPATH')) { |
| 20 |
exit; |
| 21 |
} |
| 22 |
|
| 23 |
require_once __DIR__ . '/inc/class-animated-blocks-settings.php'; |
| 24 |
require_once __DIR__ . '/inc/class-animated-blocks-assets.php'; |
| 25 |
require_once __DIR__ . '/inc/class-animated-blocks-block.php'; |
| 26 |
|
| 27 |
/** |
| 28 |
* Main plugin bootstrap. |
| 29 |
*/ |
| 30 |
class Animated_Blocks |
| 31 |
{ |
| 32 |
|
| 33 |
/** |
| 34 |
* Plugin version. |
| 35 |
* |
| 36 |
* @var string |
| 37 |
*/ |
| 38 |
const VERSION = '1.1.6'; |
| 39 |
|
| 40 |
/** |
| 41 |
* Gets the plugin file path. |
| 42 |
* |
| 43 |
* @return string |
| 44 |
*/ |
| 45 |
public static function file() |
| 46 |
{ |
| 47 |
return __FILE__; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Gets the plugin directory path. |
| 52 |
* |
| 53 |
* @return string |
| 54 |
*/ |
| 55 |
public static function path() |
| 56 |
{ |
| 57 |
return plugin_dir_path(self::file()); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Gets the plugin directory URL. |
| 62 |
* |
| 63 |
* @return string |
| 64 |
*/ |
| 65 |
public static function url() |
| 66 |
{ |
| 67 |
return plugin_dir_url(self::file()); |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Registers plugin hooks. |
| 72 |
* |
| 73 |
* @return void |
| 74 |
*/ |
| 75 |
public static function register() |
| 76 |
{ |
| 77 |
add_action('init', array('Animated_Blocks_Assets', 'register')); |
| 78 |
add_action('init', array('Animated_Blocks_Block', 'register')); |
| 79 |
add_action('admin_init', array('Animated_Blocks_Settings', 'register')); |
| 80 |
add_action('admin_menu', array('Animated_Blocks_Settings', 'register_page')); |
| 81 |
add_action('enqueue_block_assets', array('Animated_Blocks_Assets', 'enqueue_editor_block_assets')); |
| 82 |
add_action('enqueue_block_editor_assets', array('Animated_Blocks_Assets', 'enqueue_editor_settings')); |
| 83 |
add_filter('register_block_type_args', array('Animated_Blocks_Block', 'add_animation_attributes'), 10, 2); |
| 84 |
add_filter('render_block', array('Animated_Blocks_Block', 'maybe_animate_block'), 10, 2); |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
Animated_Blocks::register(); |
| 89 |
|