PluginProbe
MaxButtons – Create buttons / 6.28
MaxButtons – Create buttons v6.28
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / includes / maxbuttons-admin-helper.php

maxbuttons-admin-helper.php in MaxButtons – Create buttons 6.28, at includes/maxbuttons-admin-helper.php

305 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MaxButtons;
3 defined('ABSPATH') or die('No direct access permitted');
4
5 /* Helper class for uniform elements in admin pages */
6
7 add_action('mb-display-logo', array(maxUtils::namespaceit('maxAdmin'),'logo'));
8 add_action('mb-display-title', array(maxUtils::namespaceit("maxAdmin"),'rate_us'), 20);
9 add_action('mb-display-tabs', array(maxUtils::namespaceit('maxAdmin'),'tab_menu'));
10 add_action('mb-display-ads', array(maxUtils::namespaceit('maxAdmin'), 'display_ads'));
11 add_action('mb-display-pagination', array(maxUtils::namespaceit('maxAdmin'), 'display_pagination'));
12
13 add_action('mb-display-collection-welcome', array(maxUtils::namespaceit('maxAdmin'), 'displayCollectionWelcome'));
14
15
16 class maxAdmin
17 {
18 protected static $tabs = null;
19
20
21 public static function logo()
22 {
23 $version = self::getAdVersion();
24 $url = self::getCheckoutURL();
25
26
27 ?>
28 <?php _e('Brought to you by', 'maxbuttons') ?>
29 <a href="http://maxfoundry.com/products/?ref=mbfree" target="_blank"><img src="<?php echo MB()->get_plugin_url() ?>images/max-foundry.png" alt="Max Foundry" title="Max Foundry" /></a>
30 <?php printf(__('Upgrade to MaxButtons Pro today! %sClick Here%s', 'maxbuttons'), '<a class="simple-btn" href="' . $url . '&utm_source=mbf-dash' . $version . '&utm_medium=mbf-plugin&utm_content=click-here&utm_campaign=cart' . $version . '" target="_blank">', '</a>' ) ?>
31
32 <?php $twitlink = 'https://twitter.com/intent/user?original_referer=http%3A%2F%2Flocal.max%2Fwp-admin%2Fadmin.php%3Fpage%3Dmaxbuttons-controller&amp;ref_src=twsrc%5Etfw&amp;region=count_link&amp;screen_name=maxfoundry&amp;tw_p=followbutton';
33 ?>
34 <?php
35 return; ?>
36 <!--
37 <div class="twitter-follow">
38
39 <div class='follow'><a href='<?php echo $twitlink ?>'><i></i> <?php _e("Follow","maxbuttons"); ?></a></div>
40 <a class="note" href="<?php echo $twitlink ?>">
41 <u></u><?php printf( __("%dK followers",'maxbuttons'), 10) ?></a></div> -->
42
43 <?php
44 }
45
46 static function tab_items_init()
47 {
48 self::$tabs = array(
49 "list" => array("name" => __('Buttons', 'maxbuttons'),
50 "link" => "page=maxbuttons-controller&action=list",
51 "active" => "maxbuttons-controller", ),
52 "collection" => array("name" => __('Social Share','maxbuttons'),
53 "link" => "page=maxbuttons-collections",
54 "active" => "maxbuttons-collections",
55 ),
56 "pro" => array( "name" => __('Upgrade to Pro', 'maxbuttons'),
57 "link" => "page=maxbuttons-pro",
58 "active" => "maxbuttons-pro",
59 ),
60 "settings" => array("name" => __('Settings', 'maxbuttons'),
61 "link" => "page=maxbuttons-settings",
62 "active" => "maxbuttons-settings",
63 "userlevel" => 'manage_options' ),
64 "support" => array("name" => __('Support', 'maxbuttons'),
65 "link" => "page=maxbuttons-support",
66 "active" => "maxbuttons-support",
67 "userlevel" => 'manage_options'
68 )
69 );
70 }
71
72 public static function tab_menu()
73 {
74 self::tab_items_init();
75 ?>
76 <h2 class="tabs">
77 <span class="spacer"></span>
78 <?php foreach (self::$tabs as $tab => $tabdata) {
79 if (isset($tabdata["userlevel"]) && ! current_user_can($tabdata["userlevel"]))
80 continue;
81
82 $link = admin_url() . "admin.php?" . $tabdata["link"];
83 $name = $tabdata["name"];
84 $active = '';
85 if ($tabdata["active"] == $_GET["page"])
86 $active = "nav-tab-active";
87
88 echo "<a class='nav-tab $active' href='$link'>$name</a>";
89
90 }
91 echo "</h2>";
92 }
93
94 public static function getAdversion()
95 {
96 $version = MAXBUTTONS_VERSION_NUM;
97 $version = str_replace('.','',$version);
98 return $version;
99
100 }
101
102 public static function getCheckoutURL()
103 {
104 return $url = 'https://maxbuttons.com/checkout/?edd_action=add_to_cart&download_id=24035';
105 }
106
107 public static function display_reviewoffer()
108 {
109 $current_user_id = get_current_user_id();
110 $display = get_user_meta($current_user_id, 'maxbuttons_review_offer', true);
111
112 if ($display == 'off')
113 return;
114
115 if ($display == '')
116 {
117 $created = get_option("MBFREE_CREATED");
118 $display_time = $created + (8 * WEEK_IN_SECONDS );
119
120 if (time() < $display_time)
121 return;
122 }
123
124 add_action( 'admin_notices', array('maxAdmin', 'mb_review_notice'));
125 wp_enqueue_style('maxbuttons-review-notice', MB()->get_plugin_url() . 'assets/css/review_notice.css');
126 wp_enqueue_script('maxbuttons-review-notice', MB()->get_plugin_url() . 'js/min/review-notice.js', array('jquery'), true);
127
128 $local = array();
129 $local["ajaxurl"] = admin_url( 'admin-ajax.php' );
130 wp_localize_script('maxbuttons-review-notice', 'mb_ajax_review', $local);
131
132 }
133
134 public static function display_ads()
135 {
136 $plugin_url = MB()->get_plugin_url();
137 $ad_url = $plugin_url . '/images/ads/';
138 $version = self::getAdVersion();
139 $url = self::getCheckoutURL();
140 ?>
141
142 <div class="ads image-ad">
143 <a href="<?php echo $url ?>&utm_source=mbf-dash<?php echo $version ?>&utm_medium=mbf-plugin&utm_content=MBF-sidebar&utm_campaign=cart<?php echo $version ?>" target="_blank" >
144 <img src="<?php echo $plugin_url ?>/images/max_ad.png" width="300">
145 </a>
146 </div>
147
148 <div class="ads image-ad">
149 <a href="http://www.maxbuttons.com/pricing/?utm_source=mbf-dash<?php echo $version ?>&utm_medium=mbf-plugin&utm_content=EBWG-sidebar-22&utm_campaign=inthecart<?php echo $version ?>" target="_blank"><img src="<?php echo $plugin_url ?>/images/ebwg_ad.png" /></a>
150
151 </div>
152
153 <div class="ads image-ad">
154 <a href="https://wordpress.org/plugins/maxgalleria/?utm_source=mbf-dash<?php echo $version ?>&utm_medium=mbf_plugin&utm_content=MG_sidebar&utm_campaign=MG_promote" target="_blank">
155 <img src="<?php echo $plugin_url ?>/images/mg_ad.png" /></a>
156 </div>
157
158 <?php
159 }
160
161 /** Display Rating Links
162 *
163 * Displays rating links via mb-display-title hook.
164 */
165 public static function rate_us()
166 {
167 $output = '';
168
169 $output .= "<div>";
170 $output .= sprintf("Enjoying MaxButtons? Please %s rate us ! %s",
171 "<a href='https://wordpress.org/support/view/plugin-reviews/maxbuttons#postform'>",
172 "</a>"
173 );
174 $output .= "</div>";
175 echo $output;
176 }
177
178
179 public static function display_pagination($page_args)
180 {
181
182 $mbadmin = MB()->getClass("admin");
183 $pag = $mbadmin->getButtonPages($page_args);
184 if ($pag["first"] == $pag["last"])
185 { return; }
186
187
188 extract($pag);
189
190 ?>
191
192 <div class="tablenav-pages"><span class="displaying-num"><?php echo $pag["total"] ?> items</span>
193 <span class="pagination-links">
194
195 <?php if (! $first_url): ?>
196 <a class="first-page disabled" href='#'>«</a>
197 <?php else: ?>
198 <a href="<?php echo $first_url ?>" data-page="1" title="<?php _e("Go to the first page","maxbuttons") ?>" class="first-page <?php if (!$first_url) echo "disabled"; ?>">«</a>
199 <?php endif; ?>
200
201 <?php if (! $prev_url): ?>
202 <a class="prev-page disabled" href='#'></a>
203 <?php else : ?>
204 <a href="<?php echo $prev_url ?>" data-page="<?php echo $prev_page ?>" title="<?php _e("Go to the previous page","maxbuttons"); ?>" class="prev-page <?php if (!$prev_url) echo "disabled"; ?>"></a>
205 <?php endif; ?>
206
207 <span class="paging-input"><input data-url="<?php echo $base ?>" class='input-paging' min="1" max="<?php echo $last ?>" type="number" name='paging-number' size="1" value="<?php echo $current ?>"> <?php _e("of","maxbuttons") ?> <span class="total-pages"><?php echo $last ?>
208 </span></span>
209
210 <?php if (! $next_url): ?>
211 <a class="next-page disabled" href='#'></a>
212 <?php else: ?>
213 <a href="<?php echo $next_url ?>" data-page="<?php echo $next_page ?>" title="<?php _e("Go to the next page","maxbuttons") ?>" class="next-page <?php if (!$next_url) echo "disabled"; ?>"></a>
214 <?php endif; ?>
215
216 <?php if (! $last_url): ?>
217 <a class="last-page disabled" href='#'>»</a></span></div>
218 <?php else: ?>
219 <a href="<?php echo $last_url ?>" data-page="<?php echo $last ?>" title="<?php _e("Go to the last page","maxbuttons") ?>" class="last-page <?php if (!$last_url) echo "disabled"; ?>">»</a></span></div>
220 <?php endif; ?>
221
222
223 <?php
224 }
225
226 public static function mb_review_notice() {
227 if( current_user_can( 'manage_options' ) ) { ?>
228 <div class="updated notice maxbuttons-notice">
229 <div class='review-logo'></div>
230 <div class='mb-notice'>
231 <p class='title'><?php _e("Rate us Please!","maxbuttons"); ?></p>
232 <p><?php _e("Your rating is the simplest way to support MaxButtons. We really appreciate it!","maxbuttons"); ?></p>
233
234 <ul class="review-notice-links">
235 <li> <span class="dashicons dashicons-smiley"></span><a data-action='off' href="javascript:void(0)"><?php _e("I've already left a review","maxbuttons"); ?></a></li>
236 <li><span class="dashicons dashicons-calendar-alt"></span><a data-action='later' href="javascript:void(0)"><?php _e("Maybe Later","maxbuttons"); ?></a></li>
237 <li><span class="dashicons dashicons-external"></span><a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/maxbuttons?filter=5#postform"><?php _e("Sure! I'd love to!","maxbuttons"); ?></a></li>
238 </ul>
239 </div>
240 <a class="dashicons dashicons-dismiss close-mb-notice" href="javascript:void(0)" data-action='off'></a>
241
242 </div>
243 <?php
244 }
245 }
246
247 // standard modal :: DEPRECATED!
248 static function formResponseModals()
249 {
250 return false;
251 ?>
252 <div class='form_modal_wrapper'>
253 <a href='#mb-formresponse' rel='leanModal' class='show_response_modal'></a>
254 <div id='mb-formresponse' class='max-modal'>
255
256 <div class="content-area">
257 <div class="modal_header">
258 <h3 class='title'></h3>
259 <div id="modal_close" class="modal_close tb-close-icon"></div>
260 </div>
261 <p class='content'>&nbsp;</p>
262 </div>
263 <div class='controls'>
264 <div class='ok'>
265 <input type="button" name="#" onClick="javascript:document.getElementById('modal_close').click();" class="button-primary" value="<?Php _e("OK", "maxbuttons-pro"); ?>">
266 </div>
267 <div class='yesno'>
268 <input type='button' class="button-primary yes" name='#' value="<?php _e("Yes","maxbuttons-pro"); ?>">
269 <input type="button" class="button-primary no" name='#' value="<?php _e("No","maxbuttons-pro"); ?>" onClick="javascript:document.getElementById('modal_close').click();">
270 </div>
271 </div>
272 </div>
273 </div>
274 <?php
275
276 }
277
278 public static function displayCollectionWelcome()
279 {
280 ?>
281 <div class="collection welcome">
282 <h2><?php _e("Welcome to MaxButtons Social Sharing", "maxbuttons"); ?></h2>
283 <p><?php _e("Social Sharing sets are collections of buttons that are primarily used to promote your social media profiles on your site.","maxbuttons"); ?></p>
284 <p><?php _e("MaxButtons comes with 5 terrific free sets of Social Sharing buttons for you to use: Notched Box Social Share, Modern Social Share, Round White Social Share, Social Share Squares, Minimalistic Share Buttons. You can also add any other button you have made to a collection of Social Sharing buttons.","maxbuttons"); ?></p>
285
286 <p><?php _e("After clicking the Get Started link below you’ll come to the ‘Select your buttons’ page. Here you will see the listing of free Social Sharing sets plus all of the buttons that you have on your site can be used in the collection that you are putting together.","maxbuttons"); ?></p>
287
288 <p><?php _e("You build your Social Sharing set by selecting the buttons you want in your collection. Then click the Add selected buttons button in the lower right. Aside from being included in your collection your selected buttons are now included with all of the other buttons on your site. You can edit those buttons by going to the Buttons section in the Nav bar on the left.","maxbuttons"); ?></p>
289
290 <p><?php printf(__("By upgrading to %sMaxButtons Pro%s you get an 13 additional Social Sharing button sets along with the ability to build your own Social Sharing sets using your own icons, using Google Fonts in your Social Sharing buttons along with all of the features that come with our premium product.","maxbuttons"), "<a href='https://www.maxbuttons.com' target='_blank'>", "</a>"); ?></p>
291
292 <p><strong><?php _e("Click Get Started and we will have your social media icons up and running on your site super quick!","maxbuttons"); ?></strong></p>
293
294 <p><?php _e("The Max Foundry Team", "maxbuttons"); ?></p>
295
296 <p><a class="page-title-action " href="<?php echo admin_url() ?>admin.php?page=maxbuttons-collections&action=edit&collection=social">
297 <?php _e("Get Started","maxbuttons"); ?></a></p>
298
299 </div>
300
301 <?php
302 }
303
304 } // class
305