_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q4200 | CNabuXMLSiteTargetSectionLanguageBase.setAttributes | train | protected function setAttributes(SimpleXMLElement $element)
{
$nb_parent = $this->nb_data_object->getTranslatedObject();
if ($nb_parent !== null) {
$nb_language = $nb_parent->getLanguage($this->nb_data_object->getLanguageId());
$element->addAttribute('lang', $nb_language->grantHash(true));
| php | {
"resource": ""
} |
q4201 | TNabuDataObjectTreeNode.addChild | train | public function addChild(INabuDataObjectTreeNode $child)
{
$retval = $this->nb_tree_child_list->addItem($child);
| php | {
"resource": ""
} |
q4202 | TNabuDataObjectTreeNode.setChild | train | public function setChild(INabuDataObjectTreeNode $child)
{
$this->nb_tree_child_list->setItem($child);
| php | {
"resource": ""
} |
q4203 | TNabuDataObjectTreeNode.setParent | train | public function setParent(INabuDataObjectTreeNode $parent)
{
$this->nb_tree_parent = $parent;
if ($parent instanceof CNabuDataObject &&
method_exists($parent, 'getId') &&
$this instanceof CNabuDataObject &&
| php | {
"resource": ""
} |
q4204 | CNabuHTTPSession.init | train | private function init()
{
$nb_engine = CNabuEngine::getEngine();
$session_name = session_name();
$nb_engine->traceLog("Session Name", $session_name);
if (array_key_exists($session_name, $_GET)) {
$sessid = filter_input(INPUT_GET, $session_name);
if (preg_match('/^[a-zA-Z0-9]{26}$/', $sessid)) {
session_id($sessid);
| php | {
"resource": ""
} |
q4205 | CNabuHTTPSession.applySecurityRules | train | public function applySecurityRules(bool $secure = false, bool $httponly = false)
{
$nb_engine = CNabuEngine::getEngine();
$attrs = session_get_cookie_params();
session_set_cookie_params(
$attrs['lifetime'],
$attrs['path'],
$attrs['domain'],
$secure || $attrs['secure'],
| php | {
"resource": ""
} |
q4206 | CNabuHTTPSession.purgeNonce | train | public function purgeNonce()
{
$nonce_list = $this->getVariable('nonce_list', array());
$new_nonce_list = array();
if (count($nonce_list) > 0) {
$stop_nonce = time() - 1800;
foreach ($nonce_list as $key => $word) {
if (count($word) > 0) {
$this->purgeNonceWord($key, $word, $stop_nonce, $new_nonce_list);
}
| php | {
"resource": ""
} |
q4207 | CNabuHTTPSession.purgeNonceWord | train | private function purgeNonceWord(string $key, array $word, int $stop_nonce, array &$new_nonce_list)
{
foreach ($word as $nonce) {
if ($nonce['time'] >= $stop_nonce) {
if (!array_key_exists($key, $new_nonce_list)) {
| php | {
"resource": ""
} |
q4208 | CNabuHTTPSession.unsetVariable | train | public function unsetVariable($name)
{
$retval = false;
if (array_key_exists($name, $_SESSION)) | php | {
"resource": ""
} |
q4209 | CNabuHTTPSession.setCookie | train | public function setCookie($name, $value, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false) {
if ($expires !== null) {
setcookie($name, $value, time() | php | {
"resource": ""
} |
q4210 | EntityValidator.validateEmbeddedClass | train | public function validateEmbeddedClass($class, $classAnnotations)
{
$check = false;
foreach ($classAnnotations as $annotation) {
if ($annotation instanceof \ProAI\Datamapper\Annotations\Embeddable) {
$check = true;
}
| php | {
"resource": ""
} |
q4211 | EntityValidator.validateName | train | public function validateName($name, $definedClass)
{
if ($name != camel_case($name)) {
| php | {
"resource": ""
} |
q4212 | EntityValidator.validatePrimaryKey | train | public function validatePrimaryKey(EntityDefinition $entityMetadata)
{
// check if all tables have exactly one primary key
$countPrimaryKeys = 0;
foreach ($entityMetadata['table']['columns'] as $column) {
if (! empty($column['primary'])) {
$countPrimaryKeys++;
}
}
if ($countPrimaryKeys == 0) {
throw new DomainException('No primary key defined in | php | {
"resource": ""
} |
q4213 | EntityValidator.validateTimestamps | train | public function validateTimestamps(EntityDefinition $entityMetadata)
{
$columnNames = [];
// get column names
foreach ($entityMetadata['table']['columns'] as $column) {
$columnNames[] = $column['name'];
}
// get version column names
if (! empty($entityMetadata['versionTable'])) {
| php | {
"resource": ""
} |
q4214 | EntityValidator.validateVersionTable | train | public function validateVersionTable(EntityDefinition $entityMetadata)
{
$columnNames = [];
$countPrimaryKeys = 0;
$versionPrimaryKey = false;
// get column names
foreach ($entityMetadata['table']['columns'] as $column) {
$columnNames[] = $column['name'];
}
if (! in_array('latest_version', $columnNames)) {
throw new DomainException('@Versionable annotation defined in class ' . $entityMetadata['class'] . ' requires a $latestVersion column property.');
}
$columnNames = [];
// get version column names
foreach ($entityMetadata['versionTable']['columns'] as $column) {
$columnNames[] = $column['name'];
if (! empty($column['primary'])) {
$countPrimaryKeys++;
}
if (! empty($column['primary']) && $column['name'] == 'version') {
$versionPrimaryKey = true;
}
| php | {
"resource": ""
} |
q4215 | EntityValidator.validatePivotTables | train | public function validatePivotTables($metadata)
{
$pivotTables = [];
foreach ($metadata as $entityMetadata) {
foreach ($entityMetadata['relations'] as $relationMetadata) {
if (! empty($relationMetadata['pivotTable'])) {
$pivotTables[$entityMetadata['class'].$relationMetadata['relatedEntity']] = $relationMetadata;
if (isset($pivotTables[$relationMetadata['relatedEntity'].$entityMetadata['class']])) {
$relation1 = $pivotTables[$relationMetadata['relatedEntity'].$entityMetadata['class']];
$relation2 = $relationMetadata;
$error = null;
// check name
if ($relation1['pivotTable']['name'] != $relation2['pivotTable']['name']) {
$error = 'Different table names (compared '.$relation1['pivotTable']['name'].' with '.$relation2['pivotTable']['name'].').';
}
// check name
if (! empty(array_diff_key($relation1['pivotTable']['columns'], $relation2['pivotTable']['columns']))) {
| php | {
"resource": ""
} |
q4216 | CNabuMediotecaItemLanguageBase.setMediotecaItemId | train | public function setMediotecaItemId(int $nb_medioteca_item_id) : CNabuDataObject
{
if ($nb_medioteca_item_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4217 | CNabuMediotecaItemLanguageBase.setHavePublic | train | public function setHavePublic($have_public) : CNabuDataObject
{
if ($have_public === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$have_public")
| php | {
"resource": ""
} |
q4218 | CNabuProviderInterfaceFactoryAdapter.discoverInterface | train | protected function discoverInterface() : bool
{
if (!($this->nb_interface instanceof INabuProviderInterface) &&
($nb_manager = $this->nb_descriptor->getManager()) instanceof INabuProviderManager
) {
| php | {
"resource": ""
} |
q4219 | CNabuProviderInterfaceFactoryAdapter.setRequest | train | public function setRequest(CNabuHTTPRequest $nb_request) : CNabuProviderInterfaceFactoryAdapter
{
if ($this->discoverInterface()) {
$this->nb_interface->setRequest($nb_request);
} else {
| php | {
"resource": ""
} |
q4220 | CNabuProviderInterfaceFactoryAdapter.setResponse | train | public function setResponse(CNabuHTTPResponse $nb_response = null) : CNabuProviderInterfaceFactoryAdapter
{
if ($this->discoverInterface()) {
$this->nb_interface->setResponse($nb_response);
} else {
| php | {
"resource": ""
} |
q4221 | CNabuXMLObject.collect | train | public function collect(SimpleXMLElement $element)
{
if ($element->getName() === get_called_class()::getTagName() && $this->locateDataObject($element)) {
$this->getAttributes($element);
$this->getChilds($element);
} | php | {
"resource": ""
} |
q4222 | NonDB.driver | train | public static function driver(string $name){
//Get the name.
$name = explode(':', $name);
//Get the classname.
$class = "\\NonDB\\Drivers\\" . $name[0];
//Get the parameter.
$param = $name[1];
//See if the driver exists.
if(!class_exists($class) || !( \NonDB\Components\Tool::checkImplement($class, "NonDB\\Interfaces\\Driver") )){
| php | {
"resource": ""
} |
q4223 | CNabuXMLDataObject.getAttributesFromList | train | protected function getAttributesFromList(
SimpleXMLElement $element,
array $attributes,
bool $ignore_empty = false
) : int {
$count = 0;
if (count($attributes) > 0) {
foreach ($attributes as $field => $attr) {
if (isset($element[$attr])) {
$value = (string)$element[$attr];
if ($ignore_empty || strlen($value) > 0) {
| php | {
"resource": ""
} |
q4224 | CNabuXMLDataObject.putAttributesFromList | train | protected function putAttributesFromList(
SimpleXMLElement $element,
array $attributes,
bool $ignore_empty = false
) : int {
$count = 0;
if (count($attributes) > 0) {
foreach ($attributes as $field => $attr) {
if ($this->nb_data_object->contains($field) &&
(!$ignore_empty ||
!$this->nb_data_object->isValueNull($field) ||
!$this->nb_data_object->isValueEmptyString($field)
| php | {
"resource": ""
} |
q4225 | CNabuXMLDataObject.putChildsAsCDATAFromList | train | protected function putChildsAsCDATAFromList(
SimpleXMLElement $element,
array $childs,
bool $ignore_empty = false
) : int {
$count = 0;
if (count($childs) > 0) {
foreach ($childs as $field => $child) {
if ($this->nb_data_object->contains($field) &&
(!$ignore_empty ||
!$this->nb_data_object->isValueNull($field) ||
!$this->nb_data_object->isValueEmptyString($field)
| php | {
"resource": ""
} |
q4226 | PatchService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->types()
| php | {
"resource": ""
} |
q4227 | PatchService.getById | train | public function getById($patchId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
| php | {
"resource": ""
} |
q4228 | LanguageHydrator.hydrateCollection | train | public static function hydrateCollection(array $languages)
{
$hydrated = [];
foreach ($languages as $language) {
| php | {
"resource": ""
} |
q4229 | LanguageHydrator.hydrate | train | public static function hydrate(stdClass $language)
{
$hydrated = new LanguageEntity();
if (isset($language->id)) {
$hydrated->setId($language->id);
}
if (isset($language->name)) {
$hydrated->setName($language->name);
}
if (isset($language->file_extensions)) {
$hydrated->setFileExtensions($language->file_extensions); | php | {
"resource": ""
} |
q4230 | TNabuRoleChild.getRole | train | public function getRole($force = false)
{
if ($this->nb_role === null || $force) {
$this->nb_role = null;
if ($this->isValueNumeric('nb_role_id')) {
$nb_role = new CNabuRole($this);
| php | {
"resource": ""
} |
q4231 | TNabuRoleChild.setRole | train | public function setRole(CNabuRole $nb_role)
{
$this->nb_role = $nb_role;
if ($this | php | {
"resource": ""
} |
q4232 | Migrate.postPackageInstall | train | public static function postPackageInstall(PackageEvent $event){
$installedPackage = $event->getOperation()->getPackage()->getName();
if (self::checkConfig($event, $installedPackage)) {
| php | {
"resource": ""
} |
q4233 | Migrate.postPackageUpdate | train | public static function postPackageUpdate(PackageEvent $event){
$installedPackage = $event->getOperation()->getTargetPackage()->getName();
if (self::checkConfig($event, $installedPackage)) {
| php | {
"resource": ""
} |
q4234 | Migrate.prePackageUninstall | train | public static function prePackageUninstall(PackageEvent $event){
$installedPackage = $event->getOperation()->getPackage()->getName();
if (self::checkConfig($event, $installedPackage)) {
| php | {
"resource": ""
} |
q4235 | AbstractViewCompiler.replaceBreadcrumb | train | protected function replaceBreadcrumb($modelName, $modelLabel)
{
$this->stub = str_replace('{{breadcrumb}}', ucfirst(strtolower($modelLabel)), $this->stub);
| php | {
"resource": ""
} |
q4236 | Definition.offsetSet | train | public function offsetSet($key, $newval)
{
if ($def = in_array($key, array_keys($this->keys))) {
parent::offsetSet($key, $newval);
} else {
| php | {
"resource": ""
} |
q4237 | Guard.authenticate | train | public function authenticate(Request $request, Route $route)
{
if (! $user = $this->auth->user()) {
throw new UnauthorizedHttpException(
get_class($this),
'Unable | php | {
"resource": ""
} |
q4238 | OrgHydrator.hydrateCollection | train | public static function hydrateCollection(array $organizations)
{
$hydrated = [];
foreach ($organizations as $organization) {
| php | {
"resource": ""
} |
q4239 | OrgHydrator.hydrate | train | public static function hydrate(stdClass $organization)
{
$hydrated = new OrgEntity();
if (isset($organization->id)) {
$hydrated->setId($organization->id);
}
if (isset($organization->name)) {
$hydrated->setName($organization->name);
}
if (isset($organization->valid_until)) {
$hydrated->setValidUntil(new DateTime($organization->valid_until));
}
if (isset($organization->quotas) && is_array($organization->quotas)) {
$hydrated->setQuotas(QuotaHydrator::hydrateCollection($organization->quotas)); | php | {
"resource": ""
} |
q4240 | CNabuHTTPStandaloneApplication.enableLanguage | train | public function enableLanguage($ISO639_1, $name, $default_country_code, $default_lang = false)
{
$nb_language = new CNabuBuiltInLanguage();
$nb_language->setISO6391($ISO639_1)
->setName($name)
->setDefaultCountryCode($default_country_code)
->setEnabled(CNabuLanguage::LANGUAGE_ENABLED)
| php | {
"resource": ""
} |
q4241 | CNabuHTTPStandaloneApplication.addSmartyTarget | train | public function addSmartyTarget($display, $content, $default = false)
{
$target = new CNabuBuiltInSiteTarget();
$target->setMIMETypeId('text/html')
->setOutputTypeHTML()
->setSmartyDisplayFile($display)
| php | {
"resource": ""
} |
q4242 | CNabuHTTPStandaloneApplication.addTarget | train | protected function addTarget(CNabuSiteTarget $nb_site_target, $default = false)
{
$nb_site = $this->nb_engine->getHTTPServer()->getSite();
| php | {
"resource": ""
} |
q4243 | CNabuHTTPStandaloneApplication.setLoginTarget | train | public function setLoginTarget(CNabuSiteTarget $nb_site_target)
{
$nb_site = $this->nb_engine->getHTTPServer()->getSite();
if ($nb_site instanceof CNabuSite) {
return $nb_site->setLoginTarget($nb_site_target);
| php | {
"resource": ""
} |
q4244 | CNabuHTTPStandaloneApplication.addRootSiteMapForURL | train | public function addRootSiteMapForURL($order, CNabuRole $nb_role = null)
{
if ($nb_role === null) {
$nb_role = $this->nb_engine->getHTTPServer()->getSite()->getDefaultRole();
}
| php | {
"resource": ""
} |
q4245 | CNabuHTTPStandaloneApplication.addRootSiteMapForTarget | train | public function addRootSiteMapForTarget(CNabuSiteTarget $nb_site_target, $order, CNabuRole $nb_role = null)
{
if ($nb_role === null) {
$nb_role = $this->nb_engine->getHTTPServer()->getSite()->getDefaultRole();
}
| php | {
"resource": ""
} |
q4246 | CNabuHTTPStandaloneApplication.addRootSiteMap | train | public function addRootSiteMap(CNabuSiteMap $nb_site_map)
{
$nb_site = $this->nb_engine->getHTTPServer()->getSite();
if ($nb_site instanceof CNabuSite) {
return $nb_site->addSiteMap($nb_site_map);
| php | {
"resource": ""
} |
q4247 | CNabuHTTPStandaloneApplication.newMedioteca | train | public function newMedioteca($key)
{
$nb_medioteca = new CNabuBuiltInMedioteca();
$nb_medioteca->setKey($key); | php | {
"resource": ""
} |
q4248 | Model.getPrimaryKey | train | public function getPrimaryKey() {
if ($this->primaryKey === null) {
$schema = $this->getSchema();
$pk = [];
foreach ($schema->getSchemaArray()['properties'] as $column => $property) {
if (!empty($property['primary'])) {
| php | {
"resource": ""
} |
q4249 | Model.mapID | train | protected function mapID($id) {
$idArray = (array)$id;
$result = [];
foreach ($this->getPrimaryKey() as $i => $column) {
if (isset($idArray[$i])) {
$result[$column] = $idArray[$i];
} elseif (isset($idArray[$column])) { | php | {
"resource": ""
} |
q4250 | Model.getSchema | train | final public function getSchema() {
if ($this->schema === null) { | php | {
"resource": ""
} |
q4251 | Model.fetchSchema | train | protected function fetchSchema() {
$columns = $this->getDb()->fetchColumnDefs($this->name);
if ($columns === null) {
throw new \InvalidArgumentException("Cannot fetch schema foor {$this->name}.");
}
$schema = [
'type' => 'object',
'dbtype' => 'table',
'properties' => $columns
| php | {
"resource": ""
} |
q4252 | Model.requiredFields | train | private function requiredFields(array $columns) {
$required = [];
foreach ($columns as $name => $column) {
if (empty($column['autoIncrement']) && !isset($column['default']) && | php | {
"resource": ""
} |
q4253 | Model.get | train | public function get(array $where) {
$options = [
Db::OPTION_FETCH_MODE => $this->getFetchArgs(),
'rowCallback' => [$this, 'unserialize']
| php | {
"resource": ""
} |
q4254 | Model.query | train | public function query(array $where, array $options = []) {
$options += [
'order' => $this->getDefaultOrder(),
'limit' => $this->getDefaultLimit(),
| php | {
"resource": ""
} |
q4255 | Model.updateID | train | public function updateID($id, array $set): int {
$r = $this->update($set, | php | {
"resource": ""
} |
q4256 | Model.validate | train | public function validate($row, $sparse = false) {
$schema = $this->getSchema();
$valid | php | {
"resource": ""
} |
q4257 | Settings.index | train | public function index()
{
if (!userHasPermission('admin:captcha:settings:*')) {
unauthorised();
}
$oDb = Factory::service('Database');
$oInput = Factory::service('Input');
$oCaptchaDriverService = Factory::service('CaptchaDriver', 'nails/module-captcha');
if ($oInput->post()) {
// Settings keys
$sKeyCaptchaDriver = $oCaptchaDriverService->getSettingKey();
// Validation
$oFormValidation = Factory::service('FormValidation');
$oFormValidation->set_rules($sKeyCaptchaDriver, '', 'required');
if ($oFormValidation->run()) {
try {
$oDb->trans_begin();
// Drivers
$oCaptchaDriverService->saveEnabled($oInput->post($sKeyCaptchaDriver));
$oDb->trans_commit();
$this->data['success'] = 'Captcha settings were saved.';
| php | {
"resource": ""
} |
q4258 | MfaQuestion.askQuestion | train | protected function askQuestion()
{
// Ask away cap'n!
$this->data['page']->title = lang('auth_twofactor_answer_title');
$this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/mfa/question/ask.php');
Factory::service('View')
->load([
| php | {
"resource": ""
} |
q4259 | Attachment.isPresentable | train | public function isPresentable($presenter = null)
{
if (is_bool($presenter)) { | php | {
"resource": ""
} |
q4260 | Attachment.setContainerObj | train | public function setContainerObj($obj)
{
if ($obj === null) {
$this->containerObj = null;
return $this;
}
if (!$obj instanceof AttachmentContainerInterface) {
throw new InvalidArgumentException(sprintf(
'Container object must be an instance of %s; received %s',
AttachmentContainerInterface::class,
(is_object($obj) ? get_class($obj) : gettype($obj))
));
}
| php | {
"resource": ""
} |
q4261 | Attachment.microType | train | public function microType()
{
$classname = get_called_class();
if (!isset(static::$resolvedType[$classname])) {
$reflect = new ReflectionClass($this);
| php | {
"resource": ""
} |
q4262 | Attachment.heading | train | public function heading()
{
$heading = $this->render((string)$this->heading);
if (!$heading) {
$heading = $this->translator()->translation('{{ objType }} #{{ id }}', [
| php | {
"resource": ""
} |
q4263 | Attachment.setDescription | train | public function setDescription($description)
{
$this->description = $this->translator()->translation($description);
if ($this->isPresentable()) {
foreach ($this->description->data() as $lang => $trans) {
| php | {
"resource": ""
} |
q4264 | Attachment.setFileSize | train | public function setFileSize($size)
{
if ($size === null) {
$this->fileSize = null;
return $this;
| php | {
"resource": ""
} |
q4265 | Attachment.preDelete | train | public function preDelete()
{
$attId = $this->id();
$joinProto = $this->modelFactory()->get(Join::class);
$loader = $this->collectionLoader();
$loader->setModel($joinProto);
| php | {
"resource": ""
} |
q4266 | LoginRecorderComponent.getFileArray | train | public function getFileArray()
{
if (!$this->FileArray) {
$user = $this->getConfig('user');
is_true_or_fail(is_positive($user), __d('me_cms', 'You have to set a valid user id'), InvalidArgumentException::class);
| php | {
"resource": ""
} |
q4267 | PHP.extensions | train | public function extensions()
{
foreach ($this->extensionsToCheck as $extension) { | php | {
"resource": ""
} |
q4268 | Difficulty.getCurrentRealmsIncrement | train | public function getCurrentRealmsIncrement(): int
{
$currentDifficulty = $this->getValue();
$maximalDifficulty = $this->getMaximal();
if ($currentDifficulty <= $maximalDifficulty) {
return 0;
}
$additionalDifficulty = $currentDifficulty - $maximalDifficulty;
$steps = $additionalDifficulty / $this->getDifficultyAddition()->getDifficultyAdditionPerStep();
| php | {
"resource": ""
} |
q4269 | BaseAlias.configure | train | protected function configure()
{
if (empty(static::COMMAND)) {
throw new NailsException('static::COMMAND must be defined');
}
if (empty(static::ALIAS)) {
throw new NailsException('static::ALIAS must be defined');
}
// | php | {
"resource": ""
} |
q4270 | Body.setContentType | train | public function setContentType(string $contentType, string $contentCharset = null): self
{
$this->contentType = $contentType;
if ($contentCharset !== null) {
| php | {
"resource": ""
} |
q4271 | Body.isImage | train | public function isImage(): bool
{
return is_resource($this->content) && in_array($this->contentType, [
| php | {
"resource": ""
} |
q4272 | ArrayExchanger.getRate | train | public function getRate($fromCurrency, $toCurrency)
{
if ($fromCurrency === $toCurrency) {
return 1;
}
$currencyString = "{$fromCurrency}-{$toCurrency}";
if (!isset($this->rates[$currencyString])) {
throw new NoExchangeRateException(sprintf(
'Cannot convert %s | php | {
"resource": ""
} |
q4273 | PagesCategoriesController.view | train | public function view($slug = null)
{
//The category can be passed as query string, from a widget
if ($this->request->getQuery('q')) {
return $this->redirect([$this->request->getQuery('q')]);
}
$category = $this->PagesCategories->findActiveBySlug($slug)
->select(['id', 'title'])
->contain($this->PagesCategories->Pages->getAlias(), function (Query $q) {
| php | {
"resource": ""
} |
q4274 | Join.getObject | train | public function getObject()
{
if ($this->sourceObject === null && $this->isSourceObjectResolved === false) {
$this->isSourceObjectResolved = true;
try {
$model = $this->modelFactory()->create($this->objectType())->load($this->objectId());
if ($model->id()) {
$this->sourceObject = $model;
}
} catch | php | {
"resource": ""
} |
q4275 | Join.getAttachment | train | public function getAttachment()
{
if ($this->relatedObject === null && $this->isRelatedObjectResolved === false) {
$this->isRelatedObjectResolved = true;
try {
$model = $this->modelFactory()->create(Attachment::class)->load($this->attachmentId());
if ($model->id()) {
$this->relatedObject = $model;
| php | {
"resource": ""
} |
q4276 | Join.getParent | train | public function getParent()
{
if ($this->parentRelation === null && $this->isParentRelationResolved === false) {
$this->isParentRelationResolved = true;
try {
$source = $this->getObject();
if ($source instanceof AttachmentContainerInterface) {
$model = $this->modelFactory()->create(self::class)->loadFrom('attachment_id', $source->id());
if ($model->id()) {
$this->parentRelation = $model;
| php | {
"resource": ""
} |
q4277 | Join.setPosition | train | public function setPosition($position)
{
if ($position === null) {
$this->position = null;
return $this;
}
if (!is_numeric($position)) {
throw new InvalidArgumentException(
| php | {
"resource": ""
} |
q4278 | FormDisableElementsCapableFormSettings.render | train | public function render(ElementInterface $element)
{
/* @var $element DisableElementsCapableFormSettings
* @var $renderer \Zend\View\Renderer\PhpRenderer
* @var $headscript \Zend\View\Helper\HeadScript
* @var $basepath \Zend\View\Helper\BasePath */
$renderer = $this->getView();
$headscript = $renderer->plugin('headscript');
$basepath = | php | {
"resource": ""
} |
q4279 | FormDisableElementsCapableFormSettings.renderCheckboxes | train | protected function renderCheckboxes($checkboxes)
{
$markup = '';
foreach ($checkboxes as $boxes) {
$markup .= '<li class="disable-element">';
if (is_array($boxes)) {
if (isset($boxes['__all__'])) {
$markup .= $this->renderCheckbox($boxes['__all__'], | php | {
"resource": ""
} |
q4280 | Pdf.instantiate | train | protected function instantiate()
{
$oOptions = new Options();
$aOptions = [];
// Default options
foreach (self::DEFAULT_OPTIONS as $sOption => $mValue) {
$aOptions[$sOption] = $mValue;
}
// Custom options override default options
| php | {
"resource": ""
} |
q4281 | Pdf.setOption | train | public function setOption($sOption, $mValue)
{
$this->aCustomOptions[$sOption] = $mValue;
| php | {
"resource": ""
} |
q4282 | Pdf.setPaperSize | train | public function setPaperSize($sSize = null, $sOrientation = null)
{
$this->sPaperSize = $sSize ?: static::DEFAULT_PAPER_SIZE;
$this->sPaperOrientation = $sOrientation ?: static::DEFAULT_PAPER_ORIENTATION;
| php | {
"resource": ""
} |
q4283 | Pdf.loadView | train | public function loadView($mViews, $aData = [])
{
$sHtml = '';
$aViews = array_filter((array) $mViews);
| php | {
"resource": ""
} |
q4284 | Pdf.download | train | public function download($sFilename = '', $aOptions = [])
{
$sFilename = $sFilename ? $sFilename : self::DEFAULT_FILE_NAME;
// Set the content attachment, by default send to the browser
| php | {
"resource": ""
} |
q4285 | Pdf.save | train | public function save($sPath, $sFilename)
{
if (!is_writable($sPath)) {
$this->setError('Cannot write to ' . $sPath);
return false;
}
$this->oDomPdf->render();
$bResult = (bool) file_put_contents(
| php | {
"resource": ""
} |
q4286 | Pdf.saveToCdn | train | public function saveToCdn($sFilename, $sBucket = null)
{
if (Components::exists('nails/module-cdn')) {
// Save temporary file
$sCacheDir = CACHE_PATH;
$sCacheFile = 'TEMP-PDF-' . md5(uniqid() . microtime(true)) . '.pdf';
if ($this->save($sCacheDir, $sCacheFile)) {
$oCdn = Factory::service('Cdn', 'nails/module-cdn');
$oResult = $oCdn->objectCreate(
$sCacheDir . $sCacheFile,
$sBucket,
['filename_display' => $sFilename]
);
if ($oResult) {
@unlink($sCacheDir . $sCacheFile);
| php | {
"resource": ""
} |
q4287 | PageMapper.findPageById | train | public function findPageById($pageId)
{
$this->makeCollectionPageSelect(true);
$this->sql .= ' and p.id = ?';
| php | {
"resource": ""
} |
q4288 | PageMapper.findPublishedPageBySlug | train | public function findPublishedPageBySlug($pageSlug)
{
$this->makeSelect();
if (is_string($pageSlug)) {
$this->sql .= ' and collection_id is null and slug = ?';
$this->bindValues[] = $pageSlug;
} else {
| php | {
"resource": ""
} |
q4289 | PageMapper.findPages | train | public function findPages($unpublished = false)
{
$this->makeSelect();
$this->sql .= " and collection_id is null";
if (!$unpublished) {
| php | {
"resource": ""
} |
q4290 | PageMapper.findCollectionPagesById | train | public function findCollectionPagesById($collectionId, $published = true)
{
$this->makeCollectionPageSelect();
$this->sql .= ' and c.id = ?';
$this->bindValues[] = $collectionId;
if ($published) {
| php | {
"resource": ""
} |
q4291 | PageMapper.findPublishedCollectionPageBySlug | train | public function findPublishedCollectionPageBySlug($collectionSlug, $pageSlug)
{
$this->makeCollectionPageSelect();
$this->sql .= " and p.published_date <= | php | {
"resource": ""
} |
q4292 | Email.setData | train | public function setData(array $data)
{
foreach ($data as $prop => $val) {
$func = [$this, $this->setter($prop)];
if (is_callable($func)) {
call_user_func($func, $val);
| php | {
"resource": ""
} |
q4293 | Email.campaign | train | public function campaign()
{
if ($this->campaign === null) {
| php | {
"resource": ""
} |
q4294 | Email.from | train | public function from()
{
if ($this->from === null) {
| php | {
"resource": ""
} |
q4295 | Email.replyTo | train | public function replyTo()
{
if ($this->replyTo === null) {
| php | {
"resource": ""
} |
q4296 | Email.msgHtml | train | public function msgHtml()
{
if ($this->msgHtml === null) { | php | {
"resource": ""
} |
q4297 | Email.msgTxt | train | public function msgTxt()
{
if ($this->msgTxt === null) {
| php | {
"resource": ""
} |
q4298 | Email.log | train | public function log()
{
if ($this->log === null) {
| php | {
"resource": ""
} |
q4299 | Email.track | train | public function track()
{
if ($this->track === null) {
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.