_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q7200 | UserCredentialSmsTokenLoginService.authenticate | train | public function authenticate() {
$currentStage = $this->_multiFactorStages['current'];
//set stage as inactive
if ($currentStage == 1) {
$this->_multiFactorStages[1]['statuss'] = parent::authenticate();
//stage one sucessfull, bootstrap stage ... | php | {
"resource": ""
} |
q7201 | UserCredentialSmsTokenLoginService.setEncKeyLength | train | public function setEncKeyLength($keyLength) {
$keyLengthCast = (int) $keyLength;
if (!($keyLengthCast > 0)) {
throw new UserCredentialException('The encryption key length must be an integer', 2105);
}
$this->keyLength = $keyLengthCast;
} | php | {
"resource": ""
} |
q7202 | UserCredentialSmsTokenLoginService.getOneTimeToken | train | public function getOneTimeToken($unhashed = false) {
if ((bool) $unhashed === true) {
return $this->oneTimeToken;
} else {
return \password_hash($this->oneTimeToken, \PASSWORD_DEFAULT);
}
} | php | {
"resource": ""
} |
q7203 | Mailer.push | train | public function push($view, array $data = [], $callback = null, ?string $queue = null): ReceiptContract
{
$method = $this->shouldBeQueued() ? 'queue' : 'send';
return $this->{$method}($view, $data, $callback, $queue);
} | php | {
"resource": ""
} |
q7204 | Mailer.send | train | public function send($view, array $data = [], $callback = null): ReceiptContract
{
$mailer = $this->getMailer();
if ($view instanceof MailableContract) {
$this->updateFromOnMailable($view)->send($mailer);
} else {
$mailer->send($view, $data, $callback);
}
... | php | {
"resource": ""
} |
q7205 | Mailer.queue | train | public function queue($view, array $data = [], $callback = null, ?string $queue = null): ReceiptContract
{
$mailer = $this->getMailer();
if ($view instanceof MailableContract) {
$this->updateFromOnMailable($view)->queue($this->queue);
} else {
$callback = $this->buil... | php | {
"resource": ""
} |
q7206 | Mailer.updateFromOnMailable | train | protected function updateFromOnMailable(MailableContract $message): MailableContract
{
if (! empty($this->from['address'])) {
$message->from($this->from['address'], $this->from['name']);
}
return $message;
} | php | {
"resource": ""
} |
q7207 | Mailer.configureIlluminateMailer | train | public function configureIlluminateMailer(MailerContract $mailer): MailerContract
{
$from = $this->memory->get('email.from');
// If a "from" address is set, we will set it on the mailer so that
// all mail messages sent by the applications will utilize the same
// "from" address on ... | php | {
"resource": ""
} |
q7208 | App.getServices | train | public function getServices(): ServiceContainer
{
if (is_null($this->services)) {
$this->services = new ServiceContainer();
$this->services->setConstraints(['caching' => '\Psr\SimpleCache\CacheInterface',
'events' => '\Psr\EventMana... | php | {
"resource": ""
} |
q7209 | App.addExtension | train | public function addExtension(ExtensionInterface $extension): App
{
try {
if (!$extension->isInitialized()) {
$extension->init($this);
}
} catch (\Exception $e) {
throw new RuntimeException(sprintf('Unable to load extension "%s"', get_class($extensi... | php | {
"resource": ""
} |
q7210 | AnnotationService.registerController | train | private function registerController(string $controllerClassName)
{
$controllerAnnotation = $this->getControllerAnnotation($controllerClassName);
if ($controllerAnnotation instanceof Controller) {
$controllerName = trim($controllerClassName, "\\");
$this->app["$controllerName... | php | {
"resource": ""
} |
q7211 | Server.getDatalistValue | train | protected function getDatalistValue(array $names = array()) {
$services = \hypeJunction\Integration::getServiceProvider();
foreach ($names as $name) {
$values[$name] = $services->datalist->get($name);
}
return $values;
} | php | {
"resource": ""
} |
q7212 | Action.setup | train | public function setup() {
$input_keys = array_keys((array) elgg_get_config('input'));
$request_keys = array_keys((array) $_REQUEST);
$keys = array_unique(array_merge($input_keys, $request_keys));
foreach ($keys as $key) {
if ($key) {
$this->params->$key = get_input($key);
}
}
} | php | {
"resource": ""
} |
q7213 | Order.getReportedShippingCollections | train | public function getReportedShippingCollections()
{
try {
return $this->encoder->decode($this->getData(self::FIELD_REPORTED_SHIPPING_COLLECTIONS)) ?: [];
} catch (\InvalidArgumentException $e) {
$this->_logger->error($e->getMessage());
return [];
}
} | php | {
"resource": ""
} |
q7214 | Http.authenticateOnServer | train | protected function authenticateOnServer($authUrl, $username, $password)
{
$response = $this->sendDigestAuthentication($authUrl, $username, $password);
$httpCode = $response->getHttpCode();
// If status code is not 200, something went wrong
if (200 !== $httpCode) {
throw... | php | {
"resource": ""
} |
q7215 | Http.getRights | train | public function getRights()
{
$rights = array(
'graphUpdate' => false,
'tripleQuerying' => false,
'tripleUpdate' => false
);
// generate a unique graph URI which we will use later on for our tests.
$graph = 'http://saft/'. hash('sha1', rand(0, tim... | php | {
"resource": ""
} |
q7216 | Http.isGraphAvailable | train | public function isGraphAvailable(Node $graph)
{
$graphs = $this->getGraphs();
return isset($graphs[$graph->getUri()]);
} | php | {
"resource": ""
} |
q7217 | Http.openConnection | train | public function openConnection()
{
if (null == $this->httpClient) {
return false;
}
$configuration = array_merge(array(
'authUrl' => '',
'password' => '',
'queryUrl' => '',
'username' => ''
), $this->configuration);
... | php | {
"resource": ""
} |
q7218 | Http.sendDigestAuthentication | train | public function sendDigestAuthentication($url, $username, $password = null)
{
$this->httpClient->setDigestAuthentication($username, $password);
return $this->httpClient->get($url);
} | php | {
"resource": ""
} |
q7219 | Http.sendSparqlSelectQuery | train | public function sendSparqlSelectQuery($url, $query)
{
// because you can't just fire multiple requests with the same CURL class instance
// we have to be creative and re-create the class everytime a request is to be send.
// FYI: https://github.com/php-curl-class/php-curl-class/issues/326
... | php | {
"resource": ""
} |
q7220 | Http.sendSparqlUpdateQuery | train | public function sendSparqlUpdateQuery($url, $query)
{
// because you can't just fire multiple requests with the same CURL class instance
// we have to be creative and re-create the class everytime a request is to be send.
// FYI: https://github.com/php-curl-class/php-curl-class/issues/326
... | php | {
"resource": ""
} |
q7221 | Http.transformResultToArray | train | public function transformResultToArray($receivedResult)
{
// transform object to array
if (is_object($receivedResult)) {
return json_decode(json_encode($receivedResult), true);
// transform json string to array
} else {
return json_decode($receivedResult, true... | php | {
"resource": ""
} |
q7222 | Retriever.getProductTaxClasses | train | public function getProductTaxClasses()
{
/** @var \Magento\Tax\Model\ResourceModel\TaxClass\Collection $taxCollection */
$classes = [];
$taxCollection = $this->taxClass->getCollection();
$taxCollection->setClassTypeFilter(ClassModel::TAX_CLASS_TYPE_PRODUCT);
/** @var C... | php | {
"resource": ""
} |
q7223 | Retriever.getCustomerTaxClasses | train | public function getCustomerTaxClasses()
{
/** @var \Magento\Tax\Model\ResourceModel\TaxClass\Collection $taxCollection */
$classes = [];
$defaultTaxId = $this->customerGroup->getNotLoggedInGroup()->getTaxClassId();
$taxCollection = $this->taxClass->getCollection();
$ta... | php | {
"resource": ""
} |
q7224 | Retriever.getTaxRates | train | public function getTaxRates()
{
$rates = [];
/** @var \Magento\Tax\Model\Calculation\Rate $rate */
foreach ($this->taxRates as $rate) {
$zipCodeType = self::ZIP_CODE_TYPE_ALL;
$zipCodePattern = '';
$zipCodeRangeFrom = '';
$zipCodeRangeTo... | php | {
"resource": ""
} |
q7225 | Retriever.getTaxRules | train | public function getTaxRules()
{
$rules = [];
/* @var \Magento\Tax\Model\Calculation\Rule $rule */
foreach ($this->taxRules as $rule) {
$_rule = [
'id' => $rule->getId(),
'name' => $rule->getCode(),
... | php | {
"resource": ""
} |
q7226 | FileContentHelper._returnHash | train | private function _returnHash(string $hash, int $length)
{
try {
return substr($hash, 0, $length);
} catch (\Exception $e) { }
return false;
} | php | {
"resource": ""
} |
q7227 | FileContentHelper.pathHash | train | public function pathHash(string $path, int $length = 8)
{
return $this->_returnHash(
sha1_file($this->_generalizeResource($path)),
$length
);
} | php | {
"resource": ""
} |
q7228 | FileContentHelper.resourceHash | train | public function resourceHash($resource, int $length = 8): string
{
return $this->_returnHash($resource->getResource()->getSha1(), $length);
} | php | {
"resource": ""
} |
q7229 | UploadHandler.makeFiles | train | public function makeFiles($input, array $attributes = array(), array $config = array()) {
$files = array();
$uploads = hypeApps()->uploader->handle($input, $attributes, $config);
foreach ($uploads as $upload) {
if ($upload->file instanceof \ElggEntity) {
$files[] = $upload->file;
}
}
return $files;
... | php | {
"resource": ""
} |
q7230 | UploadHandler.handle | train | public static function handle($input, array $attributes = array(), array $config = array()) {
return hypeApps()->uploader->handle($input, $attributes, $config);
} | php | {
"resource": ""
} |
q7231 | AbstractFTPClient.newFTPException | train | protected function newFTPException($message) {
return new FTPException(sprintf("%s://%s:%s@%s:%d " . $message, $this->authenticator->getScheme(), $this->authenticator->getPasswordAuthentication()->getUsername(), $this->authenticator->getPasswordAuthentication()->getPassword(), $this->authenticator->getHost(), $... | php | {
"resource": ""
} |
q7232 | Multiotp.ResetCacheArray | train | function ResetCacheArray()
{
// First, we reset all values (we know the key based on the schema)
reset($this->_sql_tables_schema['cache']);
while(list($valid_key, $valid_format) = @each($this->_sql_tables_schema['cache'])) {
$pos = mb_strpos(mb_strtoupper($valid_format), 'DEFAULT');
$value = "... | php | {
"resource": ""
} |
q7233 | Multiotp.ResetConfigArray | train | function ResetConfigArray($array_to_reset = '')
{
if (!is_array($array_to_reset)) {
$array_to_reset = $this->_sql_tables_schema['config'];
}
// First, we reset all values (we know the key based on the schema)
reset($array_to_reset);
while(list($valid_key, $valid_format) = @each($... | php | {
"resource": ""
} |
q7234 | Multiotp.ResetTempUserArray | train | function ResetTempUserArray()
{
$temp_user_array = array();
// First, we reset all values (we know the key based on the schema)
reset($this->_sql_tables_schema['users']);
while(list($valid_key, $valid_format) = @each($this->_sql_tables_schema['users'])) {
$pos = mb_strpos(mb_strtoup... | php | {
"resource": ""
} |
q7235 | Multiotp.ResetUserArray | train | function ResetUserArray()
{
$this->_user_data = array();
$this->_user_data = $this->ResetTempUserArray();
// The user data array is not read actually
$this->SetUserDataReadFlag(false);
} | php | {
"resource": ""
} |
q7236 | Multiotp.GetDetailedUsersArray | train | function GetDetailedUsersArray()
{
$users_array = array();
$result = $this->GetNextUserArray(TRUE);
if (isset($result['user'])) {
$users_array[$result['user']] = $result;
}
do {
if ($result = $this->GetNextUserArray()) {
if (isset($result['user'])) {
... | php | {
"resource": ""
} |
q7237 | Multiotp.ImportTokensFile | train | function ImportTokensFile(
$file,
$original_name = '',
$cipher_password = '',
$key_mac = ""
) {
if (!file_exists($file)) {
$result = FALSE;
} else {
$data1000 = @file_get_contents($file, FALSE, NULL, 0, 1000);
$file_name = ('' != $original_name)?$origi... | php | {
"resource": ""
} |
q7238 | Multiotp.qrcode | train | function qrcode(
$data = '',
$file_name = '',
$image_type = "P",
$ecc_level = "Q",
$module_size = 4,
$version = 0,
$structure_m = 0,
$structure_n = 0,
$parity = 0,
$original_data = ''
) {
$result = '';
$qrcode_folder = $this->GetQrCodeFolder();
... | php | {
"resource": ""
} |
q7239 | MultiotpAdLdap.authenticate | train | function authenticate($username,$password,$prevent_rebind=false){
if ($username==NULL || $password==NULL){ return (false); } //prevent null binding
//bind as the user
$this->_bind = @ldap_bind($this->_conn,$username.$this->_account_suffix,$password);
$this->_bind_paged = @ldap... | php | {
"resource": ""
} |
q7240 | MultiotpAdLdap.group_add_group | train | function group_add_group($parent,$child){
//find the parent group's dn
$parent_group=$this->group_info($parent,array("cn"));
if ($parent_group[0]["dn"]==NULL){ return (false); }
$parent_dn=$parent_group[0]["dn"];
//find the child group's dn
$child_group=$this->g... | php | {
"resource": ""
} |
q7241 | MultiotpAdLdap.group_add_user | train | function group_add_user($group,$user){
//adding a user is a bit fiddly, we need to get the full DN of the user
//and add it using the full DN of the group
//find the user's dn
$user_info=$this->user_info($user,array("cn"));
if ($user_info[0]["dn"]==NULL){ return (false);... | php | {
"resource": ""
} |
q7242 | MultiotpAdLdap.group_del_group | train | function group_del_group($parent,$child){
//find the parent dn
$parent_group=$this->group_info($parent,array("cn"));
if ($parent_group[0]["dn"]==NULL){ return (false); }
$parent_dn=$parent_group[0]["dn"];
//find the child dn
$child_group=$this->group_info($child... | php | {
"resource": ""
} |
q7243 | MultiotpAdLdap.group_del_user | train | function group_del_user($group,$user){
//find the parent dn
$group_info=$this->group_info($group,array("cn"));
if ($group_info[0]["dn"]==NULL){ return (false); }
$group_dn=$group_info[0]["dn"];
//find the child dn
$user_info=$this->user_info($user,array("cn"));
... | php | {
"resource": ""
} |
q7244 | MultiotpAdLdap.group_info | train | function group_info($group_name,$fields=NULL){
if ($group_name==NULL){ return (false); }
if (!$this->_bind){ return (false); }
$filter="(&(objectCategory=group)(".$this->_group_cn_identifier."=".$this->ldap_search_encode($group_name)."))";
if ($fields==NULL){ $fields=array("mem... | php | {
"resource": ""
} |
q7245 | MultiotpAdLdap.group_users | train | function group_users($group_name=NUL){
$result = array();
if ($group_name==NULL){ return (false); }
if (!$this->_bind){ return (false); }
$filter="(&(|(objectClass=posixGroup)(objectClass=groupofNames))(".$this->_group_cn_identifier."=".$this->ldap_search_encode($group_name)."))";
... | php | {
"resource": ""
} |
q7246 | MultiotpAdLdap.user_groups | train | function user_groups($username,$recursive=NULL){
if ($username==NULL){ return (false); }
if ($recursive==NULL){ $recursive=$this->_recursive_groups; } //use the default option if they haven't set it
if (!$this->_bind){ return (false); }
//search the directory for their informati... | php | {
"resource": ""
} |
q7247 | MultiotpAdLdap.user_all_groups | train | function user_all_groups($username, $groups_filtering = '') {
if ($username==NULL){ return (false); }
if (!$this->_bind){ return (false); }
$filter = "(&(objectCategory=group)(member:1.2.840.113556.1.4.1941:=".$username.")".$groups_filtering.")";
// $fields = array($this->_group_cn_ident... | php | {
"resource": ""
} |
q7248 | MultiotpAdLdap.users_info | train | function users_info($username=NULL, $fields=NULL, $groups_filtering = '')
{
$entries = array();
$entries['count'] = 0; // To be compatible with the old data organisation (counter at the beginning)
$i = 0;
if ($result = $this->one_user_info(TRUE, $username, $fields, FALSE, $groups_filtering)) {
do {
$ent... | php | {
"resource": ""
} |
q7249 | MultiotpAdLdap.user_ingroup | train | function user_ingroup($username,$group,$recursive=NULL){
if ($username==NULL){ return (false); }
if ($group==NULL){ return (false); }
if (!$this->_bind){ return (false); }
if ($recursive==NULL){ $recursive=$this->_recursive_groups; } //use the default option if they haven't set it
... | php | {
"resource": ""
} |
q7250 | MultiotpAdLdap.user_modify | train | function user_modify($username,$attributes){
if ($username==NULL){ return ("Missing compulsory field [username]"); }
if (array_key_exists("password",$attributes) && !$this->_use_ssl){ echo ("FATAL: SSL must be configured on your webserver and enabled in the class to set passwords."); exit(); }
/... | php | {
"resource": ""
} |
q7251 | MultiotpAdLdap.user_password | train | function user_password($username,$password){
if ($username==NULL){ return (false); }
if ($password==NULL){ return (false); }
if (!$this->_bind){ return (false); }
if (!$this->_use_ssl){ echo ("FATAL: SSL must be configured on your webserver and enabled in the class to set passwords."); e... | php | {
"resource": ""
} |
q7252 | MultiotpAdLdap.computer_info | train | function computer_info($computer_name,$fields=NULL){
if ($computer_name==NULL){ return (false); }
if (!$this->_bind){ return (false); }
$filter="(&(objectClass=computer)(cn=".$computer_name."))";
if ($fields==NULL){ $fields=array($this->_group_attribute,"cn","displayname","dnshostname",... | php | {
"resource": ""
} |
q7253 | MultiotpAdLdap.all_users | train | function all_users($include_desc = false, $search = "*", $sorted = true){
if (!$this->_bind){
return (false);
}
//perform the search and grab all their details
$filter = "(&(objectClass=user)(samaccounttype=". ADLDAP_NORMAL_ACCOUNT .")(objectCategory=person)(cn=".$se... | php | {
"resource": ""
} |
q7254 | MultiotpAdLdap.encode_password | train | function encode_password($password){
$password="\"".$password."\"";
$encoded="";
for ($i=0; $i <strlen($password); $i++){ $encoded.="{$password{$i}}\000"; }
return ($encoded);
} | php | {
"resource": ""
} |
q7255 | MultiotpAdLdap.ldap_slashes | train | function ldap_slashes($str){
$illegal=array("(",")","#"); // the + character has problems too, but it's an illegal character
$legal=array();
foreach ($illegal as $id => $char){ $legal[$id]="\\".$char; } //make up the array of legal chars
$str=str_replace($illegal,$legal... | php | {
"resource": ""
} |
q7256 | ShopgateOrder.getValueSelectOptions | train | public function getValueSelectOptions()
{
if (!$this->hasData('value_select_options')) {
$this->setData(
'value_select_options',
$this->sourceYesno->toOptionArray()
);
}
return $this->getData('value_select_options');
} | php | {
"resource": ""
} |
q7257 | ShopgateOrder.validate | train | public function validate(\Magento\Framework\Model\AbstractModel $model)
{
$isShopgateOrder = (int) in_array($model->getData(self::CLIENT_ATTRIBUTE), self::APP_CLIENTS);
// TODO add validation for web checkout
$model->setData(self::IS_SHOPGATE_ORDER, $isShopgateOrder);
return parent:... | php | {
"resource": ""
} |
q7258 | ModelCustomFields.getCustomFields | train | public static function getCustomFields($findResults, $getById = false)
{
if (is_array($findResults)) {
if (count($findResults) == 1 && $getById) {
$findResults = [$findResults];
}
}
$results = [];
$classReflection = (new \ReflectionClass($fin... | php | {
"resource": ""
} |
q7259 | ModelCustomFields.getAllCustomFields | train | public function getAllCustomFields(array $fields = [])
{
if (!$models = Modules::findFirstByName($this->getSource())) {
return;
}
$conditions = [];
$fieldsIn = null;
if (!empty($fields)) {
$fieldsIn = " and name in ('" . implode("','", $fields) . ')'... | php | {
"resource": ""
} |
q7260 | ModelCustomFields.saveCustomFields | train | protected function saveCustomFields(): bool
{
//find the custom field module
if (!$module = Modules::findFirstByName($this->getSource())) {
return false;
}
//we need a new instane to avoid overwrite
$reflector = new \ReflectionClass($this);
$classNameWith... | php | {
"resource": ""
} |
q7261 | ModelCustomFields.cleanCustomFields | train | public function cleanCustomFields(int $id): bool
{
$reflector = new \ReflectionClass($this);
$classNameWithNameSpace = $reflector->getNamespaceName() . '\\' . $reflector->getShortName() . 'CustomFields';
$customModel = new $classNameWithNameSpace();
//return $customModel->find(['con... | php | {
"resource": ""
} |
q7262 | ModelCustomFields.afterUpdate | train | public function afterUpdate()
{
//only clean and change custom fields if they are been sent
if (!empty($this->customFields)) {
//replace old custom with new
$allCustomFields = $this->getAllCustomFields();
if (is_array($allCustomFields)) {
foreach (... | php | {
"resource": ""
} |
q7263 | AlphabeticalTreeSort.compare | train | protected function compare(AlphabeticalTreeNodeInterface $a, AlphabeticalTreeNodeInterface $b) {
// Get the paths.
$pathA = AlphabeticalTreeNodeHelper::getPath($a);
$pathB = AlphabeticalTreeNodeHelper::getPath($b);
// Count the path.
$count = count($pathA);
// Handle e... | php | {
"resource": ""
} |
q7264 | Session.flash | train | public function flash($key, $value = true)
{
if (is_array($key))
$this->flashMany($key);
else
$this->session->flash($key, $value);
} | php | {
"resource": ""
} |
q7265 | AbstractDatabase.getConnection | train | public function getConnection() {
if (null === $this->connection) {
$this->connection = $this->connect();
}
return $this->connection;
} | php | {
"resource": ""
} |
q7266 | AbstractDatabase.prepareBinding | train | public function prepareBinding(array $fields) {
$output = [];
foreach ($fields as $current) {
$output[$current] = ":" . $current;
}
return $output;
} | php | {
"resource": ""
} |
q7267 | AbstractDatabase.prepareInsert | train | public function prepareInsert($table, array $values) {
// Initialize the query.
$query = [];
$query[] = "INSERT INTO ";
$query[] = $table;
$query[] = " (`";
$query[] = implode("`, `", array_keys($values));
$query[] = "`) VALUES (";
$query[] = implode(", ... | php | {
"resource": ""
} |
q7268 | AbstractDatabase.prepareUpdate | train | public function prepareUpdate($table, array $values) {
// Initialize the SET.
$set = [];
foreach ($values as $k => $v) {
$set[] = "`" . $k . "` = " . $v;
}
// Initialize the query.
$query = [];
$query[] = "UPDATE ";
$query[] = $table;
... | php | {
"resource": ""
} |
q7269 | UserParser.parseEntity | train | public function parseEntity(User $entity) {
$output = [
$this->encodeInteger($entity->getUserNumber(), 9),
$this->encodeInteger($entity->getCustomerNumber(), 9),
$this->encodeString($entity->getTitle(), 10),
$this->encodeString($entity->getSurname(), 25),
... | php | {
"resource": ""
} |
q7270 | CssInliner.handle | train | public function handle(MessageSending $sending): void
{
$message = $sending->message;
$converter = new CssToInlineStyles();
if ($message->getContentType() === 'text/html' ||
($message->getContentType() === 'multipart/alternative' && $message->getBody())
) {
... | php | {
"resource": ""
} |
q7271 | CodeStringBuffer.append | train | public function append($lines, $newline = true, $indentOffset = 0)
{
$this->_buffer[] = trim($lines) ? ($this->_getIndentationString($indentOffset) . $lines) : $lines;
if ($newline) {
$this->_buffer[] = $this->newLineStr;
}
return $this;
} | php | {
"resource": ""
} |
q7272 | Type.getType | train | public function getType($item)
{
switch ($this->getProductType($item)) {
case Bundle::TYPE_CODE:
return $this->bundle->create()->setItem($item);
case Grouped::TYPE_CODE:
return $this->grouped->create()->setItem($item);
case Configurable::TY... | php | {
"resource": ""
} |
q7273 | Upload.save | train | public function save(array $attributes = array(), $prefix = self::DEFAULT_FILESTORE_PREFIX) {
$this->error_code = $this->error;
$this->error = $this->getError();
$this->filesize = $this->size;
$this->path = $this->tmp_name;
$this->mimetype = $this->detectMimeType();
$this->simpletype = $this->parseSimpleTy... | php | {
"resource": ""
} |
q7274 | Upload.getError | train | public function getError() {
switch ($this->error_code) {
case UPLOAD_ERR_OK:
return false;
case UPLOAD_ERR_NO_FILE:
$error = 'upload:error:no_file';
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$error = 'upload:error:file_size';
default:
$error = 'upload:error:unknown';
}
r... | php | {
"resource": ""
} |
q7275 | Upload.parseSimpleType | train | public function parseSimpleType() {
if (is_callable('elgg_get_file_simple_type')) {
return elgg_get_file_simple_type($this->detectMimeType());
}
$mime_type = $this->detectMimeType();
switch ($mime_type) {
case "application/msword":
case "application/vnd.openxmlformats-officedocument.wordprocessingml.... | php | {
"resource": ""
} |
q7276 | CMySQLSyntaxBuilder.describeStorage | train | public function describeStorage($name, $schema = false)
{
if (!$schema) {
$schema = $this->connector->getSchema();
}
return $this->describeTable($name, $schema);
} | php | {
"resource": ""
} |
q7277 | CMySQLSyntaxBuilder.describeTable | train | private function describeTable($name, $schema)
{
$data = $this->connector->getQueryAsSingleRow(
'SELECT t.table_schema AS table_schema, t.table_name AS table_name, t.engine AS engine,
t.auto_increment AS auto_increment, t.table_collation AS table_collation,
... | php | {
"resource": ""
} |
q7278 | ObjectHelper.getHooks | train | public static function getHooks($classpath, $namespace, $classname = null, $extends = null, $method = null) {
//
$hooks = [];
// Get the filenames.
$filenames = FileHelper::getFileNames($classpath, ".php");
// Handle each filenames.
foreach ($filenames as $filename) {
... | php | {
"resource": ""
} |
q7279 | ObjectHelper.urlEncodeShortName | train | public static function urlEncodeShortName($object) {
$classname = static::getShortName($object);
$explode = preg_replace("/([a-z]{1})([A-Z]{1})/", "$1-$2", $classname);
return strtolower($explode);
} | php | {
"resource": ""
} |
q7280 | ContextIORequest.put | train | public function put($account, $action, $parameters = null, $httpHeadersToSet = array())
{
return $this->sendRequest('PUT', $account, $action, $parameters, null, null, $httpHeadersToSet);
} | php | {
"resource": ""
} |
q7281 | ContextIORequest.delete | train | public function delete($account, $action = '', $parameters = null)
{
return $this->sendRequest('DELETE', $account, $action, $parameters);
} | php | {
"resource": ""
} |
q7282 | PaginateHelper.getPageOffsetAndLimit | train | public static function getPageOffsetAndLimit($pageNumber, $divider, $total = -1) {
if ($pageNumber < 0 || $divider < 0) {
return -1;
}
$offset = $pageNumber * $divider;
$limit = $divider;
if (0 <= $total && ($total < $offset || $total < ($offset + $limit))) {
... | php | {
"resource": ""
} |
q7283 | PaginateHelper.getPagesCount | train | public static function getPagesCount($linesNumber, $divider) {
if ($linesNumber < 0 || $divider < 0) {
return -1;
}
$pagesCount = intval($linesNumber / $divider);
if (0 < ($linesNumber % $divider)) {
++$pagesCount;
}
return $pagesCount;
} | php | {
"resource": ""
} |
q7284 | OrderRepository.createAndSave | train | public function createAndSave($mageOrderId)
{
$order = $this->orderFactory->create()
->setOrderId($mageOrderId)
->setStoreId($this->config->getStoreViewId())
->setShopgateOrderNumber($this->sgOrder->getOrderNumber())
->setIsShippingBlocked($this->sgOrder->getI... | php | {
"resource": ""
} |
q7285 | OrderRepository.update | train | public function update(Order $order)
{
if ($this->sgOrder->getUpdatePayment()) {
$order->setIsPaid($this->sgOrder->getIsPaid());
}
if ($this->sgOrder->getUpdateShipping()) {
$order->setIsShippingBlocked($this->sgOrder->getIsShippingBlocked());
}
} | php | {
"resource": ""
} |
q7286 | DefaultController.actionJson | train | public function actionJson()
{
/** @var \yii\web\Response */
$response = \Yii::$app->getResponse();
if (!is_readable($this->module->swaggerPath)) {
throw new NotFoundHttpException();
}
// Read source json file
$json = file_get_contents($t... | php | {
"resource": ""
} |
q7287 | AlphabeticalTreeNodeHelper.createChoices | train | public static function createChoices(array $choices) {
// Initialize the output.
$output = [];
// Sort the nodes.
$sorter = new AlphabeticalTreeSort($choices);
$sorter->sort();
// Handle each node.
foreach ($sorter->getNodes() as $current) {
// Get... | php | {
"resource": ""
} |
q7288 | AlphabeticalTreeNodeHelper.removeOrphan | train | public static function removeOrphan(array &$nodes = []) {
do {
$found = false;
foreach ($nodes as $k => $v) {
if (false === ($v instanceof AlphabeticalTreeNodeInterface) || null === $v->getAlphabeticalTreeNodeParent() || true === in_array($v->getAlphabeticalTreeNodeParent... | php | {
"resource": ""
} |
q7289 | DefaultEngine.getTwig | train | public function getTwig(): \Twig_Environment
{
if (is_null($this->twig)) {
// Init Twig
$this->twigLoader = new \Twig_Loader_Filesystem();
$this->twig = new \Twig_Environment($this->twigLoader);
}
return $this->twig;
} | php | {
"resource": ""
} |
q7290 | Config.all | train | public function all() {
if (!isset($this->settings)) {
$this->settings = array_merge($this->getDefaults(), $this->plugin->getAllSettings());
}
return $this->settings;
} | php | {
"resource": ""
} |
q7291 | OAuthServer.fetchRequestToken | train | public function fetchRequestToken(&$request)
{
$this->getVersion($request);
$consumer = $this->getConsumer($request);
// no token required for the initial token request
$token = null;
$this->checkSignature($request, $consumer, $token);
... | php | {
"resource": ""
} |
q7292 | OAuthServer.fetchAccessToken | train | public function fetchAccessToken(&$request)
{
$this->getVersion($request);
$consumer = $this->getConsumer($request);
// requires authorized request token
$token = $this->getToken($request, $consumer, "request");
$this->checkSignature($request, $cons... | php | {
"resource": ""
} |
q7293 | OAuthServer.getSignatureMethod | train | protected function getSignatureMethod(&$request)
{
$signature_method =
@$request->getParameter("oauth_signature_method");
if (!$signature_method) {
// According to chapter 7 ("Accessing Protected Ressources") the signature-method
// parameter is required,... | php | {
"resource": ""
} |
q7294 | OAuthServer.getConsumer | train | protected function getConsumer(&$request)
{
$consumer_key = @$request->getParameter("oauth_consumer_key");
if (!$consumer_key) {
throw new OAuthException("Invalid consumer key");
}
$consumer = $this->data_store->lookupConsumer($consumer_key);
if (!$consum... | php | {
"resource": ""
} |
q7295 | OAuthServer.getToken | train | protected function getToken(&$request, $consumer, $token_type = "access")
{
$token_field = @$request->getParameter('oauth_token');
$token = $this->data_store->lookupToken(
$consumer, $token_type, $token_field
);
if (!$token) {
throw new OAuthException("Invalid... | php | {
"resource": ""
} |
q7296 | OAuthServer.checkNonce | train | protected function checkNonce($consumer, $token, $nonce, $timestamp)
{
if (!$nonce) {
throw new OAuthException(
'Missing nonce parameter. The parameter is required'
);
}
// verify that the nonce is uniqueish
$found = $this->data_store-... | php | {
"resource": ""
} |
q7297 | Date.convert_to_date_time | train | protected function convert_to_date_time( $value ) {
if ( $value instanceof \DateTimeInterface ) {
return $value;
}
switch ( gettype( $value ) ) {
case 'string' :
return $this->convert_string( $value );
case 'integer' :
return $this->convert_integer( $value );
case 'double' :
return $this... | php | {
"resource": ""
} |
q7298 | Date.convert_string | train | protected function convert_string( $value ) {
$format = $this->input_data[ 'format' ];
$date = \DateTime::createFromFormat( $format, $value );
// Invalid dates can show up as warnings (ie. "2007-02-99") and still return a DateTime object.
$errors = \DateTime::getLastErrors();
if ( $errors[ 'warning_count'... | php | {
"resource": ""
} |
q7299 | DiagramUML.getStereoType | train | public function getStereoType(\DOMElement $diaObject)
{
$xpath = $diaObject->getNodePath() . '/dia:attribute[@name="stereotype"]/dia:string';
$nodeList = $this->engine->query($xpath);
if ($nodeList->length == 1) {
$stereoType = str_replace('#', '', $nodeList->item(0)->nodeValue)... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.