コード例 #1
0
 /**
  * Load the admin settings page
  * @since 1.1
  * @sa https://github.com/NateWr/simple-admin-pages
  */
 public function load_settings_panel()
 {
     require_once 'lib/simple-admin-pages/simple-admin-pages.php';
     // Insantiate the Simple Admin Library so that we can add a settings page
     $sap = sap_initialize_library(array('version' => '2.0.a.7', 'lib_url' => FDM_PLUGIN_URL . '/lib/simple-admin-pages/'));
     // Create a page for the options under the Settings (options) menu
     $sap->add_page('submenu', array('id' => 'food-and-drink-menu-settings', 'title' => __('Settings', FDM_TEXTDOMAIN), 'menu_title' => __('Settings', FDM_TEXTDOMAIN), 'description' => '', 'capability' => 'manage_options', 'parent_menu' => 'edit.php?post_type=fdm-menu'));
     // Create a section to choose a default style
     $sap->add_section('food-and-drink-menu-settings', array('id' => 'fdm-style-settings', 'title' => __('Style', FDM_TEXTDOMAIN), 'description' => __('Choose what style you would like to use for your menu.', FDM_TEXTDOMAIN)));
     global $fdm_controller;
     $options = array();
     foreach ($fdm_controller->styles as $style) {
         $options[$style->id] = $style->label;
     }
     $sap->add_setting('food-and-drink-menu-settings', 'fdm-style-settings', 'select', array('id' => 'fdm-style', 'title' => __('Style', FDM_TEXTDOMAIN), 'description' => __('Choose the styling for your menus.', FDM_TEXTDOMAIN), 'blank_option' => false, 'options' => $options));
     // Create a section to disable specific features
     $sap->add_section('food-and-drink-menu-settings', array('id' => 'fdm-enable-settings', 'title' => __('Disable Features', FDM_TEXTDOMAIN), 'description' => __('Choose what features of the menu items you wish to disable and hide from the admin interface.', FDM_TEXTDOMAIN)));
     $sap->add_setting('food-and-drink-menu-settings', 'fdm-enable-settings', 'toggle', array('id' => 'fdm-disable-price', 'title' => __('Price', FDM_TEXTDOMAIN), 'label' => __('Disable all pricing options for menu items.', FDM_TEXTDOMAIN)));
     // Create a section for advanced options
     $sap->add_section('food-and-drink-menu-settings', array('id' => 'fdm-advanced-settings', 'title' => __('Advanced Options', FDM_TEXTDOMAIN)));
     $sap->add_setting('food-and-drink-menu-settings', 'fdm-advanced-settings', 'text', array('id' => 'fdm-item-thumb-width', 'title' => __('Menu Item Photo Width', FDM_TEXTDOMAIN), 'description' => __('The width in pixels of menu item thumbnails automatically generated by WordPress. Leave this field empty to preserve the default (600).', FDM_TEXTDOMAIN)));
     $sap->add_setting('food-and-drink-menu-settings', 'fdm-advanced-settings', 'text', array('id' => 'fdm-item-thumb-height', 'title' => __('Menu Item Photo Height', FDM_TEXTDOMAIN), 'description' => __('The height in pixels of menu item thumbnails automatically generated by WordPress. Leave this field empty to preserve the default (600).', FDM_TEXTDOMAIN)));
     // Create filter so addons can modify the settings page or add new pages
     $sap = apply_filters('fdm_settings_page', $sap);
     // Backwards compatibility when the sap library went to version 2
     $sap->port_data(2);
     // Register all admin pages and settings with WordPress
     $sap->add_admin_menus();
 }
コード例 #2
0
 private function setup_settings_page()
 {
     $sap = sap_initialize_library(array('version' => '2.0', 'lib_url' => plugin_dir_path(dirname(__FILE__)) . '/lib/simple-admin-pages/'));
     $sap->add_page('options', array('id' => 'dude-img-hashfeed', 'title' => __('Image hashtag feed', 'dude-img-hashfeed'), 'menu_title' => __('Image hashtag feed', 'dude-img-hashfeed'), 'capability' => 'manage_options'));
     $sap->add_section('dude-img-hashfeed', array('id' => 'dude-img-hashfeed-settings', 'description' => __('Images are stored to transient in favor of caching and reducing page load time. Cache time is five minutes<br />and after that new images are fetched from Instagram when images are needed again.', 'dude-img-hashfeed') . '<br /><br />' . __('For now, this plugin supports only one hashtag.')));
     $sap->add_setting('dude-img-hashfeed', 'dude-img-hashfeed-settings', 'text', array('id' => 'hashtags', 'title' => __('Hashtag', 'dude-img-hashfeed'), 'description' => __('Type hashtag without hash at the beginning.', 'dude-img-hashfeed')));
     $sap->add_setting('dude-img-hashfeed', 'dude-img-hashfeed-settings', 'text', array('id' => 'last_fetch_insta', 'title' => __('Last fetch was made', 'dude-img-hashfeed')));
     $sap = apply_filters('dude_img_hashfeed_setup_settings_page', $sap);
     $sap->add_admin_menus();
 }
