PluginProbe
Snippet Shortcodes / 4.1.4
Snippet Shortcodes v4.1.4
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 / page.settings.php

page.settings.php in Snippet Shortcodes 4.1.4, at includes/pages/page.settings.php

96 lines 4.2 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 function sh_cd_settings_page_generic() {
6
7 if ( !current_user_can( 'manage_options' ) ) {
8 wp_die( __( 'You do not have sufficient permissions to access this page.' , SH_CD_SLUG ) );
9 }
10
11 $disable_if_not_premium_class = ( SH_CD_IS_PREMIUM ) ? '' : 'sh-cd-disabled';
12
13 ?>
14
15 <div id="icon-options-general" class="icon32"></div>
16
17 <div id="poststuff">
18
19 <div id="post-body" class="metabox-holder columns-3 yk-mt-settings">
20
21 <!-- main content -->
22 <div id="post-body-content">
23
24 <div class="meta-box-sortables ui-sortable">
25
26 <div class="postbox">
27 <h3 class="hndle">
28 <span>
29 <?php echo __( SH_CD_PLUGIN_NAME . ' Settings', SH_CD_SLUG); ?>
30 </span>
31 </h3>
32 <div class="inside">
33 <form method="post" action="options.php">
34 <?php
35
36 settings_fields( 'sh-cd-options-group' );
37 do_settings_sections( 'sh-cd-options-group' );
38
39 ?>
40
41 <?php
42 if ( false === SH_CD_IS_PREMIUM ) {
43 sh_cd_display_pro_upgrade_notice();
44 }
45 ?>
46 <h3><?php echo __( 'Permissions' , SH_CD_SLUG); ?></h3>
47 <table class="form-table">
48 <tr class="<?php echo $disable_if_not_premium_class; ?>">
49 <th scope="row"><?php echo __( 'Who can view and modify snippet shortcodes?' , SH_CD_SLUG); ?></th>
50 <?php $edit_permissions = sh_cd_permission_role(); ?>
51 <td>
52 <select id="sh-cd-edit-permissions" name="sh-cd-edit-permissions">
53 <option value="manage_options" <?php selected( $edit_permissions, 'manage_options' ); ?>><?php echo __( 'Administrators Only', SH_CD_SLUG ); ?></option>
54 <option value="read_private_posts" <?php selected( $edit_permissions, 'read_private_posts' ); ?>><?php echo __( 'Editors and above', SH_CD_SLUG ); ?></option>
55 <option value="publish_posts" <?php selected( $edit_permissions, 'publish_posts' ); ?>><?php echo __( 'Authors and above', SH_CD_SLUG ); ?></option>
56 </select>
57 <p><?php echo __('Specify the minimum level of user role that can edit and view shortcodes.', SH_CD_SLUG)?></p>
58 </td>
59 </tr>
60 <tr class="<?php echo $disable_if_not_premium_class; ?>">
61 <th scope="row"><a href="https://snippet-shortcodes.yeken.uk/shortcodes/sc-db-value-by-id.html" target="_blank" rel="noopener">"sc-db-value-by-id"</a> <?php echo __( 'shortcode enabled', SH_CD_SLUG ); ?>?</th>
62 <?php $is_enabled = sh_cd_is_shortcode_db_value_by_id_enabled(); ?>
63 <td>
64 <select id="sh-cd-shortcode-db-value-by-id-enabled" name="sh-cd-shortcode-db-value-by-id-enabled">
65 <option value="No" <?php selected( $is_enabled, false ); ?>><?php echo __( 'No', SH_CD_SLUG ); ?></option>
66 <option value="Yes" <?php selected( $is_enabled, true ); ?>><?php echo __( 'Yes', SH_CD_SLUG ); ?></option>
67 </select>
68 <p><?php echo __('Should the premium shortcode, [sv slug="sc-db-value-by-id"] be enabled?', SH_CD_SLUG)?></p>
69 </td>
70 </tr>
71 </table>
72 <?php submit_button(); ?>
73 </form>
74 </div>
75 </div>
76 </div>
77 </div>
78 </div>
79 <!-- #poststuff -->
80
81 </div> <!-- .wrap -->
82
83 <?php
84
85 }
86
87 /**
88 * Register fields to save
89 */
90 function sh_cd_register_settings(){
91
92 register_setting( 'sh-cd-options-group', 'sh-cd-edit-permissions' );
93 register_setting( 'sh-cd-options-group', 'sh-cd-shortcode-db-value-by-id-enabled' );
94 }
95 add_action( 'admin_init', 'sh_cd_register_settings' );
96