Example #1
1
 /**
  * Get the downloadable file name for this upload.
  * @return mixed|string
  */
 public function getFileName()
 {
     if (str_contains($this->name, '.')) {
         return $this->name;
     }
     return $this->name . '.' . $this->extension;
 }
Example #2
1
 /**
  * Create a new user instance.
  *
  * @param array $data
  *
  * @return User
  */
 public function create(array $data)
 {
     unset($data['g-recaptcha-response']);
     unset($data['password_confirmation']);
     //use Gravatar if a user has one
     try {
         if (!isset($data['avatar']) && Gravatar::exists($data['email'])) {
             $data['avatar'] = Gravatar::get($data['email']);
         }
     } catch (\ErrorException $e) {
         if (App::environment('local', 'testing') && str_contains($e->getMessage(), 'get_headers(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided')) {
             Log::debug('We are probably offline, so this is being suppressed to avoid test failures');
         } else {
             throw $e;
         }
     }
     $user = App::make(User::class, [$data]);
     //third party account creation won't have a password
     if (isset($data['password'])) {
         $user->password = bcrypt($data['password']);
     }
     $user->save();
     event('auth.registered', [$user]);
     return $user;
 }
 /**
  * Guess the HREF for a button.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $buttons = $builder->getButtons();
     if (!($section = $this->sections->active())) {
         return;
     }
     if (!($module = $this->modules->active())) {
         return;
     }
     $stream = $builder->getTableStream();
     foreach ($buttons as &$button) {
         // If we already have an HREF then skip it.
         if (isset($button['attributes']['href'])) {
             continue;
         }
         switch (array_get($button, 'button')) {
             case 'restore':
                 $button['attributes']['href'] = $this->url->to('entry/handle/restore/' . $module->getNamespace() . '/' . $stream->getNamespace() . '/' . $stream->getSlug() . '/{entry.id}');
                 break;
             default:
                 // Determine the HREF based on the button type.
                 $type = array_get($button, 'segment', array_get($button, 'button'));
                 if ($type && !str_contains($type, '\\') && !class_exists($type)) {
                     $button['attributes']['href'] = $section->getHref($type . '/{entry.id}');
                 }
                 break;
         }
     }
     $builder->setButtons($buttons);
 }
Example #4
1
 /**
  * Returns default image if title doesnt have poster.
  * 
  * @param  string $value 
  * @return string
  */
 public function getPosterAttribute($value)
 {
     if ($value && !str_contains($value, 'http')) {
         return url($value);
     }
     return $value;
 }
 /**
  * Get the API ancestor controller class
  * of the current controller class.
  *
  * @return Esensi\Core\Http\Controllers\ApiController
  */
 public function api()
 {
     // Make a copy of the parent class
     $class = get_parent_class();
     $parent = App::make($class);
     // Copy over the packaged properties
     if ($this instanceof PackagedInterface) {
         $parent->setUI($this->getUI());
         $parent->setPackage($this->getPackage());
         $parent->setNamespacing($this->getNamespacing());
     }
     // Copy over the injected repositories
     if ($this instanceof RepositoryInjectedInterface) {
         foreach ($this->repositories as $name => $repository) {
             $parent->setRepository($repository, $name);
         }
     }
     // Return first ApiController ancestor found
     if (str_contains($class, 'ApiController')) {
         return $parent;
     }
     // Recursively look up the parent class
     if (method_exists($parent, 'api')) {
         return $parent->api();
     }
     // Return the parent class found already
     return $parent;
 }
 public function index()
 {
     $urls = [];
     $routes = Route::getRoutes();
     foreach ($routes as $route) {
         $path = $route->getPath();
         $actions = $route->getAction();
         $params = $route->parameterNames();
         $controller = $actions['controller'];
         if (starts_with($path, '_') or str_contains($controller, 'RedirectController') or count($params)) {
             continue;
         }
         $urls[] = url($path);
     }
     foreach (Campus::all() as $item) {
         $urls[] = url($item->url);
     }
     foreach (Event::all() as $item) {
         $urls[] = url($item->url);
     }
     foreach (Series::withDrafts()->get() as $item) {
         $urls[] = url($item->url);
     }
     foreach (Staff::all() as $item) {
         $urls[] = url($item->url);
     }
     foreach (MissionLocation::all() as $item) {
         $urls[] = url($item->url);
     }
     foreach (Video::withDrafts()->get() as $item) {
         $urls[] = url($item->url);
     }
     return response()->json($urls);
 }
