anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
Update the row in the database.
protected function doUpdate(ConnectionInterface $con) { $selectCriteria = $this->buildPkeyCriteria(); $valuesCriteria = $this->buildCriteria(); return $selectCriteria->doUpdate($valuesCriteria, $con); }
For internal only. DO NOT USE IT.
public function deserialize($param) { if ($param === null) { return; } if (array_key_exists("InstanceId",$param) and $param["InstanceId"] !== null) { $this->InstanceId = $param["InstanceId"]; } if (array_key_exists("VirtualHost",$param) and $param["Vi...
Set up default permissions.
public function initializePermissions() { Loader::helper('clov_permissions', 'clov'); $page = $this->getCollectionObject(); ClovPermissionsHelper::setBaselinePermissions($page); // Project managers and employees can add new expenses. $clovGroups = Loader::package('clov')->getGroups(); $page->assignPer...
Run the database seeds.
public function run() { $newUser = new App\User(); $newUser->name ='mr_datawolf'; $newUser->email = 'patrickmoon@gmail.com'; $newUser->password = bcrypt('not4u2know'); $newUser->save(); }
================================================== Some helper functions and filters for theme
function default_menu(){ wp_nav_menu(array('menu' => 'Main Menu', 'fallback_cb' => 'default_page_menu', 'container' => 'nav', 'container_class' => 'mainmenu', 'menu_class' => 'menu clear')); }
Returns the path from the url.
public function getPath(string $url): string;
/ remove_tag Remove a tag from the given TestRun Usage TestRun.remove_tag Parameters ParameterData Type run_idinteger tag_namestring Result 0
function TestRun_remove_tag($run_id, $tag_name) { // Create call $call = new xmlrpcmsg('TestRun.remove_tag', array(new xmlrpcval($run_id, "int"), new xmlrpcval($tag_name, "string"))); // Do call and return value return do_call($call); }
Store a newly created resource in storage.
public function store(AppoinmentStoreRequest $request) { $validated = $request->validated(); //evaluate Appointment Services Logic $reservation = (new AppoinmentServices())->reservation($validated); if($reservation['status'] == 'error') { return back()->withInput()->wi...
fonction pour supprimer un commentaire
public function deleteComment($commentId) { $db = $this->dbconnect(); $deletedComment = $db->prepare('DELETE from comments WHERE id = ?'); $affectedLines = $deletedComment->execute(array($commentId)); return $affectedLines; }
Get URL for Redirect
public function getRedirectUrl($url) { return $this->context->link->getModuleLink($this->name, 'redirect', array('goto' => $url), Tools::usingSecureMode()); }
for hashing a code sent to email
public function verification_hash($code){ return hash('sha512', $code . config_item('encryption_key')); }
Return properties for JSON serialization
public function jsonSerialize(){ if( ! $this->isPersisted() ){ $properties = (object) get_object_vars($this); unset($properties->id); return $properties; } $properties = (object) get_object_vars($this); $pro...
Seed the application's database.
public function run() { Role::create(['name' => 'admin']); Role::create(['name' => 'user']); User::create([ 'name' => 'admin', 'email' => "admin@gmail.com", 'password' => Hash::make('password'), ])->assignRole(['admin', 'user']); User::cr...
Display the specified resource.
public function show(Price $price) { // }
A setter method when a form is submitted
public function getInfoAttribute($info) { return unserialize($info); }
Cast value from scalar to type
public function fromString(string $value): \DateTime { return new \DateTime($value); }
checks, if orm data type is defined
public function hasOrmType($ormDataType) { return isset($this->ormDataTypeInstance[$ormDataType]); }
Update the specified resource in storage.
public function update(CategoryRequests $request, $id) { $category = Category::findOrFail($id); $category->name = $request->input('name'); $category->parent_id = $request->input('parent_id'); $category->save(); return response()->json([ 'status'...
Show the application dashboard.
public function index() { return view('backend.index')->with('posts', \App\Post::all()); }
Edit a Canvas user
public function editUser($userID){ $this->path = "users/$userID"; return $this->put(); }
Returns the comments for a photo
function photos_comments_getList ($photo_id, $min_comment_date = NULL, $max_comment_date = NULL) { $params = array(); $params['method'] = 'flickr.photos.comments.getList'; $params['photo_id'] = $photo_id; if ($min_comment_date) $params['min_comment_date'] = $min_comment_date; if ($max_comment_date) $params['m...
Reads the $xmlPath file and returns an object.
function getObject($object, $xmlPath) { $i = 0; if (!file_exists($xmlPath)) return; $xml = domxml_open_file ($xmlPath); $node = $xml->document_element(); $ChildDomNode = $node->first_child(); while($ChildDomNode) { if ($ChildDomNode->type == XML_ELEMENT_NODE) ...
Create a new job instance.
public function __construct(User $user) { $this->user = $user; }
returns the part of speech for specified word EG: [base_path]/frontend_dev.php/words/pos?word=computer
public function executePos(sfWebRequest $request) { // NOTE -- changed this from `getGetParameter` to `getParameter.` // The former wasn't working for some reason, $headword was coming up empty // andyinabox - 2010-05-20 $headword = $request->getParameter("word"); $this->pos = Wordnik::getPartOfSpeech($hea...
Returns Customer_Company objects of all employees of this company
public function getEmployees() { if ( is_null($this->_employees) ){ $customers = $this->getTable()->getEmployees(); $objects = new splObjectStorage(); foreach ($customers AS $customer) { try { $ccust = new Yourdelivery_Model_Customer_Compa...
Add this Gateway to WooCommerce
function woocommerce_add_paycoingateway_gateway($methods) { $methods[] = 'WC_Gateway_PaycoinGateway'; return $methods; }
Returns the username used to authenticate the user.
public function getUsername() { return $this->username; }
/ Fungsi ini menginsertkan data ke dalam tabel pokemon. Parameter $data berisi data yang akan diinsertkan dalam bentuk associative array yang terdiri dari pasangan key=>value. Key adalan nama field, sedangkan value adalah nilai field
public function insert($data){ // TODO: Modif bagian ini $this->db->insert('pokemon', $data); }
manda todos los datos recogidos del formulario del producto seleccionado para actualizar el registro en la base de datos
public static function actualizarProductosModel($datosModel, $tabla){ $stmt = Conexion::conectar()->prepare("UPDATE $tabla SET codigo_producto = :codigo, nombre = :nombre, precio = :precio, fecha_agregado = :fecha, id_categoria = :categoria, foto = :foto WHERE id_producto = :id"); $stmt->bindParam(":id", $datos...
function Synchronizes properties from an import with the database.
public function sync($p_category_data, $p_object_id, $p_status = 1 /* isys_import_handler_cmdb::C__CREATE */) { $l_indicator = false; if (is_array($p_category_data) && isset($p_category_data['properties'])) { // Create category data identifier if needed: if ($p_status...
Update the specified resource in storage.
public function update($id) { $branch = Branches::find($id); $branch->branch_name = Input::get('branch_name'); $branch->phone = Input::get('phone'); $branch->save(); $branchesById = Branches::find($id); $branches = Branches::orderBy('branch_name','asc')->paginate(); return Redirect::route('branches.e...
Get modified object instance.
public function getModel(){ return $this->model; }
Remove redundant closeTag elements from the tail of a switch's cases For each remove duplicate nodes that are either siblings or descendants of a sibling
protected static function removeRedundantCloseTagElements(DOMDocument $ir) { $xpath = new DOMXPath($ir); foreach ($xpath->query('//closeTag') as $closeTag) { $id = $closeTag->getAttribute('id'); $query = 'following-sibling::*/descendant-or-self::closeTag[@id="' . $id . '"]'; foreach ($xpath->query($q...
Returns the agreement module
protected function getAgreementModule() { if (!$this->agreement_module) { $this->agreement_module = ActivityModule::byIdentifier('agreement'); } return $this->agreement_module; }
Make a grid builder.
protected function grid($id) { $grid = new Grid(new Attendee); $grid->model() ->orderBy('id', 'desc') ->where('event_id', $id) ->whereNotNull('canceled_at'); $grid->disableActions(); $grid->disableCreateButton(); $grid->disableRowSelector(); ...
Shows voltages in the nodes
static public function showVoltages($circuit, $return = false) { $text = "Operating point:\n\n"; foreach ($circuit->V as $k => $v) { $text .= 'V(' . $circuit->getNodeName($k) . ") \t\t = " . number_format($v, 6) . " V\n"; } return $return ? $text : print($text);...
Fonction pour poster des commentaires blog
public function postCommentBlog($id_membre, $id_chapitre, $commentaire) { if(!empty($commentaire)) { $comment = $this->chapitre->commenterBlog($id_membre, $id_chapitre, $commentaire); array_push(self::$erreurs, '<h2>Votre Message a bien été envoyé !</h2> <i class="far fa-...
Given an IPv6 address in octet notation, returns a pure hex string.
private static function IPv6ToRawHex( $ip ) { $ip = self::sanitizeIP( $ip ); if ( !$ip ) { return null; } $r_ip = ''; foreach ( explode( ':', $ip ) as $v ) { $r_ip .= str_pad( $v, 4, 0, STR_PAD_LEFT ); } return $r_ip; }
Overloading this method to show the Amazon id of the order instead of the name of the Magento store
public function getOrderStoreName() { if ($this->getOrder()) { $name = array(); if($this->getOrder()->getAmazonOrderId()){ $name = array( Mage::helper('amazonOrders')->__('Imported from Amazon'), "#" . $this->getOrder()->getAmazonOrderId() ); } if (count($na...
Installs the given Composer Packages into the application. Taken from
protected function requireComposerPackages($packages) { $composer = $this->option('composer'); if ($composer !== 'global') { $command = ['php', $composer, 'require']; } $command = array_merge( $command ?? ['composer', 'require'], is_array($packag...
Return all employees as array so it is easier to display
public function findAllEmployeesAsArray() { return $this->createQueryBuilder('e') ->getQuery() ->getArrayResult(); }
Finish sale and redirect customer to payment result page
public function finish_sale($order_id, array $callback_data) { $order = $this->get_order($order_id, $callback_data); try { $response = $this ->get_payment_aggregate() ->finish_sale($order, $callback_data); ; } catch (Ex...
adds the settings to the Payment Gateways section
function pn_edd_add_settings( $settings ) { $paynow_gateway_settings = array( array( 'id' => 'paynow_gateway_settings', 'name' => '<strong>' . __( 'Paynow Gateway Settings', 'pw_edd' ) . '</strong>', 'desc' => __( 'Configure the gateway settings', 'pw_edd' ), 'type' => 'header' ), array( 'id' => ...
Returns a duplicate of the node.
final public function copy(array $params = null) { return clone $this; }
Get latest currency exchange rates.
public function latest($base = 'USD', $targets = []) { return $this->query('latest', $base, $targets); }
Set the value of title
public function setTitle($title) { $this->title = $title; return $this; }
get the total new orders
public function add_category_template($filename, $data = array()) { //$data["there_is_new_order"] = $this->Admin_model->return_total_rows('order', 'status', 'open'); $this->admin_header(); $data['header'] = $this->load->view('templates/admin_header', $data, TRUE); $data['footer'] = $this->load->view('templa...
Search for the translated version of a Cat URL Indicator segment. Takes a segment, and sees if it exists in the languages array. If it does, return the translated version of it from the requested language
private function _get_translated_cat_url_indicator($str, $lang_id_from = NULL, $lang_id_to = NULL) { $from_language = ee()->publisher_model->languages[$lang_id_from]; $to_language = ee()->publisher_model->languages[$lang_id_to]; if ($from_language['cat_url_indicator'] == $str) { ...
Checks if a disease is editable
function is_disease_editable($obj, $diseasestamp) { $disease = $obj->Query_reader->get_row_as_array('get_diagnosis_by_stamp', array('stamp'=>$diseasestamp)); if((!empty($disease['isfrozen']) && $disease['isfrozen'] == 'N') || ($obj->session->userdata('isadmin') && $obj->session->userdata('isadmin') == 'Y')) { retu...
Return the users count for each value associated with the metadata provided
function statistics_extended_users_metadata_count($metadata,$group=null){ $sector_metadata = get_metastring_id($metadata); $dbprefix = elgg_get_config('dbprefix'); $query = "SELECT mv.string AS data, count(*) as total "; $query .= "FROM {$dbprefix}users_entity ue "; $query .= "JOIN " . $dbprefix . "ent...
Viet phuong thuc lay ra 3 san pham noi bat
function getFeatureProducts(){ $itemonpage = !empty($_GET['per_page'])?$_GET['per_page']:3; $page = !empty($_GET['page'])?$_GET['page']:1; $offset= ($page-1)*$itemonpage; $numberPage = ceil(30/$itemonpage); $sql = self::$connection->prepare("SELECT * FROM produc...
TODO: Implement delete() method.
public function delete($id) { }
parse a url as a log dsn
public static function parse($url, $options = []) { $inst = new LogDsn($url, $options); return $inst->toArray(); }
Get the associated ChildTblShippingCategories object
public function getTblShippingCategories(ConnectionInterface $con = null) { if ($this->aTblShippingCategories === null && ($this->prod_category_shipping !== null)) { $this->aTblShippingCategories = ChildTblShippingCategoriesQuery::create()->findPk($this->prod_category_shipping, $con); ...
Sets an optional classpath
public function setClasspath(Path $classpath) { if ($this->_classpath === null) { $this->_classpath = $classpath; } else { $this->_classpath->append($classpath); } }
Normalize rules if needed.
public function normalizeRules($rules): array { if (\is_string($rules)) { $rules = $this->parseRules($rules); } if (!\is_array($rules)) { throw new \UnexpectedValueException('The rules should be an array or string'); } return $this->cancelOnFail($rul...
Extract the timeslot from a DateTime object
private function dateTime2timeslot($date) { return (intval($date->format('G'))*2 + (($date->format('i') == '00') ? 0 : 1)); }
Exclude object from result
public function prune($lp = null) { if ($lp) { $this->addUsingAlias(LpPeer::ID, $lp->getId(), Criteria::NOT_EQUAL); } return $this; }
Show the form for creating a new resource.
public function create() { $categories=$this->model->getCategories(); $colors=$this->model->getColours(); return view("admin.pages.insertProduct",['categories'=>$categories,'colors'=>$colors]); }
Tests the setCodeCollaborateurDest() method.
public function testSetCodeCollaborateurDest() { $obj = new AppelsEnCours(); $obj->setCodeCollaborateurDest("codeCollaborateurDest"); $this->assertEquals("codeCollaborateurDest", $obj->getCodeCollaborateurDest()); }
make sure our child object has this method
public function __call($name, $arguments) { if(method_exists($this->excel, $name)) { // forward the call to our child object return call_user_func_array(array($this->excel, $name), $arguments); } return null; }
Save Methods / Function to insert a project in to the database, should check the project code first. Function returns the created project ID
function saveQuestionArray($questions, $project_id) { // Loop through questions array, do Insert query for each $questions_ids = array(); $i = 0; foreach($questions as $question) { $i++; DB::insert('question', array( 'question_project_id' => $project_id, 'question_title' => $question, 'question_numb...
After installation migrate all existing data to the Publisher tables
public function migrate_data($entry_ids = array(), $where = array(), $delete_old = FALSE) { // Delete old rows. delete() resets the where(), so reset them. if ($delete_old && !empty($where) && !empty($entry_ids)) { ee()->db->where_in('entry_id', $entry_ids) ->dele...
Remove the specified resource from storage.
public function destroy( $abate) { $abates = Abate::find($abate); //$Abate->deleted_at = new DateTime(); $abates->delete(); //$deleted= $Abate->delete(); session()->flash('flash_message','Abate was removed with success'); if (Request::wantsJson()){ return...
Set the value of email
public static function setEmail($email) { self::$email = $email; }
Execute the console command.
public function handle() { Log::info('CHECKING TRIALS'); CourseStudent::where('status', 'active') ->where('is_in_trial', true) ->get()->each(function ($student) { $now = Carbon::now(); $trial_start_date = $student->trial_started; ...
Test login real user Try to validate real user
public function testLogin() : void { $res = self::$dataService->login( "login", null, $this->userA["user"], $this->userA["pass"], [ "user_agent" => $this->userA["getBrowserName"], "time" => $this->userA["getCurrentDateTime"], "ip" => $this->userA["getReqIp"] ] ); $this->assertIsArray( $res, 'testLo...
Update the specified resource in storage.
public function update(UpdateRequest $request, Event $event): EventResource { return new EventResource( tap($event)->update(array_filter($request->only(self::ALLOWED_FIELDS))) ); }
Operation deleteunit Remove a unit.
public function unitdelete($unit_id) { $unit = Unit::destroy($unit_id); if($unit){ return response()->json(['msg' => 'Saftly deleted the unit'],200); }else{ return response()->json(['msg' => 'Could not delete record'], 400); } }
replace non letter or digits by
private function getRewrite($text, $limit = 75) { $text = preg_replace('/~[^\\pL\d]+~u/i', '-', $text); // trim $text = trim($text, '-'); // lowercase $text = strtolower($text); // remove unwanted characters $text = preg_replace('~[^-\w]+~', '', $text); ...
Atualiza os dados de sess?o do usu?rio logado
public function _atualiza_usuario_sessao($row) { $session_key = $this->config['prefixo_sessao'] . '.' . $this->config['hashkey'] . '.' . $this->config['model_usuario']; $ses = $this->Session->read($session_key); $row = $row["{$this->config['model_usuario']}"]; $ses = arra...
setAdditionalProperties If the subattribute has additional option values add them to the object public properties
public function setAdditionalProperties(Array $values) { unset($values['key']); unset($values['value']); unset($values['dependencies']); if ($values) { foreach ($values as $key => $value) { $this->$key = $value; } } return $...
VISE EN RUTE WHERE ruteId = ?
public function getRute($ruteId, $logg) { include (realpath(dirname(__FILE__)).'/db.php');; $sql = "SELECT ruteId, fraDestId, tilDestId, sesongId, navn FROM rute WHERE ruteId=?;"; $queryRute = $db_connection->prepare($sql); $...
Append item to the channel
public function appendTo(ChannelInterface $channel);
Display a listing of the resource.
public function joinedclass() { //thaem herre $value= session('id'); $username = DB::select('select * from users where idUser=?',[$value]); $yourjoinedclass= DB::select('select * from class_students where idUser=?',[$value]); $class=DB::select('select * from classrooms order ...
Show a postcode resource.
public function show(string $postcode, string $houseNumber, string $houseNumberAddition = null): JsonResponse { try { $address = $this->addressService->search(str_replace(' ', '', $postcode), (int)$houseNumber, $houseNumberAddition); return response()->json($address); } catch...
get AccountID Returns:The Service account associated with the security event notification.
public function getAccountID() { return $this->getKey('AccountID'); }
multiple queries from database to admin
public function update() { $this->connect(); mysqli_multi_query($this->con, $this->sql); $this->sql = ""; mysqli_close($this->con); $this->getStories(); }
Store a newly created resource in storage.
public function store(Request $request) { $request->validate([ 'nama'=>'required|max:255', 'nipd'=>'required|unique:dosens|max:255' ]); $dosens = new dosens; $dosens->nama = $request->nama; $dosens->nipd = $request->nipd; $dosens->save(); ...
Store a newly created resource in storage.
public function store(Request $request) { $title = $request->input('title'); $recurrence = $request->input('recurrence'); $price = $request->input('price'); $button = $request->input('button'); $link = $request->input('link'); $back_color = $request->input('back_color'); ...
Remove the specified resource from storage.
public function destroy($id) { User::destroy($id); }
Return the file height
public function height($manipulation_name = '') { return $this->row_field('height'); }
Get Leave Name by Id
public function getLeaveNameById($absid){ $sql = <<<eof select absence_name from hr_absence_type where seg_segment_no = :companyid and absence_type_id = :absid eof; //$this->DBConn->debug = 1; return $this->DBConn->CacheGetOne(self::DATA_CACHE_SECONDS,$sql,array('companyid' =...
/////////////////////// Counties // ////////////////////// Operation listsCountiesGet Fetch Regimen Counties (for select options).
public function listsCountiesget() { $response = County::all(); return response()->json($response, 200); }
Get status by transaction_id
public function get(string $transactionID, WithdrawService $withdrawService) { $disburse = $withdrawService->getWithdrawStatus($transactionID); return response()->json(['success'=> true, 'disburse' => $disburse]); }
Execute the loginflow to get the keywords
public function getKeywords($keywords = false) { $this->time_restrict = 5; // In Minutes; $accounts = json_decode(file_get_contents(__DIR__ . "/../../../accounts.json")); foreach ($accounts as $key => $value) { $gv = new \GoogleLoginCurl($value->email, $value->password, $value...
Generate a documentation link for a given key
public function buildDocLinkToKey($key) { return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; }
Store a newly created resource in storage.
public function create(Request $request) { $data = [ 'title' => $request->title, 'sku' => $request->sku, 'warehouses_id' => $request->warehouse_id, 'description' => $request->description ]; Products::create($data); return; }
Bring variables into scope
function whois_check(&$irc, &$data) { global $pickupchannel; global $pickup; global $queue; global $users; //Check for commands on queue if($data->rawmessageex[1] == "330") { if($queue[$data->rawmessageex[3]][0]["nick"] == $data->rawmessageex[3]) { //Get qauth and nick $nick = $data->rawme...
Set the value of DOCUMENT_PRODUCT_PIS_ALIQUOTA
public function setDocumentProductPisAliquota(float $document_product_pis_aliquota) { $this->collection->put('document_product_pis_aliquota', (string) $document_product_pis_aliquota); }
works with session facade, does session get or set process
function session($get = null, $set = null) { if ($get !== null && $set === null) { return Session::get($get); } elseif ($get !== null && $set !== null) { return Session::set($get, $set); } else { return App::make('session'); } }
Seed the application's database.
public function run() { User::factory(100)->create(); Income::factory(100)->create(); Cost::factory(100)->create(); Region::factory(20)->create(); District::factory(50)->create(); UserAddress::factory(100)->create(); Law::factory(100)->create(); Prison...
presmerovani na pozadovanou stranku
public static function redirect_initial($url = '', $code = 302) { self::initial()->redirect($url, $code); }
Constructor de la clase Metodo que carga los atributos de la clase CI_model
public function __construct() { parent::__construct(); }
Gets the cached textures from the database (if any available) for this file
public function getCache() { $db = \Helper::getDB(); $db->join('cached_assets c', 'dc.cacheId = c.id', 'LEFT'); $db->where('dc.fileId', $db->escape($this->getId())); $results = $db->get('document_files_cache dc'); return $results; }
Returns TRUE if the route matches the filter and FALSE if not.
protected function routeMatches(string $filter, Route $route): bool { if(str_contains($route->getRoute(), $filter)) { return true; } if(str_contains($this->getNormalizedActionName($route), $filter)) { return true; } if(str_contains((string) $route->getName(), $filter)) { return true; } ...
Search count only routine.
public function searchCount(\Doctrine\ORM\QueryBuilder $qb) { $qb->select('COUNT(DISTINCT t.transaction_id)'); return intval($qb->getSingleScalarResult()); }
Gets the allowInsertRows property value. Represents the worksheet protection option of allowing inserting rows.
public function getAllowInsertRows(): ?bool { $val = $this->getBackingStore()->get('allowInsertRows'); if (is_null($val) || is_bool($val)) { return $val; } throw new \UnexpectedValueException("Invalid type found in backing store for 'allowInsertRows'"); }
nacita sluzby podle obyvatele
private function selectServicesObyvatele($scheduler, $id){ $result = $scheduler->adminLoadServiceObyvatel($id); return $this->transformToJSON($result); }
Implements theme_links() targeting the main menu specifically Outputs Foundation Nav bar
function zurpal_js_alter(&$javascript) { // Swap out jQuery to use an updated version of the library. $javascript['misc/jquery.js']['data'] = drupal_get_path('theme', 'zurpal') . '/javascripts/foundation/jquery.js'; $javascript['misc/jquery.js']['version'] = '1.9.0'; //drupal_static_reset('drupal_add_js'); ...