Example #1
0
 /**
  * Convert a PHP error to an ErrorException.
  *
  * @param  int  $level
  * @param  string  $message
  * @param  string  $file
  * @param  int  $line
  * @param  array  $context
  * @return void
  *
  * @throws \ErrorException
  */
 public function handleError($level, $message, $file = '', $line = 0, $context = [])
 {
     if (error_reporting() & $level) {
         kd(get_defined_vars());
         throw new ErrorException($message, 0, $level, $file, $line);
     }
 }
Example #2
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof MethodNotAllowedHttpException) {
         return \Response::view('custom.404');
     }
     //foolant
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case '404':
                 //\Log::error($e);
                 return \Response::view('custom.404');
                 break;
             case '500':
                 kd('test');
                 //\Log::error($exception);
                 return \Response::view('custom.500');
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     }
     //end
     return parent::render($request, $e);
 }
Example #3
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     kd('test');
     //
     // Register 'thememanager' instance container to our ThemeManager object
     $this->app['thememanager'] = $this->app->share(function ($app) {
         return new ThemeManager();
     });
     // Shortcut so developers don't need to add an Alias in app/config/app.php
     $this->app->booting(function () {
         $loader = \Illuminate\Foundation\AliasLoader::getInstance();
         $loader->alias('ThemeManager', ThemeManager::class);
     });
 }
Example #4
0
<?php

include "../../class.krumo.php";
$fp = fopen(__FILE__, "r");
$a = array('first' => $fp, 'last' => new bar(), 'null_var' => null, 'float' => pi(), 'bool' => true, ' leading_space' => 6 * 8, 'trailing_space ' => 'grapes', 'middle space' => 'Mt. Rushmore', 'phones' => array(5036541278, 8714077831, 'x253'), 'long_str' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum...", 'empty_arr' => array(), 'func_str' => 'preg_replace', 'address' => array('street' => '123 Fake Street', 'city' => 'Portland', 'state' => 'Maine'), 'unixtime' => 1231241234, 'microtime' => microtime(1));
if (isset($_GET['short']) || php_sapi_name() === 'cli') {
    kd($a, KRUMO_EXPAND_ALL);
}
print "<h2>krumo capture</h2>\n";
$str = k(array('foo' => 'bar'), KRUMO_RETURN);
print $str;
print "<h2>krumo</h2>\n";
k(array('likes', 'kittens', 'and', 'dogs'));
print "<h2>krumo passing multiple args</h2>\n";
k('likes', 'kittens', 'and', 'dogs');
print "<h2>krumo + die()</h2>\n";
kd($a);
print "If you see this something is broken";
$k = new krumo();
class bar
{
    public $b = 'bb';
    public $a = 'aa';
    public function foo()
    {
        return 'bar';
    }
}
 /**
  * Duplicates the old blog to the new blog
  *
  * @global    wpdb $wpdb WordPress Database Wrapper
  * @param	int $blog_id the new blog id
  * @return	void
  */
 public function wpmu_new_blog($blog_id)
 {
     // Return if we don't have a blog
     if (!isset($_POST['blog']['basedon']) || 1 > $_POST['blog']['basedon']) {
         return;
     }
     $source_blog_id = (int) $_POST['blog']['basedon'];
     // Hook information
     $context = array('source_blog_id' => $source_blog_id, 'new_blog_id' => $blog_id);
     // Switch to the base blog
     switch_to_blog($source_blog_id);
     $old_prefix = $this->wpdb->prefix;
     $domain = $this->get_mapped_domain();
     $tables = $this->get_table_names($context);
     // Switch to our new blog
     restore_current_blog();
     switch_to_blog($blog_id);
     // Set the stuff
     $current_admin_email = get_option('admin_email');
     $url = get_option('siteurl');
     // truncate all tables
     foreach ($tables as $table) {
         $this->duplicator->replace_content($this->wpdb->prefix . $table, $old_prefix . $table, TRUE);
     }
     $this->update_admin_email($current_admin_email);
     kd('test');
     // if an url was used in the old blog, we set it to this url to change all content elements
     // change siteurl -> will start url rename plugin
     if ('' != $domain) {
         update_option('siteurl', $domain);
     }
     update_option('blogname', stripslashes($_POST['blog']['title']));
     update_option('home', $url);
     // change siteurl -> will start url rename plugin
     update_option('siteurl', $url);
     $this->wpdb->update($this->wpdb->options, array('option_name' => $this->wpdb->prefix . 'user_roles'), array('option_name' => $old_prefix . 'user_roles'));
     $this->insert_post_relations($source_blog_id, $blog_id);
     $this->copy_attachments($source_blog_id, $blog_id, $blog_id);
     restore_current_blog();
     /**
      * Called after successful blog duplication.
      *
      * @param array $context Two blog ids: 'source_blog_id' and 'new_blog_id'.
      */
     do_action('mlp_duplicated_blog', $context);
 }
Example #6
0
/**
 * Require the template file with WordPress environment.
 *
 * The globals are set up for the template file to ensure that the WordPress
 * environment is available from within the function. The query variables are
 * also available.
 *
 * @since 1.5.0
 *
 * @global array      $posts
 * @global WP_Post    $post
 * @global bool       $wp_did_header
 * @global WP_Query   $wp_query
 * @global WP_Rewrite $wp_rewrite
 * @global wpdb       $wpdb
 * @global string     $wp_version
 * @global WP         $wp
 * @global int        $id
 * @global object     $comment
 * @global int        $user_ID
 *
 * @param string $_template_file Path to template file.
 * @param bool   $require_once   Whether to require_once or require. Default true.
 */
function load_template($_template_file, $require_once = true)
{
    global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
    if (is_array($wp_query->query_vars)) {
        extract($wp_query->query_vars, EXTR_SKIP);
    }
    if (isset($s)) {
        $s = esc_attr($s);
    }
    if ($require_once === null) {
        return $_template_file;
    }
    extract(View::getShared(), EXTR_REFS);
    if ($isBlade = preg_match("/\\.blade\\.php\$/", $_template_file)) {
        $tplfile = str_replace(['Resources/views/', '.blade.php'], '', substr($_template_file, strlen(get_template_directory()) + 1));
        //echo View::make($tplfile)->with(array_except(get_defined_vars(), array('__data', '__path')));
        //echo View::file($_template_file)->with(array_except(get_defined_vars(), array('__data', '__path')) );
        try {
            error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
            echo View::file($_template_file)->with(array_except(get_defined_vars(), array('__data', '__path')))->render();
        } catch (Exception $e) {
            kd($e);
        }
        return '';
    }
    if ($require_once) {
        require_once $_template_file;
    } else {
        require $_template_file;
    }
}
Example #7
0
 /**
  *
  */
 protected static function compile_debug($value)
 {
     // Done last
     if (strpos($value, '@debug')) {
         kd($value);
     }
     return $value;
 }