public function action_404()
 {
     // Lets see if theres a URL to redirect
     // $url = trim($_SERVER['REQUEST_URI'],'/');
     $url = str_replace(Uri::Base(), '', Uri::Create($_SERVER['REQUEST_URI']));
     $parts = preg_split('/\\//', $url);
     // var_dump($parts);
     if (count($parts) == 1) {
         $url = str_replace('%20', ' ', $url);
         static::$url_found = Model_Url::query()->where('short_url', $url)->get_one();
         if (empty(static::$url_found) === false) {
             return Controller_Url::action_view(static::$url_found);
         }
     } else {
         if (count($parts) == 2) {
             // $url = str_replace('%20',' ',$url[1]);
             $url = explode('/', $url);
             $url = $url[1];
             static::$url_found = Model_Url::query()->where('short_url', $url)->get_one();
             if (empty(static::$url_found) === false) {
                 return Controller_Url::action_view(static::$url_found);
             }
         }
     }
     $data = new stdClass();
     $this->template->content = View::forge('core/404');
 }
 public function action_create()
 {
     $url = Input::Get('url');
     $custom = Input::Get('custom');
     $api = Input::Get('api_key');
     if (empty($api) === true) {
         $api = true;
     }
     if (empty($url) === false) {
         // Check to see if its a valid url
         if (filter_var($url, FILTER_VALIDATE_URL) === false) {
             echo 'You did not enter a valid url in, please try again';
             die;
         }
         // Check black list!
         $blocked = Model_Blacklist::query()->get();
         if (empty($blocked) === false) {
             foreach ($blocked as $block) {
                 // Check aginst the blocked
                 if (preg_match('/' . strtolower($block['blocked']) . '/', strtolower($url))) {
                     echo 'URL Blacklisted';
                     die;
                 }
             }
         }
         // Lets generate them a url
         $safe = \Settings::Get('google_safe_api_key');
         // Is it safe?
         if (empty($safe) === false) {
             $m_url = 'https://sb-ssl.google.com/safebrowsing/api/lookup?client=api&apikey=' . $safe . '&appver=1.0&pver=3.0&url=' . $url;
             $curl_handle = curl_init();
             curl_setopt($curl_handle, CURLOPT_URL, $m_url);
             curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
             curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
             $buffer = curl_exec($curl_handle);
             curl_close($curl_handle);
             if (empty($buffer) === false) {
                 echo 'This website has been blocked because of ' . $buffer;
                 die;
             }
         }
         $length = strlen($url);
         $data['short_url_raw'] = Controller_Url::shortenit($url, $custom, $api);
         $data['url'] = $url;
         $data['short_url'] = $data['short_url_raw']['short_url'];
         echo \Uri::Create($data['short_url']);
         die;
     } else {
         echo 'Error';
         die;
     }
 }
<div class="meela-bg margin-bottom-20 clearfix">
    
    <h3 class="stats-long-url"><img src="<?php 
echo Controller_Url::img_from_url($url);
?>
"> <span>Long URL: </span><?php 
echo $url->url;
?>
</h3>
    <div class="col-lg-5">
        <div class="row stats-pod">
            <div class="col-lg-10 col-lg-offset-1"><span>Total Hits:</span><?php 
echo $url->hits;
?>
</div>
            <div class="col-lg-10 col-lg-offset-1"><span>Unique Hits:</span><?php 
echo $unqiue_hits;
?>
</div>
            <div class="col-lg-10 col-lg-offset-1"><span>Total Hits Today:</span><?php 
echo $hits_today;
?>
</div>
            <div class="col-lg-10 col-lg-offset-1"><span>Unique Hits Today:</span><?php 
echo $unqiue_hits_today;
?>
</div>
        </div>
    </div>
    <div class="col-lg-7">
        <div id="chart_div_map"></div>
 public function action_make_image()
 {
     $url_id = \Input::GET('url_id');
     $url_object = \Model_Url::query()->where('id', $url_id)->get_one();
     Controller_Url::img_from_url($url_object);
 }