function category_submit() { global $vars, $phpcdb, $phpc_script, $phpc_cal; if (empty($vars["text-color"]) || empty($vars["bg-color"])) { $page = "{$phpc_script}?action=category_form"; if (!empty($vars["cid"])) { $page .= "&cid={$vars["cid"]}"; } if (!empty($vars["catid"])) { $page .= "&catid={$vars["catid"]}"; } return message_redirect(__("Color not specified."), $page); } // The current widget produces hex values without the "#". // We may in the future want to allow different input, so store the // values with the "#" $text_color = '#' . $vars["text-color"]; $bg_color = '#' . $vars["bg-color"]; if (empty($vars['gid']) || strlen($vars['gid']) == 0) { $gid = 0; } else { $gid = $vars['gid']; } if (!check_color($text_color) || !check_color($bg_color)) { soft_error(__("Invalid color.")); } if (!isset($vars['catid'])) { $modify = false; if (!isset($vars['cid'])) { $cid = null; if (!is_admin()) { permission_error(__('You do not have permission to add categories to all calendars.')); } } else { $cid = $vars['cid']; $calendar = $phpcdb->get_calendar($cid); if (!$calendar->can_admin()) { permission_error(__('You do not have permission to add categories to this calendar.')); } } $catid = $phpcdb->create_category($cid, $vars["name"], $text_color, $bg_color, $gid); } else { $modify = true; $catid = $vars['catid']; $category = $phpcdb->get_category($catid); if (!(empty($category['cid']) && is_admin() || $phpcdb->get_calendar($category["cid"])->can_admin())) { soft_error(__("You do not have permission to modify this category.")); } $phpcdb->modify_category($catid, $vars['name'], $text_color, $bg_color, $gid); } $page = "{$phpc_script}?action=cadmin&phpcid=" . $vars['phpcid']; if ($modify) { return message_redirect(__("Modified category: ") . $catid, $page); } if ($catid > 0) { return message_redirect(__("Created category: ") . $catid, $page); } return tag('div', attributes('class="phpc-error"'), __('Error submitting category.')); }
function check_theme_config($posts) { unset($posts['style']); foreach ($posts as $k => $v) { if (!check_color($v)) { form_ajax_failed('text', lang('style_' . $k) . ' ' . $v . ': ' . lang('not_aliable_color')); } } }
function sevenleague_adminpanel() { global $themename, $shortname, $options, $mess, $fonts, $slider, $menus, $allslider_sliders, $socials, $social_icons_dir, $used_colors, $used_fonts; if (isset($_REQUEST['saved'])) { if ($_REQUEST['saved']) { echo '<div id="message" class="updated fade"><p><strong>Settings saved.</strong></p></div>'; } } if (isset($_REQUEST['reset'])) { if ($_REQUEST['reset']) { echo '<div id="message" class="updated fade"><p><strong>Settings reset.</strong></p></div>'; } } add_action('admin_init', 'editor_admin_init'); add_action('admin_head', 'editor_admin_head'); function editor_admin_init() { wp_enqueue_script('word-count'); wp_enqueue_script('post'); wp_enqueue_script('editor'); wp_enqueue_script('media-upload'); } function editor_admin_head() { // wp_tiny_mce(); } $vtabcounter = 1; $zz = ""; $iii = ""; ?> <link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?> /jquery-ui.css" /> <script type="text/javascript"> jQuery(document).ready(function($) { jQuery('.upload_image_button').click(function() { formfield = jQuery('.upload_image_<?php echo $zz; ?> ').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); return false; }); var actTab=1; <?php if (isset($_REQUEST['currTab'])) { if ($_REQUEST['currTab']) { ?> var actTab=<?php echo $_REQUEST['currTab']; ?> ; <?php } else { ?> var actTab=1; <?php } } ?> if(actTab) { jQuery(".tabcontent").css("display","none"); jQuery(".tabContainer #tab_content_"+actTab).css("display","block"); } jQuery(".src_image").click(function() { var trigger; trigger=jQuery(this).prev().prev().attr('id'); var url="<?php echo get_template_directory_uri(); ?> /7league/load_bg.php?url=<?php echo get_template_directory_uri(); ?> &trigger="+trigger; jQuery("#src_load").load(url, function() { jQuery("#src_load").dialog({modal:true,minWidth: 800,maxHeight: 400, height:500 }); }); }); jQuery("#moresocial").click(function() { var sm1=jQuery("#sminput_1").val(); var sm2=jQuery("#sminput_2").val(); var insert_1="<a class='social_media social_icon "+sm1+" ' href='"+sm2+"' target='_blank'><img src='<?php echo get_stylesheet_directory_uri(); ?> /images/<?php echo $social_icons_dir; ?> /"+sm1+".png' alt='' /></a>"; jQuery("#social_movecontainer").append('<li class="social_move">'+insert_1+'<input name="<?php echo $shortname; ?> _social_media[]" type="hidden" value="'+insert_1+'" /><a href="#" class="remove_social" title="Remove Item">X</a></li>'); return false; }); }); </script> <div class="wrap"> <div id="optionsPage"> <h2>Theme settings</h2> <?php $i = 1; $used_colors = array(); ?> <p><?php echo $mess; ?> </p> <div class="tabscontainer"> <div class="tabs"> <div class="tab <?php if (isset($_REQUEST['currTab'])) { if ($_REQUEST['currTab'] == "" or $_REQUEST['currTab'] == "1") { echo " selected "; } } ?> first" id="tab_menu_<?php echo "1"; ?> "> <div class="link">General</div> <div class="arrow"></div> </div> <div class="tab tab-less"> <div class="link">Sections</div> <div class="arrow"></div> </div> <?php foreach ($options as $value) { if ($value['type'] == "newvtab") { $i++; ?> <div class="tab<?php if (isset($_REQUEST['currTab'])) { if ($_REQUEST['currTab'] == $i) { echo " selected "; } } ?> " id="tab_menu_<?php echo $i; ?> "> <div class="link"><?php echo $value['name']; ?> </div> <div class="arrow"></div> </div> <?php } } ?> </div> <div class="tabContainer"> <form method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="save" /> <input type="hidden" name="currTab" value="<?php echo $vtabcounter; ?> " /> <div class="tabcontent" id="tab_content_1" style="display:block"> <?php foreach ($options as $value) { $iii++; switch ($value['type']) { case "newvtab": $vtabcounter++; ?> </div> </form> <form method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="save" /> <input type="hidden" name="currTab" value="<?php echo $vtabcounter; ?> " /> <div class="tabcontent" id="tab_content_<?php echo $vtabcounter; ?> "> <?php break; case "newtab": ?> <div class="tab"> <?php break; case "endtab": ?> </div><!-- close Tab --> <?php break; case "open": ?> <div class="admin-options"> <?php break; case "close": ?> <button class="button-primary"> Save </button> </div> <?php break; case "title": ?> <h3 class="taber" ><?php echo $value['name']; ?> </h3> <?php break; case 'info': ?> <div class="options-line"> <div class="info"> <p><?php echo $value['desc']; ?> </p> </div> </div> <?php break; case 'space': ?> <div class="options-line space"> <h3><?php echo $value['name']; ?> </h3> </div><div class="options-line2 space"></div> <?php break; case 'sidebar': ?> <div> <ul> <?php foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) { ?> <?php // echo "<li>". $sidebar['name'] . "</li>"; ?> <?php } $sidebars = get_option($value['id']); ?> <h3>Existing Sidebars</h3> <?php $z = 0; for ($i = 0; $i < count($sidebars); $i++) { if (isset($sidebars[$i])) { if ($sidebars[$i] != "") { $z = "1"; ?> <li class="sidebar_entry"> <input type="hidden" name="<?php echo $shortname; ?> _sidebars[]" value="<?php echo $sidebars[$i]; ?> " /><a href='#' class='del_sidebar'><img src="<?php echo get_stylesheet_directory_uri(); ?> /7league/images/trash.png" width="16px" height="16px" title="Delete Sidebar" alt="Delete"></a><span><?php echo $sidebars[$i]; ?> </span> </li> <?php } } } ?> <?php if ($z == "0") { echo "<div class='info'>There are no Sidebars to display</div>"; } ?> </ul> </div> <div class="options-line"> <h3>Create a new Sidebar</h3> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"><input style="width:400px;" name="<?php echo $value['id']; ?> []" id="<?php echo $value['id']; ?> " type="<?php echo $value['type']; ?> " /></label><input type="submit" value="Save" /></div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case 'sidebar-dropdown': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"> <?php $sidebarx = ""; foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) { $sidebarx[] = $sidebar['id']; $sidebarname[] = $sidebar['name']; } $actval = get_option($value['id']); ?> <select name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " /> <option></option> <?php for ($i = 0; $i < count($sidebarx); $i++) { $actgoal = $sidebarx[$i]; if ($sidebarx[$i] != "") { echo "<option value='" . $sidebarx[$i] . "' "; if ($actval == $actgoal) { echo " selected "; } echo ">" . $sidebarname[$i] . "</option> "; } } ?> </select> </label></div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case 'fulltime': ?> <div class="options-line"> <div class="options-left"><?php echo $value['name']; ?> </div> <div class="options-right"> <b>The Time:</b><br /><br /> <input maxlength="2" style="width:20px;" name="<?php echo $value['id']; ?> _hour" id="<?php echo $value['id']; ?> _hour" value="<?php echo get_option($value['id'] . "_hour"); ?> " /> The Hours (01,02,...,23)<br /> <input maxlength="2" style="width:20px;" name="<?php echo $value['id']; ?> _minute" id="<?php echo $value['id']; ?> _minute" value="<?php echo get_option($value['id'] . "_minute"); ?> " /> The Minutes (01,02,...,59)<br /> <input maxlength="2" style="width:20px;" name="<?php echo $value['id']; ?> _second" id="<?php echo $value['id']; ?> _second" value="<?php echo get_option($value['id'] . "_second"); ?> " /> The Seconds (01,02,...,59) <br /><br /><br /> <b>The Date:</b><br /><br /> <input maxlength="2" style="width:20px;" name="<?php echo $value['id']; ?> _day" id="<?php echo $value['id']; ?> _day" value="<?php echo get_option($value['id'] . "_day"); ?> " /> The Day (01,14,21,...)<br /> <input maxlength="2" style="width:20px;" name="<?php echo $value['id']; ?> _month" id="<?php echo $value['id']; ?> _month" value="<?php echo get_option($value['id'] . "_month"); ?> " /> The Month (01,02,...,12)<br /> <input maxlength="4" style="width:40px;" name="<?php echo $value['id']; ?> _year" id="<?php echo $value['id']; ?> _year" value="<?php echo get_option($value['id'] . "_year"); ?> " /> The Year (2012, 2014, ...) </div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case 'text': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"><div class='clear-value'>x</div><input style="width:400px;" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="<?php echo $value['type']; ?> " value="<?php if (get_option($value['id']) != "") { echo esc_attr(get_option($value['id'])); } ?> " /></label></div> </div> <div class="options-line2"><?php if (isset($value['desc'])) { echo $value['desc']; } ?> </div> <?php break; case 'template': ?> <div class="options-line"> <div class="options-left"><?php echo $value['name']; ?> </div> <div class="options-right"> <input name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="hidden" value="<?php if (get_option($value['id']) != "") { $echo = get_option($value['id']); } else { $echo = $value['std']; } echo $echo; ?> " /> <div class="template_entry <?php if ($echo == "page-sidebar-no-sidebar") { echo "active"; } ?> "> <img src="<?php echo get_template_directory_uri(); ?> /images/template_no.jpg" alt="No Sidebar" data-val="page-sidebar-no-sidebar" /> </div> <div class="template_entry <?php if ($echo == "page-sidebar-left") { echo "active"; } ?> "> <img src="<?php echo get_template_directory_uri(); ?> /images/template_l.jpg" alt="Sidebar Left" data-val="page-sidebar-left" /> </div> <div class="template_entry <?php if ($echo == "page-sidebar-right") { echo "active"; } ?> "> <img src="<?php echo get_template_directory_uri(); ?> /images/template_r.jpg" alt="Sidebar Right" data-val="page-sidebar-right" /> </div> <div class="clear"></div> </div> </div> <div class="options-line2">Please choose your Template / Sidebar - Positions for this Page</div> <?php break; case 'text-range': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"><input step="10" max="<?php echo $value['max']; ?> " min="<?php echo $value['min']; ?> " style="width:400px;" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } else { echo $value['std']; } ?> " onInput="<?php echo $value['id']; ?> _val.value=value" ><output name="<?php echo $value['id']; ?> _val"><?php echo get_option($value['id']); ?> px</output></label></div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case 'slider_dropdown': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></div> <div class="options-right"> <select name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> "><option></option> <?php for ($i = 0; $i < count($slider); $i++) { ?> <option value="<?php echo $slider[$i]; ?> " <?php if (get_option($value['id']) == $slider[$i]) { echo " selected "; } ?> ><?php echo $slider[$i]; ?> </option><?php } ?> </select> </div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case 'social': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right" id="social_container"> Your Network: <select name="sminput_1" id="sminput_1"> <?php for ($i = 0; $i < count($socials); $i++) { echo "<option value='" . $socials[$i] . "'>" . $socials[$i] . "</option>"; } ?> </select> The Link to your Profile: <input type="text" name="sminput_2" id="sminput_2"/><a href="#" class="button" id="moresocial"> Add</a><br /> </div> </div> <div id="media_list"> <div class="options-line space"> <h3>Existing Social Medias:</h3> </div><div class="options-line2 space"></div> <ul id="social_movecontainer"> <input type="hidden" name="<?php echo $shortname; ?> _social_media[]" /> <?php if (get_option($value['id']) != "") { $vals = get_option($value['id']); } if (isset($vals)) { for ($i = 0; $i < count($vals); $i++) { if ($vals[$i] != "") { echo "<li class='social_move'>" . stripslashes($vals[$i]); ?> <input type="hidden" name="<?php echo $shortname; ?> _social_media[]" value="<?php echo stripslashes($vals[$i]); ?> " /> <a href="#" class="remove_social" title="Remove Item">X</a> </li> <?php $cvals = count($vals); } } } ?> </ul> <?php if (isset($cvals)) { if ($cvals < "1") { echo "<div class='info'><p>You dont have defined Social Media Links. Please use the Area above to define your Social Media Profiles</p></div>"; } } ?> </div> <div class="options-line2"></div> <?php break; case 'slider-value': ?> <?php $zz++; ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.upload_image_button_<?php echo $zz; ?> ').click(function() { formfield = jQuery('.upload_image_<?php echo $zz; ?> ').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); window.send_to_editor=window.send_to_editor_<?php echo $zz; ?> ; return false; }); window.send_to_editor_<?php echo $zz; ?> = function(html) { imgurl = jQuery('img',html).attr('src'); jQuery('#<?php echo $value['id']; ?> ').val(imgurl); tb_remove(); } }); </script> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"><div class='clear-value'>x</div><input style="width:400px;" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="text" value="<?php if (get_option($value['id']) != "") { echo esc_attr(get_option($value['id'])); } else { echo $value['std']; } ?> " /></label> <div>Picturesets: <?php foreach ((array) $allslider_sliders as $sliderid => $slid) { ?> <a href="#" class='exist_sliders' onclick="jQuery('#<?php echo $value['id']; ?> ').val('<?php echo $slid[name]; ?> '); return false;"><?php echo $slid[name]; ?> </a> <?php } ?> </div><input class="upload_image_button_<?php echo $zz; ?> " type="button" value="Upload Image" /> </div> </div> <div class="options-line2">Please choose your Header - Value. Note: if you choose one of the Slider, please select one of the defined Picturesets. If you want to use a Image, click one the >Upload Picture< Button, than you can choose an uploaded Picture or upload a new one. If you want to show the >Script< Header, insert a Word of your choice.</div> <?php break; case 'text-color': ?> <div class="options-line color_opts"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></div> <div class="options-right"><div class='clear-value'>x</div> <input class="font-color color{required:false, hash:true,pickerClosable:true, adjust:false}" style="width:100px;" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="text" value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } ?> " /> <div class='color_previewer'></div> <span><?php echo $value['desc']; ?> </span> </div> </div> <div class="options-line2"></div> <?php if (check_color(get_option($value['id']), $used_colors) != "") { $used_colors[] = get_option($value['id']); } break; case 'textarea': if (get_option($value['id']) != "") { $echo = stripslashes(get_option($value['id'])); } else { $echo = $value['std']; } $edit_id = $value['id']; ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"> <?php if (isset($value['editor'])) { if ($value['editor'] == true) { // the_editor("$echo",$value['id'], "", true,"1"); ?> </label></div><?php } } else { ?> <div class='clear-value'>x</div><textarea name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " style="width:400px; height:200px;" type="<?php echo $value['type']; ?> " cols="" rows=""><?php if (get_option($value['id']) != "") { echo esc_html(stripslashes(get_option($value['id']))); } ?> </textarea></label></div> <?php } ?> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case 'select': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"><select style="width:240px;" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> "><?php foreach ($value['options'] as $option) { ?> <option<?php if (get_option($value['id']) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?> ><?php echo $option; ?> </option><?php } ?> </select></label></div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case "checkbox": ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </div> <div class="options-right"> <?php if (get_option($value['id']) == "on") { $checked = " checked='checked' "; $cclass = " checked"; } else { $checked = ""; $cclass = " unchecked"; } ?> <div class="checkboxfake <?php echo $cclass; ?> "></div> <input type="hidden" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " value="<?php if (get_option($value['id']) != "") { echo esc_attr(get_option($value['id'])); } else { echo $value['std']; } ?> " /><?php if (isset($value['desc'])) { echo $value['desc']; } ?> </label> </div> </div> <div class="options-line2"></div> <?php break; case 'dropdown': ?> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></div> <div class="options-right"> <select name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " /> <?php for ($i = 0; $i < count($value['value']); $i++) { ?> <option value="<?php echo $value['value'][$i]; ?> " <?php if (trim(get_option($value['id'])) == $value['value'][$i]) { echo " selected"; } ?> ><?php echo $value['value'][$i]; ?> </option> <?php } ?> </select> </div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php break; case "font": ?> <div class="options-line color_opts font_opts"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></div> <div class="options-right"><?php if (get_option($value['id'])) { $checked = "checked=\"checked\""; } else { $checked = ""; } ?> <select class="font_dropdown" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " /> <option></option> <?php if (count($used_fonts != "")) { ?> <option disabled><b>---Used Fonts---</b></option><?php for ($i = 0; $i < count($used_fonts); $i++) { ?> <option value="<?php echo $used_fonts[$i]; ?> "><?php echo $used_fonts[$i]; ?> </option><?php } } ?> <option></option><option disabled><b>---Standart Fonts---</b></option><?php for ($i = 0; $i < count($fonts); $i++) { ?> <option value="<?php echo $fonts[$i]; ?> " <?php if ($fonts[$i] == get_option($value['id']) or $fonts[$i] == $value['std'] and get_option($value['id']) == "") { echo " selected"; } if ($fonts[$i] == "---Google Webfonts---" or $fonts[$i] == "---Cufon Fonts---") { echo " disabled"; } ?> ><?php echo $fonts[$i]; ?> </option> <?php } ?> </select> <?php if (get_option($value['id'])) { ?> <script type="text/javascript"> jQuery(document).ready(function($) { var link = ("<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=<?php echo get_option($value['id']); ?> ' media='screen' />"); $("head").append(link); }); </script><?php $f = get_option($value['id']); } break; case "fontsize": ?> <input class='font-size' type="text" name="<?php echo $value['id']; ?> " value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } else { echo $value['std']; } ?> " > px <?php $siz = get_option($value['id']); break; case "fontcolor": ?> <div class='clear'></div> <div class='clear-value'>x</div> <input type="text" class="font-color color{required:false, hash:true,pickerClosable:true, adjust:false}" name="<?php echo $value['id']; ?> " value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } ?> "> Fontcolor <div class='color_previewer'></div> <?php $col = get_option($value['id']); ?> <div class='font-pre'><span><strong>Preview: </strong></span> <span class='font_preview' style="font-family:<?php echo $f; ?> ; color:<?php echo $col; ?> ; font-size:<?php if ($siz) { echo $siz; } else { echo "15"; } ?> px; ">Lorem Ipsum Dolor</span></div></div> </div> <div class="options-line2"><?php echo $value['desc']; ?> </div> <?php if (check_color(get_option($value['id']), $used_colors) != "") { $used_colors[] = get_option($value['id']); } $col = ""; $siz = ""; $f = ""; break; case "fontbgcolor": ?> <input type="text" class="font-color color{required:false, hash:true,pickerClosable:true, adjust:false}" name="<?php echo $value['id']; ?> " value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } else { echo $value['std']; } ?> "> Backgroundcolor <?php break; case "file": ?> <?php $zz++; ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.upload_image_button_<?php echo $zz; ?> ').click(function() { formfield = jQuery('.upload_image_<?php echo $zz; ?> ').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); window.send_to_editor=window.send_to_editor_<?php echo $zz; ?> ; return false; }); window.send_to_editor_<?php echo $zz; ?> = function(html) { imgurl = jQuery('img',html).attr('src'); jQuery('.upload_image_<?php echo $zz; ?> ').val(imgurl); tb_remove(); } }); </script> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></div> <div class="options-right"> <div class='clear-value'>x</div><input id="<?php echo $value['id']; ?> " class="upload_image upload_image_<?php echo $zz; ?> " type="text" size="36" name="<?php echo $value['id']; // upload_image ?> " value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } ?> " /> <input class="upload_image_button_<?php echo $zz; ?> " type="button" value="Upload Image" /> </div> </div> <div class="options-line2"><?php echo $value['desc']; ?> <div class='upload_preview'> <?php if (get_option($value['id']) != "") { ?> <p><strong>Preview:</strong></p> <img src="<?php echo get_option($value['id']); ?> " alt="Your Upload" /><?php } ?> </div> </div> <?php break; case "background": ?> <?php $zz++; ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.upload_image_button_<?php echo $zz; ?> ').click(function() { formfield = jQuery('.upload_image_<?php echo $zz; ?> ').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); window.send_to_editor=window.send_to_editor_<?php echo $zz; ?> ; return false; }); window.send_to_editor_<?php echo $zz; ?> = function(html) { imgurl = jQuery('img',html).attr('src'); jQuery('.upload_image_<?php echo $zz; ?> ').val(imgurl); tb_remove(); } }); </script> <div class="options-line"> <div class="options-left"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></div> <div class="options-right"> <div class='clear-value'>x</div><input id="<?php echo $value['id']; ?> " class="upload_image_<?php echo $zz; ?> " type="text" size="36" name="<?php echo $value['id']; ?> " value="<?php echo get_option($value['id']); ?> " /> <input class="upload_image_button_<?php echo $zz; ?> " type="button" value="Upload Image" /> <input class="src_image" type="button" value=" Sample " /> <?php if (get_option($value['id']) != "") { $url = get_option($value['id']); } break; case "background-x": ?> <div> <span>Y-Axis: </span> <select name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " > <option value="top" <?php if (get_option($value['id']) == "top") { echo " selected"; } ?> >Top</> <option value="center" <?php if (get_option($value['id']) == "center") { echo " selected"; } ?> >Center</> <option value="bottom" <?php if (get_option($value['id']) == "bottom") { echo " selected"; } ?> >Bottom</> </select> <?php $x = get_option($value['id']); break; case "background-y": ?> <span>X-Axis: </span> <select name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " > <option value="left" <?php if (get_option($value['id']) == "left") { echo " selected"; } ?> >Left</> <option value="right" <?php if (get_option($value['id']) == "right") { echo " selected"; } ?> >Right</> <option value="center" <?php if (get_option($value['id']) == "center") { echo " selected"; } ?> >Center</> </select> <?php $y = get_option($value['id']); break; case "background-repeat": ?> <span>Background-Repeat: </span> <select name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " > <option value="repeat-x" <?php if (get_option($value['id']) == "repeat-x") { echo " selected"; } ?> >X</> <option value="repeat-y" <?php if (get_option($value['id']) == "repeat-y") { echo " selected"; } ?> >Y</> <option value="" <?php if (get_option($value['id']) == "") { echo " selected"; } ?> >All</> <option value="no-repeat" <?php if (get_option($value['id']) == "no-repeat") { echo " selected"; } ?> >No Repeat</> </select> <?php $rep = get_option($value['id']); break; case "background-fix": if (get_option($value['id']) == "on") { $checked = " checked='checked' "; $cclass = " checked"; } else { $checked = ""; $cclass = " unchecked"; } ?> <br /><br /> <div class="checkboxfake <?php echo $cclass; ?> " ><span style="margin-left:20px;">Background Fix</span></div> <input type="hidden" name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " value="<?php if (get_option($value['id']) != "") { echo esc_attr(get_option($value['id'])); } else { echo $value['std']; } ?> " /> </div> </div> </div> <div class="options-line2"> <?php if (isset($url)) { if ($url != "") { ?> <p><strong>Preview:</strong></p> <div style="width:100%; height:100px; max-width:500px; background:url(<?php echo $url; ?> ) <?php echo $x . " " . $y . " " . $rep; ?> ;"></div> <?php } } ?> </div> <?php $url = ""; $x = ""; $y = ""; $rep = ""; break; case "cufon": $cufon_fonts = get_option("cufon_fonts"); $ch1 = get_option($shortname . "_cufon_h1"); $ch2 = get_option($shortname . "_cufon_h2"); $ch3 = get_option($shortname . "_cufon_h3"); if (!is_array($cufon_fonts)) { ?> <div class='info'>Note: There are no Cufon Fonts. Please go to "Font Upload and add some Cufon Fonts.</div><?php } else { ?> <div class="options-line"> <div class="options-left">Cufon H1 Replace</div> <div class="options-right"> <select name="<?php echo $shortname; ?> _cufon_h1" id="<?php echo $shortname; ?> _cufon_h1"> <option></option> <?php $s = 0; $sname = $shortname . "_cufon_h1"; foreach ((array) $cufon_fonts as $font => $fata) { $s++; echo '<option value="' . stripslashes($fata['name']) . '"'; if ($fata['name'] == $ch1) { echo " selected "; } echo '>' . stripslashes($fata['name']) . '</option>'; } ?> </select> </div> </div> <div class="options-line2"> </div> <div class="options-line"> <div class="options-left">Cufon H2 Replace</div> <div class="options-right"> <select name="<?php echo $shortname; ?> _cufon_h2" id="<?php echo $shortname; ?> _cufon_h2"> <option></option> <?php $sname = $shortname . "_cufon_h2"; if (is_array($cufon_fonts)) { foreach ((array) $cufon_fonts as $font => $fata) { echo '<option value="' . stripslashes($fata['name']) . '"'; if ($fata['name'] == $ch2) { echo " selected "; } echo '>' . stripslashes($fata['name']) . '</option>'; } } ?> </select> </div> </div> <div class="options-line2"> </div> <div class="options-line"> <div class="options-left">Cufon H3 Replace</div> <div class="options-right"> <select name="<?php echo $shortname; ?> _cufon_h3" id="<?php echo $shortname; ?> _cufon_h3"> <option></option> <?php $sname = $shortname . "_cufon_h3"; foreach ((array) $cufon_fonts as $font => $fata) { echo '<option value="' . stripslashes($fata['name']) . '"'; if ($fata['name'] == $ch3) { echo " selected "; } echo '>' . stripslashes($fata['name']) . '</option>'; } ?> </select> </div> </div> <div class="options-line2"> </div> <?php } break; } } ?> </div> </div> <div style="clear:both;"></div> </div><!-- Tabs--> </div><!-- Tabscontainer--> </form> <form method="post"> <p class="submit"> <input type="hidden" name="action" value="reset" /> <input id="reset_options" name="reset" type="submit" value="Reset" /> </p> </form> <div id="src_load"></div> </div><!-- optionsPage--> <?php $out = ""; for ($i = 0; $i < count($used_colors); $i++) { $mycol = $used_colors[$i]; $out .= "<div class='used_color_picker' data-color='{$mycol}' style='background:{$used_colors[$i]}'></div>"; } $out .= "<div class='clear'></div>"; ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.color_opts').hover(function() { jQuery(this).stop().find(".color_previewer").show(); jQuery(this).find(".color_previewer").html("<?php echo $out; ?> "); }, function() { jQuery(this).find(".color_previewer").stop().delay('0').fadeOut(); } ); jQuery('.used_color_picker').live('click',function() { var col=jQuery(this).data('color'); jQuery(this).parent().prev().val(col).css('backgroundColor',col); //jQuery(this).parent().hide(); }); }); </script> <?php }
function save_watermark() { need_login('ajax_box'); $watermark_type = $this->getPost('watermark_type', '0'); $watermark = $this->getPost('watermark'); if (!isset($watermark['water_mark_pos'])) { $watermark['water_mark_pos'] = 5; } if ($watermark_type == 1) { if ($watermark['water_mark_image'] == '') { form_ajax_failed('box', lang('water_mark_image_error')); } if ($watermark['water_mark_opacity'] < 0 || $watermark['water_mark_opacity'] > 100) { form_ajax_failed('box', lang('water_mark_opacity_error')); } $this->setting->set_conf('watermark.water_mark_image', $watermark['water_mark_image']); $this->setting->set_conf('watermark.water_mark_opacity', $watermark['water_mark_opacity']); $this->setting->set_conf('watermark.water_mark_pos', $watermark['water_mark_pos']); } elseif ($watermark_type == 2) { if ($watermark['water_mark_string'] == '') { form_ajax_failed('box', lang('water_mark_string_error')); } if ($watermark['water_mark_fontsize'] < 1) { form_ajax_failed('box', lang('water_mark_fontsize_error')); } if (!check_color($watermark['water_mark_color'])) { form_ajax_failed('box', lang('water_mark_color_error')); } if (!isset($watermark['water_mark_font']) || !$watermark['water_mark_font']) { form_ajax_failed('box', lang('water_mark_font_error')); } if ($watermark['water_mark_angle'] < 0 || $watermark['water_mark_angle'] > 360) { form_ajax_failed('box', lang('water_mark_angle_error')); } if ($watermark['water_mark_opacity'] < 0 || $watermark['water_mark_opacity'] > 100) { form_ajax_failed('box', lang('water_mark_opacity_error')); } $this->setting->set_conf('watermark.water_mark_string', $watermark['water_mark_string']); $this->setting->set_conf('watermark.water_mark_fontsize', $watermark['water_mark_fontsize']); $this->setting->set_conf('watermark.water_mark_color', $watermark['water_mark_color']); $this->setting->set_conf('watermark.water_mark_font', $watermark['water_mark_font']); $this->setting->set_conf('watermark.water_mark_angle', $watermark['water_mark_angle']); $this->setting->set_conf('watermark.water_mark_opacity', $watermark['water_mark_opacity']); $this->setting->set_conf('watermark.water_mark_pos', $watermark['water_mark_pos']); } $this->setting->set_conf('watermark.type', $watermark_type); form_ajax_success('box', lang('save_setting_success'), null, 0.5, $_SERVER['HTTP_REFERER']); }
function story_lines_meta_box_save($post_id) { global $float_array; if (!isset($_POST['story_lines_meta_box_nonce']) || !wp_verify_nonce($_POST['story_lines_meta_box_nonce'], 'story_lines_meta_box_nonce')) { return; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!current_user_can('edit_post', $post_id)) { return; } $old = get_post_meta($post_id, 'story_lines_highlights', true); $new = array(); $lines = $_POST['story_lines_highlight']; $num = count($lines); if (isset($_POST['story_lines_title'])) { update_post_meta($post_id, 'story_lines_title', sanitize_text_field(wp_filter_nohtml_kses($_POST['story_lines_title']))); } if (isset($_POST['story_lines_size'])) { update_post_meta($post_id, 'story_lines_size', wp_filter_nohtml_kses(intval($_POST['story_lines_size']))); } if ($_POST['story_lines_float'] && array_key_exists($_POST['story_lines_float'], $float_array)) { update_post_meta($post_id, 'story_lines_float', wp_filter_nohtml_kses($_POST['story_lines_float'])); } $title_bg_color = trim($_POST['story_lines_title_background']); $title_bg_color = strip_tags(stripslashes($title_bg_color)); if (TRUE === check_color($title_bg_color)) { update_post_meta($post_id, 'story_lines_title_background', $title_bg_color); } $main_bg_color = trim($_POST['story_lines_main_background']); $main_bg_color = strip_tags(stripslashes($main_bg_color)); if (TRUE === check_color($main_bg_color)) { update_post_meta($post_id, 'story_lines_main_background', $main_bg_color); } $title_color = trim($_POST['story_lines_title_color']); $title_color = strip_tags(stripslashes($title_color)); if (TRUE === check_color($title_color)) { update_post_meta($post_id, 'story_lines_title_color', $title_color); } $main_color = trim($_POST['story_lines_main_color']); $main_color = strip_tags(stripslashes($main_color)); if (TRUE === check_color($main_color)) { update_post_meta($post_id, 'story_lines_main_color', $main_color); } for ($i = 0; $i < $num; $i++) { if (isset($lines[$i])) { $new[$i]['story_lines_highlight'] = sanitize_text_field(wp_filter_nohtml_kses($lines[$i])); } } if (!empty($new) && $new != $old) { update_post_meta($post_id, 'story_lines_highlights', $new); } elseif (empty($new) && $old) { delete_post_meta($post_id, 'story_lines_highlights', $old); } }
function jm_breaking_news_save_box($post_id) { global $posts_array; if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!isset($_POST['meta_box_nonce']) || !wp_verify_nonce($_POST['meta_box_nonce'], 'jm_breaking_news_nonce')) { return; } if (!current_user_can('edit_post')) { return; } if (isset($_POST['jm_breaking_news_in_ex']) && $_POST['jm_breaking_news_in_ex'] && $_POST['jm_breaking_news_in_ex'] == 1) { $check = 1; } else { $check = 0; } update_post_meta($post_id, 'jm_breaking_news_in_ex', $check); if (isset($_POST['jm_breaking_news_link'])) { update_post_meta($post_id, 'jm_breaking_news_link', wp_filter_nohtml_kses($_POST['jm_breaking_news_link'])); } if (isset($_POST['jm_breaking_news_limit'])) { update_post_meta($post_id, 'jm_breaking_news_limit', intval(esc_attr($_POST['jm_breaking_news_limit']))); } if (isset($_POST['jm_breaking_news_target']) && $_POST['jm_breaking_news_target']) { $check = 1; } else { $check = 0; } update_post_meta($post_id, 'jm_breaking_news_target', $check); if (isset($_POST['jm_breaking_news_internal_link']) && array_key_exists($_POST['jm_breaking_news_internal_link'], $posts_array)) { update_post_meta($post_id, 'jm_breaking_news_internal_link', wp_filter_nohtml_kses($_POST['jm_breaking_news_internal_link'])); } $background = trim($_POST['jm_breaking_news_color']); $background = strip_tags(stripslashes($background)); if (TRUE === check_color($background)) { update_post_meta($post_id, 'jm_breaking_news_color', $background); } }