PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.0.6
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.0.6
3.6.0 3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 All 110 releases
buttonizer-multifunctional-button / classes / admin / General.php

General.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder 1.0.6, at classes/admin/General.php

302 lines 16.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 Copyright 2017 Buttonizer
19 */
20 namespace Buttonizer\Admin;
21
22 # No script kiddies
23 defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
24 class General
25 {
26 private $aSavedData = array() ;
27 private $aSubCatagories = array() ;
28 private $aSubPages = array() ;
29 private $aFontAwesome = array() ;
30 private $oIconManager = array() ;
31 private $bHasProFeature = false ;
32 public function __construct( $aFontAwesome, $oIconManager )
33 {
34 $this->aFontAwesome = $aFontAwesome;
35 $this->oIconManager = $oIconManager;
36 $this->loadData();
37 $this->registerStylingSettings();
38 $this->registerAdvancedSettings();
39 $this->registerSocialSettings();
40 $this->registerOther();
41 $this->generatePage();
42 }
43
44 private function loadData()
45 {
46 $this->aSavedData = (array) get_option( 'buttonizer_general_settings' );
47 }
48
49 private function generatePage()
50 {
51 $sTabs = '';
52 $sTabsContent = '';
53 $bFirstTab = true;
54 // Get tabs
55 foreach ( $this->aSubCatagories as $sKey => $sTitle ) {
56 $sTabs .= '<a href="#tab_' . $sKey . '" onclick="javascript:buttonizer.tabNavigate(\'' . $sKey . '\')" id="tab_container_' . $sKey . '" class="nav-tab ' . (( $bFirstTab ? 'first nav-tab-active' : '' )) . '">' . $sTitle . '</a>';
57 $sTabsContent .= '<div id="tab_container_' . $sKey . '" ' . (( !$bFirstTab ? 'style="display: none;"' : '' )) . ' class="tab-container">' . $this->aSubPages[$sKey] . '</div>';
58 $bFirstTab = false;
59 }
60 echo '<table class="vertical-tabs">
61 <tr>
62 <td class="tabs">' . $sTabs . '</td>
63 <td class="tabsholder">' . $sTabsContent . '</td>
64 </tr>
65 </table>' ;
66 }
67
68 /*
69 * Register settings
70 */
71 public function registerStylingSettings()
72 {
73 $this->aSubCatagories['styling'] = 'Styling settings';
74 $this->aSubPages['styling'] = '<table class="form-table"><tbody>';
75 $this->aSubPages['styling'] .= $this->createFormField( 'Right', array( &$this, 'field_position_right' ) );
76 $this->aSubPages['styling'] .= $this->createFormField( 'Bottom', array( &$this, 'field_position_bottom' ) );
77 $this->aSubPages['styling'] .= $this->createFormField( 'Button animation', array( &$this, 'field_button_animation' ) );
78 $this->aSubPages['styling'] .= $this->createFormField( 'Color button unpushed', array( &$this, 'field_button_unpushed' ) );
79 $this->aSubPages['styling'] .= $this->createFormField( 'Color button pushed', array( &$this, 'field_button_pushed' ) );
80 $this->aSubPages['styling'] .= $this->createFormField( 'Icon color', array( &$this, 'field_icon_color' ) );
81 $this->aSubPages['styling'] .= $this->createFormField( 'Main icon<br /><br /><small>Used only when more then one button and there is a menu.</small>', array( &$this, 'field_icon_icon' ) );
82 $this->aSubPages['styling'] .= '</tbody></table>';
83 }
84
85 public function registerAdvancedSettings()
86 {
87 $this->aSubCatagories['advanced'] = 'Advanced settings';
88 $this->aSubPages['advanced'] = '<table class="form-table"><tbody>';
89 $this->aSubPages['advanced'] .= $this->createFormField( '
90 <span class="info-class">
91 <i class="fa fa-info-circle"></i>
92 <span>If you have your Google Analytics tracking code already installed you can ignore this setting. If you want to be sure that your buttons are tracked in your Google Analytics account? Then go to your Google Analytics account > Click on Real Time > Events and open your website in another tab. Click on a Buttonizer button and check if you see that the click gets tracked in Google Analytics. If this doesn\'t happen than go to your google Analytics settings page > Click on tracking code and copy your tracking-ID. It should look like this (UA-00000000-0)
93 </span>
94 </span>
95 Google Analytics', array( &$this, 'field_analytics_code' ) );
96 // Show on scroll
97 $this->aSubPages['advanced'] .= $this->createFormField( '
98 <span class="info-class">
99 <i class="fa fa-info-circle"></i>
100 <span>
101 When selected, the buttons will be shown after the user has scrolled a percentage of the page.
102 </span>
103 </span>
104 Show on scroll?', array( &$this, 'field_show_on_scroll' ) );
105 $this->aSubPages['advanced'] .= $this->createFormField( '
106 <span class="info-class">
107 <i class="fa fa-info-circle"></i>
108 <span>
109 Enter a percentage, starting from 0, up to 100.
110 </span>
111 </span>
112 % from top to show:', array( &$this, 'field_procent_to_scroll' ) );
113 // Show after timeout
114 $this->aSubPages['advanced'] .= $this->createFormField( '
115 <span class="info-class">
116 <i class="fa fa-info-circle"></i>
117 <span>
118 When selected, the buttons will be shown when the user browsers more than the given seconds. So when you say: Show after 20<i>000</i>ms, the button shows after the user browsed on the website for 20 seconds.
119 </span>
120 </span>
121 Show after timeout?', array( &$this, 'field_show_on_timeout' ) );
122 $this->aSubPages['advanced'] .= $this->createFormField( '
123 <span class="info-class">
124 <i class="fa fa-info-circle"></i>
125 <span>
126 Enter the miliseconds from when the buttons must get shown to the user.<br />
127 <br />
128 1 second = 1000 miliseconds<br />
129 10 seconds = 10000 miliseconds<br />
130 1 minute = 60000 miliseconds<br />
131 </span>
132 </span>
133 Milliseconds: ', array( &$this, 'field_time_to_timeout' ) );
134 // Exit intent
135 $this->aSubPages['advanced'] .= $this->createFormField( '
136 <span class="info-class">
137 <i class="fa fa-info-circle"></i>
138 <span>
139 When selected, the buttons will open with a effect when your guest/user tries to escape from your website. The user gets attracted from your buttons.
140 </span>
141 </span>
142 Exit intent', array( &$this, 'field_exit_intent' ) );
143 $this->aSubPages['advanced'] .= $this->createFormField( '
144 <span class="info-class">
145 <i class="fa fa-info-circle"></i>
146 <span>
147 When the exit intent activates, there will be shown some text next to the head-button. You can edit that here.<br />
148 <br />
149 When empty, no message will be shown.
150 </span>
151 </span>
152 Exit intent text', array( &$this, 'field_exit_intent_text' ) );
153 $this->aSubPages['advanced'] .= '</tbody></table>';
154 if ( !ButtonizerLicense()->is_not_paying() && !ButtonizerLicense()->is_plan( 'premium' ) ) {
155 $this->aSubPages['advanced'] .= '<div class="buttonizer-pro-text"><i class="fa fa-lock"></i> You are missing the fun! When upgrading to <a href="admin.php?page=Buttonizer-pricing">Buttonizer Pro</a> you will get these features.</div>';
156 }
157 }
158
159 public function registerSocialSettings()
160 {
161 $this->aSubCatagories['social'] = 'Social share settings';
162 $this->aSubPages['social'] = '<table class="form-table"><tbody>';
163 // Facebook share button
164 $this->aSubPages['social'] .= $this->createFormField( 'Share on Facebook', array( &$this, 'field_share_facebook' ) );
165 // Twitter share button
166 $this->aSubPages['social'] .= $this->createFormField( 'Share on Twitter', array( &$this, 'field_share_twitter' ) );
167 // LinkedIn share button
168 $this->aSubPages['social'] .= $this->createFormField( 'Share on LinkedIn', array( &$this, 'field_share_linkedin' ) );
169 $this->aSubPages['social'] .= '</tbody></table>';
170 }
171
172 public function registerOther()
173 {
174 $this->aSubCatagories['other'] = 'Other';
175 $this->aSubPages['other'] = '<table class="form-table"><tbody>';
176 $this->aSubPages['other'] .= '<tr><th scope="row">Reset Buttonizer</th><td><a href="?page=Buttonizer&tab=buttonizer_page_reset">More info</a></td></tr>';
177 $this->aSubPages['other'] .= '</tbody></table>';
178 }
179
180 private function createFormField( $sLabel, $aFunction )
181 {
182 return '<tr><th scope="row">' . $sLabel . '</th><td>' . $aFunction() . '</td></tr>';
183 }
184
185 /*
186 * Form
187 */
188 public function field_button_unpushed()
189 {
190 $button_unpushed = ( isset( $this->aSavedData['button_unpushed'] ) ? $this->aSavedData['button_unpushed'] : '#48A4DC' );
191 return '<input type="text" name="buttonizer_general_settings[button_unpushed]" value="' . $button_unpushed . '" id="button_unpushed" data-default-color="#fffff" />';
192 }
193
194 public function field_button_pushed()
195 {
196 $button_pushed = ( isset( $this->aSavedData['button_pushed'] ) ? $this->aSavedData['button_pushed'] : '#1D9BDB' );
197 return '<input type="text" name="buttonizer_general_settings[button_pushed]" value="' . $button_pushed . '" id="button_pushed" data-default-color="#fffff" />';
198 }
199
200 public function field_icon_color()
201 {
202 $icon_color = ( isset( $this->aSavedData['icon_color'] ) ? $this->aSavedData['icon_color'] : '#fffff' );
203 return '<input type="text" name="buttonizer_general_settings[icon_color]" value="' . $icon_color . '" id="icon_color" data-default-color="#fffff" />';
204 }
205
206 public function field_icon_icon()
207 {
208 $p = $this->oIconManager->generator( array(
209 'icon' => ( isset( $this->aSavedData['icon_icon'] ) ? $this->aSavedData['icon_icon'] : '' ),
210 'icon_fieldname' => 'buttonizer_general_settings[icon_icon]',
211 'image' => ( isset( $this->aSavedData['custom_icon'] ) ? $this->aSavedData['custom_icon'] : '' ),
212 'image_fieldname' => 'buttonizer_general_settings[custom_icon]',
213 ) );
214 return $p;
215 }
216
217 public function field_position_right()
218 {
219 $position_right = ( isset( $this->aSavedData['position_right'] ) ? $this->aSavedData['position_right'] : '5' );
220 return '<input type="text" name="buttonizer_general_settings[position_right]" value="' . $position_right . '"/><small><i>%</i><br />Recommended 5% then it will position itself on the right corner</small>';
221 }
222
223 public function field_position_bottom()
224 {
225 $position_bottom = ( isset( $this->aSavedData['position_bottom'] ) ? $this->aSavedData['position_bottom'] : '5' );
226 return '<input type="text" name="buttonizer_general_settings[position_bottom]" value="' . $position_bottom . '"/><small><i>%</i><br>Recommended 5% then it will position itself on the bottom corner</small>';
227 }
228
229 public function field_button_animation()
230 {
231 $button_animation = ( isset( $this->aSavedData['buttons_animation'] ) ? $this->aSavedData['buttons_animation'] : 'default' );
232 return '
233 <select name="buttonizer_general_settings[buttons_animation]" style="width: 100%; padding: 0 10px; height: 40px;">
234 <option value="default" ' . (( $button_animation == 'default' ? 'selected' : '' )) . '>Default button animation (fade up)</option>
235 <option value="circle" ' . (( $button_animation == 'circle' ? 'selected' : '' )) . '>Circle animation (arround button, right bottom corner)</option>
236 <option value="fade-left-to-right" ' . (( $button_animation == 'fade-left-to-right' ? 'selected' : '' )) . '>Fade animation left to right</option>
237 </select>';
238 }
239
240 /*
241 * Advanced
242 */
243 public function field_analytics_code()
244 {
245 $google_analytics = ( isset( $this->aSavedData['google_analytics'] ) ? $this->aSavedData['google_analytics'] : '' );
246 return '<input type="text" name="buttonizer_general_settings[google_analytics]" value="' . $google_analytics . '" placeholder="Only when not inserted yet" style="width: 250px;"/>';
247 }
248
249 public function field_show_on_scroll()
250 {
251 return '<input type="checkbox" class="buttonizer-click-to-pro" readonly /> <span class="buttonizer-pro-feature">PRO</span>';
252 }
253
254 public function field_procent_to_scroll()
255 {
256 return '<input type="text" value="0" class="buttonizer-click-to-pro" readonly /><small><i>%</i></small> <span class="buttonizer-pro-feature">PRO</span>';
257 }
258
259 public function field_show_on_timeout()
260 {
261 return '<input type="checkbox" class="buttonizer-click-to-pro" readonly /> <span class="buttonizer-pro-feature">PRO</span>';
262 }
263
264 public function field_time_to_timeout()
265 {
266 return '<input type="text" class="buttonizer-click-to-pro" readonly value="0" /><span class="buttonizer-pro-feature">PRO</span>';
267 }
268
269 // Exit intent
270 public function field_exit_intent()
271 {
272 return '<input type="checkbox" class="buttonizer-click-to-pro" readonly /> <span class="buttonizer-pro-feature">PRO</span>';
273 }
274
275 public function field_exit_intent_text()
276 {
277 return '<input type="text" class="buttonizer-click-to-pro" readonly value="" /><span class="buttonizer-pro-feature">PRO</span>';
278 }
279
280 // Share page
281 public function field_share_facebook()
282 {
283 $share_facebook = ( isset( $this->aSavedData['share_facebook'] ) ? $this->aSavedData['share_facebook'] : '' );
284 $share_facebook_text = ( isset( $this->aSavedData['share_facebook_text'] ) ? $this->aSavedData['share_facebook_text'] : 'Share this on Facebook' );
285 return '<input type="checkbox" name="buttonizer_general_settings[share_facebook]" value="1" ' . (( $share_facebook == '1' ? 'checked="checked"' : '' )) . ' /> <input type="text" name="buttonizer_general_settings[share_facebook_text]" value="' . $share_facebook_text . '" placeholder="Share this on Facebook" style="vertical-align: middle; margin-left: 10px;" />';
286 }
287
288 public function field_share_linkedin()
289 {
290 $share_linkedin = ( isset( $this->aSavedData['share_linkedin'] ) ? $this->aSavedData['share_linkedin'] : '' );
291 $share_linkedin_text = ( isset( $this->aSavedData['share_linkedin_text'] ) ? $this->aSavedData['share_linkedin_text'] : 'Share this on LinkedIn' );
292 return '<input type="checkbox" name="buttonizer_general_settings[share_linkedin]" value="1" ' . (( $share_linkedin == '1' ? 'checked="checked"' : '' )) . ' /> <input type="text" name="buttonizer_general_settings[share_linkedin_text]" value="' . $share_linkedin_text . '" placeholder="Share this on LinkedIn" style="vertical-align: middle; margin-left: 10px;" />';
293 }
294
295 public function field_share_twitter()
296 {
297 $share_twitter = ( isset( $this->aSavedData['share_twitter'] ) ? $this->aSavedData['share_twitter'] : '' );
298 $share_twitter_text = ( isset( $this->aSavedData['share_twitter_text'] ) ? $this->aSavedData['share_twitter_text'] : 'Share this on Twitter' );
299 return '<input type="checkbox" name="buttonizer_general_settings[share_twitter]" value="1" ' . (( $share_twitter == '1' ? 'checked="checked"' : '' )) . ' /> <input type="text" name="buttonizer_general_settings[share_twitter_text]" value="' . $share_twitter_text . '" placeholder="Share this on Twitter" style="vertical-align: middle; margin-left: 10px;" />';
300 }
301
302 }