Since: 0.6.0
Inheritance: extends Apple_News
コード例 #1
0
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     $this->page = $page;
     $base_settings = new \Apple_Exporter\Settings();
     $this->base_settings = $base_settings->all();
     $this->settings = apply_filters('apple_news_section_settings', $this->settings, $page);
     $this->groups = apply_filters('apple_news_section_groups', $this->groups, $page);
     self::$fonts = apply_filters('apple_news_fonts_list', self::$fonts);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Advanced Settings', 'apple-news');
     // Add the settings
     $this->settings = array('body_line_height' => array('label' => __('Body Line Height', 'apple-news'), 'type' => 'float', 'sanitize' => 'floatval'), 'pullquote_line_height' => array('label' => __('Pull quote Line Height', 'apple-news'), 'type' => 'float', 'sanitize' => 'floatval'), 'header_line_height' => array('label' => __('Heading Line Height', 'apple-news'), 'type' => 'float', 'sanitize' => 'floatval'), 'component_alerts' => array('label' => __('Component Alerts', 'apple-news'), 'type' => array('none', 'warn', 'fail'), 'description' => __('If a post has a component that is unsupported by Apple News, choose "none" to generate no alert, "warn" to provide an admin warning notice, or "fail" to generate a notice and stop publishing.', 'apple-news')), 'json_alerts' => array('label' => __('JSON Alerts', 'apple-news'), 'type' => array('none', 'warn', 'fail'), 'description' => __('If a post has invalid JSON that may cause display issues in Apple News, choose "none" to generate no alert, "warn" to provide an admin warning notice, or "fail" to generate a notice and stop publishing.', 'apple-news')), 'use_remote_images' => array('label' => __('Use Remote Images?', 'apple-news'), 'type' => array('yes', 'no'), 'description' => __('Allow the Apple News API to retrieve images remotely rather than bundle them. This setting is recommended if you are having any issues with publishing images. If your images are not publicly accessible, such as on a development site, you cannot use this feature.', 'apple-news')));
     // Add the groups
     $this->groups = array('line_heights' => array('label' => __('Line Heights', 'apple-news'), 'settings' => array('body_line_height', 'pullquote_line_height', 'header_line_height')), 'alerts' => array('label' => __('Alerts', 'apple-news'), 'settings' => array('component_alerts', 'json_alerts')), 'images' => array('label' => __('Image Settings', 'apple-news'), 'settings' => array('use_remote_images')));
     parent::__construct($page);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Developer Tools', 'apple-news');
     // Add the settings
     $this->settings = array('apple_news_enable_debugging' => array('label' => __('Enable Debugging', 'apple-news'), 'type' => array('no', 'yes')), 'apple_news_admin_email' => array('label' => __('Administrator Email', 'apple-news'), 'type' => 'text'));
     // Add the groups
     $this->groups = array('debugging_settings' => array('label' => __('Debugging Settings', 'apple-news'), 'settings' => array('apple_news_enable_debugging', 'apple_news_admin_email')));
     parent::__construct($page);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Formatting', 'apple-news');
     // Add the settings
     $this->settings = array('layout_margin' => array('label' => __('Layout margin', 'apple-news'), 'type' => 'integer'), 'layout_gutter' => array('label' => __('Layout gutter', 'apple-news'), 'type' => 'integer'), 'body_font' => array('label' => '', 'type' => 'font'), 'body_size' => array('label' => __('Body font size', 'apple-news'), 'type' => 'integer'), 'body_color' => array('label' => __('Body font color', 'apple-news'), 'type' => 'color'), 'body_link_color' => array('label' => __('Body font hyperlink color', 'apple-news'), 'type' => 'color'), 'body_background_color' => array('label' => __('Body background color', 'apple-news'), 'type' => 'color'), 'body_orientation' => array('label' => __('Body alignment', 'apple-news'), 'type' => array('left', 'center', 'right')), 'initial_dropcap' => array('label' => __('Use initial dropcap', 'apple-news'), 'type' => array('yes', 'no')), 'dropcap_font' => array('label' => '', 'type' => 'font'), 'dropcap_color' => array('label' => __('Dropcap font color', 'apple-news'), 'type' => 'color'), 'byline_font' => array('label' => '', 'type' => 'font'), 'byline_size' => array('label' => __('Byline font size', 'apple-news'), 'type' => 'integer'), 'byline_color' => array('label' => __('Byline font color', 'apple-news'), 'type' => 'color'), 'byline_format' => array('label' => __('Byline format', 'apple-news'), 'type' => 'text', 'description' => __('Set the byline format. Two tokens can be present, #author# to denote the location of the author name and a <a href="http://php.net/manual/en/function.date.php" target="blank">PHP date format</a> string also encapsulated by #. The default format is "by #author# | #M j, Y | g:i A#". Note that byline format updates only preview on save.', 'apple-news'), 'size' => 40, 'required' => false), 'header_font' => array('label' => '', 'type' => 'font'), 'header_color' => array('label' => __('Header font color', 'apple-news'), 'type' => 'color'), 'header1_size' => array('label' => __('Header 1 font size', 'apple-news'), 'type' => 'integer'), 'header2_size' => array('label' => __('Header 2 font size', 'apple-news'), 'type' => 'integer'), 'header3_size' => array('label' => __('Header 3 font size', 'apple-news'), 'type' => 'integer'), 'header4_size' => array('label' => __('Header 4 font size', 'apple-news'), 'type' => 'integer'), 'header5_size' => array('label' => __('Header 5 font size', 'apple-news'), 'type' => 'integer'), 'header6_size' => array('label' => __('Header 6 font size', 'apple-news'), 'type' => 'integer'), 'pullquote_font' => array('label' => '', 'type' => 'font'), 'pullquote_size' => array('label' => __('Pull quote font size', 'apple-news'), 'type' => 'integer'), 'pullquote_color' => array('label' => __('Pull quote color', 'apple-news'), 'type' => 'color'), 'pullquote_border_color' => array('label' => __('Pull quote border color', 'apple-news'), 'type' => 'color'), 'pullquote_border_style' => array('label' => __('Pull quote border style', 'apple-news'), 'type' => array('solid', 'dashed', 'dotted')), 'pullquote_border_width' => array('label' => __('Pull quote border width', 'apple-news'), 'type' => 'integer'), 'pullquote_transform' => array('label' => __('Pull quote transformation', 'apple-news'), 'type' => array('none', 'uppercase')), 'gallery_type' => array('label' => __('Gallery type', 'apple-news'), 'type' => array('gallery', 'mosaic')), 'enable_advertisement' => array('label' => __('Enable advertisements', 'apple-news'), 'type' => array('yes', 'no')), 'ad_frequency' => array('label' => __('Ad Frequency', 'apple-news'), 'type' => 'integer', 'description' => __('A number between 1 and 10 defining the frequency for automatically inserting Banner Advertisement components into articles. For more information, see the <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/Apple_News_Format_Ref/AdvertisingSettings.html#//apple_ref/doc/uid/TP40015408-CH93-SW1" target="_blank">Apple News Format Reference</a>.', 'apple-news')), 'ad_margin' => array('label' => __('Ad Margin', 'apple-news'), 'type' => 'integer', 'description' => __('The margin to use above and below inserted ads.', 'apple-news')), 'meta_component_order' => array('callback' => array(get_class($this), 'render_meta_component_order'), 'sanitize' => array($this, 'sanitize_array')));
     // Add the groups
     $this->groups = array('layout' => array('label' => __('Layout Spacing', 'apple-news'), 'description' => __('The spacing for the base layout of the exported articles', 'apple-news'), 'settings' => array('layout_margin', 'layout_gutter')), 'body' => array('label' => __('Body', 'apple-news'), 'settings' => array('body_font', 'body_size', 'body_color', 'body_link_color', 'body_background_color', 'body_orientation')), 'dropcap' => array('label' => __('Dropcap', 'apple-news'), 'settings' => array('dropcap_font', 'initial_dropcap', 'dropcap_color')), 'byline' => array('label' => __('Byline', 'apple-news'), 'description' => __("The byline displays the article's author and date", 'apple-news'), 'settings' => array('byline_font', 'byline_size', 'byline_color', 'byline_format')), 'headings' => array('label' => __('Headings', 'apple-news'), 'settings' => array('header_font', 'header_color', 'header1_size', 'header2_size', 'header3_size', 'header4_size', 'header4_size', 'header5_size', 'header6_size')), 'pullquote' => array('label' => __('Pull quote', 'apple-news'), 'description' => sprintf('%s <a href="https://en.wikipedia.org/wiki/Pull_quote">%s</a>.', __('Articles can have an optional', 'apple-news'), __('Pull quote', 'apple-news')), 'settings' => array('pullquote_font', 'pullquote_size', 'pullquote_color', 'pullquote_border_color', 'pullquote_border_style', 'pullquote_border_width', 'pullquote_transform')), 'gallery' => array('label' => __('Gallery', 'apple-news'), 'description' => __('Can either be a standard gallery, or mosaic.', 'apple-news'), 'settings' => array('gallery_type')), 'advertisement' => array('label' => __('Advertisement', 'apple-news'), 'settings' => array('enable_advertisement', 'ad_frequency', 'ad_margin')), 'component_order' => array('label' => __('Component Order', 'apple-news'), 'settings' => array('meta_component_order')));
     parent::__construct($page);
 }
