PluginProbe
Social Share Buttons / 1.30
Social Share Buttons v1.30
trunk 0.9 1.0 1.1 1.1.1 1.1.2 1.10 1.11 1.12 1.15 1.16 1.17 1.18 1.19 1.2 1.20 1.3 1.30 1.4 1.5 1.6 1.7 1.8 1.9
← All changes | admin/page_editor.php +98 -16 0.91.30 View file →
@@ -2,13 +2,16 @@
2 2 namespace MBSocial;
3 3 defined('ABSPATH') or die('No direct access permitted');
4 4
5 5 use MaxButtons\maxButton as maxButton;
6 +use MaxButtons\maxBlocks as maxBlocks;
6 7
7 8 $button = new maxButton(); // this loads the maxblocks template files
8 9
10 +
11 +$title = (Install::isPro()) ? __('Wordpress Share Buttons PRO', 'mbsocial') : __('WordPress Share Buttons','mbsocial');
9 12 $header = array(
10 - 'title' => __('WordPress Share Buttons','mbsocial')
13 + 'title' => $title,
11 14 );
12 15
13 16 $mainclass = 'maxbuttons-social-editor';
14 17 $admin = mbSocial()->admin();
@@ -15,40 +18,119 @@
15 18 $admin->header($header);
16 19
17 20
18 21 $collection_ids = collections::getCollections();
22 +$number_of_collections = count($collection_ids);
19 23
24 +$the_collection_id = isset($_GET['social_id']) ? intval($_GET['social_id']) : false;
20 25
21 -if (count($collection_ids) == 0)
22 - $collection_ids = array(0);
26 +if ($the_collection_id === false && $number_of_collections > 0 )
27 +{
28 + $the_collection_id = $collection_ids[0]; // load the first one
29 +}
30 +else {
31 + $collection_id = 0;
32 +}
23 33
34 +$url = mbSocial()->get_page_url();
35 +?>
24 36
25 -?>
37 +<form class='mb-ajax-form save-on-key' data-action='save-share'>
26 38
27 -<?php foreach ($collection_ids as $collection_id): ?>
28 39
29 -<?php if ($collection_id > 0): ?>
30 -<div class='mb-message shortcode'>
31 - <?php printf(__('Shortcode for manual use: [maxsocial id="%s"]','mbsocial'), $collection_id); ?>
40 +<?php if($number_of_collections > 0) : ?>
41 +<div class='help-side collection_switcher'>
42 + <h3><?php _e('Your Social Groups','mbsocial'); ?></h3>
43 + <?php
44 +
45 + echo '<div class="item heading"><span>' . __('name', 'mbsocial') . '</span><span>' . __('no buttons', 'mbsocial') . '</span><span>' . __('shortcode', 'mbsocial') . '</span></div>';
46 +
47 + foreach($collection_ids as $id) {
48 + $collection = new collection($id);
49 + $genBlock = $collection->getBlock('generalBlock');
50 + $name = $genBlock->getValue('name');
51 + $nwBlock = $collection->getBlock('networkBlock');
52 +
53 + $networks_number = count($nwBlock->getValue('network_active')); // )
54 +
55 + $name = ( strlen($name) > 0) ? $name : '#' . $id;
56 + $active = ($id == $the_collection_id) ? 'active' : '';
57 +
58 +
59 +
60 + if ( Install::isPRO() )
61 + {
62 + $link = '<a href="' . esc_url(add_query_arg('social_id', $id, $url)) . '"><span>' . $name . '</span>';
63 + $linkend = '</a>';
64 + }
65 + else {
66 + $link = '<span>' . $name . '</span>';
67 + $linkend = '';
68 + }
69 + echo '<div class="item ' . $active . '">';
70 + echo $link;
71 + echo '<span> [' . $networks_number . ' buttons] </span>';
72 + echo '<span> [maxsocial id="' . $id . '"] </span>';
73 + echo $linkend;
74 + echo '</div>';
75 +
76 + }
77 +
78 + if ( Install::isPRO() )
79 + {
80 + $link = '<a href="' . esc_url(add_query_arg('social_id', 0, $url)) . '" title="' . __('Add', 'mbsocial') . '"> <span class="plus">+</span> ' . __('Add', 'mbsocial') . '</a>';
81 + }
82 + else {
83 + $link = '<a><span class="plus">+</span> ' . __('Add', 'mbsocial') . '</a>';
84 + }
85 +
86 + echo '<span class="item new">' . $link . '</span>';
87 +
88 +
89 + if (! Install::isPro() )
90 + { ?>
91 + <div class='forpro overlay'><div><?php echo $admin->getProMessage(); ?></div></div>
92 + <?php } ?>
32 93 </div>
33 94 <?php endif; ?>
34 95
35 -<form class='mb-ajax-form' data-action='save-share'>
96 + <?php if ($the_collection_id > 0):
97 + $collection_id = $the_collection_id;
98 + ?>
99 +
100 + <div class='mb-message shortcode'>
101 + <?php printf(__('Shortcode for manual use: [maxsocial id="%s"]','mbsocial'), $collection_id); ?>
102 + </div>
103 + <?php endif; ?>
104 +
36 105 <input type='hidden' name="collection_id" value="<?php echo $collection_id ?>" />
106 + <input type='hidden' name="form_post" value="true" />
37 107
38 -
39 108 <div class="form-actions ">
40 - <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'maxbuttons') ?></button>
109 + <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'mbsocial') ?></button>
110 + <?php if ($collection_id > 0 && Install::isPro()): ?>
111 + <button type='button' class='button remove maxmodal' data-modal='modal_remove'><?php _e('Delete', 'mbsocial'); ?></button>
112 + <?php endif; ?>
41 113 </div>
42 114
115 +
43 116 <?php include('share_editor.php'); ?>
44 117
45 - <?php //$admin->output_defined_fields(); ?>
46 118
119 + <div class="form-actions">
120 + <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'mbsocial') ?></button>
121 + </div>
47 122
123 + <div id='modal_remove' class='maxmodal-data'>
124 + <div class='title'><?php _e('Delete Social Group', 'mbsocial'); ?></div>
125 + <span class="content"><p><?php _e("You are about to permanently remove this Social Group. Are you sure?", "mbsocial"); ?></p></span>
126 + <div class='controls'>
127 + <button type="button" class='button-primary mb-ajax-action' data-action='remove-collection' data-param='<?php echo $collection_id ?>'>
128 + <?php _e('Yes','mbsocial'); ?></button>
48 129
49 - <div class="form-actions">
50 - <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'maxbuttons') ?></button>
51 - </div>
130 + <a class="modal_close button-primary"><?php _e("No", "mbsocial"); ?></a>
131 +
132 + </div>
133 +
134 + </div> <!-- modal -->
52 135 <?php $admin->footer(); ?>
53 136 </form>
54 -<?php endforeach; ?>