Example #7
0
 public function fire()
 {
     if (!$this->option('tenant')) {
         return parent::fire();
     }
     if ($this->option('tenant') == 'all') {
         $websites = $this->website->all();
     } else {
         $websites = $this->website->queryBuilder()->whereIn('id', explode(',', $this->option('tenant')))->get();
     }
     // forces database to tenant
     if (!$this->option('database')) {
         $this->input->setOption('database', 'tenant');
     }
     foreach ($websites as $website) {
         $this->info("Migrating for {$website->id}: {$website->present()->name}");
         $website->database->setCurrent();
         $this->repository->setSource($website->database->name);
         try {
             $this->repository->createRepository();
         } catch (PDOException $e) {
             if (str_contains($e->getMessage(), ['Base table or view already exists'])) {
                 $this->info("Migration table already exists: {$e->getMessage()}");
                 continue;
             }
         }
         $this->info('Migration table created successfully.');
     }
 }
Example #8
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure() && !str_contains($request->getRequestUri(), '/podcasts/rss')) {
         return redirect()->secure($request->getRequestUri(), 301);
     }
     return $next($request);
 }
 public function create(Request $request)
 {
     if (str_contains($request->input("bg_image"), "simple")) {
         return $this->createsimple($request);
     }
     return $this->createpolaroid($request);
 }
Example #10
0
 private function isHtmlResponse($response)
 {
     if (is_object($response) && $response instanceof Response && str_contains($response->headers->get('Content-Type'), 'text/html')) {
         return false;
     }
     return true;
 }
Example #11
0
 public function vote()
 {
     $class = \Input::get('class');
     $postId = \Input::get('postId');
     $previousVote = PostVote::where('user_id', \Auth::id())->where('post_id', $postId)->first();
     $isUpvote = str_contains($class, 'up');
     // If there is a vote by the same user on the same post
     if (!is_null($previousVote)) {
         if ($isUpvote) {
             if ($previousVote->type === 'up') {
                 // Cancel out previous upvote
                 $previousVote->delete();
             } else {
                 $previousVote->update(['type' => 'up']);
             }
         } else {
             if ($previousVote->type === 'down') {
                 // Cancel out previous downvote
                 $previousVote->delete();
             } else {
                 $previousVote->update(['type' => 'down']);
             }
         }
     } else {
         // Create a new vote
         PostVote::create(['type' => $isUpvote ? 'up' : 'down', 'user_id' => \Auth::id(), 'post_id' => $postId]);
     }
 }
 /**
  * Load the Laravel routes into the application routes for
  * permission assignment.
  *
  * @param $routeNameRegEx
  *
  * @return int The number of Laravel routes loaded.
  */
 public static function loadLaravelRoutes($routeNameRegEx)
 {
     $AppRoutes = \Route::getRoutes();
     $cnt = 0;
     foreach ($AppRoutes as $appRoute) {
         $name = $appRoute->getName();
         $methods = $appRoute->getMethods();
         $path = $appRoute->getPath();
         $actionName = $appRoute->getActionName();
         // Skip AuthController and PasswordController routes, Those are always authorized.
         if (!str_contains($actionName, 'AuthController') && !str_contains($actionName, 'PasswordController')) {
             // Include only if the name matches the requested Regular Expression.
             if (preg_match($routeNameRegEx, $name)) {
                 foreach ($methods as $method) {
                     $route = null;
                     if ('HEAD' !== $method && !starts_with($path, '_debugbar')) {
                         // Skip all DebugBar routes.
                         // TODO: Use Repository 'findWhere' when its fixed!!
                         //                    $route = $this->route->findWhere([
                         //                        'method'      => $method,
                         //                        'action_name' => $actionName,
                         //                    ])->first();
                         $route = \App\Models\Route::ofMethod($method)->ofActionName($actionName)->ofPath($path)->first();
                         if (!isset($route)) {
                             $cnt++;
                             Route::create(['name' => $name, 'method' => $method, 'path' => $path, 'action_name' => $actionName, 'enabled' => 1]);
                         }
                     }
                 }
             }
         }
     }
     return $cnt;
 }
 /**
  * Load the Laravel routes into the application routes for
  * permission assignment.
  *
  * @return int  The number of Laravel routes loaded.
  */
 public static function loadLaravelRoutes()
 {
     $AppRoutes = \Route::getRoutes();
     $cnt = 0;
     foreach ($AppRoutes as $appRoute) {
         $name = $appRoute->getName();
         $methods = $appRoute->getMethods();
         $path = $appRoute->getPath();
         $actionName = $appRoute->getActionName();
         if (!str_contains($actionName, 'AuthController') && !str_contains($actionName, 'PasswordController')) {
             foreach ($methods as $method) {
                 $route = null;
                 if ('HEAD' !== $method && !starts_with($path, '_debugbar')) {
                     // Skip all DebugBar routes.
                     // TODO: Use Repository 'findWhere' when its fixed!!
                     //                    $route = $this->route->findWhere([
                     //                        'method'      => $method,
                     //                        'action_name' => $actionName,
                     //                    ])->first();
                     $route = \App\Models\Route::ofMethod($method)->ofActionName($actionName)->ofPath($path)->first();
                     if (!isset($route)) {
                         $cnt++;
                         $newRoute = Route::create(['name' => $name, 'method' => $method, 'path' => $path, 'action_name' => $actionName, 'enabled' => 1]);
                     }
                 }
             }
         }
     }
     return $cnt;
 }
