query
stringlengths
7
5.25k
document
stringlengths
15
1.06M
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
return the flash messenger value
public static function getMessage() { return unserialize($_COOKIE[self::$_name]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFlashMessage() {\n if($message = Session::get('Site.Message')){\n Session::clear('Site.Message');\n $array = new ArrayData($message);\n return $array->renderWith('FlashMessage');\n }\n }", "public function popFlashDanger() {\n\t\treturn $this->...
[ "0.78296506", "0.75873876", "0.74004704", "0.73475754", "0.73412824", "0.73076206", "0.71227473", "0.70910823", "0.70510453", "0.6975396", "0.6938368", "0.69135356", "0.6877875", "0.6856525", "0.6813749", "0.6764333", "0.67627245", "0.6738545", "0.6723661", "0.67195106", "0.6...
0.6386127
36
return the flash messenger value and reset the variable
public static function popMessage() { if (isset($_COOKIE[self::$_name])) { $message = unserialize($_COOKIE[self::$_name]); setcookie(self::$_name, "", time() - self::$_time, self::$_path); } else { $message = NULL; } return $message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function popFlashDanger() {\n\t\treturn $this->getVariable(\"flashMessageDanger\");\n\t}", "function getFlash() {\n return isset($_SESSION['flash.message']) ? $_SESSION['flash.message'] : false;\n}", "private function check_message(){\t\t\tif(isset($_SESSION['message'])){\r\n\t\t\t\t// Add it as an a...
[ "0.7214022", "0.68607426", "0.66295123", "0.6535517", "0.65351653", "0.6520989", "0.6490544", "0.6440368", "0.64181453", "0.64037174", "0.6374987", "0.62689203", "0.62656724", "0.6257856", "0.6228942", "0.62199444", "0.62153685", "0.6199445", "0.61729014", "0.61697036", "0.61...
0.6003726
31
Returns the rendered HTML template
public function __toString(): string { return container_resolve( ViewDataInterface::class, [ $this->getViewData() ] )->withTemplate($this->template); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function renderTemplate();", "public function getHtmlTemplate() {}", "public function render()\n\t{\n\t $templateFile = $this->template;\n\t $templateContents = $this->getTemplateContents($templateFile);\n\n\t $layout = $this->getTemplateLayout($templateContents);\n $arguments = $this->g...
[ "0.81362635", "0.799934", "0.7726359", "0.76758707", "0.75938416", "0.7592613", "0.75670445", "0.7564756", "0.7564756", "0.7564756", "0.7541586", "0.7481189", "0.7480332", "0.74650407", "0.7433974", "0.74248755", "0.73895067", "0.73657846", "0.734425", "0.73276126", "0.731475...
0.0
-1
Display a listing of the resource.
public function index() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for creating a new resource.
public function create() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created Problem in storage.
public function store(Request $request) { $problems = $request->input('problems'); $topicId = $request->input('topicId'); // if requests includes Problem information, store in database // attach created Problem object to the specified Topic if (!empty($problems)){ foreach ($problems as $prob){ $problem = new Problem; $problem->problem_name = $prob['problem_name']; $problem->url = $prob['url']; $problem->save(); $problem->topics()->attach($topicId); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store(Request $request, Problem $problem)\n {\n $rules = [\n 'file' => 'file'\n ];\n\n $this->validate($request, $rules);\n\n $uploadedFile = $request->file;\n $run = new Run();\n $run->file_name = $uploadedFile->getClientOriginalName();\n ...
[ "0.64421576", "0.61969244", "0.5901603", "0.5874045", "0.5816447", "0.5816447", "0.5816447", "0.5792641", "0.57516456", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", "0.5748392", ...
0.63180965
1
Display the specified resource.
public function show($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n ...
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.6833...
0.0
-1
Update the specified resource in storage.
public function update(Request $request, $id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Remove the specified resource from storage.
public function destroy($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n ...
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897...
0.0
-1
Handle an incoming request.
public function handle($request, Closure $next) { $response = $next($request); if (app()->runningInConsole() || $response instanceof RedirectResponse) { return $response; } $content = $response instanceof Response ? $response->getContent() : $response->router->iframe(); $this->checkDefinedConfig(); return new Response(view(config('app.crud.layout'), [ 'title' => config('app.crud.title'), 'content' => $content ])->render()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function handle_request();", "public function handleRequest();", "public function handleRequest();", "public function handleRequest();", "protected abstract function handleRequest();", "abstract public function handleRequest($request);", "abstract public function handleRequest(Request $...
[ "0.8299201", "0.8147294", "0.8147294", "0.8147294", "0.8127764", "0.7993589", "0.7927201", "0.7912899", "0.7899075", "0.76317674", "0.75089735", "0.7485808", "0.74074036", "0.7377414", "0.736802", "0.7294553", "0.72389543", "0.7230166", "0.72108", "0.71808434", "0.7170364", ...
0.0
-1
Creates or returns an instance of this class.
public static function get_instance() { static $instance = null; if( $instance === null ) { $instance = new self; } return $instance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function create()\n\t\t{\n\t\t\treturn new self();\n\t\t}", "public static function create() {\n\t\treturn new self();\n\t}", "public static function create()\n {\n return new self();\n }", "public static function create()\n {\n return new self();\n }", "public stati...
[ "0.81545395", "0.8128206", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295", "0.80818295",...
0.0
-1
Add field in register form
private function __construct() { add_action( 'register_form', array( $this, 'field' ) ); // Validate values add_filter( 'registration_errors', array( $this, 'registration_errors') , 10, 3 ); //Save user meta add_action( 'user_register', array( $this, 'save_meta' ), 10, 1 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function add_to_register_form() {\n\t\t$this->recaptcha->show_recaptcha( array( 'action' => ITSEC_Recaptcha::A_REGISTER ) );\n\t}", "public function register_field()\n {\n }", "public function addField();", "function addToField(\\Foundation\\Form\\Field $field);", "function ic_add_regi...
[ "0.75753456", "0.74725765", "0.728612", "0.72533625", "0.7076673", "0.69894", "0.69659483", "0.68555033", "0.6801537", "0.6768168", "0.6503087", "0.6460507", "0.6444193", "0.6399711", "0.6399711", "0.6390212", "0.6364882", "0.63470316", "0.6338419", "0.6320897", "0.632048", ...
0.0
-1
here we process request and decide if it should just goto botapi
public function processChat(Request $request) { $userInput = strtolower($request->input('say')); //if it's direction request if (strchr(strtoupper($userInput),'FROM') && strchr(strtoupper($userInput),'TO')) { $response['key'] = 'direction'; $data = BotModel::getDirections($userInput); } //if it's a dictionary request elseif(strpos($userInput, 'define') !== false) { $response['key'] = 'definition'; $data = BotModel::getDefinitions($userInput); } //if it's a job request elseif(strpos($userInput, 'job') !== false) { $response['key'] = 'job'; $pieces = explode(" ", $userInput); $location = false; if(strpos($userInput, 'in') !== false) { $location = $pieces[array_search('in', $pieces) + 1]; } $keyword = false; if(strpos($userInput, 'need') !== false) { $keyword = $pieces[array_search('need', $pieces) + 1]; if(strpos($keyword, 'job') !== false) { $keyword = false; } } $number = preg_replace('/\D/', '', $userInput); $limit = is_numeric($number) ? $number : 5; $url = $this->jobURL."?keyword=$keyword&location=$location&limit=5"; $res = UtilitiesModel::getWebPage($url); $res = json_decode($res); $jobs = false; foreach($res as $datum) { $jobs .= '<p><b>'.$datum->title.' ('.$datum->location.')</b><br>'.implode(' ', array_slice(explode(' ', $datum->summary), 0, 10)).' <a target="_blank" href="'.$datum->url.'">view</a></p><br>'; } if(!$jobs) { $data = "I didn't find any jobs."; if($keyword) { Log::info("Found keyword $keyword and $location"); $data .= " Kindly provide your email address so I can alert you when I find $keyword jobs " . (($location) ? 'in ' . $location.' ' : false) . "for you."; $this->cache['location'] = $location; $this->cache['keyword'] = $keyword; $this->cache['awaiting_email_response'] = true; Cache::put($this->convoId, $this->cache, 2); } } else { $data = $jobs; } } elseif($this->cache['awaiting_email_response'] && $email = UtilitiesModel::getEmail($userInput)) { $this->cache['awaiting_email_response'] = false; $this->cache['awaiting_email_validation'] = true; $this->cache['email'] = $email; Cache::put($this->convoId, $this->cache, 2); $data = "Should I save your email as $email?"; } elseif($this->cache['awaiting_email_validation']) { if(strpos($userInput, 'yes') !== false || strpos($userInput, 'yea') !== false) { $data = "I will send emails to ".$this->cache['email']." when I find ".$this->cache['keyword']." jobs"; $data .= $this->cache['location'] ? " in ".$this->cache['location'] : ""; $this->cache['awaiting_email_validation'] = false; $this->cache['awaiting_whatsapp_response'] = true; $data .= ". Kindly provide your whatsapp number so I can alert you when I find {$this->cache['keyword']} jobs"; $data .= $this->cache['location'] ? " in ".$this->cache['location'] : ''; Cache::put($this->convoId, $this->cache, 2); UtilitiesModel::getWebPage($this->subscribeUrl, $this->cache); } else { Cache::forget($this->convoId); $data = $this->botResponse($userInput); } } elseif($this->cache['awaiting_whatsapp_response'] && $whatsapp = UtilitiesModel::validatePhone($userInput)) { $this->cache['awaiting_whatsapp_response'] = false; $this->cache['awaiting_whatsapp_validation'] = true; $this->cache['whatsapp'] = $whatsapp; Cache::put($this->convoId, $this->cache, 2); $data = "Should I save your whatsapp number as $whatsapp?"; } elseif($this->cache['awaiting_whatsapp_validation']) { if(strpos($userInput, 'yes') !== false || strpos($userInput, 'yea') !== false) { $data = "I will send messages to ".$this->cache['whatsapp']." when I find ".$this->cache['keyword']." jobs"; $data .= $this->cache['location'] ? " in ".$this->cache['location'] : ""; $this->cache['awaiting_whatsapp_validation'] = false; $this->cache['awaiting_telegram_response'] = true; // $data .= ". Kindly provide your telegram number so I can alert you when I find {$this->cache['keyword']} jobs"; // $data .= $this->cache['location'] ? " in ".$this->cache['location'] : ''; UtilitiesModel::getWebPage($this->subscribeUrl, $this->cache); } else { Cache::forget($this->convoId); $data = $this->botResponse($userInput); } } elseif($this->cache['awaiting_telegram_response'] && $telegram = UtilitiesModel::validatePhone($userInput)) { $this->cache['awaiting_telegram_response'] = false; $this->cache['awaiting_telegram_validation'] = true; $this->cache['telegram'] = $telegram; Cache::put($this->convoId, $this->cache, 2); $data = "Should I save your telegram number as $telegram?"; } elseif($this->cache['awaiting_telegram_validation']) { if(strpos($userInput, 'yes') !== false || strpos($userInput, 'yea') !== false) { $data = "I will send messages to ".$this->cache['telegram']." when I find ".$this->cache['keyword']." jobs"; $data .= $this->cache['location'] ? " in ".$this->cache['location'] : ""; Cache::put($this->convoId, $this->cache, 2); } else { Cache::forget($this->convoId); $data = $this->botResponse($userInput); } } //if it's none elseif($userInput == 'clear') { DB::table('conversation_log')->where('convo_id', request('convo_id'))->delete(); $data = "Now we can have a fresh start!"; } else { $data = $this->botResponse($userInput); } $response['status'] = true; $response['message'] = $data; return $response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract function do_api_request();", "public function sniff_requests() {\r\n global $wp;\r\n\r\n if(isset($wp->query_vars['__api'])){\r\n $this->handle_request();\r\n exit;\r\n }\r\n }", "abstract public function handle_request();", "public function requests()\n\t{\n\t\t$this->checkReque...
[ "0.65299445", "0.6244234", "0.61338896", "0.61302006", "0.6109292", "0.6070739", "0.6042608", "0.59987915", "0.597294", "0.59036523", "0.59036523", "0.5893917", "0.5889598", "0.58877915", "0.5874798", "0.5869739", "0.5859666", "0.5858569", "0.58562094", "0.5828508", "0.582566...
0.5695775
43
Show the application dashboard.
public function index() { $matchThese = ['status' => 1, 'sents' => 0]; $neworders=Order::where($matchThese)->count(); $unpaidorders=Order::where('status',0)->count(); $from = new Carbon('last week'); $to=Carbon::today(); $newusers=User::whereBetween('created_at',[$from, $to])->count(); return view('admin.main.index',compact(['unpaidorders','neworders','newusers'])); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function dashboard()\n {\n\n $pageData = (new DashboardService())->handleDashboardLandingPage();\n\n return view('application', $pageData);\n }", "function dashboard() {\r\n\t\t\tTrackTheBookView::render('dashboard');\r\n\t\t}", "public function showDashboard() { \n\t\n ...
[ "0.77850926", "0.7760142", "0.7561336", "0.75147176", "0.74653697", "0.7464913", "0.73652893", "0.7351646", "0.7346477", "0.73420244", "0.7326711", "0.7316215", "0.73072463", "0.7287626", "0.72826403", "0.727347", "0.727347", "0.727347", "0.727347", "0.7251768", "0.7251768", ...
0.0
-1
TODO: Implement setDefaultOptions() method.
public function setDefaultOptions(OptionsResolverInterface $resolver) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _getDefaultOptions()\n {\n }", "protected function setDefaultOptions()\n {\n $this->unsigned = false;\n }", "public function setDefaultOptions(array $options);", "protected function initOptions()\n {\n }", "public function getDefaultOptions();", "public functio...
[ "0.8102202", "0.7918558", "0.77495813", "0.76479733", "0.760753", "0.760753", "0.7574474", "0.7408657", "0.7266818", "0.7255919", "0.72536474", "0.72451895", "0.72020394", "0.7186434", "0.71628743", "0.7154129", "0.70959044", "0.70820093", "0.70533353", "0.7041575", "0.704157...
0.6717513
58
performs extra validation for number input types adds message(s) to object's errors if validation errors are found
public function validateExtra(bool $change = true) { $label = new \GZMP\HTMLTag('span', array('class' => 'label'), $this->getIdentifyingText()); // check to make sure in range, numeric if (!is_numeric($this->value)) return "{$label->getHTML()} must be numeric."; // check this before minimum and maximum so that if value is changed, we make sure it's not outside the proper range $step = $this->getAttribute('step'); if (! is_null($step) && is_numeric($step) && ($remainder = fmod($this->value, $step)) != 0) { if ($change) { // set value to closest matching increment step $this->value = $this->value - $remainder + ($remainder > ($step / 2) ? $step : 0); } else { return $this->addError("{$label->getHTML()} isn't in a correct increment of {$step}."); } } $min = $this->getAttribute('min'); if (! is_null($min) && is_numeric($min) && $this->value < $min) { if ($change) { $this->value = $min; } else { return $this->addError("{$label->getHTML()} is below minimum allowed value of {$min}."); } } $max = $this->getAttribute('max'); if (! is_null($max) && is_numeric($max) && $this->value > $max) { if ($change) { $this->value = $max; } else { return $this->addError("{$label->getHTML()} is above maximum allowed value of {$max}."); } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate_is_number($field_input, array &$field): bool\n{\n if (!is_numeric($field_input)) {\n $field['error'] = 'Type in integer';\n return false;\n }\n return true;\n}", "public function testNumber()\r\n {\r\n\r\n $testData = array(\r\n 'number' => '',\r\n ...
[ "0.69244134", "0.6674316", "0.6653331", "0.6607713", "0.65993696", "0.643232", "0.639", "0.6237006", "0.6194095", "0.6114547", "0.60940814", "0.60489476", "0.6038087", "0.6010902", "0.6005032", "0.60026234", "0.5994022", "0.5946864", "0.5941952", "0.5940506", "0.5923564", "...
0.0
-1
Gets all scheduled tasks executed by this plugin.
public function getScheduledTasks(&$tasks) { $tasks[] = new ScheduledTask( 'Piwik\Plugins\CorePluginsAdmin\MarketplaceApiClient', 'clearAllCacheEntries', null, new Daily(), ScheduledTask::LOWEST_PRIORITY ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getCronTasks()\n {\n return array(\n // Cron task to check for incoming email tickets\n array(\n 'key' => 'tss_order_sync',\n 'plugin_dir' => 'thesslstore',\n 'name' => Language::_(\n 'TheSSLStorePlugin...
[ "0.71102124", "0.691206", "0.684818", "0.68444353", "0.6807654", "0.6807654", "0.673303", "0.67153317", "0.67036265", "0.67036265", "0.667695", "0.66410553", "0.65761906", "0.6525065", "0.6453267", "0.6378285", "0.6368776", "0.63155526", "0.62465566", "0.6177588", "0.6144941"...
0.6454117
14
__get Enables the use of CI superglobal without having to define an extra variable. I can't remember where I first saw this, so thank you if you are the original author. Militis
public function __get($var) { return get_instance()->$var; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ci()\n{\n\tstatic $CI;\n\tif (!$CI) $CI = get_instance();\n\treturn $CI;\n}", "function CI_Base()\n\t{\n\t\tparent::CI_Loader();\n\t\t$this->load =& $this;\n\t\t\n\t\t// This allows resources used within controller constructors to work\n\t\tglobal $OBJ;\n\t\t$OBJ = $this->load; // Do NOT use a reference...
[ "0.6347764", "0.6234206", "0.6067399", "0.5960223", "0.5923772", "0.5918367", "0.591714", "0.591714", "0.59123373", "0.5859731", "0.5858657", "0.5794372", "0.5780791", "0.57749873", "0.5764158", "0.5743179", "0.57177943", "0.5705867", "0.5649874", "0.5644415", "0.5644067", ...
0.0
-1
check Checks users online, and add users to online list
public function check() { if(!empty($this->user)) { // If you need to check users online list in every page load, check this TRUE in config file if($this->config->item('check_users_on_page_load', 'online')) { $this->checkOnlineList(); } $this->addUser(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function checkOnlineList()\n {\n $this->online->checkOnlineList($this->loginTime);\n }", "public static function updateWhoIsOnline()\n {\n $users = User::all();\n foreach($users as $u)\n {\n $lastPing = $u->last_ping;\n $twoMinAgo = Carbon::now()...
[ "0.7829768", "0.71915525", "0.7086502", "0.7036963", "0.7030495", "0.67450607", "0.671252", "0.6583092", "0.65375644", "0.6520061", "0.63896847", "0.63812935", "0.63379115", "0.6322503", "0.63222915", "0.6319637", "0.6293487", "0.62560666", "0.62289673", "0.6208892", "0.62083...
0.7113368
2
checkOnlineList Checks users online
private function checkOnlineList() { $this->online->checkOnlineList($this->loginTime); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUsersOnline()\r\n {\r\n $result = $this->getBitrixApi(array(\r\n 'FILTER' => array('IS_ONLINE' => 'Y',),\r\n ), 'user.get');\r\n\r\n if ($result) {\r\n if (isset($result['total']) && $result['total'] > 0) {\r\n return $result['result']...
[ "0.7345724", "0.7073978", "0.70617306", "0.68892986", "0.6867892", "0.6864916", "0.6840707", "0.6835407", "0.67512155", "0.6697396", "0.6697396", "0.6685548", "0.66441566", "0.6642902", "0.66096693", "0.6605822", "0.6593062", "0.65782773", "0.65550184", "0.65521514", "0.65440...
0.88326967
0
addUser Add user to online list
private function addUser() { $this->online->addUser($this->user, $this->place, $this->loginTime); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addUser(){}", "public static function addUser()\n {\n // ADD NEW DATA TO A TABLE\n // MAKE SURE TO SEND USERS TO THE /users page when a user is added\n }", "public function addUser(){\n\t}", "public function addUser($user){\n\t\t\tif(!in_array($user, $this->lobby)){\n\t\t\...
[ "0.7489906", "0.7341624", "0.7284498", "0.721324", "0.71765566", "0.6925692", "0.6894491", "0.68279076", "0.6794994", "0.675266", "0.6662102", "0.66595215", "0.6651458", "0.6646068", "0.6542056", "0.65294284", "0.6526403", "0.6525425", "0.6522657", "0.6520463", "0.65165466", ...
0.8508977
0
method loadVars when called should returnArrayWithProperData
public function test_loadVars_called_returnArrayWithProperData() { $expected = $this->getArrayContentTemplate(); $emailTemplate = new EmailTemplate(); $this->lotteryService->getNextJackpot('EuroMillions')->willReturn(new Money(10000,new Currency('EUR'))); $this->lotteryService->getNextDateDrawByLottery('EuroMillions')->willReturn(new \DateTime()); $next_draw_day = new \DateTime(); $emailTemplateDataStrategy_double = $this->getInterfaceWebDouble('IEmailTemplateDataStrategy'); $emailTemplateDataStrategy_double->getData(Argument::type('EuroMillions\web\interfaces\IEmailTemplateDataStrategy'))->willReturn([]); $data = [ 'jackpot_amount' => 100, 'draw_day_format_one' => $next_draw_day->format('l'), 'draw_day_format_two' => $next_draw_day->format('j F Y') ]; $emailTemplateDataStrategy_double->getData($emailTemplateDataStrategy_double->reveal())->willReturn($data); $sut = new LowBalanceEmailTemplate($emailTemplate, $emailTemplateDataStrategy_double->reveal()); $actual = $sut->loadVars($emailTemplateDataStrategy_double->reveal()); $this->assertEquals($expected,$actual); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function loadSesionVars() {\r\n\r\n $this->VARS = array(); \r\n\r\n $this->updateSessionExpireTime();\r\n\r\n $dati = $this->selectSessionVars();\r\n\r\n foreach($dati as $infos) { \r\n $this->VARS[$infos[\"name\"]]=unseria...
[ "0.66900533", "0.6678735", "0.64030147", "0.6383934", "0.63757026", "0.6333383", "0.62956923", "0.62934405", "0.6254016", "0.6196336", "0.61656684", "0.61656684", "0.6151887", "0.61497647", "0.61261046", "0.61143816", "0.60597646", "0.59771204", "0.59659237", "0.5941745", "0....
0.65602946
2
Show the application registration form.
public function getRegister() { return view('auth.register'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function showRegistrationForm()\n {\n abort_unless(config('access.registration'), 404);\n\n return view('frontend.auth.register');\n }", "public function showRegistrationForm()\n {\n return view('skins.' . config('pilot.SITE_SKIN') . '.auth.register');\n }", "public func...
[ "0.8297065", "0.8129581", "0.80603653", "0.80266684", "0.799944", "0.7991334", "0.79490364", "0.7943822", "0.7927548", "0.7884847", "0.7865486", "0.78399515", "0.7831668", "0.7810182", "0.7768593", "0.7721173", "0.77126104", "0.7705905", "0.7700533", "0.7687983", "0.7687317",...
0.0
-1
Handle a registration request to the application.
public function postRegister(RegistrationRequest $request) { $credentials = $request->only(['name', 'email', 'password']); $user = $this->users->create($credentials); if (!$user) { return redirect()->route('auth.register'); } event(new UserHasRegistered($user)); flash()->info(trans('authentication.account_activation')); return redirect()->home(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function registration()\n {\n \n }", "public function onRegister();", "public function register(){}", "public function register() {}", "public function registration() {\r\n \r\n if (isset($_GET[\"submitted\"])) {\r\n $this->registrationSubmit();\r\n } els...
[ "0.6979403", "0.6888007", "0.68419355", "0.6785757", "0.6777993", "0.67499214", "0.67499214", "0.67499214", "0.67499214", "0.67499214", "0.67499214", "0.67499214", "0.67499214", "0.6715186", "0.6710594", "0.6687877", "0.66852635", "0.6617978", "0.6617978", "0.6617978", "0.661...
0.0
-1
Show the application login form.
public function getLogin() { return view('auth.login'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function formLogin(){\n\t\tView::show(\"user/login\");\n\t}", "public function showLogin()\n\t{\n\t\t// show the form\n\t \treturn View::make('login');\n\t}", "public function loginAction()\r\n\t{\r\n\t\t$this->setSubTitle($this->loginSubTitle);\r\n\t\t\r\n\t\t$this->view->form = new $this->loginForm...
[ "0.82363474", "0.8112341", "0.8098614", "0.8065458", "0.8030373", "0.80252075", "0.7991413", "0.79617375", "0.7882064", "0.7876691", "0.78711575", "0.78463435", "0.78413707", "0.7834962", "0.77784806", "0.77511746", "0.7738174", "0.772751", "0.7711599", "0.7710985", "0.771098...
0.0
-1
Handle a login request to the application.
public function postLogin(SignInRequest $request) { if ($this->throttles->hasTooManyLoginAttempts($request)) { return $this->throttles->sendLockoutResponse($request); } $credentials = array_merge( $request->only(['email', 'password']), ['active' => 1] ); if ($this->auth->attempt($credentials, $request->has('remember'))) { session()->flash('app_status', 'login_success'); $this->throttles->clearLoginAttempts($request); return redirect()->intended('/'); } session()->flash( 'login_error', trans('authentication.login_error') ); $this->throttles->incrementLoginAttempts($request); return redirect()->route('auth.login') ->withInput($request->only('email', 'remember')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function handleLogin( ){\n\t\t// Filter allowed data\n\t\t$data = Request::only([ 'uid', 'password' ]);\n\n\t\t// Validate user input\n\t\t$validator = Validator::make(\n\t\t\t$data,\n\t\t\t[\n\t\t\t\t'uid' => 'required',\n\t\t\t\t'password' => 'required',\n\t\t\t]\n\t\t);\n\n\t\tforeach ($data as $key => $...
[ "0.7669814", "0.74851155", "0.7442612", "0.72329086", "0.7112905", "0.7103887", "0.70698494", "0.7055757", "0.7029516", "0.6985367", "0.6953118", "0.69134593", "0.6885101", "0.687445", "0.6863917", "0.6856037", "0.6848747", "0.684784", "0.68152297", "0.680864", "0.68045515", ...
0.0
-1
Log the user out of the application.
public function getLogout() { $this->auth->logout(); session()->flash('app_status', 'logged_out'); return redirect()->home(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function logOut()\n {\n $auth = new AuthenticationService();\n\n if ($auth->hasIdentity()) {\n Session::getDefaultManager()->forgetMe();\n $auth->clearIdentity();\n }\n }", "public function logout(){\n $this->_user->logout();\n }", "public funct...
[ "0.8105121", "0.8074796", "0.8000976", "0.79922146", "0.7947992", "0.7944206", "0.7927852", "0.7915717", "0.7901902", "0.79006684", "0.7895875", "0.78850526", "0.78815913", "0.7878597", "0.7876985", "0.78708506", "0.7865771", "0.7865345", "0.7860615", "0.78551507", "0.7824059...
0.0
-1
Check if user account can be activated or not.
protected function canBeActivated($user) { return $user->update(['activation_code' => '', 'active' => true]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function can_activate(): bool;", "function activate()\n {\n if (empty($this->userID)) $this->error('No user is loaded', __LINE__);\n if ( $this->is_active()) $this->error('Allready active account', __LINE__);\n $res = $this->db->query(\"UPDATE \".$this->usertable.\" SET \".$this->user_active.\" ...
[ "0.7429018", "0.72740954", "0.70621485", "0.70303094", "0.70240635", "0.7016996", "0.69933975", "0.69851756", "0.6940561", "0.6907332", "0.6810327", "0.6799433", "0.67153347", "0.66843295", "0.6672949", "0.6658936", "0.6632243", "0.6608393", "0.65561837", "0.65556574", "0.654...
0.6597038
18
Build a navigation bar using the $classifications array
function dynamicMenu($classifications){ $navList = '<ul>'; $navList .= "<li><a href='/phpmotors/' title='View the PHP Motors home page'>Home</a></li>"; foreach ($classifications as $classification) { $navList .= "<li><a href='/phpmotors/vehicles/?action=classification&classificationName=".urlencode($classification['classificationName'])."' title='View our $classification[classificationName] lineup of vehicles'>$classification[classificationName]</a></li>"; } $navList .= '</ul>'; return $navList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildNav($navArray)\n{\n // Build a dropdown list $classifications array\n $navList = '';\n $navList .= \"<div><a href='/phpmotors/index.php' title='View the PHP Motors home page'>Home</a></div>\";\n foreach ($navArray as $classification) {\n $navList .= \"<div><a href='/phpmotors/vehicles/in...
[ "0.71500725", "0.6944747", "0.6782555", "0.67732614", "0.66652083", "0.64630353", "0.64618427", "0.63763696", "0.63430667", "0.63146335", "0.62852085", "0.62432545", "0.6232835", "0.6172886", "0.61571664", "0.61344826", "0.61207503", "0.6117479", "0.6116228", "0.6037143", "0....
0.6684448
4
Check the password for a minimum of 8 characters, at least one 1 capital letter, at least 1 number and at least 1 special character
function checkPassword($clientPassword){ $pattern = '/^(?=.*[[:digit:]])(?=.*[[:punct:]])(?=.*[A-Z])(?=.*[a-z])([^\s]){8,}$/'; return preg_match($pattern, $clientPassword); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_password($password)\n{\n if (strlen($password) < 8) {\n throw new Exception(\"password_short.\", 1);\n return false;\n }\n if (!preg_match(\"/[0-9]{1,}/\", $password) || !preg_match(\"/[A-Z]{1,}/\", $password)) {\n throw new Exception(\"password_bad\", 1);\n retu...
[ "0.8070311", "0.8020083", "0.7886989", "0.7879418", "0.7818022", "0.7809847", "0.7809847", "0.78092045", "0.7797603", "0.77616775", "0.7728333", "0.76601297", "0.7637825", "0.7576043", "0.7526579", "0.7526579", "0.7526579", "0.75181526", "0.74897426", "0.7455564", "0.7449323"...
0.7845265
4
Build the classifications select list
function buildClassificationList($classifications){ $classificationList = '<select name="classificationId" id="classificationList">'; $classificationList .= "<option>Choose a Classification</option>"; foreach ($classifications as $classification) { $classificationList .= "<option value='$classification[classificationId]'>$classification[classificationName]</option>"; } $classificationList .= '</select>'; return $classificationList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildClassificationList($classifications)\n{\n $classificationList = '<select name=\"classificationId\" id=\"classificationList\">';\n $classificationList .= \"<option>Choose a Classification</option>\";\n foreach ($classifications as $classification) {\n $classificationList .= \"<option value=...
[ "0.78847694", "0.6640465", "0.62988997", "0.62259257", "0.616417", "0.60691726", "0.6025562", "0.5884363", "0.58370405", "0.5767028", "0.5751865", "0.5743982", "0.57101256", "0.5708095", "0.56958336", "0.5680058", "0.56152344", "0.5586126", "0.55670166", "0.55496097", "0.5511...
0.80517733
0
Build table of vehicles by classification
function buildVehiclesDisplay($vehicles){ $dv = '<ul id="inv-display">'; foreach ($vehicles as $vehicle) { $dv .= '<li>'; $dv .= "<a href='/phpmotors/vehicles/?action=vehicle-detail&invId=".urlencode($vehicle['invId'])."'><img src='$vehicle[imgPath]' alt='Image of $vehicle[invMake] $vehicle[invModel] on phpmotors.com'></a>"; $dv .= '<hr>'; $dv .= "<a href='/phpmotors/vehicles/?action=vehicle-detail&invId=".urlencode($vehicle['invId'])."'><h2>$vehicle[invMake] $vehicle[invModel]</h2></a>"; $dv .= "<span>$vehicle[invPrice]</span>"; $dv .= '</li>'; } $dv .= '</ul>'; return $dv; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCategorizedTables() {}", "public function classify($tableName);", "function build_table($new,$array_cat){\n\t\t//de categorias de serviceo.\n\t\t//Hacemos las iniciaciones pertinentes para intentar\n\t\t//aclarar un poco el codigo\n\t\t$ini_fila=\"<tr>\";\n\t\t$fin_fila=\"</tr>\";\n\t\t$ini_...
[ "0.5685896", "0.56152964", "0.5585336", "0.541483", "0.5381089", "0.5367708", "0.5274978", "0.52230334", "0.5207936", "0.51745886", "0.51711804", "0.5141213", "0.5089362", "0.5071022", "0.50492764", "0.5045722", "0.5029012", "0.49953613", "0.498474", "0.4953292", "0.4921502",...
0.0
-1
Build table of vehicles by ID
function vehiclesDisplayInfo($vehicleInfo,){ //store the arrayinfo in variables $invMake = $vehicleInfo['0']['invMake']; $invModel = $vehicleInfo['0']['invModel']; $invDescription = $vehicleInfo['0']['invDescription']; $invPrice = $vehicleInfo['0']['invPrice']; $invStock = $vehicleInfo['0']['invStock']; $invColor = $vehicleInfo['0']['invColor']; $imgPath = $vehicleInfo['0']['imgPath']; $detail = "<div id='imageDetail'>"; $detail = "<div id='imageDetail'>"; $detail .= "<img src='$imgPath' alt='Image of $invMake $invModel'>"; $detail .= '</div>'; $detail .= '<div>'; $detail .= "<h2>$invMake $invModel</h2>"; $detail .="<p><span>Model</span>: $invModel</p>"; $detail .="<p><span>Make</span>: $invMake</p>"; $detail .="<hr>"; $detail .="<h3>Description</h3>"; $detail .="<p>$invDescription</p>"; $detail .="<p><span>Color</span>: $invColor</p>"; $detail .="<p><span>Stock:</span>: $invStock</p>"; $price= number_format($invPrice, 2,',','.'); $detail .="<p id='price'><span>Price</span>: $$price</p>"; $detail .= '</div>'; return $detail; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function table_voltooid($conn)\n\t{\n\t\t$data=prepare_data_volt($conn);\n\t\t\n\t\tfor ($i=0;$i<count($data);$i++)\n\t\t{\n\t\t\techo \"<tr>\";\n\t\t\tforeach($data[$i] as $best)\n\t\t\t{\n\t\t\t\techo \"<td>$best</td>\";\n\t\t\t}\n\t\t\techo \"</tr>\";\n\t\t}\n\t}", "function create_table($id, $data, $headers=...
[ "0.60493976", "0.59130245", "0.5860502", "0.5813905", "0.5765854", "0.5750921", "0.5750503", "0.5698211", "0.5671879", "0.5650434", "0.5645319", "0.56325865", "0.55617666", "0.54598206", "0.5360614", "0.5355763", "0.5355763", "0.53297055", "0.5311116", "0.52919203", "0.528932...
0.0
-1
/ Functions for working with images Adds "tn" designation to file name
function makeThumbnailName($image) { $i = strrpos($image, '.'); $image_name = substr($image, 0, $i); $ext = substr($image, $i); $image = $image_name . '-tn' . $ext; return $image; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeThumbnailName($image)\n{\n $i = strrpos($image, '.');\n $image_name = substr($image, 0, $i);\n $ext = substr($image, $i);\n $image = $image_name . '-tn' . $ext;\n return $image;\n}", "protected function imageName() {}", "public function getImageName();", "private function createImageNa...
[ "0.76361454", "0.74944025", "0.68055826", "0.66019374", "0.6599242", "0.6576761", "0.65444136", "0.6507727", "0.6493835", "0.64035404", "0.64034975", "0.6264035", "0.6226564", "0.621767", "0.62126434", "0.61867845", "0.615337", "0.61518663", "0.6137972", "0.613783", "0.613768...
0.764747
0
Build images display for image management view
function buildImageDisplay($imageArray) { $id = '<ul id="image-display">'; foreach ($imageArray as $image) { $id .= '<li>'; $id .= "<img src='$image[imgPath]' title='$image[invMake] $image[invModel] image on PHP Motors.com' alt='$image[invMake] $image[invModel] image on PHP Motors.com'>"; $id .= "<p><a href='/phpmotors/uploads?action=delete&imgId=$image[imgId]&filename=$image[imgName]' title='Delete the image'>Delete $image[imgName]</a></p>"; $id .= '</li>'; } $id .= '</ul>'; return $id; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function combineImages() {}", "function buildImageDisplay($imageArray)\n{\n $id = '<ul id=\"image-display\">';\n foreach ($imageArray as $image) {\n $id .= '<li>';\n $id .= \"<img src='$image[imgPath]' title='$image[invMake] $image[invModel] image on PHP Motors.com' alt='$image[invMake] $...
[ "0.66767216", "0.6653933", "0.662097", "0.6508861", "0.6464377", "0.64505446", "0.64118344", "0.6403195", "0.6401963", "0.6396919", "0.63388807", "0.6326887", "0.63045967", "0.629498", "0.62719315", "0.6271095", "0.6270881", "0.6254747", "0.62450004", "0.62233055", "0.6221337...
0.6767184
0
Build the vehicles select list
function buildVehiclesSelect($vehicles) { $prodList = '<select name="invId" id="invId">'; $prodList .= "<option>Choose a Vehicle</option>"; foreach ($vehicles as $vehicle) { $prodList .= "<option value='$vehicle[invId]'>$vehicle[invMake] $vehicle[invModel]</option>"; } $prodList .= '</select>'; return $prodList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildVehiclesSelect($vehicles)\n{\n $prodList = '<select name=\"invId\" id=\"invId\">';\n $prodList .= \"<option>Choose a Vehicle</option>\";\n foreach ($vehicles as $vehicle) {\n $prodList .= \"<option value='$vehicle[invId]'>$vehicle[invMake] $vehicle[invModel]</option>\";\n }\n $prodList...
[ "0.7584048", "0.66605157", "0.605245", "0.6036802", "0.5951677", "0.5943212", "0.5908782", "0.5883085", "0.5868457", "0.5715422", "0.570622", "0.5702444", "0.5682596", "0.5668327", "0.5666378", "0.5661099", "0.56583834", "0.5655364", "0.5651713", "0.5647812", "0.56468326", ...
0.78088266
0
Handles the file upload process and returns the path The file path is stored into the database
function uploadFile($name) { // Gets the paths, full and local directory global $image_dir, $image_dir_path; if (isset($_FILES[$name])) { // Gets the actual file name $filename = $_FILES[$name]['name']; if (empty($filename)) { return; } // Get the file from the temp folder on the server $source = $_FILES[$name]['tmp_name']; // Sets the new path - images folder in this directory $target = $image_dir_path . '/' . $filename; // Moves the file to the target folder move_uploaded_file($source, $target); // Send file for further processing processImage($image_dir_path, $filename); // Sets the path for the image for Database storage $filepath = $image_dir . '/' . $filename; // Returns the path where the file is stored return $filepath; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function uploadPath();", "public function handle_upload()\n {\n }", "public function getUploadedFilePath()\n {\n return !empty($this->filepath) ? $this->filepath : \n (!empty($this->filename) ? (Yii::$app->params['uploadPath'] . $this->filename) : null);\n }", ...
[ "0.7407422", "0.7088717", "0.7075692", "0.6971553", "0.68665946", "0.6832987", "0.6820952", "0.67938834", "0.6791494", "0.6741928", "0.6738314", "0.67152804", "0.6682245", "0.66656154", "0.6647367", "0.6637334", "0.6629151", "0.6602371", "0.65785533", "0.65688777", "0.6562753...
0.0
-1
Processes images by getting paths and creating smaller versions of the image
function processImage($dir, $filename) { // Set up the variables $dir = $dir . '/'; // Set up the image path $image_path = $dir . $filename; // Set up the thumbnail image path $image_path_tn = $dir.makeThumbnailName($filename); // Create a thumbnail image that's a maximum of 200 pixels square resizeImage($image_path, $image_path_tn, 200, 200); // Resize original to a maximum of 500 pixels square resizeImage($image_path, $image_path, 500, 500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function processImageStack() {\n\n foreach($this->imagePath as $imagePath) {\n $this->processSingleImage($imagePath);\n }\n }", "protected function combineImages() {}", "protected function processImage() {}", "private function generate()\n {\n $originalImages = S...
[ "0.71595985", "0.68345433", "0.67023957", "0.6509673", "0.6453629", "0.6415463", "0.62737244", "0.61988723", "0.61672896", "0.6140493", "0.6051794", "0.6050297", "0.6038673", "0.6007389", "0.5968761", "0.5933317", "0.59270424", "0.59164745", "0.58583045", "0.58471507", "0.583...
0.560764
41
Checks and Resizes image
function resizeImage($old_image_path, $new_image_path, $max_width, $max_height) { // Get image type $image_info = getimagesize($old_image_path); $image_type = $image_info[2]; // Set up the function names switch ($image_type) { case IMAGETYPE_JPEG: $image_from_file = 'imagecreatefromjpeg'; $image_to_file = 'imagejpeg'; break; case IMAGETYPE_GIF: $image_from_file = 'imagecreatefromgif'; $image_to_file = 'imagegif'; break; case IMAGETYPE_PNG: $image_from_file = 'imagecreatefrompng'; $image_to_file = 'imagepng'; break; default: return; } // ends the swith // Get the old image and its height and width $old_image = $image_from_file($old_image_path); $old_width = imagesx($old_image); $old_height = imagesy($old_image); // Calculate height and width ratios $width_ratio = $old_width / $max_width; $height_ratio = $old_height / $max_height; // If image is larger than specified ratio, create the new image if ($width_ratio > 1 || $height_ratio > 1) { // Calculate height and width for the new image $ratio = max($width_ratio, $height_ratio); $new_height = round($old_height / $ratio); $new_width = round($old_width / $ratio); // Create the new image $new_image = imagecreatetruecolor($new_width, $new_height); // Set transparency according to image type if ($image_type == IMAGETYPE_GIF) { $alpha = imagecolorallocatealpha($new_image, 0, 0, 0, 127); imagecolortransparent($new_image, $alpha); } if ($image_type == IMAGETYPE_PNG || $image_type == IMAGETYPE_GIF) { imagealphablending($new_image, false); imagesavealpha($new_image, true); } // Copy old image to new image - this resizes the image $new_x = 0; $new_y = 0; $old_x = 0; $old_y = 0; imagecopyresampled($new_image, $old_image, $new_x, $new_y, $old_x, $old_y, $new_width, $new_height, $old_width, $old_height); // Write the new image to a new file $image_to_file($new_image, $new_image_path); // Free any memory associated with the new image imagedestroy($new_image); } else { // Write the old image to a new file $image_to_file($old_image, $new_image_path); } // Free any memory associated with the old image imagedestroy($old_image); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function checkImage()\n\t{\n\t\tif (!$this->imageResized) {\n\t\t\t$this->resize($this->width, $this->height);\n\t\t}\n\t}", "private function resize() {\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$originalImage = imagecreatefromjpeg($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/p...
[ "0.8113505", "0.7085443", "0.70314085", "0.68301684", "0.68097025", "0.6801972", "0.67775345", "0.67615557", "0.6752481", "0.6678836", "0.66656107", "0.66516554", "0.66501224", "0.66137785", "0.6577751", "0.6572114", "0.65445787", "0.6540436", "0.6525844", "0.6522556", "0.651...
0.6120032
83
ends resizeImage function / Reviews Functions
function displayReviews($reviews){ $reviewConatainer="<ul id='reviews'>"; foreach($reviews as $blocks){ $reviewConatainer.='<li>'; // take first character from first name $clientName = substr($blocks['clientFirstname'], 0,1); // transform to uppercase $clientName = strtoupper($clientName); // transform fist character from Lastname to uppercase $clientLasname = ucfirst($blocks['clientLastname']); $userReviewName = $clientName.$clientLasname; //Simplify date $date = substr($blocks['reviewDate'],0,10); $reviewConatainer.="<p><span>$userReviewName</span> wrote on $date</p>"; $reviewConatainer.="<p class='reviewText'>$blocks[reviewText]</p>"; $reviewConatainer.='</li>'; } $reviewConatainer.='</ul>'; return $reviewConatainer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function resize() {\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$originalImage = imagecreatefromjpeg($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t$originalImage = imagecreatefrompng($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\t$originalImage = ima...
[ "0.7226951", "0.72027385", "0.71870244", "0.7103431", "0.7094963", "0.7039208", "0.7012308", "0.69961786", "0.69903344", "0.6964784", "0.6963558", "0.6930311", "0.6909252", "0.68589705", "0.6849555", "0.6824427", "0.682291", "0.679686", "0.6771909", "0.67260414", "0.67086107"...
0.0
-1
Display reviwes manaement veiw
function reviewsMangment($userReviews){ $rc = "<ul>"; foreach ($userReviews as $review){ $date = substr($review['reviewDate'],0,10); $rc .="<li> $review[invMake] $review[invModel] $date <a href='/phpmotors/reviews/?action=update-review&reviewId=".urlencode($review['reviewId'])."'>Edit</a> | <a href='/phpmotors/reviews/?action=delete-review&reviewId=".urlencode($review['reviewId'])."'>Delete</a> </li>"; } $rc .= '</ul>'; return $rc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function affiche (){\n\t\t\t//affiche en retour à la ligne\n\t\t\techo '<pre>';\n\t\t\tprint_r(array(\n\t\t\t\tname=>$this->Getname(),\n\t\t\t\tpv=>$this->Getpv(),\n\t\t\t\tlevel=>$this->Getlevel(),\n\t\t\t\tattack1=>$this->Getattack1(),\n\t\t\t\tattack2=>$this->Getattack2(),\n\t\t\t\ttype=>$this->Gettype()...
[ "0.6146755", "0.60834306", "0.5960743", "0.5910915", "0.58897215", "0.5688248", "0.5672813", "0.56533855", "0.5647011", "0.56231403", "0.5581109", "0.5564898", "0.5560913", "0.55602664", "0.5548997", "0.55343515", "0.5518477", "0.5485794", "0.54725397", "0.5461679", "0.541131...
0.0
-1
Display the specified resource.
public function show($id) { $data = Cate::find($id); return [ 'result' => new Result(true), 'data' => $data, ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id...
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245...
0.0
-1
Update the specified resource in storage.
public function update(CateUpdateRequest $request, $id) { $cate = Cate::find($id); $cate->fill($request->input()); $cate->save(); return [ 'result' => new Result(true), 'cate' => $cate ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ...
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890...
0.0
-1
Function used to set job response
public function setResponse(bool $success, string $message = '', $content = null): self { $this->response = new ResponseModel($success, $message, $content); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setResponse() {\n }", "function set_Json_Response()\n {\n $this->setCommand();\n //Fire Script \n $this->fire_Script();\n $response = array(\"status\"=>$this->status,\n \"script_ouput\"=>$this->script_output,\n ...
[ "0.6955188", "0.63468874", "0.59772277", "0.59672487", "0.59569657", "0.5909629", "0.58698195", "0.58636844", "0.58546287", "0.5849248", "0.5826125", "0.57500404", "0.5709512", "0.5672829", "0.565541", "0.56550103", "0.5651117", "0.56470084", "0.56395155", "0.56302196", "0.56...
0.0
-1
Getter for job response
public function getResponse(): ResponseModel { return $this->response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getJob()\n {\n return $this->job;\n }", "public function getJob()\n {\n return $this->job;\n }", "function get_response() {\n return $this->response;\n }", "protected function getResponse()\n {\n return $this->response;\n }", "public function getResponse()...
[ "0.6734401", "0.6734401", "0.6727866", "0.67125434", "0.66979074", "0.66979074", "0.66979074", "0.668678", "0.6682224", "0.6664702", "0.6662667", "0.66602707", "0.66389066", "0.66083246", "0.66066056", "0.6604454", "0.6604454", "0.6587935", "0.65866965", "0.65866965", "0.6586...
0.0
-1
Create a new user This command creates a new user which has access to the backend user interface. It is recommended to user the email address as a username.
public function createAccountCommand($username, $password, $roles, $authenticationProvider = 'DefaultProvider') { $account = $this->accountFactory->createAccountWithPassword($username, $password, explode(',', $roles), $authenticationProvider); $this->accountRepository->add($account); $this->outputLine('Created account "%s".', array($username)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createUser()\n {\n $this->question('Enter your details for the admin user.');\n\n $user = \\App\\User::create([\n 'name' => $this->ask('Name', 'Admin'),\n 'email' => $this->ask('Email address', 'noreply@'.str_replace(['http://', 'https://'], '', config('app...
[ "0.7808013", "0.7639282", "0.7437577", "0.7408493", "0.7402834", "0.7402834", "0.7402834", "0.7402834", "0.7204184", "0.7102936", "0.7093755", "0.70836735", "0.7083158", "0.70817983", "0.7067123", "0.7065401", "0.7062736", "0.7054613", "0.69758433", "0.6972999", "0.69536614",...
0.0
-1
Set a new password for the given user This allows for setting a new password for an existing user account.
public function setPasswordCommand($username, $password, $authenticationProvider = 'DefaultProvider') { $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($username, $authenticationProvider); if (!$account instanceof \TYPO3\Flow\Security\Account) { $this->outputLine('User "%s" does not exist.', array($username)); $this->quit(1); } $account->setCredentialsSource($this->hashService->hashPassword($password, 'default')); $this->accountRepository->update($account); $this->outputLine('The new password for user "%s" was set.', array($username)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function changePassword(User $user, string $newPassword): void;", "public function setPassword($newPassword);", "public function setPassword($userid, $password);", "public function savePasswordToUser($user, $password);", "public function setPassword($newPassword){\n\t}", "private function setEncry...
[ "0.800322", "0.78537005", "0.7814909", "0.7690685", "0.76173264", "0.7614786", "0.7514632", "0.74557436", "0.7414512", "0.7413278", "0.73913443", "0.73728204", "0.73714644", "0.73094", "0.7309104", "0.72929764", "0.72840303", "0.72679484", "0.7266989", "0.72617227", "0.722054...
0.0
-1
Add a role to a user This command allows for adding a specific role to an existing user. Currently supported roles: "Editor", "Administrator"
public function addRoleCommand($username, $role, $authenticationProvider = 'DefaultProvider') { $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($username, $authenticationProvider); if (!$account instanceof \TYPO3\Flow\Security\Account) { $this->outputLine('User "%s" does not exist.', array($username)); $this->quit(1); } $role = new \TYPO3\Flow\Security\Policy\Role($role); if ($account->hasRole($role)) { $this->outputLine('User "%s" already has the role "%s" assigned.', array($username, $role)); $this->quit(1); } $account->addRole($role); $this->accountRepository->update($account); $this->outputLine('Added role "%s" to user "%s".', array($role, $username)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addRole($username, $role);", "public function add_role($role)\n {\n }", "function add_role($role, $display_name, $capabilities = array())\n {\n }", "public function AddRole ($roleName = NULL, $idRole = NULL);", "public function addRoleToUser() {\n\t\tif (self::userHasRol...
[ "0.78929883", "0.76876915", "0.74237394", "0.73169243", "0.72742784", "0.71059334", "0.7093353", "0.70523655", "0.70049286", "0.69236803", "0.69236803", "0.6915478", "0.6877522", "0.68172604", "0.66711676", "0.6635117", "0.66057265", "0.6603692", "0.6600718", "0.6597044", "0....
0.69706064
9
Remove a role from a user
public function removeRoleCommand($username, $role, $authenticationProvider = 'DefaultProvider') { $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($username, $authenticationProvider); if (!$account instanceof \TYPO3\Flow\Security\Account) { $this->outputLine('User "%s" does not exist.', array($username)); $this->quit(1); } $role = new \TYPO3\Flow\Security\Policy\Role($role); if (!$account->hasRole($role)) { $this->outputLine('User "%s" does not have the role "%s" assigned.', array($username, $role)); $this->quit(1); } $account->removeRole($role); $this->accountRepository->update($account); $this->outputLine('Removed role "%s" from user "%s".', array($role, $username)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function removeRole($username, $role);", "function remove_role($role)\n {\n }", "public function remove_role($role)\n {\n }", "public function remove_role($role)\n {\n }", "public function removing_user_from_role_works()\n {\n $this->withoutExceptionHandli...
[ "0.8328603", "0.8047605", "0.80001885", "0.79981226", "0.7838622", "0.77902114", "0.77600473", "0.7727452", "0.7659778", "0.74432653", "0.7421057", "0.7352167", "0.73409647", "0.7229905", "0.721011", "0.70708543", "0.69848835", "0.6951225", "0.6941198", "0.6930036", "0.691814...
0.6370081
73
load the user profile from the IDp api client
function getUserProfile() { try{ $data = $this->api->getProfile( $this->api->getCurrentUserId() ); } catch( Exception $e ){ throw new Exception( "User profile request failed! {$this->providerId} returned an error while requesting the user profile.", 6 ); } if ( ! is_object( $data ) ) { throw new Exception( "User profile request failed! {$this->providerId} returned an invalide response.", 6 ); } $this->user->profile->identifier = $this->api->getCurrentUserId(); $this->user->profile->displayName = @ $data->basicprofile->name; $this->user->profile->description = @ $data->aboutme; $this->user->profile->gender = @ $data->basicprofile->gender; $this->user->profile->photoURL = @ $data->basicprofile->image; $this->user->profile->profileURL = @ $data->basicprofile->webUri; $this->user->profile->age = @ $data->age; $this->user->profile->country = @ $data->country; $this->user->profile->region = @ $data->region; $this->user->profile->city = @ $data->city; $this->user->profile->zip = @ $data->postalcode; return $this->user->profile; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUserProfile() {\n\n\t\t$data = $this->api->get( 'people/~:('. implode(',', $this->config['fields']) .')?format=json' );\n\n\t\t// if the provider identifier is not received, we assume the auth has failed\n\t\tif ( ! isset( $data->id ) ) {\n\t\t\tthrow new Exception( \"User profile request failed...
[ "0.70147586", "0.69734836", "0.69304895", "0.69040716", "0.6845906", "0.6828981", "0.68215376", "0.67172414", "0.668077", "0.6634352", "0.656285", "0.6529293", "0.6527742", "0.6527256", "0.6527256", "0.6507267", "0.65028745", "0.6475412", "0.6470527", "0.64657557", "0.6409142...
0.6858198
4
Create a new command instance.
public function __construct() { parent::__construct(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function newCommand() {\n return newinstance(Command::class, [], '{\n public static $wasRun= false;\n public function __construct() { self::$wasRun= false; }\n public function run() { self::$wasRun= true; }\n public function wasRun() { return self::$wasRun; }\n }');\n }", "pu...
[ "0.8010746", "0.7333379", "0.72606754", "0.7164165", "0.716004", "0.7137585", "0.6748632", "0.67234164", "0.67178184", "0.6697025", "0.6677973", "0.66454077", "0.65622073", "0.65437883", "0.64838654", "0.64696646", "0.64292693", "0.6382209", "0.6378306", "0.63773245", "0.6315...
0.0
-1
Execute the console command.
public function handle() { foreach (BoardConfiguration::where('task_id', '!=', '')->get() as $Setting) { $this->User = User::find($Setting->user_id); Auth::login($this->User); $Class = "App\\Console\\Commands\\Task\\Tasks\\{$Setting->tasks[$Setting->task_id]}"; $Task = new $Class; $Task->boot($Setting, $this->User); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function handle()\n {\n\t\t$this->info('league fetching ..');\n $object = new XmlFeed();\n\t\t$object->fetchLeague($this->argument('sports_id'));\n\t\t$this->info('league saved');\n }", "public function handle()\n {\n //get us the Converter class instance and call the convert() meth...
[ "0.6469962", "0.6463639", "0.64271367", "0.635053", "0.63190264", "0.62747604", "0.6261977", "0.6261908", "0.6235821", "0.62248456", "0.62217945", "0.6214421", "0.6193356", "0.61916095", "0.6183878", "0.6177804", "0.61763877", "0.6172579", "0.61497146", "0.6148907", "0.614841...
0.0
-1
Condition used to check if a content element is in a certain column This is used in the Permissions.ts TSConfig file to make sure only certain content elements are placed in certain columns.
public function matchCondition(array $conditionParameters) { $result = false; if (0 === count($conditionParameters)) { $result = true; } else { $colPos = (int)$conditionParameters[0]; $get = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(); // Case 2). Adding a new element using the new-element icon if (isset($get['colPos'])) { $result = $colPos === (int)$get['colPos']; // Case 3). Right after new element creation } elseif (isset($get['defVals']['tt_content']['colPos'])) { $result = $colPos === (int)$get['defVals']['tt_content']['colPos']; // Case 1). edit one or more existing elements } elseif (isset($get['edit']['tt_content'])) { $getUid = $get['edit']['tt_content']; if (is_array($getUid)) { $uid = (int)abs(rtrim(key($getUid), ',')); $result = $colPos === $this->getColPosFromDatabase($uid); } // Case 4). Elements pasted from a clipboard } elseif (is_array($get['CB'])) { $newColPosData = $GLOBALS['BE_USER']->getSessionData('core.www_tue_ce.newColPos'); if (is_array($newColPosData) && ($colPos == $newColPosData['colPos'])) { $result = true; }; } } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function beUserHasRightToSeeMultiColumnContainer () {\r\n\t\t$hasAccess = true;\r\n\t\t$TSconfig = t3lib_BEfunc::getPagesTSconfig($GLOBALS['SOBE']->id);\r\n\t\t\r\n\t\t\t// check remove items\r\n\t\tif(!empty($TSconfig['TCEFORM.']['tt_content.']['CType.']['removeItems'])) {\r\n\t\t\t$hasAccess = t3li...
[ "0.6062957", "0.5882016", "0.577921", "0.57612467", "0.5696731", "0.56465274", "0.5608349", "0.5556337", "0.55024123", "0.5495213", "0.5486442", "0.5465334", "0.5418901", "0.5388088", "0.5380476", "0.5376956", "0.5375346", "0.531481", "0.53114223", "0.5308563", "0.52926284", ...
0.0
-1
Get the colPos from a content element in the database
protected function getColPosFromDatabase($contentElementUid) { $queryResult = $this->getDatabaseConnection()->sql_query( 'SELECT colPos FROM tt_content WHERE uid =' . $contentElementUid ); /** @var array $contentElement */ $contentElement = $this->getDatabaseConnection()->sql_fetch_assoc($queryResult); $this->getDatabaseConnection()->sql_free_result($queryResult); return (int)$contentElement['colPos']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPositionColumn();", "public function columnOffset();", "protected function getPositionColumn()\n {\n return $this->positionColumn ?? 'position';\n }", "public function getColumn(){\n\n $part = substr($this->input, 0, $this->index);\n $pos = strrpos($part,\"\\n\")...
[ "0.76174587", "0.7289113", "0.68652093", "0.66942096", "0.6408288", "0.6118814", "0.6085125", "0.6034319", "0.5988009", "0.5843853", "0.58199114", "0.5746704", "0.5730189", "0.57267284", "0.57145965", "0.56802636", "0.5676263", "0.5662575", "0.5657394", "0.56508076", "0.56463...
0.73617625
1
Get the database connection
protected function getDatabaseConnection() { return $GLOBALS['TYPO3_DB']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getConnection()\n\t{\n\t\treturn empty($this->db_conn) ? Db::getConnection($this->getConnectionName()) : $this->db_conn;\n\t}", "public static function get_connection() {\n if (static::$instance === null) {\n static::$instance = new Database;\n }\n return static::$...
[ "0.8697612", "0.8605568", "0.85822105", "0.8569528", "0.85384864", "0.849004", "0.84641755", "0.84612453", "0.8457801", "0.84310544", "0.8425498", "0.8411327", "0.8397318", "0.8361616", "0.8361616", "0.8347151", "0.8331177", "0.829789", "0.8288185", "0.8281096", "0.82805854",...
0.8286199
26
This test can be only run in php53. That is beacuse ENT_IGNORE is not available in earlier versions of php
public function itReplacesBadCharacters() { $bad_chars = array( "\x01" => ' ', "\x02" => ' ', "\x03" => ' ', "\x04" => ' ', "\x05" => ' ', "\x06" => ' ', "\x07" => ' ', "\x08" => ' ', "\x0b" => ' ', "\x0c" => ' ', "\x0e" => ' ', "\x0f" => ' ', "\x11" => ' ', "’" => '&rsquo;', ); foreach ($bad_chars as $bad_char => $replace) { $string = htmlentities($bad_char, ENT_IGNORE, 'UTF-8'); $bad_text = html_entity_decode($string, ENT_IGNORE, 'ISO-8859-1'); $returned = Encoding_SupportedXmlCharEncoding::getXMLCompatibleString($bad_text); $this->assertEqual($returned, $replace); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testNoEncodeImmuneCharsForXML()\n {\n $this->assertEquals(\n 'testTEST0123,.-_ ',\n $this->_xmlEntityCodec->encode(\n $this->_immune_xml,\n 'testTEST0123,.-_ '\n )\n );\n }", "public function testParseHtmlEntities(...
[ "0.6475374", "0.62963563", "0.62661266", "0.61922497", "0.6145783", "0.61179906", "0.59609157", "0.59336513", "0.5931832", "0.5898189", "0.58377635", "0.5817503", "0.5809556", "0.5790638", "0.57647306", "0.57581663", "0.5741571", "0.5735994", "0.5688061", "0.56790704", "0.566...
0.56630385
21
/ Create a merchantAuthenticationType object with authentication details retrieved from the constants file
public function update_customer_profile($card_details, $customerProfileId = "1511420207", $customerPaymentProfileId = "1511265906"){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($this->authorize['merchant_login_id']); $merchantAuthentication->setTransactionKey($this->authorize['merchant_transaction_key']); // Set the transaction's refId $refId = 'ref' . time(); // echo $customerProfileId;die; $request = new AnetAPI\GetCustomerPaymentProfileRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId( $refId); $request->setCustomerProfileId($customerProfileId); $request->setCustomerPaymentProfileId($customerPaymentProfileId); $controller = new AnetController\GetCustomerPaymentProfileController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); // $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { $billto = new AnetAPI\CustomerAddressType(); $billto = $response->getPaymentProfile()->getbillTo(); $creditCard = new AnetAPI\CreditCardType(); $creditCard->setCardNumber((int) $card_details['card_number'] ); $creditCard->setExpirationDate($card_details['expiry']); $creditCard->setCardCode($card_details['cvc']); $paymentCreditCard = new AnetAPI\PaymentType(); $paymentCreditCard->setCreditCard($creditCard); $paymentprofile = new AnetAPI\CustomerPaymentProfileExType(); $paymentprofile->setCustomerPaymentProfileId($customerPaymentProfileId); $paymentprofile->setPayment($paymentCreditCard); // Submit a UpdatePaymentProfileRequest $request = new AnetAPI\UpdateCustomerPaymentProfileRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setCustomerProfileId($customerProfileId); $request->setPaymentProfile( $paymentprofile ); $controller = new AnetController\UpdateCustomerPaymentProfileController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); // $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) { $payment_method['card_name'] = $card_details['card_name']; $payment_method['card_number'] = substr($card_details['card_number'], -4); $payment_method['expiry'] = $card_details['expiry']; $payment_method['is_validated'] = 1; $payment_method['updated_at'] = date('Y-m-d H:i:s'); $this->db->update('payment_methods', $payment_method, ['customer_profile_id' => $customerProfileId]); return true; } else if ($response != null) { $errorMessages = $response->getMessages()->getMessage(); return "Failed to Update Customer Payment Profile : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText(); } } else if (is_null($response) && !isset($errorMessages)){ return "Sandbox and production mode confilct"; } else { return "Failed to Get Customer Payment Profile : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function merchantConfigObject()\n{\n $config = new \\CyberSource\\Authentication\\Core\\MerchantConfiguration();\n $runEnv = \"api-matest.cybersource.com\";\n #OAuth related config\n $enableClientCert = true;\n $clientCertDirectory = \"Resources/\";\n $clientCertFile = \"\"; // p12 certificate\n ...
[ "0.5910793", "0.55366606", "0.5528246", "0.53520894", "0.5320093", "0.5278251", "0.52673197", "0.51783717", "0.5116644", "0.50472945", "0.50056213", "0.49597767", "0.4956573", "0.49559554", "0.4951448", "0.49490044", "0.49415153", "0.49393824", "0.4928695", "0.49243787", "0.4...
0.0
-1
/ Create a merchantAuthenticationType object with authentication details retrieved from the constants file
public function get_customer_profile($customer_profile_id = 1511419029){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($this->authorize['merchant_login_id']); $merchantAuthentication->setTransactionKey($this->authorize['merchant_transaction_key']); $request = new AnetAPI\GetCustomerProfileRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setCustomerProfileId($customer_profile_id); $controller = new AnetController\GetCustomerProfileController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); // $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); echo '<pre>'; print_r($response->getProfile()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function merchantConfigObject()\n{\n $config = new \\CyberSource\\Authentication\\Core\\MerchantConfiguration();\n $runEnv = \"api-matest.cybersource.com\";\n #OAuth related config\n $enableClientCert = true;\n $clientCertDirectory = \"Resources/\";\n $clientCertFile = \"\"; // p12 certificate\n ...
[ "0.59119105", "0.5536457", "0.5527294", "0.53496224", "0.5320145", "0.5277579", "0.5267329", "0.517796", "0.5117303", "0.5048447", "0.5005212", "0.4959125", "0.4956645", "0.49545348", "0.4952741", "0.49495524", "0.49412787", "0.4940237", "0.4932282", "0.49260667", "0.4914828"...
0.0
-1
If some valid syntax isn't in the HHVM/Hack tests, use it here to make sure it's permitted by the types
private static function syntaxExamples() { // https://github.com/hhvm/hhast/issues/150 $_ = function () { return [self::class => self::class]; }; // https://github.com/hhvm/hhast/issues/151 $_ = function ($x) { return \is_a($__tmp1__ = $x->flatten([]), \get_class($this)) ? $__tmp1__ : null; }; $_ = function ($x) { return \is_a($__tmp2__ = $x->flatten([]), \get_class($this)) ? $__tmp2__ : (function () { throw new \TypeError('Failed assertion'); })(); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function check_type()\n {\n $regex = \"/^int$|^bool$|^string$/\";\n\n $result = preg_match($regex, $this->token);\n\n if($result == 0 or $result == FALSE)\n {\n fwrite(STDERR, \"Error, expecting <type> function parameter! Line: \");\n ...
[ "0.6435279", "0.61733", "0.6087122", "0.59889054", "0.5985797", "0.5921954", "0.58977157", "0.58839667", "0.58731234", "0.586502", "0.58238155", "0.5756265", "0.5751384", "0.5750584", "0.5715456", "0.57070374", "0.56916493", "0.5626371", "0.5608669", "0.56054044", "0.5604574"...
0.5758699
11
Retrieves the Role manager to use.
public static function get() { static $manager = null; if ( $manager === null ) { if ( function_exists( 'wpcom_vip_add_role' ) ) { $manager = RoleManagerVIP::get_instance(); } if ( ! function_exists( 'wpcom_vip_add_role' ) ) { $manager = RoleManagerWP::get_instance(); } } return $manager; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getRole()\n {\n return $this->hasOne(Role::className(), ['id' => 'role_id']);\n }", "public function getManager()\n {\n return $this->manager;\n }", "public function getManager()\n {\n return $this->manager;\n }", "public function getManager()\n {\n ...
[ "0.6890441", "0.68621635", "0.68621635", "0.68621635", "0.6841516", "0.6753865", "0.6740957", "0.66282755", "0.65834385", "0.64943206", "0.6446718", "0.6436054", "0.6425184", "0.64227283", "0.6413139", "0.63930273", "0.6382889", "0.6354982", "0.6354982", "0.6354982", "0.63549...
0.8018739
0
Determine if the user is authorized to make this request.
public function authorize(): bool { return auth('api')->check(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function authorize()\n {\n if ($this->user() !== null) {\n return true;\n }\n return false;\n }", "public function authorize()\n {\n return $this->user() !== null;\n }", "public function authorize()\n {\n return $this->user() !== null;\n }"...
[ "0.8401071", "0.8377486", "0.8377486", "0.8344406", "0.8253731", "0.824795", "0.8213121", "0.8146598", "0.81115526", "0.8083369", "0.7991986", "0.79907674", "0.79836637", "0.79604936", "0.79516214", "0.79494005", "0.79265946", "0.7915068", "0.79001635", "0.7894822", "0.789145...
0.0
-1
Get the validation rules that apply to the request.
public function rules(): array { return [ 'status' => 'nullable', 'from_date' => 'nullable', 'to_date' => 'nullable', ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function rules()\n {\n $commons = [\n\n ];\n return get_request_rules($this, $commons);\n }", "public function getRules()\n {\n return $this->validator->getRules();\n }", "public function getValidationRules()\n {\n $rules = [];\n\n // Get the sche...
[ "0.8342703", "0.80143493", "0.7937251", "0.79264987", "0.79233825", "0.79048395", "0.78603816", "0.7790699", "0.77842164", "0.77628785", "0.7737272", "0.7733618", "0.7710535", "0.7691693", "0.76849866", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.76830...
0.0
-1
Create a new controller instance.
public function __construct() { $this->middleware('auth'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createController()\n {\n $this->createClass('controller');\n }", "protected function createController()\n {\n $controller = Str::studly(class_basename($this->getNameInput()));\n\n $modelName = $this->qualifyClass('Models/'.$this->getNameInput());\n\n $this-...
[ "0.82668066", "0.8173394", "0.78115296", "0.77052677", "0.7681875", "0.7659338", "0.74860525", "0.74064577", "0.7297601", "0.7252339", "0.7195181", "0.7174191", "0.70150065", "0.6989306", "0.69835985", "0.69732994", "0.6963521", "0.6935819", "0.68973273", "0.68920785", "0.687...
0.0
-1
Show the application dashboard.
public function index() { $products = Product::with(['photo', 'category', 'subcategory'])->take(4)->latest('created_at')->get(); $users = User::with(['photo'])->take(4)->latest('created_at')->get();//Volgens created_at sorteren 4 weergeven return view('admin.index', compact('users', 'products')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function dashboard()\n {\n\n $pageData = (new DashboardService())->handleDashboardLandingPage();\n\n return view('application', $pageData);\n }", "function dashboard() {\r\n\t\t\tTrackTheBookView::render('dashboard');\r\n\t\t}", "public function showDashboard() { \n\t\n ...
[ "0.77850926", "0.7760142", "0.7561336", "0.75147176", "0.74653697", "0.7464913", "0.73652893", "0.7351646", "0.7346477", "0.73420244", "0.7326711", "0.7316215", "0.73072463", "0.7287626", "0.72826403", "0.727347", "0.727347", "0.727347", "0.727347", "0.7251768", "0.7251768", ...
0.0
-1
Create a new controller instance.
public function __construct() { $this->middleware('auth'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createController()\n {\n $this->createClass('controller');\n }", "protected function createController()\n {\n $controller = Str::studly(class_basename($this->getNameInput()));\n\n $modelName = $this->qualifyClass('Models/'.$this->getNameInput());\n\n $this-...
[ "0.82668066", "0.8173394", "0.78115296", "0.77052677", "0.7681875", "0.7659338", "0.74860525", "0.74064577", "0.7297601", "0.7252339", "0.7195181", "0.7174191", "0.70150065", "0.6989306", "0.69835985", "0.69732994", "0.6963521", "0.6935819", "0.68973273", "0.68920785", "0.687...
0.0
-1
Show the application dashboard.
public function index() { $user = Auth::user(); if ($user->flag_admin == 1) { return view('dashboard/content_management/promo/index'); }else{ return Redirect::to('/'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function dashboard()\n {\n\n $pageData = (new DashboardService())->handleDashboardLandingPage();\n\n return view('application', $pageData);\n }", "function dashboard() {\r\n\t\t\tTrackTheBookView::render('dashboard');\r\n\t\t}", "public function showDashboard() { \n\t\n ...
[ "0.77850926", "0.7760142", "0.7561336", "0.75147176", "0.74653697", "0.7464913", "0.73652893", "0.7351646", "0.7346477", "0.73420244", "0.7326711", "0.7316215", "0.73072463", "0.7287626", "0.72826403", "0.727347", "0.727347", "0.727347", "0.727347", "0.7251768", "0.7251768", ...
0.0
-1
Composes and returns mail object
function getMail() { if ($this->_mail === false) { $rcpt = $this->getRecipients(); if ($rcpt) { $this->_mail = new Ac_Mail_Message(false, $rcpt, $this->subject, $this->from); Ac_Util::simpleBind($this->mailExtraSettings, $this->_mail); if ($this->replyTo) $this->_mail->replyTo = $this->replyTo; $this->_template->currentSendout = $this; $this->_mail->htmlBody = $this->_template->fetch($this->templatePart); } else $this->_mail = null; } return $this->_mail; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createMailMessage();", "private function clone_mail()\n {\n return clone $this->mail_transport;\n }", "public static function createInstance()\n {\n return new MailMessage('serializable@serializable.com');\n }", "function get () {\n $this->_build_mail();\n\n ...
[ "0.6905763", "0.61797136", "0.6173315", "0.6156689", "0.6069785", "0.6041911", "0.59983474", "0.5963014", "0.5960338", "0.5936944", "0.5922275", "0.5894485", "0.58692044", "0.58519435", "0.58277094", "0.5685993", "0.5683205", "0.56743014", "0.56663007", "0.565762", "0.5621353...
0.65684193
1
Run the database seeds.
public function run() { DB::table('cat_report')->insert([ ['name' => 'Otro'], ['name' => 'Servicio'], ['name' => 'Seguridad'] ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n fact...
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.78414...
0.0
-1
Create a random star image
public function getImage(int $width = 300, int $height = 300) { // Créé une ressource en mémoire $img = imagecreate($width, $height); imagecolorallocate($img, rand(0, 255),rand(0, 255),rand(0, 255)); $randColor = imagecolorallocate($img, rand(0, 255),rand(0, 255),rand(0, 255)); $randColor2 = imagecolorallocatealpha($img, rand(0, 255),rand(0, 255),rand(0, 255), rand(0,126)); imagefilledrectangle($img,25,25,275,275, $randColor); imagefilledpolygon($img, array( 150, 25, 200, 100, 275, 100, 225, 175, 275, 275, 150, 225, 25, 275, 75, 175, 25, 100, 100, 100 ), 10, $randColor2); // Créé un fichier jpeg à partir de la ressource ob_start(); imagepng($img); $png = ob_get_clean(); return $png; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function generateImgStarfield() {\r\n $img_starfield = $config[ConfigurationKey::prefix_img_starfield];\r\n $img_starfield = rand(0, $config[ConfigurationKey::number_img_starfield]);\r\n return $img_starfield;\r\n }", "function noisemaker($im)\n{\n imageSetThickness($im, 2);\n ...
[ "0.707569", "0.6469052", "0.6275206", "0.62309813", "0.6226524", "0.6219485", "0.6163294", "0.6142326", "0.5906499", "0.5887831", "0.58828706", "0.58058685", "0.57976896", "0.57786185", "0.5762002", "0.5724785", "0.56916887", "0.56537706", "0.56439424", "0.5578183", "0.557336...
0.0
-1
EDITAR PRODUCTO, se retornan los datos del id especificado (id de producto)
public function editarProductoModel($datosModel){ $stmt = Conexion::conectar()->prepare("SELECT * FROM products WHERE id = :id"); $stmt->bindParam(":id", $datosModel, PDO::PARAM_INT); $stmt->execute(); return $stmt->fetch(); $stmt->close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editar_producto(){\t\t\n\t\t$this->accion=\"Editando Datos del Producto\";\n\t\tif (isset($_POST['envio']) && $_POST['envio']==\"Guardar\" && isset($_GET['id']) && $_GET['id']!=\"\"){\n\t\t\t$id=$_GET['id'];\n\t\t\t$this->asignar_valores();\n\t\t\t$this->fecha=$this->convertir_fecha($this->fecha);\n\t\t\t...
[ "0.79248345", "0.7909097", "0.79006255", "0.7808983", "0.7763881", "0.7702607", "0.7685938", "0.76822126", "0.7595196", "0.74935496", "0.74881953", "0.74848497", "0.74773556", "0.74655867", "0.7452791", "0.74383277", "0.73660684", "0.7335586", "0.7313008", "0.7296999", "0.728...
0.0
-1
ACTUALIZAR PRODUCTO, dado un arreglo asociativo con los datos a actualizar actualiza los datos del producto correspondiente $stmt = Conexion::conectar()>prepare("INSERT INTO products (nombreProd, descProduc, BuyPrice, SalePrice, Proce) VALUES (:nombre,:des,:buy, :sale, :price)");
public function actualizarProductoModel($datosModel){ $stmt = Conexion::conectar()->prepare("UPDATE products SET nombreProd = :nombre, descProduc = :des, BuyPrice = :buy, SalePrice = :sale, Proce=:price WHERE id = :id"); $stmt->bindParam(":nombre", $datosModel["nombre"]); $stmt->bindParam(":des", $datosModel["des"]); $stmt->bindParam(":buy", $datosModel["buy"]); $stmt->bindParam(":sale", $datosModel["sale"]); $stmt->bindParam(":price", $datosModel["price"]); $stmt->bindParam(":id", $datosModel["id"], PDO::PARAM_INT); if($stmt->execute()){ return "success"; } else{ return "error"; } $stmt->close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newProducto($producto)\n{\n\t$con = getDBConnection();\n\t$stmt = $con->prepare(\"INSERT INTO productos (nombre, descripcion, precio) VALUES (:nombre, :descripcion, :precio)\");\n\t$stmt->bindParam(':nombre', $producto->nombre);\n\t$stmt->bindParam(':descripcion', $producto->descripcion);\n\t$stmt->bindPa...
[ "0.8028034", "0.76822054", "0.7514043", "0.7371036", "0.7244796", "0.72040266", "0.71453357", "0.71063894", "0.70620036", "0.70212555", "0.6981778", "0.69788176", "0.695198", "0.6944085", "0.69093907", "0.6841821", "0.68402296", "0.68132037", "0.67915267", "0.6755007", "0.675...
0.0
-1
BORRAR PRODUCTO, dado un id, borra el producto de la tabla products
public function borrarProductoModel($datosModel){ $stmt = Conexion::conectar()->prepare("DELETE FROM products WHERE id = :id"); $stmt->bindParam(":id", $datosModel, PDO::PARAM_INT); if($stmt->execute()){ return "success"; } else{ return "error"; } $stmt->close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function buscarProducto($idProducto)\n {\n $crudProducto=new crudProducto();\n return $crudProducto->buscarProducto($idProducto);\n\n }", "public function ProductosPorId()\n{\n\tself::SetNames();\n\t$sql = \" SELECT * FROM productos INNER JOIN categorias ON productos.codcategoria = cat...
[ "0.70995796", "0.7055204", "0.70263666", "0.6775954", "0.6587867", "0.65728325", "0.6537069", "0.6472087", "0.64545155", "0.6441437", "0.6438928", "0.640231", "0.6395025", "0.63855135", "0.637788", "0.636536", "0.6336031", "0.6333014", "0.62810236", "0.6268155", "0.62549806",...
0.0
-1
Obtenir les commentaires en fonction de leur id
public function getComments($postId) { $db = $this->dbConnect(); $comments = $db->prepare('SELECT id, author, comment, DATE_FORMAT(comment_date, \'%d/%m/%Y à %Hh%imin%ss\') AS comment_date_fr FROM comments WHERE post_id = ? ORDER BY comment_date DESC'); $comments->execute(array($postId)); return $comments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function get_comment_ids()\n {\n }", "public function ListComments($id) {\n try {\n \n\t //$res = $this->db->ExecuteSelectQueryAndFetchAll(\"SELECT Comment.*, User.acronym as owner FROM Comment INNER JOIN User ON Comment.idUser=User.id WHERE idContent=? AND Comment.deleted IS NUL...
[ "0.730391", "0.7279076", "0.7274053", "0.7138294", "0.7096878", "0.7080956", "0.6997329", "0.6934673", "0.6744257", "0.6740269", "0.6723633", "0.669541", "0.6674506", "0.66674006", "0.66173464", "0.66140264", "0.65997833", "0.65859944", "0.6585176", "0.6576593", "0.65737206",...
0.0
-1
Ajouter un commentaire en BDD
public function postComment($postId, $author, $comment) { $db = $this->dbConnect(); $comments = $db->prepare('INSERT INTO comments(post_id, author, comment, comment_date) VALUES(?, ?, ?, NOW())'); $affectedLines = $comments->execute(array($postId, $author, $comment)); return $affectedLines; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addComment()\n {\n session_start();\n $superglobalsPost = $this->getSuperglobals()->get_POST();\n $newComment = new CommentManager;\n $superglobalsPost['status'] = \"waiting\";\n $newComment->createComment($superglobalsPost);\n if (isset($superglobalsPos...
[ "0.7441979", "0.7437014", "0.73652065", "0.7274808", "0.7168541", "0.71185267", "0.70384926", "0.7033251", "0.69935626", "0.691666", "0.68394893", "0.68220204", "0.6794708", "0.67844945", "0.677306", "0.67704356", "0.675354", "0.67355955", "0.67246795", "0.6721198", "0.671811...
0.0
-1
Effacer un commentaire en BDD
public function deleteComment($id) { $db = $this->dbConnect(); $commentTarget = $db->prepare("DELETE FROM comments WHERE id=?"); $commentTarget->execute(array($id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function comment();", "public function testCreateTaskComments()\n {\n }", "public function testDeleteTaskComment()\n {\n }", "public function testProfilePrototypeCreateComments()\n {\n\n }", "public function testProfilePrototypeDeleteComments()\n {\n\n }", "public ...
[ "0.6625634", "0.65454084", "0.64513206", "0.6379023", "0.63754505", "0.6360422", "0.6338719", "0.6315823", "0.62520665", "0.62212783", "0.618579", "0.6179771", "0.617319", "0.6171886", "0.617079", "0.61694705", "0.6144656", "0.6143732", "0.6138712", "0.6137837", "0.61243385",...
0.0
-1
Signaler un commentaire en BDD
public function warningComment($id) { $db = $this->dbConnect(); $commentTarget = $db->prepare("UPDATE comments SET signalement = 'Oui' WHERE id=?"); $commentTarget->execute(array($id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function record_comment(){\n\t\t\t\n\t\t}", "public function testCommentReceivedValid()\n {\n $user = factory(User::class)->create();\n $post = factory(Post::class)->create([\n 'author_id'=>$user->id\n ]);\n\n\n Mail::fake();\n\n $this->actingAs($user)->pos...
[ "0.6737391", "0.6616184", "0.6429513", "0.640985", "0.63532054", "0.63198006", "0.63005173", "0.621153", "0.6200189", "0.61040163", "0.6076796", "0.60599506", "0.60542214", "0.60466754", "0.6042426", "0.60196996", "0.6006864", "0.59674746", "0.5949651", "0.59389955", "0.59322...
0.0
-1
Enlever le signalement d'un commentaire
public function unwarningComment($id) { $db = $this->dbConnect(); $commentTarget = $db->prepare("UPDATE comments SET signalement = 'Non' WHERE id=?"); $commentTarget->execute(array($id)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addComment()\n {\n session_start();\n $superglobalsPost = $this->getSuperglobals()->get_POST();\n $newComment = new CommentManager;\n $superglobalsPost['status'] = \"waiting\";\n $newComment->createComment($superglobalsPost);\n if (isset($superglobalsPos...
[ "0.7094971", "0.70193523", "0.6935898", "0.69348186", "0.69106936", "0.6872578", "0.6756958", "0.6720305", "0.6681305", "0.66744405", "0.662212", "0.66194713", "0.66046304", "0.65486765", "0.65380794", "0.6521094", "0.65203184", "0.6458606", "0.64473003", "0.6407548", "0.6400...
0.0
-1
Obtenir le nombre total de commentaires
public function counterComment() { $db = $this->dbConnect(); $commentcount = $db->prepare("SELECT COUNT(id) AS countercom FROM comments"); $commentcount->execute(); $myvar = $commentcount->fetch(); return $myvar; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNombreCommentaires()\n {\n $sql='SELECT COUNT(*) as nbCommentaires from t_commentaire';\n $resultat = $this->executerRequete($sql);\n $ligne=$resultat->fetch();\n return $ligne['nbCommentaires'];\n }", "public function getCommentCount();", "public function g...
[ "0.76423097", "0.7639367", "0.74910307", "0.73166627", "0.7266562", "0.7227155", "0.7165992", "0.70966834", "0.70756364", "0.7061781", "0.7015644", "0.6926642", "0.6872187", "0.68612385", "0.6856903", "0.67862624", "0.67253834", "0.6644186", "0.66085154", "0.65790296", "0.656...
0.7303601
4
Get customer credit amount
protected function getCreditAmount($customerId){ $creditAccount = ObjectManager::getInstance()->create('Vnecoms\Credit\Model\Credit'); $creditAccount->loadByCustomerId($customerId); return $creditAccount->getCredit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCreditAmount()\n {\n if (!$this->getData('credit_amount')) {\n $creditAccount = $this->_creditFactory->create();\n $creditAccount->loadByCustomerId($this->getVendor()->getCustomer()->getId());\n \n $this->setData('credit_amount', $creditAccount->getC...
[ "0.79663885", "0.7920442", "0.7615811", "0.73398936", "0.71224856", "0.71224856", "0.70833886", "0.69903237", "0.6768489", "0.6765701", "0.674159", "0.6662768", "0.6641993", "0.66349065", "0.6632239", "0.66192955", "0.6556293", "0.65549713", "0.65246", "0.6516991", "0.6456378...
0.718691
4
Get number of products of current vendor
public function getTotalProducts($vendorId) { $resource = ObjectManager::getInstance()->create('Magento\Catalog\Model\ResourceModel\Product'); $connection = $resource->getConnection(); $select = $connection->select(); $select->from( $resource->getTable('catalog_product_entity'), ['total_product' => 'count( entity_id )'] )->where( 'vendor_id = :vendor_id' ); $bind = ['vendor_id' => $vendorId]; $total = $connection->fetchOne($select, $bind); return $total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getProductCount()\n {\n $count = 0;\n \tforeach ($this->getItems() as $item) {\n \t $count += $item['count'];\n \t}\n \treturn $count;\n }", "public function ProductCount()\n {\n return Products::count();\n }", "public function getNumProducts()\n {\n return $thi...
[ "0.77058846", "0.7454343", "0.7400336", "0.73645765", "0.7323935", "0.72988576", "0.72179997", "0.7146809", "0.71216726", "0.7060956", "0.67669386", "0.6725656", "0.6666449", "0.66342", "0.6625918", "0.65743613", "0.6573858", "0.65701693", "0.6568277", "0.65186995", "0.649700...
0.6214018
40
prepare the array so it can be used as a dropdown
public function get_for_admin() { $return_array = array(); $r = $this->where('deleted',NULL)->get_all(); foreach($r as $key=>$value) { $return_array[$value->id]=$value->name; } return $return_array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectListArray($name,$array,$curr_id,$script=\"\",$empty_option=0) {\n\n\t\t$output\t\t = \"<select name=\\\"$name\\\" id=\\\"$name\\\" $script>\\n\";\n if ($empty_option) $output\t\t.= \"<option></option>\\n\";\n\n\t\tforeach ($array as $key=>$val) {\n\t\t\t$output .= \"<option value=\\\"\".$key....
[ "0.67639107", "0.65232074", "0.6519679", "0.6334738", "0.6274717", "0.6206159", "0.618178", "0.6088956", "0.60825145", "0.6056119", "0.6038832", "0.60318935", "0.60283273", "0.599329", "0.598511", "0.5963232", "0.5948729", "0.5947924", "0.591775", "0.5911445", "0.5903783", ...
0.0
-1
Run the database seeds.
public function run() { $follower=new Follower(); $follower->idSeguidor = 2; $follower->idSeguido = 1; $follower->save(); $follower=new Follower(); $follower->idSeguidor = 3; $follower->idSeguido = 1; $follower->save(); $follower=new Follower(); $follower->idSeguidor = 1; $follower->idSeguido = 2; $follower->save(); $follower=new Follower(); $follower->idSeguidor = 3; $follower->idSeguido = 2; $follower->save(); $follower=new Follower(); $follower->idSeguidor = 1; $follower->idSeguido = 3; $follower->save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n fact...
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.78414...
0.0
-1
process_vb_data, get the VB data to save it in the ra_group_product table
public function process_vb_data ($feed) { print $feed; exit; //Read the data sent from VB $xml_vb = simplexml_load_string($feed); $task_id = $xml_vb->attributes()->task_id; //Create return xml string $xml = array(); $xml[] = '<?xml version="1.0" encoding="UTF-8"?>'; $xml[] = '<ra_group_products task_id="' . $task_id . '">'; $c = count($xml_vb->ra_group_product); foreach($xml_vb->ra_group_product as $ra_group_product) { $c--; try { //Get the master sku to search the corresponding sku in atomv2 database $master_sku = $ra_group_product->master_sku; $master_sku = strtoupper($master_sku); $sku = $this->sku_mapping_service->get_local_sku($master_sku); $fail_reason = ""; if ($master_sku == "" || $master_sku == null) $fail_reason .= "No master SKU mapped, "; if ($sku == "" || $sku == null) $fail_reason .= "SKU not specified, "; if ($fail_reason == "") { $is_delete = $ra_group_product->is_delete; //Get the external (VB) ra_group_id to search the corresponding row in atomv2 database if($ra_group_product_ext_atomv2 = $this->get_dao()->get(array("ra_group_id"=>$ra_group_product->ra_group_id, "sku"=>$sku))) { $id = $ra_group_product->ra_group_id; } //if id exists, update if ($id != "" && $id != null) { if ($is_delete) { $d_where["ra_group_id"] = $id; $d_where["sku"] = $sku; $this->get_dao()->q_delete($d_where); $xml[] = '<ra_group_product>'; $xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>'; $xml[] = '<sku>' . $ra_group_product->sku . '</sku>'; $xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>'; $xml[] = '<status>5</status>'; //updated $xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>'; $xml[] = '</ra_group_product>'; } else { //Update the AtomV2 ra_group_product extend data $where = array("ra_group_id"=>$id, "sku"=>$sku); $new_ra_group_products_obj = array(); $new_ra_group_products_obj["name"] = $ra_group_product->name; $this->get_dao()->q_update($where, $new_ra_group_products_obj); $xml[] = '<ra_group_product>'; $xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>'; $xml[] = '<sku>' . $ra_group_product->sku . '</sku>'; $xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>'; $xml[] = '<status>5</status>'; //updated $xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>'; $xml[] = '</ra_group_product>'; } } //if not exists, insert else { $new_ra_group_products_obj = array(); $new_ra_group_products_obj = $this->get_dao()->get(); $new_ra_group_products_obj->set_ra_group_id($ra_group_product->ra_group_id); $new_ra_group_products_obj->set_sku($sku); $new_ra_group_products_obj->set_name($ra_group_product->name); $this->get_dao()->insert($new_ra_group_products_obj); $xml[] = '<ra_group_product>'; $xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>'; $xml[] = '<sku>' . $ra_group_product->sku . '</sku>'; $xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>'; $xml[] = '<status>5</status>'; //updated $xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>'; $xml[] = '</ra_group_product>'; } } elseif ($sku == "" || $sku == null) { //if the master_sku is not found in atomv2, we have to store that sku in an xml string to send it to VB $xml[] = '<ra_group_product>'; $xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>'; $xml[] = '<sku>' . $ra_group_product->sku . '</sku>'; $xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>'; $xml[] = '<status>2</status>'; //sku not found $xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>'; $xml[] = '</ra_group_product>'; } else { $xml[] = '<ra_group_product>'; $xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>'; $xml[] = '<sku>' . $ra_group_product->sku . '</sku>'; $xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>'; $xml[] = '<status>3</status>'; //not updated $xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>'; $xml[] = '</ra_group_product>'; } } catch(Exception $e) { $xml[] = '<ra_group_product>'; $xml[] = '<id>' . $ra_group_product->ra_group_id . '</id>'; $xml[] = '<sku>' . $ra_group_product->sku . '</sku>'; $xml[] = '<master_sku>' . $ra_group_product->master_sku . '</master_sku>'; $xml[] = '<status>4</status>'; //error $xml[] = '<is_error>' . $ra_group_product->is_error . '</is_error>'; $xml[] = '</ra_group_product>'; } } $xml[] = '</ra_group_products>'; $return_feed = implode("\n", $xml); return $return_feed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function processVbData ($feed)\n\t{\n\t\t//print $feed; exit;\n\t\t//Read the data sent from VB\n\t\t$xml_vb = simplexml_load_string($feed);\n\n\t\t$task_id = $xml_vb->attributes()->task_id;\n\n\t\t//Create return xml string\n\t\t$xml = array();\n\t\t$xml[] = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\n\...
[ "0.5839891", "0.5706544", "0.568808", "0.563969", "0.5520001", "0.54985833", "0.5443457", "0.5417065", "0.53986895", "0.5354572", "0.5347832", "0.53006446", "0.52670217", "0.5250371", "0.52405167", "0.52275676", "0.52121246", "0.5193366", "0.5173578", "0.51589", "0.51460457",...
0.653533
0
List of Laravel model events that should be recorded public static $logModelEvents = ['created','updated'];
public static function bootLogsModelEvents() { if (property_exists(self::class, 'logModelEvents')) { foreach (self::$logModelEvents as $eventName) { static::$eventName(function ($model) use ($eventName) { $description = $eventName; if ($eventName == 'updating' || $eventName == 'updated') { if ($dirty = $model->getDirty()) { $changed = []; foreach ($dirty as $key => $value) { if (!self::shouldHideKey($key)) { if (self::shouldSanitizeKey($key)) { $changed[] = "'$key': ***"; } else { $changed[] = "'$key': [" . ($model->original[$key] ?? '-') . "]→[$value]"; } } } if ($changed) { $description .= ':' . implode(', ', $changed); } } } $model->logModelEvent($description); }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function getModelEventsToRecord()\n {\n if (isset(static::$modelEventsToRecord)) {\n return static::$modelEventsToRecord;\n }\n\n return ['created', 'updated', 'deleted'];\n }", "protected static function recordableEvents()\n {\n if (isset(static::...
[ "0.75341773", "0.6896052", "0.6525554", "0.6388823", "0.6388823", "0.6228684", "0.621511", "0.61946315", "0.61371857", "0.6107221", "0.6067984", "0.60408044", "0.59189606", "0.58752406", "0.58464116", "0.5836131", "0.57916987", "0.577985", "0.5735789", "0.5732192", "0.5731368...
0.76568913
0
INSERTAR UNA NUEVA DEPENDENCIA
function insertDependence($data) { $this->db->insert('dependence', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajoue_proprietaire($nom,$CA,$debut_contrat,$fin_contrat)\r\n{ $BDD=ouverture_BDD_Intranet_Admin();\r\n\r\n if(exist($BDD,\"proprietaire\",\"nom\",$nom)){echo \"nom deja pris\";return;}\r\n\r\n $SQL=\"INSERT INTO `proprietaire` (`ID`, `nom`, `CA`, `debut_contrat`, `fin_contrat`) VALUES (NULL, '\".$no...
[ "0.6481965", "0.6276919", "0.6164597", "0.61160046", "0.61150014", "0.6109523", "0.61035895", "0.60233164", "0.6018255", "0.6008726", "0.59815973", "0.5975209", "0.5961618", "0.59491414", "0.5937328", "0.5903848", "0.59028924", "0.5895484", "0.58858943", "0.5867154", "0.58661...
0.6092713
7
OBTENGO EL NOMBRE DE UNA DEPENDENCIA POR SU ID
function getDependenceNameById($dependence_id) { $query = $this->db->get_where('dependence', array('id'=>$dependence_id)); return $query->row()->name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getTotalDependency($id, $idDependencia)\n {\n $cont=0; \n for ($i = 1; $i <= $id; $i++){\n $consult=\"select * from division where id=\".$i.\" and id_dependency=\".$idDependencia.\"\";\n $dependencia[]=self::model()->findBySql($consult)...
[ "0.58621323", "0.58474946", "0.57772523", "0.5738539", "0.5695178", "0.5693606", "0.56846595", "0.56731635", "0.5656044", "0.5640587", "0.5632214", "0.5615848", "0.56115896", "0.56080186", "0.5607772", "0.56063247", "0.55942893", "0.5565586", "0.55648434", "0.5553695", "0.554...
0.0
-1
OBTENGO UNA DEPENDENCE POR SU ID
function getDependenceById($dependence_id) { $query = $this->db->get_where('dependence', array('id'=>$dependence_id)); return $query->row(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "final function __construct($id)\r\n\t{\r\n\t\tparent::__construct($id);\r\n\t\t$this->_transaccion_abierta = false;\r\n\t\t// Cargo las dependencias\r\n\t\tforeach( $this->_lista_dependencias as $dep){\r\n\t\t\t$this->cargar_dependencia($dep);\r\n\t\t\t$this->_dependencias[$dep]->set_controlador($this, $dep);\r\n\...
[ "0.5879079", "0.5643255", "0.5616351", "0.55740327", "0.549171", "0.54719406", "0.53944963", "0.5345596", "0.5345596", "0.5345596", "0.5325813", "0.530464", "0.530114", "0.5275039", "0.5268493", "0.52453", "0.5237646", "0.5231721", "0.52023035", "0.51460886", "0.5140303", "...
0.0
-1
VERIFICA POR NOMBRE QUE UNA DEPENDENCIA NO EXISTA
function noExistDependence($dependence_name) { $query = $this->db->get_where('dependence', array('name'=>$dependence_name)); return $query->num_rows() == 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function has_dependents(){\n\t\treturn false;\n\t}", "public function has_dependencies(): bool;", "function cumple_dependencias()\n\t{\n\t\treturn count($this->get_dependencias_faltantes()) > 0;\n\t}", "public function dependencyExist(): bool\n {\n if ($this->dependencyExist !== null)...
[ "0.66179436", "0.647935", "0.6430712", "0.63491136", "0.6294501", "0.61362946", "0.6070822", "0.6025547", "0.60139084", "0.6010748", "0.5917012", "0.5887242", "0.58806574", "0.5841174", "0.5825609", "0.58082557", "0.5762216", "0.5746142", "0.57455945", "0.5720548", "0.5712699...
0.5683528
23
DEVUELVE TODAS LAS DEPENDENCIAS
function getAllDependences() { $query = $this->db->get('dependence'); return $query->result(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function load_dependencies() {\n //require_once( $this->inc . 'class-best-faq-admin.php' );\n require_once( $this->inc . 'best-faq-shortcode.php' );\n }", "function get_dependencies();", "private function load_dependencies() {\n\n\t\t//For CHAOS lib\n\t\tset_include_path(get_include_pa...
[ "0.6589734", "0.6571747", "0.6334228", "0.62454414", "0.6186806", "0.60964495", "0.60809416", "0.60755384", "0.6044933", "0.6040495", "0.6038151", "0.600188", "0.5986961", "0.5986488", "0.5920155", "0.58539146", "0.58063155", "0.57943135", "0.578357", "0.5773794", "0.5757515"...
0.0
-1
DADO UN URL OBTENGO LA DEPENDENCIA
function getDependenceBySlug($slug) { $query = $this->db->get_where('dependence', array('slug'=>$slug)); return $query->row(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jc_url() {\n\n}", "abstract public function getUrl();", "public function url();", "public function url();", "public function url();", "private function Get_URL()\n {\n $url = $this->CURL->GET_SERVER_URL();\n $download_url = $url.\"/application/download/download.php\";\n $view_url = $ur...
[ "0.58038384", "0.58000225", "0.57319236", "0.57319236", "0.57319236", "0.5729183", "0.5720145", "0.5717459", "0.57100016", "0.5687298", "0.56712353", "0.565993", "0.5645743", "0.5645743", "0.5589236", "0.5580399", "0.5569577", "0.5557956", "0.5556938", "0.5556755", "0.5554417...
0.0
-1
VERIFICA QUE NO ESTE DUPLICADO UNA DEPENDENCIA
function isNotDuplicateDependence($dependence_id, $name) { $query = $this->db->get_where('dependence', array('id !='=>$dependence_id, 'name =' => $name)); return $query->num_rows() == 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateDependencies()\n {\n $db = Codeli::getInstance()->getDB();\n $db->query(\"DELETE FROM \" . SystemTables::MODULE_DEPENDENCY . \" WHERE guid='::guid'\", array(\"::guid\" => $this->guid));\n\n if (count($this->dependencies) < 1)\n {\n ...
[ "0.6003426", "0.59442866", "0.58935016", "0.5843761", "0.5751475", "0.57499796", "0.56985253", "0.56855065", "0.5621191", "0.56106", "0.5591915", "0.55451703", "0.5499492", "0.54337764", "0.54262614", "0.5422188", "0.54003894", "0.53665113", "0.5336218", "0.53199375", "0.5317...
0.5491811
13
/ Query a time server (C) 19990929, Ralf D. Kloth (QRQ.software)
function query_time_server($timeserver, $socket) { $fp = fsockopen($timeserver, $socket, $err, $errstr, 5); # parameters: server, socket, error code, error text, timeout if ($fp) { fputs($fp, "\n"); $timevalue = fread($fp, 49); fclose($fp); # close the connection } else { $timevalue = " "; } $ret = []; $ret[] = $timevalue; $ret[] = $err; # error code $ret[] = $errstr; # error text return $ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function retrieveServerTime(){\n //http://www.thetvdb.com/api/Updates.php?type=none\n\t \n\t if(!$this->t_mirrors){\n\t\t$this->retrieveMirrors;\n\t }\n\t \n $url = $this->t_mirrors[0].'/api/Updates.php?type=none';\n \n //$xmlStr=$this->curl_get_file_c...
[ "0.6596131", "0.64093447", "0.6295277", "0.62776715", "0.62247115", "0.6191721", "0.60731685", "0.5970149", "0.5952864", "0.5924523", "0.5846608", "0.58172303", "0.5806068", "0.5734254", "0.5654907", "0.5619656", "0.5562991", "0.5517565", "0.55126476", "0.5507908", "0.5472556...
0.7619637
0
If we didn't receive the command NTP ...
function doNTP($text = null) { if (strtolower($this->input) != "ntp") { $this->ntp_message = $this->ntp_response; $this->response = $this->ntp_response; return; } // "None" agent command received. if ($this->agent_input == null) { $token_thing = new Tokenlimiter($this->thing, "ntp"); $dev_overide = null; if ( $token_thing->thing_report["token"] == "ntp" or $dev_overide == true ) { // From example $timeserver = "ntp.pads.ufrj.br"; // Dev neither of these two are working. $timeserver = "time.nrc.ca"; $timeserver = "time.chu.nrc.ca"; // This is an older protocol version. $timeserver = "time4.nrc.ca"; $timercvd = $this->query_time_server($timeserver, 37); $this->time_zone = "America/Vancouver"; //if no error from query_time_server if (!$timercvd[1]) { $timevalue = bin2hex($timercvd[0]); $timevalue = abs( HexDec("7fffffff") - HexDec($timevalue) - HexDec("7fffffff") ); $tmestamp = $timevalue - 2208988800; # convert to UNIX epoch time stamp $epoch = $tmestamp; // $datum = date("Y-m-d H:i:s",$tmestamp - date("Z",$tmestamp)); /* incl time zone offset */ // $d = date("Y-m-d H:i:s",$tmestamp - date("Z",$tmestamp)); /* incl time zone offset */ //$datum = $dt = new \DateTime($tmestamp, new \DateTimeZone("UTC")); $datum = new \DateTime("@$epoch", new \DateTimeZone("UTC")); //$datum->setTimezone($tz); // $dt = new \DateTime($prediction['date'], new \DateTimeZone("UTC")); $datum->setTimezone(new \DateTimeZone($this->time_zone)); $m = "Time check from time server " . $timeserver . ". "; $m = "In the timezone " . $this->time_zone . ", it is " . $datum->format("l") . " " . $datum->format("d/m/Y, H:i:s") . ". "; } else { $m = "Unfortunately, the time server $timeserver could not be reached at this time. "; $m .= "$timercvd[1] $timercvd[2].\n"; } $this->response = $m; // Bear goes back to sleep. $this->bear_message = $this->response; } } else { $this->bear_message = $this->agent_input; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function send_cntdwn_msg()\n{\n $current = new DateTime();\n $current->Sub(new Dateinterval(\"PT1H\"));\n\t$sqldate = $current->format(\"Y-m-d H:i:s\");\n $ipAddress = false;\n $stopparam = new TempPredictionStopParam($this->connector);\n $stopparam->build_id = $this->stopBuild->build_id;\n $send...
[ "0.5358862", "0.52541333", "0.52417123", "0.52409226", "0.5150787", "0.5086303", "0.5082719", "0.50663257", "0.5056325", "0.5010953", "0.49747655", "0.49531448", "0.49449086", "0.49419537", "0.4931662", "0.49180624", "0.49171072", "0.4916608", "0.4885348", "0.4872519", "0.486...
0.7596663
0
Checks if the form user is the owner of the specified screen ID.
public function validateUserScreenId($attribute, $params) { $user = $this->getUser(); if (!$user || !$user->findScreenById((int) $this->{$attribute})) { $this->addError($attribute, Yii::t('app', 'Invalid screen ID.')); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isOwner()\n {\n return (\\Auth::check() and \\Auth::user()->id == $this->id);\n }", "public function isOwner(): bool {\n $f3 = \\Base::instance();\n\n return $f3->get('CURRENT_USER') && !is_null($this->owner) && $f3->get('CURRENT_USER') === $this->owner->id;\n }", ...
[ "0.6760983", "0.66502994", "0.65118855", "0.64314747", "0.6407534", "0.6407061", "0.63521975", "0.6331897", "0.6216127", "0.61890703", "0.61856806", "0.6157196", "0.613505", "0.6103269", "0.61032623", "0.6103158", "0.610174", "0.6098609", "0.6082986", "0.60804224", "0.6075597...
0.0
-1
Checks if the form user own a specific ScreenComment model.
public function validateReplyTo($attribute, $params) { $user = $this->getUser(); $comment = $user ? $user->findScreenCommentById((int) $this->{$attribute}) : null; if ( !$comment || // comment doesn't exist or can't be accessed !empty($comment->replyTo) // only primary comment can have replies ) { $this->addError($attribute, Yii::t('app', 'Invalid primary comment ID.')); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function is_screen() {\n\t\treturn ! empty( $this->ID ) && Tribe__Admin__Helpers::instance()->is_screen( $this->ID );\n\t}", "public function isOwnedBy($comment, $user) {\n return $this->field('id', array('id' => $comment, 'user_id' => $user)) !== false;\n }", "public function owns(Model $mode...
[ "0.64010966", "0.63686544", "0.60119355", "0.5878308", "0.5874903", "0.56737393", "0.5670553", "0.5595417", "0.5576449", "0.55202824", "0.55171555", "0.5487937", "0.5476937", "0.54594934", "0.54541636", "0.54531336", "0.542957", "0.54160845", "0.5404946", "0.5401371", "0.5374...
0.0
-1
Persists model form and returns the created/updated `ScreenComment` model.
public function save(): ?ScreenComment { if ($this->validate()) { $user = $this->getUser(); $comment = $this->getScreenComment() ?: (new ScreenComment); $isNewRecord = $comment->isNewRecord; $comment->from = $isNewRecord ? $user->email : $comment->from; $comment->message = $this->message; if ( $this->replyTo && ($replyToComment = ScreenComment::findById($this->replyTo)) ) { $comment->screenId = $replyToComment->screenId; $comment->replyTo = $replyToComment->id; $comment->status = ScreenComment::STATUS['PENDING']; $comment->left = 0.0; $comment->top = 0.0; } else { $comment->screenId = $this->screenId; $comment->replyTo = null; $comment->status = $this->status; $comment->left = (float) $this->left; $comment->top = (float) $this->top; } if ($comment->save()) { if ($isNewRecord) { $comment->createNotifications(); } $comment->refresh(); return $comment; } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save(): ?ScreenComment\n {\n if ($this->validate()) {\n $comment = new ScreenComment;\n $comment->from = $this->from;\n $comment->message = $this->message;\n $comment->status = ScreenComment::STATUS['PENDING'];\n\n if (\n...
[ "0.6792862", "0.5931886", "0.58542407", "0.56830025", "0.55532944", "0.5527788", "0.5524882", "0.53696376", "0.5351451", "0.53174573", "0.5296563", "0.52663326", "0.52244365", "0.5157345", "0.51543283", "0.5149078", "0.5124249", "0.51101196", "0.5106191", "0.5103197", "0.5100...
0.6901158
0
Display a listing of the resource.
public function index() { return response()->json(Event::all()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function indexAction()\n {\n $limit = $this->Request()->getParam('limit', 1000);\n $offset = $this->Request()->getParam('start', 0);\n $sort = $this->Request()->getParam('sort', array());\n $filter = $this->Request()->getParam('filter', array());\n\n $result = $this->re...
[ "0.7446777", "0.736227", "0.73005503", "0.72478926", "0.71631265", "0.71489686", "0.7131636", "0.7105969", "0.71029514", "0.7101372", "0.70508176", "0.6995128", "0.69890636", "0.6934895", "0.6900203", "0.6899281", "0.6891734", "0.6887235", "0.68670005", "0.6849741", "0.683052...
0.0
-1
Show the form for creating a new resource.
public function create() { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view(...
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.717428...
0.0
-1
Store a newly created resource in storage.
public function store(Request $request) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations...
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.63424...
0.0
-1