PluginProbe
MaxButtons – Create buttons / 7.13
MaxButtons – Create buttons v7.13
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 / classes / maxbuttons-admin-helper.php

maxbuttons-admin-helper.php in MaxButtons – Create buttons 7.13, at classes/maxbuttons-admin-helper.php

317 lines 11.8 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 class maxAdmin
8 {
9 protected static $tabs = null;
10
11 public static function init()
12 {
13 add_action('mb-display-logo', array(maxUtils::namespaceit('maxAdmin'),'logo'));
14 add_action('mb-display-title', array(maxUtils::namespaceit("maxAdmin"),'rate_us'), 20);
15 add_action('mb-display-tabs', array(maxUtils::namespaceit('maxAdmin'),'tab_menu'));
16 add_action('mb-display-ads', array(maxUtils::namespaceit('maxAdmin'), 'display_ads'));
17 add_action('mb-display-pagination', array(maxUtils::namespaceit('maxAdmin'), 'display_pagination'), 10, 2);
18 add_action('mb-display-collection-welcome', array(maxUtils::namespaceit('maxAdmin'), 'displayCollectionWelcome'));
19 }
20
21 public static function logo()
22 {
23 $version = self::getAdVersion();
24 $url = self::getCheckoutURL();
25 ?>
26
27 <?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>' ) ?>
28
29 <?php// $twitlink = 'https://twitter.com/intent/user?original_referer=http%3A%2F%2Flocal.max%2Fwp-admin%2Fadmin.php%3Fpage%3Dmaxbuttons&amp;ref_src=twsrc%5Etfw&amp;region=count_link&amp;screen_name=maxfoundry&amp;tw_p=followbutton';
30 ?>
31
32 <?php
33 }
34
35 static function tab_items_init()
36 {
37 self::$tabs = array(
38 "list" => array("name" => __('Buttons', 'maxbuttons'),
39 "link" => "page=maxbuttons-list",
40 "active" => "maxbuttons-list", ),
41 "pro" => array( "name" => __('Upgrade to Pro', 'maxbuttons'),
42 "link" => "page=maxbuttons-pro",
43 "active" => "maxbuttons-pro",
44 ),
45 "settings" => array("name" => __('Settings', 'maxbuttons'),
46 "link" => "page=maxbuttons-settings",
47 "active" => "maxbuttons-settings",
48 "userlevel" => 'manage_options' ),
49 "support" => array("name" => __('Support', 'maxbuttons'),
50 "link" => "page=maxbuttons-support",
51 "active" => "maxbuttons-support",
52 "userlevel" => 'manage_options'
53 )
54 );
55
56 if ( maxInstall::hasAddOn('socialshare'))
57 {
58 unset(self::$tabs['collection']);
59 }
60 }
61
62 public static function tab_menu()
63 {
64 self::tab_items_init();
65 ?>
66 <h2 class="tabs">
67 <span class="spacer"></span>
68 <?php foreach (self::$tabs as $tab => $tabdata) {
69 if (isset($tabdata["userlevel"]) && ! current_user_can($tabdata["userlevel"]))
70 continue;
71
72 $link = admin_url() . "admin.php?" . $tabdata["link"];
73 $name = $tabdata["name"];
74 $active = '';
75 if ($tabdata["active"] == $_GET["page"])
76 $active = "nav-tab-active";
77
78 echo "<a class='nav-tab $active' href='$link'>$name</a>";
79
80 }
81 echo "</h2>";
82 }
83
84 public static function getAdversion()
85 {
86 $version = MAXBUTTONS_VERSION_NUM;
87 $version = str_replace('.','',$version);
88 return $version;
89
90 }
91
92 public static function getCheckoutURL()
93 {
94 return $url = 'https://maxbuttons.com/checkout/?edd_action=add_to_cart&download_id=24035';
95 }
96
97
98 public static function do_review_notice () {
99
100 $current_user_id = get_current_user_id();
101 $version = MAXBUTTONS_VERSION_NUM;
102
103 $review = get_user_meta( $current_user_id, 'maxbuttons_review_notice' , true );
104
105 if ($review == '')
106 {
107 //$created = get_option("MBFREE_CREATED");
108 $show = time() + (7* DAY_IN_SECONDS);
109 update_user_meta($current_user_id, 'maxbuttons_review_notice', $show);
110 return;
111 }
112
113 $display_review = false;
114
115 if ($review == 'off')
116 { return; // no show
117
118 }
119 elseif (is_numeric($review))
120 {
121 $now = time();
122
123 if ($now > $review)
124 {
125 $display_review = true;
126
127 }
128 }
129
130 // load style / script. It's seperated since it should show everywhere in admin.
131 if ($display_review)
132 {
133 add_action( 'admin_notices', array( maxUtils::namespaceit('maxAdmin'), 'mb_review_notice'));
134 // registered in admin scripts
135 MB()->load_library('review_notice');
136 }
137
138 }
139
140 public static function setReviewNoticeStatus()
141 {
142 $status = isset($_POST["status"]) ? sanitize_text_field($_POST["status"]) : '';
143 $current_user_id = get_current_user_id();
144
145 $updated = false;
146
147 if ($status == 'off')
148 {
149 $updated = true;
150 update_user_meta($current_user_id, 'maxbuttons_review_notice', 'off');
151
152 }
153 if ($status == 'later')
154 {
155 $updated = true;
156 $later = time() + (14 * DAY_IN_SECONDS );
157
158 update_user_meta($current_user_id, 'maxbuttons_review_notice', $later);
159 }
160 if ($status == 'reviewoffer-dismiss') // different ad!
161 {
162 $updated = true;
163 update_user_meta($current_user_id, 'maxbuttons_review_offer', 'off');
164
165 }
166
167 echo json_encode(array("updated" => $updated)) ;
168
169 exit();
170 }
171
172 public static function display_ads()
173 {
174 $plugin_url = MB()->get_plugin_url();
175 $ad_url = $plugin_url . '/images/ads/';
176 $version = self::getAdVersion();
177 $url = self::getCheckoutURL();
178 ?>
179
180 <div class="ads image-ad">
181 <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" >
182 <img src="<?php echo $plugin_url ?>/images/max_ad.png" width="300">
183 </a>
184 </div>
185
186 <div class="ads image-ad">
187 <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>
188
189 </div>
190
191 <div class="ads image-ad">
192 <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">
193 <img src="<?php echo $plugin_url ?>/images/mg_ad.png" /></a>
194 </div>
195
196 <?php
197 }
198
199 /** Display Rating Links
200 *
201 * Displays rating links via mb-display-title hook.
202 */
203 public static function rate_us()
204 {
205 $output = '';
206
207 $output .= "<div>";
208 $output .= sprintf("Enjoying MaxButtons? Please %s rate us ! %s",
209 "<a href='https://wordpress.org/support/view/plugin-reviews/maxbuttons#postform'>",
210 "</a>"
211 );
212 $output .= "</div>";
213 echo $output;
214 }
215
216
217 public static function display_pagination($page_args, $location = 'top')
218 {
219
220 $mbadmin = MB()->getClass("admin");
221 $pag = $mbadmin->getButtonPages($page_args);
222 if ($pag["first"] == $pag["last"])
223 { return; }
224
225
226 extract($pag);
227
228 ?>
229 <div class='tablenav <?php echo $location ?>'>
230 <div class="tablenav-pages">
231 <span class="displaying-num"><?php echo $pag["total"] ?> items</span>
232 <span class="pagination-links">
233
234 <?php if (! $first_url): ?>
235 <a class="tablenav-pages-navspan button first-page disabled" href='#'>«</a>
236 <?php else: ?>
237 <a href="<?php echo $first_url ?>" data-page="1" title="<?php _e("Go to the first page","maxbuttons") ?>" class="tablenav-pages-navspan button first-page <?php if (!$first_url) echo "disabled"; ?>">«</a>
238 <?php endif; ?>
239
240 <?php if (! $prev_url): ?>
241 <a class="tablenav-pages-navspan button prev-page disabled" href='#'></a>
242 <?php else : ?>
243 <a href="<?php echo $prev_url ?>" data-page="<?php echo $prev_page ?>" title="<?php _e("Go to the previous page","maxbuttons"); ?>" class="tablenav-pages-navspan button prev-page <?php if (!$prev_url) echo "disabled"; ?>"></a>
244 <?php endif; ?>
245
246 <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 ?>
247 </span></span>
248
249 <?php if (! $next_url): ?>
250 <a class="tablenav-pages-navspan button next-page disabled" href='#'></a>
251 <?php else: ?>
252 <a href="<?php echo $next_url ?>" data-page="<?php echo $next_page ?>" title="<?php _e("Go to the next page","maxbuttons") ?>" class=" tablenav-pages-navspan button next-page <?php if (!$next_url) echo "disabled"; ?>"></a>
253 <?php endif; ?>
254
255 <?php if (! $last_url): ?>
256 <a class="tablenav-pages-navspan button last-page disabled" href='#'>»</a></span>
257 <?php else: ?>
258 <a href="<?php echo $last_url ?>" data-page="<?php echo $last ?>" title="<?php _e("Go to the last page","maxbuttons") ?>" class="tablenav-pages-navspan button last-page <?php if (!$last_url) echo "disabled"; ?>">»</a></span>
259 <?php endif; ?>
260
261 </div> <!-- tablenav-pages -->
262 </div> <!-- tablenav -->
263
264 <?php
265 }
266
267 public static function mb_review_notice() {
268 if( current_user_can( 'manage_options' ) ) { ?>
269 <div class="updated notice maxbuttons-notice">
270 <div class='review-logo'></div>
271 <div class='mb-notice'>
272 <p class='title'><?php _e("Rate us Please!","maxbuttons"); ?></p>
273 <p><?php _e("Your rating is the simplest way to support MaxButtons. We really appreciate it!","maxbuttons"); ?></p>
274
275 <ul class="review-notice-links">
276 <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>
277 <li><span class="dashicons dashicons-calendar-alt"></span><a data-action='later' href="javascript:void(0)"><?php _e("Maybe Later","maxbuttons"); ?></a></li>
278 <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>
279 </ul>
280 </div>
281 <a class="dashicons dashicons-dismiss close-mb-notice" href="javascript:void(0)" data-action='off'></a>
282
283 </div>
284 <?php
285 }
286 }
287
288
289
290 public static function displayCollectionWelcome()
291 {
292 ?>
293 <div class="collection welcome">
294 <h2><?php _e("Welcome to MaxButtons Social Sharing", "maxbuttons"); ?></h2>
295 <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>
296 <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>
297
298 <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>
299
300 <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>
301
302 <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>
303
304 <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>
305
306 <p><?php _e("The Max Foundry Team", "maxbuttons"); ?></p>
307
308 <p><a class="page-title-action " href="<?php echo admin_url() ?>admin.php?page=maxbuttons-collections&action=edit&collection=social">
309 <?php _e("Get Started","maxbuttons"); ?></a></p>
310
311 </div>
312
313 <?php
314 }
315
316 } // class
317