Example #14
0
function humanize_title($filename)
{
    $replacement = array('ss' => '', 'bb' => 'B&B Editor', 'mixer' => 'FX Mixer', 'roll' => 'Roll Editor', 'plugins' => 'Native Instruments', 'automation' => 'Automation Editor', 'vst' => 'VSTi Running via Vestige');
    $title_split = explode('_', $filename);
    $found = false;
    foreach ($title_split as &$item) {
        // Skip 01, 02, etc
        if (is_numeric($item)) {
            $item = '';
            continue;
        }
        // Substitute array reference with the text above
        if (str_contains($item, '.png', false)) {
            $item = str_replace('.png', '', $item);
        }
        if (array_key_exists($item, $replacement)) {
            $temp = $replacement[$item];
            $item = ($found ? ', ' : ' ') . $temp;
            $found = trim($temp) != '' ? true : false;
        } else {
            $item = ' ' . ucfirst($item);
        }
    }
    return trim(implode('', $title_split));
}
 /**
  * Returns whether the request must be prerendered server side for crawler.
  *
  * @param Request $request
  * @return bool
  */
 private function shouldPrerender(Request $request)
 {
     $userAgent = strtolower($request->server->get('HTTP_USER_AGENT'));
     $bufferAgent = $request->server->get('X-BUFFERBOT');
     $shouldPrerender = false;
     if (!$userAgent) {
         return false;
     }
     if (!$request->isMethod('GET')) {
         return false;
     }
     //google bot
     if ($request->query->has('_escaped_fragment_')) {
         $shouldPrerender = true;
     }
     //other crawlers
     foreach ($this->userAgents as $crawlerUserAgent) {
         if (str_contains($userAgent, strtolower($crawlerUserAgent))) {
             $shouldPrerender = true;
         }
     }
     if ($bufferAgent) {
         $shouldPrerender = true;
     }
     if (!$shouldPrerender) {
         return false;
     }
     return true;
 }
Example #16
0
function setReferer($source, $current)
{
    $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
    str_contains($referer, $current) && str_contains(session('referer'), $source) ? $referer = session('referer') : ($referer = $referer);
    str_contains($referer, $source) ? session(['referer' => $referer]) : session(['referer' => $source]);
    return session('referer');
}
Example #17
0
 /**
  * Return currently active theme.
  *
  * @return string
  */
 public function getTheme()
 {
     if (App::environment() === 'demo' && str_contains(url(), 'mercury')) {
         return 'mercury';
     }
     return isset($this->options['theme']) ? $this->options['theme'] : 'original';
 }
Example #18
0
 /**
  * @return bool
  * @throws Exception
  */
 public function isSigned()
 {
     if (!$this->isNumeric()) {
         throw new Exception('This method should only be called on numeric columns');
     }
     return !str_contains($this->type, 'unsigned');
 }