コード例 #5
0
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('API Settings', 'apple-news');
     // Add the settings
     $this->settings = array('api_key' => array('label' => __('API Key', 'apple-news'), 'type' => 'string'), 'api_secret' => array('label' => __('API Secret', 'apple-news'), 'type' => 'password'), 'api_channel' => array('label' => __('API Channel', 'apple-news'), 'type' => 'string'), 'api_autosync' => array('label' => __('Automatically publish to Apple News', 'apple-news'), 'type' => array('yes', 'no')), 'api_autosync_update' => array('label' => __('Automatically update Apple News', 'apple-news'), 'type' => array('yes', 'no')), 'api_async' => array('label' => __('Asynchronously publish to Apple News', 'apple-news'), 'type' => array('yes', 'no'), 'description' => $this->get_async_description()));
     // Add the groups
     $this->groups = array('apple_news' => array('label' => __('Apple News API', 'apple-news'), 'description' => __('All of these settings are required for publishing to Apple News', 'apple-news'), 'settings' => array('api_key', 'api_secret', 'api_channel', 'api_autosync', 'api_autosync_update', 'api_async')));
     parent::__construct($page);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Formatting', 'apple-news');
     // Add the settings
     $this->settings = array('layout_margin' => array('label' => __('Layout margin', 'apple-news'), 'type' => 'integer'), 'layout_gutter' => array('label' => __('Layout gutter', 'apple-news'), 'type' => 'integer'), 'body_font' => array('label' => '', 'type' => 'font'), 'body_size' => array('label' => __('Body font size', 'apple-news'), 'type' => 'integer'), 'body_color' => array('label' => __('Body font color', 'apple-news'), 'type' => 'color'), 'body_link_color' => array('label' => __('Body font hyperlink color', 'apple-news'), 'type' => 'color'), 'body_orientation' => array('label' => __('Body alignment', 'apple-news'), 'type' => array('left', 'center', 'right')), 'initial_dropcap' => array('label' => __('Use initial dropcap', 'apple-news'), 'type' => array('yes', 'no')), 'dropcap_font' => array('label' => '', 'type' => 'font'), 'dropcap_color' => array('label' => __('Dropcap font color', 'apple-news'), 'type' => 'color'), 'byline_font' => array('label' => '', 'type' => 'font'), 'byline_size' => array('label' => __('Byline font size', 'apple-news'), 'type' => 'integer'), 'byline_color' => array('label' => __('Byline font color', 'apple-news'), 'type' => 'color'), 'byline_format' => array('label' => __('Byline format', 'apple-news'), 'type' => 'text', 'description' => __('Set the byline format. Two tokens can be present, #author# to denote the location of the author name and a <a href="http://php.net/manual/en/function.date.php" target="blank">PHP date format</a> string also encapsulated by #. The default format is "by #author# | #M j, Y | g:i A#".', 'apple-news'), 'size' => 40, 'required' => false), 'header_font' => array('label' => '', 'type' => 'font'), 'header_color' => array('label' => __('Header font color', 'apple-news'), 'type' => 'color'), 'header1_size' => array('label' => __('Header 1 font size', 'apple-news'), 'type' => 'integer'), 'header2_size' => array('label' => __('Header 2 font size', 'apple-news'), 'type' => 'integer'), 'header3_size' => array('label' => __('Header 3 font size', 'apple-news'), 'type' => 'integer'), 'header4_size' => array('label' => __('Header 4 font size', 'apple-news'), 'type' => 'integer'), 'header5_size' => array('label' => __('Header 5 font size', 'apple-news'), 'type' => 'integer'), 'header6_size' => array('label' => __('Header 6 font size', 'apple-news'), 'type' => 'integer'), 'pullquote_font' => array('label' => '', 'type' => 'font'), 'pullquote_size' => array('label' => __('Pull quote font size', 'apple-news'), 'type' => 'integer'), 'pullquote_color' => array('label' => __('Pull quote color', 'apple-news'), 'type' => 'color'), 'pullquote_transform' => array('label' => __('Pull quote transformation', 'apple-news'), 'type' => array('none', 'uppercase')), 'gallery_type' => array('label' => __('Gallery type', 'apple-news'), 'type' => array('gallery', 'mosaic')), 'enable_advertisement' => array('label' => __('Enable advertisement', 'apple-news'), 'type' => array('yes', 'no')));
     // Add the groups
     $this->groups = array('layout' => array('label' => __('Layout Spacing', 'apple-news'), 'description' => __('The spacing for the base layout of the exported articles', 'apple-news'), 'settings' => array('layout_margin', 'layout_gutter')), 'body' => array('label' => __('Body', 'apple-news'), 'settings' => array('body_font', 'body_size', 'body_color', 'body_link_color', 'body_orientation')), 'dropcap' => array('label' => __('Dropcap', 'apple-news'), 'settings' => array('dropcap_font', 'initial_dropcap', 'dropcap_color')), 'byline' => array('label' => __('Byline', 'apple-news'), 'description' => __("The byline displays the article's author and date", 'apple-news'), 'settings' => array('byline_font', 'byline_size', 'byline_color', 'byline_format')), 'headings' => array('label' => __('Headings', 'apple-news'), 'settings' => array('header_font', 'header_color', 'header1_size', 'header2_size', 'header3_size', 'header4_size', 'header4_size', 'header5_size', 'header6_size')), 'pullquote' => array('label' => __('Pull quote', 'apple-news'), 'description' => sprintf('%s <a href="https://en.wikipedia.org/wiki/Pull_quote">%s</a>.', __('Articles can have an optional', 'apple-news'), __('Pull quote', 'apple-news')), 'settings' => array('pullquote_font', 'pullquote_size', 'pullquote_color', 'pullquote_transform')), 'gallery' => array('label' => __('Gallery', 'apple-news'), 'description' => __('Can either be a standard gallery, or mosaic.', 'apple-news'), 'settings' => array('gallery_type')), 'advertisement' => array('label' => __('Advertisement', 'apple-news'), 'settings' => array('enable_advertisement')));
     parent::__construct($page);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Formatting', 'apple-news');
     // Add the settings
     $this->settings = array('layout_margin' => array('label' => __('Layout margin', 'apple-news'), 'type' => 'integer'), 'layout_gutter' => array('label' => __('Layout gutter', 'apple-news'), 'type' => 'integer'), 'body_font' => array('label' => '', 'type' => 'font'), 'body_size' => array('label' => __('Body font size', 'apple-news'), 'type' => 'integer'), 'body_color' => array('label' => __('Body font color', 'apple-news'), 'type' => 'color'), 'body_link_color' => array('label' => __('Body font hyperlink color', 'apple-news'), 'type' => 'color'), 'body_orientation' => array('label' => __('Body alignment', 'apple-news'), 'type' => array('left', 'center', 'right')), 'initial_dropcap' => array('label' => __('Use initial dropcap', 'apple-news'), 'type' => array('yes', 'no')), 'dropcap_font' => array('label' => '', 'type' => 'font'), 'dropcap_color' => array('label' => __('Dropcap font color', 'apple-news'), 'type' => 'color'), 'byline_font' => array('label' => '', 'type' => 'font'), 'byline_size' => array('label' => __('Byline font size', 'apple-news'), 'type' => 'integer'), 'byline_color' => array('label' => __('Byline font color', 'apple-news'), 'type' => 'color'), 'header_font' => array('label' => '', 'type' => 'font'), 'header_color' => array('label' => __('Header font color', 'apple-news'), 'type' => 'color'), 'header1_size' => array('label' => __('Header 1 font size', 'apple-news'), 'type' => 'integer'), 'header2_size' => array('label' => __('Header 2 font size', 'apple-news'), 'type' => 'integer'), 'header3_size' => array('label' => __('Header 3 font size', 'apple-news'), 'type' => 'integer'), 'header4_size' => array('label' => __('Header 4 font size', 'apple-news'), 'type' => 'integer'), 'header5_size' => array('label' => __('Header 5 font size', 'apple-news'), 'type' => 'integer'), 'header6_size' => array('label' => __('Header 6 font size', 'apple-news'), 'type' => 'integer'), 'pullquote_font' => array('label' => '', 'type' => 'font'), 'pullquote_size' => array('label' => __('Pull quote font size', 'apple-news'), 'type' => 'integer'), 'pullquote_color' => array('label' => __('Pull quote color', 'apple-news'), 'type' => 'color'), 'pullquote_transform' => array('label' => __('Pull quote transformation', 'apple-news'), 'type' => array('none', 'uppercase')), 'gallery_type' => array('label' => __('Gallery type', 'apple-news'), 'type' => array('gallery', 'mosaic')), 'enable_advertisement' => array('label' => __('Enable advertisement', 'apple-news'), 'type' => array('yes', 'no')));
     // Add the groups
     $this->groups = array('layout' => array('label' => __('Layout Spacing', 'apple-news'), 'description' => __('The spacing for the base layout of the exported articles', 'apple-news'), 'settings' => array('layout_margin', 'layout_gutter')), 'body' => array('label' => __('Body', 'apple-news'), 'settings' => array('body_font', 'body_size', 'body_color', 'body_link_color', 'body_orientation')), 'dropcap' => array('label' => __('Dropcap', 'apple-news'), 'settings' => array('dropcap_font', 'initial_dropcap', 'dropcap_color')), 'byline' => array('label' => __('Byline', 'apple-news'), 'description' => __("The byline displays the article's author and date", 'apple-news'), 'settings' => array('byline_font', 'byline_size', 'byline_color')), 'headings' => array('label' => __('Headings', 'apple-news'), 'settings' => array('header_font', 'header_color', 'header1_size', 'header2_size', 'header3_size', 'header4_size', 'header4_size', 'header5_size', 'header6_size')), 'pullquote' => array('label' => __('Pull quote', 'apple-news'), 'description' => sprintf('%s <a href="https://en.wikipedia.org/wiki/Pull_quote">%s</a>.', __('Articles can have an optional', 'apple-news'), __('Pull quote', 'apple-news')), 'settings' => array('pullquote_font', 'pullquote_size', 'pullquote_color', 'pullquote_transform')), 'gallery' => array('label' => __('Gallery', 'apple-news'), 'description' => __('Can either be a standard gallery, or mosaic.', 'apple-news'), 'settings' => array('gallery_type')), 'advertisement' => array('label' => __('Advertisement', 'apple-news'), 'settings' => array('enable_advertisement')));
     parent::__construct($page);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Advanced Settings', 'apple-news');
     // Add the settings
     $this->settings = array('body_line_height' => array('label' => __('Body Line Height', 'apple-news'), 'type' => 'float', 'sanitize' => 'floatval'), 'pullquote_line_height' => array('label' => __('Pull quote Line Height', 'apple-news'), 'type' => 'float', 'sanitize' => 'floatval'), 'header_line_height' => array('label' => __('Heading Line Height', 'apple-news'), 'type' => 'float', 'sanitize' => 'floatval'));
     // Add the groups
     $this->groups = array('line_heights' => array('label' => __('Line Heights', 'apple-news'), 'settings' => array('body_line_height', 'pullquote_line_height', 'header_line_height')));
     parent::__construct($page);
 }
 /**
  * Constructor.
  *
  * @param string $page
  */
 function __construct($page)
 {
     // Set the name
     $this->name = __('Post Type Options', 'apple-news');
     // Add the settings
     $this->settings = array('show_metabox' => array('label' => __('Show a publish meta box on post types that have Apple News enabled.', 'apple-news'), 'type' => array('yes', 'no')));
     // Build the post types to display
     $post_types = apply_filters('apple_news_post_types', get_post_types(array('public' => true, 'show_ui' => true), 'objects'));
     if (!empty($post_types)) {
         $post_type_options = array();
         foreach ($post_types as $post_type) {
             $post_type_options[$post_type->name] = $post_type->label;
         }
         $this->settings['post_types'] = array('label' => __('Post Types', 'apple-news'), 'type' => $post_type_options, 'multiple' => true);
     }
     // Add the groups
     $this->groups = array('post_type_settings' => array('label' => __('Post Types', 'apple-news'), 'description' => __('Choose the post types that are eligible for publishing to Apple News.', 'apple-news'), 'settings' => array('post_types', 'show_metabox')));
     parent::__construct($page);
 }
コード例 #10
0
						<?php 
            do_action('apple_news_before_setting', $setting_name, $setting_meta);
            ?>
						<label class="setting-container">
							<?php 
            if (!empty($setting_meta['label'])) {
                ?>
								<span class="label-name"><?php 
                echo esc_html($setting_meta['label']);
                ?>
</span>
							<?php 
            }
            ?>
							<?php 
            echo wp_kses($section->render_field(array($setting_name, $setting_meta['default'])), Admin_Apple_Settings_Section::allowed_html());
            ?>
						</label>
						<?php 
            do_action('apple_news_after_setting', $setting_name, $setting_meta);
            ?>
						<br />
						<?php 
        }
        ?>

						<?php 
        if ($group['description']) {
            ?>
							<p class="description"><?php 
            echo '(' . wp_kses_post($group['description']) . ')';