| @@ -18,11 +18,18 @@ | ||
| 18 | 18 | // (c)Pagelayer Team |
| 19 | 19 | //=========================================================== |
| 20 | 20 | ////////////////////////////////////////////////////////////// |
| 21 | 21 | |
| 22 | +if(!empty($_REQUEST['test'])){ | |
| 23 | + echo 1; | |
| 24 | + die(); | |
| 25 | +} | |
| 22 | 26 | |
| 23 | 27 | // Read the file |
| 24 | 28 | $data = ''; |
| 29 | +$data_premium = ''; | |
| 30 | +$self_path = dirname(__FILE__); | |
| 31 | +$plugins_path = dirname(dirname($self_path)); | |
| 25 | 32 | $files = array( |
| 26 | 33 | // Admin JS |
| 27 | 34 | 'pagelayer-editor.js', |
| 28 | 35 | 'widgets.js', |
| @@ -27,28 +34,34 @@ | ||
| 27 | 34 | 'pagelayer-editor.js', |
| 28 | 35 | 'widgets.js', |
| 29 | 36 | 'premium.js', |
| 30 | 37 | 'properties.js', |
| 31 | - 'base64.js', | |
| 38 | + 'base-64.min.js', | |
| 32 | 39 | 'slimscroll.js', |
| 33 | 40 | 'vanilla-picker.min.js', |
| 34 | - 'trumbowyg.min.js', | |
| 35 | - 'trumbowyg.js', | |
| 36 | - 'trumbowyg-pagelayer.js', | |
| 37 | - 'pen.js', | |
| 41 | + 'tlite.min.js', | |
| 42 | + 'pagelayer-pen.js', | |
| 43 | + 'pagelayer-ai.js', | |
| 38 | 44 | // Enduser JS |
| 39 | 45 | 'imagesloaded.min.js', |
| 40 | 46 | 'nivo-lightbox.min.js', |
| 41 | - 'slippry.min.js', | |
| 47 | + 'owl.carousel.min.js', | |
| 42 | 48 | 'pagelayer-frontend.js', |
| 49 | + 'premium-frontend.js', | |
| 43 | 50 | 'wow.min.js', |
| 44 | 51 | 'jquery-numerator.js', |
| 45 | 52 | 'simpleParallax.min.js', |
| 53 | + 'chart.min.js', | |
| 54 | + 'shuffle.min.js' | |
| 46 | 55 | ); |
| 47 | 56 | |
| 48 | 57 | // What files to give |
| 49 | 58 | $give = @$_REQUEST['give']; |
| 50 | 59 | |
| 60 | +// Premium | |
| 61 | +$premium = !empty($_REQUEST['premium']) ? $_REQUEST['premium'] : ''; | |
| 62 | +$premium_path = $plugins_path.'/pagelayer-pro/js'; | |
| 63 | + | |
| 51 | 64 | if(!empty($give)){ |
| 52 | 65 | |
| 53 | 66 | $give = explode(',', $give); |
| 54 | 67 | |
| @@ -60,8 +73,20 @@ | ||
| 60 | 73 | } |
| 61 | 74 | |
| 62 | 75 | } |
| 63 | 76 | |
| 77 | +if(!empty($premium)){ | |
| 78 | + | |
| 79 | + $premium = explode(',', trim($premium, ',')); | |
| 80 | + | |
| 81 | + // Check all files are in the supported list | |
| 82 | + foreach($premium as $file){ | |
| 83 | + if(in_array($file, $files)){ | |
| 84 | + $final_premium[md5($file)] = $file; | |
| 85 | + } | |
| 86 | + } | |
| 87 | + | |
| 88 | +} | |
| 64 | 89 | |
| 65 | 90 | // Give all |
| 66 | 91 | if(empty($final)){ |
| 67 | 92 | $final = $files; |
| @@ -68,13 +93,22 @@ | ||
| 68 | 93 | } |
| 69 | 94 | |
| 70 | 95 | foreach($final as $k => $v){ |
| 71 | 96 | //echo $k.'<br>'; |
| 72 | - $data .= file_get_contents($v)."\n\n"; | |
| 97 | + $data .= file_get_contents($self_path.'/'.$v)."\n\n"; | |
| 73 | 98 | } |
| 74 | 99 | |
| 100 | +if(!empty($final_premium)){ | |
| 101 | + | |
| 102 | + foreach($final_premium as $k => $v){ | |
| 103 | + //echo $k.'<br>'; | |
| 104 | + $data_premium .= file_get_contents($premium_path.'/'.$v)."\n\n"; | |
| 105 | + } | |
| 106 | + | |
| 107 | +} | |
| 108 | + | |
| 75 | 109 | // We are zipping if possible |
| 76 | -if(function_exists('ob_gzhandler')){ | |
| 110 | +if(function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')){ | |
| 77 | 111 | ob_start('ob_gzhandler'); |
| 78 | 112 | } |
| 79 | 113 | |
| 80 | 114 | // Type javascript |
| @@ -80,10 +114,35 @@ | ||
| 80 | 114 | // Type javascript |
| 81 | 115 | header("Content-type: text/javascript; charset: UTF-8"); |
| 82 | 116 | |
| 83 | 117 | // Set a zero Mtime |
| 84 | -$filetime = filemtime('pagelayer-editor.js'); | |
| 118 | +$filetime = filemtime($self_path.'/pagelayer-editor.js'); | |
| 85 | 119 | |
| 120 | +// Are we to also serve Shortcodes ? | |
| 121 | +if(!empty($pagelayer->shortcodes)){ | |
| 122 | + $data .= 'pagelayer_shortcodes = '.json_encode($pagelayer->shortcodes).';'."\n\n"; | |
| 123 | + $data .= 'pagelayer_styles = '.json_encode($pagelayer->styles).';'."\n\n"; | |
| 124 | + $data .= 'pagelayer_groups = '.json_encode($pagelayer->groups).';'."\n\n"; | |
| 125 | +} | |
| 126 | + | |
| 127 | +// Add the langs as well | |
| 128 | +preg_match_all('/pagelayer_l\([\'"](\w*)[\'"]\)/is', $data, $matches); | |
| 129 | +if(!empty($matches[1]) && function_exists('__pl')){ | |
| 130 | + foreach($matches[1] as $lk => $lv){ | |
| 131 | + $export_langs[$lv] = __pl($lv); | |
| 132 | + } | |
| 133 | +} | |
| 134 | + | |
| 135 | +// Also add the fonts | |
| 136 | +if(!empty($pagelayer->fonts)){ | |
| 137 | + $export_langs['pl_fonts_list'] = $pagelayer->fonts; | |
| 138 | +} | |
| 139 | + | |
| 140 | +// And lang string ? | |
| 141 | +if(!empty($export_langs)){ | |
| 142 | + $data .= 'pagelayer_lang = '.json_encode($export_langs).';'."\n\n"; | |
| 143 | +} | |
| 144 | + | |
| 86 | 145 | // Cache Control |
| 87 | 146 | header("Cache-Control: must-revalidate"); |
| 88 | 147 | |
| 89 | 148 | // Checking if the client is validating his cache and if it is current. |
| @@ -101,6 +160,14 @@ | ||
| 101 | 160 | |
| 102 | 161 | } |
| 103 | 162 | |
| 104 | 163 | echo $data; |
| 164 | +echo $data_premium; | |
| 165 | + | |
| 166 | +// Write if we are front-end only then | |
| 167 | +$dev = dirname(dirname(__FILE__)).'/dev.php'; | |
| 168 | +if(!empty($_REQUEST['write']) && file_exists($dev)){ | |
| 169 | + include_once($dev); | |
| 170 | + write_js(); | |
| 171 | +} | |
| 105 | 172 | |
| 106 | 173 | |