'; $rett .= self::boxTitle( $box ); $rett .= '
'; foreach( $box[ 'sett' ] as $slug ){ /* GET FIELDS */ if( isset( $sett[ $slug ] ) ){ $sett[ $slug ][ 'slug' ] = $slug; $sett[ $slug ][ 'default' ] = mythemes_options::def( $slug ); $sett[ $slug ][ 'value' ] = mythemes_options::set_validate( $sett[ $slug ] , mythemes_options::val( $slug ) ); $rett .= self::field( $sett[ $slug ] ); } /* IF NOT EXISTS SLUG */ else{ ob_start(); print_r( $sett ); $data = ob_get_clean(); $bt = debug_backtrace(); $caller = array_shift( $bt ); $result = '' . $caller[ 'file' ] . ' : ' . $caller[ 'line' ]; $result .= '
Field not exist : [ ' . $slug . ' ]'; $result .= '
' . $data .''; } } $rett .= '
'; $rett .= ''; return $rett; } static function boxTitle( $box ) { $rett = ''; if( isset( $box[ 'title' ] ) ){ $rett .= '
'; $rett .= '

' . $box[ 'title' ] . '

'; $rett .= '
'; } return $rett; } static function boxStyle( $box ) { $rett = ''; if( isset( $box[ 'top' ] ) ){ $rett = 'margin-top: ' . $box[ 'top' ] . 'px;'; } if( isset( $box[ 'bottom' ] ) ){ $rett .= 'margin-bottom: ' . $box[ 'bottom' ] . 'px;'; } if( !empty( $rett ) ){ $rett = ' style="' . $rett . '"'; } return $rett; } /* FIELD */ static function field( $sett ) { if( isset( $sett[ 'type' ][ 'field' ] ) && method_exists( new mythemes_ahtml() , $sett[ 'type' ][ 'field' ] ) ) { return call_user_func_array( array( new mythemes_ahtml() , $sett[ 'type' ][ 'field' ] ) , array( $sett ) ); } else{ ob_start(); print_r( $sett ); $data = ob_get_clean(); $bt = debug_backtrace(); $caller = array_shift( $bt ); $result = '
' . $caller[ 'file' ] . ' : ' . $caller[ 'line' ];
            $result .= '
Field not exist : [ ' . self::name( $sett ) . ' ]'; $result .= '
' . $data .'
'; return $result; } } /* FIELD ID */ static function fieldID( $sett ) { if( isset( $sett[ 'fieldID' ] ) && !empty( $sett[ 'fieldID' ] ) ) return $sett[ 'fieldID' ]; if( isset( $sett[ 'slug' ] ) && !empty( $sett[ 'slug' ] ) ) return 'mythemes-field-' . $sett[ 'slug' ]; return null; } /* FIELD CLASS */ static function fieldClasses( $sett ) { $rett = 'mythemes-' . self::type( $sett ); if( isset( $sett[ 'fieldClass' ] ) && !empty( $sett[ 'fieldClass' ] ) ) $rett .= ' ' . $sett[ 'fieldClass' ]; if( isset( $sett[ 'slug' ] ) && !empty( $sett[ 'slug' ] ) ) $rett .= ' mythemes-' . $sett[ 'slug' ]; return $rett; } /* ALERT */ static function inlist( $sett ) { $type = null; if( method_exists( new mythemes_ahtml() , $sett[ 'type' ][ 'input' ] ) ) $type = $sett[ 'type' ][ 'input' ]; $rett = ''; if( !empty( $type ) ){ $rett .= '
'; $rett .= '
'; $rett .= self::label( $sett ); $rett .= self::hint( $sett ); $rett .= '
'; $rett .= '
'; $rett .= call_user_func_array( array( new mythemes_ahtml() , $type ) , array( $sett ) ); $rett .= '
'; $rett .= '
'; $rett .= '
'; } return $rett; } static function inline( $sett ) { $type = null; if( method_exists( new mythemes_ahtml() , $sett[ 'type' ][ 'input' ] ) ) $type = $sett[ 'type' ][ 'input' ]; $rett = ''; if( !empty( $type ) ){ $rett .= '
'; $rett .= '
'; $rett .= self::label( $sett ); $rett .= self::hint( $sett ); $rett .= '
'; $rett .= '
'; $rett .= call_user_func_array( array( new mythemes_ahtml() , $type ) , array( $sett ) ); $rett .= '
'; $rett .= '
'; $rett .= '
'; } return $rett; } static function social( $sett ) { $type = null; if( method_exists( new mythemes_ahtml() , $sett[ 'type' ][ 'input' ] ) ) $type = $sett[ 'type' ][ 'input' ]; $rett = ''; if( !empty( $type ) ){ $rett .= '
'; $rett .= '
'; $rett .= ''; $rett .= '
'; $rett .= '
'; $rett .= call_user_func_array( array( new mythemes_ahtml() , $type ) , array( $sett ) ); $rett .= '
'; $rett .= '
'; $rett .= '
'; } return $rett; } static function none( $sett ) { $rett = null; if( isset( $sett[ 'content' ] ) ) $rett = $sett[ 'content' ]; return $rett; } static function label( $sett ) { $rett = ''; if( isset( $sett[ 'label' ] ) ) $rett = ''; return $rett; } static function hint( $sett ) { if( isset( $sett[ 'hint' ] ) && !empty( $sett[ 'hint' ] ) ){ return '' . $sett[ 'hint' ] . ''; } } /* ALERT */ static function alert( $sett ){ $title = ''; $content = ''; if( isset( $sett[ 'title' ] ) ){ $title = '' . esc_html( $sett[ 'title' ] ) . ''; } if( isset( $sett[ 'content' ] ) ){ $content = '

