Beispiel #1
0
 /**
  * Build admin page
  *
  * @wp-hook plugins_loaded
  * @since   2012.12.21
  * @return  void
  */
 public function build_admin()
 {
     # Initiate the admin page
     $options_panel = new BF_Admin_Page_Class($this->config);
     $options_panel->OpenTabs_container('');
     # Define tabs listing
     $tabs_links = array('appearance' => __('Appearance', 'mtt'), 'admin_bar' => __('Admin Bar', 'mtt'), 'admin_menus' => __('Admin Menus'), 'dashboard' => __('Dashboard', 'mtt'), 'post_listing' => __('Post and Page Listing', 'mtt'), 'post_editing' => __('Post and Page Editing', 'mtt'), 'media' => __('Media', 'mtt'), 'widgets' => __('Widgets', 'mtt'), 'plugins' => __('Plugins', 'mtt'), 'user_profile' => __('Users and Profile', 'mtt'), 'shortcodes' => __('Shortcodes', 'mtt'), 'general' => __('General Settings', 'mtt'), 'login_logout' => __('Login', 'mtt'), 'maintenance' => __('Maintenance Mode', 'mtt'));
     # MS support
     if ($this->multisite) {
         $tabs_links['multisite'] = __('Multisite', 'mtt');
     }
     # Finish tabs listing
     $tabs_links['credits'] = __('Credits', 'mtt');
     $tabs_links['import_export'] = __('Import Export Reset', 'mtt');
     # Declare tabs listing
     $options_panel->TabsListing(array('links' => $tabs_links));
     # Include Admin Tabs
     $plugin_url = B5F_MTT_Init::get_instance()->plugin_url;
     foreach ($this->plugin_sections as $section) {
         require_once 'admin-tabs/' . $section . '.php';
     }
     # Special Admin Section
     require_once 'admin-tabs/credits.php';
     # Import Export Admin Tabs
     $options_panel->OpenTab('import_export');
     $options_panel->Title(__('Import Export Reset', 'mtt'));
     $options_panel->addImportExport();
     $options_panel->addParagraph("<hr><h3> Reset</h3>");
     $options_panel->addCheckboxList('mtt_reset_plugin', array('do_it' => 'Select this to reset all plugin data.'), array('name' => 'Reset all plugin data.', 'desc' => '', 'class' => 'no-toggle', 'std' => false));
     $options_panel->addCheckboxList('mtt_verbose_plugin', array('visible' => ''), array('name' => '', 'class' => 'mtt-hidden', 'desc' => '', 'std' => false));
     $options_panel->CloseTab();
     # End Admin Tabs Container
     $options_panel->CloseTab();
     # Create Admin Interface
     $this->options_class = $options_panel;
 }
function sw_optionsClass()
{
    // Fetch the Options Array - This is the sw_options filter hook
    global $sw_options;
    $sw_options = apply_filters('sw_options', $sw_options);
    // Initiate the Options Class with the config settings in the array
    $options_panel = new BF_Admin_Page_Class($sw_options['config']);
    // Open the Options Tabs Container
    $options_panel->OpenTabs_container('');
    // Execute the list of options tabs
    $options_panel->TabsListing($sw_options['tabs']);
    // Loop through the options tabs and build the options page
    foreach ($sw_options['options'] as $tabName => $tabOptions) {
        $options_panel->OpenTab($tabName);
        // Loop through and output the options for this tab
        foreach ($tabOptions as $key => $option) {
            // TITLE - Add a Title
            if ($option['type'] == 'title') {
                $options_panel->Title($option['content']);
            }
            // PARAGRAPH - Add a Paragraph of Information
            if ($option['type'] == 'paragraph') {
                $options_panel->addParagraph($option['content']);
            }
            // TEXTBOX - Add a Textbox option
            if ($option['type'] == 'textbox') {
                if (isset($option['default'])) {
                    $options_panel->addText($key, array('name' => $option['content'], 'std' => $option['default']));
                } else {
                    $options_panel->addText($key, array('name' => $option['content']));
                }
            }
            // CHECKBOX - Add a checkbox option
            if ($option['type'] == 'checkbox') {
                $options_panel->addCheckbox($key, array('name' => $option['content'], $key => $key, 'std' => $option['default']));
            }
            // SORTABLE - Add a sortable option
            if ($option['type'] == 'sortable') {
                $options_panel->addSortable($key, $option['content'], array('name' => $option['name']));
            }
            // SELECT - Add a select option
            if ($option['type'] == 'select') {
                $options_panel->addSelect($key, $option['content'], array('name' => $option['name'], 'std' => $option['default']));
            }
            // COLOROPTION - Add a color picker
            if ($option['type'] == 'colorselect') {
                $options_panel->addColor($key, array('name' => $option['name'], 'std' => $option['default']));
            }
        }
        // Close the tab and move on to the next one
        $options_panel->CloseTab();
    }
}
//text field
$options_panel->addText('text_baseurl_ngrok', array('name' => __('Ngrok URL ', 'apc'), 'std' => '', 'desc' => __('fill website base url with Ngrok. ie: http://22cbcbe4.ngrok.com/wordpress', 'apc')));
/*
//textarea field
$options_panel->addTextarea('textarea_field_id',array('name'=> __('My Textarea ','apc'), 'std'=> 'textarea', 'desc' => __('Simple textarea field description','apc')));
//checkbox field
$options_panel->addCheckbox('checkbox_field_id',array('name'=> __('My Checkbox ','apc'), 'std' => true, 'desc' => __('Simple checkbox field description','apc')));
//select field
$options_panel->addSelect('select_field_id',array('selectkey1'=>'Select Value1','selectkey2'=>'Select Value2'),array('name'=> __('My select ','apc'), 'std'=> array('selectkey2'), 'desc' => __('Simple select field description','apc')));
//radio field
$options_panel->addRadio('radio_field_id',array('radiokey1'=>'Radio Value1','radiokey2'=>'Radio Value2'),array('name'=> __('My Radio Filed','apc'), 'std'=> array('radiokey2'), 'desc' => __('Simple radio field description','apc')));
*/
/**
 * Close first tab
 */
