__( 'Upload or choose an image File', 'quadro' ), 'mediaButton' => __( 'Choose Image', 'quadro' ), 'importFail' => __( 'There was an error with the import. Please try to import it directly from the xml file located in your theme folder.', 'quadro' ), 'portfTransientsRefreshed' => __( 'Portfolio transients successfully refreshed.', 'quadro' ), 'addThisModule' => __( 'Add this Module to a Page', 'quadro' ), 'dupThisModule' => __( 'Duplicate this Module', 'quadro' ), 'publishFirst' => __( 'Please publish this module first.', 'quadro' ), ) ); wp_enqueue_script( 'adminscripts' ); wp_enqueue_style( 'qi-framework-styles', $template_directory_uri . '/inc/qi-framework/framework-styles.css', '' ); wp_enqueue_style( 'thickbox' ); wp_enqueue_script( 'thickbox' ); // Enqueue New Media Manager wp_enqueue_media(); // Call Icon fonts wp_enqueue_style( 'quadro-font-awesome', $template_directory_uri . '/inc/qi-framework/fonts/font-awesome/font-awesome.min.css' ); $font_declare = "@font-face{font-family:'FontAwesome';src:url('".$template_directory_uri."/inc/qi-framework/fonts/font-awesome/fontawesome-webfont.eot?v=4.3.0');src:url('".$template_directory_uri."/inc/qi-framework/fonts/font-awesome/fontawesome-webfont.eot?#iefix&v=4.3.0') format('embedded-opentype'),url('".$template_directory_uri."/inc/qi-framework/fonts/font-awesome/fontawesome-webfont.woff?v=4.3.0') format('woff'),url('".$template_directory_uri."/inc/qi-framework/fonts/font-awesome/fontawesome-webfont.ttf?v=4.3.0') format('truetype'),url('".$template_directory_uri."/inc/qi-framework/fonts/font-awesome/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular') format('svg');"; wp_add_inline_style( 'quadro-font-awesome', $font_declare ); } add_action( 'admin_enqueue_scripts', 'qi_admin_scripts' ); /*-----------------------------------------------------------------------------------*/ /* Enabling ColorPicker Script through Farbtastic /*-----------------------------------------------------------------------------------*/ function quadro_page_cpicker_scripts() { wp_enqueue_script( 'farbtastic' ); } function quadro_page_cpicker_styles() { wp_enqueue_style('farbtastic'); } add_action( 'admin_print_scripts', 'quadro_page_cpicker_scripts' ); add_action( 'admin_print_styles', 'quadro_page_cpicker_styles' ); /*-----------------------------------------------------------------------------------*/ /* Retina uploading & resizing functions /* http://wp.tutsplus.com/tutorials/theme-development/ensuring-your-theme-has-retina-support /*-----------------------------------------------------------------------------------*/ if ( $quadro_options['retina_enable'] == true ) { add_filter( 'wp_generate_attachment_metadata', 'quadro_retina_support_attachment_meta', 10, 2 ); /** * Retina images * * This function is attached to the 'wp_generate_attachment_metadata' filter hook. */ function quadro_retina_support_attachment_meta( $metadata, $attachment_id ) { foreach ( $metadata as $key => $value ) { if ( is_array( $value ) ) { foreach ( $value as $image => $attr ) { if ( is_array( $attr ) ) quadro_retina_support_create_images( get_attached_file( $attachment_id ), $attr['width'], $attr['height'], true ); } } } return $metadata; } /** * Create retina-ready images * * Referenced via quadro_retina_support_attachment_meta(). */ function quadro_retina_support_create_images( $file, $width, $height, $crop = false ) { if ( $width || $height ) { $resized_file = wp_get_image_editor( $file ); if ( ! is_wp_error( $resized_file ) ) { $filename = $resized_file->generate_filename( $width . 'x' . $height . '@2x' ); $resized_file->resize( $width * 2, $height * 2, $crop ); $resized_file->save( $filename ); $info = $resized_file->get_size(); return array( 'file' => wp_basename( $filename ), 'width' => $info['width'], 'height' => $info['height'], ); } } return false; } add_filter( 'delete_attachment', 'quadro_delete_retina_support_images' ); /** * Delete retina-ready images * * This function is attached to the 'delete_attachment' filter hook. */ function quadro_delete_retina_support_images( $attachment_id ) { $meta = wp_get_attachment_metadata( $attachment_id ); if ( $meta ) { $upload_dir = wp_upload_dir(); $path = pathinfo( $meta['file'] ); foreach ( $meta as $key => $value ) { if ( 'sizes' === $key ) { foreach ( $value as $sizes => $size ) { $original_filename = $upload_dir['basedir'] . '/' . $path['dirname'] . '/' . $size['file']; $retina_filename = substr_replace( $original_filename, '@2x.', strrpos( $original_filename, '.' ), strlen( '.' ) ); if ( file_exists( $retina_filename ) ) unlink( $retina_filename ); } } } } } } // End if Retina Option Enabled /*-----------------------------------------------------------------------------------*/ /* Adding supported plugins features /*-----------------------------------------------------------------------------------*/ function quadro_plugins_support() { global $template_directory_uri; // Site Origin Page Builder Styles if( function_exists( 'siteorigin_panels_activate' ) ) { wp_enqueue_style( 'quadro-page-builder', $template_directory_uri . '/inc/qi-framework/plugins/page-builder-styles.css' ); } // Crelly Slider Styles if( class_exists( 'CrellySliderCommon' ) ) { wp_enqueue_style( 'quadro-crelly-slider', $template_directory_uri . '/inc/qi-framework/plugins/crelly-slider-styles.css' ); } } add_action( 'wp_enqueue_scripts', 'quadro_plugins_support' );