Example #19
0
 /**
  * @param string $view
  * @param array  $data
  * @param array  $mergeData
  *
  * @return \Illuminate\View\View
  */
 protected function view($view = null, $data = [], $mergeData = [])
 {
     if (!empty($this->view_namespace) and !str_contains($view, '::')) {
         $view = $this->view_namespace . $view;
     }
     return view($view, $data, $mergeData);
 }
Example #20
0
 /**
  * Retrieve a user by the given credentials.
  *
  * @param  array  $credentials
  * @param \Closure $userCreator
  * @return \Illuminate\Auth\UserInterface|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     // First we will add each credential element to the query as a where clause.
     // Then we can execute the query and, if we found a user, return it in a
     // Eloquent User "model" that will be utilized by the Guard instances.
     $query = $this->createModel()->newQuery();
     $idKey = $this->netidKey;
     $credientials[$idKey] = strtolower($credentials[$idKey]);
     foreach ($credentials as $key => $value) {
         if (!str_contains($key, 'password')) {
             $query->where($key, $value);
         }
     }
     if ($query->first()) {
         return $query->first();
     }
     if (!$this->autoCreate) {
         return null;
     }
     if ($this->validateLdapCredentials($credentials)) {
         $idValue = $credentials[$idKey];
         return $this->createNewUser($idValue);
     }
     return null;
 }
 public function store(PostRequest $request)
 {
     if (Input::has('link')) {
         $input['link'] = Input::get('link');
         $info = Embed::create($input['link']);
         if ($info->image == null) {
             $embed_data = ['text' => $info->description];
         } else {
             if ($info->description == null) {
                 $embed_data = ['text' => ''];
             } else {
                 $orig = pathinfo($info->image, PATHINFO_EXTENSION);
                 $qmark = str_contains($orig, '?');
                 if ($qmark == false) {
                     $extension = $orig;
                 } else {
                     $extension = substr($orig, 0, strpos($orig, '?'));
                 }
                 $newName = public_path() . '/images/' . str_random(8) . ".{$extension}";
                 if (File::exists($newName)) {
                     $imageToken = substr(sha1(mt_rand()), 0, 5);
                     $newName = public_path() . '/images/' . str_random(8) . '-' . $imageToken . ".{$extension}";
                 }
                 $image = Image::make($info->image)->fit(70, 70)->save($newName);
                 $embed_data = ['text' => $info->description, 'image' => basename($newName)];
             }
         }
         Auth::user()->posts()->create(array_merge($request->all(), $embed_data));
         return redirect('/subreddit');
     }
     Auth::user()->posts()->create($request->all());
     return redirect('/subreddit');
 }
Example #22
0
 /**
  * Handle the view query.
  *
  * @param  TableBuilder  $builder
  * @param  Builder       $query
  * @param  ViewInterface $view
  * @return mixed
  * @throws \Exception
  */
 public function handle(TableBuilder $builder, Builder $query, ViewInterface $view)
 {
     $view->fire('querying', compact('builder', 'query'));
     if (!($handler = $view->getQuery())) {
         return;
     }
     // Self handling implies @handle
     if (is_string($handler) && !str_contains($handler, '@')) {
         $handler .= '@handle';
     }
     /*
      * If the handler is a callable string or Closure
      * then call it using the IoC container.
      */
     if (is_string($handler) || $handler instanceof \Closure) {
         $this->container->call($handler, compact('builder', 'query'));
     }
     /*
      * If the handle is an instance of ViewQueryInterface
      * simply call the handle method on it.
      */
     if ($handler instanceof ViewQueryInterface) {
         $handler->handle($builder, $query);
     }
 }