$options_panel->CloseTab();
/**
 * Open admin page Second tab
 */
$options_panel->OpenTab('options_2');
/**
 * Add fields to your admin page 2nd tab
 * 
 * Fancy options:
 *  typography field
 *  image uploader
 *  Pluploader
 *  date picker
 *  time picker
 *  color picker
 */
Beispiel #4
0
<?php

require_once plugin_dir_path(__FILE__) . "/admin-page-class/admin-page-class.php";
$lssf_config = array('menu' => 'settings', 'page_title' => 'LS Social Feed', 'capability' => 'edit_themes', 'option_group' => 'ls_social_feed', 'id' => 'ls_social_feed', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false);
$lssf_options_panel = new BF_Admin_Page_Class($lssf_config);
$lssf_options_panel->OpenTabs_container('ls_social_feed');
$lssf_options_panel->TabsListing(array('links' => array('lssf_opt_fb' => __('Facebook', 'ls_social_feed'), 'lssf_opt_gplus' => __('Google+', 'ls_social_feed'), 'lssf_opt_templates' => __('Templates', 'ls_social_feed'), 'lssf_about' => __('About this plugin', 'ls_social_feed'), 'lssf_importexport' => __('Import/Export settings', 'ls_social_feed'))));
$lssf_options_panel->OpenTab('lssf_opt_fb');
$lssf_options_panel->Title(__("Facebook", "ls_social_feed"));
$lssf_options_panel->addParagraph(__("You need an active Facebook App to fetch Facebook feed.", "ls_social_feed"));
$lssf_options_panel->addText('fb_appid', array('name' => __('App ID', 'ls_social_feed'), 'std' => '', 'desc' => ''));
$lssf_options_panel->addText('fb_appsecret', array('name' => __('App Secret', 'ls_social_feed'), 'std' => '', 'desc' => ''));
$lssf_options_panel->CloseTab();
$lssf_options_panel->OpenTab('lssf_opt_gplus');
$lssf_options_panel->Title(__("Google+", "ls_social_feed"));
//$lssf_options_panel->addParagraph( __("", "ls_social_feed") );
$lssf_options_panel->addText('gplus_key', array('name' => __('Google+ API Key', 'ls_social_feed'), 'std' => '', 'desc' => ''));
$lssf_options_panel->CloseTab();
$lssf_def_template_path = plugin_dir_path(__FILE__) . '/tpl-default.html';
$lssf_def_template = @file_get_contents($lssf_def_template_path);
$lssf_options_panel->OpenTab('lssf_opt_templates');
$lssf_options_panel->Title(__("Templates", "ls_social_feed"));
$lssf_options_panel->addCode('main_template', array('name' => __('Global Template (HTML)', 'ls_social_feed'), 'syntax' => 'html', 'std' => $lssf_def_template, 'desc' => __('', 'ls_social_feed')));
$templates_help = '<h3>' . __("Template Variables", "ls_social_feed") . '</h3>';
$templates_help .= '<div><b>%%item_text%%</b> - ' . __("Feed item text", "ls_social_feed") . '</div>';
$templates_help .= '<div><b>%%item_url%%</b> - ' . __("Url to read more or url to source post", "ls_social_feed") . '</div>';
$templates_help .= '<div><b>%%att_type%%</b> - ' . __("Attachement - type", "ls_social_feed") . '</div>';
$templates_help .= '<div><b>%%att_image%%</b> - ' . __("Attachement - image url address", "ls_social_feed") . '</div>';
$templates_help .= '<div><b>%%meta_author%%</b> - ' . __("Item meta - author", "ls_social_feed") . '</div>';
$templates_help .= '<div><b>%%meta_avatar%%</b> - ' . __("Item meta - author avatar", "ls_social_feed") . '</div>';
$templates_help .= '<div><b>%%meta_date%%</b> - ' . __("Meta data - date posted", "ls_social_feed") . '</div>';