/** * Gets instance of class. * * @return WP_Google_DFP_Ads_Settings_Fields Instance of the class. */ public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Renders view. */ public function __render() { $title = __('Google DFP Ads Settings', WP_Google_DFP_Ads::get_instance()->get_slug()); echo '<h2>' . $title . '</h2>'; echo '<form class="' . $this->id . '" method="post" action="options.php">'; do_settings_sections($this->id); settings_fields(WP_Google_DFP_Ads_Settings_Fields::get_instance()->get_id()); submit_button(); echo '</form>'; }
/** * Initializes settings. */ public function __initialize() { add_settings_field($this->id, __('Script Block', WP_Google_DFP_Ads::get_instance()->get_slug()), array($this, '__render'), WP_Google_DFP_Ads_Settings::get_instance()->get_id(), WP_Google_DFP_Ads_Settings_Head_Section::get_instance()->get_id()); register_setting(WP_Google_DFP_Ads_Settings_Fields::get_instance()->get_id(), $this->id); }