| 1 |
<?php |
| 2 |
/**If this file is called directly, abort.*/ |
| 3 |
if ( ! defined( 'WPINC' ) ) { |
| 4 |
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* |
| 10 |
* @link https://www.gutentor.com/ |
| 11 |
* @since 1.0.0 |
| 12 |
* @package Gutentor |
| 13 |
* |
| 14 |
* @wordpress-plugin |
| 15 |
* Plugin Name: Gutentor - Gutenberg Blocks - Page Builder for Gutenberg Editor |
| 16 |
* Description: Advanced yet easy, Gutenberg editor page builder blocks. Create a masterpiece, pixel perfect websites using modern WordPress Gutenberg blocks. |
| 17 |
* Version: 4.0.6 |
| 18 |
* Author: Gutentor |
| 19 |
* Author URI: https://www.gutentor.com/ |
| 20 |
* License: GPL-2.0+ |
| 21 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 22 |
* Text Domain: gutentor |
| 23 |
* Requires PHP: 7.4 |
| 24 |
*/ |
| 25 |
|
| 26 |
/*Define Constants for this plugin*/ |
| 27 |
define( 'GUTENTOR_VERSION', '4.0.6' ); |
| 28 |
define( 'GUTENTOR_PLUGIN_NAME', 'gutentor' ); |
| 29 |
define( 'GUTENTOR_PATH', plugin_dir_path( __FILE__ ) ); |
| 30 |
define( 'GUTENTOR_URL', plugin_dir_url( __FILE__ ) ); |
| 31 |
define( 'GUTENTOR_SCRIPT_PREFIX', ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' ); |
| 32 |
$GLOBALS['GUTENTOR_GLOBAL'] = array(); |
| 33 |
|
| 34 |
/** |
| 35 |
* The code that runs during plugin activation. |
| 36 |
* This action is documented in includes/class-gutentor-activator.php |
| 37 |
*/ |
| 38 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Required by register_activation_hook. |
| 39 |
function activate_gutentor() { |
| 40 |
require_once GUTENTOR_PATH . 'includes/activator.php'; |
| 41 |
Gutentor_Activator::activate(); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* The core plugin class that is used to define internationalization, |
| 46 |
* admin-specific hooks, and public-facing site hooks. |
| 47 |
*/ |
| 48 |
require GUTENTOR_PATH . 'includes/init.php'; |
| 49 |
|
| 50 |
/** |
| 51 |
* The code that runs during plugin deactivation. |
| 52 |
* This action is documented in includes/class-gutentor-deactivator.php |
| 53 |
*/ |
| 54 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Required by register_deactivation_hook. |
| 55 |
function deactivate_gutentor() { |
| 56 |
require_once GUTENTOR_PATH . 'includes/deactivator.php'; |
| 57 |
Gutentor_Deactivator::deactivate(); |
| 58 |
} |
| 59 |
|
| 60 |
register_activation_hook( __FILE__, 'activate_gutentor' ); |
| 61 |
register_deactivation_hook( __FILE__, 'deactivate_gutentor' ); |
| 62 |
|
| 63 |
// comment on post added. |
| 64 |
function gutentor_count_comments( $object ) { |
| 65 |
$comments_count = wp_count_comments( $object['id'] ); |
| 66 |
return $comments_count->total_comments; |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Create API fields for additional info |
| 71 |
* |
| 72 |
* @since 1.0.9 |
| 73 |
*/ |
| 74 |
function gutentor_register_rest_fields() { |
| 75 |
// Add comment info. |
| 76 |
register_rest_field( |
| 77 |
'post', |
| 78 |
'gutentor_comment', |
| 79 |
array( |
| 80 |
'get_callback' => 'gutentor_count_comments', |
| 81 |
'update_callback' => null, |
| 82 |
'schema' => null, |
| 83 |
) |
| 84 |
); |
| 85 |
} |
| 86 |
add_action( 'rest_api_init', 'gutentor_register_rest_fields' ); |
| 87 |
|
| 88 |
/** |
| 89 |
* Begins execution of the plugin. |
| 90 |
* |
| 91 |
* Since everything within the plugin is registered via hooks, |
| 92 |
* then kicking off the plugin from this point in the file does |
| 93 |
* not affect the page life cycle. |
| 94 |
* |
| 95 |
* @since 1.0.0 |
| 96 |
*/ |
| 97 |
if ( ! function_exists( 'run_gutentor' ) ) { |
| 98 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy bootstrap function, renaming would break compatibility. |
| 99 |
function run_gutentor() { |
| 100 |
|
| 101 |
return Gutentor::instance(); |
| 102 |
} |
| 103 |
run_gutentor()->run(); |
| 104 |
} |
| 105 |
|