Plugin Directory

Changeset 1286972


Ignore:
Timestamp:
11/16/2015 08:51:03 AM (10 years ago)
Author:
heimsveld
Message:

d- shortcode on templates problem fixed

Location:
chronosly-events-calendar
Files:
10 edited
6 copied

Legend:

Unmodified
Added
Removed
  • chronosly-events-calendar/tags/2.2.7/README.txt

    r1284685 r1286972  
    66Requires at least: 3.1
    77Tested up to: 4.3.1
    8 Stable tag: 2.2.6
     8Stable tag: 2.2.7
    99License: GPLv2
    1010
  • chronosly-events-calendar/tags/2.2.7/chronosly.php

    r1284685 r1286972  
    44 * Plugin URI: http://www.chronosly.com
    55 * Description: Chronosly is one of the plugins you have always dreamt about. Designed to suit all users (basic, designers, and software developers). Choose your template and you are ready to publish your events. Install addons to enhance the preset plugin features. You can get a wide selection of templates and addons in our marketplace
    6  * Version: 2.2.6
     6 * Version: 2.2.7
    77 * Author: Heimsveld IPBN
    88 * Author URI: http://www.heimsveld.com
     
    2626define('CHRONOSLY_TEMPLATES_URL',  plugins_url()."/chronosly-templates"); //path para incluir scripts o css
    2727define('CHRONOSLY_DEBUG', false); //debug mode
    28 define('CHRONOSLY_VERSION', "2.2.6"); //debug mode
     28define('CHRONOSLY_VERSION', "2.2.7"); //debug mode
    2929define('CHRONOSLY_ADMIN_INTERFACE', 1);  //Todo: hacer diferentes interficies de admin simple o varios event
    3030define('CHRONOSLY_ADMIN_MODALITY', 1);  //Todo: hacer diferentes modalidades segun la tematica
  • chronosly-events-calendar/tags/2.2.7/classes/chronosly_dad_elements.php

    r1272735 r1286972  
    12411241
    12421242            // print_r($vars->metas["ev-from"]);
    1243 
    12441243            $lorem = 0;
     1244
    12451245            switch ($extra) {
    12461246            case "full_datetime":
     
    13031303
    13041304            case "full_time":
    1305 
    13061305                if ($html) {
    13071306                    $cont = str_replace("}}", " | time_format $value}}", $cont);
    13081307                }
    13091308                else {
     1309
    13101310                    if (!$value) $value = $settings["chronosly_format_time"];
    13111311                    if(!isset($vars->metas["events"][0]) or $vars->metas["events"][0] == "") {
     
    13311331                        if (!$cont) $cont = __("All day long", "chronosly");
    13321332                    } else {
    1333                         $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    1334                         if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
    1335                         $s = json_decode($vars->metas["ev-from-h"][0]);
    1336                         foreach($s as $id=>$s1) if($s1 == ":") $s[$id] = __("All day long", "chronosly");
    1337                         if(is_array($s)) $cont .= implode(", ", $s);
    1338                         else $cont .=  $s;
     1333
     1334                         $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1335
     1336                          if(!$sets["seasons_normal_display"]){
     1337                            $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1338                            if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
     1339                            $s = json_decode($vars->metas["ev-from-h"][0]);
     1340                            foreach($s as $id=>$s1) if($s1 == ":") $s[$id] = __("All day long", "chronosly");
     1341                            if(is_array($s)) $cont .= implode(", ", $s);
     1342                            else $cont .=  $s;
     1343                        } else {
     1344
     1345                            $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1346
     1347                            if($_REQUEST["repeat"]){
     1348                                $ses = explode("_", $_REQUEST["repeat"]);
     1349                                if(count($ses) == 4) $date1 = $vars->metas["ev-from"][0] . " " . $ses[2] . ":" . $ses[3];
     1350                            }else {
     1351
     1352                                $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1353                            }
     1354                            $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     1355                            if (stripos($vars->metas["ev-from-h"][0], "'lorem'") === FALSE) $lorem = 0;
     1356                            $date1o = strtotime($date1);
     1357                            if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1358                            else $cont.= strftime($value, $date1o);
     1359                        }
     1360                     
    13391361                    }
    13401362                }
     
    13571379                        else $cont.= strftime($value, $date1o);
    13581380                    } else {
    1359                          $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    1360                         if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
    1361 
    1362                         $s = json_decode($vars->metas["ev-from-h"][0]);
    1363                         if(is_array($s)) $cont .= implode(", ", $s);
    1364                         else $cont .=  $s;
     1381                         $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1382                     
     1383                        if(!$sets["seasons_normal_display"]){
     1384                             $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1385                            if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
     1386
     1387                            $s = json_decode($vars->metas["ev-from-h"][0]);
     1388                            if(is_array($s)) $cont .= implode(", ", $s);
     1389                            else $cont .=  $s;
     1390                        } else {
     1391                            $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1392                            $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     1393                            if (stripos($vars->metas["ev-from-h"][0], "'lorem'") === FALSE) $lorem = 0;
     1394                            $date1o = strtotime($date1);
     1395                            if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1396                            else $cont.= strftime($value, $date1o);
     1397                        }
    13651398                    }
    13661399                }
     
    13901423                }
    13911424                else {
    1392 
    13931425                    if (!$value) $value = $settings["chronosly_format_date"];
    13941426                    $date1 = $vars->metas["ev-from"][0];
     1427                    // echo "<pre>";print_r($vars->metas);
    13951428                    if(!isset($vars->metas["events"][0]) or $vars->metas["events"][0] == "") $date1 .= " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
    13961429                    $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     
    13981431                    $date1o = strtotime($date1);
    13991432                    if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1433
    14001434                    else $cont.= strftime($value, $date1o);
    14011435                }
     
    14351469                    } else {
    14361470
    1437                          $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    1438                         if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
    1439 ;
    1440                        
    1441                         $s = json_decode($vars->metas["ev-from-h"][0]);
    1442 
    1443                         // $m = json_decode($vars->metas["ev-from-m"][0]);
    1444                         if(is_array($s)) {
    1445                             foreach ($s as $v) {
    1446                                 if($v == ":") $cont .= __("All day long", "chronosly").", ";
    1447                                 else $cont .= $v.", ";
     1471                         $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1472                     
     1473                        if(!$sets["seasons_normal_display"]){
     1474                             $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1475                            if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
     1476   
     1477                           
     1478                            $s = json_decode($vars->metas["ev-from-h"][0]);
     1479
     1480                            // $m = json_decode($vars->metas["ev-from-m"][0]);
     1481                            if(is_array($s)) {
     1482                                foreach ($s as $v) {
     1483                                    if($v == ":") $cont .= __("All day long", "chronosly").", ";
     1484                                    else $cont .= $v.", ";
     1485                                }
     1486                                $cont = substr($cont, 0,-2);
    14481487                            }
    1449                             $cont = substr($cont, 0,-2);
    1450                         }
    1451                         else {
    1452                            if($s == ":") $cont .= __("All day long", "chronosly");
    1453                            else $cont .= $s;
     1488                            else {
     1489                               if($s == ":") $cont .= __("All day long", "chronosly");
     1490                               else $cont .= $s;
     1491                            }
     1492                        } else {
     1493                            $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1494                            $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     1495                            if (stripos($vars->metas["ev-from-h"][0], "'lorem'") === FALSE) $lorem = 0;
     1496                            $date1o = strtotime($date1);
     1497                            if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1498                            else $cont.= strftime($value, $date1o);
    14541499                        }
    14551500                        // print_r($vars->metas["ev-from-h"][0]);
  • chronosly-events-calendar/tags/2.2.7/classes/chronosly_extend.php

    r1284685 r1286972  
    623623
    624624
    625 
  • chronosly-events-calendar/tags/2.2.7/classes/chronosly_shortcode.php

    r1284685 r1286972  
    480480} // END
    481481
    482 
  • chronosly-events-calendar/tags/2.2.7/classes/chronosly_templates.php

    r1272735 r1286972  
    11<?php
    2 //javascript call
    32
    43
     
    2726                add_action( 'wp_ajax_chronosly_get_tipo_template', array(&$this, 'js_get_tipo_template' ));
    2827                add_action( 'wp_ajax_chronosly_clear_cache', array(&$this, 'js_clear_cache' ));
     28                add_action( 'wp_ajax_chronosly_save_all_html_templates', array(&$this, 'save_all_html_templates' ));
    2929                //add_filter( 'heartbeat_received', array(&$this, 'js_preview_theme' ), 10, 3 );
    3030               //load init vars for templates
     
    3333
    3434            }
    35 
    36 
    3735
    3836            add_filter("chronosly_dad_tabs", array("Chronosly_Templates", "chronosly_get_default_dad_tabs"), 5, 3);//get de default tabs for dad
     
    8583        }
    8684
    87         public function set_shortcode_template_css($template="default"){
     85           public function set_shortcode_template_css($template="default"){
    8886            wp_register_style( "chronosly_$template", CHRONOSLY_TEMPLATES_URL.'/css/'.$template.'.css');
    8987            wp_print_styles("chronosly_$template");
     
    123121            }
    124122        }
    125 
    126123
    127124
     
    180177                    fwrite( $f , $html);
    181178                    fclose($f);
    182 
     179                    // echo "hola";
    183180                    $this->template_2_html($name, $tid);
    184181                    /*
     
    316313                while (false !== ($entry = readdir($handle))) {
    317314                    if($entry != "." and $entry != ".." and !stripos($entry, ".html") )
    318 
    319                      $custom_templates[] = str_replace(array(".php","_"), array("", " "),$entry);
     315                        $custom_templates[] = str_replace(array(".php","_"), array("", " "),$entry);
    320316
    321317                }
     
    510506            }
    511507            //faltan los calendars
    512 
    513508            return $return;
    514509        }
     
    605600            $this->vars->args = $args;
    606601            $itid = $id;
    607             if(isset($args["start"]) and isset($args["end"])) $itid .= "_{$args["start"]}_{$args["end"]}";
     602            if($args["start"] and $args["end"]) $itid .= "_{$args["start"]}_{$args["end"]}";
    608603            if($args["h"] and $args["m"]) $itid .= "_{$args["h"]}_{$args["m"]}";
    609             //si lo tenemos en la cache lo pintamos, si no lo generamos y lo guardamos
     604
     605            //controlamos para hacerlo por html o por json
    610606
    611607            $path = CHRONOSLY_TEMPLATES_PATH.DIRECTORY_SEPARATOR;
    612608            if(isset($vars['chronosly_template_default_active']) and $vars['chronosly_template_default_active'] and stripos($_SERVER['HTTP_REFERER'], "chronosly_edit_templates") === FALSE ) $template = $vars['chronosly_template_default'];
    613             if(isset($_REQUEST["force_template"])) $template = $_REQUEST["force_template"];
     609            if($_REQUEST["force_template"]) $template = $_REQUEST["force_template"];
    614610
    615611            if(!$template) $template = $this->get_tipo_template($id, $vista);
     
    619615                return $this->print_template_html($id, $vista, $draganddropels, $template, $style, $args, $html2);
    620616            }
    621 
    622 
     617            // echo $path.$vista.DIRECTORY_SEPARATOR.$template.".html";
     618
     619            //si lo tenemos en la cache lo pintamos, si no lo generamos y lo guardamos
    623620            if($style == "front" and $id != 1 and $html = Chronosly_Cache::load_item($itid, $vista)) {
    624621               echo $html;
    625622            }
    626623            else {
     624
    627625                ob_start();
    628626
     
    638636
    639637                    $this->render_template($template, $style, $vista, json_decode($data), $draganddropels, $html2 );
     638
    640639                }
    641640                $cont= str_replace("{{notprev}}", "",ob_get_clean());
    642641                echo $cont;
     642
    643643                if($style == "front") Chronosly_Cache::save_item($itid, $vista, $cont);
    644644            }
     
    654654                $path = CHRONOSLY_TEMPLATES_PATH;//ruta hacia los templates del user
    655655                $vars = $this->get_template_vars($path.DIRECTORY_SEPARATOR.$vista.DIRECTORY_SEPARATOR.$template.".php");//ruta hacia el dad que toca
     656
    656657            }
    657658            if(($style == "back-addon" or $style == "back-addon-js") and isset($_REQUEST['addon']) and has_filter("chronosly_update_template_".$_REQUEST['addon'])) {
     
    664665            $args = $this->vars->args;
    665666            if($vars) $this->vars = $vars;
    666 
    667667            if($dadcats) $this->dadcats = $dadcats;
    668668            $this->vars->pid = $id;
     
    675675            }
    676676            else if ($style == "front"){
     677
    677678                $this->build_front_template($vista,$template, $html2);
    678679
     
    682683
    683684            }
     685
    684686        }
    685687
     
    696698        //cargamos las variables necesarias para pintar el template, las metas de organizer, place, etc..
    697699        private function get_all_vars($style){
     700
    698701            global $pastformat;
    699702            if(isset($this->vars->args["id"]) and $this->vars->args["id"]) {
     
    717720            if((!isset($this->vars->post) or !is_object($this->vars->post)) and isset($post[0])) $this->vars->post = $post[0];
    718721            if(!isset($this->vars->pid) and isset($post[0])) $this->vars->pid = $post[0]->ID;
     722
    719723            if($this->vars->vista != "dad11" and $this->vars->vista != "dad12" ) $this->vars->metas = get_post_meta($this->vars->pid);//assing metas vars
    720724
    721725            if(isset($this->vars->metas['organizer'])){
    722726                foreach($this->vars->metas['organizer'] as $orgs){
    723 
    724727                    $orgs = unserialize($orgs);
    725728
     
    740743                $this->vars->metas['organizer_vars'][] = array("post" =>  (isset($this->vars->post)?$this->vars->post:""), "metas" => $this->vars->metas);
    741744            }
     745
    742746            if(isset($this->vars->metas['places'])){
    743747                foreach($this->vars->metas['places'] as $orgs){
     
    746750                        foreach($orgs as $org){
    747751                            if(function_exists("icl_object_id")) $org = icl_object_id($org, "chronosly_places");
    748 
    749752                            $post = get_posts('post_type=chronosly_places&p='.$org);
    750753                            $this->vars->metas['places_vars'][] = array("post" =>  $post[0], "metas" => get_post_meta($org));
     
    770773                $this->vars->metas['cats_vars'][0]->metas = $this->vars->metas;//assing metas vars
    771774            }
     775
    772776            //ordenamos segun orden
    773777            if(isset($this->vars->metas['cats_vars'])) usort($this->vars->metas['cats_vars'], array("Chronosly_Templates", "ordenar_cats"));
     778
    774779            if($this->vars->vista != "dad11" and $this->vars->vista != "dad12" ){
     780
    775781                $tags = wp_get_object_terms($this->vars->pid, "chronosly_tag");
    776782                foreach($tags as $tag){
     
    778784                    //faltan los metas
    779785                }
     786
    780787                $vars = "";
    781788                if(isset($this->vars->metas['tickets'])) $vars = json_decode($this->vars->metas['tickets'][0]);
     789
    782790               if(isset($vars->tickets) and count($vars->tickets)){
    783791                   for($i = 1; $i < count($vars->tickets);++$i){
     
    788796
    789797                   }
     798
    790799               }
     800
    791801                $this->vars->link = get_post_permalink($this->vars->pid);
     802
    792803            }
    793804
     
    798809                foreach($this->vars->args as $k => $v){
    799810                    switch($k){
    800                        case "id":
     811                        case "id":
    801812                            $this->vars->pid = $v;
    802813                            if(!isset($this->vars->post)) $this->vars->post = new stdClass();
     
    828839
    829840                            break;
    830                              case "eh":
     841                        case "eh":
    831842                            $this->vars->metas['ev-to-h'][0] = $v;
    832                            
     843
    833844
    834845                            break;
    835846                         case "em":
    836847                            $this->vars->metas['ev-to-m'][0] = $v;
    837                            
     848
    838849
    839850                            break;
    840851
    841 
    842852                    }
    843853
     
    846856
    847857            //cargariamos el hook de data_field
    848             // print_r($this->vars);
     858
    849859            $this->set_default_text($style);
    850860
     
    945955                    $this->vars->metas["tickets_vars"][1]["title"] = "<span class='lorem'></span>Ticket lorem ipsum";
    946956                    $this->vars->metas["tickets_vars"][1]["price"] = "<span class='lorem'></span>49";
    947                     $this->vars->metas["tickets_vars"][1]["capacity"] = "<span class='lorem'></span>100";   
    948957                    $this->vars->metas["tickets_vars"][1]["sale-price"] = "<span class='lorem'></span>39";
    949 
     958                    $this->vars->metas["tickets_vars"][1]["capacity"] = "<span class='lorem'></span>100";
    950959                    // $this->vars->metas["tickets_vars"][1]["min-user"] = "<span class='lorem'></span>1";
    951960                    // $this->vars->metas["tickets_vars"][1]["max-user"] = "<span class='lorem'></span>5";
     
    954963                    $this->vars->metas["tickets_vars"][1]["link"] = "<span class='lorem'></span>link.com";
    955964                    $this->vars->metas["tickets_vars"][1]["soldout"] = "";
    956                      $this->vars->metas["tickets_vars"][1]["sale"] = "";
     965                    $this->vars->metas["tickets_vars"][1]["sale"] = "";
    957966                    $this->vars->metas["tickets_vars"][1]["notes"] = "<span class='lorem'></span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ultrices, ante commodo elementum posuere, velit justo fermentum enim, placerat tincidunt massa leo convallis purus. Praesent cursus arcu non tortor iaculis, eleifend lacinia enim euismod. Etiam consequat porttitor sapien, vitae feugiat nunc accumsan at. Mauris ultrices pretium lacus, vitae dapibus enim pharetra ut. Curabitur gravida vel lorem quis sollicitudin. Fusce commodo, mi et bibendum elementum, eros enim dapibus arcu, gravida rhoncus felis nulla ut eros. Suspendisse consequat ligula rhoncus erat gravida, et mollis quam placerat. Morbi in diam vestibulum, tempus ante molestie, pharetra nibh. Etiam nulla risus, imperdiet eu tincidunt a, hendrerit a elit. Nullam ut tincidunt augue. Aenean vehicula nulla sed ipsum bibendum, non congue risus mollis. Etiam dolor diam, semper nec sem et, convallis gravida urna.";
    958967
     
    10621071
    10631072        //pintamos el template del admin
    1064         private function build_admin_template($vista,$template, $variant= "back", $html=0){
     1073        private function build_admin_template($vista,$template, $variant= "back", $html= 0){
    10651074
    10661075
     
    10681077            $st = $variant;
    10691078            $this->get_all_vars($st);
    1070 
    10711079            if($variant == "back-js") {
    10721080                $this->templates_tabs($vista, 1);
     
    10761084            //else if($variant == "back-addon" or $variant == "back-addon-js") $this->templates_tabs($vista, 2);
    10771085            $temp = $this->vars;
    1078             if($template == "chbd") $template = isset($temp->base)?$temp->base:"";
     1086            if($template == "chbd") $template = $temp->base;
    10791087            include(CHRONOSLY_PATH.DIRECTORY_SEPARATOR."metaboxes".DIRECTORY_SEPARATOR."chronosly_dad_framework_metabox.php");
    10801088
     
    10861094            $st = "front";
    10871095            $this->get_all_vars($st);
     1096
    10881097            $temp = $this->vars;
    1089             if($template == "chbd") $template = isset($temp->base)?$temp->base:"";
     1098            // echo "<pre>";print_r($temp);echo "</pre>";
     1099            if($template == "chbd") $template = $temp->base;
     1100
    10901101            include(CHRONOSLY_PATH.DIRECTORY_SEPARATOR."metaboxes".DIRECTORY_SEPARATOR."chronosly_dad_framework_metabox.php");
    10911102
     
    10991110            $out1 = $out2 = "";
    11001111            $dadcats = apply_filters("chronosly_dad_tabs",$dadcats, $vista, $this->vars);//llamamos para generar el array de tabs
    1101         foreach($dadcats as $id=>$name){
    1102             $out1 .='<li><a href="#'.$id.'">'.__($name, "chronosly").'</a></li>';
    1103             $out2 .='<ul id="'.$id.'">';
    1104 
    1105             $ret = "";
    1106              $out2.= apply_filters("chronosly_dad_tabs_content_$id",  $ret, "dad1", $this->vars);
    1107             $out2 .="</ul>";
    1108             }
    1109              if(!$frontend or $frontend == 2){
    1110                  if(!$frontend) echo "<ul>$out1</ul>$out2";
    1111 
    1112                 //registramos el js para crear los addons en el dad del backend
    1113                 wp_register_script( 'chronosly-admin-elements', CHRONOSLY_URL.'/js/admin-elements.js', array( 'jquery' ));
    1114                 $translation_array = array(
    1115 
    1116                     "bubble_create_js_code" => json_encode($ch_bubble_create_js_code),
    1117                     "bubble_modify_js_code" => json_encode($ch_bubble_modify_js_code),
    1118                     "field_create_js_code" => json_encode($ch_field_create_js_code),
    1119                     "field_modify_js_code" => json_encode($ch_field_modify_js_code),
    1120                     "style_fields" => json_encode($ch_js_style_fields)
    1121                 );
    1122                 wp_localize_script( 'chronosly-admin-elements', 'translated', $translation_array );
    1123 
    1124                 wp_enqueue_script('chronosly-admin-elements');
    1125              }
     1112            foreach($dadcats as $id=>$name){
     1113                $out1 .='<li><a href="#'.$id.'">'.__($name, "chronosly").'</a></li>';
     1114                $out2 .='<ul id="'.$id.'">';
     1115
     1116                $ret = "";
     1117                // echo "chronosly_dad_tabs_content_$id";
     1118                 $out2.= apply_filters("chronosly_dad_tabs_content_$id",  $ret, "dad1", $this->vars);
     1119                $out2 .="</ul>";
     1120                }
     1121                 if(!$frontend or $frontend == 2){
     1122                     if(!$frontend) echo "<ul>$out1</ul>$out2";
     1123
     1124                    //registramos el js para crear los addons en el dad del backend
     1125                    wp_register_script( 'chronosly-admin-elements', CHRONOSLY_URL.'/js/admin-elements.js', array( 'jquery' ));
     1126                    $translation_array = array(
     1127
     1128                        "bubble_create_js_code" => json_encode($ch_bubble_create_js_code),
     1129                        "bubble_modify_js_code" => json_encode($ch_bubble_modify_js_code),
     1130                        "field_create_js_code" => json_encode($ch_field_create_js_code),
     1131                        "field_modify_js_code" => json_encode($ch_field_modify_js_code),
     1132                        "style_fields" => json_encode($ch_js_style_fields)
     1133                    );
     1134                    wp_localize_script( 'chronosly-admin-elements', 'translated', $translation_array );
     1135
     1136                    wp_enqueue_script('chronosly-admin-elements');
     1137                 }
    11261138        }
    11271139
     
    11551167            add_filter("chronosly_field_tickets_note_check", array("Chronosly_Dad_Elements", "tickets_note_check_field"), 25, 1);
    11561168
     1169
    11571170                $ret= array(
    11581171                    "event" => __("Event","chronosly"),
     
    12311244            $i = 1;
    12321245            add_filter("chronosly_bubble_ticket_list", array("Chronosly_Dad_Elements","set_new_bubble_ticket_list"), 10, 3);
     1246
    12331247            add_filter("chronosly_bubble_ticket_name", array("Chronosly_Dad_Elements","set_new_bubble_ticket_name"), 10, 3);
    12341248            add_filter("chronosly_bubble_ticket_price", array("Chronosly_Dad_Elements","set_new_bubble_ticket_price"), 10, 3);
    12351249            add_filter("chronosly_bubble_ticket_capacity", array("Chronosly_Dad_Elements","set_new_bubble_ticket_capacity"), 10, 3);
     1250            add_filter("chronosly_bubble_ticket_link", array("Chronosly_Dad_Elements","set_new_bubble_ticket_link"), 10, 3);
     1251            $return .= apply_filters("chronosly_bubble_ticket_list", 0, "", "");
    12361252            // add_filter("chronosly_bubble_ticket_min_per_user", array("Chronosly_Dad_Elements","set_new_bubble_ticket_min_per_user"), 10, 3);
    12371253            // add_filter("chronosly_bubble_ticket_max_per_user", array("Chronosly_Dad_Elements","set_new_bubble_ticket_max_per_user"), 10, 3);
    12381254            // add_filter("chronosly_bubble_ticket_start", array("Chronosly_Dad_Elements","set_new_bubble_ticket_start"), 10, 3);
    12391255            // add_filter("chronosly_bubble_ticket_end", array("Chronosly_Dad_Elements","set_new_bubble_ticket_end"), 10, 3);
    1240             add_filter("chronosly_bubble_ticket_notes", array("Chronosly_Dad_Elements","set_new_bubble_ticket_notes"), 10, 3);
    1241             add_filter("chronosly_bubble_ticket_link", array("Chronosly_Dad_Elements","set_new_bubble_ticket_link"), 10, 3);
    1242             $return .= apply_filters("chronosly_bubble_ticket_list", 0, "", "");
     1256            // add_filter("chronosly_bubble_ticket_notes", array("Chronosly_Dad_Elements","set_new_bubble_ticket_notes"), 10, 3);
    12431257            //mirar el order
    12441258            if(isset($vars->metas["tickets_vars"])){
     
    14451459
    14461460
    1447         public function parse_style($style, $html2=0){
     1461        public function parse_style($style){
    14481462            $s =array();
    14491463            $ex = explode(";", $style);
     
    14831497                                $color = $this->settings["chronosly_category_color"];
    14841498                            }
    1485                              if(!$this->settings["chronosly_sale_color"]){
     1499                            if(!$this->settings["chronosly_sale_color"]){
    14861500                                $color2 = "#ff9711";
    14871501                            } else $color2 = $this->settings["chronosly_sale_color"];
     1502
    14881503                            if($html2) $val = $value;
    14891504                            else $val = str_replace(array("#cat-color", "#sale-color", "#feat-image"), array($color,$color2, $featimg), $value);
     
    15641579
    15651580        public function print_item_box($item, $temp, $st, $html2=0){
    1566             global $tabs;
     1581            global $tabs, $timestamp;
    15671582            $out1 = $out2 = $out3 = $out11= $out111= "";
    15681583            $es = $this->parse_style($item->style);
     
    16331648                                    }
    16341649                                    //echo "chronosly_field_render_$type2<br/>";
    1635                                     if(($type2 == "custom_code" || $type2 == "custom_text") && $st == "back") $cont = " ".$value;
     1650                                    if(($type2 == "custom_code" || $type2 == "custom_text") && stripos($st,"back")!== FALSE) $cont = " ".$value;
    16361651                                    else $cont = "   ".apply_filters("chronosly_field_render_$type2", $cont,$value, $vars, $html2);
    16371652                                }
     
    16411656                                $width = "100%";
    16421657                                $height = "200";
    1643                                if($html2) $cont = "$tabs   <div id='gmap{{id}}{{timestamp}}' class='ev-data $type'  style='width:$width; height:{$height}px;#data_style'>\n$tabs $cont\n$tabs</div>";
     1658                                if($html2) $cont = "$tabs   <div id='gmap{{id}}{{timestamp}}' class='ev-data $type'  style='width:$width; height:{$height}px;#data_style'>\n$tabs $cont\n$tabs</div>";
    16441659                                else {
    16451660                                    $cont = "  $tabs<div id='gmap{$vars->pid}".$timestamp."' class='ev-data $type'  style='width:$width; height:{$height}px;#data_style'>\n$tabs     $cont\n$tabs    </div>";
     
    17641779       public function print_template_html($id, $vista, $draganddropels="", $template ="", $style="back", $args = array()){
    17651780            global $timestamp;
     1781            $timestamp = $timestamp+1;
    17661782            $vars = $this->settings;
    17671783            $data = "";
     
    17771793            // foreach($dads as $tid){
    17781794            $template = str_replace(" ", "_",$template);
    1779             if(isset($args["start"]) and isset($args["end"]) and $args["start"] and $args["start"]) $itid .= "_{$args["start"]}_{$args["end"]}";
     1795            if($args["start"] and $args["end"]) $itid .= "_{$args["start"]}_{$args["end"]}";
    17801796
    17811797            // if($style == "front" and $id =! 1 and  $html = Chronosly_Cache::load_item($itid, $vista)) {
     
    17861802
    17871803                if(isset($vars['chronosly_template_default_active']) and $vars['chronosly_template_default_active'] and stripos($_SERVER['HTTP_REFERER'], "chronosly_edit_templates") === FALSE ) $template = $vars['chronosly_template_default'];
    1788                 if(isset($_REQUEST["force_template"])) $template = $_REQUEST["force_template"];
     1804                if($_REQUEST["force_template"]) $template = $_REQUEST["force_template"];
    17891805
    17901806                if(!$template) $template = $this->get_tipo_template($id, $vista);
    17911807                if(!$template) $template = $vars['chronosly_template_default'];
    1792                 if(isset($this->vars->metas["featured"][0]) and $this->vars->metas["featured"][0] and file_exists($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html")){
     1808                if($this->vars->metas["featured"][0] and file_exists($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html")){
    17931809                    $f = fopen($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html", "r");
    17941810                    $content = @fread($f, filesize($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html"));
     
    18161832                    $featimg = wp_get_attachment_url( get_post_thumbnail_id($pid) );
    18171833                }
     1834
    18181835                if(!$color){
    18191836                    $color = $this->settings["chronosly_category_color"];
     
    18241841
    18251842                $content = str_replace(array("#cat-color", "#sale-color", "#feat-image"), array($color,$color2, $featimg), $content);
     1843
    18261844                echo $content;
    18271845                 // if($style == "front") Chronosly_Cache::save_item($itid, $vista, $content);
     
    19141932                        $f = explode(" ", trim($rep), 2);
    19151933                        $func = $f[0];
    1916                         $arg = isset($f[1])?$f[1]:"";
     1934                        $arg = $f[1];
    19171935                        $ret = $this->run_html_var_function($ret, $func, $arg);
    19181936                    }
     
    19331951
    19341952                $func = $f[0];
    1935                 $arg = isset($f[1])?$f[1]:"";
     1953                $arg = $f[1];
    19361954                $ret = $this->run_html_var_function($ret, $func, $arg);
    19371955
     
    20052023                    return Chronosly_dad_elements::chronosly_create_tags("", $vars);
    20062024                break;
     2025                case "tickets_list":
     2026                    return Chronosly_dad_elements::chronosly_create_ticket_list("", $vars);
     2027                break;
    20072028                case "seasons_list 1":
    20082029                    if(class_exists("Chronosly_Tickets_and_Repeats_Extended")){
     
    20172038                    } else return "";
    20182039                break;
    2019                 case "seasons_list":
    2020                     if(class_exists("Chronosly_Tickets_and_Repeats_Extended")){
    2021                         // echo "HOLA";
    2022                         return Chronosly_Tickets_and_Repeats_Extended::chronosly_create_seasons_item(0, $vars);
    2023                     } else return "";
    2024                 break;
    2025                
     2040
    20262041                case "full_date":
    20272042                case "full_time":
     
    20722087                case "ticket_notes":
    20732088                case "share_box":
    2074                
     2089
    20752090                    return trim($var);
    20762091
     
    20992114                    do_shortcode(__($func." ".$arg, "chronosly"));
    21002115                    $ret = ob_get_contents();
     2116                    if(!$ret){
     2117                     echo do_shortcode(__($func." ".$arg, "chronosly"));
     2118                      $ret = ob_get_contents();
     2119                    }
    21012120                    ob_end_clean();
    21022121                    return $ret;
     
    21532172                    return Chronosly_dad_elements::create_ticket_note($cont, $arg, $vars);
    21542173                break;
    2155                
    2156                case "seasons_calendar":
     2174
     2175                case "seasons_calendar":
    21572176                    if(class_exists("Chronosly_Tickets_and_Repeats_Extended")){
    21582177                        return Chronosly_Tickets_and_Repeats_Extended::chronosly_create_seasons_calendar_item($cont, $arg, $vars);
     
    23732392             echo "not recognized function $func<br>";
    23742393        }
     2394
    23752395    }//End class
    23762396
     
    23792399        public $post = "";
    23802400        public $vista = "";
    2381         public $base = "";
    2382         public $style = "";
    2383         public $boxes = "";
    23842401        public $args = array();
    23852402        public $metas = array();
  • chronosly-events-calendar/tags/2.2.7/post-types/post_type_chronosly.php

    r1277154 r1286972  
    858858
    859859        //devolvemos la posicion en la que deberia ir segun los settings
    860         public static function get_event_position($name, $meta, $id, $time){
     860        public static function get_event_position($name, $meta, $id, $time, $h=-1, $m=-1){
    861861            global $pastformat;
    862862            $settings =  unserialize(get_option("chronosly-settings"));
     
    10211021                    $start =  strtotime($meta["ev-from"][0]);
    10221022                   
    1023                     if(class_exists("Chronosly_Tickets_and_Repeats_Extended") and isset($meta["events"][0])){
     1023                     if(class_exists("Chronosly_Tickets_and_Repeats_Extended") and isset($meta["events"][0])){
    10241024                        $eventos = json_decode($meta["events"][0]);
    10251025                        $find = 0;
     1026                        $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    10261027                        // echo $from." 00:00";
    10271028                        // echo $to." 23:59";
    10281029                        // echo "<pre>";print_r($eventos);
    1029                         foreach ($eventos as $ev) {
    1030                             if(strtotime($ev->start) >= strtotime($from." 00:00")
    1031                                 and strtotime($ev->start) <= strtotime($to." 23:59")){
    1032                                  $find = 1;
     1030                        if(!$sets["seasons_normal_display"]){
     1031                            foreach ($eventos as $ev) {
     1032                                if(strtotime($ev->start) >= strtotime($from." 00:00")
     1033                                    and strtotime($ev->start) <= strtotime($to." 23:59")){
     1034                                     $find = 1;
     1035                                    }
     1036                            }
     1037                            if(!$find) continue;
     1038                            $pos = Post_Type_Chronosly::get_event_position(get_the_title(),$meta, get_the_ID(), $start);
     1039                            if(Post_Type_Chronosly::filter(get_the_ID())) {
     1040                                $elements[$pos] = get_the_ID();
     1041                            }
     1042                        } else {
     1043                            $tickets = array();
     1044                            if( isset($meta["tickets"][0])) $tickets = json_decode($meta["tickets"][0]);
     1045                            if(Post_Type_Chronosly::filter(get_the_ID())) Post_Type_Chronosly::seasons($eventos, strtotime($from), strtotime($to),$meta, $name, get_the_ID(), $elements, $tickets);
     1046                        }
     1047                    }
     1048                    else {
     1049                        $pos = Post_Type_Chronosly::get_event_position(get_the_title(),$meta, get_the_ID(), $start);
     1050                        if(Post_Type_Chronosly::filter(get_the_ID())) {
     1051                            $elements[$pos] = get_the_ID();
     1052                        }
     1053                    }
     1054
     1055
     1056                }
     1057
     1058            }
     1059            return $elements;
     1060
     1061        }
     1062
     1063         public static function seasons($eventos, $start, $end ,$meta, $name, $id, &$elements, $tickets){
     1064            $end = strtotime(date("Y-m-d", $end)." 23:59");
     1065            $settings =  unserialize(get_option("chronosly-settings"));
     1066           
     1067                // echo "<pre>";print_r($eventos);
     1068            foreach($eventos as $evento){
     1069                $from = strtotime(substr($evento->start, 0, stripos($evento->start, "+")-1));
     1070                $to = strtotime(substr($evento->end, 0, stripos( $evento->end, "+")-1));
     1071                if($_REQUEST["ch-price-min"]){
     1072                    if(!isset($evento->tickets)) continue;
     1073                    $tick = 0;
     1074                    //faltaria los sales que no los he podido controlar bien
     1075                    foreach ($evento->tickets as $t) {
     1076                        if($t->id && isset($tickets->tickets[$t->id])){
     1077                            foreach ($tickets->tickets[$t->id] as $t1) {
     1078                                if($t1->name == "price" && $t1->value >= $_REQUEST["ch-price-min"]){
     1079                                    $tick = 1;
     1080                                } else if($t->sale && $t1->name == "sales-price" && $t1->value >= $_REQUEST["ch-price-min"]){
     1081                                    $tick = 1;
    10331082                                }
    1034                         }
    1035                         if(!$find) continue;
    1036                     }
    1037 
    1038                     $pos = Post_Type_Chronosly::get_event_position(get_the_title(),$meta, get_the_ID(), $start);
    1039                     if(Post_Type_Chronosly::filter(get_the_ID())) {
    1040                         $elements[$pos] = get_the_ID();
    1041                     }
    1042 
    1043 
    1044                 }
    1045 
    1046             }
     1083                            }
     1084
     1085                        }
     1086                     } 
     1087                    if(!$tick) continue;
     1088                }
     1089                if($_REQUEST["ch-price-max"]){
     1090                    $tick = 0;
     1091                    //faltaria los sales que no los he podido controlar bien
     1092                    foreach ($evento->tickets as $t) {
     1093                        if($t->id && isset($tickets->tickets[$t->id])){
     1094                            foreach ( $tickets->tickets[$t->id] as $t1) {
     1095                                if($t1->name == "price" && $t1->value <= $_REQUEST["ch-price-max"]){
     1096                                    $tick = 1;
     1097                                } else if($t->sale && $t1->name == "sales-price" && $t1->value <= $_REQUEST["ch-price-max"]){
     1098                                    $tick = 1;
     1099                                }
     1100                            }
     1101
     1102                        }
     1103                     } 
     1104                    if(!$tick) continue;
     1105                }
     1106                // print_r($evento);
     1107                if(date('Y-m-d',$from) != date('Y-m-d',$to)) $to -= 60*60*24;
     1108
     1109                    if($to >= $start and $from <= $end){
     1110                   
     1111
     1112                           if($settings["chronosly_show_past_events"] != 1 or $from >= strtotime(date("Y-m-d"))) {
     1113                                $pos = Post_Type_Chronosly::get_event_position($name,$meta, $id, $from, date("H", $from), date("i", $from));
     1114                                // echo $pos." ";
     1115                                $elements[$pos]= array("id" => $id,"start" => $from, "end" => $to , "h" => date("H", $from), "m"=> date("i", $from), "eh" => date("H", $to), "em"=> date("i", $to));
     1116                            }
     1117                         
     1118                    }
     1119                }
     1120               
    10471121            return $elements;
    1048 
     1122           
    10491123        }
    10501124
  • chronosly-events-calendar/trunk/README.txt

    r1284685 r1286972  
    66Requires at least: 3.1
    77Tested up to: 4.3.1
    8 Stable tag: 2.2.6
     8Stable tag: 2.2.7
    99License: GPLv2
    1010
  • chronosly-events-calendar/trunk/chronosly.php

    r1284685 r1286972  
    44 * Plugin URI: http://www.chronosly.com
    55 * Description: Chronosly is one of the plugins you have always dreamt about. Designed to suit all users (basic, designers, and software developers). Choose your template and you are ready to publish your events. Install addons to enhance the preset plugin features. You can get a wide selection of templates and addons in our marketplace
    6  * Version: 2.2.6
     6 * Version: 2.2.7
    77 * Author: Heimsveld IPBN
    88 * Author URI: http://www.heimsveld.com
     
    2626define('CHRONOSLY_TEMPLATES_URL',  plugins_url()."/chronosly-templates"); //path para incluir scripts o css
    2727define('CHRONOSLY_DEBUG', false); //debug mode
    28 define('CHRONOSLY_VERSION', "2.2.6"); //debug mode
     28define('CHRONOSLY_VERSION', "2.2.7"); //debug mode
    2929define('CHRONOSLY_ADMIN_INTERFACE', 1);  //Todo: hacer diferentes interficies de admin simple o varios event
    3030define('CHRONOSLY_ADMIN_MODALITY', 1);  //Todo: hacer diferentes modalidades segun la tematica
  • chronosly-events-calendar/trunk/classes/chronosly_dad_elements.php

    r1272735 r1286972  
    12411241
    12421242            // print_r($vars->metas["ev-from"]);
    1243 
    12441243            $lorem = 0;
     1244
    12451245            switch ($extra) {
    12461246            case "full_datetime":
     
    13031303
    13041304            case "full_time":
    1305 
    13061305                if ($html) {
    13071306                    $cont = str_replace("}}", " | time_format $value}}", $cont);
    13081307                }
    13091308                else {
     1309
    13101310                    if (!$value) $value = $settings["chronosly_format_time"];
    13111311                    if(!isset($vars->metas["events"][0]) or $vars->metas["events"][0] == "") {
     
    13311331                        if (!$cont) $cont = __("All day long", "chronosly");
    13321332                    } else {
    1333                         $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    1334                         if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
    1335                         $s = json_decode($vars->metas["ev-from-h"][0]);
    1336                         foreach($s as $id=>$s1) if($s1 == ":") $s[$id] = __("All day long", "chronosly");
    1337                         if(is_array($s)) $cont .= implode(", ", $s);
    1338                         else $cont .=  $s;
     1333
     1334                         $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1335
     1336                          if(!$sets["seasons_normal_display"]){
     1337                            $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1338                            if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
     1339                            $s = json_decode($vars->metas["ev-from-h"][0]);
     1340                            foreach($s as $id=>$s1) if($s1 == ":") $s[$id] = __("All day long", "chronosly");
     1341                            if(is_array($s)) $cont .= implode(", ", $s);
     1342                            else $cont .=  $s;
     1343                        } else {
     1344
     1345                            $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1346
     1347                            if($_REQUEST["repeat"]){
     1348                                $ses = explode("_", $_REQUEST["repeat"]);
     1349                                if(count($ses) == 4) $date1 = $vars->metas["ev-from"][0] . " " . $ses[2] . ":" . $ses[3];
     1350                            }else {
     1351
     1352                                $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1353                            }
     1354                            $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     1355                            if (stripos($vars->metas["ev-from-h"][0], "'lorem'") === FALSE) $lorem = 0;
     1356                            $date1o = strtotime($date1);
     1357                            if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1358                            else $cont.= strftime($value, $date1o);
     1359                        }
     1360                     
    13391361                    }
    13401362                }
     
    13571379                        else $cont.= strftime($value, $date1o);
    13581380                    } else {
    1359                          $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    1360                         if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
    1361 
    1362                         $s = json_decode($vars->metas["ev-from-h"][0]);
    1363                         if(is_array($s)) $cont .= implode(", ", $s);
    1364                         else $cont .=  $s;
     1381                         $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1382                     
     1383                        if(!$sets["seasons_normal_display"]){
     1384                             $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1385                            if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
     1386
     1387                            $s = json_decode($vars->metas["ev-from-h"][0]);
     1388                            if(is_array($s)) $cont .= implode(", ", $s);
     1389                            else $cont .=  $s;
     1390                        } else {
     1391                            $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1392                            $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     1393                            if (stripos($vars->metas["ev-from-h"][0], "'lorem'") === FALSE) $lorem = 0;
     1394                            $date1o = strtotime($date1);
     1395                            if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1396                            else $cont.= strftime($value, $date1o);
     1397                        }
    13651398                    }
    13661399                }
     
    13901423                }
    13911424                else {
    1392 
    13931425                    if (!$value) $value = $settings["chronosly_format_date"];
    13941426                    $date1 = $vars->metas["ev-from"][0];
     1427                    // echo "<pre>";print_r($vars->metas);
    13951428                    if(!isset($vars->metas["events"][0]) or $vars->metas["events"][0] == "") $date1 .= " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
    13961429                    $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     
    13981431                    $date1o = strtotime($date1);
    13991432                    if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1433
    14001434                    else $cont.= strftime($value, $date1o);
    14011435                }
     
    14351469                    } else {
    14361470
    1437                          $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    1438                         if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
    1439 ;
    1440                        
    1441                         $s = json_decode($vars->metas["ev-from-h"][0]);
    1442 
    1443                         // $m = json_decode($vars->metas["ev-from-m"][0]);
    1444                         if(is_array($s)) {
    1445                             foreach ($s as $v) {
    1446                                 if($v == ":") $cont .= __("All day long", "chronosly").", ";
    1447                                 else $cont .= $v.", ";
     1471                         $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1472                     
     1473                        if(!$sets["seasons_normal_display"]){
     1474                             $tickets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
     1475                            if(stripos($vars->metas["ev-from-h"][0], ",")) $cont = __($tickets["event_repeats_seasons_name"], "chronosly")." ";
     1476   
     1477                           
     1478                            $s = json_decode($vars->metas["ev-from-h"][0]);
     1479
     1480                            // $m = json_decode($vars->metas["ev-from-m"][0]);
     1481                            if(is_array($s)) {
     1482                                foreach ($s as $v) {
     1483                                    if($v == ":") $cont .= __("All day long", "chronosly").", ";
     1484                                    else $cont .= $v.", ";
     1485                                }
     1486                                $cont = substr($cont, 0,-2);
    14481487                            }
    1449                             $cont = substr($cont, 0,-2);
    1450                         }
    1451                         else {
    1452                            if($s == ":") $cont .= __("All day long", "chronosly");
    1453                            else $cont .= $s;
     1488                            else {
     1489                               if($s == ":") $cont .= __("All day long", "chronosly");
     1490                               else $cont .= $s;
     1491                            }
     1492                        } else {
     1493                            $date1 = $vars->metas["ev-from"][0] . " " . $vars->metas["ev-from-h"][0] . ":" . $vars->metas["ev-from-m"][0];
     1494                            $date1 = str_replace("<span class='lorem'></span>", "", $date1, $lorem);
     1495                            if (stripos($vars->metas["ev-from-h"][0], "'lorem'") === FALSE) $lorem = 0;
     1496                            $date1o = strtotime($date1);
     1497                            if (stripos($value, "%") === FALSE) $cont.= date_i18n($value, $date1o);
     1498                            else $cont.= strftime($value, $date1o);
    14541499                        }
    14551500                        // print_r($vars->metas["ev-from-h"][0]);
  • chronosly-events-calendar/trunk/classes/chronosly_extend.php

    r1284685 r1286972  
    623623
    624624
    625 
  • chronosly-events-calendar/trunk/classes/chronosly_shortcode.php

    r1284685 r1286972  
    480480} // END
    481481
    482 
  • chronosly-events-calendar/trunk/classes/chronosly_templates.php

    r1272735 r1286972  
    11<?php
    2 //javascript call
    32
    43
     
    2726                add_action( 'wp_ajax_chronosly_get_tipo_template', array(&$this, 'js_get_tipo_template' ));
    2827                add_action( 'wp_ajax_chronosly_clear_cache', array(&$this, 'js_clear_cache' ));
     28                add_action( 'wp_ajax_chronosly_save_all_html_templates', array(&$this, 'save_all_html_templates' ));
    2929                //add_filter( 'heartbeat_received', array(&$this, 'js_preview_theme' ), 10, 3 );
    3030               //load init vars for templates
     
    3333
    3434            }
    35 
    36 
    3735
    3836            add_filter("chronosly_dad_tabs", array("Chronosly_Templates", "chronosly_get_default_dad_tabs"), 5, 3);//get de default tabs for dad
     
    8583        }
    8684
    87         public function set_shortcode_template_css($template="default"){
     85           public function set_shortcode_template_css($template="default"){
    8886            wp_register_style( "chronosly_$template", CHRONOSLY_TEMPLATES_URL.'/css/'.$template.'.css');
    8987            wp_print_styles("chronosly_$template");
     
    123121            }
    124122        }
    125 
    126123
    127124
     
    180177                    fwrite( $f , $html);
    181178                    fclose($f);
    182 
     179                    // echo "hola";
    183180                    $this->template_2_html($name, $tid);
    184181                    /*
     
    316313                while (false !== ($entry = readdir($handle))) {
    317314                    if($entry != "." and $entry != ".." and !stripos($entry, ".html") )
    318 
    319                      $custom_templates[] = str_replace(array(".php","_"), array("", " "),$entry);
     315                        $custom_templates[] = str_replace(array(".php","_"), array("", " "),$entry);
    320316
    321317                }
     
    510506            }
    511507            //faltan los calendars
    512 
    513508            return $return;
    514509        }
     
    605600            $this->vars->args = $args;
    606601            $itid = $id;
    607             if(isset($args["start"]) and isset($args["end"])) $itid .= "_{$args["start"]}_{$args["end"]}";
     602            if($args["start"] and $args["end"]) $itid .= "_{$args["start"]}_{$args["end"]}";
    608603            if($args["h"] and $args["m"]) $itid .= "_{$args["h"]}_{$args["m"]}";
    609             //si lo tenemos en la cache lo pintamos, si no lo generamos y lo guardamos
     604
     605            //controlamos para hacerlo por html o por json
    610606
    611607            $path = CHRONOSLY_TEMPLATES_PATH.DIRECTORY_SEPARATOR;
    612608            if(isset($vars['chronosly_template_default_active']) and $vars['chronosly_template_default_active'] and stripos($_SERVER['HTTP_REFERER'], "chronosly_edit_templates") === FALSE ) $template = $vars['chronosly_template_default'];
    613             if(isset($_REQUEST["force_template"])) $template = $_REQUEST["force_template"];
     609            if($_REQUEST["force_template"]) $template = $_REQUEST["force_template"];
    614610
    615611            if(!$template) $template = $this->get_tipo_template($id, $vista);
     
    619615                return $this->print_template_html($id, $vista, $draganddropels, $template, $style, $args, $html2);
    620616            }
    621 
    622 
     617            // echo $path.$vista.DIRECTORY_SEPARATOR.$template.".html";
     618
     619            //si lo tenemos en la cache lo pintamos, si no lo generamos y lo guardamos
    623620            if($style == "front" and $id != 1 and $html = Chronosly_Cache::load_item($itid, $vista)) {
    624621               echo $html;
    625622            }
    626623            else {
     624
    627625                ob_start();
    628626
     
    638636
    639637                    $this->render_template($template, $style, $vista, json_decode($data), $draganddropels, $html2 );
     638
    640639                }
    641640                $cont= str_replace("{{notprev}}", "",ob_get_clean());
    642641                echo $cont;
     642
    643643                if($style == "front") Chronosly_Cache::save_item($itid, $vista, $cont);
    644644            }
     
    654654                $path = CHRONOSLY_TEMPLATES_PATH;//ruta hacia los templates del user
    655655                $vars = $this->get_template_vars($path.DIRECTORY_SEPARATOR.$vista.DIRECTORY_SEPARATOR.$template.".php");//ruta hacia el dad que toca
     656
    656657            }
    657658            if(($style == "back-addon" or $style == "back-addon-js") and isset($_REQUEST['addon']) and has_filter("chronosly_update_template_".$_REQUEST['addon'])) {
     
    664665            $args = $this->vars->args;
    665666            if($vars) $this->vars = $vars;
    666 
    667667            if($dadcats) $this->dadcats = $dadcats;
    668668            $this->vars->pid = $id;
     
    675675            }
    676676            else if ($style == "front"){
     677
    677678                $this->build_front_template($vista,$template, $html2);
    678679
     
    682683
    683684            }
     685
    684686        }
    685687
     
    696698        //cargamos las variables necesarias para pintar el template, las metas de organizer, place, etc..
    697699        private function get_all_vars($style){
     700
    698701            global $pastformat;
    699702            if(isset($this->vars->args["id"]) and $this->vars->args["id"]) {
     
    717720            if((!isset($this->vars->post) or !is_object($this->vars->post)) and isset($post[0])) $this->vars->post = $post[0];
    718721            if(!isset($this->vars->pid) and isset($post[0])) $this->vars->pid = $post[0]->ID;
     722
    719723            if($this->vars->vista != "dad11" and $this->vars->vista != "dad12" ) $this->vars->metas = get_post_meta($this->vars->pid);//assing metas vars
    720724
    721725            if(isset($this->vars->metas['organizer'])){
    722726                foreach($this->vars->metas['organizer'] as $orgs){
    723 
    724727                    $orgs = unserialize($orgs);
    725728
     
    740743                $this->vars->metas['organizer_vars'][] = array("post" =>  (isset($this->vars->post)?$this->vars->post:""), "metas" => $this->vars->metas);
    741744            }
     745
    742746            if(isset($this->vars->metas['places'])){
    743747                foreach($this->vars->metas['places'] as $orgs){
     
    746750                        foreach($orgs as $org){
    747751                            if(function_exists("icl_object_id")) $org = icl_object_id($org, "chronosly_places");
    748 
    749752                            $post = get_posts('post_type=chronosly_places&p='.$org);
    750753                            $this->vars->metas['places_vars'][] = array("post" =>  $post[0], "metas" => get_post_meta($org));
     
    770773                $this->vars->metas['cats_vars'][0]->metas = $this->vars->metas;//assing metas vars
    771774            }
     775
    772776            //ordenamos segun orden
    773777            if(isset($this->vars->metas['cats_vars'])) usort($this->vars->metas['cats_vars'], array("Chronosly_Templates", "ordenar_cats"));
     778
    774779            if($this->vars->vista != "dad11" and $this->vars->vista != "dad12" ){
     780
    775781                $tags = wp_get_object_terms($this->vars->pid, "chronosly_tag");
    776782                foreach($tags as $tag){
     
    778784                    //faltan los metas
    779785                }
     786
    780787                $vars = "";
    781788                if(isset($this->vars->metas['tickets'])) $vars = json_decode($this->vars->metas['tickets'][0]);
     789
    782790               if(isset($vars->tickets) and count($vars->tickets)){
    783791                   for($i = 1; $i < count($vars->tickets);++$i){
     
    788796
    789797                   }
     798
    790799               }
     800
    791801                $this->vars->link = get_post_permalink($this->vars->pid);
     802
    792803            }
    793804
     
    798809                foreach($this->vars->args as $k => $v){
    799810                    switch($k){
    800                        case "id":
     811                        case "id":
    801812                            $this->vars->pid = $v;
    802813                            if(!isset($this->vars->post)) $this->vars->post = new stdClass();
     
    828839
    829840                            break;
    830                              case "eh":
     841                        case "eh":
    831842                            $this->vars->metas['ev-to-h'][0] = $v;
    832                            
     843
    833844
    834845                            break;
    835846                         case "em":
    836847                            $this->vars->metas['ev-to-m'][0] = $v;
    837                            
     848
    838849
    839850                            break;
    840851
    841 
    842852                    }
    843853
     
    846856
    847857            //cargariamos el hook de data_field
    848             // print_r($this->vars);
     858
    849859            $this->set_default_text($style);
    850860
     
    945955                    $this->vars->metas["tickets_vars"][1]["title"] = "<span class='lorem'></span>Ticket lorem ipsum";
    946956                    $this->vars->metas["tickets_vars"][1]["price"] = "<span class='lorem'></span>49";
    947                     $this->vars->metas["tickets_vars"][1]["capacity"] = "<span class='lorem'></span>100";   
    948957                    $this->vars->metas["tickets_vars"][1]["sale-price"] = "<span class='lorem'></span>39";
    949 
     958                    $this->vars->metas["tickets_vars"][1]["capacity"] = "<span class='lorem'></span>100";
    950959                    // $this->vars->metas["tickets_vars"][1]["min-user"] = "<span class='lorem'></span>1";
    951960                    // $this->vars->metas["tickets_vars"][1]["max-user"] = "<span class='lorem'></span>5";
     
    954963                    $this->vars->metas["tickets_vars"][1]["link"] = "<span class='lorem'></span>link.com";
    955964                    $this->vars->metas["tickets_vars"][1]["soldout"] = "";
    956                      $this->vars->metas["tickets_vars"][1]["sale"] = "";
     965                    $this->vars->metas["tickets_vars"][1]["sale"] = "";
    957966                    $this->vars->metas["tickets_vars"][1]["notes"] = "<span class='lorem'></span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ultrices, ante commodo elementum posuere, velit justo fermentum enim, placerat tincidunt massa leo convallis purus. Praesent cursus arcu non tortor iaculis, eleifend lacinia enim euismod. Etiam consequat porttitor sapien, vitae feugiat nunc accumsan at. Mauris ultrices pretium lacus, vitae dapibus enim pharetra ut. Curabitur gravida vel lorem quis sollicitudin. Fusce commodo, mi et bibendum elementum, eros enim dapibus arcu, gravida rhoncus felis nulla ut eros. Suspendisse consequat ligula rhoncus erat gravida, et mollis quam placerat. Morbi in diam vestibulum, tempus ante molestie, pharetra nibh. Etiam nulla risus, imperdiet eu tincidunt a, hendrerit a elit. Nullam ut tincidunt augue. Aenean vehicula nulla sed ipsum bibendum, non congue risus mollis. Etiam dolor diam, semper nec sem et, convallis gravida urna.";
    958967
     
    10621071
    10631072        //pintamos el template del admin
    1064         private function build_admin_template($vista,$template, $variant= "back", $html=0){
     1073        private function build_admin_template($vista,$template, $variant= "back", $html= 0){
    10651074
    10661075
     
    10681077            $st = $variant;
    10691078            $this->get_all_vars($st);
    1070 
    10711079            if($variant == "back-js") {
    10721080                $this->templates_tabs($vista, 1);
     
    10761084            //else if($variant == "back-addon" or $variant == "back-addon-js") $this->templates_tabs($vista, 2);
    10771085            $temp = $this->vars;
    1078             if($template == "chbd") $template = isset($temp->base)?$temp->base:"";
     1086            if($template == "chbd") $template = $temp->base;
    10791087            include(CHRONOSLY_PATH.DIRECTORY_SEPARATOR."metaboxes".DIRECTORY_SEPARATOR."chronosly_dad_framework_metabox.php");
    10801088
     
    10861094            $st = "front";
    10871095            $this->get_all_vars($st);
     1096
    10881097            $temp = $this->vars;
    1089             if($template == "chbd") $template = isset($temp->base)?$temp->base:"";
     1098            // echo "<pre>";print_r($temp);echo "</pre>";
     1099            if($template == "chbd") $template = $temp->base;
     1100
    10901101            include(CHRONOSLY_PATH.DIRECTORY_SEPARATOR."metaboxes".DIRECTORY_SEPARATOR."chronosly_dad_framework_metabox.php");
    10911102
     
    10991110            $out1 = $out2 = "";
    11001111            $dadcats = apply_filters("chronosly_dad_tabs",$dadcats, $vista, $this->vars);//llamamos para generar el array de tabs
    1101         foreach($dadcats as $id=>$name){
    1102             $out1 .='<li><a href="#'.$id.'">'.__($name, "chronosly").'</a></li>';
    1103             $out2 .='<ul id="'.$id.'">';
    1104 
    1105             $ret = "";
    1106              $out2.= apply_filters("chronosly_dad_tabs_content_$id",  $ret, "dad1", $this->vars);
    1107             $out2 .="</ul>";
    1108             }
    1109              if(!$frontend or $frontend == 2){
    1110                  if(!$frontend) echo "<ul>$out1</ul>$out2";
    1111 
    1112                 //registramos el js para crear los addons en el dad del backend
    1113                 wp_register_script( 'chronosly-admin-elements', CHRONOSLY_URL.'/js/admin-elements.js', array( 'jquery' ));
    1114                 $translation_array = array(
    1115 
    1116                     "bubble_create_js_code" => json_encode($ch_bubble_create_js_code),
    1117                     "bubble_modify_js_code" => json_encode($ch_bubble_modify_js_code),
    1118                     "field_create_js_code" => json_encode($ch_field_create_js_code),
    1119                     "field_modify_js_code" => json_encode($ch_field_modify_js_code),
    1120                     "style_fields" => json_encode($ch_js_style_fields)
    1121                 );
    1122                 wp_localize_script( 'chronosly-admin-elements', 'translated', $translation_array );
    1123 
    1124                 wp_enqueue_script('chronosly-admin-elements');
    1125              }
     1112            foreach($dadcats as $id=>$name){
     1113                $out1 .='<li><a href="#'.$id.'">'.__($name, "chronosly").'</a></li>';
     1114                $out2 .='<ul id="'.$id.'">';
     1115
     1116                $ret = "";
     1117                // echo "chronosly_dad_tabs_content_$id";
     1118                 $out2.= apply_filters("chronosly_dad_tabs_content_$id",  $ret, "dad1", $this->vars);
     1119                $out2 .="</ul>";
     1120                }
     1121                 if(!$frontend or $frontend == 2){
     1122                     if(!$frontend) echo "<ul>$out1</ul>$out2";
     1123
     1124                    //registramos el js para crear los addons en el dad del backend
     1125                    wp_register_script( 'chronosly-admin-elements', CHRONOSLY_URL.'/js/admin-elements.js', array( 'jquery' ));
     1126                    $translation_array = array(
     1127
     1128                        "bubble_create_js_code" => json_encode($ch_bubble_create_js_code),
     1129                        "bubble_modify_js_code" => json_encode($ch_bubble_modify_js_code),
     1130                        "field_create_js_code" => json_encode($ch_field_create_js_code),
     1131                        "field_modify_js_code" => json_encode($ch_field_modify_js_code),
     1132                        "style_fields" => json_encode($ch_js_style_fields)
     1133                    );
     1134                    wp_localize_script( 'chronosly-admin-elements', 'translated', $translation_array );
     1135
     1136                    wp_enqueue_script('chronosly-admin-elements');
     1137                 }
    11261138        }
    11271139
     
    11551167            add_filter("chronosly_field_tickets_note_check", array("Chronosly_Dad_Elements", "tickets_note_check_field"), 25, 1);
    11561168
     1169
    11571170                $ret= array(
    11581171                    "event" => __("Event","chronosly"),
     
    12311244            $i = 1;
    12321245            add_filter("chronosly_bubble_ticket_list", array("Chronosly_Dad_Elements","set_new_bubble_ticket_list"), 10, 3);
     1246
    12331247            add_filter("chronosly_bubble_ticket_name", array("Chronosly_Dad_Elements","set_new_bubble_ticket_name"), 10, 3);
    12341248            add_filter("chronosly_bubble_ticket_price", array("Chronosly_Dad_Elements","set_new_bubble_ticket_price"), 10, 3);
    12351249            add_filter("chronosly_bubble_ticket_capacity", array("Chronosly_Dad_Elements","set_new_bubble_ticket_capacity"), 10, 3);
     1250            add_filter("chronosly_bubble_ticket_link", array("Chronosly_Dad_Elements","set_new_bubble_ticket_link"), 10, 3);
     1251            $return .= apply_filters("chronosly_bubble_ticket_list", 0, "", "");
    12361252            // add_filter("chronosly_bubble_ticket_min_per_user", array("Chronosly_Dad_Elements","set_new_bubble_ticket_min_per_user"), 10, 3);
    12371253            // add_filter("chronosly_bubble_ticket_max_per_user", array("Chronosly_Dad_Elements","set_new_bubble_ticket_max_per_user"), 10, 3);
    12381254            // add_filter("chronosly_bubble_ticket_start", array("Chronosly_Dad_Elements","set_new_bubble_ticket_start"), 10, 3);
    12391255            // add_filter("chronosly_bubble_ticket_end", array("Chronosly_Dad_Elements","set_new_bubble_ticket_end"), 10, 3);
    1240             add_filter("chronosly_bubble_ticket_notes", array("Chronosly_Dad_Elements","set_new_bubble_ticket_notes"), 10, 3);
    1241             add_filter("chronosly_bubble_ticket_link", array("Chronosly_Dad_Elements","set_new_bubble_ticket_link"), 10, 3);
    1242             $return .= apply_filters("chronosly_bubble_ticket_list", 0, "", "");
     1256            // add_filter("chronosly_bubble_ticket_notes", array("Chronosly_Dad_Elements","set_new_bubble_ticket_notes"), 10, 3);
    12431257            //mirar el order
    12441258            if(isset($vars->metas["tickets_vars"])){
     
    14451459
    14461460
    1447         public function parse_style($style, $html2=0){
     1461        public function parse_style($style){
    14481462            $s =array();
    14491463            $ex = explode(";", $style);
     
    14831497                                $color = $this->settings["chronosly_category_color"];
    14841498                            }
    1485                              if(!$this->settings["chronosly_sale_color"]){
     1499                            if(!$this->settings["chronosly_sale_color"]){
    14861500                                $color2 = "#ff9711";
    14871501                            } else $color2 = $this->settings["chronosly_sale_color"];
     1502
    14881503                            if($html2) $val = $value;
    14891504                            else $val = str_replace(array("#cat-color", "#sale-color", "#feat-image"), array($color,$color2, $featimg), $value);
     
    15641579
    15651580        public function print_item_box($item, $temp, $st, $html2=0){
    1566             global $tabs;
     1581            global $tabs, $timestamp;
    15671582            $out1 = $out2 = $out3 = $out11= $out111= "";
    15681583            $es = $this->parse_style($item->style);
     
    16331648                                    }
    16341649                                    //echo "chronosly_field_render_$type2<br/>";
    1635                                     if(($type2 == "custom_code" || $type2 == "custom_text") && $st == "back") $cont = " ".$value;
     1650                                    if(($type2 == "custom_code" || $type2 == "custom_text") && stripos($st,"back")!== FALSE) $cont = " ".$value;
    16361651                                    else $cont = "   ".apply_filters("chronosly_field_render_$type2", $cont,$value, $vars, $html2);
    16371652                                }
     
    16411656                                $width = "100%";
    16421657                                $height = "200";
    1643                                if($html2) $cont = "$tabs   <div id='gmap{{id}}{{timestamp}}' class='ev-data $type'  style='width:$width; height:{$height}px;#data_style'>\n$tabs $cont\n$tabs</div>";
     1658                                if($html2) $cont = "$tabs   <div id='gmap{{id}}{{timestamp}}' class='ev-data $type'  style='width:$width; height:{$height}px;#data_style'>\n$tabs $cont\n$tabs</div>";
    16441659                                else {
    16451660                                    $cont = "  $tabs<div id='gmap{$vars->pid}".$timestamp."' class='ev-data $type'  style='width:$width; height:{$height}px;#data_style'>\n$tabs     $cont\n$tabs    </div>";
     
    17641779       public function print_template_html($id, $vista, $draganddropels="", $template ="", $style="back", $args = array()){
    17651780            global $timestamp;
     1781            $timestamp = $timestamp+1;
    17661782            $vars = $this->settings;
    17671783            $data = "";
     
    17771793            // foreach($dads as $tid){
    17781794            $template = str_replace(" ", "_",$template);
    1779             if(isset($args["start"]) and isset($args["end"]) and $args["start"] and $args["start"]) $itid .= "_{$args["start"]}_{$args["end"]}";
     1795            if($args["start"] and $args["end"]) $itid .= "_{$args["start"]}_{$args["end"]}";
    17801796
    17811797            // if($style == "front" and $id =! 1 and  $html = Chronosly_Cache::load_item($itid, $vista)) {
     
    17861802
    17871803                if(isset($vars['chronosly_template_default_active']) and $vars['chronosly_template_default_active'] and stripos($_SERVER['HTTP_REFERER'], "chronosly_edit_templates") === FALSE ) $template = $vars['chronosly_template_default'];
    1788                 if(isset($_REQUEST["force_template"])) $template = $_REQUEST["force_template"];
     1804                if($_REQUEST["force_template"]) $template = $_REQUEST["force_template"];
    17891805
    17901806                if(!$template) $template = $this->get_tipo_template($id, $vista);
    17911807                if(!$template) $template = $vars['chronosly_template_default'];
    1792                 if(isset($this->vars->metas["featured"][0]) and $this->vars->metas["featured"][0] and file_exists($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html")){
     1808                if($this->vars->metas["featured"][0] and file_exists($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html")){
    17931809                    $f = fopen($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html", "r");
    17941810                    $content = @fread($f, filesize($path.$vista.DIRECTORY_SEPARATOR.$template."_featured.html"));
     
    18161832                    $featimg = wp_get_attachment_url( get_post_thumbnail_id($pid) );
    18171833                }
     1834
    18181835                if(!$color){
    18191836                    $color = $this->settings["chronosly_category_color"];
     
    18241841
    18251842                $content = str_replace(array("#cat-color", "#sale-color", "#feat-image"), array($color,$color2, $featimg), $content);
     1843
    18261844                echo $content;
    18271845                 // if($style == "front") Chronosly_Cache::save_item($itid, $vista, $content);
     
    19141932                        $f = explode(" ", trim($rep), 2);
    19151933                        $func = $f[0];
    1916                         $arg = isset($f[1])?$f[1]:"";
     1934                        $arg = $f[1];
    19171935                        $ret = $this->run_html_var_function($ret, $func, $arg);
    19181936                    }
     
    19331951
    19341952                $func = $f[0];
    1935                 $arg = isset($f[1])?$f[1]:"";
     1953                $arg = $f[1];
    19361954                $ret = $this->run_html_var_function($ret, $func, $arg);
    19371955
     
    20052023                    return Chronosly_dad_elements::chronosly_create_tags("", $vars);
    20062024                break;
     2025                case "tickets_list":
     2026                    return Chronosly_dad_elements::chronosly_create_ticket_list("", $vars);
     2027                break;
    20072028                case "seasons_list 1":
    20082029                    if(class_exists("Chronosly_Tickets_and_Repeats_Extended")){
     
    20172038                    } else return "";
    20182039                break;
    2019                 case "seasons_list":
    2020                     if(class_exists("Chronosly_Tickets_and_Repeats_Extended")){
    2021                         // echo "HOLA";
    2022                         return Chronosly_Tickets_and_Repeats_Extended::chronosly_create_seasons_item(0, $vars);
    2023                     } else return "";
    2024                 break;
    2025                
     2040
    20262041                case "full_date":
    20272042                case "full_time":
     
    20722087                case "ticket_notes":
    20732088                case "share_box":
    2074                
     2089
    20752090                    return trim($var);
    20762091
     
    20992114                    do_shortcode(__($func." ".$arg, "chronosly"));
    21002115                    $ret = ob_get_contents();
     2116                    if(!$ret){
     2117                     echo do_shortcode(__($func." ".$arg, "chronosly"));
     2118                      $ret = ob_get_contents();
     2119                    }
    21012120                    ob_end_clean();
    21022121                    return $ret;
     
    21532172                    return Chronosly_dad_elements::create_ticket_note($cont, $arg, $vars);
    21542173                break;
    2155                
    2156                case "seasons_calendar":
     2174
     2175                case "seasons_calendar":
    21572176                    if(class_exists("Chronosly_Tickets_and_Repeats_Extended")){
    21582177                        return Chronosly_Tickets_and_Repeats_Extended::chronosly_create_seasons_calendar_item($cont, $arg, $vars);
     
    23732392             echo "not recognized function $func<br>";
    23742393        }
     2394
    23752395    }//End class
    23762396
     
    23792399        public $post = "";
    23802400        public $vista = "";
    2381         public $base = "";
    2382         public $style = "";
    2383         public $boxes = "";
    23842401        public $args = array();
    23852402        public $metas = array();
  • chronosly-events-calendar/trunk/post-types/post_type_chronosly.php

    r1277154 r1286972  
    858858
    859859        //devolvemos la posicion en la que deberia ir segun los settings
    860         public static function get_event_position($name, $meta, $id, $time){
     860        public static function get_event_position($name, $meta, $id, $time, $h=-1, $m=-1){
    861861            global $pastformat;
    862862            $settings =  unserialize(get_option("chronosly-settings"));
     
    10211021                    $start =  strtotime($meta["ev-from"][0]);
    10221022                   
    1023                     if(class_exists("Chronosly_Tickets_and_Repeats_Extended") and isset($meta["events"][0])){
     1023                     if(class_exists("Chronosly_Tickets_and_Repeats_Extended") and isset($meta["events"][0])){
    10241024                        $eventos = json_decode($meta["events"][0]);
    10251025                        $find = 0;
     1026                        $sets = unserialize(get_option("chronosly_settings_tickets_and_repeats_extended"));
    10261027                        // echo $from." 00:00";
    10271028                        // echo $to." 23:59";
    10281029                        // echo "<pre>";print_r($eventos);
    1029                         foreach ($eventos as $ev) {
    1030                             if(strtotime($ev->start) >= strtotime($from." 00:00")
    1031                                 and strtotime($ev->start) <= strtotime($to." 23:59")){
    1032                                  $find = 1;
     1030                        if(!$sets["seasons_normal_display"]){
     1031                            foreach ($eventos as $ev) {
     1032                                if(strtotime($ev->start) >= strtotime($from." 00:00")
     1033                                    and strtotime($ev->start) <= strtotime($to." 23:59")){
     1034                                     $find = 1;
     1035                                    }
     1036                            }
     1037                            if(!$find) continue;
     1038                            $pos = Post_Type_Chronosly::get_event_position(get_the_title(),$meta, get_the_ID(), $start);
     1039                            if(Post_Type_Chronosly::filter(get_the_ID())) {
     1040                                $elements[$pos] = get_the_ID();
     1041                            }
     1042                        } else {
     1043                            $tickets = array();
     1044                            if( isset($meta["tickets"][0])) $tickets = json_decode($meta["tickets"][0]);
     1045                            if(Post_Type_Chronosly::filter(get_the_ID())) Post_Type_Chronosly::seasons($eventos, strtotime($from), strtotime($to),$meta, $name, get_the_ID(), $elements, $tickets);
     1046                        }
     1047                    }
     1048                    else {
     1049                        $pos = Post_Type_Chronosly::get_event_position(get_the_title(),$meta, get_the_ID(), $start);
     1050                        if(Post_Type_Chronosly::filter(get_the_ID())) {
     1051                            $elements[$pos] = get_the_ID();
     1052                        }
     1053                    }
     1054
     1055
     1056                }
     1057
     1058            }
     1059            return $elements;
     1060
     1061        }
     1062
     1063         public static function seasons($eventos, $start, $end ,$meta, $name, $id, &$elements, $tickets){
     1064            $end = strtotime(date("Y-m-d", $end)." 23:59");
     1065            $settings =  unserialize(get_option("chronosly-settings"));
     1066           
     1067                // echo "<pre>";print_r($eventos);
     1068            foreach($eventos as $evento){
     1069                $from = strtotime(substr($evento->start, 0, stripos($evento->start, "+")-1));
     1070                $to = strtotime(substr($evento->end, 0, stripos( $evento->end, "+")-1));
     1071                if($_REQUEST["ch-price-min"]){
     1072                    if(!isset($evento->tickets)) continue;
     1073                    $tick = 0;
     1074                    //faltaria los sales que no los he podido controlar bien
     1075                    foreach ($evento->tickets as $t) {
     1076                        if($t->id && isset($tickets->tickets[$t->id])){
     1077                            foreach ($tickets->tickets[$t->id] as $t1) {
     1078                                if($t1->name == "price" && $t1->value >= $_REQUEST["ch-price-min"]){
     1079                                    $tick = 1;
     1080                                } else if($t->sale && $t1->name == "sales-price" && $t1->value >= $_REQUEST["ch-price-min"]){
     1081                                    $tick = 1;
    10331082                                }
    1034                         }
    1035                         if(!$find) continue;
    1036                     }
    1037 
    1038                     $pos = Post_Type_Chronosly::get_event_position(get_the_title(),$meta, get_the_ID(), $start);
    1039                     if(Post_Type_Chronosly::filter(get_the_ID())) {
    1040                         $elements[$pos] = get_the_ID();
    1041                     }
    1042 
    1043 
    1044                 }
    1045 
    1046             }
     1083                            }
     1084
     1085                        }
     1086                     } 
     1087                    if(!$tick) continue;
     1088                }
     1089                if($_REQUEST["ch-price-max"]){
     1090                    $tick = 0;
     1091                    //faltaria los sales que no los he podido controlar bien
     1092                    foreach ($evento->tickets as $t) {
     1093                        if($t->id && isset($tickets->tickets[$t->id])){
     1094                            foreach ( $tickets->tickets[$t->id] as $t1) {
     1095                                if($t1->name == "price" && $t1->value <= $_REQUEST["ch-price-max"]){
     1096                                    $tick = 1;
     1097                                } else if($t->sale && $t1->name == "sales-price" && $t1->value <= $_REQUEST["ch-price-max"]){
     1098                                    $tick = 1;
     1099                                }
     1100                            }
     1101
     1102                        }
     1103                     } 
     1104                    if(!$tick) continue;
     1105                }
     1106                // print_r($evento);
     1107                if(date('Y-m-d',$from) != date('Y-m-d',$to)) $to -= 60*60*24;
     1108
     1109                    if($to >= $start and $from <= $end){
     1110                   
     1111
     1112                           if($settings["chronosly_show_past_events"] != 1 or $from >= strtotime(date("Y-m-d"))) {
     1113                                $pos = Post_Type_Chronosly::get_event_position($name,$meta, $id, $from, date("H", $from), date("i", $from));
     1114                                // echo $pos." ";
     1115                                $elements[$pos]= array("id" => $id,"start" => $from, "end" => $to , "h" => date("H", $from), "m"=> date("i", $from), "eh" => date("H", $to), "em"=> date("i", $to));
     1116                            }
     1117                         
     1118                    }
     1119                }
     1120               
    10471121            return $elements;
    1048 
     1122           
    10491123        }
    10501124
Note: See TracChangeset for help on using the changeset viewer.