PluginProbe
Repeater Fields for Gravity Forms / trunk
Repeater Fields for Gravity Forms vtrunk
3.2.0 3.1.1 3.1.0 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.5.1 2.5.0 2.4.6 trunk 2.0.5 2.0.9 2.1.0 2.3.2 2.3.7 2.4.1 2.4.3 2.4.4 2.4.5
repeater-for-gravity-forms / yeekit / document.php

document.php in Repeater Fields for Gravity Forms trunk, at yeekit/document.php

489 lines 24.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (! defined('ABSPATH')) exit; // Exit if accessed directly
3 global $yeekit_document_addons;
4 if (!class_exists('Yeekit_Document_Addons')) {
5 class Yeekit_Document_Addons
6 {
7 public $data = array();
8 function __construct()
9 {
10 add_action('admin_menu', array($this, "add_menu"), 9999);
11 add_action('admin_enqueue_scripts', array($this, 'add_js'));
12 add_filter("fluentform_global_addons", array($this, "fluentform_global_addons"));
13 add_action('wp_ajax_yeekit_dismiss_noty', array($this, 'dismiss_noty'));
14 add_action('admin_notices', array($this, "add_banner"));
15 add_action('elementor/element/form/section_form_options/after_section_end', array($this, 'elementor_addons'));
16 if (isset($_GET["page"]) && $_GET["page"] == "ninja-forms") {
17 add_action('admin_init', array($this, "add_ninja_form"));
18 }
19 add_action('elementor/editor/after_enqueue_styles', array($this, "after_register_styles"));
20 }
21 function after_register_styles()
22 {
23 $custom_css = "
24 .yeekit_addons_list{
25 background: #fff;
26 padding: 15px 10px;
27 border-radius: 5px;
28 }
29 .yeekit_addons_list li {
30 color: #444444;
31 display: block;
32 font-size: 16px;
33 line-height: 18px;
34 margin: 0;
35 outline: 0;
36 padding: 5px 0;
37 position: relative;
38 text-decoration: none;
39 opacity: 0.8;
40 position: relative;
41 color: #fff;
42 text-align: center;
43 background: #e0e0e0;
44 margin-bottom: 10px;
45 }
46 .yeekit_addons_list li img {
47 magin-top: 5px;
48 border-radius: 5px 5px 0 0;
49 }
50 .yeekit_addons_list li span {
51 color: #444;
52 }
53 .yeekit_addons_list li:hover,.yeekit_addons_list li.active {
54 opacity: 1;
55 }
56 .yeekit_addons_list li .yee-install {
57 background: #ffffff;
58 position: absolute;
59 right: 10px;
60 top: 10px;
61 border: 1px solid #ddd;
62 padding: 5px 10px;
63 border-radius: 3px;
64 text-decoration: none;
65 font-size: 12px;
66 }
67 .yeekit_addons_list li .yee-pro {
68 background: #f18500;
69 color: #fff;
70 position: absolute;
71 left: 10px;
72 top: 10px;
73 border: 1px solid #ddd;
74 padding: 5px 10px;
75 border-radius: 3px;
76 text-decoration: none;
77 font-size: 12px;
78 }
79 ";
80 wp_add_inline_style('elementor-editor', $custom_css);
81 }
82 function elementor_addons($element)
83 {
84 include_once ABSPATH . 'wp-admin/includes/plugin.php';
85 $element->start_controls_section(
86 'section_yeekit_addons',
87 [
88 'label' => __('Forms Add-ons', 'text-domain'),
89 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
90 ]
91 );
92 $datas = $this->get_addons("elementor");
93 $html = '';
94 foreach ($datas as $data) {
95 if (wp_http_validate_url($data["download"])) {
96 $dl = $data["download"];
97 } else {
98 $dl = "https://" . $data["download"];
99 }
100 $install_url = "";
101 if (isset($data["free"]) && $data["free"] != "") {
102 $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $data["free"]), 'install-plugin_' . $data["free"]);;
103 }
104 $class = "";
105 if (isset($data["plugin"]) && $data["plugin"] != "") {
106 if (is_plugin_active($data["plugin"])) {
107 $class = "active";
108 continue;
109 }
110 }
111 $download_html = '<a target="_blank" href="' . $install_url . '" class="yee-install">Install Now – Free</a>';
112 if ($install_url == "") {
113 $download_html = "";
114 }
115 $html .= '<li class="yeekit_addons_list ' . $class . '">
116 <img src="' . esc_url($data["img"]) . '" alt="' . esc_attr($data["name"]) . '" />
117 <span>' . esc_html($data["name"]) . '</span>
118 ' . $download_html . '
119 <a target="_blank" href="' . $dl . '" class="yee-pro">Download</a>
120 </li>';
121 }
122 $html = '<ul class="yeekit_addons_list">' . $html . '</ul>';
123 $element->add_control(
124 'yeekit_addons',
125 [
126 'type' => \Elementor\Controls_Manager::RAW_HTML,
127 'raw' => $html
128 ]
129 );
130 $element->end_controls_section();
131 }
132 function set_document_link($data)
133 {
134 $defaults = array(
135 "plugin" => false,
136 "pro" => "",
137 "notice_id" => "",
138 "document" => "#"
139 );
140 $args = wp_parse_args($data, $defaults);
141 $this->data[$args["plugin"]] = $args;
142 add_filter('plugin_action_links_' . $args["plugin"], array($this, 'add_action_plugin'));
143 }
144 function add_action_plugin($links)
145 {
146 $plugin = current_filter();
147 $plugin = str_replace('plugin_action_links_', '', $plugin);
148 if (isset($this->data[$plugin])) {
149 $item = $this->data[$plugin];
150
151 $mylinks[] = '<a class="color-red" href="' . $item["pro"] . '" target="_blank">Pro Version</a>';
152 $mylinks[] = '<a href="https://add-ons.org/supports/" target="_blank">Support</a>';
153 $mylinks[] = '<a href="' . $item["document"] . '" target="_blank">Document</a>';
154
155 return array_merge($links, $mylinks);
156 }
157 return $links;
158 }
159 function add_banner()
160 {
161 global $pagenow;
162 $admin_pages = array('index.php', 'plugins.php');
163 foreach ($this->data as $data) {
164 $notice_id = $data["notice_id"];
165 $check_notice_id = get_option('_redmuber_item_' . $notice_id);
166 if ($check_notice_id != "ok") {
167 if (in_array($pagenow, $admin_pages)) {
168 $check_disable = "";
169 if ($pagenow == "index.php") {
170 if (get_user_meta(get_current_user_id(), "yeeaddons_dismissed_{$notice_id}", true)) {
171 $check_disable = "yes";
172 }
173 }
174 if ($check_disable == "") {
175 ?>
176 <div class="notice notice-warning is-dismissible yeeaddons-s-dismissible" data-id="<?php echo esc_attr($data["notice_id"]) ?>">
177 <p><strong><?php echo esc_attr($data["plugin_name"]) ?>: </strong><?php esc_html_e('Upgrade to pro version: ', 'yeekit'); ?> <a href="<?php echo esc_url($data["pro"]) ?>" target="_blank"><?php echo esc_url($data["pro"]) ?></a></p>
178 </div>
179 <?php
180 }
181 }
182 }
183 }
184 }
185 function dismiss_noty()
186 {
187 check_ajax_referer('yeekit_addons_nonce', 'nonce');
188 $id = sanitize_text_field($_POST["id"]);
189 update_user_meta(get_current_user_id(), 'yeeaddons_dismissed_' . $id, true);
190 wp_send_json_success();
191 }
192 function add_js()
193 {
194 wp_enqueue_script('yeekit_list_addons', plugins_url('yeekit.js', __FILE__), array("jquery"), "1.0.0");
195 wp_enqueue_style('yeekit_list_addons', plugins_url('yeekit.css', __FILE__), array(), "1.0.0");
196 wp_localize_script('yeekit_list_addons', 'yeekit_list_addons', [
197 'nonce' => wp_create_nonce('yeekit_addons_nonce'),
198 ]);
199 }
200 function add_menu()
201 {
202 add_submenu_page("wpcf7", "contact-form-7 addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "contact-form-7-addons", array($this, 'page_addons_cf7'), 999);
203 add_submenu_page("elementor", "elementor form addons", "<span style='color:#f18500'>Forms Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>15</span></span>", "manage_options", "elementor-forms-addons", array($this, 'page_addons_elementor'), 999);
204 add_submenu_page("fluent_forms", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "fluent_forms-addons", array($this, 'page_addons_fluent_forms'));
205 add_submenu_page("formidable", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "formidable-addons", array($this, 'page_addons_formidable'), 999);
206 add_submenu_page("quform.dashboard", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "quform.dashboard-addons", array($this, 'page_addons_quform'), 999);
207 add_submenu_page("wpforms-overview", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>9</span></span>", "manage_options", "wpforms.dashboard-addons", array($this, 'page_addons_wpforms'), 999);
208 add_filter("http_response", array($this, "http_response_eform"), 10, 3);
209 add_submenu_page("edit.php?post_type=yeemail_template", "addons", "<span style='color:#f18500'>Add-ons </span>", "manage_options", "yeemail-addons", array($this, 'page_yeemail'), 999);
210 }
211 function page_yeemail()
212 {
213 $this->page_addons("yeemail");
214 }
215 function page_addons_cf7()
216 {
217 $this->page_addons("cf7");
218 }
219 function page_addons_elementor()
220 {
221 $this->page_addons("elementor");
222 }
223 function page_addons_fluent_forms()
224 {
225 $this->page_addons("fluent_forms");
226 }
227 function page_addons_formidable()
228 {
229 $this->page_addons("formidable");
230 }
231 function page_addons_quform()
232 {
233 $this->page_addons("quform");
234 }
235 function page_addons_wpforms()
236 {
237 $this->page_addons("wpforms");
238 }
239 function fluentform_global_addons($add_ons_ok)
240 {
241 $datas = $this->get_addons();
242 $add_ons = array();
243 foreach ($datas as $k => $data) {
244 $add_ons[$k] = array(
245 "logo" => $data["img"],
246 "url" => $data["download"],
247 "title" => $data["name"],
248 "description" => $data["des"],
249 "purchase_url" => $data["download"],
250 "category" => "a",
251 );
252 }
253 return array_merge($add_ons, $add_ons_ok);
254 }
255 function add_ninja_form()
256 {
257 $saved = get_option('ninja_forms_addons_feed', false);
258 $datas = $this->get_addons("ninja_forms");
259 $add_ons = array();
260 foreach ($datas as $k => $data) {
261 $add_ons[] = array(
262 "image" => $data["img"],
263 "url" => $data["download"],
264 "title" => $data["name"],
265 "content" => $data["des"],
266 "link" => $data["download"],
267 "plugin" => "a",
268 "version" => "3.0.1",
269 "categories" => array(
270 array(
271 "name" => "Look &amp; Feel",
272 "slug" => "form-function-design"
273 )
274 )
275 );
276 }
277 update_option("ninja_forms_addons_feed", json_encode($add_ons));
278 }
279 function http_response_eform($response, $datas, $url)
280 {
281 $add_ons = array();
282 switch ($url) {
283 case "https://wpquark.com/wp-json/ipt-api/v1/fsqm/":
284 // eforms
285 $datas = $this->get_addons("eforms");
286 foreach ($datas as $data) {
287 $add_ons[] = array(
288 "image" => $data["img"],
289 "url" => $data["download"],
290 "name" => $data["name"],
291 "description" => $data["des"],
292 "author" => "rednumber",
293 "authorurl" => "https://add-ons.org",
294 "class" => "",
295 "star" => 5,
296 "starnum" => rand(10, 100),
297 "downloaded" => rand(100, 1000),
298 "version" => "2." . rand(10, 100),
299 "compatible" => "4.0",
300 "date" => date("Y-m-d h:i:sa")
301 );
302 $datas_rs = json_decode($response['body'], true);
303 $add_on = $datas_rs["addons"];
304 $datas_rs["addons"] = array_merge($add_ons, $add_on);
305 $response["body"] = json_encode($datas_rs);
306 }
307 break;
308 case "https://gravityapi.com/wp-content/plugins/gravitymanager/api.php?op=plugin_browser&page=gf_addons":
309 // gravity form
310 ob_start();
311 ?>
312 <h1><?php esc_html_e("Improve your forms with our premium addons.", "yeekit") ?></h1>
313 <div class="list-addons-container">
314 <?php
315 $datas = $this->get_addons("gravity");
316 foreach ($datas as $data) {
317 ?>
318 <div class="add-ons-box">
319 <img src="<?php echo esc_url($data["img"]) ?>">
320 <h3><?php echo esc_attr($data["name"]) ?></h3>
321 <div class="add-ons-box-content">
322 <p><?php echo esc_attr($data["des"]) ?></p>
323 <div class="add-ons-box-actions">
324 <a href="<?php echo esc_url($data["demo"]) ?>" target="_blank" class="add-ons-box-actions-button-live"><?php esc_html_e("Live Demo", "yeekit") ?></a>
325 <?php
326 if (wp_http_validate_url($data["download"])) {
327 $dl = $data["download"];
328 } else {
329 $dl = "https://" . $data["download"];
330 }
331 ?>
332 <a href="<?php echo esc_url($dl) ?>" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Download", "yeekit") ?></a>
333 </div>
334 </div>
335 </div>
336 <?php } ?>
337 </div>
338 <?php
339 $html = ob_get_clean();
340 $response["body"] = $html . $response["body"];
341 break;
342 case "http://api.ninjaforms.com/feeds/?fetch=addons":
343 $datas = $this->get_addons("ninja_forms");
344 $add_ons = array();
345 foreach ($datas as $k => $data) {
346 $add_ons[] = array(
347 "image" => $data["img"],
348 "url" => $data["download"],
349 "title" => $data["name"],
350 "content" => $data["des"],
351 "link" => $data["download"],
352 "plugin" => "a",
353 "version" => "3.0.1",
354 "categories" => array(
355 array(
356 "name" => "Look &amp; Feel",
357 "slug" => "form-function-design"
358 )
359 )
360 );
361 }
362 $add_on = json_decode($response['body'], true);
363 $response["body"] = json_encode(array_merge($add_ons, $add_on));
364 break;
365 default:
366 // code...
367 break;
368 }
369 return $response;
370 }
371 function page_addons($addon = "")
372 {
373 ?>
374 <div class="wrap">
375 <h2><?php esc_html_e("Improve your forms with our premium addons.", "yeekit") ?></h2>
376 <p></p>
377 <?php
378 switch ($addon) {
379 case "cf7":
380 ?>
381 <div class="cf7-container-bundle">
382 <div class="cf7-container-bundle-h">
383 <p><?php esc_html_e("Having a tough time choosing just a few?", "yeekit") ?></p>
384 <p><?php esc_html_e("Bundle and save big with $59", "yeekit") ?></p>
385 </div>
386 <p><?php esc_html_e("This is a special pack including all add-on for contact form 7 issued by us and every released add-on!", "yeekit") ?></p>
387 <h3><?php esc_html_e("Save up to 90%", "yeekit") ?></h3>
388 <p><?php esc_html_e("In fact, purchasing every item singularly you would spend at least $891. Bundle Price – Only $59", "yeekit") ?></p>
389 <a href="https://add-ons.org/plugin/contact-form-7-add-on-bundle-all-in-one/" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Get Now", "yeekit") ?></a>
390 </div>
391 <?php
392 break;
393 case "wpforms":
394 ?>
395 <div class="cf7-container-bundle">
396 <div class="cf7-container-bundle-h">
397 <p><?php esc_html_e("Having a tough time choosing just a few?", "yeekit") ?></p>
398 <p><?php esc_html_e("Bundle and save big with $49", "yeekit") ?></p>
399 </div>
400 <p>
401 <?php esc_html_e("This is a special pack including all add-on for WPForms issued by us and every released add-on!", "yeekit") ?>
402 </p>
403 <h3><?php esc_html_e("Save up to 80%", "yeekit") ?></h3>
404 <p><?php esc_html_e("In fact, purchasing every item singularly you would spend at least $250. Bundle Price – Only $49", "yeekit") ?></p>
405 <a href="https://add-ons.org/plugin/wpforms-add-on-bundle-all-in-one/" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Get Now", "yeekit") ?></a>
406 </div>
407 <?php
408 break;
409 case "elementor":
410 ?>
411 <div class="cf7-container-bundle">
412 <div class="cf7-container-bundle-h">
413 <p><?php esc_html_e("Having a tough time choosing just a few?", "yeekit") ?></p>
414 <p><?php esc_html_e("Bundle and save big with $49", "yeekit") ?></p>
415 </div>
416 <p>
417 <?php esc_html_e("This is a special pack including all add-on for Elementor Forms issued by us and every released add-on!", "yeekit") ?>
418 </p>
419 <h3><?php esc_html_e("Save up to 85%", "yeekit") ?></h3>
420 <p><?php esc_html_e("In fact, purchasing every item singularly you would spend at least $350. Bundle Price – Only $49", "yeekit") ?></p>
421 <a href="https://add-ons.org/plugin/elementor-forms-add-on-bundle-all-in-one/" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Get Now", "yeekit") ?></a>
422 </div>
423 <?php
424 break;
425 }
426 ?>
427 <div class="list-addons-container">
428 <?php
429 $datas = $this->get_addons($addon);
430 foreach ($datas as $data) {
431 ?>
432 <div class="add-ons-box">
433 <img src="<?php echo esc_attr($data["img"]) ?>">
434 <h3><?php echo esc_attr($data["name"]) ?></h3>
435 <div class="add-ons-box-content">
436 <p><?php echo esc_attr($data["des"]) ?></p>
437 <div class="add-ons-box-actions">
438 <a href="<?php echo esc_url($data["demo"]) ?>" target="_blank" class="add-ons-box-actions-button-live"><?php esc_html_e("Live Demo", "yeekit") ?></a>
439 <?php
440 if (wp_http_validate_url($data["download"])) {
441 $dl = $data["download"];
442 } else {
443 $dl = "https://" . $data["download"];
444 }
445 ?>
446 <a href="<?php echo esc_url($dl) ?>" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Download", "yeekit") ?></a>
447 </div>
448 </div>
449 </div>
450 <?php } ?>
451 </div>
452 <?php
453 }
454 function get_addons($add_on = null)
455 {
456 if (isset($add_on)) {
457 $yeekit_addons = get_transient("yeekit_addons_" . $add_on);
458 if ($yeekit_addons === false) {
459 $rs = wp_remote_get("https://cdn.add-ons.org/plugins.php?type=" . $add_on);
460 $data = $rs['body'];
461 set_transient("yeekit_addons_" . $add_on, $data, 86400);
462 return json_decode($data, true);
463 } else {
464 return json_decode($yeekit_addons, true);
465 }
466 } else {
467 $yeekit_addons = get_transient("yeekit_addons");
468 if ($yeekit_addons === false) {
469 $rs = wp_remote_get("https://cdn.add-ons.org/plugins.php");
470 $data = $rs['body'];
471 set_transient("yeekit_addons", $data, 86400);
472 return json_decode($data, true);
473 } else {
474 return json_decode($yeekit_addons, true);
475 }
476 }
477 }
478 }
479 $yeekit_document_addons = new Yeekit_Document_Addons;
480 }
481 $yeekit_document_addons->set_document_link(
482 array(
483 "plugin" => "repeater-for-gravity-forms/repeater-for-gravity-forms.php",
484 "pro"=>"https://add-ons.org/plugin/gravity-forms-repeater-fields/",
485 "plugin_name"=> "Repeater Field For Gravity Forms",
486 "document"=>"https://add-ons.org/document-gravity-forms-repeater-fields/",
487 "notice_id"=>1540
488 )
489 );