PluginProbe
Snippet Shortcodes / 3.0.2
Snippet Shortcodes v3.0.2
5.2.1 5.2 5.1.8 5.1.6 5.1.7 5.1.5 trunk 1.0 1.1 1.2 1.3 1.3.1 1.4 1.5 1.5.1 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.8 2.0 2.0.1 All 74 releases
shortcode-variables / includes / pages / pages.list.php

pages.list.php in Snippet Shortcodes 3.0.2, at includes/pages/pages.list.php

144 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') or die('Jog on!');
4
5 /**
6 * Determine which page to show
7 */
8 function sh_cd_pages_your_shortcodes() {
9
10 echo '<h1>Your Shortcode Variables</h1>';
11
12 $action = ( false === empty( $_GET['action'] ) ) ? $_GET['action'] : NULL;
13
14 switch ( $action ) {
15
16 case 'add':
17 case 'edit':
18 case 'save':
19 sh_cd_pages_your_shortcodes_edit( $action );
20 break;
21 default:
22 sh_cd_pages_your_shortcodes_list( $action );
23 }
24
25 }
26
27 /**
28 * Display all shortcodes
29 */
30 function sh_cd_pages_your_shortcodes_list( $action = NULL ) {
31
32 if ( false === current_user_can( 'manage_options' ) ) {
33 wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
34 }
35
36 // Cloning a shortcode?
37 if ( 'clone' === $action && false === empty( $_GET['id'] ) ) {
38
39 sh_cd_clone( (int) $_GET['id'] );
40
41 }
42
43 // Deleting a shortcode?
44 if( 'delete' === $action && false === empty( $_GET['id'] ) ) {
45
46 $result = sh_cd_db_shortcodes_delete( (int) $_GET['id'] );
47
48 $message = ( true === $result ) ? 'Your shortcode has been deleted!' : 'There was an error deleting your shortcode!';
49
50 sh_cd_message_display( $message, ! $result );
51 }
52
53 ?>
54
55 <div class="wrap">
56 <div id="icon-options-general" class="icon32"></div>
57 <div id="poststuff">
58 <div id="post-body" class="metabox-holder columns-3">
59 <div id="post-body-content">
60 <div class="meta-box-sortables ui-sortable">
61 <div class="postbox">
62 <h3 class="hndle"><span>Your existing Shortcode Variables</span></h3>
63 <div style="padding: 0px 15px 0px 15px">
64 <p style="text-align: right">
65 <a class="button-primary" href="<?php echo sh_cd_link_your_shortcodes_add() ?>">Add a new Shortcode Variable</a>
66 </p>
67 <p style="text-align: right">
68 <?php
69
70 sh_cd_upgrade_button( 'sh-cd-hide', sh_cd_license_upgrade_link() );
71
72 ?>
73 </p>
74 <table class="widefat sh-cd-table" width="100%">
75 <tr class="row-title">
76 <th class="row-title" width="15%">Slug</th>
77 <th width="20%">Shortcode</th>
78 <th width="*">Shortcode content</th>
79 <th width="60px" align="middle">Global</th>
80 <th width="60px" align="middle">Enabled</th>
81 <th width="70px" align="middle">Options</th>
82 </tr>
83 <?php
84
85 $current_shortcodes = sh_cd_db_shortcodes_all();
86
87 if ( false === empty( $current_shortcodes ) ) {
88
89 $class = '';
90
91 $link = sh_cd_link_your_shortcodes();
92
93 foreach ( $current_shortcodes as $shortcode ) {
94
95 $class = ($class == 'alternate') ? '' : 'alternate';
96
97 $id = (int) $shortcode['id'];
98
99 printf(
100 '<tr class="%1$s">
101 <td><a href="%2$s">%3$s</a></td>
102 <td>[%4$s slug="%3$s"]</td>
103 <td align="right">
104 <textarea class="large-text inline-text-shortcode" id="sh-cd-text-area-%8$d" data-id="%8$d">%5$s</textarea>
105 <a class="button button-small sh-cd-inline-save-button" id="sh-cd-save-button-%8$d" data-id="%8$d"><i class="fas fa-save"></i> Save</a>
106 </td>
107 <td align="middle"><a class="button button-small toggle-multisite" id="sc-cd-multisite-%8$s" data-id="%8$s"><i class="fas %10$s"></i></a></td>
108 <td align="middle"><a class="button button-small toggle-disable" id="sc-cd-toggle-%8$s" data-id="%8$s"><i class="fas %6$s"></i></a></td>
109 <td width="100">
110 <a class="button button-small" href="%9$s"><i class="far fa-clone"></i></a>
111 <a class="button button-small" href="%2$s"><i class="far fa-edit"></i></a>
112 <a class="button button-small" href="%7$s" onclick="return confirm(\'Are you sure you want to delete this shortcode?\');"><i class="fas fa-trash-alt"></i></a>
113 </td>
114 </tr>',
115 $class,
116 $link . '&action=edit&id=' . $id,
117 esc_html( $shortcode['slug'] ),
118 SH_CD_SHORTCODE,
119 esc_html( stripslashes( $shortcode['data'] ) ),
120 ( 1 === (int) $shortcode['disabled'] ) ? 'fa-times' : 'fa-check',
121 $link . '&action=delete&id=' . $id,
122 $id,
123 ( true === sh_cd_license_is_premium() ) ? $link . '&action=clone&id=' . $id : sh_cd_license_upgrade_link(),
124 ( 1 === (int) $shortcode['multisite'] ) ? 'fa-check' : 'fa-times'
125 );
126 }
127 }
128 else {
129 printf( '<tr><td colspan="5" align="center">You haven\'t created any shortcodes yet. <a href="%s">Add one now!</a></td></tr>', sh_cd_link_your_shortcodes_add() );
130 }
131 ?>
132 </table>
133 <br clear="all" />
134 </div>
135 </div>
136 </div>
137 </div>
138 </div>
139 </div>
140 </div>
141 <?php
142 }
143
144