‘title’ => ‘Xenion’,
‘href’ => admin_url(‘admin.php?page=xenion-page’)
);
$wp_admin_bar->add_menu($argsParent);
}
function enqueue_admin_bar_scripts () {
wp_enqueue_style(‘xenion-admin-bar’, plugin_dir_url( __FILE__ ).’css/admin.css’ );
wp_enqueue_script(‘xenion-admin-back-office-script’, plugin_dir_url( __FILE__ ).’js/admin-back-office.js’, array(‘jquery’));
wp_localize_script(“xenion-admin-back-office-script”, “xenion_trad”, array(
“__attivaIlTuoXenion” => __(“Activate Xenion”, “xenion”),
“__Attendere” => __(“Waiting”, “xenion”),
“__AttenzioneTuttiICampiSonoObbligatori” => __(“Warning, all fields are required”, “xenion”),
“__AttenzioneLIndirizzo” => __(“Warning!
The address”, “xenion”),
“__EGiaInUso” => __(“is already exist.
“, “xenion”),
“__ProvaACambiarloEPremiNuovamenteIlPulsantediAttivazione” => __(“Try to changing it and then press the activation button again”, “xenion”)
));
}
add_action(‘admin_enqueue_scripts’, ‘enqueue_admin_bar_scripts’);
// i-Frame
function xenion_form() {
global $uniqueIDXenion;
global $urlXenionHttps;
global $urlXenionHttp;
global $jsonConfigXenion;
?>
Segui i seguenti 3 passi per attivare Xenion
PASSO 1
Copia e incolla il seguente codice dentro a Xenion nella pagina dove hai scaricato il plugin:
:
PASSO 2
Leggi i parametri di Configurazione da Xenion
Leggi Configurazioni |
PASSO 3
Salva i parametri di Configurazione su WordPress
Salva Configurazioni |
$html .= $current_user->user_login . ”
“;
$html .= $current_user->user_email . ”
“;
$html .= $current_user->display_name . ”
“;
$userdata = get_user_by(‘login’, $current_user->user_login);
$html .= “password=” . wp_check_password(“xxxx”, $userdata->user_pass, $userdata->ID) . ”
“;
*/
function listroom_func( $atts ) {
global $urlXenionHttps;
$html = “Xenion is not properly configured”;
if ($urlXenionHttps != false) {
$url = $urlXenionHttps.”/pacifik/client/modules/hotels/services/readopen/roomtypes?Idindirizzoanag=2&prgr=1467365741485″;
//$json = file_get_contents($url);
$json = “”;
$json = json_decode($json, true);
$lang = “en”;
if ( isset($atts[‘lang’]) ) $lang = $atts[‘lang’];
$html = “”;
$html .= ”
“;
foreach ($json as $row) {
$html .= ”
“;
$html .= ”
$html .= ”
$img = $urlXenionHttps.”/”.getFirstImage($row, ‘Immagini’)->url;
$html .= “
$html .= “
“;
$html .= ”
$html .= “” . strlang($row[“Name”], $lang) . “
“;
$html .= “” . strlang($row[“Descrizionebreve”], $lang) . ““;
$html .= “
“;
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
}
$html .= ”
“;
}
return $html;
}
add_shortcode(‘listroom’, ‘listroom_func’);
function boxPren_func( $atts ) {
global $urlXenionHttps;
global $urlXenionHttp;
global $jsonConfigXenion;
global $linkTitleXenion;
$html = “”;
$lang = “en”;
if ( isset($atts[‘lang’]) ) $lang = $atts[‘lang’];
//if (function_exists(‘icl_object_id’)) $lang = ICL_LANGUAGE_CODE;
if ($lang==”de” || $lang==”en” || $lang==”es” || $lang==”fr” || $lang==”it” || $lang==”pt” || $lang==”ru”) {
wp_enqueue_script( ‘angular-locale-‘.$lang.’-js’, plugin_dir_url( __FILE__ ) . ‘js/angularStrap/angular-locale_’.$lang.’.js’, array(), ”, true );
}
$testDatePk = 0;
if ( isset($atts[‘idstructure’]) ) $idstructure = $atts[‘idstructure’];
if ( isset($atts[‘test_date_picker’]) ) $testDatePk = $atts[‘test_date_picker’];
//$url = $urlXenionHttps.”/pacifik/client/modules/hotels/services/readopen/configbookeng?id=1&language=”.$lang.”&prgr=1467365741485″;
//$json = file_get_contents($url);
//$jsonConfigXenion = str_replace(‘\”‘, ‘”‘, $jsonConfigXenion);
$json = json_decode($jsonConfigXenion, true);
$json = $json[$lang];
$conf_titolo = $json[“Titolo”];
$conf_colorebackground = $json[“Colorebackground”];
$conf_colorebackgroundtrasparent = $json[“Colorebackgroundtrasparent”];
$conf_mostratitolicampi = $json[“Mostratitolicampi”];
$conf_coloretasto = $json[“Coloretasto”];
$conf_testotasto = $json[“Testotasto”];
$conf_stile = $json[“Stile”];
$conf_csscustom = $json[“Csscustom”];
$conf_htmlboxsearch = $json[“Htmlboxsearch”];
$conf_nadulticombo = $json[“Nadulticombo”];
$conf_nbambinicombo = $json[“Nbambinicombo”];
$conf_lblAdulto = $json[“LblAdulto”];
$conf_lblAdulti = $json[“LblAdulti”];
$conf_lblBambino = $json[“LblBambino”];
$conf_lblBambini = $json[“LblBambini”];
$conf_lblTipologia = $json[“LblTipologia”];
$conf_Tipologie = [];
foreach ($json[“Tipologie”] as $tipologia) {
if (isset( $tipologia[“Idindirizzoanag”])) {
$arridstructures = explode(“,”, $idstructure);
for($i=0;$i<count($arridstructures);$i++) {
if (in_array($arridstructures[$i], $tipologia[“Idindirizzoanag”])) {
$found = 0;
for($a=0;$a<count($conf_Tipologie);$a++) {
if ($conf_Tipologie[$a][“Idmacrotipologiaall”] == $tipologia[“Idmacrotipologiaall”]) {
$found = 1;
}
}
if ($found == 0) {
$conf_Tipologie[] = $tipologia;
}
}
}
}
}
$conf_directiondatepicker = “bottom”;
if (isset($json[“Directiondatepicker”]) == true && $json[“Directiondatepicker”]==1) {
$conf_directiondatepicker = “top”;
}
if ($conf_nadulticombo === null) $conf_nadulticombo = 20;
if ($conf_nbambinicombo === null) $conf_nbambinicombo = 15;
if (wp_is_mobile()) {
$conf_mostratitolicampi = 0;
}
///////
wp_localize_script( ‘xenion-js’, ‘__lang’, $lang );
wp_localize_script( ‘xenion-js’, ‘__idstructureXenion’, $idstructure );
wp_localize_script( ‘xenion-js’, ‘__directionDatepicker’, $conf_directiondatepicker );
$html .= ”
“;
$html .= ”
$html .= ”
“;
if ($conf_titolo!=null && $conf_titolo!=””) {
$html .= ”
$html .= $conf_titolo;
$html .= “
“;
$html .= ”
“;
}
///////////
$mostra_Bambinicombo = 0;
$mostra_Tipologiecombo = 0;
if ($conf_nbambinicombo > 0) {
$mostra_Bambinicombo = 1;
}
if (count($conf_Tipologie) > 1) {
$mostra_Tipologiecombo = 1;
}
///////////
if ($mostra_Bambinicombo == 0 && $mostra_Tipologiecombo == 0) {
$numColCi = 4;
$numColCo = 4;
$numColAdulti = 3;
$numBtnCerca = 1;
}
if ($mostra_Bambinicombo == 0 && $mostra_Tipologiecombo == 1) {
$numColCi = 3;
$numColCo = 3;
$numColTipoAll = 3;
$numColAdulti = 2;
$numBtnCerca = 1;
}
if ($mostra_Bambinicombo == 1 && $mostra_Tipologiecombo == 0) {
$numColCi = 3;
$numColCo = 3;
$numColAdulti = 2;
$numColBambini = 2;
$numBtnCerca = 2;
}
if ($mostra_Bambinicombo == 1 && $mostra_Tipologiecombo == 1) {
$numColCi = 2;
$numColCo = 2;
$numColTipoAll = 3;
$numColAdulti = 2;
$numColBambini = 2;
$numBtnCerca = 1;
}
///////////
$title_ci = ucfirst(“Check-in”);
$title_co = ucfirst(“Check-out”);
$title_tipall = ucfirst($conf_lblTipologia);
$title_adult = ucfirst($conf_lblAdulti);
$title_bamb = ucfirst($conf_lblBambini);
///////////
if ($conf_mostratitolicampi != 1) {
$html .= ”
“;
$html .= ”
“;
if ($mostra_Tipologiecombo == 1) {
$html .= ”
“;
}
$html .= ”
“;
if ($mostra_Bambinicombo == 1) {
$html .= ”
“;
}
$html .= ”
“;
}
///////////
if ($conf_mostratitolicampi != 1) {
$html .= ”
$html .= $title_ci;
$html .= “
“;
$title_ci = “”;
}
$html .= ”
if (wp_is_mobile()) {
$html .= ” “;
} else {
$html .= ” “;
}
$html .= “
“;
///////////
if ($conf_mostratitolicampi != 1) {
$html .= ”
$html .= $title_co;
$html .= “
“;
$title_co = “”;
}
$html .= ”
if (wp_is_mobile()) {
$html .= ” “;
} else {
$html .= ” “;
}
$html .= “
“;
///////////
if ($mostra_Tipologiecombo == 1) {
if ($conf_mostratitolicampi != 1) {
$html .= ”
$html .= $title_tipall;
$html .= “
“;
$title_tipall = “”;
}
$html .= ”
$html .= “
“;
$html .= ”
“;
}
///////////
if ($conf_mostratitolicampi != 1) {
$html .= ”
$html .= $title_adult;
$html .= “
“;
$title_adult = “”;
}
$html .= ”
$html .= “
“;
$html .= ”
“;
///////////
if ($mostra_Bambinicombo == 1) {
if ($conf_mostratitolicampi != 1) {
$html .= ”
$html .= $title_bamb;
$html .= “
“;
$title_bamb = “”;
}
$html .= ”
$html .= “
“;
$html .= ”
“;
}
if ($conf_testotasto==null || $conf_testotasto==””) {
$conf_testotasto = “Search”;
}
$html .= ”
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
$html .= ”
“;
$html .= ““;
return $html;
}
add_shortcode(‘box_pren’, ‘boxPren_func’);
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Funzioni generiche
///////////////////////////////////////////////////////////////////////////////////////////////////////
function strlang ($value, $language) {
$ret = $value;
if ( strcmp( substr($value, 0, 14), “multilanguage=”)==0 ) {
$ret = json_decode (str_replace(“multilanguage=”, “”, $value) );
if (isset($ret->$language)) {
$ret = $ret->$language;
} else {
$ret = “”;
}
}
return $ret;
}
function getFirstImage($row, $colFoto=”Photo”) {
$ret = new stdClass();
$ret->url = “”;
$ret->description = “”;
try {
$arrImg = $row[$colFoto];
$arrImg = str_replace(“arrFiles=”, “”, $arrImg);
$arrImg = json_decode($arrImg);
if (count($arrImg) > 0) {
$ret = $arrImg[0];
}
} catch (Exception $e) {}
return $ret;
}
function getImages($row, $colFoto=”Photo”) {
$ret = array();
try {
$arrImg = $row[$colFoto];
$arrImg = str_replace(“arrFiles=”, “”, $arrImg);
$arrImg = json_decode($arrImg);
$ret = $arrImg;
} catch (Exception $e) {}
return $ret;
}
// Aggiunge le traduzioni
function xenion_textdomain() {
load_plugin_textdomain( ‘xenion’, FALSE, basename( dirname( __FILE__ ) ) . ‘/languages/’ );
}
add_action( ‘plugins_loaded’, ‘xenion_textdomain’ );