Example #1
0
 /**
  * Generates the combined js code.
  *
  * Called by the external_js() and module_js() methods.
  *
  * @param array $files       An array of files to be combined.
  * @param string $scriptType Either a string ('module') or empty. Used in
  * generating the file name.
  *
  * @return string
  */
 public static function combine_js($files = array(), $scriptType = '')
 {
     // Are there any scripts to include?
     if (is_array($files) && count($files) == 0) {
         return;
     }
     $theme = Template::theme();
     // Get the class name, module name, and uri segments
     $className = self::$ci->router->class;
     $moduleName = self::$ci->router->fetch_module();
     $uriSegments = self::$ci->uri->segment_array();
     // Get the context name from the uri segments
     $classKey = array_search($className, $uriSegments);
     if ($classKey !== false) {
         $classKey = $classKey + 1;
         if (isset($uriSegments[$classKey])) {
             $moduleName = $uriSegments[$classKey];
         }
     }
     $fileName = trim($theme, '/') . "_{$moduleName}_{$className}";
     if (self::$ci->config->item('assets.encrypt_name')) {
         $fileName = md5($fileName);
     }
     $fileName .= $scriptType == 'module' ? '_mod' : '_combined';
     // If the file is to be minified, .min must be added to the URL below,
     // but since generate_file() adds .min on its own, it can't be added to
     // $fileName, yet.
     $min = self::$ci->config->item('assets.js_minify') ? '.min' : '';
     // If the file is generated successfully, output the path to the file
     $output = '';
     if (self::generate_file($files, $fileName, 'js')) {
         $output = self::path(base_url(), self::$directories['base'], self::$directories['cache'], "{$fileName}{$min}.js");
     }
     return $output;
 }
Example #2
0
<?php

include_once dirname(__FILE__) . '/inc/config.inc.php';
include_once dirname(__FILE__) . '/inc/paste.class.php';
include_once dirname(__FILE__) . '/inc/mobile.class.php';
include_once dirname(__FILE__) . '/inc/templates.class.php';
// This may be required if a user is dealing with a file that is so large that is takes more than 30 seconds
set_time_limit(0);
$conf = get_config();
// load up our config
$template = new Template();
// detect what device is viewing the page
$detect = new Mobile();
$template->theme('default');
//if( $detect->isMobile() )
//	$template->theme( 'mobile' );
//elseif( $detect->isTablet() )
//	$template->theme( 'tablet' );
$template->assign('meta_title', 'EZCrypt');
$pastes = new Paste();
$template->assign('pastes', $pastes);
// we are looking for a paste
if (!empty($_GET['id'])) {
    $display_id = $_GET['id'];
    $paste = $pastes->get($display_id);
    // detect if any errors came through
    switch ($paste) {
        case EZCRYPT_DOES_NOT_EXIST:
        case EZCRYPT_HAS_EXPIRED:
        case EZCRYPT_MISSING_DATA:
            $template->assign('meta_title', 'EZCrypt - Paste does not exist');