sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public static function cpf($num){ $num = preg_replace('/[^0-9]/', '', $num); if($num == "11111111111" || $num == "22222222222" || $num == "33333333333" || $num == "44444444444" || $num == "55555555555" || $num == "66666666666" || $num == "77777777777" || $num == "88888888888" || $num == "99999999999" || $num == "...
verifica CPF
entailment
public static function WhatBrowser($browser=''){ $ua = strtolower($_SERVER['HTTP_USER_AGENT']); if($browser=="ie"){ if(strpos($ua, 'msie') == true ){ return true;}else{return false;} }else if($browser=="ie7"){ if(strpos($ua, 'msie 7.0') == true ){ return true;}else{return false;} }else if($browser=...
responde Browser
entailment
public static function Compactar($b,$bolean) { if($bolean==false){return $b;} ob_start("compactar"); $b = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $b); $b = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $b); return $b; }
compacta codigo HTML
entailment
public static function dt2br($var,$separa="/"){ if(preg_match('/([012][0-9]|3[01]|[0-9])\/([0-9]|[0-9]{2})\/([0-9]{4})/', $var, $array)) return self::checkDtbr($array[1], $array[2], $array[3],$separa); else if(preg_match('/([0-9]{4})\-([0-9]|[0-9]{2})\-([012][0-9]|3[01]|[0-9])/', $var, $array)) return sel...
transforma data 1992-08-14 para 14/08/1992
entailment
public static function dttm2br($var,$separador="/"){ if(preg_match('/([0-9]{4})\-([0-9]{2})\-([012][0-9]|3[01])[ ]([0-9]{2}):([0-9]{2}):([0-9]{2})/', $var, $array)){ $dt = self::checkDtbr($array[3], $array[2], $array[1],$separador); if($dt && ($array[4] != '00' || $array[5] != '00')) $dt .= ' '.$array[...
transforma datetime do servidor US para data e hora BR
entailment
public static function checkDtbr($dia, $mes, $ano,$separa){ if(checkdate($mes, $dia, $ano)) return $dia.$separa.$mes.$separa.$ano; }
function auxiliar
entailment
public function getImageType() { $this->imageType = ($this->imageType === 'jpg') ? 'jpeg' : $this->imageType; $this->imageType = ( in_array($this->imageType, $this->imageTypes) ) ? $this->imageType : 'png'; return $this->imageType; }
Get image type @return string
entailment
public function create($width = null, $height = null) { $this->width = ($width) ? $width : $this->width; $this->height = ($height) ? $height : $this->height; $imageType = $this->getImageType(); $createFunc = ($imageType === 'gif') ? 'imagecreate' : 'imagecreatetruecolor...
Captcha image creator @param int $width null @param int $height null @return $this
entailment
protected function randomLetters() { for ($i = 0; $i < $this->length; $i++) { $letters = $this->letters[mt_rand(0, count($this->letters) - 1)]; $this->code .= $letters[mt_rand(0, strlen($letters) - 1)]; } }
Random generation English & Numbers letters @return void
entailment
protected function randomChinese() { if ( function_exists('mb_substr') ) { $len = mb_strlen($this->chineseCharacters, 'utf-8'); for ($i = 0; $i < $this->length; $i++) { $this->code .= mb_substr($this->chineseCharacters, mt_rand(0, $len - 1...
Random generation chinese characters @return void
entailment
protected function randomMixed() { $characters = implode('', $this->letters) . $this->chineseCharacters; if (function_exists('mb_substr')) { $len = mb_strlen($characters, 'utf-8'); for ($i = 0; $i < $this->length; $i++) { $this-...
Random generation mixed characters @return void
entailment
protected function drawText() { /** * 0 Numbers * 1 Pure English letters * 2 English letters & Numbers mixed * 3 chinese characters * 4 All mixed */ switch($this->randomType) { case 0: $this->rand...
Draw text characters to image @return void
entailment
protected function drawBorder() { $borderColor = imagecolorallocate($this->image, 0, 0, mt_rand(50, 255)); imagerectangle($this->image, 0, 0, $this->width - $this->borderWidth, $this->height - $this->borderWidth, $borderColor); }
Draw border @return void
entailment
protected function drawLine() { $lineColor = imagecolorallocate($this->image, mt_rand(50, 255), mt_rand(100, 255), mt_rand(0, 255)); for($i = 0; $i < $this->lines; $i++) { imageline($this->image, 0, mt_rand() % $this->height, $this->width, mt_rand() % $this->height, $lineC...
Draw lines @return void
entailment
protected function drawPixel() { $pixelColor = imagecolorallocate($this->image, mt_rand(0, 255), mt_rand(100, 255), mt_rand(50, 255)); for($i = 0; $i< mt_rand(1000, 1800); $i++) { imagesetpixel($this->image, mt_rand() % $this->width, mt_rand() % $this->height, $pixelColor)...
Draw pixel points @return void
entailment
public function display() { $imageType = $this->getImageType(); header('Content-type: image/' . $imageType); $imageFunc = 'image' . $imageType; $imageFunc($this->image); $this->destroy($this->image); return $this; }
Display captcha image in page @return $this
entailment
public function save($filename) { $type = pathinfo($filename, PATHINFO_EXTENSION); $type = ($type === 'jpg') ? 'jpeg' : $type; $type = (in_array($type, $this->imageTypes)) ? $type : 'png'; header('Content-type: image/' . $type); $imageFunc = 'image' . $type; ...
Save captcha image file @param string $filename @return $this
entailment
public function gotoURL($url, $base = true) { if ($base) { $url = $this->app->baseURL . $url; } $this->js('location.href="'.$url.'";'); }
Using javascript location.href go to url @param string $url @param bool $base true @return string
entailment
protected function redirect($path) { $path = str_replace('//', '/', $this->app->baseURL . $path); $this->app->redirect($path); }
Redirect controller @param string $path @return void
entailment
protected function render($tpl, array $data = []) { $suffix = $this->app->config('template.suffix'); $suffix = (empty($suffix)) ? $this->viewSuffix : $suffix; $tpl .= $suffix; $this->app->render($tpl, $data); }
Override \Slim\Slim::render method on controller @param string $tpl @param array $data [] @param string $suffix @return void
entailment
protected function getFilePath() { $path = $this->cachePath . DIRECTORY_SEPARATOR . $this->cacheDirectory . DIRECTORY_SEPARATOR; $path = str_replace(['\\\\', '//'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $path); return $path; }
Get cache file path @return string
entailment
protected function getFileName($key) { $file = $this->getFilePath() . $this->encrypt($key) . $this->fileExtension; return $file; }
Get cache filename @param string $key @return string
entailment
public function set($key, $value, $expireTime = null) { if ( $expireTime && !is_int($expireTime) ) { throw new \InvalidArgumentException('cache expire time must be integer.'); } $this->expireTime = ($expireTime) ? $expireTime : $this->expireTime; return...
Set cache key and write to cache file @param string $key @param string $value @param int $expireTime null @return bool @throws InvalidArgumentException @throws FileCacheException
entailment
protected function write($file, $value) { $key = $file; $path = $this->getFilePath(); if ( !file_exists($dir) ) { mkdir($path, 0777, true); } $file = $this->getFileName($key); $value = serialize($value); $value = ($this->ba...
Write to cache file @param string $file @param string $value @return bool @throws FileCacheException
entailment
protected function read($file) { $data = null; $key = $file; $file = $this->getFileName($file); if ( file_exists($file)) { // if cache file not expire if (filemtime($file) >= time()) { echo "read cache<br/>"; ...
Read cache file @param string $file @return mixed|null
entailment
public function has($key) { $file = $this->getFileName($key); if ( !file_exists($file) ) { return false; } // if cache file expire if ( filemtime($file) >= time() ) { static::$keys[$key] = true; return true;...
Check has cache key @param string $key @return bool
entailment
public function remove($key) { $file = $this->getFileName($key); if ( !file_exists($file) ) { return false; } unset(static::$keys[$key]); return (unlink($file))? true : false; }
Remove cache key @param string $key @return bool
entailment
public function clear() { echo $path = $this->getFilePath(); $files = glob($path . '*' . $this->fileExtension); foreach ($files as $file) { // if cache file expire, delete cache file if ( time() > filemtime($file) ) { @u...
Clear expire cache file @return void
entailment
public function clearAll() { $path = $this->getFilePath(); $files = glob($path . '*' . $this->fileExtension); foreach ($files as $file) { @unlink($file); } static::$keys = []; }
Delete all cache files @return void
entailment
public function setDefaultOptions() { curl_setopt_array($this->curl, [ CURLOPT_TIMEOUT => $this->timeout, CURLOPT_NOSIGNAL => $this->nosignal, CURLOPT_FILETIME => $this->fileTime, CURLOPT_USERAGENT => $this->userAgent, ...
Default cURL options @return void
entailment
public function method($method) { $this->headers = array_merge($this->headers, array('X-HTTP-Method-Override: ' . $method)); $this->setOption(CURLOPT_CUSTOMREQUEST, $method); $this->setOption(CURLOPT_HTTPHEADER, $this->headers); }
Set cURL method @param string $method @return void
entailment
public function error() { $this->errors = [ 'code' => curl_errno($this->curl), 'message' => curl_error($this->curl) ]; return $this->error(); }
Get cURL errors @return mixed
entailment
public function send($url, $method = 'GET', $data = null, callable $callback = null) { $this->curl($url); $this->setDefaultOptions(); if (is_array($this->options)) { if (count($this->options) > 0) { foreach ($this->options as $key => ...
Send Http query @param string $url @param string $method GET @param string|array $data null @param callable $callback null @return mixed
entailment
public function head($url, $fields = null, callable $callback = null) { $this->send($url, self::HEAD, $fields, $callback); }
HTTP HEAD method @param $url @param string $fields null @param callable $callback null
entailment
public function get($url, $queries = null, callable $callback = null) { if ( is_array($queries) ) { $queries = '?' . http_build_query($queries); } return $this->send($url . $queries, self::GET, [], $callback); }
HTTP GET method @param string $url @param array|string $queries null @param callable $callback null @return mixed
entailment
public function post($url, array $fields = [], callable $callback = null) { return $this->send($url, self::POST, $fields, $callback); }
HTTP POST method @param string $url @param array $fields [] @param callable $callback null @return mixed
entailment
public function put($url, $fields = null, callable $callback = null) { $fields = (is_array($fields)) ? http_build_query($fields) : $fields; return $this->send($url, self::PUT, $fields, $callback); }
HTTP PUT method @param string $url @param string|array $fields null @param callable $callback null @return mixed
entailment
public function delete($url, $fields = null, callable $callback = null) { $fields = ( is_array($fields) ) ? http_build_query($fields) : $fields; return $this->send($url, self::DELETE, $fields, $callback); }
HTTP DELETE method @param string $url @param string|array $fields null @param callable $callback null @return mixed
entailment
public function patch($url, $fields = null, callable $callback = null) { $this->send($url, self::PATCH, $fields, $callback); }
HTTP PATCH method @param $url @param string $fields null @param callable $callback null
entailment
public function options($url, $fields = null, callable $callback = null) { $this->send($url, self::OPTIONS, $fields, $callback); }
HTTP OPTIONS method @param $url @param null $fields null @param callable $callback null
entailment
public function trace($url, $fields = null, callable $callback = null) { $this->send($url, self::TRACE, $fields, $callback); }
HTTP TRACE method @param $url @param null $fields null @param callable $callback null
entailment
public function boot() { parent::boot(); if (Request::is('*/gallery/gallery/*')) { Route::bind('gallery', function ($gallery) { $galleryrepo = $this->app->make('Litecms\Gallery\Interfaces\GalleryRepositoryInterface'); return $galleryrepo->findorN...
Define your route model bindings, pattern filters, etc. @param \Illuminate\Routing\Router $router @return void
entailment
protected function mapWebRoutes() { if (request()->segment(1) == 'api' || request()->segment(2) == 'api') { return; } Route::group([ 'middleware' => 'web', 'namespace' => $this->namespace, 'prefix' => trans_setlocale(), ],...
Define the "web" routes for the package. These routes all receive session state, CSRF protection, etc. @return void
entailment
public function make() { $this->pageTotal = ceil($this->total / $this->num); $this->page = ($this->page > $this->pageTotal) ? $this->pageTotal : $this->page; $this->offset = ($this->page == 1) ? 0 : (($this->page - 1) * $this->num); $this->prev = ($this->page == 1) ...
Make paginator params @return void
entailment
public function range() { $start = $this->page - $this->range; $start = ($start < 1) ? 1 : $start; $end = $this->page + $this->range; $end = ($end > $this->pageTotal) ? $this->pageTotal : $end; $this->ranges = [ 'start' => $start, 'end'...
Set/Get paginator ranges @return array
entailment
public function query() { $model = $this->model; $this->query = $model->select($this->select) ->where($this->where) ->orderBy($this->orderBy, $this->sortBy) ->take($this->num) ...
Sql query @param bool $toJson @return array
entailment
public static function mask($txt='', $mascara='') { if(empty($txt) || empty($mascara)){ return false; }else if($mascara == Mask::TELEFONE){ $mascara = (strlen($txt) == 10 ? '(##)####-####' : '(##)#####-####'); }else if($mascara == Mask::DOCUMENTO){ $mascara ...
Adiciona máscara em um texto @param string $txt Texto @param Mask $mascara @return string (Texto com mascara)
entailment
public static function maskFactory($txt='', $mascara='') { $txt = Mask::unmask($txt); if(empty($txt) || empty($mascara)){ return false; } $qtd = substr_count($mascara, '#'); if($qtd != strlen($txt) && strlen($txt)!=0) { return false; }else{ ...
Adiciona máscara @param string $texto @return string (Texto com a mascara)
entailment
public static function isNumericArray($array){ if (!is_array($array)) { return false; } $current = 0; foreach (array_keys($array) as $key) { if ($key !== $current) { return false; } $current++; } return true; }
Retorna booleano se uma função é uma matriz numérica plana / seqüencial @param array $array An array to test @return boolean
entailment
public static function arrayFlatten(array $array, $preserve_keys = true){ $flattened = array(); array_walk_recursive($array, function ($value, $key) use (&$flattened, $preserve_keys) { if ($preserve_keys && !is_int($key)) { $flattened[$key] = $value; } else { ...
Aplique uma matriz multidimensional em uma matriz unidimensional. * @param array $array The array to flatten @param boolean $preserve_keys Whether or not to preserve array keys. Keys from deeply nested arrays will overwrite keys from shallowy nested arrays @return array
entailment
public static function arrayPluck(array $array, $field, $preserve_keys = true, $remove_nomatches = true){ $new_list = array(); foreach ($array as $key => $value) { if (is_object($value)) { if (isset($value->{$field})) { if ($preserve_keys) { ...
Aceita uma matriz e retorna uma matriz de valores da matriz conforme especificado pelo $field. Por exemplo, se a matriz estiver cheia de objetos e você chamar util::array_pluck ($array, 'name'), a função será retornar uma matriz de valores de $array[]->name. @param array $array An array @param string $...
entailment
public function isInScope(UriInterface $source, UriInterface $comparator): bool { $source = $this->removeIgnoredComponents($source); $comparator = $this->removeIgnoredComponents($comparator); $sourceString = (string) $source; $comparatorString = (string) $comparator; if ($s...
Is the given comparator url in the scope of the source url? Comparator is in the same scope as the source if: - scheme is the same or equivalent (e.g. http and https are equivalent) - hostname is the same or equivalent (equivalency looks at subdomain equivalence e.g. example.com and www.example.com) - path is the same...
entailment
public function set() { $args = func_get_args(); $count = func_num_args(); if ( is_array($args[0]) ) { foreach ($args[0] as $key => $value) { if ($key === 'path') { $this->setPath($value); ...
Settings @param string|array $key null @param string $value null @return void
entailment
public function setPath($path) { if (!file_exists($path)) { mkdir($path, 0777, true); } $this->path = $path; }
Setting logs path @param string $path @return void
entailment
protected function defaultMessageFormatReplaces() { $this->messageFormatReplaces = [ $this->label, str_repeat(' ', 9 - strlen($this->label)), date('Y-m-d H:i:s e O'), $this->message ]; }
Default log message format replaces @return void
entailment
protected function messageFormatParser() { $this->label = $this->levels[$this->level]; $this->messageOutput = str_replace( $this->getMessageFormatSearchs(), $this->getMessageFormatReplaces(), $this->getMessageFormat() ); }
Log message format parser @return void
entailment
public function write($content, $level) { $this->message = (string) $content; $this->level = $level; if ( is_callable($this->writeBeforeHandle) ) { $this->writeBefore($this->writeBeforeHandle); if (!$this->customMessageFormatParser) {...
Write to log file @param mixed $content @param int $level @return void
entailment
public static function numberToWords($number, $measurement='') { if(strpos($number, ',')!== false) { $number = str_replace(',', '.', $number); } if (!is_numeric($number)) { return false; } if ($number > PHP_INT_MAX) { // overflow r...
Converts a unix timestamp to a relative time string, such as "3 days ago" or "2 weeks ago". @param int number @return string
entailment
public static function humanTimeDiff($from, $to = '', $as_text = false, $suffix = ' atrás'){ if ($to == '') { $to = time(); } $from = new \DateTime(date('Y-m-d H:i:s', $from)); $to = new \DateTime(date('Y-m-d H:i:s', $to)); $diff = $from->diff($to); if ($di...
Converts a unix timestamp to a relative time string, such as "3 days ago" or "2 weeks ago". @param int $from The date to use as a starting point @param int $to The date to compare to, defaults to now @param string $suffix The string to add to the end, defaults to " ago" @return string
entailment
public function isPubliclyRoutable(): bool { try { $ip = IpUtilsFactory::getAddress($this->host); if ($ip->isPrivate()) { return false; } if ($ip->isLoopback()) { return false; } if ($ip instanceof IPv...
@return bool @throws InvalidExpressionException
entailment
private function isIpv4InUnroutableRange(IPv4 $ip): bool { foreach ($this->unrouteableRanges as $ipRange) { if ($ip->matches(new Subnet($ipRange))) { return true; } } return false; }
@param IPv4 $ip @return bool @throws InvalidExpressionException
entailment
public function config(array $configs) { foreach($configs as $key => $value) { if (property_exists($this, $key)) { $this->$key = $value; } } }
Set configs @access public @param array $configs @return void
entailment
public function upload($name) { // When $_FILES[$name]['name'] empty if ( empty($_FILES[$name]['name']) ) { $this->error($this->errors['empty'], 0, true); return false; } $this->files = $_FILES[$name]; // When the directory is ...
Execute upload @access public @param string $name fileInput's name @return bool
entailment
private function moveFile() { $this->setSeveName(); $files = $this->files; if ($this->formats != "" && !in_array($this->fileExt, $this->formats)) { $formats = implode(',', $this->formats); $message = "Your upload file " . $files["name"] . " is " ....
Check and move the upload file @access private @return bool
entailment
private function randomFileName() { $fileName = ''; // Generate the datetime format file name if ($this->randomNameType == 1) { date_default_timezone_set($this->timezone); $date = date($this->randomLength); echo $dir = $this->s...
Generate random file name @access private @return string $fileName
entailment
private function setSeveName() { $this->saveName = $this->randomFileName(); if ($this->saveName == '') { $this->saveName = $this->files['name']; } }
Set Saved filename for database @access private @return void
entailment
public function message($message, $success = 0, $return = false) { $array = array( 'success' => $success, 'message' => $message ); $url = $this->saveURL . $this->saveName; // Cross-domain redirect to callback url if ($this->redirect) ...
Errors message handle @access public @param string $message @param int $success @param bool $return false @return array|string
entailment
public function index(GalleryRequest $request) { $view = $this->response->theme->listView(); if ($this->response->typeIs('json')) { $function = camel_case('get-' . $view); return $this->repository ->setPresenter(\Litecms\Gallery\Repositories\Presenter\Gallery...
Display a list of gallery. @return Response
entailment
public function show(GalleryRequest $request, Gallery $gallery) { if ($gallery->exists) { $view = 'gallery::gallery.show'; } else { $view = 'gallery::gallery.new'; } return $this->response->title(trans('app.view') . ' ' . trans('gallery::gallery.name')) ...
Display gallery. @param Request $request @param Model $gallery @return Response
entailment
public function edit(GalleryRequest $request, Gallery $gallery) { return $this->response->title(trans('app.edit') . ' ' . trans('gallery::gallery.name')) ->view('gallery::gallery.edit', true) ->data(compact('gallery')) ->output(); }
Show gallery for editing. @param Request $request @param Model $gallery @return Response
entailment
public function update(GalleryRequest $request, Gallery $gallery) { try { $attributes = $request->all(); $gallery->update($attributes); return $this->response->message(trans('messages.success.updated', ['Module' => trans('gallery::gallery.name')])) ->code...
Update the gallery. @param Request $request @param Model $gallery @return Response
entailment
public function destroy(GalleryRequest $request, Gallery $gallery) { try { $gallery->delete(); return $this->response->message(trans('messages.success.deleted', ['Module' => trans('gallery::gallery.name')])) ->code(202) ->status('success') ...
Remove the gallery. @param Model $gallery @return Response
entailment
public function executeSQL($sql){ //verifica se o banco de dados está conectado if(!isset($GLOBALS['CONN'])){ $this->setError('Não há conexão com o banco de dados <i><b>$</b>GLOBALS["CONN"]</i>'); } //se for teste, exibe SQL e não executa; if($this->getError()!=''){ echo "Em:".$sql.'<br/><br/>'.utf8_decode...
EXECUTA
entailment
public function Select($executar=true){ $q='SELECT '; $q.=($this->getFields()!=''?$this->getFields():'*'); $q.=' FROM '; if($this->getTable()!=''){ $q.=$this->getTable(); }else{ $this->setError('É necessário atribuir um valor ao método <i><b>getTable</b></i>'); } //insere WHERE if($this-...
SELECT
entailment
public function Insert(){ $q='INSERT INTO '; if($this->getTable()!=''){ $q.=$this->getTable(); }else{ $this->setError('É necessário atribuir um valor ao método <i><b>getTable</b></i>'); } //insere SET if($this->getSet()!=''){ $q.=' SET '; $q.=$this->getSet(); }else{ $this->setEr...
INSERIR
entailment
public function Update($executar=true){ $q='UPDATE '; if($this->getTable()!=''){ $q.=$this->getTable(); }else{ $this->setError('É necessário atribuir um valor ao método <i><b>getTable</b></i>'); } $q.=' SET '; //insere SET if($this->getSet()!=''){ $q.=$this->getSet(); }else{ $thi...
INSERIR
entailment
public function Delete(){ $q='DELETE FROM '; if($this->getTable()!=''){ $q.=$this->getTable(); }else{ $this->setError('É necessário atribuir um valor ao método <i><b>getTable</b></i>'); } //insere WHERE if($this->getWhere()!=''){ $q.=' WHERE '.$this->getWhere(); } //insere LIMIT i...
INSERIR
entailment
public function clear(){ $this->setFields(''); $this->setSet(''); $this->setLimit(''); $this->setWhere(''); $this->setOrderBy(''); $this->setGroupBy(''); $this->setRecords(''); $this->setQuery(''); }
Limpa variaveis para novas consultas
entailment
public function getRow(){ if($GLOBALS['CONN']->_connectionID==false){ return false; } $s=$this->getQuery(); return $s->FetchRow(); }
CONTROLE DE TABLE
entailment
public function setSet($v=''){ if(is_array($v)){ $q=''; if(count($v)>0){ foreach($v as $key=>$value){ $q.= "`{$key}` = '{$value}', "; } $q=substr($q, 0, -2); } $this->set=$q; }else{ $this->set=$v; ...
CONTROLE DE SET
entailment
public function setWhere($v=''){ if(is_array($v)){ $q=''; if(count($v)>0){ foreach($v as $key=>$value){ $q.= " {$key}= '{$value}' AND"; } $q=substr($q, 0, -3); } $this->where=$q; }else{ $this->where=$...
CONTROLE DE WHERE
entailment
public function setError($v=''){ $tmp=array(); $tmp=$this->getError('array'); $tmp[]=$v; $this->error=$tmp; }
CONTROLE DE ALL ERROR
entailment
public function setAllError($v=''){ $tmp=array(); $tmp=$this->getAllError('array'); $tmp[]=$v; $this->allError=$tmp; }
CONTROLE DE ALL ERROR
entailment
public function getAllError($t='text'){ $tmp=''; if(count($this->allError)>0){ $tmp='<table>'; for ($i=0; $i < count($this->allError); $i++) { $tmp.='<tr>'; $tmp.=' <td width="100">#ERRO N&deg; '.($i+1).'</td>'; $tmp.=' <td>SQL: '.strip_tags($this->getLastQuery()).'</td>'; $tmp.='</tr>...
parametro('array') - Retorna tabela HTML de erros
entailment
public function run(ApplicationInterface $app) { $config = $app->getConfig(); $servicesFactory = $app->getServicesFactory(); $this->injectInitialServices($app); foreach ($config->get(Service::class, []) as $serviceSpec) { $servicesFactory->regis...
@param ApplicationInterface $app @throws \ObjectivePHP\ServicesFactory\Exception\Exception
entailment
protected function injectInitialServices(ApplicationInterface $app) { $app->getServicesFactory()->registerService( ['id' => 'application', 'instance' => $app], // all those are here for convenience only since 'application' gives access to all of them ['id' =>...
@param ApplicationInterface $app @throws \ObjectivePHP\ServicesFactory\Exception\Exception @internal param ApplicationInterface $application
entailment
public function set($reference, $value) { $reference = $this->computeKeyFQN($reference); self::$data[$reference] = $value; return $this; }
@param $key @param $value @return $this @throws \ObjectivePHP\Primitives\Exception
entailment
public function get($reference, $default = null) { $reference = $this->computeKeyFQN($reference); // first look for exact match if (isset(self::$data[$reference])) { return self::$data[$reference]; } // otherwise use a matcher to return a // collection o...
@param $reference @param null $default @return mixed|null @throws \ObjectivePHP\Primitives\Exception
entailment
public function remove($reference) { $reference = $this->computeKeyFQN($reference); $matcher = $this->getMatcher(); Collection::cast(self::$data)->each(function (&$value, $key) use ($matcher, $reference) { if ($matcher->match($reference, $key)) { unset(self::$dat...
@param $key @return $this
entailment
public function getImportCurrentDataApplication(){ $app_config = $this->getAppConfigYaml(); foreach ($app_config[$this->getApplicationName()] as $key => $value) { if(isset($value['address_uri'])){ $addresUri = explode('/', $value['address_uri']); if(!empty($addresUri[0]) && strpos(...
configura applications
entailment
private function setSystemConfigs(){ /* Set limiter cache, default: private */ if($this->getCacheLimiter() != 'nochace' && $this->getCacheLimiter() != 'private' && $this->getCacheLimiter() != 'private_no_expire' && $this->getCacheLimiter() != 'public'){ $this->getCacheLimiter('private'); } session_cache_limi...
realiza as configurações do sistema
entailment
private function setSystemConfigsCurrentApplication(){ //verifica use_https if($this->getUseHttps()!='On' && $this->getUseHttps()!='Off'){ $this->setUseHttps('Off'); } //verifica use_www if($this->getUseWww()!='On' && $this->getUseWww()!='Off'){ $this->setUseWww('Off'); } //verifica address_uri if...
realiza as configurações da atual aplicação
entailment
public function setApplication($a='',$l=''){ if(is_string($a)){ // adicona novas applications // 'default' => /app/default/ é padrão $this->application[$a] = $l; }else if(is_array($a)){ foreach ($a as $key => &$value) { $this->application[$key] = $value; } } }
Set applications of system
entailment
public function getApplicationUseNow(){ $tmp=explode('/', preg_replace('/^[\/]*(.*?)[\/]*$/', '\\1', $_SERVER['REQUEST_URI'])); foreach ($tmp as $key => $value) { if(isset($tmp[$key]) && is_array($this->getApplication()) && array_key_exists($tmp[$key],$this->getApplication())){ for ($i=0; $i < $key; $i++) ...
Capture path of application, using url or subdomin
entailment
private function getApplicationPathFiles(){ $this->setPathURI(explode('/', preg_replace('/^[\/]*(.*?)[\/]*$/', '\\1', $_SERVER['REQUEST_URI']))); $a=$this->getPathURI(); if($this->getEnvironmentStatus()=='development'){ $nun_level=explode("/", $this->getAddressUri()); for ($i=0; $i < count($nun_level)-2...
retur folder about aplicatoins
entailment
public function insertLoadPageLog($timer= '', $page=''){ if($this->getLimitDataLoadPage()!=0){ $text=''; $addLine=true; if(file_exists(PATH_ROOT."/dwphp/storage/log/loadpage.log")){ $f=fopen(PATH_ROOT."/dwphp/storage/log/loadpage.log","r+"); while (!feof($f)) { //pega conteudo da linha $lin...
/* GET PATH
entailment
private function instanceTemplate($pathFile){ if(file_exists($pathFile)){ require_once $pathFile; if(class_exists('App\\template', true)){ $n='App\template'; $this->template = new $n($this); if(file_exists($this->getpageCtrl())){ require_once $this->getpageCtrl(); if(class_exists('\App\Fra...
/* GET PATH
entailment
public function requireModels($file=''){ //$d = PATH_ROOT.$this->getApplicationPath().'/'.$this->getEnvironmentStatus().'/models'.($file!=''?'/'.$file:''); $d = PATH_ROOT.'/app/'.$this->getEnvironmentStatus().'/models'.($file!=''?'/'.$file:''); if(file_exists($d) && is_file($d)){ require_once $d; } }
GETTERS AND SETTERES
entailment
public function make($file, $content, $recursive = false) { if ($this->exists($this->getPath($file))) { throw new FileAlreadyExists; } $this->put($file, $content, 0, $recursive); }
Create file with provided content if not exists. @param $file @param $content @param bool $recursive @throws FileAlreadyExists
entailment
public function get($file) { $path = $this->getPath($file); if (! file_exists($path)) { throw new FileDoesNotExists; } return file_get_contents($path); }
Get file contents. @param $file @return string @throws FileDoesNotExists
entailment