// IF IE $tempStr = explode('<image', $item->svg); $item->svg = $tempStr[0] . '<image' . str_replace('xmlns:xlink="http://www.w3.org/1999/xlink"', '', $tempStr[1]); preg_match_all("/xlink:href=\"(.*)\">/i", $item->svg, $links); if (isset($links[1][0])) { $link = str_replace('_thumb', '', $links[1][0]); if ($file == 'svg' && !empty($_GET['download'])) { $files[] = $link; $string = explode('/', $link); $file_name = $string[count($string) - 1]; $temp = explode($links[1][0], $item->svg); if (isset($temp[1])) { $item->svg = $temp[0] . $file_name . $temp[1]; } } else { $data = $dg->openURL($link); $base64 = 'data:image/PNG;base64,' . base64_encode($data); $temp = explode($links[1][0], $item->svg); if (isset($temp[1])) { $item->svg = $temp[0] . $base64 . $temp[1]; } } } } $dom = new DOMDocument(); $dom->loadXML($item->svg); if ($item->type == 'team') { $texts = $dom->getElementsByTagName("text"); foreach ($texts as $text) { if ($text->getAttribute('class') != '') { $action = '';
public function update($product_id = '') { include_once ROOT . DS . 'includes' . DS . 'functions.php'; $dg = new dg(); $path_info = dirname(ROOT) . DS . 'addons' . DS . 'install' . DS . $product_id . '.json'; if ($product_id != '' && file_exists($path_info)) { $content = file_get_contents($path_info); if ($content != false) { $addon = json_decode($content); $args = array('woo_sl_action' => 'plugin_update', 'licence_key' => $addon->key, 'product_unique_id' => $product_id, 'domain' => $_SERVER['HTTP_HOST']); $result = $dg->sendPostData($this->api_url, $args); if ($result != false && $result != '') { $content = json_decode($result); if (isset($content[0]) && isset($content[0]->status) && isset($content[0]->message) && $content[0]->status == 'success') { if (isset($content[0]->message->package)) { $addon->version = $content[0]->message->new_version; $addon->date = $content[0]->message->date; // download and upzip file $file = $dg->openURL($content[0]->message->package); $zip = new ZipArchive(); $path = dirname(dirname(ROOT)); $path_file = $path . DS . 'addon.zip'; if ($dg->WriteFile($path_file, $file) && $zip->open($path_file) == true) { $zip->extractTo($path); $zip->close(); unlink($path_file); $dg->WriteFile($path_info, json_encode($addon)); } } } } } } $dg->redirect('index.php/addon/installed'); }