Changeset 2423451
- Timestamp:
- 11/23/2020 10:00:11 AM (5 years ago)
- Location:
- k2-essentials
- Files:
-
- 44 added
- 2 edited
-
tags/1.2 (added)
-
tags/1.2/README.md (added)
-
tags/1.2/assets (added)
-
tags/1.2/assets/css (added)
-
tags/1.2/assets/css/styles.css (added)
-
tags/1.2/class-controls.php (added)
-
tags/1.2/controls (added)
-
tags/1.2/controls/block-gutenberg.php (added)
-
tags/1.2/controls/bypass-add-to-cart.php (added)
-
tags/1.2/controls/change-add-to-cart-text.php (added)
-
tags/1.2/controls/disable-admin-bar.php (added)
-
tags/1.2/controls/disable-image-compressor.php (added)
-
tags/1.2/controls/hide-update.php (added)
-
tags/1.2/controls/keep-item-in-cart.php (added)
-
tags/1.2/controls/login-redirect.php (added)
-
tags/1.2/controls/maintenance-mode.php (added)
-
tags/1.2/controls/remove-password-strength.php (added)
-
tags/1.2/controls/replace-out-of-stock-text.php (added)
-
tags/1.2/controls/set-min-order-amount.php (added)
-
tags/1.2/init.php (added)
-
tags/1.2/plugin.php (added)
-
tags/1.2/readme.txt (added)
-
tags/1.3 (added)
-
tags/1.3/README.md (added)
-
tags/1.3/assets (added)
-
tags/1.3/assets/css (added)
-
tags/1.3/assets/css/styles.css (added)
-
tags/1.3/class-controls.php (added)
-
tags/1.3/controls (added)
-
tags/1.3/controls/block-gutenberg.php (added)
-
tags/1.3/controls/bypass-add-to-cart.php (added)
-
tags/1.3/controls/change-add-to-cart-text.php (added)
-
tags/1.3/controls/disable-admin-bar.php (added)
-
tags/1.3/controls/disable-image-compressor.php (added)
-
tags/1.3/controls/hide-update.php (added)
-
tags/1.3/controls/keep-item-in-cart.php (added)
-
tags/1.3/controls/login-redirect.php (added)
-
tags/1.3/controls/maintenance-mode.php (added)
-
tags/1.3/controls/remove-password-strength.php (added)
-
tags/1.3/controls/replace-out-of-stock-text.php (added)
-
tags/1.3/controls/set-min-order-amount.php (added)
-
tags/1.3/init.php (added)
-
tags/1.3/plugin.php (added)
-
tags/1.3/readme.txt (added)
-
trunk/plugin.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
k2-essentials/trunk/plugin.php
r2412620 r2423451 1 1 <?php 2 2 /** 3 * K2 Essentials WordPress Plugin 4 * 5 * @package K2Essentials 6 * 3 7 * Plugin Name: K2 Essentials 4 * Plugin URI: https://k2plugins.com/ 5 * Description: Everything you need before launching the site. 6 * Version: 1.1.1 7 * Author: PookiDevs Technologies. 8 * Description: Everything you need before launching the site. 9 * Author: PookiDevs 8 10 * Author URI: https://pookidevs.com/ 9 * License: GPL2+10 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt11 * */11 * Version: 1.2 12 * Text Domain: k2essentials 13 */ 12 14 13 add_action( 'admin_menu', 'add_k2_essentials_sidebar' ); 14 add_action('admin_init', 'k2_essentials_init' ); 15 define( 'K2_ESSENTIALS', __FILE__ ); 15 16 16 17 18 19 20 21 22 // Add a new top level menu link to the ACP 23 function add_k2_essentials_sidebar() 24 { 25 add_menu_page( 26 'K2 Essentials', // Title of the page 27 'K2 Essentials', // Text to show on the menu link 28 'manage_options', // Capability requirement to see the link 29 'k2-essentials', // The 'slug' - file to display when clicking the link 30 'k2_essentials_options_page_fn' 31 ); 32 33 34 35 } 36 37 38 39 function k2_essentials_init (){ 40 41 register_setting('plugin_options', 'plugin_options', 'k2_essentials_plugin_options_validate' ); 42 add_settings_section('main_section', 'Main Settings', 'k2_essentials_section_text_fn', __FILE__); 43 add_settings_field('plugin_chk2', 'Enable to redirect login url', 'k2_essentials_setting_chk2_fn', __FILE__, 'main_section'); 44 add_settings_field('plugin_chk4_block_editor_gutenbergo', 'Disable for classic gutenberg editor', 'k2_essentials_setting_checkbox4_block_editor_gutenberg', __FILE__, 'main_section'); 45 add_settings_field('plugin_chk5_disable_admin_bar', 'Disable admin bar', 'k2_essentials_setting_checkbox5_disable_admin_bar', __FILE__, 'main_section'); 46 add_settings_field('plugin_chk6_site_under_Maintaince', 'Put Site Under Maintaince', 'k2_essentials_setting_checkbox6_site_under_Maintaince', __FILE__, 'main_section'); 47 add_settings_field('plugin_chk7_hide_update_message', 'Hide Wordpress Update Notice for Clients', 'k2_essentials_setting_checkbox7_hide_update_message', __FILE__, 'main_section'); 48 49 } 50 51 52 // Section HTML, displayed before the first option 53 function k2_essentials_section_text_fn() { 54 echo '<p>Here, you can enable/disable fields that are needed before deployment</p>'; 55 } 56 57 58 // CHECKBOX - For Login Redirect 59 function k2_essentials_setting_chk2_fn() { 60 $options = get_option('plugin_options'); 61 if($options['chkbox2']=='on') { 62 $checked = ' checked="checked" '; 63 } 64 echo "<div> 65 <input ".$checked." id='plugin_chk2' name='plugin_options[chkbox2]' type='checkbox' /> 66 <p>Page Slug </p> 67 <input id='plugin_text_string' name='plugin_options[text_string]' size='40' type='text' value='{$options['text_string']}' /> </div> 68 "; 69 } 70 71 72 // CHECKBOX - For Block Editor Gutenberg 73 function k2_essentials_setting_checkbox4_block_editor_gutenberg() { 74 $options = get_option('plugin_options'); 75 if($options['chkbox4_block_editor_gutenberg']=='on') { 76 $checked = ' checked="checked" '; 77 } 78 echo "<div> 79 <input ".$checked." id='plugin_chk4_block_editor_gutenbergo' name='plugin_options[chkbox4_block_editor_gutenberg]' type='checkbox' /> 80 "; 81 } 82 83 // CHECKBOX - For disable of admin bar 84 function k2_essentials_setting_checkbox5_disable_admin_bar() { 85 $options = get_option('plugin_options'); 86 if($options['chkbox5_disable_admin_bar']=='on') { 87 $checked = ' checked="checked" '; 88 } 89 echo "<div> 90 <input ".$checked." id='plugin_chk5_disable_admin_bar' name='plugin_options[chkbox5_disable_admin_bar]' type='checkbox' /> 91 "; 92 } 93 94 // CHECKBOX - For putting site under maintaince 95 function k2_essentials_setting_checkbox6_site_under_Maintaince() { 96 $options = get_option('plugin_options'); 97 if($options['chkbox6_site_under_Maintaince']=='on') { 98 $checked = ' checked="checked" '; 99 } 100 echo "<div> 101 <input ".$checked." id='plugin_chk6_site_under_Maintaince' name='plugin_options[chkbox6_site_under_Maintaince]' type='checkbox' /> 102 "; 103 } 104 105 106 // CHECKBOX - Hide Update Messages 107 function k2_essentials_setting_checkbox7_hide_update_message() { 108 $options = get_option('plugin_options'); 109 if($options['chkbox7_hide_update_message']=='on') { 110 $checked = ' checked="checked" '; 111 } 112 echo "<div> 113 <input ".$checked." id='plugin_chk7_hide_update_message' name='plugin_options[chkbox7_hide_update_message]' type='checkbox' /> 114 "; 115 } 116 117 118 // Display the admin options page 119 function k2_essentials_options_page_fn() { 120 ?> 121 <div class="wrap"> 122 <div class="icon32" id="icon-options-general"><br></div> 123 <h2>Welcome to K2 Essentials</h2> 124 <form action="options.php" method="post"> 125 <?php 126 if ( function_exists('wp_nonce_field') ) 127 wp_nonce_field('plugin-name-action_' . "yep"); 128 ?> 129 <?php settings_fields('plugin_options'); ?> 130 <?php do_settings_sections(__FILE__); ?> 131 <p class="submit"> 132 <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" /> 133 </p> 134 </form> 135 </div> 136 <?php 137 } 138 139 140 // Validate user data for some/all of your input fields 141 function k2_essentials_plugin_options_validate($input) { 142 // Check our textbox option field contains no HTML tags - if so strip them out 143 return $input; // return validated input 144 } 145 146 147 function k2_essentials_prevent_wp_login() { 148 149 150 $options = get_option('plugin_options'); 151 if($options['chkbox2']=='on') { 152 // WP tracks the current page - global the variable to access it 153 global $pagenow; 154 // Check if a $_GET['action'] is set, and if so, load it into $action variable 155 $action = (isset($_GET['action'])) ? $_GET['action'] : ''; 156 // Check if we're on the login page, and ensure the action is not 'logout' 157 if( $pagenow == 'wp-login.php' && ( ! $action || ( $action && ! in_array($action, array('logout', 'lostpassword', 'rp', 'resetpass'))))) { 158 // Load the home page url 159 $page = $options['text_string']; 160 // Redirect to the home page 161 wp_redirect($page); 162 // Stop execution to prevent the page loading for any reason 163 exit(); 164 } 165 } 166 } 167 add_filter('login_redirect', 'k2_essentials_prevent_wp_login', 999999999, 3); 168 169 function k2_essentials_wp_maintenance_mode(){ 170 if(!current_user_can('edit_themes') || !is_user_logged_in()){ 171 wp_die('Maintenance, please come back soon.', 'Maintenance - please come back soon.', array('response' => '503')); 172 } 173 } 174 175 function k2_essentials_perform_checked_snippets(){ 176 $options = get_option('plugin_options'); 177 178 179 180 if($options['chkbox4_block_editor_gutenberg']=='on') { 181 add_filter('use_block_editor_for_post', '__return_false', 10); 182 } 183 184 if($options['chkbox5_disable_admin_bar']=='on') { 185 add_filter( 'show_admin_bar', '__return_false' ); 186 } 187 188 189 if($options['chkbox6_site_under_Maintaince']=='on') { 190 add_action('get_header', 'k2_essentials_wp_maintenance_mode'); 191 } 192 193 if($options['chkbox7_hide_update_message']=='on') { 194 add_action('admin_menu','wphidenag'); 195 } 196 } 197 198 199 add_action('init', 'k2_essentials_perform_checked_snippets'); 200 201 202 function k2_essentials_wphidenag() { 203 remove_action( 'admin_notices', 'update_nag', 3 ); 204 } 205 206 207 ?> 17 /** 18 * Include the Elementor_K2blocks class. 19 */ 20 require plugin_dir_path( K2_ESSENTIALS ) . 'init.php'; -
k2-essentials/trunk/readme.txt
r2412620 r2423451 1 1 === K2 Essentials === 2 Contributors: syedharis632, shahrukhx04, saadhamid2 Contributors: hmumtaz1, syedharis632, shahrukhx04, saadhamid 3 3 Tags: tools, utility, toolkit 4 4 Requires at least: 4.7 5 5 Tested up to: 5.4.1 6 Stable tag: 1. 1.16 Stable tag: 1.3 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 63 63 = 1.1.1 = 64 64 * Bug fixes 65 = 1.2 = 66 * Complete code restructure 67 =1.3= 68 * UI restyling
Note: See TracChangeset
for help on using the changeset viewer.