monsterinsights_text_callback

Text Callback.

Description

monsterinsights_text_callback( (array) $args ); 

Renders text fields.

Parameters (1)

0. $args (array)
Arguments passed by the setting

Usage

  1. if ( !function_exists( 'monsterinsights_text_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/settings/settings-api.php'; 
  3.  
  4. // Arguments passed by the setting 
  5. $args = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = monsterinsights_text_callback($args); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/settings/settings-api.php  
  1. function monsterinsights_text_callback( $args ) { 
  2. $monsterinsights_option = monsterinsights_get_option( $args['id'] ); 
  3.  
  4. if ( $monsterinsights_option ) { 
  5. $value = $monsterinsights_option; 
  6. } elseif( ! empty( $args['allow_blank'] ) && empty( $monsterinsights_option ) ) { 
  7. $value = ''; 
  8. } else { 
  9. $value = isset( $args['std'] ) ? $args['std'] : ''; 
  10.  
  11. if ( isset( $args['faux'] ) && true === $args['faux'] ) { 
  12. $args['readonly'] = true; 
  13. $value = isset( $args['std'] ) ? $args['std'] : ''; 
  14. $name = ''; 
  15. } else { 
  16. $name = 'name="monsterinsights_settings[' . esc_attr( $args['id'] ) . ']"'; 
  17.  
  18. $class = monsterinsights_sanitize_html_class( $args['field_class'] ); 
  19.  
  20. $disabled = ! empty( $args['disabled'] ) ? ' disabled="disabled"' : ''; 
  21. $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; 
  22. $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; 
  23. $html = '<input type="text" class="' . $class . ' ' . sanitize_html_class( $size ) . '-text" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . $disabled . ' placeholder="' . esc_attr( $args['placeholder'] ) . '"/>'; 
  24. $html .= '<p class="description"> ' . wp_kses_post( $args['desc'] ) . '</p>'; 
  25.  
  26. return apply_filters( 'monsterinsights_after_setting_output', $html, $args );