Plugin Directory

Changeset 2267785


Ignore:
Timestamp:
03/25/2020 10:22:08 PM (6 years ago)
Author:
virtualinc
Message:

Minor fixes and enhancements

Location:
vforce-extensions/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vforce-extensions/trunk/README.md

    r2255091 r2267785  
    55Requires at least: 3.0.1
    66Tested up to: 5.3
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1919
    2020## 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.
    2127
    2228### 1.0.2
  • vforce-extensions/trunk/README.txt

    r2255091 r2267785  
    55Requires at least: 3.0.1
    66Tested up to: 5.3
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1818
    1919== 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.
    2026
    2127### 1.0.2
  • vforce-extensions/trunk/vforce-extensions.php

    r2255091 r2267785  
    33 * Plugin Name: VForce Extensions
    44 * Description: Plugin to streamline VForce integration
    5  * Version: 1.0.2
     5 * Version: 1.0.3
    66 * Author: Virtual Inc
    77 * Author URI: https://virtualinc.com
     
    3333$vforce_helper = get_option('vforce_helper');
    3434
    35 add_filter( 'template_include', 'vforce_set_template_incldue_variable', 1000 );
    36 function vforce_set_template_incldue_variable( $t ){
     35add_filter( 'template_include', 'vforce_set_template_include_variable', 1000 );
     36function vforce_set_template_include_variable( $t )
     37{
    3738    $GLOBALS['current_theme_template'] = basename($t);
    3839    return $t;
    3940}
    4041
    41 function vforce_get_current_template_url( $echo = false ) {
     42function vforce_get_current_template_url( $echo = false )
     43{
    4244    if( !isset( $GLOBALS['current_theme_template'] ) )
    4345        return false;
     
    4850}
    4951
     52// This simply cleans up the WP admin bar slightly and adds a section to show which page template is currently in use.
    5053function vforce_update_admin_bar($wp_adminbar) {
     54  $vforce_helper = get_option('vforce_helper');
    5155
    5256  // remove unnecessary items
    5357  $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');
    5560  $wp_adminbar->remove_node('comments');
    5661
     
    6166    'href' => '#',
    6267  ]);
     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
    6374}
    64 
    6575// admin_bar_menu hook
    6676add_action('admin_bar_menu', 'vforce_update_admin_bar', 999);
    6777// Add a menu page
    68 function vforce_settings_plugin_menu() {
     78function vforce_settings_plugin_menu()
     79{
    6980    $vforce_admin_page = add_menu_page ('VForce Settings', 'VForce Settings', 'manage_options', 'vforce-settings', 'vforce_create_settings_page');
    7081}
     
    7283
    7384// now load the scripts we need
    74 function vforce_load_variables_and_scripts ($hook) {
     85function vforce_load_variables_and_scripts ($hook)
     86{
    7587  $vforce_helper = get_option('vforce_helper');
    7688  // Load our global js file.  Any variables in this file will be available sitewide
     
    7890  $scripts = $vforce_helper['script'];
    7991
    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      }
    85101    }
    86102  }
    87 
    88103  wp_localize_script( 'init-global', 'vforce_helper', $vforce_helper );
    89104
    90105}
    91 
    92 
    93106
    94107// and make sure it loads with our custom script
     
    97110
    98111
    99 function vforce_load_bootstrap_js(){
     112function vforce_load_bootstrap_js()
     113{
    100114    // link some styles to the admin page
    101115  if(get_admin_page_title() === 'VForce Settings') {
     
    103117    wp_enqueue_style ('vforce_stylesheet', $vforce_stylesheet );
    104118  }
    105 
    106 
    107119}
    108120add_action('admin_enqueue_scripts', 'vforce_load_bootstrap_js');
     
    130142
    131143 function toggleHiddenFields(){
    132   console.log(setting)
    133144  if (vforce_helper[optionType] && vforce_helper[optionType][setting] && vforce_helper[optionType][setting] == 'true') {
    134145    jQuery(setting ).show()
     
    137148  }
    138149}
    139 
    140   jQuery(document).ready(() => {
    141     //toggleHiddenFields()
    142   })
    143 
    144150
    145151  function ajaxSuccessMsg(response) {
     
    158164add_action( 'wp_ajax_update_vforce_setting', 'vforce_update_org_settings' );
    159165
    160 function vforce_update_org_settings() {
     166function vforce_update_org_settings()
     167{
    161168
    162169  $action = sanitize_text_field($_POST['action']);
     
    165172  $setting_type = sanitize_text_field($_POST['setting_type']);
    166173
    167  
    168174  $settings = get_option('vforce_helper');
    169175  $settings[$setting_type][$option_name] = $option_value;
Note: See TracChangeset for help on using the changeset viewer.