PluginProbe
Repeaterly – ACF Repeater, Flexible Content & Dynamic Tags for Elementor / 2.0.5
Repeaterly – ACF Repeater, Flexible Content & Dynamic Tags for Elementor v2.0.5
2.2.1 trunk 1.0.0 1.0.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.0 2.2.0
repeaterly / repeaterly.php

repeaterly.php in Repeaterly – ACF Repeater, Flexible Content & Dynamic Tags for Elementor 2.0.5, at repeaterly.php

186 lines 4.9 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: Repeaterly
5 * Plugin URI: https://repeaterly.com
6 * Description: Connect ACF repeater, flexible content & relationship fields to Elementor with dynamic tags.
7 * Version: 2.0.5
8 * Author: Techimium
9 * Author URI: https://techimium.com
10 * License: GPLv2 or later
11 * Text Domain: repeaterly
12 * Domain Path: /languages
13 */
14
15 use Repeaterly\Includes\Page_Manager;
16 use Repeaterly\Includes\Tag_Manager;
17 use Repeaterly\Includes\Widget_Manager;
18
19 if (! defined('ABSPATH')) {
20 exit; // Exit if accessed directly.
21 }
22
23 if (!class_exists('Repeaterly')) {
24 class Repeaterly
25 {
26 public static $instance;
27 /**
28 * Plugin version
29 */
30 static function plugin_version()
31 {
32 return '2.0.5';
33 }
34
35 /**
36 * Plugin name
37 */
38 static function plugin_name()
39 {
40 return 'Repeaterly';
41 }
42
43 /**
44 * Plugin file
45 */
46 static function plugin_file()
47 {
48 return __FILE__;
49 }
50
51 /**
52 * Plugin url
53 */
54 static function plugin_url()
55 {
56 return trailingslashit(plugin_dir_url(__FILE__));
57 }
58
59 /**
60 * Plugin dir
61 */
62 static function plugin_dir()
63 {
64 return trailingslashit(plugin_dir_path(__FILE__));
65 }
66
67 /**
68 * Is pro version active?
69 */
70 static function is_pro_activated()
71 {
72 return class_exists('Repeaterly_Pro');
73 }
74
75 /**
76 * Link to the pro version
77 */
78 static function pro_link()
79 {
80 return 'https://repeaterly.com';
81 }
82
83 static function run()
84 {
85 if (!self::$instance) {
86 self::$instance = new static();
87 }
88
89 return self::$instance;
90 }
91
92 /**
93 * Init the plugin
94 */
95 public function init()
96 {
97 require_once self::plugin_dir() . 'autoloader.php';
98
99 if ($this->is_compatible()) {
100 Widget_Manager::init();
101 Tag_Manager::init();
102 }
103
104 Page_Manager::init();
105 }
106
107 function add_premium_link($links)
108 {
109 if (!self::is_pro_activated()) {
110 $links[] = '<a style="color: #FCB214; font-weight: 500;" href="' . self::pro_link() . '" target="_blank">Go Premium</a>';
111 }
112 return $links;
113 }
114
115 function plugin_deactivate()
116 {
117 deactivate_plugins(plugin_basename(__FILE__));
118 }
119
120 public function is_compatible()
121 {
122 if (! did_action('elementor/loaded')) {
123 add_action('admin_notices', [$this, 'admin_notice_missing_main_plugin']);
124 add_action('admin_init', [$this, 'plugin_deactivate']);
125 return false;
126 }
127
128 if (! function_exists('get_field')) {
129 add_action('admin_notices', [$this, 'admin_notice_missing_acf_plugin']);
130 add_action('admin_init', [$this, 'plugin_deactivate']);
131 return false;
132 }
133
134 return true;
135 }
136
137 public function admin_notice_missing_main_plugin(): void
138 {
139 $message = sprintf(
140 /* translators: %1$s: Plugin name (Repeaterly), %2$s: Required plugin name (Elementor). */
141 __('"%1$s" requires "%2$s" to be installed and activated.', 'repeaterly'),
142 '<strong>' . __('Repeaterly', 'repeaterly') . '</strong>',
143 '<strong>' . __('Elementor', 'repeaterly') . '</strong>'
144 );
145
146 $allowed_html = [
147 'strong' => [],
148 ];
149
150 printf(
151 '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>',
152 wp_kses($message, $allowed_html)
153 );
154 }
155
156 public function admin_notice_missing_acf_plugin(): void
157 {
158 $message = sprintf(
159 /* translators: %1$s: Plugin name (Repeaterly), %2$s: Required plugin name (Advanced Custom Fields). */
160 __('"%1$s" requires "%2$s" to be installed and activated.', 'repeaterly'),
161 '<strong>' . __('Repeaterly', 'repeaterly') . '</strong>',
162 '<strong>' . __('Advanced Custom Fields', 'repeaterly') . '</strong>'
163 );
164
165 $allowed_html = [
166 'strong' => [],
167 ];
168
169 printf(
170 '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>',
171 wp_kses($message, $allowed_html)
172 );
173 }
174
175 /**
176 * Run the plugin
177 */
178 public function __construct()
179 {
180 add_action('plugins_loaded', [$this, 'init'], 100);
181 add_filter('plugin_action_links_' . plugin_basename(__FILE__), [$this, 'add_premium_link']);
182 }
183 }
184
185 Repeaterly::run();
186 }