_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q251500 | Generator.getPhone | validation | public function getPhone($state_code = null, $zip = null, $include_toll_free = false)
{
if (!empty($zip)) {
$areacodes = Zipcode::where('zip', $zip)->orderByRaw(Database::random())->first()->area_codes;
} else {
// Get a random state if state not provided
$state_code = !empty($state_code) ? $state_code : ... | php | {
"resource": ""
} |
q251501 | Generator.getIp | validation | public function getIp()
{
$parts = [];
for ($i=0; $i<4; $i++) {
$parts[] = $this->getInteger(0, 255);
}
return join('.', $parts);
} | php | {
"resource": ""
} |
q251502 | Generator.getEmail | validation | public function getEmail($person_name = null, $domain = null)
{
$username = $this->getUsername($person_name);
$domains = [];
$domains[] = !empty($domain) ? $domain : $this->getDomain();
$domains[] = 'gmail.com';
$domains[] = 'yahoo.com';
$domains[] = 'me.com';
$domains[] = 'msn.com';
$domains[] = 'h... | php | {
"resource": ""
} |
q251503 | Generator.getInternet | validation | public function getInternet($person_name = null, $company = null)
{
if (empty($person_name)) {
$person_name = $this->getFullName();
}
$internet = new Entities\Internet();
$internet->domain = $this->getDomain($company);
$internet->username = $this->getUserName($person_name);
$internet->email = $this->... | php | {
"resource": ""
} |
q251504 | Generator.getCreditCard | validation | public function getCreditCard($weighted = true)
{
// Get a random card type
if ($weighted) {
$weight[] = ['American Express', 1];
$weight[] = ['Discover', 2];
$weight[] = ['MasterCard', 10];
$weight[] = ['Visa', 10];
foreach ($weight as $w) {
$type = $w[0];
$count = $w[1];
for (... | php | {
"resource": ""
} |
q251505 | Generator.getBank | validation | public function getBank()
{
$bank_account = new Entities\BankAccount;
$bank_account->type = $this->fromArray(['Checking', 'Savings']);
$bank_account->name = $this->fromArray(['First National', 'Arvest', 'Regions', 'Metropolitan', 'Wells Fargo']);
$bank_account->account = $this->getInteger('1000', '9999999... | php | {
"resource": ""
} |
q251506 | Generator.getPerson | validation | public function getPerson($state_code = null)
{
$state_code = !empty($state_code) ? $state_code : $this->getState()->code;
$person = new Entities\Person;
$person->guid = $this->getGuid();
$person->unique_hash = $this->getUniqueHash();
$person->name = $this->getFullName(); // Returns an object with fir... | php | {
"resource": ""
} |
q251507 | Fill.setRotation | validation | public function setRotation($pValue)
{
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['rotation' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->rotation = $pValue;
}
... | php | {
"resource": ""
} |
q251508 | Fill.setEndColor | validation | public function setEndColor(Color $pValue)
{
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
if ($this->isSupervisor) {
$styleArray = $this->getEndColor()->getStyleArray(['argb' => $color-... | php | {
"resource": ""
} |
q251509 | MailingsService.createMailing | validation | function createMailing($name, $subject, $deprecatedParameter = false, $type = "regular")
{
$queryParameters = array(
'name' => urlencode($name),
'subject' => urlencode($subject),
'type' => urlencode($type),
);
return $this->post('mailings', "", $queryPara... | php | {
"resource": ""
} |
q251510 | MailingsService.setHTMLContent | validation | function setHTMLContent($mailingId, $html, $doImageGrabbing = true, $doLinkTracking = false)
{
$queryParameters = array(
'doImageGrabbing' => ($doImageGrabbing == TRUE) ? "true" : "false",
'doLinkTracking' => ($doLinkTracking == TRUE) ? "true" : "false"
);
return $thi... | php | {
"resource": ""
} |
q251511 | MailingsService.setReplyToAddress | validation | function setReplyToAddress($mailingId, $auto = true, $customEmail = null)
{
$queryParameters = array(
'auto' => ($auto == TRUE) ? "true" : "false",
'customEmail' => $customEmail
);
return $this->post('mailings/' . $mailingId . '/settings/replyto', null, $queryParamet... | php | {
"resource": ""
} |
q251512 | MailingsService.addAttachment | validation | function addAttachment($mailingId, $filename, $contentType, $contents) {
$queryParameters = array( 'filename' => $filename );
return $this->post("mailings/${mailingId}/attachments", $contents, $queryParameters, null, null, $contentType, strlen($contents));
} | php | {
"resource": ""
} |
q251513 | MailingsService.addCustomProperties | validation | function addCustomProperties($mailingId, $properties) {
$xml = new SimpleXMLElement("<?xml version=\"1.0\"?><properties></properties>");
if (is_array($properties)) {
foreach ($properties as $property) {
$this->sxml_append($xml, $property->toXML());
}
} e... | php | {
"resource": ""
} |
q251514 | MailingsService.updateCustomProperty | validation | function updateCustomProperty($mailingId, $property) {
$queryParameters = array(
'name' => $property->key,
'value' => $property->value
);
return $this->put("mailings/${mailingId}/settings/properties", "", $queryParameters);
} | php | {
"resource": ""
} |
q251515 | Protection.setLocked | validation | public function setLocked($pValue)
{
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['locked' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->locked = $pValue;
}
... | php | {
"resource": ""
} |
q251516 | Font.getTextWidthPixelsExact | validation | public static function getTextWidthPixelsExact($text, \PhpOffice\PhpSpreadsheet\Style\Font $font, $rotation = 0)
{
if (!function_exists('imagettfbbox')) {
throw new PhpSpreadsheetException('GD library needs to be enabled');
}
// font size should really be supplied in pixels in G... | php | {
"resource": ""
} |
q251517 | Font.getTextWidthPixelsApprox | validation | public static function getTextWidthPixelsApprox($columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font, $rotation = 0)
{
$fontName = $font->getName();
$fontSize = $font->getSize();
// Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size.
... | php | {
"resource": ""
} |
q251518 | Font.getDefaultRowHeightByFont | validation | public static function getDefaultRowHeightByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font)
{
switch ($font->getName()) {
case 'Arial':
switch ($font->getSize()) {
case 10:
// inspection of Arial 10 workbook says 12.75pt ~17px
... | php | {
"resource": ""
} |
q251519 | Styles.write | validation | public function write(Spreadsheet $spreadsheet = null)
{
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new XMLWrit... | php | {
"resource": ""
} |
q251520 | Coordinate.coordinateFromString | validation | public static function coordinateFromString($pCoordinateString)
{
if (preg_match('/^([$]?[A-Z]{1,3})([$]?\\d{1,7})$/', $pCoordinateString, $matches)) {
return [$matches[1], $matches[2]];
} elseif (self::coordinateIsRange($pCoordinateString)) {
throw new Exception('Cell coordi... | php | {
"resource": ""
} |
q251521 | Coordinate.absoluteReference | validation | public static function absoluteReference($pCoordinateString)
{
if (self::coordinateIsRange($pCoordinateString)) {
throw new Exception('Cell coordinate string can not be a range of cells');
}
// Split out any worksheet name from the reference
$worksheet = '';
$cel... | php | {
"resource": ""
} |
q251522 | Coordinate.absoluteCoordinate | validation | public static function absoluteCoordinate($pCoordinateString)
{
if (self::coordinateIsRange($pCoordinateString)) {
throw new Exception('Cell coordinate string can not be a range of cells');
}
// Split out any worksheet name from the coordinate
$worksheet = '';
$c... | php | {
"resource": ""
} |
q251523 | Coordinate.splitRange | validation | public static function splitRange($pRange)
{
// Ensure $pRange is a valid range
if (empty($pRange)) {
$pRange = self::DEFAULT_RANGE;
}
$exploded = explode(',', $pRange);
$counter = count($exploded);
for ($i = 0; $i < $counter; ++$i) {
$explode... | php | {
"resource": ""
} |
q251524 | Coordinate.buildRange | validation | public static function buildRange(array $pRange)
{
// Verify range
if (empty($pRange) || !is_array($pRange[0])) {
throw new Exception('Range does not contain any information');
}
// Build range
$imploded = [];
$counter = count($pRange);
for ($i = ... | php | {
"resource": ""
} |
q251525 | Coordinate.getRangeBoundaries | validation | public static function getRangeBoundaries($pRange)
{
// Ensure $pRange is a valid range
if (empty($pRange)) {
$pRange = self::DEFAULT_RANGE;
}
// Uppercase coordinate
$pRange = strtoupper($pRange);
// Extract range
if (strpos($pRange, ':') === fa... | php | {
"resource": ""
} |
q251526 | Coordinate.columnIndexFromString | validation | public static function columnIndexFromString($pString)
{
// Using a lookup cache adds a slight memory overhead, but boosts speed
// caching using a static within the method is faster than a class static,
// though it's additional memory overhead
static $indexCache = [];
... | php | {
"resource": ""
} |
q251527 | Coordinate.stringFromColumnIndex | validation | public static function stringFromColumnIndex($columnIndex)
{
static $indexCache = [];
if (!isset($indexCache[$columnIndex])) {
$indexValue = $columnIndex;
$base26 = null;
do {
$characterValue = ($indexValue % 26) ?: 26;
$indexValue... | php | {
"resource": ""
} |
q251528 | Executor.parseCrontab | validation | protected function parseCrontab( $crontab )
{
$lines = preg_split( '(\r\n|\r|\n)', $crontab );
$this->crontab = array();
foreach ( $lines as $line )
{
$line = trim( $line );
if ( !empty( $line ) &&
( $line[0] !== '#' ) &&
( $l... | php | {
"resource": ""
} |
q251529 | Executor.getJobsSince | validation | protected function getJobsSince( $time )
{
$now = time();
$jobs = array();
// Find rescheduled tasks
foreach ( $this->rescheduled as $scheduled => $cronjob )
{
if ( $scheduled <= $now )
{
$jobs[$scheduled][] = $cronjob;
... | php | {
"resource": ""
} |
q251530 | Executor.executeTasks | validation | protected function executeTasks( array $tasks )
{
foreach ( $tasks as $scheduled => $taskList )
{
foreach ( $taskList as $cronjob )
{
if ( ( $task = $this->taskFactory->factory( $cronjob->task, $scheduled, $this->logger ) ) !== false )
{
... | php | {
"resource": ""
} |
q251531 | Executor.storeLastRun | validation | protected function storeLastRun()
{
// Silence warnings, which might be caused by multiple possible
// failures. We handle and log them anyways.
if ( !@file_put_contents( $this->lockDir . '/lastRun', time() ) )
{
$this->logger->log(
'Failure storing last r... | php | {
"resource": ""
} |
q251532 | Executor.aquireLock | validation | protected function aquireLock()
{
$lockfile = $this->lockDir . '/lock';
// Silence call, since PHP will issue a warning when the file exists.
// But there is no other way to properly immediately create a lock file
// only if it does not exist yet.
$fp = @fopen( $lockfile, 'x'... | php | {
"resource": ""
} |
q251533 | Date.setDefaultTimezone | validation | public static function setDefaultTimezone($timeZone)
{
if ($timeZone = self::validateTimeZone($timeZone)) {
self::$defaultTimeZone = $timeZone;
return true;
}
return false;
} | php | {
"resource": ""
} |
q251534 | Date.validateTimeZone | validation | protected static function validateTimeZone($timeZone)
{
if (is_object($timeZone) && $timeZone instanceof DateTimeZone) {
return $timeZone;
} elseif (is_string($timeZone)) {
return new DateTimeZone($timeZone);
}
throw new \Exception('Invalid timezone');
} | php | {
"resource": ""
} |
q251535 | Date.excelToTimestamp | validation | public static function excelToTimestamp($excelTimestamp, $timeZone = null)
{
return (int) self::excelToDateTimeObject($excelTimestamp, $timeZone)
->format('U');
} | php | {
"resource": ""
} |
q251536 | Date.dayStringToNumber | validation | public static function dayStringToNumber($day)
{
$strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
if (is_numeric($strippedDayValue)) {
return (int) $strippedDayValue;
}
return $day;
} | php | {
"resource": ""
} |
q251537 | Chart.writeChart | validation | public function writeChart(\PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, $calculateCellValues = true)
{
$this->calculateCellValues = $calculateCellValues;
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWr... | php | {
"resource": ""
} |
q251538 | Chart.writeTitle | validation | private function writeTitle(XMLWriter $objWriter, Title $title = null)
{
if ($title === null) {
return;
}
$objWriter->startElement('c:title');
$objWriter->startElement('c:tx');
$objWriter->startElement('c:rich');
$objWriter->startElement('a:bodyPr');
... | php | {
"resource": ""
} |
q251539 | Chart.writeLegend | validation | private function writeLegend(XMLWriter $objWriter, Legend $legend = null)
{
if ($legend === null) {
return;
}
$objWriter->startElement('c:legend');
$objWriter->startElement('c:legendPos');
$objWriter->writeAttribute('val', $legend->getPosition());
$objWr... | php | {
"resource": ""
} |
q251540 | Chart.writeDataLabels | validation | private function writeDataLabels(XMLWriter $objWriter, Layout $chartLayout = null)
{
$objWriter->startElement('c:dLbls');
$objWriter->startElement('c:showLegendKey');
$showLegendKey = (empty($chartLayout)) ? 0 : $chartLayout->getShowLegendKey();
$objWriter->writeAttribute('val', ((e... | php | {
"resource": ""
} |
q251541 | Chart.writeBubbles | validation | private function writeBubbles($plotSeriesValues, $objWriter)
{
if ($plotSeriesValues === null) {
return;
}
$objWriter->startElement('c:bubbleSize');
$objWriter->startElement('c:numLit');
$objWriter->startElement('c:formatCode');
$objWriter->writeRawData(... | php | {
"resource": ""
} |
q251542 | Chart.writeLayout | validation | private function writeLayout(XMLWriter $objWriter, Layout $layout = null)
{
$objWriter->startElement('c:layout');
if ($layout !== null) {
$objWriter->startElement('c:manualLayout');
$layoutTarget = $layout->getLayoutTarget();
if ($layoutTarget !== null) {
... | php | {
"resource": ""
} |
q251543 | Chart.writePrintSettings | validation | private function writePrintSettings($objWriter)
{
$objWriter->startElement('c:printSettings');
$objWriter->startElement('c:headerFooter');
$objWriter->endElement();
$objWriter->startElement('c:pageMargins');
$objWriter->writeAttribute('footer', 0.3);
$objWriter->wri... | php | {
"resource": ""
} |
q251544 | BaseWriter.setUseDiskCaching | validation | public function setUseDiskCaching($pValue, $pDirectory = null)
{
$this->useDiskCaching = $pValue;
if ($pDirectory !== null) {
if (is_dir($pDirectory)) {
$this->diskCachingDirectory = $pDirectory;
} else {
throw new Exception("Directory does no... | php | {
"resource": ""
} |
q251545 | ResolvableFilesystem.resolve | validation | public function resolve($key)
{
if (!($this->getAdapter() instanceof ResolverInterface)) {
throw new \LogicException('This adapter can not resolve keys');
}
return $this->getAdapter()->resolve($key);
} | php | {
"resource": ""
} |
q251546 | Migrator.recursiveReplace | validation | private function recursiveReplace($path)
{
$patterns = [
'/*.md',
'/*.php',
'/*.phtml',
'/*.txt',
'/*.TXT',
];
$from = array_keys($this->getMapping());
$to = array_values($this->getMapping());
foreach ($patterns as... | php | {
"resource": ""
} |
q251547 | Axis.setLineStyleProperties | validation | public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
{
($line_width !== null) ? $this->lineStyleProperties['width'] = $this->... | php | {
"resource": ""
} |
q251548 | Axis.setGlowProperties | validation | public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this->setGlowSize($size)
->setGlowColor(
$color_value === null ? $this->glowProperties['color']['value'] : $color_value,
$color_alpha === null ? (int) $this->... | php | {
"resource": ""
} |
q251549 | Axis.setGlowSize | validation | private function setGlowSize($size)
{
if ($size !== null) {
$this->glowProperties['size'] = $this->getExcelPointsWidth($size);
}
return $this;
} | php | {
"resource": ""
} |
q251550 | ReportsService.getOpensCount | validation | function getOpensCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$formatFilter = null,
$socialNetworkFilter = null,
$deviceTypeFilter = null,
$excludeAnonym... | php | {
"resource": ""
} |
q251551 | ReportsService.getUniqueOpensCount | validation | function getUniqueOpensCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$excludeAnonymousOpens = false)
{
$params = $this->createCountQueryParameters($fromDate, $toDate... | php | {
"resource": ""
} |
q251552 | ReportsService.getRecipients | validation | function getRecipients(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$excludeDeletedRecipients = false,
$standardFields = null,
$customFields = null,
$embedFiel... | php | {
"resource": ""
} |
q251553 | ReportsService.getRecipientsCount | validation | function getRecipientsCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$excludeDeletedRecipients = false)
{
$params = $this->createCountQueryParameters($fromDate, $toDa... | php | {
"resource": ""
} |
q251554 | ReportsService.getClicks | validation | function getClicks(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$formatFilter = null,
$linkIdFilter = null,
$linkUrlFilter = null,
$linkTagFilter = null,
... | php | {
"resource": ""
} |
q251555 | ReportsService.getClicksCount | validation | function getClicksCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$formatFilter = null,
$linkIdFilter = null,
$linkUrlFilter = null,
$linkTagFilter = null,
... | php | {
"resource": ""
} |
q251556 | ReportsService.getUniqueClicksCount | validation | function getUniqueClicksCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$excludeAnonymousClicks = false)
{
$params = $this->createCountQueryParameters($fromDate, $toD... | php | {
"resource": ""
} |
q251557 | ReportsService.getBouncesCount | validation | function getBouncesCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$statusCodeFilter = null,
$typeFilter = null,
$sourceFilter = null,
$excludeAnonymousBoun... | php | {
"resource": ""
} |
q251558 | ReportsService.getUniqueBouncesCount | validation | function getUniqueBouncesCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$excludeAnonymousBounces = false)
{
$params = $this->createCountQueryParameters($fromDate, $to... | php | {
"resource": ""
} |
q251559 | ReportsService.getBlocks | validation | function getBlocks(
$fromDate = null,
$toDate = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$reasons = null,
$oldStatus = null,
$newStatus = null,
$excludeAnonymousBlocks = false,
$standardFields = null,
... | php | {
"resource": ""
} |
q251560 | ReportsService.getBlocksCount | validation | function getBlocksCount(
$fromDate = null,
$toDate = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$reasons = null,
$oldStatus = null,
$newStatus = null,
$excludeAnonymousBlocks = false)
{
$params = $this... | php | {
"resource": ""
} |
q251561 | ReportsService.getUnsubscribers | validation | function getUnsubscribers(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$source = null,
$embedFieldBackups = false,
$pageIndex = 1,
$pageSize = 100)
{
... | php | {
"resource": ""
} |
q251562 | ReportsService.getUnsubscribersCount | validation | function getUnsubscribersCount(
$fromDate = null,
$toDate = null,
$mailingIds = null,
$contactIds = null,
$contactEmails = null,
$contactExternalIds = null,
$source = null)
{
$params = $this->createCountQueryParameters($fromDate, $toDate, $contactIds, ... | php | {
"resource": ""
} |
q251563 | ReportsService.getSubscribersCount | validation | function getSubscribersCount($fromDate = null, $toDate = null, $mailingIds = array(), $contactIds = array(), $contactEmails = array(), $contactExternalIds = array(), $excludeAnonymousContacts = false)
{
$params = $this->createCountQueryParameters($fromDate, $toDate, $contactIds, $contactEmails, $contactExte... | php | {
"resource": ""
} |
q251564 | ReportsService.createQueryParameters | validation | private function createQueryParameters($pageIndex, $pageSize, $fromDate, $toDate, $contactIds, $contactEmails, $contactExternalIds, $mailingIds, $source, $embedFieldBackups)
{
$queryParameters = array(
'page_index' => $pageIndex,
'page_size' => $pageSize
);
if (isset... | php | {
"resource": ""
} |
q251565 | ReportsService.createCountQueryParameters | validation | private function createCountQueryParameters($fromDate, $toDate, $contactIds, $contactEmails, $contactExternalIds, $mailingIds, $source)
{
$queryParameters = array();
if (isset ($fromDate))
$queryParameters ['from_date'] = $fromDate;
if (isset ($toDate))
$queryParamet... | php | {
"resource": ""
} |
q251566 | Db.setOptions | validation | protected function setOptions(array $options) {
if (!array_key_exists('adapter', $options) || !array_key_exists('table', $options) || !array_key_exists('column_key', $options) || !array_key_exists('column_value', $options)) {
throw new Exception\InvalidArgumentException('Db adapter options must be d... | php | {
"resource": ""
} |
q251567 | ContactFilter.addRule | validation | function addRule($rule)
{
if (!$this->rules) $this->rules = array();
array_push($this->rules, $rule);
} | php | {
"resource": ""
} |
q251568 | ContactFilter.fromXML | validation | function fromXML($xmlElement)
{
$this->author = $xmlElement->author;
$this->countContacts = $xmlElement->count_contacts;
$this->countRules = $xmlElement->count_rules;
$this->created = $xmlElement->created;
$this->id = $xmlElement->id;
$this->name = $xmlElement-... | php | {
"resource": ""
} |
q251569 | SpContainer.getNestingLevel | validation | public function getNestingLevel()
{
$nestingLevel = 0;
$parent = $this->getParent();
while ($parent instanceof SpgrContainer) {
++$nestingLevel;
$parent = $parent->getParent();
}
return $nestingLevel;
} | php | {
"resource": ""
} |
q251570 | Image.set_images | validation | public function set_images( $post_id, $post, $update ) {
App::setCurrentID( 'EFG' );
if ( Module::CustomImagesGrifus()->getOption( 'replace-when-add' ) ) {
$is_insert_post = App::main()->is_after_insert_post( $post, $update );
$is_update_post = App::main()->is_after_update_post( $post, $update );
if ( $i... | php | {
"resource": ""
} |
q251571 | Image.replace_when_add | validation | public function replace_when_add() {
$state = isset( $_POST['state'] ) ? $_POST['state'] : null;
$nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';
if ( ! wp_verify_nonce( $nonce, 'eliasis' ) && ! wp_verify_nonce( $nonce, 'customImagesGrifusAdmin' ) ) {
die( 'Busted!' );
}
App::setCurrentID( 'EFG... | php | {
"resource": ""
} |
q251572 | VideoEmbed.load | validation | public function load($url)
{
if (!is_string($url)) {
throw new \InvalidArgumentException('The url argument must be of type string');
}
$this->url = $url;
// Converts PHP errors and warnings to Exceptions
set_error_handler(function() {
throw new \Excep... | php | {
"resource": ""
} |
q251573 | VideoEmbed.setSize | validation | public function setSize($width, $height)
{
if (!is_string($width) && !is_int($width)) {
throw new \InvalidArgumentException('The width argument must be of type string or integer');
}
if (!is_string($height) && !is_int($height)) {
throw new \InvalidArgumentException('T... | php | {
"resource": ""
} |
q251574 | ReportContact.fromXML | validation | function fromXML($xmlElement)
{
parent::fromXML($xmlElement);
if (isset($xmlElement->permissionType)) $this->permission = Permission::getPermission($xmlElement->permissionType);
if (isset($xmlElement->field_backups)) $this->fieldBackups = XMLDeserializer::deserialize($xmlElement->field... | php | {
"resource": ""
} |
q251575 | Font.setName | validation | public function setName($pValue)
{
if ($pValue == '') {
$pValue = 'Calibri';
}
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['name' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
... | php | {
"resource": ""
} |
q251576 | Font.setSuperscript | validation | public function setSuperscript($pValue)
{
if ($pValue == '') {
$pValue = false;
}
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['superscript' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($style... | php | {
"resource": ""
} |
q251577 | Xls.getDistanceY | validation | public static function getDistanceY(Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
{
$distanceY = 0;
// add the widths of the spanning rows
for ($row = $startRow; $row <= $endRow; ++$row) {
$distanceY += self::sizeRow($sheet, $row);
}
... | php | {
"resource": ""
} |
q251578 | Xls.oneAnchor2twoAnchor | validation | public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height)
{
list($column, $row) = Coordinate::coordinateFromString($coordinates);
$col_start = Coordinate::columnIndexFromString($column);
$row_start = $row - 1;
$x1 = $offsetX;
$y1 =... | php | {
"resource": ""
} |
q251579 | CustomProperty.toXML | validation | function toXML() {
$xml = new SimpleXMLElement("<?xml version=\"1.0\"?><property></property>");
$xml->addChild("key", $this->key);
$xml->addChild("value", $this->value);
return $xml;
} | php | {
"resource": ""
} |
q251580 | DataType.checkString | validation | public static function checkString($pValue)
{
if ($pValue instanceof RichText) {
// TODO: Sanitize Rich-Text string (max. character count is 32,767)
return $pValue;
}
// string must never be longer than 32,767 characters, truncate if necessary
$pValue = Strin... | php | {
"resource": ""
} |
q251581 | DataType.checkErrorCode | validation | public static function checkErrorCode($pValue)
{
$pValue = (string) $pValue;
if (!isset(self::$errorCodes[$pValue])) {
$pValue = '#NULL!';
}
return $pValue;
} | php | {
"resource": ""
} |
q251582 | CronjobIterator.validateColumns | validation | protected function validateColumns( $columns )
{
$patterns = array(
'((?P<minute>(?:\*|(?:(?:[0-9]|[1-5][0-9])(?:-(?:[0-9]|[1-5][0-9]))?)(?:,(?:[0-9]|[1-5][0-9])(?:-(?:[0-9]|[1-5][0-9]))?)*)(?:/(?:[1-9]|[1-5][0-9]))?)$)AD',
'((?P<hour>(?:\*|(?:(?:[0-9]|1[0-9]|2[0-3])(?:-(?:[0-9]|1[0-... | php | {
"resource": ""
} |
q251583 | CronjobIterator.isValidDate | validation | protected function isValidDate( $year, $month, $day )
{
// Some basic sanity checking
if ( $month <= 0 || $month > 12 || $day <= 0 || $day > 31 )
{
return false;
}
// Check for months with 30 days
if ( ( $month == 4 || $month == 6 || $month == 9 || $mon... | php | {
"resource": ""
} |
q251584 | CronjobIterator.extractRange | validation | protected function extractRange( $definition, $min = null, $max=null )
{
$resultSet = array();
if ( substr( $definition, 0, 1 ) === '*' )
{
// We need ranges otherwise a full set can not be created
if ( $min === null || $max === null )
{
r... | php | {
"resource": ""
} |
q251585 | CronjobIterator.extractStep | validation | protected function extractStep( $definition )
{
if ( ( $position = strpos( $definition, '/' ) ) !== false )
{
return (int)substr( $definition, $position + 1 );
}
return false;
} | php | {
"resource": ""
} |
q251586 | CronjobIterator.applyStepping | validation | protected function applyStepping( $range, $step )
{
if ( $step === false || $step === 1 )
{
return $range;
}
foreach ( $range as $value => $tmp )
{
if ( ( $value % $step ) !== 0 )
{
unset( $range[$value] );
}
... | php | {
"resource": ""
} |
q251587 | CronjobIterator.getNextFutureTimestamp | validation | protected function getNextFutureTimestamp()
{
/*
* To save time in pregeneration we use the array traversal functions
* here to create iteratively accessed foreach loops on monthAndDays,
* hours and minutes
*/
// These values are only used if we are inside the curren... | php | {
"resource": ""
} |
q251588 | CronjobIterator.current | validation | public function current()
{
$minute = current( $this->minutes );
$hour = current( $this->hours );
$monthAndDay = current( $this->monthAndDays );
$currentElement = strtotime(
sprintf(
'%d-%s %02d:%02d:00',
$this->year + $this->y... | php | {
"resource": ""
} |
q251589 | CronjobIterator.rewind | validation | public function rewind()
{
/*
* If we changed the years already we need to recalculate the data for
* the first one
*/
if ( $this->yearOffset !== 0 )
{
$this->generateTimetable( 0 );
}
else
{
// Just reset the current... | php | {
"resource": ""
} |
q251590 | Response.validateArgSet | validation | public function validateArgSet($set)
{
if (isset($set)) {
foreach ($set as $arg) {
if (!isset($this->{$arg})) {
throw new \Exception('Response not valid: ' . $arg . ' has not been set!');
}
}
}
} | php | {
"resource": ""
} |
q251591 | Response.validate | validation | protected function validate()
{
$this->validateArgSet($this->args);
if ($this->success) {
$this->validateArgSet($this->successArgs);
}
if (!$this->success) {
$this->validateArgSet($this->failureArgs);
}
} | php | {
"resource": ""
} |
q251592 | Stk2kEventStreamAdapter.channel | validation | public function channel(string $channel_id) : EventChannelInterface
{
if (isset($this->channel_adapters[$channel_id])){
return $this->channel_adapters[$channel_id];
}
$adapter = new Stk2kEventChannelAdapter(
$this->eventstream->channel(
$channel_id,
... | php | {
"resource": ""
} |
q251593 | Throttle.getSourceByJob | validation | private function getSourceByJob($job)
{
$login = head(array_except($job->credentials, 'password'));
return $login . app('request')->ip();
} | php | {
"resource": ""
} |
q251594 | AbstractEventDispatcherPipe.fireEventOn | validation | private function fireEventOn($action, $payload)
{
$event = $this->getEventName();
$this->dispatcher->fire("auth.{$event}.{$action}", $payload);
} | php | {
"resource": ""
} |
q251595 | AbstractEventDispatcherPipe.getEventName | validation | protected function getEventName()
{
$chunks = explode('\\', get_class($this));
$name = $chunks[count($chunks) - 2];
return strtolower($name);
} | php | {
"resource": ""
} |
q251596 | CachingThrottler.incrementAttempts | validation | public function incrementAttempts()
{
$this->cache->add($this->key, 0, $this->getExpiry());
$this->cache->increment($this->key);
} | php | {
"resource": ""
} |
q251597 | CachingThrottler.lockOut | validation | public function lockOut()
{
$this->resetAttempts();
$this->cache->add($this->lockOutKey, $this->getDelay() + time(), $this->getExpiry());
} | php | {
"resource": ""
} |
q251598 | ErrorHandler.highlightCode | validation | protected static function highlightCode(string $file, int $line, int $padding = 6) : array
{
if ( ! is_readable($file)) {
return false;
}
$handle = fopen($file, 'r');
$lines = array();
$currentLine = 0;
while ( ! feof($handle)) {
$... | php | {
"resource": ""
} |
q251599 | ErrorHandler.error | validation | public static function error(int $code, string $message, string $file, int $line) : bool
{
// If isset error_reporting and $code then throw new error exception
if ((error_reporting() & $code) !== 0) {
/**
* Dont thow NOTICE exception for PRODUCTION Environment. Just write t... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.