get_path( 'admin' ) . 'views/' . $view . '.php', $view, $view_args ); if ( ! is_readable( $filename ) ) { _doing_it_wrong( __FUNCTION__, __( 'Passed view (' . $filename . ') not found or is not readable.', 'charitable' ), '1.0.0' ); } ob_start(); include( $filename ); ob_end_flush(); } /** * Returns the Charitable_Admin_Settings helper. * * @return Charitable_Admin_Settings * @since 1.0.0 */ function charitable_get_admin_settings() { return Charitable_Settings::get_instance(); } /** * Returns whether we are currently viewing the Charitable settings area. * * @param string $tab Optional. If passed, the function will also check that we are on the given tab. * @return boolean * @since 1.2.0 */ function charitable_is_settings_view( $tab = "" ) { if ( ! empty( $_POST ) ) { $is_settings = isset( $_POST[ 'charitable_settings' ] ); if ( ! $is_settings || empty( $tab ) ) { return $is_settings; } return array_key_exists( $tab, $_POST[ 'charitable_settings' ] ); } $is_settings = isset( $_GET[ 'page' ] ) && 'charitable-settings' == $_GET[ 'page' ]; if ( ! $is_settings || empty( $tab ) ) { return $is_settings; } /* The general tab can be loaded when tab is not set. */ if ( 'general' == $tab ) { return ! isset( $_GET[ 'tab' ] ) || 'general' == $_GET[ 'tab' ]; } return isset( $_GET[ 'tab' ] ) && $tab == $_GET[ 'tab' ]; } /** * Print out the settings fields for a particular settings section. * * This is based on WordPress' do_settings_fields but allows the possibility * of leaving out a field lable/title, for fullwidth fields. * * @see do_settings_fields * * @global $wp_settings_fields Storage array of settings fields and their pages/sections * * @param string $page Slug title of the admin page who's settings fields you want to show. * @param string $section Slug title of the settings section who's fields you want to show. * @return string * @since 1.0.0 */ function charitable_do_settings_fields( $page, $section ) { global $wp_settings_fields; if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { return; } foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { $class = ''; if ( ! empty( $field['args']['class'] ) ) { $class = ' class="' . esc_attr( $field['args']['class'] ) . '"'; } echo "