コード例 #1
0
ファイル: form.php プロジェクト: jbogota/blog-king
/**
* @desc get textarea 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 + textarea Name
* @param string $k_P_Class of the surrounding p
* @param string $k_Label_Class  of the label field
* @param string $k_Description  shown before textarea
* @param string $k_Value 		Value for Textarea
* @param string $k_Class  		Textarea Class
* @param string $k_Label_Title  Description shown for label
* @param string $k_cols  		Textarea colums
* @param string $k_rows  		Textarea rows
* @return string 				p with textarea
*/
function king_get_textarea_p($options)
{
    $result = king_get_start_p($options['Label_Id_Name'], $options['Description'], $options['Label_Title'], $options['Class']);
    $result .= king_get_textarea($options['Label_Id_Name'], $options['Value'], '', '', $options['cols'], $options['rows']);
    $result .= king_get_end_p();
    return $result;
}
コード例 #2
0
ファイル: king_events.php プロジェクト: jbogota/blog-king
/**
* @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 
}