ReduxFramework_info

Main ReduxFramework_info class.

Defined (1)

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

/library/admin/redux-framework/inc/fields/info/field_info.php  
  1. class ReduxFramework_info { 
  2.  
  3. /** 
  4. * Field Constructor. 
  5. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function 
  6. * @since 1.0.0 
  7. * @access public 
  8. * @return void 
  9. */ 
  10. function __construct( $field = array(), $value = '', $parent ) { 
  11. $this->parent = $parent; 
  12. $this->field = $field; 
  13. $this->value = $value; 
  14.  
  15. /** 
  16. * Field Render Function. 
  17. * Takes the vars and outputs the HTML for the field in the settings 
  18. * @since 1.0.0 
  19. * @access public 
  20. * @return void 
  21. */ 
  22. public function render() { 
  23.  
  24. $defaults = array( 
  25. 'title' => '',  
  26. 'desc' => '',  
  27. 'notice' => true,  
  28. 'style' => '',  
  29. 'color' => '',  
  30. ); 
  31.  
  32. $this->field = wp_parse_args( $this->field, $defaults ); 
  33.  
  34. $styles = array( 
  35. 'normal',  
  36. 'info',  
  37. 'warning',  
  38. 'success',  
  39. 'critical',  
  40. 'custom' 
  41. ); 
  42.  
  43. if (!in_array($this->field['style'], $styles)) { 
  44. $this->field['style'] = 'normal'; 
  45. if ($this->field['style'] == "custom") { 
  46. if (!empty($this->field['color']) ) { 
  47. $this->field['color'] = "border-color:".$this->field['color'].';'; 
  48. } else { 
  49. $this->field['style'] = 'normal'; 
  50. $this->field['color'] = ""; 
  51. } else { 
  52. $this->field['color'] = ""; 
  53.  
  54. if ( empty( $this->field['desc'] ) && ! empty( $this->field['default'] ) ) { 
  55. $this->field['desc'] = $this->field['default']; 
  56. unset( $this->field['default'] ); 
  57.  
  58. if ( empty( $this->field['desc'] ) && ! empty( $this->field['subtitle'] ) ) { 
  59. $this->field['desc'] = $this->field['subtitle']; 
  60. unset( $this->field['subtitle'] ); 
  61.  
  62. if ( empty( $this->field['desc'] ) ) { 
  63. $this->field['desc'] = ""; 
  64.  
  65. if ( empty( $this->field['raw_html'] ) ) { 
  66. if ( $this->field['notice'] == true ) { 
  67. $this->field['class'] .= ' redux-notice-field'; 
  68. } else { 
  69. $this->field['class'] .= ' redux-info-field'; 
  70.  
  71.  
  72.  
  73. $this->field['style'] = 'redux-' . $this->field['style'] . ' '; 
  74.  
  75. $indent = ( isset( $this->field['sectionIndent'] ) && $this->field['sectionIndent'] ) ? ' form-table-section-indented' : ''; 
  76.  
  77. echo '</td></tr></table><div id="info-' . esc_attr($this->field['id']) . '" class="' . ( isset( $this->field['icon'] ) && ! empty( $this->field['icon'] ) && $this->field['icon'] !== true ? "hasIcon " : "") . esc_attr($this->field['style']) . ' ' . esc_attr($this->field['class']) . ' redux-field-' . esc_attr($this->field['type']) . esc_attr($indent) . '"'.( !empty($this->field['color']) ? ' style="' . esc_attr($this->field['color']) . '"' : '' ) . '>'; 
  78.  
  79. if ( ! empty( $this->field['raw_html'] ) && $this->field['raw_html'] ) { 
  80. echo wp_kses_post($this->field['desc']); 
  81. } else { 
  82. if ( isset( $this->field['title'] ) && ! empty( $this->field['title'] ) ) { 
  83. $this->field['title'] = '<b>' . wp_kses_post($this->field['title']) . '</b><br/>'; 
  84.  
  85. if ( isset( $this->field['icon'] ) && ! empty( $this->field['icon'] ) && $this->field['icon'] !== true ) { 
  86. echo '<p class="redux-info-icon"><i class="' . esc_attr($this->field['icon']) . ' icon-large"></i></p>'; 
  87.  
  88. if ( isset( $this->field['raw'] ) && ! empty( $this->field['raw'] ) ) { 
  89. echo wp_kses_post($this->field['raw']); 
  90.  
  91. if ( ! empty( $this->field['title'] ) || ! empty( $this->field['desc'] ) ) { 
  92. echo '<p class="redux-info-desc">' . wp_kses_post($this->field['title']) . wp_kses_post($this->field['desc']) . '</p>'; 
  93.  
  94. echo '</div><table class="form-table no-border" style="margin-top: 0;"><tbody><tr style="border-bottom:0; display:none;"><th style="padding-top:0;"></th><td style="padding-top:0;">'; 
  95.  
  96. /** 
  97. * Enqueue Function. 
  98. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css 
  99. * @since 1.0.0 
  100. * @access public 
  101. * @return void 
  102. */ 
  103. public function enqueue() { 
  104. if ($this->parent->args['dev_mode']) { 
  105. wp_enqueue_style( 
  106. 'redux-field-info-css',  
  107. ReduxFramework::$_url . 'inc/fields/info/field_info.css',  
  108. array(),  
  109. time(),  
  110. 'all' 
  111. );