function wt_get_sidebar($post_id)
 {
     if (is_page()) {
         $wt_sidebar = $this->wt_sidebar_names['page'];
     }
     if (is_home() || is_front_page() || $post_id == wt_get_option('homepage', 'home_page')) {
         $home_page_id = wt_get_option('homepage', 'home_page');
         $post_id = get_object_id($home_page_id, 'page');
         $wt_sidebar = $this->wt_sidebar_names['home'];
     }
     if (is_page_template('template_blog.php')) {
         $wt_sidebar = $this->wt_sidebar_names['blog'];
     }
     if (is_singular('post')) {
         $wt_sidebar = $this->wt_sidebar_names['blog'];
     } elseif (is_singular('wt_portfolio')) {
         $wt_sidebar = $this->wt_sidebar_names['wt_portfolio'];
     }
     if (is_search() || is_archive()) {
         $wt_sidebar = $this->wt_sidebar_names['blog'];
     }
     if (wt_get_option('general', 'woocommerce')) {
         if (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) {
             $wt_sidebar = dynamic_sidebar(__('Products Area', 'wt_admin'));
         }
     }
     if (!empty($post_id) && !is_archive()) {
         $wt_custom = get_post_meta($post_id, '_sidebar', true);
         if (!empty($wt_custom)) {
             $wt_sidebar = $wt_custom;
         }
     }
     if (isset($wt_sidebar)) {
         dynamic_sidebar($wt_sidebar);
     }
 }
function is_blog()
{
    global $is_blog;
    if ($is_blog == true) {
        return true;
    }
    $blog_page_id = wt_get_option('blog', 'blog_page');
    if (empty($blog_page_id)) {
        return false;
    }
    if (get_object_id($blog_page_id, 'page') == get_queried_object_id()) {
        $is_blog = true;
        return true;
    }
    return false;
}
?>
<!--[if lt IE 10]>
    <style type="text/css">
    html:not(.is_smallScreen) .wt_animations .wt_animate { visibility:visible;}
    </style>
