anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
show timeline if user is authenticated | public function index() {
if (Auth::check()) {
// get the statuses (own and from friends)
// (but filter out the replies - see Status model!)
$statuses =
Status::notReply()
->where(
function($query) {
return $query->where('user_id', Auth::user()->id)
->orWhereIn('user_id', A... |
Remove registros da tabela | protected function _remover($nomeTabela, $where)
{
$sql = "DELETE FROM $nomeTabela WHERE $where";
try
{
return Statement::getInstance()->execute($sql);
}
catch(Exception $e)
{
throw new Exception($e->getMessage(), $e->getCode());
}
... |
Get body class this is sat via page>header | function getClass() {
return $this->classname ? $this->classname : "theme"."1";//rand(1, 6);
} |
Adds a questionblock to the database | function _addQuestionblock($title = "", $owner = 0, $show_questiontext = true, $show_blocktitle = false)
{
global $ilDB;
$next_id = $ilDB->nextId('svy_qblk');
$ilDB->manipulateF("INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
" show_blocktitle, owner_fi, tstamp) " .
"VALUES (%s, %s,... |
/ Plugin Name: Dark Mode Plugin URI: Description: An amazing plugin. Author: Matthieu Mota Author URI: Version: 1.0.0 | function darkmode() {
?>
<script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
<script>
function addDarkmodeWidget() {
new Darkmode({
label: '🌓',
}).showWidget();
}
window.addEventListener('load', addDa... |
/ get item list by ajax | function get_item_list_json()
{
$output = $this->invm->get_item_list_search(strtolower($this->uri->segment(4)));
echo json_encode($output);
} |
Returns whether this plugin is running on a test system or the production system. | public function is_test_environment() {
if(empty($this->production_site_url))
return true;
else
return get_site_url() === $this->production_site_url ? false : true;
} |
Check if implementation supported | public function isSupported() {
return class_exists('Salt');
} |
endregion region: Support methods | private function parseCommand(string $subject) : Mailcode_Commands_Command_ShowEncoded
{
$command = $this->parseCommandStringValid($subject);
$this->assertInstanceOf(Mailcode_Commands_Command_ShowEncoded::class, $command);
return $command;
} |
Denormalizes data back into an object of the given class. | public function denormalize($data, $class, $format = null, array $context = [])
{
$object = $this->extractObjectToPopulate($class, $context) ?? new $class();
isset($data['name']) && $object->setName($data['name']);
isset($data['description']) && $object->setDescription($data['description'])... |
Operation listsIndicationsPost create an Indication. | public function listsIndicationspost()
{
$input = Request::all();
$new_indication = Indication::create($input);
if($new_indication){
return response()->json(['msg' => 'Added a new indication', 'data' => $new_indication]);
}else{
return response('Oops, i... |
Update the specified resource in storage. | public function update(Request $request, Appointment $appointment, $id)
{
$this->validate(request(), [
'name' => 'required|string|max:255',
'sns' => 'required|integer',
'especialidade' => 'required',
'data' => 'required|date|after_or_equal:tomorrow',
... |
Add field labels to the existing labels. | public function setLabels(array $labels): void
{
foreach ($labels as $field_name => $label) {
if (isset($this->display_fields[$field_name])) {
$this->labels[$field_name] = $label;
} else {
throw new InvalidFieldException('"'.$field_name.'" not set as a... |
returns one part of the postcode. Most commonly first part of postcode may be used independently. Also may be used to retrieve a second part. | public function getPostcodePart($part = IAddress::POSTCODE_PART_ONE); |
Menampilkan seluruh halaman website beserta head dan layoutnya Merupakan method utama yang berhubungan langsung dengan view jika $file diisi dengan nama folder dan nama file akan otomatis ditacari lokasi folder dan viewnya berdasarkan root = system/view $var harus berbentuk array, key dari var nanti akan menjadi variab... | protected function view($var_and_file = array("content"=>"index.php"),$var = array()){
foreach($var_and_file as $variabel => $file){
if(is_object($file)||is_array($file)||strpos($file,".php")==0)
$$variabel = $file;
else
$$variabel = $this->viewPartial($f... |
Process reference transaction response used when creating payment for scheduled subscription. | protected function _process_reference_transaction_response( $order, $response ) {
$client = wc_gateway_ppec()->client;
try {
if ( ! $client->response_has_success_status( $response ) ) {
throw new Exception( __( 'PayPal API error', 'woocommerce-gateway-paypal-express-checkout' ) );
}
$status = ! empty... |
Display the specified resource. | public function show()
{
if (empty(auth()->user()->driver)) {
Toastr::warning("Please Complete Your Profile", "Warning");
return redirect()->route("driver.my-profile.show");
}
$truck = auth()->user()->driver->truck;
if (empty($truck)) {
return view... |
Get the cache manager instance. | public static function getCacheManager()
{
return static::$cache;
} |
Setup before running any test cases | public static function setUpBeforeClass()
{
} |
$status = Post::where('id', $post_id)>pbpgs()>where('id', $pbpg_id)>pivot('status'); | public static function check($post_id, $pbpg_id) {
$post = Post::where('id', $post_id)->first();
$status = $post->pbpgs->where('id', $pbpg_id)->first()->pivot->status;
return $status;
} |
Get the services provided by the provider. | public function provides()
{
return array(
'unionpay'
);
} |
Show the form for editing the specified resource. | public function edit($id)
{
$driver = Drivers::findOrFail($id);
$this->data['driver'] = $driver;
return view('drivers.drivers_edit',$this->data);
} |
Sets value of 'port' property | public function setPort($value)
{
return $this->set(self::port, $value);
} |
Set the array of column widths | function SetWidths($w)
{
$this->widths=$w;
} |
Display the specified resource. | public function show(Product $product)
{
$data = DB::table('products')
->where('products.id',$product->id)
->join('categories','products.category_id','categories.id')
->join('suppliers','products.supplier_id','suppliers.id')
->select('categories.category_name'... |
Get the min value from the stream. If two elements have the same value, the first one found is returned. This method consumes the stream. | public function min(callable $compare_function = null) {
return $this->reduce(null, function ($acc, $value) use ($compare_function) {
if (is_null($acc)) {
return $value;
}
$to_apply_function = $compare_function ?? function ($a, $b) {
return $b <=> $a;
};
$result = $to_apply_function($acc, $val... |
Make a form builder. | protected function form()
{
return Form::make(new Prodind(), function (Form $form) {
$form->display('id');
$form->text('inid');
$form->text('prodid');
$form->text('tstock');
$form->text('qty');
$form->text('fstock');
... |
/ db_add_group Create a new group. Return its database entry. Default parent is 1, the root group. | function db_add_group($name, $parent = -1)
{
$dbh = db_connect();
// Create the group
$query = "INSERT INTO `groups` (parent, name) VALUES (?,?)";
$stmt = $dbh->prepare($query);
$result = $stmt->bind_param("is", $parent, $name);
$result = $stmt->execute();
$stmt->close();
if (!$result)
{
global $db_errno;
... |
Show anime list belong to user | public function action_index()
{
$view = View::forge('tracker/watchable');
$data = array(
'page_title' => '動漫清單',
'loggedin' => true,
'user' => $this->getUserInfo(),
);
$view->set_global($data);
return $view;
} |
Returns the solr client instance. We don't reuse SolrClient if we are on libcurl 7.35.0, due to a bug in that version of curl. | protected function get_search_client($triggerexception = true) {
global $CFG;
// Type comparison as it is set to false if not available.
if ($this->client !== null) {
return $this->client;
}
$options = array(
'hostname' => $this->config->server_hostname,... |
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 __construct()
{
parent::__construct();
$this->load->model("M_mahasiswa");
$this->load->library('form_validation');
} |
/ Gives search suggestions based on what is being searched for | public function suggest()
{
$suggestions = $this->Role->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
echo implode("\n",$suggestions);
} |
Run the database seeds. | public function run()
{
$product1['name'] = [
'ar' => 'product1 ar',
'en' => 'product1 en'
];
$product1['description'] = [
'ar' => 'desc product1 ar',
'en' => 'desc product1 en'
];
$product1['purchase_price'] = 100.89;
$... |
Display a single summary | function cbDisplaySummary($number) {
global $EDIT_SUMMARY_URL;
cbTrace("DISPLAYING " . $number);
$heftRow = cbFindHeftRow($number) or cbTrace(mysql_error());
$numRows = mysql_numrows($heftRow);
$title = mysql_result($heftRow, 0, "title");
$author = mysql_result($heftRow, 0, "author");
$summaryRow = cbFi... |
end public function build_admin_menu_listacf_load_capabilities_field | public function load_text_domain() {
load_plugin_textdomain($this->text_domain, false, dirname(plugin_basename(__FILE__)).'/lang/');
do_action('acf_options_page/load_text_domain');
} |
Sanitize and validate input. Accepts an array, return a sanitized array. | function ajb_options_validate( $input ) {
for ( $j=1; $j<=5; $j++) {
// home page CSS must be safe text with the allowed tags for posts
$input['button_' . $j . '_link'] = wp_filter_post_kses( $input['button_' . $j . '_link'] );
}
return $input;
} |
Add a new element to | public function addStatuses(\google\rpc\Status $value){
return $this->_add(1, $value);
} |
Run the database seeds. | public function run()
{
$classification = new \App\Models\Classification();
$classification->description = 'Camara';
$classification->save();
$classification = new \App\Models\Classification();
$classification->description = 'Portero';
$classification->save();
... |
Dsiplay information about the author | function hc_the_author($gravatarSize = ''){
$info = hc_get_the_author($gravatarSize);
foreach ($info as $index => $author) {
if(file_exists(get_bloginfo('stylesheet_directory').'plugins/hypercontact/templates/author.php')){
include(get_bloginfo('stylesheet_directory').'plugins/hypercontact/templates/author.p... |
validate if the given file is empty | public function file_required(): static
{
if (empty($this->is_file['name'])) $this->message("is required");
return $this;
} |
Get all notifications for a given user | public function get_all(int $userid, int $fromid = 0): array {
// TODO currently only retrieves events for the current user context.
global $DB;
$events = $DB->get_records_select(self::TABLENAME,
'contextid = :contextid AND id > :fromid',
['contextid' => \context_user::in... |
Modifies the current Form Component by changing any properties that were passed in $structure. If a component supports special indices in $structure (for example a "fields" property) then that component may specify its own `modify()` method and manually process each of the specially supported keywords. For example, the... | public function modify(array $structure); |
Generated from protobuf field .grafeas.v1.InTotoProvenance provenance = 4; | public function setProvenance($var)
{
GPBUtil::checkMessage($var, \Grafeas\V1\InTotoProvenance::class);
$this->writeOneof(4, $var);
return $this;
} |
Create word context from a word | public function getWordContext() {
$word = $this->getRandomWord();
return new WordContext($word);
} |
Get the method type (Upstream Pay method), it can be primary or secondary. | public function getType(): string; |
Retorna o numero de linhas retornadas da consulta | public function getNumRows(){
return $this->instance->getNumRows();
} |
Transform the resource into an array. | public function toArray($request)
{
return [
'id' => $this->id,
'publishDate' => $this->created_at,
'previewImage' => $this->image_url,
'isFavourite' => user()->favoriteObjects->firstWhere('id', $this->id) ? true : false,
'objectType' ... |
match with given field value like password confirmation | public function confirm(string|int|bool $field, string $message): static
{
$field = Sanitization::input($field)->sanitize();
if ($field !== $this->field) $this->message($message);
return $this;
} |
System::getPhpExtensionVersion Gets php extension version. | public function getPhpExtensionVersion($extension)
{
return phpversion($extension);
} |
Generates the database and inserts dummy data. | public function generateDatabase()
{
$this->generateUserTable();
$this->generateEmployerTable();
$this->generateCandidateTable();
$this->generateGuidTable();
$this->generateWorkExperienceTable();
$this->generateShortListTable();
$this->generateQualTypeTable();... |
Display a listing of the resource. | public function index()
{
$restaurants = Hotel::restaurant()->get();
return view('backend/restaurant/index', compact('restaurants'));
} |
By the way, you can still create your own method in here... :) | public function getSync()
{
ini_set('memory_limit', '256M');
// echo "<pre>";
// print_r($this->compare());
// echo "</pre>";
$compare = $this->compare();
if($compare->dataIn){
$insert = collect($compare->dataIn);
... |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts. If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup) | function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
{
global $tree;
switch ($a_event)
{
case "link":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
... |
====================== Query Scopes ====================== | public function scopePath($query, $path)
{
$slugs = collect(explode('/', $path));
$pages = self::whereIn($this->getTable().'.slug', $slugs)->get();
$target_slug = $slugs->pop();
$page = $pages->where('slug', $target_slug)->filter(function ($page) use ($slugs, $pages) {
... |
Specification: Publish price list prices for product abstracts. Uses the given IDs of the `fos_price_product_price_list` table. Merges created or updated prices to the existing ones. | public function publishAbstractPriceProductPriceList(array $priceProductPriceListIds): void; |
Get the 'render' tokens to use for advanced rendering. This runs through all of the fields and arguments that are available and gets their values. This will then be used in one giant str_replace(). | function get_render_tokens() {
$tokens = array();
if (!empty($this->view->build_info['substitutions'])) {
$tokens = $this->view->build_info['substitutions'];
}
$count = 0;
foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
$token = '%' . ++$count;
... |
This method erases all block which id does not match given pattern | public function keepOnly($pattern){
$this->layout->keepOnly($pattern);
return $this;
} |
$res=mysql_query("select from products ORDER BY product_order") or die(mysql_error()); | public function get_all_productes()
{
$res=mysql_query("select * from products") or die(mysql_error());
return $res;
} |
Logout Logouts from Elvis with the given session id | public function logout(string $token): bool
{
// Call logout REST API
$response = Elvis::query($token, 'logout');
// Return null if login failed, otherwise the session id.
if (isset($response->logoutSuccess) && $response->logoutSuccess === true) {
return true;
} ... |
Store a newly created resource in storage. | public function cancelBrief(Request $request){
// dd($request->all());
if($request->registers_id){
$register = Register::where('id', $request->registers_id)->first();
$register->status = self::CANCEL;
if($register->save()) {
if(!empty($request->descrip... |
Gets the attribute name. | public function getName(): string; |
Test Request GET (orchestra)/users/view/1 | public function testGetSingleUserPage()
{
$this->be($this->user);
$response = $this->call('orchestra::users@view', array(1));
$this->assertInstanceOf('Laravel\Response', $response);
$this->assertEquals(200, $response->foundation->getStatusCode());
$this->assertEquals('orchestra::users.edit', $response->c... |
Media directory name for the temporary file storage pub/media/tmp | protected function getMediaDirTmpDir()
{
return $this->directoryList->getPath(DirectoryList::MEDIA) . DIRECTORY_SEPARATOR . 'tmp';
} |
Devuelve un array de los productos que vencieron. | function devolverProductosVencidos($consulta)
{
$conexion = mysqli_connect("localhost", "root", "", "inventariocasa");
$fecha = date("j-n-Y");
if (!$resultado = mysqli_query($conexion, $consulta)) {
die();
}
$datos = array();
$i = 0;
while ($row = $resu... |
Automatically create datagrid for master file table | private function generateDatagrid(&$simbio, $str_args) {
$_master_tables = $this->global['db_prefix'].$this->dbTable.' AS mst ';
if ($this->dbTable != 'unit_kerja') {
$this->relation['id_unit'] = array('table' => 'unit_kerja',
'display_field' => 'nama_unit', 'pk_field' => 'id_... |
get users for the given filter code | function get_users_by_filter($filterCode,$users_id = '')
{
log_message('debug', '_message/get_users_by_filter');
log_message('debug', '_message/get_users_by_filter:: [1] filterCode='.$filterCode);
switch($filterCode){
case "all_users":
return $this->get_types(array('invited_shopper','random_shopper','clo... |
Determines if the subscribed link has block objects. | public function hasBodyLines()
{
return count($this->getBodyLines()) > 0;
} |
Checks if the PHP Solr extension is available. | public function is_installed() {
return function_exists('solr_get_version');
} |
Hent info om filmen | public function getFilm(): Film
{
return $this->film;
} |
Create token password reset | public function request(RequestPasswordReset $request)
{
$user = User::where('email', $request->validated())->first();
if (!$user) return response()->error('Email tidak ditemukan', StatusCode::UNPROCESSABLE_ENTITY);
$resetPassword = PasswordReset::updateOrCreate(
['email' => $use... |
Decodes a base64 encoded data. | function base64_decode(string $data, bool $strict = false): string
{
error_clear_last();
$result = \base64_decode($data, $strict);
if ($result === false) {
throw UrlException::createFromPhpError();
}
return $result;
} |
Check if field conditionally hidden | function ppom_is_field_hidden_by_condition( $field_name ) {
if( !isset($_POST['ppom']['conditionally_hidden']) ) return false;
$ppom_is_hidden = false;
$ppom_hidden_fields = explode(",", $_POST['ppom']['conditionally_hidden']);
// Remove duplicates
$ppom_hidden_fields = array_unique( $ppom_hidden_fields );
... |
Update the specified resource in storage. | public function update(Request $request, Product $product)
{
$request->validate([
'category_id' => 'required',
'product_name' => 'required|string',
'product_code' => 'required',
]);
if($request->image != $product->image && $request->image != null... |
Show the specified resource. | public function show($id)
{
return view('models::show');
} |
Get a Type instance based on the type of the passed php variable. | public static function getTypeFromPHPVariable($variable)
{
if (is_object($variable)) {
if ($variable instanceof \DateTime) {
return self::getType('date');
} else if ($variable instanceof \MongoId) {
return self::getType('id');
}
} e... |
getPalette method returns a value between 15 depending on which paletter the user wants to plot the chart with. Here, we just read from Session variable and show it In your application, you could read this configuration from your User Configuration Manager, database, or global application settings | function getPalette() {
//Return
return (((!isset($_SESSION['palette'])) || ($_SESSION['palette']=="")) ? "2" : $_SESSION['palette']);
} |
Change Method. More information on this method is available here: | public function change()
{
$table = $this->table('user_groups');
$table->addColumn('user_id', 'integer');
$table->addColumn('group_id', 'integer')
->create();
$table = $this->table('user_groups');
$table->addForeignKey('user_id', 'users', 'id', ['delete'=> 'RES... |
Handle an incoming request. | public function handle($request,Closure $next,$var=null)
{
if ($var=="bb")
{
echo "<br> MyMiddleware";
}
else
{
return $next($request);
}
} |
Output login result in JSON format. | function output_json_results() {
global $result;
print json_encode($result);
die();
} |
This method performs the voting action for a game. | public function vote($id)
{
// Find our game and perform the vote.
$game = $this->findById($id);
// Check if we own this game already.
if (!empty($game) && $game['owned'] == 1) return false;
// Check if we are using the service.
if (XBOXAPP_OFFLINE === true) {
if (empty($game)) return fal... |
Starts a new file stack | public function restore()
{
$this->files = array();
} |
Function to get member record of specific member id | protected function MEMBER_getUserLastMemberId ($es_id, $user_id)
{
if (!$es_id || !$user_id) throw new Exception (self::EXCEPTION_MESSAGE_NO_SESSION);
$query = $this->db->select(
self::MEMBER_TABLE,
'collab_member_id',
array('collab_es_id' => $es_id, 'collab_uid' => $user_id),
__LINE__,
__FILE_... |
Converts a hexidecimal representation of a color (think: XHTML/CSS) into an RGB 3item array. | public function convertHexToRgb($hex)
{
list($r, $g, $b) = array(
$hex[0] . $hex[1],
$hex[2] . $hex[3],
$hex[4] . $hex[5]
);
return array(hexdec($r), hexdec($g), hexdec($b));
} |
/ Cuando tenemos que escribir un archivo ".json" tenemos que ver si hay algo previamente guardado | public function Escribir($filePath, $personaRecibida)
{
// -> primero lo tenemos que leer
try {
if (!(isset($filePath))) {
throw new Exception('No se recibió path al archivo');
echo "entro";
} else if (!(file_exists($filePath))) {
... |
Show the profile page belonging to the current vendor. | public function ShowVendorProfile()
{
$GLOBALS['BreadCrumbs'] = array(
array(
'name' => GetLang('Vendors'),
'link' => VendorLink()
),
array(
'name' => $this->vendor['vendorname'],
)
);
$title = isc_html_escape($this->vendor['vendorname']);
$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(G... |
Find the child hierarchy for the specified parent node. | public function findChildHierarchy($parentId)
{
return $this->getChildHierarchyQueryBuilder($parentId)->getQuery()->getResult();
} |
Check last modification header and terminates presenter if provided date is less or equal | private function handleLastModification($lastModified) {
if(!$this->getHttpContext()->isModified($lastModified)) {
$this->getHttpResponse()->setHeader('Content-length', 0);
$this->terminate();
}
} |
order page (index) (ajax) | public function actionIndex()
{
$model = new OrderForm;
if( Request::isAjaxRequest() ) {
$model->setAttributes( Request::getPosts() );
if( !$model->validate() ) {
\Framework::end( json_encode( [ 'status' => 'error', 'content' => $model->getMessages() ] ) );
}
$product = Product::model()->find... |
Return script link for $href | public function js($href)
{
return sprintf('<script src="%s"></script>', $this->url($href));
} |
To Return Chart Of Account Primary Key | public function getChartOfAccountId()
{
return $this->chartOfAccountId;
} |
config pour le site | public function details_entrepot_site($id)
{
$entrepot = Entrepot::findOrFail($id);
$entrepot_similaire = Entrepot::where('id', '!=', $id)
->where('status', 1)
->take(8)
->get();
$nb_entr = $entrepot_similaire->count();
return view('site.entrepot.... |
Get the services provided by the provider. | public function provides() {
return array();
} |
Returns sql where part and params. | public function get_sql($data, $logreader) {
global $DB;
$wherearray = array();
$where = array();
$params = array();
if ($logreader instanceof \logstore_standard\log\store) {
$db = $DB;
} else if ($logreader instanceof \logstore_database\log\store) {
... |
redirect to Appliacation route:: application/careerID | public function show($id)
{
} |
Return the file URL | abstract public function url($manipulation_name = ''); |
Get the current receiver | private function getTo(): ?array {
return $this->to;
} |
Process event and return result to subscribers. | public function fire(): array; |
Get user social id or null if it is not set | public function getUserId()
{
return $this->getUserAttribute(static::ATTRIBUTE_ID);
} |
Sets the Icontact Prospect Country Name attribute value. | public function setCountryName(string $country_name = null) : CNabuDataObject
{
$this->setValue('nb_icontact_prospect_country_name', $country_name);
return $this;
} |
Display the specified resource. | public function show($id)
{
return \App\FactorImpact::find($id);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.