Example #23
0
 /**
  * Validate a given attribute against a rule.
  *
  * @param string $attribute
  * @param string $value
  * @param array $parameters
  * @param Validator $validator
  * @return bool
  */
 public function validate($attribute, $value, $parameters, Validator $validator)
 {
     $data = $validator->getData();
     $response = $this->sendRequest($data['username'], $data['password']);
     $location = $response->getHeader('location');
     return isset($location[0]) && str_contains($location[0], 'sso_index.php');
 }
 /**
  * 模拟登录
  */
 public function Login($verifycode = NULL)
 {
     $data = $this->account;
     if (!is_numeric($data['username']) && !str_contains($data['username'], '@')) {
         return '用户名格式错误,请输入QQ号或QQ邮箱。';
     }
     Session::Set('qq', $data['username']);
     if (!$verifycode) {
         $ret = $this->get('http://check.ptlogin2.qq.com/check?appid=15000101&uin=' . $data['username']);
         //
         $arr = explode("'", $ret);
         $verifycode = $arr[3];
         if (strlen($verifycode) != 4) {
             return '绑定账号失败:请输入验证码';
             //'登录服务暂时不可用,请稍后再试!';
         }
     }
     $param = array('aid' => 15000101, 'fp' => 'loginerroralert', 'from_ui' => 1, 'g' => 1, 'h' => 1, 'u' => $data['username'], 'p' => $this->encpwd($data['password'], $data['username'], $verifycode), 'verifycode' => $verifycode, 'u1' => 'http://imgcache.qq.com/qzone/v5/loginsucc.html?para=izone');
     Log::customLog('qzone.txt', "GET http://ptlogin2.qq.com/login:\r\n" . print_r($param, true));
     $ret = $this->get('http://ptlogin2.qq.com/login?' . http_build_query($param));
     Log::customLog('qzone.txt', "Response:\r\n" . print_r($this->http_header, true) . print_r($ret, true));
     $arr = explode("'", $ret);
     $ret = $arr[9];
     if (start_with($ret, '登录成功')) {
         return true;
     }
     return $ret;
 }
Example #25
-1
File: Domain.php Project: riclt/api
 /**
  * Strip the protocol from a domain.
  *
  * @param string $domain
  *
  * @return string
  */
 protected function stripProtocol($domain)
 {
     if (str_contains($domain, '://')) {
         $domain = substr($domain, strpos($domain, '://') + 3);
     }
     return $domain;
 }
 /**
  * Handle the command.
  */
 public function handle(MessageBag $messages, Translator $translator)
 {
     // If we can't save or there are errors then skip it.
     if ($this->builder->hasFormErrors() || !$this->builder->canSave()) {
         return;
     }
     // If there is no model and there isn't anything specific to say, skip it.
     if (!$this->builder->getFormEntry() && !$this->builder->getFormOption('success_message')) {
         return;
     }
     $mode = $this->builder->getFormMode();
     // False means no message is desired.
     if ($this->builder->getFormOption('success_message') === false) {
         return;
     }
     $entry = $this->builder->getFormEntry();
     $stream = $this->builder->getFormStream();
     $parameters = ['title' => is_object($entry) ? $entry->getTitle() : null, 'name' => is_object($stream) ? $stream->getName() : null];
     // If the name doesn't exist we need to be clever.
     if (str_contains($parameters['name'], '::') && !$translator->has($parameters['name']) && $stream) {
         $parameters['name'] = ucfirst(str_singular(str_replace('_', ' ', $stream->getSlug())));
     } elseif ($parameters['name']) {
         $parameters['name'] = str_singular(trans($parameters['name']));
     } else {
         $parameters['name'] = trans('streams::entry.name');
     }
     /**
      * Set the default success message.
      */
     if ($this->builder->getFormOption('success_message') === null) {
         $this->builder->setFormOption('success_message', trans('streams::message.' . $mode . '_success', $parameters));
     }
     $messages->{$this->builder->getFormOption('success_message_type', 'success')}($this->builder->getFormOption('success_message'));
 }
Example #27
-1
 /**
  * Handle an exception and display the exception report.
  *
  * @param  Exception  $exception
  * @param  bool       $trace
  * @return void
  */
 public static function exception($exception, $trace = true)
 {
     static::log($exception);
     ob_get_level() and ob_end_clean();
     $message = $exception->getMessage();
     // For Laravel view errors we want to show a prettier error:
     $file = $exception->getFile();
     if (str_contains($exception->getFile(), 'eval()') and str_contains($exception->getFile(), 'laravel' . DS . 'view.php')) {
         $message = 'Error rendering view: [' . View::$last['name'] . ']' . PHP_EOL . PHP_EOL . $message;
         $file = View::$last['path'];
     }
     // If detailed errors are enabled, we'll just format the exception into
     // a simple error message and display it on the screen. We don't use a
     // View in case the problem is in the View class.
     if (Config::get('error.detail')) {
         $response_body = "<html><h2>Unhandled Exception</h2>\n\t\t\t\t<h3>Message:</h3>\n\t\t\t\t<pre>" . $message . "</pre>\n\t\t\t\t<h3>Location:</h3>\n\t\t\t\t<pre>" . $file . " on line " . $exception->getLine() . "</pre>";
         if ($trace) {
             $response_body .= "\n\t\t\t\t  <h3>Stack Trace:</h3>\n\t\t\t\t  <pre>" . $exception->getTraceAsString() . "</pre></html>";
         }
         $response = Response::make($response_body, 500);
     } else {
         $response = Event::first('500', array($exception));
         $response = Response::prepare($response);
     }
     $response->render();
     $response->send();
     $response->foundation->finish();
     exit(1);
 }
