query stringlengths 10 8.11k | document stringlengths 17 398k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Test case for landedCostShipmentPurchaseOrderGETRequestShipmentIDPurchaseOrdersOrderIDGet Retrieves a shipment purchase order.. | public function testLandedCostShipmentPurchaseOrderGETRequestShipmentIDPurchaseOrdersOrderIDGet()
{
} | [
"public function testLandedCostShipmentGETRequestShipmentIDGet()\n {\n }",
"public function testGoodsReceivedNotePurchaseOrdersGETManyRequestGRNIDPurchaseOrdersGet()\n {\n }",
"public function testGETShipmentsShipmentIdPrints()\n {\n }",
"public function testProcurementPurchaseordersIdGet()\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the duplicate_student_name property of this object | public function set_duplicate_student_name($duplicate_student_name)
{
$this->set_default_property(self::PROPERTY_DUPLICATE_STUDENT_NAME, $duplicate_student_name);
} | [
"public function get_duplicate_student_name()\n {\n return $this->get_default_property(self::PROPERTY_DUPLICATE_STUDENT_NAME);\n }",
"public function getDuplicatedName()\n {\n return $this->duplicatedName;\n }",
"protected function onCloneName(): void\n\t{\n\t\t// ensure unique name\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update row with corresponding has in table with data data is an array such that [key1 => value1, key2 =>value2, etc] | public function update($table, $hash, $data){
$sql = "UPDATE `".$table."` SET ";
$i=0;
foreach($data as $key => $value){
if($i++!=0) $sql .= " , ";
$sql .= $key ." = :".$key;
}
$sql .= " WHERE `hash` = :hash";
$data["hash"] = $hash;
$stmt = $this->conn->prepare($sql);
$stmt->execute($data);
// echo $sql;
} | [
"public function update(array $row);",
"function update($table, $data, $where=''){\n\t\t$data = $this->checkFields($table, $data);\n\t\tforeach($data as $column=>$value){\n\t\t\t$v_arr[] = \"$column='$value'\";\n\t\t}\n\t\t$sql = \"UPDATE $table SET \".implode(\",\", $v_arr).\" \".$where;\n\t\t$this->exec($sql);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ loadout bins compartments on create default selection load | public function loadoutBinsCompartmentsDefault(){
var_dump(Input::all());
} | [
"public function getBinOptions()\n {\n return array(\n 'nbins' => $this->_nbins,\n 'rangeLow' => $this->_rangeLow,\n 'rangeHigh' => $this->_rangeHigh,\n );\n }",
"public function getBins() {\n \tif (!isset(self::$getBins_stmt)) {\n \t\tself::$getBins... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mode Of Vaccine Supply By Facility Type | public function modeOfVaccineSupplyByFacilityTypeAction() {
//ccem proposed list 1.1 (1)
$search_form = new Form_ReportsSearch();
$data_arr = array(
'WorkingWell' => '90',
'WorkingNeedsService' => '7',
'NotWorking' => '3'
);
$main_heading = "Mode Of Vaccine Supply By Facility Type";
$str_sub_heading = "";
$number_prefix = "";
$number_suffix = "%";
$s_number_prefix = "";
$xmlstore = "<?xml version=\"1.0\"?>";
$xmlstore .= '<chart caption="' . $main_heading . '" subCaption="' . $str_sub_heading . '" numberPrefix="' . $number_prefix . '" numberSuffix="' . $number_suffix . '" sformatNumberScale="1" sNumberPrefix="' . $s_number_prefix . '" syncAxisLimits="1" rotateValues="1" showSum="0" theme="fint">';
$xmlstore .='<set label="Working Well" value="' . $data_arr['WorkingWell'] . '"/>';
$xmlstore .='<set label="Working Needs Service" value="' . $data_arr['WorkingNeedsService'] . '"/>';
$xmlstore .='<set label="Not Working" value="' . $data_arr['NotWorking'] . '"/>';
$xmlstore .="</chart>";
$this->view->xmlstore = $xmlstore;
$this->view->main_heading = $main_heading;
$this->view->str_sub_heading = $str_sub_heading;
$this->view->chart_type = 'Pie3D';
$this->view->width = '80%';
$this->view->height = '400';
$this->view->search_form = $search_form;
$this->view->inlineScript()->appendFile(Zend_Registry::get('baseurl') . '/js/all_level_area_combo.js');
} | [
"abstract public function getMode();",
"public function getFitMode() {}",
"function mode_str(){\n\t\t$str = locstr(SalusZone::MODES_TEXT[$this->mode]);\n\t\tif($this->mode!=SalusZone::MODE_OFF and $this->mode!=SalusZone::MODE_ES) $str .= ' '.temp_to_str($this->current_mode_temp);\n\t\treturn $str;\n\t}",
"pub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether a var exists given its name | public function hasVar($name)
{
return array_key_exists($name, $this->vars);
} | [
"public function hasVariable($name);",
"public function varExists($baseName)\n {\n return isset($this->initVars[$baseName]);\n }",
"public function data_var_exists($var_name, $path = NULL)\n\t{\n\t\tif ($path === NULL)\n\t\t{\n\t\t\treturn array_key_exists($var_name, $this->form_data());\n\t\t} else // fix... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wraps results in appropriate results class for this GetAccount execution. | protected function wrapResults($outputs)
{
return new Twilio_Accounts_GetAccount_Results($outputs);
} | [
"protected function wrapResults($outputs)\n {\n return new RapidShare_GetAccountDetails_Results($outputs);\n }",
"protected function wrapResults($outputs)\n {\n return new Stripe_Account_RetrieveAccountDetails_Results($outputs);\n }",
"protected function wrapResults($outputs)\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an expression that refers to an identifier. Identifiers are used to refer to field names and allow the SQL compiler to apply quotes or escape the identifier. The value is used as is, and you might be required to use aliases or include the table reference in the identifier. Do not use this method to inject SQL methods or logical statements. Example ``` $query>newExpr()>lte('count', $query>identifier('total')); ``` | public function identifier(string $identifier): ExpressionInterface
{
return new IdentifierExpression($identifier);
} | [
"public abstract function prepare_identifier($expr);",
"public function createExpression();",
"public static function identifier($string, $db = 'default')\r\n {\r\n return new Expression(static::quoteIdentifier($string));\r\n }",
"public function prepare_identifier($expr) {\n\t\tif ($expr instanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/Elimina un registro de tblproveedoreliminado | public static function setDeleteTblproveedorEliminado($idtbloproveedoreliminado){
$delete = "DELETE FROM tbloproveedoreliminado WHERE idtbloproveedoreliminado = ?";
try{
$resultado = ConexionDB::getInstance()->getDb()->prepare($delete);
$resultado->bindParam(1,$idtbloproveedoreliminado,PDO::PARAM_INT);
$resultado->execute();
return $resultado->rowCount(); //retorna el numero de registros afectados
} catch(PDOException $e){
return false;
}
} | [
"public static function setDeleteAllTblproveedorEliminado(){\n\t \n\t\t$delete = \"DELETE FROM tbloproveedoreliminado WHERE idtbloproveedoreliminado = ?\";\n\t\t\n\t\ttry{\n\n\t\t\t$resultado = ConexionDB::getInstance()->getDb()->prepare($delete);\n\t\t\t$resultado->execute();\n\t \treturn $resultado->rowCou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tests Greenery Day before 1989. Greenery Day was established from 1989 on April 29th. After 2007 it was changed to be May 4th. | public function testGreeneryDayBefore1989()
{
$this->assertNotHoliday(self::COUNTRY, self::HOLIDAY, $this->generateRandomYear(1000, 1988));
} | [
"public function testGreeneryDayOnAfter2007()\n {\n $year = 2112;\n $this->assertHoliday(self::COUNTRY, self::HOLIDAY, $year,\n new DateTime(\"$year-5-4\", new DateTimeZone(self::TIMEZONE)));\n }",
"public function testEsterDate()\n {\n if (!function_exists('easter_date'))... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a WikiFile object populated with the file data. | public function getFile($filename)
{
return new WikiFile($filename, $this);
} | [
"public static function make($fileData) {\n \n return new File($fileData);\n }",
"public function getFileObject() {\n\n return File::getByID($this->fID);\n }",
"public function getFile()\n {\n if (!is_object($this->_file)) {\n $this->_file = Yii::createObject(arra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the montant annuel5. | public function setMontantAnnuel5($montantAnnuel5) {
$this->montantAnnuel5 = $montantAnnuel5;
return $this;
} | [
"public function testSetMontant5() {\n\n $obj = new Employes();\n\n $obj->setMontant5(10.092018);\n $this->assertEquals(10.092018, $obj->getMontant5());\n }",
"public function setMontantBrut5($montantBrut5) {\n $this->montantBrut5 = $montantBrut5;\n return $this;\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the mobilePhone Mobile phone number of the contact. | public function setMobilePhone($val)
{
$this->_propDict["mobilePhone"] = $val;
return $this;
} | [
"public function set_mobile_phone($mobile_phone) {\r\n $this->mobile_phone = $mobile_phone;\r\n }",
"public function setMobilePhone(?string $value): void {\n $this->getBackingStore()->set('mobilePhone', $value);\n }",
"public function set_mobile_phone($p_mobile_phone){\n\t\t$this->v_mobile_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiates a new UserExperienceAnalyticsAnomalyDeviceItemRequestBuilderGetRequestConfiguration and sets the default values. | public function __construct(?array $headers = null, ?array $options = null, ?UserExperienceAnalyticsAnomalyDeviceItemRequestBuilderGetQueryParameters $queryParameters = null) {
parent::__construct($headers ?? [], $options ?? []);
$this->queryParameters = $queryParameters;
} | [
"public function userExperienceAnalyticsDeviceScopes(): UserExperienceAnalyticsDeviceScopesRequestBuilder {\n return new UserExperienceAnalyticsDeviceScopesRequestBuilder($this->pathParameters, $this->requestAdapter);\n }",
"public function userExperienceAnalyticsDeviceTimelineEvent(): UserExperienceAna... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
defend by monitor requests | public function defend()
{
$lastRequest = $this->getRequest();
if (empty($lastRequest)) {
$this->logRequest();
} else
if ($lastRequest['blocked'] && $lastRequest['blocked'] > time() - $this->blockingPeriod) {
$this->blockRequest();
} else
if ($lastRequest['ip_address'] == $this->getIpAddress() && $lastRequest['request_uri'] == $this->getRequestUri() && $lastRequest['timestamp'] > time() - $this->pageInternal) {
if ($lastRequest['request_count'] >= $this->pageCount) {
$this->storage->update([
'blocked' => time()
]);
$this->blockRequest();
} else {
$this->updateLastRequestCounter($lastRequest['request_count'] + 1);
}
} else {
$this->logRequest();
}
} | [
"public function endRequest();",
"public function onEndRequest()\n\t{\n\t\t$this->flushOutput(false); // flush all remaining content in the buffer\n\t\t$this->saveGlobals(); // save global state\n\t\t$this->raiseEvent('OnEndRequest',$this,null);\n\t}",
"private static function requestEnd()\n {\n $_GE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Try to DESCRIBE the groups table to see whether the column exists / was added | function bp_group_hierarchy_verify_install( $debug_column = false ) {
global $wpdb, $bp;
/** Manually confirm that parent_id column exists */
$parent_id_exists = true;
$columns = $wpdb->get_results( 'DESCRIBE ' . $bp->groups->table_name );
if( $columns ) {
$parent_id_exists = false;
foreach( $columns as $column ) {
if( $column->Field == 'parent_id') {
$parent_id_exists = true;
break;
}
}
if( ! $parent_id_exists && $debug_column ) {
bp_group_hierarchy_debug( 'Required column was not found - last MySQL error was: ' . $wpdb->last_error );
return $parent_id_exists;
}
} else {
bp_group_hierarchy_debug( 'Could not DESCRIBE table - last MySQL error was: ' . $wpdb->last_error );
return false;
}
return $parent_id_exists;
} | [
"function _sql_groups()\n\t{\n\t\t$sql\t= array();\n\n\t\t//\t----------------------------------------\n\t\t//\tTable exists?\n\t\t//\t----------------------------------------\n\n\t\tif ( ee()->db->table_exists( 'exp_friends_groups' ) )\n\t\t{\n\t\t\tif ( $this->column_exists( 'total_members', 'exp_friends_groups' ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method runs before a table is reordered | protected function onBeforeReorder(&$table)
{
// Call the behaviors
$result = $this->modelDispatcher->trigger('onBeforeReorder', array(&$this));
if (in_array(false, $result, true))
{
// Behavior failed, return false
return false;
}
return true;
} | [
"public function onAfterReorder(&$table)\n\t{\n\t\treturn true;\n\t}",
"protected static function preClearTables()\n {\n }",
"protected function printElementBeforeTable()\n {\n \n }",
"function postLoadTables() {}",
"function table_reflow_start()\n {\n $this->_in_table++;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the first photo associated with the model. | public function getFirstPhotoAttribute()
{
if ($this->hasPhotos()) {
foreach ($this->photos as $photo) {
return $photo;
}
}
return false;
} | [
"public function getFirstPhoto() {\n return $this->get(1);\n }",
"public function getSinglePhoto() {\n $id = $this->getPhotoId();\n $this->getPhoto($id);\n }",
"public function FirstImage()\n {\n return $this->owner->Images()\n ->Sort($this->owner->Sorter)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to update a ride after it has been reserved | public function update_ride($id)
{
$res=mysql_query("UPDATE rides SET `available`=0 WHERE `id`= '$id' ");
return $res;
} | [
"public function reserve()\n {\n $this->update(['reserved_at' => Carbon::now()]);\n }",
"public function update_car_ride() {\n $data = array(\n 'origin' => $this->input->post('origin'),\n 'destination' => $this->input->post('destination'),\n 'price' => $this->i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation restPaymentsMethodsListGet Returns all payment methods with id and name | public function restPaymentsMethodsListGet()
{
list($response) = $this->restPaymentsMethodsListGetWithHttpInfo();
return $response;
} | [
"public function getPaymentMethods()\n {\n /** @var oxPayment $oxPayment */\n $oxPayment = oxNew('oxPayment');\n $sql = \"SELECT `OXID` FROM {$oxPayment->getViewName()} WHERE {$oxPayment->getSqlActiveSnippet()}\";\n $methods = marm_shopgate::dbGetAll($sql);\n\n $result ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Queues transactional email so it's not sent in current request if enabled, otherwise falls back to send now. | public static function queue_transactional_email() {
if ( is_a( self::$background_emailer, 'WeDevs\PM\Core\Notifications\Background_Emailer' ) ) {
self::$background_emailer->push_to_queue( array(
'filter' => current_filter(),
'args' => func_get_args(),
) );
} else {
call_user_func_array( array( __CLASS__, 'send_transactional_email' ), func_get_args() );
}
} | [
"private function prevent_transactional_emails() {\n $statuses = array( 'processing', 'pending', 'on-hold' );\n\n foreach( $statuses as $status )\n add_action( 'woocommerce_order_status_' . $status, array( $this, 'unhook_transactional_emails_confirmed' ), 5, 1 );\n\n // Prevent trans... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If new redirect targets have been added for given statusmessage, create referring queue entries | protected function _createMissingQueueEntries($sStatusmessageId) {
try {
$aParams = $this->_fetchPostParams($sStatusmessageId);
$aRequest = $aParams['array'];
$sPayoneStatus = $aRequest['txaction'];
$this->_addQueueEntries($sStatusmessageId, $sPayoneStatus);
} catch (Exception $e) {
throw $e;
}
} | [
"private function _addToQueue($url, $referrer)\n {\n $url = (string) $url;\n \n if (! in_array($url, $this->_targets)) {\n $request = new Spizer_Request($url);\n $request->setReferrer($referrer);\n $this->_engine->getQueue()->append($request);\n \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write data to daily csv file | function logData ($Datalog) {
global $today, $now, $config;
$csvFile = $config['outputPath'].'/'.$today.'.csv';
if ( !is_file($csvFile) ) {
$header = '# Date Time, TodaykWh, inVolt, inAmp, inWatt, outVolt, outAmp, outWatt, Temp';
try {
file_put_contents($csvFile, $header.PHP_EOL);
} catch (Exception $e) {
http_response_code(500);
die('Cannot create file '.$csvFile);
}
}
$csvFormat = '%s %s, %01.1f, %01.1f, %01.1f, %01.1f, %01.1f, %01.1f, %s, %01.1f';
$csvString = sprintf($csvFormat, $today, $now, $Datalog['todaykWh'],
$Datalog['Vpv'], $Datalog['Ipv'], $Datalog['Ppv'], $Datalog['Vac'],
$Datalog['Iac'], $Datalog['Pac'], $Datalog['Temp']).PHP_EOL;
file_put_contents($csvFile, $csvString, FILE_APPEND);
logger('Debug','Values: '.$csvString);
} | [
"public function dailyEmailAttachedCSV()\n {\n\n\n }",
"function SaveToCSV($data){\n $targetFile = '../history/'.$data[\"site_name\"].'.csv';\n\n // open / create & open file\n if (file_exists($targetFile)) {\n // open file if already exisits\n $fh = fopen($targetFile, 'a');\n } el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of Telefon | public function getTelefon()
{
return $this->telefon;
} | [
"public function getTelefno()\n {\n return $this->telefno;\n }",
"public function getInstTelefono()\n {\n return $this->inst_telefono;\n }",
"public function getTelephone();",
"public function getTelevision()\n {\n return $this->television;\n }",
"public function getTe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The api should create a valid stack of cards | public function testCreatesValidStack()
{
$vehicleFactory = new NamesHashFactory();
$vehicleFactory->registerVehicleType('flight', 'Boarding\\Vehicle\\Flight');
$vehicleFactory->registerVehicleType('train', 'Boarding\\Vehicle\\Train');
$vehicleFactory->registerVehicleType('airport bus', 'Boarding\\Vehicle\\AirportBus');
$cardToLegMapper = new BaseCardMapper();
$descriptor = new BaseDescriptor();
$api = new Api(new FromArray($vehicleFactory), new QuickSortTopological($cardToLegMapper), $descriptor);
$stack = $api->createStack($this->cardsArray);
$this->assertInstanceOf('Boarding\Card\Stack', $stack, 'Api did not create a stack.');
$this->assertEquals(4, $stack->getLength());
} | [
"private function generateCards(){\n $name = ['Prof. Day', 'Prof. Enbody', 'Prof. McCullen', 'Prof. Onsay', 'Prof. Owen', 'Prof. Plum',\n 'Beaumont Tower', 'Breslin Center', 'Engineering Building', 'International Center',\n 'Library', 'Art Museum', 'Spartan Stadium', 'University Union',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes all entry export files from the server that haven't been claimed within 24 hours. | public static function delete_old_export_files() {
GFCommon::log_debug( __METHOD__ . '(): Starting.' );
$uploads_folder = RGFormsModel::get_upload_root();
if ( ! is_dir( $uploads_folder ) || is_link( $uploads_folder ) ) {
GFCommon::log_debug( __METHOD__ . '(): No upload root - bailing.' );
return;
}
$export_folder = $uploads_folder . 'export';
if ( ! is_dir( $export_folder ) || is_link( $export_folder ) ) {
GFCommon::log_debug( __METHOD__ . '(): No export root - bailing.' );
return;
}
GFCommon::log_debug( __METHOD__ . '(): Start deleting old export files' );
foreach ( GFCommon::glob( '*.csv', $export_folder . DIRECTORY_SEPARATOR ) as $filename ) {
$timestamp = filemtime( $filename );
if ( $timestamp < time() - DAY_IN_SECONDS ) {
// Delete files over a day old
GFCommon::log_debug( __METHOD__ . '(): Proceeding to delete ' . $filename );
$success = unlink( $filename );
GFCommon::log_debug( __METHOD__ . '(): Delete successful: ' . ( $success ? 'yes' : 'no' ) );
}
}
} | [
"public function deleteExpiredFiles()\n {\n $this->_garbageCollector->clean();\n }",
"public function deleteAllExpired() {\n\t}",
"public function cleanup_exports() {\n\n\t\twc_customer_order_csv_export()->get_export_handler_instance()->remove_expired_exports();\n\t}",
"function wp_schedule_delet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new oauth server record | public function Create($oauth_server, $consumer_key, $consumer_secret, $expire_threshold)
{
global $addslashes, $msg;
$oauth_server = $addslashes($oauth_server);
$consumer_key = $addslashes($consumer_key);
$consumer_secret = $addslashes($consumer_secret);
$expire_threshold = intval($expire_threshold);
$missing_fields = array();
/* email check */
$oauth_server = $addslashes(trim($oauth_server));
$expire_threshold = intval($expire_threshold);
/* login name check */
if ($oauth_server == '')
{
$missing_fields[] = _AT('oauth_server');
}
if ($missing_fields)
{
$missing_fields = implode(', ', $missing_fields);
$msg->addError(array('EMPTY_FIELDS', $missing_fields));
}
if (!$msg->containsErrors())
{
/* insert into the db */
$sql = "INSERT INTO ".TABLE_PREFIX."oauth_client_servers
(oauth_server,
consumer_key,
consumer_secret,
expire_threshold,
create_date
)
VALUES ('".$oauth_server."',
'".$consumer_key."',
'".$consumer_secret."',
".$expire_threshold.",
now()
)";
if (!$this->execute($sql))
{
$msg->addError('DB_NOT_UPDATED');
return false;
}
else
{
return mysql_insert_id();
}
}
else
{
return false;
}
} | [
"public function createApiServer()\n {\n if (null == ($clientCredentials = $this->loadClientCredentials())) {\n // prepare oob server\n $discovergyCredentials = $this->loadDiscovergyCredentials();\n $oob = new DiscovergyOutOfBand($discovergyCredentials);\n\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function used to add new country// | public function addCountry()
{
$this->Checklogin();
if (isset($_POST ['submit']))
{
$data ['admin_section']='location';
$id=$this->location_model->addCountry();
if ($id)
{
$this->session->set_flashdata('success','Country has been added successfully.');
redirect('head/location');
} else
{
$this->session->set_flashdata('error','Unable to save Country.');
$data ['include']='head/location/location';
$data ['admin_section']='manage_location';
$this->load->view('backend/container_sa',$data);
}
} else
{
redirect('head/location');
}
} | [
"public function add_country($data) {\n $this->db->insert('tours_country', $data);\n }",
"public function addnewcountry($country, $region){\n\t\t$connection = Database::getConnection();\n\t\t$query=\"INSERT INTO country VALUES (DEFAULT, '\".$country.\"', '\".$region.\"')\";\n\t\tif (!$connection->query(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add media metabox tab | function houzez_media_metabox_tab( $metabox_tabs ) {
if ( is_array( $metabox_tabs ) ) {
$metabox_tabs['gallery'] = array(
'label' => houzez_option('cls_media', 'Property Media'),
'icon' => 'dashicons-format-gallery',
);
}
return $metabox_tabs;
} | [
"function the_media_upload_tabs()\n{\n}",
"function media_upload_tabs() {}",
"function yz_groups_screen_media() {\r\n\r\n global $Youzer;\r\n\r\n // Call Media Tab Content.\r\n\tadd_action( 'bp_template_content', array( &$Youzer->tabs->media, 'group_tab' ) );\r\n\r\n // Load Tab Template\r\n bp_cor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if mode triggers desktop style | protected static function is_desktop_mode($mode)
{
return ($mode == 'desktop' || $mode == '404');
} | [
"function is_desktop()\n {\n return dev::isDesktop();\n }",
"public function is_desktop () {\n\t\treturn $this->is_desktop;\n\t}",
"public function isDesktop();",
"public function theSizeIsDesktop()\n {\n $this->getSession()->resizeWindow(1400, 900, 'current');\n }",
"static function getSc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fills in peoples' submission data from the submission results log file | function process_submission_results() {
global $ROOT_DIR; // input
global $people; // input & output
// Syntax of log file:
// <hhmmss>,<user id>,<first name last name>,Problem<problem number>,<status code>,[text]
// status codes:
// "0" success
// "1" compile failure
// "2" test failure
// "3" timeout while running
// "4" crash
// "15" unknown error while executing program
// if status code is 1, there is another token before text which has the
// filename of a log of the compile
// log file is assumed to be in chronological order
global $contest_id, $curr_contest, $db;
$result_set = $db->get_submitted($contest_id);
foreach($result_set as $row) {
$user_id = $row['user_id'];
$problem_number = $row['problem'];
$status_code = intval($row['message']);
$time = $row['time'];//date("H:i:s", $row['time']);
if($row['tested'] == 1)
$people[$user_id]->submitted_problem($problem_number+1, $time, $status_code);
}
/* $log = file($ROOT_DIR.'/log', 1);
if ($log === false) {
app_log("ERROR: Opening submission results log file failed.");
echo "ERROR: Opening submission results log file failed.";
exit;
}
foreach ($log as $line) {
//echo "tokenized log entry as:<br />"; echo "<pre>"; print_r($entry); echo "</pre>";
$time = strtok($line, ",");
$user_id = strtok(",");
$name = strtok(",");
$problem_number = substr(strtok(","), 7);
$status_code = strtok(",");
//echo "tokenized line: time=$time, name=$name, problem number=$problem_number, code=$status_code<br />";
if (!array_key_exists($user_id, $people)) {
app_log(sprintf("ERROR: Submission results log refers to user id %d which is not in the users file.", $user_id));
continue;
}
$people[$user_id]->submitted_problem($problem_number, $time, $status_code);
if ($status_code == 1) {
$people[$user_id]->last_compile_log_filename = strtok(",");
}
}*/
} | [
"public function logSubmission() {\n\t\ttry {\n\t\t\t$this->clear ();\n\t\t\t\n\t\t\t$this->_populate ();\n\t\t\t\n\t\t\t$this->_validateInput ();\n\t\t\t\n\t\t\t$this->store ();\n\t\t\n\t\t} catch ( Exception $e ) {\n\t\t\techo $e->getMessage ();\n\t\t\tdie ();\n\t\t}\n\t\n\t}",
"function createSubmissionsArray(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the site URL of the reference site to use for stats. | public function get_reference_site_url() {
return $this->filter_reference_url();
} | [
"public function getUrl() {\n\t\treturn $this->siteURL;\n\t}",
"public function getSiteURL()\n {\n return $this->config->get('site.url').$this->config->get('site.dir');\n }",
"public function getSiteLink()\n {\n return $this->siteLink;\n }",
"private function get_site_url() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test binding a class, using the abstract as the concrete. | public function testBindNoConcretePassed()
{
$this->container->bind('League\\Di\\Stub\\Baz');
$bindings = $this->readAttribute($this->container, 'bindings');
$this->assertArrayHasKey(
'League\\Di\\Stub\\Baz',
$bindings,
'The key for the binding should equal the first argument passed.'
);
$definition = $bindings['League\\Di\\Stub\\Baz'];
$this->assertInstanceOf(
'League\\Di\\Definition',
$definition,
'Passing an empty $concrete should result in an instance of Definition.'
);
$this->assertAttributeEquals(
'League\\Di\\Stub\\Baz',
'class',
$definition,
'The class attribute on the created Definition should match the $abstract param if no $concrete is passed.'
);
} | [
"public function testBindingToAbstractClass()\n {\n $this->container->bind($this->baseClass, $this->concreteFoo);\n $sharedInstance = $this->container->makeShared($this->baseClass);\n $this->assertInstanceOf($this->concreteFoo, $sharedInstance);\n $newInstance = $this->container->make... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect to the remote server. This is not asynchronous at the current time though it appears to be suported (via flag options). | public function connect()
{
$errno = 0;
$errstr = '';
$this->s = stream_socket_client($this->transport."://".$this->host.":".$this->port
,$errno
,$errstr
,$this->timeout
,STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT);
$this->status = 'connected';
if ( $errno )
{
$this->error = $errno;
$this->status = 'connect failed: $errrstr ($errno)';
}
return $this->error;
} | [
"public function connect()\n\t{\n\t\t/**\n\t\t * There is no point attempting to connect if we are already connected.\n\t\t */\n\t\tif( $this->connection !== null )\n\t\t\treturn;\n\n\t\t/**\n\t\t * Attempt to connect to the server.\n\t\t */\n\t\tif( ($this->connection = fsockopen($this->host, $this->port, $errno, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function used to save ipn transaction | function saveIpnTransaction($data){
$user_id = $data['user_id'];
//$email = $data['email'];
$txn_id = $data['txn_id'];
$this->db->select('*');
$this->db->where('user_id',$user_id);
//$this->db->where('email',$email);
$this->db->where('txn_id',$txn_id);
$check = $this->db->get(DB_PREFIX.'transaction')->row_array();
if(!empty($check)){
$this->db->where('user_id',$user_id);
//$this->db->where('email',$email);
$this->db->where('txn_id',$txn_id);
$return = $this->db->update(DB_PREFIX.'transaction',$data);
return $check['id'];
}else{
$return = $this->db->insert(DB_PREFIX.'transaction',$data);
return $this->db->insert_id();
}
} | [
"public function save() {\n $transaction = $this->transaction;\n $transaction->changed = REQUEST_TIME;\n\n $transaction_array = array(\n 'transaction_id' => $transaction->transactionId,\n 'uid' => $transaction->uid,\n 'cashier' => $transaction->cashier,\n 'order_id' => $transaction->ord... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a newly created inscription in storage. | public function store(CreateinscriptionRequest $request)
{
$input = $request->all();
$inscription = $this->inscriptionRepository->store($input);
$inscriptions = DB::table('inscriptions')->get();
$nbr = DB::table('inscriptions')->count();
if($nbr%10==0){
// send email
$email="belaidzouhair@gmail.com";
$email2="Samri.manar@gmail.com";
Mail::send('emails.contact', ['email' => $email,'email2' => $email2,'nbr' =>$nbr,'inscriptions'=> $inscriptions], function($message) use ($email,$email2,$nbr,$inscriptions)
{
$message->to($email2)->subject('workshop nbr: '.$nbr);
$message->to($email)->subject('workshop nbr: '.$nbr);
});
}
Flash::message('inscription saved successfully.');
return view('inscriptions.merci')->with('inscription', $inscription);
} | [
"public function store()\n\t{\n\t\t$id = Input::get('id');\n\t\t\n\t\tAuth::user()->storages_id = $id;\n\t\tAuth::user()->save();\n\t}",
"public function store()\n\t{\n\t\t$this->transaction->save(Input::all());\n\t}",
"public function store()\n {\n\n $data = Input::all();\n\n $result = Prescri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the path to a localized Markdown resource. | public static function localizedMarkdownPath(string $name): ?string
{
$localName = preg_replace('#(\.md)$#i', '.'.app()->getLocale().'$1', $name);
return Arr::first([
resource_path('markdown/'.$localName),
resource_path('markdown/'.$name),
], static function ($path) {
return file_exists($path);
});
} | [
"public function getPath()\n {\n return $this->path ?: __DIR__ . '/locales';\n }",
"public function setPath()\n\t{\n\t\t$title = preg_replace(\"/[^a-zA-Z0-9]+/\", \" \", $this->properties['title']);\n\t\t$title = preg_replace('!\\s+!', ' ', trim($title));\n\n\t\treturn $this->config['dir']['page'] . ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for getAccountTransactions Get account transactions. | public function testGetAccountTransactions()
{
$response = $this->api->getAccountTransactions("0x0123456789012345678901234567890123456789", 0, 100);
$this->assertTrue($response->getSuccess());
$this->assertInternalType("array", $response->getResult());
} | [
"public function testAccountTransactionsGet()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"public function transactions()\n\t{\n\t\t$response = $this->client->get( 'account/transactions' );\n\t\treturn $response->getBody();\n\t}",
"public function getTransa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function SubjectCell , Parameter list: $edit Creates subject cell as table. | function SubjectCell($edit)
{
$subject=$this->GetMailField("Subject");
$cell="";
if ($edit==1)
{
$cell=$this->MakeInput("Subject",$subject,80);
}
else
{
$cell=$subject;
}
return $this->Span($cell,array("WIDTH" => '75%'));
} | [
"function Emails2TableCell($edit,$email,$selected=FALSE,$disabled=FALSE)\n {\n return\n $this->Emails2TableCheckBox($edit,$email,$selected,$disabled).\" \".\n $this->Span($email[ \"Email\" ].\";\",array(\"TITLE\" => $email[ \"Name\" ].\" (\".$email[ \"ID\" ].\")\")).\n \"\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves a member's interests | function getInterests($memberId)
{
$sql = "SELECT interest.interest
FROM member
INNER JOIN `member-interest` ON member.member_id = `member-interest`.member_id
INNER JOIN interest ON `member-interest`.interest_id = interest.interest_id
WHERE member.member_id = :memberId";
$statement = $this->_dbh->prepare($sql);
$statement->bindParam(':memberId', $memberId);
$statement->execute();
return $statement->fetchAll(PDO::FETCH_ASSOC);
} | [
"function getInterests($member_id)\n {\n $sql = \"SELECT interests FROM member WHERE member_id = :member_id\";\n\n // prepare the statement\n $statement = $this->_dbh->prepare($sql);\n\n // bind the parameters\n $statement->bindParam(':member_id', $member_id);\n\n // exe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes in a request for skill id Calls the business service to read If successful, return skill profile page If not, return the home form | public function readSkillEdit($id)
{
$this->logger->info("Entering ProfileController.readSkillEdit()");
try
{
// create new instance of profileBusinessService
$profileBS = new SkillBusinessService();
// attempt to read Skill
$skills = $profileBS->retrieveSkill($id);
// store skill information into variable
$data = [
'skill' => $skills
];
return view("skills.skillUpdate")->with($data);
}
catch (Exception $e2) {
// display our Global Exception Handler page
return view("error");
}
} | [
"function single_get()\n { \n $id=(int) $this->get('id');\n $skill = $this->skill_model->read_specific_skills( $id );\n \n if($skill)\n {\n $this->response($skill, REST_Controller::HTTP_OK); // 200 being the HTTP response code\n }\n \n else\n {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the server status and tries to start it if it is shut down | private static function serverStatus()
{
if (!empty(self::$request) && self::$method === 'POST' && strpos(self::$request, 'server') === 0 && isset(self::$input['session'])) {
if (Session::validate(self::$input['session'])) {
if (Daemon::isRunning()) {
// Daemon is already running
return json_encode(true);
} else if (Daemon::runBackground()) {
// Start Daemon
return json_encode(true);
} else {
// Could not start Daemon
return json_encode(false);
}
}
}
return false;
} | [
"static private function ServerState() {\n $status = exec('illarionctl status');\n if (strpos($status, 'ONLINE') === FALSE) {\n\t\t\tself::$serverstatus = 1;\n\t\t} else {\n\t\t\tself::$serverstatus = 0;\n\t\t}\n\n $status = exec('testctl status');\n\t\tif (strpos($status, 'ONLINE') === FALSE) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the recurrence type of the event. This is usually a string that matches up to the label of a recurrence type. | public function getRecurrenceType(); | [
"public function getRecurrenceType()\n {\n return $this->recurrenceType;\n }",
"public function getRecurringType()\n {\n return $this->recurringType;\n }",
"public function getRecurrence(): string\n {\n return $this->recurrence;\n }",
"public function setRecurrenceType($... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace class on cancel reply link | function magaz_replace_cancel_reply_link_class( $cancel_comment_reply_link, $post = null ) {
$new = str_replace( '<a', '<a class="button outline tiny"', $cancel_comment_reply_link );
return $new;
} | [
"function shoestrap_replace_reply_link_class( $class ) {\n $class = str_replace( \"class='comment-reply-link\", \"class='comment-reply-link btn btn-primary btn-small\", $class );\n return $class;\n}",
"function replace_reply_link_class( $class ){\n\t$class = str_replace( \"class='comment-reply-link\", \"class='... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get template tabs Get tabs for the library. | public function get_template_tabs() {
$tabs = Templates\premium_templates()->types->get_types_for_popup();
return $tabs;
} | [
"public static function get_tabs()\n {\n return apply_filters( 'es_settings_get_tabs', array(\n 'general' => array(\n 'label' => __( 'General', 'es-plugin' ),\n 'template' => ES_ADMIN_TEMPLATES . 'settings/general-tab.php'\n ),\n 'layouts' => ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the current status of bypass_assets flag | public function bypass_assets():bool
{
return $this->_bypass_assets;
} | [
"public function getAssetStatus()\n {\n return $this->asset_status;\n }",
"public function getCacheStatus(): mixed\n {\n return $this->getCacheOptions()['enable'];\n }",
"public function hasAccessTo() {\n return $this->getAffiliate()->getAssets();\n }",
"public function get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end arrayPrefixKeys() Filter an array by keys from another array. Returns an array that has the key/value pairs from $data only if the key is present in $keys. Solution copied from | function arrayFilterByKeys(array $data, array $keys)
{
return array_intersect_key($data, array_flip($keys));
} | [
"function array_filter_keys($input, $keys)\n{\n return array_intersect_key($input, array_flip($keys));\n}",
"function array_filter_keys($array, $keys) {\r\n return array_intersect_key($array, array_flip($keys));\r\n}",
"function extractKeysOfArray(array $keys, array $data, $includeNonExistentKeys = false)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if $entity is a valid category | public function instanceOfCategory(ElggEntity $entity = null) {
if (!$entity instanceof ElggEntity) {
return false;
}
if (!in_array($entity->getSubtype(), $this->config->getCategorySubtypes())) {
return false;
}
return true;
} | [
"public function validateCategory()\n {\n\n }",
"public function is_category($category = '')\n {\n }",
"private function isValidCategory(string $category)\n {\n return in_array($category, $this->jokeClient->fetchCategories());\n }",
"public function isValidCat($cat){\r\n \t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of stock items | public function stockItems($params = array(), $list_info = true)
{
return $this->get('/stock_items/index.json'.$this->_getRequestParams($params, $list_info));
} | [
"public function getAllStock()\n\t{\n \n\t\t$stock = array(); \n \t$results = $this->db -> select(\"SELECT * from stock\");\n \n\t\tforeach($results as $result)\n\t\t{\n\t\t\t$item = new StockItem();\n\t $item->hydrate($result);\n \t$stock[] = $item;\n }\n \n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ensure that logging queries works. | public function testQueryLogging()
{
$logger = $this->getMockBuilder('Cake\Log\Engine\BaseLog')->setMethods(['log'])->getMock();
$logger->expects($this->once())->method('log');
Log::config('elasticsearch', $logger);
$connection = ConnectionManager::get('test');
$connection->logQueries(true);
$result = $connection->request('_stats');
$connection->logQueries(false);
$this->assertNotEmpty($result);
} | [
"static public function enableQueryLogging() {\n\t\t$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = TRUE;\n\t}",
"public function enableQueryLog() {\n\t\t$this->loggingQueries = true;\n\t}",
"public function enableQueryLog()\n {\n $this->loggingQueries = true;\n }",
"abstract protected function _log... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function called to create a table which stores the contents of $_inputs array for a particular state in the requestDB database in the table which is names after the state. This table would be later used for the pupose of deciding response for a particular input from page and then further deciding the transition. | public function buildFormInputFieldTable($databaseName = "requestDB") {
// take credentials from config.php and connect to database.
$config = include('config.php');
$databaseHostname = $config['databaseHostname'];
$databaseUsername = $config['databaseUsername'];
$databasePassword = $config['databasePassword'];
$conn = new \mysqli($databaseHostname, $databaseUsername, $databasePassword);
if ($conn->connect_error) {
die("Connection Error:".$conn->connect_error);
}
// Connects to DB, create if does not exist.
$sql = "CREATE DATABASE IF NOT EXISTS ".$databaseName;
if ($conn->query($sql) === TRUE) {
$conn->close();
}
// Creates a table with name as stateName for state's form input fields and saves the content.
$conn = new \mysqli($databaseHostname, $databaseUsername, $databasePassword, $databaseName);
if ($conn->connect_error) {
die("Connection Error: ".$conn->connect_error);
}
$sql = "CREATE TABLE IF NOT EXISTS ".$this->stateName."_".$this->stateType."(
inputType VARCHAR(50) NOT NULL,
name VARCHAR(50) NOT NULL,
label VARCHAR(50),
defaultValue VARCHAR(50)
)";
if ($conn->query($sql) === TRUE) {
// Empty the table, to override the contents.
$sql = "TRUNCATE TABLE ".$this->stateName."_".$this->stateType;
$conn->query($sql);
foreach($this->_inputs as $key => $input) {
// Skip the submit buttons
if ($input['inputType'] == "submit") {
continue;
}
$sql = "INSERT INTO ".$this->stateName."_".$this->stateType." (inputType, name, label, defaultValue)
VALUES (\"".$input['inputType']."\", \"".$input['name']."\", \"".$input['label']."\", \"".$input['defaultValue']."\")";
if ($conn->query($sql) === FALSE) {
die("Unable to add entries to FormEntries table ".$conn->error);
}
}
}
else {
die("Unable to create Table for state \"".$this->stateName."_".$this->stateType."\": ".$conn->error);
}
$conn->close();
} | [
"function create_form_table($args) {\n\t\t$table_name = $args[\"singular_code_name\"];\n\t\t$result = $GLOBALS['db']->query(\"DROP TABLE \".$table_name);\n\t\t$result = $GLOBALS['db']->query(\"CREATE TABLE IF NOT EXISTS \".$table_name.\" (id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY)\");\n\n\t\t$items = $args[\"it... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Translate Turns a single integer into the appropriate string according to the fizzbuzz specification. | public static function translate(int $val): string {
if ($val === 0) {
$out = "0";
} else if ($val % 15 == 0) {
$out = "fizzbuzz";
} else if ($val % 5 == 0) {
$out = "buzz";
} else if ($val % 3 == 0) {
$out = "fizz";
} else {
$out = "$val";
}
return $out;
} | [
"function fizzBuzzAValue(int $theValue)\n{\n /** @var string $outputVal */\n $outputVal = '';\n\n if ($theValue % 3 === 0) {\n $outputVal = FIZZ;\n }\n if ($theValue % 5 === 0) {\n $outputVal .= BUZZ;\n }\n if (empty($outputVal)) {\n return $theValue;\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send Test Notification To Destination Send a test Notification to the specified destination. | public function sendTestNotificationToDestination($request); | [
"public function sendTestNotificationToDestination($request)\n {\n if (!($request instanceof SendTestNotificationToDestinationInput)) {\n $request = new SendTestNotificationToDestinationInput($request);\n }\n $parameters = $request->toQueryParameterArray();\n $parameters['A... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Binds the values needed to insert a sport | function addSportBinding(&$query, $values) {
$query->bindParam(':sport_name', $values['sport_name']);
} | [
"function addSports(){\n\n $name = $this->getName();\n\n $sql = \"INSERT INTO server_sport (name)\n VALUES (?)\";\n\n $this->db->Add_insert_delete_Query($sql,\n array($name),\n array(PDO::PARAM_STR));\n\n\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read private static member from same class | #[@test, @ignore('$this->getClass()->getField($field) does not yield private field declared in parent class')]
public function readingPrivateStaticMemberFromChildClass() {
PrivateAccessibilityFixtureChild::readStatic(self::$fixtureChild);
} | [
"public function testGetPrivateProperty_Static()\n {\n $this->assertSame(910, get_private_property(TestClass::class, 'statPriv'));\n $this->assertSame(920, get_private_property(TestClass::class, 'statProt'));\n $this->assertSame(940, get_private_property(TestClass::class, 'statPub'));\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch all levels and associated lessons for each level | public function getAllLevels()
{
return $level = Level::with(array( 'lessons' => function ( $query ) {
$query->addSelect(array('id', 'level_id', 'title', 'description'));
}))->orderBy('level_index', 'ASC')->get(['id', 'user_id', 'level_index', 'title', 'description']);
} | [
"public function getLessons($level = null) {\n\t\tif ($level === null)\n\t\t\t$level = $this->getLevel();\n\n\t\t$lessons = Application::getLessons($level);\n\n\t\tif ($lessons === false)\n\t\t\treturn false;\n\n\t\t$sql = <<<\"SQL\"\n\t\t\tSELECT lesson_id, score, passing_score, timestamp\n\t\t\tFROM test_result\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes l10n.js from head | function rm_l10n(){
if(!is_admin()){
wp_deregister_script('l10n');
}
} | [
"function remove_l10n_js(){\n if (!is_admin()){\n wp_deregister_script('l10n');\n }\n}",
"function _gandalf_remove_l1on() {\n\tif ( !is_admin() ) {\n\t\twp_deregister_script('l10n');\n\t}\n}",
"function newenglish_head_cleanup() {\n // Originally from http://wpengineer.com/1438/wordpress-header/\n remove... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate site path (relative to root path) site_path('role/create', 'admin') === 'admin/role/create' | function site_path($path, $site = 'desktop')
{
if (!in_array($site, config('site.route.group'))) {
$site = 'desktop';
}
$sub_dir = config('site.route.prefix.'.$site, '');
return $sub_dir.'/'.trim($path, '/');
} | [
"public function getSitePath();",
"protected function getPathSite() {}",
"function admin_path() {\n return root_path() . '/admin';\n }",
"function getSitePath() {\n return Site::getSitePath();\n}",
"public static function getSitePath(): string\n {\n return Environment::getPublicPath()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts the message timestamp to readable dates | protected function _timestampToReadable($message)
{
if (key_exists(self::KEY_CREATED, $message)){
$creation = new Zend_Date($message[self::KEY_CREATED]);
$message[self::KEY_CREATED. "Readable"] = $creation->get(Zend_Date::DATE_LONG);
}
if (key_exists(self::KEY_MODIFED, $message)){
$modified = new Zend_Date($message[self::KEY_MODIFED]);
$message[self::KEY_MODIFED. "Readable"] = $modified->get("M. MMMM yyyy HH:mm:ss");
}
if (key_exists(self::KEY_ONSINCE, $message)){
$onSince = new Zend_Date($message[self::KEY_ONSINCE]);
$message[self::KEY_ONSINCE. "Readable"] = $onSince->get(Zend_Date::DATE_LONG);
}
return $message;
} | [
"private function renderDate(){\n\t\t#On divise le chiffre par 1 000 car GoSMS enregistre les dates en timestamp UNIX (en millisecondes : 1 sec = 1000 ms)\n\t\t$iDate = (string) $this->oSMS->date;\n\t\t$iDate /= 1000;\n\n\t\t$sDate = date('l d/m/Y - H:i:s', $iDate);\n\n\t\treturn $sDate;\n\t}",
"function dateRFC8... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Acquire an identity to store | public function acquireIdentity() {
$group = new IdentityDataGroup($this->data, $this->source);
/** @var \Drupal\identity\IdentityDataIdentityAcquirerInterface $acquirer */
$acquirer = \Drupal::service('identity.acquirer');
$result = $acquirer->acquireIdentity($group);
$this->set('entity', $result->getIdentity());
return $result;
} | [
"public function nextIdentity();",
"abstract function attainSignedIdentity();",
"public function getIdentity()\n {\n if (!isset($this->identity) && isset($this->instance)) {\n $this->identity = $this->createIdentity($this->instance);\n }\n\n return $this->identity;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AJAX Callback function for removing notes | function wpbs_action_ajax_calendar_remove_note()
{
if (!isset($_POST['calendar_id'])) {
return false;
}
$calendar_id = absint($_POST['calendar_id']);
$note_id = absint($_POST['note_id']);
$notes = wpbs_get_calendar_meta($calendar_id, 'notes', true);
unset($notes[$note_id]);
wpbs_update_calendar_meta($calendar_id, 'notes', $notes);
wp_die();
} | [
"function ajax_note_delete() {\n $note = ModelJB::newInstance()->getNoteByID(Params::getParam('noteID'));\n $result = ModelJB::newInstance()->deleteNote(Params::getParam('noteID'));\n if( ($result !== false) && ($result > 0 ) ) {\n $st = new Stream();\n $st->log_remove_n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
export function isEnumType(type: any): type is GraphQLEnumType ; | #[Pure]
public static function isEnumType($type): bool
{
return $type instanceof EnumTypeInterface;
} | [
"public function isEnumType()\n {\n return $this->getType() == PropelTypes::ENUM;\n }",
"public function isEnum(): bool;",
"public function hasEnumType()\n {\n return count($this->get(self::ENUM_TYPE)) !== 0;\n }",
"private function isEnum(\\EasyRdf_Resource $type)\n {\n $s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return job data for given jobid | function getJobData($jobid) {
// Check if job with given ID is set
if(!isset($this->operations[$jobid])) {
return FALSE;
}
// Get job type
return $this->operations[$jobid]['jobdata'];
} | [
"public function getJob($id);",
"abstract public function getJob( $id );",
"public function getJobById($id);",
"private function get_job($id)\n {\n $query = 'SELECT `jb_id` AS id, `jb_position` AS position, `jb_description` AS description, `jb_status` as status , `jb_created_on` AS crated_on\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ dbtable processed or grouped | function dbTable() {
global $plexWatch;
if ($plexWatch['globalHistoryGrouping'] == "yes") {
return "grouped";
}
return "processed";
} | [
"function groupBy() {}",
"function join_group_by($tablename=\"\",$fieldname=\"\",$whereCon=\"\", $groupby=\"\",$findline='')\r\n {\r\n $arguments = array($tablename,$fieldname,$whereCon, $groupby);\r\n $this->debug_obj->WriteDebug($class=\"templates.class\", $function=\"join_group_by\", $file=$fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the date model. | public function getDateModel() : DateModel
{
return $this->dateModel;
} | [
"protected function _getDateModel()\n {\n return Mage::getSingleton('core/date');\n }",
"public function getPayDateModel()\n\t\t{\n\t\t\tif ($this->paydate_model === NULL)\n\t\t\t{\n\t\t\t\t$model = $this->getModel();\n\t\t\t\t$this->paydate_model = Date_PayDateModel_1::getModel(\n\t\t\t\t\t\t\t\t$mo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display our custom control in the Customizer. | public function render_content() {
// We do this to allow the upload control to specify certain labels
$l10n = json_encode( $this->l10n );
// Control title
printf(
'<span class="customize-control-title" data-l10n="%s" data-mime="%s">%s</span>',
esc_attr( $l10n ),
esc_attr( $this->mime_type ),
esc_html( $this->label )
);
// Control description
if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo $this->description; ?></span>
<?php endif; ?>
<div class="current"></div>
<div class="actions"></div>
<?php
} | [
"public function render_content() {\n\t\tif ( empty( $this->choices ) ) {\n\t\t\treturn;\n\t\t}\n\t\t?>\n\t\t<label>\n\t\t\t<?php if ( ! empty( $this->label ) ) : ?>\n\t\t\t<span class=\"customize-control-title\"><?php echo esc_html( $this->label ); ?></span>\n\t\t\t<?php endif; ?>\n\n\t\t\t<?php if ( ! empty( $thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get views of the published article. | function getViews() {
$application =& PKPApplication::getApplication();
return $application->getPrimaryMetricByAssoc(ASSOC_TYPE_ARTICLE, $this->getId());
} | [
"public function getViews();",
"public function getViews()\n {\n return $this->views;\n }",
"public function getPostViews($id);",
"public function get_views()\n\t{\n\t\treturn $this->driver_query($this->sql->view_list());\n\t}",
"public function views()\n {\n return $this->morphMany(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ views pagers theme_views_mini_pager original: /views/theme/theme.inc | function starter_views_mini_pager($vars) {
global $pager_page_array, $pager_total;
$tags = $vars['tags'];
$element = $vars['element'];
$parameters = $vars['parameters'];
// Calculate various markers within this pager piece:
// current is the page we are currently paged to
$pager_current = $pager_page_array[$element] + 1;
// max is the maximum page number
$pager_max = $pager_total[$element];
// End of marker calculations.
$li_previous = theme('pager_previous',
array(
'text' => (isset($tags[1]) ? $tags[1] : t('‹‹')),
'element' => $element,
'interval' => 1,
'parameters' => $parameters,
)
);
if (empty($li_previous)) {
$li_previous = " ";
}
$li_next = theme('pager_next',
array(
'text' => (isset($tags[3]) ? $tags[3] : t('››')),
'element' => $element,
'interval' => 1,
'parameters' => $parameters,
)
);
if (empty($li_next)) {
$li_next = " ";
}
if ($pager_total[$element] > 1) {
$items[] = array(
'class' => array('previous'),
'data' => $li_previous,
);
$items[] = array(
'class' => array('current'),
'data' => t('@current of @max', array('@current' => $pager_current, '@max' => $pager_max)),
);
$items[] = array(
'class' => array('next'),
'data' => $li_next,
);
return theme('item_list',
array(
'items' => $items,
'title' => NULL,
'type' => 'ul',
'attributes' => array('class' => array('pager')),
'daddy' => 'pager'
)
);
}
} | [
"function ideal_protest_views_mini_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {\n global $pager_page_array, $pager_total;\n $view = views_get_current_view();\n $view_name = $view->name; \n // Calculate various markers within this pager piece:\n // Middle is used to ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the value of desconto_unitario. | public function getDescontoUnitario()
{
return $this->desconto_unitario;
} | [
"public function getValorUnitario()\n {\n return $this->valor_unitario;\n }",
"public function getCostoUnitario()\n {\n return $this->costoUnitario;\n }",
"public function getValorunitario()\n {\n return $this->valorunitario;\n }",
"public function getDescuen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return testimonial by position | public function getTestimonialByPosition($position = null)
{
return $this->testimonialRepository->findOneBy(
array(
'position' => $position,
)
);
} | [
"public function getAllTestimonials()\n {\n return $this->testimonialRepository->findBy(\n array(),\n array(\n 'position' => 'ASC',\n )\n );\n }",
"public function getTestimonial()\n {\n return $this->testimonial;\n }",
"public fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply a boolean attribute | private function apply_boolean_attribute( $atts, $key ) {
if ( isset( $atts[ $key ] ) ) {
$this->{$key} = ( $atts[ $key ] ) ? true : false;
}
} | [
"public function getBoolean( $attr );",
"public function getBoolean( Inx_Api_Recipient_Attribute $oAttr );",
"public function shortcode_atts_boolean( $att ) {\n\n if ( $att === 'true' || absint( $att ) ) {\n $att_val = 1;\n } else {\n $att_val = 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Apply Brightness filter to the image | function effectBrightness($val){
if($this->useGdFilters){
if($this->_isReady())
return imagefilter($this->_imgHandler, IMG_FILTER_BRIGHTNESS,$val);
else
return false;
}
else return $this->_setError('Image filters is not available on PHP4');
} | [
"private function applyFilters() {\n if ($this->sharpen) {\n $this->image = $this->sharpenImage($this->image);\n }\n if ($this->grayscale) {\n $this->image = $this->applyGrayscale($this->image);\n }\n if ($this->sepia) {\n $this->image = $this->applySepia($this->image);\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
paginaBeheer retrieves all pages from the database so they can be shown in a table | public function paginaBeheer()
{
$pageQuery = "SELECT * FROM pages";
$data["pages"] = $this->model->getContent($pageQuery);
Load::view("paginaBeheer", $data);
} | [
"public function getPaginate() {\n /*\n * Iniciando valores.\n */\n $showPages = $this->_showPages;\n $pages = [];\n $pageItems = false;\n $transformer = $this->getTransformer();\n /*\n * Recuperando valores\n */\n $limit = $this->getL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get single exam by exam ID | public function get_exam($exam_id)
{
$exam_id = (int)$exam_id;
// making sure that number of questions does not exceed
// the number of questions actually exists in the category
//$this->update_exam_category_no_of_question($exam_id);
if ($exam_id > 0) {
$this->db->where('id', $exam_id);
$query = $this->db->get($this->table_name);
//echo $this->db->last_query(); die();
if ($query->num_rows() > 0) {
return $query->row();
} else {
$this->error_message = 'Exam not found. Invalid id.';
return false;
}
} else {
$this->error_message = 'Invalid id.';
return false;
}
} | [
"public function getById($examId);",
"public static function LoadById($exam_id)\n {\n \t$result = &get_instance()->db->get_where(\"Exams\", array(\"exam_id\" => $exam_id));\n \t$result = $result->result();\n \treturn count($result) != 0 ? Exams_model::LoadWithData($result[0]) : null;\n }",
"publi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove and return the last inserted font | public function popLastFont()
{
if ($this->index < 0) {
throw new FontException('The font stack is empty');
}
$font = array_pop($this->stack);
--$this->index;
return $this->getFontMetric($font);
} | [
"public function getNewFont()\n {\n return $this->newFont;\n }",
"private function font()\n {\n return $this->fonts[array_rand($this->fonts)];\n }",
"public function getCurrentFont()\n {\n return $this->currentFont;\n }",
"public static function _remove_system_font($font... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the active worksheet's context (school or district) | public function getContext()
{
// Context has already been determined
if (isset($this->worksheets[$this->activeWorksheet]['context'])) {
return $this->worksheets[$this->activeWorksheet]['context'];
}
// Context can be determined from the worksheet name
switch ($this->activeWorksheet) {
case 'Schools':
return Context::SCHOOL_CONTEXT;
case 'Corporations':
return Context::DISTRICT_CONTEXT;
}
// Context can be determined from the column headers
for ($row = 1; $row <= 2; $row++) {
$isSchoolContext = (
$this->isSchoolCodeHeader(1, $row)
&& $this->isSchoolNameHeader(2, $row)
) || (
$this->isDistrictCodeHeader(1, $row)
&& $this->isDistrictNameHeader(2, $row)
&& $this->isSchoolCodeHeader(3, $row)
&& $this->isSchoolNameHeader(4, $row)
);
if ($isSchoolContext) {
return Context::SCHOOL_CONTEXT;
}
$isDistrictContext = $this->isDistrictCodeHeader(1, $row)
&& $this->isDistrictNameHeader(2, $row)
&& !$this->isSchoolCodeHeader(3, $row)
&& !$this->isSchoolNameHeader(4, $row);
if ($isDistrictContext) {
return Context::DISTRICT_CONTEXT;
}
}
throw new Exception('Cannot determine school/district context of worksheet ' . $this->activeWorksheet);
} | [
"public function getSchool()\n {\n return $this->school;\n }",
"public function getCurrentWorksheet();",
"public function getSchoolOfficeId()\r\n {\r\n return $this->school_office_id;\r\n }",
"public function context()\n {\n if ($this->hasRole(Role::ctype('Employee', 'Name'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve information of local rgb bulb | public function RetrieveLocalRgbBulbInfo($ipAddress)
{
try {
$this->jeedomHelper->logDebug("Retrieve info of wifi bulb " . $ipAddress);
$url = "http://" . $ipAddress . "/api/v1/device";
$result = $this->doHttpCall($url, null, "GET");
if ($result === false) {
return null;
}
$jsonObj = json_decode($result);
$macAddress = key($properties = get_object_vars($jsonObj));
$mystromBulb = new MystromWifiBulb();
$mystromBulb->macAddress = $macAddress;
$mystromBulb->ipAddress = $ipAddress;
$mystromBulb->state = $jsonObj->$macAddress->on == true ? "on" : "off";
$mystromBulb->power = $jsonObj->$macAddress->power;
$mystromBulb->color = $jsonObj->$macAddress->color;
$hsv = explode(";", $mystromBulb->color);
$rgb = explode(";", $this->hsvToRgb($hsv[0], $hsv[1], $hsv[2]));
$mystromBulb->color = "#" . \sprintf("%'.02s", \dechex($rgb[0]))
. \sprintf("%'.02s", \dechex($rgb[1]))
. \sprintf("%'.02s", \dechex($rgb[2]));
return $mystromBulb;
} catch (Exception $e) {
$this->jeedomHelper->logWarning("RetrieveLocalRgbBulbInfo - " . $e);
return null;
}
} | [
"function GetRGB(){}",
"public function getRGB()\n {\n if ($this->resource->getFormat() == \"code\") {\n $this->findRGBByCode();\n } elseif ($this->resource->getFormat() == \"name\") {\n $this->findRGBByName();\n } else {\n return;\n }\n }",
"pu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cURL Operations Set the internal data members to valued representing a bad handle error. | private function set_bad_handle() /*void*/ {
$this->_response = '';
$this->_errno = CURLM_BAD_HANDLE;
$this->_error = 'The passed-in handle is not a valid cURL handle.';
$this->_status = 0;
} | [
"private function __set_curl_errors() {\n\t\tif (! $this->success) {\n\t\t\t\n\t\t\t$err = error_get_last ();\n\t\t\tif (! empty ( $this->curl_errors )) {\n\t\t\t\t$err = array (\n\t\t\t\t\t\t\"message\" => $this->curl_errors \n\t\t\t\t);\n\t\t\t}\n\t\t\tif (! $err) {\n\t\t\t\t$err = array (\n\t\t\t\t\t\t\"message\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the riskLevel Level of the detected risk. Note: Details for this property are only available for Workload Identities Premium customers. Events in tenants without this license will be returned hidden. The possible values are: low, medium, high, hidden, none. | public function setRiskLevel($val)
{
$this->_propDict["riskLevel"] = $val;
return $this;
} | [
"public function addRiskLevel($riskLevel) {\r\n \t$this->riskLevel = $riskLevel;\r\n }",
"public function riskLevel(?string $value): self\n {\n $this->instance->setRiskLevel($value);\n return $this;\n }",
"public function setLevel($Level){\n $this->Level = $Level;\n }",
"publ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the TelegramBot model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown. | protected function findModel($id)
{
if (($model = TelegramBot::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));
} | [
"protected function findModel($id)\n\t{\n\t\tif (($model = Budget::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}",
"protected function findModel($id)\n\t{\n\t\tif (($model = WiRequest::findOne($id)) !== null) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the active token for the given series. | public function loadTokenBySeries(string $series): PersistentTokenInterface; | [
"public function loadTokenBySeries($series)\n {\n $token = $this->query()->where('series', $series)->first();\n\n if (!$token) {\n throw new TokenNotFoundException(\"Token with series '$series' was not found\");\n }\n\n return $token;\n }",
"function loadToken() {\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ nkList configuration Define the list of forum | function getForumListCfg() {
return array(
'sqlQuery' => 'SELECT A.id, A.nom, A.niveau, A.level, B.nom AS category FROM '. FORUM_TABLE .' AS A LEFT JOIN '. FORUM_CAT_TABLE .' AS B ON B.id = A.cat',
'defaultSortables' => array(
'order' => array('B.ordre', 'B.nom', 'A.ordre', 'A.nom')
),
'fields' => array(
'nom' => array('label' => __('NAME')),
'category' => array('label' => __('CATEGORY')),
'niveau' => array('label' => __('LEVEL_ACCES')),
'level' => array('label' => __('LEVEL_POST'))
),
'edit' => array(),
'delete' => array()
);
} | [
"public function getForumList()\n\t{\t\t\t\n\t\t$this->DB->build( array( 'select' => 'f.*',\n\t\t\t\t\t\t\t\t 'from' => array( 'forums' => 'f' ),\n\t\t\t\t\t\t\t\t 'add_join' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarray( 'select' => 'm.member_group_id as last_poster_group_id',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTIONS Creates a fake user. To make testing easier. | public function createFakeUser(){
$email = 'user@user.com';
$lastname = 'fakeLastName';
$firstname = 'fakeFirstName';
$password = 'pwd';
$status = 2;
$password_hash = password_hash($password, PASSWORD_BCRYPT);
$this->user->setLastName($lastname);
$this->user->setFirstName($firstname);
$this->user->setEmail($email);
$this->user->setPasswordHash($password_hash);
// OPE : save info in DB
$sid = $this->user->signin();
// OPE : save session info
$_SESSION['id'] = $sid;
$_SESSION['status'] = 2;
// OPE : redirect to success page
changeLocation("?action=signinSuccess");
} | [
"private function createTestUser()\n {\n return factory(App\\User::class)->create(['email' => config('credentials.vocabulary.email'), 'password' => bcrypt(config('credentials.vocabulary.password'))]);\n }",
"protected function createTestUser() {\n\t\treturn wp_insert_user(array(\n\t\t\t'user_login' =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Check if window is currently hidden (only PLATFORM_DESKTOP) | function IsWindowHidden(): bool { return false; } | [
"public static function isWindowHidden() : bool {}",
"function IsShownOnScreen(){}",
"public static function isWindowFullscreen() : bool {}",
"public function canBeShown()\n {\n if (!is_null($this->_show_window)) {\n return $this->_show_window;\n }\n\n if (!$this->isOutputEn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hookable method called after Latte has been initialized. Use this method to customize the passed $latte instance, e.g. adding functions and filters. | protected function ___initLatte(Engine $latte)
{
} | [
"protected function initLatte() {\r\n $template = new Nette\\Templating\\FileTemplate;\r\n $template->setCacheStorage(new Nette\\Caching\\Storages\\PhpFileStorage(self::$cacheDir . '/latte/'));\r\n $template->registerHelperLoader('Nette\\Templating\\Helpers::loader');\r\n\r\n $class = ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compiles the regex necessary to capture all match types within a route. | protected function compileRegex($route)
{
$pattern = '`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`';
if (preg_match_all($pattern, $route, $matches, PREG_SET_ORDER)) {
$match_types = array(
'i' => '[0-9]++',
'a' => '[0-9A-Za-z]++',
'h' => '[0-9A-Fa-f]++',
'*' => '.+?',
'' => '[^/]++'
);
foreach ($matches as $match) {
list ($block, $pre, $type, $param, $optional) = $match;
if (isset($match_types[$type])) {
$type = $match_types[$type];
}
if ($param) {
$param = "?<{$param}>";
}
if ($optional) {
$optional = '?';
}
$replaced = "(?:{$pre}({$param}{$type})){$optional}";
$route = str_replace($block, $replaced, $route);
}
}
if (substr($route, strlen($route) - 1) != '/') {
$route .= '/?';
}
return "`^{$route}$`";
} | [
"function compile_matcher($route) {\r\n\t if (preg_match_all('`(/|\\.|)\\[([^:\\]]*+)(?::([^:\\]]*+))?\\](\\?|)`', $route, $matches, PREG_SET_ORDER)) {\r\n\t $match_types = array(\r\n\t 'i' => '[0-9]++',\r\n\t 'a' => '[0-9A-Za-z]++',\r\n\t 'h' => '[0-9A-Fa-f]++',\r\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Operation siteListsSiteListIdSitesPost Add Sites to Site List | public function siteListsSiteListIdSitesPost($site_list_id, $body)
{
$this->siteListsSiteListIdSitesPostWithHttpInfo($site_list_id, $body);
} | [
"public function siteListsSiteListIdSitesPostWithHttpInfo($site_list_id, $body)\n {\n $request = $this->siteListsSiteListIdSitesPostRequest($site_list_id, $body);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Answers a string of meta image caption class names for the template. | public function getMetaImageCaptionClass()
{
return ViewTools::singleton()->array2att($this->owner->getMetaImageCaptionClassNames());
} | [
"public function getMetaImageCaptionClassNames()\n {\n $classes = ['caption'];\n \n if ($alignment = $this->owner->getMetaImageAlignment()) {\n $classes[] = $alignment;\n }\n \n return $classes;\n }",
"public function getMetaImageWrapperClassNames()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates an existing PostHistory model. If update is successful, the browser will be redirected to the 'view' page. | public function actionUpdate($id)
{
if (!\Yii::$app->user->can('cmsPostHistoriesUpdate')) {
throw new ForbiddenHttpException('You do not have privileges to view this content.');
}
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
} | [
"public function actionUpdate()\n\t{\n\t\t$post=$this->loadPost();\n\t\tif(Yii::app()->request->isPostRequest)\n\t\t{\n\t\t\tif(isset($_POST['Post']))\n\t\t\t\t$post->setAttributes($_POST['Post']);\n\t\t\tif($post->save())\n\t\t\t\t$this->redirect(array('show','id'=>$post->id));\n\t\t}\n\t\t$this->render('update',a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Add flags and structures to a "pages tree" in respect of the current page within that tree. Takes a "pages tree", as produced by user/getpagestree and adds the necessary flags, returning the tree again. TODO: would probably be more efficient if the pages tree could be passed by reference. | function publications_userapi_addcurrentpageflags($args)
{
extract($args);
if (empty($pagedata) || empty($id)) {return array();}
$targetpagekey = false;
foreach ($pagedata['pages'] as $key => $page) {
if ($page['id'] == $id) {
$targetpagekey = true;
break;
}
}
if (!$targetpagekey) return array();
if (empty($root_ids) || !is_array($root_ids)) {
$root_ids = array();
}
// Set up a bunch of flags against pages to allow hierarchical menus
// to be generated. We do not want to make any assumptions here as to
// how the menus will look and function (i.e. what will be displayed,
// what will be suppressed, hidden etc) but rather just provide flags
// that allow a template to build a menu of its choice.
//
// The basic flags are:
// 'depth' - 0 for root, counting up for each subsequent level
// 'is_ancestor' - flag indicates an ancestor of the current page
// 'is_child' - flag indicates a child of the current page
// 'is_sibling' - flag indicates a sibling of the current page
// 'is_ancestor_sibling' - flag indicates a sibling of an ancestor of the current page
// 'is_current' - flag indicates the current page
// 'is_root' - flag indicates the page is a root page of the hierarchy - good
// starting point for menus
// 'has_children' - flag indicates a page has children [done in getpagestree]
//
// Any page will have a depth flag, and may have one or more of the
// remaining flags.
// NOTE: with the exception of the following, all the above flags are
// set in previous loops.
// Point the current page at the page in the tree.
$pagedata['current_page'] =& $pagedata['pages'][$key];
// Create an ancestors array.
// Shift the pages onto the start of the array, so the resultant array
// is in order furthest ancestor towards the current page.
// The ancestors array includes the current page.
// TODO: stop at a non-ACTIVE page. Non-ACTIVE pages act as blockers
// in the hierarchy.
// Ancestors will include self - filter out in the template if required.
$pagedata['ancestors'] = array();
$this_id = $key;
// TODO: allow a 'virtual root' to stop before we reach the real root page. Used
// when we are filtering lower sections of a tree. Physically remove pages that
// do not fall into this range.
// This *could* happen if a root page is set to INACTIVE and a child page is
// set as a module alias.
$ancestor_ids = array();
while (true) {
// Set flag for menus.
$pagedata['pages'][$this_id]['is_ancestor'] = true;
// Record the id, so we don't accidently include this page again.
array_unshift($ancestor_ids, $this_id);
// Reference the page. Note we are working back down the tree
// towards the root page, so will unshift each page to the front
// of the ancestors array.
array_unshift($pagedata['ancestors'], NULL);
$pagedata['ancestors'][0] =& $pagedata['pages'][$this_id];
// Get the parent page.
try {
$id_ancestor = $pagedata['pages'][$this_id]['parent_key'];
} catch (Exception $e) {
$id_ancestor = 0;
}
// If there is no parent, then stop.
// Likewise if this is a page we have already seen (infinite loop protection).
if ($id_ancestor == 0 || in_array($id_ancestor, $ancestor_ids) || in_array($this_id, $root_ids)) {
// Make a note of the final root page.
$root_id = $this_id;
// Since we have reached the 'root' page for the purposes
// of this ancestry, make sure this root page has no parents
// by resetting any parent links.
$pagedata['pages'][$this_id]['parent_key'] = 0;
// Reference the root page in the main structure.
$pagedata['root_page'] =& $pagedata['pages'][$root_id];
// Finished the loop.
break;
}
// Move to the parent page and loop.
$this_id = $id_ancestor;
}
// Create a 'children' array for children of the current page.
$pagedata['children'] = array();
if (!empty($pagedata['current_page']['child_keys'])) {
foreach ($pagedata['current_page']['child_keys'] as $key => $child) {
// Set flag for menus. The flag 'is_child' means the page is a
// child of the 'current' page.
$pagedata['pages'][$key]['is_child'] = true;
// Reference the child page from the children array.
$pagedata['children'][$key] =& $pagedata['pages'][$child];
}
}
// TODO: create a 'siblings' array.
// Siblings are the children of the current page parent.
// The root page will have no siblings, as we want to keep this in
// a single tree.
// Siblings will include self - filter out in the template if necessary.
$pagedata['siblings'] = array();
if (!empty($pagedata['current_page']['parent_key']) && isset($pagedata['pages'][$pagedata['current_page']['parent_key']]['child_keys'])) {
// Loop though all children of the parent.
foreach ($pagedata['pages'][$pagedata['current_page']['parent_key']]['child_keys'] as $key => $child) {
// Set flag for menus.
$pagedata['pages'][$key]['is_sibling'] = true;
// Reference the page.
$pagedata['siblings'][$key] =& $pagedata['pages'][$child];
}
}
// Go through each ancestor and flag up the siblings of those ancestors.
// They will be all pages that are children of the ancestors, assuming the
// root ancestor does not have any siblings.
foreach($pagedata['ancestors'] as $key => $value) {
if (isset($value['child_keys']) && is_array($value['child_keys'])) {
foreach($value['child_keys'] as $value2) {
$pagedata['pages'][$value2]['is_ancestor_sibling'] = true;
}
}
}
$pagedata['id'] = $this_id;
$pagedata['pages'][$this_id]['is_current'] = true;
return $pagedata;
} | [
"protected function getPageTreeStructure()\n {\n // Get page record for tree starting point\n // from where we currently are navigated\n $startingPoint = $GLOBALS['TSFE']->rootLine[0]['uid'];\n $pageRecord = \\TYPO3\\CMS\\Backend\\Utility\\BackendUtility::getRecord(\n 'page... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new role for the guild. Requires the 'MANAGE_ROLES' permission. Returns the new role object on success. Fires a Guild Role Create Gateway event. | public static function createRole($guild_id)
{
$result = Api::post(
'/guilds/' . $guild_id . '/roles',
[
/**
* All JSON params are optional.
JSON Params
Field Type Description Default
name string name of the role "new role"
permissions integer bitwise of the enabled/disabled permissions @everyone permissions in guild
color integer RGB color value 0
hoist bool whether the role should be displayed separately in the sidebar false
mentionable bool whether the role should be mentionable false
*/
]
);
return RoleFactory::instatiate($result->getBody);
} | [
"public function createRole() {\n\t\t\tif (!$this->roleExists()) {\n\t\t\t\t$role = Mage::getModel('api/roles')\n\t\t\t\t\t->setName($this->rolename)\n\t\t\t\t\t->setPid(false)\n\t\t\t\t\t->setRoleType('G')\n\t\t\t\t\t->save();\n\t\t\t}\n\n\t\t\t//attach rule to role\n\t\t\tMage::getModel(\"api/rules\")\n\t\t\t\t->... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Operation getParagraphFormatAsyncWithHttpInfo Reads the formatting properties of a paragraph from the document node. | private function getParagraphFormatAsyncWithHttpInfo(Requests\getParagraphFormatRequest $request)
{
$returnType = '\Aspose\Words\Model\ParagraphFormatResponse';
$request = $request->createRequest($this->config);
return $this->client
->sendAsync($request, $this->_createHttpClientOption())
->then(
function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ($returnType === '\SplFileObject' || $returnType === 'FILES_COLLECTION') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
if ($this->config->getDebug()) {
$this->_writeResponseLog($response->getStatusCode(), $response->getHeaders(), ObjectSerializer::deserialize($content, $returnType, $response->getHeaders()));
}
return [
ObjectSerializer::deserialize($content, $returnType, $response->getHeaders()),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
if ($exception instanceof RepeatRequestException) {
$this->_requestToken();
throw new RepeatRequestException("Request must be retried", 401, null, null);
}
throw new ApiException(
sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), $response->getBody()
);
}
);
} | [
"private function getParagraphListFormatAsyncWithHttpInfo(Requests\\getParagraphListFormatRequest $request) \n {\n $returnType = '\\Aspose\\Words\\Model\\ParagraphListFormatResponse';\n $request = $request->createRequest($this->config);\n\n return $this->client\n ->sendAsync($requ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the public 'gaufrette.sylius_image_filesystem' shared service. | protected function getGaufrette_SyliusImageFilesystemService()
{
return $this->services['gaufrette.sylius_image_filesystem'] = new \Gaufrette\Filesystem(new \Gaufrette\Adapter\Local(($this->targetDirs[3].'/web/media/image'), true));
} | [
"protected function getSylius_ImageUploaderService()\n {\n return $this->services['sylius.image_uploader'] = new \\Sylius\\Component\\Core\\Uploader\\ImageUploader(${($_ = isset($this->services['knp_gaufrette.filesystem_map']) ? $this->services['knp_gaufrette.filesystem_map'] : $this->get('knp_gaufrette.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the context of a metabox by ID. | protected function get_metabox_context( $metabox ) {
$context = 'normal';
if ( in_array( $metabox, array(
'categorydiv',
'tagsdiv-post_tag',
'pageparentdiv',
), true ) ) {
$context = 'side';
} elseif ( in_array( $metabox, array(
'members-cp',
), true ) ) {
$context = 'advanced';
}
return apply_filters( 'wps_posttype_get_metabox_context', $context, $metabox, $this->post_type, $this );
} | [
"public function get_categorycontextid($id){\n\t\tglobal $remotedb;\n\t\t\n $contextid = $remotedb->get_record_sql(\"SELECT id\n FROM {context}\n WHERE contextlevel = 40 AND instanceid = ?\", array($id));\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function that doubles every other digit in the array | function double_every_other($reversed) {
// Loop through the reversed base number array and multiply each number by
// its proper weight.
foreach ($reversed as $key => $value) {
if ($key % 2 == 0) {
$reversed[$key] = $value * 2;
}
}
return $reversed;
} | [
"function tripledouble($num1, $num2)\n{\n $num1_digits = array_map('intval', str_split($num1));\n $num2_digits = array_map('intval', str_split($num2));\n\n $num1_digits_occurrences = array_count_values($num1_digits);\n $num2_digits_occurrences = array_count_values($num2_digits);\n\n $three_consecutiv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
// Funcao que fecha a conexao com o banco de dados // | public function fechaConexaoBD()
{
$_USER = "dgi";
$_HOST = "150.163.134.104:3333";
$_PWD = "dgi.2013";
$desconec = @mysql_connect($_HOST, $_USER, $_PWD) or die("NÃO CONECTADO COM O BANCO!");
mysql_close($desconec);
} | [
"function Conectar() {\n\t//Revisamos si la conexion est vacia \n\t\tif(!isset($this->conexion)){\n\t\t\t$this->conexion = (mysqli_connect($this->dbhost,$this->dbuser,$this->dbpass,$this->db)) \n\t\t\t\tor die (\"ERROR: NO se puede conectar al Gestor de Base de Datos.\" . mysqli_connect_error($this->conexion));\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WordPress will prevent post data saving if a page template has been selected that does not exist. This is especially a problem when switching themes, and old page templates are in the post data. Unset the page template if the page does not exist to allow the post to save. | public function fix_page_template( WP_Post $post ) {
$template = get_post_meta( $post->ID, '_wp_page_template', true );
$page_templates = wp_get_theme()->get_page_templates();
// If the template doesn't exists, remove the data to allow WordPress to save.
if ( ! isset( $page_templates[ $template ] ) ) {
delete_post_meta( $post->ID, '_wp_page_template' );
}
} | [
"function blackfyre_recreate_page_template_transients( $post_id = 0 ) {\n\tglobal $post;\n\tif ( ! is_admin() )\n\t\treturn $post_id;\n\n\tif ( ! $post_id )\n\t\treturn $post_id;\n\n\t// 'Add New' admin page check\n\t$page = get_post( $post_id );\n\tif(! empty($post) && is_a($post, 'WP_Post')){\n\tif ( $post->post_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the list of pubishers from the offset position, ordered by publisher name from the table 'journals' using SQL. | public function list_all_publishers($limit, $offset, $status = false, $matching = false, $search = false, $letter = false)
{
$this->db->select('trim(publisher_name) as publisher_name');
$this->db->from($this->journals_table);
$this->set_status_criteria($status);
if ($search) {
switch ($matching) {
case 'contains':
$this->db->like('publisher_name', $search);
$this->db->or_like('title_search', remove_accents($search));
break;
case 'extact_title':
$this->db->where('title_search', remove_accents($search));
$this->db->or_where('title_search', remove_accents($search));
break;
case 'starts_with':
$this->db->like('publisher_name', $search, 'after');
$this->db->or_like('title_search', remove_accents($search), 'after');
break;
}
}
if ($letter) {
$this->db->like('publisher_name', $letter, 'after');
}
$this->db->limit($limit, $offset);
$this->db->group_by('publisher_name');
$this->db->order_by('trim(publisher_name)', 'ASC');
return $this->get_results_obj();
} | [
"public function getAllPublishersOrderedById(){\n $query = \"SELECT * FROM publishers ORDER BY id\";\n $result = $this->connection->query($query);\n $result = $result->fetchAll(PDO::FETCH_ASSOC);\n $publishers = [];\n foreach($result as $data){\n $publishers[] = new Pub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the syntax highlighting object | abstract public function getSyntaxHighlighter(): SyntaxHighlighter; | [
"public function syntaxHighlighting()\n {\n return $this->withMeta([\n 'syntaxHighlighting' => true,\n ]);\n }",
"function SyntaxHighlighter() {\n\tglobal $SyntaxHighlighter;\n\n\tif ( ! isset( $SyntaxHighlighter ) ) {\n\t\t$SyntaxHighlighter = new SyntaxHighlighter();\n\t}\n\n\tret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds pre & post flags to the domainname | function _addFlags() {
$this->host = ( $this->_checkValue( 'preFlags' ) ? $this->_checkValue( 'preFlags' ) . ' ' : '' )
. $this->host
. ( $this->_checkValue( 'postFlags' ) ? ' ' . $this->_checkValue( 'postFlags' ) : '' );
} | [
"function domain_migrate_modify_subdomain(&$sd_prefix, $sd_string, $sd_modify) {\n\n if (!empty($sd_string)) { \n switch($sd_modify) {\n \n case 'add': \n $sd_prefix = $sd_string . $sd_prefix;\n break; \n case 'subtract':\n $sd_pos = strpos($sd_prefix, $sd_string); ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |