| 1 |
<?php |
| 2 |
|
| 3 |
////////////////////////////////////////////////////////////// |
| 4 |
//=========================================================== |
| 5 |
// givecss.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 |
$data_premium = ''; |
| 26 |
$self_path = dirname(__FILE__); |
| 27 |
$plugins_path = dirname(dirname($self_path)); |
| 28 |
$files = array( |
| 29 |
// Admin CSS |
| 30 |
'pagelayer-editor.css', |
| 31 |
'pagelayer-icons.css', |
| 32 |
'pagelayer-editor-frontend.css', |
| 33 |
// Enduser CSS |
| 34 |
'font-awesome5.min.css', |
| 35 |
'font-awesome5-v4shims.css', |
| 36 |
'nivo-lightbox.css', |
| 37 |
'owl.carousel.min.css', |
| 38 |
'owl.theme.default.min.css', |
| 39 |
'pagelayer-frontend.css', |
| 40 |
'premium-frontend.css', |
| 41 |
'animate.min.css', |
| 42 |
'chartist.min.css', |
| 43 |
'pagelayer-pen.css' |
| 44 |
); |
| 45 |
|
| 46 |
// What files to give |
| 47 |
$give = @$_REQUEST['give']; |
| 48 |
|
| 49 |
// Premium |
| 50 |
$premium = !empty($_REQUEST['premium']) ? $_REQUEST['premium'] : ''; |
| 51 |
$premium_path = $plugins_path.'/pagelayer-pro/css'; |
| 52 |
|
| 53 |
if(!empty($give)){ |
| 54 |
|
| 55 |
$give = explode(',', $give); |
| 56 |
|
| 57 |
// Check all files are in the supported list |
| 58 |
foreach($give as $file){ |
| 59 |
if(in_array($file, $files)){ |
| 60 |
$final[md5($file)] = $file; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
} |
| 65 |
|
| 66 |
if(!empty($premium)){ |
| 67 |
|
| 68 |
$premium = explode(',', trim($premium, ',')); |
| 69 |
|
| 70 |
// Check all files are in the supported list |
| 71 |
foreach($premium as $file){ |
| 72 |
if(in_array($file, $files)){ |
| 73 |
$final_premium[md5($file)] = $file; |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
// Give all |
| 81 |
if(empty($final)){ |
| 82 |
$final = $files; |
| 83 |
} |
| 84 |
|
| 85 |
foreach($final as $k => $v){ |
| 86 |
//echo $k.'<br>'; |
| 87 |
$data .= file_get_contents($self_path.'/'.$v)."\n\n"; |
| 88 |
} |
| 89 |
|
| 90 |
if(!empty($final_premium)){ |
| 91 |
|
| 92 |
foreach($final_premium as $k => $v){ |
| 93 |
//echo $k.'<br>'; |
| 94 |
$data_premium .= file_get_contents($premium_path.'/'.$v)."\n\n"; |
| 95 |
} |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
// We are zipping if possible |
| 100 |
if(function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')){ |
| 101 |
ob_start('ob_gzhandler'); |
| 102 |
} |
| 103 |
|
| 104 |
// Type CSS |
| 105 |
header("Content-type: text/css; charset: UTF-8"); |
| 106 |
|
| 107 |
// Set a zero Mtime |
| 108 |
$filetime = filemtime($self_path.'/pagelayer-editor.css'); |
| 109 |
|
| 110 |
// Cache Control |
| 111 |
header("Cache-Control: must-revalidate"); |
| 112 |
|
| 113 |
// Checking if the client is validating his cache and if it is current. |
| 114 |
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $filetime)) { |
| 115 |
|
| 116 |
// Client's cache IS current, so we just respond '304 Not Modified'. |
| 117 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 304); |
| 118 |
|
| 119 |
return; |
| 120 |
|
| 121 |
}else{ |
| 122 |
|
| 123 |
// Image not cached or cache outdated, we respond '200 OK' and output the image. |
| 124 |
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filetime).' GMT', true, 200); |
| 125 |
|
| 126 |
} |
| 127 |
|
| 128 |
if(defined('DOING_AJAX') && !defined('SITEPAD')){ |
| 129 |
$data = str_replace('../fonts/', '../wp-content/plugins/'.(basename(dirname(dirname(__FILE__)))).'/fonts/', $data); |
| 130 |
} |
| 131 |
|
| 132 |
echo $data; |
| 133 |
echo $data_premium; |
| 134 |
|
| 135 |
// Write if we are front-end only then |
| 136 |
$dev = dirname(dirname(__FILE__)).'/dev.php'; |
| 137 |
if(!empty($_REQUEST['write']) && file_exists($dev)){ |
| 138 |
include_once($dev); |
| 139 |
write_css(); |
| 140 |
} |
| 141 |
|
| 142 |
|