Changeset 2267785
- Timestamp:
- 03/25/2020 10:22:08 PM (6 years ago)
- Location:
- vforce-extensions/trunk
- Files:
-
- 3 edited
-
README.md (modified) (2 diffs)
-
README.txt (modified) (2 diffs)
-
vforce-extensions.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vforce-extensions/trunk/README.md
r2255091 r2267785 5 5 Requires at least: 3.0.1 6 6 Tested up to: 5.3 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 19 19 20 20 ## Changelog 21 22 ### 1.0.3 23 * Cleaned up some styling. Removed debug statements. 24 * Fixed issue with WPEngine quick links in admin bar not showing up. 25 * Added VForce Settings quick link to admin bar. 26 * Added Association ID to VForce settings quick links. 21 27 22 28 ### 1.0.2 -
vforce-extensions/trunk/README.txt
r2255091 r2267785 5 5 Requires at least: 3.0.1 6 6 Tested up to: 5.3 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 == Changelog == 20 21 ### 1.0.3 22 * Cleaned up some styling. Removed debug statements. 23 * Fixed issue with WPEngine quick links in admin bar not showing up. 24 * Added VForce Settings quick link to admin bar. 25 * Added Association ID to VForce settings quick links. 20 26 21 27 ### 1.0.2 -
vforce-extensions/trunk/vforce-extensions.php
r2255091 r2267785 3 3 * Plugin Name: VForce Extensions 4 4 * Description: Plugin to streamline VForce integration 5 * Version: 1.0. 25 * Version: 1.0.3 6 6 * Author: Virtual Inc 7 7 * Author URI: https://virtualinc.com … … 33 33 $vforce_helper = get_option('vforce_helper'); 34 34 35 add_filter( 'template_include', 'vforce_set_template_incldue_variable', 1000 ); 36 function vforce_set_template_incldue_variable( $t ){ 35 add_filter( 'template_include', 'vforce_set_template_include_variable', 1000 ); 36 function vforce_set_template_include_variable( $t ) 37 { 37 38 $GLOBALS['current_theme_template'] = basename($t); 38 39 return $t; 39 40 } 40 41 41 function vforce_get_current_template_url( $echo = false ) { 42 function vforce_get_current_template_url( $echo = false ) 43 { 42 44 if( !isset( $GLOBALS['current_theme_template'] ) ) 43 45 return false; … … 48 50 } 49 51 52 // This simply cleans up the WP admin bar slightly and adds a section to show which page template is currently in use. 50 53 function vforce_update_admin_bar($wp_adminbar) { 54 $vforce_helper = get_option('vforce_helper'); 51 55 52 56 // remove unnecessary items 53 57 $wp_adminbar->remove_node('wp-logo'); 54 $wp_adminbar->remove_node('customize'); 58 // Uncommenting the below line will remove WP Engine Quick Links, and possibly other things from the admin bar. 59 // $wp_adminbar->remove_node('customize'); 55 60 $wp_adminbar->remove_node('comments'); 56 61 … … 61 66 'href' => '#', 62 67 ]); 68 69 $associationId = ($vforce_helper['variable']['association-id'] && $vforce_helper['variable']['association-id'] != '') ? 'Association ID: ' . $vforce_helper['variable']['association-id'] : 'Click here to set Association Id'; 70 $wp_adminbar->add_menu( array( 'id' => 'vforce_extensions_admin_bar', 'title' => 'VForce Settings' ) ); 71 $wp_adminbar->add_menu( array( 'id' => 'vforce_extensions_admin_bar_status','parent' => 'vforce_extensions_admin_bar', 'title' => $associationId ) ); 72 73 63 74 } 64 65 75 // admin_bar_menu hook 66 76 add_action('admin_bar_menu', 'vforce_update_admin_bar', 999); 67 77 // Add a menu page 68 function vforce_settings_plugin_menu() { 78 function vforce_settings_plugin_menu() 79 { 69 80 $vforce_admin_page = add_menu_page ('VForce Settings', 'VForce Settings', 'manage_options', 'vforce-settings', 'vforce_create_settings_page'); 70 81 } … … 72 83 73 84 // now load the scripts we need 74 function vforce_load_variables_and_scripts ($hook) { 85 function vforce_load_variables_and_scripts ($hook) 86 { 75 87 $vforce_helper = get_option('vforce_helper'); 76 88 // Load our global js file. Any variables in this file will be available sitewide … … 78 90 $scripts = $vforce_helper['script']; 79 91 80 foreach($vforce_helper['script'] as $key => $value ){ 81 $scptPath = explode('_', $key); 82 if($value != 'false'){ 83 wp_enqueue_script( $key, plugin_dir_url( __FILE__ ) . 'inc/' . $scptPath[0] . '/js/' . $scptPath[1] . '.js', array('jquery'), '1.0', true ); 84 92 if($vforce_helper['script']) 93 { 94 foreach($vforce_helper['script'] as $key => $value ) 95 { 96 $scptPath = explode('_', $key); 97 if($value != 'false'){ 98 wp_enqueue_script( $key, plugin_dir_url( __FILE__ ) . 'inc/' . $scptPath[0] . '/js/' . $scptPath[1] . '.js', array('jquery'), '1.0', true ); 99 100 } 85 101 } 86 102 } 87 88 103 wp_localize_script( 'init-global', 'vforce_helper', $vforce_helper ); 89 104 90 105 } 91 92 93 106 94 107 // and make sure it loads with our custom script … … 97 110 98 111 99 function vforce_load_bootstrap_js(){ 112 function vforce_load_bootstrap_js() 113 { 100 114 // link some styles to the admin page 101 115 if(get_admin_page_title() === 'VForce Settings') { … … 103 117 wp_enqueue_style ('vforce_stylesheet', $vforce_stylesheet ); 104 118 } 105 106 107 119 } 108 120 add_action('admin_enqueue_scripts', 'vforce_load_bootstrap_js'); … … 130 142 131 143 function toggleHiddenFields(){ 132 console.log(setting)133 144 if (vforce_helper[optionType] && vforce_helper[optionType][setting] && vforce_helper[optionType][setting] == 'true') { 134 145 jQuery(setting ).show() … … 137 148 } 138 149 } 139 140 jQuery(document).ready(() => {141 //toggleHiddenFields()142 })143 144 150 145 151 function ajaxSuccessMsg(response) { … … 158 164 add_action( 'wp_ajax_update_vforce_setting', 'vforce_update_org_settings' ); 159 165 160 function vforce_update_org_settings() { 166 function vforce_update_org_settings() 167 { 161 168 162 169 $action = sanitize_text_field($_POST['action']); … … 165 172 $setting_type = sanitize_text_field($_POST['setting_type']); 166 173 167 168 174 $settings = get_option('vforce_helper'); 169 175 $settings[$setting_type][$option_name] = $option_value;
Note: See TracChangeset
for help on using the changeset viewer.