PluginProbe
MaxButtons – Create buttons / 6.25
MaxButtons – Create buttons v6.25
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-collection-edit.php

maxbuttons-collection-edit.php in MaxButtons – Create buttons 6.25, at includes/maxbuttons-collection-edit.php

98 lines 2.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 global $page_title;
6
7 $collections = MB()->getClass("collections");
8
9 $collection_type = (isset($_REQUEST["collection"])) ? sanitize_text_field($_REQUEST["collection"]) : 'basic';
10 $collection = $collections::getCollection($collection_type);
11
12
13 // handle submits
14 if ($_POST) {
15
16 $collection_id = intval($_POST["collection_id"]);
17 $collection->set($collection_id);
18
19 // this can be a new id (!)
20 $collection_id = $collection->save($_POST);
21 }
22 else
23 {
24 $collection_id = isset($_REQUEST["collection_id"]) ? intval($_REQUEST["collection_id"]) : 0;
25 }
26
27 $nonce = wp_create_nonce('collection-edit-' . $collection_id);
28 $block_nonce = wp_create_nonce('mbpro_collection_block-' . $collection_id);
29
30
31 $collection->set($collection_id);
32 $basic = $collection->getBlock("basic")->get();
33 $collection_name = $basic["name"];
34
35 $tab = isset($_REQUEST["tab"]) ? sanitize_text_field($_REQUEST["tab"]) : '';
36
37 $page_title = __("Edit Social Share", "maxbuttons");
38 $admin = MB()->getClass("admin");
39
40 $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>";
41
42 $admin->get_header(array("tabs_active" => true, "title" => $page_title, "title_action" => $action));
43
44
45 $button = MB()->getClass("button");
46
47 ?>
48 <?php if ($collection_id > 0): ?>
49 <div class="mb-message shortcode">
50 <?php $button_name = $button->getName(); ?>
51 <?php _e('To use this collection, place the following shortcode anywhere in your site content:', 'maxbuttons') ?>
52 <strong>[maxcollection id="<?php echo $collection_id ?>"]</strong> <i><?php _e("or","maxbuttons"); ?></i> <strong>[maxcollection name="<?php echo $collection_name ?>"]</strong>
53
54
55 </div>
56 <?php endif; ?>
57
58 <?php
59 /* Display admin notices [deprecated]
60 @ignore
61 */
62 do_action("mb_display_notices");
63
64 /* Display admin notices
65
66 Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format. Use @see add_notice to add
67 notices.
68
69 @since 4.20
70 */
71 do_action('mb/collection/display_notices');
72 ?>
73
74
75 <form method="post" id='collection_edit' class="mb_ajax_save">
76
77
78 <?php $collection->showBlocks(); ?>
79
80
81 <?php $collection->display_field_map(); ?>
82 <input type="hidden" name="action" value="collection-edit">
83 <input type="hidden" name="collection_id" value="<?php echo $collection_id ?>">
84 <input type="hidden" name="nonce" value="<?php echo $nonce ?>">
85 <input type="hidden" name="block_nonce" value="<?php echo $block_nonce ?>">
86 <input type="hidden" name="tab" value="<?php echo $tab ?>" />
87 <input type="hidden" name="collection_type" value="<?php echo $collection_type ?>" >
88
89 <div class="form-actions">
90 <input type="submit" data-form='collection_edit' name="submit" value="<?php _e('Save All', 'maxbuttons') ?>" class="button-primary ">
91 </div>
92 </form>
93
94 <?php
95
96 $admin->get_footer();
97 ?>
98