PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 5.8.5
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v5.8.5
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
automatorwp / integrations / geodirectory / geodirectory.php

geodirectory.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 5.8.5, at integrations/geodirectory/geodirectory.php

177 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: AutomatorWP - GeoDirectory
5 * Plugin URI: https://automatorwp.com/add-ons/geodirectory/
6 * Description: Connect AutomatorWP with WP Geo Directory.
7 * Version: 1.0.0
8 * Author: AutomatorWP
9 * Author URI: https://automatorwp.com/
10 * Text Domain: automatorwp-geodirectory
11 * Domain Path: /languages/
12 * Requires at least: 4.4
13 * Tested up to: 6.6
14 * License: GNU AGPL v3.0 (http://www.gnu.org/licenses/agpl.txt)
15 *
16 * @package AutomatorWP\GeoDirectory
17 * @author AutomatorWP
18 * @copyright Copyright (c) AutomatorWP
19 */
20
21 final class AutomatorWP_Integration_GeoDirectory
22 {
23
24 /**
25 * @var AutomatorWP_Integration_GeoDirectory $instance The one true AutomatorWP_Integration_GeoDirectory
26 * @since 1.0.0
27 */
28 private static $instance;
29
30 /**
31 * Get active instance
32 *
33 * @access public
34 * @since 1.0.0
35 * @return AutomatorWP_Integration_GeoDirectory self::$instance The one true AutomatorWP_Integration_GeoDirectory
36 */
37 public static function instance()
38 {
39 if( ! self::$instance ) {
40
41 self::$instance = new AutomatorWP_Integration_GeoDirectory();
42
43 if( ! self::$instance->pro_installed() ) {
44
45 self::$instance->constants();
46 self::$instance->includes();
47
48 }
49
50 self::$instance->hooks();
51 }
52
53 return self::$instance;
54 }
55
56 /**
57 * Setup plugin constants
58 *
59 * @access private
60 * @since 1.0.0
61 * @return void
62 */
63 private function constants()
64 {
65 // Plugin version
66 define('AUTOMATORWP_GEODIRECTORY_VER', '1.0.0');
67
68 // Plugin file
69 define('AUTOMATORWP_GEODIRECTORY_FILE', __FILE__);
70
71 // Plugin path
72 define('AUTOMATORWP_GEODIRECTORY_DIR', plugin_dir_path(__FILE__));
73
74 // Plugin URL
75 define('AUTOMATORWP_GEODIRECTORY_URL', plugin_dir_url(__FILE__));
76 }
77
78 /**
79 * Include plugin files
80 *
81 * @access private
82 * @since 1.0.0
83 * @return void
84 */
85 private function includes()
86 {
87
88 if ($this->meets_requirements()) {
89
90 // Triggers
91 require_once AUTOMATORWP_GEODIRECTORY_DIR . 'includes/triggers/anonymous-comment-posted.php';
92 require_once AUTOMATORWP_GEODIRECTORY_DIR . 'includes/triggers/comment-posted.php';
93 require_once AUTOMATORWP_GEODIRECTORY_DIR . 'includes/triggers/place-added.php';
94
95 }
96 }
97
98 /**
99 * Setup plugin hooks
100 *
101 * @access private
102 * @since 1.0.0
103 * @return void
104 */
105 private function hooks()
106 {
107 add_action('automatorwp_init', array($this, 'register_integration'));
108
109 }
110
111 /**
112 * Registers this integration
113 *
114 * @since 1.0.0
115 */
116 function register_integration()
117 {
118
119 automatorwp_register_integration('geodirectory', array(
120 'label' => 'GeoDirectory',
121 'icon' => AUTOMATORWP_GEODIRECTORY_URL . 'assets/geodirectory.svg',
122 ));
123 }
124
125 /**
126 * Check if there are all plugin requirements
127 *
128 * @since 1.0.0
129 *
130 * @return bool True if installation meets all requirements
131 */
132 private function meets_requirements()
133 {
134
135 if (!class_exists('AutomatorWP')) {
136 return false;
137 }
138
139 if (!class_exists('GeoDirectory')) {
140 return false;
141 }
142
143 return true;
144 }
145
146 /**
147 * Check if the pro version of this integration is installed
148 *
149 * @since 1.0.0
150 *
151 * @return bool True if pro version installed
152 */
153 private function pro_installed() {
154
155 if ( ! class_exists( 'AutomatorWP_GeoDirectory' ) ) {
156 return false;
157 }
158
159 return true;
160
161 }
162
163 }
164
165 /**
166 * The main function responsible for returning the one true AutomatorWP_Integration_GeoDirectory instance to functions everywhere
167 *
168 * @since 1.0.0
169 * @return \AutomatorWP_Integration_GeoDirectory The one true AutomatorWP_Integration_GeoDirectory
170 */
171 function AutomatorWP_Integration_GeoDirectory()
172 {
173 return AutomatorWP_Integration_GeoDirectory::instance();
174 }
175
176 add_action('automatorwp_pre_init', 'AutomatorWP_Integration_GeoDirectory');
177