color-patterns.php000066600000025400152141444270010242 0ustar00 .has-primary-background-color, .entry .entry-content > *[class^="wp-block-"].has-primary-background-color, .entry .entry-content > *[class^="wp-block-"] .has-primary-background-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color.has-primary-background-color, .entry .entry-content .wp-block-file .wp-block-file__button { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* * Set Color for: * - all links * - main navigation links * - Post navigation links * - Post entry meta hover * - Post entry header more-link hover * - main navigation svg * - comment navigation * - Comment edit link hover * - Site Footer Link hover * - Widget links */ a, a:visited, .main-navigation .main-menu > li, .main-navigation ul.main-menu > li > a, .post-navigation .post-title, .entry .entry-meta a:hover, .entry .entry-footer a:hover, .entry .entry-content .more-link:hover, .main-navigation .main-menu > li > a + svg, .comment .comment-metadata > a:hover, .comment .comment-metadata .comment-edit-link:hover, #colophon .site-info a:hover, .widget a, .entry .entry-content .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color), .entry .entry-content > .has-primary-color, .entry .entry-content > *[class^="wp-block-"] .has-primary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-primary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-primary-color p { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* * Set border color for: * wp block quote * :focus */ blockquote, .entry .entry-content blockquote, .entry .entry-content .wp-block-quote:not(.is-large), .entry .entry-content .wp-block-quote:not(.is-style-large), input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="tel"]:focus, input[type="range"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="week"]:focus, input[type="time"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="color"]:focus, textarea:focus { border-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .gallery-item > div > a:focus { box-shadow: 0 0 0 2px hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* Hover colors */ a:hover, a:active, .main-navigation .main-menu > li > a:hover, .main-navigation .main-menu > li > a:hover + svg, .post-navigation .nav-links a:hover, .post-navigation .nav-links a:hover .post-title, .author-bio .author-description .author-link:hover, .entry .entry-content > .has-secondary-color, .entry .entry-content > *[class^="wp-block-"] .has-secondary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-secondary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-secondary-color p, .comment .comment-author .fn a:hover, .comment-reply-link:hover, .comment-navigation .nav-previous a:hover, .comment-navigation .nav-next a:hover, #cancel-comment-reply-link:hover, .widget a:hover { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness_hover . ' ); /* base: #005177; */ } .main-navigation .sub-menu > li > a:hover, .main-navigation .sub-menu > li > a:focus, .main-navigation .sub-menu > li > a:hover:after, .main-navigation .sub-menu > li > a:focus:after, .main-navigation .sub-menu > li > .menu-item-link-return:hover, .main-navigation .sub-menu > li > .menu-item-link-return:focus, .main-navigation .sub-menu > li > a:not(.submenu-expand):hover, .main-navigation .sub-menu > li > a:not(.submenu-expand):focus, .entry .entry-content > .has-secondary-background-color, .entry .entry-content > *[class^="wp-block-"].has-secondary-background-color, .entry .entry-content > *[class^="wp-block-"] .has-secondary-background-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color.has-secondary-background-color { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness_hover . ' ); /* base: #005177; */ } /* Text selection colors */ ::selection { background-color: hsl( ' . $primary_color . ', ' . $saturation_selection . ', ' . $lightness_selection . ' ); /* base: #005177; */ } ::-moz-selection { background-color: hsl( ' . $primary_color . ', ' . $saturation_selection . ', ' . $lightness_selection . ' ); /* base: #005177; */ }'; $editor_css = ' /* * Set colors for: * - links * - blockquote * - pullquote (solid color) * - buttons */ .editor-block-list__layout .editor-block-list__block a, .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline:hover .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline:focus .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline:active .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-file .wp-block-file__textlink { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .editor-block-list__layout .editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .editor-styles-wrapper .editor-block-list__layout .wp-block-freeform blockquote { border-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .editor-block-list__layout .editor-block-list__block .wp-block-pullquote.is-style-solid-color:not(.has-background-color) { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .editor-block-list__layout .editor-block-list__block .wp-block-file .wp-block-file__button, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link:active, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link:focus, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* Hover colors */ .editor-block-list__layout .editor-block-list__block a:hover, .editor-block-list__layout .editor-block-list__block a:active, .editor-block-list__layout .editor-block-list__block .wp-block-file .wp-block-file__textlink:hover { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness_hover . ' ); /* base: #005177; */ } /* Do not overwrite solid color pullquote or cover links */ .editor-block-list__layout .editor-block-list__block .wp-block-pullquote.is-style-solid-color a, .editor-block-list__layout .editor-block-list__block .wp-block-cover a { color: inherit; } '; if ( function_exists( 'register_block_type' ) && is_admin() ) { $theme_css = $editor_css; } /** * Filters Twenty Nineteen custom colors CSS. * * @since Twenty Nineteen 1.0 * * @param string $css Base theme colors CSS. * @param int $primary_color The user's selected color hue. * @param string $saturation Filtered theme color saturation level. */ return apply_filters( 'twentynineteen_custom_colors_css', $theme_css, $primary_color, $saturation ); } icon-functions.php000066600000006410152141444270010224 0ustar00theme_location ) { $svg = twentynineteen_get_social_link_svg( $item->url, 26 ); if ( empty( $svg ) ) { $svg = twentynineteen_get_icon_svg( 'link' ); } $item_output = str_replace( $args->link_after, '' . $svg, $item_output ); } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'twentynineteen_nav_menu_social_icons', 10, 4 ); /** * Add a dropdown icon to top-level menu items. * * @param string $output Nav menu item start element. * @param object $item Nav menu item. * @param int $depth Depth. * @param object $args Nav menu args. * @return string Nav menu item start element. * Add a dropdown icon to top-level menu items */ function twentynineteen_add_dropdown_icons( $output, $item, $depth, $args ) { // Only add class to 'top level' items on the 'primary' menu. if ( ! isset( $args->theme_location ) || 'menu-1' !== $args->theme_location ) { return $output; } if ( in_array( 'mobile-parent-nav-menu-item', $item->classes, true ) && isset( $item->original_id ) ) { // Inject the keyboard_arrow_left SVG inside the parent nav menu item, and let the item link to the parent item. // @todo Only do this for nested submenus? If on a first-level submenu, then really the link could be "#" since the desire is to remove the target entirely. $link = sprintf( '. $output = preg_replace( '##i', '', $output, 1 // Limit. ); } elseif ( in_array( 'menu-item-has-children', $item->classes, true ) ) { // Add SVG icon to parent items. $icon = twentynineteen_get_icon_svg( 'keyboard_arrow_down', 24 ); $output .= sprintf( '', $icon ); } return $output; } add_filter( 'walker_nav_menu_start_el', 'twentynineteen_add_dropdown_icons', 10, 4 ); template-tags.php000066600000016247152141444270010046 0ustar00%2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( DATE_W3C ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( DATE_W3C ) ), esc_html( get_the_modified_date() ) ); printf( '%1$s%3$s', twentynineteen_get_icon_svg( 'watch', 16 ), esc_url( get_permalink() ), $time_string ); } endif; if ( ! function_exists( 'twentynineteen_posted_by' ) ) : /** * Prints HTML with meta information about theme author. */ function twentynineteen_posted_by() { printf( /* translators: 1: SVG icon. 2: Post author, only visible to screen readers. 3: Author link. */ '%1$s%2$s%4$s', twentynineteen_get_icon_svg( 'person', 16 ), __( 'Posted by', 'twentynineteen' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); } endif; if ( ! function_exists( 'twentynineteen_comment_count' ) ) : /** * Prints HTML with the comment count for the current post. */ function twentynineteen_comment_count() { if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; echo twentynineteen_get_icon_svg( 'comment', 16 ); /* translators: %s: Post title. Only visible to screen readers. */ comments_popup_link( sprintf( __( 'Leave a comment on %s', 'twentynineteen' ), get_the_title() ) ); echo ''; } } endif; if ( ! function_exists( 'twentynineteen_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function twentynineteen_entry_footer() { // Hide author, post date, category and tag text for pages. if ( 'post' === get_post_type() ) { // Posted by. twentynineteen_posted_by(); // Posted on. twentynineteen_posted_on(); /* translators: Used between list items, there is a space after the comma. */ $categories_list = get_the_category_list( __( ', ', 'twentynineteen' ) ); if ( $categories_list ) { printf( /* translators: 1: SVG icon. 2: Posted in label, only visible to screen readers. 3: List of categories. */ '%1$s%2$s%3$s', twentynineteen_get_icon_svg( 'archive', 16 ), __( 'Posted in', 'twentynineteen' ), $categories_list ); // WPCS: XSS OK. } /* translators: Used between list items, there is a space after the comma. */ $tags_list = get_the_tag_list( '', __( ', ', 'twentynineteen' ) ); if ( $tags_list ) { printf( /* translators: 1: SVG icon. 2: Posted in label, only visible to screen readers. 3: List of tags. */ '%1$s%2$s %3$s', twentynineteen_get_icon_svg( 'tag', 16 ), __( 'Tags:', 'twentynineteen' ), $tags_list ); // WPCS: XSS OK. } } // Comment count. if ( ! is_singular() ) { twentynineteen_comment_count(); } // Edit post link. edit_post_link( sprintf( wp_kses( /* translators: %s: Post title. Only visible to screen readers. */ __( 'Edit %s', 'twentynineteen' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title() ), '' . twentynineteen_get_icon_svg( 'edit', 16 ), '' ); } endif; if ( ! function_exists( 'twentynineteen_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. */ function twentynineteen_post_thumbnail() { if ( ! twentynineteen_can_show_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
%s', get_avatar( $id_or_email, twentynineteen_get_avatar_size() ) ); } endif; if ( ! function_exists( 'twentynineteen_discussion_avatars_list' ) ) : /** * Displays a list of avatars involved in a discussion for a given post. */ function twentynineteen_discussion_avatars_list( $comment_authors ) { if ( empty( $comment_authors ) ) { return; } echo '
    ', "\n"; foreach ( $comment_authors as $id_or_email ) { printf( "
  1. %s
  2. \n", twentynineteen_get_user_avatar_markup( $id_or_email ) ); } echo '
', "\n"; } endif; if ( ! function_exists( 'twentynineteen_comment_form' ) ) : /** * Documentation for function. */ function twentynineteen_comment_form( $order ) { if ( true === $order || strtolower( $order ) === strtolower( get_option( 'comment_order', 'asc' ) ) ) { comment_form( array( 'logged_in_as' => null, 'title_reply' => null, ) ); } } endif; if ( ! function_exists( 'twentynineteen_the_posts_navigation' ) ) : /** * Documentation for function. */ function twentynineteen_the_posts_navigation() { the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => sprintf( '%s %s', twentynineteen_get_icon_svg( 'chevron_left', 22 ), __( 'Newer posts', 'twentynineteen' ) ), 'next_text' => sprintf( '%s %s', __( 'Older posts', 'twentynineteen' ), twentynineteen_get_icon_svg( 'chevron_right', 22 ) ), ) ); } endif; if ( ! function_exists( 'wp_body_open' ) ) : /** * Fire the wp_body_open action. * * Added for backward compatibility to support pre-5.2.0 WordPress versions. * * @since Twenty Nineteen 1.4 */ function wp_body_open() { /** * Triggered after the opening tag. * * @since Twenty Nineteen 1.4 */ do_action( 'wp_body_open' ); } endif; template-functions.php000066600000016235152141444270011115 0ustar00'; } } add_action( 'wp_head', 'twentynineteen_pingback_header' ); /** * Changes comment form default fields. */ function twentynineteen_comment_form_defaults( $defaults ) { $comment_field = $defaults['comment_field']; // Adjust height of comment form. $defaults['comment_field'] = preg_replace( '/rows="\d+"/', 'rows="5"', $comment_field ); return $defaults; } add_filter( 'comment_form_defaults', 'twentynineteen_comment_form_defaults' ); /** * Filters the default archive titles. */ function twentynineteen_get_the_archive_title() { if ( is_category() ) { $title = __( 'Category Archives: ', 'twentynineteen' ) . '' . single_term_title( '', false ) . ''; } elseif ( is_tag() ) { $title = __( 'Tag Archives: ', 'twentynineteen' ) . '' . single_term_title( '', false ) . ''; } elseif ( is_author() ) { $title = __( 'Author Archives: ', 'twentynineteen' ) . '' . get_the_author_meta( 'display_name' ) . ''; } elseif ( is_year() ) { $title = __( 'Yearly Archives: ', 'twentynineteen' ) . '' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentynineteen' ) ) . ''; } elseif ( is_month() ) { $title = __( 'Monthly Archives: ', 'twentynineteen' ) . '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentynineteen' ) ) . ''; } elseif ( is_day() ) { $title = __( 'Daily Archives: ', 'twentynineteen' ) . '' . get_the_date() . ''; } elseif ( is_post_type_archive() ) { $title = __( 'Post Type Archives: ', 'twentynineteen' ) . '' . post_type_archive_title( '', false ) . ''; } elseif ( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); /* translators: %s: Taxonomy singular name. */ $title = sprintf( esc_html__( '%s Archives:', 'twentynineteen' ), $tax->labels->singular_name ); } else { $title = __( 'Archives:', 'twentynineteen' ); } return $title; } add_filter( 'get_the_archive_title', 'twentynineteen_get_the_archive_title' ); /** * Add custom sizes attribute to responsive image functionality for post thumbnails. * * @origin Twenty Nineteen 1.0 * * @param array $attr Attributes for the image markup. * @return string Value for use in post thumbnail 'sizes' attribute. */ function twentynineteen_post_thumbnail_sizes_attr( $attr ) { if ( is_admin() ) { return $attr; } if ( ! is_singular() ) { $attr['sizes'] = '(max-width: 34.9rem) calc(100vw - 2rem), (max-width: 53rem) calc(8 * (100vw / 12)), (min-width: 53rem) calc(6 * (100vw / 12)), 100vw'; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'twentynineteen_post_thumbnail_sizes_attr', 10, 1 ); /** * Add an extra menu to our nav for our priority+ navigation to use * * @param object $nav_menu Nav menu. * @param object $args Nav menu args. * @return string More link for hidden menu items. */ function twentynineteen_add_ellipses_to_nav( $nav_menu, $args ) { if ( 'menu-1' === $args->theme_location ) : $nav_menu .= ' '; endif; return $nav_menu; } add_filter( 'wp_nav_menu', 'twentynineteen_add_ellipses_to_nav', 10, 2 ); /** * WCAG 2.0 Attributes for Dropdown Menus * * Adjustments to menu attributes tot support WCAG 2.0 recommendations * for flyout and dropdown menus. * * @ref https://www.w3.org/WAI/tutorials/menus/flyout/ */ function twentynineteen_nav_menu_link_attributes( $atts, $item, $args, $depth ) { // Add [aria-haspopup] and [aria-expanded] to menu items that have children. $item_has_children = in_array( 'menu-item-has-children', $item->classes ); if ( $item_has_children ) { $atts['aria-haspopup'] = 'true'; $atts['aria-expanded'] = 'false'; } return $atts; } add_filter( 'nav_menu_link_attributes', 'twentynineteen_nav_menu_link_attributes', 10, 4 ); /** * Create a nav menu item to be displayed on mobile to navigate from submenu back to the parent. * * This duplicates each parent nav menu item and makes it the first child of itself. * * @param array $sorted_menu_items Sorted nav menu items. * @param object $args Nav menu args. * @return array Amended nav menu items. */ function twentynineteen_add_mobile_parent_nav_menu_items( $sorted_menu_items, $args ) { static $pseudo_id = 0; if ( ! isset( $args->theme_location ) || 'menu-1' !== $args->theme_location ) { return $sorted_menu_items; } $amended_menu_items = array(); foreach ( $sorted_menu_items as $nav_menu_item ) { $amended_menu_items[] = $nav_menu_item; if ( in_array( 'menu-item-has-children', $nav_menu_item->classes, true ) ) { $parent_menu_item = clone $nav_menu_item; $parent_menu_item->original_id = $nav_menu_item->ID; $parent_menu_item->ID = --$pseudo_id; $parent_menu_item->db_id = $parent_menu_item->ID; $parent_menu_item->object_id = $parent_menu_item->ID; $parent_menu_item->classes = array( 'mobile-parent-nav-menu-item' ); $parent_menu_item->menu_item_parent = $nav_menu_item->ID; $amended_menu_items[] = $parent_menu_item; } } return $amended_menu_items; } add_filter( 'wp_nav_menu_objects', 'twentynineteen_add_mobile_parent_nav_menu_items', 10, 2 ); back-compat.php000066600000004673152141444270007460 0ustar00

%s

', $message ); } /** * Prevents the Customizer from being loaded on WordPress versions prior to 4.7. * * @since Twenty Nineteen 1.0.0 * * @global string $wp_version WordPress version. */ function twentynineteen_customize() { wp_die( sprintf( /* translators: %s: WordPress version. */ __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ), '', array( 'back_link' => true, ) ); } add_action( 'load-customize.php', 'twentynineteen_customize' ); /** * Prevents the Theme Preview from being loaded on WordPress versions prior to 4.7. * * @since Twenty Nineteen 1.0.0 * * @global string $wp_version WordPress version. */ function twentynineteen_preview() { if ( isset( $_GET['preview'] ) ) { /* translators: %s: WordPress version. */ wp_die( sprintf( __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ) ); } } add_action( 'template_redirect', 'twentynineteen_preview' ); customizer.php000066600000007676152141444270007511 0ustar00get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'twentynineteen_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'twentynineteen_customize_partial_blogdescription', ) ); } /** * Primary color. */ $wp_customize->add_setting( 'primary_color', array( 'default' => 'default', 'transport' => 'postMessage', 'sanitize_callback' => 'twentynineteen_sanitize_color_option', ) ); $wp_customize->add_control( 'primary_color', array( 'type' => 'radio', 'label' => __( 'Primary Color', 'twentynineteen' ), 'choices' => array( 'default' => _x( 'Default', 'primary color', 'twentynineteen' ), 'custom' => _x( 'Custom', 'primary color', 'twentynineteen' ), ), 'section' => 'colors', 'priority' => 5, ) ); // Add primary color hue setting and control. $wp_customize->add_setting( 'primary_color_hue', array( 'default' => 199, 'transport' => 'postMessage', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color_hue', array( 'description' => __( 'Apply a custom color for buttons, links, featured images, etc.', 'twentynineteen' ), 'section' => 'colors', 'mode' => 'hue', ) ) ); // Add image filter setting and control. $wp_customize->add_setting( 'image_filter', array( 'default' => 1, 'sanitize_callback' => 'absint', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'image_filter', array( 'label' => __( 'Apply a filter to featured images using the primary color', 'twentynineteen' ), 'section' => 'colors', 'type' => 'checkbox', ) ); } add_action( 'customize_register', 'twentynineteen_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function twentynineteen_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function twentynineteen_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Bind JS handlers to instantly live-preview changes. */ function twentynineteen_customize_preview_js() { wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', true ); } add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' ); /** * Load dynamic logic for the customizer controls area. */ function twentynineteen_panels_js() { wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', true ); } add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' ); /** * Sanitize custom color choice. * * @param string $choice Whether image filter is active. * * @return string */ function twentynineteen_sanitize_color_option( $choice ) { $valid = array( 'default', 'custom', ); if ( in_array( $choice, $valid, true ) ) { return $choice; } return 'default'; } helper-functions.php000066600000007004152141444270010553 0ustar00user_id > 0 ) { $user = get_userdata( $comment->user_id ); $post = get_post( $comment->comment_post_ID ); if ( ! empty( $user ) && ! empty( $post ) ) { return $comment->user_id === $post->post_author; } } return false; } /** * Returns information about the current post's discussion, with cache support. */ function twentynineteen_get_discussion_data() { static $discussion, $post_id; $current_post_id = get_the_ID(); if ( $current_post_id === $post_id ) { return $discussion; /* If we have discussion information for post ID, return cached object */ } else { $post_id = $current_post_id; } $comments = get_comments( array( 'post_id' => $current_post_id, 'orderby' => 'comment_date_gmt', 'order' => get_option( 'comment_order', 'asc' ), /* Respect comment order from Settings » Discussion. */ 'status' => 'approve', 'number' => 20, /* Only retrieve the last 20 comments, as the end goal is just 6 unique authors */ ) ); $authors = array(); foreach ( $comments as $comment ) { $authors[] = ( (int) $comment->user_id > 0 ) ? (int) $comment->user_id : $comment->comment_author_email; } $authors = array_unique( $authors ); $discussion = (object) array( 'authors' => array_slice( $authors, 0, 6 ), /* Six unique authors commenting on the post. */ 'responses' => get_comments_number( $current_post_id ), /* Number of responses. */ ); return $discussion; } /** * Converts HSL to HEX colors. */ function twentynineteen_hsl_hex( $h, $s, $l, $to_hex = true ) { $h /= 360; $s /= 100; $l /= 100; $r = $l; $g = $l; $b = $l; $v = ( $l <= 0.5 ) ? ( $l * ( 1.0 + $s ) ) : ( $l + $s - $l * $s ); if ( $v > 0 ) { $m; $sv; $sextant; $fract; $vsf; $mid1; $mid2; $m = $l + $l - $v; $sv = ( $v - $m ) / $v; $h *= 6.0; $sextant = floor( $h ); $fract = $h - $sextant; $vsf = $v * $sv * $fract; $mid1 = $m + $vsf; $mid2 = $v - $vsf; switch ( $sextant ) { case 0: $r = $v; $g = $mid1; $b = $m; break; case 1: $r = $mid2; $g = $v; $b = $m; break; case 2: $r = $m; $g = $v; $b = $mid1; break; case 3: $r = $m; $g = $mid2; $b = $v; break; case 4: $r = $mid1; $g = $m; $b = $v; break; case 5: $r = $v; $g = $m; $b = $mid2; break; } } $r = round( $r * 255, 0 ); $g = round( $g * 255, 0 ); $b = round( $b * 255, 0 ); if ( $to_hex ) { $r = ( $r < 15 ) ? '0' . dechex( $r ) : dechex( $r ); $g = ( $g < 15 ) ? '0' . dechex( $g ) : dechex( $g ); $b = ( $b < 15 ) ? '0' . dechex( $b ) : dechex( $b ); return "#$r$g$b"; } return "rgb($r, $g, $b)"; } class.redux_helpers.php000066600000075567152141561100011256 0ustar00sections as $k => $section ) { if ( ! isset( $section['title'] ) ) { continue; } if ( isset( $section['fields'] ) && ! empty( $section['fields'] ) ) { if ( Redux_Helpers::recursive_array_search( $field, $section['fields'] ) ) { return $k; continue; } } } } public static function isFieldInUseByType( $fields, $field = array() ) { foreach ( $field as $name ) { if ( array_key_exists( $name, $fields ) ) { return true; } } return false; } public static function isFieldInUse( $parent, $field ) { foreach ( $parent->sections as $k => $section ) { if ( ! isset( $section['title'] ) ) { continue; } if ( isset( $section['fields'] ) && ! empty( $section['fields'] ) ) { if ( Redux_Helpers::recursive_array_search( $field, $section['fields'] ) ) { return true; continue; } } } } public static function major_version( $v ) { $version = explode( '.', $v ); if ( count( $version ) > 1 ) { return $version[0] . '.' . $version[1]; } else { return $v; } } public static function isLocalHost() { return ( $_SERVER['REMOTE_ADDR'] === '127.0.0.1' || $_SERVER['REMOTE_ADDR'] === 'localhost' ) ? 1 : 0; } public static function isWpDebug() { return ( defined( 'WP_DEBUG' ) && WP_DEBUG == true ); } public static function getTrackingObject() { global $wpdb; $hash = md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] ); global $blog_id, $wpdb; $pts = array(); foreach ( get_post_types( array( 'public' => true ) ) as $pt ) { $count = wp_count_posts( $pt ); $pts[ $pt ] = $count->publish; } $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array( 'version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template, ); if ( ! function_exists( 'get_plugin_data' ) ) { if ( file_exists( ABSPATH . 'wp-admin/includes/plugin.php' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( file_exists( ABSPATH . 'wp-admin/includes/admin.php' ) ) { require_once ABSPATH . 'wp-admin/includes/admin.php'; } } $plugins = array(); foreach ( get_option( 'active_plugins', array() ) as $plugin_path ) { $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path ); $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path ); $plugins[ $slug ] = array( 'version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI'], ); } if ( is_multisite() ) { foreach ( get_option( 'active_sitewide_plugins', array() ) as $plugin_path ) { $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path ); $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path ); $plugins[ $slug ] = array( 'version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI'], ); } } $version = explode( '.', PHP_VERSION ); $version = array( 'major' => $version[0], 'minor' => $version[0] . '.' . $version[1], 'release' => PHP_VERSION ); $user_query = new WP_User_Query( array( 'blog_id' => $blog_id, 'count_total' => true, ) ); $comments_query = new WP_Comment_Query(); $data = array( '_id' => $hash, 'localhost' => ( $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ) ? 1 : 0, 'php' => $version, 'site' => array( 'hash' => $hash, 'version' => get_bloginfo( 'version' ), 'multisite' => is_multisite(), 'users' => $user_query->get_total(), 'lang' => get_locale(), 'wp_debug' => ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? true : false : false ), 'memory' => WP_MEMORY_LIMIT, ), 'pts' => $pts, 'comments' => array( 'total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $comments_query->query( array( 'count' => true, 'type' => 'pingback' ) ), ), 'options' => apply_filters( 'redux/tracking/options', array() ), 'theme' => $theme, 'redux' => array( 'mode' => ReduxFramework::$_is_plugin ? 'plugin' : 'theme', 'version' => ReduxFramework::$_version, 'demo_mode' => get_option( 'ReduxFrameworkPlugin' ), ), 'developer' => apply_filters( 'redux/tracking/developer', array() ), 'plugins' => $plugins, ); $parts = explode( ' ', $_SERVER['SERVER_SOFTWARE'] ); $software = array(); foreach ( $parts as $part ) { if ( $part[0] == "(" ) { continue; } if ( strpos( $part, '/' ) !== false ) { $chunk = explode( "/", $part ); $software[ strtolower( $chunk[0] ) ] = $chunk[1]; } } $software['full'] = $_SERVER['SERVER_SOFTWARE']; $data['environment'] = $software; $data['environment']['mysql'] = $wpdb->db_version(); // if ( function_exists( 'mysqli_get_server_info' ) ) { // $link = mysqli_connect() or die( "Error " . mysqli_error( $link ) ); // $data['environment']['mysql'] = mysqli_get_server_info( $link ); // } else if ( class_exists( 'PDO' ) && method_exists( 'PDO', 'getAttribute' ) ) { // $data['environment']['mysql'] = PDO::getAttribute( PDO::ATTR_SERVER_VERSION ); // } else { // $data['environment']['mysql'] = mysql_get_server_info(); // } if ( empty( $data['developer'] ) ) { unset( $data['developer'] ); } return $data; } public static function trackingObject() { $data = wp_remote_post( 'http://verify.redux.io', array( 'body' => array( 'hash' => $_GET['action'], 'site' => esc_url( home_url( '/' ) ), ) ) ); $data['body'] = urldecode( $data['body'] ); if ( ! isset( $_GET['code'] ) || $data['body'] != $_GET['code'] ) { die(); } return Redux_Helpers::getTrackingObject(); } public static function isParentTheme( $file ) { $file = self::cleanFilePath( $file ); $dir = self::cleanFilePath( get_template_directory() ); $file = str_replace( '//', '/', $file ); $dir = str_replace( '//', '/', $dir ); if ( strpos( $file, $dir ) !== false ) { return true; } return false; } public static function isChildTheme( $file ) { $file = self::cleanFilePath( $file ); $dir = self::cleanFilePath( get_stylesheet_directory() ); $file = str_replace( '//', '/', $file ); $dir = str_replace( '//', '/', $dir ); if ( strpos( $file, $dir ) !== false ) { return true; } return false; } private static function reduxAsPlugin() { return ReduxFramework::$_as_plugin; } public static function isTheme( $file ) { if ( true == self::isChildTheme( $file ) || true == self::isParentTheme( $file ) ) { return true; } return false; } public static function array_in_array( $needle, $haystack ) { //Make sure $needle is an array for foreach if ( ! is_array( $needle ) ) { $needle = array( $needle ); } //For each value in $needle, return TRUE if in $haystack foreach ( $needle as $pin ) //echo 'needle' . $pin; { if ( in_array( $pin, $haystack ) ) { return true; } } //Return FALSE if none of the values from $needle are found in $haystack return false; } public static function recursive_array_search( $needle, $haystack ) { foreach ( $haystack as $key => $value ) { if ( $needle === $value || ( is_array( $value ) && self::recursive_array_search( $needle, $value ) !== false ) ) { return true; } } return false; } /** * Take a path and return it clean * * @param string $path * * @since 3.1.7 */ public static function cleanFilePath( $path ) { $path = str_replace( '', '', str_replace( array( "\\", "\\\\" ), '/', $path ) ); if ( $path[ strlen( $path ) - 1 ] === '/' ) { $path = rtrim( $path, '/' ); } return $path; } /** * Take a path and delete it * * @param string $path * * @since 3.3.3 */ public static function rmdir( $dir ) { if ( is_dir( $dir ) ) { $objects = scandir( $dir ); foreach ( $objects as $object ) { if ( $object != "." && $object != ".." ) { if ( filetype( $dir . "/" . $object ) == "dir" ) { rrmdir( $dir . "/" . $object ); } else { unlink( $dir . "/" . $object ); } } } reset( $objects ); rmdir( $dir ); } } /** * Field Render Function. * Takes the color hex value and converts to a rgba. * * @since ReduxFramework 3.0.4 */ public static function hex2rgba( $hex, $alpha = '' ) { $hex = str_replace( "#", "", $hex ); if ( strlen( $hex ) == 3 ) { $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); } else { $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); } $rgb = $r . ',' . $g . ',' . $b; if ( '' == $alpha ) { return $rgb; } else { $alpha = floatval( $alpha ); return 'rgba(' . $rgb . ',' . $alpha . ')'; } } public static function makeBoolStr( $var ) { if ( $var == false || $var == 'false' || $var == 0 || $var == '0' || $var == '' || empty( $var ) ) { return 'false'; } else { return 'true'; } } public static function localize( $localize ) { $redux = ReduxFrameworkInstances::get_instance( $localize['args']['opt_name'] ); $nonce = wp_create_nonce( 'redux-ads-nonce' ); $base = admin_url( 'admin-ajax.php' ) . '?action=redux_p&nonce=' . $nonce . '&url='; $localize['rAds'] = Redux_Helpers::rURL_fix( $base, $redux->args['opt_name'] ); return $localize; } public static function compileSystemStatus( $json_output = false, $remote_checks = false ) { global $wpdb; $sysinfo = array(); $sysinfo['home_url'] = home_url(); $sysinfo['site_url'] = site_url(); $sysinfo['redux_ver'] = esc_html( ReduxFramework::$_version ); $sysinfo['redux_data_dir'] = ReduxFramework::$_upload_dir; $f = 'fo' . 'pen'; // Only is a file-write check $sysinfo['redux_data_writeable'] = self::makeBoolStr( @$f( ReduxFramework::$_upload_dir . 'test-log.log', 'a' ) ); $sysinfo['wp_content_url'] = WP_CONTENT_URL; $sysinfo['wp_ver'] = get_bloginfo( 'version' ); $sysinfo['wp_multisite'] = is_multisite(); $sysinfo['permalink_structure'] = get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default'; $sysinfo['front_page_display'] = get_option( 'show_on_front' ); if ( $sysinfo['front_page_display'] == 'page' ) { $front_page_id = get_option( 'page_on_front' ); $blog_page_id = get_option( 'page_for_posts' ); $sysinfo['front_page'] = $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset'; $sysinfo['posts_page'] = $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset'; } $sysinfo['wp_mem_limit']['raw'] = self::let_to_num( WP_MEMORY_LIMIT ); $sysinfo['wp_mem_limit']['size'] = size_format( $sysinfo['wp_mem_limit']['raw'] ); $sysinfo['db_table_prefix'] = 'Length: ' . strlen( $wpdb->prefix ) . ' - Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ); $sysinfo['wp_debug'] = 'false'; if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $sysinfo['wp_debug'] = 'true'; } $sysinfo['wp_lang'] = get_locale(); if ( ! class_exists( 'Browser' ) ) { require_once ReduxFramework::$_dir . 'inc/browser.php'; } $browser = new Browser(); $sysinfo['browser'] = array( 'agent' => $browser->getUserAgent(), 'browser' => $browser->getBrowser(), 'version' => $browser->getVersion(), 'platform' => $browser->getPlatform(), //'mobile' => $browser->isMobile() ? 'true' : 'false', ); $sysinfo['server_info'] = esc_html( $_SERVER['SERVER_SOFTWARE'] ); $sysinfo['localhost'] = self::makeBoolStr( self::isLocalHost() ); $sysinfo['php_ver'] = function_exists( 'phpversion' ) ? esc_html( phpversion() ) : 'phpversion() function does not exist.'; $sysinfo['abspath'] = ABSPATH; if ( function_exists( 'ini_get' ) ) { $sysinfo['php_mem_limit'] = size_format( self::let_to_num( ini_get( 'memory_limit' ) ) ); $sysinfo['php_post_max_size'] = size_format( self::let_to_num( ini_get( 'post_max_size' ) ) ); $sysinfo['php_time_limit'] = ini_get( 'max_execution_time' ); $sysinfo['php_max_input_var'] = ini_get( 'max_input_vars' ); $sysinfo['php_display_errors'] = self::makeBoolStr( ini_get( 'display_errors' ) ); } $sysinfo['suhosin_installed'] = extension_loaded( 'suhosin' ); $sysinfo['mysql_ver'] = $wpdb->db_version(); $sysinfo['max_upload_size'] = size_format( wp_max_upload_size() ); $sysinfo['def_tz_is_utc'] = 'true'; if ( date_default_timezone_get() !== 'UTC' ) { $sysinfo['def_tz_is_utc'] = 'false'; } $sysinfo['fsockopen_curl'] = 'false'; if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { $sysinfo['fsockopen_curl'] = 'true'; } //$sysinfo['soap_client'] = 'false'; //if ( class_exists( 'SoapClient' ) ) { // $sysinfo['soap_client'] = 'true'; //} // //$sysinfo['dom_document'] = 'false'; //if ( class_exists( 'DOMDocument' ) ) { // $sysinfo['dom_document'] = 'true'; //} //$sysinfo['gzip'] = 'false'; //if ( is_callable( 'gzopen' ) ) { // $sysinfo['gzip'] = 'true'; //} if ( $remote_checks == true ) { $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( 'sslverify' => false, 'timeout' => 60, 'user-agent' => 'ReduxFramework/' . ReduxFramework::$_version, 'body' => array( 'cmd' => '_notify-validate' ) ) ); if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { $sysinfo['wp_remote_post'] = 'true'; $sysinfo['wp_remote_post_error'] = ''; } else { $sysinfo['wp_remote_post'] = 'false'; $sysinfo['wp_remote_post_error'] = $response->get_error_message(); } $response = @wp_remote_get( 'http://reduxframework.com/wp-admin/admin-ajax.php?action=get_redux_extensions' ); if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { $sysinfo['wp_remote_get'] = 'true'; $sysinfo['wp_remote_get_error'] = ''; } else { $sysinfo['wp_remote_get'] = 'false'; $sysinfo['wp_remote_get_error'] = $response->get_error_message(); } } $active_plugins = (array) get_option( 'active_plugins', array() ); if ( is_multisite() ) { $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); } $sysinfo['plugins'] = array(); foreach ( $active_plugins as $plugin ) { $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $plugin_name = esc_html( $plugin_data['Name'] ); $sysinfo['plugins'][ $plugin_name ] = $plugin_data; } $redux = ReduxFrameworkInstances::get_all_instances(); $sysinfo['redux_instances'] = array(); if ( ! empty( $redux ) && is_array( $redux ) ) { foreach ( $redux as $inst => $data ) { Redux::init( $inst ); $sysinfo['redux_instances'][ $inst ]['args'] = $data->args; $sysinfo['redux_instances'][ $inst ]['sections'] = $data->sections; foreach ( $sysinfo['redux_instances'][ $inst ]['sections'] as $sKey => $section ) { if ( isset( $section['fields'] ) && is_array( $section['fields'] ) ) { foreach ( $section['fields'] as $fKey => $field ) { if ( isset( $field['validate_callback'] ) ) { unset( $sysinfo['redux_instances'][ $inst ]['sections'][ $sKey ]['fields'][ $fKey ]['validate_callback'] ); } if ( $field['type'] == "js_button" ) { if ( isset( $field['script'] ) && isset( $field['script']['ver'] ) ) { unset( $sysinfo['redux_instances'][ $inst ]['sections'][ $sKey ]['fields'][ $fKey ]['script']['ver'] ); } } } } } $sysinfo['redux_instances'][ $inst ]['extensions'] = Redux::getExtensions( $inst ); if ( isset( $data->extensions['metaboxes'] ) ) { $data->extensions['metaboxes']->init(); $sysinfo['redux_instances'][ $inst ]['metaboxes'] = $data->extensions['metaboxes']->boxes; } if ( isset( $data->args['templates_path'] ) && $data->args['templates_path'] != '' ) { $sysinfo['redux_instances'][ $inst ]['templates'] = self::getReduxTemplates( $data->args['templates_path'] ); } } } $active_theme = wp_get_theme(); $sysinfo['theme']['name'] = $active_theme->Name; $sysinfo['theme']['version'] = $active_theme->Version; $sysinfo['theme']['author_uri'] = $active_theme->{'Author URI'}; $sysinfo['theme']['is_child'] = self::makeBoolStr( is_child_theme() ); if ( is_child_theme() ) { $parent_theme = wp_get_theme( $active_theme->Template ); $sysinfo['theme']['parent_name'] = $parent_theme->Name; $sysinfo['theme']['parent_version'] = $parent_theme->Version; $sysinfo['theme']['parent_author_uri'] = $parent_theme->{'Author URI'}; } //if ( $json_output ) { // $sysinfo = json_encode( $sysinfo ); //} //print_r($sysinfo); //exit(); return $sysinfo; } private static function getReduxTemplates( $custom_template_path ) { $filesystem = Redux_Filesystem::get_instance(); $template_paths = array( 'ReduxFramework' => ReduxFramework::$_dir . 'templates/panel' ); $scanned_files = array(); $found_files = array(); $outdated_templates = false; foreach ( $template_paths as $plugin_name => $template_path ) { $scanned_files[ $plugin_name ] = self::scan_template_files( $template_path ); } foreach ( $scanned_files as $plugin_name => $files ) { foreach ( $files as $file ) { if ( file_exists( $custom_template_path . '/' . $file ) ) { $theme_file = $custom_template_path . '/' . $file; } else { $theme_file = false; } if ( $theme_file ) { $core_version = self::get_template_version( ReduxFramework::$_dir . 'templates/panel/' . $file ); $theme_version = self::get_template_version( $theme_file ); if ( $core_version && ( empty( $theme_version ) || version_compare( $theme_version, $core_version, '<' ) ) ) { if ( ! $outdated_templates ) { $outdated_templates = true; } $found_files[ $plugin_name ][] = sprintf( __( '%s version %s is out of date. The core version is %s', 'redux-framework' ), str_replace( WP_CONTENT_DIR . '/themes/', '', $theme_file ), $theme_version ? $theme_version : '-', $core_version ); } else { $found_files[ $plugin_name ][] = sprintf( '%s', str_replace( WP_CONTENT_DIR . '/themes/', '', $theme_file ) ); } } } } return $found_files; } public static function rURL_fix( $base, $opt_name ) { $url = $base . urlencode( 'http://ads.reduxframework.com/api/index.php?js&g&1&v=2' ) . '&proxy=' . urlencode( $base ) . ''; return Redux_Functions::tru( $url, $opt_name ); } private static function scan_template_files( $template_path ) { $files = scandir( $template_path ); $result = array(); if ( $files ) { foreach ( $files as $key => $value ) { if ( ! in_array( $value, array( ".", ".." ) ) ) { if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { $sub_files = redux_scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); foreach ( $sub_files as $sub_file ) { $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; } } else { $result[] = $value; } } } } return $result; } public static function get_template_version( $file ) { $filesystem = Redux_Filesystem::get_instance(); // Avoid notices if file does not exist if ( ! file_exists( $file ) ) { return ''; } // //// We don't need to write to the file, so just open for reading. //$fp = fopen( $file, 'r' ); // //// Pull only the first 8kiB of the file in. //$file_data = fread( $fp, 8192 ); // //// PHP will close file handle, but we are good citizens. //fclose( $fp ); // // Make sure we catch CR-only line endings. $data = get_file_data( $file, array( 'version' ), 'plugin' ); if ( ! empty( $data[0] ) ) { return $data[0]; } else { $file_data = $filesystem->execute( 'get_contents', $file ); $file_data = str_replace( "\r", "\n", $file_data ); $version = ''; if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { $version = _cleanup_header_comment( $match[1] ); } return $version; } } private static function let_to_num( $size ) { $l = substr( $size, - 1 ); $ret = substr( $size, 0, - 1 ); switch ( strtoupper( $l ) ) { case 'P': $ret *= 1024; case 'T': $ret *= 1024; case 'G': $ret *= 1024; case 'M': $ret *= 1024; case 'K': $ret *= 1024; } return $ret; } public static function get_extension_dir( $dir ) { return trailingslashit( wp_normalize_path( dirname( $dir ) ) ); } public static function get_extension_url( $dir ) { $ext_dir = Redux_Helpers::get_extension_dir( $dir ); $ext_url = str_replace( wp_normalize_path( WP_CONTENT_DIR ), WP_CONTENT_URL, $ext_dir ); return $ext_url; } } } class.redux_instances.php000066600000014161152141561100011562 0ustar00options = get_option( 'redux-framework-tracking' ); $this->options['dev_mode'] = false; if ( ! isset( $this->options['hash'] ) || ! $this->options['hash'] || empty( $this->options['hash'] ) ) { $this->options['hash'] = md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] ); update_option( 'redux-framework-tracking', $this->options ); } if ( isset( $_GET['redux_framework_disable_tracking'] ) && ! empty( $_GET['redux_framework_disable_tracking'] ) ) { $this->options['allow_tracking'] = false; update_option( 'redux-framework-tracking', $this->options ); } if ( isset( $_GET['redux_framework_enable_tracking'] ) && ! empty( $_GET['redux_framework_enable_tracking'] ) ) { $this->options['allow_tracking'] = true; update_option( 'redux-framework-tracking', $this->options ); } header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', false ); header( 'Pragma: no-cache' ); $instances = ReduxFrameworkInstances::get_all_instances(); if ( isset( $_REQUEST['i'] ) && ! empty( $_REQUEST['i'] ) ) { if ( is_array( $instances ) && ! empty( $instances ) ) { foreach ( $instances as $opt_name => $data ) { if ( md5( $opt_name . '-debug' ) == $_REQUEST['i'] ) { $array = $instances[ $opt_name ]; } if ($data->args['dev_mode']) { $this->options['dev_mode'] = $data->args['dev_mode']; } } } if ( isset( $array ) ) { if ( isset( $array->extensions ) && is_array( $array->extensions ) && ! empty( $array->extensions ) ) { foreach ( $array->extensions as $key => $extension ) { if ( isset( $extension->$version ) ) { $array->extensions[ $key ] = $extension->$version; } else { $array->extensions[ $key ] = true; } } } if ( isset( $array->import_export ) ) { unset( $array->import_export ); } if ( isset( $array->debug ) ) { unset( $array->debug ); } } else { die(); } } else { $array = Redux_Helpers::trackingObject(); if ( is_array( $instances ) && ! empty( $instances ) ) { $array['instances'] = array(); foreach ( $instances as $opt_name => $data ) { $array['instances'][] = $opt_name; } } $array['key'] = md5( AUTH_KEY . SECURE_AUTH_KEY ); } echo @json_encode( $array, true ); die(); } function capture( $ReduxFramework ) { $this->store( $ReduxFramework ); } private function store( $ReduxFramework ) { if ( $ReduxFramework instanceof ReduxFramework ) { $key = $ReduxFramework->args['opt_name']; self::$instances[ $key ] = $ReduxFramework; } } } class.redux_api.php000066600000067636152141561100010363 0ustar00{$closure}->bindTo( $this ), $args ); } public function __toString() { return call_user_func( $this->{"__toString"}->bindTo( $this ) ); } public static function load() { add_action( 'after_setup_theme', array( 'Redux', 'createRedux' ) ); add_action( 'init', array( 'Redux', 'createRedux' ) ); add_action( 'switch_theme', array( 'Redux', 'createRedux' ) ); } public static function init( $opt_name = "" ) { if ( ! empty( $opt_name ) ) { self::loadRedux( $opt_name ); remove_action( 'setup_theme', array( 'Redux', 'createRedux' ) ); } } public static function loadExtensions( $ReduxFramework ) { if ( $instanceExtensions = self::getExtensions( $ReduxFramework->args['opt_name'], "" ) ) { foreach ( $instanceExtensions as $name => $extension ) { if ( ! class_exists( $extension['class'] ) ) { // In case you wanted override your override, hah. $extension['path'] = apply_filters( 'redux/extension/' . $ReduxFramework->args['opt_name'] . '/' . $name, $extension['path'] ); if ( file_exists( $extension['path'] ) ) { require_once $extension['path']; } } if ( ! isset( $ReduxFramework->extensions[ $name ] ) ) { if ( class_exists( $extension['class'] ) ) { $ReduxFramework->extensions[ $name ] = new $extension['class']( $ReduxFramework ); } else { echo '

No class named ' . $extension['class'] . ' exists. Please verify your extension path.

'; } } } } } public static function extensionPath( $extension, $folder = true ) { if ( ! isset( Redux::$extensions[ $extension ] ) ) { return; } $path = end( Redux::$extensions[ $extension ] ); if ( ! $folder ) { return $path; } return str_replace( 'extension_' . $extension . '.php', '', $path ); } public static function loadRedux( $opt_name = "" ) { if ( empty( $opt_name ) ) { return; } $check = ReduxFrameworkInstances::get_instance( $opt_name ); if ( isset( $check->apiHasRun ) ) { return; } $args = self::constructArgs( $opt_name ); $sections = self::constructSections( $opt_name ); if ( ! class_exists( 'ReduxFramework' ) ) { echo '

Redux Framework is not installed. Please install it.

'; return; } if ( isset( self::$uses_extensions[ $opt_name ] ) && ! empty( self::$uses_extensions[ $opt_name ] ) ) { add_action( "redux/extensions/{$opt_name}/before", array( 'Redux', 'loadExtensions' ), 0 ); } $redux = new ReduxFramework( $sections, $args ); $redux->apiHasRun = 1; self::$init[ $opt_name ] = 1; if ( isset( $redux->args['opt_name'] ) && $redux->args['opt_name'] != $opt_name ) { self::$init[ $redux->args['opt_name'] ] = 1; } } public static function createRedux() { foreach ( self::$sections as $opt_name => $theSections ) { if ( ! self::$init[ $opt_name ] ) { self::loadRedux( $opt_name ); } } } public static function constructArgs( $opt_name ) { $args = isset( self::$args[ $opt_name ] ) ? self::$args[ $opt_name ] : array(); $args['opt_name'] = $opt_name; if ( ! isset( $args['menu_title'] ) ) { $args['menu_title'] = ucfirst( $opt_name ) . ' Options'; } if ( ! isset( $args['page_title'] ) ) { $args['page_title'] = ucfirst( $opt_name ) . ' Options'; } if ( ! isset( $args['page_slug'] ) ) { $args['page_slug'] = $opt_name . '_options'; } return $args; } public static function constructSections( $opt_name ) { $sections = array(); if ( ! isset( self::$sections[ $opt_name ] ) ) { return $sections; } foreach ( self::$sections[ $opt_name ] as $section_id => $section ) { $section['fields'] = self::constructFields( $opt_name, $section_id ); $p = $section['priority']; while ( isset( $sections[ $p ] ) ) { $p++; } $sections[ $p ] = $section; } ksort( $sections ); return $sections; } public static function constructFields( $opt_name = "", $section_id = "" ) { $fields = array(); if ( ! empty( self::$fields[ $opt_name ] ) ) { foreach ( self::$fields[ $opt_name ] as $key => $field ) { if ( $field['section_id'] == $section_id ) { $p = $field['priority']; while ( isset( $fields[ $p ] ) ) { echo $p ++; } $fields[ $p ] = $field; } } } ksort( $fields ); return $fields; } public static function getSection( $opt_name = '', $id = '' ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $id ) ) { if ( ! isset( self::$sections[ $opt_name ][ $id ] ) ) { $id = strtolower( sanitize_html_class( $id ) ); } return isset( self::$sections[ $opt_name ][ $id ] ) ? self::$sections[ $opt_name ][ $id ] : false; } return false; } public static function setSections( $opt_name = '', $sections = array() ) { self::check_opt_name( $opt_name ); if ( ! empty( $sections ) ) { foreach ( $sections as $section ) { Redux::setSection( $opt_name, $section ); } } } public static function getSections( $opt_name = '' ) { self::check_opt_name( $opt_name ); if ( ! empty( self::$sections[ $opt_name ] ) ) { return self::$sections[ $opt_name ]; } return array(); } public static function removeSection( $opt_name = '', $id = "", $fields = false ) { if ( ! empty( $opt_name ) && ! empty( $id ) ) { if ( isset( self::$sections[ $opt_name ][ $id ] ) ) { $priority = ''; foreach ( self::$sections[ $opt_name ] as $key => $section ) { if ( $key == $id ) { $priority = $section['priority']; self::$priority[ $opt_name ]['sections'] --; unset( self::$sections[ $opt_name ][ $id ] ); continue; } if ( $priority != "" ) { $newPriority = $section['priority']; $section['priority'] = $priority; self::$sections[ $opt_name ][ $key ] = $section; $priority = $newPriority; } } if ( isset( self::$fields[ $opt_name ] ) && ! empty( self::$fields[ $opt_name ] ) && $fields == true ) { foreach ( self::$fields[ $opt_name ] as $key => $field ) { if ( $field['section_id'] == $id ) { unset( self::$fields[ $opt_name ][ $key ] ); } } } } } } public static function setSection( $opt_name = '', $section = array() ) { self::check_opt_name( $opt_name ); if ( empty( $section ) ) { return; } if ( ! isset( $section['id'] ) ) { if ( isset( $section['type'] ) && $section['type'] == "divide" ) { $section['id'] = time(); } else { if ( isset( $section['title'] ) ) { $section['id'] = strtolower( sanitize_title( $section['title'] ) ); } else { $section['id'] = time(); } } if ( ! isset( $section['id'] ) ) { print_r( $section ); echo "DOVY"; } if ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) { $orig = $section['id']; $i = 0; while ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) { $section['id'] = $orig . '_' . $i; } } } if ( ! empty( $opt_name ) && is_array( $section ) && ! empty( $section ) ) { if ( ! isset( $section['id'] ) && ! isset( $section['title'] ) ) { self::$errors[ $opt_name ]['section']['missing_title'] = "Unable to create a section due to missing id and title."; return; } if ( ! isset( $section['priority'] ) ) { $section['priority'] = self::getPriority( $opt_name, 'sections' ); } if ( isset( $section['fields'] ) ) { if ( ! empty( $section['fields'] ) && is_array( $section['fields'] ) ) { self::processFieldsArray( $opt_name, $section['id'], $section['fields'] ); } unset( $section['fields'] ); } self::$sections[ $opt_name ][ $section['id'] ] = $section; } else { self::$errors[ $opt_name ]['section']['empty'] = "Unable to create a section due an empty section array or the section variable passed was not an array."; return; } } public static function hideSection( $opt_name = '', $id = '', $hide = true ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $id ) ) { if ( isset ( self::$sections[ $opt_name ][ $id ] ) ) { self::$sections[ $opt_name ][ $id ]['hidden'] = $hide; } } } public static function processFieldsArray( $opt_name = "", $section_id = "", $fields = array() ) { if ( ! empty( $opt_name ) && ! empty( $section_id ) && is_array( $fields ) && ! empty( $fields ) ) { foreach ( $fields as $field ) { if ( ! is_array( $field ) ) { continue; } $field['section_id'] = $section_id; self::setField( $opt_name, $field ); } } } public static function getField( $opt_name = '', $id = '' ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $id ) ) { return isset( self::$fields[ $opt_name ][ $id ] ) ? self::$fields[ $opt_name ][ $id ] : false; } return false; } public static function hideField( $opt_name = '', $id = '', $hide = true ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $id ) ) { if ( isset ( self::$fields[ $opt_name ][ $id ] ) ) { if ( ! $hide ) { self::$fields[ $opt_name ][ $id ]['class'] = str_replace( 'hidden', '', self::$fields[ $opt_name ][ $id ]['class'] ); } else { self::$fields[ $opt_name ][ $id ]['class'] .= 'hidden'; } } } } public static function setField( $opt_name = '', $field = array() ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && is_array( $field ) && ! empty( $field ) ) { if ( ! isset( $field['priority'] ) ) { $field['priority'] = self::getPriority( $opt_name, 'fields' ); } if ( isset( $field['id'] ) ) { self::$fields[ $opt_name ][ $field['id'] ] = $field; } } } public static function removeField( $opt_name = '', $id = '' ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $id ) ) { if ( isset( self::$fields[ $opt_name ][ $id ] ) ) { foreach ( self::$fields[ $opt_name ] as $key => $field ) { if ( $key == $id ) { $priority = $field['priority']; self::$priority[ $opt_name ]['fields'] --; unset( self::$fields[ $opt_name ][ $id ] ); continue; } if ( isset( $priority ) && $priority != "" ) { $newPriority = $field['priority']; $field['priority'] = $priority; self::$fields[ $opt_name ][ $key ] = $field; $priority = $newPriority; } } } } return false; } public static function setHelpTab( $opt_name = "", $tab = array() ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $tab ) ) { if ( ! isset( self::$args[ $opt_name ]['help_tabs'] ) ) { self::$args[ $opt_name ]['help_tabs'] = array(); } if ( isset( $tab['id'] ) ) { self::$args[ $opt_name ]['help_tabs'][] = $tab; } else if ( is_array( end( $tab ) ) ) { foreach ( $tab as $tab_item ) { self::$args[ $opt_name ]['help_tabs'][] = $tab_item; } } } } public static function setHelpSidebar( $opt_name = "", $content = "" ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $content ) ) { self::$args[ $opt_name ]['help_sidebar'] = $content; } } public static function setArgs( $opt_name = "", $args = array() ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $args ) && is_array( $args ) ) { if ( isset( self::$args[ $opt_name ] ) && isset( self::$args[ $opt_name ]['clearArgs'] ) ) { self::$args[ $opt_name ] = array(); } self::$args[ $opt_name ] = wp_parse_args( $args, self::$args[ $opt_name ] ); } } public static function getArgs( $opt_name = "" ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( self::$args[ $opt_name ] ) ) { return self::$args[ $opt_name ]; } } public static function getArg( $opt_name = "", $key = "" ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $key ) && ! empty( self::$args[ $opt_name ] ) ) { return self::$args[ $opt_name ][ $key ]; } else { return; } } public static function getOption( $opt_name = "", $key = "" ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $key ) ) { $redux = get_option( $opt_name ); if ( isset( $redux[ $key ] ) ) { return $redux[ $key ]; } else { return; } } else { return; } } public static function setOption( $opt_name = "", $key = "", $option = "" ) { self::check_opt_name( $opt_name ); if ( ! empty( $opt_name ) && ! empty( $key ) ) { $redux = get_option( $opt_name ); $redux[ $key ] = $option; return update_option( $opt_name, $redux ); } else { return false; } } public static function getPriority( $opt_name, $type ) { $priority = self::$priority[ $opt_name ][ $type ]; self::$priority[ $opt_name ][ $type ] += 1; return $priority; } public static function check_opt_name( $opt_name = "" ) { if ( empty( $opt_name ) || is_array( $opt_name ) ) { return; } if ( ! isset( self::$sections[ $opt_name ] ) ) { self::$sections[ $opt_name ] = array(); self::$priority[ $opt_name ]['sections'] = 1; } if ( ! isset( self::$args[ $opt_name ] ) ) { self::$args[ $opt_name ] = array(); self::$priority[ $opt_name ]['args'] = 1; } if ( ! isset( self::$fields[ $opt_name ] ) ) { self::$fields[ $opt_name ] = array(); self::$priority[ $opt_name ]['fields'] = 1; } if ( ! isset( self::$help[ $opt_name ] ) ) { self::$help[ $opt_name ] = array(); self::$priority[ $opt_name ]['help'] = 1; } if ( ! isset( self::$errors[ $opt_name ] ) ) { self::$errors[ $opt_name ] = array(); } if ( ! isset( self::$init[ $opt_name ] ) ) { self::$init[ $opt_name ] = false; } } /** * Retrieve metadata from a file. Based on WP Core's get_file_data function * * @since 2.1.1 * * @param string $file Path to the file * * @return string */ public static function getFileVersion( $file ) { $data = get_file_data( $file, array( 'version' ), 'plugin' ); return $data[0]; } public static function checkExtensionClassFile( $opt_name, $name = "", $class_file = "", $instance = "" ) { if ( file_exists( $class_file ) ) { self::$uses_extensions[ $opt_name ] = isset( self::$uses_extensions[ $opt_name ] ) ? self::$uses_extensions[ $opt_name ] : array(); if ( ! in_array( $name, self::$uses_extensions[ $opt_name ] ) ) { self::$uses_extensions[ $opt_name ][] = $name; } self::$extensions[ $name ] = isset( self::$extensions[ $name ] ) ? self::$extensions[ $name ] : array(); $version = Redux_Helpers::get_template_version( $class_file ); if ( empty( $version ) && ! empty( $instance ) ) { if ( isset( $instance->version ) ) { $version = $instance->version; } } self::$extensions[ $name ][ $version ] = isset( self::$extensions[ $name ][ $version ] ) ? self::$extensions[ $name ][ $version ] : $class_file; $api_check = str_replace( 'extension_' . $name, $name . '_api', $class_file ); if ( file_exists( $api_check ) && ! class_exists( 'Redux_' . ucfirst( $name ) ) ) { include_once( $api_check ); } } } public static function setExtensions( $opt_name, $path ) { if ( is_dir( $path ) ) { $path = trailingslashit( $path ); $folder = str_replace( '.php', '', basename( $path ) ); if ( file_exists( $path . 'extension_' . $folder . '.php' ) ) { self::checkExtensionClassFile( $opt_name, $folder, $path . 'extension_' . $folder . '.php' ); } else { $folders = scandir( $path, 1 ); foreach ( $folders as $folder ) { if ( $folder === '.' or $folder === '..' ) { continue; } if ( file_exists( $path . $folder . '/extension_' . $folder . '.php' ) ) { self::checkExtensionClassFile( $opt_name, $folder, $path . $folder . '/extension_' . $folder . '.php' ); } else if ( is_dir( $path . $folder ) ) { self::setExtensions( $opt_name, $path . $folder ); continue; } } } } else if ( file_exists( $path ) ) { $name = explode( 'extension_', basename( $path ) ); if ( isset( $name[1] ) && ! empty( $name[1] ) ) { $name = str_replace( '.php', '', $name[1] ); self::checkExtensionClassFile( $opt_name, $name, $path ); } } } public static function getAllExtensions() { $redux = ReduxFrameworkInstances::get_all_instances(); foreach ( $redux as $instance ) { if ( ! empty( self::$uses_extensions[ $instance['args']['opt_name'] ] ) ) { continue; } if ( ! empty( $instance['extensions'] ) ) { Redux::getInstanceExtensions( $instance['args']['opt_name'], $instance ); } } } public static function getInstanceExtensions( $opt_name, $instance = array() ) { if ( ! empty( self::$uses_extensions[ $opt_name ] ) ) { return; } if ( empty( $instance ) ) { $instance = ReduxFrameworkInstances::get_instance( $opt_name ); } if ( empty( $instance ) || empty( $instance->extensions ) ) { return; } foreach ( $instance->extensions as $name => $extension ) { if ( $name == "widget_areas" ) { $new = new Redux_Widget_Areas( $instance ); } if ( isset( self::$uses_extensions[ $opt_name ][ $name ] ) ) { continue; } if ( isset( $extension->extension_dir ) ) { Redux::setExtensions( $opt_name, str_replace( $name, '', $extension->extension_dir ) ); } else if ( isset( $extension->_extension_dir ) ) { Redux::setExtensions( $opt_name, str_replace( $name, '', $extension->_extension_dir ) ); } } } public static function getExtensions( $opt_name = "", $key = "" ) { if ( empty( $opt_name ) ) { Redux::getAllExtensions(); if ( empty( $key ) ) { return self::$extension_paths; } else { if ( isset( self::$extension_paths[ $key ] ) ) { return self::$extension_paths[ $key ]; } } } else { if ( empty( self::$uses_extensions[ $opt_name ] ) ) { Redux::getInstanceExtensions( $opt_name ); } if ( empty( self::$uses_extensions[ $opt_name ] ) ) { return false; } $instanceExtensions = array(); foreach ( self::$uses_extensions[ $opt_name ] as $extension ) { $class_file = end( self::$extensions[ $extension ] ); $name = str_replace( '.php', '', basename( $extension ) ); $extension_class = 'ReduxFramework_Extension_' . $name; $instanceExtensions[ $extension ] = array( 'path' => $class_file, 'class' => $extension_class, 'version' => Redux_Helpers::get_template_version( $class_file ) ); } return $instanceExtensions; } return false; } } Redux::load(); } class.redux_cdn.php000066600000017503152141561100010342 0ustar00args['dev_mode'] ) { $msg = sprintf( __( 'If you are developing offline, please download and install the Redux Vendor Support plugin/extension to bypass the our CDN and avoid this warning', 'redux-framework' ), 'https://github.com/reduxframework/redux-vendor-support' ); } self::$_parent->admin_notices[] = array( 'type' => 'error', 'msg' => '' . __( 'Redux Framework Warning', 'redux-framework' ) . '
' . sprintf( __( '%s CDN unavailable. Some controls may not render properly.', 'redux-framework' ), $handle ) . ' ' . $msg, 'id' => $handle . $tran_key, 'dismiss' => false, ); } } } else { set_transient( $handle . $tran_key, true, MINUTE_IN_SECONDS * self::$_parent->args['cdn_check_time'] ); if ( $register ) { self::_register( $handle, $src_cdn, $deps, $ver, $footer_or_media, $is_script ); } else { self::_enqueue( $handle, $src_cdn, $deps, $ver, $footer_or_media, $is_script ); } } } } private static function _vendor_plugin( $register = true, $handle, $src_cdn, $deps, $ver, $footer_or_media, $is_script = true ) { if ( class_exists( 'Redux_VendorURL' ) ) { $src = Redux_VendorURL::get_url( $handle ); if ( $register ) { self::_register( $handle, $src, $deps, $ver, $footer_or_media, $is_script ); } else { self::_enqueue( $handle, $src, $deps, $ver, $footer_or_media, $is_script ); } } else { if ( ! self::$_set ) { self::$_parent->admin_notices[] = array( 'type' => 'error', 'msg' => sprintf( __( 'The Vendor Support plugin (or extension) is either not installed or not activated and thus, some controls may not render properly. Please ensure that it is installed and activated', 'redux-framework' ), 'https://github.com/reduxframework/redux-vendor-support', admin_url( 'plugins.php' ) ), 'id' => $handle . '23', 'dismiss' => false, ); self::$_set = true; } } } public static function register_style( $handle, $src_cdn = false, $deps = array(), $ver = false, $media = 'all' ) { if ( self::$_parent->args['use_cdn'] ) { self::_cdn( true, $handle, $src_cdn, $deps, $ver, $media, $is_script = false ); } else { self::_vendor_plugin( true, $handle, $src_cdn, $deps, $ver, $media, $is_script = false ); } } public static function register_script( $handle, $src_cdn = false, $deps = array(), $ver = false, $in_footer = false ) { if ( self::$_parent->args['use_cdn'] ) { self::_cdn( true, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true ); } else { self::_vendor_plugin( true, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true ); } } public static function enqueue_style( $handle, $src_cdn = false, $deps = array(), $ver = false, $media = 'all' ) { if ( self::$_parent->args['use_cdn'] ) { self::_cdn( false, $handle, $src_cdn, $deps, $ver, $media, $is_script = false ); } else { self::_vendor_plugin( false, $handle, $src_cdn, $deps, $ver, $media, $is_script = false ); } } public static function enqueue_script( $handle, $src_cdn = false, $deps = array(), $ver = false, $in_footer = false ) { if ( self::$_parent->args['use_cdn'] ) { self::_cdn( false, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true ); } else { self::_vendor_plugin( false, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true ); } } } } class.p.php000066600000026246152141561100006632 0ustar00 and // are disabled by default, see for more information. // callback - If specified, the response JSON will be wrapped in this named // function call. This parameter and are disabled by // default, see for more information. // user_agent - This value will be sent to the remote URL request as the // `User-Agent:` HTTP request header. If omitted, the browser user agent // will be passed through. // send_cookies - If send_cookies=1, all cookies will be forwarded through to // the remote URL request. // send_session - If send_session=1 and send_cookies=1, the SID cookie will be // forwarded through to the remote URL request. // full_headers - If a JSON request and full_headers=1, the JSON response will // contain detailed header information. // full_status - If a JSON request and full_status=1, the JSON response will // contain detailed cURL status information, otherwise it will just contain // the `http_code` property. // // Topic: POST Parameters // // All POST parameters are automatically passed through to the remote URL // request. // // Topic: JSON requests // // This request will return the contents of the specified url in JSON format. // // Request: // // > ba-simple-proxy.php?url=http://example.com/ // // Response: // // > { "contents": "...", "headers": {...}, "status": {...} } // // JSON object properties: // // contents - (String) The contents of the remote URL resource. // headers - (Object) A hash of HTTP headers returned by the remote URL // resource. // status - (Object) A hash of status codes returned by cURL. // // Topic: JSONP requests // // This request will return the contents of the specified url in JSONP format // (but only if $enable_jsonp is enabled in the PHP script). // // Request: // // > ba-simple-proxy.php?url=http://example.com/&callback=foo // // Response: // // > foo({ "contents": "...", "headers": {...}, "status": {...} }) // // JSON object properties: // // contents - (String) The contents of the remote URL resource. // headers - (Object) A hash of HTTP headers returned by the remote URL // resource. // status - (Object) A hash of status codes returned by cURL. // // Topic: Native requests // // This request will return the contents of the specified url in the format it // was received in, including the same content-type and other headers (but only // if $enable_native is enabled in the PHP script). // // Request: // // > ba-simple-proxy.php?url=http://example.com/&mode=native // // Response: // // > ... // // Topic: Notes // // * Assumes magic_quotes_gpc = Off in php.ini // // Topic: Configuration Options // // These variables can be manually edited in the PHP file if necessary. // // $enable_jsonp - Only enable if you really need to. If you // install this script on the same server as the page you're calling it // from, plain JSON will work. Defaults to false. // $enable_native - You can enable , but you should only do // this if you also whitelist specific URLs using $valid_url_regex, to avoid // possible XSS vulnerabilities. Defaults to false. // $valid_url_regex - This regex is matched against the url parameter to // ensure that it is valid. This setting only needs to be used if either // $enable_jsonp or $enable_native are enabled. Defaults to '/.*/' which // validates all URLs. // // ############################################################################ $_GET['mode'] = "native"; $_GET['full_headers'] = 1; $_GET['full_status'] = 1; $_GET['send_cookies'] = 1; // Change these configuration options if needed, see above descriptions for info. $enable_jsonp = false; $enable_native = true; $valid_url_regex = '/.*/'; // ############################################################################ $url = $_GET['url']; if ( isset( $_GET['nonce'] ) ) { $url = str_replace( 'nonce=' . $_GET['nonce'] . '&', '', $url ); } if ( ! $url ) { // Passed url not specified. $contents = 'ERROR: url not specified'; $status = array( 'http_code' => 'ERROR' ); } else if ( ! preg_match( $valid_url_regex, $url ) ) { // Passed url doesn't match $valid_url_regex. $contents = 'ERROR: invalid url'; $status = array( 'http_code' => 'ERROR' ); } else { $url = urldecode( $url ); if ( isset( $_GET['proxy'] ) ) { $url .= '&proxy=' . $_GET['proxy']; } // Ad URL rewrite if ( strpos( $url, 'http' ) === false ) { $url = 'http:' . $url; } if ( isset( $_GET['callback'] ) ) { foreach ( $_GET as $key => $value ) { if ( in_array( $key, array( 'url', 'mode', 'full_headers', 'full_status', 'send_cookies' ) ) ) { continue; } $url .= "&" . $key . '=' . $value; } } $args = array( 'user-agent' => isset( $_GET['user_agent'] ) ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'], 'method' => 'GET', ); if ( isset( $_GET['send_cookies'] ) && $_GET['send_cookies'] ) { $cookie = array(); foreach ( $_COOKIE as $key => $value ) { $cookie[] = $key . '=' . $value; } if ( isset( $_GET['send_session'] ) && $_GET['send_session'] ) { $cookie[] = SID; } $args['cookies'] = $cookie; } if ( strtolower( $_SERVER['REQUEST_METHOD'] ) == 'post' ) { $args['body'] = $_POST; $args['method'] = 'POST'; } $response = wp_remote_request( $url, $args ); if ( ! is_wp_error( $response ) ) { $status = $response['response']['code']; $contents = $response['body']; } } if ( isset( $_GET['mode'] ) && $_GET['mode'] == 'native' ) { if ( ! $enable_native ) { $contents = 'ERROR: invalid mode'; $status = array( 'http_code' => 'ERROR' ); } if ( ! is_wp_error( $response ) && isset( $response['headers']['content-type'] ) ) { header( 'Content-Type: ' . $response['headers']['content-type'] ); } if ( ! is_wp_error( $response ) && isset( $response['headers']['content-language'] ) ) { header( 'Content-Language: ' . $response['headers']['content-language'] ); } if ( ! is_wp_error( $response ) && isset( $response['headers']['set-cookie'] ) ) { header( 'Set-Cookie: ' . $response['headers']['set-cookie'] ); } if ( isset( $contents ) ) { print str_replace( 'ads.reduxframework.com', 'look.reduxframework.com', $contents ); } } else { // $data will be serialized into JSON data. $data = array(); // Propagate all HTTP headers into the JSON data object. if ( isset( $_GET['full_headers'] ) && $_GET['full_headers'] ) { $data['headers'] = array(); } // Propagate all cURL request / response info to the JSON data object. if ( isset( $_GET['full_status'] ) && $_GET['full_status'] ) { $data['status'] = $status; } else { $data['status'] = array(); $data['status']['http_code'] = $status['http_code']; } // Set the JSON data object contents, decoding it from JSON if possible. $decoded_json = json_decode( $contents ); $data['contents'] = str_replace( 'e(window).width()', 'window.innerWidth||e(window).width()', $decoded_json ? $decoded_json : $contents ); // Generate appropriate content-type header. $is_xhr = isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ? strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) : 'xmlhttprequest'; header( 'Content-type: application/' . ( $is_xhr ? 'json' : 'x-javascript' ) ); // Get JSONP callback. $jsonp_callback = $enable_jsonp && isset( $_GET['callback'] ) ? $_GET['callback'] : null; // Generate JSON/JSONP string $json = json_encode( $data ); print $jsonp_callback ? "$jsonp_callback($json)" : $json; } } } new Redux_P(); validation/url/validation_url.php000066600000002640152141561100013227 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid URL for this option.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { if ( filter_var( $this->value, FILTER_VALIDATE_URL ) == false ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } else { $this->value = esc_url_raw( $this->value ); } } //function } //class }validation/str_replace/validation_str_replace.php000066600000002056152141561100016432 0ustar00parent = $parent; $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { $this->value = str_replace( $this->field['str']['search'], $this->field['str']['replacement'], $this->value ); } //function } //class }validation/color/validation_color.php000066600000013131152141561100014054 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Validate Color * Takes the user's input color value and returns it only if it's a valid color. * * @since ReduxFramework 3.0.0 */ function validate_color( $color ) { if ( $color == "transparent" ) { return $color; } $named = json_decode( '{"transparent":"transparent", "aliceblue":"#f0f8ff","antiquewhite":"#faebd7","aqua":"#00ffff","aquamarine":"#7fffd4","azure":"#f0ffff", "beige":"#f5f5dc","bisque":"#ffe4c4","black":"#000000","blanchedalmond":"#ffebcd","blue":"#0000ff","blueviolet":"#8a2be2","brown":"#a52a2a","burlywood":"#deb887", "cadetblue":"#5f9ea0","chartreuse":"#7fff00","chocolate":"#d2691e","coral":"#ff7f50","cornflowerblue":"#6495ed","cornsilk":"#fff8dc","crimson":"#dc143c","cyan":"#00ffff", "darkblue":"#00008b","darkcyan":"#008b8b","darkgoldenrod":"#b8860b","darkgray":"#a9a9a9","darkgreen":"#006400","darkkhaki":"#bdb76b","darkmagenta":"#8b008b","darkolivegreen":"#556b2f", "darkorange":"#ff8c00","darkorchid":"#9932cc","darkred":"#8b0000","darksalmon":"#e9967a","darkseagreen":"#8fbc8f","darkslateblue":"#483d8b","darkslategray":"#2f4f4f","darkturquoise":"#00ced1", "darkviolet":"#9400d3","deeppink":"#ff1493","deepskyblue":"#00bfff","dimgray":"#696969","dodgerblue":"#1e90ff", "firebrick":"#b22222","floralwhite":"#fffaf0","forestgreen":"#228b22","fuchsia":"#ff00ff", "gainsboro":"#dcdcdc","ghostwhite":"#f8f8ff","gold":"#ffd700","goldenrod":"#daa520","gray":"#808080","green":"#008000","greenyellow":"#adff2f", "honeydew":"#f0fff0","hotpink":"#ff69b4", "indianred ":"#cd5c5c","indigo ":"#4b0082","ivory":"#fffff0","khaki":"#f0e68c", "lavender":"#e6e6fa","lavenderblush":"#fff0f5","lawngreen":"#7cfc00","lemonchiffon":"#fffacd","lightblue":"#add8e6","lightcoral":"#f08080","lightcyan":"#e0ffff","lightgoldenrodyellow":"#fafad2", "lightgrey":"#d3d3d3","lightgreen":"#90ee90","lightpink":"#ffb6c1","lightsalmon":"#ffa07a","lightseagreen":"#20b2aa","lightskyblue":"#87cefa","lightslategray":"#778899","lightsteelblue":"#b0c4de", "lightyellow":"#ffffe0","lime":"#00ff00","limegreen":"#32cd32","linen":"#faf0e6", "magenta":"#ff00ff","maroon":"#800000","mediumaquamarine":"#66cdaa","mediumblue":"#0000cd","mediumorchid":"#ba55d3","mediumpurple":"#9370d8","mediumseagreen":"#3cb371","mediumslateblue":"#7b68ee", "mediumspringgreen":"#00fa9a","mediumturquoise":"#48d1cc","mediumvioletred":"#c71585","midnightblue":"#191970","mintcream":"#f5fffa","mistyrose":"#ffe4e1","moccasin":"#ffe4b5", "navajowhite":"#ffdead","navy":"#000080", "oldlace":"#fdf5e6","olive":"#808000","olivedrab":"#6b8e23","orange":"#ffa500","orangered":"#ff4500","orchid":"#da70d6", "palegoldenrod":"#eee8aa","palegreen":"#98fb98","paleturquoise":"#afeeee","palevioletred":"#d87093","papayawhip":"#ffefd5","peachpuff":"#ffdab9","peru":"#cd853f","pink":"#ffc0cb","plum":"#dda0dd","powderblue":"#b0e0e6","purple":"#800080", "red":"#ff0000","rosybrown":"#bc8f8f","royalblue":"#4169e1", "saddlebrown":"#8b4513","salmon":"#fa8072","sandybrown":"#f4a460","seagreen":"#2e8b57","seashell":"#fff5ee","sienna":"#a0522d","silver":"#c0c0c0","skyblue":"#87ceeb","slateblue":"#6a5acd","slategray":"#708090","snow":"#fffafa","springgreen":"#00ff7f","steelblue":"#4682b4", "tan":"#d2b48c","teal":"#008080","thistle":"#d8bfd8","tomato":"#ff6347","turquoise":"#40e0d0", "violet":"#ee82ee", "wheat":"#f5deb3","white":"#ffffff","whitesmoke":"#f5f5f5", "yellow":"#ffff00","yellowgreen":"#9acd32"}', true ); if ( isset( $named[ strtolower( $color ) ] ) ) { /* A color name was entered instead of a Hex Value, convert and send back */ return $named[ strtolower( $color ) ]; } $color = str_replace( '#', '', $color ); if ( strlen( $color ) == 3 ) { $color = $color . $color; } if ( preg_match( '/^[a-f0-9]{6}$/i', $color ) ) { return '#' . $color; } //$this->error = $this->field; return false; } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 3.0.0 */ function validate() { if ( is_array( $this->value ) ) { // If array foreach ( $this->value as $k => $value ) { $this->value[ $k ] = $this->validate_color( $value ); } //foreach } else { // not array $this->value = $this->validate_color( $this->value ); } // END array check } //function } //class }validation/preg_replace/validation_preg_replace.php000066600000002126152141561100016702 0ustar00parent = $parent; $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { $this->value = preg_replace_callback($this->field['preg']['pattern'], function($matches){return $this->field['preg']['replacement'];}, $this->value); } //function } //class }validation/no_html/validation_no_html.php000066600000002535152141561100014726 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must not enter any HTML in this field, all HTML tags have been removed.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { $newvalue = strip_tags( $this->value ); if ( $this->value != $newvalue ) { $this->warning = $this->field; } $this->value = $newvalue; } //function } //class }validation/no_special_chars/validation_no_special_chars.php000066600000002631152141561100020413 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must not enter any special characters in this field, all special characters have been removed.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { if ( ! preg_match( '/[^a-zA-Z0-9_ -]/s', $this->value ) == 0 ) { $this->warning = $this->field; } $this->value = preg_replace( '/[^a-zA-Z0-9_ -]/s', '', $this->value ); } //function } //class }validation/numeric/validation_numeric.php000066600000002531152141561100014726 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a numerical value for this option.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { if ( ! is_numeric( $this->value ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/comma_numeric/validation_comma_numeric.php000066600000002734152141561100017263 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a comma separated list of numerical values for this option.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { $this->value = str_replace( ' ', '', $this->value ); if ( ! is_numeric( str_replace( ',', '', $this->value ) ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/email_not_empty/validation_email_not_empty.php000066600000002627152141561100020202 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid email for this option.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { if ( ! is_email( $this->value ) || ! isset( $this->value ) || empty( $this->value ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/numeric_not_empty/validation_numeric_not_empty.php000066600000002450152141561100021122 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a numerical value for this option.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { if ( ! is_numeric( $this->value ) || ! isset( $this->value ) || empty( $this->value ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/html/validation_html.php000066600000001736152141561100013540 0ustar00parent = $parent; $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { $this->value = wp_kses_post( $this->value ); } //function } //class }validation/email/validation_email.php000066600000002517152141561100014004 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid email for this option.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { if ( ! is_email( $this->value ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/css/validation_css.php000066600000002626152141561100013207 0ustar00parent = $parent; $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 3.0.0 */ function validate() { $data = $this->value; $data = wp_filter_nohtml_kses( $data ); $data = str_replace( '>', '>', $data ); $data = stripslashes($data); if ($data != $this->value) { $this->field['msg'] = __( 'Unsafe strings were found in your CSS and have been filtered out.', 'redux-framework' ); $this->warning = $this->field; } $this->value = $data; } //function } //class }validation/not_empty/validation_not_empty.php000066600000002561152141561100015661 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field cannot be empty. Please provide a value.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { if ( ! isset( $this->value ) || empty( $this->value ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/js/validation_js.php000066600000001712152141561100012652 0ustar00parent = $parent; $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { $this->value = $this->value; } //function } //class }validation/html_custom/validation_html_custom.php000066600000002125152141561100016515 0ustar00parent = $parent; $this->field = $field; $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and validates them * * @since ReduxFramework 1.0.0 */ function validate() { if (isset($this->field['allowed_html'])) { $this->value = wp_kses( $this->value, $this->field['allowed_html'] ); } } //function } //class }validation/colorrgba/validation_colorrgba.php000066600000005114152141561100015546 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' ); $this->value = $value; $this->current = $current; //$this->validate(); } //function /** * Validate Color to RGBA * Takes the user's input color value and returns it only if it's a valid color. * * @since ReduxFramework 3.0.3 */ function validate_colorrgba( $color ) { return $color; //$color = $value['color']; //$alpha = $value['alpha']; $alpha = '1.0'; if ( $color == "transparent" ) { return $hidden; } /* $color = str_replace('#','', $color); if (strlen($color) == 3) { $color = $color.$color; } if (preg_match('/^[a-f0-9]{6}$/i', $color)) { $color = '#' . $color; } */ return array( 'hex' => $color, 'alpha' => $alpha ); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 3.0.0 */ function validate() { $this->value = $this->validate_colorrgba( $this->value ); /* if(is_array($this->value)) { // If array foreach($this->value as $k => $value){ $this->value[$k] = $this->validate_colorrgba($value); }//foreach } else { // not array $this->value = $this->validate_colorrgba($this->value); } // END array check */ } //function } //class }validation/color_rgba/validation_color_rgba.php000066600000004472152141561100016052 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Validate Color to RGBA * Takes the user's input color value and returns it only if it's a valid color. * * @since ReduxFramework 3.0.3 */ function validate_color_rgba( $color ) { if ( $color == "transparent" ) { return $color; } $color = str_replace( '#', '', $color ); if ( strlen( $color ) == 3 ) { $color = $color . $color; } if ( preg_match( '/^[a-f0-9]{6}$/i', $color ) ) { $color = '#' . $color; } return array( 'hex' => $color, 'rgba' => Redux_Helpers::hex2rgba( $color ) ); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 3.0.0 */ function validate() { if ( is_array( $this->value ) ) { // If array foreach ( $this->value as $k => $value ) { $this->value[ $k ] = $this->validate_color_rgba( $value ); } //foreach } else { // not array $this->value = $this->validate_color_rgba( $this->value ); } // END array check } //function } //class }validation/date/validation_date.php000066600000003512152141561100013454 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid date.', 'redux-framework' ); $this->value = $value; $this->current = $current; $this->validate(); } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function validate() { $string = str_replace( '/', '', $this->value ); if ( ! is_numeric( $string ) ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; return; } if ( $this->value[2] != '/' ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; return; } if ( $this->value[5] != '/' ) { $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->error = $this->field; } } //function } //class }validation/unique_slug/validation_unique_slug.php000066600000006223152141561100016524 0ustar00parent = $parent; $this->field = $field; $this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'That URL slug is in use, please choose another. %s is open for use.', 'redux-framework' ); $this->field['flush_permalinks'] = ( isset( $this->field['flush_permalinks'] ) ) ? $this->field['flush_permalinks'] : false; $this->value = $value; $this->current = $current; $this->validate(); } //function function validate() { global $wpdb, $wp_rewrite; $slug = $this->value; $feeds = $wp_rewrite->feeds; if ( ! is_array( $feeds ) ) { $feeds = array(); } // Post slugs must be unique across all posts. $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug ) ); /** * Filter whether the post slug would be bad as a flat slug. * * @since 3.1.0 * * @param bool $bad_slug Whether the post slug would be bad as a flat slug. * @param string $slug The post slug. * @param string $post_type Post type. */ if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name ) ); $suffix ++; } while ( $post_name_check ); $slug = $alt_post_name; $this->value = ( isset( $this->current ) ) ? $this->current : ''; $this->field['msg'] = sprintf( $this->field['msg'], $slug ); $this->error = $this->field; } else if ( isset( $this->field['flush_permalinks'] ) && $this->field['flush_permalinks'] == true ) { add_action( 'init', array( $this, 'flush_permalinks' ), 99 ); } } //function function flush_permalinks() { flush_rewrite_rules(); } } //class } class.redux_functions.php000066600000026130152141561100011602 0ustar00args['dev_mode'] ) { $min = '.min'; } return $min; } /** * Sets a cookie. * Do nothing if unit testing. * * @since 3.5.4 * @access public * @return void * * @param string $name The cookie name. * @param string $value The cookie value. * @param integer $expire Expiry time. * @param string $path The cookie path. * @param string $domain The cookie domain. * @param boolean $secure HTTPS only. * @param boolean $httponly Only set cookie on HTTP calls. */ public static function setCookie( $name, $value, $expire = 0, $path, $domain = null, $secure = false, $httponly = false ) { if ( ! defined( 'WP_TESTS_DOMAIN' ) ) { setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly ); } } /** * Parse CSS from output/compiler array * * @since 3.2.8 * @access private * @return $css CSS string */ public static function parseCSS( $cssArray = array(), $style = '', $value = '' ) { // Something wrong happened if ( count( $cssArray ) == 0 ) { return; } else { //if ( count( $cssArray ) >= 1 ) { $css = ''; foreach ( $cssArray as $element => $selector ) { // The old way if ( $element === 0 ) { $css = self::theOldWay( $cssArray, $style ); return $css; } // New way continued $cssStyle = $element . ':' . $value . ';'; $css .= $selector . '{' . $cssStyle . '}'; } } return $css; } private static function theOldWay( $cssArray, $style ) { $keys = implode( ",", $cssArray ); $css = $keys . "{" . $style . '}'; return $css; } /** * initWpFilesystem - Initialized the Wordpress filesystem, if it already isn't. * * @since 3.2.3 * @access public * @return void */ public static function initWpFilesystem() { global $wp_filesystem; // Initialize the Wordpress filesystem, no more using file_put_contents function if ( empty( $wp_filesystem ) ) { require_once ABSPATH . '/wp-includes/pluggable.php'; require_once ABSPATH . '/wp-admin/includes/file.php'; WP_Filesystem(); } } /** * verFromGit - Retrives latest Redux version from GIT * * @since 3.2.0 * @access private * @return string $ver */ private static function verFromGit() { // Get the raw framework.php from github $gitpage = wp_remote_get( 'https://raw.github.com/ReduxFramework/redux-framework/master/ReduxCore/framework.php', array( 'headers' => array( 'Accept-Encoding' => '' ), 'sslverify' => true, 'timeout' => 300 ) ); // Is the response code the corect one? if ( ! is_wp_error( $gitpage ) ) { if ( isset( $gitpage['body'] ) ) { // Get the page text. $body = $gitpage['body']; // Find version line in framework.php $needle = 'public static $_version ='; $pos = strpos( $body, $needle ); // If it's there, continue. We don't want errors if $pos = 0. if ( $pos > 0 ) { // Look for the semi-colon at the end of the version line $semi = strpos( $body, ";", $pos ); // Error avoidance. If the semi-colon is there, continue. if ( $semi > 0 ) { // Extract the version line $text = substr( $body, $pos, ( $semi - $pos ) ); // Find the first quote around the veersion number. $quote = strpos( $body, "'", $pos ); // Extract the version number $ver = substr( $body, $quote, ( $semi - $quote ) ); // Strip off quotes. $ver = str_replace( "'", '', $ver ); return $ver; } } } } } /** * updateCheck - Checks for updates to Redux Framework * * @since 3.2.0 * @access public * * @param string $curVer Current version of Redux Framework * * @return void - Admin notice is diaplyed if new version is found */ public static function updateCheck( $curVer ) { // If no cookie, check for new ver if ( ! isset( $_COOKIE['redux_update_check'] ) ) { // || 1 == strcmp($_COOKIE['redux_update_check'], self::$_version)) { // actual ver number from git repo $ver = self::verFromGit(); // hour long cookie. setcookie( "redux_update_check", $ver, time() + 3600, '/' ); } else { // saved value from cookie. If it's different from current ver // we can still show the update notice. $ver = $_COOKIE['redux_update_check']; } // Set up admin notice on new version //if ( 1 == strcmp( $ver, $curVer ) ) { if ( version_compare( $ver, $curVer, '>' ) ) { self::$_parent->admin_notices[] = array( 'type' => 'updated', 'msg' => 'A new build of Redux is now available!

Your version: ' . $curVer . '
New version: ' . $ver . '

If you are not a developer, your theme/plugin author shipped with dev_mode on. Contact them to fix it, but in the meantime you can use our dev_mode disabler.

Get it now  |', 'id' => 'dev_notice_' . $ver, 'dismiss' => true, ); } } public static function tru( $string, $opt_name ) { $redux = ReduxFrameworkInstances::get_instance( $opt_name ); $check = get_user_option( 'r_tru_u_x', array() ); if ( ! empty( $check ) && ( isset( $check['expires'] ) < time() ) ) { $check = array(); } //if ( isset( $redux->args['dev_mode'] ) && $redux->args['dev_mode'] == true && ! ( isset( $redux->args['forced_dev_mode_off'] ) && $redux->args['forced_dev_mode_off'] == true ) ) { if ( isset( $redux->args['dev_mode'] ) && $redux->args['dev_mode'] == true ) { update_user_option( get_current_user_id(), 'r_tru_u_x', array( 'id' => '', 'expires' => 60 * 60 * 24 ) ); return apply_filters( 'redux/' . $opt_name . '/aURL_filter', '' ); } else { if ( empty( $check ) ) { $check = @wp_remote_get( 'http://look.reduxframework.com/status.php?p=' . ReduxFramework::$_is_plugin ); $check = json_decode( wp_remote_retrieve_body( $check ), true ); if ( ! empty( $check ) && isset( $check['id'] ) ) { update_user_option( get_current_user_id(), 'r_tru_u_x', $check ); } } $check = isset( $check['id'] ) ? $check['id'] : $check; if ( ! empty( $check ) ) { return apply_filters( 'redux/' . $opt_name . '/aURL_filter', '' ); } else { return ""; } } } public static function dat($fname, $opt_name){ $name = apply_filters('redux/' . $opt_name . '/aDBW_filter', $fname); return $name; } public static function bub($fname, $opt_name){ $name = apply_filters('redux/' . $opt_name . '/aNF_filter', $fname); return $name; } public static function yo($fname, $opt_name){ $name = apply_filters('redux/' . $opt_name . '/aNFM_filter', $fname); return $name; } } } welcome/views/about.php000066600000007632152141561100011167 0ustar00

display_version ); ?>

display_version ); ?>
actions(); ?> tabs(); ?>

Ajax Saving & More Speed!

This version the fastest Redux ever released. We've integrated ajax_saving as well as many other speed improvements to make Redux even surpass the load time of SMOF even with large panels.

The New Redux API

We've gone back to the drawing boards and made Redux the simplest framework to use. Introducing the Redux API. Easily add fields, extensions, templates, and more without every having to define a class! Learn More

Security Improvments

Thanks to the help of James Golovich (Pritect), we have patched varying security flaws in Redux. This is the most secure version of Redux yet!

Panel Templates

Now developers can easily customize the Redux panel by declaring a templates location path. We've also made use of template versioning so if we change anything, you will know.
Learn More

Full Width for ANY Field

Any field can now be set to full width! Just set the full_width argument and your field will expand to the full width of your panel or metabox.

Elusive Icons Update

Redux is now taking over development of Elusive Icons. As a result, we've refreshed our copy of Elusive to the newest version.

welcome/views/credits.php000066600000002020152141561100011474 0ustar00

actions(); ?> tabs(); ?>

Contribute to Redux.', 'redux-framework' ), 'https://github.com/reduxframework/redux-framework/blob/master/CONTRIBUTING.md' );?>

contributors()); ?>
welcome/views/status_report.php000066600000131344152141561100012771 0ustar00

actions(); ?> tabs(); ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?>
: uploads directory. This directory must be writable.', 'redux-framework' ) . '">[?]'; ?> ' . '✔ ' . esc_html($sysinfo['redux_data_dir']) . ' '; } else { printf( '' . '✕ ' . __( 'To allow data saving, make %s writable.', 'redux-framework' ) . '', esc_html($sysinfo['redux_data_dir']) ); } ?>
: [?]'; ?> ' . esc_url($sysinfo['wp_content_url']) . ' '; ?>
: [?]'; ?>
: [?]'; ?>
: Permalinks.', 'redux-framework' ) . '">[?]'; ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?> ' . sprintf( __( '%s - We recommend setting memory to at least 40MB. See: Increasing memory allocated to PHP', 'redux-framework' ), esc_html($sysinfo['wp_mem_limit']['size']), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . ''; } else { echo '' . esc_html($sysinfo['wp_mem_limit']['size']) . ''; } ?>
: [?]'; ?>
: [?]'; ?> ' . '✔' . ''; } else { echo '' . '–' . ''; } ?>
: [?]'; ?>
: [?]'; ?> $value ) { echo '' . esc_html(ucfirst( $key )) . ': ' . esc_html($value) . '
'; } ?>
[?]'; if ( $sysinfo['fsockopen_curl'] === 'true' ) { $posting['fsockopen_curl']['success'] = true; } else { $posting['fsockopen_curl']['success'] = false; $posting['fsockopen_curl']['note'] = esc_html__( 'Your server does not have fsockopen or cURL enabled - cURL is used to communicate with other servers. Please contact your hosting provider.', 'redux-framework' ) . ''; } /* // SOAP $posting['soap_client']['name'] = 'SoapClient'; $posting['soap_client']['help'] = '[?]'; if ( $sysinfo['soap_client'] == true ) { $posting['soap_client']['success'] = true; } else { $posting['soap_client']['success'] = false; $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the SOAP Client class enabled - some gateway plugins which use SOAP may not work as expected.', 'redux-framework' ), 'http://php.net/manual/en/class.soapclient.php' ) . ''; } // DOMDocument $posting['dom_document']['name'] = 'DOMDocument'; $posting['dom_document']['help'] = '[?]'; if ( $sysinfo['dom_document'] == true ) { $posting['dom_document']['success'] = true; } else { $posting['dom_document']['success'] = false; $posting['dom_document']['note'] = sprintf( __( 'Your server does not have the DOMDocument class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'redux-framework' ), 'http://php.net/manual/en/class.domdocument.php' ) . ''; } */ //// GZIP //$posting['gzip']['name'] = 'GZip'; //$posting['gzip']['help'] = '[?]'; // //if ( $sysinfo['gzip'] == true ) { // $posting['gzip']['success'] = true; //} else { // $posting['gzip']['success'] = false; // $posting['gzip']['note'] = sprintf( __( 'Your server does not support the gzopen function - this is required to use the GeoIP database from MaxMind. The API fallback will be used instead for geolocation.', 'redux-framework' ), 'http://php.net/manual/en/zlib.installation.php' ) . ''; //} // WP Remote Post Check $posting['wp_remote_post']['name'] = esc_html__( 'Remote Post', 'redux-framework' ); $posting['wp_remote_post']['help'] = '[?]'; if ( $sysinfo['wp_remote_post'] === 'true' ) { $posting['wp_remote_post']['success'] = true; } else { $posting['wp_remote_post']['note'] = esc_html__( 'wp_remote_post() failed. Many advanced features may not function. Contact your hosting provider.', 'redux-framework' ); if ( $sysinfo['wp_remote_post_error'] ) { $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'redux-framework' ), redux_clean( $sysinfo['wp_remote_post_error'] ) ); } $posting['wp_remote_post']['success'] = false; } // WP Remote Get Check $posting['wp_remote_get']['name'] = esc_html__( 'Remote Get', 'redux-framework' ); $posting['wp_remote_get']['help'] = '[?]'; if ( $sysinfo['wp_remote_get'] === 'true' ) { $posting['wp_remote_get']['success'] = true; } else { $posting['wp_remote_get']['note'] = esc_html__( 'wp_remote_get() failed. This is needed to get information from remote servers. Contact your hosting provider.', 'redux-framework' ); if ( $sysinfo['wp_remote_get_error'] ) { $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'redux-framework' ), redux_clean( $sysinfo['wp_remote_get_error'] ) ); } $posting['wp_remote_get']['success'] = false; } $posting = apply_filters( 'redux_debug_posting', $posting ); foreach ( $posting as $post ) { $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; ?>
: [?]'; ?>
: [?]'; ?> ' . '✔' . ''; } else { echo '' . '–' . ''; } ?>
: [?]'; ?>
: [?]'; ?> ' . esc_html($sysinfo['abspath']) . ''; ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?> ' . '✔' . ''; } else { echo '' . '–' . ''; } ?>
: [?]'; ?> ' . '✔' . ''; } else { echo '' . '–' . ''; } ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?> ' . '✕ ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'redux-framework' ), esc_html(date_default_timezone_get()) ) . ''; } else { echo '' . '✔' . ''; } ?>
:
$plugin_data ) { $version_string = ''; $network_string = ''; if ( ! empty( $plugin_data['Name'] ) ) { // link the plugin name to the plugin url if available $plugin_name = esc_html( $plugin_data['Name'] ); if ( ! empty( $plugin_data['PluginURI'] ) ) { $plugin_name = '' . esc_html($plugin_name) . ''; } ?>
()
 
$data ) { $inst_name = ucwords( str_replace( array( '_', '-' ), ' ', $inst ) ); $args = $data['args']; ?> $found_plugin_files ) { ?>
opt_name: [?]'; ?>
global_variable: [?]'; ?>
dev_mode: [?]'; ?> ' . '✔' . '' : '' . '–' . ''; ?>
ajax_save: [?]'; ?> ' . '✔' . '' : '' . '–' . ''; ?>
page_slug: [?]'; ?>
page_permissions: [?]'; ?>
menu_type: [?]'; ?>
page_parent: [?]'; ?>
compiler: [?]'; ?> ' . '✔' . '' : '' . '–' . ''; ?>
output: [?]'; ?> ' . '✔' . '' : '' . '–' . ''; ?>
output_tag: [?]'; ?> ' . '✔' . '' : '' . '–' . ''; ?>
template_path: [?]'; ?> ' . esc_html($args['templates_path']) . ''; ?>
Templates: [?]'; ?> ', $found_plugin_files ); ?>
Extensions [?]'; ?> $arr ) { $ver = $arr['version']; echo '' . ucwords( str_replace( array( '_', '-' ), ' ', $name ) ) . ' - ' . esc_html($ver); ?>
: [?]'; ?>
: [?]'; ?> Version, '!=' ) ) { echo ' – ' . esc_html($theme_version_data['version']) . ' ' . esc_html__( 'is available', 'redux-framework' ) . ''; } ?>
: [?]'; ?>
: [?]'; ?> ' . '✔' . '' : '✕
' . sprintf( __( 'If you\'re modifying Redux Framework or a parent theme you didn\'t build personally, we recommend using a child theme. See: How to create a child theme', 'redux-framework' ), 'http://codex.wordpress.org/Child_Themes' ) . ''; ?>
: [?]'; ?>
: [?]'; ?>
: [?]'; ?>
welcome/views/support.php000066600000016345152141561100011572 0ustar00

actions(); ?> tabs(); ?>

Status tab.', 'redux-framework' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'tools.php?page=redux-status' ) ) ); ?>





'; foreach ( $redux as $panel ) { echo ' ' . esc_html($panel->args['display_name']) . ''; if ( ! empty( $panel->args['display_version'] ) ) { echo ' v' . esc_html($panel->args['display_version']); } echo ' 
'; } echo '
'; } ?>

following article before asking for support from us directly.', 'redux-framework' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( 'http://docs.reduxframework.com/core/support-defined/' ) );?>

welcome/views/changelog.php000066600000001463152141561100012000 0ustar00

actions(); ?> tabs(); ?>
parse_readme()); ?>
welcome/views/extensions.php000066600000012325152141561100012247 0ustar00 social profiles => js button => multi media => css layout => color schemes => adjust-alt custom fonts => fontsize code mirror => view-mode live search => search support faq's => question date time picker => premium support => metaboxes => widget areas => shortcodes => icon select => gallery tracking => * */ $iconMap = array( 'repeater' => 'tags', 'social-profiles' => 'group', 'js-button' => 'hand-down', 'multi-media' => 'picture', 'css-layout' => 'fullscreen', 'color-schemes' => 'adjust-alt', 'custom-fonts' => 'fontsize', //'codemirror' => 'view-mode', 'live-search' => 'search', 'support-faqs' => 'question', 'date-time' => 'calendar', 'premium-support' => 'fire', 'metaboxes' => 'magic', 'widget-areas' => 'inbox-box', 'shortcodes' => 'shortcode', 'icon-select' => 'gallery', 'accordion' => 'lines' ); $colors = array( '8CC63F', '8CC63F', '0A803B', '25AAE1', '0F75BC', 'F7941E', 'F1592A', 'ED217C', 'BF1E2D', '8569CF', '0D9FD8', '8AD749', 'EECE00', 'F8981F', 'F80E27', 'F640AE' ); shuffle( $colors ); echo ''; $color = 1; ?>

display_version) ); ?>
actions(); ?> tabs(); ?>

$extension ) { ?>
welcome/css/redux-welcome.scss000066600000042307152141561100012452 0ustar00$green: #7ad03a; $red: #a00; $orange: #ffba00; $blue: #2ea2cc; .about-wrap { &.redux-status { .updated, .error { margin-top: 10px; } .updated { &.redux-message { display: block !important; } } .redux-message { position: relative; border-left-color: #00A2E3 !important; overflow: hidden; a.skip, a.docs { opacity: 0.5; text-decoration: none !important; } } #debug-report { display: none; margin: 10px 0; padding: 0; position: relative; textarea { font-family: monospace; width: 100%; margin: 0; height: 300px; padding: 20px; -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; resize: none; font-size: 12px; line-height: 20px; outline: 0; } } table.redux_status_table { margin-bottom: 1em; tr { &:nth-child(2n) { th, td { background: #fcfcfc; } } } th { font-weight: 700; padding: 9px; } td:first-child { width: 33%; } td.help { width: 1em; } td { padding: 9px; //font-size: 1.1em; mark { background: transparent none; } mark.yes { color: $green; } mark.no { color: #999; } mark.error { color: $red; } ul { margin: 0; } } .redux-hint-qtip { cursor: help; } } } } .about-wrap { #footer-upgrade { display: none;; } .redux-badge { position: absolute; top: 0; background: #00A2E3; padding: 20px; color: #efefef; margin: 5px 0 0 0; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .2); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); &:before { color: #fff; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-size: 80px; font-weight: normal; width: 165px; height: 165px; line-height: 165px; text-align: center; position: absolute; top: 0; margin: 0; vertical-align: middle; } .el { background: #00A2E3; display: block !important; font-size: 8em; color: #fff; margin-bottom: 30px; } span { font-weight: 600; font-size: 14px; text-align: center; position: absolute; bottom: 0; background: rgba(50, 50, 49, 0.47); left: 0; right: 0; padding: 8px; } } .redux-feature { overflow: visible !important; *zoom: 1; &:before, &:after { content: " "; display: table; } &:after { clear: both; } } h3 + .redux-feature { margin-top: 0; } .feature-rest div { width: 50% !important; -moz-box-sizing: border-box; box-sizing: border-box; margin: 0 !important; &.icon:before { font-weight: normal; width: 100%; font-size: 170px; line-height: 125px; color: #9c5d90; display: inline-block; position: relative; text-align: center; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } } div.icon { width: 0 !important; padding: 0; margin: 20px 0 !important; } .about-integrations { background: #fff; margin: 20px 0; padding: 1px 20px 10px; } .changelog { h2 { line-height: 1.4; padding-bottom: 0;; } .feature-section { padding-top: 1.4em; } .prettyprint { overflow-wrap: break-word; } .gist-it-gist { .gist-file { border: 0 !important; background: 0 !important; .gist-data { border: 0 !important; background: 0 !important; pre { padding-top: 10px !important; word-break: break-word; } } } } } .theme-screenshot { color: #eee; transition: all 0.5s; &:hover { color: #fff; } i { text-align: center; display: block; margin: 10px; font-size: 90px; line-height: 200px; transition: all 0.5s ease; } } .theme-browser { .theme { transition: all 0.5s; &:hover .theme-screenshot i { transition: all 0.5s; font-size: 120px; } .theme-screenshot:after { content: inherit; display: inherit; padding-top: inherit; } } } .theme-screenshot { figure { position: relative; overflow: hidden; cursor: pointer; margin: 0; i { position: relative; display: block; font-size: 11em; opacity: 0.8; } figcaption { padding: 15px; color: #fff; text-transform: uppercase; font-size: 1.25em; -webkit-backface-visibility: hidden; backface-visibility: hidden; &:before, &:after { pointer-events: none; } } figcaption, figcaption > a { position: absolute; top: 0; left: 0; right: 0; bottom: 0; } figcaption > a { z-index: 1000; text-indent: 200%; white-space: nowrap; font-size: 0; opacity: 0; } p { margin: 0; letter-spacing: 1px; font-size: 68.5%; } i { opacity: 0.7; -webkit-transition: opacity 0.35s; transition: opacity 0.35s; } } } .theme:hover { figcaption { &::before, &::after { opacity: 1; -webkit-transform: scale(1); transform: scale(1); } } i { opacity: 0.3; } p { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); text-shadow: 2px 2px 1px rgba(0, 0, 0, .3); } } figure { figcaption { &::before, &::after { position: absolute; top: 15px; right: 15px; bottom: 15px; left: 15px; content: ''; opacity: 0; -webkit-transition: opacity 0.35s, -webkit-transform 0.35s; transition: opacity 0.35s, transform 0.35s; } &::before { border-top: 1px solid #fff; border-bottom: 1px solid #fff; -webkit-transform: scale(0, 1); transform: scale(0, 1); } &::after { border-right: 1px solid #fff; border-left: 1px solid #fff; -webkit-transform: scale(1, 0); transform: scale(1, 0); } } p { padding: 10px; text-transform: none; opacity: 0; margin-top: 0 !important; -webkit-transition: opacity 0.35s, -webkit-transform 0.35s; transition: opacity 0.35s, transform 0.35s; -webkit-transform: translate3d(0, 20px, 0); transform: translate3d(0, 20px, 0); } } } .redux-message, p.redux-actions { .twitter-share-button { margin-top: -3px; margin-left: 3px; vertical-align: middle; } a { &.donate, &.review-us { opacity: .5; text-decoration: none !important; } } } #redux-message { margin-top: 15px !important; display: block !important; margin: 5px 0 15px; border-color: #00A2E3; h4 { margin-top: .5em; } } @media only screen and (min-width: 2000px) { #wpwrap .theme-browser .theme:nth-child(4n), #wpwrap .theme-browser .theme:nth-child(5n) { margin-right: 3%; } } @media screen and (max-width: 500px) { .about-wrap h2 .nav-tab { width: 100%; margin: 0; padding: 0; height: 40px; line-height: 40px; text-align: center; margin-bottom: 10px; margin-top: 10px; } .about-wrap h2.nav-tab-wrapper { padding: 0; width: 100%; } } @media only screen and (max-width: 1120px) { .theme-browser .theme:nth-child(odd) { margin-right: 5% !important; } .theme-browser .theme { width: 47.5% !important; margin-right: auto !important; } } @media screen and (max-width: 620px) { .theme-browser .theme { width: 100% !important; margin-right: 0; } } #support_div { input.hash { text-align: center; } .hide { display: none; } .previous { opacity: .8; } /*form styles*/ #supportform { /*width: 500px;*/ margin-top: 10px; text-align: center; position: relative; fieldset { background: white; border: 0 none; border-radius: 3px; box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4); padding: 20px 30px; box-sizing: border-box; width: 86%; margin: 0 7%; /*stacking fieldsets above each other*/ position: absolute; /*Hide all except first fieldset*/ &:not(:first-of-type) { display: none; } } /*inputs*/ input, textarea { padding: 15px; border: 1px solid #ccc; border-radius: 3px; margin-bottom: 10px; width: 100%; box-sizing: border-box; font-family: montserrat; color: #2C3E50; font-size: 13px; } input.checkbox { width: initial; margin-top: 10px; } /*buttons*/ .action-button { width: 100px; background: #27AE60; font-weight: bold; color: white; border: 0 none; border-radius: 1px; cursor: pointer; padding: 10px 5px; margin: 10px 5px; &:disabled { opacity: .5; } &:hover, &:focus { box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60; } } /*headings*/ .fs-title { font-size: 15px; text-transform: uppercase; color: #2C3E50; margin-bottom: 10px; } .fs-subtitle { font-weight: normal; font-size: 13px; text-align: left; color: #666; margin-bottom: 20px; } #toDebug li { text-align: left; width: 45%; float: left; } #user_type { width: 100%; td { cursor: pointer; width: 50%; i { font-size: 130px; margin-bottom: 10px; } &:hover i { color: #176C8E; } small { line-height: 2.5em; font-style: italic; } } } #support_hash { text-align: center; word-break: break-all; } } .breadcrumb { /*centering*/ display: inline-block; box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.35); overflow: hidden; border-radius: 5px; margin: 15px 0; /*Lets add the numbers for each link using CSS counters. flag is the name of the counter. to be defined using counter-reset in the parent element of the links*/ counter-reset: flag; li { text-decoration: none; outline: none; display: block; float: left; font-size: 12px; transition: all 0.5s; width: auto; margin: 0; line-height: 36px; color: white; /*need more margin on the left of links to accomodate the numbers*/ padding: 0 10px 0 60px; background: #666; //background: linear-gradient(#666, #333); position: relative; /*since the first link does not have a triangle before it we can reduce the left padding to make it look consistent with other links*/ &:first-child { padding-left: 46px; border-radius: 5px 0 0 5px; /*to match with the parent's radius*/ &:before { left: 14px; } } &:last-child { border-radius: 0 5px 5px 0; /*this was to prevent glitches on hover*/ padding-right: 20px; /*we dont need an arrow after the last link*/ &:after { content: none; } } &.active { background: #333; //background: linear-gradient(#333, #000); &:after { background: #333; //background: linear-gradient(135deg, #333, #000); } &:before { background: #555; } } /*adding the arrows for the breadcrumbs using rotated pseudo elements*/ &:after { content: ''; position: absolute; top: 0; right: -18px; /*half of square's length*/ /*same dimension as the line-height of .breadcrumb a */ width: 36px; height: 36px; /*as you see the rotated square takes a larger height. which makes it tough to position it properly. So we are going to scale it down so that the diagonals become equal to the line-height of the link. We scale it to 70.7% because if square's: length = 1; diagonal = (1^2 + 1^2)^0.5 = 1.414 (pythagoras theorem) if diagonal required = 1; length = 1/1.414 = 0.707*/ transform: scale(0.707) rotate(45deg); /*we need to prevent the arrows from getting buried under the next link*/ z-index: 1; /*background same as links but the gradient will be rotated to compensate with the transform applied*/ background: #666; //background: linear-gradient(135deg, #666, #333); /*stylish arrow design using box shadow*/ box-shadow: 2px -2px 0 2px rgba(0, 0, 0, 0.4), 3px -3px 0 2px rgba(255, 255, 255, 0.1); /* 5px - for rounded arrows and 50px - to prevent hover glitches on the border created using shadows*/ border-radius: 0 5px 0 50px; transition: all 0.5s; } /*we will use the :before element to show numbers*/ &:before { transition: all 0.5s; content: counter(flag); counter-increment: flag; /*some styles now*/ border-radius: 100%; width: 20px; height: 20px; line-height: 20px; margin: 8px 0; position: absolute; top: 0; left: 30px; background: #444; //background: linear-gradient(#444, #222); font-weight: bold; } } } }welcome/css/redux-welcome.css000066600000024575152141561100012276 0ustar00.about-wrap.redux-status .updated,.about-wrap.redux-status .error{margin-top:10px}.about-wrap.redux-status .updated.redux-message{display:block !important}.about-wrap.redux-status .redux-message{position:relative;border-left-color:#00A2E3 !important;overflow:hidden}.about-wrap.redux-status .redux-message a.skip,.about-wrap.redux-status .redux-message a.docs{opacity:0.5;text-decoration:none !important}.about-wrap.redux-status #debug-report{display:none;margin:10px 0;padding:0;position:relative}.about-wrap.redux-status #debug-report textarea{font-family:monospace;width:100%;margin:0;height:300px;padding:20px;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;resize:none;font-size:12px;line-height:20px;outline:0}.about-wrap.redux-status table.redux_status_table{margin-bottom:1em}.about-wrap.redux-status table.redux_status_table tr:nth-child(2n) th,.about-wrap.redux-status table.redux_status_table tr:nth-child(2n) td{background:#fcfcfc}.about-wrap.redux-status table.redux_status_table th{font-weight:700;padding:9px}.about-wrap.redux-status table.redux_status_table td:first-child{width:33%}.about-wrap.redux-status table.redux_status_table td.help{width:1em}.about-wrap.redux-status table.redux_status_table td{padding:9px}.about-wrap.redux-status table.redux_status_table td mark{background:transparent none}.about-wrap.redux-status table.redux_status_table td mark.yes{color:#7ad03a}.about-wrap.redux-status table.redux_status_table td mark.no{color:#999}.about-wrap.redux-status table.redux_status_table td mark.error{color:#a00}.about-wrap.redux-status table.redux_status_table td ul{margin:0}.about-wrap.redux-status table.redux_status_table .redux-hint-qtip{cursor:help}.about-wrap #footer-upgrade{display:none}.about-wrap .redux-badge{position:absolute;top:0;background:#00A2E3;padding:20px;color:#efefef;margin:5px 0 0 0;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.2);box-shadow:0 1px 3px rgba(0,0,0,0.2)}.about-wrap .redux-badge:before{color:#fff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:80px;font-weight:normal;width:165px;height:165px;line-height:165px;text-align:center;position:absolute;top:0;margin:0;vertical-align:middle}.about-wrap .redux-badge .el{background:#00A2E3;display:block !important;font-size:8em;color:#fff;margin-bottom:30px}.about-wrap .redux-badge span{font-weight:600;font-size:14px;text-align:center;position:absolute;bottom:0;background:rgba(50,50,49,0.47);left:0;right:0;padding:8px}.about-wrap .redux-feature{overflow:visible !important;*zoom:1}.about-wrap .redux-feature:before,.about-wrap .redux-feature:after{content:" ";display:table}.about-wrap .redux-feature:after{clear:both}.about-wrap h3+.redux-feature{margin-top:0}.about-wrap .feature-rest div{width:50% !important;-moz-box-sizing:border-box;box-sizing:border-box;margin:0 !important}.about-wrap .feature-rest div.icon:before{font-weight:normal;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.about-wrap div.icon{width:0 !important;padding:0;margin:20px 0 !important}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h2{line-height:1.4;padding-bottom:0}.about-wrap .changelog .feature-section{padding-top:1.4em}.about-wrap .changelog .prettyprint{overflow-wrap:break-word}.about-wrap .changelog .gist-it-gist .gist-file{border:0 !important;background:0 !important}.about-wrap .changelog .gist-it-gist .gist-file .gist-data{border:0 !important;background:0 !important}.about-wrap .changelog .gist-it-gist .gist-file .gist-data pre{padding-top:10px !important;word-break:break-word}.about-wrap .theme-screenshot{color:#eee;transition:all 0.5s}.about-wrap .theme-screenshot:hover{color:#fff}.about-wrap .theme-screenshot i{text-align:center;display:block;margin:10px;font-size:90px;line-height:200px;transition:all 0.5s ease}.about-wrap .theme-browser .theme{transition:all 0.5s}.about-wrap .theme-browser .theme:hover .theme-screenshot i{transition:all 0.5s;font-size:120px}.about-wrap .theme-browser .theme .theme-screenshot:after{content:inherit;display:inherit;padding-top:inherit}.about-wrap .theme-screenshot figure{position:relative;overflow:hidden;cursor:pointer;margin:0}.about-wrap .theme-screenshot figure i{position:relative;display:block;font-size:11em;opacity:0.8}.about-wrap .theme-screenshot figure figcaption{padding:15px;color:#fff;text-transform:uppercase;font-size:1.25em;-webkit-backface-visibility:hidden;backface-visibility:hidden}.about-wrap .theme-screenshot figure figcaption:before,.about-wrap .theme-screenshot figure figcaption:after{pointer-events:none}.about-wrap .theme-screenshot figure figcaption,.about-wrap .theme-screenshot figure figcaption>a{position:absolute;top:0;left:0;right:0;bottom:0}.about-wrap .theme-screenshot figure figcaption>a{z-index:1000;text-indent:200%;white-space:nowrap;font-size:0;opacity:0}.about-wrap .theme-screenshot figure p{margin:0;letter-spacing:1px;font-size:68.5%}.about-wrap .theme-screenshot figure i{opacity:0.7;-webkit-transition:opacity 0.35s;transition:opacity 0.35s}.about-wrap .theme:hover figcaption::before,.about-wrap .theme:hover figcaption::after{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.about-wrap .theme:hover i{opacity:0.3}.about-wrap .theme:hover p{opacity:1;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);text-shadow:2px 2px 1px rgba(0,0,0,0.3)}.about-wrap figure figcaption::before,.about-wrap figure figcaption::after{position:absolute;top:15px;right:15px;bottom:15px;left:15px;content:'';opacity:0;-webkit-transition:opacity 0.35s, -webkit-transform 0.35s;transition:opacity 0.35s, transform 0.35s}.about-wrap figure figcaption::before{border-top:1px solid #fff;border-bottom:1px solid #fff;-webkit-transform:scale(0, 1);transform:scale(0, 1)}.about-wrap figure figcaption::after{border-right:1px solid #fff;border-left:1px solid #fff;-webkit-transform:scale(1, 0);transform:scale(1, 0)}.about-wrap figure p{padding:10px;text-transform:none;opacity:0;margin-top:0 !important;-webkit-transition:opacity 0.35s, -webkit-transform 0.35s;transition:opacity 0.35s, transform 0.35s;-webkit-transform:translate3d(0, 20px, 0);transform:translate3d(0, 20px, 0)}.redux-message .twitter-share-button,p.redux-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.redux-message a.donate,.redux-message a.review-us,p.redux-actions a.donate,p.redux-actions a.review-us{opacity:.5;text-decoration:none !important}#redux-message{margin-top:15px !important;display:block !important;margin:5px 0 15px;border-color:#00A2E3}#redux-message h4{margin-top:.5em}@media only screen and (min-width: 2000px){#wpwrap .theme-browser .theme:nth-child(4n),#wpwrap .theme-browser .theme:nth-child(5n){margin-right:3%}}@media screen and (max-width: 500px){.about-wrap h2 .nav-tab{width:100%;margin:0;padding:0;height:40px;line-height:40px;text-align:center;margin-bottom:10px;margin-top:10px}.about-wrap h2.nav-tab-wrapper{padding:0;width:100%}}@media only screen and (max-width: 1120px){.theme-browser .theme:nth-child(odd){margin-right:5% !important}.theme-browser .theme{width:47.5% !important;margin-right:auto !important}}@media screen and (max-width: 620px){.theme-browser .theme{width:100% !important;margin-right:0}}#support_div input.hash{text-align:center}#support_div .hide{display:none}#support_div .previous{opacity:.8}#support_div #supportform{margin-top:10px;text-align:center;position:relative}#support_div #supportform fieldset{background:white;border:0 none;border-radius:3px;box-shadow:0 0 15px 1px rgba(0,0,0,0.4);padding:20px 30px;box-sizing:border-box;width:86%;margin:0 7%;position:absolute}#support_div #supportform fieldset:not(:first-of-type){display:none}#support_div #supportform input,#support_div #supportform textarea{padding:15px;border:1px solid #ccc;border-radius:3px;margin-bottom:10px;width:100%;box-sizing:border-box;font-family:montserrat;color:#2C3E50;font-size:13px}#support_div #supportform input.checkbox{width:initial;margin-top:10px}#support_div #supportform .action-button{width:100px;background:#27AE60;font-weight:bold;color:white;border:0 none;border-radius:1px;cursor:pointer;padding:10px 5px;margin:10px 5px}#support_div #supportform .action-button:disabled{opacity:.5}#support_div #supportform .action-button:hover,#support_div #supportform .action-button:focus{box-shadow:0 0 0 2px white, 0 0 0 3px #27AE60}#support_div #supportform .fs-title{font-size:15px;text-transform:uppercase;color:#2C3E50;margin-bottom:10px}#support_div #supportform .fs-subtitle{font-weight:normal;font-size:13px;text-align:left;color:#666;margin-bottom:20px}#support_div #supportform #toDebug li{text-align:left;width:45%;float:left}#support_div #supportform #user_type{width:100%}#support_div #supportform #user_type td{cursor:pointer;width:50%}#support_div #supportform #user_type td i{font-size:130px;margin-bottom:10px}#support_div #supportform #user_type td:hover i{color:#176C8E}#support_div #supportform #user_type td small{line-height:2.5em;font-style:italic}#support_div #supportform #support_hash{text-align:center;word-break:break-all}#support_div .breadcrumb{display:inline-block;box-shadow:0 0 10px 1px rgba(0,0,0,0.35);overflow:hidden;border-radius:5px;margin:15px 0;counter-reset:flag}#support_div .breadcrumb li{text-decoration:none;outline:none;display:block;float:left;font-size:12px;transition:all 0.5s;width:auto;margin:0;line-height:36px;color:white;padding:0 10px 0 60px;background:#666;position:relative}#support_div .breadcrumb li:first-child{padding-left:46px;border-radius:5px 0 0 5px}#support_div .breadcrumb li:first-child:before{left:14px}#support_div .breadcrumb li:last-child{border-radius:0 5px 5px 0;padding-right:20px}#support_div .breadcrumb li:last-child:after{content:none}#support_div .breadcrumb li.active{background:#333}#support_div .breadcrumb li.active:after{background:#333}#support_div .breadcrumb li.active:before{background:#555}#support_div .breadcrumb li:after{content:'';position:absolute;top:0;right:-18px;width:36px;height:36px;transform:scale(0.707) rotate(45deg);z-index:1;background:#666;box-shadow:2px -2px 0 2px rgba(0,0,0,0.4),3px -3px 0 2px rgba(255,255,255,0.1);border-radius:0 5px 0 50px;transition:all 0.5s}#support_div .breadcrumb li:before{transition:all 0.5s;content:counter(flag);counter-increment:flag;border-radius:100%;width:20px;height:20px;line-height:20px;margin:8px 0;position:absolute;top:0;left:30px;background:#444;font-weight:bold} welcome/welcome.php000066600000054207152141561100010353 0ustar00redux_loaded ) { return; } $this->redux_loaded = true; add_action( 'admin_menu', array( $this, 'admin_menus' ) ); if ( isset( $_GET['page'] ) ) { if ( substr( $_GET['page'], 0, 6 ) == "redux-" ) { $version = explode( '.', ReduxFramework::$_version ); $this->display_version = $version[0] . '.' . $version[1]; add_filter( 'admin_footer_text', array( $this, 'change_wp_footer' ) ); add_action( 'admin_head', array( $this, 'admin_head' ) ); } else { $this->check_version(); } } else { $this->check_version(); } update_option( 'redux_version_upgraded_from', ReduxFramework::$_version ); set_transient( '_redux_activation_redirect', true, 30 ); } public function check_version() { global $pagenow; if ( $pagenow == "admin-ajax.php" || ( $GLOBALS['pagenow'] == "customize" && isset( $_GET['theme'] ) && ! empty( $_GET['theme'] ) ) ) { return; } $saveVer = Redux_Helpers::major_version( get_option( 'redux_version_upgraded_from' ) ); $curVer = Redux_Helpers::major_version( ReduxFramework::$_version ); $compare = false; if ( Redux_Helpers::isLocalHost() ) { $compare = true; } else if ( class_exists( 'ReduxFrameworkPlugin' ) ) { $compare = true; } else { $redux = ReduxFrameworkInstances::get_all_instances(); if ( is_array( $redux ) ) { foreach ( $redux as $panel ) { if ( $panel->args['dev_mode'] == 1 ) { $compare = true; break; } } } } if ( $compare ) { $redirect = false; if ( empty( $saveVer ) ) { $redirect = true; // First time } // Removing redirect except for the first time with the plugin installed. :) Less annoying until we actually use this page. //else if ( version_compare( $curVer, $saveVer, '>' ) ) { // $redirect = true; // Previous version //} if ( $redirect && ! defined( 'WP_TESTS_DOMAIN' ) && ReduxFramework::$_as_plugin ) { add_action( 'init', array( $this, 'do_redirect' ) ); } } } public function do_redirect() { if ( ! defined( 'WP_CLI' ) ) { wp_redirect( admin_url( 'tools.php?page=redux-about' ) ); exit(); } } public function change_wp_footer() { echo __( 'If you like Redux please leave us a ★★★★★ rating. A huge thank you from Redux in advance!', 'redux-framework' ); } public function support_hash() { if ( ! wp_verify_nonce( $_POST['nonce'], 'redux-support-hash' ) ) { die(); } $data = get_option( 'redux_support_hash' ); $data = wp_parse_args( $data, array( 'check' => '', 'identifier' => '' ) ); $generate_hash = true; $system_info = Redux_Helpers::compileSystemStatus(); $newHash = md5( json_encode( $system_info ) ); $return = array(); if ( $newHash == $data['check'] ) { unset( $generate_hash ); } $post_data = array( 'hash' => md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] ), 'site' => esc_url( home_url( '/' ) ), 'tracking' => Redux_Helpers::getTrackingObject(), 'system_status' => $system_info, ); //$post_data = json_encode( $post_data ); $post_data = serialize( $post_data ); if ( isset( $generate_hash ) && $generate_hash ) { $data['check'] = $newHash; $data['identifier'] = ""; $response = wp_remote_post( 'http://support.redux.io/v1/', array( 'method' => 'POST', 'timeout' => 65, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'compress' => true, 'headers' => array(), 'body' => array( 'data' => $post_data, 'serialize' => 1 ) ) ); if ( is_wp_error( $response ) ) { echo json_encode( array( 'status' => 'error', 'message' => $response->get_error_message() ) ); die( 1 ); } else { $response_code = wp_remote_retrieve_response_code( $response ); if ( $response_code == 200 ) { $response = wp_remote_retrieve_body( $response ); $return = json_decode( $response, true ); if ( isset( $return['identifier'] ) ) { $data['identifier'] = $return['identifier']; update_option( 'redux_support_hash', $data ); } } else { $response = wp_remote_retrieve_body( $response ); echo json_encode( array( 'status' => 'error', 'message' => $response ) ); } } } if ( ! empty( $data['identifier'] ) ) { $return['status'] = "success"; $return['identifier'] = $data['identifier']; } else { $return['status'] = "error"; $return['message'] = esc_html__( "Support hash could not be generated. Please try again later.", 'redux-framework' ); } echo json_encode( $return ); die( 1 ); } /** * Register the Dashboard Pages which are later hidden but these pages * are used to render the Welcome and Credits pages. * * @access public * @since 1.4 * @return void */ public function admin_menus() { $page = 'add_management_page'; // About Page $page( esc_html__( 'Welcome to Redux Framework', 'redux-framework' ), esc_html__( 'Redux Framework', 'redux-framework' ), $this->minimum_capability, 'redux-about', array( $this, 'about_screen' ) ); // Changelog Page $page( esc_html__( 'Redux Framework Changelog', 'redux-framework' ), esc_html__( 'Redux Framework Changelog', 'redux-framework' ), $this->minimum_capability, 'redux-changelog', array( $this, 'changelog_screen' ) ); // Support Page $page( esc_html__( 'Get Support', 'redux-framework' ), esc_html__( 'Get Support', 'redux-framework' ), $this->minimum_capability, 'redux-support', array( $this, 'get_support' ) ); // Support Page $page( esc_html__( 'Redux Extensions', 'redux-framework' ), esc_html__( 'Redux Extensions', 'redux-framework' ), $this->minimum_capability, 'redux-extensions', array( $this, 'redux_extensions' ) ); // Credits Page $page( esc_html__( 'The people that develop Redux Framework', 'redux-framework' ), esc_html__( 'The people that develop Redux Framework', 'redux-framework' ), $this->minimum_capability, 'redux-credits', array( $this, 'credits_screen' ) ); // Status Page $page( esc_html__( 'Redux Framework Status', 'redux-framework' ), esc_html__( 'Redux Framework Status', 'redux-framework' ), $this->minimum_capability, 'redux-status', array( $this, 'status_screen' ) ); //remove_submenu_page( 'tools.php', 'redux-about' ); remove_submenu_page( 'tools.php', 'redux-status' ); remove_submenu_page( 'tools.php', 'redux-changelog' ); remove_submenu_page( 'tools.php', 'redux-getting-started' ); remove_submenu_page( 'tools.php', 'redux-credits' ); remove_submenu_page( 'tools.php', 'redux-support' ); remove_submenu_page( 'tools.php', 'redux-extensions' ); } /** * Hide Individual Dashboard Pages * * @access public * @since 1.4 * @return void */ public function admin_head() { // Badge for welcome page //$badge_url = ReduxFramework::$_url . 'assets/images/redux-badge.png'; ?>

'; require_once 'views/about.php'; } /** * Render Changelog Screen * * @access public * @since 2.0.3 * @return void */ public function changelog_screen() { // Stupid hack for Wordpress alerts and warnings echo '

'; require_once 'views/changelog.php'; } /** * Render Changelog Screen * * @access public * @since 2.0.3 * @return void */ public function redux_extensions() { // Stupid hack for Wordpress alerts and warnings echo '

'; require_once 'views/extensions.php'; } /** * Render Get Support Screen * * @access public * @since 1.9 * @return void */ public function get_support() { // Stupid hack for Wordpress alerts and warnings echo '

'; require_once 'views/support.php'; } /** * Render Credits Screen * * @access public * @since 1.4 * @return void */ public function credits_screen() { // Stupid hack for Wordpress alerts and warnings echo '

'; require_once 'views/credits.php'; } /** * Render Status Report Screen * * @access public * @since 1.4 * @return void */ public function status_screen() { // Stupid hack for Wordpress alerts and warnings echo '

'; require_once 'views/status_report.php'; } /** * Parse the Redux readme.txt file * * @since 2.0.3 * @return string $readme HTML formatted readme file */ public function parse_readme() { if ( file_exists( ReduxFramework::$_dir . 'inc/fields/raw/parsedown.php' ) ) { require_once ReduxFramework::$_dir . 'inc/fields/raw/parsedown.php'; $Parsedown = new Parsedown(); $data = @wp_remote_get( ReduxFramework::$_url . '../CHANGELOG.md' ); if ( isset( $data ) && ! empty( $data ) ) { $data = @wp_remote_retrieve_body( $data ); return $Parsedown->text( trim( str_replace( '# Redux Framework Changelog', '', $data ) ) ); } } return ''; } public function actions() { ?>

Docs Review Us Donate

get_contributors(); if ( empty ( $contributors ) ) { return ''; } $contributor_list = ''; return $contributor_list; } /** * Retreive list of contributors from GitHub. * * @access public * @since 1.4 * @return array $contributors List of contributors */ public function get_contributors() { $contributors = get_transient( 'redux_contributors' ); if ( false !== $contributors ) { return $contributors; } $response = wp_remote_get( 'https://api.github.com/repos/ReduxFramework/redux-framework/contributors', array( 'sslverify' => false ) ); if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { return array(); } $contributors = json_decode( wp_remote_retrieve_body( $response ) ); if ( ! is_array( $contributors ) ) { return array(); } set_transient( 'redux_contributors', $contributors, 3600 ); return $contributors; } } new Redux_Welcome(); welcome/js/redux-welcome-admin.js000066600000026725152141561100013033 0ustar00(function( $ ) { 'use strict'; $.redux_welcome = $.redux_welcome || {}; $( document ).ready( function() { $.redux_welcome.initQtip(); if ( jQuery( document.getElementById( "support_div" ) ).is( ":visible" ) ) { $.redux_welcome.initSupportPage(); } $.redux_welcome.supportHash(); } ); $.redux_welcome.supportHash = function() { jQuery( "#support_hash" ).focus( function() { var $this = jQuery( this ); $this.select(); // Work around Chrome's little problem $this.mouseup( function() { // Prevent further mouseup intervention $this.unbind( "mouseup" ); return false; } ); } ); jQuery( '.redux_support_hash' ).click( function( e ) { var $button = jQuery( this ); if ( $button.hasClass( 'disabled' ) ) { return; } var $nonce = jQuery( '#redux_support_nonce' ).val(); $button.addClass( 'disabled' ); $button.parent().append( '' ); $button.closest( '.spinner' ).fadeIn(); if ( !window.console ) console = {}; console.log = console.log || function( name, data ) {}; jQuery.ajax( { type: "post", dataType: "json", url: ajaxurl, data: { action: "redux_support_hash", nonce: $nonce }, error: function( response ) { console.log( response ); $button.removeClass( 'disabled' ); $button.parent().find( '.spinner' ).remove(); alert( 'There was an error. Please try again later.' ); }, success: function( response ) { if ( response.status == "success" ) { jQuery( '#support_hash' ).val( 'http://support.redux.io/?id=' + response.identifier ); $button.parents( 'fieldset:first' ).find( '.next' ).removeAttr( 'disabled' ).click(); } else { console.log( response ); alert( 'There was an error. Please try again later.' ); } } } ); e.preventDefault(); } ); }; $.redux_welcome.initSupportPage = function() { //jQuery time var current_fs, next_fs, previous_fs; //fieldsets var left, opacity, scale; //fieldset properties which we will animate var animating; //flag to prevent quick multi-click glitches $.fn.actualHeight = function() { // find the closest visible parent and get it's hidden children var visibleParent = this.closest( ':visible' ).children(), thisHeight; // set a temporary class on the hidden parent of the element visibleParent.addClass( 'temp-show' ); // get the height thisHeight = this.height(); // remove the temporary class visibleParent.removeClass( 'temp-show' ); return thisHeight; }; function setHeight() { var $height = 0; jQuery( document ).find( '#support_div fieldset' ).each( function() { var $actual = $( this ).actualHeight(); if ( $height < $actual ) { $height = $actual; } } ); jQuery( '#support_div' ).height( $height + 20 ); } setHeight(); $( window ).on( 'resize', function() { setHeight(); } ); jQuery( '#is_user' ).click( function() { jQuery( '#final_support .is_user' ).show(); jQuery( '#final_support .is_developer' ).hide(); jQuery( this ).parents( 'fieldset:first' ).find( '.next' ).click(); } ); jQuery( '#is_developer' ).click( function() { jQuery( '#final_support .is_user' ).hide(); jQuery( '#final_support .is_developer' ).show(); jQuery( this ).parents( 'fieldset:first' ).find( '.next' ).click(); } ); jQuery( "#support_div .next" ).click( function() { if ( animating ) return false; animating = true; current_fs = jQuery( this ).parent(); next_fs = jQuery( this ).parent().next(); //activate next step on progressbar using the index of next_fs jQuery( "#progressbar li" ).eq( jQuery( "fieldset" ).index( next_fs ) ).addClass( "active" ); //show the next fieldset next_fs.show(); //hide the current fieldset with style current_fs.animate( {opacity: 0}, { step: function( now, mx ) { //as the opacity of current_fs reduces to 0 - stored in "now" //1. scale current_fs down to 80% scale = 1 - (1 - now) * 0.2; //2. bring next_fs from the right(50%) left = (now * 50) + "%"; //3. increase opacity of next_fs to 1 as it moves in opacity = 1 - now; current_fs.css( {'transform': 'scale(' + scale + ')'} ); next_fs.css( {'left': left, 'opacity': opacity} ); }, duration: 800, complete: function() { current_fs.hide(); animating = false; }, //this comes from the custom easing plugin easing: 'easeInOutBack' } ); } ); jQuery( "#support_div .previous" ).click( function() { if ( animating ) return false; animating = true; current_fs = jQuery( this ).parent(); previous_fs = jQuery( this ).parent().prev(); //de-activate current step on progressbar jQuery( "#progressbar li" ).eq( jQuery( "fieldset" ).index( current_fs ) ).removeClass( "active" ); //show the previous fieldset previous_fs.show(); //hide the current fieldset with style current_fs.animate( {opacity: 0}, { step: function( now, mx ) { //as the opacity of current_fs reduces to 0 - stored in "now" //1. scale previous_fs from 80% to 100% scale = 0.8 + (1 - now) * 0.2; //2. take current_fs to the right(50%) - from 0% left = ((1 - now) * 50) + "%"; //3. increase opacity of previous_fs to 1 as it moves in opacity = 1 - now; current_fs.css( {'left': left} ); previous_fs.css( {'transform': 'scale(' + scale + ')', 'opacity': opacity} ); }, duration: 800, complete: function() { current_fs.hide(); animating = false; }, //this comes from the custom easing plugin easing: 'easeInOutBack' } ); } ); } $.redux_welcome.initQtip = function() { if ( $().qtip ) { var shadow = 'qtip-shadow'; var color = 'qtip-dark'; var rounded = ''; var style = ''; //qtip-bootstrap'; var classes = shadow + ',' + color + ',' + rounded + ',' + style; classes = classes.replace( /,/g, ' ' ); // Get position data var myPos = 'top center'; var atPos = 'bottom center'; // Tooltip trigger action var showEvent = 'click'; var hideEvent = 'click mouseleave'; // Tip show effect var tipShowEffect = 'slide'; var tipShowDuration = '500'; // Tip hide effect var tipHideEffect = 'slide'; var tipHideDuration = '500'; $( '.redux-hint-qtip' ).each( function() { $( this ).qtip( { content: { text: $( this ).attr( 'qtip-content' ), title: $( this ).attr( 'qtip-title' ) }, show: { effect: function() { switch ( tipShowEffect ) { case 'slide': $( this ).slideDown( tipShowDuration ); break; case 'fade': $( this ).fadeIn( tipShowDuration ); break; default: $( this ).show(); break; } }, event: showEvent, }, hide: { effect: function() { switch ( tipHideEffect ) { case 'slide': $( this ).slideUp( tipHideDuration ); break; case 'fade': $( this ).fadeOut( tipHideDuration ); break; default: $( this ).show( tipHideDuration ); break; } }, event: hideEvent, }, style: { classes: classes, }, position: { my: myPos, at: atPos, }, } ); } ); } }; })( jQuery );welcome/js/jquery.easing.min.js000066600000012653152141561100012526 0ustar00/* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(ggetBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) { * echo 'You have FireFox version 2 or greater'; * } * * User Agents Sampled from: http://www.useragentstring.com/ * * This implementation is based on the original work from Gary White * http://apptools.com/phptools/browser/ * */ class Browser { private $_agent = ''; private $_browser_name = ''; private $_version = ''; private $_platform = ''; private $_os = ''; private $_is_aol = false; private $_is_mobile = false; private $_is_tablet = false; private $_is_robot = false; private $_is_facebook = false; private $_aol_version = ''; const BROWSER_UNKNOWN = 'unknown'; const VERSION_UNKNOWN = 'unknown'; const BROWSER_OPERA = 'Opera'; // http://www.opera.com/ const BROWSER_OPERA_MINI = 'Opera Mini'; // http://www.opera.com/mini/ const BROWSER_WEBTV = 'WebTV'; // http://www.webtv.net/pc/ const BROWSER_IE = 'Internet Explorer'; // http://www.microsoft.com/ie/ const BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // http://en.wikipedia.org/wiki/Internet_Explorer_Mobile const BROWSER_KONQUEROR = 'Konqueror'; // http://www.konqueror.org/ const BROWSER_ICAB = 'iCab'; // http://www.icab.de/ const BROWSER_OMNIWEB = 'OmniWeb'; // http://www.omnigroup.com/applications/omniweb/ const BROWSER_FIREBIRD = 'Firebird'; // http://www.ibphoenix.com/ const BROWSER_FIREFOX = 'Firefox'; // http://www.mozilla.com/en-US/firefox/firefox.html const BROWSER_ICEWEASEL = 'Iceweasel'; // http://www.geticeweasel.org/ const BROWSER_SHIRETOKO = 'Shiretoko'; // http://wiki.mozilla.org/Projects/shiretoko const BROWSER_MOZILLA = 'Mozilla'; // http://www.mozilla.com/en-US/ const BROWSER_AMAYA = 'Amaya'; // http://www.w3.org/Amaya/ const BROWSER_LYNX = 'Lynx'; // http://en.wikipedia.org/wiki/Lynx const BROWSER_SAFARI = 'Safari'; // http://apple.com const BROWSER_IPHONE = 'iPhone'; // http://apple.com const BROWSER_IPOD = 'iPod'; // http://apple.com const BROWSER_IPAD = 'iPad'; // http://apple.com const BROWSER_CHROME = 'Chrome'; // http://www.google.com/chrome const BROWSER_ANDROID = 'Android'; // http://www.android.com/ const BROWSER_GOOGLEBOT = 'GoogleBot'; // http://en.wikipedia.org/wiki/Googlebot const BROWSER_SLURP = 'Yahoo! Slurp'; // http://en.wikipedia.org/wiki/Yahoo!_Slurp const BROWSER_W3CVALIDATOR = 'W3C Validator'; // http://validator.w3.org/ const BROWSER_BLACKBERRY = 'BlackBerry'; // http://www.blackberry.com/ const BROWSER_ICECAT = 'IceCat'; // http://en.wikipedia.org/wiki/GNU_IceCat const BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // http://en.wikipedia.org/wiki/Web_Browser_for_S60 const BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform const BROWSER_MSN = 'MSN Browser'; // http://explorer.msn.com/ const BROWSER_MSNBOT = 'MSN Bot'; // http://search.msn.com/msnbot.htm const BROWSER_BINGBOT = 'Bing Bot'; // http://en.wikipedia.org/wiki/Bingbot const BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // http://browser.netscape.com/ (DEPRECATED) const BROWSER_GALEON = 'Galeon'; // http://galeon.sourceforge.net/ (DEPRECATED) const BROWSER_NETPOSITIVE = 'NetPositive'; // http://en.wikipedia.org/wiki/NetPositive (DEPRECATED) const BROWSER_PHOENIX = 'Phoenix'; // http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED) const PLATFORM_UNKNOWN = 'unknown'; const PLATFORM_WINDOWS = 'Windows'; const PLATFORM_WINDOWS_CE = 'Windows CE'; const PLATFORM_APPLE = 'Apple'; const PLATFORM_LINUX = 'Linux'; const PLATFORM_OS2 = 'OS/2'; const PLATFORM_BEOS = 'BeOS'; const PLATFORM_IPHONE = 'iPhone'; const PLATFORM_IPOD = 'iPod'; const PLATFORM_IPAD = 'iPad'; const PLATFORM_BLACKBERRY = 'BlackBerry'; const PLATFORM_NOKIA = 'Nokia'; const PLATFORM_FREEBSD = 'FreeBSD'; const PLATFORM_OPENBSD = 'OpenBSD'; const PLATFORM_NETBSD = 'NetBSD'; const PLATFORM_SUNOS = 'SunOS'; const PLATFORM_OPENSOLARIS = 'OpenSolaris'; const PLATFORM_ANDROID = 'Android'; const OPERATING_SYSTEM_UNKNOWN = 'unknown'; public function __construct($userAgent = "") { $this->reset(); if ($userAgent != "") { $this->setUserAgent($userAgent); } else { $this->determine(); } } /** * Reset all properties */ public function reset() { $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; $this->_browser_name = self::BROWSER_UNKNOWN; $this->_version = self::VERSION_UNKNOWN; $this->_platform = self::PLATFORM_UNKNOWN; $this->_os = self::OPERATING_SYSTEM_UNKNOWN; $this->_is_aol = false; $this->_is_mobile = false; $this->_is_tablet = false; $this->_is_robot = false; $this->_is_facebook = false; $this->_aol_version = self::VERSION_UNKNOWN; } /** * Check to see if the specific browser is valid * @param string $browserName * @return bool True if the browser is the specified browser */ function isBrowser($browserName) { return (0 == strcasecmp($this->_browser_name, trim($browserName))); } /** * The name of the browser. All return types are from the class contants * @return string Name of the browser */ public function getBrowser() { return $this->_browser_name; } /** * Set the name of the browser * @param $browser string The name of the Browser */ public function setBrowser($browser) { $this->_browser_name = $browser; } /** * The name of the platform. All return types are from the class contants * @return string Name of the browser */ public function getPlatform() { return $this->_platform; } /** * Set the name of the platform * @param string $platform The name of the Platform */ public function setPlatform($platform) { $this->_platform = $platform; } /** * The version of the browser. * @return string Version of the browser (will only contain alpha-numeric characters and a period) */ public function getVersion() { return $this->_version; } /** * Set the version of the browser * @param string $version The version of the Browser */ public function setVersion($version) { $this->_version = preg_replace('/[^0-9,.,a-z,A-Z-]/', '', $version); } /** * The version of AOL. * @return string Version of AOL (will only contain alpha-numeric characters and a period) */ public function getAolVersion() { return $this->_aol_version; } /** * Set the version of AOL * @param string $version The version of AOL */ public function setAolVersion($version) { $this->_aol_version = preg_replace('/[^0-9,.,a-z,A-Z]/', '', $version); } /** * Is the browser from AOL? * @return boolean True if the browser is from AOL otherwise false */ public function isAol() { return $this->_is_aol; } /** * Is the browser from a mobile device? * @return boolean True if the browser is from a mobile device otherwise false */ public function isMobile() { return $this->_is_mobile; } /** * Is the browser from a tablet device? * @return boolean True if the browser is from a tablet device otherwise false */ public function isTablet() { return $this->_is_tablet; } /** * Is the browser from a robot (ex Slurp,GoogleBot)? * @return boolean True if the browser is from a robot otherwise false */ public function isRobot() { return $this->_is_robot; } /** * Is the browser from facebook? * @return boolean True if the browser is from facebook otherwise false */ public function isFacebook() { return $this->_is_facebook; } /** * Set the browser to be from AOL * @param $isAol */ public function setAol($isAol) { $this->_is_aol = $isAol; } /** * Set the Browser to be mobile * @param boolean $value is the browser a mobile browser or not */ protected function setMobile($value = true) { $this->_is_mobile = $value; } /** * Set the Browser to be tablet * @param boolean $value is the browser a tablet browser or not */ protected function setTablet($value = true) { $this->_is_tablet = $value; } /** * Set the Browser to be a robot * @param boolean $value is the browser a robot or not */ protected function setRobot($value = true) { $this->_is_robot = $value; } /** * Set the Browser to be a Facebook request * @param boolean $value is the browser a robot or not */ protected function setFacebook($value = true) { $this->_is_facebook = $value; } /** * Get the user agent value in use to determine the browser * @return string The user agent from the HTTP header */ public function getUserAgent() { return $this->_agent; } /** * Set the user agent value (the construction will use the HTTP header value - this will overwrite it) * @param string $agent_string The value for the User Agent */ public function setUserAgent($agent_string) { $this->reset(); $this->_agent = $agent_string; $this->determine(); } /** * Used to determine if the browser is actually "chromeframe" * @since 1.7 * @return boolean True if the browser is using chromeframe */ public function isChromeFrame() { return (strpos($this->_agent, "chromeframe") !== false); } /** * Returns a formatted string with a summary of the details of the browser. * @return string formatted string with a summary of the browser */ public function __toString() { return "Browser Name: {$this->getBrowser()}
\n" . "Browser Version: {$this->getVersion()}
\n" . "Browser User Agent String: {$this->getUserAgent()}
\n" . "Platform: {$this->getPlatform()}
"; } /** * Protected routine to calculate and determine what the browser is in use (including platform) */ protected function determine() { $this->checkPlatform(); $this->checkBrowsers(); $this->checkForAol(); } /** * Protected routine to determine the browser type * @return boolean True if the browser was detected otherwise false */ protected function checkBrowsers() { return ( // well-known, well-used // Special Notes: // (1) Opera must be checked before FireFox due to the odd // user agents used in some older versions of Opera // (2) WebTV is strapped onto Internet Explorer so we must // check for WebTV before IE // (3) (deprecated) Galeon is based on Firefox and needs to be // tested before Firefox is tested // (4) OmniWeb is based on Safari so OmniWeb check must occur // before Safari // (5) Netscape 9+ is based on Firefox so Netscape checks // before FireFox are necessary $this->checkBrowserWebTv() || $this->checkBrowserInternetExplorer() || $this->checkBrowserOpera() || $this->checkBrowserGaleon() || $this->checkBrowserNetscapeNavigator9Plus() || $this->checkBrowserFirefox() || $this->checkBrowserChrome() || $this->checkBrowserOmniWeb() || // common mobile $this->checkBrowserAndroid() || $this->checkBrowseriPad() || $this->checkBrowseriPod() || $this->checkBrowseriPhone() || $this->checkBrowserBlackBerry() || $this->checkBrowserNokia() || // common bots $this->checkBrowserGoogleBot() || $this->checkBrowserMSNBot() || $this->checkBrowserBingBot() || $this->checkBrowserSlurp() || // check for facebook external hit when loading URL $this->checkFacebookExternalHit() || // WebKit base check (post mobile and others) $this->checkBrowserSafari() || // everyone else $this->checkBrowserNetPositive() || $this->checkBrowserFirebird() || $this->checkBrowserKonqueror() || $this->checkBrowserIcab() || $this->checkBrowserPhoenix() || $this->checkBrowserAmaya() || $this->checkBrowserLynx() || $this->checkBrowserShiretoko() || $this->checkBrowserIceCat() || $this->checkBrowserIceweasel() || $this->checkBrowserW3CValidator() || $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */ ); } /** * Determine if the user is using a BlackBerry (last updated 1.7) * @return boolean True if the browser is the BlackBerry browser otherwise false */ protected function checkBrowserBlackBerry() { if (stripos($this->_agent, 'blackberry') !== false) { $aresult = explode("/", stristr($this->_agent, "BlackBerry")); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->_browser_name = self::BROWSER_BLACKBERRY; $this->setMobile(true); return true; } } return false; } /** * Determine if the user is using an AOL User Agent (last updated 1.7) * @return boolean True if the browser is from AOL otherwise false */ protected function checkForAol() { $this->setAol(false); $this->setAolVersion(self::VERSION_UNKNOWN); if (stripos($this->_agent, 'aol') !== false) { $aversion = explode(' ', stristr($this->_agent, 'AOL')); if (isset($aversion[1])) { $this->setAol(true); $this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1])); return true; } } return false; } /** * Determine if the browser is the GoogleBot or not (last updated 1.7) * @return boolean True if the browser is the GoogletBot otherwise false */ protected function checkBrowserGoogleBot() { if (stripos($this->_agent, 'googlebot') !== false) { $aresult = explode('/', stristr($this->_agent, 'googlebot')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion(str_replace(';', '', $aversion[0])); $this->_browser_name = self::BROWSER_GOOGLEBOT; $this->setRobot(true); return true; } } return false; } /** * Determine if the browser is the MSNBot or not (last updated 1.9) * @return boolean True if the browser is the MSNBot otherwise false */ protected function checkBrowserMSNBot() { if (stripos($this->_agent, "msnbot") !== false) { $aresult = explode("/", stristr($this->_agent, "msnbot")); if (isset($aresult[1])) { $aversion = explode(" ", $aresult[1]); $this->setVersion(str_replace(";", "", $aversion[0])); $this->_browser_name = self::BROWSER_MSNBOT; $this->setRobot(true); return true; } } return false; } /** * Determine if the browser is the BingBot or not (last updated 1.9) * @return boolean True if the browser is the BingBot otherwise false */ protected function checkBrowserBingBot() { if (stripos($this->_agent, "bingbot") !== false) { $aresult = explode("/", stristr($this->_agent, "bingbot")); if (isset($aresult[1])) { $aversion = explode(" ", $aresult[1]); $this->setVersion(str_replace(";", "", $aversion[0])); $this->_browser_name = self::BROWSER_BINGBOT; $this->setRobot(true); return true; } } return false; } /** * Determine if the browser is the W3C Validator or not (last updated 1.7) * @return boolean True if the browser is the W3C Validator otherwise false */ protected function checkBrowserW3CValidator() { if (stripos($this->_agent, 'W3C-checklink') !== false) { $aresult = explode('/', stristr($this->_agent, 'W3C-checklink')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->_browser_name = self::BROWSER_W3CVALIDATOR; return true; } } else if (stripos($this->_agent, 'W3C_Validator') !== false) { // Some of the Validator versions do not delineate w/ a slash - add it back in $ua = str_replace("W3C_Validator ", "W3C_Validator/", $this->_agent); $aresult = explode('/', stristr($ua, 'W3C_Validator')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->_browser_name = self::BROWSER_W3CVALIDATOR; return true; } } else if (stripos($this->_agent, 'W3C-mobileOK') !== false) { $this->_browser_name = self::BROWSER_W3CVALIDATOR; $this->setMobile(true); return true; } return false; } /** * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7) * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false */ protected function checkBrowserSlurp() { if (stripos($this->_agent, 'slurp') !== false) { $aresult = explode('/', stristr($this->_agent, 'Slurp')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->_browser_name = self::BROWSER_SLURP; $this->setRobot(true); $this->setMobile(false); return true; } } return false; } /** * Determine if the browser is Internet Explorer or not (last updated 1.7) * @return boolean True if the browser is Internet Explorer otherwise false */ protected function checkBrowserInternetExplorer() { // Test for IE11 if( stripos($this->_agent,'Trident/7.0; rv:11.0') !== false ) { $this->setBrowser(self::BROWSER_IE); $this->setVersion('11.0'); return true; } // Test for v1 - v1.5 IE else if (stripos($this->_agent, 'microsoft internet explorer') !== false) { $this->setBrowser(self::BROWSER_IE); $this->setVersion('1.0'); $aresult = stristr($this->_agent, '/'); if (preg_match('/308|425|426|474|0b1/i', $aresult)) { $this->setVersion('1.5'); } return true; } // Test for versions > 1.5 else if (stripos($this->_agent, 'msie') !== false && stripos($this->_agent, 'opera') === false) { // See if the browser is the odd MSN Explorer if (stripos($this->_agent, 'msnb') !== false) { $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'MSN')); if (isset($aresult[1])) { $this->setBrowser(self::BROWSER_MSN); $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1])); return true; } } $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie')); if (isset($aresult[1])) { $this->setBrowser(self::BROWSER_IE); $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1])); if(stripos($this->_agent, 'IEMobile') !== false) { $this->setBrowser(self::BROWSER_POCKET_IE); $this->setMobile(true); } return true; } } // Test for versions > IE 10 else if(stripos($this->_agent, 'trident') !== false) { $this->setBrowser(self::BROWSER_IE); $result = explode('rv:', $this->_agent); if (isset($result[1])) { $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1])); $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent); } } // Test for Pocket IE else if (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) { $aresult = explode(' ', stristr($this->_agent, 'mspie')); if (isset($aresult[1])) { $this->setPlatform(self::PLATFORM_WINDOWS_CE); $this->setBrowser(self::BROWSER_POCKET_IE); $this->setMobile(true); if (stripos($this->_agent, 'mspie') !== false) { $this->setVersion($aresult[1]); } else { $aversion = explode('/', $this->_agent); if (isset($aversion[1])) { $this->setVersion($aversion[1]); } } return true; } } return false; } /** * Determine if the browser is Opera or not (last updated 1.7) * @return boolean True if the browser is Opera otherwise false */ protected function checkBrowserOpera() { if (stripos($this->_agent, 'opera mini') !== false) { $resultant = stristr($this->_agent, 'opera mini'); if (preg_match('/\//', $resultant)) { $aresult = explode('/', $resultant); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); } } else { $aversion = explode(' ', stristr($resultant, 'opera mini')); if (isset($aversion[1])) { $this->setVersion($aversion[1]); } } $this->_browser_name = self::BROWSER_OPERA_MINI; $this->setMobile(true); return true; } else if (stripos($this->_agent, 'opera') !== false) { $resultant = stristr($this->_agent, 'opera'); if (preg_match('/Version\/(1*.*)$/', $resultant, $matches)) { $this->setVersion($matches[1]); } else if (preg_match('/\//', $resultant)) { $aresult = explode('/', str_replace("(", " ", $resultant)); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); } } else { $aversion = explode(' ', stristr($resultant, 'opera')); $this->setVersion(isset($aversion[1]) ? $aversion[1] : ""); } if (stripos($this->_agent, 'Opera Mobi') !== false) { $this->setMobile(true); } $this->_browser_name = self::BROWSER_OPERA; return true; } else if (stripos($this->_agent, 'OPR') !== false) { $resultant = stristr($this->_agent, 'OPR'); if (preg_match('/\//', $resultant)) { $aresult = explode('/', str_replace("(", " ", $resultant)); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); } } if (stripos($this->_agent, 'Mobile') !== false) { $this->setMobile(true); } $this->_browser_name = self::BROWSER_OPERA; return true; } return false; } /** * Determine if the browser is Chrome or not (last updated 1.7) * @return boolean True if the browser is Chrome otherwise false */ protected function checkBrowserChrome() { if (stripos($this->_agent, 'Chrome') !== false) { $aresult = explode('/', stristr($this->_agent, 'Chrome')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_CHROME); //Chrome on Android if (stripos($this->_agent, 'Android') !== false) { if (stripos($this->_agent, 'Mobile') !== false) { $this->setMobile(true); } else { $this->setTablet(true); } } return true; } } return false; } /** * Determine if the browser is WebTv or not (last updated 1.7) * @return boolean True if the browser is WebTv otherwise false */ protected function checkBrowserWebTv() { if (stripos($this->_agent, 'webtv') !== false) { $aresult = explode('/', stristr($this->_agent, 'webtv')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_WEBTV); return true; } } return false; } /** * Determine if the browser is NetPositive or not (last updated 1.7) * @return boolean True if the browser is NetPositive otherwise false */ protected function checkBrowserNetPositive() { if (stripos($this->_agent, 'NetPositive') !== false) { $aresult = explode('/', stristr($this->_agent, 'NetPositive')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion(str_replace(array('(', ')', ';'), '', $aversion[0])); $this->setBrowser(self::BROWSER_NETPOSITIVE); return true; } } return false; } /** * Determine if the browser is Galeon or not (last updated 1.7) * @return boolean True if the browser is Galeon otherwise false */ protected function checkBrowserGaleon() { if (stripos($this->_agent, 'galeon') !== false) { $aresult = explode(' ', stristr($this->_agent, 'galeon')); $aversion = explode('/', $aresult[0]); if (isset($aversion[1])) { $this->setVersion($aversion[1]); $this->setBrowser(self::BROWSER_GALEON); return true; } } return false; } /** * Determine if the browser is Konqueror or not (last updated 1.7) * @return boolean True if the browser is Konqueror otherwise false */ protected function checkBrowserKonqueror() { if (stripos($this->_agent, 'Konqueror') !== false) { $aresult = explode(' ', stristr($this->_agent, 'Konqueror')); $aversion = explode('/', $aresult[0]); if (isset($aversion[1])) { $this->setVersion($aversion[1]); $this->setBrowser(self::BROWSER_KONQUEROR); return true; } } return false; } /** * Determine if the browser is iCab or not (last updated 1.7) * @return boolean True if the browser is iCab otherwise false */ protected function checkBrowserIcab() { if (stripos($this->_agent, 'icab') !== false) { $aversion = explode(' ', stristr(str_replace('/', ' ', $this->_agent), 'icab')); if (isset($aversion[1])) { $this->setVersion($aversion[1]); $this->setBrowser(self::BROWSER_ICAB); return true; } } return false; } /** * Determine if the browser is OmniWeb or not (last updated 1.7) * @return boolean True if the browser is OmniWeb otherwise false */ protected function checkBrowserOmniWeb() { if (stripos($this->_agent, 'omniweb') !== false) { $aresult = explode('/', stristr($this->_agent, 'omniweb')); $aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : ""); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_OMNIWEB); return true; } return false; } /** * Determine if the browser is Phoenix or not (last updated 1.7) * @return boolean True if the browser is Phoenix otherwise false */ protected function checkBrowserPhoenix() { if (stripos($this->_agent, 'Phoenix') !== false) { $aversion = explode('/', stristr($this->_agent, 'Phoenix')); if (isset($aversion[1])) { $this->setVersion($aversion[1]); $this->setBrowser(self::BROWSER_PHOENIX); return true; } } return false; } /** * Determine if the browser is Firebird or not (last updated 1.7) * @return boolean True if the browser is Firebird otherwise false */ protected function checkBrowserFirebird() { if (stripos($this->_agent, 'Firebird') !== false) { $aversion = explode('/', stristr($this->_agent, 'Firebird')); if (isset($aversion[1])) { $this->setVersion($aversion[1]); $this->setBrowser(self::BROWSER_FIREBIRD); return true; } } return false; } /** * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008) * @return boolean True if the browser is Netscape Navigator 9+ otherwise false */ protected function checkBrowserNetscapeNavigator9Plus() { if (stripos($this->_agent, 'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i', $this->_agent, $matches)) { $this->setVersion($matches[1]); $this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR); return true; } else if (stripos($this->_agent, 'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i', $this->_agent, $matches)) { $this->setVersion($matches[1]); $this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR); return true; } return false; } /** * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7) * @return boolean True if the browser is Shiretoko otherwise false */ protected function checkBrowserShiretoko() { if (stripos($this->_agent, 'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i', $this->_agent, $matches)) { $this->setVersion($matches[1]); $this->setBrowser(self::BROWSER_SHIRETOKO); return true; } return false; } /** * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7) * @return boolean True if the browser is Ice Cat otherwise false */ protected function checkBrowserIceCat() { if (stripos($this->_agent, 'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i', $this->_agent, $matches)) { $this->setVersion($matches[1]); $this->setBrowser(self::BROWSER_ICECAT); return true; } return false; } /** * Determine if the browser is Nokia or not (last updated 1.7) * @return boolean True if the browser is Nokia otherwise false */ protected function checkBrowserNokia() { if (preg_match("/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches)) { $this->setVersion($matches[2]); if (stripos($this->_agent, 'Series60') !== false || strpos($this->_agent, 'S60') !== false) { $this->setBrowser(self::BROWSER_NOKIA_S60); } else { $this->setBrowser(self::BROWSER_NOKIA); } $this->setMobile(true); return true; } return false; } /** * Determine if the browser is Firefox or not (last updated 1.7) * @return boolean True if the browser is Firefox otherwise false */ protected function checkBrowserFirefox() { if (stripos($this->_agent, 'safari') === false) { if (preg_match("/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches)) { $this->setVersion($matches[1]); $this->setBrowser(self::BROWSER_FIREFOX); //Firefox on Android if (stripos($this->_agent, 'Android') !== false) { if (stripos($this->_agent, 'Mobile') !== false) { $this->setMobile(true); } else { $this->setTablet(true); } } return true; } else if (preg_match("/Firefox$/i", $this->_agent, $matches)) { $this->setVersion(""); $this->setBrowser(self::BROWSER_FIREFOX); return true; } } return false; } /** * Determine if the browser is Firefox or not (last updated 1.7) * @return boolean True if the browser is Firefox otherwise false */ protected function checkBrowserIceweasel() { if (stripos($this->_agent, 'Iceweasel') !== false) { $aresult = explode('/', stristr($this->_agent, 'Iceweasel')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_ICEWEASEL); return true; } } return false; } /** * Determine if the browser is Mozilla or not (last updated 1.7) * @return boolean True if the browser is Mozilla otherwise false */ protected function checkBrowserMozilla() { if (stripos($this->_agent, 'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent) && stripos($this->_agent, 'netscape') === false) { $aversion = explode(' ', stristr($this->_agent, 'rv:')); preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion); $this->setVersion(str_replace('rv:', '', $aversion[0])); $this->setBrowser(self::BROWSER_MOZILLA); return true; } else if (stripos($this->_agent, 'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i', $this->_agent) && stripos($this->_agent, 'netscape') === false) { $aversion = explode('', stristr($this->_agent, 'rv:')); $this->setVersion(str_replace('rv:', '', $aversion[0])); $this->setBrowser(self::BROWSER_MOZILLA); return true; } else if (stripos($this->_agent, 'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i', $this->_agent, $matches) && stripos($this->_agent, 'netscape') === false) { $this->setVersion($matches[1]); $this->setBrowser(self::BROWSER_MOZILLA); return true; } return false; } /** * Determine if the browser is Lynx or not (last updated 1.7) * @return boolean True if the browser is Lynx otherwise false */ protected function checkBrowserLynx() { if (stripos($this->_agent, 'lynx') !== false) { $aresult = explode('/', stristr($this->_agent, 'Lynx')); $aversion = explode(' ', (isset($aresult[1]) ? $aresult[1] : "")); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_LYNX); return true; } return false; } /** * Determine if the browser is Amaya or not (last updated 1.7) * @return boolean True if the browser is Amaya otherwise false */ protected function checkBrowserAmaya() { if (stripos($this->_agent, 'amaya') !== false) { $aresult = explode('/', stristr($this->_agent, 'Amaya')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_AMAYA); return true; } } return false; } /** * Determine if the browser is Safari or not (last updated 1.7) * @return boolean True if the browser is Safari otherwise false */ protected function checkBrowserSafari() { if (stripos($this->_agent, 'Safari') !== false && stripos($this->_agent, 'iPhone') === false && stripos($this->_agent, 'iPod') === false) { $aresult = explode('/', stristr($this->_agent, 'Version')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); } else { $this->setVersion(self::VERSION_UNKNOWN); } $this->setBrowser(self::BROWSER_SAFARI); return true; } return false; } /** * Detect if URL is loaded from FacebookExternalHit * @return boolean True if it detects FacebookExternalHit otherwise false */ protected function checkFacebookExternalHit() { if(stristr($this->_agent,'FacebookExternalHit')) { $this->setRobot(true); $this->setFacebook(true); return true; } return false; } /** * Detect if URL is being loaded from internal Facebook browser * @return boolean True if it detects internal Facebook browser otherwise false */ protected function checkForFacebookIos() { if(stristr($this->_agent,'FBIOS')) { $this->setFacebook(true); return true; } return false; } /** * Detect Version for the Safari browser on iOS devices * @return boolean True if it detects the version correctly otherwise false */ protected function getSafariVersionOnIos() { $aresult = explode('/',stristr($this->_agent,'Version')); if( isset($aresult[1]) ) { $aversion = explode(' ',$aresult[1]); $this->setVersion($aversion[0]); return true; } return false; } /** * Detect Version for the Chrome browser on iOS devices * @return boolean True if it detects the version correctly otherwise false */ protected function getChromeVersionOnIos() { $aresult = explode('/',stristr($this->_agent,'CriOS')); if( isset($aresult[1]) ) { $aversion = explode(' ',$aresult[1]); $this->setVersion($aversion[0]); $this->setBrowser(self::BROWSER_CHROME); return true; } return false; } /** * Determine if the browser is iPhone or not (last updated 1.7) * @return boolean True if the browser is iPhone otherwise false */ protected function checkBrowseriPhone() { if( stripos($this->_agent,'iPhone') !== false ) { $this->setVersion(self::VERSION_UNKNOWN); $this->setBrowser(self::BROWSER_IPHONE); $this->getSafariVersionOnIos(); $this->getChromeVersionOnIos(); $this->checkForFacebookIos(); $this->setMobile(true); return true; } return false; } /** * Determine if the browser is iPad or not (last updated 1.7) * @return boolean True if the browser is iPad otherwise false */ protected function checkBrowseriPad() { if( stripos($this->_agent,'iPad') !== false ) { $this->setVersion(self::VERSION_UNKNOWN); $this->setBrowser(self::BROWSER_IPAD); $this->getSafariVersionOnIos(); $this->getChromeVersionOnIos(); $this->checkForFacebookIos(); $this->setTablet(true); return true; } return false; } /** * Determine if the browser is iPod or not (last updated 1.7) * @return boolean True if the browser is iPod otherwise false */ protected function checkBrowseriPod() { if( stripos($this->_agent,'iPod') !== false ) { $this->setVersion(self::VERSION_UNKNOWN); $this->setBrowser(self::BROWSER_IPOD); $this->getSafariVersionOnIos(); $this->getChromeVersionOnIos(); $this->checkForFacebookIos(); $this->setMobile(true); return true; } return false; } /** * Determine if the browser is Android or not (last updated 1.7) * @return boolean True if the browser is Android otherwise false */ protected function checkBrowserAndroid() { if (stripos($this->_agent, 'Android') !== false) { $aresult = explode(' ', stristr($this->_agent, 'Android')); if (isset($aresult[1])) { $aversion = explode(' ', $aresult[1]); $this->setVersion($aversion[0]); } else { $this->setVersion(self::VERSION_UNKNOWN); } if (stripos($this->_agent, 'Mobile') !== false) { $this->setMobile(true); } else { $this->setTablet(true); } $this->setBrowser(self::BROWSER_ANDROID); return true; } return false; } /** * Determine the user's platform (last updated 1.7) */ protected function checkPlatform() { if (stripos($this->_agent, 'windows') !== false) { $this->_platform = self::PLATFORM_WINDOWS; } else if (stripos($this->_agent, 'iPad') !== false) { $this->_platform = self::PLATFORM_IPAD; } else if (stripos($this->_agent, 'iPod') !== false) { $this->_platform = self::PLATFORM_IPOD; } else if (stripos($this->_agent, 'iPhone') !== false) { $this->_platform = self::PLATFORM_IPHONE; } elseif (stripos($this->_agent, 'mac') !== false) { $this->_platform = self::PLATFORM_APPLE; } elseif (stripos($this->_agent, 'android') !== false) { $this->_platform = self::PLATFORM_ANDROID; } elseif (stripos($this->_agent, 'linux') !== false) { $this->_platform = self::PLATFORM_LINUX; } else if (stripos($this->_agent, 'Nokia') !== false) { $this->_platform = self::PLATFORM_NOKIA; } else if (stripos($this->_agent, 'BlackBerry') !== false) { $this->_platform = self::PLATFORM_BLACKBERRY; } elseif (stripos($this->_agent, 'FreeBSD') !== false) { $this->_platform = self::PLATFORM_FREEBSD; } elseif (stripos($this->_agent, 'OpenBSD') !== false) { $this->_platform = self::PLATFORM_OPENBSD; } elseif (stripos($this->_agent, 'NetBSD') !== false) { $this->_platform = self::PLATFORM_NETBSD; } elseif (stripos($this->_agent, 'OpenSolaris') !== false) { $this->_platform = self::PLATFORM_OPENSOLARIS; } elseif (stripos($this->_agent, 'SunOS') !== false) { $this->_platform = self::PLATFORM_SUNOS; } elseif (stripos($this->_agent, 'OS\/2') !== false) { $this->_platform = self::PLATFORM_OS2; } elseif (stripos($this->_agent, 'BeOS') !== false) { $this->_platform = self::PLATFORM_BEOS; } elseif (stripos($this->_agent, 'win') !== false) { $this->_platform = self::PLATFORM_WINDOWS; } } } extensions/options_object/extension_options_object.php000066600000007315152141561100017620 0ustar00. * * @package ReduxFramework * @author Kevin Provance (kprovance) * @version 4.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_Extension_options_object' ) ) { /** * Main ReduxFramework options_object extension class * * @since 3.1.6 */ class ReduxFramework_Extension_options_object { // Protected vars protected $parent; public $extension_url; public $extension_dir; public static $theInstance; public static $version = "4.0"; public $is_field = false; /** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * * @param array $sections Panel sections. * @param array $args Class constructor arguments. * @param array $extra_tabs Extra panel tabs. * * @return void */ public function __construct( $parent ) { $this->parent = $parent; if ( empty( $this->extension_dir ) ) { //$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); } $this->field_name = 'options_object'; self::$theInstance = $this; $this->is_field = Redux_Helpers::isFieldInUse($parent, 'options_object'); if ( !$this->is_field && $this->parent->args['dev_mode'] && $this->parent->args['show_options_object'] ) { $this->add_section(); } add_filter( 'redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array( &$this, 'overload_field_path' ) ); // Adds the local field } public function add_section() { $this->parent->sections[] = array( 'id' => 'options-object', 'title' => __( 'Options Object', 'redux-framework' ), 'heading' => '', 'icon' => 'el el-info-circle', 'customizer' => false, 'fields' => array( array( 'id' => 'redux_options_object', 'type'=> 'options_object', 'title' => '', ) ), ); } // Forces the use of the embeded field path vs what the core typically would use public function overload_field_path( $field ) { return dirname( __FILE__ ) . '/' . $this->field_name . '/field_' . $this->field_name . '.php'; } } // class } // if extensions/options_object/options_object/field_options_object.min.js000066600000001172152141561100022312 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.options_object=redux.field_objects.options_object||{},redux.field_objects.options_object.init=function(b){b||(b=a(document).find(".redux-container-options_object"));var c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),a("#consolePrintObject").on("click",function(b){b.preventDefault(),console.log(a.parseJSON(a("#redux-object-json").html()))}),"function"==typeof jsonView&&jsonView("#redux-object-json","#redux-object-browser"))}}(jQuery);extensions/options_object/options_object/field_options_object.php000066600000014501152141561100021703 0ustar00. * * @package ReduxFramework * @author Kevin Provance (kprovance) * @version 3.5.4 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_options_object' ) ) { /** * Main ReduxFramework_options_object class * * @since 1.0.0 */ class ReduxFramework_options_object { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; $this->is_field = $this->parent->extensions['options_object']->is_field; $this->extension_dir = ReduxFramework::$_dir . 'inc/extensions/options_object/'; $this->extension_url = ReduxFramework::$_url . 'inc/extensions/options_object/'; // Set default args for this field to avoid bad indexes. Change this to anything you use. $defaults = array( 'options' => array(), 'stylesheet' => '', 'output' => true, 'enqueue' => true, 'enqueue_frontend' => true ); $this->field = wp_parse_args( $this->field, $defaults ); } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { if ( version_compare( phpversion(), "5.3.0", ">=" ) ) { $json = json_encode( $this->parent->options, true ); } else { $json = json_encode( $this->parent->options ); } $defaults = array( 'full_width' => true, 'overflow' => 'inherit', ); $this->field = wp_parse_args( $this->field, $defaults ); if ( $this->is_field ) { $fullWidth = $this->field['full_width']; } $bDoClose = false; $id = $this->parent->args['opt_name'] . '-' . $this->field['id']; if ( ! $this->is_field || ( $this->is_field && false == $fullWidth ) ) { ?>

'; } else { echo ''; } echo ''; echo ''; echo ''; } // All sections, settings, and controls will be added here public function _register_customizer_controls( $wp_customize ) { if ( ! class_exists( 'Redux_Customizer_Section' ) ) { require_once dirname( __FILE__ ) . '/inc/customizer_section.php'; if ( method_exists( $wp_customize, 'register_section_type' ) ) { $wp_customize->register_section_type( 'Redux_Customizer_Section' ); } } if ( ! class_exists( 'Redux_Customizer_Panel' ) ) { require_once dirname( __FILE__ ) . '/inc/customizer_panel.php'; if ( method_exists( $wp_customize, 'register_panel_type' ) ) { $wp_customize->register_panel_type( 'Redux_Customizer_Panel' ); } } if ( ! class_exists( 'Redux_Customizer_Control' ) ) { require_once dirname( __FILE__ ) . '/inc/customizer_control.php'; } require_once dirname( __FILE__ ) . '/inc/customizer_fields.php'; require_once dirname( __FILE__ ) . '/inc/customizer_devs.php'; do_action( "redux/extension/customizer/control/includes" ); //if ($this->parent->args['dev_mode']) { // $section = new Redux_Customizer_rAds( $wp_customize, 'redux_rAds', array( // 'priority' => 0, // ) ); // $wp_customize->add_section( $section, array( // 'priority' => 0, // ) ); // // //$wp_customize->add_control( new Redux_Customizer_Control_rAds( $wp_customize, 'reduxAdsDisplay', array( // // 'section' => 'redux_rAds', // // 'settings' => 'redux_rAds_field', // // 'type' => 'redux-rAds', // //) ) ); // // // // //} if ( $this->parent->args['dev_mode'] ) { //$args = array( // 'priority' => 0, //); ////$section = new Redux_Customizer_Section( $wp_customize, 'redux_rAds', $args ); ////$wp_customize->add_section( $section, $args ); //$this->add_section( 'redux_rAds', array( // 'title' => '', // 'priority' => 1, // 'description' => '', // 'capability' => 'edit_theme_options', //), $wp_customize ); // //$wp_customize->add_control( new WP_Customize_Color_Control( // $wp_customize, // 'redux_rAds_display', // array( // 'section' => 'redux_rAds', // 'settings' => 'redux_rAds_display', // ) //)); ////$wp_customize->add_control( new Redux_Customizer_Control_rAds( $wp_customize, 'reduxAdsDisplay', array( //// 'section' => 'redux_rAds', //// 'settings' => 'redux_rAds_field', //// 'type' => 'redux-rAds', ////) ) ); //start copyright settings //$section = new Redux_Customizer_section_rAds( $wp_customize, 'redux_rAds', array( // 'priority' => -999, //) ); //$wp_customize->add_section( $section, array( // 'priority' => -999, //) ); //$wp_customize->add_setting( // 'redux_rAds_empty' //); //$wp_customize->add_control( // new Redux_Customizer_Control_rAds( // $wp_customize, // 'redux_rAds_empty', // array( // 'section' => 'redux_rAds', // 'settings' => 'redux_rAds_empty' // ) // ) //); } $order = array( 'heading' => - 500, 'option' => - 500, ); $defaults = array( 'default-color' => '', 'default-image' => '', 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); $panel = ""; $this->parent->args['options_api'] = false; $this->parent->_register_settings(); foreach ( $this->parent->sections as $key => $section ) { // Not a type that should go on the customizer if ( isset( $section['type'] ) && ( $section['type'] == "divide" ) ) { continue; } if ( isset( $section['id'] ) && $section['id'] == "import/export" ) { continue; } // If section customizer is set to false if ( isset( $section['customizer'] ) && $section['customizer'] === false ) { continue; } $section['permissions'] = isset( $section['permissions'] ) ? $section['permissions'] : 'edit_theme_options'; // No errors please if ( ! isset( $section['desc'] ) ) { $section['desc'] = ""; } // Fill the description if there is a subtitle if ( empty( $section['desc'] ) && ! empty( $section['subtitle'] ) ) { $section['desc'] = $section['subtitle']; } // Let's make a section ID from the title if ( empty( $section['id'] ) ) { $section['id'] = strtolower( str_replace( " ", "", $section['title'] ) ); } // No title is present, let's show what section is missing a title if ( ! isset( $section['title'] ) ) { $section['title'] = ""; } // Let's set a default priority if ( empty( $section['priority'] ) ) { $section['priority'] = $order['heading']; $order['heading'] ++; } //print_r($section); //print_r($this->parent->sections[$key+1]); //echo $key; //exit(); if ( method_exists( $wp_customize, 'add_panel' ) && ( ! isset( $section['subsection'] ) || ( isset( $section['subsection'] ) && $section['subsection'] != true ) ) && isset( $this->parent->sections[ ( $key + 1 ) ]['subsection'] ) && $this->parent->sections[ ( $key + 1 ) ]['subsection'] ) { $this->add_panel( $section['id'], array( 'priority' => $section['priority'], 'capability' => $section['permissions'], //'theme_supports' => '', 'title' => $section['title'], 'section' => $section, 'opt_name' => $this->parent->args['opt_name'], 'description' => '', ), $wp_customize ); $panel = $section['id']; $this->add_section( $section['id'], array( 'title' => $section['title'], 'priority' => $section['priority'], 'description' => $section['desc'], 'section' => $section, 'opt_name' => $this->parent->args['opt_name'], 'capability' => $section['permissions'], 'panel' => $panel ), $wp_customize ); } else { if ( ! isset( $section['subsection'] ) || ( isset( $section['subsection'] ) && $section['subsection'] != true ) ) { $panel = ""; } $this->add_section( $section['id'], array( 'title' => $section['title'], 'priority' => $section['priority'], 'description' => $section['desc'], 'opt_name' => $this->parent->args['opt_name'], 'section' => $section, 'capability' => $section['permissions'], 'panel' => $panel ), $wp_customize ); } if ( ! isset( $section['fields'] ) || ( isset( $section['fields'] ) && empty( $section['fields'] ) ) ) { continue; } foreach ( $section['fields'] as $skey => $option ) { if ( isset( $option['customizer'] ) && $option['customizer'] === false ) { continue; } if ( $this->parent->args['customizer'] === false && ( ! isset( $option['customizer'] ) || $option['customizer'] !== true ) ) { continue; } $this->options[ $option['id'] ] = $option; add_action( 'redux/advanced_customizer/control/render/' . $this->parent->args['opt_name'] . '-' . $option['id'], array( $this, 'render' ) ); $option['permissions'] = isset( $option['permissions'] ) ? $option['permissions'] : 'edit_theme_options'; // //if ( isset( $option['validate_callback'] ) && ! empty( $option['validate_callback'] ) ) { // continue; //} //Change the item priority if not set if ( $option['type'] != 'heading' && ! isset( $option['priority'] ) ) { $option['priority'] = $order['option']; $order['option'] ++; } if ( ! empty( $this->options_defaults[ $option['id'] ] ) ) { $option['default'] = $this->options_defaults['option']['id']; } //$option['id'] = $this->parent->args['opt_name'].'['.$option['id'].']'; //echo $option['id']; if ( ! isset( $option['default'] ) ) { $option['default'] = ""; } if ( ! isset( $option['title'] ) ) { $option['title'] = ""; } $option['id'] = $this->parent->args['opt_name'] . '[' . $option['id'] . ']'; if ( $option['type'] != "heading" && $option['type'] != "import_export" && ! empty( $option['type'] ) ) { $wp_customize->add_setting( $option['id'], array( 'default' => $option['default'], //'type' => 'option', //'capabilities' => $option['permissions'], //'capabilities' => 'edit_theme_options', //'capabilities' => $this->parent->args['page_permissions'], 'transport' => 'refresh', 'opt_name' => $this->parent->args['opt_name'], //'theme_supports' => '', //'sanitize_callback' => '__return_false', 'sanitize_callback' => array( $this, '_field_validation' ), //'sanitize_js_callback' =>array( &$parent, '_field_input' ), ) ); } if ( ! empty( $option['data'] ) && empty( $option['options'] ) ) { if ( empty( $option['args'] ) ) { $option['args'] = array(); } if ( $option['data'] == "elusive-icons" || $option['data'] == "elusive-icon" || $option['data'] == "elusive" ) { $icons_file = ReduxFramework::$_dir . 'inc/fields/select/elusive-icons.php'; $icons_file = apply_filters( 'redux-font-icons-file', $icons_file ); if ( file_exists( $icons_file ) ) { require_once $icons_file; } } $option['options'] = $this->parent->get_wordpress_data( $option['data'], $option['args'] ); } $class_name = 'Redux_Customizer_Control_' . $option['type']; do_action( 'redux/extension/customizer/control_init', $option ); if ( ! class_exists( $class_name ) ) { continue; } $wp_customize->add_control( new $class_name( $wp_customize, $option['id'], array( 'label' => $option['title'], 'section' => $section['id'], 'settings' => $option['id'], 'type' => 'redux-' . $option['type'], 'field' => $option, 'ReduxFramework' => $this->parent, 'active_callback' => ( isset( $option['required'] ) && class_exists( 'Redux_Customizer_Active_Callback' ) ) ? array( 'Redux_Customizer_Active_Callback', 'evaluate' ) : '__return_true', 'priority' => $option['priority'], ) ) ); $section['fields'][ $skey ]['name'] = $option['id']; if ( ! isset ( $section['fields'][ $skey ]['class'] ) ) { // No errors please $section['fields'][ $skey ]['class'] = ""; } $this->controls[ $section['fields'][ $skey ]['id'] ] = $section['fields'][ $skey ]; add_action( 'redux/advanced_customizer/render/' . $option['id'], array( $this, 'field_render' ), $option['priority'] ); } } } public function add_section( $id, $args = array(), $wp_customize ) { if ( is_a( $id, 'WP_Customize_Section' ) ) { $section = $id; } else { $section_class = apply_filters( 'redux/customizer/section/class_name', "Redux_Customizer_Section" ); $section = new $section_class( $wp_customize, $id, $args ); } $wp_customize->add_section( $section, $args ); } /** * Add a customize panel. * * @since 4.0.0 * @access public * * @param WP_Customize_Panel|string $id Customize Panel object, or Panel ID. * @param array $args Optional. Panel arguments. Default empty array. */ public function add_panel( $id, $args = array(), $wp_customize ) { if ( is_a( $id, 'WP_Customize_Panel' ) ) { $panel = $id; } else { $panel_class = apply_filters( 'redux/customizer/panel/class_name', "Redux_Customizer_Panel" ); $panel = new $panel_class( $wp_customize, $id, $args ); } $wp_customize->add_panel( $panel, $args ); } public function field_render( $option ) { echo '1'; preg_match_all( "/\[([^\]]*)\]/", $option->id, $matches ); $id = $matches[1][0]; echo $option->link(); //$link = $option->link(); //echo $link; $this->parent->_field_input( $this->controls[ $id ] ); echo '2'; } public function customizer_save_before( $plugin_options ) { $this->before_save = $this->parent->options; //$parent->_field_input( $plugin_options ); } public function customizer_save_after( $wp_customize ) { if ( empty( $this->parent->options ) ) { $this->parent->get_options(); } if ( empty( $this->orig_options ) && ! empty( $this->parent->options ) ) { $this->orig_options = $this->parent->options; } $options = json_decode( stripslashes_deep( $_POST['customized'] ), true ); $compiler = false; $changed = false; foreach ( $options as $key => $value ) { if ( strpos( $key, $this->parent->args['opt_name'] ) !== false ) { $key = str_replace( $this->parent->args['opt_name'] . '[', '', rtrim( $key, "]" ) ); if ( ! isset( $this->orig_options[ $key ] ) || $this->orig_options[ $key ] != $value || ( isset( $this->orig_options[ $key ] ) && ! empty( $this->orig_options[ $key ] ) && empty( $value ) ) ) { $this->parent->options[ $key ] = $value; $changed = true; if ( isset( $this->parent->compiler_fields[ $key ] ) ) { $compiler = true; } } } } if ( $changed ) { $this->parent->set_options( $this->parent->options ); if ( $compiler ) { // Have to set this to stop the output of the CSS and typography stuff. $this->parent->no_output = true; $this->parent->_enqueue_output(); do_action( "redux/options/{$this->parent->args['opt_name']}/compiler", $this->parent->options, $this->parent->compilerCSS ); do_action( "redux/options/{$this->args['opt_name']}/compiler/advanced", $this->parent ); } } } /** * Enqueue CSS/JS for preview pane * * @since 1.0.0 * @access public * @global $wp_styles * @return void */ public function _enqueue_previewer() { wp_enqueue_script( 'redux-extension-previewer-js', $this->_extension_url . 'assets/js/preview.js' ); $localize = array( 'save_pending' => __( 'You have changes that are not saved. Would you like to save them now?', 'redux-framework' ), 'reset_confirm' => __( 'Are you sure? Resetting will lose all custom values.', 'redux-framework' ), 'preset_confirm' => __( 'Your current options will be replaced with the values of this preset. Would you like to proceed?', 'redux-framework' ), 'opt_name' => $this->args['opt_name'], //'folds' => $this->folds, 'options' => $this->parent->options, 'defaults' => $this->parent->options_defaults, ); wp_localize_script( 'redux-extension-previewer-js', 'reduxPost', $localize ); } /** * Enqueue CSS/JS for the customizer controls * * @since 1.0.0 * @access public * @global $wp_styles * @return void */ public function _enqueue() { global $wp_styles; //wp_enqueue_style( 'wp-pointer' ); //wp_enqueue_script( 'wp-pointer' ); // Remove when code is in place! //wp_enqueue_script('redux-extension-customizer-js', $this->_extension_url . 'assets/js/customizer.js'); // Get styles //wp_enqueue_style('redux-extension-customizer-css', $this->_extension_url . 'assets/css/customizer.css'); $localize = array( 'save_pending' => __( 'You have changes that are not saved. Would you like to save them now?', 'redux-framework' ), 'reset_confirm' => __( 'Are you sure? Resetting will lose all custom values.', 'redux-framework' ), 'preset_confirm' => __( 'Your current options will be replaced with the values of this preset. Would you like to proceed?', 'redux-framework' ), 'opt_name' => $this->args['opt_name'], //'folds' => $this->folds, 'field' => $this->parent->options, 'defaults' => $this->parent->options_defaults, ); // Values used by the javascript wp_localize_script( 'redux-js', 'redux_opts', $localize ); do_action( 'redux-enqueue-' . $this->args['opt_name'] ); foreach ( $this->sections as $section ) { if ( isset( $section['fields'] ) ) { foreach ( $section['fields'] as $field ) { if ( isset( $field['type'] ) ) { $field_class = 'ReduxFramework_' . $field['type']; if ( ! class_exists( $field_class ) ) { $class_file = apply_filters( 'redux-typeclass-load', $this->path . 'inc/fields/' . $field['type'] . '/field_' . $field['type'] . '.php', $field_class ); if ( $class_file ) { /** @noinspection PhpIncludeInspection */ require_once( $class_file ); } } if ( class_exists( $field_class ) && method_exists( $field_class, 'enqueue' ) ) { $enqueue = new $field_class( '', '', $this ); $enqueue->enqueue(); } } } } } } /** * Register Option for use * * @since 1.0.0 * @access public * @return void */ public function _register_setting() { } /** * Validate the options before insertion * * @since 3.0.0 * @access public * * @param array $plugin_options The options array * * @return */ public function _field_validation( $value ) { //print_r( $value ); //print_r( $_POST ); return $value; //return $this->parent->_validate_options( $plugin_options ); } /** * HTML OUTPUT. * * @since 1.0.0 * @access public * @return void */ public function _customizer_html_output() { } } // class function redux_customizer_custom_validation( $field ) { return $field; } } // if extensions/customizer/extension_customizer.js000066600000043360152141561100016013 0ustar00/* global jQuery, document, redux, redux_change, setting */ /*! SerializeJSON jQuery plugin. https://github.com/marioizquierdo/jquery.serializeJSON version 2.6.0 (Apr, 2015) Copyright (c) 2012, 2015 Mario Izquierdo Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. */ (function( $ ) { "use strict"; // jQuery('form').serializeJSON() $.fn.serializeJSON = function( options ) { var serializedObject, formAsArray, keys, type, value, _ref, f, opts; f = $.serializeJSON; opts = f.setupOpts( options ); // calculate values for options {parseNumbers, parseBoolens, parseNulls} formAsArray = this.serializeArray(); // array of objects {name, value} f.readCheckboxUncheckedValues( formAsArray, this, opts ); // add {name, value} of unchecked checkboxes if needed serializedObject = {}; $.each( formAsArray, function( i, input ) { keys = f.splitInputNameIntoKeysArray( input.name, opts ); type = keys.pop(); // the last element is always the type ("string" by default) if ( type !== 'skip' ) { // easy way to skip a value value = f.parseValue( input.value, type, opts ); // string, number, boolean or null if ( opts.parseWithFunction && type === '_' ) value = opts.parseWithFunction( value, input.name ); // allow for custom parsing f.deepSet( serializedObject, keys, value, opts ); } } ); return serializedObject; }; // Use $.serializeJSON as namespace for the auxiliar functions // and to define defaults $.serializeJSON = { defaultOptions: { checkboxUncheckedValue: undefined, // to include that value for unchecked checkboxes (instead of ignoring them) parseNumbers: false, // convert values like "1", "-2.33" to 1, -2.33 parseBooleans: false, // convert "true", "false" to true, false parseNulls: false, // convert "null" to null parseAll: false, // all of the above parseWithFunction: null, // to use custom parser, a function like: function(val){ return parsed_val; } customTypes: {}, // override defaultTypes defaultTypes: { string: function( str ) { return String( str ); }, number: function( str ) { return Number( str ); }, boolean: function( str ) { return (["false", "null", "undefined", "", "0"].indexOf( str ) === -1); }, null: function( str ) { return (["false", "null", "undefined", "", "0"].indexOf( str ) !== -1) ? null : str; }, array: function( str ) { return JSON.parse( str ); }, object: function( str ) { return JSON.parse( str ); }, auto: function( str ) { return $.serializeJSON.parseValue( str, null, {parseNumbers: true, parseBooleans: true, parseNulls: true} ); } // try again with something like "parseAll" }, useIntKeysAsArrayIndex: false, // name="foo[2]" value="v" => {foo: [null, null, "v"]}, instead of {foo: ["2": "v"]} }, // Merge option defaults into the options setupOpts: function( options ) { var opt, validOpts, defaultOptions, optWithDefault, parseAll, f; f = $.serializeJSON; if ( options === null || options === undefined ) options = {}; // options ||= {} defaultOptions = f.defaultOptions || {}; // defaultOptions // Make sure that the user didn't misspell an option validOpts = ['checkboxUncheckedValue', 'parseNumbers', 'parseBooleans', 'parseNulls', 'parseAll', 'parseWithFunction', 'customTypes', 'defaultTypes', 'useIntKeysAsArrayIndex']; // re-define because the user may override the defaultOptions for ( opt in options ) { if ( validOpts.indexOf( opt ) === -1 ) { throw new Error( "serializeJSON ERROR: invalid option '" + opt + "'. Please use one of " + validOpts.join( ', ' ) ); } } // Helper to get the default value for this option if none is specified by the user optWithDefault = function( key ) { return (options[key] !== false) && (options[key] !== '') && (options[key] || defaultOptions[key]); }; // Return computed options (opts to be used in the rest of the script) parseAll = optWithDefault( 'parseAll' ); return { checkboxUncheckedValue: optWithDefault( 'checkboxUncheckedValue' ), parseNumbers: parseAll || optWithDefault( 'parseNumbers' ), parseBooleans: parseAll || optWithDefault( 'parseBooleans' ), parseNulls: parseAll || optWithDefault( 'parseNulls' ), parseWithFunction: optWithDefault( 'parseWithFunction' ), typeFunctions: $.extend( {}, optWithDefault( 'defaultTypes' ), optWithDefault( 'customTypes' ) ), useIntKeysAsArrayIndex: optWithDefault( 'useIntKeysAsArrayIndex' ), }; }, // Given a string, apply the type or the relevant "parse" options, to return the parsed value parseValue: function( str, type, opts ) { var typeFunction, f; f = $.serializeJSON; // Parse with a type if available typeFunction = opts.typeFunctions && opts.typeFunctions[type]; if ( typeFunction ) return typeFunction( str ); // use specific type // Otherwise, check if there is any auto-parse option enabled and use it. if ( opts.parseNumbers && f.isNumeric( str ) ) return Number( str ); // auto: number if ( opts.parseBooleans && (str === "true" || str === "false") ) return str === "true"; // auto: boolean if ( opts.parseNulls && str == "null" ) return null; // auto: null // If none applies, just return the str return str; }, isObject: function( obj ) { return obj === Object( obj ); }, // is this variable an object? isUndefined: function( obj ) { return obj === void 0; }, // safe check for undefined values isValidArrayIndex: function( val ) { return /^[0-9]+$/.test( String( val ) ); }, // 1,2,3,4 ... are valid array indexes isNumeric: function( obj ) { return obj - parseFloat( obj ) >= 0; }, // taken from jQuery.isNumeric implementation. Not using jQuery.isNumeric to support old jQuery and Zepto versions optionKeys: function( obj ) { if ( Object.keys ) { return Object.keys( obj ); } else { var keys = []; for ( var key in obj ) { keys.push( key ); } return keys; } }, // polyfill Object.keys to get option keys in IE<9 // Split the input name in programatically readable keys. // The last element is always the type (default "_"). // Examples: // "foo" => ['foo', '_'] // "foo:string" => ['foo', 'string'] // "foo:boolean" => ['foo', 'boolean'] // "[foo]" => ['foo', '_'] // "foo[inn][bar]" => ['foo', 'inn', 'bar', '_'] // "foo[inn[bar]]" => ['foo', 'inn', 'bar', '_'] // "foo[inn][arr][0]" => ['foo', 'inn', 'arr', '0', '_'] // "arr[][val]" => ['arr', '', 'val', '_'] // "arr[][val]:null" => ['arr', '', 'val', 'null'] splitInputNameIntoKeysArray: function( name, opts ) { var keys, nameWithoutType, type, _ref, f; f = $.serializeJSON; _ref = f.extractTypeFromInputName( name, opts ), nameWithoutType = _ref[0], type = _ref[1]; keys = nameWithoutType.split( '[' ); // split string into array keys = $.map( keys, function( key ) { return key.replace( /]/g, '' ); } ); // remove closing brackets if ( keys[0] === '' ) { keys.shift(); } // ensure no opening bracket ("[foo][inn]" should be same as "foo[inn]") keys.push( type ); // add type at the end return keys; }, // Returns [name-without-type, type] from name. // "foo" => ["foo", '_'] // "foo:boolean" => ["foo", 'boolean'] // "foo[bar]:null" => ["foo[bar]", 'null'] extractTypeFromInputName: function( name, opts ) { var match, validTypes, f; if ( match = name.match( /(.*):([^:]+)$/ ) ) { f = $.serializeJSON; validTypes = f.optionKeys( opts ? opts.typeFunctions : f.defaultOptions.defaultTypes ); validTypes.push( 'skip' ); // skip is a special type that makes it easy to remove if ( validTypes.indexOf( match[2] ) !== -1 ) { return [match[1], match[2]]; } else { throw new Error( "serializeJSON ERROR: Invalid type " + match[2] + " found in input name '" + name + "', please use one of " + validTypes.join( ', ' ) ) } } else { return [name, '_']; // no defined type, then use parse options } }, // Set a value in an object or array, using multiple keys to set in a nested object or array: // // deepSet(obj, ['foo'], v) // obj['foo'] = v // deepSet(obj, ['foo', 'inn'], v) // obj['foo']['inn'] = v // Create the inner obj['foo'] object, if needed // deepSet(obj, ['foo', 'inn', '123'], v) // obj['foo']['arr']['123'] = v // // // deepSet(obj, ['0'], v) // obj['0'] = v // deepSet(arr, ['0'], v, {useIntKeysAsArrayIndex: true}) // arr[0] = v // deepSet(arr, [''], v) // arr.push(v) // deepSet(obj, ['arr', ''], v) // obj['arr'].push(v) // // arr = []; // deepSet(arr, ['', v] // arr => [v] // deepSet(arr, ['', 'foo'], v) // arr => [v, {foo: v}] // deepSet(arr, ['', 'bar'], v) // arr => [v, {foo: v, bar: v}] // deepSet(arr, ['', 'bar'], v) // arr => [v, {foo: v, bar: v}, {bar: v}] // deepSet: function( o, keys, value, opts ) { var key, nextKey, tail, lastIdx, lastVal, f; if ( opts == null ) opts = {}; f = $.serializeJSON; if ( f.isUndefined( o ) ) { throw new Error( "ArgumentError: param 'o' expected to be an object or array, found undefined" ); } if ( !keys || keys.length === 0 ) { throw new Error( "ArgumentError: param 'keys' expected to be an array with least one element" ); } key = keys[0]; // Only one key, then it's not a deepSet, just assign the value. if ( keys.length === 1 ) { if ( key === '' ) { o.push( value ); // '' is used to push values into the array (assume o is an array) } else { o[key] = value; // other keys can be used as object keys or array indexes } // With more keys is a deepSet. Apply recursively. } else { nextKey = keys[1]; // '' is used to push values into the array, // with nextKey, set the value into the same object, in object[nextKey]. // Covers the case of ['', 'foo'] and ['', 'var'] to push the object {foo, var}, and the case of nested arrays. if ( key === '' ) { lastIdx = o.length - 1; // asume o is array lastVal = o[lastIdx]; if ( f.isObject( lastVal ) && (f.isUndefined( lastVal[nextKey] ) || keys.length > 2) ) { // if nextKey is not present in the last object element, or there are more keys to deep set key = lastIdx; // then set the new value in the same object element } else { key = lastIdx + 1; // otherwise, point to set the next index in the array } } // '' is used to push values into the array "array[]" if ( nextKey === '' ) { if ( f.isUndefined( o[key] ) || !$.isArray( o[key] ) ) { o[key] = []; // define (or override) as array to push values } } else { if ( opts.useIntKeysAsArrayIndex && f.isValidArrayIndex( nextKey ) ) { // if 1, 2, 3 ... then use an array, where nextKey is the index if ( f.isUndefined( o[key] ) || !$.isArray( o[key] ) ) { o[key] = []; // define (or override) as array, to insert values using int keys as array indexes } } else { // for anything else, use an object, where nextKey is going to be the attribute name if ( f.isUndefined( o[key] ) || !f.isObject( o[key] ) ) { o[key] = {}; // define (or override) as object, to set nested properties } } } // Recursively set the inner object tail = keys.slice( 1 ); f.deepSet( o[key], tail, value, opts ); } }, // Fill the formAsArray object with values for the unchecked checkbox inputs, // using the same format as the jquery.serializeArray function. // The value of the unchecked values is determined from the opts.checkboxUncheckedValue // and/or the data-unchecked-value attribute of the inputs. readCheckboxUncheckedValues: function( formAsArray, $form, opts ) { var selector, $uncheckedCheckboxes, $el, dataUncheckedValue, f; if ( opts == null ) opts = {}; f = $.serializeJSON; selector = 'input[type=checkbox][name]:not(:checked):not([disabled])'; $uncheckedCheckboxes = $form.find( selector ).add( $form.filter( selector ) ); $uncheckedCheckboxes.each( function( i, el ) { $el = $( el ); dataUncheckedValue = $el.attr( 'data-unchecked-value' ); if ( dataUncheckedValue ) { // data-unchecked-value has precedence over option opts.checkboxUncheckedValue formAsArray.push( {name: el.name, value: dataUncheckedValue} ); } else { if ( !f.isUndefined( opts.checkboxUncheckedValue ) ) { formAsArray.push( {name: el.name, value: opts.checkboxUncheckedValue} ); } } } ); } }; }( window.jQuery || window.$ )); (function( $ ) { //This functions first parameter is named $ 'use strict'; redux.customizer = redux.customizer || {}; $( document ).ready( function() { redux.customizer.init(); } ); redux.customizer.init = function() { $( 'body' ).addClass( redux_customizer.body_class ); $( '.accordion-section.redux-section, .accordion-section.redux-panel, .accordion-section-title' ).click( function() { $.redux.initFields(); } ); redux.args.disable_save_warn = true; var reduxChange = redux_change; redux_change = function( variable ) { variable = $( variable ); reduxChange.apply( this, arguments ); redux.customizer.save( variable ) }; var redux_initFields = $.redux.initFields; $.redux.initFiles = function() { redux_initFields(); } }; redux.customizer.save = function( $obj ) { var $parent = $obj.hasClass( 'redux-field' ) ? $obj : $obj.parents( '.redux-field-container:first' ); redux.customizer.inputSave( $parent ); }; redux.customizer.inputSave = function( $parent ) { if ( !$parent.hasClass( 'redux-field-container' ) ) { $parent = $parent.parents( '[class^="redux-field-container"]' ); } var $id = $parent.parent().find( '.redux-customizer-input' ).data( 'id' ); if ( !$id ) { $parent = $parent.parents( '.redux-container-repeater:first' ); var $id = $parent.parent().find( '.redux-customizer-input' ).data( 'id' ); } //var $nData = $parent.serializeJSON(); var $nData = $parent.find( ':input' ).serializeJSON(); $.each( $nData, function( $k, $v ) { $nData = $v; } ); var $key = $parent.parent().find( '.redux-customizer-input' ).data( 'key' ); if ( $nData[$key] ) { $nData = $nData[$key]; } var $control = wp.customize.control( $id ); // Customizer hack since they didn't code it to save order... if ( JSON.stringify( $control.setting._value ) !== JSON.stringify( $nData ) ) { $control.setting._value = null; } $control.setting.set( $nData ); } })( jQuery );extensions/customizer/extension_customizer.css000066600000003477152141561100016174 0ustar00.redux-section p.customize-section-description{margin-top:22px;word-break:break-word}.redux-section p.customize-section-description.legacy{margin-top:7px}.control-section-themes .accordion-section-title{margin:0}#customize-controls .customize-info{margin-bottom:0}#customize-controls .redux-section .accordion-section-content{background:#fcfcfc}.redux-section .accordion-section-title i,.redux-field .accordion-field-title i,.redux-panel .accordion-section-title i{margin-right:5px}.accordion-section.redux-main{background:inherit;margin-left:inherit;border-left:inherit;-moz-box-shadow:inherit;-webkit-box-shadow:inherit;padding:inherit;box-shadow:inherit}.redux_field_th{padding:13px 0 0 0}.redux-main .redux-field-container{padding:10px 0}.redux-main .select_wrapper{float:none;width:100%;display:inline-block}.redux-main .select2-container{margin-right:0 !important;margin-bottom:5px !important;width:100% !important}.redux-main .select_wrapper:nth-child(odd){margin-right:0}.redux-main .redux-option-image{max-width:42% !important;margin-right:3%}.redux-main .customize-control{border-bottom:1px solid #ddd;padding-bottom:4px}.redux-main .customize-control:last-child{border-bottom:0;padding-bottom:0}.redux-main .upload{width:100% !important}.redux-main h3{margin-top:inherit}.redux-main .redux-container-raw{margin-top:22px;word-break:break-word;padding:0 !important}.redux-main .redux-container-password input{width:100%}.select2-drop{z-index:999999}.rAdsContainer{line-height:0;border:0}.customize-control-redux-raw{list-style:none}.rAds{position:inherit !important;right:0 !important;top:0 !important;bottom:0 !important;left:0 !important;text-align:center;margin-bottom:0;line-height:0;-webkit-transition:left ease-in-out .18s;transition:left ease-in-out .18s}.rAds img{-webkit-transition:left ease-in-out .18s;transition:left ease-in-out .18s}extensions/import_export/extension_import_export.php000066600000020425152141561100017401 0ustar00. * * @package ReduxFramework * @author Dovy Paukstys (dovy) * @version 4.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_extension_import_export' ) ) { /** * Main ReduxFramework import_export extension class * * @since 3.1.6 */ class ReduxFramework_extension_import_export { // Protected vars protected $parent; public $extension_url; public $extension_dir; public static $theInstance; public static $version = "4.0"; public $is_field = false; /** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * * @param array $sections Panel sections. * @param array $args Class constructor arguments. * @param array $extra_tabs Extra panel tabs. * * @return void */ public function __construct( $parent ) { $this->parent = $parent; if ( empty( $this->extension_dir ) ) { //$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); } $this->field_name = 'import_export'; self::$theInstance = $this; add_action( "wp_ajax_redux_link_options-" . $this->parent->args['opt_name'], array( $this, "link_options" ) ); add_action( "wp_ajax_nopriv_redux_link_options-" . $this->parent->args['opt_name'], array( $this, "link_options" ) ); add_action( "wp_ajax_redux_download_options-" . $this->parent->args['opt_name'], array( $this, "download_options" ) ); add_action( "wp_ajax_nopriv_redux_download_options-" . $this->parent->args['opt_name'], array( $this, "download_options" ) ); do_action( "redux/options/{$this->parent->args['opt_name']}/import", array( $this, 'remove_cookie' ) ); $this->is_field = Redux_Helpers::isFieldInUse( $parent, 'import_export' ); if ( ! $this->is_field && $this->parent->args['show_import_export'] ) { $this->add_section(); } add_filter( 'redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array( &$this, 'overload_field_path' ) ); // Adds the local field add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) ); } /** * Adds the appropriate mime types to WordPress * * @param array $existing_mimes * * @return array */ function custom_upload_mimes( $existing_mimes = array() ) { $existing_mimes['redux'] = 'application/redux'; return $existing_mimes; } public function add_section() { $this->parent->sections[] = array( 'id' => 'import/export', 'title' => __( 'Import / Export', 'redux-framework' ), 'heading' => '', 'icon' => 'el el-refresh', 'customizer' => false, 'fields' => array( array( 'id' => 'redux_import_export', 'type' => 'import_export', //'class' => 'redux-field-init redux_remove_th', //'title' => '', 'full_width' => true, ) ), ); } function link_options() { if ( ! isset( $_GET['secret'] ) || $_GET['secret'] != md5( md5( AUTH_KEY . SECURE_AUTH_KEY ) . '-' . $this->parent->args['opt_name'] ) ) { wp_die( 'Invalid Secret for options use' ); exit; } $var = $this->parent->options; $var['redux-backup'] = '1'; if ( isset( $var['REDUX_imported'] ) ) { unset( $var['REDUX_imported'] ); } echo json_encode( $var ); die(); } public function download_options() { if ( ! isset( $_GET['secret'] ) || $_GET['secret'] != md5( md5( AUTH_KEY . SECURE_AUTH_KEY ) . '-' . $this->parent->args['opt_name'] ) ) { wp_die( 'Invalid Secret for options use' ); exit; } $this->parent->get_options(); $backup_options = $this->parent->options; $backup_options['redux-backup'] = '1'; if ( isset( $backup_options['REDUX_imported'] ) ) { unset( $backup_options['REDUX_imported'] ); } // No need to escape this, as it's been properly escaped previously and through json_encode $content = json_encode( $backup_options ); if ( isset( $_GET['action'] ) && $_GET['action'] == 'redux_download_options-' . $this->parent->args['opt_name'] ) { header( 'Content-Description: File Transfer' ); header( 'Content-type: application/txt' ); header( 'Content-Disposition: attachment; filename="redux_options_' . $this->parent->args['opt_name'] . '_backup_' . date( 'd-m-Y' ) . '.json"' ); header( 'Content-Transfer-Encoding: binary' ); header( 'Expires: 0' ); header( 'Cache-Control: must-revalidate' ); header( 'Pragma: public' ); echo $content; exit; } else { header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', false ); header( 'Pragma: no-cache' ); // Can't include the type. Thanks old Firefox and IE. BAH. //header("Content-type: application/json"); echo $content; exit; } } // Forces the use of the embeded field path vs what the core typically would use public function overload_field_path( $field ) { return dirname( __FILE__ ) . '/' . $this->field_name . '/field_' . $this->field_name . '.php'; } public function remove_cookie() { // Remove the import/export tab cookie. if ( $_COOKIE['redux_current_tab'] == 'import_export_default' ) { setcookie( 'redux_current_tab', '', 1, '/' ); $_COOKIE['redux_current_tab'] = 1; } } } } extensions/import_export/import_export/field_import_export.css000066600000000245152141561100021362 0ustar00#redux-import-link-wrapper,#redux-import-code-wrapper{display:none}#redux-export-code,#redux-export-link-value{display:none}#redux-import-action span{color:#B94A48} extensions/import_export/import_export/field_import_export.php000066600000021634152141561100021366 0ustar00. * * @package ReduxFramework * @author Dovy Paukstys * @version 3.1.5 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_import_export' ) ) { /** * Main ReduxFramework_import_export class * * @since 1.0.0 */ class ReduxFramework_import_export extends ReduxFramework { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; $this->is_field = $this->parent->extensions['import_export']->is_field; $this->extension_dir = ReduxFramework::$_dir . 'inc/extensions/import_export/'; $this->extension_url = ReduxFramework::$_url . 'inc/extensions/import_export/'; // Set default args for this field to avoid bad indexes. Change this to anything you use. $defaults = array( 'options' => array(), 'stylesheet' => '', 'output' => true, 'enqueue' => true, 'enqueue_frontend' => true ); $this->field = wp_parse_args( $this->field, $defaults ); } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $secret = md5( md5( AUTH_KEY . SECURE_AUTH_KEY ) . '-' . $this->parent->args['opt_name'] ); // No errors please $defaults = array( 'full_width' => true, 'overflow' => 'inherit', ); $this->field = wp_parse_args( $this->field, $defaults ); $bDoClose = false; // $this->parent->args['opt_name'] & $this->field['id'] are sanitized in the ReduxFramework class, no need to re-sanitize it. $id = $this->parent->args['opt_name'] . '-' . $this->field['id']; // $this->field['type'] && $this->field['id'] is sanitized in the ReduxFramework class, no need to re-sanitize it. ?>

parent->args['opt_name'] is sanitized in the ReduxFramework class, no need to re-sanitize it. ?>

  

 

parent->args['opt_name'] is sanitized in the ReduxFramework class, no need to re-sanitize it. $link = esc_url( admin_url( 'admin-ajax.php?action=redux_download_options-' . $this->parent->args['opt_name'] . '&secret=' . $secret ) ); ?>

extension_url . 'import_export/field_import_export' . Redux_Functions::isMin() . '.js', array( 'jquery' ), ReduxFramework_extension_import_export::$version, true ); wp_enqueue_style( 'redux-import-export', $this->extension_url . 'import_export/field_import_export.css', time(), true ); } /** * Output Function. * Used to enqueue to the front-end * * @since 1.0.0 * @access public * @return void */ public function output() { if ( $this->field['enqueue_frontend'] ) { } } } } extensions/import_export/import_export/field_import_export.js000066600000023070152141561100021207 0ustar00/*global jQuery, document, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.import_export = redux.field_objects.import_export || {}; redux.field_objects.import_export.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-import_export:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.each( function() { $( '#redux-import' ).click( function( e ) { if ( $( '#import-code-value' ).val() === "" && $( '#import-link-value' ).val() === "" ) { e.preventDefault(); return false; } window.onbeforeunload = null; redux.args.ajax_save = false; } ); $( this ).find( '#redux-import-code-button' ).click( function() { var $el = $( '#redux-import-code-wrapper' ); if ( $( '#redux-import-link-wrapper' ).is( ':visible' ) ) { $( '#import-link-value' ).text( '' ); $( '#redux-import-link-wrapper' ).slideUp( 'fast', function() { $el.slideDown( 'fast', function() { $( '#import-code-value' ).focus(); } ); } ); } else { if ( $el.is( ':visible' ) ) { $el.slideUp(); } else { $el.slideDown( 'medium', function() { $( '#import-code-value' ).focus(); } ); } } } ); $( this ).find( '#redux-import-link-button' ).click( function() { var $el = $( '#redux-import-link-wrapper' ); if ( $( '#redux-import-code-wrapper' ).is( ':visible' ) ) { $( '#import-code-value' ).text( '' ); $( '#redux-import-code-wrapper' ).slideUp( 'fast', function() { $el.slideDown( 'fast', function() { $( '#import-link-value' ).focus(); } ); } ); } else { if ( $el.is( ':visible' ) ) { $el.slideUp(); } else { $el.slideDown( 'medium', function() { $( '#import-link-value' ).focus(); } ); } } } ); $( this ).find( '#redux-export-code-copy' ).click( function() { var $el = $( '#redux-export-code' ); if ( $( '#redux-export-link-value' ).is( ':visible' ) ) { $( '#redux-export-link-value' ).slideUp( 'fast', function() { $el.slideDown( 'medium', function() { var options = redux.options; options['redux-backup'] = 1; $( this ).text( JSON.stringify( options ) ).focus().select(); } ); } ); } else { if ( $el.is( ':visible' ) ) { $el.slideUp().text( '' ); } else { $el.slideDown( 'medium', function() { var options = redux.options; options['redux-backup'] = 1; $( this ).text( JSON.stringify( options ) ).focus().select(); } ); } } } ); $( this ).find( 'textarea' ).focusout( function() { var $id = $( this ).attr( 'id' ); var $el = $( this ); var $container = $el; if ( $id == "import-link-value" || $id == "import-code-value" ) { $container = $( this ).parent(); } $container.slideUp( 'medium', function() { if ( $id != "redux-export-link-value" ) { $el.text( '' ); } } ); } ); $( this ).find( '#redux-export-link' ).click( function() { var $el = $( '#redux-export-link-value' ); if ( $( '#redux-export-code' ).is( ':visible' ) ) { $( '#redux-export-code' ).slideUp( 'fast', function() { $el.slideDown().focus().select(); } ); } else { if ( $el.is( ':visible' ) ) { $el.slideUp(); } else { $el.slideDown( 'medium', function() { $( this ).focus().select(); } ); } } } ); var textBox1 = document.getElementById( "redux-export-code" ); textBox1.onfocus = function() { textBox1.select(); // Work around Chrome's little problem textBox1.onmouseup = function() { // Prevent further mouseup intervention textBox1.onmouseup = null; return false; }; }; var textBox2 = document.getElementById( "import-code-value" ); textBox2.onfocus = function() { textBox2.select(); // Work around Chrome's little problem textBox2.onmouseup = function() { // Prevent further mouseup intervention textBox2.onmouseup = null; return false; }; }; } ); } ); }; })( jQuery ); extensions/import_export/import_export/field_import_export.scss000066600000000305152141561100021542 0ustar00#redux-import-link-wrapper, #redux-import-code-wrapper { display: none; } #redux-export-code, #redux-export-link-value { display: none; } #redux-import-action span { color: #B94A48; }extensions/import_export/import_export/field_import_export.min.js000066600000005366152141561100022001 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.import_export=redux.field_objects.import_export||{},redux.field_objects.import_export.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-import_export:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.each(function(){a("#redux-import").click(function(b){return""===a("#import-code-value").val()&&""===a("#import-link-value").val()?(b.preventDefault(),!1):(window.onbeforeunload=null,void(redux.args.ajax_save=!1))}),a(this).find("#redux-import-code-button").click(function(){var b=a("#redux-import-code-wrapper");a("#redux-import-link-wrapper").is(":visible")?(a("#import-link-value").text(""),a("#redux-import-link-wrapper").slideUp("fast",function(){b.slideDown("fast",function(){a("#import-code-value").focus()})})):b.is(":visible")?b.slideUp():b.slideDown("medium",function(){a("#import-code-value").focus()})}),a(this).find("#redux-import-link-button").click(function(){var b=a("#redux-import-link-wrapper");a("#redux-import-code-wrapper").is(":visible")?(a("#import-code-value").text(""),a("#redux-import-code-wrapper").slideUp("fast",function(){b.slideDown("fast",function(){a("#import-link-value").focus()})})):b.is(":visible")?b.slideUp():b.slideDown("medium",function(){a("#import-link-value").focus()})}),a(this).find("#redux-export-code-copy").click(function(){var b=a("#redux-export-code");a("#redux-export-link-value").is(":visible")?a("#redux-export-link-value").slideUp("fast",function(){b.slideDown("medium",function(){var b=redux.options;b["redux-backup"]=1,a(this).text(JSON.stringify(b)).focus().select()})}):b.is(":visible")?b.slideUp().text(""):b.slideDown("medium",function(){var b=redux.options;b["redux-backup"]=1,a(this).text(JSON.stringify(b)).focus().select()})}),a(this).find("textarea").focusout(function(){var b=a(this).attr("id"),c=a(this),d=c;("import-link-value"==b||"import-code-value"==b)&&(d=a(this).parent()),d.slideUp("medium",function(){"redux-export-link-value"!=b&&c.text("")})}),a(this).find("#redux-export-link").click(function(){var b=a("#redux-export-link-value");a("#redux-export-code").is(":visible")?a("#redux-export-code").slideUp("fast",function(){b.slideDown().focus().select()}):b.is(":visible")?b.slideUp():b.slideDown("medium",function(){a(this).focus().select()})});var b=document.getElementById("redux-export-code");b.onfocus=function(){b.select(),b.onmouseup=function(){return b.onmouseup=null,!1}};var c=document.getElementById("import-code-value");c.onfocus=function(){c.select(),c.onmouseup=function(){return c.onmouseup=null,!1}}}))})}}(jQuery);fields/select_image/field_select_image.scss000066600000000620152141561100015112 0ustar00.redux-container-select_image { margin-top: 2px; margin-left: 5px; width: 100%; margin-bottom: 0; } .redux-preview-image { max-height: 250px; max-width: 250px; padding: 5px; margin-top: 10px; border: 1px solid #e3e3e3; background: #f7f7f7; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } fields/select_image/field_select_image.min.js000066600000002021152141561100015332 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.select_image=redux.field_objects.select_image||{},a(document).ready(function(){}),redux.field_objects.select_image.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-select_image:visible")),a(b).each(function(){var b=a(this),c=b;if(b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),!c.is(":hidden")&&c.hasClass("redux-field-init")){c.removeClass("redux-field-init");var d={width:"resolve",triggerChange:!0,allowClear:!0},e=b.find(".redux-container-select_image").find(".select2_params");if(e.size()>0){var f=e.val();f=JSON.parse(f),d=a.extend({},d,f)}b.find("select.redux-select-images").select2(d),b.find(".redux-select-images").on("change",function(){var b=a(this).parents(".redux-field:first").find(".redux-preview-image");""===a(this).val()?b.fadeOut("medium",function(){b.attr("src","")}):(b.attr("src",a(this).val()),b.fadeIn().css("visibility","visible"))})}})}}(jQuery);fields/select_image/field_select_image.php000066600000015067152141561100014741 0ustar00 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'ReduxFramework_select_image' ) ) { class ReduxFramework_select_image { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { // If options is NOT empty, the process if ( ! empty( $this->field['options'] ) ) { // Strip off the file ext if ( isset( $this->value ) ) { $name = explode( ".", $this->value ); $name = str_replace( '.' . end( $name ), '', $this->value ); $name = basename( $name ); //$this->value = trim( $name ); $filename = trim($name); } // beancounter $x = 1; // Process width if ( ! empty( $this->field['width'] ) ) { $width = ' style="width:' . $this->field['width'] . ';"'; } else { $width = ' style="width: 40%;"'; } // Process placeholder $placeholder = ( isset( $this->field['placeholder'] ) ) ? esc_attr( $this->field['placeholder'] ) : __( 'Select an item', 'redux-framework' ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } // Begin the '; echo ''; // Enum through the options array foreach ( $this->field['options'] as $k => $v ) { // No array? No problem! if ( ! is_array( $v ) ) { $v = array( 'img' => $v ); } // No title set? Make it blank. if ( ! isset( $v['title'] ) ) { $v['title'] = ''; } // No alt? Set it to title. We do this so the alt tag shows // something. It also makes HTML/SEO purists happy. if ( ! isset( $v['alt'] ) ) { $v['alt'] = $v['title']; } // Set the selected entry $selected = selected( $this->value, $v['img'], false ); // If selected returns something other than a blank space, we // found our default/saved name. Save the array number in a // variable to use later on when we want to extract its associted // url. if ( '' != $selected ) { $arrNum = $x; } // Add the option tag, with values. echo ''; // Add a bean $x ++; } // Close the '; // Some space echo '

'; // Show the preview image. echo '
'; // just in case. You never know. if ( ! isset( $arrNum ) ) { $this->value = ''; } // Set the default image. To get the url from the default name, // we save the array count from the for/each loop, when the default image // is mark as selected. Since the for/each loop starts at one, we must // substract one from the saved array number. We then pull the url // out of the options array, and there we go. if ( '' == $this->value ) { echo ''; } else { echo ''; } // Close the
tag. echo '
'; } else { // No options specified. Really? echo '' . __( 'No items of this type were found.', 'redux-framework' ) . ''; } } //function /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ function enqueue() { wp_enqueue_style( 'select2-css' ); wp_enqueue_script( 'field-select-image-js', ReduxFramework::$_url . 'inc/fields/select_image/field_select_image' . Redux_Functions::isMin() . '.js', array('jquery', 'select2-js', 'redux-js'), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-select-image-css', ReduxFramework::$_url . 'inc/fields/select_image/field_select_image.css', array(), time(), 'all' ); } } //function } //class }fields/select_image/field_select_image.css000066600000000462152141561100014733 0ustar00.redux-container-select_image{margin-top:2px;margin-left:5px;width:100%;margin-bottom:0}.redux-preview-image{max-height:250px;max-width:250px;padding:5px;margin-top:10px;border:1px solid #e3e3e3;background:#f7f7f7;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}fields/select_image/field_select_image.js000066600000005020152141561100014552 0ustar00/*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.select_image = redux.field_objects.select_image || {}; $( document ).ready( function() { //redux.field_objects.select_image.init(); } ); redux.field_objects.select_image.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-select_image:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; var select2_handle = el.find( '.redux-container-select_image' ).find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } el.find( 'select.redux-select-images' ).select2( default_params ); el.find( '.redux-select-images' ).on( 'change', function() { var preview = $( this ).parents( '.redux-field:first' ).find( '.redux-preview-image' ); if ( $( this ).val() === "" ) { preview.fadeOut( 'medium', function() { preview.attr( 'src', '' ); } ); } else { preview.attr( 'src', $( this ).val() ); preview.fadeIn().css( 'visibility', 'visible' ); } } ); } ); }; })( jQuery );fields/select_image/field_select_image.css.map000066600000000673152141561100015513 0ustar00{ "version": 3, "mappings": "AAAA,6BAA8B;EAC1B,UAAU,EAAE,GAAG;EACf,WAAW,EAAE,GAAG;EAChB,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,CAAC;;AAGpB,oBAAqB;EACjB,UAAU,EAAE,KAAK;EACjB,SAAS,EAAE,KAAK;EAChB,OAAO,EAAE,GAAG;EACZ,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,iBAAiB;EACzB,UAAU,EAAE,OAAO;EACnB,kBAAkB,EAAE,GAAG;EACvB,oBAAoB,EAAE,GAAG;EACzB,qBAAqB,EAAE,GAAG;EAC1B,aAAa,EAAE,GAAG", "sources": ["field_select_image.scss"], "names": [], "file": "field_select_image.css" }fields/radio/field_radio.php000066600000004566152141561100012075 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { if ( empty( $this->field['args'] ) ) { $this->field['args'] = array(); } $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] ); } $this->field['data_class'] = ( isset( $this->field['multi_layout'] ) ) ? 'data-' . $this->field['multi_layout'] : 'data-full'; if ( ! empty( $this->field['options'] ) ) { echo '
    '; foreach ( $this->field['options'] as $k => $v ) { echo '
  • '; echo ''; echo '
  • '; } //foreach echo '
'; } } //function } //class }fields/divide/field_divide.scss000066600000002406152141561100012564 0ustar00.redux-main { .divide { height: 20px; line-height: 20px; float: none; border-color: #E7E7E7; display: block; width: 100%; height: 35px !important; line-height: 35px !important; position: relative; margin: 15px 0 10px 0; .inner { width: 42% !important; left: 40% !important; margin-left: -6%; background-color: #FCFCFC; border-color: #E7E7E7; position: absolute; height: 1px; top: 50%; width: 100%; margin-top: -1px; border-top-width: 1px; border-top-style: solid; span { background-color: #FCFCFC; border-color: #E7E7E7; height: 5px; width: 5px; border-width: 2px; border-style: solid; display: block; position: absolute; left: 50%; margin-left: -5px; margin-top: -5px; } } } } .wp-customizer .redux-container-divide { .divide .inner { width: 82% !important; left: 18% !important; margin-left: -8%; } } fields/divide/field_divide.php000066600000005414152141561100012402 0ustar00. * * @package ReduxFramework * @subpackage Field_Divide * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( !defined ( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( !class_exists ( 'ReduxFramework_divide' ) ) { /** * Main ReduxFramework_divide class * * @since 1.0.0 */ class ReduxFramework_divide { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct ( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render () { echo '
extension_url . 'options_object/field_options_object' . Redux_Functions::isMin() . '.js', array( 'jquery' ), ReduxFramework_extension_options_object::$version, true ); wp_enqueue_style( 'redux-options-object', $this->extension_url . 'options_object/field_options_object.css', array(), time(), 'all' ); } /** * Output Function. * Used to enqueue to the front-end * * @since 1.0.0 * @access public * @return void */ public function output() { if ( $this->field['enqueue_frontend'] ) { } } } } extensions/options_object/options_object/field_options_object.scss000066600000000166152141561100022071 0ustar00#redux-object-browser { overflow: auto; word-wrap: break-word; max-height: 600px; max-width: 100%; } extensions/options_object/options_object/field_options_object.css000066600000000132152141561100021677 0ustar00#redux-object-browser{overflow:auto;word-wrap:break-word;max-height:600px;max-width:100%} extensions/options_object/options_object/field_options_object.js000066600000002341152141561100021527 0ustar00/*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.options_object = redux.field_objects.options_object || {}; // $( document ).ready( // function() { // redux.field_objects.import_export.init(); // } // ); redux.field_objects.options_object.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-options_object' ); } var parent = selector; if ( !selector.hasClass( 'redux-field-container' ) ) { parent = selector.parents( '.redux-field-container:first' ); } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } $( '#consolePrintObject' ).on( 'click', function( e ) { e.preventDefault(); console.log( $.parseJSON( $( "#redux-object-json" ).html() ) ); } ); if ( typeof jsonView === 'function' ) { jsonView( '#redux-object-json', '#redux-object-browser' ); } }; })( jQuery );extensions/README.txt000066600000000100152141561100010430 0ustar00This directory is a placeholder for Redux Framework extensions. extensions/customizer/extension_customizer.css.map000066600000002770152141561100016743 0ustar00{ "version": 3, "mappings": "AACI,8CAAgC;EAC5B,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,UAAU;EACtB,qDAAS;IACL,UAAU,EAAE,GAAG;;AAK3B,gDAAiD;EAC7C,MAAM,EAAE,CAAC;;AAIT,mCAAgB;EACZ,aAAa,EAAE,CAAC;AAEpB,6DAA0C;EACtC,UAAU,EAAE,OAAO;;AAI3B;;uCAEwC;EACpC,YAAY,EAAE,GAAG;;AAGrB,6BAA8B;EAC1B,UAAU,EAAE,OAAO;EACnB,WAAW,EAAE,OAAO;EACpB,WAAW,EAAE,OAAO;EACpB,eAAe,EAAE,OAAO;EACxB,kBAAkB,EAAE,OAAO;EAC3B,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,OAAO;;AAGvB,eAAgB;EACZ,OAAO,EAAE,gBAAgB;;AAIzB,kCAAuB;EACnB,OAAO,EAAE,MAAM;AAEnB,2BAAgB;EACZ,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,YAAY;AAEzB,8BAAmB;EACf,YAAY,EAAE,YAAY;EAC1B,aAAa,EAAE,cAAc;EAC7B,KAAK,EAAE,eAAe;AAE1B,0CAA+B;EAC3B,YAAY,EAAE,CAAC;AAEnB,+BAAoB;EAChB,SAAS,EAAE,cAAc;EACzB,YAAY,EAAE,EAAE;AAEpB,8BAAmB;EACf,aAAa,EAAE,cAAc;EAC7B,cAAc,EAAE,GAAG;AAEvB,yCAA8B;EAC1B,aAAa,EAAE,CAAC;EAChB,cAAc,EAAE,CAAC;AAErB,mBAAQ;EACJ,KAAK,EAAE,eAAe;AAE1B,cAAG;EACC,UAAU,EAAE,OAAO;AAEvB,gCAAqB;EACjB,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,UAAU;EACtB,OAAO,EAAE,YAAY;AAEzB,2CAAgC;EAC5B,KAAK,EAAE,IAAI;;AAInB,aAAc;EACV,OAAO,EAAE,MAAM;;AAGnB,cAAe;EACX,WAAW,EAAE,CAAC;EACd,MAAM,EAAE,CAAC;EACT,sBAAsB;EACtB,yBAAyB;;AAG7B,4BAA6B;EACzB,UAAU,EAAE,IAAI;;AAGpB,KAAM;EACF,QAAQ,EAAE,kBAAkB;EAC5B,KAAK,EAAE,YAAY;EACnB,GAAG,EAAE,YAAY;EACjB,MAAM,EAAE,YAAY;EACpB,IAAI,EAAE,YAAY;EAClB,UAAU,EAAE,MAAM;EAClB,aAAa,EAAE,CAAC;EAChB,WAAW,EAAE,CAAC;EACd,kBAAkB,EAAE,qBAAqB;EACzC,UAAU,EAAE,qBAAqB;EACjC,SAAI;IACA,kBAAkB,EAAE,qBAAqB;IACzC,UAAU,EAAE,qBAAqB", "sources": ["extension_customizer.scss"], "names": [], "file": "extension_customizer.css" }extensions/customizer/extension_customizer.min.js000066600000015454152141561100016600 0ustar00(function($){"use strict";$.fn.serializeJSON=function(options){var serializedObject,formAsArray,keys,type,value,_ref,f,opts;f=$.serializeJSON;opts=f.setupOpts(options);formAsArray=this.serializeArray();f.readCheckboxUncheckedValues(formAsArray,this,opts);serializedObject={};$.each(formAsArray,function(i,input){keys=f.splitInputNameIntoKeysArray(input.name,opts);type=keys.pop();if(type!=="skip"){value=f.parseValue(input.value,type,opts);if(opts.parseWithFunction&&type==="_")value=opts.parseWithFunction(value,input.name);f.deepSet(serializedObject,keys,value,opts)}});return serializedObject};$.serializeJSON={defaultOptions:{checkboxUncheckedValue:undefined,parseNumbers:false,parseBooleans:false,parseNulls:false,parseAll:false,parseWithFunction:null,customTypes:{},defaultTypes:{string:function(str){return String(str)},number:function(str){return Number(str)},"boolean":function(str){return["false","null","undefined","","0"].indexOf(str)===-1},"null":function(str){return["false","null","undefined","","0"].indexOf(str)!==-1?null:str},array:function(str){return JSON.parse(str)},object:function(str){return JSON.parse(str)},auto:function(str){return $.serializeJSON.parseValue(str,null,{parseNumbers:true,parseBooleans:true,parseNulls:true})}},useIntKeysAsArrayIndex:false},setupOpts:function(options){var opt,validOpts,defaultOptions,optWithDefault,parseAll,f;f=$.serializeJSON;if(options===null||options===undefined)options={};defaultOptions=f.defaultOptions||{};validOpts=["checkboxUncheckedValue","parseNumbers","parseBooleans","parseNulls","parseAll","parseWithFunction","customTypes","defaultTypes","useIntKeysAsArrayIndex"];for(opt in options){if(validOpts.indexOf(opt)===-1){throw new Error("serializeJSON ERROR: invalid option '"+opt+"'. Please use one of "+validOpts.join(", "))}}optWithDefault=function(key){return options[key]!==false&&options[key]!==""&&(options[key]||defaultOptions[key])};parseAll=optWithDefault("parseAll");return{checkboxUncheckedValue:optWithDefault("checkboxUncheckedValue"),parseNumbers:parseAll||optWithDefault("parseNumbers"),parseBooleans:parseAll||optWithDefault("parseBooleans"),parseNulls:parseAll||optWithDefault("parseNulls"),parseWithFunction:optWithDefault("parseWithFunction"),typeFunctions:$.extend({},optWithDefault("defaultTypes"),optWithDefault("customTypes")),useIntKeysAsArrayIndex:optWithDefault("useIntKeysAsArrayIndex")}},parseValue:function(str,type,opts){var typeFunction,f;f=$.serializeJSON;typeFunction=opts.typeFunctions&&opts.typeFunctions[type];if(typeFunction)return typeFunction(str);if(opts.parseNumbers&&f.isNumeric(str))return Number(str);if(opts.parseBooleans&&(str==="true"||str==="false"))return str==="true";if(opts.parseNulls&&str=="null")return null;return str},isObject:function(obj){return obj===Object(obj)},isUndefined:function(obj){return obj===void 0},isValidArrayIndex:function(val){return/^[0-9]+$/.test(String(val))},isNumeric:function(obj){return obj-parseFloat(obj)>=0},optionKeys:function(obj){if(Object.keys){return Object.keys(obj)}else{var keys=[];for(var key in obj){keys.push(key)}return keys}},splitInputNameIntoKeysArray:function(name,opts){var keys,nameWithoutType,type,_ref,f;f=$.serializeJSON;_ref=f.extractTypeFromInputName(name,opts),nameWithoutType=_ref[0],type=_ref[1];keys=nameWithoutType.split("[");keys=$.map(keys,function(key){return key.replace(/]/g,"")});if(keys[0]===""){keys.shift()}keys.push(type);return keys},extractTypeFromInputName:function(name,opts){var match,validTypes,f;if(match=name.match(/(.*):([^:]+)$/)){f=$.serializeJSON;validTypes=f.optionKeys(opts?opts.typeFunctions:f.defaultOptions.defaultTypes);validTypes.push("skip");if(validTypes.indexOf(match[2])!==-1){return[match[1],match[2]]}else{throw new Error("serializeJSON ERROR: Invalid type "+match[2]+" found in input name '"+name+"', please use one of "+validTypes.join(", "))}}else{return[name,"_"]}},deepSet:function(o,keys,value,opts){var key,nextKey,tail,lastIdx,lastVal,f;if(opts==null)opts={};f=$.serializeJSON;if(f.isUndefined(o)){throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined")}if(!keys||keys.length===0){throw new Error("ArgumentError: param 'keys' expected to be an array with least one element")}key=keys[0];if(keys.length===1){if(key===""){o.push(value)}else{o[key]=value}}else{nextKey=keys[1];if(key===""){lastIdx=o.length-1;lastVal=o[lastIdx];if(f.isObject(lastVal)&&(f.isUndefined(lastVal[nextKey])||keys.length>2)){key=lastIdx}else{key=lastIdx+1}}if(nextKey===""){if(f.isUndefined(o[key])||!$.isArray(o[key])){o[key]=[]}}else{if(opts.useIntKeysAsArrayIndex&&f.isValidArrayIndex(nextKey)){if(f.isUndefined(o[key])||!$.isArray(o[key])){o[key]=[]}}else{if(f.isUndefined(o[key])||!f.isObject(o[key])){o[key]={}}}}tail=keys.slice(1);f.deepSet(o[key],tail,value,opts)}},readCheckboxUncheckedValues:function(formAsArray,$form,opts){var selector,$uncheckedCheckboxes,$el,dataUncheckedValue,f;if(opts==null)opts={};f=$.serializeJSON;selector="input[type=checkbox][name]:not(:checked):not([disabled])";$uncheckedCheckboxes=$form.find(selector).add($form.filter(selector));$uncheckedCheckboxes.each(function(i,el){$el=$(el);dataUncheckedValue=$el.attr("data-unchecked-value");if(dataUncheckedValue){formAsArray.push({name:el.name,value:dataUncheckedValue})}else{if(!f.isUndefined(opts.checkboxUncheckedValue)){formAsArray.push({name:el.name,value:opts.checkboxUncheckedValue})}}})}}})(window.jQuery||window.$);(function($){"use strict";redux.customizer=redux.customizer||{};$(document).ready(function(){redux.customizer.init()});redux.customizer.init=function(){$("body").addClass(redux_customizer.body_class);$(".accordion-section.redux-section, .accordion-section.redux-panel, .accordion-section-title").click(function(){$.redux.initFields()});redux.args.disable_save_warn=true;var reduxChange=redux_change;redux_change=function(variable){variable=$(variable);reduxChange.apply(this,arguments);redux.customizer.save(variable)};var redux_initFields=$.redux.initFields;$.redux.initFiles=function(){redux_initFields()}};redux.customizer.save=function($obj){var $parent=$obj.hasClass("redux-field")?$obj:$obj.parents(".redux-field-container:first");redux.customizer.inputSave($parent)};redux.customizer.inputSave=function($parent){if(!$parent.hasClass("redux-field-container")){$parent=$parent.parents('[class^="redux-field-container"]')}var $id=$parent.parent().find(".redux-customizer-input").data("id");if(!$id){$parent=$parent.parents(".redux-container-repeater:first");var $id=$parent.parent().find(".redux-customizer-input").data("id")}var $nData=$parent.find(":input").serializeJSON();$.each($nData,function($k,$v){$nData=$v});var $key=$parent.parent().find(".redux-customizer-input").data("key");if($nData[$key]){$nData=$nData[$key]}var $control=wp.customize.control($id);if(JSON.stringify($control.setting._value)!==JSON.stringify($nData)){$control.setting._value=null}$control.setting.set($nData)}})(jQuery);extensions/customizer/extension_customizer.scss000066600000004540152141561100016347 0ustar00.redux-section { p.customize-section-description { margin-top: 22px; word-break: break-word; &.legacy { margin-top: 7px; } } } .control-section-themes .accordion-section-title { margin: 0; } #customize-controls { .customize-info { margin-bottom: 0; } .redux-section .accordion-section-content { background: #FCFCFC; } } .redux-section .accordion-section-title i, .redux-field .accordion-field-title i, .redux-panel .accordion-section-title i { margin-right: 5px; } .accordion-section.redux-main { background: inherit; margin-left: inherit; border-left: inherit; -moz-box-shadow: inherit; -webkit-box-shadow: inherit; padding: inherit; box-shadow: inherit; } .redux_field_th { padding: 13px 0px 0px 0px; } .redux-main { .redux-field-container { padding: 10px 0; } .select_wrapper { float: none; width: 100%; display: inline-block; } .select2-container { margin-right: 0 !important; margin-bottom: 5px !important; width: 100% !important; } .select_wrapper:nth-child(odd) { margin-right: 0; } .redux-option-image { max-width: 42% !important; margin-right: 3%; } .customize-control { border-bottom: 1px solid #ddd; padding-bottom: 4px; } .customize-control:last-child { border-bottom: 0; padding-bottom: 0; } .upload { width: 100% !important; } h3 { margin-top: inherit; } .redux-container-raw { margin-top: 22px; word-break: break-word; padding: 0 !important; } .redux-container-password input { width: 100%; } } .select2-drop { z-index: 999999; } .rAdsContainer { line-height: 0; border: 0; /*margin-top: -15px;*/ /*margin-bottom: -15px;*/ } .customize-control-redux-raw { list-style: none; } .rAds { position: inherit !important; right: 0 !important; top: 0 !important; bottom: 0 !important; left: 0 !important; text-align: center; margin-bottom: 0; line-height: 0; -webkit-transition: left ease-in-out .18s; transition: left ease-in-out .18s; img { -webkit-transition: left ease-in-out .18s; transition: left ease-in-out .18s; } }extensions/customizer/inc/customizer_section.php000066600000013703152141561100016365 0ustar00$key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; $this->controls = array(); // Users cannot customize the $controls array. // TODO Redux addition if ( isset( $args['section'] ) ) { $this->section = $args['section']; $this->description = isset( $this->section['desc'] ) ? $this->section['desc'] : ''; $this->opt_name = isset( $args['opt_name'] ) ? $args['opt_name'] : ''; } } /** * An Underscore (JS) template for rendering this section. * Class variables for this section class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Section::json()}. * * @see WP_Customize_Section::print_template() * @since 4.3.0 */ protected function render_template() { ?>
  • {{ data.title }}

    • {{{ data.customizeAction }}} {{ data.title }}

      <# if ( data.description ) { #>

      {{{ data.description }}}

      <# } #> opt_name ) && isset( $this->section ) ) { do_action( "redux/page/{$this->opt_name}/section/before", $this->section ); } ?>
  • type; ?>
  • title, array( 'em' => array(), 'i' => array(), 'strong' => array(), 'span' => array( 'class' => array(), 'style' => array(), ), ) ); ?>

      opt_name ) && isset( $this->section ) ) { do_action( "redux/page/{$this->opt_name}/section/before", $this->section ); } ?> description ) ) : ?>
    • description; ?>

  • render_fallback(); } } } extensions/customizer/inc/customizer_control.php000066600000004410152141561100016374 0ustar00redux_id = str_replace( 'customize-control-', '', 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ) ); $class = 'customize-control redux-group-tab redux-field customize-control-' . $this->type; $opt_name = explode( '[', $this->id ); $opt_name = $opt_name[0]; ?>
  • type != "repeater" ): ?> link() ) ?> value=""/> render_content(); ?>
  • redux_id, $this ); } public function label() { // The label has already been sanitized in the Fields class, no need to re-sanitize it. echo $this->label; } public function description() { if ( ! empty( $this->description ) ) { // The description has already been sanitized in the Fields class, no need to re-sanitize it. echo '' . $this->description . ''; } } public function title() { echo ''; $this->label(); $this->description(); echo ''; } } } extensions/customizer/inc/customizer_panel.php000066600000014534152141561100016023 0ustar00$key = $args[ $key ]; } } $this->manager = $manager; $this->id = $id; if ( empty( $this->active_callback ) ) { $this->active_callback = array( $this, 'active_callback' ); } self::$instance_count += 1; $this->instance_number = self::$instance_count; $this->sections = array(); // Users cannot customize the $sections array. // TODO Redux addition if ( isset( $args['section'] ) ) { $this->section = $args['section']; $this->description = isset( $this->section['desc'] ) ? $this->section['desc'] : ''; $this->opt_name = isset( $args['opt_name'] ) ? $args['opt_name'] : ''; } // TODO END Redux Addition } /** * WP < 4.3 Render * * @since * @access protected */ protected function render() { global $wp_version; $version = explode( '-', $wp_version ); if ( version_compare( $version[0], '4.3', '<' ) ) { $this->render_fallback(); } } protected function render_fallback() { $classes = 'accordion-section redux-main redux-panel control-section control-panel control-panel-' . esc_attr($this->type); ?>
  • title, array( 'em' => array(), 'i' => array(), 'strong' => array(), 'span' => array( 'class' => array(), 'style' => array(), ), ) ); ?>

      render_content(); ?>
  • ' . esc_html( $this->title ) . '' ); ?>
    description ) ) : ?>
    description; ?>
  • {{ data.title }}' ); ?> <# if ( data.description ) { #> <# } #>
    <# if ( data.description ) { #>
    {{{ data.description }}}
    <# } #>
  • //return; /** * Redux Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * any later version. * Redux Framework is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Redux Framework. If not, see . * * @package ReduxFramework * @author Dovy Paukstys (dovy) * @version 0.1.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_extension_customizer' ) ) { /** * Main ReduxFramework customizer extension class * * @since 1.0.0 */ class ReduxFramework_extension_customizer { // Protected vars protected $redux; private $_extension_url; private $_extension_dir; private $parent; private $orig_options = array(); private static $post_values = array(); public static $version = "2.0.0"; private $options = array(); /** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * * @param array $sections Panel sections. * @param array $args Class constructor arguments. * @param array $extra_tabs Extra panel tabs. * * @return void */ public function __construct( $parent ) { $this->parent = $parent; $this->upload_dir = ReduxFramework::$_upload_dir . 'advanced-customizer/'; //add_action('wp_head', array( $this, '_enqueue_new' )); if ( $parent->args['customizer'] == false ) { return; } // Override the ReduxCore class add_filter( "redux/extension/{$this->parent->args['opt_name']}/customizer", array( $this, 'remove_core_customizer_class' ) ); global $pagenow, $wp_customize; if ( ! isset( $wp_customize ) && $pagenow !== "customize.php" && $pagenow !== "admin-ajax.php" ) { return; } if ( ( $pagenow !== "customize.php" && $pagenow !== "admin-ajax.php" && ! isset( $GLOBALS['wp_customize'] ) ) ) { //return; } if ( empty( $this->_extension_dir ) ) { $this->_extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); $this->_extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->_extension_dir ) ); } self::get_post_values(); // Create defaults array $defaults = array(); /* customize_controls_init customize_controls_enqueue_scripts customize_controls_print_styles customize_controls_print_scripts customize_controls_print_footer_scripts */ //add_action('customize_save', ); if ( isset( $_POST['wp_customize'] ) && $_POST['wp_customize'] == "on" ) { $this->parent->args['customizer_only'] = true; } if ( isset( $_POST['wp_customize'] ) && $_POST['wp_customize'] == "on" && isset( $_POST['customized'] ) && ! empty( $_POST['customized'] ) && ! isset( $_POST['action'] ) ) { add_action( "redux/options/{$this->parent->args['opt_name']}/options", array( $this, '_override_values' ), 100 ); } add_action( 'customize_register', array( $this, '_register_customizer_controls' ) ); // Create controls add_action( 'wp_head', array( $this, 'customize_preview_init' ) ); //add_action( 'customize_save', array( $this, 'customizer_save_before' ) ); // Before save add_action( 'customize_save_after', array( &$this, 'customizer_save_after' ) ); // After save // Add global controls CSS file add_action( 'customize_controls_print_scripts', array( $this, 'enqueue_controls_css' ) ); add_action( 'customize_controls_init', array( $this, 'enqueue_panel_css' ) ); //add_action( 'wp_enqueue_scripts', array( &$this, '_enqueue_previewer_css' ) ); // Enqueue previewer css //add_action( 'wp_enqueue_scripts', array( &$this, '_enqueue_previewer_js' ) ); // Enqueue previewer javascript //add_action( "wp_footer", array( $this, '_enqueue_new' ), 100 ); //$this->_enqueue_new(); } function enqueue_controls_css() { require_once ReduxFramework::$_dir . 'core/enqueue.php'; $enqueue = new reduxCoreEnqueue ( $this->parent ); $enqueue->get_warnings_and_errors_array(); $enqueue->init(); wp_enqueue_style( 'redux-extension-advanced-customizer', $this->_extension_url . 'extension_customizer.css', '', time() ); wp_enqueue_script( 'redux-extension-customizer', $this->_extension_url . 'extension_customizer' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), ReduxFramework_extension_customizer::$version, true ); wp_localize_script( 'redux-extension-customizer', 'redux_customizer', array( 'body_class' => sanitize_html_class( 'admin-color-' . get_user_option( 'admin_color' ), 'fresh' ) ) ); } function enqueue_panel_css() { } function remove_core_customizer_class( $path ) { return ""; } function customize_preview_init() { do_action( 'redux/customizer/live_preview' ); } protected static function get_post_values() { if ( empty( self::$post_values ) && isset( $_POST['customized'] ) && ! empty( $_POST['customized'] ) ) { self::$post_values = json_decode( stripslashes_deep( $_POST['customized'] ), true ); } } public function _override_values( $data ) { self::get_post_values(); if ( isset( $_POST['customized'] ) && ! empty( self::$post_values ) ) { if ( is_array( self::$post_values ) ) { foreach ( self::$post_values as $key => $value ) { if ( strpos( $key, $this->parent->args['opt_name'] ) !== false ) { //if (is_array($value)) { // $value = @stripslashes( $value ); // if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) { // $value = @array_map( 'stripslashes_deep', $value ); // $value = @array_map( 'urldecode', $value ); // } //} else { // $value = @urldecode($value); //} $key = str_replace( $this->parent->args['opt_name'] . '[', '', rtrim( $key, "]" ) ); $data[ $key ] = $value; $GLOBALS[ $this->parent->args['global_variable'] ][ $key ] = $value; $this->parent->options[ $key ] = $value; } } } } return $data; } public function _enqueue_new() { //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; /* wp_enqueue_script('redux-extension-customizer-codemirror-js', $this->_extension_url . 'new/codemirror.min.js'); wp_enqueue_script('redux-extension-customizer-color-js', $this->_extension_url . 'new/colors-control.js'); wp_enqueue_script('redux-extension-customizer-controls-js', $this->_extension_url . 'new/customizer-control.js'); wp_enqueue_script('redux-extension-customizer-fonts-js', $this->_extension_url . 'new/fonts-customizer-admin.js'); wp_enqueue_script('redux-extension-customizer-header-js', $this->_extension_url . 'new/header-control.js'); wp_enqueue_script('redux-extension-customizer-models-js', $this->_extension_url . 'new/header-models.js'); wp_enqueue_script('redux-extension-customizer-slimscroll-js', $this->_extension_url . 'new/jquery.slimscroll.js'); wp_enqueue_script('redux-extension-customizer-droppable-js', $this->_extension_url . 'new/jquery.ui.droppable.min.js'); wp_enqueue_script('redux-extension-customizer-editor-js', $this->_extension_url . 'new/media-editor.min.js'); wp_enqueue_script('redux-extension-customizer-new-js', $this->_extension_url . 'new/new-customizer.js'); wp_enqueue_script('redux-extension-customizer-previewing-js', $this->_extension_url . 'new/previewing.js'); wp_enqueue_script('redux-extension-customizer-theme-js', $this->_extension_url . 'new/theme-customizer.js'); */ } public function render( $control ) { $fieldID = str_replace( $this->parent->args['opt_name'] . '-', '', $control->redux_id ); $field = $this->options[ $fieldID ]; if ( isset( $field['compiler'] ) && ! empty( $field['compiler'] ) ) { echo '
    ' . $this->parent->field_head[ $field['id'] ] . ''; //$field['data-customize-setting-link'] = array( // 'name' => $field['name'], // 'suffix' => isset($field['name_suffix']) ? $field['name_suffix'] : '' //); // $field['name'] = $field['id']; $this->parent->_field_input( $field ); echo '
    '; echo '
     
    '; echo '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-divide', ReduxFramework::$_url . 'inc/fields/divide/field_divide.css', array(), time(), 'all' ); } } } }fields/divide/field_divide.css.map000066600000001607152141561100013157 0ustar00{ "version": 3, "mappings": "AACI,mBAAQ;EACJ,MAAM,EAAE,IAAI;EACZ,WAAW,EAAE,IAAI;EACjB,KAAK,EAAE,IAAI;EACX,YAAY,EAAE,OAAO;EACrB,OAAO,EAAE,KAAK;EACd,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,eAAe;EACvB,WAAW,EAAE,eAAe;EAC5B,QAAQ,EAAE,QAAQ;EAClB,MAAM,EAAE,aAAa;EAErB,0BAAO;IACH,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,GAAG;IAChB,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,OAAO;IACrB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,GAAG;IACX,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,gBAAgB,EAAE,GAAG;IACrB,gBAAgB,EAAE,KAAK;IACvB,+BAAK;MACD,gBAAgB,EAAE,OAAO;MACzB,YAAY,EAAE,OAAO;MACrB,MAAM,EAAE,GAAG;MACX,KAAK,EAAE,GAAG;MACV,YAAY,EAAE,GAAG;MACjB,YAAY,EAAE,KAAK;MACnB,OAAO,EAAE,KAAK;MACd,QAAQ,EAAE,QAAQ;MAClB,IAAI,EAAE,GAAG;MACT,WAAW,EAAE,IAAI;MACjB,UAAU,EAAE,IAAI;;AAO5B,qDAAe;EACX,KAAK,EAAE,cAAc;EACrB,IAAI,EAAE,cAAc;EACpB,WAAW,EAAE,GAAG", "sources": ["field_divide.scss"], "names": [], "file": "field_divide.css" }fields/divide/field_divide.css000066600000001362152141561100012401 0ustar00.redux-main .divide{height:20px;line-height:20px;float:none;border-color:#e7e7e7;display:block;width:100%;height:35px !important;line-height:35px !important;position:relative;margin:15px 0 10px 0}.redux-main .divide .inner{width:42% !important;left:40% !important;margin-left:-6%;background-color:#fcfcfc;border-color:#e7e7e7;position:absolute;height:1px;top:50%;width:100%;margin-top:-1px;border-top-width:1px;border-top-style:solid}.redux-main .divide .inner span{background-color:#fcfcfc;border-color:#e7e7e7;height:5px;width:5px;border-width:2px;border-style:solid;display:block;position:absolute;left:50%;margin-left:-5px;margin-top:-5px}.wp-customizer .redux-container-divide .divide .inner{width:82% !important;left:18% !important;margin-left:-8%}fields/section/field_section.css.map000066600000000444152141561100013555 0ustar00{ "version": 3, "mappings": "AACI,wCAA6B;EACzB,KAAK,EAAE,GAAG;EACV,WAAW,EAAE,aAAa;AAG9B,iEAAsD;EAClD,OAAO,EAAE,cAAc;AAG3B,cAAG;EACC,UAAU,EAAE,IAAI;AAIhB,iEAAc;EACV,OAAO,EAAE,IAAI;AAGjB,uEAAoB;EAChB,aAAa,EAAE,CAAC", "sources": ["field_section.scss"], "names": [], "file": "field_section.css" }fields/section/field_section.php000066600000012652152141561100013004 0ustar00. * * @package ReduxFramework * @subpackage Field_Section * @author Tobias Karnetze (athoss.de) * @version 1.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_section' ) ) { /** * Main ReduxFramework_heading class * * @since 1.0.0 */ class ReduxFramework_section { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ public function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { // No errors please $defaults = array( 'indent' => '', 'style' => '', 'class' => '', 'title' => '', 'subtitle' => '', ); $this->field = wp_parse_args( $this->field, $defaults ); $guid = uniqid(); $add_class = ''; if ( isset( $this->field['indent'] ) && true === $this->field['indent'] ) { $add_class = ' form-table-section-indented'; } elseif( !isset( $this->field['indent'] ) || ( isset( $this->field['indent'] ) && false !== $this->field['indent'] ) ) { $add_class = " hide"; } echo '
    '; echo '
    '; if ( ! empty( $this->field['title'] ) ) { echo '

    ' . esc_html($this->field['title']) . '

    '; } if ( ! empty( $this->field['subtitle'] ) ) { echo '
    ' . esc_html($this->field['subtitle']) . '
    '; } echo '
    '; // delete the tr afterwards ?> parent->args['dev_mode'] ) { wp_enqueue_style( 'redux-field-section-css', ReduxFramework::$_url . 'inc/fields/section/field_section.css', array(), time(), 'all' ); } } } }fields/section/field_section.css000066600000000542152141561100013000 0ustar00.redux-main .form-table-section-indented{width:95%;margin-left:5% !important}.redux-main .form-table-section tr:first-of-type th:first-of-type{padding:0 !important}.redux-main h3{margin-top:10px}.redux-main .form-table-section-indented>tbody>tr:first-child{display:none}.redux-main .form-table-section-indented>tbody>tr:nth-last-child(2){border-bottom:0}fields/section/field_section.scss000066600000000672152141561100013167 0ustar00.redux-main { .form-table-section-indented { width: 95%; margin-left: 5% !important; } .form-table-section tr:first-of-type th:first-of-type { padding: 0px !important; } h3 { margin-top: 10px; } .form-table-section-indented > tbody > tr{ &:first-child { display: none; } &:nth-last-child(2) { border-bottom: 0; } } } fields/slider/field_slider.min.js000066600000006243152141561100013046 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.slider=redux.field_objects.slider||{},a(document).ready(function(){}),redux.field_objects.slider.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-slider:visible")),a(b).each(function(){var b=a(this),c=b;if(b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),!c.is(":hidden")&&c.hasClass("redux-field-init")){c.removeClass("redux-field-init"),b.find("div.redux-slider-container").each(function(){var c,d,e,f,g,h,i=0,j=1,k=2,l=3,m=a(this).data("id"),n=a(this).data("min"),o=a(this).data("max"),p=a(this).data("step"),q=a(this).data("handles"),r=a(this).data("default-one"),s=a(this).data("default-two"),t=a(this).data("resolution"),u=parseInt(a(this).data("display")),v=Boolean(a(this).data("rtl")),w=a(this).data("float-mark");Boolean(a(this).data("forced"));h=v===!0?"rtl":"ltr";var x,y,z=[n,o],A=[r,s],B=[r];u==k?(e=b.find(".redux-slider-input-one-"+m),f=b.find(".redux-slider-input-two-"+m),x=e,y=f):u==l?(e=b.find(".redux-slider-select-one-"+m),f=b.find(".redux-slider-select-two-"+m),redux.field_objects.slider.loadSelect(e,n,o,t,p),2===q&&redux.field_objects.slider.loadSelect(f,n,o,t,p)):u==j?(e=b.find("#redux-slider-label-one-"+m),f=b.find("#redux-slider-label-two-"+m)):u==i&&(e=b.find(".redux-slider-value-one-"+m),f=b.find(".redux-slider-value-two-"+m));var C,D;if(u==j){var E=[e,"html"],F=[f,"html"];C=[E],D=[E,F]}else C=[e],D=[e,f];2===q?(c=A,d=D,g=!0):(c=B,d=C,g="lower");var G=a(this).noUiSlider({range:z,start:c,handles:q,step:p,connect:g,behaviour:"tap-drag",direction:h,serialization:{resolution:t,to:d,mark:w},slide:function(){if(u==j)if(2===q){var c=G.val();b.find("input.redux-slider-value-one-"+m).attr("value",c[0]),b.find("input.redux-slider-value-two-"+m).attr("value",c[1])}else b.find("input.redux-slider-value-one-"+m).attr("value",G.val());u==l&&(2===q?(b.find(".redux-slider-select-one").select2("val",G.val()[0]),b.find(".redux-slider-select-two").select2("val",G.val()[1])):b.find(".redux-slider-select-one").select2("val",G.val())),redux_change(a(this).parents(".redux-field-container:first").find("input"))}});u===k&&(x.keydown(function(a){var b=G.val(),c=parseInt(b[0]);switch(a.which){case 38:G.val([c+1,null]);break;case 40:G.val([c-1,null]);break;case 13:a.preventDefault()}}),2===q&&y.keydown(function(a){var b=G.val(),c=parseInt(b[1]);switch(a.which){case 38:G.val([null,c+1]);break;case 40:G.val([null,c-1]);break;case 13:a.preventDefault()}}))});var d={width:"resolve",triggerChange:!0,allowClear:!0},e=b.find(".select2_params");if(e.size()>0){var f=e.val();f=JSON.parse(f),d=a.extend({},d,f)}b.find("select.redux-slider-select-one, select.redux-slider-select-two").select2(d)}})},redux.field_objects.slider.isFloat=function(a){return+a===a&&!isFinite(a)||Boolean(a%1)},redux.field_objects.slider.decimalCount=function(a){var b=a.toString().split(".");return b[1].length},redux.field_objects.slider.loadSelect=function(b,c,d,e,f){for(var g=c;d>=g;g+=e){var h=g;if(redux.field_objects.slider.isFloat(e)){var i=redux.field_objects.slider.decimalCount(e);h=g.toFixed(i)}a(b).append('")}}}(jQuery);fields/slider/field_slider.css000066600000002713152141561100012436 0ustar00.redux-container-slider .redux-slider-container{margin-left:25px;margin-right:25px;width:200px;display:inline-block;vertical-align:middle}.redux-container-slider .redux-slider-input,.redux-container-slider .redux-slider-select-one,.redux-container-slider .redux-slider-select-two{width:100px !important;text-align:center}.redux-container-slider .redux-slider-label{position:absolute;margin-left:-5px}.redux-container-slider .redux-slider-label-one{position:absolute;margin-left:-22px}.redux-container-slider .redux-slider-label-two{position:absolute;margin-top:-21px;margin-left:245px}@media screen and (max-width:782px){.redux-container-slider input{display:inline-block !important}}@media screen and (max-width:570px){.redux-container-slider{text-align:center}.redux-container-slider input,.redux-container-slider select,.redux-container-slider .redux-slider-label,.redux-container-slider .select2-container{display:block !important;position:inherit;margin:10px auto}.redux-container-slider .redux-slider-container{margin-top:3px;width:80%}}.wp-customizer .redux-container-slider .redux-slider-label{float:left;position:inherit;width:25%;text-align:center;margin-left:0}.wp-customizer .redux-container-slider .redux-slider-input,.wp-customizer .redux-container-slider .redux-slider-select-one,.wp-customizer .redux-container-slider .redux-slider-select-two{width:25% !important}.wp-customizer .redux-container-slider .redux-slider-container{width:70%;margin-right:0;margin-left:5%}fields/slider/field_slider.php000066600000035174152141561100012444 0ustar00. * * @package ReduxFramework * @subpackage Field_Slider * @author Kevin Provance (kprovance) * @version 2.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'ReduxFramework_slider' ) ) { class ReduxFramework_slider { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 3.1.8 */ private $display_none = 0; private $display_label = 1; private $display_text = 2; private $display_select = 3; function __construct( $field = array(), $value = '', $parent ) { //parent::__construct( $parent->sections, $parent->args ); $this->parent = $parent; $this->field = $field; $this->value = $value; // Set defaults $defaults = array( 'handles' => 1, 'resolution' => 1, 'display_value' => 'text', 'float_mark' => '.', 'forced' => true ); $this->field = wp_parse_args( $this->field, $defaults ); // Sanitize float mark switch ( $this->field['float_mark'] ) { case ',': case '.': break; default: $this->field['float_mark'] = '.'; break; } // Sanitize resolution value $this->field['resolution'] = $this->cleanVal( $this->field['resolution'] ); // Sanitize handle value switch ( $this->field['handles'] ) { case 0: case 1: $this->field['handles'] = 1; break; default: $this->field['handles'] = 2; break; } // Sanitize display value switch ( $this->field['display_value'] ) { case 'label': $this->field['display_value'] = $this->display_label; break; case 'text': default: $this->field['display_value'] = $this->display_text; break; case 'select': $this->field['display_value'] = $this->display_select; break; case 'none': $this->field['display_value'] = $this->display_none; break; } } private function cleanVal( $var ) { if ( is_float( $var ) ) { $cleanVar = floatval( $var ); } else { $cleanVar = intval( $var ); } return $cleanVar; } private function cleanDefault( $val ) { if ( empty( $val ) && ! empty( $this->field['default'] ) && $this->cleanVal( $this->field['min'] ) >= 1 ) { $val = $this->cleanVal( $this->field['default'] ); } if ( empty( $val ) && $this->cleanVal( $this->field['min'] ) >= 1 ) { $val = $this->cleanVal( $this->field['min'] ); } if ( empty( $val ) ) { $val = 0; } // Extra Validation if ( $val < $this->field['min'] ) { $val = $this->cleanVal( $this->field['min'] ); } else if ( $val > $this->field['max'] ) { $val = $this->cleanVal( $this->field['max'] ); } return $val; } private function cleanDefaultArray( $val ) { $one = $this->value[1]; $two = $this->value[2]; if ( empty( $one ) && ! empty( $this->field['default'][1] ) && $this->cleanVal( $this->field['min'] ) >= 1 ) { $one = $this->cleanVal( $this->field['default'][1] ); } if ( empty( $one ) && $this->cleanVal( $this->field['min'] ) >= 1 ) { $one = $this->cleanVal( $this->field['min'] ); } if ( empty( $one ) ) { $one = 0; } if ( empty( $two ) && ! empty( $this->field['default'][2] ) && $this->cleanVal( $this->field['min'] ) >= 1 ) { $two = $this->cleanVal( $this->field['default'][1] + 1 ); } if ( empty( $two ) && $this->cleanVal( $this->field['min'] ) >= 1 ) { $two = $this->cleanVal( $this->field['default'][1] + 1 ); } if ( empty( $two ) ) { $two = $this->field['default'][1] + 1; } $val[0] = $one; $val[1] = $two; return $val; } /** * Clean the field data to the fields defaults given the parameters. * * @since Redux_Framework 3.1.8 */ function clean() { // Set min to 0 if no value is set. $this->field['min'] = empty( $this->field['min'] ) ? 0 : $this->cleanVal( $this->field['min'] ); // Set max to min + 1 if empty. $this->field['max'] = empty( $this->field['max'] ) ? $this->field['min'] + 1 : $this->cleanVal( $this->field['max'] ); // Set step to 1 if step is empty ot step > max. $this->field['step'] = empty( $this->field['step'] ) || $this->field['step'] > $this->field['max'] ? 1 : $this->cleanVal( $this->field['step'] ); if ( 2 == $this->field['handles'] ) { if ( ! is_array( $this->value ) ) { $this->value[1] = 0; $this->value[2] = 1; } $this->value = $this->cleanDefaultArray( $this->value ); } else { if ( is_array( $this->value ) ) { $this->value = 0; } $this->value = $this->cleanDefault( $this->value ); } // More dummy checks //if ( ! is_array( $this->field['default'] ) && 2 == $this->field['handles'] ) { if ( ! is_array( $this->value ) && 2 == $this->field['handles'] ) { $this->value[0] = $this->field['min']; $this->value[1] = $this->field['min'] + 1; } //if ( is_array( $this->field['default'] ) && 1 == $this->field['handles'] ) { if ( is_array( $this->value ) && 1 == $this->field['handles'] ) { $this->value = $this->field['min']; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 3.1.8 */ function enqueue() { $min = Redux_Functions::isMin(); wp_enqueue_style( 'select2-css' ); wp_enqueue_style( 'redux-nouislider-css', ReduxFramework::$_url . 'inc/fields/slider/vendor/nouislider/redux.jquery.nouislider.css', array(), '5.0.0', 'all' ); wp_register_script( 'redux-nouislider-js', ReduxFramework::$_url . 'inc/fields/slider/vendor/nouislider/redux.jquery.nouislider' . $min . '.js', array( 'jquery' ), '5.0.0', true ); wp_enqueue_script( 'redux-field-slider-js', ReduxFramework::$_url . 'inc/fields/slider/field_slider' . $min . '.js', array( 'jquery', 'redux-nouislider-js', 'redux-js', 'select2-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-slider-css', ReduxFramework::$_url . 'inc/fields/slider/field_slider.css', array(), time(), 'all' ); } } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 0.0.4 */ function render() { $this->clean(); $fieldID = $this->field['id']; $fieldName = $this->field['name'] . $this->field['name_suffix']; //$fieldName = $this->parent->args['opt_name'] . '[' . $this->field['id'] . ']'; // Set handle number variable. $twoHandles = false; if ( 2 == $this->field['handles'] ) { $twoHandles = true; } // Set default values(s) if ( true == $twoHandles ) { $valOne = $this->value[0]; $valTwo = $this->value[1]; $html = 'data-default-one="' . $valOne . '" '; $html .= 'data-default-two="' . $valTwo . '" '; $nameOne = $fieldName . '[1]'; $nameTwo = $fieldName . '[2]'; $idOne = $fieldID . '[1]'; $idTwo = $fieldID . '[2]'; } else { $valOne = $this->value; $valTwo = ''; $html = 'data-default-one="' . $valOne . '"'; $nameOne = $fieldName; $nameTwo = ''; $idOne = $fieldID; $idTwo = ''; } $showInput = false; $showLabel = false; $showSelect = false; // TEXT output if ( $this->display_text == $this->field['display_value'] ) { $showInput = true; echo ''; // LABEL output } elseif ( $this->display_label == $this->field['display_value'] ) { $showLabel = true; $labelNum = $twoHandles ? '-one' : ''; echo '
    '; // SELECT output } elseif ( $this->display_select == $this->field['display_value'] ) { $showSelect = true; if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } echo ''; } // DIV output echo '
    '; // Double slider output if ( true == $twoHandles ) { // TEXT if ( true == $showInput ) { echo ''; } // LABEL if ( true == $showLabel ) { echo '
    '; } // SELECT if ( true == $showSelect ) { echo ''; } } // NO output (input hidden) if ( $this->display_none == $this->field['display_value'] || $this->display_label == $this->field['display_value'] ) { echo ''; // double slider hidden output if ( true == $twoHandles ) { echo ''; } } } } }fields/slider/field_slider.js000066600000027136152141561100012270 0ustar00/*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.slider = redux.field_objects.slider || {}; $( document ).ready( function() { } ); redux.field_objects.slider.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-slider:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( 'div.redux-slider-container' ).each( function() { var start, toClass, defClassOne, defClassTwo, connectVal; var DISPLAY_NONE = 0; var DISPLAY_LABEL = 1; var DISPLAY_TEXT = 2; var DISPLAY_SELECT = 3; var mainID = $( this ).data( 'id' ); var minVal = $( this ).data( 'min' ); var maxVal = $( this ).data( 'max' ); var stepVal = $( this ).data( 'step' ); var handles = $( this ).data( 'handles' ); var defValOne = $( this ).data( 'default-one' ); var defValTwo = $( this ).data( 'default-two' ); var resVal = $( this ).data( 'resolution' ); var displayValue = parseInt( ($( this ).data( 'display' )) ); var rtlVal = Boolean( $( this ).data( 'rtl' ) ); var floatMark = ($( this ).data( 'float-mark' )); var forced = Boolean($( this ).data( 'forced' )); var rtl; if ( rtlVal === true ) { rtl = 'rtl'; } else { rtl = 'ltr'; } // range array var range = [minVal, maxVal]; // Set default values for dual slides. var startTwo = [defValOne, defValTwo]; // Set default value for single slide var startOne = [defValOne]; var inputOne, inputTwo; if ( displayValue == DISPLAY_TEXT ) { defClassOne = el.find( '.redux-slider-input-one-' + mainID ); defClassTwo = el.find( '.redux-slider-input-two-' + mainID ); inputOne = defClassOne; inputTwo = defClassTwo; } else if ( displayValue == DISPLAY_SELECT ) { defClassOne = el.find( '.redux-slider-select-one-' + mainID ); defClassTwo = el.find( '.redux-slider-select-two-' + mainID ); redux.field_objects.slider.loadSelect( defClassOne, minVal, maxVal, resVal, stepVal ); if ( handles === 2 ) { redux.field_objects.slider.loadSelect( defClassTwo, minVal, maxVal, resVal, stepVal ); } } else if ( displayValue == DISPLAY_LABEL ) { defClassOne = el.find( '#redux-slider-label-one-' + mainID ); defClassTwo = el.find( '#redux-slider-label-two-' + mainID ); } else if ( displayValue == DISPLAY_NONE ) { defClassOne = el.find( '.redux-slider-value-one-' + mainID ); defClassTwo = el.find( '.redux-slider-value-two-' + mainID ); } var classOne, classTwo; if ( displayValue == DISPLAY_LABEL ) { var x = [defClassOne, 'html']; var y = [defClassTwo, 'html']; classOne = [x]; classTwo = [x, y]; } else { classOne = [defClassOne]; classTwo = [defClassOne, defClassTwo]; } if ( handles === 2 ) { start = startTwo; toClass = classTwo; connectVal = true; } else { start = startOne; toClass = classOne; connectVal = 'lower'; } var slider = $( this ).noUiSlider( { range: range, start: start, handles: handles, step: stepVal, connect: connectVal, behaviour: "tap-drag", direction: rtl, serialization: { resolution: resVal, to: toClass, mark: floatMark, }, slide: function() { if ( displayValue == DISPLAY_LABEL ) { if ( handles === 2 ) { var inpSliderVal = slider.val(); el.find( 'input.redux-slider-value-one-' + mainID ).attr( 'value', inpSliderVal[0] ); el.find( 'input.redux-slider-value-two-' + mainID ).attr( 'value', inpSliderVal[1] ); } else { el.find( 'input.redux-slider-value-one-' + mainID ).attr( 'value', slider.val() ); } } if ( displayValue == DISPLAY_SELECT ) { if ( handles === 2 ) { el.find( '.redux-slider-select-one' ).select2( 'val', slider.val()[0] ); el.find( '.redux-slider-select-two' ).select2( 'val', slider.val()[1] ); } else { el.find( '.redux-slider-select-one' ).select2( 'val', slider.val() ); } } redux_change( $( this ).parents( '.redux-field-container:first' ).find( 'input' ) ); } } ); if ( displayValue === DISPLAY_TEXT ) { inputOne.keydown( function( e ) { var sliderOne = slider.val(); var value = parseInt( sliderOne[0] ); switch ( e.which ) { case 38: slider.val( [value + 1, null] ); break; case 40: slider.val( [value - 1, null] ); break; case 13: e.preventDefault(); break; } } ); if ( handles === 2 ) { inputTwo.keydown( function( e ) { var sliderTwo = slider.val(); var value = parseInt( sliderTwo[1] ); switch ( e.which ) { case 38: slider.val( [null, value + 1] ); break; case 40: slider.val( [null, value - 1] ); break; case 13: e.preventDefault(); break; } } ); } } } ); var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; var select2_handle = el.find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } el.find( 'select.redux-slider-select-one, select.redux-slider-select-two' ).select2( default_params ); } ); }; // Return true for float value, false otherwise redux.field_objects.slider.isFloat = function( mixed_var ) { return +mixed_var === mixed_var && (!(isFinite( mixed_var ))) || Boolean( (mixed_var % 1) ); }; // Return number of integers after the decimal point. redux.field_objects.slider.decimalCount = function( res ) { var q = res.toString().split( '.' ); return q[1].length; }; redux.field_objects.slider.loadSelect = function( myClass, min, max, res, step ) { //var j = step + ((decCount ) - (step )); // 18; for ( var i = min; i <= max; i = i + res ) { //var step = 2; //if (j === (step + ((decCount ) - (step )))) { var n = i; if ( redux.field_objects.slider.isFloat( res ) ) { var decCount = redux.field_objects.slider.decimalCount( res ); n = i.toFixed( decCount ); } $( myClass ).append( '' ); //j = 0; //} //j++; } }; })( jQuery ); fields/slider/field_slider.scss000066600000003270152141561100012620 0ustar00.redux-container-slider { .redux-slider-container { margin-left: 25px; margin-right: 25px; width: 200px; display: inline-block; vertical-align: middle; } .redux-slider-input, .redux-slider-select-one, .redux-slider-select-two { width: 100px !important; text-align: center; } .redux-slider-label { position: absolute; margin-left: -5px; } .redux-slider-label-one { position: absolute; margin-left: -22px; } .redux-slider-label-two { position: absolute; margin-top: -21px; margin-left: 245px; } } @media screen and (max-width: 782px) { .redux-container-slider { input { display: inline-block !important; } } } // Select Slider @media screen and (max-width: 570px) { .redux-container-slider { text-align: center; input, select, .redux-slider-label, .select2-container { display: block !important; position: inherit; margin: 10px auto; } .redux-slider-container { margin-top: 3px; width: 80%; } } } .wp-customizer { .redux-container-slider { .redux-slider-label { float: left; position: inherit; width: 25%; text-align: center; margin-left:0; } .redux-slider-input, .redux-slider-select-one, .redux-slider-select-two { width: 25% !important; } .redux-slider-container { width: 70%; margin-right: 0; margin-left: 5%; } } } fields/slider/vendor/nouislider/redux.jquery.nouislider.min.js000066600000024145152141561100020715 0ustar00(function(f){if(f.zepto&&!f.fn.removeData)throw new ReferenceError("Zepto is loaded without the data module.");f.fn.noUiSlider=function(C,D){function s(a,b){return 100*b/(a[1]-a[0])}function E(a,b){return b*(a[1]-a[0])/100+a[0]}function t(a){return a instanceof f||f.zepto&&f.zepto.isZ(a)}function n(a){return!isNaN(parseFloat(a))&&isFinite(a)}function r(a,b){f.isArray(a)||(a=[a]);f.each(a,function(){"function"===typeof this&&this.call(b)})}function F(a,b){return function(){var c=[null,null];c[b]=f(this).val(); a.val(c,!0)}}function G(a,b){a=a.toFixed(b.decimals);0===parseFloat(a)&&(a=a.replace("-0","0"));return a.replace(".",b.serialization.mark)}function u(a){return parseFloat(a.toFixed(7))}function p(a,b,c,d){var e=d.target;a=a.replace(/\s/g,h+" ")+h;b.on(a,function(a){var b=e.attr("disabled");if(e.hasClass("noUi-state-tap")||void 0!==b&&null!==b)return!1;var g;a.preventDefault();var b=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),l=0===a.type.indexOf("pointer"),v,H=a;0===a.type.indexOf("MSPointer")&& (l=!0);a.originalEvent&&(a=a.originalEvent);b&&(g=a.changedTouches[0].pageX,v=a.changedTouches[0].pageY);if(h||l)l||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),g=a.clientX+window.pageXOffset,v=a.clientY+window.pageYOffset;g=f.extend(H,{pointX:g,pointY:v,cursor:h});c(g,d,e.data("base").data("options"))})}function I(a){var b=this.target;if(void 0===a)return this.element.data("value");!0===a?a=this.element.data("value"): this.element.data("value",a);void 0!==a&&f.each(this.elements,function(){if("function"===typeof this)this.call(b,a);else this[0][this[1]](a)})}function J(a,b,c){if(t(b)){var d=[],e=a.data("target");a.data("options").direction&&(c=c?0:1);b.each(function(){f(this).on("change"+h,F(e,c));d.push([f(this),"val"])});return d}"string"===typeof b&&(b=[f('').appendTo(a).addClass(g[3]).change(function(a){a.stopPropagation()}),"val"]);return[b]}function K(a,b,c){var d=[];f.each(c.to[b], function(e){d=d.concat(J(a,c.to[b][e],b))});return{element:a,elements:d,target:a.data("target"),val:I}}function L(a,b){var c=a.data("target");c.hasClass(g[14])||(b||(c.addClass(g[15]),setTimeout(function(){c.removeClass(g[15])},450)),c.addClass(g[14]),r(a.data("options").h,c))}function w(a,b){var c=a.data("options");b=u(b);a.data("target").removeClass(g[14]);a.css(c.style,b+"%").data("pct",b);a.is(":first-child")&&a.toggleClass(g[13],50k?100:k);if(b===a.data("pct"))return[e?e:!1,100===k?!1:k];w(a,b);return!0}function A(a,b,c,d){a.addClass(g[5]);setTimeout(function(){a.removeClass(g[5])},300);x(b,c);r(d,a.data("target"));a.data("target").change()}function M(a,b,c){var d= b.a,e=a[b.d]-b.start[b.d],e=100*e/b.size;if(1===d.length){if(a=x(d[0],b.c[0]+e),!0!==a){0<=f.inArray(d[0].data("pct"),a)&&L(b.b,!c.margin);return}}else{var k,m;c.step&&(a=c.step,e=Math.round(e/a)*a);a=k=b.c[0]+e;e=m=b.c[1]+e;0>a?(e+=-1*a,a=0):100k&&!a&&!d[0].data("pct")||100===e&&100").appendTo(b);if(b.data("base"))throw Error("Slider was already initialized.");b.data("base",k).addClass([g[6],g[16+a.direction],g[10+a.orientation]].join(" "));for(c=0;c
    ").appendTo(k),e.addClass(g[1]),e.children().addClass([g[2], g[2]+g[7+a.direction+(a.direction?-1*c:c)]].join(" ")),e.data({base:k,target:b,options:a,grab:e.children(),pct:-1}).attr("data-style",a.style),e.data({store:K(e,c,a.serialization)}),d.push(e);switch(a.connect){case 1:b.addClass(g[9]);d[0].addClass(g[12]);break;case 3:d[1].addClass(g[12]);case 2:d[0].addClass(g[9]);case 0:b.addClass(g[12])}k.addClass(g[0]).data({target:b,options:a,handles:d});b.val(a.start);if(!a.behaviour.fixed)for(c=0;ch[0]?d+Math.abs(h[0]):d-h[0]);g.direction&&(d=100-d);!0!==x(e[c],d)&&e[c].data("store").val(!0);!0===b&&r(g.set,f(this))}})}function U(a){var b=[[a,""]];f.each(a.data("base").data("handles"), function(){b=b.concat(f(this).data("store").elements)});f.each(b,function(){1') .appendTo(handle) .addClass(clsList[3]) .change(function ( e ) { e.stopPropagation(); }), 'val']; } return [item]; } // Access point and abstraction for serialization. function store ( handle, i, serialization ) { var elements = []; // Loops all items in the provided serialization setting, // add the proper events to them or create new input fields, // and add them as data to the handle so they can be kept // in sync with the slider value. $.each( serialization['to'][i], function( index ){ elements = elements.concat( storeElement( handle, serialization['to'][i][index], i ) ); }); return { element: handle ,elements: elements ,target: handle.data('target') ,'val': serialize }; } // Handle placement // Fire callback on unsuccessful handle movement. function block ( base, stateless ) { var target = base.data('target'); if ( !target.hasClass(clsList[14]) ){ // The visual effects should not always be applied. if ( !stateless ) { target.addClass(clsList[15]); setTimeout(function(){ target.removeClass(clsList[15]); }, 450); } target.addClass(clsList[14]); call( base.data('options').block, target ); } } // Change inline style and apply proper classes. function placeHandle ( handle, to ) { var settings = handle.data('options'); to = digits(to, 7); // If the slider can move, remove the class // indicating the block state. handle.data('target').removeClass(clsList[14]); // Set handle to new location handle.css( settings['style'], to + '%' ).data('pct', to); // Force proper handle stacking if ( handle.is(':first-child') ) { handle.toggleClass(clsList[13], to > 50 ); } if ( settings['direction'] ) { to = 100 - to; } // Write the value to the serialization object. handle.data('store').val( format ( isPercentage( settings['range'], to ), settings ) ); } // Test suggested values and apply margin, step. function setHandle ( handle, to ) { var base = handle.data('base'), settings = base.data('options'), handles = base.data('handles'), lower = 0, upper = 100; // Catch invalid user input if ( !isNumeric( to ) ){ return false; } // Handle the step option. if ( settings['step'] ){ to = closest( to, settings['step'] ); } if ( handles.length > 1 ){ if ( handle[0] !== handles[0][0] ) { lower = digits(handles[0].data('pct')+settings['margin'],7); } else { upper = digits(handles[1].data('pct')-settings['margin'],7); } } // Limit position to boundaries. When the handles aren't set yet, // they return -1 as a percentage value. to = Math.min( Math.max( to, lower ), upper < 0 ? 100 : upper ); // Stop handling this call if the handle can't move past another. // Return an array containing the hit limit, so the caller can // provide feedback. ( block callback ). if ( to === handle.data('pct') ) { return [!lower ? false : lower, upper === 100 ? false : upper]; } placeHandle ( handle, to ); return true; } // Handles movement by tapping function jump ( base, handle, to, callbacks ) { // Flag the slider as it is now in a transitional state. // Transition takes 300 ms, so re-enable the slider afterwards. base.addClass(clsList[5]); setTimeout(function(){ base.removeClass(clsList[5]); }, 300); // Move the handle to the new position. setHandle( handle, to ); // Trigger the 'slide' and 'set' callbacks, // pass the target so that it is 'this'. call( callbacks, base.data('target') ); base.data('target').change(); } // Event handlers // Handle movement on document for handle and range drag. function move ( event, Dt, Op ) { // Map event movement to a slider percentage. var handles = Dt.handles, limits, proposal = event[ Dt.point ] - Dt.start[ Dt.point ]; proposal = ( proposal * 100 ) / Dt.size; if ( handles.length === 1 ) { // Run handle placement, receive true for success or an // array with potential limits. limits = setHandle( handles[0], Dt.positions[0] + proposal ); if ( limits !== true ) { if ( $.inArray ( handles[0].data('pct'), limits ) >= 0 ){ block ( Dt.base, !Op['margin'] ); } return; } } else { // Dragging the range could be implemented by forcing the // 'move' event on both handles, but this solution proved // lagging on slower devices, resulting in range errors. The // slightly ugly solution below is considerably faster, and // it can't move the handle out of sync. Bypass the standard // setting method, as other checks are needed. var l1, u1, l2, u2; // Round the proposal to the step setting. if ( Op['step'] ) { proposal = closest( proposal, Op['step'] ); } // Determine the new position, store it twice. Once for // limiting, once for checking whether placement should occur. l1 = l2 = Dt.positions[0] + proposal; u1 = u2 = Dt.positions[1] + proposal; // Round the values within a sensible range. if ( l1 < 0 ) { u1 += -1 * l1; l1 = 0; } else if ( u1 > 100 ) { l1 -= ( u1 - 100 ); u1 = 100; } // Don't perform placement if no handles are to be changed. // Check if the lowest value is set to zero. if ( l2 < 0 && !l1 && !handles[0].data('pct') ) { return; } // The highest value is limited to 100%. if ( u1 === 100 && u2 > 100 && handles[1].data('pct') === 100 ){ return; } placeHandle ( handles[0], l1 ); placeHandle ( handles[1], u1 ); } // Trigger the 'slide' event, if the handle was moved. call( Op['slide'], Dt.target ); } // Unbind move events on document, call callbacks. function end ( event, Dt, Op ) { // The handle is no longer active, so remove the class. if ( Dt.handles.length === 1 ) { Dt.handles[0].data('grab').removeClass(clsList[4]); } // Remove cursor styles and text-selection events bound to the body. if ( event.cursor ) { body.css('cursor', '').off( namespace ); } // Unbind the move and end events, which are added on 'start'. doc.off( namespace ); // Trigger the change event. Dt.target.removeClass( clsList[14] +' '+ clsList[20]).change(); // Trigger the 'end' callback. call( Op['set'], Dt.target ); } // Bind move events on document. function start ( event, Dt, Op ) { // Mark the handle as 'active' so it can be styled. if( Dt.handles.length === 1 ) { Dt.handles[0].data('grab').addClass(clsList[4]); } // A drag should never propagate up to the 'tap' event. event.stopPropagation(); // Attach the move event. attach ( actions.move, doc, move, { start: event ,base: Dt.base ,target: Dt.target ,handles: Dt.handles ,positions: [ Dt.handles[0].data('pct') ,Dt.handles[ Dt.handles.length - 1 ].data('pct') ] ,point: Op['orientation'] ? 'pointY' : 'pointX' ,size: Op['orientation'] ? Dt.base.height() : Dt.base.width() }); // Unbind all movement when the drag ends. attach ( actions.end, doc, end, { target: Dt.target ,handles: Dt.handles }); // Text selection isn't an issue on touch devices, // so adding additional callbacks isn't required. if ( event.cursor ) { // Prevent the 'I' cursor and extend the range-drag cursor. body.css('cursor', $(event.target).css('cursor')); // Mark the target with a dragging state. if ( Dt.handles.length > 1 ) { Dt.target.addClass(clsList[20]); } // Prevent text selection when dragging the handles. body.on('selectstart' + namespace, function( ){ return false; }); } } // Move closest handle to tapped location. function tap ( event, Dt, Op ) { var base = Dt.base, handle, to, point, size; // The tap event shouldn't propagate up to trigger 'edge'. event.stopPropagation(); // Determine the direction of the slider. if ( Op['orientation'] ) { point = event['pointY']; size = base.height(); } else { point = event['pointX']; size = base.width(); } // Find the closest handle and calculate the tapped point. handle = closestHandle( base.data('handles'), point, Op['style'] ); to = (( point - base.offset()[ Op['style'] ] ) * 100 ) / size; // The set handle to the new position. jump( base, handle, to, [ Op['slide'], Op['set'] ]); } // Move handle to edges when target gets tapped. function edge ( event, Dt, Op ) { var handles = Dt.base.data('handles'), to, i; i = Op['orientation'] ? event['pointY'] : event['pointX']; i = i < Dt.base.offset()[Op['style']]; to = i ? 0 : 100; i = i ? 0 : handles.length - 1; jump ( Dt.base, handles[i], to, [ Op['slide'], Op['set'] ]); } // API // Validate and standardize input. function test ( input, sliders ){ /* Every input option is tested and parsed. This'll prevent endless validation in internal methods. These tests are structured with an item for every option available. An option can be marked as required by setting the 'r' flag. The testing function is provided with three arguments: - The provided value for the option; - A reference to the options object; - The name for the option; The testing function returns false when an error is detected, or true when everything is OK. It can also modify the option object, to make sure all values can be correctly looped elsewhere. */ function values ( a ) { if ( a.length !== 2 ){ return false; } // Convert the array to floats a = [ parseFloat(a[0]), parseFloat(a[1]) ]; // Test if all values are numerical if( !isNumeric(a[0]) || !isNumeric(a[1]) ){ return false; } // The lowest value must really be the lowest value. if( a[1] < a[0] ){ return false; } return a; } var serialization = { resolution: function(q,o){ // Parse the syntactic sugar that is the serialization // resolution option to a usable integer. // Checking for a string '1', since the resolution needs // to be cast to a string to split in on the period. switch( q ){ case 1: case 0.1: case 0.01: case 0.001: case 0.0001: case 0.00001: q = q.toString().split('.'); o['decimals'] = q[0] === '1' ? 0 : q[1].length; break; case undefined: o['decimals'] = 2; break; default: return false; } return true; } ,mark: function(q,o,w){ if ( !q ) { o[w]['mark'] = '.'; return true; } switch( q ){ case '.': case ',': return true; default: return false; } } ,to: function(q,o,w){ // Checks whether a variable is a candidate to be a // valid serialization target. function ser(r){ return isInstance ( r ) || typeof r === 'string' || typeof r === 'function' || r === false || ( isInstance ( r[0] ) && typeof r[0][r[1]] === 'function' ); } // Flatten the serialization array into a reliable // set of elements, which can be tested and looped. function filter ( value ) { var items = [[],[]]; // If a single value is provided it can be pushed // immediately. if ( ser(value) ) { items[0].push(value); } else { // Otherwise, determine whether this is an // array of single elements or sets. $.each(value, function(i, val) { // Don't handle an overflow of elements. if( i > 1 ){ return; } // Decide if this is a group or not if( ser(val) ){ items[i].push(val); } else { items[i] = items[i].concat(val); } }); } return items; } if ( !q ) { o[w]['to'] = [[],[]]; } else { var i, j; // Flatten the serialization array q = filter ( q ); // Reverse the API for RTL sliders. if ( o['direction'] && q[1].length ) { q.reverse(); } // Test all elements in the flattened array. for ( i = 0; i < o['handles']; i++ ) { for ( j = 0; j < q[i].length; j++ ) { // Return false on invalid input if( !ser(q[i][j]) ){ return false; } // Remove 'false' elements, since those // won't be handled anyway. if( !q[i][j] ){ q[i].splice(j, 1); } } } // Write the new values back o[w]['to'] = q; } return true; } }, tests = { /* Handles. * Has default, can be 1 or 2. */ 'handles': { 'r': true ,'t': function(q){ q = parseInt(q, 10); return ( q === 1 || q === 2 ); } } /* Range. * Must be an array of two numerical floats, * which can't be identical. */ ,'range': { 'r': true ,'t': function(q,o,w){ o[w] = values(q); // The values can't be identical. return o[w] && o[w][0] !== o[w][1]; } } /* Start. * Must be an array of two numerical floats when handles = 2; * Uses 'range' test. * When handles = 1, a single float is also allowed. */ ,'start': { 'r': true ,'t': function(q,o,w){ if( o['handles'] === 1 ){ if( $.isArray(q) ){ q = q[0]; } q = parseFloat(q); o.start = [q]; return isNumeric(q); } o[w] = values(q); return !!o[w]; } } /* Connect. * Must be true or false when handles = 2; * Can use 'lower' and 'upper' when handles = 1. */ ,'connect': { 'r': true ,'t': function(q,o,w){ if ( q === 'lower' ) { o[w] = 1; } else if ( q === 'upper' ) { o[w] = 2; } else if ( q === true ) { o[w] = 3; } else if ( q === false ) { o[w] = 0; } else { return false; } return true; } } /* Connect. * Will default to horizontal, not required. */ ,'orientation': { 't': function(q,o,w){ switch (q){ case 'horizontal': o[w] = 0; break; case 'vertical': o[w] = 1; break; default: return false; } return true; } } /* Margin. * Must be a float, has a default value. */ ,'margin': { 'r': true ,'t': function(q,o,w){ q = parseFloat(q); o[w] = fromPercentage(o['range'], q); return isNumeric(q); } } /* Direction. * Required, can be 'ltr' or 'rtl'. */ ,'direction': { 'r': true ,'t': function(q,o,w){ switch ( q ) { case 'ltr': o[w] = 0; break; case 'rtl': o[w] = 1; // Invert connection for RTL sliders; o['connect'] = [0,2,1,3][o['connect']]; break; default: return false; } return true; } } /* Behaviour. * Required, defines responses to tapping and * dragging elements. */ ,'behaviour': { 'r': true ,'t': function(q,o,w){ o[w] = { 'tap': q !== (q = q.replace('tap', '')) ,'extend': q !== (q = q.replace('extend', '')) ,'drag': q !== (q = q.replace('drag', '')) ,'fixed': q !== (q = q.replace('fixed', '')) }; return !q.replace('none','').replace(/\-/g,''); } } /* Serialization. * Required, but has default. Must be an array * when using two handles, can be a single value when using * one handle. 'mark' can be period (.) or comma (,). */ ,'serialization': { 'r': true ,'t': function(q,o,w){ return serialization.to( q['to'], o, w ) && serialization.resolution( q['resolution'], o ) && serialization.mark( q['mark'], o, w ); } } /* Slide. * Not required. Must be a function. */ ,'slide': { 't': function(q){ return $.isFunction(q); } } /* Set. * Not required. Must be a function. * Tested using the 'slide' test. */ ,'set': { 't': function(q){ return $.isFunction(q); } } /* Block. * Not required. Must be a function. * Tested using the 'slide' test. */ ,'block': { 't': function(q){ return $.isFunction(q); } } /* Step. * Not required. */ ,'step': { 't': function(q,o,w){ q = parseFloat(q); o[w] = fromPercentage ( o['range'], q ); return isNumeric(q); } } }; $.each( tests, function( name, test ){ /*jslint devel: true */ var value = input[name], isSet = value !== undefined; // If the value is required but not set, fail. if( ( test['r'] && !isSet ) || // If the test returns false, fail. ( isSet && !test['t']( value, input, name ) ) ){ // For debugging purposes it might be very useful to know // what option caused the trouble. Since throwing an error // will prevent further script execution, log the error // first. Test for console, as it might not be available. if( console && console.log && console.group ){ console.group( 'Invalid noUiSlider initialisation:' ); console.log( 'Option:\t', name ); console.log( 'Value:\t', value ); console.log( 'Slider(s):\t', sliders ); console.groupEnd(); } throw new RangeError('noUiSlider'); } }); } // Parse options, add classes, attach events, create HTML. function create ( options ) { /*jshint validthis: true */ // Store the original set of options on all targets, // so they can be re-used and re-tested later. // Make sure to break the relation with the options, // which will be changed by the 'test' function. this.data('options', $.extend(true, {}, options)); // Set defaults where applicable; options = $.extend({ 'handles': 2 ,'margin': 0 ,'connect': false ,'direction': 'ltr' ,'behaviour': 'tap' ,'orientation': 'horizontal' }, options); // Make sure the test for serialization runs. options['serialization'] = options['serialization'] || {}; // Run all options through a testing mechanism to ensure correct // input. The test function will throw errors, so there is // no need to capture the result of this call. It should be noted // that options might get modified to be handled properly. E.g. // wrapping integers in arrays. test( options, this ); // Pre-define the styles. options['style'] = options['orientation'] ? 'top' : 'left'; return this.each(function(){ var target = $(this), i, dragable, handles = [], handle, base = $('
    ').appendTo(target); // Throw an error if the slider was already initialized. if ( target.data('base') ) { throw new Error('Slider was already initialized.'); } // Apply classes and data to the target. target.data('base', base).addClass([ clsList[6] ,clsList[16 + options['direction']] ,clsList[10 + options['orientation']] ].join(' ')); for (i = 0; i < options['handles']; i++ ) { handle = $('
    ').appendTo(base); // Add all default and option-specific classes to the // origins and handles. handle.addClass( clsList[1] ); handle.children().addClass([ clsList[2] ,clsList[2] + clsList[ 7 + options['direction'] + ( options['direction'] ? -1 * i : i ) ]].join(' ') ); // Make sure every handle has access to all variables. handle.data({ 'base': base ,'target': target ,'options': options ,'grab': handle.children() ,'pct': -1 }).attr('data-style', options['style']); // Every handle has a storage point, which takes care // of triggering the proper serialization callbacks. handle.data({ 'store': store(handle, i, options['serialization']) }); // Store handles on the base handles.push(handle); } // Apply the required connection classes to the elements // that need them. Some classes are made up for several // segments listed in the class list, to allow easy // renaming and provide a minor compression benefit. switch ( options['connect'] ) { case 1: target.addClass( clsList[9] ); handles[0].addClass( clsList[12] ); break; case 3: handles[1].addClass( clsList[12] ); /* falls through */ case 2: handles[0].addClass( clsList[9] ); /* falls through */ case 0: target.addClass(clsList[12]); break; } // Merge base classes with default, // and store relevant data on the base element. base.addClass( clsList[0] ).data({ 'target': target ,'options': options ,'handles': handles }); // Use the public value method to set the start values. target.val( options['start'] ); // Attach the standard drag event to the handles. if ( !options['behaviour']['fixed'] ) { for ( i = 0; i < handles.length; i++ ) { // These events are only bound to the visual handle // element, not the 'real' origin element. attach ( actions.start, handles[i].children(), start, { base: base ,target: target ,handles: [ handles[i] ] }); } } // Attach the tap event to the slider base. if ( options['behaviour']['tap'] ) { attach ( actions.start, base, tap, { base: base ,target: target }); } // Extend tapping behaviour to target if ( options['behaviour']['extend'] ) { target.addClass( clsList[19] ); if ( options['behaviour']['tap'] ) { attach ( actions.start, target, edge, { base: base ,target: target }); } } // Make the range dragable. if ( options['behaviour']['drag'] ){ dragable = base.find('.'+clsList[9]).addClass(clsList[18]); // When the range is fixed, the entire range can // be dragged by the handles. The handle in the first // origin will propagate the start event upward, // but it needs to be bound manually on the other. if ( options['behaviour']['fixed'] ) { dragable = dragable .add( base.children().not(dragable).data('grab') ); } attach ( actions.start, dragable, start, { base: base ,target: target ,handles: handles }); } }); } // Return value for the slider, relative to 'range'. function getValue ( ) { /*jshint validthis: true */ var base = $(this).data('base'), answer = []; // Loop the handles, and get the value from the input // for every handle on its' own. $.each( base.data('handles'), function(){ answer.push( $(this).data('store').val() ); }); // If the slider has just one handle, return a single value. // Otherwise, return an array, which is in reverse order // if the slider is used RTL. if ( answer.length === 1 ) { return answer[0]; } if ( base.data('options').direction ) { return answer.reverse(); } return answer; } // Set value for the slider, relative to 'range'. function setValue ( args, set ) { /*jshint validthis: true */ // If the value is to be set to a number, which is valid // when using a one-handle slider, wrap it in an array. if( !$.isArray(args) ){ args = [args]; } // Setting is handled properly for each slider in the data set. return this.each(function(){ var b = $(this).data('base'), to, i, handles = Array.prototype.slice.call(b.data('handles'),0), settings = b.data('options'); // If there are multiple handles to be set run the setting // mechanism twice for the first handle, to make sure it // can be bounced of the second one properly. if ( handles.length > 1) { handles[2] = handles[0]; } // The RTL settings is implemented by reversing the front-end, // internal mechanisms are the same. if ( settings['direction'] ) { args.reverse(); } for ( i = 0; i < handles.length; i++ ){ // Calculate a new position for the handle. to = args[ i%2 ]; // The set request might want to ignore this handle. // Test for 'undefined' too, as a two-handle slider // can still be set with an integer. if( to === null || to === undefined ) { continue; } // Add support for the comma (,) as a decimal symbol. // Replace it by a period so it is handled properly by // parseFloat. Omitting this would result in a removal // of decimals. This way, the developer can also // input a comma separated string. if( $.type(to) === 'string' ) { to = to.replace(',', '.'); } // Calculate the new handle position to = toPercentage( settings['range'], parseFloat( to ) ); // Invert the value if this is an right-to-left slider. if ( settings['direction'] ) { to = 100 - to; } // If the value of the input doesn't match the slider, // reset it. Sometimes the input is changed to a value the // slider has rejected. This can occur when using 'select' // or 'input[type="number"]' elements. In this case, set // the value back to the input. if ( setHandle( handles[i], to ) !== true ){ handles[i].data('store').val( true ); } // Optionally trigger the 'set' event. if( set === true ) { call( settings['set'], $(this) ); } } }); } // Unbind all attached events, remove classed and HTML. function destroy ( target ) { // Start the list of elements to be unbound with the target. var elements = [[target,'']]; // Get the fields bound to both handles. $.each(target.data('base').data('handles'), function(){ elements = elements.concat( $(this).data('store').elements ); }); // Remove all events added by noUiSlider. $.each(elements, function(){ if( this.length > 1 ){ this[0].off( namespace ); } }); // Remove all classes from the target. target.removeClass(clsList.join(' ')); // Empty the target and remove all data. target.empty().removeData('base options'); } // Merge options with current initialization, destroy slider // and reinitialize. function build ( options ) { /*jshint validthis: true */ return this.each(function(){ // When uninitialised, jQuery will return '', // Zepto returns undefined. Both are falsy. var values = $(this).val() || false, current = $(this).data('options'), // Extend the current setup with the new options. setup = $.extend( {}, current, options ); // If there was a slider initialised, remove it first. if ( values !== false ) { destroy( $(this) ); } // Make the destroy method publicly accessible. if( !options ) { return; } // Create a new slider $(this)['noUiSlider']( setup ); // Set the slider values back. If the start options changed, // it gets precedence. if ( values !== false && setup.start === current.start ) { $(this).val( values ); } }); } // Overwrite the native jQuery value function // with a simple handler. noUiSlider will use the internal // value method, anything else will use the standard method. $.fn.val = function(){ // If the function is called without arguments, // act as a 'getter'. Call the getValue function // in the same scope as this call. if ( this.hasClass( clsList[6] ) ){ return arguments.length ? setValue.apply( this, arguments ) : getValue.apply( this ); } // If this isn't noUiSlider, continue with jQuery's // original method. return $VAL.apply( this, arguments ); }; return ( rebuild ? build : create ).call( this, options ); }; }( window['jQuery'] || window['Zepto'] )); fields/slider/vendor/nouislider/redux.jquery.nouislider.css000066600000006035152141561100020305 0ustar00 /* Functional styling; * These styles are required for noUiSlider to function. * You don't need to change these rules to apply your design. */ .noUi-target, .noUi-target * { -webkit-touch-callout: none; -webkit-user-select: none; -ms-touch-action: none; -ms-user-select: none; -moz-user-select: none; -moz-box-sizing: border-box; box-sizing: border-box; } .noUi-base { width: 100%; height: 100%; position: relative; } .noUi-origin { position: absolute; right: 0; top: 0; left: 0; bottom: 0; } .noUi-handle { position: relative; z-index: 1; } .noUi-stacking .noUi-handle { /* This class is applied to the lower origin when its values is > 50%. */ z-index: 10; } .noUi-stacking + .noUi-origin { /* Fix stacking order in IE7, which incorrectly creates a new context for the origins. */ *z-index: -1; } .noUi-state-tap .noUi-origin { -webkit-transition: left 0.3s, top 0.3s; transition: left 0.3s, top 0.3s; } .noUi-state-drag * { cursor: inherit !important; } /* Slider size and handle placement; */ .noUi-horizontal { height: 18px; } .noUi-horizontal .noUi-handle { width: 34px; height: 28px; left: -17px; top: -6px; } .noUi-horizontal.noUi-extended { padding: 0 15px; } .noUi-horizontal.noUi-extended .noUi-origin { right: -15px; } .noUi-vertical { width: 18px; } .noUi-vertical .noUi-handle { width: 28px; height: 34px; left: -6px; top: -17px; } .noUi-vertical.noUi-extended { padding: 15px 0; } .noUi-vertical.noUi-extended .noUi-origin { bottom: -15px; } /* Styling; */ .noUi-background { background: #FAFAFA; box-shadow: inset 0 1px 1px #f0f0f0; } .noUi-connect { background: #3FB8AF; box-shadow: inset 0 0 3px rgba(51,51,51,0.45); -webkit-transition: background 450ms; transition: background 450ms; } .noUi-origin { border-radius: 2px; } .noUi-target { border-radius: 4px; border: 1px solid #D3D3D3; box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; } .noUi-target.noUi-connect { box-shadow: inset 0 0 3px rgba(51,51,51,0.45), 0 3px 6px -5px #BBB; } /* Handles and cursors; */ .noUi-dragable { cursor: w-resize; } .noUi-vertical .noUi-dragable { cursor: n-resize; } .noUi-handle { border: 1px solid #D9D9D9; border-radius: 3px; background: #FFF; cursor: default; box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB; } .noUi-active { box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB; } /* Handle stripes; */ .noUi-handle:before, .noUi-handle:after { content: ""; display: block; position: absolute; height: 14px; width: 1px; background: #E8E7E6; left: 14px; top: 6px; } .noUi-handle:after { left: 17px; } .noUi-vertical .noUi-handle:before, .noUi-vertical .noUi-handle:after { width: 14px; height: 1px; left: 6px; top: 14px; } .noUi-vertical .noUi-handle:after { top: 17px; } /* Disabled state; */ [disabled].noUi-connect, [disabled] .noUi-connect { background: #B8B8B8; } [disabled] .noUi-handle { cursor: not-allowed; } /* Blocked state; */ .noUi-state-blocked.noUi-connect, .noUi-state-blocked .noUi-connect { background: #4FDACF; } fields/slider/field_slider.css.map000066600000001625152141561100013213 0ustar00{ "version": 3, "mappings": "AACI,+CAAwB;EACpB,WAAW,EAAE,IAAI;EACjB,YAAY,EAAE,IAAI;EAClB,KAAK,EAAE,KAAK;EACZ,OAAO,EAAE,YAAY;EACrB,cAAc,EAAE,MAAM;AAG1B;;gDAEyB;EACrB,KAAK,EAAE,gBAAgB;EACvB,UAAU,EAAE,MAAM;AAGtB,2CAAoB;EAChB,QAAQ,EAAE,QAAQ;EAClB,WAAW,EAAE,IAAI;AAGrB,+CAAwB;EACpB,QAAQ,EAAE,QAAQ;EAClB,WAAW,EAAE,KAAK;AAGtB,+CAAwB;EACpB,QAAQ,EAAE,QAAQ;EAClB,UAAU,EAAE,KAAK;EACjB,WAAW,EAAE,KAAK;;AAI1B,oCAAqC;EAE7B,6BAAM;IACF,OAAO,EAAE,uBAAuB;AAM5C,oCAAqC;EACjC,uBAAwB;IACpB,UAAU,EAAE,MAAM;IAElB;;;8CAGmB;MACf,OAAO,EAAE,gBAAgB;MACzB,QAAQ,EAAE,OAAO;MACjB,MAAM,EAAE,SAAS;IAGrB,+CAAwB;MACpB,UAAU,EAAE,GAAG;MACf,KAAK,EAAE,GAAG;AAOd,0DAAoB;EAChB,KAAK,EAAE,IAAI;EACX,QAAQ,EAAE,OAAO;EACjB,KAAK,EAAE,GAAG;EACV,UAAU,EAAE,MAAM;EAClB,WAAW,EAAC,CAAC;AAEjB,4LAAwE;EACpE,KAAK,EAAE,cAAc;AAEzB,8DAAwB;EACpB,KAAK,EAAE,GAAG;EACV,YAAY,EAAE,CAAC;EACf,WAAW,EAAE,EAAE", "sources": ["field_slider.scss"], "names": [], "file": "field_slider.css" }fields/typography/field_typography.css.map000066600000006771152141561100015072 0ustar00{ "version": 3, "mappings": "AACI,uCAA4B;EACxB,OAAO,EAAE,KAAK;EACd,QAAQ,EAAE,QAAQ;EAClB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;EACV,KAAK,EAAE,IAAI;EACX,SAAS,EAAE,KAAK;EAEhB,iDAAU;IACN,KAAK,EAAE,IAAI;IAEX,uDAAQ;MACJ,UAAU,EAAE,MAAM;MAClB,OAAO,EAAE,KAAK;MACd,SAAS,EAAE,CAAC;MACZ,OAAO,EAAE,GAAG;MACZ,KAAK,EAAE,IAAI;MACX,MAAM,EAAE,CAAC;EAIjB;iEACwB;IACpB,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,mBAAmB;IAC5B,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,eAAe;EAG9B,uDAAgB;IACZ,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE,gBAAgB;IAC3B,SAAS,EAAE,gBAAgB;IAC3B,MAAM,EAAE,IAAI;IACZ,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,UAAU;IAEtB,sEAAiB;MACb,YAAY,EAAE,eAAe;IAGjC,uEAAkB;MACd,YAAY,EAAE,eAAe;IAI7B,4FAAmB;MACf,KAAK,EAAE,IAAI;IAInB,yEAAkB;MACd,SAAS,EAAE,eAAe;MAC1B,OAAO,EAAE,KAAK;MACd,KAAK,EAAE,IAAI;MACX,MAAM,EAAE,eAAe;MACvB,WAAW,EAAE,eAAe;MAC5B,OAAO,EAAE,cAAc;MACvB,KAAK,EAAE,eAAe;MACtB,kBAAkB,EAAE,UAAU;MAC9B,eAAe,EAAE,UAAU;MAC3B,aAAa,EAAE,UAAU;MACzB,UAAU,EAAE,UAAU;EAI9B,4DAAqB;IACjB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,GAAG;IACZ,qBAAqB,EAAE,GAAG;IAC1B,kBAAkB,EAAE,GAAG;IACvB,aAAa,EAAE,GAAG;EAGtB,sDAAe;IACX,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,UAAU;IACtB,cAAc,EAAE,QAAQ;IAExB,gEAAY;MACR,WAAW,EAAE,GAAG;IAGpB,iEAAW;MACP,kBAAkB,EAAE,UAAU;MAC9B,eAAe,EAAE,UAAU;MAC3B,aAAa,EAAE,UAAU;MACzB,UAAU,EAAE,UAAU;MACtB,KAAK,EAAE,GAAG;MACV,UAAU,EAAE,MAAM;MAClB,MAAM,EAAE,CAAC;MACT,MAAM,EAAE,IAAI;MACZ,GAAG,EAAE,GAAG;MACR,OAAO,EAAE,WAAW;MACpB,eAAe,EAAE,IAAI;MACrB,qBAAqB,EAAE,GAAG;MAC1B,kBAAkB,EAAE,GAAG;MACvB,aAAa,EAAE,GAAG;EAI1B,uDAAgB;IACZ,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,UAAU;IACtB,cAAc,EAAE,QAAQ;EAG5B,6CAAM;IACF,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,sBAAsB;IAC9B,MAAM,EAAE,OAAO;EAGnB,2DAAoB;IAChB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,oBAAoB;IAC5B,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,UAAU;IAClB,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,UAAU;IAC3B,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,MAAM;EAGpB,yDAAkB;IACd,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,CAAC;EAGb,mEAA4B;IACxB,WAAW,EAAE,IAAI;AAIzB,oCAAqC;EAE7B,mDAA4B;IACxB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,MAAM;IAEd,mEAAgB;MACZ,SAAS,EAAE,KAAK;MAChB,SAAS,EAAE,KAAK;MAChB,KAAK,EAAE,KAAK;MACZ,WAAW,EAAE,YAAY;MACzB,YAAY,EAAE,YAAY;IAG9B,kEAAe;MACX,SAAS,EAAE,KAAK;MAChB,SAAS,EAAE,KAAK;MAChB,KAAK,EAAE,KAAK;MACZ,WAAW,EAAE,YAAY;MACzB,YAAY,EAAE,cAAc;MAC5B,6EAAW;QACP,KAAK,EAAE,GAAG;IAIlB,yEAAsB;MAClB,KAAK,EAAE,GAAG;MACV,OAAO,EAAE,cAAc;EAK/B,8EAAuD;IACnD,UAAU,EAAE,GAAG;;AAM/B,oCAAqC;EAE7B,iEAAsD;IAClD,YAAY,EAAE,EAAE;AAOpB,yDAAe;EACX,KAAK,EAAE,GAAG;EACV,SAAS,EAAE,GAAG;EACd,SAAS,EAAE,GAAG;EACd,oEAAW;IACP,KAAK,EAAE,GAAG;AAGlB,0DAAgB;EACZ,KAAK,EAAE,eAAe", "sources": ["field_typography.scss"], "names": [], "file": "field_typography.css" }fields/typography/field_typography.scss000066600000014731152141561100014474 0ustar00.redux-main { .redux-typography-container { display: block; position: relative; margin: 0; padding: 0; width: 100%; max-width: 660px; .clearfix { clear: both; &:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } } input.wp-picker-default, .redux-typography-color { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; height: 24px; padding: 0px 14px !important; margin-top: 0; margin-bottom: 0; margin-left: 4px !important; font-size: 12px !important; } .select_wrapper { display: block; position: relative; float: left; clear: none; margin: 0 10px 0 0; width: 48% !important; min-width: 210px !important; max-width: 324px !important; height: 57px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; &:nth-child(odd) { margin-right: 10px !important; } &:nth-child(even) { margin-right: 10px !important; } &.typography-family { .select2-container { width: 100% } } .redux-typography { font-size: 14px !important; display: block; float: left; height: 28px !important; line-height: 50px !important; padding: 0px !important; width: 100% !important; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; } } .wp-picker-container { float: left; clear: left; margin-bottom: 12px; padding: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .input_wrapper { display: block; position: relative; margin: 0 4px 0 5px; padding: 0; width: 23%; max-width: 23%; min-width: 70px; float: left; clear: none; height: 57px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; vertical-align: baseline; &.font-size { margin-left: 0px; } input.mini { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; width: 78%; text-align: center; margin: 0; height: 28px; top: 3px; padding: 0 2px 0 5px; text-decoration: none; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } } .picker-wrapper { display: block; display: block; position: relative; margin: 0 4px 0 5px; margin: 0; padding: 0; width: 23%; width: 100%; max-width: 23%; min-width: 70px; min-width: 100%; clear: none; height: 57px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; vertical-align: baseline; } label { display: block; position: relative; font-size: 12px !important; text-align: left; color: #999999; margin: 4px 0 2px 0 !important; cursor: default; } .typography-preview { display: none; width: 100%; border: 1px dotted lightgray; max-width: 850px; padding: 10px; font-size: 10pt; height: auto; margin: 5px 0 10px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; overflow: hidden; } .typography-color { border: 0 none; margin: 0; } ::-webkit-input-placeholder { line-height: 19px; } } @media screen and (max-width: 540px) { .redux-main { .redux-typography-container { max-width: 230px; margin: 0 auto; .select_wrapper { max-width: 210px; min-width: 210px; width: 210px; margin-left: 0 !important; margin-right: 0 !important; } .input_wrapper { max-width: 101px; min-width: 101px; width: 101px; margin-left: 0 !important; margin-right: 5px !important; input.mini { width: 73%; } } .input-append .add-on { width: 30%; padding: 5px !important; } } .redux-main .wp-picker-container .wp-picker-input-wrap { margin-top: 7px; } } } } @media screen and (max-width: 360px) { .redux-main { .redux-typography-container .iris-picker .iris-square { margin-right: 3%; } } } .wp-customizer { .redux-typography-container { .input_wrapper { width: 40%; max-width: 40%; min-width: 20%; input.mini { width: 70%; } } .select_wrapper { width: 100% !important; } } } fields/typography/field_typography_json.js000066600000070264152141561100015171 0ustar00/*global redux_change, redux*/ /** * Typography * Dependencies: google.com, jquery, select2 * Feature added by: Dovy Paukstys - http://simplerain.com/ * Date: 06.14.2013 * * Rewrite: Kevin Provance (kprovance) * Date: May 25, 2014 */ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.typography = redux.field_objects.typography || {}; var selVals = []; var isSelecting = false; var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; $( document ).ready( function() { //redux.field_objects.typography.init(); } ); redux.field_objects.typography.init = function( selector, skipCheck ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-typography:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } var fontClear; el.each( function() { // init each typography field $( this ).find( '.redux-typography-container' ).each( function() { var family = $( this ).find( '.redux-typography-family' ); if ( family.data( 'value' ) === undefined ) { family = $( this ); } else if ( family.data( 'value' ) !== "" ) { $( family ).val( family.data( 'value' ) ); } var select2_handle = $( this ).find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } fontClear = Boolean( $( this ).find( '.redux-font-clear' ).val() ); redux.field_objects.typography.select( family, true ); window.onbeforeunload = null; } ); //init when value is changed $( this ).find( '.redux-typography' ).on( 'change', function() { redux.field_objects.typography.select( $( this ) ); //.parents('.redux-container-typography:first')); } ); //init when value is changed $( this ).find( '.redux-typography-size, .redux-typography-height, .redux-typography-word, .redux-typography-letter, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration' ).keyup( function() { redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } ); // Have to redeclare the wpColorPicker to get a callback function $( this ).find( '.redux-typography-color' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } } ); // Don't allow negative numbers for size field $( this ).find( ".redux-typography-size" ).numeric( { allowMinus: false } ); // Allow negative numbers for indicated fields $( this ).find( ".redux-typography-height, .redux-typography-word, .redux-typography-letter" ).numeric( { allowMinus: true } ); // select2 magic, to load font-family dynamically var data = [{id: 'none', text: 'none'}]; $( this ).find( ".redux-typography-family" ).select2( { matcher: function( term, text ) { return text.toUpperCase().indexOf( term.toUpperCase() ) === 0; }, query: function( query ) { return window.Select2.query.local( data )( query ); }, initSelection: function( element, callback ) { var data = {id: element.val(), text: element.val()}; callback( data ); }, allowClear: fontClear, // when one clicks on the font-family select box } ).on( "select2-opening", function( e ) { // Get field ID var thisID = $( this ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); // User included fonts? var isUserFonts = $( '#' + thisID + ' .redux-typography-font-family' ).data( 'user-fonts' ); isUserFonts = isUserFonts ? 1 : 0; // Google font isn use? var usingGoogleFonts = $( '#' + thisID + ' .redux-typography-google' ).val(); usingGoogleFonts = usingGoogleFonts ? 1 : 0; // Set up data array var buildData = []; // If custom fonts, push onto array if ( redux.customfonts !== undefined ) { buildData.push( redux.customfonts ); } // If standard fonts, push onto array if ( redux.stdfonts !== undefined && isUserFonts === 0 ) { buildData.push( redux.stdfonts ); } // If user fonts, pull from localize and push into array if ( isUserFonts == 1 ) { var fontKids = []; // var fontData = { text: 'Standard Fonts', children: fontKids }; buildData.push( fontData ); } // If googfonts on and had data, push into array if ( usingGoogleFonts == 1 || usingGoogleFonts === true && redux.googlefonts !== undefined ) { buildData.push( redux.googlefonts ); } // output data to drop down data = buildData; // get placeholder var selFamily = $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'placeholder' ); if ( !selFamily ) { selFamily = null; } // select current font $( '#' + thisID + " .redux-typography-family" ).select2( 'val', selFamily ); // When selection is made. } ).on( 'select2-selecting', function( val, object ) { var fontName = val.object.text; var thisID = $( this ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); $( '#' + thisID + ' #' + thisID + '-family' ).data( 'value', fontName ); $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'placeholder', fontName ); // option values selVals = val; isSelecting = true; redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } ).on( 'select2-clearing', function( val, choice ) { var thisID = $( this ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'data-value', '' ); $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'placeholder', 'Font Family' ); $( '#' + thisID + ' #' + thisID + '-google-font' ).val( 'false' ); redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } ); var xx = el.find( ".redux-typography-family" ); if ( !xx.hasClass( 'redux-typography-family' ) ) { el.find( ".redux-typography-style" ).select2( default_params ); } // Init select2 for indicated fields el.find( ".redux-typography-family-backup, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration" ).select2( default_params ); } ); } ); }; // Return font size redux.field_objects.typography.size = function( obj ) { var size = 0, key; for ( key in obj ) { if ( obj.hasOwnProperty( key ) ) { size++; } } return size; }; // Return proper bool value redux.field_objects.typography.makeBool = function( val ) { if ( val == 'false' || val == '0' || val === false || val === 0 ) { return false; } else if ( val == 'true' || val == '1' || val === true || val == 1 ) { return true; } }; redux.field_objects.typography.change = function( container ) { var $data = {}; jQuery( container ).find( '.redux-typography-input' ).each( function() { if ( jQuery( this ).data( 'name' ) === undefined ) { return; } $data[jQuery( this ).data( 'name' )] = jQuery( this ).val(); } ); var $input = jQuery( container ).find( '.typography-data-input:first-child' ); $input.val( JSON.stringify( $data ) ); }; redux.field_objects.typography.contrastColour = function( hexcolour ) { // default value is black. var retVal = '#444444'; // In case - for some reason - a blank value is passed. // This should *not* happen. If a function passing a value // is canceled, it should pass the current value instead of // a blank. This is how the Windows Common Controls do it. :P if ( hexcolour !== '' ) { // Replace the hash with a blank. hexcolour = hexcolour.replace( '#', '' ); var r = parseInt( hexcolour.substr( 0, 2 ), 16 ); var g = parseInt( hexcolour.substr( 2, 2 ), 16 ); var b = parseInt( hexcolour.substr( 4, 2 ), 16 ); var res = ((r * 299) + (g * 587) + (b * 114)) / 1000; // Instead of pure black, I opted to use WP 3.8 black, so it looks uniform. :) - kp retVal = (res >= 128) ? '#444444' : '#ffffff'; } return retVal; }; // Sync up font options redux.field_objects.typography.select = function( selector, skipCheck ) { var mainID; // Main id for selected field mainID = $( selector ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); if ( mainID === undefined ) { mainID = $( selector ).attr( 'data-id' ); } var parent = $( selector ).parents( '.redux-container-typography:first' ); var data = []; //$.each(parent.find('.redux-typography-field'), function() { // console.log(); //}); //console.log( selector ); // Set all the variables to be checked against var family = $( '#' + mainID + ' #' + mainID + '-family' ).val(); if ( !family ) { family = null; //"inherit"; } var familyBackup = $( '#' + mainID + ' select.redux-typography-family-backup' ).val(); var size = $( '#' + mainID + ' .redux-typography-size' ).val(); var height = $( '#' + mainID + ' .redux-typography-height' ).val(); var word = $( '#' + mainID + ' .redux-typography-word' ).val(); var letter = $( '#' + mainID + ' .redux-typography-letter' ).val(); var align = $( '#' + mainID + ' select.redux-typography-align' ).val(); var transform = $( '#' + mainID + ' select.redux-typography-transform' ).val(); var fontVariant = $( '#' + mainID + ' select.redux-typography-font-variant' ).val(); var decoration = $( '#' + mainID + ' select.redux-typography-decoration' ).val(); var style = $( '#' + mainID + ' select.redux-typography-style' ).val(); var script = $( '#' + mainID + ' select.redux-typography-subsets' ).val(); var color = $( '#' + mainID + ' .redux-typography-color' ).val(); var units = $( '#' + mainID ).data( 'units' ); //console.log('here3'); //console.log(color); //var output = family; // Is selected font a google font? var google; if ( isSelecting === true ) { google = redux.field_objects.typography.makeBool( selVals.object['data-google'] ); $( '#' + mainID + ' .redux-typography-google-font' ).val( google ); } else { google = redux.field_objects.typography.makeBool( $( '#' + mainID + ' .redux-typography-google-font' ).val() ); // Check if font is a google font } // Page load. Speeds things up memory wise to offload to client if ( !$( '#' + mainID ).hasClass( 'typography-initialized' ) ) { style = $( '#' + mainID + ' select.redux-typography-style' ).data( 'value' ); script = $( '#' + mainID + ' select.redux-typography-subsets' ).data( 'value' ); if ( style !== "" ) { style = String( style ); } if ( typeof (script) !== undefined ) { script = String( script ); } } // Something went wrong trying to read google fonts, so turn google off if ( redux.fonts.google === undefined ) { google = false; } // Get font details var details = ''; if ( google === true && ( family in redux.fonts.google) ) { details = redux.fonts.google[family]; } else { details = { '400': 'Normal 400', '700': 'Bold 700', '400italic': 'Normal 400 Italic', '700italic': 'Bold 700 Italic' }; } if ( $( selector ).hasClass( 'redux-typography-subsets' ) ) { $( '#' + mainID + ' input.typography-subsets' ).val( script ); } // If we changed the font if ( $( selector ).hasClass( 'redux-typography-family' ) ) { var html = ''; // Google specific stuff if ( google === true ) { // STYLES var selected = ""; $.each( details.variants, function( index, variant ) { if ( variant.id === style || redux.field_objects.typography.size( details.variants ) === 1 ) { selected = ' selected="selected"'; style = variant.id; } else { selected = ""; } html += ''; } ); // destroy select2 $( '#' + mainID + ' .redux-typography-style' ).select2( "destroy" ); // Instert new HTML $( '#' + mainID + ' .redux-typography-style' ).html( html ); // Init select2 $( '#' + mainID + ' .redux-typography-style' ).select2( default_params ); // SUBSETS selected = ""; html = ''; $.each( details.subsets, function( index, subset ) { if ( subset.id === script || redux.field_objects.typography.size( details.subsets ) === 1 ) { selected = ' selected="selected"'; script = subset.id; $( '#' + mainID + ' input.typography-subsets' ).val( script ); } else { selected = ""; } html += ''; } ); //if (typeof (familyBackup) !== "undefined" && familyBackup !== "") { // output += ', ' + familyBackup; //} // Destroy select2 $( '#' + mainID + ' .redux-typography-subsets' ).select2( "destroy" ); // Inset new HTML $( '#' + mainID + ' .redux-typography-subsets' ).html( html ); // Init select2 $( '#' + mainID + ' .redux-typography-subsets' ).select2( default_params ); $( '#' + mainID + ' .redux-typography-subsets' ).parent().fadeIn( 'fast' ); $( '#' + mainID + ' .typography-family-backup' ).fadeIn( 'fast' ); } else { if ( details ) { $.each( details, function( index, value ) { if ( index === style || index === "normal" ) { selected = ' selected="selected"'; $( '#' + mainID + ' .typography-style .select2-chosen' ).text( value ); } else { selected = ""; } html += ''; } ); // Destory select2 $( '#' + mainID + ' .redux-typography-style' ).select2( "destroy" ); // Insert new HTML $( '#' + mainID + ' .redux-typography-style' ).html( html ); // Init select2 $( '#' + mainID + ' .redux-typography-style' ).select2( default_params ); // Prettify things $( '#' + mainID + ' .redux-typography-subsets' ).parent().fadeOut( 'fast' ); $( '#' + mainID + ' .typography-family-backup' ).fadeOut( 'fast' ); } } $( '#' + mainID + ' .redux-typography-font-family' ).val( family ); } else if ( $( selector ).hasClass( 'redux-typography-family-backup' ) && familyBackup !== "" ) { $( '#' + mainID + ' .redux-typography-font-family-backup' ).val( familyBackup ); } // Check if the selected value exists. If not, empty it. Else, apply it. if ( $( '#' + mainID + " select.redux-typography-style option[value='" + style + "']" ).length === 0 ) { style = ""; $( '#' + mainID + ' select.redux-typography-style' ).select2( 'val', '' ); } else if ( style === "400" ) { $( '#' + mainID + ' select.redux-typography-style' ).select2( 'val', style ); } // Handle empty subset select if ( $( '#' + mainID + " select.redux-typography-subsets option[value='" + script + "']" ).length === 0 ) { script = ""; $( '#' + mainID + ' select.redux-typography-subsets' ).select2( 'val', '' ); $( '#' + mainID + ' input.typography-subsets' ).val( script ); } var _linkclass = 'style_link_' + mainID; //remove other elements crested in $( '.' + _linkclass ).remove(); if ( family !== null && family !== "inherit" && $( '#' + mainID ).hasClass( 'typography-initialized' ) ) { //replace spaces with "+" sign var the_font = family.replace( /\s+/g, '+' ); if ( google === true ) { //add reference to google font family var link = the_font; if ( style && style !== "" ) { link += ':' + style.replace( /\-/g, " " ); } if ( script && script !== "" ) { link += '&subset=' + script; } if ( isSelecting === false ) { if ( typeof (WebFont) !== "undefined" && WebFont ) { WebFont.load( {google: {families: [link]}} ); } } $( '#' + mainID + ' .redux-typography-google' ).val( true ); } else { $( '#' + mainID + ' .redux-typography-google' ).val( false ); } } // Weight and italic if ( style.indexOf( "italic" ) !== -1 ) { $( '#' + mainID + ' .typography-preview' ).css( 'font-style', 'italic' ); $( '#' + mainID + ' .typography-font-style' ).val( 'italic' ); style = style.replace( 'italic', '' ); } else { $( '#' + mainID + ' .typography-preview' ).css( 'font-style', "normal" ); $( '#' + mainID + ' .typography-font-style' ).val( '' ); } $( '#' + mainID + ' .typography-font-weight' ).val( style ); if ( !height ) { height = size; } if ( size === '' || size === undefined ) { $( '#' + mainID + ' .typography-font-size' ).val( '' ); } else { $( '#' + mainID + ' .typography-font-size' ).val( size + units ); } if ( height === '' || height === undefined ) { $( '#' + mainID + ' .typography-line-height' ).val( '' ); } else { $( '#' + mainID + ' .typography-line-height' ).val( height + units ); } if ( word === '' || word === undefined ) { $( '#' + mainID + ' .typography-word-spacing' ).val( '' ); } else { $( '#' + mainID + ' .typography-word-spacing' ).val( word + units ); } if ( letter === '' || letter === undefined ) { $( '#' + mainID + ' .typography-letter-spacing' ).val( '' ); } else { $( '#' + mainID + ' .typography-letter-spacing' ).val( letter + units ); } // Show more preview stuff if ( $( '#' + mainID ).hasClass( 'typography-initialized' ) ) { //console.log('here2'); var isPreviewSize = $( '#' + mainID + ' .typography-preview' ).data( 'preview-size' ); if ( isPreviewSize == '0' ) { $( '#' + mainID + ' .typography-preview' ).css( 'font-size', size + units ); } $( '#' + mainID + ' .typography-preview' ).css( 'font-weight', style ); //show in the preview box the font $( '#' + mainID + ' .typography-preview' ).css( 'font-family', family + ', sans-serif' ); if ( family === 'none' && family === '' ) { //if selected is not a font remove style "font-family" at preview box $( '#' + mainID + ' .typography-preview' ).css( 'font-family', 'inherit' ); } $( '#' + mainID + ' .typography-preview' ).css( 'line-height', height + units ); $( '#' + mainID + ' .typography-preview' ).css( 'word-spacing', word + units ); $( '#' + mainID + ' .typography-preview' ).css( 'letter-spacing', letter + units ); if ( color ) { $( '#' + mainID + ' .typography-preview' ).css( 'color', color ); $( '#' + mainID + ' .typography-preview' ).css( 'background-color', redux.field_objects.typography.contrastColour( color ) ); } $( '#' + mainID + ' .typography-style .select2-chosen' ).text( $( '#' + mainID + ' .redux-typography-style option:selected' ).text() ); $( '#' + mainID + ' .typography-script .select2-chosen' ).text( $( '#' + mainID + ' .redux-typography-subsets option:selected' ).text() ); if ( align ) { $( '#' + mainID + ' .typography-preview' ).css( 'text-align', align ); } if ( transform ) { $( '#' + mainID + ' .typography-preview' ).css( 'text-transform', transform ); } if ( fontVariant ) { $( '#' + mainID + ' .typography-preview' ).css( 'font-variant', fontVariant ); } if ( decoration ) { $( '#' + mainID + ' .typography-preview' ).css( 'text-decoration', decoration ); } $( '#' + mainID + ' .typography-preview' ).slideDown(); } // end preview stuff // if not preview showing, then set preview to show if ( !$( '#' + mainID ).hasClass( 'typography-initialized' ) ) { $( '#' + mainID ).addClass( 'typography-initialized' ); } isSelecting = false; if ( !skipCheck ) { redux_change( selector ); } }; })( jQuery );fields/typography/field_typography_json.min.js000066600000025120152141561100015742 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.typography=redux.field_objects.typography||{};var b=[],c=!1,d={width:"resolve",triggerChange:!0,allowClear:!0};a(document).ready(function(){}),redux.field_objects.typography.init=function(e,f){e||(e=a(document).find(".redux-group-tab:visible").find(".redux-container-typography:visible")),a(e).each(function(){var e=a(this),f=e;if(e.hasClass("redux-field-container")||(f=e.parents(".redux-field-container:first")),!f.is(":hidden")&&f.hasClass("redux-field-init")){f.removeClass("redux-field-init");var g;e.each(function(){a(this).find(".redux-typography-container").each(function(){var b=a(this).find(".redux-typography-family");void 0===b.data("value")?b=a(this):""!==b.data("value")&&a(b).val(b.data("value"));var c=a(this).find(".select2_params");if(c.size()>0){var e=c.val();e=JSON.parse(e),d=a.extend({},d,e)}g=Boolean(a(this).find(".redux-font-clear").val()),redux.field_objects.typography.select(b,!0),window.onbeforeunload=null}),a(this).find(".redux-typography").on("change",function(){redux.field_objects.typography.select(a(this))}),a(this).find(".redux-typography-size, .redux-typography-height, .redux-typography-word, .redux-typography-letter, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration").keyup(function(){redux.field_objects.typography.select(a(this).parents(".redux-container-typography:first"))}),a(this).find(".redux-typography-color").wpColorPicker({change:function(b,c){a(this).val(c.color.toString()),redux.field_objects.typography.select(a(this).parents(".redux-container-typography:first"))}}),a(this).find(".redux-typography-size").numeric({allowMinus:!1}),a(this).find(".redux-typography-height, .redux-typography-word, .redux-typography-letter").numeric({allowMinus:!0});var f=[{id:"none",text:"none"}];a(this).find(".redux-typography-family").select2({matcher:function(a,b){return 0===b.toUpperCase().indexOf(a.toUpperCase())},query:function(a){return window.Select2.query.local(f)(a)},initSelection:function(a,b){var c={id:a.val(),text:a.val()};b(c)},allowClear:g}).on("select2-opening",function(b){var c=a(this).parents(".redux-container-typography:first").attr("data-id"),d=a("#"+c+" .redux-typography-font-family").data("user-fonts");d=d?1:0;var e=a("#"+c+" .redux-typography-google").val();e=e?1:0;var g=[];if(void 0!==redux.customfonts&&g.push(redux.customfonts),void 0!==redux.stdfonts&&0===d&&g.push(redux.stdfonts),1==d){var h=[];for(var i in redux.typography[c]){var j=redux.typography[c].std_font;for(var k in j)j.hasOwnProperty(k)&&h.push({id:k,text:k,"data-google":"false"})}var l={text:"Standard Fonts",children:h};g.push(l)}(1==e||e===!0&&void 0!==redux.googlefonts)&&g.push(redux.googlefonts),f=g;var m=a("#"+c+" #"+c+"-family").attr("placeholder");m||(m=null),a("#"+c+" .redux-typography-family").select2("val",m)}).on("select2-selecting",function(d,e){var f=d.object.text,g=a(this).parents(".redux-container-typography:first").attr("data-id");a("#"+g+" #"+g+"-family").data("value",f),a("#"+g+" #"+g+"-family").attr("placeholder",f),b=d,c=!0,redux.field_objects.typography.select(a(this).parents(".redux-container-typography:first"))}).on("select2-clearing",function(b,c){var d=a(this).parents(".redux-container-typography:first").attr("data-id");a("#"+d+" #"+d+"-family").attr("data-value",""),a("#"+d+" #"+d+"-family").attr("placeholder","Font Family"),a("#"+d+" #"+d+"-google-font").val("false"),redux.field_objects.typography.select(a(this).parents(".redux-container-typography:first"))});var h=e.find(".redux-typography-family");h.hasClass("redux-typography-family")||e.find(".redux-typography-style").select2(d),e.find(".redux-typography-family-backup, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration").select2(d)})}})},redux.field_objects.typography.size=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c},redux.field_objects.typography.makeBool=function(a){return"false"==a||"0"==a||a===!1||0===a?!1:"true"==a||"1"==a||a===!0||1==a?!0:void 0},redux.field_objects.typography.change=function(a){var b={};jQuery(a).find(".redux-typography-input").each(function(){void 0!==jQuery(this).data("name")&&(b[jQuery(this).data("name")]=jQuery(this).val())});var c=jQuery(a).find(".typography-data-input:first-child");c.val(JSON.stringify(b))},redux.field_objects.typography.contrastColour=function(a){var b="#444444";if(""!==a){a=a.replace("#","");var c=parseInt(a.substr(0,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(4,2),16),f=(299*c+587*d+114*e)/1e3;b=f>=128?"#444444":"#ffffff"}return b},redux.field_objects.typography.select=function(e,f){var g;g=a(e).parents(".redux-container-typography:first").attr("data-id"),void 0===g&&(g=a(e).attr("data-id"));var h=(a(e).parents(".redux-container-typography:first"),a("#"+g+" #"+g+"-family").val());h||(h=null);var i,j=a("#"+g+" select.redux-typography-family-backup").val(),k=a("#"+g+" .redux-typography-size").val(),l=a("#"+g+" .redux-typography-height").val(),m=a("#"+g+" .redux-typography-word").val(),n=a("#"+g+" .redux-typography-letter").val(),o=a("#"+g+" select.redux-typography-align").val(),p=a("#"+g+" select.redux-typography-transform").val(),q=a("#"+g+" select.redux-typography-font-variant").val(),r=a("#"+g+" select.redux-typography-decoration").val(),s=a("#"+g+" select.redux-typography-style").val(),t=a("#"+g+" select.redux-typography-subsets").val(),u=a("#"+g+" .redux-typography-color").val(),v=a("#"+g).data("units");c===!0?(i=redux.field_objects.typography.makeBool(b.object["data-google"]),a("#"+g+" .redux-typography-google-font").val(i)):i=redux.field_objects.typography.makeBool(a("#"+g+" .redux-typography-google-font").val()),a("#"+g).hasClass("typography-initialized")||(s=a("#"+g+" select.redux-typography-style").data("value"),t=a("#"+g+" select.redux-typography-subsets").data("value"),""!==s&&(s=String(s)),void 0!==typeof t&&(t=String(t))),void 0===redux.fonts.google&&(i=!1);var w="";if(w=i===!0&&h in redux.fonts.google?redux.fonts.google[h]:{400:"Normal 400",700:"Bold 700","400italic":"Normal 400 Italic","700italic":"Bold 700 Italic"},a(e).hasClass("redux-typography-subsets")&&a("#"+g+" input.typography-subsets").val(t),a(e).hasClass("redux-typography-family")){var x='';if(i===!0){var y="";a.each(w.variants,function(a,b){b.id===s||1===redux.field_objects.typography.size(w.variants)?(y=' selected="selected"',s=b.id):y="",x+='"}),a("#"+g+" .redux-typography-style").select2("destroy"),a("#"+g+" .redux-typography-style").html(x),a("#"+g+" .redux-typography-style").select2(d),y="",x='',a.each(w.subsets,function(b,c){c.id===t||1===redux.field_objects.typography.size(w.subsets)?(y=' selected="selected"',t=c.id,a("#"+g+" input.typography-subsets").val(t)):y="",x+='"}),a("#"+g+" .redux-typography-subsets").select2("destroy"),a("#"+g+" .redux-typography-subsets").html(x),a("#"+g+" .redux-typography-subsets").select2(d),a("#"+g+" .redux-typography-subsets").parent().fadeIn("fast"),a("#"+g+" .typography-family-backup").fadeIn("fast")}else w&&(a.each(w,function(b,c){b===s||"normal"===b?(y=' selected="selected"',a("#"+g+" .typography-style .select2-chosen").text(c)):y="",x+='"}),a("#"+g+" .redux-typography-style").select2("destroy"),a("#"+g+" .redux-typography-style").html(x),a("#"+g+" .redux-typography-style").select2(d),a("#"+g+" .redux-typography-subsets").parent().fadeOut("fast"),a("#"+g+" .typography-family-backup").fadeOut("fast"));a("#"+g+" .redux-typography-font-family").val(h)}else a(e).hasClass("redux-typography-family-backup")&&""!==j&&a("#"+g+" .redux-typography-font-family-backup").val(j);0===a("#"+g+" select.redux-typography-style option[value='"+s+"']").length?(s="",a("#"+g+" select.redux-typography-style").select2("val","")):"400"===s&&a("#"+g+" select.redux-typography-style").select2("val",s),0===a("#"+g+" select.redux-typography-subsets option[value='"+t+"']").length&&(t="",a("#"+g+" select.redux-typography-subsets").select2("val",""),a("#"+g+" input.typography-subsets").val(t));var z="style_link_"+g;if(a("."+z).remove(),null!==h&&"inherit"!==h&&a("#"+g).hasClass("typography-initialized")){var A=h.replace(/\s+/g,"+");if(i===!0){var B=A;s&&""!==s&&(B+=":"+s.replace(/\-/g," ")),t&&""!==t&&(B+="&subset="+t),c===!1&&"undefined"!=typeof WebFont&&WebFont&&WebFont.load({google:{families:[B]}}),a("#"+g+" .redux-typography-google").val(!0)}else a("#"+g+" .redux-typography-google").val(!1)}if(-1!==s.indexOf("italic")?(a("#"+g+" .typography-preview").css("font-style","italic"),a("#"+g+" .typography-font-style").val("italic"),s=s.replace("italic","")):(a("#"+g+" .typography-preview").css("font-style","normal"),a("#"+g+" .typography-font-style").val("")),a("#"+g+" .typography-font-weight").val(s),l||(l=k),""===k||void 0===k?a("#"+g+" .typography-font-size").val(""):a("#"+g+" .typography-font-size").val(k+v),""===l||void 0===l?a("#"+g+" .typography-line-height").val(""):a("#"+g+" .typography-line-height").val(l+v),""===m||void 0===m?a("#"+g+" .typography-word-spacing").val(""):a("#"+g+" .typography-word-spacing").val(m+v),""===n||void 0===n?a("#"+g+" .typography-letter-spacing").val(""):a("#"+g+" .typography-letter-spacing").val(n+v),a("#"+g).hasClass("typography-initialized")){var C=a("#"+g+" .typography-preview").data("preview-size");"0"==C&&a("#"+g+" .typography-preview").css("font-size",k+v),a("#"+g+" .typography-preview").css("font-weight",s),a("#"+g+" .typography-preview").css("font-family",h+", sans-serif"),"none"===h&&""===h&&a("#"+g+" .typography-preview").css("font-family","inherit"),a("#"+g+" .typography-preview").css("line-height",l+v),a("#"+g+" .typography-preview").css("word-spacing",m+v),a("#"+g+" .typography-preview").css("letter-spacing",n+v),u&&(a("#"+g+" .typography-preview").css("color",u),a("#"+g+" .typography-preview").css("background-color",redux.field_objects.typography.contrastColour(u))),a("#"+g+" .typography-style .select2-chosen").text(a("#"+g+" .redux-typography-style option:selected").text()),a("#"+g+" .typography-script .select2-chosen").text(a("#"+g+" .redux-typography-subsets option:selected").text()),o&&a("#"+g+" .typography-preview").css("text-align",o),p&&a("#"+g+" .typography-preview").css("text-transform",p),q&&a("#"+g+" .typography-preview").css("font-variant",q),r&&a("#"+g+" .typography-preview").css("text-decoration",r),a("#"+g+" .typography-preview").slideDown()}a("#"+g).hasClass("typography-initialized")||a("#"+g).addClass("typography-initialized"),c=!1,f||redux_change(e)}}(jQuery);fields/typography/field_typography.json000066600000163045152141561100014475 0ustar00 "Arial, Helvetica, sans-serif", "'Arial Black', Gadget, sans-serif" => "'Arial Black', Gadget, sans-serif", "'Bookman Old Style', serif" => "'Bookman Old Style', serif", "'Comic Sans MS', cursive" => "'Comic Sans MS', cursive", "Courier, monospace" => "Courier, monospace", "Garamond, serif" => "Garamond, serif", "Georgia, serif" => "Georgia, serif", "Impact, Charcoal, sans-serif" => "Impact, Charcoal, sans-serif", "'Lucida Console', Monaco, monospace" => "'Lucida Console', Monaco, monospace", "'Lucida Sans Unicode', 'Lucida Grande', sans-serif" => "'Lucida Sans Unicode', 'Lucida Grande', sans-serif", "'MS Sans Serif', Geneva, sans-serif" => "'MS Sans Serif', Geneva, sans-serif", "'MS Serif', 'New York', sans-serif" => "'MS Serif', 'New York', sans-serif", "'Palatino Linotype', 'Book Antiqua', Palatino, serif" => "'Palatino Linotype', 'Book Antiqua', Palatino, serif", "Tahoma,Geneva, sans-serif" => "Tahoma, Geneva, sans-serif", "'Times New Roman', Times,serif" => "'Times New Roman', Times, serif", "'Trebuchet MS', Helvetica, sans-serif" => "'Trebuchet MS', Helvetica, sans-serif", "Verdana, Geneva, sans-serif" => "Verdana, Geneva, sans-serif", ); private $user_fonts = true; /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; // Shim out old arg to new if ( isset( $this->field['all_styles'] ) && ! empty( $this->field['all_styles'] ) ) { $this->field['all-styles'] = $this->field['all_styles']; unset ( $this->field['all_styles'] ); } // Set field array defaults. No errors please $defaults = array( 'font-family' => true, 'font-size' => true, 'font-weight' => true, 'font-style' => true, 'font-backup' => false, 'subsets' => true, 'custom_fonts' => true, 'text-align' => true, 'text-transform' => false, 'font-variant' => false, 'text-decoration' => false, 'color' => true, 'preview' => true, 'line-height' => true, 'multi' => array( 'subset' => false, 'weight' => false, ), 'word-spacing' => false, 'letter-spacing' => false, 'google' => true, 'update_weekly' => false, // Enable to force updates of Google Fonts to be weekly 'font_family_clear' => true ); $this->field = wp_parse_args( $this->field, $defaults ); // Set value defaults. $defaults = array( 'font-family' => '', 'font-options' => '', 'font-backup' => '', 'text-align' => '', 'text-transform' => '', 'font-variant' => '', 'text-decoration' => '', 'line-height' => '', 'word-spacing' => '', 'letter-spacing' => '', 'subsets' => '', 'google' => false, 'font-script' => '', 'font-weight' => '', 'font-style' => '', 'color' => '', 'font-size' => '', ); $this->value = wp_parse_args( $this->value, $defaults ); // Get the google array $this->getGoogleArray(); if ( empty( $this->field['fonts'] ) ) { $this->user_fonts = false; $this->field['fonts'] = $this->std_fonts; } // Localize std fonts $this->localizeStdFonts(); } function localize( $field, $value = "" ) { $params = array(); if ( true == $this->user_fonts && ! empty( $this->field['fonts'] ) ) { $params['std_font'] = $this->field['fonts']; } return $params; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { // Since fonts declared is CSS (@font-face) are not rendered in the preview, // they can be declared in a CSS file and passed here so they DO display in // font preview. Do NOT pass style.css in your theme, as that will mess up // admin page styling. It's recommended to pass a CSS file with ONLY font // declarations. // If field is set and not blank, then enqueue field if ( isset( $this->field['ext-font-css'] ) && $this->field['ext-font-css'] != '' ) { wp_register_style( 'redux-external-fonts', $this->field['ext-font-css'] ); wp_enqueue_style( 'redux-external-fonts' ); } if ( empty( $this->field['units'] ) && ! empty( $this->field['default']['units'] ) ) { $this->field['units'] = $this->field['default']['units']; } if ( empty( $this->field['units'] ) || ! in_array( $this->field['units'], array( 'px', 'em', 'rem', '%' ) ) ) { $this->field['units'] = 'px'; } $unit = $this->field['units']; echo '
    '; $val = json_encode( $this->value ); echo "field['name_suffix']}' class='{$this->field['class']} typography-data-input' value='{$val}'>"; if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } /* Font Family */ if ( $this->field['font-family'] === true ) { // font family clear echo ''; //if (filter_var($this->value['google'], FILTER_VALIDATE_BOOLEAN)) { if ( filter_var( $this->value['google'], FILTER_VALIDATE_BOOLEAN ) ) { // Divide and conquer $fontFamily = explode( ', ', $this->value['font-family'], 2 ); // If array 0 is empty and array 1 is not if ( empty( $fontFamily[0] ) && ! empty( $fontFamily[1] ) ) { // Make array 0 = array 1 $fontFamily[0] = $fontFamily[1]; // Clear array 1 $fontFamily[1] = ""; } } // If no fontFamily array exists, create one and set array 0 // with font value if ( ! isset( $fontFamily ) ) { $fontFamily = array(); $fontFamily[0] = $this->value['font-family']; $fontFamily[1] = ""; } // Is selected font a Google font $isGoogleFont = '0'; if ( isset( $this->parent->fonts['google'][ $fontFamily[0] ] ) ) { $isGoogleFont = '1'; } // If not a Google font, show all font families if ( $isGoogleFont != '1' ) { $fontFamily[0] = $this->value['font-family']; } $userFonts = '0'; if ( true == $this->user_fonts ) { $userFonts = '1'; } echo ''; echo ''; echo ''; echo '
    '; echo ''; $placeholder = $fontFamily[0] ? $fontFamily[0] : __( 'Font family', 'redux-framework' ); echo '
    '; echo '
    '; echo '
    '; $googleSet = false; if ( $this->field['google'] === true ) { // Set a flag so we know to set a header style or not echo ''; $googleSet = true; } } /* Backup Font */ if ( $this->field['font-family'] === true && $this->field['google'] === true ) { if ( false == $googleSet ) { // Set a flag so we know to set a header style or not echo ''; } if ( $this->field['font-backup'] === true ) { echo '
    '; echo ''; echo '
    '; } } /* Font Style/Weight */ if ( $this->field['font-style'] === true || $this->field['font-weight'] === true ) { echo '
    '; echo ''; $style = $this->value['font-weight'] . $this->value['font-style']; echo ' '; echo ' '; $multi = ( isset( $this->field['multi']['weight'] ) && $this->field['multi']['weight'] ) ? ' multiple="multiple"' : ""; echo ''; if ( empty( $this->value['subset'] ) || empty( $this->value['font-weight'] ) ) { echo ''; } $nonGStyles = array( '200' => 'Lighter', '400' => 'Normal', '700' => 'Bold', '900' => 'Bolder' ); if ( isset( $gfonts[ $this->value['font-family'] ] ) ) { foreach ( $gfonts[ $this->value['font-family'] ]['variants'] as $v ) { echo ''; } } else { if ( ! isset( $this->value['font-weight'] ) && isset( $this->value['subset'] ) ) { $this->value['font-weight'] = $this->value['subset']; } foreach ( $nonGStyles as $i => $style ) { if ( ! isset( $this->value['font-weight'] ) ) { $this->value['font-weight'] = false; } if ( ! isset( $this->value['subset'] ) ) { $this->value['subset'] = false; } echo ''; } } echo '
    '; } /* Font Script */ if ( $this->field['font-family'] == true && $this->field['subsets'] == true && $this->field['google'] == true ) { echo '
    '; echo ' '; echo ''; $multi = ( isset( $this->field['multi']['subset'] ) && $this->field['multi']['subset'] ) ? ' multiple="multiple"' : ""; echo ''; if ( empty( $this->value['subsets'] ) ) { echo ''; } if ( isset( $gfonts[ $this->value['font-family'] ] ) ) { foreach ( $gfonts[ $this->value['font-family'] ]['subsets'] as $v ) { echo ''; } } echo '
    '; } /* Font Align */ if ( $this->field['text-align'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Text Transform */ if ( $this->field['text-transform'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Font Variant */ if ( $this->field['font-variant'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Text Decoration */ if ( $this->field['text-decoration'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Font Size */ if ( $this->field['font-size'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } /* Line Height */ if ( $this->field['line-height'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } /* Word Spacing */ if ( $this->field['word-spacing'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } /* Letter Spacing */ if ( $this->field['letter-spacing'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } echo '
    '; /* Font Color */ if ( $this->field['color'] === true ) { $default = ""; if ( empty( $this->field['default']['color'] ) && ! empty( $this->field['color'] ) ) { $default = $this->value['color']; } else if ( ! empty( $this->field['default']['color'] ) ) { $default = $this->field['default']['color']; } echo '
    '; echo ''; echo '
    '; echo ''; echo '
    '; } echo '
    '; /* Font Preview */ if ( ! isset( $this->field['preview'] ) || $this->field['preview'] !== false ) { if ( isset( $this->field['preview']['text'] ) ) { $g_text = $this->field['preview']['text']; } else { $g_text = '1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z'; } $style = ''; if ( isset( $this->field['preview']['always_display'] ) ) { if ( true === filter_var( $this->field['preview']['always_display'], FILTER_VALIDATE_BOOLEAN ) ) { if ( $isGoogleFont == true ) { $this->parent->typography_preview[ $fontFamily[0] ] = array( 'font-style' => array( $this->value['font-weight'] . $this->value['font-style'] ), 'subset' => array( $this->value['subset'] ) ); $protocol = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ) ? "https:" : "http:"; wp_deregister_style( 'redux-typography-preview' ); wp_dequeue_style( 'redux-typography-preview' ); wp_register_style( 'redux-typography-preview', $protocol . $this->makeGoogleWebfontLink( $this->parent->typography_preview ), '', time() ); wp_enqueue_style( 'redux-typography-preview' ); } $style = 'display: block; font-family: ' . $this->value['font-family'] . '; font-weight: ' . $this->value['font-weight'] . ';'; } } if ( isset( $this->field['preview']['font-size'] ) ) { $style .= 'font-size: ' . $this->field['preview']['font-size'] . ';'; $inUse = '1'; } else { //$g_size = ''; $inUse = '0'; } echo '

    ' . $g_text . '

    '; echo '
    '; // end typography container } } //function /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ function enqueue() { if ( ! wp_style_is( 'select2-css' ) ) { wp_enqueue_style( 'select2-css' ); } if ( ! wp_style_is( 'wp-color-picker' ) ) { wp_enqueue_style( 'wp-color-picker' ); } if ( ! wp_script_is( 'redux-field-typography-js' ) ) { wp_enqueue_script( 'redux-field-typography-js', ReduxFramework::$_url . 'inc/fields/typography/field_typography' . Redux_Functions::isMin() . '.js', array( 'jquery', 'wp-color-picker', 'select2-js', 'redux-js' ), time(), true ); } wp_localize_script( 'redux-field-typography-js', 'redux_ajax_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); if ( $this->parent->args['dev_mode'] ) { if ( ! wp_style_is( 'redux-color-picker-css' ) ) { wp_enqueue_style( 'redux-color-picker-css' ); } if ( ! wp_style_is( 'redux-field-typography-css' ) ) { wp_enqueue_style( 'redux-field-typography-css', ReduxFramework::$_url . 'inc/fields/typography/field_typography.css', array(), time(), 'all' ); } } } //function /** * makeGoogleWebfontLink Function. * Creates the google fonts link. * * @since ReduxFramework 3.0.0 */ function makeGoogleWebfontLink( $fonts ) { $link = ""; $subsets = array(); foreach ( $fonts as $family => $font ) { if ( ! empty( $link ) ) { $link .= "%7C"; // Append a new font to the string } $link .= $family; if ( ! empty( $font['font-style'] ) || ! empty( $font['all-styles'] ) ) { $link .= ':'; if ( ! empty( $font['all-styles'] ) ) { $link .= implode( ',', $font['all-styles'] ); } else if ( ! empty( $font['font-style'] ) ) { $link .= implode( ',', $font['font-style'] ); } } if ( ! empty( $font['subset'] ) ) { foreach ( $font['subset'] as $subset ) { if ( ! in_array( $subset, $subsets ) ) { array_push( $subsets, $subset ); } } } } if ( ! empty( $subsets ) ) { $link .= "&subset=" . implode( ',', $subsets ); } return '//fonts.googleapis.com/css?family=' . str_replace( '|', '%7C', $link ); } /** * makeGoogleWebfontString Function. * Creates the google fonts link. * * @since ReduxFramework 3.1.8 */ function makeGoogleWebfontString( $fonts ) { $link = ""; $subsets = array(); foreach ( $fonts as $family => $font ) { if ( ! empty( $link ) ) { $link .= "', '"; // Append a new font to the string } $link .= $family; if ( ! empty( $font['font-style'] ) || ! empty( $font['all-styles'] ) ) { $link .= ':'; if ( ! empty( $font['all-styles'] ) ) { $link .= implode( ',', $font['all-styles'] ); } else if ( ! empty( $font['font-style'] ) ) { $link .= implode( ',', $font['font-style'] ); } } if ( ! empty( $font['subset'] ) ) { foreach ( $font['subset'] as $subset ) { if ( ! in_array( $subset, $subsets ) ) { array_push( $subsets, $subset ); } } } } if ( ! empty( $subsets ) ) { $link .= "&subset=" . implode( ',', $subsets ); } return "'" . $link . "'"; } function output() { $font = $this->value; // Shim out old arg to new if ( isset( $this->field['all_styles'] ) && ! empty( $this->field['all_styles'] ) ) { $this->field['all-styles'] = $this->field['all_styles']; unset ( $this->field['all_styles'] ); } // Check for font-backup. If it's set, stick it on a variabhle for // later use. if ( ! empty( $font['font-family'] ) && ! empty( $font['font-backup'] ) ) { $font['font-family'] = str_replace( ', ' . $font['font-backup'], '', $font['font-family'] ); $fontBackup = ',' . $font['font-backup']; } // if (strpos($font['font-family'], ' ')) { // $font['font-family'] = '"' . $font['font-family'] . '"'; // } $style = ''; $fontValueSet = false; if ( ! empty( $font ) ) { foreach ( $font as $key => $value ) { if ( ! empty( $value ) && in_array( $key, array( 'font-family', 'font-weight' ) ) ) { $fontValueSet = true; } } } if ( ! empty( $font ) ) { foreach ( $font as $key => $value ) { if ( $key == 'font-options' ) { continue; } // Check for font-family key if ( 'font-family' == $key ) { // Enclose font family in quotes if spaces are in the // name. This is necessary because if there are numerics // in the font name, they will not render properly. // Google should know better. if ( strpos( $value, ' ' ) && ! strpos( $value, ',' ) ) { $value = '"' . $value . '"'; } // Ensure fontBackup isn't empty (we already option // checked this earlier. No need to do it again. if ( ! empty( $fontBackup ) ) { // Apply the backup font to the font-family element // via the saved variable. We do this here so it // doesn't get appended to the Google stuff below. $value .= $fontBackup; } } if ( empty( $value ) && in_array( $key, array( 'font-weight', 'font-style' ) ) && $fontValueSet == true ) { $value = "normal"; } if ( $key == 'font-weight' && $this->field['font-weight'] == false ) { continue; } if ( $key == 'font-style' && $this->field['font-style'] == false ) { continue; } if ( $key == "google" || $key == "subsets" || $key == "font-backup" || empty( $value ) ) { continue; } $style .= $key . ':' . $value . ';'; } if ( isset( $this->parent->args['async_typography'] ) && $this->parent->args['async_typography'] ) { $style .= 'opacity: 1;visibility: visible;-webkit-transition: opacity 0.24s ease-in-out;-moz-transition: opacity 0.24s ease-in-out;transition: opacity 0.24s ease-in-out;'; } } if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); $this->parent->outputCSS .= $keys . "{" . $style . '}'; if ( isset( $this->parent->args['async_typography'] ) && $this->parent->args['async_typography'] ) { $key_string = ""; $key_string_ie = ""; foreach ( $this->field['output'] as $value ) { $key_string .= ".wf-loading " . $value . ','; $key_string_ie .= ".ie.wf-loading " . $value . ','; } $this->parent->outputCSS .= $key_string . "{opacity: 0;}"; $this->parent->outputCSS .= $key_string_ie . "{visibility: hidden;}"; } } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); $this->parent->compilerCSS .= $keys . "{" . $style . '}'; if ( isset( $this->parent->args['async_typography'] ) && $this->parent->args['async_typography'] ) { $key_string = ""; $key_string_ie = ""; foreach ( $this->field['compiler'] as $value ) { $key_string .= ".wf-loading " . $value . ','; $key_string_ie .= ".ie.wf-loading " . $value . ','; } $this->parent->compilerCSS .= $key_string . "{opacity: 0;}"; $this->parent->compilerCSS .= $key_string_ie . "{visibility: hidden;}"; } } } // Google only stuff! if ( ! empty( $font['font-family'] ) && ! empty( $this->field['google'] ) && filter_var( $this->field['google'], FILTER_VALIDATE_BOOLEAN ) ) { // Added standard font matching check to avoid output to Google fonts call - kp // If no custom font array was supplied, the load it with default // standard fonts. if ( empty( $this->field['fonts'] ) ) { $this->field['fonts'] = $this->std_fonts; } // Ensure the fonts array is NOT empty if ( ! empty( $this->field['fonts'] ) ) { //Make the font keys in the array lowercase, for case-insensitive matching $lcFonts = array_change_key_case( $this->field['fonts'] ); // Rebuild font array with all keys stripped of spaces $arr = array(); foreach ( $lcFonts as $key => $value ) { $key = str_replace( ', ', ',', $key ); $arr[ $key ] = $value; } $lcFonts = array_change_key_case( $this->field['custom_fonts'] ); foreach ( $lcFonts as $group => $fontArr ) { foreach ( $fontArr as $key => $value ) { $arr[ strtolower( $key ) ] = $key; } } $lcFonts = $arr; unset( $arr ); // lowercase chosen font for matching purposes $lcFont = strtolower( $font['font-family'] ); // Remove spaces after commas in chosen font for mathcing purposes. $lcFont = str_replace( ', ', ',', $lcFont ); // If the lower cased passed font-family is NOT found in the standard font array // Then it's a Google font, so process it for output. if ( ! array_key_exists( $lcFont, $lcFonts ) ) { $family = $font['font-family']; // Strip out spaces in font names and replace with with plus signs // TODO?: This method doesn't respect spaces after commas, hence the reason // for the std_font array keys having no spaces after commas. This could be // fixed with RegEx in the future. $font['font-family'] = str_replace( ' ', '+', $font['font-family'] ); // Push data to parent typography variable. if ( empty( $this->parent->typography[ $font['font-family'] ] ) ) { $this->parent->typography[ $font['font-family'] ] = array(); } if ( isset( $this->field['all-styles'] ) ) { if ( ! isset( $font['font-options'] ) || empty( $font['font-options'] ) ) { $this->getGoogleArray(); if ( isset( $this->parent->googleArray ) && ! empty( $this->parent->googleArray ) && isset( $this->parent->googleArray[ $family ] ) ) { $font['font-options'] = $this->parent->googleArray[ $family ]; } } else { $font['font-options'] = json_decode( $font['font-options'], true ); } //print_r($font['font-options']); //exit(); } if ( isset( $font['font-options'] ) && ! empty( $font['font-options'] ) && isset( $this->field['all-styles'] ) && filter_var( $this->field['all-styles'], FILTER_VALIDATE_BOOLEAN ) ) { if ( isset( $font['font-options'] ) && ! empty( $font['font-options']['variants'] ) ) { if ( ! isset( $this->parent->typography[ $font['font-family'] ]['all-styles'] ) || empty( $this->parent->typography[ $font['font-family'] ]['all-styles'] ) ) { $this->parent->typography[ $font['font-family'] ]['all-styles'] = array(); foreach ( $font['font-options']['variants'] as $variant ) { $this->parent->typography[ $font['font-family'] ]['all-styles'][] = $variant['id']; } } } } if ( ! empty( $font['font-weight'] ) ) { if ( empty( $this->parent->typography[ $font['font-family'] ]['font-weight'] ) || ! in_array( $font['font-weight'], $this->parent->typography[ $font['font-family'] ]['font-weight'] ) ) { $style = $font['font-weight']; } if ( ! empty( $font['font-style'] ) ) { $style .= $font['font-style']; } if ( empty( $this->parent->typography[ $font['font-family'] ]['font-style'] ) || ! in_array( $style, $this->parent->typography[ $font['font-family'] ]['font-style'] ) ) { $this->parent->typography[ $font['font-family'] ]['font-style'][] = $style; } } if ( ! empty( $font['subsets'] ) ) { if ( empty( $this->parent->typography[ $font['font-family'] ]['subset'] ) || ! in_array( $font['subsets'], $this->parent->typography[ $font['font-family'] ]['subset'] ) ) { $this->parent->typography[ $font['font-family'] ]['subset'][] = $font['subsets']; } } } // !array_key_exists } //!empty fonts array } // Typography not set } private function localizeStdFonts() { if ( false == $this->user_fonts ) { if ( isset( $this->parent->fonts['std'] ) && ! empty( $this->parent->fonts['std'] ) ) { return; } $this->parent->font_groups['std'] = array( 'text' => __( 'Standard Fonts', 'redux-framework' ), 'children' => array(), ); foreach ( $this->field['fonts'] as $font => $extra ) { $this->parent->font_groups['std']['children'][] = array( 'id' => $font, 'text' => $font, 'data-google' => 'false', ); } } if ( $this->field['custom_fonts'] !== false ) { $this->field['custom_fonts'] = apply_filters( "redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array() ); if ( ! empty( $this->field['custom_fonts'] ) ) { foreach ( $this->field['custom_fonts'] as $group => $fonts ) { $this->parent->font_groups['customfonts'] = array( 'text' => $group, 'children' => array(), ); foreach ( $fonts as $family => $v ) { $this->parent->font_groups['customfonts']['children'][] = array( 'id' => $family, 'text' => $family, 'data-google' => 'false', ); } } } } } /** * Construct the google array from the stored JSON/HTML */ function getGoogleArray() { if ( ( isset( $this->parent->fonts['google'] ) && ! empty( $this->parent->fonts['google'] ) ) || isset( $this->parent->fonts['google'] ) && $this->parent->fonts['google'] == false ) { return; } $gFile = dirname( __FILE__ ) . '/googlefonts.php'; // Weekly update if ( isset( $this->parent->args['google_update_weekly'] ) && $this->parent->args['google_update_weekly'] && ! empty( $this->parent->args['google_api_key'] ) ) { if ( file_exists( $gFile ) ) { // Keep the fonts updated weekly $weekback = strtotime( date( 'jS F Y', time() + ( 60 * 60 * 24 * - 7 ) ) ); $last_updated = filemtime( $gFile ); if ( $last_updated < $weekback ) { unlink( $gFile ); } } } if ( ! file_exists( $gFile ) ) { $result = @wp_remote_get( apply_filters( 'redux-google-fonts-api-url', 'https://www.googleapis.com/webfonts/v1/webfonts?key=' ) . $this->parent->args['google_api_key'], array( 'sslverify' => false ) ); if ( ! is_wp_error( $result ) && $result['response']['code'] == 200 ) { $result = json_decode( $result['body'] ); foreach ( $result->items as $font ) { $this->parent->googleArray[ $font->family ] = array( 'variants' => $this->getVariants( $font->variants ), 'subsets' => $this->getSubsets( $font->subsets ) ); } if ( ! empty( $this->parent->googleArray ) ) { $this->parent->filesystem->execute( 'put_contents', $gFile, array( 'content' => "parent->googleArray ) . "', true );" ) ); } } } if ( ! file_exists( $gFile ) ) { $this->parent->fonts['google'] = false; return; } if ( ! isset( $this->parent->fonts['google'] ) || empty( $this->parent->fonts['google'] ) ) { $fonts = include $gFile; if ( $fonts === true ) { $this->parent->fonts['google'] = false; return; } if ( isset( $fonts ) && ! empty( $fonts ) && is_array( $fonts ) && $fonts != false ) { $this->parent->fonts['google'] = $fonts; $this->parent->googleArray = $fonts; // optgroup $this->parent->font_groups['google'] = array( 'text' => __( 'Google Webfonts', 'redux-framework' ), 'children' => array(), ); // options foreach ( $this->parent->fonts['google'] as $font => $extra ) { $this->parent->font_groups['google']['children'][] = array( 'id' => $font, 'text' => $font, 'data-google' => 'true' ); } } } } /** * getSubsets Function. * Clean up the Google Webfonts subsets to be human readable * * @since ReduxFramework 0.2.0 */ private function getSubsets( $var ) { $result = array(); foreach ( $var as $v ) { if ( strpos( $v, "-ext" ) ) { $name = ucfirst( str_replace( "-ext", " Extended", $v ) ); } else { $name = ucfirst( $v ); } array_push( $result, array( 'id' => $v, 'name' => $name ) ); } return array_filter( $result ); } //function /** * getVariants Function. * Clean up the Google Webfonts variants to be human readable * * @since ReduxFramework 0.2.0 */ private function getVariants( $var ) { $result = array(); $italic = array(); foreach ( $var as $v ) { $name = ""; if ( $v[0] == 1 ) { $name = 'Ultra-Light 100'; } else if ( $v[0] == 2 ) { $name = 'Light 200'; } else if ( $v[0] == 3 ) { $name = 'Book 300'; } else if ( $v[0] == 4 || $v[0] == "r" || $v[0] == "i" ) { $name = 'Normal 400'; } else if ( $v[0] == 5 ) { $name = 'Medium 500'; } else if ( $v[0] == 6 ) { $name = 'Semi-Bold 600'; } else if ( $v[0] == 7 ) { $name = 'Bold 700'; } else if ( $v[0] == 8 ) { $name = 'Extra-Bold 800'; } else if ( $v[0] == 9 ) { $name = 'Ultra-Bold 900'; } if ( $v == "regular" ) { $v = "400"; } if ( strpos( $v, "italic" ) || $v == "italic" ) { $name .= " Italic"; $name = trim( $name ); if ( $v == "italic" ) { $v = "400italic"; } $italic[] = array( 'id' => $v, 'name' => $name ); } else { $result[] = array( 'id' => $v, 'name' => $name ); } } foreach ( $italic as $item ) { $result[] = $item; } return array_filter( $result ); } //function } //class } //class exists fields/typography/field_typography.php000066600000154524152141561100014315 0ustar00 "Arial, Helvetica, sans-serif", "'Arial Black', Gadget, sans-serif" => "'Arial Black', Gadget, sans-serif", "'Bookman Old Style', serif" => "'Bookman Old Style', serif", "'Comic Sans MS', cursive" => "'Comic Sans MS', cursive", "Courier, monospace" => "Courier, monospace", "Garamond, serif" => "Garamond, serif", "Georgia, serif" => "Georgia, serif", "Impact, Charcoal, sans-serif" => "Impact, Charcoal, sans-serif", "'Lucida Console', Monaco, monospace" => "'Lucida Console', Monaco, monospace", "'Lucida Sans Unicode', 'Lucida Grande', sans-serif" => "'Lucida Sans Unicode', 'Lucida Grande', sans-serif", "'MS Sans Serif', Geneva, sans-serif" => "'MS Sans Serif', Geneva, sans-serif", "'MS Serif', 'New York', sans-serif" => "'MS Serif', 'New York', sans-serif", "'Palatino Linotype', 'Book Antiqua', Palatino, serif" => "'Palatino Linotype', 'Book Antiqua', Palatino, serif", "Tahoma,Geneva, sans-serif" => "Tahoma, Geneva, sans-serif", "'Times New Roman', Times,serif" => "'Times New Roman', Times, serif", "'Trebuchet MS', Helvetica, sans-serif" => "'Trebuchet MS', Helvetica, sans-serif", "Verdana, Geneva, sans-serif" => "Verdana, Geneva, sans-serif", ); private $user_fonts = true; /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; // Shim out old arg to new if ( isset( $this->field['all_styles'] ) && ! empty( $this->field['all_styles'] ) ) { $this->field['all-styles'] = $this->field['all_styles']; unset ( $this->field['all_styles'] ); } // Set field array defaults. No errors please $defaults = array( 'font-family' => true, 'font-size' => true, 'font-weight' => true, 'font-style' => true, 'font-backup' => false, 'subsets' => true, 'custom_fonts' => true, 'text-align' => true, 'text-transform' => false, 'font-variant' => false, 'text-decoration' => false, 'color' => true, 'preview' => true, 'line-height' => true, 'multi' => array( 'subset' => false, 'weight' => false, ), 'word-spacing' => false, 'letter-spacing' => false, 'google' => true, 'update_weekly' => false, // Enable to force updates of Google Fonts to be weekly 'font_family_clear' => true ); $this->field = wp_parse_args( $this->field, $defaults ); // Set value defaults. $defaults = array( 'font-family' => '', 'font-options' => '', 'font-backup' => '', 'text-align' => '', 'text-transform' => '', 'font-variant' => '', 'text-decoration' => '', 'line-height' => '', 'word-spacing' => '', 'letter-spacing' => '', 'subsets' => '', 'google' => false, 'font-script' => '', 'font-weight' => '', 'font-style' => '', 'color' => '', 'font-size' => '', ); $this->value = wp_parse_args( $this->value, $defaults ); // Get the google array $this->getGoogleArray(); if ( empty( $this->field['fonts'] ) ) { $this->user_fonts = false; $this->field['fonts'] = $this->std_fonts; } // Localize std fonts $this->localizeStdFonts(); } function localize( $field, $value = "" ) { $params = array(); if ( true == $this->user_fonts && ! empty( $this->field['fonts'] ) ) { $params['std_font'] = $this->field['fonts']; } return $params; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { // Since fonts declared is CSS (@font-face) are not rendered in the preview, // they can be declared in a CSS file and passed here so they DO display in // font preview. Do NOT pass style.css in your theme, as that will mess up // admin page styling. It's recommended to pass a CSS file with ONLY font // declarations. // If field is set and not blank, then enqueue field if ( isset( $this->field['ext-font-css'] ) && $this->field['ext-font-css'] != '' ) { wp_register_style( 'redux-external-fonts', $this->field['ext-font-css'] ); wp_enqueue_style( 'redux-external-fonts' ); } if ( empty( $this->field['units'] ) && ! empty( $this->field['default']['units'] ) ) { $this->field['units'] = $this->field['default']['units']; } if ( empty( $this->field['units'] ) || ! in_array( $this->field['units'], array( 'px', 'em', 'rem', '%' ) ) ) { $this->field['units'] = 'px'; } $unit = $this->field['units']; echo '
    '; if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } /* Font Family */ if ( $this->field['font-family'] === true ) { // font family clear echo ''; //if (filter_var($this->value['google'], FILTER_VALIDATE_BOOLEAN)) { if ( filter_var( $this->value['google'], FILTER_VALIDATE_BOOLEAN ) ) { // Divide and conquer $fontFamily = explode( ', ', $this->value['font-family'], 2 ); // If array 0 is empty and array 1 is not if ( empty( $fontFamily[0] ) && ! empty( $fontFamily[1] ) ) { // Make array 0 = array 1 $fontFamily[0] = $fontFamily[1]; // Clear array 1 $fontFamily[1] = ""; } } // If no fontFamily array exists, create one and set array 0 // with font value if ( ! isset( $fontFamily ) ) { $fontFamily = array(); $fontFamily[0] = $this->value['font-family']; $fontFamily[1] = ""; } // Is selected font a Google font $isGoogleFont = '0'; if ( isset( $this->parent->fonts['google'][ $fontFamily[0] ] ) ) { $isGoogleFont = '1'; } // If not a Google font, show all font families if ( $isGoogleFont != '1' ) { $fontFamily[0] = $this->value['font-family']; } $userFonts = '0'; if ( true == $this->user_fonts ) { $userFonts = '1'; } echo ''; echo ''; echo ''; echo '
    '; echo ''; $placeholder = $fontFamily[0] ? $fontFamily[0] : __( 'Font family', 'redux-framework' ); echo '
    '; echo '
    '; echo '
    '; $googleSet = false; if ( $this->field['google'] === true ) { // Set a flag so we know to set a header style or not echo ''; $googleSet = true; } } /* Backup Font */ if ( $this->field['font-family'] === true && $this->field['google'] === true ) { if ( false == $googleSet ) { // Set a flag so we know to set a header style or not echo ''; } if ( $this->field['font-backup'] === true ) { echo '
    '; echo ''; echo '
    '; } } /* Font Style/Weight */ if ( $this->field['font-style'] === true || $this->field['font-weight'] === true ) { echo '
    '; echo ''; $style = $this->value['font-weight'] . $this->value['font-style']; echo ' '; echo ' '; $multi = ( isset( $this->field['multi']['weight'] ) && $this->field['multi']['weight'] ) ? ' multiple="multiple"' : ""; echo ''; if ( empty( $this->value['subsets'] ) || empty( $this->value['font-weight'] ) ) { echo ''; } $nonGStyles = array( '200' => 'Lighter', '400' => 'Normal', '700' => 'Bold', '900' => 'Bolder' ); if ( isset( $gfonts[ $this->value['font-family'] ] ) ) { foreach ( $gfonts[ $this->value['font-family'] ]['variants'] as $v ) { echo ''; } } else { if ( ! isset( $this->value['font-weight'] ) && isset( $this->value['subsets'] ) ) { $this->value['font-weight'] = $this->value['subsets']; } foreach ( $nonGStyles as $i => $style ) { if ( ! isset( $this->value['font-weight'] ) ) { $this->value['font-weight'] = false; } if ( ! isset( $this->value['subsets'] ) ) { $this->value['subsets'] = false; } echo ''; } } echo '
    '; } /* Font Script */ if ( $this->field['font-family'] == true && $this->field['subsets'] == true && $this->field['google'] == true ) { echo '
    '; echo ' '; echo ''; $multi = ( isset( $this->field['multi']['subset'] ) && $this->field['multi']['subset'] ) ? ' multiple="multiple"' : ""; echo ''; if ( empty( $this->value['subsets'] ) ) { echo ''; } if ( isset( $gfonts[ $this->value['font-family'] ] ) ) { foreach ( $gfonts[ $this->value['font-family'] ]['subsets'] as $v ) { echo ''; } } echo '
    '; } /* Font Align */ if ( $this->field['text-align'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Text Transform */ if ( $this->field['text-transform'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Font Variant */ if ( $this->field['font-variant'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Text Decoration */ if ( $this->field['text-decoration'] === true ) { echo '
    '; echo ''; echo '
    '; } /* Font Size */ if ( $this->field['font-size'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } /* Line Height */ if ( $this->field['line-height'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } /* Word Spacing */ if ( $this->field['word-spacing'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } /* Letter Spacing */ if ( $this->field['letter-spacing'] === true ) { echo '
    '; echo ''; echo '
    ' . $unit . '
    '; echo ''; echo '
    '; } echo '
    '; /* Font Color */ if ( $this->field['color'] === true ) { $default = ""; if ( empty( $this->field['default']['color'] ) && ! empty( $this->field['color'] ) ) { $default = $this->value['color']; } else if ( ! empty( $this->field['default']['color'] ) ) { $default = $this->field['default']['color']; } echo '
    '; echo ''; echo '
    '; echo ''; echo '
    '; } echo '
    '; /* Font Preview */ if ( ! isset( $this->field['preview'] ) || $this->field['preview'] !== false ) { if ( isset( $this->field['preview']['text'] ) ) { $g_text = $this->field['preview']['text']; } else { $g_text = '1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z'; } $style = ''; if ( isset( $this->field['preview']['always_display'] ) ) { if ( true === filter_var( $this->field['preview']['always_display'], FILTER_VALIDATE_BOOLEAN ) ) { if ( $isGoogleFont == true ) { $this->parent->typography_preview[ $fontFamily[0] ] = array( 'font-style' => array( $this->value['font-weight'] . $this->value['font-style'] ), 'subset' => array( $this->value['subsets'] ) ); $protocol = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ) ? "https:" : "http:"; wp_deregister_style( 'redux-typography-preview' ); wp_dequeue_style( 'redux-typography-preview' ); wp_register_style( 'redux-typography-preview', $protocol . $this->makeGoogleWebfontLink( $this->parent->typography_preview ), '', time() ); wp_enqueue_style( 'redux-typography-preview' ); } $style = 'display: block; font-family: ' . $this->value['font-family'] . '; font-weight: ' . $this->value['font-weight'] . ';'; } } if ( isset( $this->field['preview']['font-size'] ) ) { $style .= 'font-size: ' . $this->field['preview']['font-size'] . ';'; $inUse = '1'; } else { //$g_size = ''; $inUse = '0'; } echo '

    ' . $g_text . '

    '; echo '
    '; // end typography container } } //function /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ function enqueue() { if (!wp_style_is('select2-css')) { wp_enqueue_style( 'select2-css' ); } if (!wp_style_is('wp-color-picker')) { wp_enqueue_style( 'wp-color-picker' ); } if (!wp_script_is ( 'redux-field-typography-js' )) { wp_enqueue_script( 'redux-field-typography-js', ReduxFramework::$_url . 'inc/fields/typography/field_typography' . Redux_Functions::isMin() . '.js', array( 'jquery', 'wp-color-picker', 'select2-js', 'redux-js' ), time(), true ); } wp_localize_script( 'redux-field-typography-js', 'redux_ajax_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); if ($this->parent->args['dev_mode']) { if (!wp_style_is('redux-color-picker-css')) { wp_enqueue_style( 'redux-color-picker-css' ); } if (!wp_style_is('redux-field-typography-css')) { wp_enqueue_style( 'redux-field-typography-css', ReduxFramework::$_url . 'inc/fields/typography/field_typography.css', array(), time(), 'all' ); } } } //function /** * makeGoogleWebfontLink Function. * Creates the google fonts link. * * @since ReduxFramework 3.0.0 */ function makeGoogleWebfontLink( $fonts ) { $link = ""; $subsets = array(); foreach ( $fonts as $family => $font ) { if ( ! empty( $link ) ) { $link .= "%7C"; // Append a new font to the string } $link .= $family; if ( ! empty( $font['font-style'] ) || ! empty( $font['all-styles'] ) ) { $link .= ':'; if ( ! empty( $font['all-styles'] ) ) { $link .= implode( ',', $font['all-styles'] ); } else if ( ! empty( $font['font-style'] ) ) { $link .= implode( ',', $font['font-style'] ); } } if ( ! empty( $font['subset'] ) ) { foreach ( $font['subset'] as $subset ) { if ( ! in_array( $subset, $subsets ) ) { array_push( $subsets, $subset ); } } } } if ( ! empty( $subsets ) ) { $link .= "&subset=" . implode( ',', $subsets ); } return '//fonts.googleapis.com/css?family=' . str_replace( '|', '%7C', $link ); } /** * makeGoogleWebfontString Function. * Creates the google fonts link. * * @since ReduxFramework 3.1.8 */ function makeGoogleWebfontString( $fonts ) { $link = ""; $subsets = array(); foreach ( $fonts as $family => $font ) { if ( ! empty( $link ) ) { $link .= "', '"; // Append a new font to the string } $link .= $family; if ( ! empty( $font['font-style'] ) || ! empty( $font['all-styles'] ) ) { $link .= ':'; if ( ! empty( $font['all-styles'] ) ) { $link .= implode( ',', $font['all-styles'] ); } else if ( ! empty( $font['font-style'] ) ) { $link .= implode( ',', $font['font-style'] ); } } if ( ! empty( $font['subset'] ) ) { foreach ( $font['subset'] as $subset ) { if ( ! in_array( $subset, $subsets ) ) { array_push( $subsets, $subset ); } } } } if ( ! empty( $subsets ) ) { $link .= "&subset=" . implode( ',', $subsets ); } return "'" . $link . "'"; } function output() { $font = $this->value; // Shim out old arg to new if ( isset( $this->field['all_styles'] ) && ! empty( $this->field['all_styles'] ) ) { $this->field['all-styles'] = $this->field['all_styles']; unset ( $this->field['all_styles'] ); } // Check for font-backup. If it's set, stick it on a variabhle for // later use. if ( ! empty( $font['font-family'] ) && ! empty( $font['font-backup'] ) ) { $font['font-family'] = str_replace( ', ' . $font['font-backup'], '', $font['font-family'] ); $fontBackup = ',' . $font['font-backup']; } // if (strpos($font['font-family'], ' ')) { // $font['font-family'] = '"' . $font['font-family'] . '"'; // } $style = ''; $fontValueSet = false; if ( ! empty( $font ) ) { foreach ( $font as $key => $value ) { if ( ! empty( $value ) && in_array( $key, array( 'font-family', 'font-weight' ) ) ) { $fontValueSet = true; } } } if ( ! empty( $font ) ) { foreach ( $font as $key => $value ) { if ( $key == 'font-options' ) { continue; } // Check for font-family key if ( 'font-family' == $key ) { // Enclose font family in quotes if spaces are in the // name. This is necessary because if there are numerics // in the font name, they will not render properly. // Google should know better. if (strpos($value, ' ') && !strpos($value, ',')){ $value = '"' . $value . '"'; } // Ensure fontBackup isn't empty (we already option // checked this earlier. No need to do it again. if ( ! empty( $fontBackup ) ) { // Apply the backup font to the font-family element // via the saved variable. We do this here so it // doesn't get appended to the Google stuff below. $value .= $fontBackup; } } if ( empty( $value ) && in_array( $key, array( 'font-weight', 'font-style' ) ) && $fontValueSet == true ) { $value = "normal"; } if ($key == 'font-weight' && $this->field['font-weight'] == false) { continue; } if ($key == 'font-style' && $this->field['font-style'] == false) { continue; } if ( $key == "google" || $key == "subsets" || $key == "font-backup" || empty( $value ) ) { continue; } $style .= $key . ':' . $value . ';'; } if ( isset( $this->parent->args['async_typography'] ) && $this->parent->args['async_typography'] ) { $style .= 'opacity: 1;visibility: visible;-webkit-transition: opacity 0.24s ease-in-out;-moz-transition: opacity 0.24s ease-in-out;transition: opacity 0.24s ease-in-out;'; } } if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); $this->parent->outputCSS .= $keys . "{" . $style . '}'; if ( isset( $this->parent->args['async_typography'] ) && $this->parent->args['async_typography'] ) { $key_string = ""; $key_string_ie = ""; foreach ( $this->field['output'] as $value ) { $key_string .= ".wf-loading " . $value . ','; $key_string_ie .= ".ie.wf-loading " . $value . ','; } $this->parent->outputCSS .= $key_string . "{opacity: 0;}"; $this->parent->outputCSS .= $key_string_ie . "{visibility: hidden;}"; } } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); $this->parent->compilerCSS .= $keys . "{" . $style . '}'; if ( isset( $this->parent->args['async_typography'] ) && $this->parent->args['async_typography'] ) { $key_string = ""; $key_string_ie = ""; foreach ( $this->field['compiler'] as $value ) { $key_string .= ".wf-loading " . $value . ','; $key_string_ie .= ".ie.wf-loading " . $value . ','; } $this->parent->compilerCSS .= $key_string . "{opacity: 0;}"; $this->parent->compilerCSS .= $key_string_ie . "{visibility: hidden;}"; } } } // Google only stuff! if ( ! empty( $font['font-family'] ) && ! empty( $this->field['google'] ) && filter_var( $this->field['google'], FILTER_VALIDATE_BOOLEAN ) ) { // Added standard font matching check to avoid output to Google fonts call - kp // If no custom font array was supplied, the load it with default // standard fonts. if ( empty( $this->field['fonts'] ) ) { $this->field['fonts'] = $this->std_fonts; } // Ensure the fonts array is NOT empty if ( ! empty( $this->field['fonts'] ) ) { //Make the font keys in the array lowercase, for case-insensitive matching $lcFonts = array_change_key_case( $this->field['fonts'] ); // Rebuild font array with all keys stripped of spaces $arr = array(); foreach ( $lcFonts as $key => $value ) { $key = str_replace( ', ', ',', $key ); $arr[ $key ] = $value; } $lcFonts = array_change_key_case( $this->field['custom_fonts'] ); foreach ( $lcFonts as $group => $fontArr ) { foreach ( $fontArr as $key => $value ) { $arr[ strtolower( $key ) ] = $key; } } $lcFonts = $arr; unset( $arr ); // lowercase chosen font for matching purposes $lcFont = strtolower( $font['font-family'] ); // Remove spaces after commas in chosen font for mathcing purposes. $lcFont = str_replace( ', ', ',', $lcFont ); // If the lower cased passed font-family is NOT found in the standard font array // Then it's a Google font, so process it for output. if ( ! array_key_exists( $lcFont, $lcFonts ) ) { $family = $font['font-family']; // Strip out spaces in font names and replace with with plus signs // TODO?: This method doesn't respect spaces after commas, hence the reason // for the std_font array keys having no spaces after commas. This could be // fixed with RegEx in the future. $font['font-family'] = str_replace( ' ', '+', $font['font-family'] ); // Push data to parent typography variable. if ( empty( $this->parent->typography[ $font['font-family'] ] ) ) { $this->parent->typography[ $font['font-family'] ] = array(); } if ( isset( $this->field['all-styles'] ) ) { if ( ! isset( $font['font-options'] ) || empty( $font['font-options'] ) ) { $this->getGoogleArray(); if ( isset( $this->parent->googleArray ) && ! empty( $this->parent->googleArray ) && isset( $this->parent->googleArray[ $family ] ) ) { $font['font-options'] = $this->parent->googleArray[ $family ]; } } else { $font['font-options'] = json_decode( $font['font-options'], true ); } //print_r($font['font-options']); //exit(); } if ( isset( $font['font-options'] ) && ! empty( $font['font-options'] ) && isset( $this->field['all-styles'] ) && filter_var( $this->field['all-styles'], FILTER_VALIDATE_BOOLEAN ) ) { if ( isset( $font['font-options'] ) && ! empty( $font['font-options']['variants'] ) ) { if ( ! isset( $this->parent->typography[ $font['font-family'] ]['all-styles'] ) || empty( $this->parent->typography[ $font['font-family'] ]['all-styles'] ) ) { $this->parent->typography[ $font['font-family'] ]['all-styles'] = array(); foreach ( $font['font-options']['variants'] as $variant ) { $this->parent->typography[ $font['font-family'] ]['all-styles'][] = $variant['id']; } } } } if ( ! empty( $font['font-weight'] ) ) { if ( empty( $this->parent->typography[ $font['font-family'] ]['font-weight'] ) || ! in_array( $font['font-weight'], $this->parent->typography[ $font['font-family'] ]['font-weight'] ) ) { $style = $font['font-weight']; } if ( ! empty( $font['font-style'] ) ) { $style .= $font['font-style']; } if ( empty( $this->parent->typography[ $font['font-family'] ]['font-style'] ) || ! in_array( $style, $this->parent->typography[ $font['font-family'] ]['font-style'] ) ) { $this->parent->typography[ $font['font-family'] ]['font-style'][] = $style; } } if ( ! empty( $font['subsets'] ) ) { if ( empty( $this->parent->typography[ $font['font-family'] ]['subset'] ) || ! in_array( $font['subsets'], $this->parent->typography[ $font['font-family'] ]['subset'] ) ) { $this->parent->typography[ $font['font-family'] ]['subset'][] = $font['subsets']; } } } // !array_key_exists } //!empty fonts array } // Typography not set } private function localizeStdFonts() { if ( false == $this->user_fonts ) { if ( isset( $this->parent->fonts['std'] ) && ! empty( $this->parent->fonts['std'] ) ) { return; } $this->parent->font_groups['std'] = array( 'text' => __( 'Standard Fonts', 'redux-framework' ), 'children' => array(), ); foreach ( $this->field['fonts'] as $font => $extra ) { $this->parent->font_groups['std']['children'][] = array( 'id' => $font, 'text' => $font, 'data-google' => 'false', ); } } if ( $this->field['custom_fonts'] !== false ) { $this->field['custom_fonts'] = apply_filters( "redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array() ); if ( ! empty( $this->field['custom_fonts'] ) ) { foreach ( $this->field['custom_fonts'] as $group => $fonts ) { $this->parent->font_groups['customfonts'] = array( 'text' => $group, 'children' => array(), ); foreach ( $fonts as $family => $v ) { $this->parent->font_groups['customfonts']['children'][] = array( 'id' => $family, 'text' => $family, 'data-google' => 'false', ); } } } } } /** * Construct the google array from the stored JSON/HTML */ function getGoogleArray() { if ( ( isset( $this->parent->fonts['google'] ) && ! empty( $this->parent->fonts['google'] ) ) || isset( $this->parent->fonts['google'] ) && $this->parent->fonts['google'] == false ) { return; } $gFile = dirname( __FILE__ ) . '/googlefonts.php'; // Weekly update if ( isset( $this->parent->args['google_update_weekly'] ) && $this->parent->args['google_update_weekly'] && ! empty( $this->parent->args['google_api_key'] ) ) { if ( file_exists( $gFile ) ) { // Keep the fonts updated weekly $weekback = strtotime( date( 'jS F Y', time() + ( 60 * 60 * 24 * - 7 ) ) ); $last_updated = filemtime( $gFile ); if ( $last_updated < $weekback ) { unlink( $gFile ); } } } if ( ! file_exists( $gFile ) ) { $result = @wp_remote_get( apply_filters( 'redux-google-fonts-api-url', 'https://www.googleapis.com/webfonts/v1/webfonts?key=' ) . $this->parent->args['google_api_key'], array( 'sslverify' => false ) ); if ( ! is_wp_error( $result ) && $result['response']['code'] == 200 ) { $result = json_decode( $result['body'] ); foreach ( $result->items as $font ) { $this->parent->googleArray[ $font->family ] = array( 'variants' => $this->getVariants( $font->variants ), 'subsets' => $this->getSubsets( $font->subsets ) ); } if ( ! empty( $this->parent->googleArray ) ) { $this->parent->filesystem->execute( 'put_contents', $gFile, array( 'content' => "parent->googleArray ) . "', true );" ) ); } } } if ( ! file_exists( $gFile ) ) { $this->parent->fonts['google'] = false; return; } if ( ! isset( $this->parent->fonts['google'] ) || empty( $this->parent->fonts['google'] ) ) { $fonts = include $gFile; if ( $fonts === true ) { $this->parent->fonts['google'] = false; return; } if ( isset( $fonts ) && ! empty( $fonts ) && is_array( $fonts ) && $fonts != false ) { $this->parent->fonts['google'] = $fonts; $this->parent->googleArray = $fonts; // optgroup $this->parent->font_groups['google'] = array( 'text' => __( 'Google Webfonts', 'redux-framework' ), 'children' => array(), ); // options foreach ( $this->parent->fonts['google'] as $font => $extra ) { $this->parent->font_groups['google']['children'][] = array( 'id' => $font, 'text' => $font, 'data-google' => 'true' ); } } } } /** * getSubsets Function. * Clean up the Google Webfonts subsets to be human readable * * @since ReduxFramework 0.2.0 */ private function getSubsets( $var ) { $result = array(); foreach ( $var as $v ) { if ( strpos( $v, "-ext" ) ) { $name = ucfirst( str_replace( "-ext", " Extended", $v ) ); } else { $name = ucfirst( $v ); } array_push( $result, array( 'id' => $v, 'name' => $name ) ); } return array_filter( $result ); } //function /** * getVariants Function. * Clean up the Google Webfonts variants to be human readable * * @since ReduxFramework 0.2.0 */ private function getVariants( $var ) { $result = array(); $italic = array(); foreach ( $var as $v ) { $name = ""; if ( $v[0] == 1 ) { $name = 'Ultra-Light 100'; } else if ( $v[0] == 2 ) { $name = 'Light 200'; } else if ( $v[0] == 3 ) { $name = 'Book 300'; } else if ( $v[0] == 4 || $v[0] == "r" || $v[0] == "i" ) { $name = 'Normal 400'; } else if ( $v[0] == 5 ) { $name = 'Medium 500'; } else if ( $v[0] == 6 ) { $name = 'Semi-Bold 600'; } else if ( $v[0] == 7 ) { $name = 'Bold 700'; } else if ( $v[0] == 8 ) { $name = 'Extra-Bold 800'; } else if ( $v[0] == 9 ) { $name = 'Ultra-Bold 900'; } if ( $v == "regular" ) { $v = "400"; } if ( strpos( $v, "italic" ) || $v == "italic" ) { $name .= " Italic"; $name = trim( $name ); if ( $v == "italic" ) { $v = "400italic"; } $italic[] = array( 'id' => $v, 'name' => $name ); } else { $result[] = array( 'id' => $v, 'name' => $name ); } } foreach ( $italic as $item ) { $result[] = $item; } return array_filter( $result ); } //function } //class } //class exists fields/typography/field_typography.css000066600000011003152141561100014276 0ustar00.redux-main .redux-typography-container{display:block;position:relative;margin:0;padding:0;width:100%;max-width:660px}.redux-main .redux-typography-container .clearfix{clear:both}.redux-main .redux-typography-container .clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.redux-main .redux-typography-container input.wp-picker-default,.redux-main .redux-typography-container .redux-typography-color{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;height:24px;padding:0 14px !important;margin-top:0;margin-bottom:0;margin-left:4px !important;font-size:12px !important}.redux-main .redux-typography-container .select_wrapper{display:block;position:relative;float:left;clear:none;margin:0 10px 0 0;width:48% !important;min-width:210px !important;max-width:324px !important;height:57px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box}.redux-main .redux-typography-container .select_wrapper:nth-child(odd){margin-right:10px !important}.redux-main .redux-typography-container .select_wrapper:nth-child(even){margin-right:10px !important}.redux-main .redux-typography-container .select_wrapper.typography-family .select2-container{width:100%}.redux-main .redux-typography-container .select_wrapper .redux-typography{font-size:14px !important;display:block;float:left;height:28px !important;line-height:50px !important;padding:0 !important;width:100% !important;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box}.redux-main .redux-typography-container .wp-picker-container{float:left;clear:left;margin-bottom:12px;padding:3px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.redux-main .redux-typography-container .input_wrapper{display:block;position:relative;margin:0 4px 0 5px;padding:0;width:23%;max-width:23%;min-width:70px;float:left;clear:none;height:57px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;vertical-align:baseline}.redux-main .redux-typography-container .input_wrapper.font-size{margin-left:0}.redux-main .redux-typography-container .input_wrapper input.mini{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;width:78%;text-align:center;margin:0;height:28px;top:3px;padding:0 2px 0 5px;text-decoration:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.redux-main .redux-typography-container .picker-wrapper{display:block;display:block;position:relative;margin:0 4px 0 5px;margin:0;padding:0;width:23%;width:100%;max-width:23%;min-width:70px;min-width:100%;clear:none;height:57px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;vertical-align:baseline}.redux-main .redux-typography-container label{display:block;position:relative;font-size:12px !important;text-align:left;color:#999;margin:4px 0 2px 0 !important;cursor:default}.redux-main .redux-typography-container .typography-preview{display:none;width:100%;border:1px dotted lightgray;max-width:850px;padding:10px;font-size:10pt;height:auto;margin:5px 0 10px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.redux-main .redux-typography-container .typography-color{border:0 none;margin:0}.redux-main .redux-typography-container ::-webkit-input-placeholder{line-height:19px}@media screen and (max-width:540px){.redux-main .redux-main .redux-typography-container{max-width:230px;margin:0 auto}.redux-main .redux-main .redux-typography-container .select_wrapper{max-width:210px;min-width:210px;width:210px;margin-left:0 !important;margin-right:0 !important}.redux-main .redux-main .redux-typography-container .input_wrapper{max-width:101px;min-width:101px;width:101px;margin-left:0 !important;margin-right:5px !important}.redux-main .redux-main .redux-typography-container .input_wrapper input.mini{width:73%}.redux-main .redux-main .redux-typography-container .input-append .add-on{width:30%;padding:5px !important}.redux-main .redux-main .redux-main .wp-picker-container .wp-picker-input-wrap{margin-top:7px}}@media screen and (max-width:360px){.redux-main .redux-typography-container .iris-picker .iris-square{margin-right:3%}}.wp-customizer .redux-typography-container .input_wrapper{width:40%;max-width:40%;min-width:20%}.wp-customizer .redux-typography-container .input_wrapper input.mini{width:70%}.wp-customizer .redux-typography-container .select_wrapper{width:100% !important}fields/typography/field_typography.js000066600000067756152141561100014154 0ustar00/*global redux_change, redux*/ /** * Typography * Dependencies: google.com, jquery, select2 * Feature added by: Dovy Paukstys - http://simplerain.com/ * Date: 06.14.2013 * * Rewrite: Kevin Provance (kprovance) * Date: May 25, 2014 */ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.typography = redux.field_objects.typography || {}; var selVals = []; var isSelecting = false; var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; redux.field_objects.typography.init = function( selector, skipCheck ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-typography:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } var fontClear; el.each( function() { // init each typography field $( this ).find( '.redux-typography-container' ).each( function() { var family = $( this ).find( '.redux-typography-family' ); if ( family.data( 'value' ) === undefined ) { family = $( this ); } else if ( family.data( 'value' ) !== "" ) { $( family ).val( family.data( 'value' ) ); } var select2_handle = $( this ).find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } fontClear = Boolean( $( this ).find( '.redux-font-clear' ).val() ); redux.field_objects.typography.select( family, true ); window.onbeforeunload = null; } ); //init when value is changed $( this ).find( '.redux-typography' ).on( 'change', function() { redux.field_objects.typography.select( $( this ) ); //.parents('.redux-container-typography:first')); } ); //init when value is changed $( this ).find( '.redux-typography-size, .redux-typography-height, .redux-typography-word, .redux-typography-letter, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration' ).keyup( function() { redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } ); // Have to redeclare the wpColorPicker to get a callback function $( this ).find( '.redux-typography-color' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux.field_objects.typography.select( $( this ) ); } } ); // Don't allow negative numbers for size field $( this ).find( ".redux-typography-size" ).numeric( { allowMinus: false } ); // Allow negative numbers for indicated fields $( this ).find( ".redux-typography-height, .redux-typography-word, .redux-typography-letter" ).numeric( { allowMinus: true } ); // select2 magic, to load font-family dynamically var data = [{id: 'none', text: 'none'}]; $( this ).find( ".redux-typography-family" ).select2( { matcher: function( term, text ) { return text.toUpperCase().indexOf( term.toUpperCase() ) === 0; }, query: function( query ) { return window.Select2.query.local( data )( query ); }, initSelection: function( element, callback ) { var data = {id: element.val(), text: element.val()}; callback( data ); }, allowClear: fontClear, // when one clicks on the font-family select box } ).on( "select2-opening", function( e ) { // Get field ID var thisID = $( this ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); // User included fonts? var isUserFonts = $( '#' + thisID + ' .redux-typography-font-family' ).data( 'user-fonts' ); isUserFonts = isUserFonts ? 1 : 0; // Google font isn use? var usingGoogleFonts = $( '#' + thisID + ' .redux-typography-google' ).val(); usingGoogleFonts = usingGoogleFonts ? 1 : 0; // Set up data array var buildData = []; // If custom fonts, push onto array if ( redux.customfonts !== undefined ) { buildData.push( redux.customfonts ); } // If standard fonts, push onto array if ( redux.stdfonts !== undefined && isUserFonts === 0 ) { buildData.push( redux.stdfonts ); } // If user fonts, pull from localize and push into array if ( isUserFonts == 1 ) { var fontKids = []; // var fontData = { text: 'Standard Fonts', children: fontKids }; buildData.push( fontData ); } // If googfonts on and had data, push into array if ( usingGoogleFonts == 1 || usingGoogleFonts === true && redux.googlefonts !== undefined ) { buildData.push( redux.googlefonts ); } // output data to drop down data = buildData; // get placeholder var selFamily = $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'placeholder' ); if ( !selFamily ) { selFamily = null; } // select current font $( '#' + thisID + " .redux-typography-family" ).select2( 'val', selFamily ); // When selection is made. } ).on( 'select2-selecting', function( val, object ) { var fontName = val.object.text; var thisID = $( this ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); $( '#' + thisID + ' #' + thisID + '-family' ).data( 'value', fontName ); $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'placeholder', fontName ); // option values selVals = val; isSelecting = true; redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } ).on( 'select2-clearing', function( val, choice ) { var thisID = $( this ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'data-value', '' ); $( '#' + thisID + ' #' + thisID + '-family' ).attr( 'placeholder', 'Font Family' ); $( '#' + thisID + ' #' + thisID + '-google-font' ).val( 'false' ); redux.field_objects.typography.select( $( this ).parents( '.redux-container-typography:first' ) ); } ); var xx = el.find( ".redux-typography-family" ); if ( !xx.hasClass( 'redux-typography-family' ) ) { el.find( ".redux-typography-style" ).select2( default_params ); } // Init select2 for indicated fields el.find( ".redux-typography-family-backup, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration" ).select2( default_params ); } ); } ); }; // Return font size redux.field_objects.typography.size = function( obj ) { var size = 0, key; for ( key in obj ) { if ( obj.hasOwnProperty( key ) ) { size++; } } return size; }; // Return proper bool value redux.field_objects.typography.makeBool = function( val ) { if ( val == 'false' || val == '0' || val === false || val === 0 ) { return false; } else if ( val == 'true' || val == '1' || val === true || val == 1 ) { return true; } }; redux.field_objects.typography.contrastColour = function( hexcolour ) { // default value is black. var retVal = '#444444'; // In case - for some reason - a blank value is passed. // This should *not* happen. If a function passing a value // is canceled, it should pass the current value instead of // a blank. This is how the Windows Common Controls do it. :P if ( hexcolour !== '' ) { // Replace the hash with a blank. hexcolour = hexcolour.replace( '#', '' ); var r = parseInt( hexcolour.substr( 0, 2 ), 16 ); var g = parseInt( hexcolour.substr( 2, 2 ), 16 ); var b = parseInt( hexcolour.substr( 4, 2 ), 16 ); var res = ((r * 299) + (g * 587) + (b * 114)) / 1000; // Instead of pure black, I opted to use WP 3.8 black, so it looks uniform. :) - kp retVal = (res >= 128) ? '#444444' : '#ffffff'; } return retVal; }; // Sync up font options redux.field_objects.typography.select = function( selector, skipCheck ) { var mainID; // Main id for selected field mainID = $( selector ).parents( '.redux-container-typography:first' ).attr( 'data-id' ); if ( mainID === undefined ) { mainID = $( selector ).attr( 'data-id' ); } var parent = $( selector ).parents( '.redux-container-typography:first' ); var data = []; //$.each(parent.find('.redux-typography-field'), function() { // console.log(); //}); //console.log( selector ); // Set all the variables to be checked against var family = $( '#' + mainID + ' #' + mainID + '-family' ).val(); if ( !family ) { family = null; //"inherit"; } var familyBackup = $( '#' + mainID + ' select.redux-typography-family-backup' ).val(); var size = $( '#' + mainID + ' .redux-typography-size' ).val(); var height = $( '#' + mainID + ' .redux-typography-height' ).val(); var word = $( '#' + mainID + ' .redux-typography-word' ).val(); var letter = $( '#' + mainID + ' .redux-typography-letter' ).val(); var align = $( '#' + mainID + ' select.redux-typography-align' ).val(); var transform = $( '#' + mainID + ' select.redux-typography-transform' ).val(); var fontVariant = $( '#' + mainID + ' select.redux-typography-font-variant' ).val(); var decoration = $( '#' + mainID + ' select.redux-typography-decoration' ).val(); var style = $( '#' + mainID + ' select.redux-typography-style' ).val(); var script = $( '#' + mainID + ' select.redux-typography-subsets' ).val(); var color = $( '#' + mainID + ' .redux-typography-color' ).val(); var units = $( '#' + mainID ).data( 'units' ); //console.log('here3'); //console.log(color); //var output = family; // Is selected font a google font? var google; if ( isSelecting === true ) { google = redux.field_objects.typography.makeBool( selVals.object['data-google'] ); $( '#' + mainID + ' .redux-typography-google-font' ).val( google ); } else { google = redux.field_objects.typography.makeBool( $( '#' + mainID + ' .redux-typography-google-font' ).val() ); // Check if font is a google font } // Page load. Speeds things up memory wise to offload to client if ( !$( '#' + mainID ).hasClass( 'typography-initialized' ) ) { style = $( '#' + mainID + ' select.redux-typography-style' ).data( 'value' ); script = $( '#' + mainID + ' select.redux-typography-subsets' ).data( 'value' ); if ( style !== "" ) { style = String( style ); } if ( typeof (script) !== undefined ) { script = String( script ); } } // Something went wrong trying to read google fonts, so turn google off if ( redux.fonts.google === undefined ) { google = false; } // Get font details var details = ''; if ( google === true && ( family in redux.fonts.google) ) { details = redux.fonts.google[family]; } else { details = { '400': 'Normal 400', '700': 'Bold 700', '400italic': 'Normal 400 Italic', '700italic': 'Bold 700 Italic' }; } if ( $( selector ).hasClass( 'redux-typography-subsets' ) ) { $( '#' + mainID + ' input.typography-subsets' ).val( script ); } // If we changed the font if ( $( selector ).hasClass( 'redux-typography-family' ) ) { var html = ''; // Google specific stuff if ( google === true ) { // STYLES var selected = ""; $.each( details.variants, function( index, variant ) { if ( variant.id === style || redux.field_objects.typography.size( details.variants ) === 1 ) { selected = ' selected="selected"'; style = variant.id; } else { selected = ""; } html += ''; } ); // destroy select2 $( '#' + mainID + ' .redux-typography-style' ).select2( "destroy" ); // Instert new HTML $( '#' + mainID + ' .redux-typography-style' ).html( html ); // Init select2 $( '#' + mainID + ' .redux-typography-style' ).select2( default_params ); // SUBSETS selected = ""; html = ''; $.each( details.subsets, function( index, subset ) { if ( subset.id === script || redux.field_objects.typography.size( details.subsets ) === 1 ) { selected = ' selected="selected"'; script = subset.id; $( '#' + mainID + ' input.typography-subsets' ).val( script ); } else { selected = ""; } html += ''; } ); //if (typeof (familyBackup) !== "undefined" && familyBackup !== "") { // output += ', ' + familyBackup; //} // Destroy select2 $( '#' + mainID + ' .redux-typography-subsets' ).select2( "destroy" ); // Inset new HTML $( '#' + mainID + ' .redux-typography-subsets' ).html( html ); // Init select2 $( '#' + mainID + ' .redux-typography-subsets' ).select2( default_params ); $( '#' + mainID + ' .redux-typography-subsets' ).parent().fadeIn( 'fast' ); $( '#' + mainID + ' .typography-family-backup' ).fadeIn( 'fast' ); } else { if ( details ) { $.each( details, function( index, value ) { if ( index === style || index === "normal" ) { selected = ' selected="selected"'; $( '#' + mainID + ' .typography-style .select2-chosen' ).text( value ); } else { selected = ""; } html += ''; } ); // Destory select2 $( '#' + mainID + ' .redux-typography-style' ).select2( "destroy" ); // Insert new HTML $( '#' + mainID + ' .redux-typography-style' ).html( html ); // Init select2 $( '#' + mainID + ' .redux-typography-style' ).select2( default_params ); // Prettify things $( '#' + mainID + ' .redux-typography-subsets' ).parent().fadeOut( 'fast' ); $( '#' + mainID + ' .typography-family-backup' ).fadeOut( 'fast' ); } } $( '#' + mainID + ' .redux-typography-font-family' ).val( family ); } else if ( $( selector ).hasClass( 'redux-typography-family-backup' ) && familyBackup !== "" ) { $( '#' + mainID + ' .redux-typography-font-family-backup' ).val( familyBackup ); } // Check if the selected value exists. If not, empty it. Else, apply it. if ( $( '#' + mainID + " select.redux-typography-style option[value='" + style + "']" ).length === 0 ) { style = ""; $( '#' + mainID + ' select.redux-typography-style' ).select2( 'val', '' ); } else if ( style === "400" ) { $( '#' + mainID + ' select.redux-typography-style' ).select2( 'val', style ); } // Handle empty subset select if ( $( '#' + mainID + " select.redux-typography-subsets option[value='" + script + "']" ).length === 0 ) { script = ""; $( '#' + mainID + ' select.redux-typography-subsets' ).select2( 'val', '' ); $( '#' + mainID + ' input.typography-subsets' ).val( script ); } var _linkclass = 'style_link_' + mainID; //remove other elements crested in $( '.' + _linkclass ).remove(); if ( family !== null && family !== "inherit" && $( '#' + mainID ).hasClass( 'typography-initialized' ) ) { //replace spaces with "+" sign var the_font = family.replace( /\s+/g, '+' ); if ( google === true ) { //add reference to google font family var link = the_font; if ( style && style !== "" ) { link += ':' + style.replace( /\-/g, " " ); } if ( script && script !== "" ) { link += '&subset=' + script; } if ( isSelecting === false ) { if ( typeof (WebFont) !== "undefined" && WebFont ) { WebFont.load( {google: {families: [link]}} ); } } $( '#' + mainID + ' .redux-typography-google' ).val( true ); } else { $( '#' + mainID + ' .redux-typography-google' ).val( false ); } } // Weight and italic if ( style.indexOf( "italic" ) !== -1 ) { $( '#' + mainID + ' .typography-preview' ).css( 'font-style', 'italic' ); $( '#' + mainID + ' .typography-font-style' ).val( 'italic' ); style = style.replace( 'italic', '' ); } else { $( '#' + mainID + ' .typography-preview' ).css( 'font-style', "normal" ); $( '#' + mainID + ' .typography-font-style' ).val( '' ); } $( '#' + mainID + ' .typography-font-weight' ).val( style ); if ( !height ) { height = size; } if ( size === '' || size === undefined ) { $( '#' + mainID + ' .typography-font-size' ).val( '' ); } else { $( '#' + mainID + ' .typography-font-size' ).val( size + units ); } if ( height === '' || height === undefined ) { $( '#' + mainID + ' .typography-line-height' ).val( '' ); } else { $( '#' + mainID + ' .typography-line-height' ).val( height + units ); } if ( word === '' || word === undefined ) { $( '#' + mainID + ' .typography-word-spacing' ).val( '' ); } else { $( '#' + mainID + ' .typography-word-spacing' ).val( word + units ); } if ( letter === '' || letter === undefined ) { $( '#' + mainID + ' .typography-letter-spacing' ).val( '' ); } else { $( '#' + mainID + ' .typography-letter-spacing' ).val( letter + units ); } // Show more preview stuff if ( $( '#' + mainID ).hasClass( 'typography-initialized' ) ) { //console.log('here2'); var isPreviewSize = $( '#' + mainID + ' .typography-preview' ).data( 'preview-size' ); if ( isPreviewSize == '0' ) { $( '#' + mainID + ' .typography-preview' ).css( 'font-size', size + units ); } $( '#' + mainID + ' .typography-preview' ).css( 'font-weight', style ); //show in the preview box the font $( '#' + mainID + ' .typography-preview' ).css( 'font-family', family + ', sans-serif' ); if ( family === 'none' && family === '' ) { //if selected is not a font remove style "font-family" at preview box $( '#' + mainID + ' .typography-preview' ).css( 'font-family', 'inherit' ); } $( '#' + mainID + ' .typography-preview' ).css( 'line-height', height + units ); $( '#' + mainID + ' .typography-preview' ).css( 'word-spacing', word + units ); $( '#' + mainID + ' .typography-preview' ).css( 'letter-spacing', letter + units ); if ( color ) { $( '#' + mainID + ' .typography-preview' ).css( 'color', color ); $( '#' + mainID + ' .typography-preview' ).css( 'background-color', redux.field_objects.typography.contrastColour( color ) ); } $( '#' + mainID + ' .typography-style .select2-chosen' ).text( $( '#' + mainID + ' .redux-typography-style option:selected' ).text() ); $( '#' + mainID + ' .typography-script .select2-chosen' ).text( $( '#' + mainID + ' .redux-typography-subsets option:selected' ).text() ); if ( align ) { $( '#' + mainID + ' .typography-preview' ).css( 'text-align', align ); } if ( transform ) { $( '#' + mainID + ' .typography-preview' ).css( 'text-transform', transform ); } if ( fontVariant ) { $( '#' + mainID + ' .typography-preview' ).css( 'font-variant', fontVariant ); } if ( decoration ) { $( '#' + mainID + ' .typography-preview' ).css( 'text-decoration', decoration ); } $( '#' + mainID + ' .typography-preview' ).slideDown(); } // end preview stuff // if not preview showing, then set preview to show if ( !$( '#' + mainID ).hasClass( 'typography-initialized' ) ) { $( '#' + mainID ).addClass( 'typography-initialized' ); } isSelecting = false; if ( !skipCheck ) { redux_change( selector ); } }; })( jQuery );fields/typography/field_typography.min.js000066600000025176152141561100014724 0ustar00(function(c){redux.field_objects=redux.field_objects||{};redux.field_objects.typography=redux.field_objects.typography||{};var d=[];var a=false;var b={width:"resolve",triggerChange:true,allowClear:true};redux.field_objects.typography.init=function(e,f){if(!e){e=c(document).find(".redux-group-tab:visible").find(".redux-container-typography:visible")}c(e).each(function(){var i=c(this);var h=i;if(!i.hasClass("redux-field-container")){h=i.parents(".redux-field-container:first")}if(h.is(":hidden")){return}if(h.hasClass("redux-field-init")){h.removeClass("redux-field-init")}else{return}var g;i.each(function(){c(this).find(".redux-typography-container").each(function(){var n=c(this).find(".redux-typography-family");if(n.data("value")===undefined){n=c(this)}else{if(n.data("value")!==""){c(n).val(n.data("value"))}}var l=c(this).find(".select2_params");if(l.size()>0){var m=l.val();m=JSON.parse(m);b=c.extend({},b,m)}g=Boolean(c(this).find(".redux-font-clear").val());redux.field_objects.typography.select(n,true);window.onbeforeunload=null});c(this).find(".redux-typography").on("change",function(){redux.field_objects.typography.select(c(this))});c(this).find(".redux-typography-size, .redux-typography-height, .redux-typography-word, .redux-typography-letter, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration").keyup(function(){redux.field_objects.typography.select(c(this).parents(".redux-container-typography:first"))});c(this).find(".redux-typography-color").wpColorPicker({change:function(m,l){c(this).val(l.color.toString());redux.field_objects.typography.select(c(this))}});c(this).find(".redux-typography-size").numeric({allowMinus:false});c(this).find(".redux-typography-height, .redux-typography-word, .redux-typography-letter").numeric({allowMinus:true});var j=[{id:"none",text:"none"}];c(this).find(".redux-typography-family").select2({matcher:function(l,m){return m.toUpperCase().indexOf(l.toUpperCase())===0},query:function(l){return window.Select2.query.local(j)(l)},initSelection:function(l,n){var m={id:l.val(),text:l.val()};n(m)},allowClear:g}).on("select2-opening",function(r){var u=c(this).parents(".redux-container-typography:first").attr("data-id");var n=c("#"+u+" .redux-typography-font-family").data("user-fonts");n=n?1:0;var o=c("#"+u+" .redux-typography-google").val();o=o?1:0;var s=[];if(redux.customfonts!==undefined){s.push(redux.customfonts)}if(redux.stdfonts!==undefined&&n===0){s.push(redux.stdfonts)}if(n==1){var m=[];for(var v in redux.typography[u]){var q=redux.typography[u].std_font;for(var l in q){if(q.hasOwnProperty(l)){m.push({id:l,text:l,"data-google":"false"})}}}var p={text:"Standard Fonts",children:m};s.push(p)}if(o==1||o===true&&redux.googlefonts!==undefined){s.push(redux.googlefonts)}j=s;var t=c("#"+u+" #"+u+"-family").attr("placeholder");if(!t){t=null}c("#"+u+" .redux-typography-family").select2("val",t)}).on("select2-selecting",function(n,l){var m=n.object.text;var o=c(this).parents(".redux-container-typography:first").attr("data-id");c("#"+o+" #"+o+"-family").data("value",m);c("#"+o+" #"+o+"-family").attr("placeholder",m);d=n;a=true;redux.field_objects.typography.select(c(this).parents(".redux-container-typography:first"))}).on("select2-clearing",function(m,l){var n=c(this).parents(".redux-container-typography:first").attr("data-id");c("#"+n+" #"+n+"-family").attr("data-value","");c("#"+n+" #"+n+"-family").attr("placeholder","Font Family");c("#"+n+" #"+n+"-google-font").val("false");redux.field_objects.typography.select(c(this).parents(".redux-container-typography:first"))});var k=i.find(".redux-typography-family");if(!k.hasClass("redux-typography-family")){i.find(".redux-typography-style").select2(b)}i.find(".redux-typography-family-backup, .redux-typography-align, .redux-typography-transform, .redux-typography-font-variant, .redux-typography-decoration").select2(b)})})};redux.field_objects.typography.size=function(g){var f=0,e;for(e in g){if(g.hasOwnProperty(e)){f++}}return f};redux.field_objects.typography.makeBool=function(e){if(e=="false"||e=="0"||e===false||e===0){return false}else{if(e=="true"||e=="1"||e===true||e==1){return true}}};redux.field_objects.typography.contrastColour=function(j){var k="#444444";if(j!==""){j=j.replace("#","");var i=parseInt(j.substr(0,2),16);var h=parseInt(j.substr(2,2),16);var e=parseInt(j.substr(4,2),16);var f=((i*299)+(h*587)+(e*114))/1000;k=(f>=128)?"#444444":"#ffffff"}return k};redux.field_objects.typography.select=function(w,k){var e;e=c(w).parents(".redux-container-typography:first").attr("data-id");if(e===undefined){e=c(w).attr("data-id")}var m=c(w).parents(".redux-container-typography:first");var E=[];var B=c("#"+e+" #"+e+"-family").val();if(!B){B=null}var f=c("#"+e+" select.redux-typography-family-backup").val();var q=c("#"+e+" .redux-typography-size").val();var r=c("#"+e+" .redux-typography-height").val();var z=c("#"+e+" .redux-typography-word").val();var D=c("#"+e+" .redux-typography-letter").val();var v=c("#"+e+" select.redux-typography-align").val();var p=c("#"+e+" select.redux-typography-transform").val();var i=c("#"+e+" select.redux-typography-font-variant").val();var l=c("#"+e+" select.redux-typography-decoration").val();var y=c("#"+e+" select.redux-typography-style").val();var C=c("#"+e+" select.redux-typography-subsets").val();var u=c("#"+e+" .redux-typography-color").val();var t=c("#"+e).data("units");var g;if(a===true){g=redux.field_objects.typography.makeBool(d.object["data-google"]);c("#"+e+" .redux-typography-google-font").val(g)}else{g=redux.field_objects.typography.makeBool(c("#"+e+" .redux-typography-google-font").val())}if(!c("#"+e).hasClass("typography-initialized")){y=c("#"+e+" select.redux-typography-style").data("value");C=c("#"+e+" select.redux-typography-subsets").data("value");if(y!==""){y=String(y)}if(typeof(C)!==undefined){C=String(C)}}if(redux.fonts.google===undefined){g=false}var A="";if(g===true&&(B in redux.fonts.google)){A=redux.fonts.google[B]}else{A={"400":"Normal 400","700":"Bold 700","400italic":"Normal 400 Italic","700italic":"Bold 700 Italic"}}if(c(w).hasClass("redux-typography-subsets")){c("#"+e+" input.typography-subsets").val(C)}if(c(w).hasClass("redux-typography-family")){var o='';if(g===true){var s="";c.each(A.variants,function(F,G){if(G.id===y||redux.field_objects.typography.size(A.variants)===1){s=' selected="selected"';y=G.id}else{s=""}o+='"});c("#"+e+" .redux-typography-style").select2("destroy");c("#"+e+" .redux-typography-style").html(o);c("#"+e+" .redux-typography-style").select2(b);s="";o='';c.each(A.subsets,function(F,G){if(G.id===C||redux.field_objects.typography.size(A.subsets)===1){s=' selected="selected"';C=G.id;c("#"+e+" input.typography-subsets").val(C)}else{s=""}o+='"});c("#"+e+" .redux-typography-subsets").select2("destroy");c("#"+e+" .redux-typography-subsets").html(o);c("#"+e+" .redux-typography-subsets").select2(b);c("#"+e+" .redux-typography-subsets").parent().fadeIn("fast");c("#"+e+" .typography-family-backup").fadeIn("fast")}else{if(A){c.each(A,function(F,G){if(F===y||F==="normal"){s=' selected="selected"';c("#"+e+" .typography-style .select2-chosen").text(G)}else{s=""}o+='"});c("#"+e+" .redux-typography-style").select2("destroy");c("#"+e+" .redux-typography-style").html(o);c("#"+e+" .redux-typography-style").select2(b);c("#"+e+" .redux-typography-subsets").parent().fadeOut("fast");c("#"+e+" .typography-family-backup").fadeOut("fast")}}c("#"+e+" .redux-typography-font-family").val(B)}else{if(c(w).hasClass("redux-typography-family-backup")&&f!==""){c("#"+e+" .redux-typography-font-family-backup").val(f)}}if(c("#"+e+" select.redux-typography-style option[value='"+y+"']").length===0){y="";c("#"+e+" select.redux-typography-style").select2("val","")}else{if(y==="400"){c("#"+e+" select.redux-typography-style").select2("val",y)}}if(c("#"+e+" select.redux-typography-subsets option[value='"+C+"']").length===0){C="";c("#"+e+" select.redux-typography-subsets").select2("val","");c("#"+e+" input.typography-subsets").val(C)}var x="style_link_"+e;c("."+x).remove();if(B!==null&&B!=="inherit"&&c("#"+e).hasClass("typography-initialized")){var h=B.replace(/\s+/g,"+");if(g===true){var j=h;if(y&&y!==""){j+=":"+y.replace(/\-/g," ")}if(C&&C!==""){j+="&subset="+C}if(a===false){if(typeof(WebFont)!=="undefined"&&WebFont){WebFont.load({google:{families:[j]}})}}c("#"+e+" .redux-typography-google").val(true)}else{c("#"+e+" .redux-typography-google").val(false)}}if(y.indexOf("italic")!==-1){c("#"+e+" .typography-preview").css("font-style","italic");c("#"+e+" .typography-font-style").val("italic");y=y.replace("italic","")}else{c("#"+e+" .typography-preview").css("font-style","normal");c("#"+e+" .typography-font-style").val("")}c("#"+e+" .typography-font-weight").val(y);if(!r){r=q}if(q===""||q===undefined){c("#"+e+" .typography-font-size").val("")}else{c("#"+e+" .typography-font-size").val(q+t)}if(r===""||r===undefined){c("#"+e+" .typography-line-height").val("")}else{c("#"+e+" .typography-line-height").val(r+t)}if(z===""||z===undefined){c("#"+e+" .typography-word-spacing").val("")}else{c("#"+e+" .typography-word-spacing").val(z+t)}if(D===""||D===undefined){c("#"+e+" .typography-letter-spacing").val("")}else{c("#"+e+" .typography-letter-spacing").val(D+t)}if(c("#"+e).hasClass("typography-initialized")){var n=c("#"+e+" .typography-preview").data("preview-size");if(n=="0"){c("#"+e+" .typography-preview").css("font-size",q+t)}c("#"+e+" .typography-preview").css("font-weight",y);c("#"+e+" .typography-preview").css("font-family",B+", sans-serif");if(B==="none"&&B===""){c("#"+e+" .typography-preview").css("font-family","inherit")}c("#"+e+" .typography-preview").css("line-height",r+t);c("#"+e+" .typography-preview").css("word-spacing",z+t);c("#"+e+" .typography-preview").css("letter-spacing",D+t);if(u){c("#"+e+" .typography-preview").css("color",u);c("#"+e+" .typography-preview").css("background-color",redux.field_objects.typography.contrastColour(u))}c("#"+e+" .typography-style .select2-chosen").text(c("#"+e+" .redux-typography-style option:selected").text());c("#"+e+" .typography-script .select2-chosen").text(c("#"+e+" .redux-typography-subsets option:selected").text());if(v){c("#"+e+" .typography-preview").css("text-align",v)}if(p){c("#"+e+" .typography-preview").css("text-transform",p)}if(i){c("#"+e+" .typography-preview").css("font-variant",i)}if(l){c("#"+e+" .typography-preview").css("text-decoration",l)}c("#"+e+" .typography-preview").slideDown()}if(!c("#"+e).hasClass("typography-initialized")){c("#"+e).addClass("typography-initialized")}a=false;if(!k){redux_change(w)}}})(jQuery);fields/color/field_color.php000066600000011176152141561100012130 0ustar00. * * @package ReduxFramework * @subpackage Field_Color * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_color' ) ) { /** * Main ReduxFramework_color class * * @since 1.0.0 */ class ReduxFramework_color { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { echo ''; echo ''; if ( ! isset( $this->field['transparent'] ) || $this->field['transparent'] !== false ) { $tChecked = ""; if ( $this->value == "transparent" ) { $tChecked = ' checked="checked"'; } echo ''; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-color-picker-css' ); } wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'redux-field-color-js', ReduxFramework::$_url . 'inc/fields/color/field_color' . Redux_Functions::isMin() . '.js', array( 'jquery', 'wp-color-picker', 'redux-js' ), time(), true ); } public function output() { $style = ''; if ( ! empty( $this->value ) ) { $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'color' ); $style .= $mode . ':' . $this->value . ';'; if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $css = Redux_Functions::parseCSS( $this->field['output'], $style, $this->value ); $this->parent->outputCSS .= $css; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $css = Redux_Functions::parseCSS( $this->field['compiler'], $style, $this->value ); $this->parent->compilerCSS .= $css; } } } } } fields/color/field_color.min.js000066600000004467152141561100012544 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.color=redux.field_objects.color||{},a(document).ready(function(){}),redux.field_objects.color.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-color:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".redux-color-init").wpColorPicker({change:function(c,d){a(this).val(d.color.toString()),redux_change(a(this)),b.find("#"+c.target.getAttribute("data-id")+"-transparency").removeAttr("checked")},clear:function(b,c){a(this).val(""),redux_change(a(this).parent().find(".redux-color-init"))}}),b.find(".redux-color").on("focus",function(){a(this).data("oldcolor",a(this).val())}),b.find(".redux-color").on("keyup",function(){var c=a(this).val(),d=colorValidate(this),e="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(e+"-transparency").attr("checked","checked")):(b.find(e+"-transparency").removeAttr("checked"),d&&d!==a(this).val()&&a(this).val(d))}),b.find(".redux-color").on("blur",function(){var c=a(this).val(),d="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(d+"-transparency").attr("checked","checked")):(colorValidate(this)===c&&0!==c.indexOf("#")&&a(this).val(a(this).data("oldcolor")),b.find(d+"-transparency").removeAttr("checked"))}),b.find(".redux-color").on("keydown",function(){a(this).data("oldkeypress",a(this).val())}),b.find(".color-transparency").on("click",function(){if(a(this).is(":checked"))b.find(".redux-saved-color").val(a("#"+a(this).data("id")).val()),b.find("#"+a(this).data("id")).val("transparent"),b.find("#"+a(this).data("id")).parent().parent().find(".wp-color-result").css("background-color","transparent");else if("transparent"===b.find("#"+a(this).data("id")).val()){var c=a(".redux-saved-color").val();""===c&&(c=a("#"+a(this).data("id")).data("default-color")),b.find("#"+a(this).data("id")).parent().parent().find(".wp-color-result").css("background-color",c),b.find("#"+a(this).data("id")).val(c)}redux_change(a(this))}))})}}(jQuery);fields/color/field_color.js000066600000017146152141561100011760 0ustar00/* Field Color (color) */ /*global jQuery, document, redux_change, redux*/ (function( $ ) { 'use strict'; redux.field_objects = redux.field_objects || {}; redux.field_objects.color = redux.field_objects.color || {}; $( document ).ready( function() { } ); redux.field_objects.color.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-color:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } // var $control = el.find( '.redux-color-init' ), // // value = $control.val().replace( /\s+/g, '' ), // alpha_val = 100, // $alpha, $alpha_output; // //console.log($control); // if ( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ ) ) { // alpha_val = parseFloat( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ )[ 1 ] ) * 100; // } el.find( '.redux-color-init' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ) ); el.find( '#' + e.target.getAttribute( 'data-id' ) + '-transparency' ).removeAttr( 'checked' ); }, clear: function( e, ui ) { $( this ).val( '' ); redux_change( $( this ).parent().find( '.redux-color-init' ) ); } } ); // $( '
    ' // + '' // + '' // + '
    ' ).appendTo( $control.parents( '.wp-picker-container:first' ).addClass( 'vc_color-picker' ).find( '.iris-picker' ) ); // $alpha = $control.parents( '.wp-picker-container:first' ).find( '.vc_alpha-field' ); // //console.log($alpha); // $alpha_output = $control.parents( '.wp-picker-container:first' ).find( '.redux-alpha-container output' ); // $alpha.bind( 'change keyup', function () { // var alpha_val = parseFloat( $alpha.val() ), // iris = $control.data( 'a8cIris' ), // color_picker = $control.data( 'wp-wpColorPicker' ); // //console.log(alpha_val); // $alpha_output.val( $alpha.val() + '%' ); // console.log(alpha_val / 100.0); // iris._color._alpha = parseFloat(alpha_val / 100.0); // console.log(iris._color); // //$control.val( iris._color.toString() ); // el.find( '.redux-color-init' ).wpColorPicker( 'color', iris._color.toString() ); // //console.log($control.val()); // //color_picker.toggler.css( { backgroundColor: $control.val() } ); // } ).val( alpha_val ).trigger( 'change' ); el.find( '.redux-color' ).on( 'focus', function() { $( this ).data( 'oldcolor', $( this ).val() ); } ); el.find( '.redux-color' ).on( 'keyup', function() { var value = $( this ).val(); var color = colorValidate( this ); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { el.find( id + '-transparency' ).removeAttr( 'checked' ); if ( color && color !== $( this ).val() ) { $( this ).val( color ); } } } ); // Replace and validate field on blur el.find( '.redux-color' ).on( 'blur', function() { var value = $( this ).val(); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { if ( colorValidate( this ) === value ) { if ( value.indexOf( "#" ) !== 0 ) { $( this ).val( $( this ).data( 'oldcolor' ) ); } } el.find( id + '-transparency' ).removeAttr( 'checked' ); } } ); // Store the old valid color on keydown el.find( '.redux-color' ).on( 'keydown', function() { $( this ).data( 'oldkeypress', $( this ).val() ); } ); // When transparency checkbox is clicked el.find( '.color-transparency' ).on( 'click', function() { if ( $( this ).is( ":checked" ) ) { el.find( '.redux-saved-color' ).val( $( '#' + $( this ).data( 'id' ) ).val() ); el.find( '#' + $( this ).data( 'id' ) ).val( 'transparent' ); el.find( '#' + $( this ).data( 'id' ) ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); } else { if ( el.find( '#' + $( this ).data( 'id' ) ).val() === 'transparent' ) { var prevColor = $( '.redux-saved-color' ).val(); if ( prevColor === '' ) { prevColor = $( '#' + $( this ).data( 'id' ) ).data( 'default-color' ); } el.find( '#' + $( this ).data( 'id' ) ).parent().parent().find( '.wp-color-result' ).css( 'background-color', prevColor ); el.find( '#' + $( this ).data( 'id' ) ).val( prevColor ); } } redux_change( $( this ) ); } ); } ); }; })( jQuery );fields/info/field_info.css.map000066600000003240152141561100012330 0ustar00{ "version": 3, "mappings": "AAAA,iBAAkB;EACd,UAAU,EAAE,IAAI;EAChB,OAAO,EAAE,QAAQ;EACjB,MAAM,EAAE,MAAM;EACd,MAAM,EAAE,SAAS;EACjB,aAAa,EAAE,GAAG;EAClB,MAAM,EAAE,SAAS;EACjB,QAAQ,EAAE,QAAQ;EAElB;;;;;sBAKG;IACC,aAAa,EAAE,YAAY;EAG/B,oBAAG;IACC,KAAK,EAAE,IAAI;EAGf,kCAAiB;IACb,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,IAAI;IAElB,oCAAE;MACE,SAAS,EAAE,GAAG;EAItB,kCAAiB;IACb,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,GAAG;EAGvB,8BAAe;IACX,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,OAAO;IACrB,KAAK,EAAE,OAAO;IAEd,gCAAE;MACE,KAAK,EAAE,OAAO;EAItB,+BAAgB;IACZ,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,OAAO;IACrB,KAAK,EAAE,OAAO;IAEd,iCAAE;MACE,KAAK,EAAE,OAAO;EAItB,+BAAgB;IACZ,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,OAAO;IACrB,KAAK,EAAE,OAAO;IAEd,iCAAE;MACE,KAAK,EAAE,OAAO;EAItB,gCAAiB;IACb,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,OAAO;IACrB,KAAK,EAAE,OAAO;IAEd,kCAAE;MACE,KAAK,EAAE,OAAO;EAItB,4BAAa;IACT,gBAAgB,EAAE,OAAO;IACzB,YAAY,EAAE,OAAO;IACrB,KAAK,EAAE,OAAO;IAEd,8BAAE;MACE,KAAK,EAAE,OAAO;;AAK1B,mBAAoB;EAChB,MAAM,EAAE,QAAQ;EAChB,gBAAgB,EAAE,IAAI;EACtB,MAAM,EAAE,CAAC;EACT,WAAW,EAAE,iBAAiB;EAC9B,kBAAkB,EAAE,8BAA6B;EACjD,UAAU,EAAE,8BAA6B;EACzC,OAAO,EAAE,QAAQ;EAEjB;;;;;wBAKG;IACC,aAAa,EAAE,YAAY;EAG/B,qBAAE;IACE,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,GAAG;EAGhB,oCAAiB;IACb,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,IAAI;IAElB,sCAAE;MACE,SAAS,EAAE,GAAG;EAItB,oCAAiB;IACb,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,GAAG;EAGvB,8BAAa;IACT,WAAW,EAAE,iBAAiB;EAGlC,iCAAgB;IACZ,WAAW,EAAE,iBAAiB;EAGlC,iCAAgB;IACZ,WAAW,EAAE,iBAAiB;EAGlC,kCAAiB;IACb,WAAW,EAAE,iBAAiB;;AAItC,uDAAwD;EACpD,OAAO,EAAE,CAAC;;AAKN,sHAAiB;EACb,OAAO,EAAE,KAAK;EACd,WAAW,EAAE,IAAI;AAErB,sHAAiB;EACb,KAAK,EAAE,IAAI;AAGnB,0EAA4D;EACxD,aAAa,EAAE,CAAC", "sources": ["field_info.scss"], "names": [], "file": "field_info.css" }fields/info/field_info.php000066600000015341152141561100011560 0ustar00. * * @package ReduxFramework * @subpackage Field_Info * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_info' ) ) { /** * Main ReduxFramework_info class * * @since 1.0.0 */ class ReduxFramework_info { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $defaults = array( 'title' => '', 'desc' => '', 'notice' => true, 'style' => '', 'color' => '', ); $this->field = wp_parse_args( $this->field, $defaults ); $styles = array( 'normal', 'info', 'warning', 'success', 'critical', 'custom' ); if (!in_array($this->field['style'], $styles)) { $this->field['style'] = 'normal'; } if ($this->field['style'] == "custom") { if (!empty($this->field['color']) ) { $this->field['color'] = "border-color:".$this->field['color'].';'; } else { $this->field['style'] = 'normal'; $this->field['color'] = ""; } } else { $this->field['color'] = ""; } if ( empty( $this->field['desc'] ) && ! empty( $this->field['default'] ) ) { $this->field['desc'] = $this->field['default']; unset( $this->field['default'] ); } if ( empty( $this->field['desc'] ) && ! empty( $this->field['subtitle'] ) ) { $this->field['desc'] = $this->field['subtitle']; unset( $this->field['subtitle'] ); } if ( empty( $this->field['desc'] ) ) { $this->field['desc'] = ""; } if ( empty( $this->field['raw_html'] ) ) { if ( $this->field['notice'] == true ) { $this->field['class'] .= ' redux-notice-field'; } else { $this->field['class'] .= ' redux-info-field'; } $this->field['style'] = 'redux-' . $this->field['style'] . ' '; } $indent = ( isset( $this->field['sectionIndent'] ) && $this->field['sectionIndent'] ) ? ' form-table-section-indented' : ''; echo '
    field['style']) . ' ' . esc_attr($this->field['class']) . ' redux-field-' . esc_attr($this->field['type']) . esc_attr($indent) . '"'.( !empty($this->field['color']) ? ' style="' . esc_attr($this->field['color']) . '"' : '' ) . '>'; if ( ! empty( $this->field['raw_html'] ) && $this->field['raw_html'] ) { echo wp_kses_post($this->field['desc']); } else { if ( isset( $this->field['title'] ) && ! empty( $this->field['title'] ) ) { $this->field['title'] = '' . wp_kses_post($this->field['title']) . '
    '; } if ( isset( $this->field['icon'] ) && ! empty( $this->field['icon'] ) && $this->field['icon'] !== true ) { echo '

    '; } if ( isset( $this->field['raw'] ) && ! empty( $this->field['raw'] ) ) { echo wp_kses_post($this->field['raw']); } if ( ! empty( $this->field['title'] ) || ! empty( $this->field['desc'] ) ) { echo '

    ' . wp_kses_post($this->field['title']) . wp_kses_post($this->field['desc']) . '

    '; } } echo '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-info-css', ReduxFramework::$_url . 'inc/fields/info/field_info.css', array(), time(), 'all' ); } } } }fields/info/field_info.css000066600000004721152141561100011561 0ustar00.redux-info-field{min-height:20px;padding:8px 19px;margin:10px 0;border:1px solid;border-radius:4px;border:1px solid;position:relative}.redux-info-field h1,.redux-info-field h2,.redux-info-field h3,.redux-info-field h4,.redux-info-field h5,.redux-info-field h6{border-bottom:0 !important}.redux-info-field h3{color:#777}.redux-info-field .redux-info-icon{display:inline-block;margin-right:15px}.redux-info-field .redux-info-icon i{font-size:2em}.redux-info-field .redux-info-desc{display:inline-block;vertical-align:top}.redux-info-field.redux-normal{background-color:#eee;border-color:#ccc;color:#666}.redux-info-field.redux-normal i{color:#c5c5c5}.redux-info-field.redux-warning{background-color:#fbeba4;border-color:#d7c281;color:#958234}.redux-info-field.redux-warning i{color:#dcca81}.redux-info-field.redux-success{background-color:#c4ee91;border-color:#71af5d;color:#4d7615}.redux-info-field.redux-success i{color:#a0ca6c}.redux-info-field.redux-critical{background-color:#fba1a3;border-color:#b84f5b;color:#981225}.redux-info-field.redux-critical i{color:#dd767d}.redux-info-field.redux-info{background-color:#d3e4f4;border-color:#a9b6c2;color:#5c80a1}.redux-info-field.redux-info i{color:#afc6da}.redux-notice-field{margin:15px 0 0;background-color:#fff;border:0;border-left:4px solid #f3f3f3;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);padding:1px 12px}.redux-notice-field h1,.redux-notice-field h2,.redux-notice-field h3,.redux-notice-field h4,.redux-notice-field h5,.redux-notice-field h6{border-bottom:0 !important}.redux-notice-field p{margin:.5em 0;padding:2px}.redux-notice-field .redux-info-icon{display:inline-block;margin-right:15px}.redux-notice-field .redux-info-icon i{font-size:2em}.redux-notice-field .redux-info-desc{display:inline-block;vertical-align:top}.redux-notice-field.redux-info{border-left:4px solid #0099d5}.redux-notice-field.redux-success{border-left:4px solid #7ad03a}.redux-notice-field.redux-warning{border-left:4px solid #fbeba4}.redux-notice-field.redux-critical{border-left:4px solid #dd3d36}.redux-main .redux-field-container.redux-container-info{padding:0}.wp-customizer .hasIcon.redux-notice-field .redux-info-desc,.wp-customizer .hasIcon.redux-info-field .redux-info-desc{display:block;margin-left:43px}.wp-customizer .hasIcon.redux-notice-field .redux-info-icon,.wp-customizer .hasIcon.redux-info-field .redux-info-icon{float:left}.wp-customizer .redux-main .customize-control.customize-control-redux-info{border-bottom:0}fields/info/field_info.scss000066600000005236152141561100011746 0ustar00.redux-info-field { min-height: 20px; padding: 8px 19px; margin: 10px 0; border: 1px solid; border-radius: 4px; border: 1px solid; position: relative; h1, h2, h3, h4, h5, h6 { border-bottom: 0 !important; } h3 { color: #777; } .redux-info-icon { display: inline-block; margin-right: 15px; i { font-size: 2em; } } .redux-info-desc { display: inline-block; vertical-align: top; } &.redux-normal { background-color: #eeeeee; border-color: #cccccc; color: #666666; i { color: #c5c5c5; } } &.redux-warning { background-color: #fbeba4; border-color: #d7c281; color: #958234; i { color: #dcca81; } } &.redux-success { background-color: #c4ee91; border-color: #71af5d; color: #4d7615; i { color: #a0ca6c; } } &.redux-critical { background-color: #fba1a3; border-color: #b84f5b; color: #981225; i { color: #dd767d; } } &.redux-info { background-color: #d3e4f4; border-color: #a9b6c2; color: #5c80a1; i { color: #afc6da; } } } .redux-notice-field { margin: 15px 0 0; background-color: #fff; border: 0; border-left: 4px solid #f3f3f3; -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); padding: 1px 12px; h1, h2, h3, h4, h5, h6 { border-bottom: 0 !important; } p { margin: .5em 0; padding: 2px; } .redux-info-icon { display: inline-block; margin-right: 15px; i { font-size: 2em; } } .redux-info-desc { display: inline-block; vertical-align: top; } &.redux-info { border-left: 4px solid #0099d5; } &.redux-success { border-left: 4px solid #7ad03a; } &.redux-warning { border-left: 4px solid #fbeba4; } &.redux-critical { border-left: 4px solid #dd3d36; } } .redux-main .redux-field-container.redux-container-info { padding: 0; } .wp-customizer { .hasIcon.redux-notice-field, .hasIcon.redux-info-field { .redux-info-desc { display: block; margin-left: 43px; } .redux-info-icon { float: left; } } .redux-main .customize-control.customize-control-redux-info { border-bottom: 0; } } fields/palette/field_palette.php000066600000007436152141561100012774 0ustar00. * * @package ReduxFramework * @subpackage Field_Palette * @author Kevin Provance (kprovance) * @version 3.5.4 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'ReduxFramework_palette' ) ) { class ReduxFramework_palette { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settingss * * @since 1.0.0 * @access public * @return void */ public function render() { if (empty($this->field['palettes'])) { echo 'No palettes have been set.'; return; } echo '
    '; foreach ( $this->field['palettes'] as $value => $colorSet ) { $checked = checked( $this->value , $value, false ); echo ''; echo ''; echo ''; } echo '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { $min = Redux_Functions::isMin(); wp_enqueue_script( 'redux-field-palette-js', ReduxFramework::$_url . 'inc/fields/palette/field_palette' . $min . '.js', array( 'jquery', 'redux-js', 'jquery-ui-button', 'jquery-ui-core' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-palette-css', ReduxFramework::$_url . 'inc/fields/palette/field_palette.css', array(), time(), 'all' ); } } public function output() { } } }fields/palette/field_palette.css000066600000001766152141561100012775 0ustar00.redux-container-palette label{border:3px solid transparent;border-color:transparent !important;border-radius:0;width:100% !important;display:block}.redux-container-palette label.ui-button.ui-widget{width:95%;background:0;padding:0}.redux-container-palette label.ui-button.ui-widget .ui-button-text{display:flex}.redux-container-palette label.ui-button.ui-widget .ui-button-text span{padding:10px;flex-grow:1;font-size:0;line-height:10px;color:transparent;-webkit-transition:all 200ms ease-in-out;-moz-transition:all 200ms ease-in-out;-ms-transition:all 200ms ease-in-out;-o-transition:all 200ms ease-in-out;transition:all 200ms ease-in-out;text-shadow:0}.redux-container-palette label.ui-button.ui-widget .ui-button-text span:hover{flex-grow:3;font-weight:bold;min-width:60px;font-size:12px;line-height:10px;color:#333;text-shadow:0 0 8px #fff,0 0 8px #fff}.redux-container-palette label.ui-state-active{border:3px solid #333 !important}.wp-customizer .redux-main .redux-container-palette label{margin-bottom:3px}fields/palette/field_palette.css.map000066600000001467152141561100013547 0ustar00{ "version": 3, "mappings": "AACI,8BAAM;EACF,MAAM,EAAE,qBAAqB;EAC7B,YAAY,EAAE,sBAAsB;EACpC,aAAa,EAAE,CAAC;EAEhB,KAAK,EAAE,eAAe;EACtB,OAAO,EAAE,KAAK;EACd,kDAAsB;IAClB,KAAK,EAAE,GAAG;IACV,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,CAAC;IAEV,kEAAgB;MAC5B;;2CAEqC;MACrB,OAAO,EAAE,IAAI;MAEb,uEAAK;QACD,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,WAAa;QACpB,kBAAkB,EAAE,qBAAqB;QACzC,eAAe,EAAE,qBAAqB;QACtC,cAAc,EAAE,qBAAqB;QACrC,aAAa,EAAE,qBAAqB;QACpC,UAAU,EAAE,qBAAqB;QACjC,WAAW,EAAE,CAAC;QACd,6EAAQ;UACJ,SAAS,EAAE,CAAC;UACZ,WAAW,EAAE,IAAI;UACjB,SAAS,EAAE,IAAI;UACf,SAAS,EAAE,IAAI;UACf,WAAW,EAAE,IAAI;UACjB,KAAK,EAAE,IAAI;UACX,WAAW,EAAE,0BAA0B;EAMvD,8CAAkB;IACd,MAAM,EAAE,yBAAyB;;AAMzC,yDAA2C;EACvC,aAAa,EAAE,GAAG", "sources": ["field_palette.scss"], "names": [], "file": "field_palette.css" }fields/palette/field_palette.min.js000066600000001042152141561100013366 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.palette=redux.field_objects.palette||{},redux.field_objects.palette.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-palette:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".buttonset").each(function(){a(this).buttonset()}))})}}(jQuery);fields/palette/field_palette.js000066600000003006152141561100012606 0ustar00/* Field Palette (color) */ /*global jQuery, document, redux_change, redux*/ (function( $ ) { 'use strict'; redux.field_objects = redux.field_objects || {}; redux.field_objects.palette = redux.field_objects.palette || {}; redux.field_objects.palette.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-palette:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.buttonset' ).each( function() { $( this ).buttonset(); } ); // el.find('.redux-palette-set').click( // function(){ // console.log($(this).val()); // } // ) } ); }; })( jQuery );fields/palette/field_palette.scss000066600000003253152141561100013151 0ustar00.redux-container-palette { label { border: 3px solid transparent; border-color: transparent !important; border-radius: 0; //border: 0; width: 100% !important; display: block; &.ui-button.ui-widget { width: 95%; background: none; padding: 0; .ui-button-text { /* border-top: 3px solid transparent; border-bottom: 3px solid transparent; margin-bottom: 5px;*/ display: flex; span { padding: 10px; flex-grow: 1; font-size: 0; line-height: 10px; color: rgba(0,0,0,0); -webkit-transition: all 200ms ease-in-out; -moz-transition: all 200ms ease-in-out; -ms-transition: all 200ms ease-in-out; -o-transition: all 200ms ease-in-out; transition: all 200ms ease-in-out; text-shadow: 0; &:hover { flex-grow: 3; font-weight: bold; min-width: 60px; font-size: 12px; line-height: 10px; color: #333; text-shadow: 0 0 8px #fff, 0 0 8px #fff; } } } } &.ui-state-active { border: 3px solid #333 !important; } } } .wp-customizer { .redux-main .redux-container-palette label { margin-bottom: 3px; } } fields/password/field_password.php000066600000010656152141561100013402 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.1 */ function render() { if ( ! empty( $this->field['username'] ) && $this->field['username'] === true ) { $this->_render_combined_field(); } else { $this->_render_single_field(); } } /** * This will render a combined User/Password field * * @since ReduxFramework 3.0.9 * @example * * array( * 'id' => 'smtp_account', * 'type' => 'password', * 'username' => true, * 'title' => 'SMTP Account', * 'placeholder' => array('username' => 'Username') * ) * */ private function _render_combined_field() { $defaults = array( 'username' => '', 'password' => '', 'placeholder' => array( 'password' => __( 'Password', 'redux-framework' ), 'username' => __( 'Username', 'redux-framework' ) ) ); $this->value = wp_parse_args( $this->value, $defaults ); if ( ! empty( $this->field['placeholder'] ) ) { if ( is_array( $this->field['placeholder'] ) ) { if ( ! empty( $this->field['placeholder']['password'] ) ) { $this->value['placeholder']['password'] = $this->field['placeholder']['password']; } if ( ! empty( $this->field['placeholder']['username'] ) ) { $this->value['placeholder']['username'] = $this->field['placeholder']['username']; } } else { $this->value['placeholder']['password'] = $this->field['placeholder']; } } // Username field echo ' '; // Password field echo ''; } /** * This will render a single Password field * * @since ReduxFramework 3.0.9 * @example * * array( * 'id' => 'smtp_password', * 'type' => 'password', * 'title' => 'SMTP Password' * ) * */ private function _render_single_field() { echo ''; } } }fields/text/field_text.scss000066600000001612152141561100012022 0ustar00.redux-container-text { label { display: block; position: relative; font-size: 12px !important; text-align: left; color: #999999; margin: 4px 0 2px 0 !important; cursor: default; top: 5px; width: 100px; } input { clear: left; } .input_wrapper { display: block; position: relative; padding: 0; width: 23%; max-width: 23%; min-width: 70px; float: left; clear: left; height: 57px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; vertical-align: baseline; } } .wp-customizer { .redux-container-text { .input_wrapper { width: 100%; max-width: 100%; height: auto; } } }fields/text/field_text.css.map000066600000001276152141561100012421 0ustar00{ "version": 3, "mappings": "AACI,2BAAM;EACF,OAAO,EAAE,KAAK;EACd,QAAQ,EAAE,QAAQ;EAClB,SAAS,EAAE,eAAe;EAC1B,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,OAAO;EACd,MAAM,EAAE,sBAAsB;EAC9B,MAAM,EAAE,OAAO;EACf,GAAG,EAAE,GAAG;EACR,KAAK,EAAE,KAAK;AAGhB,2BAAM;EACF,KAAK,EAAE,IAAI;AAGf,oCAAe;EACX,OAAO,EAAE,KAAK;EACd,QAAQ,EAAE,QAAQ;EAClB,OAAO,EAAE,CAAC;EACV,KAAK,EAAE,GAAG;EACV,SAAS,EAAE,GAAG;EACd,SAAS,EAAE,IAAI;EACf,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,kBAAkB,EAAE,UAAU;EAC9B,eAAe,EAAE,UAAU;EAC3B,aAAa,EAAE,UAAU;EACzB,UAAU,EAAE,UAAU;EACtB,cAAc,EAAE,QAAQ;;AAMxB,mDAAe;EACX,KAAK,EAAE,IAAI;EACX,SAAS,EAAE,IAAI;EACf,MAAM,EAAE,IAAI", "sources": ["field_text.scss"], "names": [], "file": "field_text.css" }fields/text/field_text.css000066600000001113152141561100011633 0ustar00.redux-container-text label{display:block;position:relative;font-size:12px !important;text-align:left;color:#999;margin:4px 0 2px 0 !important;cursor:default;top:5px;width:100px}.redux-container-text input{clear:left}.redux-container-text .input_wrapper{display:block;position:relative;padding:0;width:23%;max-width:23%;min-width:70px;float:left;clear:left;height:57px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;vertical-align:baseline}.wp-customizer .redux-container-text .input_wrapper{width:100%;max-width:100%;height:auto}fields/text/field_text.php000066600000010555152141561100011644 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { if ( empty( $this->field['args'] ) ) { $this->field['args'] = array(); } $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] ); $this->field['class'] .= " hasOptions "; } if ( empty( $this->value ) && ! empty( $this->field['data'] ) && ! empty( $this->field['options'] ) ) { $this->value = $this->field['options']; } //if (isset($this->field['text_hint']) && is_array($this->field['text_hint'])) { $qtip_title = isset( $this->field['text_hint']['title'] ) ? 'qtip-title="' . $this->field['text_hint']['title'] . '" ' : ''; $qtip_text = isset( $this->field['text_hint']['content'] ) ? 'qtip-content="' . $this->field['text_hint']['content'] . '" ' : ''; //} $readonly = ( isset( $this->field['readonly'] ) && $this->field['readonly']) ? ' readonly="readonly"' : ''; $autocomplete = ( isset($this->field['autocomplete']) && $this->field['autocomplete'] == false) ? ' autocomplete="off"' : ''; if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) { $placeholder = ''; if ( isset( $this->field['placeholder'] ) ) { $placeholder = $this->field['placeholder']; } foreach ( $this->field['options'] as $k => $v ) { if ( ! empty( $placeholder ) ) { $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][ $k ] ) . '" ' : ''; } echo '
    '; echo ' '; echo '
    '; echo '
    '; } //foreach } else { $placeholder = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'] ) . '" ' : ''; echo ''; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 3.0.0 */ function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-text-css', ReduxFramework::$_url . 'inc/fields/text/field_text.css', array(), time(), 'all' ); } } } }fields/color_gradient/field_color_gradient.scss000066600000000516152141561100016042 0ustar00.redux-container-color_gradient { .colorGradient { display: inline-block; } .toLabel { padding-left: 18px; } } @media screen and (max-width: 660px) { .redux-container-color_gradient { .colorGradient { display: block; text-align: center !important; } } }fields/color_gradient/field_color_gradient.min.js000066600000004425152141561100016270 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.color_gradient=redux.field_objects.color_gradient||{},a(document).ready(function(){}),redux.field_objects.color_gradient.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-color_gradient:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".redux-color-init").wpColorPicker({change:function(c,d){a(this).val(d.color.toString()),redux_change(a(this)),b.find("#"+c.target.getAttribute("data-id")+"-transparency").removeAttr("checked")},clear:function(b,c){a(this).val(c.color.toString()),redux_change(a(this).parent().find(".redux-color-init"))}}),b.find(".redux-color").on("keyup",function(){var c=a(this).val(),d=colorValidate(this),e="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(e+"-transparency").attr("checked","checked")):(b.find(e+"-transparency").removeAttr("checked"),d&&d!==a(this).val()&&a(this).val(d))}),b.find(".redux-color").on("blur",function(){var c=a(this).val(),d="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(d+"-transparency").attr("checked","checked")):(colorValidate(this)===c&&0!==c.indexOf("#")&&a(this).val(a(this).data("oldcolor")),b.find(d+"-transparency").removeAttr("checked"))}),b.find(".redux-color").on("keydown",function(){a(this).data("oldkeypress",a(this).val())}),b.find(".color-transparency").on("click",function(){if(a(this).is(":checked"))b.find(".redux-saved-color").val(a("#"+a(this).data("id")).val()),b.find("#"+a(this).data("id")).val("transparent"),b.find("#"+a(this).data("id")).parent().parent().find(".wp-color-result").css("background-color","transparent");else if("transparent"===b.find("#"+a(this).data("id")).val()){var c=a(".redux-saved-color").val();""===c&&(c=a("#"+a(this).data("id")).data("default-color")),b.find("#"+a(this).data("id")).parent().parent().find(".wp-color-result").css("background-color",c),b.find("#"+a(this).data("id")).val(c)}redux_change(a(this))}))})}}(jQuery);fields/color_gradient/field_color_gradient.js000066600000013224152141561100015503 0ustar00/* Field Color Gradient */ /*global jQuery, document, redux_change, redux*/ (function( $ ) { 'use strict'; redux.field_objects = redux.field_objects || {}; redux.field_objects.color_gradient = redux.field_objects.color_gradient || {}; $( document ).ready( function() { // setTimeout(function () { // redux.field_objects.color.init(); // }, 1000); } ); redux.field_objects.color_gradient.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-color_gradient:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.redux-color-init' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ) ); el.find( '#' + e.target.getAttribute( 'data-id' ) + '-transparency' ).removeAttr( 'checked' ); }, clear: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ).parent().find( '.redux-color-init' ) ); } } ); el.find( '.redux-color' ).on( 'keyup', function() { var value = $( this ).val(); var color = colorValidate( this ); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { el.find( id + '-transparency' ).removeAttr( 'checked' ); if ( color && color !== $( this ).val() ) { $( this ).val( color ); } } } ); // Replace and validate field on blur el.find( '.redux-color' ).on( 'blur', function() { var value = $( this ).val(); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { if ( colorValidate( this ) === value ) { if ( value.indexOf( "#" ) !== 0 ) { $( this ).val( $( this ).data( 'oldcolor' ) ); } } el.find( id + '-transparency' ).removeAttr( 'checked' ); } } ); // Store the old valid color on keydown el.find( '.redux-color' ).on( 'keydown', function() { $( this ).data( 'oldkeypress', $( this ).val() ); } ); // When transparency checkbox is clicked el.find( '.color-transparency' ).on( 'click', function() { if ( $( this ).is( ":checked" ) ) { el.find( '.redux-saved-color' ).val( $( '#' + $( this ).data( 'id' ) ).val() ); el.find( '#' + $( this ).data( 'id' ) ).val( 'transparent' ); el.find( '#' + $( this ).data( 'id' ) ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); } else { if ( el.find( '#' + $( this ).data( 'id' ) ).val() === 'transparent' ) { var prevColor = $( '.redux-saved-color' ).val(); if ( prevColor === '' ) { prevColor = $( '#' + $( this ).data( 'id' ) ).data( 'default-color' ); } el.find( '#' + $( this ).data( 'id' ) ).parent().parent().find( '.wp-color-result' ).css( 'background-color', prevColor ); el.find( '#' + $( this ).data( 'id' ) ).val( prevColor ); } } redux_change( $( this ) ); } ); } ); }; })( jQuery );fields/color_gradient/field_color_gradient.css.map000066600000000375152141561100016436 0ustar00{ "version": 3, "mappings": "AACI,8CAAe;EACX,OAAO,EAAE,YAAY;AAEzB,wCAAS;EACL,YAAY,EAAE,IAAI;;AAI1B,oCAAqC;EAE7B,8CAAe;IACX,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,iBAAiB", "sources": ["field_color_gradient.scss"], "names": [], "file": "field_color_gradient.css" }fields/color_gradient/field_color_gradient.php000066600000012770152141561100015663 0ustar00. * * @package ReduxFramework * @subpackage Field_Color_Gradient * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_color_gradient' ) ) { /** * Main ReduxFramework_color_gradient class * * @since 1.0.0 */ class ReduxFramework_color_gradient { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { // No errors please $defaults = array( 'from' => '', 'to' => '' ); $this->value = wp_parse_args( $this->value, $defaults ); echo '
    ' . __( 'From ', 'redux-framework' ) . ' '; echo ''; echo ''; if ( ! isset( $this->field['transparent'] ) || $this->field['transparent'] !== false ) { $tChecked = ""; if ( $this->value['from'] == "transparent" ) { $tChecked = ' checked="checked"'; } echo ''; } echo "
    "; echo '
    ' . __( 'To ', 'redux-framework' ) . ' '; if ( ! isset( $this->field['transparent'] ) || $this->field['transparent'] !== false ) { $tChecked = ""; if ( $this->value['to'] == "transparent" ) { $tChecked = ' checked="checked"'; } echo ''; } echo "
    "; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'redux-field-color-gradient-js', ReduxFramework::$_url . 'inc/fields/color_gradient/field_color_gradient' . Redux_Functions::isMin() . '.js', array( 'jquery', 'wp-color-picker', 'redux-js' ), time(), 'all' ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-color-picker-css' ); wp_enqueue_style( 'redux-field-color_gradient-css', ReduxFramework::$_url . 'inc/fields/color_gradient/field_color_gradient.css', array(), time(), 'all' ); } } } }fields/color_gradient/field_color_gradient.css000066600000000376152141561100015663 0ustar00.redux-container-color_gradient .colorGradient{display:inline-block}.redux-container-color_gradient .toLabel{padding-left:18px}@media screen and (max-width:660px){.redux-container-color_gradient .colorGradient{display:block;text-align:center !important}}fields/border/field_border.css000066600000001220152141561100012414 0ustar00.redux-container-border .select2-container{float:left;display:block;margin-right:10px}.redux-container-border .select_wrapper{float:left;width:inherit}.redux-container-border .select_wrapper select{width:80px;float:left}.redux-container-border .field-border-input{margin-right:10px;margin-bottom:7px}.redux-container-border .wp-picker-container{margin-top:2px}@media screen and (max-width:782px){.redux-container-border .field-border-input input{display:inline-block !important;width:100px !important}.redux-container-border .field-border-input .add-on{padding:7px 4px;font-size:16px;line-height:1.5}.redux-container-border .select_wrapper{margin-top:6px}}fields/border/field_border.php000066600000040203152141561100012417 0ustar00. * * @package Redux_Field * @subpackage Border * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_border' ) ) { class ReduxFramework_border { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } //function private function stripAlphas($s) { // Regex is our friend. THERE ARE FOUR LIGHTS!! return preg_replace('/[^\d.-]/', '', $s); } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { // No errors please $defaults = array( 'top' => true, 'bottom' => true, 'all' => true, 'style' => true, 'color' => true, 'left' => true, 'right' => true, ); $this->field = wp_parse_args( $this->field, $defaults ); $defaults = array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', 'color' => '', 'style' => '', ); $this->value = wp_parse_args( $this->value, $defaults ); $value = array( 'top' => isset( $this->value['border-top'] ) ? filter_var( $this->value['border-top'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['top'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'right' => isset( $this->value['border-right'] ) ? filter_var( $this->value['border-right'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['right'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'bottom' => isset( $this->value['border-bottom'] ) ? filter_var( $this->value['border-bottom'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['bottom'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'left' => isset( $this->value['border-left'] ) ? filter_var( $this->value['border-left'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['left'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'color' => isset( $this->value['border-color'] ) ? $this->value['border-color'] : $this->value['color'], 'style' => isset( $this->value['border-style'] ) ? $this->value['border-style'] : $this->value['style'] ); if ( ( isset( $this->value['width'] ) || isset( $this->value['border-width'] ) ) ) { if ( isset( $this->value['border-width'] ) && ! empty( $this->value['border-width'] ) ) { $this->value['width'] = $this->value['border-width']; } $this->value['width'] = $this->stripAlphas($this->value['width']); $value['top'] = $this->value['width']; $value['right'] = $this->value['width']; $value['bottom'] = $this->value['width']; $value['left'] = $this->value['width']; } $this->value = $value; $defaults = array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ); $this->value = wp_parse_args( $this->value, $defaults ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } echo ''; if ( isset( $this->field['all'] ) && $this->field['all'] == true ) { echo '
    '; } echo ''; echo ''; echo ''; echo ''; if ( ! isset( $this->field['all'] ) || $this->field['all'] !== true ) { /** * Top * */ if ( $this->field['top'] === true ) { echo '
    '; } /** * Right * */ if ( $this->field['right'] === true ) { echo '
    '; } /** * Bottom * */ if ( $this->field['bottom'] === true ) { echo '
    '; } /** * Left * */ if ( $this->field['left'] === true ) { echo '
    '; } } /** * Border-style * */ if ( $this->field['style'] != false ) { $options = array( 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted', 'double' => "Double", 'none' => 'None' ); echo ''; } else { echo ''; } /** * Color * */ if ( $this->field['color'] != false ) { $default = isset( $this->field['default']['border-color'] ) ? $this->field['default']['border-color'] : ''; if ( empty( $default ) ) { $default = ( isset( $this->field['default']['color'] ) ) ? $this->field['default']['color'] : '#ffffff'; } echo ''; } else { echo ''; } } //function /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ function enqueue() { $min = Redux_Functions::isMin(); if (!wp_style_is ( 'select2-css' )) { wp_enqueue_style( 'select2-css' ); } if (!wp_style_is ( 'wp-color-picker' )) { wp_enqueue_style( 'wp-color-picker' ); } if (!wp_script_is ( 'redux-field-border-js' )) { wp_enqueue_script( 'redux-field-border-js', ReduxFramework::$_url . 'inc/fields/border/field_border' . $min . '.js', array( 'jquery', 'select2-js', 'wp-color-picker', 'redux-js' ), time(), true ); } if ($this->parent->args['dev_mode']) { if (!wp_style_is ( 'redux-color-picker-css' )) { wp_enqueue_style( 'redux-color-picker-css' ); } if (!wp_style_is ( 'redux-field-border-css' )) { wp_enqueue_style( 'redux-field-border-css', ReduxFramework::$_url . 'inc/fields/border/field_border.css', array(), time(), 'all' ); } } } //function public function output() { if ( isset( $this->field['all'] ) && true == $this->field['all'] ) { $borderWidth = isset( $this->value['border-width'] ) ? $this->value['border-width'] : '0px'; $val = isset( $this->value['border-top'] ) ? $this->value['border-top'] : $borderWidth; $this->value['border-top'] = $val; $this->value['border-bottom'] = $val; $this->value['border-left'] = $val; $this->value['border-right'] = $val; } $cleanValue = array( 'color' => ! empty( $this->value['border-color'] ) ? $this->value['border-color'] : '', 'style' => ! empty( $this->value['border-style'] ) ? $this->value['border-style'] : '' ); $borderWidth = ''; if ( isset( $this->value['border-width'] ) ) { $borderWidth = $this->value['border-width']; } $this->field['top'] = isset( $this->field['top'] ) ? $this->field['top'] : true; $this->field['bottom'] = isset( $this->field['bottom'] ) ? $this->field['bottom'] : true; $this->field['left'] = isset( $this->field['left'] ) ? $this->field['left'] : true; $this->field['right'] = isset( $this->field['right'] ) ? $this->field['right'] : true; if ( $this->field['top'] === true ) { $cleanValue['top'] = ! empty( $this->value['border-top'] ) ? $this->value['border-top'] : $borderWidth; } if ( $this->field['bottom'] == true ) { $cleanValue['bottom'] = ! empty( $this->value['border-bottom'] ) ? $this->value['border-bottom'] : $borderWidth; } if ( $this->field['left'] === true ) { $cleanValue['left'] = ! empty( $this->value['border-left'] ) ? $this->value['border-left'] : $borderWidth; } if ( $this->field['right'] === true ) { $cleanValue['right'] = ! empty( $this->value['border-right'] ) ? $this->value['border-right'] : $borderWidth; } $style = ""; //absolute, padding, margin if ( ! isset( $this->field['all'] ) || $this->field['all'] != true ) { foreach ( $cleanValue as $key => $value ) { if ( $key == "color" || $key == "style" ) { continue; } if (!empty($value)) { $style .= 'border-' . $key . ':' . $value . ' ' . $cleanValue['style'] . ' ' . $cleanValue['color'] . ';'; } } } else { if (!empty($cleanValue['top'])) { $style .= 'border:' . $cleanValue['top'] . ' ' . $cleanValue['style'] . ' ' . $cleanValue['color'] . ';'; } } if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); if (!empty($style)) { $this->parent->outputCSS .= $keys . "{" . $style . '}'; } } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); if (!empty($style)) { $this->parent->compilerCSS .= $keys . "{" . $style . '}'; } } } } //class }fields/border/field_border.min.js000066600000004132152141561100013027 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.border=redux.field_objects.border||{},redux.field_objects.border.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-border:visible")),a(b).each(function(){var b=a(this),c=b;if(b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),!c.is(":hidden")&&c.hasClass("redux-field-init")){c.removeClass("redux-field-init"),b.find(".redux-border-top, .redux-border-right, .redux-border-bottom, .redux-border-left, .redux-border-all").numeric({allowMinus:!1});var d={triggerChange:!0,allowClear:!0},e=b.find(".redux-container-border").find(".select2_params");if(e.size()>0){var f=e.val();f=JSON.parse(f),d=a.extend({},d,f)}b.find(".redux-border-style").select2(d),b.find(".redux-border-input").on("change",function(){var b=a(this).parents(".redux-field:first").find(".field-units").val();0!==a(this).parents(".redux-field:first").find(".redux-border-units").length&&(b=a(this).parents(".redux-field:first").find(".redux-border-units option:selected").val());var c=a(this).val();"undefined"!=typeof b&&c&&(c+=b),a(this).hasClass("redux-border-all")?a(this).parents(".redux-field:first").find(".redux-border-value").each(function(){a(this).val(c)}):a("#"+a(this).attr("rel")).val(c)}),b.find(".redux-border-units").on("change",function(){a(this).parents(".redux-field:first").find(".redux-border-input").change()}),b.find(".redux-color-init").wpColorPicker({change:function(c,d){a(this).val(d.color.toString()),redux_change(a(this)),b.find("#"+c.target.getAttribute("data-id")+"-transparency").removeAttr("checked")},clear:function(b,c){a(this).val(c.color.toString()),redux_change(a(this).parent().find(".redux-color-init"))}}),b.find(".redux-color").on("keyup",function(){var b=colorValidate(this);b&&b!==a(this).val()&&a(this).val(b)}),b.find(".redux-color").on("blur",function(){var b=a(this).val();colorValidate(this)===b&&0!==b.indexOf("#")&&a(this).val(a(this).data("oldcolor"))}),b.find(".redux-color").on("keydown",function(){a(this).data("oldkeypress",a(this).val())})}})}}(jQuery);fields/border/field_border.css.map000066600000001044152141561100013174 0ustar00{ "version": 3, "mappings": "AACI,0CAAmB;EACf,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,KAAK;EACd,YAAY,EAAE,IAAI;AAGtB,uCAAgB;EACZ,KAAK,EAAE,IAAI;EAMX,KAAK,EAAE,OAAO;EALd,8CAAO;IACH,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;AAMnB,2CAAoB;EAChB,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,GAAG;AAGtB,4CAAqB;EACjB,UAAU,EAAE,GAAG;;AAIvB,oCAAqC;EAGzB,iDAAM;IACF,OAAO,EAAE,uBAAuB;IAChC,KAAK,EAAE,gBAAgB;EAG3B,mDAAQ;IACJ,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,GAAG;EAIxB,uCAAgB;IACZ,UAAU,EAAE,GAAG", "sources": ["field_border.scss"], "names": [], "file": "field_border.css" }fields/border/field_border.js000066600000012036152141561100012247 0ustar00/* Field Border (border) */ /*global redux_change, wp, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.border = redux.field_objects.border || {}; redux.field_objects.border.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-border:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( ".redux-border-top, .redux-border-right, .redux-border-bottom, .redux-border-left, .redux-border-all" ).numeric( { allowMinus: false } ); var default_params = { triggerChange: true, allowClear: true }; var select2_handle = el.find( '.redux-container-border' ).find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } el.find( ".redux-border-style" ).select2( default_params ); el.find( '.redux-border-input' ).on( 'change', function() { var units = $( this ).parents( '.redux-field:first' ).find( '.field-units' ).val(); if ( $( this ).parents( '.redux-field:first' ).find( '.redux-border-units' ).length !== 0 ) { units = $( this ).parents( '.redux-field:first' ).find( '.redux-border-units option:selected' ).val(); } var value = $( this ).val(); if ( typeof units !== 'undefined' && value ) { value += units; } if ( $( this ).hasClass( 'redux-border-all' ) ) { $( this ).parents( '.redux-field:first' ).find( '.redux-border-value' ).each( function() { $( this ).val( value ); } ); } else { $( '#' + $( this ).attr( 'rel' ) ).val( value ); } } ); el.find( '.redux-border-units' ).on( 'change', function() { $( this ).parents( '.redux-field:first' ).find( '.redux-border-input' ).change(); } ); el.find( '.redux-color-init' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ) ); el.find( '#' + e.target.getAttribute( 'data-id' ) + '-transparency' ).removeAttr( 'checked' ); }, clear: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ).parent().find( '.redux-color-init' ) ); } } ); el.find( '.redux-color' ).on( 'keyup', function() { var color = colorValidate( this ); if ( color && color !== $( this ).val() ) { $( this ).val( color ); } } ); // Replace and validate field on blur el.find( '.redux-color' ).on( 'blur', function() { var value = $( this ).val(); if ( colorValidate( this ) === value ) { if ( value.indexOf( "#" ) !== 0 ) { $( this ).val( $( this ).data( 'oldcolor' ) ); } } } ); // Store the old valid color on keydown el.find( '.redux-color' ).on( 'keydown', function() { $( this ).data( 'oldkeypress', $( this ).val() ); } ); } ); }; })( jQuery );fields/border/field_border.scss000066600000001557152141561100012614 0ustar00.redux-container-border { .select2-container { float: left; display: block; margin-right: 10px; } .select_wrapper { float: left; select { width: 80px; float: left; } width: inherit; } .field-border-input { margin-right: 10px; margin-bottom: 7px; } .wp-picker-container { margin-top: 2px; } } @media screen and (max-width: 782px) { .redux-container-border { .field-border-input { input { display: inline-block !important; width: 100px !important; } .add-on { padding: 7px 4px; font-size: 16px; line-height: 1.5; } } .select_wrapper { margin-top: 6px; } } } fields/slides/field_slides.min.js000066600000005646152141561100013056 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.slides=redux.field_objects.slides||{},a(document).ready(function(){}),redux.field_objects.slides.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-slides:visible")),a(b).each(function(){var b=a(this);redux.field_objects.media.init(b);var c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||(c.hasClass("redux-container-slides")&&c.addClass("redux-field-init"),c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".redux-slides-remove").live("click",function(){redux_change(a(this)),a(this).parent().siblings().find('input[type="text"]').val(""),a(this).parent().siblings().find("textarea").val(""),a(this).parent().siblings().find('input[type="hidden"]').val("");var b=a(this).parents(".redux-container-slides:first").find(".redux-slides-accordion-group").length;if(b>1)a(this).parents(".redux-slides-accordion-group:first").slideUp("medium",function(){a(this).remove()});else{var c=a(this).parent(".redux-slides-accordion").data("new-content-title");a(this).parents(".redux-slides-accordion-group:first").find(".remove-image").click(),a(this).parents(".redux-container-slides:first").find(".redux-slides-accordion-group:last").find(".redux-slides-header").text(c)}}),b.find(".redux-slides-add").off("click").click(function(){var b=a(this).prev().find(".redux-slides-accordion-group:last").clone(!0),c=a(b).find(".slide-title").attr("name").match(/[0-9]+(?!.*[0-9])/),d=1*c+1;a(b).find('input[type="text"], input[type="hidden"], textarea').each(function(){a(this).attr("name",jQuery(this).attr("name").replace(/[0-9]+(?!.*[0-9])/,d)).attr("id",a(this).attr("id").replace(/[0-9]+(?!.*[0-9])/,d)),a(this).val(""),a(this).hasClass("slide-sort")&&a(this).val(d)});var e=a(this).prev().data("new-content-title");a(b).find(".screenshot").removeAttr("style"),a(b).find(".screenshot").addClass("hide"),a(b).find(".screenshot a").attr("href",""),a(b).find(".remove-image").addClass("hide"),a(b).find(".redux-slides-image").attr("src","").removeAttr("id"),a(b).find("h3").text("").append(''+e+''),a(this).prev().append(b)}),b.find(".slide-title").keyup(function(b){var c=b.target.value;a(this).parents().eq(3).find(".redux-slides-header").text(c)}),b.find(".redux-slides-accordion").accordion({header:"> div > fieldset > h3",collapsible:!0,active:!1,heightStyle:"content",icons:{header:"ui-icon-plus",activeHeader:"ui-icon-minus"}}).sortable({axis:"y",handle:"h3",connectWith:".redux-slides-accordion",start:function(a,b){b.placeholder.height(b.item.height()),b.placeholder.width(b.item.width())},placeholder:"ui-state-highlight",stop:function(b,c){c.item.children("h3").triggerHandler("focusout");var d=a("input.slide-sort");d.each(function(b){a(this).val(b)})}})))})}}(jQuery);fields/slides/field_slides.js000066600000015126152141561100012266 0ustar00/*global redux_change, wp, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.slides = redux.field_objects.slides || {}; $( document ).ready( function() { //redux.field_objects.slides.init(); } ); redux.field_objects.slides.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-slides:visible' ); } $( selector ).each( function() { var el = $( this ); redux.field_objects.media.init(el); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-container-slides' ) ) { parent.addClass( 'redux-field-init' ); } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.redux-slides-remove' ).live( 'click', function() { redux_change( $( this ) ); $( this ).parent().siblings().find( 'input[type="text"]' ).val( '' ); $( this ).parent().siblings().find( 'textarea' ).val( '' ); $( this ).parent().siblings().find( 'input[type="hidden"]' ).val( '' ); var slideCount = $( this ).parents( '.redux-container-slides:first' ).find( '.redux-slides-accordion-group' ).length; if ( slideCount > 1 ) { $( this ).parents( '.redux-slides-accordion-group:first' ).slideUp( 'medium', function() { $( this ).remove(); } ); } else { var content_new_title = $( this ).parent( '.redux-slides-accordion' ).data( 'new-content-title' ); $( this ).parents( '.redux-slides-accordion-group:first' ).find( '.remove-image' ).click(); $( this ).parents( '.redux-container-slides:first' ).find( '.redux-slides-accordion-group:last' ).find( '.redux-slides-header' ).text( content_new_title ); } } ); //el.find( '.redux-slides-add' ).click( el.find( '.redux-slides-add' ).off('click').click( function() { var newSlide = $( this ).prev().find( '.redux-slides-accordion-group:last' ).clone( true ); var slideCount = $( newSlide ).find( '.slide-title' ).attr( "name" ).match( /[0-9]+(?!.*[0-9])/ ); var slideCount1 = slideCount * 1 + 1; $( newSlide ).find( 'input[type="text"], input[type="hidden"], textarea' ).each( function() { $( this ).attr( "name", jQuery( this ).attr( "name" ).replace( /[0-9]+(?!.*[0-9])/, slideCount1 ) ).attr( "id", $( this ).attr( "id" ).replace( /[0-9]+(?!.*[0-9])/, slideCount1 ) ); $( this ).val( '' ); if ( $( this ).hasClass( 'slide-sort' ) ) { $( this ).val( slideCount1 ); } } ); var content_new_title = $( this ).prev().data( 'new-content-title' ); $( newSlide ).find( '.screenshot' ).removeAttr( 'style' ); $( newSlide ).find( '.screenshot' ).addClass( 'hide' ); $( newSlide ).find( '.screenshot a' ).attr( 'href', '' ); $( newSlide ).find( '.remove-image' ).addClass( 'hide' ); $( newSlide ).find( '.redux-slides-image' ).attr( 'src', '' ).removeAttr( 'id' ); $( newSlide ).find( 'h3' ).text( '' ).append( '' + content_new_title + '' ); $( this ).prev().append( newSlide ); } ); el.find( '.slide-title' ).keyup( function( event ) { var newTitle = event.target.value; $( this ).parents().eq( 3 ).find( '.redux-slides-header' ).text( newTitle ); } ); el.find( ".redux-slides-accordion" ) .accordion( { header: "> div > fieldset > h3", collapsible: true, active: false, heightStyle: "content", icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" } } ) .sortable( { axis: "y", handle: "h3", connectWith: ".redux-slides-accordion", start: function( e, ui ) { ui.placeholder.height( ui.item.height() ); ui.placeholder.width( ui.item.width() ); }, placeholder: "ui-state-highlight", stop: function( event, ui ) { // IE doesn't register the blur when sorting // so trigger focusout handlers to remove .ui-state-focus ui.item.children( "h3" ).triggerHandler( "focusout" ); var inputs = $( 'input.slide-sort' ); inputs.each( function( idx ) { $( this ).val( idx ); } ); } } ); } ); }; })( jQuery );fields/slides/field_slides.css.map000066600000002560152141561100013214 0ustar00{ "version": 3, "mappings": "AACI,6DAAsC;EAClC,aAAa,EAAE,IAAI;EACnB,KAAK,EAAE,IAAI;AAGf,4CAAqB;EACjB,aAAa,EAAE,CAAC;AAGpB;mCACY;EACR,KAAK,EAAE,IAAI;AAGf,qDAA8B;EAC1B,MAAM,EAAE,4BAA4B;EACpC,aAAa,EAAE,cAAc;EAC7B,UAAU,EAAE,cAAc;EAC1B,aAAa,EAAE,IAAI;EACnB,UAAU,EAAE,OAAO;EACnB,OAAO,EAAE,GAAG;EAEZ,wDAAG;IACC,MAAM,EAAE,iBAAiB;IACzB,MAAM,EAAE,eAAe;IACvB,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,iBAAiB;IAC1B,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,eAAe;IAC5B,gBAAgB,EAAE,OAAO;IACzB,gBAAgB,EAAE,0CAA0C;IAC5D,gBAAgB,EAAE,2CAA2C;IAC7D,gBAAgB,EAAE,yCAAyC;IAC3D,gBAAgB,EAAE,2EAA2E;IAC7F,gBAAgB,EAAE,8CAA8C;IAChE,gBAAgB,EAAE,sCAAsC;IACxD,QAAQ,EAAE,MAAM;IAChB,qBAAqB,EAAE,GAAG;IAC1B,kBAAkB,EAAE,GAAG;IACvB,aAAa,EAAE,GAAG;IAClB,eAAe,EAAE,kBAAkB;IACnC,kBAAkB,EAAE,kBAAkB;IACtC,UAAU,EAAE,kBAAkB;IAC9B,UAAU,EAAE,MAAM;AAI1B,mEAA4C;EACxC,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,GAAG;EACZ,UAAU,EAAE,IAAI;EAChB,aAAa,EAAE,IAAI;EACnB,MAAM,EAAE,iBAAiB;EACzB,UAAU,EAAE,OAAO;EACnB,kBAAkB,EAAE,GAAG;EACvB,oBAAoB,EAAE,GAAG;EACzB,qBAAqB,EAAE,GAAG;EAC1B,aAAa,EAAE,GAAG;AAGtB,yCAAkB;EACd,KAAK,EAAE,KAAK;EACZ,YAAY,EAAE,GAAG;EACjB,OAAO,EAAE,KAAK;EACd,aAAa,EAAE,IAAI;AAGvB,4CAAqB;EACjB,KAAK,EAAE,kBAAkB;EACzB,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,GAAG;AAGnB,4CAAqB;EACjB,WAAW,EAAE,IAAI;AAGrB,gDAAyB;EACrB,aAAa,EAAE,IAAI;AAEvB,6BAAM;EACF,KAAK,EAAE,eAAe;;AAM1B,0EAA4D;EACxD,OAAO,EAAE,IAAI", "sources": ["field_slides.scss"], "names": [], "file": "field_slides.css" }fields/slides/field_slides.scss000066600000004635152141561100012630 0ustar00.redux-container-slides { .redux-slides-list .select2-container { margin-bottom: 10px; width: 100%; } .ui-accordion-header { margin-bottom: 0; } .full-text, .large-text { width: 100%; } .redux-slides-accordion-group { border: 1px solid #dfdfdf !important; border-radius: 3px !important; margin-top: 0px !important; margin-bottom: 10px; background: #f9f9f9; padding: 5px; h3 { border: 1px solid #dfdfdf; cursor: move !important; font-weight: bold; padding: 0 10px !important; height: 40px; line-height: 40px !important; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); overflow: hidden; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -moz-box-shadow: inset 0 1px 0 #fff; -webkit-box-shadow: inset 0 1px 0 #fff; box-shadow: inset 0 1px 0 #fff; text-align: center; } } #redux-slides-accordion .redux-slides-image { height: 250px; padding: 5px; margin-top: 10px; margin-bottom: 10px; border: 1px solid #e3e3e3; background: #f7f7f7; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .redux-slides-add { float: right; margin-right: 10%; display: block; margin-bottom: 10px; } .redux-slides-remove { color: #ef521d !important; float: right; margin-top: 5px; } .redux-slides-header { font-weight: bold; } .redux_slides_add_remove { margin-bottom: 10px; } input { width: 100% !important; } } .wp-customizer { .redux-container-slides .ui-accordion .ui-accordion-content { padding: 10px; } } fields/slides/field_slides.css000066600000003647152141561100012447 0ustar00.redux-container-slides .redux-slides-list .select2-container{margin-bottom:10px;width:100%}.redux-container-slides .ui-accordion-header{margin-bottom:0}.redux-container-slides .full-text,.redux-container-slides .large-text{width:100%}.redux-container-slides .redux-slides-accordion-group{border:1px solid #dfdfdf !important;border-radius:3px !important;margin-top:0 !important;margin-bottom:10px;background:#f9f9f9;padding:5px}.redux-container-slides .redux-slides-accordion-group h3{border:1px solid #dfdfdf;cursor:move !important;font-weight:bold;padding:0 10px !important;height:40px;line-height:40px !important;background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec);overflow:hidden;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;text-align:center}.redux-container-slides #redux-slides-accordion .redux-slides-image{height:250px;padding:5px;margin-top:10px;margin-bottom:10px;border:1px solid #e3e3e3;background:#f7f7f7;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.redux-container-slides .redux-slides-add{float:right;margin-right:10%;display:block;margin-bottom:10px}.redux-container-slides .redux-slides-remove{color:#ef521d !important;float:right;margin-top:5px}.redux-container-slides .redux-slides-header{font-weight:bold}.redux-container-slides .redux_slides_add_remove{margin-bottom:10px}.redux-container-slides input{width:100% !important}.wp-customizer .redux-container-slides .ui-accordion .ui-accordion-content{padding:10px}fields/slides/field_slides.php000066600000036765152141561100012455 0ustar00. * * @package ReduxFramework * @subpackage Field_slides * @author Luciano "WebCaos" Ubertini * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( !defined ( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( !class_exists ( 'ReduxFramework_slides' ) ) { /** * Main ReduxFramework_slides class * * @since 1.0.0 */ class ReduxFramework_slides { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct ( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render () { $defaults = array( 'show' => array( 'title' => true, 'description' => true, 'url' => true, ), 'content_title' => __ ( 'Slide', 'redux-framework' ) ); $this->field = wp_parse_args ( $this->field, $defaults ); echo '
    '; $x = 0; $multi = ( isset ( $this->field[ 'multi' ] ) && $this->field[ 'multi' ] ) ? ' multiple="multiple"' : ""; if ( isset ( $this->value ) && is_array ( $this->value ) && !empty ( $this->value ) ) { $slides = $this->value; foreach ( $slides as $slide ) { if ( empty ( $slide ) ) { continue; } $defaults = array( 'title' => '', 'description' => '', 'sort' => '', 'url' => '', 'image' => '', 'thumb' => '', 'attachment_id' => '', 'height' => '', 'width' => '', 'select' => array(), ); $slide = wp_parse_args ( $slide, $defaults ); if ( empty ( $slide[ 'thumb' ] ) && !empty ( $slide[ 'attachment_id' ] ) ) { $img = wp_get_attachment_image_src ( $slide[ 'attachment_id' ], 'full' ); $slide[ 'image' ] = $img[ 0 ]; $slide[ 'width' ] = $img[ 1 ]; $slide[ 'height' ] = $img[ 2 ]; } echo '

    ' . $slide[ 'title' ] . '

    '; $hide = ''; if ( empty ( $slide[ 'image' ] ) ) { $hide = ' hide'; } echo '
    '; echo ''; echo ''; echo ''; echo '
    '; echo '
    '; echo '' . __ ( 'Upload', 'redux-framework' ) . ''; $hide = ''; if ( empty ( $slide[ 'image' ] ) || $slide[ 'image' ] == '' ) { $hide = ' hide'; } echo '' . __ ( 'Remove', 'redux-framework' ) . ''; echo '
    ' . "\n"; echo '
      '; if ( $this->field[ 'show' ][ 'title' ] ) { $title_type = "text"; } else { $title_type = "hidden"; } $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'title' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'title' ] ) : __ ( 'Title', 'redux-framework' ); echo '
    • '; if ( $this->field[ 'show' ][ 'description' ] ) { $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'description' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'description' ] ) : __ ( 'Description', 'redux-framework' ); echo '
    • '; } $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'url' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'url' ] ) : __ ( 'URL', 'redux-framework' ); if ( $this->field[ 'show' ][ 'url' ] ) { $url_type = "text"; } else { $url_type = "hidden"; } echo '
    • '; echo '
    • '; echo '
    • '; echo ''; echo ''; echo ''; echo '
    • '; echo '
    • ' . __ ( 'Delete', 'redux-framework' ) . '
    • '; echo '
    '; $x ++; } } if ( $x == 0 ) { echo '

    ' . esc_attr ( sprintf ( __ ( 'New %s', 'redux-framework' ), $this->field[ 'content_title' ] ) ) . '

    '; $hide = ' hide'; echo '
    '; echo ''; echo ''; echo ''; echo '
    '; //Upload controls DIV echo '
    '; //If the user has WP3.5+ show upload/remove button echo '' . __ ( 'Upload', 'redux-framework' ) . ''; echo '' . __ ( 'Remove', 'redux-framework' ) . ''; echo '
    ' . "\n"; echo '
      '; if ( $this->field[ 'show' ][ 'title' ] ) { $title_type = "text"; } else { $title_type = "hidden"; } $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'title' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'title' ] ) : __ ( 'Title', 'redux-framework' ); echo '
    • '; if ( $this->field[ 'show' ][ 'description' ] ) { $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'description' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'description' ] ) : __ ( 'Description', 'redux-framework' ); echo '
    • '; } $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'url' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'url' ] ) : __ ( 'URL', 'redux-framework' ); if ( $this->field[ 'show' ][ 'url' ] ) { $url_type = "text"; } else { $url_type = "hidden"; } echo '
    • '; echo '
    • '; echo '
    • '; echo ''; echo ''; echo '
    • '; echo ''; echo '
    • ' . __ ( 'Delete', 'redux-framework' ) . '
    • '; echo '
    '; } echo '
    ' . sprintf ( __ ( 'Add %s', 'redux-framework' ), $this->field[ 'content_title' ] ) . '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue () { if ( function_exists( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } else { wp_enqueue_script( 'media-upload' ); } if ($this->parent->args['dev_mode']){ wp_enqueue_style ('redux-field-media-css'); wp_enqueue_style ( 'redux-field-slides-css', ReduxFramework::$_url . 'inc/fields/slides/field_slides.css', array(), time (), 'all' ); } wp_enqueue_script( 'redux-field-media-js', ReduxFramework::$_url . 'assets/js/media/media' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); wp_enqueue_script ( 'redux-field-slides-js', ReduxFramework::$_url . 'inc/fields/slides/field_slides' . Redux_Functions::isMin () . '.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-sortable', 'redux-field-media-js' ), time (), true ); } } }fields/ace_editor/field_ace_editor.min.js000066600000001754152141561100014500 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.ace_editor=redux.field_objects.ace_editor||{},redux.field_objects.ace_editor.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-ace_editor:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".ace-editor").each(function(c,d){var e=d,f=JSON.parse(a(this).parent().find(".localize_data").val()),g=a(d).attr("data-editor"),h=ace.edit(g);h.setTheme("ace/theme/"+jQuery(d).attr("data-theme")),h.getSession().setMode("ace/mode/"+a(d).attr("data-mode"));var i="";i=b.hasClass("redux-field-container")?b.attr("data-id"):b.parents(".redux-field-container:first").attr("data-id"),h.setOptions(f),h.on("change",function(b){a("#"+e.id).val(h.getSession().getValue()),redux_change(a(d)),h.resize()})}))})}}(jQuery);fields/ace_editor/field_ace_editor.php000066600000012404152141561100014063 0ustar00. * * @package Redux_Field * @subpackage ACE_Editor * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_ace_editor' ) ) { class ReduxFramework_ace_editor { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since ReduxFramework 1.0.0 */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; if ( is_array( $this->value ) ) { $this->value = ''; } else { $this->value = trim( $this->value ); } if ( ! empty( $this->field['options'] ) ) { $this->field['args'] = $this->field['options']; unset( $this->field['options'] ); } } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { if ( ! isset( $this->field['mode'] ) ) { $this->field['mode'] = 'javascript'; } if ( ! isset( $this->field['theme'] ) ) { $this->field['theme'] = 'monokai'; } $params = array( 'minLines' => 10, 'maxLines' => 30, ); if ( isset( $this->field['args'] ) && ! empty( $this->field['args'] ) && is_array( $this->field['args'] ) ) { $params = wp_parse_args( $this->field['args'], $params ); } ?>
    value ); ?>
    parent->args['dev_mode'] ) { if ( ! wp_style_is( 'redux-field-ace-editor-css' ) ) { wp_enqueue_style( 'redux-field-ace-editor-css', ReduxFramework::$_url . 'inc/fields/ace_editor/field_ace_editor.css', array(), time(), 'all' ); } } if ( ! wp_script_is( 'ace-editor-js' ) ) { Redux_CDN::enqueue_script( 'ace-editor-js', '//cdn.jsdelivr.net/ace/1.1.9/min/ace.js', array( 'jquery' ), '1.1.9', true ); } if ( ! wp_script_is( 'redux-field-ace-editor-js' ) ) { wp_enqueue_script( 'redux-field-ace-editor-js', ReduxFramework::$_url . 'inc/fields/ace_editor/field_ace_editor' . Redux_Functions::isMin() . '.js', array( 'jquery', 'ace-editor-js', 'redux-js' ), time(), true ); } } } }fields/ace_editor/field_ace_editor.css.map000066600000000423152141561100014636 0ustar00{ "version": 3, "mappings": "AACI,wCAAa;EACT,QAAQ,EAAE,MAAM;AAGpB,uCAAY;EACR,MAAM,EAAE,KAAK;EACb,qBAAqB,EAAE,GAAG;EAC1B,kBAAkB,EAAE,GAAG;EACvB,aAAa,EAAE,GAAG;AAGtB,uCAAY;EACR,OAAO,EAAE,YAAY", "sources": ["field_ace_editor.scss"], "names": [], "file": "field_ace_editor.css" }fields/ace_editor/field_ace_editor.css000066600000000356152141561100014067 0ustar00.redux-container-ace_editor .ace-wrapper{position:static}.redux-container-ace_editor .ace_editor{height:200px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.redux-container-ace_editor .ace_gutter{z-index:1 !important}fields/ace_editor/field_ace_editor.js000066600000004575152141561100013722 0ustar00/*global jQuery, document, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.ace_editor = redux.field_objects.ace_editor || {}; redux.field_objects.ace_editor.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-ace_editor:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.ace-editor' ).each( function( index, element ) { var area = element; var params = JSON.parse( $( this ).parent().find( '.localize_data' ).val() ); var editor = $( element ).attr( 'data-editor' ); var aceeditor = ace.edit( editor ); aceeditor.setTheme( "ace/theme/" + jQuery( element ).attr( 'data-theme' ) ); aceeditor.getSession().setMode( "ace/mode/" + $( element ).attr( 'data-mode' ) ); var parent = ''; if ( el.hasClass( 'redux-field-container' ) ) { parent = el.attr( 'data-id' ); } else { parent = el.parents( '.redux-field-container:first' ).attr( 'data-id' ); } aceeditor.setOptions( params ); aceeditor.on( 'change', function( e ) { $( '#' + area.id ).val( aceeditor.getSession().getValue() ); redux_change( $( element ) ); aceeditor.resize(); } ); } ); } ); }; })( jQuery );fields/ace_editor/field_ace_editor.scss000066600000000445152141561110014252 0ustar00.redux-container-ace_editor { .ace-wrapper { position: static; } .ace_editor { height: 200px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .ace_gutter { z-index: 1 !important; } } fields/background/field_background.css.map000066600000001115152141561110014700 0ustar00{ "version": 3, "mappings": "AAEQ;;;;;;;;;;;uEAWgC;EAC5B,KAAK,EAAC,gBAAgB;EACtB,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,GAAG;AAItB,2DAAoB;EAChB,OAAO,EAAC,KAAK;EACb,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,UAAU;EAClB,MAAM,EAAC,oBAAoB;AAG/B,0DAAmB;EACf,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,IAAI;AAGvB,4DAAqB;EACjB,aAAa,EAAE,IAAI;AAGvB,+CAAQ;EACJ,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,GAAG;AAKtB,yDAAsB;EAClB,MAAM,EAAE,IAAI;EACZ,UAAU,EAAC,GAAG;EACd,WAAW,EAAE,GAAG;EAChB,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,CAAC;;AAOpB,w2BAAqW;EACjW,KAAK,EAAE,eAAe", "sources": ["field_background.scss"], "names": [], "file": "field_background.css" }fields/background/field_background.scss000066600000003320152141561110014307 0ustar00.redux-main { .redux-container-background { .redux-background-position, .redux-background-position select, .redux-background-attachment, .redux-background-attachment select, .redux-background-clip, .redux-background-clip select, .redux-background-origin, .redux-background-origin select, .redux-background-size, .redux-background-size select, .redux-background-repeat, .redux-background-repeat select { width:200px !important; margin-right: 10px; margin-bottom: 7px; } .background-preview { display:block; width: 100%; margin: 5px 0 10px; border:1px dotted lightgray; } .select2-container { margin-right: 10px; margin-bottom: 10px; } .wp-picker-container { margin-bottom: 10px; } .upload { width: 100%; margin-bottom: 8px; } } .redux-container-select { li.ui-state-highlight { height: 20px; margin-top:2px; margin-left: 5px; width: 64px; margin-bottom: 0; } } } .wp-customizer { .redux-container-background { .redux-background-position, .redux-background-position select, .redux-background-attachment, .redux-background-attachment select, .redux-background-clip, .redux-background-clip select, .redux-background-origin, .redux-background-origin select, .redux-background-size, .redux-background-size select, .redux-background-repeat, .redux-background-repeat select { width: 100% !important; } } } fields/background/field_background.min.js000066600000012615152141561110014541 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.background=redux.field_objects.background||{},redux.field_objects.background.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-background:visible")),a(b).each(function(){var b=a(this),c=b;if(b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),!c.is(":hidden")&&c.hasClass("redux-field-init")){c.removeClass("redux-field-init"),b.find(".redux-remove-background").unbind("click").on("click",function(b){return b.preventDefault(),redux.field_objects.background.removeImage(a(this).parents(".redux-container-background:first")),!1}),b.find(".redux-background-upload").unbind().on("click",function(b){redux.field_objects.background.addImage(b,a(this).parents(".redux-container-background:first"))}),b.find(".redux-background-input").on("change",function(){redux.field_objects.background.preview(a(this))}),b.find(".redux-color").wpColorPicker({change:function(b,c){a(this).val(c.color.toString()),redux_change(a(this)),a("#"+b.target.id+"-transparency").removeAttr("checked"),redux.field_objects.background.preview(a(this))},clear:function(b,c){a(this).val(c.color.toString()),redux_change(a(this).parent().find(".redux-color-init")),redux.field_objects.background.preview(a(this))}}),b.find(".redux-color").on("blur",function(){var c=a(this).val(),d="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(d+"-transparency").attr("checked","checked")):(colorValidate(this)===c&&0!==c.indexOf("#")&&a(this).val(a(this).data("oldcolor")),b.find(d+"-transparency").removeAttr("checked"))}),b.find(".redux-color").on("focus",function(){a(this).data("oldcolor",a(this).val())}),b.find(".redux-color").on("keyup",function(){var c=a(this).val(),d=colorValidate(this),e="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(e+"-transparency").attr("checked","checked")):(b.find(e+"-transparency").removeAttr("checked"),d&&d!==a(this).val()&&a(this).val(d))}),b.find(".color-transparency").on("click",function(){if(a(this).is(":checked"))b.find(".redux-saved-color").val(a("#"+a(this).data("id")).val()),b.find("#"+a(this).data("id")).val("transparent"),b.find("#"+a(this).data("id")).parent().parent().find(".wp-color-result").css("background-color","transparent");else if("transparent"===b.find("#"+a(this).data("id")).val()){var c=a(".redux-saved-color").val();""===c&&(c=a("#"+a(this).data("id")).data("default-color")),b.find("#"+a(this).data("id")).parent().parent().find(".wp-color-result").css("background-color",c),b.find("#"+a(this).data("id")).val(c)}redux.field_objects.background.preview(a(this)),redux_change(a(this))});var d={width:"resolve",triggerChange:!0,allowClear:!0},e=b.find(".select2_params");if(e.size()>0){var f=e.val();f=JSON.parse(f),d=a.extend({},d,f)}b.find(" .redux-background-repeat, .redux-background-clip, .redux-background-origin, .redux-background-size, .redux-background-attachment, .redux-background-position").select2(d)}})},redux.field_objects.background.preview=function(b){var c=a(b).parents(".redux-container-background:first"),d=a(c).find(".background-preview");if(d){var e=!0,f="height:"+d.height()+"px;";a(c).find(".redux-background-input").each(function(){var b=a(this).serializeArray();b=b[0],b&&-1!=b.name.indexOf("[background-")&&""!==b.value&&(e=!1,b.name=b.name.split("[background-"),b.name="background-"+b.name[1].replace("]",""),f+="background-image"==b.name?b.name+':url("'+b.value+'");':b.name+":"+b.value+";")}),e?d.slideUp():d.attr("style",f).fadeIn()}},redux.field_objects.background.addImage=function(b,c){b.preventDefault();var d,e=a(this);return d?void d.open():(d=wp.media({multiple:!1,library:{},title:e.data("choose"),button:{text:e.data("update")}}),d.on("select",function(){var b=d.state().get("selection").first();if(d.close(),"image"===b.attributes.type){c.find(".upload").val(b.attributes.url),c.find(".upload-id").val(b.attributes.id),c.find(".upload-height").val(b.attributes.height),c.find(".upload-width").val(b.attributes.width),redux_change(a(c).find(".upload-id"));var e=b.attributes.url;if("undefined"!=typeof b.attributes.sizes&&"undefined"!=typeof b.attributes.sizes.thumbnail)e=b.attributes.sizes.thumbnail.url;else if("undefined"!=typeof b.attributes.sizes){var f=b.attributes.height;for(var g in b.attributes.sizes){var h=b.attributes.sizes[g];h.height').slideDown("fast"),c.find(".redux-remove-background").removeClass("hide"),c.find(".redux-background-input-properties").slideDown(),redux.field_objects.background.preview(c.find(".upload"))}}),void d.open())},redux.field_objects.background.removeImage=function(b){if(b.find(".redux-remove-background").addClass("hide")){b.find(".redux-remove-background").addClass("hide"),b.find(".upload").val(""),b.find(".upload-id").val(""),b.find(".upload-height").val(""),b.find(".upload-width").val(""),redux_change(a(b).find(".upload-id")),b.find(".redux-background-input-properties").hide();var c=b.find(".screenshot");c.slideUp(),b.find(".remove-file").unbind(),a(".section-upload .upload-notice").length>0&&a(".redux-background-upload").remove()}}}(jQuery);fields/background/field_background.js000066600000032323152141561110013755 0ustar00/** * Redux Background * Dependencies : jquery, wp media uploader * Feature added by : Dovy Paukstys * Date : 07 Jan 2014 */ /*global redux_change, wp, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.background = redux.field_objects.background || {}; redux.field_objects.background.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-background:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } // Remove the image button el.find( '.redux-remove-background' ).unbind( 'click' ).on( 'click', function( e ) { e.preventDefault(); redux.field_objects.background.removeImage( $( this ).parents( '.redux-container-background:first' ) ); return false; } ); // Upload media button el.find( '.redux-background-upload' ).unbind().on( 'click', function( event ) { redux.field_objects.background.addImage( event, $( this ).parents( '.redux-container-background:first' ) ); } ); el.find( '.redux-background-input' ).on( 'change', function() { redux.field_objects.background.preview( $( this ) ); } ); el.find( '.redux-color' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ) ); $( '#' + e.target.id + '-transparency' ).removeAttr( 'checked' ); redux.field_objects.background.preview( $( this ) ); }, clear: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ).parent().find( '.redux-color-init' ) ); redux.field_objects.background.preview( $( this ) ); } } ); // Replace and validate field on blur el.find( '.redux-color' ).on( 'blur', function() { var value = $( this ).val(); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { if ( colorValidate( this ) === value ) { if ( value.indexOf( "#" ) !== 0 ) { $( this ).val( $( this ).data( 'oldcolor' ) ); } } el.find( id + '-transparency' ).removeAttr( 'checked' ); } } ); el.find( '.redux-color' ).on( 'focus', function() { $( this ).data( 'oldcolor', $( this ).val() ); } ); el.find( '.redux-color' ).on( 'keyup', function() { var value = $( this ).val(); var color = colorValidate( this ); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { el.find( id + '-transparency' ).removeAttr( 'checked' ); if ( color && color !== $( this ).val() ) { $( this ).val( color ); } } } ); // When transparency checkbox is clicked el.find( '.color-transparency' ).on( 'click', function() { if ( $( this ).is( ":checked" ) ) { el.find( '.redux-saved-color' ).val( $( '#' + $( this ).data( 'id' ) ).val() ); el.find( '#' + $( this ).data( 'id' ) ).val( 'transparent' ); el.find( '#' + $( this ).data( 'id' ) ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); } else { if ( el.find( '#' + $( this ).data( 'id' ) ).val() === 'transparent' ) { var prevColor = $( '.redux-saved-color' ).val(); if ( prevColor === '' ) { prevColor = $( '#' + $( this ).data( 'id' ) ).data( 'default-color' ); } el.find( '#' + $( this ).data( 'id' ) ).parent().parent().find( '.wp-color-result' ).css( 'background-color', prevColor ); el.find( '#' + $( this ).data( 'id' ) ).val( prevColor ); } } redux.field_objects.background.preview( $( this ) ); redux_change( $( this ) ); } ); var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; var select2_handle = el.find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } el.find( " .redux-background-repeat, .redux-background-clip, .redux-background-origin, .redux-background-size, .redux-background-attachment, .redux-background-position" ).select2( default_params ); } ); }; // Update the background preview redux.field_objects.background.preview = function( selector ) { var parent = $( selector ).parents( '.redux-container-background:first' ); var preview = $( parent ).find( '.background-preview' ); if ( !preview ) { // No preview present return; } var hide = true; var css = 'height:' + preview.height() + 'px;'; $( parent ).find( '.redux-background-input' ).each( function() { var data = $( this ).serializeArray(); data = data[0]; if ( data && data.name.indexOf( '[background-' ) != -1 ) { if ( data.value !== "" ) { hide = false; data.name = data.name.split( '[background-' ); data.name = 'background-' + data.name[1].replace( ']', '' ); if ( data.name == "background-image" ) { css += data.name + ':url("' + data.value + '");'; } else { css += data.name + ':' + data.value + ';'; } } } } ); if ( !hide ) { preview.attr( 'style', css ).fadeIn(); } else { preview.slideUp(); } }; // Add a file via the wp.media function redux.field_objects.background.addImage = function( event, selector ) { event.preventDefault(); var frame; var jQueryel = $( this ); // If the media frame already exists, reopen it. if ( frame ) { frame.open(); return; } // Create the media frame. frame = wp.media( { multiple: false, library: { //type: 'image' //Only allow images }, // Set the title of the modal. title: jQueryel.data( 'choose' ), // Customize the submit button. button: { // Set the text of the button. text: jQueryel.data( 'update' ) // Tell the button not to close the modal, since we're // going to refresh the page when the image is selected. } } ); // When an image is selected, run a callback. frame.on( 'select', function() { // Grab the selected attachment. var attachment = frame.state().get( 'selection' ).first(); frame.close(); //console.log(attachment.attributes.type); if ( attachment.attributes.type !== "image" ) { return; } selector.find( '.upload' ).val( attachment.attributes.url ); selector.find( '.upload-id' ).val( attachment.attributes.id ); selector.find( '.upload-height' ).val( attachment.attributes.height ); selector.find( '.upload-width' ).val( attachment.attributes.width ); redux_change( $( selector ).find( '.upload-id' ) ); var thumbSrc = attachment.attributes.url; if ( typeof attachment.attributes.sizes !== 'undefined' && typeof attachment.attributes.sizes.thumbnail !== 'undefined' ) { thumbSrc = attachment.attributes.sizes.thumbnail.url; } else if ( typeof attachment.attributes.sizes !== 'undefined' ) { var height = attachment.attributes.height; for ( var key in attachment.attributes.sizes ) { var object = attachment.attributes.sizes[key]; if ( object.height < height ) { height = object.height; thumbSrc = object.url; } } } else { thumbSrc = attachment.attributes.icon; } selector.find( '.upload-thumbnail' ).val( thumbSrc ); if ( !selector.find( '.upload' ).hasClass( 'noPreview' ) ) { selector.find( '.screenshot' ).empty().hide().append( '' ).slideDown( 'fast' ); } selector.find( '.redux-remove-background' ).removeClass( 'hide' );//show "Remove" button selector.find( '.redux-background-input-properties' ).slideDown(); redux.field_objects.background.preview( selector.find( '.upload' ) ); } ); // Finally, open the modal. frame.open(); }; // Update the background preview redux.field_objects.background.removeImage = function( selector ) { // This shouldn't have been run... if ( !selector.find( '.redux-remove-background' ).addClass( 'hide' ) ) { return; } selector.find( '.redux-remove-background' ).addClass( 'hide' ); //hide "Remove" button selector.find( '.upload' ).val( '' ); selector.find( '.upload-id' ).val( '' ); selector.find( '.upload-height' ).val( '' ); selector.find( '.upload-width' ).val( '' ); redux_change( $( selector ).find( '.upload-id' ) ); selector.find( '.redux-background-input-properties' ).hide(); var screenshot = selector.find( '.screenshot' ); // Hide the screenshot screenshot.slideUp(); selector.find( '.remove-file' ).unbind(); // We don't display the upload button if .upload-notice is present // This means the user doesn't have the WordPress 3.5 Media Library Support if ( $( '.section-upload .upload-notice' ).length > 0 ) { $( '.redux-background-upload' ).remove(); } }; })( jQuery ); fields/background/field_background.php000066600000055257152141561110014143 0ustar00. * * @package ReduxFramework * @subpackage Field_Background * @author Dovy Paukstys * @version 3.1.5 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_background' ) ) { /** * Main ReduxFramework_background class * * @since 3.1.5 */ class ReduxFramework_background { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 3.1.5 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $defaults = array( 'background-color' => true, 'background-repeat' => true, 'background-attachment' => true, 'background-position' => true, 'background-image' => true, 'background-gradient' => false, 'background-clip' => false, 'background-origin' => false, 'background-size' => true, 'preview_media' => false, 'preview' => true, 'preview_height' => '200px', 'transparent' => true, ); $this->field = wp_parse_args( $this->field, $defaults ); // No errors please $defaults = array( 'background-color' => '', 'background-repeat' => '', 'background-attachment' => '', 'background-position' => '', 'background-image' => '', 'background-clip' => '', 'background-origin' => '', 'background-size' => '', 'media' => array(), ); $this->value = wp_parse_args( $this->value, $defaults ); $defaults = array( 'id' => '', 'width' => '', 'height' => '', 'thumbnail' => '', ); $this->value['media'] = wp_parse_args( $this->value['media'], $defaults ); // select2 args if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } if ( $this->field['background-color'] === true ) { if ( isset( $this->value['color'] ) && empty( $this->value['background-color'] ) ) { $this->value['background-color'] = $this->value['color']; } echo ''; echo ''; if ( ! isset( $this->field['transparent'] ) || $this->field['transparent'] !== false ) { $tChecked = ""; if ( $this->value['background-color'] == "transparent" ) { $tChecked = ' checked="checked"'; } echo ''; } if ( $this->field['background-repeat'] === true || $this->field['background-position'] === true || $this->field['background-attachment'] === true ) { echo '
    '; } } if ( $this->field['background-repeat'] === true ) { $array = array( 'no-repeat' => 'No Repeat', 'repeat' => 'Repeat All', 'repeat-x' => 'Repeat Horizontally', 'repeat-y' => 'Repeat Vertically', 'inherit' => 'Inherit', ); echo ''; } if ( $this->field['background-clip'] === true ) { $array = array( 'inherit' => 'Inherit', 'border-box' => 'Border Box', 'content-box' => 'Content Box', 'padding-box' => 'Padding Box', ); echo ''; } if ( $this->field['background-origin'] === true ) { $array = array( 'inherit' => 'Inherit', 'border-box' => 'Border Box', 'content-box' => 'Content Box', 'padding-box' => 'Padding Box', ); echo ''; } if ( $this->field['background-size'] === true ) { $array = array( 'inherit' => 'Inherit', 'cover' => 'Cover', 'contain' => 'Contain', ); echo ''; } if ( $this->field['background-attachment'] === true ) { $array = array( 'fixed' => 'Fixed', 'scroll' => 'Scroll', 'inherit' => 'Inherit', ); echo ''; } if ( $this->field['background-position'] === true ) { $array = array( 'left top' => 'Left Top', 'left center' => 'Left center', 'left bottom' => 'Left Bottom', 'center top' => 'Center Top', 'center center' => 'Center Center', 'center bottom' => 'Center Bottom', 'right top' => 'Right Top', 'right center' => 'Right center', 'right bottom' => 'Right Bottom', ); echo ''; } if ( $this->field['background-image'] === true ) { echo '
    '; if ( empty( $this->value ) && ! empty( $this->field['default'] ) ) { // If there are standard values and value is empty if ( is_array( $this->field['default'] ) ) { if ( ! empty( $this->field['default']['media']['id'] ) ) { $this->value['media']['id'] = $this->field['default']['media']['id']; } else if ( ! empty( $this->field['default']['id'] ) ) { $this->value['media']['id'] = $this->field['default']['id']; } if ( ! empty( $this->field['default']['url'] ) ) { $this->value['background-image'] = $this->field['default']['url']; } else if ( ! empty( $this->field['default']['media']['url'] ) ) { $this->value['background-image'] = $this->field['default']['media']['url']; } else if ( ! empty( $this->field['default']['background-image'] ) ) { $this->value['background-image'] = $this->field['default']['background-image']; } } else { if ( is_numeric( $this->field['default'] ) ) { // Check if it's an attachment ID $this->value['media']['id'] = $this->field['default']; } else { // Must be a URL $this->value['background-image'] = $this->field['default']; } } } if ( empty( $this->value['background-image'] ) && ! empty( $this->value['media']['id'] ) ) { $img = wp_get_attachment_image_src( $this->value['media']['id'], 'full' ); $this->value['background-image'] = $img[0]; $this->value['media']['width'] = $img[1]; $this->value['media']['height'] = $img[2]; } $hide = 'hide '; if ( ( isset( $this->field['preview_media'] ) && $this->field['preview_media'] === false ) ) { $this->field['class'] .= " noPreview"; } if ( ( ! empty( $this->field['background-image'] ) && $this->field['background-image'] === true ) || isset( $this->field['preview'] ) && $this->field['preview'] === false ) { $hide = ''; } $placeholder = isset( $this->field['placeholder'] ) ? $this->field['placeholder'] : __( 'No media selected', 'redux-framework' ); echo ''; echo ''; echo ''; echo ''; echo ''; //Preview $hide = ''; if ( ( isset( $this->field['preview_media'] ) && $this->field['preview_media'] === false ) || empty( $this->value['background-image'] ) ) { $hide = 'hide '; } if ( empty( $this->value['media']['thumbnail'] ) && ! empty( $this->value['background-image'] ) ) { // Just in case if ( ! empty( $this->value['media']['id'] ) ) { $image = wp_get_attachment_image_src( $this->value['media']['id'], array( 150, 150 ) ); $this->value['media']['thumbnail'] = $image[0]; } else { $this->value['media']['thumbnail'] = $this->value['background-image']; } } echo '
    '; echo ''; echo ''; echo ''; echo '
    '; //Upload controls DIV echo '
    '; //If the user has WP3.5+ show upload/remove button echo '' . __( 'Upload', 'redux-framework' ) . ''; $hide = ''; if ( empty( $this->value['background-image'] ) || $this->value['background-image'] == '' ) { $hide = ' hide'; } echo '' . __( 'Remove', 'redux-framework' ) . ''; echo '
    '; } /** * Preview * */ if ( ! isset( $this->field['preview'] ) || $this->field['preview'] !== false ): $css = $this->getCSS(); if ( empty( $css ) ) { $css = "display:none;"; } $css .= "height: " . $this->field['preview_height'] . ";"; echo '

     

    '; endif; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ( function_exists( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } else { if (!wp_script_is ( 'media-upload' )) { wp_enqueue_script( 'media-upload' ); } } if (!wp_style_is ( 'select2-css' )) { wp_enqueue_style( 'select2-css' ); } if (!wp_style_is ( 'wp-color-picker' )) { wp_enqueue_style( 'wp-color-picker' ); } if (!wp_script_is ( 'redux-field-background-js' )) { wp_enqueue_script( 'redux-field-background-js', ReduxFramework::$_url . 'inc/fields/background/field_background' . Redux_Functions::isMin() . '.js', array( 'jquery', 'wp-color-picker', 'select2-js', 'redux-js' ), time(), true ); } if ($this->parent->args['dev_mode']) { if (!wp_style_is ( 'redux-field-background-css' )) { wp_enqueue_style( 'redux-field-background-css', ReduxFramework::$_url . 'inc/fields/background/field_background.css', array(), time(), 'all' ); } if (!wp_style_is ( 'redux-color-picker-css' )) { wp_enqueue_style( 'redux-color-picker-css' ); } } } public static function getCSS( $value = array() ) { $css = ''; if ( ! empty( $value ) && is_array( $value ) ) { foreach ( $value as $key => $value ) { if ( ! empty( $value ) && $key != "media" ) { if ( $key == "background-image" ) { $css .= $key . ":url('" . $value . "');"; } else { $css .= $key . ":" . $value . ";"; } } } } return $css; } public function output() { $style = $this->getCSS( $this->value ); if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); $this->parent->outputCSS .= $keys . "{" . $style . '}'; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); $this->parent->compilerCSS .= $keys . "{" . $style . '}'; } } } } } fields/background/field_background.css000066600000004351152141561110014131 0ustar00.redux-main .redux-container-background .redux-background-position,.redux-main .redux-container-background .redux-background-position select,.redux-main .redux-container-background .redux-background-attachment,.redux-main .redux-container-background .redux-background-attachment select,.redux-main .redux-container-background .redux-background-clip,.redux-main .redux-container-background .redux-background-clip select,.redux-main .redux-container-background .redux-background-origin,.redux-main .redux-container-background .redux-background-origin select,.redux-main .redux-container-background .redux-background-size,.redux-main .redux-container-background .redux-background-size select,.redux-main .redux-container-background .redux-background-repeat,.redux-main .redux-container-background .redux-background-repeat select{width:200px !important;margin-right:10px;margin-bottom:7px}.redux-main .redux-container-background .background-preview{display:block;width:100%;margin:5px 0 10px;border:1px dotted lightgray}.redux-main .redux-container-background .select2-container{margin-right:10px;margin-bottom:10px}.redux-main .redux-container-background .wp-picker-container{margin-bottom:10px}.redux-main .redux-container-background .upload{width:100%;margin-bottom:8px}.redux-main .redux-container-select li.ui-state-highlight{height:20px;margin-top:2px;margin-left:5px;width:64px;margin-bottom:0}.wp-customizer .redux-container-background .redux-background-position,.wp-customizer .redux-container-background .redux-background-position select,.wp-customizer .redux-container-background .redux-background-attachment,.wp-customizer .redux-container-background .redux-background-attachment select,.wp-customizer .redux-container-background .redux-background-clip,.wp-customizer .redux-container-background .redux-background-clip select,.wp-customizer .redux-container-background .redux-background-origin,.wp-customizer .redux-container-background .redux-background-origin select,.wp-customizer .redux-container-background .redux-background-size,.wp-customizer .redux-container-background .redux-background-size select,.wp-customizer .redux-container-background .redux-background-repeat,.wp-customizer .redux-container-background .redux-background-repeat select{width:100% !important}fields/sorter/field_sorter.scss000066600000003552152141561110012714 0ustar00.redux-container-sorter { margin-right: -20px; ul { background: #F9F9F9; border: 1px solid #E3E3E3; min-height: 40px; padding: 10px 10px 0; width: 145px; float: left; margin: 0 15px 0 0; &.filled { opacity: .7; filter: alpha(opacity=70); /* For IE8 and earlier */ background: #efecec; } li { border: 1px solid #DFDFDF; cursor: move; font-weight: bold; margin-bottom: 10px !important; padding: 0 10px; height: 40px; line-height: 40px !important; background-color: #F1F1F1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); overflow: hidden; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -moz-box-shadow: inset 0 1px 0 #fff; -webkit-box-shadow: inset 0 1px 0 #fff; box-shadow: inset 0 1px 0 #fff; text-align: center; h3 { margin: 0 0 10px; text-align: center; color: #777; text-transform: capitalize; word-wrap: break-word; } &.placeholder { height: 40px; } } } } .wp-customizer { .redux-container-sorter ul { width: 85%; margin: 0 0 5px 0; } }fields/sorter/field_sorter.css.map000066600000002110152141561110013272 0ustar00{ "version": 3, "mappings": "AAAA,uBAAwB;EACpB,YAAY,EAAE,KAAK;EAEnB,0BAAG;IACC,UAAU,EAAE,OAAO;IACnB,MAAM,EAAE,iBAAiB;IACzB,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,UAAU;IAElB,iCAAS;MACL,OAAO,EAAE,EAAE;MACX,MAAM,EAAE,iBAAiB;MAAE,yBAAyB;MACpD,UAAU,EAAE,OAAO;IAGvB,6BAAG;MACC,MAAM,EAAE,iBAAiB;MACzB,MAAM,EAAE,IAAI;MACZ,WAAW,EAAE,IAAI;MACjB,aAAa,EAAE,eAAe;MAC9B,OAAO,EAAE,MAAM;MACf,MAAM,EAAE,IAAI;MACZ,WAAW,EAAE,eAAe;MAC5B,gBAAgB,EAAE,OAAO;MACzB,gBAAgB,EAAE,0CAA0C;MAC5D,gBAAgB,EAAE,2CAA2C;MAC7D,gBAAgB,EAAE,yCAAyC;MAC3D,gBAAgB,EAAE,2EAA2E;MAC7F,gBAAgB,EAAE,8CAA8C;MAChE,gBAAgB,EAAE,sCAAsC;MACxD,QAAQ,EAAE,MAAM;MAChB,qBAAqB,EAAE,GAAG;MAC1B,kBAAkB,EAAE,GAAG;MACvB,aAAa,EAAE,GAAG;MAClB,eAAe,EAAE,kBAAkB;MACnC,kBAAkB,EAAE,kBAAkB;MACtC,UAAU,EAAE,kBAAkB;MAC9B,UAAU,EAAE,MAAM;MAElB,gCAAG;QACC,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,UAAU;QAC1B,SAAS,EAAE,UAAU;MAGzB,yCAAc;QACV,MAAM,EAAE,IAAI;;AAOxB,yCAA2B;EACvB,KAAK,EAAE,GAAG;EACV,MAAM,EAAE,SAAS", "sources": ["field_sorter.scss"], "names": [], "file": "field_sorter.css" }fields/sorter/field_sorter.min.js000066600000004073152141561110013136 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.sorter=redux.field_objects.sorter||{};var b="";a(document).ready(function(){}),redux.field_objects.sorter.init=function(c){c||(c=a(document).find(".redux-group-tab:visible").find(".redux-container-sorter:visible")),a(c).each(function(){var c=a(this),d=c;c.hasClass("redux-field-container")||(d=c.parents(".redux-field-container:first")),d.is(":hidden")||d.hasClass("redux-field-init")&&(d.removeClass("redux-field-init"),c.find(".redux-sorter").each(function(){var d=a(this).attr("id");c.find("#"+d).find("ul").sortable({items:"li",placeholder:"placeholder",connectWith:".sortlist_"+d,opacity:.8,scroll:!1,out:function(c,d){d.helper&&(b=d.offset.top>0?"down":"up",redux.field_objects.sorter.scrolling(a(this).parents(".redux-field-container:first")))},over:function(a,c){b=""},deactivate:function(a,c){b=""},stop:function(b,c){var d=redux.sorter[a(this).attr("data-id")],e=a(this).find("h3").text();d.limits&&e&&d.limits[e]&&(a(this).children("li").length>=d.limits[e]?(a(this).addClass("filled"),a(this).children("li").length>d.limits[e]&&a(c.sender).sortable("cancel")):a(this).removeClass("filled"))},update:function(b,c){var d=redux.sorter[a(this).attr("data-id")],e=a(this).find("h3").text();d.limits&&e&&d.limits[e]&&(a(this).children("li").length>=d.limits[e]?(a(this).addClass("filled"),a(this).children("li").length>d.limits[e]&&a(c.sender).sortable("cancel")):a(this).removeClass("filled")),a(this).find(".position").each(function(){var b=a(this).parent().attr("data-id"),c=a(this).parent().parent().attr("data-group-id");redux_change(a(this));var d=a(this).parent().parent().parent().attr("id");a(this).prop("name",redux.args.opt_name+"["+d+"]["+c+"]["+b+"]")})}}),c.find(".redux-sorter").disableSelection()}))})},redux.field_objects.sorter.scrolling=function(a){if(void 0!==a){var c=a.find(".redux-sorter");"up"==b?(c.scrollTop(c.scrollTop()-20),setTimeout(redux.field_objects.sorter.scrolling,50)):"down"==b&&(c.scrollTop(c.scrollTop()+20),setTimeout(redux.field_objects.sorter.scrolling,50))}}}(jQuery);fields/sorter/field_sorter.css000066600000002431152141561110012524 0ustar00.redux-container-sorter{margin-right:-20px}.redux-container-sorter ul{background:#f9f9f9;border:1px solid #e3e3e3;min-height:40px;padding:10px 10px 0;width:145px;float:left;margin:0 15px 0 0}.redux-container-sorter ul.filled{opacity:.7;filter:alpha(opacity=70);background:#efecec}.redux-container-sorter ul li{border:1px solid #dfdfdf;cursor:move;font-weight:bold;margin-bottom:10px !important;padding:0 10px;height:40px;line-height:40px !important;background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec);overflow:hidden;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff;text-align:center}.redux-container-sorter ul li h3{margin:0 0 10px;text-align:center;color:#777;text-transform:capitalize;word-wrap:break-word}.redux-container-sorter ul li.placeholder{height:40px}.wp-customizer .redux-container-sorter ul{width:85%;margin:0 0 5px 0}fields/sorter/field_sorter.php000066600000021376152141561110012534 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } private function replace_id_with_slug( $arr ) { $new_arr = array(); if ( ! empty( $arr ) ) { foreach ( $arr as $id => $name ) { if ( is_numeric( $id ) ) { $slug = strtolower( $name ); $slug = str_replace( ' ', '-', $slug ); $new_arr[ $slug ] = $name; } else { $new_arr[ $id ] = $name; } } } return $new_arr; } private function is_value_empty( $val ) { if ( ! empty( $val ) ) { foreach ( $val as $section => $arr ) { if ( ! empty( $arr ) ) { return false; } } } return true; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 */ function render() { if ( ! is_array( $this->value ) && isset( $this->field['options'] ) ) { $this->value = $this->field['options']; } if ( ! isset( $this->field['args'] ) ) { $this->field['args'] = array(); } if ( isset( $this->field['data'] ) ) { $this->field['options'] = $this->parent->options_defaults[ $this->field['id'] ]; } // Make sure to get list of all the default blocks first $all_blocks = ! empty( $this->field['options'] ) ? $this->field['options'] : array(); $temp = array(); // holds default blocks $temp2 = array(); // holds saved blocks foreach ( $all_blocks as $blocks ) { $temp = array_merge( $temp, $blocks ); } $temp = $this->replace_id_with_slug( $temp ); if ( $this->is_value_empty( $this->value ) ) { if ( ! empty( $this->field['options'] ) ) { $this->value = $this->field['options']; } } $sortlists = $this->value; if ( ! empty( $sortlists ) ) { foreach ( $sortlists as $section => $arr ) { $sortlists[ $section ] = $this->replace_id_with_slug( $arr ); } } if ( is_array( $sortlists ) ) { foreach ( $sortlists as $sortlist ) { $temp2 = array_merge( $temp2, $sortlist ); } // now let's compare if we have anything missing foreach ( $temp as $k => $v ) { // k = id/slug // v = name if ( ! empty( $temp2 ) ) { if ( ! array_key_exists( $k, $temp2 ) ) { if (isset($sortlists['Disabled'])) { $sortlists['Disabled'][ $k ] = $v; } else { $sortlists['disabled'][ $k ] = $v; } } } } // now check if saved blocks has blocks not registered under default blocks foreach ( $sortlists as $key => $sortlist ) { // key = enabled, disabled, backup // sortlist = id => name foreach ( $sortlist as $k => $v ) { // k = id // v = name if ( ! array_key_exists( $k, $temp ) ) { unset( $sortlist[ $k ] ); } } $sortlists[ $key ] = $sortlist; } // assuming all sync'ed, now get the correct naming for each block foreach ( $sortlists as $key => $sortlist ) { foreach ( $sortlist as $k => $v ) { $sortlist[ $k ] = $temp[ $k ]; } $sortlists[ $key ] = $sortlist; } if ( $sortlists ) { echo '
    '; foreach ( $sortlists as $group => $sortlist ) { $filled = ""; if ( isset( $this->field['limits'][ $group ] ) && count( $sortlist ) >= $this->field['limits'][ $group ] ) { $filled = " filled"; } echo '
      '; echo '

      ' . esc_html($group) . '

      '; if ( ! isset( $sortlist['placebo'] ) ) { array_unshift( $sortlist, array( "placebo" => "placebo" ) ); } foreach ( $sortlist as $key => $list ) { echo ''; if ( $key != "placebo" ) { //echo '
    • '; echo '
    • '; echo ''; echo esc_html($list); echo '
    • '; } } echo '
    '; } echo '
    '; } } } function enqueue() { if ( $this->parent->args['dev_mode'] ) { wp_enqueue_style( 'redux-field-sorder-css', ReduxFramework::$_url . 'inc/fields/sorter/field_sorter.css', array(), time(), 'all' ); } wp_enqueue_script( 'redux-field-sorter-js', ReduxFramework::$_url . 'inc/fields/sorter/field_sorter' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js', 'jquery-ui-sortable' ), time(), true ); } /** * Functions to pass data from the PHP to the JS at render time. * * @return array Params to be saved as a javascript object accessable to the UI. * @since Redux_Framework 3.1.5 */ function localize( $field, $value = "" ) { $params = array(); if ( isset( $field['limits'] ) && ! empty( $field['limits'] ) ) { $params['limits'] = $field['limits']; } if ( empty( $value ) ) { $value = $this->value; } $params['val'] = $value; return $params; } } }fields/sorter/field_sorter.js000066600000014525152141561110012357 0ustar00/*global redux, redux_opts*/ /* * Field Sorter jquery function * Based on * [SMOF - Slightly Modded Options Framework](http://aquagraphite.com/2011/09/slightly-modded-options-framework/) * Version 1.4.2 */ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.sorter = redux.field_objects.sorter || {}; var scroll = ''; $( document ).ready( function() { //redux.field_objects.sorter.init(); } ); redux.field_objects.sorter.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-sorter:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } /** Sorter (Layout Manager) */ el.find( '.redux-sorter' ).each( function() { var id = $( this ).attr( 'id' ); el.find( '#' + id ).find( 'ul' ).sortable( { items: 'li', placeholder: "placeholder", connectWith: '.sortlist_' + id, opacity: 0.8, scroll: false, out: function( event, ui ) { if ( !ui.helper ) return; if ( ui.offset.top > 0 ) { scroll = 'down'; } else { scroll = 'up'; } redux.field_objects.sorter.scrolling( $( this ).parents( '.redux-field-container:first' ) ); }, over: function( event, ui ) { scroll = ''; }, deactivate: function( event, ui ) { scroll = ''; }, stop: function( event, ui ) { var sorter = redux.sorter[$( this ).attr( 'data-id' )]; var id = $( this ).find( 'h3' ).text(); if ( sorter.limits && id && sorter.limits[id] ) { if ( $( this ).children( 'li' ).length >= sorter.limits[id] ) { $( this ).addClass( 'filled' ); if ( $( this ).children( 'li' ).length > sorter.limits[id] ) { $( ui.sender ).sortable( 'cancel' ); } } else { $( this ).removeClass( 'filled' ); } } }, update: function( event, ui ) { var sorter = redux.sorter[$( this ).attr( 'data-id' )]; var id = $( this ).find( 'h3' ).text(); if ( sorter.limits && id && sorter.limits[id] ) { if ( $( this ).children( 'li' ).length >= sorter.limits[id] ) { $( this ).addClass( 'filled' ); if ( $( this ).children( 'li' ).length > sorter.limits[id] ) { $( ui.sender ).sortable( 'cancel' ); } } else { $( this ).removeClass( 'filled' ); } } $( this ).find( '.position' ).each( function() { //var listID = $( this ).parent().attr( 'id' ); var listID = $( this ).parent().attr( 'data-id' ); var parentID = $( this ).parent().parent().attr( 'data-group-id' ); redux_change( $( this ) ); var optionID = $( this ).parent().parent().parent().attr( 'id' ); $( this ).prop( "name", redux.args.opt_name + '[' + optionID + '][' + parentID + '][' + listID + ']' ); } ); } } ); el.find( ".redux-sorter" ).disableSelection(); } ); } ); }; redux.field_objects.sorter.scrolling = function( selector ) { if (selector === undefined) { return; } var scrollable = selector.find( ".redux-sorter" ); if ( scroll == 'up' ) { scrollable.scrollTop( scrollable.scrollTop() - 20 ); setTimeout( redux.field_objects.sorter.scrolling, 50 ); } else if ( scroll == 'down' ) { scrollable.scrollTop( scrollable.scrollTop() + 20 ); setTimeout( redux.field_objects.sorter.scrolling, 50 ); } }; })( jQuery );fields/select/field_select.css.map000066600000000334152141561110013202 0ustar00{ "version": 3, "mappings": "AACI,6CAAsB;EAClB,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,GAAG;EACf,WAAW,EAAE,GAAG;EAChB,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,CAAC", "sources": ["field_select.scss"], "names": [], "file": "field_select.css" }fields/select/field_select.php000066600000016433152141561110012434 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ public function render() { $sortable = ( isset( $this->field['sortable'] ) && $this->field['sortable'] ) ? ' select2-sortable"' : ""; if ( ! empty( $sortable ) ) { // Dummy proofing :P $this->field['multi'] = true; } if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { if ( empty( $this->field['args'] ) ) { $this->field['args'] = array(); } if ( $this->field['data'] == "elusive-icons" || $this->field['data'] == "elusive-icon" || $this->field['data'] == "elusive" ) { $icons_file = ReduxFramework::$_dir . 'inc/fields/select/elusive-icons.php'; /** * filter 'redux-font-icons-file}' * * @param array $icon_file File for the icons */ $icons_file = apply_filters( 'redux-font-icons-file', $icons_file ); /** * filter 'redux/{opt_name}/field/font/icons/file' * * @param array $icon_file File for the icons */ $icons_file = apply_filters( "redux/{$this->parent->args['opt_name']}/field/font/icons/file", $icons_file ); if ( file_exists( $icons_file ) ) { require_once $icons_file; } } $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] ); } if ( ! empty( $this->field['data'] ) && ( $this->field['data'] == "elusive-icons" || $this->field['data'] == "elusive-icon" || $this->field['data'] == "elusive" ) ) { $this->field['class'] .= " font-icons"; } //if if ( ! empty( $this->field['options'] ) ) { $multi = ( isset( $this->field['multi'] ) && $this->field['multi'] ) ? ' multiple="multiple"' : ""; if ( ! empty( $this->field['width'] ) ) { $width = ' style="' . $this->field['width'] . '"'; } else { $width = ' style="width: 40%;"'; } $nameBrackets = ""; if ( ! empty( $multi ) ) { $nameBrackets = "[]"; } $placeholder = ( isset( $this->field['placeholder'] ) ) ? esc_attr( $this->field['placeholder'] ) : __( 'Select an item', 'redux-framework' ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } if ( isset( $this->field['multi'] ) && $this->field['multi'] && isset( $this->field['sortable'] ) && $this->field['sortable'] && ! empty( $this->value ) && is_array( $this->value ) ) { $origOption = $this->field['options']; $this->field['options'] = array(); foreach ( $this->value as $value ) { $this->field['options'][ $value ] = $origOption[ $value ]; } if ( count( $this->field['options'] ) < count( $origOption ) ) { foreach ( $origOption as $key => $value ) { if ( ! in_array( $key, $this->field['options'] ) ) { $this->field['options'][ $key ] = $value; } } } } $sortable = ( isset( $this->field['sortable'] ) && $this->field['sortable'] ) ? ' select2-sortable"' : ""; echo ''; } else { echo '' . __( 'No items of this type were found.', 'redux-framework' ) . ''; } } //function private function make_option($id, $value, $group_name = '') { if ( is_array( $this->value ) ) { $selected = ( is_array( $this->value ) && in_array( $id, $this->value ) ) ? ' selected="selected"' : ''; } else { $selected = selected( $this->value, $id, false ); } echo ''; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ public function enqueue() { wp_enqueue_style( 'select2-css' ); if (isset($this->field['sortable']) && $this->field['sortable']) { wp_enqueue_script('jquery-ui-sortable'); } wp_enqueue_script( 'redux-field-select-js', ReduxFramework::$_url . 'inc/fields/select/field_select' . Redux_Functions::isMin() . '.js', array( 'jquery', 'select2-js', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-select-css', ReduxFramework::$_url . 'inc/fields/select/field_select.css', array(), time(), 'all' ); } } //function } //class }fields/select/field_select.css000066600000000164152141561110012427 0ustar00.redux-container-select li.ui-state-highlight{height:20px;margin-top:2px;margin-left:5px;width:64px;margin-bottom:0}fields/select/field_select.js000066600000006651152141561110012262 0ustar00/*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.select = redux.field_objects.select || {}; redux.field_objects.select.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-select:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( 'select.redux-select-item' ).each( function() { var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; if ( $(this).attr('multiple') == "multiple" ) { default_params.width = "100%"; } if ( $( this ).siblings( '.select2_params' ).size() > 0 ) { var select2_params = $( this ).siblings( '.select2_params' ).val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } if ( $( this ).hasClass( 'font-icons' ) ) { default_params = $.extend( {}, { formatResult: redux.field_objects.select.addIcon, formatSelection: redux.field_objects.select.addIcon, escapeMarkup: function( m ) { return m; } }, default_params ); } $( this ).select2( default_params ); if ( $( this ).hasClass( 'select2-sortable' ) ) { default_params = {}; default_params.bindOrder = 'sortableStop'; default_params.sortableOptions = {placeholder: 'ui-state-highlight'}; $( this ).select2Sortable( default_params ); } $( this ).on( "change", function() { redux_change( $( $( this ) ) ); $( this ).select2SortableOrder(); } ); } ); } ); }; redux.field_objects.select.addIcon = function( icon ) { if ( icon.hasOwnProperty( 'id' ) ) { return "" + "  " + icon.text + ""; } }; })( jQuery );fields/select/elusive-icons.php000066600000022040152141561110012566 0ustar000){var f=a(this).siblings(".select2_params").val();f=JSON.parse(f);e=a.extend({},e,f)}if(a(this).hasClass("font-icons")){e=a.extend({},{formatResult:redux.field_objects.select.addIcon,formatSelection:redux.field_objects.select.addIcon,escapeMarkup:function(g){return g}},e)}a(this).select2(e);if(a(this).hasClass("select2-sortable")){e={};e.bindOrder="sortableStop";e.sortableOptions={placeholder:"ui-state-highlight"};a(this).select2Sortable(e)}a(this).on("change",function(){redux_change(a(a(this)));a(this).select2SortableOrder()})})})};redux.field_objects.select.addIcon=function(b){if(b.hasOwnProperty("id")){return"  "+b.text+""}}})(jQuery);fields/select/field_select.scss000066600000000267152141561110012616 0ustar00.redux-container-select { li.ui-state-highlight { height: 20px; margin-top: 2px; margin-left: 5px; width: 64px; margin-bottom: 0; } } fields/editor/field_editor.css.map000066600000001503152141561110013217 0ustar00{ "version": 3, "mappings": "AACI,qCAAc;EACV,YAAY,EAAE,GAAG;EACjB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,GAAG;AAGhB;gCACS;EACL,MAAM,EAAE,OAAO;AAGnB,gCAAS;EACL,YAAY,EAAE,IAAI;EAClB,MAAM,EAAE,CAAC;EACT,YAAY,EAAE,CAAC;AAGnB,4CAAqB;EACjB,qBAAqB,EAAE,GAAG;EAC1B,kBAAkB,EAAE,GAAG;EACvB,aAAa,EAAE,GAAG;EAElB,qDAAS;IACL,qBAAqB,EAAE,CAAC;IACxB,kBAAkB,EAAE,CAAC;IACrB,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,OAAO;AAI7B,gDAAyB;EACrB,MAAM,EAAE,WAAW;EACnB,WAAW,EAAE,IAAI;EACjB,OAAO,EAAE,YAAY;EACrB,SAAS,EAAE,IAAI;EACf,OAAO,EAAE,OAAO;EAChB,IAAI,EAAE,6CAA6C;EACnD,KAAK,EAAE,OAAO;EACd,MAAM,EAAE,iBAAiB;EACzB,qBAAqB,EAAE,GAAG;EAC1B,aAAa,EAAE,GAAG;EAClB,UAAU,EAAE,IAAI;EAChB,gBAAgB,EAAE,wEAAwE;EAC1F,gBAAgB,EAAE,8CAA8C;EAChE,gBAAgB,EAAE,2CAA2C;EAC7D,gBAAgB,EAAE,yCAAyC;EAC3D,gBAAgB,EAAE,sCAAsC", "sources": ["field_editor.scss"], "names": [], "file": "field_editor.css" }fields/editor/field_editor.scss000066600000002474152141561110012636 0ustar00.redux-container-editor { .mceLayout td { border-width: 1px; margin: 0; padding: 1px; } input, textarea { margin: inherit; } textarea { border-style: none; border: 0; border-width: 0; } .wp-editor-container { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; textarea { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; border-style: inherit; } } .quicktags-toolbar input { margin: 2px 1px 4px; line-height: 18px; display: inline-block; min-width: 26px; padding: 2px 4px; font: 12px/18px Arial, Helvetica, sans-serif normal; color: #464646; border: 1px solid #c3c3c3; -webkit-border-radius: 3px; border-radius: 3px; background: #eee; background-image: -webkit-gradient(linear, left bottom, left top, from(#e3e3e3), to(#fff)); background-image: -webkit-linear-gradient(bottom, #e3e3e3, #fff); background-image: -moz-linear-gradient(bottom, #e3e3e3, #fff); background-image: -o-linear-gradient(bottom, #e3e3e3, #fff); background-image: linear-gradient(to top, #e3e3e3, #fff); } } fields/editor/field_editor.min.js000066600000001105152141561110013047 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.editor=redux.field_objects.editor||{},a(document).ready(function(){}),redux.field_objects.editor.init=function(a){setTimeout(function(){if("undefined"!=typeof tinymce)for(var a=0;a. * * @package ReduxFramework * @subpackage Field_Editor * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Kevin Provance (kprovance) * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_editor' ) ) { /** * Main ReduxFramework_editor class * * @since 1.0.0 */ class ReduxFramework_editor { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { if ( ! isset( $this->field['args'] ) ) { $this->field['args'] = array(); } $this->field['args']['onchange_callback'] = "alert('here')"; // Setup up default args $defaults = array( 'textarea_name' => $this->field['name'] . $this->field['name_suffix'], 'editor_class' => $this->field['class'], 'textarea_rows' => 10, //Wordpress default 'teeny' => true, ); if ( isset( $this->field['editor_options'] ) && empty( $this->field['args'] ) ) { $this->field['args'] = $this->field['editor_options']; unset( $this->field['editor_options'] ); } $this->field['args'] = wp_parse_args( $this->field['args'], $defaults ); wp_editor( $this->value, $this->field['id'], $this->field['args'] ); } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-editor-css', ReduxFramework::$_url . 'inc/fields/editor/field_editor.css', array(), time(), 'all' ); } wp_enqueue_script( 'redux-field-editor-js', ReduxFramework::$_url . 'inc/fields/editor/field_editor' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); } } }fields/button_set/field_button_set.php000066600000015256152141561110014254 0ustar00. * * @package Redux_Field * @subpackage Button_Set * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Kevin Provance (kprovance) * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_button_set' ) ) { /** * Main ReduxFramework_button_set class * * @since 1.0.0 */ class ReduxFramework_button_set { /** * Holds configuration settings for each field in a model. * Defining the field options * @param array $arr (See above) * * @return Object A new editor object. * */ static $_properties = array( 'id' => 'Identifier', ); /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { if ( !empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { if ( empty( $this->field['args'] ) ) { $this->field['args'] = array(); } $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] ); if ( empty( $this->field['options'] ) ) { return; } } $is_multi = (isset( $this->field['multi'] ) && $this->field['multi'] == true) ? true: false; $name = $this->field['name'] . $this->field['name_suffix']; // multi => true renders the field multi-selectable (checkbox vs radio) echo '
    '; if ($is_multi) { $s = ''; if (empty($this->value)) { $s = $name; } echo ''; $name = $name . '[]'; } foreach ( $this->field['options'] as $k => $v ) { $selected = ''; if ( $is_multi ) { $post_value = ''; $type = "checkbox"; if ( ! empty( $this->value ) && ! is_array( $this->value ) ) { $this->value = array( $this->value ); } if ( is_array( $this->value ) && in_array( $k, $this->value ) ) { $selected = 'checked="checked"'; $post_value = $k; } } else { $type = "radio"; if ( is_scalar( $this->value ) ) { $selected = checked( $this->value, $k, false ); } } $the_val = $k; $the_name = $name; $data_val = ''; $multi_class = ''; if ($is_multi) { $the_val = ''; $the_name = ''; $data_val = ' data-val="' . $k . '"'; $hidden_name = $name; $multi_class = 'multi '; if ($post_value == '') { $hidden_name = ''; } echo ''; } echo ''; echo ''; } echo '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if (!wp_script_is ( 'redux-field-button-set-js' )) { wp_enqueue_script( 'redux-field-button-set-js', ReduxFramework::$_url . 'inc/fields/button_set/field_button_set' . Redux_Functions::isMin() . '.js', array( 'jquery', 'jquery-ui-core', 'redux-js' ), time(), true ); } } } }fields/button_set/field_button_set.js000066600000006360152141561110014075 0ustar00/* Field Button Set (button_set) */ /*global jQuery, document, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.button_set = redux.field_objects.button_set || {}; $( document ).ready( function() { if ( $.fn.button.noConflict !== undefined ) { var btn = $.fn.button.noConflict(); $.fn.btn = btn; } } ); redux.field_objects.button_set.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-button_set:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.buttonset' ).each( function() { if ( $( this ).is( ':checkbox' ) ) { $( this ).find( '.buttonset-item' ).button(); } $( this ).buttonset(); } ); el.find( '.buttonset-item.multi' ).on( 'click', function( e ) { var val = ''; var name = ''; var id = $(this).attr('id'); var empty = $( this ).parent().find( '.buttonset-empty' ); var idName = empty.attr( 'data-name' ); var isChecked = false; $( this ).parent().find('.buttonset-item').each(function(){ if ($( this ).is( ':checked' )) { isChecked = true; } }); if (isChecked) { empty.attr('name', ''); } else { empty.attr('name', idName); } if ( $( this ).is( ':checked' ) ) { val = $( this ).attr( 'data-val' ); name = idName + '[]'; } $( this ).parent().find( '#' + id + '-hidden.buttonset-check' ).val( val ); $( this ).parent().find( '#' + id + '-hidden.buttonset-check' ).attr( 'name', name ); redux_change( $( this ) ); } ); } ); }; })( jQuery );fields/button_set/field_button_set.min.js000066600000002426152141561110014656 0ustar00(function(a){redux.field_objects=redux.field_objects||{};redux.field_objects.button_set=redux.field_objects.button_set||{};a(document).ready(function(){if(a.fn.button.noConflict!==undefined){var b=a.fn.button.noConflict();a.fn.btn=b}});redux.field_objects.button_set.init=function(b){if(!b){b=a(document).find(".redux-group-tab:visible").find(".redux-container-button_set:visible")}a(b).each(function(){var d=a(this);var c=d;if(!d.hasClass("redux-field-container")){c=d.parents(".redux-field-container:first")}if(c.is(":hidden")){return}if(c.hasClass("redux-field-init")){c.removeClass("redux-field-init")}else{return}d.find(".buttonset").each(function(){if(a(this).is(":checkbox")){a(this).find(".buttonset-item").button()}a(this).buttonset()});d.find(".buttonset-item.multi").on("click",function(i){var j="";var g="";var l=a(this).attr("id");var h=a(this).parent().find(".buttonset-empty");var f=h.attr("data-name");var k=false;a(this).parent().find(".buttonset-item").each(function(){if(a(this).is(":checked")){k=true}});if(k){h.attr("name","")}else{h.attr("name",f)}if(a(this).is(":checked")){j=a(this).attr("data-val");g=f+"[]"}a(this).parent().find("#"+l+"-hidden.buttonset-check").val(j);a(this).parent().find("#"+l+"-hidden.buttonset-check").attr("name",g);redux_change(a(this))})})}})(jQuery);fields/spinner/field_spinner.php000066600000014276152141561110013035 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 3.0.0 */ function render() { $params = array( 'min' => '', 'max' => '', 'step' => '', 'default' => '', ); $this->field = wp_parse_args( $this->field, $params ); $data_string = ""; foreach($this->field as $key => $val) { if (in_array($key, array('min', 'max', 'step', 'default'))) { $data_string.= " data-".$key.'="'.$val.'"'; } } $data_string .= ' data-val="'.$val.'"'; // Don't allow input edit if there's a step $readonly = ""; if ( isset( $this->field['edit'] ) && $this->field['edit'] == false ) { $readonly = ' readonly="readonly"'; } echo '
    '; echo ''; echo '
    '; } //function /** * Clean the field data to the fields defaults given the parameters. * * @since Redux_Framework 3.1.1 */ function clean() { if ( empty( $this->field['min'] ) ) { $this->field['min'] = 0; } else { $this->field['min'] = intval( $this->field['min'] ); } if ( empty( $this->field['max'] ) ) { $this->field['max'] = intval( $this->field['min'] ) + 1; } else { $this->field['max'] = intval( $this->field['max'] ); } if ( empty( $this->field['step'] ) || $this->field['step'] > $this->field['max'] ) { $this->field['step'] = 1; } else { $this->field['step'] = intval( $this->field['step'] ); } if ( empty( $this->value ) && ! empty( $this->field['default'] ) && intval( $this->field['min'] ) >= 1 ) { $this->value = intval( $this->field['default'] ); } if ( empty( $this->value ) && intval( $this->field['min'] ) >= 1 ) { $this->value = intval( $this->field['min'] ); } if ( empty( $this->value ) ) { $this->value = 0; } // Extra Validation if ( $this->value < $this->field['min'] ) { $this->value = intval( $this->field['min'] ); } else if ( $this->value > $this->field['max'] ) { $this->value = intval( $this->field['max'] ); } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 3.0.0 */ function enqueue() { wp_enqueue_script( 'redux-field-spinner-custom-js', ReduxFramework::$_url . 'inc/fields/spinner/vendor/spinner_custom.js', array( 'jquery','redux-js' ), time(), true ); wp_enqueue_script( 'redux-field-spinner-js', ReduxFramework::$_url . 'inc/fields/spinner/field_spinner' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-field-spinner-custom-js', 'jquery-ui-core', 'jquery-ui-dialog', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-spinner-css', ReduxFramework::$_url . 'inc/fields/spinner/field_spinner.css', array(), time(), 'all' ); } } public function output() { $style = ''; if ( ! empty( $this->value ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $css = $this->parseCSS($this->value, $this->field['output']); $this->parent->outputCSS .= $css; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $css = $this->parseCSS($this->value, $this->field['compiler']); $this->parent->compilerCSS .= $css; } } } private function parseCSS($value, $output){ // No notices $css = ''; $unit = isset($this->field['output_unit']) ? $this->field['output_unit'] : 'px'; // Must be an array if (is_numeric($value)) { if (is_array($output)) { foreach($output as $mode => $selector) { if (!empty($mode) && !empty($selector)) { $css .= $selector . '{' . $mode . ': ' . $value . $unit . ';}'; } } } } return $css; } } }fields/spinner/arrow_right.png000066600000000232152141561110012523 0ustar00PNG  IHDR /3tEXtSoftwareAdobe ImageReadyqe< @RgvQg?};Uچ(X,;WVIENDB`fields/spinner/vendor/spinner_custom.js000066600000041570152141561110014403 0ustar00(function( a, b ) { var c = "ui-state-active", d = "ui-state-hover", e = "ui-state-disabled", f = a.ui.keyCode, g = f.UP, h = f.DOWN, i = f.RIGHT, j = f.LEFT, k = f.PAGE_UP, l = f.PAGE_DOWN, m = f.HOME, n = f.END, o = a.browser.msie, p = a.browser.mozilla ? "DOMMouseScroll" : "mousewheel", q = ".uispinner", r = [g, h, i, j, k, l, m, n, f.BACKSPACE, f.DELETE, f.TAB], s; a.widget( "ui.spinner", { options: { min: null, max: null, allowNull: false, group: "", point: ".", prefix: "", suffix: "", places: null, defaultStep: 1, largeStep: 10, mouseWheel: true, increment: "slow", className: null, showOn: "always", width: 95, upIconClass: "ui-icon-triangle-1-n", downIconClass: "ui-icon-triangle-1-s", format: function( a, b ) { var c = this, d = /(\d+)(\d{3})/, e = (isNaN( a ) ? 0 : Math.abs( a )).toFixed( b ) + ""; for ( e = e.replace( ".", c.point ); d.test( e ) && c.group; e = e.replace( d, "$1" + c.group + "$2" ) ) { } return (a < 0 ? "-" : "") + c.prefix + e + c.suffix }, parse: function( a ) { var b = this; if ( b.group == "." ) a = a.replace( ".", "" ); if ( b.point != "." ) a = a.replace( b.point, "." ); return parseFloat( a.replace( /[^0-9\-\.]/g, "" ) ) } }, _create: function() { var a = this, b = a.element, c = b.attr( "type" ); if ( !b.is( "input" ) || c != "text" && c != "number" ) { console.error( "Invalid target for ui.spinner" ); return } a._procOptions( true ); a._createButtons( b ); if ( !b.is( ":enabled" ) ) a.disable() }, _createButtons: function( b ) { function R() { if ( L ) { a( this ).removeClass( c ); p._stopSpin(); L = false } return false } function Q() { if ( !t.disabled ) { var b = p.element[0], d = this === C ? 1 : -1; b.focus(); b.select(); a( this ).addClass( c ); L = true; p._startSpin( d ) } return false } function P( a ) { function b() { G = 0; a() } if ( G ) { if ( a === H )return; clearTimeout( G ) } H = a; G = setTimeout( b, 100 ) } function O( a, b ) { if ( K )return false; var c = String.fromCharCode( b || a ), d = p.options; if ( c >= "0" && c <= "9" || c == "-" )return false; if ( p.places > 0 && c == d.point || c == d.group )return false; return true } function N( a ) { for ( var b = 0; b < r.length; b++ )if ( r[b] == a )return true; return false } function e( a ) { return a == "auto" ? 0 : parseInt( a ) } var p = this, t = p.options, u = t.className, v = t.width, w = t.showOn, x = a.support.boxModel, y = b.outerHeight(), z = p.oMargin = e( b.css( "margin-right" ) ), A = p.wrapper = b.wrap( '' ).css( { width: (p.oWidth = x ? b.width() : b.outerWidth()) - v, marginRight: "30px", marginLeft: "30px", textAlign: "center", "float": "none", marginTop: 0 } ).after( '' ).next(), B = p.btnContainer = a( '
    ' + '
    ' + '
    ' + "
    " ), C, D, E, F, G, H, I, J, K, L, M = b[0].dir == "rtl"; if ( u ) A.addClass( u ); A.append( B.css( {height: y, left: 0, top: 0} ) ); E = p.buttons = B.find( ".ui-spinner-button" ); E.css( {width: "30px", height: y - (x ? E.outerHeight() - E.height() : 0)} ); E.eq( 0 ).css( {right: "0"} ); E.eq( 1 ).css( {left: "0"} ); C = E[0]; D = E[1]; F = E.find( ".ui-icon" ); B.width( "105px" ); if ( w != "always" ) B.css( "opacity", 0 ); if ( w == "hover" || w == "both" ) E.add( b ).bind( "mouseenter" + q, function() { P( function() { I = true; if ( !p.focused || w == "hover" ) p.showButtons() } ) } ).bind( "mouseleave" + q, function S() { P( function() { I = false; if ( !p.focused || w == "hover" ) p.hideButtons() } ) } ); E.hover( function() { p.buttons.removeClass( d ); if ( !t.disabled ) a( this ).addClass( d ) }, function() { a( this ).removeClass( d ) } ).mousedown( Q ).mouseup( R ).mouseout( R ); if ( o ) E.dblclick( function() { if ( !t.disabled ) { p._change(); p._doSpin( (this === C ? 1 : -1) * t.step ) } return false } ).bind( "selectstart", function() { return false } ); b.bind( "keydown" + q, function( b ) { var d, e, f, o = b.keyCode; if ( b.ctrl || b.alt )return true; if ( N( o ) ) K = true; if ( J )return false; switch ( o ) { case g: case k: d = 1; e = o == k; break; case h: case l: d = -1; e = o == l; break; case i: case j: d = o == i ^ M ? 1 : -1; break; case m: f = p.options.min; if ( f != null ) p._setValue( f ); return false; case n: f = p.options.max; f = p.options.max; if ( f != null ) p._setValue( f ); return false } if ( d ) { if ( !J && !t.disabled ) { keyDir = d; a( d > 0 ? C : D ).addClass( c ); J = true; p._startSpin( d, e ) } return false } } ).bind( "keyup" + q, function( a ) { if ( a.ctrl || a.alt )return true; if ( N( f ) ) K = false; switch ( a.keyCode ) { case g: case i: case k: case h: case j: case l: E.removeClass( c ); p._stopSpin(); J = false; return false } } ).bind( "keypress" + q, function( a ) { if ( O( a.keyCode, a.charCode ) )return false } ).bind( "change" + q, function() { p._change() } ).bind( "focus" + q, function() { function a() { p.element.select() } o ? a() : setTimeout( a, 0 ); p.focused = true; s = p; if ( !I && (w == "focus" || w == "both") ) p.showButtons() } ).bind( "blur" + q, function() { p.focused = false; if ( !I && (w == "focus" || w == "both") ) p.hideButtons() } ) }, _procOptions: function( a ) { var b = this, c = b.element, d = b.options, e = d.min, f = d.max, g = d.step, h = d.places, i = -1, j; if ( d.increment == "slow" ) d.increment = [{count: 1, mult: 1, delay: 250}, { count: 3, mult: 1, delay: 100 }, {count: 0, mult: 1, delay: 50}]; else if ( d.increment == "fast" ) d.increment = [{ count: 1, mult: 1, delay: 250 }, {count: 19, mult: 1, delay: 100}, {count: 80, mult: 1, delay: 20}, { count: 100, mult: 10, delay: 20 }, {count: 0, mult: 100, delay: 20}]; if ( e == null && (j = c.attr( "min" )) != null ) e = parseFloat( j ); if ( f == null && (j = c.attr( "max" )) != null ) f = parseFloat( j ); if ( !g && (j = c.attr( "step" )) != null )if ( j != "any" ) { g = parseFloat( j ); d.largeStep *= g } d.step = g = g || d.defaultStep; if ( h == null && (j = g + "").indexOf( "." ) != -1 ) h = j.length - j.indexOf( "." ) - 1; b.places = h; if ( f != null && e != null ) { if ( e > f ) e = f; i = Math.max( Math.max( i, d.format( f, h, c ).length ), d.format( e, h, c ).length ) } if ( a ) b.inputMaxLength = c[0].maxLength; j = b.inputMaxLength; if ( j > 0 ) { i = i > 0 ? Math.min( j, i ) : j; j = Math.pow( 10, i ) - 1; if ( f == null || f > j ) f = j; j = -(j + 1) / 10 + 1; if ( e == null || e < j ) e = j } if ( i > 0 ) c.attr( "maxlength", i ); d.min = e; d.max = f; b._change(); c.unbind( p + q ); if ( d.mouseWheel ) c.bind( p + q, b._mouseWheel ) }, _mouseWheel: function( b ) { var c = a.data( this, "spinner" ); if ( !c.options.disabled && c.focused && s === c ) { c._change(); c._doSpin( ((b.wheelDelta || -b.detail) > 0 ? 1 : -1) * c.options.step ); return false } }, _setTimer: function( a, b, c ) { function e() { d._spin( b, c ) } var d = this; d._stopSpin(); d.timer = setInterval( e, a ) }, _stopSpin: function() { if ( this.timer ) { clearInterval( this.timer ); this.timer = 0 } }, _startSpin: function( a, b ) { var c = this, d = c.options, e = d.increment; c._change(); c._doSpin( a * (b ? c.options.largeStep : c.options.step) ); if ( e && e.length > 0 ) { c.counter = 0; c.incCounter = 0; c._setTimer( e[0].delay, a, b ) } }, _spin: function( a, b ) { var c = this, d = c.options.increment, e = d[c.incCounter]; c._doSpin( a * e.mult * (b ? c.options.largeStep : c.options.step) ); c.counter++; if ( c.counter > e.count && c.incCounter < d.length - 1 ) { c.counter = 0; e = d[++c.incCounter]; c._setTimer( e.delay, a, b ) } }, _doSpin: function( a ) { var b = this, c = b.curvalue; if ( c == null ) c = (a > 0 ? b.options.min : b.options.max) || 0; b._setValue( c + a ) }, _parseValue: function() { var a = this.element.val(); return a ? this.options.parse( a, this.element ) : null }, _validate: function( a ) { var b = this.options, c = b.min, d = b.max; if ( a == null && !b.allowNull ) a = this.curvalue != null ? this.curvalue : c || d || 0; if ( d != null && a > d )return d; else if ( c != null && a < c )return c; else return a }, _change: function() { var a = this, b = a._parseValue(), c = a.options.min, d = a.options.max; if ( !a.selfChange ) { if ( isNaN( b ) ) b = a.curvalue; a._setValue( b, true ) } }, _setOption: function( b, c ) { a.Widget.prototype._setOption.call( this, b, c ); this._procOptions() }, increment: function() { this._doSpin( this.options.step ) }, decrement: function() { this._doSpin( -this.options.step ) }, showButtons: function( a ) { var b = this.btnContainer.stop(); if ( a ) b.css( "opacity", 1 ); else b.fadeTo( "fast", 1 ) }, hideButtons: function( a ) { var b = this.btnContainer.stop(); if ( a ) b.css( "opacity", 0 ); else b.fadeTo( "fast", 0 ); this.buttons.removeClass( d ) }, _setValue: function( a, b ) { var c = this; c.curvalue = a = c._validate( a ); c.element.val( a != null ? c.options.format( a, c.places, c.element ) : "" ); if ( !b ) { c.selfChange = true; c.element.change(); c.selfChange = false } }, value: function( a ) { if ( arguments.length ) { this._setValue( a ); return this.element } return this.curvalue }, enable: function() { this.buttons.removeClass( e ); this.element[0].disabled = false; a.Widget.prototype.enable.call( this ) }, disable: function() { this.buttons.addClass( e ).removeClass( d ); this.element[0].disabled = true; a.Widget.prototype.disable.call( this ) }, destroy: function( b ) { this.wrapper.remove(); this.element.unbind( q ).css( {width: this.oWidth, marginRight: this.oMargin} ); a.Widget.prototype.destroy.call( this ) } } ) })( jQuery ) fields/spinner/vendor/spinner_custom.min.js000066600000017452152141561110015167 0ustar00(function(a,b){var c="ui-state-active",d="ui-state-hover",e="ui-state-disabled",f=a.ui.keyCode,g=f.UP,h=f.DOWN,i=f.RIGHT,j=f.LEFT,k=f.PAGE_UP,l=f.PAGE_DOWN,m=f.HOME,n=f.END,o=a.browser.msie,p=a.browser.mozilla?"DOMMouseScroll":"mousewheel",q=".uispinner",r=[g,h,i,j,k,l,m,n,f.BACKSPACE,f.DELETE,f.TAB],s;a.widget("ui.spinner",{options:{min:null,max:null,allowNull:false,group:"",point:".",prefix:"",suffix:"",places:null,defaultStep:1,largeStep:10,mouseWheel:true,increment:"slow",className:null,showOn:"always",width:95,upIconClass:"ui-icon-triangle-1-n",downIconClass:"ui-icon-triangle-1-s",format:function(a,b){var c=this,d=/(\d+)(\d{3})/,e=(isNaN(a)?0:Math.abs(a)).toFixed(b)+"";for(e=e.replace(".",c.point);d.test(e)&&c.group;e=e.replace(d,"$1"+c.group+"$2")){}return(a<0?"-":"")+c.prefix+e+c.suffix},parse:function(a){var b=this;if(b.group==".")a=a.replace(".","");if(b.point!=".")a=a.replace(b.point,".");return parseFloat(a.replace(/[^0-9\-\.]/g,""))}},_create:function(){var a=this,b=a.element,c=b.attr("type");if(!b.is("input")||c!="text"&&c!="number"){console.error("Invalid target for ui.spinner");return}a._procOptions(true);a._createButtons(b);if(!b.is(":enabled"))a.disable()},_createButtons:function(b){function R(){if(L){a(this).removeClass(c);p._stopSpin();L=false}return false}function Q(){if(!t.disabled){var b=p.element[0],d=this===C?1:-1;b.focus();b.select();a(this).addClass(c);L=true;p._startSpin(d)}return false}function P(a){function b(){G=0;a()}if(G){if(a===H)return;clearTimeout(G)}H=a;G=setTimeout(b,100)}function O(a,b){if(K)return false;var c=String.fromCharCode(b||a),d=p.options;if(c>="0"&&c<="9"||c=="-")return false;if(p.places>0&&c==d.point||c==d.group)return false;return true}function N(a){for(var b=0;b').css({width:(p.oWidth=x?b.width():b.outerWidth())-v,marginRight:"30px",marginLeft:"30px",textAlign:"center","float":"none",marginTop:0}).after('').next(),B=p.btnContainer=a('
    '+'
    '+'
    '+"
    "),C,D,E,F,G,H,I,J,K,L,M=b[0].dir=="rtl";if(u)A.addClass(u);A.append(B.css({height:y,left:0,top:0}));E=p.buttons=B.find(".ui-spinner-button");E.css({width:"30px",height:y-(x?E.outerHeight()-E.height():0)});E.eq(0).css({right:"0"});E.eq(1).css({left:"0"});C=E[0];D=E[1];F=E.find(".ui-icon");B.width("105px");if(w!="always")B.css("opacity",0);if(w=="hover"||w=="both")E.add(b).bind("mouseenter"+q,function(){P(function(){I=true;if(!p.focused||w=="hover")p.showButtons()})}).bind("mouseleave"+q,function S(){P(function(){I=false;if(!p.focused||w=="hover")p.hideButtons()})});E.hover(function(){p.buttons.removeClass(d);if(!t.disabled)a(this).addClass(d)},function(){a(this).removeClass(d)}).mousedown(Q).mouseup(R).mouseout(R);if(o)E.dblclick(function(){if(!t.disabled){p._change();p._doSpin((this===C?1:-1)*t.step)}return false}).bind("selectstart",function(){return false});b.bind("keydown"+q,function(b){var d,e,f,o=b.keyCode;if(b.ctrl||b.alt)return true;if(N(o))K=true;if(J)return false;switch(o){case g:case k:d=1;e=o==k;break;case h:case l:d=-1;e=o==l;break;case i:case j:d=o==i^M?1:-1;break;case m:f=p.options.min;if(f!=null)p._setValue(f);return false;case n:f=p.options.max;f=p.options.max;if(f!=null)p._setValue(f);return false}if(d){if(!J&&!t.disabled){keyDir=d;a(d>0?C:D).addClass(c);J=true;p._startSpin(d,e)}return false}}).bind("keyup"+q,function(a){if(a.ctrl||a.alt)return true;if(N(f))K=false;switch(a.keyCode){case g:case i:case k:case h:case j:case l:E.removeClass(c);p._stopSpin();J=false;return false}}).bind("keypress"+q,function(a){if(O(a.keyCode,a.charCode))return false}).bind("change"+q,function(){p._change()}).bind("focus"+q,function(){function a(){p.element.select()}o?a():setTimeout(a,0);p.focused=true;s=p;if(!I&&(w=="focus"||w=="both"))p.showButtons()}).bind("blur"+q,function(){p.focused=false;if(!I&&(w=="focus"||w=="both"))p.hideButtons()})},_procOptions:function(a){var b=this,c=b.element,d=b.options,e=d.min,f=d.max,g=d.step,h=d.places,i=-1,j;if(d.increment=="slow")d.increment=[{count:1,mult:1,delay:250},{count:3,mult:1,delay:100},{count:0,mult:1,delay:50}];else if(d.increment=="fast")d.increment=[{count:1,mult:1,delay:250},{count:19,mult:1,delay:100},{count:80,mult:1,delay:20},{count:100,mult:10,delay:20},{count:0,mult:100,delay:20}];if(e==null&&(j=c.attr("min"))!=null)e=parseFloat(j);if(f==null&&(j=c.attr("max"))!=null)f=parseFloat(j);if(!g&&(j=c.attr("step"))!=null)if(j!="any"){g=parseFloat(j);d.largeStep*=g}d.step=g=g||d.defaultStep;if(h==null&&(j=g+"").indexOf(".")!=-1)h=j.length-j.indexOf(".")-1;b.places=h;if(f!=null&&e!=null){if(e>f)e=f;i=Math.max(Math.max(i,d.format(f,h,c).length),d.format(e,h,c).length)}if(a)b.inputMaxLength=c[0].maxLength;j=b.inputMaxLength;if(j>0){i=i>0?Math.min(j,i):j;j=Math.pow(10,i)-1;if(f==null||f>j)f=j;j=-(j+1)/10+1;if(e==null||e0)c.attr("maxlength",i);d.min=e;d.max=f;b._change();c.unbind(p+q);if(d.mouseWheel)c.bind(p+q,b._mouseWheel)},_mouseWheel:function(b){var c=a.data(this,"spinner");if(!c.options.disabled&&c.focused&&s===c){c._change();c._doSpin(((b.wheelDelta||-b.detail)>0?1:-1)*c.options.step);return false}},_setTimer:function(a,b,c){function e(){d._spin(b,c)}var d=this;d._stopSpin();d.timer=setInterval(e,a)},_stopSpin:function(){if(this.timer){clearInterval(this.timer);this.timer=0}},_startSpin:function(a,b){var c=this,d=c.options,e=d.increment;c._change();c._doSpin(a*(b?c.options.largeStep:c.options.step));if(e&&e.length>0){c.counter=0;c.incCounter=0;c._setTimer(e[0].delay,a,b)}},_spin:function(a,b){var c=this,d=c.options.increment,e=d[c.incCounter];c._doSpin(a*e.mult*(b?c.options.largeStep:c.options.step));c.counter++;if(c.counter>e.count&&c.incCounter0?b.options.min:b.options.max)||0;b._setValue(c+a)},_parseValue:function(){var a=this.element.val();return a?this.options.parse(a,this.element):null},_validate:function(a){var b=this.options,c=b.min,d=b.max;if(a==null&&!b.allowNull)a=this.curvalue!=null?this.curvalue:c||d||0;if(d!=null&&a>d)return d;else if(c!=null&&a=parseInt(c.max)?c.max:a<=parseInt(c.min)?c.min:Math.round(a/c.step)*c.step,b.val(a).trigger("change")}}}(jQuery);fields/spinner/field_spinner.css.map000066600000002527152141561110013606 0ustar00{ "version": 3, "mappings": "AACI,sCAAc;EACV,QAAQ,EAAE,QAAQ;EAClB,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,IAAI;EACZ,QAAQ,EAAE,MAAM;EAEhB,qDAAe;IACX,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,eAAe;IACvB,UAAU,EAAE,kBAAkB;IAC9B,MAAM,EAAE,4BAA4B;IACpC,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,YAAY;IACzB,qBAAqB,EAAE,YAAY;IACnC,kBAAkB,EAAE,YAAY;IAChC,aAAa,EAAE,YAAY;AAInC,oCAAY;EACR,QAAQ,EAAE,MAAM;EAChB,OAAO,EAAE,MAAM;AAInB,4CAAoB;EAChB,QAAQ,EAAE,QAAQ;EAClB,OAAO,EAAE,CAAC;AAGd,sDAA8B;EAC1B,QAAQ,EAAE,QAAQ;EAClB,GAAG,EAAE,CAAC;EACN,OAAO,EAAE,QAAQ;EACjB,QAAQ,EAAE,MAAM;EAChB,MAAM,EAAE,OAAO;EACf,UAAU,EAAE,sCAAsC;EAClD,UAAU,EAAE,oCAAoC;EAChD,UAAU,EAAE,2EAA2E;EACvF,UAAU,EAAE,iCAAiC;EAC7C,gBAAgB,EAAE,OAAO;EACzB,MAAM,EAAE,IAAI;EACZ,kBAAkB,EAAE,IAAI;EACxB,eAAe,EAAE,IAAI;EACrB,UAAU,EAAE,IAAI;AAGpB;wCACgB;EACZ,UAAU,EAAE,sCAAsC;EAClD,UAAU,EAAE,oCAAoC;EAChD,UAAU,EAAE,2EAA2E;EACvF,UAAU,EAAE,iCAAiC;EAC7C,gBAAgB,EAAE,OAAO;AAG7B;iEACyC;EACrC,qBAAqB,EAAE,WAAW;EAClC,kBAAkB,EAAE,WAAW;EAC/B,aAAa,EAAE,WAAW;AAG9B;iEACyC;EACrC,qBAAqB,EAAE,WAAW;EAClC,kBAAkB,EAAE,WAAW;EAC/B,aAAa,EAAE,WAAW;AAI1B,oDAAS;EACL,GAAG,EAAE,CAAC;EACN,OAAO,EAAE,KAAK;EACd,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,MAAM,EAAE,CAAC;EACT,MAAM,EAAE,iBAAiB;AAG7B,iEAAsB;EAClB,UAAU,EAAE,0QAAyQ;AAGzR,iEAAsB;EAClB,UAAU,EAAE,kQAAiQ", "sources": ["field_spinner.scss"], "names": [], "file": "field_spinner.css" }fields/spinner/field_spinner.js000066600000010617152141561110012655 0ustar00/*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.spinner = redux.field_objects.spinner || {}; $( document ).ready( function() { //redux.field_objects.spinner.init(); } ); redux.field_objects.spinner.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-spinner:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.redux_spinner' ).each( function() { //slider init var spinner = $( this ).find( '.spinner-input' ).data(); spinner.id = $( this ).find( '.spinner-input' ).attr( 'id' ); el.find( "#" + spinner.id ).spinner( { value: parseFloat( spinner.val, null ), min: parseFloat( spinner.min, null ), max: parseFloat( spinner.max, null ), step: parseFloat( spinner.step, null ), range: "min", slide: function( event, ui ) { var input = $( "#" + spinner.id ); input.val( ui.value ); redux_change( input ); } } ); // Limit input for negative var neg = false; if ( parseInt( spinner.min, null ) < 0 ) { neg = true; } //el.find( "#" + spinner.id ).numeric( // { // allowMinus: neg, // min: spinner.min, // max: spinner.max // } //); } ); // Update the slider from the input and vice versa el.find( ".spinner-input" ).keyup( function() { $( this ).addClass( 'spinnerInputChange' ); } ); el.find( ".spinner-input" ).focus( function() { redux.field_objects.spinner.clean( $( this ).val(), $( this ) ); } ); el.find( '.spinner-input' ).typeWatch( { callback: function( value ) { redux.field_objects.spinner.clean( value, $( this ) ); }, wait: 500, highlight: false, captureLength: 1 } ); } ); }; redux.field_objects.spinner.clean = function( value, selector ) { if ( !selector.hasClass( 'spinnerInputChange' ) ) { return; } selector.removeClass( 'spinnerInputChange' ); var spinner = selector.data(); value = parseFloat( value ); if ( value === "" || value === null ) { value = spinner.min; } else if ( value >= parseInt( spinner.max ) ) { value = spinner.max; } else if ( value <= parseInt( spinner.min ) ) { value = spinner.min; } else { value = Math.round( value / spinner.step ) * spinner.step; } selector.val( value ).trigger( 'change' ); }; })( jQuery );fields/spinner/field_spinner.scss000066600000006212152141561110013210 0ustar00.redux-container-spinner { .spinner-wrpr { position: relative; display: block; height: 30px; overflow: hidden; .spinner-input { position: relative !important; z-index: 1; width: 45px !important; height: 30px !important; background: #e7e7e7 !important; border: 1px solid #bfbfbf !important; border-right: 0 !important; border-left: 0 !important; -webkit-border-radius: 0 !important; -moz-border-radius: 0 !important; border-radius: 0 !important; } } .ui-spinner { position: static; display: inline; } .ui-spinner-buttons { position: absolute; padding: 0; } .ui-widget .ui-spinner-button { position: absolute; top: 0; padding: 0 0 30px; overflow: hidden; cursor: pointer; background: -moz-linear-gradient(#ffffff, #f3f3f3); background: -o-linear-gradient(#ffffff, #f3f3f3); background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f3f3f3)); background: linear-gradient(#ffffff, #f3f3f3); background-color: #ffffff; border: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .ui-spinner-button:hover, .ui-state-hover { background: -moz-linear-gradient(#f3f3f3, #ffffff); background: -o-linear-gradient(#f3f3f3, #ffffff); background: -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#ffffff)); background: linear-gradient(#f3f3f3, #ffffff); background-color: #f3f3f3; } .ui-corner-tr, .ui-spinner-button .ui-icon-triangle-1-n { -webkit-border-radius: 0 5px 5px 0; -moz-border-radius: 0 5px 5px 0; border-radius: 0 5px 5px 0; } .ui-corner-br, .ui-spinner-button .ui-icon-triangle-1-s { -webkit-border-radius: 5px 0 0 5px; -moz-border-radius: 5px 0 0 5px; border-radius: 5px 0 0 5px; } .ui-spinner-button { .ui-icon { top: 0; display: block; width: 28px; height: 28px; margin: 0; border: 1px solid #b7b7b7; } .ui-icon-triangle-1-n { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAKCAYAAACXDi8zAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADxJREFUeNpsjwsKADAIQu3u3tsRY6M5gz7w0AqSQFLdZ3ZRgmf44JQ/EOZ9oYOsiDviVemP2oYoWCwBBgDpO6VXVo3RyQAAAABJRU5ErkJggg==) 10px 10px no-repeat!important; } .ui-icon-triangle-1-s { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAKCAYAAACXDi8zAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADhJREFUeNpi+P//PwM6bmlpwS4IorEKokggC8Il0AVhEv9x6sAmiaz9P05XIUsygmVRAUiAESDAAFHcpVdWtdj/AAAAAElFTkSuQmCC) 10px 10px no-repeat!important; } } } @media screen and (max-width: 570px) { .redux-container-spinner { .spinner-wrpr { //text-align: center; // Need to center align this SOMEHOW } } }fields/spinner/arrow_left.png000066600000000226152141561110012343 0ustar00PNG  IHDR /3tEXtSoftwareAdobe ImageReadyqe<8IDATxb?:nii. H %aq&?NW!K2eQH QܥWVIENDB`fields/dimensions/field_dimensions.css.map000066600000000616152141561110014767 0ustar00{ "version": 3, "mappings": "AACI;2CACgB;EACZ,KAAK,EAAE,eAAe;EACtB,KAAK,EAAE,IAAI;AAGf,mDAAwB;EACpB,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,GAAG;;AAI1B,oCAAqC;EAGzB,yDAAM;IACF,OAAO,EAAE,uBAAuB;IAChC,KAAK,EAAE,gBAAgB;EAG3B,2DAAQ;IACJ,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,GAAG;EAIxB,2CAAgB;IACZ,UAAU,EAAE,GAAG", "sources": ["field_dimensions.scss"], "names": [], "file": "field_dimensions.css" }fields/dimensions/field_dimensions.min.js000066600000002361152141561110014620 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.dimensions=redux.field_objects.dimensions||{},a(document).ready(function(){}),redux.field_objects.dimensions.init=function(b){b||(b=a(document).find(".redux-container-dimensions:visible")),a(b).each(function(){var b=a(this),c=b;if(b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),!c.is(":hidden")&&c.hasClass("redux-field-init")){c.removeClass("redux-field-init");var d={width:"resolve",triggerChange:!0,allowClear:!0},e=b.find(".select2_params");if(e.size()>0){var f=e.val();f=JSON.parse(f),d=a.extend({},d,f)}b.find(".redux-dimensions-units").select2(d),b.find(".redux-dimensions-input").on("change",function(){var c=a(this).parents(".redux-field:first").find(".field-units").val();0!==a(this).parents(".redux-field:first").find(".redux-dimensions-units").length&&(c=a(this).parents(".redux-field:first").find(".redux-dimensions-units option:selected").val()),"undefined"!=typeof c?b.find("#"+a(this).attr("rel")).val(a(this).val()+c):b.find("#"+a(this).attr("rel")).val(a(this).val())}),b.find(".redux-dimensions-units").on("change",function(){a(this).parents(".redux-field:first").find(".redux-dimensions-input").change()})}})}}(jQuery);fields/dimensions/field_dimensions.less000066600000001232152141561110014364 0ustar00.redux-dimensions-container { select, .select_wrapper { width: 80px !important; float: left; } .field-dimensions-input { margin-right: 10px; margin-bottom: 7px; } } @media screen and (max-width: 782px) { .redux-dimensions-container { .field-dimensions-input { input { display: inline-block !important; width: 100px !important; } .add-on { padding: 7px 4px; font-size: 16px; line-height: 1.5; } } .select_wrapper { margin-top: 6px; } } }fields/dimensions/field_dimensions.css000066600000001004152141561110014203 0ustar00.redux-dimensions-container select,.redux-dimensions-container .select_wrapper{width:65px !important;float:left}.redux-dimensions-container .field-dimensions-input{margin-right:10px;margin-bottom:7px}@media screen and (max-width:782px){.redux-dimensions-container .field-dimensions-input input{display:inline-block !important;width:100px !important}.redux-dimensions-container .field-dimensions-input .add-on{padding:7px 4px;font-size:16px;line-height:1.5}.redux-dimensions-container .select_wrapper{margin-top:6px}}fields/dimensions/field_dimensions.js000066600000005445152141561110014044 0ustar00 /*global jQuery, document, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.dimensions = redux.field_objects.dimensions || {}; $( document ).ready( function() { //redux.field_objects.dimensions.init(); } ); redux.field_objects.dimensions.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-dimensions:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; var select2_handle = el.find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } el.find( ".redux-dimensions-units" ).select2( default_params ); el.find( '.redux-dimensions-input' ).on( 'change', function() { var units = $( this ).parents( '.redux-field:first' ).find( '.field-units' ).val(); if ( $( this ).parents( '.redux-field:first' ).find( '.redux-dimensions-units' ).length !== 0 ) { units = $( this ).parents( '.redux-field:first' ).find( '.redux-dimensions-units option:selected' ).val(); } if ( typeof units !== 'undefined' ) { el.find( '#' + $( this ).attr( 'rel' ) ).val( $( this ).val() + units ); } else { el.find( '#' + $( this ).attr( 'rel' ) ).val( $( this ).val() ); } } ); el.find( '.redux-dimensions-units' ).on( 'change', function() { $( this ).parents( '.redux-field:first' ).find( '.redux-dimensions-input' ).change(); } ); } ); }; })( jQuery );fields/dimensions/field_dimensions.php000066600000037133152141561110014216 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } //function /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { /* * So, in_array() wasn't doing it's job for checking a passed array for a proper value. * It's wonky. It only wants to check the keys against our array of acceptable values, and not the key's * value. So we'll use this instead. Fortunately, a single no array value can be passed and it won't * take a dump. */ // No errors please $defaults = array( 'width' => true, 'height' => true, 'units_extended' => false, 'units' => 'px', 'mode' => array( 'width' => false, 'height' => false, ), ); $this->field = wp_parse_args( $this->field, $defaults ); $defaults = array( 'width' => '', 'height' => '', 'units' => 'px' ); $this->value = wp_parse_args( $this->value, $defaults ); if ( isset( $this->value['unit'] ) ) { $this->value['units'] = $this->value['unit']; } /* * Acceptable values checks. If the passed variable doesn't pass muster, we unset them * and reset them with default values to avoid errors. */ // If units field has a value but is not an acceptable value, unset the variable if ( isset( $this->field['units'] ) && ! Redux_Helpers::array_in_array( $this->field['units'], array( '', false, '%', 'in', 'cm', 'mm', 'em', 'ex', 'pt', 'pc', 'px', 'rem' ) ) ) { unset( $this->field['units'] ); } //if there is a default unit value but is not an accepted value, unset the variable if ( isset( $this->value['units'] ) && ! Redux_Helpers::array_in_array( $this->value['units'], array( '', '%', 'in', 'cm', 'mm', 'em', 'ex', 'pt', 'pc', 'px' ) ) ) { unset( $this->value['units'] ); } /* * Since units field could be an array, string value or bool (to hide the unit field) * we need to separate our functions to avoid those nasty PHP index notices! */ // if field units has a value and IS an array, then evaluate as needed. if ( isset( $this->field['units'] ) && ! is_array( $this->field['units'] ) ) { //if units fields has a value but units value does not then make units value the field value if ( isset( $this->field['units'] ) && ! isset( $this->value['units'] ) || $this->field['units'] == false ) { $this->value['units'] = $this->field['units']; // If units field does NOT have a value and units value does NOT have a value, set both to blank (default?) } else if ( ! isset( $this->field['units'] ) && ! isset( $this->value['units'] ) ) { $this->field['units'] = 'px'; $this->value['units'] = 'px'; // If units field has NO value but units value does, then set unit field to value field } else if ( ! isset( $this->field['units'] ) && isset( $this->value['units'] ) ) { $this->field['units'] = $this->value['units']; // if unit value is set and unit value doesn't equal unit field (coz who knows why) // then set unit value to unit field } elseif ( isset( $this->value['units'] ) && $this->value['units'] !== $this->field['units'] ) { $this->value['units'] = $this->field['units']; } // do stuff based on unit field NOT set as an array } elseif ( isset( $this->field['units'] ) && is_array( $this->field['units'] ) ) { // nothing to do here, but I'm leaving the construct just in case I have to debug this again. } echo '
    '; if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } // This used to be unit field, but was giving the PHP index error when it was an array, // so I changed it. echo ''; /** * Width * */ if ( $this->field['width'] === true ) { if ( ! empty( $this->value['width'] ) && strpos( $this->value['width'], $this->value['units'] ) === false ) { $this->value['width'] = filter_var( $this->value['width'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); if ( $this->field['units'] !== false ) { $this->value['width'] .= $this->value['units']; } } echo '
    '; echo ''; echo ''; echo '
    '; } /** * Height * */ if ( $this->field['height'] === true ) { if ( ! empty( $this->value['height'] ) && strpos( $this->value['height'], $this->value['units'] ) === false ) { $this->value['height'] = filter_var( $this->value['height'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); if ( $this->field['units'] !== false ) { $this->value['height'] .= $this->value['units']; } } echo '
    '; echo ''; echo ''; echo '
    '; } /** * Units * */ // If units field is set and units field NOT false then // fill out the options object and show it, otherwise it's hidden // and the default units value will apply. if ( isset( $this->field['units'] ) && $this->field['units'] !== false ) { echo '
    '; echo '
    '; }; echo "
    "; } //function /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ function enqueue() { wp_enqueue_style( 'select2-css' ); wp_enqueue_script( 'redux-field-dimensions-js', ReduxFramework::$_url . 'inc/fields/dimensions/field_dimensions' . Redux_Functions::isMin() . '.js', array( 'jquery', 'select2-js', 'redux-js' ), time(), true ); if ( $this->parent->args['dev_mode'] ) { wp_enqueue_style( 'redux-field-dimensions-css', ReduxFramework::$_url . 'inc/fields/dimensions/field_dimensions.css', array(), time(), 'all' ); } } public function output() { // if field units has a value and IS an array, then evaluate as needed. if ( isset( $this->field['units'] ) && ! is_array( $this->field['units'] ) ) { //if units fields has a value but units value does not then make units value the field value if ( isset( $this->field['units'] ) && ! isset( $this->value['units'] ) || $this->field['units'] == false ) { $this->value['units'] = $this->field['units']; // If units field does NOT have a value and units value does NOT have a value, set both to blank (default?) } else if ( ! isset( $this->field['units'] ) && ! isset( $this->value['units'] ) ) { $this->field['units'] = 'px'; $this->value['units'] = 'px'; // If units field has NO value but units value does, then set unit field to value field } else if ( ! isset( $this->field['units'] ) && isset( $this->value['units'] ) ) { $this->field['units'] = $this->value['units']; // if unit value is set and unit value doesn't equal unit field (coz who knows why) // then set unit value to unit field } elseif ( isset( $this->value['units'] ) && $this->value['units'] !== $this->field['units'] ) { $this->value['units'] = $this->field['units']; } // do stuff based on unit field NOT set as an array } elseif ( isset( $this->field['units'] ) && is_array( $this->field['units'] ) ) { // nothing to do here, but I'm leaving the construct just in case I have to debug this again. } $units = isset( $this->value['units'] ) ? $this->value['units'] : ""; $height = isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'height'; $width = isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'width'; $cleanValue = array( $height => isset( $this->value['height'] ) ? filter_var( $this->value['height'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : '', $width => isset( $this->value['width'] ) ? filter_var( $this->value['width'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : '', ); $style = ""; foreach ( $cleanValue as $key => $value ) { // Output if it's a numeric entry if ( isset( $value ) && is_numeric( $value ) ) { $style .= $key . ':' . $value . $units . ';'; } } if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); $this->parent->outputCSS .= $keys . "{" . $style . '}'; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); $this->parent->compilerCSS .= $keys . "{" . $style . '}'; } } } //function } //class } fields/dimensions/field_dimensions.scss000066600000001242152141561110014372 0ustar00.redux-dimensions-container { select, .select_wrapper { width: 65px !important; float: left; } .field-dimensions-input { margin-right: 10px; margin-bottom: 7px; } } @media screen and (max-width: 782px) { .redux-dimensions-container { .field-dimensions-input { input { display: inline-block !important; width: 100px !important; } .add-on { padding: 7px 4px; font-size: 16px; line-height: 1.5; } } .select_wrapper { margin-top: 6px; } } } fields/spacing/field_spacing.scss000066600000001223152141561110013121 0ustar00.redux-container-spacing { select, .select_wrapper { width: 80px !important; float: left; } .field-spacing-input { margin-right: 10px; margin-bottom: 7px; } } @media screen and (max-width: 782px) { .redux-container-spacing { .field-spacing-input { input { display: inline-block !important; width: 70px !important; } .add-on { padding: 7px 4px; font-size: 16px; line-height: 1.5; } } .select_wrapper { margin-top: 6px; } } }fields/spacing/field_spacing.php000066600000046136152141561110012751 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { /* * So, in_array() wasn't doing it's job for checking a passed array for a proper value. * It's wonky. It only wants to check the keys against our array of acceptable values, and not the key's * value. So we'll use this instead. Fortunately, a single no array value can be passed and it won't * take a dump. */ // No errors please // Set field values $defaults = array( 'units' => '', 'mode' => 'padding', 'top' => true, 'bottom' => true, 'all' => false, 'left' => true, 'right' => true, 'units_extended' => false, 'display_units' => true ); $this->field = wp_parse_args( $this->field, $defaults ); // Set default values $defaults = array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', 'units' => 'px' ); $this->value = wp_parse_args( $this->value, $defaults ); /* * Acceptable values checks. If the passed variable doesn't pass muster, we unset them * and reset them with default values to avoid errors. */ // If units field has a value but is not an acceptable value, unset the variable if ( isset( $this->field['units'] ) && ! Redux_Helpers::array_in_array( $this->field['units'], array( '', false, '%', 'in', 'cm', 'mm', 'em', 'rem', 'ex', 'pt', 'pc', 'px' ) ) ) { unset( $this->field['units'] ); } //if there is a default unit value but is not an accepted value, unset the variable if ( isset( $this->value['units'] ) && ! Redux_Helpers::array_in_array( $this->value['units'], array( '', '%', 'in', 'cm', 'mm', 'em', 'rem', 'ex', 'pt', 'pc', 'px' ) ) ) { unset( $this->value['units'] ); } // if ($this->field['mode'] == "absolute") { // $this->field['units'] = ""; // $this->value['units'] = ""; // } if ( $this->field['units'] == false ) { $this->value == ""; } if ( isset( $this->field['mode'] ) && ! in_array( $this->field['mode'], array( 'margin', 'padding' ) ) ) { if ( $this->field['mode'] == "absolute" ) { $absolute = true; } $this->field['mode'] = ""; } $value = array( 'top' => isset( $this->value[ $this->field['mode'] . '-top' ] ) ? filter_var( $this->value[ $this->field['mode'] . '-top' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['top'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'right' => isset( $this->value[ $this->field['mode'] . '-right' ] ) ? filter_var( $this->value[ $this->field['mode'] . '-right' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['right'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'bottom' => isset( $this->value[ $this->field['mode'] . '-bottom' ] ) ? filter_var( $this->value[ $this->field['mode'] . '-bottom' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['bottom'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ), 'left' => isset( $this->value[ $this->field['mode'] . '-left' ] ) ? filter_var( $this->value[ $this->field['mode'] . '-left' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : filter_var( $this->value['left'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) ); // if field units has a value and is NOT an array, then evaluate as needed. if ( isset( $this->field['units'] ) && ! is_array( $this->field['units'] ) ) { //if units fields has a value and is not empty but units value does not then make units value the field value if ( isset( $this->field['units'] ) && $this->field['units'] != "" && ! isset( $this->value['units'] ) || $this->field['units'] == false ) { $this->value['units'] = $this->field['units']; // If units field does NOT have a value and units value does NOT have a value, set both to blank (default?) } else if ( ! isset( $this->field['units'] ) && ! isset( $this->value['units'] ) ) { $this->field['units'] = 'px'; $this->value['units'] = 'px'; // If units field has NO value but units value does, then set unit field to value field } else if ( ! isset( $this->field['units'] ) && isset( $this->value['units'] ) ) { // If Value is defined $this->field['units'] = $this->value['units']; // if unit value is set and unit value doesn't equal unit field (coz who knows why) // then set unit value to unit field } elseif ( isset( $this->value['units'] ) && $this->value['units'] !== $this->field['units'] ) { $this->value['units'] = $this->field['units']; } // do stuff based on unit field NOT set as an array } elseif ( isset( $this->field['units'] ) && is_array( $this->field['units'] ) ) { // nothing to do here, but I'm leaving the construct just in case I have to debug this again. } if ( isset( $this->field['units'] ) ) { $value['units'] = $this->value['units']; } $this->value = $value; if ( ! empty( $this->field['mode'] ) ) { $this->field['mode'] = $this->field['mode'] . "-"; } $defaults = array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', 'units' => '' ); $this->value = wp_parse_args( $this->value, $defaults ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( $this->field['select2'] ); $select2_params = htmlspecialchars( $select2_params, ENT_QUOTES ); echo ''; } echo ''; if ( isset( $this->field['all'] ) && $this->field['all'] == true ) { echo '
    '; } if ( $this->field['top'] === true ) { echo ''; } if ( $this->field['right'] === true ) { echo ''; } if ( $this->field['bottom'] === true ) { echo ''; } if ( $this->field['left'] === true ) { echo ''; } if ( ! isset( $this->field['all'] ) || $this->field['all'] !== true ) { /** * Top * */ if ( $this->field['top'] === true ) { echo '
    '; } /** * Right * */ if ( $this->field['right'] === true ) { echo '
    '; } /** * Bottom * */ if ( $this->field['bottom'] === true ) { echo '
    '; } /** * Left * */ if ( $this->field['left'] === true ) { echo '
    '; } } /** * Units * */ if ( $this->field['units'] !== false && is_array( $this->field['units'] ) /* && !isset($absolute) */ && $this->field['display_units'] == true ) { echo '
    '; echo '
    '; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 1.0.0 */ function enqueue() { wp_enqueue_style( 'select2-css' ); wp_enqueue_script( 'redux-field-spacing-js', ReduxFramework::$_url . 'inc/fields/spacing/field_spacing' . Redux_Functions::isMin() . '.js', array( 'jquery', 'select2-js', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-spacing-css', ReduxFramework::$_url . 'inc/fields/spacing/field_spacing.css', array(), time(), 'all' ); } } //function public function output() { if ( ! isset( $this->field['mode'] ) ) { $this->field['mode'] = "padding"; } if ( isset( $this->field['mode'] ) && ! in_array( $this->field['mode'], array( 'padding', 'absolute', 'margin' ) ) ) { $this->field['mode'] = ""; } $mode = ( $this->field['mode'] != "absolute" ) ? $this->field['mode'] : ""; $units = isset( $this->value['units'] ) ? $this->value['units'] : ""; $style = ''; if ( ! empty( $mode ) ) { foreach ( $this->value as $key => $value ) { if ( $key == "units" ) { continue; } // Strip off any alpha for is_numeric test - kp $num_no_alpha = preg_replace('/[^\d.-]/', '', $value); // Output if it's a numeric entry if ( isset( $value ) && is_numeric( $num_no_alpha ) ) { $style .= $key . ':' . $value . ';'; } } } else { $this->value['top'] = isset( $this->value['top'] ) ? $this->value['top'] : 0; $this->value['bottom'] = isset( $this->value['bottom'] ) ? $this->value['bottom'] : 0; $this->value['left'] = isset( $this->value['left'] ) ? $this->value['left'] : 0; $this->value['right'] = isset( $this->value['right'] ) ? $this->value['right'] : 0; $cleanValue = array( 'top' => isset( $this->value[ $mode . '-top' ] ) ? filter_var( $this->value[ $mode . '-top' ], FILTER_SANITIZE_NUMBER_INT ) : filter_var( $this->value['top'], FILTER_SANITIZE_NUMBER_INT ), 'right' => isset( $this->value[ $mode . '-right' ] ) ? filter_var( $this->value[ $mode . '-right' ], FILTER_SANITIZE_NUMBER_INT ) : filter_var( $this->value['right'], FILTER_SANITIZE_NUMBER_INT ), 'bottom' => isset( $this->value[ $mode . '-bottom' ] ) ? filter_var( $this->value[ $mode . '-bottom' ], FILTER_SANITIZE_NUMBER_INT ) : filter_var( $this->value['bottom'], FILTER_SANITIZE_NUMBER_INT ), 'left' => isset( $this->value[ $mode . '-left' ] ) ? filter_var( $this->value[ $mode . '-left' ], FILTER_SANITIZE_NUMBER_INT ) : filter_var( $this->value['left'], FILTER_SANITIZE_NUMBER_INT ) ); if ( isset( $this->field['all'] ) && true == $this->field['all'] ) { $style .= $mode . 'top:' . $cleanValue['top'] . $units . ';'; $style .= $mode . 'bottom:' . $cleanValue['top'] . $units . ';'; $style .= $mode . 'right:' . $cleanValue['top'] . $units . ';'; $style .= $mode . 'left:' . $cleanValue['top'] . $units . ';'; } else { if ( true == $this->field['top'] ) { $style .= $mode . 'top:' . $cleanValue['top'] . $units . ';'; } if ( true == $this->field['bottom'] ) { $style .= $mode . 'bottom:' . $cleanValue['bottom'] . $units . ';'; } if ( true == $this->field['left'] ) { $style .= $mode . 'left:' . $cleanValue['left'] . $units . ';'; } if ( true == $this->field['right'] ) { $style .= $mode . 'right:' . $cleanValue['right'] . $units . ';'; } } } if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); $this->parent->outputCSS .= $keys . "{" . $style . '}'; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); $this->parent->compilerCSS .= $keys . "{" . $style . '}'; } } } } }fields/spacing/field_spacing.css.map000066600000000606152141561110013516 0ustar00{ "version": 3, "mappings": "AACI;wCACgB;EACZ,KAAK,EAAE,eAAe;EACtB,KAAK,EAAE,IAAI;AAGf,6CAAqB;EACjB,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,GAAG;;AAI1B,oCAAqC;EAGzB,mDAAM;IACF,OAAO,EAAE,uBAAuB;IAChC,KAAK,EAAE,eAAe;EAG1B,qDAAQ;IACJ,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,GAAG;EAIxB,wCAAgB;IACZ,UAAU,EAAE,GAAG", "sources": ["field_spacing.scss"], "names": [], "file": "field_spacing.css" }fields/spacing/field_spacing.css000066600000000750152141561110012742 0ustar00.redux-container-spacing select,.redux-container-spacing .select_wrapper{width:80px !important;float:left}.redux-container-spacing .field-spacing-input{margin-right:10px;margin-bottom:7px}@media screen and (max-width:782px){.redux-container-spacing .field-spacing-input input{display:inline-block !important;width:70px !important}.redux-container-spacing .field-spacing-input .add-on{padding:7px 4px;font-size:16px;line-height:1.5}.redux-container-spacing .select_wrapper{margin-top:6px}}fields/spacing/field_spacing.min.js000066600000002527152141561110013354 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.spacing=redux.field_objects.spacing||{},a(document).ready(function(){}),redux.field_objects.spacing.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-spacing:visible")),a(b).each(function(){var b=a(this),c=b;if(b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),!c.is(":hidden")&&c.hasClass("redux-field-init")){c.removeClass("redux-field-init");var d={width:"resolve",triggerChange:!0,allowClear:!0},e=b.find(".select2_params");if(e.size()>0){var f=e.val();f=JSON.parse(f),d=a.extend({},d,f)}b.find(".redux-spacing-units").select2(d),b.find(".redux-spacing-input").on("change",function(){var b=a(this).parents(".redux-field:first").find(".field-units").val();0!==a(this).parents(".redux-field:first").find(".redux-spacing-units").length&&(b=a(this).parents(".redux-field:first").find(".redux-spacing-units option:selected").val());var c=a(this).val();"undefined"!=typeof b&&c&&(c+=b),a(this).hasClass("redux-spacing-all")?a(this).parents(".redux-field:first").find(".redux-spacing-value").each(function(){a(this).val(c)}):a("#"+a(this).attr("rel")).val(c)}),b.find(".redux-spacing-units").on("change",function(){a(this).parents(".redux-field:first").find(".redux-spacing-input").change()})}})}}(jQuery);fields/spacing/field_spacing.js000066600000006206152141561110012570 0ustar00/*global redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.spacing = redux.field_objects.spacing || {}; $( document ).ready( function() { //redux.field_objects.spacing.init(); } ); redux.field_objects.spacing.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-spacing:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } var default_params = { width: 'resolve', triggerChange: true, allowClear: true }; var select2_handle = el.find( '.select2_params' ); if ( select2_handle.size() > 0 ) { var select2_params = select2_handle.val(); select2_params = JSON.parse( select2_params ); default_params = $.extend( {}, default_params, select2_params ); } el.find( ".redux-spacing-units" ).select2( default_params ); el.find( '.redux-spacing-input' ).on( 'change', function() { var units = $( this ).parents( '.redux-field:first' ).find( '.field-units' ).val(); if ( $( this ).parents( '.redux-field:first' ).find( '.redux-spacing-units' ).length !== 0 ) { units = $( this ).parents( '.redux-field:first' ).find( '.redux-spacing-units option:selected' ).val(); } var value = $( this ).val(); if ( typeof units !== 'undefined' && value ) { value += units; } if ( $( this ).hasClass( 'redux-spacing-all' ) ) { $( this ).parents( '.redux-field:first' ).find( '.redux-spacing-value' ).each( function() { $( this ).val( value ); } ); } else { $( '#' + $( this ).attr( 'rel' ) ).val( value ); } } ); el.find( '.redux-spacing-units' ).on( 'change', function() { $( this ).parents( '.redux-field:first' ).find( '.redux-spacing-input' ).change(); } ); } ); }; })( jQuery );fields/textarea/field_textarea.php000066600000006347152141561110013333 0ustar00field['test'] This is cool. * @param string|boolean $field[default] Default value for this field. * @return Test * @see ParentClass * @since Redux 3.0.9 * @todo Still need to fix this! * @var string cool * @var int notcool * @param string[] $options { * @type boolean $required Whether this element is required * @type string $label The display name for this element */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'ReduxFramework_textarea' ) ) { class ReduxFramework_textarea { /** * Field Constructor. * * @param $value Constructed by Redux class. Based on the passing in $field['defaults'] value and what is stored in the database. * @param $parent ReduxFramework object is passed for easier pointing. * * @since ReduxFramework 1.0.0 * @type string $field [test] Description. Default . Accepts , . */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 * * @param array $arr (See above) * * @return Object A new editor object. **/ function render() { $this->field['placeholder'] = isset( $this->field['placeholder'] ) ? $this->field['placeholder'] : ""; $this->field['rows'] = isset( $this->field['rows'] ) ? $this->field['rows'] : 6; $readonly = ( isset( $this->field['readonly'] ) && $this->field['readonly']) ? ' readonly="readonly"' : ''; // The $this->field variables are already escaped in the ReduxFramework Class. ?> . * * @package ReduxFramework * @subpackage Field_Gallery * @author Abdullah Almesbahi (cadr-sa) * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_gallery' ) ) { /** * Main ReduxFramework_gallery class * * @since 3.0.0 */ class ReduxFramework_gallery { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { echo '
    '; if ( ! empty( $this->value ) ) { $ids = explode( ',', $this->value ); foreach ( $ids as $attachment_id ) { $img = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); echo ''; echo ''; echo ''; } } echo '
    '; echo '' . __( 'Add/Edit Gallery', 'redux-framework' ) . ' '; echo '' . __( 'Clear Gallery', 'redux-framework' ) . ''; echo ''; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ( function_exists( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } else { wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'thickbox' ); wp_enqueue_style( 'thickbox' ); } wp_enqueue_script( 'redux-field-gallery-js', ReduxFramework::$_url . 'inc/fields/gallery/field_gallery' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); } } }fields/gallery/field_gallery.min.js000066600000002665152141561110013405 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.gallery=redux.field_objects.gallery||{},a(document).ready(function(){}),redux.field_objects.gallery.init=function(b){b||(b=a(document).find(".redux-container-gallery:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.on({click:function(b){wp.media.view.Settings.Gallery=wp.media.view.Settings.Gallery.extend({template:function(a){}});var c=a(this).closest("fieldset");if("clear-gallery"===b.currentTarget.id){c.find(".gallery_values").val("");return void c.find(".screenshot").html("")}if("undefined"!=typeof wp&&wp.media&&wp.media.gallery){b.preventDefault();var d,e=(a(this),c.find(".gallery_values").val());d=e?'[gallery ids="'+e+'"]':'[gallery ids="0"]';var f=wp.media.gallery.edit(d);return f.state("gallery-edit").on("update",function(a){c.find(".screenshot").html("");var b,d,e="",f=a.models.map(function(a){return b=a.toJSON(),d="undefined"!=typeof b.sizes&&"undefined"!=typeof b.sizes.thumbnail?b.sizes.thumbnail.url:b.url,e="",c.find(".screenshot").append(e),a.id});c.find(".gallery_values").val(f.join(",")),redux_change(c.find(".gallery_values"))}),!1}}},".gallery-attachments"))})}}(jQuery);fields/gallery/field_gallery.js000066600000011556152141561110012622 0ustar00/* global redux_change, wp */ /*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.gallery = redux.field_objects.gallery || {}; $( document ).ready( function() { //redux.field_objects.gallery.init(); } ); redux.field_objects.gallery.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-gallery:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } // When the user clicks on the Add/Edit gallery button, we need to display the gallery editing el.on( { click: function( event ) { // hide gallery settings used for posts/pages wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend({ template: function(view){ return; } }); var current_gallery = $( this ).closest( 'fieldset' ); if ( event.currentTarget.id === 'clear-gallery' ) { //remove value from input var rmVal = current_gallery.find( '.gallery_values' ).val( '' ); //remove preview images current_gallery.find( ".screenshot" ).html( "" ); return; } // Make sure the media gallery API exists if ( typeof wp === 'undefined' || !wp.media || !wp.media.gallery ) { return; } event.preventDefault(); // Activate the media editor var $$ = $( this ); var val = current_gallery.find( '.gallery_values' ).val(); var final; if ( !val ) { final = '[gallery ids="0"]'; } else { final = '[gallery ids="' + val + '"]'; } var frame = wp.media.gallery.edit( final ); // When the gallery-edit state is updated, copy the attachment ids across frame.state( 'gallery-edit' ).on( 'update', function( selection ) { //clear screenshot div so we can append new selected images current_gallery.find( ".screenshot" ).html( "" ); var element, preview_html = "", preview_img; var ids = selection.models.map( function( e ) { element = e.toJSON(); //preview_img = typeof element.sizes.thumbnail !== 'undefined' ? element.sizes.thumbnail.url : element.url; preview_img = (typeof element.sizes !== "undefined" && typeof element.sizes.thumbnail !== 'undefined') ? element.sizes.thumbnail.url : element.url; preview_html = ""; current_gallery.find( ".screenshot" ).append( preview_html ); return e.id; } ); current_gallery.find( '.gallery_values' ).val( ids.join( ',' ) ); redux_change( current_gallery.find( '.gallery_values' ) ); } ); return false; } }, '.gallery-attachments' ); } ); }; })( jQuery );fields/checkbox/field_checkbox.min.js000066600000001334152141561110013653 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.checkbox=redux.field_objects.checkbox||{},a(document).ready(function(){}),redux.field_objects.checkbox.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-checkbox:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".checkbox").on("click",function(b){var c=0;a(this).is(":checked")&&(c=a(this).parent().find(".checkbox-check").attr("data-val")),a(this).parent().find(".checkbox-check").val(c),redux_change(a(this))}))})}}(jQuery);fields/checkbox/field_checkbox.css.map000066600000000375152141561110014025 0ustar00{ "version": 3, "mappings": "AACI,+BAAM;EACF,cAAc,EAAE,GAAG;EACnB,KAAK,EAAE,IAAI;EAEX,2CAAY;IACR,UAAU,EAAE,CAAC;IACb,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,IAAI", "sources": ["field_checkbox.scss"], "names": [], "file": "field_checkbox.css" }fields/checkbox/field_checkbox.js000066600000003373152141561110013076 0ustar00/** * Redux Checkbox * Dependencies : jquery * Feature added by : Dovy Paukstys * Date : 17 June 2014 */ /*global redux_change, wp, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.checkbox = redux.field_objects.checkbox || {}; $( document ).ready( function() { //redux.field_objects.checkbox.init(); } ); redux.field_objects.checkbox.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-checkbox:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.checkbox' ).on( 'click', function( e ) { var val = 0; if ( $( this ).is( ':checked' ) ) { val = $( this ).parent().find( '.checkbox-check' ).attr( 'data-val' ); } $( this ).parent().find( '.checkbox-check' ).val( val ); redux_change( $( this ) ); } ); } ); }; })( jQuery ); fields/checkbox/field_checkbox.scss000066600000000347152141561110013433 0ustar00.redux-container-checkbox { label { vertical-align: top; width: 100%; .field-desc { margin-top: 0; float: left; width: 93%; clear: none; } } }fields/checkbox/field_checkbox.css000066600000000227152141561110013245 0ustar00.redux-container-checkbox label{vertical-align:top;width:100%}.redux-container-checkbox label .field-desc{margin-top:0;float:left;width:93%;clear:none}fields/checkbox/field_checkbox.php000066600000014763152141561110013256 0ustar00. * * @package ReduxFramework * @subpackage Field_Checkbox * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( !defined ( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( !class_exists ( 'ReduxFramework_checkbox' ) ) { /** * Main ReduxFramework_checkbox class * * @since 1.0.0 */ class ReduxFramework_checkbox { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct ( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render () { if( !empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { if (empty($this->field['args'])) { $this->field['args'] = array(); } $this->field['options'] = $this->parent->get_wordpress_data($this->field['data'], $this->field['args']); if (empty($this->field['options'])) { return; } } $this->field[ 'data_class' ] = ( isset ( $this->field[ 'multi_layout' ] ) ) ? 'data-' . $this->field[ 'multi_layout' ] : 'data-full'; if ( !empty ( $this->field[ 'options' ] ) && ( is_array ( $this->field[ 'options' ] ) || is_array ( $this->field[ 'default' ] ) ) ) { echo '
      '; if ( !isset ( $this->value ) ) { $this->value = array(); } if ( !is_array ( $this->value ) ) { $this->value = array(); } if ( empty ( $this->field[ 'options' ] ) && isset ( $this->field[ 'default' ] ) && is_array ( $this->field[ 'default' ] ) ) { $this->field[ 'options' ] = $this->field[ 'default' ]; } foreach ( $this->field[ 'options' ] as $k => $v ) { if ( empty ( $this->value[ $k ] ) ) { $this->value[ $k ] = ""; } echo '
    • '; echo ''; echo '
    • '; } echo '
    '; } else if ( empty ( $this->field[ 'data' ] ) ) { echo (!empty ( $this->field[ 'desc' ] ) ) ? '
    '; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue () { if ($this->parent->args['dev_mode']) { wp_enqueue_style ( 'redux-field-checkbox-css', ReduxFramework::$_url . 'inc/fields/checkbox/field_checkbox.css', array(), time (), 'all' ); } wp_enqueue_script ( 'redux-field-checkbox-js', ReduxFramework::$_url . 'inc/fields/checkbox/field_checkbox' . Redux_Functions::isMin () . '.js', array( 'jquery', 'redux-js' ), time (), true ); } } } fields/color_rgba/field_color_rgba.min.js000066600000007163152141561110014527 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.color_rgba=redux.field_objects.color_rgba||{},redux.field_objects.color_rgba.fieldID="",redux.field_objects.color_rgba.hexToRGBA=function(a,b){var c;if(null===a)c="";else{a=a.replace("#","");var d=parseInt(a.substring(0,2),16),e=parseInt(a.substring(2,4),16),f=parseInt(a.substring(4,6),16);c="rgba("+d+","+e+","+f+","+b+")"}return c},redux.field_objects.color_rgba.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-color_rgba:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),redux.field_objects.color_rgba.modInit(b),redux.field_objects.color_rgba.initColorPicker(b))})},redux.field_objects.color_rgba.modInit=function(a){redux.field_objects.color_rgba.fieldID=a.find(".redux-color_rgba-container").data("id")},redux.field_objects.color_rgba.initColorPicker=function(b){var c=redux.field_objects.color_rgba.fieldID,d=b.find(".redux-color-rgba"),e=d.data("current-alpha");e=Number(null===e||void 0===e?1:e);var f=d.data("current-color");f=""===f||"transparent"===f?"":f;var g=d.data("output-transparent");g=Boolean(""===g?!1:g);var h=b.find(".redux-color-rgba-container"),i=h.data("palette");i=decodeURIComponent(i),i=JSON.parse(i),null===i&&(i=[["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff"],["#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],["#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d9ead3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc"],["#dd7e6b","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#a4c2f4","#9fc5e8","#b4a7d6","#d5a6bd"],["#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#6fa8dc","#8e7cc3","#c27ba0"],["#a61c00","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3c78d8","#3d85c6","#674ea7","#a64d79"],["#85200c","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#0b5394","#351c75","#741b47"],["#5b0f00","#660000","#783f04","#7f6000","#274e13","#0c343d","#1c4587","#073763","#20124d","#4c1130"]]);var j=h.data("show-input");j=Boolean(""===j?!1:j);var k=h.data("show-initial");k=Boolean(""===k?!1:k);var l=h.data("show-alpha");l=Boolean(""===l?!1:l);var m=h.data("allow-empty");m=Boolean(""===m?!1:m);var n=h.data("show-palette");n=Boolean(""===n?!1:n);var o=h.data("show-palette-only");o=Boolean(""===o?!1:o);var p=h.data("show-selection-palette");p=Boolean(""===p?!1:p);var q=Number(h.data("max-palette-size")),r=h.data("clickout-fires-change");r=Boolean(""===r?!1:r);var s=String(h.data("choose-text")),t=String(h.data("cancel-text")),u=String(h.data("input-text")),v=h.data("show-buttons");v=Boolean(""===v?!1:v);var w=String(h.data("container-class")),x=String(h.data("replacer-class"));d.spectrum({color:f,showAlpha:l,showInput:j,allowEmpty:m,className:"redux-color-rgba",showInitial:k,showPalette:n,showSelectionPalette:p,maxPaletteSize:q,showPaletteOnly:o,clickoutFiresChange:r,chooseText:s,cancelText:t,showButtons:v,containerClassName:w,replacerClassName:x,preferredFormat:"hex6",localStorageKey:"redux.color-rgba."+c,palette:i,inputText:u,change:function(c){var d,e,f;null===c?(d=g===!0?"transparent":null,e=null):(d=c.toHexString(),e=c.alpha),f="transparent"!=d?redux.field_objects.color_rgba.hexToRGBA(d,e):"transparent";var h=a(this).data("block-id");b.find("input#"+h+"-color").val(d),b.find("input#"+h+"-alpha").val(e),b.find("input#"+h+"-rgba").val(f),redux_change(b.find(".redux-color-rgba-container"))}})}}(jQuery);fields/color_rgba/field_color_rgba.php000066600000030345152141561110014116 0ustar00. * * @package Redux Framework * @subpackage Spectrum Color Picker * @author Kevin Provance (kprovance) * @version 1.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_color_rgba' ) ) { /** * Main ReduxFramework_color_rgba class * * @since 1.0.0 */ class ReduxFramework_color_rgba { /** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * * @param array $field Field sections. * @param array $value Values. * @param array $parent Parent object. * * @return void */ public function __construct( $field = array(), $value = '', $parent ) { // Set required variables $this->parent = $parent; $this->field = (array) $field; $this->value = $value; $defaults = array( 'color' => '', 'alpha' => 1, 'rgba' => '' ); $option_defaults = array( "show_input" => true, "show_initial" => false, "show_alpha" => true, "show_palette" => false, "show_palette_only" => false, "max_palette_size" => 10, "show_selection_palette" => false, "allow_empty" => true, "clickout_fires_change" => false, "choose_text" => __( 'Choose', 'redux-framework' ), "cancel_text" => __( 'Cancel', 'redux-framework' ), "show_buttons" => true, "input_text" => __( 'Select Color', 'redux-framework' ), "palette" => null, ); $this->value = wp_parse_args( $this->value, $defaults ); $this->field['options'] = isset( $this->field['options'] ) ? wp_parse_args( $this->field['options'], $option_defaults ) : $option_defaults; // Convert empty array to null, if there. $this->field['options']['palette'] = empty( $this->field['options']['palette'] ) ? null : $this->field['options']['palette']; $this->field['output_transparent'] = isset( $this->field['output_transparent'] ) ? $this->field['output_transparent'] : false; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $field_id = $this->field['id']; // Color picker container echo '
    '; // Colour picker layout $opt_name = $this->parent->args['opt_name']; if ( '' == $this->value['color'] || 'transparent' == $this->value['color'] ) { $color = ''; } else { $color = Redux_Helpers::hex2rgba( $this->value['color'], $this->value['alpha'] ); } if ( $this->value['rgba'] == '' && $this->value['color'] != '' ) { $this->value['rgba'] = Redux_Helpers::hex2rgba( $this->value['color'], $this->value['alpha'] ); } echo ''; echo ''; // Hidden input for alpha channel echo ''; // Hidden input for rgba echo ''; echo '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { // Set up min files for dev_mode = false. $min = Redux_Functions::isMin(); // Field dependent JS if ( ! wp_script_is( 'redux-field-color-rgba-js' ) ) { wp_enqueue_script( 'redux-field-color-rgba-js', ReduxFramework::$_url . 'inc/fields/color_rgba/field_color_rgba' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-spectrum-js' ), time(), true ); } // Spectrum CSS if ( ! wp_style_is( 'redux-spectrum-css' ) ) { wp_enqueue_style( 'redux-spectrum-css' ); } if ( $this->parent->args['dev_mode'] ) { if ( ! wp_style_is( 'redux-field-color-rgba-css' ) ) { wp_enqueue_style( 'redux-field-color-rgba-css', ReduxFramework::$_url . 'inc/fields/color_rgba/field_color_rgba.css', array(), time(), 'all' ); } } } /** * getColorVal. Returns formatted color val in hex or rgba. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access private * @return string */ private function getColorVal() { // No notices $color = ''; $alpha = 1; $rgba = ''; // Must be an array if ( is_array( $this->value ) ) { // Enum array to parse values foreach ( $this->value as $id => $val ) { // Sanitize alpha if ( $id == 'alpha' ) { $alpha = ! empty( $val ) ? $val : 1; } elseif ( $id == 'color' ) { $color = ! empty( $val ) ? $val : ''; } elseif ( $id == 'rgba' ) { $rgba = ! empty( $val ) ? $val : ''; $rgba = Redux_Helpers::hex2rgba( $color, $alpha ); } } // Only build rgba output if alpha ia less than 1 if ( $alpha < 1 && $alpha <> '' ) { $color = $rgba; } } return $color; } /** * Output Function. * Used to enqueue to the front-end * * @since 1.0.0 * @access public * @return void */ public function output() { if ( ! empty( $this->value ) ) { $style = ''; $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'color' ); $color_val = $this->getColorVal(); $style .= $mode . ':' . $color_val . ';'; if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { if ( ! empty( $color_val ) ) { $css = Redux_Functions::parseCSS( $this->field['output'], $style, $color_val ); $this->parent->outputCSS .= $css; } } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { if ( ! empty( $color_val ) ) { $css = Redux_Functions::parseCSS( $this->field['compiler'], $style, $color_val ); $this->parent->compilerCSS .= $css; } } } } } } fields/color_rgba/field_color_rgba.css000066600000002162152141561110014113 0ustar00.sp-container{color:#555;border-color:#ccc;background:#f7f7f7;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,0.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,0.08);vertical-align:top}.sp-replacer{color:#555;border-color:#ccc;background:#f7f7f7;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,0.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,0.08);vertical-align:top}.sp-replacer:focus,.sp-replacer:hover,.sp-replacer.focus,.sp-replacer.hover{background:#fafafa;border-color:#999;color:#222}.sp-replacer:focus,.sp-replacer.focus{-webkit-box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,0.8);box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,0.8)}.sp-replacer.active:focus{-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5),0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,0.8);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5),0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,0.8)}.sp-replacer.active,.sp-replacer.active:hover,.sp-replacer:active{background:#eee;border-color:#999;color:#333;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5)}fields/color_rgba/field_color_rgba.js000066600000022114152141561110013736 0ustar00(function($){ 'use strict'; redux.field_objects = redux.field_objects || {}; redux.field_objects.color_rgba = redux.field_objects.color_rgba || {}; redux.field_objects.color_rgba.fieldID = ''; redux.field_objects.color_rgba.hexToRGBA = function( hex, alpha ) { var result; if (hex === null) { result = ''; } else { hex = hex.replace('#', ''); var r = parseInt(hex.substring(0, 2), 16); var g = parseInt(hex.substring(2, 4), 16); var b = parseInt(hex.substring(4, 6), 16); result = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'; } return result; }; redux.field_objects.color_rgba.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-color_rgba:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } redux.field_objects.color_rgba.modInit(el); redux.field_objects.color_rgba.initColorPicker(el); }); }; redux.field_objects.color_rgba.modInit = function(el) { redux.field_objects.color_rgba.fieldID = el.find('.redux-color_rgba-container').data('id'); }; // Initialize colour picker redux.field_objects.color_rgba.initColorPicker = function(el){ // Get field ID var field_id = redux.field_objects.color_rgba.fieldID; // Get the color scheme container var colorpickerInput = el.find('.redux-color-rgba'); // Get alpha value and sanitize it var currentAlpha = colorpickerInput.data('current-alpha'); currentAlpha = Number((currentAlpha === null || currentAlpha === undefined) ? 1 : currentAlpha); // Get colour value and sanitize it var currentColor = colorpickerInput.data('current-color'); currentColor = (currentColor === '' || currentColor === 'transparent') ? '' : currentColor; var outputTransparent = colorpickerInput.data('output-transparent'); outputTransparent = Boolean((outputTransparent === '') ? false : outputTransparent); // Color picker arguments var container = el.find('.redux-color-rgba-container'); // Get, decode and parse palette. var palette = container.data('palette'); palette = decodeURIComponent(palette); palette = JSON.parse(palette); // Default palette if (palette === null) { palette = [ ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"], ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"], ["#e6b8af", "#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d9ead3", "#c9daf8", "#cfe2f3", "#d9d2e9", "#ead1dc"], ["#dd7e6b", "#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#a4c2f4", "#9fc5e8", "#b4a7d6", "#d5a6bd"], ["#cc4125", "#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6d9eeb", "#6fa8dc", "#8e7cc3", "#c27ba0"], ["#a61c00", "#cc0000", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3c78d8", "#3d85c6", "#674ea7", "#a64d79"], ["#85200c", "#990000", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#1155cc", "#0b5394", "#351c75", "#741b47"], ["#5b0f00", "#660000", "#783f04", "#7f6000", "#274e13", "#0c343d", "#1c4587", "#073763", "#20124d", "#4c1130"] ]; } // Get and sanitize show input argument var showInput = container.data('show-input'); showInput = Boolean((showInput === '') ? false : showInput); // Get and sanitize show initial argument var showInitial = container.data('show-initial'); showInitial = Boolean((showInitial === '') ? false : showInitial); // Get and sanitize show alpha argument var showAlpha = container.data('show-alpha'); showAlpha = Boolean((showAlpha === '') ? false : showAlpha); // Get and sanitize allow empty argument var allowEmpty = container.data('allow-empty'); allowEmpty = Boolean((allowEmpty === '') ? false : allowEmpty); // Get and sanitize show palette argument var showPalette = container.data('show-palette'); showPalette = Boolean((showPalette === '') ? false : showPalette); // Get and sanitize show palette only argument var showPaletteOnly = container.data('show-palette-only'); showPaletteOnly = Boolean((showPaletteOnly === '') ? false : showPaletteOnly); // Get and sanitize show selection palette argument var showSelectionPalette = container.data('show-selection-palette'); showSelectionPalette = Boolean((showSelectionPalette === '') ? false : showSelectionPalette); // Get max palette size var maxPaletteSize = Number(container.data('max-palette-size')); // Get and sanitize clickout fires change argument var clickoutFiresChange = container.data('clickout-fires-change'); clickoutFiresChange = Boolean((clickoutFiresChange === '') ? false : clickoutFiresChange); // Get choose button text var chooseText = String(container.data('choose-text')); // Get cancel button text var cancelText = String(container.data('cancel-text')); // Get cancel button text var inputText = String(container.data('input-text')); // Get and sanitize show buttons argument var showButtons = container.data('show-buttons'); showButtons = Boolean((showButtons === '') ? false : showButtons); // Get container class var containerClass = String(container.data('container-class')); // Get replacer class var replacerClass = String(container.data('replacer-class')); // Color picker options colorpickerInput.spectrum({ color: currentColor, //'#ffffff', showAlpha: showAlpha, showInput: showInput, allowEmpty: allowEmpty, className: 'redux-color-rgba', showInitial: showInitial, showPalette: showPalette, showSelectionPalette: showSelectionPalette, maxPaletteSize: maxPaletteSize, showPaletteOnly: showPaletteOnly, clickoutFiresChange: clickoutFiresChange, chooseText: chooseText, cancelText: cancelText, showButtons: showButtons, containerClassName: containerClass, replacerClassName: replacerClass, preferredFormat: 'hex6', localStorageKey: 'redux.color-rgba.' + field_id, palette: palette, inputText: inputText, // on change change: function(color) { var colorVal, alphaVal, rgbaVal; if (color === null) { if (outputTransparent === true) { colorVal = 'transparent'; } else { colorVal = null; } alphaVal = null; } else { colorVal = color.toHexString(); alphaVal = color.alpha; } if (colorVal != 'transparent') { rgbaVal = redux.field_objects.color_rgba.hexToRGBA(colorVal, alphaVal); } else { rgbaVal = 'transparent'; } var blockID = $(this).data('block-id'); // Update HTML color value el.find('input#' + blockID + '-color').val(colorVal); // Update HTML alpha value el.find('input#' + blockID + '-alpha').val(alphaVal); // Update RGBA alpha value el.find('input#' + blockID + '-rgba').val(rgbaVal); redux_change(el.find('.redux-color-rgba-container')); } }); }; })(jQuery);fields/color_rgba/field_color_rgba.css.map000066600000001337152141561110014672 0ustar00{ "version": 3, "mappings": "AAAA,aAAc;EACd;;oHAEkH;EACjH,KAAK,EAAE,IAAI;EACX,YAAY,EAAE,OAAO;EACrB,UAAU,EAAE,OAAO;EACnB,kBAAkB,EAAE,+CAAiD;EACrE,UAAU,EAAE,+CAAiD;EAC5D,cAAc,EAAE,GAAG;;AAGrB,YAAa;EACT,KAAK,EAAE,IAAI;EACX,YAAY,EAAE,OAAO;EACrB,UAAU,EAAE,OAAO;EACnB,kBAAkB,EAAE,+CAAiD;EACrE,UAAU,EAAE,+CAAiD;EAC7D,cAAc,EAAE,GAAG;;AAGvB;;;kBAGmB;EACf,UAAU,EAAE,OAAO;EACnB,YAAY,EAAE,IAAI;EAClB,KAAK,EAAE,IAAI;;AAGf;kBACmB;EACf,kBAAkB,EACV,sDACkC;EAC1C,UAAU,EACF,sDACkC;;AAI9C,yBAA0B;EACzB,kBAAkB,EACjB,+FAEkC;EACnC,UAAU,EACT,+FAEkC;;AAGpC;;mBAEmB;EACf,UAAU,EAAE,IAAI;EAChB,YAAY,EAAE,IAAI;EAClB,KAAK,EAAE,IAAI;EACX,kBAAkB,EAAE,uCAAyC;EAC7D,UAAU,EAAE,uCAAyC", "sources": ["field_color_rgba.scss"], "names": [], "file": "field_color_rgba.css" }fields/color_rgba/field_color_rgba.scss000066600000003225152141561110014277 0ustar00.sp-container { /* border: solid 1px black; -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5), 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8); box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5), 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);*/ color: #555; border-color: #cccccc; background: #f7f7f7; -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 ); box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 ); vertical-align: top; } .sp-replacer { color: #555; border-color: #cccccc; background: #f7f7f7; -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 ); box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 ); vertical-align: top; } .sp-replacer:focus, .sp-replacer:hover, .sp-replacer.focus, .sp-replacer.hover { background: #fafafa; border-color: #999; color: #222; } .sp-replacer:focus, .sp-replacer.focus { -webkit-box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); } .sp-replacer.active:focus { -webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ), 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ), 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); } .sp-replacer.active, .sp-replacer.active:hover, .sp-replacer:active{ background: #eee; border-color: #999; color: #333; -webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ); box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ); } fields/image_select/field_image_select.min.js000066600000004251152141561110015342 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.image_select=redux.field_objects.image_select||{},a(document).ready(function(){}),redux.field_objects.image_select.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-image_select:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".redux-image-select label img, .redux-image-select label .tiles").click(function(c){var d=a(this).closest("label").attr("for");if(a(this).parents("fieldset:first").find(".redux-image-select-selected").removeClass("redux-image-select-selected").find("input[type='radio']").attr("checked",!1),a(this).closest("label").find('input[type="radio"]').prop("checked"),a(this).closest("label").hasClass("redux-image-select-preset-"+d)){c.preventDefault();var e=a(this).closest("label").find("input"),f=e.data("presets"),g=e.data("merge");if(void 0!==g&&null!==g&&("string"===a.type(g)&&(g=g.split("|")),a.each(f,function(b,c){g!==!0&&-1==a.inArray(b,g)||"object"!==a.type(redux.options[b])||(f[b]=a.extend(redux.options[b],f[b]))})),void 0!==e&&null!==e){var h=confirm(redux.args.preset_confirm);h&&(b.find('label[for="'+d+'"]').addClass("redux-image-select-selected").find("input[type='radio']").attr("checked",!0),window.onbeforeunload=null,0===a("#import-code-value").length?a(this).append('"):a("#import-code-value").val(JSON.stringify(f)),0!==a("#publishing-action #publish").length?a("#publish").click():a("#redux-import").click())}return!1}b.find('label[for="'+d+'"]').addClass("redux-image-select-selected").find("input[type='radio']").attr("checked",!0).trigger("change"),redux_change(a(this).closest("label").find('input[type="radio"]'))}),b.find(".tiles").qtip({content:{text:function(b,c){return""}},style:"qtip-tipsy",position:{my:"top center",at:"bottom center"}}))})}}(jQuery);fields/image_select/field_image_select.php000066600000025305152141561110014736 0ustar00. * * @package ReduxFramework * @subpackage Field_Images * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_image_select' ) ) { /** * Main ReduxFramework_image_select class * * @since 1.0.0 */ class ReduxFramework_image_select { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { if ( ! empty( $this->field['options'] ) ) { echo '
    '; echo '
      '; $x = 1; foreach ( $this->field['options'] as $k => $v ) { if ( ! is_array( $v ) ) { $v = array( 'img' => $v ); } if ( ! isset( $v['title'] ) ) { $v['title'] = ''; } if ( ! isset( $v['alt'] ) ) { $v['alt'] = $v['title']; } if ( ! isset( $v['class'] ) ) { $v['class'] = ''; } $style = ''; if ( ! empty( $this->field['width'] ) ) { $style .= 'width: ' . $this->field['width']; if ( is_numeric( $this->field['width'] ) ) { $style .= 'px'; } $style .= ';'; } else { $style .= " width: 100%; "; } if ( ! empty( $this->field['height'] ) ) { $style .= 'height: ' . $this->field['height']; if ( is_numeric( $this->field['height'] ) ) { $style .= 'px'; } $style .= ';'; } $theValue = $k; if ( ! empty( $this->field['tiles'] ) && $this->field['tiles'] == true ) { $theValue = $v['img']; } $selected = ( checked( $this->value, $theValue, false ) != '' ) ? ' redux-image-select-selected' : ''; $presets = ''; $is_preset = false; $this->field['class'] .= ' noUpdate '; if ( isset( $this->field['presets'] ) && $this->field['presets'] !== false ) { $this->field['class'] = trim($this->field['class']); if ( ! isset( $v['presets'] ) ) { $v['presets'] = array(); } if ( ! is_array( $v['presets'] ) ) { $v['presets'] = json_decode( $v['presets'], true ); } // Only highlight the preset if it's the same if ( $selected ) { if ( empty( $v['presets'] ) ) { $selected = false; } else { foreach ( $v['presets'] as $pk => $pv ) { if ( isset( $v['merge'] ) && $v['merge'] !== false ) { if( ( $v['merge'] === true || in_array( $pk, $v['merge'] ) ) && is_array( $this->parent->options[ $pk ] ) ) { $pv = array_merge( $this->parent->options[ $pk ], $pv ); } } if ( empty( $pv ) && isset( $this->parent->options[ $pk ] ) && ! empty( $this->parent->options[ $pk ] ) ) { $selected = false; } else if ( ! empty( $pv ) && ! isset( $this->parent->options[ $pk ] ) ) { $selected = false; } else if ( isset( $this->parent->options[ $pk ] ) && $this->parent->options[ $pk ] != $pv ) { $selected = false; } if ( ! $selected ) { // We're still not using the same preset. Let's unset that shall we? $this->value = ""; break; } } } } $v['presets']['redux-backup'] = 1; $presets = ' data-presets="' . htmlspecialchars( json_encode( $v['presets'] ), ENT_QUOTES, 'UTF-8' ) . '"'; $is_preset = true; $this->field['class'] = trim( $this->field['class'] ) . ' redux-presets'; } $is_preset_class = $is_preset ? '-preset-' : ' '; $merge = ''; if ( isset( $v['merge'] ) && $v['merge'] !== false ) { $merge = is_array( $v['merge'] ) ? implode( '|', $v['merge'] ) : 'true'; $merge = ' data-merge="' . htmlspecialchars( $merge, ENT_QUOTES, 'UTF-8' ) . '"'; } echo '
    • '; echo ''; echo '
    • '; $x ++; } echo '
    '; echo '
    '; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_script( 'redux-field-image-select-js', ReduxFramework::$_url . 'inc/fields/image_select/field_image_select' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-image-select-css', ReduxFramework::$_url . 'inc/fields/image_select/field_image_select.css', array(), time(), 'all' ); } } public function getCSS( $mode = '' ) { $css = ''; $value = $this->value; $output = ''; if ( ! empty( $value ) && ! is_array($value) ) { switch ( $mode ) { case 'background-image': $output = "background-image: url('" . $value . "');"; break; default: $output = $mode . ": " . $value . ";"; } } $css .= $output; return $css; } public function output() { $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'background-image' ); if ( ( ! isset( $this->field['output'] ) || ! is_array( $this->field['output'] ) ) && ( ! isset( $this->field['compiler'] ) ) ) { return; } $style = $this->getCSS( $mode ); if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $keys = implode( ",", $this->field['output'] ); $style = $keys . "{" . $style . '}'; $this->parent->outputCSS .= $style; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $keys = implode( ",", $this->field['compiler'] ); $style = $keys . "{" . $style . '}'; $this->parent->compilerCSS .= $style; } } } } }fields/image_select/field_image_select.css000066600000002447152141561110014741 0ustar00.redux-container-image_select .redux-table-container{display:table;table-layout:fixed;width:100%}.redux-container-image_select .redux-image-select{margin:0 !important}.redux-container-image_select .redux-image-select .tiles{display:block;background-color:#FFF;background-repeat:repeat;width:40px;height:40px}.redux-container-image_select .redux-image-select img,.redux-container-image_select .redux-image-select .tiles{border-color:#d9d9d9}.redux-container-image_select .redux-image-select li:last-child{margin-bottom:0}.redux-container-image_select .redux-image-select input[type='radio']{display:none}.redux-container-image_select .redux-image-select-presets img{width:100%}.redux-container-image_select ul.redux-image-select li{margin:0 10px 3px 10px;display:inline-block;padding:2px 2px;padding-left:0}.redux-container-image_select .redux-image-select-selected{background-color:#f9f9f9}.redux-container-image_select .redux-image-select img,.redux-container-image_select .redux-image-select-selected img,.redux-container-image_select .redux-image-select .tiles,.redux-container-image_select .redux-image-select-selected .tiles{border-width:4px;border-style:solid}.redux-container-image_select .redux-image-select-selected .tiles,.redux-container-image_select .redux-image-select-selected .tiles{border-color:#7a7a7a}fields/image_select/field_image_select.scss000066600000002324152141561110015116 0ustar00.redux-container-image_select { .redux-table-container { display: table; table-layout: fixed; width: 100%; } .redux-image-select { margin: 0 !important; .tiles { display: block; background-color: #FFF; background-repeat: repeat; width: 40px; height: 40px; } img, .tiles { border-color: #d9d9d9; } li:last-child { margin-bottom: 0; } input[type='radio'] { display: none; } } .redux-image-select-presets img { width: 100%; } ul.redux-image-select li { margin: 0 10px 3px 10px; display: inline-block; padding: 2px 2px; padding-left: 0; } .redux-image-select-selected { background-color: #f9f9f9; } .redux-image-select img, .redux-image-select-selected img, .redux-image-select .tiles, .redux-image-select-selected .tiles { border-width: 4px; border-style: solid; } .redux-image-select-selected, .redux-image-select-selected { .tiles { border-color: #7a7a7a; } } } fields/image_select/field_image_select.css.map000066600000001270152141561110015506 0ustar00{ "version": 3, "mappings": "AACI,oDAAuB;EACnB,OAAO,EAAE,KAAK;EACd,YAAY,EAAE,KAAK;EACnB,KAAK,EAAE,IAAI;AAGf,iDAAoB;EAChB,MAAM,EAAE,YAAY;EAEpB,wDAAO;IACH,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,MAAM;IACzB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;EAGhB;0DACO;IACH,YAAY,EAAE,OAAO;EAGzB,+DAAc;IACV,aAAa,EAAE,CAAC;EAGpB,qEAAoB;IAChB,OAAO,EAAE,IAAI;AAIrB,6DAAgC;EAC5B,KAAK,EAAE,IAAI;AAGf,sDAAyB;EACrB,MAAM,EAAE,eAAe;EACvB,OAAO,EAAE,YAAY;EACrB,OAAO,EAAE,OAAO;EAChB,YAAY,EAAE,CAAC;AAGnB,0DAA6B;EACzB,gBAAgB,EAAE,OAAO;AAG7B;;;iEAGoC;EAChC,YAAY,EAAE,GAAG;EACjB,YAAY,EAAE,KAAK;AAKnB;iEAAO;EACH,YAAY,EAAE,OAAO", "sources": ["field_image_select.scss"], "names": [], "file": "field_image_select.css" }fields/image_select/field_image_select.js000066600000012650152141561110014562 0ustar00/* global confirm, redux, redux_change */ /*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.image_select = redux.field_objects.image_select || {}; $( document ).ready( function() { //redux.field_objects.image_select.init(); } ); redux.field_objects.image_select.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-image_select:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } // On label click, change the input and class el.find( '.redux-image-select label img, .redux-image-select label .tiles' ).click( function( e ) { var id = $( this ).closest( 'label' ).attr( 'for' ); $( this ).parents( "fieldset:first" ).find( '.redux-image-select-selected' ).removeClass( 'redux-image-select-selected' ).find( "input[type='radio']" ).attr( "checked", false ); $( this ).closest( 'label' ).find( 'input[type="radio"]' ).prop( 'checked' ); if ( $( this ).closest( 'label' ).hasClass( 'redux-image-select-preset-' + id ) ) { // If they clicked on a preset, import! e.preventDefault(); var presets = $( this ).closest( 'label' ).find( 'input' ); var data = presets.data( 'presets' ); var merge = presets.data( 'merge' ); if( merge !== undefined && merge !== null ) { if( $.type( merge ) === 'string' ) { merge = merge.split('|'); } $.each(data, function( index, value ) { if( ( merge === true || $.inArray( index, merge ) != -1 ) && $.type( redux.options[index] ) === 'object' ) { data[index] = $.extend(redux.options[index], data[index]); } }); } if ( presets !== undefined && presets !== null ) { var answer = confirm( redux.args.preset_confirm ); if ( answer ) { el.find( 'label[for="' + id + '"]' ).addClass( 'redux-image-select-selected' ).find( "input[type='radio']" ).attr( "checked", true ); window.onbeforeunload = null; if ( $( '#import-code-value' ).length === 0 ) { $( this ).append( '' ); } else { $( '#import-code-value' ).val( JSON.stringify( data ) ); } if ( $( '#publishing-action #publish' ).length !== 0 ) { $( '#publish' ).click(); } else { $( '#redux-import' ).click(); } } } else { } return false; } else { el.find( 'label[for="' + id + '"]' ).addClass( 'redux-image-select-selected' ).find( "input[type='radio']" ).attr( "checked", true ).trigger('change'); redux_change( $( this ).closest( 'label' ).find( 'input[type="radio"]' ) ); } } ); // Used to display a full image preview of a tile/pattern el.find( '.tiles' ).qtip( { content: { text: function( event, api ) { return ""; }, }, style: 'qtip-tipsy', position: { my: 'top center', // Position my top left... at: 'bottom center', // at the bottom right of... } } ); } ); }; })( jQuery );fields/link_color/field_link_color.css.map000066600000000273152141561110014734 0ustar00{ "version": 3, "mappings": "AACI,sCAAW;EACP,OAAO,EAAE,YAAY;EACrB,aAAa,EAAE,IAAI;EACnB,cAAc,EAAE,GAAG", "sources": ["field_link_color.scss"], "names": [], "file": "field_link_color.css" }fields/link_color/field_link_color.js000066600000007763152141561110014017 0ustar00/* Field Link Color */ /*global jQuery, document, redux_change, redux*/ (function( $ ) { 'use strict'; redux.field_objects = redux.field_objects || {}; redux.field_objects.link_color = redux.field_objects.link_color || {}; $( document ).ready( function() { } ); redux.field_objects.link_color.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-link_color:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.redux-color-init' ).wpColorPicker( { change: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ) ); el.find( '#' + e.target.getAttribute( 'data-id' ) + '-transparency' ).removeAttr( 'checked' ); }, clear: function( e, ui ) { $( this ).val( ui.color.toString() ); redux_change( $( this ).parent().find( '.redux-color-init' ) ); } } ); el.find( '.redux-color' ).on( 'keyup', function() { var value = $( this ).val(); var color = colorValidate( this ); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { el.find( id + '-transparency' ).removeAttr( 'checked' ); if ( color && color !== $( this ).val() ) { $( this ).val( color ); } } } ); // Replace and validate field on blur el.find( '.redux-color' ).on( 'blur', function() { var value = $( this ).val(); var id = '#' + $( this ).attr( 'id' ); if ( value === "transparent" ) { $( this ).parent().parent().find( '.wp-color-result' ).css( 'background-color', 'transparent' ); el.find( id + '-transparency' ).attr( 'checked', 'checked' ); } else { if ( colorValidate( this ) === value ) { if ( value.indexOf( "#" ) !== 0 ) { $( this ).val( $( this ).data( 'oldcolor' ) ); } } el.find( id + '-transparency' ).removeAttr( 'checked' ); } } ); // Store the old valid color on keydown el.find( '.redux-color' ).on( 'keydown', function() { $( this ).data( 'oldkeypress', $( this ).val() ); } ); } ); }; })( jQuery ); fields/link_color/field_link_color.min.js000066600000003162152141561110014566 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.link_color=redux.field_objects.link_color||{},a(document).ready(function(){}),redux.field_objects.link_color.init=function(b){b||(b=a(document).find(".redux-container-link_color:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".redux-color-init").wpColorPicker({change:function(c,d){a(this).val(d.color.toString()),redux_change(a(this)),b.find("#"+c.target.getAttribute("data-id")+"-transparency").removeAttr("checked")},clear:function(b,c){a(this).val(c.color.toString()),redux_change(a(this).parent().find(".redux-color-init"))}}),b.find(".redux-color").on("keyup",function(){var c=a(this).val(),d=colorValidate(this),e="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(e+"-transparency").attr("checked","checked")):(b.find(e+"-transparency").removeAttr("checked"),d&&d!==a(this).val()&&a(this).val(d))}),b.find(".redux-color").on("blur",function(){var c=a(this).val(),d="#"+a(this).attr("id");"transparent"===c?(a(this).parent().parent().find(".wp-color-result").css("background-color","transparent"),b.find(d+"-transparency").attr("checked","checked")):(colorValidate(this)===c&&0!==c.indexOf("#")&&a(this).val(a(this).data("oldcolor")),b.find(d+"-transparency").removeAttr("checked"))}),b.find(".redux-color").on("keydown",function(){a(this).data("oldkeypress",a(this).val())}))})}}(jQuery);fields/link_color/field_link_color.scss000066600000000221152141561110014334 0ustar00.redux-container-link_color { .linkColor { display: inline-block; padding-right: 10px; padding-bottom: 7px; } } fields/link_color/field_link_color.css000066600000000142152141561110014153 0ustar00.redux-container-link_color .linkColor{display:inline-block;padding-right:10px;padding-bottom:7px}fields/link_color/field_link_color.php000066600000024207152141561110014162 0ustar00. * * @package ReduxFramework * @subpackage Field_Color_Gradient * @author Luciano "WebCaos" Ubertini * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Kevin Provance (kprovance) - fixing everyone else's bugs. * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_link_color' ) ) { /** * Main ReduxFramework_link_color class * * @since 1.0.0 */ class ReduxFramework_link_color { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; $defaults = array( 'regular' => true, 'hover' => true, 'visited' => false, 'active' => true ); $this->field = wp_parse_args( $this->field, $defaults ); $defaults = array( 'regular' => '', 'hover' => '', 'visited' => '', 'active' => '' ); $this->value = wp_parse_args( $this->value, $defaults ); // In case user passes no default values. if ( isset( $this->field['default'] ) ) { $this->field['default'] = wp_parse_args( $this->field['default'], $defaults ); } else { $this->field['default'] = $defaults; } } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { if ( $this->field['regular'] === true && $this->field['default']['regular'] !== false ) { echo '' . __( 'Regular', 'redux-framework' ) . ' '; } if ( $this->field['hover'] === true && $this->field['default']['hover'] !== false ) { echo '' . __( 'Hover', 'redux-framework' ) . ' '; } if ( $this->field['visited'] === true && $this->field['default']['visited'] !== false ) { echo '' . __( 'Visited', 'redux-framework' ) . ' '; } if ( $this->field['active'] === true && $this->field['default']['active'] !== false ) { echo '' . __( 'Active', 'redux-framework' ) . ' '; } } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'redux-field-link-color-js', ReduxFramework::$_url . 'inc/fields/link_color/field_link_color' . Redux_Functions::isMin() . '.js', array( 'jquery', 'wp-color-picker', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-color-picker-css' ); wp_enqueue_style( 'redux-field-link_color-js', ReduxFramework::$_url . 'inc/fields/link_color/field_link_color.css', array(), time(), 'all' ); } } public function output() { $style = array(); if ( ! empty( $this->value['regular'] ) && $this->field['regular'] === true && $this->field['default']['regular'] !== false ) { $style[] = 'color:' . $this->value['regular'] . ';'; } if ( ! empty( $this->value['visited'] ) && $this->field['visited'] === true && $this->field['default']['visited'] !== false ) { $style['visited'] = 'color:' . $this->value['visited'] . ';'; } if ( ! empty( $this->value['hover'] ) && $this->field['hover'] === true && $this->field['default']['hover'] !== false ) { $style['hover'] = 'color:' . $this->value['hover'] . ';'; } if ( ! empty( $this->value['active'] ) && $this->field['active'] === true && $this->field['default']['active'] !== false ) { $style['active'] = 'color:' . $this->value['active'] . ';'; } if ( ! empty( $style ) ) { if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { $styleString = ""; foreach ( $style as $key => $value ) { if ( is_numeric( $key ) ) { $styleString .= implode( ",", $this->field['output'] ) . "{" . $value . '}'; } else { if ( count( $this->field['output'] ) == 1 ) { foreach($this->field['output'] as $sel => $elem) { continue; } if (strpos($elem, ',') != false) { $selector_arr = explode(',',$elem); $sel_list = ''; foreach($selector_arr as $idx => $selector) { $sel_list .= $selector . ":" . $key . ","; } $sel_list = rtrim($sel_list,','); $styleString .= $sel_list . "{" . $value . '}'; } else { $styleString .= $elem . ":" . $key . "{" . $value . '}'; } } else { $blah = ''; foreach($this->field['output'] as $k => $sel) { $blah .= $sel . ':' . $key . ','; } $blah = substr($blah, 0, strlen($blah) - 1); $styleString .= $blah . '{' . $value . '}'; } } } $this->parent->outputCSS .= $styleString; } if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { $styleString = ""; foreach ( $style as $key => $value ) { if ( is_numeric( $key ) ) { $styleString .= implode( ",", $this->field['compiler'] ) . "{" . $value . '}'; } else { if ( count( $this->field['compiler'] ) == 1 ) { $styleString .= $this->field['compiler'][0] . ":" . $key . "{" . $value . '}'; } else { $blah = ''; foreach($this->field['compiler'] as $k => $sel) { $blah .= $sel . ':' . $key . ','; } $blah = substr($blah, 0, strlen($blah) - 1); $styleString .= $blah . '{' . $value . '}'; } } } $this->parent->compilerCSS .= $styleString; } } } } }fields/media/field_media.less000066600000002376152141561110012214 0ustar00.redux-main { .button.remove-image, .removeCSS { margin-left: 10px; color: #ef521d; } .button.remove-image:hover, .removeCSS:hover { color: red; } .upload_button_div { margin-bottom: 5px; } .upload-error { float: left; color: #666; font-size: 10px; font-weight: bold; text-decoration: none; text-shadow: 1px 1px 0 #FFFFFF; margin: 0 10px 0 0; padding: 3px 10px; background: #FFDFEC; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .reset-button { font-family: Arial, Verdana, sans-serif; float: left; margin: 0; color: #ef521d; border-color: #bbb; } .redux-option-image { max-height: 340px; max-width: 340px; padding: 5px; margin-bottom: 0; margin-top: 10px; margin-right: 15px; border: 1px solid #e3e3e3; background: #f7f7f7; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .redux-main .upload { width: 80% !important; } .button { margin-top: 2px; } } fields/media/field_media.css.map000066600000001653152141561110012607 0ustar00{ "version": 3, "mappings": "AACI;sBACW;EACP,WAAW,EAAE,IAAI;EACjB,KAAK,EAAE,OAAO;EAEd;8BAAQ;IACJ,KAAK,EAAE,GAAG;AAIlB,8BAAmB;EACf,aAAa,EAAE,GAAG;AAGtB,yBAAc;EACV,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,IAAI;EACX,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,IAAI;EACjB,eAAe,EAAE,IAAI;EACrB,WAAW,EAAE,iBAAiB;EAC9B,MAAM,EAAE,UAAU;EAClB,OAAO,EAAE,QAAQ;EACjB,UAAU,EAAE,OAAO;EACnB,qBAAqB,EAAE,GAAG;EAC1B,kBAAkB,EAAE,GAAG;EACvB,aAAa,EAAE,GAAG;AAGtB,yBAAc;EACV,WAAW,EAAE,0BAA0B;EACvC,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,CAAC;EACT,KAAK,EAAE,OAAO;EACd,YAAY,EAAE,IAAI;AAGtB,+BAAoB;EAChB,UAAU,EAAE,KAAK;EACjB,SAAS,EAAE,KAAK;EAChB,OAAO,EAAE,GAAG;EACZ,aAAa,EAAE,CAAC;EAChB,UAAU,EAAE,IAAI;EAChB,YAAY,EAAE,IAAI;EAClB,MAAM,EAAE,iBAAiB;EACzB,UAAU,EAAE,OAAO;EACnB,kBAAkB,EAAE,GAAG;EACvB,oBAAoB,EAAE,GAAG;EACzB,qBAAqB,EAAE,GAAG;EAC1B,aAAa,EAAE,GAAG;AAGtB,+BAAoB;EAChB,KAAK,EAAE,cAAc;AAGzB,mBAAQ;EACJ,UAAU,EAAE,GAAG", "sources": ["field_media.scss"], "names": [], "file": "field_media.css" }fields/media/field_media.php000066600000023523152141561110012032 0ustar00. * * @package ReduxFramework * @subpackage Field_Media * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Kevin Provance (kprovance) * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_media' ) ) { /** * Main ReduxFramework_media class * * @since 1.0.0 */ class ReduxFramework_media { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { // No errors please $defaults = array( 'id' => '', 'url' => '', 'width' => '', 'height' => '', 'thumbnail' => '', ); $this->value = wp_parse_args( $this->value, $defaults ); if (isset($this->field['mode']) && $this->field['mode'] == false) { $this->field['mode'] = 0; } if ( ! isset( $this->field['mode'] ) ) { $this->field['mode'] = "image"; } if (!isset($this->field['library_filter'])) { $libFilter = ''; } else { if (!is_array($this->field['library_filter'])) { $this->field['library_filter'] = array($this->field['library_filter']); } $mimeTypes = get_allowed_mime_types(); $libArray = $this->field['library_filter']; $jsonArr = array(); // Enum mime types foreach ($mimeTypes as $ext => $type) { if (strpos($ext,'|')) { $expArr = explode('|', $ext); foreach($expArr as $ext){ if (in_array($ext, $libArray )) { $jsonArr[$ext] = $type; } } } elseif (in_array($ext, $libArray )) { $jsonArr[$ext] = $type; } } $libFilter = urlencode(json_encode($jsonArr)); } if ( empty( $this->value ) && ! empty( $this->field['default'] ) ) { // If there are standard values and value is empty if ( is_array( $this->field['default'] ) ) { if ( ! empty( $this->field['default']['id'] ) ) { $this->value['id'] = $this->field['default']['id']; } if ( ! empty( $this->field['default']['url'] ) ) { $this->value['url'] = $this->field['default']['url']; } } else { if ( is_numeric( $this->field['default'] ) ) { // Check if it's an attachment ID $this->value['id'] = $this->field['default']; } else { // Must be a URL $this->value['url'] = $this->field['default']; } } } if ( empty( $this->value['url'] ) && ! empty( $this->value['id'] ) ) { $img = wp_get_attachment_image_src( $this->value['id'], 'full' ); $this->value['url'] = $img[0]; $this->value['width'] = $img[1]; $this->value['height'] = $img[2]; } $hide = 'hide '; if ( ( isset( $this->field['preview'] ) && $this->field['preview'] === false ) ) { $this->field['class'] .= " noPreview"; } if ( ( ! empty( $this->field['url'] ) && $this->field['url'] === true ) || isset( $this->field['preview'] ) && $this->field['preview'] === false ) { $hide = ''; } $placeholder = isset( $this->field['placeholder'] ) ? $this->field['placeholder'] : __( 'No media selected', 'redux-framework' ); $readOnly = ' readonly="readonly"'; if ( isset( $this->field['readonly'] ) && $this->field['readonly'] === false ) { $readOnly = ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; //Preview $hide = ''; if ( ( isset( $this->field['preview'] ) && $this->field['preview'] === false ) || empty( $this->value['url'] ) ) { $hide = 'hide '; } if ( empty( $this->value['thumbnail'] ) && ! empty( $this->value['url'] ) ) { // Just in case if ( ! empty( $this->value['id'] ) ) { $image = wp_get_attachment_image_src( $this->value['id'], array( 150, 150 ) ); if (empty($image[0]) || $image[0] == '') { $this->value['thumbnail'] = $this->value['url']; } else { $this->value['thumbnail'] = $image[0]; } } else { $this->value['thumbnail'] = $this->value['url']; } } echo '
    '; echo ''; echo ''; echo ''; echo '
    '; //Upload controls DIV echo '
    '; //If the user has WP3.5+ show upload/remove button echo '' . __( 'Upload', 'redux-framework' ) . ''; $hide = ''; if ( empty( $this->value['url'] ) || $this->value['url'] == '' ) { $hide = ' hide'; } echo '' . __( 'Remove', 'redux-framework' ) . ''; echo '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ( function_exists( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } else { wp_enqueue_script( 'media-upload' ); } wp_enqueue_script( 'redux-field-media-js', ReduxFramework::$_url . 'assets/js/media/media' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style('redux-field-media-css'); } } } }fields/media/field_media.css000066600000001641152141561110012030 0ustar00.redux-main .button.remove-image,.redux-main .removeCSS{margin-left:10px;color:#ef521d}.redux-main .button.remove-image:hover,.redux-main .removeCSS:hover{color:red}.redux-main .upload_button_div{margin-bottom:5px}.redux-main .upload-error{float:left;color:#666;font-size:10px;font-weight:bold;text-decoration:none;text-shadow:1px 1px 0 #fff;margin:0 10px 0 0;padding:3px 10px;background:#ffdfec;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.redux-main .reset-button{font-family:Arial,Verdana,sans-serif;float:left;margin:0;color:#ef521d;border-color:#bbb}.redux-main .redux-option-image{max-height:340px;max-width:340px;padding:5px;margin-bottom:0;margin-top:10px;margin-right:15px;border:1px solid #e3e3e3;background:#f7f7f7;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.redux-main .redux-main .upload{width:80% !important}.redux-main .button{margin-top:2px}fields/media/field_media.scss000066600000002361152141561110012213 0ustar00.redux-main { .button.remove-image, .removeCSS { margin-left: 10px; color: #ef521d; &:hover { color: red; } } .upload_button_div { margin-bottom: 5px; } .upload-error { float: left; color: #666; font-size: 10px; font-weight: bold; text-decoration: none; text-shadow: 1px 1px 0 #FFFFFF; margin: 0 10px 0 0; padding: 3px 10px; background: #FFDFEC; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .reset-button { font-family: Arial, Verdana, sans-serif; float: left; margin: 0; color: #ef521d; border-color: #bbb; } .redux-option-image { max-height: 340px; max-width: 340px; padding: 5px; margin-bottom: 0; margin-top: 10px; margin-right: 15px; border: 1px solid #e3e3e3; background: #f7f7f7; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .redux-main .upload { width: 80% !important; } .button { margin-top: 2px; } } fields/sortable/field_sortable.js000066600000006316152141561110013150 0ustar00/*global jQuery, document, redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.sortable = redux.field_objects.sortable || {}; var scroll = ''; redux.field_objects.sortable.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-sortable:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( ".redux-sortable" ).sortable( { handle: ".drag", placeholder: "placeholder", opacity: 0.7, scroll: false, out: function( event, ui ) { if ( !ui.helper ) return; if ( ui.offset.top > 0 ) { scroll = 'down'; } else { scroll = 'up'; } redux.field_objects.sortable.scrolling( $( this ).parents( '.redux-field-container:first' ) ); }, over: function( event, ui ) { scroll = ''; }, deactivate: function( event, ui ) { scroll = ''; }, update: function(event, ui) { // console.log('here'); redux_change( $( this ) ); } } ); el.find( '.checkbox_sortable' ).on( 'click', function() { if ( $( this ).is( ":checked" ) ) { el.find( '#' + $( this ).attr( 'rel' ) ).val( 1 ); } else { el.find( '#' + $( this ).attr( 'rel' ) ).val( '' ); } } ); } ); }; redux.field_objects.sortable.scrolling = function( selector ) { if (selector === undefined) { return; } var $scrollable = selector.find( ".redux-sorter" ); if ( scroll == 'up' ) { $scrollable.scrollTop( $scrollable.scrollTop() - 20 ); setTimeout( redux.field_objects.sortable.scrolling, 50 ); } else if ( scroll == 'down' ) { $scrollable.scrollTop( $scrollable.scrollTop() + 20 ); setTimeout( redux.field_objects.sortable.scrolling, 50 ); } }; })( jQuery );fields/sortable/field_sortable.min.js000066600000002524152141561110013727 0ustar00(function(b){redux.field_objects=redux.field_objects||{};redux.field_objects.sortable=redux.field_objects.sortable||{};var a="";redux.field_objects.sortable.init=function(c){if(!c){c=b(document).find(".redux-group-tab:visible").find(".redux-container-sortable:visible")}b(c).each(function(){var e=b(this);var d=e;if(!e.hasClass("redux-field-container")){d=e.parents(".redux-field-container:first")}if(d.is(":hidden")){return}if(d.hasClass("redux-field-init")){d.removeClass("redux-field-init")}else{return}e.find(".redux-sortable").sortable({handle:".drag",placeholder:"placeholder",opacity:0.7,scroll:false,out:function(f,g){if(!g.helper){return}if(g.offset.top>0){a="down"}else{a="up"}redux.field_objects.sortable.scrolling(b(this).parents(".redux-field-container:first"))},over:function(f,g){a=""},deactivate:function(f,g){a=""},update:function(f,g){redux_change(b(this))}});e.find(".checkbox_sortable").on("click",function(){if(b(this).is(":checked")){e.find("#"+b(this).attr("rel")).val(1)}else{e.find("#"+b(this).attr("rel")).val("")}})})};redux.field_objects.sortable.scrolling=function(c){if(c===undefined){return}var d=c.find(".redux-sorter");if(a=="up"){d.scrollTop(d.scrollTop()-20);setTimeout(redux.field_objects.sortable.scrolling,50)}else{if(a=="down"){d.scrollTop(d.scrollTop()+20);setTimeout(redux.field_objects.sortable.scrolling,50)}}}})(jQuery);fields/sortable/field_sortable.scss000066600000002313152141561110013500 0ustar00.redux-container-sortable { i { &.el { cursor: move; } } label { margin-right: 10px; width: 300px; &.bugger { margin-bottom: 0px !important; font-size: 12px !important; color: #999999; } } input { margin-right: 10px; } .checkbox-container { width: 364px; .drag { float: right; margin-left: 10px; } } ul { &.labeled { li { line-height: 1.4em !important; } } } li { line-height: 30px !important; &.ui-state-highlight { height: 30px; width: 364px; margin-bottom: 13px; } &.placeholder { height: 30px; margin: 10px 0; } } } .wp-customizer { .redux-sortable { input[type="text"] { width: 92%; } i.el { margin-left: 5px; } } .redux-container-sortable { .checkbox-container { width: inherit; } .ui-draggable-handle { margin-left: 3%; } } } fields/sortable/field_sortable.css000066600000001661152141561110013322 0ustar00.redux-container-sortable i.el{cursor:move}.redux-container-sortable label{margin-right:10px;width:300px}.redux-container-sortable label.bugger{margin-bottom:0 !important;font-size:12px !important;color:#999}.redux-container-sortable input{margin-right:10px}.redux-container-sortable .checkbox-container{width:364px}.redux-container-sortable .checkbox-container .drag{float:right;margin-left:10px}.redux-container-sortable ul.labeled li{line-height:1.4em !important}.redux-container-sortable li{line-height:30px !important}.redux-container-sortable li.ui-state-highlight{height:30px;width:364px;margin-bottom:13px}.redux-container-sortable li.placeholder{height:30px;margin:10px 0}.wp-customizer .redux-sortable input[type="text"]{width:92%}.wp-customizer .redux-sortable i.el{margin-left:5px}.wp-customizer .redux-container-sortable .checkbox-container{width:inherit}.wp-customizer .redux-container-sortable .ui-draggable-handle{margin-left:3%}fields/sortable/field_sortable.php000066600000014713152141561110013323 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since Redux_Options 2.0.1 */ function render() { if ( empty( $this->field['mode'] ) ) { $this->field['mode'] = "text"; } if ( $this->field['mode'] != "checkbox" && $this->field['mode'] != "text" ) { $this->field['mode'] = "text"; } $class = ( isset( $this->field['class'] ) ) ? $this->field['class'] : ''; $options = $this->field['options']; // This is to weed out missing options that might be in the default // Why? Who knows. Call it a dummy check. if ( ! empty( $this->value ) ) { foreach ( $this->value as $k => $v ) { if ( ! isset( $options[ $k ] ) ) { unset( $this->value[ $k ] ); } } } $noSort = false; foreach ( $options as $k => $v ) { if ( ! isset( $this->value[ $k ] ) ) { // A save has previously been done. if ( is_array( $this->value ) && array_key_exists( $k, $this->value ) ) { $this->value[ $k ] = $v; // Missing database entry, meaning no save has yet been done. } else { $noSort = true; $this->value[ $k ] = ''; } } } // If missing database entries are found, it means no save has been done // and therefore no sort should be done. Set the default array in the same // order as the options array. Why? The sort order is based on the // saved default array. If entries are missing, the sort is messed up. // - kp if ( true == $noSort ) { $dummyArr = array(); foreach ( $options as $k => $v ) { $dummyArr[ $k ] = $this->value[ $k ]; } unset( $this->value ); $this->value = $dummyArr; unset( $dummyArr ); } $use_labels = false; $label_class = ''; if ( $this->field['mode'] != "checkbox" ) { if ( ( isset( $this->field['label'] ) && $this->field['label'] == true ) ) { $use_labels = true; $label_class = ' labeled'; } } echo '
      '; foreach ( $this->value as $k => $nicename ) { echo '
    • '; $checked = ""; $name = 'name="' . $this->field['name'] . $this->field['name_suffix'] . '[' . $k . ']' . '" '; if ( $this->field['mode'] == "checkbox" ) { $value_display = $this->value[ $k ]; if ( ! empty( $this->value[ $k ] ) ) { $checked = 'checked="checked" '; } $class .= " checkbox_sortable"; $name = ""; echo ''; echo '
      '; } else { $value_display = isset( $this->value[ $k ] ) ? $this->value[ $k ] : ''; $nicename = $this->field['options'][$k]; } if ($this->field['mode'] != "checkbox") { if ($use_labels) { echo ''; echo "
      "; } } echo ''; echo ''; //if ( ( isset( $this->field['label'] ) && $this->field['label'] == true ) ) { if ($this->field['mode'] == "checkbox") { if ( $this->field['mode'] != "checkbox" ) { //echo "
      "; //echo ''; } else { echo ''; } } if ( $this->field['mode'] == "checkbox" ) { echo '
      '; } echo '
    • '; } echo '
    '; } function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-sortable-css', ReduxFramework::$_url . 'inc/fields/sortable/field_sortable.css', array(), time(), 'all' ); } wp_enqueue_script( 'redux-field-sortable-js', ReduxFramework::$_url . 'inc/fields/sortable/field_sortable' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js', 'jquery-ui-sortable' ), time(), true ); } } } fields/sortable/field_sortable.css.map000066600000001305152141561110014071 0ustar00{ "version": 3, "mappings": "AAEQ,8BAAK;EACD,MAAM,EAAE,IAAI;AAIpB,+BAAM;EACF,YAAY,EAAE,IAAI;EAClB,KAAK,EAAE,KAAK;EAEZ,sCAAS;IACL,aAAa,EAAE,cAAc;IAC7B,SAAS,EAAE,eAAe;IAC1B,KAAK,EAAE,OAAO;AAItB,+BAAM;EACF,YAAY,EAAE,IAAI;AAGtB,6CAAoB;EAChB,KAAK,EAAE,KAAK;EAEZ,mDAAM;IACF,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,IAAI;AAMjB,uCAAG;EACC,WAAW,EAAE,gBAAgB;AAKzC,4BAAG;EACC,WAAW,EAAE,eAAe;EAE5B,+CAAqB;IACjB,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,IAAI;EAGvB,wCAAc;IACV,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,MAAM;;AAOlB,iDAAmB;EACf,KAAK,EAAE,GAAG;AAEd,mCAAK;EACD,WAAW,EAAE,GAAG;AAIpB,4DAAoB;EAChB,KAAK,EAAE,OAAO;AAElB,6DAAqB;EACjB,WAAW,EAAE,EAAE", "sources": ["field_sortable.scss"], "names": [], "file": "field_sortable.css" }fields/date/field_date.css000066600000000130152141561110011514 0ustar00#ui-datepicker-div{z-index:15 !important}.ui-datepicker-header{background-color:#00abef}fields/date/field_date.php000066600000006357152141561110011534 0ustar00. * * @package ReduxFramework * @subpackage Field_Date * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Kevin Provance (kprovance) * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_date' ) ) { /** * Main ReduxFramework_date class * * @since 1.0.0 */ class ReduxFramework_date { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $placeholder = ( isset( $this->field['placeholder'] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'] ) . '" ' : ''; echo ''; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-date-css', ReduxFramework::$_url . 'inc/fields/date/field_date.css', array(), time(), 'all' ); } wp_enqueue_script( 'redux-field-date-js', ReduxFramework::$_url . 'inc/fields/date/field_date' . Redux_Functions::isMin() . '.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'redux-js' ), time(), true ); } } }fields/date/field_date.scss000066600000000156152141561110011707 0ustar00#ui-datepicker-div { z-index: 15 !important; } .ui-datepicker-header { background-color: #00abef; } fields/date/field_date.min.js000066600000001430152141561110012126 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.date=redux.field_objects.date||{},a(document).ready(function(){}),redux.field_objects.date.init=function(b){b||(b=a(document).find(".redux-container-date:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".redux-datepicker").each(function(){a(this).datepicker({dateFormat:"mm/dd/yy",beforeShow:function(b,c){var d=a("#ui-datepicker-div"),e=c.dpDiv;a(".redux-container:first").append(d),a("#ui-datepicker-div").hide(),setTimeout(function(){e.position({my:"left top",at:"left bottom",collision:"none",of:b})},1)}})}))})}}(jQuery);fields/date/field_date.css.map000066600000000253152141561110012276 0ustar00{ "version": 3, "mappings": "AAAA,kBAAmB;EACf,OAAO,EAAE,aAAa;;AAG1B,qBAAsB;EAClB,gBAAgB,EAAE,OAAO", "sources": ["field_date.scss"], "names": [], "file": "field_date.css" }fields/date/field_date.js000066600000006044152141561110011352 0ustar00/*global jQuery, document, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.date = redux.field_objects.date || {}; $( document ).ready( function() { //redux.field_objects.date.init(); } ); redux.field_objects.date.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-date:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } // var someArr = [] // someArr = i; // console.log(someArr); // var str = JSON.parse('{"redux_demo[opt-multi-check]":{"redux_demo[opt-multi-check][1]":"1","redux_demo[opt-multi-check][2]":"","redux_demo[opt-multi-check][3]":""}}'); // console.log (str); // // $.each(str, function(idx, val){ // var tmpArr = new Object(); // var count = 1; // // $.each(val, function (i, v){ // // tmpArr[count] = v; // count++; // }); // // var newArr = {}; // newArr[idx] = tmpArr; // var newJSON = JSON.stringify(newArr) // //console.log(newJSON); // }); el.find( '.redux-datepicker' ).each( function() { $( this ).datepicker({ "dateFormat":"mm/dd/yy", beforeShow: function(input, instance){ var el = $('#ui-datepicker-div'); //$.datepicker._pos = $.datepicker._findPos(input); //this is the default position var popover = instance.dpDiv; $('.redux-container:first').append(el); $('#ui-datepicker-div').hide(); setTimeout(function() { popover.position({ my: 'left top', at: 'left bottom', collision: 'none', of: input }); }, 1); } }); }); } ); }; })( jQuery );fields/multi_text/field_multi_text.scss000066600000001755152141561110014457 0ustar00.redux-container-multi_text { ul.redux-multi-text { margin: 0; padding: 0; } .redux-multi-text-add { clear: both; margin: 5px 0; } a.redux-multi-text-remove { &.deletion { color: #F00; padding: 2px 4px; margin-left: 5px; &:hover { background: red; color: #fff; text-decoration: none; } } } } @media screen and (max-width: 782px) { .redux-container-multi_text { input { clear: both; } .redux-multi-text-remove { margin: 0; float: right; } } } .wp-customizer { .redux-container-multi_text { .button { float: right; } .redux-multi-text-remove { float: right; margin-bottom: 5px; } ul.redux-multi-text input { width: 100% !important; } } } fields/multi_text/field_multi_text.min.js000066600000002721152141561110014674 0ustar00(function(a){redux.field_objects=redux.field_objects||{};redux.field_objects.multi_text=redux.field_objects.multi_text||{};redux.field_objects.multi_text.init=function(b){if(!b){b=a(document).find(".redux-container-multi_text:visible")}a(b).each(function(){var d=a(this);var c=d;if(!d.hasClass("redux-field-container")){c=d.parents(".redux-field-container:first")}if(c.is(":hidden")){return}if(c.hasClass("redux-field-init")){c.removeClass("redux-field-init")}else{return}d.find(".redux-multi-text-remove").live("click",function(){redux_change(a(this));a(this).prev('input[type="text"]').val("");var e=a(this).attr("data-id");a(this).parent().slideUp("medium",function(){a(this).remove();var g=d.find("#"+e+" li").length;if(g==1){var h=d.find(".redux-multi-text-add");var f=h.attr("data-name");d.find("#"+e+' li:last-child input[type="text"]').attr("name",f)}})});d.find(".redux-multi-text-add").click(function(){var k=parseInt(a(this).attr("data-add_number"));var m=a(this).attr("data-id");var g=a(this).attr("data-name")+"[]";for(var j=0;j1){var h,e;d.find("#"+m+" li").each(function(i,n){h=a(this).css("display");if(h==="none"){e=a(this).find('input[type="text"]');e.attr("name","")}})}})})}})(jQuery);fields/multi_text/field_multi_text.css.map000066600000001107152141561110015037 0ustar00{ "version": 3, "mappings": "AACI,+CAAoB;EAChB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;AAGd,iDAAsB;EAClB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,KAAK;AAIb,8DAAW;EACP,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,OAAO;EAChB,WAAW,EAAE,GAAG;EAEhB,oEAAQ;IACJ,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,IAAI;IACX,eAAe,EAAE,IAAI;;AAMrC,oCAAqC;EAE7B,iCAAM;IACF,KAAK,EAAE,IAAI;EAGf,oDAAyB;IACrB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,KAAK;AAOhB,kDAAQ;EACJ,KAAK,EAAE,KAAK;AAEhB,mEAAyB;EACrB,KAAK,EAAE,KAAK;EACZ,aAAa,EAAE,GAAG;AAEtB,oEAA0B;EACtB,KAAK,EAAE,eAAe", "sources": ["field_multi_text.scss"], "names": [], "file": "field_multi_text.css" }fields/multi_text/field_multi_text.js000066600000007062152141561110014115 0ustar00/*global redux_change, redux*/ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.multi_text = redux.field_objects.multi_text || {}; redux.field_objects.multi_text.init = function( selector ) { if ( !selector ) { selector = $( document ).find( '.redux-container-multi_text:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( '.redux-multi-text-remove' ).live( 'click', function() { redux_change( $( this ) ); $( this ).prev( 'input[type="text"]' ).val( '' ); var id = $( this ).attr( 'data-id' ); $( this ).parent().slideUp( 'medium', function() { $( this ).remove(); var lis = el.find( '#' + id + ' li').length; if (lis == 1) { var add = el.find( '.redux-multi-text-add' ); var name = add.attr( 'data-name' ); el.find( '#' + id + ' li:last-child input[type="text"]' ).attr( 'name', name ); } } ); } ); el.find( '.redux-multi-text-add' ).click( function() { var number = parseInt( $( this ).attr( 'data-add_number' ) ); var id = $( this ).attr( 'data-id' ); var name = $( this ).attr( 'data-name' ) + '[]'; for ( var i = 0; i < number; i++ ) { var new_input = $( '#' + id + ' li:last-child' ).clone(); el.find( '#' + id ).append( new_input ); el.find( '#' + id + ' li:last-child' ).removeAttr( 'style' ); el.find( '#' + id + ' li:last-child input[type="text"]' ).val( '' ); el.find( '#' + id + ' li:last-child input[type="text"]' ).attr( 'name', name ); } var lis = el.find( '#' + id + ' li').length; if (lis > 1) { var css, input; el.find('#' + id + ' li').each(function(idx, val){ css = $(this).css('display'); if (css === 'none') { input = $(this).find('input[type="text"]'); input.attr('name', ''); } }) } } ); } ); }; })( jQuery ); fields/multi_text/field_multi_text.php000066600000013120152141561110014260 0ustar00. * * @package ReduxFramework * @subpackage Field_Multi_Text * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @author Kevin Provance (kprovance) * @version 3.0.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } // Don't duplicate me! if ( ! class_exists( 'ReduxFramework_multi_text' ) ) { /** * Main ReduxFramework_multi_text class * * @since 1.0.0 */ class ReduxFramework_multi_text { /** * Field Constructor. * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @return void */ function __construct( $field = array(), $value = '', $parent ) { $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { $this->add_text = ( isset( $this->field['add_text'] ) ) ? $this->field['add_text'] : __( 'Add More', 'redux-framework' ); $this->show_empty = ( isset( $this->field['show_empty'] ) ) ? $this->field['show_empty'] : true; echo '
      '; if ( isset( $this->value ) && is_array( $this->value ) ) { foreach ( $this->value as $k => $value ) { if ( $value != '' || ($value == '' && $this->show_empty == true) ) { echo '
    • '; echo ' '; echo '' . __( 'Remove', 'redux-framework' ) . ''; echo '
    • '; } } } elseif ( $this->show_empty == true ) { echo '
    • '; echo ' '; echo '' . __( 'Remove', 'redux-framework' ) . ''; echo '
    • '; } $the_name = ''; if (isset($this->value) && empty($this->value) && $this->show_empty == false) { $the_name = $this->field['name'] . $this->field['name_suffix']; } echo '
    • '; echo '' . __( 'Remove', 'redux-framework' ) . ''; echo '
    • '; echo '
    '; echo ''; $this->field['add_number'] = ( isset( $this->field['add_number'] ) && is_numeric( $this->field['add_number'] ) ) ? $this->field['add_number'] : 1; echo '' . $this->add_text . '
    '; } /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_script( 'redux-field-multi-text-js', ReduxFramework::$_url . 'inc/fields/multi_text/field_multi_text' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-multi-text-css', ReduxFramework::$_url . 'inc/fields/multi_text/field_multi_text.css', array(), time(), 'all' ); } } } }fields/multi_text/field_multi_text.css000066600000001403152141561110014262 0ustar00.redux-container-multi_text ul.redux-multi-text{margin:0;padding:0}.redux-container-multi_text .redux-multi-text-add{clear:both;margin:5px 0}.redux-container-multi_text a.redux-multi-text-remove.deletion{color:#F00;padding:2px 4px;margin-left:5px}.redux-container-multi_text a.redux-multi-text-remove.deletion:hover{background:red;color:#fff;text-decoration:none}@media screen and (max-width:782px){.redux-container-multi_text input{clear:both}.redux-container-multi_text .redux-multi-text-remove{margin:0;float:right}}.wp-customizer .redux-container-multi_text .button{float:right}.wp-customizer .redux-container-multi_text .redux-multi-text-remove{float:right;margin-bottom:5px}.wp-customizer .redux-container-multi_text ul.redux-multi-text input{width:100% !important}fields/switch/field_switch.scss000066600000002650152141561110012660 0ustar00.redux-container-switch { .switch-options { min-height: 30px; margin-right: 10px; label { cursor: pointer; } input { display: none; } } .cb-enable, .cb-disable { padding: 0 10px; border-width: 1px; border-style: solid; -webkit-appearance: none; white-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; span { line-height: 30px; display: block; font-weight: 700; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; -ms-user-select: none; user-select: none; } } .cb-enable, .cb-disable, .cb-enable span, .cb-disable span { display: block; float: left; } .cb-enable { border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; &.selected { color: #fff; } } .cb-disable { border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; &.selected { color: #fff; } } }fields/switch/field_switch.css.map000066600000001634152141561110013252 0ustar00{ "version": 3, "mappings": "AACI,uCAAgB;EACZ,UAAU,EAAE,IAAI;EAChB,YAAY,EAAE,IAAI;EAElB,6CAAM;IACF,MAAM,EAAE,OAAO;EAGnB,6CAAM;IACF,OAAO,EAAE,IAAI;AAIrB;mCACY;EACR,OAAO,EAAE,MAAM;EACf,YAAY,EAAE,GAAG;EACjB,YAAY,EAAE,KAAK;EACnB,kBAAkB,EAAE,IAAI;EACxB,WAAW,EAAE,MAAM;EACnB,kBAAkB,EAAE,UAAU;EAC9B,eAAe,EAAE,UAAU;EAC3B,UAAU,EAAE,UAAU;EAEtB;0CAAK;IACD,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,GAAG;IAChB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,IAAI;AAIzB;;;wCAGiB;EACb,OAAO,EAAE,KAAK;EACd,KAAK,EAAE,IAAI;AAGf,kCAAW;EACP,YAAY,EAAE,CAAC;EACf,aAAa,EAAE,eAAe;EAC9B,kBAAkB,EAAE,eAAe;EACnC,qBAAqB,EAAE,eAAe;EAEtC,2CAAW;IACP,KAAK,EAAE,IAAI;AAInB,mCAAY;EACR,WAAW,EAAE,CAAC;EACd,aAAa,EAAE,eAAe;EAC9B,kBAAkB,EAAE,eAAe;EACnC,qBAAqB,EAAE,eAAe;EAEtC,4CAAW;IACP,KAAK,EAAE,IAAI", "sources": ["field_switch.scss"], "names": [], "file": "field_switch.css" }fields/switch/field_switch.php000066600000005505152141561110012476 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 0.0.4 */ function render() { $cb_enabled = $cb_disabled = ''; //no errors, please // //Get selected if ( (int) $this->value == 1 ) { $cb_enabled = ' selected'; } else { $cb_disabled = ' selected'; } //Label ON $this->field['on'] = isset( $this->field['on'] ) ? $this->field['on'] : __( 'On', 'redux-framework' ); //Label OFF $this->field['off'] = isset( $this->field['off'] ) ? $this->field['off'] : __( 'Off', 'redux-framework' ); echo '
    '; echo ''; echo ''; echo ''; echo '
    '; } //function /** * Enqueue Function. * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since ReduxFramework 0.0.4 */ function enqueue() { wp_enqueue_script( 'redux-field-switch-js', ReduxFramework::$_url . 'inc/fields/switch/field_switch' . Redux_Functions::isMin() . '.js', array( 'jquery', 'redux-js' ), time(), true ); if ($this->parent->args['dev_mode']) { wp_enqueue_style( 'redux-field-switch-css', ReduxFramework::$_url . 'inc/fields/switch/field_switch.css', array(), time(), 'all' ); } } } }fields/switch/field_switch.min.js000066600000002413152141561110013100 0ustar00!function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects["switch"]=redux.field_objects["switch"]||{},a(document).ready(function(){}),redux.field_objects["switch"].init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-switch:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.find(".cb-enable").click(function(){if(!a(this).hasClass("selected")){var c=a(this).parents(".switch-options");a(".cb-disable",c).removeClass("selected"),a(this).addClass("selected"),a(".checkbox-input",c).val(1).trigger("change"),redux_change(a(".checkbox-input",c));var d=a(this),e=".f_"+d.data("id");b.find(e).slideDown("normal","swing")}}),b.find(".cb-disable").click(function(){if(!a(this).hasClass("selected")){var c=a(this).parents(".switch-options");a(".cb-enable",c).removeClass("selected"),a(this).addClass("selected"),a(".checkbox-input",c).val(0).trigger("change"),redux_change(a(".checkbox-input",c));var d=a(this),e=".f_"+d.data("id");b.find(e).slideUp("normal","swing")}}),b.find(".cb-enable span, .cb-disable span").find().attr("unselectable","on"))})}}(jQuery);fields/switch/switch.gif000066600000002321152141561110011302 0ustar00GIF89a\%ItVb\\\`i}dBm u(R{yKs| imoqvvvi[dddWyMrUUUQ]Rq'aaadXW^|||pppzzzjjjrrrnnntttlllxxxhhhyv{sgbk儶#Oggg$uρ"`s!Ȭu nΙÏؿÀXpz!2|nWx%zX \&eUa$#\fff!,L}|! OS<&A9;C̢@>:?B=DT%, QP4NH`Az(TXaC#!"8E2f\‘#YdI%(Q2X2˗0mȔy͛/rl?'C+HXBb& ZIDATxڤTKK[QUDRKWjtEJ*vp-T]-!’bļ0Mb&wz*nz`swfs9,,v)6Yz,]):1a>:JCCC$#C3d5x1l&&&0=|_6lRB, !5122BSSS)Tu]K1KnkQRqEq:s1O2xtpW:PZCiFcjZyxAv'̪H BrO)ECT3.fA<GOOOd'agyppkwwq7 ƻʟy +>:7;|"v70^Lboo$')'њ:w.///q/=Hy]ȀWVVޱMCltJIC:v?[Z3"iIENDB`fields/switch/field_switch.js000066600000006037152141561110012324 0ustar00/*global redux_change, redux*/ /** * Switch * Dependencies : jquery * Feature added by : Smartik - http://smartik.ws/ * Date : 03.17.2013 */ (function( $ ) { "use strict"; redux.field_objects = redux.field_objects || {}; redux.field_objects.switch = redux.field_objects.switch || {}; $( document ).ready( function() { //redux.field_objects.switch.init(); } ); redux.field_objects.switch.init = function( selector ) { if ( !selector ) { selector = $( document ).find( ".redux-group-tab:visible" ).find( '.redux-container-switch:visible' ); } $( selector ).each( function() { var el = $( this ); var parent = el; if ( !el.hasClass( 'redux-field-container' ) ) { parent = el.parents( '.redux-field-container:first' ); } if ( parent.is( ":hidden" ) ) { // Skip hidden fields return; } if ( parent.hasClass( 'redux-field-init' ) ) { parent.removeClass( 'redux-field-init' ); } else { return; } el.find( ".cb-enable" ).click( function() { if ( $( this ).hasClass( 'selected' ) ) { return; } var parent = $( this ).parents( '.switch-options' ); $( '.cb-disable', parent ).removeClass( 'selected' ); $( this ).addClass( 'selected' ); $( '.checkbox-input', parent ).val( 1 ).trigger('change'); redux_change( $( '.checkbox-input', parent ) ); //fold/unfold related options var obj = $( this ); var $fold = '.f_' + obj.data( 'id' ); el.find( $fold ).slideDown( 'normal', "swing" ); } ); el.find( ".cb-disable" ).click( function() { if ( $( this ).hasClass( 'selected' ) ) { return; } var parent = $( this ).parents( '.switch-options' ); $( '.cb-enable', parent ).removeClass( 'selected' ); $( this ).addClass( 'selected' ); $( '.checkbox-input', parent ).val( 0 ).trigger('change'); redux_change( $( '.checkbox-input', parent ) ); //fold/unfold related options var obj = $( this ); var $fold = '.f_' + obj.data( 'id' ); el.find( $fold ).slideUp( 'normal', "swing" ); } ); el.find( '.cb-enable span, .cb-disable span' ).find().attr( 'unselectable', 'on' ); } ); }; })( jQuery );fields/raw/field_raw.php000066600000004045152141561110011254 0ustar00parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * Takes the vars and outputs the HTML for the field in the settings * * @since ReduxFramework 1.0.0 */ function render() { if ( ! empty( $this->field['include'] ) && file_exists( $this->field['include'] ) ) { require_once $this->field['include']; } if ( isset( $this->field['content_path'] ) && ! empty( $this->field['content_path'] ) && file_exists( $this->field['content_path'] ) ) { $this->field['content'] = $this->parent->filesystem->execute( 'get_contents', $this->field['content_path'] ); } if ( ! empty( $this->field['content'] ) && isset( $this->field['content'] ) ) { if ( isset( $this->field['markdown'] ) && $this->field['markdown'] == true && ! empty( $this->field['content'] ) ) { require_once dirname( __FILE__ ) . "/parsedown.php"; $Parsedown = new Parsedown(); echo $Parsedown->text( $this->field['content'] ); } else { echo $this->field['content']; } } do_action( 'redux-field-raw-' . $this->parent->args['opt_name'] . '-' . $this->field['id'] ); } } }fields/raw/parsedown.php000066600000111560152141561110011323 0ustar00DefinitionData = array(); # standardize line breaks $text = str_replace(array("\r\n", "\r"), "\n", $text); # remove surrounding line breaks $text = trim($text, "\n"); # split text into lines $lines = explode("\n", $text); # iterate through lines to identify blocks $markup = $this->lines($lines); # trim line breaks $markup = trim($markup, "\n"); return $markup; } # # Setters # function setBreaksEnabled($breaksEnabled) { $this->breaksEnabled = $breaksEnabled; return $this; } protected $breaksEnabled; function setMarkupEscaped($markupEscaped) { $this->markupEscaped = $markupEscaped; return $this; } protected $markupEscaped; function setUrlsLinked($urlsLinked) { $this->urlsLinked = $urlsLinked; return $this; } protected $urlsLinked = true; # # Lines # protected $BlockTypes = array( '#' => array('Header'), '*' => array('Rule', 'List'), '+' => array('List'), '-' => array('SetextHeader', 'Table', 'Rule', 'List'), '0' => array('List'), '1' => array('List'), '2' => array('List'), '3' => array('List'), '4' => array('List'), '5' => array('List'), '6' => array('List'), '7' => array('List'), '8' => array('List'), '9' => array('List'), ':' => array('Table'), '<' => array('Comment', 'Markup'), '=' => array('SetextHeader'), '>' => array('Quote'), '[' => array('Reference'), '_' => array('Rule'), '`' => array('FencedCode'), '|' => array('Table'), '~' => array('FencedCode'), ); # ~ protected $unmarkedBlockTypes = array( 'Code', ); # # Blocks # protected function lines(array $lines) { $CurrentBlock = null; foreach ($lines as $line) { if (chop($line) === '') { if (isset($CurrentBlock)) { $CurrentBlock['interrupted'] = true; } continue; } if (strpos($line, "\t") !== false) { $parts = explode("\t", $line); $line = $parts[0]; unset($parts[0]); foreach ($parts as $part) { $shortage = 4 - mb_strlen($line, 'utf-8') % 4; $line .= str_repeat(' ', $shortage); $line .= $part; } } $indent = 0; while (isset($line[$indent]) and $line[$indent] === ' ') { $indent ++; } $text = $indent > 0 ? substr($line, $indent) : $line; # ~ $Line = array('body' => $line, 'indent' => $indent, 'text' => $text); # ~ if (isset($CurrentBlock['continuable'])) { $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock); if (isset($Block)) { $CurrentBlock = $Block; continue; } else { if ($this->isBlockCompletable($CurrentBlock['type'])) { $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); } } } # ~ $marker = $text[0]; # ~ $blockTypes = $this->unmarkedBlockTypes; if (isset($this->BlockTypes[$marker])) { foreach ($this->BlockTypes[$marker] as $blockType) { $blockTypes []= $blockType; } } # # ~ foreach ($blockTypes as $blockType) { $Block = $this->{'block'.$blockType}($Line, $CurrentBlock); if (isset($Block)) { $Block['type'] = $blockType; if ( ! isset($Block['identified'])) { $Blocks []= $CurrentBlock; $Block['identified'] = true; } if ($this->isBlockContinuable($blockType)) { $Block['continuable'] = true; } $CurrentBlock = $Block; continue 2; } } # ~ if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) { $CurrentBlock['element']['text'] .= "\n".$text; } else { $Blocks []= $CurrentBlock; $CurrentBlock = $this->paragraph($Line); $CurrentBlock['identified'] = true; } } # ~ if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) { $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); } # ~ $Blocks []= $CurrentBlock; unset($Blocks[0]); # ~ $markup = ''; foreach ($Blocks as $Block) { if (isset($Block['hidden'])) { continue; } $markup .= "\n"; $markup .= isset($Block['markup']) ? $Block['markup'] : $this->element($Block['element']); } $markup .= "\n"; # ~ return $markup; } # # Allow for plugin extensibility # protected function isBlockContinuable($Type) { return method_exists($this, 'block'.$Type.'Continue'); } protected function isBlockCompletable($Type) { return method_exists($this, 'block'.$Type.'Complete'); } # # Code protected function blockCode($Line, $Block = null) { if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted'])) { return; } if ($Line['indent'] >= 4) { $text = substr($Line['body'], 4); $Block = array( 'element' => array( 'name' => 'pre', 'handler' => 'element', 'text' => array( 'name' => 'code', 'text' => $text, ), ), ); return $Block; } } protected function blockCodeContinue($Line, $Block) { if ($Line['indent'] >= 4) { if (isset($Block['interrupted'])) { $Block['element']['text']['text'] .= "\n"; unset($Block['interrupted']); } $Block['element']['text']['text'] .= "\n"; $text = substr($Line['body'], 4); $Block['element']['text']['text'] .= $text; return $Block; } } protected function blockCodeComplete($Block) { $text = $Block['element']['text']['text']; $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); $Block['element']['text']['text'] = $text; return $Block; } # # Comment protected function blockComment($Line) { if ($this->markupEscaped) { return; } if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') { $Block = array( 'markup' => $Line['body'], ); if (preg_match('/-->$/', $Line['text'])) { $Block['closed'] = true; } return $Block; } } protected function blockCommentContinue($Line, array $Block) { if (isset($Block['closed'])) { return; } $Block['markup'] .= "\n" . $Line['body']; if (preg_match('/-->$/', $Line['text'])) { $Block['closed'] = true; } return $Block; } # # Fenced Code protected function blockFencedCode($Line) { if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches)) { $Element = array( 'name' => 'code', 'text' => '', ); if (isset($matches[1])) { $class = 'language-'.$matches[1]; $Element['attributes'] = array( 'class' => $class, ); } $Block = array( 'char' => $Line['text'][0], 'element' => array( 'name' => 'pre', 'handler' => 'element', 'text' => $Element, ), ); return $Block; } } protected function blockFencedCodeContinue($Line, $Block) { if (isset($Block['complete'])) { return; } if (isset($Block['interrupted'])) { $Block['element']['text']['text'] .= "\n"; unset($Block['interrupted']); } if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) { $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1); $Block['complete'] = true; return $Block; } $Block['element']['text']['text'] .= "\n".$Line['body'];; return $Block; } protected function blockFencedCodeComplete($Block) { $text = $Block['element']['text']['text']; $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); $Block['element']['text']['text'] = $text; return $Block; } # # Header protected function blockHeader($Line) { if (isset($Line['text'][1])) { $level = 1; while (isset($Line['text'][$level]) and $Line['text'][$level] === '#') { $level ++; } if ($level > 6) { return; } $text = trim($Line['text'], '# '); $Block = array( 'element' => array( 'name' => 'h' . min(6, $level), 'text' => $text, 'handler' => 'line', ), ); return $Block; } } # # List protected function blockList($Line) { list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]'); if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) { $Block = array( 'indent' => $Line['indent'], 'pattern' => $pattern, 'element' => array( 'name' => $name, 'handler' => 'elements', ), ); $Block['li'] = array( 'name' => 'li', 'handler' => 'li', 'text' => array( $matches[2], ), ); $Block['element']['text'] []= & $Block['li']; return $Block; } } protected function blockListContinue($Line, array $Block) { if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) { if (isset($Block['interrupted'])) { $Block['li']['text'] []= ''; unset($Block['interrupted']); } unset($Block['li']); $text = isset($matches[1]) ? $matches[1] : ''; $Block['li'] = array( 'name' => 'li', 'handler' => 'li', 'text' => array( $text, ), ); $Block['element']['text'] []= & $Block['li']; return $Block; } if ($Line['text'][0] === '[' and $this->blockReference($Line)) { return $Block; } if ( ! isset($Block['interrupted'])) { $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); $Block['li']['text'] []= $text; return $Block; } if ($Line['indent'] > 0) { $Block['li']['text'] []= ''; $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); $Block['li']['text'] []= $text; unset($Block['interrupted']); return $Block; } } # # Quote protected function blockQuote($Line) { if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) { $Block = array( 'element' => array( 'name' => 'blockquote', 'handler' => 'lines', 'text' => (array) $matches[1], ), ); return $Block; } } protected function blockQuoteContinue($Line, array $Block) { if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) { if (isset($Block['interrupted'])) { $Block['element']['text'] []= ''; unset($Block['interrupted']); } $Block['element']['text'] []= $matches[1]; return $Block; } if ( ! isset($Block['interrupted'])) { $Block['element']['text'] []= $Line['text']; return $Block; } } # # Rule protected function blockRule($Line) { if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) { $Block = array( 'element' => array( 'name' => 'hr' ), ); return $Block; } } # # Setext protected function blockSetextHeader($Line, array $Block = null) { if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) { return; } if (chop($Line['text'], $Line['text'][0]) === '') { $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2'; return $Block; } } # # Markup protected function blockMarkup($Line) { if ($this->markupEscaped) { return; } if (preg_match('/^<(\w*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) { $element = strtolower($matches[1]); if (in_array($element, $this->textLevelElements)) { return; } $Block = array( 'name' => $matches[1], 'depth' => 0, 'markup' => $Line['text'], ); $length = strlen($matches[0]); $remainder = substr($Line['text'], $length); if (trim($remainder) === '') { if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) { $Block['closed'] = true; $Block['void'] = true; } } else { if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) { return; } if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) { $Block['closed'] = true; } } return $Block; } } protected function blockMarkupContinue($Line, array $Block) { if (isset($Block['closed'])) { return; } if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open { $Block['depth'] ++; } if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close { if ($Block['depth'] > 0) { $Block['depth'] --; } else { $Block['closed'] = true; } } if (isset($Block['interrupted'])) { $Block['markup'] .= "\n"; unset($Block['interrupted']); } $Block['markup'] .= "\n".$Line['body']; return $Block; } # # Reference protected function blockReference($Line) { # ReduxFramework added string alerting to remove themecheck error. if (preg_match('/^\[(.+?)\]:[ ]*<'.'?'.'(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches)) { $id = strtolower($matches[1]); $Data = array( 'url' => $matches[2], 'title' => null, ); if (isset($matches[3])) { $Data['title'] = $matches[3]; } $this->DefinitionData['Reference'][$id] = $Data; $Block = array( 'hidden' => true, ); return $Block; } } # # Table protected function blockTable($Line, array $Block = null) { if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) { return; } if (strpos($Block['element']['text'], '|') !== false and chop($Line['text'], ' -:|') === '') { $alignments = array(); $divider = $Line['text']; $divider = trim($divider); $divider = trim($divider, '|'); $dividerCells = explode('|', $divider); foreach ($dividerCells as $dividerCell) { $dividerCell = trim($dividerCell); if ($dividerCell === '') { continue; } $alignment = null; if ($dividerCell[0] === ':') { $alignment = 'left'; } if (substr($dividerCell, - 1) === ':') { $alignment = $alignment === 'left' ? 'center' : 'right'; } $alignments []= $alignment; } # ~ $HeaderElements = array(); $header = $Block['element']['text']; $header = trim($header); $header = trim($header, '|'); $headerCells = explode('|', $header); foreach ($headerCells as $index => $headerCell) { $headerCell = trim($headerCell); $HeaderElement = array( 'name' => 'th', 'text' => $headerCell, 'handler' => 'line', ); if (isset($alignments[$index])) { $alignment = $alignments[$index]; $HeaderElement['attributes'] = array( 'style' => 'text-align: '.$alignment.';', ); } $HeaderElements []= $HeaderElement; } # ~ $Block = array( 'alignments' => $alignments, 'identified' => true, 'element' => array( 'name' => 'table', 'handler' => 'elements', ), ); $Block['element']['text'] []= array( 'name' => 'thead', 'handler' => 'elements', ); $Block['element']['text'] []= array( 'name' => 'tbody', 'handler' => 'elements', 'text' => array(), ); $Block['element']['text'][0]['text'] []= array( 'name' => 'tr', 'handler' => 'elements', 'text' => $HeaderElements, ); return $Block; } } protected function blockTableContinue($Line, array $Block) { if (isset($Block['interrupted'])) { return; } if ($Line['text'][0] === '|' or strpos($Line['text'], '|')) { $Elements = array(); $row = $Line['text']; $row = trim($row); $row = trim($row, '|'); preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches); foreach ($matches[0] as $index => $cell) { $cell = trim($cell); $Element = array( 'name' => 'td', 'handler' => 'line', 'text' => $cell, ); if (isset($Block['alignments'][$index])) { $Element['attributes'] = array( 'style' => 'text-align: '.$Block['alignments'][$index].';', ); } $Elements []= $Element; } $Element = array( 'name' => 'tr', 'handler' => 'elements', 'text' => $Elements, ); $Block['element']['text'][1]['text'] []= $Element; return $Block; } } # # ~ # protected function paragraph($Line) { $Block = array( 'element' => array( 'name' => 'p', 'text' => $Line['text'], 'handler' => 'line', ), ); return $Block; } # # Inline Elements # protected $InlineTypes = array( '"' => array('SpecialCharacter'), '!' => array('Image'), '&' => array('SpecialCharacter'), '*' => array('Emphasis'), ':' => array('Url'), '<' => array('UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'), '>' => array('SpecialCharacter'), '[' => array('Link'), '_' => array('Emphasis'), '`' => array('Code'), '~' => array('Strikethrough'), '\\' => array('EscapeSequence'), ); # ~ protected $inlineMarkerList = '!"*_&[:<>`~\\'; # # ~ # public function line($text) { $markup = ''; # $excerpt is based on the first occurrence of a marker while ($excerpt = strpbrk($text, $this->inlineMarkerList)) { $marker = $excerpt[0]; $markerPosition = strpos($text, $marker); $Excerpt = array('text' => $excerpt, 'context' => $text); foreach ($this->InlineTypes[$marker] as $inlineType) { $Inline = $this->{'inline'.$inlineType}($Excerpt); if ( ! isset($Inline)) { continue; } # makes sure that the inline belongs to "our" marker if (isset($Inline['position']) and $Inline['position'] > $markerPosition) { continue; } # sets a default inline position if ( ! isset($Inline['position'])) { $Inline['position'] = $markerPosition; } # the text that comes before the inline $unmarkedText = substr($text, 0, $Inline['position']); # compile the unmarked text $markup .= $this->unmarkedText($unmarkedText); # compile the inline $markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']); # remove the examined text $text = substr($text, $Inline['position'] + $Inline['extent']); continue 2; } # the marker does not belong to an inline $unmarkedText = substr($text, 0, $markerPosition + 1); $markup .= $this->unmarkedText($unmarkedText); $text = substr($text, $markerPosition + 1); } $markup .= $this->unmarkedText($text); return $markup; } # # ~ # protected function inlineCode($Excerpt) { $marker = $Excerpt['text'][0]; if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(? strlen($matches[0]), 'element' => array( 'name' => 'code', 'text' => $text, ), ); } } protected function inlineEmailTag($Excerpt) { if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $Excerpt['text'], $matches)) { $url = $matches[1]; if ( ! isset($matches[2])) { $url = 'mailto:' . $url; } return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => 'a', 'text' => $matches[1], 'attributes' => array( 'href' => $url, ), ), ); } } protected function inlineEmphasis($Excerpt) { if ( ! isset($Excerpt['text'][1])) { return; } $marker = $Excerpt['text'][0]; if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) { $emphasis = 'strong'; } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) { $emphasis = 'em'; } else { return; } return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => $emphasis, 'handler' => 'line', 'text' => $matches[1], ), ); } protected function inlineEscapeSequence($Excerpt) { if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters)) { return array( 'markup' => $Excerpt['text'][1], 'extent' => 2, ); } } protected function inlineImage($Excerpt) { if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') { return; } $Excerpt['text']= substr($Excerpt['text'], 1); $Link = $this->inlineLink($Excerpt); if ($Link === null) { return; } $Inline = array( 'extent' => $Link['extent'] + 1, 'element' => array( 'name' => 'img', 'attributes' => array( 'src' => $Link['element']['attributes']['href'], 'alt' => $Link['element']['text'], ), ), ); $Inline['element']['attributes'] += $Link['element']['attributes']; unset($Inline['element']['attributes']['href']); return $Inline; } protected function inlineLink($Excerpt) { $Element = array( 'name' => 'a', 'handler' => 'line', 'text' => null, 'attributes' => array( 'href' => null, 'title' => null, ), ); $extent = 0; $remainder = $Excerpt['text']; if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches)) { $Element['text'] = $matches[1]; $extent += strlen($matches[0]); $remainder = substr($remainder, $extent); } else { return; } if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; if (isset($matches[2])) { $Element['attributes']['title'] = substr($matches[2], 1, - 1); } $extent += strlen($matches[0]); } else { if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) { $definition = strlen($matches[1]) ? $matches[1] : $Element['text']; $definition = strtolower($definition); $extent += strlen($matches[0]); } else { $definition = strtolower($Element['text']); } if ( ! isset($this->DefinitionData['Reference'][$definition])) { return; } $Definition = $this->DefinitionData['Reference'][$definition]; $Element['attributes']['href'] = $Definition['url']; $Element['attributes']['title'] = $Definition['title']; } $Element['attributes']['href'] = str_replace(array('&', '<'), array('&', '<'), $Element['attributes']['href']); return array( 'extent' => $extent, 'element' => $Element, ); } protected function inlineMarkup($Excerpt) { if ($this->markupEscaped or strpos($Excerpt['text'], '>') === false) { return; } if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $Excerpt['text'], $matches)) { return array( 'markup' => $matches[0], 'extent' => strlen($matches[0]), ); } if ($Excerpt['text'][1] === '!' and preg_match('/^/s', $Excerpt['text'], $matches)) { return array( 'markup' => $matches[0], 'extent' => strlen($matches[0]), ); } if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) { return array( 'markup' => $matches[0], 'extent' => strlen($matches[0]), ); } } protected function inlineSpecialCharacter($Excerpt) { if ($Excerpt['text'][0] === '&' and ! preg_match('/^&#?\w+;/', $Excerpt['text'])) { return array( 'markup' => '&', 'extent' => 1, ); } $SpecialCharacter = array('>' => 'gt', '<' => 'lt', '"' => 'quot'); if (isset($SpecialCharacter[$Excerpt['text'][0]])) { return array( 'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';', 'extent' => 1, ); } } protected function inlineStrikethrough($Excerpt) { if ( ! isset($Excerpt['text'][1])) { return; } if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches)) { return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => 'del', 'text' => $matches[1], 'handler' => 'line', ), ); } } protected function inlineUrl($Excerpt) { if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') { return; } if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) { $Inline = array( 'extent' => strlen($matches[0][0]), 'position' => $matches[0][1], 'element' => array( 'name' => 'a', 'text' => $matches[0][0], 'attributes' => array( 'href' => $matches[0][0], ), ), ); return $Inline; } } protected function inlineUrlTag($Excerpt) { if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches)) { $url = str_replace(array('&', '<'), array('&', '<'), $matches[1]); return array( 'extent' => strlen($matches[0]), 'element' => array( 'name' => 'a', 'text' => $url, 'attributes' => array( 'href' => $url, ), ), ); } } # ~ protected function unmarkedText($text) { if ($this->breaksEnabled) { $text = preg_replace('/[ ]*\n/', "
    \n", $text); } else { $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "
    \n", $text); $text = str_replace(" \n", "\n", $text); } return $text; } # # Handlers # protected function element(array $Element) { $markup = '<'.$Element['name']; if (isset($Element['attributes'])) { foreach ($Element['attributes'] as $name => $value) { if ($value === null) { continue; } $markup .= ' '.$name.'="'.$value.'"'; } } if (isset($Element['text'])) { $markup .= '>'; if (isset($Element['handler'])) { $markup .= $this->{$Element['handler']}($Element['text']); } else { $markup .= $Element['text']; } $markup .= ''; } else { $markup .= ' />'; } return $markup; } protected function elements(array $Elements) { $markup = ''; foreach ($Elements as $Element) { $markup .= "\n" . $this->element($Element); } $markup .= "\n"; return $markup; } # ~ protected function li($lines) { $markup = $this->lines($lines); $trimmedMarkup = trim($markup); if ( ! in_array('', $lines) and substr($trimmedMarkup, 0, 3) === '

    ') { $markup = $trimmedMarkup; $markup = substr($markup, 3); $position = strpos($markup, "

    "); $markup = substr_replace($markup, '', $position, 4); } return $markup; } # # Deprecated Methods # function parse($text) { $markup = $this->text($text); return $markup; } # # Static Methods # static function instance($name = 'default') { if (isset(self::$instances[$name])) { return self::$instances[$name]; } $instance = new static(); self::$instances[$name] = $instance; return $instance; } private static $instances = array(); # # Fields # protected $DefinitionData; # # Read-Only protected $specialCharacters = array( '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', ); protected $StrongRegex = array( '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us', ); protected $EmRegex = array( '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us', ); protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?'; protected $voidElements = array( 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', ); protected $textLevelElements = array( 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', 'i', 'rp', 'del', 'code', 'strike', 'marquee', 'q', 'rt', 'ins', 'font', 'strong', 's', 'tt', 'sub', 'mark', 'u', 'xm', 'sup', 'nobr', 'var', 'ruby', 'wbr', 'span', 'time', ); } lib.redux_instances.php000066600000001647152141561110011231 0ustar00 $ReduxFramework] */ function get_all_redux_instances() { return ReduxFrameworkInstances::get_all_instances(); } }themecheck/js/admin.js000066600000000625152141561110010712 0ustar00(function( $ ) { "use strict"; $(function() { $('#theme-check > h2').html( $('#theme-check > h2').html() + ' with Redux Theme-Check' ); if ( typeof redux_check_intro !== 'undefined' ) { $('#theme-check .theme-check').append( redux_check_intro.text ); } $('#theme-check form' ).append('   Extra WP.org Requirements.'); }); }(jQuery)); themecheck/lang/themeforest-check.pot000066600000001626152141561110013717 0ustar00# Copyright (C) 2013 Japh # This file is distributed under the same license as the ThemeForest-Check package. msgid "" msgstr "" "Project-Id-Version: ThemeForest-Check 1.0.0\n" "Report-Msgid-Bugs-To: http://wordpress.org/tag/plugin-name\n" "POT-Creation-Date: 2013-05-10 11:23:19+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "PO-Revision-Date: 2013-05-10 10:37-0500\n" "Last-Translator: Japh \n" "Language-Team: Japh \n" "X-Generator: Poedit 1.5.7\n" "X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;" "esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n" "X-Poedit-Basepath: ../\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Poedit-SearchPath-0: .\n" #: class-themeforest-check.php:214 msgid "Page Title" msgstr "" #: class-themeforest-check.php:215 msgid "Menu Text" msgstr ""themecheck/lang/index.php000066600000000033152141561110011402 0ustar00 * @license GPL-3.0+ * @link http://redux.op * @copyright 2015 ReduxFramework */ /** * Redux-ThemeCheck class * * @package Redux_ThemeCheck * @author Dovy */ // Don't duplicate me! if ( ! class_exists( 'Redux_ThemeCheck' ) ) { class Redux_ThemeCheck { /** * Plugin version, used for cache-busting of style and script file references. * * @since 1.0.0 * @var string */ protected $version = '1.0.0'; /** * Instance of this class. * * @since 1.0.0 * @var object */ protected static $instance = null; /** * Instance of the Redux class. * * @since 1.0.0 * @var object */ protected static $redux = null; /** * Details of the embedded Redux class. * * @since 1.0.0 * @var object */ protected static $redux_details = null; /** * Slug for various elements. * * @since 1.0.0 * @var string */ protected $slug = 'redux_themecheck'; /** * Initialize the plugin by setting localization, filters, and administration functions. * * @since 1.0.0 */ private function __construct() { if ( ! class_exists( 'ThemeCheckMain' ) ) { return; } // Load admin style sheet and JavaScript. add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); add_action( 'themecheck_checks_loaded', array( $this, 'disable_checks' ) ); add_action( 'themecheck_checks_loaded', array( $this, 'add_checks' ) ); } /** * Return an instance of this class. * * @since 1.0.0 * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } /** * Return an instance of this class. * * @since 1.0.0 * @return object A single instance of this class. */ public static function get_redux_instance() { // If the single instance hasn't been set, set it now. if ( null == self::$redux && ReduxFramework::$_as_plugin ) { self::$redux = new ReduxFramework(); self::$redux->init(); } return self::$redux; } /** * Return the Redux path info, if had. * * @since 1.0.0 * @return object A single instance of this class. */ public static function get_redux_details( $php_files = array() ) { if ( self::$redux_details === null ) { foreach ( $php_files as $php_key => $phpfile ) { if ( strpos( $phpfile, 'class' . ' ReduxFramework {' ) !== false ) { self::$redux_details = array( 'filename' => strtolower( basename( $php_key ) ), 'path' => $php_key, ); self::$redux_details['dir'] = str_replace( basename( $php_key ), '', $php_key ); self::$redux_details['parent_dir'] = str_replace( basename( self::$redux_details['dir'] ) . '/', '', self::$redux_details['dir'] ); } } } if ( self::$redux_details === null ) { self::$redux_details = false; } return self::$redux_details; } /** * Disable Theme-Check checks that aren't relevant for ThemeForest themes * * @since 1.0.0 */ function disable_checks() { global $themechecks; //$checks_to_disable = array( // 'IncludeCheck', // 'I18NCheck', // 'AdminMenu', // 'Bad_Checks', // 'MalwareCheck', // 'Theme_Support', // 'CustomCheck', // 'EditorStyleCheck', // 'IframeCheck', //); // //foreach ( $themechecks as $keyindex => $check ) { // if ( $check instanceof themecheck ) { // $check_class = get_class( $check ); // if ( in_array( $check_class, $checks_to_disable ) ) { // unset( $themechecks[$keyindex] ); // } // } //} } /** * Disable Theme-Check checks that aren't relevant for ThemeForest themes * * @since 1.0.0 */ function add_checks() { global $themechecks; // load all the checks in the checks directory $dir = 'checks'; foreach ( glob( dirname( __FILE__ ) . '/' . $dir . '/*.php' ) as $file ) { require_once $file; } } /** * Register and enqueue admin-specific style sheet. * * @since 1.0.1 */ public function enqueue_admin_styles() { $screen = get_current_screen(); if ( 'appearance_page_themecheck' == $screen->id ) { wp_enqueue_style( $this->slug . '-admin-styles', ReduxFramework::$_url . 'inc/themecheck/css/admin.css', array(), $this->version ); } } /** * Register and enqueue admin-specific JavaScript. * * @since 1.0.1 */ public function enqueue_admin_scripts() { $screen = get_current_screen(); if ( 'appearance_page_themecheck' == $screen->id ) { wp_enqueue_script( $this->slug . '-admin-script', ReduxFramework::$_url . 'inc/themecheck/js/admin.js', array( 'jquery' ), $this->version ); if ( ! isset( $_POST['themename'] ) ) { $intro = ''; $intro .= '

    Redux Theme-Check

    '; $intro .= '

    Extra checks for Redux to ensure you\'re ready for marketplace submission to marketplaces.

    '; $redux_check_intro['text'] = $intro; wp_localize_script( $this->slug . '-admin-script', 'redux_check_intro', $redux_check_intro ); } } } } Redux_ThemeCheck::get_instance(); }themecheck/index.php000066600000000033152141561110010461 0ustar00error[] = '
    ' . sprintf( __( 'RECOMMENDED: If you are submitting to WordPress.org Theme Repository, it is strongly suggested that you read this document, or your theme will be rejected because of Redux.', 'redux-framework' ), 'https://docs.reduxframework.com/core/wordpress-org-submissions/' ) . '
    '; $ret = false; } else { // TODO Granular WP.org tests!!! // Check for Tracking checkcount(); $tracking = $redux['dir'] . 'inc/tracking.php'; if ( file_exists( $tracking ) ) { $this->error[] = '
    ' . sprintf( __('REQUIRED: You MUST delete %s , or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework'), $tracking ) . '
    '; $ret = false; } // Embedded CDN package //use_cdn // Arguments checkcount(); $args = '
      '; $args .= "
    1. 'save_defaults' => false
    2. "; $args .= "
    3. 'use_cdn' => false
    4. "; $args .= "
    5. 'customizer_only' => true Non-Customizer Based Panels are Prohibited within WP.org Themes
    6. "; $args .= "
    7. 'database' => 'theme_mods' (" . __( 'Optional', 'redux-framework' ) . ")
    8. "; $args .= '
    '; $this->error[] = '
    ' . __( 'RECOMMENDED: The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework' ) . $args . '
    '; } } return $ret; } function getError() { return $this->error; } } $themechecks[] = new Redux_Embedded;themecheck/checks/full_package.php000066600000004540152141561110013236 0ustar00 __( 'Redux localization utilities', 'themecheck' ), 'bin' => __( 'Redux Resting Diles', 'themecheck' ), 'codestyles' => __( 'Redux Code Styles', 'themecheck' ), 'tests' => __( 'Redux Unit Testing', 'themecheck' ), 'class.redux-plugin.php' => __( 'Redux Plugin File', 'themecheck' ), 'bootstrap_tests.php' => __( 'Redux Boostrap Tests', 'themecheck' ), '.travis.yml' => __( 'CI Testing FIle', 'themecheck' ), 'phpunit.xml' => __( 'PHP Unit Testing', 'themecheck' ), ); $errors = array(); foreach ( $blacklist as $file => $reason ) { checkcount(); if ( file_exists( $redux['parent_dir'] . $file ) ) { $errors[ $redux['parent_dir'] . $file ] = $reason; } } if ( ! empty( $errors ) ) { $error = 'REQUIRED ' . __( 'It appears that you have embedded the full Redux package inside your theme. You need only embed the ReduxCore folder. Embedding anything else will get your rejected from theme submission. Suspected Redux package file(s):', 'redux-framework' ); $error .= '
      '; foreach ( $errors as $key => $e ) { $error .= '
    1. ' . $e . ': ' . $key . '
    2. '; } $error .= '
    '; $this->error[] = '
    ' . $error . '
    '; $ret = false; } } return $ret; } function getError() { return $this->error; } } $themechecks[] = new Redux_Full_Package();themecheck/checks/index.php000066600000000033152141561110011721 0ustar00parent->admin_notices[] = array( 'type' => 'error', 'msg' => '' . __( 'File Permission Issues', 'redux-framework' ) . '
    ' . sprintf( __( 'We were unable to modify required files. Please check your permissions, or modify your wp-config.php file to contain your FTP login credentials as outlined here.', 'redux-framework' ), 'https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants' ), 'id' => 'redux-wp-login', 'dismiss' => false, ); } /** * Return an instance of this class. * * @since 1.0.0 * @return object A single instance of this class. */ public static function get_instance( $parent = null ) { // If the single instance hasn't been set, set it now. if ( null == self::$instance ) { self::$instance = new self; } if ( $parent !== null ) { self::$instance->parent = $parent; } return self::$instance; } public function ftp_form() { if ( isset( $this->parent->ftp_form ) && ! empty( $this->parent->ftp_form ) ) { echo '

    '; echo '' . __( 'File Permission Issues', 'redux-framework' ) . '
    ' . sprintf( __( 'We were unable to modify required files. Please ensure that %1s has the proper read-write permissions, or modify your wp-config.php file to contain your FTP login credentials as outlined here.', 'redux-framework' ), Redux_Helpers::cleanFilePath( trailingslashit( WP_CONTENT_DIR ) ) . '/uploads/', 'https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants' ); echo '

    ' . '
    '; } } function filesystem_init( $form_url, $method = '', $context = false, $fields = null ) { global $wp_filesystem; if ( ! empty( $this->creds ) ) { return true; } ob_start(); /* first attempt to get credentials */ if ( false === ( $this->creds = request_filesystem_credentials( $form_url, $method, false, $context ) ) ) { $this->creds = array(); $this->parent->ftp_form = ob_get_contents(); ob_end_clean(); /** * if we comes here - we don't have credentials * so the request for them is displaying * no need for further processing **/ return false; } /* now we got some credentials - try to use them*/ if ( ! WP_Filesystem( $this->creds ) ) { $this->creds = array(); /* incorrect connection data - ask for credentials again, now with error message */ request_filesystem_credentials( $form_url, '', true, $context ); $this->parent->ftp_form = ob_get_contents(); ob_end_clean(); return false; } return true; } public static function load_direct() { if ( self::$direct === null ) { require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php'; require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php'; self::$direct = new WP_Filesystem_Direct( array() ); } } public function execute( $action, $file = '', $params = '' ) { if ( empty( $this->parent->args ) ) { return; } if ( ! empty ( $params ) ) { extract( $params ); } if ( ! is_dir( ReduxFramework::$_upload_dir ) ) { wp_mkdir_p( ReduxFramework::$_upload_dir ); } // Setup the filesystem with creds require_once ABSPATH . '/wp-admin/includes/template.php'; require_once ABSPATH . '/wp-includes/pluggable.php'; require_once ABSPATH . '/wp-admin/includes/file.php'; if ( $this->parent->args['menu_type'] == 'submenu' ) { $page_parent = $this->parent->args['page_parent']; $base = $page_parent . '?page=' . $this->parent->args['page_slug']; } else { $base = 'admin.php?page=' . $this->parent->args['page_slug']; } $url = wp_nonce_url( $base, 'redux-options' ); $this->filesystem_init( $url, 'direct', dirname( $file ) ); return $this->do_action( $action, $file, $params ); } public function do_action( $action, $file = '', $params = '' ) { if ( ! empty ( $params ) ) { extract( $params ); } global $wp_filesystem; if ( ! isset( $params['chmod'] ) || ( isset( $params['chmod'] ) && empty( $params['chmod'] ) ) ) { if ( defined( 'FS_CHMOD_FILE' ) ) { $chmod = FS_CHMOD_FILE; } else { $chmod = 0644; } } $res = false; if ( ! isset( $recursive ) ) { $recursive = false; } //$target_dir = $wp_filesystem->find_folder( dirname( $file ) ); // Do unique stuff if ( $action == 'mkdir' ) { if ( defined( 'FS_CHMOD_DIR' ) ) { $chmod = FS_CHMOD_DIR; } else { $chmod = 0755; } $res = $wp_filesystem->mkdir( $file ); if ( ! $res ) { wp_mkdir_p( $file ); $res = file_exists( $file ); if ( ! $res ) { mkdir( $file, $chmod, true ); $res = file_exists( $file ); } } } elseif ( $action == 'rmdir' ) { $res = $wp_filesystem->rmdir( $file, $recursive ); } elseif ( $action == 'copy' && ! isset( $this->filesystem->killswitch ) ) { if ( isset( $this->parent->ftp_form ) && ! empty( $this->parent->ftp_form ) ) { $res = copy( $file, $destination ); if ( $res ) { chmod( $destination, $chmod ); } } else { $res = $wp_filesystem->copy( $file, $destination, $overwrite, $chmod ); } } elseif ( $action == 'move' && ! isset( $this->filesystem->killswitch ) ) { $res = $wp_filesystem->copy( $file, $destination, $overwrite ); } elseif ( $action == 'delete' ) { $res = $wp_filesystem->delete( $file, $recursive ); } elseif ( $action == 'rmdir' ) { $res = $wp_filesystem->rmdir( $file, $recursive ); } elseif ( $action == 'dirlist' ) { if ( ! isset( $include_hidden ) ) { $include_hidden = true; } $res = $wp_filesystem->dirlist( $file, $include_hidden, $recursive ); } elseif ( $action == 'put_contents' && ! isset( $this->filesystem->killswitch ) ) { // Write a string to a file if ( isset( $this->parent->ftp_form ) && ! empty( $this->parent->ftp_form ) ) { self::load_direct(); $res = self::$direct->put_contents( $file, $content, $chmod ); } else { $res = $wp_filesystem->put_contents( $file, $content, $chmod ); } } elseif ( $action == 'chown' ) { // Changes file owner if ( isset( $owner ) && ! empty( $owner ) ) { $res = $wp_filesystem->chmod( $file, $chmod, $recursive ); } } elseif ( $action == 'owner' ) { // Gets file owner $res = $wp_filesystem->owner( $file ); } elseif ( $action == 'chmod' ) { if ( ! isset( $params['chmod'] ) || ( isset( $params['chmod'] ) && empty( $params['chmod'] ) ) ) { $chmod = false; } $res = $wp_filesystem->chmod( $file, $chmod, $recursive ); } elseif ( $action == 'get_contents' ) { // Reads entire file into a string if ( isset( $this->parent->ftp_form ) && ! empty( $this->parent->ftp_form ) ) { self::load_direct(); $res = self::$direct->get_contents( $file ); } else { $res = $wp_filesystem->get_contents( $file ); } } elseif ( $action == 'get_contents_array' ) { // Reads entire file into an array $res = $wp_filesystem->get_contents_array( $file ); } elseif ( $action == 'object' ) { $res = $wp_filesystem; } elseif ( $action == 'unzip' ) { $unzipfile = unzip_file( $file, $destination ); if ( $unzipfile ) { $res = true; } } if ( ! $res ) { if ($action == 'dirlist') { if (empty($res) || $res == false || $res == '' ) { return; } if (is_array($res) && empty($res)) { return; } if (!is_array($res)) { if (count(glob("$file*")) == 0) { return; } } } $this->killswitch = true; $this->parent->admin_notices[] = array( 'type' => 'error', 'msg' => '' . __( 'File Permission Issues', 'redux-framework' ) . '
    ' . sprintf( __( 'We were unable to modify required files. Please ensure that %1s has the proper read-write permissions, or modify your wp-config.php file to contain your FTP login credentials as outlined here.', 'redux-framework' ), Redux_Helpers::cleanFilePath( trailingslashit( WP_CONTENT_DIR ) ) . '/uploads/', 'https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants' ), 'id' => 'redux-wp-login', 'dismiss' => false, ); //add_action( "redux/page/{$this->parent->args['opt_name']}/form/before", array( // $this, // 'ftp_form' //) ); } return $res; } } Redux_Filesystem::get_instance(); } class.redux_admin_notices.php000066600000020050152141561110012402 0ustar00ID; if ( ! get_user_meta( $userid, 'ignore_' . $notice['id'] ) ) { // Check if we are on admin.php. If we are, we have // to get the current page slug and tab, so we can // feed it back to Wordpress. Why> admin.php cannot // be accessed without the page parameter. We add the // tab to return the user to the last panel they were // on. $pageName = ''; $curTab = ''; if ( $pagenow == 'admin.php' || $pagenow == 'themes.php' ) { // Get the current page. To avoid errors, we'll set // the redux page slug if the GET is empty. $pageName = empty( $_GET['page'] ) ? '&page=' . self::$_parent->args['page_slug'] : '&page=' . esc_attr( $_GET['page'] ); // Ditto for the current tab. $curTab = empty( $_GET['tab'] ) ? '&tab=0' : '&tab=' . esc_attr( $_GET['tab'] ); } global $wp_version; // Print the notice with the dismiss link if ( version_compare( $wp_version, '4.2', '>' ) ) { $output = ""; $css_id = esc_attr( $notice['id'] ) . $pageName . $curTab; $css_class = esc_attr( $notice['type'] ) . ' redux-notice notice is-dismissible redux-notice'; $output .= "
    \n"; $nonce = wp_create_nonce( $notice['id'] . $userid . 'nonce' ); $output .= " \n"; $output .= '

    ' . wp_kses_post( $notice['msg'] ) . '

    '; $output .= "
    \n"; echo $output; } else { echo '

    ' . wp_kses_post( $notice['msg'] ) . '  ' . esc_html__( 'Dismiss', 'redux-framework' ) . '.

    '; } } } else { // Standard notice echo '

    ' . wp_kses_post( $notice['msg'] ) . '.

    '; } ?> admin_notices = array(); } } /** * dismissAdminNotice - Updates user meta to store dismiss notice preference * * @since 3.2.0 * @access public * @return void */ public static function dismissAdminNotice() { global $current_user; // Verify the dismiss and id parameters are present. if ( isset( $_GET['dismiss'] ) && isset( $_GET['id'] ) ) { if ( 'true' == $_GET['dismiss'] || 'false' == $_GET['dismiss'] ) { // Get the user id $userid = $current_user->ID; // Get the notice id $id = esc_attr( $_GET['id'] ); $val = esc_attr( $_GET['dismiss'] ); // Add the dismiss request to the user meta. update_user_meta( $userid, 'ignore_' . $id, $val ); } } } /** * dismissAdminNotice - Updates user meta to store dismiss notice preference * * @since 3.2.0 * @access public * @return void */ public static function dismissAdminNoticeAJAX() { global $current_user; // Get the notice id $id = explode( '&', $_POST['id'] ); $id = $id[0]; // Get the user id $userid = $current_user->ID; if ( ! wp_verify_nonce( $_POST['nonce'], $id . $userid . 'nonce' ) ) { die( 0 ); } else { // Add the dismiss request to the user meta. update_user_meta( $userid, 'ignore_' . $id, true ); } } } Redux_Admin_Notices::load(); } tracking.php000066600000062445152141561110007073 0ustar00parent = $parent; $this->options = get_option( 'redux-framework-tracking' ); $this->options['dev_mode'] = $parent->args['dev_mode']; if ( ! isset( $this->options['hash'] ) || ! $this->options['hash'] || empty( $this->options['hash'] ) ) { $this->options['hash'] = md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] ); update_option( 'redux-framework-tracking', $this->options ); } if ( isset( $_GET['redux_framework_disable_tracking'] ) && ! empty( $_GET['redux_framework_disable_tracking'] ) ) { $this->options['allow_tracking'] = 'no'; update_option( 'redux-framework-tracking', $this->options ); } if ( isset( $_GET['redux_framework_enable_tracking'] ) && ! empty( $_GET['redux_framework_enable_tracking'] ) ) { $this->options['allow_tracking'] = 'yes'; update_option( 'redux-framework-tracking', $this->options ); } if ( isset( $_GET['page'] ) && $_GET['page'] == $this->parent->args['page_slug'] ) { if ( ! isset( $this->options['allow_tracking'] ) ) { add_action( 'admin_enqueue_scripts', array( $this, '_enqueue_tracking' ) ); } else if ( ! isset( $this->options['tour'] ) && ( $this->parent->args['dev_mode'] == "true" || $this->parent->args['page_slug'] == "redux_demo" ) ) { add_action( 'admin_enqueue_scripts', array( $this, '_enqueue_newsletter' ) ); } } $hash = md5( trailingslashit( network_site_url() ) . '-redux' ); add_action( 'wp_ajax_nopriv_' . $hash, array( $this, 'tracking_arg' ) ); add_action( 'wp_ajax_' . $hash, array( $this, 'tracking_arg' ) ); $hash = md5( md5( AUTH_KEY . SECURE_AUTH_KEY . '-redux' ) . '-support' ); add_action( 'wp_ajax_nopriv_' . $hash, array( $this, 'support_args' ) ); add_action( 'wp_ajax_' . $hash, array( $this, 'support_args' ) ); if ( isset( $this->options['allow_tracking'] ) && $this->options['allow_tracking'] == 'yes' ) { // The tracking checks daily, but only sends new data every 7 days. if ( ! wp_next_scheduled( 'redux_tracking' ) ) { wp_schedule_event( time(), 'daily', 'redux_tracking' ); } add_action( 'redux_tracking', array( $this, 'tracking' ) ); } } function _enqueue_tracking() { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui' ); wp_enqueue_script( 'wp-pointer' ); wp_enqueue_script( 'utils' ); add_action( 'admin_print_footer_scripts', array( $this, 'tracking_request' ) ); } function _enqueue_newsletter() { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui' ); wp_enqueue_script( 'wp-pointer' ); wp_enqueue_script( 'utils' ); add_action( 'admin_print_footer_scripts', array( $this, 'newsletter_request' ) ); } /** * Shows a popup that asks for permission to allow tracking. */ function tracking_request() { $id = '#wpadminbar'; $nonce = wp_create_nonce( 'redux_activate_tracking' ); $content = '

    ' . esc_html__( 'Help improve Our Panel', 'redux-framework' ) . '

    '; $content .= '

    ' . esc_html__( 'Please helps us improve our panel by allowing us to gather anonymous usage stats so we know which configurations, plugins and themes to test to ensure compatibility.', 'redux-framework' ) . '

    '; $opt_arr = array( 'content' => $content, 'position' => array( 'edge' => 'top', 'align' => 'center' ) ); $button2 = esc_html__( 'Allow tracking', 'redux-framework' ); $function2 = 'redux_store_answer("yes","' . $nonce . '")'; $function1 = 'redux_store_answer("no","' . $nonce . '")'; $this->print_scripts( $id, $opt_arr, esc_html__( 'Do not allow tracking', 'redux-framework' ), $button2, $function2, $function1 ); } /** * Shows a popup that asks for permission to allow tracking. */ function newsletter_request() { $id = '#wpadminbar'; $nonce = wp_create_nonce( 'redux_activate_tracking' ); $content = '

    ' . esc_html__( 'Welcome to the Redux Demo Panel', 'redux-framework' ) . '

    '; $content .= '

    ' . esc_html__( 'Getting Started', 'redux-framework' ) . '
    ' . sprintf( __( 'This panel demonstrates the many features of Redux. Before digging in, we suggest you get up to speed by reviewing %1$s.', 'redux-framework' ), '' . esc_html__( 'our documentation', 'redux-framework' ) . '' ); $content .= '

    ' . esc_html__( 'Redux Generator', 'redux-framework' ) . '
    ' . sprintf( __( 'Want to get a head start? Use the %1$s. It will create a customized boilerplate theme or a standalone admin folder complete with all things Redux (with the help of Underscores and TGM). Save yourself a headache and try it today.', 'redux-framework' ), '' . esc_html__( 'Redux Generator', 'redux-framework' ) . '' ); $content .= '

    ' . esc_html__( 'Redux Extensions', 'redux-framework' ) . '
    ' . sprintf( __( 'Did you know we have extensions, which greatly enhance the features of Redux? Visit our %1$s to learn more!', 'redux-framework' ), '' . esc_html__( 'extensions directory', 'redux-framework' ) . '' ); $content .= '

    ' . esc_html__( 'Like Redux?', 'redux-framework' ) . '
    ' . sprintf( __( 'If so, please %1$s and consider making a %2$s to keep development of Redux moving forward.', 'redux-framework' ), '' . esc_html__( 'leave us a favorable review on WordPress.org', 'redux-framework' ) . '', '' . esc_html__( 'donation', 'redux-framework' ) . '' ); $content .= '

    ' . esc_html__( 'Newsletter', 'redux-framework' ) . '
    ' . esc_html__( 'If you\'d like to keep up to with all things Redux, please subscribe to our newsletter', 'redux-framework' ) . ':

    '; $content .= '

        

    '; $opt_arr = array( 'content' => $content, 'position' => array( 'edge' => 'top', 'align' => 'center' ), 'pointerWidth' => 450 ); $function1 = 'redux_store_answer("tour","' . $nonce . '")'; $this->print_scripts( $id, $opt_arr, esc_html__( 'Close', 'redux-framework' ), false, '', $function1 ); } /** * Prints the pointer script * * @param string $selector The CSS selector the pointer is attached to. * @param array $options The options for the pointer. * @param string $button1 Text for button 1 * @param string|bool $button2 Text for button 2 (or false to not show it, defaults to false) * @param string $button2_function The JavaScript function to attach to button 2 * @param string $button1_function The JavaScript function to attach to button 1 */ function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) { ?> true ) ) as $pt ) { $count = wp_count_posts( $pt ); $pts[ $pt ] = $count->publish; } $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array( 'version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template, ); if ( ! function_exists( 'get_plugin_data' ) ) { require_once ABSPATH . 'wp-admin/includes/admin.php'; } $plugins = array(); foreach ( get_option( 'active_plugins', array() ) as $plugin_path ) { $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path ); $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path ); $plugins[ $slug ] = array( 'version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI'], ); } if ( is_multisite() ) { foreach ( get_option( 'active_sitewide_plugins', array() ) as $plugin_path ) { $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path ); $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path ); $plugins[ $slug ] = array( 'version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI'], ); } } $version = explode( '.', PHP_VERSION ); $version = array( 'major' => $version[0], 'minor' => $version[0] . '.' . $version[1], 'release' => PHP_VERSION ); $user_query = new WP_User_Query( array( 'blog_id' => $blog_id, 'count_total' => true, ) ); $comments_query = new WP_Comment_Query(); $data = array( '_id' => $this->options['hash'], 'localhost' => ( $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ) ? 1 : 0, 'php' => $version, 'site' => array( 'hash' => $this->options['hash'], 'version' => get_bloginfo( 'version' ), 'multisite' => is_multisite(), 'users' => $user_query->get_total(), 'lang' => get_locale(), 'wp_debug' => ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? true : false : false ), 'memory' => WP_MEMORY_LIMIT, ), 'pts' => $pts, 'comments' => array( 'total' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pings' => $comments_query->query( array( 'count' => true, 'type' => 'pingback' ) ), ), 'options' => apply_filters( 'redux/tracking/options', array() ), 'theme' => $theme, 'redux' => array( 'mode' => ReduxFramework::$_is_plugin ? 'plugin' : 'theme', 'version' => ReduxFramework::$_version, 'demo_mode' => get_option( 'ReduxFrameworkPlugin' ), ), 'developer' => apply_filters( 'redux/tracking/developer', array() ), 'plugins' => $plugins, ); $parts = explode( ' ', $_SERVER['SERVER_SOFTWARE'] ); $software = array(); foreach ( $parts as $part ) { if ( $part[0] == "(" ) { continue; } if ( strpos( $part, '/' ) !== false ) { $chunk = explode( "/", $part ); $software[ strtolower( $chunk[0] ) ] = $chunk[1]; } } $software['full'] = $_SERVER['SERVER_SOFTWARE']; $data['environment'] = $software; //if ( function_exists( 'mysql_get_server_info' ) ) { // $data['environment']['mysql'] = mysql_get_server_info(); //} $data['environment']['mysql'] = $wpdb->db_version(); if ( empty( $data['developer'] ) ) { unset( $data['developer'] ); } return $data; } /** * Main tracking function. */ function tracking() { // Start of Metrics global $blog_id, $wpdb; $data = get_transient( 'redux_tracking_cache' ); if ( ! $data ) { $args = array( 'body' => $this->trackingObject() ); $response = wp_remote_post( 'https://redux-tracking.herokuapp.com', $args ); // Store for a week, then push data again. set_transient( 'redux_tracking_cache', true, WEEK_IN_SECONDS ); } } function tracking_arg() { echo md5( AUTH_KEY . SECURE_AUTH_KEY . '-redux' ); die(); } function support_args() { header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', false ); header( 'Pragma: no-cache' ); $instances = ReduxFrameworkInstances::get_all_instances(); if ( isset( $_REQUEST['i'] ) && ! empty( $_REQUEST['i'] ) ) { if ( is_array( $instances ) && ! empty( $instances ) ) { foreach ( $instances as $opt_name => $data ) { if ( md5( $opt_name . '-debug' ) == $_REQUEST['i'] ) { $array = $instances[ $opt_name ]; } } } if ( isset( $array ) ) { if ( isset( $array->extensions ) && is_array( $array->extensions ) && ! empty( $array->extensions ) ) { foreach ( $array->extensions as $key => $extension ) { if ( isset( $extension->$version ) ) { $array->extensions[ $key ] = $extension->$version; } else { $array->extensions[ $key ] = true; } } } if ( isset( $array->import_export ) ) { unset( $array->import_export ); } if ( isset( $array->debug ) ) { unset( $array->debug ); } } else { die(); } } else { $array = $this->trackingObject(); if ( is_array( $instances ) && ! empty( $instances ) ) { $array['instances'] = array(); foreach ( $instances as $opt_name => $data ) { $array['instances'][] = $opt_name; } } $array['key'] = md5( AUTH_KEY . SECURE_AUTH_KEY ); } echo @json_encode( $array, true ); die(); } } Redux_Tracking::get_instance(); /** * Adds tracking parameters for Redux settings. Outside of the main class as the class could also be in use in other ways. * * @param array $options * * @return array */ function redux_tracking_additions( $options ) { $opt = array(); $options['redux'] = array( 'demo_mode' => get_option( 'ReduxFrameworkPlugin' ), ); return $options; } add_filter( 'redux/tracking/options', 'redux_tracking_additions' ); function redux_allow_tracking_callback() { // Verify that the incoming request is coming with the security nonce if ( wp_verify_nonce( $_REQUEST['nonce'], 'redux_activate_tracking' ) ) { $options = get_option( 'redux-framework-tracking' ); if ( $_REQUEST['allow_tracking'] == "tour" ) { $options['tour'] = 1; } else { $options['allow_tracking'] = $_REQUEST['allow_tracking']; } if ( update_option( 'redux-framework-tracking', $options ) ) { die( '1' ); } else { die( '0' ); } } else { // Send -1 if the attempt to save via Ajax was completed invalid. die( '-1' ); } // end if } add_action( 'wp_ajax_redux_allow_tracking', 'redux_allow_tracking_callback' ); }