<?php define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
const PLUGIN_VERSION = '1.1.1';
const PLUGIN_DOMAIN = 'admidio';
if (!class_exists('admidio_main')) {
class admidio_main {
function admidio_main(){
$this->__construct();
}
function __construct(){
add_action('admin_menu', 'admidio_description_add_menu');
add_filter('the_content', 'get_admidioper_id');
add_action('admin_head', 'admidio_addStyle');
add_action('save_post', 'admidio_save_post');
}
} function admidio_addStyle(){
global $pagenow;
if ( is_admin() && $pagenow == 'options-general.php' ) {
?><style type="text/css" media="screen" lang="de">
<?php foreach ( glob( plugin_dir_path( __FILE__ ) . "css/*.css" ) as $file ) {include_once $file;} ?>
</style><?php
}
} function admidio_description_option_page() {
if (!empty($_POST)){
if ($_POST) {
$meta = array( 'admidio_addlink'
);
foreach($meta as $field_name) {
update_option($field_name, '');
}
foreach ($_POST as $option => $value) {
if ( $option == 'submit' ) continue ;
update_option( $option, $value );
}
}
}
$admidio_url = ( get_option('admidio_protocol') !=1 ? 'http://' : 'https://')
. trim( preg_replace('%\b([\r\n\t]?(https?|ftp|file):/+)\b%'
, '', get_option('admidio_url')));
ob_start(); ?>
<div id="wrapper" class="wrap">
<h1><?=_e('Einstellungen > Wrapper');?></h1>
<hr />
<div class="wrapper">
<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>&updated=true">
<table class="form-table">
<tr>
<th scope="row"><strong><?=_e('Url');?></strong></th>
<td>
<select name="admidio_protocol"
id="admidio_protocol"
class="admidio-max-width widefat ui-corner-left ui-corner-right "
autofocus >
<optgroup label="<?=_e('Geben Sie das Protokoll an.'); ?>">
<option name="admidio_protocol" <?=selected(get_option('admidio_protocol'), '0'); ?> value="0" >http://</option>
<option name="admidio_protocol" <?=selected(get_option('admidio_protocol'), '1'); ?> value="1">https://</option>
</select>
<label for="admidio_protocol"><?=_e('welches Protokoll verwenden Sie?');?></label>
<fieldset>
<input name="admidio_url"
id="admidio_url"
title="<?=_e('geben Sie eine vollständige Adresse mit „http://“ ein!');?>"
size="25"
type="url"
pattern="^(f|ht)tps?\://[a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~]+$"
value="<?=$admidio_url;?>"
class="admidio-min-width"
spellcheck="false"
autocomplete="off"
required
autocapitalize="off" />
<button onclick="document.getElementById('admidio_url').value = '';" >
<?=_e('Löschen');?>
</button>
</fieldset>
<label for="admidio_url"><?=_e('geben Sie eine vollständige Adresse ein.');?></label>
</td>
</tr>
<tr>
<th scope="row"><strong><?=_e('Einbinden in Seite');?></strong></th>
<td><?php admidio_dropdown_pages('name=admidio_page'); ?>
<label for=""><?=_e('wählen Sie eine Seite aus');?></label>
</tr>
<tr>
<th scope="row"><strong><?=_e('Breite');?></strong></th>
<td><input name="admidio_width"
title="Sie können nur Zahlen von 0 bis 2400 eingeben."
class="admidio-max-width widefat ui-corner-left ui-corner-right "
size="4"
value="<?=get_option("admidio_width");?>"
min="0"
max="2400"
step="2"
type="number" />
<select name="admidio_width_einheit"
id="admidio_width_einheit"
class="admidio-max-width widefat ui-corner-left ui-corner-right " >
<optgroup value="1" label="<?=_e('Prozent, Pixel oder Desktop Breit');?>">
<option name="admidio_width_einheit" value="vw"
<?=selected( get_option('admidio_width_einheit'), 'vw'); ?>>vw</option>
<option name="admidio_width_einheit" value="px"
<?=selected( get_option('admidio_width_einheit'), 'px'); ?>>Pixel</option>
<option name="admidio_width_einheit" value="%"
<?=selected( get_option('admidio_width_einheit'), '%'); ?>>Prozent</option>
</select>
<label for="admidio_width"><?=__('bestimme die Breite und wähle den Maßstab <strong>height</strong> in Pixel <strong>px</strong> oder in Prozent <strong>%</strong> für den Wrapper.');?></label></td>
</tr>
<tr>
<th scope="row"><strong><?=_e('Höhe');?></strong></th>
<td><input name="admidio_height"
title="<?=_e('Sie können nur Zahlen von 0 bis 2400 eingeben.');?>"
class="admidio-max-width widefat ui-corner-left ui-corner-right "
size="4"
value="<?=get_option("admidio_height");?>"
min="0"
max="2400"
step="2"
type="number" />
<select name="admidio_height_einheit"
id="admidio_height_einheit"
class="admidio-max-width widefat ui-corner-left ui-corner-right " >
<optgroup value="1" label="<?=_e('Prozent, Pixel oder Desktop Höhe');?>">
<option name="admidio_height_einheit" value="vh"
<?php selected( get_option('admidio_height_einheit'), 'vh'); ?>>vh</option>
<option name="admidio_height_einheit" value="px"
<?php selected( get_option('admidio_height_einheit'), 'px'); ?>>Pixel</option>
<option name="admidio_height_einheit" value="%"
<?php selected( get_option('admidio_height_einheit'), '%'); ?>>Prozent</option>
</select>
<label for="admidio_height"><?=__('bestimme die Höhe und wähle den Maßstab <strong>height</strong> in Pixel <strong>px</strong> oder in Prozent <strong>%</strong> für den Wrapper.');?></label></td>
</tr>
<tr>
<th scope="row"><strong><?=_e('Rahmen');?></strong></th>
<td>
<select name="admidio_border"
id="admidio_border"
class="admidio-max-width widefat ui-corner-left ui-corner-right " >
<optgroup value="0" label="<?=_e('JA oder NEIN');?>">
<option name="admidio_border" value="1" <?=selected(get_option('admidio_border'), '1'); ?>>Ja</option>
<option name="admidio_border" value="0" <?=selected(get_option('admidio_border'), '0'); ?>>Nein</option>
</select>
<label for="admidio_border"><?=_e('anzeigen?');?></label></td>
</tr>
<tr>
<th scope="row"><strong><?=_e('Scrollbar');?></strong></th>
<td>
<select name="admidio_scroll"
id="admidio_scroll"
class="admidio-max-width widefat ui-corner-left ui-corner-right " >
<optgroup label="<?=_e('JA, NEIN oder Auto');?>">
<option name="admidio_scroll" value="yes" <?=selected( get_option('admidio_scroll'), 'yes'); ?>>Ja</option>
<option name="admidio_scroll" value="no" <?=selected( get_option('admidio_scroll'), 'no'); ?>>Nein</option>
<option name="admidio_scroll" value="auto" <?=selected( get_option('admidio_scroll'), 'auto'); ?>>Auto</option>
</select>
<label for="admidio_scroll"><?=_e('anzeigen?');?></label></td>
</tr>
<tr>
<th scope="row"><strong><?=_e('Link zu Admidio');?></strong></th>
<td>
<input type="checkbox"
id="admidio_addlink"
name="admidio_addlink"
class="widefat ui-corner-left ui-corner-right "
<?= checked(get_option('admidio_addlink'), 'on' ) ;?> />
<label for="admidio_addlink"><?=_e('wollen Sie ');?>„<strong>Powered by
<a href="http://www.admidio.org/" tabindex="-1" target="_blank">admidio</a></strong>“
<?=_e('oberhalb des Wrappers hinzufügen?');?></label></td>
</tr>
</table>
<br />
<p class="submit_admidio">
<input name="submit_admidio"
type="submit"
id="submit_admidio"
class="button button-primary button-large"
value="<?=esc_attr__('Speichern', PLUGIN_DOMAIN);?> »" />
</p>
</form>
<br /><hr />
<h4 style="text-align:center">
Powered by
<a href="http://www.admidio.org/" target="_blank">
<img src="<?=sprintf( plugins_url( '%s/admidio_logo_20.png', __FILE__ ), 'images');?>"
id="admidio_logo"
alt="<?=_e('Das Online-Verwaltungssystem für Vereine', PLUGIN_DOMAIN);?>"
title="<?=_e('Das Online-Verwaltungssystem für Vereine', PLUGIN_DOMAIN);?>" />
</a>
</h4>
</div>
</div><?php
$pages = ob_get_contents(); ob_end_clean();
echo $pages;
} function admidio_description_add_menu() {
add_options_page( 'WP Admidio Wrapper Einstellung'
,'Admidio Wrapper'
,'manage_options'
, __FILE__
,'admidio_description_option_page'
);
} function get_admidioper_id($content) {
$admidio_page = get_option('admidio_page');
if(is_page($admidio_page)) {
$admidio_addlink= ( get_option('admidio_addlink') =='on' ?
'<p style="text-align:center">Powered by
<a href="http://www.admidio.org/" target="_blank">
<img src="' . plugins_url( 'images/admidio_logo_20.png', __FILE__ ) . '"
style="border: 0px; vertical-align: bottom; top: -5px; position: relative;"
alt="Das Online-Verwaltungssystem für Vereine"
title="Das Online-Verwaltungssystem für Vereine" /></a></p>':'');
$admidio_width = ( get_option('admidio_width') !='0' ? ' width:' . get_option('admidio_width') . get_option('admidio_width_einheit') . ';' : '' );
$admidio_height = ( get_option('admidio_height') !='0' ? ' height:' . get_option('admidio_height') . get_option('admidio_height_einheit') . ';' : '' );
$admidio_border = ( get_option('admidio_border') !='0' ? ' border="' . get_option('admidio_border') . '"' : '' );
$admidio_scroll = ( get_option('admidio_scroll') !="auto" ? ' scrolling="' . get_option('admidio_scroll') . '"' : '' );
$content .= '<div class="admidio"'
. 'style=" z-index: 0;'
. $admidio_width
. $admidio_height
. 'padding-top: 25px;'
. 'position: relative;'
. 'margin-bottom: 16px;'
. 'padding-bottom: 56.25%; /* 16:9 */'
. 'box-sizing: border-box;">'
. '<iframe style=" z-index: 99999;'
. 'box-sizing: border-box;'
. 'position: absolute;'
. 'top: 10px; right: 0;'
. 'bottom: 16px;'
. 'left: 0;'
. $admidio_width
. $admidio_height
. '" src="'
. get_option('admidio_url') . '"'
. $admidio_scroll
. $admidio_border
. '></iframe>'
. $admidio_addlink
. '</div>';
}
return $content;
}
}
class Admidio_Dropdown_Pages_New extends Walker {
var $tree_type = 'page';
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
function start_el(&$output, $page, $depth, $args) {
$pad = str_repeat(' ', $depth * 3);
$output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
if ( $page->ID == get_option("admidio_page") )
$output .= ' selected="selected"';
$output .= '>';
$title = esc_html($page->post_title);
$title = apply_filters( 'list_pages', $page->post_title );
$output .= "$pad$title";
$output .= "</option>\n";
}
}
function admidio_dropdown_pages_treenew() {
$args = func_get_args();
if ( empty($args[2]['walker']) ) $walker = new Admidio_Dropdown_Pages_New;
else
$walker = $args[2]['walker'];
return call_user_func_array(array(&$walker, 'walk'), $args);
}
function admidio_dropdown_pages($args = '') {
$result = wp_parse_args( $args,
array( 'id' => ''
,'echo' => true
,'name' => 'page_id'
,'depth' => 0
,'authors' => ''
,'child_of' => 0
,'selected' => false
,'show_date' => ''
,'show_option_none' => ''
,'option_none_value' => ''
,'show_option_no_change' => ''
));
extract( $result, EXTR_SKIP );
$pages = get_pages($result);
$output = '';
$name = esc_attr($name);
if ( empty($id) )
$id = $name;
if ( ! empty($pages) ) {
$output = "<select name=\"$name\" id=\"$id\">\n";
$output .= admidio_dropdown_pages_treenew($pages, $depth, $result);
$output .= "</select>\n";
}
$output = apply_filters('wp_dropdown_pages', $output);
if ( $echo )
echo $output;
}
function admidio_save_post()
{
} if (class_exists('admidio_main')) {
$admidio_main = new admidio_main();
}
?>