public static function load_item($id, $vista)
 {
     $settings = unserialize(get_option("chronosly-settings"));
     if ($settings["disable_cache"]) {
         return false;
     }
     if (isset($_REQUEST["small"])) {
         $vista .= "_small";
     }
     if (function_exists("qtrans_getLanguage")) {
         $vista .= qtrans_getLanguage();
     }
     $html = get_option("chronosly_template_{$id}_{$vista}");
     if (!Chronosly_Utils::validate_closure($html)) {
         return false;
     }
     return $html;
 }
 public function update_code($type, $url, $addon = "")
 {
     global $Chronosly_Settings;
     switch ($type) {
         case "core":
             $path = CHRONOSLY_PATH;
             break;
         case "addons":
             $path = CHRONOSLY_ADDONS_PATH;
             break;
         case "templates":
             $path = CHRONOSLY_TEMPLATES_PATH;
             break;
     }
     $cont = $this->get_external_content($url);
     // return;
     //save the zip temporaly
     if ($cont["error"]) {
         return 0;
     }
     $zip = $cont["content"];
     $fp = fopen(CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "temp.zip", "w");
     fwrite($fp, $zip);
     fclose($fp);
     require_once ABSPATH . '/wp-admin/includes/file.php';
     WP_Filesystem();
     if (stripos($addon, "organizers_and_places") !== FALSE or stripos($addon, "extended_marketplace") !== FALSE) {
         $path = CHRONOSLY_PATH;
     }
     $unzipfile = unzip_file(CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "temp.zip", $path);
     @unlink(CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "temp.zip");
     $utils = new Chronosly_Utils();
     if (stripos($addon, "organizers_and_places") !== FALSE and $unzipfile === true) {
         $files = scandir($path . DIRECTORY_SEPARATOR . "organizers_and_places");
         foreach ($files as $file) {
             if ($file != "." && $file != "..") {
                 $utils->rcopy($path . DIRECTORY_SEPARATOR . "organizers_and_places/{$file}", $destination_path . DIRECTORY_SEPARATOR . "{$file}");
             }
         }
     } else {
         if (stripos($addon, "extended_marketplace") !== FALSE and $unzipfile === true) {
             $files = scandir($path . DIRECTORY_SEPARATOR . "extended_marketplace");
             foreach ($files as $file) {
                 if ($file != "." && $file != "..") {
                     $utils->rcopy($path . DIRECTORY_SEPARATOR . "extended_marketplace/{$file}", $destination_path . DIRECTORY_SEPARATOR . "{$file}");
                 }
             }
         }
     }
     if ($unzipfile === true) {
         return 1;
     }
     return 0;
 }
        }
        $ext = new Chronosly_Extend();
        echo $ext->update_addons($_REQUEST['addon']);
    } else {
        if (isset($_REQUEST["delete"])) {
            if (!current_user_can('manage_options')) {
                wp_die(__('You do not have sufficient permissions to access this page.'));
            }
            if (has_filter("chronosly_update_template_" . $_REQUEST["delete"])) {
                $Post_Type_Chronosly->template->full_update_templates_by_addon($_REQUEST["delete"], array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), "remove");
            }
            if (has_action("chronosly_remove_" . $_REQUEST["delete"])) {
                do_action("chronosly_remove_" . $_REQUEST["delete"]);
            }
            //remove files and reload page
            $utils = new Chronosly_Utils();
            $utils->rrmdir(CHRONOSLY_ADDONS_PATH . DIRECTORY_SEPARATOR . $_REQUEST["delete"]);
            // wp_redirect("admin.php?page=chronosly_addons_configs&deleted=1");
            echo "<script type=\"text/javascript\"> document.location.href= '" . $_SERVER["SCRIPT_URI"] . "?page=chronosly_addons_configs&deleted=1'; </script>";
            die;
        }
    }
}
//
?>


    <?php 
if (isset($_REQUEST['installed'])) {
    echo "<div class='bubblegreen'>" . __('Addon successfully installed!', "chronosly") . "</div>";
    $Post_Type_Chronosly->template->full_update_templates_by_addon($_REQUEST['installed'], array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), "update");