load(); } public static function instance() { if (is_null(self::$instance)) { self::$instance = new AWPCP_Settings_API(); } return self::$instance; } public function load() { $options = get_option($this->option); $this->options = is_array($options) ? $options : array(); } public function register_settings() { register_setting($this->option, $this->option, array($this, 'validate')); // Group: Private $group = $this->add_group(__('Private Settings', 'AWPCP'), 'private-settings', 10); // Group: General $group = $this->add_group( __( 'General', 'AWPCP' ), 'general-settings', 10); // Section: General - Default $key = $this->add_section( $group, __( 'General Settings', 'AWPCP' ), 'default', 10, array( $this, 'section' ) ); $this->add_setting( $key, 'activatelanguages', __( 'Turn on transalation file (POT)', 'AWPCP' ), 'checkbox', 0, __( "Enable translations. WordPress will look for an AWPCP-<language>.mo file in AWPCP's languages/ directory. Example filenames are: AWPCP-en_EN.mo, AWPCP-es_ES.mo. You can generate .mo files using POEdit and the AWPCP.pot or AWPCP-en_EN.po files included with the plugin.", 'AWPCP' ) ); $this->add_setting( $key, 'main_page_display', __( 'Show Ad listings on main page', 'AWPCP' ), 'checkbox', 0, __( 'If unchecked only categories will be displayed', 'AWPCP' ) ); $this->add_setting( $key, 'view-categories-columns', __( 'Category columns in View Categories page', 'AWPCP' ), 'select', 2, '', array('options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5))); $this->add_setting( $key, 'uiwelcome', __( 'Welcome message in Classified page', 'AWPCP' ), 'textarea', __( 'Looking for a job? Trying to find a date? Looking for an apartment? Browse our classifieds. Have a job to advertise? An apartment to rent? Post a classified ad.', 'AWPCP' ), __( 'The welcome text for your classified page on the user side', 'AWPCP' ) ); $options = array('admin' => __( 'Administrator', 'AWPCP' ), 'admin,editor' => __( 'Administrator & Editor', 'AWPCP' ) ); $this->add_setting( $key, 'awpcpadminaccesslevel', __( 'Role of admin users', 'AWPCP' ), 'radio', 'admin', __( 'Role of WordPress users who can have admin access to Classifieds.', 'AWPCP' ), array( 'options' => $options ) ); $this->add_setting( $key, 'awpcppagefilterswitch', __( 'Enable page filter', 'AWPCP' ), 'checkbox', 1, __( 'Uncheck this if you need to turn off the AWPCP page filter that prevents AWPCP classifieds children pages from showing up in your wp pages menu (You might need to do this if for example the AWPCP page filter is messing up your page menu. It means you will have to manually exclude the AWPCP children pages from showing in your page list. Some of the pages really should not be visible to your users by default).', 'AWPCP') ); $this->add_setting( $key, 'showlatestawpcpnews', __( 'Show latest AWPCP news', 'AWPCP' ), 'checkbox', 1, __( 'Show latest news from www.awpcp.com RSS feed.', 'AWPCP' ) ); // Section: General - Date & Time Format $label = _x( __( 'Date & Time Format', 'AWPCP' ) , 'settings', 'AWPCP' ); $key = $this->add_section($group, $label, 'date-time-format', 10, array($this, 'section_date_time_format')); $datetime = current_time('timestamp'); $options = array( 'american' => sprintf( '%s: %s', __( 'American', 'AWPCP' ), awpcp_time( $datetime, 'm/d/Y h:i:s' ) ), 'european' => sprintf( '%s: %s', __( 'European', 'AWPCP' ), awpcp_time( $datetime, 'd/m/Y H:i:s' ) ), 'custom' => __( 'Your own.', 'AWPCP' ), ); $this->add_setting( $key, 'x-date-time-format', __( 'Date Time Format', 'AWPCP' ), 'radio', 'american', '', array( 'options' => $options ) ); $this->add_setting( $key, 'date-format', _x( 'Date Format', 'settings', 'AWPCP' ), 'textfield', 'm/d/Y', '' ); $this->add_setting( $key, 'time-format', _x( 'Time Format', 'settings', 'AWPCP' ), 'textfield', 'h:i:s', '' ); $example = sprintf( '%s: %s', _x( 'Example output', 'settings', 'AWPCP' ), awpcp_time( null, 'awpcp' ) ); $description = _x( 'Full date/time output with any strings you wish to add. and