示例#1
0
/**
* @desc The Admin Page
* @author Georg Leciejewski
*/
function king_events_admin_options()
{
    include_once ABSPATH . 'wp-content/plugins/king-includes/library/form.php';
    //see if we're handling a form submission.
    if ($_POST['king_events_admin_options_save']) {
        // transfer new form values
        $newoptions['google_cal'] = isset($_POST["google_cal"]);
        $newoptions['google_map'] = isset($_POST["google_map"]);
        $newoptions['boxes_cal'] = isset($_POST["boxes_cal"]);
        $newoptions['goyellow'] = isset($_POST["goyellow"]);
        $newoptions['qype'] = isset($_POST["qype"]);
        $newoptions['plazes'] = isset($_POST["plazes"]);
        $newoptions['plazes_pe'] = isset($_POST["plazes_pe"]);
        $newoptions['yahoo_cal'] = isset($_POST["yahoo_cal"]);
        $newoptions['hcal'] = isset($_POST["hcal"]);
        $newoptions['ical'] = isset($_POST["ical"]);
        $newoptions['ics'] = isset($_POST["ics"]);
        $newoptions['cal_info'] = isset($_POST["cal_info"]);
        $newoptions['show_sl'] = isset($_POST["show_sl"]);
        $newoptions['sl'] = isset($_POST["sl"]);
        $newoptions['blogscout'] = isset($_POST["blogscout"]);
        $newoptions['event_html'] = stripslashes($_POST["event_html"]);
        $newoptions['dateformat'] = stripslashes($_POST["dateformat"]);
        $newoptions['google_map_url'] = stripslashes($_POST["google_map_url"]);
        //save options
        update_option('king_events', $newoptions);
    }
    // Get our options
    $options = get_option('king_events');
    //prepare variables for admin form
    $google_cal = $options['google_cal'] ? 'checked="checked"' : '';
    $google_map = $options['google_map'] ? 'checked="checked"' : '';
    $boxes_cal = $options['boxes_cal'] ? 'checked="checked"' : '';
    $goyellow = $options['goyellow'] ? 'checked="checked"' : '';
    $qype = $options['qype'] ? 'checked="checked"' : '';
    $plazes = $options['plazes'] ? 'checked="checked"' : '';
    $plazes_pe = $options['plazes_pe'] ? 'checked="checked"' : '';
    $yahoo_cal = $options['yahoo_cal'] ? 'checked="checked"' : '';
    $hcal = $options['hcal'] ? 'checked="checked"' : '';
    $ical = $options['ical'] ? 'checked="checked"' : '';
    $ics = $options['ics'] ? 'checked="checked"' : '';
    $cal_info = $options['cal_info'] ? 'checked="checked"' : '';
    $show_sl = $options['show_sl'] ? 'checked="checked"' : '';
    $sl = $options['sl'] ? 'checked="checked"' : '';
    $blogscout = $options['blogscout'] ? 'checked="checked"' : '';
    $event_html = htmlspecialchars($options['event_html'], ENT_QUOTES);
    $dateformat = $options['dateformat'];
    $google_map_url = $options['google_map_url'];
    ?>
	<div class="wrap">
	<h2><?php 
    _e('King Events Options', 'kingplugin');
    ?>
 </h2>
	<form method="post" id="king_events_admin_options" action="">

		<legend><?php 
    _e('Define Global King Events Options', 'kingplugin');
    ?>
</legend>
		<table width="100%" cellspacing="2" cellpadding="5" class="editform">
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('the following:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    _e('Those Settings will set the defaults for new event posts. But this can also be edited in every single post.', 'kingplugin');
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Event Details above Post', 'kingplugin');
    ?>
</th>
				<td>
				<?php 
    echo king_get_checkbox('cal_info', $cal_info);
    ?>
			</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('hCal Microformat in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('hcal', $hcal);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('iCal Subscribe Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('ical', $ical);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('ics Download Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('ics', $ics);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Google Calendar Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('google_cal', $google_cal);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('GoogleMap Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('google_map', $google_map);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('30boxes Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('boxes_cal', $boxes_cal);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('GoYellow Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('goyellow', $goyellow);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Yahoo Calendar Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('yahoo_cal', $yahoo_cal);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Qype Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('qype', $qype);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Plazes Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('plazes', $plazes);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Plazes People Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('plazes_pe', $plazes_pe);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Blogscout, german Blogs and Post at Location:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('plazes_pe', $plazes_pe);
    ?>
				</td>
			</tr>
            <tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Show Second Live URL on Postingpage:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('show_sl', $show_sl);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('SL Link in Post:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_checkbox('sl', $sl);
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('HTML Template for Eventdetails in Post:', 'kingplugin');
    ?>
</th>
				<td >
					<?php 
    echo king_get_textarea('event_html', $event_html, '', '', '40', '4');
    ?>
<br />
					<?php 
    _e('Placeholders are:', 'kingplugin');
    ?>
<br />
					<strong>%%starttime%%</strong> ex: &lt;p&gt; Beginn: %%starttime%% &lt;/p&gt; <br />
					<strong>%%endtime%%</strong>  ex: &lt;p&gt; End: %%endtime%% &lt;/p&gt;<br />
					<strong>%%location_name%%, %%location%%</strong> ex: &lt;p&gt; Location: %%location_name%%, %%location%% &lt;/p&gt;
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Dateformat for Dates in HTML Template:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_textbox('dateformat', $dateformat);
    ?>
 <?php 
    _e('Use phpTime Format: d m Y - H:i', 'kingplugin');
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('URL To Google Maps:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_textbox('google_map_url', $google_map_url, '', '', '40');
    ?>
 <?php 
    _e('Depending on your Country change URL Suffix to .de / .com : http://maps.google.com/maps?q=', 'kingplugin');
    ?>
				</td>
			</tr>
			<tr valign="top">
				<th width="33%" scope="row"><?php 
    _e('Multiple ical feeds:', 'kingplugin');
    ?>
</th>
				<td>
					<?php 
    echo king_get_textarea('ical_feeds', $ical_feeds, '', '', '40', '5');
    ?>
 <?php 
    _e('Insert one Ical Feed URL in each Line', 'kingplugin');
    ?>
				</td>
			</tr>
		</table>
		<p class="submit"><input type="submit" name="king_events_admin_options_save" value="Save" /></p>
	</form>
	</div>
<?php 
}
示例#2
0
/**
* @desc get checkbox element row with p and label. Is used for the AJAX popup Options
* @author Georg Leciejewski
* @param array $options 		with following params
* @param string $k_Label_Id_Name p Label + IDs + Textbox Name
* @param string $k_P_Class 	Class of the surrounding p
* @param string $k_Label_Class  Class of the label field
* @param string $k_Description  Description shown before textbox
* @param string $k_Value 		Value for textbox
* @param string $k_Class  		Textbox Class
* @param string $k_Label_Title  Description shown for label
* @return string  				p with checkbox
*/
function king_get_checkbox_p($options)
{
    $result = king_get_start_p($options['Label_Id_Name'], $options['Description'], $options['Label_Title']);
    $result .= king_get_checkbox($options['Label_Id_Name'], $options['Value'], '', '');
    $result .= king_get_end_p();
    return $result;
}
示例#3
0
/**
*@desc the Admin interface
*/
function king_search_admin_options()
{
    include_once ABSPATH . 'wp-content/plugins/king-includes/library/form.php';
    if (isset($_POST['king_search_options_save'])) {
        //form is submitted
        $newoptions['search_pages'] = isset($_POST["search_pages"]);
        $newoptions['search_comments'] = isset($_POST["search_comments"]);
        $newoptions['appvd_comments'] = isset($_POST["appvd_comments"]);
        $newoptions['search_drafts'] = isset($_POST["search_drafts"]);
        $newoptions['search_attachments'] = isset($_POST["search_attachments"]);
        $newoptions['search_metadata'] = isset($_POST["search_metadata"]);
        //save options
        update_option('king_search', $newoptions);
        echo '<div id="message" class="updated fade"><p>Options updated!</p></div>';
    }
    $options = get_option('king_search');
    $search_pages = $options['search_pages'] ? 'checked="checked"' : '';
    $search_comments = $options['search_comments'] ? 'checked="checked"' : '';
    $appvd_comments = $options['appvd_comments'] ? 'checked="checked"' : '';
    $search_drafts = $options['search_drafts'] ? 'checked="checked"' : '';
    $search_attachments = $options['search_attachments'] ? 'checked="checked"' : '';
    $search_metadata = $options['search_metadata'] ? 'checked="checked"' : '';
    $search_pages = $options['search_pages'] ? 'checked="checked"' : '';
    ?>

	<div class="wrap">
		<h2><?php 
    _e('King Search Options', 'kingplugin');
    ?>
 </h2>
		<form method="post" action="">

			<legend><?php 
    _e('Define Search Options', 'kingplugin');
    ?>
</legend>
			<table width="100%" cellspacing="2" cellpadding="5" class="editform">
			<tr valign="top">
					<th width="33%" scope="row"><?php 
    _e('Search in pages', 'kingplugin');
    ?>
</th>
					<td>
					<?php 
    echo king_get_checkbox('search_pages', $search_pages);
    ?>
		          </td>
				</tr>
	            <tr valign="top">
					<th width="33%" scope="row"><?php 
    _e('Search in all Comments:', 'kingplugin');
    ?>
</th>
					<td>
						<?php 
    echo king_get_checkbox('search_comments', $search_comments);
    ?>
		            </td>
				</tr>
				<tr valign="top">
					<th width="33%" scope="row"><?php 
    _e('Search only in approved Comments?', 'kingplugin');
    ?>
</th>
					<td>
						<?php 
    echo king_get_checkbox('appvd_comments', $appvd_comments);
    ?>
		            </td>
				</tr>
	            <tr valign="top">
					<th width="33%" scope="row"><?php 
    _e('Search in Drafts:', 'kingplugin');
    ?>
</th>
					<td>
						<?php 
    echo king_get_checkbox('search_drafts', $search_drafts);
    ?>
		            </td>
				</tr>
				<tr valign="top">
					<th width="33%" scope="row"><?php 
    _e('Search in Attachments', 'kingplugin');
    ?>
</th>
					<td>
						<?php 
    echo king_get_checkbox('search_attachments', $search_attachments);
    ?>
		            </td>
				</tr>            <tr valign="top">
					<th width="33%" scope="row"><?php 
    _e('Search in Custom Fields (Metadata)', 'kingplugin');
    ?>
</th>
					<td>
						<?php 
    echo king_get_checkbox('search_metadata', $search_metadata);
    ?>
		            </td>
				</tr>

			</table>
			<p class="submit"><input type="submit" name="king_search_options_save" value="Save" /></p>
			</fieldset>
		</form>
	</div>

<?php 
}