<![endif]-->
<?php 
wp_head();
?>
</head>
<?php 
if (is_blog()) {
    global $blog_page_id;
    global $post;
    $blog_page_id = wt_get_option('blog', 'blog_page');
    $post->ID = get_object_id($blog_page_id, 'page');
}
/* Sidebar Alignement  */
require_once THEME_FILES . '/layout.php';
if (!is_search()) {
    $type = get_post_meta($post->ID, '_intro_type', true);
    $bg = wt_check_input(get_post_meta($post->ID, '_page_bg', true));
    $bg_position = get_post_meta($post->ID, '_page_position_x', true);
    $bg_repeat = get_post_meta($post->ID, '_page_repeat', true);
    $color = get_post_meta($post->ID, '_page_bg_color', true);
} else {
    $type = 'default';
}
$stickyHeader = wt_get_option('general', 'sticky_header');
$noStickyOnSS = wt_get_option('general', 'no_sticky_on_ss');
$retinaLogo = wt_get_option('general', 'logo_retina');
Ejemplo n.º 4
0
function buildpg()
{
    global $txt, $x7c, $x7s, $print, $db, $prefix;
    $errore = '';
    $ok = true;
    $pg = $x7s->username;
    include_once './lib/sheet_lib.php';
    $query = $db->DoQuery("SELECT * FROM {$prefix}users WHERE username='******'");
    $row_user = $db->Do_Fetch_Assoc($query);
    if (!$row_user) {
        die("Users not in database: should not happen");
    }
    if (isset($_GET['build'])) {
        $starting_xp = $x7c->settings['starting_xp'];
        $xp_avail = $starting_xp;
        $query = $db->DoQuery("SELECT u.ability_id AS ab_id, u.value AS value, a.dep AS dep, a.dep_val AS dep_val, a.name AS name\n\t\t\t\t\t\t\tFROM \t{$prefix}userability u, \n\t\t\t\t\t\t\t\t{$prefix}ability a\n\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\tu.ability_id = a.id AND\n\t\t\t\t\t\t\t\tusername='******' AND\n\t\t\t\t\t\t\t\tcorp=''\n\t\t\t\t\t\t\tORDER BY a.name");
        $ability = '';
        while ($row = $db->Do_Fetch_Assoc($query)) {
            $ability[$row['ab_id']] = $row;
            if (!isset($_POST[$row['ab_id']])) {
                $ok = false;
                break;
            }
        }
        if (!isset($_POST['xp'])) {
            $ok = false;
        }
        //Controllo se le abilit� non sono state abbassate o superano il massimo
        //Il master fa quel che gli pare: niente controlli
        $tot_used = 0;
        $lvl_gained = 0;
        if ($ok) {
            $max_ab = $x7c->settings['max_ab_constr'];
            foreach ($ability as $cur) {
                if ($cur['value'] != $_POST[$cur['ab_id']]) {
                    $new_value = $_POST[$cur['ab_id']];
                    while ($new_value > $cur['value']) {
                        $tot_used += $new_value;
                        $new_value--;
                    }
                    if ($cur['value'] > $_POST[$cur['ab_id']]) {
                        $errore .= "Errore, non puoi scendere sotto il valore attuale<br>";
                        $ok = false;
                        break;
                    } elseif ($_POST[$cur['ab_id']] > $max_ab) {
                        $errore .= "Errore, non puoi superare il valore massimo<br>";
                        $ok = false;
                        break;
                    }
                }
            }
            if ($tot_used > $xp_avail) {
                $errore .= "Hai usato troppi PX<br>";
                $ok = false;
            }
            if ($tot_used < $starting_xp) {
                $errore .= "Non hai usato tutti i punti abilit&agrave; {$tot_used}/{$starting_xp}<br>";
                $ok = false;
            }
            if ($ok) {
                //Controllo le dipendenze
                foreach ($ability as $cur) {
                    if ($cur['value'] != $_POST[$cur['ab_id']]) {
                        if ($cur['dep'] != "") {
                            if ($_POST[$cur['ab_id']] > 0 && 2 * $_POST[$cur['dep']] < $_POST[$cur['ab_id']]) {
                                $right_value = 2 * $_POST[$cur['dep']] > 0 ? 2 * $_POST[$cur['dep']] : 1;
                                $errore .= "Errore, non puoi avere " . $_POST[$cur['ab_id']] . " gradi in <b>" . $cur['name'] . "</b> senza vere almeno " . $right_value . " gradi in b>" . $ability[$cur['dep']]['name'] . "<br>";
                                $ok = false;
                                break;
                            }
                        }
                    }
                }
            }
        }
        if (isset($_POST['name']) && isset($_POST['age']) && isset($_POST['nat']) && isset($_POST['marr']) && isset($_POST['gender'])) {
            if ($_POST['name'] == '') {
                $ok = false;
                $errore .= "Non hai specificato il nome<br>";
            }
            if ($_POST['age'] == '' || $_POST['age'] < 16) {
                $ok = false;
                $errore .= "Et&agrave; non valida... deve essere maggiore di 16<br>";
            }
            if ($_POST['nat'] == '') {
                $ok = false;
                $errore .= "Non hai specificato la nazionalit&agrave;<br>";
            }
        } else {
            $ok = false;
            $errore .= "Parametri mancanti<br>";
        }
        if (isset($_POST['ch']) && $_POST['ch'] > 0) {
            $errore .= "Non hai usato tutti i tuoi punti caratteristica<br>";
        } else {
            $query = $db->DoQuery("SELECT * FROM {$prefix}characteristic ORDER BY name");
            $char = '';
            while ($row = $db->Do_Fetch_Assoc($query)) {
                $char[$row['id']] = $row;
            }
            $total_char = 0;
            //Controllo se le caratteristiche non sono state abbassate o superano il massimo
            foreach ($char as $cur) {
                if (!isset($_POST[$cur['id']])) {
                    $ok = false;
                    break;
                }
                $total_char += $_POST[$cur['id']];
                if ($_POST[$cur['id']] < $x7c->settings['min_ch']) {
                    $errore .= "Errore, non puoi abbassare le caratteristiche sotto il {$x7c->settings['min_ch']}<br>";
                    $ok = false;
                    break;
                } elseif ($_POST[$cur['id']] > $x7c->settings['max_ch']) {
                    $errore .= "Errore, le caratteristiche non possono superare il valore massimo {$x7c->settings['max_ch']}<br>";
                    $ok = false;
                    break;
                }
            }
            if ($total_char > $x7c->settings['starting_ch']) {
                $errore .= "Errore, hai usato troppi punti caratteristica<br>";
                $ok = false;
            }
        }
        if ($ok) {
            //Ora posso aggiornare
            $newxp = $row_user['xp'] - $tot_used * $x7c->settings['xp_ratio'];
            $newlvl = 1;
            if ($_POST['gender'] == 0) {
                if ($_POST['marr'] == 0) {
                    $marr = "Libero";
                } else {
                    $marr = "Sposato";
                }
            } else {
                if ($_POST['marr'] == 0) {
                    $marr = "Libera";
                } else {
                    $marr = "Sposata";
                }
            }
            $pf = $_POST['rob'] * 2;
            $db->DoQuery("UPDATE {$prefix}users SET\n\t\t\t\t\t\t\t\tname='{$_POST['name']}',\n\t\t\t\t\t\t\t\tage='{$_POST['age']}',\n\t\t\t\t\t\t\t\tnat='{$_POST['nat']}',\n\t\t\t\t\t\t\t\tmarr='{$marr}',\n\t\t\t\t\t\t\t\tgender='{$_POST['gender']}',\n\t\t\t\t\t\t\t\tinfo='{$pf}'\n\t\t\t\t\t\t\t\tWHERE username='******'");
            foreach ($char as $cur) {
                if (!isset($_POST[$cur['id']])) {
                    $ok = false;
                    break;
                }
                $db->DoQuery("UPDATE {$prefix}usercharact\n\t\t\t\t\t\t\t\t\t\tSET value='{$_POST[$cur['id']]}'\n\t\t\t\t\t\t\t\t\t\tWHERE username='******'\n\t\t\t\t\t\t\t\t\t\t AND charact_id='{$cur['id']}'");
            }
            $db->DoQuery("UPDATE {$prefix}users \n\t\t\t\t\t\t\t\t\tSET xp='{$newxp}',\n\t\t\t\t\t\t\t\t\tlvl='{$newlvl}'\n\t\t\t\t\t\t\t\t\tWHERE username='******'");
            foreach ($ability as $cur) {
                if ($cur['value'] != $_POST[$cur['ab_id']]) {
                    $db->DoQuery("UPDATE {$prefix}userability \n\t\t\t\t\t\t\t\t\tSET value='{$_POST[$cur['ab_id']]}'\n\t\t\t\t\t\t\t\t\tWHERE username='******'\n\t\t\t\t\t\t\t\t\t AND ability_id='{$cur['ab_id']}'");
                }
            }
            $spazio = ($_POST['for'] - 3) * 2;
            $db->DoQuery("UPDATE {$prefix}users\n\t\t\t\t\t\t\t\t\tSET sheet_ok='1', spazio = {$spazio}\n\t\t\t\t\t\t\t\t\tWHERE username='******'");
            $db->DoQuery("INSERT INTO {$prefix}user_feat\n\t\t\t\t\t\t\t(username, feat_id)\n\t\t\t\t\t\t\tVALUES ('{$pg}', '{$_POST['add_feat']}')");
            // Default equipment
            /*if ($row_user['base_group'] == $x7c->settings['usergroup_default']) {
            			include_once('lib/shop_lib.php');
            			global $shopper, $start_cogs;
            			pay($start_cogs, $shopper, $pg);
            		}*/
            $id = get_object_id("ID Pod");
            assign_object($id, $pg, true);
            if ($_POST['gender'] == 0) {
                $id2 = get_object_id("Abiti comuni maschili");
            } else {
                $id2 = get_object_id("Abiti comuni femminili");
            }
            assign_object($id2, $pg, true);
            header('Location: ./index.php');
            return;
        }
    }
    $max_ab = $x7c->settings['max_ab_constr'];
    //Characteristics
    $query_char = $db->DoQuery("SELECT * FROM {$prefix}characteristic");
    $ch_descr_vector = "\n";
    while ($row_ch = $db->Do_Fetch_Assoc($query_char)) {
        $charact[$row_ch['id']] = $row_ch;
        $ch_descr_vector .= "\t\t\t\t\t\tdescr['{$row_ch['id']}']=\"{$row_ch['descr']}\";\n";
    }
    $ch_fields = '';
    foreach ($charact as $cur_ch) {
        $ch_fields .= "<tr " . ">\n\t\t\t\t\t<td>{$cur_ch['name']}:</td><td><input class=\"button\" type=\"button\" value=\"-\" onMouseDown=\"return sub_ch('{$cur_ch['id']}');\">\n\t\t\t\t\t<input type=\"text\" name=\"{$cur_ch['id']}_display\" value=\"{$x7c->settings['min_ch']}\" size=\"2\" style=\"text-align: right; color: blue;\" disabled/>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"{$cur_ch['id']}\" value=\"{$x7c->settings['min_ch']}\"/>\n\t\t\t\t\t\t<input class=\"button\" type=\"button\" value=\"+\" onMouseDown=\"return add_ch('{$cur_ch['id']}');\">\n</td></tr>";
    }
    $ch = $x7c->settings['starting_ch'] - $x7c->settings['min_ch'] * sizeof($charact);
    //Ability
    $xp = $x7c->settings['starting_xp'];
    $max_ab = $x7c->settings['max_ab_constr'];
    $query = $db->DoQuery("SELECT * FROM \t{$prefix}userability,\n\t\t\t\t\t\t\t{$prefix}ability\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tability_id=id AND\n\t\t\t\t\t\t\tusername='******'\n\t\t\t\t\t\tORDER BY dep,name");
    while ($row = $db->Do_Fetch_Assoc($query)) {
        $ability[$row['ability_id']] = $row;
    }
    $ab_descr_vector = "\n";
    foreach ($ability as $cur) {
        $ab_descr_vector .= "\t\t\t\t\t\tdescr['{$cur['ability_id']}']=\"{$cur['descr']}\";\n";
    }
    $ab_fields = '';
    foreach ($ability as $cur) {
        if ($cur['dep'] == "") {
            $ab_fields .= "<tr " . ">";
            $ab_fields .= "<td style=\"font-weight: bold;\">" . $cur['name'] . "</td>\n\t\t\t\t\t<td><input class=\"button\" type=\"button\" value=\"-\" onClick=\"return sub('{$cur['ability_id']}');\">\n\t\t\t\t\t<input type=\"text\" name=\"{$cur['ability_id']}_display\" value=\"{$cur['value']}\" size=\"2\" style=\"text-align: right; color: blue;\" disabled/>\n\t\t\t\t\t<input type=\"hidden\" name=\"{$cur['ability_id']}\" value=\"{$cur['value']}\"/>\n\t\t\t\t\t<input class=\"button\" type=\"button\" value=\"+\" onClick=\"return add('{$cur['ability_id']}');\">\n\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur['ability_id'] . "_min\" value=\"{$cur['value']}\">\n\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur['ability_id'] . "_name\" value=\"{$cur['name']}\">\n\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur['ability_id'] . "_dep\" value=\"{$cur['dep']}\">";
            $query = $db->DoQuery("SELECT id FROM {$prefix}ability WHERE dep='{$cur['ability_id']}' ORDER BY name");
            $ab_fields .= "\n\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur['ability_id'] . "_leaf\" value=\"";
            while ($leaf = $db->Do_Fetch_Assoc($query)) {
                $ab_fields .= $leaf['id'] . "|";
            }
            $ab_fields .= "\">";
            $ab_fields .= "</td></tr>\n";
            foreach ($ability as $cur2) {
                if ($cur2['dep'] == $cur['ability_id']) {
                    $ab_fields .= "<tr " . ">\n";
                    $ab_fields .= "<td style=\"font-weight: bold;\">&nbsp;&nbsp;&nbsp;" . $cur2['name'] . "</td>\n\t\t\t\t\t\t\t\t<td><input class=\"button\" type=\"button\" value=\"-\" onMouseDown=\"return sub('{$cur2['ability_id']}');\">\n\t\t\t\t\t\t\t\t<input type=\"text\" name=\"{$cur2['ability_id']}_display\" value=\"{$cur2['value']}\" size=\"2\" style=\"text-align: right; color: blue;\" disabled/>\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"{$cur2['ability_id']}\" value=\"{$cur2['value']}\"/>\n\t\t\t\t\t\t\t\t<input class=\"button\" type=\"button\" value=\"+\" onMouseDown=\"return add('{$cur2['ability_id']}');\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur2['ability_id'] . "_min\" value=\"{$cur2['value']}\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur2['ability_id'] . "_name\" value=\"{$cur2['name']}\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur2['ability_id'] . "_dep\" value=\"{$cur2['dep']}\">";
                    if ($cur2['dep'] != "") {
                        $ab_fields .= "\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"" . $cur2['ability_id'] . "_dep_val\" value=\"{$cur2['dep_val']}\">";
                    }
                    $ab_fields .= "</td></tr>\n";
                }
            }
        }
    }
    $full_name_form = '	
					<tr ' . '>
						<td>Nome e Cognome:</td>
						<td><input class="sheet_input" type="text" name="name" size="16" /></td>
					</tr>
					<tr>
						<td>
						<b>NOTA:</b> Nome e cognome verranno utilizzati<br>
						per identificare il vostro personaggio nelle stanze 
						</td>
					</tr>

			';
    $features_form = "<select name=\"add_feat\">";
    $query_feat_list = $db->DoQuery("SELECT id, feat_id FROM {$prefix}features\n\t\t\t\t\tORDER BY feat_id");
    while ($row_feat_list = $db->Do_Fetch_Assoc($query_feat_list)) {
        $features_form .= "<option value={$row_feat_list['id']}>\n\t\t\t\t{$row_feat_list['feat_id']}</option>";
    }
    $features_form .= "</select>";
    $body = '
			<script language="javascript" type="text/javascript">
						var descr=Array();
						' . $ab_descr_vector . $ch_descr_vector . '

						descr[\'naz\']="La Nazionalit&agrave; indica lo stato dal quale provenite. Italiana, statunitense, russa... Facile dai!";
						descr[\'nome\']="Il nome completo del pg &egrave; inteso come il vero nome anagrafico del personaggio, quello \\"legale\\" ... Quindi il <b>NICK</b> e\' quello che appare in chat (scorpion, butterfly, volpe quel che vi pare...) ma questo &egrave; la Vera Identit&agrave; del player. Non sono quindi ammessi nomi impossibili (Leo-99 o Topolina 74) o cretini (the undead lord o Diabolik), come nemmeno nomi fantasy (Gandalf il bianco, Elandriel Blacwisdom o cose simili)... Insomma siate veritieri...";
						descr[\'sesso\']="Sesso? Spesso e volentieri grazie... Non vi spiego cosa sia, tanto il men&ugrave; a tendina non vi permetter&agrave; grossi errori!";
						descr[\'civile\']="Indica se siete sposati o single.";

						function add_ch(ch_name){
							var value = parseInt(document.sheet_form[ch_name].value);
							var ch = parseInt(document.sheet_form["ch"].value);

							if (ch > 0 && value < 12){
								document.sheet_form[ch_name].value = value + 1;
								document.sheet_form["ch"].value = ch - 1;
							}
							do_ch_form_refresh(ch_name);
						}

						function sub_ch(ch_name){
							var value = parseInt(document.sheet_form[ch_name].value);
							var ch = parseInt(document.sheet_form["ch"].value);

							if (value > 4){
								document.sheet_form[ch_name].value = value -1;
								document.sheet_form["ch"].value = ch + 1;
							}
							do_ch_form_refresh(ch_name);
						}

						function do_ch_form_refresh(ch_name){
							document.sheet_form[ch_name+"_display"].value = document.sheet_form[ch_name].value;
							document.sheet_form["ch_display"].value = document.sheet_form["ch"].value;
							enable_send();
						}

						' . ability_script($max_ab) . '
						function do_form_refresh(ab_name){
							document.sheet_form[ab_name+"_display"].value = document.sheet_form[ab_name].value;
							document.sheet_form["xp_display"].value = document.sheet_form["xp"].value;
							enable_send();
						}

						function show_desc(el){
							document.getElementById("help").innerHTML = \'<a target="_blank" href="../manual">Vedi il regolamento</a>\';
							document.getElementById("help").style.visibility = "visible";
						}

						function hide_desc(){
							document.getElementById("help").style.visibility = "hidden";
							document.getElementById("help").innerHTML = "";
						}

						function enable_send(){
							var xp=document.sheet_form["xp"].value;
							var ch=document.sheet_form["ch"].value;
							var send = document.getElementById("send");

							if(xp > 0 || ch > 0){
								send.disabled = true;
							}
							else{
								send.disabled = false;
							}

						}

				</script>

			<p>Completa la scheda del tuo personaggio<BR>
			 Per proseguire devi completare tutti i campi e usare tutti i punti abilit&agrave; e caratteristica.
			 </p>
			<p class="error_msg">' . $errore . '</p>
			<form action="index.php?act=buildpg&build" method="post" name="sheet_form">
				<div class="overflow" id="all">
				<table>
					' . $full_name_form . '	
					<tr>
						<td>Et&agrave;</td>
						<td><input class="sheet_input" type="text" name="age" value="16" size="2" style="text-align: right;" /></td>
					</tr>

					<tr ' . '>
						<td>Nazionalit&agrave;</td>
						<td><input class="sheet_input" type="text" name="nat" size="16" /></td>
					</tr>
					
					</tr>
					<tr ' . '><td>Sesso:</td>
						<td>
						<select class="button" name="gender">
											<option value="0">M</option>
											<option value="1">F</option>
						</select>
						</td>
					</tr>

					<tr ' . '>
						<td>Stato civile:</td>
						<td>
							<select class="button" name="marr">
								<option value="0">Libero</option>
								<option value="1">Sposato</option>
						</select>
						</td>
					</tr>

					<tr><td colspan=2><hr></td></tr>
					
					<tr>
						<td>Punti caratteristica:</td> <td><input type="text" size="2" name="ch_display" value="' . $ch . '" style="text-align: right; color: blue;" disabled> <input type="hidden" name="ch" value="' . $ch . '"> </td>
					</tr>
					' . $ch_fields . '
					<tr><td>Talento:</td><td>' . $features_form . '</tr></td>
					
					
					<tr>
						<td><INPUT id="send" name="aggiorna" class="button" type="SUBMIT" value="Crea personaggio" disabled></td>
					</tr>
				</table>
				</div>
				
				<div class="overflow" id="ability">
				<table>
					<tr>
						<td>Punti abilit&agrave;:</td><td><input type="text" size="2" name="xp_display" value="' . $xp . '" style="text-align: right; color: blue;" disabled>
						<input type="hidden" name="xp" value="' . $xp . '"></td>
					</tr>

					' . $ab_fields . '

				</table>
				</div>
			</form>
			<div id="help"><a onClick="javascript: opener.focus();" target="_blank" href="../manual">Vedi il regolamento</a></div>
			';
    //Old show desc
    /*function show_desc(el){
    						document.getElementById("help").innerHTML = descr[el];
    						document.getElementById("help").style.visibility = "visible";
    		}*/
    return $body;
}
    function widget($args, $instance)
    {
        $cache = wp_cache_get('theme_widget_popular_portfolio_posts', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Portfolio Posts', 'randf_front') : $instance['title'], $instance, $this->id_base);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            } else {
                if ($number > 15) {
                    $number = 15;
                }
            }
        }
        if (!($desc_length = (int) $instance['desc_length'])) {
            $desc_length = 80;
        } else {
            if ($desc_length < 1) {
                $desc_length = 1;
            }
        }
        $disable_thumbnail = $instance['disable_thumbnail'] ? '1' : '0';
        $display_extra_type = $instance['display_extra_type'] ? $instance['display_extra_type'] : 'time';
        $query = array('showposts' => $number, 'nopaging' => 0, 'orderby' => 'comment_count', 'post_type' => 'wt_portfolio', 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
        if (!empty($instance['cat'])) {
            global $wp_version;
            foreach ($instance['cat'] as &$id) {
                $id = get_object_id($id, 'wt_portfolio_category');
            }
            if (version_compare($wp_version, "3.1", '>=')) {
                $query['tax_query'] = array(array('taxonomy' => 'wt_portfolio_category', 'field' => 'id', 'terms' => $instance['cat']));
            } else {
                $terms = array();
                foreach ($instance['cat'] as $cat) {
                    $term = get_term_by('id', $cat, 'wt_portfolio_category');
                    $terms[] = $term->slug;
                }
                $query['taxonomy'] = 'wt_portfolio_category';
                $query['term'] = implode(",", $terms);
            }
        }
        $r = new WP_Query($query);
        if ($r->have_posts()) {
            ?>
		<section class="wt_widgetPosts widget">
        <h4 class="widgettitle"><span><?php 
            echo $title;
            ?>
</span></h4>
		<?php 
            if ($display_extra_type != 'none') {
                ?>
        <ul class="wt_postList">
        <?php 
            } else {
                // end thumbsOnly
                ?>
 
        <div class="wt_postThumbs">
	    <?php 
            }
            ?>
	
<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
			<?php 
                if ($display_extra_type != 'none') {
                    ?>
<li><?php 
                }
                if (!$disable_thumbnail) {
                    ?>
				<a class="thumb" href="<?php 
                    echo get_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
<?php 
                    if (has_post_thumbnail()) {
                        ?>
					<?php 
                        the_post_thumbnail('thumb', array(55, 55), array('title' => get_the_title(), 'alt' => get_the_title()));
                        ?>
	
<?php 
                    } else {
                        ?>
					<img src="<?php 
                        echo THEME_IMAGES;
                        ?>
/widget_posts_thumbnail.png" width="55" height="55" title="<?php 
                        the_title();
                        ?>
" alt="<?php 
                        the_title();
                        ?>
"/>
<?php 
                    }
                    //end has_post_thumbnail
                    ?>
				</a>
<?php 
                }
                //disable_thumbnail
                if ($display_extra_type != 'none') {
                    ?>
				<div class="wt_postInfo">
					<a href="<?php 
                    the_permalink();
                    ?>
" class="postInfoTitle" rel="bookmark" title="<?php 
                    echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                    ?>
"><?php 
                    if (get_the_title()) {
                        the_title();
                    } else {
                        the_ID();
                    }
                    ?>
</a>
<?php 
                    if ($display_extra_type == 'time') {
                        ?>
					<span class="date"><?php 
                        echo get_the_date();
                        ?>
</span>
<?php 
                    } elseif ($display_extra_type == 'description') {
                        ?>
					<p><?php 
                        echo wp_html_excerpt(get_the_excerpt(), $desc_length);
                        ?>
</p>
<?php 
                    } elseif ($display_extra_type == 'comments') {
                        ?>
					<span class="comments"><?php 
                        echo comments_popup_link(__('No response ', 'randf_front'), __('1 Comment', 'randf_front'), __('% Comments', 'randf_front'), '');
                        ?>
</span>
<?php 
                    }
                    //end display extra type
                    ?>
				</div>
                <div class="wt_clearboth"></div>
<?php 
                }
                //end display post information
                ?>
	
			<?php 
                if ($display_extra_type != 'none') {
                    ?>
</li><?php 
                }
            }
            ?>
		<?php 
            if ($display_extra_type != 'none') {
                ?>
        </ul>
		<?php 
            } else {
                // end postThumbs
                ?>
 
        </div> 
        <div class="wt_clearboth"></div>
		<?php 
            }
            ?>
		</section>
<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_query();
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('theme_widget_popular_portfolio_posts', $cache, 'widget');
    }
 function wt_custom_title($post_id = NULL)
 {
     $type = get_post_meta($post_id, '_intro_type', true);
     if (is_blog()) {
         $blog_page_id = wt_get_option('blog', 'blog_page');
         $post_id = get_object_id($blog_page_id, 'page');
     }
     if (is_single() || is_page() || is_front_page() && $post_id != NULL || is_home() && $post_id != NULL) {
         $type = get_post_meta($post_id, '_intro_type', true);
         if (in_array($type, array('default', 'title', 'title_custom'))) {
             $custom_title = get_post_meta($post_id, '_custom_title', true);
             if (!empty($custom_title)) {
                 $title = $custom_title;
             } else {
                 $title = get_the_title($post_id);
             }
         }
         if (in_array($type, array('custom', 'title_custom'))) {
             $text = '<h3 class="custom_title wt_animate wt_animate_if_visible" data-animation="bounceIn">' . trim(get_post_meta($post_id, '_custom_introduce_text', true)) . '</h3>';
         }
     }
     //echo wt_theme_generator('wt_intro',$post_id);
     echo "\t\t\t" . '<div class="wt_intro"><div class="intro_text">';
     if (isset($title)) {
         echo '<h2 class="title wt_animate wt_animate_if_visible" data-animation="bounceIn">' . $title . '</h2>';
     }
     if (isset($text)) {
         echo $text;
     }
     echo "</div></div>\n\t";
 }
Ejemplo n.º 7
0
<?php

$_POST['ssid'] = $_GET['ssid'];
require '../session.php';
require 'edit_function.php';
// Clear the url temp for the ID TEMP
$_SESSION[$ssid]['objet_fiche']->clear_url_temp();
// Parse the URL & insert params in database
$object_type = get_object();
$object_id = get_object_id();
$object_version = get_object_version($_SESSION[$ssid]['message']['iknow'][504]);
$object_ik_cartridge = get_object_ik_cartridge();
get_url_params();
$object_tab_level = get_tab_level();
$object_ik_valmod = get_object_ik_valmod();
/**==================================================================
	 * HTML declare page interpretation directive
	 ====================================================================*/
require '../../../../../../includes/common/html_doctype.php';
/*===================================================================*/
?>
<html>
	<head>
		<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="../css/iknow_tiny.css" type="text/css">
		<link rel="stylesheet" href="../../../../../../css/ifiche/tiny.css" type="text/css">
		<link rel="stylesheet" href="../../../../../../css/common/iknow/iknow_onglet.css" type="text/css">
		<link rel="stylesheet" href="../../../../../../css/ifiche/common_fiche.css" type="text/css"/>
		<style type="text/css">
		.onglets
		{