Example #28
-1
 public function folder_contents()
 {
     $directory = Input::get('dir', '');
     $files = array();
     foreach (File::files(public_path($directory)) as $key => $file) {
         $pathinfo = pathinfo($file);
         $dir = str_replace(base_path() . '/public/', '', $pathinfo['dirname']);
         $dir = str_replace(base_path() . '/', '', $dir);
         $filename = $dir . '/' . $pathinfo['filename'] . '.' . $pathinfo['extension'];
         $thumbnail = $dir . '/thumbs/' . $filename;
         if (File::exists($thumbnail)) {
             $files[] = $thumbnail;
         } else {
             $files[] = $filename;
         }
     }
     $dirs = array();
     foreach (File::directories(public_path($directory)) as $dir) {
         if (!str_contains($dir, 'thumbs')) {
             $dir_name = str_replace('\\', '/', $dir);
             $dirs[] = $dir_name;
         }
     }
     $ret = array('files' => $files, 'dirs' => $dirs);
     return Response::json($ret, 200);
 }
Example #29
-1
 /**
  * Retrieve a user by the given credentials.
  *
  * @param  array  $credentials
  * @return \Illuminate\Auth\UserInterface|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     // First we will add each credential element to the query as a where clause.
     // Then we can execute the query and, if we found a user, return it in a
     // Eloquent User "model" that will be utilized by the Guard instances.
     $query = $this->createModel()->newQuery();
     $idKey = $this->config['netidColumn'];
     $credientials[$idKey] = strtolower($credentials[$idKey]);
     foreach ($credentials as $key => $value) {
         if (!str_contains($key, 'password')) {
             $query->where($key, $value);
         }
     }
     if ($query->first()) {
         return $query->first();
     }
     if (!$this->autoCreate) {
         return null;
     }
     if ($this->validateLdapCredentials($credentials)) {
         $idValue = $credentials[$idKey];
         $firstNameKey = $this->firstNameKey;
         $lastNameKey = $this->lastNameKey;
         $emailKey = $this->emailKey;
         $info = $this->retrieveLdapUserInfo($idValue);
         $user = $this->createModel();
         $user->{$firstNameKey} = $info['first_name'];
         $user->{$lastNameKey} = $info['last_name'];
         $user->{$idKey} = $idValue;
         $user->{$emailKey} = $info['email'];
         $user->save();
         return $user;
     }
     return null;
 }
Example #30
-1
 /**
  * Checks call to see if we can create a table from a magic call (for you wizards).
  * hover_striped, bordered_condensed, etc.
  *
  * @param string $method     Method name
  * @param array  $parameters Method parameters
  *
  * @return mixed
  */
 public static function __callStatic($method, $parameters)
 {
     // Opening a table
     if (str_contains($method, 'open') or $method == 'open') {
         $method = strtolower($method);
         $classes = explode('_', $method);
         $method = array_pop($classes);
         // Fallback to default type if defined
         if (sizeof($classes) == 0) {
             $classes = Config::get('table.classes');
         }
         // Filter table classes
         $classes = array_intersect($classes, static::$classes);
         $attributes = Helpers::set_multi_class_attributes($method, $classes, $parameters, 0, 'table-');
         $attributes = array_get($attributes, 0);
         static::$table = new static($attributes);
         return static::$table->open();
     }
     // Set default function
     if (!$method) {
         $method = 'table';
     }
     // Use cases
     switch ($method) {
         case 'close':
             $close = static::table()->close();
             static::$table = null;
             return $close;
             break;
         default:
             return call_user_func_array(array(static::table(), $method), $parameters);
             break;
     }
 }