PluginProbe
Social Share Buttons / 1.19
Social Share Buttons v1.19
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 +93 -15 1.01.19 View file →
@@ -2,8 +2,9 @@
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
9 10
@@ -17,40 +18,117 @@
17 18 $admin->header($header);
18 19
19 20
20 21 $collection_ids = collections::getCollections();
22 +$number_of_collections = count($collection_ids);
21 23
24 +$the_collection_id = isset($_GET['social_id']) ? intval($_GET['social_id']) : false;
22 25
23 -if (count($collection_ids) == 0)
24 - $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 +}
33 +?>
25 34
35 +<form class='mb-ajax-form save-on-key' data-action='save-share'>
26 36
27 -?>
28 37
29 -<?php foreach ($collection_ids as $collection_id): ?>
38 +<?php if($number_of_collections > 0) : ?>
39 +<div class='help-side collection_switcher'>
40 + <h3><?php _e('Your Social Groups','mbsocial'); ?></h3>
41 + <?php //
30 42
31 -<?php if ($collection_id > 0): ?>
32 -<div class='mb-message shortcode'>
33 - <?php printf(__('Shortcode for manual use: [maxsocial id="%s"]','mbsocial'), $collection_id); ?>
43 + echo '<div class="item heading"><span>' . __('name', 'mbsocial') . '</span><span>' . __('no buttons', 'mbsocial') . '</span><span>' . __('shortcode', 'mbsocial') . '</span></div>';
44 +
45 + foreach($collection_ids as $id) {
46 + $collection = new collection($id);
47 + $genBlock = $collection->getBlock('generalBlock');
48 + $name = $genBlock->getValue('name');
49 + $nwBlock = $collection->getBlock('networkBlock');
50 +
51 + $networks_number = count($nwBlock->getValue('network_active')); // )
52 +
53 + $name = ( strlen($name) > 0) ? $name : '#' . $id;
54 + $active = ($id == $the_collection_id) ? 'active' : '';
55 +
56 +
57 +
58 + if ( Install::isPRO() )
59 + {
60 + $link = '<a href="' . add_query_arg('social_id', $id) . '"><span>' . $name . '</span>';
61 + $linkend = '</a>';
62 + }
63 + else {
64 + $link = '<span>' . $name . '</span>';
65 + $linkend = '';
66 + }
67 + echo '<div class="item ' . $active . '">';
68 + echo $link;
69 + echo '<span> [' . $networks_number . ' buttons] </span>';
70 + echo '<span> [maxsocial id="' . $id . '"] </span>';
71 + echo $linkend;
72 + echo '</div>';
73 +
74 + }
75 +
76 + if ( Install::isPRO() )
77 + {
78 + $link = '<a href="' . add_query_arg('social_id', 0) . '" title="' . __('Add', 'mbsocial') . '"> <span class="plus">+</span> ' . __('Add', 'mbsocial') . '</a>';
79 + }
80 + else {
81 + $link = '<a><span class="plus">+</span> ' . __('Add', 'mbsocial') . '</a>';
82 + }
83 +
84 + echo '<span class="item new">' . $link . '</span>';
85 +
86 +
87 + if (! Install::isPro() )
88 + { ?>
89 + <div class='forpro overlay'><div><?php echo $admin->getProMessage(); ?></div></div>
90 + <?php } ?>
34 91 </div>
35 92 <?php endif; ?>
36 93
37 -<form class='mb-ajax-form' data-action='save-share'>
94 + <?php if ($the_collection_id > 0):
95 + $collection_id = $the_collection_id;
96 + ?>
97 +
98 + <div class='mb-message shortcode'>
99 + <?php printf(__('Shortcode for manual use: [maxsocial id="%s"]','mbsocial'), $collection_id); ?>
100 + </div>
101 + <?php endif; ?>
102 +
38 103 <input type='hidden' name="collection_id" value="<?php echo $collection_id ?>" />
104 + <input type='hidden' name="form_post" value="true" />
39 105
40 -
41 106 <div class="form-actions ">
42 - <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'maxbuttons') ?></button>
107 + <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'mbsocial') ?></button>
108 + <?php if ($collection_id > 0 && Install::isPro()): ?>
109 + <button type='button' class='button remove maxmodal' data-modal='modal_remove'><?php _e('Delete', 'mbsocial'); ?></button>
110 + <?php endif; ?>
43 111 </div>
44 112
113 +
45 114 <?php include('share_editor.php'); ?>
46 115
47 - <?php //$admin->output_defined_fields(); ?>
48 116
117 + <div class="form-actions">
118 + <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'mbsocial') ?></button>
119 + </div>
49 120
121 + <div id='modal_remove' class='maxmodal-data'>
122 + <div class='title'><?php _e('Delete Social Group', 'mbsocial'); ?></div>
123 + <span class="content"><p><?php _e("You are about to permanently remove this Social Group. Are you sure?", "mbsocial"); ?></p></span>
124 + <div class='controls'>
125 + <button type="button" class='button-primary mb-ajax-action' data-action='remove-collection' data-param='<?php echo $collection_id ?>'>
126 + <?php _e('Yes','mbsocial'); ?></button>
50 127
51 - <div class="form-actions">
52 - <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'maxbuttons') ?></button>
53 - </div>
128 + <a class="modal_close button-primary"><?php _e("No", "mbsocial"); ?></a>
129 +
130 + </div>
131 +
132 + </div> <!-- modal -->
54 133 <?php $admin->footer(); ?>
55 134 </form>
56 -<?php endforeach; ?>