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->setting_name); $this->options = is_array($options) ? $options : array(); } public function register_settings() { register_setting($this->setting_name, $this->setting_name, array($this, 'validate')); // Group: Private $group = $this->add_group( __( 'Private Settings', 'AWPCP' ), 'private-settings', 0 ); // Group: Classified Pages $group = $this->add_group(__('Classifieds Pages', 'AWPCP'), 'pages-settings', 20); // Section: Classifieds Pages - Default $key = $this->add_section($group, __('Classifieds Pages', 'AWPCP'), 'default', 10, array($this, 'section')); $this->add_setting( $key, 'main-page-name', __( 'AWPCP Main page', 'AWPCP' ), 'textfield', 'AWPCP', __( 'Name for Classifieds page.', 'AWPCP' ) ); $this->add_setting( $key, 'show-ads-page-name', __( 'Show Ad page', 'AWPCP' ), 'textfield', 'Show Ad', __( 'Name for Show Ads page.', 'AWPCP' ) ); $this->add_setting( $key, 'place-ad-page-name', __( 'Place Ad page', 'AWPCP' ), 'textfield', 'Place Ad', __( 'Name for Place Ads page.', 'AWPCP' ) ); $this->add_setting( $key, 'edit-ad-page-name', __( 'Edit Ad page', 'AWPCP' ), 'textfield', 'Edit Ad', __( 'Name for edit ad page.', 'AWPCP' ) ); $this->add_setting( $key, 'renew-ad-page-name', __( 'Renew Ad page', 'AWPCP' ), 'textfield', 'Renew Ad', __( 'Name for Renew Ad page.', 'AWPCP' ) ); $this->add_setting( $key, 'reply-to-ad-page-name', __( 'Reply to Ad page', 'AWPCP' ), 'textfield', 'Reply To Ad', __( 'Name for Reply to Ad page.', 'AWPCP' ) ); $this->add_setting( $key, 'browse-ads-page-name', __( 'Browse Ads page', 'AWPCP' ), 'textfield', 'Browse Ads', __( 'Name for Browse Ads page.', 'AWPCP' ) ); $this->add_setting( $key, 'search-ads-page-name', __( 'Search Ads page', 'AWPCP' ), 'textfield', 'Search Ads', __( 'Name for Search Ads page.', 'AWPCP' ) ); $this->add_setting( $key, 'browse-categories-page-name', __( 'Browse Categories page', 'AWPCP' ), 'textfield', 'Browse Categories', __( 'Name for Browse Categories page.', 'AWPCP' ) ); $this->add_setting( $key, 'view-categories-page-name', __( 'View Categories page', 'AWPCP' ), 'textfield', 'View Categories', __( 'Name for categories view page. (Dynamic Page)', 'AWPCP' ) ); $this->add_setting( $key, 'payment-thankyou-page-name', __( 'Payment Thank You page', 'AWPCP' ), 'textfield', 'Payment Thank You', __( 'Name for Payment Thank You page.', 'AWPCP' ) ); $this->add_setting( $key, 'payment-cancel-page-name', __( 'Payment Cancel page', 'AWPCP' ), 'textfield', 'Cancel Payment', __( 'Name for Payment Cancel page.', 'AWPCP' ) ); // Group: Ad/Listings $group = $this->add_group(__('Ad/Listings', 'AWPCP'), 'listings-settings', 30); // Section: Ad/Listings - Regions $key = $this->add_section( $group, __( 'Regions Settings', 'AWPCP' ), 'regions-settings', 20, array( $this, 'section' ) ); $this->add_setting( $key, 'allow-regions-modification', __( 'Allow Regions modification', 'AWPCP' ), 'checkbox', 1, __( 'If enabled, users will be allowed to change the region information associated with their Ads.', 'AWPCP' ) ); $this->add_setting( $key, 'allow-user-to-search-in-multiple-regions', __( 'Allow users to search Ads in multiple regions', 'AWPCP' ), 'checkbox', 0, __( 'If enabled, users will be allowed to search Ads in multiple regions.', 'AWPCP' ) ); // Section: Ad/Listings - Layout and Presentation $key = $this->add_section($group, __('Layout and Presentation', 'AWPCP'), 'layout', 30, array($this, 'section')); $this->add_setting( $key, 'show-ad-preview-before-payment', __( 'Show Ad preview before payment.', 'AWPCP' ), 'checkbox', 0, __( 'If enabled, a preview of the Ad being posted will be shown after the images have been uploaded and before the user is asked to pay. The user is allowed to go back and edit the Ad details and uploaded images or proceed with the posting process.', 'AWPCP' ) ); $this->add_setting( $key, 'allowhtmlinadtext', __( 'Allow HTML in Ad text', 'AWPCP' ), 'checkbox', 0, __( 'Allow HTML in ad text (Not recommended).', 'AWPCP' ) ); $this->add_setting( $key, 'htmlstatustext', __( 'Display this text above ad detail text input box on ad post page', 'AWPCP' ), 'textarea', __( 'No HTML Allowed', 'AWPCP' ), ''); $this->add_setting( $key, 'characters-allowed-in-title', __( 'Maximum Ad title length', 'AWPCP' ), 'textfield', 100, __( 'Number of characters allowed in Ad title. Please note this is the default value and can be overwritten in Fees and Subscription Plans.', 'AWPCP' ) ); $this->add_setting( $key, 'maxcharactersallowed', __( 'Maximum Ad details length', 'AWPCP' ), 'textfield', 750, __( 'Number of characters allowed in Ad details. Please note this is the default value and can be overwritten in Fees and Subscription Plans.', 'AWPCP' ) ); $this->add_setting( $key, 'words-in-listing-excerpt', __( 'Number of words in Ad excerpt', 'AWPCP' ), 'textfield', 20, __( 'Number of words shown by the Ad excerpt placeholder.', 'AWPCP' ) ); $this->add_setting( $key, 'hidelistingcontactname', __( 'Hide contact name to anonymous users?', 'AWPCP' ), 'checkbox', 0, __( 'Hide listing contact name to anonymous (non logged in) users.', 'AWPCP' ) ); $this->add_setting( $key, 'displayadlayoutcode', __( 'Ad Listings page layout', 'AWPCP' ), 'textarea', '
$awpcp_image_name_srccode

$title_link

$excerpt
$awpcpadpostdate $awpcp_city_display $awpcp_state_display $awpcp_display_adviews $awpcp_display_price $awpcpextrafields
', __( 'Modify as needed to control layout of ad listings page. Maintain code formatted as \$somecodetitle. Changing the code keys will prevent the elements they represent from displaying.', 'AWPCP' ) ); $this->add_setting( $key, 'awpcpshowtheadlayout', __( 'Single Ad page layout', 'AWPCP' ), 'textarea', '
$ad_title

$featureimg
' . __( "Contact Information","AWPCP" ). '
' . __("Contact","AWPCP") . ' $adcontact_name $adcontactphone $location $awpcpvisitwebsite
$aditemprice $awpcpextrafields
$showadsense1
' . __( "More Information", "AWPCP" ) . '
$addetails
$showadsense2
    $awpcpshowadotherimages
$tweetbtn $sharebtn $flagad $awpcpadviews $showadsense3 $edit_listing_link
', __( 'Modify as needed to control layout of single ad view page. Maintain code formatted as \$somecodetitle. Changing the code keys will prevent the elements they represent from displaying.', 'AWPCP' ) ); $this->add_setting( $key, 'allow-wordpress-shortcodes-in-single-template', __( 'Allow WordPress Shortcodes in Single Ad page layout' ), 'checkbox', 0, __( 'Shortcodes executed this way will be executed as if they were entered in the content of the WordPress page showing the listing (normally the Show Ad page, but in general any page that has the AWPCPSHOWAD shortcode).', 'AWPCP' ) ); $radio_options = array(1 => __( 'Date (newest first)', 'AWPCP' ), 9 => __( 'Date (oldest first)', 'AWPCP' ), 2 => __( 'Title (ascending)', 'AWPCP' ), 10 => __( 'Title (descending)', 'AWPCP' ), 3 => __( 'Paid status and date (paid first, then most recent)', 'AWPCP' ), 4 => __( 'Paid status and title (paid first, then by title)', 'AWPCP' ), 5 => __( 'Views (most viewed first, then by title)', 'AWPCP' ), 6 => __( 'Views (most viewed first, then by date)', 'AWPCP' ), 11 => __( 'Views (least viewed first, then by title)', 'AWPCP' ), 12 => __( 'Views (least viewed first, then by date)', 'AWPCP' ), 7 => __( 'Price (high to low, then by date)', 'AWPCP' ), 8 => __( 'Price (low to high, then by date)', 'AWPCP' ), ); $this->add_setting( $key, 'groupbrowseadsby', __( 'Order Ad Listings by', 'AWPCP' ), 'select', 1, '', array('options' => $radio_options)); $this->add_setting( $key, 'search-results-order', __( 'Order Ad Listings in Search results by', 'AWPCP' ), 'select', 1, '', array('options' => $radio_options)); // $this->add_setting($key, 'groupsearchresultsby', 'Group Ad Listings search results by', 'radio', 1, '', array('options' => $radio_options)); $this->add_setting( $key, 'adresultsperpage', __( 'Default number of Ads per page', 'AWPCP' ), 'textfield', 10, ''); $pagination_options = array( 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 500 ); $this->add_setting( $key, 'pagination-options', __( 'Pagination Options', 'AWPCP' ), 'choice', $pagination_options, '', array( 'choices' => array_combine( $pagination_options, $pagination_options ) ) ); $this->add_setting( $key, 'buildsearchdropdownlists', __( 'Limits search to available locations.', 'AWPCP' ), 'checkbox', 0, __( 'The search form can attempt to build drop down country, state, city and county lists if data is available in the system. Note that with the regions module installed the value for this option is overridden.', 'AWPCP' ) ); $this->add_setting( $key, 'showadcount', __( 'Show Ad count in categories', 'AWPCP' ), 'checkbox', 1, __( 'Show how many ads a category contains.', 'AWPCP' ) ); $this->add_setting( $key, 'hide-empty-categories', __( 'Hide empty categories?', 'AWPCP' ), 'checkbox', 0, __( "If checked, categories with 0 listings in it won't be shown.", 'AWPCP' ) ); $this->add_setting( $key, 'displayadviews', __( 'Show Ad views', 'AWPCP' ), 'checkbox', 1, __( 'Show the number of times the ad has been viewed (simple count made by AWPCP &endash; warning, may not be accurate!)', 'AWPCP' ) ); $this->add_setting( $key, 'hyperlinkurlsinadtext', __( 'Make URLs in ad text clickable', 'AWPCP' ), 'checkbox', 0, '' ); $this->add_setting( $key, 'visitwebsitelinknofollow', __( 'Add no follow to links in Ads', 'AWPCP' ), 'checkbox', 1, '' ); // Section: Ad/Listings - Menu Items $key = $this->add_section( $group, __( 'Menu Items', 'AWPCP' ), 'menu-items', 60, array( $this, 'section' ) ); $this->add_setting( $key, 'show-menu-item-place-ad', __( 'Show Place Ad menu item', 'AWPCP' ), 'checkbox', 1, '' ); $this->add_setting( $key, 'show-menu-item-edit-ad', __( 'Show Edit Ad menu item', 'AWPCP' ), 'checkbox', 1, '' ); $this->add_setting( $key, 'show-menu-item-browse-ads', __( 'Show Browse Ads menu item', 'AWPCP' ), 'checkbox', 1, '' ); $this->add_setting( $key, 'show-menu-item-search-ads', __( 'Show Search Ads menu item', 'AWPCP' ), 'checkbox', 1, '' ); // Group: Payment Settings $group = $this->add_group( __( 'Payment', 'AWPCP') , 'payment-settings', 40 ); // Section: Payment Settings - PayPal $key = $this->add_section( $group, __( 'PayPal Settings', 'AWPCP' ), 'paypal', 20, array( $this, 'section' ) ); $this->add_setting($key, 'activatepaypal', __( 'Activate PayPal?', 'AWPCP' ), 'checkbox', 1, __( 'Activate PayPal?', 'AWPCP' ) ); $this->add_setting( $key, 'paypalemail', __( 'PayPal receiver email', 'AWPCP' ), 'textfield', '', __( 'Email address for PayPal payments (if running in pay mode and if PayPal is activated).', 'AWPCP' ) ); $this->add_validation_rule( $key, 'paypalemail', 'required', array( 'depends' => 'activatepaypal' ) ); $this->add_validation_rule( $key, 'paypalemail', 'email', true, __( 'Please enter a valid email address.', 'AWPCP' ) ); $this->add_behavior( $key, 'paypalemail', 'enabledIf', 'activatepaypal' ); $this->add_setting( $key, 'paypalcurrencycode', __( 'PayPal currency code', 'AWPCP' ), 'textfield', 'USD', __( 'The currency in which you would like to receive your PayPal payments', 'AWPCP' ) ); $supported_currencies = awpcp_paypal_supported_currencies(); $message = __( 'The PayPal Currency Code must be one of .', 'AWPCP' ); $message = str_replace( '', implode( ', ', $supported_currencies ), $message ); $this->add_validation_rule( $key, 'paypalcurrencycode', 'required', array( 'depends' => 'activatepaypal' ) ); $this->add_validation_rule( $key, 'paypalcurrencycode', 'oneof', array( 'param' => $supported_currencies ), $message ); $this->add_behavior( $key, 'paypalcurrencycode', 'enabledIf', 'activatepaypal' ); // Section: Payment Settings - 2Checkout $key = $this->add_section($group, __('2Checkout Settings', 'AWPCP'), '2checkout', 30, array($this, 'section')); $this->add_setting( $key, 'activate2checkout', __( 'Activate 2Checkout', 'AWPCP' ), 'checkbox', 1, __( 'Activate 2Checkout?', 'AWPCP' ) ); $this->add_setting( $key, '2checkout', __( '2Checkout account', 'AWPCP' ), 'textfield', '', __( 'Account for 2Checkout payments.', 'AWPCP' ) ); $this->add_validation_rule( $key, '2checkout', 'required', array( 'depends' => 'activate2checkout' ) ); $this->add_behavior( $key, '2checkout', 'enabledIf', 'activate2checkout' ); $this->add_setting( $key, '2checkoutcurrencycode', __( '2Checkout Currency Code', 'AWPCP' ), 'textfield', 'USD', __( 'The currency in which you would like to receive your 2Checkout payments', 'AWPCP' ) ); $this->add_validation_rule( $key, '2checkoutcurrencycode', 'required', array( 'depends' => 'activate2checkout' ) ); $this->add_behavior( $key, '2checkoutcurrencycode', 'enabledIf', 'activate2checkout' ); // Group: AdSense $group = $this->add_group( __( 'AdSense', 'AWPCP' ), 'adsense-settings', 60 ); // Section: AdSense Settings $key = $this->add_section( $group, __( 'AdSense Settings', 'AWPCP' ), 'default', 10, array( $this, 'section' ) ); $options = array( 1 => __( 'Above Ad text.', 'AWPCP' ), 2 => __( 'Under Ad text.', 'AWPCP' ), 3 => __( 'Below Ad images.', 'AWPCP' ), ); $this->add_setting( $key, 'useadsense', __( 'Activate AdSense', 'AWPCP'), 'checkbox', 1, ''); $this->add_setting( $key, 'adsense', __( 'AdSense code', 'AWPCP' ), 'textarea', __( 'AdSense code', 'AWPCP' ), __( 'Your AdSense code (Best if 468x60 text or banner.)', 'AWPCP' ) ); $this->add_setting( $key, 'adsenseposition', __( 'Show AdSense at position', 'AWPCP' ), 'radio', 2, '', array( 'options' => $options ) ); // Group: Registration $group = $this->add_group( __( 'Registration', 'AWPCP' ), 'registration-settings', 80); // Group: Email $group = $this->add_group('Email', 'email-settings', 90); // Section: General Email Settings $key = $this->add_section($group, __('General Email Settings', 'AWPCP'), 'default', 20, array($this, 'section')); $this->add_setting( $key, 'admin-recipient-email', __( 'TO email address for outgoing emails', 'AWPCP' ), 'textfield', '', __( 'Emails are sent to your WordPress admin email. If you prefere to receive emails in a different address, please enter it here.', 'AWPCP' ) ); $this->add_setting( $key, 'awpcpadminemail', __( 'FROM email address for outgoing emails', 'AWPCP' ), 'textfield', '', __( 'Emails go out using your WordPress admin email. If you prefer to use a different email enter it here.', 'AWPCP' ) ); $this->add_setting( $key, 'usesenderemailinsteadofadmin', __( 'Use sender email for reply messages', 'AWPCP' ), 'checkbox', 0, __( 'Check this to use the name and email of the sender in the FROM field when someone replies to an ad. When unchecked the messages go out with the website name and WP admin email address in the from field. Some servers will not process outgoing emails that have an email address from gmail, yahoo, hotmail and other free email services in the FROM field. Some servers will also not process emails that have an email address that is different from the email address associated with your hosting account in the FROM field. If you are with such a webhost you need to leave this option unchecked and make sure your WordPress admin email address is tied to your hosting account.', 'AWPCP' ) ); $this->add_setting( $key, 'include-ad-access-key', __( 'Include Ad access key in email messages', 'AWPCP' ), 'checkbox', 1, __( "Include Ad access key in email notifications. You may want to uncheck this option if you are using the Ad Management panel, but is not necessary.", 'AWPCP' ) ); // Section: Ad Posted Message $key = $this->add_section($group, __('Ad Posted Message', 'AWPCP'), 'ad-posted-message', 10, array($this, 'section')); $this->add_setting( $key, 'listingaddedsubject', __( 'Subject for Ad posted notification email', 'AWPCP' ), 'textfield', __( 'Your Classified Ad listing has been submitted', 'AWPCP' ), __( 'Subject line for email sent out when someone posts an Ad', 'AWPCP' ) ); $this->add_setting( $key, 'listingaddedbody', __( 'Body for Ad posted notification email', 'AWPCP' ), 'textarea', __( 'Thank you for submitting your Classified Ad. The details of your ad are shown below.', 'AWPCP' ), __( 'Message body text for email sent out when someone posts an Ad', 'AWPCP' ) ); // Section: Reply to Ad Message $key = $this->add_section($group, __('Reply to Ad Message', 'AWPCP'), 'reply-to-ad-message', 10, array($this, 'section')); $this->add_setting( $key, 'contactformsubjectline', __( 'Subject for Reply to Ad email', 'AWPCP' ), 'textfield', __( 'Response to your AWPCP Demo Ad', 'AWPCP' ), __( 'Subject line for email sent out when someone replies to Ad', 'AWPCP' ) ); $this->add_setting( $key, 'contactformbodymessage', __( 'Body for Reply to Ad email', 'AWPCP' ), 'textarea', __( 'Someone has responded to your AWPCP Demo Ad', 'AWPCP' ), __( 'Message body text for email sent out when someone replies to Ad', 'AWPCP' ) ); $this->add_setting( $key, 'notify-admin-about-contact-message', __( 'Notify admin about contact message', 'AWPCP' ), 'checkbox', 1, __( 'An email will be sent to the administrator every time a visitor sends a message to one of the Ad posters through the Reply to Ad page.', 'AWPCP' ) ); // Section: Request Ad Message $key = $this->add_section($group, __('Resend Access Key Message', 'AWPCP'), 'request-ad-message', 10, array($this, 'section')); $this->add_setting( $key, 'resendakeyformsubjectline', __( 'Subject for Request Ad Access Key email', 'AWPCP' ), 'textfield', __( "The Classified Ad's ad access key you requested", 'AWPCP' ), __( 'Subject line for email sent out when someone requests their ad access key resent', 'AWPCP' ) ); $this->add_setting( $key, 'resendakeyformbodymessage', __( 'Body for Request Ad Access Key email', 'AWPCP' ), 'textarea', __( "You asked to have your Classified Ad's access key resent. Below are all the Ad access keys in the system that are tied to the email address you provided", 'AWPCP' ), __('Message body text for email sent out when someone requests their ad access key resent', 'AWPCP' ) ); // Section: Incomplete Payment Message $key = $this->add_section($group, __('Incomplete Payment Message', 'AWPCP'), 'incomplete-payment-message', 10, array($this, 'section')); $this->add_setting( $key, 'paymentabortedsubjectline', __( 'Subject for Incomplete Payment email', 'AWPCP' ), 'textfield', __( 'There was a problem processing your payment', 'AWPCP' ), __( 'Subject line for email sent out when the payment processing does not complete', 'AWPCP' ) ); $this->add_setting( $key, 'paymentabortedbodymessage', __( 'Body for Incomplete Payment email', 'AWPCP' ), 'textarea', __( 'There was a problem encountered during your attempt to submit payment. If funds were removed from the account you tried to use to make a payment please contact the website admin or the payment website customer service for assistance.', 'AWPCP' ), __( 'Message body text for email sent out when the payment processing does not complete', 'AWPCP' ) ); // Section: Renew Ad Message $key = $this->add_section($group, __('Renew Ad Message', 'AWPCP'), 'renew-ad-message', 10, array($this, 'section')); $this->add_setting( $key, 'renew-ad-email-subject', __( 'Subject for Renew Ad email', 'AWPCP' ), 'textfield', __( 'Your classifieds listing Ad will expire in %d days.', 'AWPCP' ), __( 'Subject line for email sent out when an Ad is about to expire.', 'AWPCP' ) ); $this->add_setting( $key, 'renew-ad-email-body', __( 'Body for Renew Ad email', 'AWPCP' ), 'textarea', __( 'This is an automated notification that your Classified Ad will expire in %d days.', 'AWPCP' ), __( 'Message body text for email sent out when an Ad is about to expire. Use %d as placeholder for the number of days before the Ad expires.', 'AWPCP' ) ); // Section: Ad Renewed Message $key = $this->add_section($group, __('Ad Renewed Message', 'AWPCP'), 'ad-renewed-message', 10, array($this, 'section')); $this->add_setting( $key, 'ad-renewed-email-subject', __( 'Subject for Ad Renewed email', 'AWPCP' ), 'textfield', __( 'Your classifieds listing "%s" has been successfully renewed.', 'AWPCP' ), __( 'Subject line for email sent out when an Ad is successfully renewed.', 'AWPCP' ) ); $this->add_setting( $key, 'ad-renewed-email-body', __( 'Body for Renew Ad email', 'AWPCP' ), 'textarea', __( 'Your classifieds listing Ad has been successfully renewed. More information below:', 'AWPCP' ), __( 'Message body text for email sent out when an Ad is successfully renewed. ', 'AWPCP' ) ); // Section: Ad Expired Message $key = $this->add_section($group, __('Ad Expired Message', 'AWPCP'), 'ad-expired-message', 10, array($this, 'section')); $this->add_setting( $key, 'adexpiredsubjectline', __( 'Subject for Ad Expired email', 'AWPCP' ), 'textfield', __( 'Your classifieds listing at %s has expired', 'AWPCP' ), __( 'Subject line for email sent out when an ad has auto-expired', 'AWPCP' ) ); $this->add_setting( $key, 'adexpiredbodymessage', __( 'Body for Ad Expired email', 'AWPCP' ), 'textarea', __( 'This is an automated notification that your Classified Ad has expired.', 'AWPCP' ), __( 'Message body text for email sent out when an ad has auto-expired', 'AWPCP' ) ); // Section: Advanced Email Configuration $key = $this->add_section( $group, __( 'Advanced Email Configuration', 'AWPCP' ), 'advanced', 30, array( $this, 'section' ) ); $this->add_setting( $key, 'usesmtp', __( 'Enable external SMTP server', 'AWPCP' ), 'checkbox', 0, __( 'Enabled external SMTP server (if emails not processing normally).', 'AWPCP' ) ); $this->add_setting( $key, 'smtphost', __( 'SMTP host', 'AWPCP' ), 'textfield', 'mail.example.com', __( 'SMTP host (if emails not processing normally).', 'AWPCP' ) ); $this->add_setting( $key, 'smtpport', __( 'SMTP port', 'AWPCP' ), 'textfield', '25', __( 'SMTP port (if emails not processing normally).', 'AWPCP' ) ); $this->add_setting( $key, 'smtpusername', __( 'SMTP username', 'AWPCP' ), 'textfield', 'smtp_username', __( 'SMTP username (if emails not processing normally).', 'AWPCP' ) ); $this->add_setting( $key, 'smtppassword', __( 'SMTP password', 'AWPCP' ), 'password', '', __( 'SMTP password (if emails not processing normally).', 'AWPCP' ) ); // Group: Facebook $group = $this->add_group('Facebook', 'facebook-settings', 100); $key = $this->add_section( $group, __( 'General Settings', 'AWPCP' ), 'general', 10, array( $this, 'section' ) ); $this->add_setting( $key, 'sends-listings-to-facebook-automatically', __( 'Send Ads to Facebook Automatically', 'AWPCP' ), 'checkbox', 1, __( 'If checked, Ads will be posted to Facebook shortly after they are posted, enabled or edited, whichever occurs first. Ads will be posted only once. Please note that disabled Ads cannot be posted to Facebook.', 'AWPCP' ) ); // save settings to database $this->skip = true; $this->save_settings(); $this->skip = false; } private function save_settings() { update_option( $this->setting_name, $this->options ); } /** * Hook actions and filters required by AWPCP Settings * to work. */ public function setup() { add_action('init', array($this, 'init'), 9999); add_action('admin_init', array($this, 'register')); // setup validate functions add_filter('awpcp_validate_settings_general-settings', array($this, 'validate_general_settings'), 10, 2); add_filter('awpcp_validate_settings_pages-settings', array($this, 'validate_classifieds_pages_settings'), 10, 2); add_filter('awpcp_validate_settings_payment-settings', array($this, 'validate_payment_settings'), 10, 2); add_filter('awpcp_validate_settings_registration-settings', array($this, 'validate_registration_settings'), 10, 2); add_filter('awpcp_validate_settings_smtp-settings', array($this, 'validate_smtp_settings'), 10, 2); } public function init() { do_action('awpcp_register_settings', $this); // save settings to database $this->skip = true; $this->save_settings(); $this->skip = false; $this->set_javascript_data(); } private function set_javascript_data() { $awpcp = awpcp(); $awpcp->js->set( 'decimal-separator', get_awpcp_option( 'decimal-separator' ) ); $awpcp->js->set( 'thousands-separator', get_awpcp_option( 'thousands-separator' ) ); $awpcp->js->set( 'date-format', awpcp_datepicker_format( get_awpcp_option( 'date-format') ) ); $awpcp->js->set( 'datetime-formats', array( 'american' => array( 'date' => 'm/d/Y', 'time' => 'h:i:s', 'format' => '