PluginProbe
Gmap Block / 1.0.5
Gmap Block v1.0.5
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4
gmap-block / gmap-block.php

gmap-block.php in Gmap Block 1.0.5, at gmap-block.php

135 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Gmap Block
4 * Description: A custom Gutenberg block to display google map in Gutenberg editor.
5 * Author: Zakaria Binsaifullah
6 * Version: 1.0.5
7 * Text Domain: gmap-block
8 * Domain Path: /languages
9 * License: GPLv2 or later
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11 *
12 * @package GmapBlock
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // Exit if accessed directly.
17 }
18
19 if ( ! class_exists( 'Gmap_Block ' ) ) {
20
21 /**
22 * Gmap Blocks Final Class
23 *
24 * @since 1.0.0
25 * @package GmapBlock
26 */
27 final class GmapBlock {
28
29 // Plugin Version
30 const VERSION = '1.0.5';
31
32 /**
33 * Gmap Blocks Instance
34 *
35 * @since 1.0.0
36 */
37 private static $instance;
38
39 /**
40 * Gmap Blocks Constructor
41 *
42 * @since 1.0.0
43 * @return void
44 */
45 private function __construct() {
46 $this->constants();
47 $this->init();
48 $this->includes();
49 }
50
51 /**
52 * Gmap Blocks Define Constants
53 *
54 * @since 1.0.0
55 * @return void
56 */
57 public function constants() {
58 $this->define_constant( 'GMAP_VERSION', self::VERSION );
59 $this->define_constant( 'GMAP__FILE__', __FILE__ );
60 $this->define_constant( 'GMAP_URL_FILE', plugin_dir_url( __FILE__ ) );
61 $this->define_constant( 'GMAP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
62 $this->define_constant( 'GMAP_URL', plugins_url( '/', plugin_dir_path( __FILE__ ) ) );
63 }
64
65 private function define_constant( $name, $value ) {
66 if ( ! defined( $name ) ) {
67 define( $name, $value );
68 }
69 }
70
71 /**
72 * Gmap Blocks Init
73 *
74 * @since 1.0.0
75 * @return void
76 */
77 public function init() {
78 add_action( 'init', array( $this, 'load_textdomain' ) );
79 }
80
81 /**
82 * Gmap Blocks Load Text Domain
83 *
84 * @since 1.0.0
85 * @return void
86 */
87 public function load_textdomain() {
88 load_plugin_textdomain( 'gmap-block', false, basename( GMAP_PLUGIN_DIR ) . '/languages' );
89 }
90
91 /**
92 * Gmap Blocks Instance
93 *
94 * @since 1.0.0
95 * @return GmapBlock
96 */
97 public static function get_instance() {
98 if ( is_null( self::$instance ) ) {
99 self::$instance = new self();
100 }
101
102 return self::$instance;
103 }
104
105 /**
106 * Gmap Blocks Includes Files
107 *
108 * @since 1.0.0
109 * @return void
110 */
111 private function includes() {
112 require_once trailingslashit( GMAP_PLUGIN_DIR ) . 'sdk/sdk.php';
113 require_once trailingslashit( GMAP_PLUGIN_DIR ) . 'inc/gmap-block-loader.php';
114 }
115 }
116
117 }
118
119 /**
120 * Gmap Blocks
121 *
122 * @since 1.0.0
123 * @return GmapBlock
124 */
125 function gmap_blocks() {
126 return GmapBlock::get_instance();
127 }
128
129 /**
130 * Initialize Gmap Blocks
131 *
132 * @since 1.0.0
133 */
134 gmap_blocks(); // Initialize the Gmap Blocks class.
135