| 1 |
<?php |
| 2 |
|
| 3 |
////////////////////////////////////////////////////////////// |
| 4 |
//=========================================================== |
| 5 |
// givejs.php |
| 6 |
//=========================================================== |
| 7 |
// PAGELAYER |
| 8 |
// Inspired by the DESIRE to be the BEST OF ALL |
| 9 |
// ---------------------------------------------------------- |
| 10 |
// Started by: Pulkit Gupta |
| 11 |
// Date: 23rd Jan 2017 |
| 12 |
// Time: 23:00 hrs |
| 13 |
// Site: http://pagelayer.com/wordpress (PAGELAYER) |
| 14 |
// ---------------------------------------------------------- |
| 15 |
// Please Read the Terms of use at http://pagelayer.com/tos |
| 16 |
// ---------------------------------------------------------- |
| 17 |
//=========================================================== |
| 18 |
// (c)Pagelayer Team |
| 19 |
//=========================================================== |
| 20 |
////////////////////////////////////////////////////////////// |
| 21 |
|
| 22 |
|
| 23 |
// Read the file |
| 24 |
$data = ''; |
| 25 |
$files = array( |
| 26 |
// Admin JS |
| 27 |
'pagelayer-editor.js', |
| 28 |
'widgets.js', |
| 29 |
'premium.js', |
| 30 |
'properties.js', |
| 31 |
'drag.js', |
| 32 |
'base64.js', |
| 33 |
'slimscroll.js', |
| 34 |
'vanilla-picker.min.js', |
| 35 |
'trumbowyg.min.js', |
| 36 |
'trumbowyg.js', |
| 37 |
'trumbowyg-pagelayer.js', |
| 38 |
'pen.js', |
| 39 |
// Enduser JS |
| 40 |
'imagesloaded.min.js', |
| 41 |
'nivo-lightbox.min.js', |
| 42 |
'slippry.min.js', |
| 43 |
'pagelayer-frontend.js', |
| 44 |
'wow.min.js', |
| 45 |
'jquery-numerator.js', |
| 46 |
'simpleParallax.min.js', |
| 47 |
); |
| 48 |
|
| 49 |
// What files to give |
| 50 |
$give = @$_REQUEST['give']; |
| 51 |
|
| 52 |
if(!empty($give)){ |
| 53 |
|
| 54 |
$give = explode(',', $give); |
| 55 |
|
| 56 |
// Check all files are in the supported list |
| 57 |
foreach($give as $file){ |
| 58 |
if(in_array($file, $files)){ |
| 59 |
$final[md5($file)] = $file; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
// Give all |
| 67 |
if(empty($final)){ |
| 68 |
$final = $files; |
| 69 |
} |
| 70 |
|
| 71 |
foreach($final as $k => $v){ |
| 72 |
//echo $k.'<br>'; |
| 73 |
$data .= file_get_contents($v)."\n\n"; |
| 74 |
} |
| 75 |
|
| 76 |
// We are zipping if possible |
| 77 |
if(function_exists('ob_gzhandler')){ |
| 78 |
ob_start('ob_gzhandler'); |
| 79 |
} |
| 80 |
|
| 81 |
// Type javascript |
| 82 |
header("Content-type: text/javascript; charset: UTF-8"); |
| 83 |
|
| 84 |
// Set a zero Mtime |
| 85 |
$filetime = filemtime('pagelayer-editor.js'); |
| 86 |
|
| 87 |
// Cache Control |
| 88 |
header("Cache-Control: must-revalidate"); |
| 89 |
|
| 90 |
// Checking if the client is validating his cache and if it is current. |
| 91 |
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $filetime)) { |
| 92 |
|
| 93 |
// Client's cache IS current, so we just respond '304 Not Modified'. |
| 94 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 304); |
| 95 |
|
| 96 |
return; |
| 97 |
|
| 98 |
}else{ |
| 99 |
|
| 100 |
// Image not cached or cache outdated, we respond '200 OK' and output the image. |
| 101 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 200); |
| 102 |
|
| 103 |
} |
| 104 |
|
| 105 |
echo $data; |
| 106 |
|
| 107 |
|
| 108 |
|