function foundation_render_theme_settings($page_options)
{
    wptouch_add_sub_page(FOUNDATION_PAGE_GENERAL, 'foundation-page-theme-settings', $page_options);
    if (!wptouch_admin_use_customizer()) {
        if (foundation_has_theme_colors()) {
            $color_settings = array();
            $colors = foundation_get_theme_colors();
            foreach ($colors as $name => $color) {
                $color_settings[] = wptouch_add_setting('color', $color->setting, $color->desc, '', WPTOUCH_SETTING_BASIC, '1.0', '', $color->domain);
            }
            wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Theme Colors', 'wptouch-pro'), 'foundation-colors', $color_settings, $page_options, FOUNDATION_SETTING_DOMAIN, false, false, 20);
        }
    }
    $foundation_blog_settings = array(wptouch_add_pro_setting('range', 'posts_per_page', __('Number of posts in post listings', 'wptouch-pro'), __('Overrides the WordPress Reading settings for "Blog pages show at most"', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0', array('min' => 1, 'max' => 15, 'step' => 1)), wptouch_add_pro_setting('text', 'excluded_categories', __('Excluded categories', 'wptouch-pro'), __('Comma separated by category name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'), wptouch_add_pro_setting('text', 'excluded_tags', __('Excluded tags', 'wptouch-pro'), __('Comma separated by tag name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'));
    $foundation_blog_settings = apply_filters('foundation_settings_blog', $foundation_blog_settings);
    $foundation_page_settings = apply_filters('foundation_settings_page', array());
    wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Blog', 'wptouch-pro'), 'foundation-web-theme-settings', $foundation_blog_settings, $page_options, FOUNDATION_SETTING_DOMAIN, true);
    wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Pages', 'wptouch-pro'), 'foundation-page-settings', $foundation_page_settings, $page_options, FOUNDATION_SETTING_DOMAIN, true);
    if (!function_exists('has_site_icon')) {
        wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Site Icon', 'wptouch-pro'), 'admin_menu_homescreen_android', array(wptouch_add_setting('image-upload', 'iphone_icon_retina', sprintf(__('%d by %d pixels (PNG)', 'wptouch-pro'), 192, 192), false, WPTOUCH_SETTING_BASIC, '2.0')), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 30);
    }
    $foundation_header_settings = array(wptouch_add_setting('image-upload', 'logo_image', __('Site Logo', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, false, '1.0'));
    $foundation_header_settings = apply_filters('foundation_settings_header', $foundation_header_settings);
    wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Header', 'wptouch-pro'), 'foundation-header', $foundation_header_settings, $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 10);
    wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Footer', 'wptouch-pro'), 'foundation-custom-content', array(wptouch_add_setting('textarea', 'custom_footer_message', __('Custom footer content (HTML is allowed)', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '1.0')), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 70);
    wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Custom CSS', 'wptouch-pro'), 'foundation-custom-css-declarations', array(wptouch_add_setting('textarea', 'custom_css_declarations', __('Custom CSS Declarations', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '4.0')), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 80);
    return $page_options;
}
Beispiel #2
0
function foundation_render_theme_settings($page_options)
{
    wptouch_add_sub_page(FOUNDATION_PAGE_GENERAL, 'foundation-page-general', $page_options);
    wptouch_add_sub_page(FOUNDATION_PAGE_BRANDING, 'foundation-page-branding', $page_options);
    $foundation_blog_settings = array(wptouch_add_setting('text', 'posts_per_page', __('Number of posts in post listings', 'wptouch-pro'), __('Overrides the WordPress Reading settings for "Blog pages show at most"', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'), wptouch_add_setting('text', 'excluded_categories', __('Excluded categories', 'wptouch-pro'), __('Comma separated by category name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'), wptouch_add_setting('text', 'excluded_tags', __('Excluded tags', 'wptouch-pro'), __('Comma separated by tag name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'), wptouch_add_setting('checkbox', 'allow_nested_comment_replies', __('Allow nested comment replies from mobile visitors', 'wptouch-pro'), __('Will show a Reply link after each comment', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'));
    $foundation_blog_settings = apply_filters('foundation_settings_blog', $foundation_blog_settings);
    wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Blog', 'wptouch-pro'), 'foundation-web-theme-settings', $foundation_blog_settings, $page_options, FOUNDATION_SETTING_DOMAIN);
    $foundation_page_settings = array(wptouch_add_setting('checkbox', 'show_comments_on_pages', __('Show comments on pages', 'wptouch-pro'), __('Overrides the WordPress settings for showing comments on pages.', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'));
    $foundation_page_settings = apply_filters('foundation_settings_pages', $foundation_page_settings);
    wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Pages', 'wptouch-pro'), 'foundation-pages', $foundation_page_settings, $page_options, FOUNDATION_SETTING_DOMAIN);
    wptouch_add_sub_page(FOUNDATION_PAGE_HOMESCREEN_ICONS, 'foundation-page-homescreen-icons', $page_options);
    /* Homescreen Icon Area */
    wptouch_add_page_section(FOUNDATION_PAGE_HOMESCREEN_ICONS, __('Icon Title', 'wptouch-pro'), 'admin_menu_homescreen_icons_options', array(wptouch_add_pro_setting('text', 'homescreen_icon_title', __('Icon title', 'wptouch-pro'), __('When visitors bookmark your website, this will be the title shown.', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0')), $page_options, FOUNDATION_SETTING_DOMAIN);
    wptouch_add_page_section(FOUNDATION_PAGE_HOMESCREEN_ICONS, __('Android', 'wptouch-pro'), 'admin_menu_homescreen_android', array(wptouch_add_setting('image-upload', 'android_others_icon', sprintf(__('%d by %d pixels (PNG)', 'wptouch-pro'), 96, 96), '', WPTOUCH_SETTING_BASIC, '2.0')), $page_options, FOUNDATION_SETTING_DOMAIN);
    wptouch_add_page_section(FOUNDATION_PAGE_HOMESCREEN_ICONS, __('iPhone & iPod touch', 'wptouch-pro'), 'admin_menu_homescreen_iphone_android_retina', array(wptouch_add_setting('image-upload', 'iphone_icon_retina', sprintf(__('%d by %d pixels (PNG)', 'wptouch-pro'), 180, 180), '', WPTOUCH_SETTING_BASIC, '2.0')), $page_options, FOUNDATION_SETTING_DOMAIN);
    if (foundation_has_theme_colors()) {
        $color_settings = array();
        $colors = foundation_get_theme_colors();
        foreach ($colors as $name => $color) {
            $color_settings[] = wptouch_add_setting('color', $color->setting, $color->desc, '', WPTOUCH_SETTING_BASIC, '1.0', '', $color->domain);
        }
        wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Theme Colors', 'wptouch-pro'), 'foundation-colors', $color_settings, $page_options, FOUNDATION_SETTING_DOMAIN);
    }
    $foundation_logo_settings = array(wptouch_add_setting('image-upload', 'logo_image', __('(Scaled by themes to fit logo areas as needed)', 'wptouch-pro'), '', WPTOUCH_SETTING_BASIC, '1.0'));
    $foundation_logo_settings = apply_filters('foundation_settings_logo', $foundation_logo_settings);
    wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Site Logo', 'wptouch-pro'), 'foundation-logo', $foundation_logo_settings, $page_options, FOUNDATION_SETTING_DOMAIN);
    wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Smart App Banner', 'wptouch-pro'), 'foundation-smart-app-banner', array(wptouch_add_setting('text', 'smart_app_banner', sprintf(__('Enter your app\'s %sApp Store ID%s', 'wptouch-pro'), '<a href="http://itunes.apple.com/linkmaker/" target="_blank">', '</a>'), __('Your app\'s unique identifier. Find your ID from the iTunes Link Maker: Search for your app. In the link it provides, your app ID is the nine-digit number in between id and ?mt. For example Angry Birds\'s ID is 343200656.', 'wptouch-pro'), WPTOUCH_SETTING_ADVANCED, '1.0')), $page_options, FOUNDATION_SETTING_DOMAIN);
    wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Theme Footer', 'wptouch-pro'), 'foundation-custom-content', array(wptouch_add_setting('textarea', 'custom_footer_message', __('Custom footer content (HTML is allowed)', 'wptouch-pro'), __('You can add custom footer content that will be displayed below the switch link.', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0')), $page_options, FOUNDATION_SETTING_DOMAIN);
    // No settings added to this by Foundation
    wptouch_add_sub_page(FOUNDATION_PAGE_CUSTOM, 'foundation-page-custom', $page_options);
    return $page_options;
}
function wptouch_customizer_ajax_callbacks()
{
    ?>
	<script type="text/javascript">
		function wptouchCustomizerGetLuma( hexvalue ) {
			var c = hexvalue.substring(1);      // strip #
			var rgb = parseInt(c, 16);   // convert rrggbb to decimal
			var r = (rgb >> 16) & 0xff;  // extract red
			var g = (rgb >>  8) & 0xff;  // extract green
			var b = (rgb >>  0) & 0xff;  // extract blue

			return 0.2126 * r + 0.7152 * g + 0.0722 * b; // per ITU-R BT.709'
		}

	( function( jQuery ){
<?php 
    if (foundation_has_theme_colors()) {
        $colors = foundation_get_theme_colors();
        foreach ($colors as $color) {
            ?>
			wp.customize('wptouch_<?php 
            echo $color->setting;
            ?>
',function( value ) {
				value.bind( function( to ) {
					<?php 
            if ($color->fg_selectors) {
                ?>
						jQuery( '<?php 
                echo $color->fg_selectors;
                ?>
' ).css('color', to ? to : '' );
					<?php 
            }
            ?>

					<?php 
            if ($color->bg_selectors) {
                ?>
						jQuery( '<?php 
                echo $color->bg_selectors;
                ?>
' ).css('background-color', to ? to : '' );
					<?php 
            }
            ?>

					<?php 
            if ($color->luma_threshold) {
                ?>
						if ( wptouchCustomizerGetLuma( to ) < <?php 
                echo $color->luma_threshold;
                ?>
 ) {
							jQuery( 'body' ).removeClass( 'light-<?php 
                echo $color->luma_class;
                ?>
' );
							jQuery( 'body' ).addClass( 'dark-<?php 
                echo $color->luma_class;
                ?>
' );
						} else {
							jQuery( 'body' ).addClass( 'light-<?php 
                echo $color->luma_class;
                ?>
' );
							jQuery( 'body' ).removeClass( 'dark-<?php 
                echo $color->luma_class;
                ?>
' );
						}
					<?php 
            }
            ?>
				});
			});
<?php 
        }
    }
    ?>
	} )( jQuery )
	</script>
<?php 
}