| 1 |
<?php |
| 2 |
|
| 3 |
/* Helper class for uniform elements in admin pages */ |
| 4 |
|
| 5 |
add_action('mb-display-logo', array('maxAdmin','logo')); |
| 6 |
add_action('mb-display-title', array("maxAdmin",'rate_us'), 20); |
| 7 |
add_action('mb-display-tabs', array('maxAdmin','tab_menu')); |
| 8 |
add_action('mb-display-ads', array('maxAdmin', 'display_ads')); |
| 9 |
add_action('mb-display-pagination', array('maxAdmin', 'display_pagination')); |
| 10 |
//add_action('mb-display-reviewoffer', array('maxAdmin', 'display_reviewoffer')); // page telling about discount on review |
| 11 |
|
| 12 |
//add_action('mb-display-review-notice', array('maxAdmin', 'mb_review_notice')); |
| 13 |
|
| 14 |
add_action('mb-display-collection-welcome', array('maxAdmin', 'displayCollectionWelcome')); |
| 15 |
|
| 16 |
|
| 17 |
class maxAdmin |
| 18 |
{ |
| 19 |
protected static $tabs = null; |
| 20 |
|
| 21 |
|
| 22 |
public static function logo() |
| 23 |
{ |
| 24 |
$version = self::getAdVersion(); |
| 25 |
$url = self::getCheckoutURL(); |
| 26 |
?> |
| 27 |
<?php _e('Brought to you by', 'maxbuttons') ?> |
| 28 |
<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> |
| 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&ref_src=twsrc%5Etfw&region=count_link&screen_name=maxfoundry&tw_p=followbutton'; |
| 32 |
?> |
| 33 |
|
| 34 |
<!-- |
| 35 |
<div class="twitter-follow"> |
| 36 |
|
| 37 |
<div class='follow'><a href='<?php echo $twitlink ?>'><i></i> <?php _e("Follow","maxbuttons"); ?></a></div> |
| 38 |
<a class="note" href="<?php echo $twitlink ?>"> |
| 39 |
<u></u><?php printf( __("%dK followers",'maxbuttons'), 10) ?></a></div> --> |
| 40 |
|
| 41 |
<?php |
| 42 |
} |
| 43 |
|
| 44 |
static function tab_items_init() |
| 45 |
{ |
| 46 |
self::$tabs = array( |
| 47 |
"list" => array("name" => __('Buttons', 'maxbuttons'), |
| 48 |
"link" => "page=maxbuttons-controller&action=list", |
| 49 |
"active" => "maxbuttons-controller", ), |
| 50 |
"collection" => array("name" => __('Social Share','maxbuttons'), |
| 51 |
"link" => "page=maxbuttons-collections", |
| 52 |
"active" => "maxbuttons-collections", |
| 53 |
), |
| 54 |
"pro" => array( "name" => __('Upgrade to Pro', 'maxbuttons'), |
| 55 |
"link" => "page=maxbuttons-pro", |
| 56 |
"active" => "maxbuttons-pro", |
| 57 |
), |
| 58 |
"settings" => array("name" => __('Settings', 'maxbuttons'), |
| 59 |
"link" => "page=maxbuttons-settings", |
| 60 |
"active" => "maxbuttons-settings", |
| 61 |
"userlevel" => 'manage_options' ), |
| 62 |
"support" => array("name" => __('Support', 'maxbuttons'), |
| 63 |
"link" => "page=maxbuttons-support", |
| 64 |
"active" => "maxbuttons-support", |
| 65 |
"userlevel" => 'manage_options' |
| 66 |
) |
| 67 |
); |
| 68 |
} |
| 69 |
|
| 70 |
public static function tab_menu() |
| 71 |
{ |
| 72 |
self::tab_items_init(); |
| 73 |
?> |
| 74 |
<h2 class="tabs"> |
| 75 |
<span class="spacer"></span> |
| 76 |
<?php foreach (self::$tabs as $tab => $tabdata) { |
| 77 |
if (isset($tabdata["userlevel"]) && ! current_user_can($tabdata["userlevel"])) |
| 78 |
continue; |
| 79 |
|
| 80 |
$link = admin_url() . "admin.php?" . $tabdata["link"]; |
| 81 |
$name = $tabdata["name"]; |
| 82 |
$active = ''; |
| 83 |
if ($tabdata["active"] == $_GET["page"]) |
| 84 |
$active = "nav-tab-active"; |
| 85 |
|
| 86 |
echo "<a class='nav-tab $active' href='$link'>$name</a>"; |
| 87 |
|
| 88 |
} |
| 89 |
echo "</h2>"; |
| 90 |
} |
| 91 |
|
| 92 |
public static function getAdversion() |
| 93 |
{ |
| 94 |
$version = MAXBUTTONS_VERSION_NUM; |
| 95 |
$version = str_replace('.','',$version); |
| 96 |
return $version; |
| 97 |
|
| 98 |
} |
| 99 |
|
| 100 |
public static function getCheckoutURL() |
| 101 |
{ |
| 102 |
return $url = 'https://maxbuttons.com/checkout/?edd_action=add_to_cart&download_id=24035'; |
| 103 |
} |
| 104 |
|
| 105 |
public static function display_reviewoffer() |
| 106 |
{ |
| 107 |
$current_user_id = get_current_user_id(); |
| 108 |
$display = get_user_meta($current_user_id, 'maxbuttons_review_offer', true); |
| 109 |
|
| 110 |
if ($display == 'off') |
| 111 |
return; |
| 112 |
|
| 113 |
if ($display == '') |
| 114 |
{ |
| 115 |
$created = get_option("MBFREE_CREATED"); |
| 116 |
$display_time = $created + (8 * WEEK_IN_SECONDS ); |
| 117 |
|
| 118 |
if (time() < $display_time) |
| 119 |
return; |
| 120 |
} |
| 121 |
|
| 122 |
add_action( 'admin_notices', array('maxAdmin', 'mb_review_notice')); |
| 123 |
wp_enqueue_style('maxbuttons-review-notice', MB()->get_plugin_url() . 'assets/css/review_notice.css'); |
| 124 |
wp_enqueue_script('maxbuttons-review-notice', MB()->get_plugin_url() . 'js/min/review-notice.js', array('jquery'), true); |
| 125 |
|
| 126 |
$local = array(); |
| 127 |
$local["ajaxurl"] = admin_url( 'admin-ajax.php' ); |
| 128 |
wp_localize_script('maxbuttons-review-notice', 'mb_ajax_review', $local); |
| 129 |
|
| 130 |
} |
| 131 |
|
| 132 |
public static function display_ads() |
| 133 |
{ |
| 134 |
$plugin_url = MB()->get_plugin_url(); |
| 135 |
$ad_url = $plugin_url . '/images/ads/'; |
| 136 |
$version = self::getAdVersion(); |
| 137 |
$url = self::getCheckoutURL(); |
| 138 |
?> |
| 139 |
|
| 140 |
<div class="ads image-ad"> |
| 141 |
<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" > |
| 142 |
<img src="<?php echo $plugin_url ?>/images/max_ad.png" width="300"> |
| 143 |
</a> |
| 144 |
</div> |
| 145 |
|
| 146 |
<div class="ads image-ad"> |
| 147 |
<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> |
| 148 |
|
| 149 |
</div> |
| 150 |
|
| 151 |
<div class="ads image-ad"> |
| 152 |
<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"> |
| 153 |
<img src="<?php echo $plugin_url ?>/images/mg_ad.png" /></a> |
| 154 |
</div> |
| 155 |
|
| 156 |
<!-- <div class="ads"> |
| 157 |
<h3><i class="fa fa-cogs"></i> <?php _e('Font Awesome Support', 'maxbuttons'); ?></h3> |
| 158 |
<p><?php _e('With MaxButtons Pro you have access to all 439 Font Awesome icons, ready to add to your buttons.', 'maxbuttons'); ?></p> |
| 159 |
<p><?php _e('Never upload another icon again, just choose an icon and go about your normal button-making business.', 'maxbuttons'); ?></p> |
| 160 |
<a class="button-primary" href="http://www.maxbuttons.com/pricing/?utm_source=wordpress&utm_medium=mbrepo&utm_content=button-list-sidebar-99&utm_campaign=plugin"><?php _e('Use Font Awesome!', 'maxbuttons'); ?> <i class="fa fa-arrow-circle-right"></i></a> |
| 161 |
</div> --> |
| 162 |
<?php |
| 163 |
} |
| 164 |
|
| 165 |
/** Display Rating Links |
| 166 |
* |
| 167 |
* Displays rating links via mb-display-title hook. |
| 168 |
*/ |
| 169 |
public static function rate_us() |
| 170 |
{ |
| 171 |
$output = ''; |
| 172 |
|
| 173 |
$output .= "<div>"; |
| 174 |
$output .= sprintf("Enjoying MaxButtons? Please %s rate us ! %s", |
| 175 |
"<a href='https://wordpress.org/support/view/plugin-reviews/maxbuttons#postform'>", |
| 176 |
"</a>" |
| 177 |
); |
| 178 |
$output .= "</div>"; |
| 179 |
echo $output; |
| 180 |
} |
| 181 |
|
| 182 |
|
| 183 |
public static function display_pagination($page_args) |
| 184 |
{ |
| 185 |
|
| 186 |
$mbadmin = MB()->getClass("admin"); |
| 187 |
$pag = $mbadmin->getButtonPages($page_args); |
| 188 |
if ($pag["first"] == $pag["last"]) |
| 189 |
{ return; } |
| 190 |
|
| 191 |
|
| 192 |
extract($pag); |
| 193 |
|
| 194 |
?> |
| 195 |
|
| 196 |
<div class="tablenav-pages"><span class="displaying-num"><?php echo $pag["total"] ?> items</span> |
| 197 |
<span class="pagination-links"> |
| 198 |
|
| 199 |
<?php if (! $first_url): ?> |
| 200 |
<a class="first-page disabled" href='#'>«</a> |
| 201 |
<?php else: ?> |
| 202 |
<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> |
| 203 |
<?php endif; ?> |
| 204 |
|
| 205 |
<?php if (! $prev_url): ?> |
| 206 |
<a class="prev-page disabled" href='#'>‹</a> |
| 207 |
<?php else : ?> |
| 208 |
<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> |
| 209 |
<?php endif; ?> |
| 210 |
|
| 211 |
<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 ?> |
| 212 |
</span></span> |
| 213 |
|
| 214 |
<?php if (! $next_url): ?> |
| 215 |
<a class="next-page disabled" href='#'>›</a> |
| 216 |
<?php else: ?> |
| 217 |
<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> |
| 218 |
<?php endif; ?> |
| 219 |
|
| 220 |
<?php if (! $last_url): ?> |
| 221 |
<a class="last-page disabled" href='#'>»</a></span></div> |
| 222 |
<?php else: ?> |
| 223 |
<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> |
| 224 |
<?php endif; ?> |
| 225 |
|
| 226 |
|
| 227 |
<?php |
| 228 |
} |
| 229 |
|
| 230 |
public static function mb_review_notice() { |
| 231 |
if( current_user_can( 'manage_options' ) ) { ?> |
| 232 |
<div class="updated notice maxbuttons-notice"> |
| 233 |
<div class='review-logo'></div> |
| 234 |
<div class='mb-notice'> |
| 235 |
<p class='title'><?php _e("Rate us Please!","maxbuttons"); ?></p> |
| 236 |
<p><?php _e("Your rating is the simplest way to support MaxButtons. We really appreciate it!","maxbuttons"); ?></p> |
| 237 |
|
| 238 |
<ul class="review-notice-links"> |
| 239 |
<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> |
| 240 |
<li><span class="dashicons dashicons-calendar-alt"></span><a data-action='later' href="javascript:void(0)"><?php _e("Maybe Later","maxbuttons"); ?></a></li> |
| 241 |
<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> |
| 242 |
</ul> |
| 243 |
</div> |
| 244 |
<a class="dashicons dashicons-dismiss close-mb-notice" href="javascript:void(0)" data-action='off'></a> |
| 245 |
|
| 246 |
</div> |
| 247 |
<?php |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 251 |
// standard modal :: DEPRECATED! |
| 252 |
static function formResponseModals() |
| 253 |
{ |
| 254 |
return false; |
| 255 |
?> |
| 256 |
<div class='form_modal_wrapper'> |
| 257 |
<a href='#mb-formresponse' rel='leanModal' class='show_response_modal'></a> |
| 258 |
<div id='mb-formresponse' class='max-modal'> |
| 259 |
|
| 260 |
<div class="content-area"> |
| 261 |
<div class="modal_header"> |
| 262 |
<h3 class='title'></h3> |
| 263 |
<div id="modal_close" class="modal_close tb-close-icon"></div> |
| 264 |
</div> |
| 265 |
<p class='content'> </p> |
| 266 |
</div> |
| 267 |
<div class='controls'> |
| 268 |
<div class='ok'> |
| 269 |
<input type="button" name="#" onClick="javascript:document.getElementById('modal_close').click();" class="button-primary" value="<?Php _e("OK", "maxbuttons-pro"); ?>"> |
| 270 |
</div> |
| 271 |
<div class='yesno'> |
| 272 |
<input type='button' class="button-primary yes" name='#' value="<?php _e("Yes","maxbuttons-pro"); ?>"> |
| 273 |
<input type="button" class="button-primary no" name='#' value="<?php _e("No","maxbuttons-pro"); ?>" onClick="javascript:document.getElementById('modal_close').click();"> |
| 274 |
</div> |
| 275 |
</div> |
| 276 |
</div> |
| 277 |
</div> |
| 278 |
<?php |
| 279 |
|
| 280 |
} |
| 281 |
|
| 282 |
public static function displayCollectionWelcome() |
| 283 |
{ |
| 284 |
?> |
| 285 |
<div class="collection welcome"> |
| 286 |
<h2><?php _e("Welcome to MaxButtons Social Sharing", "maxbuttons"); ?></h2> |
| 287 |
<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> |
| 288 |
<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> |
| 289 |
|
| 290 |
<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> |
| 291 |
|
| 292 |
<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> |
| 293 |
|
| 294 |
<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> |
| 295 |
|
| 296 |
<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> |
| 297 |
|
| 298 |
<p><?php _e("The Max Foundry Team", "maxbuttons"); ?></p> |
| 299 |
|
| 300 |
<p><a class="page-title-action " href="<?php echo admin_url() ?>admin.php?page=maxbuttons-collections&action=edit&collection=social"> |
| 301 |
<?php _e("Get Started","maxbuttons"); ?></a></p> |
| 302 |
|
| 303 |
</div> |
| 304 |
|
| 305 |
<?php |
| 306 |
} |
| 307 |
|
| 308 |
} // class |
| 309 |
|