PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 1.2.4
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v1.2.4
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Modules / EditorButtonModule.php

EditorButtonModule.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 1.2.4, at app/Modules/EditorButtonModule.php

62 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace FluentForm\App\Modules;
2
3 use FluentForm\App;
4 use FluentForm\Config;
5 use FluentForm\Request;
6 use FluentForm\View;
7
8 class EditorButtonModule
9 {
10 public function addButton()
11 {
12 $isDisplayButton = $this->pageSupportedMediaButtons();
13 if ( ! $isDisplayButton ) {
14 return;
15 }
16 $this->addMceButtonAssets();
17 echo "<button id='fluent_form_insert_button' class='button'><span style='background-image: url(".App::publicUrl('img/icon_black_small.png')."); width: 16px;height: 16px;background-repeat: no-repeat;display: inline-block;background-size: contain;opacity: 0.4;margin-right: 5px;vertical-align: middle;'></span>".__('Add Form', 'fluentform')."</button>";
18 }
19
20 private function addMceButtonAssets()
21 {
22 wp_enqueue_script(
23 'fluentform_editor_script',
24 fluentformMix('js/fluentform_editor_script.js'),
25 array('jquery')
26 );
27
28 $forms = wpFluent()->table('fluentform_forms')
29 ->select(array('id', 'title'))
30 ->get();
31
32 $forms = array_map(function($item) {
33 return array('value' => $item->id, 'text'=> $item->title);
34 }, $forms);
35
36 wp_localize_script('fluentform_editor_script', 'fluentform_editor_vars', array(
37 'forms' => $forms
38 ));
39 }
40
41 private function pageSupportedMediaButtons()
42 {
43 $currentPage = basename( $_SERVER['PHP_SELF'] );
44 $isEligiblePage = in_array( $currentPage, array(
45 'post.php',
46 'page.php',
47 'page-new.php',
48 'post-new.php',
49 'customize.php',
50 ));
51
52 $displayButton = apply_filters( 'fluentform_display_add_form_button', $isEligiblePage );
53
54 return $displayButton;
55 }
56
57 private function getMenuIcon()
58 {
59 return 'data:image/svg+xml;base64,'.base64_encode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><defs><style>.cls-1{fill:#fff;}</style></defs><title>dashboard_icon</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M15.57,0H4.43A4.43,4.43,0,0,0,0,4.43V15.57A4.43,4.43,0,0,0,4.43,20H15.57A4.43,4.43,0,0,0,20,15.57V4.43A4.43,4.43,0,0,0,15.57,0ZM12.82,14a2.36,2.36,0,0,1-1.66.68H6.5A2.31,2.31,0,0,1,7.18,13a2.36,2.36,0,0,1,1.66-.68l4.66,0A2.34,2.34,0,0,1,12.82,14Zm3.3-3.46a2.36,2.36,0,0,1-1.66.68H3.21a2.25,2.25,0,0,1,.68-1.64,2.36,2.36,0,0,1,1.66-.68H16.79A2.25,2.25,0,0,1,16.12,10.53Zm0-3.73a2.36,2.36,0,0,1-1.66.68H3.21a2.25,2.25,0,0,1,.68-1.64,2.36,2.36,0,0,1,1.66-.68H16.79A2.25,2.25,0,0,1,16.12,6.81Z"/></g></g></svg>');
60 }
61
62 }