Exemplo n.º 1
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_login_control($number = 1)
 {
     // Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_login');
     if ($_POST["king_login_submit_{$number}"]) {
         //if defaults are choosen
         if (isset($_POST["king_login_defaults_{$number}"])) {
         } elseif (!empty($_POST["king_login_dump_{$number}"]) && isset($_POST["king_login_usedump_{$number}"])) {
             $newoptions[$number] = king_read_options($_POST["king_login_dump_{$number}"]);
         } else {
             // insert new form values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_login_title_{$number}"]));
             $newoptions[$number]['redirect_url'] = html_entity_decode($_POST["king_login_redirect_url_{$number}"]);
             $newoptions[$number]['postlink'] = isset($_POST["king_login_postlink_{$number}"]);
             $newoptions[$number]['logout'] = isset($_POST["king_login_logout_{$number}"]);
             $newoptions[$number]['postlink'] = isset($_POST["king_login_postlink_{$number}"]);
             $newoptions[$number]['myposts'] = isset($_POST["king_login_myposts_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_login_category_id_{$number}"];
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_login_show_on_site_area_{$number}"]);
             $newoptions[$number]['show_not_on_site_area'] = isset($_POST["king_login_show_not_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_login_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_login_site_area_id_{$number}"];
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_login_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_login_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_login_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_login_widget_title_{$number}"]);
         }
     }
     if ($options != $newoptions) {
         $options = $newoptions;
         update_option('widget_king_login', $options);
     }
     $title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
     $redirect_url = $options[$number]['redirect_url'];
     $postlink = !empty($options[$number]['postlink']) ? 'checked' : '';
     $logout = !empty($options[$number]['logout']) ? 'checked' : '';
     $myposts = !empty($options[$number]['myposts']) ? 'checked' : '';
     $show_category = !empty($options[$number]['show_category']) ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $show_on_site_area = !empty($options[$number]['show_on_site_area']) ? 'checked' : '';
     $show_not_on_site_area = !empty($options[$number]['show_not_on_site_area']) ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     echo king_get_tab_start('login' . $number, array(__('Basic', 'kingplugin'), __('Show', 'kingplugin'), __('HTML', 'kingplugin'), __('Export', 'kingplugin')));
     echo king_get_textbox_p(array('Label_Id_Name' => "king_login_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your Login Widget', 'widgetKing'), 'Value' => $title, 'Size' => '20', 'Max' => '50'));
     echo king_get_textbox_p(array('Label_Id_Name' => "king_login_redirect_url_{$number}", 'Description' => __('Login Redirect URL', 'widgetKing'), 'Label_Title' => __('The URL where the User will be redirected to after logged on. If empty the user will be redirected to the page he logged in from. You maybe want to set this to your Backoffice URL or any other special Page. Just copy the URL from your Browser in here.', 'widgetKing'), 'Value' => $redirect_url, 'Size' => '20', 'Max' => '50'));
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_login_postlink_{$number}", 'Description' => __('Show New Post Link', 'widgetKing'), 'Label_Title' => __('A link which brings you in the admin area to post a new article.', 'widgetKing'), 'Value' => $postlink));
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_login_myposts_{$number}", 'Description' => __('Show Link to My Articles', 'widgetKing'), 'Label_Title' => __('Shows a Link to a list with all your articles.', 'widgetKing'), 'Value' => $myposts));
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_login_logout_{$number}", 'Description' => __('Show Logout Link', 'widgetKing'), 'Label_Title' => __('A link which Logs You out. Only shown when logged in of course.', 'widgetKing'), 'Value' => $logout));
     echo king_get_tab_section('login' . $number . '-1');
     widget_king_where_to_show('login', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     echo king_get_tab_section('login' . $number . '-2');
     widget_king_htmloptions('login', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     echo king_get_tab_section('login' . $number . '-3');
     king_get_dump_options('login', $number, 'widget_king_login');
     echo king_get_hidden("king_login_submit_{$number}", '1', "king_login_submit_{$number}");
     echo king_get_tab_end();
 }
Exemplo n.º 2
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_calendar_control($number = 1)
 {
     # Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_calendar');
     if ($_POST["king_calendar_submit_{$number}"]) {
         #if defaults are choosen
         if (isset($_POST["king_calendar_defaults_{$number}"])) {
             $newoptions[$number]['title'] = "Calendar";
             /*
             $newoptions[$number]['before_widget']		= "<ul>";
             $newoptions[$number]['after_widget']		= addslashes("</li></ul>");
             $newoptions[$number]['before_widget_title'] = "<h2>";
             $newoptions[$number]['after_widget_title']	= addslashes("</h2><li>");
             */
         } else {
             # insert new form values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_calendar_title_{$number}"]));
             $newoptions[$number]['show_category'] = isset($_POST["king_calendar_showcategory_{$number}"]);
             $newoptions[$number]['use_events'] = isset($_POST["king_calendar_use_events_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_calendar_category_id_{$number}"];
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_calendar_show_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_calendar_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_calendar_site_area_id_{$number}"];
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_calendar_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_calendar_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_calendar_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_calendar_widget_title_{$number}"]);
         }
     }
     if ($options != $newoptions) {
         $options = $newoptions;
         update_option('widget_king_calendar', $options);
     }
     $title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
     $show_category = $options[$number]['show_category'] ? 'checked' : '';
     $use_events = $options[$number]['use_events'] ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $show_on_site_area = $options[$number]['show_on_site_area'] ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     # Here is the form segment. Notice that I have outsourced the form elements to be a little cleaner
     echo king_get_tab_start('calendar' . $number, array(__('Basic Features', 'widgetKing'), __('Show', 'widgetKing'), __('HTML', 'widgetKing')));
     # show title
     echo king_get_textbox_p(array('Label_Id_Name' => "king_calendar_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your Calendar', 'widgetKing'), 'Value' => $title, 'Size' => '20', 'Max' => '50'));
     #show use events instead of normal
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_calendar_use_events_{$number}", 'Description' => __('Use Events instead of normal Calendar', 'widgetKing'), 'Label_Title' => __('Check this box if you have the eventsCalendar Plugin installed. There can only be one Events Calendar on a Page. Dont forget to set your Events Calendar options', 'widgetKing'), 'Value' => $use_events));
     # devider
     echo king_get_tab_section('calendar' . $number . '-1');
     # show only in category
     widget_king_where_to_show('calendar', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     #devider
     echo king_get_tab_section('calendar' . $number . '-2');
     widget_king_htmloptions('calendar', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     echo king_get_hidden("king_calendar_submit_{$number}", '1', "king_calendar_submit_{$number}");
     echo king_get_tab_end();
 }
Exemplo n.º 3
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_links_control($number)
 {
     # Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_links');
     if ($_POST["king_links_submit_{$number}"]) {
         if (isset($_POST["king_links_defaults_{$number}"])) {
             #if defaults are choosen
             $newoptions[$number]['title'] = "Links {$number}";
             $newoptions[$number]['category'] = -1;
             $newoptions[$number]['before'] = '';
             $newoptions[$number]['after'] = '<br />';
             $newoptions[$number]['between'] = '<br />';
             $newoptions[$number]['show_images'] = 1;
             $newoptions[$number]['orderby'] = 'name';
             $newoptions[$number]['show_description'] = 1;
             $newoptions[$number]['show_rating'] = 0;
             $newoptions[$number]['limit'] = -1;
         } elseif (!empty($_POST["king_links_dump_{$number}"]) && isset($_POST["king_links_usedump_{$number}"])) {
             $newoptions[$number] = king_read_options($_POST["king_links_dump_{$number}"]);
         } elseif ($_POST["king_links_copy_{$number}"] !== 'No' && $_POST["king_links_copy_{$number}"] != $number) {
             # insert choosen values
             $copy = $_POST["king_links_copy_{$number}"];
             $newoptions[$number]['title'] = $options[$copy]['title'];
             $newoptions[$number]['category'] = $options[$copy]['category'];
             $newoptions[$number]['before'] = $options[$copy]['before'];
             $newoptions[$number]['after'] = $options[$copy]['after'];
             $newoptions[$number]['between'] = $options[$copy]['between'];
             $newoptions[$number]['show_images'] = $options[$copy]['show_images'];
             $newoptions[$number]['orderby'] = $options[$copy]['orderby'];
             $newoptions[$number]['show_description'] = $options[$copy]['show_description'];
             $newoptions[$number]['show_rating'] = $options[$copy]['show_rating'];
             $newoptions[$number]['limit'] = $options[$copy]['limit'];
             $newoptions[$number]['show_category'] = $options[$copy]['show_category'];
             $newoptions[$number]['category_id'] = $options[$copy]['category_id'];
             $newoptions[$number]['show_on_site_area'] = $options[$copy]['show_on_site_area'];
             $newoptions[$number]['site_area'] = $options[$copy]['site_area'];
             $newoptions[$number]['site_area_id'] = $options[$copy]['site_area_id'];
             $newoptions[$number]['debug'] = $options[$copy]['debug'];
             $newoptions[$number]['before_widget'] = $options[$copy]['before_widget'];
             $newoptions[$number]['after_widget'] = $options[$copy]['after_widget'];
             $newoptions[$number]['before_widget_title'] = $options[$copy]['before_widget_title'];
             $newoptions[$number]['after_widget_title'] = $options[$copy]['after_widget_title'];
             $newoptions[$number]['use_wpgetlinks'] = $options[$copy]['use_wpgetlinks'];
         } else {
             # insert choosen values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_links_title_{$number}"]));
             $newoptions[$number]['category'] = html_entity_decode($_POST["king_links_category_{$number}"]);
             $newoptions[$number]['before'] = html_entity_decode($_POST["king_links_before_{$number}"]);
             $newoptions[$number]['after'] = html_entity_decode($_POST["king_links_after_{$number}"]);
             $newoptions[$number]['between'] = html_entity_decode($_POST["king_links_between_{$number}"]);
             $newoptions[$number]['show_images'] = isset($_POST["king_links_show_images_{$number}"]);
             $newoptions[$number]['orderby'] = $_POST["king_links_orderby_{$number}"];
             $newoptions[$number]['show_description'] = isset($_POST["king_links_show_description_{$number}"]);
             $newoptions[$number]['show_rating'] = isset($_POST["king_links_show_rating_{$number}"]);
             $newoptions[$number]['limit'] = $_POST["king_links_limit_{$number}"];
             $newoptions[$number]['show_category'] = isset($_POST["king_links_showcategory_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_links_category_id_{$number}"];
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_links_show_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_links_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_links_site_area_id_{$number}"];
             $newoptions[$number]['debug'] = isset($_POST["king_links_debug_{$number}"]);
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_links_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_links_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_links_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_links_widget_title_{$number}"]);
             $newoptions[$number]['use_wpgetlinks'] = isset($_POST["king_links_use_wpgetlinks_{$number}"]);
         }
     }
     if ($options != $newoptions) {
         $options = $newoptions;
         update_option('widget_king_links', $options);
     }
     $title = wp_specialchars($options[$number]['title']);
     $category = $options[$number]['category'];
     $before = stripslashes(htmlentities($options[$number]['before']));
     $after = stripslashes(htmlentities($options[$number]['after']));
     $between = stripslashes(htmlentities($options[$number]['between']));
     $show_images = $options[$number]['show_images'] ? 'checked' : '';
     $orderby = $options[$number]['orderby'];
     $show_description = $options[$number]['show_description'] ? 'checked' : '';
     $show_rating = $options[$number]['show_rating'] ? 'checked' : '';
     $limit = $options[$number]['limit'];
     $show_category = $options[$number]['show_category'] ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $show_on_site_area = $options[$number]['show_on_site_area'] ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     $debug = $options[$number]['debug'] ? 'checked' : '';
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     $use_wpgetlinks = $options[$number]['use_wpgetlinks'] ? 'checked' : '';
     echo king_get_tab_start('links' . $number, array(__('Basic', 'widgetKing'), __('Advanced', 'widgetKing'), __('Show', 'widgetKing'), __('HTML', 'widgetKing'), __('Export', 'widgetKing')));
     # show title
     echo king_get_textbox_p(array('Label_Id_Name' => "king_links_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your category menu', 'widgetKing'), 'Value' => $title, 'Max' => '50'));
     #show category only ID
     echo king_get_textbox_p(array('Label_Id_Name' => "king_links_category_{$number}", 'Description' => __('Link Category ID', 'widgetKing'), 'Label_Title' => __('Show only Links belonging to this category.Defaults to -1 (show all links)', 'widgetKing'), 'Value' => $category, 'Max' => '5', 'Class' => 'small'));
     #Use wp_get_links
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_links_use_wpgetlinks_{$number}", 'Description' => __('Use Options from Linkmanager', 'widgetKing'), 'Label_Title' => __('When set you only need to provide the Link Category ID! It takes all the Links options from the Links Manager. Dont forget to set the widget HTML. Internally this uses the wp_get_links() Method', 'widgetKing'), 'Value' => $use_wpgetlinks));
     #Limit to show only xx Links
     echo king_get_textbox_p(array('Label_Id_Name' => "king_links_limit_{$number}", 'Description' => __('Limit Shown Links', 'widgetKing'), 'Label_Title' => __('Show only this Number of Links inside the box. -1 stands for show all. But you can also leave this field empty.', 'widgetKing'), 'Value' => $limit, 'Max' => '5', 'Class' => 'small'));
     #show Images
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_links_show_images_{$number}", 'Description' => __('Show Link Images', 'widgetKing'), 'Label_Title' => __('If there are Images associated with a Link, show them', 'widgetKing'), 'Value' => $show_images));
     #sort Column
     echo king_get_select_p(array('Label_Id_Name' => "king_links_orderby_{$number}", 'Description' => __('Sort by', 'widgetKing'), 'Label_Title' => __('The _ underscore means sorting in reverse order. owner->User who added link through Links Manager./ Rand-> Random / rel-> Link relationship (XFN) / length -> The length of the link name, shortest to longest.', 'widgetKing'), 'select_options' => array('id', 'name', 'url', 'target', 'category', 'description', 'owner', 'rating', 'updated', 'rel', 'notes', 'rss', 'length', 'rand', '_id', '_name', '_url', '_target', '_category', '_description', '_owner', '_rating', '_updated', '_rel', '_notes', '_rss', '_length'), 'Value' => $orderby));
     #Show the Link Descriptions
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_links_show_description_{$number}", 'Description' => __('Link Description', 'widgetKing'), 'Label_Title' => __('Show the Link Descriptions', 'widgetKing'), 'Value' => $show_description));
     #Show the Link Rating
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_links_show_rating_{$number}", 'Description' => __('Rating', 'widgetKing'), 'Label_Title' => __('Show the Link Rating', 'widgetKing'), 'Value' => $show_rating));
     # Devider
     echo king_get_tab_section('links' . $number . '-1');
     #before Link
     echo king_get_textbox_p(array('Label_Id_Name' => "king_links_before_{$number}", 'Description' => __('Before Link', 'widgetKing'), 'Label_Title' => __('HTML bevor a Link in the List', 'widgetKing'), 'Value' => $before));
     #after Link
     echo king_get_textbox_p(array('Label_Id_Name' => "king_links_after_{$number}", 'Description' => __('After Link', 'widgetKing'), 'Label_Title' => __('HTML after a Link in the List', 'widgetKing'), 'Value' => $after));
     #between Link
     echo king_get_textbox_p(array('Label_Id_Name' => "king_links_between_{$number}", 'Description' => __('Between Link', 'widgetKing'), 'Label_Title' => __('Text to place between each link/image and its description. Defaults to a space', 'widgetKing'), 'Value' => $between));
     #set to defaults
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_links_defaults_{$number}", 'Description' => __('Insert default Options', 'widgetKing'), 'Label_Title' => __('Set Menu Options to Wordpress Defaults', 'widgetKing')));
     #copy
     echo king_get_select_p(array('Label_Id_Name' => "king_links_copy_{$number}", 'Description' => __('Copy Settings from Widget No.', 'widgetKing'), 'Label_Title' => __('Choose a Widget Number from which you want to copy the settings into this one. Make sure to choose the right widget, with some Options in it!', 'widgetKing'), 'select_options' => array('No', '1', '2', '3', '4', '5', '6', '7', '8', '9')));
     #devider
     echo king_get_tab_section('links' . $number . '-2');
     # Where To Show Options Panel
     widget_king_where_to_show('links', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     #devider
     echo king_get_tab_section('links' . $number . '-3');
     widget_king_htmloptions('links', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     #show debug output
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_links_debug_{$number}", 'Description' => __('Show Debug Output', 'widgetKing'), 'Label_Title' => __('Shows all set options in Frontend to check what you have entered.', 'widgetKing'), 'Value' => $debug));
     echo king_get_tab_section('links' . $number . '-4');
     king_get_dump_options('links', $number, 'widget_king_links');
     echo king_get_hidden("king_links_submit_{$number}", '1', "king_links_submit_{$number}");
     echo king_get_tab_end();
 }
Exemplo n.º 4
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_search_control($number = 1)
 {
     # Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_search');
     if ($_POST["king_search_submit_{$number}"]) {
         #if defaults are choosen
         if (isset($_POST["king_search_defaults_{$number}"])) {
             /* no defaults at the moment
             			$newoptions[$number]['title']				= "search";
             			$newoptions[$number]['before_widget']		= "<ul>";
             			$newoptions[$number]['after_widget']		= addslashes("</li></ul>");
             			$newoptions[$number]['before_widget_title'] = "<h2>";
             			$newoptions[$number]['after_widget_title']	= addslashes("</h2><li>");
             			*/
         } else {
             # insert new form values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_search_title_{$number}"]));
             $newoptions[$number]['show_category'] = isset($_POST["king_search_showcategory_{$number}"]);
             $newoptions[$number]['use_suggestion'] = isset($_POST["king_search_use_suggestion_{$number}"]);
             $newoptions[$number]['use_catsearch'] = isset($_POST["king_search_use_catsearch_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_search_category_id_{$number}"];
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_search_show_on_site_area_{$number}"]);
             $newoptions[$number]['show_not_on_site_area'] = isset($_POST["king_search_show_not_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_search_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_search_site_area_id_{$number}"];
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_search_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_search_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_search_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_search_widget_title_{$number}"]);
         }
     }
     if ($options != $newoptions) {
         $options = $newoptions;
         update_option('widget_king_search', $options);
     }
     $title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
     $show_category = $options[$number]['show_category'] ? 'checked' : '';
     $use_suggestion = $options[$number]['use_suggestion'] ? 'checked' : '';
     $use_catsearch = $options[$number]['use_catsearch'] ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $show_on_site_area = $options[$number]['show_on_site_area'] ? 'checked' : '';
     $show_not_on_site_area = $options[$number]['show_not_on_site_area'] ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     echo king_get_tab_start('search' . $number, array(__('Basic Features', 'widgetKing'), __('Show', 'widgetKing'), __('HTML', 'widgetKing')));
     # title
     echo king_get_textbox_p(array('Label_Id_Name' => "king_search_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your search', 'widgetKing'), 'Value' => $title, 'Size' => '20', 'Max' => '50'));
     # use events instead of normal
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_search_use_suggestion_{$number}", 'Description' => __('Use Search Suggestion', 'widgetKing'), 'Label_Title' => __('Check this box for Search Word-Suggestions. Makes a spellcheck and looks up the right word.', 'widgetKing'), 'Value' => $use_suggestion));
     # show category search feature
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_search_use_catsearch_{$number}", 'Description' => __('Use Category Search', 'widgetKing'), 'Label_Title' => __('A dropdown containing all your categories. Searches only in the choosen Category.', 'widgetKing'), 'Value' => $use_catsearch));
     /*
     		#devider
     		echo king_get_tab_section('search'.$number.'-3');
     		# URL Format
     		echo king_get_textbox_p(array(
     				'Label_Id_Name' 	=>"king_search_urlformat_$number",
     
     				'Description' 	=> __('URL Format', 'widgetKing'),
     				'Label_Title' 	=> __('The URL Format for your Search results page. Default is: /?s=%s', 'widgetKing'),
     				'Value' 			=> $url_format,
     				'Size' 			=>'50',
     				'Max' 			=>'200'));
     		#before suggest
     		echo king_get_textbox_p(array(
     				'Label_Id_Name' 	=>"king_search_beforesuggest_$number",
     
     				'Description' 	=> __('Before Suggest', 'widgetKing'),
     				'Label_Title' 	=> __('The HTML and Text before the Suggested Words. Defaults can be seen in Frontend Sourcecode.', 'widgetKing'),
     				'Value' 			=> $before_suggest_text,
     				'Size' 			=>'50',
     				'Max' 			=>'200'));
     
     		echo king_get_textbox_p(array(
     				'Label_Id_Name' 	=>"king_search_aftersuggest_$number",
     
     				'Description' 	=> __('After Suggest', 'widgetKing'),
     				'Label_Title' 	=> __('The HTML after the Suggested Words. Defaults can be seen in Frontend Sourcecode.', 'widgetKing'),
     				'Value' 			=> $after_suggest_text,
     				'Size' 			=>'50',
     				'Max' 			=>'200'));
     		echo king_get_textbox_p(array(
     				'Label_Id_Name' 	=>"king_search_suggesterror_$number",
     
     				'Description' 	=> __('Suggest Error Text', 'widgetKing'),
     				'Label_Title' 	=> __('The HTML and Text before the Suggested Words. Defaults can be seen in Frontend Sourcecode.', 'widgetKing'),
     				'Value' 			=> $error_text,
     				'Size' 			=>'50',
     				'Max' 			=>'200'));
     */
     #devider
     echo king_get_tab_section('search' . $number . '-1');
     #Where To Show Options Panel
     widget_king_where_to_show('search', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     #devider
     echo king_get_tab_section('search' . $number . '-2');
     # HTML
     widget_king_htmloptions('search', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     echo king_get_hidden("king_search_submit_{$number}", '1', "king_search_submit_{$number}");
     echo king_get_tab_end();
 }
Exemplo n.º 5
0
    /**
     * @desc Output of plugin?s editform in te adminarea
     * @author Georg Leciejewski
     */
    function widget_king_rss_control($number)
    {
        # Get our options and see if we're handling a form submission.
        $options = $newoptions = get_option('widget_king_rss');
        if ($_POST["king_rss_submit_{$number}"]) {
            if (isset($_POST["king_rss_defaults_{$number}"])) {
                #if defaults are choosen
                if (!empty($_POST["king_rss_url_{$number}"])) {
                    $newoptions[$number]['rss_url'] = strip_tags(stripslashes($_POST["king_rss_url_{$number}"]));
                } else {
                    $newoptions[$number]['rss_url'] = "http://www.blog.mediaprojekte.de/feed/";
                }
                $newoptions[$number]['max_items'] = "10";
                $newoptions[$number]['shortdesc'] = "50";
                $newoptions[$number]['showdate'] = "j F Y";
                #php time format
                $newoptions[$number]['error'] = "Sorry can not grab the Feed!";
                $newoptions[$number]['titlehtml'] = '<h2><a class="rsswidget" href="%rssurl%" title="Syndicate this content"><img src="%rssicon%" alt="RSS" height="14" width="14"/></a>
<a class="rsswidget" href="%link%" title="%descr%">%title%</a></h2><ul>';
                $newoptions[$number]['rsshtml'] = '<li><strong>%date%</strong><br /><a class="rsswidget" href="%link%" title="%text%">%title%</a></li>';
                $newoptions[$number]['before_widget'] = '<li class="widget">';
                $newoptions[$number]['after_widget'] = "</ul></li>";
            } elseif ($_POST["king_rss_copy_{$number}"] !== 'No' && $_POST["king_rss_copy_{$number}"] != $number) {
                # do the copying
                $copy = $_POST["king_rss_copy_{$number}"];
                #$copyoption
                $newoptions[$number]['title'] = $options[$copy]['title'];
                $newoptions[$number]['rss_url'] = $options[$copy]['rss_url'];
                $newoptions[$number]['max_items'] = $options[$copy]['max_items'];
                $newoptions[$number]['cache_time'] = $options[$copy]['cache_time'];
                $newoptions[$number]['nosort'] = $options[$copy]['nosort'];
                $newoptions[$number]['shortdesc'] = $options[$copy]['shortdesc'];
                $newoptions[$number]['showdate'] = $options[$copy]['showdate'];
                $newoptions[$number]['error'] = $options[$copy]['error'];
                $newoptions[$number]['rsshtml'] = $options[$copy]['rsshtml'];
                $newoptions[$number]['titlehtml'] = $options[$copy]['titlehtml'];
                $newoptions[$number]['stripads'] = $options[$copy]['stripads'];
                $newoptions[$number]['show_category'] = $options[$copy]['show_category'];
                $newoptions[$number]['category_id'] = $options[$copy]['category_id'];
                $newoptions[$number]['show_on_site_area'] = $options[$copy]['show_on_site_area'];
                $newoptions[$number]['show_not_on_site_area'] = $options[$copy]['show_not_on_site_area'];
                $newoptions[$number]['site_area'] = $options[$copy]['site_area'];
                $newoptions[$number]['site_area_id'] = $options[$copy]['site_area_id'];
                $newoptions[$number]['before_widget'] = $options[$copy]['before_widget'];
                $newoptions[$number]['after_widget'] = $options[$copy]['after_widget'];
            } else {
                # insert new form values
                $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_rss_title_{$number}"]));
                $newoptions[$number]['rss_url'] = strip_tags(stripslashes($_POST["king_rss_url_{$number}"]));
                $newoptions[$number]['max_items'] = strip_tags(stripslashes($_POST["king_rss_max_items_{$number}"]));
                $newoptions[$number]['cache_time'] = strip_tags(stripslashes($_POST["king_rss_cache_time_{$number}"]));
                $newoptions[$number]['nosort'] = isset($_POST["king_rss_nosort_{$number}"]);
                $newoptions[$number]['shortdesc'] = $_POST["king_rss_shortdesc_{$number}"];
                $newoptions[$number]['showdate'] = $_POST["king_rss_showdate_{$number}"];
                #php time format
                $newoptions[$number]['error'] = strip_tags(stripslashes($_POST["king_rss_error_{$number}"]));
                $newoptions[$number]['rsshtml'] = stripslashes($_POST["king_rss_rsshtml_{$number}"]);
                $newoptions[$number]['titlehtml'] = stripslashes($_POST["king_rss_titlehtml_{$number}"]);
                $newoptions[$number]['stripads'] = isset($_POST["king_rss_stripads_{$number}"]);
                $newoptions[$number]['show_category'] = isset($_POST["king_rss_showcategory_{$number}"]);
                $newoptions[$number]['category_id'] = $_POST["king_rss_category_id_{$number}"];
                $newoptions[$number]['show_on_site_area'] = isset($_POST["king_rss_show_on_site_area_{$number}"]);
                $newoptions[$number]['show_not_on_site_area'] = isset($_POST["king_rss_show_not_on_site_area_{$number}"]);
                $newoptions[$number]['site_area'] = $_POST["king_rss_site_area_{$number}"];
                $newoptions[$number]['site_area_id'] = $_POST["king_rss_site_area_id_{$number}"];
                $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_rss_widget_{$number}"]);
                $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_rss_widget_{$number}"]);
            }
        }
        if ($options != $newoptions) {
            $options = $newoptions;
            update_option('widget_king_rss', $options);
        }
        $title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
        $rss_url = htmlspecialchars($options[$number]['rss_url'], ENT_QUOTES);
        $max_items = $options[$number]['max_items'];
        $cache_time = $options[$number]['cache_time'];
        $nosort = $options[$number]['nosort'] ? 'checked' : '';
        $shortdesc = $options[$number]['shortdesc'];
        $showdate = $options[$number]['showdate'];
        $error = htmlspecialchars($options[$number]['error'], ENT_QUOTES);
        $titlehtml = htmlspecialchars($options[$number]['titlehtml'], ENT_QUOTES);
        $rsshtml = htmlspecialchars($options[$number]['rsshtml'], ENT_QUOTES);
        $stripads = $options[$number]['stripads'] ? 'checked' : '';
        $show_category = $options[$number]['show_category'] ? 'checked' : '';
        $category_id = $options[$number]['category_id'];
        $show_on_site_area = $options[$number]['show_on_site_area'] ? 'checked' : '';
        $show_not_on_site_area = $options[$number]['show_not_on_site_area'] ? 'checked' : '';
        $site_area = $options[$number]['site_area'];
        $site_area_id = $options[$number]['site_area_id'];
        $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
        $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
        # Here is the form segment. Notice that I have outsourced the form elements to be a little cleaner
        echo king_get_tab_start('rss' . $number, array(__('Basic', 'widgetKing'), __('Advanced', 'widgetKing'), __('Show', 'widgetKing'), __('Export', 'widgetKing')));
        # show rss URL
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_url_{$number}", 'Description' => __('The Feed URL', 'widgetKing'), 'Label_Title' => __('Insert your rss Feed URL.', 'widgetKing'), 'Value' => $rss_url, 'Class' => 'big'));
        # show child rss
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_max_items_{$number}", 'Description' => __('Feed Items to show', 'widgetKing'), 'Label_Title' => __('How many Articles or Items do you want to show from the Feed. Of course this is a numeric Value!', 'widgetKing'), 'Value' => $max_items, 'Max' => '3', 'Class' => 'small'));
        # show only short description
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_shortdesc_{$number}", 'Description' => __('Show only the first No. Letters ', 'widgetKing'), 'Label_Title' => __('How much of the Feed Article Text should be shown? Of course this is a numeric Value! f.ex. Set to 100 to show the first 100 letters.', 'widgetKing'), 'Value' => $shortdesc, 'Max' => '3', 'Class' => 'small'));
        # show Date
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_showdate_{$number}", 'Description' => __('Dateformat (php time)', 'widgetKing'), 'Label_Title' => __('Enter the date  in php time() format. If left empty none is shown. You can check this f.ex. in your blog settings. or juggle with j F Y, g:i a', 'widgetKing'), 'Value' => $showdate, 'Max' => '20'));
        # show Error Message
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_error_{$number}", 'Description' => __('Error Message', 'widgetKing'), 'Label_Title' => __('The error Message shown if the feed cant be fetched', 'widgetKing'), 'Value' => $error, 'Max' => '60'));
        # sort order
        echo king_get_checkbox_p(array('Label_Id_Name' => "king_rss_nosort_{$number}", 'Description' => __('Do not sort Feed', 'widgetKing'), 'Label_Title' => __('Prevent sorting the feed by the time of its items. f.ex. used when grabbing a google calendar feed', 'widgetKing'), 'Value' => $nosort));
        # strip Ads
        echo king_get_checkbox_p(array('Label_Id_Name' => "king_rss_stripads_{$number}", 'Description' => __('Strip Ads', 'widgetKing'), 'Label_Title' => __('Strip out Feed-Ads from Google/Pheedo/Doubleclicks.', 'widgetKing'), 'Value' => $stripads));
        #cache time
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_cache_time_{$number}", 'Description' => __('Refresh the feed every Minutes', 'widgetKing'), 'Label_Title' => __('The Feed will be refreshed every given Minutes. If the feed does not update frequently set a high value, else make it grab the feed more often. Default is 60 minutes, if left empty', 'widgetKing'), 'Class' => 'small', 'Value' => $cache_time));
        # set to defaults
        echo king_get_checkbox_p(array('Label_Id_Name' => "king_rss_defaults_{$number}", 'Description' => __('Insert default Options', 'widgetKing'), 'Label_Title' => __('Set all Widget Options to (hopefully failsave) Defaults. You should definitly try out some more of the HTML Placeholders for the RSS', 'widgetKing')));
        # copy
        echo king_get_select_p(array('Label_Id_Name' => "king_rss_copy_{$number}", 'Description' => __('Copy Settings from Widget No.', 'widgetKing'), 'Label_Title' => __('Choose a Widget Number from which you want to copy the settings into this one. Make sure to choose the right widget, with some Options in it!', 'widgetKing'), 'select_options' => array('No', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20')));
        # show title
        echo king_get_textbox_p(array('Label_Id_Name' => "king_rss_title_{$number}", 'Description' => __('Internal Widget Title', 'widgetKing'), 'Label_Title' => __('The title inside this widget admin page. Is shown next to the widgets name, if you applied my Widget Title Hack -> try to google on that. Or search the MP:Blog', 'widgetKing'), 'Value' => $title, 'Max' => '50'));
        # devider
        echo king_get_tab_section('rss' . $number . '-1');
        #before widget
        echo king_get_textbox_p(array('Label_Id_Name' => "king_before_rss_widget_{$number}", 'Description' => __('HTML before widget', 'widgetKing'), 'Label_Title' => __('HTML which opens this widget. Can be something linke ul with a class, depending on your css and Theme', 'widgetKing'), 'Value' => $before_widget, 'Class' => 'big'));
        # rss template html
        echo king_get_textarea_p(array('Label_Id_Name' => "king_rss_titlehtml_{$number}", 'Description' => __('RSS Title HTML Template', 'widgetKing'), 'Label_Title' => __('The HTML that will be used to format the RSS-Title output. There are several Placeholders wich can be used. <br />%link% - Link to Website <br />%title% - RSS Title<br />%descr% - RSS Description<br />%rssurl% - Feed URL<br />%rssicon% - RSS Icon <br />%feedimg% - Feed Image if provided by Feed.', 'widgetKing'), 'Value' => $titlehtml));
        # rss template html
        echo king_get_textarea_p(array('Label_Id_Name' => "king_rss_rsshtml_{$number}", 'Description' => __('RSS Item formatting HTML Template', 'widgetKing'), 'Label_Title' => __('The HTML that will be used to format each Item of the RSS output. There are several Placeholders wich can be used: <br />%title% - Item Title<br />%date% - Item Date<br />%link% - Link to Item Title<br />%text% - Item Text<br />%category% - Item Categories if provided delimited by | <br />%author% - Item Author if provided', 'widgetKing'), 'Value' => $rsshtml));
        #after widget
        echo king_get_textbox_p(array('Label_Id_Name' => "king_after_rss_widget_{$number}", 'Description' => __('HTML after widget', 'widgetKing'), 'Label_Title' => __('HTML which closes this widget. Can be something linke /ul , depending on what you set as HTML before', 'widgetKing'), 'Value' => $after_widget, 'Class' => 'big'));
        #devider
        echo king_get_tab_section('rss' . $number . '-2');
        #Where To Show Options Panel
        widget_king_where_to_show('rss', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
        echo king_get_tab_section('rss' . $number . '-3');
        king_get_dump_options('rss', $number, 'widget_rss_categories');
        echo king_get_hidden("king_rss_submit_{$number}", '1', "king_rss_submit_{$number}");
        echo king_get_tab_end();
    }
Exemplo n.º 6
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_text_control($number)
 {
     // Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_text');
     if ($_POST["king_text_submit_{$number}"]) {
         //if defaults are choosen
         if (isset($_POST["king_text_defaults_{$number}"])) {
             /*  no defaults atm	*/
         } elseif ($_POST["king_text_copy_{$number}"] !== 'No' && $_POST["king_text_copy_{$number}"] != $number) {
             $copy = $_POST["king_text_copy_{$number}"];
             $newoptions[$number] = array();
             foreach ($options[$copy] as $key => $val) {
                 $newoptions[$number][$key] = $val;
             }
         } else {
             // insert new form values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_text_title_{$number}"]));
             $newoptions[$number]['text'] = stripslashes($_POST["king_text_text_{$number}"]);
             if (!current_user_can('unfiltered_html')) {
                 $newoptions[$number]['text'] = stripslashes(wp_filter_post_kses($newoptions[$number]['text']));
             }
             $newoptions[$number]['use_php'] = isset($_POST["king_text_use_php_{$number}"]);
             $newoptions[$number]['show_category'] = isset($_POST["king_text_showcategory_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_text_category_id_{$number}"];
             $newoptions[$number]['slide'] = isset($_POST["king_text_slide_{$number}"]);
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_text_show_on_site_area_{$number}"]);
             $newoptions[$number]['show_not_on_site_area'] = isset($_POST["king_text_show_not_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_text_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_text_site_area_id_{$number}"];
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_text_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_text_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_text_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_text_widget_title_{$number}"]);
         }
     }
     if ($options != $newoptions) {
         $options = $newoptions;
         update_option('widget_king_text', $options);
     }
     $title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
     $text = htmlspecialchars($options[$number]['text'], ENT_QUOTES);
     $show_category = $options[$number]['show_category'] ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $use_php = $options[$number]['use_php'] ? 'checked' : '';
     $show_on_site_area = $options[$number]['show_on_site_area'] ? 'checked' : '';
     $show_not_on_site_area = $options[$number]['show_not_on_site_area'] ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     $slide = !empty($options[$number]['slide']) ? 'checked' : '';
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     echo king_get_tab_start('text' . $number, array(__('Basic Features', 'widgetKing'), __('Show', 'widgetKing'), __('HTML', 'widgetKing')));
     # show title
     echo king_get_textbox_p(array('Label_Id_Name' => "king_text_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your text menu', 'widgetKing'), 'Value' => $title));
     #use_php in textarea
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_text_use_php_{$number}", 'Description' => __('Use PHP in Text', 'widgetKing'), 'Label_Title' => __('If checked the inserted code is evaluated as php.PHP Code MUST be enclosed in &lt;?php and ?&gt; tags! You can also insert Wordpress Code if you have not found a Widget for it yet.', 'widgetKing'), 'Value' => $use_php));
     # show child text
     echo king_get_textarea_p(array('Label_Id_Name' => "king_text_text_{$number}", 'Description' => __('Text or HTML', 'widgetKing'), 'Label_Title' => __('Insert your Text Freely. This can be bannercode, images or whatever you like. The HTML gets stripped if you do not have the right to insert unfiltered html.', 'widgetKing'), 'Value' => $text, 'Class' => 'big'));
     #copy
     echo king_get_select_p(array('Label_Id_Name' => "king_text_copy_{$number}", 'Description' => __('Copy Settings from Widget No.', 'widgetKing'), 'Label_Title' => __('Choose a Widget Number from which you want to copy the settings into this one. Make sure to choose the right widget, with some Options in it!', 'widgetKing'), 'select_options' => array('No', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19')));
     echo king_get_tab_section('text' . $number . '-1');
     # Where To Show Options Panel
     widget_king_where_to_show('text', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     echo king_get_tab_section('text' . $number . '-2');
     # Widget HTML
     widget_king_htmloptions('text', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     echo king_get_hidden("king_text_submit_{$number}", '1', "king_text_submit_{$number}");
     echo king_get_tab_end();
 }
Exemplo n.º 7
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_pages_control($number)
 {
     # Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_pages');
     if ($_POST["king_pages_submit_{$number}"]) {
         if (isset($_POST["king_pages_defaults_{$number}"])) {
             # if defaults are choosen
             $newoptions[$number]['title'] = "Pages Menu {$number}";
             $newoptions[$number]['child_of'] = '0';
             $newoptions[$number]['sort_column'] = 'post_title';
             $newoptions[$number]['sort_order'] = 'ASC';
             $newoptions[$number]['exclude'] = '';
             $newoptions[$number]['depth'] = '0';
             $newoptions[$number]['show_date'] = '';
             $newoptions[$number]['date_format'] = '';
             $newoptions[$number]['debug'] = '';
             $newoptions[$number]['before_widget'] = "<ul>";
             $newoptions[$number]['after_widget'] = addslashes("</ul>");
             $newoptions[$number]['before_widget_title'] = "<h2>";
             $newoptions[$number]['after_widget_title'] = addslashes("</h2>");
         } elseif (!empty($_POST["king_pages_dump_{$number}"]) && isset($_POST["king_pages_usedump_{$number}"])) {
             $newoptions[$number] = king_read_options($_POST["king_pages_dump_{$number}"]);
         } else {
             # insert new form values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_pages_title_{$number}"]));
             $newoptions[$number]['child_of'] = $_POST["king_pages_child_of_{$number}"];
             $newoptions[$number]['sort_column'] = $_POST["king_pages_sort_column_{$number}"];
             $newoptions[$number]['sort_order'] = $_POST["king_pages_sort_order_{$number}"];
             $newoptions[$number]['exclude'] = $_POST["king_pages_exclude_{$number}"];
             $newoptions[$number]['depth'] = $_POST["king_pages_depth_{$number}"];
             $newoptions[$number]['show_date'] = $_POST["king_pages_show_date_{$number}"];
             $newoptions[$number]['date_format'] = $_POST["king_pages_date_format_{$number}"];
             $newoptions[$number]['debug'] = isset($_POST["king_pages_debug_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_pages_category_id_{$number}"];
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_pages_show_on_site_area_{$number}"]);
             $newoptions[$number]['show_not_on_site_area'] = isset($_POST["king_pages_show_not_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_pages_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_pages_site_area_id_{$number}"];
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_pages_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_pages_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_pages_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_pages_widget_title_{$number}"]);
             $newoptions[$number]['foldlist'] = isset($_POST["king_pages_foldlist_{$number}"]);
         }
     }
     if ($options != $newoptions) {
         # save it
         $options = $newoptions;
         update_option('widget_king_pages', $options);
     }
     $title = wp_specialchars($options[$number]['title']);
     $child_of = $options[$number]['child_of'];
     $sort_column = $options[$number]['sort_column'];
     $sort_order = $options[$number]['sort_order'];
     $exclude = $options[$number]['exclude'];
     $depth = $options[$number]['depth'];
     $show_date = $options[$number]['show_date'];
     $date_format = $options[$number]['date_format'];
     $debug = $options[$number]['debug'] ? 'checked' : '';
     $show_category = !empty($options[$number]['show_category']) ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $show_on_site_area = !empty($options[$number]['show_on_site_area']) ? 'checked' : '';
     $show_not_on_site_area = !empty($options[$number]['show_not_on_site_area']) ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     $foldlist = $options[$number]['foldlist'] ? 'checked' : '';
     # Here is the form segment. Notice that I have outsourced the form elements to be a little cleaner
     echo king_get_tab_start('pages' . $number, array(__('Basic', 'widgetKing'), __('Advanced', 'widgetKing'), __('Show', 'widgetKing'), __('HTML', 'widgetKing'), __('Export', 'widgetKing')));
     # show title
     echo king_get_textbox_p(array('Label_Id_Name' => "king_pages_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your pages menu', 'widgetKing'), 'Value' => $title, 'Max' => '50'));
     # show child pages
     echo king_get_textbox_p(array('Label_Id_Name' => "king_pages_child_of_{$number}", 'Description' => __('List Child Pages of (ID)', 'widgetKing'), 'Label_Title' => __('Show only subpages of the given PagesID', 'widgetKing'), 'Value' => $child_of, 'Class' => 'small', 'Max' => '3'));
     #sort Order
     echo king_get_select_p(array('Label_Id_Name' => "king_pages_sort_column_{$number}", 'Description' => __('Sort by', 'widgetKing'), 'Label_Title' => __('Sort Pages by choosen sort column.', 'widgetKing'), 'select_options' => array('post_title', 'menu_order', 'post_date', 'post_modified', 'ID', 'post_author', 'post_name'), 'Value' => $sort_column));
     #sort Order
     echo king_get_select_p(array('Label_Id_Name' => "king_pages_sort_order_{$number}", 'Description' => __('Sort order', 'widgetKing'), 'Label_Title' => __('Sort Categories ascending or descending depending on choosen sort column.', 'widgetKing'), 'select_options' => array('asc', 'desc'), 'Value' => $sort_order));
     #  exlude pages
     echo king_get_textbox_p(array('Label_Id_Name' => "king_pages_exclude_{$number}", 'Description' => __('Exlude Pages with (ID)', 'widgetKing'), 'Label_Title' => __('Comma separated list of Page numeric IDs to be excluded from the list (example:10, 20, 30)', 'widgetKing'), 'Value' => $exclude, 'Max' => '150'));
     # show depth
     echo king_get_textbox_p(array('Label_Id_Name' => "king_pages_depth_{$number}", 'Description' => __('Show till Sub-Level', 'widgetKing'), 'Label_Title' => __('Numeric value for how many levels of hierarchy (sub-pages) to display. Defaults to 0 (display all pages)', 'widgetKing'), 'Value' => $depth, 'Size' => '3', 'Max' => '3'));
     echo king_get_tab_section('pages' . $number . '-1');
     #show_date
     echo king_get_select_p(array('Label_Id_Name' => "king_pages_show_date_{$number}", 'Description' => __('Show Date', 'widgetKing'), 'Label_Title' => __('Display creation or last modified date next to each Page. if Empty -> Display no date. modified -> Display the date last modified. post_date -> Date Page was first created.', 'widgetKing'), 'select_options' => array('', 'modified', 'post_date'), 'Value' => $show_date));
     #date_format
     echo king_get_textbox_p(array('Label_Id_Name' => "king_pages_date_format_{$number}", 'Description' => __('Format of date to display', 'widgetKing'), 'Label_Title' => __('Defaults to the date format configured in your WordPress options. Custom values need to be in php Time Format. You can google on that..can you?', 'widgetKing'), 'Value' => $date_format, 'Max' => '50'));
     #show foldlist
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_pages_foldlist_{$number}", 'Description' => __('Use Foldable Pages Navigation', 'widgetKing'), 'Label_Title' => __('If you have the Fold Pages List Plugin installed you can set this option to use the wswwpx_fold_page_list() call.', 'widgetKing'), 'Value' => $foldlist));
     #set to defaults
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_pages_defaults_{$number}", 'Description' => __('Insert default Options', 'widgetKing'), 'Label_Title' => __('Set Menu Options to Wordpress Defaults', 'widgetKing')));
     # devider
     echo king_get_tab_section('pages' . $number . '-2');
     widget_king_where_to_show('pages', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     # devider
     echo king_get_tab_section('pages' . $number . '-3');
     # widget surrounding HTML
     widget_king_htmloptions('pages', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     # show debug output
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_pages_debug_{$number}", 'Description' => __('Show Debug Output', 'widgetKing'), 'Label_Title' => __('Shows all set options in Frontend to check what you have entered. The list_cats() is pretty bitchy so you might want to know whats going on.', 'widgetKing'), 'Value' => $debug));
     # devider
     echo king_get_tab_section('pages' . $number . '-4');
     king_get_dump_options('pages', $number, 'widget_king_pages');
     echo king_get_hidden("king_pages_submit_{$number}", '1', "king_pages_submit_{$number}");
     echo king_get_tab_end();
 }
Exemplo n.º 8
0
 /**
  * @desc Output of plugin?s editform in te adminarea
  * @author Georg Leciejewski
  */
 function widget_king_categories_control($number)
 {
     # Get our options and see if we're handling a form submission.
     $options = $newoptions = get_option('widget_king_categories');
     if ($_POST["king_cat_submit_{$number}"]) {
         #if defaults are choosen
         if (isset($_POST["king_cat_defaults_{$number}"])) {
             $newoptions[$number]['title'] = "Category Menu {$number}";
             $newoptions[$number]['sort_column'] = 'ID';
             $newoptions[$number]['sort_order'] = 'asc';
             $newoptions[$number]['file'] = '';
             $newoptions[$number]['list'] = 1;
             $newoptions[$number]['optiondates'] = '';
             $newoptions[$number]['count'] = '';
             $newoptions[$number]['empty'] = 1;
             $newoptions[$number]['desc_title'] = 1;
             $newoptions[$number]['children'] = '';
             $newoptions[$number]['child_of'] = '';
             $newoptions[$number]['feed'] = '';
             $newoptions[$number]['feed_image'] = '';
             $newoptions[$number]['exclude'] = '';
             $newoptions[$number]['hierarchical'] = 1;
             $newoptions[$number]['debug'] = '';
             $newoptions[$number]['before_widget'] = "<li>";
             $newoptions[$number]['after_widget'] = addslashes("</ul></li>");
             $newoptions[$number]['before_widget_title'] = "<h2>";
             $newoptions[$number]['after_widget_title'] = addslashes("</h2><ul>");
         } elseif ($_POST["king_cat_copy_{$number}"] !== 'No' && $_POST["king_cat_copy_{$number}"] != $number) {
             $copy = $_POST["king_cat_copy_{$number}"];
             $newoptions[$number] = array();
             foreach ($options[$copy] as $key => $val) {
                 $newoptions[$number][$key] = $val;
             }
         } elseif (!empty($_POST["king_cat_dump_{$number}"]) && isset($_POST["king_cat_usedump_{$number}"])) {
             $newoptions[$number] = king_read_options($_POST["king_cat_dump_{$number}"]);
         } else {
             # insert new form values
             $newoptions[$number]['title'] = strip_tags(stripslashes($_POST["king_cat_title_{$number}"]));
             $newoptions[$number]['sort_column'] = $_POST["king_sort_column_{$number}"];
             $newoptions[$number]['sort_order'] = $_POST["king_sort_order_{$number}"];
             $newoptions[$number]['file'] = stripslashes($_POST["king_file_{$number}"]);
             $newoptions[$number]['list'] = isset($_POST["king_list_{$number}"]);
             $newoptions[$number]['optiondates'] = isset($_POST["king_optiondates_{$number}"]);
             $newoptions[$number]['count'] = isset($_POST["king_cat_count_{$number}"]);
             $newoptions[$number]['empty'] = isset($_POST["king_cat_empty_{$number}"]);
             $newoptions[$number]['desc_title'] = isset($_POST["king_desc_title_{$number}"]);
             $newoptions[$number]['children'] = isset($_POST["king_children_{$number}"]);
             $newoptions[$number]['child_of'] = strip_tags(stripslashes($_POST["king_child_of_{$number}"]));
             $newoptions[$number]['feed'] = strip_tags(stripslashes($_POST["king_feed_{$number}"]));
             $newoptions[$number]['feed_image'] = addslashes($_POST["king_feed_image_{$number}"]);
             $newoptions[$number]['exclude'] = stripslashes($_POST["king_exclude_{$number}"]);
             $newoptions[$number]['hierarchical'] = isset($_POST["king_cat_hierarchical_{$number}"]);
             $newoptions[$number]['debug'] = isset($_POST["king_cat_debug_{$number}"]);
             $newoptions[$number]['before_widget'] = html_entity_decode($_POST["king_before_cat_widget_{$number}"]);
             $newoptions[$number]['after_widget'] = html_entity_decode($_POST["king_after_cat_widget_{$number}"]);
             $newoptions[$number]['before_widget_title'] = html_entity_decode($_POST["king_before_cat_widget_title_{$number}"]);
             $newoptions[$number]['after_widget_title'] = html_entity_decode($_POST["king_after_cat_widget_title_{$number}"]);
             $newoptions[$number]['foldlist'] = isset($_POST["king_cat_foldlist_{$number}"]);
             $newoptions[$number]['show_category'] = isset($_POST["king_cat_showcategory_{$number}"]);
             $newoptions[$number]['category_id'] = $_POST["king_cat_category_id_{$number}"];
             $newoptions[$number]['show_on_site_area'] = isset($_POST["king_cat_show_on_site_area_{$number}"]);
             $newoptions[$number]['show_not_on_site_area'] = isset($_POST["king_cat_show_not_on_site_area_{$number}"]);
             $newoptions[$number]['site_area'] = $_POST["king_cat_site_area_{$number}"];
             $newoptions[$number]['site_area_id'] = $_POST["king_cat_site_area_id_{$number}"];
         }
     }
     if ($options != $newoptions) {
         $options = $newoptions;
         update_option('widget_king_categories', $options);
     }
     $title = wp_specialchars($options[$number]['title']);
     $hierarchical = $options[$number]['hierarchical'] ? 'checked' : '';
     $sort_column = $options[$number]['sort_column'];
     $sort_order = $options[$number]['sort_order'];
     $file = $options[$number]['file'];
     $list = $options[$number]['list'] ? 'checked' : '';
     $optiondates = $options[$number]['optiondates'] ? 'checked' : '';
     $count = $options[$number]['count'] ? 'checked' : '';
     $empty = $options[$number]['empty'] ? 'checked' : '';
     $desc_title = $options[$number]['desc_title'] ? 'checked' : '';
     $children = $options[$number]['children'] ? 'checked' : '';
     $child_of = $options[$number]['child_of'];
     $feed = $options[$number]['feed'];
     $feed_image = stripslashes($options[$number]['feed_image']);
     $exclude = $options[$number]['exclude'];
     $hierarchical = $options[$number]['hierarchical'] ? 'checked' : '';
     $debug = $options[$number]['debug'] ? 'checked' : '';
     $before_widget = stripslashes(htmlentities($options[$number]['before_widget']));
     $after_widget = stripslashes(htmlentities($options[$number]['after_widget']));
     $before_widget_title = stripslashes(htmlentities($options[$number]['before_widget_title']));
     $after_widget_title = stripslashes(htmlentities($options[$number]['after_widget_title']));
     $foldlist = $options[$number]['foldlist'] ? 'checked' : '';
     $show_category = $options[$number]['show_category'] ? 'checked' : '';
     $category_id = $options[$number]['category_id'];
     $show_on_site_area = $options[$number]['show_on_site_area'] ? 'checked' : '';
     $show_not_on_site_area = $options[$number]['show_not_on_site_area'] ? 'checked' : '';
     $site_area = $options[$number]['site_area'];
     $site_area_id = $options[$number]['site_area_id'];
     echo king_get_tab_start('cat' . $number, array(__('Basic', 'widgetKing'), __('Advanced', 'widgetKing'), __('Show', 'widgetKing'), __('HTML', 'widgetKing'), __('Export', 'widgetKing')));
     # show title
     echo king_get_textbox_p(array('Label_Id_Name' => "king_cat_title_{$number}", 'Description' => __('Title', 'widgetKing'), 'Label_Title' => __('The title above your category menu', 'widgetKing'), 'Value' => $title, 'Size' => '20', 'Max' => '50'));
     #show category Count
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_cat_count_{$number}", 'Description' => __('Show post counts', 'widgetKing'), 'Label_Title' => __('Show number of posts in category', 'widgetKing'), 'Value' => $count));
     #show hirachical
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_cat_hierarchical_{$number}", 'Description' => __('Show hierarchical', 'widgetKing'), 'Label_Title' => __('Shows Categories hierarchical with sub-categories indented -> Depending on your CSS', 'widgetKing'), 'Value' => $hierarchical));
     #show cat children
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_children_{$number}", 'Description' => __('Show Children', 'widgetKing'), 'Label_Title' => __('Show the children of the categories or just the top level categories.', 'widgetKing'), 'Value' => $children));
     #show empty
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_cat_empty_{$number}", 'Description' => __('Hide Empty Categories', 'widgetKing'), 'Label_Title' => __('Categories without articles are not shown.', 'widgetKing'), 'Value' => $empty));
     #sort Column
     echo king_get_select_p(array('Label_Id_Name' => "king_sort_column_{$number}", 'Description' => __('Sort by', 'widgetKing'), 'select_options' => array('name', 'id'), 'Value' => $sort_column));
     #sort Order
     echo king_get_select_p(array('Label_Id_Name' => "king_sort_order_{$number}", 'Description' => __('Sort order', 'widgetKing'), 'Label_Title' => __('Sort Categories ascending or descending depending on choosen sort column.', 'widgetKing'), 'select_options' => array('asc', 'desc'), 'Value' => $sort_order));
     #list as list
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_list_{$number}", 'Description' => __('Show as List (li)', 'widgetKing'), 'Label_Title' => __('Sets whether the Categories are enclosed by list points ->li', 'widgetKing'), 'Value' => $list));
     # devider
     echo king_get_tab_section('cat' . $number . '-1');
     #show dates
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_optiondates_{$number}", 'Description' => __('Date of the last post', 'widgetKing'), 'Label_Title' => __('Sets whether to display the date of the last post in each Category.', 'widgetKing'), 'Value' => $optiondates));
     #description as title
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_desc_title_{$number}", 'Description' => __('Use Description as Title', 'widgetKing'), 'Label_Title' => __('Sets whether to display the Category Description in the links title tag.', 'widgetKing'), 'Value' => $desc_title));
     #show children of
     echo king_get_textbox_p(array('Label_Id_Name' => "king_child_of_{$number}", 'Description' => __('Show Children of Category', 'widgetKing'), 'Label_Title' => __('Show only children of the category id given. All other top level categories will disappear.', 'widgetKing'), 'Value' => $child_of, 'Size' => '3', 'Max' => '3'));
     #file to display category on
     echo king_get_textbox_p(array('Label_Id_Name' => "king_file_{$number}", 'Description' => __('File to show Category on', 'widgetKing'), 'Label_Title' => __('The php file a Category link is to be displayed on. Defaults to index.php.', 'widgetKing'), 'Value' => $file, 'Size' => '20', 'Max' => '200'));
     #insert feed text
     echo king_get_textbox_p(array('Label_Id_Name' => "king_feed_{$number}", 'Description' => __('Show Category Feed Text', 'widgetKing'), 'Label_Title' => __('Text to display for the link to each Categorys RSS2 feed. Default is no text, and no feed displayed.', 'widgetKing'), 'Value' => $feed, 'Size' => '20', 'Max' => '20'));
     #name of feed image  Path/filename
     echo king_get_textbox_p(array('Label_Id_Name' => "king_feed_image_{$number}", 'Description' => __('Show Category Feed Image', 'widgetKing'), 'Label_Title' => __('URL Path/filename for a graphic to act as a link to each Categories RSS2 feed.Overrides the feed parameter.', 'widgetKing'), 'Value' => $feed_image, 'Size' => '20', 'Max' => '300'));
     #exclude categories
     echo king_get_textbox_p(array('Label_Id_Name' => "king_exclude_{$number}", 'Description' => __('Exclude Categories (1,2,3)', 'widgetKing'), 'Label_Title' => __('Sets the Categories to be excluded. This must be in the form of an array (ex: 1, 2, 3).', 'widgetKing'), 'Value' => $exclude, 'Size' => '20', 'Max' => '100'));
     #set to defaults
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_cat_defaults_{$number}", 'Description' => __('Insert default Options', 'widgetKing'), 'Label_Title' => __('Set Menu Options to Wordpress Defaults', 'widgetKing')));
     #copy
     echo king_get_select_p(array('Label_Id_Name' => "king_cat_copy_{$number}", 'Description' => __('Copy Settings from Widget No.', 'widgetKing'), 'Label_Title' => __('Choose a Widget Number from which you want to copy the settings into this one. Make sure to choose the right widget, with some Options in it!', 'widgetKing'), 'select_options' => array('No', '1', '2', '3', '4', '5', '6', '7', '8', '9')));
     #devider
     echo king_get_tab_section('cat' . $number . '-2');
     # Where To Show Options Panel
     widget_king_where_to_show('cat', $number, $show_category, $category_id, $show_on_site_area, $show_not_on_site_area, $site_area, $site_area_id);
     # devider
     echo king_get_tab_section('cat' . $number . '-3');
     widget_king_htmloptions('cat', $number, $before_widget, $before_widget_title, $after_widget_title, $after_widget);
     # show debug output
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_cat_debug_{$number}", 'Description' => __('Show Debug Output', 'widgetKing'), 'Label_Title' => __('Shows all set options in Frontend to check what you have entered. The list_cats() is pretty bitchy so you might want to know whats going on.', 'widgetKing'), 'Value' => $debug));
     # foldlist
     echo king_get_checkbox_p(array('Label_Id_Name' => "king_cat_foldlist_{$number}", 'Description' => __('Use Foldable Navigation', 'widgetKing'), 'Label_Title' => __('If you have the Fold Category List Plugin installed you can set this option to use the wswwpx_list_cats call.', 'widgetKing'), 'Value' => $foldlist));
     echo king_get_tab_section('cat' . $number . '-4');
     king_get_dump_options('cat', $number, 'widget_king_categories');
     echo king_get_hidden("king_cat_submit_{$number}", '1', "king_cat_submit_{$number}");
     echo king_get_tab_end();
 }