"facebook_settings", 'icon' => "facebook-square", 'title' => __("Facebook", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Settings that require input from Facebook.", 'allfacebook-instant-articles'), ); $facebook_settings = new afbia_settings_section($args); $args = array( 'id' => 'afbia_page_id', 'title' => __("Page ID", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'facebook_settings', 'description' => __("The page ID of the facebook page you want to add Instant Articles to.", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_page_id = new afbia_settings_field($args); // // Feed Settings // $args = array( 'id' => "feed_settings", 'icon' => "feed", 'title' => __("Feed", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Settings that modify parts of the Instant Articles feed.", 'allfacebook-instant-articles'), ); $facebook_settings = new afbia_settings_section($args); $args = array( 'id' => 'afbia_copyright', 'title' => __("Copyright", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("The standard copyright details for your instant articles.", 'allfacebook-instant-articles'), 'type' => 'textarea', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_copyright = new afbia_settings_field($args); $args = array( 'id' => 'afbia_like_media', 'title' => __("Like Media", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allow users to like the media you embedded.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_like_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_comment_media', 'title' => __("Comment Media", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allow users to comment on the media you embedded.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_article_interaction', 'title' => __("Article Interaction", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allow users to like and comment the whole article.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_article_interaction = new afbia_settings_field($args); $args = array( 'id' => 'afbia_rtl_publishing', 'title' => __("RTL Publishing", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Allows Right to Left Publishing for Arabic, Hebrew, Persian and other languages", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_articles_num', 'title' => __("Number of Articles", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("The number of articles, that will be rendered on the feed.", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); $args = array( 'id' => 'afbia_articles_style', 'title' => __("Style of Articles", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'feed_settings', 'description' => __("Style for articles if different from default", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_comment_media = new afbia_settings_field($args); // // Tracking Settings // $args = array( 'id' => "tracking_settings", 'icon' => "line-chart", 'title' => __("Tracking & Analytics", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Settings that set how you want to track your content.", 'allfacebook-instant-articles'), ); $facebook_settings = new afbia_settings_section($args); $args = array( 'id' => 'afbia_tracking', 'title' => __("Tracking Code", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'tracking_settings', 'description' => __("The tracking code, that will be embedded in your instant articles. See this link for more information.", 'allfacebook-instant-articles'), 'type' => 'textarea', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_tracking = new afbia_settings_field($args); $args = array( 'id' => 'afbia_ga_uid', 'title' => __("Google Tracking ID", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'tracking_settings', 'description' => __("If you want us to generate a Google Analytics tracking code for you, enter your analytics tracking ID here. (e.g. UA-XXXXX-Y)", 'allfacebook-instant-articles'), 'placeholder' => __("UA-XXXXX-Y", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_tracking = new afbia_settings_field($args); $args = array( 'id' => 'afbia_ga_anonymize_ip', 'title' => __("Anonymize IP", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'tracking_settings', 'description' => __("For many countries it is advisable to activate IP anonymization, to be compliant with data protection laws. More about that here.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); $afbia_tracking = new afbia_settings_field($args); // // Ad Settings Version 2 // Added in 0.8.3 // $args = array( 'id' => "afbia_ad_settings_2", 'icon' => "money", 'title' => __("Ads", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("Facebook Audience Network for Instant Articles ", 'allfacebook-instant-articles'), ); new afbia_settings_section($args); $args = array( 'id' => 'afbia_audience_active', // TODO: Change and migrate the ID name to something, that makes more sense 'title' => __("Automatic Placement", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'afbia_ad_settings_2', 'description' => __("Activate automatic placement of ads for Instant Articles.", 'allfacebook-instant-articles'), 'type' => 'checkbox', // text, textarea, password, checkbox 'option_group' => "settings_page_afbia_settings_page", ); new afbia_settings_field($args); $args = array( 'id' => 'afbia_audienceplacement', 'title' => __("Placement IDs", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'afbia_ad_settings_2', 'description' => __("Audience Network Placement IDs ", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'multi' => true, 'option_group' => "settings_page_afbia_settings_page", ); new afbia_settings_field($args); // // Custom Ads // Added in 0.8.3 // $args = array( 'id' => 'afbia_customads', 'title' => __("Direct-Sold Ads", 'allfacebook-instant-articles'), 'page' => 'afbia_settings_page', 'section' => 'afbia_ad_settings_2', 'description' => __("The source code of the custom ads, that will be placed in the Instant Article. ", 'allfacebook-instant-articles'), 'type' => 'text', // text, textarea, password, checkbox 'placeholder' => __('', 'allfacebook-instant-articles'), 'multi' => true, 'option_group' => "settings_page_afbia_settings_page", ); new afbia_settings_field($args); // // Help Page // /* $args = array( 'id' => "help_page", 'icon' => "question-circle", 'title' => __("Help", 'allfacebook-instant-articles'), 'page' => "afbia_settings_page", 'description' => __("One day this will be a proper help page.", 'allfacebook-instant-articles'), ); $help_page = new afbia_settings_section($args); /**/ } // // Register the Theme Settings Page // /** * add_theme_settings_page function. * * @access public * @return void */ public function add_theme_settings_page(){ $theme_page = add_options_page( __("Instant Articles", 'allfacebook-instant-articles'), __("Instant Articles", 'allfacebook-instant-articles'), 'manage_options', 'afbia_settings_page', array($this, 'lh_settings_page_v2') ); } /** * lh_settings_page function. * * @access public * @return void */ public function lh_settings_page(){ ?>
args['description'] ?>
NULL, 'title' => NULL, 'page' => NULL, 'section' => NULL, 'description' => NULL, 'type' => 'text', // text, textarea, password, checkbox 'multi' => false, 'placeholder' => NULL, 'sanitize_callback' => NULL, 'option_group' => NULL, ); $this->args = wp_parse_args( $args, $defaults ); $this->register_field(); } /** * register_field function. * * @access private * @return void */ private function register_field(){ add_settings_field( $this->args['id'], '', array($this, 'output_callback'), $this->args['page'], $this->args['section'] ); register_setting($this->args['option_group'], $this->args['id'], isset($this->args['sanatize_callback']) ? $this->args['sanatize_callback'] : NULL ); } /** * output_callback function. * * @access public * @return void */ public function output_callback(){ $t = $this->args['type']; if($t == "text"): $classes = array("text"); if($this->args['multi']){ $classes[] = "multi"; } ?> args['callback'], $this->args); endif; } }