' . strip_tags( $sett[ 'content' ] , '
' ) . '

'; } $classes = 'mythemes-flat-alert'; if( isset( $sett[ 'type' ][ 'style' ] ) ){ $classes .= ' ' . esc_attr( $sett[ 'type' ][ 'style' ] ); } return '
' . $title . $content . '
'; } /* URL */ static function url( $sett ) { return ''; } static function urlValue( $sett ) { $value = null; if( isset( $sett[ 'value' ] ) ) $value = esc_url( $sett[ 'value' ] ); return 'value="' . $value . '"'; } /* TEXT */ static function text( $sett ) { return ''; } static function textValue( $sett ) { $value = null; if( isset( $sett[ 'value' ] ) ) $value = esc_attr( $sett[ 'value' ] ); return 'value="' . $value . '"'; } /* TEXTAREA */ static function textarea( $sett ) { return ''; } /* TO DO : GET VALIDATOR TYPE */ static function textareaValue( $sett ) { $value = null; if( isset( $sett[ 'value' ] ) ) $value = $sett[ 'value' ]; return $value; } /* MULTIPLE SELECT */ static function mselect( $sett ) { return ''; } static function mselectValue( $sett ) { $values = array(); if( isset( $sett[ 'value' ] ) ) $values = (array)$sett[ 'value' ]; $rett = ''; if( isset( $sett[ 'values' ] ) ) foreach( $sett[ 'values' ] as $index => $v ){ if( in_array( $index , $values ) ){ $rett .= ''; }else{ $rett .= ''; } } return $rett; } /* SELECT */ static function select( $sett ) { return ''; } static function selectValue( $sett ) { $value = null; if( isset( $sett[ 'value' ] ) ) $value = $sett[ 'value' ]; $rett = ''; if( isset( $sett[ 'values' ] ) ) foreach( $sett[ 'values' ] as $index => $v ){ $rett .= ''; } return $rett; } static function selectAction( $sett ) { $action = ''; if( isset( $sett[ 'action' ] ) ) $action = "onchange='javascript:mythemes_ahtml.is_selected( this , " . json_encode( $sett[ 'action' ] ) . ");'"; if( isset( $sett[ 'ajax' ] ) ) $action = "onchange='javascript:" . $sett[ 'ajax' ] . "'"; return $action; } /* ICON SELECT */ /* LOGIC */ static function logic( $sett ) { $classes = 'is-off'; if( isset( $sett[ 'value' ] ) && absint( $sett[ 'value' ] ) ) $classes = 'is-on'; if( !isset( $sett[ 'inputClass' ] ) ){ $sett[ 'inputClass' ] = 'mythemes-input-logic ' . $classes; } else{ $sett[ 'inputClass' ] .= 'mythemes-input-logic ' . $classes; } return '
' . '' . '' . __( 'On' , 'cannyon' ) . '' . '' . __( 'Off' , 'cannyon' ) . '' . '' . '
' . '
' . '
' . '
' . '
' . '' . '
'; } static function logicValue( $sett ) { $value = 0; if( isset( $sett[ 'value' ] ) ) $value = absint( $sett[ 'value' ] ); return 'value="' . $value . '"'; } static function logicAction( $sett ) { $action = ''; if( isset( $sett[ 'action' ] ) ) $action = 'data-action="' . $sett[ 'action' ] . '"'; return $action; } /* COLOR */ static function color( $sett ) { if( isset( $sett[ 'inputClass' ] ) ) $sett[ 'inputClass' ] .= ' mythemes-pickcolor'; else $sett[ 'inputClass' ] = 'mythemes-pickcolor'; $inputName = self::name( $sett ); return ''; } /* UPLOAD */ static function upload( $sett ) { /* UPLOAD URL / FILE PATH */ return '' /* UPLOAD BUTTON */ . ''; } /* IMAGE SELECT */ static function image_select( $sett ) { /* DEFAULT PATH */ if( !isset( $sett[ 'path' ] ) || empty( $sett[ 'path' ] ) ){ $sett[ 'path' ] = get_template_directory_uri() . self::$image_select_path; } /* DEFAULT EXT */ if( !isset( $sett[ 'ext' ] ) || empty( $sett[ 'ext' ] ) ){ $sett[ 'ext' ] = self::$image_select_ext; } /* DEFAULT COLS */ if( !isset( $sett[ 'cols' ] ) || empty( $sett[ 'cols' ] ) ){ $sett[ 'cols' ] = self::$image_select_cols; } /* DEFAULT POSITION */ if( !isset( $sett[ 'pos' ] ) || empty( $sett[ 'pos' ] ) ){ $sett[ 'pos' ] = self::$image_select_pos; } /* ADD COLS CLASS */ if( !isset( $sett[ 'inputClass' ] ) ){ $sett[ 'inputClass' ] = 'mythemes-input-image-select mythemes-image-select-cols-' . absint( $sett[ 'cols' ] ) . ' ' . 'mythemes-image-select-pos-' . esc_attr( $sett[ 'pos' ] ); } else{ $sett[ 'inputClass' ] .= ' mythemes-input-image-select mythemes-image-select-cols-' . absint( $sett[ 'cols' ] ) . ' ' . 'mythemes-image-select-pos-' . esc_attr( $sett[ 'pos' ] ); } /* INPUT */ return '
' . '' . '
' . self::image_select_value( $sett ) . '
' . '
' . self::image_select_values( $sett ) . '
' . '
'; } static function image_select_value( $sett ) { $value = null; if( isset( $sett[ 'value' ] ) ) $value = $sett[ 'value' ]; if( empty( $value ) ) return ''; return ''; } static function image_select_values( $sett ) { $rett = ''; $value = null; if( isset( $sett[ 'value' ] ) ) $value = esc_attr( $sett[ 'value' ] ); if( isset( $sett[ 'values' ] ) && !empty( $sett[ 'values' ] ) ){ foreach( $sett[ 'values' ] as $v ){ $action = ''; if( isset( $sett[ 'action' ] ) && isset( $sett[ 'action' ][ $v ] ) ){ $action = 'data-action="' . esc_attr( $sett[ 'action' ][ $v ] ) . '"'; } if( $value == $v ){ $rett .= '
'; $rett .= ''; $rett .= '
'; } else{ $rett .= '
'; $rett .= ''; $rett .= '
'; } } } return $rett; } /* ORIZONTAL TABBER */ static function tabber( $sett ) { $rett = ''; $content = ''; $rett .= '
'; $rett .= '
'; $rett .= ''; $rett .= '
'; $rett .= '
'; $rett .= $content; $rett .= '
'; $rett .= '
'; return $rett; } } } /* END IF CLASS EXISTS */ ?>