# gutenify/0.0.2/gutenify.php

Gutenify – Visual Site Builder Blocks &amp; Starter Templates, version 0.0.2. 156 lines.

- Page: https://pluginprobe.com/plugins/gutenify/0.0.2/code/gutenify.php
- Raw: https://pluginprobe.com/plugins/gutenify/0.0.2/raw/gutenify.php
- Modified: 2020-01-05T17:10:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenify/0.0.2/code/gutenify.php#L10-L20`.

```php
<?php
/**
 * Plugin Name: Gutenify
 * Plugin URI: http://gutenify.com/?page=plugin
 * Description: WordPress plugin with great collection of page building WordPress blocks for the new Gutenberg WordPress block editor.
 * Version: 0.0.2
 * Author: Gutenify
 * Author URI: http://gutenify.com/?page=author
 * Requires at least: 5.3.2
 * Requires PHP: 5.5
 * Tested up to: 5.3.2
 *
 * Text Domain: gutenify
 * Domain Path: /i18n/languages/
 *
 * @package Gutenify
 * @category Core
 * @author Gutenify
 */


// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'Gutenify' ) ) :

	/**
	 * Main Gutenify Class (singleton).
	 *
	 * @since 0.0.1
	 */
	final class Gutenify {

		/**
		 * Gutenify version.
		 *
		 * @var string
		 */
		public $version = '0.0.2';

		/**
		 * The single instance of the class.
		 *
		 * @var Gutenify
		 * @since 0.0.1
		 */
		protected static $_instance = null;

		/**
		 * Main Gutenify Instance.
		 * Ensures only one instance of Gutenify is loaded or can be loaded.
		 *
		 * @static
		 * @see Gutenify()
		 * @return Gutenify - Main instance.
		 */
		public static function instance() {
			if ( is_null( self::$_instance ) ) {
				self::$_instance = new self();
			}
			return self::$_instance;
		}

		/**
		 * Gutenify Constructor.
		 */
		function __construct() {
			$this->define_constants();
			$this->includes();
			$this->init_hooks();
		}

		/**
		 * Define Gutenify Constants.
		 */
		private function define_constants() {
			$this->define( 'GUTENIFY_PLUGIN_FILE', __FILE__ );
			$this->define( 'GUTENIFY_ABSPATH', dirname( __FILE__ ) . '/' );
			$this->define( 'GUTENIFY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
			$this->define( 'GUTENIFY_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
			$this->define( 'GUTENIFY_VERSION', $this->version );
		}

		/**
		 * Hook into actions and filters.
		 *
		 * @since 0.0.1
		 * @return void
		 */
		private function init_hooks() {
			Gutenify_Blocks_Loader::init();
			add_action( 'init', array( $this, 'set_script_translations' ) );
		}

		/**
		 * Include required core files used in admin and on the frontend.
		 *
		 * @return void
		 */
		function includes() {
			include_once('inc/class-helpers.php');
			include_once('inc/class-blocks-loader.php');
        }
        
        /**
         * Define constants.
         */
        public function define( $name, $value ) {
			if ( ! defined( $name ) ) {
				define( $name, $value );
			}
		}

		/**
		 * What type of request is this?
		 *
		 * @param  string $type admin, ajax, cron or frontend.
		 * @return bool
		 */
		private function is_request( $type ) {
			switch ( $type ) {
				case 'admin' :
					return is_admin();
				case 'ajax' :
					return defined( 'DOING_AJAX' );
				case 'cron' :
					return defined( 'DOING_CRON' );
				case 'frontend' :
					return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
			}
		}

		function set_script_translations() {
			wp_set_script_translations( 'gutenify-script', 'gutenify', plugin_dir_path( __FILE__ ) . 'i18n/languages' );
		}
		

	}
endif;
/**
 * Main instance of gutenify.
 *
 * Returns the main instance of Gutenify to prevent the need to use globals.
 *
 * @since  0.0.1
 * @return gutenify
 */
function gutenify() {
	return Gutenify::instance();
}

// Start gutenify.
gutenify();

```
