PluginProbe
MaxButtons – Create buttons / 7.10
MaxButtons – Create buttons v7.10
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 7.10, at includes/maxbuttons-admin-helper.php

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