| 1 |
<?php |
| 2 |
namespace MaxButtons; |
| 3 |
defined('ABSPATH') or die('No direct access permitted'); |
| 4 |
|
| 5 |
global $page_title; |
| 6 |
$page_title = __("Social Share", "maxbuttons"); |
| 7 |
$admin = MB()->getClass("admin"); |
| 8 |
|
| 9 |
$action = "<a class='page-title-action add-new-h2' href='" . admin_url() . "admin.php?page=maxbuttons-collections&action=edit&collection=social'>" . __('Add New', 'maxbuttons') . "</a>"; |
| 10 |
|
| 11 |
$admin->get_header(array("tabs_active" => true, "title" => $page_title, "title_action" => $action)); |
| 12 |
|
| 13 |
$collections = maxCollections::getCollections(); |
| 14 |
$maxCol = new maxCollection(); |
| 15 |
|
| 16 |
//if (count($collections) == 0) : |
| 17 |
require_once('social-share.php'); |
| 18 |
|
| 19 |
//else: |
| 20 |
|
| 21 |
?> |
| 22 |
<!-- |
| 23 |
<a class="page-title-action collection-addnew" href="<?php echo admin_url() ?>admin.php?page=maxbuttons-collections&action=edit&collection=social"> |
| 24 |
<?php _e("Add New","maxbuttons"); ?></a> --> |
| 25 |
|
| 26 |
<?php //endif; |
| 27 |
?> |
| 28 |
|
| 29 |
<?php |
| 30 |
|
| 31 |
/* Display admin notices |
| 32 |
|
| 33 |
Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format. |
| 34 |
@since 4.20 |
| 35 |
*/ |
| 36 |
do_action('mb/collection/display_notices'); |
| 37 |
?> |
| 38 |
</span> |
| 39 |
|
| 40 |
|
| 41 |
<span class="remove_action_title" style="display:none"><?php _e("Removing this collection","maxbuttons"); ?></span> |
| 42 |
<span class="remove_action_text" style="display:none"><?php _e("Are you sure you want to permanently delete this collection?", "maxbuttons"); ?></span> |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
<div class='collection_list'> |
| 47 |
<?php |
| 48 |
|
| 49 |
|
| 50 |
foreach ($collections as $index => $data) |
| 51 |
{ |
| 52 |
$id = $data["collection_id"]; |
| 53 |
$name = $maxCol->get_meta($id, "collection_name"); |
| 54 |
$name = isset($name['collection_name']) ? $name["collection_name"] : ''; |
| 55 |
|
| 56 |
|
| 57 |
$collection = maxCollections::getCollectionById($id); |
| 58 |
if (! $collection) |
| 59 |
continue; |
| 60 |
|
| 61 |
$collection_type = $collection->getType(); |
| 62 |
$block_nonce = wp_create_nonce('mbpro_collection_block-' . $id); |
| 63 |
|
| 64 |
$button_count = 0; |
| 65 |
$picker = $collection->getBlock("picker"); |
| 66 |
if ($picker) |
| 67 |
{ |
| 68 |
$picker_data = $picker->get(); |
| 69 |
$button_count = count($picker_data["selection"]); |
| 70 |
} |
| 71 |
|
| 72 |
?> |
| 73 |
|
| 74 |
<div class='collection collection-<?php echo $id ?>' data-id="<?php echo $id ?>" data-blocknonce="<?php echo $block_nonce ?>" data-type="<?php echo $collection_type ?>"> |
| 75 |
<div class="collection_remove dashicons dashicons-no"></div> |
| 76 |
|
| 77 |
<h3 class='title'><a href="?page=maxbuttons-collections&action=edit&collection=social&collection_id=<?php echo $id ?>"><?php echo $name; ?></a> |
| 78 |
|
| 79 |
<?php if ($button_count > 0): ?> |
| 80 |
<span class="button-count">(<?php echo $button_count ?> <?php _e("Buttons","maxbuttons"); ?>)</span> |
| 81 |
<?php endif; ?> |
| 82 |
</h3> |
| 83 |
|
| 84 |
<div class="collection-container"> |
| 85 |
<?php |
| 86 |
|
| 87 |
$args = array("preview" => true, |
| 88 |
|
| 89 |
); |
| 90 |
|
| 91 |
$collection->display($args); |
| 92 |
|
| 93 |
?> |
| 94 |
</div> |
| 95 |
<p>[maxcollection id="<?php echo $id ?>"]</p> |
| 96 |
<p><a href="?page=maxbuttons-collections&action=edit&collection=social&collection_id=<?php echo $id ?>"><?php _e("Edit","maxbuttons"); ?></a></p> |
| 97 |
<!-- <p>[ Edit - Delete ] </p> --> |
| 98 |
|
| 99 |
</div> |
| 100 |
<?php |
| 101 |
} |
| 102 |
|
| 103 |
/* |
| 104 |
if (count($collections) == 0) |
| 105 |
{ |
| 106 |
do_action("mb-display-collection-welcome"); |
| 107 |
} */ |
| 108 |
?> |
| 109 |
|
| 110 |
</div> <!-- // collection-list --> |
| 111 |
</div> <!-- // main --> |
| 112 |
<div class="ad-wrap"> |
| 113 |
<?php do_action("mb-display-ads"); ?> |
| 114 |
</div> |
| 115 |
|
| 116 |
<?php |
| 117 |
$admin->get_footer(); |
| 118 |
|