Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -8,12 +8,16 @@
|
||||
* @since 1 Aug 2013
|
||||
*/
|
||||
|
||||
use IPS\Http\Url;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
|
||||
define('REPORT_EXCEPTIONS', TRUE);
|
||||
require_once '../../../../init.php';
|
||||
|
||||
function loadResource ($url)
|
||||
{
|
||||
$response = \IPS\Http\Url::external( $url )->request()->get();
|
||||
$response = Url::external( $url )->request()->get();
|
||||
if ( strpos( $response->httpHeaders['Content-Type'], 'javascript' ) !== FALSE )
|
||||
{
|
||||
return $response . "\n\n\n\n";
|
||||
@@ -24,11 +28,11 @@ function loadResource ($url)
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->src )
|
||||
if ( Request::i()->src )
|
||||
{
|
||||
$output = '';
|
||||
|
||||
foreach ( explode( ',', \IPS\Request::i()->src ) as $src )
|
||||
foreach ( explode( ',', Request::i()->src ) as $src )
|
||||
{
|
||||
if ( mb_substr( $src, -3 ) !== '.js' )
|
||||
{
|
||||
@@ -54,38 +58,28 @@ if ( \IPS\Request::i()->src )
|
||||
$output .= file_get_contents( \IPS\ROOT_PATH . '/applications/' . $app . '/interface/' . implode( '/', $exploded ) ) . "\n\n\n\n";
|
||||
}
|
||||
}
|
||||
elseif ( \IPS\IN_DEV && $exploded[0] == 'ckeditor' && $exploded[1] == 'ckeditor.js' )
|
||||
{
|
||||
$output .= file_get_contents( \IPS\ROOT_PATH . '/applications/core/dev/ckeditor/ckeditor.js' ) . "\n\n\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ( \IPS\Output::i()->js( implode( '/', $exploded ), $app, $location ) as $url )
|
||||
foreach ( Output::i()->js( implode( '/', $exploded ), $app, $location ) as $url )
|
||||
{
|
||||
/* If we are in_dev, ckeditor comes from the /dev/ directory instead */
|
||||
if ( \IPS\IN_DEV && $exploded[0] == 'ckeditor' && $exploded[1] == 'ckeditor.js' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
/* Make sure we have a protocol defined. \IPS\Http\Url::external() does not like protocol relative URL's */
|
||||
if ( mb_substr( $url, 0, 2 ) == '//' )
|
||||
{
|
||||
$url = ( \IPS\Request::i()->isSecure() ) ? 'https:' . $url : 'http:' . $url;
|
||||
$url = ( Request::i()->isSecure() ) ? 'https:' . $url : 'http:' . $url;
|
||||
}
|
||||
$output .= loadResource( $url );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
catch (Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( '', 500, 'text/javascript' );
|
||||
Output::i()->sendOutput( '', 500, 'text/javascript' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cacheHeaders = ( \IPS\IN_DEV !== true AND \IPS\Theme::designersModeEnabled() !== true ) ? \IPS\Output::getCacheHeaders( time(), 360 ) : array();
|
||||
$cacheHeaders = ( \IPS\IN_DEV !== true ) ? Output::getCacheHeaders( time(), 360 ) : array();
|
||||
|
||||
\IPS\Output::i()->sendOutput( $output, 200, 'text/javascript', $cacheHeaders );
|
||||
Output::i()->sendOutput( $output, 200, 'text/javascript', $cacheHeaders );
|
||||
}
|
||||
Reference in new issue
Block a user