parent
1c6f9d1746
commit
4c8f8283d9
|
@ -390,17 +390,19 @@ class AdminController extends Controller
|
||||||
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
|
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
|
||||||
$sourceURL = substr($matches[0][0],13);
|
$sourceURL = substr($matches[0][0],13);
|
||||||
|
|
||||||
$replaced = str_replace("https://github.com/", "https://api.github.com/repos/", trim($sourceURL));
|
$replaced = str_replace("https://github.com/", "https://raw.githubusercontent.com/", trim($sourceURL));
|
||||||
$replaced = $replaced . "/releases/latest";
|
$replaced = $replaced . "/main/readme.md";
|
||||||
|
|
||||||
if (strpos($sourceURL, 'github.com')){
|
if (strpos($sourceURL, 'github.com')){
|
||||||
|
|
||||||
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
|
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
|
||||||
try{
|
try{
|
||||||
$jsont = file_get_contents($replaced);
|
$textGit = file_get_contents($replaced);
|
||||||
$myObjt = json_decode($jsont);
|
$patternGit = '/Theme Version:.*/';
|
||||||
$Vgitt = $myObjt->tag_name;
|
preg_match($patternGit, $textGit, $matches, PREG_OFFSET_CAPTURE);
|
||||||
$verNrv = 'v' . $verNr;
|
$sourceURLGit = substr($matches[0][0],15);
|
||||||
|
$Vgitt = 'v' . $sourceURLGit;
|
||||||
|
$verNrv = 'v' . $verNr;
|
||||||
}catch(Exception $ex){
|
}catch(Exception $ex){
|
||||||
$themeVe = "error";
|
$themeVe = "error";
|
||||||
$Vgitt = NULL;
|
$Vgitt = NULL;
|
||||||
|
@ -410,7 +412,7 @@ class AdminController extends Controller
|
||||||
if(trim($Vgitt) > trim($verNrv)){
|
if(trim($Vgitt) > trim($verNrv)){
|
||||||
|
|
||||||
|
|
||||||
$fileUrl = trim($sourceURL) . '/archive/refs/tags/' . trim($verNrv) . '.zip';
|
$fileUrl = trim($sourceURL) . '/archive/refs/tags/' . trim($Vgitt) . '.zip';
|
||||||
|
|
||||||
|
|
||||||
file_put_contents(base_path('themes/theme.zip'), fopen($fileUrl, 'r'));
|
file_put_contents(base_path('themes/theme.zip'), fopen($fileUrl, 'r'));
|
||||||
|
|
|
@ -156,16 +156,18 @@ table, th, td {
|
||||||
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
|
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
|
||||||
$sourceURL = substr($matches[0][0],13);
|
$sourceURL = substr($matches[0][0],13);
|
||||||
|
|
||||||
$replaced = str_replace("https://github.com/", "https://api.github.com/repos/", trim($sourceURL));
|
$replaced = str_replace("https://github.com/", "https://raw.githubusercontent.com/", trim($sourceURL));
|
||||||
$replaced = $replaced . "/releases/latest";
|
$replaced = $replaced . "/main/readme.md";
|
||||||
|
|
||||||
if (strpos($sourceURL, 'github.com')){
|
if (strpos($sourceURL, 'github.com')){
|
||||||
|
|
||||||
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
|
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
|
||||||
try{
|
try{
|
||||||
$jsont = file_get_contents($replaced);
|
$textGit = file_get_contents($replaced);
|
||||||
$myObjt = json_decode($jsont);
|
$patternGit = '/Theme Version:.*/';
|
||||||
$Vgitt = $myObjt->tag_name;
|
preg_match($patternGit, $textGit, $matches, PREG_OFFSET_CAPTURE);
|
||||||
|
$sourceURLGit = substr($matches[0][0],15);
|
||||||
|
$Vgitt = 'v' . $sourceURLGit;
|
||||||
$verNrv = 'v' . $verNr;
|
$verNrv = 'v' . $verNr;
|
||||||
}catch(Exception $ex){
|
}catch(Exception $ex){
|
||||||
$themeVe = "error";
|
$themeVe = "error";
|
||||||
|
|
Loading…
Reference in New Issue