CyberChimps_Meta_Box

The Responsive II CyberChimps Meta Box class.

Defined (1)

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

/libraries/class-meta-box.php  
  1. class CyberChimps_Meta_Box extends AT_Meta_Box { 
  2.  
  3. public function show_field_image_select( $field, $meta ) { 
  4.  
  5. $this->show_field_begin( $field, $meta ); 
  6. echo "<div class='image-select'>"; 
  7. foreach( $field['options'] as $key => $option ) { 
  8. echo "<img data-key='{$key}' class='" . ( $key == $meta ? ' selected' : '' ) . "' src='{$option}' />"; 
  9. echo "<input type='hidden' name='{$field['id']}' />"; 
  10. echo "</div>"; 
  11. $this->show_field_end( $field, $meta ); 
  12.  
  13. public function show_field_section_order( $field, $meta ) { 
  14. //Define image path 
  15. $image_path = get_template_directory_uri() . "/core/images/"; 
  16.  
  17. $this->show_field_begin( $field, $meta ); 
  18.  
  19. echo "<div class='section-order' id=" . esc_attr( $field['id'] ) . ">"; 
  20. echo "<div class='left-list'>"; 
  21. echo "<div id='inactive'>Inactive Elements</div>"; 
  22. echo "<div class='list-items'>"; 
  23. foreach( $field['options'] as $key => $option ) { 
  24. if( is_array( $meta ) ) { 
  25. if( in_array( $key, $meta ) ) { 
  26. continue; 
  27. echo "<div class='list-item'>"; 
  28. echo '<span class="glyphicon glyphicon-minus-sign action"></span>'; 
  29. echo "<span data-key='{$key}'>{$option}</span>"; 
  30. echo "</div>"; 
  31. echo "</div>"; 
  32. echo "</div>"; 
  33. echo '<div id="arrow"><span class="glyphicon glyphicon-arrow-right"></span></div>'; 
  34. echo "<div class='right-list'>"; 
  35. echo "<div id='active'>Active Elements</div>"; 
  36. echo "<div class='list-items'>"; 
  37. if( is_array( $meta ) ) { 
  38. foreach( $meta as $key => $option ) { 
  39. if( !array_key_exists( $option, $field['options'] ) ) { 
  40. continue; 
  41. echo "<div class='list-item'>"; 
  42. echo '<span class="glyphicon glyphicon-minus-sign action"></span>'; 
  43. echo '<span data-key="' . $option . '">' . $field['options'][$option] . '</span>'; 
  44. echo "</div>"; 
  45. echo "</div>"; 
  46. echo "</div>"; 
  47. echo "<input class='section-order-tracker' type='hidden' id={$field['id']} name={$field['id']} />"; 
  48. echo '<div id="values"></div>'; 
  49. echo "</div>"; 
  50.  
  51. $this->show_field_end( $field, $meta ); 
  52.  
  53. /** 
  54. * Creates re-order field prompt to download plugin 
  55. * @param $field 
  56. * @param $meta 
  57. */ 
  58. public function show_field_reorder( $field, $meta ) { 
  59. $this->show_field_begin( $field, $meta ); 
  60. echo "Install the <a href='http://wordpress.org/extend/plugins/post-types-order/' target='_blank'>Post Types Order Plugin</a> to control the order of your custom slides.</td>"; 
  61.  
  62. $this->show_field_end( $field, $meta ); 
  63.  
  64. /** 
  65. * Show Image Field. Overwrites original as images have been saved under [0] rather than source 
  66. * @param array $field 
  67. * @param array $meta 
  68. * @since 1.0 
  69. * @access public 
  70. */ 
  71. public function show_field_single_image( $field, $meta ) { 
  72. wp_enqueue_media(); 
  73.  
  74. $this->show_field_begin( $field, $meta ); 
  75.  
  76. if( $meta ) { 
  77. echo "<img class='image-preview' src='{$meta}' /><br/>"; 
  78.  
  79. echo "<input type='button' class='upload-image-button' value='" . __( 'Upload', 'responsive-II' ) . "' />"; 
  80. echo "<div class='upload-desc-field'>" . __( 'or enter URL', 'responsive-II' ) . "</div>"; 
  81. echo "<input class='upload-image-field' type='text' size='50' name='{$field['id']}' value='{$meta}'/>"; 
  82.  
  83. $this->show_field_end( $field, $meta ); 
  84.  
  85. /****************************** Sanitization Functions Starts *************************************/ 
  86.  
  87. /** 
  88. * Sanitize editor Field. 
  89. * @param string $input 
  90. * @returns string $output 
  91. * @access public 
  92. */ 
  93. public function sanitize_field_editor( $input ) { 
  94. if( current_user_can( 'unfiltered_html' ) ) { 
  95. $output = $input; 
  96. else { 
  97. global $allowedtags; 
  98. $output = wpautop( wp_kses( $input, $allowedtags ) ); 
  99.  
  100. return $output; 
  101.  
  102. /** 
  103. * Sanitize text Field. 
  104. * @param string $input 
  105. * @returns string $output 
  106. * @access public 
  107. */ 
  108. public function sanitize_field_text( $input ) { 
  109. $output = wp_kses_post( $input ); 
  110.  
  111. return $output; 
  112.  
  113. /** 
  114. * Sanitize textarea Field. 
  115. * @param string $input 
  116. * @returns string $output 
  117. * @access public 
  118. */ 
  119. public function sanitize_field_textarea( $input ) { 
  120. global $allowedposttags; 
  121. $output = wp_kses( $input, $allowedposttags ); 
  122.  
  123. return $output; 
  124.  
  125. /** 
  126. * Sanitize unfiltered_textarea Field. 
  127. * @param string $input 
  128. * @returns string $output 
  129. * @access public 
  130. */ 
  131. public function sanitize_field_unfiltered_textarea( $input, $old ) { 
  132. if( current_user_can( 'unfiltered_html' ) ) { 
  133. return $input; 
  134. else { 
  135. return $old;