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
\\ END NAVIGATION Function //\\ \\ START ATTACH MANU Function //\\
public function attach_menu(){ if($this->access_role->is_Admin() == false) show_404(); if($_SERVER['REQUEST_METHOD'] == 'POST') { if($this->form_validation->run('attach_menu') ){ $this->load->model('AttachMenu_Model'); $this->AttachMenu_Model->attach_menu(); } else { $error = ['class'=>'warning','text'=> validation_errors()]; $this->session->set_flashdata('sms_flash', $error); redirect('Dashboard/attach_menu'); } } else { $this->load->model('AttachMenu_Model'); $data = $this->AttachMenu_Model->view_attach(); $this->load->view('admin/attach_menu_content',$data); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bp_attachments_personal_screen() {\n\n\t/**\n\t * Fires right before the loading of the \"My Media\" screen template file.\n\t *\n\t * @since 1.0.0\n\t */\n\tdo_action( 'bp_attachments_personal_screen' );\n\n\t/**\n\t * Filters the template to load for the \"My Media\" screen.\n\t *\n\t * @since 1.0.0\n\t...
[ "0.5967628", "0.5733828", "0.5670365", "0.55589724", "0.5528676", "0.5453475", "0.5430974", "0.54278517", "0.5427303", "0.5422724", "0.54068476", "0.53856677", "0.5358151", "0.53445446", "0.5338323", "0.5330168", "0.5323818", "0.5319771", "0.5300407", "0.5268886", "0.524617",...
0.0
-1
\\ END ATTACH MANU Function //\\ \\ START POST DECORATION Function //\\
public function decoration($pg = false) { if($this->access_role->is_Author()) { $this->load->model('Decoration_Model'); if($_SERVER['REQUEST_METHOD'] == 'POST') { $this->Decoration_Model->add_decoration(); } $data = $this->Decoration_Model->view_post(); $data['pg']=($pg)?(integer)$pg:null; $this->load->view('admin/post_deoration_content',$data); } else { show_404(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function massattach_post_form_pre()\n{\n\tglobal $context, $board, $topic, $txt, $settings;\n\n\tif (!allowedTo('post_attachment'))\n\t\treturn;\n\n\tloadLanguage('Errors');\n\n\t$current_attach_dir = get_attach_dir();\n\n\t$total_size = 0;\n\tif (!isset($_SESSION['temp_attachments']))\n\t\t$_SESSION['temp_attachm...
[ "0.63753223", "0.6204222", "0.6175238", "0.6124887", "0.6100545", "0.6099578", "0.5816423", "0.5766711", "0.5737994", "0.5687763", "0.56705165", "0.56342655", "0.5617843", "0.55786943", "0.5555076", "0.5534717", "0.55321026", "0.5507631", "0.5431883", "0.53816843", "0.5365379...
0.0
-1
\\ END POST DECORATION Function //\\ \\ START PROFILE Functions //\\
public function profile(){ $this->load->model('profile_model'); $data = $this->profile_model->admin_info(); $this->load->view('admin/profile_content',$data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function do_personal()\r\n\t{\r\n\r\n\t\t$this->lib->do_profile();\r\n\r\n\t}", "function wpgplus_update_profile_status($post_id) {\t$wpgplus_debug_file= WP_PLUGIN_DIR .'/wpgplus/debug.txt';\n\t/* Set up the post */\n\tglobal $more;\n\t$more = 0; //only the post teaser please\n\t$my_post = get_post($post_id);\n\...
[ "0.5828464", "0.58257747", "0.57891023", "0.55653197", "0.5501415", "0.54158527", "0.5410642", "0.53726125", "0.5368775", "0.5343421", "0.52973646", "0.52585113", "0.5247062", "0.5229435", "0.52256566", "0.5220788", "0.5199947", "0.5184318", "0.51605743", "0.5156151", "0.5140...
0.0
-1
\\ END PROFILE Function //\\ \\ START BRAND Function //\\
public function brand(){ if($this->access_role->is_Admin() == false) show_404(); if($_SERVER['REQUEST_METHOD'] === 'POST') { if ($this->form_validation->run('foote_validition') == true) { $this->load->model('Brand_Model'); $this->Brand_Model->update_footer(); } else { $error = ['class'=>'warning','text'=> validation_errors()]; $this->session->set_flashdata('sms_flash', $error); redirect('Dashboard/brand'); } } else { $this->load->view('admin/brand_content'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Generate()\n \t{\n \t\t\n \t}", "function do_personal()\r\n\t{\r\n\r\n\t\t$this->lib->do_profile();\r\n\r\n\t}", "function profile_scripts() {\n\n // Load Profile Schemes.\n wp_enqueue_style( 'yz-schemes' );\n\n // Load Profile Style\n wp_enqueue_style( 'yz-profile', YZ_PA ...
[ "0.5941783", "0.5482347", "0.53077924", "0.52124965", "0.517286", "0.5122612", "0.5112904", "0.50971216", "0.5089613", "0.5086335", "0.508111", "0.50670594", "0.50663555", "0.50650483", "0.5054118", "0.5030316", "0.50143754", "0.5009511", "0.50065994", "0.5003134", "0.4992960...
0.0
-1
\\ END Brand Function //\\ \\ START USER Function //\\
public function user(){ if($this->access_role->is_Admin() == false) show_404(); $this->load->model('User_Model'); $data = $this->User_Model->view_admin(); $this->load->view('admin/user_content',$data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function user();", "function identifyUser() {\n}", "function m_dspUserAccount()\n\t{\n\t\tif(!isset($_SESSION['userid']) || $_SESSION['userid']==\"\")\n\t\t{\n\t\t\t#URL TEMPER\n\t\t\t$this->libFunc->m_mosRedirect($this->m_safeUrl(SITE_URL.\"user/index.php?action=user.loginForm\"));\n\t\t\texit...
[ "0.63044226", "0.59622526", "0.5959432", "0.5896933", "0.5875195", "0.5866667", "0.5824568", "0.5812872", "0.5774559", "0.5759127", "0.57530427", "0.56586564", "0.5632286", "0.5632286", "0.5632286", "0.5632286", "0.5632286", "0.5632286", "0.5632286", "0.5632286", "0.56218505"...
0.0
-1
\\ END USER Function //\\ \\ START ALL POST Function //\\
public function all_post() { if($this->access_role->is_Admin() == false) show_404(); $this->load->model('All_post_Model'); $data = $this->All_post_Model->view_post(); $this->load->view('admin/all_post_content',$data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function postProcess();", "function handle_postUserCode($debug=false)\n {\n $result = Array();\n \n // re-retrieve instance id which could have been modified by a complete\n $this->instance_id\t= $this->instance->getInstanceId();\n \n //synchronised instance object with the database...
[ "0.66147745", "0.6451661", "0.63999707", "0.62948936", "0.627368", "0.62278515", "0.62051165", "0.6107264", "0.6087199", "0.5969431", "0.59576434", "0.59527344", "0.590636", "0.59041363", "0.58864784", "0.5839042", "0.58121175", "0.57949656", "0.5784303", "0.57838845", "0.578...
0.0
-1
\\ END ALL POST Function //\\ \\ START LOGOUT Function //\\
public function logout(){ $this->session->unset_userdata('user_id'); $this->session->unset_userdata('admin_name'); $this->session->unset_userdata('admin_role'); $this->session->unset_userdata('username'); redirect('login'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logout() {\n\t}", "function xvbLogout()\r\n\t{\r\n\t\tprocess_logout();\r\n\t}", "function logoutHandler() {\n clearLogin();\n formatOutput(true, 'logout success');\n}", "public function logOut(): void;", "abstract protected function logout();", "abstract public function logout();", "pri...
[ "0.77454597", "0.77345717", "0.77027786", "0.76214623", "0.7538087", "0.7485766", "0.74501", "0.74286723", "0.7423401", "0.736888", "0.7289299", "0.7219453", "0.72079927", "0.719872", "0.7179793", "0.71632415", "0.7162159", "0.71576965", "0.71526235", "0.71241903", "0.7121541...
0.0
-1
Handle an incoming request.
public function handle($request, Closure $next) { $validatorRequire = Validator::make($request->all(), [ 'token' => 'required', ]); if ($validatorRequire->fails()) { return response()->json([ "code" => ApiStatusCode::PARAMETER_NOT_ENOUGH, "message" => "Token required" ]); } $token = $request->token; $request->headers->set("Authorization", "Bearer " . $token); return $next($request); }
{ "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
Initialize connection and define main table and primary key
protected function _construct() { $this->_init('axaltacore_customuser/partnerinfo', 'partnerinfo_id'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function init() {\n\t\tlist(, $this->db, $this->table) = explode('_', get_called_class(), 3);\n\t\t$this->db = defined('static::DB') ? static::DB : $this->db;\n\t\t$this->table = defined('static::TABLE') ? static::TABLE : $this->table;\n\t\t$this->pk = defined('static::PK') ? static::PK : 'id';\n\t}", "p...
[ "0.6612558", "0.6548025", "0.65423596", "0.65275", "0.6520894", "0.6520894", "0.6511265", "0.64966387", "0.6420786", "0.64094895", "0.6317924", "0.62853867", "0.6282888", "0.6263322", "0.62474734", "0.6246951", "0.62273353", "0.62221295", "0.6174748", "0.6141381", "0.6137397"...
0.0
-1
This will return entity id based on email address.
public function getEntityIdByEmail($email) { $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $readresult = $read->query( 'SELECT entity_id,role_id,role_code FROM `customer_entity` ce LEFT JOIN axaltacore_user_role aur ON ce.entity_id = aur.user_id LEFT JOIN axaltacore_role ar ON aur.role_id = ar.axaltacore_role_id where ce.email = "'.$email.'" and ar.role_code="la_key_user"' ); while ($row = $readresult->fetch()) { $entityId = $row['entity_id']; } return $entityId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmailId() {\n\t\treturn $this->getData('emailId');\n\t}", "protected function userIDEmail ($email)\n {\n \n $user = Model_users::find('all', array\n (\n 'where' => array\n (\n array('email'=>$email),\n )\n ));\n if(!empty($user))\n ...
[ "0.73483413", "0.7223782", "0.72197527", "0.7193137", "0.716111", "0.71277434", "0.70311105", "0.6999079", "0.685598", "0.68531823", "0.6843078", "0.68231684", "0.68041915", "0.6756805", "0.67410135", "0.67270297", "0.67166895", "0.67041534", "0.66755015", "0.66755015", "0.66...
0.81247777
0
/ To unassign parent from User
public function unassginedUser($customerId) { $resource = Mage::getSingleton('core/resource'); $writeConnection = $resource->getConnection('core_write'); $query = 'UPDATE customer_entity SET parent_id = 0 WHERE parent_id = '. $customerId; $writeConnection->query($query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove_from_parent()\n {\n /* Cancel if there's nothing to do here */\n if (!$this->initially_was_account){\n return;\n }\n \n /* include global link_info */\n $ldap= $this->config->get_ldap_link();\n\n /* Remove and write to LDAP */\n plugin::remove_from_parent();\n\n /* ...
[ "0.67111224", "0.5984325", "0.5945639", "0.5759665", "0.5711497", "0.5686699", "0.5667659", "0.5635568", "0.5633572", "0.5625246", "0.5597532", "0.5593291", "0.55842894", "0.5563203", "0.55456454", "0.55262077", "0.5514139", "0.55074096", "0.5491041", "0.5482948", "0.5476212"...
0.6470636
1
Why? This makes validation to fail!!
function setValidator($options, $messages = array()){ if(!$this->_checked && isset($options['required']) && $options['required']){ if(!isset($options['null_values'])){ //$options['null_values'] = array($this->_value); } else{ //$options['null_values'][] = $this->_value; } } parent::setValidator($options, $messages); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _validate() {\n\t}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "private function...
[ "0.78047764", "0.7519951", "0.7519951", "0.7519951", "0.7519951", "0.7519951", "0.7519951", "0.7519951", "0.7519951", "0.7514006", "0.740862", "0.73698527", "0.73535824", "0.73123807", "0.73123807", "0.7275002", "0.72422683", "0.7241979", "0.7241586", "0.72310764", "0.7226725...
0.0
-1
Get all of the comments for the institution
public function finish_report() { return $this->hasMany(finish_report::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getComments() {}", "public function getComments()\n {\n return $this->api->_request('GET', '/api/comments?id='.$this->ID);\n }", "public function getComments()\n {\n $id = $this->getId();\n\n $stmt = \" SELECT c.*, c.id as id, u.username, u.profile_picture FROM _xy...
[ "0.72035265", "0.71401954", "0.71167", "0.7064272", "0.70364404", "0.6958365", "0.6942925", "0.6888225", "0.68644804", "0.6863646", "0.6854806", "0.6841427", "0.6821307", "0.68111676", "0.6757336", "0.6738386", "0.67347515", "0.67111117", "0.67032546", "0.66950244", "0.666173...
0.0
-1
Get the user associated with the institution
public function request_to_volunteer_in_institution_std() { return $this->hasOne(request_to_volunteer_in_institution_std::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function user()\n {\n if (!is_null($this->user)) {\n return $this->user;\n }\n $user = null;\n try {\n $resourceId = Authorizer::getResourceOwnerId();\n $resourceType = Authorizer::getResourceOwnerType();\n } catch (\\Exception $e) {\n ...
[ "0.70086867", "0.68979067", "0.68585247", "0.6844091", "0.6844091", "0.6844091", "0.6844091", "0.6824401", "0.6823274", "0.67765754", "0.6771171", "0.6759654", "0.6757933", "0.6729196", "0.67253685", "0.6712617", "0.67075247", "0.6706649", "0.6697342", "0.6684744", "0.6673766...
0.0
-1
Get the user associated with the institution
public function institution_statistics() { return $this->hasOne(institution_statistics::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function user()\n {\n if (!is_null($this->user)) {\n return $this->user;\n }\n $user = null;\n try {\n $resourceId = Authorizer::getResourceOwnerId();\n $resourceType = Authorizer::getResourceOwnerType();\n } catch (\\Exception $e) {\n ...
[ "0.7012019", "0.6901817", "0.6862211", "0.68486166", "0.68486166", "0.68486166", "0.68486166", "0.6828524", "0.6827206", "0.6779959", "0.6775852", "0.676253", "0.6762527", "0.6733292", "0.6728296", "0.6716293", "0.671103", "0.6710196", "0.67006", "0.66885465", "0.6676772", ...
0.0
-1
Get all of the comments for the institution
public function institution_mailbox() { return $this->hasMany(institution_mailbox::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getComments() {}", "public function getComments()\n {\n return $this->api->_request('GET', '/api/comments?id='.$this->ID);\n }", "public function getComments()\n {\n $id = $this->getId();\n\n $stmt = \" SELECT c.*, c.id as id, u.username, u.profile_picture FROM _xy...
[ "0.72035265", "0.71401954", "0.71167", "0.7064272", "0.70364404", "0.6958365", "0.6942925", "0.6888225", "0.68644804", "0.6863646", "0.6854806", "0.6841427", "0.6821307", "0.68111676", "0.6757336", "0.6738386", "0.67347515", "0.67111117", "0.67032546", "0.66950244", "0.666173...
0.0
-1
Get all of the comments for the institution
public function request_volunteers_institution() { return $this->hasMany(request_volunteers_institution::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getComments() {}", "public function getComments()\n {\n return $this->api->_request('GET', '/api/comments?id='.$this->ID);\n }", "public function getComments()\n {\n $id = $this->getId();\n\n $stmt = \" SELECT c.*, c.id as id, u.username, u.profile_picture FROM _xy...
[ "0.72035265", "0.71401954", "0.71167", "0.7064272", "0.70364404", "0.6958365", "0.6942925", "0.6888225", "0.68644804", "0.6863646", "0.6854806", "0.6841427", "0.6821307", "0.68111676", "0.6757336", "0.6738386", "0.67347515", "0.67111117", "0.67032546", "0.66950244", "0.666173...
0.0
-1
Get the user that owns the institution
public function type_of_institution() { return $this->belongsTo(type_of_institution::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getOwner() {\n // no need to check whether exist because of database constrain\n return User::getUserById($this->owner_id);\n }", "public function user()\n {\n if (!is_null($this->user)) {\n return $this->user;\n }\n $user = null;\n try {...
[ "0.7486503", "0.728493", "0.68975556", "0.68084127", "0.6785338", "0.67441034", "0.6735582", "0.67186874", "0.67097574", "0.66292715", "0.6564688", "0.6555642", "0.65469617", "0.6541447", "0.6479597", "0.6455385", "0.64459264", "0.64416015", "0.6435536", "0.6435536", "0.64355...
0.0
-1
add_filter( 'dentario_filter_importer_required_plugins','dentario_instagram_feed_importer_required_plugins', 10, 2 );
function dentario_instagram_feed_importer_required_plugins($not_installed='', $list='') { //if (in_array('instagram_feed', dentario_storage_get('required_plugins')) && !dentario_exists_instagram_feed() ) if (dentario_strpos($list, 'instagram_feed')!==false && !dentario_exists_instagram_feed() ) $not_installed .= '<br>Instagram Feed'; return $not_installed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run_blossomthemes_instagram_feed() {\r\n\r\n\t$plugin = new Blossomthemes_Instagram_Feed();\r\n\t$plugin->run();\r\n\r\n}", "function activate_blossomthemes_instagram_feed() {\r\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-blossomthemes-instagram-feed-activator.php';\r\n\tBlossomthemes_...
[ "0.66876394", "0.66649747", "0.64598954", "0.64092255", "0.6392534", "0.6348223", "0.6315788", "0.61637276", "0.6137726", "0.61215276", "0.60820097", "0.60631496", "0.6059491", "0.6058998", "0.60547125", "0.6019657", "0.59754616", "0.5973476", "0.5962512", "0.59384435", "0.59...
0.67997575
0
/ ( Constructing Locks )
public static function newLock($name) { $namespace = PhabricatorLiskDAO::getStorageNamespace(); $namespace = PhabricatorHash::digestToLength($namespace, 20); $full_name = 'ph:'.$namespace.':'.$name; $length_limit = 64; if (strlen($full_name) > $length_limit) { throw new Exception( pht( 'Lock name "%s" is too long (full lock name is "%s"). The '. 'full lock name must not be longer than %s bytes.', $name, $full_name, new PhutilNumber($length_limit))); } $lock = self::getLock($full_name); if (!$lock) { $lock = new PhabricatorGlobalLock($full_name); self::registerLock($lock); } return $lock; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function lock(): void;", "protected function hashLockClause() {}", "function lock()\n{\n}", "public function lock() {}", "public function acquireSharedLock() {}", "public function acquireExclusiveLock() {}", "public function lockToNormal() {}", "public function lock(): void;", "p...
[ "0.7565232", "0.75220346", "0.7506385", "0.74548084", "0.71886015", "0.7093422", "0.70764387", "0.70262825", "0.70005035", "0.70005035", "0.70005035", "0.70005035", "0.70005035", "0.6960764", "0.6897569", "0.68090725", "0.6788309", "0.67802304", "0.6742713", "0.66884744", "0....
0.57240045
82
Use a specific database connection for locking. By default, `PhabricatorGlobalLock` will lock on the "repository" database (somewhat arbitrarily). In most cases this is fine, but this method can be used to lock on a specific connection.
public function useSpecificConnection(AphrontDatabaseConnection $conn) { $this->conn = $conn; $this->isExternalConnection = true; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function doLock($wait) {\n $conn = $this->conn;\n\n if (!$conn) {\n // Try to reuse a connection from the connection pool.\n $conn = array_pop(self::$pool);\n }\n\n if (!$conn) {\n // NOTE: Using the 'repository' database somewhat arbitrarily, mostly\n // because the first...
[ "0.56406045", "0.5614542", "0.5552109", "0.5550203", "0.5518373", "0.54865783", "0.5426204", "0.5401229", "0.5326229", "0.52980053", "0.52967775", "0.5275493", "0.52177733", "0.5215543", "0.52088904", "0.52068484", "0.5199067", "0.51928586", "0.519231", "0.5190674", "0.518240...
0.5021122
94
/ ( Implementation )
protected function doLock($wait) { $conn = $this->conn; if (!$conn) { // Try to reuse a connection from the connection pool. $conn = array_pop(self::$pool); } if (!$conn) { // NOTE: Using the 'repository' database somewhat arbitrarily, mostly // because the first client of locks is the repository daemons. We must // always use the same database for all locks, but don't access any // tables so we could use any valid database. We could build a // database-free connection instead, but that's kind of messy and we // might forget about it in the future if we vertically partition the // application. $dao = new PhabricatorRepository(); // NOTE: Using "force_new" to make sure each lock is on its own // connection. $conn = $dao->establishConnection('w', $force_new = true); } // NOTE: Since MySQL will disconnect us if we're idle for too long, we set // the wait_timeout to an enormous value, to allow us to hold the // connection open indefinitely (or, at least, for 24 days). $max_allowed_timeout = 2147483; queryfx($conn, 'SET wait_timeout = %d', $max_allowed_timeout); $lock_name = $this->getName(); $result = queryfx_one( $conn, 'SELECT GET_LOCK(%s, %f)', $lock_name, $wait); $ok = head($result); if (!$ok) { throw new PhutilLockException($lock_name); } $conn->rememberLock($lock_name); $this->conn = $conn; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _i() {\n }", "private function __() {\n }", "public function helper()\n\t{\n\t\n\t}", "function specialop() {\n\n\n\t}", "public function operations();", "private function __construct()\t{}", "public function temporality();", "final function velcom(){\n }", "pub...
[ "0.6215982", "0.6046039", "0.5977724", "0.5795871", "0.5775646", "0.5769733", "0.5731374", "0.5671888", "0.5661205", "0.5640303", "0.5617398", "0.5617398", "0.5584446", "0.5574076", "0.55314237", "0.55249363", "0.5521218", "0.5521218", "0.5477436", "0.54721344", "0.54703975",...
0.0
-1
/ To change this template, choose Tools | Templates and open the template in the editor.
function smarty_function_print_messages($params, &$smarty) { $list = array(); $smarty->loadPlugin("smarty_function_translate_message"); foreach ($params["messages"] as $message) { $list[] = smarty_function_translate_message(array( "message" => $message, "dictonary" => $params["dictonary"]), $smarty); } if (!isset($params["delimiter"])) $params["delimiter"] = "<br />"; return implode($params["delimiter"], $list); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function __() {\n }", "public function custom()\n\t{\n\t}", "public function helper()\n\t{\n\t\n\t}", "public function forTemplate() {\n\t\treturn; \n\t}", "private function _i() {\n }", "public function __construct ()\n { // TODO Auto-generated constructor\n }", "functio...
[ "0.62693316", "0.62481993", "0.6141029", "0.6072559", "0.60316855", "0.6026014", "0.5935997", "0.59034765", "0.5879668", "0.58743393", "0.58743393", "0.58552086", "0.58551943", "0.58517367", "0.58355653", "0.5835139", "0.5835139", "0.5830859", "0.5830859", "0.5830859", "0.583...
0.0
-1
Fix iOS issue if this blog uses msfile rewrite. If not, this code does no harm.
private function un_ms_file_rewrite_path($url_to_file){ $basedir = wp_upload_dir(); $basedir = $basedir['basedir']; $date_folder = NULL; preg_match('#/[0-9]{4}/[0-1]{1}[0-9]{1}#', $url_to_file, $date_folder); $path_to_file = $basedir . $date_folder[0] . '/' . basename($url_to_file); //at this point, we have the full unix path to the file. This is bad on the internet. //strip the unnecessary unix stuff at the beginning and replace it with the domain name $path_to_file = strstr($path_to_file, 'wp-content'); //build the domain-based path $url_build = get_site_url(); return $url_build .'/'. $path_to_file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function fixFiles()\n {\n\n \tforeach (glob(base_path($this->passport_path) . '*.php') as $filename)\n \t{\n \t $file = file_get_contents($filename);\n \t file_put_contents($filename, str_replace($this->laravel_model, $this->mongo_model, $file));\n \t //$this->info($filename . ...
[ "0.59424436", "0.5724621", "0.571139", "0.5705128", "0.56007516", "0.55843925", "0.5566918", "0.54799926", "0.5356928", "0.52918494", "0.52160275", "0.52021396", "0.51792675", "0.5136813", "0.51321155", "0.51138586", "0.51103365", "0.5095997", "0.50830734", "0.50760764", "0.5...
0.5746252
1
changing variable name for clarity
private function hc_portfolio_prepare_file_paths(&$array_of_file_data){ $files = &$array_of_file_data; foreach($files as &$file){ foreach($file as $field_name => &$field){ //Is this an attachment field? Wouldn't want to accidentally just look up a random URL for what is supposed to actually be a number. if(!in_array($field_name, self::$file_field_names)) continue; if($field == 0) { //remove unused URL fields unset($file[$field_name]); continue; } $field = $this->un_ms_file_rewrite_path(wp_get_attachment_url($field)); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e($var_nm)\n{\n\tglobal $$var_nm ;\n\n\treturn '$' . $var_nm . ' = ' . $$var_nm . ' ' ;\n}", "function _varname($varname) {\n\t\treturn \"{\".$varname.\"}\";\n\t}", "public function setName($x) { $this->name = $x; }", "public function tlogVariable($name, $variable);", "function readable_name($vari...
[ "0.667622", "0.65881693", "0.648625", "0.6436127", "0.638864", "0.63070613", "0.62799484", "0.623869", "0.62163174", "0.6204088", "0.6196251", "0.6128466", "0.6100077", "0.6063482", "0.6057078", "0.6039364", "0.6039364", "0.60385", "0.60385", "0.6014403", "0.6007379", "0.59...
0.0
-1
Create a new ForumPost
public function __construct($obj) { parent::__construct($obj->post_id, RESOURCE_FORUMPOST); $this->obj = $obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createPost()\n {\n if ($this->issetPostSperglobal('title') &&\n $this->issetPostSperglobal('description') &&\n $this->issetPostSperglobal('content') &&\n $this->issetPostSperglobal('categorie') &&\n $this->issetPostSperglobal('publish'))\n ...
[ "0.776668", "0.7639285", "0.7543489", "0.7351308", "0.7281514", "0.7274098", "0.72166705", "0.71891904", "0.71742165", "0.7148633", "0.70920765", "0.70659447", "0.70446986", "0.70179886", "0.69931716", "0.6988377", "0.69670606", "0.69594246", "0.69440734", "0.693962", "0.6927...
0.0
-1
Create fake instance of StoreClass and save it in database
public function makeStoreClass($storeClassFields = []) { /** @var StoreClassRepository $storeClassRepo */ $storeClassRepo = App::make(StoreClassRepository::class); $theme = $this->fakeStoreClassData($storeClassFields); return $storeClassRepo->create($theme); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testCreateStore()\n {\n\n }", "public function testStore() {\n\n if ($this->skipBaseTests) $this->markTestSkipped('Skipping Base Tests');\n\n $item = $this->model->factory()->make();\n\n // Check create :: Create model\n $response = $this->postJson($this->baseUrl...
[ "0.7180867", "0.71392226", "0.709205", "0.6503009", "0.64987934", "0.64987934", "0.64987934", "0.6385105", "0.63572985", "0.6300413", "0.6215858", "0.6212471", "0.61288404", "0.6114841", "0.6114841", "0.6114841", "0.6088687", "0.6079472", "0.6072402", "0.6072402", "0.6069644"...
0.628185
10
Get fake instance of StoreClass
public function fakeStoreClass($storeClassFields = []) { return new StoreClass($this->fakeStoreClassData($storeClassFields)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function phpunit_get_store_class() {\n return get_class($this->get_store());\n }", "public function phpunit_get_store_class() {\n return get_class($this->get_store());\n }", "public function phpunit_get_store_class() {\n return get_class($this->get_store());\n }", "protec...
[ "0.7723719", "0.7723719", "0.7723719", "0.712821", "0.69534194", "0.69534194", "0.6892377", "0.6837548", "0.6655793", "0.6606972", "0.65891945", "0.656675", "0.65185696", "0.65054077", "0.6396455", "0.6393407", "0.63020796", "0.6257488", "0.6257488", "0.6257488", "0.6257488",...
0.72753185
3
Get fake data of StoreClass
public function fakeStoreClassData($storeClassFields = []) { $fake = Faker::create(); return array_merge([ 'name' => $fake->word, 'desc' => $fake->word, 'weigh' => $fake->randomDigitNotNull, 'total_num' => $fake->randomDigitNotNull, 'created_at' => $fake->word, 'updated_at' => $fake->word, 'deleted_at' => $fake->word ], $storeClassFields); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getStore();", "public function getStore();", "public function phpunit_get_store_class() {\n return get_class($this->get_store());\n }", "public function phpunit_get_store_class() {\n return get_class($this->get_store());\n }", "public function phpunit_get_store_class() {...
[ "0.70334816", "0.70334816", "0.68194956", "0.68194956", "0.68194956", "0.67880493", "0.6580229", "0.64922374", "0.6466835", "0.64177656", "0.6385156", "0.63041747", "0.62529397", "0.6148387", "0.6138337", "0.6127782", "0.6127782", "0.6127782", "0.6127782", "0.6126917", "0.604...
0.6649794
6
Index Page for this controller. Maps to the following URL or or Since this controller is set as the default controller in config/routes.php, it's displayed at So any other public methods not prefixed with an underscore will map to /index.php/welcome/
public function index() { if ($this->session->userdata('id_user')) { redirect(base_url('dashboard')); } else { $this->session->set_userdata("judul","Home"); $this->load->view('login'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function index () {\n $view = new WelcomeIndex();\n $view->display();\n }", "public function index()\n\t{\n\t\treturn view(\"welcome\");\n\t}", "public function index()\n\t{\n\t\t$this->load->view('welcome');\n\t}", "public function action_index()\r\n\t{\r\n\t\t$this->title = 'Welcome...
[ "0.7654609", "0.7413426", "0.7394598", "0.731692", "0.7227223", "0.7227223", "0.71899563", "0.7165393", "0.7151099", "0.7144871", "0.71078676", "0.7078446", "0.7074241", "0.70401293", "0.7029486", "0.7029486", "0.7029486", "0.7029486", "0.7029486", "0.697335", "0.6968791", ...
0.0
-1
Executes this middle ware class.
public function execute(Command $command, callable $next): object;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _run();", "abstract protected function _run();", "protected function _exec()\n {\n }", "protected abstract function performImpl();", "protected function doExecute()\n\t{\n\t\t// Your application routines go here.\n\t}", "abstract public function Execute();", "protected...
[ "0.64949775", "0.64949775", "0.63547426", "0.6351422", "0.6347405", "0.63114053", "0.63035476", "0.62748235", "0.62678397", "0.62614", "0.62436134", "0.6224474", "0.61957383", "0.6142682", "0.6124333", "0.61189306", "0.61189306", "0.61188656", "0.61188656", "0.61188656", "0.6...
0.0
-1
Listing Masterdocs based on the selected condition
public function getMasterdocCondition($filterCondition){ if ($filterCondition == Configure::read('DEFAULT_FILTER')) { // 1. Getting master docs with logged in user as owner $masterdocCondition = array( 'owner ' => CakeSession::read('user.User.id'), 'available_deal_issue ' => 1 ); } else { $masterdocCondition = array( 'available_deal_issue ' => 1 ); } return $masterdocCondition; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionIndex()\n\t{\n\t\t$searchModel = new WiMasterlistSearch;\n\t\t$dataProvider = $searchModel->search($_GET);\n\n\t\tTabs::clearLocalStorage();\n\n Url::remember();\n \\Yii::$app->session['__crudReturnUrl'] = null;\n\n\t\treturn $this->render('index', [\n\t\t\t'dataProvider' => $d...
[ "0.5979422", "0.57736385", "0.57638794", "0.5752535", "0.5743459", "0.57180274", "0.5673956", "0.56717503", "0.5652149", "0.56315714", "0.5604542", "0.5568464", "0.5545227", "0.55364686", "0.5532948", "0.55277866", "0.55190057", "0.55094266", "0.5505112", "0.54830223", "0.547...
0.5448133
25
Set credentials for connecting to repo.magento.com
protected function repoAuthentication($needAuthentication, RepoCredentials $repoCredentials) { if ($needAuthentication) { $this->setupWizard->getSystemConfig()->clickSystemConfig(); $this->setupWizard->getAuthentication()->fill($repoCredentials); $this->setupWizard->getAuthentication()->clickSaveConfig(); $this->setupWizard->open(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setCredentials()\n\t{\n\t\t$settings_repo = new \\Kickapoo\\Repositories\\SettingRepository;\n\t\t$this->credentials = $settings_repo->socialCreds();\n\t}", "private function setCredentials()\n\t{\n\t\t$this->credentials['app_token'] = $this->settings_repo->getSiteSetting('facebook', 'app_token')...
[ "0.7305122", "0.694442", "0.6214177", "0.6104557", "0.5927543", "0.58925575", "0.5843619", "0.58394843", "0.5798745", "0.5700157", "0.5691571", "0.56828374", "0.5670536", "0.5639334", "0.56014687", "0.55825573", "0.555298", "0.55181324", "0.55024445", "0.5487318", "0.5485765"...
0.0
-1
Readiness check and Create Backup steps.
protected function readinessCheckAndBackup( AssertSuccessfulReadinessCheck $assertReadiness, BackupOptions $backupOptions ) { $this->readinessCheck($assertReadiness); $this->setupWizard->getReadiness()->clickNext(); $this->backup($backupOptions); $this->setupWizard->getCreateBackup()->clickNext(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n// dd('backup.create');\n $exitCode = Artisan::call('backup:run', ['--only-db'=>true]);\n return redirect()->route('backup.index');\n }", "protected function initial()\n {\n $adapter = new Local('/', LOCK_SH, Local::SKIP_LINKS);\n $local =...
[ "0.6220813", "0.6220601", "0.6089825", "0.6017322", "0.5974011", "0.59259033", "0.58765393", "0.5808511", "0.575421", "0.5747473", "0.56747955", "0.56574196", "0.56556", "0.5649466", "0.5625648", "0.5590939", "0.55859196", "0.5580922", "0.5556306", "0.5543951", "0.55151266", ...
0.7063489
0
use SoftDeletes; protected $dates = ['deleted_at'];
public function consumer(){ return $this->belongsTo('App\Consumer'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function useSoftDeletes()\n {\n $this->attributes['softDeletes'] = true;\n $this->_deleted_at (\"Deleted Date\", FieldBlueprint::TIMESTAMP, null);\n\n $this->dates(['deleted_at']);\n return $this;\n }", "public function setDeleted() {}", "public function getDelete_date(...
[ "0.75997573", "0.6818382", "0.6768563", "0.67431164", "0.67198527", "0.6630542", "0.6564059", "0.65411496", "0.6502996", "0.6480554", "0.6418776", "0.63602823", "0.6340713", "0.6310638", "0.6302615", "0.6289997", "0.6273521", "0.6272588", "0.62582743", "0.61169845", "0.611698...
0.0
-1
/ v2: Return an array of custdata for the memberId. Calling script to test for ofitems in array: 0=none, >=1 if some. Return errorstring if the lookup failed. / v1: Return TRUE if the Civi membership number is known in ISC4C custdata. Return FALSE if not. Return errorstring if the lookup failed. Is there something to gain by getting some data, such a numberof persons from custdata at this point? Names for household members?
function searchIS4C($member) { global $dbConn2; $is4cMembers = array(); $sel = "SELECT CardNo, personNum, FirstName, LastName FROM custdata where CardNo = ${member};"; $rslt = $dbConn2->query("$sel"); if ( $dbConn2->errno ) { $msg = sprintf("Error: DQL failed: %s\n", $dbConn2->error); $is4cMembers[] = array($msg); return($is4cMembers); } // What is $rslt if 0 rows? Does it exist? //$n = 0; while ( $row = $dbConn2->fetch_row($rslt) ) { //$n++; $is4cMembers[] = array($row[CardNo], $row[personNum], $row[FirstName], $row[LastName]); } return($is4cMembers); // searchIS4C }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cns_cache_member_details($members)\n{\n require_code('cns_members');\n\n $member_or_list = '';\n foreach ($members as $member) {\n if ($member_or_list != '') {\n $member_or_list .= ' OR ';\n }\n $member_or_list .= 'm.id=' . strval($member);\n }\n if ($member_...
[ "0.5722052", "0.5636185", "0.5567402", "0.54970694", "0.5495408", "0.5491785", "0.5466657", "0.5400659", "0.5390302", "0.53853226", "0.53717375", "0.5355878", "0.5354773", "0.5340167", "0.53352743", "0.5290059", "0.5283923", "0.52817833", "0.52813745", "0.5279581", "0.5274399...
0.6772406
0
Insert the records for this Individual, Household or Organization. Return "OK" if all OK or abort returning message on any error.
function insertToIS4C() { global $dbConn2; global $insertCustdata; global $insertMeminfo; global $insertMemContact; global $insertMemDates; global $insertMemberCards; global $insertStockpurchases; global $debug; //echo "In insertToIS4C\n"; $statements = array($insertMeminfo, $insertMemContact, $insertMemDates, $insertMemberCards); $statement = ""; if ( count($insertCustdata) > 0 ) { foreach ($insertCustdata as $statement) { if ( $debug == 1) echo $statement, "\n"; //continue; $rslt = $dbConn2->query("$statement"); if ( 1 && $dbConn2->errno ) { return(sprintf("Error: Insert failed: %s\n", $dbConn2->error)); } } } else { //echo "No custdata to insert.\n"; 1; } foreach ($statements as $statement) { if ( $statement != "" ) { if ( $debug == 1) echo $statement, "\n"; //continue; $rslt = $dbConn2->query("$statement"); if ( 1 && $dbConn2->errno ) { return(sprintf("Error: Insert failed: %s\n", $dbConn2->error)); } } } // stockpurchases is in a different db. return("OK"); // insertToIS4C }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function insertRecords(){\n // Get the sql statement\n $sql = $this->insertSql();\n // Prepare the query\n $stmt = $this->db->prepare($sql);\n\n foreach ($this->paramsValues as $key=>$value) {\n $stmt->bindParam($this->params['columnNameP...
[ "0.57897073", "0.55630565", "0.54652715", "0.54429394", "0.543053", "0.53655815", "0.5364712", "0.536319", "0.53578377", "0.5351041", "0.5329684", "0.5303191", "0.5281365", "0.5277889", "0.527286", "0.52683336", "0.52659833", "0.52610916", "0.5246014", "0.5235282", "0.5222054...
0.0
-1
Update the records for this Individual, Household or Organization. Return "OK" if all OK or abort returning message on any error.
function updateIS4C() { global $dbConn2; //echo "In updateIS4C\n"; global $updateCustdata; global $updateMeminfo; global $updateMemContact; global $updateMemDates; global $updateMemberCards; global $updateStockpurchases; global $debug; $statements = array($updateMeminfo, $updateMemContact, $updateMemDates, $updateMemberCards); $statement = ""; if ( count($updateCustdata) > 0 ) { foreach ($updateCustdata as $statement) { if ( $debug == 1) echo $statement, "\n"; //continue; $rslt = $dbConn2->query("$statement"); if ( 1 && $dbConn2->errno ) { return(sprintf("Error: Update failed: %s\n", $dbConn2->error)); } } } else { //echo "No custdata to update.\n"; 1; } foreach ($statements as $statement) { if ( $statement != "" ) { if ( $debug == 1) echo $statement, "\n"; //continue; $rslt = $dbConn2->query("$statement"); if ( 1 && $dbConn2->errno ) { return(sprintf("Error: Update failed: %s\n", $dbConn2->error)); } } } // stockpurchases is in a different db. return("OK"); // updateIS4C }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionUpdate() {\n $data = $this->data;\n $model = $this->findModel($data['employee_id']);\n if ($model) {\n $model->employee_code = $data['employee_code'];\n $model->employee_name = $data['employee_name'];\n $model->employee_email = $data['empl...
[ "0.6358098", "0.61777586", "0.61179405", "0.6110263", "0.60081863", "0.59716684", "0.5898757", "0.58846474", "0.5882847", "0.58776665", "0.5833215", "0.58197916", "0.58184457", "0.580224", "0.5797307", "0.578883", "0.57694465", "0.57573515", "0.5756782", "0.5746046", "0.57255...
0.0
-1
Each IS4C table is represented by an assoc array.
function clearWorkVars() { // in core_op // Card#, Person#, Name global $custdata; // Contact points for Card# global $meminfo; // Whether/how to contact. global $memContact; // Membership start, i.e. join date global $memDates; // Member Card barcode lookup. global $memberCards; // in core_trans global $stockpurchases; // in core_op // Card#, Person#, Name // $custdata[CardNo] = 0; // $custdata[personNum] = 0; $flds = array_keys($custdata); foreach ($flds as $field) { $custdata[$field] = ""; } $flds = array_keys($meminfo); foreach ($flds as $field) { $meminfo[$field] = ""; } $flds = array_keys($memDates); foreach ($flds as $field) { $memDates[$field] = ""; } $flds = array_keys($memContact); foreach ($flds as $field) { $memContact[$field] = ""; } $flds = array_keys($memberCards); foreach ($flds as $field) { $memberCards[$field] = ""; } $flds = array_keys($stockpurchases); foreach ($flds as $field) { $stockpurchases[$field] = ""; } global $insertCustdata; global $insertMeminfo; global $insertMemContact; global $insertMemDates; global $insertMemberCards; global $insertStockpurchases; global $updateCustdata; global $updateMeminfo; global $updateMemContact; global $updateMemDates; global $updateMemberCards; global $updateStockpurchases; $insertCustdata = array(); $insertMeminfo = ""; $insertMemContact = ""; $insertMemDates = ""; $insertMemberCards = ""; $insertStockpurchases = ""; $updateCustdata = array(); $updateMeminfo = ""; $updateMemContact = ""; $updateMemDates = ""; $updateMemberCards = ""; $updateStockpurchases = ""; // clearWorkVars }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function getTablesArray();", "function table()\n {\n\n $db = $this->getDatabaseConnection();\n $dbtype = $db->phptype; // Database type is stored here. Crazy but true.\n\n return array('user_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,\n 'yubike...
[ "0.6260416", "0.59579086", "0.5916091", "0.5793578", "0.5779633", "0.57737964", "0.57278514", "0.56756496", "0.55498534", "0.5511058", "0.5481044", "0.5476275", "0.5475782", "0.54178816", "0.54178816", "0.54178816", "0.54153174", "0.5411465", "0.5407019", "0.5379701", "0.5373...
0.0
-1
Return province or state name from code format 1=abbreviation or 2=fullname
function getProvince($num = 0, $format = 1) { $province = ""; if ( $format == 1 ) { switch ($num) { case 1108: $province = "ON"; break; default: $province = "XX"; break; } } return($province); //getProvince }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getStateNameByCode($code) {\n $states = array(\n \"AC\" => \"Acre\",\n \"AL\" => \"Alagoas\",\n \"AM\" => \"Amazonas\",\n \"AP\" => \"Amapá\",\n \"BA\" => \"Bahia\",\n \"CE\" => \"Ceará\",\n \"DF\" => \"Distrito Fe...
[ "0.7082496", "0.6623176", "0.6491565", "0.62882483", "0.61521363", "0.613532", "0.60997033", "0.608652", "0.60698044", "0.60149306", "0.5968017", "0.595726", "0.5929277", "0.5924106", "0.5912176", "0.58841884", "0.58828866", "0.58730334", "0.58374053", "0.58254826", "0.580193...
0.6148748
5
o Return in format "A9A 9A9"
function fixPostalCode($str = "") { $str = strtoupper($str); // Remove anything but uppercase letters and numbers. $str = preg_replace("/[^A-Z\d]/", "", $str); // Format: A9A 9A9 // Leaves non-postal-code content alone. $str = preg_replace("/([A-Z]\d[A-Z])(\d[A-Z]\d)/", "$1 $2", $str); return($str); //fixPostalCode }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hex_to_str($hex)\n{\n $string='';\n\n for ($i=0; $i < strlen($hex)-1; $i+=2)\n {\n $d = hexdec($hex[$i].$hex[$i+1]);\n\n //Show only if number of alphabet\n if( ($d >= 48 and $d <= 57) or ($d >= 65 and $d <= 90) or ($d >= 97 and $d <= 122) )\n {\n $string .=...
[ "0.65868616", "0.6437217", "0.6437217", "0.6384981", "0.6288597", "0.6287685", "0.6262768", "0.6248616", "0.6173016", "0.61293674", "0.6119358", "0.60921407", "0.6080099", "0.6050879", "0.60495025", "0.60257274", "0.6011885", "0.59966093", "0.59469706", "0.59413487", "0.59374...
0.0
-1
/ o Return in format 9999999999 unless the original wasn't even close.
function fixPhone($str = "") { $str_orig = $str; $str = preg_replace("/[^\d]/", "", $str); $str = preg_replace("/^(\d{3})(\d{3})(\d{4})$/", "$1-$2-$3", $str); if ( preg_match("/^(\d{3})-(\d{3})-(\d{4})$/", $str) ) { return($str); } else { $str_orig = str_replace("'", "''", $str_orig); return($str_orig); } //fixPhone }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function num_to_short($num)\n{\n\tif (is_float($num))\n\t\t$num = round($num);\n\t\n\tif ($num >= 1000) {\n\t\t$i = 1000;\n\t\twhile ($num >= $i) {\n\t\t\t$return = ($i/1000). \"K\";\n\t\t\t\n\t\t\tif ($num > $i)\n\t\t\t\t$return .= \"+\";\n\t\t\t\n\t\t\t$i += 1000;\n\t\t}\n\t} else\n\t\t$return = $num;\n\t\n\tret...
[ "0.6179624", "0.58028585", "0.57469213", "0.5673696", "0.56473637", "0.56119037", "0.5576254", "0.5550005", "0.5534598", "0.5507336", "0.54732734", "0.54453635", "0.54210365", "0.5353795", "0.52585226", "0.5243332", "0.5233228", "0.5214374", "0.5212127", "0.52120453", "0.5201...
0.0
-1
/ City: + tolower if ALL CAPS + Capitalize first letter of each word + Double apostrophes
function fixCity($str = "") { if ( preg_match("/[A-Z]{3}/", $str) ) { $str = strtolower($str); } $str = ucwords($str); $str = str_replace("'", "''", $str); return($str); //fixCity }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accronym($string) {\n $out = '';\n foreach (explode(' ', $string) as $value) {\n if ($value) {\n $out .= strtoupper($value[0]);\n }\n }\n return $out;\n}", "function makeTitleCase($input_title)\n {\n $input_array_of_words = explode(\" \", strtolower...
[ "0.6969585", "0.6899945", "0.6711611", "0.65355843", "0.65331244", "0.65323824", "0.6488122", "0.6426783", "0.6404989", "0.6376354", "0.63423026", "0.63273424", "0.63271356", "0.62753755", "0.6269467", "0.62544614", "0.62507164", "0.62440306", "0.6243878", "0.6205333", "0.619...
0.74844426
0
/ Name: + tolower if ALL CAPS + Capitalize first letter of each word + Double apostrophes
function fixName($str = "") { if ( preg_match("/[A-Z]{3}/", $str) ) { $str = strtolower($str); // First letter after hyphen $str = preg_replace("/(-[A-Z])/", "$1", $str); if ( "$1" != "" ) { $upper1 = strtoupper("$1"); $str = str_replace("$1", "$upper1", $str); } //$str = preg_replace("/(-[A-Z])/", strtoupper($1), $str); // T_LNUMBER error $str = ucwords($str); } // Is all-lowercase + hyphen space apostrophe elseif ( preg_match("/^[- 'a-z]+$/", $str) ) { // Need exceptions: "di", "de la", ... ? $str = ucwords($str); } // Already mixed-case else { 1; } $str = str_replace("'", "''", $str); return($str); //fixName }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accronym($string) {\n $out = '';\n foreach (explode(' ', $string) as $value) {\n if ($value) {\n $out .= strtoupper($value[0]);\n }\n }\n return $out;\n}", "function formatName(array $name)\r\n {\r\n return $name['last_name'] . ' ' . preg_replace('/\\b([A-Z])...
[ "0.7363329", "0.7195041", "0.7092894", "0.70499", "0.6981637", "0.6964604", "0.6916112", "0.69152504", "0.6858851", "0.68585974", "0.6833126", "0.68254685", "0.67995447", "0.67752856", "0.6696308", "0.668311", "0.665933", "0.66548085", "0.6652857", "0.6622695", "0.6607264", ...
0.69634426
6
/ Address: + tolower if ALL CAPS + Capitalize first letter of each word + Double apostrophes
function fixAddress($str = "") { if ( preg_match("/[A-Z]{3}/", $str) ) { $str = strtolower($str); } $str = ucwords($str); $str = str_replace("'", "''", $str); return($str); //fixAddress }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accronym($string) {\n $out = '';\n foreach (explode(' ', $string) as $value) {\n if ($value) {\n $out .= strtoupper($value[0]);\n }\n }\n return $out;\n}", "function makeTitleCase($input_title)\n {\n $input_array_of_words = explode(\" \", strtolower...
[ "0.7151543", "0.70927954", "0.6959306", "0.6914649", "0.6890335", "0.6821561", "0.6732551", "0.67044103", "0.66475236", "0.66254514", "0.6596069", "0.6574875", "0.6570055", "0.6558186", "0.6545003", "0.6542625", "0.6531809", "0.6515873", "0.6495379", "0.64914894", "0.6483181"...
0.65863186
11
Return an array of the name keys: 1, 3, etc.
function getNameKeys($row) { $names = array(); $key = ""; $n = 0; foreach (array_keys($row) as $key) { // Test for odd number. // http://ca.php.net/manual/en/function.array-filter.php // Also works: //if ( ($n % 2) != 0 ) {} if ($n & 1) { $names[] = $key; //echo "$n odd: $key\n"; } else { 1; //echo "$n not-odd: $key\n"; } $n++; } return($names); //getNameKeys }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function keys(): array;", "public function getNames()\n {\n if($this->isKeycacheInvalid())\n {\n $this->regenerateKeyCache();\n }\n if(is_array($this->__keycacheindex))\n {\n return $this->__keycacheindex;\n }\n return array(...
[ "0.7769973", "0.7661111", "0.7580498", "0.7580498", "0.7580498", "0.7544186", "0.7449566", "0.7449566", "0.7371521", "0.724048", "0.72181845", "0.718179", "0.71708834", "0.71708834", "0.7136591", "0.706684", "0.7032246", "0.70275736", "0.6991015", "0.6954699", "0.6954699", ...
0.67618155
49
Return an array of the values from the oddnumbered elements i.e. hashname keys: 1, 3, etc. I.e. reduce the duplication of a BOTH array. Getting the evens would have the same result.
function getNameValues($row) { $values = array(); $val = ""; $n = 0; foreach ($row as $val) { // Test for odd number. // http://ca.php.net/manual/en/function.array-filter.php // Also works: //if ( ($n % 2) != 0 ) {} if ($n & 1) { $values[] = $val; //echo "$n odd: $key\n"; } else { 1; //echo "$n not-odd: $key\n"; } $n++; } return($values); //getNameValues }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evenNumbers(array $array): array\n{\n $resultArray = [];\n\n if (count($array) !== 0) {\n foreach ($array as $elementArray) {\n if (($elementArray % 2) === 0) {\n $resultArray[] = $elementArray;\n }\n }\n }\n return $resultArray;\n}", "funct...
[ "0.6245411", "0.6010292", "0.5541475", "0.5506541", "0.5460188", "0.54284096", "0.5362256", "0.53396577", "0.5330465", "0.53092116", "0.52846", "0.5278048", "0.5277437", "0.5250284", "0.5249447", "0.5221857", "0.5216014", "0.5214611", "0.5199264", "0.519908", "0.51730853", ...
0.65567416
0
chama a view principal
public function index(){ return view('lista'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Public Function ChamaView() {\n $params = array();\n echo ($this->gen_redirect_and_form(BaseController::ReturnView(BaseController::getPath(), get_class($this)), $params));\n }", "Public Function ChamaView(){\n $params = array();\n echo ($this->gen_redirect_and_form(BaseController::...
[ "0.6314638", "0.6307152", "0.6307152", "0.5759571", "0.5641569", "0.54039246", "0.5371139", "0.53407365", "0.5334472", "0.5318522", "0.5318522", "0.5299715", "0.52849466", "0.5282864", "0.5225355", "0.5194086", "0.5179187", "0.51637566", "0.5162638", "0.51611763", "0.5158175"...
0.0
-1
busca a lista de contatos, apenas os campos selecionados por nome
public function listar(){ $lista = Contato::select('id','nome','email','telefone')->get(); return $lista; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function Lista_Ciudades()//FUNCION PARA LLAMAR LA LISTA DE DEPARTAMENTOS\n {\n \n include('conexion.php');\n \n\n $Consulta_Ciudad = \"SELECT * FROM p_ciudad ORDER BY ciud_nombre\";\n\t\t\t $Resultado_Consulta_Ciudad = $conexion->prepare($Consulta_Ciuda...
[ "0.64384043", "0.6436177", "0.6290939", "0.62590694", "0.6210102", "0.61098975", "0.60694504", "0.59951264", "0.5953743", "0.594025", "0.59340906", "0.5927841", "0.589909", "0.58936024", "0.58875006", "0.58855534", "0.5881688", "0.58254987", "0.57962465", "0.57754374", "0.576...
0.6360603
2
__construct Instantiates the validator class
public function __construct() { $this->_val = new \tinyPHP\Classes\Core\Val(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createValidator();", "public function __construct() {\n\n $this->inputmanager = new Validator();\n\n $this->config = $this->configuration();\n\n $this->validation = $this->validate(); \n\n }", "public function __construct() {\n\n\t\t//Call the parent constructor\n\t\...
[ "0.77763444", "0.7707832", "0.76635814", "0.75208306", "0.73693174", "0.73514265", "0.73025894", "0.7247031", "0.7213092", "0.71903473", "0.7152608", "0.71146846", "0.7040914", "0.7014733", "0.7014733", "0.70025885", "0.6996356", "0.6972854", "0.6961003", "0.691606", "0.69116...
0.0
-1
post This is to run $_POST
public function post($field) { $this->_postData[$field] = $_POST[$field]; $this->_currentItem = $field; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _post()\r\n\t\t{\r\n\t\t}", "function post() \n {\n \n }", "public function process_post() {\n\t\t$name = $this->node->attr('name');\n\n\n\t\tif (!empty($_POST) && $this->get_post_value($name)) {\n//\t\t\t$this->value = $this->get_post_value($name);\n\t\t\t$this->value($this->get_post_valu...
[ "0.8003076", "0.7574693", "0.7483119", "0.741681", "0.73471427", "0.73341864", "0.73341864", "0.73341864", "0.7243884", "0.7085929", "0.70733476", "0.6999287", "0.69616425", "0.6865595", "0.68534374", "0.68443", "0.6795214", "0.67809254", "0.6692392", "0.6659166", "0.6610034"...
0.0
-1
fetch Return the posted data
public function fetch($fieldName = false) { if ($fieldName) { if (isset($this->_postData[$fieldName])) return $this->_postData[$fieldName]; else return false; } else { return $this->_postData; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function data() {\n $request = $this->requestReader->getContents();\n\t\tif ($request) {\n if ($json_post = CJSON::decode($request)){\n\t\t\t\treturn $json_post;\n\t\t\t}else{\n\t\t\t\tparse_str($request,$variables);\n\t\t\t\treturn $variables;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public fun...
[ "0.66881186", "0.64251953", "0.6424984", "0.6420936", "0.64141625", "0.64034384", "0.63785833", "0.6361615", "0.6343724", "0.63303834", "0.63152176", "0.62848866", "0.6199514", "0.61922556", "0.6173973", "0.61636513", "0.6147817", "0.6130498", "0.61010754", "0.61010754", "0.6...
0.61585677
16
val This is to validate
public function val($typeOfValidator, $arg = null) { if ($arg == null) $error = $this->_val->{$typeOfValidator}($this->_postData[$this->_currentItem]); else $error = $this->_val->{$typeOfValidator}($this->_postData[$this->_currentItem], $arg); if ($error) $this->_error[$this->_currentItem] = $error; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function validate($val) {\n\t\t$res = false;\n\t\tif (isset($val) && ($val != \"\")){\n\t\t\t$res = true;\n\t\t}\n\t\treturn ($res);\n\t}", "public function validateValue($value)\n {\n }", "function validate_value($valid, $value, $field, $input)\n {\n }", "function validate_value($valid, $...
[ "0.6529787", "0.6501874", "0.64302695", "0.64302695", "0.64302695", "0.64302695", "0.6347722", "0.63259983", "0.6169222", "0.61275274", "0.61016923", "0.6099969", "0.608216", "0.6081949", "0.6071868", "0.6071868", "0.606123", "0.5956244", "0.5948128", "0.5948128", "0.5948128"...
0.0
-1
submit Handles the form, and throws an exception upon error.
public function submit() { if (empty($this->_error)) { return true; } else { $str = ''; foreach ($this->_error as $key => $value) { $str .= $key . ' => ' . $value . "\n"; } throw new \Exception($str); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static abstract function postSubmit(Form $form);", "public static function trySubmit() {\n\t}", "abstract public function _submitForm($form, $form_state);", "function submit()\n {\n\t\t//all data is handled by submit2()\n }", "public function submitForm(array &$form, FormStateInterface $form_s...
[ "0.69589335", "0.6942178", "0.6830971", "0.6745352", "0.65533674", "0.6424358", "0.6392939", "0.63731104", "0.6354493", "0.6345528", "0.63408667", "0.63042706", "0.63042706", "0.63042706", "0.62610257", "0.62018657", "0.6164519", "0.6150361", "0.6133404", "0.6108087", "0.6061...
0.6541101
5
Init the module with specific information.
protected function init() { $this->basePath = __DIR__; \Yii::setPathOfAlias($this->getShortId(), __DIR__); \Yii::app()->getMessages()->extensionPaths[$this->getShortId()] = $this->getShortId().'.messages'; parent::init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n parent::init();\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'info.models.*',\n\t\t\t'info.components.*',\n\t\t));\n\t}", "public function init()\n {\n ...
[ "0.78962713", "0.7761095", "0.7704436", "0.76536274", "0.7651287", "0.76059407", "0.7600401", "0.7588906", "0.7571668", "0.7555096", "0.75485635", "0.7547714", "0.7527733", "0.7500003", "0.7456157", "0.74523884", "0.7429657", "0.7393822", "0.7389612", "0.73657477", "0.7339885...
0.0
-1
Run the database seeds.
public function run() { // create an instance of Faker class to the variable $faker $faker = Faker::create(); // get all existing user ids into a $users array $users = User::all()->pluck('id')->toArray(); // generate ten records for the accounts table foreach (range(1,10) as $index){ DB::table('accounts')->insert([ 'userid' => $faker->randomElement($users), 'accountNumber' => $faker->numberBetween(100000,999999), 'type' => $faker->randomElement($array=array('saving', 'current')), 'balance' => $faker->randomFloat(2,0,999999), 'interest' => $faker->randomFloat(2,0,0.1) ]); } }
{ "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
If the URI starts with $needle
public function startsWith($needle) { return ($needle === '') || (0 === strpos((string)$this, $needle)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function match($uri);", "public function match ($uri);", "function startWith($haystack, $needle){\n \treturn $needle === \"\" || strpos($haystack, $needle) === 0;\n\t}", "function startsWith($haystack, $needle){\n\t\t$length = strlen($needle);\n\t\treturn (substr($haystack, 0, $length) === $needle)...
[ "0.66160685", "0.65923005", "0.6553105", "0.65521544", "0.6538332", "0.6478425", "0.641376", "0.6356798", "0.6342114", "0.63109845", "0.6304224", "0.6297337", "0.62943155", "0.6286284", "0.6279851", "0.6277959", "0.6265446", "0.62494045", "0.62271297", "0.6225131", "0.6222819...
0.6635497
0
If the URI ends with $needle
public function endsWith($needle) { return ($needle === '') || (substr((string)$this, -strlen($needle)) === $needle); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function str_endsWith (string $str, string $needle): bool {\n\t$strLen = strlen($str);\n\t$needleLen = strlen($needle);\n\treturn (substr($str, $strLen - $needleLen, $needleLen) === $needle);\n}", "function endsWith($haystack, $needle){\n $length = strlen($needle);\n return $length === 0 ||\n (substr($h...
[ "0.67159086", "0.663944", "0.6612122", "0.6581157", "0.65766317", "0.65681255", "0.65547174", "0.655125", "0.652404", "0.651618", "0.65146327", "0.6500416", "0.649843", "0.6493224", "0.6488655", "0.64760524", "0.6474933", "0.6442232", "0.6421888", "0.64060926", "0.64034575", ...
0.6722348
0
If the URI contains $needle
public function contains($needle) { return ($needle === '') || (false !== strpos((string)$this, $needle)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function match($uri);", "public function match ($uri);", "public function match( $pURI );", "public function findWhereUri($uri);", "function url_contains($string) {\n\n $url = URL;\n //check for string in url\n $lookup = strpos($url, $string);\n\n\n //If string is found, set the value of found...
[ "0.68182063", "0.6739259", "0.6424781", "0.6416", "0.6408486", "0.6407935", "0.6057957", "0.5905668", "0.5898345", "0.5877941", "0.5855489", "0.5802915", "0.5788497", "0.5757634", "0.5730575", "0.56896085", "0.56445354", "0.5637983", "0.56359947", "0.5633843", "0.5590634", ...
0.5317519
54
returns the equivalent of $_SERVER[REQUEST_URI]
public function getRequestUri() { $final = ''; if($this->path) { $final .= $this->path; } if($this->query) { $final .= '?' . $this->query; } return $final; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function requestURI() {\n return $_SERVER['REQUEST_URI'];\n }", "public function requestURI()\n {\n return $_SERVER['REQUEST_URI'];\n }", "public function getRequestUri()\n {\n return (string) $_SERVER['REQUEST_URI'];\n }", "static public functio...
[ "0.8318589", "0.83091086", "0.81592894", "0.81392795", "0.81276876", "0.8109076", "0.8079629", "0.8043538", "0.80174536", "0.80053544", "0.7993777", "0.79654306", "0.7905037", "0.7880404", "0.78587914", "0.7809568", "0.7796144", "0.7792227", "0.7751474", "0.77456325", "0.7720...
0.0
-1
Parses a URI string into components via parse_url
protected function parse($uriString) { if(is_string($uriString)) { return parse_url($uriString); } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function parseUrl(string $url)\n {\n $url_parts = Utils::multibyteParseUrl($url);\n\n if (isset($url_parts['scheme'])) {\n /** @var UniformResourceLocator $locator */\n $locator = Grav::instance()['locator'];\n\n // Special handling for the streams.\n ...
[ "0.72863454", "0.72218287", "0.7086937", "0.7026385", "0.69955015", "0.69792634", "0.69665927", "0.6946515", "0.6928125", "0.68892145", "0.6839346", "0.6812163", "0.6781123", "0.67558753", "0.6739345", "0.6711439", "0.67015976", "0.6673604", "0.66641086", "0.6575618", "0.6570...
0.6321906
32
Returns if the dialog retrieved a valid result. If a valid result has already been received, this method returns true, otherwise false.
public function hasValidResult() { return ( $this->result !== null ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function checkResult() {\n\t\treturn ($this->_query_result !== false);\n\t}", "protected function _isResultValid()\n {\n if (!$this->getRequest()->getParam('result') ||\n !in_array($this->getRequest()->getParam('result'), $this->_validResults)) {\n $this->_logger->error(__(...
[ "0.7610003", "0.7455422", "0.726771", "0.7231844", "0.7221336", "0.7185457", "0.69031245", "0.68116444", "0.68116444", "0.68116444", "0.66841316", "0.66414577", "0.65968955", "0.65859735", "0.6569663", "0.6548598", "0.6537232", "0.6536151", "0.65261424", "0.64882785", "0.6442...
0.7776744
0
Obtiene una lista para paginar los menus
public function index($page = 1) { $categoria = new Categoria(); $this->listCategoria = $categoria->getcategoria($page); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getMenus() {}", "public function set_menu_list()\r\n {\r\n $controllerData = $this->setUrlController;\r\n $controllerData = urldecode($controllerData);\r\n $getUrlSegment = explode('/', $controllerData);\r\n $controllerSet = isset($_GET['page']) && trim($_GET['page'...
[ "0.733573", "0.70259553", "0.6968912", "0.6929603", "0.6902517", "0.68330437", "0.67648596", "0.6743577", "0.6731454", "0.6675419", "0.66578704", "0.66401476", "0.66268253", "0.65992635", "0.6597795", "0.6571413", "0.65563285", "0.654915", "0.6542852", "0.654042", "0.6486123"...
0.0
-1
Append an array of child elements
public function appendChildren(array $elements) { foreach ($elements as $element) { $this->appendChild($element); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function append($node) {\n\t\tif (!is_array($node)) {\n\t\t\t$this->child[]=$node;\n\t\t} else if (is_array($node)) {\n\t\t\tfor ($childIdx=0; $childIdx<count($node); $childIdx++)\n\t\t\t\t$this->child[]=$node[$childIdx];\n\t\t}\n\t}", "function append ( $element ) {\n $this->childrenElements[] = $element;\n...
[ "0.70471627", "0.6645177", "0.64714247", "0.63536996", "0.6318185", "0.62570274", "0.6226185", "0.61726373", "0.6168356", "0.613448", "0.60892767", "0.5971514", "0.5971514", "0.59264576", "0.5910577", "0.5881004", "0.58766544", "0.5809089", "0.5737582", "0.57370627", "0.57098...
0.67076284
1
Performs the AJAX validation.
protected function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 'systemuser-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function ajaxValidationAction()\n {\n if($this->_request->getPost('ajax_submit',false, Request::FILTER_INT))\n $result = 'ok_ajax';\n else\n $result = 'ok';\n $messages = array();\n\n if(!$this->validate())\n {\n $this->collectValidateE...
[ "0.79766375", "0.7535804", "0.6860131", "0.6860131", "0.6833871", "0.6784885", "0.6775202", "0.67711323", "0.6764112", "0.6737663", "0.67355454", "0.6724824", "0.67199975", "0.6704958", "0.66932213", "0.6688998", "0.66856104", "0.6685253", "0.6685253", "0.6685253", "0.6684122...
0.0
-1
Returns the data model based on the primary key given in the GET variable. If the data model is not found, an HTTP exception will be raised.
public function loadModel($id) { $model = SystemUser::model()->findByPk($id); if ($model === null) throw new CHttpException(404, 'The requested page does not exist.'); return $model; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadModel()\n\t{\n\t\tif($this->_model===null)\n\t\t{\n\t\t\tif(isset($_GET['id']))\n\t\t\t\t$this->_model=Residencebaseinfo::model()->findbyPk($_GET['id']);\n\t\t\tif($this->_model===null)\n\t\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\t}\n\t\treturn $this->_model...
[ "0.69972247", "0.6964152", "0.6856979", "0.67055696", "0.66492844", "0.6642662", "0.66368365", "0.6627068", "0.6623815", "0.66185117", "0.6614805", "0.66135335", "0.6559161", "0.6557772", "0.65422094", "0.6541265", "0.65345716", "0.6534087", "0.6528608", "0.65273887", "0.6523...
0.0
-1
Determine if the user is authorized to make this request.
public function authorize() { return false; }
{ "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.83993316", "0.8375539", "0.8375539", "0.8342643", "0.8251967", "0.82460433", "0.82116765", "0.8145634", "0.81104577", "0.8082012", "0.7990385", "0.79879874", "0.7982323", "0.79598", "0.7950402", "0.7948058", "0.7924861", "0.791403", "0.7900065", "0.78929263", "0.7889438", ...
0.0
-1
Get the validation rules that apply to the request.
public function rules() { return [ // 'ten'=>'unique:mptheloais,ten_danhmuc', 'email'=>'required|email|unique:users,email', 'password'=>'required|min:10|regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\X])(?=.*[!$#%]).*$/|alpha_dash', 'laipassword'=>'required|confimed:password', 'phone'=>'required|integer|size:10|regex:/(01)[0-9]{9}/' ]; }
{ "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
Calculate password strength via nonoverlapping minimum entropy patterns.
public function passwordStrength($password, array $userInputs = []) { $timeStart = microtime(true); if ('' === $password) { $timeStop = microtime(true) - $timeStart; return $this->result($password, 0, [], 0, ['calc_time' => $timeStop]); } // Get matches for $password. $matches = $this->matcher->getMatches($password, $userInputs, $this->params); // Calcuate minimum entropy and get best match sequence. $entropy = $this->searcher->getMinimumEntropy($password, $matches); $bestMatches = $this->searcher->matchSequence; // Calculate score and get crack time. $score = $this->scorer->score($entropy); $metrics = $this->scorer->getMetrics(); $timeStop = microtime(true) - $timeStart; // Include metrics and calculation time. $params = array_merge($metrics, ['calc_time' => $timeStop]); return $this->result($password, $entropy, $bestMatches, $score, $params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reduce_min_strength_password_requirement( $strength ) {\n return 2; \n}", "public function getStrength($password, $username = null)\n {\n if (!empty($username)) {\n $password = str_replace($username, '', $password);\n }\n\n $password_length = strlen($password);\n\n ...
[ "0.6690594", "0.6629334", "0.65587735", "0.6506499", "0.6479081", "0.64238024", "0.6104876", "0.5868502", "0.5786164", "0.5784589", "0.56393343", "0.5631854", "0.5548654", "0.5546089", "0.5464658", "0.5300745", "0.52051777", "0.52016646", "0.51671815", "0.5157213", "0.5138537...
0.6025717
7
Register the routes for the objects of the controller.
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_item' ), 'args' => array(), 'permission_callback' => array( $this, 'get_item_permissions_check' ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'callback' => array( $this, 'update_item' ), 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ), 'permission_callback' => array( $this, 'get_item_permissions_check' ), ), 'schema' => array( $this, 'get_public_item_schema' ), ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function register_rest_routes() {\n\t\t$controllers = array(\n\t\t\t'GF_REST_Entries_Controller',\n\t\t\t'GF_REST_Entry_Properties_Controller',\n\t\t\t'GF_REST_Entry_Notifications_Controller',\n\t\t\t'GF_REST_Notes_Controller',\n\t\t\t'GF_REST_Entry_Notes_Controller',\n\t\t\t'GF_REST_Form_Entries_Controller...
[ "0.8205839", "0.7760709", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "0.7760362", "...
0.72580606
47
Check if a given request has access to read and manage settings.
public function get_item_permissions_check( $request ) { return current_user_can( 'manage_options' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function checkAccess()\n {\n $list = $this->getPages();\n\n /**\n * Settings controller is available directly if the $page request variable is provided\n * if the $page is omitted, the controller must be the subclass of Settings main one.\n *\n * The inner $p...
[ "0.76137173", "0.7035752", "0.6915942", "0.6717096", "0.6572943", "0.653304", "0.6524546", "0.6497568", "0.6491931", "0.64904374", "0.64285713", "0.6410797", "0.63552886", "0.6334361", "0.6325367", "0.6325367", "0.6325367", "0.6324746", "0.6324746", "0.6324133", "0.6324133", ...
0.6872134
3
Prepare a value for output based off a schema array.
protected function prepare_value( $value, $schema ) { switch ( $schema['type'] ) { case 'string': return strval( $value ); case 'number': return floatval( $value ); case 'boolean': return (bool) $value; default: return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function prepare_value($value, $schema)\n {\n }", "public function prepValue($value)\n\t{\n\t\t$this->_convertDateTimes($value);\n\n\t\tif (is_array($value) && ($columns = $this->getSettings()->columns))\n\t\t{\n\t\t\t// Make the values accessible from both the col IDs and the handles\n\t...
[ "0.67483413", "0.6205842", "0.618068", "0.56534785", "0.554653", "0.54904425", "0.54771096", "0.5421695", "0.5328472", "0.5214461", "0.5201358", "0.5201351", "0.52000785", "0.51834923", "0.51401013", "0.51368433", "0.5066874", "0.5058589", "0.50428456", "0.5038394", "0.498215...
0.62846506
1
Get all the registered options for the Settings API
protected function get_registered_options() { $rest_options = array(); foreach ( get_registered_settings() as $name => $args ) { if ( empty( $args['show_in_rest'] ) ) { continue; } $rest_args = array(); if ( is_array( $args['show_in_rest'] ) ) { $rest_args = $args['show_in_rest']; } $defaults = array( 'name' => ! empty( $rest_args['name'] ) ? $rest_args['name'] : $name, 'schema' => array(), ); $rest_args = array_merge( $defaults, $rest_args ); $default_schema = array( 'type' => empty( $args['type'] ) ? null : $args['type'], 'description' => empty( $args['description'] ) ? '' : $args['description'], 'default' => isset( $args['default'] ) ? $args['default'] : null, ); $rest_args['schema'] = array_merge( $default_schema, $rest_args['schema'] ); $rest_args['option_name'] = $name; // Skip over settings that don't have a defined type in the schema. if ( empty( $rest_args['schema']['type'] ) ) { continue; } // Whitelist the supported types for settings, as we don't want invalid types // to be updated with arbitrary values that we can't do decent sanitizing for. if ( ! in_array( $rest_args['schema']['type'], array( 'number', 'string', 'boolean' ), true ) ) { continue; } $rest_options[ $rest_args['name'] ] = $rest_args; } return $rest_options; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wpjsfsp_get_options() {\n\treturn \\WPJSFSP\\Options::get_all();\n}", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOpti...
[ "0.80390793", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.77769214", "0.7768011", "0.7768011", "0.77679914", ...
0.7613416
22
Get the site setting schema, conforming to JSON Schema.
public function get_item_schema() { $options = $this->get_registered_options(); $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'settings', 'type' => 'object', 'properties' => array(), ); foreach ( $options as $option_name => $option ) { $schema['properties'][ $option_name ] = $option['schema']; } return $this->add_additional_fields_schema( $schema ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function get_settings_schema() {\n\n $_schema = json_decode( wp_remote_retrieve_body( wp_remote_get( WPP_API_URL_STANDARDS . '/schema' ) ), true );\n\n return isset( $_schema['data'] ) ? $_schema['data'] : array();\n\n }", "public function getSettings() {\n $file = SETTING...
[ "0.7996044", "0.6677421", "0.6593927", "0.6385942", "0.6174305", "0.6144686", "0.6039883", "0.6017932", "0.59656686", "0.59631807", "0.5948019", "0.5907641", "0.58914", "0.58914", "0.58914", "0.58914", "0.58914", "0.58914", "0.5885717", "0.5882725", "0.5876973", "0.58548236...
0.7493372
1
$validator = Validator::make($this>request>all(), [
public function store(){ // 'transactiontypes_id' => 'bail|required', // 'amount' => 'required', // ]); // if ($validator->fails()) { // return redirect('/home') // ->withErrors($validator) // ->withInput(); // } $data = $this->json(); $validation=$this->validate($this->request, [ 'transactiontypes_id' => 'bail|required', 'amount' => 'required', 'description' => 'required', 'categories_id' => 'required' ]); $data['date'] = new DateTime;; $transaction = new Transaction; $transaction->fill($data); $transaction->save(); return Response()->json($transaction); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store(Request $request)\n {\n $validator = Validator::make($request->all());\n dd($validator);\n }", "protected function validator(Request $request)\n {\n return Validator::make($request, [\n 'first_name' => 'required',\n 'last_name'...
[ "0.7853447", "0.7548577", "0.74812514", "0.74457085", "0.73523575", "0.7308768", "0.7303648", "0.726078", "0.7194113", "0.71842164", "0.7181724", "0.7176066", "0.7169478", "0.7141478", "0.7100361", "0.7068353", "0.7058244", "0.70359206", "0.70242715", "0.7011808", "0.6990519"...
0.0
-1
method proses pendaftaran akun user
public function process_daftar() { $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>'); $this->form_validation->set_rules('nik', 'NIK', 'trim|required|min_length[6]|max_length[7]|is_unique[user.nik]', ['is_unique' => 'NIK sudah dipakai']); $this->form_validation->set_rules('name', 'Nama Lengkap', 'trim|required', ['required' => 'Nama Lengkap Wajib diisi']); $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|is_unique[user.email]', ['is_unique' => 'Email sudah dipakai']); $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[6]', ['required' => 'Kata Sandi Wajib diisi']); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required|matches[password]', ['matches' => 'Konfirmasi Kata Sandi wajib sama', 'required' => 'Konfirmasi Kata Sandi wajib diisi']); $this->form_validation->set_rules('id_cabang', 'ID Cabang', 'trim|required', ['required' => 'Cabang Wajib diisi']); if ($this->form_validation->run() == FALSE) { $data['pertanyaan'] = $this->data_m->get('tb_cabang')->result(); $this->load->view('user/daftar_akun2', $data); } else { // $this->load->view('formsuccess'); $data = [ 'name' => $this->input->post('name'), 'nik' => $this->input->post('nik'), 'email' => $this->input->post('email'), 'password' => md5($this->input->post('password')), 'id_cabang' => $this->input->post('id_cabang'), 'level' => 1 ]; //process daftar akun user $success = $this->user_m->add($data); redirect('dashboard'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function user() {\n $user = $this->ion_auth->user()->row();\n //\n //get id\n $data['profic'] = $this->model_portofolio->select_profic_user($user->id)->row();\n $data['user'] = $user;\n if ($this->model_portofolio->select_metadata($user->id, 1)->row() == NULL) {\n ...
[ "0.70942086", "0.6864044", "0.68123734", "0.6754809", "0.67192143", "0.6694579", "0.6637816", "0.6636999", "0.6608919", "0.65725213", "0.657022", "0.65530425", "0.6550731", "0.6530548", "0.6471016", "0.64702994", "0.6467128", "0.64651155", "0.6460598", "0.64561635", "0.641831...
0.0
-1
Halaman List para User
public function list_user() { check_access_level_superuser(); $data = [ 'list_user' => $this->user_m->get_cabang(), 'list_cabang' => $this->data_m->get('tb_cabang') ]; $this->template->load('template2', 'user/list_user', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function userlist()\n\t{\n\t\t$data['page']='Userlist';\n\t\t$data['users_list']=$this->users->get_many_by('userlevel_id',2);\n\t\t$view = 'admin/userlist/admin_userlist_view';\n\t\techo Modules::run('template/admin_template', $view, $data);\t\n\t}", "public function userList() {\n /** @var User[] ...
[ "0.7710576", "0.76590395", "0.7579087", "0.7573508", "0.75307435", "0.75220776", "0.7499849", "0.74958277", "0.7457248", "0.74262947", "0.7386747", "0.729269", "0.7289015", "0.72821397", "0.72498786", "0.7218278", "0.71950054", "0.7181125", "0.7177128", "0.71610385", "0.71588...
0.7906442
0
method untuk memunculkan data profil
public function profile() { // echo $this->fungsi->user_login()->nik; $query = $this->user_m->get($this->fungsi->user_login()->nik); $data['data'] = $query->row(); $this->template->load('template2', 'profile', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processData() ;", "public function getDataDiskreProv($getProv,$getTahun,$getTriwulan,$getRefWaktu){\n if($getTriwulan == 1){\n $tahun_0 = $getTahun - 1;\n $triwulan_0 = 4;\n $getRefWaktu_0 = PdrbProv::getReferensiDataTerbaru($getProv, $tahun_0, $triwul...
[ "0.5578389", "0.55351377", "0.5448834", "0.5448834", "0.5448834", "0.5448209", "0.54417443", "0.54345596", "0.5401126", "0.53938186", "0.5384768", "0.53636855", "0.5358553", "0.5358473", "0.53581333", "0.5355993", "0.5355993", "0.5316219", "0.5300339", "0.52977335", "0.528279...
0.0
-1
Constructor. Loads configuration file of controller and does some init stuff
public function __construct($ctrlName, $app) { $this->ctrlName = $ctrlName; $this->app = $app; $this->page = $this->app->page; $this->page->BASE_URL = BASE_URL; if (!$ctrlName) return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function initializeController() {}", "public function __construct() {\n\n $this->loadConfig();\n\n }", "function __construct() {\n\tparent::__construct();\n\t$this->config = json_decode(file_get_contents(CONFIG_DIR . \"controllers/playlist.config.json\"), false);\n }", "public function...
[ "0.76575387", "0.76521236", "0.7583357", "0.7556084", "0.75418925", "0.74419785", "0.742286", "0.73543495", "0.7332051", "0.7327903", "0.73224664", "0.7267531", "0.7266131", "0.7265455", "0.7264737", "0.7257994", "0.7249777", "0.7205533", "0.71989435", "0.71874666", "0.718391...
0.0
-1
Loads Model represented by $modName and $ctrlName
public function loadModel($modName, $ctrlName = '') { if (!class_exists($modName.'Model')) { if (!$ctrlName) $ctrlName = $this->ctrlName; $filename = $this->app->getModelClassFileName($modName, $ctrlName); if (!file_exists($filename)) zf::halt("No such model found \"$modName\"! at $filename"); require_once $filename; } $class = ucfirst($modName).'Model'; $mod = new $class($ctrlName, $modName, $this); $this->models[$modName] = $mod; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model($modName = null, $ctrlName = '')\n\t{\n\t\tif (!$modName) $modName = $this->ctrlName;\n if (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\tif (isset($this->models[$modName])) return $this->models[$modName];\n\t\t\n\t\t$this->loadModel($modName, $ctrlName);\n\t\treturn $this->model($mo...
[ "0.7934687", "0.7782699", "0.7741777", "0.6975137", "0.6923596", "0.6880434", "0.68387866", "0.68174314", "0.6717329", "0.6551923", "0.6425403", "0.63943905", "0.63550526", "0.6327506", "0.6289112", "0.6261731", "0.6251583", "0.6205615", "0.6176086", "0.6131433", "0.6118449",...
0.8280711
0
Loads model by path
public function loadModelByPath($modName, $path, $ctrlName = '') { require_once $path; $class = ucfirst($modName).'Model'; $mod = new $class($ctrlName ? $ctrlName : $this->ctrlName, $modName, $this, null, dirname($path)); $this->models[$modName] = $mod; return $mod; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadModel(string $path): Model {\n\t\tlist($module, $model) = explode('/', $path);\n\t\t$model = ucfirst($model).'Model';\n\t\trequire_once($_SERVER['DOCUMENT_ROOT'].\"/modules/$module/models/{$model}.php\");\n\t\t$model = '\\\\'.ucfirst($module).'\\\\'.$model;\n\t\treturn new $model;\n\t}", "pri...
[ "0.7761908", "0.7408096", "0.7407711", "0.7131224", "0.70897996", "0.70897996", "0.70897996", "0.70329356", "0.68948627", "0.68308264", "0.68192923", "0.67977655", "0.6734649", "0.6675078", "0.6650308", "0.6634657", "0.6634574", "0.6601258", "0.65880674", "0.6550393", "0.6546...
0.67187667
13
Determines whether specified model exists
protected function modelExists($modName, $ctrlName = '') { if (!$ctrlName) $ctrlName = $this->ctrlName; return file_exists($this->zf->app->app_path.$this->zf->app->conf['models_dir'].'/'.$ctrlName.'/'.$modName.'.mod.inc'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function modelExists()\n {\n $model = $this->option('model');\n\n if (empty($model)) {\n return true;\n }\n\n return class_exists($model) && is_subclass_of($model, Model::class);\n }", "public function hasModel();", "public function checkModelExist($model)...
[ "0.80227816", "0.79687256", "0.77525747", "0.7630612", "0.7574057", "0.7402347", "0.7336696", "0.7213116", "0.7022812", "0.70096403", "0.6879127", "0.68324995", "0.6717154", "0.66299206", "0.6530306", "0.6505908", "0.64671254", "0.6459778", "0.64440393", "0.64200383", "0.6411...
0.63552606
22
Returns loaded Model object represented by $modName and $ctrlName
public function model($modName = null, $ctrlName = '') { if (!$modName) $modName = $this->ctrlName; if (!$ctrlName) $ctrlName = $this->ctrlName; if (isset($this->models[$modName])) return $this->models[$modName]; $this->loadModel($modName, $ctrlName); return $this->model($modName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model($modName = '', $ctrlName = '')\n {\n return parent::model($modName, $ctrlName);\n }", "public function loadModel($modName, $ctrlName = '')\n\t{\n\t\tif (!class_exists($modName.'Model')) {\n\t\t\tif (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\t\t$filename = $this->app->getMode...
[ "0.8005318", "0.7772888", "0.75677365", "0.6486984", "0.64635754", "0.6358232", "0.63388497", "0.63196945", "0.6294006", "0.62820995", "0.62815875", "0.6276671", "0.62104774", "0.6201406", "0.6194457", "0.61726457", "0.61702365", "0.61461574", "0.6140707", "0.6138701", "0.611...
0.83249307
0
Loads form into controller
protected function loadForm($formName, $elements, $arr = array(), $action = '', $method = 'post', $not_add_to_page = false, $target = null, $id = null) { if (!$arr) { $arr = $this->app->request->post; } else { //$arr = $this->ConvertDates($elements, $arr); } //if (!$action) $action = $this->app->request->uri; $views = misc::get($this->app->conf, 'views'); $form = new form($arr, $elements, $action, $formName, $method, misc::get($views, 'forms'), true, $target, $id); $form->ctrl = $this; if (isset($this->forms[$formName])) { debug::add_log("This controller already has loaded this form \"{$formName}\"", 'warning'); } $this->forms[$formName] = $form; if (!$not_add_to_page) { $this->page->addForm($formName, $form); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function loadForm()\n {\n $form = $this->createForm();\n\n $bridge = $this->model->getBridgeFor('form', $form);\n\n $this->addFormElements($bridge, $this->model);\n\n $this->form = $bridge->getForm();\n }", "public function populateForm() {}", "function loadFromForm(...
[ "0.7552389", "0.7436238", "0.73142284", "0.7149681", "0.70954305", "0.7068946", "0.6925604", "0.69224495", "0.68480265", "0.6824728", "0.6812824", "0.66687983", "0.6646273", "0.662751", "0.66269", "0.6584979", "0.65605646", "0.65144813", "0.65074956", "0.64391756", "0.6404547...
0.0
-1
Returns form represented by $formName
protected function form($formName) { if (isset($this->forms[$formName])) return $this->forms[$formName]; zf::halt("No such form \"{$formName}\" loaded"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getForm($name)\n {\n return $this->getFormBuilder()->createBuilder($name);\n }", "public function getForm($formName)\n {\n if (!isset($this->form[$formName])) {\n $message = sprintf(\n 'Requested form \"%s\" not part of this build. Available forms:...
[ "0.76612115", "0.73769957", "0.7250387", "0.7189241", "0.71573496", "0.7138883", "0.7075898", "0.7067946", "0.70426977", "0.7030337", "0.70275545", "0.7017357", "0.7017357", "0.69855624", "0.69801784", "0.69801784", "0.69255316", "0.6913544", "0.6912028", "0.69070464", "0.687...
0.8119895
0
Default action method for controller
protected function actionDefault() { zf::halt("You can't call this function \"actionDefault\" directly. You must redefine it in your controller."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionDefault()\n {\n\n }", "function & DefaultIndexAction (&$controller)\n {\n\n parent::Action($controller);\n\n }", "public function indexAction(){}", "public function indexAction()\n {\n }", "public function indexAction()\n {\n }", "public function indexActi...
[ "0.8106456", "0.785664", "0.76059896", "0.75992596", "0.75992596", "0.75992596", "0.75992596", "0.75992596", "0.75992596", "0.7591357", "0.75542045", "0.7540066", "0.7540066", "0.7540066", "0.7540066", "0.7540066", "0.7540066", "0.7537198", "0.75212467", "0.75212467", "0.7521...
0.7836256
2
Not found action method for controller
protected function actionNotFound() { zf::halt("You can't call this function \"actionNotFound\" directly. You must redefine it in your controller."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionnotfound()\n {\n $this->render('notfound');\n }", "public function actionNotfound()\n {\n $this->actionSlug = 'notfound';\n $this->actionParams = [];\n $this->breadcrumbs=[];\n $this->beforeAction();\n $this->breadcrumbs[] = ['title' => 404...
[ "0.8356943", "0.8273121", "0.8070214", "0.8017735", "0.7941634", "0.784426", "0.7821098", "0.7747471", "0.7669802", "0.7664562", "0.7656013", "0.7636298", "0.7623391", "0.75673753", "0.75317514", "0.75268656", "0.7502693", "0.7497364", "0.74813926", "0.7467583", "0.74636656",...
0.83453125
1
Gets controller. Returns Controller
public function getCtrl($ctrlName, $use_dir = 1) { $filename = $this->zf->app->app_path.$this->zf->app->conf['controllers_dir'].($use_dir ? '/'.$ctrlName : '').'/'.$ctrlName.'.ctrl.inc'; //if ($this->conf['mode'] != 'prod' && !file_exists($filename)) return null; require_once $filename; $class = ucfirst($ctrlName).'Controller'; $ctrl = new $class($ctrlName); if (misc::get($this->zf->path, 0) == $ctrlName) { $this->ctrl->isDefault = 0; array_shift($this->zf->path); } else { $this->ctrl->isDefault = 1; } $ctrl->init(); return $ctrl; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getController()\n {\n return $this->Controller();\n }", "public function GetController () {\n\t\treturn $this->controller;\n\t}", "protected function getController()\n\t{\n\t\treturn $this->controller;\n\t}", "public function controller()\n {\n if ($this->controller ===...
[ "0.8687293", "0.86697865", "0.8602085", "0.8585033", "0.857965", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8572208", "0.8557558", "0.8557558", "0.85470074", "0.85393", "0.8500976", "0...
0.0
-1
Load controller. Returns true on success and false otherwise
public function loadCtrl($ctrlName, $use_dir = null) { if ($use_dir === null) { $use_dir = $this->app->conf['mvc']['use_subdirs']['controllers']; } $filename = $this->app->app_path.$this->app->conf['mvc']['dirs']['controllers'].($use_dir ? '/'.$ctrlName : '').'/'.$ctrlName.'.ctrl.php'; if ($this->app->mode != 'production' && !file_exists($filename)) return false; require_once $filename; $class = ucfirst($ctrlName).'Controller'; return new $class($ctrlName, $this->app); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _loadExistingController(){\n\t\t$file = $this->_controllerPath . $this->_url[0] . '.php';\n\t\tif (file_exists($file)) {\n\t\t\trequire $file;\n\t\t\t$this->_controller = new $this->_url[0];\n\t\t $this->_controller->loadModel($this->_url[0], $this->_modelPath);\n\t\t} else {\n\t\t\t$this->_err...
[ "0.79405886", "0.77929056", "0.71935904", "0.7164783", "0.6960809", "0.6956569", "0.6915565", "0.6906357", "0.6864777", "0.6847343", "0.6821309", "0.6742296", "0.67107207", "0.6702255", "0.6560098", "0.6377106", "0.63357407", "0.6302476", "0.62909037", "0.6259831", "0.6248201...
0.6081205
27
Many to many relationship with genre model.
public function genres() { return $this->belongsToMany('App\Genre', 'genre_artist'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function genres()\n {\n return $this->belongsToMany('App\\Genre');\n }", "public function genres()\n {\n return $this->belongsToMany(Genre::class, 'genre__movies', 'movie_id', 'id');\n }", "public function genres()\n {\n return $this->belongsToMany('App\\Models\\Genre...
[ "0.82063353", "0.78325015", "0.77752", "0.7754915", "0.7650356", "0.7539934", "0.71598816", "0.71355844", "0.6953636", "0.6885664", "0.6842402", "0.66718584", "0.657852", "0.6541937", "0.6354747", "0.62195873", "0.62049276", "0.6166439", "0.61296797", "0.61159146", "0.6080682...
0.79764205
1
Replaces all valid imports with the result of the $contentReplaceFunction. The function receives the cleaned path as argument (without the quotes and the function must not add quotes).
public function replaceValidImports (string $fileContent, callable $contentReplaceFunction) : string { return \preg_replace_callback( '~url\\(\\s*(?<path>.*?)\\s*\\)~i', function (array $matches) use ($contentReplaceFunction) { return $this->ensureValidImportAndReplace($matches, $contentReplaceFunction); }, $fileContent ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function ensureValidImportAndReplace (array $matches, callable $contentReplaceFunction) : string\n {\n $path = $matches[\"path\"];\n $openingQuote = \\substr($matches[\"path\"], 0, 1);\n $closingQuote = \\substr($matches[\"path\"], -1);\n $usedQuotes = \"\";\n\n // che...
[ "0.7026493", "0.688952", "0.59473085", "0.59461015", "0.59340507", "0.5927119", "0.5904901", "0.572699", "0.56774545", "0.55368406", "0.54570633", "0.5386634", "0.52854264", "0.52719516", "0.52693266", "0.52442926", "0.523602", "0.5209371", "0.5193935", "0.5193661", "0.515291...
0.7020751
1
Replaces all valid imports with the result of the content replace function.
private function ensureValidImportAndReplace (array $matches, callable $contentReplaceFunction) : string { $path = $matches["path"]; $openingQuote = \substr($matches["path"], 0, 1); $closingQuote = \substr($matches["path"], -1); $usedQuotes = ""; // check if quoted and whether valid quoted if ("'" === $openingQuote || '"' === $openingQuote) { if ($openingQuote !== $closingQuote) { // looks like invalid CSS, as there is a leading quote, but no closing one, so bail return $matches[0]; } // strip quotes from path $path = \substr($path, 1, -1); $usedQuotes = $openingQuote; } $path = $contentReplaceFunction($path); return "url({$usedQuotes}{$path}{$usedQuotes})"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static function replaceImports($content)\n {\n $content = preg_replace(self::FORMAT['style'], '<link rel=\"stylesheet\" type=\"text/css\" href=$4/>', $content);\n $content = preg_replace(self::FORMAT['script'], '<script type=\"text/javascript\" src=$4></script>', $content);\n $conte...
[ "0.7593309", "0.66750973", "0.6448205", "0.64319396", "0.6104385", "0.5987199", "0.5975507", "0.59659886", "0.591517", "0.5904163", "0.5827744", "0.58232856", "0.578464", "0.5740109", "0.573233", "0.5711887", "0.56903154", "0.56443876", "0.56059104", "0.5473588", "0.54700685"...
0.6357027
4
Store a newly created resource in storage.
public function store(Request $request) { $this->validate($request, [ 'name' => 'required', 'document' => 'required|mimes:pdf,png,jpg|max:9999', ]); $base_location = 'user_documents'; // Handle File Upload if($request->hasFile('document')) { //Using store(), the filename will be hashed. You can use storeAs() to specify a name. //To specify the file visibility setting, you can update the config/filesystems.php s3 disk visibility key, //or you can specify the visibility of the file in the second parameter of the store() method like: //$documentPath = $request->file('document')->store($base_location, ['disk' => 's3', 'visibility' => 'public']); $documentPath = $request->file('document')->store($base_location, 's3'); } else { return response()->json(['success' => false, 'message' => 'No file uploaded'], 400); } //We save new path $document = new Document(); $document->path = $documentPath; $document->name = $request->name; $document->save(); return response()->json(['success' => true, 'message' => 'Document successfully uploaded', 'document' => new DocumentResource($document)], 200); }
{ "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
Remove the specified resource from storage.
public function destroy($id) { $document = Document::find($id); if(empty($document)){ return response()->json(['success' => false, 'message' => 'Document not found'], 404); } //We remove existing document if(!empty($document)) { Storage::disk('s3')->delete($document->path); $document->delete(); return response()->json(['success' => true, 'message' => 'Document deleted'], 200); } return response()->json(['success' => false, 'message' => 'Unable to delete the document. Please try again later.'], 400); }
{ "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
(DOMDocument) object used to open pages adds initial values to variables, starts the crawl
public function __construct($_start, $_robots = array(false, false)){ // starting url $this->url = $_start; // variables used for crawling $this->pages = array('/'); $this->current_path = '/'; $this->crawled_dirs = array(); $this->links = array(); $this->visited = array(); $this->ignore_dirs = null; $this->file_types = array('html', 'htm', 'php'); // empty DOMDocument for loading pages and finding links $this->doc = new DOMDocument(); libxml_use_internal_errors(true); $this->doc->strictErrorChecking = false; $this->doc->recover = true; // robots.txt if($_robots[0]){ $this->robot = new RobotsCrawler($this->url, $_robots[1]); } else { $this->robot = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function crawl(){\n\t\t// check if path is allowed by robots.txt\n\t\tif(!$this->robot || $this->robot->crawlAllowed($this->pages[0])){\n\t\t\t// set the file path, extract directory structure, open file\n\t\t\t$path = 'http://'.$this->url.$this->pages[0];\n\t\t\t$this->setCurrentPath();\n\t\t\t$this->doc-...
[ "0.6484954", "0.6470632", "0.6378332", "0.62961334", "0.6128521", "0.611757", "0.59321237", "0.58809865", "0.58720064", "0.58145446", "0.57610315", "0.5735044", "0.5689769", "0.5593213", "0.5589589", "0.5588662", "0.5588662", "0.5588662", "0.5588662", "0.55884975", "0.5578804...
0.54148036
26
allows user to change variables if values are valid
public function settings($options = 'get'){ // ensure settings are given if(is_array($options) && count($options) > 0){ // loop through all settings given foreach ($options as $setting => $value) { // check for existence of desired variable if(property_exists('SiteCrawler', $setting)){ // switch through all variables for validation switch ($setting) { // check if desired value is a string case 'url': if(gettype($value) === 'string'){ // set variable, return true $this->{$value} = $value; $return[$setting] = true; } else { // return errors $return[$setting] = array('value'=>$value, 'error'=>'Given value was type '.gettype($value).', <em>string</em> required.'); } break; // check if value is populated array case 'file_types': if(gettype($value) === 'array' && count($value) > 0){ // loop through array foreach ($value as $type) { // check if value is a string if(gettype($type) === 'string'){ // set variable, return true $this->{$setting}[] = $type; $return[$setting][$type] = true; } else { // return errors if not string $return[$setting][$type] = array('value'=>$type, 'error'=>'Given value was type '.gettype($type).', <em>string</em> required.'); } } // remove duplicates from array $this->{$setting} = array_unique($this->$setting); } else { // return errors if not array $return[$setting] = array('value'=>$value, 'error'=>'Given value was type '.gettype($value).', <em>array</em> required.'); } break; // check if value is populated array case 'ignore_dirs': if (gettype($value) === 'array' && count($value) > 0) { // loop through array foreach ($value as $type) { // check if value is a string if(gettype($type) === 'string'){ // set variable, return true $this->{$setting}[] = $type; $return[$setting][$type] = true; } else { // return errors if not string $return[$setting][$type] = array('value'=>$type, 'error'=>'Given value was type '.gettype($type).', <em>string</em> required.'); } } // remove duplicates from array $this->{$setting} = array_unique($this->$setting); // check if value is null } elseif(is_null($value)) { // set variable, return true $this->{$setting} = null; $return[$setting] = true; } else { // return errors if not array or null $return[$setting] = array('setting' => $setting, 'value' => $value, 'error' => 'Given $value was type '.gettype($value).', <em>array</em> or <em>null</em> required'); } break; default: $return[$setting] = array('setting'=>$setting, 'value'=>$value, 'error'=>'Given setting does not exist or cannot be altered'); break; } } else { $return[$setting] = array('setting'=>$setting, 'value'=>$value, 'error'=>'Given setting does not exist or cannot be altered'); } } } else { // if $options is not an array, switch it to decide what to do switch ($options) { // if $options is 'get', print all variables but $pages (usually empty), $visited and $links (could be massive), and $doc (DOMDocument object) case 'get': // initiate a ReflectionClass object, gather properties $reflect = new ReflectionClass($this); $properties = $reflect->getProperties(); // loop through properties, add to array foreach ($properties as $prop) { $name = $prop->getName(); if($name !== 'pages' && $name !== 'links' && $name !== 'visited' && $name !== 'doc' && $name !== 'robot'){ $return[$name] = $this->{$name}; } if($this->robot){ $return['robot'] = $this->robot->settings(); } } break; } } return $return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setInvalid();", "function ctr_validateHome(&$ctx)\n{\n $reservation = $ctx['reservation'];\n\n // variables exist *AND* are not empty\n if (!empty($_POST['destination']) AND !empty($_POST['personsCounter']))\n {\n $reservation->destination = htmlspecialchars($_POST['destination...
[ "0.63169557", "0.6165813", "0.6103923", "0.60468537", "0.59335893", "0.59335893", "0.59335893", "0.59335893", "0.59195447", "0.5916947", "0.5869364", "0.5865801", "0.5746169", "0.5729059", "0.57285583", "0.5720367", "0.56736654", "0.563245", "0.5624506", "0.5593537", "0.55764...
0.0
-1
opens first entry in $pages, extracts all hyperlinks, adds them to $links
private function crawl(){ // check if path is allowed by robots.txt if(!$this->robot || $this->robot->crawlAllowed($this->pages[0])){ // set the file path, extract directory structure, open file $path = 'http://'.$this->url.$this->pages[0]; $this->setCurrentPath(); $this->doc->loadHTMLFile($path); // find all <a> tags in the page $a_tags = $this->doc->getElementsByTagName('a'); $link_tags = $this->doc->getElementsByTagName('link'); $script_tags = $this->doc->getElementsByTagName('script'); $img_tags = $this->doc->getElementsByTagName('img'); $form_tags = $this->doc->getElementsByTagName('form'); // if <a> tags were found, loop through all of them if(isset($a_tags) && !is_null($a_tags)){ foreach ($a_tags as $link) { // find the href attribute of each link foreach ($link->attributes as $attrib) { if(strtolower($attrib->name) == 'href'){ // make sure its not external, javascript or to an anchor if(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){ $this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value); } } } } } // if <link> tags were found, loop through all of them if(isset($link_tags) && !is_null($link_tags)){ foreach ($link_tags as $link) { // find the href attribute of each link foreach ($link->attributes as $attrib) { if(strtolower($attrib->name) == 'href'){ // make sure its not external, javascript or to an anchor if(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){ $this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value); } } } } } // if <script> tags were found, loop through all of them if(isset($script_tags) && !is_null($script_tags)){ foreach ($script_tags as $link) { // find the src attribute of each link foreach ($link->attributes as $attrib) { if(strtolower($attrib->name) == 'src'){ // make sure its not external, javascript or to an anchor if(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){ $this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value); } } } } } // if <img> tags were found, loop through all of them if(isset($img_tags) && !is_null($img_tags)){ foreach ($img_tags as $link) { // find the src attribute of each link foreach ($link->attributes as $attrib) { if(strtolower($attrib->name) == 'src'){ // make sure its not external, javascript or to an anchor if(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){ $this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value); } } } } } // if <form> tags were found, loop through all of them if(isset($forms_tags) && !is_null($form_tags)){ foreach ($form_tags as $link) { // find the src attribute of each link foreach ($link->attributes as $attrib) { if(strtolower($attrib->name) == 'action'){ // make sure its not external, javascript or to an anchor if(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){ $this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value); } } } } } } // merge and sort all arrays $this->arrayShuffle(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function extract_pages(){\r\n $dom = new DOMDocument();\r\n @$dom->loadHTMLFile($this->get_sitemap_url());\r\n $dOMXPath = new DOMXPath($dom);\r\n foreach ($dOMXPath->query(\"//urlset/url/loc\") as $node) {\r\n $this->add_page($node->nodeValue);\r\...
[ "0.6697641", "0.61973274", "0.619499", "0.61222", "0.61027735", "0.5964066", "0.5956364", "0.5911316", "0.5882442", "0.58639", "0.58198136", "0.5791143", "0.5762102", "0.57574713", "0.57364297", "0.57237226", "0.57074434", "0.5675262", "0.5673988", "0.56561387", "0.5624655", ...
0.56984997
17
changes $current_path used for fixing relative paths
private function setCurrentPath(){ $dirs = explode('/', $this->pages[0]); // if last character is a / then just use it if(empty($dirs[count($dirs)-1]) || is_null($dirs[count($dirs)-1])){ $this->current_path = $this->pages[0]; // if end of path was a filename, remove it and add a / } else { array_pop($dirs); $this->current_path = implode('/', $dirs).'/'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function changePath()\n {\n chdir(base_path());\n }", "abstract public function getCurrentPath();", "function current_path()\n {\n\treturn str_replace(base_url(), '', current_url());\n }", "protected function setInitialRelativePath() {}", "private function relativePathFix($path){\n\t...
[ "0.7021977", "0.6928795", "0.6675617", "0.6667217", "0.66215587", "0.65949434", "0.6530308", "0.63362676", "0.6181536", "0.610016", "0.60529083", "0.6050394", "0.60440636", "0.60261613", "0.59632707", "0.59627086", "0.5916782", "0.5903339", "0.5897093", "0.5879897", "0.587657...
0.77386767
0
fixes relative paths (to/file.php) into absolute paths (/path/to/file.php)
private function relativePathFix($path){ // check if page is a generated javadoc $page_str = $this->doc->saveHTML(); if(preg_match('%.*Generated by javadoc.*%', $page_str)){ // if it is, fix the frame-based links so that the path isn't appended to itself infinitely $path = preg_replace('%(.*\/).*\.html\?(.*\/.*)%', "$1$2", $path); } $dirs = explode('/', $path); // check if link goes up a directory if($dirs[0] == '..'){ $new_path = explode('/', $this->current_path); if(count($dirs) == 2){ array_pop($new_path); array_pop($new_path); $new_path = implode('/', $new_path).'/'; } else { // remove slash from end of current path to ensure single slashes if(empty($new_path[count($new_path)-1]) || is_null($new_path[count($new_path)-1])){ array_pop($new_path); } // go up directories while($dirs[0] == '..'){ array_shift($dirs); array_pop($new_path); } // stick the two paths together to get new path $new_path = implode('/', $new_path).'/'; $new_path .= implode('/', $dirs); } // if link it to same dir, remove the ./ } elseif($dirs[0] == '.'){ $new_path = $this->current_path.substr($path, 2); // if the link starts at root, use it without modification } elseif(empty($dirs[0]) || is_null($dirs[0])){ $new_path = $path; } elseif(strlen($dirs[0]) == 2){ $new_path = '/'.$path; // default to adding the link's value to the end of the current directory } else { $new_path = $this->current_path.$path; } // if the link doesn't point to a file or query string, but has no end slash, add one if(count(explode('.', $new_path)) < 2 && count(explode('?', $new_path)) < 2 && substr($new_path, -1) != '/'){ $new_path .= '/'; } return $new_path; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function relative_to_absolute($filepath) {\n\treturn str_replace(__CHV_RELATIVE_ROOT__, __CHV_ROOT_DIR__, str_replace('\\\\', '/', $filepath));\n}", "function absolute_to_relative($filepath) {\n\treturn str_replace(__CHV_ROOT_DIR__, __CHV_RELATIVE_ROOT__, str_replace('\\\\', '/', $filepath));\n}", "function __...
[ "0.75638896", "0.7466008", "0.71610296", "0.7063255", "0.69166064", "0.69147843", "0.6818298", "0.6652967", "0.6587011", "0.6559613", "0.65548766", "0.65378535", "0.64913917", "0.64567405", "0.64178383", "0.63733053", "0.62943995", "0.62812126", "0.6253842", "0.6245388", "0.6...
0.6130064
27
sorts entries in $links, moves entries to $pages, validates entries in $pages
private function arrayShuffle(){ // check if arrays exist before trying to use them if(isset($this->links[$this->pages[0]]) && is_array($this->links[$this->pages[0]])){ // remove duplicate values $this->links[$this->pages[0]] = array_unique($this->links[$this->pages[0]]); // find all links that are not queued or visited and add to the queue $this->pages = array_merge($this->pages, array_diff($this->links[$this->pages[0]], $this->pages, $this->visited)); // sort links sort($this->links[$this->pages[0]]); } // find all links in the queue that point to files foreach ($this->pages as $path) { if(count(explode('.', $path)) > 1){ // get the file extension $file = explode('.', $path); $qry = false; // if there's a query string, explode it to access the extension foreach ($file as $key => $value){ if (count(explode('?', $value)) > 1) { $file[$key] = explode('?', $value); $qry = $key; } } if($qry){ $type = $file[$qry][0]; } else { $type = count($file); $type = $file[$type-1]; } // remove any links that are to files NOT on the accept list (deafult: html, htm, php) if(array_search($type, $this->file_types) === false){ while($key = array_search($path, $this->pages)){ array_splice($this->pages, $key, 1); } } } if(!is_null($this->ignore_dirs)){ // loop through ignored directories, compare to the path in the link foreach ($this->ignore_dirs as $dir) { if(array_search($dir, explode('/', $path)) !== false){ while($key = array_search($path, $this->pages)){ array_splice($this->pages, $key, 1); } } } } } // add current link to $visited, remove from $pages, sort $pages $this->visited[] = $this->pages[0]; array_shift($this->pages); sort($this->pages); // if the queue is not empty, crawl again if(count($this->pages) > 0){ $this->crawl(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function sort(): void\n {\n if (!$this->dirtyIndex) {\n return;\n }\n\n $newIndex = [];\n $index = 0;\n\n foreach ($this->pages as $hash => $page) {\n $order = $page->getOrder();\n\n if (null === $order) {\n $newIndex[...
[ "0.6010659", "0.5896721", "0.5698866", "0.56682277", "0.56658876", "0.5550747", "0.55059135", "0.54730123", "0.54663306", "0.5440575", "0.54390836", "0.5438898", "0.542991", "0.5418039", "0.5403084", "0.5396782", "0.53644204", "0.53427666", "0.5336459", "0.52864057", "0.52785...
0.59011066
1