コード例 #3
0
 /**
  * Load the admin settings page
  * @since 0.0.1
  * @sa https://github.com/NateWr/simple-admin-pages
  * added cellphone and fax
  */
 public function load_settings_panel()
 {
     require_once BPFWP_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php';
     $sap = sap_initialize_library($args = array('version' => '2.0', 'lib_url' => BPFWP_PLUGIN_URL . '/lib/simple-admin-pages/'));
     $sap->add_page('menu', array('id' => 'bpfwp-settings', 'title' => __('Business Profile', 'business-profile'), 'menu_title' => __('Business Profile', 'business-profile'), 'capability' => 'manage_options', 'icon' => 'dashicons-businessman', 'position' => null));
     $sap->add_section('bpfwp-settings', array('id' => 'bpfwp-seo', 'title' => __('Search Engine Optimization', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-seo', 'select', array('id' => 'schema_type', 'title' => __('Schema Type', 'business-profile'), 'description' => __('Select the option that best describes your business to improve how search engines understand your website', 'business-profile') . ' <a href="http://schema.org/" target="_blank">Schema.org</a>', 'blank_option' => false, 'options' => array('Organization' => 'Organization', 'Corporation' => 'Corporation', 'EducationalOrganization' => 'Educational Organization', 'GovernmentOrganization' => 'Government Organization', 'LocalBusiness' => 'Local Business', 'AnimalShelter' => '- Animal Shelter', 'AutomotiveBusiness' => '- Automotive Business', 'ChildCare' => '- Child Care', 'DryCleaningOrLaundry' => '- Dry Cleaning or Laundry', 'EmergencyService' => '- Emergency Service', 'EmploymentAgency' => '- Employment Agency', 'EntertainmentBusiness' => '- Entertainment Business', 'FinancialService' => '- Financial Service', 'FoodEstablishment' => '- Food Establishment', 'GovernmentOffice' => '- Government Office', 'HealthAndBeautyBusiness' => '- Health and Beauty Business', 'HomeAndConstructionBusiness' => '- Home and Construction Business', 'InternetCafe' => '- Internet Cafe', 'Library' => '- Library', 'LodgingBusiness' => '- Lodging Business', 'MedicalOrganization' => '- Medical Organization', 'RadioStation' => '- Radio Station', 'RealEstateAgent' => '- Real Estate Agent', 'RecyclingCenter' => '- Recycling Center', 'SelfStorage' => '- Self Storage', 'SportsActivityLocation' => '- Sports Activity Location', 'Store' => '- Store', 'TouristInformationCenter' => '- Tourist Information Center', 'TravelAgency' => '- Travel Agency', 'NGO' => 'NGO', 'PerformingGroup' => 'PerformingGroup', 'SportsTeam' => 'SportsTeam')));
     $sap->add_section('bpfwp-settings', array('id' => 'bpfwp-contact', 'title' => __('Contact Information', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'text', array('id' => 'name', 'title' => __('Name', 'business-profile'), 'description' => __('Enter the name of your business if it is different than the website name.', 'business-profile'), 'placeholder' => $this->defaults['name']));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'address', array('id' => 'address', 'title' => __('Address', 'business-profile'), 'strings' => array('sep-action-links' => _x(' | ', 'separator between admin action links in address component', 'business-profile'), 'sep-lat-lon' => _x(', ', 'separates latitude and longitude', 'business-profile'), 'no-setting' => __('No map coordinates set.', 'business-profile'), 'retrieving' => __('Requesting new coordinates', 'business-profile'), 'select' => __('Select a match below', 'business-profile'), 'view' => __('View', 'business-profile'), 'retrieve' => __('Retrieve map coordinates', 'business-profile'), 'remove' => __('Remove map coordinates', 'business-profile'), 'try_again' => __('Try again?', 'business-profile'), 'result_error' => __('Error', 'business-profile'), 'result_invalid' => __('Invalid request. Be sure to fill out the address field before retrieving coordinates.', 'business-profile'), 'result_denied' => __('Request denied.', 'business-profile'), 'result_limit' => __('Request denied because you are over your request quota.', 'business-profile'), 'result_empty' => __('Nothing was found at that address', 'business-profile'))));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'text', array('id' => 'phone', 'title' => __('Phone', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'text', array('id' => 'cellphone', 'title' => __('Cellphone', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'text', array('id' => 'faxphone', 'title' => __('Fax', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'post', array('id' => 'contact-page', 'title' => __('Contact Page', 'business-profile'), 'description' => __('Select a page on your site where users can reach you, such as a contact form.', 'business-profile'), 'blank_option' => true, 'args' => array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => 'publish')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-contact', 'text', array('id' => 'contact-email', 'title' => __('Email Address (optional)', 'business-profile'), 'description' => __('Enter an email address only if you want to display this publicly. Showing your email address on your site may cause you to receive excessive spam.', 'business-profile')));
     $sap->add_section('bpfwp-settings', array('id' => 'bpfwp-schedule', 'title' => __('Schedule', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-schedule', 'scheduler', array('id' => 'opening-hours', 'title' => __('Opening Hours', 'business-profile'), 'description' => __('Define your weekly opening hours by adding scheduling rules.', 'business-profile'), 'weekdays' => array('monday' => _x('Mo', 'Monday abbreviation', 'business-profile'), 'tuesday' => _x('Tu', 'Tuesday abbreviation', 'business-profile'), 'wednesday' => _x('We', 'Wednesday abbreviation', 'business-profile'), 'thursday' => _x('Th', 'Thursday abbreviation', 'business-profile'), 'friday' => _x('Fr', 'Friday abbreviation', 'business-profile'), 'saturday' => _x('Sa', 'Saturday abbreviation', 'business-profile'), 'sunday' => _x('Su', 'Sunday abbreviation', 'business-profile')), 'time_format' => _x('h:i A', 'Time format displayed in the opening hours setting panel in your admin area. Must match formatting rules at http://amsul.ca/pickadate.js/time.htm#formats', 'business-profile'), 'date_format' => _x('mmmm d, yyyy', 'Date format displayed in the opening hours setting panel in your admin area. Must match formatting rules at http://amsul.ca/pickadate.js/date.htm#formatting-rules', 'business-profile'), 'disable_weeks' => true, 'disable_date' => true, 'strings' => array('add_rule' => __('Add another opening time', 'business-profile'), 'weekly' => _x('Weekly', 'Format of a scheduling rule', 'business-profile'), 'monthly' => _x('Monthly', 'Format of a scheduling rule', 'business-profile'), 'date' => _x('Date', 'Format of a scheduling rule', 'business-profile'), 'weekdays' => _x('Days of the week', 'Label for selecting days of the week in a scheduling rule', 'business-profile'), 'month_weeks' => _x('Weeks of the month', 'Label for selecting weeks of the month in a scheduling rule', 'business-profile'), 'date_label' => _x('Date', 'Label to select a date for a scheduling rule', 'business-profile'), 'time_label' => _x('Time', 'Label to select a time slot for a scheduling rule', 'business-profile'), 'allday' => _x('All day', 'Label to set a scheduling rule to last all day', 'business-profile'), 'start' => _x('Start', 'Label for the starting time of a scheduling rule', 'business-profile'), 'end' => _x('End', 'Label for the ending time of a scheduling rule', 'business-profile'), 'set_time_prompt' => _x('All day long. Want to %sset a time slot%s?', 'Prompt displayed when a scheduling rule is set without any time restrictions', 'business-profile'), 'toggle' => _x('Open and close this rule', 'Toggle a scheduling rule open and closed', 'business-profile'), 'delete' => _x('Delete rule', 'Delete a scheduling rule', 'business-profile'), 'delete_schedule' => __('Delete scheduling rule', 'business-profile'), 'never' => _x('Never', 'Brief default description of a scheduling rule when no weekdays or weeks are included in the rule', 'business-profile'), 'weekly_always' => _x('Every day', 'Brief default description of a scheduling rule when all the weekdays/weeks are included in the rule', 'business-profile'), 'monthly_weekdays' => _x('%s on the %s week of the month', 'Brief default description of a scheduling rule when some weekdays are included on only some weeks of the month. %s should be left alone and will be replaced by a comma-separated list of days and weeks in the following format: M, T, W on the first, second week of the month', 'business-profile'), 'monthly_weeks' => _x('%s week of the month', 'Brief default description of a scheduling rule when some weeks of the month are included but all or no weekdays are selected. %s should be left alone and will be replaced by a comma-separated list of weeks in the following format: First, second week of the month', 'business-profile'), 'all_day' => _x('All day', 'Brief default description of a scheduling rule when no times are set', 'business-profile'), 'before' => _x('Ends at', 'Brief default description of a scheduling rule when an end time is set but no start time. If the end time is 6pm, it will read: Ends at 6pm', 'business-profile'), 'after' => _x('Starts at', 'Brief default description of a scheduling rule when a start time is set but no end time. If the start time is 6pm, it will read: Starts at 6pm', 'business-profile'), 'separator' => _x('&mdash;', 'Separator between times of a scheduling rule', 'business-profile'))));
     $sap->add_section('bpfwp-settings', array('id' => 'bpfwp-display', 'title' => __('Display', 'business-profile')));
     $sap->add_setting('bpfwp-settings', 'bpfwp-display', 'html', array('id' => 'shortcode', 'title' => __('Shortcode', 'business-profile'), 'description' => '', 'html' => '<div><code>[contact-card]</code></div><p class="description">' . sprintf(__('Paste this shortcode into any page or post to display your contact details. Learn about %sall of the attributes%s in the documentation.', 'business-profile'), '<a href="' . BPFWP_PLUGIN_URL . DIRECTORY_SEPARATOR . 'docs#shortcode">', '</a>') . ' </p>'));
     $sap = apply_filters('bpfwp_settings_page', $sap);
     $sap->add_admin_menus();
 }
コード例 #4
0
        /**
         * Load the admin settings page
         * @since 0.0.1
         * @sa https://github.com/NateWr/simple-admin-pages
         */
        public function load_settings_panel()
        {
            require_once RTB_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php';
            $sap = sap_initialize_library($args = array('version' => '2.0.a.8', 'lib_url' => RTB_PLUGIN_URL . '/lib/simple-admin-pages/'));
            $sap->add_page('submenu', array('id' => 'rtb-settings', 'title' => __('Settings', 'restaurant-reservations'), 'menu_title' => __('Settings', 'restaurant-reservations'), 'parent_menu' => 'rtb-bookings', 'description' => '', 'capability' => 'manage_options', 'default_tab' => 'rtb-general'));
            $sap->add_section('rtb-settings', array('id' => 'rtb-general', 'title' => __('General', 'restaurant-reservations'), 'is_tab' => true));
            $sap->add_setting('rtb-settings', 'rtb-general', 'post', array('id' => 'booking-page', 'title' => __('Booking Page', 'restaurant-reservations'), 'description' => __('Select a page on your site to automatically display the booking form and confirmation message.', 'restaurant-reservations'), 'blank_option' => true, 'args' => array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => 'publish')));
            $sap->add_setting('rtb-settings', 'rtb-general', 'select', array('id' => 'party-size', 'title' => __('Max Party Size', 'restaurant-reservations'), 'description' => __('Set a maximum allowed party size for bookings.', 'restaurant-reservations'), 'blank_option' => false, 'options' => $this->get_party_size_setting_options()));
            $sap->add_setting('rtb-settings', 'rtb-general', 'textarea', array('id' => 'success-message', 'title' => __('Success Message', 'restaurant-reservations'), 'description' => __('Enter the message to display when a booking request is made.', 'restaurant-reservations'), 'placeholder' => $this->defaults['success-message']));
            $sap->add_setting('rtb-settings', 'rtb-general', 'text', array('id' => 'date-format', 'title' => __('Date Format', 'restaurant-reservations'), 'description' => sprintf(__('Define how the date is formatted on the booking form. %sFormatting rules%s. This only changes the format on the booking form. To change the date format in notification messages, modify your general %sWordPress Settings%s.', 'restaurant-reservations'), '<a href="http://amsul.ca/pickadate.js/date.htm#formatting-rules">', '</a>', '<a href="' . admin_url('options-general.php') . '">', '</a>'), 'placeholder' => $this->defaults['date-format']));
            $sap->add_setting('rtb-settings', 'rtb-general', 'text', array('id' => 'time-format', 'title' => __('Time Format', 'restaurant-reservations'), 'description' => sprintf(__('Define how the time is formatted on the booking form. %sFormatting rules%s. This only changes the format on the booking form. To change the time format in notification messages, modify your general %sWordPress Settings%s.', 'restaurant-reservations'), '<a href="http://amsul.ca/pickadate.js/time.htm#formatting-rules">', '</a>', '<a href="' . admin_url('options-general.php') . '">', '</a>'), 'placeholder' => $this->defaults['time-format']));
            // Add i8n setting for pickadate if the frontend assets are to be loaded
            if (RTB_LOAD_FRONTEND_ASSETS) {
                $sap->add_setting('rtb-settings', 'rtb-general', 'select', array('id' => 'i8n', 'title' => __('Language', 'restaurant-reservations'), 'description' => __('Select a language to use for the booking form datepicker if it is different than your WordPress language setting.', 'restaurant-reservations'), 'options' => $this->supported_i8n));
            }
            $sap->add_section('rtb-settings', array('id' => 'rtb-schedule', 'title' => __('Booking Schedule', 'restaurant-reservations'), 'is_tab' => true));
            // Translateable strings for scheduler components
            $scheduler_strings = array('add_rule' => __('Add new scheduling rule', 'restaurant-reservations'), 'weekly' => _x('Weekly', 'Format of a scheduling rule', 'restaurant-reservations'), 'monthly' => _x('Monthly', 'Format of a scheduling rule', 'restaurant-reservations'), 'date' => _x('Date', 'Format of a scheduling rule', 'restaurant-reservations'), 'weekdays' => _x('Days of the week', 'Label for selecting days of the week in a scheduling rule', 'restaurant-reservations'), 'month_weeks' => _x('Weeks of the month', 'Label for selecting weeks of the month in a scheduling rule', 'restaurant-reservations'), 'date_label' => _x('Date', 'Label to select a date for a scheduling rule', 'restaurant-reservations'), 'time_label' => _x('Time', 'Label to select a time slot for a scheduling rule', 'restaurant-reservations'), 'allday' => _x('All day', 'Label to set a scheduling rule to last all day', 'restaurant-reservations'), 'start' => _x('Start', 'Label for the starting time of a scheduling rule', 'restaurant-reservations'), 'end' => _x('End', 'Label for the ending time of a scheduling rule', 'restaurant-reservations'), 'set_time_prompt' => _x('All day long. Want to %sset a time slot%s?', 'Prompt displayed when a scheduling rule is set without any time restrictions', 'restaurant-reservations'), 'toggle' => _x('Open and close this rule', 'Toggle a scheduling rule open and closed', 'restaurant-reservations'), 'delete' => _x('Delete rule', 'Delete a scheduling rule', 'restaurant-reservations'), 'delete_schedule' => __('Delete scheduling rule', 'restaurant-reservations'), 'never' => _x('Never', 'Brief default description of a scheduling rule when no weekdays or weeks are included in the rule', 'restaurant-reservations'), 'weekly_always' => _x('Every day', 'Brief default description of a scheduling rule when all the weekdays/weeks are included in the rule', 'restaurant-reservations'), 'monthly_weekdays' => _x('%s on the %s week of the month', 'Brief default description of a scheduling rule when some weekdays are included on only some weeks of the month. %s should be left alone and will be replaced by a comma-separated list of days and weeks in the following format: M, T, W on the first, second week of the month', 'restaurant-reservations'), 'monthly_weeks' => _x('%s week of the month', 'Brief default description of a scheduling rule when some weeks of the month are included but all or no weekdays are selected. %s should be left alone and will be replaced by a comma-separated list of weeks in the following format: First, second week of the month', 'restaurant-reservations'), 'all_day' => _x('All day', 'Brief default description of a scheduling rule when no times are set', 'restaurant-reservations'), 'before' => _x('Ends at', 'Brief default description of a scheduling rule when an end time is set but no start time. If the end time is 6pm, it will read: Ends at 6pm', 'restaurant-reservations'), 'after' => _x('Starts at', 'Brief default description of a scheduling rule when a start time is set but no end time. If the start time is 6pm, it will read: Starts at 6pm', 'restaurant-reservations'), 'separator' => _x('&mdash;', 'Separator between times of a scheduling rule', 'restaurant-reservations'));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'scheduler', array('id' => 'schedule-open', 'title' => __('Schedule', 'restaurant-reservations'), 'description' => __('Define the weekly schedule during which you accept bookings.', 'restaurant-reservations'), 'weekdays' => array('monday' => _x('Mo', 'Monday abbreviation', 'restaurant-reservations'), 'tuesday' => _x('Tu', 'Tuesday abbreviation', 'restaurant-reservations'), 'wednesday' => _x('We', 'Wednesday abbreviation', 'restaurant-reservations'), 'thursday' => _x('Th', 'Thursday abbreviation', 'restaurant-reservations'), 'friday' => _x('Fr', 'Friday abbreviation', 'restaurant-reservations'), 'saturday' => _x('Sa', 'Saturday abbreviation', 'restaurant-reservations'), 'sunday' => _x('Su', 'Sunday abbreviation', 'restaurant-reservations')), 'time_format' => $this->get_setting('time-format'), 'date_format' => $this->get_setting('date-format'), 'disable_weeks' => true, 'disable_date' => true, 'strings' => $scheduler_strings));
            $scheduler_strings['all_day'] = _x('Closed all day', 'Brief default description of a scheduling exception when no times are set', 'restaurant-reservations');
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'scheduler', array('id' => 'schedule-closed', 'title' => __('Exceptions', 'restaurant-reservations'), 'description' => __("Define special opening hours for holidays, events or other needs. Leave the time empty if you're closed all day.", 'restaurant-reservations'), 'time_format' => $this->get_setting('time-format'), 'date_format' => $this->get_setting('date-format'), 'disable_weekdays' => true, 'disable_weeks' => true, 'strings' => $scheduler_strings));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'early-bookings', 'title' => __('Early Bookings', 'restaurant-reservations'), 'description' => __('Select how early customers can make their booking.', 'restaurant-reservations'), 'blank_option' => false, 'options' => array('' => __('Any time', 'restaurant-reservations'), '1' => __('Up to 1 day in advance', 'restaurant-reservations'), '7' => __('Up to 1 week in advance', 'restaurant-reservations'), '14' => __('Up to 2 weeks in advance', 'restaurant-reservations'), '30' => __('Up to 30 days in advance', 'restaurant-reservations'), '90' => __('Up to 90 days in advance', 'restaurant-reservations'))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'late-bookings', 'title' => __('Late Bookings', 'restaurant-reservations'), 'description' => __('Select how late customers can make their booking.', 'restaurant-reservations'), 'blank_option' => false, 'options' => array('' => __('Up to the last minute', 'restaurant-reservations'), '15' => __('At least 15 minutes in advance', 'restaurant-reservations'), '30' => __('At least 30 minutes in advance', 'restaurant-reservations'), '45' => __('At least 45 minutes in advance', 'restaurant-reservations'), '60' => __('At least 1 hour in advance', 'restaurant-reservations'), '240' => __('At least 4 hours in advance', 'restaurant-reservations'), '1440' => __('At least 1 day in advance', 'restaurant-reservations'))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'date-onload', 'title' => __('Date Pre-selection', 'restaurant-reservations'), 'description' => __('When the booking form is loaded, should it automatically attempt to select a valid date?', 'restaurant-reservations'), 'blank_option' => false, 'options' => array('' => __('Select today if valid', 'restaurant-reservations'), 'soonest' => __('Select today or next valid date', 'restaurant-reservations'), 'empty' => __('Leave empty', 'restaurant-reservations'))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'time-interval', 'title' => __('Time Interval', 'restaurant-reservations'), 'description' => __('Select the number of minutes between each available time.', 'restaurant-reservations'), 'blank_option' => false, 'options' => array('' => __('Every 30 minutes', 'restaurant-reservations'), '15' => __('Every 15 minutes', 'restaurant-reservations'), '10' => __('Every 10 minutes', 'restaurant-reservations'), '5' => __('Every 5 minutes', 'restaurant-reservations'))));
            $sap->add_section('rtb-settings', array('id' => 'rtb-notifications', 'title' => __('Notifications', 'restaurant-reservations'), 'is_tab' => true));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'text', array('id' => 'reply-to-name', 'title' => __('Reply-To Name', 'restaurant-reservations'), 'description' => __('The name which should appear in the Reply-To field of a user notification email', 'restaurant-reservations'), 'placeholder' => $this->defaults['reply-to-name']));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'text', array('id' => 'reply-to-address', 'title' => __('Reply-To Email Address', 'restaurant-reservations'), 'description' => __('The email address which should appear in the Reply-To field of a user notification email.', 'restaurant-reservations'), 'placeholder' => $this->defaults['reply-to-address']));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'toggle', array('id' => 'admin-email-option', 'title' => __('Admin Notification', 'restaurant-reservations'), 'label' => __('Send an email notification to an administrator when a new booking is requested.', 'restaurant-reservations')));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'text', array('id' => 'admin-email-address', 'title' => __('Admin Email Address', 'restaurant-reservations'), 'description' => __('The email address where admin notifications should be sent.', 'restaurant-reservations'), 'placeholder' => $this->defaults['admin-email-address']));
            $sap->add_section('rtb-settings', array('id' => 'rtb-notifications-templates', 'title' => __('Email Templates', 'restaurant-reservations'), 'tab' => 'rtb-notifications', 'description' => __('Adjust the messages that are emailed to users and admins during the booking process.', 'restaurant-reservations')));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'html', array('id' => 'template-tags-description', 'title' => __('Template Tags', 'restaurant-reservations'), 'html' => '
					<p class="description">' . __('Use the following tags to automatically add booking information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.', 'restaurant-reservations') . '</p>' . $this->render_template_tag_descriptions()));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-booking-admin', 'title' => __('Admin Notification Subject', 'restaurant-reservations'), 'description' => __('The email subject for admin notifications.', 'restaurant-reservations'), 'placeholder' => $this->defaults['subject-booking-admin']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-booking-admin', 'title' => __('Admin Notification Email', 'restaurant-reservations'), 'description' => __('Enter the email an admin should receive when an initial booking request is made.', 'restaurant-reservations'), 'default' => $this->defaults['template-booking-admin']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-booking-user', 'title' => __('New Request Email Subject', 'restaurant-reservations'), 'description' => __('The email subject a user should receive when they make an initial booking request.', 'restaurant-reservations'), 'placeholder' => $this->defaults['subject-booking-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-booking-user', 'title' => __('New Request Email', 'restaurant-reservations'), 'description' => __('Enter the email a user should receive when they make an initial booking request.', 'restaurant-reservations'), 'default' => $this->defaults['template-booking-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-confirmed-user', 'title' => __('Confirmed Email Subject', 'restaurant-reservations'), 'description' => __('The email subject a user should receive when their booking has been confirmed.', 'restaurant-reservations'), 'placeholder' => $this->defaults['subject-confirmed-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-confirmed-user', 'title' => __('Confirmed Email', 'restaurant-reservations'), 'description' => __('Enter the email a user should receive when their booking has been confirmed.', 'restaurant-reservations'), 'default' => $this->defaults['template-confirmed-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-rejected-user', 'title' => __('Rejected Email Subject', 'restaurant-reservations'), 'description' => __('The email subject a user should receive when their booking has been rejected.', 'restaurant-reservations'), 'placeholder' => $this->defaults['subject-rejected-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-rejected-user', 'title' => __('Rejected Email', 'restaurant-reservations'), 'description' => __('Enter the email a user should receive when their booking has been rejected.', 'restaurant-reservations'), 'default' => $this->defaults['template-rejected-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-admin-notice', 'title' => __('Admin Update Subject', 'restaurant-reservations'), 'description' => sprintf(__('The email subject a user should receive when an admin sends them a custom email message from the %sbookings panel%s.', 'restaurant-reservations'), '<a href="' . admin_url('?page=rtb-bookings') . '">', '</a>'), 'placeholder' => $this->defaults['subject-admin-notice']));
            $sap = apply_filters('rtb_settings_page', $sap);
            $sap->add_admin_menus();
        }
コード例 #5
0
        /**
         * Load the admin settings page
         * @since 0.0.1
         * @sa https://github.com/NateWr/simple-admin-pages
         */
        public function load_settings_panel()
        {
            require_once RTB_PLUGIN_DIR . '/lib/simple-admin-pages/simple-admin-pages.php';
            $sap = sap_initialize_library($args = array('version' => '2.0.a.7', 'lib_url' => RTB_PLUGIN_URL . '/lib/simple-admin-pages/'));
            $sap->add_page('submenu', array('id' => 'rtb-settings', 'title' => __('Settings', RTB_TEXTDOMAIN), 'menu_title' => __('Settings', RTB_TEXTDOMAIN), 'parent_menu' => 'rtb-bookings', 'description' => '', 'capability' => 'manage_options', 'default_tab' => 'rtb-general'));
            $sap->add_section('rtb-settings', array('id' => 'rtb-general', 'title' => __('General', RTB_TEXTDOMAIN), 'is_tab' => true));
            $sap->add_setting('rtb-settings', 'rtb-general', 'post', array('id' => 'booking-page', 'title' => __('Booking Page', RTB_TEXTDOMAIN), 'description' => __('Select a page on your site to automatically display the booking form and confirmation message.', RTB_TEXTDOMAIN), 'blank_option' => true, 'args' => array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => 'publish')));
            $sap->add_setting('rtb-settings', 'rtb-general', 'text', array('id' => 'party-size', 'title' => __('Max Party Size', RTB_TEXTDOMAIN), 'description' => __('Set a maximum allowed party size for bookings. Leave it empty to allow parties of any size.', RTB_TEXTDOMAIN), 'placeholder' => __('No limit', RTB_TEXTDOMAIN)));
            $sap->add_setting('rtb-settings', 'rtb-general', 'textarea', array('id' => 'success-message', 'title' => __('Success Message', RTB_TEXTDOMAIN), 'description' => __('Enter the message to display when a booking request is made.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['success-message']));
            $sap->add_setting('rtb-settings', 'rtb-general', 'text', array('id' => 'date-format', 'title' => __('Date Format', RTB_TEXTDOMAIN), 'description' => __('Define how the date should appear after it has been selected. <a href="http://amsul.ca/pickadate.js/date.htm#formatting-rules">Formatting rules</a>', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['date-format']));
            $sap->add_setting('rtb-settings', 'rtb-general', 'text', array('id' => 'time-format', 'title' => __('Time Format', RTB_TEXTDOMAIN), 'description' => __('Define how the time should appear after it has been selected. <a href="http://amsul.ca/pickadate.js/time.htm#formatting-rules">Formatting rules</a>', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['time-format']));
            // Add i8n setting for pickadate if the frontend assets are to be loaded
            if (RTB_LOAD_FRONTEND_ASSETS) {
                $sap->add_setting('rtb-settings', 'rtb-general', 'select', array('id' => 'i8n', 'title' => __('Language', RTB_TEXTDOMAIN), 'description' => __('Select a language to use for the booking form datepicker if it is different than your WordPress language setting.', RTB_TEXTDOMAIN), 'options' => $this->supported_i8n));
            }
            $sap->add_section('rtb-settings', array('id' => 'rtb-schedule', 'title' => __('Booking Schedule', RTB_TEXTDOMAIN), 'is_tab' => true));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'scheduler', array('id' => 'schedule-open', 'title' => __('Schedule', RTB_TEXTDOMAIN), 'description' => __('Define the weekly schedule during which you accept bookings.', RTB_TEXTDOMAIN), 'weekdays' => array('monday' => _x('Mo', 'Monday abbreviation', RTB_TEXTDOMAIN), 'tuesday' => _x('Tu', 'Tuesday abbreviation', RTB_TEXTDOMAIN), 'wednesday' => _x('We', 'Wednesday abbreviation', RTB_TEXTDOMAIN), 'thursday' => _x('Th', 'Thursday abbreviation', RTB_TEXTDOMAIN), 'friday' => _x('Fr', 'Friday abbreviation', RTB_TEXTDOMAIN), 'saturday' => _x('Sa', 'Saturday abbreviation', RTB_TEXTDOMAIN), 'sunday' => _x('Su', 'Sunday abbreviation', RTB_TEXTDOMAIN)), 'time_format' => $this->get_setting('time-format'), 'date_format' => $this->get_setting('date-format'), 'disable_weeks' => true, 'disable_date' => true));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'scheduler', array('id' => 'schedule-closed', 'title' => __('Exceptions', RTB_TEXTDOMAIN), 'description' => __("Define special opening hours for holidays, events or other needs. Leave the time empty if you're closed all day.", RTB_TEXTDOMAIN), 'time_format' => $this->get_setting('time-format'), 'date_format' => $this->get_setting('date-format'), 'disable_weekdays' => true, 'disable_weeks' => true, 'instance_schedule_summaries' => array('all_day' => _x('Closed all day', 'Brief description of a scheduling exception when no times are set', SAP_TEXTDOMAIN))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'early-bookings', 'title' => __('Early Bookings', RTB_TEXTDOMAIN), 'description' => __('Select how early customers can make their booking.', RTB_TEXTDOMAIN), 'blank_option' => false, 'options' => array('' => __('Any time', RTB_TEXTDOMAIN), '1' => __('Up to 1 day in advance', RTB_TEXTDOMAIN), '7' => __('Up to 1 week in advance', RTB_TEXTDOMAIN), '14' => __('Up to 2 weeks in advance', RTB_TEXTDOMAIN), '30' => __('Up to 30 days in advance', RTB_TEXTDOMAIN), '90' => __('Up to 90 days in advance', RTB_TEXTDOMAIN))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'late-bookings', 'title' => __('Late Bookings', RTB_TEXTDOMAIN), 'description' => __('Select how late customers can make their booking.', RTB_TEXTDOMAIN), 'blank_option' => false, 'options' => array('' => __('Up to the last minute', RTB_TEXTDOMAIN), '15' => __('At least 15 minutes in advance', RTB_TEXTDOMAIN), '30' => __('At least 30 minutes in advance', RTB_TEXTDOMAIN), '45' => __('At least 45 minutes in advance', RTB_TEXTDOMAIN), '60' => __('At least 1 hour in advance', RTB_TEXTDOMAIN), '240' => __('At least 4 hours in advance', RTB_TEXTDOMAIN), '1440' => __('At least 1 day in advance', RTB_TEXTDOMAIN))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'date-onload', 'title' => __('Date Pre-selection', RTB_TEXTDOMAIN), 'description' => __('When the booking form is loaded, should it automatically attempt to select a valid date?', RTB_TEXTDOMAIN), 'blank_option' => false, 'options' => array('' => __('Select today if valid', RTB_TEXTDOMAIN), 'soonest' => __('Select today or next valid date', RTB_TEXTDOMAIN), 'empty' => __('Leave empty', RTB_TEXTDOMAIN))));
            $sap->add_setting('rtb-settings', 'rtb-schedule', 'select', array('id' => 'time-interval', 'title' => __('Time Interval', RTB_TEXTDOMAIN), 'description' => __('Select the number of minutes between each available time.', RTB_TEXTDOMAIN), 'blank_option' => false, 'options' => array('' => __('Every 30 minutes', RTB_TEXTDOMAIN), '15' => __('Every 15 minutes', RTB_TEXTDOMAIN), '10' => __('Every 10 minutes', RTB_TEXTDOMAIN), '5' => __('Every 5 minutes', RTB_TEXTDOMAIN))));
            $sap->add_section('rtb-settings', array('id' => 'rtb-notifications', 'title' => __('Notifications', RTB_TEXTDOMAIN), 'is_tab' => true));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'text', array('id' => 'reply-to-name', 'title' => __('Reply-To Name', RTB_TEXTDOMAIN), 'description' => __('The name which should appear in the Reply-To field of a notification email', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['reply-to-name']));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'text', array('id' => 'reply-to-address', 'title' => __('Reply-To Email Address', RTB_TEXTDOMAIN), 'description' => __('The email address which should appear in the Reply-To field of a notification email.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['reply-to-address']));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'toggle', array('id' => 'admin-email-option', 'title' => __('Admin Notification', RTB_TEXTDOMAIN), 'label' => __('Send an email notification to an administrator when a new booking is requested.', RTB_TEXTDOMAIN)));
            $sap->add_setting('rtb-settings', 'rtb-notifications', 'text', array('id' => 'admin-email-address', 'title' => __('Admin Email Address', RTB_TEXTDOMAIN), 'description' => __('The email address where admin notifications should be sent.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['admin-email-address']));
            $sap->add_section('rtb-settings', array('id' => 'rtb-notifications-templates', 'title' => __('Email Templates', RTB_TEXTDOMAIN), 'tab' => 'rtb-notifications', 'description' => 'Adjust the messages that are emailed to users and admins during the booking process.'));
            // @todo this should be generated automatically from an array of tags/descriptions somewhere, so that addons
            //	can easily add/edit without conflicting with each other.
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'html', array('id' => 'template-tags-description', 'title' => __('Template Tags', RTB_TEXTDOMAIN), 'html' => '
					<p class="description">' . __('Use the following tags to automatically add booking information to the emails.', RTB_TEXTDOMAIN) . '</p>
					<div class="rtb-template-tags-box">
						<strong>{user_name}</strong> ' . __('Name of the user who made the booking', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{party}</strong> ' . __('Number of people booked', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{date}</strong> ' . __('Date and time of the booking', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{phone}</strong> ' . __('Phone number if supplied with the request', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{message}</strong> ' . __('Message added to the request', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{bookings_link}</strong> ' . __('A link to the admin panel showing pending bookings', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{confirm_link}</strong> ' . __('A link to confirm this booking. Only include this in admin notifications', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{close_link}</strong> ' . __('A link to reject this booking. Only include this in admin notifications', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{site_name}</strong> ' . __('The name of this website', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{site_link}</strong> ' . __('A link to this website', RTB_TEXTDOMAIN) . '
					</div>
					<div class="rtb-template-tags-box">
						<strong>{current_time}</strong> ' . __('Current date and time', RTB_TEXTDOMAIN) . '
					</div>'));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-booking-admin', 'title' => __('Admin Notification Subject', RTB_TEXTDOMAIN), 'description' => __('The email subject for admin notifications.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['subject-booking-admin']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-booking-admin', 'title' => __('Admin Notification Email', RTB_TEXTDOMAIN), 'description' => __('Enter the email an admin should receive when an initial booking request is made.', RTB_TEXTDOMAIN), 'default' => $this->defaults['template-booking-admin']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-booking-user', 'title' => __('New Request Email Subject', RTB_TEXTDOMAIN), 'description' => __('The email subject a user should receive when they make an initial booking request.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['subject-booking-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-booking-user', 'title' => __('New Request Email', RTB_TEXTDOMAIN), 'description' => __('Enter the email a user should receive when they make an initial booking request.', RTB_TEXTDOMAIN), 'default' => $this->defaults['template-booking-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-confirmed-user', 'title' => __('Confirmed Email Subject', RTB_TEXTDOMAIN), 'description' => __('The email subject a user should receive when their booking has been confirmed.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['subject-confirmed-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-confirmed-user', 'title' => __('Confirmed Email', RTB_TEXTDOMAIN), 'description' => __('Enter the email a user should receive when their booking has been confirmed.', RTB_TEXTDOMAIN), 'default' => $this->defaults['template-confirmed-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'text', array('id' => 'subject-rejected-user', 'title' => __('Rejected Email Subject', RTB_TEXTDOMAIN), 'description' => __('The email subject a user should receive when their booking has been rejected.', RTB_TEXTDOMAIN), 'placeholder' => $this->defaults['subject-rejected-user']));
            $sap->add_setting('rtb-settings', 'rtb-notifications-templates', 'editor', array('id' => 'template-rejected-user', 'title' => __('Rejected Email', RTB_TEXTDOMAIN), 'description' => __('Enter the email a user should receive when their booking has been rejected.', RTB_TEXTDOMAIN), 'default' => $this->defaults['template-rejected-user']));
            $sap = apply_filters('rtb_settings_page', $sap);
            $sap->add_admin_menus();
        }
コード例 #6
0
ファイル: custommenu.php プロジェクト: madonion/p0limed
function polimed_toplevel_page()
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    echo '<div class="wrap">';
    echo '<p>Here is where the form would go if I actually had options.</p>';
    echo '</div>';
}
function polimed_mainslider_page()
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    echo '<div class="wrap">';
    echo '<p>Polimed mainslider.</p>';
    echo '</div>';
}
// Instantiate the Simple Admin Library
require_once 'simple-admin-pages/simple-admin-pages.php';
$sap = sap_initialize_library(array('version' => '2.0', 'lib_url' => '/lib/simple-admin-pages/'));
// Create a page for the options under the Settings (options) menu
$sap->add_page('options', array('id' => 'basic-settings', 'title' => __('Page Title', 'textdomain'), 'menu_title' => __('menu Title', 'textdomain'), 'description' => '', 'capability' => 'manage_options'));
// Create a basic details section
$sap->add_section('basic-settings', array('id' => 'basic-details', 'title' => __('Basic Details', 'textdomain'), 'description' => __('This section includes some basic details for you to configure.', 'textdomain')));
// Create the options fields
$sap->add_setting('basic-settings', 'basic-details', 'select', array('id' => 'select-field', 'title' => __('Select Field', 'textdomain'), 'description' => __('A demonstration of the select field type.', 'textdomain'), 'options' => array('one' => __('Option 1', 'textdomain'), 'two' => __('Option 2', 'textdomain'), 'three' => __('Option 3', 'textdomain'))));
// Allow third-party addons to hook into your settings page
$sap = apply_filters('sap_page_setup', $sap);
// Register all admin pages and settings with WordPress
$sap->add_admin_menus();