query
stringlengths
9
43.3k
document
stringlengths
17
1.17M
metadata
dict
negatives
listlengths
0
30
negative_scores
listlengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
BizForm::DeleteRecord() Delete the record of current row
public function DeleteRecord() { // TODO: support delete multiple records // read the id array from the check box list _REQUEST['row_selections'] global $g_BizSystem; $values = $g_BizSystem->GetClientProxy()->GetFormInputs('row_selections',false); if ($values) { foreach ($values as $id) { $recArray = $this->GetDataObj()->FetchById($id); $dataRec = new DataRecord($recArray, $this->GetDataObj()); // take care of exception try { $dataRec->Delete(); } catch (BDOException $e) { // call $this->ProcessBDOException($e); $this->ProcessBDOException($e); return; } } } else // delete current focused record { $rec = $this->GetActiveRecord(); if (!$rec) return; global $g_BizSystem; //$recId = $this->m_ActiveRecord["Id"]; $ok = $this->GetDataObj()->DeleteRecord($rec); if (!$ok) return $this->ProcessDataObjError($ok); } $this->m_RecordId = null; // clean the current record id // TODO: adjust current page. if current page return no record, goto prev page return $this->ReRender(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteRecord()\n { \n $sql = \"DELETE FROM Cubans WHERE Id = :Id\";\n $statement = $this->connect->prepare($sql);\n $statement->bindValue(':Id', $this->id);\n $statement->execute();\n }", "function deleteRecord()\t{\n\t\tif ($this->conf['delete'])\t{\t// If deleting is enabled\n\t\n\t\t\t$origArr = $GLOBALS['TSFE']->sys_page->getRawRecord($this->theTable, $this->recUid);\n\t\t\tif (($GLOBALS['TSFE']->loginUser && $this->conf['requireLogin']) || ( $this->aCAuth($origArr)&& $this->conf['requireLogin'])||!$this->conf['requireLogin'])\t{\t// Must be logged in OR be authenticated by the aC code in order to delete\n\t\t\t\t\t// If the recUid selects a record.... (no check here)\n\t\t\t\tif (is_array($origArr))\t{\n\t\t\t\t\tif ($this->aCAuth($origArr) || $this->metafeeditlib->DBmayFEUserEdit($this->theTable,$origArr, $GLOBALS['TSFE']->fe_user->user,$this->conf['allowedGroups'],$this->conf['fe_userEditSelf'],$this->conf))\t{\t// Display the form, if access granted.\n\t\t\t\t\t\tif (!$GLOBALS['TCA'][$this->theTable]['ctrl']['delete'])\t{\t// If the record is fully deleted... then remove the image (or any file) attached.\n\t\t\t\t\t\t\t$this->deleteFilesFromRecord($this->recUid);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->cObj->DBgetDelete($this->theTable, $this->recUid, TRUE);\n\t\t\t\t\t\t$this->currentArr = $origArr;\n\t\t\t\t\t\t$this->saved = 1;\n\t\t\t\t\t\t$this->userProcess_alt($conf['edit.']['userFunc_afterDelete'],$conf['edit.']['userFunc_afterDelete.'],array('rec'=>$this->currentArr, 'origRec'=>$origArr));\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->error = '###TEMPLATE_NO_PERMISSIONS###';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t\t\t$this->error = '###TEMPLATE_NO_PERMISSIONS###';\n\t\t }\n\t\t}\n\t}", "function deleteRecord($id)\n\t{\n\t\t$this->form->deleteRecord($this->tablename, $id);\n\t}", "public function delete() {\n\t\tif ($this->checkDependencies() == true ) {\n\t\t\t$sql = \"DELETE FROM \".$this->tablename.\" where \".$this->idcol.\" = \".$this->page->ctrl['record'];\n\t\t\t$this->dbc->exec($sql);\n\t\t}\n\t}", "public function delete() {\n\t\ttry {\n\t\t\tif($this->_state == self::STATE_UNCHANGED) {\n\t\t\t\t$sql = 'DELETE FROM ' . self::sanitize($this->_table->getProperty('name')) . ' WHERE ' . self::sanitize($this->_key_primary->name) . ' = ' . self::sanitize($this->_data[$this->_key_primary->name]);\n\t\t\t\t\\Bedrock\\Common\\Logger::info('Deleting record with query: ' . $sql); echo $sql;\n\t\t\t\t$this->_connection->exec($sql);\n\t\t\t}\n\t\t\telseif($this->_state == self::STATE_CHANGED) {\n\t\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('Unsaved changes found, cannot delete record.');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('Record not found in database.');\n\t\t\t}\n\t\t}\n\t\tcatch(\\PDOException $ex) {\n\t\t\t\\Bedrock\\Common\\Logger::exception($ex);\n\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('A database error was encountered, the record could not be deleted.');\n\t\t}\n\t\tcatch(\\Exception $ex) {\n\t\t\t\\Bedrock\\Common\\Logger::exception($ex);\n\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('The record could not be deleted.');\n\t\t}\n\t}", "public function deleteRecord()\n\t{\n\t\tif($this->user->hasRight($this->getHandler()->getDeleteRight()))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t$record = $this->getHandler()->getRecord();\n\t\t\t\t$record->import($this->getRequest());\n\n\t\t\t\t// check owner\n\t\t\t\tif(!$this->isOwner($record))\n\t\t\t\t{\n\t\t\t\t\tthrow new Exception('You are not the owner of the record');\n\t\t\t\t}\n\n\t\t\t\t// check captcha\n\t\t\t\t$this->handleCaptcha($record);\n\n\t\t\t\t// delete\n\t\t\t\t$this->getHandler()->delete($record);\n\n\n\t\t\t\t$msg = new Message('You have successful delete a ' . $record->getName(), true);\n\n\t\t\t\t$this->setResponse($msg);\n\t\t\t}\n\t\t\tcatch(\\Exception $e)\n\t\t\t{\n\t\t\t\t$msg = new Message($e->getMessage(), false);\n\n\t\t\t\t$this->setResponse($msg);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$msg = new Message('Access not allowed', false);\n\n\t\t\t$this->setResponse($msg, null, $this->user->isAnonymous() ? 401 : 403);\n\t\t}\n\t}", "public function do_delete_record()\n {\n $v_list_delete = get_post_var('hdn_item_id_list','');\n $this->model->do_delete_record($v_list_delete);\n }", "public function delete() {\n global $DB;\n $DB->delete_records($this->get_table_name(), array('id' => $this->id));\n }", "function delete_record () { //deletes a record\n\t\t\n\t\t//deletes record\n\t\t$pdo = Database::connect();\n\t\t$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\t\t$sql = \"DELETE FROM customers WHERE id = ?\";\n\t\t$q = $pdo->prepare($sql);\n\t\t$q->execute(array($_GET['id']));\n\t\tDatabase::disconnect();\n\t\theader(\"Location: customer.php\");\n\t\t\t\n\t}", "public function deleteRecord ($id);", "public function delete()\r\n {\r\n $recordId = $this->getRecId();\r\n $command = static::getDb()->newDeleteCommand(static::$defaultLayout, $recordId);\r\n try {\r\n $command->execute();\r\n return 1;\r\n } catch (FileMakerException $e) {\r\n $this->addError('delete', $e->getMessage());\r\n return 0;\r\n }\r\n }", "public function deleteRecord($id){\n\t}", "public function deleteRecord(){\n\t\t/* Variable initialization */\n\t\t$intEmailCode \t= ($this->input->post('txtDeleteRecordCode') !='') ? getDecyptionValue($this->input->post('txtDeleteRecordCode')) : 0;\n\n\t\t/* if email code is not pass then do needful */\n\t\tif($intEmailCode == 0){\n\t\t\t/* Return error message */\n\t\t\tjsonReturn(array('status'=>0,'message'=>\"Invalid email template code requested.\"), true);\n\t\t}\n\t\t/* Setting the updated array */\n\t\t$strUpdatedArr\t= array(\n\t\t\t\t\t\t\t\t\t'table'=>$this->_strPrimaryTableName,\n\t\t\t\t\t\t\t\t\t'data'=>array(\n\t\t\t\t\t\t\t\t\t\t\t\t'deleted'=>1,\n\t\t\t\t\t\t\t\t\t\t\t\t'updated_by'=>$this->getUserCode(),\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'where'=>array(\n\t\t\t\t\t\t\t\t\t\t\t\t'id'=>$intEmailCode\n\t\t\t\t\t\t\t\t\t\t\t)\n\n\t\t\t\t\t\t\t\t);\n\t\t/* Updating the requested record set */\n\t\t$intNunberOfRecordUpdated = $this->_objDataOperation->setUpdateData($strUpdatedArr);\n\n\t\tif($intNunberOfRecordUpdated > 0){\n\t\t\tjsonReturn(array('status'=>1,'message'=>'Requested email template deleted successfully.'), true);\n\t\t}else{\n\t\t\tjsonReturn(array('status'=>0,'message'=>DML_ERROR), true);\n\t\t}\n\n\t\t/* removed variables */\n\t\tunset($strUpdatedArr);\n\t}", "public function deleteRecord() {\n\n $permissions = $this->permission();\n $access = FALSE;\n foreach ($permissions as $per) {\n if ($per->permission == 'user-delete') {\n $access = TRUE;\n break;\n }\n }\n if ($access) {\n \n $id = $this->uri->segment(3);\n\n if ($id != $this->user()->id) {\n $result = $this->UserModel->deleteRecordData($id);\n $this->UserModel->deleteUserType($id);\n if ($result == 1) {\n $this->session->set_flashdata('message', '2');\n redirect('UserCon/showAllRecordsPage');\n } else {\n echo \"Database error!\";\n }\n } else {\n $this->session->set_flashdata('message', '3');\n redirect('UserCon/showAllRecordsPage');\n }\n } else {\n echo \"access denied\";\n }\n }", "function delete_record ($fieldName,$id,$tblName){\n\t\n\t\t$this->load->model('Common_function_model','common');\n\t\t\n\t\t$this->db->where($fieldName, $id);\n\n\t\tif($this->db->delete($tblName))\n\t\t\treturn true;\n\t\telse\n\t\t\t return false;\n\t\t\n }", "function delete()\r\n\t{\r\n\t\t// Check for request forgeries\r\n\t\tJRequest::checkToken() or die( 'Invalid Token' );\r\n\t\tglobal $mainframe;\r\n\t\t$model\t= &$this->getModel( 'table' );\r\n\t\t$ids = JRequest::getVar('ids', array(), 'request', 'array');\r\n\t\t$model->deleteRows( $ids );\r\n\t\tif ( JRequest::getVar('format') == 'raw') {\r\n\t\t\tJRequest::setVar( 'view', 'table' );\r\n\t\t\t$this->display();\r\n\t\t} else {\r\n\t\t\t//@TODO: test this\r\n\t\t\t$ref = JRequest::getVar( 'fabrik_referrer', \"index.php\", 'post' );\r\n\t\t\t$mainframe->redirect( $ref, count($ids) . \" \" . JText::_( 'RECORDS DELETED' ) );\r\n\t\t}\r\n\t}", "function doRealDelete()\n {\n /* Delete the record */\n DatabaseBean::dbDeleteById();\n }", "function doRealDelete()\n {\n $this->assignSingle();\n /* Delete the record */\n DatabaseBean::dbDeleteById();\n }", "function delete($fieldName, $recordKey) {\r\n\t\t\r\n\t\t\t$sqlRecord = $this->deleteTableRecord($this->table, $fieldName , $recordKey );\r\n\t\t\treturn $sqlRecord;\r\n\t\t\r\n\t\t}", "function delete($fieldName, $recordKey) {\r\n\t\t\r\n\t\t\t$sqlRecord = $this->deleteTableRecord($this->table, $fieldName , $recordKey );\r\n\t\t\treturn $sqlRecord;\r\n\t\t\r\n\t\t}", "function delete($fieldName, $recordKey) {\r\n\t\t\r\n\t\t\t$sqlRecord = $this->deleteTableRecord($this->table, $fieldName , $recordKey );\r\n\t\t\treturn $sqlRecord;\r\n\t\t\r\n\t\t}", "public function delete()\n {\n $this->db->delete($this->table, $this->data['id'], $this->key);\n }", "function DeleteRecord($tabel_name='',$where='')\n {\n $param = ['is_delete'=>1];\n $this->db\n ->where($where)\n ->update($tabel_name,$param);\n }", "public function delete(){\n if (isset($this->content[$this->idField])) {\n\n $sql = \"DELETE FROM {$this->table} WHERE {$this->idField} = {$this->content[$this->idField]};\";\n $delet = new \\AR\\BD\\Delete();\n $delet->ExeDelete($this->table, \"WHERE {$this->idField} = {$this->content[$this->idField]}\", \"\");\n \n }\n }", "function delete()\n\t{\n\t\tSQL::query(\"delete from {$this->_table} where id = {$this->_data['id']}\");\n\t}", "public function RemoveRecord()\n {\n $rec = $this->GetActiveRecord();\n global $g_BizSystem;\n $ok = $this->GetDataObj()->RemoveRecord($rec,$bPrtObjUpdated);\n if (!$ok)\n return $this->ProcessDataObjError($ok);\n\n $html = \"\";\n // rerender parent form's driving form (its field is updated in M-1 case)\n if ($bPrtObjUpdated) {\n $prtForm = $g_BizSystem->GetObjectFactory()->GetObject($this->m_ParentFormName);\n $html = $prtForm->ReRender();\n }\n //$this->UpdateActiveRecord($this->GetDataObj()->GetRecord(0));\n return $html . $this->ReRender();\n }", "public function delete() {\n global $db;\n $this->_predelete();\n $result = $db->query(\"DELETE FROM \".$this->table.\" WHERE \".$this->id_field.\"=?\", array($this->{$this->id_field}));\n $this->_postdelete($result);\n return $result;\n }", "private function delete(){\n\t\t$id = $this->objAccessCrud->getId();\n\t\tif (empty ( $id )) return;\n\t\t// Check if there are permission to execute delete command.\n\t\t$result = $this->clsAccessPermission->toDelete();\n\t\tif(!$result){\n\t\t\t$this->msg->setWarn(\"You don't have permission to delete!\");\n\t\t\treturn;\n\t\t}\n\t\tif(!$this->objAccessCrud->delete($id)){\n\t\t\t$this->msg->setError (\"There was an issue to delete, because this register has some relation with another one!\");\n\t\t\treturn;\n\t\t}\n\t\t// Cleaner all class values.\n\t\t$this->objAccessCrud->setAccessCrud(null);\n\t\t// Cleaner session primary key.\n\t\t$_SESSION['PK']['ACCESSCRUD'] = null;\n\n\t\t$this->msg->setSuccess (\"Delete the record with success!\");\n\t\treturn;\n\t}", "function deleteRecord($table,$where) \t{\n\t\t$query = \"DELETE FROM \".$this->tablePrefix .$table.' WHERE '.$where ;\n $res = $this->execute($query);\n\n\t}", "public function destroy(Record $record)\n {\n //\n }" ]
[ "0.7640079", "0.76286453", "0.75354093", "0.74142456", "0.7413047", "0.7381915", "0.71535695", "0.71475536", "0.7103126", "0.7067173", "0.7059723", "0.7029607", "0.70152307", "0.6950108", "0.6931678", "0.692823", "0.6926597", "0.6907327", "0.6796317", "0.6796317", "0.6796317", "0.67621154", "0.67449844", "0.67395276", "0.6724839", "0.6710861", "0.6681794", "0.66737276", "0.66551644", "0.6636231" ]
0.84122926
0
BizForm::RemoveRecord() Remove the record out of the associate relationship
public function RemoveRecord() { $rec = $this->GetActiveRecord(); global $g_BizSystem; $ok = $this->GetDataObj()->RemoveRecord($rec,$bPrtObjUpdated); if (!$ok) return $this->ProcessDataObjError($ok); $html = ""; // rerender parent form's driving form (its field is updated in M-1 case) if ($bPrtObjUpdated) { $prtForm = $g_BizSystem->GetObjectFactory()->GetObject($this->m_ParentFormName); $html = $prtForm->ReRender(); } //$this->UpdateActiveRecord($this->GetDataObj()->GetRecord(0)); return $html . $this->ReRender(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function onRelationManageRemove()\n {\n $this->beforeAjax();\n\n $recordId = post('record_id');\n $sessionKey = $this->deferredBinding ? $this->relationGetSessionKey() : null;\n $relatedModel = $this->relationModel;\n\n /*\n * Remove\n */\n if ($this->viewMode == 'multi') {\n\n $checkedIds = $recordId ? [$recordId] : post('checked');\n\n if (is_array($checkedIds)) {\n $foreignKeyName = $relatedModel->getKeyName();\n\n $models = $relatedModel->whereIn($foreignKeyName, $checkedIds)->get();\n foreach ($models as $model) {\n $this->relationObject->remove($model, $sessionKey);\n }\n }\n }\n /*\n * Unlink\n */\n elseif ($this->viewMode == 'single') {\n if ($this->relationType == 'belongsTo') {\n $this->relationObject->dissociate();\n $this->relationObject->getParent()->save();\n }\n elseif ($this->relationType == 'hasOne' || $this->relationType == 'morphOne') {\n if ($obj = $relatedModel->find($recordId)) {\n $this->relationObject->remove($obj, $sessionKey);\n }\n elseif ($this->viewModel->exists) {\n $this->relationObject->remove($this->viewModel, $sessionKey);\n }\n }\n\n $this->viewWidget->setFormValues([]);\n }\n\n return $this->relationRefresh();\n }", "public function delete () {\n if(count($this->data[$this->id])) {\n foreach($this->data[$this->id] as $key=>$prop) {\n if($prop[\"link\"] == \"P127F\")\n $broader = $key;\n }\n }\n unset($this->data[$this->id][$broader]);\n \n // if there are still links, we must stop\n if(count($this->data[$this->id])) \n throw new Exception(\"Cannot remove because record has links! (remove them first)\");\n\n // remove table data linked to this record\n foreach($this->tables as $table) {\n $table->deleteMyData($this->id);\n }\n \n // remove link to class hierarchy and then the record itself\n IdaDb::deleteBy(\"_sys_classes_join\", array(\"subject\"=>$this->id));\n IdaDb::deleteBy(\"_sys_records\", array(\"id\"=>$this->id));\n \n }", "public function delinkRecord(string $relatedRecordId)\n\t{\n\t\t$handlerInstance=new CommonAPIHandler(); \n\t\t$apiPath=\"\"; \n\t\t$apiPath=$apiPath.('/crm/v2/'); \n\t\t$apiPath=$apiPath.(strval($this->moduleAPIName)); \n\t\t$apiPath=$apiPath.('/'); \n\t\t$apiPath=$apiPath.(strval($this->recordId)); \n\t\t$apiPath=$apiPath.('/'); \n\t\t$apiPath=$apiPath.(strval($this->relatedListAPIName)); \n\t\t$apiPath=$apiPath.('/'); \n\t\t$apiPath=$apiPath.(strval($relatedRecordId)); \n\t\t$handlerInstance->setAPIPath($apiPath); \n\t\t$handlerInstance->setHttpMethod(Constants::REQUEST_METHOD_DELETE); \n\t\t$handlerInstance->setCategoryMethod(Constants::REQUEST_METHOD_DELETE); \n\t\treturn $handlerInstance->apiCall(ActionHandler::class, 'application/json'); \n\n\t}", "public function isRemoveFromRelationship();", "public function destroy(Record $record)\n {\n //\n }", "public function removeFromCart()\n\t{\n\t\t$this->cart->remove($this->request->getInteger('record'));\n\t\t$this->saveCart();\n\t}", "public function DeleteRecord()\n {\n // TODO: support delete multiple records\n // read the id array from the check box list _REQUEST['row_selections']\n global $g_BizSystem;\n $values = $g_BizSystem->GetClientProxy()->GetFormInputs('row_selections',false);\n if ($values)\n {\n foreach ($values as $id)\n {\n $recArray = $this->GetDataObj()->FetchById($id);\n $dataRec = new DataRecord($recArray, $this->GetDataObj());\n // take care of exception\n try {\n $dataRec->Delete();\n }\n catch (BDOException $e)\n {\n // call $this->ProcessBDOException($e);\n $this->ProcessBDOException($e);\n return;\n }\n }\n }\n else // delete current focused record\n {\n $rec = $this->GetActiveRecord();\n if (!$rec) return;\n global $g_BizSystem;\n //$recId = $this->m_ActiveRecord[\"Id\"];\n $ok = $this->GetDataObj()->DeleteRecord($rec);\n if (!$ok)\n return $this->ProcessDataObjError($ok);\n }\n $this->m_RecordId = null; // clean the current record id\n // TODO: adjust current page. if current page return no record, goto prev page\n \n return $this->ReRender();\n }", "public function m2mDbRemove($attr)\n {\n $relName = $this->_relName($this->_relConfig($attr));\n $relation = $this->owner->getRelation($relName);\n\n $pkOwner = $this->_pkOwner();\n $df = $this->_relDefinition($relation);\n\n // deletes current junctions\n $this->_delJunctions($df[0], $df[2], $pkOwner);\n }", "public function delete() {\n\t\ttry {\n\t\t\tif($this->_state == self::STATE_UNCHANGED) {\n\t\t\t\t$sql = 'DELETE FROM ' . self::sanitize($this->_table->getProperty('name')) . ' WHERE ' . self::sanitize($this->_key_primary->name) . ' = ' . self::sanitize($this->_data[$this->_key_primary->name]);\n\t\t\t\t\\Bedrock\\Common\\Logger::info('Deleting record with query: ' . $sql); echo $sql;\n\t\t\t\t$this->_connection->exec($sql);\n\t\t\t}\n\t\t\telseif($this->_state == self::STATE_CHANGED) {\n\t\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('Unsaved changes found, cannot delete record.');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('Record not found in database.');\n\t\t\t}\n\t\t}\n\t\tcatch(\\PDOException $ex) {\n\t\t\t\\Bedrock\\Common\\Logger::exception($ex);\n\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('A database error was encountered, the record could not be deleted.');\n\t\t}\n\t\tcatch(\\Exception $ex) {\n\t\t\t\\Bedrock\\Common\\Logger::exception($ex);\n\t\t\tthrow new \\Bedrock\\Model\\Record\\Exception('The record could not be deleted.');\n\t\t}\n\t}", "public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }", "public function delete() {\n\t\tif ($this->checkDependencies() == true ) {\n\t\t\t$sql = \"DELETE FROM \".$this->tablename.\" where \".$this->idcol.\" = \".$this->page->ctrl['record'];\n\t\t\t$this->dbc->exec($sql);\n\t\t}\n\t}", "public function remove()\n {\n database()->run('DELETE FROM ' . $this->table . ' WHERE ' . $this->primaryKey . ' = ?', [ $this->{$this->primaryKey} ]);\n $this->__destruct();\n }", "function deleteRecord()\t{\n\t\tif ($this->conf['delete'])\t{\t// If deleting is enabled\n\t\n\t\t\t$origArr = $GLOBALS['TSFE']->sys_page->getRawRecord($this->theTable, $this->recUid);\n\t\t\tif (($GLOBALS['TSFE']->loginUser && $this->conf['requireLogin']) || ( $this->aCAuth($origArr)&& $this->conf['requireLogin'])||!$this->conf['requireLogin'])\t{\t// Must be logged in OR be authenticated by the aC code in order to delete\n\t\t\t\t\t// If the recUid selects a record.... (no check here)\n\t\t\t\tif (is_array($origArr))\t{\n\t\t\t\t\tif ($this->aCAuth($origArr) || $this->metafeeditlib->DBmayFEUserEdit($this->theTable,$origArr, $GLOBALS['TSFE']->fe_user->user,$this->conf['allowedGroups'],$this->conf['fe_userEditSelf'],$this->conf))\t{\t// Display the form, if access granted.\n\t\t\t\t\t\tif (!$GLOBALS['TCA'][$this->theTable]['ctrl']['delete'])\t{\t// If the record is fully deleted... then remove the image (or any file) attached.\n\t\t\t\t\t\t\t$this->deleteFilesFromRecord($this->recUid);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->cObj->DBgetDelete($this->theTable, $this->recUid, TRUE);\n\t\t\t\t\t\t$this->currentArr = $origArr;\n\t\t\t\t\t\t$this->saved = 1;\n\t\t\t\t\t\t$this->userProcess_alt($conf['edit.']['userFunc_afterDelete'],$conf['edit.']['userFunc_afterDelete.'],array('rec'=>$this->currentArr, 'origRec'=>$origArr));\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->error = '###TEMPLATE_NO_PERMISSIONS###';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t\t\t$this->error = '###TEMPLATE_NO_PERMISSIONS###';\n\t\t }\n\t\t}\n\t}", "public function deleteRecord()\n\t{\n\t\tif($this->user->hasRight($this->getHandler()->getDeleteRight()))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t$record = $this->getHandler()->getRecord();\n\t\t\t\t$record->import($this->getRequest());\n\n\t\t\t\t// check owner\n\t\t\t\tif(!$this->isOwner($record))\n\t\t\t\t{\n\t\t\t\t\tthrow new Exception('You are not the owner of the record');\n\t\t\t\t}\n\n\t\t\t\t// check captcha\n\t\t\t\t$this->handleCaptcha($record);\n\n\t\t\t\t// delete\n\t\t\t\t$this->getHandler()->delete($record);\n\n\n\t\t\t\t$msg = new Message('You have successful delete a ' . $record->getName(), true);\n\n\t\t\t\t$this->setResponse($msg);\n\t\t\t}\n\t\t\tcatch(\\Exception $e)\n\t\t\t{\n\t\t\t\t$msg = new Message($e->getMessage(), false);\n\n\t\t\t\t$this->setResponse($msg);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$msg = new Message('Access not allowed', false);\n\n\t\t\t$this->setResponse($msg, null, $this->user->isAnonymous() ? 401 : 403);\n\t\t}\n\t}", "public function removeAction() {\n\t\t$unitModelId = $this->getRequest()->getParam('unitModelId');\n\n\t\t$model = new Unit_Model_UnitModel();\n\t\t$result = $model->delete( $unitModelId );\t\t\t\t\n\n $this->setFlashMessage('recordDeleted'); \n $this->_helper->redirector('viewallunitmodels', 'unitmodel', 'unit');\t\t\n\t}", "function do_delete(){\n\t\t// remove from fieldset:\n\t\t$fieldset = jcf_fieldsets_get( $this->fieldset_id );\n\t\tif( isset($fieldset['fields'][$this->id]) )\n\t\t\tunset($fieldset['fields'][$this->id]);\n\t\tjcf_fieldsets_update( $this->fieldset_id, $fieldset );\n\t\t\n\t\t// remove from fields array\n\t\tjcf_field_settings_update($this->id, NULL);\n\t}", "public function removeAction()\n {\n $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_frpformanswers_domain_model_formentry');\n\n $queryBuilder->delete('tx_frpformanswers_domain_model_formentry')\n ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($this->pid, \\PDO::PARAM_INT)))\n ->andWhere($queryBuilder->expr()->eq('deleted', $queryBuilder->createNamedParameter(1, \\PDO::PARAM_INT)))\n ->execute();\n\n $this->addFlashMessage(\n LocalizationUtility::translate('LLL:EXT:frp_form_answers/Resources/Private/Language/de.locallang_be.xlf:flashmessage.removeEntries.body', null, [$this->pid]),\n LocalizationUtility::translate('LLL:EXT:frp_form_answers/Resources/Private/Language/de.locallang_be.xlf:flashmessage.removeEntries.title'),\n \\TYPO3\\CMS\\Core\\Messaging\\FlashMessage::OK,\n true);\n\n $this->redirect('list');\n }", "public function delete() {\r\n\t\t$this->getMapper()->delete($this);\r\n\t}", "public function deleteRecord()\n { \n $sql = \"DELETE FROM Cubans WHERE Id = :Id\";\n $statement = $this->connect->prepare($sql);\n $statement->bindValue(':Id', $this->id);\n $statement->execute();\n }", "public function delinkRecords(ParameterMap $paramInstance=null)\n\t{\n\t\t$handlerInstance=new CommonAPIHandler(); \n\t\t$apiPath=\"\"; \n\t\t$apiPath=$apiPath.('/crm/v2/'); \n\t\t$apiPath=$apiPath.(strval($this->moduleAPIName)); \n\t\t$apiPath=$apiPath.('/'); \n\t\t$apiPath=$apiPath.(strval($this->recordId)); \n\t\t$apiPath=$apiPath.('/'); \n\t\t$apiPath=$apiPath.(strval($this->relatedListAPIName)); \n\t\t$handlerInstance->setAPIPath($apiPath); \n\t\t$handlerInstance->setHttpMethod(Constants::REQUEST_METHOD_DELETE); \n\t\t$handlerInstance->setCategoryMethod(Constants::REQUEST_METHOD_DELETE); \n\t\t$handlerInstance->setParam($paramInstance); \n\t\treturn $handlerInstance->apiCall(ActionHandler::class, 'application/json'); \n\n\t}", "public function delete($entity){ \n //TODO: Implement remove record.\n }", "function delete() {\n\t\n\t\t$this->getMapper()->delete($this);\n\t\t\n\t}", "public function action_remove(){\n $abuse = ORM::factory('BoardAbuse', $this->request->param('id'));\n if($abuse->loaded()){\n if($abuse->ad->loaded())\n $abuse->ad->delete();\n $abuse->delete();\n }\n $this->redirect('admin/boardAbuses' . URL::query());\n }", "public function delete() {\r\n\r\n\t\ttry {\r\n\t\t\tglobal $ks_db;\r\n\t\t\tglobal $ks_log;\r\n\r\n\t\t\tif (! isset ( $this->id )) { \r\n\t\t\t\techo \"Fatal Error: Id is not set for the object! Please do \\$objA->setId(\\$id); in: \" . __METHOD__;\r\n\t\t\t\texit ();\r\n\t\t\t}\r\n\r\n\t\t\t//check if record exists\r\n\t\t\tif(! $this->exists ()) {\r\n\t\t\t\techo \"Fatal Error: No record found with id of ($this->id)\";\r\n\t\t\t\texit ();\r\n\t\t\t}\r\n\r\n\t\t\t$ks_db->beginTransaction ();\r\n\r\n\t\t\t$sql = \"DELETE FROM $this->sqlTable \";\r\n\t\t\t$sql .= \" WHERE lp_id = ?\";\r\n\r\n\t\t\t$ks_db->query ( $sql, $this->id );\r\n\r\n\t\t\t$ks_db->commit ();\r\n\r\n\t\t} catch(Exception $e) {\r\n\t\t\t$ks_db->rollBack ();\r\n\t\t\t$ks_log->info ( 'Fatal Error: ' . __CLASS__ . '::' . __METHOD__ . '. ' . $e->getMessage () );\r\n\t\t\t$ks_log->info ( '<br>SQL Statement: ' . $sql );\r\n\t\t\techo \"Fatal Error: \" . __CLASS__ . '::' . __METHOD__ . '. ' . $e->getMessage ();\r\n\t\t\techo \"SQL Statement: \" . $sql;\r\n\t\t}\r\n\t}", "public function remove() {\n\n // Updates DB (data & metadata)\n $this->attributes->removeAll($this->get(\"id\"));\n $this->db->delete(XCMS_Tables::TABLE_USERS, array(\n \"id\" => $this->get(\"id\")\n ));\n\n }", "public function postRemove($entity);", "public function actionRemove()\n {\n $delete_record = new DeleteRecord();\n $result = Yii::$app->request->post('selection');\n\n if (!$delete_record->isOkPermission(ACTION_DELETE)\n || !$delete_record->isOkSelection($result)\n ) {\n return $this->redirect([ACTION_INDEX]);\n }\n\n $nro_selections = sizeof($result);\n $status = [];\n for ($counter = 0; $counter < $nro_selections; $counter++) {\n try {\n $primary_key = $result[$counter];\n $model = Permission::findOne($primary_key);\n $item = $delete_record->remove($model, 0);\n $status[$item] .= $primary_key . ',';\n } catch (Exception $exception) {\n $bitacora = new Bitacora();\n $bitacora->registerAndFlash(\n $exception,\n 'actionRemove',\n MSG_ERROR\n );\n }\n }\n\n $delete_record->summaryDisplay($status);\n return $this->redirect([ACTION_INDEX]);\n }", "public function remove();", "public function remove();", "public function remove();" ]
[ "0.6813979", "0.6612005", "0.64071", "0.6311899", "0.63110745", "0.62719935", "0.6255385", "0.6187896", "0.61863273", "0.6184471", "0.61646646", "0.6096491", "0.6087318", "0.6013859", "0.6013756", "0.6010203", "0.6008153", "0.5972906", "0.59727114", "0.59619707", "0.59540707", "0.59476143", "0.59442186", "0.59228516", "0.5917139", "0.59138995", "0.5898674", "0.58877987", "0.58877987", "0.58877987" ]
0.7375513
0
BizForm::CopyRecord() Copy current record and paste to a new record Note: copy record will error out if db table uses composite columns as its primary key
public function CopyRecord() { $rec = $this->GetActiveRecord(); if (!$rec) return; foreach ($rec as $k=>$v) $rec[$k] = addslashes($v); global $g_BizSystem; // get new record array $recArr = $this->GetDataObj()->NewRecord(); $rec["Id"] = $recArr["Id"]; // replace with new Id field. TODO: consider different ID generation type $this->m_RecordRow->SetRecordArr($rec); $ok = $this->GetDataObj()->InsertRecord($rec); if (!$ok) return $this->ProcessDataObjError($ok); return $this->ReRender(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clone_record($db_table) {\n $db_obj = new db_class();\n $typeHash = $db_obj->columnTypeHash($this->table_title);\n \n $sql = 'INSERT INTO ' . $this->table_title ;\n $typeList = '';\n $columns = ' (' ;\n $values = '(' ;\n $paramList = array();\n $count = 0;\n \n foreach($db_table as $key => $value) {\n if($count > 0){ \n $columns .= ',' ; \n $values .= ',';\n }\n $columns .= $key;\n $values .= '?';\n $paramList[] = $value;\n $typeList .= $typeHash[$key];\n \n $count++;\n }\n \n $columns .= ')';\n $values .= ')';\n $sql .= $columns . ' VALUES ' . $values;\n \n showArray(array($sql, $typeList, $paramList));\n \n $db_obj->closeDB();\n \n }", "public function copy() {\n\n\t\t// check authorization, abort if negative\n\t\t$this->isAuthorized() or $this->abortUnauthorized();\n\n\t\t// check type\n\t\t$responseType = (KRequest::getString('show_list') == '1') ? 'list' : 'json';\n\n\t\t// set ids or just one id\n\t\t$id = KRequest::getInt('id');\n\t\t$ids = KRequest::getString('ids');\n\n\t\t// The system takes in 'id' or 'ids'. In either case, we make an array $ids for looping later\n\t\tif(!empty($ids)) {\n\t\t\t$ids = explode(',', $ids);\n\t\t}\n\t\telseif($id){\n\t\t\t$ids = [$id];\n\t\t}\n\t\telse $ids = [];\n\n\t\t// Cast all IDs to int for sanitation\n\t\tforeach ($ids as &$id) {\n\t\t\t$id = intval($id);\n\t\t}\n\t\tunset($id);\n\n\t\t// Set the mime type for the response for JSON response\n\t\tif($responseType == 'json') {\n\t\t\tKenedoPlatform::p()->setDocumentMimeType('application/json');\n\t\t}\n\n\t\t// Bounce if no record ID came in\n\t\tif(empty($ids)) {\n\n\t\t\tif($responseType == 'json') {\n\t\t\t\techo json_encode(array(\n\t\t\t\t\t'success' => false,\n\t\t\t\t\t'errors' => array(KText::_('Please select a record to copy')),\n\t\t\t\t));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$error = KText::_('Please select a record to copy');\n\t\t\t\tKenedoPlatform::p()->sendSystemMessage($error, 'error');\n\t\t\t\tKenedoViewHelper::addMessage($error, 'error');\n\t\t\t\t$this->display();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tKLog::log('Starting copying data for Controller \"' . get_class($this) . '\". - ' . KLog::time('ModelCopyMethod'), 'custom_copying');\n\n\t\t// Start a transaction, if any record fails to copy, we roll back all DB changes.\n\t\tKLog::log('Controller '.get_class($this). ' starts its transaction.', 'custom_copying');\n\t\tKenedoPlatform::getDb()->startTransaction();\n\n\t\ttry {\n\n\t\t\t$newId = null;\n\t\t\t$newIds = array();\n\n\t\t\t// Get the model and the record we gotta copy\n\t\t\t$model = $this->getDefaultModel();\n\t\t\t// Prepare the language tags\n\t\t\t$languageTags = KenedoLanguageHelper::getActiveLanguageTags();\n\n\t\t\t// loop trough ids\n\t\t\tforeach ($ids as $id) {\n\n\t\t\t\t$record = $model->getRecord($id);\n\n\t\t\t\t// Until we got a better way, assume there is a title (or otherwise a name) and append 'Copy' to it\n\t\t\t\tforeach ($languageTags as $languageTag) {\n\n\t\t\t\t\tif (!empty($record->{'title-' . $languageTag})) {\n\t\t\t\t\t\t$record->{'title-' . $languageTag} = $record->{'title-' . $languageTag} . ' (' . KText::_('COPY_NOUN') . ')';\n\t\t\t\t\t}\n\t\t\t\t\telseif (!empty($record->{'name-' . $languageTag})) {\n\t\t\t\t\t\t$record->{'name-' . $languageTag} = $record->{'name-' . $languageTag} . ' (' . KText::_('COPY_NOUN') . ')';\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// Copy the record, $response will be false or the ID of the new record\n\t\t\t\t$response = $model->copy($record);\n\n\t\t\t\t// If things went bad, report (logging already happened in the model)\n\t\t\t\tif ($response === false) {\n\t\t\t\t\t$error = 'Record '.$record->id.' failed to copy, error messages from model are: ' . implode(', ', $model->getErrors());\n\t\t\t\t\tthrow new Exception($error);\n\t\t\t\t}\n\n\t\t\t\t// Prepare new record id and controller name\n\t\t\t\t$newIds[] = $newId = $response;\n\n\t\t\t}\n\n\t\t\t// success\n\t\t\tKLog::log('Controller '.get_class($this). ' commits its transaction.', 'custom_copying');\n\t\t\tKenedoPlatform::getDb()->commitTransaction();\n\n\t\t\t$controllerName = KenedoController::getControllerNameFromClass(get_class($this));\n\n\t\t\t// Purge the cache\n\t\t\t$this->purgeCache();\n\n\t\t\t// Deliver the good news\n\t\t\tif($responseType == 'json') {\n\t\t\t\techo json_encode(array(\n\t\t\t\t\t'success' => true,\n\t\t\t\t\t'messages'=>array(KText::_('Records copied')),\n\t\t\t\t\t'newId' => $newId,\n\t\t\t\t\t'newIds' => $newIds,\n\t\t\t\t\t'redirectUrl' => KLink::getRoute('index.php?option=' . $this->component . '&controller=' . $controllerName . '&task=edit&id=' . $newId, false),\n\t\t\t\t));\n\t\t\t}\n\t\t\telseif($responseType == 'list'){\n\t\t\t\t$msg = KText::_('Records copied.');\n\t\t\t\tKenedoPlatform::p()->sendSystemMessage($msg, 'notice');\n\t\t\t\tKenedoViewHelper::addMessage($msg, 'notice');\n\t\t\t\t$this->display();\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\t\tcatch (Exception $e) {\n\n\t\t\tKLog::log($e->getMessage(), 'error');\n\t\t\tKLog::log($e->getMessage(), 'custom_copying');\n\t\t\tKLog::log('Controller '.get_class($this). ' rolls back its transaction.', 'custom_copying');\n\n\t\t\tKenedoPlatform::getDb()->rollbackTransaction();\n\n\t\t\t// Purge the cache\n\t\t\t$this->purgeCache();\n\n\t\t\t$errorMsg = KText::_('A system error occurred during copying. Diagnostic data is in the ConfigBox error log. Please notify your service provider.');\n\t\t\t// error response\n\t\t\tif ($responseType == 'json') {\n\t\t\t\techo json_encode(array(\n\t\t\t\t\t'success' => false,\n\t\t\t\t\t'errors' => [$errorMsg],\n\t\t\t\t));\n\t\t\t} elseif ($responseType == 'list') {\n\t\t\t\tKenedoPlatform::p()->sendSystemMessage($errorMsg, 'error');\n\t\t\t\tKenedoViewHelper::addMessage($errorMsg, 'error');\n\t\t\t\t$this->display();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n }", "function copy()\n\t{\n\t\tJSession::checkToken() or jexit( 'Invalid Token' );\n\n\t\t$cid = JFactory::getApplication()->input->get('cid',array(0),'array');\n\n\t\t$model = $this->getModel('fields');\n\n\t\tif(!$model->copy( $cid )) {\n\t\t\tthrow new Exception(JText::_('COM_FLEXIMPORT_FIELDS_COPY_FAILED'), 400);\n\t\t} else {\n\t\t\t$msg = JText::_('COM_FLEXIMPORT_FIELDS_COPY_SUCCESS');\n\t\t\t$cache = JFactory::getCache('com_fleximport');\n\t\t\t$cache->clean();\n\t\t}\n\t\t$this->setRedirect('index.php?option=com_fleximport&view=fields', $msg );\n\t}", "function Copy(&$data){\n // -- get storage\n $storageName = $this->listSettings->GetItem(\"MAIN\", \"TABLE\");\n $this->Kernel->ImportClass(\"data.\" . $storageName, $storageName);\n $Storage = new $storageName($this->Kernel->Connection, $this->Kernel->Settings->GetItem(\"database\", $storageName));\n\n //return;\n //-- get copy field name\n if ($this->listSettings->HasItem(\"MAIN\", \"COPY_NAME_FIELD\")) {\n $_name_field = $this->listSettings->GetItem(\"MAIN\", \"COPY_NAME_FIELD\");\n }\n else {\n $_name_field = TableHelper::GetFirstNotKeyColumn($Storage);\n }\n\n $this->copy_Storage = $Storage;\n // insert loop\n foreach ($data as $i => $item_id) {\n //get record\n $record = $Storage->Get(array(\n $this->key_field => $item_id));\n //get copy records count\n $_count = $Storage->GetCount(array(\n $_name_field => $record[$_name_field] . \" (%)\"));\n\n $_count ++;\n $record[$_name_field] = $record[$_name_field] . \" ($_count)\";\n //insert record\n\n\n $Storage->Insert($record);\n\n // get ID of inserted record\n $insert_id = $Storage->getInsertId();\n // get priority column\n if ($this->listSettings->HasItem(\"Main\", \"COPY_NAME_FIELD\")) {\n $priority_column = $this->listSettings->GetItem(\"Main\", \"COPY_NAME_FIELD\");\n }\n elseif ($Storage->HasColumn(\"_priority\")) {\n $priority_column = \"_priority\";\n }\n\n if (strlen($priority_column)) { // if priority column exists\n $priority_data = array(\n $this->key_field => $insert_id ,\n $priority_column => $insert_id);\n if (count($unique_fields)) { // if unique fields is found\n foreach ($unique_fields as $i => $ufield) {\n if ($ufield != $_name_field)\n $priority_data[$ufield] = $record[$ufield] . \" (\" . $insert_id . \")\";\n }\n }\n // update priority and unique field\n $Storage->Update($priority_data);\n }\n\n if ($this->listSettings->HasItem(\"MAIN\", \"USE_SUB_CATEGORIES\")) {\n $use_sub_categories = $this->listSettings->GetItem(\"MAIN\", \"USE_SUB_CATEGORIES\");\n }\n else {\n $use_sub_categories = false;\n }\n\n //--if library use subcategories\n if ($use_sub_categories) {\n $message = \"\";\n $sub_categories_count = $this->listSettings->GetItem(\"MAIN\", \"SUB_CATEGORIES_COUNT\");\n // subcategories loop\n for ($i = 0; $i < sizeof($sub_categories_count); $i ++) {\n // get library settings\n $library = $this->listSettings->GetItem(\"sub_category_\" . $i, \"APPLY_LIBRARY\");\n $link_field = $this->listSettings->GetItem(\"sub_category_\" . $i, \"LINK_FIELD\");\n // get subcategory library config\n $sub_listSettings = Engine::getLibrary($this->Kernel, $library, \"sub_ListSettings_\" . $library);\n\n //-- get subcategory storage\n $sub_table = $sub_listSettings->GetItem(\"MAIN\", \"TABLE\");\n $this->Kernel->ImportClass(\"data.\" . strtolower($sub_table), $sub_table);\n $sub_Storage = new $sub_table($this->Kernel->Connection, $this->Kernel->Settings->GetItem(\"database\", $sub_table));\n\n //--get subcategory items\n $list = $sub_Storage->GetList(array(\n $link_field => $item_id));\n\n //-- get priority column\n $priority_column = \"\";\n if ($sub_listSettings->HasItem(\"Main\", \"COPY_NAME_FIELD\")) {\n $priority_column = $sub_listSettings->GetItem(\"Main\", \"COPY_NAME_FIELD\");\n }\n elseif ($sub_Storage->HasColumn(\"_priority\")) {\n $priority_column = \"_priority\";\n }\n //--get unique columns\n $unique_fields = array();\n if ($sub_listSettings->HasItem(\"MAIN\", \"UNIQUE_FIELDS\")) {\n $unique_fields = explode(\",\", $sub_listSettings->GetItem(\"MAIN\", \"UNIQUE_FIELDS\"));\n }\n // get subcategory key field\n $sub_keyfields = $sub_Storage->getKeyColumns();\n $sub_keyfield = $sub_keyfields[0][\"name\"];\n\n if ($list->RecordCount != 0) {\n while ($sub_item = $list->Read()) {\n $sub_item[$link_field] = $insert_id;\n\n // insert subcategory\n $sub_Storage->Insert($sub_item);\n\n //get inserted subcategory ID\n $sub_list = $sub_Storage->GetList(array(), array(\n $sub_keyfield => 0), 1, 0);\n $sub_item = $sub_list->Read();\n $sub_insert_id = $sub_item[$sub_keyfield];\n if (strlen($priority_column)) { // if priority column exists\n $priority_data = array(\n $sub_keyfield => $sub_insert_id ,\n $priority_column => $sub_insert_id);\n if (count($unique_fields)) { // if unique fields is found\n foreach ($unique_fields as $i => $ufield) {\n if ($ufield != $_name_field)\n $priority_data[$ufield] = $sub_item[$ufield] . \" (\" . $sub_insert_id . \")\";\n }\n }\n // update priority and unique fields\n $sub_Storage->Update($priority_data);\n }\n }\n }\n } // for\n }\n $this->OnAfterCopy($item_id, $insert_id);\n }\n }", "public static function cloneRecord($table, array $fields, $where_clause, array $changeset = null, $primary_key_field = 'id')\n\t{\n\t\t$fields_list = implode(',', $fields);\n\t\t\n\t\t$create_sql = <<<SQL\nINSERT INTO {$table}({$fields_list})\nSELECT {$fields_list} FROM {$table}\nWHERE {$where_clause}\nSQL;\n\t\t\n\t\tself::exec($create_sql);\n\t\t\n\t\t$cloned_row_id = self::lastInsertId();\n\t\t\n\t\tif(!is_null($changeset))\n\t\t{\n\t\t\t$change_list_parts = array();\n\t\t\t\n\t\t\tforeach($changeset as $field => $value)\n\t\t\t{\n\t\t\t\t$change_list_parts[] = \"{$field} = {$value}\";\n\t\t\t}\n\t\t\t\n\t\t\t$change_list = implode(',', $change_list_parts);\n\t\t\t\n\t\t\t$change_sql = <<<SQL\nUPDATE {$table} SET {$change_list}\nWHERE {$primary_key_field} = {$cloned_row_id}\nSQL;\n\t\t\n\t\t\tMySQL::exec($change_sql);\n\t\t}\n\t\t\n\t\treturn $cloned_row_id;\n\t}", "function copy()\n\t{\n\t\tif (count($_POST[\"p_id\"]) > 0)\n\t\t{\n\t\t\tforeach ($_POST[\"p_id\"] as $key => $value)\n\t\t\t{\n\t\t\t\t$this->object->copyToClipboard($value);\n\t\t\t}\n\t\t\tilUtil::sendInfo($this->txt(\"copy_insert_clipboard\"), true);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tilUtil::sendInfo($this->txt(\"copy_select_none\"), true);\n\t\t}\n\t\t$this->ctrl->redirect($this, \"pairs\");\n\t}", "public function actionCopy()\n\t{\n\t\t$id=$_GET['id'];\n\t\t$model=$this->loadModel($id);\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\n\t\tif(isset($_POST['Knowledgecatalogue']))\n\t\t{\n\t\t\t$createmodel=new Knowledgecatalogue;\n\t\t\t$createmodel->attributes=$_POST['Knowledgecatalogue'];\n\t\t\tif($createmodel->save())\n\t\t\t\t$this->redirect(array('view','id'=>$createmodel->fCatalogueNo));\n\t\t}\n\n\t\t$this->render('copy',array(\n\t\t\t'model'=>$model,\n\t\t));\n\t}", "private static function duplicateRecord($from, $to) {\n $fields = $from->as_array();\n unset($fields['id']);\n foreach ($fields as $name => $value) {\n $to->$name = $value;\n }\n\n return $to;\n }", "public function copyRecord($record, RecordType $record_type, $record_has_inactive = false): array\n {\n $ret_val = ['system_error' => false, 'edit_url' => null];\n\n // Get base table copy\n /** @var Product $copied_record */\n $copied_record = $record->replicate(['slug', 'default_item_id', 'cached_options']);\n $copied_record->slug = $record->slug . '-' . time();\n\n if($record_has_inactive)\n {\n $copied_record->is_inactive = true;\n }\n\n $copied_record->save();\n $sku_counter = time();\n\n // Copy default item\n /** @var Item $default_item_copy */\n $default_item_copy = $record->default_item->replicate(['sku', 'upc']);\n $default_item_copy->sku = 'copy-' . $sku_counter;\n $default_item_copy->product()->associate($copied_record);\n $default_item_copy->save();\n $copied_record->default_item()->associate($default_item_copy);\n $copied_record->save();\n\n // Copy item stock locations\n /** @var RelStockLocationItem $stock_location_item */\n foreach($default_item_copy->rel_stock_location_items as $stock_location_item)\n {\n /** @var RelStockLocationItem $default_stock_loc_item_copy */\n $default_stock_loc_item_copy = $stock_location_item->replicate(['item_id']);\n $default_stock_loc_item_copy->item()->associate($default_item_copy);\n $default_stock_loc_item_copy->save();\n }\n\n // Copy categories\n /** @var RelProductProductCategory $rel_product_category */\n foreach($record->categories as $rel_product_category)\n {\n /** @var RelProductProductCategory $new_rel_product_category */\n $new_rel_product_category = $rel_product_category->replicate(['product_id']);\n $new_rel_product_category->product()->associate($copied_record);\n $new_rel_product_category->save();\n }\n\n // Copy items\n /** @var Item $non_default_item */\n $idx = 1;\n foreach($record->non_default_items as $non_default_item)\n {\n /** @var Item $non_default_item_copy */\n $non_default_item_copy = $non_default_item->replicate(['product_id', 'upc', 'sku']);\n $non_default_item_copy->sku = 'copy-' . ($sku_counter + $idx);\n $non_default_item_copy->product()->associate($copied_record);\n $non_default_item_copy->save();\n\n File::copyDirectory(business('site_root') . '/storage/app/public/content-img/products/items/' . $non_default_item->id,\n business('site_root') . '/storage/app/public/content-img/products/items/' . $non_default_item_copy->id);\n\n // Update stock locations\n foreach($non_default_item->rel_stock_location_items as $stock_location_item)\n {\n /** @var RelStockLocationItem $non_default_stock_loc_item */\n $non_default_stock_loc_item = $stock_location_item->replicate(['item_id']);\n $non_default_stock_loc_item->item()->associate($non_default_item_copy);\n $non_default_stock_loc_item->save();\n }\n\n $idx++;\n }\n\n // Move images\n File::copyDirectory(business('site_root') . '/storage/app/public/content-img/products/' . $record->id,\n business('site_root') . '/storage/app/public/content-img/products/' . $copied_record->id);\n\n $ret_val['edit_url'] = $record_type->edit_url . '/' . $copied_record->id;\n\n return $ret_val;\n }", "public function copy($cap = false, $generateNewId = true)\n\t{\n\t\t//refresh the ID attribute.\n\t\t$rows = $this->getRows();\n\t\t$this->row['id'] = $rows['id'];\n\n\t\treturn $this->create($cap, $generateNewId);\n\t}", "public function actionCopy()\n\t{\n\t\t$id=$_GET['id'];\n\t\t$model=Cooperativepartner::model()->with('company')->findByPk($id);\n\t\tif(isset($_POST['Cooperativepartner']))\n\t\t{\n\t\t\t$newpartner=new Cooperativepartner();\n\t\t\t$newpartner->attributes=$_POST['Cooperativepartner'];\n\t\t\t$newpartner->fCooperativePartnerID=GuidUtil::getUuid();\n\t\t\tif(!empty($_POST['fCooperativeCompanyID'])) \n\t\t\t\t$newpartner->fCooperativeCompanyID= $_POST['fCooperativeCompanyID'];\n\t\t\telse $newpartner->fCooperativeCompanyID=$this->loadModel($id)->fCooperativeCompanyID;\n\t\t\t$newpartner->fEducationalLevel= $_POST['EducationalLevel'];\n\t\t\t$newpartner->fCreateUser=Yii::app()->params->loginuser->fUserName;\n\t\t\t$newpartner->fCreateDate=time();\n\t\t\tif($newpartner->save())\n\t\t\t\t$this->redirect(array('view','id'=>$newpartner->fCooperativePartnerID));\n\t\t}\n\t\t$model->fCooperativeCompanyID=empty($model->company->fCooperativeCompanyID)?'':$model->company->fCooperativeCompanyName;\n\t\t$model->fEducationalLevel=array_key_exists($model->fEducationalLevel,adminSettings::$EducationLevel)?adminSettings::$EducationLevel[$model->fEducationalLevel]:'';\n\t\t$this->render('copy',array(\n\t\t\t'model'=>$model,'EducationLevel'=>adminSettings::$EducationLevel,'Sex'=>adminSettings::$Sex\n\t\t));\n\t}", "function copy() {\n\t\tdefined('_JEXEC') or die('Invalid Token');\n\t\t$option = clm_core::$load->request_string('option', '');\n\t\t$section = clm_core::$load->request_string('section', '');\n\t\t$this->setRedirect('index.php?option=' . $option . '&section=' . $section);\n\t\t$cid = clm_core::$load->request_array_int('cid');\n\t\t$db = JFactory::getDBO();\n\t\t$table = JTable::getInstance('saisons', 'TableCLM');\n\t\t$user = JFactory::getUser();\n\t\t$n = count($cid);\n\t\tif ($n > 0) {\n\t\t\tforeach ($cid as $id) {\n\t\t\t\tif ($table->load((int)$id)) {\n\t\t\t\t\t$table->id = 0;\n\t\t\t\t\t$table->name = 'Kopie von ' . $table->name;\n\t\t\t\t\t$table->published = 0;\n\t\t\t\t\tif (!$table->store()) {\n\t\t\t\t\t\t$this->setMessage($table->getError(), 'warning');\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$this->setMessage($table->getError(), 'warning');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t$this->setMessage(JText::_('SAISON_NO_SELECT'), 'warning');\n\t\t\treturn;\n\t\t}\n\t\tif ($n > 1) {\n\t\t\t$msg = JText::_('SAISON_MSG_ENTRYS_COPY');\n\t\t} else {\n\t\t\t$msg = JText::_('SAISON_MSG_ENTRY_COPY');\n\t\t}\n\t\t// Log schreiben\n\t\t$clmLog = new CLMLog();\n\t\t$clmLog->aktion = JText::_('SAISON_AKTION_SEASON_COPY');\n\t\t$clmLog->params = array('sid' => $cid[0], 'cids' => implode(',', $cid));\n\t\t$clmLog->write();\n\t\t$this->setMessage(JText::_($n . $msg));\n\t}", "function insert_record()\n\t{\n\t $dbname=$this->dbname;\n\t $DB1=$this->__connect($dbname,$this->table_name);\n $fields_data=$this->__list_fields_data($dbname,$this->table_name);\n // echo_array($fields_data);\n $index=$this->_get_primary($fields_data);\n //echo $index;\n //echo_array($_POST);\n \n \n //since we are coming from a form there\n //are $_POST values\n foreach ($fields_data->name as $key=>$value)\n {\n $data[$value['name']]=$_POST[$value['name']];\n }\n\n //needs checking if a FOREIGN FIELD\n //insert into database \n $this->db->insert($this->table_name, $data);\n\n $keys=(array_keys($data));\n $values=(array_values($data));\n\n //prepare some data for the form controls\n //in this case the Tdataset control\n \n $i=0;\n $num_fields=count($keys);\n for ($i=0;$i<$num_fields;$i++){\n $this->table->add_row($keys[$i],$values[$i]);\n }\n $this->table->set_heading('field','Value');\n $this->table->set_caption('Insert');\n $this->table->set_template($this->tmpl);\n $s=$this->table->generate();\n $s.='<a href=\"http://localhost/CodeIgniter/admin/dbutil/browse/'.$dbname.'/'.$this->table_name.'\">Click to Edit More</a>';\n return $s;\n\t}", "public function copycurrentrow()\n\t{\n\t\t// 1005 = Copy Profile\n\t\t$reasonID = 1005; // copy profile\n\t\treturn $this->copyrow($this->id, $reasonID);\n\t}", "function db_copy_data($conn, $table, $where, $fields=\"ID\", $values=\"0\") {\n\t$sql = \"select * from $table where $where\";\n\t$result = db_exec($conn, $sql);\n\t$n = mysql_num_fields($result);\n\t$except_fields = explode(',', $fields);\n\t$set_values = explode(',', $values);\n\t$c = count($except_fields);\n\tfor ($i=0; $i<$n; $i++) {\n\t\t$f = mysql_field_name($result, $i);\n\t\t$except = false;\n\t\tfor ($j=0; $j<$c; $j++) {\n\t\t\tif ($f==trim($except_fields[$j])) {\n\t\t\t\t$except = true;\n\t\t\t\t$field_array[] = $set_values[$j].\" as `\".$f.\"`\";\n\t\t\t}\n\t\t}\n\t\tif (!$except) $field_array[] = \"`\".$f.\"`\";\n\t}\n\tdb_free($result);\n\t$field_list = implode(\",\", $field_array);\n\t$sql = \"insert into $table select $field_list from $table where $where\";\n\tdb_exec($conn, $sql);\n\treturn mysql_insert_id();\n}", "public function insertAsParentOf(Doctrine_Record $dest);", "public function prepareRecord()\n {\n // Get specific record\n $requestParameters = $this->Request->all();\n $Model = clone $this->Model;\n if (request('action') == \"view\") {\n // Hook Filter viewModifyRecord\n $Model = $this->doFilter(\"viewPrepareRecord\", $Model);\n } else {\n $Model = $this->doFilter(\"prepareRecord\", $Model);\n }\n foreach ($requestParameters['indexes'] as $column => $value) {\n $Model = $Model->where($column, '=', $value);\n }\n $record = $Model->first();\n // Is valid record\n if (!$record) {\n // Redirect to List Page\n // Set session flash for notify Entry is not exist\n return redirect($this->getFormAction())\n ->with('dk_' . $this->getIdentifier() . '_info_error', trans('dkscaffolding.no.entry'));\n }\n $this->Model->setRawAttributes($record->getAttributes(), true);\n }", "public function copyAttributesToKey()\n\t{\n\t\t$primarykey = $this->factory->getPrimarykey ;\n\t\tforeach( $primarykey->fields as $n=>$field )\n\t\t{\n\t\t\t$this->key[$field] = $this->$field ;\n\t\t}\n\t}", "function editRecord($rec)\r\n\t\t{\r\n\t\t\t// Create associative array of key fields and data values\r\n\t\t\t$data = array(\"idMedicalRecord\"=>$rec[0],\"medicalRec_weight\"=>$rec[1],\"medicalRec_height\"=>$rec[2],\"medicalRec_bloodPressure\"=>$rec[3],\"medicalRec_temperature\"=>$rec[4],\"medicalRec_bloodIronLevel\"=>$rec[5],\"medicalRec_time\"=>$rec[6],\"medicalRec_date\"=>$rec[7],\"medicalRec_medicalHistory\"=>$rec[8],\"medicalRec_rejectionReason\"=>$rec[9]);\r\n\t\t\t// Bind values to object's attributes\r\n\t\t\t$this->bind($data);\r\n\t\t\t// Add new updated values to table in database to location of given Primary key\r\n\t\t\t$this->update($rec[0]);\r\n\t\t}", "function doCOPY() {\n\tglobal $description_obj;\n\tglobal $table_name, $class_name;\n\tglobal $tabs, $tab2, $tab3;\n\n\t// fComment2($tab2,\"if \\$obj is set, update class members\");\n\n\techo \"\\n\";\n\t$c = array('copy an object to the local members', '',\n\t\t\t\t\"@param mixed \\$obj\\tthe object to copy.\");\n\n\tfFuncStart(\"copy(\\$obj)\", $c);\n\n\techo $tab2,\"if (\\$obj == null)\\n\",\n\t\t $tab3,\"return;\\n\";\n\n\techo \"\\n\",\n\t\t $tab2,\"foreach(\\$obj as \\$key => \\$val) {\\n\",\n\t\t \t$tab3,\"\\$this->\\$key = \\$val;\\n\",\n\t\t $tab2,\"}\\n\";\n\n\tfFuncEnd();\n\n}", "public function insertAsFirstChildOf(Doctrine_Record $dest);", "private function copyData()\n {\n $connection = Yii::app()->db;\n $transaction = $connection->beginTransaction();\n try {\n $connection->createCommand('INSERT INTO ' . $connection->quoteTableName($this->tableMemory) . ' SELECT * FROM ' . $connection->quoteTableName($this->table))->execute();\n $transaction->commit();\n return true;\n } catch (Exception $e) {\n Yii::log('Transaction error: ' . print_r($e->getMessage(), true), 'error', 'extensions.CodMtfs.Mtfs');\n $transaction->rollback();\n }\n }", "protected function copySingleObject()\n\t{\n\t\tinclude_once('./Services/Link/classes/class.ilLink.php');\n\t\tinclude_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');\n\t\t\n\t\tglobal $ilAccess,$ilErr,$rbacsystem,$ilUser,$ilCtrl,$rbacreview;\n\n\t\t// Source defined\n\t\tif(!$this->getSource())\n\t\t{\n\t\t\tilUtil::sendFailure($this->lng->txt('select_one'),true);\n\t\t\t$ilCtrl->returnToParent($this);\n\t\t}\n\n\t\t$this->copyMultipleNonContainer(array($this->getSource()));\n\n\t\treturn;\n\n\t// old implementation\n\n\n\n\t\t// Create permission\n\t \tif(!$rbacsystem->checkAccess('create', $this->getTarget(), $this->getType()))\n\t \t{\n\t \t\tilUtil::sendFailure($this->lng->txt('permission_denied'),true);\n\t\t\t$ilCtrl->returnToParent($this);\n\t \t}\n\t\t// Source defined\n\t\tif(!$this->getSource())\n\t\t{\n\t\t\tilUtil::sendFailure($this->lng->txt('select_one'),true);\n\t\t\t$ilCtrl->returnToParent($this);\n\t\t}\n\t\t// Copy permission\n\t\tif(!$ilAccess->checkAccess('copy','',$this->getSource()))\n\t\t{\n\t \t\tilUtil::sendFailure($this->lng->txt('permission_denied'),true);\n\t\t\t$ilCtrl->returnToParent($this);\n\t\t}\n\t\t\n\t\t// Save wizard options\n\t\t$copy_id = ilCopyWizardOptions::_allocateCopyId();\n\t\t$wizard_options = ilCopyWizardOptions::_getInstance($copy_id);\n\t\t$wizard_options->saveOwner($ilUser->getId());\n\t\t$wizard_options->saveRoot((int) $this->getSource());\n\t\t\n\t\t/*\n\t\t$options = $_POST['cp_options'] ? $_POST['cp_options'] : array();\n\t\tforeach($options as $source_id => $option)\n\t\t{\n\t\t\t$wizard_options->addEntry($source_id,$option);\n\t\t}\n\t\t*/\n\t\t\n\t\t$wizard_options->read();\n\t\t\n\t\t$orig = ilObjectFactory::getInstanceByRefId((int) $this->getSource());\n\t\t$new_obj = $orig->cloneObject($this->getTarget(),$copy_id);\n\t\t\n\t\t// Delete wizard options\n\t\t$wizard_options->deleteAll();\n\n\t\t// rbac log\n\t\tinclude_once \"Services/AccessControl/classes/class.ilRbacLog.php\";\n\t\tif(ilRbacLog::isActive())\n\t\t{\n\t\t\t$rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);\n\t\t\t$rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);\n\t\t\tilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int)$this->getSource());\n\t\t}\n\n\t\tilUtil::sendSuccess($this->lng->txt(\"object_duplicated\"),true);\n\t\tilUtil::redirect(ilLink::_getLink($new_obj->getRefId()));\n\t}", "public function actionCopy()\n\t{\n\t\t$id=$_GET['id'];\n\t\t$model=$this->loadModel($id);\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\n\t\tif(isset($_POST['Companyorganisation']))\n\t\t{\n\t\t\t$createmodel=new Companyorganisation;\n\t\t\t$createmodel->attributes=$_POST['Companyorganisation'];\n\t\t\tif($createmodel->save())\n\t\t\t\t$this->redirect(array('view','id'=>$createmodel->fOrgNo));\n\t\t}\n\n\t\t$this->render('copy',array(\n\t\t\t'model'=>$model,\n\t\t));\n\t}", "public function actionCopy()\n\t{\n\n\n\t\t$id=$_GET['id'];\n\t\t$model=$this->loadModel($id);\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\n\t\tif(isset($_POST['Templetstandardtask']))\n\t\t{\n\t\t\t$createmodel=new Templetstandardtask;\n\t\t\t$createmodel->attributes=$_POST['Templetstandardtask'];\n\t\t\tif($createmodel->save())\n\t\t\t\t$this->redirect(array('view','id'=>$createmodel->fTaskNo));\n\t\t}\n\n\t\t$this->render('copy',array(\n\t\t\t'model'=>$model,\n\t\t));\n\t}", "function &postCopy () {\n \t\t/* override to copy fields as necessary to complete the full copy. */\n \t\treturn $this;\n \t}", "protected function mergeNewRecordData()\n\t{\n\t\tif( !$this->auditObj && !$this->eventsObject->exists(\"AfterEdit\") )\n\t\t\treturn;\n\n\t\tforeach($this->getOldRecordData() as $f => $v)\n\t\t{\n\t\t\tif( !isset( $this->newRecordData[ $f ] ) )\n\t\t\t\t$this->newRecordData[ $f ] = $v;\n\t\t}\n\t}", "function copy_article($newlyPlanId,$plan_id){\n \n {//Plan_Article Block\n \n $queryPlanArticle = \"SELECT * FROM plan_article WHERE status = 1 AND plan_id = '{$plan_id}' \" ;\n $resultPlanArticle = $this->execute_query($queryPlanArticle);\n \n if($this->num_rows($resultPlanArticle)!= 0)\n {\n while($row = $this->fetch_array($resultPlanArticle))\n { \n \n $insertArr = array(\n 'plan_id'=> $newlyPlanId,\n 'article_id' => $row['article_id'], \n 'creation_date' => date('Y-m-d H:i:s',time()), \n 'status'=> $row['status'] \n );\n \n $result = $this->insert('plan_article',$insertArr);\n \n }\n }\n }\n }", "public function duplicate() {\n \t\t\n \t\ttry {\n\t\t\t\n\t \t\t// start duplicate\n\t\t\t$class = get_class($this);\n \t\t\t$duplicate = new $class;\n \t\t\t\n\t \t\t// duplicate row fields\n\t \t\t$this->duplicateRow($duplicate);\n\t \t\t\n \t\t\t// duplicate data\n\t \t\t$this->duplicateData($duplicate);\n\t \t\t\n\t \t\t// duplicate items\n\t \t\t$this->duplicateChildren($duplicate);\n\t \t\t\n\t \t\t$duplicate->setDuplicate($this->getId());\n \t\t\n \t\t\treturn $duplicate;\n \t\t\t\n \t\t} catch (Exception $e) {\n \t\t\n \t\t\treturn false;\n \t\t\t\n \t\t}\n \t\t\n \t}", "public function recInsert($record) {\n $conn = Query::connect();\n $col = $conn->SelectLimit(\"select*from \".static::getTable(),1);\n $sql = $conn->GetInsertSQL($col,$record);\n $rs = $conn->Execute($sql);\n return $conn->ErrorNo();\n }" ]
[ "0.6525337", "0.6165195", "0.6137295", "0.60140705", "0.59805375", "0.5928032", "0.5911303", "0.58938324", "0.5869956", "0.5857455", "0.58397734", "0.57352066", "0.565873", "0.5641316", "0.5585916", "0.55501807", "0.5508207", "0.54714197", "0.54597795", "0.54578537", "0.54333246", "0.5395518", "0.5358069", "0.5357186", "0.5354951", "0.53295714", "0.5322125", "0.5317704", "0.5296943", "0.52742183" ]
0.8193739
0
BizForm::InputValToRule() convert the user input on a given fieldcontrol in qeury mode to search rule
protected function InputValToRule($field, $inputVal) { // todo: should check single quote for nonoperators clauses // find locations for all sql key words // search for starting ' and closing ' pair, check if sql key word in the pair $val = trim($inputVal); // check " AND ", " OR " if (($pos=strpos(strtoupper($val), " AND "))!==false) { $inputArr = spliti(" AND ", $val); $retStr = null; foreach($inputArr as $v) $retStr .= ($retStr) ? " AND ".$this->InputValToRule($field, $v) : $this->InputValToRule($field, $v); return $retStr; } else if (($pos=strpos(strtoupper($val), " OR "))!==false) { $inputArr = spliti(" OR ", $val); $retStr = null; foreach($inputArr as $v) $retStr .= ($retStr) ? " OR ".$this->InputValToRule($field, $v) : $this->InputValToRule($field, $v); return "(".$retStr.")"; } // check >=, >, <=, <, = if (($pos=strpos($val, "<>"))!==false || ($pos=strpos($val, "!="))!==false) { $opr = "<>"; $oprlen = 2; } else if (($pos=strpos($val, ">="))!==false) { $opr = ">="; $oprlen = 2; } else if (($pos=strpos($val, ">"))!==false) { $opr = ">"; $oprlen = 1; } else if (($pos=strpos($val, "<="))!==false) { $opr = "<="; $oprlen = 2; } else if (($pos=strpos($val, "<"))!==false) { $opr = "<"; $oprlen = 1; } else if (($pos=strpos($val, "="))!==false) { $opr = "="; $oprlen = 1; } if ($opr) { $val = trim(substr($val, $pos+$oprlen)); } if (strpos($val, "*") !== false) { $opr = "LIKE"; $val = str_replace("*", "%", $val); } //if (strpos($val, "'") !== false) { // not needed since addslashes() is called before // $val = str_replace("'", "\\'", $val); //} if (!$opr) $opr = "="; // unformat value to real value data $bizFld = $this->GetDataObj()->GetField($field); global $g_BizSystem; $realVal = $g_BizSystem->GetTypeManager()->FormattedStringToValue($bizFld->m_Type, $bizFld->m_Format, $val); return "[" . $field . "] " . $opr . " '" . $realVal . "'"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function prepareFieldValidationRule($field_validation_rule);", "protected function get_inputs_rules(){return $this->input['inputs_rules'];}", "protected function set_inputs_rules($val){ $this->input ['inputs_rules'] = $val;}", "function acf_validate_value($value, $field, $input)\n{\n}", "function getInputRules( $idx );", "abstract protected function filterFieldvalue();", "private function validateField($fieldName, $rule, $rule_value){\n \n switch(strtolower($rule)){\n\n case \"required\":\n if(strtolower($rule_value) == \"true\"){\n if(!Input::exists($fieldName) || !Input::entered($fieldName)){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" is required.\");\n }\n }\n break;\n \n case \"email\":\n if(strtolower($rule_value) == \"true\"){\n if( (Input::entered($fieldName)) && !filter_var(Input::get($fieldName), FILTER_VALIDATE_EMAIL)){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" is not a valid email address.\");\n }\n }\n break;\n \n case \"minlength\":\n if( (Input::entered($fieldName)) && strlen(Input::get($fieldName)) < $rule_value){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must be at least {$rule_value} characters long.\");\n }\n break;\n \n case \"maxlength\":\n if( (Input::entered($fieldName)) && strlen(Input::get($fieldName)) > $rule_value){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must not exceed {$rule_value} characters.\");\n }\n break;\n \n case \"rangelength\":\n list($min, $max) = explode(',', $rule_value);\n if( (Input::entered($fieldName)) && (strlen(Input::get($fieldName)) > (float)$max || strlen(Input::get($fieldName)) < (float)$min) ){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must be between {$min} and {$max} characters.\");\n }\n break;\n \n case \"min\":\n if( (Input::entered($fieldName)) && ((float)Input::get($fieldName) < (float)$rule_value)){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must be greater than or equal to {$rule_value}.\");\n }\n break;\n \n case \"max\":\n if( (Input::entered($fieldName)) && ((float)Input::get($fieldName) > (float)$rule_value)){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must be lesser than or equal to {$rule_value}.\");\n }\n break;\n \n case \"range\":\n list($min, $max) = explode(',', $rule_value);\n if( (Input::entered($fieldName)) && ((float)Input::get($fieldName) > (float)$max || (float)Input::get($fieldName) < (float)$min) ){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must be between {$min} and {$max}.\");\n }\n break;\n \n case \"equalto\":\n if( (Input::entered($fieldName)) && (Input::get($fieldName) !== Input::get($rule_value)) ){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" must match \" . $this->fieldName($rule_value) . \" field.\");\n }\n break;\n \n case \"date\":\n if(strtolower($rule_value) == \"true\"){\n if( (Input::entered($fieldName)) && !$this->validateDate(Input::get($fieldName), 'd/m/Y')){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" is not a valid URL.\");\n }\n }\n break;\n \n case \"url\":\n if(strtolower($rule_value) == \"true\"){\n if( (Input::entered($fieldName)) && !filter_var(Input::get($fieldName), FILTER_VALIDATE_URL)){\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" is not a valid date.\");\n }\n }\n break;\n \n case \"remote\": \n if( (Input::entered($fieldName)) && $this->get_data($rule_value) == \"false\"){\n //echo \"ERROR IS TRUE\";\n $this->addError($fieldName, $rule, $this->fieldName($fieldName) . \" is not valid.\");\n }\n break;\n \n } \n }", "function form_rule($field = '')\n {\n if (FALSE === ($OBJ =& _get_validation_object()))\n {\n return '';\n }\n\n return $OBJ->rule($field);\n }", "public function rules()\n\t{\n\t\t$defaults = array();\n\t\t$toggles = array();\n\t\t$custom = array();\n\t\t$required = array();\n\n\t\tforeach($this->searchFields as $field=>$data)\n\t\t{\n\t\t\t$type = $this->getSearchFieldType($field);\n\t\t\tif ($type == 'toggle')\n\t\t\t\t$toggles[] = $field;\n\t\t\telseif ($type == 'required')\n\t\t\t\t$required[] = $field;\n\t\t\telseif (empty($data['rule']) || !is_array($data['rule']))\n\t\t\t\t$defaults[] = $field;\n\n\t\t\tif (isset($data['rule']) && is_array($data['rule']))\n\t\t\t\t$custom[] = $data['rule'];\n\t\t}\n\n\t\treturn array_merge(array(\n\t\t\tarray(implode(', ', $required), 'required'),\n\t\t\tarray(implode(', ', $toggles), 'in', 'range' => array('Y','N','I')),\n\t\t\tarray(implode(', ', $defaults), 'length', 'max'=>200)\n\t\t), $custom);\n\t}", "function pewc_is_field_visible( $field_value, $rule, $required_value ) {\n\n\tif( $rule == 'is' || $rule == 'cost-equals' ) {\n\t\tif( is_array( $field_value ) ) { // Radio button values\n\t\t\treturn in_array( $required_value, $field_value );\n\t\t}\n\t\treturn $field_value == $required_value;\n\t} else if( $rule == 'is-not' ) {\n\t\tif( is_array( $field_value ) ) { // Radio button values\n\t\t\treturn ! in_array( $required_value, $field_value );\n\t\t}\n\t\treturn $field_value != $required_value;\n\t} else if( $rule == 'contains' ) {\n\t\treturn in_array( $required_value, $field_value );\n\t} else if( $rule == 'does-not-contain' ) {\n\t\treturn ! in_array( $required_value, $field_value );\n\t} else if( $rule == 'greater-than' || $rule == 'greater-than-equals' ) {\n\t\treturn $field_value >= $required_value;\n\t} else if( $rule == 'less-than' || $rule == 'less-than-equals' ) {\n\t\treturn $field_value <= $required_value;\n\t} else if ( $rule == 'cost-greater' ) {\n\t\treturn $field_value > $required_value;\n\t} else if ( $rule == 'cost-less' ) {\n\t\treturn $field_value < $required_value;\n\t}\n\n}", "public static function customRules($input, $rules){\r\n\t\t// It appends strings in before or after the string (example: 21 --> #21)\r\n\t\t// Input as Object {'fieldname': 'name-of-field', 'fieldvalue': 'Ein String'}\r\n\t\t// Setup as object {'fieldname': 'name-of-field', 'mode': ['before', 'after'], 'value': '#'}\r\n\t\t// returns string: #Ein String\r\n\t\t\r\n\t\tforeach($rules as $rule){\r\n\t\t\t$rule_fieldname = $rule->customfield_for_rule;\r\n\t\r\n\t\t\tif($rule_fieldname === $input->fieldname){\r\n\t\t\t\t// Break if we are not in the correct context (modal / card / always)\r\n\t\t\t\tif($rule->rule_target !== 'always' && $rule->rule_target !== $input->context) break;\r\n\r\n\t\t\t\t$setup = (object) ['mode' => $rule->rule_type, 'value' => $rule->rule_string_to_add, 'replacemode' => $rule->rule_string_replace_with, 'find' => $rule->rule_string_to_find, 'replace' => $rule->rule_string_to_replace ];\r\n\t\t\t\t// As function because we could make it bigger if necessary\r\n\t\t\t\t$html = self::applyBasicRule($input, $setup);\r\n\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t};\r\n\t\t};\r\n\t\t\r\n\t\tif(empty($html)) $html = trim($input->fieldvalue);\r\n\t\r\n\t\treturn $html;\r\n\t\r\n\t}", "public function validationRules( array $input );", "function acf_get_location_rule_values($rule)\n{\n}", "function Recordset_SearchValidated() {\n\n\t\t// Example:\n\t\t//$this->MyField1->AdvancedSearch->SearchValue = \"your search criteria\"; // Search value\n\n\t}", "function Recordset_SearchValidated() {\n\n\t\t// Example:\n\t\t//$this->MyField1->AdvancedSearch->SearchValue = \"your search criteria\"; // Search value\n\n\t}", "function Recordset_SearchValidated() {\n\n\t\t// Example:\n\t\t//$this->MyField1->AdvancedSearch->SearchValue = \"your search criteria\"; // Search value\n\n\t}", "function Recordset_SearchValidated() {\n\n\t\t// Example:\n\t\t//$this->MyField1->AdvancedSearch->SearchValue = \"your search criteria\"; // Search value\n\n\t}", "function Recordset_SearchValidated() {\n\n\t\t// Example:\n\t\t//$this->MyField1->AdvancedSearch->SearchValue = \"your search criteria\"; // Search value\n\n\t}", "abstract protected function getValidationRules();", "public function getRule();", "public static function validationRule()\n {\n return 'in:'. implode(',', static::getConstants());\n }", "function validate_value($valid, $value, $field, $input)\n {\n }", "function validate_value($valid, $value, $field, $input)\n {\n }", "function validate_value($valid, $value, $field, $input)\n {\n }", "function validate_value($valid, $value, $field, $input)\n {\n }", "function render_search_field($field,$value=\"\",$autoupdate,$class=\"stdwidth\",$forsearchbar=false,$limit_keywords=array(), $searched_nodes = array())\n {\n node_field_options_override($field);\n\t\n\tglobal $auto_order_checkbox, $auto_order_checkbox_case_insensitive, $lang, $category_tree_open, $minyear, $daterange_search, $searchbyday, $is_search, $values, $n, $simple_search_show_dynamic_as_dropdown, $clear_function, $simple_search_display_condition, $autocomplete_search, $baseurl, $fields, $baseurl_short, $extrafooterhtml,$FIXED_LIST_FIELD_TYPES;\n \n // set this to zero since this does not apply to collections\n if (!isset($field['field_constraint'])){$field['field_constraint']=0;}\n \n $name=\"field_\" . ($forsearchbar ? htmlspecialchars($field[\"name\"]) : $field[\"ref\"]);\n $id=\"field_\" . $field[\"ref\"];\n\n $scriptconditions=array();\n \n #Check if field has a display condition set\n $displaycondition=true;\n if ($field[\"display_condition\"]!=\"\" && (!$forsearchbar || ($forsearchbar && !empty($simple_search_display_condition) && in_array($field['ref'],$simple_search_display_condition))))\n {\n $s=explode(\";\",$field[\"display_condition\"]);\n $condref=0;\n foreach ($s as $condition) # Check each condition\n {\n $displayconditioncheck=false;\n $s=explode(\"=\",$condition);\n global $fields;\n for ($cf=0;$cf<count($fields);$cf++) # Check each field to see if needs to be checked\n {\n if ($s[0]==$fields[$cf][\"name\"] && ($fields[$cf][\"resource_type\"]==0 || $fields[$cf][\"resource_type\"]==$field[\"resource_type\"])) # this field needs to be checked\n {\n $display_condition_js_prepend=($forsearchbar ? \"#simplesearch_\".$fields[$cf][\"ref\"].\" \" : \"\");\n \n $scriptconditions[$condref][\"field\"] = $fields[$cf][\"ref\"]; # add new jQuery code to check value\n $scriptconditions[$condref]['type'] = $fields[$cf]['type'];\n $scriptconditions[$condref]['display_as_dropdown'] = $fields[$cf]['display_as_dropdown'];\n\t\t\t\t\t$scriptconditionnodes = get_nodes($fields[$cf]['ref'], null, (FIELD_TYPE_CATEGORY_TREE == $fields[$cf]['type'] ? true : false));\n \n $checkvalues=$s[1];\n $validvalues=explode(\"|\",strtoupper($checkvalues));\n\t\t\t\t\t$scriptconditions[$condref]['valid'] = array();\n\t\t\t\t\tforeach($validvalues as $validvalue)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t$found_validvalue = get_node_by_name($scriptconditionnodes, $validvalue);\n\n\t\t\t\t\t\tif(0 != count($found_validvalue))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$scriptconditions[$condref]['valid'][] = $found_validvalue['ref'];\n\n if(in_array($found_validvalue['ref'],$searched_nodes))\n {\n // Found a valid value\n $displayconditioncheck = true;\n }\n }\n }\n\t\t\t\t\n\n if (!$displayconditioncheck)\n {\n $displaycondition=false;\n }\n\n\t\t\t\t\t\n\t\t\t\t\t// Certain fixed list types allow for multiple nodes to be passed at the same time\n\t\t\t\t\tif(in_array($fields[$cf]['type'], $FIXED_LIST_FIELD_TYPES))\n\t\t\t\t\t\t{\n\t\t\t\t\t\tif(FIELD_TYPE_CATEGORY_TREE == $fields[$cf]['type'])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\tjQuery(document).ready(function()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjQuery('#CentralSpace').on('categoryTreeChanged', function(e,node)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcheckSearchDisplayCondition<?php echo $field['ref']; ?>(node);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t<?php\n\n\t\t\t\t\t\t\t// Move on to the next field now\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(FIELD_TYPE_DYNAMIC_KEYWORDS_LIST == $fields[$cf]['type'])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\tjQuery(document).ready(function()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjQuery('#CentralSpace').on('dynamicKeywordChanged', function(e,node)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcheckSearchDisplayCondition<?php echo $field['ref']; ?>(node);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t<?php\n\n\t\t\t\t\t\t\t// Move on to the next field now\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n else\n {\n\n $checkname = \"nodes_searched[{$fields[$cf]['ref']}][]\";\n $jquery_selector = \"input[name=\\\"{$checkname}\\\"]\";\n if(FIELD_TYPE_DROP_DOWN_LIST == $fields[$cf]['type'] && true == $fields[$cf]['display_as_dropdown'])\n {\n $checkname = \"nodes_searched[{$fields[$cf]['ref']}]\";\n $jquery_selector = \"select[name=\\\"{$checkname}\\\"]\";\n }\n ?>\n <script type=\"text/javascript\">\n jQuery(document).ready(function()\n {\n jQuery('<?php echo $jquery_selector; ?>').change(function ()\n {\n checkSearchDisplayCondition<?php echo $field['ref']; ?>(jQuery(this).val());\n });\n });\n </script>\n <?php\n }\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t?>\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\tjQuery(document).ready(function()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tjQuery('#field_<?php echo $fields[$cf][\"ref\"]; ?>').change(function ()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcheckSearchDisplayCondition<?php echo $field['ref']; ?>();\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t</script>\n\t\t\t\t\t\t<?php\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n } # see if next field needs to be checked\n\n $condref++;\n } # check next condition\n\n ?>\n <script type=\"text/javascript\">\n \n function checkSearchDisplayCondition<?php echo $field[\"ref\"];?>(node)\n\t\t\t{\n field<?php echo $field['ref']; ?>status = jQuery('#question_<?php echo $n; ?>').css('display');\n\t\t\tnewfield<?php echo $field['ref']; ?>status = 'none';\n\t\t\tnewfield<?php echo $field['ref']; ?>show = false;\n newfield<?php echo $field['ref']; ?>provisional = true;\n <?php\n\t\t\tforeach($scriptconditions as $scriptcondition)\n\t\t\t\t{\n /*\n Example of $scriptcondition:\n Array\n (\n [field] => 73\n [type] => 2\n [valid] => Array\n (\n [0] => 267\n [1] => 266\n )\n )\n */\n\t\t\t\t?>\n newfield<?php echo $field['ref']; ?>subcheck = false;\n fieldokvalues<?php echo $scriptcondition['field']; ?> = <?php echo json_encode($scriptcondition['valid']); ?>;\n\t\t\t\t<?php\n ############################\n ### Field type specific\n ############################\n if(in_array($scriptcondition['type'], $FIXED_LIST_FIELD_TYPES))\n {\n $jquery_condition_selector = \"input[name=\\\"nodes_searched[{$scriptcondition['field']}][]\\\"]\";\n $js_conditional_statement = \"fieldokvalues{$scriptcondition['field']}.indexOf(element.value) != -1\";\n\n if(in_array($scriptcondition['type'], array(FIELD_TYPE_CHECK_BOX_LIST, FIELD_TYPE_RADIO_BUTTONS))\n || (FIELD_TYPE_DROP_DOWN_LIST == $scriptcondition['type'] && false == $scriptcondition['display_as_dropdown']))\n {\n $js_conditional_statement = \"jQuery(this).prop('checked') && {$js_conditional_statement}\";\n }\n\n if(FIELD_TYPE_DROP_DOWN_LIST == $scriptcondition['type'] && true == $scriptcondition['display_as_dropdown'])\n {\n $jquery_condition_selector = \"select[name=\\\"nodes_searched[{$scriptcondition['field']}]\\\"] option:selected\";\n }\n\t\t\t\t\t\t\n\t\t\t\t\t\t?>\n if(!newfield<?php echo $field['ref']; ?>show)\n {\n jQuery('<?php echo $jquery_condition_selector; ?>').each(function(index, element)\n {\n\t\t\t\t\t\t\t if(<?php echo $js_conditional_statement; ?>)\n {\n newfield<?php echo $field['ref']; ?>subcheck = true;\n }\n });\n }\n <?php\n }?>\n if(!newfield<?php echo $field['ref']; ?>subcheck)\n {\n newfield<?php echo $field['ref']; ?>provisional = false;\n }\n <?php\n }\n ?>\n\n if(newfield<?php echo $field['ref']; ?>provisional)\n {\n newfield<?php echo $field['ref']; ?>status = 'block';\n }\n\n if(newfield<?php echo $field['ref']; ?>status != field<?php echo $field['ref']; ?>status)\n {\n jQuery('#question_<?php echo $n ?>').slideToggle();\n\n if(jQuery('#question_<?php echo $n ?>').css('display') == 'block')\n {\n jQuery('#question_<?php echo $n ?>').css('border-top', '');\n }\n else\n {\n jQuery('#question_<?php echo $n ?>').css('border-top', 'none');\n }\n }\n }\n </script>\n \t<?php\n \tif($forsearchbar)\n \t\t{\n \t\t// add the display condition check to the clear function\n \t\t$clear_function.=\"checkSearchDisplayCondition\".$field['ref'].\"();\";\n \t\t}\n }\n\n $is_search = true;\n\n if (!$forsearchbar)\n {\n ?>\n <div class=\"Question\" id=\"question_<?php echo $n ?>\" <?php if (!$displaycondition) {?>style=\"display:none;border-top:none;\"<?php } ?><?php\n if (strlen($field[\"tooltip_text\"])>=1)\n {\n echo \"title=\\\"\" . htmlspecialchars(lang_or_i18n_get_translated($field[\"tooltip_text\"], \"fieldtooltip-\")) . \"\\\"\";\n }\n ?>>\n <label><?php echo htmlspecialchars(lang_or_i18n_get_translated($field[\"title\"], \"fieldtitle-\")) ?></label>\n <?php\n }\n else\n {\n hook(\"modifysearchfieldtitle\");\n ?>\n <div class=\"SearchItem\" id=\"simplesearch_<?php echo $field[\"ref\"] ?>\" <?php if (!$displaycondition) {?>style=\"display:none;\"<?php } if (strlen($field[\"tooltip_text\"]) >= 1){ echo \"title=\\\"\" . htmlspecialchars(lang_or_i18n_get_translated($field[\"tooltip_text\"], \"fieldtooltip-\")) . \"\\\"\";} ?> ><?php echo htmlspecialchars(lang_or_i18n_get_translated($field[\"title\"], \"fieldtitle-\")) ?></br>\n \n <?php\n #hook to modify field type in special case. Returning zero (to get a standard text box) doesn't work, so return 1 for type 0, 2 for type 1, etc.\n\t\tif(hook(\"modifyfieldtype\")){$fields[$n][\"type\"]=hook(\"modifyfieldtype\")-1;}\n }\n\n //hook(\"rendersearchhtml\", \"\", array($field, $class, $value, $autoupdate));\n\n switch ($field[\"type\"]) {\n case FIELD_TYPE_TEXT_BOX_SINGLE_LINE:\n case FIELD_TYPE_TEXT_BOX_MULTI_LINE:\n case FIELD_TYPE_TEXT_BOX_LARGE_MULTI_LINE:\n case FIELD_TYPE_TEXT_BOX_FORMATTED_AND_CKEDITOR:\n case ($forsearchbar && $field[\"type\"]==FIELD_TYPE_DYNAMIC_KEYWORDS_LIST && !$simple_search_show_dynamic_as_dropdown):\n if ($field['field_constraint']==0){ \n\t\t\t\n\t\t\t?><input class=\"<?php echo $class ?>\" type=text name=\"<?php echo $name ?>\" id=\"<?php echo $id ?>\" value=\"<?php echo htmlspecialchars($value)?>\" <?php if($forsearchbar && !$displaycondition) { ?> disabled <?php } ?> <?php if ($autoupdate) { ?>onChange=\"UpdateResultCount();\"<?php } if(!$forsearchbar){ ?> onKeyPress=\"if (!(updating)) {setTimeout('UpdateResultCount()',2000);updating=true;}\"<?php } if($forsearchbar){?>onKeyUp=\"if('' != jQuery(this).val()){FilterBasicSearchOptions('<?php echo htmlspecialchars($field[\"name\"]) ?>',<?php echo htmlspecialchars($field[\"resource_type\"]) ?>);}\"<?php } ?>><?php \n\t\t\t# Add to the clear function so clicking 'clear' clears this box.\n\t\t\t$clear_function.=\"document.getElementById('field_\" . ($forsearchbar? $field[\"ref\"] : $field[\"name\"]) . \"').value='';\";\n\t\t}\n // number view - manipulate the form value (don't send these but send a compiled numrange value instead\n else if ($field['field_constraint']==1){ // parse value for to/from simple search\n\t\t\t$minmax=explode('|',str_replace(\"numrange\",\"\",$value));\n\t\t\t($minmax[0]=='')?$minvalue='':$minvalue=str_replace(\"neg\",\"-\",$minmax[0]);\n\t\t\t(isset($minmax[1]))?$maxvalue=str_replace(\"neg\",\"-\",$minmax[1]):$maxvalue='';\n\t\t\t?>\n\t\t\t<input id=\"<?php echo $name ?>_min\" onChange=\"jQuery('#<?php echo $name?>').val('numrange'+jQuery(this).val().replace('-','neg')+'|'+jQuery('#<?php echo $name?>_max').val().replace('-','neg'));\" class=\"NumberSearchWidth\" type=\"number\" value=\"<?php echo htmlspecialchars($minvalue)?>\"> ...\n\t\t\t<input id=\"<?php echo $name ?>_max\" onChange=\"jQuery('#<?php echo $name?>').val('numrange'+jQuery('#<?php echo $name?>_min').val().replace('-','neg')+'|'+jQuery(this).val().replace('-','neg'));\" class=\"NumberSearchWidth\" type=\"number\" value=\"<?php echo htmlspecialchars($maxvalue)?>\">\n\t\t\t<input id=\"<?php echo $name?>\" name=\"<?php echo $name?>\" type=\"hidden\" value=\"<?php echo $value?>\">\n\t\t<?php \n\t\t\t# Add to the clear function so clicking 'clear' clears this box.\n\t\t\t $clear_function.=\"document.getElementById('\".$name.\"_max').value='';\";\n\t\t\t $clear_function.=\"document.getElementById('\".$name.\"_min').value='';\";\n\t\t\t $clear_function.=\"document.getElementById('\".$name.\"').value='';\";\n\t\t}\n\t\t\n\n \n if ($forsearchbar && $autocomplete_search) { \n\t\t\t\t# Auto-complete search functionality\n\t\t\t\t?></div>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\n\t\t\t\tjQuery(document).ready(function () { \n\t\t\t\t\n\t\t\t\t\tjQuery(\"#field_<?php echo htmlspecialchars($field[\"name\"])?>\").autocomplete( { source: \"<?php echo $baseurl?>/pages/ajax/autocomplete_search.php?field=<?php echo htmlspecialchars($field[\"name\"]) ?>&fieldref=<?php echo $field[\"ref\"]?>\"} );\n\t\t\t\t\t})\n\t\t\t\t\n\t\t\t\t</script>\n\t\t\t\t<div class=\"SearchItem\">\n\t\t\t<?php }\n \n break;\n \n case FIELD_TYPE_CHECK_BOX_LIST: \n case FIELD_TYPE_DROP_DOWN_LIST:\n case ($forsearchbar && $field[\"type\"]==FIELD_TYPE_DYNAMIC_KEYWORDS_LIST && $simple_search_show_dynamic_as_dropdown):\n if(!hook(\"customchkboxes\", \"\", array($field, $value, $autoupdate, $class, $forsearchbar, $limit_keywords)))\n {\n global $checkbox_ordered_vertically;\n\n # -------- Show a check list or dropdown for dropdowns and check lists?\n # By default show a checkbox list for both (for multiple selections this enabled OR functionality)\n \n $setnames = trim_array(explode(\";\",cleanse_string($value,true)));\n # Translate all options\n $adjusted_dropdownoptions=hook(\"adjustdropdownoptions\");\n if ($adjusted_dropdownoptions){$options=$adjusted_dropdownoptions;}\n \n if($forsearchbar)\n \t{\n \t$optionfields[]=$field[\"name\"]; # Append to the option fields array, used by the AJAX dropdown filtering\n \t}\n\n $node_options = array();\n foreach($field['nodes'] as $node)\n {\n $node_options[] = $node['name'];\n }\n\n if((bool) $field['automatic_nodes_ordering'])\n {\n $field['nodes'] = reorder_nodes($field['nodes']);\n }\n\n $order_by_resetter = 0;\n foreach($field['nodes'] as $node_index => $node)\n {\n // Special case for vertically ordered checkboxes.\n // Order by needs to be reset as per the new order so that we can reshuffle them using the order by as a reference\n if($checkbox_ordered_vertically)\n {\n $field['nodes'][$node_index]['order_by'] = $order_by_resetter++;\n }\n }\n\n if ($field[\"display_as_dropdown\"] || $forsearchbar)\n {\n # Show as a dropdown box\n $name = \"nodes_searched[{$field['ref']}]\";\n ?>\n <select class=\"<?php echo $class ?>\" name=\"<?php echo $name ?>\" id=\"<?php echo $id ?>\" <?php if($forsearchbar && !$displaycondition) { ?> disabled <?php } ?> <?php if ($autoupdate) { ?>onChange=\"UpdateResultCount();\"<?php } if($forsearchbar){?> onChange=\"FilterBasicSearchOptions('<?php echo htmlspecialchars($field[\"name\"]) ?>',<?php echo htmlspecialchars($field[\"resource_type\"]) ?>);\" <?php } ?>>\n <option value=\"\"></option>\n <?php\n foreach($field['nodes'] as $node)\n {\n if('' != trim($node['name']))\n {\n ?>\n <option value=\"<?php echo htmlspecialchars(trim($node['ref'])); ?>\" <?php if (0 < count($searched_nodes) && in_array($node['ref'], $searched_nodes)) { ?>selected<?php } ?>><?php echo htmlspecialchars(trim(i18n_get_translated($node['name']))); ?></option>\n <?php\n }\n }\n ?></select><?php\n if($forsearchbar)\n \t{\n \t// Add to the clear function so clicking 'clear' clears this box.\n\t\t\t\t\t$clear_function .= \"document.getElementById('{$id}').selectedIndex = -1;\";\n \t}\n }\n else\n {\n # Show as a checkbox list (default)\n $setnames=trim_array(explode(\";\",$value));\n $wrap=0;\n\n $l = average_length($node_options);\n switch($l)\n {\n case($l > 40): $cols = 1; break; \n case($l > 25): $cols = 2; break;\n case($l > 15): $cols = 3; break;\n case($l > 10): $cols = 4; break;\n case($l > 5): $cols = 5; break;\n default: $cols = 10;\n }\n\n $height = ceil(count($field['nodes']) / $cols);\n\n global $checkbox_ordered_vertically, $checkbox_vertical_columns;\n if($checkbox_ordered_vertically)\n {\n if(!hook('rendersearchchkboxes'))\n {\n # ---------------- Vertical Ordering (only if configured) -----------\n ?>\n <table cellpadding=2 cellspacing=0>\n <tbody>\n <tr>\n <?php\n for($i = 0; $i < $height; $i++)\n {\n for($j = 0; $j < $cols; $j++)\n {\n $order_by = ($height * $j) + $i;\n\n $node_index_to_be_reshuffled = array_search($order_by, array_column($field['nodes'], 'order_by', 'ref'));\n\n if(false === $node_index_to_be_reshuffled)\n {\n continue;\n }\n\n $node = $field['nodes'][$node_index_to_be_reshuffled];\n ?>\n <td valign=middle>\n <input id=\"nodes_searched_<?php echo $node['ref']; ?>\" type=\"checkbox\" name=\"nodes_searched[<?php echo $field['ref']; ?>][]\" value=\"<?php echo $node['ref']; ?>\" <?php if((0 < count($searched_nodes) && in_array($node['ref'], $searched_nodes)) || in_array(i18n_get_translated($node['name']),$setnames)) { ?>checked<?php } ?> <?php if($autoupdate) { ?>onClick=\"UpdateResultCount();\"<?php } ?>>\n </td>\n <td valign=middle>\n <?php echo htmlspecialchars(i18n_get_translated($node['name'])); ?>&nbsp;&nbsp;\n </td>\n <?php\n }\n ?>\n </tr>\n <tr>\n <?php\n }\n ?>\n </tbody>\n </table>\n <?php\n }\n }\n else\n {\n # ---------------- Horizontal Ordering (Standard) --------------------- \n ?>\n <table cellpadding=2 cellspacing=0>\n <tr>\n <?php\n foreach($field['nodes'] as $node)\n {\n $wrap++;\n\n if($wrap > $cols)\n {\n $wrap = 1;\n ?>\n </tr>\n <tr>\n <?php\n }\n\n if('' != $node['name'])\n {\n ?>\n <td valign=middle>\n <input id=\"nodes_searched_<?php echo $node['ref']; ?>\" type=\"checkbox\" name=\"nodes_searched[<?php echo $field['ref']; ?>][]\" value=\"<?php echo $node['ref']; ?>\" <?php if ((0 < count($searched_nodes) && in_array($node['ref'], $searched_nodes)) || in_array(i18n_get_translated($node['name']),$setnames)) {?>checked<?php } ?> <?php if ($autoupdate) { ?>onClick=\"UpdateResultCount();\"<?php } ?>>\n </td>\n <td valign=middle>\n <?php echo htmlspecialchars(i18n_get_translated($node['name'])); ?>&nbsp;&nbsp;\n </td>\n <?php\n }\n }\n ?>\n </tr>\n </table>\n <?php\n }\n \n }\n }\n break;\n \n case FIELD_TYPE_DATE_AND_OPTIONAL_TIME:\n case FIELD_TYPE_EXPIRY_DATE: \n case FIELD_TYPE_DATE: \n case FIELD_TYPE_DATE_RANGE: \n $found_year='';$found_month='';$found_day='';$found_start_year='';$found_start_month='';$found_start_day='';$found_end_year='';$found_end_month='';$found_end_day='';\n if (!$forsearchbar && $daterange_search)\n {\n\t\t\trender_date_range_field($name,$value,true, $autoupdate);\n }\n else\n {\n $s=explode(\"|\",$value);\n if (count($s)>=3)\n {\n $found_year=$s[0];\n $found_month=$s[1];\n $found_day=$s[2];\n }\n ?> \n <select name=\"<?php echo $name?>_year\" id=\"<?php echo $id?>_year\" class=\"SearchWidth\" style=\"width:100px;\" <?php if ($autoupdate) { ?>onChange=\"UpdateResultCount();\"<?php } ?>>\n <option value=\"\"><?php echo $lang[\"anyyear\"]?></option>\n <?php\n $y=date(\"Y\");\n for ($d=$minyear;$d<=$y;$d++)\n {\n ?><option <?php if ($d==$found_year) { ?>selected<?php } ?>><?php echo $d?></option><?php\n }\n ?>\n </select>\n \n <?php if ($forsearchbar && $searchbyday) { ?><br /><?php } ?>\n \n <select name=\"<?php echo $name?>_month\" id=\"<?php echo $id?>_month\" class=\"SearchWidth\" style=\"width:100px;\" <?php if ($autoupdate) { ?>onChange=\"UpdateResultCount();\"<?php } ?>>\n <option value=\"\"><?php echo $lang[\"anymonth\"]?></option>\n <?php\n for ($d=1;$d<=12;$d++)\n {\n $m=str_pad($d,2,\"0\",STR_PAD_LEFT);\n ?><option <?php if ($d==$found_month) { ?>selected<?php } ?> value=\"<?php echo $m?>\"><?php echo $lang[\"months\"][$d-1]?></option><?php\n }\n ?>\n </select>\n \n <?php if (!$forsearchbar || ($forsearchbar && $searchbyday)) \n \t{ \n \t?>\n\t\t\t\t<select name=\"<?php echo $name?>_day\" id=\"<?php echo $id?>_day\" class=\"SearchWidth\" style=\"width:100px;\" <?php if ($autoupdate) { ?>onChange=\"UpdateResultCount();\"<?php } ?>>\n\t\t\t\t <option value=\"\"><?php echo $lang[\"anyday\"]?></option>\n\t\t\t\t <?php\n\t\t\t\t for ($d=1;$d<=31;$d++)\n\t\t\t\t\t{\n\t\t\t\t\t$m=str_pad($d,2,\"0\",STR_PAD_LEFT);\n\t\t\t\t\t?><option <?php if ($d==$found_day) { ?>selected<?php } ?> value=\"<?php echo $m?>\"><?php echo $m?></option><?php\n\t\t\t\t\t}\n\t\t\t\t ?>\n\t\t\t\t</select>\n \t<?php \n \t}\n if($forsearchbar)\n \t{\n \t# Add to the clear function so clicking 'clear' clears this box.\n\t\t\t\t$clear_function.=\"\n\t\t\t\t\tdocument.getElementById('field_\" . $field[\"ref\"] . \"_year').selectedIndex=0;\n\t\t\t\t\tdocument.getElementById('field_\" . $field[\"ref\"] . \"_month').selectedIndex=0;\n\t\t\t\t\t\";\n\t\t\t\tif($searchbyday)\n\t\t\t\t\t{\n\t\t\t\t\t$clear_function.=\"document.getElementById('field_\" . $field[\"ref\"] . \"_day').selectedIndex=0;\";\n\t\t\t\t\t}\n\t\t\t\t}\n }\n \n break;\n \n \n case FIELD_TYPE_CATEGORY_TREE:\n global $category_tree_add_parents, $category_tree_search_use_and;\n\n $set = preg_split('/[;\\|]/', cleanse_string($value, true));\n $name = \"nodes_searched[{$field['ref']}][]\";\n\n /*\n For search, category trees work slightly different than the intended behaviour shown in edit_fields/7.php:\n Intended behaviour:\n 1. Selecting a sub (child) node will automatically select all parent nodes up to and including the root level,\n unless the option $category_tree_add_parents is set to false\n\n On search this should work like this:\n Selecting a sub (child) node will NOT select all parent nodes unless the system is configured to search using AND\n */\n $category_tree_add_parents = $category_tree_search_use_and;\n\n if($forsearchbar)\n {\n $original_category_tree_open = $category_tree_open;\n $category_tree_open = true;\n $treeonly = true;\n $status_box_elements = '';\n\n foreach($field['nodes'] as $node)\n {\n if(!in_array($node['ref'], $searched_nodes))\n {\n continue;\n }\n\n // Show previously searched options on the status box\n $status_box_elements .= \"<span id=\\\"nodes_searched_{$field['ref']}_statusbox_option_{$node['ref']}\\\">{$node['name']}</span><br />\";\n }\n ?>\n\t\t\t<div id=\"field_<?php echo htmlspecialchars($field['name']); ?>\">\n \t\t\t<div id=\"nodes_searched_<?php echo $field['ref']; ?>_statusbox\" class=\"MiniCategoryBox\">\n <?php echo $status_box_elements; ?>\n </div>\n <div id=\"cattree_<?php echo $fields[$n]['name']; ?>\" class=\"RecordPanel PopupCategoryTree\">\n <p align=\"right\">\n <a href=\"#\" onClick=\"document.getElementById('cattree_<?php echo $field['name']; ?>').style.display='none'; return false;\"><?php echo $lang['close']; ?></a>\n </p>\n <?php\n include __DIR__ . '/../pages/edit_fields/7.php';\n\n // Reset category_tree_open because normally searchbar occurs before edit/ advanced search page\n $category_tree_open = $original_category_tree_open;\n ?>\n </div>\n <a href=\"#\"\n onClick=\"\n jQuery('#cattree_<?php echo $field['name']; ?>').css('top', (jQuery(this).position().top) - 200);\n jQuery('#cattree_<?php echo $field['name']; ?>').css('left', (jQuery(this).position().left) - 400);\n jQuery('#cattree_<?php echo $field['name']; ?>').show();\n jQuery('#cattree_<?php echo $field['name']; ?>').draggable();\n return false;\"><?php echo $lang['select']; ?></a>\n </div>\n\t\t\t<?php\n\t\t\t# Add to clear function\n\t\t\t$clear_function .= \"\n jQuery('#search_tree_{$field['ref']}').jstree(true).deselect_all();\n\n /* remove the hidden inputs */\n var elements = document.getElementsByName('nodes_searched[{$field['ref']}][]');\n while(elements[0])\n {\n elements[0].parentNode.removeChild(elements[0]);\n }\n\n /* update status box */\n var node_statusbox = document.getElementById('nodes_searched_{$field['ref']}_statusbox');\n while(node_statusbox.lastChild)\n {\n node_statusbox.removeChild(node_statusbox.lastChild);\n }\n \";\n }\n else\n {\n # For advanced search and elsewhere, include the category tree.\n include __DIR__ . \"/../pages/edit_fields/7.php\";\n }\n break;\n \n // Dynamic keywords list\n case FIELD_TYPE_DYNAMIC_KEYWORDS_LIST:\n include __DIR__ . '/../pages/edit_fields/9.php';\n break; \n\n // Radio buttons:\n case FIELD_TYPE_RADIO_BUTTONS:\n // auto save is not needed when searching\n $edit_autosave = false;\n $display_as_radiobuttons = false;\n $display_as_checkbox = true;\n $name = \"nodes_searched[{$field['ref']}][]\";\n\n if($forsearchbar || $field['display_as_dropdown'])\n {\n $display_as_dropdown = true;\n $display_as_checkbox = false;\n $name = \"nodes_searched[{$field['ref']}]\";\n\n $clear_function .= \"document.getElementsByName('{$name}')[0].selectedIndex = -1;\";\n }\n \n include __DIR__ . '/../pages/edit_fields/12.php';\n // need to adjust the field's name value\n ?>\n \t<script type=\"text/javascript\">\n \t\tjQuery(\"#field_<?php echo $field['ref']?>\").attr('name', 'field_<?php echo $field[\"name\"]?>');\n \t</script>\n <?php\n break;\n }\n ?>\n <div class=\"clearerleft\"> </div>\n </div>\n <?php\n }", "function getInputValues();", "function Recordset_SearchValidated() {\n\n\t\t// Example:\n\t\t//global $MyTable;\n\t\t//$MyTable->MyField1->AdvancedSearch->SearchValue = \"your search criteria\"; // Search value\n\n\t}", "function process_input($search = SQ_POST, &$errormsg, $truncate_empty_conditions = false) {\n\tglobal $comparators;\n\n\t/* Set Namespace ($ns) referring variable according to $search */\n\tswitch ($search) {\n\t\tcase SQ_GET:\n\t\t\t$ns = &$_GET;\n\t\t\tbreak;\n\t\tdefault:\n\t\tcase SQ_POST:\n\t\t\t$ns = &$_POST;\n\t}\n\t\n\t/* If Part */\n\t$vars = array('type', 'condition');\n\n\tif($truncate_empty_conditions) {\n\t\tif(isset($ns['cond'])) {\n\t\t\t/* Decide how much of the items to use for the condition of the\n\t\t\t * rule, based on the first zero / null /undefined variable to be\n\t\t\t * found. Also, reorder the conditions. */\n\t\t\t$match_vars = array('headermatch', 'addressmatch', 'envelopematch', 'sizeamount', 'bodymatch');\n\t\t\t$new_cond_indexes = array();\n\t\t\tforeach($ns['cond'] as $n => $c) {\n\t\t\t\tforeach($match_vars as $m) {\n\t\t\t\t\tif(!empty($c[$m]) || $c['type'] == 'all') {\n\t\t\t\t\t\t$new_cond_indexes[] = $n;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$new_cond_indexes = array_unique($new_cond_indexes);\n\t\t\t$new_cond_indexes = array_values($new_cond_indexes);\n\t\n\t\t\tforeach($new_cond_indexes as $n => $index) {\n\t\t\t\t$rule['cond'][] = $ns['cond'][$index];\n\t\t\t}\n\t\t\t/* If it is completely empty, we must return an error. */\n\t\t\tif(!isset($rule['cond'])) {\n\t\t\t\t$errormsg[] = _(\"You have to define at least one condition.\");\n\t\t\t}\n\t\t}\n\t} else {\n\t\t$vars[] = 'cond';\n\t}\n\n\tif(isset($ns['action'])) {\n\t\tarray_push($vars, 'action');\n\t\tswitch ($ns['action']) { \n\t\t\tcase \"1\": /* keep */\n\t\t\t\tbreak;\n\t\t\tcase \"2\": /* discard */\n\t\t\t\tbreak;\n\t\t\tcase \"3\": /* reject w/ excuse */\n\t\t\t\tarray_push($vars, 'excuse');\n\t\t\t\tbreak;\n\t\t\tcase \"4\": /* redirect */\n\t\t\t\tavelsieve_action_redirect::validate($ns, $errormsg);\n\t\t\t\tarray_push($vars, 'redirectemail', 'keep');\n\t\t\t\tbreak;\n\t\t\tcase \"5\": /* fileinto */\n\t\t\t\tarray_push($vars, 'folder');\n\t\t\t\tbreak;\n\t\t\tcase \"6\": /* vacation */\n\t\t\t\tavelsieve_action_vacation::validate($ns, $errormsg);\n\t\t\t\tarray_push($vars, 'vac_addresses', 'vac_days', 'vac_message');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t} else {\n /* User did not select anything from the radio buttons; default to\n * 'keep' */\n $rule['action'] = '1';\n }\n\t\n\tif(isset($ns['keepdeleted'])) {\n\t\t$vars[] = 'keepdeleted';\n\t}\n\tif(isset($ns['stop'])) {\n\t\t$vars[] = 'stop';\n\t}\n\tif(isset($ns['notify']['on']) && isset($ns['notify']['options']) &&\n\t\t!empty($ns['notify']['options'])) {\n\t\t$vars[] = 'notify';\n\t}\n\n\tif(isset($ns['disabled'])) {\n\t\t$rule['disabled'] = 1;\n\t}\n\t\n\t/* Put all variables from the defined namespace (e.g. $_POST in the rule\n\t * array. */\n\tforeach($vars as $myvar) {\n\t\tif(isset($ns[$myvar])) {\n\t\t\t$rule[$myvar]= $ns[$myvar];\n\t\t}\n\t}\n\n\t/* Special hack for newly-created folder */\n\tif(isset($rule['folder'])) {\n\t\tglobal $created_mailbox_name;\n\t\tif(isset($created_mailbox_name) && $created_mailbox_name) {\n\t\t\t$rule['folder'] = $created_mailbox_name;\n\t\t}\n\t}\n\treturn $rule;\n}", "function get_field_inputter($_cf_name,$_cf_description,$field,$actual_value,$new)\n\t{\n\t\tif (is_null($actual_value)) $actual_value=''; // Plug anomaly due to unusual corruption\n\t\treturn form_input_line($_cf_name,$_cf_description,'field_'.strval($field['id']),$actual_value,$field['cf_required']==1);\n\t}" ]
[ "0.5623711", "0.54888225", "0.5454033", "0.53326046", "0.52634543", "0.5217676", "0.5115427", "0.51085263", "0.501515", "0.500902", "0.49928808", "0.49475366", "0.49173877", "0.4907876", "0.4907876", "0.4907876", "0.4907876", "0.4907876", "0.49013764", "0.4882725", "0.48732525", "0.48683158", "0.48683158", "0.48683158", "0.48683158", "0.48477894", "0.4840501", "0.48394608", "0.48297933", "0.48195347" ]
0.66257006
0
send user input to BizForm. synch up client to server Bizform's activeRecord
public function SendUserInput() { $this->ReadInputRecord($recArr); $this->UpdateActiveRecord($recArr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function bindForm();", "abstract public function bindForm();", "function receive() {\n // Input type 1.\n if ($this->method == 'POST' && isset($_POST[$this->id . '-form_id']) && $_POST[$this->id . '-form_id'] == $this->id) {\n $this->request['raw_input'] = $_POST;\n }\n // Input types 2 and 3.\n else {\n $this->request['raw_input'] = $_GET;\n }\n }", "public function form()\n {\n $this->setData();\n }", "public function controller_processReceivedData() {\n // validate received form data\n // update data model\n }", "public function run()\n { \n $this->controller->render('aut_form',array(\n\t\t\t'client_id' => Opciones::model()->find('opcion = \"client_id_mu\"')['valor'],\n\t\t\t'client_secret' => Opciones::model()->find('opcion = \"client_secret_mu\"')['valor'],\n ));\n }", "public function execute()\n\t{\n\t\t$opf = Opl_Registry::get('opf');\n\n\t\t$this->invokeEvent('preInit');\n\t\t$this->onInit();\n\t\t$this->invokeEvent('postInit');\n\n\t\t// Validate the input data.\n\t\t$data = $this->_retrieveData();\n\n\t\t// Decide, if the form has been sent to us.\n\t\tif($_SERVER['REQUEST_METHOD'] == $this->_method && isset($data[$opf->formInternalId]))\n\t\t{\n\t\t\t// Get the internal data and remove them from the \"official\" scope.\n\t\t\t$internals = $data[$opf->formInternalId];\n\t\t\tunset($data[$opf->formInternalId]);\n\n\t\t\t// The names must match.\n\t\t\tif(isset($internals['name']) && $internals['name'] == $this->_name)\n\t\t\t{\n\t\t\t\t$this->_step = 0;\n\t\t\t\tif(isset($internals['step']))\n\t\t\t\t{\n\t\t\t\t\t$this->_step = (integer)$internals['step'];\n\t\t\t\t}\n\t\t\t\t$tracker = $this->getTracker();\n\t\t\t\t$tracker->setSequence($this);\n\t\t\t\t$current = 0;\n\t\t\t\twhile($current < $this->_step)\n\t\t\t\t{\n\t\t\t\t\t// Get the current form and advance the placeholder pointer.\n\t\t\t\t\t$form = $this->getNextSubform();\n\n\t\t\t\t\t// Attempt to ensure that the tracked data are still valid.\n\t\t\t\t\t$formData = $tracker->retrieve($internals, $current);\n\t\t\t\t\t$current++;\n\n\t\t\t\t\t$state = $form->_validate($formData);\n\t\t\t\t\tif(!$state)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->_step = $current;\n\t\t\t\t\t\t$this->_state = $form->_state = self::ERROR;\n\t\t\t\t\t\t$form->populate($data);\n\t\t\t\t\t\t$form->_onRender($this->_view);\n\t\t\t\t\t\t$this->_onRender($this->_view);\n\t\t\t\t\t\t$this->invokeEvent('preRender');\n\t\t\t\t\t\t$form->invokeEvent('preRender');\n\t\t\t\t\t\t$form->onRender();\n\t\t\t\t\t\t$form->invokeEvent('postRender');\n\t\t\t\t\t\t$this->invokeEvent('postRender');\n\t\t\t\t\t\treturn $this->_state;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$form = $this->getNextSubform();\n\t\t\t\t// Now, the currently displayed form.\n\t\t\t\t$state = $form->_validate($data);\n\t\t\t\tif(!$state)\n\t\t\t\t{\n\t\t\t\t\t$this->_state = $form->_state = self::ERROR;\n\t\t\t\t\t$form->populate($data);\n\t\t\t\t\t$form->_onRender($this->_view);\n\t\t\t\t\t$form->invokeEvent('preRender');\n\t\t\t\t\t$form->onRender();\n\t\t\t\t\t$form->invokeEvent('postRender');\n\t\t\t\t\treturn $this->_state;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$tracker->track($data, $current);\n\t\t\t\t\t$form->_state = self::ACCEPTED;\n\t\t\t\t}\n\t\t\t\t// Decide, what to do next: display another form or return\n\t\t\t\t$this->_step++;\n\t\t\t\tif(($form = $this->getNextSubform()) === false)\n\t\t\t\t{\n\t\t\t\t\t$this->_state = self::ACCEPTED;\n\t\t\t\t\t$this->invokeEvent('preAccept');\n\t\t\t\t\t$this->onAccept();\n\t\t\t\t\t$this->invokeEvent('postAccept');\n\t\t\t\t\treturn $this->_state;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->_state = $form->_state = self::RENDER;\n\t\t\t\t\t$form->_onRender($this->_view);\n\t\t\t\t\t$this->_onRender($this->_view);\n\t\t\t\t\t$form->invokeEvent('preRender');\n\t\t\t\t\t$form->onRender();\n\t\t\t\t\t$form->invokeEvent('postRender');\n\t\t\t\t\treturn $this->_state;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$form = $this->getNextSubform();\n\t\t$this->_state = $form->_state = self::RENDER;\n\t\t$form->_onRender($this->_view);\n\t\t$this->_onRender($this->_view);\n\t\t$form->invokeEvent('preRender');\n\t\t$form->onRender();\n\t\t$form->invokeEvent('postRender');\n\t\treturn $this->_state;\n\t}", "public function start() {\n if (isset($_GET)) {\n $clientId = $_GET['clientId'];\n $client = $this->clientDao->get($clientId);\n $this->showClientData($client);\n }\n //Se actualiza al cliente\n else if (isset($_POST)) {\n $id = $_POST[ClientColumns::ID];\n $nombre = $_POST[ClientColumns::NOMBRE];\n $apellido = $_POST[ClientColumns::APELLIDO];\n $dni = $_POST[ClientColumns::DNI];\n $direccion = $_POST[ClientColumns::DIRECCION];\n $this->clientDao->\n\n\n\n }\n //Se elige al cliente\n else {\n\n }\n }", "public function valiteForm();", "public function process()\n\t{\n\t\tif(isset($_POST[$this->input_name()])) {\n\t\t\t$this->value = $_POST[$this->input_name()];\n\t\t}\n\t\telse {\n\t\t\t$this->value = false;\n\t\t}\n\t}", "function clients_select_storeInput($ctlData,$clientID) {\n\tglobal $Auth,$gSession;\n\t\n\t##first check if the database was setup\n\tclients_select_setup($ctlData['IDENTIFIER']);\n\t\n\t## we need to prepare the input - needs to be done properly\n\t$data = $_POST[$ctlData['IDENTIFIER']];\n\n\t## now we update the appropriate client\n\t$db_connection = new DB_Sql(); \n\t\n\t$query = \"UPDATE \".DB_PREFIX.$GLOBALS['_MODULE_DATAOBJECTS_DBPREFIX'].\" SET \".$ctlData['IDENTIFIER'].\"= '$data' WHERE id='$clientID'\";\n\t$result_pointer = $db_connection->query($query);\t\n}", "function execute()\n\t{\n\t\t$this->obj_form = New form_input;\n\t\t$this->obj_form->formname = \"vendor_add\";\n\t\t$this->obj_form->language = $_SESSION[\"user\"][\"lang\"];\n\n\t\t$this->obj_form->action = \"vendors/edit-process.php\";\n\t\t$this->obj_form->method = \"post\";\n\t\t\n\n\t\t// general\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"code_vendor\";\n\t\t$structure[\"type\"]\t\t= \"input\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"name_vendor\";\n\t\t$structure[\"type\"]\t\t= \"input\";\n\t\t$structure[\"options\"][\"req\"]\t= \"yes\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"date_start\";\n\t\t$structure[\"type\"]\t\t= \"date\";\n\t\t$structure[\"defaultvalue\"]\t= date(\"Y-m-d\");\n\t\t$structure[\"options\"][\"req\"]\t= \"yes\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"date_end\";\n\t\t$structure[\"type\"]\t= \"date\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\t\t\t//contacts\n\t\tif (!empty($_SESSION[\"error\"][\"num_contacts\"]))\n\t\t{\n\t\t\t$this->num_contacts = stripslashes($_SESSION[\"error\"][\"num_contacts\"]);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->num_contacts = 1;\n\t\t}\n\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"]\t\t= \"num_contacts\";\n\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t$structure[\"defaultvalue\"]\t= $this->num_contacts;\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t\n\t\tfor ($i=0; $i<$this->num_contacts; $i++)\n\t\t{\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"]\t\t= \"contact_id_\" .$i;\n\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"]\t\t= \"delete_contact_\" .$i;\n\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t$structure[\"defaultvalue\"]\t= \"false\";\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"]\t\t= \"contact_\" .$i;\n\t\t\t$structure[\"type\"]\t\t= \"input\";\n\t\t\t$structure[\"defaultvalue\"]\t= \"\";\n\t\t\tif (isset($_SESSION[\"error\"][\"contact_\" .$i. \"-error\"]))\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field_error\";\n\t\t\t}\n\t\t\telse if (empty($_SESSION[\"error\"]) && $i == 0)\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field_error\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field\";\n\t\t\t}\n\t\t\t$structure[\"options\"][\"width\"]\t\t\t= \"200\";\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\n\t\t\t\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"]\t\t= \"role_\" .$i;\n\t\t\t$structure[\"type\"]\t\t= \"dropdown\";\n\t\t\t$structure[\"options\"][\"width\"]\t= \"205\";\n\t\t\tif ($i == 0)\n\t\t\t{\n\t\t\t\t$structure[\"values\"]\t\t\t= array(\"accounts\");\n\t\t\t\t$structure[\"options\"][\"autoselect\"]\t= \"yes\";\n\t\t\t\t$structure[\"options\"][\"disabled\"]\t= \"yes\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$structure[\"values\"]\t\t\t= array(\"other\");\n\t\t\t\t$structure[\"options\"][\"autoselect\"]\t= \"yes\";\n\t\t\t}\n\t\t\tif (isset($_SESSION[\"error\"][\"contact_\" .$i. \"-error\"]))\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field_error\";\n\t\t\t}\n\t\t\telse if (empty($_SESSION[\"error\"]) && $i == 0)\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field_error\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field\";\n\t\t\t}\t\t\t\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"]\t\t= \"description_\" .$i;\n\t\t\t$structure[\"type\"]\t\t= \"textarea\";\n\t\t\t$structure[\"defaultvalue\"]\t= \"\";\n\t\t\tif (isset($_SESSION[\"error\"][\"contact_\" .$i. \"-error\"]))\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field_error\";\n\t\t\t}\n\t\t\telse if (empty($_SESSION[\"error\"]) && $i == 0)\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field_error\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$structure[\"options\"][\"css_field_class\"]\t= \"hidden_form_field\";\n\t\t\t}\n\t\t\t$structure[\"options\"][\"width\"]\t\t\t= \"205\";\n\t\t\t$structure[\"options\"][\"height\"]\t\t\t= \"\";\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\n\t\t\t//contact records\n\t\t\tif (!empty($_SESSION[\"error\"][\"num_records_$i\"]))\n\t\t\t{\n\t\t\t\t$num_records = stripslashes($_SESSION[\"error\"][\"num_records_$i\"]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$num_records = 0;\n\t\t\t}\n\t\t\t\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"]\t\t= \"num_records_\" .$i;\n\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t$structure[\"defaultvalue\"]\t= $num_records;\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\n\t\t\tif ($num_records > 0)\n\t\t\t{\n\t\t\t\tfor ($j=0; $j<$num_records; $j++)\n\t\t\t\t{\n\t\t\t\t\t$structure = NULL;\n\t\t\t\t\t$structure[\"fieldname\"]\t\t= \"contact_\" .$i. \"_record_id_\" .$j;\n\t\t\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t\t\n\t\t\t\t\t$structure = NULL;\n\t\t\t\t\t$structure[\"fieldname\"]\t\t= \"contact_\" .$i. \"_delete_\" .$j;\n\t\t\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t\t\t$structure[\"defaultvalue\"]\t= \"false\";\n\t\t\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t\t\n\t\t\t\t\t$structure = NULL;\n\t\t\t\t\t$structure[\"fieldname\"]\t\t= \"contact_\" .$i. \"_type_\" .$j;\n\t\t\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t\t\n\t\t\t\t\t$structure = NULL;\n\t\t\t\t\t$structure[\"fieldname\"]\t\t= \"contact_\" .$i. \"_label_\" .$j;\n\t\t\t\t\t$structure[\"type\"]\t\t= \"hidden\";\n\t\t\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t\t\n\t\t\t\t\t$structure = NULL;\n\t\t\t\t\t$structure[\"fieldname\"]\t\t= \"contact_\" .$i. \"_detail_\" .$j;\n\t\t\t\t\t$structure[\"type\"]\t\t= \"input\";\n\t\t\t\t\t$structure[\"options\"][\"width\"] = \"\";\n\t\t\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t// taxes\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"tax_number\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure = form_helper_prepare_dropdownfromdb(\"tax_default\", \"SELECT id, name_tax as label FROM account_taxes\");\n\t\t$this->obj_form->add_input($structure);\n\n\n\n\n\t\t// list all the taxes so the user can enable or disable the taxes\n\t\t$sql_tax_obj\t\t= New sql_query;\n\t\t$sql_tax_obj->string\t= \"SELECT id, name_tax, description, default_vendors FROM account_taxes ORDER BY name_tax\";\n\t\t$sql_tax_obj->execute();\n\n\t\tif ($sql_tax_obj->num_rows())\n\t\t{\n\t\t\t// user note\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"] \t\t= \"tax_message\";\n\t\t\t$structure[\"type\"]\t\t\t= \"message\";\n\t\t\t$structure[\"defaultvalue\"]\t\t= \"<p>Select all the taxes below which apply to this vendor. Any taxes not selected, will not be added to invoices for this vendor.</p>\";\n\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t\n\n\n\t\t\t// run through all the taxes\n\t\t\t$sql_tax_obj->fetch_array();\n\n\t\t\tforeach ($sql_tax_obj->data as $data_tax)\n\t\t\t{\n\t\t\t\t// define tax checkbox\n\t\t\t\t$structure = NULL;\n\t\t\t\t$structure[\"fieldname\"] \t\t= \"tax_\". $data_tax[\"id\"];\n\t\t\t\t$structure[\"type\"]\t\t\t= \"checkbox\";\n\t\t\t\t$structure[\"options\"][\"label\"]\t\t= $data_tax[\"name_tax\"] .\" -- \". $data_tax[\"description\"];\n\t\t\t\t$structure[\"options\"][\"no_fieldname\"]\t= \"enable\";\n\t\t\t\t\n\t\t\t\tif ($data_tax[\"default_vendors\"])\n\t\t\t\t{\n\t\t\t\t\t$structure[\"defaultvalue\"]\t= \"on\";\n\t\t\t\t}\n\n\t\t\t\t// add to form\n\t\t\t\t$this->obj_form->add_input($structure);\n\t\t\t\t$this->tax_array[] = \"tax_\". $data_tax[\"id\"];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->tax_array = array();\n\n\t\t\t$structure = NULL;\n\t\t\t$structure[\"fieldname\"] \t\t= \"tax_message\";\n\t\t\t$structure[\"type\"]\t\t\t= \"message\";\n\t\t\t$structure[\"defaultvalue\"]\t\t= \"<p>No taxes can be selected for this vendor, as there have been no taxes configured yet.</p>\";\n\t\t\t$this->obj_form->add_input($structure);\n\t\t}\n\n\n\t\t// purchase options\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t\t= \"discount\";\n\t\t$structure[\"type\"]\t\t\t= \"input\";\n\t\t$structure[\"options\"][\"width\"]\t\t= 50;\n\t\t$structure[\"options\"][\"label\"]\t\t= \" %\";\n\t\t$structure[\"options\"][\"max_length\"]\t= \"6\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\n\n\t\t// billing address\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address1_street\";\n\t\t$structure[\"type\"]\t= \"textarea\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address1_city\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address1_state\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address1_country\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address1_zipcode\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$this->obj_form->add_input($structure);\n\n\n\n\t\t// shipping address\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"]\t\t\t= \"address1_same_as_2\";\n\t\t$structure[\"type\"]\t\t\t= \"checkbox\";\n\t\t$structure[\"options\"][\"label\"]\t\t= \" \". lang_trans(\"address1_same_as_2_help\");\n\t\t$structure[\"options\"][\"css_row_class\"]\t= \"shipping_same_address\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address2_street\";\n\t\t$structure[\"type\"]\t= \"textarea\";\n\t\t$structure[\"options\"][\"css_row_class\"]\t= \"shipping_address\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address2_city\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$structure[\"options\"][\"css_row_class\"]\t= \"shipping_address\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address2_state\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$structure[\"options\"][\"css_row_class\"]\t= \"shipping_address\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address2_country\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$structure[\"options\"][\"css_row_class\"]\t= \"shipping_address\";\n\t\t$this->obj_form->add_input($structure);\n\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] = \"address2_zipcode\";\n\t\t$structure[\"type\"]\t= \"input\";\n\t\t$structure[\"options\"][\"css_row_class\"]\t= \"shipping_address\";\n\t\t$this->obj_form->add_input($structure);\n\t\n\n\n\n\n\t\t// submit button\n\t\t$structure = NULL;\n\t\t$structure[\"fieldname\"] \t= \"submit\";\n\t\t$structure[\"type\"]\t\t= \"submit\";\n\t\t$structure[\"defaultvalue\"]\t= \"Create Vendor\";\n\t\t$this->obj_form->add_input($structure);\n\t\t\n\n\t\n\t\t// load any data returned due to errors\n\t\t$this->obj_form->load_data_error();\n\t}", "protected abstract function fetchSubmitValue();", "public function form()\n {\n\n $this->display('id', '申请ID')->default($this->payload['id']);\n $this->display('uid', '申请人UID')->default($this->payload['uid']);\n $this->display('status', '状态')->default(\\App\\Admin\\Repositories\\BusinessApply::$statusLabel[$this->payload['status']]);\n\n\n $this->radio('process', '处理')\n ->options([\n 1 => '通过',\n 2 => '拒绝',\n ]);\n\n $this->text('msg', '审核回复');\n\n }", "public function processForm(ServerData $server);", "function _submit_biz_data()\n {\n\t$data = $this->_get_data_from_post('business');\n\t//$this->debug($_FILES);\n\tif ($_FILES['photo']['name'] != NULL) {\n\t $data['logo'] = Modules::run('upload_manager/upload', 'photo', 'biz');\n\t}\n\n\t$id = $this->uri->segment(3) == 'edit' ? $this->session->user_id : '';\n\tif (is_numeric($id)) {\n\t $this->_update($id, $data, 'mdl_marketers_info');\n\t //Modules::run('auth/create_session', $this->session->user_id);\n\t redirect($this->uri->segment(3) == 'edit' ? 'users/profile' : 'users');\n\t} else {\n\t $this->_insert($data, 'mdl_marketers_info');\n\t //redirect('login');\n\t}\n }", "public static function handleInput()\n {\n switch ($_REQUEST[\"cmd\"]) {\n //cancella il profilo del cliente \n case 'cancella':\n self::cancella();\n break;\n //modifica il profilo del cliente \n case 'back_home_page':\n case 'showrecensioni':\n self::showHomePage();\n break;\n //modifica il profilo personale\n case 'modifica_profilo_personale':\n self::modificaProfiloPersonale();\n break;\n //modifca il profilo dell'azienda\n case 'modifica_profilo_azienda':\n self::modificaProfiloAzienda();\n break;\n //modifica i servizi offerti\n case 'modifica_servizi':\n self::modificaServizi();\n break;\n //aggiorna profilo personale\n case 'update_profilo_personale':\n self::updateProfiloPersonale();\n break;\n //aggiorna profilo azienda\n case 'update_profilo_azienda':\n self::updateProfiloAzienda();\n break;\n //aggiorna servizi\n case 'update_servizi':\n self::updateServizi();\n break;\n }\n }", "public function store()\n\t{ $input = Input::get();\n $input['userId'] = Auth::user()->id;\n $body = Input::only('body');\n $this->postStatusForm->validate($body);\n// $this->execute(new PublishStatusCommand(Input::get('body'),Auth::user()->id));\n $this->execute(PublishStatusCommand::class,$input);\n Flash::success('Your status has been updated!');\n return Redirect::back();\n\t}", "public function run()\n\t{\n\t\t\n\t\tlist($name,$id)=$this->resolveNameID();\n\t\tif(isset($this->htmlOptions['id']))\n\t\t\t$id=$this->htmlOptions['id'];\n\t\telse\n\t\t\t$this->htmlOptions['id']=$id;\n\t\tif(isset($this->htmlOptions['name']))\n\t\t\t$name=$this->htmlOptions['name'];\n\n\t\t$this->registerClientScript($id);\n\t\t$this->htmlOptions[\"class\"]=\"form-control\";\n\t\t\n\t\techo \"<small class=\\\"text-muted\\\"><em>Here a message for user</em></small>\";\n\t\techo CHtml::activeTextField($this->model,$this->attribute,$this->htmlOptions);\n\t\t\n\t}", "protected function Form_Run() {}", "public function afterSubmit() {\n\t\t$this->setValue($this->serializeData($this->getValue()));\n\t}", "public function populateForm() {}", "public function processAction() {\n $post = $this->request->getPost();\n $userTable = $this->getServiceLocator()->get('UserTable');\n// Load User entity\n $user = $userTable->getUser($post->id);\n// Bind User entity to Form\n $form = $this->getServiceLocator()->get('UserEditForm');\n $form->bind($user);\n $form->setData($post);\n// Save user\n $this->getServiceLocator()->get('UserTable')->saveUser($user);\n }", "public function send_friend_request()\n {\n //insert into db;\n $this->Friend_model->send_friend_request_model();\n }", "public function receive(){\n $eslId = $this->uri->segment(3); //Get the flower shop ID\n\n $formData = $this->input->post(NULL, TRUE);\n\n $domain = $formData['_domain'];\n $name = $formData['_name'];\n\n if($name === \"bid_available\"){\n //Get data to store\n $data = array(\n 'guildPhoneNumber' => $formData['guildPhoneNumber'],\n 'deliveryRequestId' => $formData['deliveryRequestId'],\n 'driverPhoneNumber' => $formData['driverPhoneNumber'],\n 'driverName' => $formData['driverName'],\n 'estimatedDeliveryTime' => $formData['estimatedDeliveryTime']\n );\n\n //Store bid in DB and exit\n $this->save_bid($data);\n }\n else if($name === \"complete\"){\n $driverPhoneNumber = $formData['driverPhoneNumber'];\n\n $this->load->model('bids_model');\n $this->bids_model->set_delivered($driverPhoneNumber);\n }\n }", "abstract function setupform();", "public function updateFromPOST() {\n if ($this->isSubmit()) {\n foreach (Tools::getValue($this->namebase(), array()) as $name => $value) {\n $key = $this->nameify($name);\n $this->input_values[$key] = $value;\n }\n Configuration::updateValue($this->key(), json_encode($this->input_values));\n }\n }", "private function input(){\n $this->params['controller_name'] = $this->ask('Controller name');\n $this->params['crud_url'] = $this->ask('CRUD url');\n $this->params['model_name'] = $this->ask('Model name');\n $this->params['table_name'] = $this->ask('Table name');\n $this->params['author'] = env('PACKAGE_AUTHOR');\n }", "public function handleDataSubmission() {}", "public function saveForm()\n\t{\n\t\tif ($this->request->isPost() && !empty($this->request[$this->connector . '_form']))\n\t\t{\n\t\t\t//If the session actual\n\t\t\tif (check_bitrix_sessid())\n\t\t\t{\n\t\t\t\t//Activation\n\t\t\t\tif ($this->request[$this->connector . '_active'] && empty($this->arResult['ACTIVE_STATUS']))\n\t\t\t\t{\n\t\t\t\t\t$this->status->setActive(true);\n\t\t\t\t\t$this->arResult['ACTIVE_STATUS'] = true;\n\n\t\t\t\t\t//Reset cache\n\t\t\t\t\t$this->cleanCache();\n\t\t\t\t}\n\n\t\t\t\tif (!empty($this->arResult['ACTIVE_STATUS']))\n\t\t\t\t{\n\t\t\t\t\t//If you remove the reference to the user\n\t\t\t\t\tif ($this->request[$this->connector . '_del_user'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$delUser = $this->connectorOutput->delUserActive($this->request['user_id']);\n\n\t\t\t\t\t\tif ($delUser->isSuccess())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->setStatus(false);\n\n\t\t\t\t\t\t\t$this->messages[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_OK_DEL_USER');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->error[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_NO_DEL_USER');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Reset cache\n\t\t\t\t\t\t$this->cleanCache();\n\t\t\t\t\t}\n\n\t\t\t\t\t//If you remove the reference to the group\n\t\t\t\t\tif ($this->request[$this->connector . '_del_page'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$delPage = $this->connectorOutput->delPageActive($this->request['page_id']);\n\n\t\t\t\t\t\tif ($delPage->isSuccess())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->setStatus(false);\n\n\t\t\t\t\t\t\t$this->messages[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_OK_DEL_PAGE');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->error[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_NO_DEL_PAGE');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Reset cache\n\t\t\t\t\t\t$this->cleanCache();\n\t\t\t\t\t}\n\n\t\t\t\t\t//If you bind to the group\n\t\t\t\t\tif ($this->request[$this->connector . '_authorization_page'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$authorizationPage = $this->connectorOutput->authorizationPage($this->request['page_id']);\n\n\t\t\t\t\t\tif ($authorizationPage->isSuccess())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($this->request['human_agent'] === 'Y')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$data = ['HUMAN_AGENT' => true];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$data = [];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this->setStatus(true, true, $data);\n\n\t\t\t\t\t\t\t$this->messages[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_OK_AUTHORIZATION_PAGE');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->setStatus(false);\n\n\t\t\t\t\t\t\t$this->error[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_NO_AUTHORIZATION_PAGE');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Reset cache\n\t\t\t\t\t\t$this->cleanCache();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($this->request[$this->connector . '_del'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$rawDelete = $this->connectorOutput->deleteConnector();\n\n\t\t\t\t\t\tif ($rawDelete->isSuccess())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tStatus::delete($this->connector, (int)$this->arParams['LINE']);\n\t\t\t\t\t\t\t$this->arResult['STATUS'] = false;\n\t\t\t\t\t\t\t$this->arResult['ACTIVE_STATUS'] = false;\n\t\t\t\t\t\t\t$this->arResult['CONNECTION_STATUS'] = false;\n\t\t\t\t\t\t\t$this->arResult['REGISTER_STATUS'] = false;\n\t\t\t\t\t\t\t$this->arResult['ERROR_STATUS'] = false;\n\t\t\t\t\t\t\t$this->arResult['DATA_STATUS'] = [];\n\t\t\t\t\t\t\t$this->arResult['PAGE'] = '';\n\n\t\t\t\t\t\t\t//$this->messages[] = Loc::getMessage('IMCONNECTOR_COMPONENT_SETTINGS_OK_DISABLE');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->error[] = Loc::getMessage('IMCONNECTOR_COMPONENT_SETTINGS_NO_DISABLE');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Reset cache\n\t\t\t\t\t\t$this->cleanCache();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->error[] = Loc::getMessage('IMCONNECTOR_COMPONENT_FACEBOOK_SESSION_HAS_EXPIRED');\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.61794895", "0.61794895", "0.59871686", "0.58996487", "0.5891565", "0.5665535", "0.5580118", "0.5573205", "0.5550448", "0.55493826", "0.5516256", "0.55053353", "0.55008966", "0.5481724", "0.5476852", "0.54766595", "0.54724264", "0.54624295", "0.54333615", "0.54174507", "0.5408449", "0.538951", "0.53772247", "0.53604114", "0.5357778", "0.5333312", "0.5329442", "0.53224546", "0.5319374", "0.5318573" ]
0.69070315
0
BizForm::Render() render this form (return html content), called by bizview's render method (called when form is loaded). Query is issued before returning the html content.
public function Render() { // when in NEW mode or when parent form in NEW mode, do nothing global $g_BizSystem; $prtMode = ""; if ($this->m_ParentFormName) { $prtForm = $g_BizSystem->GetObjectFactory()->GetObject($this->m_ParentFormName); $prtMode = $prtForm->GetDisplayMode()->GetMode(); } if ($this->m_Mode != MODE_N && $prtMode != MODE_N) { // get view history if (!$this->m_NoHistoryInfo) $this->SetHistoryInfo($g_BizSystem->GetSessionContext()->GetViewHistory($this->m_Name)); } if ($this->m_Mode == MODE_N) $this->UpdateActiveRecord($this->GetDataObj()->NewRecord()); //Moved the renderHTML function infront of declaring subforms $renderedHTML = $this->RenderHTML(); global $g_BizSystem; // prepare the subforms' dataobjs, since the subform relates to parent form by dataobj association if ($this->m_SubForms) { foreach($this->m_SubForms as $subForm) { $formObj = $g_BizSystem->GetObjectFactory()->GetObject($subForm); $dataObj = $this->GetDataObj()->GetRefObject($formObj->m_DataObjName); if ($dataObj) $formObj->SetDataObj($dataObj); } } $this->SetClientScripts(); return $renderedHTML; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function render()\n {\n $root =& XCube_Root::getSingleton();\n $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM);\n\n $renderTarget =& $renderSystem->createRenderTarget('main');\n\n $renderTarget->setAttribute('legacy_module', 'legacy');\n $renderTarget->setTemplateName('legacy_xoopsform_tableform.html');\n $renderTarget->setAttribute('form', $this);\n\n $renderSystem->render($renderTarget);\n\n return $renderTarget->getResult();\n }", "public function render()\n {\n echo htmlspecialcharsbx($this->getPrefix());\n $action = $this->getAction();\n $id = $this->getId();\n $class = $this->getClass();\n $name = $this->getName();\n $dataAttributes = $this->getDataAttributes();\n $dataAttributesString = '';\n foreach ($dataAttributes as $key => $value) {\n $dataAttributesString .= ' data-' . $key . '=\"' . $value . '\" ';\n }\n\n $formArguments = 'action=\"' . (($action !== null) ? $action : '#') . '\" ';\n $formArguments .= ($id !== null) ? 'id=\"' . $id . '\" ' : '';\n $formArguments .= !empty($class) ? 'class=\"' . implode(' ', $class) . '\" ' : '';\n $formArguments .= ($name !== null) ? 'name=\"' . $name . '\" ' : '';\n $formArguments .= $dataAttributesString;\n echo '<form ' . $formArguments . '>';\n\n $fields = $this->getFields();\n foreach ($fields as $key => $field) {\n $field->render();\n }\n\n echo '</form>';\n\n echo htmlspecialcharsbx($this->getPostfix());\n }", "protected function RenderBegin($blnDisplayOutput = true) {\r\n\t\t\tswitch ($this->intFormStatus) {\r\n\t\t\t\tcase QFormBase::FormStatusUnrendered:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase QFormBase::FormStatusRenderBegun:\r\n\t\t\t\tcase QFormBase::FormStatusRenderEnded:\r\n\t\t\t\t\tthrow new QCallerException('$this->RenderBegin() has already been called');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new QCallerException('FormStatus is in an unknown status');\r\n\t\t\t}\r\n\r\n\t\t\t// Update FormStatus\r\n\t\t\t$this->intFormStatus = QFormBase::FormStatusRenderBegun;\r\n\r\n\t\t\t// Iterate through the form's ControlArray to Define FormAttributes and JavaScriptIncludes\r\n\t\t\t$strJavaScriptArray = array();\r\n\t\t\t$strFormAttributeArray = array();\r\n\t\t\tforeach ($this->GetAllControls() as $objControl) {\r\n\t\t\t\t// JavaScript Includes? The control would have a\r\n\t\t\t\t// comma-delimited list of javascript files to include (if applicable)\r\n\t\t\t\tif ($objControl->JavaScripts) {\r\n\t\t\t\t\t$strScriptArray = explode(',', $objControl->JavaScripts);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($strScriptArray) foreach ($strScriptArray as $strScript) {\r\n\t\t\t\t\t\tif (trim($strScript))\r\n\t\t\t\t\t\t\t$strJavaScriptArray[trim($strScript)] = $strScript;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Form Attributes?\r\n\t\t\t\tif ($objControl->FormAttributes) {\r\n\t\t\t\t\t$strFormAttributeArray = array_merge($strFormAttributeArray, $objControl->FormAttributes);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Create $strFormAttributes\r\n\t\t\t$strFormAttributes = '';\r\n\t\t\tforeach ($strFormAttributeArray as $strKey=>$strValue) {\r\n\t\t\t\t$strFormAttributes .= sprintf(' %s=\"%s\"', $strKey, $strValue);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$strOutputtedText = strtolower(trim(ob_get_contents()));\r\n\t\t\tif (strpos($strOutputtedText, '<body') === false) {\r\n\t\t\t\t$strToReturn = '<body>';\r\n\t\t\t\t$this->blnRenderedBodyTag = true;\r\n\t\t\t} else\r\n\t\t\t\t$strToReturn = '';\r\n\r\n\t\t\t// Setup Rendered HTML\r\n//\t\t\t$strToReturn .= sprintf('<form method=\"post\" name=\"%s\" id=\"%s\" action=\"%s\"%s>', $this->strFormId, $this->strFormId, QApplication::$RequestUri, $strFormAttributes);\r\n\t\t\t$strToReturn .= sprintf('<form method=\"post\" id=\"%s\" autocomplete=\"off\" action=\"%s\"%s>', $this->strFormId, QApplication::$RequestUri, $strFormAttributes);\r\n\r\n\t\t\t// Call in JavaScript\r\n\t\t\t$strToReturn .= sprintf('<script type=\"text/javascript\" src=\"%s%s/includes/qcodo/qform_objects/_form.js\"></script>', DOCROOT_VIRTUAL_DIRECTORY, DOCROOT_SUBFOLDER);\r\n\r\n\t\t\t// Call in OTHER JavaScripts (if any)\r\n\t\t\tforeach ($strJavaScriptArray as $strScript)\r\n\t\t\t\t$strToReturn .= sprintf('<script type=\"text/javascript\" src=\"%s%s/includes/qform/assets/%s\"></script>', DOCROOT_VIRTUAL_DIRECTORY, DOCROOT_SUBFOLDER, $strScript);\r\n\r\n\t\t\t// Perhaps a strFormModifiers as an array to\r\n\t\t\t// allow controls to update other parts of the form, like enctype, onsubmit, etc.\r\n\r\n\t\t\t// Return or Display\r\n\t\t\tif ($blnDisplayOutput) {\r\n\t\t\t\tprint ($strToReturn);\r\n\t\t\t\treturn null;\r\n\t\t\t} else\r\n\t\t\t\treturn $strToReturn;\r\n\t\t}", "public function render() {\n $formContainsRequiredFields = FALSE;\n $htmlElements = array();\n\n foreach($this->elements as $element) {\n if(!$this->getMarkRequiredFields()) {\n $element['object']->markIfRequired(FALSE);\n }\n\n if($element['object']->isRequired()) $formContainsRequiredFields = TRUE;\n $element['object']->render();\n if($element['object']->errorOccured()) $this->setError(TRUE);\n\n $htmlElements[] = $element['object']->fetch();\n $this->javascripts .= $element['object']->getJavaScripts();\n }\n\n $this->html = implode(\"\\n<span class=\\\"element_separator\\\">&nbsp;</span>\", $htmlElements);\n $preForm = (bool)$this->headline ? FORMWIZARD_PRE_FORM_HEADLINE : FORMWIZARD_PRE_FORM;\n\n $html = NULL;\n\n $html .= '<style type=\"text/css\">@import url('.FORMWIZARD_CSS_URL.\");</style>\\n\";\n $html .= str_replace('{headline}', $this->headline, $preForm);\n $html .= \"\\n\".'<form name=\"'.$this->name.'\" method=\"'.$this->method.'\" action=\"'.$this->action.'\" enctype=\"multipart/form-data\">';\n $html .= \"\\n\".'<input type=\"hidden\" name=\"__'.$this->name.'_submitted\" value=\"1\" />';\n $html .= \"\\n\".$this->html;\n $html .= \"\\n\".'</form>';\n $html .= \"\\n\".'<script type=\"text/javascript\">'.$this->javascripts.'</script>';\n\n if($formContainsRequiredFields && $this->markRequiredFields) {\n $html .= \"\\n\".FORMWIZARD_LEGEND_REQUIRED_FIELD;\n }\n\n $this->html = $html.\"\\n\".FORMWIZARD_POST_FORM;\n\n $this->isRendered = TRUE;\n }", "public function renderForm()\n\t{\n\t\t$this->beginForm();\n\t\t$this->renderMessageInput();\n\t\techo Html::beginTag('div', array('class' => 'chat-from-actions'));\n\t\t$this->renderSubmit();\n\t\techo Html::endTag('div');\n\t\t$this->endForm();\n\t}", "public function render() {\n $this->checkValue();\n $html = NULL;\n\n $html .= '<select id=\"'.$this->id.'\" name=\"'.$this->name.'\"';\n $html .= (bool)$this->multiple ? ' multiple' : NULL;\n $html .= (bool)$this->size ? ' size=\"'.$this->size.'\"' : NULL;\n $html .= \">\\n\";\n\n foreach($this->options as $option) {\n $html .= '<option value=\"'.$option['optionValue'].'\"';\n\n if($this->form->isSubmitted()) {\n $html .= ($_REQUEST[$this->name] == $option['optionValue']) ? ' selected' : NULL;\n } else {\n $html .= (isset($option['selected']) && (bool)$option['selected']) ? ' selected' : NULL;\n }\n\n $html .= '>'.$option['optionTitle'].\"</option>\\n\";\n }\n\n if($this->required\n && $this->form->isSubmitted()\n && !$this->checkValue()) {\n $this->error = TRUE;\n }\n\n $html .= '</select>';\n $this->html = $this->wrap($html);\n }", "public function render()\n {\n return $this->getFormCreator()->render();\n }", "public function displayForm() {\n\t\t$output = $this->getOutput();\n\n\t\t$form_class = $this->adapter->getFormClass();\n\t\t// TODO: use interface. static ctor.\n\t\tif ( $form_class && class_exists( $form_class ) ){\n\t\t\t$form_obj = new $form_class();\n\t\t\t$form_obj->setGateway( $this->adapter );\n\t\t\t$form_obj->setGatewayPage( $this );\n\t\t\t$form = $form_obj->getForm();\n\t\t\t$output->addModules( $form_obj->getResources() );\n\t\t\t$output->addModuleStyles( $form_obj->getStyleModules() );\n\t\t\t$output->addHTML( $form );\n\t\t} else {\n\t\t\t$this->logger->error( \"Displaying fail page for bad form class '$form_class'\" );\n\t\t\t$this->displayFailPage( false );\n\t\t}\n\t}", "public function displayForm() {\n\t\t$output = $this->getOutput();\n\n\t\t$form_class = $this->adapter->getFormClass();\n\t\t// TODO: use interface. static ctor.\n\t\tif ( $form_class && class_exists( $form_class ) ) {\n\t\t\t$form_obj = new $form_class();\n\t\t\t$form_obj->setGateway( $this->adapter );\n\t\t\t$form_obj->setGatewayPage( $this );\n\t\t\t$form = $form_obj->getForm();\n\t\t\t$output->addModules( $form_obj->getResources() );\n\t\t\t$output->addModuleStyles( $form_obj->getStyleModules() );\n\t\t\t$output->addHTML( $form );\n\t\t} else {\n\t\t\t$this->logger->error( \"Displaying fail page for bad form class '$form_class'\" );\n\t\t\t$this->displayFailPage( false );\n\t\t}\n\t}", "function render(Form $form);", "public function renderForm()\n {\n $formUnit = $this->interActor->formUnit($this->inputHandler->getArrayMap());\n\n $view = new \\View\\Model(\n \\View\\Customer::form($formUnit),\n $this->inputHandler->routeArrayMap()\n );\n return $view->render();\n }", "public function render() {\n /* verify all fields except checkbox */\n if($this->required\n && $this->form->isSubmitted()\n && !$this->checkValue()) {\n $this->error = TRUE;\n $this->cssClass = 'error';\n }\n\n /* verify checkbox */\n $tempName = str_replace('[]', NULL, $this->name);\n\n if($this->required\n && $this->form->isSubmitted()\n && $this->type == 'checkbox'\n && !isset($_REQUEST[$tempName])) {\n $this->error = TRUE;\n $this->cssClass = 'error';\n }\n\n $html = NULL;\n $this->value = htmlspecialchars($this->value);\n\n $html .= '<input type=\"'.$this->type.'\" id=\"'.$this->id.'\" name=\"'.$this->name.'\" value=\"'.$this->value.'\"';\n $html .= (bool)$this->size ? ' size= \"'.$this->size.'\"' : NULL;\n $html .= (bool)$this->maxlength ? ' maxlength= \"'.$this->maxlength.'\"' : NULL;\n $html .= (bool)$this->size ? ' size=\"'.$this->size.'\"' : NULL;\n $html .= ($this->type == 'text' || $this->type == 'password') ? ' class=\"' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'submit') ? ' class=\"submit ' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'checkbox') ? ' class=\"checkbox ' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'radio') ? ' class=\"radio ' . $this->cssClass .'\"' : NULL;\n $html .= ($this->type == 'image') ? ' source=\"'.$this->source.'\"' : NULL;\n $html .= ($this->type == 'image' && (bool)$this->width && (bool)$this->height) ? ' style=\"width:'.$this->width.'px; height:'.$this->height.'px;\"' : NULL;\n $html .= (bool)$this->checked ? ' checked' : NULL;\n $html .= ' />';\n\n if (isset($this->label)) {\n $html .= '<span class=\"label\">' . $this->label . '</span>';\n }\n\n $this->html = ($this->type == 'hidden') ? $html : $this->wrap($html);\n }", "public function run()\n {\n if (!empty($this->_fields)) {\n throw new InvalidCallException('Each beginField() should have a matching endField() call.');\n }\n\n if ($this->enableClientScript) {\n $id = $this->options['id'];\n $options = Json::encode($this->getClientOptions());\n $attributes = Json::encode($this->attributes);\n $view = $this->getView();\n ActiveFormAsset::register($view);\n $view->registerJs(\"jQuery('#$id').xtlanActiveForm($attributes, $options);\");\n }\n\n echo Html::endForm();\n }", "public function renderForm()\n {\n\n $table = \"luda_resource_has_tag\";\n $identifier = \"Light_Kit_Admin_UserData.generated/luda_resource_has_tag\";\n $parentLayout = \"Light_Kit_Admin/kit/zeroadmin/dev/mainlayout_base\";\n $vars = [\n \"title\" => \"Resource has tag form\",\n ];\n if (array_key_exists(\"solo\", $_GET)) {\n $parentLayout = \"Light_Kit_Admin/kit/zeroadmin/dev/mainlayout_solo\";\n $vars['related_links'] = []; // cancel any existing related links\n $this->setOnSuccessIframeSignal(\"done\");\n }\n\n $form = $this->processForm($identifier, $table);\n\n\n\n //--------------------------------------------\n // RENDERING\n //--------------------------------------------\n return $this->renderAdminPage('Light_Kit_Admin_UserData/kit/zeroadmin/generated/luda_resource_has_tag_form', [\n \"parent_layout\" => $parentLayout,\n \"form\" => $form,\n ], PageConfUpdator::create()->updateWidget(\"body.lka_chloroform\", [\n 'vars' => $vars,\n ]));\n }", "public function getRender(){\n //Adiciona a funcionalidade para definir o campo que deve receber o foco inicial\n if($this->getCampoFoco() != null){\n $sFuncao = View::campoFocus($this->getCampoFoco()->getId());\n $this->addListener(Base::EVENTO_APOS_MONTAR, $sFuncao);\n }\n \n //Adiciona a funcionalidade que centraliza o formulário na tela\n if($this->getCentraliza()){\n $sFuncao = Base::getFuncaoCentraliza();\n $this->addListener(Base::EVENTO_MONTAR, $sFuncao);\n }\n \n //Adiciona a funcionalidade que indica que será possível arrastar o formulário\n if($this->getPermiteArrastar()){\n $sFuncao = Base::getFuncaoLimitaArrasto($this->getId(),$this->getRenderTo());\n $this->addListener(Base::EVENTO_MONTAR, $sFuncao);\n }\n \n $aRender = array(\n \"animCollapse\" => true,\n \"autoScroll\" => true,\n \"waitMsgTarget\" => true,\n \"bodyPadding\" => 10,\n \"iconCls\" => 'icon-form',\n \"border\" => $this->getAdicionaBorda(),\n //\"glyph\" => 36,\n \"layout\" => $this->getLayout(),\n \"id\" => $this->getId(),\n \"title\" => $this->getTitulo(),\n \"closable\" => $this->getPermiteFechar(),\n \"resizable\" => $this->getPermiteRedimensionar(),\n \"draggable\" => $this->getPermiteArrastar(),\n \"collapsible\" => $this->getPermiteRecolher(),\n \"height\" => $this->getAltura(),\n \"width\" => $this->getLargura(),\n \"html\" => $this->getHtml(),\n \"items\" => $this->getStringItemsLayout(),\n \"buttons\" => $this->getBotoes(),\n \"listeners\" => $this->getListeners(),\n \"reloadPreviousOnClose\" => $this->getReloadPreviousOnClose()\n );\n \n $oForm = \"Ext.create('Ext.panel.Panel', {\".Base::getRender($aRender).\"})\";\n \n return Base::addObj($oForm,$this->getRenderTo());\n }", "public function render(): String\n {\n\n $this->view = \"<form action='$this->action' method='$this->method' name='$this->name' id='$this->id'\";\n\n // Add all other attributes like class, id, required etc.\n foreach ($this->attr as $key => $value) {\n $this->view .= \" $key=$value \";\n }\n $this->view .= \"/>\";\n\n // Add field's HTML code\n $fieldsView = $this->renderFields();\n $this->view .= \" <br> $fieldsView\";\n\n // Add submit button HTML code\n $submitButtonView = $this->buildSubmitButton();\n $this->view .= \" <br> $submitButtonView\";\n\n // Close the form tag\n $this->view .= \" <br> </form>\";\n\n return $this->view;\n }", "protected function renderForm()\n {\n $helper = PrestashopFactory::buildHelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitIfthenpayModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(),\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitOrderrefModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitB2binpayModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submit_apisfact_prestashop';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitKushkipagosModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n if(Currency::getDefaultCurrency()->iso_code=='COP'){\n return $helper->generateForm(array($this->getConfigFormCOP()));\n }else{\n return $helper->generateForm(array($this->getConfigForm()));\n }\n\n }", "public function Render($form)\r\n\t{\r\n\t\t$this->form = $form;\r\n\t}", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitMyeticketsModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submit'.$this->name;\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFieldsValues(),\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "public function renderForm() {\n $enctype = $this->_enctype ? \"enctype=\\\"multipart/form-data\\\"\" : \"\";\n $formAttributes = $this->_renderAttributes($this->_formAttributes);\n $html = \"<form action=\\\"{$this->getAction()}\\\" method=\\\"{$this->_method}\\\" {$enctype} $formAttributes>\";\n $currentFieldset = NULL;\n\n if (count($this->_inputElements)) {\n foreach ($this->_inputElements as $element) {\n if ($element[1] !== NULL) {\n if ($element[1] !== $currentFieldset) {\n if ($currentFieldset !== NULL)\n $html .= \"</fieldset>\";\n $fieldset = $this->_fieldsets[$element[1]];\n $fieldsetAttributes = $this->_renderAttributes($fieldset[1]);\n $html .= \"<fieldset {$fieldsetAttributes}><legend>{$fieldset[0]}</legend>\";\n $currentFieldset = $element[1];\n }\n } else {\n if ($currentFieldset !== NULL)\n $html .= \"</fieldset>\";\n }\n $html .= $this->renderElement($element[0]->getName());\n $currentFieldset = $element[1];\n }\n }\n if (count($this->_hiddenElements)) {\n foreach ($this->_hiddenElements as $element) {\n $html .= $this->renderElement($element->getName());\n }\n }\n $html .= \"</form>\";\n return $html;\n }", "protected function renderForm()\n {\n $this->addAttribute(\"method\",$this->getMethod());\n \n if($this->getHasFile()) $this->addAttribute(\"enctype\",\"multipart/form-data\");\n\n $ret = '<form '.$this->getAttributes().'>';\n if($this->getHasFile())\n {\n $ret .= \"<input type='hidden' name='MAX_FILE_SIZE' value='10485760' />\";\n }\n if($this->error)\n {\n $ret .= \"<div class='fapi-error'><ul>\";\n foreach($this->errors as $error)\n {\n $ret .= \"<li>$error</li>\";\n }\n $ret .= \"</ul></div>\";\n }\n $ret .= $this->renderElements();\n\n $onclickFunction = \"fapi_ajax_submit_\".$this->getId().\"()\";\n $onclickFunction = str_replace(\"-\",\"_\",$onclickFunction);\n \n if($this->getShowClear())\n {\n $clearButton = '<input class=\"fapi-submit\" type=\"reset\" value=\"Clear\"/>';\n }\n\n if($this->getShowSubmit())\n {\n $ret .= '<div id=\"fapi-submit-area\">';\n $submitValue = $this->submitValue?('value=\"'.$this->submitValue.'\"'):\"\";\n if($this->ajaxSubmit)\n {\n $ret .= sprintf('<input class=\"fapi-submit\" type=\"button\" %s onclick=\"%s\" /> %s',$submitValue,$onclickFunction,$clearButton);\n }\n else\n {\n $ret .= sprintf('<input class=\"fapi-submit\" type=\"submit\" %s /> %s',$submitValue,$clearButton);\n }\n $ret .= '</div>';\n }\n $id = $this->getId();\n \n if($id != '')\n {\n $ret .= \"<input type='hidden' name='is_form_{$id}_sent' value='yes' />\";\n }\n \n $ret .= '<input type=\"hidden\" name=\"is_form_sent\" value=\"yes\" />';\n $ret .= '</form>';\n\n if($this->ajaxSubmit)\n {\n $elements = $this->getFields();\n $ajaxData = array();\n foreach($elements as $element)\n {\n $id = $element->getId();\n if($element->getStorable())\n {\n $ajaxData[] = \"'\".urlencode($id).\"='+document.getElementById('$id').\".($element->getType()==\"Field\"?\"value\":\"checked\");\n }\n $validations = $element->getJsValidations();\n $validators .= \"if(!fapiValidate('$id',$validations)) error = true;\\n\";\n }\n $ajaxData[] = \"'fapi_dt=\".urlencode($this->getDatabaseTable()).\"'\";\n $ajaxData = addcslashes(implode(\"+'&'+\", $ajaxData),\"\\\\\");\n\n $ret .=\n \"<script type='text/javascript'>\n function $onclickFunction\n {\n var error = false;\n $validators\n if(error == false)\n {\n \\$.ajax({\n type : 'POST',\n url : '{$this->ajaxAction}',\n data : $ajaxData\n });\n }\n }\n </script>\";\n }\n return $ret;\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitCaptureleadsxavierModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "public function _Render() {\n $form_instance = $this->form_instance;\n // Return the contents\n return '3/15 Questions Answered';\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitWi_spentModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(),\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }", "protected function RenderHTML()\n\t{\n\t $dispmode = $this->GetDisplayMode();\n\t $this->SetDisplayMode($dispmode->GetMode());\n\n $smarty = BizSystem::GetSmartyTemplate();\n $smarty->assign_by_ref(\"name\", $this->m_Name);\n $smarty->assign_by_ref(\"title\", $this->m_Title);\n $smarty->assign_by_ref(\"formstate\", $this->m_FormState);\n $smarty->assign_by_ref(\"toolbar\", $this->m_ToolBar->Render());\n\n if ($dispmode->m_DataFormat == \"array\") // if dataFormat is array, call array render function\n $smarty->assign_by_ref(\"fields\", $this->RenderArray());\n else if ($dispmode->m_DataFormat == \"table\") // if dataFormat is table, call table render function.\n {\n $smarty->assign_by_ref(\"table\", $this->RenderTable());\n $smarty->assign_by_ref(\"formobj\", $this);\n }\n else if ($dispmode->m_DataFormat == \"block\" && $dispmode->m_FormatStyle)\n $smarty->assign_by_ref(\"block\", $this->RenderFormattedTable());\n\n $smarty->assign_by_ref(\"navbar\", $this->m_NavBar->Render());\n\n\t return $smarty->fetch(BizSystem::GetTplFileWithPath($dispmode->m_TemplateFile, $this->m_Package))\n\t . \"\\n\" . $this->RenderShortcutKeys()\n\t . \"\\n\" . $this->RenderContextMenu();\n\t}" ]
[ "0.6683386", "0.65917933", "0.6519513", "0.6431727", "0.6366705", "0.62878877", "0.6241164", "0.62408257", "0.62229854", "0.620923", "0.6206829", "0.6154277", "0.61487544", "0.61463606", "0.61348605", "0.6127034", "0.61113876", "0.60973233", "0.609271", "0.6088244", "0.6057495", "0.60417116", "0.6041494", "0.6040734", "0.60262305", "0.60237813", "0.60170794", "0.5999697", "0.59907866", "0.59732825" ]
0.69840676
0
BizForm::SetClientScripts auto add javascripts code to the page
protected function SetClientScripts() { global $g_BizSystem; if ($this->m_jsClass != "jbForm") $g_BizSystem->GetClientProxy()->AppendScripts($this->m_jsClass, $this->m_jsClass.".js"); // scan all elements foreach ($this->m_RecordRow as $ctrl) { $cType = strtoupper($ctrl->m_Type); if ($cType == "RICHTEXT") $g_BizSystem->GetClientProxy()->IncludeRTEScripts(); else if ($cType == "DATETIME" || $cType == "DATE") $g_BizSystem->GetClientProxy()->IncludeCalendarScripts(); else if ($cType == "AUTOSUGGEST") $g_BizSystem->GetClientProxy()->AppendScripts("scriptaculous", "scriptaculous.js"); } $g_BizSystem->GetClientProxy()->AppendScripts("tablekit", "tablekit.js"); //$g_BizSystem->GetClientProxy()->AppendScripts("fastinit", "fastinit.js"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function addScripts() {\n global $CFG; \n $script = \"<script type=\\\"text/javascript\\\">\n jQuery(document).ready(function() {\n codeActivity.initEdit(); \n codeActivity.ajaxURL = '\" . $CFG->wwwroot . \"/mod/codeactivity/ajax.php';\n codeActivity.lang = {\n empty_name: '\" . addslashes(get_string('js_empty_name', 'codeactivity')) . \"',\n empty_test_code: '\" . addslashes(get_string('js_empty_test_code', 'codeactivity')).\"',\n error_add: '\" . addslashes(get_string('js_error_add', 'codeactivity')).\"',\n error_delete: '\" . addslashes(get_string('js_error_delete', 'codeactivity')).\"',\n error_forbidden: '\" . addslashes(get_string('js_error_forbidden', 'codeactivity')).\"'\n }\n });\n </script>\";\n \n $this->_form->addElement('html', $script);\n }", "public function registerClientScripts()\n {\n // add the script\n $cs = Yii::app()->getClientScript();\n $cs->registerCoreScript('jquery');\n $js = $this->createJsCode();\n $cs->registerScript('mbmenu_' . $this->getId(), $js, CClientScript::POS_READY);\n }", "public function registerFormScripts() {\n $view = $this->getView();\n $view->registerJsFile($this->stripeJs, ['position' => \\yii\\web\\View::POS_HEAD]);\n $js = \"Stripe.setPublishableKey('\" . Yii::$app->stripe->getPublishableKey() . \"');\";\n $view->registerJs($js, \\yii\\web\\View::POS_BEGIN);\n //form scripts\n $view->registerJs($this->stripeResponseHandler, \\yii\\web\\View::POS_READY);\n $view->registerJs($this->stripeRequestHandler, \\yii\\web\\View::POS_READY);\n }", "private function registerClientScripts()\n {\n $view = $this->getView();\n\n DatepickerAsset::$language = $this->_language;\n DatepickerAsset::$juiNoConflict = $this->juiNoConflict;\n DatepickerAsset::register($view);\n\n $clientOptions = array_replace([\n 'format' => 'yyyy-mm-dd',\n ], $this->clientOptions);\n $options = Json::htmlEncode($clientOptions);\n\n $view->registerJs(\"jQuery('#{$this->options['id']}').datepicker(jQuery.extend({autoclose: true, zIndexOffset: 100}, $options));\");\n }", "private function _addJavascript ()\n {\n $options = array ();\n\n if ($this->isTypeahead) {\n $options['documentReady'][] = 'init';\n if ($this->desc)\n $options['documentReady'][] = 'tooltip';\n }\n \n if ($this->selectable) {\n $options['documentReady'][] = 'selectable';\n if ($this->sortable) {\n $options['documentReady'][] = 'sortable';\n }\n }\n\n if ($this->clickable) {\n \t$options['documentReady'][] = 'click';\n }\n\n if (!empty ($options)) {\n $this->buildJS('thesaurus/', $options);\n }\n\n if ($this->selectable) {\n $this->_element->addDocumentReady($this->endJavascript);\n if (isset($this->required_items) && is_array ($this->required_items)) {\n foreach ($this->required_items as $item) {\n $this->_element->addDocumentReady(\"setRequiredItems_\" . $this->idfilter . \" ('$item');\");\n }\n }\n }\n }", "protected function registerClientScript()\n\t{\n\t\t$cs=Yii::app()->clientScript;\n\t\t$cs->registerScriptFile(Yii::app()->request->baseUrl.'/js/ImageSelector.js', CClientScript::POS_HEAD);\n\t}", "public function script() {\r\n\t\tif ($this->scriptable === true || $this->scriptable === 'true') {\r\n\t\t\t$page = pzk_page();\r\n\t\t\tif ($page) {\r\n\t\t\t\t$page->addJsInst($this->toArray());\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private function registerClientScripts()\n {\n $view = $this->getView();\n\n TranslitAsset::register($view);\n\n $replace = Json::htmlEncode(TranslitHelper::$replace);\n $view->registerJs(\"translit.replace = $replace;\", $view::POS_READY, 'translit');\n }", "private function add_rich_form_scripts() {\r\n\r\n\t$this->template->libs_js = array(\r\n\t \"http://code.jquery.com/jquery-1.8.2.js\",\r\n\t \"http://code.jquery.com/ui/1.9.1/jquery-ui.js\",\r\n\t \"jquery-ui-timepicker-addon.js\",\r\n\t \"http://cdn.aloha-editor.org/latest/lib/require.js\"\r\n\t);\r\n\t$this->template->libs_css = array(\r\n\t \"http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css\",\r\n\t \"datetimepicker.css\",\r\n\t \"http://cdn.aloha-editor.org/latest/css/aloha.css\"\r\n\t);\r\n }", "protected function addOnSubmitJavaScriptCode() {}", "public function registerClientScript()\n {\n $view = $this->getView();\n KCFinderWidgetAsset::register($view);\n $this->clientOptions['kcfUrl'] = Yii::$app->assetManager->getPublishedUrl((new KCFinderAsset)->sourcePath);\n\n if ($this->iframe) {\n $this->clientOptions['iframeModalId'] = $this->getIFrameModalId();\n }\n\n $clientOptions = Json::encode($this->clientOptions);\n $view->registerJs(\"jQuery('#{$this->buttonOptions['id']}').KCFinderInputWidget($clientOptions)\");\n }", "public function registerClientScripts()\r\n {\r\n if ($this->baseUrl === '')\r\n throw new CException('Can not find the base folder');\r\n\r\n $this->clientScript = Yii::app()->getClientScript();\r\n \r\n $this->clientScript->registerCoreScript('jquery');\r\n\r\n foreach ($this->Jscripts as $script)\r\n {\r\n \t$this->clientScript->registerScriptFile($this->baseUrl.'/js/'.$script,CClientScript::POS_BEGIN); \t\r\n } \r\n \r\n $this->clientScript->registerCssFile($this->baseUrl.'/css/'.$this->Cssscript);\r\n }", "public function registerClientScripts()\r\n {\r\n if ($this->baseUrl === '')\r\n throw new CException('Can not find the base folder');\r\n\r\n $this->clientScript = Yii::app()->getClientScript();\r\n\r\n// $this->clientScript->registerCoreScript('jquery');\r\n \r\n foreach ($this->Jscripts as $script)\r\n {\r\n $this->clientScript->registerScriptFile($this->baseUrl.'/js/'.$script,CClientScript::POS_HEAD); \t\r\n }\r\n\r\n\r\n \r\n $this->clientScript->registerCssFile($this->baseUrl.'/css/'.$this->Cssscript);\r\n }", "public function registerClientScript() {\n\n// $_cssFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'jquery.innerfade/css/jq_fade.css';\n// $cssFile = Yii::app()->getAssetManager()->publish($_cssFile);\n// Yii::app()->getClientScript()->registerCssFile($cssFile);\n\n $_jsFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'jquery.innerfade/js/jquery.innerfade.js';\n $jsFile = Yii::app()->getAssetManager()->publish($_jsFile);\n\n Yii::app()->getClientScript()->registerScriptFile($jsFile);\n }", "protected function generateJavascript() {}", "protected function generateJavascript() {}", "function generateClientScript()\r\n\t{\r\n\t\tif ($this->bInlineScript)\r\n\t\t{\r\n\t\t\techo \"\\n<script type='text/javascript' \" . $this->sDefer . \"charset='UTF-8'>\\n\";\r\n\t\t\techo \"/* <![CDATA[ */\\n\";\r\n\r\n\t\t\tinclude(dirname(__FILE__) . '/modalWindow.js');\r\n\t\t\t\t\r\n\t\t\techo \"/* ]]> */\\n\";\r\n\t\t\techo \"</script>\\n\";\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\techo \"\\n<script type='text/javascript' src='\" . $this->sJavascriptURI . \"xajax_plugins/response/modalWindow/modalWindow.js' \" . $this->sDefer . \"charset='UTF-8'></script>\\n\";\r\n\t\t}\r\n\t}", "public function registerClientScripts()\r\n {\r\n if ($this->baseUrl === '')\r\n throw new CException('Can not find the base folder');\r\n\r\n $this->clientScript = Yii::app()->getClientScript();\r\n \r\n if($this->needCore)\r\n $this->clientScript->registerCoreScript('jquery');\r\n \r\n foreach ($this->Jscripts as $jsfile)\r\n {\r\n $this->clientScript->registerScriptFile($this->baseUrl.'/'.$jsfile,CClientScript::POS_HEAD); \t\r\n }\r\n foreach ($this->Cssscript as $cssfile)\r\n \t$this->clientScript->registerCssFile($this->baseUrl.'/'.$cssfile);\r\n }", "public function loadScripts() {\n $graphcss = $this->getProperty('graphcss');\n $customcss = $this->getProperty('customcss');\n $loadjquery = $this->getProperty('loadjquery');\n\n $cssUrl = $this->sekug->config['cssUrl'].'web/';\n $jsUrl = $this->sekug->config['jsUrl'].'web/';\n\n if($loadjquery == 1){\n $this->modx->regClientStartupScript($jsUrl.'libs/'.$this->sekug->config['jqueryFile']);\n }\n if($customcss>''){\n $this->modx->regClientCSS($this->modx->getOption('assets_url').$customcss);\n } else {\n $this->modx->regClientCSS($cssUrl.'gallery.structure.css');\n }\n if($graphcss>''){\n $this->modx->regClientCSS($this->modx->getOption('assets_url').$graphcss);\n } else {\n $this->modx->regClientCSS($cssUrl.'directory.graph.css');\n }\n }", "public function setJavascript() {\n $this->javascript = true;\n }", "protected function generateJavascript()\n\t{\n\t}", "protected function registerClientScript()\n {\n $js = [];\n $view = $this->getView();\n\n TinyMceAsset::register($view);\n\n $id = $this->options['id'];\n\n Yii::debug($this->language, 'DBG');\n if ($this->language == null) {\n $this->language = yii::$app->language;\n }\n if ($this->language == \"en\") $this->language = \"en_GB\";\n $this->clientOptions['language'] = $this->language;\n Yii::debug($this->language, 'DBG');\n\n $this->clientOptions['document_base_url'] = yii::$app->urlManager->hostInfo . '/';\n\n $this->clientOptions['content_css'] =\n yii::$app->assetManager->getPublishedUrl(yii::$app->assetManager->getBundle('yii\\bootstrap\\BootstrapAsset')->sourcePath) . \"/css/bootstrap.css,\" .\n $this->extraCss;\n $this->clientOptions['selector'] = \"#$id\";\n\n $langFile = \"langs/{$this->language}.js\";\n $langAssetBundle = TinyMceLangAsset::register($view);\n $langAssetBundle->js[] = $langFile;\n $this->clientOptions['language_url'] = $langAssetBundle->baseUrl . \"/{$langFile}\";\n $options = Json::encode($this->clientOptions);\n\n $js[] = \"tinymce.init($options);\";\n $js[] = \"$('#{$id}').parents('form').on('beforeValidate beforeSubmit submit', function() {\n tinymce.triggerSave();\n $('[name={$id}]').attr('name',$('#{$id}').attr('name'));\n return true;\n });\";\n $view->registerJs(implode(\"\\n\", $js));\n }", "protected function addCustomJS()\n\t{\n\t\t\n\t}", "private function registerScript(){\n Yii::app()->clientScript->registerScript(UniqId::get(\"scr-\", true), \"\n $(window).bind('beforeunload', function(e){\n var scrollTop = $('#$this->id').scrollTop();\n $.cookie( '$this->id', scrollTop, {expires: 7, path: '/'} );\n });\n\n $(window).bind('load', function(){\n var top = $.cookie('$this->id');\n if ( top != undefined ){\n $('#$this->id').scrollTop(top);\n }\n });\n \");\n }", "public function setJavascriptData() {\n // Make Services List\n $services = array(\n 'billingDashboard' => $this->createAbsoluteUrl('billingDashboard/index'),\n // Invoice export / preview urls\n 'exportInvoice' => $this->createAbsoluteUrl('createInvoice', array('report' => 1)),\n );\n // Encode to javascript\n $servicesEncoded = CJavaScript::encode($services);\n \n // Set javascript variable\n Yii::app()->clientScript->registerScript('set_services', \"\n var services = {$servicesEncoded};\n \", CClientScript::POS_BEGIN);\n }", "public function javascript() {\r\n\t\tif ($this->scriptable === true || $this->scriptable === 'true') {\r\n\t\t\t\r\n\t\t\tif(@$this->scriptTo) {\r\n\t\t\t\t$element = pzk_element($this->scriptTo);\r\n\t\t\t\tif($element) {\r\n\t\t\t\t\t$element->append(pzk_parse('<html.js src=\"'.BASE_URL.'/js/'.implode('/', $this->fullNames).'.js\" />'));\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t$page =pzk_page();\r\n\t\t\t\tif ($page) {\r\n\t\t\t\t\t$page->addObjJs($this->tagName);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif ($this->jsLink != false) {\r\n\t\t\tif($this->scriptTo) {\r\n\t\t\t\t$elem = pzk_element($this->scriptTo);\r\n\t\t\t\t$elem->append(pzk_parse('<html.js src=\"'.BASE_REQUEST.'/default/skin/'.pzk_app()->name.'/js/'.$this->jsLink.'.js\" />'));\r\n\t\t\t} else {\r\n\t\t\t\tif($page = pzk_page())\r\n\t\t\t\t\t$page->addObjCss($this->cssLink);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\tif ($this->jsExternalLink != false) {\r\n\t\t\tif($this->scriptTo) {\r\n\t\t\t\t$elem = pzk_element($this->scriptTo);\r\n\t\t\t\t$elem->append(pzk_parse('<html.js src=\"'.$this->jsExternalLink.'\" />'));\r\n\t\t\t} else {\r\n\t\t\t\tif($page = pzk_page()) {\r\n\t\t\t\t\t$page->addExternalCss($this->jsExternalLink);\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}", "private function registerClientScript()\n {\n ArrayInputAsset::register($this->view);\n }", "public function registerClientScript()\n {\n $view = $this->getView();\n\n CroppieAsset::register($view);\n\n if (isset($this->clientOptions['enableExif']) && $this->clientOptions['enableExif'] === true) {\n ExifJsAsset::register($view);\n }\n\n $options = !empty($this->clientOptions)\n ? Json::encode($this->clientOptions)\n : '';\n\n $id = $this->getId();\n\n $js[] = \";jQuery('#$id').croppie($options);\";\n if (!empty($this->clientEvents)) {\n foreach ($this->clientEvents as $event => $handler) {\n $js[] = \"jQuery('#$id').on('$event', $handler);\";\n }\n }\n\n $view->registerJs(implode(\"\\n\", $js));\n }", "protected function registerClientScript()\n\t{\n\t\t// Prepare script package.\n\t\t$this->package = array_merge(array(\n\t\t\t\t'baseUrl' => $this->getAssetsUrl(),\n\t\t\t\t'js' => array(\n\t\t\t\t\tYII_DEBUG ? 'jquery.textmistake.js' : 'jquery.textmistake.min.js',\n\t\t\t\t),\n\t\t\t\t'depends' => array(\n\t\t\t\t\t'jquery',\n\t\t\t\t),\n\t\t\t), $this->package);\n\n\t\t$clientScript = Yii::app()->getClientScript();\n\t\t$options = CJavaScript::encode($this->options);\n\n\t\t$clientScript\n\t\t\t->addPackage(self::PACKAGE_ID, $this->package)\n\t\t\t->registerPackage(self::PACKAGE_ID)\n\t\t\t->registerScript(\n\t\t\t\t$this->id,\n 'jQuery(document).textmistake('.$options.');',\n\t\t\t\tCClientScript::POS_READY\n\t\t\t);\n\t}", "public function init()\n {\n Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . \"/js/search-triple.js\", CClientScript::POS_END);\n\n }" ]
[ "0.7834655", "0.74229556", "0.72017837", "0.71647453", "0.70598006", "0.7002699", "0.70014197", "0.6997561", "0.69918525", "0.69523233", "0.6929925", "0.6902576", "0.69006145", "0.68536353", "0.68114644", "0.68107283", "0.6787066", "0.67858565", "0.6757396", "0.6737201", "0.6736386", "0.67258847", "0.6711923", "0.67072356", "0.6707058", "0.67028314", "0.6701471", "0.6698541", "0.6666824", "0.66443" ]
0.8174726
0
BizForm::ReRender() rerender this form (form is rendered already) .
public function ReRender($redrawForm=true, $hasRecordChange=true) { if ($this->m_ReRenderOn == false) return; // consider the postAction $postAction = $this->GetPostAction(); if ($postAction) { $this->HandlePostAction($postAction); return; } global $g_BizSystem; if ($redrawForm) { if ($g_BizSystem->GetClientProxy()->HasFormRerendered($this->m_Name) == false) $g_BizSystem->GetClientProxy()->ReDrawForm($this->m_Name, $this->RenderHTML()); } if ($hasRecordChange) { $this->ReRenderSubForms(); } return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "#[BeforeReRender]\n public function submitFormOnRender(): void\n {\n if (!$this->getFormInstance()->isSubmitted()) {\n $this->submitForm(false);\n }\n }", "protected function ReRenderSubForms()\n {\n if (!$this->m_SubForms)\n return;\n\n $this->m_ActiveRecord = $this->GetActiveRecord();\n\n global $g_BizSystem;\n $mode = $this->GetDisplayMode()->GetMode();\n foreach($this->m_SubForms as $subForm) {\n $formObj = $g_BizSystem->GetObjectFactory()->GetObject($subForm);\n $formObj->SetPostActionOff();\n if ($mode == MODE_N) { // parent form on new mode\n $formObj->SetPrtCommitPending(true);\n }\n else {\n $formObj->SetPrtCommitPending(false);\n $dataObj = $this->GetDataObj()->GetRefObject($formObj->m_DataObjName);\n if ($dataObj)\n $formObj->SetDataObj($dataObj);\n }\n // force the active row on the first row\n $formObj->SetActiveRecordId(null);\n $formObj->ReRender();\n }\n return;\n }", "function reload_form() {\n\tglobal $ROW, $ERROR_MESSAGE;\n\n\t// Only reload if it hasn't been reloaded already\n\tif ( $ERROR_MESSAGE && ( !isset($ROW[0]['STATUS']) || $ROW[0]['STATUS'] != 'RELOAD') ) {\n\t\t$ROW[0]=$_POST;\n\t\t$ROW[0]['STATUS']='RELOAD';\n\t\tLOG_MSG('INFO',\"reload_form(): ROW=[\".print_r($ROW,true).\"]\");\n\t}\n}", "public function Render()\n\t{\n\t // when in NEW mode or when parent form in NEW mode, do nothing\n\t global $g_BizSystem;\n\t $prtMode = \"\";\n\t if ($this->m_ParentFormName) {\n $prtForm = $g_BizSystem->GetObjectFactory()->GetObject($this->m_ParentFormName);\n $prtMode = $prtForm->GetDisplayMode()->GetMode();\n\t }\n\t if ($this->m_Mode != MODE_N && $prtMode != MODE_N)\n\t {\n \t // get view history\n \t if (!$this->m_NoHistoryInfo)\n\t $this->SetHistoryInfo($g_BizSystem->GetSessionContext()->GetViewHistory($this->m_Name));\n\t }\n\t if ($this->m_Mode == MODE_N)\n $this->UpdateActiveRecord($this->GetDataObj()->NewRecord());\n\n //Moved the renderHTML function infront of declaring subforms\n $renderedHTML = $this->RenderHTML();\n\n\t global $g_BizSystem;\n\t // prepare the subforms' dataobjs, since the subform relates to parent form by dataobj association\n\t if ($this->m_SubForms) {\n \t foreach($this->m_SubForms as $subForm) {\n $formObj = $g_BizSystem->GetObjectFactory()->GetObject($subForm);\n $dataObj = $this->GetDataObj()->GetRefObject($formObj->m_DataObjName);\n if ($dataObj)\n $formObj->SetDataObj($dataObj);\n }\n\t }\n\t $this->SetClientScripts();\n\n return $renderedHTML;\n\t}", "public function resetForm()\n\t{\n\t\tparent::resetForm();\n\t\t$this->setNeedReinitRulesFlag();\n\t}", "public function getRender(){\n //Adiciona a funcionalidade para definir o campo que deve receber o foco inicial\n if($this->getCampoFoco() != null){\n $sFuncao = View::campoFocus($this->getCampoFoco()->getId());\n $this->addListener(Base::EVENTO_APOS_MONTAR, $sFuncao);\n }\n \n //Adiciona a funcionalidade que centraliza o formulário na tela\n if($this->getCentraliza()){\n $sFuncao = Base::getFuncaoCentraliza();\n $this->addListener(Base::EVENTO_MONTAR, $sFuncao);\n }\n \n //Adiciona a funcionalidade que indica que será possível arrastar o formulário\n if($this->getPermiteArrastar()){\n $sFuncao = Base::getFuncaoLimitaArrasto($this->getId(),$this->getRenderTo());\n $this->addListener(Base::EVENTO_MONTAR, $sFuncao);\n }\n \n $aRender = array(\n \"animCollapse\" => true,\n \"autoScroll\" => true,\n \"waitMsgTarget\" => true,\n \"bodyPadding\" => 10,\n \"iconCls\" => 'icon-form',\n \"border\" => $this->getAdicionaBorda(),\n //\"glyph\" => 36,\n \"layout\" => $this->getLayout(),\n \"id\" => $this->getId(),\n \"title\" => $this->getTitulo(),\n \"closable\" => $this->getPermiteFechar(),\n \"resizable\" => $this->getPermiteRedimensionar(),\n \"draggable\" => $this->getPermiteArrastar(),\n \"collapsible\" => $this->getPermiteRecolher(),\n \"height\" => $this->getAltura(),\n \"width\" => $this->getLargura(),\n \"html\" => $this->getHtml(),\n \"items\" => $this->getStringItemsLayout(),\n \"buttons\" => $this->getBotoes(),\n \"listeners\" => $this->getListeners(),\n \"reloadPreviousOnClose\" => $this->getReloadPreviousOnClose()\n );\n \n $oForm = \"Ext.create('Ext.panel.Panel', {\".Base::getRender($aRender).\"})\";\n \n return Base::addObj($oForm,$this->getRenderTo());\n }", "function _onRenderForm($tmp) {\n\t\t\n\t\t/* Show Page title */\n\t\tif ($this->_FORM_CONFIG ['showtitle'] == 1) {\n\t\t\t$tmp->assign ( 'SHOW_PAGE_TITLE', TRUE );\n\t\t}\n\t\t\n\t\t/* Show Reset Button */\n\t\tif ($this->_FORM_CONFIG ['showresetbutton'] == 1) {\n\t\t\t$tmp->assign ( 'SHOW_RESET_BUTTON', TRUE );\n\t\t}\n\t\t\n\t\t$tmp->assign ( 'RESETBUTTONTEXT', $this->_FORM_CONFIG ['resetbuttontext'] );\n\t\t$tmp->assign ( 'SUBMITBUTTONTEXT', $this->_FORM_CONFIG ['submitbuttontext'] );\n\t\t\n\t\treturn $tmp;\n\t}", "function render(Form $form);", "function goToFormReinit(){\n\n require('view/frontend/formReinitMdpView.php');\n }", "public function modifyView() {\n $this->object = $this->object->readObject($this->id);\n $uiObjectName = $this->type.'_Ui';\n $uiObject = new $uiObjectName($this->object);\n $values = array_merge($this->object->valuesArray(), $this->values);\n return $uiObject->renderForm(array_merge(\n array('values'=>$values,\n 'action'=>url($this->type.'/modify', true),\n 'class'=>'formAdmin formAdminModify'),\n array('submit'=>array('save'=>__('save'),\n 'saveCheck'=>__('saveCheck')))));\n }", "public function render()\n {\n $root =& XCube_Root::getSingleton();\n $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM);\n\n $renderTarget =& $renderSystem->createRenderTarget('main');\n\n $renderTarget->setAttribute('legacy_module', 'legacy');\n $renderTarget->setTemplateName('legacy_xoopsform_tableform.html');\n $renderTarget->setAttribute('form', $this);\n\n $renderSystem->render($renderTarget);\n\n return $renderTarget->getResult();\n }", "public function Render($form)\r\n\t{\r\n\t\t$this->form = $form;\r\n\t}", "public function updateForm(){\n $new = $this->model->getNew();\n $this->view->updateForm($new);\n }", "abstract function repopulate(Form $arg0);", "protected function Form_Run() {}", "function update() {\n\t\tglobal $tpl, $lng;\n\n\t\t$form = $this->initForm(TRUE);\n\t\tif ($form->checkInput()) {\n\t\t\tif ($this->updateElement($this->getPropertiesFromPost($form))) {\n\t\t\t\tilUtil::sendSuccess($lng->txt('msg_obj_modified'), TRUE);\n\t\t\t\t$this->returnToParent();\n\t\t\t}\n\t\t}\n\n\t\t$form->setValuesByPost();\n\t\t$tpl->setContent($form->getHtml());\n\t}", "function render ()\n {\n parent::render();\n }", "public function renderForm() {\n\n $id_default_lang = $this->context->language->id;\n $id_shop = $this->context->shop->id;\n\n /* Render Form */\n $carousel_types = array(\n array(\n 'value' => 'featured',\n 'name' => $this->l('Featured products')\n ),\n array(\n 'value' => 'new',\n 'name' => $this->l('New products')\n ),\n array(\n 'value' => 'special',\n 'name' => $this->l('Special products')\n ),\n array(\n 'value' => 'category',\n 'name' => $this->l('All products from certain category')\n ),\n array(\n 'value' => 'custom',\n 'name' => $this->l('Custom products')\n )\n );\n\n // Get Categories\n $root_category = Category::getRootCategory($id_default_lang);\n $this->_getCategories($root_category->id_category, $id_shop);\n\n // Init Fields form array\n $this->fields_form = array(\n 'legend' => array(\n 'title' => $this->l('Carousel'),\n 'icon' => 'icon-cogs'\n ),\n // Inputs\n 'input' => array(\n array(\n 'type' => 'text',\n 'label' => $this->l('Carousel Title'),\n 'name' => 'title',\n 'desc' => $this->l('Must be less than 250 characters.'),\n 'size' => 50,\n 'required' => true,\n 'lang' => true\n ),\n array(\n 'type' => 'select',\n 'name' => 'carousel_type',\n 'label' => $this->l('Carousel Content'),\n 'required' => false,\n 'lang' => false,\n 'options' => array(\n 'query' => $carousel_types,\n 'id' => 'value',\n 'name' => 'name'\n )\n ),\n array(\n 'type' => 'select',\n 'name' => 'select_category',\n 'label' => $this->l('Select a category'),\n 'required' => false,\n 'lang' => false,\n 'options' => array(\n 'query' => $this->_categorySelect,\n 'id' => 'value',\n 'name' => 'name'\n )\n ),\n array(\n 'type' => 'text',\n 'label' => $this->l('Add a product'),\n 'name' => 'product_autocomplete',\n 'size' => 50,\n ),\n array(\n 'type' => 'text',\n 'label' => $this->l('Carousel Content'),\n 'name' => 'carousel_content',\n 'size' => 50\n ),\n ),\n // Submit Button\n 'submit' => array(\n 'title' => $this->l('Save'),\n 'name' => 'saveProductCarousel'\n )\n );\n\n if (Shop::isFeatureActive()){\n $this->fields_form['input'][] = array(\n 'type' => 'shop',\n 'label' => $this->l('Shop association'),\n 'name' => 'checkBoxShopAsso',\n );\n }\n\n if (!($obj = $this->loadObject(true)))\n return;\n\n if ($obj && $obj->carousel_type == 'custom'){\n $carousel_content_products = array();\n $carousel_content = explode(',', $obj->carousel_content);\n\n foreach ($carousel_content as $pid) {\n $product = new Product($pid, false, $id_default_lang);\n $carousel_content_products[] = array(\n 'id' => $pid,\n 'name' => $product->name,\n 'ref' => $product->reference\n );\n }\n\n $this->tpl_form_vars['carousel_content_products'] = $carousel_content_products;\n }\n\n return parent::renderForm();\n }", "public function postRender()\n {\n }", "public function redrawForm($formName, $sHTML)\n {\n if ($this->isRpc) {\n $this->_formsOutput[$formName] = $this->buildTargetContent($formName, $sHTML);\n } else {\n $this->_formsOutput[$formName] = $sHTML;\n }\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitKushkipagosModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n if(Currency::getDefaultCurrency()->iso_code=='COP'){\n return $helper->generateForm(array($this->getConfigFormCOP()));\n }else{\n return $helper->generateForm(array($this->getConfigForm()));\n }\n\n }", "protected function regenerateFormControls()\n\t{\n\t\t$form = $this->getForm();\n\n\t\t// regenerate checker's checkbox controls\n\t\tif ($this->hasOperations()) {\n\t\t\t$values = $form->getValues();\n\n\t\t\t$form->removeComponent($form['checker']);\n\t\t\t$sub = $form->addContainer('checker');\n\t\t\tforeach ($this->getRows() as $row) {\n\t\t\t\t$sub->addCheckbox($row[$this->keyName], $row[$this->keyName]);\n\t\t\t}\n\n\t\t\tif (!empty($values['checker'])) {\n\t\t\t\t$form->setDefaults(array('checker' => $values['checker']));\n\t\t\t}\n\t\t}\n\n\t\t// for selectbox filter controls update values if was filtered over column\n\t\tif ($this->hasFilters()) {\n\t\t\tparse_str($this->filters, $list);\n\n\t\t\tforeach ($this->getFilters() as $filter) {\n\t\t\t\tif ($filter instanceof SelectboxFilter) {\n\t\t\t\t\t$filter->generateItems();\n\t\t\t\t}\n\n\t\t\t\tif ($this->filters === $this->defaultFilters && ($filter->value !== NULL || $filter->value !== '')) {\n\t\t\t\t\tif (!in_array($filter->getName(), array_keys($list))) $filter->value = NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// page input & items selectbox\n\t\t$form['page']->setValue($this->paginator->page); // intentionally page from paginator\n\t\t$form['items']->setValue($this->paginator->itemsPerPage);\n\t}", "public function postDispatch()\n {\n if ($this->_shouldRender()) {\n $this->render();\n }\n }", "public function RefreshQuery()\n {\n if ($this->m_OnSortField) {\n $this->SetSortFieldFlag($this->m_OnSortField, null);\n $this->m_OnSortField = null;\n $this->GetDataObj()->ClearSortRule();\n }\n $this->SetDisplayMode (MODE_R);\n $this->m_ClearSearchRule = true;\n return $this->ReRender();\n }", "protected function callRenderMethod() {}", "public function index_onUpdateForm()\n\t{\n\t\t$record_id = post('record_id');\n\t\tparent::update($record_id);\n\t\t$this->controller->vars['record_id'] = $record_id;\n\t\treturn $this->makePartial('update');\n\t}", "public function render() {\n $formContainsRequiredFields = FALSE;\n $htmlElements = array();\n\n foreach($this->elements as $element) {\n if(!$this->getMarkRequiredFields()) {\n $element['object']->markIfRequired(FALSE);\n }\n\n if($element['object']->isRequired()) $formContainsRequiredFields = TRUE;\n $element['object']->render();\n if($element['object']->errorOccured()) $this->setError(TRUE);\n\n $htmlElements[] = $element['object']->fetch();\n $this->javascripts .= $element['object']->getJavaScripts();\n }\n\n $this->html = implode(\"\\n<span class=\\\"element_separator\\\">&nbsp;</span>\", $htmlElements);\n $preForm = (bool)$this->headline ? FORMWIZARD_PRE_FORM_HEADLINE : FORMWIZARD_PRE_FORM;\n\n $html = NULL;\n\n $html .= '<style type=\"text/css\">@import url('.FORMWIZARD_CSS_URL.\");</style>\\n\";\n $html .= str_replace('{headline}', $this->headline, $preForm);\n $html .= \"\\n\".'<form name=\"'.$this->name.'\" method=\"'.$this->method.'\" action=\"'.$this->action.'\" enctype=\"multipart/form-data\">';\n $html .= \"\\n\".'<input type=\"hidden\" name=\"__'.$this->name.'_submitted\" value=\"1\" />';\n $html .= \"\\n\".$this->html;\n $html .= \"\\n\".'</form>';\n $html .= \"\\n\".'<script type=\"text/javascript\">'.$this->javascripts.'</script>';\n\n if($formContainsRequiredFields && $this->markRequiredFields) {\n $html .= \"\\n\".FORMWIZARD_LEGEND_REQUIRED_FIELD;\n }\n\n $this->html = $html.\"\\n\".FORMWIZARD_POST_FORM;\n\n $this->isRendered = TRUE;\n }", "public function saveForm()\n\t{\n\t\tparent::saveForm();\n\t\t$this->setNeedReinitRulesFlag();\n\t}", "public static function refresh(array $form, FormStateInterface $form_state) {\n $form_state->setRebuild();\n }", "protected function renderForm()\n {\n $helper = new HelperForm();\n\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $helper->module = $this;\n $helper->default_form_language = $this->context->language->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);\n\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'submitOrderrefModule';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)\n .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id,\n );\n\n return $helper->generateForm(array($this->getConfigForm()));\n }" ]
[ "0.7193632", "0.69183314", "0.61419123", "0.60782564", "0.5925603", "0.59230065", "0.5920741", "0.5748224", "0.57376385", "0.5657635", "0.5573895", "0.5536717", "0.55123013", "0.549581", "0.5471474", "0.54503703", "0.5428482", "0.5414958", "0.54090816", "0.5375595", "0.5362937", "0.53419304", "0.5340902", "0.5339753", "0.53211707", "0.53097105", "0.53059757", "0.5304808", "0.52943027", "0.52869713" ]
0.7392372
0
BizForm::ReRenderSubForms() rerender sub forms who has dependecy on this form. This method is called when parent form's change affect the sub forms
protected function ReRenderSubForms() { if (!$this->m_SubForms) return; $this->m_ActiveRecord = $this->GetActiveRecord(); global $g_BizSystem; $mode = $this->GetDisplayMode()->GetMode(); foreach($this->m_SubForms as $subForm) { $formObj = $g_BizSystem->GetObjectFactory()->GetObject($subForm); $formObj->SetPostActionOff(); if ($mode == MODE_N) { // parent form on new mode $formObj->SetPrtCommitPending(true); } else { $formObj->SetPrtCommitPending(false); $dataObj = $this->GetDataObj()->GetRefObject($formObj->m_DataObjName); if ($dataObj) $formObj->SetDataObj($dataObj); } // force the active row on the first row $formObj->SetActiveRecordId(null); $formObj->ReRender(); } return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function ReRender($redrawForm=true, $hasRecordChange=true)\n\t{\n\t if ($this->m_ReRenderOn == false)\n\t return;\n\t \n\t // consider the postAction\n\t $postAction = $this->GetPostAction();\n if ($postAction) {\n $this->HandlePostAction($postAction);\n return;\n }\n\n global $g_BizSystem;\n if ($redrawForm)\n {\n if ($g_BizSystem->GetClientProxy()->HasFormRerendered($this->m_Name) == false)\n\t $g_BizSystem->GetClientProxy()->ReDrawForm($this->m_Name, $this->RenderHTML());\n }\n\t if ($hasRecordChange)\n\t {\n\t $this->ReRenderSubForms();\n\t }\n\t return;\n\t}", "public function Render()\n\t{\n\t // when in NEW mode or when parent form in NEW mode, do nothing\n\t global $g_BizSystem;\n\t $prtMode = \"\";\n\t if ($this->m_ParentFormName) {\n $prtForm = $g_BizSystem->GetObjectFactory()->GetObject($this->m_ParentFormName);\n $prtMode = $prtForm->GetDisplayMode()->GetMode();\n\t }\n\t if ($this->m_Mode != MODE_N && $prtMode != MODE_N)\n\t {\n \t // get view history\n \t if (!$this->m_NoHistoryInfo)\n\t $this->SetHistoryInfo($g_BizSystem->GetSessionContext()->GetViewHistory($this->m_Name));\n\t }\n\t if ($this->m_Mode == MODE_N)\n $this->UpdateActiveRecord($this->GetDataObj()->NewRecord());\n\n //Moved the renderHTML function infront of declaring subforms\n $renderedHTML = $this->RenderHTML();\n\n\t global $g_BizSystem;\n\t // prepare the subforms' dataobjs, since the subform relates to parent form by dataobj association\n\t if ($this->m_SubForms) {\n \t foreach($this->m_SubForms as $subForm) {\n $formObj = $g_BizSystem->GetObjectFactory()->GetObject($subForm);\n $dataObj = $this->GetDataObj()->GetRefObject($formObj->m_DataObjName);\n if ($dataObj)\n $formObj->SetDataObj($dataObj);\n }\n\t }\n\t $this->SetClientScripts();\n\n return $renderedHTML;\n\t}", "#[BeforeReRender]\n public function submitFormOnRender(): void\n {\n if (!$this->getFormInstance()->isSubmitted()) {\n $this->submitForm(false);\n }\n }", "public function setSubFormDecorators(Zend_Form_SubForm $subForm)\r\n {\r\n $subForm->setDecorators(array('FormElements',\r\n array('HtmlTag', \r\n array('tag' => 'dl',\r\n 'class' => 'zend_form')),\r\n 'Form',\r\n ));\r\n \r\n \r\n //if ($subForm->getName() == 'basic_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'devotees/addNewDevotee.phtml')),\r\n// ));\r\n// \r\n// }\r\n// \r\n// if ($subForm->getName() == 'personal_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'devotees/addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n//\r\n// if ($subForm->getName() == 'address_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n// \r\n// if ($subForm->getName() == 'family_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n// \r\n// if ($subForm->getName() == 'education_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n// \r\n// if ($subForm->getName() == 'office_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n// \r\n// if ($subForm->getName() == 'devotional_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n// \r\n// if ($subForm->getName() == 'services_info') {\r\n// $subForm->setDecorators(array('PrepareElements',\r\n// array('ViewScript', \r\n// array('viewScript' => 'addNewDevotee.phtml')),\r\n// ));\r\n//\r\n// }\r\n\r\n return $this;\r\n }", "public function updateForms()\n {\n $this->updateSubmitForms();\n $this->updateSearchForms();\n $this->updateSearchFields();\n $this->updateFeaturedFormFields();\n $this->updateTitlesFormFields();\n $this->updateShortFormFields();\n $this->updateSortingFormFields();\n }", "protected function regenerateFormControls()\n\t{\n\t\t$form = $this->getForm();\n\n\t\t// regenerate checker's checkbox controls\n\t\tif ($this->hasOperations()) {\n\t\t\t$values = $form->getValues();\n\n\t\t\t$form->removeComponent($form['checker']);\n\t\t\t$sub = $form->addContainer('checker');\n\t\t\tforeach ($this->getRows() as $row) {\n\t\t\t\t$sub->addCheckbox($row[$this->keyName], $row[$this->keyName]);\n\t\t\t}\n\n\t\t\tif (!empty($values['checker'])) {\n\t\t\t\t$form->setDefaults(array('checker' => $values['checker']));\n\t\t\t}\n\t\t}\n\n\t\t// for selectbox filter controls update values if was filtered over column\n\t\tif ($this->hasFilters()) {\n\t\t\tparse_str($this->filters, $list);\n\n\t\t\tforeach ($this->getFilters() as $filter) {\n\t\t\t\tif ($filter instanceof SelectboxFilter) {\n\t\t\t\t\t$filter->generateItems();\n\t\t\t\t}\n\n\t\t\t\tif ($this->filters === $this->defaultFilters && ($filter->value !== NULL || $filter->value !== '')) {\n\t\t\t\t\tif (!in_array($filter->getName(), array_keys($list))) $filter->value = NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// page input & items selectbox\n\t\t$form['page']->setValue($this->paginator->page); // intentionally page from paginator\n\t\t$form['items']->setValue($this->paginator->itemsPerPage);\n\t}", "function RenderChildren() {\n if ($this->HasControls()) {\n foreach($this->Controls as $control) {\n $control->Render();\n }\n }\n }", "private function loadSubWidgets()\n {\n $subWidgets = [];\n // get widgets for the fields\n foreach ($this->fields as $index => $field) :\n $subWidgets[$index] = $field->widget;\n endforeach;\n\n $this->widget->setSubWidgets($subWidgets);\n }", "protected function _prepareForm()\n\t{\n\t\tparent::_prepareForm();\n\n\t\t$oMainTab = $this->getTab('main');\n\t\t$oAdditionalTab = $this->getTab('additional');\n\n\t\t$windowId = $this->_Admin_Form_Controller->getWindowId();\n\n\t\t$oMainTab\n\t\t\t->add(Admin_Form_Entity::factory('Div')->class('row')\n\t\t\t\t->add($oDivLeft = Admin_Form_Entity::factory('Div')->class('col-xs-12 col-md-6 col-lg-7 left-block'))\n\t\t\t\t->add($oDivRight = Admin_Form_Entity::factory('Div')->class('col-xs-12 col-md-6 col-lg-5 right-block'))\n\t\t\t);\n\n\t\t\t$oMainTab\n\t\t\t->add(Admin_Form_Entity::factory('Script')\n\t\t\t\t->value('\n\t\t\t\t\t$(function(){\n\t\t\t\t\t\tvar timer = setInterval(function(){\n\t\t\t\t\t\t\tif ($(\"#' . $windowId . ' .left-block\").height())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclearInterval(timer);\n\n\t\t\t\t\t\t\t\t$(\"#' . $windowId . ' .right-block\").find(\"#' . $windowId . '_notes\").slimscroll({\n\t\t\t\t\t\t\t\t\theight: $(\"#' . $windowId . ' .left-block\").height() - 75,\n\t\t\t\t\t\t\t\t\tcolor: \"rgba(0, 0, 0, 0.3)\",\n\t\t\t\t\t\t\t\t\tsize: \"5px\"\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t});\n\t\t\t\t'));\n\n\t\t$oDivLeft\n\t\t\t->add($oMainRow1 = Admin_Form_Entity::factory('Div')->class('row'))\n\t\t\t->add($oMainRow2 = Admin_Form_Entity::factory('Div')->class('row'))\n\t\t\t->add($oMainRow3 = Admin_Form_Entity::factory('Div')->class('row'))\n\t\t\t->add($oMainRow4 = Admin_Form_Entity::factory('Div')->class('row'))\n\t\t\t;\n\n\t\t$oDivRight\n\t\t\t->add($oMainRowRight1 = Admin_Form_Entity::factory('Div')->class('row'));\n\n\t\t$sColorValue = ($this->_object->id && $this->getField('color')->value)\n\t\t\t? $this->getField('color')->value\n\t\t\t: '#aebec4';\n\n\t\t$this->getField('color')\n\t\t\t->colorpicker(TRUE)\n\t\t\t->value($sColorValue);\n\n\t\t$oMainTab\n\t\t\t->move($this->getField('name')->divAttr(array('class' => 'form-group col-xs-12')), $oMainRow1)\n\t\t\t->move($this->getField('description')->divAttr(array('class' => 'form-group col-xs-12'))->rows(10), $oMainRow2)\n\t\t\t->move($this->getField('datetime')->divAttr(array('class' => 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-6')), $oMainRow3)\n\t\t\t->move($this->getField('deadline')->divAttr(array('class' => 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-6')), $oMainRow3)\n\t\t\t->move($this->getField('color')->set('data-control', 'hue')->divAttr(array('class' => 'form-group col-xs-12 col-sm-6')), $oMainRow4)\n\t\t\t->move($this->getField('completed')->divAttr(array('class' => 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-6 margin-top-21')), $oMainRow4);\n\n\t\t$windowId = $this->_Admin_Form_Controller->getWindowId();\n\n\t\t$countNotes = $this->_object->Crm_Notes->getCount()\n\t\t\t? '<span class=\"badge badge-palegreen\">' . $this->_object->Crm_Notes->getCount() . '</span>'\n\t\t\t: '';\n\n\t\tob_start();\n\t\t?>\n\t\t<div class=\"tabbable\">\n\t\t\t<ul class=\"nav nav-tabs tabs-flat\" id=\"crmProjectTabs\">\n\t\t\t\t<li class=\"active\">\n\t\t\t\t\t<a data-toggle=\"tab\" href=\"#<?php echo $windowId?>_notes\" data-path=\"/admin/crm/project/note/index.php\" data-window-id=\"<?php echo $windowId?>_notes\" data-additional=\"crm_project_id=<?php echo $this->_object->id?>\">\n\t\t\t\t\t\t<?php echo Core::_(\"Crm_Project.tabNotes\")?> <?php echo $countNotes?>\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t\t<div class=\"tab-content tabs-flat\">\n\t\t\t\t<div id=\"<?php echo $windowId?>_notes\" class=\"tab-pane in active\">\n\t\t\t\t\t<?php\n\t\t\t\t\tAdmin_Form_Entity::factory('Div')\n\t\t\t\t\t\t->controller($this->_Admin_Form_Controller)\n\t\t\t\t\t\t->id(\"crm-project-notes\")\n\t\t\t\t\t\t->add(\n\t\t\t\t\t\t\t$this->_object->id\n\t\t\t\t\t\t\t\t? $this->_addNotes()\n\t\t\t\t\t\t\t\t: Admin_Form_Entity::factory('Code')->html(\n\t\t\t\t\t\t\t\t\tCore_Message::get(Core::_('Crm_Project.enable_after_save'), 'warning')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t->execute();\n\t\t\t\t\t?>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<?php\n\t\t$oMainRowRight1->add(Admin_Form_Entity::factory('Div')\n\t\t\t->class('form-group col-xs-12 margin-top-20')\n\t\t\t->add(\n\t\t\t\tAdmin_Form_Entity::factory('Code')\n\t\t\t\t\t->html(ob_get_clean())\n\t\t\t)\n\t\t);\n\n\t\t$this->title($this->_object->id\n\t\t\t? Core::_('Crm_Project.edit_title', $this->_object->name, FALSE)\n\t\t\t: Core::_('Crm_Project.add_title')\n\t\t);\n\n\t\treturn $this;\n\t}", "public function init() {\n $this->setMethod('post');\n $this->setAction($this->getView()->url());\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/collapsiblefields.js', 'text/javascript'));\n\n $subform = new Dnna_Form_SubFormBase($this->_view);\n // Επιλογή Έργου/Υποέργου\n $subform->addSubForm(new Application_Form_Subforms_SubProjectSelect(array('required' => true), $this->_view), 'subproject', false);\n // Επιλογή Δικαιούχου\n $subsubform = new Dnna_Form_SubFormBase();\n if($this->_aitisi != null && $this->_aitisi->get_recipientauthor() != null) {\n $employee = array($this->_aitisi->get_recipientauthor()->get_recordid() => $this->_aitisi->get_recipientauthor()->__toString());\n } else {\n $employee = array();\n }\n if($this->_aitisi != null && $this->_aitisi->get_recipientcontractor() != null) {\n $contractor = array($this->_aitisi->get_recipientcontractor()->get_recordid() => $this->_aitisi->get_recipientcontractor()->__toString());\n } else {\n $contractor = array();\n }\n $subsubform->addElement('select', 'recordid', array(\n 'label' => 'Δικαιούχος (Σύμβαση):',\n 'registerInArrayValidator' => false,\n 'multiOptions' => $employee,\n ));\n $subform->addSubForm($subsubform, 'recipientauthor', false);\n $subsubform = new Dnna_Form_SubFormBase();\n $subsubform->addElement('select', 'recordid', array(\n 'label' => 'Δικαιούχος (Σύμβαση):',\n 'registerInArrayValidator' => false,\n 'multiOptions' => $contractor,\n ));\n $subform->addSubForm($subsubform, 'recipientcontractor', false);\n // Ποσό Εντολής (€):\n $subform->addElement('text', 'amount', array(\n 'label' => 'Ποσό Εντολής (€):',\n 'required' => true,\n 'validators' => array(\n array('validator' => 'Float')\n ),\n 'class' => 'formatFloat',\n ));\n // Είδος Πληρωμής\n $subform->addElement('select', 'type', array(\n 'required' => true,\n 'label' => 'Είδος Πληρωμής:',\n 'multiOptions' => Aitiseis_Model_EntoliPliromis::getConstantAsArray('TYPE')\n ));\n // Είδος Παραστατικού (αν το είδος πληρωμής είναι Αμοιβή)\n $subform->addElement('select', 'vouchertype', array(\n 'required' => true,\n 'label' => 'Είδος Παραστατικού:',\n 'multiOptions' => Aitiseis_Model_EntoliPliromis::getConstantAsArray('VOUCHERTYPE')\n ));\n // Υποτύπος (αν το είδος ΔΕΝ είναι Αμοιβή)\n $subform->addElement('select', 'subtype', array(\n 'label' => 'Τύπος:',\n 'multiOptions' => Aitiseis_Model_EntoliPliromis::getConstantAsArray('SUBTYPE')\n ));\n // Αιτιολογία\n $subform->addElement('textarea', 'reasoning', array(\n 'label' => 'Αιτιολογία:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, $this->_textareaMaxLength))\n ),\n 'rows' => $this->_textareaRows,\n 'cols' => $this->_textareaCols,\n 'required' => true,\n ));\n // Κωδικός Λογιστικής\n $subform->addElement('text', 'acccode', array(\n 'label' => 'Κωδικός Λογιστικής:',\n )\n );\n // Κατηγορία δαπάνης (από την σχετική λίστα)\n $subform->addElement('select', 'expenditurecategory', array(\n 'label' => 'Κατηγορία Δαπάνης:',\n 'required' => true,\n 'multiOptions' => Application_Model_Repositories_Lists::getListAsArray('Application_Model_Lists_ExpenditureCategory')\n ));\n // Τρόπος Πληρωμής\n $subform->addElement('select', 'paymentmethod', array(\n 'required' => true,\n 'label' => 'Τρόπος Πληρωμής:',\n 'multiOptions' => Aitiseis_Model_EntoliPliromis::getConstantAsArray('PAYMENTMETHOD')\n ));\n // Τραπεζικός λογαριασμός δικαιούχου\n $subform->addElement('text', 'recbankaccount', array(\n 'label' => 'Τραπεζικός λογαριασμός δικαιούχου:',\n ));\n\n $this->addSubForm($subform, 'default');\n // Επιλογή παραδοτέων\n $this->addDeliverableFields($subform);\n\n $this->addSubmitFields();\n }", "function InitChildControls() {\n }", "public function admin_render()\n {\n $output = $this->admin_form_before();\n $output .= $this->admin_form_start();\n $output .= $this->default_fields();\n $widget_saved_values = $this->get_settings();\n\n $output .= $this->admin_language_tab(); //have to start language tab from here on\n $output .= $this->admin_language_tab_start();\n\n $all_languages = LanguageHelper::all_languages();\n foreach ($all_languages as $key => $lang) {\n $output .= $this->admin_language_tab_content_start([\n 'class' => $key == 0 ? 'tab-pane fade show active' : 'tab-pane fade',\n 'id' => \"nav-home-\" . $lang->slug\n ]);\n $output .= Text::get([\n 'name' => 'title_'.$lang->slug,\n 'label' => __('Title'),\n 'value' => $widget_saved_values['title_' . $lang->slug] ?? null,\n ]);\n $output .= $this->admin_language_tab_content_end();\n }\n\n $output .= $this->admin_language_tab_end(); //have to end language tab\n\n $output .= Repeater::get([\n 'multi_lang' => true,\n 'settings' => $widget_saved_values,\n 'id' => 'contact_page_contact_info_01',\n 'fields' => [\n [\n 'type' => RepeaterField::TEXT,\n 'name' => 'title',\n 'label' => __('Title')\n ],\n [\n 'type' => RepeaterField::TEXTAREA,\n 'name' => 'description',\n 'label' => __('Details'),\n 'info' => __('new line count as a separate text')\n ],\n [\n 'type' => RepeaterField::ICON_PICKER,\n 'name' => 'icon',\n 'label' => __('Icon')\n ]\n ]\n ]);\n $output .= Select::get([\n 'name' => 'custom_form_id',\n 'label' => __('Custom Form'),\n 'placeholder' => __('Select form'),\n 'options' => FormBuilder::all()->pluck('title','id')->toArray(),\n 'value' => $widget_saved_values['custom_form_id'] ?? []\n ]);\n $output .= Slider::get([\n 'name' => 'padding_top',\n 'label' => __('Padding Top'),\n 'value' => $widget_saved_values['padding_top'] ?? 120,\n 'max' => 500,\n ]);\n $output .= Slider::get([\n 'name' => 'padding_bottom',\n 'label' => __('Padding Bottom'),\n 'value' => $widget_saved_values['padding_bottom'] ?? 120,\n 'max' => 500,\n ]);\n $output .= $this->admin_form_submit_button();\n $output .= $this->admin_form_end();\n $output .= $this->admin_form_after();\n\n return $output;\n }", "public function resetForm()\n\t{\n\t\tparent::resetForm();\n\t\t$this->setNeedReinitRulesFlag();\n\t}", "private function cacheGetRestoreRelations(fapitng_FormBase $parent) {\n foreach ($parent->children as $element) {\n $element->form = $this;\n $element->form = $parent;\n $this->cacheGetRestoreRelations($element);\n }\n }", "public function indexAction() {\n // (first) sub form\n if (!$form = $this->getCurrentSubForm()) {\n $form = $this->getNextSubForm();\n }\n\n //Zend_Debug::dump($form);\n //$form->setDecorators(array(array('ViewScript', array('viewScript' => 'formScript.phtml'))));\n //$this->view->form = $this->getForm()->prepareSubForm($form);\n $form = $this->getForm()->prepareSubForm($form);\n $this->view->form = $form;\n }", "function action_index()\n\t{\n\t\t$subforms = array(\n\t\t\t\\Artefacts\\Subform_Description::forge(),\n\t\t\t\\Artefacts\\Subform_Owner::forge(),\n\t\t\t\\Artefacts\\Subform_File::forge(),\n\t\t\t\\Quotes\\Subform_Worksub::forge(),\n\t\t\t\\Quotes\\Subform_Quote::forge(),\n \\Receipts\\Subform_Receipt::forge(),\n \\Jobs\\Subform_Jobs::forge(),\n \\Invoices\\Subform_Invoices::forge(),\n \\Files\\Subform_Files::forge()\n\t\t);\n\n\t\t$vsubforms = array();\n\t\tforeach($subforms as $subform)\n\t\t{\n\t\t\tif(isset($vsubforms[$subform->get_prefix()]))\n\t\t\t{\n\t\t\t\tthrow new \\FuelException('Specified subform prefix already exists in subform test.');\n\t\t\t}\n\t\t\t$vsubforms[$subform->get_prefix()] = $subform->render(); \n\t\t}\n\n\t\t//update\n\t\tif(\\Input::post('save'))\n\t\t{\n\t\t\tforeach ($subforms as $subform) \n\t\t\t{\n\t\t\t\t$subform->update(\\Input::post($subform->get_prefix()));\n\t\t\t}\n\t\t}\n \n\n\t\tif (\\Input::post('save') ) \n\t\t{\n\t\t\tif(\\Input::param('lock'))\n {\n //return \\Message::set('error', 'Form locked has been changed'); \n $tab = \\Input::param('lock');\n \\Response::redirect(\\Uri::create('mainform/index/?tab='.$tab.'&quote_id='.$_GET['quote_id']));\n }else{\n return \\Message::set('success', 'Successfully saved..!') . \\Response::redirect(\\Uri::create('mainform/index/?tab=0&quote_id='.$_GET['quote_id']));\n } \n }\n \n if ( \\Input::post('cancel')) \n\t\t{\n\t\t\treturn \\Response::redirect(Helper_App::url_from_tab(\\Input::get('active_tab')));\n \n\t\t}\n\n\t\t$view = \\View::forge('mainform');\n if(\\Input::param('wind')){\n $this->set_iframe_template();\n }\n\t\t$view->set('subforms', $vsubforms, false);\n\t\t$this->template->body_classes = array('contact_un');\n\t\t$this->template->content = $view;\t\t\n\t}", "function initChildrenRecursive() {\n $this->initChildControls();\n if ($this->HasControls()) {\n $keys = array_keys($this->Controls);\n $count = count($this->Controls);\n for ($i = 0; $i < $count; $i++) {\n @$control = &$this->Controls[$keys[$i]];\n $control->initChildrenRecursive();\n }\n }\n\n }", "public function updateSearchForms()\n {\n global $config, $rlListingTypes, $reefless, $rlDb;\n\n if (!$config['cache']) {\n return false;\n }\n\n $sql = \"SELECT `T1`.`Category_ID`, `T1`.`Group_ID`, `T1`.`Fields`, \";\n $sql .= \"`T2`.`Key` AS `Group_key`, `T2`.`Display`, \";\n $sql .= \"`T3`.`Type` AS `Listing_type`, `T3`.`Key` AS `Form_key`, `T3`.`With_picture` \";\n $sql .= \"FROM `{db_prefix}search_forms_relations` AS `T1` \";\n $sql .= \"LEFT JOIN `{db_prefix}listing_groups` AS `T2` ON `T1`.`Group_ID` = `T2`.`ID` AND `T2`.`Status` = 'active' \";\n $sql .= \"LEFT JOIN `{db_prefix}search_forms` AS `T3` ON `T1`.`Category_ID` = `T3`.`ID` \";\n $sql .= \"WHERE `T3`.`Status` = 'active' \";\n $sql .= \"ORDER BY `Position` \";\n\n $GLOBALS['rlHook']->load('phpCacheUpdateSearchFormsGetRelations', $sql); // >= v4.3\n\n $relations = $rlDb->getAll($sql);\n\n if (!$relations) {\n $out = array(1);\n }\n\n $reefless->loadClass('Categories');\n\n /* populate field information */\n foreach ($relations as $key => $value) {\n if (!$value) {\n continue;\n }\n\n $sql = \"SELECT `ID`, `Key`, `Type`, `Default`, `Values`, `Condition`, CONCAT('listing_fields+name+', `Key`) AS `pName`, \";\n $sql .= \"`Multilingual`, `Opt1`, `Opt2`, FIND_IN_SET(`ID`, '{$value['Fields']}') AS `Order` \";\n $sql .= \"FROM `{db_prefix}listing_fields` \";\n $sql .= \"WHERE FIND_IN_SET(`ID`, '{$value['Fields']}' ) > 0 AND `Status` = 'active' \";\n $sql .= \"ORDER BY `Order`\";\n $fields = $rlDb->getAll($sql);\n\n if ($value['Group_key']) {\n $relations[$key]['pName'] = 'listing_groups+name+' . $value['Group_key'];\n }\n $relations[$key]['Fields'] = empty($fields) ? false : $GLOBALS['rlCommon']->fieldValuesAdaptation($fields, 'listing_fields', $value['Listing_type']);\n\n $out[$value['Form_key']][] = $relations[$key];\n }\n\n $GLOBALS['rlHook']->load('phpCacheUpdateSearchFormsBeforeSave', $out, $relations); // >= v4.3\n\n unset($relations);\n\n $this->set('cache_search_forms', $out);\n }", "function rebound_form_alter(&$form, &$form_state) {\n $form['comment_body']['#after_build'][] = 'rebound_customize_form';\n\t\n\tif($form['#node']->type == \"guild_application\") {\n\t\t$form['body']['#after_build'][] = 'rebound_customize_form';\n\t\t$form['application_references']['#after_build'][] = 'rebound_customize_form';\n\t\t$form['application_raid_experience']['#after_build'][] = 'rebound_customize_form';\n\t\t$form['application_raid_availablity']['#after_build'][] = 'rebound_customize_form';\n\t}\n\n}", "function loadRecursive() {\n $this->ControlOnLoad();\n if ($this->HasControls()) {\n $keys = array_keys($this->Controls);\n $count = count($this->Controls);\n for ($i = 0; $i < $count ; $i++) {\n @$control = &$this->Controls[$keys[$i]];\n $control->loadRecursive();\n }\n }\n $this->_state = WEB_CONTROL_LOADED;\n }", "public function indexAction()\n {\n // (first) sub form\n\t\tZend_Session::namespaceUnset($this->_namespace);\t\t// Delete all former forms datas\n\t\t\n if (!$form = $this->getCurrentSubForm()) {\n $form = $this->getNextSubForm();\n }\n $this->view->form = $this->getForm()->prepareSubForm($form);\n }", "public function init()\n {\n $this->addSubForm(new LandlordsInsuranceQuote_Form_Subforms_PersonalDetails(), 'subform_personaldetails');\n \t$this->addSubForm(new LandlordsInsuranceQuote_Form_Subforms_DataProtection(), 'subform_dataprotection');\n $this->addSubForm(new LandlordsInsuranceQuote_Form_Subforms_CorrespondenceDetails(), 'subform_correspondencedetails');\n $this->addSubForm(new LandlordsInsuranceQuote_Form_Subforms_InsuredAddress(), 'subform_insuredaddress');\n $this->addSubForm(new LandlordsInsuranceQuote_Form_Subforms_PolicyDetails(), 'subform_policydetails');\n $this->addSubForm(new LandlordsInsuranceQuote_Form_Subforms_IDD(), 'subform_idd');\n }", "public function render()\n {\n $root =& XCube_Root::getSingleton();\n $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM);\n\n $renderTarget =& $renderSystem->createRenderTarget('main');\n\n $renderTarget->setAttribute('legacy_module', 'legacy');\n $renderTarget->setTemplateName('legacy_xoopsform_tableform.html');\n $renderTarget->setAttribute('form', $this);\n\n $renderSystem->render($renderTarget);\n\n return $renderTarget->getResult();\n }", "public function init() {\n $this->setMethod('post');\n $this->setAction($this->getView()->url());\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/collapsiblefields.js', 'text/javascript'));\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/toggledetails.js', 'text/javascript'));\n $this->_view->headScript()->appendFile($this->_view->baseUrl('media/js/erga/paketaergasias/paradotea.js', 'text/javascript'));\n\n $subform = new Dnna_Form_SubFormBase();\n $subform->setLegend('Στοιχεία Παραδοτέου');\n // Recordid\n $subform->addElement('hidden', 'recordid', array());\n // Κωδικός Παραδοτέου\n $subform->addElement('text', 'codename', array(\n 'label' => 'Κωδικός Παραδοτέου:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, 15))\n ),\n 'required' => true,\n 'placeholder' => 'πχ. Π.1.1',\n )\n );\n // Τίτλος Παραδοτέου\n $subform->addElement('textarea', 'title', array(\n 'label' => 'Τίτλος Παραδοτέου:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, $this->_textareaMaxLength))\n ),\n 'rows' => 1,\n 'cols' => $this->_textareaCols,\n 'required' => true,\n )\n );\n // Ποσό\n $subform->addElement('text', 'amount', array(\n 'label' => 'Ποσό:',\n 'validators' => array(\n array('validator' => 'Float')\n ),\n 'class' => 'formatFloat',\n 'required' => true,\n ));\n // Όρια ανα Κατηγορία Προσωπικού\n $project = $this->_view->getProject();\n if(isset($project) && $project->get_personnelcategories()->count() > 0) {\n $limitsform = new Dnna_Form_SubFormBase($this->_view);\n $i = 1;\n foreach($project->get_personnelcategories() as $curCategory) {\n $curlimitform = new Dnna_Form_SubFormBase($this->_view);\n // Recordid\n $curlimitform->addElement('hidden', 'recordid', array());\n // Id κατηγορίας\n $curlimitcategoryform = new Dnna_Form_SubFormBase($this->_view);\n $curlimitcategoryform->addElement('hidden', 'recordid', array(\n 'value' => $curCategory->get_recordid(),\n ));\n $curlimitform->addSubForm($curlimitcategoryform, 'personnelcategory', false);\n // Limit\n $curlimitform->addElement('text', 'limit', array(\n 'label' => 'Όριο ωρών για '.$curCategory->get_name().':',\n 'validators' => array(\n array('validator' => 'Float')\n ),\n 'required' => false,\n ));\n $curlimitform->set_empty(false);\n $limitsform->addSubForm($curlimitform, $i, false, 'default-limits');\n $i++;\n }\n $subform->addSubForm($limitsform, 'limits', false);\n }\n // Έναρξη\n $subform->addElement('text', 'startdate', array(\n 'label' => 'Ημερομηνία Έναρξης:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n 'required' => false,\n ));\n // Λήξη\n $subform->addElement('text', 'enddate', array(\n 'label' => 'Ημερομηνία Λήξης:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n 'required' => false,\n ));\n // Εγκριση αναθεσης απο επιτροπη ερευνων\n $subform->addElement('text', 'assignmentapprovaldate', array(\n 'label' => 'Έγκριση Ανάθεσης από Επιτροπή Ερευνών:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n ));\n // Εγκριση ολοκλήρωσης απο Επιτροπή Ερευνών\n $subform->addElement('text', 'completionapprovaldate', array(\n 'label' => 'Εγκριση Ολοκλήρωσης απο Επιτροπή Ερευνών:',\n 'validators' => array(\n array('validator' => 'Date')\n ),\n 'class' => 'usedatepicker',\n ));\n\n // Σχόλια\n $subform->addElement('textarea', 'comments', array(\n 'label' => 'Γενικές Πληροφορίες:',\n 'validators' => array(\n array('validator' => 'StringLength', 'options' => array(0, $this->_textareaMaxLength))\n ),\n 'rows' => $this->_textareaRows,\n 'cols' => $this->_textareaCols,\n ));\n\n $subsubform = new Dnna_Form_SubFormBase();\n if($this->_view->getSubProject()->get_subprojectdirectlabor() == \"1\") {\n $subsubform->setLegend('Συντάκτες');\n if(($this->_view->getSubProject()->get_employees() != null && count($this->_view->getSubProject()->get_employees()) > 0) ||\n ($this->_view->getProject() != null && $this->_view->getProject()->get_thisprojectemployees() != null && count($this->_view->getProject()->get_thisprojectemployees()) > 0)) {\n $this->addAuthorFields($subsubform, false);\n } else {\n $element = new Application_Form_Element_Note('noauthorsnote', array(\n 'value' => 'Δεν έχουν οριστεί απασχολούμενοι'\n ));\n $subsubform->addElement($element);\n }\n $subform->addSubForm($subsubform, 'authors');\n } else {\n $subsubform->setLegend('Ανάδοχος');\n if($this->_view->getSubProject()->get_contractors() != null && $this->_view->getSubProject()->get_contractors()->count() > 0) {\n $this->addContractorFields($subsubform, false);\n } else {\n $element = new Application_Form_Element_Note('noauthorsnote', array(\n 'value' => 'Δεν έχουν οριστεί ανάδοχοι'\n ));\n $subsubform->addElement($element);\n }\n $subform->addSubForm($subsubform, 'contractor');\n }\n $this->addSubForm($subform, 'default');\n $this->addSubmitFields();\n }", "public function test_buildSubForm ( )\n {\n $form = new Rx_Form_Abstract;\n\n $result = $form->buildSubForm();\n\n $this->assertInstanceOf('Zend_Form_SubForm', $result);\n\n }", "function reload_form() {\n\tglobal $ROW, $ERROR_MESSAGE;\n\n\t// Only reload if it hasn't been reloaded already\n\tif ( $ERROR_MESSAGE && ( !isset($ROW[0]['STATUS']) || $ROW[0]['STATUS'] != 'RELOAD') ) {\n\t\t$ROW[0]=$_POST;\n\t\t$ROW[0]['STATUS']='RELOAD';\n\t\tLOG_MSG('INFO',\"reload_form(): ROW=[\".print_r($ROW,true).\"]\");\n\t}\n}", "function teligence_cart_errors_form_pre_render($form)\r\n{\r\n\tforeach((array)element_children($form) as $key)\r\n\t{\r\n\t\t//!strstr($key, '#') ? $form[$key]['#description'] .= \"Variable Name: <strong>variable_get('\" . $key . \"', '' )</strong>\" : null;\r\n\t\t$form[$key]['#description'] .= \" Variable Name: <strong>variable_get('\" . $key . \"', '' )</strong>\";\r\n\t\t\r\n\t\tif(substr($key, -8) == '_subject')\r\n\t\t{\r\n\t\t\t$subjectsibling = substr($key, 0, -8);\r\n\t\t\t$form['group_'.$subjectsibling] = array(\r\n\t\t\t\t'#title' => \"COMBO - \" . $subjectsibling,\r\n\t\t\t\t'#type' => 'fieldset',\r\n\t\t\t\t'#collapsible' => true,\r\n\t\t\t\t'#collapsed' => true,\r\n\t\t\t\t'#weight' => -100,\r\n\t\t\t);\r\n\t\t\t$form['group_'.$subjectsibling][$key] = $form[$key];\r\n\t\t\tunset($form[$key]);\r\n\t\t}\r\n\t\tif($key == $subjectsibling)\r\n\t\t{\r\n\t\t\t$form['group_'.$subjectsibling][$key] = $form[$key];\r\n\t\t\tunset($form[$key]);\r\n\t\t\tunset($subjectsibling);\r\n\t\t}\r\n\t}\t\r\n\t\r\n\treturn $form;\r\n}", "function recursiveRender(){\n\t\tif( $this->folder_id === 0)\n\t\t\treturn parent::recursiveRender();\n\n\t\t// on click on new button open modal popup\n\t\t\t$js = [\n\t\t\t\t$this->js()->_selector('#'.$this->modal_popup->name)->modal(),\n\t\t\t\t$this->js()->_selector(\"#\".$this->modal_popup->name.\" .modal-header h4\")->text($this->js()->_selectorThis()->data('title')),\n\t\t\t\t$this->js()->_selector(\"#\".$this->modal_popup->name.\" #\".$this->field_new_type->name)->val($this->js()->_selectorThis()->data('documenttype'))\n\t\t\t];\n\t\t$this->action->js('click',$js)->_selector('li.xepan-new-document');\n\n\t\t// form submition handle\n\t\tif($this->form->isSubmitted()){\n\n\t\t\ttry{\n\t\t\t\t$this->api->db->beginTransaction();\n\t\t\t\t$document_model = $this->add('xepan\\hr\\Model_'.$this->form['add_new_document_type']);\n\t\t\t\t$document_model->createNew($this->form['name'],$this->form['folder_id']);\n\t\t\t\t$this->api->db->commit();\n\t\t\t}catch(Exception $e){\n\t\t\t\t$this->api->db->rollback();\n\t\t\t\t\n\t\t\t\t$this->form->js()->univ()->errorMessage('error occured '.$e->message())->execute();\n\t\t\t}\n\t\t\t$js = [$this->js()->_selector('#'.$this->modal_popup->name)->modal('toggle')];\n\t\t\t$this->form->js(null,$js)->univ()->successMessage(\"Added Successfully\")->execute();\n\t\t}\n\n\t\tparent::recursiveRender();\n\t}", "protected function buildRenderChildrenClosure() {}", "public function renderForeignRecordHeaderControl_postProcess(\n $parentUid,\n $foreignTable,\n array $childRecord,\n array $childConfig,\n $isVirtual,\n array &$controlItems\n ) {\n // registered empty to satisfy interface\n }" ]
[ "0.6582182", "0.62850034", "0.60938174", "0.56778204", "0.5406098", "0.534997", "0.5332994", "0.5269312", "0.5265423", "0.52481663", "0.51877964", "0.5104601", "0.50673497", "0.50629926", "0.5018036", "0.5016725", "0.49698514", "0.49688122", "0.4959845", "0.49394217", "0.49087048", "0.49065694", "0.49056235", "0.49001008", "0.48888153", "0.48842952", "0.48567608", "0.48531413", "0.48444864", "0.48430097" ]
0.8432645
0
BizForm::RenderArray() Render form as array format using array template
protected function RenderArray() { if ($this->m_QueryONRender && !$this->m_ActiveRecord && $this->m_DataObjName) { if (!$this->_run_search($resultRecords, $this->m_ClearSearchRule)) return $this->ProcessDataObjError($ok); $this->UpdateActiveRecord($resultRecords[0]); } $columns = $this->m_RecordRow->RenderColumn(); foreach($columns as $key=>$val) { $fields[$key]["label"] = $val; $fields[$key]["required"] = $this->GetControl($key)->m_Required; $fields[$key]["description"] = $this->GetControl($key)->m_Description; $fields[$key]["value"] = $this->GetControl($key)->m_Value; } $controls = $this->m_RecordRow->Render(); if ($this->CanShowData()) { foreach($controls as $key=>$val) { $fields[$key]["control"] = $val; } } return $fields; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function renderArray() {}", "public function render(){\n\t\t$data = array();\n\n\t\tforeach($this->fields as $fieldName => $field){\n\t\t\t$field->invokeContents($field->getValue(), $field);\n\t\t\t$data[$fieldName] = $this->renderTag($field);\n $data['fieldData'][$fieldName] = $this->renderArray($field);\n\t\t}\n $data['namespace'] = $this->settings['namespace'];\n\t\t$data['errors'] = $this->getMessageBag()->get(\"errors\");\n\t\t$data['messages'] = $this->getMessageBag()->get(\"messages\");\n $data['fieldData'] = substr(json_encode($data['fieldData']), 1, -1); // <-- remove outer curly's for IDE\n\n\t\treturn $data;\n\t}", "private function arrayToPrint()\n\t{\n\t\t$this->view->addToReplace($this->langArr);\n\t\t$this->view->addToReplace($this->arrRender);\n\t\t$this->arrRender['CONTENT'] = $this->view\n\t\t\t->setTemplateFile('employeeedit')->renderFile();\n\t\t$this->view->addToReplace($this->arrRender);\n\t\t$this->view->setTemplateFile('index')->templateRender();\n\t}", "public function render()\n {\n $languageService = $this->getLanguageService();\n $resultArray = $this->initializeResultArray();\n\n $parameterArray = $this->data['parameterArray'];\n $config = $parameterArray['fieldConf']['config'];\n $elementName = $parameterArray['itemFormElName'];\n\n if ($config['readOnly']) {\n // Early return for the relatively simple read only case\n return $this->renderReadOnly();\n }\n\n $possibleItems = $config['items'];\n $selectedItems = $parameterArray['itemFormElValue'] ?: [];\n $selectedItemsCount = count($selectedItems);\n\n $maxItems = $config['maxitems'];\n $autoSizeMax = MathUtility::forceIntegerInRange($config['autoSizeMax'], 0);\n $size = 2;\n if (isset($config['size'])) {\n $size = (int)$config['size'];\n }\n if ($autoSizeMax >= 1) {\n $size = MathUtility::forceIntegerInRange($selectedItemsCount + 1, MathUtility::forceIntegerInRange($size, 1), $autoSizeMax);\n }\n $itemCanBeSelectedMoreThanOnce = !empty($config['multiple']);\n\n $listOfSelectedValues = [];\n $selectedItemsHtml = [];\n foreach ($selectedItems as $itemValue) {\n foreach ($possibleItems as $possibleItem) {\n if ($possibleItem[1] == $itemValue) {\n $title = $possibleItem[0];\n $listOfSelectedValues[] = $itemValue;\n $selectedItemsHtml[] = '<option value=\"' . htmlspecialchars($itemValue) . '\" title=\"' . htmlspecialchars($title) . '\">' . htmlspecialchars($title) . '</option>';\n break;\n }\n }\n }\n\n $selectableItemsHtml = [];\n foreach ($possibleItems as $possibleItem) {\n $disabledAttr = '';\n $classAttr = '';\n if (!$itemCanBeSelectedMoreThanOnce && in_array((string)$possibleItem[1], $selectedItems, true)) {\n $disabledAttr = ' disabled=\"disabled\"';\n $classAttr = ' class=\"hidden\"';\n }\n $selectableItemsHtml[] =\n '<option value=\"'\n . htmlspecialchars($possibleItem[1])\n . '\" title=\"' . htmlspecialchars($possibleItem[0]) . '\"'\n . $classAttr . $disabledAttr\n . '>'\n . htmlspecialchars($possibleItem[0]) .\n '</option>';\n }\n\n // Html stuff for filter and select filter on top of right side of multi select boxes\n $filterTextfield = [];\n if ($config['enableMultiSelectFilterTextfield']) {\n $filterTextfield[] = '<span class=\"input-group input-group-sm\">';\n $filterTextfield[] = '<span class=\"input-group-addon\">';\n $filterTextfield[] = '<span class=\"fa fa-filter\"></span>';\n $filterTextfield[] = '</span>';\n $filterTextfield[] = '<input class=\"t3js-formengine-multiselect-filter-textfield form-control\" value=\"\">';\n $filterTextfield[] = '</span>';\n }\n $filterDropDownOptions = [];\n if (isset($config['multiSelectFilterItems']) && is_array($config['multiSelectFilterItems']) && count($config['multiSelectFilterItems']) > 1) {\n foreach ($config['multiSelectFilterItems'] as $optionElement) {\n $value = $languageService->sL($optionElement[0]);\n $label = $value;\n if (isset($optionElement[1]) && trim($optionElement[1]) !== '') {\n $label = $languageService->sL($optionElement[1]);\n }\n $filterDropDownOptions[] = '<option value=\"' . htmlspecialchars($value) . '\">' . htmlspecialchars($label) . '</option>';\n }\n }\n $filterHtml = [];\n if (!empty($filterTextfield) || !empty($filterDropDownOptions)) {\n $filterHtml[] = '<div class=\"form-multigroup-item-wizard\">';\n if (!empty($filterTextfield) && !empty($filterDropDownOptions)) {\n $filterHtml[] = '<div class=\"t3js-formengine-multiselect-filter-container form-multigroup-wrap\">';\n $filterHtml[] = '<div class=\"form-multigroup-item form-multigroup-element\">';\n $filterHtml[] = '<select class=\"form-control input-sm t3js-formengine-multiselect-filter-dropdown\">';\n $filterHtml[] = implode(LF, $filterDropDownOptions);\n $filterHtml[] = '</select>';\n $filterHtml[] = '</div>';\n $filterHtml[] = '<div class=\"form-multigroup-item form-multigroup-element\">';\n $filterHtml[] = implode(LF, $filterTextfield);\n $filterHtml[] = '</div>';\n $filterHtml[] = '</div>';\n } elseif (!empty($filterTextfield)) {\n $filterHtml[] = implode(LF, $filterTextfield);\n } else {\n $filterHtml[] = '<select class=\"form-control input-sm t3js-formengine-multiselect-filter-dropdown\">';\n $filterHtml[] = implode(LF, $filterDropDownOptions);\n $filterHtml[] = '</select>';\n }\n $filterHtml[] = '</div>';\n }\n\n $classes = [];\n $classes[] = 'form-control';\n $classes[] = 'tceforms-multiselect';\n if ($maxItems === 1) {\n $classes[] = 'form-select-no-siblings';\n }\n $multipleAttribute = '';\n if ($maxItems !== 1 && $size !== 1) {\n $multipleAttribute = ' multiple=\"multiple\"';\n }\n $selectedListStyle = '';\n if (isset($config['selectedListStyle'])) {\n GeneralUtility::deprecationLog('TCA property selectedListStyle is deprecated since TYPO3 v8 and will be removed in v9');\n $selectedListStyle = ' style=\"' . htmlspecialchars($config['selectedListStyle']) . '\"';\n }\n $selectableListStyle = '';\n if (isset($config['itemListStyle'])) {\n GeneralUtility::deprecationLog('TCA property itemListStyle is deprecated since TYPO3 v8 and will be removed in v9');\n $selectableListStyle = ' style=\"' . htmlspecialchars($config['itemListStyle']) . '\"';\n }\n\n $legacyWizards = $this->renderWizards();\n $legacyFieldControlHtml = implode(LF, $legacyWizards['fieldControl']);\n $legacyFieldWizardHtml = implode(LF, $legacyWizards['fieldWizard']);\n\n $fieldInformationResult = $this->renderFieldInformation();\n $fieldInformationHtml = $fieldInformationResult['html'];\n $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);\n\n $fieldControlResult = $this->renderFieldControl();\n $fieldControlHtml = $legacyFieldControlHtml . $fieldControlResult['html'];\n $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldControlResult, false);\n\n $fieldWizardResult = $this->renderFieldWizard();\n $fieldWizardHtml = $legacyFieldWizardHtml . $fieldWizardResult['html'];\n $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false);\n\n $html = [];\n $html[] = '<div class=\"formengine-field-item t3js-formengine-field-item\">';\n $html[] = $fieldInformationHtml;\n $html[] = '<div class=\"form-wizards-wrap\">';\n $html[] = '<div class=\"form-wizards-element\">';\n $html[] = '<input type=\"hidden\" data-formengine-input-name=\"' . htmlspecialchars($elementName) . '\" value=\"' . (int)$itemCanBeSelectedMoreThanOnce . '\" />';\n $html[] = '<div class=\"form-multigroup-wrap t3js-formengine-field-group\">';\n $html[] = '<div class=\"form-multigroup-item form-multigroup-element\">';\n $html[] = '<label>';\n $html[] = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.selected'));\n $html[] = '</label>';\n $html[] = '<div class=\"form-wizards-wrap form-wizards-aside\">';\n $html[] = '<div class=\"form-wizards-element\">';\n $html[] = '<select';\n $html[] = ' id=\"' . StringUtility::getUniqueId('tceforms-multiselect-') . '\"';\n $html[] = ' size=\"' . $size . '\"';\n $html[] = ' class=\"' . implode(' ', $classes) . '\"';\n $html[] = $multipleAttribute;\n $html[] = ' data-formengine-input-name=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = $selectedListStyle;\n $html[] = '>';\n $html[] = implode(LF, $selectedItemsHtml);\n $html[] = '</select>';\n $html[] = '</div>';\n $html[] = '<div class=\"form-wizards-items-aside\">';\n $html[] = '<div class=\"btn-group-vertical\">';\n if ($maxItems > 1 && $size >= 5) {\n $html[] = '<a href=\"#\"';\n $html[] = ' class=\"btn btn-default t3js-btn-moveoption-top\"';\n $html[] = ' data-fieldname=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' title=\"' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.move_to_top')) . '\"';\n $html[] = '>';\n $html[] = $this->iconFactory->getIcon('actions-move-to-top', Icon::SIZE_SMALL)->render();\n $html[] = '</a>';\n }\n if ($maxItems > 1) {\n $html[] = '<a href=\"#\"';\n $html[] = ' class=\"btn btn-default t3js-btn-moveoption-up\"';\n $html[] = ' data-fieldname=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' title=\"' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.move_up')) . '\"';\n $html[] = '>';\n $html[] = $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render();\n $html[] = '</a>';\n $html[] = '<a href=\"#\"';\n $html[] = ' class=\"btn btn-default t3js-btn-moveoption-down\"';\n $html[] = ' data-fieldname=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' title=\"' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.move_down')) . '\"';\n $html[] = '>';\n $html[] = $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render();\n $html[] = '</a>';\n }\n if ($maxItems > 1 && $size >= 5) {\n $html[] = '<a href=\"#\"';\n $html[] = ' class=\"btn btn-default t3js-btn-moveoption-bottom\"';\n $html[] = ' data-fieldname=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' title=\"' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.move_to_bottom')) . '\"';\n $html[] = '>';\n $html[] = $this->iconFactory->getIcon('actions-move-to-bottom', Icon::SIZE_SMALL)->render();\n $html[] = '</a>';\n }\n $html[] = '<a href=\"#\"';\n $html[] = ' class=\"btn btn-default t3js-btn-removeoption\"';\n $html[] = ' data-fieldname=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' title=\"' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.remove_selected')) . '\"';\n $html[] = '>';\n $html[] = $this->iconFactory->getIcon('actions-selection-delete', Icon::SIZE_SMALL)->render();\n $html[] = '</a>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '<div class=\"form-multigroup-item form-multigroup-element\">';\n $html[] = '<label>';\n $html[] = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.items'));\n $html[] = '</label>';\n $html[] = '<div class=\"form-wizards-wrap form-wizards-aside\">';\n $html[] = '<div class=\"form-wizards-element\">';\n $html[] = implode(LF, $filterHtml);\n $html[] = '<select';\n $html[] = ' data-relatedfieldname=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' data-exclusivevalues=\"' . htmlspecialchars($config['exclusiveKeys']) . '\"';\n $html[] = ' id=\"' . StringUtility::getUniqueId('tceforms-multiselect-') . '\"';\n $html[] = ' data-formengine-input-name=\"' . htmlspecialchars($elementName) . '\"';\n $html[] = ' class=\"form-control t3js-formengine-select-itemstoselect\"';\n $html[] = ' size=\"' . $size . '\"';\n $html[] = ' onchange=\"' . htmlspecialchars(implode('', $parameterArray['fieldChangeFunc'])) . '\"';\n $html[] = ' data-formengine-validation-rules=\"' . htmlspecialchars($this->getValidationDataAsJsonString($config)) . '\"';\n $html[] = $selectableListStyle;\n $html[] = '>';\n $html[] = implode(LF, $selectableItemsHtml);\n $html[] = '</select>';\n $html[] = '</div>';\n $html[] = '<div class=\"form-wizards-items-aside\">';\n $html[] = '<div class=\"btn-group-vertical\">';\n $html[] = $fieldControlHtml;\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '<input type=\"hidden\" name=\"' . htmlspecialchars($elementName) . '\" value=\"' . htmlspecialchars(implode(',', $listOfSelectedValues)) . '\" />';\n $html[] = '</div>';\n $html[] = '<div class=\"form-wizards-items-bottom\">';\n $html[] = $fieldWizardHtml;\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n\n $resultArray['html'] = implode(LF, $html);\n return $resultArray;\n }", "public function templateStrings(){\n \n foreach($this->rules as $field => $rules){\n $array[$field] = array(\n 'rules' => $this->renderRules($field),\n 'value' => $this->value($field) \n );\n }\n \n $array['form_token'] = $this->renderToken();\n \n return $array;\n }", "public function getElementHtml()\n {\n \t$form = $this->getForm();\n \t$parent = $form->getParent();\n \t$layout = $parent->getLayout();\n \t$arrayBlock = $layout->createBlock('aydus_scheduledemails/adminhtml_system_config_form_field_array', $this->getName(), $this->getData());\n \t\n \t$arrayBlock->setElement($this);\n \t\n \t$html = $arrayBlock->toHtml();\n \t$html.= $this->getAfterElementHtml();\n \t\n \t$htmlId = $arrayBlock->getHtmlId();\n \t$rows = $arrayBlock->getArrayRows();\n \t$columns = $this->getColumns();\n \t$selectedValues = $this->getValue();\n \t\n \tif (is_array($rows) && count($rows)>0 && is_array($columns) && count($columns)>0){\n \t\t\n \t\t$html.= '<script type=\"application/javascript\">\n \t\t\t';\n \t\tforeach ($rows as $i=>$row){\n \t\t\tforeach ($columns as $columnName=>$column){\n \t\t\t\t$html.= '$$(\"select[name=\\\"'.$htmlId.'['.$i.']['.$columnName.']\\\"]\").each(function(select, selectIndex){\n\t \t\t\t$(select).select(\"option\").each(function(option, optionIndex){\n\t \t\t\t\tif (\"'.$selectedValues[$i][$columnName].'\" == option.value){\n\t \t\t\t\t\toption.selected = true;\n\t \t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t \t\t';\n \t\t\t}\n \t\t}\n \t\t\n \t\t$html.= '</script>\n \t\t';\n \t}\n \t \n \treturn $html;\n }", "protected function renderReadOnly()\n {\n $languageService = $this->getLanguageService();\n\n $parameterArray = $this->data['parameterArray'];\n $config = $parameterArray['fieldConf']['config'];\n $fieldName = $parameterArray['itemFormElName'];\n\n $possibleItems = $config['items'];\n $selectedItems = $parameterArray['itemFormElValue'] ?: [];\n if (!is_array($selectedItems)) {\n $selectedItems = GeneralUtility::trimExplode(',', $selectedItems, true);\n }\n $selectedItemsCount = count($selectedItems);\n\n $autoSizeMax = MathUtility::forceIntegerInRange($config['autoSizeMax'], 0);\n $size = 2;\n if (isset($config['size'])) {\n $size = (int)$config['size'];\n }\n if ($autoSizeMax >= 1) {\n $size = MathUtility::forceIntegerInRange($selectedItemsCount + 1, MathUtility::forceIntegerInRange($size, 1), $autoSizeMax);\n }\n $multiple = '';\n if ($size !== 1) {\n $multiple = ' multiple=\"multiple\"';\n }\n\n $listOfSelectedValues = [];\n $optionsHtml = [];\n foreach ($selectedItems as $itemValue) {\n foreach ($possibleItems as $possibleItem) {\n if ($possibleItem[1] == $itemValue) {\n $title = $possibleItem[0];\n $listOfSelectedValues[] = $itemValue;\n $optionsHtml[] = '<option value=\"' . htmlspecialchars($itemValue) . '\" title=\"' . htmlspecialchars($title) . '\">' . htmlspecialchars($title) . '</option>';\n break;\n }\n }\n }\n\n $html = [];\n $html[] = '<div class=\"formengine-field-item t3js-formengine-field-item\">';\n $html[] = '<div class=\"form-wizards-wrap\">';\n $html[] = '<div class=\"form-wizards-element\">';\n $html[] = '<label>';\n $html[] = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.selected'));\n $html[] = '</label>';\n $html[] = '<div class=\"form-wizards-wrap form-wizards-aside\">';\n $html[] = '<div class=\"form-wizards-element\">';\n $html[] = '<select';\n $html[] = ' id=\"' . StringUtility::getUniqueId('tceforms-multiselect-') . '\"';\n $html[] = ' size=\"' . $size . '\"';\n $html[] = ' class=\"form-control tceforms-multiselect\"';\n $html[] = $multiple;\n $html[] = ' data-formengine-input-name=\"' . htmlspecialchars($fieldName) . '\"';\n $html[] = ' disabled=\"disabled\">';\n $html[] = '/>';\n $html[] = implode(LF, $optionsHtml);\n $html[] = '</select>';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '<input type=\"hidden\" name=\"' . htmlspecialchars($fieldName) . '\" value=\"' . htmlspecialchars(implode(',', $listOfSelectedValues)) . '\" />';\n $html[] = '</div>';\n $html[] = '</div>';\n $html[] = '</div>';\n\n $resultArray = $this->initializeResultArray();\n $resultArray['html'] = implode(LF, $html);\n return $resultArray;\n }", "public function toFormArray() : array {\n $return = [];\n\n foreach ($this->toArray() as $component) {\n $return = array_merge($return, $component->toFormArray());\n }\n\n return $return;\n }", "public function buildFieldArray($renderables, $data) {\n\n\t\t$renderablesArray = '';\n\n\t\tforeach ($renderables as $renderable) {\n\t\t\tif (is_array($renderable) && array_key_exists('identifier', $renderable)) {\n\t\t\t\tif (in_array($renderable['type'], $this->fieldTypesToBeIgnored)) {\n\t\t\t\t\t// ignore static text fields\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$renderablesArray[$renderable['identifier']] = $this->buildFieldArray($renderable, $data);\n\t\t\t\t$renderablesArray[$renderable['identifier']]['identifier'] = $renderable['identifier'];\n\t\t\t\t$renderablesArray[$renderable['identifier']]['label'] = $renderable['label'];\n\t\t\t\t$renderablesArray[$renderable['identifier']]['type'] = $renderable['type'];\n\t\t\t} elseif (is_array($renderable)) {\n\t\t\t\tforeach ($renderable as $subRenderable) {\n\t\t\t\t\tif (is_array($subRenderable) && array_key_exists('identifier', $subRenderable) && array_key_exists('type', $subRenderable)) {\n\t\t\t\t\t\tif (in_array($subRenderable['type'], $this->fieldTypesToBeIgnored)) {\n\t\t\t\t\t\t\t// ignore static text fields\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t} elseif ($subRenderable['type'] === 'TYPO3.Form:Section') {\n\t\t\t\t\t\t\t// we have another layer of subs\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']] = $this->buildFieldArray($subRenderable, $data);\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['identifier'] = $subRenderable['identifier'];\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['label'] = $subRenderable['label'];\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['type'] = $subRenderable['type'];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// last layer\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['label'] = $subRenderable['label'];\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['identifier'] = $subRenderable['identifier'];\n\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['type'] = $subRenderable['type'];\n\t\t\t\t\t\t\tif (is_array($data) && array_key_exists($subRenderable['identifier'], $data)) {\n\t\t\t\t\t\t\t\t$renderablesArray['items'][$subRenderable['identifier']]['value'] = $data[$subRenderable['identifier']];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\treturn $renderablesArray;\n\t}", "function render()\n {\n return array(\n 'init' => $this->__init,\n 'data' => $this->__items\n );\n }", "public function render()\n {\n foreach ($this->arrayList as $item)\n {\n $this->render .= $item->render();\n }\n return $this->render;\n }", "public function render()\n {\n $parameters = $this->data['parameterArray'];\n $parameters['row'] = $this->data['databaseRow'];\n // Vars\n $uid = $parameters['row']['uid'];\n $pid = $parameters['row']['pid'];\n $name = $parameters['itemFormElName'];\n $value = $parameters['itemFormElValue'];\n $cType = $parameters['row']['CType'];\n $gridLayout = $parameters['row']['tx_gridelements_backend_layout'];\n // In case of new content elements, pid might be negative\n if ($pid < 1) {\n $pid = $this->getPidFromParentContentElement($pid);\n }\n // C-Type could be an array or a string\n if (is_array($cType) && isset($cType[0])) {\n $cType = $cType[0];\n }\n if (is_array($gridLayout) && isset($gridLayout[0])) {\n $gridLayout = $gridLayout[0];\n }\n // Get values\n $values = explode(',', $value);\n $this->valuesFlipped = array_flip($values);\n $this->valuesAvailable = [];\n // Get configuration\n $behaviours = $this->getMergedConfiguration($pid, 'behaviour', $cType);\n // Build checkboxes\n $this->checkboxesArray['default'] = [];\n $this->checkboxesArray['ctype'] = [];\n $this->checkboxesArray['gridLayout'] = [];\n if (isset($behaviours['properties']) && is_array($behaviours['properties'])) {\n foreach ($behaviours['properties'] as $contentElementKey => $label) {\n // GridElements: are able to provide grid-specific behaviours\n if (is_array($label) && $cType === 'gridelements_pi1' && !array_key_exists($contentElementKey, $this->defaultProperties)) {\n $contentElementKey = substr($contentElementKey, 0, -1);\n\n // Behaviour for all GridElements\n if ($contentElementKey == 'default' && !empty($label)) {\n foreach ($label as $gridLayoutKey => $gridLayoutBehaviourLabel) {\n $this->createElement($gridLayoutKey, $gridLayoutBehaviourLabel, 'ctype');\n }\n }\n // Behaviour only for selected GridElement\n elseif ($contentElementKey == $gridLayout && !empty($label)) {\n foreach ($label as $gridLayoutKey => $gridLayoutBehaviourLabel) {\n $this->createElement($gridLayoutKey, $gridLayoutBehaviourLabel, 'gridLayout');\n }\n }\n }\n // Normal CEs\n else {\n // Is default property!?\n if (array_key_exists($contentElementKey, $this->defaultProperties)) {\n $this->createElement($contentElementKey, $label, 'default');\n }\n // Is ctype specific!\n else {\n $this->createElement($contentElementKey, $label, 'ctype');\n }\n }\n }\n }\n // Merge checkbox groups\n $checkboxes = '';\n $checkboxes .= $this->getMergedCheckboxes('default');\n $checkboxes .= $this->getMergedCheckboxes('ctype', $cType);\n $checkboxes .= $this->getMergedCheckboxes('gridLayout', $gridLayout);\n if ($checkboxes === '') {\n $checkboxes = $this->getLanguageService()->sL('LLL:EXT:themes/Resources/Private/Language/locallang.xlf:behaviour.no_behaviour_available');\n }\n // Process current classes/identifiers\n $setClasses = array_intersect($values, $this->valuesAvailable);\n $setClass = htmlspecialchars(implode(' ', $setClasses));\n $setValue = htmlspecialchars(implode(',', $setClasses));\n // Allow admins to see the internal identifiers\n $inputType = 'hidden';\n if ($this->isAdminAndDebug()) {\n $inputType = 'text';\n }\n // Build hidden field structure\n $hiddenField = '<div>'.LF;\n $hiddenField .= '<div class=\"form-control-wrap\">'.LF;\n $hiddenField .= '<input class=\"form-control themes-hidden-admin-field '.$setClass.'\" ';\n $hiddenField .= 'readonly=\"readonly\" type=\"'.$inputType.'\" ';\n $hiddenField .= 'name=\"'.htmlspecialchars($name).'\" ';\n $hiddenField .= 'value=\"'.$setValue.'\" class=\"'.$setClass.'\">'.LF;\n $hiddenField .= '</div>'.LF;\n $hiddenField .= '</div>'.LF;\n // Missed classes\n $missedField = $this->getMissedFields($values, $this->valuesAvailable);\n\n return ['html' => '<div class=\"contentBehaviour\">'.$checkboxes.$hiddenField.$missedField.'</div>'];\n }", "public static function getFormComponents(): array {\n return [\n 'title' => ['attr' => ['required' => true, 'maxlength' => AppConstants::INDEXED_STRINGS_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'status' => ['type' => 'translated', 'attr' => ['required' => true, 'maxlength' => AppConstants::INDEXED_STRINGS_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'startDate' => ['type' => 'date', 'attr' => ['required' => true]],\n 'endDate' => ['type' => 'date', 'attr' => ['required' => true]],\n 'price' => ['attr' => ['max' => AppConstants::SMALL_INTEGER_MAXIMUM_VALUE]],\n 'type' => ['type' => 'translated', 'attr' => ['max' => AppConstants::SMALL_INTEGER_MAXIMUM_VALUE]],\n // 'major_id' => ['type'=>'reference','attr' => ['maxlength' => AppConstants::STRINGS_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'requiredNumberOfUsers' => ['attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'appliedUsersCount' => ['attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'language' => ['details-type' => 'multi-data'],\n 'location' => ['attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'workHoursCount' => ['attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'willTakeCertificate' => ['type' => 'boolean', 'attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n // 'major' => [\n // 'type' => 'reference',\n // 'reference' => 'major.name',\n // 'displayColumn' => 'major.name',\n // ],\n 'company' => [\n 'type' => 'reference',\n 'reference' => 'company.name',\n 'displayColumn' => 'company.name',\n ],\n 'requiredNumberOfUsers' => ['attr' => ['max' => AppConstants::SMALL_INTEGER_MAXIMUM_VALUE]],\n 'briefDescription' => ['attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'fullDescription' => ['attr' => ['required' => true, 'maxlength' => AppConstants::TEXT_MAXIMUM_LENGTH, 'minlength' => AppConstants::STRINGS_MINIMUM_LENGTH]],\n 'majors' => ['details-type' => 'multi-data-majors'],\n\n ];\n }", "public function jsonSerialize()\n\t{\n\t\t$form = [\n\t\t\t'key' => $this->getFormKey(),\n\t\t\t'data' => $this->data,\n\t\t\t'schema' => $this->getSchema('frontend'),\n\t\t\t'theme' => $this->getTheme(),\n\t\t\t'columns' => $this->getColumns(),\n\t\t\t'class' => $this->class,\n\t\t\t'classes' => $this->classes,\n\t\t\t'labels' => $this->getLabels(),\n\t\t\t'layout' => $this->getLayout(),\n\t\t\t'formErrors' => $this->getFormErrors(),\n\t\t\t'buttons' => $this->getButtons(),\n\t\t\t'with' => $this->with,\n\t\t\t'messages' => $this->getMessages(),\n\t\t\t'locale' => $this->getLocale(),\n\t\t\t'endpoint' => $this->getEndpoint(),\n\t\t\t'method' => $this->getMethod(),\n\t\t\t'validateOn' => $this->getValidateOn(),\n\t\t];\n\n\t\treturn $form;\n\t}", "public function toArray()\n {\n $arrayForm = array();\n \n if ($this->m_availability_zone != null)\n {\n $arrayForm['AvailabilityZone'] = $this->m_availability_zone;\n }\n \n if ($this->m_group_name != null)\n {\n $arrayForm['GroupName'] = $this->m_group_name;\n }\n \n if ($this->m_tenancy != null)\n {\n $arrayForm['Tenancy'] = $this->m_tenancy;\n }\n \n return $arrayForm;\n }", "public function render():array\n {\n return $this->itinerary;\n }", "public function render(){\n\t\t$fhp; // form_helper_params\n\t\t$value = $this->_data['value'];\n\t\t$form_helper = 'input';\n\t\t$attributes = Arr::extract($this->_data,['id','required','maxlength','title','pattern','readonly','class','size','placeholder','multiple','accept','options']);\n\t\tif(!in_array($this->_data['type'],['radio'])) unset($attributes['options']);\n\t\tif($attributes['required']!==true) unset($attributes['required']);\n\t\tif($attributes['readonly']!==true) unset($attributes['readonly']);\n\t\tif(!$attributes['maxlength']) unset($attributes['maxlength']);\n\t\tif(!$attributes['size']) unset($attributes['size']);\n\t\t$fhp = [$this->_data['name'],$value,$attributes];\n\t\t//$name = $this->_data['name'];\n\t\t//open,close,input,button,checkbox,file,hidden,image,label,password,radio,select,submit,textarea,\n\t\t//$attr\n\t\tswitch($this->_data['type']){\n\t\t\tcase'form':\n\t\t\t\t$form_helper = $this->_data['data_type']; $fhp=[];\n\t\t\t\tbreak;\n\t\t\tcase'select':\n\t\t\t\t//unset\n\t\t\t\t$form_helper='select'; $fhp=[$this->_data['name'],$this->_data['options'],$value,$attributes];\n\t\t\t\tbreak;\n\t\t\tcase'checkbox':\n\t\t\t\t$fhp = [$this->_data['name'],1,!!($value),$attributes];\n\t\t\t\t$form_helper='checkbox';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t//if($this->_data['type'] == 'radio') $fhp[2]['options'] = Arr::get($this->_data,'options');\n\t\t\t\tif(in_array($this->_data['type'],['file','select','checkbox','radio','hidden'])) $this->_data['inputtype'] = $this->_data['type'];\n\t\t\t\t//if()\n\t\t\t\tswitch($this->_data['data_type']){\n\t\t\t\t\tcase'int':\n\t\t\t\t\t\t$fhp[2]['type']='number';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase'text':\n\t\t\t\t\t\t$form_helper='textarea';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\tif($form_helper=='input') $fhp[2]['type']=$this->_data['inputtype'];\n\t\t/*switch($this->_data['data_type']){\n\t\t\tcase'form':\n\t\t\t\t\n\t\t\t\t\n\t\t\t}*/\n\t\treturn call_user_func_array([$this,$form_helper],$fhp);\n\t\t//->($this->_data['name']);\n\t\t//return json_encode($this->_datations);\n\t\t//return \n\t\t}", "public function provider_render() {\n return array(\n array(\n array(\n \n ),\n ),\n );\n }", "public function form() {\n\t\treturn array();\n\t}", "function usingArraysMult()\r\n{ \r\n echo '<span style=\"color:teal;\r\n margin-left:-15px;\">\r\n 1) Print arrays elements by using Multidimensional Arrays.\r\n </span>'. \"<br>\";\r\n echo \"<br>\";\r\n \r\n $fullForms = array (\r\n array(\"HTML \", \"Hypertext\",\" Markup Language\"),\r\n array(\"CSS \",\"Cascading\",\" Style Sheets\"),\r\n array(\"JS \",\"Java\",\"Script\")\r\n );\r\n \r\n $sizeOfArray = count($fullForms); \r\n \r\n if($sizeOfArray<1)\r\n {\r\n throw new Exception(\"Array is empty!!!\");\r\n } \r\n \r\n echo $fullForms[0][0].\": \".$fullForms[0][1].$fullForms[0][2].\".<br><br>\";\r\n echo $fullForms[1][0].\": \".$fullForms[1][1].$fullForms[1][2].\".<br><br>\";\r\n echo $fullForms[2][0].\": \".$fullForms[2][1].$fullForms[2][2].\".<br><br>\";\r\n}", "protected function _addFormArrayProvider()\n {\n $this->addContextProvider('array', function ($request, $data) {\n if (is_array($data['entity']) && isset($data['entity']['schema'])) {\n return new ArrayContext($request, $data['entity']);\n }\n });\n }", "public function renderForm($fields = array()){\r\n\t\t$formFields \t= $this->formElements;\r\n\t\t$formStarttag \t= $this->generateFormProperites($this->formProperties);\r\n\t\t$formElements \t= $formStarttag;\r\n\t\tforeach($formFields as $key=>$fields) {\r\n\t\t\t$type = $fields['type'];\t\t\t\r\n\t\t\t$formElements.= $this->generateFormField($type,$fields);\r\n\t\t}\r\n\t\t$formEndTag \t= '</form>'.$this->validationJsCode;\r\n\t\t$formElements .= $formEndTag;\r\n\t \treturn $formElements;\r\n\t}", "private function compileFillableArray()\n {\n /** @var \\Doctrine\\DBAL\\Schema\\Column[] $columns */\n $columns = $this->schema->listTableColumns($this->tableName);\n\n $fillableArrayCompiler = new FillableArrayCompiler();\n $fillableArrayCompiled = $fillableArrayCompiler->compile(['columns' => $columns]);\n\n //{{FillableArray}}\n $this->replaceInStub(['{{FillableArray}}' => $fillableArrayCompiled]);\n }", "public function provideRender()\n {\n return [\n 'empty atttribs array test' => [\n 'expected' => '<input type=\"submit\" value=\"Submit\" class=\"btn btn-default\">',\n 'attribs' => [],\n ],\n\n ];\n }", "public function renderForm()\n {\n $fields_form = array(\n 'form' => array(\n 'legend' => array(\n 'title' => $this->l('Configuration'),\n 'icon' => 'icon-gears'\n ),\n 'input' => array(\n array(),\n array(\n 'type' => 'text',\n 'label' => $this->l('API Key'),\n 'name' => 'SEND_SMS_API',\n 'desc' => $this->l('The API Key is used to authenticate in order to send SMS.'),\n 'required' => true\n ),\n array(\n 'type' => 'text',\n 'label' => $this->l('Admin Mobile Number'),\n 'name' => 'ADMIN_MOBILE',\n 'required' => true\n )\n ),\n 'submit' => array(\n 'title' => $this->l('Save')\n )\n )\n );\n $fields_form = $this->setDefaultInput($fields_form);\n $helper = new HelperForm();\n $helper->show_toolbar = false;\n $helper->table = $this->table;\n $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));\n $helper->default_form_language = $lang->id;\n $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG')\n ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;\n $this->fields_form = array();\n $helper->id = (int) Tools::getValue('id_carrier');\n $helper->identifier = $this->identifier;\n $helper->submit_action = 'btnSubmit';\n $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false);\n $helper->currentIndex .= '&configure=' . $this->name . '&tab_module=' . $this->tab;\n $helper->currentIndex .= '&module_name=' . $this->name;\n $helper->currentIndex .= '&configuration=yes';\n $helper->token = Tools::getAdminTokenLite('AdminModules');\n $helper->tpl_vars = array(\n 'fields_value' => $this->getConfigFieldsValues(),\n 'languages' => $this->context->controller->getLanguages(),\n 'id_language' => $this->context->language->id\n );\n \n return $helper->generateForm(array(\n $fields_form\n ));\n }", "public function render()\n {\n $content = \"Ext.create('Ext.form.Panel', {\";\n \n $content .= \"frame: true\";\n \n if ($this->getAction()) {\n $content .= \", url: '\" . $this->getAction() . \"'\";\n }\n \n foreach ($this->getAttribs() as $name => $value) {\n $content .= \", \";\n \n switch ($name) {\n case 'renderTo':\n $content .= \"renderTo: Ext.get('\" . (string)$value . \"')\";\n break;\n case 'height':\n case 'width':\n $content .= $name . \": \" . (int)$value;\n break;\n case 'standardSubmit':\n case 'hidden':\n $content .= $name . \": \" . ((boolean)$value === true ? 'true' : 'false');\n break;\n case 'onEnter':\n $content .= \"listeners: {\n afterRender: function(form, options){\n this.keyNav = Ext.create('Ext.util.KeyNav', this.el, {\n enter: function() {\" . $value . \"},\n scope: this\n });\n }\n }\";\n break;\n case 'defaults':\n $content .= \"defaults: \" . (string)$value;\n break;\n default:\n $content .= $name . \": '\" . htmlspecialchars((string)$value, ENT_QUOTES) . \"'\";\n break;\n }\n }\n \n if (!$this->getAttrib('renderTo')) {\n $content .= \", renderTo: Ext.getBody()\";\n }\n \n $content .= \", items: [\";\n \n if ($this->hasSubForms()) {\n $iterator = new ArrayIterator($this->getSubForms());\n while($iterator->valid()) {\n $subForm = $iterator->current();\n $content .= \"{\";\n \n if ($subForm->getAttrib('width')) {\n $content .= \"width: \" . (int)$subForm->getAttrib('width') . \",\";\n }\n \n $content .= $subForm->render();\n \n $content .= \"}\";\n \n $iterator->next();\n if ($iterator->valid()) {\n $content .= \",\";\n } \n }\n }\n \n if ($this->hasElements()) {\n $iterator = new ArrayIterator($this->getElements());\n while ($iterator->valid()) {\n $element = $iterator->current();\n $content .= $element->render();\n \n $iterator->next();\n if ($iterator->valid()) {\n $content .= \",\";\n }\n }\n }\n\n $content .= \"],\";\n \n $content .= \"buttons: [\";\n \n $iterator = new ArrayIterator($this->getButtons());\n while ($iterator->valid()) {\n $button = $iterator->current();\n \n $content .= $button->render();\n \n $iterator->next();\n \n if ($iterator->valid()) {\n $content .= \",\";\n }\n \n }\n \n $content .= \"]\";\n \n $content .= '});';\n \n return $content;\n }", "private function getMenuArrayRender()\n {\n $this->load->model('Menu_Model', \"menuModel\");\n $this->menuModel->setControllerName($this->_controllerName);\n return $this->menuModel->getMenuArray();\n }", "function feedback($array)\r\n{\r\n\r\n\tforeach ($array as $key=>$value)\r\n\t{\r\n\t\t$output.=format_feedback($value);\r\n\t}\r\n\t$output.=feedback_form();\r\n\treturn $output;\r\n}", "public function toArray()\n {\n return $this->map(function ($label) {\n return str_replace(\n [\n '{one}',\n '{many}'\n ],\n [\n $this->singularForm,\n $this->pluralForm\n ],\n $label\n );\n })->all();\n }", "public function render() {\n return [\n '#theme' => $this->themeFunctions(),\n '#view' => $this->view,\n '#options' => $this->options,\n '#rows' => $this->view->result,\n '#mapping' => $this->defineMapping(),\n ];\n }" ]
[ "0.7627677", "0.647688", "0.59977555", "0.59065557", "0.5873088", "0.5806575", "0.5781639", "0.5715454", "0.567836", "0.56447166", "0.5579045", "0.54680765", "0.54086125", "0.5402145", "0.5392746", "0.5376283", "0.53589725", "0.5348386", "0.53443897", "0.5301276", "0.52846336", "0.5274346", "0.5258861", "0.5253247", "0.5240712", "0.5240289", "0.52350664", "0.5221171", "0.52122855", "0.5190965" ]
0.697619
1
BizForm::RenderFormattedTable() Render form as table format using table format style Example as template>m_FormatStyle:table_style give the top style of the table. head,rowodd,roweven,rowsel,cell in css file will be used in the table elements
protected function RenderFormattedTable() { if ($this->m_QueryONRender) if (!$this->_run_search($resultRecords, $this->m_ClearSearchRule)) return $this->ProcessDataObjError($ok); $dispmode = $this->GetDisplayMode(); $hasSub = $this->m_SubForms ? 1 : 0; //$this->SetDisplayMode($dispmode->GetMode()); $cls_tbl = strlen($dispmode->m_FormatStyle[0])>0 ? "class='".$dispmode->m_FormatStyle[0]."'" : ""; $sHTML_tbl = "<table width=100% border=0 cellspacing=0 cellpadding=3 $cls_tbl>\n"; //$sHTML_tby = "<tbody id='".$this->m_Name."_tbody' Highlighted='".$this->m_Name."_data_".($this->m_CursorIndex+1)."' SelectedRow='".($this->m_CursorIndex+1)."'>\n"; // print column header $columns = $this->m_RecordRow->RenderColumn(); $sHTML = ""; foreach($columns as $colname) $sHTML .= "<th class=head>$colname</th>\n"; // print column data table $name = $this->m_Name; $counter = 0; $sHTML_rows = ""; $selectedRecId = null; $selectedIndex = 0; while (true) { if ($this->m_Range != null && $this->m_Range > 0 && $counter >= $this->m_Range) break; if ($this->CanShowData()) $arr = $resultRecords[$counter]; else $arr = null; if (!$arr && $this->m_FullPage == "N") break; if (!$arr) $sHTML_rows .= "<tr><td colspan=99>&nbsp;</td></tr>\n"; else { $recId = $arr["Id"]; $this->m_RecordRow->SetRecordArr($arr); $tblRow = $this->m_RecordRow->Render(); $rowHTML = ""; foreach($tblRow as $cell) { $cell_html = $cell=="" ? "&nbsp;" : $cell; $rowHTML .= "<td valign=top class=cell>$cell_html</td>\n"; } $rownum = $counter+1; $rowid = $name."_data_".$rownum; $attr = $rownum % 2 == 0 ? "normal=roweven select=rowsel" : "normal=rowodd select=rowsel"; if ($this->m_HistRecordId != null) $this->m_RecordId = $this->m_HistRecordId; if ($this->m_RecordId == null) $this->m_RecordId = $recId; if ($this->m_RecordId == $recId) { $style_class = "class=rowsel"; $selectedRecId = $recId; $selectedIndex = $counter; } else if ($rownum % 2 == 0) $style_class = "class=roweven"; else $style_class = "class=rowodd"; $onclick = "ondblclick=\"CallFunction('$name.EditRecord($recId)');\"" . " onclick=\"CallFunction('$name.SelectRecord($recId,$hasSub)');\""; if ($rownum == 1) { $sHTML_row1 = "<tr id='$recId' $style_class $attr $onclick>\n$rowHTML</tr>\n"; $row1_id = $recId; } else $sHTML_rows .= "<tr id='$recId' $style_class $attr $onclick>\n$rowHTML</tr>\n"; } $counter++; } // while if ($selectedRecId == null) { $selectedRecId = $row1_id; $this->m_RecordId = $selectedRecId; $sHTML_row1 = str_replace("class=rowodd", "class=rowsel", $sHTML_row1); } $sHTML .= $sHTML_row1 . $sHTML_rows; $this->GetDataObj()->SetActiveRecord($resultRecords[$selectedIndex]); $sHTML_pre = "\n<input type='hidden' id='".$this->m_Name."_selectedId' name='_selectedId' value='$selectedRecId'/>\n"; $sHTML_tby = "<tbody id='".$this->m_Name."_tbody'>\n"; $sHTML = $sHTML_pre . $sHTML_tbl . $sHTML_tby . $sHTML . "</tbody></table>"; return $sHTML; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getFormTableContent(){\n\t\t$s_style = 'font-size:'.$this->_emailFontSize.'; font-family:'.$this->_emailFontFamily.';';\n\t\t$bgCol1='#FFFFFF';\n\t\t$bgCol2='#e4edf9';\n\t\t$bgColDarkerBG='#cddaeb';\n\t\t$colOutline='#8a99ae';\n\t\t$rowCount=0;\n\t\t$NL=\"\\r\\n\";\n\t\t$s_ret='<table cellpadding=\"5\" cellspacing=\"0\" style=\"'.$s_style.'\">'.$NL;\n\t\tforeach($this->_formElements as $o_el){\n\t\t\tif(get_class($o_el)=='FormItBuilder_htmlBlock'){\n\t\t\t\t//do nothing\n\t\t\t}else{\n\t\t\t\tif($o_el->showInEmail()===true){\n\t\t\t\t\t\n\t\t\t\t\t$bgCol=$bgCol1;\n\t\t\t\t\tif($rowCount%2==0){\n\t\t\t\t\t\t$bgCol=$bgCol2;\n\t\t\t\t\t}\n\n\t\t\t\t\t$elType=get_class($o_el);\n\t\t\t\t\t$elId = $o_el->getId();\n\t\t\t\t\t\n\t\t\t\t\tswitch($elType){\n\t\t\t\t\t\tcase 'FormItBuilder_elementMatrix':\n\t\t\t\t\t\t\t$type = $o_el->getType();\n\t\t\t\t\t\t\t$cols = $o_el->getColumns();\n\t\t\t\t\t\t\t$rows = $o_el->getRows();\n\t\t\t\t\t\t\t$r_cnt=0;\n\t\t\t\t\t\t\t$s_val='<table cellpadding=\"5\" cellspacing=\"0\" style=\"'.$s_style.' font-size:10px;\"><tr><td>&nbsp;</td>';\n\t\t\t\t\t\t\t$c_cnt=0;\n\t\t\t\t\t\t\tforeach($cols as $column){\n\t\t\t\t\t\t\t\t$s_val.='<td style=\"'.($c_cnt==0?'border-left:1px solid '.$colOutline.'; ':'').'background-color:'.$bgColDarkerBG.'; border-right:1px solid '.$colOutline.'; border-bottom:1px solid '.$colOutline.'; border-top:1px solid '.$colOutline.';\"><em>'.htmlspecialchars($column).'</em></td>';\n\t\t\t\t\t\t\t\t$c_cnt++;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$s_val.='</tr>';\n\t\t\t\t\t\t\tforeach($rows as $row){\n\t\t\t\t\t\t\t\t$c_cnt=0;\n\t\t\t\t\t\t\t\t$s_val.='<tr><td style=\"'.($r_cnt==0?'border-top:1px solid '.$colOutline.'; ':'').'background-color:'.$bgColDarkerBG.'; border-right:1px solid '.$colOutline.'; border-left:1px solid '.$colOutline.'; border-bottom:1px solid '.$colOutline.';\"><em>'.htmlspecialchars($row).'</em></td>';\n\t\t\t\t\t\t\t\tforeach($cols as $column){\n\t\t\t\t\t\t\t\t\t$s_val.='<td style=\"text-align:center; border-right:1px solid '.$colOutline.'; border-bottom:1px solid '.$colOutline.';\">';\n\t\t\t\t\t\t\t\t\tswitch($type){\n\t\t\t\t\t\t\t\t\t\tcase 'text':\n\t\t\t\t\t\t\t\t\t\t\t$s_val.=htmlspecialchars($_REQUEST[$elId.'_'.$r_cnt.'_'.$c_cnt]);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 'radio':\n\t\t\t\t\t\t\t\t\t\t\t$s_val.=($c_cnt==$_REQUEST[$elId.'_'.$r_cnt]?'&#10004;':'-');\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 'check':\n\t\t\t\t\t\t\t\t\t\t\tif(isset($_REQUEST[$elId.'_'.$r_cnt]) && in_array($c_cnt,$_REQUEST[$elId.'_'.$r_cnt])===true){\n\t\t\t\t\t\t\t\t\t\t\t\t$s_val.='&#10004;';\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t$s_val.='-';\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t$s_val.='</td>';\n\t\t\t\t\t\t\t\t\t$c_cnt++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$r_cnt++;\n\t\t\t\t\t\t\t\t$s_val.='</tr>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$s_val.='</table>';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'FormItBuilder_elementFile':\n\t\t\t\t\t\t\tif(isset($_FILES[$elId])){\n\t\t\t\t\t\t\t\tif($_FILES[$elId]['size']==0){\n\t\t\t\t\t\t\t\t\t$s_val='None';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'FormItBuilder_elementDate':\n\t\t\t\t\t\t\t$s_val='[[+'.htmlspecialchars($o_el->getId()).'_0]] [[+'.htmlspecialchars($o_el->getId()).'_1]] [[+'.htmlspecialchars($o_el->getId()).'_2]]';\n\t\t\t\t\t\t\tbreak;\t\t\t\t\t\t\t\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$s_val='[[+'.htmlspecialchars($o_el->getId()).':nl2br]]';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$s_ret.='<tr valign=\"top\" bgcolor=\"'.$bgCol.'\"><td><b>'.htmlspecialchars($o_el->getLabel()).':</b></td><td>'.$s_val.'</td></tr>'.$NL;\n\t\t\t\t\t$rowCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$s_ret.='</table>'.$NL;\n\t\treturn $s_ret;\n\t}", "public function render()\r\n {\r\n $widths = $this->calculateWidths();\r\n\r\n $table = $this->renderHeaders($widths);\r\n $table .= $this->renderRows($widths);\r\n\r\n return $table;\r\n }", "public function GetHTML( $showCount = true, $styleTable = NULL, $styleHeader = NULL, $styleData = NULL )\r\n\t{\r\n\t\tif( $styleTable === NULL )\r\n\t\t{\r\n\t\t\t$tb = \"border-collapse:collapse;empty-cells:show\";\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$tb = $styleTable;\r\n\t\t}\r\n\t\tif( $styleHeader === NULL )\r\n\t\t{\r\n\t\t\t$th = \"border-width:1px;border-style:solid;background-color:navy;color:white\";\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$th = $styleHeader;\r\n\t\t}\r\n\t\tif( $styleData === NULL )\r\n\t\t{\r\n\t\t\t$td = \"border-width:1px;border-style:solid\";\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$td = $styleData;\r\n\t\t}\r\n\r\n\t\tif( $this->last_result )\r\n\t\t{\r\n\t\t\tif( $this->RowCount() > 0 )\r\n\t\t\t{\r\n\t\t\t\t$html = \"\";\r\n\t\t\t\tif( $showCount ) $html = \"Record Count: \" . $this->RowCount() . \"<br />\\n\";\r\n\t\t\t\t$html .= \"<table style=\\\"$tb\\\" cellpadding=\\\"2\\\" cellspacing=\\\"2\\\">\\n\";\r\n\t\t\t\t$this->MoveFirst();\r\n\t\t\t\t$header = false;\r\n\t\t\t\twhile( $member = mysql_fetch_object( $this->last_result ) )\r\n\t\t\t\t{\r\n\t\t\t\t\tif( !$header )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$html .= \"\\t<tr>\\n\";\r\n\t\t\t\t\t\tforeach( $member as $key => $value )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$html .= \"\\t\\t<td style=\\\"$th\\\"><strong>\" . htmlspecialchars( $key ) . \"</strong></td>\\n\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$html .= \"\\t</tr>\\n\";\r\n\t\t\t\t\t\t$header = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$html .= \"\\t<tr>\\n\";\r\n\t\t\t\t\tforeach( $member as $key => $value )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$html .= \"\\t\\t<td style=\\\"$td\\\">\" . htmlspecialchars( $value ) . \"</td>\\n\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$html .= \"\\t</tr>\\n\";\r\n\t\t\t\t}\r\n\t\t\t\t$this->MoveFirst();\r\n\t\t\t\t$html .= \"</table>\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$html = \"No records were returned.\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$this->active_row = -1;\r\n\t\t\t$html = false;\r\n\t\t}\r\n\t\treturn $html;\r\n\t}", "public function tableRender($form, $table_name, $table_rows, $last_year, $table_id) {\n $fields_list = ['Year', 'Jan', 'Feb', 'Mar', 'Q1', 'Apr', 'May', 'Jun', 'Q2', 'Jul', 'Aug', 'Sep', 'Q3', 'Oct', 'Nov', 'Dec', 'Q4', 'YTD'];\n $actions_name = \"action_{$table_id}\";\n\n $form[$actions_name]['addYear'] = [\n '#type' => 'button',\n '#value' => $this->t('Add Year'),\n '#name' => 'add_year_' . $table_id,\n '#last_year' => $last_year,\n '#ajax' => [\n 'callback' => '::submitAjaxCallback',\n 'event' => 'click',\n 'wrapper' => 'table_wrapper',\n ]\n ];\n\n $form[$table_name] = [\n '#type' => 'table',\n '#title' => 'Sample Table',\n '#header' => $fields_list,\n ];\n\n for ($j = 0; $j <= $table_rows; $j++) {\n $qtd = 1;\n for ($i = 0; $i < count($fields_list); $i++) {\n if ($fields_list[$i] == 'Year') {\n $form[$table_name][$j]['Year'] = array(\n '#type' => 'textfield',\n '#size' => 4,\n '#attributes' => array('readonly' => 'readonly'),\n '#default_value' => $last_year,\n );\n } elseif ($fields_list[$i] == 'Q1' || $fields_list[$i] == 'Q2' || $fields_list[$i] == 'Q3' || $fields_list[$i] == 'Q4') {\n $qtd++;\n $form[$table_name][$j][$fields_list[$i]] = [\n '#type' => 'number',\n '#prefix' => \"<div class='table-field-$j-$fields_list[$i]-$table_name black-field'>\",\n '#suffix' => \"</div>\",\n '#step' => '0.01',\n '#attributes' => [\n 'class' => ['qtd-input'],\n 'data-qtd' => $fields_list[$i],\n ]\n ];\n } elseif ($fields_list[$i] == 'YTD') {\n $form[$table_name][$j][$fields_list[$i]] = [\n '#type' => 'number',\n '#prefix' => \"<div class='table-field-YTD-$j-$table_name'>\",\n '#suffix' => \"</div>\",\n '#attributes' => [\n 'class' => ['year-input'],\n ],\n '#step' => '0.01',\n ];\n } else {\n $form[$table_name][$j][$fields_list[$i]] = [\n '#type' => 'number',\n '#step' => '0.01',\n '#attributes' => [\n 'class' => ['month-input'],\n 'data-month' => $i,\n 'data-qtd' => 'Q' . $qtd,\n ]\n ];\n }\n }\n }\n\n return $form;\n }", "public function render()\n\t{\n\n\t\t$table = \"<table\";\n\n\t\t// Add all attributes\n\t\tforeach ($this->attributes as $key => $value) {\n\t\t\t$table .= ' ' . $key . '=\"' . $value .'\"';\n\t\t}\n\n\t\t$table .= \">\"; // Close table\n\n\t\t// Add the head\n\t\tif ($this->showHeadRow) {\n\t\t\t$table .= \"<thead><tr>\";\n\n\t\t\t// Show the number header.\n\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t$table .= \"<th>#</th>\";\n\t\t\t}\n\n\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t$columnHeadTitle = isset($column['headTitle']) ? $column['headTitle'] : $column[0];\n\t\t\t\t$table .= \"<th>\" . $columnHeadTitle . \"</th>\";\n\t\t\t}\n\n\t\t\t$table .= \"</tr></thead>\"; // finish head\n\t\t}\n\n\t\t// Body\n\t\t$table .= \"<tbody>\";\n\n\t\t$row = $this->numberColumnOffset;\n\n\t\tif (count($this->data) == 0) {\n\t\t\t// Show a no data entry\n\t\t\t$colspan = count($this->columns) + ($this->showNumberColumn ? 1 : 0);\n\t\t\t$table .= '<tr><td colspan=\"'.$colspan.'\"><p align=\"center\" style=\"font-weight:bold;\">Keine Einträge</p></td></tr>';\n\t\t}\n\t\telse {\n\t\t\tforeach ($this->data as $dataObject) {\n\n\t\t\t\t// Row attributes\n\t\t\t\t$attributes = $this->rowAttributes;\n\t\t\t\tif (!is_array($attributes)) {\n\t\t\t\t\tif (is_callable($this->rowAttributes)) {\n\t\t\t\t\t\t$callable = $this->rowAttributes;\n\t\t\t\t\t\t$attributes = $callable($dataObject);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$attributeString = '';\n\t\t\t\tif ($attributes) {\t\t// Add attributes if we have some\n\t\t\t\t\tforeach ($attributes as $attributeName => $attributeValue) {\n\t\t\t\t\t\t$attributeString .= $attributeName . '=\"' . $attributeValue . '\" ' ;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($this->rowIdDataMethod) {\n\t\t\t\t\t// method name or closure?\n\t\t\t\t\t$id = '';\n\t\t\t\t\tif (is_string($this->rowIdDataMethod)) {\n\t\t\t\t\t\t$id = $dataObject->{$this->rowIdDataMethod}(); // Call the row data method\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($this->rowIdDataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\t\t\t\t\t\t\t// we got a closure\n\t\t\t\t\t\t\t$closure = $this->rowIdDataMethod;\n\t\t\t\t\t\t\t$id = $closure($dataObject);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\n\t\t\t\t\t$table .= '<tr id=\"'. $id .'\" ' . $attributeString . '>'; // Start row with id\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$table .= \"<tr \". $attributeString .\">\";\t// Start row without id\n\t\t\t\t}\n\n\t\t\t\t// Number?\n\t\t\t\tif ($this->showNumberColumn) {\n\t\t\t\t\t$table .= \"<td>\" . $row . \"</td>\";\n\t\t\t\t}\n\n\t\t\t\tforeach ($this->columns as $column) {\n\t\t\t\t\t$dataMethod = isset($column['dataMethod']) ? $column['dataMethod'] : $column[1];\n\t\t\t\t\tif (is_string($dataMethod)) {\n\t\t\t\t\t\t// Just call the method an insert the return value into the table cell\n\t\t\t\t\t\t$table .= \"<td>\". $dataObject->$dataMethod() .\"</td>\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$rf = new \\ReflectionFunction($dataMethod);\n\t\t\t\t\t\tif ($rf->isClosure()) {\n\n\t\t\t\t\t\t\t// Call the closure and get the result\n\t\t\t\t\t\t\t$value = $dataMethod($dataObject, $this);\n\n\t\t\t\t\t\t\t$table .= \"<td>\". $value .\"</td>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$table .= \"</tr>\";\t// End the table row\n\t\t\t\t$row++;\n\t\t\t}\n\n\t\t\t// Render the footer row\n\t\t\t$table = $this->renderFooter($table);\n\n\t\t}\n\n\t\t$table .= \"</tbody>\";\n\n\t\t$table .= \"</table>\";\n\t\treturn $table;\n\t}", "public function getTable($css_classes=''){\r\n\t\t$table=\"<table class='$css_classes'>\";\r\n\t\t // this condition check the single array\r\n\t\t\tif(count($this->values)==count($this->values,1)){\r\n\t\t\t\tforeach($this->values as $key=>$val){\r\n\t\t\t\t\t$table.=\"<tr>\";\r\n\t\t\t\t\t\t$table.=\"<th>$key</th><td>$val</td>\";\r\n\t\t\t\t\t$table.=\"</tr>\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t$table.=\"<tr>\";\r\n // this condition check for nested array\r\n\t\t\t\tforeach($this->values[0] as $key=>$row){\r\n\t\t\t\t\t$table.=\"<th>\".ucfirst($key).\"</th>\";\r\n\t\t\t\t}\r\n\t\t\t\t$table.=\"<th>Action</th>\";\r\n\t\t\t\t$table.=\"</tr>\";\r\n\t\t\t\tforeach($this->values as $row){\r\n\t\t\t\t\t$table.=\"<tr>\";\r\n\t\t\t\t\t\tforeach($row as $val){\r\n\t\t\t\t\t\t\t$table.=\"<td>$val</td>\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// add two button for edit and delete data\r\n\t\t\t\t\t\t$table.=\"<td><a class='btn btn-info' href='edit.php?id=$row[id]'>Edit</a> <a class='btn btn-danger mt-1' href='delete.php?delid=$row[id]'>Delete</a></td>\";\r\n\t\t\t\t\t$table.=\"</tr>\";\r\n\t\t\t\t}\r\n\t\t\t\t// ceate a new row for add new data \r\n\t\t\t\t$colspan=count($this->values)+1;\r\n\t\t\t\t$table.=\"<tr><td class='text-center' colspan='$colspan'><a class='btn btn-primary' href='insert_form.php'>Add New Value</a></td></tr>\";\r\n\t\t\t}\r\n\r\n\t\t$table.=\"</table>\";\r\n\t\treturn $table;\r\n\t}", "public function getHtml($fieldsPerRow = 1, $displayOrder = \"vertical\"){\n $fields = $this->form->fields;\n $fieldsHidden = array();\n $fieldsBlock = array();\n foreach($fields as $key => $field){\n if($field instanceof Form_Field_Hidden){\n $fieldsHidden[] = $field;\n unset($fields[$key]);\n }\n }\n $fieldsPerBlock = ceil(count($fields) / $fieldsPerRow);\n if($displayOrder == \"horizontal\"){\n for($i = 1 ; $i <= $fieldsPerBlock; $i++){\n for($b = 1; $b <= $fieldsPerRow; $b++){\n $field = array_shift($fields);\n if($field === null) break 2;\n $fieldsBlock[$b][$field->name] = $field;\n }\n }\n }elseif($displayOrder == \"vertical\"){\n for($b = 1; $b <= $fieldsPerRow; $b++){\n for($i = 1 ; $i <= $fieldsPerBlock; $i++){\n $field = array_shift($fields);\n if($field === null) break 2;\n $fieldsBlock[$b][$field->name] = $field;\n }\n }\n }\n\n $output = '<div id=\"'.$this->id.'\" class=\"formtable\">';\n $output .= '<form '.$this->form->attr->getHtml().'>';\n $output .= '<input type=\"hidden\" name=\"form-'.$this->form->attr->get(\"name\").'\" value=\"1\"/>';\n foreach($fieldsHidden as $field){\n $output .= $field->getHtml();\n }\n if($fieldsBlock){\n $blockWidth = round(100 / $fieldsPerRow, 2, PHP_ROUND_HALF_DOWN);\n foreach($fieldsBlock as $block => $fields){\n $output .= '<div class=\"formtable-block\" style=\"width:'.$blockWidth.'%\">';\n if($fields){\n $output .= '<table class=\"formtable-table\">';\n foreach($fields as $field){\n $output .= '<tr class=\"formtable-fieldtype-'.strtolower(slugify(get_class($field))).' formtable-field-name-'.slugify($field->name).'\">';\n $output .= '<td class=\"formtable-label\"><label for=\"'.$field->attr->get(\"id\").'\">'.$field->label.'</label></td>';\n $output .= '<td class=\"formtable-field\">'.$field->getHtml().'</td>';\n $output .= '</tr>';\n }\n $output .= '</table>';\n }\n $output .= '</div>';\n }\n }\n if($this->buttons){\n $output .= '<div class=\"formtable-buttons\">';\n if($fieldsBlock) $output .= '<table class=\"formtable-table\"><tr><td class=\"formtable-label\"></td><td class=\"formtable-field\">';\n foreach($this->buttons as $field){\n $output .= $field->getHtml();\n }\n if($fieldsBlock) $output .= '</td></tr></table>';\n $output .= '</div>';\n }\n $output .= '</form></div>';\n $output .= '<script type=\"text/javascript\">(function(){var container = $(\"#'.$this->id.'\"); if(!container.data(\"formtable\")) new FormTable(container)})();</script>';\n return $output;\n }", "public function renderTableBody()\n {\n $models = array_values($this->dataProvider->getModels());\n $keys = $this->dataProvider->getKeys();\n $rows = [];\n foreach ($models as $index => $model) {\n $key = $keys[$index];\n if ($this->beforeRow !== null) {\n $row = call_user_func($this->beforeRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model, $key, $index);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $key, $index, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows) && $this->emptyText !== false) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n }\n\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }", "public function renderTableBody() {\n //$models = array_values($this->dataProvider->getModels());\n //$keys = $this->dataProvider->getKeys();\n $rows = [];\n \n foreach ($this->dataProvider as $model) {\n if (is_callable($this->beforeRow)) {\n $row = call_user_func($this->beforeRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n\n $rows[] = $this->renderTableRow($model);\n\n if ($this->afterRow !== null) {\n $row = call_user_func($this->afterRow, $model, $this);\n if (!empty($row)) {\n $rows[] = $row;\n }\n }\n }\n\n if (empty($rows)) {\n $colspan = count($this->columns);\n\n return \"<tbody>\\n<tr><td colspan=\\\"$colspan\\\">\" . $this->renderEmpty() . \"</td></tr>\\n</tbody>\";\n } else {\n return \"<tbody>\\n\" . implode(\"\\n\", $rows) . \"\\n</tbody>\";\n }\n }", "function Render()\n\t{\n\t\t$strTableName = $this->_strName;\n\t\t$strVixenTable = \"Vixen.table.{$strTableName}\";\n\n\t\techo \"\n<script type='text/javascript'>\n\t{$strVixenTable} = Object();\n\t{$strVixenTable}.collapseAll = TRUE;\n\t{$strVixenTable}.linked = TRUE;\n\t{$strVixenTable}.totalRows = 0;\n\t{$strVixenTable}.row = Array();\n</script>\";\n\t\t\t\n\t\t\n\t\t$strPageSize = $this->_intPageSize > 0 ? \" page_size='{$this->_intPageSize}' \" : \"\";\n\n\t\techo \"<table border='0' cellpadding='3' cellspacing='0' class='Listing' width='100%' id='$strTableName'$strPageSize>\\n\";\n\t\t\n\t\t// Build headers\n\t\techo \"<tr class='First'>\\n\";\n\t\t$intHeaderCount = 0;\n\t\t$intSortLimit = ($this->_bolSortable && is_array($this->_arrSortFields)) ? count ($this->_arrSortFields) : -1;\n\t\tforeach ($this->_arrHeader AS $objField)\n\t\t{\n\t\t\t$strAlign = $this->_arrAlignments[$intHeaderCount];\n\t\t\t$strSortLabel = \"\";\n\t\t\tif ($intHeaderCount <= $intSortLimit)\n\t\t\t{\n\t\t\t\tif ($this->_arrSortFields[$intHeaderCount] !== NULL)\n\t\t\t\t{\n\t\t\t\t\t$strSortLabel = \" TABLE_SORT='\" . $this->_arrSortFields[$intHeaderCount] . \"' \";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$strSortLabel = \" NO_TABLE_SORT='1' \";\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \" <th width='{$this->_arrWidths[$intHeaderCount]}' align='$strAlign'$strSortLabel>\". $objField .\"</th>\\n\";\n\t\t\t$intHeaderCount++;\n\t\t}\n\t\techo \"</tr>\\n\";\n\t\t\n\t\t// Build rows\n\t\t$intRow = -1;\n\t\tforeach ($this->_arrRows AS $objRow)\n\t\t{\n\t\t\t$intRow++;\n\t\t\t$strClass = ($intRow % 2) ? 'Odd' : 'Even';\n\t\t\t$strStyle = \"\";\n\t\t\t\n\t\t\tif (isset($objRow['OnClick']))\n\t\t\t{\n\t\t\t\t// Escape special chars\n\t\t\t\t$strOnClick = \"onclick='\". htmlspecialchars($objRow['OnClick'], ENT_QUOTES) .\"'\";\n\t\t\t\t$strStyle .= \"cursor:pointer;\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$strOnClick = \"\";\n\t\t\t}\n\t\t\t\n\t\t\techo \"<tr id='\" . $strTableName . \"_\" . $intRow . \"' class='$strClass' $strOnClick style='$strStyle'>\\n\";\n\t\t\t\n\t\t\t$intColCount = 0;\n\t\t\t// Build fields\n\t\t\tforeach ($objRow['Columns'] as $objField)\n\t\t\t{\n\t\t\t\t$strWidth = '';\n\t\t\t\t// Work out which width to use\n\t\t\t\t//TODO! After setting the widths once in the header, you shouldn't have to set them again, but we are anyway.\n\t\t\t\t//This could cut down the size of the html file generated\n\t\t\t\t/*if (isset($objRow['Widths']))\n\t\t\t\t{\n\t\t\t\t\t// Use the width specific to this row and column\n\t\t\t\t\t$strWidth = \"width='\". $objRow['Widths'][$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use the general width of this column\n\t\t\t\t\t$strWidth = \"width='\". $this->_arrWidths[$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\t*/\n\n\t\t\t\t// Work out which alignment to use\n\t\t\t\tif (isset($objRow['Alignments']))\n\t\t\t\t{\n\t\t\t\t\t// Use the alignment specific to this row and column\n\t\t\t\t\t$strAlignment = \"align='\". $objRow['Alignments'][$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Use the general alignment of this column\n\t\t\t\t\t$strAlignment = \"align='\". $this->_arrAlignments[$intColCount] .\"'\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Work out how many columns, this column spans\n\t\t\t\t$strColSpan = \"\";\n\t\t\t\tif (isset($objRow['ColSpans']))\n\t\t\t\t{\n\t\t\t\t\t// colspan values have been declared for this row\n\t\t\t\t\t$strColSpan = \"colspan='\". $objRow['ColSpans'][$intColCount] .\"'\";\n\t\t\t\t\t\n\t\t\t\t\t// If using ColSpans do not use row widths\n\t\t\t\t\t$strWidth = \"\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\techo \"<td $strWidth $strAlignment $strColSpan>\";\n\t\t\t\techo \"$objField\";\n\t\t\t\techo \"</td>\\n\";\n\t\t\t\t$intColCount++;\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t// Build detail\n\t\t\tif ($this->_bolDetails)\n\t\t\t{\n\t\t\t\techo \"</tr>\";\n\t\t\t\techo \"<tr>\";\n\t\t\t\techo \"<td colspan=\". count($this->_arrHeader) .\" style='padding: 0px 1px 1px 1px;'>\";\n\t\t\t\techo \"<div id='\" . $strTableName . \"_\" . $intRow . \"DIV-DETAIL' style='display: block; overflow:hidden;'>\";\n\t\t\t\techo $objRow['Detail'];\n\t\t\t\techo \"</div>\";\n\t\t\t\techo \"</td>\\n\";\n\t\t\t}\n\t\t\t\n\t\t\t// Build tooltip\n\t\t\tif ($this->_bolToolTips)\n\t\t\t{\n\t\t\t\techo \"</tr>\";\n\t\t\t\techo \"<tr>\";\n\t\t\t\techo \"<td colspan=4 style='padding-top: 0px; padding-bottom: 0px'>\";\n\t\t\t\techo \"<div id='\" . $strTableName . \"_\" . $intRow . \"DIV-TOOLTIP' style='display: none;'>\";\n\t\t\t\techo $objRow['ToolTip'];\n\t\t\t\techo \"</div>\\n\";\n\t\t\t\techo \"</td>\";\n\t\t\t}\n\t\t\n\t\t\techo \"\\n<script type='text/javascript'>\";\n\t\t\techo \"objRow = Object();\\n\";\n\t\t\t\n\t\t\techo \"objRow.selected = false;\\n\";\n\t\t\techo \"objRow.up = true;\\n\";\n\n\t\t\tif ($this->_bolLinked)\n\t\t\t{\n\t\t\t\tif (is_array($objRow['Index']))\n\t\t\t\t{\n\t\t\t\t\t// add Indexes to objRow\n\t\t\t\t\techo \"objIndex = Object();\";\n\t\t\t\t\t\n\t\t\t\t\tforeach ($objRow['Index'] as $strIndexName=>$arrValues)\n\t\t\t\t\t{\n\t\t\t\t\t\techo \"objIndex.{$strIndexName} = Array();\";\n\t\t\t\t\t\tforeach ($arrValues as $strValue)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo \"objIndex.{$strIndexName}.push('$strValue');\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\techo \"objRow.index = objIndex;\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\techo \"{$strVixenTable}.row.push(objRow);\\n\";\n\t\t\techo \"</script>\\n\";\n\t\t\techo \"</tr>\\n\";\n\t\t}\n\t\t$intRowCount = $intRow + 1;\n\t\techo \"</table>\\n\";\n\t\t\n\t\techo \"<script type='text/javascript'>{$strVixenTable}.totalRows = $intRowCount;</script>\\n\";\t\n\t\t\n\t\tif ($this->_bolRowHighlighting)\n\t\t{\n\t\t\t// The following \"Vixen.AddCommand\" method breaks down when you try dynamicly inserting a VixenTable into\n\t\t\t// the DOM, because AddCommand only triggers the command when the body.onload event is triggered\n\t\t\t//echo \"<script type='text/javascript'>Vixen.AddCommand('Vixen.Highlight.Attach','\\'$strTableName\\'', $intRowCount);</script>\";\n\t\t\techo \"<script type='text/javascript'>Vixen.Highlight.Attach('$strTableName');</script>\";\n\t\t}\n\t\t\n\t\tif ($this->_bolToolTips)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.Tooltip.Attach('$strTableName');</script>\";\n\t\t}\n\t\t\n\t\tif ($this->_bolDetails)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.Slide.Attach('$strTableName', TRUE);</script>\\n\";\n\t\t}\n\t\t\n\t\tif ($this->_bolLinked)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>\";\n\t\t\techo \"{$strVixenTable}.linked = TRUE;\";\n\t\t\t\n\t\t\techo \"objLink = Object();\\n\";\n\t\t\t\n\t\t\tforeach ($this->_arrLinkedTables AS $strTableName=>$arrIndexes)\n\t\t\t{\n\t\t\t\techo \"objLink.{$strTableName} = Array();\\n\";\n\t\t\t\tforeach ($arrIndexes AS $strIndex)\n\t\t\t\t{\n\t\t\t\t\techo \"objLink.{$strTableName}.push('$strIndex');\\n\";\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \"{$strVixenTable}.link = objLink;\\n\";\n\t\t\t\n\t\t\techo \"</script>\\n\";\n\t\t\t\t/*'link':\n\t\t\t{\n\t\t\t\t'AccountInvoices' :\n\t\t\t\t[\n\t\t\t\t\t'Invoice'\n\t\t\t\t]\n\t\t\t},*/\n\t\t}\n\t\t\n\t\tif ($this->_bolSortable)\n\t\t{\n\t\t\techo \"<script type='text/javascript'>Vixen.TableSort.prepare('$strTableName');</script>\\n\";\n\t\t}\n\t}", "function FrontPageTable(){\r\n //$this->SetFillColor(135,206,250);\r\n $this->SetFillColor(176,196,222);\r\n $this->SetTextColor(0);\r\n $this->SetDrawColor(0,0,0);\r\n $this->SetLineWidth(.3);\r\n $this->SetFont('','B');\r\n // Header\r\n\r\n $this->SetX(35);\r\n $this->Cell(70,7,'Prepared By:',1,0,'C',true);\r\n $this->Cell(40,7,'Organization',1,0,'C',true);\r\n $this->Cell(40,7,'Date',1,0,'C',true);\r\n $this->Ln();\r\n $this->SetX(35);\r\n $this->SetTextColor(0,0,0);\r\n $this->SetFont('');\r\n $this->Cell(70,7,$this->PreparedBy,1,0,'C',false);\r\n $this->Cell(40,7,'NRAO',1,0,'C',false);\r\n $this->Cell(40,7,$this->MakeDate,1,0,'C',false);\r\n $this->Ln();\r\n\r\n\r\n $this->SetX(35);\r\n $this->SetTextColor(0);\r\n $this->SetFont('','B');\r\n $this->Cell(70,7,'FEIC WP Manager Approval:',1,0,'C',true);\r\n $this->Cell(40,7,'Organization',1,0,'C',true);\r\n $this->Cell(40,7,'Date',1,0,'C',true);\r\n $this->Ln();\r\n $this->SetX(35);\r\n $this->SetFont('');\r\n $this->Cell(70,27,'',1,0,'C',false);\r\n $this->Cell(40,27,'',1,0,'C',false);\r\n $this->Cell(40,27,'',1,0,'C',false);\r\n $this->Ln();\r\n $this->SetX(35);\r\n $this->SetTextColor(0);\r\n $this->SetFont('','B');\r\n $this->Cell(70,7,'FE System Engineering Approval:',1,0,'C',true);\r\n $this->Cell(40,7,'Organization',1,0,'C',true);\r\n $this->Cell(40,7,'Date',1,0,'C',true);\r\n $this->Ln();\r\n $this->SetX(35);\r\n $this->SetFont('');\r\n $this->Cell(70,27,'',1,0,'C',false);\r\n $this->Cell(40,27,'',1,0,'C',false);\r\n $this->Cell(40,27,'',1,0,'C',false);\r\n $this->Ln();\r\n $this->SetX(35);\r\n $this->SetTextColor(0);\r\n $this->SetFont('','B');\r\n $this->Cell(70,7,'FE IPT Lead Approval:',1,0,'C',true);\r\n $this->Cell(40,7,'Organization',1,0,'C',true);\r\n $this->Cell(40,7,'Date',1,0,'C',true);\r\n $this->Ln();\r\n $this->SetX(35);\r\n $this->SetFont('');\r\n $this->Cell(70,27,'',1,0,'C',false);\r\n $this->Cell(40,27,'',1,0,'C',false);\r\n $this->Cell(40,27,'',1,0,'C',false);\r\n $this->Ln();\r\n\r\n // Color and font restoration\r\n $this->SetFillColor(224,235,255);\r\n $this->SetTextColor(255);\r\n $this->SetFont('');\r\n // Data\r\n $fill = false;\r\n }", "private function render_data()\n\t{\n\t\t// create if the headers exists\n\t\t// 2 header style table\n\t\tif(count($this->headers) == 2 && isset($this->headers[0][0]) && isset($this->headers[1][0]) )\n\t\t{\n\t\t\t// generate the column headers\n\t\t\t$html = '<tr><th></th>';\n\t\t\tforeach($this->headers[0] as $header)\n\t\t\t\t$html .= \"<th>$header</th>\";\n\t\t\t$html .= '</tr>';\n\t\t\t\n\t\t\t// generate the row headers and the data\n\t\t\tfor($i=0; $i<count($this->headers[1]); $i++)\n\t\t\t{\n\t\t\t\t// the header\n\t\t\t\t$html .= \"<tr><th>{$this->headers[1][$i]}</th>\";\n\t\t\t\t\n\t\t\t\t// and now the data\n\t\t\t\tforeach($this->data[$i] as $datum)\n\t\t\t\t\t$html .= \"<td>$datum</td>\";\n\t\t\t\t\n\t\t\t\t$html .= '</tr>';\n\t\t\t}\n\t\t\treturn $html;\n\t\t}//end if\n\t\t\n\t\t// 1 header style table\n\t\tif(count($this->headers) > 0 && isset($this->headers[0]) && !is_array($this->headers[0]) )\n\t\t{\n\t\t\t// generate the column headers\n\t\t\t$html = '<tr>';\n\t\t\tforeach($this->headers as $header)\n\t\t\t\t$html .= \"<th>$header</th>\";\n\t\t\t$html .= '</tr>';\n\t\t\t\n\t\t\t// generate the data\n\t\t\tfor($i=0; $i<count($this->data); $i++)\n\t\t\t{\n\t\t\t\tforeach($this->data[$i] as $datum)\n\t\t\t\t\t$html .= \"<td>$datum</td>\";\n\t\t\t\t\n\t\t\t\t$html .= '</tr>';\n\t\t\t}\n\t\t\t\n\t\t\treturn $html;\n\t\t}//end if\n\t\t\n\t\treturn '';\n\t}", "public function render() {\n $output = array();\n array_push($output, 0, \"STYLE\");\n array_push($output, 5, $this->getHandle());\n array_push($output, 100, \"AcDbSymbolTableRecord\");\n array_push($output, 100, \"AcDbTextStyleTableRecord\");\n array_push($output, 2, strtoupper($this->name));\n array_push($output, 70, $this->flag);\n array_push($output, 6, $this->lineType);\n return implode(PHP_EOL, $output);\n }", "public static function build_table( $db_array ) {\n\n $display = self::formhead();\n \tforeach ( $db_array[0] as $column => $field ) {\n \t\t$display .= \"<th class='cell100 column1'>$column</th>\\n\";\n \t}\n \t$display .= \"</tr></thead></table></div>\\n\";\n $display .= \"<div class='table100-body '><table><tbody>\" ;\n \tforeach ( $db_array as $record ) {\n \t\t$display .= \"<tr class='row100 body'>\\n\";\n \t\tforeach ( $record as $field ) {\n \t\t\t$display .= \"<td class='cell100 column1'>$field</td>\\n\";\n \t\t}\n \t\t$display .= \"</tr>\\n\";\n \t}\n\n \t$display .= \"</tbody></table>\\n\";\n $display .= \"</div></div>\\n\";\n \t\n \treturn $display;\n }", "function make_table($result)\r\n{\r\n $temp_result=\"\\n<form name=f1 metbod='POST' action=''>\";\r\n $temp_result.=\"\\n<table cellpadding=2 cellspacing=1>\";\r\n for($i=0;$i<mysql_num_rows($result);$i++)\r\n {\r\n $a_rows=mysql_fetch_assoc($result);\r\n $noofcolumns=mysql_num_fields($result);\r\n #Starting rows-\r\n if($i==0)\r\n\t{\r\n\t $temp_result.=\"\\n<tr bgcolor=#d3dce3>\\n\";\r\n\t \t $temp_result.=\"<td colspan=3></td>\";\r\n\t foreach($a_rows as $key=>$value)\r\n\t {\r\n\t $temp_result.=\"<td>\".$key.\"</td>\";\r\n\t }\r\n\t $temp_result.=\"\\n</tr>\";\r\n\t}\r\n\r\n #data rows-\r\n $temp_result.=\"\\n<tr bgcolor=\".(($i%2==0)?\"#e5e5e5\":\"#d5d5d5\").\">\\n\";\r\n\t#edit columns-\r\n $temp_result.=\"\\n\\t<td><input type=checkbox name=check\".$i.\"></td>\";\r\n $temp_result.=\"\\n\\t<td><a name=\".$i.\" href=\\\"javascript:enable(\".$i.\",\".$noofcolumns.\")\\\"><img src=\\\"b_edit.png\\\" border=0></a></td>\";\r\n $temp_result.=\"\\n\\t<td><a href=\\\"\\\"><img src=\\\"b_drop.png\\\" border=0></a></td>\";\r\n\t#data columns- \r\n foreach($a_rows as $key=>$value)\r\n\t{\r\n\t $temp_result.=\"\\n\\t<td visibility='hidden'>\".$value.\"</td>\";\r\n\t $temp_result.=\"\\n\\t\";\r\n\t $temp_result.='<td id='.$key.$value.' display=\"none\"><input type=\"text\" disabled value=\"'.$value.'\" size='.size_of($key);\r\n\t /* if($key==\"Rollno\")*/ $temp_result.=(' name='.parsekey($key).$i);\r\n\t $temp_result.=' ></td>';\r\n\t}\r\n $temp_result.=\"\\n</tr>\";\r\n }\r\n\r\n $temp_result.=\"\\n</table>\";\r\n $temp_result.=\"\\n</form>\";\r\n\r\n $temp_java_result='<SCRIPT type=text/javascript>\r\n\tfunction hide(obj)\r\n\t{\r\n\t\tif(obj.style.display==\"none\")obj.style.display=\"\";\r\n\t\telse obj.style.display=\"none\";\r\n\t}\r\n\tfunction enable(row,col)\r\n\t{\r\n//\t\talert(\"row=\"+row+\"col=\"+col);\r\n\t\tfor( i=row*col+row+1;i<row*col+col+row+1 ;i++ )\r\n\t\t{\r\n//\t\t\talert(\"i=\"+document.f1.elements[i].name);\r\n\t\t\tdocument.f1.elements[i].disabled=false;//abled();//=\"\";\r\n\t\t}\t\t';\r\n\r\n foreach($a_rows as $key=>$value)\r\n {\r\n $temp_java_result.=\"\\n\\t\\tcellname=eval(\\\"\".parsekey($key).\"\\\"+row);\";\r\n $temp_java_result.=\"\\n\\t\\tdocument.f1.cellname.enabled=on;\";\r\n }\r\n $temp_java_result.='\r\n\t}\r\n\t</SCRIPT>';\r\n \r\n $temp_result=$temp_java_result.$temp_result;\r\n return $temp_result;\r\n}", "public function write() {\n\t\t$table = '<table '.$this->addHTML.'>';\n\t\tif(!is_null($this->tableInfo['head'])) {\n\t\t\t$table .= '<thead><tr>';\n\t\t\tforeach($this->tableInfo['head'] as $value) {\n\t\t\t\t$table .= '<th>'.$value.'</th>';\n\t\t\t}\n\t\t\tif($this->crud) {\n\t\t\t\t\t$table .= '<th>Options</th>';\t\n\t\t\t}\n\t\t\t$table .= '</tr></thead>';\n\t\t}\n\t\t$table .= '<tbody>';\n\t\tif(isset($this->tableInfo['rows'])) {\n\t\t\tforeach($this->tableInfo['rows'] as $row) {\n\t\t\t\t$table .= '<tr>';\n\t\t\t\tforeach($row as $key => $column) {\n\t\t\t\t\tif(($key != $this->crud_id) OR $this->show_crud_id) {\n\t\t\t\t\t\t$table .= '<td>'.$column.'</td>';\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($this->crud && isset($row[$this->crud_id])) {\n\t\t\t\t\t$table .= '<td>';\n\t\t\t\t\t$table .= '<a href=\"'.$this->crudPath.'Details/'.$row[$this->crud_id].'\" title=\"Details\"><i class=\"fa fa-search\"></i></a> | ';\n\t\t\t\t\t$table .= '<a href=\"'.$this->crudPath.'Edit/'.$row[$this->crud_id].'\" title=\"Edit\"><i class=\"fa fa-wrench\"></i></a> | ';\n\t\t\t\t\t$table .= '<a href=\"'.$this->crudPath.'Delete/'.$row[$this->crud_id].'\" title=\"Delete\"><i class=\"fa fa-trash\"></i></a>';\n\t\t\t\t\t$table .= '</td>';\n\t\t\t\t}\n\t\t\t\t$table .= '</tr>';\n\t\t\t}\n\t\t} else {\n\t\t\t$table .= '<tr>';\n\t\t\t$table .= '<td>';\n\t\t\t$table .= 'No Data to show here.';\n\t\t\t$table .= '</td>';\n\t\t\t$table .= '</tr>';\t\n\t\t}\n\t\t\n\t\t$table .= '</tbody></table>';\n\t\treturn $table;\n\t}", "public function renderItems() {\n\n \t $caption = $this->renderCaption();\n \t $columnGroup = $this->renderColumnGroup();\n \t $tableHeader = $this->showHeader ? $this->renderTableHeader() : false;\n \t $tableBody = $this->renderTableBody();\n \t $tableFooter = $this->showFooter ? $this->renderTableFooter() : false;\n \t $content = array_filter([\n \t$caption,\n \t$columnGroup,\n \t$tableHeader,\n \t$tableFooter,\n \t$tableBody,\n \t ]);\n\n\t return self::html()->tag('table', array('options' => $this->tableOptions, 'content' => implode(\"\\n\", $content)), $this->tableOptions);\n }", "public function renderItems()\n {\n $content = array_filter([\n $this->renderCaption(),\n $this->renderColumnGroup(),\n $this->showHeader ? $this->renderTableHeader() : false,\n $this->showFooter ? $this->renderTableFooter() : false,\n $this->renderTableBody(),\n ]);\n\n $table = Html::tag('table', implode(\"\\n\", $content), $this->tableOptions);\n if ($this->responsive)\n {\n $table = Html::tag('div', $table, ['class' => 'table-responsive']);\n }\n else\n {\n $table = Html::tag('div', $table, ['class' => 'table-scrollable']);\n }\n\n return $table;\n }", "public function renderItems()\n {\n $caption = $this->renderCaption();\n $columnGroup = $this->renderColumnGroup();\n $tableHeader = $this->showHeader ? $this->renderTableHeader() : false;\n $tableBody = $this->renderTableBody();\n\n $tableFooter = false;\n $tableFooterAfterBody = false;\n\n if ($this->showFooter) {\n if ($this->placeFooterAfterBody) {\n $tableFooterAfterBody = $this->renderTableFooter();\n } else {\n $tableFooter = $this->renderTableFooter();\n }\n }\n\n $content = array_filter([\n $caption,\n $columnGroup,\n $tableHeader,\n $tableFooter,\n $tableBody,\n $tableFooterAfterBody,\n ]);\n\n return Html::tag('table', implode(\"\\n\", $content), $this->tableOptions);\n }", "public function render()\n\t{\n\t\t// convert json to PHP arrays\n\t\tif(!is_array($this->headers))\n\t\t\t$this->headers = $this->extract_json($this->headers);\n\t\tif(!is_array($this->data))\n\t\t\t$this->data = $this->extract_json($this->data);\n\n\t\t// generate a table of the appropriate type with sub-render method\n\t\t$table_html = $this->{\"render_$this->type\"}();\n\t\t\n\t\t// get the snippets directory if set\n\t\tif($this->snippets_dir && file_exists(\"$this->snippets_dir/table.php\"))\n\t\t\t$snippet = \"$this->snippets_dir/table.php\";\n\t\telse\n\t\t\t$snippet = __DIR__ . \"/snippets/table.php\";\n\t\t\n\t\t// build up the replacements array\n\t\t$replacements = array(\n\t\t\t'body' => $table_html,\n\t\t\t'class' => strlen($this->class)?\"class=\\\"$this->class\\\"\":'',\n\t\t\t'id' => strlen($this->id)?\"id=\\\"$this->id\\\"\":'',\n\t\t\t'caption' => strlen($this->caption)?\"<caption>$this->caption</caption>\":'',\n\t\t);\n\t\t\n\t\t$html = \\helpers\\html\\html::load_snippet($snippet, $replacements);\n\n\t\treturn $html;\n\t}", "function table($text) {\n\t\t$output = \"\";\n\t\tif (!empty($text)) {\n\t\t\t$output .= '<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" width=\"100%\">';\n\t\t\t$array = explode(\"\\n\", $text);\n\t\t\tfor ($i=0; $i<count($array); $i++) {\n\t\t\t\tif (!empty($array[$i])) {\n\t\t\t\t\t$row = explode(\":\", $array[$i], 2);\n\t\t\t\t\t$title = isset($row[0]) ? $row[0] : '';\n\t\t\t\t\t$data = isset($row[1]) ? $row[1] : '';\n\t\t\t\t\tif ($i%2 == 0) {\n\t\t\t\t\t\t$output .= '<tr class=\"row_ab_a\"><td class=\"form_title\" width=\"30%\">'.$title.'</td><td bgcolor=\"#EBF1F6\" width=\"70%\">'.$data.'</td></tr>';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$output .= '<tr class=\"row_ab_b\"><td class=\"form_title\">'.$title.'</td><td bgcolor=\"#FFFFFF\">'.$data.'</td></tr>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$output .= '</table>';\n\t\t}\n\n\t\treturn $output;\n\t}", "function Formitable(& $db, $table){\n\n\t\t//sniff for Netscape 4.x\n\t\tif( stristr(getenv(\"HTTP_USER_AGENT\"), \"Mozilla/4\") && !stristr(getenv(\"HTTP_USER_AGENT\"), \"compatible\" ) )\n\t\t\t$this->NS4 = true; else $this->NS4 = false;\n\n\t\t$this->_magic_quotes = get_magic_quotes_gpc();\n\n\t\t$this->db = $db;\n\n\t\t$this->formName = $this->table = $table;\n\n\t\t$this->fields = $this->db->execute(\"DESCRIBE $table \")\n\t\t\t\t\t\tor die(\"DB Form Connection Error \");\n\n\t\t$this->columns = count($this->fields);\n\n\t\t$this->pkey = \"\";\n\n\t\t$this->optionBreak = $this->labelBreak = \"<br/>\\n\";\n\n\t\t$this->fieldBreak = \"<br/>\\n\";\n\n\t\t$this->fieldSets = true;\n\n\t\t$this->feedback = \"both\";\n\n\t\t$this->mysql_errors = false;\n\n\t\t$this->hasFiles = false;\n\n\t\t$this->submitted = 0;\n\n\t\t$this->skipFields( array(\"formitable_signature\",\"formitable_multipage\",\"formitable_setcheck\",\"pkey\",\"submit\",\"x\",\"y\",\"MAX_FILE_SIZE\") );\n\n\t}", "protected function RenderTable()\n {\n if ($this->m_QueryONRender)\n if (!$this->_run_search($resultRecords, $this->m_ClearSearchRule))\n return $this->ProcessDataObjError($ok);\n\n $records = array();\n $records[] = $this->m_RecordRow->RenderColumn();\n $counter = 0;\n while (true) {\n if ($this->m_Range != null && $this->m_Range > 0 && $counter > $this->m_Range)\n break;\n if ($this->CanShowData())\n $arr = $resultRecords[$counter];\n if (!$arr)\n break;\n $this->m_RecordRow->SetRecordArr($arr);\n $tblRow = $this->m_RecordRow->Render();\n $records[] = $tblRow;\n $counter++;\n }\n return $records;\n }", "function prepareDefaultHeader()\n {\n $this->formatBuffer .= \"p.normalText, li.normalText, div.normalText{\\n\";\n $this->formatBuffer .= \" mso-style-parent: \\\"\\\";\\n\";\n $this->formatBuffer .= \" margin: 0cm;\\n\";\n $this->formatBuffer .= \" margin-bottom: 6pt;\\n\";\n $this->formatBuffer .= \" mso-pagination: widow-orphan;\\n\";\n $this->formatBuffer .= \" font-size: {$this->fontSize}pt;\\n\";\n $this->formatBuffer .= \" font-family: \\\"{$this->fontFamily}\\\";\\n\";\n $this->formatBuffer .= \" mso-fareast-font-family: \\\"{$this->fontFamily}\\\";\\n\";\n $this->formatBuffer .= \"}\\n\\n\";\n \n $this->formatBuffer .= \"table.normalTable{\\n\";\n $this->formatBuffer .= \" mso-style-name: \\\"Tabela com grade\\\";\\n\";\n $this->formatBuffer .= \" mso-tstyle-rowband-size: 0;\\n\";\n $this->formatBuffer .= \" mso-tstyle-colband-size: 0;\\n\";\n $this->formatBuffer .= \" border-collapse: collapse;\\n\";\n $this->formatBuffer .= \" mso-border-alt: solid windowtext {$this->tableBorderAlt}pt;\\n\";\n $this->formatBuffer .= \" mso-yfti-tbllook: 480;\\n\";\n $this->formatBuffer .= \" mso-padding-alt: 0cm {$this->tablePaddingAltRight}pt 0cm {$this->tablePaddingAltLeft}pt;\\n\";\n $this->formatBuffer .= \" mso-border-insideh: {$this->tableBorderInsideH}pt solid windowtext;\\n\";\n $this->formatBuffer .= \" mso-border-insidev: {$this->tableBorderInsideV}pt solid windowtext;\\n\";\n $this->formatBuffer .= \" mso-para-margin: 0cm;\\n\";\n $this->formatBuffer .= \" mso-para-margin-bottom: .0001pt;\\n\";\n $this->formatBuffer .= \" mso-pagination: widow-orphan;\\n\";\n $this->formatBuffer .= \" font-size: {$this->fontSize}pt;\\n\";\n $this->formatBuffer .= \" font-family: \\\"{$this->fontFamily}\\\";\\n\";\n $this->formatBuffer .= \"}\\n\";\n $this->formatBuffer .= \"table.normalTable td{\\n\";\n $this->formatBuffer .= \" border: solid windowtext 1.0pt;\\n\";\n $this->formatBuffer .= \" border-left: none;\\n\";\n $this->formatBuffer .= \" mso-border-left-alt: solid windowtext .5pt;\\n\";\n $this->formatBuffer .= \" mso-border-alt: solid windowtext .5pt;\\n\";\n $this->formatBuffer .= \" padding: 0cm 5.4pt 0cm 5.4pt;\\n\";\n $this->formatBuffer .= \"}\\n\\n\";\n \n $this->formatBuffer .= \"table.tableWithoutGrid{\\n\";\n $this->formatBuffer .= \" mso-style-name: \\\"Tabela sem grade\\\";\\n\";\n $this->formatBuffer .= \" mso-tstyle-rowband-size: 0;\\n\";\n $this->formatBuffer .= \" mso-tstyle-colband-size: 0;\\n\";\n $this->formatBuffer .= \" border-collapse: collapse;\\n\";\n $this->formatBuffer .= \" border: none;\\n\";\n $this->formatBuffer .= \" mso-border-alt: none;\\n\";\n $this->formatBuffer .= \" mso-yfti-tbllook: 480;\\n\";\n $this->formatBuffer .= \" mso-padding-alt: 0cm {$this->tablePaddingAltRight}pt 0cm {$this->tablePaddingAltLeft}pt;\\n\";\n $this->formatBuffer .= \" mso-border-insideh: {$this->tableBorderInsideH}pt solid windowtext;\\n\";\n $this->formatBuffer .= \" mso-border-insidev: {$this->tableBorderInsideV}pt solid windowtext;\\n\";\n $this->formatBuffer .= \" mso-para-margin: 0cm;\\n\";\n $this->formatBuffer .= \" mso-para-margin-bottom: .0001pt;\\n\";\n $this->formatBuffer .= \" mso-pagination: widow-orphan;\\n\";\n $this->formatBuffer .= \" font-size: {$this->fontSize}pt;\\n\";\n $this->formatBuffer .= \" font-family: \\\"{$this->fontFamily}\\\";\\n\";\n $this->formatBuffer .= \"}\\n\\n\";\n \n if ($this->cssFile != '') {\n if (file_exists($this->cssFile))\n $this->formatBuffer .= file_get_contents($this->cssFile);\n }\n }", "protected function _render()\n {\n $resultTRs = array();\n $resultTDs = array();\n $options = array();\n\n if (is_null($this->_paginator)) {\n FaZend_Exception::raise(\n 'FaZend_View_Helper_HtmlTable_MissedPaginatorParameter',\n \"Paginator must be set first\"\n );\n }\n\n foreach ($this->_paginator as $key=>$rowOriginal) {\n // convert ROW, if necessary. skip the ROW if false returned\n if (!$this->_convertColumnValue(false, true, $rowOriginal)) {\n continue;\n }\n\n // prepare one row for rendering, converting it to the ARRAY\n // type, no matter what was the original type.\n if (is_array($rowOriginal)) {\n $row = $rowOriginal;\n } elseif (is_object($rowOriginal)) {\n if (method_exists($rowOriginal, 'toArray')) {\n $row = $rowOriginal->toArray();\n } else {\n $row = array();\n }\n } else {\n $row = array('column'=>$rowOriginal);\n }\n\n // inject columns\n foreach ($this->_injectedColumns as $injectedColumn=>$predecessor) {\n // sanity check\n if (!is_object($rowOriginal)) {\n break;\n }\n\n // if it's a method - call it\n if ($injectedColumn == '__key') {\n $injectedValue = $key;\n } elseif (method_exists($rowOriginal, $injectedColumn)) {\n $injectedValue = $rowOriginal->$injectedColumn();\n } else {\n try {\n $injectedValue = $rowOriginal->$injectedColumn;\n } catch (Exception $e) {\n $injectedValue = $e->getMessage();\n }\n }\n\n $this->_inject($row, $injectedColumn, $predecessor, $injectedValue);\n }\n\n $resultTRs[] = sprintf(\n \"\\t<tr class='%s' onmouseover='this.className=\\\"highlight\\\"' \" .\n \"onmouseout='this.className=\\\"%s\\\"'%s>\\n\",\n (fmod(count($resultTRs), 2) ? 'even' : 'odd'),\n (fmod(count($resultTRs), 2) ? 'even' : 'odd'),\n $this->_formatColumnStyle(false, null, $rowOriginal)\n );\n\n if (!empty($this->_columnOrder)) {\n $row = $this->_orderColumns($row);\n }\n\n $tds = array();\n foreach ($row as $title=>$value) {\n $column = $this->_column($title);\n\n // maybe we should show only some particular columns\n if (!$this->_isVisible($title)) {\n continue;\n }\n\n // convert value, if necessary\n $value = $this->_convertColumnValue($title, $value, $rowOriginal);\n\n // attach link to the TD\n if ($column->link) {\n $value = $this->_resolveLink($column->link, $value, $rowOriginal, $key);\n }\n\n // append CSS style\n $tds[$title] = sprintf(\n \"\\t\\t<td%s>%s\",\n $this->_formatColumnStyle($title, $value, $rowOriginal),\n $value\n );\n }\n\n if (count($this->_options)) {\n $optString = \"\\t\\t<td>\";\n foreach ($this->_options as $option) {\n // skip the option\n if ($option->skip) {\n if ($option->skip->call($rowOriginal, $key)) {\n continue;\n }\n }\n\n // build the <A HREF> link for this option\n $optLink = $this->_optionsSeparator .\n $this->_resolveLink($option->link, $option->title, $rowOriginal, $key);\n\n // attach this option to the particular column\n if ($option->toColumn) {\n $tds[$option->toColumn] .= ' ' . $optLink;\n } else {\n $optString .= $optLink;\n }\n }\n $options[] = $optString;\n }\n $resultTDs[] = $tds;\n }\n\n // if no data in the paginator\n if (!count($resultTDs)) {\n return $this->_noDataMessage;\n }\n\n // build the header using the last ROW information\n $header = \"\\t<tr><!-- header -->\\n\";\n foreach ($row as $title=>$value) {\n if (!$this->_isVisible($title)) {\n continue;\n }\n\n // rename the column\n if ($this->_column($title)->title) {\n $title = $this->_column($title)->title;\n }\n\n $header .= \"\\t\\t<th>{$title}</th>\\n\";\n }\n\n // add header column for OPTIONS\n if (count($this->_options)) {\n $header .= \"\\t\\t<th>\" . _t('Options') . \"</th>\\n\";\n }\n $header .= \"\\t</tr>\\n\";\n\n $html = \"\\n<table>\\n\" . $header;\n foreach ($resultTRs as $tr=>$line) {\n $html .=\n $line .\n implode(\n \"</td>\\n\",\n array_merge(\n $resultTDs[$tr],\n isset($options[$tr]) ? array($options[$tr]) : array()\n )\n ) .\n \"</td>\\n\\t</tr>\\n\";\n }\n\n return $html . \"</table>\\n\";\n }", "protected function renderTable($results, $formOpts) { \n $html = \"\"; \n $html .= Xml::openElement( 'p' ); \n $html .= 'Brief table explanation for users.'; #html text displayed with the table\n $html .= Xml::closeElement( 'p' );\n\t\t$html .= Xml::openElement( \n\t\t\t\t\t'table',\n\t\t\t\t\tarray( \n\t\t\t\t\t\t'id' => 'data display',\n\t\t\t\t\t\t'class' => 'dataTable OMP_annotation_table tableEdit',\n\t\t\t\t\t\t'border' => 1\n\t\t\t\t\t)\n\t\t\t\t); \t\t \t\n\t\t\n\t\tswitch($formOpts){\n \tcase '0':\n\t\t\t\t// make the headings\n\t\t\t\t$headings = array('column 1 heading','column 2 heading','column 3 heading');\n\t\t\t\t$html .= self::make_table_header($headings); \n\t \n\t\t\t\t// make the body\n\t\t\t\t$html .= Xml::openElement( 'tbody' );\n\t\t\t\tforeach($results as $x){\n\t\t\t\t\t$html .= \"<tr><td>$x->database_query_column_1</td><td>$x->database_query_column_2</td><td>$x->database_query_column_3</td></tr>\";\n\t\t\t\t}\t\n\t\t\t\tbreak;\t\n \tcase '1':\n\t\t\t\t#same as case 0\n\t\t\t\tbreak;\t\n\t\t\tcase '2':\n\t\t\t\t#same as case 0\n\t\t\tdefault:\n\t\t}\n\t\t\t#closing table body and table\n\t\t\t$html .= Xml::closeElement( 'tbody' );\n\t\t\t$html .= Xml::closeElement( 'table' ); \n\t\t\treturn $html; #display table\n\t}", "function table_display($table)\n{\n $out = '';\n $out = '<style> td,th{border: solid 2px black;}</style>';\n if (count($table) == 0) {\n //table is empty\n return 'table is empty';\n }\n $out .= '<table>';\n\n //table header\n $col_names = array_keys($table[0]);\n $out .= '<tr>';\n foreach ($col_names as $col_name) {\n $out .= '<th>'.$col_name.'</th>';\n }\n $out .= '</tr>';\n //table data\n $out .= '</tr>';\n foreach ($table as $one_row) {\n $out .= '<tr>';\n foreach ($one_row as $key => $col_name) {\n if ($key == 'price' and gettype($key) != 'integer') {\n $out .= '<td> $'.$col_name.' </td>';\n } else {\n $out .= '<td>'.$col_name.' </td>';\n }\n }\n $out .= '</tr>';\n }\n $out .= '</table>';\n\n return $out;\n}", "function generateTable($widths, $headers, $values)\n{\n\t$theTable = \"<table width=\\\"100%\\\">\\n\";\n\t$theTable = $theTable . \"<tr>\"; \n\n\t$table_column_width = \"\";\n\t$rowcounter = 0;\n\n\tforeach ( $headers as $table_cell )\n\t{ \n\t\tif ($widths != null)\n\t\t{\n\t\t\t$table_column_width = \" width=\\\"\".$widths[$rowcounter].\"\\\"\";\n\t\t}\n\n\t\t$theTable = $theTable . \"<th class=\\\"tdHeader\\\"\".$table_column_width.\">$table_cell</th>\";\n\t\t$rowcounter++;\n\t} \n\n\t$theTable = $theTable . \"</tr>\\n\\t<tr>\";\n\n\t$count = count( $headers );\n\t$rowcounter = 0;\n\t$table_odd = \"1\";\n\n\tforeach ( $values as $table_value )\n\t{\n\t\tif ($rowcounter == $count) \n\t\t{\n\t\t\t$theTable = $theTable . \"</tr>\\n<tr>\";\n\t\t\t$rowcounter = 0;\n\t\t\tif ($table_odd == \"1\") \n\t\t\t{\n\t\t\t\t$table_odd = \"0\";\n\t\t\t} else\n\t\t\t{\n\t\t\t\t$table_odd = \"1\";\n\t\t\t}\n\t\t}\n\t\tif ($table_odd == \"1\") \n\t\t{\n\t\t\t$table_class = \"tdOdd\";\n\t\t} else\n\t\t{\n\t\t\t$table_class = \"tdEven\";\n\t\t}\n\n\t\t$theTable = $theTable . \"<td class=\\\"$table_class\\\" valign=\\\"top\\\">$table_value</td>\";\n\t\t$rowcounter++;\n\t}\n\t$theTable = $theTable . (\"</tr>\\n</table>\\n\");\n\treturn $theTable;\n}", "function getTable($array, $firstLineHeader = true, $lastLineFooter = true, $withTableStructure = true)\n{\n\t$ret = '';\n\n\t$rows = count($array);\n\t$cols = isset($array[0]) ? count($array[0]) : 0;\n\t$i = 0;\n\n\tif($firstLineHeader)\n\t{\n\t\t$ret .= '<tr class=\"tableHeaderRow\">';\n\t\tfor($j = 0; $j < $cols; $j++)\n\t\t{\n\t\t\tif($j == ($cols - 1))\n\t\t\t\t$ret .= '<td class=\"tableHeaderCellR\">';\n\t\t\telse if($j == 0)\n\t\t\t\t$ret .= '<td class=\"tableHeaderCellL\">';\n\t\t\telse\n\t\t\t\t$ret .= '<td class=\"tableHeaderCell\">';\n\n\t\t\t$ret .= $array[$i][$j] . '</td>' . \"\\n\";\n\t\t}\n\t\t$ret .= '</tr>' . \"\\n\";\n\n\t\t$i++;\n\t}\n\n\tfor(; $i < $rows; $i++)\n\t{\n\t\t$ret .= '<tr class=\"tableRow\">';\n\t\tfor($j = 0; $j < $cols; $j++)\n\t\t{\n\t\t\tif($j == ($cols - 1))\n\t\t\t{\n\t\t\t\tif($i == ($rows - 1) && $lastLineFooter)\n\t\t\t\t\t$ret .= '<td class=\"tableCellBR\">';\n\t\t\t\telse if($i == 0)\n\t\t\t\t\t$ret .= '<td class=\"tableCellTR\">';\n\t\t\t\telse\n\t\t\t\t\t$ret .= '<td class=\"tableCellR\">';\n\t\t\t}\n\t\t\telse if($j == 0)\n\t\t\t{\n\t\t\t\tif($i == ($rows - 1) && $lastLineFooter)\n\t\t\t\t\t$ret .= '<td class=\"tableCellBL\">';\n\t\t\t\telse if($i == 0)\n\t\t\t\t\t$ret .= '<td class=\"tableCellTL\">';\n\t\t\t\telse\n\t\t\t\t\t$ret .= '<td class=\"tableCellL\">';\n\t\t\t}\n\t\t\telse if($i == ($rows - 1) && $lastLineFooter)\n\t\t\t\t$ret .= '<td class=\"tableCellB\">';\n\t\t\telse if($i == 0)\n\t\t\t\t$ret .= '<td class=\"tableCellT\">';\n\t\t\telse\n\t\t\t\t$ret .= '<td class=\"tableCell\">';\n\n\t\t\t$ret .= $array[$i][$j] . '</td>' . \"\\n\";\n\t\t}\n\t\t$ret .= '</tr>' . \"\\n\";\n\t}\n\n\tif($withTableStructure)\n\t\t$ret = '<p/><table class=\"tableMain\">' . $ret . '</table>';\n\n\treturn $ret;\n}", "function WriteTable($tcolums)\n {\n for ($i = 0; $i < sizeof($tcolums); $i++)\n {\n $current_col = $tcolums[$i];\n $height = 0;\n \n // get max height of current col\n $nb=0;\n for($b = 0; $b < sizeof($current_col); $b++)\n {\n // set style\n $this->SetFont($current_col[$b]['font_name'], $current_col[$b]['font_style'], $current_col[$b]['font_size']);\n $color = explode(\",\", $current_col[$b]['fillcolor']);\n $this->SetFillColor($color[0], $color[1], $color[2]);\n $color = explode(\",\", $current_col[$b]['textcolor']);\n $this->SetTextColor($color[0], $color[1], $color[2]); \n $color = explode(\",\", $current_col[$b]['drawcolor']); \n $this->SetDrawColor($color[0], $color[1], $color[2]);\n $this->SetLineWidth($current_col[$b]['linewidth']);\n \n $nb = max($nb, $this->NbLines($current_col[$b]['width'], $current_col[$b]['text'])); \n $height = $current_col[$b]['height'];\n } \n $h=$height*$nb;\n \n \n // Issue a page break first if needed\n $this->CheckPageBreak($h);\n \n // Draw the cells of the row\n for($b = 0; $b < sizeof($current_col); $b++)\n {\n $w = $current_col[$b]['width'];\n $a = $current_col[$b]['align'];\n \n // Save the current position\n $x=$this->GetX();\n $y=$this->GetY();\n \n // set style\n $this->SetFont($current_col[$b]['font_name'], $current_col[$b]['font_style'], $current_col[$b]['font_size']);\n $color = explode(\",\", $current_col[$b]['fillcolor']);\n $this->SetFillColor($color[0], $color[1], $color[2]);\n $color = explode(\",\", $current_col[$b]['textcolor']);\n $this->SetTextColor($color[0], $color[1], $color[2]); \n $color = explode(\",\", $current_col[$b]['drawcolor']); \n $this->SetDrawColor($color[0], $color[1], $color[2]);\n $this->SetLineWidth($current_col[$b]['linewidth']);\n \n $color = explode(\",\", $current_col[$b]['fillcolor']); \n $this->SetDrawColor($color[0], $color[1], $color[2]);\n \n \n // Draw Cell Background\n $this->Rect($x, $y, $w, $h, 'FD');\n \n $color = explode(\",\", $current_col[$b]['drawcolor']); \n $this->SetDrawColor($color[0], $color[1], $color[2]);\n \n // Draw Cell Border\n if (substr_count($current_col[$b]['linearea'], \"T\") > 0)\n {\n $this->Line($x, $y, $x+$w, $y);\n } \n \n if (substr_count($current_col[$b]['linearea'], \"B\") > 0)\n {\n $this->Line($x, $y+$h, $x+$w, $y+$h);\n } \n \n if (substr_count($current_col[$b]['linearea'], \"L\") > 0)\n {\n $this->Line($x, $y, $x, $y+$h);\n }\n \n if (substr_count($current_col[$b]['linearea'], \"R\") > 0)\n {\n $this->Line($x+$w, $y, $x+$w, $y+$h);\n }\n \n \n // Print the text\n $this->MultiCell($w, $current_col[$b]['height'], $current_col[$b]['text'], 0, $a, 0);\n \n // Put the position to the right of the cell\n $this->SetXY($x+$w, $y); \n }\n \n // Go to the next line\n $this->Ln($h); \n } \n }" ]
[ "0.6399164", "0.61847943", "0.60661876", "0.60565466", "0.6054906", "0.6051843", "0.6020196", "0.5928422", "0.59245217", "0.5892703", "0.5882187", "0.58610725", "0.58340937", "0.580906", "0.58048266", "0.57858014", "0.57260275", "0.5702808", "0.56300515", "0.56246614", "0.5620623", "0.5608752", "0.5603377", "0.55816615", "0.5576366", "0.55758333", "0.5554111", "0.5541067", "0.5538935", "0.55180955" ]
0.7178585
0
Display the matches (in stdout)
public function displayMatches() { echo "<h1>List of matches found</h1>"; print_r($this->matches); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function process_matches(&$output, &$match)\n\t{\n\t\tif (sizeof($match) > 0)\n\t\t{\n\t\t\t$data = implode(\"\\n\", $match);\n\t\t\tarray_unshift($output, new vB_Text_Diff_Entry($data, $data));\n\t\t}\n\n\t\t$match = array();\n\t}", "public function getAllMatches() {\n return $this->matches;\n }", "public function getResultString()\n {\n return \"(match {$this->pattern})\" . ( $this->default !== null ? \" [{$this->default}]\" : \"\" );\n }", "public function showTestResults() {\n echo \"Tests: {$this->tests}\\n\";\n echo \"Pass: {$this->pass}\\n\";\n echo \"Fail: {$this->fail}\\n\";\n }", "public function getMatch();", "function GetAllMatches()\n {\n return $this->all_matches;\n }", "public function show(Match $match)\n {\n //\n }", "public function show(Match $match)\n {\n //\n }", "public function getMatches() {\n\n\t\treturn $this->_matches;\n\t}", "function macro_grep($args) {\n $regexp = getattr($args, 'regexp');\n $substr = getattr($args, 'substr');\n $page = getattr($args, 'page');\n\n if (!$substr && !$regexp) {\n return macro_error('Expecting parameter `substr` or `regexp`');\n }\n if ($substr && $regexp) {\n return macro_error(\"Parameters `substr` and `regexp` can't be used together\");\n }\n if (!$page) {\n return macro_error('Expecting parameter `page`');\n }\n\n if (!identity_can('macro-grep', $args)) {\n return macro_permission_error();\n }\n\n if ($substr) {\n $textblocks = textblock_grep($substr, $page, false);\n } else {\n $textblocks = textblock_grep($regexp, $page, true);\n }\n $textblocks_good = array();\n foreach ($textblocks as $textblock) {\n if (identity_can(\"textblock-view\", $textblock)) {\n $textblocks_good[] = $textblock;\n }\n }\n\n ob_start();\n?>\n<div class=\"macroToc\">\n<p><strong><?= count($textblocks_good) ?></strong> rezultate.</p>\n<ul>\n<?php foreach ($textblocks_good as $textblock) { ?>\n <li><?= format_link(url_textblock($textblock['name']), $textblock['title']) ?></li>\n<?php } ?>\n</ul>\n</div>\n<?php\n $buffer = ob_get_clean();\n\n return $buffer;\n}", "public function returnMatches()\n {\n $user = UserAccountController::getCurrentUser();\n if ($user === null) {\n return;\n }\n // get the q parameter from URL\n $q = $_GET['search'];\n if ($q === null) {\n $q = \"\";\n }\n $products = (new ProductListModel())->findProductsWithSimilarName($q, 100);\n $tableData = new View('productsTableBody');\n $tableData->addData('products', $products);\n echo $tableData->render();\n }", "public function getRawMatches()\n {\n return $this->rawMatches;\n }", "public function printResults() {\n $assertions = $this->getAssertions();\n $failures = $this->getFailures();\n $errors = $this->getErrors();\n return \"Assertions: \" . $assertions . \", Failures: \" . $failures . \" and \" . $errors . \" errors.\";\n }", "public function runMatch()\n {\n }", "public function getMatcher();", "protected function textMatch()\n {\n $string = 'matches expected JSON structure ';\n\n switch ($this->_matchType) {\n case self::MATCH_OR:\n $string .= 'at least in one element';\n break;\n case self::MATCH_EXACT:\n $string .= 'exactly';\n break;\n case self::MATCH_AND:\n default:\n $string .= 'in all expected elements';\n break;\n }\n\n return $string;\n }", "public function matchedDocs()\n {\n return $this->_resVector;\n }", "public function matches() {\n return response()->json($this->listMatches());\n }", "function print_results() {\r\n if ($list = $this->print_list()) {\r\n echo '<p>' . $this->print_count() . '</p>';\r\n echo $list;\r\n echo '<p class=\"more\">' . $this->print_more() . '</p>';\r\n }\r\n else {\r\n echo $this->zero_results;\r\n }\r\n }", "public function showResults()\n {\n $tracker = Tracker::getInstance();\n\n $tracker->outputStats();\n if (count($tracker->getFailures())) {\n $tracker->output(\"\\nFAILURES\\n\", null, null, true);\n $tracker->outputFailures();\n }\n\n if (count($tracker->getErrors())) {\n $tracker->output(\"\\nERRORS\\n\");\n $tracker->outputErrors();\n }\n\n $tracker->output(\"\\n\");\n\n if (count($tracker->getFailures())) {\n return;\n }\n\n if ($this->coverageDirectory()) {\n $tracker->output('Generating coverage report as html...' . \"\\n\");\n $this->_generateCoverageHtml();\n return $tracker->output('Done' . \"\\n\");\n }\n\n if ($this->showCoverage()) {\n $this->_generateCoverageCommandLine();\n return;\n }\n }", "public function seeOutput($regex)\n {\n if (empty($this->commandTester)) {\n throw new \\RuntimeException('You need to call runTheCommand() before checking the output');\n }\n\n $this->assertRegExp('/'.preg_quote($regex, '/').'/', $this->commandTester->getDisplay());\n }", "public function matches(): View\n {\n $matchList = Match::all();\n return view('admin/matches/index', compact('matchList'));\n }", "function test($banner, $pattern, $name)\n{\n\t$output = \"<table>\\n\";\t\n\t$output .= \"<tr><td colspan=3><i>$banner</i></td></tr>\\n\";\n\t$output .= '<tr>';\n\t$output .= '<td><u>Pattern</u> --></td>';\n\t$output .= '<td width=\"10px\">&nbsp;</td>';\n\t$output .= \"<th align=\\\"left\\\">$pattern</th></tr>\\n\";\n\tforeach($name as $item) {\n\t\tif (preg_match($pattern, $item)) {\n\t\t\t$match = 'MATCH';\n\t\t} else {\n\t\t\t$match = 'DOES NOT MATCH';\n\t\t}\n\t\t$output .= \"<tr><td width='50%'>$item</td><td width='10%'>&nbsp;</td><td>$match</td></tr>\\n\";\n\t}\n\t$output .= \"</table>\\n\";\n\t$output .= \"<hr />\\n\";\n\treturn $output;\n}", "public function ViewResults() {\n echo \"<pre>\" . print_r($this->rs, TRUE) . \"</pre>\";\n }", "public function getMatches() : array\n {\n return $this->getFilesystemLoader()->getMatches();\n }", "public function providerMatches()\n {\n return array(\n array('24 - 5x01 (HR.HDTV).avi', 5, 1),\n array('3rd Rock from the Sun - 1x01 - Brains and Eggs.avi', 1, 1),\n array('American Dad! - 1x01 - Pilot (pdtv).avi', 1, 1),\n array('The X Factor - 1x02 - Mooman (ll).avi',1,2),\n );\n }", "public function testExactMatchWithExpectationBeforeOutput() {\n\t\t$this->expectOutputContains( 'foobar' );\n\t\techo 'foobar';\n\t}", "public function getAllMatches()\n {\n return $this->_blocksMatch;\n }", "public function testExactMatchWithExpectationAfterOutput() {\n\t\techo 'foobar';\n\t\t$this->expectOutputContains( 'foobar' );\n\t}", "public function matches( Match_Target $target );" ]
[ "0.6026635", "0.58803254", "0.56374884", "0.55848897", "0.5584837", "0.5574421", "0.55723363", "0.55723363", "0.55261034", "0.5499175", "0.54970646", "0.5496352", "0.5451071", "0.54450196", "0.54265743", "0.54236233", "0.5394202", "0.53872496", "0.53837067", "0.53325796", "0.53261566", "0.53241044", "0.53181773", "0.53137165", "0.53064567", "0.530545", "0.5302906", "0.52977115", "0.52835256", "0.5235234" ]
0.77459764
0
Loads a given git command, or throws an informative exception if such a command cannot be loaded.
public static function loadCommand($command) { // Check to see if command has already been loaded; if not, do our checks. if (empty(self::$commands[$command])) { // Check to see if it is an excluded command; if so, throw an exception. if (in_array($command, self::$excludedCommands)) { throw new CLIGitExcludedCommandException($command); } if (!is_file(CLIGIT_SRC . "/commands/$command.inc")) { throw new CLIGitUnknownCommandException($command); } // Now ready to include the file. require_once CLIGIT_SRC . "/commands/$command.inc"; // Store a reflected copy of the class in our registry array for later // checking. self::$commands[$command] = new ReflectionClass($command); } return self::$commands[$command]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCommand(string $command);", "abstract protected function getGitCommand(): string;", "private function runGitCommand($command)\n {\n $path = dirname($this->file);\n $process = new Process($command, $path);\n\n if (0 === $process->run()) {\n return trim($process->getOutput());\n }\n\n throw new RuntimeException(\n sprintf(\n 'The tag or commit hash could not be retrieved from \"%s\": %s',\n $path,\n $process->getErrorOutput()\n )\n );\n }", "private function executeGitCommand($command) {\n\n $args = func_get_args();\n $site = $this->site;\n\n $args[0] = $site['git binary'] . ' ' . $args[0];\n $command = call_user_func_array('sprintf', $args);\n $site['log']('Executing `' . $command . '`.');\n\n $process = $site['process']($command);\n $process->setWorkingDirectory($site['site.code_directory']);\n if (!$site['simulate']) {\n // Git operations can run long, set our timeout to an hour.\n $process->setTimeout(3600);\n $shortCommand = implode(' ', array_splice(explode(' ', $command), 0, 2));\n $process->run(function ($type, $buffer) use ($shortCommand) {\n if ($type === 'err') {\n fwrite(STDERR, ' ' . $shortCommand . ' stderr: ' . $buffer);\n }\n else {\n fwrite(STDOUT, ' ' . $shortCommand . ' stdout: ' . $buffer);\n }\n });\n\n if (!$process->isSuccessful()) {\n throw new \\Exception('Executing Git command failed: `' . $command . '`. Git responded with: ' . $process->getErrorOutput() . ' ' . $process->getOutput());\n }\n }\n\n return $process->isSuccessful();\n }", "function loadCommand($name) {\n $path = sprintf(\n '%s/php/Terminus/Commands/%sCommand.php',\n TERMINUS_ROOT,\n ucwords($name)\n );\n\n if (is_readable($path)) {\n include_once $path;\n }\n}", "public function exec($command)\n {\n try {\n return $this->git->exec($command);\n } catch (GitException $e) {\n throw new GitCommandException($this, $e->getMessage(), $e->getCode(), $e);\n }\n }", "private function runGitCommand($baseFile, $command)\n {\n $path = dirname($baseFile);\n $process = new Process($command, $path);\n\n if (0 === $process->run()) {\n return trim($process->getOutput());\n }\n\n throw new \\RuntimeException(\n sprintf(\n 'The tag or commit hash could not be retrieved from \"%s\": %s',\n $path,\n $process->getErrorOutput()\n )\n );\n }", "public function testCanRetrieveMainCommand()\n {\n $mainCommand = 'git';\n $command = $this->createInstance($mainCommand);\n $this->assertSame($mainCommand, $command->getMainCommand(), 'Main command must be retrievable');\n }", "public function command(Command $command);", "public static function get($commandName, Config $config)\n {\n $instance = null;\n $commandName = ucwords(str_replace('-', ' ', $commandName));\r\n $commandName = str_replace(' ', '', $commandName);\n\n $commandName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $commandName)));\n $className = 'Mage\\\\Command\\\\BuiltIn\\\\' . $commandName . 'Command';\n if (Autoload::isLoadable($className)) {\n $instance = new $className;\n $instance->setConfig($config);\n } else {\n throw new Exception('Command not found.');\n }\n\n if(!($instance instanceOf AbstractCommand)) {\n throw new Exception('The command ' . $commandName . ' must be an instance of Mage\\Command\\AbstractCommand.');\n }\n\n return $instance;\n }", "public function execute($cmd)\n\t{\n\t\tif (!is_array($cmd))\n\t\t{\n\t\t\t$cmd = array($cmd);\n\t\t}\n\n\t\tarray_unshift($cmd, 'git');\n\t\t$cmd = self::processCommand($cmd);\n\n\t\t$this->begin();\n\t\texec($cmd . ' 2>&1', $output, $ret);\n\t\t$this->end();\n\n\t\tif ($ret !== 0)\n\t\t{\n\t\t\tthrow new ExtendedGitException(\"Command '$cmd' failed (exit-code $ret).\", $ret, NULL, $output); // ONLY THIS LINE IS MODIFIED\n\t\t}\n\n\t\treturn $output;\n\t}", "public function loadSubcommand($subcommand, $parent)\n {\n $parent_class = get_class($parent);\n $class = '\\\\' . $parent_class . '\\\\' . $this->translate($subcommand);\n return $this->loadClass($class);\n }", "public function resolve(Command $command);", "private function ensureCommandExists($command)\n {\n if (!$this->hasCommand($command)) {\n throw new CommandNotFound($command, $this->commands);\n }\n }", "private function prepareRepository($command)\n\t{\n\t\t$model = $this->getModel()->getApplication();\n\t\tif (preg_match('~([\\w-]+\\s+\\')([^\\']+)(\\'.*)~',\t$command, $matches)) {\n\t\t\treturn $model->getRepositoryPath() . '/' . trim($matches[2], ' \\\\/');\n\t\t}\n\t\tthrow new \\RuntimeException('V příkazu není uvedena cesta k repozitáři.');\n\t}", "protected function checkAndGet($command, $key, $required=TRUE) {\n if (!isset($command[$key]) and $required) {\n throw new Exception(\"Expected key '$key' does not exist within command.\");\n }\n return $command[$key];\n }", "public function load($cmd, $model = null, $args = array())\n\t{\n\t\t// If $model is null we use the default model\n\t\t$model = $this->getModel($model);\n\n\t\t// First check to make sure the model requested exists\n\t\tif (!$model)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\n\t\t// Model exists, let's build the method name\n\t\t$method = 'get' . ucfirst($cmd);\n\n\t\t// Does the method exist?\n\t\tif (!method_exists($model, $method))\n\t\t{\n\t\t\t$method = 'load' . ucfirst($cmd);\n\t\t}\n\n\t\t// The method exists, let's call it and return what we get\n\t\t$result = call_user_func_array(array($model, $method), $args);\n\n\t\treturn $result;\n\t}", "public function loadCommand(string ...$commands): void\n {\n if (!$this->app->runningInConsole()) {\n return;\n }\n\n $this->commands($commands);\n }", "public function __construct($command)\n {\n $this->command = $command;\n }", "private function git($command)\n {\n $current_directory = getcwd();\n chdir($this->base_path);\n $output = trim(shell_exec(sprintf('%s %s', 'git', $command)));\n chdir($current_directory);\n\n return $output;\n }", "public function resolveCommand(CommandContract|string $command, ?ResponseObject $update = null): ?CommandContract\n {\n if ($command instanceof CommandContract) {\n return $command;\n }\n\n $command = $this->commands[strtolower($command)] ?? $command;\n\n if (is_object($command)) {\n return $this->validateCommandClassInstance($command);\n }\n\n if (! class_exists($command)) {\n $this->dispatchCommandNotFoundEvent($command, $update);\n\n if (array_key_exists('help', $this->commands)) {\n $command = $this->commands['help'];\n } else {\n return null;\n }\n }\n\n try {\n $command = $this->bot->getContainer()->make($command);\n } catch (BindingResolutionException $e) {\n throw TelegramCommandException::commandNotInstantiable($command, $e);\n }\n\n return $this->validateCommandClassInstance($command);\n }", "public function cmd($commandName, $ctrArg = null) {\n\t\t$className = 'libhg_Command_'.ucfirst(strtolower($commandName)).'_Cmd';\n\n\t\tif (!class_exists($className)) {\n\t\t\tthrow new libhg_Exception('Could not find class \"'.$className.'\" for \"'.$commandName.'\" command.');\n\t\t}\n\n\t\tif ($ctrArg === null) {\n\t\t\t$cmd = new $className();\n\t\t}\n\t\telse {\n\t\t\t$cmd = new $className($ctrArg);\n\t\t}\n\n\t\t$client = $this->getClient()->setRepository($this);\n\n\t\treturn $cmd->setClient($client);\n\t}", "public function fastImport($commands, $options = array()) {\n $options = array_merge($this->default_options, $options);\n\n if (empty($options['export-marks'])) {\n $options['export-marks'] = tempnam(sys_get_temp_dir(), 'git-marks');\n }\n\n $command = $this->buildCommandLine($options);\n // The file descriptor array for the fast-import process. The read and write\n // specifications are from the view of git-fast-import.\n $descriptorspec = array(\n 0 => array(\"pipe\", \"r\"), // stdin\n 1 => array(\"pipe\", \"w\"), // stdout\n 2 => array(\"pipe\", \"w\"), // stderr\n );\n\n $proc = proc_open($command, $descriptorspec, $pipes, $this->path);\n if (!is_resource($proc)) {\n throw new Exception('Failed to open git process.');\n }\n\n $proc_in = $pipes[0];\n $proc_out = $pipes[1];\n $proc_err = $pipes[2];\n foreach ($commands as $command) {\n $cmd_type = $this->checkAndGet($command, 'command');\n $funcname = 'handle_'. $cmd_type .'_command';\n switch ($cmd_type) {\n case 'commit':\n case 'tag':\n case 'reset':\n case 'blob':\n case 'checkpoint':\n case 'progress': {\n fwrite($proc_in, call_user_func(array($this, $funcname), $command));\n fflush($proc_in);\n }\n break;\n default:\n throw new Exception(\"Unknown command type: \". $command['command']);\n }\n }\n fclose($proc_in);\n $stdout_result = stream_get_contents($proc_out);\n $stderr_result = stream_get_contents($proc_err);\n\n fclose($proc_out);\n fclose($proc_err);\n $ret_val = proc_close($proc);\n $marks = self::readMarksFile($options['export-marks']);\n\n // Clean up temporary file.\n unlink($options['export-marks']);\n\n return array($ret_val, $marks, $stdout_result, $stderr_result);\n }", "public function run($command) {\n\t\t\treturn shell_exec($this->command_prefix.Git::get_bin() . \" \" . $command . ' 2>&1');\n\t\t}", "public function addCommand($command);", "protected function load_extends( array $args = null, array $assoc_args = null ) {\n\t\tif ( null !== $args && null !== $assoc_args ) {\n\t\t\t$this->args = $args;\n\t\t\t$this->assoc_args = $assoc_args;\n\t\t}\n\n\t\tif ( empty( $this->args ) ) {\n\t\t\t// No sub command given.\n\t\t\t$this->call();\n\t\t\treturn;\n\t\t} else {\n\t\t\t// First, make sure that <command> exists.\n\t\t\t$command_string = array_shift( $this->args );\n\t\t\t$command_class_string = Utils::get_command_class_string( $command_string );\n\n\t\t\t// Instantiate command class.\n\t\t\ttry {\n\t\t\t\t// Command namespace.\n\t\t\t\t$command_fully_qualified_class = \"{$this->get_extended_namespace()}\\\\{$command_class_string}\";\n\n\t\t\t\t// AbstractCommands are inside their own directory.\n\t\t\t\tif ( ! ( $this instanceof AbstractSubCommand ) ) {\n\t\t\t\t\t$command_fully_qualified_class .= \"\\\\{$command_class_string}\";\n\t\t\t\t}\n\n\t\t\t\t// Dynamically call the class responsible for the command and sub command.\n\t\t\t\t$sub_command = new $command_fully_qualified_class();\n\n\t\t\t\tif ( $sub_command instanceof ExtensibleInterface ) {\n\t\t\t\t\t$sub_command->load_extends( $this->args, $this->assoc_args );\n\t\t\t\t} elseif ( $sub_command instanceof CallableInterface ) {\n\t\t\t\t\t$sub_command->call();\n\t\t\t\t} else {\n\t\t\t\t\tthrow new \\TypeError();\n\t\t\t\t}\n\t\t\t} catch ( \\TypeError $type_error ) {\n\t\t\t\t\\WP_CLI::error( $command_class_string . ' is not a command.' );\n\t\t\t} catch ( \\Throwable $throwable ) {\n\t\t\t\t/**\n\t\t\t\t * TODO Error logs can be improved.\n\t\t\t\t *\n\t\t\t\t * It should show something like.\n\t\t\t\t *\n\t\t\t\t * <non-existent-subcommand> sub command not found!\n\t\t\t\t * <non-existent-subcommand> <non-existent-arg> arg not found!\n\t\t\t\t */\n\t\t\t\t\\WP_CLI::error( \"'{$command_string}' sub command not found!\" );\n\t\t\t}\n\t\t}\n\t}", "public function testCanPassCommandStringToConstructor()\n {\n $command = new Command('/bin/ls -l');\n\n $this->assertEquals('/bin/ls -l', $command->getExecCommand());\n }", "protected function resolveCommand($command)\n {\n if (! class_exists($command)) {\n return $this->getApplication()->find($command);\n }\n\n $command = $this->laravel->make($command);\n\n if ($command instanceof SymfonyCommand) {\n $command->setApplication($this->getApplication());\n }\n\n if ($command instanceof self) {\n $command->setLaravel($this->getLaravel());\n }\n\n return $command;\n }", "public function command($command)\n {\n return $this->exec(PHP_BINARY . ' ' . $this->yiiCliEntryPoint . ' ' . $command);\n }", "private function __construct($command = null)\n {\n $this->command = $command;\n }" ]
[ "0.6075108", "0.5926321", "0.587538", "0.5646386", "0.5596301", "0.5428948", "0.5323745", "0.5267764", "0.51087785", "0.50897366", "0.5089615", "0.5085852", "0.5067194", "0.5038133", "0.50078964", "0.4954108", "0.49481094", "0.49432927", "0.4932581", "0.4920479", "0.4911014", "0.48994106", "0.48452884", "0.48336744", "0.48265058", "0.4809848", "0.48040107", "0.48011422", "0.48009977", "0.4800244" ]
0.7034166
0
Adds an entry to the operations.byml file of the given context, and returns the added entry. The options are (all optional): type: string. The possible values are: update: means that the operation is an update for a file that is not registered yet in the vfs (but probably exists on the real server) move: bool=false. Whether to move or copy the file from the given path to the destination.
protected function addEntry(string $contextId, string $id, ?string $path, array $meta, array $options = []): array { if (null !== $path) { $path = $this->getRealPath($path); } $type = $options['type'] ?? 'add'; $useMove = (bool)($options['move'] ?? false); $opFile = $this->getContextDir($contextId) . "/operations.byml"; $ops = []; if (true === file_exists($opFile)) { $ops = BabyYamlUtil::readFile($opFile); } if (null !== $path) { $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta); $dst = $this->getContextDir($contextId) . "/files/" . $relPath; if ($path !== $dst) { if (true === $useMove) { FileSystemTool::move($path, $dst); } else { FileSystemTool::copyFile($path, $dst); } } } else { $relPath = null; $dst = null; } $addOperation = [ 'type' => $type, 'id' => $id, 'path' => $relPath, 'meta' => $meta, ]; //-------------------------------------------- // ADDING THE OPERATION (see heuristic notes for more details) //-------------------------------------------- $found = false; foreach ($ops as $k => $op) { if ($id === $op['id']) { $found = true; $type = $op['type']; switch ($type) { case "add": $ops[$k] = $addOperation; break; default: $this->error("Operation \"$type\" rejected. You cannot add this entry because it already exists with type=\"$type\" for id \"$id\"."); break; } } } if (false === $found) { $op = $addOperation; } $this->onFileAddedAfter($contextId, $op, $path, $dst, $options); if (false === $found) { $ops[] = $op; } else { $ops[$k] = $op; } BabyYamlUtil::writeFile($ops, $opFile); return $op; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function updateEntry(string $contextId, string $id, ?string $path, array $meta, array $options = [])\n {\n if (null !== $path) {\n $path = $this->getRealPath($path);\n }\n\n $opFile = $this->getOperationsFile($contextId);\n $ops = BabyYamlUtil::readFile($opFile);\n $useMove = (bool)($options['move'] ?? false);\n\n\n $found = false;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $found = true;\n\n\n $meta = array_merge($op[\"meta\"], $meta);\n\n\n if (null !== $path) {\n\n\n $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta);\n $dst = $this->getContextDir($contextId) . \"/files/\" . $relPath;\n\n if ($path !== $dst) {\n if (true === $useMove) {\n FileSystemTool::move($path, $dst);\n } else {\n FileSystemTool::copyFile($path, $dst);\n }\n }\n } else {\n $relPath = null;\n $dst = null;\n }\n\n\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n case \"update\":\n $op['meta'] = $meta;\n\n\n /**\n * The bottom line is that in the vfs entry, the path must be set (i.e. not null).\n * We allow for the user to pass path=null for an \"update\" action, for performances reasons, which means that the user\n * didn't change the file but might have updated the meta; however we still need to set the path\n * in the vfs entry.\n *\n * Therefore if the user passes path=null, we don't update the path (we keep the existing one)\n */\n if (null !== $relPath) {\n $op['path'] = $relPath;\n }\n $ops[$k] = $op;\n break;\n case \"remove\":\n $ops[$k] = [\n \"type\" => \"update\",\n \"id\" => $id,\n \"path\" => $relPath,\n \"meta\" => $meta,\n ];\n break;\n }\n\n\n break;\n }\n }\n\n if (false === $found) {\n return $this->addEntry($contextId, $id, $path, $meta, array_merge($options, [\n \"type\" => \"update\",\n ]));\n } else {\n // we only call this when a file has been really added to our vfs\n $this->onFileAddedAfter($contextId, $op, $path, $dst, $options);\n\n $ops[$k] = $op;\n $ops = array_merge($ops);\n BabyYamlUtil::writeFile($ops, $opFile);\n return $op;\n }\n }", "public function add(){\n\t\t\n\t\t// Open or create file\n\t\t$f = fopen($this->file, 'wb');\n\t\tfclose($f);\n\t}", "public function add(array $context): void;", "protected function _actionAdd($context)\n\t{\t\n\t\t$data = $context->data;\t\t\n\t\t$file = KRequest::get('files.file', 'raw');\n\t\t$content = @file_get_contents($file['tmp_name']);\n\t\t$filesize = strlen($content);\n\t\t$uploadlimit = $this->_max_upload_limit * 1024 * 1024; \n\t\t\n\t\t$exif = (function_exists('exif_read_data')) ? @exif_read_data($file['tmp_name']) : array();\n\n\t\tif($filesize == 0)\n\t\t{\n\t\t throw new LibBaseControllerExceptionBadRequest('File is missing');\t\n\t\t\t\n\t\t return;\n\t\t}\n\t\t\n\t\tif($filesize > $uploadlimit)\n\t\t{\n\t\t throw new LibBaseControllerExceptionBadRequest('Exceed maximum size');\t\n\n\t\t return;\n\t\t}\n\n\t\t$orientation = 0;\n\t\t\n\t\tif(!empty($exif) && isset($exif['Orientation']) )\n {\n $orientation = $exif['Orientation']; \n }\t\t\n\t\t\n\t\t$data['portrait'] = array('data'=>$content,'rotation'=>$orientation,'mimetype'=>isset($file['type']) ? $file['type'] : null);\t\t\t\t\n \n\t\t$photo = $this->actor->photos->addNew($data);\t\n\t\t\n\t\t$photo->setExifData($exif);\n\t\t\n\t\t$photo->save();\n\t\t\n\t\t$this->setItem($photo);\n\t\t\n\t\t$this->getResponse()->status = KHttpResponse::CREATED;\n\t\t\n if($photo->body && preg_match('/\\S/',$photo->body))\n {\n $context->append(array( \n 'story' => array('body'=>$photo->body)\n )); \n }\n\n\t\treturn $photo;\n\t}", "public function add(ContextInterface $context);", "public function add_entry($entry);", "public function gitAdd($path)\n\t{\n\t\t// #TODO: Doesn't support adding new directories along with files.\n\t\t// this only supports adding a single file at a time.\n\t\t$WorkingCopy = $this->gitWrapper->workingCopy($this->getPath()); // This \n\t\treturn $WorkingCopy->add($path);\n\t}", "public function addInput ( \\r8\\FileSys $input )\n {\n $input = clone $input;\n\n if ( $input->isFile() ) {\n $this->inputs->append( new \\ArrayIterator(array($input)) );\n }\n else if ( $input->isDir() ) {\n $input->setIncludeDots(FALSE);\n $this->inputs->append(\n new \\RecursiveIteratorIterator($input)\n );\n }\n else {\n throw new \\r8\\Exception\\Argument(0, 'Input', 'Path does not exist');\n }\n\n return $this;\n }", "protected function onFileAddedAfter(string $contextId, array &$operation, ?string $path, ?string $dst, array $options = [])\n {\n\n }", "public function addContext(GenericContext $context);", "public function add($child, $type = null, array $options = array());", "public function addAction() {\n \t$dataType = $this->getInput('dataType');\n \tif (!in_array($dataType,$this->DATATYPE)) {\n \t exit(\"参数错误\");\n \t}\n \t$this->assign('dataType', $dataType);\n $this->assign('dataTypes', $this->DATATYPE);\n }", "protected function removeEntry(string $contextId, string $id)\n {\n $opFile = $this->getOperationsFile($contextId);\n $ops = BabyYamlUtil::readFile($opFile);\n\n\n /**\n * If the entry is found, we remove it directly from the operations.\n */\n $addTheDeleteEntry = true;\n $realpath = null;\n $op = null;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $addTheDeleteEntry = false;\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n $realpath = $this->getEntryRealPathByOperation($contextId, $op);\n if (file_exists($realpath)) {\n unlink($realpath);\n }\n unset($ops[$k]);\n break;\n case \"update\":\n $realpath = $this->getEntryRealPathByOperation($contextId, $op);\n if (file_exists($realpath)) {\n unlink($realpath);\n }\n unset($ops[$k]);\n $addTheDeleteEntry = true;\n break;\n }\n }\n }\n\n\n if (true === $addTheDeleteEntry) {\n $ops[] = [\n 'type' => \"remove\",\n 'id' => $id,\n ];\n }\n\n $this->onFileRemovedAfter($contextId, $id, $op, $realpath);\n\n $ops = array_merge($ops);\n BabyYamlUtil::writeFile($ops, $opFile);\n\n }", "function &addEntry($entry) {\n $reuslt = NULL;\n if (is_object($entry) && is_a($entry, 'papaya_atom_entry')) {\n $result = $this->add();\n $result->assign($entry);\n }\n return $result;\n }", "function add()\n\t{\n\t\t$CFG = $this->config->item('image_configure');\n\t\t$data[\"title\"] = _e(\"Image\");\n\t\t## for check admin or not ##\n\t\t$data[\"response\"] = addPermissionMsg( $CFG[\"sector\"][\"add\"] );\t\t\t\n\t\t## Other auxilary variable ##\n\t\t$data['var'] = array();\t\t\n\t\t$this->load->module('context/context_admin');\n\t\t$user_context = $this->context_admin->getContext();\n\t\t$data['var']['context_dd'] = ( array('' => _e('Choose Context') ) + $user_context );\n\t\t$data['var']['relation_dd'] = ( array('' => _e('Choose Relation') ) );\n\t\t$data[\"top\"] = $this->template->admin_view(\"top\", $data, true, \"image\");\t\n\t\t$data[\"content\"] = $this->template->admin_view(\"image_add\", $data, true, \"image\");\n\t\t$this->template->build_admin_output($data);\n\t}", "public function add(string $name, string $type = null, array $options = []);", "public function add(SplFileInfo $splFileInfo);", "function add_log_entry(log_op_move $entry) {\n array_unshift($this->log_op_list, $entry);\n }", "public function addEntry(DataStreamEntry $entry);", "function add()\n\t{\n\t\t$this->_updatedata();\n\t}", "function add()\n\t{\n\t\t$data[\"title\"] = _e(\"Permission Modify\");\t\n\t\t$CFG = $this->config->item('permission_modify_configure');\n\t\t## for check admin or not\t##\t\n\t\t$data[\"response\"] = addPermissionMsg( $CFG[\"sector\"][\"add\"] );\n\t\t\t\t\t\n\t\t## Other auxilary variable ##\n\t\t$data['var'] = array();\t\t\t\t\n\t\t$data[\"top\"] = $this->template->admin_view(\"top\", $data, true, \"permission_modify\");\t\n\t\t$data[\"content\"] = $this->template->admin_view(\"permission_modify_add\", $data, true, \"permission_modify\");\n\t\t$this->template->build_admin_output($data);\n\t}", "public function add(Operation $operation);", "public function add() {\n $this->usePostRequest();\n //$this->dbFileModel->add_file();\n }", "protected function add($name, $value){\r\n $this->file->{\"$this->command\"}($this->handler, $name, $value);\r\n }", "protected function add($type, $file, $options)\n {\n if ($file)\n {\n if (!isset($this->resources[$type]))\n {\n $this->resources[$type] = array();\n }\n \n $this->resources[$type][$file] = $options; \n }\n \n return $this;\n }", "public function addPath($path);", "public function addPath($path);", "public function add_entry($entry)\n {\n }", "public function add_postAction() {\n\t\t$info = $this->getPost(array('name', 'sort', 'descript'));\n\t\t$info = $this->_cookData($info);\n\t\t$series = Lock_Service_FileType::getFileTypeByName($info['name']);\n\t\tif($series) $this->output(-1, $info['name'].'已存在');\n\t\t$result = Lock_Service_FileType::addFileType($info);\n\t\tif (!$result) $this->output(-1, '操作失败');\n\t\t$this->output(0, '操作成功');\n\t}", "public function add($key, $value = null)\n {\n if (is_null($value) && !isset($this->item[$key])) {\n is_file($config = root('config',$key.'.php')) && $this->set($key, require($config));\n is_file($config = runtime('config',$key.'.php')) && $this->set($key, require($config));\n } else if(is_string($value) && is_file($value)){\n return $this->set($key, require($value));\n }else{\n return $this->set($key, $value);\n }\n }" ]
[ "0.5631658", "0.5087558", "0.5044731", "0.49486068", "0.49457246", "0.49151456", "0.4877025", "0.48700997", "0.4814642", "0.48052913", "0.4791017", "0.47206935", "0.46757424", "0.4638905", "0.46332043", "0.45990634", "0.45632172", "0.45451874", "0.45377573", "0.4510024", "0.44786182", "0.44696727", "0.44489282", "0.44348058", "0.4425738", "0.44232473", "0.44232473", "0.44197625", "0.43169412", "0.43124053" ]
0.6667624
0
Returns whether there is an nondeleted entry found in the the operations.byml file of the given context that matches the given id.
protected function hasEntry(string $contextId, string $id, array $allowedTypes = null): bool { $opFile = $this->getOperationsFile($contextId); $ops = BabyYamlUtil::readFile($opFile); $types = (null === $allowedTypes) ? ["add", "remove", "update"] : $allowedTypes; foreach ($ops as $k => $op) { if (false === in_array($op['type'], $types)) { continue; } if ($id === $op['id']) { return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isEntry($id) {\n\t\t$entry = $this->getEntry($id);\n\t\treturn !empty($entry->id);\n\t}", "public function hasEntry($id): bool {\n\t\treturn property_exists($this->stash, $id);\n\t}", "function exists($id)\n{\n\tif ($id && file_exists('datas/data')){\n\t\t$file = unserialize(file_get_contents('datas/data'));\n\t\tforeach ($file as $value){\n\t\t\tif(trim($value['nom']) === trim($id))\n\t\t\t\treturn true;\n\t\t}\n\t}\n return false;\n}", "function tflash_id_exits($id) {\n return TFLASH::id_exists($id);\n}", "protected function doContains($id)\n {\n return $this->yac->get($this->getHash($id)) !== false;\n }", "public function hasEntry($idEntry);", "private function ignoreDelRequest($id)\n {\n return $this->db_ignore_del_req($id);\n }", "public function exist( $data, $id ) {\n\t\t$query = $this->db->select( '*' )\n\t\t ->from( $this->_table )\n\t\t ->where( $this->name, $data )\n\t\t ->where_not_in( $this->primary_key, $id )\n\t\t ->get();\n\t\t$num = $query->num_rows();\n\t\tif ( $num == 0 ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function checkCanDelete($id){\r\n\t\t$sql = \"Select * From #languages Where id = $id\"; \r\n\t\t$rs = $this->_get($sql); \r\n\t\tif ($rs) {\r\n\t\t\tif ($rs->is_default == 0 && $rs->is_admin_default == 0 && $rs->is_developer_default == 0) return true; \r\n\t\t}\r\n\t\treturn false;\r\n\t}", "protected function doContains($id)\n {\n $filename = $this->getFilename($id);\n\n if (!is_file($filename)) {\n return false;\n }\n\n $cacheEntry = unserialize(file_get_contents($filename));\n\n return $cacheEntry['ttl'] === Cache::TTL_NO_EXPIRY || $cacheEntry['ttl'] > time();\n }", "public function offsetExists($id)\n {\n return parent::offsetExists(str_replace('_', '.', $id));\n }", "public function returnExists($id);", "public function isPerangkatDeleted($id)\n {\n $result = $this->getPerangkatById($id);\n if ($result[\"delete_at\"] === null) {\n return true;\n }\n return false;\n }", "function exists() {\n\t return !empty($this->id);\n\t}", "public static function checkId($id) {\n\n $session = Yii::$app->session;\n\n if (isset($session['order']) && array_search($id, $session['order']) !== false) {\n return 'true';\n } else {\n return 'false';\n }\n }", "static function exists($id) {\n $result = self::get($id);\n if (count($result) > 0) return true;\n return false;\n }", "public function has($id) {\n return array_key_exists($id, $this->definitions)\n || array_key_exists($id, $this->entries);\n }", "public function exists($id);", "public function exists($id);", "protected function entry_exists ($idXml)\r\n\t{\r\n\t\tglobal $xname;\r\n\t\t$query\t= \"SELECT id,id_xml FROM {$xname}_viviendas WHERE id_xml = {$idXml}\";\r\n\t\t$sql\t= $this->db->query($query);\r\n\t\tif ($sql) {\r\n\t\t\t$row\t= $sql->fetch_object();\r\n\t\t\tif (!empty($row->id_xml)) {\r\n\t\t\t\treturn $row->id;\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function exists()\r\n\t{\r\n\t\treturn ( ! empty($this->id));\r\n\t}", "public function exists() {\n\t\treturn !is_null($this->id);\n\t}", "public function exist($id) {\n $entity = $this->entityTypeManager->getStorage('social_media_feed_twitter')->getQuery()\n ->condition('id', $id)\n ->execute();\n return (bool) $entity;\n }", "public static function exists(int $id): bool;", "public function has(string $id) : bool\n {\n return Filesystem::has($this->_file_location($id));\n }", "public function check_data_existence( $id, $action = '' ) {\n global $wpdb;\n\n // check if id is empty\n if ( empty( $id ) ) {\n return false;\n }\n\n $sql = <<<__SQL\nSELECT\n COUNT(*) as cnt\n , title\nFROM\n hc_file\nWHERE\n ID = %d\n AND deleteflg = %d\n__SQL;\n\n // parameter for the query\n $param = array( (int)$id, 0 );\n\n // prepare the sql\n $prepare = $wpdb->prepare( $sql, $param );\n\n // get the result\n $res = $wpdb->get_results( $prepare );\n\n // check if data exists\n if ( (int)$res[0]->cnt > 0 ) {\n return $res[0]->title;\n }\n\n return false;\n }", "private function isFileOwner($id){\n $query = \\Drupal::database()->select('ol_file', 'fr');\n $query->addField('fr', 'user_id');\n $query->condition('fr.id', $id);\n $uid = $query->execute()->fetchField();\n return ($uid == $this->current_user->id());\n }", "public function exists($id) {\n $path = $this->options['resource'];\n $path .= '/exists?data.' . $this->options['id_field'] . '=' . $id;\n $response = $this->get($path);\n return !!$response['body']['_id'];\n }", "public function isExistById($id){\n//\t\tprint_r(\"##Count=##\");\n//\t\tprint_r($this->find($id)->count());\n return $this->find($id)->count() ;\n }", "public function hasId()\n {\n return $this->id !== null;\n }" ]
[ "0.59771097", "0.5841355", "0.58016205", "0.57910895", "0.5771304", "0.5748312", "0.5742887", "0.57339513", "0.5707286", "0.57064027", "0.5701425", "0.5683903", "0.56824553", "0.5666182", "0.56511384", "0.56422174", "0.56095576", "0.5564062", "0.5564062", "0.55112636", "0.5498688", "0.5497766", "0.5469929", "0.5459215", "0.54552025", "0.5446226", "0.54055536", "0.5404729", "0.53982264", "0.53859645" ]
0.6014485
0
Removes the entry from the operations.byml file of the given context that matches the given id. If the entry didn't exist, the method will be silent.
protected function removeEntry(string $contextId, string $id) { $opFile = $this->getOperationsFile($contextId); $ops = BabyYamlUtil::readFile($opFile); /** * If the entry is found, we remove it directly from the operations. */ $addTheDeleteEntry = true; $realpath = null; $op = null; foreach ($ops as $k => $op) { if ($id === $op['id']) { $addTheDeleteEntry = false; $type = $op['type']; switch ($type) { case "add": $realpath = $this->getEntryRealPathByOperation($contextId, $op); if (file_exists($realpath)) { unlink($realpath); } unset($ops[$k]); break; case "update": $realpath = $this->getEntryRealPathByOperation($contextId, $op); if (file_exists($realpath)) { unlink($realpath); } unset($ops[$k]); $addTheDeleteEntry = true; break; } } } if (true === $addTheDeleteEntry) { $ops[] = [ 'type' => "remove", 'id' => $id, ]; } $this->onFileRemovedAfter($contextId, $id, $op, $realpath); $ops = array_merge($ops); BabyYamlUtil::writeFile($ops, $opFile); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function remove($id);", "public function remove($id);", "public static function remove($id)\n {\n $db = Zend_Registry::get('dbAdapter');\n $db->delete('main', 'main. = ' . $id);\n }", "public function remove($id)\n\t{\n\t}", "abstract public function remove($id);", "public function destory($id)\n {\n }", "public static function delete(\\Scrivo\\Context $context, $id) {\n\t\t\\Scrivo\\ArgumentCheck::assertArgs(func_get_args(), array(\n\t\t\tnull,\n\t\t\tarray(\\Scrivo\\ArgumentCheck::TYPE_INTEGER)\n\t\t));\n\t\ttry {\n\t\t\tself::validateDelete($context, $id);\n\n\t\t\t$tmp = self::fetch($context, $id);\n\n\t\t\t$sth = $context->connection->prepare(\n\t\t\t\t\"DELETE FROM parent_list_item_definitions\n\t\t\t\tWHERE instance_id = :instId AND\n\t\t\t\t(list_item_definition_id = :id OR parent_list_item_definition_id = :id)\");\n\n\t\t\t$context->connection->bindInstance($sth);\n\t\t\t$sth->bindValue(\":id\", $id, \\PDO::PARAM_INT);\n\n\t\t\t$sth->execute();\n\n\t\t\t$sth = $context->connection->prepare(\n\t\t\t\t\"DELETE FROM list_item_definition\n\t\t\t\tWHERE instance_id = :instId AND list_item_definition_id = :id\");\n\n\t\t\t$context->connection->bindInstance($sth);\n\t\t\t$sth->bindValue(\":id\", $id, \\PDO::PARAM_INT);\n\n\t\t\t$sth->execute();\n\n\t\t\tunset($context->cache[$id]);\n\n\t\t} catch(\\PDOException $e) {\n\t\t\tthrow new \\Scrivo\\ResourceException($e);\n\t\t}\n\t}", "public function destroy($id)\n { \n modelMst::where((new modelMst)->getKeyName(), $id)->update(['sys_status_aktif'=>'N']); \n }", "public function delete_by_id($id) {\n // We need to make sure we delete the item and all related files, which can be done with solr_filegroupingid.\n $this->get_search_client()->deleteByQuery('solr_filegroupingid:' . $id);\n $this->commit();\n }", "function deleteConf($id, $file=CONFERENCES){\n\t$confs = getJSON($file);\n\t$index = searchIndex($confs, $id);\n\tarray_splice($confs, $index, 1);\n\t\n\texport($confs, $file);\n}", "public function excluirLocalizacao($id){\n global $app;\n $sth = $this->PDO->prepare(\"DELETE FROM localizacao WHERE id = :id\");\n $sth ->bindValue(':id',$id);\n $app->render('default.php',[\"data\"=>['status'=>$sth->execute()==1]],200);\n }", "public function removeKeywordMMSFile($id)\n {\n\n $appStage = app_config('AppStage');\n if ($appStage == 'Demo') {\n return redirect('user/keywords')->with([\n 'message' => language_data('This Option is Disable In Demo Mode'),\n 'message_important' => true\n ]);\n }\n\n $keyword_id = explode('_', $id);\n if (isset($keyword_id) && is_array($keyword_id) && array_key_exists('1', $keyword_id)) {\n $keyword = Keywords::where('user_id', Auth::guard('client')->user()->id)->find($keyword_id['1']);\n\n if ($keyword) {\n $keyword->reply_mms = null;\n $keyword->save();\n\n return redirect('user/keywords')->with([\n 'message' => 'MMS file remove successfully'\n ]);\n }\n\n return redirect('user/keywords')->with([\n 'message' => 'Keyword information not found',\n 'message_important' => true\n ]);\n }\n\n return redirect('user/keywords')->with([\n 'message' => 'Invalid request',\n 'message_important' => true\n ]);\n }", "public function remove($id)\n {\n //please rely on SQL CASCADING ON DELETE\n return $this->resource\n ->model()\n ->setHistoryId($id)\n ->remove('history');\n }", "public function remove($id)\n {\n //please rely on SQL CASCADING ON DELETE\n return $this->resource\n ->model()\n ->setActionId($id)\n ->remove('action');\n }", "protected function eliminar($id)\n {\n }", "private function removeInformation($entryid){\n\t\t$query = Queries::removeinformation($entryid);\n\t\treturn $this->query($query);\n\t}", "protected function _deleteEntity( $id )\n\t\t{\n\t\t\t$data = explode( '__', $id );\n\t\t\t$template = array_pop( $data );\n\t\t\t$type = str_replace( '.phtml', '', $template );\n\t\t\t// Delete a file.\n\t\t\tif ( count( $data ) > 1 ) {\n\t\t\t\t$directory = $this->_getTypeDirectory( $type );\n\t\t\t\tif ( is_file( $directory . $id ) ) {\n\t\t\t\t\tunlink( $directory . $id );\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public function excluir($id){\n\t\t\tglobal $app;\n\t\t\t$sth = $this->PDO->prepare(\"DELETE FROM sedecchamados WHERE _id = :id\");\n\t\t\t$sth ->bindValue(':id',$id);\n\t\t\t$app->render('default.php',[\"data\"=>['status'=>$sth->execute()==1]],200); \n\t\t}", "public function remove($id)\n {\n $this->items->reject(function($value, $key) use ($id){\n return $value[$this->id] != $id;\n });\n }", "public function destroy($id)\n {\n //me dijieron que tengo que modificar un archivo, pero no se acuerdan cual para que funcione el delete, pero este funciona si lo pruebo sin el postman\n $habitacions = Habitacion::findOrFail($id); \n $habitacions->delete();\n return 'eliminado';\n }", "public function remove_information($i_id=0)\r\n {}", "public function remove_information($i_id=0)\r\n {}", "public function remove(string $id): bool;", "public function eliminar($id)\n {\n //\n }", "public function eliminar($id)\n {\n //\n }", "public function delete($id) {\n\t\t$file = $this->init['path']['data'] . $id . $this->init['data']['ext'];\n\t\t// If the file doesn't exist\n\t\tif (!file_exists($file)) {\n\t\t\t// Ooops, the file didn't exist\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// Delete the file\n\t\t\tunlink($file);\n\t\t\treturn true;\n\t\t}\n\t}", "public static function remove ($id) {\n\n $db = Zend_Registry::get('dbAdapter');\n $db->delete('orte', 'orte.plz = ' . $id);\n\n }", "public function deleteById($id) {\r\n \t$obj = $this->find($id)->current();\r\n \tif (!empty($obj)) {\r\n \t\t$obj->delete();\r\n \t}\r\n }", "public function delete($id) \r\n {\r\n $this->load(array('id=?',$id));\r\n $this->erase();\r\n }", "public function del($id)\n {\n }" ]
[ "0.5948843", "0.5948843", "0.5900992", "0.583733", "0.5799797", "0.56758916", "0.562627", "0.5555392", "0.5544114", "0.55012566", "0.5489974", "0.54875785", "0.54822344", "0.5481346", "0.5436856", "0.54347503", "0.5412185", "0.54042006", "0.53996235", "0.534955", "0.53168017", "0.53168017", "0.5310211", "0.53025186", "0.53025186", "0.5288038", "0.52791446", "0.5275526", "0.5273537", "0.52735007" ]
0.76414067
0
Updates the entry in the operations.byml file of the given context that matches the given id. Throws an exception if the file wasn't found, or in case of problems. The options are: move: bool=false. Whether to move or copy the file from the given path to the destination.
protected function updateEntry(string $contextId, string $id, ?string $path, array $meta, array $options = []) { if (null !== $path) { $path = $this->getRealPath($path); } $opFile = $this->getOperationsFile($contextId); $ops = BabyYamlUtil::readFile($opFile); $useMove = (bool)($options['move'] ?? false); $found = false; foreach ($ops as $k => $op) { if ($id === $op['id']) { $found = true; $meta = array_merge($op["meta"], $meta); if (null !== $path) { $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta); $dst = $this->getContextDir($contextId) . "/files/" . $relPath; if ($path !== $dst) { if (true === $useMove) { FileSystemTool::move($path, $dst); } else { FileSystemTool::copyFile($path, $dst); } } } else { $relPath = null; $dst = null; } $type = $op['type']; switch ($type) { case "add": case "update": $op['meta'] = $meta; /** * The bottom line is that in the vfs entry, the path must be set (i.e. not null). * We allow for the user to pass path=null for an "update" action, for performances reasons, which means that the user * didn't change the file but might have updated the meta; however we still need to set the path * in the vfs entry. * * Therefore if the user passes path=null, we don't update the path (we keep the existing one) */ if (null !== $relPath) { $op['path'] = $relPath; } $ops[$k] = $op; break; case "remove": $ops[$k] = [ "type" => "update", "id" => $id, "path" => $relPath, "meta" => $meta, ]; break; } break; } } if (false === $found) { return $this->addEntry($contextId, $id, $path, $meta, array_merge($options, [ "type" => "update", ])); } else { // we only call this when a file has been really added to our vfs $this->onFileAddedAfter($contextId, $op, $path, $dst, $options); $ops[$k] = $op; $ops = array_merge($ops); BabyYamlUtil::writeFile($ops, $opFile); return $op; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function addEntry(string $contextId, string $id, ?string $path, array $meta, array $options = []): array\n {\n if (null !== $path) {\n $path = $this->getRealPath($path);\n }\n\n $type = $options['type'] ?? 'add';\n $useMove = (bool)($options['move'] ?? false);\n\n\n $opFile = $this->getContextDir($contextId) . \"/operations.byml\";\n $ops = [];\n if (true === file_exists($opFile)) {\n $ops = BabyYamlUtil::readFile($opFile);\n }\n\n\n if (null !== $path) {\n\n $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta);\n $dst = $this->getContextDir($contextId) . \"/files/\" . $relPath;\n if ($path !== $dst) {\n if (true === $useMove) {\n FileSystemTool::move($path, $dst);\n } else {\n FileSystemTool::copyFile($path, $dst);\n }\n }\n } else {\n $relPath = null;\n $dst = null;\n }\n\n\n $addOperation = [\n 'type' => $type,\n 'id' => $id,\n 'path' => $relPath,\n 'meta' => $meta,\n ];\n\n\n //--------------------------------------------\n // ADDING THE OPERATION (see heuristic notes for more details)\n //--------------------------------------------\n $found = false;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $found = true;\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n $ops[$k] = $addOperation;\n break;\n default:\n $this->error(\"Operation \\\"$type\\\" rejected. You cannot add this entry because it already exists with type=\\\"$type\\\" for id \\\"$id\\\".\");\n break;\n }\n }\n }\n\n\n if (false === $found) {\n $op = $addOperation;\n }\n $this->onFileAddedAfter($contextId, $op, $path, $dst, $options);\n if (false === $found) {\n $ops[] = $op;\n } else {\n $ops[$k] = $op;\n }\n\n\n BabyYamlUtil::writeFile($ops, $opFile);\n\n\n return $op;\n }", "protected function removeEntry(string $contextId, string $id)\n {\n $opFile = $this->getOperationsFile($contextId);\n $ops = BabyYamlUtil::readFile($opFile);\n\n\n /**\n * If the entry is found, we remove it directly from the operations.\n */\n $addTheDeleteEntry = true;\n $realpath = null;\n $op = null;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $addTheDeleteEntry = false;\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n $realpath = $this->getEntryRealPathByOperation($contextId, $op);\n if (file_exists($realpath)) {\n unlink($realpath);\n }\n unset($ops[$k]);\n break;\n case \"update\":\n $realpath = $this->getEntryRealPathByOperation($contextId, $op);\n if (file_exists($realpath)) {\n unlink($realpath);\n }\n unset($ops[$k]);\n $addTheDeleteEntry = true;\n break;\n }\n }\n }\n\n\n if (true === $addTheDeleteEntry) {\n $ops[] = [\n 'type' => \"remove\",\n 'id' => $id,\n ];\n }\n\n $this->onFileRemovedAfter($contextId, $id, $op, $realpath);\n\n $ops = array_merge($ops);\n BabyYamlUtil::writeFile($ops, $opFile);\n\n }", "public function update($id, $data) {\n\t\t$file = $this->init['path']['data'] . $id . $this->init['data']['ext'];\n\t\t// If the file doesn't exist\n\t\tif (!file_exists($file)) {\n\t\t\t// Ooops, the file didn't exist\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// Replace the existing contents with the data\n\t\t\treturn file_put_contents($file, $data);\n\t\t}\n\t}", "public function update($id) {\n\t\t//\n\t}", "public function update($id) {\n\t\t//\n\t}", "public function update($id) {\n\t\t//\n\t}", "public function update($id) {\n\t\t//\n\t}", "public function update($id) //Ändra befintlig boking\n\t{\n\t\t//\n\t}", "public function update($id){\n\t\t//\n\t}", "public function update($id){\n\t\t//\n\t}", "public function update($id = null)\n\t{\n\t\t//\n\t}", "public function update($id);", "public function update($id);", "public function update($id) {\r\n //\r\n }", "public function actionUpdate($id)\n {\n $model = $this->findModel($id);\n $model->scenario = 'update';\n $request = Yii::$app->request;\n $fileSuccess = NULL;\n $photoPathOld = NULL;\n\n if ($request->isPost) {\n\n $modelLoaded = $model->load($request->post());\n\n if($model->photo){\n $photoPathOld = Yii::$app->basePath.'/web/'.$model->photo; //get the path to the existing file\n }\n\n if (!$modelLoaded) {\n return $this->render('update', [\n 'model' => $model,\n 'errorMessage' => \"Missing parameters!\",\n ]);\n }\n\n $files = UploadedFile::getInstances($model, 'files');\n\n if($files){\n foreach ($files as $file) {\n $photoPath = 'Uploads/' . $model->city->name . '---' . $file->name;\n if(file_exists($photoPathOld)){\n if(strcmp($photoPath, $photoPathOld) !== 0){\n @unlink($photoPathOld);\n }\n }\n $fileSuccess = $file->saveAs($photoPath);\n }\n }\n\n if ($files && !$fileSuccess) {\n return $this->render('update', [\n 'model' => $model,\n 'errorMessage' => \"Cannot update file to disk!\",\n ]);\n }\n\n if ($files && $fileSuccess){\n // save the path in the db column\n $model->setAttribute('photo', $photoPath);\n }\n\n if ($model->validate() && $model->save()) {\n return $this->redirect(['view', 'id' => $model->city_photo_id]);\n }\n }\n\n return $this->render('update', [\n 'model' => $model,\n ]);\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public function update($id) {\n //\n }", "public static function update($id, $file)\n {\n Image::delete($id);\n\n Image::save($file);\n }", "public function actionUpdate($id)\n {\n $model = $this->findModel($id);\n\n \n $model->imageFileName_Fl = UploadedFile::getInstance($model, 'imageFileName_Fl');\n if ($model->imageFileName_Fl && $model->validate()) { \n $s2=$model->id . '_' . $model->imageFileName_Fl->baseName . '.' . $model->imageFileName_Fl->extension; \n $model->imageFileName_Fl->saveAs(Yii::getAlias('@frontend').'/web/uploads/' . $s2);\n $model->imageFileName=$s2;\n }\n \n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('update', [\n 'model' => $model,\n ]);\n }\n }" ]
[ "0.5894428", "0.58074415", "0.552832", "0.54824644", "0.54824644", "0.54824644", "0.54824644", "0.5441531", "0.5419202", "0.5419202", "0.5387602", "0.538625", "0.538625", "0.53787184", "0.53642166", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53601104", "0.53495616", "0.5347719" ]
0.72480106
0
Returns the entry in the operations.byml file of the given context that matches the given id. The options are: realpath: bool=false. If true, the realpath entry is added to the returned array, and contains the realpath to the file. This only works if the operation type allows it (i.e. not remove).
protected function getEntry(string $contextId, string $id, array $options = []): array { $useRealpath = (bool)($options['realpath'] ?? false); $opFile = $this->getOperationsFile($contextId); $ops = BabyYamlUtil::readFile($opFile); foreach ($ops as $op) { if ($id === $op['id']) { if (true === $useRealpath) { $op['realpath'] = $this->getEntryRealPathByOperation($contextId, $op, $options); } return $op; } } $this->error("Entry not found with id=\"$id\" and contextId=\"$contextId\"."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function addEntry(string $contextId, string $id, ?string $path, array $meta, array $options = []): array\n {\n if (null !== $path) {\n $path = $this->getRealPath($path);\n }\n\n $type = $options['type'] ?? 'add';\n $useMove = (bool)($options['move'] ?? false);\n\n\n $opFile = $this->getContextDir($contextId) . \"/operations.byml\";\n $ops = [];\n if (true === file_exists($opFile)) {\n $ops = BabyYamlUtil::readFile($opFile);\n }\n\n\n if (null !== $path) {\n\n $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta);\n $dst = $this->getContextDir($contextId) . \"/files/\" . $relPath;\n if ($path !== $dst) {\n if (true === $useMove) {\n FileSystemTool::move($path, $dst);\n } else {\n FileSystemTool::copyFile($path, $dst);\n }\n }\n } else {\n $relPath = null;\n $dst = null;\n }\n\n\n $addOperation = [\n 'type' => $type,\n 'id' => $id,\n 'path' => $relPath,\n 'meta' => $meta,\n ];\n\n\n //--------------------------------------------\n // ADDING THE OPERATION (see heuristic notes for more details)\n //--------------------------------------------\n $found = false;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $found = true;\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n $ops[$k] = $addOperation;\n break;\n default:\n $this->error(\"Operation \\\"$type\\\" rejected. You cannot add this entry because it already exists with type=\\\"$type\\\" for id \\\"$id\\\".\");\n break;\n }\n }\n }\n\n\n if (false === $found) {\n $op = $addOperation;\n }\n $this->onFileAddedAfter($contextId, $op, $path, $dst, $options);\n if (false === $found) {\n $ops[] = $op;\n } else {\n $ops[$k] = $op;\n }\n\n\n BabyYamlUtil::writeFile($ops, $opFile);\n\n\n return $op;\n }", "private function getEntryRealPathByOperation(string $contextId, array $operation, array $options = []): string\n {\n if ('remove' === $operation['type']) {\n $id = $operation['id'];\n $this->error(\"Cannot get realpath from a remove operation, with contextId=\\\"$contextId\\\" and id=\\\"$id\\\".\");\n }\n\n return $this->doGetEntryRealPathByOperation($contextId, $operation, $options);\n }", "protected function getRawOperations(string $contextId): array\n {\n\n $ret = [];\n $opFile = $this->getContextDir($contextId) . \"/operations.byml\";\n if (true === file_exists($opFile)) {\n return BabyYamlUtil::readFile($opFile);\n }\n return $ret;\n }", "public function get($id, $contents = false)\n {\n $data = $this->db->one(\n \"SELECT id, name, location, hash, bytesize, settings FROM {$this->table} WHERE id = ?\",\n $id\n );\n if (!$data) {\n throw new FileNotFoundException('File not found', 404);\n }\n if (!is_file($this->baseDirectory . $data['location'])) {\n throw new FileNotFoundException('File not found', 404);\n }\n return [\n 'id' => $data['id'],\n 'name' => $data['name'],\n 'path' => $contents ? $this->baseDirectory . $data['location'] : null,\n 'complete' => true,\n 'hash' => $data['hash'],\n 'size' => $data['bytesize'],\n 'settings' => json_decode($data['settings'], true)\n ];\n }", "protected function getOperationsFile(string $contextId): string\n {\n $opFile = $this->getContextDir($contextId) . \"/operations.byml\";\n if (false === file_exists($opFile)) {\n $ops = [];\n BabyYamlUtil::writeFile($ops, $opFile);\n }\n return $opFile;\n }", "protected function updateEntry(string $contextId, string $id, ?string $path, array $meta, array $options = [])\n {\n if (null !== $path) {\n $path = $this->getRealPath($path);\n }\n\n $opFile = $this->getOperationsFile($contextId);\n $ops = BabyYamlUtil::readFile($opFile);\n $useMove = (bool)($options['move'] ?? false);\n\n\n $found = false;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $found = true;\n\n\n $meta = array_merge($op[\"meta\"], $meta);\n\n\n if (null !== $path) {\n\n\n $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta);\n $dst = $this->getContextDir($contextId) . \"/files/\" . $relPath;\n\n if ($path !== $dst) {\n if (true === $useMove) {\n FileSystemTool::move($path, $dst);\n } else {\n FileSystemTool::copyFile($path, $dst);\n }\n }\n } else {\n $relPath = null;\n $dst = null;\n }\n\n\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n case \"update\":\n $op['meta'] = $meta;\n\n\n /**\n * The bottom line is that in the vfs entry, the path must be set (i.e. not null).\n * We allow for the user to pass path=null for an \"update\" action, for performances reasons, which means that the user\n * didn't change the file but might have updated the meta; however we still need to set the path\n * in the vfs entry.\n *\n * Therefore if the user passes path=null, we don't update the path (we keep the existing one)\n */\n if (null !== $relPath) {\n $op['path'] = $relPath;\n }\n $ops[$k] = $op;\n break;\n case \"remove\":\n $ops[$k] = [\n \"type\" => \"update\",\n \"id\" => $id,\n \"path\" => $relPath,\n \"meta\" => $meta,\n ];\n break;\n }\n\n\n break;\n }\n }\n\n if (false === $found) {\n return $this->addEntry($contextId, $id, $path, $meta, array_merge($options, [\n \"type\" => \"update\",\n ]));\n } else {\n // we only call this when a file has been really added to our vfs\n $this->onFileAddedAfter($contextId, $op, $path, $dst, $options);\n\n $ops[$k] = $op;\n $ops = array_merge($ops);\n BabyYamlUtil::writeFile($ops, $opFile);\n return $op;\n }\n }", "protected function doGetEntryRealPathByOperation(string $contextId, array $operation, array $options = [])\n {\n return $this->getContextDir($contextId) . \"/files/\" . $operation['path'];\n }", "public function getPath($id);", "protected function removeEntry(string $contextId, string $id)\n {\n $opFile = $this->getOperationsFile($contextId);\n $ops = BabyYamlUtil::readFile($opFile);\n\n\n /**\n * If the entry is found, we remove it directly from the operations.\n */\n $addTheDeleteEntry = true;\n $realpath = null;\n $op = null;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $addTheDeleteEntry = false;\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n $realpath = $this->getEntryRealPathByOperation($contextId, $op);\n if (file_exists($realpath)) {\n unlink($realpath);\n }\n unset($ops[$k]);\n break;\n case \"update\":\n $realpath = $this->getEntryRealPathByOperation($contextId, $op);\n if (file_exists($realpath)) {\n unlink($realpath);\n }\n unset($ops[$k]);\n $addTheDeleteEntry = true;\n break;\n }\n }\n }\n\n\n if (true === $addTheDeleteEntry) {\n $ops[] = [\n 'type' => \"remove\",\n 'id' => $id,\n ];\n }\n\n $this->onFileRemovedAfter($contextId, $id, $op, $realpath);\n\n $ops = array_merge($ops);\n BabyYamlUtil::writeFile($ops, $opFile);\n\n }", "public static function find($id)\n {\n $results = parent::find($id);\n return empty($results) ? null : new File ($results);\n }", "public function get_file_detail( $id ) {\n global $wpdb;\n\n // check if id is not empty\n if ( empty( $id ) ) {\n return false;\n }\n\n $sql = <<<__SQL\nSELECT\n ID\n , title\n , content\n , date_data as date\n , tag\n , file\n , image_id\n , dtcreate\n , dtupdate\n , deleteflg\nFROM\n hc_file\nWHERE\n ID = %d\n AND deleteflg = %d\n__SQL;\n // get the param for the sql\n $param = array( (int)$id, 0 );\n\n // prepare the sql\n $prepare = $wpdb->prepare( $sql, $param );\n\n // get the result\n $res = $wpdb->get_results( $prepare );\n\n // check if result is empty\n if ( empty( $res ) ) {\n return false;\n }\n\n return $res[0];\n }", "protected function getFile($id) {\n\t\t/* load from database */\n\t\t$data = $this->db->querySingle('SELECT * FROM image WHERE id = \"'.SQLite3::escapeString($id).'\"', true);\n\t\t$path = self::getPath($id);\n\t\tif (!$data || !is_file($path)) {\n\t\t\t/* delete leftovers */\n\t\t\t$this->delete($id);\n\t\t\tthrow new QuicksandException(\"The file you are looking for does not exist (anymore).\");\n\t\t}\n\t\treturn $data + array('path' => $path);\n\t}", "public static function fetchContent($id)\n {\n $file = static::data($id);\n $path = Configure::read('FileApi.basePath') . $file->category . DS . $file->tag . DS . $file->filename;\n\n return file_exists($path) ? file_get_contents($path) : false;\n }", "public function get_file_file($id)\n\t{\n\t\tif (!$this->is_allowed('dokumentasi_tol_update', false)) {\n\t\t\techo json_encode([\n\t\t\t\t'success' => false,\n\t\t\t\t'message' => 'Image not loaded, you do not have permission to access'\n\t\t\t\t]);\n\t\t\texit;\n\t\t}\n\n\t\t$dokumentasi_tol = $this->model_dokumentasi_tol->find($id);\n\n\t\techo $this->get_file([\n 'uuid' => $id, \n 'delete_by' => 'id', \n 'field_name' => 'file', \n 'table_name' => 'dokumentasi_tol',\n 'primary_key' => 'kode_dtl',\n 'upload_path' => 'uploads/dokumentasi_tol/',\n 'delete_endpoint' => 'administrator/dokumentasi_tol/delete_file_file'\n ]);\n\t}", "public function getPathFile($id){\n $sql = \"SELECT pathFile FROM fanart WHERE id=\".intval($id).\";\";\n $res = mysqli_query($this->link, $sql);\n $path = mysqli_fetch_all($res)[0][0];\n return $path;\n }", "function get($file_id) {\r\n\r\n $f3 = \\Base::instance();\r\n\r\n $files_db=new DB\\SQL\\Mapper($f3->get('DB'),'files');\r\n $file=$files_db->load(array('file_id=?',$file_id));\r\n\r\n $out = array(\r\n \"file_id\"=>$file->file_id,\r\n \"version_id\"=>$file->version_id,\r\n \"quality\"=>$file->quality,\r\n \"complete\"=>$file->complete,\r\n \"is_master\"=>$file->is_master,\r\n \"hidden\"=>$file->hidden,\r\n \"filename\"=>$file->filename,\r\n \"path\"=>$file->path, // todo check full_path still exists, is sanitized\r\n \"width\"=>$file->width,\r\n \"height\"=>$file->height,\r\n \"filesize\"=>$file->filesize,\r\n \"filesize_h\"=>format_bytes($file->filesize,0)\r\n );\r\n\r\n return $out;\r\n }", "public static function getPath($id);", "public static function get($id, $contents = false)\n {\n $file = static::data($id);\n $file->path = Configure::read('FileApi.basePath') . $file->category . DS . $file->tag . DS . $file->filename;\n if ($contents !== false) {\n $file->contents = file_get_contents(Configure::read('FileApi.basePath') . $file->category . DS . $file->tag . DS . $file->filename);\n }\n\n return $file;\n }", "function get_detail_files_by_id($params) {\n $sql = \"SELECT * FROM fa_files WHERE data_id = ? AND ref_id = ?\";\n $query = $this->db->query($sql, $params);\n if ($query->num_rows() > 0) {\n $result = $query->row_array();\n $query->free_result();\n return $result;\n } else {\n return array();\n }\n }", "public function getFile($id, array $options = [])\n {\n $path = $this->buildPath(static::FILE_ENDPOINT, [$id]);\n $request = $this->performRequest('GET', $path, ['query' => $options]);\n return $request->data;\n }", "public function getPath($id)\n {\n $sql = \"SELECT p.id, p.\" . $this->descriptor\n . \" FROM \" . $this->table . \" n, \" . $this->table . \" p \"\n . \" WHERE n.lft BETWEEN p.lft AND p.rgt AND n.id = ? ORDER BY p.lft;\";\n\n $sth = $this->db->prepare($sql);\n $sth->setFetchMode(\\PDO::FETCH_OBJ);\n $sth->execute([$id]);\n return $sth->fetch();\n }", "public function getFileById(int $id)\n {\n $sql = \"SELECT files.*, users.name as user_name, users.avatar as user_avatar FROM files LEFT JOIN users on files.user_id = users.id WHERE files.id=:id_bind\";\n $stmt = $this->db->prepare($sql);\n $stmt->bindValue(':id_bind', $id, \\PDO::PARAM_STR);\n $stmt->execute();\n $result = $stmt->fetchAll(\\PDO::FETCH_CLASS, 'Filehosting\\Entity\\File');\n return !empty($result) ? $result[0] : null;\n }", "public function getFullFolderInfoById ($id)\n {\n $fieldMap = $this->getMappableFields(\n array('f' => 'folder_data' , 'ft' => 'folder_type_data'));\n $query = array(\n 'table' => 'folder_data f JOIN folder_type_data ft ON ft.id=f.folder_type_id' ,\n 'fields' => $this->getFieldListFromMap($fieldMap) ,\n 'where' => 'f.id=' . (int) $id);\n $data = $this->getRowFromMappedFields($fieldMap, $this->conn->selectFirst($query));\n if (! count($data)) {\n return array();\n }\n $data['f']['FolderType'] = $data['ft'];\n $data = $data['f'];\n $otData = $this->conn->select(\n array(\n 'table' => 'folder_type_object_type_rel r JOIN object_type_data ot ON ot.id=r.object_type_id' ,\n 'fields' => 'ot.*' ,\n 'where' => 'r.folder_type_id ='.$data['FolderType']['id'],\n ));\n $otIds = array();\n foreach ($otData as $row) {\n $otIds[] = $row['id'];\n }\n if (count($otIds)) {\n $otIds = implode(', ', $otIds);\n $tmp = $this->conn->select(\n array('table' => 'object_type_column_data' ,\n 'where' => \"object_type_id IN ($otIds)\",\n 'orderBy'=>'column_number ASC'));\n } else {\n $tmp = array();\n }\n $columnData = array();\n foreach ($tmp as $row) {\n if (! isset($columnData[$row['object_type_id']])) {\n $columnData[$row['object_type_id']] = array(\n $row);\n } else {\n $columnData[$row['object_type_id']][] = $row;\n }\n }\n foreach($otData as $key=>$row) {\n if (isset($columnData[$row['id']])) {\n $otData[$key]['Columns'] = $columnData[$row['id']];\n } else {\n $otData[$key]['Columns'] = array();\n }\n }\n $data['FolderType']['ObjectTypes'] = $otData;\n return $data;\n }", "public function getOperationsFile($path) {\n\n $operations = array();\n if (isset($this->filesOperations[$path])) {\n foreach ($this->filesOperations[$path] as $operationPath) {\n $operations = array_merge($operations, $this->getOperation($operationPath));\n }\n }\n\n return $operations;\n }", "public static function data($id)\n {\n $filesTable = static::_setupFilesTable();\n $file = $filesTable->get($id);\n if (!empty($file) && is_object($file)) {\n return $file;\n }\n throw new NotFoundException('The Panda was unable to retrieve the requested file.');\n }", "abstract protected function getFileId(string $contextId, string $path, array $meta): string;", "public function getPhotoWithActions($id)\n {\n $queue = $this->getBatchRequest();\n $this->db->batch($queue)->select(\"SELECT * FROM `{$this->domainPhoto}` WHERE itemName()='{$id}'\", array('ConsistentRead' => 'true'));\n $this->db->batch($queue)->select(\"SELECT * FROM `{$this->domainAction}` WHERE targetType='photo' AND targetId='{$id}'\", array('ConsistentRead' => 'true'));\n $responses = $this->db->batch($queue)->send();\n $this->logErrors($responses);\n if(!$responses->areOk())\n return false;\n\n\n if(isset($responses[0]->body->SelectResult->Item))\n $photo = self::normalizePhoto($responses[0]->body->SelectResult->Item);\n\n $photo['actions'] = array();\n foreach($responses[1]->body->SelectResult->Item as $action)\n $photo['actions'][] = $this->normalizeAction($action);\n\n return $photo;\n }", "public static function get($id = null) {\r\n if ($resp = static::external($path)) return $resp;\r\n // get data at node\r\n $data = static::getNodeData();\r\n // get data at id\r\n return static::getDataAtPath($data, $id);\r\n }", "public function getFileById($conn, $id){\n\t\t//preparo lo statement che mi ricava tutti i dati di una determinata informazione \t\t\t\n\t\t$sth = $conn->prepare(\"select * from Filmato_Presentazione where id = :id\");\n\t\t$sth->bindParam(':id', $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\t//voglio solo 1 record\n\t\t$result = $sth->fetch(PDO::FETCH_ASSOC);\n\t\treturn $result;\n\t}", "function fetchModuleFile($id)\n{\n if (!empty($id)) {\n $sql = \"SELECT file FROM modules WHERE id = \";\n $sql .= sql_escape($id);\n $sql .= \" LIMIT 1 \";\n $row = fetchOne($sql);\n }\n return !empty($row) ? $row['file'] : null;\n}" ]
[ "0.6122912", "0.57899487", "0.5669956", "0.56414443", "0.5429236", "0.5341085", "0.5148214", "0.50810665", "0.50503695", "0.5038502", "0.5021061", "0.5015197", "0.49868196", "0.4977295", "0.49487996", "0.49038512", "0.48988613", "0.48793733", "0.48779297", "0.482138", "0.48142946", "0.47469887", "0.47266197", "0.47211304", "0.47101945", "0.47099316", "0.4706921", "0.4696223", "0.4695595", "0.46822754" ]
0.6971008
0
Returns the context dir for the given context id.
protected function getContextDir(string $contextId): string { return $this->rootDir . "/" . CaseTool::toPortableFilename($contextId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getDirectory($id)\n {\n $hash = sha1($id, false);\n $dirs = array(\n $this->getCacheDirectory(),\n substr($hash, 0, 2),\n substr($hash, 2, 2)\n );\n return join(DIRECTORY_SEPARATOR, $dirs);\n }", "protected function getDirectory($id)\n {\n $hash = sha1($id, false);\n $dirs = array(\n $this->getCacheDirectory(),\n substr($hash, 0, 2),\n substr($hash, 2, 2)\n );\n return join(DIRECTORY_SEPARATOR, $dirs);\n }", "public function contextsGet($context_id = '') {\n\t\t// Build the MindTouch API URL to get the contexts.\n\t\t$url = \"contexts\";\n\t\tif (!empty($context_id)) {\n\t\t\t$url .= '/' . $context_id;\n\t\t}\n\n\t\t// Get output from API.\n\t\t$output = $this->get($url);\n\n\t\t// Parse the output.\n\t\t$output = $this->parseOutput($output);\n\n\t\treturn $output;\n\t}", "private function get_category_tree_path($id)\n {\n if ($id === 0)\n {\n $category = Element::get($this->modx, 'modCategory', $id);\n $path = $category->get_property('name');\n }\n\n while ($id !== 0)\n {\n $category = Element::get($this->modx, 'modCategory', $id);\n $path = (isset($path) ? $category->get_property('name') . '/' . $path : $category->get_property('name') . '/');\n $id = $category->get_property('parent');\n }\n\n return $path;\n }", "public function getDirectoryPath($id){\n\n if(!is_string($id) || StringUtils::isEmpty($id)){\n\n throw new UnexpectedValueException('id must be a non empty string');\n }\n\n if(!is_dir($this->_rootPath.DIRECTORY_SEPARATOR.$id)){\n\n throw new UnexpectedValueException('Tmp dir not found : '.$id);\n }\n\n // Get the full path\n return $this->_rootPath.DIRECTORY_SEPARATOR.$id;\n }", "public\n function getContext(\n int $id,\n string $type\n ) {\n $level = \"CONTEXT_\" . strtoupper($type);\n\n return DB::connection('moodle')->table('context')->where('instanceid', $id)->where('contextlevel',\n $this->getConstant($level))->pluck('id')->first();\n }", "public static function getDeviceDirectory($devid)\n\t{\n\t\t$firstLevel = substr(strtolower($devid), -1, 1);\n\t\t$secondLevel = substr(strtolower($devid), -2, 1);\n\n\t\treturn $GLOBALS['egw_info']['server']['files_dir'] . '/activesync/' . $firstLevel . \"/\" . $secondLevel;\n\t}", "public function getContextPath() {\n\t\treturn NodePaths::generateContextPath($this->path, $this->workspace->getName(), $this->getDimensionValues());\n\t}", "private function getDir() {\n return sprintf(\"%s/%s/\", app_path(), config('newportal.portlets.namespace'));\n }", "public function get_image_dir($id)\n {\n $id = abs(intval($id));\n $id = sprintf('%\\'09d', $id);\n $dir1 = substr($id, 0, 3);\n $dir2 = substr($id, 3, 2);\n $dir3 = substr($id, 5, 2);\n\n return $dir1 . '/' . $dir2 . '/' . $dir3 . '/';\n }", "public function fetchContext(string $id): ?Context;", "protected function _dir(): string\n {\n if ($container = $this->_container()) {\n assert($container->hasId());\n return \"{$container}/\" . static::DIR;\n }\n return static::DIR;\n }", "public function getDir() {\n return Yii::getAlias('@static').'/'.$this->module.'/'. $this->parent_id .'/';\n }", "public function getDir();", "function getContextId() {\n\t\treturn $this->_contextId;\n\t}", "protected function get_context() {\n $contextclass = '\\local_elisprogram\\context\\\\'.$this->contextlevel;\n if ($this->contextlevel !== 'system' && class_exists($contextclass)) {\n $id = $this->required_param('id', PARAM_INT);\n return $contextclass::instance($id);\n } else {\n return context_system::instance();\n }\n }", "public static function getPath($id) {\n\t\treturn self::$defaultInstance->getPath($id);\n\t}", "public function getModuleDir()\n {\n return dirname(Mage::getModuleDir('etc', 'Ts_Phpids')) . DS;\n }", "public function retornaCaminhoDoDiretorioPeloId($id) {\n\t\treturn (string) implode(DIRECTORY_SEPARATOR, str_split($id));\n\t}", "protected function getDir()\n {\n $reflectionClass = new \\ReflectionClass(get_class($this));\n return dirname($reflectionClass->getFileName());\n }", "private function get_course_from_context($context_id)\n {\n global $DB;\n\n //retrieve the context from the database, and extract its course ID\n $context = $DB->get_record('context', array('id' => $context_id, 'contextlevel' => CONTEXT_COURSE), 'instanceid');\n\n //return the course ID\n return $context->instanceid;\n }", "public function get_context_id()\n {\n return $this->get_default_property(self::PROPERTY_CONTEXT_ID);\n }", "public function contextsDelete($context_id) {\n\t\t// Build the MindTouch API URL to get the contexts.\n\t\t$url = \"contexts\";\n\t\tif (!empty($context_id)) {\n\t\t\t$url .= '/' . $context_id;\n\t\t}\n\n\t\t// Get output from API.\n\t\t$output = $this->delete($url);\n\n\t\treturn $output;\n\t}", "protected function getTemplateDir(): string\n {\n $dirParts = [\n AutoloaderInterface::MODULES_PATHNAME,\n $this->getModuleContext(),\n 'tpl'\n ];\n\n return implode(DIRECTORY_SEPARATOR, $dirParts);\n }", "public function getDir()\n {\n return $this->dir;\n }", "public function getDir()\n {\n return $this->dir;\n }", "public function getDir()\n {\n return $this->dir;\n }", "public function getDir()\n {\n return $this->dir;\n }", "public function getDir()\n {\n return $this->dir;\n }", "public function getDir()\n {\n return $this->dir;\n }" ]
[ "0.6628162", "0.6628162", "0.56003535", "0.55993193", "0.5515558", "0.54561937", "0.5429322", "0.5415443", "0.5316108", "0.5307999", "0.5287511", "0.5282807", "0.52705836", "0.5263187", "0.5242585", "0.52309644", "0.5218218", "0.5201452", "0.51810694", "0.5169915", "0.5129694", "0.51106673", "0.5110209", "0.50883293", "0.5058193", "0.5058193", "0.5058193", "0.5058193", "0.5058193", "0.5058193" ]
0.7305059
0
Creates the operations.byml file if necessary (for the given context id) and returns its path.
protected function getOperationsFile(string $contextId): string { $opFile = $this->getContextDir($contextId) . "/operations.byml"; if (false === file_exists($opFile)) { $ops = []; BabyYamlUtil::writeFile($ops, $opFile); } return $opFile; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function doGetEntryRealPathByOperation(string $contextId, array $operation, array $options = [])\n {\n return $this->getContextDir($contextId) . \"/files/\" . $operation['path'];\n }", "protected function addEntry(string $contextId, string $id, ?string $path, array $meta, array $options = []): array\n {\n if (null !== $path) {\n $path = $this->getRealPath($path);\n }\n\n $type = $options['type'] ?? 'add';\n $useMove = (bool)($options['move'] ?? false);\n\n\n $opFile = $this->getContextDir($contextId) . \"/operations.byml\";\n $ops = [];\n if (true === file_exists($opFile)) {\n $ops = BabyYamlUtil::readFile($opFile);\n }\n\n\n if (null !== $path) {\n\n $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta);\n $dst = $this->getContextDir($contextId) . \"/files/\" . $relPath;\n if ($path !== $dst) {\n if (true === $useMove) {\n FileSystemTool::move($path, $dst);\n } else {\n FileSystemTool::copyFile($path, $dst);\n }\n }\n } else {\n $relPath = null;\n $dst = null;\n }\n\n\n $addOperation = [\n 'type' => $type,\n 'id' => $id,\n 'path' => $relPath,\n 'meta' => $meta,\n ];\n\n\n //--------------------------------------------\n // ADDING THE OPERATION (see heuristic notes for more details)\n //--------------------------------------------\n $found = false;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $found = true;\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n $ops[$k] = $addOperation;\n break;\n default:\n $this->error(\"Operation \\\"$type\\\" rejected. You cannot add this entry because it already exists with type=\\\"$type\\\" for id \\\"$id\\\".\");\n break;\n }\n }\n }\n\n\n if (false === $found) {\n $op = $addOperation;\n }\n $this->onFileAddedAfter($contextId, $op, $path, $dst, $options);\n if (false === $found) {\n $ops[] = $op;\n } else {\n $ops[$k] = $op;\n }\n\n\n BabyYamlUtil::writeFile($ops, $opFile);\n\n\n return $op;\n }", "abstract protected function getFileId(string $contextId, string $path, array $meta): string;", "protected function createFile() {}", "protected function createPathIfNeeded() {}", "protected function getRawOperations(string $contextId): array\n {\n\n $ret = [];\n $opFile = $this->getContextDir($contextId) . \"/operations.byml\";\n if (true === file_exists($opFile)) {\n return BabyYamlUtil::readFile($opFile);\n }\n return $ret;\n }", "function get_new_file($id_progetto) {\n return sys_get_temp_dir() . DIRECTORY_SEPARATOR . \"ReportQuestionariProgetto-\" . str_pad($id_progetto, 4, '0', STR_PAD_LEFT) . \".xlsx\";\n }", "function createXMLFile($obj, $elementContent)\r\n {\r\n global $DB, $CFG;\r\n\r\n $msmRecord = $DB->get_record(\"msm\", array(\"id\" => $obj->msmid));\r\n $msmtrimName = preg_replace(\"/\\s+/\", '', $msmRecord->name);\r\n $CompDir = $CFG->dataroot . \"/temp/msmtempfiles/$msmtrimName$msmRecord->id/standalones/\";\r\n\r\n $elementType = '';\r\n switch (get_class($obj))\r\n {\r\n case \"ExportDefinition\":\r\n $elementType = \"definition\";\r\n break;\r\n case \"ExportTheorem\":\r\n $elementType = \"theorem\";\r\n break;\r\n case \"ExportComment\":\r\n $elementType = \"comment\";\r\n break;\r\n }\r\n\r\n // standalone folder already exists\r\n if (file_exists($CompDir))\r\n {\r\n // if the directory exists, there is a possibility that the same reference\r\n // was already exported --> so check if XML file with same content exists\r\n $existingCompid = $this->checkForSameFile($CompDir, $obj);\r\n\r\n if (!empty($existingCompid))\r\n {\r\n return $existingCompid;\r\n }\r\n if (!empty($obj->caption))\r\n {\r\n $captionTrim = strip_tags($obj->caption);\r\n $captionTrim = preg_replace(\"/\\s+/\", '', $captionTrim);\r\n // need to remove any non-alphanumeric characters from caption\r\n $captionmod = preg_replace(\"/[^A-Za-z0-9]/\", '', $captionTrim);\r\n $filename = $CompDir . $captionmod . \"-$elementType-\" . $obj->compid . \".xml\";\r\n }\r\n else if (!empty($obj->type))\r\n {\r\n $filename = $CompDir . $obj->type . \"-$elementType-\" . $obj->compid . \".xml\";\r\n }\r\n }\r\n else\r\n {\r\n // need to make a standalone folder\r\n if (mkdir($CompDir))\r\n {\r\n if (!empty($obj->caption))\r\n {\r\n $captionTrim = strip_tags($obj->caption);\r\n $captionTrim = preg_replace(\"/\\s+/\", '', $captionTrim);\r\n $captionmod = preg_replace(\"/[^A-Za-z0-9]/\", '', $captionTrim);\r\n $filename = $CompDir . $captionmod . \"-$elementType-\" . $obj->compid . \".xml\";\r\n }\r\n else if (!empty($obj->type))\r\n {\r\n $filename = $CompDir . $obj->type . \"-$elementType-\" . $obj->compid . \".xml\";\r\n }\r\n }\r\n else\r\n {\r\n echo \"error with creating standalone folder\";\r\n }\r\n }\r\n\r\n if ($xmlfile = fopen($filename, \"w\"))\r\n {\r\n fwrite($xmlfile, $elementContent);\r\n fclose($xmlfile);\r\n return false;\r\n }\r\n else\r\n {\r\n echo json_encode(\"error\");\r\n }\r\n }", "function __getModelFile($modelId)\n {\n $modelDir = dirname(dirname(dirname(__FILE__))) . DS . 'models';\n return $modelDir . DS . $modelId . '_service.php';\n }", "protected function onFileAddedAfter(string $contextId, array &$operation, ?string $path, ?string $dst, array $options = [])\n {\n\n }", "protected function _generateFilePath() {\n\t\treturn self::normalPaths(\n\t\t\tMage::getBaseDir(),\n\t\t\tMage::helper('pepperjam_network/config', $this->getStore())->getExportFilePath(),\n\t\t\t$this->_getFileName()\n\t\t);\n\t}", "public function getWritePath();", "public function crear(){\n\t\t$this->archivo = fopen($this->nombre , \"w+\");\n\t}", "public function getOperationContext();", "public function createFile()\n {\n return $this->addExcludesNameEntry($this->files);\n }", "public function save()\n {\n if (file_exists($this->_filePath)) {\n $existingFile = file_get_contents($this->_filePath, FILE_USE_INCLUDE_PATH);\n $this->_template = str_replace(\"</routes>\", $this->_template, $existingFile);\n } else {\n $atTheStart = '<?xml version=\"1.0\"?>\n<routes xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:module:Magento_Webapi:etc/webapi.xsd\">';\n $this->_template = $atTheStart . $this->_template;\n }\n\n parent::save();\n return $this;\n }", "protected function outPutTmpFile() {\r\n\t\t$dir = XOOPS_TRUST_PATH.'/tmp';\r\n\t\t$path = $dir.'/'.mt_rand().\"_\".time().'_collabtrans.xml';\r\n\t\t$fp = fopen($path, \"w\");\r\n\t\tfwrite($fp, $this -> toXML());\r\n\t\tfclose($fp);\r\n\r\n\t\treturn $path;\r\n\t}", "private function constructFilePath()\r\n {\r\n $this->filePath = MENU_PATH . \"/\" . $this->nameOfJson . \".json\";\r\n }", "public function getPath($id);", "protected static function getPath($id) {\n\t\treturn self::FILES_DIR.DIRECTORY_SEPARATOR.$id;\n\t}", "public function getPath(){\n $ext = $this->getExt();\n $filename = $this->id.'.'.$ext;\n return str_replace( $filename, '', $this->filename ); \n }", "public static function getLocalPath($id)\n {\n $file = static::data($id);\n $path = Configure::read('FileApi.basePath') . $file->category . DS . $file->tag . DS . $file->filename;\n\n return file_exists($path) ? $path : false;\n }", "public function generate() {\n if (!$this->filePath) {\n throw new Exception('Trying to save file without path');\n }\n \n $tempDir = codemonkey_pathTempDir;\n \n $content = $this->generateCode();\n \n $this->checkIfTempFolderExists();\n $this->checkIfFoldersExist();\n \n try {\n $fp = fopen($tempDir.$this->filePath, 'w');\n fputs($fp, $content);\n fclose($fp);\n chmod($tempDir.$this->filePath, 0775);\n } catch (Exception $e) {\n echo \"Could not generate file \".$this->filePath.\"<br />\\n\"\n . $e->getMessage().\"<br />\\n\";\n }\n }", "protected function updateEntry(string $contextId, string $id, ?string $path, array $meta, array $options = [])\n {\n if (null !== $path) {\n $path = $this->getRealPath($path);\n }\n\n $opFile = $this->getOperationsFile($contextId);\n $ops = BabyYamlUtil::readFile($opFile);\n $useMove = (bool)($options['move'] ?? false);\n\n\n $found = false;\n foreach ($ops as $k => $op) {\n if ($id === $op['id']) {\n $found = true;\n\n\n $meta = array_merge($op[\"meta\"], $meta);\n\n\n if (null !== $path) {\n\n\n $relPath = $this->getFileRelativePath($contextId, $id, $path, $meta);\n $dst = $this->getContextDir($contextId) . \"/files/\" . $relPath;\n\n if ($path !== $dst) {\n if (true === $useMove) {\n FileSystemTool::move($path, $dst);\n } else {\n FileSystemTool::copyFile($path, $dst);\n }\n }\n } else {\n $relPath = null;\n $dst = null;\n }\n\n\n $type = $op['type'];\n switch ($type) {\n case \"add\":\n case \"update\":\n $op['meta'] = $meta;\n\n\n /**\n * The bottom line is that in the vfs entry, the path must be set (i.e. not null).\n * We allow for the user to pass path=null for an \"update\" action, for performances reasons, which means that the user\n * didn't change the file but might have updated the meta; however we still need to set the path\n * in the vfs entry.\n *\n * Therefore if the user passes path=null, we don't update the path (we keep the existing one)\n */\n if (null !== $relPath) {\n $op['path'] = $relPath;\n }\n $ops[$k] = $op;\n break;\n case \"remove\":\n $ops[$k] = [\n \"type\" => \"update\",\n \"id\" => $id,\n \"path\" => $relPath,\n \"meta\" => $meta,\n ];\n break;\n }\n\n\n break;\n }\n }\n\n if (false === $found) {\n return $this->addEntry($contextId, $id, $path, $meta, array_merge($options, [\n \"type\" => \"update\",\n ]));\n } else {\n // we only call this when a file has been really added to our vfs\n $this->onFileAddedAfter($contextId, $op, $path, $dst, $options);\n\n $ops[$k] = $op;\n $ops = array_merge($ops);\n BabyYamlUtil::writeFile($ops, $opFile);\n return $op;\n }\n }", "protected function _getPath()\n {\n if (!empty($this->_path)) {\n return $this->_path;\n }\n\n $id = $this->_config['id'];\n $dir0 = $id % 10000;\n $dir1 = $dir0 % 100;\n $dir2 = $dir0 - $dir1 * 100;\n if ($dir2 < 0) {\n $dir2 = 0;\n }\n $path = 'apps/';\n\n switch ($this->_config['section']) {\n case 1 :\n $path .= 'scripteditor/' . $dir2 . '/' . $dir1 . '/';\n break;\n \tcase 2 :\n $path .= 'slave/' . $dir2 . '/' . $dir1 . '/';\n break;\n default :\n $path .= 'tmp/';\n break;\n }\n $this->_path = $path;\n return $this->_path;\n }", "public function createFile(string $typeOfLayer, string $fileName, String $content, bool $isContract = false) : bool;", "function features_command_export() {\n $args = func_get_args();\n\n if (count($args) == 1) {\n // Assume that the user intends to create a module with the same name as the\n // \"value\" of the context.\n $context = array_shift($args);\n _features_command_export(array($context));\n }\n elseif (count($args) > 1) {\n // Assume that the user intends to create a new module based on a list of \n // contexts. First argument is assumed to be the name.\n $name = array_shift($args);\n _features_command_export($args, $name);\n }\n else {\n // By default just show contexts that are available.\n $rows = array(array(dt('Available contexts')));\n foreach (context_enabled_contexts() as $k => $c) {\n $rows[] = array(\"{$c->namespace}-{$c->attribute}-{$c->value}\");\n }\n drush_print_table($rows, 2, true);\n }\n}", "public function setOperationId($var)\n {\n GPBUtil::checkString($var, True);\n $this->operation_id = $var;\n\n return $this;\n }", "private function mk_paths(string $id) {\n\t\t$this->dir_path = LIBRESIGNAGE_ROOT.SLIDES_DIR.'/'.$id;\n\t\t$this->conf_path = $this->dir_path.'/conf.json';\n\t\t$this->asset_path = $this->dir_path.'/assets';\n\t}", "public function save()\r\n {\r\n $module = Yii::$app->controller->module;\r\n if ($this->operation === self::OP_OVERWRITE) {\r\n $dir = dirname($this->path);\r\n if (!is_dir($dir)) {\r\n $mask = @umask(0);\r\n $result = @mkdir($dir, $module->newDirMode, true);\r\n @umask($mask);\r\n if (!$result) {\r\n return \"Unable to create the directory '$dir'.\";\r\n }\r\n }\r\n }\r\n if (@file_put_contents($this->path, $this->content) === false) {\r\n return \"Unable to write the file '{$this->path}'.\";\r\n }\r\n\r\n return true;\r\n }" ]
[ "0.54305196", "0.53098416", "0.5243714", "0.51919615", "0.49407333", "0.48862344", "0.4839997", "0.48362857", "0.4762411", "0.46823785", "0.46757445", "0.46458334", "0.463639", "0.4614914", "0.4492277", "0.44777828", "0.44698673", "0.44611558", "0.44294965", "0.4426375", "0.44233593", "0.4405015", "0.44013035", "0.4392272", "0.43851838", "0.43826988", "0.43736583", "0.43705046", "0.43496162", "0.434683" ]
0.7465523
0
Hook called after the file has been added to the virtual file system. operation is the entry representing the file operation. path is the absolute path to the source file being copied; dst is the absolute path to the copied file.
protected function onFileAddedAfter(string $contextId, array &$operation, ?string $path, ?string $dst, array $options = []) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function onFileRemovedAfter(string $contextId, string $id, ?array $op, ?string $realpath)\n {\n\n }", "function addFile($path)\n {\n }", "protected function _after_save(){\n if(file_exists($this->_path))\n $this->_path_infos = pathinfo($this->_path);\n }", "function _stageFile() {\n\t\t$this->_moveFile($this->_processingPath, $this->_stagePath, $this->_claimedFilename);\n\t}", "public function add(){\n\t\t\n\t\t// Open or create file\n\t\t$f = fopen($this->file, 'wb');\n\t\tfclose($f);\n\t}", "protected function onMove(){\n\t\tif (empty($this->post['directory']) || empty($this->post['file'])) return;\n\t\t\n\t\t$rename = empty($this->post['newDirectory']) && !empty($this->post['name']);\n\t\t$dir = $this->getDir($this->post['directory']);\n\t\t$file = realpath($dir . '/' . $this->post['file']);\n\t\t\n\t\t$is_dir = is_dir($file);\n\t\tif (!$this->checkFile($file) || (!$rename && $is_dir))\n\t\t\treturn;\n\t\t\n\t\tif ($rename || $is_dir){\n\t\t\tif (empty($this->post['name'])) return;\n\t\t\t$newname = $this->getName($this->post['name'], $dir);\n\t\t\t$fn = 'rename';\n\t\t}else{\n\t\t\t$newname = $this->getName(pathinfo($file, PATHINFO_FILENAME), $this->getDir($this->post['newDirectory']));\n\t\t\t$fn = !empty($this->post['copy']) ? 'copy' : 'rename';\n\t\t}\n\t\t\n\t\tif (!$newname) return;\n\t\t\n\t\t$ext = pathinfo($file, PATHINFO_EXTENSION);\n\t\tif ($ext) $newname .= '.' . $ext;\n\t\t$fn($file, $newname);\n\t\t\n\t\techo json_encode(array(\n\t\t\t'name' => pathinfo($this->normalize($newname), PATHINFO_BASENAME),\n\t\t));\n\t}", "private static function add_file($project, $entry, $base, $path_info) {\n if ($entry->attributes()->kind != 'file' )\n return;\n $path = (string) $entry->name;\n $link = $base . $path;\n $size = intval((string) $entry->size);\n\n $file = new File($path, $link, $size);\n $file->info = $path_info[$path];\n\n $project->files[] = $file;\n }", "function hook_file_operations() {\n $operations = array(\n 'delete' => array(\n 'label' => t('Delete selected files'),\n 'callback' => NULL,\n ),\n );\n return $operations;\n}", "function addFile($path, $whitespace = true) {\n\t\t$this->_items[] = array('file', $path, $whitespace);\n\n\t\t$mtime = @filemtime($path);\n\n\t\tif ($mtime > $this->_lastUpdate)\n\t\t\t$this->_lastUpdate = $mtime;\n\t}", "function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)\n {\n }", "function privAddFile($p_filedescr, &$p_header, &$p_options)\n {\n }", "public function copy($path, $newpath)\n {\n }", "function insertFile ($filename, $origname='', $extraData='')\n{\n if (!$filename)\n v4b_exit ('Invalid filename passed to IbUtil::insertFile ...');\n\n if ($origname)\n $ext = FileUtil::getExtension ($origname);\n else\n $ext = FileUtil::getExtension ($filename);\n\n $data = '';\n $err = '';\n $cmd = '';\n global $v4bConfig;\n $txtFile = $v4bConfig['V4B_FILE_TMP_PATH'] . '/' . FileUtil::getBasename($filename) . '.txt';\n if ($ext == 'txt')\n $txtFile = $filename;\n else if ($ext == 'doc')\n $cmd = \"/usr/local/bin/antiword \\\"$filename\\\" > \\\"$txtFile\\\"\";\n else if ($ext == 'pdf')\n $cmd = \"pdftotext \\\"$filename\\\" \\\"$txtFile\\\"\";\n else if ($ext == 'ps')\n $cmd = \"ps2ascii \\\"$filename\\\" \\\"$txtFile\\\"\";\n else \n return -1;\n\n $rc = system ($cmd, $err);\n if ($err)\n return -1;\n\n $fp = fopen ($txtFile, \"a\");\n $swrite = \"\\nextraData\\n\";\n @fwrite ($fp, $swrite);\n fclose ($fp);\n\n $data = FileUtil::readFile ($txtFile);\n @unlink ($txtFile);\n\n if ($data)\n return IbUtil::insert ($data);\n\n return -1;\n}", "private function add_file()\n {\n \t$helperPluginManager = $this->getServiceLocator();\n \t$serviceManager = $helperPluginManager->getServiceLocator();\n \t\n \t$file = $serviceManager->get('PM/Model/Files');\n \t\n \t$result = $file->getFileById($this->pk);\n \tif($result)\n \t{\n \t\tif($result['company_name'] != '' && $result['company_id'] && $result['company_id'] > 0)\n \t\t{\n \t\t\t$company_url = $this->view->url('companies/view', array('company_id' => $result['company_id']));\n \t\t\t$this->add_breadcrumb($company_url, $result['company_name']);\n \t\t}\n \t\t\n \t\tif($result['project_name'] != '' && $result['project_id'] && $result['project_id'] > 0)\n \t\t{ \t\t\n \t\t\t$project_url = $this->view->url('projects/view', array('project_id' => $result['project_id']));\n \t\t\t$this->add_breadcrumb($project_url, $result['project_name']);\n \t\t}\n \t\t\n \t\tif($result['task_name'] != '' && $result['task_id'] && $result['task_id'] > 0)\n \t\t{\n \t\t\t$task_url = $this->view->url('tasks/view', array('task_id' => $result['task_id']));\n \t\t\t$this->add_breadcrumb($task_url, $result['task_name']);\n \t\t}\n \t\t\n \t\t$file_url = $this->view->url('pm', array('module' => 'pm','controller' => 'files','action'=>'view', 'id' => $result['file_id']), null, TRUE);\n \t\t$this->add_breadcrumb($file_url, 'File: '.$result['name'], TRUE); \t\t\n \t}\n }", "function _archiveFile() {\n\t\t$this->_moveFile($this->_processingPath, $this->_archivePath, $this->_claimedFilename);\n\t}", "public function copy($path, $target)\n {\n \n }", "public function addFile($file);", "public function addFile($path)\n {\n $this->files[] = $path;\n }", "private function writeFile($stub)\n {\n $this->files->put($this->path, $stub);\n }", "public function addPath($path);", "public function addPath($path);", "private function setFileUsage($migration_id, $uri, $operation) {\n $files = $this->entityTypeManager()\n ->getStorage('file')\n ->loadByProperties(['uri' => $uri]);\n foreach ($files as $file) {\n $this->fileUsage->{$operation}(\n $file,\n 'jcc_migrate_source_ui',\n 'migration',\n $migration_id\n );\n }\n }", "protected function add($name, $value){\r\n $this->file->{\"$this->command\"}($this->handler, $name, $value);\r\n }", "function _addFile( $isVirtual, &$sourceNameOrData, $targetName )\n\t{\n\t\t// Are we connected to a server?\n\t\tif(!is_resource($this->_ftphandle))\n\t\t{\n\t\t\tif(!$this->_connectFTP()) return false;\n\t\t}\n\n\t\t// See if it's a directory\n\t\t$isDir = $isVirtual ? false : is_dir($sourceNameOrData);\n\n\t\tif($isDir)\n\t\t{\n\t\t\t// Just try to create the remote directory\n\t\t\treturn $this->_makeDirectory($targetName);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// We have a file we need to upload\n\t\t\tif($isVirtual)\n\t\t\t{\n\t\t\t\t// Create a temporary file, upload, rename it\n\t\t\t\t$tempFileName = JoomlapackCUBETempfiles::createRegisterTempFile();\n\t\t\t\tif(function_exists('file_put_contents'))\n\t\t\t\t{\n\t\t\t\t\tif(@file_put_contents($tempFileName, $sourceNameOrData) === false)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->setError('Could not upload virtual file '.$targetName);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t$res = $this->_upload($tempFileName, $targetName);\n\t\t\t\t\tJoomlapackCUBETempfiles::unregisterAndDeleteTempFile($tempFileName, true);\n\t\t\t\t\treturn $res;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Upload a file\n\t\t\t\treturn $this->_upload($sourceNameOrData, $targetName);\n\t\t\t}\n\t\t}\n\t}", "public function copy($targetPath, $handlerObj = NULL, $handlerMethod = NULL) {\n $this->fileService->copyFile( $this->path, $targetPath, $handlerObj, $handlerMethod );\n }", "protected function processChangedAndNewFiles() {}", "private function add_to_uploaded_files($filearea, $path, $filename) {\n $this->uploaded_files[$filearea][] = [\n 'path' => $path,\n 'filename' => $filename,\n ];\n }", "function tc_file_system_copy($source, $destination, $overwrite = false, $mode = false){\r\n\t\r\n\t//initialize processed files object\r\n\t$processed_files = WPTC_Factory::get('processed-restoredfiles',true);\r\n\t$current_processed_files = array();\r\n\t\r\n\tglobal $wp_filesystem;\r\n\tif($wp_filesystem->method == 'direct'){\r\n\t\t// check if already processed ; if so dont copy\r\n\t\t$processed_file = $processed_files->get_file($source);\r\n\t\t//file_put_contents(WP_CONTENT_DIR .'/DE_clientPluginSIde.php',\"\\n -----processed_file obj------- \".var_export($processed_file,true).\"\\n\",FILE_APPEND);\r\n\t\tif ( !($processed_file) ) {\r\n\t\t\t$copy_result = $wp_filesystem->move($source, $destination, $overwrite, $mode);\r\n\t\t\tif($copy_result)\r\n\t\t\t{\r\n\t\t\t\t//file_put_contents(WP_CONTENT_DIR .'/DE_clientPluginSIde.php',\"\\n ----adding details--------\\n\",FILE_APPEND);\r\n\t\t\t\t//if copied then add the details to DB\r\n\t\t\t\t$this_file_detail['file'] = $source;\r\n\t\t\t\t$this_file_detail['copy_status'] = true;\r\n\t\t\t\t$this_file_detail['revision_number'] = null;\r\n\t\t\t\t$this_file_detail['revision_id'] = null;\r\n\t\t\t\t$this_file_detail['mtime_during_upload'] = null;\r\n\t\t\t\t\r\n\t\t\t\t$current_processed_files[] = $this_file_detail;\r\n\t\t\t\t//file_put_contents(WP_CONTENT_DIR .'/DE_clientPluginSIde.php',\"\\n -----current_processed_files------- \".var_export($current_processed_files,true).\"\\n\",FILE_APPEND);\r\n\t\t\t\t$processed_files->add_files($current_processed_files);\t\r\n\t\t\t\t//file_put_contents(WP_CONTENT_DIR .'/DE_clientPluginSIde.php',\"\\n ---any sql error------ \".var_export(mysql_error(),true).\"\\n\",FILE_APPEND);\r\n\t\t\t\t//set the in_progress option to false on final file copy\r\n\t\t\t}\r\n\t\t\treturn $copy_result;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\telseif($wp_filesystem->method == 'ftpext' || $wp_filesystem->method == 'ftpsockets'){\r\n\t\tif ( ! $overwrite && $wp_filesystem->exists($destination) )\r\n\t\t\treturn false;\r\n\t\t//$content = $this->get_contents($source);\r\n//\t\tif ( false === $content)\r\n//\t\t\treturn false;\r\n\t\t\t\r\n\t\t//put content\t\r\n\t\t//$tempfile = wp_tempnam($file);\r\n\t\t$source_handle = fopen($source, 'r');\r\n\t\tif ( ! $source_handle )\r\n\t\t\treturn false;\r\n\r\n\t\t//fwrite($temp, $contents);\r\n\t\t//fseek($temp, 0); //Skip back to the start of the file being written to\r\n\t\t\r\n\t\t$sample_content = fread($source_handle, (1024 * 1024 * 2));//1024 * 1024 * 2 => 2MB\r\n\t\tfseek($source_handle, 0); //Skip back to the start of the file being written to\r\n\r\n\t\t$type = $wp_filesystem->is_binary($sample_content) ? FTP_BINARY : FTP_ASCII;\r\n\t\tunset($sample_content);\r\n\t\tif($wp_filesystem->method == 'ftpext'){\r\n\t\t\t$ret = @ftp_fput($wp_filesystem->link, $destination, $source_handle, $type);\r\n\t\t}\r\n\t\telseif($wp_filesystem->method == 'ftpsockets'){\r\n\t\t\t$wp_filesystem->ftp->SetType($type);\r\n\t\t\t$ret = $wp_filesystem->ftp->fput($destination, $source_handle);\r\n\t\t}\r\n\r\n\t\tfclose($source_handle);\r\n\t\tunlink($source);//to immediately save system space\r\n\t\t//unlink($tempfile);\r\n\r\n\t\t$wp_filesystem->chmod($destination, $mode);\r\n\r\n\t\treturn $ret;\r\n\t\t\r\n\t\t//return $this->put_contents($destination, $content, $mode);\r\n\t}\r\n}", "function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)\n {\n }", "public function afterSave()\n {\n if (!$this->files) {\n return;\n } else if ($this->contentAttribute) {\n $this->owner->updateAttributes([$this->contentAttribute => $this->processContentFiles(true)['content']]);\n } else {\n /** @var UploadedFile $file */\n foreach ($this->files as $key => $file) {\n $this->files[$key] = $this->saveFile($file->tempName, $file->name);\n }\n }\n $this->setAttributeValue(\\array_map(function($v){ return basename($v); }, array_filter($this->files)));\n }" ]
[ "0.561931", "0.5439367", "0.5304523", "0.51962525", "0.5189412", "0.51107407", "0.5094557", "0.50640947", "0.5060068", "0.5046373", "0.4997068", "0.4968944", "0.49438724", "0.49374127", "0.49186742", "0.4867372", "0.4864451", "0.48184586", "0.47963086", "0.47740966", "0.47740966", "0.47729197", "0.4771095", "0.4721762", "0.4716923", "0.47158498", "0.4706279", "0.47019076", "0.4694898", "0.4692461" ]
0.6951877
0
Hook called after the file has been removed from the virtual file system. id: the file identifier op: the operation if one was deleted, or null otherwise realpath: the realpath of the deleted file if one was deleted, or null otherwise
protected function onFileRemovedAfter(string $contextId, string $id, ?array $op, ?string $realpath) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function removeFile(int $id): void\n {\n $stmt = $this->db->prepare(\"DELETE FROM comments WHERE file_id=:id_bind\");\n $stmt->bindValue(':id_bind', $id, \\PDO::PARAM_INT);\n $stmt->execute();\n\n $stmt = $this->db->prepare(\"DELETE FROM files WHERE id=:id_bind\");\n $stmt->bindValue(':id_bind', $id, \\PDO::PARAM_INT);\n $stmt->execute();\n }", "function photo_cache_cleanup_by_id($id)\n{\n\t$result=$GLOBALS['db']->Execute(\"SELECT filename FROM \".PREFIX.\"photo_cache WHERE photo_id='\".linpha_addslashes($id).\"'\");\n\n\twhile($row=$result->FetchRow())\n\t{\n\t\t$file2del = get_full_path($row[0]);\n\t\tif(!@unlink($file2del)) {\n\t\t\tif(file_exists($file2del)) {\n\t\t\t\terror_log(\"photo_cache_cleanup_by_id unable to delete file: \".$file2del);\n\t\t\t}\n\t\t}\n\t}\n\t$GLOBALS['db']->Execute(\"DELETE FROM \".PREFIX.\"photo_cache WHERE photo_id='\".linpha_addslashes($id).\"'\");\n}", "public function delete($id) {\n try {\n $this->pdo->beginTransaction();\n // select the file data from the database\n $stmt = $this->pdo->prepare('SELECT file_data '\n . 'FROM company_files '\n . 'WHERE id=:id');\n $stmt->execute([$id]);\n $stmt->bindColumn('file_data', $fileData, \\PDO::PARAM_STR);\n $stmt->closeCursor();\n \n // delete the large object\n $this->pdo->pgsqlLOBUnlink($fileData);\n $stmt = $this->pdo->prepare(\"DELETE FROM company_files WHERE id = :id\");\n $stmt->execute([$id]);\n \n $this->pdo->commit();\n } catch (\\Exception $e) {\n $this->pdo->rollBack();\n throw $e;\n }\n }", "protected function delete($id) {\n\t\t@unlink(self::getPath($id));\n\t\t$this->db->exec(\"DELETE FROM image WHERE id = '\".SQLite3::escapeString($id).\"'\");\n\t}", "public function destroy($id)\n {\n Myfile::find($id)->delete();\n }", "public function hook_after_delete($id)\n\t{\n\t\t//Your code here\n\n\t}", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public static function delete($id)\n {\n DB::StartTrans();\n if (!is_numeric($id)) {\n $id = self::get_storage_id_by_link($id, false);\n }\n if ($id) {\n DB::Execute('UPDATE utils_filestorage SET deleted=1 WHERE id=%d', array($id));\n }\n DB::CompleteTrans();\n }", "public static function delete_photo($id){\n global $db;\n $row = static::find_photo($id);\n $k78sql = \"DELETE FROM photos WHERE photo_id = '\".$id.\"'\";\n try {\n //check if photo is present in database\n if($db->query($sql)){\n //$row = static::find_photo($id);\n //deletes file in image path\n unlink(IMG_PATH.DS.$row['file_name']);\n //deleting photo from database table\n $db->exec($sql);\n return 'Photo with ID '.$id.' deleted from DB';\n }else{\n throw new Exception(\"File could not be deleteed\");\n }\n } catch (Exception $e) {\n return $e;\n }\n }", "public function hook_after_delete($id) {\n\n }", "public function delete($id)\n\t{\n\n\t\t $document = Efile::where('id',$id)->first();\n //delete the file from the server\n\n // Storage::delete($document->path);\n $storagePath = Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix();\n\t\tif(file_exists($storagePath.$document->path)){\n\t\t unlink($storagePath.$document->path);\n\t\t}\n\t\t\n $document->delete($id);\n\n\t}", "public function removeFile($id,$filelocation) {\n $this->deleteFile($id,$filelocation);\n }", "public function delete($id) \n\t{\n \t$tot = $this->Model_photo->photo_check($id);\n \tif(!$tot) {\n \t\tredirect(base_url().'admin/photo');\n \texit;\n \t}\n\n $data['photo'] = $this->Model_photo->getData($id);\n if($data['photo']) {\n unlink('./public/uploads/'.$data['photo']['photo_name']);\n }\n\n $this->Model_photo->delete($id);\n redirect(base_url().'admin/photo');\n }", "function fileRemove($fileId){\n\tinclude '../../database.php';\n\n\t$stmt = $conn->prepare(\"SELECT * FROM file WHERE file_id=?\");\n\t$stmt->execute(array($fileId));\n\t$filelocation = $stmt->fetch(PDO::FETCH_ASSOC);\n\t$filelocation = $_SERVER[\"DOCUMENT_ROOT\"] . $filelocation;\n\n\tunlink($filelocation);\n\n\t$stmt = $conn->prepare(\"DELETE FROM file WHERE file_id=?\");\n\t$stmt->execute(array($fileId));\n}", "function removeFile($iaf_id)\n {\n $iaf_id = Misc::escapeInteger($iaf_id);\n $stmt = \"DELETE FROM\n \" . APP_DEFAULT_DB . \".\" . APP_TABLE_PREFIX . \"issue_attachment_file\n WHERE\n iaf_id=\" . $iaf_id;\n $res = DB_Helper::getInstance()->query($stmt);\n if (PEAR::isError($res)) {\n Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);\n return -1;\n }\n }", "public function on_delete() {\n $this->remove_dir();\n }", "public function delete($id) {\n\t\t$fileName= $this->Partner->field('image',$id);\n\t\t//create and new file varalbe to be used by the file utility for deletion\n\t\t$file = new File(WWW_ROOT . $fileName, false, 0777);\n if ($this->request->is('get')) {\n throw new MethodNotAllowedException();\n }\n //deleted the field then run the record delection from the database\n if($this->Partner->delete($id)) {\n\t\t$file->delete();\n\t\t return $this->redirect(array('action' => 'index'));\n \n }\n}", "protected function deleteFile($id, $filelocation){\n $sql = \"DELETE FROM satdatameta WHERE idSatDataMeta = ?;\n DELETE FROM satdata WHERE idSatMetaData = ?\";\n $stmt = $this->connect()->prepare($sql);\n \n if ($stmt->execute([$id,$id])) {\n unlink($filelocation);\n header('Location:../pages/dashboard.php?status=filedeletesuccess');\n exit();\n } else {\n header('Location:../pages/dashboard.php?status=filedeletefailed');\n exit();\n }\n }", "function delete_file() {\n $is_logged_in = $this->common_lib->is_logged_in();\n if ($is_logged_in == FALSE) {\n\t\t\t$this->session->set_userdata('sess_post_login_redirect_url', current_url());\n if($this->data['is_admin'] === TRUE){\n redirect($this->router->directory.'admin/login');\n }else{\n redirect($this->router->directory.'user/login');\n }\n }\n\n $id = $this->input->get_post('id');\n $file_path = $this->input->get_post('file_path');\n if ($id) {\n $where_array = array('id' => $id);\n $res = $this->user_model->delete($where_array, 'uploads');\n if ($res) {\n $this->common_lib->unlink_file(array(FCPATH . $file_path));\n }\n echo json_encode(\"success\");\n } else {\n echo json_encode(\"error\");\n }\n }", "function Trigger_FileDelete2(&$tNG) {\r\r\n $deleteObj = new tNG_FileDelete($tNG);\r\r\n $deleteObj->setFolder(\"../assets/images/magasins/\");\r\r\n $deleteObj->setDbFieldName(\"photo3\");\r\r\n return $deleteObj->Execute();\r\r\n}", "public function deleteFile($id)\n {\n $row = DB::table('uploaded_files')\n ->where('id',$id)\n ->select('id', 'upload_path')->get()->first();\n \n /**\n * NOTE: There was a problem using File::delete() as well as Storage::delete()\n * Also file_exists() fails unless basePath() is used.\n */\n $file = app()->basePath(). '/storage/app/'.$row->upload_path;\n\n if(file_exists($file))\n {\n \n unlink($file);\n // delete record from the table \n DB::table('uploaded_files')->delete($id);\n return back()\n ->with('success','You have successfully delete the file ' );\n }\n else\n {\n return back()\n ->with('Error','Error Deleting the file ' );\n }\n \n }", "function cot_pfs_deletefile($userid, $id)\n{\n\tglobal $db, $db_pfs, $cfg;\n\n\t$sql = $db->query(\"SELECT pfs_id FROM $db_pfs WHERE pfs_userid=\".(int)$userid.\" AND pfs_id=\".(int)$id.\" LIMIT 1\");\n\n\tif ($sql->rowCount()>0)\n\t{\n\t\t$fpath = cot_pfs_filepath($id);\n\n\t\tif (file_exists($thumbs_dir_user.$fpath))\n\t\t{\n\t\t\t@unlink($thumbs_dir_user.$fpath);\n\t\t}\n\t\tif (file_exists($pfs_dir_user.$fpath))\n\t\t{\n\t\t\t@unlink($pfs_dir_user.$fpath);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t$sql = $db->delete($db_pfs, \"pfs_id='\".(int)$id.\"'\");\n\t\treturn TRUE;\n\t}\n\telse\n\t{\n\t\treturn FALSE;\n\t}\n}", "public function deleteFileById($conn, $id){\n\t\t//Preparo lo statement che permette di eliminare\n\t\t//una determinata record dalla tabella Filmato_Presentazione\n\t\t$sth = $conn->prepare('delete from Filmato_Presentazione where id = :id');\n\t\t//Inserisco i dati\n\t\t$sth->bindParam(':id', $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t}", "public function admin_remove_file($id=null, $fileId=null) {\n\t\t$response = array('success' => false);\n\t\tif(empty($id) || empty($fileId)) {\n\t\t\treturn $this->render(array('json' => $response));\n\t\t}\n\t\t\n\t\t// A good check to make...Ensure the content document actually exists.\n\t\t$document = Content::find('first', array('fields' => array('_id', '_files'), 'conditions' => array('_id' => $id)));\n\t\tif(empty($document)) {\n\t\t\treturn $this->render(array('json' => $response));\n\t\t}\n\t\t\n\t\tif(substr($fileId, -5) == '.json') {\n\t\t\t$fileId = substr($fileId, 0, -5);\n\t\t}\n\t\t$fileId = new MongoId($fileId);\n\t\t\n\t\t// Also ensure the asset actually exists.\n\t\t$asset = Asset::find('first', array('conditions' => array('_id' => $fileId)));\n\t\tif(!empty($asset)) {\n\t\t\tif(Asset::remove(array('_id' => $asset->_id))) {\n\t\t\t\t// Remove any thumbnails if this was an image asset (or other types of children files).\n\t\t\t\tAsset::remove(array('_parent' => $asset->_id));\n\n\t\t\t\t// Update the document to remove associations.\n\t\t\t\tContent::update(\n\t\t\t\t\tarray('$unset' => array('_files.' . (string)$asset->_id => true)),\n\t\t\t\t\tarray('_id' => $document->_id)\n\t\t\t\t);\n\t\t\t\t$response['success'] = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->render(array('json' => $response));\n\t}", "public function delete()\n\t{\n\t\tsfCore::db->query(\"DELETE FROM `swoosh_file_storage` WHERE `id`='%i';\", $this->id);\n\t\t$this->fFile->delete();\n\t}", "function deleteFile() {\r\n\t\tif (file_exists($this->data[$this->alias]['path'])) {\r\n\t\t\tunlink($this->data[$this->alias]['path']);\r\n\t\t}\r\n\t}", "public function delete($id) {\n\t\t# Delete the picture and all its versions\n\t\t$this->Picture->_deletePicture($id);\n\n\t\t$this->render(false, false);\n\t}", "public function deleteFile(){\n\t\t$db = $this->db;\n\t\t$id = $_GET[\"id\"];\n\t\t\n\t\t$file = $db->fetchRow($db->select()->from(array(\"tbf\"=>\"tb_applicant_files\"))->where(\"id = ?\", $id));\n\t\tif ($file){\n\t\t\tif ($file[\"userid\"]!=$_SESSION[\"userid\"]){\n\t\t\t\treturn array(\"success\"=>false);\n\t\t\t}\n\t\t\t//$db->delete(\"tb_applicant_files\", $db->quoteInto(\"id = ?\", $id));\n\t\t\t$db->update(\"tb_applicant_files\", array(\"is_deleted\" => 1), $db->quoteInto(\"id = ?\", $id));\n $db->delete(\"solr_candidates\", $db -> quoteInto(\"userid=?\",$_SESSION[\"userid\"]));\n\t\t\t\n\t\t\tglobal $base_api_url;\n\t\t\t\n\t\t\tfile_get_contents($base_api_url . \"/solr-index/sync-candidates/\");\n\t\t\t\n\t\t\tif (file_exists(getcwd().\"/../applicants_files/\".$file[\"name\"])){\n\t\t\t\tunlink(getcwd().\"/../applicants_files/\".$file[\"name\"]);\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tfile_get_contents($base_api_url . \"/mongo-index/sync-candidates-files/?userid=\" . $_SESSION[\"userid\"]);\n\t\t\t\n\t\t\t\n\t\t\treturn array(\"success\"=>true);\n\t\t}else{\n\t\t\treturn array(\"success\"=>false);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}" ]
[ "0.6655746", "0.6428937", "0.626395", "0.6247531", "0.6220674", "0.61671746", "0.610972", "0.610972", "0.610972", "0.60971606", "0.60802203", "0.6078053", "0.6057658", "0.6020345", "0.59970385", "0.5994904", "0.597039", "0.5922993", "0.59033406", "0.58998823", "0.5888017", "0.5874221", "0.5858544", "0.58534735", "0.5850321", "0.5848145", "0.58308136", "0.58300704", "0.58112", "0.5807001" ]
0.82158256
0
Returns the realpath of the file associated with the given operation entry. Throws an exception if the operation doesn't have a file associated with it (i.e. remove operation).
private function getEntryRealPathByOperation(string $contextId, array $operation, array $options = []): string { if ('remove' === $operation['type']) { $id = $operation['id']; $this->error("Cannot get realpath from a remove operation, with contextId=\"$contextId\" and id=\"$id\"."); } return $this->doGetEntryRealPathByOperation($contextId, $operation, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function realpath($file);", "protected function doGetEntryRealPathByOperation(string $contextId, array $operation, array $options = [])\n {\n return $this->getContextDir($contextId) . \"/files/\" . $operation['path'];\n }", "public function getAbsolutePathOfRelativeReferencedFileOrPathResolvesFileCorrectlyDataProvider() {}", "function getAtomEntryFilePath() {\n\t\treturn $this->_outPath .'/'. $this->_fileDir .'/'. $this->_atomEntryFileName;\n\t}", "public function path(): string\n {\n return realpath($this->file);\n }", "protected function getFile($urn) {\n\t\t$resolved = $this->systemUtil->resolvePath($urn, array('onError'=>'return'));\n\t\tif( $resolved !== null and file_exists($resolved) ) return $resolved;\n\t\t\n\t\t$blob = $this->blobRepository->getBlob($urn);\n\t\tif( $blob === null ) {\n\t\t\tthrow new Exception(\"'$urn' could not be found\");\n\t\t} else if( $blob instanceof Nife_FileBlob ) {\n\t\t\treturn $blob->getFile();\n\t\t} else {\n\t\t\t$file = $this->primaryBlobRepository->newTempFile();\n\t\t\tfile_put_contents($file, (string)$blob);\n\t\t\treturn $file;\n\t\t}\n\t}", "public function getAbsolutePath()\n {\n return null === $this->photoId\n ? null\n : $this->getUploadRootDir().'/'.$this->photoId;\n }", "public function getFileAbsolutePath($file);", "function tdc_get_filepath($filenode){\n return $filenode->path[0];\n}", "public function get_path()\n\t\t{\n\t\t\tif ($this->path) {\n\t\t\t\treturn $this->path.'/'.$this->get_full_name();\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\t$hash = $this->hash();\n\t\t\t\t} catch(\\System\\Error\\File $e) {\n\t\t\t\t\t$hash = null;\n\t\t\t\t}\n\n\t\t\t\tif ($hash) {\n\t\t\t\t\treturn $this->get_path_hashed();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}", "public function getAbsolutePath()\n {\n return null === $this->image\n ? null\n : $this->getUploadRootDir() . '/' . $this->image;\n }", "function realpath($path)\n{\n return $path;\n}", "public function getFile()\n {\n return $this->getAbsolutePath($this->avatarName);\n }", "public function filePath($file) {\r\n $file = $this->fileLoad($file);\r\n return drupal_realpath($file->uri);\r\n }", "public function getCaminhoReal()\n {\n return $this->arquivo->getRealPath();\n }", "public function getAbsolutePath()\n {\n return null === $this->avatar ? null : $this->getUploadRootDir().'/'.$this->avatar;\n }", "protected function handleOperation($op) {\n $output = '';\n $op_type = $this->checkAndGet($op, 'operation');\n switch ($op_type) {\n case 'filemodify':\n $mode = $this->convertMode($this->checkAndGet($op, 'mode'));\n $output .= sprintf(\"M %s inline %s\\n\",\n $mode,\n $this->checkAndGet($op, 'path'));\n $output .= $this->handleData($this->checkAndGet($op, 'data'));\n break;\n\n case 'filedelete':\n $output .= sprintf(\"D %s\\n\", $this->checkAndGet($op, 'path'));\n break;\n\n case 'filecopy':\n $output .= sprintf(\"C %s %s\\n\",\n $this->checkAndGet($op, 'src'),\n $this->checkAndGet($op, 'dst'));\n break;\n\n case 'filerename':\n $output .= sprintf(\"R %s %s\\n\",\n $this->checkAndGet($op, 'src'),\n $this->checkAndGet($op, 'dst'));\n break;\n case 'filedeleteall':\n $output .= \"deleteall\\n\";\n break;\n default:\n throw new Exception(\"Unknown operation type '$op_type'.\");\n }\n\n return $output;\n }", "public function getFile_path() {\n return $this->_file_path ? $this->_file_path : null;\n }", "protected function getFullPathToUploadFile()\n {\n return $this->fullPathToUploadFile;\n }", "public function getAbsolutePath()\r\n {\r\n return null === $this->getPath() ? null : $this->getUploadRootDir().'/'.$this->getPath();\r\n }", "public function getAbsolutePath()\n {\n return null === $this->path ? null : $this->getUploadRootDir() . '/' . $this->path;\n }", "public function getAbsolutePath() {\n return null === $this->path ? null : $this->getUploadRootDir() . '/' . $this->path;\n }", "public function realpath($path, $relative = FileSystem::NONE);", "function phpbb_realpath($path)\n\t{\n\t\treturn phpbb_own_realpath($path);\n\t}", "function phpbb_realpath($path)\n\t{\n\t\treturn phpbb_own_realpath($path);\n\t}", "public function getFullPath(): string;", "public function getFileExec()\n {\n return $this->readOneof(6);\n }", "public function getEntryPath($reference);", "public function getPath(): string {\n $meta_data = stream_get_meta_data($this->file);\n return $meta_data[\"uri\"];\n }", "protected function getResource()\n {\n if (is_resource($this->path)) {\n return $this->path;\n }\n\n if (!$this->isRemoteFile() && !is_readable($this->path)) {\n throw new TelegramSDKException('Failed to create InputFile entity. Unable to read resource: '.$this->path.'.');\n }\n\n return Psr7\\Utils::tryFopen($this->path, 'rb');\n }" ]
[ "0.596546", "0.57632303", "0.5605034", "0.5433832", "0.53794706", "0.53050315", "0.52940404", "0.5255092", "0.5161836", "0.5150619", "0.5124858", "0.5083605", "0.5063754", "0.5005847", "0.5000892", "0.49723014", "0.4949741", "0.4938642", "0.49377012", "0.4909026", "0.490807", "0.49042958", "0.48710737", "0.4864927", "0.4864927", "0.48607424", "0.48371354", "0.48297176", "0.48220733", "0.4816916" ]
0.68746996
0
Create User Profile for newly registered User with given columns With User Model.
public function create(array $columns, $type, UserModelInterface $user);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function created(User $user)\n {\n Userprofile::create([\n 'users_id' => $user->id,\n 'address' => 'Your Address',\n 'phone_number' => 'Your Number',\n 'city' => 'Your City',\n 'country' => 'Your Country',\n 'body' => 'Something About Yourself',\n 'user_img' => 'Your image here'\n ]);\n }", "public function actionCreate()\n {\n $model = new User();\n\n $profile = new UserProfile();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n $userProfile = Yii::$app->request->post('UserProfile');\n $profile->user_id = $model->id;\n $profile->phone = $userProfile['phone'];\n $profile->firstname = $userProfile['firstname'];\n $profile->lastname = $userProfile['lastname'];\n $profile->save();\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n 'profile' => $profile,\n ]);\n }", "public function createUser(){\n \n $password = DbrLib::rand_string(8);\n \n /**\n * create username \n */\n $firstName = strtolower(self::translitStringToAscii($this->pprs_first_name));\n $secondName = strtolower(self::translitStringToAscii($this->pprs_second_name));\n $username = $firstName . substr($secondName, 0, 1);\n $i = 1;\n while(User::model()->findByAttributes(['username'=>$username])){\n $i ++;\n if($i> strlen($secondName)){\n $username = $firstName . DbrLib::rand_string(2);\n }\n $username = $firstName . substr($secondName, 0, $i); \n }\n \n /**\n * get email from person contacts\n */\n $contacts = $this->ppcnPersonContacts;\n $email = '';\n foreach($contacts as $contact){\n if($contact->ppcn_pcnt_type == PcntContactType::TYPE_EMAIL ){\n $email = trim($contact->ppcn_value);\n }\n }\n \n /**\n * create user record\n */\n $user = new User();\n $user->username = $username;\n $user->password = $password;\n $user->email = $email;\n $user->status = User::STATUS_ACTIVE;\n \n if(!$user->validate()){\n return CHtml::errorSummary($user);\n }\n \n $user->save();\n \n /**\n * create profile record\n */\n $profile=new Profile;\n $profile->user_id=$user->id;\n $profile->first_name = $this->pprs_first_name;\n $profile->last_name = $this->pprs_second_name;\n $profile->sys_ccmp_id = Yii::app()->sysCompany->getActiveCompany();\n $profile->person_id=$this->primaryKey;\n\t\t$profile->save(); \n \n return true;\n \n \n }", "protected function create(array $data)\n {\n\n /** @var User $user */\n $user = User::query()->make([\n 'username' => $data['username'],\n 'first_name' => $data['first_name'],\n 'father_name' => $data['father_name'],\n 'grandfather_name' => $data['grandfather_name'],\n 'last_name' => $data['last_name'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n 'official_id' => $data['official_id'],\n 'mobile' => $data['mobile'],\n ]);\n\n $this->storeAvatar($user, $data);\n\n $user->save();\n\n $data['preferred_times'] = implode(',', $data['preferred_times']);\n $data['languages'] = implode(',', $data['languages']);\n // skills filed is optional, we have to check if it exists in the $data array.\n $data['skills'] = isset($data['skills']) ? implode(',', $data['skills']) : null;\n\n $profile = Profile::query()->make($data);\n $user->profile()->save($profile);\n\n return $user;\n }", "public static function create($attributes = [], $exists = false) {\n $user = User::create(array_merge($attributes, ['type' => 'admin']));\n return $user->profile;\n }", "private function _createNewUser($params)\n {\n $table = new User();\n $user = $table->fetchNew();\n\n $user->lang = Globals::getTranslate()->getLocale();\n $user->activationKey = $this->_generateActivationKey();\n\n $user->{User::COLUMN_USERNAME} = $params[User::COLUMN_USERNAME];\n $user->{User::COLUMN_EMAIL} = $params[User::COLUMN_EMAIL];\n $user->{User::COLUMN_STATUS} = User::STATUS_PENDING;\n\n //if($params[User::INPUT_AUTH_METHOD] == User::LOGIN_AUTHMETHOD_PASSWORD){\n $user->{User::COLUMN_PASSWORD} = md5($params[User::COLUMN_PASSWORD]);\n //} else {\n //$user->{User::COLUMN_OPENID_IDENTITY} = $params[User::INPUT_OPENID_IDENTITY];\n //}\n\n $user->save();\n return $user;\n }", "public function findOrCreateUser($user, $provider)\n {\n\n $userCreated = User::with('user')->where('email', $user->email)->first();\n $fileContents = file_get_contents($user->getAvatar());\n\n $uploadedFolder = public_path() . '/profile_image';\n\n File::put($uploadedFolder . '/profile_image' . $user->getId() . \".jpg\", $fileContents);\n\n $picture ='/profile_image' . $user->getId() . \".jpg\";\n\n if($userCreated)\n {\n if($userCreated->activated != 2)\n {\n $userCreated->provider = $provider;\n $userCreated->provider_id = $user->id;\n\n $userCreated->image=$picture;\n\n if($userCreated->type === 1)\n {\n $userCreated->activation_code = '';\n $userCreated->activated = 1;\n }\n \n if(is_null($userCreated->name))\n {\n $userCreated->name = $user->name;\n }\n\n $appUser = AppUser::where('email' , $user->email)->first();\n\n if($appUser->account_activated === 0 && $appUser->account_type === 1)\n {\n $freePosts = FreePostModel::where('id', 1)->first();\n $appUser->free_post = is_null($freePosts)?0:$freePosts->free_post_no;\n }\n\n if(is_null($appUser->first_name) && is_null($appUser->last_name))\n {\n\n $splitName = explode(' ', $userCreated->name, 2); // Restricts it to only 2 values, for names like Billy Bob Jones\n $first_name = $splitName[0];\n $last_name = !empty($splitName[1]) ? $splitName[1] : '';\n \n $appUser->first_name = $first_name;\n $appUser->last_name = $last_name;\n }\n $appUser->facebook_id = $userCreated->provider_id;\n $appUser->user_status = 1;\n\n $userCreated->save();\n $appUser->save();\n\n if($userCreated->type !== 1 && $userCreated->activated === 0)\n {\n return 0;\n }\n }\n else\n {\n return -1;\n }\n }\n else\n {\n $userCreated = User::create([\n 'name' => $user->name,\n 'email' => $user->email,\n 'provider' => $provider,\n 'provider_id' => $user->id,\n 'activated' => 1,\n 'activation_code' => '',\n 'type' => 1,\n 'image'=>$picture,\n ]);\n \n $splitName = explode(' ', $userCreated->name, 2); // Restricts it to only 2 values, for names like Billy Bob Jones\n $first_name = $splitName[0];\n $last_name = !empty($splitName[1]) ? $splitName[1] : '';\n\n $freePosts = FreePostModel::where('id', 1)->first();\n\n AppUser::create([\n 'user_id' => $userCreated->id,\n 'first_name' => $first_name,\n 'last_name' => $last_name,\n 'email' => $user->email,\n 'user_status' => 1,\n 'email_activated' => 1,\n 'facebook_id' => $userCreated->provider_id,\n 'free_post' => is_null($freePosts)?0:$freePosts->free_post_no,\n 'account_type' => 1,\n 'account_activated' => 1,\n ]);\n }\n\n return $userCreated;\n }", "public function store(StoreUserRequest $request)\n {\n // echo '<pre>'; // user profile\n // print_r($request->all()); exit();\n if ($request->hasFile('profile_pic')) {\n $file = $request->file('profile_pic');\n $image = $file->getClientOriginalExtension();\n $newfile = time().'_'.rand().'_'.'user-profile'.'.'.$image;\n $fmove = $file->move(public_path().'/user/image/',$newfile);\n $user_pic = $newfile;\n }\n\n $user = User::create([\n 'role_id' => 2,\n 'first_name' => $request->first_name,\n 'last_name' => $request->last_name,\n 'email' => $request->email,\n 'avatar_type' => 'profile-image',\n 'avatar_location' =>isset($user_pic)?$user_pic:'',\n 'password' => $request->password,\n 'active' => isset($request->active) && $request->active === '1',\n 'confirmation_code' => md5(uniqid(mt_rand(), true)),\n 'confirmed' => isset($request->confirmed) && $request->confirmed === '1',\n ]);\n //Send confirmation email if requested and account approval is off\n if ($user->confirmed === false && ! config('access.users.requires_approval')) {\n $user->notify(new UserNeedsConfirmation($user->confirmation_code));\n }\n if (!empty($user->id)) {\n //echo $user->id; exit();\n $userProfile = new UserProfile; \n $userProfile->user_id = $user->id; \n $userProfile->gender = $request->gender; \n $userProfile->date_of_birth = $request->date_of_birth;\n $userProfile->interests = isset($request->interests)? implode(\",\",$request->interests):''; \n $userProfile->contact_numbers = $request->contact_numbers; \n $userProfile->country = $request->country; \n $userProfile->state = $request->state; \n $userProfile->city = $request->city; \n $userProfile->address = $request->address; \n $userProfile->interested_in = $request->interested_in;\n $userProfile->summery = $request->summery;\n $userProfile->profile_pic = isset($user_pic)?$user_pic:'';\n $userProfile->save(); \n } \n return redirect()->route('admin.user')->withFlashSuccess(__('alerts.backend.users.created'));\n }", "public function actionCreate()\n {\n $user = new User(['scenario' => 'create']);\n $profile = new Profile();\n\n if ($user->load(Yii::$app->request->post()) && $profile->load(Yii::$app->request->post())) {\n if ($user->validate() && $profile->validate()) {\n //$user->populateRelation('profile', $profile);\n if ($user->save(false)) {\n $user->link('profile', $profile);\n Yii::$app->session->setFlash('success', Module::t('users', 'User has been successfully created.'));\n return $this->redirect(['update', 'id' => $user->id]);\n } else {\n Yii::$app->session->setFlash('danger', Module::t('users', 'User has not been saved. Please try again!'));\n return $this->refresh();\n }\n }\n }\n\n return $this->render('create', [\n 'user' => $user,\n 'profile' => $profile\n ]);\n }", "protected function _createUser()\n {\n $data = [\n 'email' => '[email protected]',\n 'password' => 'test',\n ];\n\n $user = $this->Users->newEntity($data);\n\n $user->set('active', true);\n $user->set('role_id', 1);\n\n $this->Users->save($user);\n }", "protected function create(array $data)\n {\n $user = User::create([\n 'username' => $data['username'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n 'status' => $data['role'] === 'customer' ? 'verifiedByAdmin' : \"-\" \n ]);\n \n $address = [];\n \n array_push($address, json_encode([\n 'name' => $data['addressName'],\n 'province_id' => $data['provinceId'],\n 'city_id' => $data['cityId'],\n 'subdistrict_id' => $data['subdistrictId'],\n 'province_name' => $data['provinceName'],\n 'city_name' => $data['cityName'],\n 'subdistrict_name' => $data['subdistrictName'],\n 'postal_code' => $data['postalCode'],\n 'detail' => $data['addressDetail']\n ]));\n \n $user->profile()->save(Profile::create([\n 'user_id' => $user->id,\n 'name' => $data['name'],\n 'address' => json_encode($address),\n 'phone' => $data['phone'],\n 'photo' =>'no-image.jpg',\n 'gender' => $data['gender'],\n 'birthday' => $data['birthday'],\n ]));\n \n if($data['role'] === 'merchant'){\n $user->assignRole('merchant');\n } else {\n $user->assignRole('customer');\n }\n \n return $user;\n }", "protected function create(array $data)\n {\n return User::create([\n 'membType'=>$data['membType'],\n 'businessNature'=>$data['businessNature'],\n 'specNature'=>$data['specNature'],\n 'repBy'=>$data['repBy'],\n 'memberName' => $data['memberName'],\n 'image' => $data['image'],\n 'ComName'=>$data['ComName'],\n 'Desg'=>$data['Desg'],\n 'StrNo1'=>$data['StrNo1'],\n 'Zipcode1'=>$data['Zipcode1'],\n 'city1'=>$data['city1'],\n 'country1'=>$data['country1'],\n 'StrNo2'=>$data['StrNo2'],\n 'Zipcode2'=>$data['Zipcode2'],\n 'city2'=>$data['city2'],\n 'country2'=>$data['country2'],\n 'PhnOffice'=>$data['PhnOffice'],\n 'PhnRes'=>$data['PhnRes'],\n 'fax'=>$data['fax'],\n 'email' => $data['email'],\n 'skype'=> $data['skype'],\n 'web' => $data['web'],\n 'mobile' => $data['mobile'],\n 'password' => Hash::make($data['password']),\n 'confpass' => Hash::make($data['password']),\n 'proposerName'=>$data['proposerName'],\n 'proposerNo'=>$data['propserNo'],\n 'seconderName'=>$data['seconderName'],\n 'seconderNo'=>$data['seconderNo'],\n 'qualification'=>$data['qualification'],\n 'JoinDate'=>$data['JoinDate'],\n 'association'=>$data['association'],\n ]);\n }", "public function actionCreate()\n {\n $model = new User();\n\n if (isset($_POST['User']))\n {\n\n $transaction = Yii::app()->db->beginTransaction();\n\n try\n {\n $model->setAttributes($_POST['User']);\n $model->salt = Registration::model()->generateSalt();\n $model->password = Registration::model()->hashPassword($model->password, $model->salt);\n $model->registrationIp = Yii::app()->request->userHostAddress;\n\n if ($model->save())\n {\n $profile = new Profile();\n $profile->user_id = $model->id;\n if ($profile->save())\n {\n $transaction->commit();\n Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Новый пользователь добавлен!'));\n $this->redirect(array('view', 'id' => $model->id));\n }\n else\n {\n throw new CDbException(Yii::t('user', 'При создании пользователя произошла ошибка! Подробности в журнале исполнения.'));\n }\n }\n\n }\n catch (CDbException $e)\n {\n $transaction->rollback();\n Yii::log($e->getMessage(), CLogger::LEVEL_ERROR, UserModule::$logCategory);\n Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, $e->getMessage());\n $this->redirect(array('create'));\n }\n }\n\n $this->render('create', array(\n 'model' => $model,\n ));\n }", "public function creating(User $user)\n {\n if(!isset($user->profile_image)) {\n $user->profile_image = config('images.default_user_avatar');\n }\n }", "public function createUserProfile($data) {\n\n global $user, $db;\n\n $userID = $user->getId();\n\n $sql = 'SELECT COUNT(*)\n FROM users AS u\n JOIN profiles AS p ON p.userID = u.id\n WHERE u.id = ?';\n\n $stmt = $db->get()->prepare($sql);\n\n if ($stmt) {\n $stmt->execute([$userID]);\n $result = $stmt->fetch(PDO::FETCH_COLUMN);\n\n if ($result) {\n $sql = 'UPDATE profiles\n SET firstName=?, lastName=?, dob=?, addressFirst=?, addressSecond=?, city=?, postcode=?, mobile=?, bio=?\n WHERE userID = ?';\n\n $stmt = $db->get()->prepare($sql);\n\n if ($stmt) {\n $stmt->execute([\n $data['firstName'],\n $data['lastName'],\n $data['dob'],\n $data['addressFirst'],\n $data['addressSecond'],\n $data['city'],\n $data['postcode'],\n $data['mobile'],\n $data['bio'],\n $userID\n ]);\n header(\"Location: ../profile.php?profile=updated\");\n exit();\n }\n }\n else {\n $sql = 'INSERT INTO profiles (userID, firstName, lastName, dob, addressFirst, addressSecond, city, postcode, mobile, bio)\n VALUES (?,?,?,?,?,?,?,?,?,?)';\n\n $stmt = $db->get()->prepare($sql);\n\n if ($stmt) {\n $stmt->execute([\n $userID,\n $data['firstName'],\n $data['lastName'],\n $data['dob'],\n $data['addressFirst'],\n $data['addressSecond'],\n $data['city'],\n $data['postcode'],\n $data['mobile'],\n $data['bio']\n ]);\n header(\"Location: ../profile.php?profile=updated\");\n exit();\n }\n }\n }\n }", "public function creating(User $user)\n {\n\n $user->user_creator_id = \\Auth::id();\n //$user->user_updater_id = \\Auth::id();\n }", "public function actionCreate()\n {\n $model = new UserProfile();\n\n $model->user_id = Yii::$app->user->identity->id;\n\n\n $POST_VARIABLE = Yii::$app->request->post('Place');\n echo $POST_VARIABLE['first_name'];\n\n if ($already_exists = RecordHelpers::userHas('user_profile')) {\n return $this->render('view', [\n\n 'model' => $this->findModel($already_exists),\n ]);\n\n } elseif ($model->load(Yii::$app->request->post()) && $model->save()) {\n Yii::$app->getSession()->setFlash(\"success\", Yii::t('app', 'Profile successfully created!'));\n return $this->redirect(['view']);\n\n } else {\n// echo $model->user_id;\n return $this->render('create', [\n\n 'model' => $model,\n\n ]);\n }\n\n// if ($model->load(Yii::$app->request->post()) && $model->save()) {\n//\n// return $this->redirect(['view', 'id' => $model->id]);\n// } else {\n// return $this->render('create', [\n// 'model' => $model,\n// ]);\n// }\n }", "public function createUser($name, $pass, $profile, array $extra = []);", "public function profileAction(){\n /** @var Object_User $user */\n $data = $this->getRequestData();\n $user = Object_User::getById($this->getDeviceSession()->getUserId());\n if(isset($data['phone'])){\n $user->setPhone($data['phone']);\n }\n if(isset($data['email'])){\n $user->setPhone($data['email']);\n }\n if(isset($data['workphone'])){\n $user->setWorkPhone($data['workphone']);\n }\n if(isset($data['workemail'])){\n $user->setWorkEmail($data['workemail']);\n }\n if(!$user->save()){\n $this->setErrorResponse('Cannot update user profile');\n }\n $this->_helper->json($user);\n }", "protected function _createUser() {\n\t\t$user = System_Locator_TableLocator::getInstance()->get('User')->createRow();\n\t\t$user->username = $this->getUsername();\n\t\t$user->setPassword($this->getPassword());\n\t\t$user->email = $this->getEmail();\n\t\t$user->countryCode = $this->getCountryCode();\n\t\t$user->createdAt = date(DATE_ISO8601); \n\t\treturn $user;\n\t}", "public function updated(User $user)\n {\n Userprofile::create([\n 'users_id' => $user->id,\n 'address' => 'Your Address',\n 'phone_number' => 'Your Number',\n 'city' => 'Your City',\n 'country' => 'Your Country',\n 'body' => 'Something About Yourself',\n 'user_img' => 'Your image here'\n ]);\n }", "public function create_profile(Request $request)\n {\n //validate incoming request \n $this->validate($request, [\n 'first_name' => 'required|string',\n 'last_name' => 'required|string',\n 'phone_number'=>'required',\n 'date_of_birth'=>'required'\n \n ]);\n\n try \n {\n $profile = new User_profile();\n \n $profile->user_id = $request->input('user_id');\n $profile->first_name = $request->input('first_name');\n $profile->last_name = $request->input('last_name');\n $profile->phone_number = $request->input('phone_number');\n $profile->date_of_birth = $request->input('date_of_birth');\n\n $profile->save();\n\n return response()->json( [\n 'entity' => 'profile', \n 'action' => 'create', \n 'result' => 'success'\n ], 201);\n\n } \n catch (\\Exception $e) \n {\n return response()->json( [\n 'entity' => 'profile', \n 'action' => 'create', \n 'result' => 'failed'\n ], 409);\n }\n }", "public function createNewUserInfo($payload){\n $fieldArray = array();\n $valueArray = array();\n $weight = 0;\n $height = 0;\n $UID = User::getID($payload['username']);\n array_push($fieldArray, \"UID\");\n array_push($valueArray, $UID);\n foreach ($payload as $key => $value) {\n if($key !== \"username\"){\n array_push($fieldArray, $key);\n array_push($valueArray, $value);\n }\n if($key == \"Weight\"){\n $weight = $payload[$key];\n }\n if($key == \"Height\"){\n $height = $payload[$key];\n }\n }\n User::insert($fieldArray, $valueArray);\n User::setTable(\"usertable\");\n User::update([\"NewUser\"], [0], $UID);\n\n User::setTable(\"userdata\");\n $BMI = round(703 * ($weight) / ($height**2), 1);\n User::update([\"BMI\"], [$BMI], \"'\".base64_encode($payload[\"username\"]).\"'\");\n return true;\n }", "public function store(CreateUserRequest $request)\n {\n $input = $request->all();\n\n $input['password'] = bcrypt('password');\n $input['api_token'] = str_random(60);\n\n $profile = $input['profile'];\n $profile['driver_id'] = strtoupper(uniqid());\n unset($input['profile']);\n\n if ($request->hasFile('file')) {\n $file = $request->file('file');\n $path = $file->store('documents');\n\n $profile['document_file'] = $path;\n }\n\n\n if ($request->hasFile('picture')) {\n $file = $request->file('picture');\n $path = $file->store('documents');\n\n $profile['profile_picture'] = $path;\n }\n unset($input['file']);\n unset($input['picture']);\n\n $user = User::create($input);\n $user->profile()->create($profile);\n\n return redirect('/users');\n }", "protected function create(array $data)\n {\n $user = User::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n\t\t\t 'email_token' => bin2hex(openssl_random_pseudo_bytes(30)),\n 'unix_timestamp' => time(),\n 'verified' => 0\n ]);\n\n Profile::create(['user_id' => $user->id]);\n\n return $user;\n }", "public function created(User $user)\n {\n\n // Assign a profile Image\n if($user->sex == 'male'){\n $user->avatar = 'blue.png';\n }\n elseif ($user->sex == 'female') {\n $user->avatar = 'pink.png';\n }\n else{\n $user->avatar = 'gray.png';\n }\n\n // Assign Name\n if($user->lastname !== null){\n $user->name = $user->firstname . ' ' . $user->lastname;\n }else{\n $user->name = $user->firstname;\n }\n\n /*Create Default Settings*/\n $user->settings()->create([]);\n \n\n $user->save();\n }", "protected function create(array $data)\n {\n $file = $this->request->file('profile_picture');\n $file_name = uniqid() . \"-\" . $file->getClientOriginalName();\n $file->move(public_path('/images'),$file_name);\n\n return User::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n 'gender' => $data['gender'],\n 'address' => $data['address'],\n 'dob' => $data['dob'],\n 'profile_image' => $file_name,\n ]);\n }", "protected function create(array $data)\n {\n\n define('UPLOAD_DIR', 'uploads/profiles/');\n $img = $data['profilePictureEncoded'];\n $newImage = str_replace('data:image/png;base64,', '', $img);\n $image = explode(\",\",$img);\n $test = base64_decode($image[1]);\n $fileName = UPLOAD_DIR . uniqid() . '.jpeg';\n file_put_contents($fileName, $test);\n\n return User::create([\n 'firstname' => $data['firstname'],\n 'lastname' => $data['lastname'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n 'profile_picture' => '/' . $fileName,\n 'type' => 1,\n ]);\n }", "function d4os_io_db_070_users_add_extra_fields(&$user) {\n if (module_exists('d4os_io_services_profile')) {\n $properties = d4os_io_db_070_os_profile_services_avatar_properties_request(array('avatar_id' => $user->UUID));\n if (isset($properties['data'][0])) {\n $user->profileURL = $properties['data'][0]['ProfileUrl'];\n $user->profileImage = $properties['data'][0]['Image'];\n $user->profileAboutText = $properties['data'][0]['AboutText'];\n $user->profileFirstImage = $properties['data'][0]['FirstLifeImage'];\n $user->profileFirstText = $properties['data'][0]['FirstLifeAboutText'];\n $user->profilePartner = $properties['data'][0]['Partner'];\n\n //$user->profileAllowPublish = $properties['data'][0]['profileAllowPublish'];\n //$user->profileMaturePublish = $properties['data'][0]['profileMaturePublish'];\n\n // interests\n $user->profileWantDoMask = $properties['data'][0]['wantmask'];\n $user->profileWantToText = $properties['data'][0]['wanttext'];\n $user->profileSkillsMask = $properties['data'][0]['skillsmask'];\n $user->profileSkillsText = $properties['data'][0]['skillstext'];\n $user->profileLanguages = $properties['data'][0]['languages'];\n }\n }\n}", "public function saveProfile()\n {\n if ($this->validate()) {\n $user = $this->user;\n\n $graph = Yii::$container\n ->get(\\common\\components\\Graph::class, [$this->user]);\n\n if ($this->timezone) {\n $user->timezone = $this->timezone;\n }\n if ($this->expose_graph) {\n $user->expose_graph = true;\n\n // generate behaviors graph image\n $checkins_last_month = (Yii::$container->get(\\common\\interfaces\\UserBehaviorInterface::class))\n ->getCheckInBreakdown();\n\n // if they haven't done a check-in in the last month this will explode\n // because $checkins_last_month is an empty array\n if ($checkins_last_month) {\n $graph->create($checkins_last_month, true);\n }\n } else {\n $user->expose_graph = false;\n // remove behaviors graph image\n $graph->destroy();\n }\n\n if ($this->send_email) {\n $user->send_email = true;\n $user->email_category = $this->email_category;\n $user->partner_email1 = $this->partner_email1;\n $user->partner_email2 = $this->partner_email2;\n $user->partner_email3 = $this->partner_email3;\n } else {\n $user->send_email = false;\n $user->email_category = 4; // default to \"Speeding Up\"\n $user->partner_email1 = null;\n $user->partner_email2 = null;\n $user->partner_email3 = null;\n }\n $user->save();\n return $user;\n }\n\n return null;\n }" ]
[ "0.632334", "0.6116325", "0.6043701", "0.59704643", "0.59675735", "0.59269094", "0.5902332", "0.58426166", "0.58307564", "0.5787559", "0.5766224", "0.5762231", "0.57604074", "0.57460773", "0.5745956", "0.5742068", "0.5740418", "0.57384783", "0.5728681", "0.57059616", "0.5690376", "0.56877375", "0.5685367", "0.5675826", "0.56477714", "0.56438994", "0.5639966", "0.5625153", "0.5623558", "0.5616267" ]
0.6320776
1
Returns Counts of email records where the given email matches.
public function emailCounts($email);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUsersByEmail($email) {\n $sql = \"SELECT count(*) as total FROM \" . DB_PREFIX . \"wkpos_user WHERE email = '\" . $email . \"' AND user_id != '\" . $this->session->data['user_login_id'] . \"'\";\n $query = $this->db->query($sql);\n\n return $query->row['total'];\n }", "protected function getRecByEmail(string $email) {\n $sql = \"SELECT COUNT(*) FROM \" . $this->formsTableName . \" WHERE email = ?\";\n $stmt = $this->connect()->prepare($sql);\n $stmt->bindParam(1, $email, \\PDO::PARAM_STR);\n $stmt->execute();\n $res = $stmt->fetchAll();\n return $res[0]['COUNT(*)'];\n }", "function CountCustomerEmail($argWhere = '')\n {\n $arrNum = $this->getNumRows(TABLE_CUSTOMER, 'CustomerEmail', $argWhere);\n return $arrNum;\n }", "public static function countEmails()\r\n {\r\n $number = count(self::$emailArray);\r\n return $number;\r\n }", "function numberOfSameEmailAddress($email) {\n $sql = \"SELECT * FROM member WHERE email = '\" . $email . \"'\";\n $result = getAll($sql);\n\n return count($result);\n}", "public function findEmail($email = \"[email protected]\") {\n\t\t$users = $this->em->createQuery ( \" SELECT PARTIAL u.{id} FROM App\\Entity\\User u WHERE u.email = ?1 \" )->setParameter ( 1, $email )->execute ();\n\t\treturn count ( $users );\n\t}", "public function buscaEmail($email)\n {\n \n $query = $this->db\n ->where('email', $email)\n ->get('clientes');\n\n return $query->num_rows();\n }", "function sql_nemails($email)\n{\n global $connection, $trace, $tblmembre;\n $select = \"$tblmembre\";\n $tables = explode(\",\",$select);\n $where = \"\";\n for ($i=0;$i<count($tables);$i++) {\n $fields_array = sql_fields($tables[$i],'array');\n for ($j=0;$j<sql_fields($tables[$i],'');$j++) {\n if (strstr($fields_array[$j], \"email\")) {\n if\t($where !== '')\t$where .= \"OR\"\t;\n $where .= \" $fields_array[$j]='$email' \";\n }\n }\n }\n $sql = mysqli_query($connection, \"SELECT * FROM $select WHERE $where\");\n $row = mysqli_num_rows($sql);\n return $row;\n}", "public function verifyEmailExists($email)\r\n\t{\r\n\t\t$emailFull = $email['email'];\r\n\t\t\r\n\t\t$consult = $this->dbAdapter->query(\"SELECT count(email) as count FROM users WHERE email='$emailFull'\",Adapter::QUERY_MODE_EXECUTE);\r\n\t\t\r\n\t\t$result = $consult->toArray();\r\n\r\n\t\treturn $result;\r\n\t}", "public function getTotalCustomersByEmail($email, $app_id = '') {\n $registry = new Registry();\n // Database\n $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);\n $registry->set('db', $db);\n\n if ($app_id != '') {\n $query = $db->query(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"customer WHERE LOWER(email) = '\" . $db->escape(utf8_strtolower($email)) . \"' AND app_id='\" . $app_id . \"'\");\n } else {\n $query = $db->query(\"SELECT COUNT(*) AS total FROM \" . DB_PREFIX . \"customer WHERE LOWER(email) = '\" . $db->escape(utf8_strtolower($email)) . \"'\");\n }\n\n return $query->row['total'];\n }", "public function searchIfMailExists($email)\n {\n $reqmail = $this->db->prepare(\"SELECT * FROM users WHERE email = ?\");\n $reqmail->execute(array($email));\n $mailexist = $reqmail->rowCount();\n\n return $mailexist;\n }", "public function validate_email_user_reset($email)\n {\n return $this->db->from('ec_client')->where('email', $email)->count_all_results();\n }", "public static function CekAkunByEmail() {\n \t$mail = self::model()->countByAttributes(array(\"EMAIL\" => $_POST['email'], \"PELANGGAN_STATUS\" => self::PUNYA_AKUN));\n return $mail;\n }", "public function getMailCount()\n {\n return $this->count(self::MAIL);\n }", "public function checkDuplicateEmail( $email )\n {\n include(\"config/database.php\");\n try {\n $sql = \"SELECT email FROM students where email='$email'\";\n $result = $pdoCon->prepare($sql);\n $result->execute();\n $rows = $result->rowCount();\n } catch (Exception $e) {\n echo \"Unable to retrieved results\";\n exit;\n }\n return $rows;\n }", "function emailTaken($email) {\n\t$db = connectDB();\n $sql = <<<SQL\n \tSELECT userID\n \tFROM users\n \tWHERE email = ?\nSQL;\n\n $statement = $db->prepare($sql);\n $statement->bind_param(\"s\", $email);\n $statement->execute();\n $statement->store_result();\n\t$res = $statement->num_rows;\n\n\t$statement->close();\n\t$db->close();\n\n return $res;\n}", "function find_hotel_user_by_email($hotel_email)\n\t{\n\t $this->db->select('COUNT(`sb_hotel_useremail`) as hotelusercount',false);\n\t\t$this->db->where('sb_hotel_useremail',$hotel_email);\n\t\t$query=$this->db->get('sb_hotel_users');\n\t\treturn $query->result_array();\n\t}", "function get_customer_purchase_count( $email = \"\" ) {\n\t\t$this->db->cache_off();\n\t\t$query = $this->db->query('SELECT count( id ) as total\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM orders \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE email = \"'.$email.'\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND active = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND status = 0');\n\t\t$count = $query->result_array();\n\t\t\n\t\t$total = 0;\n\t\t\n\t\tif( $count[0]['total'] == 1 ) {\n\t\t\t$total = \"New Customer ( first order using this email address )\";\n\t\t}\n\t\t\n\t\tif( $count[0]['total'] > 1 ) {\n\t\t\t$total = \"There are \".$count[0]['total'] .\" orders using this email address\";\n\t\t}\n\n\t\treturn $total;\t\t\n\t\t\n\t}", "static function email_available($email) {\n global $con;\n $sql = \"SELECT COUNT(`id`) AS 'count' FROM `user` WHERE `email` LIKE '\".$email.\"';\";\n $query = mysqli_query($con, $sql);\n $count = mysqli_fetch_object($query)->count;\n if ($count == 0) {\n return TRUE;\n } else {\n return FALSE;\n }\n }", "protected function getRecByNameEmail(string $name, string $email) {\n $sql = \"SELECT COUNT(*) FROM \" . $this->formsTableName . \" WHERE name = ? AND email = ?\";\n $stmt = $this->connect()->prepare($sql);\n $stmt->bindParam(1, $name, \\PDO::PARAM_STR);\n $stmt->bindParam(2, $email, \\PDO::PARAM_STR);\n $stmt->execute();\n $res = $stmt->fetchAll();\n return $res[0]['COUNT(*)'];\n }", "function isEmailPresent($email = NULL){\t\t\t\n\t\t$query = \" SELECT id\";\n\t\t$query .= \" FROM \" . $this->config->item('ems_organisers','dbtables');\n\t\t$query .= \" WHERE email = ? \";\t\t\n\t\t$dataBindArr = array($email);\n\t\t$res = $this->db->query($query, $dataBindArr);\n\t\t$resArr = $res->result();\t\t\n\t\treturn count($resArr);\n\t}", "public function check_email($email)\r\n\t{\r\n\t\t$query=$this->db->query(\"SELECT * FROM users WHERE emailid='\".$email.\"'\");\r\n\tforeach ($query->result() as $row)\r\n\t\t{\r\n\t\t$storeid=$row->storeid;\r\n\t\t}\r\n\t\t$rows=$query->num_rows();\r\n\t\t$result=array('afftected_rows'=>$rows,'storeid'=>$storeid);\r\n\t\treturn $result;\r\n\t}", "public function customerHasSameEmail(string $email)\n {\n return Customer::where('email', $email)->select('email')->count('email');\n }", "public function countAllMails()\n {\n try{\n //init the catching\n $this->exceptionThrower->start();\n $count = imap_num_msg($this->mailbox);\n $this->exceptionThrower->stop();\n return $count;\n }catch (\\Exception $e)\n {\n throw new SimpleMailReceiverException(\"Error getting the number of mails\" . $e->getMessage(), $e->getCode());\n }\n }", "public function check_mail($email) {\n\n\n\t\treturn (mysql_result($this->query(\"SELECT COUNT(`id`) FROM `users` WHERE `email` = '$email'\"), 0) ? true: false);\n\n\t}", "public function availableEmail($email)\n {\n\n $pdo = DB::connect();\n $stmt = $pdo->prepare(\"SELECT COUNT(id) FROM users WHERE email = :email\");\n $stmt->bindParam(':email', $email);\n $stmt->execute();\n $result = $stmt->fetchColumn();\n\n if ($result > 0) {\n return false;\n } else {\n return true;\n }\n }", "public function emailExists($email)\r\n {\r\n return (bool) $this->countByColumn('email', $email);\r\n }", "protected function emailAlreadyInUse($email)\n {\n return (bool)self::select(['id'])->\n where('email', '=', $email)->\n count();\n }", "public function emailExists ($email){\n $con = connectPDO();\n $query = $con->prepare(\"SELECT COUNT(id) FROM users WHERE email = ?\");\n $query->execute(array($email));\n $rowcount = $query->fetchColumn();\n if ($rowcount > 0) {\n return true;\n }else{\n return false;\n }\n }", "public function existsByEmail($email) {\n\t\t\n\t\t$row = $this->createQueryBuilder()\n\t\t\t->select('count(id) as total')\n\t\t\t->from($this->getTableName(), 'u')\n\t\t\t->andWhere('u.email = :email')\n\t\t\t->setParameter(':email', $email)\n\t\t\t->execute()\n\t\t\t->fetch($this->getFetchMode());\n\n\t\treturn $row['total'] > 0;\n\t}" ]
[ "0.71565586", "0.7053754", "0.7026054", "0.695855", "0.6875584", "0.6798478", "0.679187", "0.6596043", "0.65268284", "0.64507735", "0.6441059", "0.64250684", "0.63942015", "0.6330408", "0.6326498", "0.63171285", "0.6182561", "0.6180031", "0.6162699", "0.61534566", "0.61496484", "0.61189795", "0.6097551", "0.6086295", "0.60550374", "0.6054793", "0.60461795", "0.60296637", "0.60220045", "0.60129005" ]
0.8394017
0
To extract Http Code. HTTP Batch Response can be in one of the two formats 1. HTTP/1.1 100 Continue [newline][newline] HTTP/1.1 Code Message In this case the actual code is the code part of HTTP string in second line 2. HTTP/1.1 Code Message
public function GetCode() { if($this->_correctHttpLine != null) { preg_match("|^HTTP/[\d\.x]+ (\d+)|", $this->_correctHttpLine, $m); if (isset($m[1])) { return (int)$m[1]; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCode()\n\t{\n\t\t$matches = array();\n\t\tif (isset($this->headers) && isset($this->headers[0]))\n\t\t\tpreg_match('|HTTP/\\d\\.\\d\\s+(\\d+)\\s+.*|', $this->headers[0], $matches);\n\t\treturn isset($matches[1]) ? (int)$matches[1] : 0;\n\t}", "function getHttpCode();", "function get_http_response_code()\n\t{\n\t\t//最后一个收到的HTTP代码\n\t\treturn curl_getinfo($this->ch, CURLINFO_HTTP_CODE);\n\t}", "protected function _getCode()\n {\n // filter code from response\n return (int)substr($this->_getServerResponse(), 0, 3);\n }", "function get_response_code($header) {\r\n\t$parts = explode(\"\\r\\n\", $header);\r\n\treturn $part[0];\r\n}", "public function getResponseCode();", "public function getResponseCode();", "public function code() {\n return $this->info['http_code'];\n }", "function get_http_response_code($url) {\n $headers = get_headers($url);\n return substr($headers[0], 9, 3);\n\t}", "public function getCode()\n {\n return $this->response_code;\n }", "protected function _extractHttpCode($header) {\n\t\tpreg_match(\n\t\t\t'#^HTTP/[0-9\\.]+\\s(?P<code>[0-9]+)#i',\n\t\t\t$header,\n\t\t\t$matches\n\t\t);\n\n\t\treturn isset($matches['code'])\n\t\t\t? $matches['code']\n\t\t\t: $this->_defaultCode;\n\t}", "function get_http_response_code($url) {\n $headers = get_headers($url);\n return substr($headers[0], 9, 3);\n}", "public function getHttpCode()\n {\n return $this->information[ self::INFORMATION_HTTP_CODE ];\n }", "function http_headers_get_response_code() {\n\t\treturn $this->http_response_code;\n\t}", "function getStatusCode($response){\n\tif(preg_match(\"~HTTP/1\\.1 (\\d+)~\", $response, $match)){\n\t\treturn $match[1];\n\t}\n\n\t_log(\"getStatusCode: invalid response from server\", true);\n\treturn false;\n}", "public function getResponseHTTPCode()\n {\n return $this->httpCode;\n }", "private function codes()\n {\n $a_http_status_codes = array(\n 100 => 'Continue', 102 => 'Processing',\n 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content',\n 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 208 => 'Already Reported',\n 226 => 'IM Used', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other',\n 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect',\n 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found',\n 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout',\n 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed',\n 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type',\n 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 421 => 'Misdirected Request',\n 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required',\n 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large',\n 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented',\n 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported',\n 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected',\n 510 => 'Not Extended', 511 => 'Network Authentication Required'\n );\n return $a_http_status_codes;\n }", "public function getCode()\n {\n return curl_getinfo($this->handler)['http_code'];\n }", "function getHttpResponseCode_using_getheaders($url, $followredirects = true){\n // NOTE: could potentially take up to 0-30 seconds , blocking further code execution (more or less depending on connection, target site, and local timeout settings))\n // if $followredirects == false: return the FIRST known httpcode (ignore redirects)\n // if $followredirects == true : return the LAST known httpcode (when redirected)\n if(! $url || ! is_string($url)){\n return false;\n }\n $headers = @get_headers($url);\n if($headers && is_array($headers)){\n if($followredirects){\n // we want the the last errorcode, reverse array so we start at the end:\n $headers = array_reverse($headers);\n }\n foreach($headers as $hline){\n // search for things like \"HTTP/1.1 200 OK\" , \"HTTP/1.0 200 OK\" , \"HTTP/1.1 301 PERMANENTLY MOVED\" , \"HTTP/1.1 400 Not Found\" , etc.\n // note that the exact syntax/version/output differs, so there is some string magic involved here\n if(preg_match('/^HTTP\\/\\S+\\s+([1-9][0-9][0-9])\\s+.*/', $hline, $matches) ){// \"HTTP/*** ### ***\"\n $code = $matches[1];\n return $code;\n }\n }\n // no HTTP/xxx found in headers:\n return false;\n }\n // no headers :\n return false;\n }", "public static function getStatusCode(): int;", "private function getHttpCode() {\n return $this->httpCode;\n }", "public function getResponseCode(){\n\t\treturn $this->response->getCode();\n\t}", "private function get_http_response_code($url)\n {\n $headers = get_headers($url);\n return substr($headers[0], 9, 3);\n }", "protected function getHTTPResponceTextByCode($code) {\n $text = '';\n switch ($code) {\n case 100: $text = 'Continue'; break;\n case 101: $text = 'Switching Protocols'; break;\n case 200: $text = 'OK'; break;\n case 201: $text = 'Created'; break;\n case 202: $text = 'Accepted'; break;\n case 203: $text = 'Non-Authoritative Information'; break;\n case 204: $text = 'No Content'; break;\n case 205: $text = 'Reset Content'; break;\n case 206: $text = 'Partial Content'; break;\n case 300: $text = 'Multiple Choices'; break;\n case 301: $text = 'Moved Permanently'; break;\n case 302: $text = 'Moved Temporarily'; break;\n case 303: $text = 'See Other'; break;\n case 304: $text = 'Not Modified'; break;\n case 305: $text = 'Use Proxy'; break;\n case 400: $text = 'Bad Request'; break;\n case 401: $text = 'Unauthorized'; break;\n case 402: $text = 'Payment Required'; break;\n case 403: $text = 'Forbidden'; break;\n case 404: $text = 'Not Found'; break;\n case 405: $text = 'Method Not Allowed'; break;\n case 406: $text = 'Not Acceptable'; break;\n case 407: $text = 'Proxy Authentication Required'; break;\n case 408: $text = 'Request Time-out'; break;\n case 409: $text = 'Conflict'; break;\n case 410: $text = 'Gone'; break;\n case 411: $text = 'Length Required'; break;\n case 412: $text = 'Precondition Failed'; break;\n case 413: $text = 'Request Entity Too Large'; break;\n case 414: $text = 'Request-URI Too Large'; break;\n case 415: $text = 'Unsupported Media Type'; break;\n case 500: $text = 'Internal Server Error'; break;\n case 501: $text = 'Not Implemented'; break;\n case 502: $text = 'Bad Gateway'; break;\n case 503: $text = 'Service Unavailable'; break;\n case 504: $text = 'Gateway Time-out'; break;\n case 505: $text = 'HTTP Version not supported'; break;\n default: break;\n }\n return $text;\n }", "public function getHttpCode()\n {\n return $this->code;\n }", "function getStatusCode();", "public function GetMessage()\n {\n if($this->_correctHttpLine != null)\n {\n preg_match(\"|^HTTP/[\\d\\.x]+ \\d+ ([^\\r\\n]+)|\",\n $this->_correctHttpLine, $m);\n if (isset($m[1])) { return $m[1]; }\n }\n return false;\n }", "public function getStatusCode();", "public function getStatusCode();", "public function getStatusCode();" ]
[ "0.73053265", "0.7160599", "0.71346563", "0.70290184", "0.69969416", "0.6822589", "0.6822589", "0.678162", "0.6726381", "0.67052615", "0.67023355", "0.66821796", "0.6654358", "0.65762746", "0.6560805", "0.6540516", "0.64696616", "0.64683145", "0.6461401", "0.6444074", "0.64386886", "0.64209366", "0.64192295", "0.64116865", "0.6406764", "0.63984686", "0.6389409", "0.63760906", "0.63760906", "0.63760906" ]
0.74401766
0
To extract Http message. HTTP Batch Response can be in one of the two formats 1. HTTP/1.1 100 Continue [newline][newline] HTTP/1.1 Code Message In this case the actual code is the Message part of HTTP string in second line 2. HTTP/1.1 Code Message
public function GetMessage() { if($this->_correctHttpLine != null) { preg_match("|^HTTP/[\d\.x]+ \d+ ([^\r\n]+)|", $this->_correctHttpLine, $m); if (isset($m[1])) { return $m[1]; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_response($response){ \r\n \r\n list($response_headers,$response_body) = explode(\"\\r\\n\\r\\n\",$response,2); \r\n $response_header_lines = explode(\"\\r\\n\",$response_headers); \r\n \r\n // first line of headers is the HTTP response code \r\n $http_response_line = array_shift($response_header_lines); \r\n if (preg_match('/^HTTP\\/[0-9]\\.[0-9a-z] ([0-9]{3})/i',$http_response_line,$matches)) { \r\n $response_code = $matches[1]; \r\n }\r\n // put the rest of the headers in an array \r\n $response_header_array = array(); \r\n foreach ($response_header_lines as $header_line) { \r\n list($header,$value) = explode(': ',$header_line,2); \r\n $response_header_array[$header] = $value; \r\n } \r\n \r\n return array($response_code,$response_header_array,$response_body); \r\n}", "public function getResponseMessage();", "protected function getHTTPResponceTextByCode($code) {\n $text = '';\n switch ($code) {\n case 100: $text = 'Continue'; break;\n case 101: $text = 'Switching Protocols'; break;\n case 200: $text = 'OK'; break;\n case 201: $text = 'Created'; break;\n case 202: $text = 'Accepted'; break;\n case 203: $text = 'Non-Authoritative Information'; break;\n case 204: $text = 'No Content'; break;\n case 205: $text = 'Reset Content'; break;\n case 206: $text = 'Partial Content'; break;\n case 300: $text = 'Multiple Choices'; break;\n case 301: $text = 'Moved Permanently'; break;\n case 302: $text = 'Moved Temporarily'; break;\n case 303: $text = 'See Other'; break;\n case 304: $text = 'Not Modified'; break;\n case 305: $text = 'Use Proxy'; break;\n case 400: $text = 'Bad Request'; break;\n case 401: $text = 'Unauthorized'; break;\n case 402: $text = 'Payment Required'; break;\n case 403: $text = 'Forbidden'; break;\n case 404: $text = 'Not Found'; break;\n case 405: $text = 'Method Not Allowed'; break;\n case 406: $text = 'Not Acceptable'; break;\n case 407: $text = 'Proxy Authentication Required'; break;\n case 408: $text = 'Request Time-out'; break;\n case 409: $text = 'Conflict'; break;\n case 410: $text = 'Gone'; break;\n case 411: $text = 'Length Required'; break;\n case 412: $text = 'Precondition Failed'; break;\n case 413: $text = 'Request Entity Too Large'; break;\n case 414: $text = 'Request-URI Too Large'; break;\n case 415: $text = 'Unsupported Media Type'; break;\n case 500: $text = 'Internal Server Error'; break;\n case 501: $text = 'Not Implemented'; break;\n case 502: $text = 'Bad Gateway'; break;\n case 503: $text = 'Service Unavailable'; break;\n case 504: $text = 'Gateway Time-out'; break;\n case 505: $text = 'HTTP Version not supported'; break;\n default: break;\n }\n return $text;\n }", "public function GetCode()\n {\n if($this->_correctHttpLine != null)\n {\n preg_match(\"|^HTTP/[\\d\\.x]+ (\\d+)|\", $this->_correctHttpLine, $m);\n if (isset($m[1])) { return (int)$m[1]; }\n }\n\n return false;\n }", "function get_response_code($header) {\r\n\t$parts = explode(\"\\r\\n\", $header);\r\n\treturn $part[0];\r\n}", "function get_http_response_code()\n\t{\n\t\t//最后一个收到的HTTP代码\n\t\treturn curl_getinfo($this->ch, CURLINFO_HTTP_CODE);\n\t}", "private function parseHttpLine(&$response, $line){\n $splittedLine = explode(' ', $line);\n $protocolAndVersion = explode('/', array_shift($splittedLine));\n $response['protocol'] = trim(array_shift($protocolAndVersion));\n $response['protocol_version'] = trim(array_shift($protocolAndVersion));\n $httpCode = trim(array_shift($splittedLine));\n $response['http_code'] = $httpCode;\n $response['http_message'] = trim(array_shift($splittedLine));\n $response['status'] = 200 <= $httpCode && $httpCode <= 299?'success':'failure';\n }", "public function getCode()\n\t{\n\t\t$matches = array();\n\t\tif (isset($this->headers) && isset($this->headers[0]))\n\t\t\tpreg_match('|HTTP/\\d\\.\\d\\s+(\\d+)\\s+.*|', $this->headers[0], $matches);\n\t\treturn isset($matches[1]) ? (int)$matches[1] : 0;\n\t}", "function http_response_headers($ret_str) {\n\t$hdrs = array();\n $arr = explode(\"\\r\\n\\r\\n\", $ret_str);\n foreach ($arr as $each)\n\t\tif (substr($each, 0, 4) == 'HTTP')\n\t\t\t$hdrs[] = $each;\n return $hdrs;\n}", "function getHttpCode();", "function http_parse_response()\n\t{\n\t\tlist($headers, $body) = explode(\"\\r\\n\\r\\n\", $this->http_response, 2);\n\t\t$this->http_parse_headers($headers);\n\n\t\tif(isset($this->http_response_headers['Transfer-Encoding']) && 'chunked' == $this->http_response_headers['Transfer-Encoding']):\n \t\t$this->http_response_body = $this->http_chunked_decode($body);\n\t\telse:\n\t\t\t$this->http_response_body = $body;\n\t\tendif;\n\n\t\t$this->http_set_content_type($this->http_default_content_type);\n\t}", "private function readHead() {\n\t\t$matches = array();\n\n\t\t// Read and parse status line\n\t\t$status = $this->readLine();\n\t\tif (!preg_match('!^(?:HTTP/(\\d\\.\\d)) (\\d{3})(?: (.+))?!', $status, $matches)) {\n\t\t\tthrow new MOXMAN_Http_HttpClientException(\"Malformed status line: \" . $status);\n\t\t}\n\n\t\t// Debug status line\n\t\tif ($this->client->getLogLevel() >= 2) {\n\t\t\t$this->client->log(\"< \" . trim($status));\n\t\t}\n\n\t\t$this->version = $matches[1];\n\t\t$this->code = intval($matches[2]);\n\t\t$this->message = $matches[3];\n\n\t\t// Read and parse headers\n\t\tdo {\n\t\t\t$line = $this->readLine();\n\n\t\t\t// Debug header line\n\t\t\tif ($this->client->getLogLevel() >= 2) {\n\t\t\t\t$this->client->log(\"< \" . trim($line));\n\t\t\t}\n\n\t\t\tif (preg_match('!^([^\\x00-\\x1f\\x7f-\\xff()<>@,;:\\\\\\\\\"/\\[\\]?={}\\s]+):(.+)$!', $line, $matches)) {\n\t\t\t\t$name = strtolower($matches[1]);\n\t\t\t\t$value = trim($matches[2]);\n\n\t\t\t\t// Put multiple headers with the same name into an array\n\t\t\t\tif (isset($this->headers[$name])) {\n\t\t\t\t\tif (is_array($this->headers[$name])) {\n\t\t\t\t\t\t$this->headers[$name][] = $value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->headers[$name] = array($this->headers[$name], $value);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$this->headers[$name] = $value;\n\t\t\t\t}\n\t\t\t}\n\t\t} while ($line !== \"\");\n\t}", "function parse_response($message)\n{\n $data = _parse_message($message);\n // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space\n // between status-code and reason-phrase is required. But browsers accept\n // responses without space and reason as well.\n if (!preg_match('/^HTTP\\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {\n throw new \\InvalidArgumentException('Invalid response string: ' . $data['start-line']);\n }\n $parts = explode(' ', $data['start-line'], 3);\n\n return new Response(\n $parts[1],\n $data['headers'],\n $data['body'],\n explode('/', $parts[0])[1],\n isset($parts[2]) ? $parts[2] : null\n );\n}", "public function parseResponse($message);", "public function _parseResponce()\n\t\t{\n\t\t\t$pattern = \"/(link_cropped_no\\\" target=\\\"_blank\\\" href=\\\")(.{0,255})(\\\" )/i\";\n\t\t\tpreg_match_all($pattern, $this->responce, $out);\n\t\t\t$this->content = (!empty($out['2'])) ? array_splice($out['2'], false, AMOUNT_OF_RESULTS) : array();\n\t\t}", "function get_headers_from_curl_response($response) {\n $headers = array();\n\n $header_text = substr($response, 0, strpos($response, \"\\r\\n\\r\\n\"));\n\n foreach (explode(\"\\r\\n\", $header_text) as $i => $line)\n if ($i === 0)\n $headers['http_code'] = $line;\n else {\n list ($key, $value) = explode(': ', $line);\n $headers[$key] = $value;\n }\n return $headers;\n}", "#[Pure]\nfunction http_parse_message($message) {}", "protected function _extractHttpCode($header) {\n\t\tpreg_match(\n\t\t\t'#^HTTP/[0-9\\.]+\\s(?P<code>[0-9]+)#i',\n\t\t\t$header,\n\t\t\t$matches\n\t\t);\n\n\t\treturn isset($matches['code'])\n\t\t\t? $matches['code']\n\t\t\t: $this->_defaultCode;\n\t}", "function getHeaders($respHeaders)\n{\n $headers = array();\n\n $headerText = substr($respHeaders, 0, strpos($respHeaders, \"\\r\\n\\r\\n\"));\n\n foreach (explode(\"\\r\\n\", $headerText) as $i => $line) {\n if ($i === 0) {\n $headers['http_code'] = $line;\n } else {\n list($key, $value) = explode(': ', $line);\n\n $headers[$key] = $value;\n }\n }\n\n return $headers;\n}", "public function GetAsHttpResponse()\n {\n $parts = explode(\"--\" . $this->_changesetBoundary,\n $this->_rawHttpBatchResponse, 2);\n return new Microsoft_Http_Response($this->GetCode(),\n HttpResponse::extractHeaders($parts[0]),\n (count($parts) == 2) ?\n ('--' . $this->_changesetBoundary . \"\\n\" . $parts[1]) :\n $parts[0]);\n }", "protected static function ExtractCorrectHttpLine($rawHttpBatchResponse)\n {\n if(preg_match_all(\"|HTTP/[\\d\\.x]+ \\d+ [^\\r\\n]+|\", $rawHttpBatchResponse,\n $multiArray, PREG_OFFSET_CAPTURE))\n {\n if (isset($multiArray[0]))\n {\n if (!(isset($multiArray[0][0]) &&\n isset($multiArray[0][0][0])))\n {\n return null;\n }\n\n $prevHeader = $multiArray[0][0][0];\n $index = self::ExtractBatchBoundaryIndex($rawHttpBatchResponse);\n unset($multiArray[0][0]);\n //If BatchBoundry tag is not present, then return the last HTTP\n //line from the collection.\n if($index == -1)\n {\n $count = count($multiArray[0]);\n if($count > 0)\n {\n $prevHeader = $multiArray[0][$count][0];\n }\n }\n else\n {\n foreach($multiArray[0] as $array)\n {\n if ($array[1] > $index)\n {\n break;\n }\n\n $prevHeader = $array[0];\n }\n }\n\n return $prevHeader;\n }\n }\n\n return null;\n }", "function http_parse_headers($headers) {\n\t\t$replace = ($this->http_linebreak == \"\\n\" ? \"\\r\\n\" : \"\\n\");\n\t\t$headers = str_replace($replace, $this->http_linebreak, trim($headers));\n\t\t$headers = explode($this->http_linebreak, $headers);\n\t\t$this->http_response_headers = array();\n\t\tif (preg_match('/^HTTP\\/\\d\\.\\d (\\d{3})/', $headers[0], $matches)) {\n\t\t $this->http_response_code = intval($matches[1]);\n\t\t array_shift($headers);\n\t\t}\n\t\tif($headers):\n\t\t\tforeach ($headers as $string) {\n\t\t\t list($header, $value) = explode(': ', $string, 2);\n\t\t\t $this->http_response_headers[$header] = trim($value);\n\t\t\t}\n\t\tendif;\n\t}", "function getResponseCodeMessage($code) {\n $code = is_string($code) ? intval($code) : $code;\n switch ($code) {\n case 100: $text = 'Continue';\n break;\n case 101: $text = 'Switching Protocols';\n break;\n case 200: $text = 'OK';\n break;\n case 201: $text = 'Created';\n break;\n case 202: $text = 'Accepted';\n break;\n case 203: $text = 'Non-Authoritative Information';\n break;\n case 204: $text = 'No Content';\n break;\n case 205: $text = 'Reset Content';\n break;\n case 206: $text = 'Partial Content';\n break;\n case 300: $text = 'Multiple Choices';\n break;\n case 301: $text = 'Moved Permanently';\n break;\n case 302: $text = 'Moved Temporarily';\n break;\n case 303: $text = 'See Other';\n break;\n case 304: $text = 'Not Modified';\n break;\n case 305: $text = 'Use Proxy';\n break;\n case 400: $text = 'Bad Request';\n break;\n case 401: $text = 'Unauthorized';\n break;\n case 402: $text = 'Payment Required';\n break;\n case 403: $text = 'Forbidden';\n break;\n case 404: $text = 'Not Found';\n break;\n case 405: $text = 'Method Not Allowed';\n break;\n case 406: $text = 'Not Acceptable';\n break;\n case 407: $text = 'Proxy Authentication Required';\n break;\n case 408: $text = 'Request Time-out';\n break;\n case 409: $text = 'Conflict';\n break;\n case 410: $text = 'Gone';\n break;\n case 411: $text = 'Length Required';\n break;\n case 412: $text = 'Precondition Failed';\n break;\n case 413: $text = 'Request Entity Too Large';\n break;\n case 414: $text = 'Request-URI Too Large';\n break;\n case 415: $text = 'Unsupported Media Type';\n break;\n case 500: $text = 'Internal Server Error';\n break;\n case 501: $text = 'Not Implemented';\n break;\n case 502: $text = 'Bad Gateway';\n break;\n case 503: $text = 'Service Unavailable';\n break;\n case 504: $text = 'Gateway Time-out';\n break;\n case 505: $text = 'HTTP Version not supported';\n break;\n default:\n $text = \"Unknown http status code\";\n break;\n }\n return $text;\n}", "public function getResponseCode();", "public function getResponseCode();", "function http_response_header_lines($hdr_str) {\n\t$lines = explode(\"\\n\", $hdr_str);\n\t$hdr_arr['status_line'] = trim(array_shift($lines));\n\tforeach ($lines as $line) {\n\t\tlist($key, $val) = explode(':', $line, 2);\n\t\t$hdr_arr[trim($key)] = trim($val);\n\t}\n\treturn $hdr_arr;\n}", "function get_http_response_code($url) {\n $headers = get_headers($url);\n return substr($headers[0], 9, 3);\n\t}", "function http_headers_get_response_code() {\n\t\treturn $this->http_response_code;\n\t}", "public static function getHttpStatusMessage(object $errorCode): string\n {\n $httpMessages = [\n // 1xx informational response\n 100 => 'HTTP_CONTINUE',\n 101 => 'HTTP_SWITCHING_PROTOCOLS',\n 102 => 'HTTP_PROCESSING',\n 103 => 'HTTP_EARLY_HINTS',\n // 2xx success\n 200 => 'HTTP_OK',\n 201 => 'HTTP_CREATED',\n 202 => 'HTTP_ACCEPTED',\n 203 => 'HTTP_NON_AUTHORITATIVE_INFORMATION',\n 204 => 'HTTP_NO_CONTENT',\n 205 => 'HTTP_RESET_CONTENT',\n 206 => 'HTTP_PARTIAL_CONTENT',\n 207 => 'HTTP_MULTI_STATUS',\n 208 => 'HTTP_ALREADY_REPORTED',\n 226 => 'HTTP_IM_USED',\n // 3xx redirection\n 300 => 'HTTP_MULTIPLE_CHOICES',\n 301 => 'HTTP_MOVED_PERMANENTLY',\n 302 => 'HTTP_FOUND',\n 303 => 'HTTP_SEE_OTHER',\n 304 => 'HTTP_NOT_MODIFIED',\n 305 => 'HTTP_USE_PROXY',\n 306 => 'HTTP_SWITCH_PROXY',\n 307 => 'HTTP_TEMPORARY_REDIRECT',\n 308 => 'HTTP_PERMANENT_REDIRECT',\n // 4xx client errors\n 400 => 'HTTP_BAD_REQUEST',\n 401 => 'HTTP_UNAUTHORIZED',\n 402 => 'HTTP_PAYMENT_REQUIRED',\n 403 => 'HTTP_FORBIDDEN',\n 404 => 'HTTP_NOT_FOUND',\n 405 => 'HTTP_METHOD_NOT_ALLOWED',\n 406 => 'HTTP_NOT_ACCEPTABLE',\n 407 => 'HTTP_PROXY_AUTHENTICATION_REQUIRED',\n 408 => 'HTTP_REQUEST_TIMEOUT',\n 409 => 'HTTP_CONFLICT',\n 410 => 'HTTP_GONE',\n 411 => 'HTTP_LENGTH_REQUIRED',\n 412 => 'HTTP_PRECONDITION_FAILED',\n 413 => 'HTTP_PAYLOAD_TOO_LARGE',\n 414 => 'HTTP_URI_TOO_LONG',\n 415 => 'HTTP_UNSUPPORTED_MEDIA_TYPE',\n 416 => 'HTTP_RANGE_NOT_SATISFIABLE',\n 417 => 'HTTP_EXPECTATION_FAILED',\n 418 => 'HTTP_IM_A_TEAPOT',\n 421 => 'HTTP_MISIDRECTED_REQUEST',\n 422 => 'HTTP_UNPROCESSABLE_ENTITY',\n 423 => 'HTTP_LOCKED',\n 424 => 'HTTP_FAILED_DEPENDENCY',\n 425 => 'HTTP_TOO_EARLY',\n 426 => 'HTTP_UPGRADE_REQUIRED',\n 428 => 'HTTP_PRECONDITION_REQUIRED',\n 429 => 'HTTP_TOO_MANY_REQUESTS',\n 431 => 'HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE',\n 451 => 'HTTP_UNAVIALBLE_FOR_LEGAL_REASONS',\n // 5xx server errors\n 500 => 'HTTP_INTERNAL_SERVER_ERROR',\n 501 => 'HTTP_NOT_IMPLEMENTED',\n 502 => 'HTTP_BAD_GATEWAY',\n 503 => 'HTTP_SERVICE_UNAVAILABLE',\n 504 => 'HTTP_GATEWAY_TIMEOUT',\n 505 => 'HTTP_VERSION_NOT_SUPPORTED',\n 506 => 'HTTP_VARIANT_ALSO_NEGOTIATES',\n 507 => 'HTTP_INSUFFICIENT_STORAGE',\n 508 => 'HTTP_LOOP_DETECTED',\n 510 => 'HTTP_NOT_EXTENDED',\n 511 => 'HTTP_NETWORK_AUTHENTICATION_REQUIRED',\n // 9xx fallback\n 999 => 'HTTP_UNKNOWN_STATUS',\n ];\n\n if (array_key_exists($errorCode->getStatusCode(), $httpMessages)) {\n return $httpMessages[$errorCode->getStatusCode()];\n }\n\n return '';\n }", "private function parse_curl_response()\n {\n $this->status_code = curl_getinfo($this->curl_handle, CURLINFO_HTTP_CODE);\n #$this->http_info = array_merge($this->http_info, curl_getinfo($this->curl_handle));\n\n $header_size = curl_getinfo($this->curl_handle, CURLINFO_HEADER_SIZE);\n\n // Capture the HTTP response headers\n $this->http_response_headers = substr($this->curl_response, 0, $header_size);\n\n // Capture the HTTP response body\n $this->http_body = substr($this->curl_response, $header_size);\n\n if(!$this->do_not_exit)\n {\n $this->_check_valid_response($this->http_body);\n }\n //close connection\n curl_close($this->curl_handle);\n }" ]
[ "0.61140066", "0.60528487", "0.604479", "0.60415494", "0.60112804", "0.59928155", "0.5948045", "0.59302336", "0.59050107", "0.58951384", "0.58209425", "0.58068085", "0.575463", "0.57237875", "0.57131153", "0.5710398", "0.570705", "0.5674795", "0.5674207", "0.56716305", "0.5651491", "0.5649278", "0.5639042", "0.56080806", "0.56080806", "0.5600276", "0.55568653", "0.55255145", "0.5524014", "0.5519719" ]
0.6855275
0
To extract toplevel headers of batchresponse.
public function GetHeaders() { return HttpResponse::extractHeaders($this->_rawHttpBatchResponse); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function getHeaders();", "public abstract function getHeaders();", "private static function getHeaderAndBody($response) {\n\n $header = self::http_parse_headers(substr($response, 0, strrpos($response,\"\\r\\n\\r\\n\")));\n $body = substr($response, strrpos($response,\"\\r\\n\\r\\n\")+4);\n\n return array($header,$body);\n }", "private function readHeaders() {\n $headers = $this->status->getHeaders();\n\n foreach ($headers as $key => $value) {\n switch ($key) {\n case \"Location\":\n $this->response['location'] = $value[0];\n break;\n\n case \"Content-Type\":\n $this->response['content_type'] = $value[0];\n break;\n\n case \"Content-Length\":\n $this->response['content_length'] = $value[0];\n break;\n\n default:\n break;\n }\n }\n }", "function getresponseheader($header = false){\n $headers = $this->getLastResponseHeaders();\n foreach ($headers as $head){\n if ( is_integer(strpos ($head, $header) )){\n $hstart = strpos ($head, \": \");\n $head = trim(substr($head,$hstart+2,100));\n return $head;\n }\n }\n }", "function http_response_header_lines($hdr_str) {\n\t$lines = explode(\"\\n\", $hdr_str);\n\t$hdr_arr['status_line'] = trim(array_shift($lines));\n\tforeach ($lines as $line) {\n\t\tlist($key, $val) = explode(':', $line, 2);\n\t\t$hdr_arr[trim($key)] = trim($val);\n\t}\n\treturn $hdr_arr;\n}", "public function getHeaders() {}", "public function getHeaders ();", "protected function getLastResponseHeaders()\n {\n return ParserRegistry::getInstance()->getParser('message')\n ->parseResponse($this->client->__getLastResponseHeaders());\n }", "protected static function get_response_headers()\n {\n }", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getHeaders();", "public function getOutputHeaders()\n {\n }", "function getHeaders(){ return $this->_Headers; }", "public function get_headers()\n {\n }", "public function get_headers()\n {\n }", "public function get_headers()\n {\n }", "function get_headers_from_curl_response($response) {\n $headers = array();\n\n $header_text = substr($response, 0, strpos($response, \"\\r\\n\\r\\n\"));\n\n foreach (explode(\"\\r\\n\", $header_text) as $i => $line)\n if ($i === 0)\n $headers['http_code'] = $line;\n else {\n list ($key, $value) = explode(': ', $line);\n $headers[$key] = $value;\n }\n return $headers;\n}", "protected function _parseHeader() {}", "protected function fetchHeader($response)\r\n {\r\n $headers = [];\r\n $headerSize = 0;\r\n $headerParts = explode(PHP_EOL, $response);\r\n\r\n foreach ($headerParts as $headerString) {\r\n\r\n $headerSize += strlen($headerString);\r\n\r\n $headerString = trim($headerString);\r\n if (empty($headerString)) {\r\n break;\r\n }\r\n\r\n if (strpos($headerString, ':') !== false) {\r\n $headerSize += strlen(PHP_EOL);\r\n $headerString = str_replace('\"', '', $headerString);\r\n $headerStringParts = explode(':', $headerString);\r\n $headerStringParts = array_map('trim', $headerStringParts);\r\n\r\n $headers[ $headerStringParts[ 0 ] ] = $headerStringParts[ 1 ];\r\n } elseif (preg_match(\"/(HTTP\\/[0-9].[0-9])\\s([0-9]+)\\s([a-zA-Z]+)/\", $headerString, $matches)) {\r\n $headerSize += strlen(PHP_EOL);\r\n\r\n $this->info->httpVersion = $matches[ 1 ];\r\n $this->info->httpCode = $matches[ 2 ];\r\n $this->info->httpCodeDescription = $matches[ 3 ];\r\n }\r\n }\r\n\r\n $this->headers = new Headers($headers);\r\n\r\n // Update info\r\n if ($this->headers->offsetExists('contentType')) {\r\n $this->info->contentType = $this->headers->offsetGet('contentType');\r\n }\r\n\r\n $this->info->headerSize = $headerSize;\r\n }", "private function returnImapHeadersArr(){\n\t\treturn imap_headers($this->stream);\n\t}", "function http_response_headers($ret_str) {\n\t$hdrs = array();\n $arr = explode(\"\\r\\n\\r\\n\", $ret_str);\n foreach ($arr as $each)\n\t\tif (substr($each, 0, 4) == 'HTTP')\n\t\t\t$hdrs[] = $each;\n return $hdrs;\n}" ]
[ "0.64137524", "0.63815874", "0.63623816", "0.6295206", "0.62773776", "0.6242707", "0.6233439", "0.622414", "0.6211469", "0.6156794", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6149198", "0.6133443", "0.61085224", "0.6059486", "0.6059486", "0.6058573", "0.60550547", "0.6037471", "0.6002308", "0.5992232", "0.59858406" ]
0.696579
0
To get the batch response body.
public function GetRawHttpResponse() { return $this->_rawHttpBatchResponse; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getBody()\n {\n return $this->response;\n }", "public function getBody() {\n\t\treturn $this->response_body;\n\t}", "public function getBody()\n\t{\n\t\tif ( !$this->executed ) {\n\t\t\treturn 'Trying to fetch response body for a pending request.';\n\t\t}\n\t\treturn $this->response_body;\n\t}", "public function get_response_body()\n\t{\n\t\tif ( !$this->executed ) {\n\t\t\tthrow new \\Exception( _t( 'Unable to fetch response body for a pending request.' ) );\n\t\t}\n\n\t\treturn $this->response_body;\n\t}", "public function getBody()\n {\n return $this->invokeWrappedIfEntityEnclosed(__FUNCTION__, func_get_args());\n }", "public function getRawBody()\n {\n return array_key_exists('Body', $this->job) ? $this->job['Body'] : $this->job['body'];\n }", "public function getResponseBody() {\n return $this->body;\n }", "public function GetSubBatchHttpResponses()\n {\n return $this->_httpResponses;\n }", "function getBody()\r\n\t{\r\n\t\tif( $this->debug & DBGTRACE ) echo \"getBody()\\n\";\r\n\t\treturn $this->responseBody;\r\n\t}", "public function getResponseBody(){\n\t\treturn $this->response->getBody();\n\t}", "public function getResponseBody()\r\n\t{\r\n\t\treturn $this->body;\r\n\t}", "public function getResultBody();", "public function getBody() {}", "public function getHttpBody()\n {\n return $this->httpBody;\n }", "private function body()\n {\n return json_decode($this->request->all()[\"job\"], true);\n }", "function getHttpBody() {\n return $this->httpBody;\n }", "public function body()\n {\n return (string)$this->response->getBody();\n }", "public function getRawBody()\n {\n return (string) $this->job->getBody();\n }", "public function getBatch()\n {\n return $this->_batch;\n }", "public function getBody()\n {\n return $this->rawBody;\n }", "function getBody() {\n\t\treturn $this->getData('body');\n\t}", "function getBody() {\n\t\treturn $this->getData('body');\n\t}", "public function getBody() : array\r\n {\r\n return $this->body;\r\n }", "public function getRawBody()\n {\n return $this->job->getMessageBody();\n }", "public function getBody()\r\n\t{\r\n\t\treturn $this->data;\r\n\t}", "protected function getBody()\n {\n return $this->getRequest()->getBody();\n }", "public function getDecodedBody()\r\n\t{\r\n\t\treturn ResponseObjectBuilder::buildFromJSON($this->body);\r\n\t}", "public function getRawBody()\n\t{\n\t\treturn $this->rawJob;\n\t}", "public function getBody() \r\n { \r\n return $this->_bagBody; \r\n }", "public function getBody();" ]
[ "0.70280373", "0.69828504", "0.6885645", "0.67350686", "0.6679059", "0.6639184", "0.6616117", "0.65745234", "0.6566801", "0.65563506", "0.653732", "0.6512043", "0.6510335", "0.6507144", "0.6502652", "0.6501219", "0.6482957", "0.6481892", "0.6472658", "0.64680064", "0.64672595", "0.64672595", "0.6465773", "0.6450744", "0.6449827", "0.643283", "0.6411011", "0.63939214", "0.6392562", "0.63876265" ]
0.7176031
0
Create an HttpResponse object from batchRepsonse.
public function GetAsHttpResponse() { $parts = explode("--" . $this->_changesetBoundary, $this->_rawHttpBatchResponse, 2); return new Microsoft_Http_Response($this->GetCode(), HttpResponse::extractHeaders($parts[0]), (count($parts) == 2) ? ('--' . $this->_changesetBoundary . "\n" . $parts[1]) : $parts[0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function Create($httpBatchResponse)\n {\n $changesetBoundary = null;\n $httpResponses = array();\n if (!self::CheckIsError($httpBatchResponse))\n {\n $changesetBoundary = HttpBatchResponse::ExtractChangesetBoundary($httpBatchResponse);\n if (!isset($changesetBoundary))\n {\n throw new InvalidOperation(Resource::InvalidBatchResponseNoCSBoundary);\n }\n\n $httpResponses = HttpBatchResponse::ExtractHttpResponses($httpBatchResponse,\n $changesetBoundary);\n }\n\n return new HttpBatchResponse($httpResponses, $httpBatchResponse,\n $changesetBoundary);\n }", "protected function createHttpResponse()\n {\n return new Response();\n }", "protected static function ExtractHttpResponses($httpBatchResponse, $changesetBoundary)\n {\n $httpResponses = array();\n $parts = explode( \"--\" . $changesetBoundary, $httpBatchResponse);\n $count = count($parts);\n if($count < 2)\n {\n return $httpResponses;\n }\n\n unset($parts[0]);\n unset($parts[$count-1]);\n foreach ($parts as $changeSet)\n {\n $subParts = preg_split('|(?:\\r?\\n){2}|m', $changeSet, 2);\n $httpResponses[] = Microsoft_Http_Response::fromString($subParts[1]);\n }\n\n return $httpResponses;\n }", "protected function handleBatch()\n {\n if (!($requests = $this->router->getVariable('requests'))) {\n throw new \\ApiException(\\Phork::language()->translate('Missing batch definitions'), 400);\n }\n \n if (!(is_string($requests) && $requests = json_decode($requests, true))) {\n throw new \\ApiException(\\Phork::language()->translate('Invalid batch definitions'), 400);\n }\n \n foreach ($requests as $key => $request) {\n $key = isset($request['key']) ? $request['key'] : $key;\n if (!empty($request['method']) && !empty($request['url'])) {\n switch (strtolower($request['method'])) {\n case 'get':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::get($request['url'], false);\n break;\n\n case 'post':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::post($request['url'], !empty($request['args']) ? $request['args'] : array(), false);\n break;\n\n case 'put':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::put($request['url'], false);\n break;\n\n case 'delete':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::delete($request['url'], false);\n break;\n }\n } else {\n throw new \\ApiException(\\Phork::language()->translate('Missing request type and/or URL'), 400);\n }\n }\n\n $this->success = true;\n $this->result = array(\n 'batched' => isset($result) ? $result : array()\n );\n }", "public function prepareResponse();", "abstract public function createResponse(AbstractRequestClient $request);", "public function GetRawHttpResponse()\n {\n return $this->_rawHttpBatchResponse;\n }", "public function __construct(array $batch)\n\t{\n\t\tif(Tivoka::$version == Tivoka::VER_1_0) throw new Tivoka_exception('Batch requests are not supported by JSON-RPC 1.0 spec', Tivoka::ERR_SPEC_INCOMPATIBLE);\n\t\t$this->id = array();\n\t\n\t\t//prepare requests...\n\t\tforeach($batch as $request)\n\t\t{\n\t\t\tif(!($request instanceof Tivoka_Request) && !($request instanceof Tivoka_Notification))\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t//request...\n\t\t\tif($request instanceof Tivoka_Request)\n\t\t\t{\n\t\t\t\tif(in_array($request->id,$this->id,true)) continue;\n\t\t\t\t$this->id[$request->id] = $request;\n\t\t\t}\n\t\t\t\n\t\t\t$this->request[] = $request->request;\n\t\t}\n\t}", "public function GetSubBatchHttpResponses()\n {\n return $this->_httpResponses;\n }", "public function batch_purchaseorders($limit = 0, $ponbr = '') {\n\t\t\t$original_limit = $limit;\n\t\t\t$responses = array('created' => array(), 'updated' => array());\n\t\t\t$nbr_new = count_dbpurchaseordernbrsnotinsendlog($ponbr);\n\t\t\t$nbr_existing = count_dbpurchaseordernbrsinsendlog($ponbr);\n\t\t\t\n\t\t\t$responses['created'] = $this->create_purchaseorders($limit, $ponbr);\n\t\t\t$limit = max($limit - $nbr_new, 0);\n\t\t\t\n\t\t\tif ($limit > 0 || $original_limit == 0) {\n\t\t\t\t$responses['updated'] = $this->update_purchaseorders($limit, $ponbr);\n\t\t\t}\n\t\t\t\n\t\t\t$this->response = $responses;\n\t\t\treturn $this->response;\n\t\t}", "public function interpretResponse($resparr) {\n\t\t//validate\n\t\tif(count($resparr) < 1 || !is_array($resparr)) {\n\t\t\tthrow new Tivoka_Exception('Expected batch response, but none was received', Tivoka::ERR_INVALID_RESPONSE);\n\t\t}\n\t\n\t\t$requests = $this->id;\n\t\t$nullresps = array();\n\t\t$responses = array();\n\t\n\t\t//split..\n\t\tforeach($resparr as $resp)\n\t\t{\n\t\t\tif(!is_array($resp)) throw new Tivoka_Exception('Expected batch response, but no array was received', Tivoka::ERR_INVALID_RESPONSE);\n\t\t\t\t\n\t\t\t//is jsonrpc protocol?\n\t\t\tif(!isset($resp['jsonrpc']) && !isset($resp['id'])) throw new Tivoka_Exception('The received reponse doesn\\'t implement the JSON-RPC prototcol.', Tivoka::ERR_INVALID_RESPONSE);\n\t\t\t\t\n\t\t\t//responds to an existing request?\n\t\t\tif(!array_key_exists($resp['id'], $requests))\n\t\t\t{\n\t\t\t\tif($resp['id'] != null) continue;\n\t\n\t\t\t\t$nullresps[] = $resp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\t//normal response...\n\t\t\t$requests[ $resp['id'] ]->setResponse(json_encode($resp));\n\t\t\tunset($requests[ $resp['id'] ]);\n\t\t}\n\t\n\t\t//handle id:null responses...\n\t\tforeach($requests as $req)\n\t\t{\n\t\t\t$resp = array_shift($nullresps);\n\t\t\t$requests[ $req->id ]->setResponse(json_encode($resp));\n\t\t}\n\t}", "public function createBatchUpdater()\n {\n return new Util\\BatchUpdater($this->conn->getClient(), $this);\n }", "function get_item_batch()\n\t{\n\t\tif ($_SERVER['REQUEST_METHOD'] == 'POST') {\n\n\t\t\t// $tableName = \"london_stock\";\n\t\t\t// $condition = array();\n\t\t\t$result = $this->CustomModel->get_batch_number();\n\t\t\tif ($result > 0) {\n\t\t\t\techo $response = json_encode($result, true);\n\t\t\t} else {\n\t\t\t\techo $response = json_encode(array('message' => 'No batch', 'type' => 'danger'), true);\n\t\t\t}\n\t\t}\n\t}", "public function executeBatch() {\n if (!$this->isBatch) {\n throw new JsonRpcException('Client is not in batch mode, start a batch operation by calling startBatch() first');\n }\n\n if (empty($this->batchRequests)) {\n throw new JsonRpcException('No batch requests are attached. Use call() first');\n }\n\n $batchRequests = $this->batchRequests;\n $this->discardBatch();\n\n return $this->parseBatchResponse($this->performRequest($batchRequests));\n }", "private function processResponse(Request $request, int $status, array $body): Iterator\n {\n if ($status < 200 || $status >= 300) {\n throw new BatchRequestException(sprintf(\n 'Unexpected status \"%d\" for request \"%s\": %s, %s',\n $status,\n $request->getUri(),\n $body['error']['code'] ?? '',\n $body['error']['message'] ?? '',\n ), $body['error']['message'], $body, $status);\n }\n\n // Map response body (eg. to files)\n /** @var iterable $values */\n $values = $request->hasResponseMapper() ? $request->getResponseMapper()($body) : [$body];\n foreach ($values as $key => $value) {\n // End if over limit (eg. last page has 10 items, but we need only 4)\n if ($this->limit && $this->processedCount >= $this->limit) {\n break;\n }\n\n // It is needed to specify key, otherwise it would be overwritten\n // ... because method is called multiple times, and without specifications are keys: 0, 1, 2 ...\n yield $this->processedCount => $value;\n\n // Increase processed\n $this->processedCount++;\n }\n }", "public function serve_batch_request_v1(\\WP_REST_Request $batch_request)\n {\n }", "public function process()\n {\n \t$client = $this->client->getClient();\n\n \ttry {\n $response = $client->get($this->buildUrl());\n return new ResponseJson((string)$response->getBody(), true);\n } catch (RequestException $e) {\n return new ResponseJson((string)$e->getResponse()->getBody(), false);\n }\n }", "public function build(): BatchRetrieveInventoryCountsResponse\n {\n return CoreHelper::clone($this->instance);\n }", "public function processResponses() {\n\t\t$receivedResponses = $this->receivedResponseMapper->findAll();\n\t\tforeach ($receivedResponses as $receivedResponse) {\n\t\t\t$requestId = $receivedResponse->getRequestId();\n\t\t\t$answer = $receivedResponse->getAnswer();\n\t\t\n\t\t\t$queuedRequest = $this->queuedRequestMapper->find($requestId);\n\t\t\tif ($queuedRequest) {\n\t\t\t\t$type = $queuedRequest->getRequestType();\n\t\t\t\t$field1 = $queuedRequest->getField1();\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//request no longer exists, so just delete response\n\t\t\t\t$this->receivedResponseMapper->delete($receivedResponse);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tswitch ($type) {\n\t\t\t\tcase Request::USER_EXISTS:\n\t\t\t\t\tif ($answer !== \"1\" AND $answer !== \"0\") {\n\t\t\t\t\t\t$this->api->log(\"ReceivedResponse for Request USER_EXISTS, request_id = {$receivedResponse->getId()} had invalid response = {$answer}\"); \n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif ($answer === \"0\") {\n\t\t\t\t\t\t$friendships = $this->friendshipMapper->findAllByUser($field1);\n\t\t\t\t\t\tforeach ($friendships as $friendship) {\n\t\t\t\t\t\t\t$this->friendshipMapper->delete($friendship);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$this->api->beginTransaction();\n\t\t\t\t\t//Don't need destination for delete since they should all be this instance\n\t\t\t\t\t$this->receivedResponseMapper->delete($receivedResponse);\n \t\t\t\t\t$this->queuedRequestMapper->delete($receivedResponse);\n\t\t\t\t\t$this->api->commit();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Request::FETCH_USER: \n\t\t\t\t\tif ($answer !== \"1\" AND $answer !== \"0\") {\n\t\t\t\t\t\t$this->api->log(\"ReceivedResponse for Request FETCH_USER, request_id = {$receivedResponse->getId()} had invalid response = {$answer}\"); \n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->api->beginTransaction();\n\t\t\t\t\t//Don't need destination for delete since they should all be this instance\n\t\t\t\t\t$this->receivedResponseMapper->delete($receivedResponse);\n \t\t\t\t\t$this->queuedRequestMapper->delete($receivedResponse);\n\t\t\t\t\t$this->api->commit();\n\t\t\t\t\t\n\t\t\t\t\tbreak;\t\n\t\t\t\tdefault:\n\t\t\t\t\t$this->api->log(\"Invalid request_type {$type} for request id {$requestId}\");\n\t\t\t\t\tcontinue;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public function getHttpResponse();", "private function createResponse($request)\n {\n return json_decode($request->getBody()->getContents());\n }", "public function store(CreateBatchRequest $request)\n {\n try {\n $batch = new Batch($request->all());\n $batch->save();\n activity()->causedBy(Auth::user())->performedOn($batch)->withProperties($batch)->log('Created Successfully');\n } catch (JWTException $e) {\n throw new HttpException(500);\n }\n return response()->json($batch);\n }", "public function testRetrieveChunkedHttpResponse()\n {\n $client = new HttpClient();\n $response = $client->send(\n HttpRequestMethod::GET,\n 'https://postman-echo.com/stream/5'\n );\n\n $this->assertEquals(200, $response->getStatusCode());\n $this->assertEquals('OK', $response->getReasonPhrase());\n $this->assertNotEmpty($response->getBody());\n $this->assertNotEmpty($response->getHeaders());\n }", "public function setHttpResponse($httpResponse);", "public function chunk(string $content): ResponseInterface;", "public static function batchDelete() {\n $result = array();\n $copied = lC_Products_Admin::batchDelete($_GET['batch']);\n if ($copied) {\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n }\n\n echo json_encode($result);\n }", "private function _setReponseArray() {\n try {\n $this->RESP = array(\n 'MSG' => $this->MSG,\n 'STATUS' => $this->STATUS\n );\n } catch (Exception $ex) {\n throw new Exception('Crud Model : Error in _setReponseArray function - ' . $ex);\n }\n }", "public function actionBatchCreate()\n\t{\n\t\t//batch inicio\n\t\t$models=array();\n\t\t$user=User::model()->getUserActualModel();\n\t\t$unidades=null;\n\t\t// batch fin\n\t\tfor ($i=1; $i <= 34 ; $i++) { \n\t\t\t$idunidad=$i;\n\t\t\tif(strlen((string)$i)==1){\n\t\t\t\t$idunidad='0'.$i;\n\t\t\t}\n\t\t\t$unidades=Contacto::model()->load2($user->nick,$idunidad);\n\t\t\tif(!empty($unidades))\n\t\t\t\tbreak;\n\t\t}\n\t\tif(empty($unidades)){\n\t\t\t$this->redirect(array('mensajefinal'));\n\t\t}\n\t\tforeach ($unidades as $key => $value) {\n\t\t\t$models[$key]=new Respuestas;\n\t\t\t$models[$key]->id_con=$value->id_con;\n\t\t\t$models[$key]->_contacto=Contacto::model()->load3($value->id_con);\n\t\t}\n\t\tif(isset($_POST['Respuestas']))\n\t\t{\n\n\t\t\tforeach($models as $key=>$value)\n\t\t\t{\n\t\t\t\t$value->attributes=$_POST['Respuestas'][$key];\n\t\t\t\t$value->save();\n\t\t\t}\n\t\t\t$this->redirect(array('router'));\n\n\t\t}\n\n\t\t$this->render('batchCreate',array(\n\t\t\t'models'=>$models,\n\t\t\t));\n\t}", "protected function Transform_Response($response)\n\t{\n\t\t\n\t\tif (is_string($response))\n\t\t{\n\t\t\t$response = new OLP_Response($response);\n\t\t}\n\t\t\n\t\t// we want the merged result so we have tokens for promo_id, etc.\n\t\t$data = array_merge($response->Signature()->To_Array(), $response->Collection()->To_Array());\n\t\t\n\t\t$proxy = new stdClass();\n\t\t$proxy->session_id = $response->Unique_ID();\n\t\t$proxy->page = $response->Page();\n\t\t$proxy->data = $data;\n\t\t$proxy->errors = $response->Errors()->To_Array();\n\t\t$proxy->event = array();\n\t\t\n\t\t// if we have a <section> element, turn it into\n\t\t// the eds_page in the response, using XSLT\n\t\tif (count($response->Content()->Sections()))\n\t\t{\n\t\t\t\n\t\t\t// which style-sheet?\n\t\t\t$xslt = DIR_SHARED.\"/xsl/{$response->Page()}.xsl\";\n\t\t\t\n\t\t\tif (is_file($xslt))\n\t\t\t{\n\t\t\t\t// transform our response\n\t\t\t\t$content = Transform_XML($xslt, $response->Received());\n\t\t\t\t$proxy->eds_page = array('content'=>$content, 'type'=>'text/html');\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn $proxy;\n\t\t\n\t}", "public function createResponse()\n {\n return new Response;\n }" ]
[ "0.64113384", "0.56899434", "0.56572616", "0.54901344", "0.5431552", "0.5372023", "0.5323436", "0.52802426", "0.52423775", "0.5124832", "0.51198983", "0.50455624", "0.49501958", "0.49172592", "0.48963156", "0.48269325", "0.4823379", "0.48204407", "0.48143843", "0.481249", "0.48080623", "0.47948244", "0.47838122", "0.47802046", "0.47733167", "0.47627613", "0.47600403", "0.4736692", "0.47319868", "0.4723826" ]
0.5994857
1
Construct a HttpBatchResponse object from raw batch response.
public static function Create($httpBatchResponse) { $changesetBoundary = null; $httpResponses = array(); if (!self::CheckIsError($httpBatchResponse)) { $changesetBoundary = HttpBatchResponse::ExtractChangesetBoundary($httpBatchResponse); if (!isset($changesetBoundary)) { throw new InvalidOperation(Resource::InvalidBatchResponseNoCSBoundary); } $httpResponses = HttpBatchResponse::ExtractHttpResponses($httpBatchResponse, $changesetBoundary); } return new HttpBatchResponse($httpResponses, $httpBatchResponse, $changesetBoundary); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GetAsHttpResponse()\n {\n $parts = explode(\"--\" . $this->_changesetBoundary,\n $this->_rawHttpBatchResponse, 2);\n return new Microsoft_Http_Response($this->GetCode(),\n HttpResponse::extractHeaders($parts[0]),\n (count($parts) == 2) ?\n ('--' . $this->_changesetBoundary . \"\\n\" . $parts[1]) :\n $parts[0]);\n }", "public function __construct(array $batch)\n\t{\n\t\tif(Tivoka::$version == Tivoka::VER_1_0) throw new Tivoka_exception('Batch requests are not supported by JSON-RPC 1.0 spec', Tivoka::ERR_SPEC_INCOMPATIBLE);\n\t\t$this->id = array();\n\t\n\t\t//prepare requests...\n\t\tforeach($batch as $request)\n\t\t{\n\t\t\tif(!($request instanceof Tivoka_Request) && !($request instanceof Tivoka_Notification))\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t//request...\n\t\t\tif($request instanceof Tivoka_Request)\n\t\t\t{\n\t\t\t\tif(in_array($request->id,$this->id,true)) continue;\n\t\t\t\t$this->id[$request->id] = $request;\n\t\t\t}\n\t\t\t\n\t\t\t$this->request[] = $request->request;\n\t\t}\n\t}", "protected static function ExtractCorrectHttpLine($rawHttpBatchResponse)\n {\n if(preg_match_all(\"|HTTP/[\\d\\.x]+ \\d+ [^\\r\\n]+|\", $rawHttpBatchResponse,\n $multiArray, PREG_OFFSET_CAPTURE))\n {\n if (isset($multiArray[0]))\n {\n if (!(isset($multiArray[0][0]) &&\n isset($multiArray[0][0][0])))\n {\n return null;\n }\n\n $prevHeader = $multiArray[0][0][0];\n $index = self::ExtractBatchBoundaryIndex($rawHttpBatchResponse);\n unset($multiArray[0][0]);\n //If BatchBoundry tag is not present, then return the last HTTP\n //line from the collection.\n if($index == -1)\n {\n $count = count($multiArray[0]);\n if($count > 0)\n {\n $prevHeader = $multiArray[0][$count][0];\n }\n }\n else\n {\n foreach($multiArray[0] as $array)\n {\n if ($array[1] > $index)\n {\n break;\n }\n\n $prevHeader = $array[0];\n }\n }\n\n return $prevHeader;\n }\n }\n\n return null;\n }", "public function parse()\r\n\t{\r\n\t\tif(is_string($this->_raw)) {\r\n\t\t\t$response = self::toArray($this->_format, $this->_raw);\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$response = $this->_raw;\r\n\t\t}\r\n\r\n\t\tif(!empty($response['error_code'])) {\r\n\t\t\tthrow new MediaMonks_Service_Hyves_Response_Exception($response['error_message'], $response['error_code']);\r\n\t\t}\r\n\t\t\r\n\t\tif(null == $this->_method && !empty($response['method'])) {\r\n\t\t\t$this->_method = $response['method'];\r\n\t\t\tunset($response['method']);\r\n\t\t}\r\n\t\t\r\n\t\t$this->_info = $response['info'];\r\n\t\tunset($response['info']);\r\n\t\t\r\n\t\t$this->_body = $response;\r\n\t\t\r\n\t\t// pagination\r\n\t\tif(!empty($this->_info['totalresults'])) {\r\n\t\t\t$this->_paginated = true;\r\n\t\t}\r\n\t\t\r\n\t\t$this->_parsed = true;\r\n\t\treturn $this;\r\n\t}", "private function make_response_array($response) {\n $myarray = array();\n $data = explode(\"\\n\", $response);\n if (strpos($data[0], 'HTTP') === 0) {\n // the first line is a status code\n $myarray['status'] = $data[0];\n array_shift($data);\n }\n foreach ($data as $part) {\n if (json_decode($part)) {\n $myarray[] = json_decode($part);\n continue;\n }\n $middle = explode(\": \", $part, 2);\n $myarray[trim($middle[0])] = trim($middle[1]);\n }\n return $myarray;\n }", "public function __construct($raw) {\n parent::__construct($raw);\n\n // Map all response data into this object\n $this->transactionGroupId = $this->response['transaction_group_id']['@attributes']['id'];\n $this->transactionInfos = array();\n if (Text2PayApi_Common::isAssocArray($this->response['transaction_group_id']['transaction_id'])) {\n // it is a single transaction\n $trxid = $this->response['transaction_group_id']['transaction_id']['@attributes']['id'];\n $confirmation = $this->response['transaction_group_id']['transaction_id']['confirmation'];\n $this->transactionInfos[] = new Text2PayApi_verifyTransaction_TransactionInfo($trxid, $confirmation);\n }\n else {\n // it is a list of multiple transactions\n foreach($this->response['transaction_group_id']['transaction_id'] as $t) {\n $trxid = $t['@attributes']['id'];\n $confirmation = $t['confirmation'];\n \t$this->transactionInfos[] = new Text2PayApi_verifyTransaction_TransactionInfo($trxid, $confirmation);\n }\n }\n }", "public static function fromBaseResponse($response)\n {\n $baseResponse = $response->baseResponse;\n\n return new static(\n new Psr7Response($baseResponse->getStatusCode(), $baseResponse->headers->all(), $baseResponse->getContent()),\n $response\n );\n }", "protected static function ExtractHttpResponses($httpBatchResponse, $changesetBoundary)\n {\n $httpResponses = array();\n $parts = explode( \"--\" . $changesetBoundary, $httpBatchResponse);\n $count = count($parts);\n if($count < 2)\n {\n return $httpResponses;\n }\n\n unset($parts[0]);\n unset($parts[$count-1]);\n foreach ($parts as $changeSet)\n {\n $subParts = preg_split('|(?:\\r?\\n){2}|m', $changeSet, 2);\n $httpResponses[] = Microsoft_Http_Response::fromString($subParts[1]);\n }\n\n return $httpResponses;\n }", "public function interpretResponse($resparr) {\n\t\t//validate\n\t\tif(count($resparr) < 1 || !is_array($resparr)) {\n\t\t\tthrow new Tivoka_Exception('Expected batch response, but none was received', Tivoka::ERR_INVALID_RESPONSE);\n\t\t}\n\t\n\t\t$requests = $this->id;\n\t\t$nullresps = array();\n\t\t$responses = array();\n\t\n\t\t//split..\n\t\tforeach($resparr as $resp)\n\t\t{\n\t\t\tif(!is_array($resp)) throw new Tivoka_Exception('Expected batch response, but no array was received', Tivoka::ERR_INVALID_RESPONSE);\n\t\t\t\t\n\t\t\t//is jsonrpc protocol?\n\t\t\tif(!isset($resp['jsonrpc']) && !isset($resp['id'])) throw new Tivoka_Exception('The received reponse doesn\\'t implement the JSON-RPC prototcol.', Tivoka::ERR_INVALID_RESPONSE);\n\t\t\t\t\n\t\t\t//responds to an existing request?\n\t\t\tif(!array_key_exists($resp['id'], $requests))\n\t\t\t{\n\t\t\t\tif($resp['id'] != null) continue;\n\t\n\t\t\t\t$nullresps[] = $resp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\t//normal response...\n\t\t\t$requests[ $resp['id'] ]->setResponse(json_encode($resp));\n\t\t\tunset($requests[ $resp['id'] ]);\n\t\t}\n\t\n\t\t//handle id:null responses...\n\t\tforeach($requests as $req)\n\t\t{\n\t\t\t$resp = array_shift($nullresps);\n\t\t\t$requests[ $req->id ]->setResponse(json_encode($resp));\n\t\t}\n\t}", "private function parseDefaultResponse($rawResponse)\n {\n if (isset($rawResponse->body) && $rawResponse->body != '') {\n switch ($rawResponse->type) {\n case 'application/json':\n $content = JsonHelper::decode((string) $rawResponse->body);\n break;\n case 'application/msgpack':\n case 'application/x-msgpack':\n $content = msgpack_unpack((string) $rawResponse->body);\n break;\n default:\n $this->buildExceptionFromResponse($rawResponse);\n }\n if (!isset($content)) {\n $this->buildExceptionFromResponse($rawResponse);\n }\n } else {\n $content = null;\n }\n if (!isset($content['success'])) {\n $content = [\n 'success' => true,\n 'data' => $content,\n ];\n }\n if (!isset($rawResponse->headers['content-id']) && count($this->requests) == 1) {\n $rawResponse->headers['content-id'] = $this->requests[0]->id;\n }\n if (!isset($rawResponse->headers['content-id'])) {\n throw new Exception('Invalid response!');\n }\n $content['id'] = $rawResponse->headers['content-id'];\n $meta = isset($content['meta']) ? $content['meta'] : [];\n $content['meta'] = array_merge($rawResponse->customHeaders, $meta);\n $content['meta']['statusCode'] = (int) $rawResponse->statusCode;\n $content['headers'] = $rawResponse->headers;\n if (isset($content['data'])) {\n FileHelper::processFiles($content['data'], $content['id']);\n }\n if ((int) $rawResponse->statusCode >= 400 && $content['success']) {\n $content['success'] = false;\n $content['error'] = [\n 'code' => ResponseError::ERRORCODE_HTTP_ERROR,\n 'message' => $rawResponse->statusCode,\n ];\n }\n\n return new ApiResponse($content);\n }", "function _parseResponse($res) {\n\n\t\t// set defaults\n\t\t$response = $this->response;\n\t\t$response['raw']['response'] = $res;\n\n\t\t// parse header\n\t\tif (preg_match(\"/^(.+\\r\\n)(.*)(?<=\\r\\n)\\r\\n/Us\", $res, $match)) {\n\t\t\t\n\t\t\tlist($null, $response['raw']['status-line'], $response['raw']['header']) = $match;\n\t\t\t$response['raw']['body'] = substr($res, strlen($match[0]));\n\n\t\t\tif (preg_match(\"/(.+) ([0-9]{3}) (.+)\\r\\n/DU\", $response['raw']['status-line'], $match)) {\n\t\t\t\t$response['status']['http-version'] = $match[1];\n\t\t\t\t$response['status']['code'] = (int) $match[2];\n\t\t\t\t$response['status']['reason-phrase'] = $match[3];\n\t\t\t}\n\n\t\t\t$response['header'] = $this->_parseHeader($response['raw']['header']);\n\t\t\t$response['body'] = $response['raw']['body'];\n\n\t\t\tif (!empty($response['header'])) {\n\t\t\t\t$response['cookies'] = $this->parseCookies($response['header']);\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\t$response['body'] = $res;\n\t\t\t$response['raw']['body'] = $res;\n\t\t}\n\n\t\tif (isset($response['header']['Transfer-Encoding']) && $response['header']['Transfer-Encoding'] == 'chunked') {\n\t\t\t$response['body'] = $this->_decodeChunkedBody($response['body']);\n\t\t}\n\n\t\tforeach ($response['raw'] as $field => $val) {\n\t\t\tif ($val === '') {\n\t\t\t\t$response['raw'][$field] = null;\n\t\t\t}\n\t\t}\n\n\t\treturn $response;\n\t}", "private function parseMultipartMixedResponse($rawResponse)\n {\n $responses = [];\n foreach ($rawResponse->parts as $part) {\n $response = null;\n try {\n $this->lastParsedContentId = null;\n $response = $this->parseResponse($part);\n } catch (\\Throwable $ex) {\n $response = new ApiResponse([\n 'id' => $this->lastParsedContentId ?? join('-', ['sdkError', ApiHelper::generateId()]),\n 'success' => false,\n 'error' => new ResponseError([\n 'type' => get_class($ex),\n 'code' => $ex->getCode(),\n 'message' => ['httpError' => $ex->getMessage()],\n 'exception' => $ex,\n ]),\n ]);\n }\n $responses[$response->id] = $response;\n }\n\n return $responses;\n }", "public static function createFromRaw(string $rawResponse, string $responseClassName = Response::class): ResponseInterface\n {\n $response = new $responseClassName();\n\n if (!$response instanceof ResponseInterface) {\n throw new \\InvalidArgumentException(sprintf('The given response class name \"%s\" does not implement the \"%s\" and cannot be created with this method.', $responseClassName, ResponseInterface::class));\n }\n\n // see https://tools.ietf.org/html/rfc7230#section-3.5\n $lines = explode(chr(10), $rawResponse);\n $statusLine = array_shift($lines);\n\n if (substr($statusLine, 0, 5) !== 'HTTP/') {\n throw new \\InvalidArgumentException('The given raw HTTP message is not a valid response.', 1335175601);\n }\n list($httpAndVersion, $statusCode, $reasonPhrase) = explode(' ', $statusLine, 3);\n $version = explode('/', $httpAndVersion)[1];\n if (strlen($statusCode) !== 3) {\n // See https://tools.ietf.org/html/rfc7230#section-3.1.2\n throw new \\InvalidArgumentException('The given raw HTTP message contains an invalid status code.', 1502981352);\n }\n $response = $response->withStatus((integer)$statusCode, trim($reasonPhrase));\n $response = $response->withProtocolVersion($version);\n\n $parsingHeader = true;\n $contentLines = [];\n $headers = new Headers();\n foreach ($lines as $line) {\n if ($parsingHeader) {\n if (trim($line) === '') {\n $parsingHeader = false;\n continue;\n }\n $headerSeparatorIndex = strpos($line, ':');\n if ($headerSeparatorIndex === false) {\n throw new \\InvalidArgumentException('The given raw HTTP message contains an invalid header.', 1502984804);\n }\n $fieldName = trim(substr($line, 0, $headerSeparatorIndex));\n $fieldValue = trim(substr($line, strlen($fieldName) + 1));\n if (strtoupper(substr($fieldName, 0, 10)) === 'SET-COOKIE') {\n $cookie = Cookie::createFromRawSetCookieHeader($fieldValue);\n if ($cookie !== null) {\n $headers->setCookie($cookie);\n }\n } else {\n $headers->set($fieldName, $fieldValue, false);\n }\n } else {\n $contentLines[] = $line;\n }\n }\n if ($parsingHeader === true) {\n throw new \\InvalidArgumentException('The given raw HTTP message contains no separating empty line between header and body.', 1502984823);\n }\n $content = implode(chr(10), $contentLines);\n\n $response->setHeaders($headers);\n $response = $response->withBody(ArgumentsHelper::createContentStreamFromString($content));\n\n return $response;\n }", "protected static function deserializeCsvResponse(string $rawResponse, AbstractCsvResponse $model): AbstractCsvResponse {\n\n $model->setRawResponse($rawResponse);\n\n $lines = explode(\"\\n\", $rawResponse);\n\n $count = count($lines);\n if ($count <= 1) {\n return $model;\n }\n\n $headers = explode(\",\", $lines[0]);\n\n for ($i = 1; $i < $count; ++$i) {\n\n $current = $lines[$i];\n if (\"\" === $current) {\n continue;\n }\n\n $model->addAdresse(static::deserializeAdresse($current, $headers));\n }\n\n return $model;\n }", "protected function parseResponse()\n {\n // get the status code from response.\n $statusCode = $this->httpResponse->getStatusCode();\n\n // set as error, if http status code is not between 200 and 299 (inclusive).\n $this->networkError = !($statusCode >= 200 && $statusCode <= 299);\n\n // decode the response body.\n $body = $this->decodeBody();\n\n // stop when no body is present.\n if ($body) {\n // parse the response id from the body.\n $this->id = (int) array_get($body, 'id', null);\n\n // set as error when there is a an error key and it's not null.\n $this->isError = array_get($body, 'error', null) !== null;\n\n // parse the response data, from result or error.\n $this->data = collect(array_get($body, $this->isError ? 'error' : 'result', []));\n }\n\n // just return the response body.\n return $this->body;\n }", "public function __construct($response)\n {\n @list($this->rawHeaders, $this->body) = explode(\"\\r\\n\\r\\n\", $response, 2);\n\n $this->buildHeaders($this->rawHeaders);\n }", "public function GetRawHttpResponse()\n {\n return $this->_rawHttpBatchResponse;\n }", "public static function deserializeCollectionResponse(string $rawResponse): CollectionResponse {\n\n $data = json_decode(trim($rawResponse), true);\n\n $model = new CollectionResponse();\n $model->setRawResponse($rawResponse);\n\n if (null === $data) {\n return $model;\n }\n\n foreach (ArrayHelper::get($data, \"media\", []) as $current) {\n\n $type = ArrayHelper::get($current, \"type\");\n if (\"Photo\" === $type) {\n $model->addMedia(JsonDeserializer::deserializePhoto($current));\n }\n if (\"Video\" === $type) {\n $model->addMedia(JsonDeserializer::deserializeVideo($current));\n }\n }\n\n $model->setPage(intval(ArrayHelper::get($data, \"page\", -1)));\n $model->setPerPage(intval(ArrayHelper::get($data, \"per_page\", -1)));\n $model->setTotalResults(intval(ArrayHelper::get($data, \"total_results\", -1)));\n $model->setNextPage(ArrayHelper::get($data, \"next_page\"));\n $model->setPrevPage(ArrayHelper::get($data, \"prev_page\"));\n\n return $model;\n }", "protected function init()\n {\n if ($this->request->getResponseFormat() == 'xml') {\n $aggregated = new \\SimpleXMLElement('<response/>');\n foreach ($this->responseRaw as $name => $response) {\n $child = $aggregated->addChild('classification');\n $child->addAttribute('classifier', $name);\n $xml = simplexml_load_string($response);\n\n if (! $xml instanceof \\SimpleXMLElement) {\n throw new ServiceReaderException('Failed parsing XML response.');\n }\n\n if ((string) $xml->status->attributes()->success !== 'true') {\n throw new ServiceReaderException($xml->status->attributes()->statusCode);\n }\n\n foreach ($xml->readCalls->classify as $classify) {\n $child->addAttribute('textCoverage', $classify->classification->attributes()->textCoverage);\n foreach ($classify->classification->class as $class) {\n $this->simplexmlImportXml($child, $class->asXML());\n }\n }\n }\n\n return $aggregated->asXML();\n }\n\n if ($this->request->getResponseFormat() == 'json') {\n $aggregated = array();\n foreach ($this->responseRaw as $name => $response) {\n $current = json_decode($response, 1);\n\n if (! array_key_exists('success', $current)) {\n throw new ServiceReaderException('Unable to complete request');\n }\n\n if ($current['success'] !== true) {\n throw new ServiceReaderException($current['statusCode'] . ' ' . $current['errorMessage']);\n }\n\n array_key_exists('textCoverage', $current) ? '' : $current['textCoverage'] = null;\n array_key_exists('cls1', $current) ? '' : $current['cls1'] = null;\n\n $aggregated[] = array(\n 'classifier' => $name,\n 'textCoverage' => $current['textCoverage'],\n 'classes' => $current['cls1']\n );\n }\n\n return json_encode($aggregated);\n }\n\n return $this->responseRaw;\n }", "private function parseResponse() {\n $headers = Strings::split(substr($this->response, 0, $this->info['header_size']), \"~[\\n\\r]+~\", PREG_SPLIT_NO_EMPTY);\n $this->headers = static::parseHeaders($headers);\n $this->body = substr($this->response, $this->info['header_size']);\n $this->response = NULL;\n }", "public function __construct($raw) {\n\n // Map all response data into this object\n $this->transactionId = $raw['@attributes']['id'];\n if (!empty($raw['merchant_reference']))\n $this->merchantRef = $raw['merchant_reference'];\n $this->confirmationStatus = $raw['confirmation_status'];\n $this->statusCode = $raw['status_code'];\n $this->statusTitle = $raw['status_title'];\n $this->statusDescription = $raw['status_description'];\n $this->serviceId = $raw['service_id'];\n $this->pricePoint = $raw['price_point'];\n $this->commodityAmount = $raw['commodity_amount'];\n }", "private function parse()\n {\n if ($this->isError()) {\n // error parsing\n if (empty($this->body) || !isset($this->body['errors'])) {\n // response body isn't an error object, return a custom one\n $error = new Entity\\Error();\n $error->message = \"Error $this->http_status\";\n $error->name = \"INVALID REQUEST\";\n $error->at = \"\";\n $this->objects[] = $error;\n } else {\n // parse error\n $errors = $this->body['errors'];\n foreach ($errors as $error) {\n $this->objects[] = Entity\\Error::parse($error);\n }\n }\n } else if (isset($this->body['card'])) {\n // card parsing\n $cards = $this->body['card'];\n foreach ($cards as $card) {\n $this->objects[] = Entity\\Card::parse($card);\n }\n } else if (isset($this->body['paymentmethod'])) {\n // payment parsing\n $this->objects[] = Entity\\Payment::parse($this->body);\n if (isset($this->body['subscription_plan'])) {\n // subscription also found, payment is a subscription\n $this->objects[] = Entity\\Subscription::parse($this->body['subscription_plan']);\n }\n } else if (isset($this->body['vendor'])) {\n // vendor parsing\n $this->objects[] = Entity\\Vendor::parse($this->body['vendor']);\n } else if (isset($this->body['item'])) {\n // item parsing\n $this->objects[] = Entity\\Item::parse($this->body['item']);\n } else if (isset($this->body['refunded'])) {\n // refund parsing, same as payment\n $this->objects[] = Entity\\Payment::parse($this->body);\n } else if (isset($this->body['subscription_plan'])) {\n // subscription parsing\n $this->objects[] = Entity\\Subscription::parse($this->body['subscription_plan']);\n } else if (isset($this->body['deleted'])) {\n // nothing to return\n } else {\n throw new \\RuntimeException('Could not recognize response type');\n }\n }", "public function __construct($response)\n {\n // Headers regex\n $pattern = '#HTTP/(\\d\\.\\d|\\d).*?$.*?#ims';\n\n // Extract headers from response\n preg_match_all($pattern, $response, $matches);\n\n list($headers, $body) = explode(\"\\r\\n\\r\\n\", $response, 2);\n\n $headers_string = trim(preg_replace($pattern, '', $headers));\n $parsedHeaders = $this->parseHeaders($headers_string);\n\n // Remove headers from the response body\n\n $this->body = trim(str_replace($headers, '', $response));\n // Convert headers into an associative array\n $this->headers = $parsedHeaders;\n\n // Extract the version and status from the first header\n preg_match('#HTTP/(\\d\\.\\d|\\d)\\s(\\d\\d\\d)\\s(.*)#', $response, $matches);\n\n if($matches && count($matches) >= 3){\n $this->headers['httpVersion'] = $matches[1];\n $this->headers['statusCode'] = $matches[2];\n $this->headers['status'] = $matches[2].' '.$matches[3];\n }\n\n }", "function http_parse_response()\n\t{\n\t\tlist($headers, $body) = explode(\"\\r\\n\\r\\n\", $this->http_response, 2);\n\t\t$this->http_parse_headers($headers);\n\n\t\tif(isset($this->http_response_headers['Transfer-Encoding']) && 'chunked' == $this->http_response_headers['Transfer-Encoding']):\n \t\t$this->http_response_body = $this->http_chunked_decode($body);\n\t\telse:\n\t\t\t$this->http_response_body = $body;\n\t\tendif;\n\n\t\t$this->http_set_content_type($this->http_default_content_type);\n\t}", "public function __construct($raw) {\n parent::__construct($raw);\n\n $this->transactionGroupId = $this->response['transaction_group_id']['@attributes']['id'];\n $this->totalPricePoint = $this->response['transaction_group_id']['@attributes']['total_price_point'];\n $this->totalCommodityAmount = $this->response['transaction_group_id']['@attributes']['total_commodity_amount'];\n\n $this->transactionStatusInfos = array();\n if (Text2PayApi_Common::isAssocArray($this->response['transaction_group_id']['transaction_id'])) {\n // it is a single transaction\n array_push($this->transactionStatusInfos, new Text2PayApi_checkTransactionStatus_TransactionStatusInfo($this->response['transaction_group_id']['transaction_id']));\n }\n else {\n // it is a list of multiple transactions\n foreach($this->response['transaction_group_id']['transaction_id'] as $t)\n array_push($this->transactionStatusInfos, new Text2PayApi_checkTransactionStatus_TransactionStatusInfo($t));\n }\n }", "public function build(): BatchRetrieveInventoryCountsResponse\n {\n return CoreHelper::clone($this->instance);\n }", "private function processResponse(Request $request, int $status, array $body): Iterator\n {\n if ($status < 200 || $status >= 300) {\n throw new BatchRequestException(sprintf(\n 'Unexpected status \"%d\" for request \"%s\": %s, %s',\n $status,\n $request->getUri(),\n $body['error']['code'] ?? '',\n $body['error']['message'] ?? '',\n ), $body['error']['message'], $body, $status);\n }\n\n // Map response body (eg. to files)\n /** @var iterable $values */\n $values = $request->hasResponseMapper() ? $request->getResponseMapper()($body) : [$body];\n foreach ($values as $key => $value) {\n // End if over limit (eg. last page has 10 items, but we need only 4)\n if ($this->limit && $this->processedCount >= $this->limit) {\n break;\n }\n\n // It is needed to specify key, otherwise it would be overwritten\n // ... because method is called multiple times, and without specifications are keys: 0, 1, 2 ...\n yield $this->processedCount => $value;\n\n // Increase processed\n $this->processedCount++;\n }\n }", "public static function deserializePhotosResponse(string $rawResponse): PhotosResponse {\n\n $data = json_decode(trim($rawResponse), true);\n\n $model = new PhotosResponse();\n $model->setRawResponse($rawResponse);\n\n if (null === $data) {\n return $model;\n }\n\n $model->setTotalResults(intval(ArrayHelper::get($data, \"total_results\", -1)));\n $model->setPage(intval(ArrayHelper::get($data, \"page\", -1)));\n $model->setPerPage(intval(ArrayHelper::get($data, \"per_page\", -1)));\n $model->setUrl(ArrayHelper::get($data, \"url\"));\n $model->setPrevPage(ArrayHelper::get($data, \"prev_page\"));\n $model->setNextPage(ArrayHelper::get($data, \"next_page\"));\n\n foreach (ArrayHelper::get($data, \"photos\", []) as $current) {\n $model->addPhoto(JsonDeserializer::deserializePhoto($current));\n }\n\n return $model;\n }", "public function createBatchUpdater()\n {\n return new Util\\BatchUpdater($this->conn->getClient(), $this);\n }", "public static function deserializePhotoResponse(string $rawResponse): PhotoResponse {\n\n $data = json_decode(trim($rawResponse), true);\n\n $model = new PhotoResponse();\n $model->setRawResponse($rawResponse);\n\n if (null === $data) {\n return $model;\n }\n\n $model->setPhoto(JsonDeserializer::deserializePhoto($data));\n\n return $model;\n }" ]
[ "0.5658277", "0.56258756", "0.5618119", "0.5466368", "0.5367479", "0.53603345", "0.53492403", "0.5336909", "0.53273875", "0.5327176", "0.5307578", "0.53007185", "0.5270299", "0.52382547", "0.5231376", "0.5222696", "0.51875234", "0.5162311", "0.5123806", "0.5101168", "0.5096934", "0.50935215", "0.5074941", "0.505701", "0.50514543", "0.50261426", "0.50230235", "0.5021909", "0.49994978", "0.4996313" ]
0.7419049
0
This function returns true if batch header of $rawHttpBatchResponse contains HTTP status code for error else false.
protected static function CheckIsError($rawHttpBatchResponse) { $httpLine = self::ExtractCorrectHttpLine($rawHttpBatchResponse); if($httpLine != null) { preg_match("|^HTTP/[\d\.x]+ (\d+)|", $httpLine, $m); if (isset($m[1])) { $floorVal = floor((int)$m[1] / 100); return ($floorVal == 4 || $floorVal == 5); } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hasError()\n {\n return $this->info['http_code'] != '200';\n }", "public function isSuccessful(): bool\n {\n return \\in_array($this->getStatusCode(), [200, 201, 202, 204, 205]);\n }", "public function IsError()\n {\n if($this->_correctHttpLine != null)\n {\n preg_match(\"|^HTTP/[\\d\\.x]+ (\\d+)|\", $this->_correctHttpLine, $m);\n if (isset($m[1]))\n {\n $floorVal = floor((int)$m[1] / 100);\n return ($floorVal == 4 || $floorVal == 5);\n }\n }\n\n return false;\n }", "public function isSuccessful()\n {\n return 400 > $this->statusCode;\n }", "public function isSuccessful()\n {\n return in_array($this->getCode(), ['300', '301', '302', '400']);\n }", "public function isSuccessful(): bool\n {\n return ($this->statusCode >= 200 && $this->statusCode <= 299);\n }", "public function isSuccessful(): bool\n {\n return $this->getStatusCode() >= 200 && $this->getStatusCode() < 300;\n }", "public function has_http_error($response) {\n if(!$response || !isset($response['response']['code']) || !preg_match('/20*/', $response['response']['code']) || !isset($response['body'])) {\n return true;\n }\n return false;\n }", "public function isSuccessful() {\n\t\treturn isset($this->data['status']) && $this->data['status'] >= 200 && $this->data['status'] < 300;\n\t}", "public function isSuccessful()\n {\n return ($this->statusCode >= 200) && ($this->statusCode < 300);\n }", "public function clientError()\n {\n return $this->status() >= 400 && $this->status() < 500;\n }", "public function isSuccessful()\n {\n $status = (int)$this->get('status');\n return $status >= 200 && $status <= 299;\n }", "public function isSuccessful(): bool\n {\n $statusCode = $this->getStatusCode();\n\n return ($statusCode >= 200 && $statusCode < 300) || $statusCode == 304;\n }", "public function isSuccessful()\n {\n return isset($this->data['response_code']) \n && \n ( substr($this->data['response_code'], 2) == '000' );\n }", "public function isSuccessful()\n {\n return $this->response->getStatusCode() >= 200 && $this->response->getStatusCode() < 300;\n }", "public function hasError() {\n return ($this->getStatus() != 1);\n }", "protected function isCaptureResponseErrorCode()\n {\n return in_array($this->reader->getResponseCode(), self::CAPTURE_ERROR_RESPONSE_CODES, true);\n }", "public function hasSuccessHTTPStatus() { return ($this->status == 200); }", "public function hasStatusCode(): bool\n {\n return isset($this->meta['status_code']);\n }", "public function isOk()\n {\n if ($this->statusCode >= 200 && $this->statusCode < 400) {\n return true;\n }\n\n return false;\n }", "public function isValid() : bool\n {\n return in_array($this->getStatusCode(), Response::CODE_LIST);\n }", "public function isSuccessful()\n {\n if (isset($this->data['result'])\n && empty($this->data['result']['parameterErrors'])\n && $this->getCode() < 400) {\n if (!empty($this->data['result']['code'])) {\n $code = $this->data['result']['code'];\n $success = false;\n switch ($code) {\n case (preg_match('/^(000\\.200)/', $code) ? true : false):\n case (preg_match('/^(000\\.000\\.|000\\.100\\.1|000\\.[36])/', $code) ? true : false):\n case (preg_match('/^(000\\.400\\.0|000\\.400\\.100)/', $code) ? true : false):\n $success = true;\n break;\n default:\n $success = false;\n }\n\n return $success;\n }\n\n return false;\n }\n\n return false;\n }", "public function isSuccess(): bool\n {\n return $this->code >= 200 && $this->code < 300;\n }", "public function isSuccessful(): bool\n {\n return $this->json('statusCode') === '00'\n && $this->json('errorCode') === null;\n }", "public function isClientError() {\n return (4 === $this->getStatusClass());\n }", "public function getStatus() {\r\n if ($this->status === \"error\") {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "public function isClientError(): bool\n {\n return $this->code >= 400 && $this->code < 500;\n }", "public function successful()\n {\n return $this->status() >= 200 && $this->status() < 300;\n }", "public function isSuccessful(){\r\n return $this->code>=200&& $this->code <300;\r\n }", "public function hasErrors()\n {\n if (isset($this->_response->ERROR)) {\n return true;\n }\n return false;\n }" ]
[ "0.6734576", "0.6631673", "0.6616551", "0.6596415", "0.64952564", "0.64580846", "0.6440501", "0.6415775", "0.6405771", "0.637121", "0.62749845", "0.62698436", "0.62678117", "0.62673473", "0.6250424", "0.62315995", "0.6211907", "0.6209211", "0.6200225", "0.61797506", "0.61700463", "0.6121437", "0.6111263", "0.60765713", "0.6071539", "0.60655457", "0.6064821", "0.60529095", "0.60502005", "0.60144126" ]
0.7830958
0
To extract the batch boundary index.
protected static function ExtractBatchBoundaryIndex($httpBatchResponse) { preg_match("|boundary=(batchresponse_[^\r\n]+)|", $httpBatchResponse, $m, PREG_OFFSET_CAPTURE); if (isset($m[1]) && isset($m[1][1])) { return $m[1][1]; } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function batchIndex(): ?int;", "protected function getBoundary() {\n\t\treturn $this->boundary;\n\t}", "public function getBoundary()\n {\n return $this->_boundary;\n }", "public function getBoundary()\n {\n if (null === $this->boundary) {\n $this->boundary = uniqid('', true);\n }\n\n return $this->boundary;\n }", "public function getBoundary(): string\n\t{\n\t\treturn $this->boundary;\n\t}", "public function getBoundary()\n\t{\n\t\treturn $this->getContentTypeAttribute('boundary');\n\t}", "public function getBatchID()\n {\n return $this->BatchID;\n }", "function getBatchID()\n\t\t{\n\t\t\treturn $this->BatchID;\n\t\t}", "public function getEndIndex()\n {\n return $this->end_index;\n }", "public function getBatch()\n\t{\n\t\tif (! is_int(self::$batch))\n\t\t{\n\t\t\t$batch = $this->db->table($this->table)\n\t\t\t\t->selectMax('batch')\n\t\t\t\t->get()->getResultObject();\n\t\t\t$batch = empty($batch) ? 0 : (int) reset($batch)->batch;\n\n\t\t\tself::$batch = $batch + 1;\n\t\t}\n\n\t\treturn self::$batch;\n\t}", "function getThisBatchId($db) {\n\t\t$batchId=0;\n\t\t$res=$db->query(\"SELECT MIN(id) as id_min FROM batch\");\n\t\twhile($row=$res->fetch_assoc()) {\n\t\t\t$batchId=$row[\"id_min\"];\n\t\t}\n\t\treturn $batchId+1;\n\t}", "public function GetBackReferencePosPort () {\n\t\tif ($this->backReferencePosPort === NULL)\n\t\t\t$this->preparePatternAndBackReferenceIndexes();\n\t\treturn $this->backReferencePosPort;\n\t}", "public function getBatch()\n {\n return $this->_batch;\n }", "public function getBound()\n {\n return $this->bound;\n }", "public function getBound()\n {\n return $this->bound;\n }", "public function getBoundary()\n {\n if (!isset($this->boundary)) {\n $this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';\n }\n\n return $this->boundary;\n }", "function getBatchObj()\n\t\t{\n\t\t\treturn $this->BatchObj;\n\t\t}", "public function get_batch_id()\n {\n $results = $this->results();\n\n return $results['SubmitNotificationBatchResult']->BatchID;\n }", "public function getCurrentChunkNumber()\n {\n return $this->getParam('flowChunkNumber');\n }", "public function getBatch()\n {\n return isset($this->batch) ? $this->batch : null;\n }", "public function getIdx()\n {\n return $this->get(self::_IDX);\n }", "public function getBatchCode()\n {\n $params = $this->getRequest()->getPost();\n $batch_number = $params['batch_number'];\n if (!$batch_number) {\n $id = (int) $params['entity_id'];\n if (!$id) {\n $id = $this->getRequest()->getParam('id', null); //Get batch id\n }\n if ($id) {\n $batch_number = Mage::getModel('batchcode/batchcode')\n ->load($id)\n ->getBatchNumber();\n }\n }\n\n if (!$batch_number) {\n $batch_number = Mage::helper('batchcode')->__('Invalid');\n }\n\n return $batch_number;\n }", "public function fetchBatchId ()\r\n {\r\n $member_id = $this->getMember_id(true);\r\n $student_class_object = new Acad_Model_StudentClass();\r\n $student_class_object->setMember_id($member_id);\r\n $batch_identifier_class_id = $student_class_object->fetchBatchIdentifierClassId();\r\n $class_object = new Acad_Model_Class();\r\n $class_object->setClass_id($batch_identifier_class_id);\r\n $class_object->fetchInfo();\r\n $batch_id = $class_object->getBatch_id();\r\n return $batch_id;\r\n }", "public function getMarkerIndex()\n {\n return $this->currentMarker;\n }", "protected function getBoundary(): string\n {\n if ($this->boundary === null) {\n $this->boundary = md5(random_bytes(16));\n }\n\n return $this->boundary;\n }", "public function getBoundaries()\n {\n }", "public function getBatchQuantity()\n {\n return $this->batchQuantity;\n }", "public function getLastIndex()\n {\n return $this->index - 1;\n }", "public function getBrickPosition(Brick $brick)\n {\n return array_search($brick, $this->bricks);\n }", "public function indexSeparate() {\n if ($this->_m_indexSeparate !== null)\n return $this->_m_indexSeparate;\n if ($this->isIndexSeparate()) {\n $this->_m_indexSeparate = ($this->indexSeparateMinus() + 176);\n }\n return $this->_m_indexSeparate;\n }" ]
[ "0.66085887", "0.62296146", "0.6126582", "0.6012707", "0.57899404", "0.5724486", "0.5707866", "0.5698865", "0.55410594", "0.5516474", "0.5497138", "0.5449849", "0.5428432", "0.5403393", "0.5403393", "0.53790146", "0.5368912", "0.5328668", "0.5304338", "0.52558756", "0.5255347", "0.52226245", "0.51787084", "0.5167284", "0.5160176", "0.51462877", "0.5140723", "0.51131415", "0.509689", "0.50958616" ]
0.67002594
0
This function will extract the changesets from raw batch response and generate a list of Microsoft_Http_Response objects.
protected static function ExtractHttpResponses($httpBatchResponse, $changesetBoundary) { $httpResponses = array(); $parts = explode( "--" . $changesetBoundary, $httpBatchResponse); $count = count($parts); if($count < 2) { return $httpResponses; } unset($parts[0]); unset($parts[$count-1]); foreach ($parts as $changeSet) { $subParts = preg_split('|(?:\r?\n){2}|m', $changeSet, 2); $httpResponses[] = Microsoft_Http_Response::fromString($subParts[1]); } return $httpResponses; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GetAsHttpResponse()\n {\n $parts = explode(\"--\" . $this->_changesetBoundary,\n $this->_rawHttpBatchResponse, 2);\n return new Microsoft_Http_Response($this->GetCode(),\n HttpResponse::extractHeaders($parts[0]),\n (count($parts) == 2) ?\n ('--' . $this->_changesetBoundary . \"\\n\" . $parts[1]) :\n $parts[0]);\n }", "public function GetSubBatchHttpResponses()\n {\n return $this->_httpResponses;\n }", "private function getRollbackList(int $batch): array\r\n {\r\n $listRs = DB::table('migrations')->select('id', 'migration')\r\n ->where('batch', $batch)\r\n ->orderBy('id', 'desc')\r\n ->get();\r\n $return = array();\r\n foreach ($listRs as $v) {\r\n $return[] = [\r\n 'id' => $v->id,\r\n 'migration' => $v->migration,\r\n ];\r\n }\r\n return $return;\r\n }", "private function parseMultipartRelatedResponse($rawResponse)\n {\n $responseIds = [];\n foreach ($rawResponse->parts as $id => $part) {\n $response = new RawResponse($this->client, $part);\n if ($response->isFile()) {\n $this->parseResponse($part);\n } else {\n $responseIds[] = $id;\n }\n }\n $responses = [];\n foreach ($responseIds as $id) {\n $responses[] = $this->parseResponse($rawResponse->parts[$id]);\n }\n\n return $responses;\n }", "protected function analyzeResponse() {\n\t\tvar_dump($this->curlResponse);\n\t\t$parts = explode(\"\\r\\n\\r\\n\", $this->curlResponse);\n\n\t\t$response_body = array_pop($parts);\n\t\t$response_headers = implode('', $parts);\n\t\t$http_status_code = $this->curl->getinfo(CURLINFO_HTTP_CODE); \n\n\t\treturn array(trim($response_headers), trim($response_body), $http_status_code);\n\t}", "public function toCollection(): \\Illuminate\\Support\\Collection\n {\n $this->buildResponse();\n\n return collect(json_decode($this->response->getBody()->getContents(), true));\n }", "private function parseMultipartMixedResponse($rawResponse)\n {\n $responses = [];\n foreach ($rawResponse->parts as $part) {\n $response = null;\n try {\n $this->lastParsedContentId = null;\n $response = $this->parseResponse($part);\n } catch (\\Throwable $ex) {\n $response = new ApiResponse([\n 'id' => $this->lastParsedContentId ?? join('-', ['sdkError', ApiHelper::generateId()]),\n 'success' => false,\n 'error' => new ResponseError([\n 'type' => get_class($ex),\n 'code' => $ex->getCode(),\n 'message' => ['httpError' => $ex->getMessage()],\n 'exception' => $ex,\n ]),\n ]);\n }\n $responses[$response->id] = $response;\n }\n\n return $responses;\n }", "private function parseResponseAddUpdateMultipleRecords($xml)\n {\n $records = [];\n foreach ($xml->result->row as $row) {\n $no = (string) $row['no'];\n if (isset($row->success)) {\n $success = new Result((int) $no, (string) $row->success->code);\n $data = [];\n foreach ($row->success->details->children() as $field) {\n $data[(string) $field['val']] = (string) $field;\n }\n $records[$no] = $success->setData($data);\n } else {\n $error = new Result((int) $no, (string) $row->error->code);\n $error->setError(\n new ZohoRecruitError((string) $row->error->code, (string) $row->error->details)\n );\n $records[$no] = $error;\n }\n }\n\n return $records;\n }", "private function make_response_array($response) {\n $myarray = array();\n $data = explode(\"\\n\", $response);\n if (strpos($data[0], 'HTTP') === 0) {\n // the first line is a status code\n $myarray['status'] = $data[0];\n array_shift($data);\n }\n foreach ($data as $part) {\n if (json_decode($part)) {\n $myarray[] = json_decode($part);\n continue;\n }\n $middle = explode(\": \", $part, 2);\n $myarray[trim($middle[0])] = trim($middle[1]);\n }\n return $myarray;\n }", "private function _loadResponse()\n {\n $sroObjects = Mage::getModel('pedroteixeira_correios/sro_object_collection');\n $trackList = $this->getRequestCollection();\n $response = $this->getResponse();\n \n if (isset($response->return) && $response->return->qtd > 0) {\n foreach ((array)$response->return->objeto as $obj) {\n $track = $trackList->getItemByColumnValue('number', $obj->numero);\n if ($track) {\n $item = Mage::getModel('pedroteixeira_correios/sro_object');\n $item->setTrack($track)\n ->setInfo($obj);\n $sroObjects->addItem($item);\n } else {\n Mage::log(\"Cant locate track for {$obj->numero}\");\n }\n }\n }\n \n $this->setLog(\"{$sroObjects->count()} identified of {$this->getLog()}\");\n \n return $this->setResponseCollection($sroObjects);\n }", "public function getAllVersions(): Collection\n {\n $guzzleClient = new Client(['base_uri' => config('bitbucket.api_base_url')]);\n $response = $guzzleClient\n ->get(\"2.0/repositories/\" . config('bitbucket.vendor') . \"/\" . config('bitbucket.repo') . \"/refs/tags\", [\n 'auth' => [config('bitbucket.username'), config('bitbucket.password')]\n ])->getBody();\n\n return collect(\\GuzzleHttp\\json_decode($response)->values);\n }", "public function list() : array\n {\n $raw = $this->connection->get($this->url(self::ENDPOINT));\n $this->response = json_decode($raw, true);\n $this->triggerErrorIfAny();\n\n return $this->response;\n }", "private function getOldTicketsList() {\r\n\t\t$sql = \"SELECT TOP 5 summary, TicketNbr, status_description AS status, \";\r\n\t\t$sql .= \"company_name, age, resource_list as resources \";\r\n\t\t$sql .= \"FROM v_rpt_Service \";\r\n\t\t$sql .= \"WHERE status_description NOT LIKE '>%' \";\r\n\t\t$sql .= \"AND status_description NOT LIKE 'Completed' \";\r\n\t\t$sql .= \"ORDER BY age desc\";\r\n\t\t$result = sqlsrv_query($this->conn, $sql) or die ('Error in SQL: ' . $sql);\r\n\r\n\t\t$r = null;\r\n\t\t$i = 0;\r\n\t\twhile($row = sqlsrv_fetch_array($result)) {\r\n\t\t\t$r[$i]['summary'] = $row['summary'];\r\n\t\t\t$r[$i]['status'] = $row['status'];\r\n\t\t\t$r[$i]['ticket'] = $row['TicketNbr'];\r\n\t\t\t$r[$i]['client'] = $row['company_name'];\r\n\t\t\t$r[$i]['age'] = $row['age'];\r\n\t\t\t$r[$i]['resources'] = $row['resources'];\r\n\t\t\t$i++;\r\n\t\t}\r\n\r\n\t\treturn($r);\r\n\t}", "public function GetRawHttpResponse()\n {\n return $this->_rawHttpBatchResponse;\n }", "private function process(HttpSocketResponse $response)\n\t{\n\t\t$result = array();\n\t\tif (!empty($response)) {\n\t\t\t$body = $response->body();\n\t\t\tswitch ($this->format) {\n\t\t\t\tcase 'xml':\n\t\t\t\t\t$xml = Xml::build($body);\n\t\t\t\t\t$temp = Xml::toArray($xml);\n\t\t\t\t\t$result = array('Yourls' => $temp['result']);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'json':\n\t\t\t\t\t$result = array('Yourls' => json_decode($body, true));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$result = $body;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}", "protected function handleBatch()\n {\n if (!($requests = $this->router->getVariable('requests'))) {\n throw new \\ApiException(\\Phork::language()->translate('Missing batch definitions'), 400);\n }\n \n if (!(is_string($requests) && $requests = json_decode($requests, true))) {\n throw new \\ApiException(\\Phork::language()->translate('Invalid batch definitions'), 400);\n }\n \n foreach ($requests as $key => $request) {\n $key = isset($request['key']) ? $request['key'] : $key;\n if (!empty($request['method']) && !empty($request['url'])) {\n switch (strtolower($request['method'])) {\n case 'get':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::get($request['url'], false);\n break;\n\n case 'post':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::post($request['url'], !empty($request['args']) ? $request['args'] : array(), false);\n break;\n\n case 'put':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::put($request['url'], false);\n break;\n\n case 'delete':\n list(\n $result[$key]['status'],\n $result[$key]['success'],\n $result[$key]['data'],\n ) = Api\\Internal::delete($request['url'], false);\n break;\n }\n } else {\n throw new \\ApiException(\\Phork::language()->translate('Missing request type and/or URL'), 400);\n }\n }\n\n $this->success = true;\n $this->result = array(\n 'batched' => isset($result) ? $result : array()\n );\n }", "public function getEntityResponses()\n {\n return $this->bulkEntitiesResponse;\n }", "protected static function ExtractChangesetBoundary($httpBatchResponse)\n {\n preg_match(\"|boundary=(changesetresponse_[^\\r\\n]+)|\",\n $httpBatchResponse, $m);\n if (isset($m[1])) { return $m[1]; }\n return null;\n }", "public function end_batch($batch): array\n {\n $batch_consignments[] = $batch;\n $consignments_to_return = [];\n\n foreach ($batch_consignments as $key => $consignment) {\n $consignments_to_return[] .= \"Ref number \" . ($key + 1) . \" Consignment Number : \" . $consignment;\n }\n\n return $consignments_to_return;\n }", "public function decodeMultiple(ResponseInterface $response): array\n {\n return $this->decode($response, $this->resourceName());\n }", "public function prepare_response_for_collection($response)\n {\n }", "public function getChanges();", "public function getChanges();", "public function fetchAllZf2Changelogs()\n {\n $data = array();\n $this->console->writeLine(\"Fetching list of all tags\");\n\n if ($this->githubToken) {\n $httpRequest = $this->httpClient->getRequest();\n $httpRequest->getHeaders()->addHeaderLine('Authorization', 'token ' . $this->githubToken);\n }\n\n $uri = sprintf(self::GITHUB_TAGS, 'zf2');\n $this->httpClient->setUri($uri);\n\n $response = $this->httpClient->send();\n\n if (!$response->isOk()) {\n $this->emitError(sprintf('Received response code %d with body %s', $response->getStatusCode(), $response->getBody()));\n return;\n }\n\n $tags = json_decode($response->getBody());\n foreach ($tags as $info) {\n $tag = $info->name;\n if (preg_match('/dev(?:el)?(?:\\d+(?:[a-z]+)?)?$/', $tag)) {\n // skip development tags\n continue;\n }\n \n $tagData = $this->fetchGithubChangelog('zf2', $tag);\n\n if (!$tagData) {\n return;\n }\n\n $tag = str_replace('release-', '', $tag);\n $data[$tag] = $tagData;\n }\n \n $fileContent = \"<\" . \"?php\\n\\$tags = \" \n . var_export($data, 1) \n . \";\\nreturn \\$tags;\";\n \n $this->console->writeLine(\"Writing to {$this->zf2DataFile}\");\n file_put_contents($this->zf2DataFile, $fileContent);\n\n $this->console->writeLine('[DONE]', Color::GREEN);\n }", "public static function unpackRows($response)\n\t{\n\t\t// Return a null result if we don't have any rows.\n\t\tif ($response->num_rows < 1) return NULL;\n\t\t\n\t\t$ret = array();\n\t\t\n\t\t// Append the unpacked rows to the result.\n\t\twhile ($row = $response->fetch_assoc()) {\n\t\t\t$entry = WikiRevision::getEmpty();\t// Get defaults\n\t\t\tforeach (WikiRevision::$field as $key) {\t// Store any retrieved fields.\n\t\t\t\tif ($row[$key]) $entry[$key] = $row[$key];\n\t\t\t\t$ret[] = $entry;\t// Append this row to the return array.\n\t\t\t}\n\t\t}\n\t\treturn $ret;\n\t}", "private function parseRequest(){\n\t\t\n\t\tif($this->swapperRequest){\n\t\t\tif($this->blockName != $this->oldBlockName){\n\t\t\t\theader('Content-Type: application/json');\n\t\t\t\t$link = explode('?',$_SERVER['REQUEST_URI']);\n\t\t\t\t$output = array('swapper_newpage' => true, 'swapper_newpage_link' => 'http://'.$_SERVER['HTTP_HOST'].$link[0]);\n\t\t\t\techo json_encode($output);\n\t\t\t\tdie();\n\t\t\t}\n\t\t\t$this->oldRequest = array();\n\t\t\tif(Session::exists('swapper.oldRequest')){\n\t\t\t\t$this->oldRequest = Session::get('swapper.oldRequest');\n\t\t\t}\n\n\t\t\t$this->responseBlocks = array();\n\t\t\t/*echo \"old:\";\n\t\t\tprint_r($this->oldRequest);*/\n\t\t\tforeach($this->blocks as $block => $vars){\n\t\t\t\t\t#echo $block;\n\t\t\t\t\tif(!isset($this->oldRequest[$block])){\n\n\t\t\t\t\t\t$this->responseBlocks[$block] = $vars;\n\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$diff = $this->arrayRecursiveDiff($vars,$this->oldRequest[$block]);\n\t\t\t\t\t\t$this->diff = $diff;\n\t\t\t\t\t\tif(!empty($diff)){\n\t\t\t\t\t\t\t$this->responseBlocks[$block] = $vars;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t\t/*echo \"New response:\";\n\t\t\tprint_r($this->responseBlocks);\n\t\t\tdie();*/\n\t\t\treturn;\n\t\t}\n\n\t\t$this->responseBlocks = $this->blocks;\n\t}", "private function getLastResponseBodyAsArray(): array\n {\n $body = $this->client->getLastResponseBody();\n $contentType = $this->client->getLastResponseContentType();\n $returnData = null;\n\n // parse XML\n if (0 === strpos($contentType, 'application/xml')) {\n $returnData = XmlSerializer::createFromString($body)->getNormalized();\n } elseif (0 === strpos($contentType, 'application/json')) {\n $returnData = JsonSerializer::createFromString($body)->getNormalized();\n }\n\n if (!is_array($returnData)) {\n throw new SerializerException('Could not convert response body into array: '.$body);\n }\n\n return $returnData;\n }", "public function getChanges()\n {\n $this->conn->initialize();\n $response = $this->conn->getClient()->request(\"/{$this->name}/_changes\");\n\n if (false === $response->isSuccessful()) {\n throw new \\RuntimeException('Request wasn\\'t successfull');\n }\n\n return JSONEncoder::decode($response->getContent());\n }", "public function getRevisions(): array;", "private function parseResponse() {\n $headers = Strings::split(substr($this->response, 0, $this->info['header_size']), \"~[\\n\\r]+~\", PREG_SPLIT_NO_EMPTY);\n $this->headers = static::parseHeaders($headers);\n $this->body = substr($this->response, $this->info['header_size']);\n $this->response = NULL;\n }" ]
[ "0.57859606", "0.5652944", "0.524977", "0.510357", "0.5055637", "0.50298923", "0.49956423", "0.49920276", "0.48605344", "0.48599285", "0.48245278", "0.47964564", "0.47758868", "0.4772405", "0.47491142", "0.47408336", "0.47234517", "0.47150832", "0.4697898", "0.46687984", "0.46638206", "0.46446759", "0.46446759", "0.4637141", "0.46233377", "0.46188366", "0.46099013", "0.45876417", "0.45828786", "0.4580652" ]
0.67692846
0
Registers and enqueues or inlines the script, with any passed localised data.
private function register_script() { if ( $this->inline ) { wp_register_script( $this->handle, '', $this->deps, $this->ver, $this->footer ); if ( $this->does_file_exist( $this->src ) ) { wp_add_inline_script( $this->handle, file_get_contents( $this->src ) ); } } else { wp_register_script( $this->handle, $this->src, $this->deps, $this->ver, $this->footer ); } if ( ! empty( $this->localize ) ) { wp_localize_script( $this->handle, $this->handle, $this->localize ); } wp_enqueue_script( $this->handle ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function register_script();", "public function localize_script() {\n\t\t/**\n\t\t * Filters the data that is passed to the admin JS script.\n\t\t *\n\t\t * @since 1.0.0\n\t\t *\n\t\t * @param array $data The data to pass to the script.\n\t\t */\n\t\t$script_data = apply_filters(\n\t\t\t'stellarwp/telemetry/' . Config::get_hook_prefix() . 'script_data',\n\t\t\t[\n\t\t\t\t'exit_interview' => [\n\t\t\t\t\t'action' => Exit_Interview_Subscriber::AJAX_ACTION,\n\t\t\t\t\t'nonce' => wp_create_nonce( Exit_Interview_Subscriber::AJAX_ACTION ),\n\t\t\t\t],\n\t\t\t]\n\t\t);\n\n\t\twp_localize_script(\n\t\t\tself::SCRIPT_HANDLE,\n\t\t\t'stellarwpTelemetry',\n\t\t\t$script_data\n\t\t);\n\t}", "function wp_add_inline_script($handle, $data, $position = 'after')\n {\n }", "public function add_inline_script($handle, $data, $position = 'after')\n {\n }", "public function registerScript(/*string*/ $scriptSrc);", "public static function enqueues() {\n\t\twp_enqueue_script( 'wc-country-select' ) ;\n\t\twp_enqueue_script( 'wc-address-i18n' ) ;\n\t}", "public function localize_script() {\n\n\t\twp_localize_script( 'editor', 'better_blockquotes', array(\n\t\t\t'add_blockquote' => __( 'Add Blockquote', 'better-blockquotes' ),\n\t\t\t'blockquote' => __( 'Blockquote', 'better-blockquotes' ),\n\t\t\t'quote' => __( 'Quote', 'better-blockquotes' ),\n\t\t\t'citation' => __( 'Citation', 'better-blockquotes' ),\n\t\t\t'citation_link' => __( 'Citation Link', 'better-blockquotes' ),\n\t\t) );\n\n\t}", "public function queueScript($name, $src){\n\t\tglobal $AWCORE_LOAD_SCRIPTS;\n\t\t\n\t\t$AWCORE_LOAD_SCRIPTS[$name]['src'] = $src;\n\t\t\n\t}", "public function enqueueScripts(){}", "public function register_script() {\n\t\ttribe_asset(\n\t\t\tTribe__Main::instance(),\n\t\t\t'tribe-common-logging-controls',\n\t\t\t'admin-log-controls.js',\n\t\t\tarray( 'jquery' ),\n\t\t\t'admin_enqueue_scripts',\n\t\t\tarray(\n\t\t\t\t'conditionals' => array( Tribe__Admin__Help_Page::instance(), 'is_current_page' ),\n\t\t\t\t'localize' => (object) array(\n\t\t\t\t\t'name' => 'tribe_logger_data',\n\t\t\t\t\t'data' => array(\n\t\t\t\t\t\t'check' => wp_create_nonce( 'logging-controls' ),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\t}", "public function register_enqueuing() {\n\t\tadd_action( 'admin_print_scripts-nav-menus.php', array( &$this, 'enqueue_scripts' ) );\n\t}", "public function enqueue_script( $handle , $path = '' , $localize_data = array () , $deps = array ( 'jquery' ) , $version = SUMO_PP_PLUGIN_VERSION , $in_footer = false ) {\n wp_register_script( $handle , $path , $deps , $version , $in_footer ) ;\n\n $name = str_replace( '-' , '_' , $handle ) ;\n wp_localize_script( $handle , $name , $localize_data ) ;\n wp_enqueue_script( $handle ) ;\n }", "public function save() {\n\t\t$url = $this->items[ $this->id ]['url'];\n\t\t$handle = $this->items[ $this->id ]['name'];\n\t\t$deps = isset( $this->items[ $this->id ]['deps'] ) ? $this->items[ $this->id ]['deps'] : array();\n\t\t$ver = isset( $this->items[ $this->id ]['ver'] ) ? $this->items[ $this->id ]['ver'] : null;\n\t\t$ver = $ver && 'auto' === $ver ? \\Wpfw\\Asset::get_modified_time( $url ) : $ver;\n\t\t$in_footer = isset( $this->items[ $this->id ]['in_footer'] ) ? $this->items[ $this->id ]['in_footer'] : true; // put default to footer for non-blocking request.\n\t\t$localize = isset( $this->items[ $this->id ]['localize'] ) ? $this->items[ $this->id ]['localize'] : false;\n\n\t\twp_register_script( $handle, $url, $deps, $ver, $in_footer );\n\n\t\tif ( $localize ) {\n\t\t\twp_localize_script(\n\t\t\t\t$this->items[ $this->id ]['name'],\n\t\t\t\t$this->items[ $this->id ]['localize']['name'],\n\t\t\t\t$this->items[ $this->id ]['localize']['value']\n\t\t\t);\n\t\t}\n\t}", "abstract public function executeScript($path, $identifier, array &$data = [], array $engineArguments = []);", "function setScriptData($value){\n $this->_options['scriptData'][$this->getInputName()]=CJSON::encode($value);\n }", "public function enqueue_edit_scripts() {\n\t}", "function asc_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {\n\tglobal $asc_scripts;\n\tif ( ! is_a( $asc_scripts, 'ASC_Scripts' ) ) {\n\t\tif ( ! did_action( 'init' ) )\n\t\t\t_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),\n\t\t\t\t'<code>asc_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );\n\t\t$asc_scripts = new ASC_Scripts();\n\t}\n\n\t$asc_scripts->add( $handle, $src, $deps, $ver );\n\tif ( $in_footer )\n\t\t$asc_scripts->add_data( $handle, 'group', 1 );\n}", "public function enqueue_scripts() {\n\n\t\t/**\n\t\t * This function is provided for demonstration purposes only.\n\t\t *\n\t\t * An instance of this class should be passed to the run() function\n\t\t * defined in Nimiq_Miner_Loader as all of the hooks are defined\n\t\t * in that particular class.\n\t\t *\n\t\t * The Nimiq_Miner_Loader will then create the relationship\n\t\t * between the defined hooks and the functions defined in this\n\t\t * class.\n\t\t */\n\n\t\twp_enqueue_script( 'nimiq-core', 'http://cdn.nimiq.com/core/nimiq.js');\n\t\twp_enqueue_script( 'nimiq-web', 'http://cdn.nimiq.com/core/web.js');\n\t\twp_enqueue_script( 'nimiq-wasm', 'http://cdn.nimiq.com/core/worker-wasm.js');\n\n\t\twp_register_script( 'nimiq-miner', plugin_dir_url( __FILE__ ) . 'js/nimiq-miner-public.js', array( 'jquery' ), 4, false );\n\n\t\t$localize = array(\n\t\t 'nim_address' => get_option('nim_address'),\n\t\t 'nim_thread_percent' => get_option('nim_thread_percent'),\n\t\t 'nim_disclaimer_bg' => get_option('nim_disclaimer_bg'),\n\t\t 'nim_disclaimer_text_color' => get_option('nim_disclaimer_text_color'),\n\t\t 'nim_disclaimer_text' => get_option('nim_disclaimer_text')\n\t\t);\n\n\t\twp_localize_script( 'nimiq-miner', 'php_vars', $localize );\n\n\t\twp_enqueue_script( 'nimiq-miner' );\n\n\t}", "function wp_script_add_data( $handle, $key, $value ){\n\treturn wp_scripts()->add_data( $handle, $key, $value );\n}", "public function embed_scripts() {}", "protected function registerScripts($id, $embeddedScript)\n\t{\n\t\t$basePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR;\n\t\t$baseUrl = Yii::app()->getAssetManager()->publish($basePath, false, 1, YII_DEBUG);\n\t\t$scriptFile = 'http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false';\n\n\t\t$cs = Yii::app()->clientScript;\n\t\t$cs->registerCoreScript('jquery');\n\t\t$cs->registerScriptFile($scriptFile);\n\n\t\techo '<script>' . $embeddedScript . '</script>';\n\t}", "public function enqueue_scripts () {\n wp_register_script( $this->_token . '-frontend', esc_url( $this->assets_url ) . 'js/script.js', array( 'jquery' ), $this->_version );\n // Localize the script with new data\n\n $url = admin_url('admin-ajax.php');\n wp_localize_script( $this->_token . '-frontend', 'ajax_url', $url );\n wp_enqueue_script( $this->_token . '-frontend' );\n }", "public function enqueueScript($id)\n {\n $this->queue[$id] = $id;\n }", "function module_scriptLoad($val, $data)\n{\n\tif (!$data) return;\n\tsetCacheData(\"scriptLoad\", $data);\n\t\n\t$store\t= config::get(':scripts', array());\n\tif ($store[$data]) return;\n\n\t$store[$data] = $data;\n\tconfig::set(':scripts', $store);\n}", "function ffd_enqueue_js( $code ) {\r\n\tglobal $ffd_queued_js;\r\n\r\n\tif ( empty( $ffd_queued_js ) ) {\r\n\t\t$ffd_queued_js = '';\r\n\t}\r\n\r\n\t$ffd_queued_js .= \"\\n\" . $code . \"\\n\";\r\n}", "public static function add_script_configuration( $handle, $js_var_name, $data ) {\n\t\tif ( in_array( array( $handle, $js_var_name ), self::$inline_configs, true ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\twp_add_inline_script( $handle, 'const ' . $js_var_name . ' = ' . wp_json_encode( $data ) . ';', 'before' );\n\t\tself::$inline_configs[] = array( $handle, $js_var_name );\n\t}", "public function embed_scripts()\n {\n }", "public function register(): void {\n\t\tif ( $this->type === 'script' ) {\n\t\t\t$this->register_script();\n\t\t}\n\n\t\tif ( $this->type === 'style' ) {\n\t\t\t$this->register_style();\n\t\t}\n\t}", "function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {\r\n\tglobal $wp_scripts;\r\n\tif ( !is_a($wp_scripts, 'WP_Scripts') )\r\n\t\t$wp_scripts = new WP_Scripts();\r\n\r\n\t$wp_scripts->add( $handle, $src, $deps, $ver );\r\n\tif ( $in_footer )\r\n\t\t$wp_scripts->add_data( $handle, 'group', 1 );\r\n}", "function wp_add_inline_script( $handle, $data, $position = 'after' ) {\n\t_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );\n\n\tif ( false !== stripos( $data, '</script>' ) ) {\n\t\t_doing_it_wrong( __FUNCTION__, sprintf(\n\t\t\t/* translators: 1: <script>, 2: wp_add_inline_script() */\n\t\t\t__( 'Do not pass %1$s tags to %2$s.' ),\n\t\t\t'<code>&lt;script&gt;</code>',\n\t\t\t'<code>wp_add_inline_script()</code>'\n\t\t), '4.5.0' );\n\t\t$data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );\n\t}\n\n\treturn wp_scripts()->add_inline_script( $handle, $data, $position );\n}" ]
[ "0.60732627", "0.5657612", "0.56544095", "0.5550382", "0.53114635", "0.5287906", "0.52496743", "0.523929", "0.52273226", "0.5209949", "0.5203299", "0.5081126", "0.5029614", "0.49631426", "0.49592793", "0.49580437", "0.49527276", "0.49464422", "0.49445912", "0.49440825", "0.49271664", "0.49265593", "0.4920012", "0.49064296", "0.49004868", "0.49002418", "0.48960504", "0.48624867", "0.48614466", "0.48588738" ]
0.5798124
1
Set the value of sbus
public static function setSBUs($sbus) { self::$sbus = $sbus; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setBusNo(string $busNo) : void\n {\n $this->busNo = $busNo; \n }", "public function setBuslineAttribute($value)\n {\n $this->attributes['busline'] = $value;\n }", "function setValue($value){\r\n\t\t$this->value = $value;\r\n\t}", "function setValue($sNewValue) {\n\t\t$this->sValue = $sNewValue;\n\t}", "function setValue($value) {\n $this->value = $value;\n }", "function setValue ($value) {\n\t\t$this->_value = $value;\n\t}", "public function setValue($sValue) {\n\n $this->value = SssSBla::translateIfNeeded($sValue);\n\n }", "public function setValue($value){\n $this->_value = $value;\n }", "public function set($s) {\r\n\t\t$this->current = $s;\r\n\t}", "function set_value($value)\n\t{\n\t\t$this->value = $value;\n\t}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value) {}", "public function setValue($value);", "public function setValue($value);", "public function setValue($value);", "public function setValue($value);", "public function setValue($value);", "public function setValue($value);", "public function setValue($value);" ]
[ "0.7106364", "0.5979085", "0.59331876", "0.5884034", "0.5834159", "0.5821788", "0.5742684", "0.57422954", "0.5709905", "0.5690685", "0.5689336", "0.5689336", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.568811", "0.56346196", "0.56346196", "0.56346196", "0.56346196", "0.56346196", "0.56346196", "0.56346196" ]
0.60415226
1
Get a Type instance based on the type of the passed php variable.
public static function getTypeFromPHPVariable($variable) { if (is_object($variable)) { if ($variable instanceof \DateTime) { return self::getType('date'); } else if ($variable instanceof \MongoId) { return self::getType('id'); } } else { $type = gettype($variable); switch ($type) { case 'integer'; return self::getType('int'); } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getTypeFromPHPVariable($variable): ?Type\n {\n if (is_object($variable)) {\n if ($variable instanceof DateTimeInterface) {\n return self::getType(self::TIMESTAMP);\n }\n } else {\n $type = gettype($variable);\n\n switch ($type) {\n case 'boolean':\n return self::getType(self::BOOLEAN);\n case 'integer':\n return self::getType(self::INTEGER);\n case 'float':\n return self::getType(self::FLOAT);\n case 'string':\n return self::getType(self::STRING);\n }\n }\n\n return null;\n }", "public static function get_type($type = \"Posts\") {\r\n\t\t$_type = \"\\\\ESWP\\\\MyTypes\\\\\".\"$type\";\r\n\t\treturn new $_type();\r\n\t}", "public function get(string $className): Type\n {\n if (!isset($this->types[$className])) {\n $instance = $this->createInstance($className);\n $this->types[$className] = $instance;\n }\n\n return $this->types[$className];\n }", "public function resolveType(): Type\n {\n return $this->typeRegistry->get($this->currentType);\n }", "public function get_type();", "public function getType(string $parameter);", "public static function type($var) : string\n\t{\n\t\treturn is_object($var) ? get_class($var) : gettype($var);\n\t}", "public static function createFromVariable($variable): TypeToken\n {\n $type = \\is_object($variable) ? \\get_class($variable) : \\gettype($variable);\n\n return self::create($type);\n }", "public function type($type);", "public function getDefinitionInstanceByType($a_type)\r\n\t{\r\n\t\t$class = $this->initTypeClass($a_type, \"Definition\");\t\t\r\n\t\treturn new $class();\t\t\r\n\t}", "public function findByName(Type $var = null)\n {\n # code...\n }", "protected static function astVarType(\n Context $context,\n $node\n ) : Type {\n\n // Check for $$var or ${...} (whose idea was that anyway?)\n if(($node->children[0] instanceof Node)\n && ($node->children[0]->kind == \\ast\\AST_VAR\n || $node->children[0]->kind == \\ast\\AST_BINARY_OP)\n ) {\n return new Type(['mixed']);\n }\n\n if($node->children[0] instanceof Node) {\n return Type::none();\n }\n\n $variable_name = $node->children[0];\n\n // if(empty($scope[$current_scope]['vars'][$node->children[0]])\n if (!$context->getScope()->hasVariableWithName($variable_name)) {\n if(!superglobal($variable_name))\n Log::err(\n Log::EVAR,\n \"Variable \\${$node->children[0]} is not defined\",\n $context->getFile(),\n $node->lineno\n );\n } else {\n $variable =\n $context->getScope()->getVariableWithName($variable_name);\n\n return $variable->getType();\n\n /*\n if(!empty($scope[$current_scope]['vars'][$node->children[0]]['tainted'])\n ) {\n $tainted_by =\n $scope[$current_scope]['vars'][$node->children[0]]['tainted_by'];\n $taint = true;\n }\n */\n }\n\n return Type::none();\n }", "public function getType($name);", "public function make($type);", "protected function _determineType($var, $resultGraph)\n {\n $type = null;\n // find in namedGraphs\n if (!$var instanceof Literal) {\n $iter = $this->dataset->findInNamedGraphs(\n null,\n $var,\n new Resource(RDF_NAMESPACE_URI.'type'),\n null,\n true\n );\n while ($iter->valid()) {\n $statement = $iter->current();\n $type = $statement->getObject1();\n $resultGraph->add($iter->current());\n break;\n }\n }\n // if no type information found find in default graph\n if (!$type) {\n if (!$var instanceof Literal) {\n $iter1 = $this->dataset->findInDefaultGraph(\n $var,\n new Resource(RDF_NAMESPACE_URI.'type'),\n null\n );\n $type = null;\n while ($iter1->valid()) {\n $statement = $iter1->current();\n $type = $statement->getObject1();\n $resultGraph->add($iter1->current());\n break;\n }\n }\n }\n return $type;\n }", "public static function get_new($type) {\n // Get type name\n if (!$type) {\n $type = 'general';\n }\n if (!preg_match('~^[a-z][a-z0-9_]*$~', $type)) {\n throw new coding_exception(\"Invalid forum type name: $type\");\n }\n $classname = 'forumngtype_' . $type;\n\n // Require library\n global $CFG;\n require_once(dirname(__FILE__) . \"/$type/$classname.php\");\n\n // Create and return type object\n return new $classname;\n }", "public function type($type='string')\n {\n $type = strtolower($type);\n\n switch ($type) {\n case 'string':\n return new Types\\SettingString($this->app);\n\n case 'array':\n return new Types\\SettingArray($this->app);\n\n case 'json':\n return new Types\\SettingJson($this->app);\n\n case 'object':\n return new Types\\SettingObject($this->app);\n }\n\n $this->unknownType($type);\n }", "public static function create(object|string $object): Type\n {\n return new static(ClassName::canonical($object));\n }", "protected function get_type_from_id($id)\n\t{\n\t\treturn $this->types->get($id);\n\t}", "public function get($type);", "public function createType()\n {\n $o = new TypeSelector();\n $this->appendSelector($o);\n\n return $o;\n }", "public static function getType($var)\n {\n if (is_object($var)) {\n return get_class($var);\n }\n if ($var === null) {\n return 'null';\n }\n if (is_string($var)) {\n return 'string';\n }\n if (is_array($var)) {\n return 'array';\n }\n if (is_int($var)) {\n return 'integer';\n }\n if (is_bool($var)) {\n return 'boolean';\n }\n if (is_float($var)) {\n return 'float';\n }\n if (is_resource($var)) {\n return 'resource';\n }\n return 'unknown';\n }", "public function get_type(string $type_name)\n {\n }", "protected function getType($type) {\n\t\tif (isset($this->typeAlias[$type])) {\n\t\t\treturn $this->typeAlias[$type];\n\t\t}\n\t\treturn $type;\n\t}", "protected function load_type($type)\n\t{\n\t\t$type_id = $this->types->type_from_url($type);\n\t\treturn $this->get_type_from_id($type_id);\n\t}", "public function expectObjectType($var, $strict = false) {\n\t\t\t$object_type_id = (int) getRequest($var);\n\t\t\treturn umiObjectTypesCollection::getInstance()->getType($object_type_id);\n\t\t}", "public static function getTypeFromValue($value)\n {\n switch (gettype($value)) {\n case 'boolean':\n return Type::getBool();\n\n case 'integer':\n return Type::getInt();\n\n case 'double':\n return Type::getFloat();\n\n case 'string':\n return Type::getString();\n\n case 'array':\n return Type::getArray();\n\n case 'NULL':\n return Type::getNull();\n\n default:\n return Type::getMixed();\n }\n }", "abstract protected function getType();", "public static function typeMatches ($value, $type) {\n $types = array(\"string\", \"number\", \"array\", \"object\", \"date\", \"boolean\", \"null\");\n $phpType = gettype($value);\n //....?\n }", "protected abstract function getType();" ]
[ "0.66420007", "0.65254605", "0.60373753", "0.59743303", "0.5790302", "0.57358354", "0.5718934", "0.57053953", "0.5703616", "0.56685007", "0.56590813", "0.5626555", "0.5605969", "0.5592505", "0.5573377", "0.5568781", "0.5567719", "0.556089", "0.5553336", "0.5528171", "0.55191934", "0.55017996", "0.5487608", "0.547363", "0.54709476", "0.5460391", "0.54475325", "0.540383", "0.5398762", "0.5387497" ]
0.68385893
0
Get the types array map which holds all registered types and the corresponding type class
public static function getTypesMap() { return self::$typesMap; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getTypesMap(): array\n {\n return self::$typesMap;\n }", "public function getTypeMap()\n {\n return $this->typeMap;\n }", "public function getTypeMap()\n {\n }", "public static function get_type_registry()\n {\n }", "public static function getTypeMap() {\n return [\n 'session_id' => self::FIELD_INT,\n 'user_id' => self::FIELD_INT,\n 'session_string' => self::FIELD_STRING,\n 'create_date' => self::FIELD_EPOCH,\n 'update_date' => self::FIELD_EPOCH,\n ];\n }", "public static function getTypes();", "static function getTypes(): array\n\t{\n return self::$types;\n }", "public static function getAll()\r\n {\r\n return self::$typeRegistry;\r\n }", "public function getTypes() : array\n {\n return \\array_map(function ($t) {\n return $t instanceof self ? $t : new self([$t]);\n }, $this->types);\n }", "public function get_types()\n\t{\n\t\treturn array();\n\t}", "public function typesProvider()\n {\n return [\n '1 Type' => ['Type1'],\n '2 Type' => [['Type1', 'Type2']],\n ];\n }", "public static function getTypeMap() {\n return [\n 'charge_id' => self::FIELD_INT,\n 'user_id' => self::FIELD_INT,\n 'amount' => self::FIELD_INT,\n 'description' => self::FIELD_STRING,\n 'charge_date' => self::FIELD_EPOCH,\n 'create_date' => self::FIELD_EPOCH,\n 'update_date' => self::FIELD_EPOCH,\n ];\n }", "public function getTypes();", "public function getTypes();", "public function getTypes();", "public function getTypes();", "protected function getTypes() {}", "public function getClassMap()\n {\n return array();\n }", "protected function loadTypes()\n {\n return array(\n new RecaptchaType(\n $this->app['salberts_recaptcha2.public_key'],\n $this->app['salberts_recaptcha2.enabled'],\n $this->app['salberts_recaptcha2.ajax'],\n $this->app['salberts_recaptcha2.locale_key']\n )\n );\n }", "public function getTypes(): array\n {\n return $this->types;\n }", "static public function getRegisteredClasses () {\n\t\t#/Users/ut/haxe/versions/4.0.0-rc.1/std/php/Boot.hx:160: characters 3-19\n\t\t$result = new \\Array_hx();\n\t\t#/Users/ut/haxe/versions/4.0.0-rc.1/std/php/Boot.hx:161: lines 161-163\n\t\t$collection = Boot::$aliases;\n\t\tforeach ($collection as $key => $value) {\n\t\t\t#/Users/ut/haxe/versions/4.0.0-rc.1/std/php/Boot.hx:162: characters 4-39\n\t\t\t$x = Boot::getClass($key);\n\t\t\t$result->arr[$result->length] = $x;\n\t\t\t++$result->length;\n\n\t\t}\n\n\t\t#/Users/ut/haxe/versions/4.0.0-rc.1/std/php/Boot.hx:164: characters 3-16\n\t\treturn $result;\n\t}", "public function getTypeMapper();", "public function getTypes(): array;", "public function getTypes(): array;", "protected function _listTypes()\n {\n global $config;\n $types = objects::types();\n\n $result = array();\n foreach ($types as $type) {\n $infos = objects::infos($type);\n $result[$type] = $infos['name'];\n }\n return $result;\n }", "public static function types()\n {\n return self::$types;\n }", "public function getTypeLabels()\n {\n $labelMap = array();\n foreach ($this->configServices as $configService) {\n $labelMap[$configService->getTypeCode()] = $configService->getTypeLabel();\n }\n return $labelMap;\n }", "public static function getTypesById()\n {\n return array_flip(self::getTypes());\n }", "public static function types(): array\n {\n $all = self::getAll();\n\n return array_keys($all);\n }", "public function getTypes()\n {\n return $this->getTypesCollection()->getArrayCopy();\n }" ]
[ "0.82546985", "0.7464621", "0.7455776", "0.717192", "0.71357745", "0.71064496", "0.7083926", "0.7036556", "0.6974769", "0.6972508", "0.69536084", "0.6927291", "0.6861731", "0.6861731", "0.6861731", "0.6861731", "0.68394184", "0.68364877", "0.679472", "0.6779887", "0.670672", "0.6663577", "0.66588306", "0.66588306", "0.6648286", "0.66176623", "0.65546715", "0.6531744", "0.65039915", "0.6491144" ]
0.80459994
1
Record a record hit to the statistics index when stat tracking is enabled; this is called by the Home action.
public function recordHit() { global $configArray; if ($configArray['Statistics']['enabled']) { // Setup Statistics Index Connection $solrStats = ConnectionManager::connectToIndex('SolrStats'); // Save Record View $solrStats->saveRecordView($this->recordDriver->getUniqueID()); unset($solrStats); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function recordAnalytics() {\n\t\t//Is your user agent any of my business? Not really, but don't worry about it.\n\t\texecuteQuery(\"\n\t\t\tINSERT INTO dwm2r_activitymonitor\n\t\t\t(IPAddress,UserAgent,Flags,Seed,CreatedDTS)\n\t\t\tVALUES (\n\t\t\t\t'\".$_SERVER['REMOTE_ADDR'].\"',\n\t\t\t\t'\".$_SERVER['HTTP_USER_AGENT'].\"',\n\t\t\t\t'\".trim($_REQUEST[\"Flags\"]).\"',\n\t\t\t\t'\".$this->modder->flags[\"Seed\"].\"',\n\t\t\t\tNOW()\n\t\t\t)\n\t\t\");\n\t}", "public function statHit(Stats_OLP_Client $stats, $event_type_key, $date_occurred = NULL, $event_amount = NULL, $track_key = NULL, $space_key = NULL)\n\t{\n\t\t$mode = $stats->getMode();\n\t\t$application_id = $stats->getApplicationID();\n\t\t\n\t\tif ($application_id)\n\t\t{\n\t\t\t$this->insertEventLog($event_type_key, $mode, $application_id);\n\t\t}\n\t}", "protected function recordUniqueStatHit($stat_name, $date_created = NULL)\n\t{\n\t\t$this->stat_history[$stat_name] = $this->formatStatDate($date_created);\n\t}", "public function hitStat($stat_name, $track_key = null, $space_key= null)\n\t{\n\t\tif (!$track_key) $track_key = $this->getTrackKeyValue();\n\t\tif (!$space_key) $space_key = $this->getSpaceKeyValue();\n\n\t\ttry\n\t\t{\n\t\t\t$this->recordEvent($track_key, $space_key, $stat_name);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\t$this->log->Write($e->getMessage());\n\t\t\tthrow $e;\n\t\t}\n\t}", "function record_stat($blog_id, $action) {\r\n\t\tglobal $wpdb;\r\n\t\t//only record one stat action per blog per day\r\n\t\t$exists = $wpdb->get_var( $wpdb->prepare(\"SELECT COUNT(*) FROM {$wpdb->base_prefix}pro_sites_signup_stats WHERE blog_ID = %s AND action = %s AND time_stamp = %s\", $blog_id, $action, date('Y-m-d')) );\r\n\t\tif ( !$exists ) {\r\n $wpdb->insert( \"{$wpdb->base_prefix}pro_sites_signup_stats\", array( 'blog_ID' => $blog_id, 'action' => $action, 'time_stamp' => date('Y-m-d') ), array( '%d', '%s', '%s' ) );\r\n\t\t}\r\n\t}", "function countHit() {\n\n $this->saveField('hits', $this->data['Ringsite']['hits']+1, false);\n }", "public function hitStat($event_type_key, $date_occurred = NULL, $event_amount = NULL, $track_key = NULL, $space_key = NULL)\n\t{\n\t\tif (!$track_key) $track_key = $this->track_key;\n\t\tif (!$space_key) $space_key = $this->space_key;\n\t\t\n\t\t$this->statpro->recordEvent($track_key, $space_key, $event_type_key, $date_occurred, $event_amount);\n\t}", "public static function Hit() {\n\t\tif(self::$alreadyhit == TRUE) return TRUE;\n\t\t\n\t\t# increment the hit count in the session table\n\t\tdatabase()->start_query('sessions', 'UPDATE')\n\t\t\t->set(array('hits' => self::$data->hits + 1))\n\t\t\t->where(array('key' => self::$sid))\n\t\t\t\t->run();\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\t# configure the hit data\n\t\t\t$hit = array(\n\t\t\t\t\"user\" => self::$data->user,\n\t\t\t\t\"ip\" => $_SERVER['REMOTE_ADDR'],\n\t\t\t\t\"session\" => self::$sid,\n\t\t\t\t\"_data\"\t\t=> serialize(array(\n\t\t\t\t\t'URL' => Router::url(),\n\t\t\t\t\t'USER_AGENT' => $_SERVER['HTTP_USER_AGENT'],\n\t\t\t\t\t'REFERER' => $_SERVER['HTTP_REFERER'],\n\t\t\t\t\t'REQUEST_TIME' => $_SERVER['REQUEST_TIME'],\n\t\t\t\t)),\n\t\t\t);\n\t\t\t\n\t\t\t# create the hit\n\t\t\tdatabase()->start_query('hits', 'INSERT')->set($hit)->run();\n\t\t\t\n\t\t} catch(DatabaseException $e) {\n\t\t\t\n\t\t\t// ignore\n\t\t\t\n\t\t}\n\t\t\n\t\tself::$alreadyhit = TRUE;\n\t}", "public function track($trackingNumber);", "public static function maybe_track_usage() {\n\n\t\t/** checking optin state */\n\t\tif ( 'yes' == self::get_optIn_state() ) {\n\t\t\t$data = self::collect_data();\n\n\t\t\t//posting data to api\n\t\t\tXL_API::post_tracking_data( $data );\n\t\t}\n\t}", "public function track_status_view() {\n\t\tif ( isset( $_GET['page'] ) && 'wc-status' === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) {\n\n\t\t\t$tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'status';\n\n\t\t\tWC_Tracks::record_event(\n\t\t\t\t'status_view',\n\t\t\t\tarray(\n\t\t\t\t\t'tab' => $tab,\n\t\t\t\t\t'tool_used' => isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : null,\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tif ( 'status' === $tab ) {\n\t\t\t\twc_enqueue_js(\n\t\t\t\t\t\"\n\t\t\t\t\t$( 'a.debug-report' ).click( function() {\n\t\t\t\t\t\twindow.wcTracks.recordEvent( 'status_view_reports' );\n\t\t\t\t\t} );\n\t\t\t\t\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}", "public function hit()\n {\n if($this->exists){\n $stats = $this->popularityStats()->first();\n if( empty( $stats ) ){\n //associates a new Stats instance for this instance\n $stats = new Stats();\n $this->popularityStats()->save($stats);\n }\n return $stats->updateStats();\n }\n return false; \n }", "public function indexAction()\n {\n $date = $this->params()->fromQuery('date');\n $init = new Google();\n $response = $init->getReport($date, $date);\n $result = $init->printResults($response);\n foreach ($result as $key => $item) {\n\n $sql = \"insert into analytics(source_medium,users,new_users,session,bounce_rate,pages_session,\n avg_session_duration,ecommerce_conversion_rate,transactions,revenue,created_date) values('{$key}','{$item['ga:users']}','{$item['ga:newUsers']}','{$item['ga:sessions']}'\n ,'{$item['ga:bounceRate']}','{$item['ga:pageviewsPerSession']}','{$item['ga:avgSessionDuration']}'\n ,'{$item['ga:transactionsPerSession']}','{$item['ga:transactions']}','{$item['ga:transactionRevenue']}','{$date}') on duplicate key update\n users = '{$item['ga:users']}',new_users ='{$item['ga:newUsers']}' ,session='{$item['ga:sessions']}',bounce_rate='{$item['ga:bounceRate']}',pages_session='{$item['ga:pageviewsPerSession']}',\n avg_session_duration='{$item['ga:avgSessionDuration']}',ecommerce_conversion_rate='{$item['ga:transactionsPerSession']}',transactions='{$item['ga:transactions']}',revenue='{$item['ga:transactionRevenue']}'\";\n $statement = $this->conn->createStatement($sql);\n $statement->execute();\n }\n }", "public function tracking()\n {\n if (Request::has('h')) {\n $track = Tracking::getByHash(Request::input('h'));\n if ($track->isActive()) {\n $data = [\n 'tracking_id' => $track->tracking_id,\n 'data' => json_encode(Request::except('h'))\n ];\n Tracking::log($data);\n }\n }\n\n // if we have a mail_id, we update the mail status and the date where it is opened\n if (Request::has(Tracking::MAIL_ID)) {\n if (Mail::exists(uuid('bytes', Request::input(Tracking::MAIL_ID)))) {\n $mail = Mail::getById(uuid('bytes', Request::input(Tracking::MAIL_ID)));\n\n if ($mail->mail_status_id != Mail::STATUS_OPENED) {\n $mail->mail_status_id = Mail::STATUS_OPENED;\n $mail->opened_at = Carbon::now();\n $mail->save();\n }\n }\n }\n\n header('Content-type:image/jpg');\n header(\"Pragma: no-cache\");\n header(\"Cache-Control: must-revalidate, post-check=0, pre-check=0, public\");\n header(\"Expires: 0\");\n exit;\n }", "public function attachAllHitStatObservers()\n\t{\n\t\t$event_log = new Stats_OLP_Observe_Eventlog();\n\t\t$event_log->observeHitStat($this);\n\t}", "public function hit()\n {\n if($this->exists){\n $stats = $this->popularityStats()->first();\n if( empty( $stats ) ){\n //associates a new Stats instance for this instance\n $stats = new Stats();\n $this->popularityStats()->save($stats);\n }\n return $stats->updateStats();\n }\n return false;\n }", "private function _recordVisit() {\n $txnTable = $this->settings['txnTable'];\n $dtlTable = $this->settings['dtlTable'];\n $isRES = BoolYN( $this->_isResource() );\n $rVal = false;\n\n // Construct the INSERT Statement and Record It\n $dsvID = \"CONCAT(DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'), '-', \" . \n nullInt($this->settings['SiteID']) . \", '-', \" . \n \"'\" . sqlScrub($this->settings['RequestURL']) . \"')\";\n $sqlStr = \"INSERT INTO `$txnTable` (`dsvID`, `DateStamp`, `SiteID`, `VisitURL`, `Hits`, `isResource`, `UpdateDTS`) \" .\n \"VALUES ( MD5($dsvID), DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'), \" . nullInt($this->settings['SiteID']) . \",\" .\n \" '\" . sqlScrub($this->settings['RequestURL']) . \"',\" .\n \" 1, '$isRES', Now() )\" .\n \"ON DUPLICATE KEY UPDATE `Hits` = `Hits` + 1,\" .\n \" `UpdateDTS` = Now();\" .\n \"INSERT INTO `$dtlTable` (`SiteID`, `DateStamp`, `VisitURL`, `ReferURL`, `SearchQuery`, `isResource`, `isSearch`, `UpdateDTS`) \" .\n \"VALUES ( \" . nullInt($this->settings['SiteID']) . \", DATE_FORMAT(Now(), '%Y-%m-%d %h:00:00'),\" . \n \" '\" . sqlScrub($this->settings['RequestURL']) . \"',\" .\n \" '\" . sqlScrub($this->settings['Referrer']) . \"',\" .\n \" '', '$isRES', 'N', Now() );\";\n $rslt = doSQLExecute( $sqlStr );\n if ( $rslt > 0 ) { $rVal = true; }\n\n // Return the Boolean Response\n return $rVal;\n }", "static function hit(){\n $beeHiveWriter = new BeeHiveWriter(self::$_hiveName);\n // if game is not over, random hit a bee\n if(!self::$_hive->gameOver()){\n self::$_hive->randomHit();\n }\n // after the hit, if game over: delete session\n if(self::$_hive->gameOver()){\n self::$_gameStatus = \"game over\";\n $beeHiveWriter->deleteSession();\n }else{\n // if game is not over, write the session\n self::$_gameStatus= \"game on\";\n $beeHiveWriter->writeSession(self::$_hive);\n };\n // update status\n self::$_hiveStatus = self::$_hiveViewer->view();\n }", "protected function doActionSendTracking()\n {\n \\XLite\\Core\\Mailer::sendOrderTrackingInformationCustomer($this->getOrder());\n\n \\XLite\\Core\\TopMessage::addInfo('Tracking information has been sent');\n }", "function action_track() {\n if(model_user::userLoggedIn()) {\n // Include view for this page.\n @include_once APP_PATH . 'view/track_page.tpl.php';\n } else {\n header('Location: /home/login');\n }\n }", "private function track(string $action) : void {\n if (filter_input(INPUT_SERVER, 'HTTP_DNT') === '1') {\n return;\n }\n $matomoTracker = new MatomoTracker(4, 'https://stats.codepoints.net/');\n /* make sure this blocks the API as little as possible */\n $matomoTracker->setRequestTimeout(1);\n $matomoTracker->setUrlReferrer($_SERVER['HTTP_REFERER'] ?? '');\n $matomoTracker->setUserAgent($_SERVER['HTTP_USER_AGENT'] ?? '');\n $matomoTracker->disableCookieSupport();\n $matomoTracker->doTrackPageView('API v1: '.$action);\n }", "function countHit() {\n App::import('Vendor', 'ip');\n\n $ip = _getip();\n $client = ip2long($ip);\n\n $sql = \"SELECT count(*) FROM hits WHERE \";\n $sql .= \"ip='\".$client.\"' AND link_id='\".$this->id.\"' \";\n // mySQL >=5: $sql .= \"AND DATEDIFF(NOW(), created) < 1\";\n $sql .= \"AND (TO_DAYS(NOW()) - TO_DAYS(created)) < \".Configure::read('Clicks.NoCountPeriod');\n $allreadyClicked = $this->query($sql);\n\n if ($allreadyClicked[0][0]['count(*)'] == 0) {\n $this->Hit->create();\n $this->Hit->data['Hit']['link_id'] = $this->id;\n $this->Hit->data['Hit']['ip'] = $client;\n $this->Hit->save($this->Hit->data);\n\n $this->saveField('hit_count', $this->data['Link']['hit_count']+1, false);\n }\n }", "public function log_activity() {\n\t\t$data = array();\n\t\t$data['page'] = current_url();\n\t\t$data['ip_address'] = $this->_ci->input->ip_address();\n\t\t$data['user_agent'] = $this->_ci->agent->agent_string(); \n\t\t$data['request_method'] = $this->_ci->input->server('REQUEST_METHOD');\n\t\t$data['request_params'] = serialize($this->_ci->input->get_post(NULL, TRUE)); \n\t\t$data['uri_string'] = $this->_ci->uri->uri_string();\n\t\t$data['created_at'] = date('Y-m-d h:i:s');\n\n\t\tif($this->verify_activity()) {\n\t\t\t// And write it to the database\n\t\t\t$this->_ci->db->insert('hooks', $data);\n\t\t}\n\t}", "function enableHitsOnly(){\n\t\t$this->hitsonly = true;\n\t}", "public static function optin_track_usage() {\n\n\t\t/** update week day for tracking */\n\t\t$track_week_day = date( 'w' );\n\t\tupdate_option( 'xl_track_day', $track_week_day, false );\n\n\t\t$data = self::collect_data();\n\n\t\t//posting data to api\n\t\tXL_API::post_tracking_data( $data );\n\t}", "function track_visitor()\n{\n $dbh = new db;\n $dbh->createTables();\n\n $ip_address = checkParam($_SERVER,\"REMOTE_ADDR\",'');\n $page_name = checkParam($_SERVER,\"SCRIPT_NAME\",'');\n $query_string = checkParam($_SERVER,\"QUERY_STRING\",'');\n $current_page = $page_name.\"?\".$query_string;\n\n if( isset($_SESSION['visitor_id']) )\n $visitor_id = $_SESSION['visitor_id'];\n else\n $visitor_id = $dbh->getNewVisitorID();\n\n if( isset($_SESSION[\"tracking\"]) )\n {\n // If it's a new page, add new tracking entry\n if($_SESSION[\"current_page\"] != $current_page)\n {\n $dbh->addEntry($visitor_id,$ip_address,$page_name,$query_string);\n }\n }\n else\n {\n $_SESSION[\"tracking\"] = TRUE;\n $_SESSION[\"visitor_id\"] = $visitor_id;\n $dbh->addEntry($visitor_id,$ip_address,$page_name,$query_string);\n }\n $_SESSION[\"current_page\"] = $current_page;\n}", "function feuserloginsystem_addUserStatisticEntry() {\r\n\r\n $timeStamp = time();\r\n\r\n # For the page tracking feature get the time and the page ID.\r\n $pagetrackingArray = array();\r\n $pagetrackingArray[] = array('time' => $timeStamp, 'pageID' => intval($this->id));\r\n\r\n # Get commom information for statistics.\r\n\t\t$insertDataArray = array();\r\n\t\t$insertDataArray['feuserid'] = intval($this->fe_user->user[\"uid\"]);\r\n\t\t$insertDataArray['sessionstart'] = $timeStamp;\r\n\t\t$insertDataArray['lastpageview'] = $timeStamp;\r\n\t\t$insertDataArray['pagecounter'] = intval(1);\r\n\t\t$insertDataArray['pagetracking'] = serialize($pagetrackingArray);\r\n\r\n\t\t# Create statistic entry in the database.\r\n $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_feuserloginsystem_userstatistics',$insertDataArray);\r\n }", "function log_stats($page_id)\n {\n global $app, $HTTP_USER_AGENT, $REMOTE_ADDR;\n\t\t$app[current_page] = $page_id;\n\t\t$year = date('Y');\n $hour = date('g a');\n $week = date('w');\n $month = date('F');\n\n\t\t## total hit \n $sql = \"select * from {$app[table][stats_hit]}\n where year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_hit]} \n set counter = counter + 1\n where year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_hit]} (counter, year) values(1,'$year')\";\n endif;\n db::qry($sql);\n \n ## by page\n $sql = \"select * from {$app[table][stats_page]}\n where page_id = '$page_id' and year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_page]} \n \tset counter = counter + 1\n\t\t\t\t\twhere page_id = '$page_id' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_page]} (page_id, counter, year) values('$page_id',1,'$year')\";\n endif;\n db::qry($sql);\n\t\n ## by browser\n if (eregi(\"Nav\", $HTTP_USER_AGENT) || eregi(\"Gold\", $HTTP_USER_AGENT) || eregi(\"X11\", $HTTP_USER_AGENT) || eregi(\"en-US\", $HTTP_USER_AGENT) || eregi(\"Netscape\", $HTTP_USER_AGENT) || eregi(\"Mozilla/4.74\", $HTTP_USER_AGENT)):\n $browser = \"Netscape\";\n elseif (eregi(\"Lynx\", $HTTP_USER_AGENT)): \n $browser = \"Lynx\";\n elseif (eregi(\"Opera\", $HTTP_USER_AGENT)): \n $browser = \"Opera\";\n elseif (eregi(\"Konqueror\", $HTTP_USER_AGENT)): \n $browser = \"Konqueror\";\n elseif (eregi(\"Bot\", $HTTP_USER_AGENT) || eregi(\"Google\", $HTTP_USER_AGENT) || eregi(\"Slurp\", $HTTP_USER_AGENT) || eregi(\"Scooter\", $HTTP_USER_AGENT) || eregi(\"Spider\", $HTTP_USER_AGENT) || eregi(\"Infoseek\", $HTTP_USER_AGENT)):\n $browser = \"Bot\";\n elseif (eregi(\"MSIE\", $HTTP_USER_AGENT)):\n $browser = \"MSIE\";\n else:\n $browser = \"Other\";\n endif;\n \n $sql = \"select * from {$app[table][stats_browser]}\n where browser = '$browser' and year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_browser]} \n set counter = counter + 1\n where browser = '$browser' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_browser]} (browser, counter, year) values('$browser',1,'$year')\";\n endif; \n db::qry($sql); \n\t\n ## by OS\n if (eregi(\"Win\", $HTTP_USER_AGENT)):\n $os = \"Windows\";\n elseif (eregi(\"Mac\", $HTTP_USER_AGENT)): \n $os = \"Mac\";\n elseif (eregi(\"PPC\", $HTTP_USER_AGENT)): \n $os = \"Mac\";\n elseif (eregi(\"Linux\", $HTTP_USER_AGENT)): \n $os = \"Linux\";\n elseif (eregi(\"FreeBSD\", $HTTP_USER_AGENT)): \n $os = \"FreeBSD\";\n elseif (eregi(\"SunOS\", $HTTP_USER_AGENT)):\n $os = \"SunOS\";\n elseif (eregi(\"IRIX\", $HTTP_USER_AGENT)):\n $os = \"IRIX\";\n elseif (eregi(\"BeOS\", $HTTP_USER_AGENT)):\n $os = \"BeOS\";\n elseif (eregi(\"OS/2\", $HTTP_USER_AGENT)):\n $os = \"OS2\";\n elseif (eregi(\"AIX\", $HTTP_USER_AGENT)):\n $os = \"AIX\";\n else:\n $os = \"Other\";\n endif;\n \n $sql = \"select * from {$app[table][stats_os]}\n where os = '$os' and year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_os]} \n set counter = counter + 1\n where os = '$os' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_os]} (os, counter, year) values('$os',1,'$year')\";\n endif;\n\t\tdb::qry($sql);\n\t\n\t\t## by hour\n\t\t$sql = \"select * from {$app[table][stats_hour]}\n where jam = '$hour' and year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_hour]} \n set counter = counter + 1\n where jam = '$hour' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_hour]} (jam, counter, year) values('$hour',1,'$year')\";\n endif;\n\t\tdb::qry($sql);\n\t\t\n\t\t## by weekday\n\t\t$sql = \"select * from {$app[table][stats_week]}\n where hari = '$week' and year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_week]} \n set counter = counter + 1\n where hari = '$week' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_week]} (hari, counter, year) values('$week',1,'$year')\";\n endif;\n\t\tdb::qry($sql);\n\t\t\t\n ## by month\n $sql = \"select * from {$app[table][stats_month]}\n where bulan = '$month' and year = '$year'\";\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_month]} \n set counter = counter + 1\n where bulan = '$month' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_month]} (bulan, counter, year) values('$month',1,'$year')\";\n endif;\n\t\tdb::qry($sql);\n \t\n \t## by IP\n \t$ip = $REMOTE_ADDR;\n \t#$hostname = @gethostbyaddr($ip);\n\t\t$hostname = $ip;\n\t\t$sql = \"select * from {$app[table][stats_ip]} where ip = '$ip' and year = '$year'\";\n\t\t#echo $sql;exit;\n db::query($sql, $rs, $nr);\n if ($nr):\n $sql = \"update {$app[table][stats_ip]} \n set counter = counter + 1\n where ip = '$ip' and year = '$year'\";\n else:\n $sql = \"insert into {$app[table][stats_ip]} (ip, hostname, counter, year) values('$ip','$hostname', 1, '$year')\";\n endif;\n db::qry($sql);\n\t}", "public function hitURL($url)\n\t{\n\t\t$this->statpro->insert(\n\t\t\t6,\n\t\t\tarray(\n\t\t\t\t$url,\n\t\t\t\ttime(),\n\t\t\t)\n\t\t);\n\t}", "function updateHitCount($short_url_id){\n\t\t$this->query('UPDATE short_urls SET hit_count = hit_count + 1, modified = NOW() WHERE id='.$short_url_id);\n\t}" ]
[ "0.6572687", "0.64216864", "0.6278415", "0.62199825", "0.61919165", "0.6091253", "0.59876066", "0.59746367", "0.5839471", "0.58259034", "0.5744556", "0.56715214", "0.56668496", "0.5616951", "0.5609843", "0.5601164", "0.55535907", "0.555136", "0.55492556", "0.55422217", "0.55138075", "0.5503173", "0.54922414", "0.54806256", "0.54710513", "0.5451103", "0.54276633", "0.54107475", "0.5407347", "0.5360643" ]
0.81755155
0
Set database table prefix
public function setPrefixFromDB(){ foreach($this->getTables() as $table){ $prefix = explode('_', $table); if(isset($prefix[1])){ if($this->prefix==$prefix[0]) break; else $this->prefix = $prefix[0]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function setTablePrefix()\n {\n }", "static function set_table_prefix($tp) {\n\t\tself::$table_prefix = $tp;\n\t}", "public static function getTablePrefix()\n {\n }", "public static function getTablePrefix()\n {\n return 'prefix_';\n }", "public function getTablePrefix();", "public function table_prefix(){\n return $this->db->dbprefix;\n }", "public static function setTablePrefix($prefix)\n {\n }", "public function db_changeTablePrefix( $table_prefix )\n\t{\n\t\tif ($table_prefix !== '?') {\n\t\t\t$this->table_prefix = $table_prefix;\n\t\t}\n\t}", "public function table_prefix()\n\t{\n\t\treturn $this->_config['table_prefix'];\n\t}", "protected function updateBaseTablePrefix()\n {\n //Do nothing since this is the single-site class\n }", "public function getTablePrefix(): string\n {\n return $this->tablePrefix;\n }", "function ajan_core_get_table_prefix() {\n\tglobal $wpdb;\n\n\treturn apply_filters( 'ajan_core_get_table_prefix', $wpdb->base_prefix );\n}", "public function prefix_table($table)\n\t{\n\t\t// Add the prefix to the table name\n\t\t// before quoting it\n\t\tif ( ! empty($this->table_prefix))\n\t\t{\n\t\t\t// Split indentifier by period, will split into:\n\t\t\t// database.schema.table OR\n\t\t\t// schema.table OR\n\t\t\t// database.table OR\n\t\t\t// table\n\t\t\t$idents = explode('.', $table);\n\t\t\t$segments = count($idents);\n\n\t\t\t// Quote the last item, and add the database prefix\n\t\t\t$idents[$segments - 1] = $this->_prefix(end($idents));\n\n\t\t\t// Rejoin\n\t\t\t$table = implode('.', $idents);\n\t\t}\n\n\t\treturn $table;\n\t}", "public function getTablePrefix()\n {\n return $this->tablePrefix;\n }", "public function db_prefix($tablename = '')\n {\n $ret = $this->_db->prefix($tablename);\n return $ret;\n }", "public function table_prefix($prefix) {\r\n\t\t$this->_prefix = $prefix;\r\n\t\t\r\n\t\treturn $this;\r\n\t}", "public function tablePrefix( $prefix = null ) {\n\t\treturn wfSetVar( $this->mTablePrefix, $prefix );\n\t}", "function setUserTablePrefix($prefix=\"shared\") {\n\t\t$this->_db_user = $prefix . \"_sessions\"; \n\t}", "public function prefix() {\n return $this->db['prefix'];\n }", "public function set_dbprefix($prefix = '')\n\t{\n\t\treturn $this->dbprefix = $prefix;\n\t}", "function get_table_name()\n {\n global $table_prefix;\n global $wpdb;\n $prefix = $table_prefix;\n if ($wpdb != null && $wpdb->prefix != null) {\n $prefix = $wpdb->prefix;\n }\n return apply_filters('ngg_datamapper_table_name', $prefix . $this->_object_name, $this->_object_name);\n }", "public function __construct($tblPrefix = \"\");", "public function dbprefix($table = '')\n\t{\n\t\tif ($table === '')\n\t\t{\n\t\t\t$this->display_error('db_table_name_required');\n\t\t}\n\n\t\treturn $this->dbprefix.$table;\n\t}", "public function getDbTableName(string $drupal_prefix, string $drupal_table_name): string;", "public function setColumnPrefix($solumnPrefix);", "public function init()\n\t{\n\t\tif (isset($_SERVER['DB_TABLE_PREFIX'])) {\n\t\t\t$this->setPrefix($_SERVER['DB_TABLE_PREFIX']);\n\t\t}\n\t}", "protected function setTable()\n {\n $class = explode('\\\\', get_called_class());\n $this->table = lcfirst(end($class)).'s';\n }", "function get_table_name()\n {\n global $table_prefix;\n return $table_prefix . 'posts';\n }", "public function getPrefix(): string\n {\n return config('linky.db.prefix');\n }", "protected function setTable() : void {\n\t\t$annotation = $this->annotationReader->getClassAnnotation($this->reflectionClass, 'Henri\\Framework\\Annotations\\Annotation\\DB');\n\t\tif ($annotation && isset($annotation->table)) {\n\t\t\t$this->tableName = $annotation->table;\n\t\t\t$this->tableNamePrefixed = $this->database->getPrefix() . $this->tableName;\n\t\t}\n\t}" ]
[ "0.8772204", "0.82414293", "0.8106719", "0.8043617", "0.80148953", "0.7847606", "0.78414595", "0.76680994", "0.7622542", "0.7565888", "0.75385636", "0.74136823", "0.7413044", "0.74047804", "0.73862827", "0.73421973", "0.73334724", "0.7318997", "0.7288911", "0.7255832", "0.7249907", "0.7231649", "0.7226649", "0.7184351", "0.7156272", "0.7088366", "0.70190895", "0.69926226", "0.6975529", "0.69654363" ]
0.85105306
1
Given a twodimensional array of integers, return the flattened version of the array with all the integers in the sorted (ascending) order. Example: Given [[3, 2, 1], [4, 6, 5], [], [9, 7, 8]], your function should return [1, 2, 3, 4, 5, 6, 7, 8, 9].
function flatten_and_sort(array $a): array { $flatten = array_merge([], ...$a); sort($flatten); return $flatten; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function flattenArray($array)\n{\n\t$flatArray = array();\n\tforeach ($array as $subElement) {\n \tif (is_array($subElement)) {\n\t\t\t$flatArray = array_merge($flatArray, flattenArray($subElement));\n\t\t} else {\n\t\t\t$flatArray[] = $subElement;\n\t\t}\n\t}\n\n\treturn $flatArray;\n}", "function array_flatten($array){\n\tif (is_array($array))\n\t\treturn $array ?\n\t\t\tcall_user_func_array('array_merge', array_map('array_flatten', $array))\n\t\t\t: array();\n\treturn array($array);\n}", "function flat(&$ary) {\n for ($i = 0; $i < count($ary); $i++) {\n while (is_array($ary[$i])) {\n array_splice($ary, $i, 1, $ary[$i]);\n }\n }\n}", "function flatArray($array){\n\t\t$result = [];\n\t\tif (is_array($array)) {\n\t\t\tforeach ($array as $element) {\n\t\t\t\t$result = array_merge($result, flatArray($element));\n\t\t\t}\n\t\t} else {\n\t\t\tarray_push($result, $array);\n\t\t}\n\n\t\treturn $result;\n\t}", "function array_flatten($array)\n\t{\n\t\t$return = array();\n\n\t\tarray_walk_recursive($array, function($x) use (&$return) { $return[] = $x; });\n\n\t\treturn $return;\n\t}", "function array_sort_recursive($array)\n {\n return Arr::sortRecursive($array);\n }", "function merge_sort($my_array){\n if(count($my_array) == 1 ) return $my_array;\n $mid = count($my_array) / 2;\n $left = array_slice($my_array, 0, $mid);\n $right = array_slice($my_array, $mid);\n $left = merge_sort($left);\n $right = merge_sort($right);\n return merge($left, $right);\n}", "public function array_sort_recursive($array)\n {\n return Arr::sortRecursive($array);\n }", "function array_flatten(array $array):array\n{\n if (!is_array($array)) {\n return false;\n }\n $result = array();\n foreach ($array as $key => $value) {\n if (is_array($value)) {\n $result = array_merge($result, array_flatten($value));\n } else {\n $result = array_merge($result, array($key => $value));\n }\n }\n return $result;\n}", "function array_flatten($array) { \r\n if (!is_array($array)) { \r\n return false; \r\n } \r\n $result = array(); \r\n foreach ($array as $key => $value) { \r\n if (is_array($value)) { \r\n $result = array_merge($result, array_flatten($value)); \r\n } else { \r\n $result[$key] = $value; \r\n } \r\n } \r\n return $result; \r\n}", "function array_flatten($array): array\n{\n return array_reduce(\n $array,\n function ($acc, $item) {\n if (is_array($item) || $item instanceof Traversable) {\n return array_merge($acc, array_flatten($item));\n } else {\n $acc[] = $item;\n\n return $acc;\n }\n },\n []\n );\n}", "function array_flatten($array) { \n\tif (!is_array($array)) { \n\t\treturn FALSE; \n\t} \n\t$result = array(); \n\tforeach ($array as $key => $value) { \n\t\tif (is_array($value)) { \n\t\t\t$result = array_merge($result, array_flatten($value)); \n\t\t} \n\t\telse { \n\t\t\t$result[$key] = $value; \n\t\t} \n\t} \n\treturn $result; \n}", "function array_flatten($array, $depth = INF)\n {\n return Arr::flatten($array, $depth);\n }", "function erp_array_flatten( $array ) {\n if ( ! is_array( $array ) ) {\n return false;\n }\n $result = array();\n foreach ( $array as $key => $value ) {\n if ( is_array( $value ) ) {\n $result = array_merge( $result, erp_array_flatten( $value ) );\n } else {\n $result[ $key ] = $value;\n }\n }\n\n return $result;\n}", "static function flatten(array $array) {\n $ret = [];\n\n array_walk_recursive($array, function ($i) use (&$ret) {\n $ret[] = $i;\n });\n\n return $ret;\n }", "function merge_sort($arr)\n{\n $length = count($arr);\n\n if ($length <= 1) {\n return $arr;\n }\n\n $half = ($length >> 1) + ($length & 1);\n $half_arr = array_chunk($arr, $half);\n\n $left = merge_sort($half_arr[0]);\n $right = merge_sort($half_arr[1]);\n\n while (count($left) && count($right)) {\n if ($left[0] < $right[0]) {\n $reg[] = array_shift($left);\n } else {\n $reg[] = array_shift($right);\n }\n }\n\n return array_merge($reg, $left, $right);\n}", "public static function sortRecursive($array)\n {\n foreach ($array as &$value) {\n if (is_array($value)) {\n $value = static::sortRecursive($value);\n }\n }\n\n if (static::isAssoc($array)) {\n ksort($array);\n } else {\n sort($array);\n }\n\n return $array;\n }", "public static function sortRecursive($array)\n {\n foreach ($array as &$value) {\n if (is_array($value)) {\n $value = static::sortRecursive($value);\n }\n }\n\n if (static::isAssoc($array)) {\n ksort($array);\n } else {\n sort($array);\n }\n\n return $array;\n }", "function array_flatten($array) {\n\tif (!is_array($array)) {\n\t\treturn FALSE;\n\t}\n\t$result = array();\n\tforeach ($array as $key => $value) {\n\t\tif (is_array($value)) {\n\t\t\t$result = array_merge($result, array_flatten($value));\n\t\t} else {\n\t\t\t$result[$key] = $value;\n\t\t}\n\t}\n\treturn $result;\n}", "public static function flatten(array $input)\n {\n $output = array();\n self::flattenSub($input, $output);\n return $output;\n }", "function flatten($array) {\n $result = array();\n foreach($array as $key => $subarray) {\n $result = array_merge($result, $subarray);\n }\n return $result;\n }", "public static function array_flatten(array $array, $return = []) {\n\t\tfor ($x = 0; $x <= count($array); $x++) {\n\t\t\tif (is_array($array[$x])) {\n\t\t\t\t$return = self::array_flatten($array[$x], $return);\n\t\t\t} else if (isset($array[$x])) {\n\t\t\t\t$return[] = $array[$x];\n\t\t\t}\n\t\t}\n\t\treturn $return;\n\t}", "public static function flatten( $array, $depth = INF )\n {\n $result = [];\n\n foreach ( $array as $item ) {\n if ( ! is_array( $item ) ) {\n $result[] = $item;\n } elseif ( $depth === 1 ) {\n $result = array_merge( $result, array_values( $item ) );\n } else {\n $result = array_merge( $result, static::flatten( $item, $depth - 1 ) );\n }\n }\n\n return $result;\n }", "public function array_flatten($array, $depth = INF)\n {\n return Arr::flatten($array, $depth);\n }", "public static function flatten( $array )\n\t{\n\t\t$flat = array();\n\t\tforeach ( $array as $key => $value ) {\n\t\t\tif ( is_array( $value ) ) {\n\t\t\t\t$flat += self::flatten( $value );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$flat[$key] = $value;\n\t\t\t}\n\t\t}\n\t\treturn $flat;\n\t}", "public static function flatten($array)\n {\n $return = [];\n\n array_walk_recursive($array, function($x) use (&$return) { $return[] = $x; });\n\n return $return;\n }", "public static function flatten($array)\n {\n $return = [];\n\n array_walk_recursive($array, function ($x) use (&$return) {\n $return[] = $x;\n });\n\n return $return;\n }", "function flatten($args){\n $res = array();\n foreach($args as $a) {\n if(is_array($a)) $res = array_merge($res, flatten($a));\n else $res[] = $a;\n }\n return $res;\n}", "private function array_flatten(array $a) {\r\n $ab = [];\r\n\r\n if (!is_array($a)) return [];\r\n\r\n foreach ($a as $value) {\r\n if (is_array($value)) {\r\n $ab = array_merge($ab, $this->array_flatten($value));\r\n } else {\r\n array_push($ab, $value);\r\n }\r\n }\r\n\r\n return $ab;\r\n }", "public static function flatten($array, $depth = INF)\n {\n $result = [];\n\n foreach ($array as $item) {\n $item = $item instanceof Collection ? $item->all() : $item;\n\n if (! is_array($item)) {\n $result[] = $item;\n } elseif ($depth === 1) {\n $result = array_merge($result, array_values($item));\n } else {\n $result = array_merge($result, static::flatten($item, $depth - 1));\n }\n }\n\n return $result;\n }" ]
[ "0.6523244", "0.6280655", "0.6273831", "0.62410647", "0.6225145", "0.6221742", "0.6190673", "0.6057553", "0.6040453", "0.5997727", "0.59585863", "0.5956999", "0.59409875", "0.59008163", "0.5882699", "0.587841", "0.58677673", "0.58677673", "0.5843793", "0.58420146", "0.58279234", "0.5742884", "0.57373595", "0.57075137", "0.57057434", "0.57036847", "0.5702104", "0.56725764", "0.5647195", "0.5646516" ]
0.6898906
0
must check and return this keys from $_POST token [string] new_only [boolean] emptys [boolean] wrongs [boolean] answer_result [boolean] random [boolean] length [int] category [string]
private function check_make_input() { $output = []; if (!isset($_POST['token']) || !isset($_POST['new_only']) || !isset($_POST['emptys']) || !isset($_POST['wrongs']) || !isset($_POST['answer_result']) || !isset($_POST['random']) || !isset($_POST['length']) || !isset($_POST['category'])) return false; if (empty($_POST['token']) || empty($_POST['new_only']) || empty($_POST['emptys']) || empty($_POST['wrongs']) || empty($_POST['answer_result']) || empty($_POST['random']) || empty($_POST['length'])) return false; $output = [ "token" => (string) $_POST["token"], "new_only" => (bool) $_POST["new_only"], "emptys" => (bool) $_POST["emptys"], "wrongs" => (bool) $_POST["wrongs"], "answer_result" => (bool) $_POST["answer_result"], "random" => (bool) $_POST["random"], "length" => (int) $_POST["length"], "category" => (array) json_decode($_POST["category"]), ]; return $output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function chooseTokensCheckVars()\n {\n $cart = geoCart::getInstance();\n //check the settings!\n\n if (!$_POST['token_choice']) {\n $msgs = self::_getText();\n\n $cart->addError()\n ->addErrorMsg('tokens_purchase', $msgs['error_choose_tokens']);\n return;\n }\n\n $util = geoAddon::getUtil('tokens');\n $token = $util->getTokenInfo($cart->item->getPricePlan(), $_POST['token_choice']);\n\n if (!$token) {\n $msgs = self::_getText();\n\n $cart->addError()\n ->addErrorMsg('tokens_purchase', $msgs['error_invalid_selection']);\n }\n //if it got this far, everything is AOK!\n }", "private function check_finish_inputs()\n {\n $output = [];\n if (!isset($_POST[\"token\"]) || !isset($_POST[\"exam_id\"]) || !isset($_POST[\"corrects\"]) || !isset($_POST[\"wrongs\"]) || !isset($_POST[\"emptys\"]))\n return false;\n\n if (empty($_POST[\"token\"]) || empty($_POST[\"exam_id\"]) || empty($_POST[\"corrects\"]) || empty($_POST[\"wrongs\"]) || empty($_POST[\"emptys\"]))\n return false;\n\n $output = [\n (string) \"token\" => $_POST[\"token\"],\n (int) \"exam_id\" => $_POST[\"exma_id\"],\n (array) \"corrects\" => json_decode($_POST[\"corrects\"]),\n (array) \"wrongs\" => json_decode($_POST[\"wrongs\"]),\n (array) \"emptys\" => json_decode($_POST[\"emptys\"]),\n ];\n\n return $output;\n }", "function unpack_post() {\n // Globals\n global $min_words;\n global $add_num;\n global $add_char;\n global $case_opt;\n global $separator;\n\n if (array_key_exists('min-words', $_POST)) {\n $min_words = $_POST['min-words'];\n }\n\n if (array_key_exists('add-num', $_POST)) {\n $add_num = True;\n }\n\n if (array_key_exists('add-char', $_POST)) {\n $add_char = True;\n }\n\n if (array_key_exists('separator', $_POST)) {\n $separator = $_POST['separator'];\n }\n\n if (array_key_exists('case-opt', $_POST)) {\n $case_opt = $_POST['case-opt'];\n }\n\n // Mostly just for testing\n return [$min_words, (int)$add_num, (int)$add_char, $separator, $case_opt];\n}", "function _pre_token_validation($input) {\n\n if (ENV !== 'dev') {\n //add your own validation code here!\n echo 'Forbidden (no validation tests available)';\n http_response_code(403);\n die();\n }\n\n if (!isset($input['user_id'])) {\n http_response_code(400);\n echo 'No user_id submitted!';\n die();\n } elseif(!is_numeric($input['user_id'])) {\n http_response_code(400);\n echo 'Non-numeric user_id submitted!';\n die();\n }\n\n return $input;\n }", "public function getPostValues()\n {\n // Define the check for params\n $post_check_array = array(\n // submit action\n 'toevoegen' => array('filter' => FILTER_SANITIZE_STRING),\n 'bijwerken' => array('filter' => FILTER_SANITIZE_STRING),\n 'verwijderen' => array('filter' => FILTER_SANITIZE_STRING),\n // question\n 'vraag' => array('filter' => FILTER_SANITIZE_STRING),\n // question type (open or closed)\n 'vraagId' => array('filter' => FILTER_SANITIZE_INT),\n // question type (open or closed)\n 'vraagSoort' => array('filter' => FILTER_SANITIZE_STRING),\n // Education\n 'opleiding' => array('filter' => FILTER_SANITIZE_STRING),\n // question send time\n 'verstuurTijd' => array('filter' => FILTER_SANITIZE_STRING)\n );\n // Get filtered input:\n $inputs = filter_input_array(INPUT_POST, $post_check_array);\n // RTS\n return $inputs;\n }", "function ltiExtractPost() {\n // Unescape each time we use this stuff - somedy we won't need this...\n $FIXED = array();\n foreach($_POST as $key => $value ) {\n if (get_magic_quotes_gpc()) $value = stripslashes($value);\n $FIXED[$key] = $value;\n }\n $retval = array();\n $retval['key'] = isset($FIXED['oauth_consumer_key']) ? $FIXED['oauth_consumer_key'] : null;\n $retval['context_id'] = isset($FIXED['context_id']) ? $FIXED['context_id'] : null;\n $retval['link_id'] = isset($FIXED['resource_link_id']) ? $FIXED['resource_link_id'] : null;\n $retval['user_id'] = isset($FIXED['user_id']) ? $FIXED['user_id'] : null;\n\n if ( $retval['key'] && $retval['context_id'] && $retval['link_id'] && $retval['user_id'] ) {\n // OK To Continue\n } else {\n return false;\n }\n \n $retval['service'] = isset($FIXED['lis_outcome_service_url']) ? $FIXED['lis_outcome_service_url'] : null;\n $retval['sourcedid'] = isset($FIXED['lis_result_sourcedid']) ? $FIXED['lis_result_sourcedid'] : null;\n\n $retval['context_title'] = isset($FIXED['context_title']) ? $FIXED['context_title'] : null;\n $retval['link_title'] = isset($FIXED['resource_link_title']) ? $FIXED['resource_link_title'] : null;\n $retval['user_email'] = isset($FIXED['lis_person_contact_email_primary']) ? $FIXED['lis_person_contact_email_primary'] : null;\n if ( isset($FIXED['lis_person_name_full']) ) {\n $retval['user_displayname'] = $FIXED['lis_person_name_full'];\n } else if ( isset($FIXED['lis_person_name_given']) && isset($FIXED['lis_person_name_family']) ) {\n $retval['user_displayname'] = $FIXED['lis_person_name_given'].' '.$FIXED['lis_person_name_family'];\n } else if ( isset($FIXED['lis_person_name_given']) ) {\n $retval['user_displayname'] = $FIXED['lis_person_name_given'];\n } else if ( isset($FIXED['lis_person_name_family']) ) {\n $retval['user_displayname'] = $FIXED['lis_person_name_given'];\n }\n $retval['role'] = 0;\n if ( isset($FIXED['roles']) ) {\n $roles = strtolower($FIXED['roles']);\n if ( ! ( strpos($roles,'instructor') === false ) ) $retval['role'] = 1;\n if ( ! ( strpos($roles,'administrator') === false ) ) $retval['role'] = 1;\n }\n return $retval;\n}", "public function getFormData(){\n\n\t\t\t\n\t\t\t$expectedVariables = ['title','email','checkbox'];\n\n\n\t\t\tforeach ($expectedVariables as $variable) {\n\n\t\t\t\t// creating entries for error field\t\n\t\t\t\t$this->moviesuggest['errors'][$variable]=\"\";\n\n\t\t\t\t// move all $_POST values into MovieSuggest array\n\t\t\t\tif(isset($_POST[$variable])){\n\t\t\t\t\t$this->moviesuggest[$variable] = $_POST[$variable];\n\t\t\t\t}else{\n\t\t\t\t\t$this->moviesuggest[$variable] = \"\";\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// var_dump($moviesuggest);\n\t\t\t// die();\n\t}", "function save_input_data()\r\n{\r\n foreach ($_POST as $key => $value) {//key : name, password... and value : field value\r\n //save datas in an array\r\n if (strpos($key, 'password') === false) {//in key : find password. if false : value not found\r\n $_SESSION['input'][$key] = $value;\r\n }\r\n }\r\n}", "function token_ctrl($token) {\r\n\t$session=Zend_Auth::getInstance()->getStorage();\r\n\t$log=Zend_Registry::get(\"log\");\r\n\t$reply=array('or'=>false,'and'=>true);\r\n\tforeach ($token as $key => $value) {\r\n\t\tif (preg_match(\"#^token#\", $key)) {\r\n\t\t\t$t=$session->get($key);\r\n\t\t\t$reply[$key]=($value==$t);\r\n\t\t\t$reply['or']=$reply['or']||$reply[$key];\r\n\t\t\t$reply['and']=$reply['and']&&$reply[$key];\r\n\t\t\t$session->delete($key);\r\n\t\t\tif (!$reply[$key]) $log->log(\"errore $key, valore ricevuto $value, valore memorizzato $t\",Zend_Log::WARN);\r\n\t\t}\r\n\t}\r\n\treturn $reply;\r\n}", "function _setCheck(){\n\t\tif( isset($_POST['formitable_setcheck']) )\n\t\tforeach($_POST['formitable_setcheck'] as $key){\n\t\t\tif( isset($this->rc4key) ){\n\t\t\t\t$key = $this->rc4->_decrypt( $this->rc4key, $this->_check_magic_quotes($key) );\n\t\t\t}\n\t\t\tif(!isset($_POST[$key])) $_POST[$key]=\"\";\n\t\t}\n\t}", "private function validateTokenRequest(): bool\n {\n $validator = new Validator([\n 'required' => ':attribute — обязательное поле.',\n 'numeric' => ':attribute — поле должно содержать только цифры.',\n ]);\n\n $validator->addValidator('plain', new PlainRule());\n\n $validation = $validator->make([\n 'shop_id' => $this->getRouteParam('id'),\n 'secret_key' => $this->http_request->query->get('secret_key'),\n ], [\n 'shop_id' => 'required|numeric',\n 'secret_key' => 'required|plain',\n ]);\n\n $validation->setAliases([\n 'shop_id' => 'Идентификатор магазина',\n 'secret_key' => 'Секретный ключ',\n ]);\n\n $validation->validate();\n\n if ($validation->fails()) {\n $errors = $validation->errors()->toArray();\n\n foreach ($errors as $key => $error) {\n foreach ($error as $message) {\n $this->errors[] = [\n 'code' => 'invalid-field',\n 'message' => $message,\n 'field' => $key,\n ];\n }\n }\n\n return false;\n }\n\n return true;\n }", "public function controlVariables() {\n\n $validacion = false;\n\n if (\n (count($_POST) > 0) && isset($_POST['kk_control_form']) && ($_POST['kk_control_form'] == $this->_kk_control_form)\n ) {\n $validacion = true;\n\n if (count($this->_formulario) > 0) {\n foreach ($this->_formulario[$this->_kk_control_form] as $key => $valor) {\n if ($valor['obligatorio'] == 'no_nulo') {\n if (isset($_POST[$key]) && is_array($_POST[$key])) {\n $valor_nulo = false;\n foreach ($_POST[$key] as $valor_post) {\n if (isset($valor_post) && $valor_post != '') {\n $valor_nulo = true;\n }\n }\n $validacion = $valor_nulo;\n } elseif ((!isset($_POST[$key]) || $_POST[$key] == '')) {\n $validacion = false;\n }\n }\n }\n\n if ($this->_captcha === false) {\n $validacion = false;\n }\n }\n }\n\n return $validacion;\n }", "function post($key) {\n\n $post = \\M\\Config::get('POST');\n if (isset($post[$key])) {\n return $post[$key];\n } else {\n\n return false;\n }\n}", "public static function manage_post_data(&$post) {\n\t\tif (count($post) > 0) {\n\t\t\tforeach ($post as $key => $value) {\n\t\t\t\t$key = Encryption::decrypt($key);\t\n\t\t\t\t$name = self::fetch_name($key);\n\t\t\t\t$errors[$name] = self::is_valid_request($key, $value);\n\t\t\t\t$output[$name] = self::apply_filters($key, $value);\n\t\t\t}\n\t\t\tself::$requested_data = $output;\n\t\t\tself::$errors = $errors;\n\t\t}\n\t\telse {\n\t\t\tself::$requested_data = false;\n\t\t}\n\t\t$post = array();\n\t}", "function get_fields_from_post(){\n\t\t$prefix=\"\";\n\t\t$this->id_corp=$_SESSION['ident_corp'];\n\t\t$this->name=htmlentities($_POST[$prefix.$this->ddbb_name]);\n\t\t$this->name_web=htmlentities($_POST[$prefix.$this->ddbb_name_web]);\n\t\t$this->pvp=$_POST[$prefix.$this->ddbb_pvp];\n\t\t$this->tax=$_POST[$prefix.$this->ddbb_tax];\n\t\t$this->pvp_tax=$_POST[$prefix.$this->ddbb_pvp_tax];\n\t\t$this->descrip=htmlentities($_POST[$prefix.$this->ddbb_descrip]);\n\t\t$this->path_photo = $_SESSION['ruta_photo'];\n\t\t\n\n\t\t\n\t\t$this->get_categories_from_post();\n\n\t\treturn 0;\n\t}", "public static function checkTokenRequestParam(): void\n {\n global $token_mismatch, $token_provided;\n\n $token_mismatch = true;\n $token_provided = false;\n\n if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== 'POST') {\n return;\n }\n\n if (isset($_POST['token']) && is_scalar($_POST['token']) && strlen((string) $_POST['token']) > 0) {\n $token_provided = true;\n $token_mismatch = ! @hash_equals($_SESSION[' PMA_token '], (string) $_POST['token']);\n }\n\n if (! $token_mismatch) {\n return;\n }\n\n // Warn in case the mismatch is result of failed setting of session cookie\n if (isset($_POST['set_session']) && $_POST['set_session'] !== session_id()) {\n trigger_error(\n __(\n 'Failed to set session cookie. Maybe you are using HTTP instead of HTTPS to access phpMyAdmin.'\n ),\n E_USER_ERROR\n );\n }\n\n /**\n * We don't allow any POST operation parameters if the token is mismatched\n * or is not provided.\n */\n $allowList = ['ajax_request'];\n Sanitize::removeRequestVars($allowList);\n }", "function GetTokenValidateRequest($Payloads) {\n\n if(!$Payloads ['Email'] || !$Payloads ['Password'] ) {\n Return \"False\" ;\n }\n return \"True\";\n\n}", "protected function getPostValues() {}", "public function checktoken(){\t\t\n\t\t$token=trim(strtoupper($this->input->post('tokenname')));\t\n\t\t$this->load->model('tokens');\t\n\t\t$data=$this->tokens->CheckToken($token);\n\t\tif(trim($data)==\"\"){\n\t\t\t\techo \"OK\";\n\t\t\t}else{\n\t\t\t\techo $data;\n\t\t\t\t}\n\t\t}", "function check_token($token, $form_name)\n{\n if (is_bool($token)) {\n return false;\n }\n return $token === get_token($form_name);\n}", "function parse_form($array) {\n// build reserved keyword array\n//Anything put in here will not show up in your email when form is processed\n $reserved_keys[] = \"MAX_FILE_SIZE\";\n $reserved_keys[] = \"required\";\n $reserved_keys[] = \"redirect\";\n //$reserved_keys[] = \"email\";\n $reserved_keys[] = \"require\";\n $reserved_keys[] = \"path_to_file\";\n $reserved_keys[] = \"recipient\";\n $reserved_keys[] = \"subject\";\n $reserved_keys[] = \"bgcolor\";\n $reserved_keys[] = \"text_color\";\n $reserved_keys[] = \"link_color\";\n $reserved_keys[] = \"vlink_color\";\n $reserved_keys[] = \"alink_color\";\n $reserved_keys[] = \"title\";\n $reserved_keys[] = \"missing_fields_redirect\";\n $reserved_keys[] = \"env_report\";\n $reserved_keys[] = \"Submit\";\n $reserved_keys[] = \"submit\";\n //$reserved_keys[] = \"name\";\n $reserved_keys[] = \"Name\";\n $reserved_keys[] = \"submit_x\";\n $reserved_keys[] = \"submit_y\";\n $reserved_keys[] = \"sendit\";\n if (count($array)) {\n while (list($key, $val) = each($array)) {\n//check for email injection\n\t\tif(!has_no_emailheaders($val)){\n\t\t\tprint_error(\"Please don't spam\");\n\t\t}\n\t\t\n// exclude reserved keywords\n $reserved_violation = 0;\n for ($ri=0; $ri<count($reserved_keys); $ri++) {\n if ($key == $reserved_keys[$ri]) $reserved_violation = 1;\n }\n// prepare content\n if ($reserved_violation != 1) {\n\t// let's check to see if they are check boxes\n if (is_array($val)) {\n for ($z=0; $z<count($val); $z++) {\n $nn=$z+1;\n $content .= \"$key #$nn: $val[$z]\\n\";\n }\n }\n\t // if the values contains nothing do nothing then\n\t // don't add it to the content)\n elseif($val != \"\") $content .= \"$key: $val\\n\";\n }\n } // end of while\nreturn $content;\n }\n}", "function processRequest(){\n\tglobal $muse; // App settings & database\n\tglobal $HTTP_RAW_POST_DATA;\n\t\n\t// Get the user's posted action\n\t$muse['actionRequestRaw'] = $HTTP_RAW_POST_DATA;\n\t$muse['actionRequest'] = $muse['db']->real_escape_string(trim($HTTP_RAW_POST_DATA));\n\t// First word of action request will be the action keyword.\n\t$muse['actionKeyword'] = strtolower(substr( $muse['actionRequest'], 0, strpos( $muse['actionRequest'], \" \" ) ) );\n\t\n\t// If it's only one word, through it back in. Capatlization issues?\n\tif ($muse['actionKeyword']==false) {\n\t\t$muse['actionKeyword'] = $muse['actionRequest'];\n\t}\n}", "function check_key($id_questions,$auth_token,$msg_auth_failed)\n{\n\t$found_key = check_question_keys($id_questions,$auth_token);\n\t\n\tif (empty($found_key))\n\t{\n\t\tdie($msg_auth_failed);\n\t}\n\t\n\treturn $found_key;\n\t\n}", "public function GetFormPostedValuesQuestions() {\n\t\t/* THE ARRAY OF POSTED FIELDS */\n\t\t$req_fields=array(\"survey_id\",\"question\");\n\n\t\tfor ($i=0;$i<count($req_fields);$i++) {\n\n\t\t\t//echo $_POST['application_id'];\n\t\t\tif (ISSET($_POST[$req_fields[$i]]) && !EMPTY($_POST[$req_fields[$i]])) {\n\t\t\t\t$this->SetVariable($req_fields[$i],EscapeData($_POST[$req_fields[$i]]));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//echo \"<br>\".$this->req_fields[$i].\"<br>\";\n\t\t\t\t$this->$req_fields[$i]=\"\";\n\t\t\t}\n\t\t}\n\t}", "function generate() {\n\n if ($_SERVER[\"REQUEST_METHOD\"] !== 'POST') {\n http_response_code(403);\n echo 'Forbidden';\n die();\n } else {\n //fetch posted data\n $posted_data = file_get_contents('php://input');\n $input = (array) json_decode($posted_data);\n $data = $this->_pre_token_validation($input);\n }\n\n $token = $this->_generate_token($data);\n http_response_code(200);\n echo $token;\n }", "public function setup_check_security_token() {\n\t\tif ( ! $this->wsal->settings()->CurrentUserCan( 'edit' ) ) {\n\t\t\techo wp_json_encode(\n\t\t\t\tarray(\n\t\t\t\t\t'success' => false,\n\t\t\t\t\t'message' => esc_html__( 'Access Denied.', 'wp-security-audit-log' ),\n\t\t\t\t)\n\t\t\t);\n\t\t\tdie();\n\t\t}\n\n\t\t$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : false;\n\t\t$token = isset( $_POST['token'] ) ? sanitize_text_field( wp_unslash( $_POST['token'] ) ) : false;\n\n\t\tif ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'wsal-verify-wizard-page' ) ) {\n\t\t\techo wp_json_encode(\n\t\t\t\tarray(\n\t\t\t\t\t'success' => false,\n\t\t\t\t\t'message' => esc_html__( 'Nonce verification failed.', 'wp-security-audit-log' ),\n\t\t\t\t)\n\t\t\t);\n\t\t\tdie();\n\t\t}\n\n\t\tif ( empty( $token ) ) {\n\t\t\techo wp_json_encode(\n\t\t\t\tarray(\n\t\t\t\t\t'success' => false,\n\t\t\t\t\t'message' => esc_html__( 'Invalid input.', 'wp-security-audit-log' ),\n\t\t\t\t)\n\t\t\t);\n\t\t\tdie();\n\t\t}\n\n\t\techo wp_json_encode(\n\t\t\tarray(\n\t\t\t\t'success' => true,\n\t\t\t\t'token' => $token,\n\t\t\t\t'tokenType' => esc_html( $this->get_token_type( $token ) ),\n\t\t\t)\n\t\t);\n\t\tdie();\n\t}", "function getPost($key) {\n\t$value = '';\n\tif (isset($_POST[$key])) {\n\t\t$value = $_POST[$key];\n\t}\n\t// return $value;\n\t//Phan 2: Ham xu ly ky tu dac biet\n\treturn removeSpecialCharacter($value);\n}", "function add_token(){\n\t\t$jumlah_token = $this->input->post('jumlah_token');\n\t\t$masa_aktif = $this->input->post('masa_aktif');\n\t\tif ($jumlah_token) {\n\t\t\tif ($jumlah_token==1) {\n\t\t\t\t$kode_voucher = strtoupper(uniqid());\n\t\t\t\t$data = array(\"nomorToken\"=>$kode_voucher,\n\t\t\t\t\t\"masaAktif\"=>$this->input->post('masa_aktif'));\n\t\t\t\t$this->token_model->insert_token($data);\n\t\t\t}else{\n\t\t\t\tfor ($i=0; $i < $jumlah_token ; $i++) { \n\t\t\t\t\t$kode_voucher = strtoupper(uniqid());\n\t\t\t\t\t$data = array(\"nomorToken\"=>$kode_voucher,\n\t\t\t\t\t\t\"masaAktif\"=>$masa_aktif);\n\t\t\t\t\t$this->token_model->insert_token($data);\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function checkTextFormValues($session){\r\n\t\tif ($session == \"imageName\" && strlen($_POST[$session]) > 50) {\r\n\t\t\t$_POST[$session] = null;\r\n\t\t} elseif ($session == \"description\" && strlen($_POST[$session]) > 500) {\r\n\t\t\t$_POST[$session] = null;\r\n\t\t} elseif ($session == \"author\" && strlen($_POST[$session]) > 50) {\r\n\t\t\t$_POST[$session] = null;\r\n\t\t}\r\n\r\n\t\tif (!empty($_POST[$session]) && is_string($_POST[$session]) && !preg_match( '/(galery_users|galery_photos|galery_superusers|DELETE|DROP|TABLE)/', $_POST[$session])) {\r\n\t\t\t$return = $_POST[$session];\r\n\t\t} else {\r\n\t\t\t$return = null;\r\n\t\t}\r\n\r\n\t\treturn $return;\r\n\t}", "function validateInterkassaResp($post_in)\n{\n\t$key_to_sort = $post_in;\n\t$ik_co_id = $key_to_sort['ik_co_id'];\n\t$ik_sign = $key_to_sort['ik_sign'];\n\t$ik_am = $key_to_sort['ik_am'];\n\t$ik_inv_st = $key_to_sort['ik_inv_st'];\n\n\t// Forming a digital signature\n\tunset($key_to_sort['ik_sign']);\n\tksort($key_to_sort, SORT_STRING);\n\n\t// Add to the array \"secret key\"\n\tarray_push($key_to_sort, 'XRZxzNbDsQYzsWm2');\n\n\t// Concatenate values ​​by a \":\"\n\t$signString = implode(':', $key_to_sort);\n\n\t// Take the MD5 hash in binary form by\n\t$sign = base64_encode(md5($signString, true));\n\n\t// Validate kassa results\n\tif(\n\t\t$ik_co_id == '5370b755bf4efccb31ad6f90' AND \n\t\t$ik_inv_st == 'success' AND \n\t\t$ik_sign == $sign\n\t)\n\t{\n\t\treturn $ik_am;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}" ]
[ "0.62056375", "0.6144503", "0.5749659", "0.56880814", "0.5658803", "0.5630164", "0.55228466", "0.54872245", "0.5446063", "0.5445069", "0.5414132", "0.53748727", "0.5369509", "0.5344173", "0.53163314", "0.52772856", "0.5244206", "0.5234528", "0.5233092", "0.5222523", "0.51442623", "0.51393044", "0.51302814", "0.51156414", "0.51085764", "0.51032466", "0.5079208", "0.5077464", "0.50700194", "0.50574875" ]
0.72371405
0
check this option with user access
private function check_access_to_option(array $_option, int $_user_id) { $user_access_code = $this->check_user_access((int) $_user_id); if (!$user_access_code) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cfwprapi_can_user_have_access( WP_REST_Request $request ) {\n return current_user_can( 'manage_options' );\n}", "function ShowOptionLink() {\n\t\tglobal $Security, $scholarship_package;\n\t\tif ($Security->IsLoggedIn()) {\n\t\t\tif (!$Security->IsAdmin()) {\n\t\t\t\treturn $Security->IsValidUserID($scholarship_package->group_id->CurrentValue);\n\t\t\t}\n\t\t}\n\t\treturn TRUE;\n\t}", "function ShowOptionLink() {\n\t\tglobal $Security, $scholarship_package;\n\t\tif ($Security->IsLoggedIn()) {\n\t\t\tif (!$Security->IsAdmin()) {\n\t\t\t\treturn $Security->IsValidUserID($scholarship_package->group_id->CurrentValue);\n\t\t\t}\n\t\t}\n\t\treturn TRUE;\n\t}", "protected function _checkPermission($options = array())\n {\n $viewer = MooCore::getInstance()->getViewer();\n if (!empty($viewer) && $viewer['Role']['is_admin']) {\n return true;\n }\n\n $cuser = $this->_getUser();\n $authorized = true;\n $hash = '';\n $return_url = '?redirect_url=' . base64_encode(FULL_BASE_URL.$this->request->here);\n\n //check normal subscription\n $this->options = $options;\n //$this->getEventManager()->dispatch(new CakeEvent('AppController.validNormalSubscription', $this));\n\n // check aco\n $check_aco = false;\n if (!empty($options['aco'])) {\n $acos = $this->_getUserRoleParams();\n\n if (!in_array($options['aco'], $acos)) {\n $authorized = false;\n $check_aco = true;\n $msg = __('Access denied');\n }\n } else if (!empty($options['user_block'])) {\n \tif ($cuser && !$cuser['Role']['is_admin'] && !$cuser['Role']['is_super'])\n \t{ \t\n\t $user_blocks = $this->getBlockedUsers($cuser['id']); \n\t if (in_array($options['user_block'], $user_blocks)) {\n\t $authorized = false;\n\t $msg = __('Access denied');\n\t $return_url = '';\n\t }\n \t}\n } else {\n // check login\n if (!$cuser) {\n $authorized = false;\n $msg = __('Please login or register');\n } else {\n // check role\n if (!empty($options['roles']) && !in_array($cuser['role_id'], $options['roles'])) {\n $authorized = false;\n $msg = __('Access denied');\n }\n\n // check admin\n if (!empty($options['admin']) && !$cuser['Role']['is_admin']) {\n $authorized = false;\n $msg = __('Access denied');\n }\n\n // check super admin\n if (!empty($options['super_admin']) && !$cuser['Role']['is_super']) {\n $authorized = false;\n $msg = __('Access denied');\n }\n\n\n // check approval\n if (Configure::read('core.approve_users') && !$cuser['approved']) {\n $authorized = false;\n $msg = __('Your account is pending approval.');\n }\n\n // check confirmation\n if (Configure::read('core.email_validation') && !empty($options['confirm']) && !$cuser['confirmed']) {\n $authorized = false;\n $msg = __('You have not confirmed your email address! Check your email (including junk folder) and click on the validation link to validate your email address');\n }\n\n // check owner\n if (!empty($options['admins']) && !in_array($cuser['id'],\n $options['admins']) && !$cuser['Role']['is_admin']\n ) {\n $authorized = false;\n $msg = __('Access denied');\n }\n \n //event check permission\n if ($authorized)\n {\n \t$msg = '';\n \t$cakeEvent = new CakeEvent('Controller.App.checkPermission', $this,array(\n \t\t\t'authorized' => &$authorized,\n \t\t\t'msg' => &$msg,\n \t\t\t'options' => $options\n \t));\n\t $this->getEventManager()->dispatch($cakeEvent);\n }\n }\n }\n\n if (!$authorized && empty($options['no_redirect'])) {\n if (empty($this->layout)) { \n $this->autoRender = false;\n echo $msg;\n } else {\n if ($this->request->is('ajax')) {\n $this->set(compact('msg'));\n if (!$check_aco)\n {\n echo $this->render('/Elements/error');\n }\n else\n {\n \techo $this->render('/Elements/error-role');\n }\n\n } else {\n \tif (!$check_aco)\n \t{\n if (!empty($msg)) {\n $this->Session->setFlash($msg, 'default', array('class' => 'error-message'));\n }\n\n $this->redirect('/pages/no-permission' . $return_url);\n }\n \telse\n \t{\n \t\t$this->redirect('/pages/no-permission-role' . $return_url);\n \t}\n }\n }\n exit;\n }\n }", "function admin()\n{\n return current_user_can('manage_options');\n}", "public function checkAccess()\n {\n // need to be modified for security\n }", "function checkTeamAccess() {\n global $nkAction;\n\n if ($nkAction['actionType'] == 'edit') {\n require_once 'Includes/nkForm.php';\n\n $dministratorList = nkForm_loadSelectOptions(array(\n 'optionsName' => array('User', 'administrator')\n ));\n\n if (! $dministratorList) {\n printNotification(__('NO_ADMIN'), 'error');\n return false;\n }\n\n $teamList = nkForm_loadSelectOptions(array(\n 'optionsName' => array('Team', 'team')\n ));\n\n if (! $teamList) {\n printNotification(__('NO_TEAM'), 'error');\n return false;\n }\n }\n\n return true;\n}", "public function has_access() { \n\n\t\tif (!Access::check('interface','25')) { \n\t\t\treturn false; \n\t\t} \n\t\tif ($this->user == $GLOBALS['user']->id) { \n\t\t\treturn true; \n\t\t} \n\t\telse {\n\t\t\treturn Access::check('interface','100'); \n\t\t} \t\n\n\t\treturn false; \n\n\t}", "function checkAccess () {\n if ($GLOBALS[\"pagedata\"][\"login\"] == 1) {\n if ($this->userid && $GLOBALS[\"user_show\"] == true) {\n return true;\n }\n else {\n return false;\n }\n }\n else {\n return true;\n }\n }", "function checkAccess () {\n if ($GLOBALS[\"pagedata\"][\"login\"] == 1) {\n if ($this->userid && $GLOBALS[\"user_show\"] == true) {\n return true;\n }\n else {\n return false;\n }\n }\n else {\n return true;\n }\n }", "public function adminControl()\n {\n $row = $this->currentUserData();\n if(isset($_SESSION['sess_user_type']) &&\n $_SESSION['sess_user_type'] == 'admin' && $row['user_type'] == 'admin'){\n return true;\n }\n }", "private function userHasAccess()\n {\n $required_perm = $this->route['perm'];\n $user_group = $_SESSION['user_group'];\n if ($required_perm == 'all') {\n return true;\n } elseif ($user_group == $required_perm) {\n return true;\n }\n return false;\n }", "public function check_access() {\n\n\t\tif (isset($this->current_entity_allowed)) {\n\t\t\treturn apply_filters('minerva_restrict_access_allowed', $this->current_entity_allowed);\n\t\t}\n\n\t\t$this->current_entity_allowed = MKB_Options::option('restrict_on') ?\n\t\t\t(bool) $this->check_entity_access($this->get_current_entity()) :\n\t\t\ttrue; // always allowed if restriction is off\n\n\t\treturn apply_filters('minerva_restrict_access_allowed', $this->current_entity_allowed);\n\t}", "protected function isPowerUser()\n {\n return $this->user->can('sys_properties_edit', $this->app->modules[$this->area]);\n }", "public function user_is_allowed()\n {\n //check if the record exist\n if (! $this->record) {\n $this->build_error('These record does not exist or it may not belong to you',404);\n }\n\n //check if the user is the owner of the entry\n if(!isOwner($this->record)) {\n $this->build_error('you are not the owner of this task');\n }\n\n //check if the incomming entries type is Array\n if (!is_array($this->request->entries)) {\n $this->build_error('Please the entries must be an Array');\n }\n }", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "public function checkAccess() {}", "function checkAccess() ;", "public function authorize()\n {\n $user = User::find($this->id);\n\n if (!$user) {\n $user = User::where('no_ahli', $this->no_ahli)->first();\n }\n if ($user && $user->id == auth()->user()->id) return true;\n if (auth()->user()->is('admin')) return true;\n\n return false;\n }", "public function check_insta_user() {\n \n }", "function check_user() {\n\treturn false; // update allowed\n\treturn true; //no update allowed\n}", "public function hasUsageRights() {}", "function storage_can_set($sv_user) {\n $allowed = ((api_is_platform_admin()) || ($sv_user == api_get_user_id()));\n if (!$allowed) {\n print \"ERROR : Not allowed\";\n }\n return $allowed;\n}", "protected function checkAccess() {\n\t\t$hasAccess = static::hasAccess();\n\n\t\tif (!$hasAccess) {\n\t\t\tilUtil::sendFailure($this->pl->txt(\"permission_denied\"), true);\n if (self::version()->is6()) {\n $this->ctrl->redirectByClass(ilDashboardGUI::class, 'jumpToSelectedItems');\n } else {\n\t\t\t$this->ctrl->redirectByClass(ilPersonalDesktopGUI::class, 'jumpToSelectedItems');\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.69238406", "0.6856634", "0.6856634", "0.68552583", "0.68281573", "0.6785348", "0.67772865", "0.6746185", "0.6704687", "0.6704687", "0.6680947", "0.6649449", "0.6633303", "0.6606926", "0.6598789", "0.657869", "0.657869", "0.657869", "0.6578102", "0.6578102", "0.6577317", "0.6577317", "0.6577317", "0.65513647", "0.65468985", "0.65468675", "0.65429336", "0.65292", "0.6519957", "0.6510665" ]
0.7292744
0
check and return this inputs from $_POST token [string] exma_id [int] corrects [JSON/array] wrongs [JSON/array] emptys [JSON/array]
private function check_finish_inputs() { $output = []; if (!isset($_POST["token"]) || !isset($_POST["exam_id"]) || !isset($_POST["corrects"]) || !isset($_POST["wrongs"]) || !isset($_POST["emptys"])) return false; if (empty($_POST["token"]) || empty($_POST["exam_id"]) || empty($_POST["corrects"]) || empty($_POST["wrongs"]) || empty($_POST["emptys"])) return false; $output = [ (string) "token" => $_POST["token"], (int) "exam_id" => $_POST["exma_id"], (array) "corrects" => json_decode($_POST["corrects"]), (array) "wrongs" => json_decode($_POST["wrongs"]), (array) "emptys" => json_decode($_POST["emptys"]), ]; return $output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function check_make_input()\n {\n $output = [];\n\n if (!isset($_POST['token']) || !isset($_POST['new_only']) || !isset($_POST['emptys']) || !isset($_POST['wrongs']) || !isset($_POST['answer_result']) || !isset($_POST['random']) || !isset($_POST['length']) || !isset($_POST['category']))\n return false;\n\n if (empty($_POST['token']) || empty($_POST['new_only']) || empty($_POST['emptys']) || empty($_POST['wrongs']) || empty($_POST['answer_result']) || empty($_POST['random']) || empty($_POST['length']))\n return false;\n\n $output = [\n \"token\" => (string) $_POST[\"token\"],\n \"new_only\" => (bool) $_POST[\"new_only\"],\n \"emptys\" => (bool) $_POST[\"emptys\"],\n \"wrongs\" => (bool) $_POST[\"wrongs\"],\n \"answer_result\" => (bool) $_POST[\"answer_result\"],\n \"random\" => (bool) $_POST[\"random\"],\n \"length\" => (int) $_POST[\"length\"],\n \"category\" => (array) json_decode($_POST[\"category\"]),\n ];\n return $output;\n }", "function check_extract($POST_param_name, $success_variable_name, $function_name) {\n\t\tif (empty($_POST[\"$POST_param_name\"])) {\n\t\t\t$return_arr = array(\n\t\t\t\t'success' => '0',\n\t\t\t\t'fail_reason' => \"'$POST_param_name' field is required\");\n\t\t\techo json_encode($return_arr);\n\t\t\tdie();\t\t\n\t\t} else {\n\t\t\t$GLOBALS[\"$success_variable_name\"] = test_input($_POST[\"$POST_param_name\"]);\n\t\t}\n\t}", "function check_extract($POST_param_name, $success_variable_name, $function_name) {\n\t\tif (empty($_POST[\"$POST_param_name\"])) {\n\t\t\t$return_arr = array(\n\t\t\t\t'success' => '0',\n\t\t\t\t'fail_reason' => \"'$POST_param_name' field is required\");\n\t\t\techo json_encode($return_arr);\n\t\t\tdie();\t\t\n\t\t} else {\n\t\t\t$GLOBALS[\"$success_variable_name\"] = test_input($_POST[\"$POST_param_name\"]);\n\t\t}\n\t}", "function check_extract($POST_param_name, $success_variable_name, $function_name) {\n\t\tif (empty($_POST[\"$POST_param_name\"])) {\n\t\t\t$return_arr = array(\n\t\t\t\t'success' => '0',\n\t\t\t\t'fail_reason' => \"'$POST_param_name' field is required\");\n\t\t\techo json_encode($return_arr);\n\t\t\tdie();\t\t\n\t\t} else {\n\t\t\t$GLOBALS[\"$success_variable_name\"] = test_input($_POST[\"$POST_param_name\"]);\n\t\t}\n\t}", "private function validarPUT(){\n parse_str(file_get_contents(\"php://input\"),$post_vars);\n $IO = ValidacaoIO::getInstance();\n $es = array();\n $ps = array();\n \n # Criando variáveis dinamicamente, e removendo possiveis tags HTML, espaços em branco e valores nulos:\n foreach ($post_vars as $atributo => $valor){\n \t $ps[$atributo] = trim(strip_tags($valor));\n \t$es = $IO->validarConsisten($es, $valor);\n }\n \n # Verificando a quantidade de parametros enviados:\n $es = $IO->validarQuantParam($es, $ps, 5);\n \n # Validar status fornecido:\n $es = $IO->validarStatusAnuncio($es, $ps['status']);\n \n # Validar codigo de anuncio fornecido:\n $prestadorBPO = unserialize($_SESSION['objetoUsuario']);\n // $es = $IO->validarAnuncio($es, $ps['codigoAnuncio']);\n \n $es = $IO->validarDonoAnuncio($es, $prestadorBPO->getCodigoUsuario(), $ps['codigoAnuncio']);\n \n # Se existir algum erro, mostra o erro\n $es ? $IO->retornar400($es) : $this->retornar200($ps);\n }", "function test_input() :array\n{\n if (count($_POST) > 0) {\n {\n if (isset($_POST['id'])){\n $winner['id'] = $_POST['id'];\n }\n $winner['prize_year'] = validate_input($_POST['prize_year']);\n $winner['author_name'] = validate_input($_POST['author_name']);\n $winner['book_name'] = validate_input($_POST['book_name']);\n $winner['author_nationality'] = validate_input($_POST['author_nationality']);\n return $winner;\n }\n } return [];\n}", "function validateInterkassaResp($post_in)\n{\n\t$key_to_sort = $post_in;\n\t$ik_co_id = $key_to_sort['ik_co_id'];\n\t$ik_sign = $key_to_sort['ik_sign'];\n\t$ik_am = $key_to_sort['ik_am'];\n\t$ik_inv_st = $key_to_sort['ik_inv_st'];\n\n\t// Forming a digital signature\n\tunset($key_to_sort['ik_sign']);\n\tksort($key_to_sort, SORT_STRING);\n\n\t// Add to the array \"secret key\"\n\tarray_push($key_to_sort, 'XRZxzNbDsQYzsWm2');\n\n\t// Concatenate values ​​by a \":\"\n\t$signString = implode(':', $key_to_sort);\n\n\t// Take the MD5 hash in binary form by\n\t$sign = base64_encode(md5($signString, true));\n\n\t// Validate kassa results\n\tif(\n\t\t$ik_co_id == '5370b755bf4efccb31ad6f90' AND \n\t\t$ik_inv_st == 'success' AND \n\t\t$ik_sign == $sign\n\t)\n\t{\n\t\treturn $ik_am;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "private function _validate()\n {\n $data = array();\n $data['error_string'] = array();\n $data['inputerror'] = array();\n $data['status'] = TRUE;\n\n //merubah form yang di post menjadi array asosiatif\n $jumlahField = array(\n 'nomor_part' => $this->input->post('nomor_part'),\n 'nama_part' => $this->input->post('nama_part'),\n 'qty' => $this->input->post('qty'),\n 'harga_jual' => $this->input->post('harga_jual'),\n 'harga_beli' => $this->input->post('harga_beli'),\n );\n\n //menguraikan array jumlahField\n foreach ($jumlahField as $key => $value):\n if ($value == \"\")://kondisi untuk mengecek jika value atau inputan ada yang kosong\n $data['inputerror'][] = $key;\n $data['error_string'][] = str_replace(\"_\", \" \", $key).' tidak boleh kosong';\n $data['status'] = FALSE;\n endif;\n endforeach;\n\n if($data['status'] === FALSE):\n echo json_encode($data);\n exit();\n endif;\n }", "public function checkData() {\n\t\t// e.g. numbers must only have digits, e-mail addresses must have a \"@\" and a \".\".\n\t\treturn $this->control->checkPOST($this);\n\t}", "public function checkData() {\n\t\t// e.g. numbers must only have digits, e-mail addresses must have a \"@\" and a \".\".\n\t\treturn $this->control->checkPOST($this);\n\t}", "function _pre_token_validation($input) {\n\n if (ENV !== 'dev') {\n //add your own validation code here!\n echo 'Forbidden (no validation tests available)';\n http_response_code(403);\n die();\n }\n\n if (!isset($input['user_id'])) {\n http_response_code(400);\n echo 'No user_id submitted!';\n die();\n } elseif(!is_numeric($input['user_id'])) {\n http_response_code(400);\n echo 'Non-numeric user_id submitted!';\n die();\n }\n\n return $input;\n }", "private function checkData() {\n if(!isset(\n $_POST['code'],\n $_POST['field']\n )) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong request'\n ));\n exit;\n }\n\n if($_POST['field']==='email') {\n $field = 'email';\n }\n elseif($_POST['field']==='phone') {\n $field = 'cellphone';\n }\n else {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong field'\n ));\n exit;\n }\n\n $code=trim($_POST['code']);\n\n $user_id=$this->uSes->get_val('user_id');\n if (isset(\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['code'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field][$field]\n )) {\n if($field==='cellphone'&&!(int)$this->uFunc->getConf('use MAD SMS to send SMS','content',false)) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'sms send is not supported'\n ));\n exit;\n }\n\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp']<(time()-300)) {//5min\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'code is expired'\n ));\n exit;\n }\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['code']!==$code) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong code'\n ));\n exit;\n }\n\n $password=$_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'];\n\n $value=$_SESSION['uAuth']['profile_update_bg']['change'.$field][$field];\n\n $this->updateEmailOrPhone($user_id,$field,$value,$password);\n\n unset($_SESSION['uAuth']['profile_update_bg']['change'.$field]);\n\n return $value;\n }\n\n print json_encode([\n 'status'=>'error',\n 'msg'=>'code is expired'\n ]);\n exit;\n }", "function validar_vale() {\n $validaciones = [];\n\n // Reviso si el GET tiene algo\n if(!empty($_GET)){\n if(empty($_GET['turno'])){\n $validaciones['turno'] = 'El campo turno es requerido';\n }\n\n if(empty($_GET['idsupervisor'])){\n $validaciones['idsupervisor'] = 'El campo idsupervisor es requerido' ;\n }\n\n if(empty($_GET['supervisor'])){\n $validaciones['supervisor'] = 'El campo supervisor es requerido' ;\n }\n\n if (count($_GET['detalle']) === 0){\n $validaciones['detalle'] = 'debe Llenar los Campos Necesarios para Continuar' ;\n }else{\n foreach($_GET['detalle'] as $item){\n foreach($item as $key => $value){\n //echo $key; // Nombre de la variable(nom, des, rut, etc)\n //echo $value; // Su valor\n if(empty ($value)){\n $validaciones['detalle'] = $key.' Tiene un Valor vacio,debe Llenar los Campos Necesarios para Continuar' ;\n break 2;\n }\n }\n }\n }\n\n if (isset($_GET['detallecomprado'])){\n if (count($_GET['detallecomprado']) === 0 && trim ($_GET['tipo']) === \"COMPRADO\" ){\n $validaciones['detallecomprado'] = 'debe Selecionar al Menos una Entrada' ;\n }\n }\n\n if (count($validaciones) === 0){\n $validaciones['id_vale'] = guardar_vale() ;\n }else{\n $validaciones['id_vale'] = 0 ;\n\n }\n\n //header('Content-Type: application/json');\n echo json_encode([\n 'response' => count($validaciones) === 0,\n 'errors' => $validaciones\n ],JSON_UNESCAPED_UNICODE);\n\n }\n}", "public function validarLotesxEstado(){\n log_message('INFO','#TRAZA | #TRAZ-PROD-TRAZASOFT | Etapa | validarLotesxEstado() ');\n $etap_id=$this->input->post('etap_id');\n\t\t$aux= $this->Etapas->validarLotesxEstado($etap_id)->lotes->lote;\n if(!empty($aux)){\n $i=0;\n while(($aux[$i]->estado !== 'finalizado') && $i < count($aux)){\n $i++;\n }\n if($i <= count($aux)){\n echo json_encode(array(\"status\" => false,\"msj\" => \"Error, la etapa tiene Lotes asociado\"));\n }else{\n $aux['status'] = true;\n echo json_encode($aux);\n }\n }else{\n echo json_encode(array(\"status\" => true,\"msj\" => \"Se elimino la etapa que no posee lotes\"));\n }\n }", "private function validateData ($data){\n if(isset($data[\"nombres\"]) && !preg_match('/^[a-zA-ZáéíóúÁÉÍÓÚñÑ ]+$/',$data[\"nombres\"])){\n $json = array(\"status\"=>404, \"detalles\"=>\"Error, no se permiten numeros en el nombre del usuario\");\n print json_encode($json, true);\n return false;\n }\n if(isset($data[\"apellidos\"]) && !preg_match('/^[a-zA-ZáéíóúÁÉÍÓÚñÑ ]+$/',$data[\"apellidos\"])){\n $json = array(\"status\"=>404, \"detalles\"=>\"Error, no se permiten numeros en el apellido del usuario\");\n print json_encode($json, true);\n return false;\n }\n if(isset($data[\"email\"]) && !preg_match('/^(([^<>()\\[\\]\\\\.,;:\\s@”]+(\\.[^<>()\\[\\]\\\\.,;:\\s@”]+)*)|(“.+”))@((\\[[0–9]{1,3}\\.[0–9]{1,3}\\.[0–9]{1,3}\\.[0–9]{1,3}])|(([a-zA-Z\\-0–9]+\\.)+[a-zA-Z]{2,}))$/',$data[\"email\"])){\n $json = array(\"status\"=>404, \"detalles\"=>\"Error, el email no es valido\");\n print json_encode($json, true);\n return false;\n \n }\n if(isset($data[\"email\"])){\n $conn = clientesModels::validateEmail('clientes',$data[\"email\"]);\n if($conn != 0){\n $json = array(\"status\"=>404, \"detalles\"=>\"Error, El email {$data[\"email\"]} ya esta registrado\");\n print json_encode($json, true);\n return false;\n }\n }\n \n \n return true;\n }", "public function getPostValues()\n {\n // Define the check for params\n $post_check_array = array(\n // submit action\n 'toevoegen' => array('filter' => FILTER_SANITIZE_STRING),\n 'bijwerken' => array('filter' => FILTER_SANITIZE_STRING),\n 'verwijderen' => array('filter' => FILTER_SANITIZE_STRING),\n // question\n 'vraag' => array('filter' => FILTER_SANITIZE_STRING),\n // question type (open or closed)\n 'vraagId' => array('filter' => FILTER_SANITIZE_INT),\n // question type (open or closed)\n 'vraagSoort' => array('filter' => FILTER_SANITIZE_STRING),\n // Education\n 'opleiding' => array('filter' => FILTER_SANITIZE_STRING),\n // question send time\n 'verstuurTijd' => array('filter' => FILTER_SANITIZE_STRING)\n );\n // Get filtered input:\n $inputs = filter_input_array(INPUT_POST, $post_check_array);\n // RTS\n return $inputs;\n }", "public function anecdota_post(){\n if (json_decode(file_get_contents('php://input'), true)) {\n $data = json_decode(file_get_contents('php://input'), true);\n } else {\n $data = $this->post();\n }\n $token = $data['token'];\n ///// fin de recibiendo datos post\n\n $perfil = $this->User_model->revisa_perfil_x_token($token);\n\n if (!$perfil) {\n $respuesta = array(\n 'error' => TRUE,\n 'mensaje' => 'No ha realizado un ingreso de sesión!!!',\n 'data' => null\n );\n\n $this->response($respuesta, REST_Controller::HTTP_UNAUTHORIZED);\n } else {\n\n $insertar = $this->Anecdota_model->insertar($data);\n \n\n if ($insertar == false) {\n $respuesta = array(\n 'error' => true,\n 'mensaje' => 'La anécdota no se insertó, comuníquese con el Administrador!!!',\n 'data' => null\n );\n } else {\n $respuesta = array(\n 'error' => false,\n 'mensaje' => 'Anécdota ingresada correctamente!!!',\n 'data' => null\n );\n }\n\n $this->response($respuesta);\n }\n }", "private function validateInput(){\n $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);\n $ip = filter_var($_POST['ip'], FILTER_VALIDATE_IP);\n $subnet = filter_var($_POST['subnet'], FILTER_VALIDATE_IP);\n $mac = filter_var($_POST['mac'], FILTER_VALIDATE_MAC);\n if($name && $ip && $subnet && $mac){\n return [\n 'name' => $name,\n 'ip' => $ip,\n 'subnet' => $subnet,\n 'mac' => $mac\n ];\n }else{\n return false;\n }\n }", "public function make_exam()\n {\n $inputs = $this->check_make_input();\n // return json_encode($inputs);\n if (!is_array($inputs) || !$inputs) {\n $output[\"ok\"] = false;\n $output[\"message\"] = \"inputs faild\";\n return json_encode($output);\n }\n\n $user_id = $this->un_token($_POST[\"token\"]);\n if (!$user_id) {\n $output[\"ok\"] = false;\n $output[\"message\"] = \"User undefined\";\n return json_encode($output);\n }\n\n if (!$this->check_access_to_option($inputs, (int) $user_id)) {\n $output[\"ok\"] = false;\n $output[\"message\"] = \"access denied\";\n return json_encode($output);\n }\n\n $exam_generated = $this->exam_generator->new_exam($user_id, $inputs);\n return $exam_generated;\n if (!$exam_generated)\n\n $output[\"ok\"] = true;\n $output[\"message\"] = \"ok\";\n $output[\"exam\"] = $exam_generated;\n\n // return \"HH\";\n return json_encode($output);\n }", "public function getPostValues() {\n $post_check_array = array(\n// submit action\n 'add' => array('filter' => FILTER_SANITIZE_STRING),\n 'update' => array('filter' => FILTER_SANITIZE_STRING),\n // List all update form fields !!!\n// event type name.\n 'datum' => array('filter' => FILTER_SANITIZE_STRING),\n 'prioriteit' => array('filter' => FILTER_SANITIZE_STRING),\n 'username' => array('filter' => FILTER_SANITIZE_STRING),\n 'user' => array('filter' => FILTER_SANITIZE_STRING),\n 'password' => array('filter' => FILTER_SANITIZE_STRING),\n // Help text\n 'status' => array('filter' => FILTER_SANITIZE_STRING),\n // Id of current row\n 'alarm_id' => array('filter' => FILTER_VALIDATE_INT),\n 'alarm_noticed' => array('filter' => FILTER_VALIDATE_INT),\n\t\t\t'alarm_origin' => array('filter' => FILTER_SANITIZE_STRING)\n );\n// Get filtered input:\n $inputs = filter_input_array(INPUT_POST, $post_check_array);\n// RTS\n return $inputs;\n }", "public function checkThreeItemForm()\n {\n $data = ipRequest()->getPost();\n $form = $this->threeItemManagementForm();\n $data = $form->filterValues($data); //filter post data to remove any non form specific items\n $errors = $form->validate($data); //http://www.impresspages.org/docs/form-validation-in-php-3\n if ($errors) {\n //error\n $data = array(\n 'status' => 'error',\n 'errors' => $errors\n );\n } else {\n //success\n unset($data['aa']);\n unset($data['securityToken']);\n unset($data['antispam']);\n $data = array(\n 'status' => 'ok',\n 'data' => $data\n\n );\n }\n return new \\Ip\\Response\\Json($data);\n }", "private function validPayload()\n {\n return [\n 'name' => 'Chefaa pharmacy',\n 'address' => 'Maadi',\n ];\n }", "private function __parse_intput() {\n $requests = JsonParser::decode($this->__raw_input);\n if (is_array($requests) === false or\n empty($requests[0])) {\n $requests = array($requests);\n }\n return ($requests);\n }", "function validateData($data) {\n $data = json_decode($data);\n $typesArr = [1, 2];\n\n if (!in_array((int)$data->type, $typesArr)) {\n return false;\n } else {\n $data->type = (int)$data->type;\n }\n\n if (empty($data->feedback)) {\n return false;\n }\n\n if ($data->type == 2 && !filter_var($data->url, FILTER_VALIDATE_URL)) {\n return false;\n }\n\n if (empty($data->name)) {\n $data->name = \"anonymous\";\n }\n\n if (empty($data->email)) {\n $data->email = \"anonymous\";\n }\n\n return $data;\n }", "function readinput()\n\t{\n\t\t$temanbaru = [\n\t\t\t\"noteman\"\t=> $this->input->post(\"noteman\"),\n\t\t\t\"namateman\"\t=> $this->input->post(\"namateman\"),\n\t\t\t\"notelp\"\t=> $this->input->post(\"notelp\"),\n\t\t\t\"email\"\t\t=> $this->input->post(\"email\")\n\t\t];\n\n\t\treturn $temanbaru;\n\t}", "public function data() {\n $request = $this->requestReader->getContents();\n\t\tif ($request) {\n if ($json_post = CJSON::decode($request)){\n\t\t\t\treturn $json_post;\n\t\t\t}else{\n\t\t\t\tparse_str($request,$variables);\n\t\t\t\treturn $variables;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private function validate_input()\n \t{\n \t\t$this->errors_found = FALSE;\t\t\t\t\n\n\t\t// validate the get request\n\t\t//is their an IVR code?\n\t\tif(! isset($_GET['ivrcode'])){\n\t\t\t$this->response['status'] = 'Error';\n\t\t\t$this->response['message'][] = 'Missing ivrcode';\n\t\t\t$this->errors_found = TRUE;\n\t\t}elseif(! is_numeric($_GET['ivrcode'])){\n\t\t\t$this->response['status'] = 'Error';\n\t\t\t$this->response['message'][] = 'Invalid value for ivrcode - should be numeric';\n\t\t\t$this->errors_found = TRUE;\n\t\t}else{\n\t\t\t$this->form_answers['ivrcode'] = $_GET['ivrcode'];\n\t\t}\n\n\t\t//is there a phone number\n\t\tif(! isset($_GET['phonenumber'])){\n\t\t\t$this->response['status'] = 'Error';\n\t\t\t$this->response['message'][] = 'Missing phonenumber';\n\t\t\t$this->errors_found = TRUE;\n\t\t}elseif(! is_numeric($_GET['phonenumber'])){\n\t\t\t$this->response['status'] = 'Error';\n\t\t\t$this->response['message'][] = 'Invalid value for phonenumber - should be numeric';\n\t\t\t$this->errors_found = TRUE;\n\t\t}else{\n\t\t\t$this->form_answers['phonenumber'] = $_GET['phonenumber'];\n\t\t}\n\t\t\n\t\t//is there a well working?\n\t\tif(!isset($_GET['wellwork'])){\n\t\t\t$this->response['status'] = 'Error';\n\t\t\t$this->response['message'][] = 'Missing wellwork';\n\t\t\t$this->errors_found = TRUE;\n\t\t}else\n\t\t{\n\t\t\t$_GET['wellwork'] = strtolower($_GET['wellwork']);\n\t\t\t\n\t\t\tif($_GET['wellwork'] != 'yes' && $_GET['wellwork'] != 'no')\n\t\t\t{\n\t\t\t\t$this->response['status'] = 'Error';\n\t\t\t\t$this->response['message'][] = 'Invalid value for wellwork - should be Yes or No';\n\t\t\t\t$this->errors_found = TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->form_answers['wellwork'] = $_GET['wellwork'];\n\t\t\t}\n\t\t}\n\t\t\n\n\t\t//is there a does the mechanic know?\n\t\tif(isset($_GET['mechanicknow']))\n\t\t{\n\t\t\t$_GET['mechanicknow'] = strtolower($_GET['mechanicknow']);\n\t\t\tif($_GET['mechanicknow'] != 'yes' && $_GET['mechanicknow'] != 'no'){\n\t\t\t\t$this->response['status'] = 'Error';\n\t\t\t\t$this->response['message'][] = 'Invalid value for mechanicknow - should be Yes or No';\n\t\t\t\t$this->errors_found = TRUE;\n\t\t\t}else{\n\t\t\t\t$this->form_answers['mechanicknow'] = $_GET['mechanicknow'];\n\t\t\t}\n\t\t}\n\n\t\t\t\n\t\t//is there a can the mechanic fix\n\t\tif(isset($_GET['mechanicfix']))\n\t\t{\n\t\t\t$_GET['mechanicfix'] = strtolower($_GET['mechanicfix']);\n\t\t\tif($_GET['mechanicfix'] != 'yes' && $_GET['mechanicfix'] != 'no'){\n\t\t\t\t$this->response['status'] = 'Error';\n\t\t\t\t$this->response['message'][] = 'Invalid value for mechanicfix - should be Yes or No';\n\t\t\t\t$this->errors_found = TRUE;\n\t\t\t}else{\n\t\t\t\t$this->form_answers['mechanicfix'] = $_GET['mechanicfix'];\n\t\t\t}\n\t\t}\n\t\t//is there a file name\n\t\tif(isset($_GET['filename'])){\n\t\t\t$get = new Validation($_GET);\n\t\t\t$get->add_rules('filename','standard_text');\n\t\t\tif(! $get->validate()){\n\t\t\t\t$this->response['status'] = 'Error';\n\t\t\t\t$this->response['message'][] = 'Invalid value for filename - should be standard text';\n\t\t\t\t$this->errors_found = TRUE;\n\t\t\t}else{\n\t\t\t\t$this->form_answers['filename'] = $_GET['filename'];\n\t\t\t}\n\t\t}\n\t\t\n\t\t//is there a response format \n\t\tif(isset($_GET['resp'])){\n\t\t\tif($_GET['resp'] != 'json' && $_GET['resp'] != 'xml'){\n\t\t\t\t$this->response['status'] = 'Error';\n\t\t\t\t$this->response['message'][] = 'Invalid value for resp - should be json or xml';\n\t\t\t\t$this->errors_found = TRUE;\n\t\t\t}else{\n\t\t\t\t$this->resp = $_GET['resp'];\n\t\t\t}\n\t\t}else{\n\t\t\t$this->resp = 'json';\n\t\t}\n\n\t\t//if there are errors, let them know.\n\t\tif($this->errors_found){\n\t\t\t$this->send_response($this->response, $this->resp);\n\t\t\treturn;\n\t\t}\t\t\n \t}", "public function submission()\n {\n $title_field_id = 10;\n $content_short_field_id = 8;\n $content_long_field_id = 17;\n $auto_activate = 1;\n \n $this->load->model('language_m');\n $this->load->model('estate_m');\n $this->load->model('option_m');\n $this->load->model('file_m');\n $this->load->model('repository_m');\n \n $this->data['message'] = lang_check('Something is wrong with request');\n $this->data['success'] = FALSE;\n $this->data['token_available'] = FALSE;\n $POST = $this->input->get_post(NULL, TRUE);\n\n $POST = array_merge($_GET, $_POST);\n\n if(isset($POST['lang_code']))\n {\n $lang_id_selected = $this->language_m->get_id($POST['lang_code']);\n }\n \n $lang_id_def = $this->language_m->get_default_id();\n $lang_code_def = $this->language_m->get_code($lang_id_def);\n \n $token = $this->token_m->get_token($POST);\n \n if(is_object($token))\n $this->data['token_available'] = TRUE;\n \n //var_dump($POST);\n \n if(config_db_item('property_subm_disabled')==TRUE)\n {\n $this->data['message'] = lang_check('Registration disabled on server');\n }\n else if(isset($POST['lang_code']) && $lang_id_selected != $lang_id_def)\n {\n $this->data['message'] = lang_check('Only default lang is supported');\n }\n else if(is_object($token) && isset($POST['lang_code']) && isset($POST['input_address'], \n $POST['input_title'],\n $POST['input_description'],\n $POST['input_4']))\n {\n\n $existing_fields = $this->option_m->get_field_list($lang_id_def);\n\n // check if fields exists\n foreach($POST as $key=>$val)\n {\n $exp = explode('_', $key);\n \n if(count($exp) == 2 && $exp[0]=='input' && is_numeric($exp[1]))\n {\n if(!isset($existing_fields[$exp[1]]))\n { \n unset($POST['input_'.$exp[1]]);\n\n $this->data['message'] = lang_check('Field not found: #').$exp[1];\n echo json_encode($this->data);\n exit();\n }\n }\n }\n \n if(isset($POST['property_id']))\n {\n \n if(empty($POST['input_description']) || empty($POST['input_title']))\n {\n $this->data['message'] = lang_check('Please populate all fields!');\n echo json_encode($this->data);\n exit();\n }\n\n $this->load->library('session');\n\n // check permission for edit\n if($this->estate_m->check_user_permission($POST['property_id'], $token->user_id)>0)\n {\n\n // edit\n $data = array();\n $data['date'] = date('Y-m-d H:i:s');\n $data['date_modified'] = date('Y-m-d H:i:s');\n $data['address'] = $POST['input_address'];\n $data['search_values'] = $data['address'];\n \n // fetch gps\n $this->load->library('ghelper');\n $coor = $this->ghelper->getCoordinates($data['address']);\n $data['gps'] = $coor['lat'].', '.$coor['lng'];\n \n // other dynamic data\n $dynamic_data = array();\n $dynamic_data['agent'] = $token->user_id;\n \n // get title\n $dynamic_data[\"option\".$title_field_id.\"_\".$lang_id_def] = $POST['input_title'];\n \n // get description\n $dynamic_data[\"option\".$content_short_field_id.\"_\".$lang_id_def] = $POST['input_description'];\n $dynamic_data[\"option\".$content_long_field_id.\"_\".$lang_id_def] = $POST['input_description'];\n \n // prepare other fields\n foreach($POST as $key=>$val)\n {\n $exp = explode('_', $key);\n \n if(sw_count($exp) == 2 && $exp[0]=='input' && is_numeric($exp[1]))\n {\n $dynamic_data[\"option\".$exp[1].\"_\".$lang_id_def] = $POST['input_'.$exp[1]];\n }\n }\n \n // save basic data\n $insert_id = $this->estate_m->save($data, $POST['property_id']);\n \n if(empty($insert_id))\n {\n echo 'EMPTY insert_id:<br />';\n echo $this->db->last_query();\n exit();\n }\n \n $this->config->set_item('multilang_on_qs', 0);\n \n $this->estate_m->save_dynamic($dynamic_data, $insert_id);\n \n // echo $this->db->last_query();\n \n if(!empty($insert_id))\n {\n $this->uploadfiles($insert_id);\n \n $this->data['message'] = lang_check('Listing saved');\n $this->data['success'] = TRUE;\n }\n else\n {\n $this->data['message'] = lang_check('Edit declined');\n }\n }\n\n }\n else\n {\n // add\n \n if(empty($POST['input_description']) || empty($POST['input_title']))\n {\n $this->data['message'] = lang_check('Please populate all fields!');\n echo json_encode($this->data);\n exit();\n }\n\n $data = array();\n $data['is_activated'] = $auto_activate;\n $data['date'] = date('Y-m-d H:i:s');\n $data['date_modified'] = date('Y-m-d H:i:s');\n $data['address'] = $POST['input_address'];\n $data['search_values'] = $data['address'];\n \n if($data['is_activated'])\n $data['date_activated'] = date('Y-m-d H:i:s');\n \n // fetch gps\n $this->load->library('ghelper');\n $coor = $this->ghelper->getCoordinates($data['address']);\n $data['gps'] = $coor['lat'].', '.$coor['lng'];\n \n // other dynamic data\n $dynamic_data = array();\n $dynamic_data['agent'] = $token->user_id;\n \n // get title\n $dynamic_data[\"option\".$title_field_id.\"_\".$lang_id_def] = $POST['input_title'];\n \n // get description\n $dynamic_data[\"option\".$content_short_field_id.\"_\".$lang_id_def] = $POST['input_description'];\n $dynamic_data[\"option\".$content_long_field_id.\"_\".$lang_id_def] = $POST['input_description'];\n \n // prepare other fields\n foreach($POST as $key=>$val)\n {\n $exp = explode('_', $key);\n \n if(sw_count($exp) == 2 && $exp[0]=='input' && is_numeric($exp[1]))\n {\n $dynamic_data[\"option\".$exp[1].\"_\".$lang_id_def] = $POST['input_'.$exp[1]];\n }\n }\n\n // save basic data\n $insert_id = $this->estate_m->save($data, NULL);\n \n if(empty($insert_id))\n {\n echo 'EMPTY insert_id:<br />';\n echo $this->db->last_query();\n exit();\n }\n \n $this->config->set_item('multilang_on_qs', 0);\n \n $this->estate_m->save_dynamic($dynamic_data, $insert_id);\n \n // echo $this->db->last_query();\n \n if(!empty($insert_id))\n {\n $this->uploadfiles($insert_id);\n \n $this->data['message'] = lang_check('Listing added');\n $this->data['success'] = TRUE;\n }\n else\n {\n $this->data['message'] = lang_check('Added declined');\n }\n }\n } \n \n echo json_encode($this->data);\n exit();\n }", "private function _validasi_anggota()\n\t{\n\t\t$data = array();\n\t\t$data['inputerror'] = array();\n\t\t$data['error'] = array();\n\t\t$data['status'] = true;\n\n\t\tif (input('noloan') == '') {\n\t\t\t$data['inputerror'][] = 'noloan';\n\t\t\t$data['error'][] = 'No kontrak harus diisi';\n\t\t\t$data['status'] = false;\n\t\t} else if (substr(strtoupper(input('noloan')), 0, 2) == 'LD') {\n\t\t\tif (strlen(input('noloan')) != 12) {\n\t\t\t\t$data['inputerror'][] = 'noloan';\n\t\t\t\t$data['error'][] = 'No kontrak tidak valid';\n\t\t\t\t$data['status'] = false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (strlen(input('noloan')) != 10) {\n\t\t\t\t$data['inputerror'][] = 'noloan';\n\t\t\t\t$data['error'][] = 'No kontrak tidak valid';\n\t\t\t\t$data['status'] = false;\n\t\t\t}\n\t\t}\n\n\t\tif (input('no_cif') == '') {\n\t\t\t$data['inputerror'][] = 'no_cif';\n\t\t\t$data['error'][] = 'No CIF harus diisi';\n\t\t\t$data['status'] = false;\n\t\t} else if (strlen(input('no_cif')) < 8) {\n\t\t\t$data['inputerror'][] = 'no_cif';\n\t\t\t$data['error'][] = 'No CIF tidak valid';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif (input('nm_anggota') == '') {\n\t\t\t$data['inputerror'][] = 'nm_anggota';\n\t\t\t$data['error'][] = 'Nama anggota harus diisi';\n\t\t\t$data['status'] = false;\n\t\t} else if (!preg_match('/^[a-zA-Z ]+$/', input('nm_anggota'))) {\n\t\t\t$data['inputerror'][] = 'nm_anggota';\n\t\t\t$data['error'][] = 'Nama anggota tidak valid';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif (input('tgl_cair') == '') {\n\t\t\t$data['inputerror'][] = 'tgl_cair';\n\t\t\t$data['error'][] = 'Tgl pencairan harus diisi';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif (input('tgl_ospokok') == '') {\n\t\t\t$data['inputerror'][] = 'tgl_ospokok';\n\t\t\t$data['error'][] = 'Tgl outstanding harus diisi';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif (input('tenor') == '') {\n\t\t\t$data['inputerror'][] = 'tenor';\n\t\t\t$data['error'][] = 'Tenor harus diisi';\n\t\t\t$data['status'] = false;\n\t\t} else if (!preg_match('/^[0-9]+$/', input('tenor'))) {\n\t\t\t$data['inputerror'][] = 'tenor';\n\t\t\t$data['error'][] = 'Tenor tidak valid';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif (input('nom_plafond') == '') {\n\t\t\t$data['inputerror'][] = 'nom_plafond';\n\t\t\t$data['error'][] = 'Plafond pencairan harus diisi';\n\t\t\t$data['status'] = false;\n\t\t} else if (!preg_match('/^[0-9,.]+$/', str_replace(',', '', input('nom_plafond')))) {\n\t\t\t$data['inputerror'][] = 'nom_plafond';\n\t\t\t$data['error'][] = 'Plafond pencairan tidak valid';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif (input('os_pokok') == '') {\n\t\t\t$data['inputerror'][] = 'os_pokok';\n\t\t\t$data['error'][] = 'Outstanding harus diisi';\n\t\t\t$data['status'] = false;\n\t\t} else if (!preg_match('/^[0-9,.]+$/', str_replace(',', '', input('os_pokok')))) {\n\t\t\t$data['inputerror'][] = 'os_pokok';\n\t\t\t$data['error'][] = 'Outstanding tidak valid';\n\t\t\t$data['status'] = false;\n\t\t}\n\n\t\tif ($data['status'] === false) {\n\t\t\techo json_encode($data);\n\t\t\texit();\n\t\t}\n\t}", "public function validateToken($data)\n\t{\n\t\t$response = [];\n\t\t$result = [];\n\t\ttry {\n\t\t\t$sql = \"SELECT u.id,u.usuario,u.nombre,u.id_centro,u.estatus,u.tipo,e.cve_edo \n\t\t\t\t\tFROM usuarios u \n\t\t\t\t\tINNER JOIN estados e ON e.id_centro = u.id_centro \n<<<<<<< HEAD\n\t\t\t\t\tWHERE u.id = ?\";\n\t\t\t//$query = $this->executeStmt($this->connectionToSiniiga(),$sql,[$data['idUsuario']]);\n\t\t\t$query = $this->executeStmt($this->connectionToSiniiga(),$sql,[2153]);\n=======\n\t\t\t\t\tWHERE u.id = ? AND e.cve_edo = 21\";\n\t\t\t$query = $this->executeStmt($this->connectionToSiniiga(),$sql,[$data['idUsuario']]);\n\t\t\t//$query = $this->executeStmt($this->connectionToSiniiga(),$sql,[2153]);\n>>>>>>> development\n\t\t\tif ($query) {\n\t\t\t\t$row = $query->fetch(PDO::FETCH_ASSOC);\n\t\t\t\tif (!empty( $row )) {\n\t\t\t\t\tif ($row['estatus'] == 1) {\n\t\t\t\t\t\t$result['usuario'] = [\n\t\t\t\t\t\t\t\"id\" => $row['id'],\n\t\t\t\t\t\t\t\"user\" => $row['usuario'],\n\t\t\t\t\t\t\t\"name\" => $row['nombre'],\n\t\t\t\t\t\t\t\"id_centro\" => $row['id_centro'],\n\t\t\t\t\t\t\t\"estatus\" => $row['estatus'],\n\t\t\t\t\t\t\t\"tipo\" => $row['tipo'],\n<<<<<<< HEAD\n\t\t\t\t\t\t\t//\"cveEdo\" => $row['cve_edo'],\n\t\t\t\t\t\t\t\"cveEdo\" => '21'\n=======\n\t\t\t\t\t\t\t\"cveEdo\" => $row['cve_edo'],\n\t\t\t\t\t\t\t//\"cveEdo\" => '21'\n>>>>>>> development\n\t\t\t\t\t\t];\n\t\t\t\t\t/*$sql = \"SELECT api_key \n\t\t\t\t\t\t\t\tFROM usuarios_ganadera \n\t\t\t\t\t\t\t\tWHERE id_usuario = ?\";\n\t\t\t\t\t\t$query = $this->executeStmt($this->connectionToReemo($row['cve_edo']),$sql,[$row['id']]);\n\t\t\t\t\t\tif ($query) {\n\t\t\t\t\t\t\t$row = $query->fetch(PDO::FETCH_ASSOC);\n\t\t\t\t\t\t\tif (!empty( $row )) {\n\t\t\t\t\t\t\t\tif ($row['api_key'] == $data['token']) {\n\t\t\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\t\t\"success\" => true,\n\t\t\t\t\t\t\t\t\t\t\"msg\" => \"Token correcto\",\n\t\t\t\t\t\t\t\t\t\t\"result\" => $result\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t$access = date(\"d/m/Y H:i:s\");\n \t\t\t\t\t\t\t\t$textoArchivo = \"Cliente: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})\\n\";\n \t\t\t\t\t\t\t\tfile_put_contents(\"../../logs/LoginLog.log\",$textoArchivo,FILE_APPEND | LOCK_EX);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\t\t\"success\" => false,\n\t\t\t\t\t\t\t\t\t\t\"msg\" => \"Token expiró o cambio\"\n\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\t\"success\" => false,\n\t\t\t\t\t\t\t\t\t\"msg\" => \"Token expiró o cambio\"\n\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n<<<<<<< HEAD\n\t\t\t\t\t\t\tthrow new Exception($this->getMsgErrorConnection());\n\t\t\t\t\t\t}*/\n\t\t\t\t\t\tif (true) {\n\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\"success\" => true,\n\t\t\t\t\t\t\t\t\"msg\" => \"Token correcto\",\n\t\t\t\t\t\t\t\t\"result\" => $result\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t$access = date(\"d/m/Y H:i:s\");\n\t\t\t\t\t\t\t$textoArchivo = \"Cliente: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})\\n\";\n\t\t\t\t\t\t\tfile_put_contents(\"../../logs/LoginLog.log\",$textoArchivo,FILE_APPEND | LOCK_EX);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\"success\" => false,\n\t\t\t\t\t\t\t\t\"msg\" => \"Token expiró o cambio\"\n\t\t\t\t\t\t\t];\n=======\n\t\t\t\t\t\t\tthrow new ErrorException($this->getMsgErrorConnection());\n>>>>>>> development\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/*if (true) {\n\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\"success\" => true,\n\t\t\t\t\t\t\t\t\"msg\" => \"Token correcto\",\n\t\t\t\t\t\t\t\t\"result\" => $result\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t$access = date(\"d/m/Y H:i:s\");\n\t\t\t\t\t\t\t$textoArchivo = \"Cliente: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})\\n\";\n\t\t\t\t\t\t\tfile_put_contents(\"../../logs/LoginLog.log\",$textoArchivo,FILE_APPEND | LOCK_EX);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$response = [\n\t\t\t\t\t\t\t\t\"success\" => false,\n\t\t\t\t\t\t\t\t\"msg\" => \"Token expiró o cambio\"\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t}*/\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Exception(\"Usuario (\" . $data['idUsuario'] . \") se encuentra inactivo.\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Exception(\"Usuario (\" . $data['idUsuario'] . \") no existe en su estado.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new ErrorException($this->getMsgErrorConnection());\n\t\t\t}\n\t\t} catch (ErrorException $e) {\n\t\t\terror_log(\"Error Runtime-API(REEMO_\" . __METHOD__ . \"): \" . $e->getMessage() . \" en \" . __FILE__);\n\t\t\t$response = [\n\t\t\t\t\"success\" => false,\n\t\t\t\t\"msg\" => $e->getMessage()\n\t\t\t];\n\t\t} catch (Exception $e) {\n\t\t\t$response = [\n\t\t\t\t\"success\" => false,\n\t\t\t\t\"msg\" => $e->getMessage()\n\t\t\t];\n\t\t}\n\t\treturn (object) $response;\n\t}" ]
[ "0.6677389", "0.60507935", "0.60507935", "0.60507935", "0.5983586", "0.59225214", "0.5901134", "0.5813058", "0.57808274", "0.57808274", "0.57713", "0.5758431", "0.57319653", "0.57111114", "0.5686363", "0.56624967", "0.5650246", "0.5645553", "0.5633591", "0.5629397", "0.56277996", "0.56217235", "0.56022453", "0.559924", "0.5584968", "0.5558853", "0.5555809", "0.55393034", "0.55117124", "0.5490869" ]
0.7295957
0
must check this user has this exam owner or not
private function check_exam_and_user(int $_user_id, int $_exam_id) { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function owner_matches_current_user()\n {\n }", "public function isOwner()\n {\n return (\\Auth::check() and \\Auth::user()->id == $this->id);\n }", "public function isOwner(): bool {\n $f3 = \\Base::instance();\n\n return $f3->get('CURRENT_USER') && !is_null($this->owner) && $f3->get('CURRENT_USER') === $this->owner->id;\n }", "public function ownerLoggedIn()\n {\n // For now just check session for an email and owner type\n if ( empty($_SESSION['email']) || $_SESSION['type'] != 'owner')\n return false;\n else\n return true;\n\n }", "public function isOwner()\n\t{\n\t\treturn is_null($this->CreatedBy) || $this->CreatedBy === Yii::app()->user->GUID;\n\t}", "private function checkOwner() {\r\n if (!$this->model->isOwner()) {\r\n $this->api->redirect('contact/home?message=Cannot Be Accessed');\r\n }\r\n }", "public static function isOwner(): bool\n\t{\n\t\tif(in_array( 'owner', self::getUserRole()) || in_array('administrator', self::getUserRole())) return true;\n\t\treturn false;\n\t}", "public function isOwner($user)\n {\n\n if ($this->m_role_created == $user->getId())\n return true;\n else\n return false;\n\n }", "public function getAmOwnerAttribute() {\n\t\t$userId = user('id');\n\t\tif(empty($userId)) { return false; }\n\t\t\n\t\treturn $userId == $this->attributes['user_id'];\n\t}", "public static function checkOwnerExisting()\n {\n global $mainframe;\n $db = JFactory::getDbo();\n $db->setQuery(\"Select count(id) from #__osrs_agents where agent_type <> '0' and published = '1'\");\n $count = $db->loadResult();\n if ($count > 0) {\n return true;\n } else {\n return false;\n }\n }", "public function isOwner()\n {\n return $this->affiliation == self::AFFILIATION_OWNER;\n }", "public function testIsUserPhotoOwner()\n {\n $this->seed();\n\n $isOwner = Photo::isUserPhotoOwner(1,1);\n $this->assertTrue($isOwner);\n\n $isOwner = Photo::isUserPhotoOwner(1,3);\n $this->assertTrue(!$isOwner);\n }", "public function hasOwner()\n {\n return $this->owner !== null;\n }", "protected function inExam(User $user, Exam $exam)\n {\n return ! $exam->load(['users' => function ($query) use ($user) {\n $query->where('user_id', $user->getAuthIdentifier());\n }])->getRelation('users')->isEmpty();\n }", "public function isOwnedBy($user)\n {\n if (($user === null) || ($user->user_id === null)) {\n return false;\n } else {\n return ($user->user_id === $this->user_id);\n }\n }", "public function isOwner();", "public function hasUser();", "public static function ownerOnly(){\n return TRUE;\n }", "public function isOwner($id=''){\n\t\n\tif(empty($id)) $id = $this->id;\n\t \t\n \t$sql=$this->_db->select()->from($this->m_table)->where(\"id=?\",$id)->where(\"user_id =?\",$_SESSION['user_id']);\n \t$rs =$this->_db->fetchCol($sql);\n \t\n \tif(!empty($rs)){\n \t\treturn true;\n \t}\n \treturn false;\n }", "private function check_is_owner($user_id)\n {\n if ($user_id != current_user_id()) {\n show_error(lang('not_authorized'), 403);\n }\n }", "function isOwner() {\n return $this->getIsOwner();\n }", "public function isOwnedBy(UserInterface $user);", "public function check()\t{\n\t\treturn ! is_null($this->user());\n\t}", "public function isOwner(){\n return (count($this->rooms()) > 0);\n }", "public function isOwner($item)\n {\n $roles = Session::get('roles');\n $userId = Auth::user()->externalId;\n\n $result = !empty(array_intersect($roles, ['Administrator','Accounting','Developer']));\n if ($result || in_array($userId,['34',\"55\",'155'])) { // allow mikker to see all forms\n return true;\n }\n\n //remove the user role. we don't care about it\n $roles = array_diff($roles, array('User'));\n $roles = array_values($roles);\n\n switch ($roles[0]){\n case \"Client Manager\":\n return $item->ClientAlias->Client->ClientManager_Id == null? true: $userId ? true:false;\n break;\n case \"Adwords\":\n case \"SEO\":\n // loop through all contracts and find if he has a contract assigned to him\n $owner = false;\n if(is_array($item->Contract)){\n foreach ($item->Contract as $contract){\n if($contract->Manager_Id == $userId){\n $owner = true;\n break;\n }\n }\n }\n return $owner;\n break;\n case \"Sales\":\n return $item->ClientAlias->User_Id == $userId ? true:false;\n break;\n default :\n break;\n }\n //default, we deny.\n return false;\n }", "public function isAssignee(UserInterface $user);", "public function GetisOwnerThisRecord(){\n return ($this->{$this->nameFieldUserId}==h::userId());\n}", "public function mustbeuser()\n {\n if (!$this->hasuser())\n {\n $this->web()->noaccess();\n }\n }", "public function check_insta_user() {\n \n }", "function publisher_userIsAuthor($itemObj)\r\n{\r\n global $xoopsUser;\r\n return (is_object($xoopsUser) && is_object($itemObj) && ($xoopsUser->uid() == $itemObj->uid()));\r\n}" ]
[ "0.67511183", "0.6662352", "0.65293986", "0.64193505", "0.64000636", "0.6379496", "0.63788235", "0.6374161", "0.6355589", "0.6329706", "0.62902236", "0.62775457", "0.6248488", "0.6225442", "0.62157464", "0.6203377", "0.6200721", "0.6163941", "0.61551213", "0.6154409", "0.61480755", "0.6143105", "0.61275244", "0.6122984", "0.6113575", "0.61023647", "0.6087097", "0.60855514", "0.6081588", "0.60687727" ]
0.6989703
0
Get the svg regex pattern.
private function getSvgRegex() : string { return '~^ <svg\s.+viewBox="(?P<viewBox>0\s0\s(?P<width>\d+)\s(?P<height>\d+))"> # opening <svg> with width and height (from viewBox attribute) <!--.+--> # Font Awesome License Comment (?: # optional style definitions, used by duotone <defs> <style> (?P<style>.+) # capture group "styles" for the styles </style> </defs> )? (?P<paths> # capture group "paths" (?: <path # opening <path> \s.+? # path contents (?:/>|></path>) # either self closing /> or closing </path> ){1,2} # match 1-2 <path> ) </svg> # closing </svg> $~x'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getRegularExpression();", "function getRegex() {\n\t\treturn \"/\".$this->prefixes . $this->source . $this->suffixes. \"/\" . $this->modifiers;\n\t}", "public function getRegex() {\n\t\t$spec = self::$specs[$this->id];\n\t\treturn array_value($spec, \"regex\", \"\");\n\t}", "public function getPattern();", "public function getPattern();", "public function getPattern() {}", "public function getPattern(): string;", "public function getPattern(): string;", "public function getRegex(): string\n {\n return $this->regex;\n }", "public function getRegex(): string\n {\n return $this->regex;\n }", "public function getPattern(): string\n {\n return $this->pattern;\n }", "public function getPattern(): string\n {\n return $this->pattern;\n }", "public function get_pattern()\n {\n return $this->pattern;\n }", "public function regex(): string{\n return $this->_regex;\n }", "public function get_regexp(){\n\t\treturn $this->get_regexp();\n\t}", "private static function REGEX(): string{\n\t\tif(self::$REGEX === \"\"){\n\t\t\tself::$REGEX = \"/(?:\" . preg_quote(\"{\") . \")((?:[A-Za-z0-9_\\-]{2,})(?:\\.[A-Za-z0-9_\\-]+)+)(?:\" . preg_quote(\"}\") . \")/\";\n\t\t}\n\n\t\treturn self::$REGEX;\n\t}", "public function getRegexp();", "public function getRegex()\n {\n return $this->regex;\n }", "private function getPathsRegex() : string\n {\n return '~\n <path # opening <path>\n (?:\\sclass=\"(?P<class>[^\"]+)\")? # optional classes\n \\sd=\"(?P<d>[^\"]+)\" # the path definition \"d\" attribute\n .*? # ignore any un-needed information after \"d\" attribute\n (?:/>|></path>) # either self closing /> or closing </path>\n ~x';\n }", "public function getRegex()\n\t{\n\t\treturn $this->regex;\n\t}", "public function getPattern()\n {\n return $this->_pattern;\n }", "public function getPattern()\n {\n // file type\n $pattern = $this->getFileType() . ':';\n\n // schema (http, https)\n $pattern .= $this->uri->getScheme() . ':';\n\n // host\n $pattern .= $this->uri->getHost() . ':';\n\n $path = $this->uri->getPath() . '?' . $this->uri->getQuery();\n\n $pathNew = preg_replace(\"^[a-f0-9]{32}^\", \"<h>\", $path);\n $pathNew = preg_replace(\"^[a-z\\-\\_]{1,}^i\", \"<s>\", $pathNew);\n $pathNew = preg_replace(\"^[0-9]{1,}^\", \"<i>\", $pathNew);\n\n $pattern .= $pathNew;\n\n return $pattern;\n }", "public function getRegularExpression()\n {\n return '/(\\b([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9][A-Za-z]?))))\\s?[0-9][A-Za-z]{2})\\b)/um';\n }", "public function getPattern() {\n\t\treturn $this->pattern;\n\t}", "public static function getRegex($Name = 'uri-spec');", "abstract protected function getPattern(): string;", "abstract protected function getPattern(): string;", "public function getPattern(): string\n {\n return $this->getConfig('pattern');\n }", "public function GetPattern () {\n\t\tif ($this->pattern === NULL)\n\t\t\t$this->preparePatternAndBackReferenceIndexes();\n\t\treturn $this->pattern;\n\t}", "public function getPattern()\n {\n return $this->options['pattern'];\n }" ]
[ "0.682686", "0.67306954", "0.67304736", "0.6722517", "0.6722517", "0.6662467", "0.65021664", "0.65021664", "0.6462015", "0.6462015", "0.6415263", "0.6415263", "0.6397987", "0.634499", "0.62689596", "0.62675583", "0.62602156", "0.62342733", "0.62114143", "0.6182372", "0.61738145", "0.61282325", "0.6120575", "0.6091492", "0.60377455", "0.60072374", "0.60072374", "0.5989049", "0.59404993", "0.5921434" ]
0.7619533
0
$one nombre de array de los valores de la funtion set $two Los valores que van dentro del array de la function set
public function set($one, $two=null){ if (is_array($one)) { if (is_array($two)) { $data = array_combine($one, $two); }else{ $data = $one; } }else{ $data = array($one=>$two); } $this->_view->setVars($data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function __setInfo($one, $two = null) {\n\t\t$data = array();\n\n\t\tif (is_array($one)) {\n\t\t\tif (is_array($two)) {\n\t\t\t\t$data = array_combine($one, $two);\n\t\t\t} else {\n\t\t\t\t$data = $one;\n\t\t\t}\n\t\t} else {\n\t\t\t$data = array($one => $two);\n\t\t}\n\t\t$this->_lastInfo = array_merge($this->_lastInfo, $data);\n\t}", "public function set($one, $two = null) {\n $data = null;\n if (is_array($one)) {\n if (is_array($two)) {\n $data = array_combine($one, $two);\n } else {\n $data = $one;\n }\n } else {\n $data = array($one => $two);\n }\n if ($data == null) {\n return false;\n }\n $this->viewVars = $data + $this->viewVars;\n }", "public function setContext($one, $two = NULL) {\n $args = func_get_args();\n if (count($args) == 2) {\n $this->context[$one] = $two;\n }\n else if (count($args) == 1 && is_array($one)) {\n $this->context = $one;\n }\n else {\n throw new Exception('Invalid context provided to workflow instance in method `setContext`.');\n }\n }", "public function set()\n {\n $args = func_get_args();\n $num = func_num_args();\n if ($num == 2) {\n self::$data[$args[0]] = $args[1];\n } else {\n if (is_array($args[0])) {\n foreach ($args[0] as $k => $v) {\n self::$data[$k] = $v;\n }\n }\n }\n }", "function set(array $array){\n foreach($this as $atributo => $valor){\n if(isset($array[$atributo])){\n $this->$atributo = $array[$atributo];\n }\n }\n }", "static function diff($one, $two, $stict=true){\n\t\t$set = [];\n\t\tforeach($one as $v){\n\t\t\tif(!in_array($v, $two, $strict)){\n\t\t\t\t$set[] = $v;\n\t\t\t}\n\t\t}\n\t\treturn $set;\n\t}", "function set($a, $b = null) {\n\t\tif (is_array($a)) {\n\t\t\tforeach ($a as $key => $val) {\n\t\t\t\tparent::set($key, $val);\n\t\t\t}\n\t\t}\n\t\treturn parent::set($a, $b);\n\t}", "public function setPromotion($first,$second)\n {\n $this->promotion->setPromotion($first,$second);\n //product Id for identify products\n $this->promotion->setProductId($this->id);\n }", "public function set($params1, $params2 = null)\n {\n if (is_string($params1)) {\n $this->variables[$params1] = $params2;\n } elseif (is_array($params1)) {\n $this->variables = $params1 + $this->variables;\n }\n }", "public function bulkSet(array $args = array()) {\n foreach ($args as $argName => $arg) {\n $this->__set($argName, $arg);\n }\n }", "abstract public function set();", "private function exchangeGossips(Driver $one, Driver $two): void\n {\n $one->learnGossips($two->getGossips());\n $two->learnGossips($one->getGossips());\n }", "public function test_set_020_oneStep_array()\n {// $data = new Blank();\n// $res = $this->obj->set($data, '/0/', 'John Dow');\n// $this->assertEquals('John Dow', $res[0]);\n }", "public static function merge($one, $two) {\n\t\t$elements = $one->elements;\n\t\tforeach($two->elements as $node) {\n\t\t\t$exists = false;\n\t\t\tforeach($elements as $node2) {\n\t\t\t\tif ($node2->isSameNode($node))\n\t\t\t\t\t$exists = true;\n\t\t\t}\n\t\t\tif (! $exists)\n\t\t\t\t$elements[] = $node;\n\t\t}\n\t\treturn $elements;\n//\t\t$one = $one->newInstance();\n//\t\t$one->elements = $elements;\n//\t\treturn $one;\n\t}", "function has_one() {\n System::$assocs_temp['has_one'][] = func_get_args();\n}", "public function __construct($one, $two)\n {\n echo \"<br />Creating battle simulator..\" . PHP_EOL;\n $this->_type = $this->setRandomTypeOfBattle();\n echo \"<br />Optimizing terrain...\" . PHP_EOL;\n $this->_turn = rand(0, 1);\n $this->_army1 = $one;\n $this->_army2 = $two;\n }", "function merge_perm( $one, $two ){\n\tif( empty( $one[ 0 ][ 'users' ] ) || empty( $two[ 0 ][ 'users' ] ) )\n\t\treturn $one;\n\n\t$one[ 0 ][ 'users' ] = array_merge( $one[ 0 ][ 'users' ], $two[ 0 ][ 'users' ] );\n\t$one[ 0 ][ 'groups' ] = array_merge( $one[ 0 ][ 'groups' ], $two[ 0 ][ 'groups' ] );\n\t$one[ 1 ][ 'users' ] = array_merge( $one[ 1 ][ 'users' ], $two[ 1 ][ 'users' ] );\n\t$one[ 1 ][ 'groups' ] = array_merge( $one[ 1 ][ 'groups' ], $two[ 1 ][ 'groups' ] );\n\treturn $one;\n}", "public function setList(){\r\n\t\t $arr=func_num_args();\r\n\t\t\t $arr1=func_get_args();\r\n\t\t\t if ($arr==2){\r\n\t\t\t $this->su[$this->counte]=$arr1[0];\r\n\t\t\t $this->data[$this->counte]=$arr1[1];\r\n\t\t\t\t }\r\n\t\t\t\t if ($arr==1){\r\n\t\t\t\t $this->data[$this->counte]=$arr1[0];\r\n\t\t\t\t $this->su[$this->counte]=$this->oklad;\r\n\t\t\t\t // $this->su=$this->oklad;\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t $this->listing[$this->counte] =array($this->su,$this->data);\r\n\t\t\t $this->counte++;\r\n\t\t\t}", "public static function mset($_arg) {\n\t\tif (!is_array($_arg)) {\n\t\t\t// Invalid argument\n\t\t\ttrigger_error(self::TEXT_MSet);\n\t\t\treturn;\n\t\t}\n\t\t// Bind key-value pairs\n\t\tarray_map('self::set',array_keys($_arg),$_arg);\n\t}", "public function arrayMergeRecursive($one, $two)\n {\n foreach($two as $key => $value)\n {\n if(array_key_exists($key, $one) && is_array($value)) {\n $one[$key] = $this->arrayMergeRecursive($one[$key], $two[$key]);\n } else {\n $one[$key] = $value;\n }\n }\n\n return $one;\n }", "public function set($user, array $input);", "function hesapla($sayi1, $sayi2) \n {\n $this->sayi1=$sayi1; \n $this->sayi2=$sayi2;\n }", "public function defaults($one = null, $two = null)\n {\n if ($one && $two) {\n return \"$one and $two\";\n }\n if ($one) {\n return \"only $one\";\n }\n return \"nothing provided\";\n }", "static function intersect($one, $two, $strict=true){\n\t\t$set = [];\n\t\tforeach($one as $v){\n\t\t\tif(in_array($v, $two, $strict)){\n\t\t\t\t$set[] = $v;\n\t\t\t}\n\t\t}\n\t\treturn $set;\n\t}", "private function setMetadataVariables($revision_one, $revision_two)\n { \n if ($revision_one == \"current\")\n {\n $this->latest_metadata = REDCap::getDataDictionary(\"array\");\n $this->furthest_metadata = MetaData::getDataDictionary(\"array\", true, array(), array(), false, false, $revision_two);\n }\n else\n {\n $this->latest_metadata = MetaData::getDataDictionary(\"array\", true, array(), array(), false, false, $revision_one);\n $this->furthest_metadata = MetaData::getDataDictionary(\"array\", true, array(), array(), false, false, $revision_two);\n }\n\n $this->metadata_changes = array();\n\n // Check new and modified fields.\n foreach($this->latest_metadata as $field => $metadata)\n {\n // Check to see if values are different from existing field. If they are, don't include in new array.\n if (!isset($this->furthest_metadata[$field]) || $metadata !== $this->furthest_metadata[$field]) {\n $this->metadata_changes[$field] = $metadata;\n }\n }\n\n // Check deleted fields.\n $current_fields = array_keys($this->latest_metadata);\n $deleted_fields = array_filter($this->furthest_metadata, function($field_name) use($current_fields) {\n return !in_array($field_name, $current_fields);\n }, ARRAY_FILTER_USE_KEY);\n\n $this->metadata_changes = array_merge($this->metadata_changes, $deleted_fields);\n }", "function set(array $grid, int $rowIndex, int $columnIndex, int $value): void {//tiene\n $grid[$rowIndex][$columnIndex] = $value; \n}", "public function canSetTheSameOffsetSeveralTimes()\n {\n $object0 = $this->getMock('ATM_Config_Abstract', array('getName'));\n $object1 = $this->getMock('ATM_Config_Abstract', array('getName'));\n $this->assertNotSame($object0, $object1);\n $this->object[0]=$object0;\n $this->assertSame($object0, $this->object[0]);\n $this->object[0]=$object1;\n $this->assertSame($object1, $this->object[0]);\n }", "protected function _one($arg1, $arg2 = null): void\n {\n // @codingStandardsIgnoreEnd\n }", "public function testMultipleSetAndGet()\n {\n $data = array(array(\"title\" => \"A\",\n \"url\" => \"/a\"),\n array(\"title\" => \"B\",\n \"url\" => \"/a/b\"),\n array(\"title\" => \"C\",\n \"url\" => \"/a/b/c\")\n );\n \n $bc = new \\Loom\\Breadcrumbs();\n $this->assertEmpty($bc->get());\n\n $bc->set($data);\n $this->assertCount(3, $bc->get());\n }", "function set($field_or_array,$value=undefined){\n\t\tif($value===undefined){\n\t\t\tif(is_array($field_or_array)){\n\t\t\t\tforeach($field_or_array as $key=>$val){\n\t\t\t\t\t$this->set($key,$val);\n\t\t\t\t}\n\t\t\t\treturn $this;\n\t\t\t}else{\n\t\t\t\t$value=$field_or_array;\n\t\t\t\t$field_or_array=$this->last_field;\n\t\t\t}\n\t\t}\n\n\t\t// Do not set unexistant fields\n\t\tif(!isset($this->fields[$field_or_array])){echo \"warning: no such field $field_or_array\";}\n\t\t$this->data[$field_or_array]=$value;\n\n\t\treturn $this;\n\t}" ]
[ "0.7536746", "0.7125052", "0.613436", "0.6061652", "0.555009", "0.54816246", "0.54372656", "0.5388178", "0.53716594", "0.5346571", "0.53233355", "0.52968276", "0.52800643", "0.52627784", "0.5234294", "0.5221767", "0.5196658", "0.5189121", "0.5145135", "0.5130264", "0.51247555", "0.5086163", "0.5059886", "0.50481266", "0.5031302", "0.49949592", "0.4972065", "0.4967333", "0.49029773", "0.48707795" ]
0.7386039
1
Is it command. Commands start from / (slash)
private function isCommand(string $string): bool { return strncmp($string, '/', 1) === 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isCommand($text) {\n return ( substr($text, 0, 1) == \"/\" ) ? true : false;\n }", "public function hasCmd(){\n return $this->_has(1);\n }", "public function hasCmd(){\n return $this->_has(1);\n }", "public function hasCmd(){\n return $this->_has(1);\n }", "public function hasCmd(){\n return $this->_has(1);\n }", "public function hasCmd(){\n return $this->_has(1);\n }", "public function isCommand($text)\n {\n return (($text[0] == '!') ? TRUE : FALSE);\n }", "function commandAllowed()\n {\n return array_key_exists($this->command, $this->commands);\n }", "function test_command($command) {\n\t$return = explode(':', trim(exec('whereis ' . $command)));\n\tif (isset($return[1]) and trim($return[1]) != '')\n\t\treturn TRUE;\n\telse\n\t\treturn FALSE;\n}", "private function isPotentialCommand($text) {\n\t\treturn strlen($text) > 0 && strpos($text, '/') === 0;\n\t}", "protected function hasCommand()\n\t{\n\t\treturn $this->app->bound('rocketeer.command');\n\t}", "public function hasCommand(string $command = NULL): bool;", "function getCommand($text)\r\n{\r\n\t$cmd = strtolower(substr($text, 0, 4));\r\n\tswitch ($cmd)\r\n\t{\r\n\t\tcase '/me ':\r\n\t\tcase '\\me ':\r\n\t\t\t$command = 'action';\r\n\t\t\tbreak;\r\n\t\tcase 'http':\r\n\t\tcase 'www.':\r\n\t\t\t$command = 'link';\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t$command = false;\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\treturn $command;\r\n}", "private function hasCommands()\n {\n if ($this->commands) {\n return true;\n }\n\n return false;\n }", "protected static function isCommandLine() {}", "abstract function command();", "protected function is_command($command): bool\n{\n return $command instanceof CommandInterface;\n}", "public static function has_command($name) {\n\t\treturn $name == $GLOBALS['i18n']['framework']['cli_help'] || isset(CLI_Manager::$commands[$name]);\n\t}", "public function isCommandLine()\n {\n return $this->_getMethod() === \\Yana\\Http\\Requests\\MethodEnumeration::CLI;\n }", "public function command(): string;", "public function isCmd($arg)\n {\n $clean_arg = trim($arg, \"-\");\n $is_cmd = false;\n\n foreach ($this->cmds as $key => $parseValues) {\n foreach ($parseValues as $cmd) {\n if ($cmd === $clean_arg) {\n $this->props[$key] = true;\n $this->state = $key;\n $is_cmd = true;\n }\n }\n }\n\n return $is_cmd;\n }", "public function isCLI ();", "function is_ok($cmd = \"\")\n {\n }", "public static function commandURI($mnt,$command)\n{\nreturn self::uri($mnt,'?'.$command);\n}", "private function hasValidCommand($input) {\n\t\treturn $this->isAddCommand($input) || $this->isUpdateCommand($input) || $this->isDeleteCommand($input);\n\t}", "abstract protected function getCommand();", "public function getCmd()\n {\n if (! isset($this->params['args']['cmd'])) {\n return false;\n }\n\n return $this->params['args']['cmd'];\n }", "public function getCommand() {}", "private function isAddCommand($input) {\n\t\treturn strtolower($input->command) == \"add\";\n\t}", "protected function is_class($command): bool\n{\n return is_string($command) \n && class_exists($command);\n}" ]
[ "0.8154392", "0.71213853", "0.71213853", "0.71213853", "0.71213853", "0.71213853", "0.69313496", "0.6892232", "0.67215264", "0.6667739", "0.6624764", "0.6597937", "0.6556483", "0.65301263", "0.64847225", "0.6435873", "0.63879263", "0.6371536", "0.6371083", "0.63335234", "0.62929887", "0.6204805", "0.61518127", "0.61394274", "0.6100657", "0.6085385", "0.60784346", "0.6004887", "0.6004498", "0.59760016" ]
0.73612386
1
endregion region Main functions Join the game with the specified ID or create a new one and return a new gameID gameID is a string of 3 alphanumeric caracters
function joinGame($gameID, $playerName) { $dbh = connectToDatabase(); if (!$gameID) { // Check that there is no game already using this ID $gameIDIsUnique = true; // If $gameID empty, create new game $gameID = newGameID(); // Count number of rows with $gameID $stmt = $dbh->prepare('SELECT COUNT(1) FROM games WHERE gameID = ?'); do { $stmt->execute([$gameID]); $result = $stmt->fetch(PDO::FETCH_NUM); if ($result[0] > 0) { // Wait, there is a game already using this ID. Try again $gameIDIsUnique = false; } } while (!$gameIDIsUnique); // First player in a game becomes the GM $playersData = json_encode([$playerName]); $gameData = json_encode(new stdClass); $stmt = $dbh->prepare("INSERT INTO games VALUES (?, ?, ?, ?, 0, NOW())"); if ($stmt->execute([$gameID, $playersData, $gameData, $playerName])) { // Now, send new gameID back to the host player exit($gameID); } else { http_response_code(500); die('GAME NOT CREATED'); } } else { // Otherwise, join game with passed gameID // Get whatever players are now in the database $stmt = $dbh->prepare('SELECT players FROM games WHERE gameID = ?'); $stmt->execute([$gameID]); $result = $stmt->fetch(PDO::FETCH_NUM); if (count($result) <= 0) { // Wait, there is no game with that ID http_response_code(404); die('GAME NOT FOUND'); } // There should be only one game with this ID, so join first one with matched ID $players = json_decode($result[0], true); // Add this player to the players array, and insert back into the entry array_push($players, $playerName); $playersData = json_encode($players); $stmt = $dbh->prepare('UPDATE games SET players = ? WHERE gameID = ?'); if ($stmt->execute([$playersData, $gameID])) { // Signal the client that the game is ready exit('PLAYER'); } else { http_response_code(500); die('NOT JOINED GAME'); } } // Now store the gameID in $_SESSION, so that we stay connected until the browser is closed $_SESSION['gameID'] = $gameID; $_SESSION['playerName'] = $playerName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newGameID()\n{\n return randomString();\n}", "function newGame() {\n\t$newid = uniqid();\n\t$newgame = [\n\t\t'open' => $newid,\n\t\t$newid => ['state' => 'open', 'players' => []],\n\t];\n\tupdateGames($newgame);\n\twriteGame($newid, ['round' => 0]);\n\n\treturn $newid;\n}", "function joinGame($userId, $gameId) {\n\t$oldGameId = getGameOf($userId);\n\n\tif ($oldGameId != NOT_IN_GAME) {\n\t\treturn false;\n\t}\n\n\t$sql = \"update users set game_id = $gameId where id = $userId\";\n\tSQLUpdate($sql);\n\n\tdistributeInitialCards($userId);\n\n\treturn true;\n}", "function createGame($name, $adminId) {\n\t$sql = \"insert ignore into games (name, admin_id, user_to_play) values ('$name', $adminId, $adminId)\";\n\t$id = SQLInsert($sql);\n\n\tif ($id != 0) {\n\t\t$sql = \"update users set game_id = $id where id = $adminId\";\n\t\tSQLUpdate($sql);\n\n\t\tdistributeInitialCards($adminId);\n\t}\n\n\t// TODO?: choosing before dealing would allow us to skip that expansive call\n\t$unusedCards = getUnusedCards($id);\n\n\tdo {\n\t\t$rand_index = array_rand($unusedCards);\n\t} while (($firstCard = $unusedCards[$rand_index]) == \"plusfour\");\n\n\t$firstCard = $unusedCards[$rand_index];\n\n\tSQLInsert(\"insert into placed_cards (game_id, card_name) values ($id, '$firstCard')\");\n\n\treturn $id;\n}", "public function join($id)\n {\n $game = Game::findOrFail($id);\n if ($game->state != 'waiting') {\n return redirect()->route('dashboard');\n }\n\n foreach ($game->participants as $p) {\n if ($p->user->id == Auth::id()) {\n return redirect()->route('game.show', ['id' => $id]);\n }\n }\n\n $user = Auth::user();\n $participant = $user->participants()->create();\n $game->participants()->save($participant);\n\n $userJoined = $user->name . \" Joined the game!\";\n event(new UserJoinedAGame($userJoined, $user, $game));\n\n return redirect()->route('game.show', ['id' => $id]);\n }", "function game_ai_create_new_player() {\n global $game, $base_url, $ai_output;\n\n while (TRUE) {\n $num = mt_rand(0, 99999);\n $id_to_check = 'ai-' . $num;\n zg_ai_out(\"checking for existing player $id_to_check\");\n\n $sql = 'select id from users\n where phone_id = \"%s\";';\n $result = db_query($sql, $id_to_check);\n $item = db_fetch_object($result);\n\n if (empty($item)) {\n break;\n }\n }\n\n $uri = $base_url . \"/$game/home/$id_to_check\";\n zg_ai_out(\"phone_id $id_to_check not in use; URI is $uri\");\n $response = zg_ai_web_request($id_to_check, 'home');\n zg_ai_out($response);\n\n zg_ai_out('updating record to make this a ToxiCorp Employee');\n $sql = 'update users set username = \"%s\", fkey_neighborhoods_id = 75,\n fkey_values_id = 9, `values` = \"Goo\", meta = \"ai_minion\"\n where phone_id = \"%s\";';\n db_query($sql, \"TC Emp $num\", $id_to_check);\n $ai_bot = zg_fetch_user_by_id($id_to_check);\n // mail('[email protected]', 'ai trying to create a new player AGAIN', $ai_output);.\n zg_slack($ai_bot, 'bots', 'new bot creation', $ai_output);\n}", "public function createGame($pdo, $playerID, $opponentID) {\n $pdo->beginTransaction();\n \n try {\n $activePlayerID = rand(0,1) == 0 ? $playerID : $opponentID;\n $sql = \"INSERT INTO game (opponent_1, opponent_2, activePlayerID) VALUES ({$opponentID}, {$playerID}, {$activePlayerID});\";\n \n $sth = $pdo->prepare($sql);\n \n $sth->execute();\n $currentID = $pdo->lastInsertId(); \n $pdo->commit();\n return $currentID;\n \n } catch (PDOException $e) {\n die(\"<p>{$e->getMessage()}\");\n $pdo->rollBack();\n return NULL;\n }\n }", "public function write_new_game(){\n\n\t\t$query = \"INSERT INTO `games`\n\t\t( `title`, `user_count`, `info`, `bgimage`, `banner`, `level`, `api`)\n\t\tVALUES\n\t\t('$this->title', '$this->user_count', '$this->info', '$this->bgimage', '$this->banner', '$this->level', '$this->api')\";\n\n\t\tif(DB::sql($query)){\n\t\t\t$this->id = DB::last_id();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\n\t}", "function joinGame($game, $me) {\n\t$games = getGames();\n\tif (isset($_SESSION['gameid']) and\n\t isset($games[$_SESSION['gameid']]) and\n\t $games[$_SESSION['gameid']]['state'] != 'closed') {\n\t\treturn error('You are still in an active game');\n\t}\n\n\t$games[$game]['players'][] = $me;\n\tif (sizeof($games[$game]['players']) == 2) {\n\t\t$games[$game]['state'] = 'playing';\n\t}\n\t$_SESSION['gameid'] = $game;\n\n\treturn writeGames($games);\n}", "private function createGame()\n {\n $hash = hash(\"md5\", uniqid(mt_rand(), true));\n $temphash = hash(\"md5\", uniqid(mt_rand(), true));\n\n // array with values to be inserted to the table\n $game = array(\n 'player1_hash' => $hash,\n 'player1_name' => \"Player 1\",\n 'player1_ships' => \"\",\n 'player2_hash' => $temphash,\n 'player2_name' => \"Player 2\",\n 'player2_ships' => \"\",\n 'timestamp' => Misc::getUtcTime()->getTimestamp()\n );\n\n $query = \"INSERT INTO games (player1_hash, player1_name, player1_ships,\n player2_hash, player2_name, player2_ships, timestamp)\n VALUES (?, ?, ?, ?, ?, ?, ?)\";\n $this->oDB->getAll($query, array_values($game));\n\n $game['player_number'] = 1; // player who starts is always No. 1\n $game['id'] = $this->oDB->lastInsertId();\n\n return $game;\n }", "function getNewId();", "function leaveGame($gameID, $playerName)\n{\n // If $gameID empty, ignore\n if ($gameID === '') {\n http_response_code(400);\n die('GAME ID MISSING');\n }\n // Otherwise, leave game\n\n $dbh = connectToDatabase();\n\n if (playerIsGM($gameID, $playerName)) {\n $stmt = $dbh->prepare('UPDATE games SET isPlaying = 0 WHERE gameID = ?');\n if ($stmt->execute([$gameID])) {\n // All good, keep going\n } else {\n http_response_code(500);\n die('UNABLE TO STOP GAME');\n }\n }\n\n $stmt = $dbh->prepare('SELECT players FROM games WHERE gameID = ?');\n $stmt->execute([$gameID]);\n $result = $stmt->fetch(PDO::FETCH_NUM);\n\n if (count($result) <= 0) {\n // Wait, there is no game with that ID\n http_response_code(404);\n die('GAME NOT FOUND');\n }\n\n // There should be only one game with this ID, so join first one with matched ID\n $data = $result[0];\n $players = json_decode($data, true);\n\n if (count($players) === 1) {\n // We are the last player in the game, remove the DB entry\n $stmt = $dbh->prepare('DELETE FROM games WHERE gameID = ?');\n if ($stmt->execute([$gameID])) {\n exit('DELETED');\n } else {\n http_response_code(500);\n die('UNABLE TO DELETE GAME');\n }\n }\n\n // Otherwise, remove this player to the players array, and insert back into the entry\n if (($key = array_search($playerName, $players)) !== false) {\n unset($players[$key]);\n $players = array_values($players);\n }\n\n $playersData = json_encode($players);\n\n $stmt = $dbh->prepare('UPDATE games SET players = ? WHERE gameID = ?');\n if ($stmt->execute([$playersData, $gameID])) {\n // Signal the client that they have disconnected\n exit('DISCONNECTED');\n } else {\n http_response_code(500);\n die('UNABLE TO LEAVE GAME');\n }\n}", "function gaMatch_addPlayerResult($kidPlayerId, $win, $draw, $lost) {\n //??????????????????? does record already exist - what if player change ?????????\n $match = array_search ( $kidPlayerId , $this->gamatch_gamePlayerMap);\n if ($match === FALSE) {\n $newGame = new stdData_gameUnit_extended;\n $newGame->stdRec_loadRow($row);\n $this->gamatch_gamePlayerMap[$newGame->game_kidPeriodId] = $newGame;\n ++$this->game_opponents_count;\n $this->game_opponents_kidPeriodId[] = $kidPlayerId;\n $this->game_opponents_wins[] = $win;\n $this->game_opponents_draws[] = $draw;\n $this->game_opponents_losts[] = $lost;\n $this->gagArrayGameId[] = 0;\n } else {\n $this->game_opponents_wins[$match] += $win;\n $this->game_opponents_draws[$match] += $draw;\n $this->game_opponents_losts[$match] += $lost;\n }\n}", "public function join($id);", "private function dealWithAddNewGame() {\r\n \r\n $imagePathFromRoot = str_replace('\\\\', '\\\\\\\\', str_replace(DIR_ROOT, '', $this->uploadGameImage()));\r\n \r\n $gameData = [\r\n self::FIELD_COMPLEXITY => filter_input(INPUT_POST, self::FIELD_COMPLEXITY),\r\n self::FIELD_DESCRIPTION => filter_input(INPUT_POST, self::FIELD_DESCRIPTION),\r\n self::FIELD_IMAGE => $imagePathFromRoot,\r\n self::FIELD_NAME => filter_input(INPUT_POST, self::FIELD_NAME),\r\n self::FIELD_PLAYERS_NUMBER => filter_input(INPUT_POST, self::FIELD_PLAYERS_NUMBER),\r\n self::FIELD_PLAY_TIME => filter_input(INPUT_POST, self::FIELD_PLAY_TIME),\r\n self::FIELD_PUBLISHER => filter_input(INPUT_POST, self::FIELD_PUBLISHER),\r\n self::FIELD_SITE_URL => filter_input(INPUT_POST, self::FIELD_SITE_URL),\r\n self::FIELD_TYPE => filter_input(INPUT_POST, self::FIELD_TYPE),\r\n ];\r\n \r\n $result = $this->model->saveGame($gameData);\r\n \r\n if ($result > 0) {\r\n $this->messages['ok'] = 'Game saved with ID ' . $result;\r\n } else {\r\n $this->messages['error'] = 'Some errors occured. Game not saved.';\r\n }\r\n }", "public function create_game(){\n $data = array(\n 'uid' => $this->input->post('uid'),\n 'player1_name' => $this->input->post('player-1-name'),\n 'player2_name' => $this->input->post('player-2-name')\n );\n return $this->db->insert('games', $data);\n }", "function joinRun() {\r\n\t// Access the globals. \r\n\tglobal $DB;\r\n\tglobal $TIMEMARK;\r\n\tglobal $MySelf;\r\n\t$runid = (int) $_GET[id];\r\n\t$userid = $MySelf->GetID();\r\n\r\n\t// Are we allowed to join runs?\r\n\tif (!$MySelf->canJoinRun()) {\r\n\t\tmakeNotice(\"You are not allowed to join mining operations. Please ask your CEO to unblock your account.\", \"error\", \"Forbidden\");\r\n\t}\r\n\r\n\t// Is $runid truly an integer?\r\n\tnumericCheck($runid);\r\n\r\n\t// Is the run still open?\r\n\tif (!miningRunOpen($runid)) {\r\n\t\tmakeNotice(\"This mining operation has been closed!\", \"warning\", \"Can not join\", \"index.php?action=show&id=$runid\");\r\n\t}\r\n\r\n\t// Are we banned from the run?\r\n\t$State = $DB->getCol(\"SELECT status FROM joinups WHERE run='$runid' and userid='\" . $MySelf->getID() . \"'ORDER BY id DESC LIMIT 1\");\r\n\t$State = $State[0];\r\n\r\n\tswitch ($State) {\r\n\t\tcase (\"2\") :\r\n\t\t\t// We have been kicked.\r\n\t\t\t$kicked = true;\r\n\t\t\tbreak;\r\n\t\tcase (\"3\") :\r\n\t\t\t// We have been banned!\r\n\t\t\tif ((runSupervisor($runid) == $MySelf->getUsername()) || $MySelf->isOfficial()) {\r\n\t\t\t\t$banned = \"You have been banned from this operation but your rank overrides this block.\";\r\n\t\t\t} else {\r\n\t\t\t\tmakeNotice(\"You have been banned from this operation. You can not rejoin it.\", \"warning\", \"You are banned.\", \"index.php?action=list\", \"[cancel]\");\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t// Is the run locked?\r\n\tif (runIsLocked($runid)) {\r\n\t\tmakeNotice(\"You can not join this run as this run has been locked by \" . runSupervisor($runid) . \".\", \"notice\", \"Mining operation locked\", \"index.php?action=show&id=$runid\", \"[Cancel]\");\r\n\t}\r\n\t\r\n\t// Join with shiptype.\r\n\tif (!$_GET['confirmed-ship']) {\r\n\t\t$table = new table(1, true);\r\n\t\t$table->addHeader(\">> Join an Operation\");\r\n\r\n\t\t// If we have been kicked, inform the user.\r\n\t\tif ($kicked) {\r\n\t\t\t$table->addRow(\"#880000\");\r\n\t\t\t$table->addCol(\"Warning: You have been recently kicked. Please check if you are allowed to rejoin to avoid a ban.\");\r\n\t\t}\r\n\r\n\t\t// If we are banned but an official, inform the user.\r\n\t\tif ($banned) {\r\n\t\t\t$table->addRow(\"#880000\");\r\n\t\t\t$table->addCol($banned);\r\n\t\t}\r\n\r\n\t\t$table->addRow();\r\n\t\t$table->addCol($form . \"Join the Operation in \" . ucfirst(getLocationOfRun($runid)) . \".\");\r\n\t\t$table->addRow();\r\n\t\t$table->addCol(\"You have requested to join mining operation #$runid. Please choose the shipclass \" .\r\n\t\t\"you are going to join up with.\");\r\n\t\t$table->addRow();\r\n\t\t$table->addCol(\"Shiptype: \" . $hiddenstuff . joinAs(), array (\r\n\t\t\t\"align\" => \"center\"\r\n\t\t));\r\n\t\t$table->addRow(\"#444455\");\r\n\t\t$table->addCol(\"<input type=\\\"submit\\\" name=\\\"submit\\\" value=\\\"Join mining operation\\\">\" . $form_end, array (\r\n\t\t\t\"align\" => \"center\"\r\n\t\t));\r\n\r\n\t\t$page = \"<h2>Join an Operation.</h2>\";\r\n\t\t$page .= \"<form action=\\\"index.php\\\" method=\\\"GET\\\">\";\r\n\t\t$page .= \"<input type=\\\"hidden\\\" name=\\\"id\\\" value=\\\"$runid\\\">\";\r\n\t\t$page .= \"<input type=\\\"hidden\\\" name=\\\"confirmed-ship\\\" value=\\\"true\\\">\";\r\n\t\t$page .= \"<input type=\\\"hidden\\\" name=\\\"confirmed\\\" value=\\\"true\\\">\";\r\n\t\t$page .= \"<input type=\\\"hidden\\\" name=\\\"multiple\\\" value=\\\"true\\\">\";\r\n\t\t$page .= \"<input type=\\\"hidden\\\" name=\\\"action\\\" value=\\\"joinrun\\\">\";\r\n\r\n\t\t$page .= ($table->flush());\r\n\t\t$page .= \"</form>\";\r\n\t\treturn ($page);\r\n\r\n\t}\r\n\r\n\t// Sanitize the Shiptype.\r\n\tglobal $SHIPTYPES;\r\n\t$ShiptypesCount = count($SHIPTYPES);\r\n\tif (!numericCheck($_GET[shiptype], 0, $ShiptypesCount)) {\r\n\t\tmakeNotice(\"The shiptype you tried to join up with is invalid, please go back, and try again.\", \"warning\", \"Shiptype invalid!\", \"index.php?action=show&id=$_GET[id]\");\r\n\t} else {\r\n\t\t$shiptype = $_GET[shiptype];\r\n\t}\r\n\t\r\n\t// Warn the user if he is already in another run.\r\n\t$joinedothers = $DB->query(\"select run from joinups where userid='$userid' and parted IS NULL order by run\");\r\n\r\n\t// And check for that just now.\r\n\tif ($joinedothers->numRows() > 0) {\r\n\t\tconfirm(\"You joined another mining operation already!<br>Are you sure you want to join multiple runs at the same time?\");\r\n\t}\r\n\r\n\t// Get the correct time to join (in case event hasnt started yet)\r\n\t$startOfRun = $DB->getCol(\"SELECT starttime FROM runs WHERE id='$runid' LIMIT 1\");\r\n\tif ($startOfRun[0] > $TIMEMARK) {\r\n\t\t$time = $startOfRun[0];\r\n\t} else {\r\n\t\t$time = $TIMEMARK;\r\n\t}\r\n\r\n\t// Dont allow him to join the same mining run twice.\r\n\tif (userInRun($MySelf->getID(), \"$runid\") == \"none\") {\r\n\r\n\t\t// Mark user as joined.\r\n\t\t$DB->query(\"insert into joinups (userid, run, joined, shiptype) values (?,?,?,?)\", array (\r\n\t\t\t\"$userid\",\r\n\t\t\t\"$runid\",\r\n\t\t\t\"$time\",\r\n\t\t\t\"$shiptype\"\r\n\t\t));\r\n\r\n\t\t// Forward user to his joined run.\r\n\t\tmakeNotice(\"You have joined the Mining Operation.\", \"notice\", \"Joining confirmed\", \"index.php?action=show&id=$id\");\r\n\r\n\t} else {\r\n\r\n\t\t// Hes already in that run.\r\n\t\tmakeNotice(\"You are already in that mining run!\", \"notice\", \"Joinup not confirmed\", \"index.php?action=show&id=$id\");\r\n\r\n\t}\r\n\r\n}", "public static function addGame() {\n\t\t$params = $_POST;\n\n\t\t$newGame = new Game(array(\n\t\t\t'name' => $params['name'],\n\t\t\t'url' => $params['url'],\n\t\t\t'desc' => $params['desc']\n\t\t\t));\n\n\t\t$errors = $newGame->errors();\n\n\t\tif (count($errors) == 0) {\n\t\t\t$gameId = $newGame->save();\n\t\t\t$accountId = parent::get_user_logged_in()->id;\n\t\t\tKint::dump(array($gameId, $accountId));\n\t\t\t$accountGame = new Account_game(array(\n\t\t\t\t'accountId' => $accountId,\n\t\t\t\t'gameId' => $gameId\n\t\t\t\t));\n\t\t\t$accountGame->save();\n\t\t\t$messages = array('game added');\n\t\t\tRedirect::to('/addGame', array('messages' => $messages));\n\t\t} else {\n\t\t\tRedirect::to('/addGame', array('errors' => $errors));\n\t\t}\n\t}", "function addGame($data){\r\n\t\t\treturn $this->insert($data);\r\n\t\t}", "public function join(){\n\t\t/* players, players_nick, scores, */\n $gameId = $this->input->post('gameId');\n $utoken = $this->input->post('utoken');\n\t\t$nick = $this->input->post('nick');\n\t\t$game = $this->setRedis_info($gameId);\n\t\tif(empty($game)){\n\t\t\t$this->setHeader(['registered'=>0, 'player_id'=>$utoken, 'nick'=>$nick, 'msg'=>'Invalid game id!'], 202);\n\t\t}else{\n\t\t\t$matrix = $game['matrix'];\n\t\t\t$admin = $game['admin'];\n\n\t\t\tif(!in_array($utoken, $game['players'])){\n\t\t\t\tif(count($game['players']) > 5){\n\t\t\t\t\t$this->setHeader(['registered'=>0, 'player_id'=>$utoken, 'nick'=>$nick, 'msg'=>'Game is full!'], 202);\n\t\t\t\t}\n\t\t\t\tif(in_array($game['status'], ['inPlay', 'completed'])){\n\t\t\t\t\t$this->setHeader(['registered'=>0, 'player_id'=>$utoken, 'nick'=>$nick, 'msg'=>'Cannot join...Game status: '.$game['status'].'!'], 202);\n\t\t\t\t}\n\t\t\t\tarray_push($game['players'], $utoken);\n\t\t\t\tarray_push($game['turn_seq'], $utoken);\n\t\t\t\t$game['scores'][$utoken] = 0;\n\t\t\t\t$game['players_nick'][$utoken] = $nick;\n\t\t\t\t$this->setRedis_set($gameId, $game);\n\t\t\t\t$this->setHeader(['registered'=>1, 'player_id'=>$utoken, 'nick'=>$nick, 'msg'=>'Succesfully joined the game!'], 200);\n\t\t\t}else{\n\t\t\t\t$this->setHeader(['registered'=>1, 'player_id'=>$utoken, 'nick'=>$nick, 'msg'=>'Succesfully joined the game!'], 200);\n\t\t\t}\n\t\t}\n\n }", "private function add_user_to_existing_game()\n {\n\n $number_of_existing_players = intval($this->gameUserCanPlay[\"number_of_players\"]) + 1;\n $this->number_of_players_in_current_user_game = $number_of_existing_players;\n $this->update_multiple_fields($this->games_table_name, [\"number_of_players\" => $number_of_existing_players], \"game_id ='{$this->gameIDUserCanPlay}'\");\n $this->update_multiple_fields($this->users_table_name, [\"game_id_about_to_play\" => $this->gameIDUserCanPlay], \"user_id='{$this->userID}'\");\n $this->game_10_words = $this->fetch_data_from_table($this->games_table_name , 'game_id' , $this->gameIDUserCanPlay)[0][\"words\"];\n $this->game_10_words = json_decode($this->game_10_words);\n\n /* if players are complete game should start */\n if ($number_of_existing_players == $this->config->MaximumNumberOfPlayers) {\n /* tell javascript that the game has started */\n $this->update_record($this->games_table_name, 'started', '1', 'game_id', $this->gameIDUserCanPlay);\n /* update current_game_id for all users in game */\n $this->update_record($this->users_table_name , 'current_game_id' , $this->gameIDUserCanPlay , 'game_id_about_to_play' , $this->gameIDUserCanPlay );\n /* Subtract the amount for all players */\n //$this->update_multiple_fields($this->users_table_name , ['account_balance' => \" account_balance - {$this->amount}\"] , \"game_id_about_to_play = '{$this->gameIDUserCanPlay}'\");\n /* Make sure all users point is set to 0 immediately game starts and ends*/\n // $this->executeSQL(\"UPDATE {$this->users_table_name} SET account_balance = cast(account_balance as int) - {$this->amount} WHERE game_id_about_to_play = '{$this->gameIDUserCanPlay}'\");\n $this->update_record($this->users_table_name , 'current_point' , 0 , 'game_id_about_to_play' , $this->gameIDUserCanPlay);\n $this->start_time = time() * 1000;\n $this->update_record($this->games_table_name , 'start_time' , $this->start_time , 'game_id' , $this->gameIDUserCanPlay);\n\n $this->showGameChat = true;\n\n }\n\n return true;\n }", "function mknewPerson($id) {\n $newID=uniqid (rand());\n //Wird zur Zeit nicht verwendet\n //if (!$id) {$uid='null';} else {$uid=$id;};\n $sql=\"insert into contacts (cp_name,cp_employee) values ('$newID',$id)\";\n $rc=$GLOBALS['dbh']->query($sql);\n if ($rc) {\n $sql=\"select cp_id from contacts where cp_name = '$newID'\";\n $rs=$GLOBALS['dbh']->getAll($sql);\n if ($rs) {\n $id=$rs[0][\"cp_id\"];\n } else {\n $id=false;\n }\n } else {\n $id=false;\n }\n return $id;\n}", "function createNewGame($deckid) {\n\t\t\n\t\t// allow access to database connection variable\n\t\tglobal $dbconn;\n\t\t\n\t\t// ensure we have a valid deck id\n\t\tif ($deckid === \"\") {\n\t\t\treturn message(-1, \"Cannot create a high score record without a valid deck id.\");\n\t\t}\n\t\t\n\t\t// insert the new game record\n\t\t$query = \"INSERT INTO highscore (deckid, username, highscore) VALUES ($1, $2, 0)\";\n\t\t$stmnt = pg_prepare($dbconn, \"newGame\", $query);\n\t\t$result = pg_execute($dbconn, \"newGame\", array($deckid, $_SESSION[\"username\"]));\n\t\t\n\t\t// ensure there were no query errors\n\t\tif (!$result) {\n\t\t\treturn message(-1, \"Error executing query against the database.\");\n\t\t}\n\t\t\n\t\t// ensure a record was inserted, if not, one already exists\n\t\tif (pg_affected_rows($result) == 0) {\n\t\t\treturn message(1, \"High score record for deck not created\");\n\t\t}\n\t\t\n\t\t// return success\n\t\treturn message(1, \"High score record for deck created successfully\");\n\t\t\n\t}", "function addUserToGame($userId,$gameId){\r\n\t\t$SQLerror = '';\r\n\t\t$currentDate = date(\"Y\\-m\\-d\");\r\n\t\t$queryCheckIfExists = \"SELECT * FROM gameMembers WHERE userId=\".$userId.\" AND gameId=\".$gameId;\r\n\t\t\r\n\t\t// return if user is already member of that game\r\n\t\tmysql_query($queryCheckIfExists) or $SQLerror = $query.mysql_error().\" \".$query;\r\n\t\tif($SQLerror!='')\r\n\t\t\treturn json_encode(array(\"error\"=>$SQLerror));\t\t\r\n\r\n\t\tif(mysql_affected_rows() > 0)\r\n\t\t\treturn \"true\";\r\n\t\telse {\r\n\t\t\t// Continue if user is not a member of that game\r\n\t\t\t$query = \"INSERT INTO gameMembers (gameId,userId,joined)\".\r\n\t\t\t\t\t\t\"VALUES ('\".$gameId.\"','\" .$userId. \"','\" .$currentDate.\"')\";\r\n\r\n\t\t\t$result = mysql_query($query) or $SQLerror = $query.mysql_error().\" \".$query;\r\n\t\t\t\tif($SQLerror!='')\r\n\t\t\t\t\treturn json_encode(array(\"error\"=>$SQLerror));\t\t\r\n\r\n\t\t\tif(mysql_affected_rows() == 1)\r\n\t\t\t\treturn \"true\";\r\n\t\t\telse\r\n\t\t\t\treturn \"false\";\r\n\t\t}\r\n\t}", "function join_other_room(){\n\t\tglobal $db, $prefix, $txt, $print;\n\n\t\t// See if hte room exists\n\t\t$query = $db->DoQuery(\"SELECT * FROM {$prefix}rooms WHERE name='$_POST[rname]'\");\n\t\t$row = $db->Do_Fetch_Row($query);\n\n\t\tif($row == \"\"){\n\t\t\t// Tell them they are stupid and that room doesn't exist\n\t\t\t$body = \"<div align=\\\"center\\\">$txt[386]<Br><Br><a href=\\\"./index.php\\\">$txt[77]</a></div>\";\n\t\t}else{\n\t\t\t// Give them a link to join that room\n\t\t\t$txt[387] = eregi_replace(\"<a>\",\"<a href=\\\"index.php?act=frame&room=$_POST[rname]\\\">\",$txt[387]);\n\t\t\t$body = $txt[387];\n\t\t}\n\n\n\t\t$print->normal_window($txt[29],$body);\n\t}", "private function createUniqueId() {\n\t\t\t// pool\n\t\t\t$chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\";\n\t\t\t$length =rand(10, 30);\n\t\t\t// start creation\n\t\t\tsrand((double)microtime()*1000000);\n\t\t\t$i = 0; \n\t\t\t$rndStr = \"\";\n\t\t\twhile ($i < $length) { \n\t\t\t\t\t$num = rand() % strlen($chars);\n\t\t\t\t\t$tmp = substr($chars, $num, 1);\n\t\t\t\t\t$rndStr = $rndStr . $tmp;\n\t\t\t\t\t$i++;\n\t\t\t}\n\t\t\treturn $rndStr;\n\t\t}", "public function join($id)\n\t{\n\t\t$group = Group::find($id);\n\n\t\tif($group) {\n\n\t\t\tif(Auth::user()->getUsername() == $group->creator) {\n\t\t\t\tSession::flash('info_message', 'You are the creator of the group!');\n\t\t\t\treturn redirect(route('groups.show', [$group->id]));\n\t\t\t}\n\n\t\t\t$user_id = Auth::user()->getId();\n\n\t\t\t$userJoined = DB::select(\"select user_id from group_user where user_id = $user_id and group_id = $group->id\");\n\n\t\t\tif (empty($userJoined)) {\n\t\t\t\t$group->users()->attach(Auth::user()->getId());\n\n\t\t\t\tSession::flash('message', 'Joined Group!');\n\t\t\t\treturn redirect(route('groups.show', [$group->id]));\n\n\t\t\t} else {\n\t\t\t\tSession::flash('info_message', 'You are already in this group!');\n\t\t\t\treturn redirect(route('groups.show', [$group->id]));\n\t\t\t}\n\n\t\t} else {\n\t\t\tSession::flash('info_message', 'No such group!');\n\t\t\treturn redirect(route('groups.index'));\n\t\t}\n\t}", "function createRoom(){\n\t\t$roomid = (int)$_POST['roomid'];\n\t\tif($roomid < 0){ throw new Exception('Invalid player');}\n\t\t$session = @mt_rand(0,99999999999);\n\t\tglobal $db;\n\t\t$q = $db -> prepare(\"SELECT * FROM game WHERE roomid = ? LIMIT 1\");\n\t\t$q->execute(array($roomid));\n\t\t$r = $q->fetch();\n\t\tif($r == null){\n\t\t\t$q = $db -> prepare(\"INSERT INTO game (sessionid,roomid,cardnorth,cardeast,cardsouth,cardwest) VALUES(?,?,?,?,?,?)\");\n\t\t\t$q->execute(array($session,$roomid,'0','0','0','0'));\n\t\t\t$q = $db -> prepare(\"INSERT INTO session (roomid, timer, hand, done, ready) VALUES(?,?,?,?,?)\");\n\t\t\t$q->execute(array($roomid,'0','0','0','0'));\t\t\t\n\t\t}\n\t\treturn true;\n\t}", "function joinGame ($date_insc, $partie, $index_equipe, $joueur, $password) {\n\tglobal $bdd;\n\t$result = false;\n\t\n\t$ancienneEquipe = equipeAncienneInscriptionPartie ($partie,$joueur);\n\tif($ancienneEquipe!=0)\n\t\t$equipe=$ancienneEquipe;\n\telse\n\t\t$equipe=$index_equipe;\n\n\t// Verif : la partie existe\n\t$verif = $bdd->prepare('\n\t\tSELECT id_partie, password\n\t\tFROM parties \n\t\tWHERE id_partie = :partie');\n\t$verif->execute(array(\n\t\t\t\t'partie' => $partie\n\t\t\t));\n\tif ($row = $verif->fetch()) {\n\t\t// Verif : Le mot de passe est correct\n\t\tif(sha1($password) == $row['password'] || $row['password'] === NULL) {\n\t\t\t// Verif : Le joueur existe\n\t\t\t$verif2 = $bdd->prepare('\n\t\t\t\tSELECT id_joueur\n\t\t\t\tFROM joueurs \n\t\t\t\tWHERE id_joueur = :joueur');\n\t\t\t$verif2->execute(array(\n\t\t\t\t\t'joueur' => $joueur\n\t\t\t));\n\t\t\tif ($row2 = $verif2->fetch()) {\n\t\t\t\ttry {\n\t\t\t\t\t// Insertion\n\t\t\t\t\t$req = $bdd->prepare('\n\t\t\t\t\t\tINSERT INTO inscriptions (date_inscription, partie, equipe, joueur) \n\t\t\t\t\t\tVALUES (:date_insc, :partie, :equipe, :joueur)');\n\t\t\t\t\t$req->execute(array(\n\t\t\t\t\t\t'date_insc' => $date_insc,\n\t\t\t\t\t\t'partie' => $partie,\n\t\t\t\t\t\t'equipe' => $equipe,\n\t\t\t\t\t\t'joueur' => $joueur\n\t\t\t\t\t));\n\t\t\t\t\t$result = true;\n\t\t\t\t} catch (Exception $e) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn $result;\n}", "function addGame()\n {\t\n\t\t$uid = $_SESSION['uid'];\n\t\t$gid = time();\n\t\t$ct = $_POST['country'];\n $query = \"INSERT INTO games(gid, year, season, running, players)\n VALUES($gid, 1901, 's', false, 1);\";\n \n $result = mysql_query($query) or die(\"db access error\" . mysql_error());\n \n $query = \"INSERT INTO in_game(uid, gid, country)\n VALUES('$uid', $gid, '$ct');\";\n \n $result = mysql_query($query) or die(\"db access error\" . mysql_error());\n \n $this->addStartUnits($ct, $gid, $uid);\n\t}" ]
[ "0.6650937", "0.6349432", "0.6175855", "0.6061047", "0.598846", "0.5816179", "0.5740137", "0.5719858", "0.5698816", "0.56089544", "0.5540726", "0.5518419", "0.54598254", "0.54209864", "0.54039454", "0.533514", "0.53332454", "0.53279835", "0.53269917", "0.531378", "0.53016585", "0.52900195", "0.5271362", "0.52475214", "0.52468747", "0.5241261", "0.5240418", "0.519736", "0.5195712", "0.5189342" ]
0.7476717
0
Leave the game with the specified ID or delete it if called by the last player
function leaveGame($gameID, $playerName) { // If $gameID empty, ignore if ($gameID === '') { http_response_code(400); die('GAME ID MISSING'); } // Otherwise, leave game $dbh = connectToDatabase(); if (playerIsGM($gameID, $playerName)) { $stmt = $dbh->prepare('UPDATE games SET isPlaying = 0 WHERE gameID = ?'); if ($stmt->execute([$gameID])) { // All good, keep going } else { http_response_code(500); die('UNABLE TO STOP GAME'); } } $stmt = $dbh->prepare('SELECT players FROM games WHERE gameID = ?'); $stmt->execute([$gameID]); $result = $stmt->fetch(PDO::FETCH_NUM); if (count($result) <= 0) { // Wait, there is no game with that ID http_response_code(404); die('GAME NOT FOUND'); } // There should be only one game with this ID, so join first one with matched ID $data = $result[0]; $players = json_decode($data, true); if (count($players) === 1) { // We are the last player in the game, remove the DB entry $stmt = $dbh->prepare('DELETE FROM games WHERE gameID = ?'); if ($stmt->execute([$gameID])) { exit('DELETED'); } else { http_response_code(500); die('UNABLE TO DELETE GAME'); } } // Otherwise, remove this player to the players array, and insert back into the entry if (($key = array_search($playerName, $players)) !== false) { unset($players[$key]); $players = array_values($players); } $playersData = json_encode($players); $stmt = $dbh->prepare('UPDATE games SET players = ? WHERE gameID = ?'); if ($stmt->execute([$playersData, $gameID])) { // Signal the client that they have disconnected exit('DISCONNECTED'); } else { http_response_code(500); die('UNABLE TO LEAVE GAME'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function leave(Request $request, $id)\n {\n $userId = $request->user()->id;\n $leagueAdminId = League::findOrFail($id)->league_admin_id;\n\n // Ensure user isn't league admin\n if($userId == $leagueAdminId){\n return back()->with('error', 'You cannot leave a league you are the administrator of.');\n };\n\n // Remove user's team record\n $team = Team::where([\n 'manager_id' => $userId,\n 'league_id' => $id,\n ]);\n $team->delete();\n\n return redirect(route('my-leagues.index'))->with('status', 'You left the league successfully.');\n }", "public function closeGame()\n\t{\n\t\t$playerX = $this -> playerX;\n\t\t$playerO = $this -> playerO;\n\t\t$query = \"DELETE FROM tttGame \n\t\t\t\t WHERE playerX = '$playerX' \n\t\t\t\t AND playerO = '$playerO';\";\n\t\t$this -> queryDB($query);\n\t}", "public function deleteGame($id)\n {\n $this->db->where('ID_GAMES', $id);\n $this->db->delete('games');\n }", "private function exit_user_from_game() {\n //increments the user account_balance, since the amount was already deducted at game start\n $this->executeSQL(\"UPDATE {$this->users_table_name} SET account_balance = cast(account_balance as int) + {$this->amount} WHERE user_id = '{$this->userID}'\");\n\n /*This gets the user current game details*/\n $this->userCurrentGameDetail = $this->fetch_data_from_table($this->games_table_name, 'game_id', $this->user_details[\"game_id_about_to_play\"])[0];\n\n /* Gets the number of players in the game */\n $number_of_players = (int)$this->userCurrentGameDetail[\"number_of_players\"];\n\n /* the new number of players will now be the previous number of players - 1*/\n $new_number_of_players = $number_of_players - 1;\n /* if the new number of players is equal to 0; meaning that he is the only one about to play; the entire game details will be deleted from the database*/\n if($new_number_of_players == 0){ $this->delete_record($this->games_table_name , \"game_id\" , $this->user_details[\"game_id_about_to_play\"] ); return true;}\n /* else set the new number of players to the one above */\n $this->update_record($this->games_table_name , \"number_of_players\" , $new_number_of_players , 'game_id' , $this->userCurrentGameDetail[\"game_id\"]);\n /* delete the game id from the user detail to avoid deduction from the when the game starts */\n $this->update_record($this->users_table_name , \"game_id_about_to_play\" , \"0\" , 'user_id' , $this->userID);\n /* finally return true */\n return true;\n }", "public function leaveGroup($id){\n try{\n $decryptGroup = Crypt::decrypt($id);\n $group = Group::findOrFail($decryptGroup);\n $groupMem = GroupMember::where('group_id', '=', $decryptGroup)->where('user_id', '=', \\Auth::user()->id)->delete();\n $hasMember = count(GroupMember::where('group_id', '=', $group->id)->get());\n\n if($hasMember == 0){\n $deleteGroup = Group::where('id', '=', $group->id)->delete();\n }\n // $groupMem = GroupMember::where('group_id', '=', $decryptGroup)->where('user_id', '=', \\Auth::user()->id)->update(array('is_removed' => 1));\n\n\n return redirect('/group')->with(compact('group'))->with('message', 'You have left your group: '.$group->group_name);\n\n }catch(DecryptException $e){\n return view('errors.404');\n }\n }", "public function destroygame($id)\n {\n if(Auth::user()->is_admin == 1)\n {\n $path = Game::find($id)->image;\n if(Storage::exists($path)){\n Storage::delete($path);\n }\n \n DB::table('games')->where('id', '=', $id)->delete();\n\n return redirect('indexgames');\n }else{\n return view('portada');\n }\n }", "public function destroy($id)\n {\n $game = Game::find($id);\n //check for correct user\n if((auth()->user()->id !==$game->user_id) and (auth()->user()->role !== 'Admin')) {\n return redirect('/games')->with('error', 'neautorizēta pieeja');\n }\n\n $game->delete();\n return redirect('/games')->with('success', 'Spēle noņemta');\n }", "public function destroy($id)\n {\n return Game::delete($id);\n }", "public function leave()\n {\n auth()->user()->leavePlayer();\n\n return response()->json(null, 200);\n }", "private function endGame()\n {\n $this->hasWon = true;\n $this->calculatePoints();\n $this->setMessageToPlayer();\n }", "public function destroy($id)\n {\n $game = Game::find($id);\n $game->delete();\n return redirect('/games')->with('success','Eveniment anulat!');\n }", "function joinGame($gameID, $playerName)\n{\n $dbh = connectToDatabase();\n\n if (!$gameID) {\n\n // Check that there is no game already using this ID\n $gameIDIsUnique = true;\n // If $gameID empty, create new game\n $gameID = newGameID();\n // Count number of rows with $gameID\n $stmt = $dbh->prepare('SELECT COUNT(1) FROM games WHERE gameID = ?');\n do {\n $stmt->execute([$gameID]);\n $result = $stmt->fetch(PDO::FETCH_NUM);\n if ($result[0] > 0) {\n // Wait, there is a game already using this ID. Try again\n $gameIDIsUnique = false;\n }\n } while (!$gameIDIsUnique);\n\n // First player in a game becomes the GM\n $playersData = json_encode([$playerName]);\n $gameData = json_encode(new stdClass);\n $stmt = $dbh->prepare(\"INSERT INTO games VALUES (?, ?, ?, ?, 0, NOW())\");\n if ($stmt->execute([$gameID, $playersData, $gameData, $playerName])) {\n // Now, send new gameID back to the host player\n exit($gameID);\n } else {\n http_response_code(500);\n die('GAME NOT CREATED');\n }\n } else {\n // Otherwise, join game with passed gameID\n // Get whatever players are now in the database\n $stmt = $dbh->prepare('SELECT players FROM games WHERE gameID = ?');\n $stmt->execute([$gameID]);\n $result = $stmt->fetch(PDO::FETCH_NUM);\n if (count($result) <= 0) {\n // Wait, there is no game with that ID\n http_response_code(404);\n die('GAME NOT FOUND');\n }\n\n // There should be only one game with this ID, so join first one with matched ID\n $players = json_decode($result[0], true);\n // Add this player to the players array, and insert back into the entry\n array_push($players, $playerName);\n $playersData = json_encode($players);\n\n $stmt = $dbh->prepare('UPDATE games SET players = ? WHERE gameID = ?');\n\n if ($stmt->execute([$playersData, $gameID])) {\n // Signal the client that the game is ready\n exit('PLAYER');\n } else {\n http_response_code(500);\n die('NOT JOINED GAME');\n }\n }\n\n // Now store the gameID in $_SESSION, so that we stay connected until the browser is closed\n $_SESSION['gameID'] = $gameID;\n $_SESSION['playerName'] = $playerName;\n}", "private function leaveGroup()\n {\n try\n {\n $request = $_POST;\n\n if(!isset($request['group_id']) || $request['group_id']==\"\" )\n throw_error_msg('provide group id');\n else if(!is_numeric($request['group_id'])) \n throw_error_msg('invalid group id'); \n else\n $gid = (int)$request['group_id'];\n\n if(!userid())\n throw_error_msg(lang(\"you_not_logged_in\")); \n else \n $uid = userid(); \n \n global $cbgroup; \n $id = $cbgroup->leave_group($gid,$uid);\n\n if( msg())\n {\n $data = array('code' => \"200\", 'status' => \"success\", \"msg\" => 'left group successfully', \"data\" => array());\n $this->response($this->json($data));\n }\n\n if( error() )\n {\n throw_error_msg(error('single')); \n }\n }\n catch(Exception $e)\n {\n $this->getExceptionDelete($e->getMessage());\n }\n }", "public function delete_gamelink()\n\t\t{\n\t\t\treturn null;\n\t\t}", "public function leaveRoom()\n\t{\n\t\t//get current login user session\n\t\t$user = $this->Session->read('UserData.userName');\n\t\t$userCourse = $this->Session->read('UserData.usersCourses');\n\t\t$user_course_section = $userCourse[0];\n\n\t\t//get Course and section name\n\t\t$course_info = $this->getCourseNameOfUser($user_course_section);\n\t\t$course_name = $course_info->course_name;\n\t\t$course_section = $course_info->section_name;\n\t\t$data = $this->request->data;\n\t\t$group_name = $data['roomName'];\n\t\t$this->MeetingUser->updateAll(\n\t\t\t\tarray('MeetingUser.is_attend' => 0),\n\t\t\t\tarray('MeetingUser.chat_meeting_name' => $group_name, 'MeetingUser.to_user'=>$user)\n\t\t);\n\t\t//counting if any meeting chat is going on for the same group.\n\t\t$count = $this->MeetingUser->find('count', array('conditions'=>array('MeetingUser.chat_meeting_name' => $group_name, 'MeetingUser.is_attend'=> 1)));\n\t\tif(!$count)\n\t\t\t$this->MeetingInfo->updateAll(\n\t\t\t\t\tarray('MeetingInfo.is_active' => 0),\n\t\t\t\t\tarray('MeetingInfo.chat_meeting_name' => $group_name)\n\t\t\t);\n\t\techo \"true\";\n\t\texit;\n\t}", "public function destroy($id)\n {\n Game::destroy($id);\n return redirect(route('home'));\n }", "public function destroy($id)\n {\n $game_history = Game_History::find($id);\n if(is_null($game_history)) {\n Session::flash('message','game_history not found.');\n return redirect('/game_histories');\n }\n\n\t\t\n $game_history->delete();\n # Finish\n Session::flash('flash_message','Session '. $game_history->id.' was deleted.');\n return redirect('/game_histories');\n }", "public function delete($id) {\n // Delete the game\n // \n $game = $this->find($id);\n $logo = $game->getLogo();\n $bg = $game->getBackground();\n\n $this->imageDAO->deleteImage($logo);\n $this->imageDAO->deleteImage($bg);\n\n $this->getDb()->delete('game', array('game_id' => $id));\n }", "public function destroy_game()\n {\n $player = Player::findOrFail(Input::json('player_id'));\n $game = Game::findOrFail(Input::json('game_id'));\n\n if (!$player->admin) {\n return Response::make('Not authorized', 403);\n }\n\n $game->delete();\n }", "public function leave_resump_userid($id){\r\n\t\r\n\t$user_id = $this->data_client->leave_resump_userid($id);\r\n\treturn $user_id;\r\n\t}", "public function destroy($id)\n {\n $game = Game::findOrFail($id);\n if ($game->previewImg) {\n $deletePath = base_path() . '/public/img/games/' . $game->previewImg;\n if (File::exists($deletePath)) {\n File::delete($deletePath);\n }\n }\n\n Game::destroy($id);\n Session::flash('flash_message', 'بازی مورد نظر حذف گردید');\n return redirect('admin/games');\n }", "public function setGameId($id){\n $this->game->setGameId($id);\n }", "public function leaveGroup($id, Request $request)\n {\n $user_id = auth() -> user() -> id;\n $group = Group::findOrFail($id);\n $membership = $group -> userRelations() -> wherePivot('user_id', $user_id) -> first()['pivot'];\n \n if (sizeof($membership) == 0)\n {\n unset($user_id, $group, $membership);\n return redirect() -> action('GroupController@dashboard');\n }\n $membership -> delete();\n\n unset($user_id, $membership);\n return redirect() -> action('GroupController@dashboard') -> with('success', __('messages.group_leave') . $group -> name);\n }", "public function destroy($id)\n {\n if (! Gate::allows('game_delete')) {\n return abort(401);\n }\n $game = Game::findOrFail($id);\n $game->delete();\n\n return redirect()->route('games.index');\n }", "function leaveRoom(Room $room): Promise;", "public function destroy($id)\n {\n $game = Game::findOrFail($id);\n\n $game->forceDelete();\n\n return redirect()->route('manager.dashboard')->with([\n 'success-message' => 'Game #'.$id.' has been removed',\n ]);\n }", "public function destroy($id)\n {\n Leave::findOrFail($id)->delete();\n return redirect()->back()->with('success','Leave deleted successfully !');\n }", "function leaveChat($chatID) {\n global $bot;\n\n return $bot->TelegramApi(\"leaveChat\", array(\"chat_id\" => $chatID));\n}", "function remove()\n {\n $gameId = $this->registry->params[0];\n\n if (isset($gameId, $_SESSION['cart'])) {\n Util::deleteElement($gameId, $_SESSION['cart']);\n }\n\n $count = 0;\n for ($index = 0; $index < sizeof($_SESSION['cart']); $index++) {\n $count++;\n if ($_SESSION['cart'][$index][0] == $gameId) {\n unset($_SESSION['cart'][$index]);\n }\n }\n if($count == 0){\n unset($_SESSION['cart']);\n }\n\n header(\"Location: /cart\");\n }", "function leave(&$irc, &$data)\n\t{\n\t\tglobal $pickup;\n\t\tglobal $users;\n\t\tglobal $irc;\n\t\tglobal $pickupchannel;\n\t\tglobal $pickup;\n\t\tglobal $pickupstatus;\n\n\t\t//Get data\n\t\t$nick = $data->nick;\n\t\t$qauth = $users->nicktoqauth($nick);\n\n\t\t//Remove from pickup\n\t\tif($pickup->is_added($qauth) == true)\n\t\t{\n\t\t\t$pickup->rm_player($qauth);\n SetTopic();\n\t\t}\n\n\t\t//Mark the user out the channel\n\t\t$users->mark_outchannel($qauth);\n\t}" ]
[ "0.64284134", "0.63772726", "0.6266195", "0.6263336", "0.6150872", "0.61379075", "0.6040208", "0.60167336", "0.5949734", "0.5905429", "0.5863817", "0.5853786", "0.5831699", "0.5794543", "0.57802737", "0.57713324", "0.57327783", "0.57167774", "0.57003206", "0.5691744", "0.56636924", "0.5648473", "0.5646761", "0.56391364", "0.55842036", "0.55813956", "0.55783117", "0.55645615", "0.5551773", "0.549972" ]
0.7176326
0
Create a new 3 letter string to use as gameID
function newGameID() { return randomString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function make_id () {\n // http://sourceforge.net/projects/phunction/\n return sprintf('%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));\n }", "function generatePopId($length = 3) {\n $characters = '123456789';\n $randomString = '';\n for ($i = 0; $i < $length; $i++) {\n $randomString .= $characters[rand(0, strlen($characters) - 1)];\n }\n return $randomString;\n }", "private function id($length = 10) {\n $key = '';\n $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n for ($i = 0; $i < $length; $i++)\n $key .= $chars[rand(0, strlen($chars) - 1)];\n return $key;\n }", "static function newGuid() { \n $s = strtoupper(md5(uniqid(rand(),true))); \n $guidText = \n substr($s,0,8) . '-' . \n substr($s,8,4) . '-' . \n substr($s,12,4). '-' . \n substr($s,16,4). '-' . \n substr($s,20); \n return strtolower($guidText);\n }", "function make_name($length){\n return substr(str_repeat(md5(rand()), ceil($length/32)), 0, $length);\n }", "private function generateId(int $length = 4): string\n {\n return base_convert(time(), 10, 36) . '-' . base_convert(mt_rand(0, pow(36, $length)), 10, 36);\n }", "private function createUniqueId() {\n\t\t\t// pool\n\t\t\t$chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\";\n\t\t\t$length =rand(10, 30);\n\t\t\t// start creation\n\t\t\tsrand((double)microtime()*1000000);\n\t\t\t$i = 0; \n\t\t\t$rndStr = \"\";\n\t\t\twhile ($i < $length) { \n\t\t\t\t\t$num = rand() % strlen($chars);\n\t\t\t\t\t$tmp = substr($chars, $num, 1);\n\t\t\t\t\t$rndStr = $rndStr . $tmp;\n\t\t\t\t\t$i++;\n\t\t\t}\n\t\t\treturn $rndStr;\n\t\t}", "function generateID($length = 20)\n{\n $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $randomString = '';\n for ($i = 0; $i < $length; $i++) {\n $randomString .= $characters[rand(0, strlen($characters) - 1)];\n }\n return $randomString;\n}", "private function getBoardNewName()\n {\n return substr(md5(rand(1000, 9999999)), 0, 20);\n }", "private function generateTransactionID() {\n $pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $maxlen = strlen($pattern) - 1;\n\n $id = '';\n for ($i = 1; $i <= 6; $i++)\n $id .= $pattern{mt_rand(0, $maxlen)};\n\n return $id;\n }", "protected function getId($length = 6) : string\n {\n $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n return substr(str_shuffle(str_repeat($pool, 5)), 0, $length);\n }", "function shortcode()\n{\n\t//$uuid = substr($chars,0,3) . rand(100,999);\n\t$uuid = rand(100,999) . rand(100,999) . rand(100,999);\n\treturn strtoupper($uuid);\n}", "function cjpopups_unique_string(){\n\t$unique_string = sprintf(\n\t\t\"%04s%03s%s\", base_convert(mt_rand(0, pow(36, 4) - 1), 10, 36), base_convert(mt_rand(0, pow(36, 3) - 1), 10, 36), substr(sha1(md5(strtotime(date('Y-m-d H:i:s')))), 7, 3)\n );\n return strtoupper($unique_string);\n}", "public function createRandInt(){\n\n $new = '';\n srand((double)microtime() * 1000000);\n $char_list = \"1234567890\";\n\n for ($i = 0; $i < 8; $i++) {\n\n $new .= substr($char_list, (rand() % (strlen($char_list))), 1);\n\n }\n\n return $new;\n\n }", "function generate_external_id($length = 64) {\n\t $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\t $charactersLength = strlen($characters);\n\t $randomString = '';\n\t for ($i = 0; $i < $length; $i++) {\n\t $randomString .= $characters[rand(0, $charactersLength - 1)];\n\t }\n\t return $randomString;\n\t}", "protected function make_uid()\n\t{\n\t\t$date = date('Ymd\\THisT');\n\t\t$unique = substr(microtime(), 2, 4);\n\t\t$base = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPrRsStTuUvVxXuUvVwWzZ1234567890';\n\t\t$start = 0;\n\t\t$end = strlen( $base ) - 1;\n\t\t$length = 6;\n\t\t$str = null;\n\t\tfor( $p = 0; $p < $length; $p++ )\n\t\t{\n\t\t\t$unique .= $base{mt_rand( $start, $end )};\n\t\t}\n\t\treturn $date . '-' . $unique . ($this->num_to_letter(++$this->uid_counter));\n\t}", "public\tfunction sp_build_order_no()\n\t{\n mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.\n $uuid = strtoupper(md5(uniqid(rand(), true)));\n // $uuid = substr($charid, 0, 8)\n // .substr($charid, 8, 4)\n // .substr($charid,12, 4)\n // .substr($charid,16, 4)\n // .substr($charid,20,12);\n return $uuid;\n\t}", "static function uniqueID()\n {\n return substr(str_pad(str_replace('.', '', microtime(true)), 12, 0), 0, 12);\n }", "private function generateKey(): string\n\t{\n\t\t// `+` and `/` are replaced by `-` and `_`, resp.\n\t\t// The other characters (a-z, A-Z, 0-9) are legal within an URL.\n\t\t// As the number of bytes is divisible by 3, no trailing `=` occurs.\n\t\treturn strtr(base64_encode(random_bytes(3 * self::RANDOM_ID_LENGTH / 4)), '+/', '-_');\n\t}", "public static function generateID()\n {\n static $sequence = 0;\n list($mt, $tm) = explode(\" \", microtime());\n return strftime('%Y%m%d@%H%M%S', $tm )\n .sprintf(\".%03d\",(int)($mt*1000))\n .'/'\n .sprintf(\"%08x\",mt_rand())\n .':'\n .sprintf(\"%04x\", ++$sequence );\n }", "private function generateId()\n {\n $startHex = dechex((int)$this->startTime);\n $uuid = bin2hex(random_bytes(12));\n\n return \"1-{$startHex}-{$uuid}\";\n }", "static function GenerateID($digits = 5){\n $chars=\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ\";\n $result = \"\";\n for ($i = 0; $i < $digits; $i++){\n $result .= $chars[rand(0,strlen($chars)-1)];\n }\n return $result;\n }", "public static function makeGuid()\n {\n if (function_exists('com_create_guid')) {\n return strtolower(trim(com_create_guid(), '{}'));\n } else {\n $charid = strtolower(md5(uniqid(rand(), true)));\n $hyphen = chr(45);\n $uuid = substr($charid, 0, 8) . $hyphen\n . substr($charid, 8, 4) . $hyphen\n . substr($charid, 12, 4) . $hyphen\n . substr($charid, 16, 4) . $hyphen\n . substr($charid, 20, 12);\n\n return $uuid;\n }\n }", "public static function createGUID() {\r\n if (function_exists('com_create_guid')) {\r\n return substr(com_create_guid(), 1, 36);\r\n }\r\n else {\r\n mt_srand((double) microtime() * 10000);\r\n $charid = strtoupper(md5(uniqid(rand(), true)));\r\n $hyphen = chr(45);\r\n $uuid = substr($charid, 0, 8) . $hyphen .\r\n substr($charid, 8, 4) . $hyphen .\r\n substr($charid, 12, 4) . $hyphen .\r\n substr($charid, 16, 4) . $hyphen .\r\n substr($charid, 20, 12);\r\n\r\n return $uuid;\r\n }\r\n }", "function generateId(){\n $a = date('Ymd');\n $b = rand(1000, 9999);\n $c = rand(100, 999);\n $d = $a.$b.$c;\n if(strlen($d) !== 15){\n return str_pad($d, 15, '0', STR_PAD_RIGHT);\n }\n return $d;\n}", "function generate_uid($length=8) {\r\n\t$allChars = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9','_');\r\n\tfor($i=0;$i<$length;$i++) \r\n\t\t$uid.=$allChars[rand(0,62)];\r\n\treturn $uid;\r\n}", "public static function generateJournalId() {\n $value = random_bytes(24);\n\n $data = substr(base64_encode($value), 0, 32);\n $data = str_replace(array('+','/','='), array('-','_',''), $data);\n return $data;\n }", "function id_gen($str=''){\n\t$pats = array('/','+');\n\t$subs = array('_','-');\n\treturn str_replace($pats,$subs,substr(base64_encode(md5($str,true)),0,22));\n}", "function gen_ID($prefix='', $length=10, $strength=0)\n{\n $final_id='';\n for ($i=0;$i< $length;$i++) {\n $final_id .= mt_rand(0, 9);\n }\n if ($strength == 1) {\n $final_id = mt_rand(100, 999).$final_id;\n }\n if ($strength == 2) {\n $final_id = mt_rand(10000, 99999).$final_id;\n }\n if ($strength == 4) {\n $final_id = mt_rand(1000000, 9999999).$final_id;\n }\n return $prefix.$final_id;\n}", "function CriaCodigo() { //Gera numero aleatorio\r\n for ($i = 0; $i < 40; $i++) {\r\n $tempid = strtoupper(uniqid(rand(), true));\r\n $finalid = substr($tempid, -12);\r\n return $finalid;\r\n }\r\n }" ]
[ "0.71837056", "0.6810796", "0.6727847", "0.67093486", "0.6697293", "0.6620383", "0.6557908", "0.6537767", "0.6515797", "0.651169", "0.64956707", "0.64827114", "0.64050347", "0.6390086", "0.6387255", "0.6370516", "0.6363806", "0.6351139", "0.63249147", "0.6248654", "0.62432903", "0.6231529", "0.6226783", "0.6215431", "0.6205837", "0.61953765", "0.61912745", "0.61757344", "0.6166734", "0.61627674" ]
0.7160302
1
Check if the player is the GM
function playerIsGM($gameID, $playerName) { $dbh = connectToDatabase(); $stmt = $dbh->prepare('SELECT gmName FROM games WHERE gameID = ?'); $stmt->execute([$gameID]); $result = $stmt->fetch(PDO::FETCH_NUM); if (count($result) <= 0) { // Wait, there is no game with that ID http_response_code(404); die('GAME NOT FOUND'); } $isGM = $result[0] === $playerName; return $isGM; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isplayer()\n\t{\n\t\treturn $this->Players->isplayer($this->SqueezePlyrID);\n\t}", "public function isUserPlayer()\n\t{\n\t\treturn (Bn::getValue('user_type') == 'P');\n\t}", "private function isGod() : bool\n {\n return $this->user->id === 1;\n }", "function amap_ma_check_if_membersmap_gm_enabled() {\n if (!elgg_is_active_plugin(\"membersmap\")) {\n return false;\n }\n \n $gm_membersmap = trim(elgg_get_plugin_setting('gm_membersmap', AMAP_MA_PLUGIN_ID));\n\n if ($gm_membersmap == AMAP_MA_GENERAL_YES && elgg_is_active_plugin('membersmap')) {\n return true;\n }\n\n return false;\n}", "public function isMe(Player $player){\n\t\tif($this->session->getPlayerID() == $player->getID()){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public function isPlayer()\r\n\t{\r\n\t\t\treturn count($this->getPlayerProfiles()) > 0;\r\n\t}", "private function isGod() : bool\n {\n return $this->role('god');\n }", "function amap_ma_check_if_groupsmap_gm_enabled() {\n if (!elgg_is_active_plugin(\"groupsmap\")) {\n return false;\n }\n \n $gm_groupsmap = trim(elgg_get_plugin_setting('gm_groupsmap', AMAP_MA_PLUGIN_ID));\n\n if ($gm_groupsmap == AMAP_MA_GENERAL_YES && elgg_is_active_plugin('groupsmap')) {\n return true;\n }\n\n return false;\n}", "public function setGameMaster($gm)\n\t{\n\t\tif ($this->_ended)\n\t\t\treturn [\"error\" => \"That game is over.\"];\n\t\t$this->_gameMaster = $gm;\n\t\t$this->checkVictory();\n\t\treturn TRUE;\n\t}", "function isSpectator($player) {\n\n\t\treturn $player->isspectator;\n\t}", "public function hasGmcmd(){\n return $this->_has(16);\n }", "public function hasServerGameTime()\n {\n return $this->server_game_time !== null;\n }", "function isAdmin() {\n\t\t$me = $_SESSION[\"me\"];\n\t\t$check = mf(mq(\"select `id`,`url` from `[p]musicplayer` where `id`='{$me}' limit 1\"));\n\t\tif ($check[\"url\"] == \"admin\") {\n\t\t\treturn true;\n\t\t}\n\t}", "private function check_players(){\n\t\tforeach($this->clients as $cli){\n\t\t\tif(null!==$cli){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function amap_ma_check_if_agora_gm_enabled() {\n if (!elgg_is_active_plugin(\"agora\")) {\n return false;\n }\n \n $gm_agora = trim(elgg_get_plugin_setting('gm_agora', AMAP_MA_PLUGIN_ID));\n\n if ($gm_agora == AMAP_MA_GENERAL_YES && elgg_is_active_plugin('agora')) {\n return true;\n }\n\n return false;\n}", "static function isGoogleBot() {\n if (preg_match('/Googlebot/', self::$useragent)) return true;\n return false;\n }", "public function isInGame() {\n return $this->onlineState == 'in-game';\n }", "public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args ) :bool\n {\n if(strtolower($cmd->getName()) == \"gms\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.gms.use\")){\n\t\t\t\t\t$sender->setGamemode(0);\n\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Your gamemode has been set to Survival!\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command!\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"gmc\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.gmc.use\")){\n\t\t\t\t\t$sender->setGamemode(1);\n\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Your gamemode has been set to Creative!\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command!\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"gma\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.gma.use\")){\n\t\t\t\t\t$sender->setGamemode(2);\n\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Your gamemode has been set to Adventure!\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command!\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"gmspc\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.gmspc.use\")){\n\t\t\t\t\t$sender->setGamemode(3);\n\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Your gamemode has been set to Spectator!\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command!\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"day\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.day.use\")){\n\t\t\t\t\t$sender->getLevel()->setTime(6000);\n\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Set the time to Day (6000) in your world!\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"night\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.night.use\")){\n\t\t\t\t\t$sender->getLevel()->setTime(16000);\n\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Set the time to Night (16000) in your world!\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n if(strtolower($cmd->getName()) == \"nv\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->getEffect(Effect::NIGHT_VISION)){\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Night Vision turned off!\");\n\t\t\t\t\t$sender->removeEffect(Effect::NIGHT_VISION);\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Night Vision turned on!\");\n\t\t\t\t\t$sender->addEffect(new EffectInstance(Effect::getEffectByName(\"NIGHT_VISION\"), INT32_MAX, 1, false));\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"This command only works in game\");\n\t\t\t}\n\t\t}\n if(strtolower($cmd->getName()) == \"clearinv\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$sender->getInventory()->clearAll();\n\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"tpworld\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.tpworld.use\")){\n\t\t\t\t\tif(isset($args[0])){\n\t\t\t\t\t\t$world = $args[0];\n\t\t\t\t\t\tif($this->getServer()->isLevelLoaded($world)){\n\t\t\t\t\t\t\t$level = $this->getServer()->getLevelByName($world);\n\t\t\t\t\t\t\t$sender->teleport($level->getSafeSpawn());\n\t\t\t\t\t\t\t$sender->getLevel()->addSound(new GhastShootSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" You have been teleported to \" . TF::GOLD . $world);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GOLD . \" Error: World \" . TF::GREEN . $world . TF::GOLD . \" does not exist.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GOLD . \" Error: missing arguments.\");\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Usage: /tpworld <freebuild|city>\");\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n if(strtolower($cmd->getName()) == \"itemid\"){\n if($sender instanceof Player){\n $item = $sender->getInventory()->getItemInHand()->getId();\n $damage = $sender->getInventory()->getItemInHand()->getDamage();\n $sender->sendMessage($this->mch . TF::GREEN . \" ID: \" . $item . \":\" . $damage);\n }else{\n $sender->sendMessage(\"Please use this command in-game.\");\n }\n }\n\t\tif(strtolower($cmd->getName()) == \"changesign\"){\n\t\t\tif(!$sender instanceof Player){\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(!$sender->hasPermission(\"core.changesign.use\")){\n\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command!\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(empty($args[0])){\n\t\t\t\t$sender->sendMessage($this->mch . TF::GOLD . \" Error: Missing arguments.\");\n\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Usage: /cs <line #> <text>\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tswitch($args[0]){\n\t\t\t\tcase \"1\":\n\t\t\t\t\t$this->signLines[$sender->getName()] = 0;\n\t\t\t\t\t$this->signText[$sender->getName()] = implode(\" \", array_slice($args, 1));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Tap a sign now to change the first line of text\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"2\":\n\t\t\t\t\t$this->signLines[$sender->getName()] = 1;\n\t\t\t\t\t$this->signText[$sender->getName()] = implode(\" \", array_slice($args, 1));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Tap a sign now to change the second line of text\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"3\":\n\t\t\t\t\t$this->signLines[$sender->getName()] = 2;\n\t\t\t\t\t$this->signText[$sender->getName()] = implode(\" \", array_slice($args, 1));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Tap a sign now to change the third line of text\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"4\":\n\t\t\t\t\t$this->signLines[$sender->getName()] = 3;\n\t\t\t\t\t$this->signText[$sender->getName()] = implode(\" \", array_slice($args, 1));\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Tap a sign now to change the fourth line of text\");\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GRAY . \" Usage: /cs <line #> <text>\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"info\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$this->infoForm($sender);\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"portal\"){\n\t\t\tif(!isset($args[0])){\n return false;\n }\n $subCommand = array_shift($args);\n switch($subCommand){\n case 'pos1':\n if(!($sender instanceof Player)){\n $sender->sendMessage('Please run this command in-game.');\n return true;\n }\n if(!$sender->hasPermission('core.portals.admin')){\n $sender->sendMessage($this->mch . TF::RED . ' You do not have permission to use this command');\n return true;\n }\n $this->sel1[$sender->getName()] = true;\n $sender->sendMessage($this->mch . TF::GREEN . ' Please place or break the first position');\n return true;\n case 'pos2':\n if(!($sender instanceof Player)){\n $sender->sendMessage('Please run this command in-game.');\n return true;\n }\n if(!$sender->hasPermission('core.portals.admin')){\n $sender->sendMessage($this->mch . TF::RED . ' You do not have permission to use this command');\n return true;\n }\n $this->sel2[$sender->getName()] = true;\n $sender->sendMessage($this->mch . TF::GREEN . ' Please place or break the second position');\n return true;\n case 'create':\n if(!($sender instanceof Player)){\n $sender->sendMessage('Please run this command in-game.');\n return true;\n }\n if(!$sender->hasPermission('core.portals.admin')){\n $sender->sendMessage($this->mch . TF::RED . ' You do not have permission to use this command');\n return true;\n }\n if(!isset($this->pos1[$sender->getName()], $this->pos2[$sender->getName()])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: Please select both positions first');\n return true;\n }\n if(!isset($args[0])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: Please specify the portal name');\n return true;\n }\n if($this->pos1[$sender->getName()][3] !== $this->pos2[$sender->getName()][3]){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: Positions are in different levels');\n return true;\n }\n if(isset($this->portals[strtolower($args[0])])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: A portal with that name already exists');\n return true;\n }\n $this->portals[strtolower($args[0])] = [\n 'x' => min($this->pos1[$sender->getName()][0], $this->pos2[$sender->getName()][0]),\n 'y' => min($this->pos1[$sender->getName()][1], $this->pos2[$sender->getName()][1]),\n 'z' => min($this->pos1[$sender->getName()][2], $this->pos2[$sender->getName()][2]),\n 'x2' => max($this->pos1[$sender->getName()][0], $this->pos2[$sender->getName()][0]),\n 'y2' => max($this->pos1[$sender->getName()][1], $this->pos2[$sender->getName()][1]),\n 'z2' => max($this->pos1[$sender->getName()][2], $this->pos2[$sender->getName()][2]),\n 'level' => $this->pos1[$sender->getName()][3],\n 'dx' => $sender->x, 'dy' => $sender->y, 'dz' => $sender->z, 'dlevel' => $sender->getLevel()->getFolderName()\n ];\n yaml_emit_file($this->getDataFolder() . 'portals.yml', $this->portals);\n $sender->sendMessage($this->mch . TF::GREEN . ' Portal created');\n unset($this->pos1[$sender->getName()], $this->pos2[$sender->getName()]);\n return true;\n case 'list':\n if(!$sender->hasPermission('core.portals.admin')){\n $sender->sendMessage($this->mch . TF::RED . ' You do not have permission to use this command');\n return true;\n }\n $sender->sendMessage($this->mch . TF::GREEN . ' Portals: ' . implode(', ', array_keys($this->portals)));\n return true;\n case 'delete':\n if(!$sender->hasPermission('core.portals.admin')){\n $sender->sendMessage($this->mch . TF::RED . ' You do not have permission to use this command');\n return true;\n }\n if(!isset($this->portals[strtolower($args[0])])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: A portal with that name does not exist');\n return true;\n }\n unset($this->portals[strtolower($args[0])]);\n yaml_emit_file($this->getDataFolder() . 'portals.yml', $this->portals);\n $sender->sendMessage($this->mch . TF::GREEN . ' You have deleted the portal');\n return true;\n case 'fill':\n if(!$sender->hasPermission('core.portals.admin')){\n $sender->sendMessage($this->mch . TF::RED . ' You do not have permission to use this command');\n return true;\n }\n if(!isset($args[0])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: Please specify the portal name');\n return true;\n }\n if(!isset($args[1])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: Please specify the block id');\n return true;\n }\n $name = strtolower($args[0]);\n if(!isset($this->portals[$name])){\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: A portal with that name does not exist');\n return true;\n }\n\t\t\t\t\t$level = $this->getServer()->getLevelByName($this->portals[$name]['level']);\n for($x = $this->portals[$name]['x']; $x <= $this->portals[$name]['x2']; $x++){\n for($y = $this->portals[$name]['y']; $y <= $this->portals[$name]['y2']; $y++){\n for($z = $this->portals[$name]['z']; $z <= $this->portals[$name]['z2']; $z++){\n if($level->getBlockIdAt($x, $y, $z) === 0){\n $level->setBlockIdAt($x, $y, $z, $args[1]);\n if(isset($args[2])){\n $level->setBlockDataAt($x, $y, $z, $args[2]);\n }\n }\n }\n }\n }\n $sender->sendMessage($this->mch . TF::GREEN . ' Portal filled');\n return true;\n default:\n $sender->sendMessage($this->mch . TF::GOLD . ' Error: Strange argument ' . $subCommand . '.');\n $sender->sendMessage($cmd->getUsage());\n return true;\n }\n\t\t}\n\t\tif($cmd->getName() == \"lock\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.lock.use\")){\n\t\t\t\t\tif(isset($args[0])){\n\t\t\t\t\t\t$this->lockSession[$sender->getName()] = $args[0];\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Please touch the item you want to lock\");\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GOLD . \" Error: Please provide a name for the Key\");\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif($cmd->getName() == \"unlock\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.unlock.use\")){\n\t\t\t\t\tif(isset($args[0])){\n\t\t\t\t\t\t$this->unlock($args[0]);\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" The item has been unlocked\");\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->unlockSession[$sender->getName()] = true;\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Please touch the item you want to unlock\");\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif($cmd->getName() == \"makekey\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.makekey.use\")){\n\t\t\t\t\tif(isset($args[0])){\n\t\t\t\t\t\t$item = ItemFactory::get($this->itemID);\n\t\t\t\t\t\t$item->clearCustomName();\n\t\t\t\t\t\t$item->setCustomName($args[0]);\n\t\t\t\t\t\t$sender->getInventory()->addItem($item);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GOLD . \" Error: Please provide a name for the Key\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif($cmd->getName() == \"lockedinfo\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\tif($sender->hasPermission(\"core.lockedinfo.use\")){\n\t\t\t\t\t$this->infoSession[$sender->getName()] = true;\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Please touch the item you want information on\");\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage($this->mch . TF::RED . \" You do not have permission to use this command.\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Please use this command in-game.\");\n\t\t\t}\n\t\t}\n\t\tif($cmd->getName() == \"idea\"){\n\t\t\t$idea = $this->generateIdea();\n\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" Idea generated: \" . $idea . \".\");\n\t\t}\n\t\tif($cmd->getName() == \"event\"){\n\t\t\t$theme = $this->cfg[\"comp-theme\"];\n\t\t\t$endDate = $this->cfg[\"comp-end-date\"];\n\t\t\t$sender->sendMessage($this->mch . TF::GREEN . \" This weeks Build Comp. Theme is \" . $theme . \", ending on \" . $endDate);\n\t\t}\n # All commands after this will likely need modifications more than once.\n\t\tif(strtolower($cmd->getName()) == \"hub\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$x = 0.5;\n\t\t\t\t$y = 44;\n\t\t\t\t$z = 0.5;\n\t\t\t\t$level = $this->getServer()->getLevelByName(\"freebuild\");\n\t\t\t\t$pos = new Position($x, $y, $z, $level);\n\t\t\t\t$sender->teleport($pos);\n\t\t\t\t$sender->getLevel()->addSound(new EndermanTeleportSound(new Vector3($sender->getX(), $sender->getY(), $sender->getZ())));\n\t\t\t\t$sender->sendMessage($this->mch . TF::GOLD . \" Teleported to Hub\");\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Sir, you just tried to teleport a non-existent entity into a virtual game to teleport them to another world in said game. I recommend you go see a psychologist.\");\n\t\t\t}\n\t\t}\n\t\tif(strtolower($cmd->getName()) == \"rules\"){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$sender->sendMessage(\"§6§o§lServer Rules§r\");\n\t\t\t\t$sender->sendMessage(\"§f- §eNo griefing. §c(§4Ban§c)\");\n\t\t\t\t$sender->sendMessage(\"§f- §eNo advertising in any way, shape or form. §c(§4Ban§c)\");\n\t\t\t $sender->sendMessage(\"§f- §eNo NSFW/18+ Builds, Chat or Content. §c(§4Ban§c)\");\n\t\t\t $sender->sendMessage(\"§f- §eNo asking for OP/Ranks/Perms. §c(§4Kick, then Ban§c)\");\n\t\t\t $sender->sendMessage(\"§f- §eNo Drama. We've all had enough of it elsewhere, please do not bring it here. §c(§4Kick, then Ban§c)\");\n $sender->sendMessage(\"§f- §eNo Lavacasts/Other excessive usages of Lava and Water. §c(§4Ban§c)\");\n $sender->sendMessage(\"§f- §eNo Dolphin Porn. §c(§4Ban§c)\");\n\t\t\t $sender->sendMessage(\"§f- §eThat's it, have fun §b:)§e\");\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"If you have console access you BETTER know the fucking rules...\");\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private function _isMine(): bool {\n\t\treturn $this->isMyServer() && $this->isMyPID();\n\t}", "private function isBot()\n {\n if (preg_match('/mediapartners|googlebot|bingbot|bot/i', request()->server('HTTP_USER_AGENT'))) {\n return true;\n }\n }", "function isReady($player) {\n\t// check if the player exists and has a username in the gamestate\n\treturn isset(readPlayerData($player)['username']);\n}", "public function getPlayertype() {\n $objUser = App_Factory_Security::getSecurity()->getObjuser();\n \n if(!($objUser instanceof App_Data_User)) {\n return false;\n }\n \n if($this->getlngPlayer1() === $objUser->getUID()) {\n return 1;\n } else if($this->getlngPlayer2() === $objUser->getUID()) {\n return 2;\n }\n \n return false;\n }", "public function isUserWinner() {\n if($this->winnerType == \"player\" && $this->winnerID == CD()->id) {\n return true;\n }\n return false;\n }", "function amap_ma_check_if_photosmap_gm_enabled() {\n \n if (!elgg_is_active_plugin(\"photosmap\") || !elgg_is_active_plugin(\"tidypics\")) {\n error_log('lalala 2');\n return false;\n }\n \n $gm_photosmap = trim(elgg_get_plugin_setting('gm_photosmap', AMAP_MA_PLUGIN_ID));\n \n if ($gm_photosmap == AMAP_MA_GENERAL_YES) {\n return true;\n }\n\n return false;\n}", "public function isGod()\n {\n return $this->hasRole(Config::get('rbac.god_role'));\n }", "public function isGerechtigd()\n {\n if(isset($_SESSION['gebruiker'])&&!empty($_SESSION['gebruiker']))\n {\n $gebruiker=$_SESSION['gebruiker'];\n if ($gebruiker->getRecht() == \"medewerker\")\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n \n return false;\n \n \n }", "public function isBot()\n {\n return $this->is_bot;\n }", "abstract protected function isGameOver();", "public function is_game_live()\n {\n return $this->status === 'live' ? true : false;\n }", "static function isBot()\n {\n if(empty($_SERVER['HTTP_USER_AGENT']) || (!stristr($_SERVER['HTTP_USER_AGENT'], 'bot') && !stristr($_SERVER['HTTP_USER_AGENT'], 'spider')))\n return false;\n else\n return true;\n }" ]
[ "0.6730003", "0.65284336", "0.64989305", "0.6395883", "0.6316865", "0.6300721", "0.62313294", "0.61646485", "0.60800976", "0.6003701", "0.592019", "0.59103334", "0.58652943", "0.5858434", "0.584967", "0.5813075", "0.5757056", "0.5746513", "0.5745754", "0.5728846", "0.5728315", "0.5708988", "0.57017106", "0.5662508", "0.5600441", "0.55954075", "0.55496746", "0.5529739", "0.55281085", "0.5500365" ]
0.68529636
0
startSession Performs all the actions necessary to initialize this session object. Tries to determine if the the user has logged in already, and sets the variables accordingly. Also takes advantage of this page load to update the active visitors tables.
public function startSession() { session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /** * Set guest value to users not logged in, and update * active guests table accordingly. */ if (!$this->logged_in) { $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $this->connection->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } /* Update users active timestamp */ else { $this->connection->addActiveUser($this->username, $this->time); } /* Remove inactive visitors from database */ $this->connection->removeInactiveUsers(); $this->connection->removeInactiveGuests(); /* Set referrer page */ if (isset($_SESSION['url'])) { $this->referrer = $_SESSION['url']; } else { $this->referrer = "/"; } /* Set current url */ $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function initSession(){\n \n self::setSessionIni(); \n self::setSessionHandler();\n session_start();\n self::checkSystemCookie();\n\n // if 'started' is set for previous request\n //we truely know we are in 'in_session'\n if (isset($_SESSION['started'])){\n $_SESSION['in_session'] = 1;\n }\n\n // if not started we do not know for sure if session will work\n // we destroy 'in_session'\n if (!isset($_SESSION['started'])){\n $_SESSION['started'] = 1;\n $_SESSION['in_session'] = null;\n }\n\n // we set a session start time\n if (!isset($_SESSION['start_time'])){\n $_SESSION['start_time'] = time();\n }\n }", "public function startSession()\n\t{\n\t\t// Let's start the session\n\t\tif (session_id() == '')\n\t\t{\n\t\t\tsession_start();\n\t\t}\n\t}", "public static function startSession();", "public static function start()\r\n {\r\n if (!self::isStarted())\r\n session_start();\r\n }", "protected function init_session () {\n\t\t$Request = Request::instance();\n\t\t/**\n\t\t * If session exists\n\t\t */\n\t\tif ($Request->cookie('session')) {\n\t\t\t$this->user_id = $this->load();\n\t\t}\n\t\t$this->update_user_is();\n\t}", "public static function sessionStart()\n\t{\n\t\t{\n\t\t\tsession_start();\n\t\t}\n\t}", "public static function init()\n {\n if (self::$sessionStarted == false) {\n session_start();\n self::$sessionStarted = true;\n }\n }", "public final function start() \n\t{\n\t\tif (isset($_SESSION)) return;\n\t\tsession_start();\n\t}", "public function initSession() {\n\n\n\n if (session_id() == '') {\n\n // session isn't started\n\n session_start();\n }\n }", "private static function startSession() {\n if (session_status() == PHP_SESSION_NONE) {\n session_start();\n }\n }", "public static function init() {\n\t\t\t\n\t\t\t/* Run session */\n\t\t\tsession_start();\n\t\t\t\n\t\t}", "public function startSession() {}", "public function start(){\n\t\t$this->current_time = $this->time->time;\n\t\t$this->data['user_id'] = ANONYMOUS;\n\t\t$boolValid = false;\n\n\t\t//Return, if we don't want a session\n\t\tif (defined('NO_SESSION')) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Remove old sessions and update user information if necessary.\n\t\tif($this->current_time - $this->session_length > $this->config->get('session_last_cleanup')){\n\t\t\t$this->cleanup($this->current_time);\n\t\t}\n\t\t//Cookie-Data\n\t\t$arrCookieData = array();\n\t\t$arrCookieData['sid']\t= get_cookie('sid');\n\t\t$arrCookieData['data']\t= get_cookie('data');\n\t\t$arrCookieData['data']\t= ( !empty($arrCookieData['data']) ) ? unserialize(base64_decode(stripslashes($arrCookieData['data']))) : '';\n\n\t\t//Let's get a Session\n\t\tif ($this->in->exists('s') && $this->in->get('s', '') != \"\"){\n\t\t\t//s-param\n\t\t\t$this->sid = $this->in->get('s', '');\n\t\t} else {\n\t\t\t$this->sid = $arrCookieData['sid'];\n\t\t}\n\n\t\t//Do we have an session? If yes, try to look if it's a valid session and get all information about it\n\t\tif ($this->sid != ''){\n\t\t\t$query = $this->db->query(\"SELECT *\n\t\t\t\t\t\t\t\tFROM __sessions s\n\t\t\t\t\t\t\t\tLEFT JOIN __users u\n\t\t\t\t\t\t\t\tON u.user_id = s.session_user_id\n\t\t\t\t\t\t\t\tWHERE s.session_id = '\".$this->db->escape($this->sid).\"'\n\t\t\t\t\t\t\t\tAND session_type = '\".$this->db->escape((defined('SESSION_TYPE')) ? SESSION_TYPE : '').\"'\");\n\t\t\t$arrResult = $this->db->fetch_record($query);\n\t\t\t$this->db->free_result($query);\n\n\t\t\t$this->data = $arrResult;\n\t\t\tif (!isset($this->data['user_id'])){\n\t\t\t\t$this->data['user_id'] = ANONYMOUS;\n\t\t\t}\n\n\t\t\t//If the Session is in our Table && is the session_length ok && the IP&Browser fits\n\t\t\t//prevent too short session_length\n\t\t\tif ($arrResult && (($arrResult['session_start'] + $this->session_length) > $this->current_time) ){\n\t\t\t\t//If the IP&Browser fits\n\t\t\t\tif (($arrResult['session_ip'] === $this->env->ip) && ($arrResult['session_browser'] === $this->env->useragent)){\n\t\t\t\t\t//We have a valid session\n\t\t\t\t\t$this->data['user_id'] = ($this->data['user_id'] == (int)$arrResult['session_user_id']) ? intval($arrResult['session_user_id']) : $this->data['user_id'];\n\t\t\t\t\t$this->id = $this->data['user_id'];\n\t\t\t\t\t// Only update session DB a minute or so after last update or if page changes\n\t\t\t\t\tif ( ($this->current_time - $arrResult['session_current'] > 60) || ($arrResult['session_page'] != $this->env->current_page) ){\n\t\t\t\t\t\t$this->db->query(\"UPDATE __sessions SET :params WHERE session_id = ?\", array(\n\t\t\t\t\t\t\t'session_current'\t=> $this->current_time,\n\t\t\t\t\t\t\t'session_page'\t\t=> strlen($this->env->current_page) ? $this->env->current_page : '',\n\t\t\t\t\t\t), $this->sid);\n\t\t\t\t\t}\n\t\t\t\t\t//The Session is valid, copy the user-data to the data-array and finish the init. You you can work with this data.\n\n\t\t\t\t\tregistry::add_const('SID', \"?s=\".((!empty($arrCookieData['sid'])) ? '' : $this->sid));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//START Autologin\n\t\t$boolSetAutoLogin = false;\n\n\t\t//Loginmethod Autologin\n\t\t$arrAuthObjects = $this->get_login_objects();\n\t\tforeach($arrAuthObjects as $strMethods => $objMethod){\n\t\t\tif (method_exists($objMethod, 'autologin')){\n\t\t\t\t$arrAutologin = $objMethod->autologin($arrCookieData);\n\t\t\t\tif ($arrAutologin){\n\t\t\t\t\t$this->data = $arrAutologin;\n\t\t\t\t\t$boolSetAutoLogin = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//EQdkp Autologin\n\t\tif (!$boolSetAutoLogin){\n\t\t\t$arrAutologin = $this->autologin($arrCookieData);\n\t\t\tif ($arrAutologin){\n\t\t\t\t$this->data = $arrAutologin;\n\t\t\t\t$boolSetAutoLogin = true;\n\t\t\t}\n\t\t}\n\n\t\t//Bridge Autologin\n\t\tif (!$boolSetAutoLogin && $this->config->get('cmsbridge_active') == 1 && $this->config->get('pk_maintenance_mode') != 1){\n\t\t\t$arrAutologin = $this->bridge->autologin($arrCookieData);\n\t\t\tif ($arrAutologin){\n\t\t\t\t$this->data = $arrAutologin;\n\t\t\t\t$boolSetAutoLogin = true;\n\t\t\t}\n\t\t}\n\t\t//END Autologin\n\n\t\t//Let's create a session\n\t\t$this->create($this->data['user_id'], (isset($this->data['user_login_key']) ? $this->data['user_login_key'] : ''), $boolSetAutoLogin);\n\t\t$this->id = $this->data['user_id'];\n\t\treturn true;\n\t}", "public function initSession() {\n if (is_writable(GLPI_SESSION_DIR)) {\n Session::setPath();\n } else {\n if (isCommandLine()) {\n die(\"Can't write in \".GLPI_SESSION_DIR.\"\\n\");\n }\n }\n Session::start();\n\n if (isCommandLine()) {\n // Init debug variable\n $_SESSION = ['glpilanguage' => (isset($this->args['lang']) ? $this->args['lang'] : 'en_GB')];\n $_SESSION[\"glpi_currenttime\"] = date(\"Y-m-d H:i:s\");\n }\n\n // Init debug variable\n // Only show errors\n Toolbox::setDebugMode(Session::DEBUG_MODE, 0, 0, 1);\n }", "private function initSession()\n {\n // Start the session\n session_start();\n\n // Create session id constant\n define('SID', session_id());\n }", "public static function init()\n {\n if (session_id() == '') {\n session_start();\n }\n }", "public static function init()\n {\n if (session_id() == '') {\n session_start();\n }\n }", "function initSession(){\n\n\t\t//load resource files\n\t\t$this->refreshDataSet();\n\n\t\tif($this->isFatal())return;\n\n\t\t//check the state\n\t\t$this->checkInput();\n\n\t\t\n\t\tif($this->isFatal())return;\n\n\t\t//construct the table from the data\n\t\t$this->buildTable($this->schedule, $this->users);\n\n\t\tif($this->isFatal())return;\t\n\n\t}", "function wpdev_session_start() {\n session_start();\n }", "public static function startSession() {\n ob_clean();\n session_start();\n\n self::$isStarted = true;\n }", "function session_begin()\n\t{\n\t\t// Get user information\n\t\t$this->time_now\t\t\t\t= time();\n\t\t$this->cookie_data\t\t\t= array('u' => 0, 'k' => '');\n\t\t$this->update_session_page\t= $update_session_page;\n\t\t$this->browser\t\t\t\t= $request->header('User-Agent');\n\t\t$this->referer\t\t\t\t= $request->header('Referer');\n\t\t$this->forwarded_for\t\t= $request->header('X-Forwarded-For');\n\n\t\treturn $this->session_create();\n\t}", "function StartSession()\n\t{\n\t\t// Check if application configuration require SSL and if connection uses it\n\t\tif(IS_SECURE && $_SERVER['HTTPS'] != 'on')\n\t\t{\n\t\t\t// Make a notice log about non-ssl connection attempt\n\t\t\terror_log('[NOTICE] Non-SSL connection attempt;');\n\t\t\t// Redirect to the same page using https \n\t\t\tRedirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);\n\t\t}\n\t\t\n\t\t// Set custom session id\n\t\t$sessionName = SESSION_NAME;\n\t\t// Get secure status\n\t\t$isSecure = IS_SECURE;\n\t\t// Stop JavaScript being able to access the session id\n\t\t$isHttpOnly = true;\n\t\t\n\t\t// Force cookies usage to store the session id on the client side; Check if setting was done\n\t\tif (ini_set('session.use_only_cookies', 1) === FALSE)\n\t\t{\n\t\t\t// Make an error log about impossibility of cookies usage to store the session id on the client side\n\t\t\terror_log('[ERROR] Cannot force cookies use to store the session id on the client side; Could not initiate a safe session;');\n\t\t\t// Redirect to the error page using \n\t\t\tRedirect('error.php?error=Could not initiate a safe session.');\n\t\t}\n\t\t\n\t\t// Get current session cookies parameters\n\t\t$cookieParams = session_get_cookie_params();\n\t\t// Set current session cookies parameters (last two)\n\t\tsession_set_cookie_params($cookieParams['lifetime'], $cookieParams['path'], $cookieParams['domain'], $isSecure, $isHttpOnly);\n\t\t\n\t\t// Set specified current session name\n\t\tsession_name($sessionName);\n\t\t// Start new or resume existing session\n\t\tsession_start();\n\t\t// Update the current session id with a newly generated one\n\t\tsession_regenerate_id(); \n\t}", "static function start()\n {\n if (session_status() == PHP_SESSION_NONE) {\n session_start();\n }\n }", "public function pcr_auth_session_start() {\r\n\r\n // # check session_status()\r\n if(session_status() === PHP_SESSION_NONE) {\r\n session_start();\r\n }\r\n\r\n $request_uri = $_SERVER['REQUEST_URI'];\r\n\r\n // # due to wp nonce in some request_uri's, lets partial match login and logout strings\r\n // # also look for onesignal references even though we match on entire troublsome URL's below.\r\n if(stripos('login', $request_uri) !== true && stripos('logout', $request_uri) !== true && stripos('onesignal', $request_uri) !== true) {\r\n\r\n // # build the array of known url's to skip\r\n $skip_urls = array('/',\r\n '/login/',\r\n '/wp-admin/admin-ajax.php',\r\n '/wp-cron.php?doing_wp_cron',\r\n '/login/?login=false',\r\n '/login/?login=failed',\r\n '/wp-login.php'\r\n );\r\n\r\n // # check if reuest uri is empty and does not match skip_urls array\r\n if(!empty($request_uri) && !in_array($request_uri, $skip_urls)) {\r\n\r\n // # all is good, set the session\r\n $_SESSION['request_uri'] = $request_uri;\r\n }\r\n }\r\n }", "public function startSession() {\n if (ini_set('session.use_only_cookies', 1) === FALSE) {\n return;\n }\n //session_name('');\n session_start();\n session_regenerate_id();\n }", "function start_session() {\n if(!session_id()) {\n session_start();\n }\n}", "function start_session() {\n session_start();\n\n if (!isset($_SESSION['initiated'])) {\n session_regenerate_id();\n $_SESSION['initiated'] = 1;\n }\n\n if (!isset($_SESSION['count'])) $_SESSION['count'] = 0;\n else ++$_SESSION['count'];\n }", "private static function init(){\n\t\t\tif (session_status() != PHP_SESSION_ACTIVE) {\n\t\t\t\tsession_start();\n\t\t\t}\n\t\t}", "private function initSession() :void\n {\n if (session_status() === PHP_SESSION_NONE) {\n session_start();\n }\n }", "public function createSession()\n {\n session_start();\n }" ]
[ "0.74910915", "0.7424528", "0.73875695", "0.73861045", "0.73327625", "0.7274146", "0.7226246", "0.7200605", "0.7144584", "0.7102855", "0.7057631", "0.7031149", "0.700014", "0.69926053", "0.6959047", "0.69334435", "0.69334435", "0.69251454", "0.69118565", "0.6902492", "0.68901336", "0.687235", "0.68717533", "0.68375164", "0.6802253", "0.6793721", "0.6785986", "0.67851096", "0.6784161", "0.67349434" ]
0.8554343
0
checkLogin Checks if the user has already previously logged in, and a session with the user has already been established. Also checks to see if user has been remembered. If so, the database is queried to make sure of the user's authenticity. Returns true if the user has logged in.
public function checkLogin() { /* Check if user has been remembered */ if (isset($_COOKIE['cookname']) && isset($_COOKIE['cookid'])) { $this->username = $_SESSION['username'] = $_COOKIE['cookname']; $this->userid = $_SESSION['user_id'] = $_COOKIE['cookid']; } /* Username and userid have been set and not guest */ if (isset($_SESSION['username']) && isset($_SESSION['user_id']) && $_SESSION['username'] != GUEST_NAME) { /* Confirm that username and userid are valid */ if ($this->connection->confirmUserID($_SESSION['username'], $_SESSION['user_id']) != 0) { /* Variables are incorrect, user not logged in */ unset($_SESSION['username']); unset($_SESSION['user_id']); return false; } /* User is logged in, set class variables */ $this->userinfo = $this->connection->getUserInfo($_SESSION['username']); $this->username = $this->userinfo['username']; $this->userid = $this->userinfo['user_id']; $this->userlevel = $this->userinfo['userlevel']; return true; } /* User not logged in */ else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function checkLogin() {\n if (isset($_SESSION['login'])) {\n if ($_SESSION['login'] == true) {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n }", "function check_login()\r\n {\r\n if ($this->user != null) {\r\n return true;\r\n }\r\n if (!isset($_COOKIE[$this->manifest['session_token']])) {\r\n return false;\r\n }\r\n $session = $this->load_controller('Session');\r\n $this->user = $session->recover_session_by_token($_COOKIE[$this->manifest['session_token']]);\r\n if ($this->user == false) {\r\n $session->remove_session_recover_cookie();\r\n return false;\r\n }\r\n return true;\r\n }", "public static function checkLoginCookie() {\n\t\tif (!LoginHandler::userIsLoggedIn()) {\n\t\t\tif (CookieHandler::isSetCookie(\"user_name\") && CookieHandler::isSetCookie(\"password\")) {\n\t\t\t\t$cookieUserName = CookieHandler::getCookie(\"user_name\");\n\t\t\t\t$cookiePassword = CookieHandler::getCookie(\"password\");\t\t\t\n\t\t\t\tif (LoginHandler::checkLogin($cookieUserName, $cookiePassword) == \"ok\") {\n\t\t\t\t\tLoginHandler::loginUser($cookieUserName, $cookiePassword);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function checkLogin()\r\n\t{\r\n\t\tif (isset($_SESSION['loggedIn']))\r\n\t\t{\r\n\t\t\t$password = $_SESSION['loggedIn'];\r\n\t\t\t$result = self::$db->getDataSecured(\"SELECT * FROM \".$this->dbTable.\" WHERE $this->userPasswordClmn = :password ;\", array(\":password\" => $password));\r\n\t\t\t\r\n\t\t\tif(!empty($result) && ($_SESSION['lastActive'] + $this->maxLifeTime > time()))\r\n\t\t\t{\r\n\t\t\t\t$_SESSION['lastActive'] = time();\r\n\t\t\t\treturn $result[0];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}", "public static function checkIsLogged(): bool\n {\n $db = DbManager::openDB();\n if (!DbManager::tableExists($db, 'Users')) {\n Self::createTables($db);\n }\n\n if (!isset($auth)) {\n $auth = new Auth(DbManager::openDB(), null, null, false);\n }\n\n if ($auth->isLoggedIn()) {\n $isLogged = true;\n } else {\n $isLogged = false;\n }\n return $isLogged;\n }", "private function checkLoggedIn()\n {\n $loggedin = false;\n $user = Account::checkLogin($this->getDb());\n\n if ($user) {\n $loggedin = true;\n }\n\n return $loggedin;\n }", "public function checkLoginStatus()\n\t{\n\t\tif (isset($_SESSION[$this->sess_auth]) || isset($_SESSION[$this->sess_cookie_auth])) {\n\t\t\treturn true;\n\t\t}\n\t}", "public function check_login(){\n\n\t\tsession_id() == '' ? session_start(): NULL;\n\n\t\tif($this->LOGGED_IN){//IF THE LOGIN OBJECT VAR IS SET\n\t\t\treturn true;\n\t\t\t}\n\t\telse{\n\n\t\t\tif(isset($_SESSION['userLgInfo']['USER_ID'])){//IF SESSION IS SET\n\t\t\t\t$this->LOGGED_IN = true;\n\t\t\t\t$this->USER_ID = $_SESSION['userLgInfo']['USER_ID'];\n\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\telse if(isset($_COOKIE['user'])){\n\t\t\t\t$key = Janitor::decrypt_data($_COOKIE['user'], Config::$ENCRYPT_KEY);\n\t\t\t\t$sql = \"SELECT u.`USER_EMAIL`, u.`USER_ID`, u.`USER_FIRST_NAME`, u.`USER_LAST_NAME`, u.`USER_KEY`, u.`USER_PERM` FROM `user_tbl` AS u WHERE u.`USER_KEY`= ?\"; $bind = array($key); $db = new SqlCore;\n\t\t\t\t$userArr = $db->query_array($sql, $bind);\n\n\t\t\t\tif($userArr==NULL){ return false; }\n\n\t\t\t\t//SET LOGIN VARS\n\t\t\t\t$_SESSION['userLgInfo'] = array('USER_EMAIL' => $userArr[0]['USER_EMAIL'], 'USER_ID' => Janitor::encrypt_data($userArr[0]['USER_ID'], Config::$ENCRYPT_KEY), 'USER_FULL_NAME' => $userArr[0]['USER_FIRST_NAME'].' '.$userArr[0]['USER_LAST_NAME'], 'USER_FIRST_NAME' => $userArr[0]['USER_FIRST_NAME'], 'USER_LAST_NAME' => $userArr[0]['USER_LAST_NAME'], 'USER_PERM' => Janitor::encrypt_data($userArr[0]['USER_PERM'], Config::$ENCRYPT_KEY));\n\t\t\t\t$this->LOGGED_IN = true;\n\t\t\t\t$this->USER_ID = $userArr[0]['USER_ID'];\n\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\telse{\n\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public static function verifyLogin():bool\n\t{\n\n\t\tif (\n\t\t\t!isset($_SESSION[User::SESSION])\n\t\t\t||\n\t\t\t!$_SESSION[User::SESSION]\n\t\t\t||\n\t\t\t!(int)$_SESSION[User::SESSION]['iduser'] > 0\n\t\t)\n\t\t{\n\t\t\n\t\t\treturn false;\n\t\t\n\t\t} else {\n\n\t\t\treturn true;\n\n\t\t} \n\n\t}", "public function check_login()\n\t{\n\t\tif($this->session->userdata('member_login_status'))\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public static function isLogin()\n\t{\n\t\t$session = Common::getSession();\n\n\t\tif (!$session->has(self::$sessionName)) return false;\n\t\t$sessionInfo = $session->get(self::$sessionName);\n\n\t\t$sessionInfo = self::_cookieEncrypt($sessionInfo, 'DECODE');\n\t\tif (!$sessionInfo || !$sessionInfo[1] || !$sessionInfo[3]) return false;\n\t\tif (!$userInfo = self::getUserByName($sessionInfo[1])) return false;\n\t\tif ($sessionInfo[2] != $userInfo['user_id'] || $sessionInfo[3] != $userInfo['password']) {\n\t\t\treturn false;\n\t\t}\n\t\tself::_cookieUser($userInfo);\n\t\treturn $userInfo;\n\t}", "private function check_the_login(){\n \n if(isset($_SESSION['login_user'])){\n \n $this->login_user = $_SESSION['login_user'];\n $this->signed_in = true;\n \n }else{\n unset($this->login_user);\n $this->signed_in = false;\n }\n \n }", "function checkLogin()\n{\n\t// http://php.net/manual/en/function.session-start.php\n\tsession_start();\n\t\n\t// Check that a there is not a user logged in\n\tif( !isset($_SESSION[\"current_user\"]) or !is_a($_SESSION[\"current_user\"],'User') ) \n\t{\n\t\tunset($_SESSION[\"current_user\"]);\n\t\t\n\t\t// http://stackoverflow.com/questions/14523468/redirecting-to-previous-page-after-login-php\n\t\t// Όποιος νοιάζετε ας βάλει και τα σωστά if για να μην γίνονται malicious redirects\n\t\theader(\"Location: login.php?location=\" . urlencode($_SERVER['REQUEST_URI']));\n\t\treturn false;\n\t}\n\t\n\treturn true;\t\n}", "public function checkLogin() {\r\n\t\t$post = $this -> sanitize();\r\n\t\textract($post);\r\n\t\t// Hash the password that was entered into the form (if it was correct, it will match the hashed password in the database)\r\n\t\t$password = sha1($password);\r\n\t\t// Query\r\n\t\t$query = \"SELECT username, userID, profilePic, access, email FROM users WHERE username='$username' AND password='$password'\";\r\n\t\t$data = $this -> singleSelectQuery($query);\r\n\t\tif($data){\r\n\t\t\t//set up the session\r\n\t\t\t$_SESSION['userID'] = $data['userID'];\r\n\t\t\t$_SESSION['username'] = $data['username'];\r\n\t\t\t$_SESSION['profilePic'] = $data['profilePic'];\r\n\t\t\t$_SESSION['userType'] = $data['userType'];\r\n\t\t\t$_SESSION['access'] = $data['access'];\r\n\t\t\t//redirects to their profile\r\n\t\t\theader('location: index.php?page=profile&userID='.$_SESSION['userID']);\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t}", "function check_login(){\n\t\tif(!empty(yii::app()->request->cookies['uid']) && !empty(yii::app()->request->cookies['pass'])){\n\t\t\n\t\t\t//get the user's email\n\t\t\t$email=get_user_by_id(yii::app()->request->cookies['uid'])->email;\n\t\t\t\n\t\t\t//log the user in\n\t\t\tif($this->user_login($email,yii::app()->request->cookies['pass'],true)){\n\t\t\t\t//renew cookies for n days more\n\t\t\t\t$this->remember_login(yii::app()->request->cookies['pass'],true);\n\t\t\t}\n\t\t}\n\t}", "private function checkLogin()\n {\n if ($this->verifySession()) {\n $this->userId = $this->session['id'];\n }\n if ($this->userId === 0) {\n if ($this->verifyCookie()) {\n $this->userId = $this->cookie['userid'];\n $this->createSession();\n }\n }\n }", "function check_login() {\n\t\t$pdo = new PDO(DB_PATH);\n\n\t\tif (!isset($_SESSION[\"user_id\"]) || !isset($_SESSION[\"nonce\"])) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$stmt = $pdo->prepare(\"SELECT ID, username, password, type FROM users WHERE ID = :userId\");\n\t\t$stmt->bindValue(\":userId\", $_SESSION[\"user_id\"], PDO::PARAM_INT);\n\n\n\t\tif (!$stmt->execute()) {\n\t\t\tthrow new PDOException($stmt->errorInfo()[2]);\n\t\t}\n\n\t\t$user_data = $stmt->fetch();\n\n\n\t\treturn $_SESSION[\"nonce\"] == md5(serialize($user_data)) && intval($_SESSION['user_id']) == intval($user_data['ID']);\n\t}", "public function check_login(){\n\t\t\tif( isset( $_SESSION['user_id'] ) ) {\n\t\t\t\t$this->user_id = $_SESSION['user_id'];\n\t\t\t\t$this->logged_in = true;\n\t\t\t} else {\n\t\t\t\tunset( $this->user_id );\n\t\t\t\t$this->logged_in = false;\n\t\t\t}\n\t\t}", "function checkLogin() {\n /* Check if user has been remembered */\n if (isset($_COOKIE['cook_VenusetP_UserEmail']) && isset($_COOKIE['cook_Venueset_UserPassword'])) {\n $varUserEmail = $_COOKIE['cook_VenusetP_UserEmail'];\n $varUserPassword = $_COOKIE['cook_Venueset_UserPassword'];\n /* Confirm that username and password are valid */\n $arrUserFlds = array('pkUserID', 'UserEmail', 'UserPassword', 'UserFirstName');\n $varUserWhere = ' 1 AND UserEmail = \\'' . $varUserEmail . '\\' AND UserPassword = \\'' . md5(trim($varUserPassword)) . '\\'';\n //echo '<pre>';print_r($varUserWhere);exit;\n $arrUserList = $this->select(TABLE_USERS, $arrUserFlds, $varUserWhere);\n if (count($arrUserList) > 0) {\n /* $_SESSION['VenusetP_UserEmail'] = $arrUserList[0]['UserEmail'];\n $_SESSION['VenusetP_UserID'] = $arrUserList[0]['pkUserID'];\n $_SESSION['VenusetP_UserName'] = $arrUserList[0]['UserFirstName']; */\n }\n return true;\n } else {\n return false;\n }\n }", "public function checkUserLogin()\n {\n if (isset($_SESSION[\"user_id\"])) {\n $status = true;\n } else {\n $status = false;\n }\n return $status;\n }", "private function check_login() {\n\t\t\t// If we have a cookie, but the session variables are not set,\n\t\t\t// then we need to get the data and set the proper variables.\n\t\t\tif (!empty($_COOKIE['fauth'])) {\n\t\t\t\t$this->uid = $_COOKIE['fauth'];\n\t\t\t\n\t\t\t\tif (!isset($_SESSION['uid']) || \n\t\t\t\t\t\t!isset($_SESSION['username']) || \n\t\t\t\t\t\t$_SESSION['uid'] != $_COOKIE['fauth']) {\n\t\t\t\t\t// Find the user's object.\n\t\t\t\t\t$user = User::find_by_id($_COOKIE['fauth']);\n\t\t\t\t\t\n\t\t\t\t\t// Set the session variables.\n\t\t\t\t\t$_SESSION['uid'] = $user->id;\n\t\t\t\t\t$_SESSION['username'] = $user->username;\n\t\t\t\t}\n\t\t\t\n\t\t\t\t// Log the user in.\n\t\t\t\t$this->logged_in = true;\n\t\t\t} else {\n\t\t\t\tunset($this->uid);\n\t\t\t\t$this->logged_in = false;\n\t\t\t}\n\t\t}", "public function checkUserLogin() {\n\t\tif (isset($this->session->data['user_login_id']) && $this->session->data['user_login_id']) {\n\t\t\t$check_user = $this->db->query(\"SELECT * FROM \" . DB_PREFIX . \"wkpos_user WHERE user_id = '\" . $this->session->data['user_login_id'] . \"'\")->row;\n\t\t\treturn $check_user;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function checkLogin () {\r\n //check is session has user\r\n if (isset($_SESSION['user'])) {\r\n //check if the credentials match\r\n if (verifyUser($_SESSION['user']['name'], $_SESSION['user']['hash'])) {\r\n return true;\r\n }\r\n }\r\n //returns false by default\r\n return false;\r\n}", "public function logged_in()\n\t{\n\t\t$status = FALSE;\n\n\t\t// Get the user from the session\n\t\t$user = $this->_session->get($this->_config['session_key']);\n\n\t\tif ( ! is_object($user))\n\t\t{\n\t\t\t// Attempt auto login\n\t\t\tif ($this->auto_login())\n\t\t\t{\n\t\t\t\t// Success, get the user back out of the session\n\t\t\t\t$user = $this->_session->get($this->_config['session_key']);\n\t\t\t}\n\t\t}\n\n\t\t// check from DB if set in config\n\t\tif ($this->_config['strong_check'])\n\t\t{\n\t\t\t$user = $this->_get_object($user, TRUE);\n\t\t}\n\n\t\tif (is_object($user)\n\t\t\tAND is_subclass_of($user, 'Model_MangoRauth_User')\n\t\t\tAND $user->loaded()\n\t\t\tAND $user->is_active\n\t\t)\n\t\t{\n\t\t\t// Everything is okay so far\n\t\t\t$status = TRUE;\n\t\t}\n\n\t\treturn $status;\n\t}", "private function canLogin(User &$user) {\n\t\t$matchingUsers = $this->db->where($user, 'nickname', $user->nickname);\n\t\tif ($matchingUsers === false || count($matchingUsers) != 1) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$storedUser = $matchingUsers[0];\n\n\t\tif (!$this->checkPassword($storedUser, $user->ident)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/* Check if the password needs to be rehashed, \n\t\t * if so do so prior to login, if it fails don't login\n\t\t*/\n\t\tif (!$this->rehashIfNeccesary($storedUser)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$user = $storedUser;\n\t\treturn true;\n\t}", "public static function getLoginStatus(): bool\n\t{\n\t\tif (isset(self::$isLoggedIn)) return self::$isLoggedIn;\n\n\t\tsession_start([\n\t\t\t'name' => self::SESSION_NAME,\n\t\t\t'read_and_close' => true\n\t\t]);\n\n\t\tif (isset($_SESSION['tokens']) && count($_SESSION['tokens'])) {\n\t\t\t$token_count = count($_SESSION['tokens']);\n\t\t\t$cookie_count = 0;\n\n\t\t\tforeach ($_SESSION['tokens'] as $id => $token) {\n\t\t\t\tif (isset($_COOKIE[$id]) && $_COOKIE[$id] === $token)\n\t\t\t\t\t$cookie_count++;\n\t\t\t}\n\n\t\t\tif ($token_count === $cookie_count)\n\t\t\t\treturn self::$isLoggedIn = true;\n\n\t\t\t// if invalid credentials, clear cookies and destroy session\n\t\t\tforeach ($_COOKIE as $key => $value)\n\t\t\t\tself::setCookie($key, '');\n\n\t\t\tsession_start();\n\t\t\tsession_destroy();\n\t\t}\n\n\t\treturn self::$isLoggedIn = false;\n\t}", "public function login()\n {\n if ($this->validate()) {\n $duration = $this->module->rememberLoginLifespan;\n\n return Yii::$app->getUser()->login($this->user, $duration);\n }\n\n return false;\n }", "public function login()\n\t{\n\t\tif($this->_identity===null)\n\t\t{\n\t\t\t$this->_identity=new UserIdentity($this->UserName,$this->passWd);\n\t\t\t$this->_identity->authenticate();\n\t\t}\n\t\tif($this->_identity->errorCode===UserIdentity::ERROR_NONE)\n\t\t{\n\t\t\t$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days\n\t\t\tuser()->login($this->_identity,$duration);\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t\treturn false;\n\t}", "public function is_logged_in()\n\t{\n\t\t/** if username and password are saved in sessions, user is logged in * */\n\t\tif (isset($_SESSION[self::$cookie_name_prefix .self::USERNAME]) AND isset($_SESSION[self::$cookie_name_prefix .self::PASSWORD]))\n\t\t{\n\t\t\t$this->logged_in = true;\n\t\t\t$this->load_properties_by_session();\n\t\t\treturn true;\n\t\t}\n\t\telseif (isset($_COOKIE[self::$cookie_name_prefix .self::USERNAME]) && isset($_COOKIE[self::$cookie_name_prefix .self::PASSWORD]))\n\t\t{\n\t\t\tif ($this->is_valid($_COOKIE[self::$cookie_name_prefix .self::USERNAME], $_COOKIE[self::$cookie_name_prefix .self::PASSWORD]))\n\t\t\t{\n\t\t\t\tROCKETS_HTTP::redirect(FILE_SUCCESS);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->logout();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "public function is_logged()\n {\n // set a variable to determine how to validate authentication data\n $validate_using = NULL;\n\n if (\n get_cookie($this->config->item('auth_cookie_id'), TRUE)\n && get_cookie($this->config->item('auth_cookie_key'), TRUE)\n ) {\n // store cookie informations in variables\n $encryptedUserIDs = get_cookie($this->config->item('auth_cookie_id'), TRUE);\n $enckey = get_cookie($this->config->item('auth_cookie_key'), TRUE);\n\n $validate_using = 'cookie';\n } else {\n // store session informations in variables\n $encryptedUserIDs = $this->session->userdata($this->config->item('auth_session_id'));\n $enckey = $this->session->userdata($this->config->item('auth_session_enkey'));\n\n $validate_using = 'session';\n }\n\n // check if any data is available\n if (empty($encryptedUserIDs) || empty($enckey)) {\n return FALSE;\n }\n\n // decrypt user IDs\n $userIDs = $this->encryption->decrypt($encryptedUserIDs);\n\n $userArray = explode('-', $userIDs);\n\n // return status\n return $this->auth_model->check_session($userArray[0], $userArray[1], $enckey, $validate_using);\n }" ]
[ "0.7319114", "0.7270071", "0.7216147", "0.7184806", "0.7154535", "0.7130343", "0.7104686", "0.7059172", "0.7058103", "0.69828135", "0.6981022", "0.6971756", "0.69700074", "0.6953983", "0.6948999", "0.6936746", "0.69221556", "0.68844706", "0.68736815", "0.68723965", "0.6862469", "0.68530554", "0.68294805", "0.68215835", "0.6800976", "0.6794088", "0.67832136", "0.6776178", "0.67619246", "0.6750587" ]
0.73844343
0
Determines year length, in days.
public function getYearLength($year);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hebrew_year_days($yr) {\n\t\treturn ( hebrew_to_jd(7, 1, $yr + 1) - hebrew_to_jd(7, 1, $yr) );\n\t}", "public function isLeapYear();", "private function days_to_years( $days ) {\n\t\treturn floor( $days / 365 );\n\t}", "function centuryFromYear($year)\n{\n return $year%100==0?(int)floor($year/100):(int)floor($year/100)+1;\n}", "public function getYear() : int\n {\n return $this->year;\n }", "public function getDifferenceInYears();", "public function get_year()\n {\n $round = $this->get_round();\n $roundNumber = $round['numero'];\n /*Se obtiene la fecha final para sacar el año*/\n $r = $round['fecha_final'];\n /*Se concatena el año, siempre son 4 caracteres*/\n $año = $r[0].$r[1].$r[2].$r[3];\n \n return $año;\n }", "public function get_year_permastruct()\n {\n }", "function average_tropical_year_length(DateTime $d = null): float {\n $utc = new DateTimeZone('UTC');\n if ($d === null) {\n $d = new DateTime('now', $utc);\n }\n $d1 = new DateTime('2000-01-01 12:00:00', $utc);\n $di = date_diff($d, $d1);\n $t = $di->days / 36525;\n echo \"Number of Julian centuries since 2000-01-01T12:00:00UTC is $t<br>\";\n return 365.2421896698 - 6.15359e-6 * $t - 7.29e-10 * $t ** 2 + 2.64e-10 * $t ** 3;\n}", "public function getYear() {}", "public function age() {\n $years = ((integer) date('Y')) - $this->year;\n\n if (((integer) date('n')) < $this->month) {\n $years -= 1;\n }\n else if (((integer) date('n')) == $this->month) {\n if (((integer) date('j')) < $this->day) {\n $years -= 1;\n }\n }\n\n return $years;\n }", "public function getLengthDays() {\n $eff_date = $this->getEffectiveDate(true);\n $exp_date = $this->getExpirationDate(true);\n if (is_null($exp_date) || is_null($eff_date)) {\n return null;\n }\n $length_seconds = strtotime($exp_date) - strtotime($eff_date);\n $length_days = $length_seconds / 60 / 60 / 24;\n return intval(floor($length_days));\n }", "function getMaxYears()\n {\n return 9999;\n }", "function dayOfProgrammer($year) {\n if($year <1918 && $year%400!=0 && $year%100==0 ) {\n $date=date_create($year.'-01-01');\n date_add($date,date_interval_create_from_date_string(\"254 days\"));\n return date_format($date,\"d.m.Y\"); \n } else if($year == 1918) {\n $date=date_create($year.'-01-01');\n date_add($date,date_interval_create_from_date_string(\"268 days\"));\n return date_format($date,\"d.m.Y\");\n } else {\n $date=date_create($year.'-01-01');\n date_add($date,date_interval_create_from_date_string(\"255 days\"));\n return date_format($date,\"d.m.Y\");\n }\n}", "public static function getYears() \n\t{\n\t\t$year=array();\n\t\tfor($i=date(\"Y\");$i>2004;$i--)\n\t\t\t$year[]=$i;\n\t\treturn $year;\n\t}", "public function getLengthInDays() : int\n\t{\n\t\treturn Date::diff( $this->End, $this->Start );\n\t}", "function tep_is_leap_year($year) {\n if ($year % 100 == 0) {\n if ($year % 400 == 0) return true;\n } else {\n if (($year % 4) == 0) return true;\n }\n\n return false;\n }", "function cal_days_in_year($year){\n $days=0; \n for($month=1;$month<=12;$month++){ \n $days = $days + cal_days_in_month(CAL_GREGORIAN,$month,$year);\n }\n return $days;\n}", "public function getYear()\n {\n return $this->_getDateValue('Y');\n }", "private function resolve_year() {\n $academicYearStart = strftime(\"%Y\",strtotime(\"-8 months\",time()));\n $academicYearEnd = strftime(\"%Y\",strtotime(\"+4 months\",time()));\n return \"Academic Year $academicYearStart/$academicYearEnd\";\n }", "static function leapYear($n)\n {\n if (strlen((string)$n)==4) \n {\n //check year is leap or not\n if ((($n % 4 == 0) && ($n % 100 != 0)) || ($n % 400 == 0)) \n {\n echo \"leap year\".\"\\n\";\n } \n else \n {\n echo \"not leap year\".\"\\n\";\n } \n } \n else\n {\n echo \"invalid input\".\"\\n\";\n } \n }", "function happyNewYear () {\n $day = (int) date('z');\n $year = date('Y');\n $yearCheck = ((int)$year ? $year % 4 == 0 ? $year % 400 == 0 && $year % 100 == 0 ? 366 : 365 : 365 : \"ERROR\");\n $daytill = $yearCheck-$day;\n echo \"До Нового Года осталось: $daytill дней\";\n}", "public function is_year()\n {\n }", "public function getExpiryYear()\n {\n return $this->expiry_year;\n }", "public function calculateNumberOfDays(){\n list($startYear,$startMonth,$startDay) = explode(\"-\", $this->startDate);\n list($endYear,$endMonth,$endDay) = explode(\"-\", $this->endDate);\n\n //calculate days in years\n $noOfYears = ($startYear-$endYear);\n $yYearsdays = $noOfYears * 365;\n\n //calculate days in months\n $noOfMonths= ($startMonth-$endMonth);\n $noOfMonths= str_replace(\"-\",\"\", $noOfMonths);\n $dMonthsDays = $noOfMonths * 30;\n\n //calculate days\n $noOfDays= $startDay-$endDay;\n $noOfDays= str_replace(\"-\",\"\", $noOfDays);\n\n //add additional days from all months\n $months = array(31,28,31,30,31,30,31,31,30,31,30,31);\n $additionalMonthDays=0;\n for($m=0; $m <= $noOfMonths; $m++){\n $additionalMonthDays += ($months[$m]-30);\n }\n\n //add days from leap years\n $addLeapDaysInYear = 0;\n for($y=0; $y <= $noOfYears; $y++){\n $findYear = ($startYear-$y);\n $addLeapDaysInYear += $this->findLeapYear($findYear);\n }\n \n //add all days\n $total_days = $yYearsdays + $dMonthsDays + $noOfDays + $additionalMonthDays + $addLeapDaysInYear;\n \n return floor($total_days);\n }", "public function modelYear();", "public function year()\n\t{\n\t\treturn date('Y');\n\t}", "public function getYear()\r\n\t{\r\n\t\treturn $this->format('y');\r\n\t}", "function calculateDecade($year){\n\treturn (int)($year/10);\n}", "public function getExpiryYear()\n {\n return $this->expiryYear;\n }" ]
[ "0.70539415", "0.6360501", "0.6303427", "0.62354964", "0.62326586", "0.621807", "0.6201192", "0.6168365", "0.6161536", "0.61393315", "0.61229116", "0.61141455", "0.61095804", "0.6101058", "0.6090608", "0.6087717", "0.60527676", "0.60503185", "0.60429865", "0.603421", "0.60191625", "0.60151696", "0.597389", "0.597089", "0.59597915", "0.59168404", "0.5916333", "0.5907849", "0.58979946", "0.58973825" ]
0.7874283
0
Get year's first day index (since the start of the era).
public function getYearEraDayIndex($year);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getFirstDayOfCurrentYear()\n\t{\n\t\t$dateInSeconds = mktime(0, 0, 0, 1, 1, date('Y'));\n\t\t$date = date('Y-m-d', $dateInSeconds);\n\t\treturn $date;\n\t}", "function getRHUL_StartYear() {\n $dname = getRHUL_LDAP_FieldValue(\"adi_displayname\");\n\tif (strpos($dname, \"(\"))\n\t{\t\t\n\t\t$p = (int)strpos($dname, \"(\");\n\t\treturn substr($dname, $p+1, 4);\n\t} else\n\t{\n\t\treturn \"0\";\n\t}\n}", "public function getDateStartYear($date=null){\n\t\t$dateNew = date(\"Y-01-01 H:i:s\",strtotime($date));\n\t\treturn $dateNew;\n\t}", "function get_year()\n {\n $datearray=getdate($this->timestamp);\n return $datearray[\"year\"];\n }", "public static function getCurrentSchoolYear() {\n\t\t$year = date('Y');\n\t\t$month = date('m');\n\t\tif ($month >= 9) {\n\t\t\t$year++;\n\t\t}\n\t\treturn $year;\n\t}", "public function getFirstDay(){$day = getdate(mktime(0, 0, 0, $this->getMonth(), 1, $this->getYear())); return $day['wday'];}", "public function getYearAndDayIndexFromErayDayIndex($eraDayIndex);", "function hebrew_year_days($yr) {\n\t\treturn ( hebrew_to_jd(7, 1, $yr + 1) - hebrew_to_jd(7, 1, $yr) );\n\t}", "public function getYear()\r\n\t{\r\n\t\treturn $this->format('y');\r\n\t}", "public function getYear()\n {\n return $this->_getDateValue('Y');\n }", "public function GetThisYear()\n\t\t{\n\t\t\t$year = date('Y');\n\t\t\treturn $year;\n\t\t}", "function getYear()\n {\n if (!isset($this->iyear) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iyear;\n }", "function getCurrentYear ()\n\t{\n\t\treturn date ('Y');\n\t}", "public function year()\n\t{\n\t\treturn date('Y');\n\t}", "public function getCurrentYear()\n {\n if (! $this->hasGeoLocator()) {\n return (new \\DateTime)->format('Y');\n }\n $timezone = $this->geoLocator->getTimezone($this->getClientIp());\n\n return (new \\DateTime(null, new \\DateTimeZone($timezone)))->format('Y');\n }", "public function getYear()\n\t{\n\t\treturn $this->year \n\t\t\t?? $this->year = date('Y');\n\t}", "public function getSsStartYears()\n {\n $years = array();\n $first = date(\"Y\");\n\n for ($index=5; $index>=0; $index--) {\n $year = $first - $index;\n $years[$year] = $year;\n }\n $years = array(0=>$this->__('Year'))+$years;\n return $years;\n }", "public static function firstDayOfYear(?DateTimeInterface $date = null): static\n\t{\n\t\t$date = self::checkDate($date);\n\t\treturn static::from(sprintf('%04d-01-01', $date->format('Y')));\n\t}", "public function get_year()\n {\n $round = $this->get_round();\n $roundNumber = $round['numero'];\n /*Se obtiene la fecha final para sacar el año*/\n $r = $round['fecha_final'];\n /*Se concatena el año, siempre son 4 caracteres*/\n $año = $r[0].$r[1].$r[2].$r[3];\n \n return $año;\n }", "public static function getCurrentYear() {\n return date('Y');\n }", "function date_year($date){\r\n\t$year = NULL;\r\n\t$cont = 0;\r\n\tfor($i = 0; $i < strlen($date); $i++){\r\n\t\tif(is_numeric(substr($date, $i, 1))){\r\n\t\t\tif($cont == 2){\r\n\t\t\t\t$year .= substr($date, $i, 1);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tif($cont > 1){\r\n\t\t\t\treturn $year;\r\n\t\t\t}else{\r\n\t\t\t\t$cont++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn $year;\r\n}", "public function getYear() {}", "function erp_financial_start_date() {\n $financial_year_dates = erp_get_financial_year_dates();\n\n return $financial_year_dates['start'];\n}", "public static function getLastDayOfCurrentYear()\n\t{\n\t\t$dateInSeconds = mktime(0, 0, 0, 12, 31, date('Y'));\n\t\t$date = date('Y-m-d', $dateInSeconds);\n\t\treturn $date;\n\t}", "public function getFullYear()\r\n\t{\r\n\t\treturn $this->format('Y');\r\n\t}", "public function getFirstDay()\n {\n return (int)$this->_scopeConfig->getValue(\n 'general/locale/firstday',\n ScopeInterface::SCOPE_STORE\n );\n }", "public function GetYear() {\n return $this->format('Y');\n }", "public function getCurrentYear() {\n return date('Y');\n }", "public function getYear(): string\n {\n return $this->toLocalizedString('y');\n }", "function x_current_year($a) {\n return date('Y');\n}" ]
[ "0.7917737", "0.6772323", "0.6712785", "0.66957796", "0.6522487", "0.64649636", "0.64598656", "0.64201635", "0.64189464", "0.63045704", "0.6249713", "0.62312555", "0.6210106", "0.6205686", "0.61913866", "0.6191174", "0.6188909", "0.61677337", "0.6166174", "0.6161696", "0.61419284", "0.61416847", "0.6134881", "0.6134677", "0.61249566", "0.61235887", "0.61082864", "0.6083126", "0.6065217", "0.6063698" ]
0.73779994
1
Gets year & dayIndex (in that year) from an eraDayIndex
public function getYearAndDayIndexFromErayDayIndex($eraDayIndex);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getYearEraDayIndex($year);", "function hebrew_year_days($yr) {\n\t\treturn ( hebrew_to_jd(7, 1, $yr + 1) - hebrew_to_jd(7, 1, $yr) );\n\t}", "function get_year()\n {\n $datearray=getdate($this->timestamp);\n return $datearray[\"year\"];\n }", "public function getYear($a = null)\n {\n throw new NotImplementedException(__METHOD__);\n }", "public function getDayOfYear(): string\n {\n return $this->toLocalizedString('D');\n }", "function getYear()\r\n {\r\n return $this->ano;\r\n }", "public function getYear() {}", "public function get_year()\n {\n $round = $this->get_round();\n $roundNumber = $round['numero'];\n /*Se obtiene la fecha final para sacar el año*/\n $r = $round['fecha_final'];\n /*Se concatena el año, siempre son 4 caracteres*/\n $año = $r[0].$r[1].$r[2].$r[3];\n \n return $año;\n }", "function date_year($date){\r\n\t$year = NULL;\r\n\t$cont = 0;\r\n\tfor($i = 0; $i < strlen($date); $i++){\r\n\t\tif(is_numeric(substr($date, $i, 1))){\r\n\t\t\tif($cont == 2){\r\n\t\t\t\t$year .= substr($date, $i, 1);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tif($cont > 1){\r\n\t\t\t\treturn $year;\r\n\t\t\t}else{\r\n\t\t\t\t$cont++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn $year;\r\n}", "function ordinal_day($ord, $day, $month, $year) {\n\n\t$firstOfMonth = get_timestamp(\"$year-$month-01\");\n\t$lastOfMonth = $firstOfMonth + date(\"t\", $firstOfMonth) * 86400;\n\t$dayOccurs = 0;\n\n\tfor ($i = $firstOfMonth; $i < $lastOfMonth ; $i += 86400){\n\t\tif (date(\"D\", $i) == $day){\n\t\t\t$dayOccurs++;\n\t\t\tif ($dayOccurs == $ord){\n\t\t\t\t$ordDay = $i;\n\t\t\t}\n\t\t}\n\t}\n\treturn $ordDay;\n}", "public function getYear()\n {\n return $this->_getDateValue('Y');\n }", "function centuryFromYear($year)\n{\n return $year%100==0?(int)floor($year/100):(int)floor($year/100)+1;\n}", "public function getDayOrdinal()\r\n\t{\r\n\t\treturn $this->format('jS');\r\n\t}", "function getYearFromDate ($theDate)\n\t{\n\t\tif (gettype($theDate) == 'string')\n\t\t{\n\t\t\t$theDate = strtotime ($theDate);\n\t\t}\n\t\t$dateArray = getdate ($theDate);\n\t\treturn $dateArray ['year'];\n\t}", "function stampToYear($stamp)\n {\n $date = Calendar_Engine_PearDate::stampCollection($stamp);\n return (int)$date->year;\n }", "public function dayIndex($str)\n\t{\n\t\t$str = preg_replace(\"/[^A-Z]/i\",\"\", trim($str));\n\t\tif (isset($this->dayTokenMap[$str]))\n\t\t{\n\t\t\treturn $this->dayTokenMap[$str];\n\t\t}\n\t\treturn 0;\n\t}", "public function getPublicationYear() {\n $fields = array('publicationYear');\n $result = TingOpenformatMethods::parseFields($this->_getPublicationDetails(), $fields);\n return (is_array($result)) ? reset($result) : $result;\n }", "public function getAllSaintsDay($year)\n {\n $date = new \\DateTime($year.'-10-31');\n for ($i = 0; $i < 7; $i++) {\n if ($date->format('w') == 6) {\n break;\n }\n $date->add(new \\DateInterval('P1D'));\n }\n\n return $date;\n }", "function getYear()\n {\n if (!isset($this->iyear) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iyear;\n }", "function get_year($cur_date,$type){\n $date_split=split(\"-\",$cur_date);\n if ($type=='1'){\n // Return 2003 Format\n return date(\"Y\",mktime (0,0,0,$date_split[1],$date_split[0],$date_split[2]));}\n elseif ($type=='2'){\n // Return 03 format\n return date(\"y\",mktime (0,0,0,$date_split[1],$date_split[0],$date_split[2]));}\n }", "public static function getYearFromDate($date) {\n\t\treturn substr($date, 0, 4);\n\t}", "function getyear($txt)\n {\n\t\n\t return substr($txt,0,4);\n }", "public function get_events_by_year() {\n\t\tswitch_to_blog( get_network()->site_id );\n\n\t\t$years = array();\n\t\tforeach ($this->get_events() as $event) {\n\t\t\t$start = get_field( 'event_start', $event->ID );\n\n\t\t\tif ( $start ) {\n\t\t\t\t$year = date( 'Y', strtotime( $start ) );\n\t\t\t\t$years[ $year ][] = $event;\n\t\t\t}\n\t\t}\n\n\t\trestore_current_blog();\n\n\t\treturn $years;\n\t}", "function dayOfProgrammer($year) {\n if($year <1918 && $year%400!=0 && $year%100==0 ) {\n $date=date_create($year.'-01-01');\n date_add($date,date_interval_create_from_date_string(\"254 days\"));\n return date_format($date,\"d.m.Y\"); \n } else if($year == 1918) {\n $date=date_create($year.'-01-01');\n date_add($date,date_interval_create_from_date_string(\"268 days\"));\n return date_format($date,\"d.m.Y\");\n } else {\n $date=date_create($year.'-01-01');\n date_add($date,date_interval_create_from_date_string(\"255 days\"));\n return date_format($date,\"d.m.Y\");\n }\n}", "function get_date($day, $year) {\n\t\t\t\t\n\t\t\t\t$number_date = date('D d F, Y', mktime(0, 0, 0, 0+1, $day, $year));\n\t\t\t\t\n\t\t\t\treturn $number_date;\n\t\t\t\n\t\t\t}", "public function getYear()\r\n\t{\r\n\t\treturn $this->format('y');\r\n\t}", "public static function getFirstDayOfCurrentYear()\n\t{\n\t\t$dateInSeconds = mktime(0, 0, 0, 1, 1, date('Y'));\n\t\t$date = date('Y-m-d', $dateInSeconds);\n\t\treturn $date;\n\t}", "public function get_year($year) {\n\t\t$start_time = 'first day of January ' . date( 'Y', strtotime($year) );\n\t\t$end_time = 'last day of December ' . date( 'Y', strtotime($year) );\n\t\n\t\treturn array(\n\t\t\t'start'\t\t\t=>\tdate('Y-m-d', strtotime($start_time)),\n\t\t\t'end'\t\t\t=>\tdate('Y-m-d', strtotime($end_time)),\n\t\t\t'start_time'\t\t=>\tstrtotime( $start_time ),\n\t\t\t'end_time'\t\t=>\tstrtotime( $end_time )\n\t\t);\n\t}", "public function yearProvider()\n {\n return array(\n // year = 1\n array('11111111111111111', array(2001, 2031)),\n // year = K\n array('1M8GDM9AXKP042788', array(1989, 2019)),\n // year = 3\n array('5GZCZ43D13S812715', array(2003, 2033)),\n // invalid year\n array('5GZCZ43D1US812715', array())\n );\n }", "public function getYear() : int\n {\n return $this->year;\n }" ]
[ "0.8106487", "0.6026772", "0.5702168", "0.54436815", "0.5394086", "0.5389952", "0.5359254", "0.53544813", "0.5279268", "0.52651006", "0.5243265", "0.52213925", "0.52158445", "0.5195393", "0.5153933", "0.51278275", "0.5104954", "0.51043653", "0.5091387", "0.50894237", "0.5047303", "0.50434375", "0.504235", "0.50341785", "0.50312835", "0.50108486", "0.50040835", "0.49802837", "0.4975582", "0.4967653" ]
0.8946492
0
Save the $object into the XML $xmlPath
function saveObject($object, $xmlPath) { $class_vars = get_object_vars($object); $xml = domxml_new_doc("1.0"); $elements = $xml->create_element(get_class($object)); $elementsNode = $xml->append_child($elements); foreach ($class_vars as $name => $value) { $element = $xml->create_element($name); $element->set_content($value); $elementsNode->append_child($element); } $xml->dump_file($xmlPath, false, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save(){ \r\n return $this->xmlfile->save($this->absolutepath);\r\n }", "public function saveXML(){\r\n return $this->xml->saveXML();\r\n }", "public function save($object);", "public function SaveObject($object) {\n\t\trequire_once dirname(__FILE__) . '/' . get_class($object) . '.php';\n\t\t$object->Save();\n\t}", "public function save() {\n return $this->domDocument->save($this->xmlPath);\n }", "public function SaveXMLFile();", "public function save($path = null)\n {\n if (isset($path)) {\n return $this->document->save($path);\n } else {\n return $this->document->saveXML();\n }\n }", "public function save($object)\n {\n $this->driver->save($object);\n }", "public function savetofile()\n\t\t{\n\t\t\treturn $this->xml->asXML($this->file);\n\t\t}", "public function sendRequestXML($object);", "function Save($xml_root, $file_path) \n\t{\n\t\t$this->__xml = fopen($file_path, \"w\");\n\t\tfwrite($this->__xml, \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\\r\\n\");\n\t\t$this->__SaveChild($xml_root, 0);\n\t\tfclose($this->__xml);\n\t}", "final function save() { return $this->parser->saveXML($this->root, LIBXML_NOEMPTYTAG); }", "public function saveTo(string $path);", "public function save() {\r\n $conn = GFSalsaConnector::instance();\r\n if ($conn) {\r\n $conn->saveObject($this->object, $this);\r\n }\r\n }", "function save_object()\n {\n if ($this->dialog && is_object($this->dialogObject)) {\n if (method_exists($this->dialogObject, 'save_object')) {\n $this->dialogObject->save_object();\n }\n }\n }", "public function save()\n {\n $source = $this->document->saveXml( $this->document );\n return $source;\n }", "private static function mysave($object)\n {\n $object->save();\n }", "public function save()\n {\n if ($this->createDirectoryStructure($this->getPath())) {\n $content = $this->generateContents();\n file_put_contents($this->getPathname(), $content);\n }\n }", "public function saveFile() {\n return $this->xml->save($this->filename);\n }", "public function __toString() {\n return $this->getDocument()->saveXml();\n }", "public function save($path);", "public function persist($object);", "public function afterSave(\\Magento\\Framework\\DataObject $object)\n {\n parent::afterSave($object);\n $this->_cache->save(\n $this->serializer->serialize($object->getData()),\n $this->cacheHelper->getCacheKeyCustomerDirectoryEntity($object->getEntityId()),\n [\n Config::TYPE_IDENTIFIER\n ]\n );\n }", "public function save($object){\n\t\t$facade = FacadeGenerico::getInstance();\n\t\treturn $facade->adicionar($object);\n\t}", "function create($object, $xmlFile = null){\r\n\t\tif($xmlFile == null)\r\n\t\t\t$xmlFile = constant(\"OBJECT_XML\");\t\t\r\n\t\t\r\n\t\t$xml = simplexml_load_file($xmlFile);\r\n\t\t$xml = $object->addToXML($xml);\r\n\t\t$xml->asXML($xmlFile);\r\n\t}", "public function saveXml()\n {\n return $this->_dom->saveXML();\n }", "function Save() {\n\t\t\treturn $this->__put_acl($this->__bucket, $this->__s3object, $this->__xml->asXML());\n\t\t}", "public final function save() {\n }", "protected function saving() {\n // This will get reimplemented by children when necessary\n }", "public function save($object)\n {\n $this->entityManager->persist($object);\n $this->entityManager->flush();\n }" ]
[ "0.67209715", "0.6467804", "0.64130086", "0.6402344", "0.64001524", "0.62155473", "0.6209148", "0.6160196", "0.6107419", "0.6096192", "0.5952925", "0.5931757", "0.5914121", "0.58934987", "0.58796346", "0.5851007", "0.5834234", "0.5725911", "0.57119405", "0.57096404", "0.5703611", "0.570309", "0.5695035", "0.56899446", "0.5684767", "0.5676137", "0.5629637", "0.56281626", "0.5619479", "0.55974483" ]
0.84185815
0
Display the `Delete` action for listings in in User Dashboard > My Listings.
protected function display_delete_action( $listing ) { if ( $listing->get_status() === 'pending_payment' && ! empty( $this->pending_orders[ $listing->get_id() ] ) ) { return; } $delete_url = add_query_arg( [ 'action' => 'delete', 'job_id' => $listing->get_id() ], wc_get_account_endpoint_url( \MyListing\my_listings_endpoint_slug() ) ); printf( '<li class="cts-listing-action-delete"> <a href="%s" class="job-dashboard-action-delete">%s</a> </li>', esc_url( wp_nonce_url( $delete_url, 'mylisting_dashboard_actions' ) ), __( 'Delete', 'my-listing' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteAction() {\n\t\t\t$this->_forward('index');\n\t\t}", "private function actionListDelete() {\n $put_vars = $this->actionListPutConvert();\n $this->loadModel($put_vars['id'])->delete();\n }", "public function deleteList(){\n\n $posts=$this->articleDAO->getPosts();\n $this->view->adminRender ('delete_view', ['posts' =>$posts]);\n\n }", "public function actionDelete() {}", "public function actionDelete() {}", "public function deleteAction() {\n \n }", "public function deleteAction()\n {\n if ($this->isConfirmedItem($this->_('Delete %s'))) {\n $model = $this->getModel();\n $deleted = $model->delete();\n\n $this->addMessage(sprintf($this->_('%2$u %1$s deleted'), $this->getTopic($deleted), $deleted), 'success');\n $this->_reroute(array('action' => 'index'), true);\n }\n }", "public function handleDeleteListing($id){\n $this->listings->delete($id);\n }", "public function deleteAction(){\n //farewell brave knight, your cosmo will stay with us forever...\n $this->getDM()->remove($this->getKnight());\n $this->getDM()->flush();\n //go back to home (indexAction) to show the grid of knights\n $this->redirect()->toRoute(\"home\");\n }", "public function deletesAction()\n {\n $em = $this->getDoctrine()->getManager();\n $request = $this->get('request');\n\n $filter_category = $em->getRepository('AciliaCmsBundle:ExpertCategory')->find(3);\n $query = $em->getRepository('AciliaCmsBundle:Energy')->getQuery(null, null, null, null, $filter_category);\n\n $paginator = $this->get('knp_paginator');\n $pagination = $paginator->paginate($query, $this->get('request')->query->get('page', 1), 15);\n\n return $this->render('AciliaCmsBundle:Energy:deletes.html.twig', array(\n 'pagination' => $pagination,\n ));\n }", "public function deleteAction() : object\n {\n if ($_SESSION['permission'] === \"admin\") {\n $form = new DeleteForm($this->di);\n $form->check();\n\n $this->page->add(\"user/crud/delete\", [\n \"form\" => $form->getHTML(),\n ]);\n\n return $this->page->render([\n \"title\" => \"Delete an item\",\n ]);\n }\n $this->di->get(\"response\")->redirect(\"user/login\");\n }", "protected function deleteAction()\n {\n }", "public function destroy($id)\n {\n\n $listings = Listings::find($id);\n $listings->delete();\n\n return redirect('/dashboard')->with('success','business Deleted');\n\n }", "public function deleteAction() {\n\t\t$story_id \t\t= $this->getRequest()->getParam(\"id\");\n\t\t\n\t\t//Verify if the requested story exist\n\t\t$stories\t\t= new Stories();\n\t\tif (!($story\t= $stories->getStory($story_id))) {\n\t\t\treturn $this->_helper->json->sendJson(false);\n\t\t}\n\n\t\t// Check if we are the owner\n\t\tif ($this->_application->user->id != $story->user_id) {\n\t\t\treturn $this->_helper->json->sendJson(false);\n\t\t}\n\t\t\n\t\t// Ok, we can hide the item\n\t\t$stories->deleteStory($story_id);\n\t\treturn $this->_helper->json->sendJson(true);\n\t}", "public function deleteAction() {\n parent::deleteAction();\n }", "public function deleteAction()\n {\n }", "public function deleteAction() {\n\t\t$this->_notImplemented();\n\t}", "public function deleteAction()\n {\n \n }", "public function destroy(Listing $listing)\n {\n\n $name = $listing->name;\n\n if (Auth::user()) {\n Listing::destroy($listing->id);\n\n return redirect()->route('dashboard')\n ->with('message', $name.' - removed.');\n } else {\n return back()->with('message', \"You have to have be logged in to delete Lists\");\n }\n }", "public function deleteList(Request $request)\n {\n $this->boardList->deleteList($request); \n\n return [\n 'success' => 'success', \n ];\n }", "public function actionDeleted(){\n $viewType = \"deleted\";\n\n \n $searchModel = new SearchRepair();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $viewType);\n\n return $this->render('deleted', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider\n ]);\n }", "public function deleteAction() {\n\n //CHECK USER VALIDATION\n if (!$this->_helper->requireUser()->isValid())\n return;\n\n //GET VIEWER INFO\n $viewer = Engine_Api::_()->user()->getViewer();\n $viewer_id = $viewer->getIdentity();\n\n $listingtype_id = $this->_listingType->listingtype_id;\n $this->view->listingType = $this->_listingType;\n\n //GET TAB ID\n $this->view->tab_selected_id = $tab_selected_id = $this->_getParam('content_id');\n $this->view->format_form = $this->_getParam('format', null);\n\n //GET VIDEO OBJECT\n $this->view->sitereview_video = $sitereview_video = Engine_Api::_()->getItem('sitereview_video', $this->getRequest()->getParam('video_id'));\n\n //GET VIDEO TITLE\n $this->view->title = $sitereview_video->title;\n\n //GET LISTING ID\n $listing_id = $sitereview_video->listing_id;\n\n //GET NAVIGATION \n $this->view->navigation = Engine_Api::_()->getApi('menus', 'core')->getNavigation('sitereview_main');\n\n //GET SITEREVIEW SUBJECT\n $this->view->sitereview = $sitereview = Engine_Api::_()->getItem('sitereview_listing', $listing_id);\n $can_edit = $sitereview->authorization()->isAllowed($viewer, 'edit_listtype_' . $sitereview->listingtype_id);\n\n if (!$sitereview_video) {\n $this->view->status = false;\n $this->view->error = Zend_Registry::get('Zend_Translate')->_(\"Video doesn't exists or not authorized to delete\");\n return;\n }\n\n //VIDEO OWNER AND LISTING OWNER CAN DELETE VIDEO\n if ($viewer_id != $sitereview_video->owner_id && $can_edit != 1) {\n return $this->_forwardCustom('requireauth', 'error', 'core');\n }\n\n if (!$this->getRequest()->isPost()) {\n $this->view->status = false;\n $this->view->error = Zend_Registry::get('Zend_Translate')->_('Invalid request method');\n return;\n }\n\n $db = $sitereview_video->getTable()->getAdapter();\n $db->beginTransaction();\n\n try {\n\n Engine_Api::_()->getDbtable('videoratings', 'sitereview')->delete(array('videorating_id =?' => $this->getRequest()->getParam('video_id')));\n\n $sitereview_video->delete();\n\n $db->commit();\n } catch (Exception $e) {\n $db->rollBack();\n throw $e;\n }\n\n\n\n\n\n $this->view->status = true;\n if ($this->view->format_form == 'smoothbox') {\n $this->_forwardCustom('success', 'utility', 'core', array(\n 'smoothboxClose' => true,\n 'parentRefresh' => '500',\n 'parentRefreshTime' => '500',\n 'format' => 'smoothbox',\n 'messages' => Zend_Registry::get('Zend_Translate')->_('You have successfully deleted this video.')\n ));\n } else {\n if (Engine_API::_()->seaocore()->checkSitemobileMode('fullsite-mode')) {\n if ($can_edit) {\n return $this->_gotoRouteCustom(array('action' => 'edit', 'listing_id' => $sitereview->listing_id), \"sitereview_videospecific_listtype_$listingtype_id\", true);\n } else {\n return $this->_gotoRouteCustom(array('listing_id' => $sitereview->listing_id, 'slug' => $sitereview->getSlug(), 'tab' => $tab_selected_id), \"sitereview_entry_view_listtype_$listingtype_id\", true);\n }\n } else {\n return $this->_gotoRouteCustom(array('listing_id' => $sitereview->listing_id, 'slug' => $sitereview->getSlug(), 'tab' => $tab_selected_id), \"sitereview_entry_view_listtype_$listingtype_id\", true);\n }\n }\n }", "public function showDeleted()\n {\n $categoryList = Category::onlyTrashed()->get();\n return view('admin.category.deleted', compact('categoryList'));\n }", "public function deleteAction() {\n\t\t$id = (int) $this->_getParam('id');\n\t\t$modelName = $this->_getParam('model');\n\t\t$model = Marcel_Backoffice_Model::factory($modelName);\n\t\t$item = $model->find($id)->current();\n\t\tif ($item) {\n\t\t\t$item->delete();\n\t\t}\n\t\t$this->_helper->redirector('list', null, null, array('model' => $modelName));\n\t}", "public function deleteMemberOfDayAction() {\n \n $this->view->id = $this->_getParam('id');\n \n if ($this->getRequest()->isPost()) {\n\n Engine_Api::_()->getDbtable('itemofthedays', 'sitepage')->delete(array('itemoftheday_id =?' => $this->_getParam('id')));\n\n\t\t\treturn $this->_forward('success', 'utility', 'core', array(\n\t\t\t\t'smoothboxClose' => 10,\n\t\t\t\t'parentRefresh' => 10,\n\t\t\t\t'messages' => array(Zend_Registry::get('Zend_Translate')->_(''))\n\t\t\t));\n }\n\n $this->renderScript('admin-widgets/delete.tpl');\n }", "public function action_delete()\n {\n\t $this->template = View::forge('template-admin');\n\n $post = Input::post();\n $entry = Model_Event::find_by_pk($post[\"id\"]);\n\t\tif ($entry){\n\t\t\tif(!$entry->delete()){\n\t\t\t\t$data[\"events\"] = Model_Event::find_all();\n\t\t\t\t$this->template->title = \"イベント一覧\";\n\t\t\t\t$this->template->content = View::forge('event/index', $data);\n\t\t\t}\n\t\t}\n\t\t$data[\"events\"] = Model_Event::find_all();\n\t\t$this->template->title = \"イベント一覧\";\n\t\t$this->template->content = View::forge('event/index', $data);\n }", "public function delete() {\n return $this->deleteRequest(\n \"/application/shops/{$this->shop_id}/listings/{$this->listing_id}/properties/{$this->property_id}\"\n );\n }", "public function destroy(Listing $listing)\n {\n $listing->delete();\n\n return redirect('listings');\n }", "public function deleteAction() : object\n {\n $page = $this->di->get(\"page\");\n $form = new DeleteForm($this->di);\n $form->check();\n\n $page->add(\"questions/crud/delete\", [\n \"form\" => $form->getHTML(),\n ]);\n\n return $page->render([\n \"title\" => \"Delete an item\",\n ]);\n }", "public function actionDelete()\n {\n extract(Yii::$app->request->post());\n $this->findModel($list, $item)->delete();\n }" ]
[ "0.6695461", "0.6688046", "0.65850246", "0.6575547", "0.6575547", "0.6556444", "0.65543133", "0.65104526", "0.64991283", "0.6494047", "0.64860606", "0.6456677", "0.64559746", "0.6412361", "0.64007103", "0.6391455", "0.63868433", "0.63314265", "0.6310855", "0.62581", "0.6255184", "0.6224813", "0.62143105", "0.6186794", "0.61831933", "0.6178744", "0.61671233", "0.616101", "0.6159052", "0.61390233" ]
0.72461003
0
Special use case here. Wiggins wants to send messages via GET.
public function getAction() { //$this->setOutputParam('status', true); //$this->setOutputParam('message', 'Get Message sender'); $this->sendMessage(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sendGet ()\n {\n return $this->handleQuery();\n }", "private function send_msg() {\r\n }", "protected function send() {}", "public function sendRequest()\n {\n }", "function the_champ_notify(){\r\n\tif(isset($_GET['message'])){\r\n\t\t?>\r\n\t\t<div><?php echo esc_attr($_GET['message']) ?></div>\r\n\t\t<?php\r\n\t}\r\n\tdie;\r\n}", "public function send() {}", "public function send() {}", "public function send() {}", "public function send() {}", "public function send() {}", "function sends_get()\n {\n $search = array();\n $response = FALSE; \n \n $cache = Cache::get_instance();\n $response = $cache::get('send' . serialize($this->_args));\n\n if (!$response) {\n $response['_count'] = $this->model->count_results($this->_args);\n\n if ($response['_count'] > 0)\n {\n $response['data'] = $this->model->fetch($this->_args, TRUE)->result();\n } \n\n $response['l'] = $this->db->last_query(); \n }\n\n $this->response($response);\n }", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "function hsend_get(&$app, &$c) {\n\t\t$app->logger->debug(sprintf('%s::%s', __CLASS__, __FUNCTION__));\n\n\t\t$this->_http->setMethod(HTTP_REQUEST_METHOD_GET);\n\n\t\t$this->_http->setURL($c->param('app.view_http.request.uri'));\n\n\t\t$this->_set_basic_auth($app, $c);\n\n\t\t$this->_load_get_params($app, $c);\n\n\t\t$this->_load_headers($app, $c);\n\n\t\t$this->_http->sendRequest();\n\n\t\t$this->_handler_response($app, $c);\n\n\t\treturn $app->status->handled;\n\t}", "public function sendRequest( ) {\n\n }", "abstract function doSend();", "public function send(){\n\n\n\n $id = $_GET['id'];\n $msg = $_GET['msg'];\n $response = $this->sendMessage($id,$msg);\n $return[\"allresponses\"] = $response;\n $return = json_encode($return);\n $data = json_decode($response, true);\n\n echo $response;\n\n }", "public function index_get() {\n\t\t$uid = 15;\n\t\t$messages = $this->Messages_model->getMessagesByFromUserID($uid);\n\t\t$this->response($messages);\n\t}", "function request($message, $peer_id, $keyboard, $sticker_id)\r\n{\r\n $request_params = array(\r\n 'message' => $message,\r\n 'peer_id' => $peer_id,\r\n 'access_token' => VK_API_TOKEN,\r\n 'v' => '5.80',\r\n 'sticker_id' => $sticker_id,\r\n 'keyboard' => json_encode($keyboard)\r\n );\r\n\r\n $get_params = http_build_query($request_params);\r\n file_get_contents('https://api.vk.com/method/messages.send?' . $get_params);\r\n echo('ok');\r\n}", "abstract function send();", "function sendGet($arrayRestInputs){\n if((file_exists($arrayRestInputs['enginebasedir'] . '/lib/Send.php')) && (file_exists($arrayRestInputs['enginebasedir'] . '/lib/NodeToken.php')) ){\n require_once($arrayRestInputs['enginebasedir'] . '/lib/Send.php');\n require_once($arrayRestInputs['enginebasedir'] . '/lib/NodeToken.php');\n $objectToken = new NodeToken ();\n if(($objectToken->retrieveToken($arrayRestInputs['token'])) && (count($arrayRestInputs['arguments']) > 0)){\n $arguments = $arrayRestInputs['arguments'];\n $toUser = new User($arguments[0]);\n $objectSend = new Send();\n $sendReturn = $objectSend->getMessages($objectToken->uid, $toUser->getUserID());\n if($sendReturn < 0){\n return '';\n }\n else{\n if(is_array($sendReturn)){\n $limit = count($sendReturn);\n for($i = 0; $i < $limit; $i++){\n $sendReturn[$i]['sent'] = date(DATE_ATOM, $sendReturn[$i]['sent']);\n $sendReturn[$i]['seen'] = date(DATE_ATOM, $sendReturn[$i]['seen']);\n $sendReturn[$i]['requestinguser'] = $objectToken->username;\n }\n }\n return $sendReturn;\n }\n }\n else{\n return ''; /* BUG: If the client does not send a token, an empty string is returned. An invalid token should result in an error somewhere. */\n }\n }\n else{\n return '';\n }\n}" ]
[ "0.6655427", "0.6363697", "0.6323628", "0.62498885", "0.62139", "0.61633176", "0.61633176", "0.61633176", "0.61633176", "0.61633176", "0.6138815", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.61079115", "0.60851485", "0.6077012", "0.60664654", "0.6032103", "0.6009592", "0.6008098", "0.5983985", "0.5961583" ]
0.65987045
1
/ REQUIRED IF Requerido si el valor del campo en el primer parametro es igual al segundo parametro. EJEMPLO required_if[tipo_inmueble_id,6] Se requiere modificar el core Form_validation lineas 494 y 532 por: if (!preg_match("/required_if\[.+\]/", implode(' ', $rules))) return;
function required_if($str, $parms) { list($campo, $valor,$label,$desc)=explode(',',$parms,4); if($_POST[$campo]==$valor && $str=='') { $campo=str_replace(array('_id','_'),array('',' '),$campo); $this->CI->form_validation->set_message('required_if', "El campo %s debe contener un dato si {$label} es '{$desc}'."); return FALSE; } return TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function requiredIf ($param)\n {\n list($OtherFieldName, $rule) = explode(',', $param);\n switch ($rule)\n {\n case 'notEmpty':\n if (empty($this->value) && (isset($_POST[$OtherFieldName]) && !empty($_POST[$OtherFieldName])))\n {\n $this->SetError('requiredIf', 'The '.$this->SpacedKey.' field is required');\n return false;\n }\n break;\n default:\n if (empty($this->value) && (isset($_POST[$OtherFieldName]) && $_POST[$OtherFieldName] == $rule))\n {\n $this->SetError('requiredIf', 'The '.$this->SpacedKey.' field is required');\n return false;\n }\n break;\n }\n return true;\n }", "function required_validate() {\n if ($this->required) {\n if (array_key_exists('NOT_NULL', $this->condition)) \n {\n if ($this->value == '' || $this->value == NULL) {\n $this->errors->add_msj(NOT_NULL_PRE.$this->name.NOT_NULL_POS);\n }\n }\n\n if (array_key_exists('IS_INT', $this->condition)) \n {\n if (!field_is_int($this->value))\n {\n $this->errors->add_msj(IS_INT_PRE.$this->name.IS_INT_POS);\n }\n }\n\n }\n }", "public function rules()\n {\n // will receive user inputs.\n return array(\n array('tanggal,divisiid,nama', 'required'),\t\t\t\n );\n }", "function required_if_not($str, $parms)\n\t{\t\t\n\t\tlist($campo, $valor,$label,$desc)=explode(',',$parms,4);\n\t\t\t\t\n\t\tif($_POST[$campo]!=$valor && $str=='')\n\t\t{\n\t\t\t$campo=str_replace(array('_id','_'),array('',' '),$campo);\n\t\t\t$this->CI->form_validation->set_message('required_if_not', \"El campo %s debe contener un dato si {$label} es diferente de '{$desc}'.\");\n\t\t\treturn FALSE;\n\t\t}\n\t\telseif($_POST[$campo]==$valor && $str!='')\n\t\t{\n\t\t\treturn '';\n\t\t}\t\t\n\t\treturn TRUE;\n\t}", "public function rules()\n {\n return [ \n\n 'face_investigacion' => 'required_if:estado_investigacion,2',\n 'face2' => 'required_with:face3',\n 'face3' => 'required_with:face4',\n\n ];\n }", "public function rules()\n {\n return [\n 'filter_type' => 'required',\n 'date_filter' => 'required_if:filter_type,2'\n ];\n }", "public function rules()\n\t{\n\t\treturn array(\n\t\t\tarray('dtIni, dtFim', 'required'),\n\t\t);\n\t}", "public function rules()\n {\n\n return [\n 'nombre'=>['string',\n Rule::unique('tbl_proyectos_realizados','rt_titulo_proyecto')\n ->where(function($query){\n return $query->where('fk_id_usuario',$this->user()->pk_id_usuario);\n }),\n ],\n\n 'fechaI'=>'date|required',\n 'fechaF'=>'date|required',\n 'area'=>'numeric|required',\n 'area-c'=>'string|required_if:area,\"Otra Área de conocimiento\"',\n 'descripcion'=>'required|string|min:6|max:150'\n\n\n ];\n }", "public function rules()\n {\n return [\n 'nombre'=>'required',\n 'objetivo'=>'required',\n 'metodologia'=>'required',\n 'presupuestoP'=>'required|min:1|numeric',\n 'anno'=>'required|not_in:0',\n\n\n ];\n }", "public function rules()\n {\n return [\n\n 'part_id'=>'required_if:service_id,null',\n 'service_id'=>'required_if:part_id,null',\n 'valor_venda'=>'required',\n 'desconto'=>'required',\n// 'observacao'=>'required'\n ];\n }", "public function rules()\n {\n \n return [\n 'id'=>'bail|required|integer|exists:tipo_movimiento,id',\n 'descripcion' => 'bail|max:50|min:1|unique:tipo_movimiento,descripcion,'.$this->get('id'),\n 'tipo' => 'bail|max:50|min:1|in:credito,debito'\n ];\n\n\n }", "public function rules()\n {\n return [\n 'option' => 'required|in:url,upload',\n 'url' => 'required_if:option,url',\n ];\n }", "public function rules()\n {\n return array(\n array('id, type', 'required')\n );\n }", "public function rules()\n {\n return [\n 'cliente_id' => 'required',\n 'agencia_id' => 'required',\n 'numero' => ['required','max:120',Rule::unique('contas')->where(function ($query) {\n return $query->where('tipo', request()->tipo)->where('agencia_id', request()->agencia_id)\n ->where('numero', request()->numero);\n })->ignore(request()->id)\n ],\n 'tipo' => 'required|in:corrente,poupanca|max:8',\n 'saldo' => 'required|regex:/^\\d{1,3}(?:\\.\\d{3})*?,\\d{2}$/',\n ];\n }", "public function rules()\r\n\t{\r\n\t\treturn array(\r\n\t\t\tarray('tgl_awal,tgl_akhir', 'required'),\r\n\t\t);\r\n\t}", "public function rules()\n {\n return [\n 'sigla' => '',\n 'descripcion' => 'required|unique:grupo,descripcion|max:150',\n 'tipo' => 'required|in:\"i\",\"e\"',\n 'id_profesor' => 'required|exists:profesores,id'\n ];\n }", "public function validationRules() {\n\t\treturn [\t \n\t\t\t'nom'=>'required',\n\t\t\t'enonce'=>'required',\n\t\t\t'sur'=>'required'\n\t];\t\n\t}", "public function rules(){\n return [\n 'direccion'=> 'required',\n 'tipoVivienda' => 'required',\n 'compartido' => 'required',\n 'operacion' =>'required',\n 'precio' =>'required|numeric|gt:0',\n 'anioConstruccion'=>'required|numeric|gt:1800',\n 'metrosCuadrados'=>'required|numeric|gt:0',\n 'cantAmbientes'=>'required|numeric|gt:0',\n 'cantBanios'=>'required|numeric|gt:0',\n 'cantCocheras'=> 'required|numeric|gte:0',\n 'cantDormitorios'=> 'required|numeric|gt:0|lte:cantAmbientes',\n 'propietario'=> 'required|exists:propietarios,cuit',\n 'piso' => 'required_if:tipoVivienda,Departamento', \n 'numeroDepto' => 'required_if:tipoVivienda,Departamento'\n ];\n }", "public function rules()\n\t{\n\t\treturn array(\n\t\t\tarray('vendedor_id, fdesde, fhasta', 'required'),\n\t\t);\n\t}", "function validateRequired($required, $value, $type) {\n\tif($required == \"required\") {\n\n\t\t// Check if we got an empty value\n\t\tif($value == \"\") {\n\t\t\techo \"false\";\n\t\t\texit();\n\t\t}\n\t} else {\n\t\tif($value == \"\") {\n\t\t\techo \"none\";\n\t\t\texit();\n\t\t}\n\t}\n}", "public function rules()\n {\n return [\n 'idpoi' => 'required|integer|digits_between:0,3|min:0',\n 'valor.*' => 'required|integer|digits_between:0,2|min:0',\n 'id.*' => 'required|integer|digits_between:0,2|min:0',\n ];\n }", "public function rules() {\n return [\n 'type_id' => 'required',\n ];\n }", "public function rules()\n {\n return [\n 'nombre_asignatura'=>'required|max:45',\n 'tipo'=>'required|max:45'\n ];\n }", "protected function validationRules() : array\n {\n return [\n 'email' => 'required',\n 'status' => 'reqired | in: 0,1,2,3' \n ];\n }", "function _required($required, $data)\n\t{\n\t\tforeach ($required as $field)\n\t\t{\n\t\t\tif ( ! isset($data[$field]))\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\t\treturn TRUE;\n\t}", "public function rules()\n {\n return [\n 'nombreTipoSalida' => ['required'],\n 'idCanal' => ['required', 'numeric'],\n 'idNotificacion' => ['numeric'],\n ];\n }", "public function rules()\n\t{\n\t\treturn array(\n\t\t\tarray('tableName, itemId', 'required'),\n\t\t);\n\t}", "public function rules()\n {\n return [\n 'fornecedor_id' => 'required',\n 'obra_id' => 'required',\n 'valor_unitario' => 'required',\n ];\n }", "public function rules()\n {\n // Check Create or Update\n $this->method() == 'PATCH' ? $invoice_no_rules = 'required' : $invoice_no_rules = 'required|unique:invoices' ;\n list($keys, $invoice_types) = Arr::divide(config('constants.invoice_type'));\n $rules = [\n 'invoice_date' => 'required',\n 'invoice_no' => $invoice_no_rules,\n //'invoice_type' => 'required|in:\"1\",\"2\"',\n 'invoice_type' => 'required|in:'.implode(',',$invoice_types),\n 'total' => 'required',\n ];\n \n foreach($this->request->get('item_id') as $key => $val)\n {\n $rules['item_qty.'.$key] = 'required|min:1|not_in:\"0\"|lte:invoicable_qty.'.$key;\n }\n \n return $rules;\n }", "protected static function _required() {\n if (self::$_ruleValue) {\n if (trim(self::$_elementValue) == NULL &&\n strlen(self::$_elementValue) == 0) {\n self::setErrorMessage(\"Field Required\");\n self::setInvalidFlag(true);\n } else {\n self::setInvalidFlag(false);\n }\n }\n }" ]
[ "0.66492856", "0.66092443", "0.6099727", "0.60885715", "0.60039324", "0.59194505", "0.59109366", "0.5886091", "0.58772874", "0.5857938", "0.5842526", "0.57833266", "0.5779513", "0.5754773", "0.57427526", "0.5732554", "0.5729021", "0.57278365", "0.5716129", "0.5713349", "0.5684461", "0.5679623", "0.56745344", "0.5672851", "0.56724554", "0.56721044", "0.56711024", "0.56617177", "0.5659204", "0.56349134" ]
0.71176136
0
/ IMAGE VALIDATION Se requiere modificar el core Form_validation lineas 494 y 532 if (!preg_match("/valid_image/", implode(' ', $rules))) return;
function valid_image($str,$campo) { if($_FILES[$campo]['tmp_name']): /* //Check for image upload if(!isset($_FILES['fuente_pantalla'])) { $this->validation->set_message('valid_image', 'Imagen requerida.'); return false; } //Check for file size if($_FILES['image']['size'] == 0) { $this->validation->set_message('valid_image', 'Imagen requerida.'); return false; } */ //Check for upload errors if($_FILES[$campo]['error'] != UPLOAD_ERR_OK) { $this->CI->form_validation->set_message('valid_image', 'Error al subir el archivo, intente nuevamente.'); return false; } //Check for valid image upload $imginfo = getimagesize($_FILES[$campo]['tmp_name']); if(!$imginfo) { $this->CI->form_validation->set_message('valid_image', '&Uacute;nicamente se permiten archivos de imagen.'); return false; } //Check for valid image types //if( !($imginfo[2] == 1 || $imginfo[2] == 2 || $imginfo[2] == 3) ) // JPG PNG Y GIF if( !($imginfo['mime'] == 'image/jpeg' )) { $this->CI->form_validation->set_message('valid_image', 'Solo se permiten archivos en formato JPG.'); return false; } //Check for existing image /* if(file_exists(SITEPATH.'uploads/images/'.$_FILES['image']['name'])) { $this->validation->set_message('valid_image', 'Image by this name already exists'); return false; }*/ endif; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate_image_field($field)\n {\n }", "public function valid_images($str)\n {\n if (!isset($_FILES['image']) || $_FILES['image']['size'] == 0 || $_FILES['image']['error'] != UPLOAD_ERR_OK) {\n $this->form_validation->set_message('valid_images', 'Image not uploaded.');\n return false;\n }\n\n $imginfo = @getimagesize($_FILES['image']['tmp_name']);\n\n if (!($imginfo[2] == 1 || $imginfo[2] == 2 || $imginfo[2] == 3)) {\n $this->form_validation->set_message('valid_images', 'Only GIF, JPG and PNG Images are accepted');\n return false;\n }\n return true;\n }", "public function rules()\n {\n /* $nbr = count($this->input('image')) - 1;\n foreach(range(0, $nbr) as $index) {\n $rules['image.' . $index] = 'image|mimes:jpeg,png,jpg,gif,svg|max:5000';\n }\n return $rules;*/\n $retorn = [];\n if (($this->file('image.0'))) {\n $retorn[\"image.0\"] = 'image|mimes:jpeg,png,jpg,gif,svg|max:3000';\n }\n if (($this->file('image.1'))) {\n $retorn[\"image.1\"] = 'image|mimes:jpeg,png,jpg,gif,svg|max:3000';\n }\n if (($this->file('image.2'))) {\n $retorn[\"image.2\"] = 'image|mimes:jpeg,png,jpg,gif,svg|max:3000';\n }\n return $retorn;\n }", "private function isValidImage() {\r\n\t\t\treturn in_array($this->extension, $this->extAllowed) ? true : false;\r\n\t\t}", "public function valid_image($str)\n {\n if ($_FILES['image']['size'] > 0 && $_FILES['image']['error'] == UPLOAD_ERR_OK) {\n\n $imginfo = @getimagesize($_FILES['image']['tmp_name']);\n if (!$imginfo) {\n $this->form_validation->set_message('validImage', 'Only image files are allowed');\n return false;\n }\n\n if (!($imginfo[2] == 1 || $imginfo[2] == 2 || $imginfo[2] == 3)) {\n $this->form_validation->set_message('validImage', 'Only GIF, JPG and PNG Images are accepted.');\n return false;\n }\n }\n return true;\n }", "function isValidImage( $file ) {\n\n\t$form_errors = array();\n\n\t$part = explode( \".\", $file );\n\t$extension = end( $part );\n\n\tswitch( strtolower( $extension ) ) {\n\n\t\tcase 'jpg':\n\t\tcase 'gif':\n\t\tcase 'bmp':\n\t\tcase 'png':\n\n\t\treturn $form_errors;\n\n\t}\n\n\t$form_errors[] = $extension . \"is not valid image extension\";\n\n\treturn $form_errors;\n\n}", "protected function validatePhoto(){\n\n $extension = $this->type;\n\n if( !empty($extension)){\n if($extension != 'image/jpeg' && $extension != 'image/png' && $extension != 'image/jpg'){\n $this->errors_on_upload[] = \"Your file should be .jpeg, .jpg or .png\";\n }\n }\n\n if($this->size > Config::MAX_FILE_SIZE){\n $this->errors_on_upload[] = \"Your picture shouldn't be more than 10 Mb\";\n }\n\n if($this->error != 0 && $this->error != 4) { //0 means no error, so if otherwise, display a respective message, 4 no files to upload, we allow that\n $this->errors_on_upload[] = $this->upload_errors_array[$this->error];\n }\n\n }", "private function validatePhoto()\n {\n if (empty($this->photo['name'])) {\n $this->updateEditProfile();\n } else {\n $formatNamePhoto = new \\Module\\administrative\\Models\\helper\\AdmsFormatCharacter();\n $this->dados['imagem'] = $formatNamePhoto->formatCharacters($this->photo['name']);\n $uploadImg = new \\Module\\administrative\\Models\\helper\\AdmsUploadImgRed();\n $uploadImg->uploadImd(\n $this->photo,\n 'assets/image/user/' . $_SESSION['userId'] . '/',\n $this->dados['imagem'],\n 150,\n 150\n );\n if ($uploadImg->getResult()) {\n $deleteImg = new \\Module\\administrative\\Models\\helper\\AdmsDeleteImg();\n $deleteImg->deleteImage('assets/image/user/' \n . $_SESSION['userId'] . '/' . $this->imgageOld);\n $this->updateEditProfile();\n } else {\n $this->result = false;\n }\n }\n }", "public function testValidate() {\n\t\t$validator = new ImageValidator();\n\t\t$validator->addRule('ext', 'Invalid extension', array('png'));\n\n\t\t$this->object->setValidator($validator);\n\n\t\ttry {\n\t\t\t$this->object->upload();\n\n\t\t\t$this->assertTrue(false);\n\n\t\t} catch (Exception $e) {\n\t\t\t$this->assertTrue(true);\n\t\t}\n\t}", "public function validate()\r\n\t{\r\n\t\tLumine_Validator_PHPValidator::clearValidations($this);\r\n\t\t// adicionando as regras \r\n\t\tLumine_Validator_PHPValidator::addValidation($this, 'nomeImagensUteis', Lumine_Validator::REQUIRED_STRING, 'Informe o nome da Imagem');\r\n\t\t\r\n\t\treturn parent::validate();\r\n\t}", "public function rules() {\n\n return [\n 'image' => 'required|image'\n ];\n }", "function __checkImgParams() {\n\t\t/* check file type */\n\t\t$this->__checkType($this->request->data['Upload']['file']['type']);\n\t\t\n\t\n\t\t\n\t\t/* check file size */\n\t\t$this->__checkSize($this->request->data['Upload']['file']['size']);\n\t\t\n\t\t\n\t\t\n\t\t/* check image dimensions */\n\t\t$this->__checkDimensions($this->request->data['Upload']['file']['tmp_name']);\n\t\t\n\t\t\t\n\t}", "public function rules()\n\t{\n\t\treturn array(\n\t\t\tarray('file', 'required'),\n\t\t\tarray('file','file','types'=>'jpg png'),\n\t\t);\n\t}", "public function rules()\n {\n return [\n 'img' => 'required',\n ];\n }", "function upload_validation( $field, $action )\n\t{\t\n\t\t$config['upload_path'] = './themes/web/layout/assets/images/bizlisting/';\n\t\t$config['allowed_types'] = 'gif|jpg|png';\n\t\t$config['max_size'] = '1000';\n\t\t$config['max_width'] = '1024';\n\t\t$config['max_height'] = '768';\t\n\t\t$this->upload->initialize($config);\n\t\tif(count($_FILES[\"image_url\"][\"error\"]) > 1 || (count($_FILES[\"image_url\"][\"error\"]) == 1 && $_FILES[\"image_url\"][\"error\"][0] != 4))\n\t\t{\n\t\t\tswitch($action)\n\t\t\t{\n\t\t\t\tcase 'add' :\n\n\t\t\t\t\tif( !$this->upload->do_multi_upload( 'image_url' ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->form_validation->set_message('upload_validation', $this->upload->display_errors());\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'edit' :\t\n\t\t\t\t\n\t\t\t\t\tif( !$this->upload->do_multi_upload( 'image_url' ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->form_validation->set_message('upload_validation', $this->upload->display_errors());\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t}\t\t\t\t\n\t\t}\n\t}", "public static function ValidateImage($file, &$errors){\n\t\t$hasErrors = false;\n\t\t$fileName = $file[\"name\"];\n\t\t$fileType = $file[\"type\"];\n\t\t$fileSize = intval($file[\"size\"]);\n\t\t$fileTmp = $file[\"tmp_name\"];\n\t\t$fileError = intval($file[\"error\"]);\n\t\t$imageWidth = 0;\n\t\t$imageHeight = 0;\n\t\tif(empty($fileName) || empty($fileSize)){\n\t\t\t$errors .= ' <li><p class=\"error\"><img src=\"img/error.png\" alt=\"Error\" />Debe seleccionar una imagen</p></li>';\n\t\t\t$hasErrors = true;\n\t\t}\n\t\tif($fileType != 'image/gif' && $fileType != 'image/jpeg' && $fileType != 'image/jpg' && $fileType != 'image/png'){\n\t\t\t$errors .= ' <li><p class=\"error\"><img src=\"img/error.png\" alt=\"Error\" />Solo se permiten imagenes jpg, png y gif</p></li>';\n\t\t\t$hasErrors = true;\n\t\t} else {\n\t\t\t$errors .= ' <li><p class=\"success\"><img src=\"img/accept.png\" alt=\"Valido\" />Formato \"'.$fileType.'\" v&aacute;lido</p></li>';\n\t\t\t$info = getimagesize($fileTmp);\n\t\t\t$imageWidth = intval($info[0]);\n\t\t\t$imageHeight = intval($info[1]);\n\t\t}\n\t\tif($imageWidth < 300){\n\t\t\t$errors .= '<li><p class=\"error\"><img src=\"img/error.png\" alt=\"Error\" />La imagen debe tener al menos 300 pixeles de ancho</p></li>';\n\t\t\t$hasErrors = true;\n\t\t} else {\n\t\t\t$errors .= ' <li><p class=\"success\"><img src=\"img/accept.png\" alt=\"Valido\" />La imagen supera los 300 p&iacute;xeles de ancho</p></li>';\n\t\t}\n\t\tif($imageHeight < 200){\n\t\t\t$errors .= '<li><p class=\"error\"><img src=\"img/error.png\" alt=\"Error\" />La imagen debe tener al menos 200 pixeles de alto</p></li>';\n\t\t\t$hasErrors = true;\n\t\t} else {\n\t\t\t$errors .= ' <li><p class=\"success\"><img src=\"img/accept.png\" alt=\"Valido\" />La imagen supera los 200 p&iacute;xeles de alto</p></li>';\n\t\t}\n\t\tif($fileSize > 2097152){\n\t\t\t$errors .= '<li><p class=\"error\"><img src=\"img/error.png\" alt=\"Error\" />El archivo no debe superar los 2048 KB (2 MB)</p></li>';\n\t\t\t$hasErrors = true;\n\t\t} elseif (!empty($fileSize)) {\n\t\t\t$errors .= ' <li><p class=\"success\"><img src=\"img/accept.png\" alt=\"Valido\" />El archivo pesa menos de 2 MB</p></li>';\n\t\t}\n\t\tif($fileError > 0 && $fileError != 4){\n\t\t\t$errors .= '<li><p class=\"error\"><img src=\"img/error.png\" alt=\"Error\" />Error al subir el archivo, intentelo nuevamente.</p></li>';\n\t\t\t$hasErrors = true;\n\t\t}\n\t\treturn $hasErrors;\n\t}", "public function rules()\n\t{\n\t\treturn [\n\t\t\t'image' => 'required|mimes:jpeg,png',\n\t\t];\n\t}", "public function rules() {\n return array(\n array('image_path', 'required'),\n array('image','file', 'types'=>'jpg, jpeg', 'maxSize'=>1024 * 1024 * 1, 'tooLarge'=>'ขนาดต้องไม่เกิน 1MB / File has to be smaller than 1MB',\n 'message' => 'กรุณาอัพโหลดภาพ</br>'\n . 'Please upload a photo.'),\n );\n }", "function validatePicture($fieldname)\n{\n $error = '';\n if (!empty($_FILES[$fieldname]['error'])) {\n switch ($_FILES[$fieldname]['error']) {\n case '1':\n $error = 'Upload maximum file is '.number_format(IMG_UPLOAD_MAX_SIZE/1024,2).' MB.';\n break;\n case '2':\n $error = 'File is too big, please upload with smaller size.';\n break;\n case '3':\n $error = 'File uploaded, but only halef of file.';\n break;\n case '4':\n $error = 'There is no File to upload';\n break;\n case '6':\n $error = 'Temporary folder not exists, Please try again.';\n break;\n case '7':\n $error = 'Failed to record File into disk.';\n break;\n case '8':\n $error = 'Upload file has been stop by extension.';\n break;\n case '999':\n default:\n $error = 'No error code avaiable';\n }\n } elseif (empty($_FILES[$fieldname]['tmp_name']) || $_FILES[$fieldname]['tmp_name'] == 'none') {\n $error = 'There is no File to upload.';\n } elseif ($_FILES[$fieldname]['size'] > IMG_UPLOAD_MAX_SIZE) {\n $error = 'Upload maximum file is '.number_format(IMG_UPLOAD_MAX_SIZE/1024,2).' MB.';\n } else {\n //$get_ext = substr($_FILES[$fieldname]['name'],strlen($_FILES[$fieldname]['name'])-3,3);\t\n $cekfileformat = check_image_type($_FILES[$fieldname]);\n if (!$cekfileformat) {\n $error = 'Upload Picture only allow (jpg, gif, png)';\n }\n }\n\n return $error;\n}", "public function rules()\n {\n $rules = [\n 'name' => 'required',\n 'description' => 'required'\n ];\n //Por cada imagen, añadimos las reglas.\n $images = count($this->input('entity-images'));\n foreach(range(0, $images) as $index) {\n $rules['entity-images.' . $index] = 'image|mimes:jpeg,png,jpg,gif|max:5000';\n }\n\n return $rules;\n }", "public static function validateImageFile()\n {\n if (!isset($_FILES['logo_file'])) {\n Session::add('feedback_negative', Text::get('FEEDBACK_AVATAR_IMAGE_UPLOAD_FAILED'));\n return false;\n }\n if ($_FILES['logo_file']['size'] > 5000000) {\n // if input file too big (>5MB)\n Session::add('feedback_negative', Text::get('FEEDBACK_AVATAR_UPLOAD_TOO_BIG'));\n return false;\n }\n // get the image width, height and mime type\n $image_proportions = getimagesize($_FILES['logo_file']['tmp_name']);\n // if input file too small\n if ($image_proportions[0] < Config::get('AVATAR_SIZE') || $image_proportions[1] < Config::get('AVATAR_SIZE')) {\n Session::add('feedback_negative', Text::get('FEEDBACK_AVATAR_UPLOAD_TOO_SMALL'));\n return false;\n }\n if (!($image_proportions['mime'] == 'image/jpeg')) {\n Session::add('feedback_negative', Text::get('FEEDBACK_AVATAR_UPLOAD_WRONG_TYPE'));\n return false;\n }\n return true;\n }", "public function validateMultiple()\n {\n if (is_array($this->name)) {\n for ($i = 0; $i < count($this->name); $i++) {\n $this->name[$i] = strtolower($this->name[$i]);\n $name = explode(\".\", $this->name[$i]);\n // image name\n $this->name[$i] = sha1($name[0] . time() . rand());\n // image extension\n $this->ext[$i] = array_values(array_slice($name, -1))[0];\n\n if (!in_array($this->ext[$i], $this->extensions)) {\n $this->uploadErrors[] = \"error File type not allowed\";\n }\n if ($this->size[$i] > 50000000) {\n $this->uploadErrors[] = \"Image File is too large\";\n }\n if ($this->errors[$i] > 0) {\n $this->uploadErrors[] = \"error uploading File\";\n }\n $this->image[$i] = $this->name[$i] . \".\" . $this->ext[$i];\n\n }\n }\n }", "public function rules()\n {\n return [\n 'avatar' => RvMedia::imageValidationRule(),\n ];\n }", "public function rules()\n {\n\n $fieldName = $this->input('image_fieldname');\n\n// dd($this->input);\n\n return [\n $fieldName => 'required | image',\n ];\n }", "public function testValidateDocumentImageValidation()\n {\n }", "function file_is_valid_image($path)\n {\n }", "public function rules()\n {\n return [\n 'image'=>'required|mimes:jpeg,jpg,png,gif|image|max:6000'\n ];\n }", "public function rules()\n {\n return [\n 'imagen' => 'required|mimes:jpeg|max:2048'\n\n\n ];\n }", "public static function post_image_validation($type,$size){\n\t\t\t$check_type = Posts_image::get_image_type($type);\n\t\t\t$check_size = $size;\n\t\t\t$check_ext = Posts_image::get_image_ext($type);\n\t\t\t\n\t\t\tif($check_type !== \"image\"){\n\t\t\t\tself::$_errors['imagetype'] = \"Your file must be image.\";\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tif($check_ext !== \".jpg\" && $check_ext !== \".png\" && $check_ext !== \".gif\"){\n\t\t\t\tself::$_errors['imageext'] = \"Only <b>JPG, PNG and GIF</b> format are allowed.\";\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tif($check_size > 4000000){\n\t\t\t\tself::$_errors['imagesize'] = \"Image can't be larger then 4MB.\";\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tif(empty(self::$_errors)){return true;}else{return false;}\n\t\t\t\n\t\t}", "public function rules()\n {\n return [\n 'owner_id' => 'required|numeric',\n 'image_type_id' => 'required|numeric|exists:image_types,id',\n 'file' => 'required|image'\n ];\n }" ]
[ "0.74268645", "0.7194236", "0.7149642", "0.711936", "0.71177435", "0.71109235", "0.70786494", "0.7025351", "0.6979204", "0.69622344", "0.6839643", "0.67637414", "0.67509955", "0.674953", "0.6744146", "0.6727474", "0.6675485", "0.66685075", "0.6659504", "0.66581726", "0.66572964", "0.6652793", "0.6648749", "0.6644489", "0.662579", "0.6624955", "0.66217345", "0.65961236", "0.65739954", "0.6549607" ]
0.74498755
0
/ FECHA VALIDA VALIDA QUE LA FECHA VENGA EN FORMATO dd/mm/aaaa
function fecha($str) { $this->CI->form_validation->set_message('fecha', "El campo %s debe contener una fecha en formato dd/mm/aaaa."); return (bool) preg_match("/(^([0]?[1-9]|[1|2][0-9]|[3][0|1])(\/)([0]?[1-9]|[1][0-2])(\/)([0-9]{4}|[0-9]{2})$)|^$/", $str); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fecha_valida($fecha){\n if(ereg( \"([0-9]{2})/([0-9]{2})/([0-9]{4})\",$fecha)){\n ereg( \"([0-9]{2})/([0-9]{2})/([0-9]{4})\", $fecha, $mifecha);\n $ok = checkdate($mifecha[2],$mifecha[1],$mifecha[3]);\n if($ok){\n $actual = date(\"Y-m-d\");\n $older = \"1900-01-01\";\n $dtime = strtotime(fecha_mysql($fecha));\n $dtime_ac = strtotime($actual);\n $dtime_ol = strtotime($older);\n if($dtime>$dtime_ac || $dtime<$dtime_ol){\n return false;\n }else{\n return true;\n }\n }else{\n // fecha fuera del calendario\n return false;\n } \n }else{\n // formato no valido\n return false;\n }\n}", "function __validFecha2($fecha){\n $test_arr = explode('-', $fecha);\n if (count($test_arr) == 3) {\n if (checkdate($test_arr[1], $test_arr[2], $test_arr[0])) {//YEAR / MES / DIA\n return true;\n }\n return false;\n }\n return false;\n }", "function __validFecha($fecha){\n $test_arr = explode('/', $fecha);\n if (count($test_arr) == 3) {\n if (checkdate($test_arr[1], $test_arr[0], $test_arr[2])) {//MES / DIA / YEAR\n return true;\n }\n return false;\n }\n return false;\n }", "function ValidarFechas($fechaIngreso, $fechaInicio){\n\t// $fechaInicio = formatDateSeparador(\"d/m/Y\", $fechaInicio, '-' );\t\t\n\t\n\t// date_format($fechaInicio,\"d/m/Y\");\t\n\tif( !isFechaValida($fechaIngreso) ) return 'Fecha Ingreso Invalida '.$fechaIngreso;\n\tif( !isFechaValida($fechaInicio) ) return 'Fecha Inicio Invalida '.$fechaInicio;\n\t\n\t$dias = dateDiff($fechaIngreso, $fechaInicio);\n\tif($dias < 0) return 'Fecha Inicio de la exposicion, Debe ser mayor/igual a la fecha de Ingreso a la empresa. ';\n\t\n\t$hoy = date(\"d/m/Y\");\n\t$dias = dateDiff($fechaInicio, $hoy);\n\tif($dias < 0) return 'Fecha Inicio de la exposicion, Debe ser menor/igual a la fecha actual. ';\n\t\n\treturn '';\n\t\n}", "function dateValidation($value) {\n\t$reg = \"/^(((0?[1-9]|1[012])\\/(0?[1-9]|1\\d|2[0-8])|(0?[13456789]|1[012])\\/(29|30)|(0?[13578]|1[02])\\/31)\\/(19|[2-9]\\d)\\d{2}|0?2\\/29\\/((19|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$/\";\n\treturn preg_match($reg,$value);\n}", "function checkDateFormat($date)\n{\n //match the format of the date\n if (preg_match (\"/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/\", $date, $parts))\n {\n //check weather the date is valid of not\n if(checkdate($parts[2],$parts[3],$parts[1]))\n return true;\n else\n return false;\n }\n else\n return false;\n}", "function validateDate($Fecha, $Formato = 'Ymd')\n{\n $d = DateTime::createFromFormat($Formato, $Fecha);\n return $d && $d->format($Formato) == $Fecha;\n}", "function is_date_format_valid($date)\n{\n return preg_match(\"/(0[1-9]|[12][0-9]|3[01])[ \\.](0[1-9]|1[012])[ \\.](19|20)\\d\\d/\", $date) !== 0;\n}", "function fechaInvalida($fecha){\n $valores = explode('-', $fecha);\n if(count($valores) == 3 && checkdate($valores[1], $valores[2], $valores[0])){\n return false;\n }\n return true;\n }", "public function validarFecha($texto){\n $valores = explode('-', $texto);\n if(count($valores) == 3 && checkdate($valores[1], $valores[2], $valores[0])){\n return true;\n }\n return false;\n }", "function validate_date() {\n # Check the date is in ISO date format\n if (ereg('(19|20)[0-9]{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])', $this->cur_val)) {\n # Remove any existing error message\n $this->error_message = \"\";\n\n # Return Value\n return $this->cur_val;\n }\n else {\n # Set Error Message\n $this->set_error(\"Validation for date ({$this->cur_val}) failed. This is type \" . gettype($this->cur_val));\n\n # Return Blank Date\n return \"0000-00-00\";\n }\n }", "function validateDate($postVar, $value, $error) {\n $errorMsg = \"\";\n $length = strlen(trim($postVar));\n\n //checking if the length isset or not\n if ($length) {\n if (isset($value)) {\n $found = strpos($value, ',');\n if ($found === false) {\n $options [0] = $value;\n } else {\n $options = explode(\",\", $value);\n }\n } else {\n $options [0] = 'dd-mm-yyyy';\n }\n\n $patternMatch = 0;\n\n foreach ($options as $opt) {\n $pos1 = strpos($opt, '-');\n $pos2 = strpos($opt, '/');\n $pos3 = strpos($opt, '.');\n\n if ($pos1 !== false) {\n if ($pos1 == 2) {\n if (strlen($opt) == 8)\n $regexp = '/^[0-9]{2}[\\-][0-9]{2}[\\-][0-9]{2}$/';\n else\n $regexp = '/^[0-9]{2}[\\-][0-9]{2}[\\-][0-9]{4}$/';\n }\n if ($pos1 == 4)\n $regexp = '/^[0-9]{4}[\\-][0-9]{2}[\\-][0-9]{2}$/';\n }\n\n if ($pos2 !== false) {\n if ($pos2 == 2) {\n if (strlen($opt) == 8)\n $regexp = '/^[0-9]{2}[\\/][0-9]{2}[\\/][0-9]{2}$/';\n else\n $regexp = '/^[0-9]{2}[\\/][0-9]{2}[\\/][0-9]{4}$/';\n }\n if ($pos2 == 4)\n $regexp = '/^[0-9]{4}[\\/][0-9]{2}[\\/][0-9]{2}$/';\n }\n\n if ($pos3 !== false) {\n if ($pos3 == 2) {\n if (strlen($opt) == 8)\n $regexp = '/^[0-9]{2}[\\.][0-9]{2}[\\.][0-9]{2}$/';\n else\n $regexp = '/^[0-9]{2}[\\.][0-9]{2}[\\.][0-9]{4}$/';\n }\n if ($pos3 == 4)\n $regexp = '/^[0-9]{4}[\\.][0-9]{2}[\\.][0-9]{2}$/';\n }\n\n if (preg_match($regexp, $postVar)) {\n $patternMatch = 1;\n if ((isset($pos1) && $pos1 == 2) || (isset($pos2) && $pos2 == 2) || (isset($pos3) && $pos3 == 2)) {\n $str1 = substr($opt, 0, 2);\n $str2 = substr($opt, 3, 2);\n\n if ($str1 == 'dd') {\n $DD = substr($postVar, 0, 2);\n $MM = substr($postVar, 3, 2);\n $YY = substr($postVar, 6);\n }\n if ($str1 == 'mm') {\n $MM = substr($postVar, 0, 2);\n $DD = substr($postVar, 3, 2);\n $YY = substr($postVar, 6);\n }\n if ($str1 == 'yy') {\n if ($str2 == 'mm') {\n $YY = substr($postVar, 0, 2);\n $MM = substr($postVar, 3, 2);\n $DD = substr($postVar, 6);\n } else {\n $MM = substr($postVar, 0, 2);\n $DD = substr($postVar, 3, 2);\n $YY = substr($postVar, 6);\n }\n }\n }\n\n if ((isset($pos1) && $pos1 == 4) || (isset($pos2) && $pos2 == 4) || (isset($pos3) && $pos3 == 4)) {\n $str = substr($opt, 5, 2);\n\n if ($str == 'dd') {\n $YY = substr($postVar, 0, 4);\n $DD = substr($postVar, 5, 2);\n $MM = substr($postVar, 8, 2);\n }\n if ($str == 'mm') {\n $YY = substr($postVar, 0, 4);\n $MM = substr($postVar, 5, 2);\n $DD = substr($postVar, 8, 2);\n }\n }\n\n if ($DD == 0 || $MM == 0 || $YY == 0) {\n $errorMsg .= \"Invalid Date...<br>\";\n }\n\n if ($MM <= 12) {\n switch ($MM) {\n case 4 :\n case 6 :\n case 9 :\n case 11 :\n if ($DD > 30) {\n $errorMsg .= \"Selected month has maximum 30 days.<br>\";\n }\n default :\n if ($DD > 31) {\n $errorMsg .= \"Selected month has maximum 31 days.<br>\";\n }\n break;\n }\n } else {\n $errorMsg .= \"Selected month more than 12 month.<br>\";\n }\n\n if (($YY % 4) == 0) {\n if (($MM == 2) && ($DD > 29)) {\n $errorMsg .= \"Invalid days in February for leap year.<br>\";\n }\n } else {\n if (($MM == 2) && ($DD > 28)) {\n $errorMsg .= \"Invalid days in February for non leap year.<br>\";\n }\n }\n }\n\n if ($patternMatch)\n break;\n }\n\n if (!$patternMatch)\n $errorMsg .= $error;\n }\n return $errorMsg;\n }", "function valid_date( $value = '', $format = 'Y-m-d H:i:s' )\n\t{\n\t\t$date = date_parse($value);\n\t\t$valid = ( $date['error_count'] == 0 && checkdate($date['month'], $date['day'], $date['year']) );\n\t\t\n\t\t/*\n\t\t// Create a date depending on PHP version\n\t\t$version = explode('.', phpversion());\n\t\tif (((int) $version[0] >= 5 && (int) $version[1] >= 2 && (int) $version[2] > 17))\n\t\t{\n\t\t\t$d = DateTime::createFromFormat($format, $date);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$d = new DateTime(date($format, strtotime($date)));\n\t\t}\n\t\t*/\n\t\t/*\n\t\t// Check valid date\n\t\t$format = 'Y-m-d H:i:s';\n\t\t$d = new DateTime(date($format, strtotime($date)));\n\t\t$valid_date = ( $d && $d->format($format) == $date );\n\t\t// or\n\t\t$date = date_parse($date);\n\t\t$valid_date = ( $date['error_count'] == 0 && checkdate($date['month'], $date['day'], $date['year']) );\n\t\tif ( ! $valid_date )\n\t\t{\n\t\t\t$valid = false;\n\t\t\t$return_message[] = 'The approved date is invalid.';\n\t\t}\n\t\t*/\n\t\t\n\t\tif ( ! $valid )\n\t\t{\n\t\t\t$this->set_message('valid_date', 'The %s field has in invalid date.');\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "function validateDate($date){\r\n $date = trim($date);\r\n $date_arr = explode(\"/\", $date);\r\n return checkdate ( $date_arr[0] , \"01\" , $date_arr[1] );\r\n\r\n}", "function validDate($input_data) \r\n{\r\n $date = DateTime::createFromFormat($input_data, readline(\"Masukkan tanggal/bulan/tahun dengan angka! : \"));\r\n echo $date->format('l d-M-Y');\r\n}", "function dayFormat ($value){\n \n if(strlen($value) == 0){\n return true;\n }\n \n else if(!preg_match(VALID_DAY_FORMAT,$value)){\n return false;\n }\n \n return true;\n}", "function validateDate($value) {\n\tif(ereg(\"^(([1-9])|(0[1-9])|(1[0-2]))\\/(([0-9])|([0-2][0-9])|(3[0-1]))\\/(([0-9][0-9])|([1-2][0,9][0-9][0-9]))$\", $value, $regs)) {\n\t\techo \"true\";\n\t} else {\n\t\techo \"false\";\n\t}\n}", "function validateDateFormat($date, $format);", "function validaNascimento($ano, $mes, $dia)\n{\n\n $dataCheck = $ano.'-'.$mes.'-'.$dia;\n if (checkdate($mes, $dia, $ano) && $dataCheck<=date('Y-m-d'))\n return true;\n else return false;\n}", "function validateDate($date,$format ='Y-m-d'){\n$d = dateTime::createFromFormat($format,$date);\n\nif($d && $d->format($format) == $date){\nreturn true;\n } else {\n return false;\n }\n}", "public static function check_date($value, $format='dd.mm.yyyy') {\n\t\tif (strlen($value) >= 6 && strlen($format) == 10) { \n\t // find separator. Remove all other characters from $format \n\t $separator_only = str_replace(array('m','d','y'),'', $format); \n\t $separator = $separator_only[0]; // separator is first character \n\t \n\t if ($separator && strlen($separator_only) == 2) { \n\t // make regex \n\t $regexp = str_replace('mm', '(0?[1-9]|1[0-2])', $format); \n\t $regexp = str_replace('dd', '(0?[1-9]|[1-2][0-9]|3[0-1])', $regexp); \n\t $regexp = str_replace('yyyy', '(19|20)?[0-9][0-9]', $regexp); \n\t $regexp = str_replace($separator, \"\\\\\" . $separator, $regexp); \n\t \n\t if ($regexp != $value && preg_match('/'.$regexp.'\\z/', $value)) { \n\t // check date \n\t $arr=explode($separator,$value); \n\t $day=$arr[0]; \n\t $month=$arr[1]; \n\t $year=$arr[2]; \n\t \n\t if (@checkdate($month, $day, $year)) {\n\t return true; \n\t }\n\t } \n\t } \n\t } \n\t return false; \n\t}", "function verifyDate($date) {\r\n $date = trim($date);\r\n if (!is_numeric($date) || strlen($date) != 8) {\r\n return false;\r\n }\r\n $year = substr($date, 0, 4);\r\n $month = substr($date, 4, 2);\r\n $day = substr($date, 6);\r\n if (!checkdate($month, $day, $year)) {\r\n return false;\r\n } else {\r\n return \"$year-$month-$day\";\r\n }\r\n}", "function valid_date($str) \n\t{\n\t\t//if (ereg(\"([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\", $str)) {\n\t\tif (preg_match(\"/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/\", $str)) \n\t\t{\n\t\t\t//$arr = split(\"-\", $str);\n\t\t\t$arr = preg_split(\"/-/\", $str);\n\t\t\t$yyyy = (int) $arr[0];\n\t\t\t$mm = (int) $arr[1];\n\t\t\t$dd = (int) $arr[2];\n\t\t\treturn checkdate($mm, $dd, $yyyy);\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function nrua_validateDate($date, $format = 'Y-m-d H:i:s')\n{\n $d = DateTime::createFromFormat($format, $date);\n return $d && $d->format($format) == $date;\n}", "function validar_fecha_stock($fechaStock)\n{\n //$fecha = date('d-m-Y');\n $fecha = date('d/m/Y');\n //$fecha = strftime($fecha);\n\n if ($fecha == $fechaStock) {\n return true;\n }\n\n return false;\n}", "function _validarFecha($valor) {\n if (! ($tiempo = strtotime($valor))) return false; \n $d = date('Y-m-d H:i:s', $tiempo);\n $datetime = explode(' ', $d);\n if ('00:00:00' == $datetime[1]){\n return $datetime[0];\n } else {\n return $d;\n }\n }", "public static function validateDate($input)\r\n\t{\r\n\t\treturn preg_match('/\\d{2}-\\d{2}-\\d{4}/', $input) && (strlen($input) == 10);\r\n\t}", "function isValidShortDate ($var) {\n //Returns error message for an invalid date\n \n //Check for unsafe characters\n $msg = isSantizeString($var);\n if ($msg != \"\") {\n return $msg;\n }\n // Format mm/dd/yy or mm/dd/yyyy\n $tmpDate = explode(\"/\",$var);\n\n //if the date can't be split into 3 parts, then a \"/\" was missing\n if (count($tmpDate) != 3) {\n return \"Invalid Date\"; \n }\n \n // isValidInt does not validate numbers with leading zeros. Strip off the leading zeros.\n $tmpDate[0] = ltrim($tmpDate[0], \"0\"); \n $tmpDate[1] = ltrim($tmpDate[1], \"0\"); \n $tmpDate[2] = ltrim($tmpDate[2], \"0\");\n \n //Make sure all of the parts are valid numbers\n if (isValidInt($tmpDate[0]) == \"\" && isValidInt($tmpDate[1]) == \"\" && isValidInt($tmpDate[2]) == \"\") {\n \n // Use checkdate to validate the date\n if (checkdate($tmpDate[0], $tmpDate[1], $tmpDate[2])) { //checkdate(month, day, year)\n return \"\";\n } else {\n return \"Invalid Date\";\n }\n } else {\n return \"Invalid Date\";\n }\n}", "function validateDateFormat($date, $field)\n\t{\n\t\tif (preg_match (\"/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/\", $date, $parts))\n\t\t{\n\t\t //check weather the date is valid of not\n\t\t\t\t\tif(checkdate($parts[2],$parts[3],$parts[1]))\n\t\t\t\t\t\treturn true;\n\t\t\t\t\telse\n\t\t\t\t\t return $this->setError(10011, \"error\", \"\", $field);\n\t\t}\n\t\telse\n\t\t\treturn $this->setError(10011, \"error\", \"\", $field);\n\t}", "public function verif_fecha($fecha){\n $fecha = $fecha;\n $valores = explode('/', $fecha);\n\n if(count($valores)==3){\n if(checkdate($valores[1],$valores[0],$valores[2])){\n return 'true';\n }\n else{\n return 'false';\n }\n }\n else{\n return 'false';\n }\n }" ]
[ "0.7377425", "0.72552073", "0.7251032", "0.7169811", "0.7087392", "0.70379645", "0.7023831", "0.7000162", "0.6946052", "0.6920187", "0.6917243", "0.69047433", "0.68789506", "0.68643683", "0.6859587", "0.68500394", "0.6832741", "0.68321055", "0.6812461", "0.6811427", "0.67629945", "0.6759674", "0.67143995", "0.67100435", "0.6708235", "0.67004997", "0.66912645", "0.6683297", "0.6666357", "0.664948" ]
0.7256409
1
VALIDA QUE LA FECHA DE ENTREGA SEA MAYOR A 3 DIAS HABILES A LA FECHA DE LA ORDEN DE COMPRA
function fecha_entrega($fecha_entrega) { $hoy = date('Y-m-d'); $fecha_valida = date('Y-m-d',strtotime('+3 day',strtotime($hoy))); if($fecha_entrega < $fecha_valida) { $this->CI->form_validation->set_message('fecha_entrega', "El campo %s debe de ser por lo menos 3 d&iacute;as h&aacute;biles despu&eacute;s de la fecha de la orden de compra."); return FALSE; } return TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fecha_instalacion($fecha_instalacion)\n\t{\n\t\t$hoy = date('Y-m-d');\n\t\t$fecha_valida = date('Y-m-d',strtotime('+3 day',strtotime($hoy)));\n\t\t$fecha_maxima = date('Y-m-d',strtotime('+6 month',strtotime($hoy)));\n\t\tif(($fecha_instalacion < $fecha_valida) || ($fecha_instalacion > $fecha_maxima))\n\t\t{\n\t\t\t$this->CI->form_validation->set_message('fecha_instalacion', \"El campo %s debe de ser por lo menos 3 d&iacute;as h&aacute;biles despu&eacute;s de la fecha de la orden de compra y menor a 6 meses de la misma.\");\n\t\t\treturn FALSE;\n\t\t}\n\t\treturn TRUE;\n\t}", "function __validFecha2($fecha){\n $test_arr = explode('-', $fecha);\n if (count($test_arr) == 3) {\n if (checkdate($test_arr[1], $test_arr[2], $test_arr[0])) {//YEAR / MES / DIA\n return true;\n }\n return false;\n }\n return false;\n }", "function validar($reservah, $reservaf) {\n list($añor, $mesr, $diar) = split('[/.-]', $reservaf);\n list($horar, $minr) = split('[:]', $reservah);\n list($dia, $mes, $año) = $this->fecha();\n list($hora, $min, $mer) = $this->horario();\n\n $result = false;\n $hoy = false;\n\n //es una fecha valida?\n if (($añor >= $año) && ($mesr >= $mes) && ($diar >= $dia)) {\n //es hoy?\n if (($añor == $año) && ($mesr == $mes) && ($diar == $dia)) {\n $hoy = true;\n }\n if ($hoy) {\n //es hoy\n //verifico que sea una hora valida, y no una que ya pasó.\n if (($horar >= $hora) || ($horar == $hora && $minr > $min)) {\n $result = true;\n }\n } else {\n //es otro dia\n $result = true;\n }\n }\n return $result;\n }", "function fncValidaDI_46($IdEstado, $GestorErr, $NumReg, $Campo, $Campo2)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_46 = \"(46)Periodo de Pago Final\";\n\t$DI_46_ErrTam = \"Periodo de Pago Final ser de 8 Caracteres AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_46_noDI \t = \"Periodo de Pago Final no corresponde al formato establecido por DGRH(AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_46_PerFinal = \"El perido final no puede ser menor al Periodo Inicial\";\t\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == OCHO)\n\t{\n\t\tif(!validateDate($LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_46.\"|\".$LocCampo.\"|\" . $DI_46_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\n\t\tif(validateDate($LocCampo) and validateDate($Campo2))\t\n\t\t{\n\t\t\t$Fecha1 = date_create($LocCampo);\n\t\t\t$Fecha2 = date_create($Campo2);\n\t\t\t$interval = date_diff($Fecha1, $Fecha2);\n\t\t\tif(intval($interval->format('%R%a') )> CERO)\n\t\t\t{\n\t\t\t\t\t$Error = $NumReg .\"|\".$DI_46.\"|\".$LocCampo.\"|\" . \n\t\t\t\t\t$DI_46_PerFinal.\"(\". $LocCampo . \")(\". $Campo2 .\")|\\n\";\n\t\t\t\t\tfwrite($GestorErr, $Error);\n\t\t\t\t\t$Bandera = UNO;\n\t\t\t}\t\n\t\t}\t\n\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_46.\"|\".$LocCampo.\"|\" . $DI_46_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_45($IdEstado, $GestorErr, $NumReg, $Campo, $Campo2)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_45 = \"(45)Periodo de Pago Inicial\";\n\t$DI_45_ErrTam = \"Periodo de Pago Inicial ser de 8 Caracteres AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_45_noDI \t = \"Periodo de Pago Inicial no corresponde al formato establecido por DGRH(AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_45_PerFinal \t = \"Periodo de Pago Inicial no puede ser posterior a Periodo de Pago Final\";\t\t\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == OCHO)\n\t{\n\t\tif(!validateDate($LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_45.\"|\".$LocCampo.\"|\" . $DI_45_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\n\t\tif(validateDate($LocCampo) and validateDate($Campo2))\t\n\t\t{\n\t\t\t$Fecha1 = date_create($LocCampo);\n\t\t\t$Fecha2 = date_create($Campo2);\n\t\t\t$interval = date_diff($Fecha1, $Fecha2);\n\t\t\tif(intval($interval->format('%R%a') )< CERO)\n\t\t\t{\n\t\t\t\t\t$Error = $NumReg .\"|\".$DI_45.\"|\".$LocCampo.\"|\" . \n\t\t\t\t\t$DI_45_PerFinal .\"(\" .$LocCampo.\" )(\". $Campo2.\")|\\n\";\n\t\t\t\t\tfwrite($GestorErr, $Error);\n\t\t\t\t\t$Bandera = UNO;\n\t\t\t}\t\n\t\t}\t\n\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_45.\"|\".$LocCampo.\"|\" . $DI_45_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function comprobar_NUMINVENTARIOESPACIO(){\n\t$errores = array();\n\t$correcto=true;\n //Compruebo si el valor es null o no es vacio\n if (($this->NUMINVENTARIOESPACIO == null) || (strlen($this->NUMINVENTARIOESPACIO) == 0)){\n\n \t$mensajeError = array (\n \"nombreatributo\" => \"NUMINVENTARIOESPACIO\",\n \"codigoincidencia\" => \"00001\",\n \"mensajeerror\" => \"Atributo vacío\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n }\n\tif((int)$this->NUMINVENTARIOESPACIO<=0){\n\t $mensajeError = array (\n \"nombreatributo\" => \"NUMINVENTARIOESPACIO\",\n \"codigoincidencia\" => \"00004\",\n \"mensajeerror\" => \"Valor de atributo numérico demasiado corto\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n}\n\t\nif((int)$this->NUMINVENTARIOESPACIO>=99999999){\n\t $mensajeError = array (\n \"nombreatributo\" => 'NUMINVENTARIOESPACIO',\n \"codigoincidencia\" => \"00002\",\n \"mensajeerror\" => \"Valor de atributo demasiado largo\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n}\n\tif (!preg_match(\"/^[\\d]+$/\",$this->NUMINVENTARIOESPACIO)){\n\t\t $mensajeError = array (\n \"nombreatributo\" => 'NUMINVENTARIOESPACIO',\n \"codigoincidencia\" => \"00070\",\n \"mensajeerror\" => \"Solo se permiten números\"\n );\n\t\t$errores[]=$mensajeError;\n\t\treturn $errores;\n\t}\n\tif($correcto==TRUE){\n\t\treturn TRUE;\n\t}else{\n\t\treturn $errores;\n\t}\n}", "function validaEnteroConSigno ($Cad) {\n// prueba si la entrada es un entero, con un signo opcional\nreturn preg_match(\"/^-?([0-9])+$/\", $Cad );\n}", "public function validacion_fecha($fec){\n \n self::set_fecha($fec); // asignar la fecha\n $partes= explode(\"-\", self::get_fecha()); \n echo \"<br><br>\";\n echo \"Fecha Ingresada <br><br>\";\n print_r($partes);\n $actual = array(date(\"Y\"),date(\"m\"),date(\"d\"));\n echo \"<br><br>\";\n echo \"Fecha actual <br><br>\";\n print_r($actual);\n \n if(self::escritura_valida($partes) && self::fecha_mayor_actual($actual, $partes)) // si es valida la escritura y la fecha es mayor a la actual es correcta la fecha\n {\n return true;\n }\n else{\n return false;\n }\n }", "function ValidarFechas($fechaIngreso, $fechaInicio){\n\t// $fechaInicio = formatDateSeparador(\"d/m/Y\", $fechaInicio, '-' );\t\t\n\t\n\t// date_format($fechaInicio,\"d/m/Y\");\t\n\tif( !isFechaValida($fechaIngreso) ) return 'Fecha Ingreso Invalida '.$fechaIngreso;\n\tif( !isFechaValida($fechaInicio) ) return 'Fecha Inicio Invalida '.$fechaInicio;\n\t\n\t$dias = dateDiff($fechaIngreso, $fechaInicio);\n\tif($dias < 0) return 'Fecha Inicio de la exposicion, Debe ser mayor/igual a la fecha de Ingreso a la empresa. ';\n\t\n\t$hoy = date(\"d/m/Y\");\n\t$dias = dateDiff($fechaInicio, $hoy);\n\tif($dias < 0) return 'Fecha Inicio de la exposicion, Debe ser menor/igual a la fecha actual. ';\n\t\n\treturn '';\n\t\n}", "function __validFecha($fecha){\n $test_arr = explode('/', $fecha);\n if (count($test_arr) == 3) {\n if (checkdate($test_arr[1], $test_arr[0], $test_arr[2])) {//MES / DIA / YEAR\n return true;\n }\n return false;\n }\n return false;\n }", "function comprobar_CODCENTRO(){\n\t$errores = array();\n\t$correcto=true;\n //Compruebo si el valor es null o no es vacio\n if (($this->CODCENTRO == null) || (strlen($this->CODCENTRO) == 0)){\n\n \t$mensajeError = array (\n \"nombreatributo\" => \"CODCENTRO\",\n \"codigoincidencia\" => \"00001\",\n \"mensajeerror\" => \"Atributo vacío\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n }\n\tif(strlen($this->CODCENTRO)<3){\n\t $mensajeError = array (\n \"nombreatributo\" => \"CODCENTRO\",\n \"codigoincidencia\" => \"00003\",\n \"mensajeerror\" => \"Valor de atributo no numérico demasiado corto\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n}\n\t\nif(strlen($this->CODCENTRO)>10){\n\t $mensajeError = array (\n \"nombreatributo\" => 'CODCENTRO',\n \"codigoincidencia\" => \"00002\",\n \"mensajeerror\" => \"Valor de atributo demasiado largo\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n}\n\tif (!preg_match(\"/^[a-zA-ZñÑáéíóúÁÉÍÓÚ\\d-]+$/\",$this->CODCENTRO)){\n\t\t $mensajeError = array (\n \"nombreatributo\" => 'CODCENTRO',\n \"codigoincidencia\" => \"00040\",\n \"mensajeerror\" => \"Solo están permitidas alfabéticos, números y el “-”\"\n );\n\t\t$errores[]=$mensajeError;\n\t\treturn $errores;\n\t}\n\tif($correcto==TRUE){\n\t\treturn TRUE;\n\t}else{\n\t\treturn $errores;\n\t}\n}", "function validaNascimento($ano, $mes, $dia)\n{\n\n $dataCheck = $ano.'-'.$mes.'-'.$dia;\n if (checkdate($mes, $dia, $ano) && $dataCheck<=date('Y-m-d'))\n return true;\n else return false;\n}", "function fncValidaDI_35($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_35 = \"(35)Horario Asignado\";\n\t$DI_35_ErrTam = \"Horario Asignado debe ser de 1 Digítos\";\n\t$DI_35_noDI \t = \"Horario Asignado no corresponde al catalogo establecidas por DGRH(1-8)\";\n\t\n\t\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == UNO)\n\t{\n\t\tif(!preg_match(\"/[1-8]{1}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_35.\"|\".$LocCampo.\"|\" . $DI_35_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_35.\"|\".$LocCampo.\"|\" . $DI_35_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function validarFlotante ($Cad) {\n// prueba si la entrada es un numero de punto flotante, con un signo opcional\nreturn preg_match(\"/^-?([0-9])+([\\.|,]([0-9])*)?$/\", $Cad );\n}", "function validateTituloEleitor( $value){\n\n $input = preg_replace('/[^\\d]/', '', $value);\n\n $uf = substr($input, -4, 2);\n\n if (((strlen($input) < 5) || (strlen($input) > 13)) || \n (str_repeat($input[1], strlen($input)) == $input) || \n ($uf < 1 || $uf > 28)) {\n return false;\n }\n\n $dv = substr($input, -2);\n $base = 2;\n\n $sequencia = substr($input, 0, -4);\n\n for ($i = 0; $i < 2; $i++) { \n $fator = 9;\n $soma = 0;\n\n for ($j = (strlen($sequencia) - 1); $j > -1; $j--) { \n $soma += $sequencia[$j] * $fator;\n\n if ($fator == $base) {\n $fator = 10;\n }\n $fator--;\n }\n $digito = $soma % 11;\n if (($digito == 0) and ($uf < 3)) {\n $digito = 1;\n } elseif ($digito == 10) {\n $digito = 0;\n }\n if ($dv[$i] != $digito) {\n return false;\n }\n switch ($i) {\n case '0':\n $sequencia = $uf . $digito;\n break;\n }\n }\n return true;\n }", "function fncValidaDI_42($IdEstado, $GestorErr, $NumReg, $Campo, $Campo2)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_42 = \"(42)Fecha de Reingreso\";\n\t$DI_42_ErrTam = \"Fecha de Reingreso debe ser de 8 Digíto(AAAAMMDD (AAAA=año, MM=mes, DD=día))\";\n\t$DI_42_noDI \t = \"Fecha de Reingreso no corresponde al formato establecido por DGRH(AAAAMMDD (AAAA=año, MM=mes, DD=día))\";\n\t$DI_42_FecIng \t = \"Fecha de Reingreso no puede ser menor a Fecha de Ingreso al Gobierno Federal\";\n\t\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == OCHO)\n\t{\n\t\tif(!validateDate($LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_42.\"|\".$LocCampo.\"|\" . $DI_42_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\t\tif(validateDate($LocCampo) and validateDate($Campo2))\t\n\t\t{\n\t\t\t$Fecha1 = date_create($Campo2);\n\t\t\t$Fecha2 = date_create($LocCampo);\n\t\t\t$interval = date_diff($Fecha1, $Fecha2);\n\t\t\tif(intval($interval->format('%R%a')) < CERO)\n\t\t\t{\n\t\t\t\t\t$Error = $NumReg .\"|\".$DI_42.\"|\".$LocCampo.\"|\" . $DI_42_FecIng.\"|\\n\";\n\t\t\t\t\tfwrite($GestorErr, $Error);\n\t\t\t\t\t$Bandera = UNO;\n\t\t\t}\t\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_42.\"|\".$LocCampo.\"|\" . $DI_42_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fecha_valida($fecha){\n if(ereg( \"([0-9]{2})/([0-9]{2})/([0-9]{4})\",$fecha)){\n ereg( \"([0-9]{2})/([0-9]{2})/([0-9]{4})\", $fecha, $mifecha);\n $ok = checkdate($mifecha[2],$mifecha[1],$mifecha[3]);\n if($ok){\n $actual = date(\"Y-m-d\");\n $older = \"1900-01-01\";\n $dtime = strtotime(fecha_mysql($fecha));\n $dtime_ac = strtotime($actual);\n $dtime_ol = strtotime($older);\n if($dtime>$dtime_ac || $dtime<$dtime_ol){\n return false;\n }else{\n return true;\n }\n }else{\n // fecha fuera del calendario\n return false;\n } \n }else{\n // formato no valido\n return false;\n }\n}", "function validar_Fecha()\n {\n $this->resource = 'Actividades';\n $fecha_menor = strtotime(\"2021-01-01 00:00:00\");\n $fecha_mayor = strtotime(\"2050-01-01 00:00:00\");\n $fecha_entrada = strtotime($this->fecha);\n\n if ($this->no_vacio($this->fecha) === false) {\n $this->code = '70027';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($this->formato_fecha($this->fecha) === false) {\n $this->code = '70028';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($fecha_entrada > $fecha_mayor) {\n $this->code = '70029';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($fecha_entrada < $fecha_menor) {\n $this->code = '70030';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n }\n }", "public function _validarHelado()\n {\n $listaHelados = Helado::_traerHelados();\n //Son distintos, pasa la validación.(Si y solo si se queda en este valor)\n $retorno = -1;\n if($this->_precio < 0 || $this->_tipo != \"agua\" && $this->_tipo != \"crema\" || $this->_cantidad < 0)\n {\n return 1;\n }\n foreach($listaHelados as $helado)\n { \n if($this->_sabor == $helado->_sabor && $this->_tipo == $helado->_tipo)\n {\n $helado->_cantidad = $this->_cantidad;\n $helado->_precio = $this->_precio;\n Helado::_actualizarHelado($listaHelados);\n $retorno = 0;\n break;\n }\n }\n return $retorno;\n }", "function fncValidaDI_44($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_44 = \"(44)Fecha de Pago\";\n\t$DI_44_ErrTam = \"Fecha de Pago debe ser de 9 Caracteres(DDMMMAAAA (AAAA=año, MM=mes(primeras 3 letras), DD=día))\";\n\t$DI_44_noDI \t = \"Fecha de Pago no corresponde al formato establecido por DGRH(DDMMMAAAA DD=día, MM=mes(primeras 3 letras), AAAA=año)\";\n\t$DI_44_FecIng \t = \"Fecha de Pago no puede ser menor a Fecha de Ingreso al Gobierno Federal\";\n\t$MesValido=array(\"ENE\",\"FEB\",\"MAR\",\"ABR\",\"MAY\",\"JUN\",\"JUL\",\"AGO\",\"SEP\", \"OCT\",\"NOV\",\"DIC\");\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == NUEVE)\n\t{\n\t\t$Dia =substr($LocCampo,0,2);\n\t\t$Mes =substr($LocCampo,2,3);\n\t\t$Anio=substr($LocCampo,5,4);\n\t\t$Resultado = array_search(strtoupper($Mes), $MesValido);\t\t\n\t\tif (strlen($Resultado) <= 0)\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_44.\"|\".$LocCampo.\"|\" . $DI_44_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\n\t\t}\t\n\t\t$Fecha =$Anio.str_pad(((int) $Resultado) +1,2,\"0\",STR_PAD_LEFT).$Dia;\n\n\t\tif(!validateDate($Fecha))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_44.\"|\".$LocCampo.\"|\" . $DI_44_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_44.\"|\".$LocCampo.\"|\" . $DI_44_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function comprobar_FechaNacimiento()\n\t{\n\t$correcto = true; //variable booleana que comprueba si el atributo cuumple o no lo especificado\n\n\t//si los atributos estan vacios\n\tif (strlen($this->FechaNacimiento) == 0)\n\t{\n\t\tarray_push($this->erroresdatos, [\"nombreatributo\" => \"FechaNacimiento\", \"codigoincidencia\" => \"00001\" ,\"mensajeerror\" => \"FechaNacimiento vacio\"]);\n\n\t\t$correcto = false;\t\n\t}\n\n\treturn $correcto;\n}", "function fncValidaDI_51($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_51 = \"(51)Tipo de Pago\";\n\t$DI_51_ErrTam = \"Tipo de Pago ser de 1 digitos\";\n\t$DI_51_Catalogo = \"El valor no coincide con la directiva de calidad de la DGRH\";\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == UNO){\n\t\tif(!preg_match(\"/[0-8]{1}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_51.\"|\".$LocCampo.\"|\" . $DI_51_Catalogo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_51.\"|\".$LocCampo.\"|\" . $DI_51_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function Comprobar_responsablecentro()\n{\n\t$correcto = true;\n\n\t//si se cumple la condicion\n\tif (strlen($this->RESPONSABLECENTRO)<3)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"RESPONSABLECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00003\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo no numérico demasiado corto\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (strlen($this->RESPONSABLECENTRO)>60)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"RESPONSABLECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00002\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo demasiado largo\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (!preg_match(\"/^[A-Za-zñáéíóúÑÁÉÍÓÚüÜ ]+$/\",$this->RESPONSABLECENTRO)){\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"RESPONSABLECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00030\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Solo están permitidas alfabéticos\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\n\t\n\treturn $correcto;\n}", "function fncValidaDI_31($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_31 = \"(31)Tabulador de Puesto\";\n\t$DI_31_ErrTam = \"Tamaño de campo Tabulador de Puesto debe ser de 3 Digítos\";\n\t$DI_31_noDI \t = \"Tabulador de Puesto no corresponde las Directivas Institucionales establecidas por DGRH\";\n\t\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == TRES)\n\t{\n\t\tif(!preg_match(\"/[0-9]{3}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_31.\"|\".$LocCampo.\"|\" . $DI_31_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_31.\"|\".$LocCampo.\"|\" . $DI_31_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_54($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_54 = \"(54)Percepciones \";\n\t$DI_54_ErrTam = \"Percepciones debe ser de 10 digitos y 2 decimales\";\n\t$DI_54_Catalogo = \"Percepciones no coincide con la directiva de calidad de la DGRH(9999999999.99)\";\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == 11){\n\t\tif(!preg_match(\"/[0-9]{8}.[0-9]{2}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_54.\"|\".$LocCampo.\"|\" . $DI_54_Catalogo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_54.\"|\".$LocCampo.\"|\" . $DI_54_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fecha_menor($diainicio,$diafin,$mesinicio,$mesfin,$anioinicio,$aniofin){\r\n\r\n$dif_en_meses=(($mesfin-$mesinicio)+(12*($aniofin-$anioinicio)));\r\n\r\nif($dif_en_meses<0){return(0);}\r\nif(($dif_en_meses==0) && ($diafin<$diainicio)){return(0);}\r\nreturn(1);\r\n}", "function fncValidaDI_29($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_29 = \"(29)Pagaduria\";\n\t$DI_29_ErrTam = \"Tamaño de campo Pagaduria debe ser a 5 Caracters\";\n\t$DI_29_Pgria \t = \"Pagaduria no corresponde las reglas de negocio establecidas por DGRH\";\n\t\n\t\n\t// agregar catalogo de Municpios\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == CINCO)\n\t{\n\t\tif(!preg_match(\"/[A-Za-z0-9]{5}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_29.\"|\".$LocCampo.\"|\" . $DI_29_Pgria.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_29.\"|\".$LocCampo.\"|\" . $DI_29_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function Comprobar_nombrecentro()\n{\n\t$correcto = true;\n\n\t//si se cumple la condicion\n\tif (strlen($this->NOMBRECENTRO)<3)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"NOMBRECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00003\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo no numérico demasiado corto\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (strlen($this->NOMBRECENTRO)>50)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"NOMBRECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00002\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo demasiado largo\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (!preg_match(\"/^[A-Za-zñáéíóúÑÁÉÍÓÚüÜ ]+$/\",$this->NOMBRECENTRO)){\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"NOMBRECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00030\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Solo están permitidas alfabéticos\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t\n\treturn $correcto; //se devuelve el resultado\n}", "function fncValidaDI_55($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_55 = \"(55)Deducciones \";\n\t$DI_55_ErrTam = \"Deducciones debe ser de 10 digitos y 2 decimales \";\n\t$DI_55_Catalogo = \"Deducciones no coincide con la directiva de calidad de la DGRH(9999999999.99)\";\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == 11){\n\t\tif(!preg_match(\"/[0-9]{8}.[0-9]{2}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_55.\"|\".$LocCampo.\"|\" . $DI_55_Catalogo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_55.\"|\".$LocCampo.\"|\" . $DI_55_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function valida_ingreso_ambulatorio_modo_1($id_comprobante,$prestacion,$cantidad){\n\t$query=\"select codigo from facturacion.nomenclador \n\t\t\twhere id_nomenclador='$prestacion'\";\t \n\t$res_codigo_nomenclador=sql($query, \"Error 1\") or fin_pagina();\t\n\t$codigo=$res_codigo_nomenclador->fields['codigo'];\n\t\n\tif(trim($codigo) == 'CT-C021'){\n\t\t//debo saber si alguna vez se al facturo beneficiario el \"CT-C020\"\n\t\t\n\t\t//traigo el id_smiafiliados para buscar el codigo \"CT-C020\"\n\t\t$query=\"select id_smiafiliados from facturacion.comprobante \n\t\t\t\twhere id_comprobante='$id_comprobante'\";\t \n\t\t$res_codigo_nomenclador=sql($query, \"Error 1\") or fin_pagina();\t\n\t\t$id_smiafiliados=$res_codigo_nomenclador->fields['id_smiafiliados'];\n\t\t\n\t\t//busco el codigo \"CT-C020\"\n\t\t$query=\"SELECT id_prestacion\t\t\t\t\n\t\t\t\tFROM nacer.smiafiliados\n \t\t\t\tINNER JOIN facturacion.comprobante ON (nacer.smiafiliados.id_smiafiliados = facturacion.comprobante.id_smiafiliados)\n \t\t\t\tINNER JOIN facturacion.prestacion ON (facturacion.comprobante.id_comprobante = facturacion.prestacion.id_comprobante)\n \t\t\t\tINNER JOIN facturacion.nomenclador ON (facturacion.prestacion.id_nomenclador = facturacion.nomenclador.id_nomenclador)\n \t\t\t\twhere smiafiliados.id_smiafiliados='$id_smiafiliados' and codigo='CT-C020'\";\n \t\t$cant_pres=sql($query, \"Error 3\") or fin_pagina();\n \t\tif ($cant_pres->RecordCount()>=1)return 1;\n \t\telse return 0;\n\t}\n\telse return 1;\n}" ]
[ "0.69990903", "0.67595786", "0.6691304", "0.6566324", "0.6546142", "0.65350574", "0.65154934", "0.64904755", "0.64746803", "0.6438075", "0.64236325", "0.64041567", "0.639524", "0.6393528", "0.63665783", "0.63555723", "0.63553256", "0.63456863", "0.6305961", "0.62813747", "0.62724566", "0.62441224", "0.62395495", "0.62269336", "0.62229174", "0.62182796", "0.6217722", "0.6197668", "0.61730427", "0.617206" ]
0.7187753
0
VALIDA QUE LA FECHA DE INSTALACION SEA MAYOR A 3 DIAS HABILES DE LA FECHA DE LA ORDEN DE COMPRA Y MENOR A 6 MESES DE LA MISMA
function fecha_instalacion($fecha_instalacion) { $hoy = date('Y-m-d'); $fecha_valida = date('Y-m-d',strtotime('+3 day',strtotime($hoy))); $fecha_maxima = date('Y-m-d',strtotime('+6 month',strtotime($hoy))); if(($fecha_instalacion < $fecha_valida) || ($fecha_instalacion > $fecha_maxima)) { $this->CI->form_validation->set_message('fecha_instalacion', "El campo %s debe de ser por lo menos 3 d&iacute;as h&aacute;biles despu&eacute;s de la fecha de la orden de compra y menor a 6 meses de la misma."); return FALSE; } return TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function comprobar_NUMINVENTARIOESPACIO(){\n\t$errores = array();\n\t$correcto=true;\n //Compruebo si el valor es null o no es vacio\n if (($this->NUMINVENTARIOESPACIO == null) || (strlen($this->NUMINVENTARIOESPACIO) == 0)){\n\n \t$mensajeError = array (\n \"nombreatributo\" => \"NUMINVENTARIOESPACIO\",\n \"codigoincidencia\" => \"00001\",\n \"mensajeerror\" => \"Atributo vacío\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n }\n\tif((int)$this->NUMINVENTARIOESPACIO<=0){\n\t $mensajeError = array (\n \"nombreatributo\" => \"NUMINVENTARIOESPACIO\",\n \"codigoincidencia\" => \"00004\",\n \"mensajeerror\" => \"Valor de atributo numérico demasiado corto\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n}\n\t\nif((int)$this->NUMINVENTARIOESPACIO>=99999999){\n\t $mensajeError = array (\n \"nombreatributo\" => 'NUMINVENTARIOESPACIO',\n \"codigoincidencia\" => \"00002\",\n \"mensajeerror\" => \"Valor de atributo demasiado largo\"\n );\n\t$errores[]=$mensajeError;\n\treturn $errores;\n}\n\tif (!preg_match(\"/^[\\d]+$/\",$this->NUMINVENTARIOESPACIO)){\n\t\t $mensajeError = array (\n \"nombreatributo\" => 'NUMINVENTARIOESPACIO',\n \"codigoincidencia\" => \"00070\",\n \"mensajeerror\" => \"Solo se permiten números\"\n );\n\t\t$errores[]=$mensajeError;\n\t\treturn $errores;\n\t}\n\tif($correcto==TRUE){\n\t\treturn TRUE;\n\t}else{\n\t\treturn $errores;\n\t}\n}", "function fecha_menor($diainicio,$diafin,$mesinicio,$mesfin,$anioinicio,$aniofin){\r\n\r\n$dif_en_meses=(($mesfin-$mesinicio)+(12*($aniofin-$anioinicio)));\r\n\r\nif($dif_en_meses<0){return(0);}\r\nif(($dif_en_meses==0) && ($diafin<$diainicio)){return(0);}\r\nreturn(1);\r\n}", "function valida_ingreso_ambulatorio_modo_1($id_comprobante,$prestacion,$cantidad){\n\t$query=\"select codigo from facturacion.nomenclador \n\t\t\twhere id_nomenclador='$prestacion'\";\t \n\t$res_codigo_nomenclador=sql($query, \"Error 1\") or fin_pagina();\t\n\t$codigo=$res_codigo_nomenclador->fields['codigo'];\n\t\n\tif(trim($codigo) == 'CT-C021'){\n\t\t//debo saber si alguna vez se al facturo beneficiario el \"CT-C020\"\n\t\t\n\t\t//traigo el id_smiafiliados para buscar el codigo \"CT-C020\"\n\t\t$query=\"select id_smiafiliados from facturacion.comprobante \n\t\t\t\twhere id_comprobante='$id_comprobante'\";\t \n\t\t$res_codigo_nomenclador=sql($query, \"Error 1\") or fin_pagina();\t\n\t\t$id_smiafiliados=$res_codigo_nomenclador->fields['id_smiafiliados'];\n\t\t\n\t\t//busco el codigo \"CT-C020\"\n\t\t$query=\"SELECT id_prestacion\t\t\t\t\n\t\t\t\tFROM nacer.smiafiliados\n \t\t\t\tINNER JOIN facturacion.comprobante ON (nacer.smiafiliados.id_smiafiliados = facturacion.comprobante.id_smiafiliados)\n \t\t\t\tINNER JOIN facturacion.prestacion ON (facturacion.comprobante.id_comprobante = facturacion.prestacion.id_comprobante)\n \t\t\t\tINNER JOIN facturacion.nomenclador ON (facturacion.prestacion.id_nomenclador = facturacion.nomenclador.id_nomenclador)\n \t\t\t\twhere smiafiliados.id_smiafiliados='$id_smiafiliados' and codigo='CT-C020'\";\n \t\t$cant_pres=sql($query, \"Error 3\") or fin_pagina();\n \t\tif ($cant_pres->RecordCount()>=1)return 1;\n \t\telse return 0;\n\t}\n\telse return 1;\n}", "function validateTituloEleitor( $value){\n\n $input = preg_replace('/[^\\d]/', '', $value);\n\n $uf = substr($input, -4, 2);\n\n if (((strlen($input) < 5) || (strlen($input) > 13)) || \n (str_repeat($input[1], strlen($input)) == $input) || \n ($uf < 1 || $uf > 28)) {\n return false;\n }\n\n $dv = substr($input, -2);\n $base = 2;\n\n $sequencia = substr($input, 0, -4);\n\n for ($i = 0; $i < 2; $i++) { \n $fator = 9;\n $soma = 0;\n\n for ($j = (strlen($sequencia) - 1); $j > -1; $j--) { \n $soma += $sequencia[$j] * $fator;\n\n if ($fator == $base) {\n $fator = 10;\n }\n $fator--;\n }\n $digito = $soma % 11;\n if (($digito == 0) and ($uf < 3)) {\n $digito = 1;\n } elseif ($digito == 10) {\n $digito = 0;\n }\n if ($dv[$i] != $digito) {\n return false;\n }\n switch ($i) {\n case '0':\n $sequencia = $uf . $digito;\n break;\n }\n }\n return true;\n }", "function Fecha_mes_n($Ingresomes_c){\t\n$mes_mes_c = new DateTime($Ingresomes_c);\n$me = $mes_mes_c->format('m');\n$mes='';\nif($me=='01') $mes='01';\nif($me=='02') $mes='02';\nif($me=='03') $mes='03';\nif($me=='04') $mes='04';\nif($me=='05') $mes='05';\nif($me=='06') $mes='06';\nif($me=='07') $mes='07';\nif($me=='08') $mes='08';\nif($me=='09') $mes='09';\nif($me=='10') $mes='10';\nif($me=='11') $mes='11';\nif($me=='12') $mes='12';\n$cadena = (\"$mes\");\nreturn $cadena;\n}", "function NUMERO_LUNES_FECHA($_ARGS) {\r\n\t$_FECHA_EGRESO = FECHA_EGRESO($_ARGS);\r\n\t\r\n\tif (ESTADO($_ARGS) == \"A\") {\r\n\t\tif ($_ARGS['FECHA_INGRESO'] <= $_ARGS['DESDE']) {\r\n\t\t\tif ($_ARGS['FECHA_INGRESO'] < $_ARGS['HASTA']) list($ae, $me, $de) = SPLIT('[/.-]', $_ARGS['HASTA']);\r\n\t\t\telse list($ae, $me, $de) = SPLIT('[/.-]', $_ARGS['FECHA_INGRESO']);\r\n\r\n\t\t\tlist($ap, $mp) = SPLIT('[/.-]', $_ARGS['PERIODO']); $periodo_inicio = \"01-$mp-$ap\";\r\n\t\t\t$primer_dia_semana = DIA_DE_LA_SEMANA($periodo_inicio);\r\n\t\t\t$dia_semana = $primer_dia_semana;\r\n\t\t\t$dia_inicio = 1;\r\n\t\t\t$dia_fin = DIAS_DEL_MES(\"$de-$me-$ae\");\r\n\t\t} else {\r\n\t\t\tlist($ae, $me, $de) = SPLIT('[/.-]', $_ARGS['HASTA']);\r\n\t\t\tlist($ai, $mi, $di) = SPLIT('[/.-]', $_ARGS['FECHA_INGRESO']); $periodo_inicio = \"$di-$mi-$ai\";\t$diai = (int) $di;\r\n\t\t\t\r\n\t\t\t$primer_dia_semana = DIA_DE_LA_SEMANA($periodo_inicio);\r\n\t\t\t$dia_semana = $primer_dia_semana;\r\n\t\t\t\r\n\t\t\tif ($dia_semana == 1) {\r\n\t\t\t\t$dia_inicio = (int) $di;\r\n\t\t\t} else {\r\n\t\t\t\tif ($dia_semana == 0) $restar_dia_semana = $diai - 7;\r\n\t\t\t\telse $restar_dia_semana = $diai - $dia_semana;\r\n\t\t\t\t\r\n\t\t\t\tif ($restar_dia_semana < 1) $dia_inicio = (int) $di;\r\n\t\t\t\telse {\r\n\t\t\t\t\t$diferencia_dias = $dia_semana - 1;\r\n\t\t\t\t\t$dia_inicio = (int) $di;\r\n\t\t\t\t\t$dia_inicio -= $diferencia_dias;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t$dia_fin = DIAS_DEL_MES(\"$de-$me-$ae\");\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tlist($ae, $me, $de) = SPLIT('[/.-]', $_FECHA_EGRESO);\r\n\t\t\r\n\t\tif ($_ARGS['FECHA_INGRESO'] <= $_ARGS['DESDE']) {\r\n\t\t\tlist($ap, $mp) = SPLIT('[/.-]', $_ARGS['PERIODO']); $periodo_inicio = \"01-$mp-$ap\";\r\n\t\t\t$primer_dia_semana = DIA_DE_LA_SEMANA($periodo_inicio);\r\n\t\t\t$dia_semana = $primer_dia_semana;\r\n\t\t\t$dia_inicio = 1;\r\n\t\t\t$dia_fin = (int) $de;\r\n\t\t} else {\t\r\n\t\t\tlist($ai, $mi, $di) = SPLIT('[/.-]', $_ARGS['FECHA_INGRESO']); $periodo_inicio = \"$di-$mp-$ap\";\t$diai = (int) $di;\r\n\t\t\t$primer_dia_semana = DIA_DE_LA_SEMANA($periodo_inicio);\r\n\t\t\t$dia_semana = $primer_dia_semana;\r\n\t\t\t\r\n\t\t\tif ($dia_semana == 1) {\r\n\t\t\t\t$dia_inicio = (int) $di;\r\n\t\t\t} else {\r\n\t\t\t\tif ($dia_semana == 0) $restar_dia_semana = $diai - 7;\r\n\t\t\t\telse $restar_dia_semana = $diai - $dia_semana;\r\n\t\t\t\t\r\n\t\t\t\tif ($restar_dia_semana < 1) $dia_inicio = (int) $di;\r\n\t\t\t\telse {\r\n\t\t\t\t\t$diferencia_dias = $dia_semana - 1;\r\n\t\t\t\t\t$dia_inicio = (int) $di;\r\n\t\t\t\t\t$dia_inicio -= $diferencia_dias;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t$dia_fin = (int) $de;\r\n\t\t}\r\n\t}\r\n\t\r\n\t$lunes = 0;\r\n\tfor ($dia=$dia_inicio; $dia<=$dia_fin; $dia++) {\r\n\t\tif ($dia_semana == 7) $dia_semana = 0;\r\n\t\tif ($dia_semana == 1) $lunes++;\r\n\t\t$dia_semana++;\r\n\t}\r\n\treturn $lunes;\r\n}", "public function _validarHelado()\n {\n $listaHelados = Helado::_traerHelados();\n //Son distintos, pasa la validación.(Si y solo si se queda en este valor)\n $retorno = -1;\n if($this->_precio < 0 || $this->_tipo != \"agua\" && $this->_tipo != \"crema\" || $this->_cantidad < 0)\n {\n return 1;\n }\n foreach($listaHelados as $helado)\n { \n if($this->_sabor == $helado->_sabor && $this->_tipo == $helado->_tipo)\n {\n $helado->_cantidad = $this->_cantidad;\n $helado->_precio = $this->_precio;\n Helado::_actualizarHelado($listaHelados);\n $retorno = 0;\n break;\n }\n }\n return $retorno;\n }", "function fncValidaDI_46($IdEstado, $GestorErr, $NumReg, $Campo, $Campo2)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_46 = \"(46)Periodo de Pago Final\";\n\t$DI_46_ErrTam = \"Periodo de Pago Final ser de 8 Caracteres AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_46_noDI \t = \"Periodo de Pago Final no corresponde al formato establecido por DGRH(AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_46_PerFinal = \"El perido final no puede ser menor al Periodo Inicial\";\t\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == OCHO)\n\t{\n\t\tif(!validateDate($LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_46.\"|\".$LocCampo.\"|\" . $DI_46_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\n\t\tif(validateDate($LocCampo) and validateDate($Campo2))\t\n\t\t{\n\t\t\t$Fecha1 = date_create($LocCampo);\n\t\t\t$Fecha2 = date_create($Campo2);\n\t\t\t$interval = date_diff($Fecha1, $Fecha2);\n\t\t\tif(intval($interval->format('%R%a') )> CERO)\n\t\t\t{\n\t\t\t\t\t$Error = $NumReg .\"|\".$DI_46.\"|\".$LocCampo.\"|\" . \n\t\t\t\t\t$DI_46_PerFinal.\"(\". $LocCampo . \")(\". $Campo2 .\")|\\n\";\n\t\t\t\t\tfwrite($GestorErr, $Error);\n\t\t\t\t\t$Bandera = UNO;\n\t\t\t}\t\n\t\t}\t\n\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_46.\"|\".$LocCampo.\"|\" . $DI_46_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function MESES_ANTIGUEDAD($_ARGS) {\r\n\t$fingreso = FECHA_INGRESO($_ARGS);\r\n\t$periodo_actual = $_ARGS['HASTA'];\r\n\tlist($anios, $meses, $dias) = TIEMPO_DE_SERVICIO(formatFechaDMA($fingreso), formatFechaDMA($periodo_actual));\r\n\t$cantidad = $meses + ($anios * 12);\r\n\treturn $cantidad;\r\n}", "function fncValidaDI_45($IdEstado, $GestorErr, $NumReg, $Campo, $Campo2)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_45 = \"(45)Periodo de Pago Inicial\";\n\t$DI_45_ErrTam = \"Periodo de Pago Inicial ser de 8 Caracteres AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_45_noDI \t = \"Periodo de Pago Inicial no corresponde al formato establecido por DGRH(AAAAMMDD (AAAA=año, MM=mes, DD=día)\";\n\t$DI_45_PerFinal \t = \"Periodo de Pago Inicial no puede ser posterior a Periodo de Pago Final\";\t\t\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == OCHO)\n\t{\n\t\tif(!validateDate($LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_45.\"|\".$LocCampo.\"|\" . $DI_45_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\n\t\tif(validateDate($LocCampo) and validateDate($Campo2))\t\n\t\t{\n\t\t\t$Fecha1 = date_create($LocCampo);\n\t\t\t$Fecha2 = date_create($Campo2);\n\t\t\t$interval = date_diff($Fecha1, $Fecha2);\n\t\t\tif(intval($interval->format('%R%a') )< CERO)\n\t\t\t{\n\t\t\t\t\t$Error = $NumReg .\"|\".$DI_45.\"|\".$LocCampo.\"|\" . \n\t\t\t\t\t$DI_45_PerFinal .\"(\" .$LocCampo.\" )(\". $Campo2.\")|\\n\";\n\t\t\t\t\tfwrite($GestorErr, $Error);\n\t\t\t\t\t$Bandera = UNO;\n\t\t\t}\t\n\t\t}\t\n\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_45.\"|\".$LocCampo.\"|\" . $DI_45_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fecha_no_paso($dia,$mes,$anio){\r\n$dia_hoy=date(\"d\");\r\n$mes_hoy=date(\"m\");\r\n$anio_hoy=date(\"Y\");\r\n\r\n$dif_en_meses=(($mes-$mes_hoy)+(12*($anio-$anio_hoy)));\r\n\r\nif($dif_en_meses<0){return(0);}\r\nif(($dif_en_meses==0) && ($dia<$dia_hoy)){return(0);}\r\nreturn(1);\r\n}", "function __validFecha2($fecha){\n $test_arr = explode('-', $fecha);\n if (count($test_arr) == 3) {\n if (checkdate($test_arr[1], $test_arr[2], $test_arr[0])) {//YEAR / MES / DIA\n return true;\n }\n return false;\n }\n return false;\n }", "function _check_capthca()\n\t\t{\n\t\t\t$expiration = time()-3600 ;\n\t\t\t$sql = \" DELETE FROM captcha WHERE captcha_time < ? \";\n\t\t\t$binds = array($expiration);\n\t\t\t$query = $this->db->query($sql, $binds);\n\n\t\t\t//checking input\n\t\t\t$sql = \"SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?\";\n\t\t\t$binds = array($_POST['captcha'], $this->input->ip_address(), $expiration);\n\t\t\t$query = $this->db->query($sql, $binds);\n\t\t\t$row = $query->row();\n\n\t\tif ( $row -> count > 0 ){\n\t\t\t\treturn true;\n\t\t}\n\t\t\t\treturn false;\n\n\t\t}", "static function esCedulaValida($numero) {\r\n if (strlen($numero) == 0) {\r\n return FALSE;\r\n }\r\n $resultado = \"\";\r\n $suma = 0;\r\n $residuo = 0;\r\n $pri = false;\r\n $pub = false;\r\n $nat = false;\r\n $numeroProvincias = 22;\r\n $modulo = 11;\r\n\r\n /* Aqui almacenamos los digitos de la cedula en variables. */\r\n $d1 = substr($numero, 0, 1);\r\n $d2 = substr($numero, 1, 1);\r\n $d3 = substr($numero, 2, 1);\r\n $d4 = substr($numero, 3, 1);\r\n $d5 = substr($numero, 4, 1);\r\n $d6 = substr($numero, 5, 1);\r\n $d7 = substr($numero, 6, 1);\r\n $d8 = substr($numero, 7, 1);\r\n $d9 = substr($numero, 8, 1);\r\n $d10 = substr($numero, 9, 1);\r\n\r\n $p1 = 0;\r\n $p2 = 0;\r\n $p3 = 0;\r\n $p4 = 0;\r\n $p5 = 0;\r\n $p6 = 0;\r\n $p7 = 0;\r\n $p8 = 0;\r\n $p9 = 0;\r\n\r\n /* El tercer digito es: */\r\n /* 9 para sociedades privadas y extranjeros */\r\n /* 6 para sociedades publicas */\r\n /* menor que 6 (0,1,2,3,4,5) para personas naturales */\r\n\r\n if ($d3 == 7 || $d3 == 8) {\r\n $resultado = '0';\r\n }\r\n\r\n /* Solo para personas naturales (modulo 10) */\r\n if ($d3 < 6) {\r\n $nat = true;\r\n $p1 = $d1 * 2;\r\n if ($p1 >= 10)\r\n $p1 -= 9;\r\n $p2 = $d2 * 1;\r\n if ($p2 >= 10)\r\n $p2 -= 9;\r\n $p3 = $d3 * 2;\r\n if ($p3 >= 10)\r\n $p3 -= 9;\r\n $p4 = $d4 * 1;\r\n if ($p4 >= 10)\r\n $p4 -= 9;\r\n $p5 = $d5 * 2;\r\n if ($p5 >= 10)\r\n $p5 -= 9;\r\n $p6 = $d6 * 1;\r\n if ($p6 >= 10)\r\n $p6 -= 9;\r\n $p7 = $d7 * 2;\r\n if ($p7 >= 10)\r\n $p7 -= 9;\r\n $p8 = $d8 * 1;\r\n if ($p8 >= 10)\r\n $p8 -= 9;\r\n $p9 = $d9 * 2;\r\n if ($p9 >= 10)\r\n $p9 -= 9;\r\n $modulo = 10;\r\n }\r\n\r\n /* Solo para sociedades publicas (modulo 11) */\r\n /* Aqui el digito verficador esta en la posicion 9, en las otras 2 en la pos. 10 */\r\n else {\r\n if ($d3 == 6) {\r\n $pub = true;\r\n $p1 = $d1 * 3;\r\n $p2 = $d2 * 2;\r\n $p3 = $d3 * 7;\r\n $p4 = $d4 * 6;\r\n $p5 = $d5 * 5;\r\n $p6 = $d6 * 4;\r\n $p7 = $d7 * 3;\r\n $p8 = $d8 * 2;\r\n $p9 = 0;\r\n } else {\r\n /* Solo para entidades privadas (modulo 11) */\r\n if ($d3 == 9) {\r\n $pri = true;\r\n $p1 = $d1 * 4;\r\n $p2 = $d2 * 3;\r\n $p3 = $d3 * 2;\r\n $p4 = $d4 * 7;\r\n $p5 = $d5 * 6;\r\n $p6 = $d6 * 5;\r\n $p7 = $d7 * 4;\r\n $p8 = $d8 * 3;\r\n $p9 = $d9 * 2;\r\n }\r\n }\r\n }\r\n $suma = $p1 + $p2 + $p3 + $p4 + $p5 + $p6 + $p7 + $p8 + $p9;\r\n $residuo = $suma % $modulo;\r\n\r\n /* Si residuo=0, dig.ver.=0, caso contrario 10 - residuo */\r\n if ($residuo == 0)\r\n $digitoVerificador = 0;\r\n else\r\n $digitoVerificador = $modulo - $residuo;\r\n\r\n /* ahora comparamos el elemento de la posicion 10 con el dig. ver. */\r\n if ($pub == true) {\r\n if ($digitoVerificador != $d9) {\r\n $resultado = '0';\r\n }\r\n /* El ruc de las empresas del sector publico terminan con 0001 */\r\n if (substr($numero, 9, 4) != '0001') {\r\n $resultado = '0';\r\n }\r\n } else {\r\n if ($pri == true) {\r\n if ($digitoVerificador != $d10) {\r\n $resultado = '0';\r\n }\r\n if (substr($numero, 10, 3) != '001') {\r\n $resultado = '0';\r\n }\r\n } else {\r\n if ($nat == true) {\r\n if ($digitoVerificador != $d10) {\r\n $resultado = '0';\r\n }\r\n if (strlen($numero) > 10 && substr($numero, 10, 3) != '001') {\r\n $resultado = '0';\r\n }\r\n }\r\n }\r\n }\r\n if ($resultado == \"\") {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "private function validateLibur(){\n $jmlLiburSeharusnya = $this->countSunday();\n foreach ($this->cells['data'] as $x => $employee){\n\n if($employee['jabatan'] == 'karu'){\n continue;\n }\n\n $posisiNonL = [];\n $posisiL = [];\n foreach($employee['schedules'] as $y => $value){\n if($value['schedule'] == 'M'){\n $posisiNonL[] = $y;\n }\n\n if($value['schedule'] == 'L'){\n $posisiL[] = $y;\n }\n }\n\n $filterJadwalNull = array_filter(array_column($employee['schedules'], 'schedule'));\n $libur = array_count_values($filterJadwalNull);\n\n if(isset($libur['L']) && $libur['L'] <= $jmlLiburSeharusnya){\n $change = array_rand($posisiNonL);\n $this->cells['data'][$x]['schedules'][$change]['schedule'] = 'L';\n }elseif(isset($libur['L']) && $libur['L'] >= $jmlLiburSeharusnya){\n $change = array_rand($posisiL);\n $this->cells['data'][$x]['schedules'][$change]['schedule'] = 'M';\n }\n\n }\n }", "function fncValidaDI_35($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_35 = \"(35)Horario Asignado\";\n\t$DI_35_ErrTam = \"Horario Asignado debe ser de 1 Digítos\";\n\t$DI_35_noDI \t = \"Horario Asignado no corresponde al catalogo establecidas por DGRH(1-8)\";\n\t\n\t\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == UNO)\n\t{\n\t\tif(!preg_match(\"/[1-8]{1}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_35.\"|\".$LocCampo.\"|\" . $DI_35_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_35.\"|\".$LocCampo.\"|\" . $DI_35_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function ValidarFechas($fechaIngreso, $fechaInicio){\n\t// $fechaInicio = formatDateSeparador(\"d/m/Y\", $fechaInicio, '-' );\t\t\n\t\n\t// date_format($fechaInicio,\"d/m/Y\");\t\n\tif( !isFechaValida($fechaIngreso) ) return 'Fecha Ingreso Invalida '.$fechaIngreso;\n\tif( !isFechaValida($fechaInicio) ) return 'Fecha Inicio Invalida '.$fechaInicio;\n\t\n\t$dias = dateDiff($fechaIngreso, $fechaInicio);\n\tif($dias < 0) return 'Fecha Inicio de la exposicion, Debe ser mayor/igual a la fecha de Ingreso a la empresa. ';\n\t\n\t$hoy = date(\"d/m/Y\");\n\t$dias = dateDiff($fechaInicio, $hoy);\n\tif($dias < 0) return 'Fecha Inicio de la exposicion, Debe ser menor/igual a la fecha actual. ';\n\t\n\treturn '';\n\t\n}", "function Comprobar_codedificio()\n{\n\t$correcto = true;\n\n\t//si se cumple la condicion\n\tif (strlen($this->codedificio)<3)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"CODEDIFICIO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00003\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo no numérico demasiado corto\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (strlen($this->codedificio)>10)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"CODEDIFICIO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00002\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo demasiado largo\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (!preg_match(\"/^[A-Za-zñáéíóúÑÁÉÍÓÚüÜ\\-0-9]+$/\",$this->codedificio)){\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"CODEDIFICIO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00040\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Solo están permitidas alfabéticos, números y el “-”\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\n\t\n\treturn $correcto;//se devuelve el resultado\n}", "function fncValidaDI_26($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_26 = \"(26)Municipio\";\n\t$DI_26_ErrTam = \"Tamaño de campo Municipio debe ser a 3 Dígitos\";\n\t$DI_26_Mpio \t = \"El Municipio no es parte del catalogo de DGRH\";\n\t\n\t// agregar catalogo de Municpios\n\nif($IdEstado == \"01\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\");\n} //fin de if($IdEstado == \"01\")\n\nif($IdEstado == \"02\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\");\n} //fin de if($IdEstado == \"02\")\n\nif($IdEstado == \"03\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"008\",\"009\");\n} //fin de if($IdEstado == \"03\")\n\nif($IdEstado == \"04\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\");\n} //fin de if($IdEstado == \"04\")\n\nif($IdEstado == \"05\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\");\n} //fin de if($IdEstado == \"05\")\n\nif($IdEstado == \"06\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\");\n} //fin de if($IdEstado == \"06\")\n\nif($IdEstado == \"07\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\",\"114\",\"115\",\"116\",\"117\",\"118\",\"119\");\n} //fin de if($IdEstado == \"07\")\n\nif($IdEstado == \"08\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\");\n} //fin de if($IdEstado == \"08\")\n\nif($IdEstado == \"09\"){\n\t$Mpio = array(\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\");\n} //fin de if($IdEstado == \"09\")\n\nif($IdEstado == \"10\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\");\n} //fin de if($IdEstado == \"10\")\n\nif($IdEstado == \"11\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\");\n} //fin de if($IdEstado == \"11\")\n\nif($IdEstado == \"12\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\");\n} //fin de if($IdEstado == \"12\")\n\nif($IdEstado == \"13\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\");\n} //fin de if($IdEstado == \"13\")\n\nif($IdEstado == \"14\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\",\"114\",\"115\",\"116\",\"117\",\"118\",\"119\",\"120\",\"121\",\"122\",\"123\",\"124\",\"125\");\n} //fin de if($IdEstado == \"14\")\n\nif($IdEstado == \"15\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\",\"114\",\"115\",\"116\",\"117\",\"118\",\"119\",\"120\",\"121\",\"122\",\"123\",\"124\",\"125\");\n} //fin de if($IdEstado == \"15\")\n\nif($IdEstado == \"16\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\");\n} //fin de if($IdEstado == \"16\")\n\nif($IdEstado == \"17\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\");\n} //fin de if($IdEstado == \"17\")\n\nif($IdEstado == \"18\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\");\n} //fin de if($IdEstado == \"18\")\n\nif($IdEstado == \"19\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\");\n} //fin de if($IdEstado == \"19\")\n\nif($IdEstado == \"20\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\",\"114\",\"115\",\"116\",\"117\",\"118\",\"119\",\"120\",\"121\",\"122\",\"123\",\"124\",\"125\",\"126\",\"127\",\"128\",\"129\",\"130\",\"131\",\"132\",\"133\",\"134\",\"135\",\"136\",\"137\",\"138\",\"139\",\"140\",\"141\",\"142\",\"143\",\"144\",\"145\",\"146\",\"147\",\"148\",\"149\",\"150\",\"151\",\"152\",\"153\",\"154\",\"155\",\"156\",\"157\",\"158\",\"159\",\"160\",\"161\",\"162\",\"163\",\"164\",\"165\",\"166\",\"167\",\"168\",\"169\",\"170\",\"171\",\"172\",\"173\",\"174\",\"175\",\"176\",\"177\",\"178\",\"179\",\"180\",\"181\",\"182\",\"183\",\"184\",\"185\",\"186\",\"187\",\"188\",\"189\",\"190\",\"191\",\"192\",\"193\",\"194\",\"195\",\"196\",\"197\",\"198\",\"199\",\"200\",\"201\",\"202\",\"203\",\"204\",\"205\",\"206\",\"207\",\"208\",\"209\",\"210\",\"211\",\"212\",\"213\",\"214\",\"215\",\"216\",\"217\",\"218\",\"219\",\"220\",\"221\",\"222\",\"223\",\"224\",\"225\",\"226\",\"227\",\"228\",\"229\",\"230\",\"231\",\"232\",\"233\",\"234\",\"235\",\"236\",\"237\",\"238\",\"239\",\"240\",\"241\",\"242\",\"243\",\"244\",\"245\",\"246\",\"247\",\"248\",\"249\",\"250\",\"251\",\"252\",\"253\",\"254\",\"255\",\"256\",\"257\",\"258\",\"259\",\"260\",\"261\",\"262\",\"263\",\"264\",\"265\",\"266\",\"267\",\"268\",\"269\",\"270\",\"271\",\"272\",\"273\",\"274\",\"275\",\"276\",\"277\",\"278\",\"279\",\"280\",\"281\",\"282\",\"283\",\"284\",\"285\",\"286\",\"287\",\"288\",\"289\",\"290\",\"291\",\"292\",\"293\",\"294\",\"295\",\"296\",\"297\",\"298\",\"299\",\"300\",\"301\",\"302\",\"303\",\"304\",\"305\",\"306\",\"307\",\"308\",\"309\",\"310\",\"311\",\"312\",\"313\",\"314\",\"315\",\"316\",\"317\",\"318\",\"319\",\"320\",\"321\",\"322\",\"323\",\"324\",\"325\",\"326\",\"327\",\"328\",\"329\",\"330\",\"331\",\"332\",\"333\",\"334\",\"335\",\"336\",\"337\",\"338\",\"339\",\"340\",\"341\",\"342\",\"343\",\"344\",\"345\",\"346\",\"347\",\"348\",\"349\",\"350\",\"351\",\"352\",\"353\",\"354\",\"355\",\"356\",\"357\",\"358\",\"359\",\"360\",\"361\",\"362\",\"363\",\"364\",\"365\",\"366\",\"367\",\"368\",\"369\",\"370\",\"371\",\"372\",\"373\",\"374\",\"375\",\"376\",\"377\",\"378\",\"379\",\"380\",\"381\",\"382\",\"383\",\"384\",\"385\",\"386\",\"387\",\"388\",\"389\",\"390\",\"391\",\"392\",\"393\",\"394\",\"395\",\"396\",\"397\",\"398\",\"399\",\"400\",\"401\",\"402\",\"403\",\"404\",\"405\",\"406\",\"407\",\"408\",\"409\",\"410\",\"411\",\"412\",\"413\",\"414\",\"415\",\"416\",\"417\",\"418\",\"419\",\"420\",\"421\",\"422\",\"423\",\"424\",\"425\",\"426\",\"427\",\"428\",\"429\",\"430\",\"431\",\"432\",\"433\",\"434\",\"435\",\"436\",\"437\",\"438\",\"439\",\"440\",\"441\",\"442\",\"443\",\"444\",\"445\",\"446\",\"447\",\"448\",\"449\",\"450\",\"451\",\"452\",\"453\",\"454\",\"455\",\"456\",\"457\",\"458\",\"459\",\"460\",\"461\",\"462\",\"463\",\"464\",\"465\",\"466\",\"467\",\"468\",\"469\",\"470\",\"471\",\"472\",\"473\",\"474\",\"475\",\"476\",\"477\",\"478\",\"479\",\"480\",\"481\",\"482\",\"483\",\"484\",\"485\",\"486\",\"487\",\"488\",\"489\",\"490\",\"491\",\"492\",\"493\",\"494\",\"495\",\"496\",\"497\",\"498\",\"499\",\"500\",\"501\",\"502\",\"503\",\"504\",\"505\",\"506\",\"507\",\"508\",\"509\",\"510\",\"511\",\"512\",\"513\",\"514\",\"515\",\"516\",\"517\",\"518\",\"519\",\"520\",\"521\",\"522\",\"523\",\"524\",\"525\",\"526\",\"527\",\"528\",\"529\",\"530\",\"531\",\"532\",\"533\",\"534\",\"535\",\"536\",\"537\",\"538\",\"539\",\"540\",\"541\",\"542\",\"543\",\"544\",\"545\",\"546\",\"547\",\"548\",\"549\",\"550\",\"551\",\"552\",\"553\",\"554\",\"555\",\"556\",\"557\",\"558\",\"559\",\"560\",\"561\",\"562\",\"563\",\"564\",\"565\",\"566\",\"567\",\"568\",\"569\",\"570\");\n} //fin de if($IdEstado == \"20\")\n\nif($IdEstado == \"21\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\",\"114\",\"115\",\"116\",\"117\",\"118\",\"119\",\"120\",\"121\",\"122\",\"123\",\"124\",\"125\",\"126\",\"127\",\"128\",\"129\",\"130\",\"131\",\"132\",\"133\",\"134\",\"135\",\"136\",\"137\",\"138\",\"139\",\"140\",\"141\",\"142\",\"143\",\"144\",\"145\",\"146\",\"147\",\"148\",\"149\",\"150\",\"151\",\"152\",\"153\",\"154\",\"155\",\"156\",\"157\",\"158\",\"159\",\"160\",\"161\",\"162\",\"163\",\"164\",\"165\",\"166\",\"167\",\"168\",\"169\",\"170\",\"171\",\"172\",\"173\",\"174\",\"175\",\"176\",\"177\",\"178\",\"179\",\"180\",\"181\",\"182\",\"183\",\"184\",\"185\",\"186\",\"187\",\"188\",\"189\",\"190\",\"191\",\"192\",\"193\",\"194\",\"195\",\"196\",\"197\",\"198\",\"199\",\"200\",\"201\",\"202\",\"203\",\"204\",\"205\",\"206\",\"207\",\"208\",\"209\",\"210\",\"211\",\"212\",\"213\",\"214\",\"215\",\"216\",\"217\");\n} //fin de if($IdEstado == \"21\")\n\nif($IdEstado == \"22\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\");\n} //fin de if($IdEstado == \"22\")\n\nif($IdEstado == \"23\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\");\n} //fin de if($IdEstado == \"23\")\n\nif($IdEstado == \"24\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\");\n} //fin de if($IdEstado == \"24\")\n\nif($IdEstado == \"25\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\");\n} //fin de if($IdEstado == \"25\")\n\nif($IdEstado == \"26\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\");\n} //fin de if($IdEstado == \"26\")\n\nif($IdEstado == \"27\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\");\n} //fin de if($IdEstado == \"27\")\n\nif($IdEstado == \"28\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\");\n} //fin de if($IdEstado == \"28\")\n\nif($IdEstado == \"29\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\");\n} //fin de if($IdEstado == \"29\")\n\nif($IdEstado == \"30\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\",\"107\",\"108\",\"109\",\"110\",\"111\",\"112\",\"113\",\"114\",\"115\",\"116\",\"117\",\"118\",\"119\",\"120\",\"121\",\"122\",\"123\",\"124\",\"125\",\"126\",\"127\",\"128\",\"129\",\"130\",\"131\",\"132\",\"133\",\"134\",\"135\",\"136\",\"137\",\"138\",\"139\",\"140\",\"141\",\"142\",\"143\",\"144\",\"145\",\"146\",\"147\",\"148\",\"149\",\"150\",\"151\",\"152\",\"153\",\"154\",\"155\",\"156\",\"157\",\"158\",\"159\",\"160\",\"161\",\"162\",\"163\",\"164\",\"165\",\"166\",\"167\",\"168\",\"169\",\"170\",\"171\",\"172\",\"173\",\"174\",\"175\",\"176\",\"177\",\"178\",\"179\",\"180\",\"181\",\"182\",\"183\",\"184\",\"185\",\"186\",\"187\",\"188\",\"189\",\"190\",\"191\",\"192\",\"193\",\"194\",\"195\",\"196\",\"197\",\"198\",\"199\",\"200\",\"201\",\"202\",\"203\",\"204\",\"205\",\"206\",\"207\",\"208\",\"209\",\"210\",\"211\",\"212\");\n} //fin de if($IdEstado == \"30\")\n\nif($IdEstado == \"31\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\",\"059\",\"060\",\"061\",\"062\",\"063\",\"064\",\"065\",\"066\",\"067\",\"068\",\"069\",\"070\",\"071\",\"072\",\"073\",\"074\",\"075\",\"076\",\"077\",\"078\",\"079\",\"080\",\"081\",\"082\",\"083\",\"084\",\"085\",\"086\",\"087\",\"088\",\"089\",\"090\",\"091\",\"092\",\"093\",\"094\",\"095\",\"096\",\"097\",\"098\",\"099\",\"100\",\"101\",\"102\",\"103\",\"104\",\"105\",\"106\");\n} //fin de if($IdEstado == \"31\")\n\nif($IdEstado == \"32\"){\n\t$Mpio = array(\"001\",\"002\",\"003\",\"004\",\"005\",\"006\",\"007\",\"008\",\"009\",\"010\",\"011\",\"012\",\"013\",\"014\",\"015\",\"016\",\"017\",\"018\",\"019\",\"020\",\"021\",\"022\",\"023\",\"024\",\"025\",\"026\",\"027\",\"028\",\"029\",\"030\",\"031\",\"032\",\"033\",\"034\",\"035\",\"036\",\"037\",\"038\",\"039\",\"040\",\"041\",\"042\",\"043\",\"044\",\"045\",\"046\",\"047\",\"048\",\"049\",\"050\",\"051\",\"052\",\"053\",\"054\",\"055\",\"056\",\"057\",\"058\");\n} //fin de if($IdEstado == \"32\")\n\n\n\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == TRES)\n\t{\n\t\tif(!in_array($LocCampo,$Mpio))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_26.\"|\".$LocCampo.\"|\" . $DI_26_Mpio.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_26.\"|\".$LocCampo.\"|\" . $DI_26_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function DIAS_DEL_MES($_FECHA) {\r\n\tlist($dia, $mes, $anio) = SPLIT('[/.-]', $_FECHA);\r\n\t$dias_mes['01'] = 31;\r\n\tif ($anio%4==0) $dias_mes['02']=29; else $dias_mes['02']=28;\r\n\t$dias_mes['03'] = 31;\r\n\t$dias_mes['04'] = 30;\r\n\t$dias_mes['05'] = 31;\r\n\t$dias_mes['06'] = 30;\r\n\t$dias_mes['07'] = 31;\r\n\t$dias_mes['08'] = 31;\r\n\t$dias_mes['09'] = 30;\r\n\t$dias_mes['10'] = 31;\r\n\t$dias_mes['11'] = 30;\r\n\t$dias_mes['12'] = 31;\r\n\treturn $dias_mes[$mes];\r\n}", "function fecha_entrega($fecha_entrega)\n\t{\n\t\t$hoy = date('Y-m-d');\n\t\t$fecha_valida = date('Y-m-d',strtotime('+3 day',strtotime($hoy)));\n\t\tif($fecha_entrega < $fecha_valida)\n\t\t{\n\t\t\t$this->CI->form_validation->set_message('fecha_entrega', \"El campo %s debe de ser por lo menos 3 d&iacute;as h&aacute;biles despu&eacute;s de la fecha de la orden de compra.\");\n\t\t\treturn FALSE;\n\t\t}\n\t\treturn TRUE;\n\t}", "function validar($reservah, $reservaf) {\n list($añor, $mesr, $diar) = split('[/.-]', $reservaf);\n list($horar, $minr) = split('[:]', $reservah);\n list($dia, $mes, $año) = $this->fecha();\n list($hora, $min, $mer) = $this->horario();\n\n $result = false;\n $hoy = false;\n\n //es una fecha valida?\n if (($añor >= $año) && ($mesr >= $mes) && ($diar >= $dia)) {\n //es hoy?\n if (($añor == $año) && ($mesr == $mes) && ($diar == $dia)) {\n $hoy = true;\n }\n if ($hoy) {\n //es hoy\n //verifico que sea una hora valida, y no una que ya pasó.\n if (($horar >= $hora) || ($horar == $hora && $minr > $min)) {\n $result = true;\n }\n } else {\n //es otro dia\n $result = true;\n }\n }\n return $result;\n }", "function validar_dni($dni){\n $letra = substr($dni, -1);\n $numeros = substr($dni, 0, -1);\n if ( substr(\"TRWAGMYFPDXBNJZSQVHLCKE\", $numeros%23, 1) == $letra && strlen($letra) == 1 && strlen ($numeros) == 8 ){\n echo 'valido';\n }else{\n echo 'no valido';\n }\n}", "function valida_centrobeneficio($rfc)\n{\n\tif($_REQUEST['codigomodalidadacademica'])\n\t{\n\t\t$codigomodalidadacademica=$_REQUEST['codigomodalidadacademica'];\n\t}\n\telseif(isset($_GET['codigocarrera']) and $_GET['codigocarrera']!=\"\")\n\t{\n\t\tif(!$_REQUEST['codigomodalidadacademica'])\n\t\t{\n\t\t\t$query=\"\";\n\t\t\t$carrera=new ADODB_Active_Record('carrera');\n\t\t\t$carrera->Load(\"codigocarrera='\".$_GET['codigocarrera'].\"'\");\n\t\t\t//echo $carrera->codigomodalidadacademica;\n\t\t\t$codigomodalidadacademica=$carrera->codigomodalidadacademica;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$codigomodalidadacademica=$_REQUEST['codigomodalidadacademica'];\n\t\t}\n\t}\n\t{\n\t\t$rfcfunction = \"ZFICA_CENTROS_BENEF\";\n\t\t$resultstable = \"T_CEBE\";\n\t\t$entrego = \"MODAC\";\n\t\t$modac = $codigomodalidadacademica;\n\t\t$rfchandle = saprfc_function_discover($rfc, $rfcfunction);\n\t\t// traigo la tabla interna de SAP\n\t\tsaprfc_table_init($rfchandle,$resultstable);\n\t\t// importo parametro de entrada\n\t\tsaprfc_import($rfchandle,$entrego,$modac);\n\t\t$rfcresults = saprfc_call_and_receive($rfchandle);\n\t\t$numrows = saprfc_table_rows($rfchandle,$resultstable);\n\t\tfor ($i=1; $i <= $numrows; $i++)\n\t\t{\n\t\t\t$results[$i] = saprfc_table_read($rfchandle,$resultstable,$i);\n\t\t}\n\t\t//var_dump($results);\n\t\tif ($results <> \"\")\n\t\t{ // if 1\n\t\t\tforeach ($results as $valor => $total)\n\t\t\t{ // foreach 1\n\t\t\t\tforeach ($total as $valor1 => $total1)\n\t\t\t\t{ // foreach 2\n\t\t\t\t\tif ($valor1 == \"PRCTR\")\n\t\t\t\t\t{\n\t\t\t\t\t\t$codigocentrobeneficio = $total1;\n\t\t\t\t\t\t//echo $opprincipal,\"<br>\";\n\t\t\t\t\t}\n\t\t\t\t\tif ($valor1 == \"LTEXT\")\n\t\t\t\t\t{\n\t\t\t\t\t\t$nombrecentrobeneficio = $total1;\n\t\t\t\t\t}\n\t\t\t\t} // foreach 2\n\t\t\t\t$totalconceptos[] = array($codigocentrobeneficio,$nombrecentrobeneficio);\n\t\t\t} // foreach 1\n\t\t} // if 1\n\t}\n\n\tif(is_array($totalconceptos))\n\t{\n\t\tforeach ($totalconceptos as $valor => $total)\n\t\t{ // foreach 1\n\t\t\t$contador = 1;\n\t\t\t$codigosap = \"\";\n\t\t\tforeach ($total as $valor1 => $total1)\n\t\t\t{ // foreach 2\n\t\t\t\tif ($contador == 1)\n\t\t\t\t{\n\t\t\t\t\t$codigosap = $codigosap . $total1;\n\t\t\t\t\t$contador++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif ($contador == 2)\n\t\t\t\t{\n\t\t\t\t\t$codigosap = $codigosap. \"-\" . $total1;\n\t\t\t\t\t$contador++;\n\t\t\t\t}\n\t\t\t} // foreach 2\n\t\t\t$insertacodigo = explode(\"-\", $codigosap);\n\t\t\t$valor=$insertacodigo[0];\n\t\t\t$name = explode(\"-\", $_POST['codigocentrobeneficio']);\n\t\t\t$label=strtoupper($insertacodigo[0]).\"-\".$insertacodigo[1];\n\t\t\t$array_combo_centrobeneficio[$contador_array]['etiqueta']=$label;\n\t\t\t$array_combo_centrobeneficio[$contador_array]['valor']=$valor;\n\t\t\t$contador_array++;\n\t\t}\n\t\treturn $array_combo_centrobeneficio;\n\t}\n}", "function ValidarExpedienteNroYearSecretaria($nroInstancia, $NroExpediente, $AnioExpediente, $Secretaria){\n try{\n\t\tglobal $conn; \n\t\tif(!isset($NroExpediente)){$NroExpediente = '';} \n\t\tif(!isset($AnioExpediente)){$AnioExpediente = '';}\n\t\t\n\t\t$sql = \"SELECT 1\n\t\t\t\t\tFROM legales.ljt_juicioentramite\n\t\t\t\t\tWHERE jt_estadomediacion = 'J'\n\t\t\t\t\tAND jt_idestado <> 3\n\t\t\t\t\tAND NVL2 (jt_anioexpediente,jt_nroexpediente || '/' || jt_anioexpediente,jt_nroexpediente) = \n\t\t\t\t\ttrim(:NroExpediente || '/' || :AnioExpediente)\n\t\t\t\t\tAND jt_idsecretaria = :Secretaria\n\t\t\t\t\tAND JT_ID <> :nroInstancia\n\t\t\t\t\tAND ROWNUM = 1\";\n\n\t\t$params = array(\n\t\t\t\t\t\":nroInstancia\" => $nroInstancia,\n\t\t\t\t\t\":Secretaria\" => $Secretaria,\n\t\t\t\t\t\":NroExpediente\" => $NroExpediente,\n\t\t\t\t\t\":AnioExpediente\" => $AnioExpediente);\n\t\t\n\t\t$result = ValorSql($sql, \"\", $params);\n\t\t//$result = 1;\n\t\t\n\t\tif($result == 1){\n\t\t\t//throw new Exception(\"Nro Expediente \".$NroExpediente.\"/\".$AnioExpediente.\", ya existe en la Secretaria \".$Secretaria.\".\");\n\t\t\tthrow new Exception(\"Expediente ya existente. \".$nroInstancia);\n\t\t\treturn false;\n\t\t}\t\t\n\t\t\n\t\treturn true;\n }catch (Exception $e) {\n DBRollback($conn); \n\t\tErrorConeccionDatos($e->getMessage());\n\t\treturn false;\n } \t\t\t\t\n}", "function validar_Fecha()\n {\n $this->resource = 'Actividades';\n $fecha_menor = strtotime(\"2021-01-01 00:00:00\");\n $fecha_mayor = strtotime(\"2050-01-01 00:00:00\");\n $fecha_entrada = strtotime($this->fecha);\n\n if ($this->no_vacio($this->fecha) === false) {\n $this->code = '70027';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($this->formato_fecha($this->fecha) === false) {\n $this->code = '70028';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($fecha_entrada > $fecha_mayor) {\n $this->code = '70029';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($fecha_entrada < $fecha_menor) {\n $this->code = '70030';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n }\n }", "function Comprobar_responsablecentro()\n{\n\t$correcto = true;\n\n\t//si se cumple la condicion\n\tif (strlen($this->RESPONSABLECENTRO)<3)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"RESPONSABLECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00003\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo no numérico demasiado corto\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (strlen($this->RESPONSABLECENTRO)>60)\n\t{\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"RESPONSABLECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00002\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Valor de atributo demasiado largo\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\t//si se cumple la condicion\n\tif (!preg_match(\"/^[A-Za-zñáéíóúÑÁÉÍÓÚüÜ ]+$/\",$this->RESPONSABLECENTRO)){\n\t\t$error = array();\n\t\t\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"RESPONSABLECENTRO\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"00030\");\n\t\t//guarda un mensaje de error\n\t\tarray_push($error, \"Solo están permitidas alfabéticos\");\n\n\t\t//guarda un mensaje de error\n\t\tarray_push($this->erroresdatos, $error);\n\t\t$correcto = false;\n\t}\n\n\t\n\treturn $correcto;\n}", "public function validacion_fecha($fec){\n \n self::set_fecha($fec); // asignar la fecha\n $partes= explode(\"-\", self::get_fecha()); \n echo \"<br><br>\";\n echo \"Fecha Ingresada <br><br>\";\n print_r($partes);\n $actual = array(date(\"Y\"),date(\"m\"),date(\"d\"));\n echo \"<br><br>\";\n echo \"Fecha actual <br><br>\";\n print_r($actual);\n \n if(self::escritura_valida($partes) && self::fecha_mayor_actual($actual, $partes)) // si es valida la escritura y la fecha es mayor a la actual es correcta la fecha\n {\n return true;\n }\n else{\n return false;\n }\n }", "function validCPF($cpf) {\n // determina um valor inicial para o digito $d1 e $d2\n // pra manter o respeito ;)\n $d1 = 0;\n $d2 = 0;\n // remove tudo que não seja número\n $cpf = preg_replace(\"/[^0-9]/\", \"\", $cpf);\n // lista de cpf inválidos que serão ignorados\n $ignore_list = array(\n '00000000000',\n '01234567890',\n '11111111111',\n '22222222222',\n '33333333333',\n '44444444444',\n '55555555555',\n '66666666666',\n '77777777777',\n '88888888888',\n '99999999999'\n );\n // se o tamanho da string for dirente de 11 ou estiver\n // na lista de cpf ignorados já retorna false\n if (strlen($cpf) != 11 || in_array($cpf, $ignore_list)) {\n return false;\n } else {\n // inicia o processo para achar o primeiro\n // número verificador usando os primeiros 9 dígitos\n for ($i = 0; $i < 9; $i++) {\n // inicialmente $d1 vale zero e é somando.\n // O loop passa por todos os 9 dígitos iniciais\n $d1 += $cpf[$i] * (10 - $i);\n }\n // acha o resto da divisão da soma acima por 11\n $r1 = $d1 % 11;\n // se $r1 maior que 1 retorna 11 menos $r1 se não\n // retona o valor zero para $d1\n $d1 = ($r1 > 1) ? (11 - $r1) : 0;\n // inicia o processo para achar o segundo\n // número verificador usando os primeiros 9 dígitos\n for ($i = 0; $i < 9; $i++) {\n // inicialmente $d2 vale zero e é somando.\n // O loop passa por todos os 9 dígitos iniciais\n $d2 += $cpf[$i] * (11 - $i);\n }\n // $r2 será o resto da soma do cpf mais $d1 vezes 2\n // dividido por 11\n $r2 = ($d2 + ($d1 * 2)) % 11;\n // se $r2 mair que 1 retorna 11 menos $r2 se não\n // retorna o valor zeroa para $d2\n $d2 = ($r2 > 1) ? (11 - $r2) : 0;\n // retona true se os dois últimos dígitos do cpf\n // forem igual a concatenação de $d1 e $d2 e se não\n // deve retornar false.\n return (substr($cpf, -2) == $d1 . $d2) ? true : false;\n }\n }", "function dia_en_entero($anio,$i,$mes){\t\n\t\t\n\t\t\t$fecha= \"$anio/$mes/$i\";\n\t\t\t$l = strtotime($fecha);\n\t\t\t$validar=jddayofweek(cal_to_jd(CAL_GREGORIAN, date(\"m\",$l),date(\"d\",$l), date(\"Y\",$l)) , 0 );\n\t\t\t\t\t\t\t\n\t\t\treturn $validar;\n\t\t}" ]
[ "0.6229961", "0.61410874", "0.61212033", "0.6062706", "0.5864501", "0.5830654", "0.5829482", "0.58270824", "0.58027005", "0.57992834", "0.5797385", "0.5789751", "0.5750241", "0.57177126", "0.5707379", "0.56842756", "0.56758064", "0.5671158", "0.5666472", "0.5654039", "0.5645448", "0.5635816", "0.5626707", "0.56219983", "0.559992", "0.55846", "0.5578515", "0.557706", "0.5572402", "0.55688375" ]
0.69386876
0
/ VALIDA QUE EL RFC TENGA LA ESTRUCTURA ESTABLECIDA CON HOMOCLAVE
public function validarRFC($rfc) { $this->CI->form_validation->set_message('validarRFC', "El campo %s no cuenta con la estructura establecida."); if(preg_match( "/^[A-Z&Ñ]{3,4}([0-9]{2})(1[0-2]|0[1-9])([0-3][0-9])([ -]?)([A-Z0-9]{3,4})$/", $rfc)) return TRUE; else return FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rfc($params) \r\n {\r\n \r\n \t$defaultParams = array(\r\n \t\t'nombre'\t\t=> '',\r\n\t\t\t\t'fecha'\t\t\t=> '',\r\n\t\t\t\t'personaFisica'\t=> true,\r\n\t\t\t\t'soloHomoclave'\t=> false,\r\n\t\t\t);\r\n\t\t\t\r\n\t\t\t$params = array_merge($defaultParams,$params);\r\n\t\t\t\r\n\t\t\t$nombre\t\t\t= $params['nombre'];\r\n\t\t\t$fecha \t\t\t= $params['fecha'];\r\n\t\t\t$personaFisica \t= $params['personaFisica'];\r\n\t\t\t$soloHomoclave \t= $params['soloHomoclave'];\r\n\t\t\t\r\n if ($personaFisica) \r\n {\r\n \t//Procesamos el nombre completo para obtener los apellidos\r\n \t$this->nombre = $this->QuitarArticulos(strtoupper(trim($nombre)));\r\n \t$arr_nombres = explode(\" \", $this->nombre);\r\n \t$num_nombres = count($arr_nombres);\r\n \t//Si hay menos de 2 elementos devolvemos un RFC INVALIDO\r\n \tif ($num_nombres < 2)\r\n \t{\r\n\t \t$this->rfc = \"DATOS INVALIDOS\";\r\n\t \treturn;\r\n \t}\t\r\n \t//Si hay 3 elementos el primero es el nombre\r\n \tif ($num_nombres == 3)\r\n \t{\r\n\t \t$this->nombre = $arr_nombres[0] ;\r\n\t \t$this->apellidoPaterno = $arr_nombres[1];\r\n\t \t$this->apellidoMaterno = $arr_nombres[2];\r\n \t}\r\n \telse \r\n \t{\r\n \t\t//Si hay mas 3 elementos asumimos que los primeros dos son los nombres\r\n \t\t//el tercero el apellido paterno y los demas el apellido materno\r\n\t \t$this->nombre = array_shift($arr_nombres) . \" \" . array_shift($arr_nombres);\r\n\t \t$this->apellidoPaterno = array_shift($arr_nombres);\r\n\t \t$this->apellidoMaterno = implode(\" \", $arr_nombres);\r\n \t}\r\n\t //Quitamos los artículos de los apellidos \r\n\t\t\t\t$this->nombreProcesado = $this->apellidoPaterno . \" \" . $this->apellidoMaterno . \" \" . $this->QuitaNombreComun($this->nombre);\r\n\t\t\t\t//Agregamos el primer caracter del apellido paterno \r\n\t\t\t\t$this->rfc = substr($this->apellidoPaterno, 0, 1); \r\n\t\t\t\t//Buscamos y agregamos al rfc la primera vocal del primer apellido \r\n\t\t\t\tfor($i = 1; $i < strlen($this->apellidoPaterno); $i++) \r\n\t\t\t\t{ \r\n \t\t$c = $this->apellidoPaterno[$i]; \r\n\t\t\t \t\tif ($this->EsVocal($c)) \r\n\t\t\t \t\t{ \r\n \t$this->rfc .= $c; \r\n\t\t\t\t\t\tbreak; \r\n\t\t\t\t\t} \r\n\t\t\t\t} \r\n\t\t\t\t//Agregamos el primer caracter del apellido materno \r\n\t\t\t\t$this->rfc .= substr($this->apellidoMaterno, 0, 1);\r\n\t\t\t\t//Agregamos el primer caracter del primer nombre, o los 2 primeros en caso de no haber apellido materno \r\n\t\t\t\t$this->rfc .= substr($this->QuitaNombreComun($this->nombre), 0, $this->apellidoMaterno ? 1 : 2); \r\n\t\t\t\t//Revisamos es una \"palabra mala\" \r\n\t\t\t\t$this->rfc = $this->QuitaPalabraMala($this->rfc); \r\n }\r\n\t\t\telse //Persona Moral\r\n\t\t\t{\r\n\t\t\t\t$this->nombre = strtoupper(trim($nombre));\r\n\t\t\t\t//Quitamos el S.A., A.C., etc.\r\n\t\t\t\t$pos = strpos($this->nombre, '.') - 1;\r\n\t\t\t\t$this->nombreProcesado = rtrim(substr($this->nombre, 0, $pos));\r\n\t\t\t\t//Agregamos los primeros tres caracteres de la razon social \r\n\t\t\t\t$this->rfc = substr($this->nombreProcesado, 0, 3); \r\n\t\t\t}\r\n \r\n \r\n /* Agregamos la fecha dd-mm-yyyy (por ejemplo: 25-08-1968 = 25 de agosto de 1968); \r\n por si las dudas, ponemos un cero a la izquierda de los meses y dias < 10 */ \r\n $efecha = explode(\"-\", $fecha);\r\n $ano = $efecha[2];\r\n $mes = $efecha[1];\r\n $dia = $efecha[0];\r\n $efecha[0] = substr($ano, 2, 2); \r\n $efecha[1] = str_pad($mes, 2, '0', STR_PAD_LEFT); \r\n $efecha[2] = str_pad($dia, 2, '0', STR_PAD_LEFT); \r\n $fecha = implode(\"\", $efecha); \r\n $this->rfc .= $fecha; \r\n \r\n $homoclave = '';\r\n //Le agregamos la homoclave al rfc \r\n if ($personaFisica) \r\n\t\t\t\t$homoclave = $this->CalcularHomoclave($this->apellidoPaterno . \" \" . $this->apellidoMaterno . \" \" . $this->nombre); \r\n\t\t\telse\r\n\t\t\t\t$homoclave = $this->CalcularHomoclave($this->nombreProcesado);\r\n\t\t\tif(!$soloHomoclave) \r\n $this->rfc .= $homoclave; \r\n\t\t\telse \r\n $this->rfc = $homoclave;\r\n }", "function valida_centrobeneficio($rfc)\n{\n\tif($_REQUEST['codigomodalidadacademica'])\n\t{\n\t\t$codigomodalidadacademica=$_REQUEST['codigomodalidadacademica'];\n\t}\n\telseif(isset($_GET['codigocarrera']) and $_GET['codigocarrera']!=\"\")\n\t{\n\t\tif(!$_REQUEST['codigomodalidadacademica'])\n\t\t{\n\t\t\t$query=\"\";\n\t\t\t$carrera=new ADODB_Active_Record('carrera');\n\t\t\t$carrera->Load(\"codigocarrera='\".$_GET['codigocarrera'].\"'\");\n\t\t\t//echo $carrera->codigomodalidadacademica;\n\t\t\t$codigomodalidadacademica=$carrera->codigomodalidadacademica;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$codigomodalidadacademica=$_REQUEST['codigomodalidadacademica'];\n\t\t}\n\t}\n\t{\n\t\t$rfcfunction = \"ZFICA_CENTROS_BENEF\";\n\t\t$resultstable = \"T_CEBE\";\n\t\t$entrego = \"MODAC\";\n\t\t$modac = $codigomodalidadacademica;\n\t\t$rfchandle = saprfc_function_discover($rfc, $rfcfunction);\n\t\t// traigo la tabla interna de SAP\n\t\tsaprfc_table_init($rfchandle,$resultstable);\n\t\t// importo parametro de entrada\n\t\tsaprfc_import($rfchandle,$entrego,$modac);\n\t\t$rfcresults = saprfc_call_and_receive($rfchandle);\n\t\t$numrows = saprfc_table_rows($rfchandle,$resultstable);\n\t\tfor ($i=1; $i <= $numrows; $i++)\n\t\t{\n\t\t\t$results[$i] = saprfc_table_read($rfchandle,$resultstable,$i);\n\t\t}\n\t\t//var_dump($results);\n\t\tif ($results <> \"\")\n\t\t{ // if 1\n\t\t\tforeach ($results as $valor => $total)\n\t\t\t{ // foreach 1\n\t\t\t\tforeach ($total as $valor1 => $total1)\n\t\t\t\t{ // foreach 2\n\t\t\t\t\tif ($valor1 == \"PRCTR\")\n\t\t\t\t\t{\n\t\t\t\t\t\t$codigocentrobeneficio = $total1;\n\t\t\t\t\t\t//echo $opprincipal,\"<br>\";\n\t\t\t\t\t}\n\t\t\t\t\tif ($valor1 == \"LTEXT\")\n\t\t\t\t\t{\n\t\t\t\t\t\t$nombrecentrobeneficio = $total1;\n\t\t\t\t\t}\n\t\t\t\t} // foreach 2\n\t\t\t\t$totalconceptos[] = array($codigocentrobeneficio,$nombrecentrobeneficio);\n\t\t\t} // foreach 1\n\t\t} // if 1\n\t}\n\n\tif(is_array($totalconceptos))\n\t{\n\t\tforeach ($totalconceptos as $valor => $total)\n\t\t{ // foreach 1\n\t\t\t$contador = 1;\n\t\t\t$codigosap = \"\";\n\t\t\tforeach ($total as $valor1 => $total1)\n\t\t\t{ // foreach 2\n\t\t\t\tif ($contador == 1)\n\t\t\t\t{\n\t\t\t\t\t$codigosap = $codigosap . $total1;\n\t\t\t\t\t$contador++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\tif ($contador == 2)\n\t\t\t\t{\n\t\t\t\t\t$codigosap = $codigosap. \"-\" . $total1;\n\t\t\t\t\t$contador++;\n\t\t\t\t}\n\t\t\t} // foreach 2\n\t\t\t$insertacodigo = explode(\"-\", $codigosap);\n\t\t\t$valor=$insertacodigo[0];\n\t\t\t$name = explode(\"-\", $_POST['codigocentrobeneficio']);\n\t\t\t$label=strtoupper($insertacodigo[0]).\"-\".$insertacodigo[1];\n\t\t\t$array_combo_centrobeneficio[$contador_array]['etiqueta']=$label;\n\t\t\t$array_combo_centrobeneficio[$contador_array]['valor']=$valor;\n\t\t\t$contador_array++;\n\t\t}\n\t\treturn $array_combo_centrobeneficio;\n\t}\n}", "function validaAlfaEsp ($Cad) {\n// prueba si la entrada son cadenas alfabeticas con espacio\n// preg_match realiza búsquedas en cadenas de texto mediante expresiones regulares. Devolverá el valor booleano.\nreturn preg_match(\"/^[a-z ]*$/i\", $Cad );\n}", "function validarCliente(){\n $this->procedimiento='rec.ft_cliente_ime';\n $this->transaccion='CLI_VALIDAR_GET';\n $this->tipo_procedimiento='IME';//tipo de transaccion\n $this->setCount(false);\n $this->setParametro('nombre','nombre','varchar');\n $this->setParametro('apellido','apellido','varchar');\n $this->setParametro('genero','genero','varchar');\n $this->setParametro('ci','ci','varchar');\n\n\n $this->captura('v_valid','varchar');\n $this->captura('v_desc_func','varchar');\n\n\n //Ejecuta la instruccion\n $this->armarConsulta();\n //var_dump($this->respuesta); exit;\n $this->ejecutarConsulta();\n //Devuelve la respuesta\n return $this->respuesta;\n }", "function validarDirCorreoElec ($Cad) {\n// prueba si la entrada coincide con los patrones de correo electronico\nreturn preg_match(\"/^([a-z0-9_-])+([\\.a-z0-9_-])*@([a-z0-9-])+(\\.[a-z0-9-]+)*\\.([a-z]{2,6})*$/i\", $Cad );\n}", "function fncValidaDI_56($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_56 = \"(56)Neto\";\n\t$DI_56_ErrTam = \"Neto debe ser de 10 digitos y 2 decimales \";\n\t$DI_56_Catalogo = \"Neto no coincide con la directiva de calidad de la DGRH(9999999999.99)\";\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == 11){\n\t\tif(!preg_match(\"/[0-9]{8}.[0-9]{2}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_56.\"|\".$LocCampo.\"|\" . $DI_56_Catalogo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_56.\"|\".$LocCampo.\"|\" . $DI_56_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "public function validate()\n {\n if (empty($this->schemeID)) {\n ISO6523ICD::verify($this->schemeID);\n }\n\n if ($this->address === null) {\n throw new \\InvalidArgumentException(\"Element 'cac:Address' MUST be provided\");\n }\n }", "function fncValidaDI_27($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_27 = \"(27)Centro de Responsabilidad\";\n\t$DI_27_ErrTam = \"Tamaño de campo Centro de Responsabilidad debe ser a 10 Caracters\";\n\t$DI_27_Edo \t = \"El Centro de Responsabilidad no corresponde al Estado\";\n\t$DI_27_CR \t = \"El Centro de Responsabilidad no corresponde al catalogo de DGRH\";\n\t\n\t// agregar catalogo de Municpios\n $Edo= array($IdEstado);\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == DIEZ)\n\t{\n\t\tif(!in_array(substr($LocCampo,0,2),$Edo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_27.\"|\".$LocCampo.\"|\" . $DI_27_Edo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t\tif(!preg_match(\"/\\d{8}/\",substr($LocCampo,2,8)))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_27.\"|\".$LocCampo.\"|\" . $DI_27_CR.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_27.\"|\".$LocCampo.\"|\" . $DI_27_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_55($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_55 = \"(55)Deducciones \";\n\t$DI_55_ErrTam = \"Deducciones debe ser de 10 digitos y 2 decimales \";\n\t$DI_55_Catalogo = \"Deducciones no coincide con la directiva de calidad de la DGRH(9999999999.99)\";\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == 11){\n\t\tif(!preg_match(\"/[0-9]{8}.[0-9]{2}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_55.\"|\".$LocCampo.\"|\" . $DI_55_Catalogo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_55.\"|\".$LocCampo.\"|\" . $DI_55_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "public function validAddresses() {}", "function validar_Validado()\n {\n\n $this->resource = 'Actividades';\n\n if ($this->no_vacio($this->validado) === false) {\n $this->code = '70032';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n } else if ($this->es_validado($this->validado) === false) {\n $this->code = '70033';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n }\n }", "function fncValidaDI_44($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_44 = \"(44)Fecha de Pago\";\n\t$DI_44_ErrTam = \"Fecha de Pago debe ser de 9 Caracteres(DDMMMAAAA (AAAA=año, MM=mes(primeras 3 letras), DD=día))\";\n\t$DI_44_noDI \t = \"Fecha de Pago no corresponde al formato establecido por DGRH(DDMMMAAAA DD=día, MM=mes(primeras 3 letras), AAAA=año)\";\n\t$DI_44_FecIng \t = \"Fecha de Pago no puede ser menor a Fecha de Ingreso al Gobierno Federal\";\n\t$MesValido=array(\"ENE\",\"FEB\",\"MAR\",\"ABR\",\"MAY\",\"JUN\",\"JUL\",\"AGO\",\"SEP\", \"OCT\",\"NOV\",\"DIC\");\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == NUEVE)\n\t{\n\t\t$Dia =substr($LocCampo,0,2);\n\t\t$Mes =substr($LocCampo,2,3);\n\t\t$Anio=substr($LocCampo,5,4);\n\t\t$Resultado = array_search(strtoupper($Mes), $MesValido);\t\t\n\t\tif (strlen($Resultado) <= 0)\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_44.\"|\".$LocCampo.\"|\" . $DI_44_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\n\t\t}\t\n\t\t$Fecha =$Anio.str_pad(((int) $Resultado) +1,2,\"0\",STR_PAD_LEFT).$Dia;\n\n\t\tif(!validateDate($Fecha))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_44.\"|\".$LocCampo.\"|\" . $DI_44_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_44.\"|\".$LocCampo.\"|\" . $DI_44_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_67($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_66 = \"(67)Acumulado de FONAC\";\n\t$DI_66_ErrTam = \"Acumulado de FONAC debe ser de 10 Digitos\";\n\t$DI_66_DC = \"Acumulado de FONAC No coincide con la Directiva de Calidad definida por la DGRH(##########.##)\";\n\t$DI_65_Catalogo = \"Acumulado de FONAC No coincide el catalogo definido por la DGRH(01-24)\";\n\t\n\t\n\t$LocCampo = $Campo;\n\tif (strlen($LocCampo) == DIEZ){\n\t\tif(!preg_match(\"/[0-9]{7}.[0-9]{2}/\",$LocCampo)){\n\t\t\t$Error = $NumReg .\"|\".$DI_66.\"|\".$LocCampo.\"|\" . $DI_66_DC.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_66.\"|\".$LocCampo.\"|\" . $DI_66_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_15($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_15 = \"(15)Unidad Responsable\";\n\t$DI_15_ErrTam = \"Tamaño de UR debe ser Alfanumérico a 3 posiciones\";\n\t$DI_15_UR = \"La UR no es parte del catalogo de DGRH\";\n\n\t//$UR = explode(\"\\n\", file_get_contents('catalogo_ur.txt'));\n\t$UR = array(\"316\",\"AYK\",\"NCE\",\"M7A\",\"NBQ\",\"NBR\",\"NBS\",\"615\",\"NBU\",\"100\",\"111\",\n\"112\",\"113\",\"114\",\"160\",\"170\",\"171\",\"172\",\"300\",\"310\",\"312\",\"313\",\"314\",\"315\",\"416\",\n\"500\",\"510\",\"511\",\"512\",\"513\",\"514\",\"600\",\"610\",\"611\",\"613\",\"614\",\"E00\",\"H06\",\"I00\",\n\"K00\",\"L00\",\"M00\",\"N00\",\"O00\",\"PBP\",\"PSF\",\"Q00\",\"R00\",\"S00\",\"S01\",\"S02\",\"S03\",\"S04\",\n\"S05\",\"S06\",\"S07\",\"S08\",\"S09\",\"S10\",\"S11\",\"S12\",\"S13\",\"S14\",\"S15\",\"S16\",\"S17\",\"S18\",\n\"S19\",\"S20\",\"S21\",\"S22\",\"S23\",\"S24\",\"S25\",\"S26\",\"S27\",\"S28\",\"S29\",\"S30\",\"S31\",\"S32\",\n\"SME\",\"SPC\",\"SPG\",\"SPM\",\"SSP\",\"T00\",\"U00\",\"V00\",\"VEC\",\"VGE\",\"W00\",\"180\",\"X00\",\n\"REG\",\"FO2\",\"CON\",\"FOR\",\"HOM\");\n\n /** Quita caracteres especiales **/\n\t//$LocCampo =preg_replace('/[^A-Za-z0-9\\-]/', '', $Campo);\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == TRES)\n\t{\n\t\tif(!in_array($LocCampo,$UR))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_15.\"|\".$LocCampo.\"|\" . $DI_15_UR.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = 1;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_15.\"|\".$LocCampo.\"|\" . $DI_15_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = 1;\n\t}\n\treturn $Bandera;\n}", "function validate_docnumber($doctype, $docnumber) {\n //Returns: 1 = NIF ok, 2 = CIF ok, 3 = NIE ok, -1 = NIF bad, -2 = CIF bad, -3 = NIE bad, 0 = ??? bad\n\n $docnumber = strtoupper($docnumber);\n for ($i = 0; $i < 9; $i ++) {\n $num[$i] = substr($docnumber, $i, 1);\n }\n\n //si no tiene un formato valido devuelve error\n if (!preg_match('/((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)/', $docnumber)) {\n $nifcifnie = 0;\n }\n\n //algoritmo para comprobacion de codigos tipo CIF\n $digit = 10;\n $suma = $num[2] + $num[4] + $num[6];\n for ($i = 1; $i < 8; $i = $i + 2) {\n $suma = $suma + substr((2 * $num[$i]), 0, 1) + substr((2 * $num[$i]), 1, 1);\n }\n $len = strlen($suma) - 1;\n $control = substr($suma, $len, 1);\n $n = $digit - $control;\n\n if ($doctype == \"NIF\") {\n //comprobacion de NIFs estandar\n $ctrlNIF = substr($docnumber, 0, 8); \n if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $docnumber)) {\n if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', $ctrlNIF % 23, 1)) {\n $nifcifnie = 1;\n } else {\n $nifcifnie = -1;\n }\n }\n\n //comprobacion de NIFs especiales (se calculan como CIFs o como NIFs)\n if (preg_match('/^[KLM]{1}/', $docnumber)) {\n $ctrlNIF = substr($docnumber, 1, 8); \n if (($num[8] == chr(64 + $n)) || ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', $ctrlNIF % 23, 1))) {\n $nifcifnie = 1;\n } else {\n $nifcifnie = -1;\n }\n }\n }\n \n if ($doctype == \"CIF\") {\n //comprobacion de CIFs\n if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $docnumber)) {\n $len = strlen($n) - 1;\n $ctrlCIF = substr($n, $len, 1); \n if (($num[8] == chr(64 + $n)) || ($num[8] == $ctrlCIF)) {\n $nifcifnie = 2;\n } else {\n $nifcifnie = -2;\n }\n }\n }\n \n if ($doctype == \"NIE\") {\n //comprobacion de NIEs\n if (preg_match('/^[XYZ]{1}/', $docnumber)) {\n if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $docnumber), 0, 8) % 23, 1)) {\n $nifcifnie = 3;\n } else {\n $nifcifnie = -3;\n }\n }\n }\n \n //si todavia no se ha verificado devuelve error\n return $nifcifnie;\n }", "public function validateBody()\n {\n\n if (v::identical($this->col)->validate(1)) {\n\n /** Cidade ou Região **/\n\n $regiao = Tools::clean($this->cell);\n\n if (!v::stringType()->notBlank()->validate($regiao)) {\n throw new \\InvalidArgumentException(\"Atenção: Informe na tabela a Cidade ou Região corretamente.\", E_USER_WARNING);\n }\n\n $this->array[$this->row]['regiao'] = $regiao;\n\n }\n\n if (v::identical($this->col)->validate(2)) {\n\n /** Faixa CEP Inicial **/\n\n $cep_inicio = Tools::clean($this->cell);\n\n if (!v::postalCode('BR')->validate($cep_inicio)) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, Informe na tabela as faixas de CEP no formato correto.\n\n Ex.: 09999-999\n\n Por favor, corrija o CEP Inicial \\\"{$cep_inicio}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n $this->array[$this->row]['cep_inicio'] = $cep_inicio;\n\n }\n\n if (v::identical($this->col)->validate(3)) {\n\n /** Faixa CEP Final **/\n\n $cep_fim = Tools::clean($this->cell);\n\n if (!v::postalCode('BR')->validate($cep_fim)) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, Informe na tabela as faixas de CEP no formato correto.\n\n Ex.: 09999-999\n\n Por favor, corrija o CEP Final \\\"{$cep_fim}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n $this->array[$this->row]['cep_fim'] = $cep_fim;\n\n }\n\n if (v::identical($this->col)->validate(4)) {\n\n /** Peso Inicial **/\n\n $peso_inicial = Tools::clean($this->cell);\n\n if (v::numeric()->negative()->validate(Tools::convertToDecimal($peso_inicial))) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, os VALORES do Peso Inicial não pode conter numeros negativos.\n\n Por favor, corrija o valor \\\"{$peso_inicial}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n $this->array[$this->row]['peso_inicial'] = $peso_inicial;\n\n }\n\n if (v::identical($this->col)->validate(5)) {\n\n /** Peso Final **/\n\n $peso_final = Tools::clean($this->cell);\n\n if (!v::numeric()->positive()->validate(Tools::convertToDecimal($peso_final))) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, os VALORES do Peso Final não pode ser menor ou igual a Zero.\n\n Por favor, corrija o valor \\\"{$peso_final}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n $this->array[$this->row]['peso_final'] = $peso_final;\n\n }\n\n if (v::identical($this->col)->validate(6)) {\n\n /** Valor **/\n\n $valor = Tools::clean($this->cell);\n\n if (!v::notEmpty()->validate(Tools::convertToDecimal($valor))) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, os VALOR do frete não pode ser vazio.\n\n Por favor, corrija o valor e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n if (!v::numeric()->positive()->validate(Tools::convertToDecimal($valor))) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, os VALORES do frete não pode ser menor ou igual a Zero.\n\n Por favor, corrija o valor \\\"{$valor}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n $this->array[$this->row]['valor'] = $valor;\n\n }\n\n if (v::identical($this->col)->validate(7)) {\n\n /** Prazo de Entrega **/\n\n $prazo_entrega = (int)Tools::clean($this->cell);\n\n /**\n * Verifica o prazo de entrega\n */\n if (!v::numeric()->positive()->validate($prazo_entrega)) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, Atenção: Informe na tabela os Prazos de Entrega corretamente.\n\n Exemplo: 7 para sete dias.\n\n Por favor, corrija o Prazo de Entrega \\\"{$prazo_entrega}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n if (!v::numeric()->notBlank()->validate($prazo_entrega)) {\n $prazo_entrega = null;\n }\n\n $this->array[$this->row]['prazo_entrega'] = $prazo_entrega;\n\n }\n\n if (v::identical($this->col)->validate(8)) {\n\n /** AD VALOREM **/\n\n $ad_valorem = Tools::clean($this->cell);\n\n if (!empty($ad_valorem) && !v::numeric()->positive()->validate(Tools::convertToDecimal($ad_valorem))) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, os VALORES do AD VALOREM não pode conter numeros negativos.\n\n Por favor, corrija o valor \\\"{$this->cell}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n if (!v::numeric()->notBlank()->validate(Tools::convertToDecimal($ad_valorem))) {\n $ad_valorem = null;\n }\n\n $this->array[$this->row]['ad_valorem'] = $ad_valorem;\n\n }\n\n if (v::identical($this->col)->validate(9)) {\n\n /** KG Adicional **/\n\n $kg_adicional = Tools::clean($this->cell);\n\n if (!empty($kg_adicional) && v::numeric()->negative()->validate(Tools::convertToDecimal($kg_adicional))) {\n\n throw new \\InvalidArgumentException(\"ATENÇÃO: Erro na linha {$this->row}, os VALORES do KG Adicional não pode conter numeros negativos.\n\n Por favor, corrija o valor \\\"{$kg_adicional}\\\" e envie o arquivo novamente.\", E_USER_WARNING);\n\n }\n\n if (!v::numeric()->notBlank()->validate(Tools::convertToDecimal($kg_adicional))) {\n $kg_adicional = null;\n }\n\n $this->array[$this->row]['kg_adicional'] = $kg_adicional;\n\n }\n\n return $this->array;\n\n }", "function fncValidaDI_21($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_21 = \"(21)Proyecto Proceso\";\n\t$DI_21_ErrTam = \"Tamaño de Actividad Institucional debe ser a 4 Alfanumerico\";\n\t$DI_21_PP \t = \"La Proyecto Proceso no es parte del catalogo de DGRH\";\n\t\n $PP= array(\"1301\", \"E010\",\"E025\",\"I002\");\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == CUATRO)\n\t{\n\t\tif(!in_array($LocCampo,$PP))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_21.\"|\".$LocCampo.\"|\" . $DI_21_PP.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = 1;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_21.\"|\".$LocCampo.\"|\" . $DI_21_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = 1;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_40($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_40 = \"(40)Fecha de Ingreso al Gobierno Federal\";\n\t$DI_40_ErrTam = \"Fecha de Ingreso al Gobierno Federal debe ser de 8 Digíto(AAAAMMDD (AAAA=año, MM=mes, DD=día))\";\n\t$DI_40_noDI \t = \"Fecha de Ingreso al Gobierno Federal no corresponde al formato establecido por DGRH(AAAAMMDD (AAAA=año, MM=mes, DD=día))\";\n\n\t\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == OCHO)\n\t{\n\t\tif(!validateDate($LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_40.\"|\".$LocCampo.\"|\" . $DI_40_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_40.\"|\".$LocCampo.\"|\" . $DI_40_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function checkfor_valid_Facs_payment_line($line){\r\n\t$valid = 0;\r\n\t$recordBeginning = substr($line, 0, 2);\r\n\tif($recordBeginning == 11){\r\n\t\t$valid = 1;\r\n\t}else { $valid = 0; }\r\n\treturn $valid;\r\n}", "function fncValidaDI_54($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_54 = \"(54)Percepciones \";\n\t$DI_54_ErrTam = \"Percepciones debe ser de 10 digitos y 2 decimales\";\n\t$DI_54_Catalogo = \"Percepciones no coincide con la directiva de calidad de la DGRH(9999999999.99)\";\n\t\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == 11){\n\t\tif(!preg_match(\"/[0-9]{8}.[0-9]{2}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_54.\"|\".$LocCampo.\"|\" . $DI_54_Catalogo.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_54.\"|\".$LocCampo.\"|\" . $DI_54_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_65($IdEstado, $GestorErr, $NumReg, $Campo){\n\t \n\t$Bandera = CERO;\n\t$DI_64 = \"(65)Ciclo del FONAC\";\n\t$DI_64_ErrTam = \"Ciclo del FONAC debe ser de 4 Digitos\";\n\t$DI_64_DC = \"Ciclo del FONAC No coincide con la Directiva de Calidad definida por la DGRH(Numérico a 4 posiciones)\";\n\t\n\t$LocCampo = $Campo;\n\tif (strlen($LocCampo) == CUATRO){\n\n\n\t\tif(!preg_match(\"/[0-9]{4}/\",$LocCampo)){\n\t\t\t$Error = $NumReg .\"|\".$DI_64.\"|\".$LocCampo.\"|\" . $DI_64_DC.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse{\n\t\t$Error = $NumReg .\"|\".$DI_64.\"|\".$LocCampo.\"|\" . $DI_64_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "function fncValidaDI_37($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_37 = \"(37)Tipo de Trabajador\";\n\t$DI_37_ErrTam = \"Tipo de Trabajador debe ser de 2 Digítos\";\n\t$DI_37_noDI \t = \"Tipo de Trabajador no corresponde al catalogo establecidas por DGRH(01,11,20)\";\n\t\n\t\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == DOS)\n\t{\n\t\tif(!preg_match(\"/[0-9]{2}/\",$LocCampo))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_37.\"|\".$LocCampo.\"|\" . $DI_37_noDI.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_37.\"|\".$LocCampo.\"|\" . $DI_37_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "public function validaCadastro()\n {\n $valido = true;\n\n /*if (!filter_var($this->__get('email'), FILTER_VALIDATE_EMAIL)) {\n $valido = false;\n }*/\n\n if (strlen($this->__get('senha')) < 4) {\n $valido = false;\n }\n\n if ($this->__get('senha') != $this->__get('conf_senha')) {\n $valido = false;\n }\n\n if (strlen($this->__get('nome')) < 4) {\n $valido = false;\n }\n\n return $valido;\n }", "function fncValidaDI_24($IdEstado, $GestorErr, $NumReg, $Campo)\n{\n\t \n\t$Bandera = CERO;\n\n\t$DI_24 = \"(24)Número de Puesto\";\n\t$DI_24_ErrTam = \"Tamaño de Número de Puesto debe ser a 4 Alfanumerico\";\n\t$DI_24_NumPto \t = \"El Número Puesto no es parte del catalogo de DGRH\";\n\t\n $NumPto= array(\"0022\",\"0101\");\n\n\t$LocCampo =$Campo;\n\tif (strlen($LocCampo) == CUATRO)\n\t{\n\t\tif(!in_array($LocCampo,$NumPto))\n\t\t{\n\t\t\t$Error = $NumReg .\"|\".$DI_24.\"|\".$LocCampo.\"|\" . $DI_24_NumPto.\"|\\n\";\n\t\t\tfwrite($GestorErr, $Error);\n\t\t\t$Bandera = UNO;\n\t\t}\t\n\t}\n\telse\n\t{\n\t\t$Error = $NumReg .\"|\".$DI_24.\"|\".$LocCampo.\"|\" . $DI_24_ErrTam.\"|\\n\";\n\t\tfwrite($GestorErr, $Error);\n\t\t$Bandera = UNO;\n\t}\n\treturn $Bandera;\n}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}" ]
[ "0.60339594", "0.6025096", "0.5957865", "0.57096416", "0.5547729", "0.5458106", "0.54314315", "0.5413482", "0.5358538", "0.5347895", "0.5341544", "0.53241426", "0.53003967", "0.5295549", "0.527674", "0.5269239", "0.5247827", "0.52424", "0.5214562", "0.52109545", "0.5210517", "0.5210284", "0.52101827", "0.5197707", "0.51973534", "0.51973534", "0.51973534", "0.51973534", "0.51973534", "0.51973534" ]
0.6515636
0
Get count of moderation reports
public function getModerationCountAttribute() { return $this->moderations->count(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function countNotModerated(){\n $count = ORM::factory($this->object_name())->where('moderate', '=', 0)->count_all();\n return $count;\n }", "private function basicReport()\n {\n return $this->report->count();\n }", "public function countReports(){\n return count($this->getReports());\n }", "public function getUnapprovedCount();", "public function getReminderCount()\n {\n $this->db->select(\"*\");\n $this->db->from(\"reminder\");\n $this->db->where(\"date\", date(\"Y-m-d\"));\n $this->db->or_where(\"period\", \"d\");\n $query = $this->db->get();\n return $query->num_rows();\n }", "public function getCount() {\n \treturn $this->count();\n }", "public function record_count() {\r\n return $this->db->count_all(\"administradores\");\r\n }", "public function getActivitiesCount() : int;", "function getMovieCount(){\n return $this->query(\"SELECT COUNT(id) as number FROM docs WHERE visible=1\");\n }", "public function countRecords()\n {\n try {\n $SQL = \"SELECT COUNT(`id`) FROM `\".CMS_TABLE_PREFIX.\"mod_feedback` WHERE `page_id` > '0' AND `active`='1'\";\n return $this->app['db']->fetchColumn($SQL);\n } catch (\\Doctrine\\DBAL\\DBALException $e) {\n throw new \\Exception($e);\n }\n }", "public function getCountMensagens() \n\t{\n\t\t$query = \"SELECT COUNT(*) as Qtd_mensagem FROM mensagem WHERE id_usuario_destinatario = :id_usuario_destinatario\";\n\t\t$stmt = $this->db->prepare($query);\n\t\t$stmt->bindValue(':id_usuario_destinatario', $this->__get('id_usuario'));\n\t\t$stmt->execute();\n\t\treturn $stmt->fetch(\\PDO::FETCH_ASSOC);\n\t}", "public function reminders()\r\n {\r\n $this->CI->db->where('rel_id', $this->leadId);\r\n $this->CI->db->where('rel_type', 'lead');\r\n $this->CI->db->where('staff', $this->staffId);\r\n $this->CI->db->where('isnotified', 0);\r\n\r\n return $this->CI->db->count_all_results('reminders');\r\n }", "public function getAlertCount() {\n if (!Auth::user()) {\n abort(403);\n }\n\n $userid = Auth::user()->id;\n $toclaim = Tournament::where('concluded', 1)->pluck('id');\n $unavailableVideos = Video::where('user_id', $userid)->where('flag_removed', true)->count();\n $nowdate = date('Y.m.d.', time());\n $weeklaterdate = date('Y.m.d.', time() + 86400 * 7);\n $toconclude = Tournament::where('creator', $userid)->where('tournament_type_id', '!=', 8)\n ->where('concluded', 0)->where('date', '<', $nowdate)->count();\n $tocomplete = Tournament::where('creator', $userid)->where('incomplete', 1)->count();\n $tocardpool = Tournament::where('creator', $userid)->whereNotNull('date')->where('cardpool_id', 'unknown')\n ->where('date', '<', $weeklaterdate)->count();\n $toclaimalert = Entry::where('user', $userid)->whereIn('tournament_id', $toclaim)->whereNull('rank')->count();\n $brokenclaim = Entry::where('user', $userid)->where('rank', '>', 0)->where(function($q){\n $q->where('broken_runner', '=', 1)->orWhere('broken_corp', '=', 1);\n })->count();\n $result = [\n 'personalAlerts' => [\n 'total' => $toclaimalert + $brokenclaim + $unavailableVideos,\n 'toClaimAlert' => $toclaimalert,\n 'brokenClaimAlert' => $brokenclaim,\n 'unavailableVideos' => $unavailableVideos\n ],\n 'organizeAlert' => [\n 'total' => $tocomplete + $toconclude + $tocardpool,\n 'concludeAlert' => $toconclude,\n 'incompleteAlert' => $tocomplete,\n 'unknownCardpoolAlert' => $tocardpool\n ],\n 'profileAlerts' => Auth::user()->badges()->wherePivot('seen', 0)->count()\n ];\n\n if (Auth::user()->admin) {\n $pending = Tournament::whereNull('approved')->where('incomplete', 0)->count();\n $conflict = Tournament::where('conflict', 1)->count();\n $photo = Photo::whereNull('approved')->count();\n $result['adminAlerts'] = [\n 'total' => $pending + $conflict + $photo,\n 'pendingTournament' => $pending,\n 'conflictTournament' => $conflict,\n 'pendingPhoto' => $photo\n ];\n }\n\n return response()->json($result);\n }", "function get_object_count()\r\n {\r\n return $this->get_browser()->count_profile_publications($this->get_condition());\r\n }", "public function searchCount() {\n try {\n if (!($this->announcement instanceof Base_Model_ObtorLib_App_Core_Announcement_Entity_Announcement)) {\n throw new Base_Model_ObtorLib_App_Core_Announcement_Exception(\" Announcement Entity not intialized\");\n } else {\n $objAnnouncement = new Base_Model_ObtorLib_App_Core_Announcement_Dao_Announcement();\n $objAnnouncement->announcement = $this->announcement;\n return $objAnnouncement->searchCount();\n }\n } catch (Exception $ex) {\n throw new Base_Model_ObtorLib_App_Core_Announcement_Exception($ex);\n }\n }", "public function CounterMail(){\n\n $CantidadMails = ($this->ConfigModelo->select('rowCountWhere', 'Mensajes', 'estado', '0', 'Id', 'Id'));\n\n return $CantidadMails;\n\n }", "public function countReportedComments()\n {\n \t$manager = $this->manager->getManager();\n\n \treturn $manager->query('SELECT COUNT(*) FROM comments WHERE reported = 1')->fetchColumn();\n }", "public function getCommentCount();", "public function count()\r\n {\n return $this->fm->count();\n }", "public function searchCount() {\n try {\n if (!($this->permission instanceof Base_Model_ObtorLib_App_Core_Doc_Entity_Permission)) {\n throw new Base_Model_ObtorLib_App_Core_Doc_Exception(\" Permission Entity not intialized\");\n } else {\n $objPermission = new Base_Model_ObtorLib_App_Core_Doc_Dao_Permission();\n $objPermission->permission = $this->permission;\n return $objPermission->searchCount();\n }\n } catch (Exception $ex) {\n throw new Base_Model_ObtorLib_App_Core_Doc_Exception($ex);\n }\n }", "function statistics_extended_members_views($group){\r\n\tglobal $CONFIG;\r\n\tif(!empty($group)){\r\n\t\t$query = \"SELECT sum(m.string) as count FROM {$CONFIG->dbprefix}annotations a, {$CONFIG->dbprefix}metastrings m \";\r\n\t\t$views_counter_id = get_metastring_id(\"views_counter\");\r\n\t\t$query.= \"WHERE name_id={$views_counter_id} \";\r\n\t\t$query.= \"AND entity_guid={$group} \";\r\n\t\t$query.= \"AND owner_guid IN (SELECT guid_one FROM {$CONFIG->dbprefix}entity_relationships WHERE relationship='member' AND guid_two={$group}) \";\r\n\t\t$query.= \"AND a.value_id = m.id\";\r\n\t\t$count = get_data_row($query);\r\n\t\treturn $count->count;\r\n\t}\r\n\treturn 0;\r\n}", "function countsreport(){\n\t\t//$this->set('surveyexports',$this->Surveyexport->find('count', array('conditions'=>array('id'=>'all'))));\n\t\t//$this->set('surveyexports',$this->Surveyexport->find('all'));\n\t\t//$this->set('surveyexports',$this->Surveyexport->find('count'));\n\t\t//$this->set('surveyexports',$this->Surveyexport->findAllById('*'),id);\n\t\t//$this->set('totalCount',$this->Surveyexport->find('count', array('fields'=>' DISTINCT state')));\n\t\t$this->set(('totalCount[0]'),$this->Surveyexport->find('count', array('fields'=>' DISTINCT id'))); // count individual ids in the database\n\t\t//$this->set('totalCount',$this->Surveyexport->find('count', array('fields'=>' DISTINCT focus_id'))); // ??????????????????????????? needs set in DB\n\t\t$this->set('totalCount[1]',$this->Surveyexport->find('count', array('fields'=>'id'))); // count all id's in the database\n\t\t\n\t}", "public function count()\n\t{\n\t\t$content = $this->resource->get($this->name)->getContent();\n\t\t\n\t\treturn $content['doc_count'];\n\t}", "static function countNotifications(){\n return PDOQueries::count_notifications(Log::get_id());\n }", "static function countAdministrators() {\n return Users::count(\"type = 'Administrator' AND state = '\" . STATE_VISIBLE . \"'\");\n }", "public function record_count_activities() {\n return $this->db->count_all(\"page\");\n }", "public function getTotalCount();", "public function getTotalCount();", "public function getTotalCount();", "public function getCounters()\n {\n $st = $this->db->query('SELECT COUNT(*) as count from users')->result_array();\n $data['users'] = $st[0]['count'];\n\n /*===== COUNT INSTANCES =====*/\n $st = $this->db->query('SELECT COUNT(*) as count from instances')->result_array();\n $data['instances'] = $st[0]['count'];\n\n\n /*===== COUNT SERVERS =====*/\n $st = $this->db->query('SELECT COUNT(*) as count from servers')->result_array();\n $data['servers'] = $st[0]['count'];\n\n /*==== COUNT MODULES ====*/\n $st = $this->db->query('SELECT COUNT(*) as count from modules')->result_array();\n $data['modules'] = $st[0]['count'];\n\n return $data;\n }" ]
[ "0.7249092", "0.65515745", "0.6528217", "0.63330036", "0.6217449", "0.61925083", "0.61684644", "0.61476797", "0.613741", "0.6136108", "0.61269104", "0.61132884", "0.60889643", "0.6078102", "0.6063618", "0.60544413", "0.60443944", "0.6041521", "0.6026915", "0.6018259", "0.6018145", "0.6014688", "0.6009093", "0.5999631", "0.5998186", "0.5980388", "0.5979753", "0.5979753", "0.5979753", "0.5960225" ]
0.7092454
1
Check if the permalink uses %postname%.
private function has_postname_in_permalink() { return ( strpos( get_option( 'permalink_structure' ), '%postname%' ) !== false ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hasPost(string $name): bool {}", "function isPost($name) {\r\n return ( getPost($name) != false );\r\n}", "function get_permalink($post = 0, $leavename = \\false)\n {\n }", "function get_the_permalink($post = 0, $leavename = \\false)\n {\n }", "function wprss_permalink_exists( $permalink ) {\n global $wpdb;\n\n $wpdb->query(\n $wpdb->prepare(\n \"SELECT *\n FROM {$wpdb->postmeta}\n WHERE `meta_value` = '{$permalink}'\"\n )\n );\n\n return $wpdb->num_rows > 0;\n }", "function get_post_permalink($post = 0, $leavename = \\false, $sample = \\false)\n {\n }", "function the_slug_exists($post_name) {\n global $wpdb;\n\n if($wpdb->get_results(\"SELECT * FROM $wpdb->posts WHERE post_name like '%\" . $post_name . \"%'\", 'ARRAY_A')) {\n return true;\n } else {\n return false;\n }\n}", "function post_permalink($post = 0)\n {\n }", "public function hasPost($name)\n {\n return isset($this->post[$name]) ? $this->post[$name] : false;\n }", "function the_permalink($post = 0)\n {\n }", "function has_shortlink( $post_id ){\n\t\tif(empty($this->_shortlinks))\n\t\t\tself::update_sl();\n\t\t\t\n\t\t// check for shortlink\n\t\treturn (bool) $this->_shortlinks[$post_id];\n\t\t \n\t}", "protected function hasPostType($name)\n {\n return post_type_exists($name);\n }", "function get_permalink_by_name($page_name) {\n global $post;\n global $wpdb;\n $pageid_name = $wpdb->get_var(\"SELECT ID FROM $wpdb->posts WHERE post_title = '\" . $page_name . \"' LIMIT 0, 1\");\n return get_permalink($pageid_name);\n}", "private function validatePostName($_post_name){\n $this->post_name = htmlspecialchars($_post_name);\n if($this->post_name === '' or strlen($this->post_name) > 100){\n return false; //Was not a string, or an error occured\n }\n return true;\n }", "private function requested_post_is_valid(){\n return (get_post_type((int) $_GET['post_id']) === $this->post_type && get_post_status((int) $_GET['post_id']) === 'publish');\n }", "function post_link($post){\n if(strcasecmp($post->post_type, 'primary_page') == 0){\n return e($post->post_slug);\n }else{\n return strtolower($post->category_name). '/' . e($post->post_slug);\n }\n}", "function voyage_mikado_post_has_title() {\n return get_the_title() !== '';\n }", "function cc_get_post_by_name($post_name) {\n\n\tglobal $wpdb;\n\n\t$sql = sprintf(\"\n\t\tSELECT ID FROM wp_posts\n\t\tWHERE post_name = '%s'\n\t\t\",\n\t\t$post_name\n\t);\n\n\t$post_id = (int) $wpdb->get_var($sql);\n\n\tif ( $post_id ) {\n\t\treturn $post_id;\n\t} else {\n\t\treturn false;\n\t}\n\n}", "protected function postBookmarksExistsOrNot($post_name, $post_id)\n {\n $result = Bookmark::where('name', $post_name)->where('post_id', $post_id)->first();\n\n if($result){\n return true;\n }else{\n return false;\n }\n }", "private function doesPostNeedsRedirect($file) {\n\t\tlist(, $lang, $name) = explode('/', $file);\n\t\tlist($id, ) = explode('-', $name);\n\t\t\n\t\tif (!$post = $this->checkPostAvailable($lang, $name)) {\n\t\t\t# Post not found\n\t\t\tthrow new Exception('Not Found', 404);\n\t\t} else {\n\t\t\t# Check if requested URL differs from needed one\n\t\t\treturn $file === ($needed = $this->buildPostURL($id, $lang)) ? false : $needed;\n\t\t}\n\t}", "public function check_permalinks() {\r\n\t\t\t\t\r\n\t\tif ( !get_option( 'permalink_structure' ) ) {\r\n\t\t\t\r\n\t\t\t// The link structure is default. This will break flow redirections Queue warning.\r\n\t\t\t\r\n\t\t\tself::$toggle_warning = true;\r\n\t\t\t\r\n\t\t\tself::$site_health_info['pretty_permalinks_are_off'] = array(\r\n\t\t\t\t'notice' => PATREON_PRETTY_PERMALINKS_ARE_OFF,\r\n\t\t\t\t// We can use this for ordering notices on health page\r\n\t\t\t\t'heading' => PATREON_PRETTY_PERMALINKS_ARE_OFF_HEADING,\r\n\t\t\t\t'order' => 1,\r\n\t\t\t\t'level' => 'critical',\r\n\t\t\t);\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "function permalink_link()\n {\n }", "private function shouldIndexPost($post)\n {\n return in_array($post->post_type, $this->getConfig()->allowedPostTypes()) && !empty($post->post_title);\n }", "function rdf_permalink( $my_post ) {\n $permalink = site_url( ) . \"?ps_articles=\" . $my_post->post_name;\n return( $permalink );\n}", "function wp_force_plain_post_permalink($post = \\null, $sample = \\null)\n {\n }", "function get_post_permalink($postid){\n if(defined('CLEANURLS')){\n return str_replace('%postid%',$postid,URL_POST);\n }\n else{\n return BLOGURL.'?postid='.$postid;\n }\n }", "function medigroup_mikado_post_has_title() {\n return get_the_title() !== '';\n }", "private function _permalink_setup_check_notice () {\n\t\tif (get_option('permalink_structure')) return false;\n\t\t$msg = sprintf(\n\t\t\t__('Upfront Exporter requires Pretty Permalinks to work. Please enable them <a href=\"%s\">here</a>', UpfrontThemeExporter::DOMAIN),\n\t\t\tadmin_url('/options-permalink.php')\n\t\t);\n\t\treturn $msg;\n\t}", "function ua_webtide_filter_jobs_permalink( $post_link, $post, $leavename, $sample ) {\n\tif ( ! ( 'jobs' == $post->post_type ) ) {\n\t\treturn $post_link;\n\t}\n\t\t\n\t// Get job posting URL\n\tif ( $job_posting_permalink = get_post_meta( $post->ID, 'job_posting_permalink', true ) ) {\n\t\treturn $job_posting_permalink;\n\t}\n\t\t\n\treturn $post_link;\n\t\n}", "private function isSocialPost()\n\t{\n\t\treturn ( get_post_type($this->post_id) == 'social-post' ) ? true : false;\n\t}" ]
[ "0.698892", "0.6982354", "0.6946954", "0.6924149", "0.66932535", "0.66312087", "0.6591611", "0.6585426", "0.63603777", "0.6270124", "0.62490606", "0.623013", "0.6218549", "0.6104967", "0.6029748", "0.6002472", "0.5979718", "0.59575486", "0.5956387", "0.595535", "0.59324497", "0.5927578", "0.58914053", "0.5865251", "0.58617926", "0.58495456", "0.5835377", "0.58211297", "0.58187586", "0.58106834" ]
0.8740753
0
Retrieve Saleable Status Ids Default Product Enable status
public function getSaleableStatusIds() { return [self::STATUS_ENABLED]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function viewableAffiliateProductStatuses()\r\n {\r\n return array(\r\n Product::ACTIVE,\r\n Product::INACTIVE,\r\n );\r\n }", "public function GetStatus()\n\t{\treturn new ProductStatus($this->details['tstatus']);\t\n\t}", "public function viewableSellerProductStatuses()\r\n {\r\n return array(\r\n Product::FOR_COMPLETION,\r\n Product::ACTIVE,\r\n Product::INACTIVE,\r\n Product::DRAFT,\r\n Product::DELETE,\r\n Product::FOR_REVIEW,\r\n Product::REJECT,\r\n );\r\n }", "public function getSellingStatus()\n {\n return $this->sellingStatus;\n }", "function article_status() {\n return Registry::prop('article', 'status');\n}", "function tep_set_product_status($products_id, $status) {\n $OSCOM_Db = Registry::get('Db');\n\n if ($status == '1') {\n return $OSCOM_Db->save('products', [\n 'products_status' => '1',\n 'products_last_modified' => 'now()'\n ], [\n 'products_id' => (int)$products_id\n ]);\n } elseif ($status == '0') {\n return $OSCOM_Db->save('products', [\n 'products_status' => '0',\n 'products_last_modified' => 'now()'\n ], [\n 'products_id' => (int)$products_id\n ]);\n } else {\n return -1;\n }\n }", "function dokan_get_product_status( $status ) {\n switch ($status) {\n case 'simple':\n return __( 'Simple Product', 'dokan' );\n break;\n\n case 'variable':\n return __( 'Variable Product', 'dokan' );\n break;\n\n case 'grouped':\n return __( 'Grouped Product', 'dokan' );\n break;\n\n case 'external':\n return __( 'Scheduled', 'dokan' );\n break;\n\n default:\n return '';\n break;\n }\n}", "public function get_purchased_status($product_id, $purchased_products)\n {\n \n }", "public function getUserDefaultStatus();", "public function enabled()\n\t{\n\t\treturn $this->installed(function($query)\n\t\t{\n\t\t\treturn $query->where('enabled', '=', 1);\n\t\t});\n\t}", "public function getEnabled()\n {\n return array_filter($this->storage, function($val)\n {\n return $val['status'] === ProviderInterface::STATUS_INSTALLED;\n });\n }", "public function active($id){\n $active = Product::find($id)->active;\n return $active;\n }", "public function getIsActiveStatuses()\n {\n $statuses = new Varien_Object(array(\n self::STATUS_ENABLED => Mage::helper('olts_reminder')->__('Enabled'),\n self::STATUS_DISABLED => Mage::helper('olts_reminder')->__('Disabled'),\n ));\n\n Mage::dispatchEvent('reminder_get_is_active_statuses', array('statuses' => $statuses));\n\n return $statuses->getData();\n }", "function getEnabled() {\n\t\treturn $this->getData('enabled');\n\t}", "public function getIsEnabled()\n\t{\n\t\treturn Mage::getStoreConfig(self::XML_PATH_ENABLE);\n\t}", "public function getEnabled()\n {\n return Mage::getStoreConfig('splitprice/split_price_config/enabled');\n }", "public function productDisableStatus($customerId){\n $productCollections = Mage::getModel ( 'catalog/product' )->getCollection ()->addAttributeToFilter ( 'userid', $customerId)->addAttributeToFilter ( 'type_id', array (\n 'eq' => 'property'\n ) );\n /**\n * Iterating the loop\n */\n foreach ( $productCollections as $product ) {\n /**\n * Get Product Id\n */\n $productId = $product->getEntityId ();\n $data = array (\n 'propertyapproved' => 0,\n 'status' => 0\n );\n $model = Mage::getModel ( 'catalog/product' )->load ( $productId )->addData ( $data );\n $model->setId ( $productId )->save ();\n }\n }", "function dokan_get_new_post_status() {\n $user_id = get_current_user_id();\n\n // trusted seller\n if ( dokan_is_seller_trusted( $user_id ) ) {\n return 'publish';\n }\n\n // if not trusted, send the option\n $status = dokan_get_option( 'product_status', 'dokan_selling', 'pending' );\n\n return $status;\n}", "public function getVisibleInCatalogStatuses()\n {\n return Mage::getSingleton('catalog/product_status')->getVisibleStatusIds();\n }", "protected function getAvailability(Mage_Catalog_Model_Product $product){\n if ($product->getData('use_config_manage_stock') == 1) {\n if (Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . 'manage_stock') == 0) {\n return 'in stock';\n }\n } else if ($product->getData('manage_stock') == 0) {\n return 'in stock';\n }\n\n if ($product->getData('is_in_stock') == 1) {\n return 'in stock';\n } else if ($product->getData('backorders') == 0) {\n return 'out of stock';\n }\n return 'available for order';\n }", "public static function allStatuses()\n {\n $statuses = ProductOrderStatus::all();\n return $statuses;\n }", "public function getItemStatus() {\r\n\t\t$status = array();\r\n\t\t\t$status[0] = array('id' => 0,\r\n\t\t\t\t\t\t\t'name' => 'Sold',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'sold'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[1] = array('id' => 1,\r\n\t\t\t\t\t\t\t'name' => 'Available',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'available'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[2] = array('id' => 2,\r\n\t\t\t\t\t\t\t'name' => 'Out on Job',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'out_on_job'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[3] = array('id' => 3,\r\n\t\t\t\t\t\t\t'name' => 'Pending Sale',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'pending_sale'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[4] = array('id' => 4,\r\n\t\t\t\t\t\t\t'name' => 'Out on Memo',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'out_on_memo'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[5] = array('id' => 5,\r\n\t\t\t\t\t\t\t'name' => 'Burgled',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'burgled'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[6] = array('id' => 6,\r\n\t\t\t\t\t\t\t'name' => 'Assembled',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'assembled'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[7] = array('id' => 7,\r\n\t\t\t\t\t\t\t'name' => 'Returned To Consignee',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'return_to_consignee'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[8] = array(\r\n\t\t\t\t\t\t\t'id' => 8,\r\n\t\t\t\t\t\t\t'name' => 'Pending Repair Queue',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'pending_repair'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[91] = array('id' => 91,\r\n\t\t\t\t\t\t\t'name' => 'Francesklein Import',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'francesklein_import'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[98] = array('id' => 98,\r\n\t\t\t\t\t\t\t'name' => 'Never Going Online',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'never_going_online'\r\n\t\t\t\t\t\t);\r\n\t\t\t$status[99] = array('id' => 99,\r\n\t\t\t\t\t\t\t'name' => 'Unavailable',\r\n\t\t\t\t\t\t\t'checked' => false,\r\n\t\t\t\t\t\t\t'field_name' => 'unavailable'\r\n\t\t\t\t\t);\r\n\t\treturn $status;\r\n\t}", "public function getSiteStatus();", "public function getProdStatuses() {\n $dql = \"SELECT i from Infrastructure i\";\n $prodStatuses = $this->em\n ->createQuery($dql)\n ->getResult();\n return $prodStatuses;\n }", "public function getEnabled()\n {\n return $this->_scopeConfig->getValue('splitprice/split_price_config/enabled', \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE);\n }", "public function getdefaultStatus()\n {\n return $this->defaultstatus;\n }", "public function isEnabled()\n {\n return Mage::getStoreConfigFlag('training_layred/catalog/enabled');\n }", "function get_status()\r\n {\r\n return $this->get_default_property(self :: PROPERTY_STATUS);\r\n }", "function getCategoryStatusById($cat_id) {\n $ci = & get_instance();\n $category = $ci->crud->get(ES_PRODUCT_CATEGORIES, array('id' => $cat_id));\n if (count($category) > 0) {\n return $category['status'];\n } else {\n return 0;\n }\n}", "function getStatus() {\n return $this->getAdditionalProperty('payment_status_selected');\n }" ]
[ "0.64557254", "0.6214199", "0.62141716", "0.6030301", "0.592042", "0.58605677", "0.584785", "0.5834163", "0.57630616", "0.5742801", "0.573849", "0.572061", "0.56780475", "0.567536", "0.5665758", "0.5662599", "0.5656784", "0.5623097", "0.56214577", "0.56202996", "0.561477", "0.5613882", "0.5567239", "0.55476063", "0.5547107", "0.5534052", "0.5529889", "0.55191976", "0.55128044", "0.5509024" ]
0.69342375
0
Instantiates a new teamworkApplicationIdentity and sets the default values.
public function __construct() { parent::__construct(); $this->setOdataType('#microsoft.graph.teamworkApplicationIdentity'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function createFromDiscriminatorValue(ParseNode $parseNode): TeamworkApplicationIdentity {\n return new TeamworkApplicationIdentity();\n }", "public function __construct()\n {\n $this->userID = 0;\n $this->programID = NULL;\n $this->typeID = NULL;\n $this->firstName = NULL;\n $this->lastName = NULL;\n $this->email = NULL;\n $this->password = NULL;\n\t\t$this->timezoneID = NULL;\n\t\t$this->timezone = NULL;\n $this->lastLogin = NULL;\n\t\t$this->active = 0;\n }", "public function __construct(array $workteam = array())\n {\n $this\n ->setWorkteam($workteam);\n }", "public function init()\n {\n if (null === $this->identityClass) {\n $this->identityClass = 'year\\user\\models\\User';\n }\n parent::init();\n }", "function __construct5($team, $username, $email, $position, $password)\n\t{\n\t\tcreateEmployee($team, $username, $position, $password, '', '', '', '', '', '', '');\n\n\t\t$this->setUsername($username);\n\t}", "public function __construct($userInfo = [])\n {\n if (empty($userInfo[self::EMPLOYEE_ID])) {\n throw new InvalidArgumentException('Employee ID cannot be empty.', 1493733219);\n }\n\n // Set all of the provided fields, taking whatever value was given.\n foreach (self::getAllFieldNames() as $fieldName) {\n if (array_key_exists($fieldName, $userInfo)) {\n $this->values[$fieldName] = $userInfo[$fieldName];\n }\n }\n\n // Ensure fields with stricter constraints have valid values.\n $this->values[self::EMPLOYEE_ID] = (string)$userInfo[self::EMPLOYEE_ID];\n $this->setLocked($userInfo[self::LOCKED] ?? null);\n $this->setRequireMfa($userInfo[self::REQUIRE_MFA] ?? null);\n }", "public function __construct(Application $wechat)\n {\n $host = explode('.', request()->getHttpHost());\n $subDomain = array_first($host);\n $this->wechatCacheKey =\n 'wechat-oauth-user:' . $subDomain . '-' . session_id();\n $this->wechat = $wechat;\n }", "public function _initialize(Tinebase_Model_Application $_application, $_options = null)\r\n {\r\n #$initialAdminUserOptions = $this->_parseInitialAdminUserOptions($_options);\r\n #Tinebase_User::getInstance()->importUsers($initialAdminUserOptions); //import users(ldap)/create initial users(sql)\r\n #Tinebase_Group::getInstance()->importGroupMembers(); //import groups members(ldap)\r\n\r\n if(Tinebase_User::getInstance() instanceof Tinebase_User_Interface_SyncAble) {\r\n // import users\r\n Tinebase_User::syncUsers(true);\r\n } else {\r\n $initialAdminUserOptions = $this->_parseInitialAdminUserOptions($_options);\r\n Tinebase_User::createInitialAccounts($initialAdminUserOptions);\r\n }\r\n parent::_initialize($_application, $_options);\r\n $this->_initializeFavorites();\r\n }", "public function setApplicationIdentityType(?TeamworkApplicationIdentityType $value): void {\n $this->getBackingStore()->set('applicationIdentityType', $value);\n }", "private function __construct() {\n\n $this->\n database = \\FluitoPHP\\Database\\Database::GetInstance();\n\n require_once( dirname(__FILE__) . DS . 'User.class.php' );\n\n $appConfig = \\FluitoPHP\\FluitoPHP::GetInstance()->\n GetConfig('AUTHENTICATION');\n\n $appConfig = $appConfig ? $appConfig : [];\n\n $moduleConfig = \\FluitoPHP\\FluitoPHP::GetInstance()->\n GetModuleConfig('AUTHENTICATION');\n\n $moduleConfig = $moduleConfig ? $moduleConfig : [];\n\n $appConfig = array_replace_recursive($appConfig, $moduleConfig);\n\n $this->\n UpdateConfig($appConfig);\n }", "public function __construct() {\n\t\tswitch (TRUE) {\n\t\t\tcase (func_num_args() == 1 && is_array(func_get_arg(0))):\n\t\t\t\t$data = func_get_arg(0);\n\n\t\t\t\t$this->application_id = intval($data['application_id']);\n\t\t\t\t$this->email = strtolower(trim($data['email']));\n\t\t\t\t$this->dep_account = intval(array_search(strtoupper($data['dep_account']), self::$dep_accounts));\n\t\t\t\t$this->income_frequency = intval(array_search(strtoupper($data['income_frequency']), self::$income_frequencies));\n\t\t\t\t$this->income_monthly_net = intval($data['income_monthly_net']);\n\t\t\t\t$this->dob = $data['dob'];\n\t\t\t\tbreak;\n\t\t\tcase (func_num_args() == 6):\n\t\t\t\tlist ($application_id, $email, $dep_account, $income_frequency, $income_monthly_net, $dob) = func_get_args();\n\t\t\n\t\t\t\t$this->application_id = intval($application_id);\n\t\t\t\t$this->email = strtolower(trim($email));\n\t\t\t\t$this->dep_account = intval(array_search(strtoupper($dep_account), self::$dep_accounts));\n\t\t\t\t$this->income_frequency = intval(array_search(strtoupper($income_frequency), self::$income_frequencies));\n\t\t\t\t$this->income_monthly_net = intval($income_monthly_net);\n\t\t\t\t$this->dob = $dob;\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// Not implemented.\n\t\t\t\tbreak;\n\t\t}\t\n\t}", "public function __construct($app_name) {\n\t\t$this->tfa = new RobThree\\Auth\\TwoFactorAuth($app_name); //, 6, 60, 'sha1'/*, $this->qr*/);\t\n\t\t$this->app_name = $app_name;\n\t}", "public function __construct() {\n $this->config = $config\t = &get_config();\n\n $this->app_id\t\t= $config['linkedin_app_id'];\n $this->app_secret\t= $config['linkedin_app_secret'];\n\n if(!$this->app_id || !$this->app_secret) {\n throw new Exception('Application ID not set', APP_ID_OR_SECRET_NOT_SET);\n }\n\n }", "function __construct($isCreationAction = false, $codeonly = false, $onetime = false)\n {\n parent::__construct();\n if (! $isCreationAction) {\n return $this;\n }\n $objRequest = Container_Request::getRequest();\n $arrSession = $objRequest->get_arrSession();\n $this->reqCreatorToMod = false;\n if (Base_GeneralFunctions::getValue($objRequest->get_arrSession(), 'intUserAuthID', false, true)) {\n unset($_SESSION['intUserAuthID']);\n }\n if (isset($arrSession['OPENID_AUTH']['url'])) {\n $this->setKey('enumAuthType', 'openid');\n $this->setKey('strAuthValue', $arrSession['OPENID_AUTH']['url']);\n unset($_SESSION['OPENID_AUTH']);\n } elseif (\n Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'username', false, true) != false\n && Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'password', false, true) != false\n ) {\n if (count(Object_Userauth::brokerByColumnSearch('strAuthValue', Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'username') . ':%')) > 0) {\n throw new Exception_AuthenticationFailed(\"This username already exists, please select another\");\n }\n $this->setKey('enumAuthType', 'basicauth');\n $this->setKey('strAuthValue', array('password' => Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'password'), 'username' => Base_GeneralFunctions::getValue($objRequest->get_arrRqstParameters(), 'username')));\n } elseif ($codeonly != false) {\n $this->setKey('enumAuthType', 'codeonly');\n $authString = '';\n while ($authString == '') {\n $authString = Base_GeneralFunctions::genRandStr(5, 9);\n if (count(Object_Userauth::brokerByColumnSearch('strAuthValue', '%:' . sha1(Container_Config::getSecureByID('salt', 'Not Yet Set!!!')->getKey('value') . $authString))) > 0) {\n $authString = '';\n }\n }\n $this->setKey('strAuthValue', array('password' => $authString, 'username' => $codeonly));\n } elseif ($onetime == true) {\n $this->setKey('enumAuthType', 'onetime');\n $authString = '';\n while ($authString == '') {\n $authString = Base_GeneralFunctions::genRandStr(8, 12);\n if (count(Object_Userauth::brokerByColumnSearch('strAuthValue', '%:' . $authString)) > 0) {\n $authString = '';\n }\n }\n $this->setKey('strAuthValue', array('password' => $authString, 'username' => 'onetime'));\n } else {\n return false;\n }\n $this->create();\n return $this;\n }", "public function Initialize()\n\t\t{\n\t\t\t$this->intId = PersonWithLock::IdDefault;\n\t\t\t$this->strFirstName = PersonWithLock::FirstNameDefault;\n\t\t\t$this->strLastName = PersonWithLock::LastNameDefault;\n\t\t\t$this->strSysTimestamp = PersonWithLock::SysTimestampDefault;\n\t\t}", "public function testCreateIdentity()\n {\n }", "protected function createDefaultUser()\n {\n $this->user = User::create(config('defaults.user'));\n\n return $this;\n }", "public function init()\n {\n $this->accessToken = 'EAAPgIZBacbTMBAJnVjjmoOW3tjZClqcJDUP3NZB5Dbi72zA2Ix8tE5qviZAE4BF3UqluxlZCLAOnlqe0WYeTXGZBTesuyGPQXb7iPZAC2qOWnX376GvrvZAiO34bcEJ7TYyPqgqV2uLZAkvHD8DkjuPZC7OEpS91ydHnNXbEPpclLSQQZDZD';\n }", "public function __construct()\n {\n $this->roles = 'ROLE_USER';\n $this->createAt = new \\DateTime();\n }", "function __construct(int $idNum, String $firstName, String $lastName, String $email, String $phoneNumber, \n int $userRole, int $active, UserCredential $userCredentials, UserInformation $userInforamtion)\n {\n $this->idNum = $idNum;\n $this->firstName = $firstName;\n $this->lastName = $lastName;\n $this->email = $email;\n $this->phoneNumber = $phoneNumber;\n $this->userRole = $userRole;\n $this->active = $active;\n $this->userCredentials = $userCredentials;\n $this->userInformation = $userInforamtion;\n }", "public function __construct()\n {\n $this->createdAt = new \\DateTime();\n $this->salt = md5(uniqid(null, true));\n $this->roles = [];\n }", "private function _setIdentity(){\n $this->_setUserData($this->getClassUser()->getIdentity());\n }", "public function __construct() {\r\n\t\t$this->user_id = null;\r\n\t\t$this->username = 'Anonymous';\r\n\t\t$this->avatar = ANONYMOUS_AVATAR;\r\n\t\t$this->date_joined = '2015-8-7';\r\n\t}", "public function __construct($app = null)\n {\n $app = $app ?: app();\n\n $em = $app['Doctrine\\ORM\\EntityManager'];\n\n parent::__construct($em, new \\Doctrine\\ORM\\Mapping\\ClassMetadata('User'));\n }", "private static function init_microsoft() {\n // Microsoft is a custom setup.\n $record = (object) [\n 'name' => 'Microsoft',\n 'image' => 'https://www.microsoft.com/favicon.ico',\n 'baseurl' => '',\n 'loginscopes' => 'openid profile email user.read',\n 'loginscopesoffline' => 'openid profile email user.read offline_access',\n 'showonloginpage' => true\n ];\n\n $issuer = new issuer(0, $record);\n return $issuer;\n }", "public function __construct()\n {\n $this->rememberIdentifier = bin2hex(random_bytes(32));\n $this->enabled = '0';\n $this->confirmationToken = bin2hex(random_bytes(32));\n }", "public function setApplicationTemplateId($val)\n {\n $this->_propDict[\"applicationTemplateId\"] = $val;\n return $this;\n }", "public function __construct()\n {\n $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);\n $this->enabled = false;\n $this->locked = false;\n $this->expired = false;\n $this->roles = new ArrayCollection();\n $this->credentialsExpired = false;\n $this->confirmationToken = base64_encode(utf8_encode(openssl_random_pseudo_bytes(10)));\n $this->createdAt = new \\DateTime();\n }", "public function __construct()\n {\n parent::__construct();\n $this->client_id = Tool::config('client_id');\n $this->client_secret = Tool::config('client_secret');\n $this->redirect_uri = Tool::config('redirect_uri');\n $this->authorize_url = Tool::config('app_type', 'com') === 'com'\n ? Constants::AUTHORITY_URL.Constants::AUTHORIZE_ENDPOINT\n : Constants::AUTHORITY_URL_21V.Constants::AUTHORIZE_ENDPOINT_21V;\n $this->access_token_url = Tool::config('app_type', 'com') === 'com'\n ? Constants::AUTHORITY_URL.Constants::TOKEN_ENDPOINT\n : Constants::AUTHORITY_URL_21V.Constants::TOKEN_ENDPOINT_21V;\n $this->scopes = Constants::SCOPES;\n }", "function __construct($requireSignIn = false) {\n\n\t}" ]
[ "0.6750662", "0.510589", "0.5028109", "0.5024034", "0.49640036", "0.49209484", "0.4916008", "0.49033433", "0.48542187", "0.4847906", "0.484605", "0.48248124", "0.48190382", "0.480061", "0.48004574", "0.47996485", "0.47817674", "0.4754837", "0.47523707", "0.47188997", "0.47038215", "0.46849364", "0.46654627", "0.46621573", "0.46516272", "0.46496147", "0.46285397", "0.46280542", "0.462527", "0.45927674" ]
0.6724186
1
Sets the applicationIdentityType property value. Type of application that is referenced. Possible values are: aadApplication, bot, tenantBot, office365Connector, and outgoingWebhook.
public function setApplicationIdentityType(?TeamworkApplicationIdentityType $value): void { $this->getBackingStore()->set('applicationIdentityType', $value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setApplicationType($applicationType)\n {\n $this->applicationType = $applicationType;\n return $this;\n }", "public function getApplicationType()\n {\n return $this->applicationType;\n }", "public function setAuthenticationType( $type ) {\n\t\t$this->_mAuthenticationType = $type;\n\t}", "public function setUserType($type)\n\t{\n\t\t$this->type = $type;\n\t}", "public function setInputType($value)\n {\n $this->_config->set('inputType', $value);\n }", "public function getApplicationIdentityType(): ?TeamworkApplicationIdentityType {\n $val = $this->getBackingStore()->get('applicationIdentityType');\n if (is_null($val) || $val instanceof TeamworkApplicationIdentityType) {\n return $val;\n }\n throw new \\UnexpectedValueException(\"Invalid type found in backing store for 'applicationIdentityType'\");\n }", "public function setType($associationType)\n {\n $this->type = $associationType;\n }", "public function setTypeID($value) {\n\t\t$this->_type_id = $value;\n\t}", "public function updateApplicationType (AccreditationApplication $accreditationApplication, $accreditationApplicationTypeId, Store $store)\r\n {\r\n $accreditationReference = $this->em->getReference('YilinkerCoreBundle:AccreditationLevel', $accreditationApplicationTypeId);\r\n\r\n if(!is_null($accreditationReference)){\r\n $store->setIsEditable(false);\r\n }\r\n\r\n $store->setAccreditationLevel($accreditationReference);\r\n $accreditationApplication->setAccreditationLevel($accreditationReference);\r\n\r\n $this->qrCodeGenerator->generateStoreQrCode($store, $store->getStoreSlug());\r\n\r\n if(!is_null($accreditationReference)){\r\n $this->elasticaObjectPersister->insertOne($store);\r\n }\r\n\r\n $this->em->flush();\r\n\r\n return $accreditationApplication;\r\n }", "public function setConfigurationAccountType(?SecureAssessmentAccountType $value): void {\n $this->getBackingStore()->set('configurationAccountType', $value);\n }", "public function getAppType();", "public function setType(?PhoneType $value): void {\n $this->getBackingStore()->set('type', $value);\n }", "private function _setApplicationTypeByDevice()\n {\n $_device = $this->_getObjectMobile_detector();\n\n if($_device->isTablet()){\n $this->_deviceType = DEVICE_TYPE_TABLET;\n }elseif($_device->isMobile()){\n $this->_deviceType = DEVICE_TYPE_MOBILE;\n }else{\n $this->_deviceType = DEVICE_TYPE_DESKTOP;\n }\n }", "public function setType($type)\r\n {\r\n $this->type = $type;\r\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type) {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "public function setType($type)\n {\n $this->type = $type;\n }", "function setType($a_type)\n\t{\n\t\t$this->il_type = $a_type;\n\t}", "public function getTypeAttribute()\n {\n if($this->personal_access_client) {\n return OAuthClientType::PERSONAL();\n }\n\n if($this->password_client) {\n return OAuthClientType::PASSWORD();\n }\n\n if($this->redirect === '') {\n return OAuthClientType::CREDENTIALS();\n }\n\n return OAuthClientType::AUTH_CODE();\n }" ]
[ "0.5839746", "0.5718836", "0.52354974", "0.5139693", "0.49972066", "0.497583", "0.4926904", "0.48223728", "0.48081604", "0.4768287", "0.4765876", "0.47505423", "0.4746091", "0.4719808", "0.47184858", "0.47184858", "0.4696542", "0.4696542", "0.4696542", "0.46875224", "0.46875224", "0.46875224", "0.46875224", "0.46875224", "0.46875224", "0.46875224", "0.46875224", "0.46875224", "0.46837732", "0.46775904" ]
0.7571305
0
Page Edit Meta Boxes Show or Hide Sidebar Meta Box
function add_page_show_sidebar_metaboxes() { add_meta_box('page_show_sidebar_meta_values', 'Page Sidebar', 'page_show_sidebar_meta_values', 'page', 'side', 'default'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GTPress_hide_pagemeta() {\r\n\tif ($options['hide_pagemeta'] == \"true\") {\r\n\t\tremove_meta_box( 'commentstatusdiv' , 'page' , 'normal' ); // allow comments for pages\r\n\t\tremove_meta_box( 'commentsdiv' , 'page' , 'normal' ); // recent comments for pages\r\n\t\tremove_meta_box( 'postcustom' , 'page' , 'normal' ); // custom fields for pages\r\n\t\tremove_meta_box( 'trackbacksdiv' , 'page' , 'normal' ); // page trackbacks\r\n\t\tremove_meta_box( 'postexcerpt' , 'page' , 'normal' ); // page excerpts\r\n\t\tremove_meta_box( 'tagsdiv-post_tag' , 'page' , 'side' ); // page tags\r\n\t\tremove_meta_box( 'pageparentdiv','page','side'); // Page Parent\r\n\t\tremove_meta_box( 'slugdiv','page','normal'); // page slug\r\n\t}\r\n}", "public function hideMetaBoxes()\n {\n remove_meta_box( 'pageparentdiv', 'playscripts', 'side' );\n // for some odd reason this doesn't always work. Very annoying.\n remove_meta_box( 'postimagediv', 'playscripts', 'side' );\n }", "public function add_admin_meta_boxes() {\n\n\t\t$id = 'hide_backend_options';\n\t\t$title = __( 'Hide Login Area', 'it-l10n-ithemes-security-pro' );\n\n\t\tadd_meta_box(\n\t\t\t$id,\n\t\t\t$title,\n\t\t\tarray( $this, 'metabox_hide_backend_settings' ),\n\t\t\t'security_page_toplevel_page_itsec_settings',\n\t\t\t'advanced',\n\t\t\t'core'\n\t\t);\n\n\t\t$this->core->add_toc_item(\n\t\t\tarray(\n\t\t\t\t'id' => $id,\n\t\t\t\t'title' => $title,\n\t\t\t)\n\t\t);\n\t}", "function GTPress_hide_postmeta() {\r\n\tif ($options['hide_postmeta'] == \"true\") {\r\n\t\tremove_meta_box( 'commentstatusdiv' , 'post' , 'normal' ); // allow comments for posts\r\n\t\tremove_meta_box( 'commentsdiv' , 'post' , 'normal' ); // recent comments for posts\r\n\t\tremove_meta_box( 'postcustom' , 'post' , 'normal' ); // custom fields for posts\r\n\t\tremove_meta_box( 'trackbacksdiv' , 'post' , 'normal' ); // post trackbacks\r\n\t\tremove_meta_box( 'postexcerpt' , 'post' , 'normal' ); // post excerpts\r\n\t\tremove_meta_box( 'tagsdiv-post_tag' , 'post' , 'side' ); // post tags\r\n\t\tremove_meta_box( 'slugdiv','post','normal'); // post slug\r\n\t}\r\n}", "function axiom_init_pagebuilder_meta_box(){\n // add custom sidebar metabox to following types\n $types = array('page', 'axi_product', 'portfolio', 'service', 'staff');\n \n foreach ($types as $key => $value) {\n add_meta_box(\"axiom_pagebuilder_metabox\", \n __(\"Smart Page Builder\", 'default'), \n \"axiom_display_pagebuilder_meta\", \n $value, \n \"normal\", \n \"high\");\n }\n \n // Save custom sidebar meta\n add_action('save_post', 'axiom_save_pagebuilder_data');\n \n}", "public function render_metabox_hide_fields_for_page($post){\n\n\t\twp_nonce_field('post_metabox_hide_fields_for_page', 'post_metabox_hide_fields_for_page_nonce');\n\n\t\t$value = get_post_meta( $post->ID, self::$checkbox_post_box_author , true );\n\t\t$value = intval($value);\n\t\techo '<div><input type=\"checkbox\" name=\"'.self::$checkbox_post_box_author.'\" value=\"1\" '.checked( $value, 1, false).'>&nbsp;';\n\t \techo '<label for='.self::$checkbox_post_box_author.'\">'.__('Hide about author', THEME_NAME).'</label></div>';\n\n\t \t$value = get_post_meta( $post->ID, self::$checkbox_post_meta_date , true );\n\t\t$value = intval($value);\n\t\techo '<div><input type=\"checkbox\" name=\"'.self::$checkbox_post_meta_date.'\" value=\"1\" '.checked( $value, 1, false).'>&nbsp;';\n\t \techo '<label for='.self::$checkbox_post_meta_date.'\">'.__('Hide published date', THEME_NAME).'</label></div>';\n\n\t \t$value = get_post_meta( $post->ID, self::$checkbox_post_meta_author , true );\n\t\t$value = intval($value);\n\t\techo '<div><input type=\"checkbox\" name=\"'.self::$checkbox_post_meta_author.'\" value=\"1\" '.checked( $value, 1, false).'>&nbsp;';\n\t \techo '<label for='.self::$checkbox_post_meta_author.'\">'.__('Hide meta author', THEME_NAME).'</label></div>';\n\n\t\t$value = get_post_meta( $post->ID, self::$checkbox_post_comments , true );\n\t\t$value = intval($value);\n\t\techo '<div><input type=\"checkbox\" name=\"'.self::$checkbox_post_comments.'\" value=\"1\" '.checked( $value, 1, false).'>&nbsp;';\n\t \techo '<label for=\"'.self::$checkbox_post_comments.'\">'.__('Hide comments', THEME_NAME).'</label></div>';\n\t}", "function rs_meta_box()\n{\n add_meta_box('rs_focus', 'Destaque na home', 'rs_focus', 'post', 'side');\n add_meta_box('rs_author', 'Autor', 'rs_author', 'post', 'side');\n add_meta_box('rs_author', 'Autor', 'rs_author', 'post_region', 'side');\n add_meta_box('rs_author', 'Autor', 'rs_author', 'event', 'side');\n}", "function create_sitewide_metabox() {\n\t\t$post_types = apply_filters( 'be_title_toggle_post_types', array( 'page' ) );\n\t\tforeach ( $post_types as $post_type )\n\t\t\techo '<p><input type=\"checkbox\" name=\"' . GENESIS_SETTINGS_FIELD . '[be_title_toggle_' . $post_type . ']\" id=\"' . GENESIS_SETTINGS_FIELD . '[be_title_toggle_' . $post_type . ']\" value=\"1\" ' . checked( genesis_get_option( 'be_title_toggle_' . $post_type ), false ) .' /> <label for=\"' . GENESIS_SETTINGS_FIELD . '[be_title_toggle_' . $post_type . ']\"> ' . sprintf( __( 'By default, remove titles in the <strong>%s</strong> post type.', 'genesis-title-toggle' ), $post_type ) .'</label></p>';\n\n\t\n\t}", "function page_setup_metabox_content( $post ){\n\twp_nonce_field( 'mptheme_layout_save_meta_box', 'mptheme_page_setup_meta_box_nonce' );\n\n\t/*\n\t * Use get_post_meta() to retrieve an existing value\n\t * from the database and use the value for the form.\n\t */\n\t$mptheme_page_setup_show_heading = get_post_meta( $post->ID, 'mptheme_page_setup_show_heading', true );\n\n\tif(!$mptheme_page_setup_show_heading){\n\t\t$mptheme_page_setup_show_heading = 'true';\n\t}\n\t?>\n\t\t<p class=\"post-attributes-label-wrapper\">\n\t\t\t<label class=\"post-attributes-label\"> <?php _e( 'Show page heading', 'mptheme' ); ?> </label>\n\t\t</p>\n\t\t<select name=\"mptheme_page_setup_show_heading\">\n\t\t\t<option value=\"true\" <?php echo selected( $mptheme_page_setup_show_heading, 'true', false); ?>> <?php _e( 'Enable', 'mptheme' ); ?></option>\n\t\t\t<option value=\"false\" <?php echo selected( $mptheme_page_setup_show_heading, 'false', false); ?>> <?php _e( 'Disable', 'mptheme' ); ?></option>;\n\t\t</select>\n\n\t<?php\n\t// if Revolution Slider is available uset can select an slider for the page\n\tif(class_exists('RevSliderAdmin')) {\n\t\tglobal $wpdb;\n\n\t\t$rs = $wpdb->get_results( \n\t\t\t\"\n\t\t\tSELECT id, title, alias\n\t\t\tFROM \".$wpdb->prefix.\"revslider_sliders\n\t\t\tORDER BY id ASC LIMIT 100\n\t\t\t\"\n\t\t);\n\t\t$revsliders = array(array(\n\t\t\t'value' => 'no_slider',\n\t\t\t'label' => 'No Slider'\n\t\t));\n\t\tif ($rs) {\n\t\t\t$_ri = 1;\n\t\t\tforeach ( $rs as $slider ) {\n\t\t\t\t$revsliders[$_ri]['value'] = $slider->alias;\n\t\t\t\t$revsliders[$_ri]['label'] = $slider->title;\n\t\t\t\t$_ri++;\n\t\t\t}\n\t\t} else {\n\t\t\t$revsliders[\"No sliders found\"] = 0;\n\t\t}\n\n\t\tif(count($revsliders)>0 ){\n\t\t\t// Get the saved slider\n\t\t\t$mptheme_page_setup_revslider = get_post_meta( $post->ID, 'mptheme_page_setup_revslider', true );\n\n\t\t\tif(!$mptheme_page_setup_revslider){\n\t\t\t\t$mptheme_page_setup_revslider = 'no_slider';\n\t\t\t}\n\n\t\t?>\n\n\t\t\t<p class=\"post-attributes-label-wrapper\">\n\t\t\t\t<label class=\"post-attributes-label\"> <?php _e( 'Show hero Revolution Slider insted of heading?', 'mptheme' ); ?> </label>\n\t\t\t</p>\n\t\t\t<select name=\"mptheme_page_setup_revslider\">\n\t\t\t\t<?php for ($i=0; $i < count($revsliders); $i++) { ?>\n\t\t\t\t\t<option value=\"<?php echo $revsliders[$i][\"value\"] ?>\" <?php echo selected( $mptheme_page_setup_revslider, $revsliders[$i][\"value\"], false); ?>><?php echo $revsliders[$i][\"label\"] ?></option>\n\t\t\t\t<?php } ?>\n\t\t\t</select>\n\n\t\t<?php }\n\t}\n\t?>\n\n\t<?php\n}", "function ssep_hide_meta_field( $fields ) {\n\n\t$fields[] = array(\n\t\t'id' => '_ss_hide_meta',\n\t\t'name' => __( 'Hide Meta' ),\n\t\t'type' => 'checkbox',\n\t\t'desc' => __( 'Hide meta info for this post.', 'shoestrap' )\n\t);\n\n\treturn $fields;\n}", "public function display_meta_box() {\n\t\t\n\t\tinclude_once( 'views/q-and-a-admin.php' );\n }", "function flowthemes_seo_meta_boxes(){\n\t\twp_nonce_field(basename(__FILE__), 'flow_seo_noncename');\n\t\t\n\t\t$opt_name = 'flow_seo_title';\n\t\t$opt_name2 = 'flow_seo_description';\n\t\t$opt_name3 = 'flow_post_header_code';\t\n\t\t\n\t\t$post_ID = get_the_ID();\n\t\t$opt_val = get_post_meta($post_ID, $opt_name, true);\n\t\t$opt_val2 = get_post_meta($post_ID, $opt_name2, true);\n\t\t$opt_val3 = get_post_meta($post_ID, $opt_name3, true);\n\n\t?>\n\t\t<table class=\"form-table flow_seo_meta_box\">\n\t\t\t<tr>\n\t\t\t\t<th style=\"width:20%;\">\n\t\t\t\t\t<label for=\"\"><?php _e('Snippet Preview', 'flowthemes'); ?></label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<div id=\"flow_seo_snippet\">\n\t\t\t\t\t\t<a class=\"default_title\" href=\"javascript:void(null);\"><?php the_title(); ?> - <?php bloginfo('name'); ?></a>\n\t\t\t\t\t\t<a class=\"title\" href=\"javascript:void(null);\"><?php the_title(); ?></a>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<cite href=\"javascript:void(null);\" class=\"url\">\n\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t$domain = parse_url(get_permalink());\n\t\t\t\t\t\t\t\tif(!empty($domain[\"host\"])){ echo $domain[\"host\"]; }\n\t\t\t\t\t\t\t\tif(!empty($domain[\"path\"])){ echo $domain[\"path\"]; }\n\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t</cite>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<p class=\"desc\">\n\t\t\t\t\t\t\t<span class=\"content\"><?php echo get_the_excerpt(); ?></span>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t<tr>\n\t\t\t\t<th style=\"width:20%;\">\n\t\t\t\t\t<label for=\"<?php echo $opt_name; ?>\">SEO Title</label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"<?php echo $opt_name; ?>\" id=\"<?php echo $opt_name; ?>\" value=\"<?php echo $opt_val; ?>\" size=\"30\" tabindex=\"30\" style=\"width: 97%;\" />\n\t\t\t\t\t<p>\n\t\t\t\t\t\tIf you leave this empty it's going to display standard title. Limited to max. 70 characters in most of the search engines. Number of characters: <span id=\"flow_seo_title-count\"></span>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<th style=\"width:20%;\">\n\t\t\t\t\t<label for=\"<?php echo $opt_name2; ?>\">SEO Description</label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea name=\"<?php echo $opt_name2; ?>\" id=\"<?php echo $opt_name2; ?>\" cols=\"60\" rows=\"4\" tabindex=\"30\" style=\"width: 97%;\"><?php echo $opt_val2; ?></textarea>\n\t\t\t\t\t<p>Limited to 156 characters in most of the search engines. Number of characters: <span id=\"flow_seo_description-count\"></span></p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<th style=\"width:20%;\">\n\t\t\t\t\t<label for=\"flow_seo_focuskw\">Test Keyword(s)</label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"flow_seo_focuskw\" id=\"flow_seo_focuskw\" value=\"\" size=\"30\" tabindex=\"30\" style=\"width: 97%;\" />\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThis field is used only as testing tool. Put here keywords that you expect that user will look for to check how well this post is using them. Please test one keyword at a time. Phrases should be tested as separate keywords (because that's the way search engine works).\n\t\t\t\t\t\t<span id=\"focuskwresults\"></span>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<th style=\"width:20%;\">\n\t\t\t\t\t<label for=\"<?php echo $opt_name3; ?>\">Custom Code</label>\n\t\t\t\t</th>\n\t\t\t\t<td>\n\t\t\t\t\t<textarea name=\"<?php echo $opt_name3; ?>\" id=\"<?php echo $opt_name3; ?>\" cols=\"60\" rows=\"4\" tabindex=\"30\" style=\"width: 97%;\"><?php echo $opt_val3; ?></textarea>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tA code that will be placed in <code>&lt;head&gt;</code> section of your website in place of <code>wp_head();</code> function (located in header.php). What you may want to put here is probably Facebook title, description and image that it should use:\n<pre><code>&lt;meta property=\"og:title\" content=\"The Daisho Project\" /&gt;\n&lt;meta property=\"og:type\" content=\"video.movie\" /&gt;\n&lt;meta property=\"og:url\" content=\"http://example.com/link-to-portfolio-project-with-movie/\" /&gt;\n&lt;meta property=\"og:image\" content=\"http://example.com/images/facebook-should-grab-this-image-as-thumbnail.jpg\" /&gt;</code></pre>\n\t\t\t\t\t\tMore: <a href=\"http://ogp.me/\" target=\"_blank\">The Open Graph protocol</a>\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t...or you can put here completely different code including <code>&lt;style&gt;</code> and <code>&lt;script&gt;</code> tags! There are lots of possibilities: <a href=\"http://en.wikipedia.org/wiki/Meta_element\" target=\"_blank\">Meta Element</a>.\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t<?php }", "function wpdocs_register_meta_boxes() {\r\n\r\n\tif ( isset($_GET['action']) && $_GET['action'] === 'edit' )\r\n\t{\r\n\t\tadd_meta_box( 'acoes-acesso', __( 'Ações', 'textdomain' ), 'petty_render_box_acao_metabox', 'acesso_camera','side','high' );\r\n\t}\r\n \r\n}", "function thmplt_carousel_slide_meta(){\r\n\tadd_meta_box(\"thmplt_carousel_meta_box1\", \"Slide Settings\", \"thmplt_carousel_slide_settings_html\", \"thmplt_carousel\", \"normal\", \"high\");\r\n\tadd_meta_box(\"thmplt_carousel_meta_box2\", \"Slide Images\", \"thmplt_carousel_slide_settings_html2\", \"thmplt_carousel\", \"normal\", \"high\");\r\n}", "function master_setup_sidebar_metaboxes() {\t\n\tglobal $wp_meta_boxes;\n\t\n\tmaster_sidebar_post_type_meta_boxes(); \t\t\t// Output Posttype Metaboxes\n\tmaster_sidebar_category_posts_metabox(); \t\t// Output Category Posts Metabox\n\tmaster_sidebar_taxonomy_meta_boxes(); \t\t\t// Output Taxonomy Metaboxes\n\tmaster_sidebar_author_meta_box(); \t\t\t// Output Author Archive Metabox\n\tmaster_sidebar_template_hierarchy_meta_box();\t// Output Custom Template Hierarchy Metabox \n}", "function thd_re_info_show_box() {\n\tthd_meta_box_callback(thd_re_meta_box_fields(), 'page');\n}", "public static function display_meta_box($post) {\r\n\t\t\t$force_hide = get_post_meta($post->ID, self::FORCE_HIDE_KEY, true);\r\n\t\t\t$moderation_url = self::_get_moderation_url($post->ID);\r\n\t\t\t$results_url = self::_get_results_url($post->ID);\r\n\r\n\t\t\tinclude('views/backend/meta-boxes/meta-box.php');\r\n\t\t}", "function block_editor_meta_box_hidden_fields()\n {\n }", "function blokco_register_meta_box() {\n if (!class_exists('RW_Meta_Box'))\n return;\n $prefix = 'blokco_';\n $meta_box = array(\n 'id' => 'template-sidebar1',\n 'title' => esc_html__(\"Select Sidebar\", 'blokco'),\n 'pages' => array('post', 'page', 'imi_projects', 'imi_team', 'imi_services','eventer'),\n 'context' => 'normal',\n 'fields' => array(\n array(\n 'name' => esc_html__('Select Sidebar from list','blokco'),\n 'id' => $prefix . 'select_sidebar_from_list',\n 'desc' => esc_html__(\"Select Sidebar from list, if using page builder then please add sidebar from element only.\", 'blokco'),\n 'type' => 'select',\n 'options' => blokco_get_all_sidebars(),\n ),\n array(\n 'name' => esc_html__('Show no sidebar','blokco'),\n 'id' => $prefix . 'strict_no_sidebar',\n 'desc' => esc_html__(\"This will dishonour page sidebar chosen at Theme Options as well.\", 'blokco'),\n 'type' => 'checkbox',\n\t\t\t\t\t'default' => 0\n ),\n array(\n 'name' => esc_html__('Select Sidebar Position','blokco'),\n 'id' => $prefix . 'select_sidebar_position',\n 'desc' => esc_html__(\"Select Sidebar Postion\", 'blokco'),\n 'type' => 'radio',\n 'options' => array(\n\t\t\t\t\t\t'2' => esc_html__('Left','blokco'),\n\t\t\t\t\t\t'1' => esc_html__('Right','blokco')\n\t\t\t\t\t),\n\t\t\t\t\t'default' => '1'\n ),\n\t\t\t\tarray(\n\t\t\t\t\t'name' => esc_html__('Sidebar Width', 'blokco'),\n\t\t\t\t\t'id' => $prefix . 'sidebar_columns_layout',\n\t\t\t\t\t'desc' => esc_html__(\"Select width of the page sidebar\", 'blokco'),\n\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t'4' => esc_html__('One Third','blokco'),\n\t\t\t\t\t\t'3' => esc_html__('One Fourth', 'blokco'),\n\t\t\t\t\t\t'6' => esc_html__('Half','blokco'),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t'default' => '4',\n\t\t\t),\n )\n );\n new RW_Meta_Box($meta_box);\n }", "function c_content_admin() {\n $form = array();\n\n $form['c_content_metatags'] = array(\n '#type' => 'fieldset',\n '#title' => t('Meta tags'),\n '#tree' => TRUE,\n );\n\n // Get fields available for meta tags embedding.\n $fields = array();\n foreach (field_info_field_map() as $key => $field) {\n // Only allow text and taxonomy_term_reference fields for now that are available on nodes.\n if (isset($field['bundles']['node']) && ($field['type'] === 'text' || $field['type'] === 'taxonomy_term_reference')) {\n $fields[$key] = $key . ' <em>(' . t('Used in types: @bundles', array('@bundles' => implode(', ', $field['bundles']['node']))) . ')</em>';\n }\n }\n\n $default_value = variable_get('c_content_metatags');\n $form['c_content_metatags']['fields'] = array(\n '#type' => 'checkboxes',\n '#options' => $fields,\n '#title' => t('Which node fields should be added as meta tag to the HTML?'),\n '#default_value' => $default_value['fields'],\n );\n\n return system_settings_form($form);\n}", "function vw_hospital_cs_custom_meta() {\n add_meta_box( 'cs_meta', __( 'Settings', 'vw-hospital' ), 'vw_hospital_cs_meta_callback' , 'doctors','normal', 'high' ); \n\n}", "function swank_home_genesis_meta() {\r\n\r\n\tif ( is_active_sidebar( 'home-slider' ) || is_active_sidebar ( 'under-home-slider' ) || is_active_sidebar( 'featured-circles' ) || is_active_sidebar( 'home-featured-area' )) \r\n\r\n\t\t//* Force full width content layout\r\n\t\tadd_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );\r\n\r\n\t\t//* Remove breadcrumbs\r\n\t\tremove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs');\r\n\r\n\t\t//* Remove the default Genesis loop\r\n\t\tremove_action( 'genesis_loop', 'genesis_do_loop' );\r\n\r\n\t\t//* Add homepage widgets\r\n\t\tadd_action( 'genesis_loop', 'swank_homepage_widgets' );\r\n\r\n\t}", "function on_show_page() { \n global $screen_layout_columns;\n $data = array();\n ?>\n <div id=\"slideshow-settings-metaboxes\" class=\"wrap\">\n <?php screen_icon('options-general'); ?>\n <form action=\"admin-post.php\" method=\"post\">\n <?php wp_nonce_field('slideshow-settings-metaboxes'); ?>\n <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>\n <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>\n <input type=\"hidden\" name=\"action\" value=\"save_slideshow_settings\" />\n <div id=\"poststuff\" class=\"metabox-holder has-right-sidebar\">\n <div id=\"side-info-column\" class=\"inner-sidebar\">\n <!-- Update -->\n <div class=\"postbox\">\n <div class=\"inside\">\n <input type=\"hidden\" name=\"HTTP_REFERER\" value=\"<?php echo $_SERVER['HTTP_REFERER'] ?>\" />\n <input type=\"hidden\" name=\"theme_options_nonce\" value=\"<?php echo wp_create_nonce( 'input' ); ?>\" />\n <input type=\"submit\" class=\"button button-primary button-large\" value=\"Save Slider\" />\n </div>\n </div>\n <?php do_meta_boxes($this->pagehook, 'side', $data); ?>\n </div>\n <div id=\"post-body\" class=\"has-sidebar\">\n <div id=\"post-body-content\" class=\"has-sidebar-content\">\n <?php do_meta_boxes($this->pagehook, 'normal', $data); ?>\n <?php do_meta_boxes($this->pagehook, 'additional', $data); ?>\n </div>\n </div>\n <br class=\"clear\"/>\n </div>\n </form>\n </div>\n <script type=\"text/javascript\">\n //<![CDATA[\n jQuery(document).ready(function($) {\n // close postboxes that should be closed\n jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');\n postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');\n });\n //]]>\n </script>\n <?php\n }", "function ssep_force_hide_meta() {\n\tglobal $post, $ss_blog;\n\n\t$hide_meta = ssep_hide_meta( $post->ID );\n\n\tif ( $hide_meta ) {\n\t\tremove_action( 'shoestrap_entry_meta', array( $ss_blog, 'meta_custom_render' ) );\n\t\tadd_filter( 'shoestrap_the_tags', '__return_null' );\n\t\tadd_filter( 'shoestrap_the_cats', '__return_null' );\n\t}\n}", "public static function security_meta_box($post = FALSE)\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;\n\t\t\t\t\t\tdo_action(\"ws_plugin__s2member_before_security_meta_box\", get_defined_vars());\n\t\t\t\t\t\tunset($__refs, $__v);\n\n\t\t\t\t\t\tif(is_object($post) && ($post_id = $post->ID) && (($post->post_type === \"page\" && current_user_can(\"edit_page\", $post_id)) || current_user_can(\"edit_post\", $post_id)))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif /* OK. So we're dealing with a Page classification. */($post->post_type === \"page\" && ($page_id = $post_id))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(!in_array($page_id, array_merge(array($GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"membership_options_page\"], $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"login_welcome_page\"], $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"file_download_limit_exceeded_page\"]), preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"specific_ids\"]))))\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\techo '<input type=\"hidden\" name=\"ws_plugin__s2member_security_meta_box_save\" id=\"ws-plugin--s2member-security-meta-box-save\" value=\"'.esc_attr(wp_create_nonce(\"ws-plugin--s2member-security-meta-box-save\")).'\" />'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<input type=\"hidden\" name=\"ws_plugin__s2member_security_meta_box_save_id\" id=\"ws-plugin--s2member-security-meta-box-save-id\" value=\"'.esc_attr($page_id).'\" />'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\tfor($n = 0; $n <= $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]; $n++)\n\t\t\t\t\t\t\t\t\t\t\t\t\t$pages[$n] = array_unique(preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"level\".$n.\"_pages\"]));\n\n\t\t\t\t\t\t\t\t\t\t\t\tfor($n = 0; $n <= $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]; $n++)\n\t\t\t\t\t\t\t\t\t\t\t\t\t$posts[$n] = array_unique(preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"level\".$n.\"_posts\"]));\n\n\t\t\t\t\t\t\t\t\t\t\t\techo '<p style=\"margin-left:2px;\"><strong>Page Level Restriction?</strong></p>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<label class=\"screen-reader-text\" for=\"ws-plugin--s2member-security-meta-box-level\">Add Level Restriction?</label>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<select name=\"ws_plugin__s2member_security_meta_box_level\" id=\"ws-plugin--s2member-security-meta-box-level\" style=\"width:99%;\">'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo /* By default, we allow public access to any Post/Page. */'<option value=\"\"></option>'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\tfor($n = 0; $n <= $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]; $n++)\n\t\t\t\t\t\t\t\t\t\t\t\t\techo ($pages[$n] !== array(\"all\")) ? // Protecting `all` Pages, of any kind?\n\t\t\t\t\t\t\t\t\t\t\t\t\t((!in_array(\"all-page\", $posts[$n]) && !in_array(\"all-pages\", $posts[$n])) // Protecting Posts of type: `page`?\n\t\t\t\t\t\t\t\t\t\t\t\t\t? '<option value=\"'.$n.'\"'.((in_array($page_id, $pages[$n])) ? ' selected=\"selected\"' : '').'>'.(($n === $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]) ? 'Require Highest Level #'.$n : 'Require Level #'.$n.' (or higher)').'</option>'.\"\\n\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '<option value=\"\" disabled=\"disabled\">Level #'.$n.' (already protects \"all\" Posts of this type)</option>'.\"\\n\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '<option value=\"\" disabled=\"disabled\">Level #'.$n.' (already protects \"all\" Pages)</option>'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\techo '</select><br /><small>* see: <strong>Restriction Options → Pages</strong></small>'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\tif(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())\n\t\t\t\t\t\t\t\t\t\t\t\t\t// ^ Will change once Custom Capabilities are compatible with a Blog Farm.\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<p style=\"margin-top:15px; margin-left:2px;\"><strong>Require Custom Capabilities?</strong></p>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<label class=\"screen-reader-text\" for=\"ws-plugin--s2member-security-meta-box-ccaps\">Custom Capabilities?</label>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<input type=\"text\" autocomplete=\"off\" name=\"ws_plugin__s2member_security_meta_box_ccaps\" id=\"ws-plugin--s2member-security-meta-box-ccaps\" value=\"'.format_to_edit(trim(implode(\",\", (array)get_post_meta($page_id, \"s2member_ccaps_req\", true)))).'\" onkeyup=\"if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \\-]/g, \\'_\\').replace (/[^a-z_0-9,]/gi, \\'\\').toLowerCase ());\" style=\"width:99%;\" />'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<br /><small>* see: <strong>API Scripting → Custom Capabilities</strong></small>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\telse if($page_id == $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"membership_options_page\"])\n\t\t\t\t\t\t\t\t\t\t\techo 'This Page is your:<br /><strong>Membership Options Page</strong><br />(always publicly available)';\n\n\t\t\t\t\t\t\t\t\t\telse if($page_id == $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"login_welcome_page\"])\n\t\t\t\t\t\t\t\t\t\t\techo 'This Page is your:<br /><strong>Login Welcome Page</strong><br />(automatically guarded by s2Member)';\n\n\t\t\t\t\t\t\t\t\t\telse if($page_id == $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"file_download_limit_exceeded_page\"])\n\t\t\t\t\t\t\t\t\t\t\techo 'This Page is your:<br /><strong>Download Limit Exceeded Page</strong><br />(automatically guarded by s2Member)';\n\n\t\t\t\t\t\t\t\t\t\telse if(in_array($page_id, preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"specific_ids\"])))\n\t\t\t\t\t\t\t\t\t\t\techo 'This Page is a:<br /><strong>Specific Post/Page for sale</strong><br />(already guarded by s2Member)';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse // Otherwise, we assume this is a Post, or possibly a Custom Post Type. It's NOT a Page.\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(!in_array($post_id, preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"specific_ids\"])))\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\techo '<input type=\"hidden\" name=\"ws_plugin__s2member_security_meta_box_save\" id=\"ws-plugin--s2member-security-meta-box-save\" value=\"'.esc_attr(wp_create_nonce(\"ws-plugin--s2member-security-meta-box-save\")).'\" />'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<input type=\"hidden\" name=\"ws_plugin__s2member_security_meta_box_save_id\" id=\"ws-plugin--s2member-security-meta-box-save-id\" value=\"'.esc_attr($post_id).'\" />'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\tfor($n = 0; $n <= $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]; $n++)\n\t\t\t\t\t\t\t\t\t\t\t\t\t$posts[$n] = array_unique(preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"level\".$n.\"_posts\"]));\n\n\t\t\t\t\t\t\t\t\t\t\t\techo '<p style=\"margin-left:2px;\"><strong>Post Level Restriction?</strong></p>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<label class=\"screen-reader-text\" for=\"ws-plugin--s2member-security-meta-box-level\">Add Level Restriction?</label>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<select name=\"ws_plugin__s2member_security_meta_box_level\" id=\"ws-plugin--s2member-security-meta-box-level\" style=\"width:99%;\">'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\techo '<option value=\"\"></option>'.\"\\n\"; // By default, we allow public access to any Post/Page.\n\n\t\t\t\t\t\t\t\t\t\t\t\tfor($n = 0; $n <= $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]; $n++)\n\t\t\t\t\t\t\t\t\t\t\t\t\techo ($posts[$n] !== array(\"all\")) ? // Protecting `all` Posts, of any kind?\n\t\t\t\t\t\t\t\t\t\t\t\t\t((!in_array(\"all-\".$post->post_type, $posts[$n]) && !in_array(\"all-\".$post->post_type.\"s\", $posts[$n])) // Protecting Posts `all-[of-this-type]`?\n\t\t\t\t\t\t\t\t\t\t\t\t\t? '<option value=\"'.$n.'\"'.((in_array($post_id, $posts[$n])) ? ' selected=\"selected\"' : '').'>'.(($n === $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"c\"][\"levels\"]) ? 'Require Highest Level #'.$n : 'Require Level #'.$n.' (or higher)').'</option>'.\"\\n\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '<option value=\"\" disabled=\"disabled\">Level #'.$n.' (already protects \"all\" Posts of this type)</option>'.\"\\n\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '<option value=\"\" disabled=\"disabled\">Level #'.$n.' (already protects \"all\" Posts)</option>'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\techo '</select><br /><small>* see: <strong>Restriction Options → Posts</strong></small>'.\"\\n\";\n\n\t\t\t\t\t\t\t\t\t\t\t\tif(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())\n\t\t\t\t\t\t\t\t\t\t\t\t\t// ^ Will change once Custom Capabilities are compatible with a Blog Farm.\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<p style=\"margin-top:15px; margin-left:2px;\"><strong>Require Custom Capabilities?</strong></p>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<label class=\"screen-reader-text\" for=\"ws-plugin--s2member-security-meta-box-ccaps\">Custom Capabilities?</label>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<input type=\"text\" autocomplete=\"off\" name=\"ws_plugin__s2member_security_meta_box_ccaps\" id=\"ws-plugin--s2member-security-meta-box-ccaps\" value=\"'.format_to_edit(trim(implode(\",\", (array)get_post_meta($post_id, \"s2member_ccaps_req\", true)))).'\" onkeyup=\"if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \\-]/g, \\'_\\').replace (/[^a-z_0-9,]/gi, \\'\\').toLowerCase ());\" style=\"width:99%;\" />'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\techo '<br /><small>* see: <strong>API Scripting → Custom Capabilities</strong></small>'.\"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\telse if(in_array($post_id, preg_split(\"/[\\r\\n\\t\\s;,]+/\", $GLOBALS[\"WS_PLUGIN__\"][\"s2member\"][\"o\"][\"specific_ids\"])))\n\t\t\t\t\t\t\t\t\t\t\techo 'This Post is a:<br /><strong>Specific Post/Page for sale</strong><br />(already guarded by s2Member)';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdo_action(\"ws_plugin__s2member_after_security_meta_box\", get_defined_vars());\n\n\t\t\t\t\t\treturn /* Return for uniformity. */;\n\t\t\t\t\t}", "function _sp_custom_box_advanced_page_options( $post ) {\n\twp_nonce_field( '_sp_process_meta_advanced_page_options', '_sp_meta_advanced_page_options_nonce' );\t\n\n\tif ( $post->ID ) {\n\t\t$show_title = get_post_meta( $post->ID, '_sp_page_show_title', true );\n\t\t$show_tagline = get_post_meta( $post->ID, '_sp_page_show_tagline', true );\n\t\t$tagline = get_post_meta( $post->ID, '_sp_page_tagline_text', true );\n\t\t$show_share = get_post_meta( $post->ID, '_sp_page_show_share', true );\n\t\t$show_wishlist = get_post_meta( $post->ID, '_sp_page_show_wishlist', true );\n\t\t$show_compare = get_post_meta( $post->ID, '_sp_page_show_compare', true );\n\t}\n\n\t// set default\n\tif ( ! isset( $show_header_section ) || empty( $show_header_section ) )\n\t\t$show_header_section = 'on';\n\n\tif ( ! isset( $show_title ) || empty( $show_title ) )\n\t\t$show_title = 'on';\n\n\t// set default\n\tif ( ! isset( $show_tagline ) || empty( $show_tagline ) )\n\t\t$show_tagline = 'off';\n\n\t// set default\n\tif ( ! isset( $show_share ) || empty( $show_share ) )\n\t\t$show_share = 'on';\n\n\t// show by default if post type is a blog post else off for all others\n\tif ( get_post_type() === 'post' ) {\n\t\tif ( ! isset( $show_social_buttons ) || empty( $show_social_buttons ) )\n\t\t\t$show_social_buttons = 'on';\n\t} else {\n\t\tif ( ! isset( $show_social_buttons ) || empty( $show_social_buttons ) )\n\t\t\t$show_social_buttons = 'off';\n\t}\n\n\t// set default\n\tif ( ! isset( $show_breadcrumbs ) || empty( $show_breadcrumbs ) )\n\t\t$show_breadcrumbs = 'on';\n\n\t// set default\n\tif ( ! isset( $show_wishlist ) || empty( $show_wishlist ) )\n\t\t$show_wishlist = 'on';\n\n\t// set default\n\tif ( ! isset( $show_compare ) || empty( $show_compare ) )\n\t\t$show_compare = 'on';\n\n\t$output = '';\n\n\t$output .= '<p><strong>' . __( 'Show Page Title:', 'sp-theme' ) . '</strong></p>' . PHP_EOL;\t\n\t$output .= '<p><label>' . __( 'Show', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_title\" value=\"on\" ' . checked( $show_title, 'on', false ) . ' /></label>&nbsp;&nbsp;<label>' . __( 'Hide', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_title\" value=\"off\" ' . checked( $show_title, 'off', false ) . '/></label></p>' . PHP_EOL;\n\n\t$output .= '<p><strong>' . __( 'Show Page Tagline:', 'sp-theme' ) . '</strong></p>' . PHP_EOL;\t\n\t$output .= '<p><label>' . __( 'Show', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_tagline\" value=\"on\" ' . checked( $show_tagline, 'on', false ) . ' /></label>&nbsp;&nbsp;<label>' . __( 'Hide', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_tagline\" value=\"off\" ' . checked( $show_tagline, 'off', false ) . '/></label></p>' . PHP_EOL;\n\n\t$output .= '<p><strong>' . __( 'Page Tagline Text:', 'sp-theme' ) . '</strong></p>' . PHP_EOL;\t\n\t$output .= '<p><input type=\"text\" name=\"page_tagline_text\" class=\"widefat\" value=\"' . esc_attr( $tagline ) . '\" /></p>' . PHP_EOL;\n\n\t$output .= '<p><strong>' . __( 'Show Social Share', 'sp-theme' ) . '</strong></p>' . PHP_EOL;\t\n\t$output .= '<p><label>' . __( 'Show', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_share\" value=\"on\" ' . checked( $show_share, 'on', false ) . ' /></label>&nbsp;&nbsp;<label>' . __( 'Hide', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_share\" value=\"off\" ' . checked( $show_share, 'off', false ) . '/></label></p>' . PHP_EOL;\n\n\t// check if post type is products\n\tif ( get_post_type() === 'product' ) {\n\t\t$output .= '<p><strong>' . __( 'Show Product Wishlist', 'sp-theme' ) . '</strong></p>' . PHP_EOL;\t\n\t\t$output .= '<p><label>' . __( 'Show', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_wishlist\" value=\"on\" ' . checked( $show_wishlist, 'on', false ) . ' /></label>&nbsp;&nbsp;<label>' . __( 'Hide', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_wishlist\" value=\"off\" ' . checked( $show_wishlist, 'off', false ) . '/></label></p>' . PHP_EOL;\n\n\t\t$output .= '<p><strong>' . __( 'Show Product Compare', 'sp-theme' ) . '</strong></p>' . PHP_EOL;\t\n\t\t$output .= '<p><label>' . __( 'Show', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_compare\" value=\"on\" ' . checked( $show_compare, 'on', false ) . ' /></label>&nbsp;&nbsp;<label>' . __( 'Hide', 'sp-theme' ) . ' <input type=\"radio\" name=\"page_show_compare\" value=\"off\" ' . checked( $show_compare, 'off', false ) . '/></label></p>' . PHP_EOL;\t\t\n\t}\n\n\techo $output;\n}", "private function initMetaBox(){\n\t\t$path = get_template_directory() . '/sub/customfield/';\n\t\tif(function_exists('of_get_option')){\n\t\t\tif(of_get_option('is-seo',true)){\n\t\t\t\tnew WPO_MetaBox(array(\n\t\t\t\t 'id' => 'wpo_seo',\n\t\t\t\t 'title' => $this->l('SEO Fields'),\n\t\t\t\t 'types' => array('page','portfolio','post','video'),\n\t\t\t\t 'priority' => 'high',\n\t\t\t\t 'template' => $path . 'seo.php',\n\t\t\t\t));\n\t\t\t}\n\t\t}\n\n\t\tnew WPO_MetaBox(array(\n\t\t 'id' => 'wpo_template',\n\t\t 'title' => $this->l('Advanced Configuration'),\n\t\t 'types' => array('page'),\n\t\t 'priority' => 'high',\n\t\t 'template' => $path . 'page-advanced.php'\n\t\t));\n\n\t\tnew WPO_MetaBox(array(\n\t\t 'id' => 'wpo_pageconfig',\n\t\t 'title' => $this->l('Page Configuration'),\n\t\t 'types' => array('page'),\n\t\t 'priority' => 'high',\n\t\t 'template' => $path . 'page.php',\n\t\t));\n\n\t\tnew WPO_MetaBox(array(\n\t\t 'id' => 'wpo_post',\n\t\t 'title' => $this->l('Embed Options'),\n\t\t 'types' => array('post','video'),\n\t\t 'priority' => 'high',\n\t\t 'template' => $path . 'post.php',\n\t\t));\n\t}", "public static function add_meta_box() {\n add_meta_box( \"CBMTheme\", \"CBM Theme Meta Box\", \"CBMAdmin::posts_page\" );\n }", "function _custom_meta_boxes() {\n\n $saved_settings = get_option( 'option_tree_settings', array() );\n\n $current_sliders = get_option( 'cp_sliders');\n\n// Iterate over the sliders\n if($current_sliders) {\n foreach($current_sliders as $key => $item) {\n $cpsliders[] = array(\n 'label' => $item->name,\n 'value' => $item->slug\n );\n }\n} else {\n $cpsliders[] = array(\n 'label' => 'No Sliders Found',\n 'value' => ''\n );\n}\n /**\n * Create a custom meta boxes array that we pass to\n * the OptionTree Meta Box API Class.\n */\n $meta_box_layout = array(\n 'id' => 'pp_metabox_sidebar',\n 'title' => 'Layout',\n 'desc' => 'If you choose the sidebar layout, please choose a sidebar from the list below. Sidebars can be created in the Theme Options and configured in the Theme Widgets.',\n 'pages' => array( 'post' ),\n 'context' => 'normal',\n 'priority' => 'high',\n 'fields' => array(\n array(\n 'id' => 'pp_sidebar_layout',\n 'label' => 'Layout',\n 'desc' => '',\n 'std' => ot_get_option('pp_blog_layout','left-sidebar'),\n 'type' => 'radio_image',\n 'class' => '',\n 'choices' => array(\n array(\n 'value' => 'left-sidebar',\n 'label' => 'Left Sidebar',\n 'src' => OT_URL . '/assets/images/layout/left-sidebar.png'\n ),\n array(\n 'value' => 'right-sidebar',\n 'label' => 'Right Sidebar',\n 'src' => OT_URL . '/assets/images/layout/right-sidebar.png'\n )\n ),\n ),\n array(\n 'id' => 'pp_sidebar_set',\n 'label' => 'Sidebar',\n 'desc' => '',\n 'std' => '',\n 'type' => 'sidebar-select',\n 'class' => '',\n\n )\n )\n );\n\n$meta_box_layout_page = array(\n 'id' => 'pp_metabox_sidebar',\n 'title' => 'Layout',\n 'desc' => 'If you choose the sidebar layout, please choose a sidebar from the list below. Sidebars can be created in the Theme Options and configured in the Theme Widgets.',\n 'pages' => array( 'page' ),\n 'context' => 'normal',\n 'priority' => 'high',\n 'fields' => array(\n array(\n 'id' => 'pp_sidebar_layout',\n 'label' => 'Layout',\n 'desc' => '',\n 'std' => ot_get_option('pp_blog_layout','left-sidebar'),\n 'type' => 'radio_image',\n 'class' => '',\n 'choices' => array(\n array(\n 'value' => 'left-sidebar',\n 'label' => 'Left Sidebar',\n 'src' => OT_URL . '/assets/images/layout/left-sidebar.png'\n ),\n array(\n 'value' => 'right-sidebar',\n 'label' => 'Right Sidebar',\n 'src' => OT_URL . '/assets/images/layout/right-sidebar.png'\n ),\n array(\n 'value' => 'full-width',\n 'label' => 'Full Width (no sidebar)',\n 'src' => OT_URL . '/assets/images/layout/full-width.png'\n )\n ),\n ),\n array(\n 'id' => 'pp_sidebar_set',\n 'label' => 'Sidebar',\n 'desc' => '',\n 'std' => '',\n 'type' => 'sidebar-select',\n 'class' => '',\n ),\n array(\n 'label' => 'Select slider',\n 'id' => 'pp_slider_select',\n 'type' => 'select',\n 'desc' => 'Don\\'t forget to choose Page Template: Page with Slider',\n 'choices' => $cpsliders,\n 'std' => 'true',\n 'rows' => '',\n 'post_type' => '',\n 'taxonomy' => '',\n 'class' => '',\n 'section' => 'slider'\n ),\n )\n);\n\n$post_options = array(\n 'id' => 'pp_metabox_featue',\n 'title' => 'Post options',\n 'desc' => 'Select post display options (Option depends on Post\\'s Format, so be sure to select one.',\n 'pages' => array( 'post' ),\n 'context' => 'normal',\n 'priority' => 'high',\n 'fields' => array(\n array(\n 'label' => 'Gallery slider (use when Post Type is set to Gallery)',\n 'id' => 'pp_gallery_slider',\n 'type' => 'gallery',\n 'desc' => 'Click Create Slider to create your gallery for slider.',\n 'post_type' => 'post',\n ),\n array(\n 'id' => 'pp_video_link',\n 'label' => 'Link to Video',\n 'desc' => 'Just link, not embed code, this field uses oEmbed.',\n 'std' => '',\n 'type' => 'text',\n 'class' => '',\n ),\n array(\n 'id' => 'pp_video_embed',\n 'label' => 'Embed code for Video',\n 'desc' => 'Place here embed code for videos services that do not support oEmbed',\n 'std' => '',\n 'type' => 'textarea',\n 'class' => '',\n ),\n )\n );\n\n\n\n$gallerypage = array(\n 'id' => 'pp_metabox_gallerypage',\n 'title' => 'Gallery slider',\n 'desc' => 'If you want to use flexslider gallery like on Portfolio item, just create gallery using button below',\n 'pages' => array( 'page' ),\n 'context' => 'normal',\n 'priority' => 'high',\n 'fields' => array(\n array(\n 'label' => 'Gallery slider (use when Post Type is set to Gallery)',\n 'id' => 'pp_gallery_slider',\n 'type' => 'gallery',\n 'desc' => 'Click Create Slider to create your gallery for slider.',\n 'post_type' => 'post',\n ),\n )\n );\n\n\n /**\n * Register our meta boxes using the\n * ot_register_meta_box() function.\n */\n ot_register_meta_box( $meta_box_layout );\n ot_register_meta_box( $meta_box_layout_page );\n ot_register_meta_box( $post_options );\n ot_register_meta_box( $gallerypage );\n\n\n}", "function remove_meta_boxes()\n {\n\n \tif( UserRoleController::isStudent() || ! current_user_can( 'publish_posts' ) )\n \t{\n \t\t//remove_meta_box( 'wpseo-dashboard-overview','project','normal' );\n \t\tremove_meta_box( 'commentstatusdiv','project', 'normal' );\n \t\tremove_meta_box( 'commentsdiv','project','normal' );\n \t\tremove_meta_box( 'statusdiv','project','normal' );\n \t\t\n \t\tremove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );\n \t\tremove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );\n \t\tremove_meta_box( 'dashboard_primary', 'dashboard', 'side' );\n \t\tremove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );\n \t\tremove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );\n \t\tremove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );\n \t\tremove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );\n \t\tremove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );\n \t\tremove_meta_box( 'dashboard_activity', 'dashboard', 'normal');//since 3.8\n\n \t\tremove_meta_box( 'themeisle', 'dashboard', 'normal');//since 3.8 \t\t\n \t\tremove_meta_box( 'logincust_subscribe_widget', 'dashboard', 'normal');//since 3.8\n\n \t}\n }" ]
[ "0.72019047", "0.7086406", "0.68498", "0.6814837", "0.68131715", "0.6740622", "0.673663", "0.6707423", "0.67020327", "0.66827893", "0.6675523", "0.663549", "0.6614527", "0.66097975", "0.6607575", "0.6593614", "0.6585065", "0.65683", "0.6562835", "0.6537237", "0.65305334", "0.65129066", "0.65112066", "0.6502337", "0.6495093", "0.64845645", "0.64827615", "0.64774024", "0.6472447", "0.6466204" ]
0.743109
0
Map character frequency as array. Returns array like this: array( )
private static function frequencyMap($data) { $occurences = array(); while (isset($data[0])) { // Count occurences for the first char and add to frequency map $occurences[base64_encode($data[0])] = substr_count($data, $data[0]); $data = str_replace($data[0], '', $data); } // Sort the resulting array asort($occurences); // Return the array in descending order return array_reverse($occurences); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function frequencyOfCharactersArray(string $text)\n {\n $text = mb_strtoupper($text);\n $unique = [];\n\n $lines_arr = preg_split('/\\r\\n/', $text);\n $num_newlines = count($lines_arr) - 1;\n if ($num_newlines) {\n $unique['paragraph'] = $num_newlines;\n }\n\n $text = str_replace(\"\\r\\n\", \"\", $text);\n\n for ($i = 0; $i < mb_strlen($text); $i++) {\n $char = mb_substr($text, $i, 1);\n if (!array_key_exists($char, $unique)) {\n $unique[$char] = 0;\n }\n $unique[$char]++;\n }\n\n arsort($unique);\n\n $array = [];\n foreach ($unique as $character => $number) {\n $percentage = round($number / array_sum($unique) * 100, 1);\n $character = str_replace(\" \", 'space', $character);\n $array[] = [\n 'character' => $character,\n 'number' => $number,\n 'percentage' => $percentage,\n ];\n }\n\n return $array;\n }", "public function getfrequency() {\n return['1' => 'Frequency 1', '2' => 'Frequency 2', '3' => 'Frequency 3', '4' => 'Frequency 4'];\n }", "private function arr2charCountArray($arr) {\n\t\treturn array_count_values($arr);\n\t}", "function getTextFrequency(){\n\t\t$freq = array(); \t\t// inisialisasi frequensi\n\t\t$this->firstBit = \"\";\t// inisialisasi bit awal\n\n\t\tfor ($i = 0; $i < strlen($this->textInside); $i++) { //melakukan perulangan untuk setiap char dalam text\n\t \n\t $letter = $this->textInside[$i]; //mengambil char ke-i dalam text\n\t $this->firstBit .= sprintf(\"%08d\",decbin(ord($letter)));\t\t//menambahkan binary char ke-i dan disimpan ke firstbit\n\t \n\t if (array_key_exists($letter, $freq)) { //mengecek apakah char ke-i sudah ada dalam array frekuensi atau tidak\n\t $freq[$letter]++;\t\t//menambahkan jumlah char \n\t } else {\n\t $freq[$letter] = 1;\t\t//menginisialisasi jumlah char\n\t }\n\t }\n\n\t return $freq;\t\t//mengembalikan nilai frekuensi dalam array\n\t}", "function sherlockAndAnagrams($s) {\n $stringSize=strlen($s);\n $data=[];\nfor($i=0;$i<$stringSize;$i++){\n\n for($j=$i;$j<$stringSize;$j++){\n for($t=$i;$t<=$j;$t++){\n $data[$t][]=countchars($s[$t]);\n }\n\n\n }\n\n\n}\necho '<pre>';\nprint_r($data);\n\n}", "public function frequencyOfCharacters(string $text)\n {\n $array = $this->frequencyOfCharactersArray($text);\n $result = '<table>';\n $result .= '<tr><td>Character</td><td>Frequency</td><td>Percentage</td></tr>';\n foreach ($array as $item) {\n $result .= '<tr><td>' . $item['character'] . '</td><td>' . $item['number'] . '</td><td>' . $item['percentage'] . '</td></tr>';\n }\n $result .= '</table>';\n\n return $result;\n }", "function getCharacterCounts(string $name0, string $name1): array\n {\n $names = getCombinedNames($name0, $name1);\n $letters = [];\n\n for ($i = 0; $i < strlen($names); $i++) {\n $letters[$names[$i]] = returnCharacterCount($names[$i], $names);\n }\n\n return $letters;\n }", "function get_word_counts_array($string) {\n $array_of_words = preg_split('/[ ,_.]+/', $string);\n\n $unique_words = get_unique_words_array($array_of_words);\n\n $return_array = generate_empty_counts_array($unique_words);\n\n $len = count($return_array);\n\n foreach ($array_of_words as $word) {\n for ($i = 0 ; $i < $len ; $i++ ) {\n\n if (strcmp($return_array[$i][0], $word) == 0) {\n $return_array[$i][1] += 1;\n }\n }\n }\n return $return_array;\n}", "public function alphabetFrequency($str, $alphabet = NULL) {\n\t\t$alph_freq_arr = array();\n\t\t$char_freq_arr = $this->str2charCountArray(strtolower($str));\n\n\t\tif (!$alphabet) {\n\t\t\t$alphabet = range('a' , 'z');\n\t\t}\n\n\t\tforeach ($alphabet as $letter) {\n\t\t\t$alph_freq_arr[$letter] = (isset($char_freq_arr[$letter]))\n\t\t\t\t\t\t\t\t\t ? $char_freq_arr[$letter]\n\t\t\t\t\t\t\t\t\t : 0;\n\t\t}\n\n\t\treturn $alph_freq_arr;\n\t}", "private function str2charCountArray($str) {\n\t\treturn array_count_values($this->str2charArray($str));\n\t}", "function frequentLetters($string)\n{\n $hash1 = [];\n $frequentLetters = [];\n for ($index = 0; $index < strlen($string); $index++) {\n $char = $string[$index];\n if (!array_key_exists($char, $hash1)) {\n $hash1[$char] = 0;\n }\n $hash1[$char] += 1;\n if ($hash1[$char] > 2 && !in_array($char, $frequentLetters)) {\n $frequentLetters[] = $char;\n }\n }\n // print_r($hash1);\n return $frequentLetters;\n}", "public function tFrequencies()\n {\n return json_encode($this->frequencies);\n }", "public static function frequencies(array $data): array\n\t{\n\t\t$frequencies = array_count_values($data);\n\t\tarsort($frequencies);\n\t\treturn $frequencies;\n\t}", "public static function getTextWidthArray()\n {\n $ret = [\n '100' => '100%',\n '90' => '90%',\n '80' => '80%',\n '70' => '70%',\n '60' => '60%',\n '50' => '50%',\n '40' => '40%',\n '30' => '30%',\n '20' => '20%',\n ];\n\n return $ret;\n }", "public function frequencyTable($tokens)\n {\n $frequencyTable = [];\n foreach ($tokens as $token) {\n if (!isset($frequencyTable[$token])) {\n $frequencyTable[$token] = 1;\n } else {\n $frequencyTable[$token]++;\n }\n }\n\n return $frequencyTable;\n }", "function testCapsFrequencyList321(){\r\n\r\n\t$c = new GenerateWordCloud();\r\n\t$words = array();\r\n\tarray_push($words, 'MOST');\r\n\tarray_push($words, 'most');\t\r\n\tarray_push($words, 'mOSt');\r\n\tarray_push($words, 'aveRage');\r\n\tarray_push($words, 'averAGE');\r\n\tarray_push($words, 'leasT');\r\n\t\r\n\t$frequency_list = $c->wordFreq($words);\r\n\t$this->assertEquals(3, $frequency_list['most']);\r\n\t$this->assertEquals(2, $frequency_list['average']);\r\n\t$this->assertEquals(1, $frequency_list['least']);\r\n\t$this->assertEquals(3, count($frequency_list));\r\n\t}", "public function typeCounts() : array\n {\n $counts = [\n self::CATEGORICAL => 0,\n self::CONTINUOUS => 0,\n self::RESOURCE => 0,\n ];\n\n return array_replace($counts, array_count_values($this->types()));\n }", "static function _utf2AsciiMap(): array {\n $map = [];\n foreach (\\hbc\\core\\StrX::charsArray() as $to => $from) {\n foreach ($from as $f) {\n $map[$f] = $to;\n }\n }\n\n return $map;\n }", "public static function frequency(array $values): array\n {\n $frequencies = array();\n foreach ($values as $value) {\n if (!isset($frequencies[$value])) {\n $frequencies[$value] = 1;\n } else {\n $frequencies[$value]++;\n }\n }\n return $frequencies;\n }", "public function toArray()\n {\n $array = parent::toArray();\n\n foreach ($array as $k => &$v) {\n $v['_count'] = $k;\n }\n\n return $array;\n }", "public function getCharClassRatios($str) {\n\n\t\t$out = array();\n\n\t\t// character counts\n\t\t$gr_cnt = $this->nonSpaceCharCount($str); // character count: M\n\t\t// character frequencies array\n\t\t$chf_arr = $this->str2charCountArray($str);\n\n\t\tforeach ($this->classes as $class => $chars) {\n\t\t\t$subset = array_intersect_key($chf_arr, array_flip($chars));\n\t\t\t$out[$class] = ($gr_cnt != 0)\n\t\t\t\t\t\t ? array_sum($subset)/$gr_cnt\n\t\t\t\t\t\t : 0;\n\t\t}\n\n\t\treturn $out;\n\t}", "private function getLetterArray() {\n $array = range('A', 'Z');\n $letters = $array;\n foreach ($array as $first) {\n foreach ($array as $second) {\n $letters[] = $first . $second;\n }\n }\n return $letters;\n }", "function getOcurrencesLetters($book) {\n $count = array();\n $strlen = strlen($book); // O(1)\n for ($i = 0; $i <= $strlen; $i++) {\n $char = substr($book, $i, 1);\n if ($char) {\n if (!isset($count[$char])) {\n $count[$char] = 0;\n }\n $count[$char] += 1;\n }\n }\n return $count;\n}", "public function countGroupedByFirstLetter()\n {\n $series = array();\n foreach ($this->getRepository()->countGroupedByFirstLetter() as $serie) {\n // Force non alpha to #\n if (!preg_match('/[A-Z]/', $serie['first_letter'])) {\n $serie['first_letter'] = '#';\n }\n if (!array_key_exists($serie['first_letter'], $series)) {\n $series[$serie['first_letter']] = 0;\n }\n $series[$serie['first_letter']] += $serie['nb_serie'];\n }\n\n return $series;\n }", "function word_count($filePath) {\r\n\t$file= fopen(\"$filePath\", \"r\");\r\n\t$word =array('A'=>0 ,'a'=>0,'B'=>0,'b'=>0,'C'=>0,'c'=>0,'D'=>0,'d'=>0,'E'=>0,'e'=>0,'F'=>0,'f'=>0,'G'=>0,'g'=>0,'H'=>0,'h'=>0,'I'=>0,'i'=>0,'J'=>0,'j'=>0,'K' =>0,'k'=>0 ,'L'=>0 ,'l' =>0,'M'=>0 ,'m'=>0 ,'N'=>0 ,'n' =>0,'O' =>0,'o' =>0,'P' =>0,'p'=>0,'Q' =>0,'q'=>0,'R'=>0 ,'r'=>0 ,'S'=>0 ,'s'=>0 ,'T'=>0 ,'t'=>0 ,'u' =>0,'u'=>0 ,'V'=>0,'v'=>0 ,'W'=>0 ,'w'=>0 ,'X'=>0 ,'x'=>0,'Y'=>0 ,'y'=>0 ,'Z'=>0,'z'=>0 ); \r\n\twhile(!feof($file)) {\r\n\t\t\r\n\t\t$str = fgetc($file);\r\n\t\tif ($str==\"\\n\" || $str===\" \" || $str==\",\" || $str==\".\" || $str==\"0\") {\r\n\t\t\r\n\t\t}else $word[\"$str\"]= $word[$str]+1;\r\n\t}\r\n\t \r\n\tfclose($file);\r\n\treturn $word ;\r\n \t\r\n}", "protected static function charsArray(): array\n {\n static $charsArray;\n\n if (isset($charsArray)) {\n return $charsArray;\n }\n\n return $charsArray = [\n '0' => ['°', '₀', '۰', '0'],\n '1' => ['¹', '₁', '۱', '1'],\n '2' => ['²', '₂', '۲', '2'],\n '3' => ['³', '₃', '۳', '3'],\n '4' => ['⁴', '₄', '۴', '٤', '4'],\n '5' => ['⁵', '₅', '۵', '٥', '5'],\n '6' => ['⁶', '₆', '۶', '٦', '6'],\n '7' => ['⁷', '₇', '۷', '7'],\n '8' => ['⁸', '₈', '۸', '8'],\n '9' => ['⁹', '₉', '۹', '9'],\n 'a' => [\n 'à',\n 'á',\n 'ả',\n 'ã',\n 'ạ',\n 'ă',\n 'ắ',\n 'ằ',\n 'ẳ',\n 'ẵ',\n 'ặ',\n 'â',\n 'ấ',\n 'ầ',\n 'ẩ',\n 'ẫ',\n 'ậ',\n 'ā',\n 'ą',\n 'å',\n 'α',\n 'ά',\n 'ἀ',\n 'ἁ',\n 'ἂ',\n 'ἃ',\n 'ἄ',\n 'ἅ',\n 'ἆ',\n 'ἇ',\n 'ᾀ',\n 'ᾁ',\n 'ᾂ',\n 'ᾃ',\n 'ᾄ',\n 'ᾅ',\n 'ᾆ',\n 'ᾇ',\n 'ὰ',\n 'ά',\n 'ᾰ',\n 'ᾱ',\n 'ᾲ',\n 'ᾳ',\n 'ᾴ',\n 'ᾶ',\n 'ᾷ',\n 'а',\n 'أ',\n 'အ',\n 'ာ',\n 'ါ',\n 'ǻ',\n 'ǎ',\n 'ª',\n 'ა',\n 'अ',\n 'ا',\n 'a',\n 'ä',\n ],\n 'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b'],\n 'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ', 'c'],\n 'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', 'd'],\n 'e' => [\n 'é',\n 'è',\n 'ẻ',\n 'ẽ',\n 'ẹ',\n 'ê',\n 'ế',\n 'ề',\n 'ể',\n 'ễ',\n 'ệ',\n 'ë',\n 'ē',\n 'ę',\n 'ě',\n 'ĕ',\n 'ė',\n 'ε',\n 'έ',\n 'ἐ',\n 'ἑ',\n 'ἒ',\n 'ἓ',\n 'ἔ',\n 'ἕ',\n 'ὲ',\n 'έ',\n 'е',\n 'ё',\n 'э',\n 'є',\n 'ə',\n 'ဧ',\n 'ေ',\n 'ဲ',\n 'ე',\n 'ए',\n 'إ',\n 'ئ',\n 'e',\n ],\n 'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', 'f'],\n 'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', 'g'],\n 'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', 'h'],\n 'i' => [\n 'í',\n 'ì',\n 'ỉ',\n 'ĩ',\n 'ị',\n 'î',\n 'ï',\n 'ī',\n 'ĭ',\n 'į',\n 'ı',\n 'ι',\n 'ί',\n 'ϊ',\n 'ΐ',\n 'ἰ',\n 'ἱ',\n 'ἲ',\n 'ἳ',\n 'ἴ',\n 'ἵ',\n 'ἶ',\n 'ἷ',\n 'ὶ',\n 'ί',\n 'ῐ',\n 'ῑ',\n 'ῒ',\n 'ΐ',\n 'ῖ',\n 'ῗ',\n 'і',\n 'ї',\n 'и',\n 'ဣ',\n 'ိ',\n 'ီ',\n 'ည်',\n 'ǐ',\n 'ი',\n 'इ',\n 'ی',\n 'i',\n ],\n 'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', 'j'],\n 'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک', 'k'],\n 'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', 'l'],\n 'm' => ['м', 'μ', 'م', 'မ', 'მ', 'm'],\n 'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ', 'n'],\n 'o' => [\n 'ó',\n 'ò',\n 'ỏ',\n 'õ',\n 'ọ',\n 'ô',\n 'ố',\n 'ồ',\n 'ổ',\n 'ỗ',\n 'ộ',\n 'ơ',\n 'ớ',\n 'ờ',\n 'ở',\n 'ỡ',\n 'ợ',\n 'ø',\n 'ō',\n 'ő',\n 'ŏ',\n 'ο',\n 'ὀ',\n 'ὁ',\n 'ὂ',\n 'ὃ',\n 'ὄ',\n 'ὅ',\n 'ὸ',\n 'ό',\n 'о',\n 'و',\n 'θ',\n 'ို',\n 'ǒ',\n 'ǿ',\n 'º',\n 'ო',\n 'ओ',\n 'o',\n 'ö',\n ],\n 'p' => ['п', 'π', 'ပ', 'პ', 'پ', 'p'],\n 'q' => ['ყ', 'q'],\n 'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ', 'r'],\n 's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს', 's'],\n 't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ', 't'],\n 'u' => [\n 'ú',\n 'ù',\n 'ủ',\n 'ũ',\n 'ụ',\n 'ư',\n 'ứ',\n 'ừ',\n 'ử',\n 'ữ',\n 'ự',\n 'û',\n 'ū',\n 'ů',\n 'ű',\n 'ŭ',\n 'ų',\n 'µ',\n 'у',\n 'ဉ',\n 'ု',\n 'ူ',\n 'ǔ',\n 'ǖ',\n 'ǘ',\n 'ǚ',\n 'ǜ',\n 'უ',\n 'उ',\n 'u',\n 'ў',\n 'ü',\n ],\n 'v' => ['в', 'ვ', 'ϐ', 'v'],\n 'w' => ['ŵ', 'ω', 'ώ', 'ဝ', 'ွ', 'w'],\n 'x' => ['χ', 'ξ', 'x'],\n 'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ', 'y'],\n 'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', 'z'],\n 'aa' => ['ع', 'आ', 'آ'],\n 'ae' => ['æ', 'ǽ'],\n 'ai' => ['ऐ'],\n 'ch' => ['ч', 'ჩ', 'ჭ', 'چ'],\n 'dj' => ['ђ', 'đ'],\n 'dz' => ['џ', 'ძ'],\n 'ei' => ['ऍ'],\n 'gh' => ['غ', 'ღ'],\n 'ii' => ['ई'],\n 'ij' => ['ij'],\n 'kh' => ['х', 'خ', 'ხ'],\n 'lj' => ['љ'],\n 'nj' => ['њ'],\n 'oe' => ['ö', 'œ', 'ؤ'],\n 'oi' => ['ऑ'],\n 'oii' => ['ऒ'],\n 'ps' => ['ψ'],\n 'sh' => ['ш', 'შ', 'ش'],\n 'shch' => ['щ'],\n 'ss' => ['ß'],\n 'sx' => ['ŝ'],\n 'th' => ['þ', 'ϑ', 'ث', 'ذ', 'ظ'],\n 'ts' => ['ц', 'ც', 'წ'],\n 'ue' => ['ü'],\n 'uu' => ['ऊ'],\n 'ya' => ['я'],\n 'yu' => ['ю'],\n 'zh' => ['ж', 'ჟ', 'ژ'],\n '(c)' => ['©'],\n 'A' => [\n 'Á',\n 'À',\n 'Ả',\n 'Ã',\n 'Ạ',\n 'Ă',\n 'Ắ',\n 'Ằ',\n 'Ẳ',\n 'Ẵ',\n 'Ặ',\n 'Â',\n 'Ấ',\n 'Ầ',\n 'Ẩ',\n 'Ẫ',\n 'Ậ',\n 'Å',\n 'Ā',\n 'Ą',\n 'Α',\n 'Ά',\n 'Ἀ',\n 'Ἁ',\n 'Ἂ',\n 'Ἃ',\n 'Ἄ',\n 'Ἅ',\n 'Ἆ',\n 'Ἇ',\n 'ᾈ',\n 'ᾉ',\n 'ᾊ',\n 'ᾋ',\n 'ᾌ',\n 'ᾍ',\n 'ᾎ',\n 'ᾏ',\n 'Ᾰ',\n 'Ᾱ',\n 'Ὰ',\n 'Ά',\n 'ᾼ',\n 'А',\n 'Ǻ',\n 'Ǎ',\n 'A',\n 'Ä',\n ],\n 'B' => ['Б', 'Β', 'ब', 'B'],\n 'C' => ['Ç', 'Ć', 'Č', 'Ĉ', 'Ċ', 'C'],\n 'D' => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ', 'D'],\n 'E' => [\n 'É',\n 'È',\n 'Ẻ',\n 'Ẽ',\n 'Ẹ',\n 'Ê',\n 'Ế',\n 'Ề',\n 'Ể',\n 'Ễ',\n 'Ệ',\n 'Ë',\n 'Ē',\n 'Ę',\n 'Ě',\n 'Ĕ',\n 'Ė',\n 'Ε',\n 'Έ',\n 'Ἐ',\n 'Ἑ',\n 'Ἒ',\n 'Ἓ',\n 'Ἔ',\n 'Ἕ',\n 'Έ',\n 'Ὲ',\n 'Е',\n 'Ё',\n 'Э',\n 'Є',\n 'Ə',\n 'E',\n ],\n 'F' => ['Ф', 'Φ', 'F'],\n 'G' => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ', 'G'],\n 'H' => ['Η', 'Ή', 'Ħ', 'H'],\n 'I' => [\n 'Í',\n 'Ì',\n 'Ỉ',\n 'Ĩ',\n 'Ị',\n 'Î',\n 'Ï',\n 'Ī',\n 'Ĭ',\n 'Į',\n 'İ',\n 'Ι',\n 'Ί',\n 'Ϊ',\n 'Ἰ',\n 'Ἱ',\n 'Ἳ',\n 'Ἴ',\n 'Ἵ',\n 'Ἶ',\n 'Ἷ',\n 'Ῐ',\n 'Ῑ',\n 'Ὶ',\n 'Ί',\n 'И',\n 'І',\n 'Ї',\n 'Ǐ',\n 'ϒ',\n 'I',\n ],\n 'J' => ['J'],\n 'K' => ['К', 'Κ', 'K'],\n 'L' => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ', 'Ľ', 'Ŀ', 'ल', 'L'],\n 'M' => ['М', 'Μ', 'M'],\n 'N' => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν', 'N'],\n 'O' => [\n 'Ó',\n 'Ò',\n 'Ỏ',\n 'Õ',\n 'Ọ',\n 'Ô',\n 'Ố',\n 'Ồ',\n 'Ổ',\n 'Ỗ',\n 'Ộ',\n 'Ơ',\n 'Ớ',\n 'Ờ',\n 'Ở',\n 'Ỡ',\n 'Ợ',\n 'Ø',\n 'Ō',\n 'Ő',\n 'Ŏ',\n 'Ο',\n 'Ό',\n 'Ὀ',\n 'Ὁ',\n 'Ὂ',\n 'Ὃ',\n 'Ὄ',\n 'Ὅ',\n 'Ὸ',\n 'Ό',\n 'О',\n 'Θ',\n 'Ө',\n 'Ǒ',\n 'Ǿ',\n 'O',\n 'Ö',\n ],\n 'P' => ['П', 'Π', 'P'],\n 'Q' => ['Q'],\n 'R' => ['Ř', 'Ŕ', 'Р', 'Ρ', 'Ŗ', 'R'],\n 'S' => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ', 'S'],\n 'T' => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ', 'T'],\n 'U' => [\n 'Ú',\n 'Ù',\n 'Ủ',\n 'Ũ',\n 'Ụ',\n 'Ư',\n 'Ứ',\n 'Ừ',\n 'Ử',\n 'Ữ',\n 'Ự',\n 'Û',\n 'Ū',\n 'Ů',\n 'Ű',\n 'Ŭ',\n 'Ų',\n 'У',\n 'Ǔ',\n 'Ǖ',\n 'Ǘ',\n 'Ǚ',\n 'Ǜ',\n 'U',\n 'Ў',\n 'Ü',\n ],\n 'V' => ['В', 'V'],\n 'W' => ['Ω', 'Ώ', 'Ŵ', 'W'],\n 'X' => ['Χ', 'Ξ', 'X'],\n 'Y' => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', 'Ы', 'Й', 'Υ', 'Ϋ', 'Ŷ', 'Y'],\n 'Z' => ['Ź', 'Ž', 'Ż', 'З', 'Ζ', 'Z'],\n 'AE' => ['Æ', 'Ǽ'],\n 'Ch' => ['Ч'],\n 'Dj' => ['Ђ'],\n 'Dz' => ['Џ'],\n 'Gx' => ['Ĝ'],\n 'Hx' => ['Ĥ'],\n 'Ij' => ['IJ'],\n 'Jx' => ['Ĵ'],\n 'Kh' => ['Х'],\n 'Lj' => ['Љ'],\n 'Nj' => ['Њ'],\n 'Oe' => ['Œ'],\n 'Ps' => ['Ψ'],\n 'Sh' => ['Ш'],\n 'Shch' => ['Щ'],\n 'Ss' => ['ẞ'],\n 'Th' => ['Þ'],\n 'Ts' => ['Ц'],\n 'Ya' => ['Я'],\n 'Yu' => ['Ю'],\n 'Zh' => ['Ж'],\n ' ' => [\n \"\\xC2\\xA0\",\n \"\\xE2\\x80\\x80\",\n \"\\xE2\\x80\\x81\",\n \"\\xE2\\x80\\x82\",\n \"\\xE2\\x80\\x83\",\n \"\\xE2\\x80\\x84\",\n \"\\xE2\\x80\\x85\",\n \"\\xE2\\x80\\x86\",\n \"\\xE2\\x80\\x87\",\n \"\\xE2\\x80\\x88\",\n \"\\xE2\\x80\\x89\",\n \"\\xE2\\x80\\x8A\",\n \"\\xE2\\x80\\xAF\",\n \"\\xE2\\x81\\x9F\",\n \"\\xE3\\x80\\x80\",\n \"\\xEF\\xBE\\xA0\",\n ],\n ];\n }", "public final function getTopCharsAndOccurrences(string $content) : array\n {\n $collArray = str_split($content);\n $top = [];\n foreach ($collArray as $char) {\n if (!isset($top[$char])) {\n $top[$char] = 0;\n }\n $top[$char]++;\n }\n arsort($top);\n return $top;\n }", "public function getPublicationFrequency()\n {\n return $this->getFieldArray('310', ['a', 'b']);\n }", "function getTextArray($text)\n{\n\t$numWords = str_word_count($text, 0, '1234567890');\n\tif($numWords > 1) { $wordsArray = explode(' ', $text); } else { $wordsArray = array($text); $word = $text; }\n\treturn(array('words'=>$wordsArray, 'wordcount'=>$numWords, 'word'=>$word));\n}", "public function cases_count()\n\t{\n\t\treturn array(\n\t\t\tarray(2, 7, true, false, 5),\n\t\t\tarray(2, 7, false, false, 4),\n\t\t\tarray(2, 7, false, true, 5),\n\t\t\tarray(2, 7, true, true, 6),\n\t\t\tarray(9, -1, true, false, 0),\n\t\t);\n\t}" ]
[ "0.7261822", "0.64978516", "0.6474168", "0.6468677", "0.6303435", "0.6242022", "0.6201956", "0.60705554", "0.60369927", "0.59643245", "0.5952663", "0.5821382", "0.58143157", "0.56799394", "0.56423604", "0.53942055", "0.5292736", "0.5289216", "0.52879566", "0.5278701", "0.5266793", "0.5255908", "0.52521586", "0.52323776", "0.52039796", "0.51918006", "0.5172418", "0.5167979", "0.5125748", "0.50261194" ]
0.7272989
0
Set default arguments Page or post details on a single page or post; site details on any other template. The default arguments can be customized via a filter.
private function setDefaultArgs() { $args = [ 'title' => get_bloginfo('name'), 'url' => get_bloginfo('url'), 'desc' => get_bloginfo('description'), ]; if (is_page() || is_singular()) { $args = [ 'title' => get_the_title(), 'url' => get_permalink(), 'desc' => $this->getPostExcerpt(), ]; } $this->setArgs(apply_filters('cgit_socialize_default_args', $args)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ht_dms_default_paginated_view_arguments( $args = null ) {\n\t$paginated_view_args = array(\n\t\t'uID' => get_current_user_id(),\n\t\t'limit' => 5,\n\t\t'page' => 1,\n\t);\n\n\tif ( is_array( $args ) ) {\n\t\t$paginated_view_args = array_merge( $paginated_view_args, $args );\n\t}\n\n\treturn $paginated_view_args;\n\n\n}", "function apply_default_args($args) {\r\n\t\t$defaults = array(\r\n\t\t\t'width'=>'',\r\n\t\t\t'height'=>'',\r\n\t\t\t'placeholder'=>'',\r\n\t\t\t'description'=>''\r\n\t\t);\r\n\t\t$args = wp_parse_args( $args, $defaults );\r\n\t\treturn $args;\t\r\n\t}", "function get_arguments_views_plugins() {\n return array(\n 'argument default' => array(\n 'param' => array(\n 'title' => t('GET parameter from URL'),\n 'handler' => 'get_arguments_plugin_argument_default_param',\n ),\n ),\n );\n}", "public function setDefaultArgs($args);", "private function default(&$args) {\n\n\t\t// Check args\n\t\tif (empty($args) || !is_array($args))\n\t\t\t$args = [];\n\n\t\t// Set agency slug\n\t\t$args['agency'] = $this->agency;\n\n\t\t// Check language\n\t\tif (!isset($args['language']) && isset($this->language))\n\t\t\t$args['language'] = $this->language;\n\t}", "private function default_args() {\n\t\n\t\t$defaults = array(\n\t\t\t'container' \t=> 'nav',\n\t\t\t'separator' \t=> '&raquo;',\n\t\t\t'before' \t\t=> 'Viewing:',\n\t\t\t'home' \t\t\t=> 'Home',\n\t\t);\n\t\treturn $defaults;\n\t}", "public function setViewHelperDefaulArgumentsToAdditionalArguments() {}", "private function setArgs(){\n\t\t$this->args = array(\n\t\t\t'label' => $this->label,\n\t\t\t'labels' => $this->labels,\n\t\t\t'description' => $this->description,\n\t\t\t'public' => $this->public,\n\t\t\t'exclude_from_search' => $this->excludeSearch,\n\t\t\t'publicly_queryable' => $this->publiclyQueryable,\n\t\t\t'show_ui' => $this->show_ui ,\n\t\t\t'show_in_nav_menus' => $this->showInNavMenus,\n\t\t\t'show_in_menu' => $this->showInMenu,\n\t\t\t'show_in_admin_bar' => $this->showInAdminBar,\n\t\t\t'menu_position' => $this->menuPosition,\n\t\t\t'menu_icon' => $this->menuIcon,\n\t\t\t'capability_type' => $this->capabilityType,\n\t\t\t'map_meta_cap' => $this->mapMetaCap,\n\t\t\t'hierarchical' => $this->hierarchical,\n\t\t\t'supports' => $this->supports,\n\t\t\t'register_meta_box_cb' => $this->registerMetaBoxCb,\n\t\t\t'taxonomies' => $this->taxonomies,\n\t\t\t'has_archive' => $this->hasArchive,\n\t\t\t'permalink_epmask' => $this->permalinkEpmask,\n\t\t\t'rewrite' => $this->rewrite,\n\t\t\t'query_var' => $this->queryVar,\n\t\t\t'can_export' => $this->canExport,\n\t\t\t'_builtin' => $this->builtin\n\t\t);\n\t}", "public function getDefaultParams() {\n\t\treturn $this->setWpQueryVars( 'paged', 'posts_per_page' );\n\t}", "private static function get_default_args() {\n $careerjet_api_key = get_option('jobsearch_integration_careerjet_affid');\n \n return array(\n 'affid' => $careerjet_api_key,\n 'keywords' => '',\n 'location' => '',\n 'page' => 1,\n );\n }", "protected function _create_defaults( $args ) {\n\t\t\t$defaults = array(\n\t\t\t\t'help_tabs' => array(),\n\t\t\t\t'help_sidebar' => '',\n\t\t\t);\n\t\t\t$args = wp_parse_args( $args, $defaults );\n\t\t\t$this->args = json_decode( json_encode( $args ) );\n\t\t}", "private static function arguments() {\n\t\treturn apply_filters(\n\t\t\t'drsa_post_type_args', array(\n\t\t\t\t'labels' => self::labels(),\n\t\t\t\t'public' => false,\n\t\t\t\t'publicly_queryable' => false,\n\t\t\t\t'show_ui' => true,\n\t\t\t\t'show_in_menu' => true,\n\t\t\t\t'query_var' => true,\n\t\t\t\t'capability_type' => 'post',\n\t\t\t\t'has_archive' => false,\n\t\t\t\t'hierarchical' => false,\n\t\t\t\t'menu_position' => null,\n\t\t\t\t'menu_icon' => 'dashicons-pressthis',\n\t\t\t\t'supports' => array( 'title', 'author', 'thumbnail' ),\n\t\t\t\t'capability_type' => apply_filters( 'drsa_ad/cpt/capability_type', 'post' ),\n\t\t\t)\n\t\t);\n\t}", "function set_default_properties( $atts ) {\n\tglobal $post;\n\n\t# If the attribute 'id' is set on the shortcode, set the post object to the post entered.\n\tif ( $atts['id'] ) {\n\t\t$post = get_post( $atts['id'] );\n\t}\n\n\t# If we are on the blog template, get the blog template ID.\n\tif ( is_home() ) {\n\t\t$post = get_post( get_option( 'page_for_posts' ) );\n\t}\n\n\t# Set up variable to check if static exists as a class.\n\t$is_static = in_array( 'static', explode( ' ', $atts['class'] ), true );\n\n\t$defaults = ( object ) array(\n\t\t'ID' => $post->ID,\n\t\t'slug' => $post->post_name,\n\t\t'header' => set_header_text( $post ),\n\t\t'image_source' => is_single() ? set_cover_image( $post->ID ) : set_featured_image( $post->ID, $is_static ),\n\t\t'classes' => set_featured_image_classes( $is_static, $atts['class'] ),\n\t\t'sub_header' => set_sub_header_text( $post ),\n\t\t'button_text' => set_button_text( $is_static, $post ),\n\t\t'button_link' => set_button_link( $post ),\n\t\t'button_downloadable' => set_button_downloadable( $post ),\n\t);\n\n\treturn $defaults;\n}", "function defaultAction($args) {\n\t}", "public function get_default_args(){ return $this->default_args; }", "public function __construct($args = [])\n {\n parent::__construct($args);\n\n // Add common data needed all pages\n $this->setBase();\n }", "public function setup() {\n\n\t\t$this->set_defaults();\n\n\t\t$this->arguments = array(\n\t\t\t'priority' => 30,\n\t\t\t'capability' => 'edit_theme_options',\n\t\t\t'title' => esc_html__( 'Month View', 'the-events-calendar' ),\n\t\t\t'description' => esc_html__( 'Options selected here will override what was selected in the \"General Theme\" and \"Global Elements\" sections', 'the-events-calendar' ),\n\t\t);\n\t}", "public function setArguments() {\n\n $theme = wp_get_theme(); // For use with some settings. Not necessary.\n\n $this->args = array(\n // TYPICAL -> Change these values as you need/desire\n 'opt_name' => 'neattheme', // This is where your data is stored in the database and also becomes your global variable name.\n 'display_name' => $theme->get('Name'), // Name that appears at the top of your panel\n 'display_version' => $theme->get('Version'), // Version that appears at the top of your panel\n 'menu_type' => 'submenu', //Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only)\n 'allow_sub_menu' => true, // Show the sections below the admin menu item or not\n 'menu_title' => __('Theme Options', 'neat'),\n 'page' => __('Theme Options', 'neat'),\n // You will need to generate a Google API key to use this feature.\n // Please visit: https://developers.google.com/fonts/docs/developer_api#Auth\n 'google_api_key' => '', // Must be defined to add google fonts to the typography module\n 'async_typography' => true,\n //'admin_bar' => false, // Show the panel pages on the admin bar\n 'global_variable' => '', // Set a different name for your global variable other than the opt_name\n 'dev_mode' => false, // Show the time the page took to load, etc\n 'customizer' => true, // Enable basic customizer support\n // OPTIONAL -> Give you extra features\n 'page_priority' => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.\n 'page_parent' => 'themes.php', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters\n 'page_permissions' => 'manage_options', // Permissions needed to access the options panel.\n 'menu_icon' => '', // Specify a custom URL to an icon\n 'last_tab' => '', // Force your panel to always open to a specific tab (by id)\n 'page_icon' => 'icon-themes', // Icon displayed in the admin panel next to your menu_title\n 'page_slug' => '_options', // Page slug used to denote the panel\n 'save_defaults' => true, // On load save the defaults to DB before user clicks save or not\n 'default_show' => false, // If true, shows the default value next to each field that is not the default value.\n 'default_mark' => '', // What to print by the field's title if the value shown is default. Suggested: *\n // CAREFUL -> These options are for advanced use only\n 'transient_time' => 60 * MINUTE_IN_SECONDS,\n 'output' => true, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output\n 'output_tag' => true, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head\n //'domain' \t=> 'redux-framework', // Translation domain key. Don't change this unless you want to retranslate all of Redux.\n //'footer_credit' \t=> '', // Disable the footer credit of Redux. Please leave if you can help it.\n // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.\n 'database' => '', // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!\n 'show_import_export' => true, // REMOVE\n 'system_info' => false, // REMOVE\n 'help_tabs' => array(),\n 'help_sidebar' => '', // __( '', $this->args['domain'] ); \n );\n $this->args['share_icons'][] = array(\n 'url' => 'https://twitter.com/marstheme',\n 'title' => 'Follow us on Twitter',\n 'icon' => 'el-icon-twitter'\n );\n // Panel Intro text -> before the form\n if (!isset($this->args['global_variable']) || $this->args['global_variable'] !== false) {\n if (!empty($this->args['global_variable'])) {\n $v = $this->args['global_variable'];\n } else {\n $v = str_replace(\"-\", \"_\", $this->args['opt_name']);\n }\n $this->args['intro_text'] = sprintf(__('<p>Did you know that Redux sets a global variable for you? To access any of your saved options from within your code you can use your global variable: <strong>$%1$s</strong></p>', 'neat'), $v);\n } else {\n $this->args['intro_text'] = __('<p>This text is displayed above the options panel. It isn\\'t required, but more info is always better! The intro_text field accepts all HTML.</p>', 'neat');\n }\n\n // Add content after the form.\n //$this->args['footer_text'] = __('<p>This text is displayed below the options panel. It isn\\'t required, but more info is always better! The footer_text field accepts all HTML.</p>', 'neat');\n }", "protected function set_new_menu_params() {\n\t\t$this->menu_args['menu-item-title'] = !empty( $_POST['premise_post_title'] ) ? $_POST['premise_post_title'] : '';\n\t\t$this->menu_args['menu-item-url'] = !empty( $_POST['premise_post_url'] ) ? $_POST['premise_post_url'] : '';\n\t\t$this->menu_args['menu-item-object-id'] = !empty( $_POST['premise_post_object_id'] ) ? $_POST['premise_post_object_id'] : '';\n\t\t$this->menu_args['menu-item-object'] = !empty( $_POST['premise_post_object'] ) ? $_POST['premise_post_object'] : '';\n\t}", "function wp_parse_args($args, $defaults = array())\n {\n }", "public function applyDefaultValues()\n\t{\n\t\t$this->type = 1;\n\t\t$this->total_index = 0;\n\t\t$this->is_published = true;\n\t\t$this->is_featured = false;\n\t\t$this->comments_count = 0;\n\t}", "function adminDefault() {\n\t\t\n\t\t// load intro and options\n\t\t$this->content = new BlogPostIntro();\n\t\t$this->content->loadContent($GLOBALS['objPage']->id);\n\t\t\n\t\t// load confirmation\n\t\t$this->confirm = new CmsContent();\n\t\t$this->confirm->loadContent($GLOBALS['objPage']->id, 'confirm');\n\t\t\n\t\t// load no access message\n\t\t$this->noaccess = new CmsContent();\n\t\t$this->noaccess->loadContent($GLOBALS['objPage']->id, 'noaccess');\n\t\t\n\t\tif ($GLOBALS['confModule']['blog_post']['editor_full']) {\n\t\t\t$this->content->initAdmin('full',2);\n\t\t\t$this->confirm->initAdmin('full',2);\n\t\t\t$this->noaccess->initAdmin('full',2);\n\t\t} else {\n\t\t\t$this->content->initAdmin('Default',1);\n\t\t\t$this->confirm->initAdmin('Default',1);\n\t\t\t$this->noaccess->initAdmin('Default',1);\n\t\t}\n\t\t\n\t\t$this->data = new ContentBlogPost();\n\t\t$this->data->loadPostsList(true);\n\t\t\n\t\t// only if on page\n\t\t$GLOBALS['objCms']->initSubmitting(1,2); // save and save and close\n\n\t\t$this->baseLink = CMS_WWW_URI.'admin/special.php?module=blog';\n\t\t$this->setView('admin');\n\t\t\n\t}", "function default_location() {\n\n return array(\n array(\n 'param' => 'post_type',\n 'operator' => '==',\n 'value' => 'post',\n )\n );\n }", "function bwrt_default_pages( WP_Site $site, array $args ) {\n // Get template pages\n $templates = bwrt_get_default_pages();\n\n if ( empty($templates) ) {\n return;\n }\n\n switch_to_blog( $site->id );\n\n // Create pages on new site\n foreach ( $templates as $template ) {\n if ( is_object($template) && $template instanceof WP_Post ) {\n\n $result = wp_insert_post(\n array(\n 'post_title' => $template->post_title,\n 'post_name' => $template->post_name,\n 'post_content' => $template->post_content,\n 'post_status' => 'publish',\n 'post_author' => $args['user_id'],\n 'post_type' => 'page',\n 'menu_order' => 1,\n 'comment_status' => 'closed',\n 'ping_status' => 'closed',\n )\n );\n\n if ( is_wp_error( $result ) ) {\n error_log( 'Error adding BWR Template: ' . print_r( $result, true ) );\n }\n }\n }\n\n // Delete WP Sample Page\n $default_page = get_page_by_title( 'Sample Page' );\n wp_delete_post( $default_page->ID );\n\n restore_current_blog();\n}", "public function getDefaultParams();", "function tb_default_options() {\n $defaults = array (\n 'banner_id' => '',\n 'banner_link' => '',\n 'city' => ''\n );\n return apply_filters( \"tb_default_options\", $defaults );\n}", "public function getDefaultParameters();", "public function getDefaultParameters();", "public function setArguments() {\n\n $theme = wp_get_theme(); // For use with some settings. Not necessary.\n\n $this->args = array(\n // TYPICAL -> Change these values as you need/desire\n 'opt_name' => 'tb_options',\n // This is where your data is stored in the database and also becomes your global variable name.\n 'display_name' => $theme->get( 'Name' ),\n // Name that appears at the top of your panel\n 'display_version' => $theme->get( 'Version' ),\n // Version that appears at the top of your panel\n 'menu_type' => 'menu',\n //Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only)\n 'allow_sub_menu' => true,\n // Show the sections below the admin menu item or not\n 'menu_title' => __( 'Theme Options', 'slova' ),\n 'page_title' => __( 'Theme Options', 'slova' ),\n // You will need to generate a Google API key to use this feature.\n // Please visit: https://developers.google.com/fonts/docs/developer_api#Auth\n 'google_api_key' => '',\n // Set it you want google fonts to update weekly. A google_api_key value is required.\n 'google_update_weekly' => false,\n // Must be defined to add google fonts to the typography module\n 'async_typography' => true,\n // Use a asynchronous font on the front end or font string\n //'disable_google_fonts_link' => true, // Disable this in case you want to create your own google fonts loader\n 'admin_bar' => true,\n // Show the panel pages on the admin bar\n 'admin_bar_icon' => 'dashicons-portfolio',\n // Choose an icon for the admin bar menu\n 'admin_bar_priority' => 50,\n // Choose an priority for the admin bar menu\n 'global_variable' => '',\n // Set a different name for your global variable other than the opt_name\n 'dev_mode' => false,\n // Show the time the page took to load, etc\n 'update_notice' => false,\n // If dev_mode is enabled, will notify developer of updated versions available in the GitHub Repo\n 'customizer' => true,\n // Enable basic customizer support\n //'open_expanded' => true, // Allow you to start the panel in an expanded way initially.\n //'disable_save_warn' => true, // Disable the save warning when a user changes a field\n\n // OPTIONAL -> Give you extra features\n 'page_priority' => null,\n // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.\n 'page_parent' => 'themes.php',\n // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters\n 'page_permissions' => 'manage_options',\n // Permissions needed to access the options panel.\n 'menu_icon' => '',\n // Specify a custom URL to an icon\n 'last_tab' => '',\n // Force your panel to always open to a specific tab (by id)\n 'page_icon' => 'icon-themes',\n // Icon displayed in the admin panel next to your menu_title\n 'page_slug' => '_options',\n // Page slug used to denote the panel\n 'save_defaults' => true,\n // On load save the defaults to DB before user clicks save or not\n 'default_show' => false,\n // If true, shows the default value next to each field that is not the default value.\n 'default_mark' => '',\n // What to print by the field's title if the value shown is default. Suggested: *\n 'show_import_export' => true,\n // Shows the Import/Export panel when not used as a field.\n\n // CAREFUL -> These options are for advanced use only\n 'transient_time' => 60 * MINUTE_IN_SECONDS,\n 'output' => true,\n // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output\n 'output_tag' => true,\n // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head\n // 'footer_credit' => '', // Disable the footer credit of Redux. Please leave if you can help it.\n\n // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.\n 'database' => '',\n // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!\n 'system_info' => false,\n // REMOVE\n\n // HINTS\n 'hints' => array(\n 'icon' => 'icon-question-sign',\n 'icon_position' => 'right',\n 'icon_color' => 'lightgray',\n 'icon_size' => 'normal',\n 'tip_style' => array(\n 'color' => 'light',\n 'shadow' => true,\n 'rounded' => false,\n 'style' => '',\n ),\n 'tip_position' => array(\n 'my' => 'top left',\n 'at' => 'bottom right',\n ),\n 'tip_effect' => array(\n 'show' => array(\n 'effect' => 'slide',\n 'duration' => '500',\n 'event' => 'mouseover',\n ),\n 'hide' => array(\n 'effect' => 'slide',\n 'duration' => '500',\n 'event' => 'click mouseleave',\n ),\n ),\n )\n );\n\t\t\t\t\n // SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.\n $this->args['share_icons'][] = array(\n 'url' => '#',\n 'title' => 'Visit us on GitHub',\n 'icon' => 'el-icon-github'\n //'img' => '', // You can use icon OR img. IMG needs to be a full URL.\n );\n $this->args['share_icons'][] = array(\n 'url' => '#',\n 'title' => 'Like us on Facebook',\n 'icon' => 'el-icon-facebook'\n );\n $this->args['share_icons'][] = array(\n 'url' => '#',\n 'title' => 'Follow us on Twitter',\n 'icon' => 'el-icon-twitter'\n );\n $this->args['share_icons'][] = array(\n 'url' => '#',\n 'title' => 'Find us on LinkedIn',\n 'icon' => 'el-icon-linkedin'\n );\n }", "function applyDefaults()\n {\n list($page, $action) = $this->controller->getActionName();\n $fe =& PEAR_PackageFileManager_Frontend::singleton();\n $fe->log('debug',\n str_pad($this->getAttribute('id') .'('. __LINE__ .')', 20, '.') .\n \" applyDefaults ActionName=($page,$action)\"\n );\n }" ]
[ "0.6301038", "0.6133395", "0.60831714", "0.6061171", "0.5944418", "0.5856443", "0.5796426", "0.576162", "0.5754492", "0.5735988", "0.56655335", "0.56044525", "0.5584979", "0.55499923", "0.5523067", "0.551069", "0.55074257", "0.54819846", "0.5405473", "0.5364972", "0.5360249", "0.53483284", "0.53435725", "0.53204066", "0.5315727", "0.5312722", "0.5312663", "0.5312663", "0.53000367", "0.5299209" ]
0.790967
0
Set icon paths Sets the URLs and file system paths for the social media icons, which can also be customized via filters.
private function setIconPaths() { // Directory URL and path $plugin = CGIT_SOCIALIZE_PLUGIN; $dir = 'icons'; $url = plugin_dir_url($plugin) . $dir; $path = plugin_dir_path($plugin) . $dir; // Apply filters for customization $ext = apply_filters('cgit_socialize_icon_extension', '.svg'); $url = apply_filters('cgit_socialize_icon_url', $url); $path = apply_filters('cgit_socialize_icon_path', $path); // Make sure directories have trailing slashes $url = trailingslashit($url); $path = trailingslashit($path); // Add URLs and paths to each network foreach ($this->networks as $key => $value) { $this->networks[$key]['icon'] = $url . $key . $ext; $this->networks[$key]['icon_path'] = $path . $key . $ext; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setIcons() {\n\t\t$this->icons = array(\n\t\t\t'slider' => $this->getSkinURI().'/assets/img/admin-logo-icon.png',\n\t\t\t'carousel' => $this->getSkinURI().'/assets/img/admin-logo-icon.png',\n\t\t\t'testimonial' => $this->getSkinURI().'/assets/img/admin-logo-icon.png',\n\t\t\t'portfolio' => $this->getSkinURI().'/assets/img/admin-logo-icon.png',\n\t\t\t'options' => 'dashicons-admin-generic'\n\t\t);\n\t}", "public static function addIconPath($path) {\n\t\tstatic::$iconPaths[] = $path;\n\t}", "function load_icons() {\n themify_get_icon( 'ti-import' );\n themify_get_icon( 'ti-export' );\n Themify_Enqueue_Assets::loadIcons();\n }", "public function set_icon_sizes($sizes)\n {\n $this->icon_sizes = $sizes;\n }", "static public function get_social_icons() {\n\t\t$icons = array(\n\t\t\t'' => '',\n\t\t\t'im-icon-google-plus' => 'Google Plus',\n\t\t\t'im-icon-google-drive' => 'Google Drive',\n\t\t\t'im-icon-facebook' => 'Facebook',\n\t\t\t'im-icon-instagram' => 'Instagram',\n\t\t\t'fa-icon-instagram' => 'Instagram (2)',\n\t\t\t'im-icon-twitter' => 'Twitter',\n\t\t\t'im-icon-feed-2' => 'RSS',\n\t\t\t'im-icon-youtube' => 'Youtube',\n\t\t\t'im-icon-vimeo' => 'Vimeo',\n\t\t\t'im-icon-flickr' => 'Flickr',\n\t\t\t'im-icon-picassa' => 'Picassa',\n\t\t\t'im-icon-dribble' => 'Dribbble',\n\t\t\t'im-icon-deviantart-2' => 'Deviantart',\n\t\t\t'im-icon-forrst' => 'Forrst',\n\t\t\t'im-icon-steam' => 'Steam',\n\t\t\t'im-icon-github-3' => 'Github',\n\t\t\t'im-icon-wordpress' => 'Wordpress',\n\t\t\t'im-icon-joomla' => 'Joomla',\n\t\t\t'im-icon-blogger' => 'Blogger',\n\t\t\t'im-icon-tumblt' => 'Tumblt',\n\t\t\t'im-icon-yahoo' => 'Yahoo',\n\t\t\t'im-icon-skype' => 'Skype',\n\t\t\t'im-icon-reddit' => 'Reddit',\n\t\t\t'im-icon-linkedin' => 'Linkedin',\n\t\t\t'im-icon-lastfm' => 'Lastfm',\n\t\t\t'im-icon-delicious' => 'Delicious',\n\t\t\t'im-icon-stumbleupon' => 'Stumbleupon',\n\t\t\t'im-icon-stackoveratom' => 'Stackoveratom',\n\t\t\t'im-icon-pinterest-2' => 'Pinterest',\n\t\t\t'im-icon-xing' => 'Xing',\n\t\t\t'im-icon-flattr' => 'Flattr',\n\t\t\t'im-icon-foursquare-2' => 'Foursquare',\n\t\t\t'im-icon-yelp' => 'Yelp',\n\t\t\t'fa-icon-renren' => 'Renren',\n\t\t\t'fa-icon-vk' => 'Vk',\n\t\t\t'fa-icon-stackexchange' => 'Stackexchange',\n\t\t );\n\t\tasort( $icons );\n\t\treturn $icons;\n\t}", "public function prepare_icon_set() {\n\n\t\t\tif ( empty( $this->settings['icon_data']['icons'] ) ) {\n\t\t\t\t$this->maybe_parse_set_from_css();\n\t\t\t}\n\n\t\t\tif ( ! array_key_exists( $this->settings['icon_data']['icon_set'], self::$sets ) ) {\n\t\t\t\tself::$sets[ $this->settings['icon_data']['icon_set'] ] = array(\n\t\t\t\t\t'iconCSS' => $this->settings['icon_data']['icon_css'],\n\t\t\t\t\t'iconBase' => $this->settings['icon_data']['icon_base'],\n\t\t\t\t\t'iconPrefix' => $this->settings['icon_data']['icon_prefix'],\n\t\t\t\t\t'icons' => $this->settings['icon_data']['icons'],\n\t\t\t\t);\n\t\t\t}\n\t\t}", "public function setIcon($icon);", "protected function buildCssAndRegisterIcons() {}", "function register_block_core_site_icon_setting()\n {\n }", "function h_get_social_icon($slug = null) {\n $list = apply_filters('h_social_icons', [\n 'facebook' => [\n 'label' => __( 'Facebook' ),\n 'color' => '#1977f2',\n 'placeholder' => 'https://www.facebook.com/your-page',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z\"></path></svg>',\n ],\n\n 'twitter' => [\n 'label' => __( 'Twitter' ),\n 'color' => '#21a1f3',\n 'placeholder' => 'https://twitter.com/your-username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M22.23,5.924c-0.736,0.326-1.527,0.547-2.357,0.646c0.847-0.508,1.498-1.312,1.804-2.27 c-0.793,0.47-1.671,0.812-2.606,0.996C18.324,4.498,17.257,4,16.077,4c-2.266,0-4.103,1.837-4.103,4.103 c0,0.322,0.036,0.635,0.106,0.935C8.67,8.867,5.647,7.234,3.623,4.751C3.27,5.357,3.067,6.062,3.067,6.814 c0,1.424,0.724,2.679,1.825,3.415c-0.673-0.021-1.305-0.206-1.859-0.513c0,0.017,0,0.034,0,0.052c0,1.988,1.414,3.647,3.292,4.023 c-0.344,0.094-0.707,0.144-1.081,0.144c-0.264,0-0.521-0.026-0.772-0.074c0.522,1.63,2.038,2.816,3.833,2.85 c-1.404,1.1-3.174,1.756-5.096,1.756c-0.331,0-0.658-0.019-0.979-0.057c1.816,1.164,3.973,1.843,6.29,1.843 c7.547,0,11.675-6.252,11.675-11.675c0-0.178-0.004-0.355-0.012-0.531C20.985,7.47,21.68,6.747,22.23,5.924z\"></path></svg>',\n ],\n\n 'instagram' => [\n 'label' => __( 'Instagram' ),\n 'color' => '#f00075',\n 'placeholder' => 'https://instagram.com/your-username',\n 'svg' => '<svg width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12,4.622c2.403,0,2.688,0.009,3.637,0.052c0.877,0.04,1.354,0.187,1.671,0.31c0.42,0.163,0.72,0.358,1.035,0.673 c0.315,0.315,0.51,0.615,0.673,1.035c0.123,0.317,0.27,0.794,0.31,1.671c0.043,0.949,0.052,1.234,0.052,3.637 s-0.009,2.688-0.052,3.637c-0.04,0.877-0.187,1.354-0.31,1.671c-0.163,0.42-0.358,0.72-0.673,1.035 c-0.315,0.315-0.615,0.51-1.035,0.673c-0.317,0.123-0.794,0.27-1.671,0.31c-0.949,0.043-1.233,0.052-3.637,0.052 s-2.688-0.009-3.637-0.052c-0.877-0.04-1.354-0.187-1.671-0.31c-0.42-0.163-0.72-0.358-1.035-0.673 c-0.315-0.315-0.51-0.615-0.673-1.035c-0.123-0.317-0.27-0.794-0.31-1.671C4.631,14.688,4.622,14.403,4.622,12 s0.009-2.688,0.052-3.637c0.04-0.877,0.187-1.354,0.31-1.671c0.163-0.42,0.358-0.72,0.673-1.035 c0.315-0.315,0.615-0.51,1.035-0.673c0.317-0.123,0.794-0.27,1.671-0.31C9.312,4.631,9.597,4.622,12,4.622 M12,3 C9.556,3,9.249,3.01,8.289,3.054C7.331,3.098,6.677,3.25,6.105,3.472C5.513,3.702,5.011,4.01,4.511,4.511 c-0.5,0.5-0.808,1.002-1.038,1.594C3.25,6.677,3.098,7.331,3.054,8.289C3.01,9.249,3,9.556,3,12c0,2.444,0.01,2.751,0.054,3.711 c0.044,0.958,0.196,1.612,0.418,2.185c0.23,0.592,0.538,1.094,1.038,1.594c0.5,0.5,1.002,0.808,1.594,1.038 c0.572,0.222,1.227,0.375,2.185,0.418C9.249,20.99,9.556,21,12,21s2.751-0.01,3.711-0.054c0.958-0.044,1.612-0.196,2.185-0.418 c0.592-0.23,1.094-0.538,1.594-1.038c0.5-0.5,0.808-1.002,1.038-1.594c0.222-0.572,0.375-1.227,0.418-2.185 C20.99,14.751,21,14.444,21,12s-0.01-2.751-0.054-3.711c-0.044-0.958-0.196-1.612-0.418-2.185c-0.23-0.592-0.538-1.094-1.038-1.594 c-0.5-0.5-1.002-0.808-1.594-1.038c-0.572-0.222-1.227-0.375-2.185-0.418C14.751,3.01,14.444,3,12,3L12,3z M12,7.378 c-2.552,0-4.622,2.069-4.622,4.622S9.448,16.622,12,16.622s4.622-2.069,4.622-4.622S14.552,7.378,12,7.378z M12,15 c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S13.657,15,12,15z M16.804,6.116c-0.596,0-1.08,0.484-1.08,1.08 s0.484,1.08,1.08,1.08c0.596,0,1.08-0.484,1.08-1.08S17.401,6.116,16.804,6.116z\"></path></svg>',\n ],\n\n 'whatsapp' => [\n 'label' => __( 'WhatsApp' ),\n 'color' => '#25d366',\n 'placeholder' => 'https://wa.me/6281234567890',\n 'svg' => '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 448 512\"><path d=\"M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z\"/></svg>'\n // 'svg' => '<svg width=\"18\" height=\"18\" viewBox=\"0 0 20 20\">\n // <path d=\"M10,0C4.5,0,0,4.5,0,10c0,1.9,0.5,3.6,1.4,5.1L0.1,20l5-1.3C6.5,19.5,8.2,20,10,20c5.5,0,10-4.5,10-10S15.5,0,10,0zM6.6,5.3c0.2,0,0.3,0,0.5,0c0.2,0,0.4,0,0.6,0.4c0.2,0.5,0.7,1.7,0.8,1.8c0.1,0.1,0.1,0.3,0,0.4C8.3,8.2,8.3,8.3,8.1,8.5C8,8.6,7.9,8.8,7.8,8.9C7.7,9,7.5,9.1,7.7,9.4c0.1,0.2,0.6,1.1,1.4,1.7c0.9,0.8,1.7,1.1,2,1.2c0.2,0.1,0.4,0.1,0.5-0.1c0.1-0.2,0.6-0.7,0.8-1c0.2-0.2,0.3-0.2,0.6-0.1c0.2,0.1,1.4,0.7,1.7,0.8s0.4,0.2,0.5,0.3c0.1,0.1,0.1,0.6-0.1,1.2c-0.2,0.6-1.2,1.1-1.7,1.2c-0.5,0-0.9,0.2-3-0.6c-2.5-1-4.1-3.6-4.2-3.7c-0.1-0.2-1-1.3-1-2.6c0-1.2,0.6-1.8,0.9-2.1C6.1,5.4,6.4,5.3,6.6,5.3z\"/>\n // </svg>',\n ],\n\n 'phone' => [\n 'label' => __( 'Phone' ),\n 'color' => 'var(--main)',\n 'placeholder' => 'tel:+12-3456-789',\n 'svg' => '<svg width=\"18\" height=\"18\" viewBox=\"0 0 512 512\"><path d=\"M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z\"/></svg>',\n ],\n\n 'email' => [\n 'label' => __( 'Email' ),\n 'color' => 'var(--main)',\n 'placeholder' => 'mailto:[email protected]',\n 'svg' => '<svg width=\"18\" height=\"18\" viewBox=\"0 0 512 512\"><path d=\"M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z\"/></svg>',\n ],\n\n 'location' => [\n 'label' => __( 'Location' ),\n 'color' => 'var(--main)',\n 'placeholder' => 'https://goo.gl/maps/abcdefghij',\n 'svg' => '<svg width=\"18\" height=\"18\" viewBox=\"0 0 384 512\"><path d=\"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z\"/></svg>',\n ],\n\n 'fax' => [\n 'label' => __( 'Fax' ),\n 'color' => 'var(--main)',\n 'placeholder' => 'fax:+1234567890',\n 'svg' => '<svg width=\"18\" height=\"18\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M480 160V77.25a32 32 0 0 0-9.38-22.63L425.37 9.37A32 32 0 0 0 402.75 0H160a32 32 0 0 0-32 32v448a32 32 0 0 0 32 32h320a32 32 0 0 0 32-32V192a32 32 0 0 0-32-32zM288 432a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16zm0-128a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16zm128 128a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16zm0-128a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16zm0-112H192V64h160v48a16 16 0 0 0 16 16h48zM64 128H32a32 32 0 0 0-32 32v320a32 32 0 0 0 32 32h32a32 32 0 0 0 32-32V160a32 32 0 0 0-32-32z\"/></svg>',\n ],\n\n 'dribbble' => [\n 'label' => __( 'Dribbble' ),\n 'color' => '#e94c89',\n 'placeholder' => 'https://dribbble.com/username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12,22C6.486,22,2,17.514,2,12S6.486,2,12,2c5.514,0,10,4.486,10,10S17.514,22,12,22z M20.434,13.369 c-0.292-0.092-2.644-0.794-5.32-0.365c1.117,3.07,1.572,5.57,1.659,6.09C18.689,17.798,20.053,15.745,20.434,13.369z M15.336,19.876c-0.127-0.749-0.623-3.361-1.822-6.477c-0.019,0.006-0.038,0.013-0.056,0.019c-4.818,1.679-6.547,5.02-6.701,5.334 c1.448,1.129,3.268,1.803,5.243,1.803C13.183,20.555,14.311,20.313,15.336,19.876z M5.654,17.724 c0.193-0.331,2.538-4.213,6.943-5.637c0.111-0.036,0.224-0.07,0.337-0.102c-0.214-0.485-0.448-0.971-0.692-1.45 c-4.266,1.277-8.405,1.223-8.778,1.216c-0.003,0.087-0.004,0.174-0.004,0.261C3.458,14.207,4.29,16.21,5.654,17.724z M3.639,10.264 c0.382,0.005,3.901,0.02,7.897-1.041c-1.415-2.516-2.942-4.631-3.167-4.94C5.979,5.41,4.193,7.613,3.639,10.264z M9.998,3.709 c0.236,0.316,1.787,2.429,3.187,5c3.037-1.138,4.323-2.867,4.477-3.085C16.154,4.286,14.17,3.471,12,3.471 C11.311,3.471,10.641,3.554,9.998,3.709z M18.612,6.612C18.432,6.855,17,8.69,13.842,9.979c0.199,0.407,0.389,0.821,0.567,1.237 c0.063,0.148,0.124,0.295,0.184,0.441c2.842-0.357,5.666,0.215,5.948,0.275C20.522,9.916,19.801,8.065,18.612,6.612z\"></path></svg>'\n ],\n\n 'github' => [\n 'label' => __( 'Github' ),\n 'color' => '#24292d',\n 'placeholder' => 'https://github.com/username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z\"></path></svg>'\n ],\n\n 'linkedin' => [\n 'label' => __( 'LinkedIn' ),\n 'color' => '#0577b5',\n 'placeholder' => 'https://www.linkedin.com/in/your-username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z\"></path></svg>',\n ],\n\n 'patreon' => [\n 'label' => __( 'Patreon' ),\n 'color' => '#ff424d',\n 'placeholder' => 'https://patreon.com/username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 569 546\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><circle cx=\"363\" cy=\"205\" r=\"205\"></circle><rect width=\"100\" height=\"546\" x=\"0\" y=\"0\"></rect></svg>'\n ],\n\n 'pinterest' => [\n 'label' => __( 'Pinterest' ),\n 'color' => '#e60122',\n 'placeholder' => 'https://pinterest.com/your-username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2\"></path></svg>',\n ],\n\n 'pocket' => [\n 'label' => __( 'Pocket' ),\n 'color' => '#ef4155',\n 'placeholder' => 'https://getpocket.com/',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M21.927,4.194C21.667,3.48,20.982,3,20.222,3h-0.01h-1.721H3.839C3.092,3,2.411,3.47,2.145,4.17 C2.066,4.378,2.026,4.594,2.026,4.814v6.035l0.069,1.2c0.29,2.73,1.707,5.115,3.899,6.778c0.039,0.03,0.079,0.059,0.119,0.089 l0.025,0.018c1.175,0.859,2.491,1.441,3.91,1.727c0.655,0.132,1.325,0.2,1.991,0.2c0.615,0,1.232-0.057,1.839-0.17 c0.073-0.014,0.145-0.028,0.219-0.044c0.02-0.004,0.042-0.012,0.064-0.023c1.359-0.297,2.621-0.864,3.753-1.691l0.025-0.018 c0.04-0.029,0.08-0.058,0.119-0.089c2.192-1.664,3.609-4.049,3.898-6.778l0.069-1.2V4.814C22.026,4.605,22,4.398,21.927,4.194z M17.692,10.481l-4.704,4.512c-0.266,0.254-0.608,0.382-0.949,0.382c-0.342,0-0.684-0.128-0.949-0.382l-4.705-4.512 C5.838,9.957,5.82,9.089,6.344,8.542c0.524-0.547,1.392-0.565,1.939-0.04l3.756,3.601l3.755-3.601 c0.547-0.524,1.415-0.506,1.939,0.04C18.256,9.089,18.238,9.956,17.692,10.481z\"></path></svg>',\n ],\n\n 'skype' => [\n 'label' => __( 'Skype' ),\n 'color' => '#0478d7',\n 'placeholder' => 'skype:your-username?chat',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M10.113,2.699c0.033-0.006,0.067-0.013,0.1-0.02c0.033,0.017,0.066,0.033,0.098,0.051L10.113,2.699z M2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223z M21.275,13.771 c0.007-0.035,0.011-0.071,0.018-0.106c-0.018-0.031-0.033-0.064-0.052-0.095L21.275,13.771z M13.563,21.199 c0.032,0.019,0.065,0.035,0.096,0.053c0.036-0.006,0.071-0.011,0.105-0.017L13.563,21.199z M22,16.386 c0,1.494-0.581,2.898-1.637,3.953c-1.056,1.057-2.459,1.637-3.953,1.637c-0.967,0-1.914-0.251-2.75-0.725 c0.036-0.006,0.071-0.011,0.105-0.017l-0.202-0.035c0.032,0.019,0.065,0.035,0.096,0.053c-0.543,0.096-1.099,0.147-1.654,0.147 c-1.275,0-2.512-0.25-3.676-0.743c-1.125-0.474-2.135-1.156-3.002-2.023c-0.867-0.867-1.548-1.877-2.023-3.002 c-0.493-1.164-0.743-2.401-0.743-3.676c0-0.546,0.049-1.093,0.142-1.628c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103C2.244,9.5,2,8.566,2,7.615c0-1.493,0.582-2.898,1.637-3.953 c1.056-1.056,2.46-1.638,3.953-1.638c0.915,0,1.818,0.228,2.622,0.655c-0.033,0.007-0.067,0.013-0.1,0.02l0.199,0.031 c-0.032-0.018-0.066-0.034-0.098-0.051c0.002,0,0.003-0.001,0.004-0.001c0.586-0.112,1.187-0.169,1.788-0.169 c1.275,0,2.512,0.249,3.676,0.742c1.124,0.476,2.135,1.156,3.002,2.024c0.868,0.867,1.548,1.877,2.024,3.002 c0.493,1.164,0.743,2.401,0.743,3.676c0,0.575-0.054,1.15-0.157,1.712c-0.018-0.031-0.033-0.064-0.052-0.095l0.034,0.201 c0.007-0.035,0.011-0.071,0.018-0.106C21.754,14.494,22,15.432,22,16.386z M16.817,14.138c0-1.331-0.613-2.743-3.033-3.282 l-2.209-0.49c-0.84-0.192-1.807-0.444-1.807-1.237c0-0.794,0.679-1.348,1.903-1.348c2.468,0,2.243,1.696,3.468,1.696 c0.645,0,1.209-0.379,1.209-1.031c0-1.521-2.435-2.663-4.5-2.663c-2.242,0-4.63,0.952-4.63,3.488c0,1.221,0.436,2.521,2.839,3.123 l2.984,0.745c0.903,0.223,1.129,0.731,1.129,1.189c0,0.762-0.758,1.507-2.129,1.507c-2.679,0-2.307-2.062-3.743-2.062 c-0.645,0-1.113,0.444-1.113,1.078c0,1.236,1.501,2.886,4.856,2.886C15.236,17.737,16.817,16.199,16.817,14.138z\"></path></svg>',\n ],\n\n 'reddit' => [\n 'label' => __( 'reddit' ),\n 'color' => '#fe4500',\n 'placeholder' => 'https://www.reddit.com/user/yourname',\n 'svg' => '<svg width=\"20px\" height=\"20px\" viewBox=\"0 0 512 512\">\n <path d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"/></svg>',\n ],\n\n 'telegram' => [\n 'label' => __( 'Telegram' ),\n 'color' => '#08c',\n 'placeholder' => 'https://t.me/your-username',\n 'svg' => '<svg width=\"18\" height=\"20\" viewBox=\"0 0 20 20\">\n <path d=\"M19.9,3.1l-3,14.2c-0.2,1-0.8,1.3-1.7,0.8l-4.6-3.4l-2.2,2.1c-0.2,0.2-0.5,0.5-0.9,0.5l0.3-4.7L16.4,5c0.4-0.3-0.1-0.5-0.6-0.2L5.3,11.4L0.7,10c-1-0.3-1-1,0.2-1.5l17.7-6.8C19.5,1.4,20.2,1.9,19.9,3.1z\"/>\n </svg>',\n ],\n\n 'tiktok' => [\n 'label' => __( 'Tiktok' ),\n 'color' => '#000',\n 'placeholder' => '',\n // 'svg' => '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 448 512\"><path d=\"M448,209.91a210.06,210.06,0,0,1-122.77-39.25V349.38A162.55,162.55,0,1,1,185,188.31V278.2a74.62,74.62,0,1,0,52.23,71.18V0l88,0a121.18,121.18,0,0,0,1.86,22.17h0A122.18,122.18,0,0,0,381,102.39a121.43,121.43,0,0,0,67,20.14Z\"/></svg>',\n 'svg' => '<svg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M16.708 0.027c1.745-0.027 3.48-0.011 5.213-0.027 0.105 2.041 0.839 4.12 2.333 5.563 1.491 1.479 3.6 2.156 5.652 2.385v5.369c-1.923-0.063-3.855-0.463-5.6-1.291-0.76-0.344-1.468-0.787-2.161-1.24-0.009 3.896 0.016 7.787-0.025 11.667-0.104 1.864-0.719 3.719-1.803 5.255-1.744 2.557-4.771 4.224-7.88 4.276-1.907 0.109-3.812-0.411-5.437-1.369-2.693-1.588-4.588-4.495-4.864-7.615-0.032-0.667-0.043-1.333-0.016-1.984 0.24-2.537 1.495-4.964 3.443-6.615 2.208-1.923 5.301-2.839 8.197-2.297 0.027 1.975-0.052 3.948-0.052 5.923-1.323-0.428-2.869-0.308-4.025 0.495-0.844 0.547-1.485 1.385-1.819 2.333-0.276 0.676-0.197 1.427-0.181 2.145 0.317 2.188 2.421 4.027 4.667 3.828 1.489-0.016 2.916-0.88 3.692-2.145 0.251-0.443 0.532-0.896 0.547-1.417 0.131-2.385 0.079-4.76 0.095-7.145 0.011-5.375-0.016-10.735 0.025-16.093z\"></path></svg>'\n ],\n\n 'tumblr' => [\n 'label' => __( 'Tumblr' ),\n 'color' => '#011835',\n 'placeholder' => 'https://www.tumblr.com/blog/yourname',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z\"></path></svg>',\n ],\n\n 'twitch' => [\n 'label' => __( 'Twitch' ),\n 'color' => '#6440a4',\n 'placeholder' => 'https://twitch.tv/username',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M16.499,8.089h-1.636v4.91h1.636V8.089z M12,8.089h-1.637v4.91H12V8.089z M4.228,3.178L3,6.451v13.092h4.499V22h2.456 l2.454-2.456h3.681L21,14.636V3.178H4.228z M19.364,13.816l-2.864,2.865H12l-2.453,2.453V16.68H5.863V4.814h13.501V13.816z\"></path></svg>'\n ],\n\n 'wechat' => [\n 'label' => __( 'WeChat' ),\n 'color' => '#7bb32e',\n 'placeholder' => 'weixin://dl/chat?your-username',\n 'svg' => '<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\">\n <path d=\"M13.5,6.8c0.2,0,0.5,0,0.7,0c-0.6-2.9-3.7-5-7.1-5C3.2,1.9,0,4.5,0,7.9c0,1.9,1.1,3.5,2.8,4.8l-0.7,2.1l2.5-1.2c0.9,0.2,1.6,0.4,2.5,0.4c0.2,0,0.4,0,0.7,0c-0.1-0.5-0.2-1-0.2-1.5C7.5,9.3,10.2,6.8,13.5,6.8L13.5,6.8zM9.7,4.9c0.5,0,0.9,0.4,0.9,0.9c0,0.5-0.4,0.9-0.9,0.9c-0.5,0-1.1-0.4-1.1-0.9C8.7,5.2,9.2,4.9,9.7,4.9zM4.8,6.6c-0.5,0-1.1-0.4-1.1-0.9c0-0.5,0.5-0.9,1.1-0.9c0.5,0,0.9,0.4,0.9,0.9C5.7,6.3,5.3,6.6,4.8,6.6z M20,12.3c0-2.8-2.8-5.1-6-5.1c-3.4,0-6,2.3-6,5.1s2.6,5.1,6,5.1c0.7,0,1.4-0.2,2.1-0.4l1.9,1.1l-0.5-1.8C18.9,15.3,20,13.9,20,12.3zM12,11.4c-0.4,0-0.7-0.4-0.7-0.7c0-0.4,0.4-0.7,0.7-0.7c0.5,0,0.9,0.4,0.9,0.7C12.9,11.1,12.6,11.4,12,11.4zM15.9,11.4c-0.4,0-0.7-0.4-0.7-0.7c0-0.4,0.4-0.7,0.7-0.7c0.5,0,0.9,0.4,0.9,0.7C16.8,11.1,16.5,11.4,15.9,11.4z\"/>\n </svg>',\n ],\n\n 'youtube' => [\n 'label' => __( 'YouTube' ),\n 'color' => '#ff0100',\n 'placeholder' => 'https://www.youtube.com/channel/your-channel',\n 'svg' => '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z\"></path></svg>',\n ],\n ]);\n\n if (isset($slug)) {\n return $list[$slug] ?? trigger_error(\"Social Item \\\"{$slug}\\\" does not exists\");\n }\n\n return $list;\n}", "function anva_social_icons() {\n\t$class = 'normal';\n\t$size = 24;\n\tprintf(\n\t\t'<ul class=\"social-media social-style-%2$s social-icon-%3$s\">%1$s</ul>',\n\t\tanva_social_media(),\n\t\tapply_filters( 'anva_social_media_style', $class ),\n\t\tapply_filters( 'anva_social_media_size', $size )\n\t);\n}", "function bridge_qode_register_social_icon_widget( $widgets ) {\n\t\t$widgets[] = 'BridgeQodeSocialIcon';\n\n\t\treturn $widgets;\n\t}", "function ds_register_social_icons_widget() {\n\tregister_widget( 'ds_Social_Icons_Widget' );\n}", "protected function setIconPath($list) {\n $module = $this->getModule();\n $config = Pi::config('', $module);\n\n $rootPath = $this->rootPath();\n $rootUrl = $this->rootUrl();\n $uploadPath = $this->tmpPath();\n $uploadUrl = $this->tmpUrl();\n $prefixLen = strlen($uploadUrl);\n\n $items = array();\n foreach ($list as $item) {\n if ($uploadUrl == substr($item['icon'], 0, $prefixLen)) {\n $imgName = substr($item['icon'], $prefixLen);\n $renamed = rename(\n $uploadPath . $imgName,\n $rootPath . $imgName\n );\n if ($renamed) {\n $item['image'] = $rootUrl . '/' . $imgName;\n $item['filename'] = $imgName;\n }\n }\n $items[] = $item;\n }\n\n return $items;\n }", "function my_social_media_icons() {\n\t$social_sites = my_customizer_social_media_array();\n\t/* any inputs that aren't empty are stored in $active_sites array */\n\tforeach($social_sites as $social_site) {\n\t\tif( strlen( get_theme_mod( $social_site ) ) > 0 ) {\n\t\t$active_sites[] = $social_site;\n\t\t}\n\t}\n\t/* for each active social site, add it as a list item */\n\tif ( ! empty( $active_sites ) ) {\n\t\techo \"<ul class='social-media-icons'>\";\n\t\tforeach ( $active_sites as $active_site ) {\n\t\t\t/* setup the class */\n\t\t\t$class = 'fab fa-' . $active_site;\n\t\t\tif ( $active_site == 'email' ) {\n\t\t\t?>\n\t\t\t<li>\n\t\t\t<a class=\"email\" target=\"_blank\" href=\"mailto:<?php echo antispambot( is_email( get_theme_mod( $active_site ) ) ); ?>\">\n\t\t\t<i class=\"fab fa-envelope\" title=\"<?php _e('email icon', 'text-domain'); ?>\"></i>\n\t\t\t</a>\n\t\t\t</li>\n\t\t\t<?php } else { ?>\n\t\t\t<li>\n\t\t\t<a class=\"<?php echo $active_site; ?>\" target=\"_blank\" href=\"<?php echo esc_url( get_theme_mod( $active_site) ); ?>\">\n\t\t\t<i class=\"<?php echo esc_attr( $class ); ?>\" title=\"<?php printf( __('%s icon', 'text-domain'), $active_site ); ?>\"></i>\n\t\t\t</a>\n\t\t\t</li>\n\t\t\t<?php\n\t\t\t}\n\t\t}\n\t\techo \"</ul>\";\n\t}\n}", "function atom_site_icon()\n {\n }", "function klippe_mikado_register_social_icons_widget( $widgets ) {\n\t\t$widgets[] = 'KlippeMikadoClassIconsGroupWidget';\n\t\t\n\t\treturn $widgets;\n\t}", "protected function register_content_social_icons_controls() {\n\t\t$this->start_controls_section(\n\t\t\t'section_social_icon',\n\t\t\tarray(\n\t\t\t\t'label' => 'Social Icons',\n\t\t\t)\n\t\t);\n\n\t\t$this->add_control(\n\t\t\t'social_icons_settings',\n\t\t\tarray(\n\t\t\t\t'label' => __( 'Social Icons', 'uael' ),\n\t\t\t\t'type' => \\Elementor\\Controls_Manager::SWITCHER,\n\t\t\t\t'label_on' => __( 'Show', 'uael' ),\n\t\t\t\t'label_off' => __( 'Hide', 'uael' ),\n\t\t\t\t'return_value' => 'yes',\n\t\t\t\t'default' => 'yes',\n\t\t\t)\n\t\t);\n\n\t\t$repeater = new Repeater();\n\n\t\tif ( UAEL_Helper::is_elementor_updated() ) {\n\t\t\t$repeater->add_control(\n\t\t\t\t'new_social',\n\t\t\t\tarray(\n\t\t\t\t\t'label' => __( 'Icon', 'uael' ),\n\t\t\t\t\t'type' => Controls_Manager::ICONS,\n\t\t\t\t\t'fa4compatibility' => 'social',\n\t\t\t\t\t'label_block' => true,\n\t\t\t\t\t'default' => array(\n\t\t\t\t\t\t'value' => 'fab fa-wordpress',\n\t\t\t\t\t\t'library' => 'fa-brands',\n\t\t\t\t\t),\n\t\t\t\t\t'recommended' => array(\n\t\t\t\t\t\t'fa-brands' => array(\n\t\t\t\t\t\t\t'android',\n\t\t\t\t\t\t\t'apple',\n\t\t\t\t\t\t\t'behance',\n\t\t\t\t\t\t\t'bitbucket',\n\t\t\t\t\t\t\t'codepen',\n\t\t\t\t\t\t\t'delicious',\n\t\t\t\t\t\t\t'deviantart',\n\t\t\t\t\t\t\t'digg',\n\t\t\t\t\t\t\t'dribbble',\n\t\t\t\t\t\t\t'elementor',\n\t\t\t\t\t\t\t'facebook',\n\t\t\t\t\t\t\t'flickr',\n\t\t\t\t\t\t\t'foursquare',\n\t\t\t\t\t\t\t'free-code-camp',\n\t\t\t\t\t\t\t'github',\n\t\t\t\t\t\t\t'gitlab',\n\t\t\t\t\t\t\t'globe',\n\t\t\t\t\t\t\t'google-plus',\n\t\t\t\t\t\t\t'houzz',\n\t\t\t\t\t\t\t'instagram',\n\t\t\t\t\t\t\t'jsfiddle',\n\t\t\t\t\t\t\t'linkedin',\n\t\t\t\t\t\t\t'medium',\n\t\t\t\t\t\t\t'meetup',\n\t\t\t\t\t\t\t'mixcloud',\n\t\t\t\t\t\t\t'odnoklassniki',\n\t\t\t\t\t\t\t'pinterest',\n\t\t\t\t\t\t\t'product-hunt',\n\t\t\t\t\t\t\t'reddit',\n\t\t\t\t\t\t\t'shopping-cart',\n\t\t\t\t\t\t\t'skype',\n\t\t\t\t\t\t\t'slideshare',\n\t\t\t\t\t\t\t'snapchat',\n\t\t\t\t\t\t\t'soundcloud',\n\t\t\t\t\t\t\t'spotify',\n\t\t\t\t\t\t\t'stack-overflow',\n\t\t\t\t\t\t\t'steam',\n\t\t\t\t\t\t\t'stumbleupon',\n\t\t\t\t\t\t\t'telegram',\n\t\t\t\t\t\t\t'thumb-tack',\n\t\t\t\t\t\t\t'tripadvisor',\n\t\t\t\t\t\t\t'tumblr',\n\t\t\t\t\t\t\t'twitch',\n\t\t\t\t\t\t\t'twitter',\n\t\t\t\t\t\t\t'viber',\n\t\t\t\t\t\t\t'vimeo',\n\t\t\t\t\t\t\t'vk',\n\t\t\t\t\t\t\t'weibo',\n\t\t\t\t\t\t\t'weixin',\n\t\t\t\t\t\t\t'whatsapp',\n\t\t\t\t\t\t\t'wordpress',\n\t\t\t\t\t\t\t'xing',\n\t\t\t\t\t\t\t'yelp',\n\t\t\t\t\t\t\t'youtube',\n\t\t\t\t\t\t\t'500px',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'fa-solid' => array(\n\t\t\t\t\t\t\t'envelope',\n\t\t\t\t\t\t\t'link',\n\t\t\t\t\t\t\t'rss',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\t$repeater->add_control(\n\t\t\t\t'social',\n\t\t\t\tarray(\n\t\t\t\t\t'label' => __( 'Icon', 'uael' ),\n\t\t\t\t\t'type' => Controls_Manager::ICON,\n\t\t\t\t\t'label_block' => true,\n\t\t\t\t\t'default' => 'fa fa-wordpress',\n\t\t\t\t\t'include' => array(\n\t\t\t\t\t\t'fa fa-android',\n\t\t\t\t\t\t'fa fa-apple',\n\t\t\t\t\t\t'fa fa-behance',\n\t\t\t\t\t\t'fa fa-bitbucket',\n\t\t\t\t\t\t'fa fa-codepen',\n\t\t\t\t\t\t'fa fa-delicious',\n\t\t\t\t\t\t'fa fa-deviantart',\n\t\t\t\t\t\t'fa fa-digg',\n\t\t\t\t\t\t'fa fa-dribbble',\n\t\t\t\t\t\t'fa fa-envelope',\n\t\t\t\t\t\t'fa fa-facebook',\n\t\t\t\t\t\t'fa fa-flickr',\n\t\t\t\t\t\t'fa fa-foursquare',\n\t\t\t\t\t\t'fa fa-free-code-camp',\n\t\t\t\t\t\t'fa fa-github',\n\t\t\t\t\t\t'fa fa-gitlab',\n\t\t\t\t\t\t'fa fa-google-plus',\n\t\t\t\t\t\t'fa fa-houzz',\n\t\t\t\t\t\t'fa fa-instagram',\n\t\t\t\t\t\t'fa fa-jsfiddle',\n\t\t\t\t\t\t'fa fa-linkedin',\n\t\t\t\t\t\t'fa fa-medium',\n\t\t\t\t\t\t'fa fa-meetup',\n\t\t\t\t\t\t'fa fa-mixcloud',\n\t\t\t\t\t\t'fa fa-odnoklassniki',\n\t\t\t\t\t\t'fa fa-pinterest',\n\t\t\t\t\t\t'fa fa-product-hunt',\n\t\t\t\t\t\t'fa fa-reddit',\n\t\t\t\t\t\t'fa fa-rss',\n\t\t\t\t\t\t'fa fa-shopping-cart',\n\t\t\t\t\t\t'fa fa-skype',\n\t\t\t\t\t\t'fa fa-slideshare',\n\t\t\t\t\t\t'fa fa-snapchat',\n\t\t\t\t\t\t'fa fa-soundcloud',\n\t\t\t\t\t\t'fa fa-spotify',\n\t\t\t\t\t\t'fa fa-stack-overflow',\n\t\t\t\t\t\t'fa fa-steam',\n\t\t\t\t\t\t'fa fa-stumbleupon',\n\t\t\t\t\t\t'fa fa-telegram',\n\t\t\t\t\t\t'fa fa-thumb-tack',\n\t\t\t\t\t\t'fa fa-tripadvisor',\n\t\t\t\t\t\t'fa fa-tumblr',\n\t\t\t\t\t\t'fa fa-twitch',\n\t\t\t\t\t\t'fa fa-twitter',\n\t\t\t\t\t\t'fa fa-vimeo',\n\t\t\t\t\t\t'fa fa-vk',\n\t\t\t\t\t\t'fa fa-weibo',\n\t\t\t\t\t\t'fa fa-weixin',\n\t\t\t\t\t\t'fa fa-whatsapp',\n\t\t\t\t\t\t'fa fa-wordpress',\n\t\t\t\t\t\t'fa fa-xing',\n\t\t\t\t\t\t'fa fa-yelp',\n\t\t\t\t\t\t'fa fa-youtube',\n\t\t\t\t\t\t'fa fa-500px',\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t$repeater->add_control(\n\t\t\t'link',\n\t\t\tarray(\n\t\t\t\t'label' => __( 'Link', 'uael' ),\n\t\t\t\t'type' => Controls_Manager::URL,\n\t\t\t\t'label_block' => true,\n\t\t\t\t'default' => array(\n\t\t\t\t\t'is_external' => 'true',\n\t\t\t\t),\n\t\t\t\t'placeholder' => __( 'https://your-link.com', 'uael' ),\n\t\t\t)\n\t\t);\n\n\t\t$this->add_control(\n\t\t\t'social_icon_list',\n\t\t\tarray(\n\t\t\t\t'type' => Controls_Manager::REPEATER,\n\t\t\t\t'fields' => $repeater->get_controls(),\n\t\t\t\t'default' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'new_social' => array(\n\t\t\t\t\t\t\t'value' => 'fab fa-facebook',\n\t\t\t\t\t\t\t'library' => 'fa-brands',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'new_social' => array(\n\t\t\t\t\t\t\t'value' => 'fab fa-twitter',\n\t\t\t\t\t\t\t'library' => 'fa-brands',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'new_social' => array(\n\t\t\t\t\t\t\t'value' => 'fab fa-google-plus',\n\t\t\t\t\t\t\t'library' => 'fa-brands',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\n\t\t\t\t),\n\t\t\t\t'condition' => array(\n\t\t\t\t\t'social_icons_settings' => 'yes',\n\t\t\t\t),\n\t\t\t\t'title_field' => '<# var migrated = \"undefined\" !== typeof __fa4_migrated, social = ( \"undefined\" === typeof social ) ? false : social; #>{{{ elementor.helpers.getSocialNetworkNameFromIcon( new_social, social, true, migrated, true ) }}}',\n\t\t\t)\n\t\t);\n\n\t\t$this->add_control(\n\t\t\t'shape',\n\t\t\tarray(\n\t\t\t\t'label' => __( 'Shape', 'uael' ),\n\t\t\t\t'type' => Controls_Manager::SELECT,\n\t\t\t\t'default' => 'square',\n\t\t\t\t'options' => array(\n\t\t\t\t\t'square' => __( 'Square', 'uael' ),\n\t\t\t\t\t'rounded' => __( 'Rounded', 'uael' ),\n\t\t\t\t\t'circle' => __( 'Circle', 'uael' ),\n\t\t\t\t),\n\t\t\t\t'prefix_class' => 'elementor-shape-',\n\t\t\t\t'condition' => array(\n\t\t\t\t\t'social_icons_settings' => 'yes',\n\t\t\t\t),\n\t\t\t\t'default' => 'rounded',\n\t\t\t)\n\t\t);\n\n\t\t$this->add_control(\n\t\t\t'social_icons_border_radius',\n\t\t\tarray(\n\t\t\t\t'label' => __( 'Border Radius', 'uael' ),\n\t\t\t\t'type' => Controls_Manager::DIMENSIONS,\n\t\t\t\t'size_units' => array( 'px', '%' ),\n\t\t\t\t'default' => array(\n\t\t\t\t\t'top' => '10',\n\t\t\t\t\t'unit' => '%',\n\t\t\t\t\t'right' => '10',\n\t\t\t\t\t'unit' => '%',\n\t\t\t\t\t'bottom' => '10',\n\t\t\t\t\t'unit' => '%',\n\t\t\t\t\t'left' => '10',\n\t\t\t\t\t'unit' => '%',\n\t\t\t\t),\n\t\t\t\t'selectors' => array(\n\t\t\t\t\t'{{WRAPPER}} .elementor-social-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',\n\t\t\t\t),\n\t\t\t\t'condition' => array(\n\t\t\t\t\t'shape' => array( 'rounded' ),\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\n\t\t$this->end_controls_section();\n\t}", "function set_dir($my_path ){\r\n\r\n $this->icons_dir = $my_path[0];\r\n $this->icons_url = $my_path[1];\r\n $this->is_dir_exist = $this->wpdev_mk_dir($this->icons_dir);\r\n\r\n }", "private function setIcon(\\Scrivo\\Str $icon) {\n\t\t$this->icon = $icon;\n\t}", "public function social_icons() {\n\t\t$enabled_socials = get_theme_mod( 'hestia_enable_sharing_icons', true );\n\t\tif ( (bool) $enabled_socials !== true ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$post_link = esc_url( get_the_permalink() );\n\t\t$post_title = get_the_title();\n\n\t\t$facebook_url =\n\t\t\tesc_url(\n\t\t\t\tadd_query_arg(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'u' => $post_link,\n\t\t\t\t\t),\n\t\t\t\t\t'https://www.facebook.com/sharer.php'\n\t\t\t\t)\n\t\t\t);\n\n\t\t$twitter_url =\n\t\t\tesc_url(\n\t\t\t\tadd_query_arg(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'url' => $post_link,\n\t\t\t\t\t\t'text' => rawurlencode( html_entity_decode( wp_strip_all_tags( $post_title ), ENT_COMPAT, 'UTF-8' ) ),\n\t\t\t\t\t),\n\t\t\t\t\t'http://twitter.com/share'\n\t\t\t\t)\n\t\t\t);\n\n\t\t$email_title = str_replace( '&', '%26', $post_title );\n\n\t\t$email_url =\n\t\t\tesc_url(\n\t\t\t\tadd_query_arg(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'subject' => wp_strip_all_tags( $email_title ),\n\t\t\t\t\t\t'body' => $post_link,\n\t\t\t\t\t),\n\t\t\t\t\t'mailto:'\n\t\t\t\t)\n\t\t\t);\n\n\t\t$social_links = '\n <div class=\"col-md-6\">\n <div class=\"entry-social\">\n <a target=\"_blank\" rel=\"tooltip\"\n data-original-title=\"' . esc_attr__( 'Share on Facebook', 'hestia' ) . '\"\n class=\"btn btn-just-icon btn-round btn-facebook\"\n href=\"' . $facebook_url . '\">\n <i class=\"fab fa-facebook-f\"></i>\n </a>\n \n <a target=\"_blank\" rel=\"tooltip\"\n data-original-title=\"' . esc_attr__( 'Share on Twitter', 'hestia' ) . '\"\n class=\"btn btn-just-icon btn-round btn-twitter\"\n href=\"' . $twitter_url . '\">\n <i class=\"fab fa-twitter\"></i>\n </a>\n \n <a rel=\"tooltip\"\n data-original-title=\" ' . esc_attr__( 'Share on Email', 'hestia' ) . '\"\n class=\"btn btn-just-icon btn-round\"\n href=\"' . $email_url . '\">\n <i class=\"fas fa-envelope\"></i>\n </a>\n </div>\n\t\t</div>';\n\t\techo apply_filters( 'hestia_filter_blog_social_icons', $social_links );\n\t}", "function widgets_icons($widgets){\n\t$widgets['SiteOrigin_Panels_Widgets_Layout']['icon'] = 'dashicons dashicons-analytics';\n\t$widgets['button']['icon'] = 'dashicons dashicons-admin-links';\n\t$widgets['SiteOrigin_Widget_GoogleMap_Widget']['icon'] = 'dashicons dashicons-location-alt';\n\treturn $widgets;\n}", "public function setIcon($ext = null, $basename = false, $icon = '')\n\t{\n\t\tif ($this->get('icon') && $this->get('ext') == $ext)\n\t\t{\n\t\t\treturn $this->get('icon');\n\t\t}\n\t\tif ($icon)\n\t\t{\n\t\t\t$this->set('icon', $icon);\n\t\t\treturn $this->get('icon');\n\t\t}\n\t\tif ($this->get('type') == 'folder')\n\t\t{\n\t\t\t$ext = 'folder';\n\t\t}\n\n\t\t$ext = $ext ? $ext : $this->get('ext');\n\t\t$icon = self::getIconImage($ext, $basename);\n\n\t\t$this->set('icon', $icon);\n\t}", "public function icon($icon);", "protected function establish_icon() {\n\t\t$this->icon = \"<i class='sw swp_{$this->key}_icon'></i>\";\n\t}", "protected function registerTCAIcons() {}", "function kvell_edge_register_social_icon_widget( $widgets ) {\n\t\t$widgets[] = 'KvellEdgeSocialIconWidget';\n\t\t\n\t\treturn $widgets;\n\t}", "public function registerPluginTriggersAddPluginWhichSetsPluginIconPathIfIconPathIsGiven() {}", "public function setEntryPaths($paths);", "public function setImages(){\n\t\t// imagen destacada\n $this->thumbail_img = $this->getThumbnailImg();\n // imagenes\n $this->images = $this->getImages();\n\t}" ]
[ "0.7025868", "0.586154", "0.5843922", "0.5827118", "0.57907385", "0.57655257", "0.5762675", "0.56828916", "0.5672955", "0.56334555", "0.56205946", "0.5546111", "0.55201936", "0.5511036", "0.5508489", "0.5504296", "0.54753196", "0.547068", "0.5456038", "0.5383028", "0.53718394", "0.53420484", "0.5335791", "0.5325069", "0.531825", "0.52783126", "0.5278161", "0.5266609", "0.5251027", "0.52492106" ]
0.8234634
0
Update network URLs Regenerates the URLs for each of the social networks using the URL templates and the current values for the URL arguments.
private function updateNetworks() { foreach ($this->networks as $net_key => $net_value) { $url = $net_value['template']; foreach ($this->args as $arg_key => $arg_value) { $url = str_replace('{' . $arg_key . '}', $arg_value, $url); } $this->networks[$net_key]['url'] = $url; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_network_cache( $networks ) {\n\tforeach ( (array) $networks as $network ) {\n\t\twp_cache_add( $network->id, $network, 'networks' );\n\t}\n}", "function update_network_cache($networks)\n {\n }", "public function generateUrl(): void\n {\n $this->load('urls');\n $createRecords = [];\n\n $existingLanguages = $this->urls->keyBy('language');\n\n foreach (config('unique-urls.languages') as $locale => $lang) {\n $uniqueUrl = Url::makeSlug($this->urlStrategy($lang, $locale), $this);\n $newUrl = $this->urlHandler();\n\n $this->handleExistingUrl($existingLanguages, $lang, $uniqueUrl);\n\n if (! $existingLanguages->has($lang)) {\n $newUrl['language'] = $lang;\n $newUrl['slug'] = $uniqueUrl;\n $createRecords[] = $newUrl;\n }\n }\n\n if (count($createRecords)) {\n $this->urls()->createMany($createRecords);\n }\n }", "abstract public function get_url_update();", "private function setUrls() {\n\t\t$this->url = ($this->env === 'DEVELOPMENT') ? 'https://test.sagepay.com/gateway/service/direct3dcallback.vsp' : 'https://live.sagepay.com/gateway/service/direct3dcallback.vsp';\n\t}", "function tc_get_social_networks() {\r\n $__options = tc__f( '__options' );\r\n\r\n //gets the social network array\r\n $socials = apply_filters( 'tc_default_socials' , TC_init::$instance -> socials );\r\n\r\n //declares some vars\r\n $html = '';\r\n\r\n foreach ( $socials as $key => $data ) {\r\n if ( $__options[$key] != '' ) {\r\n //gets height and width from image, we check if getimagesize can be used first with the error control operator\r\n $width = $height = '';\r\n if ( isset($data['custom_icon_url']) && @getimagesize($data['custom_icon_url']) ) { list( $width, $height ) = getimagesize($data['custom_icon_url']); }\r\n\r\n //there is one exception : rss feed has no target _blank and special icon title\r\n $html .= sprintf('<a class=\"%1$s\" href=\"%2$s\" title=\"%3$s\" %4$s %5$s>%6$s</a>',\r\n apply_filters( 'tc_social_link_class',\r\n sprintf('social-icon icon-%1$s' ,\r\n ( $key == 'tc_rss' ) ? 'feed' : str_replace('tc_', '', $key)\r\n ),\r\n $key\r\n ),\r\n esc_url( $__options[$key]),\r\n isset($data['link_title']) ? call_user_func( '__' , $data['link_title'] , 'customizr' ) : '' ,\r\n ( $key == 'tc_rss' ) ? '' : apply_filters( 'tc_socials_target', 'target=_blank', $key ),\r\n apply_filters( 'tc_additional_social_attributes', '' , $key),\r\n ( isset($data['custom_icon_url']) && !empty($data['custom_icon_url']) ) ? sprintf('<img src=\"%1$s\" width=\"%2$s\" height=\"%3$s\" alt=\"%4$s\"/>',\r\n $data['custom_icon_url'],\r\n $width,\r\n $height,\r\n isset($data['link_title']) ? call_user_func( '__' , $data['link_title'] , 'customizr' ) : ''\r\n ) : ''\r\n );\r\n }\r\n }\r\n return $html;\r\n }", "protected function applyUrl()\n\t{\n\t\t// CSS\n\t\t$nodes = $this->dom->getElementsByTagName('link');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('href');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('href', $url);\n\t\t\t}\n\t\t}\n\t\t// JS\n\t\t$nodes = $this->dom->getElementsByTagName('script');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('src');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('src', $url);\n\t\t\t}\n\t\t}\n\t\t// Image\n\t\t$nodes = $this->dom->getElementsByTagName('img');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('src');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('src', $url);\n\t\t\t}\n\t\t}\n\t\t// Anchor\n\t\t$nodes = $this->dom->getElementsByTagName('a');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('href');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->base_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('href', $url);\n\t\t\t}\n\t\t}\n\t}", "function _prime_network_caches( $network_ids ) {\n\tglobal $wpdb;\n\n\t$non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' );\n\tif ( !empty( $non_cached_ids ) ) {\n\t\t$fresh_networks = $wpdb->get_results( sprintf( \"SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)\", join( \",\", array_map( 'intval', $non_cached_ids ) ) ) );\n\n\t\tupdate_network_cache( $fresh_networks );\n\t}\n}", "public static function generateUrlCache($namespace = ''): void\n {\n if (\\rex_addon::get('url')->isAvailable() && \\rex_version::compare(\\rex_addon::get('url')->getVersion(), '2.0', '>=')) {\n // Delete url addon cache file\n \\Url\\Cache::deleteProfiles();\n // Read profile\n $profiles = '' !== $namespace ? \\Url\\Profile::getByNamespace($namespace) : \\Url\\Profile::getAll();\n foreach ($profiles as $profile) {\n // generate URLs\n $profile->deleteUrls();\n $profile->buildUrls();\n }\n }\n }", "protected function generateLinks()\n {\n if ( ! is_null($this->links) ) {\n foreach ( $this->links as $link ) {\n $this->addLine('<url>');\n $this->addLine('<loc>');\n $this->addLine($this->helpers->url(\n $link->link,\n $this->protocol,\n $this->host\n ));\n $this->addLine('</loc>');\n $this->addLine('<lastmod>' . date_format($link->updated_at, 'Y-m-d') . '</lastmod>');\n $this->addLine('</url>');\n }\n }\n }", "private function replaceURLsCallback($matches) {\n\n preg_match('/(http[s]?)?:\\/\\/([^\\/]+)(.*)?/', $matches[2], $url_matches);\n\n $replacement = $matches[0];\n\n if (!empty($url_matches[0])) {\n\n switch (drupal_strtoupper($this->https)) {\n case 'TO':\n $scheme = 'https';\n break;\n case 'FROM':\n $scheme = 'http';\n break;\n default:\n $scheme = $url_matches[1];\n break;\n }\n\n foreach($this->from_urls as $from_url) {\n\n $match_url = $url_matches[1] . '://' . $url_matches[2];\n\n if ($from_url == $match_url) {\n if (!$this->relative) {\n $replacement = $matches[1] . '=\"' . $scheme . '://';\n $replacement .= $this->toValue . $url_matches[3] . '\"';\n }\n else {\n $replacement = $matches[1] . '=\"' . $url_matches[3] . '\"';\n }\n break;\n }\n\n }\n\n }\n\n if ($replacement !== $matches[0]) {\n\n $this->debug && drush_print(\n t(\n 'URL: !from => !to',\n array(\n '!from' => $matches[0],\n '!to' => $replacement,\n )\n )\n );\n\n }\n\n return $replacement;\n\n }", "public function updateSocial ()\n {\n foreach ($this->user->social as $social_key => $social)\n {\n if($social->url !== $social->full_link)\n {\n if(strpos($social->full_link, $social->contain) === false) {\n $count = count(explode('://', $social->full_link));\n\n if($count > 1) {\n $social->full_link = $social->url;\n }else {\n $social->full_link = strtolower($social->url.$social->full_link);\n }\n }\n }\n }\n\n u()->update([\n 'social' => $this->user->social\n ]);\n\n return $this->message('Settings updated!', 'Social settings successfully updated.', true, $this->user);\n }", "public function updateAllShortURLs(){\n\t\t\tglobal $db;\n\t\t\t\n\t\t\t// We need to get the longURL and drawLink() to match...\n\t\t\tif($urls = $db->get_results(\"SELECT * FROM shorturls WHERE guid<=''\") ){\n\t\t\t\tforeach($urls as $url){\n\t\t\t\t\t// So now we have all of the unassigned urls...\n\t\t\t\t\t// ??????\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function tc_generates_socials() {\r\n $socials = apply_filters( 'tc_default_socials' , TC_init::$instance -> socials );\r\n\r\n //declares some loop's vars and the settings array\r\n $priority = 50;//start priority\r\n $incr = 0;\r\n $socials_setting_control = array();\r\n\r\n foreach ( $socials as $key => $data ) {\r\n $priority += $incr;\r\n $socials_setting_control['tc_theme_options[' . $key . ']'] = array(\r\n 'default' => ( isset($data['default']) && !is_null($data['default']) ) ? $data['default'] : null ,\r\n 'sanitize_callback' => array( $this , 'tc_sanitize_url' ),\r\n 'control' => 'TC_controls' ,\r\n 'label' => ( isset($data['option_label']) ) ? call_user_func( '__' , $data['option_label'] , 'customizr' ) : $key,\r\n 'section' => 'tc_social_settings' ,\r\n 'type' => 'url',\r\n 'priority' => $priority\r\n );\r\n $incr += 5;\r\n }\r\n\r\n return $socials_setting_control;\r\n }", "public function fixRepositoryUrls() {\n\t\t$update_count = 0;\n\n\t\t$packages = $this->Package->find('all', array(\n\t\t\t'contain' => array('Maintainer' => array('id', 'username')),\n\t\t\t'fields' => array('id', 'maintainer_id', 'name'),\n\t\t\t'order' => array('Package.id ASC')\n\t\t));\n\n\t\tforeach ($packages as $package) {\n\t\t\t$this->out(sprintf(\n\t\t\t\t__('Updating package id %s named %s'),\n\t\t\t\t$package['Package']['id'],\n\t\t\t\t$package['Package']['name']\n\t\t\t));\n\n\t\t\tif ($this->Package->fixRepositoryUrl($package)) $update_count++;\n\t\t}\n\n\t\t$this->out(sprintf(__('* Successfully updated %s out of %s package urls'), $update_count, count($packages)));\n\t\t$this->_stop();\n\t}", "public function update(){\n foreach (the()->project->languages as $lang){\n $field=\"url_$lang\";\n if($this->urlExists($this->$field,$lang)){\n $increment=1;\n $url=$this->$field.'-'.$increment;\n while($this->urlExists($url,$lang)){\n $increment++;\n $url=$this->$field.'-'.$increment;\n }\n $this->$field=$url;\n }\n $this->$field=strtolower($this->$field);\n $this->$field=pov()->utils->string->clean($this->$field,\"/\");\n }\n\n\n parent::update();\n\n }", "public static function add_network_settings() {\n\t\tadd_settings_section(\n\t\t\t'cjur-network-settings-section',\n\t\t\t__( 'CSS JS URL Rewriter', 'css-js-url-rewriter' ),\n\t\t\t'__return_false',\n\t\t\t'cjur-network-settings-page'\n\t\t);\n\n\t\tadd_settings_field(\n\t\t\t'css_js_url_rewriter_cdn_url',\n\t\t\t__( 'CDN URL', 'css-js-url-rewriter' ),\n\t\t\t[ __CLASS__, 'render_field' ],\n\t\t\t'cjur-network-settings-page',\n\t\t\t'cjur-network-settings-section'\n\t\t);\n\t}", "public function get() {\n\n\t\t$args = func_get_args();\n\n\t\tif( empty( $args ) ) {\n\n\t\t\t$networks = $this->_networks;\n\n\t\t} else {\n\t\t\t$networks = array();\n\n\t\t\tforeach ( $args as $network ) {\n\n\t\t\t\tif( in_array( $network, $this->_networks) ) {\n\t\t\t\t\t$networks[] = $network;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$urls = array();\n\n\t\tforeach ( $networks as $network ) {\n\t\t\t$url = call_user_func( array( $this, str_replace( '-', '_', $network ) ) );\n\n\t\t\tif( $url ) {\n\t\t\t\t$urls[ $network ] = $url;\n\t\t\t}\n\t\t}\n\n\t\treturn $urls;\n\t}", "function make_urls() {\n $url = '/search/' . $this->id . '/';\n $this->append_urls('self', $url);\n }", "private function getUrls() {\n\t\t// reassign the array because of a php bug (solved later with php 5.2.x @see: http://bugs.php.net/39449)\n\t\t$arr = $this->formData;\n\n\t\t// build bas URL for replacement variables\n\t\t$protocol\t= 'http'\n . ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ? 's' : '' )\n . '://';\n\t\t$url\t\t= $_SERVER['HTTP_HOST'] . dirname( $_SERVER['PHP_SELF'] ) . '/';\n $url = str_replace( '//', '/', $url ); // some server add 2 /\n $url = $protocol . $url . 'index.php?route=payment/directebanking/';\n\n\t\tif( $this->_param['successUrlStd'] ) {\n\t\t\t$arr['user_variable_0'] = $url . 'success'\n\t\t\t. '&transaction=-TRANSACTION-&security_criteria=-SECURITY_CRITERIA-'\n\t\t\t. '&order_id=-USER_VARIABLE_3-&pid=-PROJECT_ID-';\n\t\t}else{\n\t\t\tif( $this->_param['successUrl'] ) {\n\t\t\t\t$arr['user_variable_0'] = $this->_param['successUrl'];\n\t\t\t}\n\t\t}\n\n\t\tif( $this->_param['cancelUrlStd'] ) {\n\t\t\t$arr['user_variable_1'] = $url . 'cancel'\n\t\t\t. '&transaction=-TRANSACTION-&order_id=-USER_VARIABLE_3-&pid=-PROJECT_ID-';\n\t\t}else{\n\t\t\tif( $this->_param['cancelUrl'] ) {\n\t\t\t\t$arr['user_variable_1'] = $this->_param['cancelUrl'];\n\t\t\t}\n\t\t}\n\n\t\t// and reassign again\n\t\t$this->formData = $arr;\n\n\t\tunset( $arr );\n\t}", "public function getUrl($network)\n {\n if ($network == '') {\n throw new \\RuntimeException(\"You must choose a social network\", 1);\n }\n\n if (isset($this->definitions[$network]) &&\n isset($this->definitions[$network]['base']) &&\n isset($this->definitions[$network]['query'])) {\n\n $queryString = http_build_query(array_filter($this->definitions[$network]['query']), '', '&amp;', PHP_QUERY_RFC3986);\n\n return $this->definitions[$network]['base'] . \"?\" . $queryString;\n } else {\n throw new \\RuntimeException(\"Social network not found (\" . $network . \")\", 1);\n }\n }", "protected function generateUrls()\n\t{\n\t\t// Video URL array\n\t\t$videoUrl = $this->videoUrl;\n\n\t\t// Array for URLs\n\t\t$urls\t= [];\n\n\t\t$query\t= '';\n\n\t\t$keywords = $this->keywords;\n\n\t\t// Check if there is at least one keyword\n\t\tif(count($keywords) < 1) return false;\n\n\t\t// Setup dev key\n\t\t$devKey = (! is_null($this->developerKey)) ? '&key=' . $this->developerKey : null;\n\n\t\t// Loop keywords\n\t\tforeach($keywords as $keyword)\n\t\t{\n\t\t\t// Check keyword string length\n\t\t\tif(strlen($keyword) < 4) continue;\n\n\t\t\tforeach($this->modList as $modword)\n\t\t\t{\n\t\t\t\t$query = str_replace('-', ' ', Str::slug($modword . ' ' . $keyword));\n\n\t\t\t\t$urls[] = $videoUrl . urlencode($query) . $devKey;\n\t\t\t}\n\t\t}\n\n\t\t// Update the URLs\n\t\t$this->urls = $urls;\n\n\t\treturn $urls;\n\t}", "function cosmetics_get_social_url() {\n\n global $cosmetics_options;\n $cosmetics_social_networks = cosmetics_get_social_network();\n\n foreach( $cosmetics_social_networks as $cosmetics_social ) :\n $cosmetics_social_url = $cosmetics_options['cosmetics_social_network_' . $cosmetics_social['id']];\n\n if( $cosmetics_social_url ) :\n?>\n\n <div class=\"social-network-item item-<?php echo esc_attr( $cosmetics_social['id'] ); ?>\">\n <a href=\"<?php echo esc_url( $cosmetics_social_url ); ?>\">\n <i class=\"fa fa-<?php echo esc_attr( $cosmetics_social['id'] ); ?>\" aria-hidden=\"true\"></i>\n </a>\n </div>\n\n\n<?php\n endif;\n\n endforeach;\n}", "protected function replaceBoundUrlGenerator()\n {\n $this->app->bindShared('url', function ($app) {\n $routes = Collection::make($app['router']->getRoutes())->merge($app['router']->getApiGroups()->getRoutes());\n\n return new UrlGenerator($routes, $app->rebinding('request', function ($app, $request) {\n $app['url']->setRequest($request);\n }));\n });\n }", "function update_refurls()\n{\n\tglobal $database;\n\n\t// IF URL IS NOT EMPTY\n\t$referring_url = $_SERVER[\"HTTP_REFERER\"];\n\tif(strpos(strtolower($referring_url), strtolower($_SERVER[\"HTTP_HOST\"])) !== FALSE) { return; }\n\n\tif( $referring_url )\n {\n\t // IS URL ALREADY IN DATABASE? IF YES, ADD TO HITS. IF NO, ADD NEW ROW\n\t $referring_url = str_replace(\"http://www.\", \"http://\", $referring_url);\n\t $database->database_query(\"\n INSERT INTO se_statrefs\n (statref_hits, statref_url)\n VALUES\n ('1', '{$referring_url}')\n\t\t\tON DUPLICATE KEY UPDATE\n statref_hits=statref_hits+1\n \");\n \n\t // IF 1000 ROWS REACHED, DELETE ONE TO MAKE ROOM\n\t $refurl_totalrows = $database->database_num_rows($database->database_query(\"SELECT statref_id FROM se_statrefs\"));\n \n\t if( $refurl_totalrows > 1000 )\n $database->database_query(\"DELETE FROM se_statrefs WHERE statref_hits='1' ORDER BY statref_id ASC LIMIT 1\");\n\t}\n}", "function wp_update_urls_to_https()\n {\n }", "function forschungsatlas_admin_url() {\n global $pager_total_items;\n $destination = drupal_get_destination();\n\n drupal_set_title(t('Institutions with broken links'));\n\n $header = array();\n $header[] = array('data' => t('Institution'), 'field' => 'name', 'sort' => 'asc');\n $header[] = array('data' => t('City'), 'field' => 'city');\n $header[] = array('data' => t('Federal State'), 'field' => 'federalstate');\n $header[] = array('data' => t('URL'), 'field' => 'url');\n $header[] = array('data' => t('Updated'), 'field' => 'changed');\n $header[] = array('data' => t('Operation'));\n\n $query = db_select('forschungsatlas__tools_broken_links', 'urls')->extend('PagerDefault')->extend('TableSort');\n $query->join('forschungsatlas__institutions', 'i', 'urls.iid=i.iid');\n $query->join('forschungsatlas__cities', 'c', 'i.cid = c.cid');\n $query->join('forschungsatlas__federal_states', 'fs', 'i.fsid = fs.fsid');\n $query->fields('i', array('iid', 'name', 'url', 'changed'));\n $query->addField('c', 'name', 'city');\n $query->addField('fs', 'name', 'federalstate');\n $query->limit(FORSCHUNGSATLAS_PAGER)\n ->orderByHeader($header);\n $result = $query->execute();\n\n $rows = array();\n foreach ($result as $data) {\n $row = array();\n $row['data']['name'] = check_plain($data->name);\n $row['data']['city'] = check_plain($data->city);\n $row['data']['federalstate'] = $data->federalstate;\n $url = check_url($data->url);\n $row['data']['url'] = l($url, $url, array(\n 'attributes' => array(\n 'target'=>'blank',\n 'class' => 'forschungsatlas-institution-l-ext',\n )\n )\n );\n $row['data']['changed'] = format_date($data->changed, 'short');\n $operations = array();\n $operations['edit'] = array(\n 'title' => t('edit'),\n 'href' => FORSCHUNGSATLAS_CONFIG_PATH. '/institutions/institution/'. $data->iid .'/edit',\n 'query' => $destination,\n );\n $row['data']['operations'] = array(\n 'data' => array(\n '#theme' => 'links',\n '#links' => $operations,\n '#attributes' => array('class' => array('links', 'inline', 'nowrap')),\n ),\n );\n $rows[] = $row;\n } // foreach()\n $build['forschungsatlas_table'] = array(\n '#theme' => 'table',\n '#header' => $header,\n '#rows' => $rows,\n '#empty' => t('There are no institutions with broken links.'),\n '#attributes' => array('id' => 'forschungsatlas-table-url'),\n '#caption' => (!empty($pager_total_items[0]) ? format_plural($pager_total_items[0], '1 result', '@count results') : ''),\n );\n $build['forschungsatlas_pager'] = array(\n '#markup' => theme('pager'),\n );\n\n return $build;\n}", "public function update_storage_network() {\n\t\t// get any network stored data.\n\t\t$network_data = get_network_option( null, self::STORAGE_KEY );\n\t\t$current_blog_id = get_current_blog_id();\n\t\t$data_updated = false;\n\t\tif (\n\t\t\t! isset( $network_data['site'][ $current_blog_id ] )\n\t\t\t|| ( isset( $network_data['site'][ $current_blog_id ] ) && $network_data['site'][ get_current_blog_id() ] !== $this->data )\n\t\t) {\n\t\t\t$network_data['site'][ $current_blog_id ] = $this->data;\n\t\t\t// if the network doesn't have data for this site or the data it\n\t\t\t// has is differs then perform the update.\n\t\t\t$network_wide_list = array();\n\t\t\tforeach ( $network_data['site'] as $list ) {\n\t\t\t\t// loop through each item in a site and add uniques to a list.\n\t\t\t\tforeach ( $list as $item ) {\n\t\t\t\t\tif ( ! in_array( $item, $network_wide_list, true ) ) {\n\t\t\t\t\t\t$network_wide_list[] = $item;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// save the data on the network with the latest list and the current\n\t\t\t// sites data updated in it.\n\t\t\t$network_data['list'] = $network_wide_list;\n\t\t\t// update the site data on the network.\n\t\t\t$data_updated = update_network_option( null, self::STORAGE_KEY, $network_data );\n\t\t}\n\t\treturn $data_updated;\n\t}", "function wp_update_network_site_counts($network_id = \\null)\n {\n }", "public function updateCommunities(&$communities)\n {\n $urls = [];\n\n foreach ($communities as $community) {\n $urls [] = 'https://plus.google.com/communities/' . $community['id'];\n }\n $results = $this->curl->get_multi($urls);\n\n $html = new simple_html_dom();\n\n foreach ($results as $index => $result) {\n if (!$result) {\n $communities[$index]['categories'] = 'Loading failed.';\n $communities[$index]['members'] = 'Loading failed.';\n continue;\n }\n $html->load($result);\n\n // Categories\n $categories = $this->scrapeCategories($html);\n\n // Member count\n $member_count = $this->scrapeMembers($html);\n\n $communities[$index]['categories'] = sizeof($categories);\n $communities[$index]['members'] = $member_count;\n\n session([\n 'nxs_gp.category_name.' . $communities[$index]['id'] => $communities[$index]['name'],\n 'nxs_gp.categories.' . $communities[$index]['id'] => $categories,\n 'nxs_gp.members.' . $communities[$index]['id'] => $member_count\n ]);\n }\n }" ]
[ "0.5961742", "0.5837436", "0.579622", "0.5582788", "0.5353659", "0.5343597", "0.5245928", "0.5203176", "0.51202154", "0.5108051", "0.51018727", "0.5080132", "0.50636655", "0.50255495", "0.50093037", "0.49794492", "0.49744123", "0.49476054", "0.49207735", "0.49072805", "0.48798513", "0.48749745", "0.48722064", "0.48653752", "0.48399982", "0.48389748", "0.47908723", "0.47757936", "0.47487542", "0.4745873" ]
0.7968182
0
Get post excerpt If the page that is being shared is a page or single post, attempt to get the excerpt from it without any HTML tags.
private function getPostExcerpt() { global $post; // If this is not a page or a single post, it cannot have an excerpt and // so the method should return an empty string. if (!is_page() && !is_singular()) { return ''; } // Attempt to get a manaul excerpt $excerpt = apply_filters('the_excerpt', $post->post_excerpt); // If there is no manual excerpt, use the main content instead if (!$excerpt) { $excerpt = apply_filters('the_content', $post->post_content); } // Return the excerpt, stripped of any HTML code return strip_tags($excerpt); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTheExcerpt($post){\n\t$postfile = file_get_contents($post);\n\t$fullpost = getBetween('<div class=\"content\">',\"&nbsp;</div>\",$postfile);\n\t$postExcerpt = trimText($fullpost,750);\n\t$postExcerpt = stripslashes($postExcerpt);\n\treturn $postExcerpt;\n}", "public function excerpt() { return $this->post->post_excerpt; }", "public function excerpt()\n\t{\n\t\treturn ( ! empty($this->excerpt))? $this->excerpt : truncate_word($this->content, 200);\n\t}", "public function getExcerpt(Block $post)\n {\n // TODO: replace by ability to set custom excerpt\n $excerpt = $postBody = $post->getBodyForInsertion();\n if (preg_match('/^.{1,260}\\b/s', $postBody, $match))\n {\n $excerpt = $match[0];\n }\n\n return $excerpt;\n }", "private function excerptClass($post) {\n\t\tif($this->excerpt == FALSE)\n\t\t\treturn $post;\n\t\telseif(is_string($this->excerpt))\n\t\t{\n\t\t\t$post->{$this->contentField} = $post->{$this->excerpt};\n\t\t}\n\t\telseif(is_int($this->excerpt))\n\t\t{\n\t\t\t$content = strip_tags($post->{$this->contentField});\n\t\t\tif(strlen($content)>$this->excerpt)\n\t\t\t\t$content = substr($content, 0, ($this->excerpt-1)).\"&hellip;\";\n\t\t\t$post->{$this->contentField} = $content;\n\t\t}\n\t\treturn $post;\n\t}", "function jwp_post_excerpt() {\n return JWP_Post_Excerpt::get_instance();\n}", "public function excerpt()\n {\n if (!$this->desc()->empty()) {\n $excerpt = $this->desc();\n } else {\n $excerpt = excerpt($this->text(), $length = 40, $mode = 'words');\n };\n\n return $excerpt;\n }", "function get_post_excerpt($entity)\n {\n return '';\n }", "function cc_post_excerpt() {\n\tglobal $post;\n\n\t$excerpt = htmlentities(strip_tags($post->post_content));\n\t$excerpt_a = array_slice (explode(\" \", $excerpt), 0, 55);\n\techo implode(\" \", $excerpt_a) . \"...\";\n}", "function get_the_excerpt($post = \\null)\n {\n }", "function accouk_post_excerpt() {\n if(has_excerpt()) {\n the_excerpt();\n }\n}", "private function retrieve_excerpt_only() {\n\t\t$replacement = null;\n\n\t\t// The check `post_password_required` is because excerpt must be hidden for a post with a password.\n\t\tif ( ! empty( $this->args->ID ) && $this->args->post_excerpt !== '' && ! post_password_required( $this->args->ID ) ) {\n\t\t\t$replacement = wp_strip_all_tags( $this->args->post_excerpt );\n\t\t}\n\n\t\treturn $replacement;\n\t}", "private function excerptAssoc($post) {\n\t\tif($this->excerpt == FALSE)\n\t\t\treturn $post;\n\t\telseif(is_string($this->excerpt))\n\t\t{\n\t\t\t$post[$this->contentField] = $post[$this->excerpt];\n\t\t}\n\t\telseif(is_int($this->excerpt))\n\t\t{\n\t\t\t$content = strip_tags($post[$this->contentField]);\n\t\t\tif(strlen($content)>$this->excerpt)\n\t\t\t\t$content = substr($content, 0, ($this->excerpt-1)).\"&hellip;\";\n\t\t\t$post[$this->contentField] = $content;\n\t\t}\n\t\treturn $post;\n\t}", "public function getExcerpt()\n {\n return $this->excerpt = get_the_excerpt($this->id);\n }", "function postExcerpt($content) {\n\t\t$clean = strip_tags($content);\n\t\tif (strlen($clean) > 120){\n\t\t\t$excerpt = substr($clean, 0, strpos($clean, ' ', 120));\n\t\t\tprint $excerpt . ' ...';\n\t\t}\n\t}", "function mobject_excerpt_filter( $excerpt_text, $post ) {\n\tif ( $excerpt_text ) {\n\t\treturn $excerpt_text;\n\t}\n\treturn wp_trim_excerpt( '', $post );\n}", "private function retrieve_excerpt() {\n\t\t$replacement = null;\n\n\t\t// The check `post_password_required` is because excerpt must be hidden for a post with a password.\n\t\tif ( ! empty( $this->args->ID ) && ! post_password_required( $this->args->ID ) ) {\n\t\t\tif ( $this->args->post_excerpt !== '' ) {\n\t\t\t\t$replacement = wp_strip_all_tags( $this->args->post_excerpt );\n\t\t\t}\n\t\t\telseif ( $this->args->post_content !== '' ) {\n\t\t\t\t$replacement = wp_html_excerpt( strip_shortcodes( $this->args->post_content ), 156 );\n\t\t\t\t// Trim the auto-generated string to a word boundary.\n\t\t\t\t$replacement = substr( $replacement, 0, strrpos( $replacement, ' ' ) );\n\t\t\t}\n\t\t}\n\n\t\treturn $replacement;\n\t}", "public function get_excerpt() {\n\t\tif ( $excerpt = $this->get_field( 'post_excerpt' ) ) {\n\t\t\treturn $excerpt;\n\t\t}\n\t}", "function improved_trim_excerpt($text) { // Fakes an excerpt if needed\n global $post;\n if ( '' == $text ) {\n $text = get_the_content('');\n $text = apply_filters('the_content', $text);\n \n\t$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);\n\t$text = preg_replace('@<style[^>]*?>.*?</style>@si', '', $text);\n\t$text = preg_replace('@<p class=\"wp-caption-text\"[^>]*?>.*?</p>@si', '', $text);\t\n $text = str_replace('\\]\\]\\>', ']]&gt;', $text);\n $text = strip_tags($text, '<p><i><em><b><a><strong>');\n $excerpt_length = 140;\n $words = explode(' ', $text, $excerpt_length + 1);\n if (count($words)> $excerpt_length) {\n array_pop($words);\n array_push($words, '... <a href=\"'.get_permalink($post->ID).'\">'.'Read More &raquo;'.'</a>');\n $text = implode(' ', $words);\n }\n }\nreturn $text;\n}", "function lucasato_get_the_excerpt($post_id)\n{\n $output = get_the_excerpt($post_id);\n return $output;\n}", "public function get_the_excerpt( $excerpt, $_post ) {\n\t\tglobal $post;\n\n\t\tif ( false !== strpos( get_post_type( $_post->ID ), 'tribe_' ) && is_archive() && ! empty( $post->ID ) && $post->ID === $_post->ID ) {\n\t\t\treturn fusion_get_post_content( $post->ID, 'yes', apply_filters( 'excerpt_length', 55 ), true );\n\t\t}\n\n\t\treturn $excerpt;\n\t}", "function robins_get_the_excerpt($post_id) {\n global $post; \n $save_post = $post;\n $post = get_post($post_id);\n $output = get_the_excerpt();\n $post = $save_post;\n return $output;\n}", "public function get_excerpt();", "function ridizain_recentpost_excerpt () {\r\n\t$theContent = trim(strip_tags(get_the_content()));\r\n\t\t$output = str_replace( '\"', '', $theContent);\r\n\t\t$output = str_replace( '\\r\\n', ' ', $output);\r\n\t\t$output = str_replace( '\\n', ' ', $output);\r\n\t\t\tif (get_theme_mod( 'ridizain_recentpost_excerpt_length' )) :\r\n\t\t\t$limit = get_theme_mod( 'ridizain_recentpost_excerpt_length' );\r\n\t\t\telse : \r\n\t\t\t$limit = '15';\r\n\t\t\tendif;\r\n\t\t\t$content = explode(' ', $output, $limit);\r\n\t\t\tarray_pop($content);\r\n\t\t$content = implode(\" \",$content).\" \";\r\n\treturn strip_tags($content, ' ');\r\n}", "public function excerpt(): string\n {\n $excerpt = get_the_excerpt($this->wpPost);\n\n return $this->setAttribute(__METHOD__, $excerpt);\n }", "function voyage_mikado_excerpt($excerpt_length = '') {\n global $post;\n\n if(post_password_required()) {\n echo get_the_password_form();\n } //does current post has read more tag set?\n elseif(voyage_mikado_post_has_read_more()) {\n global $more;\n\n //override global $more variable so this can be used in blog templates\n $more = 0;\n the_content(true);\n } //is word count set to something different that 0?\n elseif($excerpt_length != '0') {\n //if word count is set and different than empty take that value, else that general option from theme options\n $word_count = '45';\n if(isset($excerpt_length) && $excerpt_length != \"\") {\n $word_count = $excerpt_length;\n\n } elseif(voyage_mikado_options()->getOptionValue('number_of_chars') != '') {\n $word_count = esc_attr(voyage_mikado_options()->getOptionValue('number_of_chars'));\n }\n //if post excerpt field is filled take that as post excerpt, else that content of the post\n $post_excerpt = $post->post_excerpt != \"\" ? $post->post_excerpt : strip_tags($post->post_content);\n\n //remove leading dots if those exists\n $clean_excerpt = strlen($post_excerpt) && strpos($post_excerpt, '...') ? strstr($post_excerpt, '...', true) : $post_excerpt;\n\n //if clean excerpt has text left\n if($clean_excerpt !== '') {\n //explode current excerpt to words\n $excerpt_word_array = explode(' ', $clean_excerpt);\n\n //cut down that array based on the number of the words option\n $excerpt_word_array = array_slice($excerpt_word_array, 0, $word_count);\n\n //add exerpt postfix\n $excert_postfix = apply_filters('voyage_mikado_excerpt_postfix', '...');\n\n //and finally implode words together\n $excerpt = implode(' ', $excerpt_word_array).$excert_postfix;\n\n //is excerpt different than empty string?\n if($excerpt !== '') {\n echo '<p class=\"mkdf-post-excerpt\">'.wp_kses_post($excerpt).'</p>';\n }\n }\n }\n }", "protected function prepare_excerpt_response($excerpt, $post)\n {\n }", "public function getExcerpt()\r\n\t\t{\r\n\t\t\treturn $this->_excerpt;$this->_created_date;\r\n\t\t}", "function get_my_excerpt(){\n\t$text = get_the_content();\n\t$text = strip_shortcodes($text);\n\t$text = apply_filters('the_content', $text);\n\t$text = strip_tags($text);\n\t$excerpt_length = 30; // set the number of words here\n\t$excerpt_more = '...';\n\t$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );\n\treturn $text;\n}", "function themify_custom_excerpt_more($more) {\n global $post;\n return '';\n}" ]
[ "0.74206954", "0.7268432", "0.69454074", "0.6917724", "0.674359", "0.67123055", "0.6691639", "0.6671284", "0.6634482", "0.6632367", "0.6590873", "0.6552178", "0.6507734", "0.6503733", "0.6459561", "0.6452262", "0.6419904", "0.64083874", "0.63771987", "0.6353947", "0.6345391", "0.6227352", "0.6143553", "0.61173594", "0.6106649", "0.6103341", "0.60722643", "0.6072046", "0.605211", "0.6038152" ]
0.7835794
0
Return list of all available networks
public function getAvailableNetworks() { return $this->networks; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_networks()\n {\n }", "public function getNetworksList() {\n return $this->_get(1);\n }", "public function getNetworksList() {\n return $this->_get(4);\n }", "public function networks()\n {\n return $this->request('get', '/api/teams/'.Helpers::config('team').'/networks');\n }", "public function getNetworks() {\n\n //GET NETWORK TABLE\n $tableNetwork = Engine_Api::_()->getDbtable('networks', 'network');\n\n //MAKE QUERY\n $select = $tableNetwork->select()\n ->from($tableNetwork->info('name'), array('network_id', 'title'))\n ->order('title');\n $result = $tableNetwork->fetchAll($select);\n\n $everyone = Zend_Registry::get('Zend_Translate')->_('Everyone');\n\n //MAKE DATA ARRAY\n $networksOptions = array('0' => $everyone);\n foreach ($result as $value) {\n $networksOptions[$value->network_id] = $value->title;\n }\n\n //RETURN\n return $networksOptions;\n }", "public function GetNetworks()\n {\n return $this->networkManager;\n }", "public function getAllowedNetworks() {\n $networks = CachedConferenceApi::getNetworks();\n if ((SettingsApi::getSetting(SettingsApi::ALLOW_NETWORK_CHAIRS_TO_SEE_ALL_NETWORKS) <> 1)\n && !LoggedInUserDetails::isCrew()\n ) {\n return NetworkApi::getOnlyNetworksOfChair($networks, LoggedInUserDetails::getUser());\n }\n return $networks;\n }", "function get_networks($args = array())\n {\n }", "function get_networks( $args = array() ) {\n\t$query = new WP_Network_Query();\n\n\treturn $query->query( $args );\n}", "function _tsuiseki_tracking_get_network_names() {\n return array(\n 'site',\n );\n}", "public function hasNetworks() {\n return $this->_has(1);\n }", "public function getAvailableSites();", "public function networkList($filter = array())\n {\n return $this->collection('OpenCloud\\Compute\\Resource\\Network');\n }", "public function hasNetworks() {\n return $this->_has(4);\n }", "public function hasNetworks() {\n return $this->_has(5);\n }", "public function get() {\n\n\t\t$args = func_get_args();\n\n\t\tif( empty( $args ) ) {\n\n\t\t\t$networks = $this->_networks;\n\n\t\t} else {\n\t\t\t$networks = array();\n\n\t\t\tforeach ( $args as $network ) {\n\n\t\t\t\tif( in_array( $network, $this->_networks) ) {\n\t\t\t\t\t$networks[] = $network;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$urls = array();\n\n\t\tforeach ( $networks as $network ) {\n\t\t\t$url = call_user_func( array( $this, str_replace( '-', '_', $network ) ) );\n\n\t\t\tif( $url ) {\n\t\t\t\t$urls[ $network ] = $url;\n\t\t\t}\n\t\t}\n\n\t\treturn $urls;\n\t}", "protected function get_network_ids()\n {\n }", "public static function get_allowed_on_network()\n {\n }", "public function getHtmlNetwork() {\n $ntworks = array(\n \n 'facebook',\n 'twitter',\n 'linkedin',\n 'pinterest',\n 'youtube',\n 'google',\n 'myspace',\n \n );\n \n $networks = array();\n \n foreach($ntworks as $name) {\n \n if (\n array_key_exists($name,$this->configWeb)\n && !empty($this->configWeb[$name])\n ) {\n $networks[$this->getUrl($name)] = $this->getImageSkin($name);\n }\n \n }\n \n $tplNetworks = Template::getWebsiteView('widgets/networks',$this->getTheme());\n ob_start(); if (is_file($tplNetworks)) { include $tplNetworks; } $out = ob_get_clean();\n \n return $out;\n \n }", "public function getAvailableWorkspaces() {}", "public function getNetworkTags()\n {\n return $this->network_tags;\n }", "function get_interface_list() {\n\n\tglobal $g;\n\n\t/* build interface list with netstat */\n\texec(\"/usr/bin/netstat -in -f inet\", $linkinfo);\n\tarray_shift($linkinfo);\n\n\t$iflist = array();\n\n\tforeach ($linkinfo as $link) {\n\t\t$alink = preg_split(\"/\\s+/\", $link);\n\t\t$ifname = chop($alink[0]);\n\t\t$iftype = chop($alink[2]);\n\t\tif (preg_match(\"/Link/\", $iftype)) {\n\t\t\tif (substr($ifname, -1) == \"*\")\n\t\t\t$ifname = substr($ifname, 0, strlen($ifname) - 1);\n\n\t\t\tif (!preg_match(\"/^(pflog|carp|pfsync|ppp|enc|sl|gif|faith|lo|ng|vlan|tun)/\", $ifname)) {\n\t\t\t\t$iflist[$ifname] = array();\n\n\n\t\t\t\t$iflist[$ifname]['mac'] = chop($alink[3]);\n\t\t\t\t$iflist[$ifname]['up'] = false;\n\n\t\t\t\t/* find out if the link on this interface is up */\n\t\t\t\tunset($ifinfo);\n\t\t\t\texec(\"/sbin/ifconfig {$ifname}\", $ifinfo);\n\n\t\t\t\tforeach ($ifinfo as $ifil) {\n\t\t\t\t\tif (preg_match(\"/status: active/\", $ifil)) {\n\t\t\t\t\t\t$iflist[$ifname]['up'] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn $iflist;\n}", "public function index()\n\t{\n\t\t$networks = $this->network->all();\n\n\t\treturn View::make('networks.index', compact('networks'));\n\t}", "private function get_ipv4Nets()\n\t{\n\t\treturn $this->m_ipv4Nets;\n\t}", "public function get_most_trusted_routes()\n {\n clearos_profile(__METHOD__, __LINE__);\n\n $iface_manager = new Iface_Manager();\n\n $local_networks = $iface_manager->get_most_trusted_networks();\n $extra_networks = $this->get_extra_lans();\n\n // Harmonize format for /network (/24 versus /255.255.255.0)\n $raw_networks = array_merge($local_networks, $extra_networks);\n $networks = array();\n\n foreach ($raw_networks as $network) {\n list($ip, $netmask_or_prefix) = preg_split('/\\//', $network);\n\n if (Network_Utils::is_valid_netmask($netmask_or_prefix))\n $prefix = Network_Utils::get_prefix($netmask_or_prefix);\n else\n $prefix = $netmask_or_prefix;\n\n $networks[] = \"$ip/$prefix\";\n }\n\n return $networks;\n }", "public function getNetworks($keys = null, $templates = false)\n {\n // If no keys are specified, use the current active network list\n $keys = is_array($keys) ? $keys : $this->activeNetworks;\n $networks = [];\n\n // Add each valid network to the output array\n foreach ($keys as $key) {\n if (array_key_exists($key, $this->networks)) {\n $networks[$key] = $this->networks[$key];\n\n // Remove the URL template\n if (!$templates) {\n unset($networks[$key]['template']);\n }\n }\n }\n\n return $networks;\n }", "function wp_get_active_network_plugins()\n {\n }", "public function listNetworks($project, $optParams = array()) {\n $params = array('project' => $project);\n $params = array_merge($params, $optParams);\n $data = $this->__call('list', array($params));\n if ($this->useObjects()) {\n return new Google_NetworkList($data);\n } else {\n return $data;\n }\n }", "public static function getNewtorkIds()\n {\n return array_keys(self::$networks);\n }", "public function get_connections() {\n\t\t$sql = \"SELECT `id` FROM `devices` WHERE `tech` <> 'custom'\";\n\t\t$alldevices = FreePBX::create()->Database->query($sql)->fetchAll(PDO::FETCH_COLUMN, 0);\n\t\t$devices = array_flip($alldevices);\n\n\t\t$protocols = array(\"sip\", \"iax2\", \"pjsip\");\n\t\t$vars = array(\n\t\t\t\"users_online\", \"users_offline\", \"users_total\",\n\t\t\t\"trunks_online\", \"trunks_offline\", \"trunks_total\",\n\t\t\t\"registrations_online\", \"registrations_offline\", \"registrations_total\",\n\t\t);\n\n\t\t// Build array to return\n\t\tforeach ($protocols as $p) {\n\t\t\tforeach ($vars as $v) {\n\t\t\t\t$retarr[$p.\"_\".$v] = 0;\n\t\t\t}\n\t\t}\n\n\t\t// Add Totals\n\t\tforeach ($vars as $v) {\n\t\t\t$retarr[$v] = 0;\n\t\t}\n\n\t\tif (!$this->astman) {\n\t\t\treturn $retarr;\n\t\t}\n\n\t\t$response = $this->astman->send_request('Command',array('Command'=>\"sip show peers\"));\n\t\t$astout = explode(\"\\n\",$response['data']);\n\t\t$blacklist = \\FreePBX::Dashboard()->extIgnoreList();\n\t\tforeach ($astout as $line) {\n\t\t\t// Previous bug IRT trunks starting or ending with /'s here. Investigate.\n\t\t\t$exploded = preg_split('/\\s+/', $line);\n\t\t\tif (strpos($exploded[0], '/') === false) {\n\t\t\t\t$name = $exploded[0];\n\t\t\t} else {\n\t\t\t\tlist($name, $null) = explode('/', $exploded[0]);\n\t\t\t}\n\t\t\t//prefix blacklist\n\t\t\tforeach($blacklist as $num)\n\t\t\tif(substr($name,0,$num['length']) == $num['value'] && $name !== $num['value']){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// How to we see if a trunk is down?\n\t\t\tif ( $exploded[1] == \"(Unspecified)\" || // No IP Address\n\t\t\t\t$exploded[5] == \"UNREACHABLE\" || $exploded[6] == \"UNREACHABLE\") {\n\t\t\t\t// This is a device that's down\n\t\t\t\tif (!isset($devices[$name])) {\n\t\t\t\t\t// It is, actually a TRUNK that's down.\n\t\t\t\t\t$retarr['sip_trunks_offline']++;\n\t\t\t\t} else {\n\t\t\t\t\t$retarr['sip_users_offline']++;\n\t\t\t\t}\n\t\t\t} elseif (filter_var($exploded[1], FILTER_VALIDATE_IP)) {\n\t\t\t\t// This is a device that's up.\n\t\t\t\tif (!isset($devices[$name])) {\n\t\t\t\t\t$retarr['sip_trunks_online']++;\n\t\t\t\t} else {\n\t\t\t\t\t$retarr['sip_users_online']++;\n\t\t\t\t}\n\t\t\t} // else it's not a device.\n\t\t}\n\n\t\t$response = $this->astman->send_request('Command',array('Command'=>\"sip show registry\"));\n\t\t$astout = explode(\"\\n\",$response['data']);\n\t\t$pos = false;\n\t\tforeach ($astout as $line) {\n\t\t\tif (trim($line) != '') {\n\t\t\t\tif ($pos===false) {\n\t\t\t\t\t// find the position of \"State\" in the first line\n\t\t\t\t\t$pos = strpos($line,\"State\");\n\t\t\t\t} else {\n\t\t\t\t\t// subsequent lines, check if it says \"Registered\" at that position\n\t\t\t\t\tif (substr($line,$pos,10) == \"Registered\") {\n\t\t\t\t\t\t$retarr['sip_registrations_online']++;\n\t\t\t\t\t} elseif (strlen($line) > $pos) {\n\t\t\t\t\t\t$retarr['sip_registrations_offline']++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$response = $this->astman->send_request('Command',array('Command'=>\"iax2 show peers\"));\n\t\t$astout = explode(\"\\n\",$response['data']);\n\t\tforeach ($astout as $line) {\n\t\t\tif (preg_match('/^(([a-z0-9\\-_]+)(\\/([a-z0-9\\-_]+))?)\\s+(\\([a-z]+\\)|\\d{1,3}(\\.\\d{1,3}){3})/i', $line, $matches)) {\n\t\t\t\t//matches: [2] = name, [4] = username, [5] = host, [6] = part of ip (if IP)\n\n\t\t\t\t// have an IP address listed, so its online\n\t\t\t\t$online = !empty($matches[6]);\n\n\t\t\t\tif (!isset($devices[$matches[2]])) {\n\t\t\t\t\t// this is a trunk\n\t\t\t\t\t//TODO match trunk tech as well?\n\t\t\t\t\t$retarr['iax2_trunks_'.($online?'online':'offline')]++;\n\t\t\t\t} else {\n\t\t\t\t\t$retarr['iax2_users_'.($online?'online':'offline')]++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\t$response = $this->astman->send_request('Command',array('Command'=>\"iax2 show registry\"));\n\t\t$astout = explode(\"\\n\",$response['data']);\n\t\t$pos = false;\n\t\tforeach ($astout as $line) {\n\t\t\tif (trim($line) != '') {\n\t\t\t\tif ($pos===false) {\n\t\t\t\t\t// find the position of \"State\" in the first line\n\t\t\t\t\t$pos = strpos($line,\"State\");\n\t\t\t\t} else {\n\t\t\t\t\t// subsequent lines, check if it syas \"Registered\" at that position\n\t\t\t\t\tif (substr($line,$pos,10) == \"Registered\") {\n\t\t\t\t\t\t$retarr['iax2_registrations_online']++;\n\t\t\t\t\t} elseif (strlen($line) > $pos) {\n\t\t\t\t\t\t$retarr['iax2_registrations_offline']++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$response = $this->astman->send_request('Command',array('Command'=>\"pjsip show endpoints\"));\n\t\t// This is an amazingly awful format to parse.\n\t\t$lines = explode(\"\\n\", $response['data']);\n\t\t$inheader = true;\n\t\t$istrunk = $isendpoint = false;\n\t\tforeach ($lines as $l) {\n\t\t\tif ($inheader) {\n\t\t\t\tif (isset($l[1]) && $l[1] == \"=\") {\n\t\t\t\t\t// Last line of the header.\n\t\t\t\t\t$inheader = false;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$l = trim($l);\n\t\t\tif (!$l) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If we have a line starting with 'Endpoint:' then we found one!\n\t\t\tif (strpos($l, \"Endpoint:\") === 0) {\n\t\t\t\tif (preg_match(\"/Endpoint:\\s+(.+)\\/(.+?)\\b\\s+(.+)/\", $l, $out)) {\n\t\t\t\t\t// Found a device\n\t\t\t\t\t$isendpoint = $out[1];\n\t\t\t\t\t$istrunk = false;\n\t\t\t\t\tif (isset($out[3]) && strpos($out[3], \"Unavail\") === 0) {\n\t\t\t\t\t\t// Unavailable endpoint.\n\t\t\t\t\t\t$retarr['pjsip_users_offline']++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$retarr['pjsip_users_online']++;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t} elseif (preg_match(\"/Endpoint:\\s+(.+?)\\b/\", $l, $out)) {\n\t\t\t\t\t// Found a trunk\n\t\t\t\t\t$isendpoint = false;\n\t\t\t\t\t$istrunk = $out[1];\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new \\Exception(\"Unable to parse endpoint $l\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we have a Contact: line, then that's something that's registered!\n\t\t\tif (strpos($l, \"Contact:\") === 0) {\n\t\t\t\tif ($isendpoint !== false) {\n\t\t\t\t\t// This is a registered endpoint\n\t\t\t\t\t$retarr['pjsip_registrations_online']++;\n\t\t\t\t} elseif ($istrunk !== false) {\n\t\t\t\t\t// Trunk status... Check for 'avail'\n\t\t\t\t\tif (strpos($l, \"Avail \") === false) {\n\t\t\t\t\t\t// Trunk down.\n\t\t\t\t\t\t$retarr['pjsip_trunks_offline']++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$retarr['pjsip_trunks_online']++;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow new \\Exception(\"Found a contact before I figured out what it is!\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Now figure out the totals.\n\t\tforeach ($protocols as $p) {\n\t\t\t$users = $retarr[$p.\"_users_online\"]+$retarr[$p.\"_users_offline\"];\n\t\t\t$retarr[$p.\"_users_total\"] = $users;\n\n\t\t\t$trunks = $retarr[$p.\"_trunks_online\"]+$retarr[$p.\"_trunks_offline\"];\n\t\t\t$retarr[$p.\"_trunks_total\"] = $trunks;\n\n\t\t\t$regs = $retarr[$p.\"_registrations_online\"]+$retarr[$p.\"_registrations_offline\"];\n\t\t\t$retarr[$p.\"_registrations_total\"] = $regs;\n\t\t}\n\n\t\tforeach ($vars as $v) {\n\t\t\tforeach ($protocols as $p) {\n\t\t\t\t$retarr[$v] += $retarr[$p.\"_\".$v];\n\t\t\t}\n\t\t}\n\n\t\treturn $retarr;\n\t}" ]
[ "0.78085506", "0.7778569", "0.7701551", "0.76748836", "0.7319537", "0.6873914", "0.6843829", "0.6622548", "0.64519954", "0.6382405", "0.6335826", "0.6311104", "0.6277313", "0.62575454", "0.62363994", "0.6200874", "0.6153595", "0.6099858", "0.6035701", "0.6005851", "0.59477526", "0.59379256", "0.5895047", "0.58945376", "0.5851114", "0.58465314", "0.5832988", "0.58085364", "0.573232", "0.57261693" ]
0.7887625
0
Compose URL for executing
protected function composeExecURL() { $exec_url = self::BASE_URI . "?key=" . $this->key . "&url=" . urlencode($this->url); if(!empty($this->options)) { foreach($this->options as $key => $value) { $exec_url .= "&" . $key . "=" . $value; } } $this->exec_url = $exec_url; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function buildFrontendUri() {}", "public function url();", "public function url();", "public function url();", "private function generateUrl() : string\n {\n return $this->apiUrl.$this->ownerRepo.$this->branchPath.$this->branch;\n }", "public function generate_url()\n {\n }", "public function toUrl()\n {\n $queryParams = '';\n\n $index = 0;\n\n foreach ($this->args as $key => $param) {\n $separator = '?';\n\n if ($index) {\n $separator = '&';\n }\n\n $queryParams .= \"{$separator}{$key}={$param}\";\n\n $index++;\n }\n\n return \"https://dev-ops.mee.ma/glenn/1/5/people.jpg{$queryParams}\";\n }", "public function url(): string;", "protected function get_endpoint_url() {\n\n\t\t$args = http_build_query( array( 'apikey' => $this->api_key ) );\n\t\t$base = $this->route . $this->app_id;\n\t\t$url = \"$base?$args\";\n\n\t\treturn $url;\n\t}", "public function outputUrl()\n\t{\n\t\techo App::e($this->url);\n\t}", "abstract public function url($manipulation_name = '');", "function _getCommand($name, $url)\n {\n if (substr($url, 0, 4) !== 'http') {\n $url = JURI::base().$url;\n }\n\n return $url;\n }", "public static function url()\n {\n return base_url(static::action());\n }", "public function getUrl(){\n return $this->server->getUrl() . \"/\" . $this->name;\n \n }", "public function renderUri();", "function _build_url() {\n\t\t// Add transaction ID for better detecting double requests in AUTH server\n\t\tif($GLOBALS['config']['application']['tid'] == '') $GLOBALS['config']['application']['tid'] = rand(0, 10000);\n\n\t\t$url = $this->url.'&action='.$this->action.'&tid='.$GLOBALS['config']['application']['tid'];\n\t\t\n\t\treturn $url;\n\t}", "abstract public function getCallUrl();", "public static function commandURI($mnt,$command)\n{\nreturn self::uri($mnt,'?'.$command);\n}", "protected function prepareUrl()\n {\n return 'http://'.$this->_host.'/service/v'.$this->_apiVersion.'/rest.php';\n }", "public function getURL();", "public function getURL();", "public function getUrl()\n {\n $url = $params = '';\n $url .= $this->getProtocol() . '://' . self::EBAY_HOST . self::EBAY_URI . '?';\n foreach ($this->getParams() as $name => $value) {\n $params .= '&' . $name . '=' . urlencode($value);\n }\n\n return $url . substr($params, 1);\n }", "public function url()\r\n {\r\n return $this->get_base_url() . http_build_query($this->get_query_params());\r\n }", "public function getURL ();", "public function GetFetchURL();", "public function get_command_url() {\r\n\t\t$language = ($this->has_language() ? $this->language : cur_lang());\r\n\t\t$controller = ($this->controller == 'home' && $this->action == 'index' && !$this->has_parameters() ? '' : $this->controller);\r\n\t\t$action = ($this->action == 'index' && !$this->has_parameters() ? '' : $this->action);\r\n\t\t$controller_parameters = ($this->has_parameters() ? implode('/', $this->parameters) : '/');\r\n\t\t$get_parameters = ($this->has_url_get_parameters() ? '?'.$this->url_get_parameters : '');\t\r\n\t\t\r\n\t\treturn DIRECTORY_ROOT.$language.($controller == '' ? '' : '/'.$controller).($action == '' ? '' : '/'.$action).($controller_parameters == '/' ? '' : '/'.$controller_parameters).$get_parameters;\r\n\t}", "public function getUrl() {\n\t\t$url = $this->getBaseUrl().$this->getBasePath().$this->getOperation();\n\t\t$params = http_build_query($this->getUrlParameters());\n\t\tif ($params) {\n\t\t\t$url .= '?'.$params;\n\t\t}\n\t\treturn $url;\n\t}", "public function buildBackendUri() {}", "public function uri();", "public function uri();" ]
[ "0.6541003", "0.6465577", "0.6465577", "0.6465577", "0.6306139", "0.62989175", "0.6225217", "0.6193616", "0.6191092", "0.61745036", "0.6170492", "0.6127379", "0.6114157", "0.6112213", "0.60921824", "0.60819685", "0.60546625", "0.60105264", "0.6007052", "0.6002942", "0.6002942", "0.5992949", "0.59928674", "0.598866", "0.59831256", "0.59721094", "0.5968817", "0.59596485", "0.5956524", "0.5956524" ]
0.71734166
0
Execute data from API
protected function executeData() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->exec_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); $json = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $data = json_decode($json); if($http_code != "200") { throw new Exception($http_code, $data); } return $data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function execute() {\n $this->check();\n $this->buildQuery();\n $response = json_decode($this->getContents());\n $this->response = !empty($response) ? $response : NULL;\n }", "private function execute()\n {\n // executes a cURL session for the request, and sets the result variable\n $result = Request::get($this->getRequestURL())->send();\n // return the json result\n return $result->raw_body;\n }", "public function processApi();", "public function run()\n {\n //\n $param=[\n 'message'=>'google',\n 'url'=>'google',\n ];\n $restdata=new Restdata;\n $restdata->fill($param)->save();\n $param=[\n 'message'=>'yahoo',\n 'url'=>'yahoo',\n ];\n $restdata=new Restdata;\n $restdata->fill($param)->save();\n $param=[\n 'message'=>'MSN',\n 'url'=>'msn',\n ];\n $restdata=new Restdata;\n $restdata->fill($param)->save();\n }", "public function requestData() {\n\t\t// Set up cURL \n\t\t$curl = curl_init($this->query); \n\t\tcurl_setopt($curl, CURLOPT_POST, false); \n\t\tcurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n\t\t$response = curl_exec($curl);\n\t\tcurl_close($curl);\n\t\t\t\n\t\treturn $this->parseAPIResponse($response);\n\t}", "protected function _execute(){\n\t\t\t$this->_getUrl();\n\n\t\t\t$c = curl_init($this->_url);\n\t\t\tob_start();\n\t\t\tif(!empty($this->_postFields)) {\n\t\t\t\tcurl_setopt($c, CURLOPT_POST, 1);\n\t\t\t\tcurl_setopt($c, CURLOPT_POSTFIELDS, json_encode($this->_postFields));\n\t\t\t}\n\n\t\t\tcurl_exec($c);\n\t\t\tcurl_close($c);\n\t\t\t$this->_result = trim(ob_get_contents());\n\t\t\tob_end_clean();\n\t\t}", "abstract function do_api_request();", "public function run() {\n\n\t\t//业务数据\n\t\tModels\\DtiLocal::build(function (Builder $b) {\n\t\t\t$b->method_enum('post')->code(\"api/amiba/doc-bizs/batch\")->name(\"业务数据\")->path('api/amiba/doc-bizs/batch');\n\t\t\t$b->body('{\"FromDate\":\"#{fm_date}#\",\"toDate\":\"#{to_date}#\"}');\n\t\t});\n\n\t\t//财务数据\n\t\tModels\\DtiLocal::build(function (Builder $b) {\n\t\t\t$b->method_enum('post')->code(\"api/amiba/doc-fis/batch\")->name(\"财务数据\")->path('api/amiba/doc-fis/batch');\n\t\t\t$b->body('{\"FromDate\":\"#{fm_date}#\",\"toDate\":\"#{to_date}#\"}');\n\t\t});\n\t}", "public function execute_http()\n {\n }", "public function execute(){\n try {\n $request = $this->getRestClient();\n $raw_response = $request->request();\n } catch (Zend_Http_Client_Exception $e) {\n Mage::helper('unbxd_recommendation')->log(Zend_Log::ERR,\n sprintf($this->getUrl() .\" failed because HTTP error: %s\", $e->getMessage()));\n return Mage::getModel('unbxd_recommendation/api_response')\n ->setErrorMessage(Unbxd_Recommendation_Model_Api_Response::SERVER_ERR);\n }\n return Mage::getModel(\"unbxd_recommendation/api_response\")\n ->setJsonResponse($this->isJsonResponse())\n ->setResponse($raw_response, $this->getUrl());\n }", "public function fromAPI($data);", "public function run() {\n\t\t$this->db->fetchAll('pundits');\n\t\t$this->response = array(\n\t\t\t'status' => 'success',\n\t\t\t'command'=> 'list',\n\t\t\t'data' => $this->db->get_last_result()\n\t\t);\n\t}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}", "public function execute() {}" ]
[ "0.7214039", "0.68051755", "0.6801584", "0.67793506", "0.66443837", "0.66114146", "0.65564317", "0.64971286", "0.64713705", "0.6470685", "0.64648974", "0.64567095", "0.64390236", "0.64390236", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.64385724", "0.643817", "0.643817", "0.643817" ]
0.6998764
1
by default eloquent uses "car_product" name for the intermediate table
public function products() { // if the intermediate table is called differently an SQl error is raised // to use a custom table name it should be passed to "belongsToMany" method as the second argument return $this->belongsToMany(Product::class, 'cars__products'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function product(){\n return $this->belongsTo(Product::class);\n }", "public function car() {\n return $this->hasMany('\\App\\Car');\n }", "public function product()\n {\n return $this->belongsTo('\\App\\Product');\n }", "public function product()\n {\n \treturn $this->belongsTo(Product::class);\n }", "public function product()\n {\n return $this->belongsTo('TechTrader\\Models\\Product');\n }", "public function product()\n {\n \treturn $this->belongsTo('App\\Product');\n }", "public function product()\n {\n \treturn $this->belongsTo('App\\Product');\n }", "public function product(){\n\n return $this->belongsTo(Product::class);\n\n }", "public function product()\n {\n return $this->belongsTo(Product::Class());\n }", "public function product()\n {\n return $this->belongsTo(Product::class);\n\n }", "public function car()\n {\n return $this->hasMany('App\\Entity\\Car');\n }", "public function product()\n {\n return $this->belongsTo('App\\CatalogProduct', 'product_id');\n }", "public function product()\n {\n return $this->belongsTo(Product::class);\n }", "public function product()\n {\n return $this->belongsTo(Product::class);\n }", "public function product()\n {\n return $this->belongsTo(Product::class);\n }", "public function product()\n {\n return $this->belongsTo(Product::class);\n }", "public function product()\n {\n return $this->belongsTo( Product::class );\n }", "public function product()\n\t{\n\t\treturn $this->belongsTo('Tricks\\Product');\n\t}", "public function products()\n {\n // hasMany(RelatedModel, foreignKeyOnRelatedModel = brand_id, localKey = id)\n return $this->hasMany(Product::class);\n }", "public function car()\n {\n return $this->belongsTo('App\\Models\\Car', 'car_id');\n }", "public function product()\n {\n return $this->belongsTo('App\\Product');\n\t}", "public function products()\n\t{\n\t\treturn $this->belongsTo(Product::class);\n\t}", "public function products()\n {\n return $this->belongsTo('App\\Models\\Product');\n }", "public function products(){\n return $this->hasMany('App\\Product');\n }", "public function product() {\n return $this->belongsTo('App\\Entity\\Product');\n }", "public function product_supply(){ return $this->hasMany(ProductSupply::class,'vehicle_id'); }", "public function product()\n {\n return $this->belongsTo('App\\Product');\n }", "public function product()\n {\n return $this->belongsTo('App\\Product');\n }", "public function product()\n {\n return $this->belongsTo('App\\Models\\Product');\n }", "public function products(){\n return $this->hasMany(Product::class);\n }" ]
[ "0.6748697", "0.67422545", "0.67222184", "0.67204285", "0.67071104", "0.666943", "0.666943", "0.6654961", "0.6638013", "0.6632344", "0.6624093", "0.66156024", "0.65834343", "0.65834343", "0.65834343", "0.65834343", "0.65833825", "0.65805614", "0.65767497", "0.6549826", "0.6532468", "0.6531519", "0.650262", "0.6501864", "0.64973754", "0.64900726", "0.6486664", "0.6486664", "0.6481447", "0.6479326" ]
0.746124
0
Start Timer for Querys. Always use with query_stop()
public function query_start($query) { if (($this->mode > 0) and (!$this->sql_query_running)) { $this->sql_query_running = true; $this->sql_query_start = microtime(true); $this->sql_query_string = $query; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function queryStop()\n\t{\n\t\tif (static::isEnabled(static::DB_BENCHMARK))\n\t\t{\n\t\t\tstatic::$_query['time'] = microtime(true) - static::$_query['time'];\n\t\t\tstatic::$_queries[] = static::$_query;\n\t\t}\n\t}", "private function startTimer()\n\t{\n\t\t// Keep statistics\n\t\tself::$totalCallCount++;\n\n\t\t// Rough execution time\n\t\t$this->startMicroStamp = microtime(true);\n\t}", "public function stopQuery() : void\n {\n if ($_ENV['LOGGER_SQL'] === 'true') {\n \n // Logger.\n static::$logger->trace('EXECUTION TIME (in seconds):');\n static::$logger->trace(number_format(microtime(true) - $this->start, 4));\n static::$logger->trace('***************************************************************************');\n \n }//end if\n \n }", "function devlyQueries() {\n\t\n\techo 'ran ' . get_num_queries() . ' queries in ' . timer_stop(1) . ' seconds';\n\t\n}", "public function start()\n\t{\n\t\t$this->startTimer = microtime(TRUE);\n\t}", "public function stopQuery()\n {\n }", "function timequery() {\n static $querytime_begin;\n list($usec, $sec) = explode(' ', microtime());\n\n if (!isset($querytime_begin)) {\n $querytime_begin = ((float) $usec + (float) $sec);\n } else {\n $querytime = (((float) $usec + (float) $sec)) - $querytime_begin;\n echo sprintf('<br />La consulta tardó %01.5f segundos.- <br />', $querytime);\n }\n}", "protected function Start_Timer() {\n\t\tif (!empty($this->timer_name)) \n\t\t{\n\t\t\t$this->Get_Server()->timer->Timer_Start($this->timer_name);\n\t\t}\n\t}", "public function timer_start()\n {\n }", "public static function queryStart($dbname, $sql, $bindings)\n\t{\n\t\tif (static::isEnabled(static::DB_BENCHMARK))\n\t\t{\n\t\t\tstatic::$_query = array(\n\t\t\t\t'dbname' => $dbname,\n\t\t\t\t'sql' => $sql,\n\t\t\t\t'bindings' => $bindings,\n\t\t\t\t'time' => microtime(true),\n\t\t\t);\n\t\t}\n\t}", "public static function enableQueryLog()\n {\n }", "public function query($query, $time = 0)\n\t{\n\t\t$this->queries[] = compact('query', 'time');\n\t}", "public function enableQueryLog()\n {\n $this->loggingQueries = true;\n }", "function start(){\n\t\t$this->time_start = $this->microtime_float();\n\t}", "protected function startTimer()\r\n\t{\r\n\t\tlist($usec, $sec) = explode(\" \",$this->time);\r\n\t\t$this->startTime = ((float)$usec + (float)$sec);\r\n\t\treturn;\r\n\t}", "public function startTimer(): void;", "public function TimerStart()\r\n\t{\r\n\t\t$parts = explode( \" \", microtime() );\r\n\t\t$this->time_diff = 0;\r\n\t\t$this->time_start = $parts[1].substr( $parts[0],1 );\r\n\t}", "public function run()\n {\n DB::disableQueryLog();\n parent::run();\n }", "public static function flushQueryLog()\n {\n }", "function timer_start()\n {\n }", "public function clearQueries();", "function query($query_string)\n\t{\n\t\t$starttime = $starttime = explode(' ', microtime());\n\t\t$starttime = $starttime[1] + $starttime[0];\t\n\t\t\n\t\t$result = mysql_query($query_string, $this->conn) or $this->error(mysql_error(), __LINE__, __FILE__, $query_string);\n\t\t\n\t\t$endtime = explode(' ',microtime());\n\t\t$endtime = $endtime[1] + $endtime[0];\n\t\t$totaltime = $endtime - $starttime;\n\t\t\n\t\t$this->runtimes += $totaltime;\n\t\t$this->queries++;\n\t\t$this->query_debug .= round($totaltime, 5).': '.$query_string.'<br>';\n\t\t\n\t\treturn $result;\n\t}", "function RunQueries()\n\t{\n\t\tBenchmark::getInstance()->timingStart( 'search' );\n\n\t\t$answer = self::$instance->RunQueries();\n\n\t\t$query_time = Benchmark::getInstance()->timingCurrentToRegistry( 'search' );\n\n\t\tRegistry::push( 'searches', $answer );\n\n\t\treturn $answer;\n\t}", "public static function disableQueryLog()\n {\n }", "public function clearQueries(): void\n {\n $this->queries = [];\n }", "function tampilstartup($limit, $start){\n $query = $this->db->get('tbl_startup', $limit, $start);\n return $query;\n }", "public function updateQueryTime()\n\t{\n\t\t$this->setLastQueryTime(time());\n\t\t$this->save();\n\t}", "public function start()\n {\n $this->_timeStartInMicroSeconds = microtime(true);\n }", "function e107_db_debug() {\n\t\tglobal $eTimingStart;\n\n\t\t$this->aTimeMarks[0]=array(\n\t\t'Index' => 0,\n\t\t'What' => 'Start',\n\t\t'%Time' => 0,\n\t\t'%DB Time' => 0,\n\t\t'%DB Count' => 0,\n\t\t'Time' => ($eTimingStart),\n\t\t'DB Time' => 0,\n\t\t'DB Count' => 0\n\t\t);\n\t\t\n\t\tregister_shutdown_function('e107_debug_shutdown');\n\t}", "function addQuery() {}" ]
[ "0.6650986", "0.6330967", "0.6266227", "0.6233954", "0.6141267", "0.61263764", "0.6123928", "0.60613054", "0.60442555", "0.6020866", "0.6005213", "0.5919651", "0.58706206", "0.5841991", "0.58296907", "0.5811369", "0.5794595", "0.5710497", "0.55242586", "0.55224067", "0.55128616", "0.55078787", "0.546274", "0.5462304", "0.5456808", "0.54545015", "0.5439536", "0.5431431", "0.5424209", "0.5417294" ]
0.7223225
0
Sort Array by first Column
public function sort_array_by_col($array) { function compare($wert_a, $wert_b) { // Sortierung nach dem zweiten Wert des Array (Index: 1) $a = $wert_a[0]; $b = $wert_b[0]; if ($a == $b) { return 0; } return ($a > $b) ? -1 : +1; } usort($array, 'compare'); return $array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _sortByArray($array) {}", "function array_sort_by(&$array_initial, $col, $order = SORT_ASC){\n\n $arrAux = array();\n\n foreach ($array_initial as $key=> $row){\n $arrAux[$key] = is_object($row) ? $arrAux[$key] = $row->$col : $row[$col];\n $arrAux[$key] = strtolower($arrAux[$key]);\n }\n\n array_multisort($arrAux, $order, $array_initial);\n }", "protected function sortDataArray() {}", "Private function array_sort_by_columnR(&$arr, $col, $dir = SORT_DESC) {\n $sort_col = array();\n foreach ($arr as $key=>$row) {\n $sort_col[$key] = $row[$col];\n }\narray_multisort($sort_col, $dir, $arr);\nreturn $arr;\n}", "public function asort() {}", "function array_sort_by_column(&$arr, $col, $dir = SORT_ASC) {\n\t$sort_col = array();\n\tforeach ($arr as $key=> $row) {\n\t\t$sort_col[$key] = $row[$col];\n\t}\n\n\tarray_multisort($sort_col, $dir, $arr);\n}", "public function sort();", "public function mySort(array $array);", "public function array_sort_by_column($array, $column)\r\n\t{\r\n\t\tif(!empty($array))\r\n\t\t{\r\n\t\t\tforeach($array as $key => $row)\r\n\t\t\t{\r\n\t\t\t\tif(isset($row[$column]))\r\n\t\t\t\t{\r\n\t\t\t\t\t$sort_values[$key] = $row[$column];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tasort($sort_values);\r\n\t\t\treset($sort_values);\r\n\r\n\t\t\twhile (list ($arr_key, $arr_val) = each ($sort_values))\r\n\t\t\t{\r\n\t\t\t\t$sorted_arr[] = $array[$arr_key];\r\n\t\t\t}\r\n\t\t\tunset($array);\r\n\t\t\treturn $sorted_arr;\r\n\t\t}\r\n\t}", "function md_multisort($arr, $col, $method = SORT_ASC)\n{\n\tif(!is_array($arr) || empty($arr)) return false;\n\tif($col === null) return $arr;\n\telseif($col == 'name') $tmp = array_keys($arr);\n\telse foreach($arr as $key => $row) $tmp[$key] = @$row[$col];\n\tarray_multisort($tmp, $method, $arr);\n\treturn $arr;\n}", "function array_multisort_2d($array,$column,$sortorder='',$base=1){\n\tglobal $array_multisort_2d;\n\tif(!$array)return $array;\n\n\tforeach($array as $n=>$v){\n\t\t//develop link based on column\n\t\t$ref[]=strtolower($v[$column]);\n\t\t$refb[]=$n;\n\t}\n\t//need to develop to arsort if called\n\tasort($ref);\n\t$base=$base-1;\n\tforeach($ref as $n=>$v){\n\t\t$base++;\n\t\t$buffer[$base]=$array[$refb[$n]];\n\t}\n\treturn $buffer;\n}", "function arraySortByColumn(&$arr, $col, $dir = SORT_ASC) {\n\t\t$sort_col = array();\n\t\tforeach ($arr as $key=> $row) {\n\t\t\t$sort_col[$key] = $row[$col];\n\t\t}\n\t\tarray_multisort($sort_col, $dir, $arr);\n\t}", "function arrayCSort($marray, $column, $sortflag) {\n\t\tforeach ($marray as $row) {\n\t\t\t$sortarr[] = strtolower($row[$column]);\n\t\t}\n\t\tif (isset($sortarr)) {\n\t\t\tif (!is_array($sortarr) ) {\n\t\t\t\treturn $marray;\n\t\t\t}\n\t\t} else {\n\t\t\treturn $marray;\n\t\t}\n\t\tarray_multisort($sortarr, $sortflag, $marray, $sortflag);\n\t\treturn $marray;\n\t}", "function aasort(&$array, $key){ // Seu array e o campo a ser ordenado\r\n\t$sorter = array();\r\n\t$ret = array();\r\n\treset($array);\r\n\tforeach($array as $ii => $va){\r\n\t\t$sorter[$ii] = $va[$key];\r\n\t}\r\n\tasort($sorter);\r\n\tforeach($sorter as $ii => $va){\r\n\t\t$ret[$ii] = $array[$ii];\r\n\t}\r\n\treturn ($ret);\r\n}", "function rearrangePro_orderby(){\n\t\t$args = func_get_args();\n\t\t$data = array_shift($args);\n\t\tforeach ($args as $n => $field) {\n\t\t\tif (is_string($field)) {\n\t\t\t\t$tmp = array();\n\t\t\t\tforeach ($data as $key => $row)\n\t\t\t\t\t$tmp[$key] = $row[$field];\n\t\t\t\t$args[$n] = $tmp;\n\t\t\t}\n\t\t}\n\t\t$args[] = &$data;\n\t\tcall_user_func_array('array_multisort', $args);\n\t\treturn array_pop($args);\n\t}", "function array_sort($array, Closure $callback)\n\t{\n\t\treturn Illuminate\\Support\\Collection::make($array)->sortBy($callback)->all();\n\t}", "protected function _orderColumns(array $row)\n {\n $sortedColumns = array();\n foreach ($this->_columnOrder as $title) {\n $sortedColumns[$title] = $row[$title];\n }\n $row = array_merge($sortedColumns, $row);\n\n return $row;\n }", "public function getSortColumn();", "function sort_array($array, $key)\n {\n foreach ($array as $temp_list) {\n $sort_aux[] = ($temp_list[$key]);\n }\n array_multisort($sort_aux, SORT_ASC, $array);\n\n return $array;\n }", "function adleex_resource_list_column_sort($cols) {\nglobal $current_screen;\n\t\n\tif ($current_screen->post_type!='resource') return $cols;\n\n\t$order = array(\n 'post_title' => true, );\n\tforeach($order\tas $k => $v) $cols[$k]=true;\n\treturn $cols;\n}", "function array_qsort(&$array, $column, $order='SORT_ASC', $first=0, $last=0) {\r\n\t\t// $column - index (column) on which to sort. can be a string if using an associative array\r\n\t\t// $order - SORT_ASC (default) for ascending or SORT_DESC for descending\r\n\t\t// $first - start index (row) for partial array sort\r\n\t\t// $last - stop index (row) for partial array sort\r\n\t\t// $keys - array of key values for hash array sort\r\n\t\tif(is_array($array)) {\r\n\t\t\t$keys = array_keys($array);\r\n\t\t\tif($last == -2) {\r\n\t\t\t\t$last = count($array) - 1;\r\n\t\t\t}\r\n\t\t\tif($last > $first) {\r\n\t\t\t\t$alpha = $first;\r\n\t\t\t\t$omega = $last;\r\n\t\t\t\t$key_alpha = $keys[$alpha];\r\n\t\t\t\t$key_omega = $keys[$omega];\r\n\t\t\t\t$guess = $array[$key_alpha][$column];\r\n\t\t\t\twhile($omega >= $alpha) {\r\n\t\t\t\t\tif($order == 'SORT_ASC') {\r\n\t\t\t\t\t\twhile($array[$key_alpha][$column] < $guess) {\r\n\t\t\t\t\t\t\t$alpha++;\r\n\t\t\t\t\t\t\t$key_alpha = $keys[$alpha]; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\twhile($array[$key_omega][$column] > $guess) {\r\n\t\t\t\t\t\t\t$omega--;\r\n\t\t\t\t\t\t\t$key_omega = $keys[$omega]; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\twhile($array[$key_alpha][$column] > $guess) {\r\n\t\t\t\t\t\t\t$alpha++;\r\n\t\t\t\t\t\t\t$key_alpha = $keys[$alpha]; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\twhile($array[$key_omega][$column] < $guess) {\r\n\t\t\t\t\t\t\t$omega--;\r\n\t\t\t\t\t\t\t$key_omega = $keys[$omega]; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($alpha > $omega) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$temporary = $array[$key_alpha];\r\n\t\t\t\t\t$array[$key_alpha] = $array[$key_omega];\r\n\t\t\t\t\t$alpha++;\r\n\t\t\t\t\t$key_alpha = $keys[$alpha];\r\n\t\t\t\t\t$array[$key_omega] = $temporary;\r\n\t\t\t\t\t$omega--;\r\n\t\t\t\t\t$key_omega = $keys[$omega];\r\n\t\t\t\t}\r\n\t\t\t\tReTidy::array_qsort ($array, $column, $order, $first, $omega);\r\n\t\t\t\tReTidy::array_qsort ($array, $column, $order, $alpha, $last);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $array;\r\n\t}", "public function testSort()\n {\n $array = array(\n array('col1' => 20, 'col2' => 20),\n array('col1' => 20, 'col2' => 10),\n array('col1' => 10, 'col2' => 50),\n array('col1' => 10, 'col2' => 10),\n array('col1' => 10, 'col2' => 20),\n );\n\n $expected = array(\n array('col1' => 10, 'col2' => 50),\n array('col1' => 10, 'col2' => 10),\n array('col1' => 10, 'col2' => 20),\n array('col1' => 20, 'col2' => 20),\n array('col1' => 20, 'col2' => 10),\n );\n\n Sort::mergesort($array, function ($row1, $row2) {\n return strcmp($row1['col1'], $row2['col1']);\n });\n\n $this->assertEquals($expected, $array);\n }", "function fn_sort_md_array_by_value(&$array, $key)\n{\n\t//ref. http://stackoverflow.com/questions/2699086/sort-multi-dimensional-array-by-value\n $sorter=array();\n $ret=array();\n reset($array);\n foreach ($array as $ii => $va) {\n $sorter[$ii]=$va[$key];\n }\n asort($sorter);\n foreach ($sorter as $ii => $va) {\n $ret[$ii]=$array[$ii];\n }\n $array=$ret;\n}", "function sort_array_of_arrays( $array, $sort_by_key ) {\n\n usort( $array, function ( $item1, $item2 ) use ( $sort_by_key ) {\n\n if ($item1[ $sort_by_key ] == $item2[ $sort_by_key ]) return 0;\n return $item1[ $sort_by_key ] < $item2[ $sort_by_key ] ? -1 : 1;\n\n });\n\n return $array;\n\n}", "public function sort(array $array)\n {\n sort($array);\n $count = 0;\n foreach ($array as $key => $valor)\n {\n $arrayOrderecha[$key] = $valor;\n $count ++;\n }\n //retorno del resultado a la vista\n return $arrayOrderecha;\n }", "function sort_by_key($array, $index) {\n\t$sort = array();\n\n\t//préparation d'un nouveau tableau basé sur la clé à trier\n\tforeach ($array as $key => $val) {\n\t\t$sort[$key] = $val[$index];\n\t}\n\n\t//tri par ordre naturel et insensible à la casse\n\tnatcasesort($sort);\n\n\t//formation du nouveau tableau trié selon la clé\n\t$output = array();\n\tforeach($sort as $key => $val) {\n\t\t$output[] = $array[$key];\n\t}\nreturn $output;\n}", "function Ascending(Array $array, $field) {\n if (is_numeric($array[0][$field])) {\n usort($array, array(new MultiArraySorting($field), 'numberSort'));\n } else {\n usort($array, array(new MultiArraySorting($field), 'textSort'));\n }\n return $array;\n }", "function sortByKeys($arr, $rows) {\n\n $res = array();\n foreach($rows as $key=>$val) {\n if(key_exists($key, $arr))\n $res[] = $arr[$key];\n }\n return $res;\n}", "public final function manualSort(){\r\n\t\t$itemid=$this->itemid;\r\n\t\t$position=$this->sortarray;\r\n\t\t$newarray=array();\r\n\t\t$max=-1;\r\n\t\tforeach($this->sorteddata as $pmid){\r\n\t\t\t$i=$itemid[$pmid];\r\n\t\t\tif (!isset($position[$i])) continue;\r\n\t\t\t$newarray[$position[$i]]=$pmid;\r\n\t\t\tif ($max<$position[$i]) $max=$position[$i];\r\n\t\t}\r\n\t\tforeach($this->sorteddata as $pmid){\r\n\t\t\t$i=$itemid[$pmid];\r\n\t\t\tif (!isset($position[$i])) $newarray[++$max]=$pmid;\r\n\t\t}\r\n\t\t$this->sorteddata=$newarray;\r\n\t}", "function sortArray( $data, $field ) {\r\n\t$field = (array) $field;\r\n\tuasort( $data, function($a, $b) use($field) {\r\n\t\t$retval = 0;\r\n\t\tforeach( $field as $fieldname ) {\r\n\t\t\tif( $retval == 0 ) $retval = strnatcmp( $a[$fieldname], $b[$fieldname] );\r\n\t\t}\r\n\t\treturn $retval;\r\n\t} );\r\n\treturn $data;\r\n}" ]
[ "0.72075224", "0.6971323", "0.68631285", "0.68221426", "0.660125", "0.65709245", "0.65704423", "0.64962673", "0.642985", "0.64006233", "0.63797593", "0.6368654", "0.6332017", "0.6230777", "0.6218475", "0.6204416", "0.6183569", "0.61483496", "0.6057417", "0.60482424", "0.60383093", "0.6009252", "0.60062844", "0.60061026", "0.5984341", "0.597668", "0.5971215", "0.5959889", "0.59571636", "0.5951613" ]
0.7365537
0
Sets content for passed container names
public function setContainerContent($containerName, $content = null) { $filter = $containerName; if (is_array($containerName)) { $filter = array_keys($containerName); } $containers = $this->getContentContainers($filter); foreach ($containers as $container) { /** @var ContentContainer $container */ if (is_array($containerName)) { $content = $containerName[$container->getName()]; } $container->html($content); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract function setContent();", "protected function setContent() {}", "public function modifyTextContainer($oldName, $newName, $content, $language);", "public function addTextContainer($name, $content, $language);", "public function set($name, $content)\n {\n $this->slots[$name] = $content;\n }", "static function set($name,$content){\n\t\tif(! self::$enable )\n\t\t\treturn $content;\n\t\tself::init();\n\t\t$i = cacheItem::getInstance($name);\n\t\t$i->content = $content;\n\t\tself::$backend->saveItem($i);\n\t\treturn $content;\n\t}", "function setContent($c) {\n\t\t$this->set(\"content\",$c);\n\t}", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent($content);", "public function setContent( string $content );", "public function setContent($content){\n $this->_content = $content;\n }", "public function setContainer($container);", "public function setContent()\n {\n }", "private function setContent()\n {\n $this->setTag();\n $this->openRoot();\n $this->setParam(ModulesInterface::KEY_NAME, ApiInterface::RAML_TYPE_STRING, ucfirst($this->generator->version));\n $this->setParam(ConfigInterface::ATTRIBUTES_CASE, ApiInterface::RAML_TYPE_STRING, ConfigInterface::DEFAULT_CASE);\n $this->setQueryParams();\n $this->setTrees();\n $this->setJwtContent();\n $this->setConfigEntities();\n $this->closeRoot();\n }", "abstract public function setContentFromString($string);", "function container($params,$content,&$smarty,&$repeat) {\n\t\t$smarty->assign('title',$params['title']);\n\t\t$smarty->display('open_container.tpl');\n\t\techo($content);\n\t\t$smarty->display('close_container.tpl');\n\t}", "function setContent($content){\n\t\t\tglobal $tableContent;\n\t\t\t\n\t\t\t$tableContent = $content;\n\t\t}", "function setContent($content){\n\t\t\tglobal $tableContent;\n\t\t\t\n\t\t\t$tableContent = $content;\n\t\t}", "public function setContents($contents) {\n $this->_contents = $contents;\n }", "public function add_content($target,$content)\n \t{\n \t\t$this->content[$target][]=$content;\n \t}", "public function set_content() {\n\n\t\t$this->content = get_the_term_list( $this->data, $this->taxonomy, $this->prepend, $this->delimiter, $this->append );\n\t}", "public function setContent( string $content ) : void\n {\n $this->content = $content;\n }" ]
[ "0.67093754", "0.6180445", "0.6101917", "0.5911395", "0.58794975", "0.5862074", "0.58462167", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.5804091", "0.57720333", "0.5686377", "0.564637", "0.5643341", "0.559326", "0.5543601", "0.5522536", "0.5521415", "0.5521415", "0.55144536", "0.5466379", "0.54655606", "0.5440816" ]
0.70741147
0
Returns a list of container names contained in page.
public function containerNames() { return $this->contentManager->listContainerNames(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getContainers()\n\t\t{\n\t\t\treturn $this->getTab( '_options_tab' )->getContainers();\n\t\t}", "public function getContainers()\n {\n }", "public function getContainers()\n {\n return $this->containers;\n }", "public function getContainers()\n {\n return $this->containers;\n }", "public function getContainers()\n\t\t{\n\t\t\treturn $this->_containers;\n\t\t}", "protected function findAll()\n {\n return ContainerPage::find()->contentContainer($this->contentContainer)->all();\n }", "public function getContainers()\n {\n $cmdResult = explode(\n \" \",\n $this->execute(\"docker ps -aq --filter 'name=cache-'\")\n );\n\n return array_map(\n 'trim',\n $cmdResult\n );\n }", "protected function getPageClassName()\n {\n return ContainerPage::className();\n }", "public function getContainerName();", "public function getContainerIDsAndTitles()\n {\n $retval = array();\n if (isset($this->fields['container_ids_and_titles']) && !empty($this->fields['container_ids_and_titles'])) {\n foreach ($this->fields['container_ids_and_titles'] as $id_and_title) {\n $a = explode(chr(0x1F), str_replace(\"#31;\", chr(0x1F), $id_and_title), 3);\n if (count($a) == 3) {\n $retval[$a[0]] = array($a[1], $a[2]);\n }\n }\n }\n return $retval;\n }", "protected function _getCollectionNames()\n {\n return array();\n }", "function getRunningContainers() {\n\tglobal $communitySettings, $DockerClient, $DockerTemplates;\n\n\tif ( $communitySettings['dockerRunning'] ) {\n\t\t$info = $DockerTemplates->getAllInfo();\n# workaround for incorrect caching in dockerMan\n\t\t$containers = $DockerClient->getDockerContainers();\n\t\tforeach ($containers as $container) {\n\t\t\t$info[$container['Name']]['running'] = $container['Running'];\n\t\t\t$info[$container['Name']]['repository'] = $container['Image'];\n\t\t\t$info[$container['Name']]['ImageId'] = $container['ImageId'];\n\t\t\t$info[$container['Name']]['Id'] = $container['Id'];\n\t\t\t$info[$container['Name']]['Name'] = $container['Name'];\n\t\t\t$infoTmp[$container['Name']] = $info[$container['Name']];\n\t\t}\n\t}\n\treturn $infoTmp ?: array();\n}", "public function getCmsElementNames();", "public function getTabPageNames()\n {\n return $this->getChildren()->getTypedControlNames(true, \"TabPage\");\n }", "private function get_node_children(midgard_page $node)\n {\n $children = array();\n $mc = midgard_page::new_collector('up', $node->id);\n $mc->set_key_property('name');\n $mc->add_value_property('title');\n $mc->execute(); \n $pages = $mc->list_keys();\n foreach ($pages as $name => $array)\n {\n if (empty($name))\n {\n continue;\n }\n $children[] = array\n (\n 'uri' => \"{$_MIDCOM->context->prefix}{$name}/\", // FIXME: dispatcher::generate_url\n 'title' => $mc->get_subkey($name, 'title'),\n 'mimetype' => 'httpd/unix-directory',\n 'resource' => 'collection',\n );\n }\n \n if ($_MIDCOM->context->page->id == $_MIDCOM->context->host->root)\n {\n // Additional \"special\" URLs\n $children[] = array\n (\n 'uri' => \"{$_MIDCOM->context->prefix}__snippets/\", // FIXME: dispatcher::generate_url\n 'title' => 'Code Snippets',\n 'mimetype' => 'httpd/unix-directory',\n 'resource' => 'collection',\n );\n $children[] = array\n (\n 'uri' => \"{$_MIDCOM->context->prefix}__styles/\", // FIXME: dispatcher::generate_url\n 'title' => 'Style Templates',\n 'mimetype' => 'httpd/unix-directory',\n 'resource' => 'collection',\n );\n }\n\n return $children;\n }", "public function GetSystemPageNames()\n {\n $aSystemPages = $this->GetSystemPageLinkList(false);\n\n return array_keys($aSystemPages);\n }", "public function getClassNamesForContainer()\n {\n $classes = ['container'];\n \n if ($this->owner->isEdgeToEdge()) {\n $classes[] = $this->style('row.edge-to-edge');\n }\n \n return $classes;\n }", "public function containers()\n {\n }", "public function getDefinitions()\n {\n return $this->containers;\n }", "private function getContainers(array $names)\n {\n $this->logger->debug('Getting container details');\n $process = new Process(['docker', 'ps', '--no-trunc', '--format', '\\'{{json .}}\\'']);\n $process->mustRun();\n $result = $process->getOutput();\n $containers = array_column(\n array_map(static function ($line) {\n $json = trim($line, \"'\");\n\n return json_decode($json, true, 512, JSON_THROW_ON_ERROR);\n }, array_filter(explode(PHP_EOL, $result))),\n null,\n 'ID'\n );\n\n $containers = array_filter($containers, static function ($id) use ($names) {\n return isset($names[$id]);\n }, ARRAY_FILTER_USE_KEY);\n\n // Add names\n foreach ($containers as $id => &$container) {\n $container['Name'] = $names[$id];\n }\n\n return $containers;\n }", "public function getNames() {}", "public function getNames() {}", "public function getNames() {}", "private function getPages()\n {\n $directory = __DIR__.'/Page/';\n // remove .. and . folder in unix\n $pageFolders = array_diff(scandir($directory), array('..', '.'));\n\n return $pageFolders;\n }", "function getNavs() {\n\t$pageData = getPageData();\n\t$li = '';\n\tforeach($pageData as $k => $v) {\n\t\t$li .= '<li><a href=\"' . COVER_PAGE . '?show=' . $k .'\">' . $k . '</a></li>' . \"\\n\";\n\t}\n\treturn $li;\n}", "public function getTagCloud()\n {\n $tagCloud = [];\n \n $pages = $this->entityManager->getRepository(Page::class)\n ->findPagesHavingAnyTag();\n $totalPageCount = count($pages);\n \n $tags = $this->entityManager->getRepository(Tag::class)\n ->findAll();\n foreach ($tags as $tag) {\n \n $pagesByTag = $this->entityManager->getRepository(Page::class)\n ->findPagesByTag($tag->getName());\n \n $pageCount = count($pagesByTag);\n if ($pageCount > 0) {\n $tagCloud[$tag->getName()] = $pageCount;\n }\n }\n \n $normalizedTagCloud = [];\n \n // Normalize\n foreach ($tagCloud as $name=>$pageCount) {\n $normalizedTagCloud[$name] = $pageCount/$totalPageCount;\n }\n \n return $normalizedTagCloud;\n }", "protected function get_container_name(): string {\n\t\t$parse = \\wp_parse_url( get_site_url() );\n\t\t$domain = $parse['host'];\n\n\t\t// Naming conventions, only letters\n\t\t// Container names must start or end with a letter or number, and can contain only letters, numbers, and the dash (-) character.\n\t\t// https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata.\n\t\t$container_name = strtolower( preg_replace( '/[^a-zA-Z0-9-]/', '-', $domain ) );\n\n\t\treturn $container_name;\n\t}", "public function getNames();", "private static function getParents(SiteTree $page)\n {\n $parents = array();\n\n $parent = $page->parent();\n\n while ($parent && $parent->exists()) {\n array_push($parents, $parent);\n // Keep looping\n $parent = $parent->parent();\n }\n\n return $parents;\n }", "public function container(): string;" ]
[ "0.6195086", "0.61684966", "0.60494167", "0.60494167", "0.59551954", "0.58465576", "0.57482284", "0.5691839", "0.56346464", "0.55717766", "0.5406663", "0.54057586", "0.5392516", "0.53511715", "0.53510904", "0.53258145", "0.5305574", "0.52819705", "0.5267462", "0.5257349", "0.52266675", "0.52266675", "0.5226045", "0.5216193", "0.52128226", "0.5156717", "0.513223", "0.51135904", "0.5102982", "0.5091228" ]
0.73039705
0
Returns weather page contains specific container (does it contains .sccontent$container container)
public function hasContainer($container = '') { return in_array($container, $this->containerNames()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function showContainer() {\r\n\t\tif( self::$_bShowContainer ) {\r\n\t\t\techo self::$_smarty->fetch( self::$_smartyContainerFilename );\r\n\t\t}\r\n\t\telse {\r\n\t\t\techo self::$_smarty->getTemplateVars('content');\r\n\t\t}\r\n\t}", "function is_container_not_fluid($control) {\n\tif ($control->manager->get_setting ( 'loungeact[container_class]' )->value () == 'container') {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "public function container(): string;", "public function getContainer() {}", "function sc_container( $attr, $content='' ) {\n\t$class = isset( $attr['class'] ) ? $attr['class'] : '';\n\tob_start();\n\t?>\n\t<div class=\"container <?php echo $class; ?>\">\n\t\t<?php echo do_shortcode( $content ); ?>\n\t</div>\n\t<?php\n\treturn ob_get_clean();\n}", "function is_visible_container( $container_key, $setting_name = 'access_login_containers' )\n\t{\n\t\t$access = $this->get_setting( $setting_name );\n\n\t\treturn ( ! empty( $access ) && ! empty( $access[ $container_key ] ) );\n\t}", "public function testGetContainer() {\r\n\t\t$this->testObject->setContainer ( 'div' );\r\n\t\t$this->assertTrue ( 'div' == $this->testObject->getContainer (), 'incorrect html container returned' );\r\n\t}", "public function getContainer();", "public function getContainer();", "public function getContainer();", "public function getContainer();", "public function getContainer();", "public function container();", "public function isContainer($in)\n {\n $elt = $this->getElement($in);\n\n return ($elt &&\n (($elt['a'] & self::ELT_NOSELECT) ||\n (((!$this->_showunsub && !$this->isSubscribed($elt)) ||\n $this->isInvisible($elt)) &&\n $this->hasChildren($elt, true))));\n }", "public function getContainers()\n {\n }", "public static function container(){\n\n $container = 'container';\n\n return $container;\n\n }", "public function containerInspect($container)\n {\n return $this->browser->get(\n $this->uri->expand(\n 'containers/{container}/json',\n array(\n 'container' => $container\n )\n )\n )->then(array($this->parser, 'expectJson'));\n }", "public static function container($container = 'default')\n {\n if ( ! isset(static::$containers[$container]))\n {\n static::$containers[$container] = new Asset_Container($container);\n }\n\n return static::$containers[$container];\n }", "public function container_fetch($mainContainerTag,$mcContentType,$scContentType = null) {\n\n if(!empty($scContentType)){\n /*fetch both a main container together with its sub containers*/\n return $this->model->main_sub_fetch($mainContainerTag, $mcContentType, $scContentType, $this->page);\n } else {\n\n return $this->model->singular_fetch($mainContainerTag,$mcContentType,$this->page);\n }\n\n }", "public function getUserContainer()\n {\n\n $url = \"https://ecouncil.burwood.nsw.gov.au/eservice/daEnquiryInit.do?doc_typ=10&nodeNum=219\";\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, !$this->config->dev);\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, !$this->config->dev);\n curl_setopt($ch, CURLOPT_HEADER, false);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($ch, CURLOPT_TIMEOUT, 30);\n curl_setopt($ch, CURLOPT_COOKIEFILE, $this->config->directories->cookiesDir . 'cookies.txt');\n curl_setopt($ch, CURLOPT_COOKIEJAR, $this->config->directories->cookiesDir . 'cookies.txt');\n curl_setopt($ch, CURLOPT_USERAGENT, $this->config->useragent);\n\n $output = curl_exec($ch);\n $errno = curl_errno($ch);\n $errmsg = curl_error($ch);\n curl_close($ch);\n\n if ($errno !== 0) {\n\n $logMsg = sprintf(\"cURL error: [%s] (%s)\", $errmsg, $errno);\n $this->logger->info($logMsg);\n return false;\n }\n\n return true;\n\n }", "public function getContainer( $slug )\n\t\t{\n\t\t\tforeach( $this->_containers as $container ) {\n\t\t\t\tif( $container->getSlug() == $slug ) {\n\t\t\t\t\treturn $container;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}", "public function container() : ?Container;", "public function getContainer()\n {\n //Return container\n return $this->contentListContainer;\n }", "public function getRackspaceContainer() {\n return @$this->attributes['rackspace_container'];\n }", "function render_page_container( $pageinfo , $firstClass )\n\t\t{\t\n\t\t\tif(!isset($pageinfo['sortable'])) $pageinfo['sortable'] = \"\";\n\t\t\t\n\t\t\t$output = '<div class=\"ace_subpage_container '.$firstClass.' '.$pageinfo['sortable'].'\" id=\"ace_'.ace_backend_safe_string($pageinfo['title']).'\">';\t\n\t\t\t$output .= '\t<div class=\"ace_section_header\">';\t\n\t\t\t$output .= '\t\t<strong class=\"ace_page_title\" style=\"background-Image:url('.ACE_IMG_URL.\"icons/\".$pageinfo['icon'].');\">'; \n\t\t\t$output .= \t\t\t$pageinfo['title'];\n\t\t\t$output .= '\t\t</strong>'; \n\t\t\t$output .= '\t</div>'; \n\t\t\treturn $output;\n\t\t}", "function getRunningContainers() {\n\tglobal $communitySettings, $DockerClient, $DockerTemplates;\n\n\tif ( $communitySettings['dockerRunning'] ) {\n\t\t$info = $DockerTemplates->getAllInfo();\n# workaround for incorrect caching in dockerMan\n\t\t$containers = $DockerClient->getDockerContainers();\n\t\tforeach ($containers as $container) {\n\t\t\t$info[$container['Name']]['running'] = $container['Running'];\n\t\t\t$info[$container['Name']]['repository'] = $container['Image'];\n\t\t\t$info[$container['Name']]['ImageId'] = $container['ImageId'];\n\t\t\t$info[$container['Name']]['Id'] = $container['Id'];\n\t\t\t$info[$container['Name']]['Name'] = $container['Name'];\n\t\t\t$infoTmp[$container['Name']] = $info[$container['Name']];\n\t\t}\n\t}\n\treturn $infoTmp ?: array();\n}", "public function parseContainer($container = null);", "public function getContainerById($id) {\n try {\n $client = new Zend_Soap_Client($this->CONTAINER_WSDL_URI);\n $options = array('soap_version' => SOAP_1_1,\n 'encoding' => 'ISO-8859-1',\n );\n $client->setOptions($options);\n $client->action = 'findByContainerId';\n $result = $client->findByContainerId($id);\n return $result;\n } catch (Exception $e) {\n //return false;\n }\n }", "public function getContainers()\n {\n return $this->containers;\n }", "public function getContainers()\n {\n return $this->containers;\n }" ]
[ "0.58931136", "0.55294085", "0.5410436", "0.5401567", "0.54000497", "0.53779864", "0.53713953", "0.536143", "0.536143", "0.536143", "0.536143", "0.536143", "0.5269339", "0.52486885", "0.5233294", "0.5213143", "0.51920515", "0.5165071", "0.51642174", "0.51351863", "0.5118334", "0.51053464", "0.50972056", "0.50919807", "0.4974507", "0.49582514", "0.4923934", "0.49132022", "0.4908898", "0.4908898" ]
0.5556834
1
Reads the page description meta tag.
public function getPageDescription() { $element = $this->query('meta[name="description"]')->first(); if ($element) { return $element->getAttribute('content'); } return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getMetaDescription() {\n return (isset($this->metaDescription) && $this->metaDescription!='') ? $this->metaDescription : Params::param('metainfo-metaDescription');\n }", "public function description()\n {\n $description = $this->DOM->filter(\"meta[name='description']\")->attr('content');\n\n return $description;\n }", "function arras_document_description() {\n\tif ( class_exists('All_in_One_SEO_Pack') || class_exists('Platinum_SEO_Pack') ) return false;\n\t\n\tif ( is_single() || is_page() ) {\n\t\tif ( have_posts() ) {\n\t\t\twhile( have_posts() ) {\n\t\t\t\tthe_post();\n\t\t\t\techo '<meta name=\"description\" content=\"' . get_the_excerpt() . '\" />';\n\t\t\t}\n\t\t}\n\t} else {\n\t\techo '<meta name=\"description\" content=\"' . get_bloginfo('description') . '\" />';\n\t}\n}", "function site_description() {\n\treturn site_meta('description');\n}", "public function meta_description()\n\t{\n\t\treturn $this->meta_description;\n\t}", "static public function getDescription() {\n\t\treturn self::$page_description;\n\t}", "function writeMetatags($description) {\r\n echo '<meta name=\"author\" content=\"Stephen Wallace\">' . \"\\n\";\r\n echo \"<meta name=\\\"description\\\" content=\\\"$description\\\">\\n\";\r\n}", "public static function description(string $content): MetaTag {\n return static::namedContent('description', $content);\n }", "function wpcom_vip_meta_desc() {\n _deprecated_function( __FUNCTION__, '2.0.0' );\n\n $text = wpcom_vip_get_meta_desc();\n if ( !empty( $text ) ) {\n echo \"\\n<meta name=\\\"description\\\" content=\\\"$text\\\" />\\n\";\n }\n}", "public function getMetaDescription();", "public function get_description () {\r\n\t\t$content = file_get_contents($this->url);\r\n\t\t$regex = preg_match('/<p id=\"eow-description\" class=\"\" >(.*)<\\/p>/i', $content, $matches);\r\n\t\treturn $matches[1];\r\n\t}", "public static function description($description)\n {\n // Set page description\n self::$data['description'] = $description;\n }", "public function getMetaDescription(): string\n {\n return (string) $this->metaDescription;\n }", "public function meta_description()\n\t{\n\t\treturn $this->get_context_meta_value( __FUNCTION__ );\n\t}", "public function getDescription() {\n\t\treturn Template::getSiteMetaDescription();\n\t}", "public function getDescription(): string\n {\n $description = $this->meta[\"description\"] ?? \"\";\n return is_array($description) ? end($description) : $description;\n }", "function getPageDescription() {\n global $wp_query,\n $post;\n\n $description = get_bloginfo( 'description' );\n\n // single / page\n if( ( is_single() || is_page() ) && !is_front_page() ) {\n $_description = $post->post_content;\n\n // try fetching first text blocks\n if( function_exists( 'get_field' ) ) {\n if( $blocks = get_field( 'blocks', $post->ID ) ) {\n for( $i = 0; $i < count( $blocks ); $i++ ) {\n if( $blocks[$i]['acf_fc_layout'] === 'text' ) {\n $_description = $blocks[$i]['text'];\n break;\n }\n }\n }\n }\n\n if( function_exists( 'get_field' ) ) {\n if( get_field( 'linkpreview--description', $post->ID ) ) {\n $_description = get_field( 'linkpreview--description', $post->ID );\n }\n }\n\n $description = ( !empty( $_description ) ) ? $_description : $description;\n }\n\n // custom taxonomy terms\n if( !empty( $wp_query->query_vars['term'] ) ) {\n $term = get_term_by( 'slug', $wp_query->query_vars['term'], $wp_query->query_vars['taxonomy'] );\n if( $term ) {\n $description = ( !empty( $term->description ) ) ? $term->description : $description;\n }\n }\n\n // tags\n if( is_tag() ) {\n $tag = get_term_by( 'slug', $wp_query->query['tag'], 'post_tag' );\n if( $tag ) {\n $description = ( !empty( $tag->description ) ) ? $tag->description : $description;\n }\n }\n\n // category\n if( is_category() ) {\n $category = get_term_by( 'slug', $wp_query->query['category_name'], 'category' );\n if( $category ) {\n $description = ( !empty( $category->description ) ) ? $category->description : $description;\n }\n }\n\n // author\n if( !empty( $wp_query->query['author_name'] ) ) {\n $author = get_user_by( 'slug', $wp_query->query['author_name'] );\n if( $author ) {\n $biography = get_the_author_meta( 'description', $author->ID );\n $description = ( !empty( $biography ) ) ? $biography : $description;\n }\n }\n\n return wp_trim_words( $description, 115, null );\n}", "function getMetaTags($pageName){\n\t\t\t$metaTags = $this->manage_content->getValue_where('meta_tags','*','page',$pageName);\n\t\t\techo '<meta name=\"keywords\" content=\"'.$metaTags[0]['keyword'].'\" />\n<meta name=\"description\" content=\"'.$metaTags[0]['description'].'\" />';\n\t\t}", "public function metaDescription()\n\t{\n\t\tif ( static::$titleLangPrefix and static::$descriptionLangSuffix )\n\t\t{\n\t\t\treturn \\IPS\\Member::loggedIn()->language()->addToStack( static::$titleLangPrefix . $this->id . static::$descriptionLangSuffix, FALSE, array( 'striptags' => TRUE ) );\n\t\t}\n\t\treturn NULL;\n\t}", "public function testDescription()\n {\n $description_original = \"This is the original \\\"description\\\".\";\n $description_received =\n MetaTags::setDescription($description_original,0)\n ->getDescription();\n\n // Make sure what we got back is what we put in. (not truncated)\n $this->assertEquals(\n $description_original,\n $description_received,\"The original description was not a match\"\n );\n\n // Do the same test, but with truncation turned on.\n $description_received =\n MetaTags::setDescription($description_original,10)\n ->getDescription();\n\n // Test to make sure truncation is working.\n $this->assertEquals(\n $description_received,\n MetaTags::truncateAtWord($description_original,10)\n );\n\n $tag_text = MetaTags::renderDescription(true)->__toString();\n $this->assertStringStartsWith(\"<meta \",$tag_text);\n $this->assertStringEndsWith(\">\",$tag_text);\n }", "private function readMetaConfig(){\r\n\t\tif($this->CI->config->item('zt_head_meta')){\r\n\t\t\t$metaTags = $this->CI->config->item('zt_head_meta');\r\n\t\t\t$meta = null;\r\r\n\t\t\tforeach($metaTags as $metaTag){\r\n\t\t\t\tif(isset($metaTag[\"type\"])){\r\t\t\t\t\tif(isset($metaTag[\"lang\"]) && $metaTag[\"lang\"] && !empty($this->langService)){\r\t\t\t\t\t\t$meta = new Meta($metaTag[\"type\"], $metaTag[\"name\"], $this->langService->GetPrimaryWithSubLangCode());\t\r\t\t\t\t\t} else {\r\t\t\t\t\t\t$meta = new Meta($metaTag[\"type\"], $metaTag[\"name\"], $metaTag[\"content\"]);\t\r\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$meta = new Meta(Meta::TYPE_NAME, $metaTag[\"name\"], $metaTag[\"content\"]);\r\n\t\t\t\t}\r\r\n\t\t\t\t$this->head->AddMetaTag($meta);\r\n\t\t\t}\r\n\t\t}\r\r\n\t}", "protected function _parseDescTag() {}", "public static function get_front_page_meta_description() {\n\t\t$front_page_meta = get_option( self::FRONT_PAGE_META_OPTION );\n\n\t\tif ( empty( $front_page_meta ) ) {\n\t\t\t$legacy_meta_option = get_option( self::LEGACY_META_OPTION );\n\t\t\tif ( ! empty( $legacy_meta_option ) ) {\n\t\t\t\treturn self::update_front_page_meta_description( $legacy_meta_option, true );\n\t\t\t}\n\t\t}\n\n\t\treturn $front_page_meta;\n\t}", "public function setPageDescription($text)\n {\n $metaDescription = $this->query('meta[name=\"description\"]')->first();\n if ($text === '') {\n // If empty value passed we need to remove title tag\n if ($metaDescription) {\n $this->removeElement($metaDescription);\n }\n } else {\n if ($metaDescription) {\n $metaDescription->setAttribute('content', $text);\n } else {\n // Try to insert meta description tag into head\n $metaDescription = new Meta('description', $text);\n $head = $this->query('head');\n if ($head->count() > 0) {\n /* @var Element $head */\n $this->appendTo($head->first(), $metaDescription);\n }\n }\n }\n }", "private function getMetaData ()\n\t\t{\n\t\t\t$data = file_get_contents (\"META.inf\");\n\t\t\t$o = json_decode ($data,true);\n\t\t\treturn $o;\t\n\t\t}", "public static function get_front_page_meta_description() {\n\t\tif ( self::is_enabled_jetpack_seo() ) {\n\t\t\t$front_page_meta = get_option( self::FRONT_PAGE_META_OPTION );\n\t\t\treturn $front_page_meta ? $front_page_meta : get_option( self::GRANDFATHERED_META_OPTION, '' );\n\t\t}\n\n\t\t// Support grandfathering for non-business users.\n\t\treturn get_option( self::GRANDFATHERED_META_OPTION, '' );\n\t}", "function getInfo ()\n\t{\n\t\t$node = $this->getElementsByTagname(\"MetaData\");\n\n\t\tif($node !== false)\n\t\t{\n\t\t\t$childs = $node[0]->child_nodes();\n\n\t\t\tforeach ($childs as $child)\n\t\t\t{\n\t\t\t\t\tif (($child->node_type() == XML_ELEMENT_NODE) && ($child->tagname == \"General\"))\n\t\t\t\t\t{\n\t\t\t\t\t\t$childs2 = $child->child_nodes();\n\n\t\t\t\t\t\tforeach ($childs2 as $child2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (($child2->node_type() == XML_ELEMENT_NODE) && ($child2->tagname == \"Title\" || $child2->tagname == \"Description\"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$arr[$child2->tagname] = $child2->get_content();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// General-tag was found. Stop foreach-loop\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// for compatibility reasons:\n\t\t$arr[\"title\"] = $arr[\"Title\"];\n\t\t$arr[\"desc\"] = $arr[\"Description\"];\n\n\t\treturn $arr;\n\t}", "function getDataDescription($data)\n{\n\t$dataDesc = getData($data, \"Page/Description\");\n\treturn $dataDesc[0];\n}", "public function blogdescription() {\n\n\t\tbloginfo( 'description' );\n\n\t}", "private function readDescriptionConfig(){\r\t\tif(empty($this->langService) || $this->langService->IsDefaultSelected()){\r\t\t\tif(empty($this->langService) || $this->CI->config->item(\"zt_site_description\")){\r\t\t\t\t$description = $this->CI->config->item(\"zt_site_description\");\r\t\t\t\t$this->head->SetDescription($description);\r\t\t\t}\t\r\t\t} else {\r\t\t\tif($this->CI->config->item(\"zt_site_description_\" . $this->langService->GetLangCode())){\r\t\t\t\t$description = $this->CI->config->item(\"zt_site_description_\" . $this->langService->GetLangCode());\r\t\t\t\tif(empty($description)){\r\t\t\t\t\t$description = $this->CI->config->item(\"zt_site_description\");\t\r\t\t\t\t}\r\t\t\t\t\r\t\t\t\t$this->head->SetDescription($description);\r\t\t\t}\r\t\t}\r\n\t}" ]
[ "0.6822339", "0.6710006", "0.6708061", "0.664036", "0.6541855", "0.6512424", "0.63987523", "0.6394304", "0.63880146", "0.635342", "0.63009965", "0.6257565", "0.61920655", "0.61899346", "0.60884774", "0.6063717", "0.60565317", "0.60435146", "0.6014236", "0.59969735", "0.59719956", "0.59604067", "0.5950121", "0.5946041", "0.58658177", "0.58340055", "0.58224285", "0.58136183", "0.5805937", "0.5788654" ]
0.7191118
0
Sets the page description meta tag with the given content.
public function setPageDescription($text) { $metaDescription = $this->query('meta[name="description"]')->first(); if ($text === '') { // If empty value passed we need to remove title tag if ($metaDescription) { $this->removeElement($metaDescription); } } else { if ($metaDescription) { $metaDescription->setAttribute('content', $text); } else { // Try to insert meta description tag into head $metaDescription = new Meta('description', $text); $head = $this->query('head'); if ($head->count() > 0) { /* @var Element $head */ $this->appendTo($head->first(), $metaDescription); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function description(string $content): MetaTag {\n return static::namedContent('description', $content);\n }", "public function setMetaDescriptionAttribute($value)\n {\n $this->attributes['meta_description'] = $value;\n\n if (empty($value)) {\n $this->attributes['meta_description'] = config('settings.meta_description');\n }\n }", "public function setDescription($description) {\n\t\tTemplate::setSiteMetaDescription($description);\n\t}", "public function setDescription($description)\n\t{\n\t\t$this->description = $description;\n\n\t\tif($this->pageInitialized)\n\t\t\t$this->setMetaTag('description', $this->description);\n\t}", "protected function addDescriptionToTlHead($content)\n {\n if ($GLOBALS['TL_HEAD']) {\n foreach ($GLOBALS['TL_HEAD'] as $i => $entry) {\n if (preg_match(\"/description/\", $entry)) {\n unset($GLOBALS['TL_HEAD'][$i]);\n }\n }\n }\n $GLOBALS['TL_HEAD'][] = sprintf('<meta name=\"description\" content=\"%s\">', $content);\n }", "protected function set_meta_desc()\r\r\n {\r\r\n define('_KEYWORDS',_BUY_ONLINE);\r\r\n define('_DESCRIPTION',_BUY_ONLINE);\r\r\n define('_TITLE_PAGE',_BUY_ONLINE);\r\r\n }", "protected function setMeta($title = '', $desc = '', $keywords = '')\n {\n $this->meta['title'] = $title;\n $this->meta['desc'] = $desc;\n $this->meta['keywords'] = $keywords;\n }", "public function setDescription ($value) {\n\t\t$this->setData(\"pageDescription\", $value);\n\t\treturn true;\n\t}", "public static function description($description)\n {\n // Set page description\n self::$data['description'] = $description;\n }", "function writeMetatags($description) {\r\n echo '<meta name=\"author\" content=\"Stephen Wallace\">' . \"\\n\";\r\n echo \"<meta name=\\\"description\\\" content=\\\"$description\\\">\\n\";\r\n}", "function setHeadDescription($var)\n\t{\n\t\t$this -> head_description = $var;\n\t}", "public function addMeta($content, $name = 'description')\n\t{\n\t\t$this->_themeExtras['meta'][$name] = $content;\n\t}", "public function addMetaTag($name,$desc){\n $this->_metaTags[$name] = $desc;\n }", "public function add_meta() {\n\t\techo \"\\n<meta data-plugin='a04_vertical_button' name='description' content='a sample meta description for this website'/>\\n\\n\";\n\t}", "public function setPageDescription($pageDescription)\n {\n $this->_pageDescription = $pageDescription;\n }", "public function AddMeta($name, $content) {\n \t\t$this->_headMeta[$name] = $content;\n \t}", "public function set_description($description) \n\t{\n\t\t$tag = ($this->version == ATOM)? 'summary' : 'description'; \n\t\t$this->add_element($tag, $description);\n\t}", "static public function setDescription($new_description) {\n\t\tself::$page_description = (string)$new_description;\n\t}", "function renderMetadata($content, $configuration) {\n\t\t$this->conf = $configuration;\n\t\t$this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');\n\t\t$this->sys_page->init($GLOBALS['TSFE']->showHiddenPage);\n\n\t\t$templateLayouts = array (\n\t\t\t'title' => $configuration['layouts.']['title'],\n\t\t\t'description' => $configuration['layouts.']['description'],\n\t\t\t'keywords' => $configuration['layouts.']['keywords']\n\t\t);\n\t\t$a_alternativePageContent = $this->getAlternativePageContent();\n\n\t\t// Set index/follow of page\n\t\t$a_indexFollow = array( 1 => 'noindex, nofollow', 2 => 'index, follow', 3 => 'noindex, follow', 4 => 'index, nofollow' );\n\t\t$GLOBALS['TSFE']->pSetup['meta.']['robots'] = $a_indexFollow[ $a_alternativePageContent['tx_rkmetadata_seo'] ];\n\n\t\t// Get the MetaData (keywords, description || get from rootLine when not available)\n\t\t$this->s_keyWords = $this->cleanForKeywords( $a_alternativePageContent['keywords'] );\n\t\t$this->s_description = $this->cleanForKeywords( $a_alternativePageContent['description'] );\n\n\t\t$this->s_keyWords = $this->replaceDynamicData( $templateLayouts['keywords'] ); // Get the dynamic page keywords\n\t\t$this->s_description = $this->replaceDynamicData( $templateLayouts['description'] ); // Get the dynamic page description\n\t\t$this->s_title = $this->replaceDynamicData( $templateLayouts['title'] ); // Get the dynamic page title\n\n\t\t// Set the MetaData (keywords, description and title)\n\t\t$GLOBALS['TSFE']->pSetup['meta.']['keywords'] = $this->s_keyWords;\n\t\t$GLOBALS['TSFE']->pSetup['meta.']['description'] = $this->s_description;\n\n\t\treturn('<title>'.$this->s_title.'</title>');\n\t}", "protected function _setMetaDescription(array $metaDescription)\n {\n $metaDescription = $this->_insertContent(\n $this->getOriginPageMetaDescription(),\n $metaDescription,\n self::HEADING_DESCRIPTION_SEPARATOR\n );\n $this->category->setData('meta_description', $metaDescription);\n return $this;\n }", "function setDescription( $value )\r\n {\r\n $this->Description = $value;\r\n }", "function setDescription( $value )\r\n {\r\n $this->Description = $value;\r\n }", "protected function setDescription($description) {\r\n $this->description = $description;\r\n }", "public function meta($name = \"\", $content =\"\") {\n echo \"<meta name='\" . $name . \"' content ='\" . $content . \"'>\";\n }", "public function setDescription($desc) {\n\t\t$this->description = $desc;\n\t}", "public function addMeta($name, $content)\n\t{\n\t\t$this->meta[$name] = '<META name=\"' . $name . '\" content=\"'. $content .'\">' . PHP_EOL;\n\t}", "function setDescription($description) {\n\t\t$this->description = $description;\n\t}", "public function setDescription($desc)\n {\n $this->description = $desc;\n }", "public function setDescription($value)\n {\n $this->setItemValue('description', (string)$value);\n }", "public function addContentMeta($name, $value): void\n {\n $this->_content_meta[$name] = $value;\n }" ]
[ "0.7295828", "0.7261422", "0.72327876", "0.7122621", "0.6840984", "0.67465454", "0.67297256", "0.6700923", "0.66913474", "0.66386557", "0.6572405", "0.6570796", "0.6557805", "0.6545076", "0.6531342", "0.6482197", "0.6467233", "0.64413965", "0.63923985", "0.63854766", "0.6370143", "0.6370143", "0.63698596", "0.63688827", "0.63625836", "0.63121265", "0.63074017", "0.6302475", "0.6291149", "0.62496394" ]
0.80547327
0
Gets PaymentDate &lt;xs:element name="PaymentDate" type="SAFdateType"/&gt;
public function getPaymentDate(): RDate { \Logger::getLogger(\get_class($this)) ->info( \sprintf( __METHOD__." get '%s'", $this->paymentDate->format(RDate::SQL_DATE) ) ); return $this->paymentDate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPaymentDate();", "public function getPaymentDate() {\n\t\t// return $this->created_at;\n\t\treturn $this->account ? $this->account->payment_date : $this->created_at;\n\t}", "public function getFirstPaymentDate()\n\t{\n\t\treturn $this->first_payment_date;\n\t}", "public function getFormattedPaymentDate(): string;", "public function getPayDate() {\r\n\r\n\t\tself::errorReset();\r\n\t\t$this->reload();\r\n\t\treturn $this->payDate;\r\n\t}", "public function getDate()\n {\n $yearconst = $this->getValue(self::XPATH_YEAR);\n $monthconst = $this->getValue(self::XPATH_MONTH);\n $dayconst = $this->getValue(self::XPATH_DAY);\n\n return $this->formateDate($yearconst, $monthconst, $dayconst);\n }", "public function getFirstPaymentDate() {\r\n $query = $this->createQuery($this->_alias)\r\n ->select(\"DATE_FORMAT(cp.created_at, '%Y-%m') AS payment_date\")\r\n ->orderBy(\"id ASC\")\r\n ->limit(1);\r\n\r\n $res = $query->execute(array(), Doctrine_Core::HYDRATE_SCALAR);\r\n\r\n if (count($res) > 0) {\r\n $res = $res[0][\"cp_payment_date\"];\r\n }\r\n\r\n return $res;\r\n }", "public static function getPayDate() {\n return new DateTime(date(\"Ymd H:i:s\", strtotime('+ 7 days')));\n }", "public function getLastPaymentDate(): \\DateTime\n {\n return $this->lastPaymentDate;\n }", "public function getDate() {\n return @$this->attributes['date'];\n }", "public function getLastpaymentdate()\n {\n return $this->lastpaymentdate;\n }", "public function getTransactionDate() \n {\n return $this->_fields['TransactionDate']['FieldValue'];\n }", "public function getDate()\n {\n return $this->getNodeText('/p:package/p:date');\n }", "public function setPaymentDate($payment_date);", "function getDate() {\n\t\treturn $this->data_array['adddate'];\n\t}", "public function getBillDate()\n {\n return isset($this->billDate) ? $this->billDate : new DateTime;\n }", "private function date()\n {\n $pubDate = $this->article->Journal->JournalIssue->PubDate;\n \n if (isset($pubDate->MedlineDate)) {\n $date = (string)$pubDate->MedlineDate;\n } else {\n $date = implode(' ', (array)$pubDate);\n }\n \n return $date;\n }", "public function getSaleDate()\n {\n if (!$this->sale_date) return null;\n return Formatter::date($this->sale_date);\n }", "function getDate( )\r\n\t{\r\n\t\treturn $this->date;\r\n\t}", "public function getWarrantyDate()\n {\n return $this->warrantyDate;\n }", "public function getDate() { return $this->date; }", "public function getShipmentReceiptDate()\n {\n $value = $this->get(self::SHIPMENTRECEIPTDATE);\n return $value === null ? (string)$value : $value;\n }", "public function getPayDate(): ?Carbon\n {\n return $this->payDate;\n }", "public function getDate()\n {\n return $this->_date;\n }", "public function getDate() {\n\t\treturn $this->_date;\n\t}", "public function getDate()\r\n {\r\n return $this->date;\r\n }", "public function getDate()\n {\n return $this->date = new \\DateTime($this->get()->post_date);\n }", "public function getDate()\n {\n return $this->date;\n }", "public function getDate(){\n\t\treturn $this->_date;\n\t}", "public function getDate()\n {\n return $this->date;\n }" ]
[ "0.77713466", "0.74972916", "0.69472134", "0.6801402", "0.67326385", "0.6454902", "0.634827", "0.6205493", "0.6191901", "0.6031016", "0.60275036", "0.60195315", "0.5958611", "0.59426016", "0.59345627", "0.59027904", "0.58933455", "0.5892541", "0.5848577", "0.5848161", "0.5809078", "0.57984823", "0.5791214", "0.57805276", "0.5779056", "0.5760513", "0.5756802", "0.5735707", "0.57253176", "0.5724094" ]
0.77122015
1
Sets PaymentDate &lt;xs:element name="PaymentDate" type="SAFdateType"/&gt;
public function setPaymentDate(RDate $paymentDate): void { $this->paymentDate = $paymentDate; \Logger::getLogger(\get_class($this)) ->debug( \sprintf( __METHOD__." set to '%s'", $this->paymentDate->format(RDate::SQL_DATE) ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setPaymentDate($payment_date);", "public function setTransactionDate($value) {\n\t\tself::$_transactionDate = $value;\n\t}", "public function set_last_payment_date( $value ) {\n\t\t$this->set_prop( 'last_payment_date', $value ) ;\n\t}", "public function setDate($value) {\n\t\t$this->_date = $value;\n\t}", "public function getPaymentDate();", "public function setDate($date);", "public function set_date($date) \n\t{\n\t\tif(! is_numeric($date))\n\t\t{\n\t\t\t$date = strtotime($date);\n\t\t}\n\t\t\n\t\tif($this->version == ATOM)\n\t\t{\n\t\t\t$tag = 'updated';\n\t\t\t$value = date(DATE_ATOM, $date);\n\t\t} \n\t\telseif($this->version == RSS2) \n\t\t{\n\t\t\t$tag = 'pubDate';\n\t\t\t$value = date(DATE_RSS, $date);\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$tag = 'dc:date';\n\t\t\t$value = date(\"Y-m-d\", $date);\n\t\t}\n\t\t\n\t\t$this->add_element($tag, $value); \n\t}", "public function getPaymentDate() {\n\t\t// return $this->created_at;\n\t\treturn $this->account ? $this->account->payment_date : $this->created_at;\n\t}", "public function setDate($date){\n\t\t$this->date = $date;\n\t}", "public function setinvoiceDateAttribute($value)\n {\n\n $this->attributes['invoice_date'] = UserHelper::parseDateFromString($value);\n }", "public function setDate($date)\n\t{\n\t\t$this->date = $date;\n\t}", "public function setDate($date)\n {\n $this->date = $date;\n }", "public function setDate($date)\n {\n $this->date = $date;\n }", "public function setDate($date) {\n $this->date = $date;\n }", "public function setDate( $sDate ) {\n\t\t$this->sDate = $sDate;\n\t}", "public function setTransactionDate($value) \n {\n $this->_fields['TransactionDate']['FieldValue'] = $value;\n return $this;\n }", "public function getPaymentDate(): RDate\n {\n \\Logger::getLogger(\\get_class($this))\n ->info(\n \\sprintf(\n __METHOD__.\" get '%s'\",\n $this->paymentDate->format(RDate::SQL_DATE)\n )\n );\n return $this->paymentDate;\n }", "public function setDate($date){\r\n\t\t$this->wishDate = $date;\r\n\t}", "public function setDueDateAttribute($value)\n {\n $this->attributes['due_date'] = $value;\n }", "function _webform_datetime_date(array &$element, FormStateInterface $form_state, DrupalDateTime $date = NULL) {\n // Make sure the date element is being displayed.\n if (!isset($element['date'])) {\n return;\n }\n\n $type = (isset($element['#date_date_element'])) ? $element['#date_date_element'] : 'date';\n switch ($type) {\n case 'datepicker':\n // Convert #type from datepicker to textfield.\n $element['date']['#type'] = 'textfield';\n\n // Must manually set 'data-drupal-date-format' to trigger date picker.\n // @see \\Drupal\\Core\\Render\\Element\\Date::processDate\n $element['date']['#attributes']['data-drupal-date-format'] = [$element['date']['#date_date_format']];\n break;\n }\n}", "public function setPayment($payment);", "public function setDateAttribute($value)\n {\n $this->attributes['date'] = Carbon::parse($value)->format('Y-m-d');\n }", "public function setDateAttribute($value)\n {\n $this->attributes['date'] = Carbon::parse($value)->toDateTimeString();\n }", "public function setOrderDateAttribute($orderDate) {\n $this->attributes['order_date'] = Carbon::parse($orderDate)->toDateString(); //'toDateTimeString(); use to dd:mm:yyyy:hh:mm:ss\n }", "private function actionAlterTablePaymentSetTimestamp() {\n $this->changeTableColumnToTimestamp(TB_VPS_PAYMENT, array(\"payment_date\"), \"payment_id\");\n echo TB_VPS_PAYMENT . \" DONE <br/>\";\n }", "public function setPayment($value) {\n $this->payment = $value;\n }", "public function getFirstPaymentDate()\n\t{\n\t\treturn $this->first_payment_date;\n\t}", "public function setDate($date_string = null)\n {\n\n if ($this->is_date() == 1) {\n $this->now = getdate(strtotime($date_string));\n } else {\n $this->now = getdate();\n }\n }", "public function setPublishDateAttribute($value)\n {\n $this->attributes['publish_date'] = date(\"Y-m-d H:i:s\", strtotime($value));\n }", "public function setPurchaseDateAttribute($input)\n {\n if ($input != null && $input != '') {\n $this->attributes['purchase_date'] = Carbon::createFromFormat(config('app.date_format'), $input)->format('Y-m-d');\n } else {\n $this->attributes['purchase_date'] = null;\n }\n }" ]
[ "0.7845562", "0.64185447", "0.6366298", "0.63164955", "0.6164906", "0.6102558", "0.6082409", "0.60491043", "0.6032942", "0.60210645", "0.60172725", "0.6013079", "0.6013079", "0.5996242", "0.5950348", "0.58824646", "0.5874693", "0.5752229", "0.5747266", "0.56992215", "0.5680494", "0.5676362", "0.56579036", "0.56487817", "0.56416", "0.56298566", "0.5628384", "0.5614487", "0.5599381", "0.5588827" ]
0.74097013
1
Returns the assigned adapter
public function getAdapter() { return $this->adapter; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function getAdapter()\n {\n return $this->adapter;\n }", "public function get_adapter()\n {\n return $this->_adapter;\n }", "public function getAdapter()\n\t{\n\t\treturn $this->config['adapter'];\n\t}", "public function getAdapter();", "public function getAdapter();", "public function getAdapter() : Adapter\n {\n return $this->adapter;\n }", "abstract protected function getAdapter();", "abstract protected function getAdapter();", "public function getAdapter(): AdapterInterface\n {\n return $this->adapter ?? $this->adapter = $this->getDefaultAdapter();\n }", "public function getAdapter()\n\t{\n\t\treturn $this->req->getAdapter();\n\t}", "public function getAdapter()\r\n {\r\n }", "public static function adapter()\n {\n return self::connectionManager()->getAdapter(static::connectionName());\n }", "protected function getAdapter()\n {\n return $this->getConnection()->getConnection();\n }", "protected function getAdapter()\n {\n return $this->getConnection()->getConnection();\n }", "public function getAdapterType();", "function getAdapterName();", "public function getAdapter()\n {\n if($this->Adapter !== null)\n {\n return $this->Adapter;\n }\n $db = new DbAdapter();\n return $db->Adapter();\n }", "public function getAdapterName()\n {\n return $this->adapterName;\n }", "abstract protected function getDefaultAdapter(): AdapterInterface;", "public function getAdapter()\n {\n if (!$this->hasAdapter()) {\n return null;\n }\n\n if (!isset($this->adapter)) {\n $this->adapter = $this->sm->get('Zend\\Db\\Adapter\\Adapter');\n }\n\n return $this->adapter;\n }", "public function getAdapterConnection(): string\n {\n return $this->adapter;\n }", "public function getAdapter(): AbstractAdapter\n {\n return Db::getAdapter($this->adapter);\n }", "public function getAdapter(){\n return $this->sm->get('Zend\\Db\\Adapter\\Adapter');\n }" ]
[ "0.7787258", "0.7787258", "0.7787258", "0.7787258", "0.7787258", "0.7787258", "0.7787258", "0.7787258", "0.7725353", "0.76880276", "0.76491064", "0.76491064", "0.76365167", "0.7589357", "0.7589357", "0.7585564", "0.7583257", "0.747719", "0.74078864", "0.7236702", "0.7236702", "0.7129471", "0.707007", "0.7052421", "0.70380634", "0.6996345", "0.69928116", "0.6992657", "0.6984947", "0.6973203" ]
0.786526
1
Assigns the filter iterator to be used during migrations
public function setFilter(\FilterIterator $filter) { $this->filter = $filter; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function prepareFilters();", "private function filters() {\n\n\n\t}", "public function getIterator()\n {\n return new EntityFilterIterator($this->storage);\n }", "private static function _getFilter() {}", "function _dotgo_filter_prepare() {\n\n}", "public function setFilter($filter){ }", "public function setupFilterRules()\n { }", "protected function setFilterArray() {\n $primary_keys = getPrimaryKeys($this->table_name);\n foreach ($primary_keys as $pk) {\n if (isset($_GET[$pk])) {\n $this->filter[$pk] = Mysql::SQLValue($_GET[$pk]);\n }\n }\n }", "protected function set_filters() {\n\t\t# Ignore all items with undefined price\n\t\t$this->generator->addFilter(\n\t\t\tfunction (\n\t\t\t\tarray $sf_product\n\t\t\t) {\n\t\t\t\t$sf_product = reset( $sf_product );\n\n\t\t\t\t/** @var Product $sf_product */\n\t\t\t\treturn ! empty( $sf_product->get_price() );\n\t\t\t}\n\t\t);\n\t}", "public function addFilters()\n {\n }", "private function setFilter()\n\t{\n\t\t// get filter values\n\t\t$this->filter['language'] = ($this->getParameter('language', 'array') != '') ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();\n\t\t$this->filter['application'] = $this->getParameter('application');\n\t\t$this->filter['module'] = $this->getParameter('module');\n\t\t$this->filter['type'] = $this->getParameter('type', 'array');\n\t\t$this->filter['name'] = $this->getParameter('name');\n\t\t$this->filter['value'] = $this->getParameter('value');\n\n\t\t// build query for filter\n\t\t$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);\n\t}", "private function setSearchFilters()\n\t{\n\t\tif(sizeof($this->searchFilters) > 0)\n\t\t{\n\t\t\t$this->taskSearchHelperDA->setSearchFilters($this->searchFilters);\n\t\t}\n\t}", "public function __construct()\n {\n $this->setupFilters();\n }", "abstract public function filters();", "public function getFilters(): FilterCollection;", "public function register_filters() {\n\n\t\t}", "private function setFilter(): void\n {\n // start date is set\n if ($this->getRequest()->query->has('start_date') && $this->getRequest()->query->get('start_date', '') !== '') {\n // redefine\n $startDate = $this->getRequest()->query->get('start_date', '');\n\n // explode date parts\n $chunks = explode('/', $startDate);\n\n // valid date\n if (count($chunks) == 3 && checkdate((int) $chunks[1], (int) $chunks[0], (int) $chunks[2])) {\n $this->filter['start_date'] = $startDate;\n } else {\n // invalid date\n $this->filter['start_date'] = '';\n }\n } else {\n // not set\n $this->filter['start_date'] = '';\n }\n\n // end date is set\n if ($this->getRequest()->query->has('end_date') && $this->getRequest()->query->get('end_date', '') !== '') {\n // redefine\n $endDate = $this->getRequest()->query->get('end_date', '');\n\n // explode date parts\n $chunks = explode('/', $endDate);\n\n // valid date\n if (count($chunks) == 3 && checkdate((int) $chunks[1], (int) $chunks[0], (int) $chunks[2])) {\n $this->filter['end_date'] = $endDate;\n } else {\n // invalid date\n $this->filter['end_date'] = '';\n }\n } else {\n // not set\n $this->filter['end_date'] = '';\n }\n }", "private function loadFiltersFromQuery(): void\n {\n $request = RequestUtil::getMainRequest($this->requestStack) ?? Request::createFromGlobals();\n $requestFilters = $request->query->all('filter');\n\n if (is_array($requestFilters)) {\n foreach ($requestFilters as $name => $limitations) {\n foreach ($limitations as $comparison => $value) {\n $filterField = new FilterField();\n $filterField->setName($name)\n ->setValue($value)\n ->setComparison($comparison)\n ->setFilter($this->getFilterByName($name));\n\n $this->filterFields[] = $filterField;\n }\n }\n }\n }", "public function __construct()\n {\n $this->filterGeneratedData = Ark()->webService()->getFilterGeneratedData();\n }", "function setFilter($filter) {\n\t\t$this->_filter = $filter;\n\t}", "public function applyFilters()\n {\n $filters = sfConfig::get('app_sft_papi_plugin_filters_sequence');\n \n if (!(is_array($filters) && count($filters) > 0))\n {\n return $this;\n }\n\n foreach($filters as $filter)\n { \n $className = $filter['class_name'];\n if(!class_exists($className))\n {\n throw new Exception('The filter \"'.$className. '\" does not exists');\n }\n\n $configuration = $filter['configuration'];\n $this -> attributes = call_user_func(array($className ,'execute'), \n $this -> attributes, $configuration);\n } \n return $this;\n }", "abstract protected function getFilters();", "protected function prepareFilters()\n {\n if(count($this->api_query) === 0){\n return;\n }\n\n // Matched WHERE filters would be all\n // that are not KEYWORDS (count, page, embed...)\n foreach($this->api_query as $column => $value) {\n if(in_array($column, $this->api_keyword_filters)){\n continue;\n }\n\n $this->where_filters[$column]= $value;\n }\n }", "function add_filters()\n {\n }", "protected static function filtes()\n {\n /*\n * The filters fetches are transported\n * to router Bus calls\n **/\n }", "public function CleanFilter(){\n\t\t$this->_objectFilter = new Model_Aclusuariosonline();\n\t}", "public function setIteratorFilter($mask = 0, $base = null)\n {\n $this->_cache['filter'] = array(\n 'base' => $base,\n 'mask' => $mask\n );\n reset($this);\n }", "private function loadFiltersFromAttributes(): void\n {\n $request = RequestUtil::getMainRequest($this->requestStack) ?? Request::createFromGlobals();\n foreach ($request->attributes->getIterator() as $key => $value) {\n $key = (string) $key;\n if ($this->getFilterByName($key) === null) {\n continue;\n }\n\n $filterField = new FilterField();\n $filterField->setName($key)\n ->setValue($value)\n ->setComparison(Api\\Filter::COMPARISON_EQUALS)\n ->setFilter($this->getFilterByName($key));\n\n $this->filterFields[] = $filterField;\n }\n }", "function setFilter($f) {\n\t\tif (!is_subclass_of($f, \"\\Library\\Database\\LinqEquality\")) {\n\t\t\tthrow new DBException(\"Must be a LINQ Equality\");\n\t\t} else {\n\t\t\t$f->setName(trim($this->getTable(),\"`\"));\n\t\t\t$this->filter = $f;\n\t\t}\n\t\treturn $this;\n\t}", "public function createFilter();" ]
[ "0.6466015", "0.6291387", "0.5951684", "0.5930622", "0.5906659", "0.5760304", "0.56612843", "0.5608889", "0.56076866", "0.5572931", "0.55623835", "0.5487783", "0.54589695", "0.5449414", "0.5444809", "0.5436798", "0.54064256", "0.5400307", "0.53803426", "0.53746444", "0.5358228", "0.5341064", "0.53407955", "0.5337057", "0.5327724", "0.5317573", "0.53145176", "0.53078717", "0.53000224", "0.52909255" ]
0.66892904
0
Retrieves the helper associated with the specified name. If no helper found, returns false.
public function getHelper($name) { return (array_key_exists($name, $this->helpers)) ? $this->helpers[$name] : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getHelper($name)\r\n {\r\n if (isset($this->_helper[$name])) {\r\n return $this->_helper[$name];\r\n }\r\n return null;\r\n }", "public function has($name)\n {\n return isset($this->helpers[$name]);\n }", "public function getHelper(string $name): mixed\n {\n if (null === $this->helperSet) {\n throw new LogicException(sprintf('Cannot retrieve helper \"%s\" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));\n }\n\n return $this->helperSet->get($name);\n }", "public function getHelper($name)\n {\n $name = sfConfig::get('app_helpers_'.$name, $name);\n $helpers = $this->getHelperHolder();\n\n if (! $helpers->has($name))\n {\n //yaApplicationConfiguration::getActive()->loadHelpers($name, yaContext::getInstance()->getModuleName());\n\n $class = $name . 'Helper';\n if (!class_exists($class, true))\n {\n throw new sfViewException(sprintf('Could not load helper %s. Class %s not found.', $name, $class));\n }\n\n $helper = new $class();\n if (method_exists($helper, 'setHelperBroker'))\n {\n $helper->setHelperBroker($this);\n }\n\n $helpers->set($name, $helper);\n }\n\n return $helpers->get($name);\n }", "public function get($name)\n {\n if (!$this->has($name)) {\n throw new InvalidArgumentException(sprintf('The helper \"%s\" is not defined.', $name));\n }\n\n return $this->helpers[$name];\n }", "protected function getHelper($helperName, $isController = true) {\n\t\tif ($isController) {\n\t\t\treturn Application::getInstance()->getDiContainer()->getHelperForController($helperName);\n\t\t}\n\t\telse {\n\t\t\treturn Application::getInstance()->getDiContainer()->getHelper($helperName);\n\t\t}\n\t}", "public function __get($name)\n {\n return $this->getHelper($name);\n }", "private function getHelper(string $helperName) : Helper\n {\n if(!isset($this->loadedHelpers[$helperName])) {\n $helperClass = 'ntentan\\honam\\engines\\php\\helpers\\\\' . ucfirst($helperName) . \"Helper\";;\n $helperInstance = new $helperClass($this->templateRenderer);\n $this->loadedHelpers[$helperName] = $helperInstance;\n }\n return $this->loadedHelpers[$helperName];\n }", "public function & GetHelper ($helperName) {\n\t\t$setUpViewAgain = FALSE;\n\t\t$implementsIHelper = FALSE;\n\t\t$instance = NULL;\n\t\t$helpers = & $this->__protected['helpers'];\n\t\tif (isset($helpers[$helperName])) {\n\t\t\t$instance = & $helpers[$helperName];\n\t\t} else if (isset(self::$_globalHelpers[$helperName])) {\n\t\t\t$globalHelpersRecord = & self::$_globalHelpers[$helperName];\n\t\t\t$instance = & $globalHelpersRecord[0];\n\t\t\t$implementsIHelper = $globalHelpersRecord[1];\n\t\t\t$setUpViewAgain = TRUE;\n\t\t} else {\n\t\t\t$helperFound = FALSE;\n\t\t\tif (self::$_toolClass === NULL)\n\t\t\t\tself::$_toolClass = \\MvcCore\\Application::GetInstance()->GetToolClass();\n\t\t\t$toolClass = self::$_toolClass;\n\t\t\t$helpersInterface = self::HELPERS_INTERFACE_CLASS_NAME;\n\t\t\tif (!static::$helpersNamespaces) self::_initHelpersNamespaces();\n\t\t\tforeach (static::$helpersNamespaces as $helperClassBase) {\n\t\t\t\t$className = $helperClassBase . ucfirst($helperName) . 'Helper';\n\t\t\t\tif (class_exists($className)) {\n\t\t\t\t\t$helperFound = TRUE;\n\t\t\t\t\t$setUpViewAgain = TRUE;\n\t\t\t\t\tif ($toolClass::CheckClassInterface($className, $helpersInterface, TRUE, FALSE)) {\n\t\t\t\t\t\t$implementsIHelper = TRUE;\n\t\t\t\t\t\t$instance = & $className::GetInstance();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$instance = new $className();\n\t\t\t\t\t}\n\t\t\t\t\tself::$_globalHelpers[$helperName] = [$instance, $implementsIHelper];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!$helperFound) {\n\t\t\t\t$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;\n\t\t\t\tthrow new \\InvalidArgumentException(\n\t\t\t\t\t\"[\".$selfClass.\"] View helper method '$helperName' is not\"\n\t\t\t\t\t.\" possible to handle by any configured view helper (View\"\n\t\t\t\t\t.\" helper namespaces: '\".implode(\"', '\", static::$helpersNamespaces).\"').\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif ($setUpViewAgain) {\n\t\t\tif ($implementsIHelper) $instance->SetView($this);\n\t\t\t$helpers[$helperName] = & $instance;\n\t\t}\n\t\treturn $instance;\n\t}", "public function getHelper(string $name, array $config = [])\n\t{\n\t\treturn $this->helperFactory->getHelper($name, $config);\n\t}", "public function helper($name)\n {\n // Lowercase the name because it isnt a class file!\n $name = strtolower($name);\n \n // Check the application/helpers folder\n if(file_exists(APP_PATH . DS . 'helpers' . DS . $name . '.php')) \n {\n require_once(APP_PATH . DS . 'helpers' . DS . $name . '.php');\n }\n \n // Check the core/helpers folder\n if(file_exists(SYSTEM_PATH . DS . 'helpers' . DS . $name . '.php')) \n {\n require_once(SYSTEM_PATH . DS . 'helpers' . DS . $name . '.php');\n }\n }", "protected function getViewHelper($helperName)\n\t{\n \treturn $this->getServiceLocator()->get('viewhelpermanager')->get($helperName);\n\t}", "public function setHelper($name, HelperAbstract $helper)\r\n {\r\n if (!isset($this->_helper[$name])) {\r\n $this->_helper[$name] = $helper;\r\n return true;\r\n }\r\n return false;\r\n }", "public function load(string $helperName, array $helperPaths = []): bool\n {\n // Determine what directories should be checked\n $helperPaths = (empty($helperPaths) ? $this->componentPaths : [3 => $helperPaths]);\n\n // Check it is already loaded\n if (isset($this->helpers[$helperName]))\n {\n Logger::log(\"Helper '\".$helperName.\"' is already loaded. Skipping\");\n return false;\n }\n\n /** @var HelperLoadEvent $event */\n try {\n $event = Events::fireEvent('helperLoadEvent', $helperName, $helperPaths);\n\n // @codeCoverageIgnoreStart\n } catch (EventException $e) {\n throw new HelperException(\"Could not load helper. helperLoadEvent failed: '\" . $e->getMessage() . \"''\");\n // @codeCoverageIgnoreEnd\n }\n\n // If cancelled by event, abort loading helper\n if ($event->isCancelled())\n {\n Logger::log(\"Not loading helper. Aborted by event\");\n return false;\n }\n\n // Iterate over helperPaths and attempt to load if helper exists\n for ($i=Priority::getHighestPriority(); $i<=Priority::getLowestPriority(); $i++)\n {\n if (!isset($event->helperPaths[$i]))\n continue;\n\n foreach ($event->helperPaths[$i] as $helperPath)\n {\n $file = $helperPath . DS . $event->helperName . '.php';\n $subfile = $helperPath . DS . $event->helperName . DS . $event->helperName . '.php';\n if (file_exists($file))\n {\n // Load and register\n include_once($file);\n $this->helpers[$event->helperName] = true;\n Logger::log(\"Loaded helper '\".$event->helperName.\"'\");\n return true;\n }\n\n // If php file not in main directory, check subdirectories\n elseif (file_exists($subfile))\n {\n // Load and register\n include_once($subfile);\n $this->helpers[$event->helperName] = true;\n Logger::log(\"Loaded helper '\".$event->helperName.\"''\");\n return true;\n }\n }\n }\n\n throw new HelperException(\"Could not load helper. Helper not found.\", 1);\n }", "public function loadHelper($name) {\r\n\t\t\t\r\n\t\t$viewHelper = null;\r\n\t\t\r\n\t\t\r\n\t\tforeach( $this->helperPath as $path ) { \r\n\t\t \r\n\t\t\t$helperFilePath = $path . $name .'.php' ;\r\n\t\t\t\r\n\t\t\tif( !file_exists( $path . $name .'.php') ) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\t\t\t\r\n\t\r\n\t\t\tif( !include_once $helperFilePath) {\r\n\t\t\t\tthrow new FileIncludeIoException($helperFilePath) ;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$viewHelper = new $name();\r\n\t\t\tbreak;\r\n\t\t}\t\t\r\n\t\t\r\n\t\tif( $viewHelper === null ) {\r\n\t\t throw new ClassNotFoundException( $name);\r\n\t\t}\r\n\t\t\r\n\t\tself::$helpers[$name] = $viewHelper ;\t\t\r\n\t}", "public function getHelper(string $helperName): AbstractViewHelper\n {\n if (!isset($this->helpers[$helperName])) {\n // Check that helper is defined\n if (!isset($this->helperClasses[$helperName])) {\n throw new \\InvalidArgumentException(\"No helper named \\\"{$helperName}\\\"\");\n }\n\n $this->helpers[$helperName] = new $this->helperClasses[$helperName]();\n $this->helpers[$helperName]->setView($this);\n }\n\n return $this->helpers[$helperName];\n }", "public function loadHelper($name)\n {\n $name = ucfirst($name);\n $helper = $this->getHelperNamespace().$name;\n\n return new $helper();\n }", "protected static function getMethod($helper, $name)\n {\n $method = new \\ReflectionMethod($helper, $name);\n $method->setAccessible(true);\n return $method;\n }", "public function getHelper( $handle, $pkg = false ){\n $helper = '_helper_' . preg_replace(\"/[^a-zA-Z0-9]+/\", \"\", $handle);\n if( $this->{$helper} === null ){\n $this->{$helper} = Loader::helper($handle, $pkg);\n }\n return $this->{$helper};\n }", "public function getHelper($method)\n {\n $helper = null;\n if (true === $this->helpers->has($method)) {\n $helper = $this->helpers->get($method);\n }\n\n return $helper;\n }", "public function helper ($name)\n\t{\n\t\t$file = $this->_create_folders_from_name($name, 'helpers');\n\t\t\n\t\t$data = $this->_php_open();\n\t\tstrpos($file['file'], '_helper') || $file['file'] .= '_helper';\n\t\t$path = APPPATH . 'helpers/' . $file['path'] . strtolower($file['file']) . '.php';\n\t\twrite_file($path, $data);\n\t\t$this->msg[] = 'Created helper file at ' . $path;\n\t\t//echo $this->_messages();\n\t\treturn $this->result(true, $this->msg[0]);\n\t}", "public function get($name = \"\")\r\n\t{\r\n\t\tif (empty($name))\r\n\t\t{\r\n\t\t\treturn $this -> gets;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif (isset($this -> gets[$name]))\r\n\t\t\t{\r\n\t\t\t\treturn $this -> gets[$name];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function helper($helperName){\r\n if(file_exists(\"../system/helpers/\" . $helperName . \".php\")){\r\n require_once \"../system/helpers/\" . $helperName . \".php\";\r\n }else{\r\n echo \"<div style='margin:0; padding:10px;background-color:silver;'>Désolé le fichier $helperName.php n'a pas été trouvé</div>\";\r\n } \r\n\r\n }", "public static function getHelper($helperName)\n {\n $helperName = ucfirst($helperName);\n if (class_exists('TH\\\\DG\\\\Helpers\\\\'.$helperName)) {\n $className = 'TH\\\\DG\\\\Helpers\\\\' . $helperName;\n $object = new $className();\n return $object;\n } else {\n throw new Exception('Class \"TH\\\\DG\\\\Helpers\\\\'.$helperName.'\" does not exist.');\n }\n }", "public function getShowHelpers()\n {\n if ($this->hideHelpers) {\n return false;\n }\n\n $helpers = $this->getHelpers();\n if ($helpers->count()) {\n return true;\n } else {\n return false;\n }\n }", "function addHelper() {\r\n $args = func_get_args();\r\n if(!is_array($args)) {\r\n return false;\r\n } // if\r\n \r\n foreach($args as $helper_name) {\r\n if(trim($helper_name) == '') {\r\n continue;\r\n } // if\r\n \r\n if(!in_array($helper_name, $this->helpers) && $this->engine->useHelper($helper_name)) {\r\n $this->helpers[] = $helper_name;\r\n } // if\r\n } // foreach\r\n \r\n return true;\r\n }", "public function get($name)\n\t{\n\t\tif (isset($this->{$name})) {\n\n\t\t\tif (method_exists($this,'get' . Helpers::camelcase($name))) {\n\t\t\t\treturn $this->{'get' . Helpers::camelcase($name)}();\n\t\t\t} else {\n\t\t\t\treturn $this->{$name};\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\t}", "public function __find($name){\n\n\t\t\tif(is_file(EMAILGATEWAYS . \"/email.$name.php\")) return EMAILGATEWAYS;\n\t\t\telse{\n\n\t\t\t\t$extensions = Symphony::ExtensionManager()->listInstalledHandles();\n\n\t\t\t\tif(is_array($extensions) && !empty($extensions)){\n\t\t\t\t\tforeach($extensions as $e){\n\t\t\t\t\t\tif(is_file(EXTENSIONS . \"/$e/email-gateways/email.$name.php\")) return EXTENSIONS . \"/$e/email-gateways\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}", "public function helper($helper = array())\n {\n if (is_array($helper)) {\n return $this->helpers($helper);\n }\n\n if (isset($this->_ci_helpers[$helper])) {\n return;\n }\n\n list($path, $_helper) = Modules::find(\"{$helper}_helper\", $this->_module, 'helpers/');\n\n if ($path === false) {\n // If the helper was not found in a module, check the traditional locations.\n parent::helper($helper);\n return $this;\n }\n\n Modules::load_file($_helper, $path);\n $this->_ci_helpers[$_helper] = true;\n return $this;\n }", "private function detect_helper() {\n\t\t$result = $this->wpdb->get_var( \"SELECT COUNT(*) AS `count` FROM {$this->wpdb->postmeta} WHERE meta_key LIKE '_aioseop_%'\" );\n\t\tif ( $result === '0' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}" ]
[ "0.7726096", "0.71455956", "0.6993883", "0.68904454", "0.6689411", "0.65721655", "0.65159667", "0.6507631", "0.64900804", "0.6356164", "0.61649364", "0.6023918", "0.58729756", "0.5868988", "0.5830039", "0.57814246", "0.5742152", "0.5721857", "0.5658632", "0.56465995", "0.5586289", "0.55728686", "0.5552235", "0.55437255", "0.5519934", "0.54692256", "0.53656256", "0.53599375", "0.5349064", "0.53203887" ]
0.84385365
0
Returns true only and only if the target is less or equal than the greatest migration executed so far.
public function isDownwards($target) { return null !== $target && $this->getFilter()->compare($target, $this->getGreatestMigration()) <= 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function reachedMaxMoves(){\r\n if($this->totalMoves == $this->board->getMaxMoves()){\r\n return true;\r\n }\r\n return false;\r\n }", "public function version($target_version)\n\t{ \n\t\t$start = $current_version = $target_version-1;\n\t\t$stop = $target_version;\n \n\t\tif ($target_version > $current_version)\n\t\t{\n\t\t\t// Moving Up\n\t\t\t++$start;\n\t\t\t++$stop;\n\t\t\t$step = 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Moving Down\n\t\t\t$step = -1;\n\t\t}\n \n\t\t$method = ($step === 1) ? 'up' : 'down';\n\t\t$migrations = array();\n \n\t\t// We now prepare to actually DO the migrations\n\t\t// But first let's make sure that everything is the way it should be\n\t\tfor ($i = $start; $i != $stop; $i += $step)\n\t\t{ \n\t\t\t$f = glob(sprintf($this->_migration_path . '%03d_*.php', $i));\n\t\t\t// Only one migration per step is permitted\n\t\t\tif (count($f) > 1)\n\t\t\t{\n\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $i);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tif ( isset( $f[0] ) ) { \n\t\t\t\t$name = basename($f[0], '.php');\n\t\t\t} else {\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n \n\t\t\t// Filename validations\n\t\t\tif (preg_match('/^\\d{3}_(\\w+)$/', $name, $match))\n\t\t\t{\n\t\t\t\t$match[1] = strtolower($match[1]);\n\n\t\t\t\t// Cannot repeat a migration at different steps\n\t\t\t\tif (in_array($match[1], $migrations))\n\t\t\t\t{\n\t\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $match[1]);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tinclude $f[0];\n\t\t\t\t$class = 'Migration_' . ucfirst($match[1]);\n\n\t\t\t\tif ( ! class_exists($class))\n\t\t\t\t{\n\t\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif ( ! is_callable(array($class, $method)))\n\t\t\t\t{\n\t\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\t$migrations[] = $match[1];\n\t\t\t}\n\t\t}\n\n\t\tlog_message('debug', 'Migration atual: ' . $current_version);\n\n\t\t$version = $i + ($step == 1 ? -1 : 0);\n\n\t\t// If there is nothing to do so quit\n\t\tif ($migrations === array())\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tlog_message('debug', 'Migrating from ' . $method . ' to version ' . $version);\n \n\t\t// Loop through the migrations\n\t\n\t\t\t// Run the migration class\n\t\t\t$class = 'Migration_' . ucfirst(strtolower(end($migrations)));\n\t\t\tcall_user_func(array(new $class, $method));\n\n\t\t\t$current_version += $step;\n\t\t\t$this->_update_version($current_version);\n\t\t\n\n\t\tlog_message('debug', 'Finished migrating to '.$current_version);\n \n\t\treturn end($migrations);\n\t}", "private function shouldExecuteMigration($direction, Version $version, $to, $migrated)\n {\n if ('down' === $direction) {\n if (!in_array($version->getVersion(), $migrated)) {\n return false;\n }\n\n return $version->getVersion() > $to;\n }\n\n if ('up' === $direction) {\n if (in_array($version->getVersion(), $migrated)) {\n return false;\n }\n\n return $version->getVersion() <= $to;\n }\n }", "public function has_goal() {\r\n\t\treturn 0 < $this->get( 'goal' );\r\n\t}", "public function hasAnotherStep()\n {\n return $this->instance->current_step < (count($this->steps) - 1);\n }", "public function isGreaterThanOrEqualTo(self $that): bool;", "public function migrate($target=null)\n\t{\t\n\t\t$migrations = $this->getAvailableMigrations($target);\n\t\tif (null === $target) {\n\t\t\tend($migrations);\n\t\t\t$target = key($migrations);\n\t\t}\n\t\t\n\t\tif (!$this->isDownwards($target)) {\n\t\t\treturn $this->doMigration($migrations, AdapterInterface::UP);\n\t\t} else {\n\t\t\treturn $this->doMigration($migrations, AdapterInterface::DOWN);\n\t\t}\n\t}", "public function isGreaterThan(self $that): bool;", "public function hasTargetNumber() {\n return $this->_has(6);\n }", "public function shouldRunMigration()\n {\n return $this->canRunMigration()\n && !Mage::getStoreConfigFlag(self::MIGRATION_COMPLETE)\n && !Mage::getStoreConfig('payment/gene_braintree/merchant_id')\n && !Mage::getStoreConfig('payment/gene_braintree/sandbox_merchant_id');\n }", "public function latest()\n\t{\n\t\tif ( ! $migrations = $this->find_migrations())\n\t\t{\n\t\t\t$this->_error_string = $this->lang->line('migration_none_found');\n\t\t\treturn false;\n\t\t}\n\n\t\t$last_migration = basename(end($migrations));\n\n\t\t// Calculate the last migration step from existing migration\n\t\t// filenames and procceed to the standard version migration\n\t\treturn $this->version((int) substr($last_migration, 0, 3));\n\t}", "protected function isTargetCorrect() {}", "public function hasMoreSteps()\n {\n return $this->instance->isActionable() ? \n $this->instance->current_step <= count($this->steps) :\n false;\n }", "public function reached()\r\n {\r\n $max = (int) $this->config->get('image_optimizer::settings.tiny_png.max_optimizations_per_month');\r\n\r\n if (empty($max)) {\r\n return false;\r\n }\r\n\r\n if ((bool) $this->config->get('image_optimizer::settings.tiny_png.enabled')\r\n && $this->config->get('image_optimizer::settings.tiny_png.api_key')\r\n ) {\r\n $tinyPngCount = $this->getTinyPngNumberOfCompressions();\r\n\r\n return $tinyPngCount >= $max;\r\n }\r\n\r\n return false;\r\n }", "public function getGreatestMigration()\n\t{\n\t\treturn (string) end(array_keys($this->getExecutedMigrations()));\n\t}", "public function isMigratingUp();", "public function migrationsNeeded() {\n\t\treturn $this->tableManager->migrationsNeeded() || $this->fieldManager->migrationsNeeded() || $this->accessManager->migrationsNeeded();\n\t}", "public function has_achieved_goal() {\r\n\t\treturn $this->get_donated_amount() >= $this->get_goal();\r\n\t}", "public function solved() {\r\n\t\treturn $this->current == $this->expected;\r\n\t}", "public function test_get_runnable_migrations_going_up_with_target_version_no_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $expect_up_files = array(\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n }", "public function test_get_runnable_migrations_going_up_with_target_version_with_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n //pretend we already executed version 1\n $this->insert_dummy_version_data(array(1));\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $expect_up_files = array(\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n $this->clear_dummy_data();\n\n //now pre-register some migrations that we have already executed\n $this->insert_dummy_version_data(array(1, 3));\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $this->assertEquals(array(), $actual_up_files);\n }", "protected function computerTurn(){ \r\n\t\t$getMinMaxResult = new MinMax($this); \r\n\t\tif ($getMinMaxResult->move) {\r\n\t\t\treturn $this->_move = $getMinMaxResult->move;\r\n\t\t}\r\n\t\treturn false; \r\n\t}", "public function canUpOrder()\n {\n $orderAble = $this->getOrderAble();\n\n $node = $orderAble->getOrderQuery()\n ->andWhere([\n '<', $orderAble->getOrderFieldName(), $orderAble->getOrderValue()\n ])\n ->one();\n\n if ($node) return true;\n return false;\n }", "function _checkMaxLimt()\r\n {\r\n if ($this->data[$this->name]['max_limit'] >= $this->data[$this->name]['min_limit']) {\r\n return true;\r\n }\r\n return false;\r\n }", "public function checkSize()\r\n\t{\r\n\t\treturn ((abs(@filesize($this->targetFile) - @filesize($this->referenceFile))) < $this->sizeTol);\r\n\t}", "public function doDatabaseUpdate()\n\t{\n\t\ttry\n\t\t{\n\t\t\tif ($this->_backupDb)\n\t\t\t{\n\t\t\t\t$dbBackup = new DbBackup();\n\t\t\t\t$this->_dbBackupPath = $dbBackup->run();\n\t\t\t}\n\n\t\t\tif (blx()->migrations->runToTop())\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tcatch(\\Exception $e)\n\t\t{\n\t\t\t// We had migrations to run and something went wrong. Let's try to restore the backup database.\n\t\t\tif ($this->_backupDb)\n\t\t\t{\n\t\t\t\tUpdateHelper::rollBackDatabaseChanges($this->_dbBackupPath);\n\t\t\t}\n\n\t\t\tthrow $e;\n\t\t}\n\n\t\t// We had migrations to run and something went wrong. Let's try to restore the backup database.\n\t\tif ($this->_backupDb)\n\t\t{\n\t\t\tUpdateHelper::rollBackDatabaseChanges($this->_dbBackupPath);\n\t\t}\n\n\t\treturn false;\n\t}", "public function isEatenUp()\n {\n return $this->eaten >= 100;\n }", "function _checkGoto($a_target)\n\t{\n\t\tglobal $ilAccess;\n\t\t$t_arr = explode('_', $a_target);\n\t\tif ($t_arr[0] != 'orgu' || ((int)$t_arr[1]) <= 0) {\n\t\t\treturn false;\n\t\t}\n\t\tif ($ilAccess->checkAccess('read', '', $t_arr[1])) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public function upToDate() {\n\t\tif($this->hasDetails()) {\n\t\t\t$last_score_date = $this->getScores()->max('updated_at');\n\t\t\tYii::trace($last_score_date.' <= '.$this->updated_at, 'Scorecard::upToDate');\n\t\t\treturn $last_score_date <= $this->updated_at;\n\t\t}\n\t\treturn true;\n\t}", "public function passes($attribute, $value)\n {\n return version_compare($this->model->version, $value, '<');\n }" ]
[ "0.61778116", "0.6080323", "0.5946392", "0.5738278", "0.5713029", "0.5688664", "0.5687063", "0.5683649", "0.5628863", "0.56193185", "0.56039834", "0.5579152", "0.5530845", "0.5412094", "0.5401458", "0.5388808", "0.53630245", "0.5322074", "0.5281697", "0.5244626", "0.52423495", "0.52341026", "0.52095246", "0.51953965", "0.51928955", "0.5184861", "0.51369953", "0.51136696", "0.5102146", "0.5098348" ]
0.7440257
0
Returns an array of all the migrations that should be executed to reach the provided target, taking into consideration both the executed migrations. This works for both normal migrations and rollbacks.
public function getAvailableMigrations($target=null) { // for normal migration we need all files to target // for rollbacks we need from target to the greatest migration $filter = $this->getFilter(); if (!$this->isDownwards($target)) { if (null !== $target) { $filter->setToVersion($target); } } else { // rollback $filter->setFromVersion($target); $filter->setToVersion($this->getGreatestMigration()); } $migration_steps = $this->getMigrationSteps(); // migrations to be executed $to_execute = array(); if ($this->isDownwards($target)) { // rollback: execute the common part of $executed and $migration_refs $executed = $this->getExecutedMigrations(); foreach($migration_steps as $ref => $migration_class) { if (array_key_exists($ref, $executed)) { $to_execute[] = $ref; } } } else { // migration: execute what's missing - the different of $executed and $available $to_execute = array_diff(array_keys($migration_steps), array_keys($this->getExecutedMigrations())); } // go through $to_execute and find the migration steps $migrations = array(); foreach ($to_execute as $ref) { $migrations[$ref] = $migration_steps[$ref]; } // sort migrations according to filter and target // remove one so that to avoid executing target in the case of rollback $this->sortMigrations($migrations, $target); if ($this->isDownwards($target)) { array_pop($migrations); } return $migrations; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getMigrationsToRun() : array\n {\n $allMigrations = $this->getAllMigrations();\n\n $tableExists = $this->queryBuilderFactory->make()\n ->table_exists($this->table);\n\n if (! $tableExists) {\n return $allMigrations;\n }\n\n /** @var array $runMigrations */\n $runMigrations = $this->queryBuilderFactory->make()\n ->get($this->table)\n ->result();\n\n foreach ($runMigrations as $record) {\n unset($allMigrations[$record->migration]);\n }\n\n return $allMigrations;\n }", "public function get_applied_migrations(): array\n {\n $stmt = $this->pdo->prepare(\"SELECT migration FROM migrations\");\n $stmt->execute();\n\n return $stmt->fetchAll(PDO::FETCH_COLUMN, 0);\n }", "public function getExecutedMigrations()\n\t{\n\t\t$migrations = $this->getAdapter()->getMigrations();\n\t\tuksort($migrations, array($this->getFilter(), 'compare'));\n\t\treturn $migrations;\n\t}", "public function migrate($target=null)\n\t{\t\n\t\t$migrations = $this->getAvailableMigrations($target);\n\t\tif (null === $target) {\n\t\t\tend($migrations);\n\t\t\t$target = key($migrations);\n\t\t}\n\t\t\n\t\tif (!$this->isDownwards($target)) {\n\t\t\treturn $this->doMigration($migrations, AdapterInterface::UP);\n\t\t} else {\n\t\t\treturn $this->doMigration($migrations, AdapterInterface::DOWN);\n\t\t}\n\t}", "public function getMigrationsToRun() : array\n {\n $allMigrations = $this->getAllMigrations();\n $ranMigrations = $this->getRanMigrations();\n\n return array_diff($allMigrations, $ranMigrations);\n }", "protected function getMigrationsToRun()\n {\n $migrations_ran = $this->getMigrationsRan();\n $migrations_in_dir = $this->getMigrationsInDir();\n\n return array_diff($migrations_in_dir, $migrations_ran);\n }", "public function runMigrations() : array\n {\n $migrations = $this->getMigrationsToRun();\n $ran = [];\n\n if (count($migrations) === 0) {\n return $ran;\n }\n\n /** @var string $migration */\n foreach ($migrations as $migration) {\n $this->runMigration($migration);\n $ran[] = $migration;\n }\n\n return $ran;\n }", "private function sortMigrations(& $migrations, $target)\n\t{\n\t\t$filter = $this->getFilter();\n\t\tif (!$this->isDownwards($target)) {\n\t\t\tuksort($migrations, array($filter, 'compare'));\n\t\t} else {\n\t\t\tuksort($migrations, function($a, $b) use ($filter) {\n\t\t\t\treturn $filter->compare($b, $a);\t// reverse arguments\n\t\t\t} );\n\t\t}\n\t\t\n\t}", "public function getMigrations(): array\n {\n $result = [];\n foreach ($this->repository->getMigrations() as $migration) {\n //Populating migration state and execution time (if any)\n $result[] = $migration->withState($this->resolveState($migration));\n }\n\n return $result;\n }", "public function up($targetMigration)\n {\n $migrations = new Ot_Model_DbTable_Migrations($this->_tablePrefix);\n \n $migrationsIdsNotApplied = array_diff(array_keys($this->_availableMigrations), $this->_appliedMigrations);\n \n $migrationsToApply = array();\n \n foreach ($migrationsIdsNotApplied as $migrationId) {\n if ($migrationId <= $targetMigration) {\n $migrationsToApply[] = $this->_availableMigrations[$migrationId];\n }\n }\n \n if (empty($migrationsToApply)) {\n $this->_messages[] = 'No migrations to apply';\n return;\n }\n \n $this->_db->beginTransaction();\n \n foreach ($migrationsToApply as $m) {\n \n require_once $this->_migrationsPath . '/' . $m;\n $classname = 'Db_' . substr($m, 0, -4); //strip out the .php extension\n $migrationClass = new $classname(array('tablePrefix' => $this->_tablePrefix));\n\n try {\n $migrationClass->up($this->_db, $this->_tablePrefix);\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Error applying migration ' . $m . '. ' . $e->getMessage());\n }\n \n try {\n $migrations->addMigration($this->_getMigrationIdFromFilename($m));\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Migration ' . $m . ' was successful, but adding record to migrations table failed. ' . $e->getMessage());\n }\n \n $this->_messages[] = 'Applied ' . $m;\n }\n \n $this->_db->commit();\n }", "public function test_get_runnable_migrations_going_down_no_target_version()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', false);\n $this->assertEquals(array() , $actual_down_files);\n }", "public function getMigrationsToExecute($direction, $to)\n {\n if ('down' === $direction) {\n if (count($this->migrations)) {\n $allVersions = array_reverse(array_keys($this->migrations));\n $classes = array_reverse(array_values($this->migrations));\n $allVersions = array_combine($allVersions, $classes);\n } else {\n $allVersions = [];\n }\n } else {\n $allVersions = $this->migrations;\n }\n $versions = [];\n $migrated = $this->getMigratedVersions();\n foreach ($allVersions as $version) {\n if ($this->shouldExecuteMigration($direction, $version, $to, $migrated)) {\n $versions[$version->getVersion()] = $version;\n }\n }\n\n return $versions;\n }", "public function getMigrations()\n {\n return $this->migrations;\n }", "public function pendingMigrations()\r\n\t{\r\n\t\t$outstanding = [];\r\n\t\t$this->ensureMigrationBinExist();\r\n\t\tforeach ($this->localRepository() as $file) {\r\n\t\t\t$line = $this->removeDotPhp($file);\r\n\r\n\t\t\t// Once we grab all of the migration files for the path, we will compare them\r\n\t\t\t// against the migrations that have already been run for this package then\r\n\t\t\t// run each of the outstanding migrations against a database connection.\r\n\t\t\t$result = $this->repository->getRan();\r\n\t\t\tif (!in_array($line, $result)) {\r\n\t\t\t\t$outstanding[] = $file;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $outstanding;\r\n\t}", "public function applied()\n {\n $migrationFiles = array();\n $sql = new Sql($this->adapter);\n $select = $sql->select();\n $select->from(self::TABLE);\n \n $selectString = $sql->getSqlStringForSqlObject($select);\n $results = $this->adapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);\n \n if ($results->count() > 0) {\n foreach ($results as $migration) {\n $migrationFiles[] = $migration->migration;\n }\n }\n \n return $migrationFiles;\n }", "public function get(string $target = '*'): array\n\t{\n\t\t$segments = explode('.', $target);\n\n\t\tif (count($segments) === 1) {\n\t\t\tarray_unshift($segments, '*');\n\t\t}\n\n\t\tif (count($segments) === 2) {\n\t\t\tif ($this->isBounded()) {\n\t\t\t\tarray_unshift($segments, $this->class);\n\t\t\t} else {\n\t\t\t\tarray_unshift($segments, 'global');\n\t\t\t}\n\t\t}\n\n\t\t$actions = Data::get($this->actions, $segments, []);\n\n\t\tif (!is_array($actions)) {\n\t\t\t$actions = [$actions];\n\t\t} else if (!empty($actions)) {\n\t\t\t$actions = array_values(array_filter($actions));\n\t\t}\n\n\t\treturn $actions;\n\t}", "public function collectMigrations(): array;", "public function getActiveMigrations() {\n\t\tif (!is_array($this->activeMigrations)) {\n\t\t\t$this->activeMigrations = array();\n\t\t\t/** @var Tx_Smoothmigration_Service_RequirementsAnalyzer $requirementsAnalyzer */\n\t\t\t$requirementsAnalyzer = t3lib_div::makeInstance('Tx_Smoothmigration_Service_RequirementsAnalyzer');\n\n\t\t\tforeach ($this->registeredMigrations as $className) {\n\t\t\t\t/** @var Tx_Smoothmigration_Domain_Interface_Migration $check */\n\t\t\t\t$migration = t3lib_div::makeInstance($className);\n\t\t\t\tif ($requirementsAnalyzer->isActive($migration)) {\n\t\t\t\t\t$this->activeMigrations[] = $migration;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $this->activeMigrations;\n\t}", "public function test_get_runnable_migrations_going_up_with_target_version_with_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n //pretend we already executed version 1\n $this->insert_dummy_version_data(array(1));\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $expect_up_files = array(\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n $this->clear_dummy_data();\n\n //now pre-register some migrations that we have already executed\n $this->insert_dummy_version_data(array(1, 3));\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $this->assertEquals(array(), $actual_up_files);\n }", "public function test_get_runnable_migrations_going_up_with_target_version_no_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $expect_up_files = array(\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n }", "public function test_get_runnable_migrations_going_up_no_target_version()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', false);\n $expect_up_files = array(\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n ),\n array(\n 'version' => '20090122193325',\n 'class' => 'AddNewTable',\n 'file' => '20090122193325_AddNewTable.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n }", "public function getMigrations();", "private function getMigrations()\n\t\t{\n\t\t\tif(self::$migrations)\n\t\t\t{\n\t\t\t\treturn self::$migrations;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach(\\System\\DB\\DataAdapter::create(\"adapter=dir;source=\".__MIGRATIONS_PATH__.\";\")->openDataSet()->rows as $row)\n\t\t\t\t{\n\t\t\t\t\tif(\\strpos($row[\"name\"], '.php'))\n\t\t\t\t\t{\n\t\t\t\t\t\trequire $row[\"path\"];\n\t\t\t\t\t\t$migration = \\str_replace(\".php\", \"\", $row[\"name\"]);\n\t\t\t\t\t\teval(\"\\$migration = new \\\\System\\\\Migrate\\\\{$migration}();\");\n\n\t\t\t\t\t\tself::$migrations[] = new $migration();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$CSort = new MigrationCompare();\n\t\t\t\tusort( self::$migrations, array( &$CSort, 'compareVersion' ));\n\t\t\t\treturn self::$migrations;\n\t\t\t}\n\t\t}", "public function get_migrations()\n\t{\n\t\tif ( ! $this->migrations)\n\t\t{\n\t\t\t$migrations = glob($this->config['path'] . DIRECTORY_SEPARATOR . '*' . EXT);\n\t\t\t$ids = array();\n\t\t\tforeach ((array) $migrations as $file)\n\t\t\t{\n\t\t\t\t$name = basename($file, EXT);\n\t\t\t\t$matches = array();\n\t\t\t\tif ( preg_match('/^(\\d+)_(\\w+)$/', $name, $matches))\n\t\t\t\t{\n\t\t\t\t\t$ids[] = intval($matches[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->migrations = $ids;\n\t\t}\n\t\treturn $this->migrations;\n\t}", "public function down($targetMigration)\n {\n $migrationsModel = new Ot_Model_DbTable_Migrations($this->_tablePrefix);\n \n end($this->_appliedMigrations);\n $highestExecutedMigration = current($this->_appliedMigrations);\n reset($this->_appliedMigrations);\n\n if (!isset($this->_availableMigrations[$targetMigration])) {\n throw new Exception('The requested migration ' . $targetMigration . ' was not found.');\n }\n \n if ((int)$highestExecutedMigration <= (int)$targetMigration) {\n throw new Exception('The database is only migrated to migration ' . $highestExecutedMigration . ', which is before the requested migration ' . $targetMigration);\n }\n \n $migrationsToApply = array();\n \n foreach ($this->_appliedMigrations as $a) {\n if ((int)$a > (int)$targetMigration && isset($this->_availableMigrations[$a])) {\n $migrationsToApply[] = $this->_availableMigrations[$a];\n }\n }\n \n $migrationsToApply = array_reverse($migrationsToApply);\n \n if (empty($migrationsToApply)) {\n $this->_messages[] = 'No migrations to apply';\n }\n \n $this->_db->beginTransaction();\n \n foreach ($migrationsToApply as $m) {\n require_once $this->_migrationsPath . '/' . $m;\n $classname = 'Db_' . substr($m, 0, -4); //strip out the .php extension\n $migrationClass = new $classname(array('tablePrefix' => $this->_tablePrefix));\n\n try {\n $migrationClass->down($this->_db, $this->_tablePrefix);\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Error applying migration ' . $m . '. ' . $e->getMessage());\n }\n \n try {\n $migrationsModel->removeMigration($this->_getMigrationIdFromFilename($m));\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Migration ' . $m . ' was successful, but adding record to migrations table failed. ' . $e->getMessage());\n }\n \n $this->_messages[] = 'Down migration of ' . $m . ' was successful.';\n }\n \n $this->_db->commit();\n }", "public function getMigrations(){\n $migrations[] = new migrateTable0001($this->get('db'));\n $migrations[] = new migrateTable0002($this->get('db'));\n $migrations[] = new migrateTableEvent($this->get('db'));\n $migrations[] = new migrateTableMessages($this->get('db'));\n $migrations[] = new migrateTablePerson($this->get('db'));\n $migrations[] = new migrateTable122320151845($this->get('db'));\n\n return $migrations;\n }", "protected function getMigrationsRan()\n {\n // TODO: Move query to a query factory based on db_adapter\n $resource = $this->db_adapter->query(\n \"SELECT file FROM $this->migration_table\"\n );\n\n // TODO: Needs to be abstracted from this class\n $results = pg_fetch_all($resource) ?: [];\n\n // Flatten the array structure to a single dimension\n $migrations_ran = array_map(function ($result) {\n return $result['file'];\n }, $results);\n\n return $migrations_ran;\n }", "protected function getNewMigrations()\n {\n if (!$this->includeModuleMigrations) {\n return parent::getNewMigrations();\n }\n\n $this->migrationPathMap = [];\n $migrations = [];\n foreach ($this->getMigrationPaths() as $migrationPath) {\n $this->migrationPath = $migrationPath;\n $migrations = array_merge($migrations, parent::getNewMigrations());\n $this->migrationPathMap[$migrationPath] = $migrations;\n }\n\n sort($migrations);\n\n\t\treturn $migrations;\n }", "public function getRan()\n {\n global $wpdb;\n\n $sql = \"SELECT migration as name FROM {$wpdb->prefix}exolnet_migration as em\";\n\n $migrations = $wpdb->get_results($sql, 'ARRAY_A');\n\n $migrationCleaned = [];\n if (!empty($migrations) && is_array($migrations)) {\n foreach ($migrations as $migration) {\n $migrationCleaned[] = $migration['name'];\n }\n }\n\n return $migrationCleaned;\n }", "protected function find_migrations()\n\t{\n\t\t// Load all *_*.php files in the migrations path\n\t\t$files = glob($this->_migration_path . '*_*.php');\n\t\t$file_count = count($files);\n\n\t\tfor ($i = 0; $i < $file_count; $i++)\n\t\t{\n\t\t\t// Mark wrongly formatted files as false for later filtering\n\t\t\t$name = basename($files[$i], '.php');\n\t\t\tif ( ! preg_match('/^\\d{3}_(\\w+)$/', $name))\n\t\t\t{\n\t\t\t\t$files[$i] = FALSE;\n\t\t\t}\n\t\t}\n\n\t\tsort($files);\n\t\treturn $files;\n\t}" ]
[ "0.6566407", "0.6549122", "0.65065175", "0.6460152", "0.6412314", "0.63901865", "0.6238462", "0.62335783", "0.6084264", "0.5982342", "0.5952659", "0.59471846", "0.58959377", "0.5857791", "0.5816764", "0.58088714", "0.57287943", "0.56991947", "0.5697555", "0.56852627", "0.5679691", "0.56749874", "0.5658907", "0.5644121", "0.5621736", "0.5595115", "0.55547714", "0.54832864", "0.5458647", "0.54172224" ]
0.8309574
0
Returns all the executed migrations. This acts as a proxy method to AdapterInterface::getMigrations plus the results are sorted according to the assigned filter.
public function getExecutedMigrations() { $migrations = $this->getAdapter()->getMigrations(); uksort($migrations, array($this->getFilter(), 'compare')); return $migrations; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getMigrationsToRun() : array\n {\n $allMigrations = $this->getAllMigrations();\n\n $tableExists = $this->queryBuilderFactory->make()\n ->table_exists($this->table);\n\n if (! $tableExists) {\n return $allMigrations;\n }\n\n /** @var array $runMigrations */\n $runMigrations = $this->queryBuilderFactory->make()\n ->get($this->table)\n ->result();\n\n foreach ($runMigrations as $record) {\n unset($allMigrations[$record->migration]);\n }\n\n return $allMigrations;\n }", "public function get_applied_migrations(): array\n {\n $stmt = $this->pdo->prepare(\"SELECT migration FROM migrations\");\n $stmt->execute();\n\n return $stmt->fetchAll(PDO::FETCH_COLUMN, 0);\n }", "private function getMigrations()\n\t\t{\n\t\t\tif(self::$migrations)\n\t\t\t{\n\t\t\t\treturn self::$migrations;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach(\\System\\DB\\DataAdapter::create(\"adapter=dir;source=\".__MIGRATIONS_PATH__.\";\")->openDataSet()->rows as $row)\n\t\t\t\t{\n\t\t\t\t\tif(\\strpos($row[\"name\"], '.php'))\n\t\t\t\t\t{\n\t\t\t\t\t\trequire $row[\"path\"];\n\t\t\t\t\t\t$migration = \\str_replace(\".php\", \"\", $row[\"name\"]);\n\t\t\t\t\t\teval(\"\\$migration = new \\\\System\\\\Migrate\\\\{$migration}();\");\n\n\t\t\t\t\t\tself::$migrations[] = new $migration();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$CSort = new MigrationCompare();\n\t\t\t\tusort( self::$migrations, array( &$CSort, 'compareVersion' ));\n\t\t\t\treturn self::$migrations;\n\t\t\t}\n\t\t}", "public function applied()\n {\n $migrationFiles = array();\n $sql = new Sql($this->adapter);\n $select = $sql->select();\n $select->from(self::TABLE);\n \n $selectString = $sql->getSqlStringForSqlObject($select);\n $results = $this->adapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);\n \n if ($results->count() > 0) {\n foreach ($results as $migration) {\n $migrationFiles[] = $migration->migration;\n }\n }\n \n return $migrationFiles;\n }", "protected function getMigrationsToRun()\n {\n $migrations_ran = $this->getMigrationsRan();\n $migrations_in_dir = $this->getMigrationsInDir();\n\n return array_diff($migrations_in_dir, $migrations_ran);\n }", "public function getMigrationsToRun() : array\n {\n $allMigrations = $this->getAllMigrations();\n $ranMigrations = $this->getRanMigrations();\n\n return array_diff($allMigrations, $ranMigrations);\n }", "public function getMigrations()\n {\n return $this->migrations;\n }", "protected function getMigrationsRan()\n {\n // TODO: Move query to a query factory based on db_adapter\n $resource = $this->db_adapter->query(\n \"SELECT file FROM $this->migration_table\"\n );\n\n // TODO: Needs to be abstracted from this class\n $results = pg_fetch_all($resource) ?: [];\n\n // Flatten the array structure to a single dimension\n $migrations_ran = array_map(function ($result) {\n return $result['file'];\n }, $results);\n\n return $migrations_ran;\n }", "public function getMigrations();", "protected function getAllMigrationFiles()\n {\n return $this->migrator->getMigrations();\n }", "public function getMigrations(): array\n {\n $result = [];\n foreach ($this->repository->getMigrations() as $migration) {\n //Populating migration state and execution time (if any)\n $result[] = $migration->withState($this->resolveState($migration));\n }\n\n return $result;\n }", "public function get_migrations()\n\t{\n\t\tif ( ! $this->migrations)\n\t\t{\n\t\t\t$migrations = glob($this->config['path'] . DIRECTORY_SEPARATOR . '*' . EXT);\n\t\t\t$ids = array();\n\t\t\tforeach ((array) $migrations as $file)\n\t\t\t{\n\t\t\t\t$name = basename($file, EXT);\n\t\t\t\t$matches = array();\n\t\t\t\tif ( preg_match('/^(\\d+)_(\\w+)$/', $name, $matches))\n\t\t\t\t{\n\t\t\t\t\t$ids[] = intval($matches[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->migrations = $ids;\n\t\t}\n\t\treturn $this->migrations;\n\t}", "public function getMigrations(){\n $migrations[] = new migrateTable0001($this->get('db'));\n $migrations[] = new migrateTable0002($this->get('db'));\n $migrations[] = new migrateTableEvent($this->get('db'));\n $migrations[] = new migrateTableMessages($this->get('db'));\n $migrations[] = new migrateTablePerson($this->get('db'));\n $migrations[] = new migrateTable122320151845($this->get('db'));\n\n return $migrations;\n }", "public function runMigrations() : array\n {\n $migrations = $this->getMigrationsToRun();\n $ran = [];\n\n if (count($migrations) === 0) {\n return $ran;\n }\n\n /** @var string $migration */\n foreach ($migrations as $migration) {\n $this->runMigration($migration);\n $ran[] = $migration;\n }\n\n return $ran;\n }", "public function getAllMigrations() : array\n {\n $migrationFiles = $this->filesystem->getDirectoryContents(\n $this->migrationsDir\n );\n\n $allMigrations = [];\n\n foreach ($migrationFiles as $file) {\n $filePathInfo = pathinfo($file);\n $allMigrations[$filePathInfo['filename']] = $filePathInfo['filename'];\n }\n\n ksort($allMigrations);\n\n return $allMigrations;\n }", "protected function get_migration_file_list()\n\t{\n\t\tif ($this->migrations !== false)\n\t\t{\n\t\t\treturn $this->migrations;\n\t\t}\n\n\t\t// Only have the finder search in this extension path directory\n\t\t$migrations = $this->extension_finder\n\t\t\t->extension_directory('/migrations')\n\t\t\t->find_from_extension($this->extension_name, $this->extension_path);\n\n\t\t$migrations = $this->extension_finder->get_classes_from_files($migrations);\n\n\t\t$this->migrator->set_migrations($migrations);\n\n\t\t$migrations = $this->migrator->get_migrations();\n\n\t\treturn $migrations;\n\t}", "public function collectMigrations(): array;", "protected function getMigrations()\n {\n $finder = new Finder();\n $files = $finder->files()\n ->name('*table.php')\n ->notName('2014*')\n ->in(database_path() . '/migrations');\n\n foreach ($files as $file) {\n $this->migrations[] = $file->getRealPath() ;\n }\n }", "protected function getNewMigrations()\n {\n if (!$this->includeModuleMigrations) {\n return parent::getNewMigrations();\n }\n\n $this->migrationPathMap = [];\n $migrations = [];\n foreach ($this->getMigrationPaths() as $migrationPath) {\n $this->migrationPath = $migrationPath;\n $migrations = array_merge($migrations, parent::getNewMigrations());\n $this->migrationPathMap[$migrationPath] = $migrations;\n }\n\n sort($migrations);\n\n\t\treturn $migrations;\n }", "public function getRan()\n {\n global $wpdb;\n\n $sql = \"SELECT migration as name FROM {$wpdb->prefix}exolnet_migration as em\";\n\n $migrations = $wpdb->get_results($sql, 'ARRAY_A');\n\n $migrationCleaned = [];\n if (!empty($migrations) && is_array($migrations)) {\n foreach ($migrations as $migration) {\n $migrationCleaned[] = $migration['name'];\n }\n }\n\n return $migrationCleaned;\n }", "public function getMigrations()\n {\n $path = database_path(\n 'migrations' . DIRECTORY_SEPARATOR . '*.php'\n );\n\n return str_replace(\n '.php', '', glob($path)\n );\n }", "public function getActiveMigrations() {\n\t\tif (!is_array($this->activeMigrations)) {\n\t\t\t$this->activeMigrations = array();\n\t\t\t/** @var Tx_Smoothmigration_Service_RequirementsAnalyzer $requirementsAnalyzer */\n\t\t\t$requirementsAnalyzer = t3lib_div::makeInstance('Tx_Smoothmigration_Service_RequirementsAnalyzer');\n\n\t\t\tforeach ($this->registeredMigrations as $className) {\n\t\t\t\t/** @var Tx_Smoothmigration_Domain_Interface_Migration $check */\n\t\t\t\t$migration = t3lib_div::makeInstance($className);\n\t\t\t\tif ($requirementsAnalyzer->isActive($migration)) {\n\t\t\t\t\t$this->activeMigrations[] = $migration;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $this->activeMigrations;\n\t}", "protected function find_migrations()\n\t{\n\t\t// Load all *_*.php files in the migrations path\n\t\t$files = glob($this->_migration_path . '*_*.php');\n\t\t$file_count = count($files);\n\n\t\tfor ($i = 0; $i < $file_count; $i++)\n\t\t{\n\t\t\t// Mark wrongly formatted files as false for later filtering\n\t\t\t$name = basename($files[$i], '.php');\n\t\t\tif ( ! preg_match('/^\\d{3}_(\\w+)$/', $name))\n\t\t\t{\n\t\t\t\t$files[$i] = FALSE;\n\t\t\t}\n\t\t}\n\n\t\tsort($files);\n\t\treturn $files;\n\t}", "public function getAvailableMigrations($target=null)\n\t{\n\t\t// for normal migration we need all files to target\n\t\t// for rollbacks we need from target to the greatest migration\n\t\t$filter = $this->getFilter();\n\t\tif (!$this->isDownwards($target)) {\n\t\t\tif (null !== $target) {\n\t\t\t\t$filter->setToVersion($target);\n\t\t\t}\n\t\t} else {\t// rollback\n\t\t\t$filter->setFromVersion($target);\n\t\t\t$filter->setToVersion($this->getGreatestMigration());\n\t\t}\n\n\t\t$migration_steps = $this->getMigrationSteps();\n\n\t\t// migrations to be executed\n\t\t$to_execute = array();\n\t\tif ($this->isDownwards($target)) {\n\t\t\t// rollback: execute the common part of $executed and $migration_refs\n\t\t\t$executed = $this->getExecutedMigrations();\n\t\t\tforeach($migration_steps as $ref => $migration_class) {\n\t\t\t\tif (array_key_exists($ref, $executed)) {\n\t\t\t\t\t$to_execute[] = $ref;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// migration: execute what's missing - the different of $executed and $available\n\t\t\t$to_execute = array_diff(array_keys($migration_steps), array_keys($this->getExecutedMigrations()));\n\t\t}\n\t\t\n\t\t// go through $to_execute and find the migration steps\n\t\t$migrations = array();\n\t\tforeach ($to_execute as $ref) {\n\t\t\t$migrations[$ref] = $migration_steps[$ref];\n\t\t}\n\t\t\n\t\t// sort migrations according to filter and target\n\t\t// remove one so that to avoid executing target in the case of rollback\n\t\t$this->sortMigrations($migrations, $target);\n\t\tif ($this->isDownwards($target)) {\n\t\t\tarray_pop($migrations);\n\t\t}\n\t\treturn $migrations;\n\t}", "protected function _getAvailableMigrations()\n {\n $availableMigrations = array();\n \n $files = scandir($this->_migrationsPath);\n \n foreach ($files as $filename) {\n \n if (substr($filename, -4) == '.php' && $filename != '.' && $filename != '..' && !is_dir($filename)) {\n \n $id = $this->_getMigrationIdFromFilename($filename);\n $availableMigrations[$id] = $filename;\n }\n }\n \n if (empty($availableMigrations)) {\n throw new Exception('No available migrations found');\n }\n \n return $availableMigrations;\n }", "public function pendingMigrations()\r\n\t{\r\n\t\t$outstanding = [];\r\n\t\t$this->ensureMigrationBinExist();\r\n\t\tforeach ($this->localRepository() as $file) {\r\n\t\t\t$line = $this->removeDotPhp($file);\r\n\r\n\t\t\t// Once we grab all of the migration files for the path, we will compare them\r\n\t\t\t// against the migrations that have already been run for this package then\r\n\t\t\t// run each of the outstanding migrations against a database connection.\r\n\t\t\t$result = $this->repository->getRan();\r\n\t\t\tif (!in_array($line, $result)) {\r\n\t\t\t\t$outstanding[] = $file;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $outstanding;\r\n\t}", "public function getRan()\n {\n return $this->table()\n ->where('plugin', $this->plugin)\n ->orderBy('batch', 'asc')\n ->orderBy('migration', 'asc')\n ->pluck('migration')->all();\n }", "private function getMigrationSteps()\n\t{\n\t\t$migration_steps = array();\n\t\tforeach ($this->getFilter() as $step) {\n\t\t\t$migration_steps[$step->getReference()] = $step;\n\t\t}\n\t\t\n\t\treturn $migration_steps;\n\t}", "protected function getMigrations()\n {\n $params = [\n 'connection' => 'test',\n 'source' => 'TestsMigrations',\n ];\n $migrations = new Migrations($params);\n $adapter = $migrations\n ->getManager($this->command->getConfig())\n ->getEnvironment('default')\n ->getAdapter();\n\n while ($adapter instanceof WrapperInterface) {\n $adapter = $adapter->getAdapter();\n }\n\n $adapter->setConnection($this->pdo);\n\n return $migrations;\n }", "public function getModulesInMigrationOrder(): array;" ]
[ "0.74191535", "0.71839124", "0.7168735", "0.71103656", "0.71043146", "0.70602465", "0.70244503", "0.69008493", "0.6890514", "0.6830789", "0.6803787", "0.67936563", "0.67870224", "0.67685294", "0.6757025", "0.6620823", "0.66137254", "0.6528872", "0.6486937", "0.64458954", "0.6435156", "0.6427179", "0.64236087", "0.63334924", "0.6206203", "0.6162733", "0.6162011", "0.61016816", "0.60197693", "0.5918047" ]
0.85546994
0
Returns the reference number of the greatest migration
public function getGreatestMigration() { return (string) end(array_keys($this->getExecutedMigrations())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getLastBatchNumber()\n {\n global $wpdb;\n\n $max = $wpdb->get_results(\n \"SELECT MAX(`batch`) as max FROM {$wpdb->prefix}exolnet_migration as em\",\n 'ARRAY_A'\n );\n\n return absint($max[0]['max']) ?? 0;\n }", "private function getMaxAvailableVersion()\n {\n echo \"Getting the max available version: \";\n\n $maxAvailableVersion = 0;\n\n foreach ($this->getDeltas() as $deltaNum => $delta) {\n if ($maxAvailableVersion < $deltaNum) {\n $maxAvailableVersion = $deltaNum;\n }\n }\n\n echo \"$maxAvailableVersion.\\n\";\n\n return $maxAvailableVersion;\n }", "public function maxSortingNumber(){\n $result = $this->repo->maxSortingNumber();\n return $result;\n }", "public function getLatestVersion()\n {\n $versions = array_keys($this->migrations);\n $latest = end($versions);\n\n return false !== $latest ? (string) $latest : '0';\n }", "public function latest()\n\t{\n\t\tif ( ! $migrations = $this->find_migrations())\n\t\t{\n\t\t\t$this->_error_string = $this->lang->line('migration_none_found');\n\t\t\treturn false;\n\t\t}\n\n\t\t$last_migration = basename(end($migrations));\n\n\t\t// Calculate the last migration step from existing migration\n\t\t// filenames and procceed to the standard version migration\n\t\treturn $this->version((int) substr($last_migration, 0, 3));\n\t}", "protected function _getMax(): int\n {\n $field = $this->_config['right'];\n $rightField = $this->_config['rightField'];\n $edge = $this->_scope($this->_table->find())\n ->select([$field])\n ->orderByDesc($rightField)\n ->first();\n\n if ($edge === null || empty($edge[$field])) {\n return 0;\n }\n\n return $edge[$field];\n }", "function hpm_last_mutation_id () {\n\n global $wpdb;\n $table = $wpdb->prefix . 'hpm_mutations';\n $result = $wpdb->get_var( \"SELECT id FROM $table ORDER BY id DESC LIMIT 1\" );\n return (int) $result;\n\n}", "public function getReferenceNum()\n {\n return $this->referenceNum;\n }", "function cek_rev_lhp($id_p2hp) {\n $sql = \"SELECT max(rev_ke) as no_rev FROM rev_lhp WHERE rev_fk_p2hp='$id_p2hp'\";\n $row = $this->db->query($sql)->row();\n $max_no = $row->no_rev + 1;\n return $max_no;\n }", "public function getLast()\n {\n global $wpdb;\n\n $sql = \"SELECT * FROM {$wpdb->prefix}exolnet_migration as em\n WHERE batch = {$this->getLastBatchNumber()} ORDER BY migration DESC\";\n\n return $wpdb->get_results($sql, 'ARRAY_A');\n }", "public function getNextRevDocNumber(){\n $lastDoc = File::orderBy('id', 'desc')->first();\n\n /*\n In a case where no record is found get 1 as a\n virtual record to generate document number.\n */\n if(is_null($lastDoc)){\n /*\n create an object counter (number) to store document ID and\n initialiaze it to 1.\n */\n $id = File::find(1);\n $number = $id;\n\n //assign and add the number with Doc ID\n $number += File::find(1);\n\n /*\n concatenate BRS-DFT- with the last inserted Doc ID\n that will end with 3 numbers.\n */\n\n return 'BRS-DFT-' . sprintf('%03d', intval($number) + 1);\n\n }else{\n /*\n The document exists then\n create variable number to store document ID\n initialiaze it to 0.\n */\n $number = 0;\n\n //assign and add the number with Doc ID\n $number += $lastDoc->id;\n\n /*\n concatenate BRS-DFT- with the last inserted Doc ID\n that will end with 3 numbers.\n */\n return 'BRS-DFT-' . sprintf('%03d', intval($number) + 1);\n }\n\n }", "public function getLastCol() : int\n {\n\n // Convert A1:D3 to D3.\n list(,$endRef) = explode(':', $this->getTableNode()->getAttribute('ref'));\n\n // Convert D3 to 4.\n $endCol = preg_replace('/([0-9])/', '', $endRef);\n\n return XlsxTools::convRefToNumber($endCol);\n }", "public function getNextNumMvt($mode = '')\n\t{\n\t\tglobal $conf;\n\n\t\t$sql = \"SELECT MAX(piece_num)+1 as max FROM \" . MAIN_DB_PREFIX . $this->table_element.$mode;\n\t\t$sql .= \" WHERE entity IN (\" . getEntity('accountancy') . \")\";\n\n\t\tdol_syslog(get_class($this) . \"getNextNumMvt sql=\" . $sql, LOG_DEBUG);\n\t\t$result = $this->db->query($sql);\n\n\t\tif ($result) {\n\t\t\t$obj = $this->db->fetch_object($result);\n\t\t\tif ($obj) $result = $obj->max;\n\t\t\tif (empty($result)) $result = 1;\n\t\t\treturn $result;\n\t\t} else {\n\t\t\t$this->error = \"Error \" . $this->db->lasterror();\n\t\t\tdol_syslog(get_class($this) . \"::getNextNumMvt \" . $this->error, LOG_ERR);\n\t\t\treturn - 1;\n\t\t}\n\t}", "function get_version_max() {\n return $this->version_max;\n }", "public function max_id()\n\t{\n\t\t$this->db->select_max('id');\n\t\t$query = $this->db->get($this->_tables['fuel_navigation']);\n\t\t$data = $query->row_array();\n\t\treturn $data['id'];\n\t}", "public function getLastBatchNo()\n {\n $query = \"SELECT max(BatchNumber) AS BatchNumber FROM voucherbatch\";\n $sql = Yii::app()->db->createCommand($query);\n $result = $sql->queryRow();\n \n if($result['BatchNumber'] > 0)\n return $result['BatchNumber'] + 1;\n else\n return 1;\n }", "protected function MEMBER_getLastMember()\n\t{\n\t\t$query = $this->db->select(\n\t\t\t\tself::MEMBER_TABLE,\n\t\t\t\t'collab_member_id',\n\t\t\t\t'',\n\t\t\t\t__LINE__,\n\t\t\t\t__FILE__,\n\t\t\t\tfalse,\n\t\t\t\t\"ORDER BY `collab_member_id` DESC LIMIT 1;\"\n\t\t);\n\t\t$last_row = $query->fetchRow();\n\t\treturn is_array($last_row)? $last_row['collab_member_id']: 0;\n\t}", "public function get_last_referral_id(){\n\t\tglobal $con;\n\t\t$query=\"SELECT referral_id FROM referrals ORDER BY referral_id DESC LIMIT 1\";\n\t\t$result=array();\n\t\t$last_id=\"\";\n\t\t$result=$this->select($con,$query);\n\t\tforeach ($result as $key => $value) {\n\t\t\t$last_id=$value['referral_id'];\n\t\t}\n\n\t\treturn $last_id;\n\t}", "public function VerUltimoID()\r\n {\r\n\t\r\n\t$reg=mysql_query(\"select max($this->ID) as maxID from $this->tabla\", $this->con) or die('no se pudo encontrar el ultimo ID en VerUltimoID: ' . mysql_error());\r\n\t$reg=mysql_fetch_array($reg);\t\r\n\t\r\n\treturn($reg[\"maxID\"]);\r\n\t\r\n\t}", "private function get_last_number() {\n\t\treturn $this->settings['last_number'];\n\t}", "public function getNumber()\n {\n foreach ($this->getGame()->getLegs() as $idx=>$leg) {\n if ($leg == $this) {\n return $idx+1;\n }\n }\n\n return null;\n }", "function cek_rev_p2hp($id_p2hp) {\n $sql = \"SELECT max(rev_ke) as no_rev FROM rev_p2hp WHERE rev_p2hp='$id_p2hp'\";\n $row = $this->db->query($sql)->row();\n $max_no = $row->no_rev + 1;\n return $max_no;\n }", "public function getMax(): int;", "protected function _get_version()\n\t{\n\t\t$row = $this->db->get('migrations')->row();\n\t\treturn $row ? $row->version : 0;\n\t}", "function getMaxId($db)\n {\t \n $sql = \"SHOW TABLE STATUS LIKE 'leads'\";\n\t$result = $db->execQuery($sql);\n\t$row = $db->resultArray();\n\treturn $row[0]['Auto_increment'];\t \n }", "function getMaxId($db)\n {\t \n $sql = \"SHOW TABLE STATUS LIKE 'leads'\";\n\t$result = $db->execQuery($sql);\n\t$row = $db->resultArray();\n\treturn $row[0]['Auto_increment'];\t \n }", "public function getMaxOrderNumber()\n {\n $orderNumber = $this->find('all', [\n 'conditions' => [\n 'top_flag' => FLAG_TRUE,\n 'delete_flag' => FLAG_FALSE\n ],\n 'fields' => [\n 'order_number' => 'MAX(News.order_number) + 1 '\n ]\n ]);\n\n if($orderNumber->first()->order_number) {\n $maxOrderNumber = $orderNumber->first()->order_number;\n } else {\n $maxOrderNumber = 1;\n }\n\n return $maxOrderNumber;\n }", "public function getMaxMenuPosition()\n {\n $value=DB::table('links')\n ->max('menu_position');\n return $value;\n }", "public function get_new_id()\n {\n $query = \"select MAX(id) as id from team\";\n $res = $this->db->query($query);\n $res->result_array();\n $last_id = ($res->result()[0]->id)+1;\n return $last_id;\n }", "public function getMaxNumber()\n {\n return $this->maxNumber;\n }" ]
[ "0.6550333", "0.6362402", "0.6198158", "0.61445165", "0.6137577", "0.60441065", "0.6022636", "0.59896886", "0.5986675", "0.5979175", "0.59742445", "0.5897246", "0.5851074", "0.58434737", "0.58397466", "0.5838604", "0.5832273", "0.5825268", "0.5821111", "0.5814068", "0.58073777", "0.579692", "0.57961655", "0.5792296", "0.5790079", "0.5790079", "0.5779794", "0.57643723", "0.5757299", "0.5746118" ]
0.7276018
0
Executes a migration with the purpose to reach the specified target. If target has been already executed we are doing a rollback.
public function migrate($target=null) { $migrations = $this->getAvailableMigrations($target); if (null === $target) { end($migrations); $target = key($migrations); } if (!$this->isDownwards($target)) { return $this->doMigration($migrations, AdapterInterface::UP); } else { return $this->doMigration($migrations, AdapterInterface::DOWN); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function up($targetMigration)\n {\n $migrations = new Ot_Model_DbTable_Migrations($this->_tablePrefix);\n \n $migrationsIdsNotApplied = array_diff(array_keys($this->_availableMigrations), $this->_appliedMigrations);\n \n $migrationsToApply = array();\n \n foreach ($migrationsIdsNotApplied as $migrationId) {\n if ($migrationId <= $targetMigration) {\n $migrationsToApply[] = $this->_availableMigrations[$migrationId];\n }\n }\n \n if (empty($migrationsToApply)) {\n $this->_messages[] = 'No migrations to apply';\n return;\n }\n \n $this->_db->beginTransaction();\n \n foreach ($migrationsToApply as $m) {\n \n require_once $this->_migrationsPath . '/' . $m;\n $classname = 'Db_' . substr($m, 0, -4); //strip out the .php extension\n $migrationClass = new $classname(array('tablePrefix' => $this->_tablePrefix));\n\n try {\n $migrationClass->up($this->_db, $this->_tablePrefix);\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Error applying migration ' . $m . '. ' . $e->getMessage());\n }\n \n try {\n $migrations->addMigration($this->_getMigrationIdFromFilename($m));\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Migration ' . $m . ' was successful, but adding record to migrations table failed. ' . $e->getMessage());\n }\n \n $this->_messages[] = 'Applied ' . $m;\n }\n \n $this->_db->commit();\n }", "public function down($targetMigration)\n {\n $migrationsModel = new Ot_Model_DbTable_Migrations($this->_tablePrefix);\n \n end($this->_appliedMigrations);\n $highestExecutedMigration = current($this->_appliedMigrations);\n reset($this->_appliedMigrations);\n\n if (!isset($this->_availableMigrations[$targetMigration])) {\n throw new Exception('The requested migration ' . $targetMigration . ' was not found.');\n }\n \n if ((int)$highestExecutedMigration <= (int)$targetMigration) {\n throw new Exception('The database is only migrated to migration ' . $highestExecutedMigration . ', which is before the requested migration ' . $targetMigration);\n }\n \n $migrationsToApply = array();\n \n foreach ($this->_appliedMigrations as $a) {\n if ((int)$a > (int)$targetMigration && isset($this->_availableMigrations[$a])) {\n $migrationsToApply[] = $this->_availableMigrations[$a];\n }\n }\n \n $migrationsToApply = array_reverse($migrationsToApply);\n \n if (empty($migrationsToApply)) {\n $this->_messages[] = 'No migrations to apply';\n }\n \n $this->_db->beginTransaction();\n \n foreach ($migrationsToApply as $m) {\n require_once $this->_migrationsPath . '/' . $m;\n $classname = 'Db_' . substr($m, 0, -4); //strip out the .php extension\n $migrationClass = new $classname(array('tablePrefix' => $this->_tablePrefix));\n\n try {\n $migrationClass->down($this->_db, $this->_tablePrefix);\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Error applying migration ' . $m . '. ' . $e->getMessage());\n }\n \n try {\n $migrationsModel->removeMigration($this->_getMigrationIdFromFilename($m));\n } catch (Exception $e) {\n $this->_db->rollback();\n throw new Exception('Migration ' . $m . ' was successful, but adding record to migrations table failed. ' . $e->getMessage());\n }\n \n $this->_messages[] = 'Down migration of ' . $m . ' was successful.';\n }\n \n $this->_db->commit();\n }", "public function up(int $target_version = null): void\n {\n $files = $this->getUpFilesToExecute($target_version);\n if (empty($files)) {\n return;\n }\n\n if (!$target_version) {\n $version_file = array_pop($files);\n $target_version = $this->getVersionFromFile($version_file);\n }\n\n foreach ($files as $file) {\n $file_path = $this->migrationDir . '/up/' . $file;\n $sql_statements = $this->getSQLStatements($file_path);\n $this->executeStatements($sql_statements);\n }\n\n $this->setCurrentVersion($target_version);\n }", "public function execute() {\n $oldMigrations = new Filesystem(\"App/system/databases/migrations\");\n $oldMigrations->addFilter(new MigrationFilter($this->model->getShortModelName()));\n\n\n //todo: write custom iterator\n $oldMigrations->customCallback([$this, \"applyOldMigrations\"]);\n //todo: get the current model and get the diffrences between that and the migration\n //todo: write a new migration.\n //\n // $this->buildChangeSet();\n //do stuff execute all the things\n $this->createNewMigration();\n\n }", "public function test_get_runnable_migrations_going_up_with_target_version_with_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n //pretend we already executed version 1\n $this->insert_dummy_version_data(array(1));\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $expect_up_files = array(\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n $this->clear_dummy_data();\n\n //now pre-register some migrations that we have already executed\n $this->insert_dummy_version_data(array(1, 3));\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $this->assertEquals(array(), $actual_up_files);\n }", "public function down(int $target_version = null): void\n {\n $files = $this->getDownFilesToExecute($target_version);\n foreach ($files as $file) {\n $file_path = $this->migrationDir . '/down/' . $file;\n $sql_statements = $this->getSQLStatements($file_path);\n $this->executeStatements($sql_statements);\n }\n\n $this->setCurrentVersion($target_version);\n }", "public function version($target_version)\n\t{ \n\t\t$start = $current_version = $target_version-1;\n\t\t$stop = $target_version;\n \n\t\tif ($target_version > $current_version)\n\t\t{\n\t\t\t// Moving Up\n\t\t\t++$start;\n\t\t\t++$stop;\n\t\t\t$step = 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Moving Down\n\t\t\t$step = -1;\n\t\t}\n \n\t\t$method = ($step === 1) ? 'up' : 'down';\n\t\t$migrations = array();\n \n\t\t// We now prepare to actually DO the migrations\n\t\t// But first let's make sure that everything is the way it should be\n\t\tfor ($i = $start; $i != $stop; $i += $step)\n\t\t{ \n\t\t\t$f = glob(sprintf($this->_migration_path . '%03d_*.php', $i));\n\t\t\t// Only one migration per step is permitted\n\t\t\tif (count($f) > 1)\n\t\t\t{\n\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $i);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tif ( isset( $f[0] ) ) { \n\t\t\t\t$name = basename($f[0], '.php');\n\t\t\t} else {\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n \n\t\t\t// Filename validations\n\t\t\tif (preg_match('/^\\d{3}_(\\w+)$/', $name, $match))\n\t\t\t{\n\t\t\t\t$match[1] = strtolower($match[1]);\n\n\t\t\t\t// Cannot repeat a migration at different steps\n\t\t\t\tif (in_array($match[1], $migrations))\n\t\t\t\t{\n\t\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $match[1]);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tinclude $f[0];\n\t\t\t\t$class = 'Migration_' . ucfirst($match[1]);\n\n\t\t\t\tif ( ! class_exists($class))\n\t\t\t\t{\n\t\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif ( ! is_callable(array($class, $method)))\n\t\t\t\t{\n\t\t\t\t\t$this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\t$migrations[] = $match[1];\n\t\t\t}\n\t\t}\n\n\t\tlog_message('debug', 'Migration atual: ' . $current_version);\n\n\t\t$version = $i + ($step == 1 ? -1 : 0);\n\n\t\t// If there is nothing to do so quit\n\t\tif ($migrations === array())\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tlog_message('debug', 'Migrating from ' . $method . ' to version ' . $version);\n \n\t\t// Loop through the migrations\n\t\n\t\t\t// Run the migration class\n\t\t\t$class = 'Migration_' . ucfirst(strtolower(end($migrations)));\n\t\t\tcall_user_func(array(new $class, $method));\n\n\t\t\t$current_version += $step;\n\t\t\t$this->_update_version($current_version);\n\t\t\n\n\t\tlog_message('debug', 'Finished migrating to '.$current_version);\n \n\t\treturn end($migrations);\n\t}", "public function runAction():void{\n $currentVersion = Migration::getCurrentVersion();\n $migrations = glob($this->config->application->migrationsDir.'*.php');\n $version = count($migrations);\n if((int)$version === $currentVersion){\n Cli::error('Nothing to migrate');\n }\n for($i=($currentVersion+1); $i<=$version; $i++){\n $class= \"MigrationVersion\".$i; \n $migration = new $class();\n $this->executeQueries($migration->up());\n\n Migration::setCurrentVersion($i);\n }\n }", "public function rebuild($targetMigration = null)\n {\n $migrations = new Ot_Model_DbTable_Migrations($this->_tablePrefix);\n \n $this->_messages[] = 'Dropping all tables';\n \n try {\n $migrations->dropAllTables();\n } catch (Exception $e) {\n throw new Exception('Dropping all the tables failed. ' . $e->getMessage());\n }\n \n $this->_messages[] = 'All tables dropped.';\n \n $this->_messages[] = \"Recreating migration table.\";\n $migrations->createTable(); // create the migrations table\n \n // reset the applied migrations array. it should be empty, but we'll\n // check the db just to make sure\n $this->_appliedMigrations = $migrations->getAppliedMigrations();\n \n if (is_null($targetMigration)) {\n $this->_messages[] = 'Rebuilding database to latest version.';\n return $this->latest();\n } else {\n $this->_messages[] = 'Rebuilding database to version ' . $targetMigration . '.';\n return $this->up($targetMigration);\n }\n }", "private function run($direction) {\n\t\tDB::start_transaction();\n\n\t\ttry {\n\t\t\t$status = call_user_func(array($this, 'do_'.$direction));\n\t\t} catch(\\Exception $e) {\n\t\t\tCli::error($e);\n\t\t\t$status = false;\n\t\t}\n\n\t\tif(! $status) {\n\t\t\tCli::error(\"Something went wrong during the migration, rollback !\");\n\t\t\tDB::rollback_transaction();\n\t\t\tthrow new Database_Exception(\"Migration rolled back due to error.\");\n\t\t}\n\t\tDB::commit_transaction();\n\t\treturn true;\n\t}", "function auto_migrate($last_migration_file = null) {\n\t\t$migrations = $this->migration;\n\n\n\t\ttry {\n\t\t\t# get last migration (if not given):\n\t\t\t$last_migration_file = $last_migration_file ??\n\t\t\t $migrations->find()->order(['migration_id' => 'DESC'])->first()->migration_file;\n\t\t} catch(Exception $e) {\n\t\t\ttry {\n\t\t\t\t// commit initial migration\n\t\t\t\t$this->_migrate('0.sql');\n\n\t\t\t\t// check if migration succeeded\n\t\t\t\t$last_migration_file = $migrations->find()->order(['migration_id' => 'DESC'])->first()->migration_file;\n\t\t\t} catch(Exception $e) {\n\t\t\t\t// initial migration failed, give up now\n\t\t\t\thttp_response_code(500);\n\t\t\t\techo 'the database could not be set-up. Please check your initial migration';\n\t\t\t\tdie();\n\t\t\t}\n\n\t\t}\n\n\n\t\t// check if there is a migration file > last_migration and migrate it\n\n\t\t$migration_files = scandir('migrations');\n\t\t$migration_index = array_search($last_migration_file, $migration_files);\n\t\tif ($migration_index == null) {\n\t\t\t// file not found, just stop.\n\t\t\treturn;\n\t\t}\n\t\t$new_file = @$migration_files[$migration_index + 1];\n\t\tif ($new_file) {\n\t\t\t$this->_migrate($new_file);\n\n\t\t\t// continue checking the rest\n\t\t\t$this->auto_migrate($new_file);\n\t\t} // else: no files left\n\n\t}", "public function test_get_runnable_migrations_going_down_with_target_version_no_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $this->insert_dummy_version_data(array(3, '20090122193325'));\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', 1, false);\n $expect_down_files = array(\n array(\n 'version' => '20090122193325',\n 'class' => 'AddNewTable',\n 'file' => '20090122193325_AddNewTable.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_down_files, $actual_down_files);\n $this->clear_dummy_data();\n\n $this->insert_dummy_version_data(array(3));\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', 1, false);\n $expect_down_files = array(\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_down_files, $actual_down_files);\n\n //go all the way down!\n $this->clear_dummy_data();\n $this->insert_dummy_version_data(array(1, 3, '20090122193325'));\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', 0, false);\n $expect_down_files = array(\n array(\n 'version' => '20090122193325',\n 'class' => 'AddNewTable',\n 'file' => '20090122193325_AddNewTable.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_down_files, $actual_down_files);\n }", "public function __invoke()\n {\n $this->migrate();\n }", "public function callMigration()\n {\n Artisan::call('lucy:migration', $this->builder->getAttribute('migration'));\n\n Artisan::call('migrate');\n }", "public function __invoke(RunMigrator $runMigrator): void\n {\n $migratorEntity = $this->migratorRepository->find($runMigrator->getMigratorId());\n if (null === $migratorEntity) {\n $this->failure('Unknown migrator ID.', [\n 'id' => $runMigrator->getMigratorId(),\n ]);\n }\n $this->migratorEntity = $migratorEntity;\n\n if (null === $this->migratorEntity->getMigration()) {\n $this->failure('Migrator has no migration.', [\n 'id' => $this->migratorEntity->getId(),\n ]);\n }\n $this->migrationEntity = $this->migratorEntity->getMigration();\n\n // Do not run migrator multiple times\n if (ComponentStatus::CREATED !== $this->migratorEntity->getStatus()) {\n $this->logger->notice('Migrator already executed.', [\n 'migrator' => $this->migratorEntity->getId(),\n ]);\n return;\n }\n\n // Canceled/failed migration\n if ($this->migrationEntity->getStatus()->isCanceling()) {\n $this->migratorEntity->setStatus(ComponentStatus::CANCELED);\n $this->entityManager->flush();\n $this->logger->notice('Canceled migrator.', [\n 'migrator' => $this->migratorEntity->getId(),\n ]);\n return;\n }\n\n // Update migration status\n try {\n $this->checkMigrationStatus();\n } catch (MigratorNotReadyException $exception) {\n $this->logger->notice($exception->getMessage());\n return;\n }\n\n // Update task status\n $this->migratorEntity\n ->setStatus(ComponentStatus::RUNNING)\n ->setStartedAt();\n $this->entityManager->flush();\n\n // Run migrator\n try {\n $migrator = $this->getMigratorService($this->migratorEntity);\n $totalPushCount = 0;\n\n $puller = $migrator->getPuller();\n $pusher = $migrator->getPusher();\n foreach ($migrator->getExecutor()->execute($puller, $pusher) as $pushedItemCount) {\n $totalPushCount += $pushedItemCount;\n }\n } catch (\\Throwable $error) {\n $this->failure('Migrator failed.', [\n 'id' => $this->migratorEntity->getId(),\n 'error' => $error\n ]);\n }\n\n // Migrator succeeded\n $this->migratorEntity\n ->setStatus(ComponentStatus::FINISHED)\n ->setFinishedAt();\n $this->entityManager->flush();\n\n // Dispatch next messages\n $this->dispatchNextMessages();\n }", "public function test_get_runnable_migrations_going_up_with_target_version_no_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', 3, false);\n $expect_up_files = array(\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n }", "public function markAsExecuted(MigrationContract $migration): void;", "function migrate($migrateTo){\n\t$settingsModel = new Settings;\n\t(int) $currentVersion = $settingsModel->getVersion();\n\t\n\t//Display current database version\n\tif($migrateTo == 'version'){\n\t\techo \"\\n\\n\";\n\t\tdie(\"Database is currently at version #\".$currentVersion.\"\\n\\n\");\n\t}\n\t\n\t//Die if trying to migrate to current version - duh!\n\tif($migrateTo == $currentVersion){\n\t\techo \"\\n\\n\";\n\t\tdie(\"Database already at version #\".$migrateTo.\"\\n\\n\");\n\t}\n\t\n\t//Get migration scripts\n\t$migrations = scandir(APPLICATION_PATH.\"/../scripts/migrations\");\n\t\n\t//Get latest migration number and filter .. and .\n\tforeach($migrations AS $migration){\n\t\tif($migration<> '.' && $migration <> '..'){\n\t\t\t(int) $number = str_replace(\"migration\",'',str_replace(\".php\",'',$migration));\n\t\t\t\n\t\t\t$latestMigration = $number;\n\t\t}\n\t}\n\t\n\t//decide whether to take user input or migrate to most recent version\n\tif(isset($migrateTo)){\n\t\t(int)$migrateTo = $migrateTo;\n\t} else {\n\t\t(int)$migrateTo = $latestMigration;\n\t}\n\t\n\t//Die if trying to migrate to current version - duh!\n\tif($latestMigration == $currentVersion){\n\t\techo \"\\n\\n\";\n\t\tdie(\"Database already at version #\".$migrateTo.\"\\n\\n\");\n\t}\n\t\n\t//decide whether we are migrating up or down and order scripts accordingly\n\tif($migrateTo <= $currentVersion){\n\t\t$direction = 'down';\n\t\t$migrations = array_reverse($migrations);\n\t} else {\n\t\t$direction = 'up';\n\t}\n\t\n\t//build runFiles array\n\t$runFiles = array();\n\tforeach($migrations AS $migration){\n\t\tif($migration<> '.' && $migration <> '..'){\n\t\t\t//get only the version number\n\t\t\t(int) $number = str_replace(\"migration\",'',str_replace(\".php\",'',$migration));\n\t\t\tif($direction == 'up'){\n\t\t\t\tif($currentVersion < $number && $number <= $migrateTo){\n\t\t\t\t\t//add to runFiles array\n\t\t\t\t\t$runFiles[] = $migration;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($direction == 'down'){\n\t\t\t\tif($currentVersion >= $number && $number > $migrateTo){\n\t\t\t\t\t//add to runFiles array\n\t\t\t\t\t$runFiles[] = $migration;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\t//start counter at 0\n\t$migratedTo = 0;\n\n\t//cycle through scripts\n\tforeach($runFiles AS $file){\n\t\t//get only the version number\n\t\t(int) $number = str_replace(\"migration\",'',str_replace(\".php\",'',$file));\n\t\t\n\t\t//get migration class name\n\t\t$className = ucwords(str_replace(\".php\",'',$file));\n\t\t\n\t\t//include dependencies\n\t\tinclude APPLICATION_PATH.'/../scripts/migrations/'.$file;\n\t\t\n\t\t//instantiate migration class\n\t\t$migration = new $className;\n\t\t\n\t\tif($direction == 'up'){\n\t\t\t//run up() migration method\n\t\t\t$migration->up();\n\t\t\t//mark as last migration run\n\t\t\t$migratedTo = $number;\n\t\t}\n\t\tif($direction == 'down'){\n\t\t\t//run down migration method\n\t\t\t$migration->down();\n\t\t\t//mark as lat migration run\n\t\t\t$migratedTo = $number - 1;\n\t\t}\n\t\t\n\t\t\n\t}\n\t//update db with new version number\n\t$settingsModel->setVersion($migratedTo);\n\t\n\t//output results to terminal\n\techo \"\\n\\n\";\n\techo \"Database Migrated to Version #\".$migratedTo;\n\techo \"\\n\\n\";\n\n}", "public function test_get_runnable_migrations_going_up_no_target_version()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $actual_up_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'up', false);\n $expect_up_files = array(\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n ),\n array(\n 'version' => '20090122193325',\n 'class' => 'AddNewTable',\n 'file' => '20090122193325_AddNewTable.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_up_files, $actual_up_files);\n }", "public function runRollback()\r\n\t{\r\n\t\t$response = \"\";\r\n\t\t$response .= $this->ensureRepositoryExist();\r\n\t\t$migration_batch = $this->repository->getLastBatchNumber();\r\n\t\t$repository = $this->rollbackRepository();\r\n\t\tif (count($repository) > 0) {\r\n\t\t\tforeach ($repository as $file) {\r\n\t\t\t\t$migration_name = $this->removeDotPhp($file);\r\n\t\t\t\t$schema = $this->runDown($file);\r\n\t\t\t\tif ($schema != \"\") {\r\n\t\t\t\t\t$query_response = DB()->query($schema);\r\n\t\t\t\t\tif ($query_response) {\r\n\r\n\t\t\t\t\t\t// Once we have run a migrations file, we remove migration to repository.\r\n\t\t\t\t\t\t$this->repository->delete($migration_name, $migration_batch);\r\n\t\t\t\t\t\t$response .= nl2br(\"Rolled back: $migration_name\\n\");\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t$response .= nl2br(\"Failed: $migration_name\\n\");\r\n\t\t\t\t\t\t$response .= nl2br(\"-- $query_response[error]\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t$response .= nl2br(\"Empty: $migration_name\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t\t$response .= nl2br(\"Nothing to rollback.\\n\");\r\n\t\t}\r\n\r\n\t\treturn $response;\r\n\t}", "public function rollbackAction(null|int $version=null):void{\n $currentVersion = Migration::getCurrentVersion();\n $migrations = glob($this->config->application->migrationsDir.'*.php');\n if(!isset($version)){\n $version = count($migrations)-1;\n }\n if((int)$version >= $currentVersion){\n Cli::error('Nothing to migrate');\n }\n for($i=$currentVersion; $i>$version; $i--){\n $class= \"MigrationVersion\".$i; \n $migration = new $class();\n $this->executeQueries($migration->down()); \n \n Migration::setCurrentVersion($i-1);\n }\n }", "abstract protected function doRollback();", "public function getAvailableMigrations($target=null)\n\t{\n\t\t// for normal migration we need all files to target\n\t\t// for rollbacks we need from target to the greatest migration\n\t\t$filter = $this->getFilter();\n\t\tif (!$this->isDownwards($target)) {\n\t\t\tif (null !== $target) {\n\t\t\t\t$filter->setToVersion($target);\n\t\t\t}\n\t\t} else {\t// rollback\n\t\t\t$filter->setFromVersion($target);\n\t\t\t$filter->setToVersion($this->getGreatestMigration());\n\t\t}\n\n\t\t$migration_steps = $this->getMigrationSteps();\n\n\t\t// migrations to be executed\n\t\t$to_execute = array();\n\t\tif ($this->isDownwards($target)) {\n\t\t\t// rollback: execute the common part of $executed and $migration_refs\n\t\t\t$executed = $this->getExecutedMigrations();\n\t\t\tforeach($migration_steps as $ref => $migration_class) {\n\t\t\t\tif (array_key_exists($ref, $executed)) {\n\t\t\t\t\t$to_execute[] = $ref;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// migration: execute what's missing - the different of $executed and $available\n\t\t\t$to_execute = array_diff(array_keys($migration_steps), array_keys($this->getExecutedMigrations()));\n\t\t}\n\t\t\n\t\t// go through $to_execute and find the migration steps\n\t\t$migrations = array();\n\t\tforeach ($to_execute as $ref) {\n\t\t\t$migrations[$ref] = $migration_steps[$ref];\n\t\t}\n\t\t\n\t\t// sort migrations according to filter and target\n\t\t// remove one so that to avoid executing target in the case of rollback\n\t\t$this->sortMigrations($migrations, $target);\n\t\tif ($this->isDownwards($target)) {\n\t\t\tarray_pop($migrations);\n\t\t}\n\t\treturn $migrations;\n\t}", "public function testExecute()\n {\n $params = [\n '--connection' => 'test',\n ];\n $commandTester = $this->getCommandTester($params);\n $migrations = $this->getMigrations();\n $migrations->migrate();\n\n $commandTester->execute([\n 'command' => $this->command->getName(),\n '--connection' => 'test',\n '--seed' => 'NumbersSeed',\n ]);\n\n $display = $this->getDisplayFromOutput();\n $this->assertTextContains('== NumbersSeed: seeded', $display);\n\n $result = $this->connection->selectQuery()\n ->select(['*'])\n ->from('numbers')\n ->order('id DESC')\n ->limit(1)\n ->execute()->fetchAll('assoc');\n $expected = [\n [\n 'id' => '1',\n 'number' => '10',\n 'radix' => '10',\n ],\n ];\n $this->assertEquals($expected, $result);\n\n $migrations->rollback(['target' => 'all']);\n }", "public function execute()\n {\n $configPath = Yii::getAlias($this->consoleConfig);\n $app = new Application(require($configPath));\n\n // Wipe current integration DB\n if ($this->wipeExistingDb) {\n $dbFile = Yii::getAlias($this->dbFile);\n if (file_exists($dbFile)) {\n unlink($dbFile);\n }\n }\n\n $parts = $app->createController('migrate/up');\n\n if ($parts === false) {\n throw new Exception('Could not create controller');\n }\n\n /* @var $controller MigrateController */\n list($controller, $actionID) = $parts;\n\n $controller->interactive = false;\n $result = $controller->runAction($actionID, []);\n if ($result !== null && $result !== MigrateController::EXIT_CODE_NORMAL) {\n throw new Exception('Exit status was ' . VarDumper::dumpAsString($result));\n }\n }", "public function migrate()\n\t{ \n\t\t(new MigratorInterface)->migrate();\n\t}", "public static function executeMigrationQuery($updateSql, $errorToIgnore, $file)\n {\n try {\n Db::exec($updateSql);\n } catch (\\Exception $e) {\n self::handleQueryError($e, $updateSql, $errorToIgnore, $file);\n }\n }", "function rollback(): void;", "function runUp()\n{\n $files = scandir(LIB_ROOT . '/migrations');\n\n $db_migration_version = get_current_migration_version();\n\n $migrations = array();\n\n foreach($files as $file)\n {\n if(preg_match('/migration_([1-9][0-9]*)\\.php/i', $file, $matches))\n {\n $migration_version = $matches[1];\n\n // we only care about this migration if it has not been performed yet\n if($migration_version > $db_migration_version)\n {\n require_once LIB_ROOT . '/migrations/' . $matches[0];\n\n $migrations[$migration_version] = 'Migration_' . $migration_version;\n }\n }\n }\n\n if(count($migrations) == 0)\n echo 'There are no migrations to run; DB is already up to date (at version ' . $db_migration_version . ').' . \"\\n\\n\";\n else\n {\n // sort migrations, so that we execute them in ascending order\n ksort($migrations);\n\n $count = 0;\n\n foreach ($migrations as $id => $class_name)\n {\n $migrationClass = new $class_name();\n\n $count++;\n\n echo 'Running migration ' . $id . ' (' . $count . ' of ' . count($migrations) . ')...' . \"\\n\";\n\n try\n {\n $migrationClass->Up();\n fetch_none('UPDATE migration_version SET version=' . quote_smart($id));\n echo ' done!' . \"\\n\";\n }\n catch(Exception $e)\n {\n echo ' Encountered an exception during migration:' . \"\\n\";\n echo ' ' . $e->getMessage() . \"\\n\";\n echo ' Migration was not completed; the database may be left in a weird state.' . \"\\n\";\n if($count < count($migrations))\n {\n $remaining = (count($migrations) - $count);\n echo $remaining . ' remaining migration' . ($remaining == 1 ? '' : 's') . ' will not be run.' . \"\\n\";\n }\n echo \"\\n\";\n die();\n }\n }\n\n echo 'All done!' . \"\\n\\n\";\n }\n}", "public abstract function rollback();" ]
[ "0.65986085", "0.64678365", "0.63607174", "0.62464625", "0.59522486", "0.5951001", "0.59134656", "0.5821075", "0.58159983", "0.57255673", "0.5698722", "0.55741066", "0.5521083", "0.5499641", "0.54508257", "0.5421777", "0.54066783", "0.53917277", "0.538161", "0.5372396", "0.5353979", "0.53466886", "0.5333308", "0.52957624", "0.5286613", "0.52563703", "0.52535886", "0.52325636", "0.5214965", "0.52084225" ]
0.72628933
0
Executes rollback. It reverses a given number (steps) of the already executed migrations.
public function rollback($steps=1, $redo=false) { $migrations = array_slice($this->getExecutedMigrations(), -$steps, null, true); $migration_steps = $this->getMigrationSteps(); $to_execute = array(); foreach ($migrations as $ref => $migration_class) { $to_execute[$ref] = $migration_steps[$ref]; } $results = $this->doMigration($to_execute, AdapterInterface::DOWN); if ( $redo ) { reset($migrations); $target = key($migrations); $results = array_merge($results,$this->migrate($target)); } return $results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function rollbackAction(null|int $version=null):void{\n $currentVersion = Migration::getCurrentVersion();\n $migrations = glob($this->config->application->migrationsDir.'*.php');\n if(!isset($version)){\n $version = count($migrations)-1;\n }\n if((int)$version >= $currentVersion){\n Cli::error('Nothing to migrate');\n }\n for($i=$currentVersion; $i>$version; $i--){\n $class= \"MigrationVersion\".$i; \n $migration = new $class();\n $this->executeQueries($migration->down()); \n \n Migration::setCurrentVersion($i-1);\n }\n }", "public function runRollback()\r\n\t{\r\n\t\t$response = \"\";\r\n\t\t$response .= $this->ensureRepositoryExist();\r\n\t\t$migration_batch = $this->repository->getLastBatchNumber();\r\n\t\t$repository = $this->rollbackRepository();\r\n\t\tif (count($repository) > 0) {\r\n\t\t\tforeach ($repository as $file) {\r\n\t\t\t\t$migration_name = $this->removeDotPhp($file);\r\n\t\t\t\t$schema = $this->runDown($file);\r\n\t\t\t\tif ($schema != \"\") {\r\n\t\t\t\t\t$query_response = DB()->query($schema);\r\n\t\t\t\t\tif ($query_response) {\r\n\r\n\t\t\t\t\t\t// Once we have run a migrations file, we remove migration to repository.\r\n\t\t\t\t\t\t$this->repository->delete($migration_name, $migration_batch);\r\n\t\t\t\t\t\t$response .= nl2br(\"Rolled back: $migration_name\\n\");\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t$response .= nl2br(\"Failed: $migration_name\\n\");\r\n\t\t\t\t\t\t$response .= nl2br(\"-- $query_response[error]\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t$response .= nl2br(\"Empty: $migration_name\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t\t$response .= nl2br(\"Nothing to rollback.\\n\");\r\n\t\t}\r\n\r\n\t\treturn $response;\r\n\t}", "public function rollback();", "public function rollback();", "public function rollback();", "public function rollback();", "function rollback(): void;", "public function rollback()\n {\n }", "public function rollback()\n {\n }", "public abstract function rollback();", "public function rollback()\n\t{\n\t}", "public function rollback()\n\t{\n\t}", "function rollback();", "function RollbackTrans() {}", "public function rollBack()\n {\n if ($this->store->transactions == 1) {\n $this->store->transactions = 0;\n\n $this->store->rollBack();\n } else {\n --$this->transactions;\n }\n }", "public function reverse(): void\n {\n $ranks = $this->ranks;\n\n $this->commit(array_values(collect($ranks)->reverse()->all()));\n }", "public function rollBack()\n {\n if ($this->transactions == 1) {\n $this->transactions = 0;\n\n $this->getPdo()->rollBack();\n } else {\n $this->transactions--;\n }\n }", "public function rollback($totalBatch = 0)\n {\n $migrate = \\Config\\Services::migrations();\n\n try {\n $migrate->regress($totalBatch);\n } catch (\\Exception $e) {\n throw new \\Exception($e->getMessage());\n }\n }", "public function rollback($pretend = false)\n\t{\n\t\t$tenants = $this->getTenants();\n\t\t$migrationsFileList = array();\n\n\t\tif ($this->usePath)\n\t\t{\n\t\t\t$this->note('<info>Rollback command initiated with path \"'.$this->path.'\"</info>');\n\t\t\t$migrationsFileList = $this->includeMigrations($this->path);\n\t\t}\n\n\t\t$everyMigration = 0;\n\n\t\tforeach($tenants as $tenant)\n\t\t{\n\t\t\t$this->manager->bootstrapConnectionByTenantName($tenant->tenant_name);\n\t\t\t$this->note('<info>Bootstrapped connection for:</info> '.$tenant->tenant_name);\n\n\t\t\t$this->setConnection($tenant->tenant_name);\n\t\t\t$this->repository->setSource($tenant->tenant_name);\n\n\t\t\t$migrations = $this->repository->getLast();\n\n\t\t\tif (count($migrations) == 0)\n\t\t\t{\n\t\t\t\t// Move on to the next tenant.\n\t\t\t\t$this->note('<info>Nothing to rollback on \"'.$tenant->tenant_name.'\".</info>');\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tforeach($migrations as $migration)\n\t\t\t{\n\t\t\t\t$this->note('<info>Rolling back \"'.$migration->migration.'\".</info>');\n\t\t\t\t$this->runDown((object) $migration, $pretend);\n\t\t\t}\n\n\t\t\t$everyMigration += count($migrations);\n\n\t\t}\n\n\t\treturn $everyMigration;\n\t}", "public function rollBack()\n {\n if ($this->transactionCount < 1) {\n return;\n }\n $transaction = $this->unprepared(\"ROLLBACK;\");\n if (false !== $transaction) {\n $this->transactionCount--;\n }\n }", "public function rollback()\n{\n\t$this->query('ROLLBACK');\n}", "protected function rollback() {\n $this->objDbConn->rollBack();\n }", "public function testMigrationsOptionsRollback()\n {\n $this->exec('completion options migrations.migrations rollback');\n $this->assertCount(1, $this->_out->messages());\n $output = $this->_out->messages()[0];\n $expected = '--connection -c --date -d --dry-run -x --fake --force -f --help -h --no-lock --plugin -p';\n $expected .= ' --quiet -q --source -s --target -t --verbose -v';\n $outputExplode = explode(' ', trim($output));\n sort($outputExplode);\n $expectedExplode = explode(' ', $expected);\n sort($expectedExplode);\n\n $this->assertEquals($outputExplode, $expectedExplode);\n }", "public function processRollback(array $options = array()) {\n if ($this->enabled) {\n $return = MigrationBase::RESULT_COMPLETED;\n if (method_exists($this, 'rollback')) {\n $this->options = $options;\n // TODO: Validate dependencies (migrations depending on us have no imported rows)\n /* if (!isset($options['force'])) {\n if (!$this->dependenciesComplete()) {\n return Migration::RESULT_SKIPPED;\n }\n }*/\n $this->beginProcess(MigrationBase::STATUS_ROLLING_BACK);\n try {\n $return = $this->rollback();\n }\n catch (Exception $exception) {\n // If something bad happened, make sure we clear the semaphore\n $this->endProcess();\n throw $exception;\n }\n $this->endProcess();\n }\n }\n else {\n $return = MigrationBase::RESULT_DISABLED;\n }\n return $return;\n }", "public function runAction():void{\n $currentVersion = Migration::getCurrentVersion();\n $migrations = glob($this->config->application->migrationsDir.'*.php');\n $version = count($migrations);\n if((int)$version === $currentVersion){\n Cli::error('Nothing to migrate');\n }\n for($i=($currentVersion+1); $i<=$version; $i++){\n $class= \"MigrationVersion\".$i; \n $migration = new $class();\n $this->executeQueries($migration->up());\n\n Migration::setCurrentVersion($i);\n }\n }", "public function rollBack(){\r\n $this->db->rollBack();\r\n }", "public function rollback(){\n $this->db->exec('ROLLBACK TO xyz;');\n }", "function rollback() {\n\t\t\tself::$db->rollback();\n\t\t}", "abstract protected function doRollback();", "public function rollBack()\r\n {\r\n if ($this->_txns == 1) {\r\n $this->getMaster()->rollBack();\r\n $this->_txns = 0;\r\n } else {\r\n --$this->_txns;\r\n }\r\n }" ]
[ "0.70009357", "0.69230497", "0.62698865", "0.62698865", "0.62698865", "0.62698865", "0.6083575", "0.6079513", "0.6079513", "0.60417515", "0.5996267", "0.5996267", "0.59493953", "0.5925792", "0.5922571", "0.5917022", "0.59099555", "0.5871308", "0.5856061", "0.5851709", "0.5839615", "0.58280146", "0.5824733", "0.58047134", "0.57941383", "0.57261837", "0.5708942", "0.56910753", "0.56799966", "0.5664098" ]
0.7283617
0
Calls the up or down method on the provided migrations and notifies the adapter to updated its list, based on the provided direction.
private function doMigration($migrations, $direction) { $methods = array( AdapterInterface::UP => array('up', 'addMigration'), AdapterInterface::DOWN => array('down', 'removeMigration'), ); $results = array(); foreach($migrations as $ref => $migration) { list($migration_method, $adapter_method) = $methods[$direction]; // assign helpers to instance $impl = $migration->getImplementation(); foreach( get_class_methods($impl) as $method ) { // get only setters if ('set' !== substr($method, 0, 3)) { continue; } // a quick and dirty way to find the helper method // need to take care CamelCase methods $helper_name = strtolower(substr($method, 3)); $helper = $this->getHelper($helper_name); if (!is_bool($helper)) { call_user_func(array($impl, $method), $helper); } } // call up or down method $results[] = call_user_func(array($migration, $migration_method)); call_user_func(array($this->getAdapter(), $adapter_method), $impl, $ref); } return $results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function migrate($direction)\n\t{\n\t\tif ($direction == self::UP)\n\t\t{\n\t\t\t// Get files\n\t\t\t$files = scandir($this->migration_path);\n\t\t\t$files = array_slice($files, 2, count($files));\n\n\t\t\tif (in_array('migrations', R::inspect()))\n\t\t\t{\n\t\t\t\t// Get migrated records\n\t\t\t\t$migrated_files = R::getCol('SELECT name FROM migrations');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$migrated_files = array();\n\t\t\t}\n\n\t\t\t// Get non migrated files\n\t\t\t$non_migrated = array_diff($files, $migrated_files);\n\n\t\t\t// Load non migrated files and execute\n\t\t\tforeach ($non_migrated as $file)\n\t\t\t{\n\t\t\t\t$instance = $this->loadMigration($file);\n\t\t\t\t$instance->up();\n\n\t\t\t\t// Record our migration\n\t\t\t\t$this->storeMigration($file);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$migration = R::findOne('migrations', ' ORDER BY created DESC ');\n\n\t\t\t// Load migration and migrate it down\n\t\t\t$instance = $this->loadMigration($migration->name);\n\t\t\t$instance->down();\n\n\t\t\t// Remove migration form database\n\t\t\tR::trash($migration);\n\t\t}\n\t}", "public function migrateUp()\n {\n //$this->migrate('up');\n $this->artisan('migrate');\n }", "public function up(){\n $migration_files=dirToArray($this->migrations_dir);\n if(!sizeof($migration_files)){\n die('migration does not exist');\n }\n\n //check MIGRATION_TABLE_NAME\n $this->_check_table();\n\n //check run migrations\n $migration_files=$this->_check_run_migrations($migration_files);\n\n if(sizeof($migration_files)<=0){\n die('migration file does not exist');\n }\n\n $responses = [];\n foreach($migration_files as $file){\n $responses[] = $this->_run($file,'up');\n }\n return $responses;\n }", "public function migrate()\n {\n $fileSystem = new Filesystem();\n $classFinder = new ClassFinder();\n\n foreach ($fileSystem->files(__DIR__.'/../../../../tests/NilPortugues/App/Migrations') as $file) {\n $fileSystem->requireOnce($file);\n $migrationClass = $classFinder->findClass($file);\n (new $migrationClass())->down();\n (new $migrationClass())->up();\n }\n }", "public function callMigration()\n {\n Artisan::call('lucy:migration', $this->builder->getAttribute('migration'));\n\n Artisan::call('migrate');\n }", "public function setMigratingUp($isMigratingUp);", "public function isMigratingUp();", "abstract protected function up();", "public function migrate($direction)\n {\n if (!method_exists($this, $direction)) { return; }\n\n if ($direction == 'up') { $this->announce(\"migrating\"); }\n if ($direction == 'down') { $this->announce(\"reverting\"); }\n\n $result = null;\n $t = new Horde_Support_Timer();\n $t->push();\n $result = $this->$direction();\n $time = $t->pop();\n\n if ($direction == 'up') {\n $this->announce(\"migrated (\" . sprintf(\"%.4fs\", $time) . \")\");\n $this->log();\n }\n if ($direction == 'down') {\n $this->announce(\"reverted (\" . sprintf(\"%.4fs\", $time) . \")\");\n $this->log();\n }\n return $result;\n }", "public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime);", "abstract public function up();", "abstract public function up();", "abstract public function up();", "function runUp()\n{\n $files = scandir(LIB_ROOT . '/migrations');\n\n $db_migration_version = get_current_migration_version();\n\n $migrations = array();\n\n foreach($files as $file)\n {\n if(preg_match('/migration_([1-9][0-9]*)\\.php/i', $file, $matches))\n {\n $migration_version = $matches[1];\n\n // we only care about this migration if it has not been performed yet\n if($migration_version > $db_migration_version)\n {\n require_once LIB_ROOT . '/migrations/' . $matches[0];\n\n $migrations[$migration_version] = 'Migration_' . $migration_version;\n }\n }\n }\n\n if(count($migrations) == 0)\n echo 'There are no migrations to run; DB is already up to date (at version ' . $db_migration_version . ').' . \"\\n\\n\";\n else\n {\n // sort migrations, so that we execute them in ascending order\n ksort($migrations);\n\n $count = 0;\n\n foreach ($migrations as $id => $class_name)\n {\n $migrationClass = new $class_name();\n\n $count++;\n\n echo 'Running migration ' . $id . ' (' . $count . ' of ' . count($migrations) . ')...' . \"\\n\";\n\n try\n {\n $migrationClass->Up();\n fetch_none('UPDATE migration_version SET version=' . quote_smart($id));\n echo ' done!' . \"\\n\";\n }\n catch(Exception $e)\n {\n echo ' Encountered an exception during migration:' . \"\\n\";\n echo ' ' . $e->getMessage() . \"\\n\";\n echo ' Migration was not completed; the database may be left in a weird state.' . \"\\n\";\n if($count < count($migrations))\n {\n $remaining = (count($migrations) - $count);\n echo $remaining . ' remaining migration' . ($remaining == 1 ? '' : 's') . ' will not be run.' . \"\\n\";\n }\n echo \"\\n\";\n die();\n }\n }\n\n echo 'All done!' . \"\\n\\n\";\n }\n}", "public function migrate($target=null)\n\t{\t\n\t\t$migrations = $this->getAvailableMigrations($target);\n\t\tif (null === $target) {\n\t\t\tend($migrations);\n\t\t\t$target = key($migrations);\n\t\t}\n\t\t\n\t\tif (!$this->isDownwards($target)) {\n\t\t\treturn $this->doMigration($migrations, AdapterInterface::UP);\n\t\t} else {\n\t\t\treturn $this->doMigration($migrations, AdapterInterface::DOWN);\n\t\t}\n\t}", "public function hookUpgrade($args) {\n\t\t$oldVersion = $args['old_version'];\n $newVersion = $args['new_version'];\n $doMigrate = false;\n\n $versions = array();\n foreach (glob(IIIF_API_BRIDGE_DIRECTORY . '/libraries/IiifApiBridge/Migration/*.php') as $migrationFile) {\n $className = 'IiifApiBridge_Migration_' . basename($migrationFile, '.php');\n include $migrationFile;\n $versions[$className::$version] = new $className();\n }\n uksort($versions, 'version_compare');\n\n foreach ($versions as $version => $migration) {\n if (version_compare($version, $oldVersion, '>')) {\n $doMigrate = true;\n }\n if ($doMigrate) {\n $migration->up();\n if (version_compare($version, $newVersion, '>')) {\n break;\n }\n }\n }\n\t}", "public function runDatabaseMigrations()\n {\n $this->parentRunDatabaseMigrations();\n\n $this->artisan('cms:migrate');\n\n $this->beforeApplicationDestroyed(function () {\n $this->artisan('cms:migrate:rollback');\n });\n }", "private function run($direction) {\n\t\tDB::start_transaction();\n\n\t\ttry {\n\t\t\t$status = call_user_func(array($this, 'do_'.$direction));\n\t\t} catch(\\Exception $e) {\n\t\t\tCli::error($e);\n\t\t\t$status = false;\n\t\t}\n\n\t\tif(! $status) {\n\t\t\tCli::error(\"Something went wrong during the migration, rollback !\");\n\t\t\tDB::rollback_transaction();\n\t\t\tthrow new Database_Exception(\"Migration rolled back due to error.\");\n\t\t}\n\t\tDB::commit_transaction();\n\t\treturn true;\n\t}", "public function action_up_migration_get()\n {\n $this->load->library('migration');\n $this->migration->current();\n }", "public function migrate()\n\t{ \n\t\t(new MigratorInterface)->migrate();\n\t}", "public function applyMigration()\n {\n $this->createMigrationsTable();\n $applied_migrations = $this->get_applied_migrations();\n\n $files = scandir(Application::$ROOT_DIR.'/migrations');\n $to_apply_migrations = array_diff($files, $applied_migrations);\n\n $new_migrations = [];\n\n foreach ($to_apply_migrations as $migration) {\n // skip unwanted folders\n if ($migration === '.' || $migration === '..') {\n continue;\n }\n require_once Application::$ROOT_DIR.'/migrations/'.$migration;\n\n $class_name = pathinfo($migration, PATHINFO_FILENAME);\n $instance = new $class_name();\n $instance->up();\n\n $new_migrations[] = $migration;\n }\n\n if (!empty($new_migrations)) {\n $this->saveMigration($new_migrations);\n }\n else {\n echo $this->log(\"All migrations are applied\");\n }\n }", "protected function migration_process() {\n\t\t$available_languages = Fusion_Multilingual::get_available_languages();\n\t\tself::$available_languages = ( ! empty( $available_languages ) ) ? $available_languages : [ '' ];\n\n\t\t$this->migrate_options();\n\t}", "public function up(): void\n {\n $filename = sprintf('%s/%s', static::UP, static::FILENAME);\n\n $this->execute($filename);\n }", "public function test_get_runnable_migrations_going_down_with_target_version_no_current()\n {\n $migrator_util = new Ruckusing_Util_Migrator($this->adapter);\n $this->insert_dummy_version_data(array(3, '20090122193325'));\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', 1, false);\n $expect_down_files = array(\n array(\n 'version' => '20090122193325',\n 'class' => 'AddNewTable',\n 'file' => '20090122193325_AddNewTable.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_down_files, $actual_down_files);\n $this->clear_dummy_data();\n\n $this->insert_dummy_version_data(array(3));\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', 1, false);\n $expect_down_files = array(\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_down_files, $actual_down_files);\n\n //go all the way down!\n $this->clear_dummy_data();\n $this->insert_dummy_version_data(array(1, 3, '20090122193325'));\n $actual_down_files = $migrator_util->get_runnable_migrations($this->migrations_dirs, 'down', 0, false);\n $expect_down_files = array(\n array(\n 'version' => '20090122193325',\n 'class' => 'AddNewTable',\n 'file' => '20090122193325_AddNewTable.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 3,\n 'class' => 'AddIndexToBlogs',\n 'file' => '003_AddIndexToBlogs.php',\n 'module' => 'default'\n ),\n array(\n 'version' => 1,\n 'class' => 'CreateUsers',\n 'file' => '001_CreateUsers.php',\n 'module' => 'default'\n )\n );\n $this->assertEquals($expect_down_files, $actual_down_files);\n }", "public function postUp(MigrationManager $manager)\n {\n }", "public function postUp(MigrationManager $manager)\n {\n }", "public function postUp(MigrationManager $manager)\n {\n }", "public function runDatabaseMigrations()\n {\n $this->artisan('migrate:fresh', $this->migrateFreshUsing());\n\n $this->app[Kernel::class]->setArtisan(null);\n\n $this->beforeApplicationDestroyed(function () {\n $this->artisan('migrate:rollback');\n\n RefreshDatabaseState::$migrated = false;\n });\n }", "public function migrations()\n {\n $this->loadMigrationsFrom(__DIR__.'/Database/Migrations');\n\n $this->publishes([\n __DIR__.'/Database/Migrations/' => database_path('migrations')\n ], $this->packageName.'-migrations');\n }", "public function updateMigration($type = 'up')\n {\n $file = $class = null;\n\n $file = $this->migrationDir.$this->getVersion().$this->getMigrationClass().self::EXTENSION;\n\n if (is_readable($file)) {\n include_once $file;\n $class = Inflector::classify($this->getMigrationClass());\n }\n\n if ($type == 'down') {\n call_user_func_array(\n array(\n new $class,\n $type\n ),\n array()\n );\n } else {\n call_user_func_array(\n array(\n new $class,\n $type\n ),\n array()\n );\n }\n $this->updateMigrationTable();\n\n }" ]
[ "0.6925409", "0.6138259", "0.6020842", "0.59198284", "0.5851253", "0.5794809", "0.5740674", "0.5654022", "0.5619761", "0.561222", "0.55906004", "0.55906004", "0.55906004", "0.5510452", "0.54333055", "0.5402129", "0.5372516", "0.53548384", "0.5351869", "0.5333748", "0.5321703", "0.5304439", "0.52727246", "0.5260665", "0.52599895", "0.52599895", "0.52599895", "0.52045536", "0.519924", "0.51793325" ]
0.69424427
0