'; if( isset( $field['title'] ) ) { $field_desc = ( isset( $field['desc'] ) ) ? '

'. $field['desc'] .'

' : ''; $output .= '

' . $field['title'] . '

'. $field_desc .'
'; } $output .= ( isset( $field['title'] ) ) ? '
' : ''; $value = ( !isset( $value ) && isset( $field['default'] ) ) ? $field['default'] : $value; $value = ( isset( $field['value'] ) ) ? $field['value'] : $value; if( class_exists( $class ) ) { ob_start(); $element = new $class( $field, $value, $unique ); $element->output(); $output .= ob_get_clean(); } else { $output .= '

'. __( 'This field class is not available!', 'advanced-portfolio' ) .'

'; } $output .= ( isset( $field['title'] ) ) ? '
' : ''; $output .= '
'; $output .= ''; return $output; } } /** * Array search key & value * * @since 1.0 * */ if ( ! function_exists( 'sp_array_search' ) ) { function sp_array_search( $array, $key, $value ) { $results = array(); if ( is_array( $array ) ) { if ( isset( $array[$key] ) && $array[$key] == $value ) { $results[] = $array; } foreach ( $array as $sub_array ) { $results = array_merge( $results, sp_array_search( $sub_array, $key, $value ) ); } } return $results; } } /** * Getting POST Var * * @since 1.0 * */ if ( ! function_exists( 'sp_get_var' ) ) { function sp_get_var( $var, $default = '' ) { if( isset( $_POST[$var] ) ) { return $_POST[$var]; } if( isset( $_GET[$var] ) ) { return $_GET[$var]; } return $default; } } /** * Getting POST Vars * * @since 1.0 * */ if ( ! function_exists( 'sp_get_vars' ) ) { function sp_get_vars( $var, $depth, $default = '' ) { if( isset( $_POST[$var][$depth] ) ) { return $_POST[$var][$depth]; } if( isset( $_GET[$var][$depth] ) ) { return $_GET[$var][$depth]; } return $default; } } /** * Load options fields * * @since 1.0 * */ if ( ! function_exists( 'sp_advp_load_option_fields' ) ) { function sp_advp_load_option_fields() { $located_fields = array(); foreach (glob(SP_AdvP_F_DIR .'/fields/*/*.php') as $sp_field) { $located_fields[] = basename($sp_field); sp_advp_locate_template(str_replace(SP_AdvP_F_DIR, '', $sp_field)); } $override_name = apply_filters('sp_advp_framework_override', 'sp-framework-override'); $override_dir = get_template_directory() .'/'. $override_name .'/fields'; if( is_dir( $override_dir ) ) { foreach ( glob( $override_dir .'/*/*.php' ) as $override_field ) { if(! in_array(basename($override_field), $located_fields)) { sp_advp_locate_template(str_replace($override_dir, '/fields', $override_field)); } } } do_action('sp_advp_load_option_fields'); } }