Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- This is to show a live preview of modification -- Da qui si lavora per attivare una preview in tempo reale delle modifiche -->
- <?php
- function appaqua_get_site_preview() {
- check_ajax_referer("site_preview"); ?>
- <iframe id="themepreview" name="themepreview" src="<?php echo get_option('appaqua_pama'); ?>/?preview=1"></iframe>
- <?php die();
- };?>
- <?php add_action('wp_ajax_site_preview', 'appaqua_get_site_preview');?>
- <?php $nonce = wp_create_nonce('site_preview'); ?>
- <script type="text/javascript">
- jQuery(document).ready(function () {
- jQuery("#$appaqua_zona1y").change(function() {// if a user changed the y-Axis
- check_preview_refresh();
- }
- );
- jQuery("#$appaqua_zona1x").change(function() {// if a user changed the x-Axis
- check_preview_refresh();
- }
- );
- });
- function check_preview_refresh(){
- if (jQuery("#zona1y").val() != '' && jQuery("#zona1x").val() != '' ){
- jQuery.ajax({
- type: "post",url: "admin-ajax.php",data: { action: 'site_preview', _ajax_nonce: '<?php echo $nonce; ?>' },
- success: function(html){
- jQuery("#themepreview").html(html);
- jQuery("#themepreview").show();
- }
- });
- }
- }
- </script>
- <!-- Fine della zona per la preview -- End of Preview Script -->
- <?php
- // Pannello di controllo inizio
- $themename = "Pannello Appartamenti Acquario";
- $shortname = "appaqua";
- $categories = get_categories('hide_empty=0&orderby=name');
- $wp_cats = array();
- foreach ($categories as $category_list ) {
- $wp_cats[$category_list->cat_ID] = $category_list->cat_name;
- }
- array_unshift($wp_cats, "Scegli una categoria");
- $options = array (
- array( "name" => $themename." Options",
- "type" => "title"),
- array( "name" => "Prima di cominciare",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Link pagina mappa",
- "desc" => "Inserisci il link alla pagina della mappa",
- "id" => $shortname."_pama",
- "type" => "text",
- "std" => "Inserisci il link qui"),
- array( "type" => "close"),
- array( "name" => "General",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Logo URL",
- "desc" => "Inserisci il link all'immagine del tuo logo",
- "id" => $shortname."_logo",
- "type" => "text",
- "std" => ""),
- array( "type" => "close"),
- array( "name" => "Homepage",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Homepage Immagine Slide 1",
- "desc" => "Inserisci il link alla prima immagine degli slide",
- "id" => $shortname."_header_img",
- "type" => "text",
- "std" => "http://nextube.info/images/ImmijQuery/image-1.jpg"),
- array( "name" => "Homepage Immagine Slide 2",
- "desc" => "Inserisci il link alla seconda immagine degli slide",
- "id" => $shortname."_header_img2",
- "type" => "text",
- "std" => "http://nextube.info/images/ImmijQuery/image-2.jpg"),
- array( "name" => "Homepage Immagine Slide 3",
- "desc" => "Inserisci il link alla terza immagine degli slide",
- "id" => $shortname."_header_img3",
- "type" => "text",
- "std" => "http://nextube.info/images/ImmijQuery/image-3.jpg"),
- array( "name" => "Homepage Immagine Slide 4",
- "desc" => "Inserisci il link alla quarta immagine degli slide",
- "id" => $shortname."_header_img4",
- "type" => "text",
- "std" => "http://nextube.info/images/ImmijQuery/image-4.jpg"),
- array( "name" => "Homepage Immagine Slide 5",
- "desc" => "Inserisci il link alla quinta immagine degli slide",
- "id" => $shortname."_header_img5",
- "type" => "text",
- "std" => "http://nextube.info/images/ImmijQuery/image-5.jpg"),
- array( "name" => "Homepage Immagine Slide 6",
- "desc" => "Inserisci il link alla sesta immagine degli slide",
- "id" => $shortname."_header_img6",
- "type" => "text",
- "std" => "http://nextube.info/images/ImmijQuery/image-6.jpg"),
- array( "type" => "close"),
- array( "name" => "Footer",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Google Analytics Code",
- "desc" => "Inserisci il tuo codice Google Analytics per tracciare le visite che ricevi.",
- "id" => $shortname."_ga_code",
- "type" => "textarea",
- "std" => ""),
- array( "type" => "close"),
- array( "name" => "Social",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Indirizzo Feed",
- "desc" => "Feedburner รจ un sistema fornito da Google per ottimizzare la distribuzione dei tuoi feed, inserisci qui il link al tuo feed",
- "id" => $shortname."_feedburner",
- "type" => "text",
- "std" => get_bloginfo('rss2_url')),
- array( "name" => "Facebook URL",
- "desc" => "Inserisci il link alla tua pagina Facebook",
- "id" => $shortname."_facebook",
- "type" => "text",
- "std" => "http://facebook.com/pages/Downloadtaky/325661998362"),
- array( "name" => "Twitter URL",
- "desc" => "Inserisci il link al tuo account Twitter",
- "id" => $shortname."_twitter",
- "type" => "text",
- "std" => "http://twitter.com/downloadtaky"),
- array( "type" => "close"),
- array( "name" => "Punti sulla mappa",
- "type" => "section"),
- array( "type" => "open"),
- /** Copia da qui per aggiungere un nuovo punti - start copy to add a new point on the map **/
- array( "name" => "Zona 1",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Attivare zona 1?",
- "desc" => "Seleziona se vuoi il primo fermaposto",
- "id" => $shortname."_zona1c",
- "type" => "checkbox",
- "std" => "false"),
- array( "name" => "Zona 1 Asse x",
- "desc" => "Scegli dove posizionare il primo punto, se attivato asse x",
- "id" => $shortname."_zona1x",
- "type" => "text",
- "std" => "Left:???"),
- array( "name" => "Zona 1 Asse y",
- "desc" => "Scegli dove posizionare il primo punto, se attivato asse y",
- "id" => $shortname."_zona1y",
- "type" => "text",
- "std" => "Top:???"),
- array( "name" => "Zona 1 URL",
- "desc" => "Inserisci il link al post della zona 1",
- "id" => $shortname."_zona1l",
- "type" => "text",
- "std" => "Indirizzo del post qui"),
- array( "type" => "close"),
- /** Copia fino a qui e rinomina progressivamente in zona2, zona3, zona4 ecc -- Copy from here to add a new zone like zone3, zone 4 and so on**/
- array( "name" => "Zona 2",
- "type" => "section"),
- array( "type" => "open"),
- array( "name" => "Attivare zona 2?",
- "desc" => "Seleziona se vuoi il primo fermaposto",
- "id" => $shortname."_zona1c",
- "type" => "checkbox",
- "std" => "false"),
- array( "name" => "Zona 2 Asse x",
- "desc" => "Scegli dove posizionare il primo punto, se attivato asse x",
- "id" => $shortname."_zona2x",
- "type" => "text",
- "std" => "Left:???"),
- array( "name" => "Zona 2 Asse y",
- "desc" => "Scegli dove posizionare il primo punto, se attivato asse y",
- "id" => $shortname."_zona2y",
- "type" => "text",
- "std" => "Top:???"),
- array( "name" => "Zona 2 URL",
- "desc" => "Inserisci il link al post della zona 2",
- "id" => $shortname."_zona2l",
- "type" => "text",
- "std" => "Indirizzo del post qui"),
- array( "type" => "close"),
- array( "type" => "close"),
- );
- function mytheme_add_admin() {
- global $themename, $shortname, $options;
- if ( $_GET['page'] == basename(__FILE__) ) {
- if ( 'save' == $_REQUEST['action'] ) {
- foreach ($options as $value) {
- update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
- foreach ($options as $value) {
- if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
- header("Location: admin.php?page=/functions/cpanelfunction.php&saved=true");
- die;
- }
- else if( 'reset' == $_REQUEST['action'] ) {
- foreach ($options as $value) {
- delete_option( $value['id'] ); }
- header("Location: admin.php?page=/functions/cpanelfunction.php&reset=true");
- die;
- }
- }
- add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');
- }
- function mytheme_add_init() {
- $file_dir=get_bloginfo('template_directory');
- wp_enqueue_style("functions",$file_dir."/functions/functions.css", false, "1.0", "all");
- wp_enqueue_script("rm_script",$file_dir."/functions/rm_script.js", false, "1.0");
- }
- function mytheme_admin() {
- global $themename, $shortname, $options;
- $i=0;
- if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
- if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';?>
- <div class="wrap rm_wrap">
- <h2><?php echo $themename; ?> Settings</h2>
- <div class="rm_opts">
- <form method="post">
- <?php foreach ($options as $value) {
- switch ( $value['type'] ) {
- case "open":
- ?>
- <?php break;
- case "close":
- ?>
- </div>
- </div>
- <br />
- <?php break;
- case "title":
- ?>
- <p>Per usare facilmente il <?php echo $themename;?> , puoi usare il menu qui sotto.</p>
- <?php break;
- case 'text':
- ?>
- <div class="rm_input rm_text">
- <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
- <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?>" />
- <small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
- </div>
- <?php
- break;
- case 'textarea':
- ?>
- <div class="rm_input rm_textarea">
- <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
- <textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea>
- <small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
- </div>
- <?php
- break;
- case 'select':
- ?>
- <div class="rm_input rm_select">
- <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
- <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
- <?php foreach ($value['options'] as $option) { ?>
- <option <?php if (get_settings( $value['id'] ) == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>
- </select>
- <small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
- </div>
- <?php
- break;
- case "checkbox":
- ?>
- <div class="rm_input rm_checkbox">
- <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
- <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>
- <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
- <small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
- </div>
- <?php break;
- case "section":
- $i++;
- ?>
- <div class="rm_section">
- <div class="rm_title"><h3><img src="<?php bloginfo('template_directory')?>/functions/images/trans.png" class="inactive" alt="""><?php echo $value['name']; ?></h3><span class="submit"><input name="save<?php echo $i; ?>" type="submit" value="Salva modifiche" />
- </span><div class="clearfix"></div></div>
- <div class="rm_options">
- <?php break;
- }
- }
- ?>
- <input type="hidden" name="action" value="save" />
- </form>
- <form method="post">
- <p class="submit">
- <input name="reset" type="submit" value="Reset" />
- <input type="hidden" name="action" value="reset" />
- </p>
- </form>
- <div style="font-size:9px; margin-bottom:10px;">Icons: <a href="http://taytel.deviantart.com/">TayTel</a></div>
- </div>
- <h2>Ecco una preview delle modifiche fatte</h2>
- <iframe src="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_option('appacqua_pama')))); ?>" width="100%" height="600" ></iframe>
- <?php
- }
- ?>
- <?php
- add_action('admin_init', 'mytheme_add_init');
- add_action('admin_menu', 'mytheme_add_admin');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement