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
Move Array Item (Key/Value) to bottom of Array
static function array_to_bottom($array, $key, $value_instead = false) { if ($value_instead) { if (($array_key = array_search($key, $array)) !== false) { unset($array[$array_key]); } array_push($array,$key); } else { $value = $array[$key]; unset($array[$key]); array_push($array, $value); } return $array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function acadp_array_insert_after( $key, $array, $new_array ) {\n\n\tif( array_key_exists( $key, $array ) ) {\n \t$new = array();\n \tforeach( $array as $k => $value ) {\n \t\t$new[ $k ] = $value;\n \t\tif( $k === $key ) {\n\t\t\t\tforeach( $new_array as $new_key => $new_value ) {\n \t\t\t$n...
[ "0.65382046", "0.639082", "0.63872117", "0.6279185", "0.6028279", "0.60095924", "0.59716326", "0.58767164", "0.577472", "0.57245255", "0.57037497", "0.56383383", "0.5622947", "0.55615455", "0.5550582", "0.5518241", "0.54523754", "0.5373389", "0.53269994", "0.5320326", "0.5320...
0.6967265
0
Move Array Item (Key/Value) to top of Array
static function array_to_top($array, $key, $value_instead = false) { if ($value_instead) { if (($array_key = array_search($key, $array)) !== false) { unset($array[$array_key]); } array_unshift($array , $key); } else { $value = array($key => $array[$key]); unset($array[$key]); $array = $value + $array; } return $array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unshift(array & $array, $key, $val) {\n $array = array_reverse($array, TRUE);\n $array[$key] = $val;\n $array = array_reverse($array, TRUE);\n\n return $array;\n}", "function arrayShift($array) {\n\n unset($array[0]);\n return $array;\n}", "public function array_put_to_position() {\n...
[ "0.64682126", "0.6390099", "0.63620937", "0.6329725", "0.62322664", "0.61628544", "0.61140645", "0.60008836", "0.5947864", "0.58728665", "0.58698773", "0.5834694", "0.5682076", "0.5677708", "0.56554115", "0.5621479", "0.5611845", "0.55907476", "0.5579645", "0.5530323", "0.552...
0.7094842
0
Hash String Hashes the string sent to it, and returns an array with both the hash & salt string in it. Config options are use_salt (bool) : Whether to use a salt string or not (`default = true`) encryption (const) : The encryption used (`default = PASSWORD_BCRYPT`)
static function hash_string($input, $config = []) { $defaults = [ 'use_salt' => true, 'encryption' => PASSWORD_BCRYPT ]; $config = array_merge($defaults, $config); //Create random bytes $salt_byte = random_bytes(15); //Make the bytes into a readable string (to save to the database) $salt_string = $config['use_salt'] ? bin2hex($salt_byte) : ""; //Put the salt-string after the password for the hashing for both creation and login $string_hashed = password_hash($input . $salt_string, $config['encryption']); return ['hash' => $string_hashed, 'salt' => $salt_string]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hash($str)\n\t{\n\t\t// on some servers hash() can be disabled :( then password are not encrypted \n\t\tif (empty($this->config['hash_method']))\n\t\t\treturn $this->config['salt_prefix'].$str.$this->config['salt_suffix']; \n\t\telse\n\t\t\treturn hash($this->config['hash_method'], $this->config['s...
[ "0.6824701", "0.64293176", "0.6423593", "0.6302542", "0.62636876", "0.61824", "0.6174575", "0.61459494", "0.6134166", "0.6131271", "0.61271495", "0.6121221", "0.61168444", "0.6109796", "0.6108238", "0.61012346", "0.60608405", "0.6059856", "0.6058442", "0.6049902", "0.6044517"...
0.722777
0
Redirects to the requested URL with specified schema.
protected function redirectToSchema(CFilterChain $filterChain, $schema) { $controller = $filterChain->controller; $action = $filterChain->action; $route = "{$controller->id}/{$action->id}"; $params = $_GET; $controller->redirect($controller->createAbsoluteUrl($route, $params, $schema)); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function redirect(string $toUrl, int $status = 302, string $schema = 'http'): PsrResponseInterface;", "public function redirectAction()\n {\n $params = array('key' => $_GET['url']);\n $records = $this->getCollection(self::MONGO_COLLECTION)->find($params);\n\n if ($records->hasNext(...
[ "0.67610604", "0.6102987", "0.5728082", "0.56425965", "0.5543527", "0.5446656", "0.5446656", "0.5446656", "0.5440463", "0.53295106", "0.529658", "0.5252868", "0.52139807", "0.519898", "0.51872313", "0.517975", "0.51673764", "0.5140585", "0.51342213", "0.51269835", "0.5108659"...
0.683372
0
Tests if this user can perform lookups of course/course catalog mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known lookup methods in this session will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users.
public function canLookupCourseCatalogMappings() { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function supportsCourseLookup() {\n \treturn $this->manager->supportsCourseLookup();\n\t}", "public function supportsCourseCatalogLookup() {\n \treturn $this->manager->supportsCourseCatalogLookup();\n\t}", "public function isAccessible() {\n\t\tif ($this->hasAccessRestrictions() === FALSE) {\n\t\t...
[ "0.72431564", "0.71832025", "0.6421889", "0.63752073", "0.6372867", "0.61922044", "0.61629236", "0.61516887", "0.6088547", "0.6023293", "0.6015788", "0.5937918", "0.58835906", "0.58796704", "0.58509636", "0.5839969", "0.5832234", "0.5829884", "0.58212954", "0.5810474", "0.578...
0.7472345
0
Gets the list of Course Ids associated with a CourseCatalog.
public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) { $ids = array(); $courses = $this->getCoursesByCatalog($courseCatalogId); while ($courses->hasNext()) { $ids[] = $courses->getNextCourse()->getId(); } return new phpkit_id_ArrayIdList($ids); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCatalogIdsByCourse(osid_id_Id $courseId) {\t\t\n\t\t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->exec...
[ "0.72812325", "0.7099674", "0.6827911", "0.64847654", "0.6342467", "0.6337828", "0.62192035", "0.61992717", "0.61672986", "0.61467516", "0.6085371", "0.5967249", "0.5954191", "0.5940127", "0.5739204", "0.5739204", "0.57051134", "0.5704309", "0.57019484", "0.56833065", "0.5675...
0.7899379
0
Gets the list of Courses associated with a CourseCatalog.
public function getCoursesByCatalog(osid_id_Id $courseCatalogId) { $lookupSession = $this->manager->getCourseLookupSessionForCatalog($courseCatalogId); $lookupSession->useIsolatedView(); if ($this->usesPlenaryView()) $lookupSession->usePlenaryCourseView(); else $lookupSession->useComparativeCourseView(); return $lookupSession->getCourses(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_stu...
[ "0.71496224", "0.7125692", "0.70384246", "0.69054234", "0.68716055", "0.6822623", "0.67812306", "0.6755467", "0.66981727", "0.6686777", "0.66485065", "0.6596202", "0.65363705", "0.6517668", "0.650607", "0.64620215", "0.6339792", "0.6298999", "0.6254616", "0.6078578", "0.60613...
0.7477056
0
Gets the list of Course Ids corresponding to a list of CourseCatalog objects.
public function getCourseIdsByCatalogs(osid_id_IdList $courseCatalogIdList) { $idList = new phpkit_CombinedList('osid_id_IdList'); while ($courseCatalogIdList->hasNext()) { try { $idList->addList($this->getCourseIdsByCatalog($courseCatalogIdList->getNextId())); } catch (osid_NotFoundException $e) { if ($this->usesPlenaryView()) throw $e; } } return $idList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) {\n \t$ids = array();\n \t$courses = $this->getCoursesByCatalog($courseCatalogId);\n \twhile ($courses->hasNext()) {\n \t\t$ids[] = $courses->getNextCourse()->getId();\n \t}\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "...
[ "0.76753193", "0.71126395", "0.6887197", "0.6728595", "0.6565588", "0.6200786", "0.6114252", "0.611215", "0.6048621", "0.60457027", "0.6044892", "0.59037507", "0.5902864", "0.5879822", "0.5832614", "0.5832614", "0.5800741", "0.57538456", "0.5745121", "0.5712706", "0.57010573"...
0.7867208
0
Gets the list of Courses corresponding to a list of CourseCatalog objects.
public function getCoursesByCatalogs(osid_id_IdList $courseCatalogIdList) { $courseList = new phpkit_CombinedList('osid_course_CourseList'); while ($courseCatalogIdList->hasNext()) { try { $courseList->addList($this->getCoursesByCatalog($courseCatalogIdList->getNextId())); } catch (osid_NotFoundException $e) { if ($this->usesPlenaryView()) throw $e; } } return $courseList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_stu...
[ "0.73062104", "0.71245277", "0.7057654", "0.70350176", "0.6980809", "0.6867817", "0.67235196", "0.6720836", "0.662141", "0.65670955", "0.65172315", "0.64136034", "0.6380824", "0.6318145", "0.63082445", "0.6265644", "0.6240504", "0.62089175", "0.613569", "0.610299", "0.6020837...
0.7464477
0
Gets the CourseCatalog Ids mapped to a Course.
public function getCatalogIdsByCourse(osid_id_Id $courseId) { $parameters = array( ':subject_code' => $this->getSubjectFromCourseId($courseId), ':course_number' => $this->getNumberFromCourseId($courseId) ); $statement = $this->getGetCatalogsStatement(); $statement->execute($parameters); $ids = array(); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/'); } $statement->closeCursor(); return new phpkit_id_ArrayIdList($ids); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) {\n \t$ids = array();\n \t$courses = $this->getCoursesByCatalog($courseCatalogId);\n \twhile ($courses->hasNext()) {\n \t\t$ids[] = $courses->getNextCourse()->getId();\n \t}\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "...
[ "0.76474375", "0.68942463", "0.6645033", "0.6436734", "0.6417131", "0.62609273", "0.6161324", "0.61395127", "0.6127694", "0.6127694", "0.60481673", "0.6031365", "0.60047334", "0.58725065", "0.5861905", "0.5826808", "0.5821608", "0.5818245", "0.58150244", "0.57863843", "0.5781...
0.7548647
1
Answer the statement for fetching catalogs
private function getGetCatalogsStatement () { if (!isset(self::$getCatalogsByCourse_stmt)) { self::$getCatalogsByCourse_stmt = $this->manager->getDB()->prepare( "SELECT course_catalog.catalog_id, catalog_title FROM SCBCRSE LEFT JOIN course_catalog_college ON SCBCRSE_COLL_CODE = coll_code LEFT JOIN course_catalog ON course_catalog_college.catalog_id = course_catalog.catalog_id WHERE SCBCRSE_SUBJ_CODE = :subject_code AND SCBCRSE_CRSE_NUMB = :course_number AND SCBCRSE_CSTA_CODE NOT IN ( 'C', 'I', 'P', 'T', 'X' ) GROUP BY SCBCRSE_SUBJ_CODE , SCBCRSE_CRSE_NUMB, catalog_id "); } return self::$getCatalogsByCourse_stmt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function fetchCatalogs()\n {\n $Sql = \"SELECT * FROM `db_catalogs`\";\n Parent::query($Sql);\n\n $catalogs = Parent::fetchAll();\n if (empty($catalogs)) {\n return array(\n 'status' => false,\n 'd...
[ "0.68669045", "0.6088272", "0.5808634", "0.5698634", "0.56830096", "0.56573486", "0.55278283", "0.5515977", "0.5488257", "0.54359615", "0.5419701", "0.5405967", "0.5371099", "0.53543603", "0.53422266", "0.5339128", "0.53056455", "0.52927727", "0.5285707", "0.52774066", "0.524...
0.75474966
0
Automatically create datagrid for master file table
private function generateDatagrid(&$simbio, $str_args) { $_master_tables = $this->global['db_prefix'].$this->dbTable.' AS mst '; if ($this->dbTable != 'unit_kerja') { $this->relation['id_unit'] = array('table' => 'unit_kerja', 'display_field' => 'nama_unit', 'pk_field' => 'id_unit'); } // include datagrid library $simbio->loadLibrary('Datagrid', SIMBIO_BASE.'Databases'.DSEP.'Datagrid.inc.php'); // create datagrid instance $_datagrid = new Datagrid($this->dbc); $_datagrid->numToShow = 20; // create an array of fields to show in datagrid $_fields = array(); $_primary_keys = array(); $_f = 0; foreach ($this->dbFields as $_fld => $_fld_info) { $_fld_label = ucwords(str_replace('_', ' ', $_fld)); $_fields[$_fld_label] = 'mst.'.$_fld; if (isset($_fld_info['isPrimary'])) { $_primary_keys[] = $_fld_label; } if (isset($this->relation[$_fld])) { $_rel_table = $this->global['db_prefix'].$this->relation[$_fld]['table']; $_fields[$_fld_label] = $_rel_table.'.'.$this->relation[$_fld]['display_field']; $_master_tables .= ' LEFT JOIN `'.$_rel_table.'` ON `mst`.'.$_fld.'='.'`'.$_rel_table.'`.'.$this->relation[$_fld]['pk_field']; } if ($_f == $this->gridMaxField) { break; } $_f++; } // set column to view in datagrid $_datagrid->setSQLColumn($_fields); // set primary key for detail view $_datagrid->setPrimaryKeys($_primary_keys); // set record actions $_action['Del.'] = '<input type="checkbox" name="record[]" value="{rowIDs}" />'; $_action['Edit'] = '<a class="datagrid-links" href="index.php?p=master/update/'.$this->dbTable.'/{rowIDs}"><b class="icon-edit"></b>&nbsp;</a>'; $_datagrid->setRowActions($_action); // set multiple record action options $_action_options[] = array('0', 'Pilih tindakan'); $_action_options[] = array('master/remove/'.$this->dbTable, 'Hapus rekod terpilih'); $_datagrid->setActionOptions($_action_options); // set result ordering $_datagrid->setSQLOrder('mst.input_date DESC'); // search criteria if (isset($_GET['keywords'])) { $_search = $simbio->filterizeSQLString($_GET['keywords'], true); $_criteria = ''; $_datagrid->setSQLCriteria($_criteria); } // built the datagrid $_datagrid->create($_master_tables); return $_datagrid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTableModel()\r\n {\r\n?>\r\n // table model\r\n var <?php echo $this->Name; ?>_tableModel = new qx.ui.table.SimpleTableModel();\r\n <?php\r\n if ($this->owner!=null)\r\n {\r\n ?>\r\n <?php echo $this->owner->...
[ "0.59534377", "0.57892495", "0.5734265", "0.5725187", "0.5685025", "0.56577164", "0.56120133", "0.5571964", "0.5557955", "0.55323964", "0.55260295", "0.55165577", "0.55000925", "0.5490411", "0.5462657", "0.545562", "0.5429502", "0.54096806", "0.54002047", "0.53851837", "0.537...
0.5799705
1
Cycles through each argument added Based on Rails `cycle` method if last argument begins with ":" then it will change the namespace (allows multiple cycle calls within a loop)
function cycle($first_value, $values = '*') { // keeps up with all counters static $count = array(); // get all arguments passed $values = is_array($first_value) ? $first_value : func_get_args(); // set the default name to use $name = 'default'; // check if last items begins with ":" $last_item = end($values); if( substr($last_item, 0, 1) === ':' ) { // change the name to the new one $name = substr($last_item, 1); // remove the last item from the array array_pop($values); } // make sure counter starts at zero for the name if( !isset($count[$name]) ) $count[$name] = 0; // get the current item for its index $index = $count[$name] % count($values); // update the count and return the value $count[$name]++; return $values[$index]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_loop($loop = array())\n {\n }", "public function cyclesAdd()\n {\n $this->cycles++;\n }", "function addOne(&$arg)\n{\n $arg++;\n}", "public function add()\n {\n for ($i = 0 ; $i < func_num_args(); $i++) {\n $this->addSingle(func_get_arg($i));\n }...
[ "0.5135708", "0.50927603", "0.505903", "0.48176682", "0.47834137", "0.47525236", "0.4743625", "0.4655114", "0.46123734", "0.46123734", "0.45069978", "0.44575948", "0.44385505", "0.44325992", "0.44205338", "0.4381066", "0.43750358", "0.43711752", "0.43579373", "0.43499324", "0...
0.5561409
0
Saves the Target Grade into the database. It either updates or inserts.
public function save() { if($this->id != -1) { $this->update_target_grade(); } else { $this->insert_target_grade(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function insert_target_grade()\r\n {\r\n global $DB;\r\n $params = $this->get_params();\r\n $this->id = $DB->insert_record('block_bcgt_target_grades', $params);\r\n }", "public function save_grade() {\r\n\r\n\t\t\t//new method\r\n\t\t\t$sql = \"UPDATE grades SET student_id = ?,...
[ "0.76819974", "0.73544496", "0.66014427", "0.64346683", "0.6227649", "0.59803945", "0.59065485", "0.58583045", "0.58172953", "0.5750802", "0.5672258", "0.5603101", "0.55894566", "0.55830395", "0.5562536", "0.5552673", "0.54855484", "0.5479278", "0.54779685", "0.5452694", "0.5...
0.82555264
0
Deletes the target grade using the target grade id passed in (from the database.)
public static function delete_target_grade($targetGradeID) { global $DB; $DB->delete_records('block_bcgt_target_grades', array('id'=>$targetGradeID)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete_grade() {\r\n\t\t\t$sql = \"DELETE FROM grades WHERE id = $this->id;\";\r\n\t\t\tDatabase::$db->query($sql);\r\n\t\t}", "function sqlDeleteGrade()\n\t{\n\t\t$sql = \"\n\t\tDELETE FROM tbl_grade\n\t\tWHERE grade_id = :grade_id\n\t\t\";\n\n\t\treturn $sql;\n\t}", "function sb_assignment_de...
[ "0.7750345", "0.62856454", "0.62751067", "0.6247999", "0.62387985", "0.6219215", "0.6123618", "0.6043811", "0.6039449", "0.60063916", "0.59998786", "0.5998948", "0.59953314", "0.5958848", "0.59498954", "0.5947142", "0.5945185", "0.5928793", "0.5928475", "0.59033436", "0.58987...
0.78142464
0
Inserts the target grade into the database.
private function insert_target_grade() { global $DB; $params = $this->get_params(); $this->id = $DB->insert_record('block_bcgt_target_grades', $params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save()\r\n {\r\n if($this->id != -1)\r\n {\r\n $this->update_target_grade();\r\n }\r\n else\r\n {\r\n $this->insert_target_grade();\r\n }\r\n }", "public function test_insert_grade_record() {\n global $DB, $USER;\n\n ...
[ "0.72508174", "0.6786291", "0.6740325", "0.6493337", "0.64287007", "0.6354729", "0.6333785", "0.6196301", "0.612433", "0.6093761", "0.60206985", "0.59183985", "0.5916492", "0.58917445", "0.58423537", "0.56940925", "0.56732213", "0.5664993", "0.5616756", "0.5606822", "0.560106...
0.8400825
0
Gets the params from the object passed in and puts them onto the target grade objectl.
private function extract_params($params) { if(isset($params->id)) { $this->id = $params->id; } $this->grade = $params->grade; $this->ucaspoints = $params->ucaspoints; $this->bcgttargetqualid = $params->bcgttargetqualid; $this->upperscore = $params->upperscore; $this->lowerscore = $params->lowerscore; $this->ranking = $params->ranking; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function get_params()\r\n {\r\n $params = new stdClass();\r\n $params->grade = $this->grade;\r\n $params->ucaspoints = $this->ucaspoints;\r\n $params->bcgttargetqualid = $this->bcgttargetqualid;\r\n $params->upperscore = $this->upperscore;\r\n $params->lowerscor...
[ "0.59932023", "0.57584214", "0.55334836", "0.5452479", "0.5435454", "0.5434264", "0.5417483", "0.53067166", "0.53067166", "0.53007376", "0.524095", "0.521113", "0.51391417", "0.51391417", "0.51391417", "0.51391417", "0.5138652", "0.5137212", "0.5130605", "0.510307", "0.507424...
0.65404516
0
Update the sitename placeholder in .ddev/config.yaml with the directory name
protected static function updateDDevName(): void { $base = self::getBasepath(); $directories = explode('/', $base); $directoryName = array_pop($directories); $ddevConfigPath = $base . '/.ddev/config.yaml'; if (file_exists($ddevConfigPath)) { $ddevConfig = file_get_contents($ddevConfigPath); $ddevConfig = str_replace('{sitename}', $directoryName, $ddevConfig); file_put_contents($ddevConfigPath, $ddevConfig); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateConfigApp() : void\n {\n $this->domainName = Str::title(Str::lower(Str::studly($this->domainName)));\n $configAppFilePath = config_path(\"app.php\");\n $oldValue = \"/*NewDomainsServiceProvider*/\";\n $newValue = \"App\\\\\".config(\"domain.pat...
[ "0.56040007", "0.53270847", "0.5232809", "0.5228946", "0.5197544", "0.50947136", "0.506499", "0.50548595", "0.5019438", "0.49987584", "0.49904034", "0.49785993", "0.4973142", "0.4967103", "0.49667454", "0.4963577", "0.49460825", "0.49360842", "0.4933854", "0.4931945", "0.4928...
0.80105674
0
Copies the .env.example to .env if it doesn't exist
protected static function copyEnv(): void { $base = self::getBasepath(); $envPath = $base . '/.env'; $examplePath = $base . '/.env.example'; if (file_exists($examplePath) && !file_exists($envPath)) { copy($examplePath, $envPath); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createEnvFile()\n {\n if (! file_exists('.env')) {\n copy('.env.example', '.env');\n $this->line('.env file successfully created');\n }\n }", "public static function copyEnv()\n {\n // Get VCAP_APPLICATION\n $vcapsApplication = json_de...
[ "0.7551238", "0.6644462", "0.6558725", "0.6294258", "0.61804384", "0.61367", "0.61296517", "0.60745007", "0.6059287", "0.60549015", "0.6017924", "0.59529054", "0.59469897", "0.59280616", "0.5917926", "0.58679223", "0.5857066", "0.5803609", "0.57858473", "0.5783957", "0.576681...
0.8148647
0
Runs "npm install" if a package.json file is present in the project.
protected static function installNpm(): void { $basePath = self::getBasepath(); $themePath = $basePath . '/themes/default/'; if (file_exists($themePath . '/package.json')) { echo shell_exec('ddev theme install'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function installNpm()\n {\n $basePath = self::getBasepath();\n $themePath = $basePath . '/themes/default/';\n\n if (file_exists($themePath . '/package.json')) {\n $current = __DIR__;\n chdir($themePath);\n echo shell_exec('npm install');\n ...
[ "0.7334342", "0.65567833", "0.632692", "0.5848454", "0.5686467", "0.56734914", "0.5594058", "0.5585572", "0.55724037", "0.5552601", "0.53995436", "0.53933674", "0.5317014", "0.5310664", "0.5308959", "0.5298278", "0.5278894", "0.52740926", "0.5262637", "0.52132183", "0.5210076...
0.69844997
1
Removes README.md from the project.
protected static function removeReadme(): void { $basePath = self::getBasepath(); if (file_exists($basePath . '/README.md')) { unlink($basePath . '/README.md'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function removeReadme()\n {\n $basePath = self::getBasepath();\n\n if (file_exists($basePath . '/README.md')) {\n unlink($basePath . '/README.md');\n }\n }", "protected function createReadme() :void\n {\n $path = app_path('readme.md');\n\n S...
[ "0.79977196", "0.67315334", "0.61825985", "0.5848066", "0.5719331", "0.56311715", "0.54835165", "0.5389537", "0.53789705", "0.5251935", "0.5251701", "0.5218745", "0.51502585", "0.506788", "0.50622153", "0.50605273", "0.5029634", "0.500807", "0.5003002", "0.4989636", "0.498699...
0.79444027
1
Returns table locks information in the current database
function getLocks() { global $conf; if (!$conf['show_system']) $where = "AND pn.nspname NOT LIKE 'pg\\\\_%'"; else $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; $sql = "SELECT pn.nspname, pc.relname AS tablename, pl.transaction, pl.pid, pl.mode, pl.granted FROM pg_catalog.pg_locks pl, pg_catalog.pg_class pc, pg_catalog.pg_namespace pn WHERE pl.relation = pc.oid AND pc.relnamespace=pn.oid {$where} ORDER BY nspname,tablename"; return $this->selectSet($sql); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLocks();", "protected function getLockTablesQuery()\n {\n $newDbName = $this->newDbName;\n $oldDbName = $this->oldDbName;\n\n $tablesLocks = array_map(function ($table) use ($newDbName, $oldDbName) {\n return [\"{$newDbName}.{$table} WRITE\", \"{$oldDbName}.{$table}...
[ "0.7128183", "0.6891073", "0.6674592", "0.63838595", "0.63678104", "0.62678874", "0.6111381", "0.6071616", "0.60571986", "0.60114866", "0.60066295", "0.59425944", "0.58664453", "0.5799368", "0.577263", "0.57592314", "0.57064563", "0.5694649", "0.5665413", "0.5633671", "0.5626...
0.794663
0
Returns the current database encoding
function getDatabaseEncoding() { $sql = "SELECT getdatabaseencoding() AS encoding"; return $this->selectField($sql, 'encoding'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEncoding() {\n\t\treturn $this->fetchRow('PRAGMA encoding');\n\t}", "public function getEncoding()\n {\n return $this->fetchRow('PRAGMA encoding');\n }", "function getEncoding() {\n\t\treturn mysql_client_encoding($this->connection);\n\t}", "public function encoding()\n {\n ...
[ "0.82511604", "0.81630945", "0.79951113", "0.79760355", "0.787582", "0.772699", "0.7725211", "0.7709512", "0.7694289", "0.76809746", "0.7680298", "0.7680298", "0.7680298", "0.7680298", "0.7650099", "0.76317376", "0.76317376", "0.76009744", "0.76009744", "0.75444674", "0.75089...
0.88552
0
Returns the current default_with_oids setting
function getDefaultWithOid() { // 8.0 is the first release to have this setting // Prior releases don't have this setting... oids always activated return 'on'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDefaultWithOid() {\n\n\t\t$sql = \"SHOW default_with_oids\";\n\n\t\treturn $this->selectField($sql, 'default_with_oids');\n\t}", "protected function get_default() {\n\t\treturn array( 'ownerID' => 0 );\n\t}", "function get_defaultsetting() {\n return $this->defaultsetting;\n }", "public...
[ "0.8139143", "0.65943444", "0.6342786", "0.62780774", "0.61722475", "0.6169658", "0.60390615", "0.6026518", "0.60127527", "0.5982875", "0.5978619", "0.5910437", "0.5862489", "0.5839659", "0.5837869", "0.5837418", "0.58335173", "0.58161354", "0.57959735", "0.57930255", "0.5787...
0.76608455
1
Constraint functions Returns a list of all constraints on a table, including constraint name, definition, related col and referenced namespace, table and col if needed
function getConstraintsWithFields($table) { $c_schema = $this->_schema; $this->clean($c_schema); $this->clean($table); // get the max number of col used in a constraint for the table $sql = "SELECT DISTINCT max(SUBSTRING(array_dims(c.conkey) FROM '^\\\\[.*:(.*)\\\\]$')) as nb FROM pg_catalog.pg_constraint AS c JOIN pg_catalog.pg_class AS r ON (c.conrelid=r.oid) JOIN pg_catalog.pg_namespace AS ns ON (r.relnamespace=ns.oid) WHERE r.relname = '{$table}' AND ns.nspname='{$c_schema}'"; $rs = $this->selectSet($sql); if ($rs->EOF) $max_col = 0; else $max_col = $rs->fields['nb']; $sql = ' SELECT c.oid AS conid, c.contype, c.conname, pg_catalog.pg_get_constraintdef(c.oid, true) AS consrc, ns1.nspname as p_schema, r1.relname as p_table, ns2.nspname as f_schema, r2.relname as f_table, f1.attname as p_field, f1.attnum AS p_attnum, f2.attname as f_field, f2.attnum AS f_attnum, pg_catalog.obj_description(c.oid, \'pg_constraint\') AS constcomment, c.conrelid, c.confrelid FROM pg_catalog.pg_constraint AS c JOIN pg_catalog.pg_class AS r1 ON (c.conrelid=r1.oid) JOIN pg_catalog.pg_attribute AS f1 ON (f1.attrelid=r1.oid AND (f1.attnum=c.conkey[1]'; for ($i = 2; $i <= $rs->fields['nb']; $i++) { $sql.= " OR f1.attnum=c.conkey[$i]"; } $sql.= ')) JOIN pg_catalog.pg_namespace AS ns1 ON r1.relnamespace=ns1.oid LEFT JOIN ( pg_catalog.pg_class AS r2 JOIN pg_catalog.pg_namespace AS ns2 ON (r2.relnamespace=ns2.oid) ) ON (c.confrelid=r2.oid) LEFT JOIN pg_catalog.pg_attribute AS f2 ON (f2.attrelid=r2.oid AND ((c.confkey[1]=f2.attnum AND c.conkey[1]=f1.attnum)'; for ($i = 2; $i <= $rs->fields['nb']; $i++) $sql.= " OR (c.confkey[$i]=f2.attnum AND c.conkey[$i]=f1.attnum)"; $sql .= sprintf(")) WHERE r1.relname = '%s' AND ns1.nspname='%s' ORDER BY 1", $table, $c_schema); return $this->selectSet($sql); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getConstraints($tableName) {\n $constraints = DbManager::query(\"select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,\n REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE\n where table_name = '$tableName'\");\n return $...
[ "0.746639", "0.693201", "0.6890931", "0.6868531", "0.6831753", "0.6791077", "0.6779372", "0.6769578", "0.6655093", "0.6639738", "0.6578574", "0.6568467", "0.65648335", "0.655904", "0.65273464", "0.6445459", "0.635602", "0.6333815", "0.63224715", "0.6318673", "0.6258683", "0...
0.71316516
1
Sequence functions Returns all sequences in the current database
function getSequences($all = false) { $c_schema = $this->_schema; $this->clean($c_schema); if ($all) { // Exclude pg_catalog and information_schema tables $sql = "SELECT n.nspname, c.relname AS seqname, u.usename AS seqowner FROM pg_catalog.pg_class c, pg_catalog.pg_user u, pg_catalog.pg_namespace n WHERE c.relowner=u.usesysid AND c.relnamespace=n.oid AND c.relkind = 'S' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') ORDER BY nspname, seqname"; } else { $sql = "SELECT c.relname AS seqname, u.usename AS seqowner, pg_catalog.obj_description(c.oid, 'pg_class') AS seqcomment FROM pg_catalog.pg_class c, pg_catalog.pg_user u, pg_catalog.pg_namespace n WHERE c.relowner=u.usesysid AND c.relnamespace=n.oid AND c.relkind = 'S' AND n.nspname='{$c_schema}' ORDER BY seqname"; } return $this->selectSet( $sql ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_sequences()\n\t{\n\t\treturn $this->driver_query('sequence_list');\n\t}", "public function getSequences()\n {\n $main_actions = [\n 'sequence' => \\adminer\\lang('Create sequence'),\n ];\n\n $headers = [\n \\adminer\\lang('Name'),\n ];\n\n ...
[ "0.8136024", "0.7423928", "0.7077528", "0.64897966", "0.6129248", "0.60549", "0.59157425", "0.58499014", "0.5774951", "0.57231396", "0.57211506", "0.56081337", "0.55795294", "0.5522043", "0.5512508", "0.5490074", "0.54655147", "0.5461807", "0.5416555", "0.54039043", "0.533166...
0.7641541
1
This will return entity id based on email address.
public function getEntityIdByEmail($email) { $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $readresult = $read->query( 'SELECT entity_id,role_id,role_code FROM `customer_entity` ce LEFT JOIN axaltacore_user_role aur ON ce.entity_id = aur.user_id LEFT JOIN axaltacore_role ar ON aur.role_id = ar.axaltacore_role_id where ce.email = "'.$email.'" and ar.role_code="la_key_user"' ); while ($row = $readresult->fetch()) { $entityId = $row['entity_id']; } return $entityId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmailId() {\n\t\treturn $this->getData('emailId');\n\t}", "protected function userIDEmail ($email)\n {\n \n $user = Model_users::find('all', array\n (\n 'where' => array\n (\n array('email'=>$email),\n )\n ));\n if(!empty($user))\n ...
[ "0.73483413", "0.7223782", "0.72197527", "0.7193137", "0.716111", "0.71277434", "0.70311105", "0.6999079", "0.685598", "0.68531823", "0.6843078", "0.68231684", "0.68041915", "0.6756805", "0.67410135", "0.67270297", "0.67166895", "0.67041534", "0.66755015", "0.66755015", "0.66...
0.81247777
0
/ To unassign parent from User
public function unassginedUser($customerId) { $resource = Mage::getSingleton('core/resource'); $writeConnection = $resource->getConnection('core_write'); $query = 'UPDATE customer_entity SET parent_id = 0 WHERE parent_id = '. $customerId; $writeConnection->query($query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove_from_parent()\n {\n /* Cancel if there's nothing to do here */\n if (!$this->initially_was_account){\n return;\n }\n \n /* include global link_info */\n $ldap= $this->config->get_ldap_link();\n\n /* Remove and write to LDAP */\n plugin::remove_from_parent();\n\n /* ...
[ "0.67111224", "0.5984325", "0.5945639", "0.5759665", "0.5711497", "0.5686699", "0.5667659", "0.5635568", "0.5633572", "0.5625246", "0.5597532", "0.5593291", "0.55842894", "0.5563203", "0.55456454", "0.55262077", "0.5514139", "0.55074096", "0.5491041", "0.5482948", "0.5476212"...
0.6470636
1
add_filter( 'dentario_filter_importer_required_plugins','dentario_instagram_feed_importer_required_plugins', 10, 2 );
function dentario_instagram_feed_importer_required_plugins($not_installed='', $list='') { //if (in_array('instagram_feed', dentario_storage_get('required_plugins')) && !dentario_exists_instagram_feed() ) if (dentario_strpos($list, 'instagram_feed')!==false && !dentario_exists_instagram_feed() ) $not_installed .= '<br>Instagram Feed'; return $not_installed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run_blossomthemes_instagram_feed() {\r\n\r\n\t$plugin = new Blossomthemes_Instagram_Feed();\r\n\t$plugin->run();\r\n\r\n}", "function activate_blossomthemes_instagram_feed() {\r\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-blossomthemes-instagram-feed-activator.php';\r\n\tBlossomthemes_...
[ "0.66876394", "0.66649747", "0.64598954", "0.64092255", "0.6392534", "0.6348223", "0.6315788", "0.61637276", "0.6137726", "0.61215276", "0.60820097", "0.60631496", "0.6059491", "0.6058998", "0.60547125", "0.6019657", "0.59754616", "0.5973476", "0.5962512", "0.59384435", "0.59...
0.67997575
0
Fix iOS issue if this blog uses msfile rewrite. If not, this code does no harm.
private function un_ms_file_rewrite_path($url_to_file){ $basedir = wp_upload_dir(); $basedir = $basedir['basedir']; $date_folder = NULL; preg_match('#/[0-9]{4}/[0-1]{1}[0-9]{1}#', $url_to_file, $date_folder); $path_to_file = $basedir . $date_folder[0] . '/' . basename($url_to_file); //at this point, we have the full unix path to the file. This is bad on the internet. //strip the unnecessary unix stuff at the beginning and replace it with the domain name $path_to_file = strstr($path_to_file, 'wp-content'); //build the domain-based path $url_build = get_site_url(); return $url_build .'/'. $path_to_file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function fixFiles()\n {\n\n \tforeach (glob(base_path($this->passport_path) . '*.php') as $filename)\n \t{\n \t $file = file_get_contents($filename);\n \t file_put_contents($filename, str_replace($this->laravel_model, $this->mongo_model, $file));\n \t //$this->info($filename . ...
[ "0.59424436", "0.5724621", "0.571139", "0.5705128", "0.56007516", "0.55843925", "0.5566918", "0.54799926", "0.5356928", "0.52918494", "0.52160275", "0.52021396", "0.51792675", "0.5136813", "0.51321155", "0.51138586", "0.51103365", "0.5095997", "0.50830734", "0.50760764", "0.5...
0.5746252
1
Readiness check and Create Backup steps.
protected function readinessCheckAndBackup( AssertSuccessfulReadinessCheck $assertReadiness, BackupOptions $backupOptions ) { $this->readinessCheck($assertReadiness); $this->setupWizard->getReadiness()->clickNext(); $this->backup($backupOptions); $this->setupWizard->getCreateBackup()->clickNext(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n// dd('backup.create');\n $exitCode = Artisan::call('backup:run', ['--only-db'=>true]);\n return redirect()->route('backup.index');\n }", "protected function initial()\n {\n $adapter = new Local('/', LOCK_SH, Local::SKIP_LINKS);\n $local =...
[ "0.6220813", "0.6220601", "0.6089825", "0.6017322", "0.5974011", "0.59259033", "0.58765393", "0.5808511", "0.575421", "0.5747473", "0.56747955", "0.56574196", "0.56556", "0.5649466", "0.5625648", "0.5590939", "0.55859196", "0.5580922", "0.5556306", "0.5543951", "0.55151266", ...
0.7063489
0
/ v2: Return an array of custdata for the memberId. Calling script to test for ofitems in array: 0=none, >=1 if some. Return errorstring if the lookup failed. / v1: Return TRUE if the Civi membership number is known in ISC4C custdata. Return FALSE if not. Return errorstring if the lookup failed. Is there something to gain by getting some data, such a numberof persons from custdata at this point? Names for household members?
function searchIS4C($member) { global $dbConn2; $is4cMembers = array(); $sel = "SELECT CardNo, personNum, FirstName, LastName FROM custdata where CardNo = ${member};"; $rslt = $dbConn2->query("$sel"); if ( $dbConn2->errno ) { $msg = sprintf("Error: DQL failed: %s\n", $dbConn2->error); $is4cMembers[] = array($msg); return($is4cMembers); } // What is $rslt if 0 rows? Does it exist? //$n = 0; while ( $row = $dbConn2->fetch_row($rslt) ) { //$n++; $is4cMembers[] = array($row[CardNo], $row[personNum], $row[FirstName], $row[LastName]); } return($is4cMembers); // searchIS4C }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cns_cache_member_details($members)\n{\n require_code('cns_members');\n\n $member_or_list = '';\n foreach ($members as $member) {\n if ($member_or_list != '') {\n $member_or_list .= ' OR ';\n }\n $member_or_list .= 'm.id=' . strval($member);\n }\n if ($member_...
[ "0.5722052", "0.5636185", "0.5567402", "0.54970694", "0.5495408", "0.5491785", "0.5466657", "0.5400659", "0.5390302", "0.53853226", "0.53717375", "0.5355878", "0.5354773", "0.5340167", "0.53352743", "0.5290059", "0.5283923", "0.52817833", "0.52813745", "0.5279581", "0.5274399...
0.6772406
0
/ City: + tolower if ALL CAPS + Capitalize first letter of each word + Double apostrophes
function fixCity($str = "") { if ( preg_match("/[A-Z]{3}/", $str) ) { $str = strtolower($str); } $str = ucwords($str); $str = str_replace("'", "''", $str); return($str); //fixCity }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accronym($string) {\n $out = '';\n foreach (explode(' ', $string) as $value) {\n if ($value) {\n $out .= strtoupper($value[0]);\n }\n }\n return $out;\n}", "function makeTitleCase($input_title)\n {\n $input_array_of_words = explode(\" \", strtolower...
[ "0.6969585", "0.6899945", "0.6711611", "0.65355843", "0.65331244", "0.65323824", "0.6488122", "0.6426783", "0.6404989", "0.6376354", "0.63423026", "0.63273424", "0.63271356", "0.62753755", "0.6269467", "0.62544614", "0.62507164", "0.62440306", "0.6243878", "0.6205333", "0.619...
0.74844426
0
Return an array of the values from the oddnumbered elements i.e. hashname keys: 1, 3, etc. I.e. reduce the duplication of a BOTH array. Getting the evens would have the same result.
function getNameValues($row) { $values = array(); $val = ""; $n = 0; foreach ($row as $val) { // Test for odd number. // http://ca.php.net/manual/en/function.array-filter.php // Also works: //if ( ($n % 2) != 0 ) {} if ($n & 1) { $values[] = $val; //echo "$n odd: $key\n"; } else { 1; //echo "$n not-odd: $key\n"; } $n++; } return($values); //getNameValues }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evenNumbers(array $array): array\n{\n $resultArray = [];\n\n if (count($array) !== 0) {\n foreach ($array as $elementArray) {\n if (($elementArray % 2) === 0) {\n $resultArray[] = $elementArray;\n }\n }\n }\n return $resultArray;\n}", "funct...
[ "0.6245411", "0.6010292", "0.5541475", "0.5506541", "0.5460188", "0.54284096", "0.5362256", "0.53396577", "0.5330465", "0.53092116", "0.52846", "0.5278048", "0.5277437", "0.5250284", "0.5249447", "0.5221857", "0.5216014", "0.5214611", "0.5199264", "0.519908", "0.51730853", ...
0.65567416
0
If the URI starts with $needle
public function startsWith($needle) { return ($needle === '') || (0 === strpos((string)$this, $needle)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function match($uri);", "public function match ($uri);", "function startWith($haystack, $needle){\n \treturn $needle === \"\" || strpos($haystack, $needle) === 0;\n\t}", "function startsWith($haystack, $needle){\n\t\t$length = strlen($needle);\n\t\treturn (substr($haystack, 0, $length) === $needle)...
[ "0.66160685", "0.65923005", "0.6553105", "0.65521544", "0.6538332", "0.6478425", "0.641376", "0.6356798", "0.6342114", "0.63109845", "0.6304224", "0.6297337", "0.62943155", "0.6286284", "0.6279851", "0.6277959", "0.6265446", "0.62494045", "0.62271297", "0.6225131", "0.6222819...
0.6635497
0
If the URI ends with $needle
public function endsWith($needle) { return ($needle === '') || (substr((string)$this, -strlen($needle)) === $needle); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function str_endsWith (string $str, string $needle): bool {\n\t$strLen = strlen($str);\n\t$needleLen = strlen($needle);\n\treturn (substr($str, $strLen - $needleLen, $needleLen) === $needle);\n}", "function endsWith($haystack, $needle){\n $length = strlen($needle);\n return $length === 0 ||\n (substr($h...
[ "0.67159086", "0.663944", "0.6612122", "0.6581157", "0.65766317", "0.65681255", "0.65547174", "0.655125", "0.652404", "0.651618", "0.65146327", "0.6500416", "0.649843", "0.6493224", "0.6488655", "0.64760524", "0.6474933", "0.6442232", "0.6421888", "0.64060926", "0.64034575", ...
0.6722348
0
Returns if the dialog retrieved a valid result. If a valid result has already been received, this method returns true, otherwise false.
public function hasValidResult() { return ( $this->result !== null ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function checkResult() {\n\t\treturn ($this->_query_result !== false);\n\t}", "protected function _isResultValid()\n {\n if (!$this->getRequest()->getParam('result') ||\n !in_array($this->getRequest()->getParam('result'), $this->_validResults)) {\n $this->_logger->error(__(...
[ "0.7610003", "0.7455422", "0.726771", "0.7231844", "0.7221336", "0.7185457", "0.69031245", "0.68116444", "0.68116444", "0.68116444", "0.66841316", "0.66414577", "0.65968955", "0.65859735", "0.6569663", "0.6548598", "0.6537232", "0.6536151", "0.65261424", "0.64882785", "0.6442...
0.7776744
0
Append an array of child elements
public function appendChildren(array $elements) { foreach ($elements as $element) { $this->appendChild($element); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function append($node) {\n\t\tif (!is_array($node)) {\n\t\t\t$this->child[]=$node;\n\t\t} else if (is_array($node)) {\n\t\t\tfor ($childIdx=0; $childIdx<count($node); $childIdx++)\n\t\t\t\t$this->child[]=$node[$childIdx];\n\t\t}\n\t}", "function append ( $element ) {\n $this->childrenElements[] = $element;\n...
[ "0.70471627", "0.6645177", "0.64714247", "0.63536996", "0.6318185", "0.62570274", "0.6226185", "0.61726373", "0.6168356", "0.613448", "0.60892767", "0.5971514", "0.5971514", "0.59264576", "0.5910577", "0.5881004", "0.58766544", "0.5809089", "0.5737582", "0.57370627", "0.57098...
0.67076284
1
Prepare a value for output based off a schema array.
protected function prepare_value( $value, $schema ) { switch ( $schema['type'] ) { case 'string': return strval( $value ); case 'number': return floatval( $value ); case 'boolean': return (bool) $value; default: return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function prepare_value($value, $schema)\n {\n }", "public function prepValue($value)\n\t{\n\t\t$this->_convertDateTimes($value);\n\n\t\tif (is_array($value) && ($columns = $this->getSettings()->columns))\n\t\t{\n\t\t\t// Make the values accessible from both the col IDs and the handles\n\t...
[ "0.67483413", "0.6205842", "0.618068", "0.56534785", "0.554653", "0.54904425", "0.54771096", "0.5421695", "0.5328472", "0.5214461", "0.5201358", "0.5201351", "0.52000785", "0.51834923", "0.51401013", "0.51368433", "0.5066874", "0.5058589", "0.50428456", "0.5038394", "0.498215...
0.62846506
1
Get the site setting schema, conforming to JSON Schema.
public function get_item_schema() { $options = $this->get_registered_options(); $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'settings', 'type' => 'object', 'properties' => array(), ); foreach ( $options as $option_name => $option ) { $schema['properties'][ $option_name ] = $option['schema']; } return $this->add_additional_fields_schema( $schema ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function get_settings_schema() {\n\n $_schema = json_decode( wp_remote_retrieve_body( wp_remote_get( WPP_API_URL_STANDARDS . '/schema' ) ), true );\n\n return isset( $_schema['data'] ) ? $_schema['data'] : array();\n\n }", "public function getSettings() {\n $file = SETTING...
[ "0.7996044", "0.6677421", "0.6593927", "0.6385942", "0.6174305", "0.6144686", "0.6039883", "0.6017932", "0.59656686", "0.59631807", "0.5948019", "0.5907641", "0.58914", "0.58914", "0.58914", "0.58914", "0.58914", "0.58914", "0.5885717", "0.5882725", "0.5876973", "0.58548236...
0.7493372
1
Halaman List para User
public function list_user() { check_access_level_superuser(); $data = [ 'list_user' => $this->user_m->get_cabang(), 'list_cabang' => $this->data_m->get('tb_cabang') ]; $this->template->load('template2', 'user/list_user', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function userlist()\n\t{\n\t\t$data['page']='Userlist';\n\t\t$data['users_list']=$this->users->get_many_by('userlevel_id',2);\n\t\t$view = 'admin/userlist/admin_userlist_view';\n\t\techo Modules::run('template/admin_template', $view, $data);\t\n\t}", "public function userList() {\n /** @var User[] ...
[ "0.7710576", "0.76590395", "0.7579087", "0.7573508", "0.75307435", "0.75220776", "0.7499849", "0.74958277", "0.7457248", "0.74262947", "0.7386747", "0.729269", "0.7289015", "0.72821397", "0.72498786", "0.7218278", "0.71950054", "0.7181125", "0.7177128", "0.71610385", "0.71588...
0.7906442
0
Loads Model represented by $modName and $ctrlName
public function loadModel($modName, $ctrlName = '') { if (!class_exists($modName.'Model')) { if (!$ctrlName) $ctrlName = $this->ctrlName; $filename = $this->app->getModelClassFileName($modName, $ctrlName); if (!file_exists($filename)) zf::halt("No such model found \"$modName\"! at $filename"); require_once $filename; } $class = ucfirst($modName).'Model'; $mod = new $class($ctrlName, $modName, $this); $this->models[$modName] = $mod; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model($modName = null, $ctrlName = '')\n\t{\n\t\tif (!$modName) $modName = $this->ctrlName;\n if (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\tif (isset($this->models[$modName])) return $this->models[$modName];\n\t\t\n\t\t$this->loadModel($modName, $ctrlName);\n\t\treturn $this->model($mo...
[ "0.7934687", "0.7782699", "0.7741777", "0.6975137", "0.6923596", "0.6880434", "0.68387866", "0.68174314", "0.6717329", "0.6551923", "0.6425403", "0.63943905", "0.63550526", "0.6327506", "0.6289112", "0.6261731", "0.6251583", "0.6205615", "0.6176086", "0.6131433", "0.6118449",...
0.8280711
0
Returns loaded Model object represented by $modName and $ctrlName
public function model($modName = null, $ctrlName = '') { if (!$modName) $modName = $this->ctrlName; if (!$ctrlName) $ctrlName = $this->ctrlName; if (isset($this->models[$modName])) return $this->models[$modName]; $this->loadModel($modName, $ctrlName); return $this->model($modName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model($modName = '', $ctrlName = '')\n {\n return parent::model($modName, $ctrlName);\n }", "public function loadModel($modName, $ctrlName = '')\n\t{\n\t\tif (!class_exists($modName.'Model')) {\n\t\t\tif (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\t\t$filename = $this->app->getMode...
[ "0.8005318", "0.7772888", "0.75677365", "0.6486984", "0.64635754", "0.6358232", "0.63388497", "0.63196945", "0.6294006", "0.62820995", "0.62815875", "0.6276671", "0.62104774", "0.6201406", "0.6194457", "0.61726457", "0.61702365", "0.61461574", "0.6140707", "0.6138701", "0.611...
0.83249307
0
Returns form represented by $formName
protected function form($formName) { if (isset($this->forms[$formName])) return $this->forms[$formName]; zf::halt("No such form \"{$formName}\" loaded"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getForm($name)\n {\n return $this->getFormBuilder()->createBuilder($name);\n }", "public function getForm($formName)\n {\n if (!isset($this->form[$formName])) {\n $message = sprintf(\n 'Requested form \"%s\" not part of this build. Available forms:...
[ "0.76612115", "0.73769957", "0.7250387", "0.7189241", "0.71573496", "0.7138883", "0.7075898", "0.7067946", "0.70426977", "0.7030337", "0.70275545", "0.7017357", "0.7017357", "0.69855624", "0.69801784", "0.69801784", "0.69255316", "0.6913544", "0.6912028", "0.69070464", "0.687...
0.8119895
0
Not found action method for controller
protected function actionNotFound() { zf::halt("You can't call this function \"actionNotFound\" directly. You must redefine it in your controller."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionnotfound()\n {\n $this->render('notfound');\n }", "public function actionNotfound()\n {\n $this->actionSlug = 'notfound';\n $this->actionParams = [];\n $this->breadcrumbs=[];\n $this->beforeAction();\n $this->breadcrumbs[] = ['title' => 404...
[ "0.8356943", "0.8273121", "0.8070214", "0.8017735", "0.7941634", "0.784426", "0.7821098", "0.7747471", "0.7669802", "0.7664562", "0.7656013", "0.7636298", "0.7623391", "0.75673753", "0.75317514", "0.75268656", "0.7502693", "0.7497364", "0.74813926", "0.7467583", "0.74636656",...
0.83453125
1
Many to many relationship with genre model.
public function genres() { return $this->belongsToMany('App\Genre', 'genre_artist'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function genres()\n {\n return $this->belongsToMany('App\\Genre');\n }", "public function genres()\n {\n return $this->belongsToMany(Genre::class, 'genre__movies', 'movie_id', 'id');\n }", "public function genres()\n {\n return $this->belongsToMany('App\\Models\\Genre...
[ "0.82063353", "0.78325015", "0.77752", "0.7754915", "0.7650356", "0.7539934", "0.71598816", "0.71355844", "0.6953636", "0.6885664", "0.6842402", "0.66718584", "0.657852", "0.6541937", "0.6354747", "0.62195873", "0.62049276", "0.6166439", "0.61296797", "0.61159146", "0.6080682...
0.79764205
1
Replaces all valid imports with the result of the $contentReplaceFunction. The function receives the cleaned path as argument (without the quotes and the function must not add quotes).
public function replaceValidImports (string $fileContent, callable $contentReplaceFunction) : string { return \preg_replace_callback( '~url\\(\\s*(?<path>.*?)\\s*\\)~i', function (array $matches) use ($contentReplaceFunction) { return $this->ensureValidImportAndReplace($matches, $contentReplaceFunction); }, $fileContent ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function ensureValidImportAndReplace (array $matches, callable $contentReplaceFunction) : string\n {\n $path = $matches[\"path\"];\n $openingQuote = \\substr($matches[\"path\"], 0, 1);\n $closingQuote = \\substr($matches[\"path\"], -1);\n $usedQuotes = \"\";\n\n // che...
[ "0.7026493", "0.688952", "0.59473085", "0.59461015", "0.59340507", "0.5927119", "0.5904901", "0.572699", "0.56774545", "0.55368406", "0.54570633", "0.5386634", "0.52854264", "0.52719516", "0.52693266", "0.52442926", "0.523602", "0.5209371", "0.5193935", "0.5193661", "0.515291...
0.7020751
1
changes $current_path used for fixing relative paths
private function setCurrentPath(){ $dirs = explode('/', $this->pages[0]); // if last character is a / then just use it if(empty($dirs[count($dirs)-1]) || is_null($dirs[count($dirs)-1])){ $this->current_path = $this->pages[0]; // if end of path was a filename, remove it and add a / } else { array_pop($dirs); $this->current_path = implode('/', $dirs).'/'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function changePath()\n {\n chdir(base_path());\n }", "abstract public function getCurrentPath();", "function current_path()\n {\n\treturn str_replace(base_url(), '', current_url());\n }", "protected function setInitialRelativePath() {}", "private function relativePathFix($path){\n\t...
[ "0.7021977", "0.6928795", "0.6675617", "0.6667217", "0.66215587", "0.65949434", "0.6530308", "0.63362676", "0.6181536", "0.610016", "0.60529083", "0.6050394", "0.60440636", "0.60261613", "0.59632707", "0.59627086", "0.5916782", "0.5903339", "0.5897093", "0.5879897", "0.587657...
0.77386767
0
sorts entries in $links, moves entries to $pages, validates entries in $pages
private function arrayShuffle(){ // check if arrays exist before trying to use them if(isset($this->links[$this->pages[0]]) && is_array($this->links[$this->pages[0]])){ // remove duplicate values $this->links[$this->pages[0]] = array_unique($this->links[$this->pages[0]]); // find all links that are not queued or visited and add to the queue $this->pages = array_merge($this->pages, array_diff($this->links[$this->pages[0]], $this->pages, $this->visited)); // sort links sort($this->links[$this->pages[0]]); } // find all links in the queue that point to files foreach ($this->pages as $path) { if(count(explode('.', $path)) > 1){ // get the file extension $file = explode('.', $path); $qry = false; // if there's a query string, explode it to access the extension foreach ($file as $key => $value){ if (count(explode('?', $value)) > 1) { $file[$key] = explode('?', $value); $qry = $key; } } if($qry){ $type = $file[$qry][0]; } else { $type = count($file); $type = $file[$type-1]; } // remove any links that are to files NOT on the accept list (deafult: html, htm, php) if(array_search($type, $this->file_types) === false){ while($key = array_search($path, $this->pages)){ array_splice($this->pages, $key, 1); } } } if(!is_null($this->ignore_dirs)){ // loop through ignored directories, compare to the path in the link foreach ($this->ignore_dirs as $dir) { if(array_search($dir, explode('/', $path)) !== false){ while($key = array_search($path, $this->pages)){ array_splice($this->pages, $key, 1); } } } } } // add current link to $visited, remove from $pages, sort $pages $this->visited[] = $this->pages[0]; array_shift($this->pages); sort($this->pages); // if the queue is not empty, crawl again if(count($this->pages) > 0){ $this->crawl(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function sort(): void\n {\n if (!$this->dirtyIndex) {\n return;\n }\n\n $newIndex = [];\n $index = 0;\n\n foreach ($this->pages as $hash => $page) {\n $order = $page->getOrder();\n\n if (null === $order) {\n $newIndex[...
[ "0.6010659", "0.5896721", "0.5698866", "0.56682277", "0.56658876", "0.5550747", "0.55059135", "0.54730123", "0.54663306", "0.5440575", "0.54390836", "0.5438898", "0.542991", "0.5418039", "0.5403084", "0.5396782", "0.53644204", "0.53427666", "0.5336459", "0.52864057", "0.52785...
0.59011066
1
look through all files found in crawl for CSS files and parse them for images
private function parseCSS(){ // collect all unique values from the arrays in $links $css_links = array(); foreach ($this->links as $key => $paths) { foreach ($paths as $key => $value) { $css_links[] = $value; } } $css_links = array_unique($css_links); sort($css_links); // loop through all values look for files foreach ($css_links as $value) { if(count(explode('.', $value)) > 1){ $temp = explode('.', $value); $qry = false; // if a file is found, see if it has a querystring foreach ($temp as $key => $css) { if(count(explode('?', $css)) > 1){ $temp[$key] = explode('?', $css); $qry = $key; } } // if it has a query string, remove it if($qry){ $type = $temp[$qry][0]; // otherwise, just grab the extension } else { $type = count($temp); $type = $temp[$type-1]; } // check if the file extension is css if($type === 'css'){ // ensure path to file exists $path = 'http://'.$this->url.$value; if(@file_get_contents($path)){ // add file to $visited $this->visited[] = $value; // set current path for relativePathFiX() $dir = explode('/', $value); array_pop($dir); $this->current_path = implode('/', $dir).'/'; // open the file to start parsing $file = file_get_contents($path); $imgs = array(); // find all occurrences of the url() method used to include images preg_match_all("%.*url\('*(.*)[^\?]*\).*\)*%", $file, $matches); // loop through occurrences foreach ($matches[1] as $key => $img) { // check if a query string is attached to the image (used to prevent caching) if(count(explode('?', $img)) > 1){ // if there is, remove it and fix the path $temp = explode('?', $img); $imgs[] = $this->relativePathFix($temp[0]); } else { // if there isn't a query string, make sure to remove the closing bracket $temp = explode(')', $img); $imgs[] = $this->relativePathFix($temp[0]); } } // if images were found, add them to $links if(count($imgs) > 0){ $this->links[$value] = $imgs; } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findCssFiles();", "private function getImageIntoCss(): void\n {\n preg_match_all(self::REGEX_IMAGE_FORMAT, $this->sContents, $aHit, PREG_PATTERN_ORDER);\n\n for ($i = 0, $iCountHit = count($aHit[0]); $i < $iCountHit; $i++) {\n $sImgPath = PH7_PATH_ROOT . $this->sBaseUrl . $aH...
[ "0.7313089", "0.682833", "0.67335427", "0.6691646", "0.6673036", "0.6495293", "0.6486712", "0.6344852", "0.6308274", "0.6184599", "0.6152373", "0.6046938", "0.60176307", "0.5997407", "0.59607375", "0.5951366", "0.5904705", "0.58877546", "0.5876533", "0.58764654", "0.5857931",...
0.80734646
0
Create the structure for the displayed month
function mkMonth ($month) { $head = "<div class='fullwidth'>"; $head .= "<div class='month'>"; $head .= date("F", mktime(0,0,0,$month)); $head .= "</div>"; $head .= "<div id='jresult'>"; $head .= "</div>"; $head .= "<div id='week'>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Sunday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Monday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Tuesday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Wednesday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Thursday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Friday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Saturday"; $head .= "</td>"; $head .= "</table>"; $head .= "</div>"; echo $head; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function monthCreator($from,$to){\n\n$month='';\nforeach (h_many_M($from,$to) as $i) {\n\n$d = DateTime::createFromFormat('!m', $i);\n$m = $d->format('F').' '.$i;\n\n $month.=' \n<th class=\"planning_head_month\" colspan=\"28\">'.$m.'</th>\n ';\n}\necho $month;\n}", "public function get_month_permastruct()\...
[ "0.73935616", "0.7041853", "0.67926854", "0.66831195", "0.66279286", "0.6617421", "0.6536828", "0.6473009", "0.6435724", "0.6414517", "0.64120907", "0.6408968", "0.6383224", "0.63521445", "0.6348271", "0.63159007", "0.631117", "0.6222103", "0.62045795", "0.61959517", "0.61901...
0.72050965
1
Logout() Closes session and returns to login screen
public static function Logout() { Session::CloseSession(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function logOut()\n {\n self::startSession();\n session_destroy();\n }", "public function logout()\n { \n Session_activity::delete();\n \n Session_activity::delete_session();\n \n $conf = $GLOBALS['CONF'];\n $ossim_li...
[ "0.8442549", "0.8360225", "0.83082336", "0.8288833", "0.82682294", "0.8265262", "0.82278305", "0.82249373", "0.821423", "0.8210084", "0.82098794", "0.8203934", "0.82014424", "0.8174821", "0.81561655", "0.8118859", "0.81179655", "0.80941784", "0.8085273", "0.8083066", "0.80751...
0.8388605
1
Delete an individual survey submission
public function delete_survey_submission($id) { if ( isset($id) ) { $this->db->delete('vwm_surveys_submissions', array('id' => $id)); } elseif ( isset($survey_id) ) { $this->db->delete('vwm_surveys_submissions', array('survey_id' => $id)); } return $this->db->affected_rows() > 0 ? TRUE : FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testDeleteSurvey()\n {\n $survey = Survey::factory()->create();\n $surveyId = $survey->id;\n\n $response = $this->json('DELETE', \"survey/{$surveyId}\");\n\n $response->assertStatus(204);\n $this->assertDatabaseMissing('survey', ['id' => $surveyId]);\n }", ...
[ "0.704928", "0.6927132", "0.6782566", "0.67519563", "0.6743712", "0.67242193", "0.6659275", "0.6654835", "0.65483344", "0.6547482", "0.6538272", "0.6526627", "0.6492822", "0.64676714", "0.64564884", "0.6453267", "0.6381312", "0.63810337", "0.6379219", "0.6363803", "0.63554263...
0.7071134
0
Delete all survey submissions for a particular survey
public function delete_survey_submissions($survey_id) { $this->db->delete('vwm_surveys_submissions', array('survey_id' => $survey_id)); return $this->db->affected_rows() > 0 ? TRUE : FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function Delete($surveyid)\n\t{\n\t\t$surveyid = (int)$surveyid;\n\t\t$prefix = $this->Db->TablePrefix;\n\n\t\t// First Delete all Widgets Associated with the form,\n\t\t$widgets = $this->getWidgets($surveyid);\n\t\tforeach ($widgets as $key=>$widget) {\n\t\t\t\t// for each widget delete all the fields rela...
[ "0.67710656", "0.65085137", "0.65076256", "0.6371583", "0.6282924", "0.62668693", "0.61472", "0.61339176", "0.6004049", "0.5990968", "0.59772944", "0.59734684", "0.5972448", "0.5812081", "0.5793504", "0.57799935", "0.57547843", "0.5746567", "0.57342863", "0.573265", "0.570542...
0.6699532
1
Get all submissions for a given survey If completed_since is set than we will check for all surveys completed since that time. This will be used to see if the user wants to compile new results based on the new completed survey submissions.
public function get_completed_survey_submissions($id, $completed_since = NULL) { $data = array(); $this->db ->order_by('completed', 'ASC') ->where('completed IS NOT NULL', NULL, TRUE) ->where('survey_id', $id); // If completed_since is set, only grab completed submissions AFTER that date if ($completed_since != NULL) { $this->db->where('completed >=', $completed_since); } $query = $this->db->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[ $row->id ] = array( 'member_id' => (int)$row->member_id, 'survey_id' => (int)$row->survey_id, 'data' => json_decode($row->data, TRUE), 'created' => (int)$row->created, 'updated' => (int)$row->updated, 'completed' => (int)$row->completed, 'current_page' => (int)$row->current_page, 'complete' => (bool)$row->completed ); } } return $data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function all_submissions($min_status = 0) {\n\t\tif (!$this->submitable()) return array();\n\t\tstatic $query;\n\t\tDB::prepare_query($query,\n\t\t\t\"SELECT * FROM `submission`\".\n\t\t\t\" WHERE `entity_path` = ? AND `status` >= ?\".\n\t\t\t\" ORDER BY `time` ASC\"\n\t\t);\n\t\t$query->execute(array($this->path(...
[ "0.5996727", "0.5936609", "0.54508674", "0.5380265", "0.5299355", "0.52664226", "0.51739275", "0.51614606", "0.5112784", "0.50744545", "0.50663435", "0.5055705", "0.50379115", "0.50034606", "0.49738628", "0.4944428", "0.49141344", "0.48513246", "0.48392534", "0.48335564", "0....
0.6841735
0
Get all survey submissions (but allow for a search filter)
public function get_survey_submissions($filters, $order_by = 'updated', $order_by_order = 'DESC') { $data = array(); $order_by = in_array($order_by, array('id', 'member_id', 'survey_id', 'created', 'updated', 'completed', 'complete')) ? $order_by : 'updated'; $order_by_order = in_array($order_by_order, array('ASC', 'DESC', 'RANDOM')) ? $order_by_order : 'DESC'; $this->db->order_by($order_by, $order_by_order); // Filter survey ID if ( isset($filters['survey_id']) AND $filters['survey_id']) { $this->db->where('survey_id', $filters['survey_id']); } // Filter member ID if ( isset($filters['member_id']) AND $filters['member_id']) { $this->db->where('member_id', $filters['member_id']); } // Filter group ID if ( isset($filters['group_id']) AND $filters['group_id']) { $this->db->join('members', 'members.member_id = vwm_surveys_submissions.member_id'); $this->db->where('group_id', $filters['group_id']); } // If a valid created from date was provided if ( isset($filters['created_from']) AND strtotime($filters['created_from']) ) { // If a valid created to date was provided as well if ( isset($filters['created_to']) AND strtotime($filters['created_to']) ) { /** * Add one day (86400 seconds) to created_to date * * If user is searching for all surveys created from 1/1/2000 to * 1/1/2000 it should show all surveys created on 1/1/2000. */ $this->db->where( '`created` BETWEEN ' . strtotime($filters['created_from']) . ' AND ' . (strtotime($filters['created_to']) + 86400), NULL, FALSE ); } // Just a created from date was provided else { $this->db->where( 'created >=', strtotime($filters['created_from']) ); } } // If a valid updated from date was provided if ( isset($filters['updated_from']) AND strtotime($filters['updated_from']) ) { // If a valid updated to date was provided as well if ( isset($filters['updated_to']) AND strtotime($filters['updated_to']) ) { /** * Add one day (86400 seconds) to updated_to date * * If user is searching for all surveys updated from 1/1/2000 to * 1/1/2000 it should show all surveys updated on 1/1/2000. */ $this->db->where( '`updated` BETWEEN ' . strtotime($filters['updated_from']) . ' AND ' . (strtotime($filters['updated_to']) + 86400), NULL, FALSE ); } // Just a updated from date was provided else { $this->db->where( 'updated >=', strtotime($filters['updated_from']) ); } } // Filter completed if ( isset($filters['complete']) AND $filters['complete'] !== NULL) { // Show completed subissions if ($filters['complete']) { $this->db->where('completed IS NOT NULL', NULL, TRUE); } // Show incomplete submissions else { $this->db->where('completed IS NULL', NULL, TRUE); } } $query = $this->db->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[ (int)$row->id ] = array( 'id' => (int)$row->id, 'hash' => $row->hash, 'member_id' => (int)$row->member_id, 'survey_id' => (int)$row->survey_id, 'created' => (int)$row->created, 'updated' => (int)$row->updated, 'completed' => (int)$row->completed, 'complete' => (bool)$row->completed ); } } return $data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSurveys() {\n return $this->_request(\n \"surveys/\"\n );\n }", "function getAll() {\r\n\t\treturn SurveyAnswerQuery::create()->find();\r\n\t}", "public function __invoke(): Collection|array\n {\n return Survey::all();\n }", "function all_submission...
[ "0.64325094", "0.64244294", "0.61194974", "0.60658884", "0.60614973", "0.59773904", "0.5884745", "0.58226883", "0.581804", "0.5790863", "0.5789288", "0.5775172", "0.57700557", "0.5765209", "0.5763232", "0.5725316", "0.57097596", "0.56432366", "0.5620622", "0.56064343", "0.559...
0.64346766
0
Get all surveys completed or in progress by the current user If a member ID is set, use that. If submission hashes are found, use those. Save results to user_submissions property.
private function get_user_submissions($submission_hahses) { self::$user_submissions = array(); $member_id = $this->session->userdata('member_id'); // Make sure we have a member ID or some submission hashes to check if ( $member_id OR $submission_hahses ) { // If we have a member ID if ($member_id) { $this->db ->where('member_id', $member_id) ->or_where_in('hash', $submission_hahses ? $submission_hahses : ''); // CI does not like an empty array } // If we only have submission hashes else { $this->db->where_in('hash', $submission_hahses); } $query = $this->db ->order_by('completed, updated, created', 'DESC') ->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { // Loop through each submission foreach ($query->result() as $row) { // First key is either "completed" or "progress", second is survey ID, and value is the submission hash self::$user_submissions[ $row->completed ? 'complete' : 'progress' ][ $row->survey_id ] = $row->hash; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function user_submissions_progress($submission_hahses)\n\t{\n\t\t// If user submissions have not yet been gathered\n\t\tif (self::$user_submissions == NULL) { $this->get_user_submissions($submission_hahses); }\n\n\t\t// If we have some surveys in progress return an array of their hashes\n\t\treturn isset(se...
[ "0.58979917", "0.5864403", "0.56491774", "0.5584163", "0.5540704", "0.5500674", "0.54719305", "0.5454758", "0.5414054", "0.53811324", "0.5347915", "0.5323728", "0.52780086", "0.52272236", "0.5170256", "0.51539874", "0.5069158", "0.50341356", "0.49852288", "0.49704343", "0.493...
0.6154837
0
Check an array of submission hashes to see if it marks a completed survey
public function is_complete_by_hashes($survey_id, $submission_hashes) { $query = $this->db ->where('survey_id', $survey_id) ->where('completed IS NOT NULL', NULL, TRUE) ->where_in('hash', $submission_hashes) ->limit(1) ->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { return TRUE; } else { return FALSE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function is_progress_by_hashes($survey_id, $submission_hashes)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NULL', NULL, TRUE)\n\t\t\t->where_in('hash', $submission_hashes)\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_s...
[ "0.6178807", "0.59711295", "0.5959456", "0.5868236", "0.5860308", "0.5852881", "0.57966447", "0.574047", "0.56483114", "0.55511385", "0.55195135", "0.5517042", "0.5457055", "0.54339623", "0.5426887", "0.54228735", "0.54208577", "0.5354125", "0.5342349", "0.533848", "0.5335340...
0.6854474
0
Check an array of submission hashes to see if the current user has any progress in this survey
public function is_progress_by_hashes($survey_id, $submission_hashes) { $query = $this->db ->where('survey_id', $survey_id) ->where('completed IS NULL', NULL, TRUE) ->where_in('hash', $submission_hashes) ->order_by('updated', 'DESC') ->limit(1) ->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { $row = $query->row(); return $row->hash; } else { return FALSE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function is_progress($survey_id)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NULL', NULL, TRUE)\n\t\t\t->where('member_id', $this->session->userdata('member_id'))\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submission...
[ "0.6453063", "0.63572836", "0.62184566", "0.614686", "0.5964588", "0.5960737", "0.58579767", "0.57735705", "0.5769345", "0.5744846", "0.57434314", "0.57242435", "0.56118435", "0.5611202", "0.5591954", "0.5563764", "0.55606085", "0.54936224", "0.54547346", "0.5449678", "0.5419...
0.66446465
0
Imports a checkbox header i.e. a field's declaration.
protected function process_header_checkbox(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_checkbox_row( string $label, string $key, bool $checked = false ): void {\n\twp_enqueue_style( 'wpinc-meta-field' );\n\t?>\n\t<div class=\"wpinc-meta-field-single checkbox\">\n\t\t<label>\n\t\t\t<span class=\"checkbox\"><input <?php name_id( $key ); ?> type=\"checkbox\" <?php echo esc_attr( $checke...
[ "0.63695353", "0.5883379", "0.58809394", "0.58807844", "0.57226795", "0.57156914", "0.57071275", "0.5695699", "0.56633687", "0.5649122", "0.5549496", "0.5474228", "0.5473855", "0.5447326", "0.54225916", "0.5406645", "0.5400897", "0.53399295", "0.5336694", "0.53366834", "0.532...
0.6030131
1
Imports a date header i.e. a field's declaration.
protected function process_header_date(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function parseDate(object $header): void {\n\n if (property_exists($header, 'date')) {\n $date = $header->date;\n\n if (preg_match('/\\+0580/', $date)) {\n $date = str_replace('+0580', '+0530', $date);\n }\n\n $date = trim(rtrim($date));\n ...
[ "0.62307817", "0.591231", "0.5634141", "0.5621257", "0.55200434", "0.547975", "0.54533225", "0.5449354", "0.5261206", "0.5159231", "0.5139352", "0.50846297", "0.50423723", "0.5041895", "0.50371337", "0.5035094", "0.4972689", "0.49478891", "0.49268717", "0.49260876", "0.491950...
0.6072167
1
Imports a number header i.e. a field's declaration.
protected function process_header_number(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function min_headings_num() {\n\t\t$this->section_data['general_min_headings_num'] = array(\n\t\t\t'name' \t\t\t\t\t=> 'general_min_headings_num',\n\t\t\t'label' \t\t\t\t=> __( 'Display TOC when', 'fixedtoc' ),\n\t\t\t'default' \t\t\t=> '',\n\t\t\t'type' \t\t\t\t\t=> 'number',\n\t\t\t'input_attrs'\t\t=> ar...
[ "0.51880145", "0.5137977", "0.5004235", "0.49478108", "0.49266407", "0.48821086", "0.4875254", "0.4813329", "0.48021185", "0.4799113", "0.47685233", "0.46652612", "0.46492574", "0.46343297", "0.46296328", "0.46275207", "0.46213627", "0.45985338", "0.45579165", "0.455238", "0....
0.6226848
0
Imports a radiobutton header i.e. a field's declaration.
protected function process_header_radiobutton(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function createCheckboxRadio($input, $name) {\n include $_SERVER[\"DOCUMENT_ROOT\"] . \"/mvdv/core/view/templates/general/form/formelements/radiocheckbox.php\";\n }", "public static function renderRadio();", "public function defineHeaderButton(){\r\n $this->addnewctrl='';\r\n $thi...
[ "0.5305672", "0.51929915", "0.5192559", "0.517536", "0.517536", "0.517536", "0.517536", "0.517536", "0.51236653", "0.5028674", "0.49931952", "0.4927494", "0.4910817", "0.49040562", "0.48878166", "0.488666", "0.48583576", "0.48304302", "0.48169217", "0.4809677", "0.4804556", ...
0.5901773
0
Imports a text header i.e. a field's declaration.
protected function process_header_text(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $autolink = true); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function statementHeader(string $text): void\n {\n }", "function setHeaderText($value) {\n $this->header_text = $value;\n}", "private function _header($text){\n echo '[*] ' . $text . PHP_EOL;\n }", "function import_text( $text ) {\r\n // quick sanity check\r\n if (e...
[ "0.6034784", "0.58935195", "0.56245434", "0.55620503", "0.5527571", "0.5523644", "0.5466935", "0.5460304", "0.5458527", "0.54272413", "0.54262334", "0.5407933", "0.54028666", "0.53963476", "0.53871566", "0.5360135", "0.53181714", "0.53011644", "0.52995664", "0.5290824", "0.52...
0.6070688
0
Imports a textarea header i.e. a field's declaration.
protected function process_header_textarea(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); $result->param2 = 60; $result->param3 = 35; $result->param4 = 1; global $DB; $DB->update_record('data_fields', $result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function createTextArea($input, $name) {\n include $_SERVER[\"DOCUMENT_ROOT\"] . \"/mvdv/core/view/templates/general/form/formelements/textarea.php\";\n }", "function bfa_add_html_inserts_header() {\r\n\tglobal $bfa_ata;\r\n\tif( $bfa_ata['html_inserts_header'] != '' ) bfa_incl('html_inse...
[ "0.5486219", "0.54106927", "0.5353058", "0.5314122", "0.5278608", "0.525247", "0.51403344", "0.5138327", "0.5132187", "0.51316994", "0.5102319", "0.51012313", "0.50904256", "0.50699586", "0.5052026", "0.5043884", "0.5042542", "0.50385123", "0.5025942", "0.5023656", "0.5021118...
0.5842437
0
PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY Process and import the body i.e. content of the table. Parses the table and calls the specialized import method based on the field's type.
protected function process_body(import_settings $settings, $data, $fields) { $doc = $settings->get_dom(); $list = $doc->getElementsByTagName('tbody'); $body = $list->item(0); $rows = $body->getElementsByTagName('tr'); foreach ($rows as $row) { $data_record = $this->get_data_record($data); //do not create datarecord if there are no rows to import $index = 0; $cells = $row->getElementsByTagName('td'); foreach ($cells as $cell) { $field = $fields[$index]; $type = $field->type; $f = array($this, 'process_data_' . $type); if (is_callable($f)) { call_user_func($f, $settings, $field, $data_record, $cell); } else { $this->process_data_default($settings, $field, $data_record, $cell); } $index++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function prepareImportContent();", "public function doImport() \n\t{ \n\t // first save the import object in the database\n $this->status = self::STATUS_IN_PROGRESS_IMPORT;\n $this->item_count = $this->getItemCount();\n\t $this->save(); \n\t \t \n\t // add an import object\n\t...
[ "0.6050659", "0.601217", "0.59888643", "0.59820735", "0.5856395", "0.5741842", "0.57190835", "0.55667895", "0.55624694", "0.55112386", "0.55014026", "0.54888356", "0.54544675", "0.5453983", "0.54128957", "0.5410939", "0.5394443", "0.53521615", "0.533543", "0.5309772", "0.5283...
0.63890934
0
On first call creates as data_record record used to link data object with its content. On subsequent calls returns the previously created record.
protected function get_data_record($data) { if ($this->_data_record) { return $this->_data_record; } global $USER, $DB; $this->_data_record = new object(); $this->_data_record->id = null; $this->_data_record->userid = $USER->id; $this->_data_record->groupid = 0; $this->_data_record->dataid = $data->id; $this->_data_record->timecreated = $time = time(); $this->_data_record->timemodified = $time; $this->_data_record->approved = true; $this->_data_record->id = $DB->insert_record('data_records', $this->_data_record); return $this->_data_record->id ? $this->_data_record : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addRecord()\n {\n $rec = new Record($this, true);\n $rec->markForInsert();\n $this->records[] = $rec;\n return $rec;\n }", "public function create($data)\n {\n try {\n $record = $this->model->create($data);\n } catch (\\Exception $e) {...
[ "0.6830509", "0.66752625", "0.65268564", "0.63946795", "0.6298123", "0.6273325", "0.61721206", "0.6119108", "0.6106025", "0.6050434", "0.6050434", "0.6048353", "0.6044807", "0.59401137", "0.59214187", "0.58682567", "0.5797092", "0.5792165", "0.57628447", "0.57008016", "0.5700...
0.7404586
0
Method for importing a checkbox data cell.
protected function process_data_checkbox(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_checkbox_row( string $label, string $key, bool $checked = false ): void {\n\twp_enqueue_style( 'wpinc-meta-field' );\n\t?>\n\t<div class=\"wpinc-meta-field-single checkbox\">\n\t\t<label>\n\t\t\t<span class=\"checkbox\"><input <?php name_id( $key ); ?> type=\"checkbox\" <?php echo esc_attr( $checke...
[ "0.55346096", "0.5344551", "0.5191674", "0.51886994", "0.518288", "0.5171274", "0.51545525", "0.50641865", "0.5053339", "0.50150746", "0.5008626", "0.48653644", "0.48485696", "0.4838679", "0.4827591", "0.48134705", "0.48091918", "0.48020542", "0.48018435", "0.47888786", "0.47...
0.55580056
0
Method for importing a number data cell.
protected function process_data_number(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testCellsImportDataIntArray()\n {\n $book1 = \"Book1.xlsx\";\n $mydoc = \"myDocument.xlsx\";\n $ImportOption = \"ImportOption\";\n\n $data = new ImportIntArrayOption();\n $data->setDestinationWorksheet('Sheet1');\n $data->setFirstColumn(1);\n $dat...
[ "0.5837573", "0.53284067", "0.52543306", "0.5202485", "0.5182147", "0.51563007", "0.5153926", "0.5122473", "0.5105191", "0.5067507", "0.5045524", "0.50338566", "0.5031159", "0.5026738", "0.50197023", "0.50055516", "0.4991452", "0.49911588", "0.49648672", "0.4929456", "0.49221...
0.5444547
1
Method for importing a radiobutton data cell.
protected function process_data_radiobutton(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function process_header_radiobutton(import_settings $settings, $data, $name, $description, $options) {\r\n $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options);\r\n return $result;\r\n }", "public function import()\n\...
[ "0.51157725", "0.47869363", "0.4668854", "0.46299484", "0.45710236", "0.45428073", "0.45386532", "0.45222545", "0.45018837", "0.4486966", "0.44613567", "0.44118488", "0.4400204", "0.43842605", "0.43669873", "0.43482393", "0.43444", "0.43307984", "0.43288007", "0.43213406", "0...
0.5347019
0
Method for importing a textarea data cell.
protected function process_data_textarea(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value, true); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function convert_textarea_field() {\n\n\t\t// Create a new Textarea field.\n\t\tself::$field = new GF_Field_Textarea();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add Textarea specific properties.\n\t\tself::$field->useRichTextEditor = rgar( self::$nf_field, 't...
[ "0.5420207", "0.524603", "0.5194765", "0.5126707", "0.51193887", "0.51129174", "0.5090459", "0.5061626", "0.5016948", "0.50030977", "0.49657747", "0.49424002", "0.48762652", "0.4853857", "0.48512346", "0.48473266", "0.48277137", "0.48229995", "0.4812099", "0.48112962", "0.480...
0.56925595
0
Returns the context used to store files. On first call construct the result based on $mod. On subsequent calls return the cached value.
protected function get_context($mod=null) { if ($this->_context) { return $this->_context; } global $DB; $module = $DB->get_record('modules', array('name' => 'data'), '*', MUST_EXIST); $cm = $DB->get_record('course_modules', array('course' => $mod->course, 'instance' => $mod->id, 'module' => $module->id), '*', MUST_EXIST); $this->_context = get_context_instance(CONTEXT_MODULE, $cm->id); return $this->_context; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _context()\n {\n return $this->_file()->context;\n }", "function frmget_context() {\n\tglobal $CFG, $DB;\n //include this file for content /libdir/filelib.php\n return $systemcontext = context_system::instance();\t\n}", "public static function context() {\n\t\treturn self::g...
[ "0.64674646", "0.6071938", "0.5815943", "0.56743664", "0.5604517", "0.54792696", "0.5473542", "0.5459495", "0.5439038", "0.54256904", "0.54256904", "0.54256904", "0.54256904", "0.54256904", "0.5416612", "0.53899765", "0.5358736", "0.5349171", "0.5308736", "0.5301935", "0.5298...
0.6363582
1
Fetch first child of $el with class name equals to $name and returns all li in an array.
protected function read_list($el, $name) { $result = array(); $list = $el->getElementsByTagName('div'); foreach ($list as $div) { if (strtolower($div->getAttribute('class')) == $name) { $lis = $el->getElementsByTagName('li'); foreach ($lis as $li) { $result[] = trim(html_entity_decode($this->get_innerhtml($li))); } } } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function read($el, $name, $default = '') {\r\n $list = $el->getElementsByTagName('div');\r\n foreach ($list as $div) {\r\n if (strtolower($div->getAttribute('class')) == $name) {\r\n $result = $this->get_innerhtml($div);\r\n $result = str_ireplace('<...
[ "0.61263555", "0.56702036", "0.5652199", "0.5628246", "0.55545205", "0.54151684", "0.5303527", "0.52979654", "0.52324617", "0.5228412", "0.5225914", "0.51862645", "0.5164076", "0.5162426", "0.5157026", "0.5079374", "0.5076307", "0.50721323", "0.5065997", "0.501336", "0.499664...
0.7723638
0
Fetch first child of $el with class name equals to $name and returns its inner html. Returns $default if no child is found.
protected function read($el, $name, $default = '') { $list = $el->getElementsByTagName('div'); foreach ($list as $div) { if (strtolower($div->getAttribute('class')) == $name) { $result = $this->get_innerhtml($div); $result = str_ireplace('<p>', '', $result); $result = str_ireplace('</p>', '', $result); return $result; } } return $default; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFirstChildByName($name) {\n foreach($this->__childs as $child) {\n if ($child->getName() == $name) {\n return $child;\n }\n }\n return null; \n }", "public function get($name) {\n\t\tif( isset($...
[ "0.6228843", "0.57680947", "0.566378", "0.56176656", "0.55473787", "0.54208755", "0.54067624", "0.5387862", "0.532956", "0.5317605", "0.5308805", "0.52735484", "0.52621186", "0.5230969", "0.5207049", "0.5177255", "0.5170779", "0.5135536", "0.5127617", "0.51206994", "0.5076852...
0.76925004
0
/ Update user vendor
public function updateVendor() { try { if (!($this->vendor instanceof Base_Model_ObtorLib_App_Core_Catalog_Entity_Vendor)) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception(" Vendor Entity not initialized"); } else { $objVendor = new Base_Model_ObtorLib_App_Core_Catalog_Dao_Vendor(); $objVendor->vendor = $this->vendor; return $objVendor->updateVendor(); } } catch (Exception $ex) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception($ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update($vendor);", "public function update_vendor($id, $data)\n\t{\n\t\t// Unset, if neccessary\n\t\tif ($data['api_id'] == '0')\n\t\t\t$data['api_id'] = NULL;\n\t\t\n\t\tif (empty($data['orderemail']))\n\t\t\t$data['orderemail'] = NULL;\n\t\t\t\n\t\tif (empty($data['ordername']))\n\t\t\t$data['o...
[ "0.77089745", "0.678249", "0.6584451", "0.6425409", "0.6245101", "0.62318724", "0.62134546", "0.6159758", "0.6158834", "0.6122324", "0.6108975", "0.60946953", "0.602808", "0.59663606", "0.59483075", "0.59092873", "0.59023994", "0.58952296", "0.5860157", "0.5858423", "0.584987...
0.713382
1
/ Search user vendors....
public function search() { try { if (!($this->vendor instanceof Base_Model_ObtorLib_App_Core_Catalog_Entity_Vendor)) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception(" Vendor Entity not initialized"); } else { $objVendor = new Base_Model_ObtorLib_App_Core_Catalog_Dao_Vendor(); $objVendor->vendor = $this->vendor; return $objVendor->search(); } } catch (Exception $ex) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception($ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getActiveVendors() {\n $this->resetResponse();\n if ($this->ci->session->userdata('user_id') != null) {\n $archived = $this->ci->input->post('archived', true);\n\n $result = $this->model->getActiveVendors('*', array(\"person_type\" => Globals::PERSON_TYPE_VENDOR, \"per...
[ "0.6522265", "0.64070505", "0.63639617", "0.62607735", "0.62493575", "0.62388426", "0.6212094", "0.6181377", "0.6116254", "0.6110841", "0.6058671", "0.6051379", "0.6045634", "0.603381", "0.6016279", "0.60091215", "0.5976708", "0.5961105", "0.5955323", "0.592257", "0.589258", ...
0.6957608
0
Display a listing of the Uploads.
public function index() { $module = Module::get('Uploads'); if(Module::hasAccess($module->id)) { return View('la.uploads.index', [ 'show_actions' => $this->show_action, 'listing_cols' => $this->listing_cols, 'module' => $module ]); } else { return redirect(config('laraadmin.adminRoute')."/"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function index() {\n $this->data['title'] = \"Uploads\";\n $viewContent = $this->load->view('uploads/index', $this->data, true);\n renderWithLayout(array('content' => $viewContent), 'admin');\n }", "public function index()\n {\n $uploads=Auth::guard('team')->user()->uploa...
[ "0.69382066", "0.6876522", "0.6749682", "0.6725907", "0.6721007", "0.6666607", "0.6666607", "0.6640795", "0.66351545", "0.66273767", "0.6605901", "0.65982366", "0.6577865", "0.65707296", "0.6520642", "0.65011615", "0.64765644", "0.63927686", "0.6379982", "0.63731706", "0.6365...
0.71702826
1
Update Uploads Public Visibility
public function update_public() { if(Module::hasAccess("Uploads", "edit")) { $file_id = Input::get('file_id'); $public = Input::get('public'); if(isset($public)) { $public = true; } else { $public = false; } $upload = Upload::find($file_id); if(isset($upload->id)) { if($upload->user_id == Auth::user()->id || Entrust::hasRole('SUPER_ADMIN')) { // Update Caption $upload->public = $public; $upload->save(); return response()->json([ 'status' => "success" ]); } else { return response()->json([ 'status' => "failure", 'message' => "Unauthorized Access 1" ]); } } else { return response()->json([ 'status' => "failure", 'message' => "Upload not found" ]); } } else { return response()->json([ 'status' => "failure", 'message' => "Unauthorized Access" ]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update_public()\n {\n\t\tif(Module::hasAccess(\"Uploads\", \"edit\")) {\n\t\t\t$file_id = Input::get('file_id');\n\t\t\t$public = Input::get('public');\n\t\t\t\n\t\t\t\n\t\t\t$upload = Upload::find($file_id);\n\t\t\tif(isset($upload->id)) {\n\t\t\t\tif($upload->user_id == Auth::user()->id || Ent...
[ "0.7433434", "0.697364", "0.6724741", "0.6699069", "0.6688663", "0.6155418", "0.6049058", "0.6047401", "0.60376936", "0.5982526", "0.57420754", "0.5724763", "0.57083505", "0.56794137", "0.56685036", "0.56627905", "0.56376064", "0.5635653", "0.56148225", "0.56059617", "0.55955...
0.7411745
1
Test that the sanitized css matches a known good version
public function test_css_was_sanitized() { $unsanitized_css = file_get_contents( __DIR__ . '/unsanitized.css' ); $known_good_sanitized_css = file_get_contents( __DIR__ . '/sanitized.css' ); $maybe_sanitized_css = sanitize_unsafe_css( $unsanitized_css ); $this->assertEquals( $maybe_sanitized_css, $known_good_sanitized_css ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function safecss_filter_attr($css, $deprecated = '')\n {\n }", "function cleanStyleInformation($string) {\r\n\t\t$string = str_replace('&nbsp;', ' ', $string);\r\n\t\t$string = str_replace('&quot;', \"'\", $string);\r\n\t\t$string = ReTidy::decode_for_DOM_character_entities($string);\r\n\t\t/* // 2011-11-2...
[ "0.62958", "0.61226946", "0.6118173", "0.6066739", "0.6029883", "0.5999646", "0.5948778", "0.59352994", "0.5889052", "0.57163066", "0.55703104", "0.5520725", "0.55170554", "0.54799986", "0.54263294", "0.53980327", "0.53788733", "0.5351177", "0.53320503", "0.5310577", "0.52976...
0.8243286
0
this creates the divs for the summary fields
function createSummaryDivs($numRows, $groupType) { for ($i = 1; $i <= $numRows; $i++) { $divs .= "<div id=\"$i$groupType\"></div>\n"; } return $divs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function buildPaneSummary();", "function show() {\n global $post;\n \t\t/**\n\t\t * Use nonce for verification.\n\t\t */\n echo '<input type=\"hidden\" name=\"weddingvendor_meta_box_nonce\" value=\"', wp_create_nonce(basename(__FILE__)), '\" />';\n echo '<table class=\"form-table\">...
[ "0.59962493", "0.59763706", "0.58714974", "0.5822382", "0.5802656", "0.57680917", "0.573524", "0.5723683", "0.56696504", "0.56693673", "0.5666097", "0.5644782", "0.5620018", "0.5618954", "0.55702794", "0.5554211", "0.5536003", "0.55055", "0.5488495", "0.5485995", "0.548042", ...
0.6125534
0
Returns whether this plugin is running on a test system or the production system.
public function is_test_environment() { if(empty($this->production_site_url)) return true; else return get_site_url() === $this->production_site_url ? false : true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isTest() : bool\n\t{\n\t\treturn $this->productionTest;\n\t}", "public function isProd() {\n\t\tif ($this->checkEnv(array('prod', 'product', 'production'))) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public static function isDev() {\n // Acquia.\n if (defined('AH_SITE_ENVIRON...
[ "0.77510166", "0.76399803", "0.7498758", "0.7489189", "0.73803633", "0.7375103", "0.7369261", "0.73560923", "0.73511416", "0.728489", "0.7228609", "0.71942675", "0.7176972", "0.7143329", "0.71116257", "0.7090879", "0.70895076", "0.7072677", "0.7005752", "0.70015776", "0.69697...
0.76479644
1
Modify the css if we are in a test environment to make the website look ugly to avoid confusion. To be added to the 'wp_head' and 'admin_head' action.
public function modify_css_if_in_test_environment() { if($this->is_test_environment()) echo '<style>div#wpadminbar {background-color: #49cf44;}</style>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attach_custom_css_filter() {\n\tif ( ! is_admin() && ! is_feed() && ! is_robots() && ! is_trackback() ) {\n\t\tglobal $publishthis;\n\n\t\tif( is_singular() ) echo $publishthis->utils->display_css();\n\t}\n}", "private function set_styles()\n {\n\n if (count($this->assets_css['global']) > 0)\n...
[ "0.64123803", "0.6364427", "0.634668", "0.6344194", "0.6244267", "0.62112933", "0.6184165", "0.617153", "0.6154084", "0.61347914", "0.6115918", "0.61113024", "0.6109064", "0.6083221", "0.6071445", "0.60558105", "0.6034255", "0.60268146", "0.6019083", "0.6017077", "0.5979238",...
0.826032
0
Returns a filename that is unique in the given directory. This fuction is based on wp_unique_filename() from but it treats .tar.gz as a single extension.
public function unique_filename_callback( $dir, $filename, $ext ) { $ext = mb_strtolower($ext); if($ext === '.gz' && mb_substr($filename, -7) === '.tar.gz' ) $ext = '.tar.gz'; $number = ''; while ( file_exists( $dir . "/$filename" ) ) { $new_number = (int) $number + 1; if ( '' === "$number$ext" ) { $filename = "$filename-" . $new_number; } else { $filename = str_replace( array( "-$number$ext", "$number$ext" ), "-" . $new_number . $ext, $filename ); } $number = $new_number; } return $filename; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generate_unique_file_name($dir, $filename)\n{\n if (!$filename)\n return;\n \n $extension = pathinfo($filename, PATHINFO_EXTENSION);\n\n $new_filename = '';\n for (;;)\n {\n $new_filename = get_random_string(8, 8) . '.' . $extension;\n if (!file_exists($dir . '/' . ...
[ "0.77655303", "0.767303", "0.7602459", "0.75815725", "0.74350446", "0.74350446", "0.74350446", "0.74350446", "0.74350446", "0.74350446", "0.73986477", "0.7397706", "0.7242553", "0.72255135", "0.71434987", "0.70677674", "0.7001081", "0.6945939", "0.6924418", "0.6850468", "0.68...
0.7734731
1
Download a file to the WordPress media library. $mime_type and $extension are optional, if set to something empty() they are guessed form the download file, where the extension is guessed based on the mime type. If the mime type is provided and the downloaded file does not actually have that mime type, an error is returned.
public function download_to_media_library( $url, $filename, $extension, $mime_type, $parent_post_id ) { $extension = ltrim($extension, '.'); // Gives us access to the download_url() and wp_handle_sideload() functions require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/image.php' ); $timeout_seconds = 20; // Download file to temp dir $temp_file = download_url( $url, $timeout_seconds ); if ( !is_wp_error( $temp_file ) ) { $finfo = finfo_open(FILEINFO_MIME_TYPE); $actual_mime_type = finfo_file($finfo, $temp_file); finfo_close($finfo); if( empty($mime_type) ) { $mime_type = $actual_mime_type; } elseif($mime_type !== $actual_mime_type) return array( 'error' => "Instead of the mime type " . $mime_type . " we were expecting, the remote server provided a file of mime type " . $actual_mime_type ); if (empty($extension)) { if( preg_match('#text/.*tex#u', $mime_type) ) $extension = 'tex'; else if( preg_match('#application/.*(tar|gz|gzip)#u', $mime_type) ) $extension = 'tar.gz'; else if( preg_match('#application/.*pdf#u', $mime_type) ) $extension = 'pdf'; else $extension = 'unknown'; } $filename = $filename . '.' . $extension; // Array based on $_FILE as seen in PHP file uploads $file = array( 'name' => $filename, 'type' => $mime_type, 'tmp_name' => $temp_file, 'error' => 0, 'size' => filesize($temp_file), ); $overrides = array( // Tells WordPress to not look for the POST form // fields that would normally be present as // we downloaded the file from a remote server, so there // will be no form fields // Default is true 'test_form' => false, // Setting this to false lets WordPress allow empty files, not recommended // Default is true 'test_size' => true, // for .tar.gz files normally only .gz is treated as the extension, so that // when file.tar.gz already exists the file is uploaded as file.tar-1.gz but // we want the propper file-1.tar.gz 'unique_filename_callback' => array($this, 'unique_filename_callback'), ); // Move the temporary file into the uploads directory $results = wp_handle_sideload( $file, $overrides ); if ( !empty( $results['error'] ) ) { return array( 'error' => "Failed to put file " . $file['name'] . " of mime type " . $file['type'] . " into uploads directory because Wordpress said: " . $results['error'] ); } else { $filepath = $results['file']; // Full path to the file // Prepare an array of post data for the attachment. $attachment = array( 'guid' => $filepath, 'post_mime_type' => $mime_type, 'post_title' => $filename, 'post_content' => '', 'post_status' => 'inherit' ); // Insert the attachment. $attach_id = wp_insert_attachment( $attachment, $filepath, $parent_post_id ); // Generate the metadata for the attachment, and update the database record. $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); $results['mime_type'] = $mime_type; $results['attach_id'] = $attach_id; return $results; } } else return array( 'error' => "Failed to download file of mime type " . $mime_type . ": " . $temp_file->get_error_message()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function download($type)\n {\n $model = Student::whereUser_id(auth()->user()->id)->first();\n if (!is_null($model)) {\n if ($model->user_id == auth()->user()->id) {\n $document = $model->getFirstMedia($type);\n if (!is_null($document))\n ...
[ "0.5585438", "0.5543451", "0.5510361", "0.5502444", "0.54925233", "0.5442962", "0.5389697", "0.53632355", "0.5334549", "0.5286034", "0.5261409", "0.5223991", "0.5199559", "0.51602364", "0.514058", "0.51262844", "0.5090899", "0.50513715", "0.50513715", "0.5029837", "0.50279915...
0.68361455
0
Get the path of a feature image of a post Returns the path of the feature image, insired by
public function get_feature_image_path( $post_id ) { $thumb_id = get_post_thumbnail_id($post_id); if(empty($thumb_id)) return ''; $image= wp_get_attachment_image_src($thumb_id, 'full'); if(empty($image)) return ''; $upload_dir = wp_upload_dir(); $base_dir = $upload_dir['basedir']; $base_url = $upload_dir['baseurl']; $imagepath= str_replace($base_url, $base_dir, $image[0]); if (file_exists( $imagepath)) return $imagepath; else return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_feature_image_url($post_id)\n{\n\tif(has_post_thumbnail($post_id))\n\t{\n\t\t$image5 = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'full' );\n\t\treturn $image5[0];\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "function get_feature_image_url($post_id)\n{\n\tif(has_post_thumbnai...
[ "0.6573878", "0.6573878", "0.6296172", "0.6168056", "0.6103291", "0.60804135", "0.6034792", "0.6013491", "0.58720905", "0.5870317", "0.58182037", "0.5749974", "0.5736883", "0.5706038", "0.5667666", "0.56430054", "0.5625451", "0.5622882", "0.56065935", "0.56058884", "0.5603174...
0.75880456
0
/ This script can be run at the command line via cron to search for all available jobs in US craigslist cities, input them into a database and email you the results. DB export is inside the folder for import.
function grab_feed($url){ //open our db connection $database="clscrape"; $con = mysql_connect('***.***.***.***','****','****'); //our associateive array of magical parsed xml jobs $arrFeeds = array(); //list of sites we want to search for jobs $sites = array("web/index.rss","eng/index.rss","sof/index.rss","search/crg?query=%20&format=rss","search/cpg?query=%20&format=rss"); foreach ($sites as $site){ //lets create a new document $doc = new DOMDocument(); //load our rss url $doc->load($url.$site); //crete an empty array to feed our items into //loop through the RSS XML document grabbing the title, description and link tags as those are the only ones we care about foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue ); //push each item onto the feed array array_push($arrFeeds, $itemRSS); } } foreach($arrFeeds as $link) { $search_terms = array( 'PHP','sysadmin','php'); foreach ($search_terms as $keyword) { $pos = strpos($link['desc'],$keyword); if($pos) { mysql_select_db('clscrape',$con) or die( 'Unable to select database' . mysql_error()); $hash = md5($link['title'].$link['desc'].$link['link']); $title = mysql_real_escape_string($link['title']); $desc = mysql_real_escape_string($link['desc']); $url = mysql_real_escape_string($link['link']); $query="INSERT INTO clscrape.data (data.hash,data.title,data.desc,data.link) VALUES('$hash','$title','$desc','$url')"; mysql_query($query,$con); } } } //close our db connection mysql_close($con); //return our associative array return $arrFeeds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function asu_isearch_cron() {\n\n // Cache data from configuration\n _asu_isearch_cache_dept_feed();\n\n // Cache dept tree and employee types data\n _asu_isearch_cache_dept_tree_data();\n\n // Begin profile migrations\n _asu_isearch_begin_migrate(FALSE);\n\n // Cleanup the profiles which are no longer asso...
[ "0.5537103", "0.54606855", "0.5449546", "0.54228944", "0.5410553", "0.5278324", "0.5236165", "0.52066", "0.5195223", "0.5177203", "0.5169428", "0.5155695", "0.50330484", "0.5013517", "0.50096905", "0.49978343", "0.49911544", "0.4990376", "0.49754736", "0.4973946", "0.4946123"...
0.5626864
0
/ Gather all information related to a given year for a person training status & location (if any) radio eligibility meals & shower privileges
public static function findForPersonYear($personId, $year) { $info = new PersonEventInfo(); $info->person_id = $personId; $info->year = $year; $requireTraining = PersonPosition::findTrainingPositions($personId); $info->trainings = []; if ($requireTraining->isEmpty()) { $requireTraining = [Position::find(Position::TRAINING)]; } foreach ($requireTraining as $position) { $info->trainings[] = Training::retrieveEducation($personId, $position, $year); } usort($info->trainings, function ($a, $b) { return strcmp($a->position_title, $b->position_title); }); $radio = RadioEligible::findForPersonYear($personId, $year); $info->radio_info_available = setting('RadioInfoAvailable'); $info->radio_max = $radio ? $radio->max_radios : 0; $info->radio_eligible = $info->radio_max > 0 ? true : false; $bmid = Bmid::findForPersonYear($personId, $year); if ($bmid) { $info->meals = $bmid->meals; $info->showers = $bmid->showers; } else { $info->meals = ''; $info->showers = false; } if (current_year() == $year && !setting('MealInfoAvailable')) { $info->meals = 'no-info'; } $ot = PersonOnlineTraining::findForPersonYear($personId, $year); if ($ot) { $info->online_training_passed = true; $info->online_training_date = (string)$ot->completed_at; } else { $info->online_training_passed = false; } $info->vehicles = Vehicle::findForPersonYear($personId, $year); $event = PersonEvent::findForPersonYear($personId, $year); if ($event) { $info->may_request_stickers = $event->may_request_stickers; $info->org_vehicle_insurance = $event->org_vehicle_insurance; $info->signed_motorpool_agreement = $event->signed_motorpool_agreement; } else { $info->may_request_stickers = false; $info->org_vehicle_insurance = false; $info->signed_motorpool_agreement = false; } return $info; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function horoscopeInformation(){\n $horoscope_years = [\n 'Rat' => [\n \"years\" => [2008, 1996, 1984, 1972, 1960, 1948, 1936, 1924],\n \"info\" =>\n 'The Rat is known as a friend for life. You find it difficult to give yourself completely, ...
[ "0.6223644", "0.53187007", "0.53092265", "0.52474815", "0.52237827", "0.5216263", "0.5115766", "0.50811625", "0.5071113", "0.4988595", "0.49541777", "0.49491763", "0.49457964", "0.49439424", "0.49324158", "0.4928264", "0.4917653", "0.48897353", "0.48842284", "0.48779628", "0....
0.5841433
1
Loads the name of an user given its email
public function findNameByEmail($email){ $stmt = $this->db->prepare("SELECT * FROM users WHERE email=?"); $stmt->execute(array($email)); $user = $stmt->fetch(PDO::FETCH_ASSOC); if($user != null) { return new User( $user["email"], $user["completeName"]); } else { return NULL; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadUserByEmail($email)\n { \n $user = $this->_em->getRepository('Entity\\User\\User')->findOneBy(array('email' => $email));\n\n if($user != null)\n return $user;\n\n throw new UsernameNotFoundException(\"Compte introuvable\");\n }", "function getUserNam...
[ "0.7470118", "0.7409108", "0.7289771", "0.70845586", "0.6977614", "0.69411457", "0.6923764", "0.689882", "0.6886406", "0.68858427", "0.68018734", "0.67706674", "0.6748977", "0.6733427", "0.6714101", "0.6670983", "0.66457134", "0.66178656", "0.65951985", "0.65804493", "0.65501...
0.7462196
1
Saves a User into the database
public function save($user) { $stmt = $this->db->prepare("INSERT INTO users values (?,?,?)"); $stmt->execute(array($user->getEmail(), $user->getCompleteName(), $user->getPasswd())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save_user()\n\t{\n $user= new Users();\n $user->setNom($_POST['nom']);\n $user->setPrenom($_POST['prenom']);\n $user->setDate_naissance($_POST['date_naiss']);\n $user->setEmail($_POST['mail']);\n $user->setPassword($_POST['pwd']); \n\n $user->C...
[ "0.79587907", "0.77736866", "0.7708109", "0.7707836", "0.7703543", "0.76558113", "0.76016927", "0.7571912", "0.75581414", "0.7402825", "0.7399722", "0.739042", "0.73269767", "0.7292358", "0.7276313", "0.7225437", "0.721875", "0.7218055", "0.7195012", "0.71814644", "0.71694463...
0.7893134
1
Asks the database what games are currently running.
public static function current_games( $db = 0 ) { if( !$db ) { $db = REGISTRY::get( "db" ); } $sth = $db->prepare( " SELECT id FROM games WHERE start_date < CURRENT_TIMESTAMP() AND end_date > CURRENT_TIMESTAMP() " ); $sth->execute(); if( $sth->rowCount() > 0 ) { return $sth->fetchAll( PDO::FETCH_COLUMN, 0 ); } else { return 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listAvailableGames() {\n\t$sql = \"select id, name, admin_id from games where has_started = 0\";\n\n\treturn parcoursRs(SQLSelect($sql));\n}", "public function processGames()\n\t{\n\t\tif ($this->site->lookupgames !== '0') {\n\t\t\t$console = new Console($this->echooutput);\n\t\t\t$console->processConso...
[ "0.63181704", "0.5849128", "0.56395024", "0.55175513", "0.550297", "0.5479659", "0.5446325", "0.53626204", "0.5309082", "0.5246008", "0.5228512", "0.5202838", "0.5187248", "0.51846135", "0.51785505", "0.5178185", "0.5170967", "0.5170245", "0.51696986", "0.51438165", "0.513948...
0.5993147
1
Send reminder messages to the list of appointments that have been passed to us
function sendReminders($appointmentList) { // get appointment details and email address JLoader::register('SalonBookModelAppointments', JPATH_COMPONENT_SITE.DS.'models'.DS.'appointments.php'); $appointmentModel = new SalonBookModelAppointments(); foreach ($appointmentList as $appointment) { $mailingInfo = $appointmentModel->detailsForMail($appointment['id']); // clear any old recipients $this->email = NULL; $this->setSuccessMessage($mailingInfo); // $this->mailer->addBCC("cronwatch@pelau.com"); $this->sendMail(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function appointments()\n\t{\n\t\tif (!is_cli())\n\t\t{\n\t\t\techo \"This script can only be accessed via the command line\" . PHP_EOL;\n\t\t\treturn;\n\t\t}\n\n\t\t$participations = $this->participationModel->get_confirmed_participations();\n\t\tforeach ($participations as $participation)\n\t\t{\n\t\t\t$a...
[ "0.8026194", "0.7020604", "0.67048925", "0.66590756", "0.6545574", "0.64621097", "0.6336447", "0.6316557", "0.6287346", "0.6232709", "0.620149", "0.6109475", "0.60863554", "0.60080373", "0.5963936", "0.59571224", "0.5953585", "0.5945126", "0.5907907", "0.59026027", "0.5885300...
0.7875032
1
Updates the specified agent version. Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version resource.
public function UpdateVersion(\Google\Cloud\Dialogflow\V2\UpdateVersionRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.dialogflow.v2.Versions/UpdateVersion', $argument, ['\Google\Cloud\Dialogflow\V2\Version', 'decode'], $metadata, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setUpdateVersion($val)\n {\n $this->_propDict[\"updateVersion\"] = $val;\n return $this;\n }", "public function setAgentVersion($agentVersion)\n {\n $this->_data['ai.internal.agentVersion'] = $agentVersion;\n }", "public function updateVersion($version)\n {\n...
[ "0.58730173", "0.58695847", "0.58048266", "0.5606574", "0.55426466", "0.54943204", "0.54700434", "0.54400736", "0.54400736", "0.54400736", "0.54358196", "0.5432168", "0.5421149", "0.5421149", "0.54122525", "0.5388079", "0.53782827", "0.53386074", "0.5330476", "0.5304612", "0....
0.7078659
0
Invalidates the cache key on edit_comment and wp_insert_comment. If a list of post IDs is provided, the invalidation will only happen if the edited/created comments belongs to one of the given posts.
public function expires_on_comment_save( $post_ids = array() ) { $invalidation = new \Cache\Invalidation\Hook( $this ); $callback = null; if ( ! empty( $post_ids ) ) { $callback = new SerializableClosure( function ( $id ) use ( $post_ids ) { $comment = get_comment( $id ); return in_array( $comment->comment_post_ID, $post_ids ); } ); } $invalidation->on_hook_with_callable( 'edit_comment', $callback ); $invalidation->on_hook_with_callable( 'wp_insert_comment', $callback ); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clean_comment_cache($ids)\n {\n }", "function _prime_comment_caches($comment_ids, $update_meta_cache = \\true)\n {\n }", "function update_postmeta_cache($post_ids)\n {\n }", "function _prime_post_caches($ids, $update_term_cache = \\true, $update_meta_cache = \\true)\n {\n }",...
[ "0.66274947", "0.63293374", "0.6029599", "0.5792569", "0.5717498", "0.55613804", "0.55031", "0.54733425", "0.54707885", "0.52404207", "0.52330625", "0.5191158", "0.50896", "0.50280756", "0.49876598", "0.49760443", "0.49303183", "0.4894563", "0.48845637", "0.48414186", "0.4832...
0.69485825
0
Builds LibriProducts from ONIX file.
public static function makeFromFile(string $file): array { // get catalog update identifier list($catalogUpdateIdentifier,$suffix) = explode('.',basename($file)); // get date of catalog update (don't use simplexml, the file might be very large) $dateOfCatalogUpdate = new Carbon(self::getDateOfCatalogUpdate($file)); // get number of items in file to make a progress bar $numberOfItems = substr_count(file_get_contents($file),'<product>'); $progress = ConsoleOutput::progress($numberOfItems); // holds all products $products = []; $productHandler = function($product) use ($progress,&$products,$dateOfCatalogUpdate, $catalogUpdateIdentifier) { ConsoleOutput::advance($progress); try { // create Object from ONIX message $libriProduct = self::create($product); if(!is_null($libriProduct)) { $libriProduct->DateOfData = $dateOfCatalogUpdate; $libriProduct->LibriUpdate = $catalogUpdateIdentifier; $products[] = $libriProduct; } } catch (MissingDataException $e) { ConsoleOutput::error($e->getMessage()); Log::warning($e->getMessage()); } }; try { $parser = new Parser(); // create instance of PINOpar Parser $parser->setProductHandler($productHandler); // define a product handler which will be called for each <product> tag $parser->useFile($file); $parser->parse(); ConsoleOutput::finish($progress); } catch(PONIpar\XMLException $e) { // error in ONIXMessage, e.g. missing <ProductIdentifier> // todo: find a way to continue parsing the onixmessage ConsoleOutput::error($e->getMessage()); Log::warning($e->getMessage()); } catch(Exception $e) { ConsoleOutput::error($e->getMessage()); Log::error($e->getMessage()); // todo: find a way to continue parsing after caught exception } // clear $products from null values $products = array_filter($products, function($item) { return !is_null($item); }); return $products; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function create(PONIpar\\Product $onix){\n $libriProduct = new LibriProduct;\n $controller = new LibriProductFactory();\n $controller->product = $onix;\n\n $recordReference = $controller->getRecordReference();\n\n /* ---------------- required data -------------- */\n ...
[ "0.6253491", "0.5181114", "0.5112983", "0.5110384", "0.50576365", "0.503746", "0.49284264", "0.48707747", "0.48707747", "0.4832499", "0.4815969", "0.4815969", "0.4783766", "0.47737586", "0.4726791", "0.4719312", "0.467551", "0.46643233", "0.46590096", "0.4658956", "0.46509764...
0.6799675
0
Copy existing Annotation Urls from old to new product, since they are usually not included in the catalog update.
private static function copyAnnotationUrls($existing_product, $new_product) { foreach(["AntCbildUrl","AntAbildUrl","AntRueckUrl"] as $ant) { if(isset($existing_product->$ant) && !property_exists($new_product,$ant)) { $new_product->$ant = $existing_product->$ant; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function mapMagentoAttributes(ProductInterface $newProduct)\n {\n try {\n $originalProduct = $this->baseMagentoProductRepository->get($newProduct->getSku());\n $newProduct->setMediaGalleryEntries($originalProduct->getMediaGalleryEntries());\n } catch (NoSuchEntityExce...
[ "0.5510585", "0.5038295", "0.497977", "0.49260625", "0.49137515", "0.48702252", "0.48362923", "0.48355854", "0.48096398", "0.4760752", "0.47297874", "0.4719762", "0.4659986", "0.46197754", "0.45372865", "0.45190895", "0.45028773", "0.44517055", "0.44405726", "0.4438688", "0.4...
0.76536757
0
todo: implement memory friendly version of this Builds LibriProduct from ONIX object.
static function create(PONIpar\Product $onix){ $libriProduct = new LibriProduct; $controller = new LibriProductFactory(); $controller->product = $onix; $recordReference = $controller->getRecordReference(); /* ---------------- required data -------------- */ $libriProduct->RecordReference = $recordReference; $libriProduct->ProductForm = $controller->getProductForm(); $libriProduct->DistinctiveTitle = $controller->getDistinctiveTitle(); $tmpReference = $controller->getProductReference(); if(!$tmpReference) return null; // if no valid reference was found, this product is invalid $libriProduct->ProductReference = (String) $tmpReference[0]; $libriProduct->ProductReferenceType = (String) $tmpReference[1]; // test required fields $requiredFields = [ 'RecordReference', 'ProductReference', 'DistinctiveTitle', 'ProductForm' ]; foreach ($requiredFields as $field) { if ($libriProduct->$field === false) throw new MissingDataException("Content of `$field` not found or empty.", $recordReference); } /* ---------------- optional data -------------- */ $libriProduct->OrderTime = (Integer) $controller->getOrderTime(); $libriProduct->QuantityOnHand = (Integer) $controller->getQuantityOnHand(); $libriProduct->AvailabilityStatus = (Integer) $controller->getAvailabilityStatus(); $libriProduct->NumberOfPages = (Integer) $controller->getNumberOfPages(); $libriProduct->VLBSchemeOld = (Integer) $controller->getVLBSchemeOld(); $libriProduct->ProductWeight = (Integer) $controller->getProductWeight(); $libriProduct->ProductWidth = (Integer) $controller->getProductWidth(); $libriProduct->ProductThickness = (Integer) $controller->getProductThickness(); $libriProduct->AudienceCodeValue = (Integer) $controller->getAudienceCodeValue(); $libriProduct->Author = (String) $controller->getAuthor(); $libriProduct->CoverLink = (String) $controller->getCoverLink(); $libriProduct->ProductLanguage = (String) $controller->getProductLanguage(); $libriProduct->PublisherName = (String) $controller->getPublisherName(); $libriProduct->PublicationDate = (String) $controller->getPublicationDate(); $libriProduct->Blurb = (String) $controller->getBlurb(); $controller->CurrentPrice = $controller->getPriceDeCurrent(); $libriProduct->PriceAmount = (float) $controller->getPriceAmount(); $libriProduct->PriceTypeCode = (Integer) $controller->getPriceTypeCode(); $libriProduct->DiscountPercent = (Integer) $controller->getDiscountPercent(); $libriProduct->TaxRateCode1 = (String) $controller->getTaxRateCode1(); $libriProduct->NotificationType = $controller->getNotificationType(); $libriProduct->Lib_MSNo = $controller->getLibriNotificationKey(); $libriProduct->AvailabilityCode = $controller->getAvailabilityCode(); $libriProduct->PublishingStatus = $controller->getPublishingStatus(); return $libriProduct; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function build();", "abstract public function build();", "abstract function build();", "public abstract function build();", "public abstract function build();", "abstract public function factoryMethod(): Product;", "function webmap_compo_lib_xml_build()\r\n{\r\n\t$this->webmap_compo_lib...
[ "0.567433", "0.567433", "0.5630675", "0.5624379", "0.5624379", "0.55156046", "0.5475541", "0.5378524", "0.53736424", "0.53120536", "0.5254839", "0.5251328", "0.5201675", "0.51764864", "0.51479137", "0.5127448", "0.51158357", "0.5112923", "0.5112923", "0.5112923", "0.5112923",...
0.6952602
0
Converts ISBN10 to ISBN13 string. Taken from
private function isbn10to13($isbn10){ $isbnclean = preg_replace("/([^d])/", "",substr($isbn10,0,-1)); if (strlen($isbnclean) != 9) { return $isbn10; } $isbn="978".$isbnclean; $check=0; for ($i=0;$i<12;$i++) { $check+=(($i%2)*2+1)*$isbn[$i]; } $check=(10-($check%10))%10; return "978".substr($isbn10,0,-1).$check; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function convert10to13($isbn10)\n {\n $isbn13 = '978' . substr($isbn10, 0, 9);\n $sum = 0;\n for ($i = 0; $i < 12; $i ++) {\n if ($i % 2 == 0) {\n $sum += $isbn13{$i};\n } else {\n $sum += 3 * $isbn13{$i};\n }\n }\...
[ "0.7752301", "0.69664115", "0.683384", "0.65942186", "0.63080627", "0.6307712", "0.61868817", "0.61771363", "0.61431986", "0.5945208", "0.5832819", "0.5708205", "0.5654722", "0.5618333", "0.5520768", "0.5519655", "0.5519655", "0.55044407", "0.531368", "0.5266902", "0.5264451"...
0.8058322
0
Retrieve Blurb Text from ONIX data
public function getBlurb() { // check if there is text available in the onix message // and return as Blurb if it exists $records = $this->product->get('OtherText'); foreach ($records as $record) { if($record->getType() == 18) { return $record->getValue(); } } return false; /* Original SQL statement from spMacSelectProductsFairnopoly.sql: > update macSelectProducts > set Blurb = > cast(( > select top 1 OtherText from refProductOtherText > where macSelectProducts.ProductReference = refProductOtherText.ProductReference > and refProductOtherText.TextTypeCode = '18') > as varchar(4000)) */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_featureblurb() {\n\t\tglobal $product;\n\t\tif ( is_front_page() ) {\n\t\t\t$content = get_post_meta( $product->id, 'featureblurb', true );\n\t\t\tif ( $content ) {\n\t\t\t\techo( '<div class=\"featureblurb\">' . html_entity_decode( $content ) . '</div>' );\n\t\t\t}\n\t\t}\n\t}", "public function ge...
[ "0.6004652", "0.59671986", "0.5666079", "0.5549008", "0.5529162", "0.54114276", "0.54049116", "0.53617334", "0.53467906", "0.5331171", "0.5294811", "0.5259774", "0.5241196", "0.520316", "0.5161109", "0.5139849", "0.5134706", "0.51287276", "0.5109651", "0.5109651", "0.5109651"...
0.7552279
0
Threads have many views.
public function views() { return $this->hasMany('App\Models\ViewedThread'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function threads()\n\t{\n\n\t\t// get sort type\n\n\n\t\t$query = Thread::where('parent_id', null)->with('user')->with('topic')->limit(20);\n\n\t\t$sort = get_string('sort', 'newest');\n\n\t\t$topic = get_int('topic', false);\n\n\t\tif($topic)\n\t\t\t$query->where('topic_id', $topic);\n\n\t\tThread::setOrde...
[ "0.6227774", "0.6065797", "0.58746225", "0.5841943", "0.58096045", "0.57834", "0.57736015", "0.5746879", "0.5743991", "0.57399094", "0.564211", "0.56412166", "0.55708474", "0.5564394", "0.55544937", "0.5502142", "0.549396", "0.549396", "0.549396", "0.549396", "0.54552364", ...
0.62835604
0
Threads belong to many viewers (Users) through ViewedThread.
public function viewedBy() { return $this->belongsToMany( 'App\Models\User', 'viewed_threads', 'thread_id', 'user_id' ) ->using('App\Models\ViewedThread') ->withPivot('timestamp'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function views()\n {\n return $this->hasMany('App\\Models\\ViewedThread');\n }", "public function favoriteThreads($userid, $threads);", "public function threads()\n {\n return $this->hasMany(thread::class);\n }", "public function threads()\n {\n return $this->hasMan...
[ "0.64863783", "0.6115233", "0.58442837", "0.5840202", "0.5840202", "0.5837736", "0.58362126", "0.573146", "0.57066077", "0.57065344", "0.56756526", "0.56379545", "0.5579365", "0.55518365", "0.54680085", "0.5441456", "0.5403752", "0.53617686", "0.53530246", "0.5348783", "0.527...
0.7057228
0