' . "\n"; if ( function_exists( 'wp_enqueue_media' ) ) { if ( ( $value == '' ) ) { $output .= '' . "\n"; } else { $output .= '' . "\n"; } } else { $output .= '

' . __( 'Upgrade your version of WordPress for full media support.', 'options_framework_theme' ) . '

'; } if ( $_desc != '' ) { $output .= '' . $_desc . '' . "\n"; } $output .= '
' . "\n"; if ( $value != '' ) { $remove = 'Remove'; $image = preg_match( '/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value ); if ( $image ) { $output .= ''.$remove.''; } else { $parts = explode( "/", $value ); for( $i = 0; $i < sizeof( $parts ); ++$i ) { $title = $parts[$i]; } // No output preview if it's not an image. $output .= ''; // Standard generic output if it's not an image. $title = __( 'View File', 'options_framework_theme' ); $output .= '
'.$title.'
'; } } $output .= '
' . "\n"; return $output; } endif; /** * Enqueue scripts for file uploader */ if ( ! function_exists( 'optionsframework_media_scripts' ) ) : add_action( 'admin_enqueue_scripts', 'optionsframework_media_scripts' ); function optionsframework_media_scripts( $hook ) { $menu = optionsframework_menu_settings(); if ( 'appearance_page_' . $menu['menu_slug'] != $hook ) return; if ( function_exists( 'wp_enqueue_media' ) ) wp_enqueue_media(); wp_register_script( 'of-media-uploader', OPTIONS_FRAMEWORK_DIRECTORY .'js/media-uploader.js', array( 'jquery' ) ); wp_enqueue_script( 'of-media-uploader' ); wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array( 'upload' => __( '上传', 'options_framework_theme' ), 'remove' => __( '移除', 'options_framework_theme' ) ) ); } endif;