query
stringlengths 10
8.11k
| document
stringlengths 17
398k
| negatives
listlengths 19
20
| metadata
dict |
---|---|---|---|
Get the presentation from the API result.
|
public function getPresentation($api_result) {
return [
"ip" => $api_result["ip"],
"hostname" => $api_result["hostname"],
"type" => $api_result["type"],
"latitude" => $api_result["latitude"],
"longitude" => $api_result["longitude"],
"city" => $api_result["city"],
"country_code" => $api_result["country_code"],
"country_name" => $api_result["country_name"],
"continent_name" => $api_result["continent_name"]
];
}
|
[
"function presentation()\n {\n if ($Presentation = $this->getPresentationByURLSegment()) {\n $Data = array(\n 'Presentation' => $Presentation\n );\n\n $this->Title = $Presentation->Name;\n $this->Autoplay = Session::get('Autoplay');\n\n // Clear autoplay so it only happens when you come directly from videos index\n Session::set('Autoplay', false);\n\n //return our $Data to use on the page\n return $this->Customise($Data);\n } else {\n //Presentation not found\n return $this->httpError(404, 'Sorry that presentation could not be found');\n }\n }",
"function displayResult(){\n\n $response = $this->encode($this->response);\n\n switch($this->format){\n\n default:\n echo $response;\n break;\n\n }//endswitch\n\n }",
"public function getPresentation()\n {\n return $this->presentation;\n }",
"public function getFrontendResult();",
"public function getPresentation() {\n\t\tif($this->debugmode)\n\t\t\techo \"<br> Entity::getPresentation for {$this->name} instance\";\n\n\t\t$id1 = md5(microtime());\n\t\t$id2 = md5(microtime());\n\t\t$fields = \"\";\n\t\t$fieldsToConcat = \"\";\n\n\t\tif (strpos($this->presentation[0], \"%\") === false) {\n\n\t\t\tforeach($this->presentation as $value) {\n\t\t\t\t$fields .= Parser::first_comma($id1,\", \").\"$value\";\n\t\t\t\tforeach($this->fields as $k => $v) {\n\t\t\t\t\tif (($v->name == $value) and ($v->type == DATE)) {\n\t\t\t\t\t\t$value = \"DATE_FORMAT({$value},'%d/%m/%Y')\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$fieldsToConcat .= Parser::first_comma($id2,\",' ', \").\"{$value}\";\n\t\t\t}\n\t\t} else {\n\t\t\t$presentation = $this->presentation[0];\n\t\t\t$finito = false;\n\t\t\tdo {\n\t\t\t\t$pos = strpos($presentation, \"%\");\n\t\t\t\tif ($pos !== false) {\n\t\t\t\t\t$value = substr($presentation, 0, $pos);\n\t\t\t\t\t$fieldsToConcat .= Parser::first_comma($id2,\",\").\"'{$value}'\";\n\t\t\t\t\t$presentation = substr($presentation, $pos);\n\t\t\t\t\tereg(\"^\\%([[:alnum:]]*)\", $presentation, $token);\n\t\t\t\t\t$fields .= Parser::first_comma($id1,\", \").$token[1];\n\t\t\t\t\t$fieldsToConcat .= Parser::first_comma($id2,\",\").\"{$token[1]}\";\n\t\t\t\t\t$presentation = substr($presentation, strlen($token[1])+1);\n\t\t\t\t} else {\n\t\t\t\t\t$fieldsToConcat .= Parser::first_comma($id2,\",\").\"'{$presentation}'\";\n\t\t\t\t\t$finito = true;\n\t\t\t\t}\n\t\t\t} while (!$finito);\n\t\t}\n\t\t$result['fields'] = $fields;\n\t\t$result['fieldsToConcat'] = $fieldsToConcat;\n\t\treturn $result;\n\t}",
"function getPresentation()\n {\n $presentation = UNL_ENews_Story_Presentation::getByID($this->presentation_id);\n\n if (false == $presentation) {\n throw new Exception('This story references a presentation type that is unknown!', 500);\n }\n return $presentation;\n }",
"public function getPresentation()\n {\n if (null !== $this->presentation_id) {\n return UNL_ENews_Story_Presentation::getByID($this->presentation_id);\n }\n\n return $this->getStory()->getPresentation();\n\n }",
"public function response() {\n return response()->json(json_decode($this->shows()->toJson()), Response::HTTP_OK);\n }",
"function get_presentation() { return $this->form->param->presentation;\t}",
"public function getPresentationByURLSegment()\n\t\t{\n\t\t\t$Params = $this->getURLParams();\n\t\t\t$id = convert::raw2sql($Params['ID']);\n\t\t\tif(is_numeric($id) && $Presentation = SpeakerSubmission::get()->byID($id))\n\t\t\t{\t\n\t\t\t\treturn $Presentation;\n\t\t\t}\n\t\t}",
"public function display()\n {\n echo $this->getResponse();\n }",
"public function show()\n {\n return $this->arrayResult;\n }",
"public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $userId = $this->get('security.token_storage')->getToken()->getUser()->getId();\n $presentations = $em->getRepository('IssConferenceBundle:Presentation')->findForUser($userId);\n\n return $this->render('IssConferenceBundle:Presentation:index.html.twig', array(\n 'entities' => $presentations,\n ));\n }",
"public function get_panics()\n {\n return Response::forge(Presenter::forge('api/clinear/pillar/panics', 'view', NULL, 'api/response'), 200, array('Content-Type','application/json'));\n }",
"public function displayResponse()\n {\n $this->displayResult = [];\n foreach ($this->invokeLambdaFunctionResponse as $key => $value) {\n if ($key === 'body') {\n foreach ($value as $bKey => $bValue) {\n $this->displayResult['Meta Data']['Author'] = isset($value['metadata']['author']) ? $value['metadata']['author'] : 'NA';\n $this->displayResult['Meta Data']['Abstract'] = isset($value['metadata']['abstract']) ? $value['metadata']['abstract'] : 'NA';\n\n // $this->displayResult['Summary'] = implode(' ', $value['summary']);\n // $this->displayResult['Highlights'] = implode(' ', $value['highlights']);\n // dd($value['highlights'], $this->displayResult['Summary']);\n // Get Summary\n foreach ($value['summary'] as $summaryKey => $summaryValue)\n $this->displayResult['Summary'][$summaryKey + 1] = $summaryValue;\n\n // Get Highlights\n foreach ($value['highlights'] as $highlightsKey => $highLightsValue)\n $this->displayResult['Highlights'][$highlightsKey + 1] = $highLightsValue;\n }\n }\n }\n // End of For\n\n $toolDetails = ToolDetailsSushi::whereAbbr('SCH')->get();\n $sendJobData = [\n 'user_id' => user()->id,\n 'tool_id' => round(@$toolDetails[0]->tool_id),\n 'tool_name' => $toolDetails[0]->tool_name,\n 'request_payload' => json_encode([\n 'file_name' => $this->scholarcyFile->getClientOriginalName()\n ]),\n 'response_payload' => collect($this->displayResult)->toJson(),\n 'is_file_content' => 1,\n 'update_id' => $this->historyUpdateId\n ];\n\n ProcessHistory::dispatch($sendJobData)->onQueue('history');\n }",
"public function actionShow()\n {\n $documentId = Craft::$app->getRequest()->getParam('documentId');\n\n return $this->asJson(Imageshop::$plugin->soap->getImage($documentId));\n }",
"public function presentations_list() {\n\t\t$start = microtime(true);\n\t\t\n\t\t// Only allow this action to be viewed as JSON\n\t\t$response = array('success' => false, 'result' => null, 'created' => null);\n\t\tif(!$this->request->is('json')) {\n\t\t\treturn json_encode($response);\n\t\t}\n\t\t\n\t\t// Providing a comma separate list of tags will return only certain documents.\n\t\t$tags = isset($this->request->data['tags']) ? explode(',', $this->request->data['tags']):false;\n\t\t\n\t\t$conditions = array('published' => true);\n\t\tforeach($tags as $tag) {\n\t\t\t$conditions['$or'][] = array('tags' => trim($tag));\n\t\t}\n\t\t\n\t\t// Limit just in case. So things don't get out of hand one day.\n\t\t$limit = isset($this->request->data['limit']) ?$this->request->data['limit']:25;\n\t\t$page = $this->request->page ?: 1;\n\t\t$order = array('created' => 'desc');\n\t\t\n\t\t$total = SandboxPresentation::count(compact('conditions'));\n\t\t$documents = SandboxPresentation::all(compact('conditions','order','limit','page'));\n\t\t\n\t\t$page_number = (int)$page;\n\t\t$total_pages = ((int)$limit > 0) ? ceil($total / $limit):0;\n\t\t\n\t\t// Pagination info\n\t\t$response['page'] = $page;\n\t\t$response['total'] = $total;\n\t\t$response['limit'] = $limit;\n\t\t$response['total_pages'] = $total_pages;\n\t\t\n\t\t// The links\n\t\tif($total > 0) {\n\t\t\t$response['success'] = true;\n\t\t\t\n\t\t\tforeach($documents as $document) {\n\t\t\t\t$response['result'][] = array('title' => $document->title, 'description' => $document->description, 'link' => $document->link);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Stats\n\t\t$response['created'] = time();\n\t\t$response['took'] = microtime(true) - $start;\n\t\t\n\t\treturn json_encode($response);\n\t}",
"private function preview()\n {\n //Load and store parameters\n $user_id = (int)$this->Request->get('user_id');\n $this->responseSetParam('user_id', $user_id);\n\n //Load user profile\n $UsersLib = new UsersLib($this->DB, $this->User);\n $this->responseSetContent($UsersLib->export(array($user_id)));\n }",
"public function renderResult()\n {\n return parent::render(self::$viewFilePath . 'results', ['question' => $this->question], new Context());\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Display a form validations of the resource.
|
public function validations(){
$pageTitle = 'Form';
$pageDescription = 'Some description for the page';
return view('forms.validations', compact('pageTitle', 'pageDescription'));
}
|
[
"public function validation()\n {\n return view('admin.pages.forms.validation');\n }",
"public function showFormErrors() {\n if(($_POST || $_GET) && !$this->isValid()) {\n ?>\n <td class=\"error\"> <?php echo $this->getError();?></td>\n <?php\n }\n }",
"public function ShowValidationError()\n\t {\n\t \tforeach ($this->validMessages as $index => $errMessage ) {\n\t \t\tforeach ($errMessage as $key => $value) {\n\t \t\t\techo '<b>'.$key.'</b>: '.$value.\"<br/>\";\n\t \t\t}\n\t \t}\n\t }",
"public function overviewFormValidate() {}",
"protected function displayFormErrors() {\n $this->_template->errors = $this->_model->getErrors();\n $this->_template->missing = $this->_model->getMissingValues();\n $this->_template->input = $this->_model->getSubmittedValues();\n $this->_template->error = '<p class=\"error\">An error occurred. Please try again.</p>';\n }",
"public function example() {\n\t\tif ($this->ExampleForm->validates($this->request->data)) {\n\t\t\techo 'true validations';\n\t\t} else {\n\t\t\techo 'false validation';\n\t\t}\n\t}",
"public function visualizeValidation() {\n $topics = $this->formValidator->getErrors();\n //echo $topics->toJson();\n foreach ($this->form->getNamedInputComponents() as $input) {\n $topic = $input->getName();\n if ($topics->hasTopic($topic)) {\n $id = $input->identify();\n //$json = $topics->getTopic($topic)->toJson();\n foreach ($topics->getTopic($topic) as $message) {\n $messages[] = \"'$message'\";\n }\n $json = Arrays::implode($messages);\n\n //$this->script[] = \"$('#$id').visualizeValidation(\" . $topics->getTopic($topic)->toJson() . \");\";\n }\n }\n return $this;\n }",
"public function display() {\n global $OUTPUT;\n\n if ($this->_form->_errors) {\n foreach ($this->_form->_errors as $error) {\n echo $OUTPUT->notification($error, 'notifyproblem');\n }\n unset($this->_form->_errors);\n }\n\n parent::display();\n }",
"public function whenFormPassesValidation();",
"function display(){\n echo '<form id=\"' . $this->id . '\" name=\"' . $this->id . '\" method=\"' . $this->method . '\" enctype=\"' . $this->enctype . '\" action=\"' . $this->action . '\">';\n echo '<div class=\"row\"><div class=\"col-md-12\">';\n \n if ( !empty($this->errors) ){\n foreach ( $this->errors as $error ){\n printf( '<div class=\"alert alert-danger\" role=\"alert\">%s</div>', $error );\n }\n }\n \n echo '<div class=\"form-fields\">';\n \n foreach( $this->fields as $field ){\n $field->display();\n }\n echo '</div>';\n \n echo '<p><input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Submit\"></p>';\n echo '</div></div>';\n echo '</form>';\n }",
"public function display_validation_notices ()\n\t\t {\n\t\t \tsettings_errors($this->key);\n\t\t }",
"public function viewRecipesToValidate() {\n $twig = Templater::getInstance()->getTwig();\n\n $recipesToValidate = RecipeService::findByValidation(false);\n\n echo $twig->render(\n 'admin/admin-recipe.html.twig',\n [\n 'checkingValidatedRecipes' => false,\n 'recipes' => $recipesToValidate\n ]);\n }",
"function validate() {\n\n // Try loading submission data\n if ( ! $this->load_submission_data() ) {\n return;\n }\n\n $form = AF()->submission['form'];\n $args = AF()->submission['args'];\n\n do_action( 'af/form/validate', $form, $args );\n do_action( 'af/form/validate/id=' . $form['post_id'], $form, $args );\n do_action( 'af/form/validate/key=' . $form['key'], $form, $args );\n\n }",
"public function validate()\r\n {\r\n $this->app->set('meta.title', 'Validate Email Address | Login');\r\n \r\n $view = \\Dsc\\System::instance()->get( 'theme' );\r\n echo $view->render( 'Users/Site/Views::login/validate.php' );\r\n }",
"public function validate() {\n $this->validateTitle();\n $this->validateName();\n $this->validateFirstName();\n $this->validateMail();\n $this->validateObject();\n $this->validateMessage();\n $this->validateFormat();\n }",
"function views_ui_edit_display_form_validate($form, &$form_state) {\n $display = &$form_state['view']->display[$form_state['display_id']];\n $display->handler->options_validate($form['options'], $form_state);\n\n if (form_get_errors()) {\n $form_state['rerender'] = TRUE;\n }\n}",
"function erros_validacao(){\n\t\n\tif (validation_errors()) echo '<div class=\"alert-box alert\">'.validation_errors('<p>', '</p>').'</div>';\n}",
"public function validateAction()\n {\n $collection = new LoginModel();\n $user = (new LoginModel())->validateLogin();\n echo (new View('loginValidation'))\n ->addData('collection', $collection)\n ->addData('user', $user)\n ->render();\n }",
"public function validateStudentFormAction()\n {\n $formValues = $this->getAllParams();\n\n $form = new Account_Form_Student($formValues['studentId'], $formValues['snId']);\n $form->isValid($formValues);\n\n $this->_helper->json($form->getMessages());\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the input field of a featured post ID used for displaying in the admin form
|
public function get_featured_post_input_field( $post ) {
$post = get_post( $post );
$context = array(
'title' => apply_filters( 'the_title', $post->post_title ),
'id' => $post->ID,
'delete_icon' => '<span class="dashicons dashicons-trash"></span>', // See https://developer.wordpress.org/resource/dashicons/#trash
);
return Sprig::render( 'input-field.twig', $context );
}
|
[
"function get_post_featured_field() {\n $input = new Input(\n [\n 'id'\t=> RVA_POST_FIELDS_FEATURED_POST,\n 'type' => 'checkbox',\n 'name' => RVA_POST_FIELDS_FEATURED_POST,\n 'label' => 'Featured Post',\n 'value' => '',\n ]\n );\n\n return $input;\n}",
"function getPostField($field);",
"function acf_get_field_reference( $field_name, $post_id ) {\n}",
"function acf_get_field_reference($field_name, $post_id) {}",
"function demus_featured_post_field()\n {\n global $post;\n\n /* check if this is a post, if not then we won't add the custom field */\n /* change this post type to any type you want to add the custom field to */\n if (get_post_type($post) != 'post') return false;\n\n /* get the value corrent value of the custom field */\n $value = get_post_meta($post->ID, 'demus_featured_post_field', true);\n ?>\n <div class=\"misc-pub-section\">\n <?php //if there is a value (1), check the checkbox ?>\n <label><input type=\"checkbox\"<?php echo (!empty($value) ? ' checked=\"checked\"' : null) ?> value=\"1\" name=\"demus_featured_post_field\" />Highlight-Teaser (größer)</label>\n </div>\n <?php\n }",
"function acf_get_value($post_id, $field)\n{\n}",
"function acf_get_value($post_id = 0, $field) {}",
"function acf_get_value( $post_id = 0, $field ) {\n}",
"function acf_preview_value($value, $post_id, $field) {}",
"function get_custom_field( $field_slug, $post_id = null, $args = array() ) {\n\n\t\tif ( ! $post_id ) $post_id = get_the_ID();\n\n\t\t$field_value = get_custom_field_listing_meta( $field_slug, $post_id, $args );\n\n\t\treturn $field_value;\n\n\t}",
"function acf_get_raw_field( $id = 0 ) {\n}",
"function acfe_get_post_id(){\n \n // Admin\n if(acfe_is_admin()){\n \n // Legacy ACF method\n $post_id = acf_get_valid_post_id();\n \n // Exclude local meta post ids\n if(function_exists('acfe_get_local_post_ids')){\n \n $exclude_post_ids = acfe_get_local_post_ids();\n \n if(in_array($post_id, $exclude_post_ids))\n $post_id = false;\n \n }\n \n if($post_id)\n return $post_id;\n \n // ACF Form Data\n $post_id = acf_get_form_data('post_id');\n \n // $_POST['_acf_post_id']\n if(!$post_id){\n $post_id = acf_maybe_get_POST('_acf_post_id');\n }\n \n // $_REQUEST['post']\n if(!$post_id){\n $post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0;\n }\n \n // $_REQUEST['post_id'] - ACF Block Type\n if(!$post_id){\n $post_id = isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : 0;\n }\n \n // $_REQUEST['user_id']\n if(!$post_id){\n $post_id = isset($_REQUEST['user_id']) ? 'user_' . absint($_REQUEST['user_id']) : 0;\n }\n \n // $_REQUEST['tag_ID']\n if(!$post_id){\n $post_id = isset($_REQUEST['tag_ID']) ? 'term_' . absint($_REQUEST['tag_ID']) : 0;\n }\n \n // Default\n if(!$post_id){\n $post_id = 0;\n }\n \n \n // Front\n }else{\n \n // vars\n $object = get_queried_object();\n $post_id = 0;\n \n if(is_object($object)){\n \n // Post\n if(isset($object->post_type, $object->ID)){\n \n $post_id = $object->ID;\n \n // Post Type Archive\n }elseif(isset($object->hierarchical, $object->name, $object->acfe_admin_archive)){\n \n // Validate with ACF filter (for multilang)\n $post_id = acf_get_valid_post_id($object->name . '_archive');\n \n // User\n }elseif(isset($object->roles, $object->ID)){\n \n $post_id = 'user_' . $object->ID;\n \n // Term\n }elseif(isset($object->taxonomy, $object->term_id)){\n \n $post_id = 'term_' . $object->term_id;\n \n // Comment\n }elseif(isset($object->comment_ID)){\n \n $post_id = 'comment_' . $object->comment_ID;\n \n }\n \n }\n \n }\n \n return $post_id;\n \n}",
"function acf_get_reference($field_name, $post_id)\n{\n}",
"function productTeaser($post)\r\n{\r\n ?>\r\n <p>\r\n <span>Embed-cсылка на тизер: </span>\r\n <input type=\"text\" name='extra[teaser]' value=\"<?php echo get_post_meta($post->ID, \"teaser\", 1); ?>\">\r\n </p>\r\n <?php\r\n}",
"function acf_get_reference($field_name, $post_id) {}",
"public function get_form_field_name() {\n $object_field = $this;\n $name = (string)$object_field->getName();\n if ($name == \"Custom_Field\") {\n $name .= '-' . $object_field->attributes()->id;\n }\n return $name;\n }",
"function productRecommended($post)\r\n{\r\n ?>\r\n <p>\r\n <span>Массив ID рекомендованых товаров: </span>\r\n <input type=\"text\" name='extra[recommend]' value=\"<?php echo get_post_meta($post->ID, \"recommend\", 1); ?>\">\r\n </p>\r\n <?php\r\n}",
"function custom_post_column_id( $column_name, $postid ) {\n\tif ( $column_name == \"postid\" )\n\t\techo $postid;\n}",
"private function getIDfield() : string { \n if ($this->isEditMember != null) {\n return '<input type=\"hidden\" id=\"' . self::$memberId . '\" name=\"' . self::$memberId . '\" value=\"' . $this->memberToEdit() . '\">';\n } else {\n return \"\";\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Match field with db
|
public function field_match($field, $params)
{
//This params contain comma separated in order (table,field)
//Get those in array
$params = explode(',', $params);
//Add field in where
$this->CI->db->where($params[1], $field);
//Set form table
$this->CI->db->from($params[0]);
return $this->CI->db->count_all_results() > 0;
}
|
[
"function find_by_field($field_name,$field_value)\n\t{\n\t\t$field_name = $this->_db->escape_string($field_name);\n\t\t$field_value = $this->_db->escape_string($field_value);\n\t\t\n\t\t$sql = 'SELECT * FROM \"'.$this->get_table_name().'\" WHERE '.$field_name.\" = '\".$field_value.\"' LIMIT 1\";\n\t\t$record = $this->_db->get_first_row($sql);\n\t\t\n\t\treturn $this->set_attributes_from_record($record);\n\t}",
"public function match($record);",
"public function getSearchedField();",
"public function querableField($name);",
"function find_by( $field, $value ) {\n\t\t$value = $this->escape_string( $value );\n\t\treturn $this->fetch_many( \"select * from {$this->table_name()} where {$field} = '{$value}'\" );\n\t}",
"function FieldCheck($table,$column1,$column2,$value) //$column1=input , $column2= output\r\n {\r\n //SELECT $COLUMN2 FROM $TABLE WHERE $COLUMN1=$VALUE\r\n $query = sprintf(\"SELECT %3\\$s FROM %1\\$s WHERE %2\\$s=%4\\$s\",\r\n $table,$column1,$column2,$value\r\n );\r\n //passing this query to MYSQL\r\n $result= $this->query($query);\r\n //getting the record for the QUERY\r\n $stat = $this->SingleRecord($result);\r\n return $stat;\r\n }",
"function match_against_query()\r\n\t{\r\n\t\t\r\n\t\t\r\n\t\t$cond = \" MATCH ( \";\r\n\t\t$count = 0;\r\n\t\tforeach($this->match_fields as $field)\r\n\t\t{\t\r\n\t\t\r\n\t\t\tif($count>0)\r\n\t\t\t\t$cond .= \",\";\r\n\t\t\t$cond .= tbl($this->db_tbl).\".\".$field;\r\n\t\t\t\r\n\t\t\t$count++;\r\n\t\t}\r\n\t\t$cond .= \")\"; //Here match(fields1,field2) thing is finished\r\n\t\t\r\n\t\t//now add against\r\n\t\t$cond .= \" AGAINST ('\".$this->key.\"' IN BOOLEAN MODE) \";\r\n\t\t\r\n\t\treturn $cond;\r\n\t}",
"public function getMatch(){\n return $this->hasOne(SecondTable::className(),['field_1'=>'field_1']);\n }",
"function checkDataExists($tableName, $selectedField, $selectedFieldValue){\n $query = \"SELECT * FROM $tableName WHERE $selectedField = $selectedFieldValue\";\n\n $result = selectDB($query);\n echo(\"checkdata result: \".$result);\n if(!empty($result)){\n //matching data found\n return true;\n }else{\n //nothing found\n return false;\n }\n }",
"function lookupField($tableName, $selectFieldName, $whereFieldName, $whereFieldValue) {\n global $default;\n $sql = $default->db;\n $query = \"select $selectFieldName from $tableName where $whereFieldName = ?\" ;\n\n $aParams = array($whereFieldValue);\n \n if ($sql->query(array($query, $aParams))) {\n if ($sql->next_record()) {\n return $sql->f($selectFieldName);\n } else {\n return false;\n }\n } else {\n $_SESSION[\"errorMessage\"] = \"lookup query failed ($query).\";\n return false;\n }\n}",
"function field_name_exists( $name ){\r\n\t\tglobal $wpdb;\r\n\t\t$table_name = $wpdb->prefix . \"ura_fields\";\r\n\t\t$sql = \"SELECT field_name FROM $table_name WHERE field_name = %s\";\r\n\t\t$run_query = $wpdb->prepare( $sql, $name );\r\n\t\t$field = $wpdb->get_var( $run_query );\r\n\t\t//wp_die( 'FIELD ___'.$field );\r\n\t\treturn $field;\t\r\n\t}",
"public function fieldExists($fieldName){}",
"function field_exists($field, $table);",
"public function match_sql($sql){\r\n\t\t\t\tglobal $db;\r\n\r\n\t\t\t\treturn $db->query($sql);\r\n\t\t}",
"public function fieldExists($table_name, $field_name);",
"function get_($table,$field,$value){\n global $config;\n $sql_word = \"SELECT * FROM {$config['db']['tableprefix']}{$table} WHERE $field = '$value'\";\n return perform_sql($sql_word);\n }",
"public function findFieldById($id);",
"function check_update_autocomplete_db(\n\t\t$auto_db_table,\n\t\t&$fill_compare_fields, &$fill_compare_val_nm, &$field_val,\n\t\t&$complete_fields, &$complete_val_nm, &$complete_val)\n{\n// fill_compare_fields, fill_compare_val_nm, and field_val are arrays of same length (the number\n// of fields which would distinguish a row in a support automcomplete db as unique, plus the\n// correspponding field in the db just editted, and the respective values\n// complete_fields, complete_val_nm, and complete_val are arrays of same length (the number\n// of fields which are the significant values of the fields used\n\tglobal\t$mysql;\n\tglobal\t$login_type;\n\t\n\tif (!$auto_db_table) {\n\t\treturn false;\n\t}\n// make a db test. does this item exist? we expect a match on all the compare fields\n// to be a match, and we should correct the given entry ???? maybe.\n\t\n\t$select_str = \"\";\n\treset($fill_compare_fields);\n\twhile (list($k,$v)=each($fill_compare_fields)) {\n\t\t$select_str = eq_clause($select_str, $v, $field_val[$k]);\n\t}\n\tif (!$select_str) { // nothing to do\n\t\treturn false;\n\t}\n\t$query = \"select * from $auto_db_table where ${select_str}\";\n\t$fetch_result = mysql_query($query, $mysql);\n\tif (!$fetch_result) {\n\t\treturn false;\n\t}\n\t$num_matching = mysql_num_rows($fetch_result);\n\tif ($num_matching == 0) {\n\t\treset($complete_fields);\n\t\t$field_set_str = \"\";\n\t\twhile (list($k,$v)=each($complete_fields)) {\n\t\t\tif ($complete_val[$k]) {\n\t\t\t\t$field_set_str = set_item($field_set_str, $v, $complete_val[$k]);\n\t\t\t}\n\t\t}\n\t\tif ($field_set_str) {\n\t\t\t$query = \"insert into ${auto_db_table} set ${field_set_str}\";\n\t\t\t$insert_result = mysql_query($query, $mysql);\n\t\t\tif (!$insert_result) {\n//\t\t\t\terrorpage(mysql_error()); // perhaps we should be quiet about things like this\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t} else {\n// possibly try and correct inconsistencies and errors, or supply missing information.\n\t\tif ($num_matching == 1) {\n\t\t\t$row = mysql_fetch_object($fetch_result);\n\t\t\treset($complete_fields);\n\t\t\t$field_set_str = \"\";\n\t\t\twhile (list($k,$v)=each($complete_fields)) {\n\t\t\t\tif (isset($row->$v)) { \n\t\t\t\t\t$chk_val = $row->$v;\n\t\t\t\t\tif (!$chk_val || ($login_type >= LOGIN_ADMIN && $chk_val != $complete_val[$k])) {\n\t\t\t\t\t\t$field_set_str = set_item($field_set_str, $v, $complete_val[$k]);\n\t\t\t\t\t}\n\t\t\t\t} else {\n// else there is an inconsistency in this subsystem's settings. a field should be fetched even if\n// in which case it would be a really bad idea to set this\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($field_set_str) {\n\t\t\t\t$query = \"update ${auto_db_table} set ${field_set_str} where ${select_str}\";\n\t\t\t\t$update_result = mysql_query($query, $mysql);\n\t\t\t\tif (!$update_result) {\n\t//\t\t\t\terrorpage(mysql_error()); // perhaps we should be quiet about things like this\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n// this is getting into the can'o'worms territory. do we make changes to every matching\n// entry? or if so, who should commit such wholesale slaugher....\n\t\t}\n\t}\n\treturn true;\n}",
"function sameAs($data, $field) {\n\t\t\t$value = Set::extract($data, \"{s}\");\n\t\t\treturn ($value[0] == $this->data[$this->name][$field]);\n\t\t}",
"function checkExistsInUsersTbl($element,$elementValue,$elementDbField)\n{\n global $db;\n $sql = \"SELECT TRUE FROM users WHERE $elementDbField = ?\";\n return !is_null($db->getOne($sql,$elementValue));\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Save timestamp of running Cron.
|
public function setCronLastStart()
{
/** @var \Cleantalk\Common\StorageHandler\StorageHandler $storage_handler_class */
$storage_handler_class = Mloader::get('StorageHandler');
return $storage_handler_class::saveSetting('cleantalk_cron_last_start', time());
}
|
[
"protected static function _save()\n {\n $cache = Cache::instance();\t\t\n $cache->set(\"Cron::run()\", Cron::$_times, Kohana::$config->load('cron')->window * 2);//30*24*60*60);\n }",
"public function updateLastRunTime()\n {\n $dt = new DateTime('now', new DateTimeZone('UTC'));\n $this->kvpRepo->save('cron_last_run', $dt->format(DateTime::ISO8601));\n }",
"public function saveLastRunTime()\n {\n if (! $this->dbLink)\n {\n $this->getDBConnection();\n }\n\n $fields['cron_name'] = $this->q($this->id);\n $fields['start_time'] = $this->q(date(\"Y-m-d H:i:s\", $this->startTime));\n $fields['end_time'] = $this->q(date(\"Y-m-d H:i:s\", $this->endTime));\n $fields['elapsed_sec'] = $this->endTime - $this->startTime;\n $fields['last_runtime'] = $fields['start_time'];\n $fields['status'] = $this->status;\n $fields['pid'] = posix_getpid();\n\n $fieldCSV = implode(',', array_keys($fields));\n $valueCSV = implode(',', array_values($fields));\n\n $stmt = \"REPLACE LOW_PRIORITY last_run ($fieldCSV) values($valueCSV)\";\n\n if(!($results = $this->dbLink->query($stmt)))\n {\n echo \"Failed to save last run time for $this->id Error:\".$this->dbLink->error;\n }\n\n return ($results) ? true : false;\n }",
"public function cronLogRunTime()\n\t{\n\t\t$run_time = sprintf('%0.3f', microtime(true) - $this->log_start_timestamp);\n\t\treturn $this->db->query(\"UPDATE `\" . DB_PREFIX . $this->module_name . \"_cronlog` SET `run_time` = '\" . $run_time . \"' WHERE `log_entry_id`=\" . $this->log_entry_id);\n\t}",
"public function cronsLast();",
"function saveCronFile(){\n\t\t\t$command=$this->minute.\" \".$this->hour.\" \".$this->day.\" \".$this->month.\" \".$this->dayofweek.\" \".$this->command.\"\\n\";\n\t\t\tif(!fwrite($this->handle, $command))\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}",
"public function getCronTime() {\n return Mage::getStoreConfig(self::SECTION . self::CRON_GROUP . \"time\");\n }",
"protected function _cronfile_save(){\n\t\t$data = serialize(array(\n\t\t\t'_jobs_meta' => $this->_jobs_meta,\n\t\t\t));\n\t\tfile_put_contents($this->_cronfile, $data);\n\t\t@chmod($this->_cronfile, 0666); # don't bark, just do the job\n\t\t}",
"function lastCronRun(){\n if(file_exists(__DIR__ . \"/../cron_last_time.txt\")){\n $fp = fopen( __DIR__ . \"/../cron_last_time.txt\",\"r\");\n $time_ran = fread($fp,filesize(\"cron_last_time.txt\"));\n fclose($fp);\n return $time_ran;\n } else {\n return null;\n }\n }",
"public function updateLastRunTime();",
"public function write()\n {\n $file = \\tempnam(\\sys_get_temp_dir(), 'cron');\n\n \\file_put_contents($file, $this->getRaw().PHP_EOL);\n\n $process = new Process('crontab '.$file);\n $process->run();\n\n $this->error = $process->getErrorOutput();\n $this->output = $process->getOutput();\n }",
"public function setLastCronUpdate()\n {\n return $this->builderGeneral->where('id', 1)->update(['last_cron_update' => date('Y-m-d H:i:s')]);\n }",
"function logCronTask($param = null){\n $content = time();\n\n if($param){$content = 'ERROR';}\n $fp = fopen( __DIR__ . \"/../cron_last_time.txt\",\"wb\");\n fwrite($fp,$content);\n fclose($fp);\n }",
"private function setLastRunTimestamp()\n\t{\n\t\t$lastRun = time();\n\t\t$params\t = $this->getComponentParameters();\n\t\t$params->set('plg_akeebasubs_asexpirationcontrol_timestamp', $lastRun);\n\n\t\t$db\t\t = JFactory::getDBO();\n\t\t$data\t = $params->toString();\n\n\t\t$query = $db->getQuery(true)\n\t\t\t->update($db->qn('#__extensions'))\n\t\t\t->set($db->qn('params') . ' = ' . $db->q($data))\n\t\t\t->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'))\n\t\t\t->where($db->qn('type') . ' = ' . $db->q('component'));\n\t\t$db->setQuery($query);\n\t\t$db->execute();\n\t}",
"function btrCore_cron_nightly() {\n // check whether the crontime has been reached yet\n $crontime = variable_get('btrCore_crontime', '0');\n if (time() < $crontime) return;\n\n // set the crontime after the next midnight (after 03:00 AM)\n $crontime = strtotime(date('Y-m-d 02:55')) + 24*60*60;\n variable_set('btrCore_crontime', $crontime);\n\n // Call cron functions.\n btrCore_delete_old_export_files();\n btrCore_cleanup_fake_users();\n btrCore_send_strings_for_review();\n}",
"protected function writeCronEntry()\n {\n $cronDir = config('shellax.cron.dirs.default');\n if (strlen($this->entry) > 0) {\n if (is_dir($cronDir)) {\n $filename = $cronDir . DIRECTORY_SEPARATOR . $this->name;\n file_put_contents($filename, $this->entry . PHP_EOL);\n\n $this->info('Saved cronjob to ' . $filename);\n }\n }\n }",
"public function execute() {\n if (self::configUpdatedMoreRecentlyThanCron()) {\n CronManager::updateCron($this->jobs);\n }\n }",
"public function setCronStatusOn()\n {\n $params = array();\n $params['table'] = LAST_RUN;\n $params['where'] = \" cron_name = '\" . $this->id . \"'\";\n $data = array();\n $data['status'] = 1;\n $params['data'] = $data;\n \n $this->dbLink->update($params);\n }",
"private function setLastRunAt(): void\n {\n // OR if this has never been run before use 2001-01-01\n if (! empty($this->option('lastRunAt'))) {\n $this->lastRunAt = new Carbon($this->option('lastRunAt'));\n } else {\n $this->lastRunAt = $this->harvest->last_run_at ?? new Carbon('2001-01-01');\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
A basic test health.
|
public function testHealth()
{
$this->json('GET', '/health')->seeJson([
'status' =>'ok'
]);
}
|
[
"public function testGetHealth(): void\n {\n $response = [\n 'cluster_name' => 'testcluster',\n 'status' => 'yellow',\n 'timed_out' => false,\n 'number_of_nodes' => 1,\n 'number_of_data_nodes' => 1,\n 'active_primary_shards' => 5,\n 'active_shards' => 5,\n 'relocating_shards' => 0,\n 'initializing_shards' => 0,\n 'unassigned_shards' => 5,\n 'delayed_unassigned_shards' => 0,\n 'number_of_pending_tasks' => 0,\n 'number_of_in_flight_fetch' => 0,\n 'task_max_waiting_in_queue_millis' => 0,\n 'active_shards_percent_as_number' => 50.0,\n ];\n $client = $this->createElasticClient($response, 200);\n $instance = $this->createInstance($client);\n\n $result = $instance->getHealth();\n\n self::assertSame('testcluster', $result->getName());\n self::assertSame('yellow', $result->getStatus());\n self::assertFalse($result->hasTimedOut());\n self::assertSame(1, $result->getNumberOfNodes());\n self::assertSame(1, $result->getNumberOfDataNodes());\n self::assertSame(5, $result->getNumberOfActivePrimaryShards());\n self::assertSame(5, $result->getNumberOfActiveShards());\n self::assertSame(0, $result->getNumberOfRelocatingShards());\n self::assertSame(0, $result->getNumberOfInitializingShards());\n self::assertSame(5, $result->getNumberOfUnassignedShards());\n self::assertSame(0, $result->getNumberOfDelayedUnassignedShards());\n self::assertSame(0, $result->getNumberOfPendingTasks());\n self::assertSame(0, $result->getNumberOfInFlightFetch());\n self::assertSame(0, $result->getTaskMaxWaitingInQueueMillis());\n self::assertSame(50, $result->getActiveShardsPercent());\n }",
"public function testWorkerHealth(): void {\n $worker = new \\Bees\\Entity\\Bee\\Worker(100);\n $this->assertEquals(75, $worker->getHealth());\n }",
"public function testApiHealthLivenessGet()\n {\n }",
"abstract public function checkHealth();",
"public function checkHealth()\n {\n // TODO: Implement isHealthy() method.\n }",
"public function testApiHealthReadinessGet()\n {\n }",
"public function testHealthPath() {\n $request = Request::create('/health');\n $bad_request = Request::create('/user');\n\n $plugin = new HealthCheck();\n static::assertTrue(\n $plugin->match($request),\n '/health path triggers plugin'\n );\n\n static::assertFalse(\n $plugin->match($bad_request),\n 'non /user path does not trigger plugin.'\n );\n\n $exception = new SuccessHTTPException('Everything is awesome');\n $this->expectExceptionObject($exception);\n $plugin->run($request, 'path', 'path');\n }",
"public function testOrgApacheSlingHcCoreImplCompositeHealthCheck() {\n\n }",
"public function testPing()\n {\n }",
"public function testStatus()\n {\n }",
"public function check(): HealthState;",
"public function testComAdobeCqSecurityHcPackagesImplExampleContentHealthCheck() {\n\n }",
"public function testGetBasicStatistics()\n {\n }",
"public function testBasicExample()\n\t{\n\n\t}",
"public function testStress()\n {\n $this->say('This project has no stress tests; this is a demonstration task');\n }",
"public function testUserPing()\n {\n }",
"public function testHeartbeat()\n {\n\n }",
"public function fakeHealthGet()\n {\n list($response) = $this->fakeHealthGetWithHttpInfo();\n return $response;\n }",
"public function testBuildHealthCheck()\n {\n $config = new SinglePayConfig();\n $config->setServiceConfig(self::$testConfig);\n\n $healthCheck = ExpressFactory::buildHealthCheck($config);\n $this->assertInstanceOf('\\SinglePay\\PaymentService\\Element\\Express\\Method\\HealthCheck', $healthCheck);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns Array of members AllTeamMembers
|
public function getAllMembers(){
//Base ya ha sido creada al haber hecho include
//Lo primero que hace es traer toda la tabla de la base de datos.
$sql = "SELECT * FROM TEAM";
$conexion = $this->base->prepare($sql);
//Ahora tengo un array de elementos asociativos
//AQUI TENGO EL ARRAY
$conexion->execute();
//Ahora tengo un array de elementos asociativos
$this->AllTeamMembers = $conexion->fetchAll(\PDO::FETCH_ASSOC);
return $this->AllTeamMembers;
}
|
[
"public function getTeamMembers(): array;",
"public function getTeamMembers(): array\n {\n return $this->teamMembers;\n }",
"protected function getTeamMembers()\n {\n try\n {\n //-- sql with team members\n $sql = 'SELECT id, first_name, last_name FROM team_members';\n\n //-- return array with members\n return $this->db()->fetchAll($sql);\n }\n catch(\\Exception $ex)\n {\n throw $ex;\n }\n }",
"public function team_all_members() {\n \n // Loads the team's members\n (new MidrubBaseUserComponentsCollectionTeamHelpers\\Team)->team_all_members();\n \n }",
"public function teamMembers()\n {\n return $this->request('get', '/api/teams/'.Helpers::config('team').'/members');\n }",
"public function getMembers() : array\n {\n return userRepository()->getUsersByTaskId($this->taskId);\n }",
"public function getMembers()\n {\n return gameToMember::getMembers($this->id);\n }",
"public function getAllMembers() {\n $members = $this->members;\n $members[] = $this->ownerName;\n return $members;\n }",
"public function getMembers()\n {\n return $this->members->toArray();\n }",
"public function getListMembers() {\n\t\t$result = array();\n\t\tswitch ($this->getMemberType()) {\n\t\t\tcase MemberType::ACCOUNT:\n\t\t\t\t$result = $this->getAccounts()->toArray();\n\t\t\t\tbreak;\n\t\t\tcase MemberType::CONTACT:\n\t\t\t\t$result = $this->getContacts()->toArray();\n\t\t\t\tbreak;\n\t\t\tcase MemberType::LEAD;\n\t\t\t\t$result = $this->getLeads()->toArray();\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $result;\n\t}",
"public function getAllMembers() {\n return Member::all();\n }",
"public function getMembers(): array\n {\n return array_map(function ($member) {\n return new User($this->client, $member);\n }, $this->thread->getMembers());\n }",
"public function team_all_members() {\n \n // Get page's input\n $page = $this->CI->input->get('page');\n \n // Set the limit\n $limit = 10;\n $page--;\n \n // Count number of members\n $total = $this->CI->base_teams->get_members($this->CI->user_id);\n \n // Get members\n $get_members = $this->CI->base_teams->get_members( $this->CI->user_id, $page * $limit, $limit );\n \n // If members exists\n if ( $get_members ) {\n\n // Members ids array\n $member_ids = array();\n\n // List all members\n foreach ( $get_members as $member ) {\n \n // Add member's ID to array\n $member_ids[] = $member['member_id'];\n \n }\n \n // Members meta array\n $members_meta = array();\n\n // Get members meta\n $get_metas = $this->CI->base_model->get_data_where('teams_meta', '*',\n array(),\n array('member_id', $member_ids));\n\n // Verify if metas exists\n if ( $get_metas ) {\n\n // List all metas\n foreach ( $get_metas as $meta ) {\n\n // Verify if meta_name is first_name or last_name\n if ( ($meta['meta_name'] === 'first_name') || ($meta['meta_name'] === 'last_name') ) {\n\n // Verify if member's id exists\n if ( isset($members_meta[$meta['member_id']]) ) {\n\n // Set last name\n $members_meta[$meta['member_id']] = $members_meta[$meta['member_id']] . ' ' . $meta['meta_value'];\n\n } else {\n\n // Set first name\n $members_meta[$meta['member_id']] = $meta['meta_value'];\n\n }\n\n }\n\n }\n \n }\n \n // Members array\n $members = array();\n \n // List all members\n foreach ( $get_members as $member ) {\n\n // Set username\n $username = $member['member_username'];\n \n // Verify if user has first and last name\n if ( isset($members_meta[$member['member_id']]) ) {\n\n // Set first and last name\n $username = $members_meta[$member['member_id']];\n \n }\n\n // Add member to array\n $members[] = array(\n 'member_id' => $member['member_id'],\n 'username' => $username,\n 'status' => $member['status'],\n 'role' => $member['role'],\n 'picture' => '//gravatar.com/avatar/' . md5($member['member_email']) . '?s=200',\n 'date_joined' => strtotime($member['date_joined']),\n 'last_access' => strtotime($member['last_access'])\n );\n \n }\n \n // Prepare the success response\n $data = array(\n 'success' => TRUE,\n 'total' => $total,\n 'members' => $members,\n 'page' => ($page + 1),\n 'time' => time(),\n 'words' => array(\n 'never' => $this->CI->lang->line( 'never' ),\n 'active' => $this->CI->lang->line( 'active' ),\n 'inactive' => $this->CI->lang->line( 'inactive' ),\n 'status' => $this->CI->lang->line( 'status' ),\n 'results' => $this->CI->lang->line( 'results' ),\n 'of' => $this->CI->lang->line( 'of' )\n )\n );\n \n // Display the success response\n echo json_encode($data);\n \n } else {\n\n // Prepare the error message\n $data = array(\n 'success' => FALSE,\n 'message' => $this->CI->lang->line( 'no_members_found' )\n );\n\n // Display the error message\n echo json_encode($data); \n\n }\n \n }",
"public function getTeamMembers()\n {\n return $this->hasMany(self::di('TeamMember'), ['speciality_id' => 'id']);\n }",
"public function GetGroupMembers() {\n $fgcGetGroupName = file_get_contents(\"https://steamcommunity.com/gid/\" . $this->gid . \"/memberslistxml?xml=1\");\n $oGetGroupName = simplexml_load_string($fgcGetGroupName, null, LIBXML_NOCDATA);\n\n $aMembers = array();\n foreach ($oGetGroupName->members->steamID64 as $oMember) {\n array_push($aMembers, new \\justinback\\steam\\player($this->key, $this->game, current($oMember)));\n }\n\n\n return $aMembers;\n }",
"public function members()\n {\n return $this->hasManyThrough(\n User::class,\n TeamMember::class,\n 'team_id',\n 'id',\n 'id',\n 'user_id'\n );\n }",
"private function get_team_members(){\n\n\t\t$cats = explode(',', $this->show_groups);\n\t\t$cat_list = '';\n\t\tforeach( $cats as $cat ){\n\t\t\tif( get_cat_ID( $cat ) != 0 ) $cat_list .= get_cat_ID( $cat ).\",\";\n\t\t}\n\n\t\t$args = array(\n\t\t\t'post_type' \t=> \t'team_members',\n\t\t\t'posts_per_page' \t=> \t-1,\n\t\t\t'orderby' \t=> \t'menu_order',\n\t\t\t'order' \t=> \t'ASC',\n\t\t\t'category'\t\t\t=> \t$cat_list,\n\t\t\t//'post_status' \t=> \t'publish'\n\t\t);\n\n\t\t$team_members = get_posts( $args );\n\n\t\treturn $team_members;\n\n\t}",
"public function getTeamUids(): array;",
"public function listMembers(){\n\n global $connection;\n\n $sql = \"SELECT * FROM organisationmembers WHERE orgid=?\";\n\n $stmt = $connection->stmt_init();\n\n $stmt->prepare($sql);\n\n $oI = $this->obj->orgid;\n\n $stmt->bind_param(\"s\",$oI);\n\n $stmt->execute();\n\n $a = Array();\n\n $r = $stmt->get_result();\n\n if($r->num_rows == 0){\n\n return $a;\n\n } else {\n\n while($row = $r->fetch_assoc()){\n array_push($a,$row['userid']);\n }\n\n return $a;\n\n }\n\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Render fields that are needed when 'image' is selected as a watermark source
|
function _render_watermark_image_fields()
{
$message = __('An absolute or relative (to the site document root) file system path', 'nggallery');
if (ini_get('allow_url_fopen')) {
$message = __('An absolute or relative (to the site document root) file system path or an HTTP url', 'nggallery');
}
return $this->object->render_partial('photocrati-nextgen_other_options#watermark_image_fields', array('image_url_label' => __('Image URL:', 'nggallery'), 'watermark_image_url' => $this->object->get_model()->wmPath, 'watermark_image_text' => $message), TRUE);
}
|
[
"function _filter_edit_form_advanced() {\r\n\t\t\t\r\n\t\t\tglobal $post;\r\n\r\n\t\t\t// Let's have a look if this post has an image attached\r\n\t\t\t// If yes: Assign the image to the template\r\n\t\t\tif (isset($post->ID)) {\r\n\t\t\t\tif (!is_null($image = YapbImage::getInstanceFromDb($post->ID))) {\r\n\t\t\t\t\t$this->tpl->assign('image', $image);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$this->tpl->assign('content', $this->tpl->fetch('edit_form_advanced_field_fileupload.tpl.php'));\r\n\t\t\t$this->tpl->display('edit_form_advanced_javascript_injection.tpl.php');\r\n\r\n\t\t}",
"function theme_imagefield_formatter_image_plain($element) {\r\n // Inside a view $element may contain null data. In that case, just return.\r\n if (empty($element['#item']['fid'])) {\r\n return '';\r\n }\r\n\r\n $field = content_fields($element['#field_name']);\r\n $item = $element['#item'];\r\n\r\n $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';\r\n $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;\r\n\r\n $class = 'imagefield imagefield-'. $field['field_name'];\r\n return theme('imagefield_image', $item, $item['data']['alt'], $item['data']['title'], array('class' => $class));\r\n}",
"function qw_field_image_attachment_form( $field ) {\n\t//$image_styles = _qw_get_image_styles();\n\t$image_styles = get_intermediate_image_sizes();\n\t$featured_image = ( isset( $field['values']['featured_image'] ) ) ? 'checked=\"checked\"' : \"\";\n\t?>\n\t<!-- image display -->\n\t<label class=\"qw-label\">Number of items to show:</label>\n\t<input class=\"qw-text-short\"\n\t type=\"text\"\n\t name='<?php print $field['form_prefix']; ?>[image_display_count]'\n\t value=\"<?php print ( isset( $field['values']['image_display_count'] ) ) ? $field['values']['image_display_count'] : 0;?>\"/>\n\t<p>\n\t\t<label>\n\t\t\t<input\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tname=\"<?php print $field['form_prefix']; ?>[featured_image]\"\n\t\t\t\t<?php print $featured_image; ?> /> Featured Image Only\n\t\t</label>\n\t</p>\n\t<p>\n\t\t<label class=\"qw-label\">Image Display Style:</label>\n\t\t<select class='qw-js-title'\n\t\t name='<?php print $field['form_prefix']; ?>[image_display_style]'>\n\t\t\t<?php\n\t\t\tforeach ( $image_styles as $key => $style ) {\n\t\t\t\t$style_selected = ( $field['values']['image_display_style'] == $style ) ? 'selected=\"selected\"' : '';\n\t\t\t\t?>\n\t\t\t\t<option\n\t\t\t\t\tvalue=\"<?php print $style; ?>\" <?php print $style_selected; ?>><?php print $style; ?></option>\n\t\t\t<?php\n\t\t\t}\n\t\t\t?>\n\t\t</select>\n\t</p>\n<?php\n}",
"public function render_image_template() {\n\t\t?>\n\t\t<script type=\"text/template\" id=\"tmpl-papi-property-image\">\n\t\t\t<a class=\"check\" href=\"#\">X</a>\n\t\t\t<div class=\"attachment-preview\">\n\t\t\t\t<div class=\"thumbnail\">\n\t\t\t\t\t<div class=\"centered\">\n\t\t\t\t\t\t<img src=\"<%= image %>\"/>\n\t\t\t\t\t\t<input type=\"hidden\" value=\"<%= id %>\" name=\"<%= slug %>\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</script>\n\t\t<?php\n\t}",
"public function field_preview( $field ) {}",
"public function getImageUrlField();",
"abstract public function drawImageWatermark(ImageWatermark $watermark);",
"public static function watermark() {\n /**\n * @var EventgalleryLibraryFactoryWatermark $watermarkFactory\n */\n $watermarkFactory = EventgalleryLibraryFactoryWatermark::getInstance();\n\n $watermarks = $watermarkFactory->getWatermarks(false);\n\n $return = '<label id=\"batch-watermark-lbl\" for=\"batch-watermark\" class=\"hasToolip\"'\n . 'title=\"' . JHtml::tooltipText('COM_EVENTGALLERY_BATCH_WATERMARK_LABEL', 'COM_EVENTGALLERY_BATCH_WATERMARK_DESC') . '\">'\n . JText::_('COM_EVENTGALLERY_BATCH_WATERMARK_LABEL')\n . '</label>';\n\n $return .= '<select name=\"batch[watermark]\" id=\"batch-watermark\" class=\"inputbox\">';\n $return .= '<option value=\"\">'.JText::_('COM_EVENTGALLERY_BATCH_WATERMARK_KEEP').'</option>';\n $return .= '<option value=\"-1\">'.JText::_('COM_EVENTGALLERY_WATERMARK_NONE').'</option>';\n\n foreach($watermarks as $watermark) {\n /**\n * @var EventgalleryLibraryWatermark $watermark\n */\n\n $return .= '<option value=\"'.$watermark->getId().'\">'.$watermark->getName().'</option>';\n }\n $return .= \"</select>\";\n\t\treturn $return;\n\n\t}",
"function toccmap_create_image_control($name, $label)\n{\n $imageSettings = array();\n \n // If there is already an uploaded image display the image here\n $fid = variable_get($name, FALSE);\n \n if ($fid !== FALSE && $image = file_load($fid)) {\n $imageSettings[$name . '_open'] = array(\n '#markup' => sprintf(\n '<div class=\"clearfix\"><p style=\"float: left; margin-right: 10px;\">%s</p>',\n theme(\n 'image_style',\n array(\n 'style_name' => 'thumbnail',\n 'path' => $image->uri,\n 'getsize' => FALSE\n )\n )\n )\n );\n }\n \n $imageSettings[$name] = array(\n '#type' => 'managed_file',\n '#title' => $label,\n '#description' => 'The main map image to be used as a base.',\n '#default_value' => variable_get($name, NULL),\n '#upload_location' => 'public://'\n );\n \n if ($fid !== FALSE) {\n $imageSettings[$name . '_close'] = array(\n '#markup' => '</div>'\n );\n }\n \n return $imageSettings;\n}",
"function inter_attachment_fields( $fields, $post ) {\n $attribution_value = get_post_meta($post->ID, '_attribution', true);\n $fields['attribution'] = array(\n 'label' => __( 'Attribution' ),\n 'input' => 'text',\n 'value' => $attribution_value,\n 'show_in_edit' => true\n );\n return $fields; \n }",
"function dingo_acf_render_image( $field, $class = null ) {\n if( empty( $field ) ) { return null; }\n \n $url = $field[ 'url' ];\n $alt = $field[ 'alt' ];\n $target = $field[ 'target' ];\n return \"<img src='$url' alt='$alt' target='$target' class='$class' />\";\n}",
"function wpbucket_redux_select_image_field( $field ) {\n return WPBUCKET_THEME_DIR . '/core/theme-options/custom-fields/select_image/field_select_image.php';\n}",
"public function watermark()\n {\n $this->imageCreator->watermark();\n }",
"function image_pornographic_detect_field_widget_form_alter(&$element, &$form_state, $context) {\n // Add display_field setting to field because file_field_widget_form() assumes it is set.\n $instance = $context['instance'];\n $settings = $instance['settings'];\n $field = $context['field'];\n if (isset($settings['image_pornographic_detect']) && $field['type'] == 'image' && $settings['image_pornographic_detect']) {\n foreach (element_children($element) as $delta) {\n // Add upload validator to each image.\n $element[$delta]['#upload_validators'] = array('image_pornographic_detect_image_validate' => array($element));\n }\n }\n}",
"function ninesixtytwain_colorbox_imagefield($variables) \n{\n $class = array('colorbox');\n\n if ($variables['image']['style_name'] == 'hide') \n {\n $image = '';\n $class[] = 'js-hide';\n }\n elseif (!empty($variables['image']['style_name'])) \n {\n $image = theme('image_style', $variables['image']);\n }\n else \n {\n $image = theme('image', $variables['image']);\n }\n\n $options = array(\n 'html' => TRUE,\n 'attributes' => array(\n 'title' => $variables['title'],\n 'class' => $class,\n 'rel' => $variables['gid'],\n )\n );\n\n return l($image, $variables['path'], $options);\n}",
"public function tableImage($bundle) {\n $fields = array();\n foreach (field_info_instances('asset', $bundle) as $field_name => $instance) {\n $field = field_info_field($field_name);\n\n // If the entity has an imagefield, show it.\n if ($field['type'] == 'image') {\n // Determine the correct image style to use.\n $image_style = 'thumbnail';\n if (!empty($instance['widget']['settings']['preview_image_style'])) {\n $image_style = $instance['widget']['settings']['preview_image_style'];\n }\n\n $fields[$field_name] = array(\n 'type' => 'field',\n 'label' => $instance['label'],\n 'formatter' => 'image',\n 'settings' => array('image_style' => $image_style),\n 'delta' => 0,\n 'weight' => -10,\n );\n // Don't add any other imagefields. One is enough.\n break;\n }\n\n if ($field['type'] == 'video_embed_field'){\n // Determine the correct image style to use.\n $image_style = 'thumbnail';\n if (!empty($instance['widget']['settings']['preview_image_style'])) {\n $image_style = $instance['widget']['settings']['preview_image_style'];\n }\n\n $fields[$field_name] = array(\n 'type' => 'field',\n 'label' => $instance['label'],\n 'formatter' => 'video_embed_field_thumbnail',\n 'settings' => array('image_style' => $image_style),\n 'delta' => 0,\n 'weight' => -10,\n );\n // Don't add any other imagefields. One is enough.\n break;\n }\n\n if ($field['type'] == 'file'){\n $fields[$field_name] = array(\n 'type' => 'field',\n 'label' => $instance['label'],\n 'formatter' => 'file_default',\n // 'settings' => array('image_style' => $image_style),\n 'delta' => 0,\n 'weight' => -10,\n );\n // Don't add any other imagefields. One is enough.\n break;\n }\n\n // If the entity has a entityreference that contains an image field.\n if ($field['type'] == 'entityreference'){\n if($targets = asset_entityreference_contains($field, 'image')){\n foreach($targets as $key => $target){\n // Determine the correct image style to use.\n $image_style = 'thumbnail';\n if (!empty($target_instance['widget']['settings']['preview_image_style'])) {\n $image_style = $target_instance['widget']['settings']['preview_image_style'];\n }\n $fields[$field_name] = array(\n 'type' => 'field',\n 'label' => $instance['label'],\n 'formatter' => 'asset_image',\n 'settings' => array('field_name' => $key, 'image_style' => $image_style),\n 'delta' => 0,\n 'weight' => -10,\n );\n break;\n }\n }\n }\n }\n return $fields;\n }",
"function _wysiwyg_imageupload_details_form($img, $iid, $defaults = array()) {\n $form = array();\n\n $form['image_upload_details'] = array(\n '#type' => 'fieldset',\n '#title' => t('Image details'),\n '#prefix' => '<div id=\"image_details\">',\n '#suffix' => '</div>'\n );\n // Title\n $form['image_upload_details']['title'] = array(\n '#type' => 'textfield',\n '#title' => t('Title'),\n '#default_value' => $defaults['title'],\n '#size' => 50\n );\n // Alignment / Floating\n $m = drupal_get_path('module','wysiwyg_imageupload');\n $form['image_upload_details']['alignment'] = array(\n '#type' => 'select',\n '#title' => t('Image alignment'),\n '#options' => array(\n 'imgupl_floating_left' => theme('image',\"$m/images/left_float.png\", $t = t('Image on left, text on right'), $t),\n 'imgupl_floating_none' => theme('image',\"$m/images/none_float.png\", $t = t('Image is inline with the text (none)'), $t),\n 'imgupl_floating_right' => theme('image',\"$m/images/right_float.png\", $t = t('Image on right, text on left'), $t), \n ),\n '#default_value' => $defaults['alignment'],\n '#after_build' => array('drupalwiki_imageselect_element_register'),\n );\n // Imagecache preset\n $form['image_upload_details']['imagecache'] = array(\n '#type' => 'select',\n '#title' => t('Size'),\n '#default_value' => $defaults['imagecache'],\n '#options' => _wysiwyg_imagegupload_allowed_presets(),\n );\n\n // We group all those extras into this fieldset to hide them from the general UI.\n $form['image_upload_details']['extras'] = array(\n '#type' => 'fieldset',\n '#title' => t('Extras'),\n '#collapsed' => TRUE,\n '#collapsible' => TRUE,\n );\n\n // image styles.\n $styles = _wysiwyg_imageupload_get_image_styles();\n if (count($styles) > 0) {\n array_unshift($styles, t('None'));\n $form['image_upload_details']['extras']['style'] = array(\n '#type' => 'select',\n '#title' => t('Style'),\n '#options' => $styles,\n '#default_value' => $defaults['style'],\n );\n }\n\n // this is the container for our preview-image\n $form['image_details_form']['preview'] = array(\n '#type' => 'fieldset',\n '#title' => t('Preview'),\n '#attributes' => array('id' => 'image_preview'),\n '#collapsible' => false\n );\n $form['image_details_form']['preview'] ['uploadedImage'] = array(\n '#prefix' => '<div >',\n '#suffix' => '</div>',\n '#value' => $img\n );\n\n // This is a fake submit button, thats why \"access false\" is used.\n // This is due we use ajax form submit.\n $form['image_details_form']['buttons']['submitimagedetails'] = array(\n '#type' => 'submit',\n '#value' => 'JSinsert', // t() not needed here, see comment below.\n '#access' => FALSE,\n );\n\n $form['image_upload_details']['iid'] = array(\n '#type' => 'value',\n '#value' => $iid,\n '#default_value' => $iid\n );\n return $form;\n}",
"public function addWatermark()\n {\n\t\t//creates the text over the background image\n\t\timagettftext($this->img, $this->fontSize, 0, $this->startPosition[\"x\"], $this->startPosition[\"y\"], $this->textColor, $this->fontFile, $this->text);\n }",
"function image_field_widget_process($element, &$form_state, $form) {\n $item = $element['#value'];\n $item['fid'] = $element['fid']['#value'];\n\n $instance = field_widget_instance($element, $form_state);\n\n $settings = $instance['settings'];\n $widget_settings = $instance['widget']['settings'];\n\n $element['#theme'] = 'image_widget';\n $element['#attached']['css'][] = drupal_get_path('module', 'image') . '/image.css';\n\n // Add the image preview.\n if ($element['#file'] && $widget_settings['preview_image_style']) {\n $variables = array(\n 'style_name' => $widget_settings['preview_image_style'],\n 'path' => $element['#file']->uri,\n );\n\n // Determine image dimensions.\n if (isset($element['#value']['width']) && isset($element['#value']['height'])) {\n $variables['width'] = $element['#value']['width'];\n $variables['height'] = $element['#value']['height'];\n }\n else {\n $info = image_get_info($element['#file']->uri);\n\n if (is_array($info)) {\n $variables['width'] = $info['width'];\n $variables['height'] = $info['height'];\n }\n else {\n $variables['width'] = $variables['height'] = NULL;\n }\n }\n\n $element['preview'] = array(\n '#type' => 'markup',\n '#markup' => theme('image_style', $variables),\n );\n\n // Store the dimensions in the form so the file doesn't have to be accessed\n // again. This is important for remote files.\n $element['width'] = array(\n '#type' => 'hidden',\n '#value' => $variables['width'],\n );\n $element['height'] = array(\n '#type' => 'hidden',\n '#value' => $variables['height'],\n );\n }\n\n // Add the additional alt and title fields.\n $element['alt'] = array(\n '#title' => t('Alternate text'),\n '#type' => 'textfield',\n '#default_value' => isset($item['alt']) ? $item['alt'] : '',\n '#description' => t('This text will be used by screen readers, search engines, or when the image cannot be loaded.'),\n // @see http://www.gawds.org/show.php?contentid=28\n '#maxlength' => 512,\n '#weight' => -2,\n '#access' => (bool) $item['fid'] && $settings['alt_field'],\n );\n $element['title'] = array(\n '#type' => 'textfield',\n '#title' => t('Title'),\n '#default_value' => isset($item['title']) ? $item['title'] : '',\n '#description' => t('The title is used as a tool tip when the user hovers the mouse over the image.'),\n '#maxlength' => 1024,\n '#weight' => -1,\n '#access' => (bool) $item['fid'] && $settings['title_field'],\n );\n\n return $element;\n}",
"function wpcf_fields_image_view_filter( $output, $value, $type, $slug, $name,\n $params ) {\n\n global $wpcf;\n\n if ( $type == 'image' ) {\n // If 'url' param is used, force return un-wrapped\n if ( isset( $params['url'] ) && $params['url'] != 'false' ) {\n $cache_key = md5( serialize( $params ) );\n if ( isset( $wpcf->__images_wrap_fix[$cache_key] ) ) {\n $output = $wpcf->__images_wrap_fix[$cache_key];\n }\n }\n }\n\n return $output;\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Raise the before queue sportevent event.
|
protected function raiseBeforesporteventEvent(sportevent $sportevent)
{
if ($this->container->bound('events')) {
$this->container['events']->dispatch(new sporteventProcessing($this->connectionName, $sportevent));
}
}
|
[
"public function beforeEvent(Event $event) {}",
"public function beforeRun() {\n if (isset($this->_behaviours[\"beforeRun\"]) && !empty($this->_behaviours[\"beforeRun\"])) {\n $this->_behaviours[\"beforeRun\"]($this->startTime);\n }\n }",
"public function handlePrePollEvent()\n\t{\n\n\t}",
"protected function raiseBeforeEvent(Job $job)\n {\n $this->events->dispatch(new JobProcessing($this->options->connectionName, $job));\n }",
"public function queueEvent($event);",
"public function queue() {\n \t\t$view_root = BLW_PSP_FacesContext::instance()->getViewRoot();\n \t\t$view_root->queueEvent($this);\n \t}",
"public function before()\n\t{\n\t\tHook::do_action($this->hook.'_before',$this->request->param());\n\t}",
"public function beforeRun()\n {\n $this->trigger(self::EVENT_BEFORE_RUN);\n }",
"public function testOnBeforeSend()\n {\n $this->event\n ->expects($this->once())\n ->method('offsetGet')\n ->with('request')\n ->will($this->returnValue($this->request))\n ;\n\n $this->request\n ->expects($this->once())\n ->method('getQuery')\n ->will($this->returnValue($this->query))\n ;\n\n $this->query\n ->expects($this->once())\n ->method('set')\n ->with('api_key', 'testkey')\n ;\n\n $this->plugin->onBeforeSend($this->event);\n }",
"public function onBeforeLock($event) {\n\t\t$this->raiseEvent(\"onBeforeLock\",$event);\n\t}",
"public function beforeRequest()\n\t{\n\t\t$this->trigger('beforeRequest');\n\t}",
"private function enqueue(Event $event): void\n {\n if ($event->isLooped()) {\n $this->log('[!] Loop found, enqueue aborted for ' . $event);\n return;\n }\n\n $this->queue[] = $event;\n\n $this->log('Queued ' . $event . ', queue size = ' . count($this->queue));\n }",
"public function executeNotifyPreDispatch()\r\n {\r\n $this->_controller->preDispatch();\r\n }",
"public function onBeforeLock ($event) {\n $this->_connection->trigger (\"onBeforeLock\" , $event);\n }",
"protected function raiseBeforeActionEvent(Actionable $action): void\n {\n $this->dispatchEvent('before', $action);\n }",
"protected function raiseBeforeJobEvent( Job $job )\n\t{\n\t\t$data = json_decode( $job->getRawBody(), true );\n\n\t\tHooks::trigger( 'queue.job.processing', compact( 'job', 'data' ) );\n\t}",
"protected function beforeSendingThroughPipeline(): void\n {\n $this->events->dispatch('orchestra.started: admin');\n $this->events->dispatch('orchestra.ready: admin');\n }",
"public function beforeDeliver() {\n \n }",
"protected function raiseBeforeJobEvent($job)\n {\n $this->events->dispatch(new JobProcessing(\n ApplicationEndConnector::CONNECTION_NAME, $job\n ));\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
createFile() creates new file in subdir
|
public function createFile_creates_new_file_in_subdir()
{
$this->_fileSystem->createFile(vfsStream::url('testDir/subDir/three.html'), 'some content');
$this->assertTrue(vfsStreamWrapper::getroot()->getChild('subDir')->hasChild('three.html'));
}
|
[
"public function createFile($path);",
"abstract public function create( $file = '' );",
"public static function createFile($path, $name);",
"protected function createDirectory() {}",
"private function createFile()\n {\n if(!is_dir(dirname($this->testPath))) {\n mkdir(dirname($this->testPath), 0755, true);\n }\n\n if (!file_exists($this->testPath)) {\n $this->testFile = fopen($this->testPath, 'aw+');\n\n $tpClass = file_get_contents(__DIR__ . '/tpl/TestClass.tpl');\n\n $init = str_replace('{name}', $this->testName, $tpClass);\n fwrite($this->testFile, $init);\n }\n }",
"public function createFile() {\n Utils::echoDebug(\"Create file: \" . $this->file_name);\n $handle = fopen($this->file_name, \"w+\");\n fclose($handle);\n }",
"public function create_new_file()\n {\n @unlink($this->path);\n\n $file = $this->createFileRecord($this->path, 'my file.');\n\n Disk::write($file);\n\n $this->assertFileExists($this->path, \"Failed to create file at [$this->path]\");\n\n $this->assertTrue(Disk::match($file), \"Failed to assert [$file->path] contains [$file->content]\");\n }",
"function _create_directory()\n {\n// echo \"path of file to be saved\";\n// debug($this->file_write_path);\n if (!is_dir($this->file_write_path)) {\n mkdir($this->file_write_path, 0705, true);\n }\n }",
"public static function make_file() {\n\t\t$file = static::get_tmp_dir(data::random_string(5));\n\t\twhile (file_exists($file)) {\n\t\t\t$file = static::get_tmp_dir(data::random_string(5));\n\t\t}\n\n\t\t// Actually make it.\n\t\ttouch($file);\n\t\tchmod($file, 0644);\n\t\treturn $file;\n\t}",
"public function create($folder);",
"function io_makeFileDir($file){\n global $messageStack;\n global $bmzConf;\n\n $dir = dirname($file);\n $dmask = $bmzConf['dmask'];\n umask($dmask);\n if(!is_dir($dir)){\n io_mkdir_p($dir) || $messageStack->add(\"Creating directory $dir failed\", \"error\");\n }\n umask($bmzConf['umask']); \n}",
"public function actionTestfilecreate() {\n $patDocuments = \\common\\models\\PatDocuments::find()->all();\n foreach ($patDocuments as $patDocument) {\n $fpath = \"uploads/{$patDocument->tenant_id}/{$patDocument->patient->patient_global_int_code}\";\n \\yii\\helpers\\FileHelper::createDirectory($fpath, 0755);\n $file_name = \"CH_{$patDocument->encounter_id}.xml\";\n $path = \\yii::getAlias('@webroot') . '/' . $fpath . '/' . $file_name;\n\n $myfile = fopen($path, \"w\") or die(\"Unable to open file!\");\n fwrite($myfile, $patDocument->document_xml);\n fclose($myfile);\n chmod($path, 0644);\n\n $patDocument->xml_path = $fpath . '/' . $file_name;\n $patDocument->save(false);\n }\n return true;\n }",
"public function create(string $directory, array $subDirectories = []);",
"public /*void*/ function create(/*binary*/$initialContent=null, /*bool*/$createParentDirectory=false) /*throws FileException*/\r\n\t{\r\n\t\tif($this->exists)\r\n\t\t\tthrow new FileAlreadyExistsException;\r\n\r\n\t\tif(substr($this->path, -1, 1) == '/') {\r\n\t\t\t$this->createDirectory($createParentDirectory);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(!$this->parent->exists) {\r\n\t\t\tif($createParentDirectory === true)\r\n\t\t\t\t$this->parent->createDirectory(true);\r\n\t\t\telse\r\n\t\t\t\tthrow new FileDoesNotExistException;\r\n\t\t}\r\n\r\n\t\t$this->put($initialContent, false);\r\n\t}",
"public function createFileWithContents($parentFolderPath, $fileName, $fileContents);",
"public function createFiles()\r\n\t{\r\n\t\t// TODO: Create function, if necessary.\r\n\t}",
"function io_makeFileDir($file){\n $dir = dirname($file);\n if(!@is_dir($dir)){\n io_mkdir_p($dir) || msg(\"Creating directory $dir failed\",-1);\n }\n}",
"public function testCreatingFile(): void {\r\n\r\n $this -> assertFalse($this -> file -> isReadable());\r\n $this -> assertFalse($this -> file -> isWritable());\r\n $this -> assertFalse($this -> file -> exists());\r\n\r\n $this -> file -> create();\r\n $this -> file -> setOwner('administrator');\r\n $this -> file -> setGroupId(1000);\r\n\r\n $this -> assertTrue($this -> file -> isReadable());\r\n $this -> assertTrue($this -> file -> isWritable());\r\n $this -> assertTrue($this -> file -> exists());\r\n\r\n $this -> file -> delete();\r\n }",
"private function creacionArchivo() {\r\n\t\t\tif(count($this->namespace) > 2):\r\n\t\t\t\tif(is_dir(dirname($this->archivo)) == false):\r\n\t\t\t\t\tmkdir(dirname($this->archivo), 0777, true);\r\n\t\t\t\tendif;\r\n\t\t\tendif;\r\n\t\t\ttouch($this->archivo);\r\n\t\t\t$fopen = fopen($this->archivo, 'w');\r\n\t\t\tfwrite($fopen, $this->plantillaPHP());\r\n\t\t\tfclose($fopen);\r\n\t\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Draw the tiny little calendar in the top right corner
|
public function drawCalendar($date=null, $x=100, $y=null, $w=35, $h=28) {
if($date===null)
$date=time();
if($y)
$this->SetY($y);
$firstDay = strtotime(date('Y-m-01', $date));
$lastDay = strtotime(date('Y-m-t', $date));
$this->SetFont(null,'',7);
$this->SetLeftMargin($x);
$this->Cell($w,$h/8, $this->months_long[date('n',$date)].date(' Y', $date),0,1, 'C');
for($d=0;$d<7;$d++) {
$this->Cell($w/7,$h/8,$this->days_short[$d], 0,0,'R');
}
$this->Ln();
$this->Line($this->GetX(), $this->GetY(), $this->GetX()+$w, $this->GetY(),array('width'=>0.1));
$day='';
for($r=0;$r<6;$r++){
for($c=0;$c<7;$c++){ //toggle weekday
if($this->wd(date('N',$firstDay))==$c && $day==='')
$day=1;
$this->Cell($w/7,$h/8,$day, 0,0,'R');
if(!empty($day))
$day++;
if($day>date('d',$lastDay))
$day=null;
}
$this->Ln();
}
$this->SetLeftMargin($this->leftMargin);
}
|
[
"function put_day($d, $font = 0, $color) {\r\r\n\t\t$cur_time = mktime(0, 0, 0, $this->a_selected_date['m'], $d, $this->a_selected_date['y']);\r\r\n\t\t$d = date('j', $cur_time);\r\r\n\t\t$m = date('m', $cur_time);\r\r\n\t\t$y = date('Y', $cur_time);\r\r\n\t\t$ar = $this->events_class->short_item($d, $m, $y);\r\r\n\t\t$cset = $this->events_class->get_cell_settings($d, $m, $y);\r\r\n\t\tif(is_array($ar)) {\r\r\n\t\t\t$cbgc = $cset[0];\r\r\n\t\t\t$cbgi = $cset[1];\r\r\n\t\t\t$calign = $cset[2];\r\r\n\t\t\tforeach($ar as $k=>$v) $ar_v[]=$v->title;\r\r\n\t\t\tif(is_array($ar_v))$str = join($this->a_template['is_show_title']?\"<br>\":\"\\n\", $ar_v);\r\r\n\t\t}\r\r\n\t\t$item_url = $this->events_class->read_item($d, $m, $y, 'url');\r\r\n\t\tif(!$this->is_admin) {\r\r\n\t\t\t\tif(!$this->a_redirect['redirect_url']) $this->a_redirect['redirect_url'] = 'show.php?CLm=%m&CLd=%d&CLy=%y';\r\r\n\t\t\t\tif(!$this->a_redirect['redirect_target']) $this->a_redirect['redirect_target'] = '_blank';\r\r\n\t\t\t\t$u = split('\\?', $this->a_redirect['redirect_url']);\r\r\n\t\t\t\t$l = $u[0];\r\r\n\t\t\t\t$p = $u[1];\r\r\n\t\t\t\tif(!$p)$p = \"CLm=%m&CLd=%d&CLy=%y&c_num=\".$this->s_calendar_index;\r\r\n\t\t\t\t$p = str_replace(array('%d', '%m', '%y'), array($d, $m, $y), $p);\r\r\n\t\t\t\tif ($item_url) {\r\r\n\t\t\t\t\t$cont = $this->put_href(\"<b>$d</b>\", (!stristr($item_url,\"http://\")?\"http://\".$item_url:$item_url), $this->events_class->read_item($d, $m, $y, 'title'), \"\", ' target='.$this->events_class->read_item($d, $m, $y, 'target'), 1, $font);\r\r\n\t\t\t\t}else {\r\r\n\t\t\t\t\t$cont = $str ? $this->put_href(\"<b>$d</b>\".($this->a_template['is_show_title']?\"<br>$str\":''), $l, $str, $p, 'target=\"'.$this->a_redirect['redirect_target'].'\"', 1, $font):\"<span class=\\\"$font\\\">$d</span>\";\r\r\n\t\t\t\t}\r\r\n\t\t}else {\r\r\n\t\t\t$cont = $this->put_href(($str || $item_url ? \"<b>$d</b>\".($this->a_template['is_show_title']?\"<br>$str\":'') : $d), 'index.php', $str ? $str : $this->events_class->read_item($d, $m, $y, 'title'), \"CLm=$m&CLd=$d&CLy=$y&name=\".$this->s_calendar_index.\"&action=e&page=e\", '', 1, $font);\r\r\n\t\t}\r\r\n\t\t$cbgc = $str ? ($cbgc ? $cbgc : $this->a_look['def_event_bgcolor']):'';\r\r\n\t\t$cbgi = $str ? ($cbgi ? $cbgi : $this->a_look['def_event_image']):($this->a_look['def_nonevent_image']?$this->a_look['def_nonevent_image']:'');\r\r\n\t\t$calign = $str ? ($calign ? $calign : $this->a_look['def_event_align']):$this->a_look['def_align'];\r\r\n\t\t$cvalign = $str ? $this->a_look['def_event_valign'] : $this->a_look['def_valign'];\r\r\n\t\treturn \"<td width=\\\"\".$this->a_look['td_width'].\"\\\" height=\\\"\".$this->a_look['td_height'].\"\\\"\".($cvalign?\"valign=\\\"$cvalign\\\"\":'').\" align=\\\"\".($calign? $calign:'center').\"\\\" \".($cbgc?\" bgcolor=\\\"$cbgc\\\"\":\"$color\").\" \".($cbgi?\"background=\\\"$cbgi\\\"\":'').\">\".$cont.\"</td>\";\r\r\n\t}",
"public function drawHTML()\n\t{\n\t\t$this->calWeekDays .= \"<table border=\\\"1\\\">\\n\";\n\t\t$this->makeCalendarTitle();\n\t\t$this->makeCalendarHead();\n\t\t$this->makeDayHeadings();\n\t\t$this->calWeekDays .= \"\\t<tr>\\n\";\n\t\t$this->startMonthSpacers();\n\t\t$this->makeHTMLIterator();\n\t\t$this->endMonthSpacers();\n\t\t$this->calWeekDays .= \"\\t</tr>\\n\";\n\t\t$this->calWeekDays .= \"</table>\\n\";\n\t\t\n\t\techo $this->calWeekDays;\n\t}",
"function draw_calendar($month,$year){\r\n\t/*Naredi koledar*/\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\t\r\n\t$headings = array('Nedelja','Ponedeljek','Torek','Sreda','Cetrtek','Petek','Sobota');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\tif($list_day < 10) {\r\n $list_day = str_pad($list_day, 2, '0', STR_PAD_LEFT);\r\n }\r\n\t\t$month = str_pad($month, 2, '0', STR_PAD_LEFT);\r\n\t\t$event_day = $year.'-'.$month.'-'.$list_day;\r\n\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div name=\"test\" style=\"height:100px; width:120px; overflow: auto; white-space:nowrap\" id=' .$event_day. ' onclick=\"modal(this.id);\">';\r\n\t\t$calendar.= '<div>'.$list_day.'</div>';\t\r\n\t\t$query = \"SELECT CONCAT_WS(' ',s.firstname,s.lastname) as Zaposleni, a.name, aa.aktivnost_id\r\n\t\t\tFROM ost_staff s, ost_agent_aktivnost aa, ost_aktivnosti a\r\n\t\t\tWHERE s.staff_id = aa.staff_id and a.id=aa.aktivnost_id and '$event_day' BETWEEN aa.aktivnost_od AND aa.aktivnost_do AND aa.aktivnost_id > 1 AND aa.aktivnost_id != 9 AND aa.aktivnost_id != 10\";\r\n\t\t\t$result = db_query($query) or die('Ne morem pridobiti rezultata!');\r\n\t\t\twhile($row = db_fetch_array($result)) {\r\n\t\t\t\t$words = explode(' ',$row['Zaposleni']);\r\n\t\t\t\t$calendar .= '<div>'.$words[0][0].'. '.$words[1][0].'. : '.$row['name'].'</div>';\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t$calendar.= '</tr>';\r\n\r\n\t$calendar.= '</table>';\r\n\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\r\n\treturn $calendar;\r\n}",
"function draw_calendar($month,$year,$events = array()){\n\t\n\n\t/* draw table */\n\t\n\t$calendar = '<table cellpadding=\"3\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t$headings = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\n\t/* keep going with days.... */\n for($list_day = 1; $list_day <= $days_in_month; $list_day++):\n $calendar.= '';\n/* add leading zero in the day number */\n if($list_day < 10) {\n $list_day = str_pad($list_day, 2, '0', STR_PAD_LEFT);\n }\n/* add leading zero in the month number */\n if($month < 10) {\n $month = str_pad($month, 2, '0', STR_PAD_LEFT);\n }\n \n $event_day = $year.'-'.$month.'-'.$list_day; \n \n $calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:10px;\">';\n \n \n /* add in the day number */\n $calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\n \n $event_day = $year.'-'.$month.'-'.$list_day;\n \n echo \"<br />\";\n if(isset($events[$event_day])) {\n foreach($events[$event_day] as $event) {\n $calendar.= '<div class=\"event\" style=\"position:absolute;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackground-color: #d80000 ;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttop:10px;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpadding-right: 30px;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpadding-bottom:20px;\n\t\t\t\tpadding-bottom:6px;\">'.$event['id'].'</div>';}\n\t\t\t\t\t \n }\n else {\n $calendar.= str_repeat('<p> </p>',2);\n }\n $calendar.= '</div></td>';\n if($running_day == 6):\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month):\n $calendar.= '<tr class=\"calendar-row\">';\n endif;\n $running_day = -1;\n $days_in_this_week = 0;\n endif;\n $days_in_this_week++; $running_day++; $day_counter++;\n endfor;\n \n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\t\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\n\t/** DEBUG **/\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\n\t\n\t/* all done, return result */\n\techo $calendar;\n\t\n}",
"function draw_calendar($month,$year,$engg_id){\n\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\t\n\t$week_start_date= '';/* VARIABLE CREATED TO STORE WEEK START DATE */\n\t$week_end_date= '';/* VARIABLE CREATED TO STORE WEEK END DATE */ \n\t\n\t/* keep going with days.... */\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t\n\t\t\t$todays_date=date('j-n-Y');\n\t\t\t$current_date='';\n\t\t\t$current_date=$list_day.'-'.$month.'-'.$year;\n\t\t\t\n\t\t\tif ($todays_date==$current_date)\n\t\t\t{\n\t\t\t$calendar.= '<td class=\"calendar-day\" style=\"background-color:#CCFF99;\" >';\n\t\t\t\t\n\t\t\t}else\n\t\t\t{\t\t\t\n\t\t\t$calendar.= '<td class=\"calendar-day\">';\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t$day_content='';\n\t\t\t\n\t\t\t//$day_content.= \"<br>\".$todays_date;\n\t\t\t/* add in the day number */\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\n\n\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\n\t\t\t//$day_content.= \"<br>\".$current_date;\n\t\t\t$mysql_date=strtotime($current_date);\n\t\t\t\n\t\t\t$results=Enggdiary::model()->fetchDiaryDetails($engg_id,$mysql_date);\t\t\t\n\n\t\t\t$print_link=\"../../servicecall/PrintAllJobsForDay/?engg_id=\".$engg_id.\"&date=\".$current_date;\n\t\t\t\n\t\t\t$count_records=0;\n\t\t\t$day_content.=\"<table>\";\n\t\t\tforeach($results as $data)\n\t\t\t{\n\t\t\t$link= Yii::app()->getBaseUrl().\"/servicecall/\".$data->servicecall_id;\n\t\t\t\t\n\t\t\t$day_content.=\"<tr><td>\";\n\t\t\t$day_content.=\"<a href='\".$link.\"'>\";\n\t\t\t$day_content.=\"\".$data->servicecall->customer->last_name.\"</td><td>\".$data->servicecall->customer->postcode_s.$data->servicecall->customer->postcode_e.\"<span style='color:#5BA0C9; font-size:10px;'><b>(\".$data->slots.\")</b></span><br>\"; ;\n\t\t\t$day_content.=\"</a>\";\n\t\t\t$day_content.=\"</td></tr>\";\n\t\t\t \n\t\t\t$count_records++;\n\t\t\t\n\t\t\t}//end of foreach().\n\t\t\tif ($count_records>0)\n\t\t\t{\n\t\t\t\t\n\t\t\t\t$day_content.=\"<tr><td colspan='2'><hr>\";\n\t\t\t\t$day_content.=\"<a href='\".$print_link.\"' target='_blank' ><b>Print All Jobs</b> <a><br><br>\";\n\t\t\t\t$day_content.=\"</td></tr>\";\n\t\t\t}\n\t\t\t$day_content.=\"</table>\";\n\t\t\t$calendar.= str_repeat('<p>'.$day_content.'</p>',1);\n\t\t\t\n\t\t$calendar.= '</td>';\n\t\t/*MY CODE TO GET URL*/\n\t\tif($day_counter=='0')\n\t\t{\n\t\t\t$week_start_date=$current_date;\n\t\t\t//echo \"<hr>Begin week :\" .$week_start_date;\n\t\t}\n\t\tif($days_in_this_week=='1')\n\t\t{\n\t\t\t$week_start_date=$current_date;\n\t\t\t//echo \"<hr>Begin week :\" .$week_start_date;\n\t\t}\n\t\t$baseUrl=Yii::app()->baseUrl;\n\t\t//echo $baseUrl;\n\t\t/*END OF MY CODE */\n\t\tif($running_day == 6):\n\t\t\t$week_end_date=$current_date;\n\t\t\t//echo \"End week :\". $week_end_date.\"<br>\"; /* GIVES THE DATES OF WEEKENDS */\n\t\t\t$url=$baseUrl.'/enggdiary/weeklyReport/?engg_id='.$engg_id.'&start_date='.$week_start_date.'&end_date='.$week_end_date;\n\t\t\t$calendar.= '<td> <a href=\"'.$url.'\">Weekly Report</a> <td></tr>';\n\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\t\t//echo \"here\";\n\t\t\tendif;\n\t\t\t\t\n\t\t\t$running_day = -1;\n\t\t\t$days_in_this_week = 0;\n\t\t\t//$weekEndDate=$current_date;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\tendfor;\n\t//echo $current_date; GIVES THE MONTH END DATE.\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\t\t\n//\t\techo \"current date\".$current_date;/* GIVES MONTH END DATE */\n//\t\techo \"week start of month end :\".$week_start_date;\n\t\t$url=$baseUrl.'/enggdiary/weeklyReport/?engg_id='.$engg_id.'&start_date='.$week_start_date.'&end_date='.$current_date;\n\t\t$calendar.= '<td> <a href=\"'.$url.'\">Weekly Report</a><td>';\n\t\t\n\tendif;\n\t//echo $day_counter;/* GIVES NO OF DAYS IN MONTH. */\n\t/* final row */\n\t$calendar.= '</tr>';\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\t\n\t/* all done, return result */\n\treturn $calendar;\n}",
"public function buildCalendar()\n {\n\n /**\n * Determione the calendar moth and create an array of\n * weekday abbreviation to label the calendar colums\n */\n\n $cal_month = date('F Y', strtotime($this->_usedate));\n define('WEEKDAYS', array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'));\n\n\n /** \n * Add a header to the calendar markup\n */\n $html = \"\\n\\t<h2>$cal_month</h2>\";\n for ($d = 0, $labels = NULL; $d < 7; ++$d) {\n $labels .= \"\\n\\t\\t<li>\" . WEEKDAYS[$d] . \"</li>\";\n }\n\n $html .= \"\\n\\t<ul class=\\\"weekdays\\\">\" . $labels . \"\\n\\t</ul>\";\n\n /**\n * Load events data\n */\n $events = $this->_createEventObj();\n\n /**\n * Create the calndar markup\n */\n\n $html .= \"\\n\\t<ul>\";\n for (\n $i = 1, $c = 1, $t = date('j'), $m = date('m'), $y = date('Y');\n $c <= $this->_daysInMonth;\n ++$i\n ) \n {\n /**\n * Apply a \"fill\" class to the boxes occuring before\n * the first of the month\n */\n $class = $i <= $this->_startDay ? \"fill\" : NULL;\n\n /**\n * Add a \"today\" class if the current fdate matches\n * the current date \n */\n\n if ($c == $t && $m == $this->_m && $y == $this->_y) \n {\n $class = \"today\";\n }\n\n /**\n * Building the opening and closing list item tags\n */\n\n $ls = sprintf(\"\\n\\t\\t<li class=\\\"%s\\\">\", $class);\n $le = \"\\n\\t\\t</li>\";\n\n /**\n *Add the day of the month to identify the calendar box \n */\n $event_info= NULL;\n\n if ($this->_startDay < $i && $this->_daysInMonth >= $c) \n {\n\n /** \n * Format events data\n */\n //clear the variable\n\n if (isset($events[$c]))\n {\n foreach ($events[$c] as $event)\n {\n $link = '<a href=\"view.php?event_id=' . $event->id . '\">' . $event->title . '</a>';\n $event_info = \"\\n\\t\\t\\t$link\";\n \n }\n \n }\n \n $date = sprintf(\"\\n\\t\\t\\t<strong>%02d</strong>\", $c++);\n }\n else\n {\n $date = \" \";\n }\n\n /**\n * If the current day is a Saturday, wrap to the nex row\n */\n $wrap = $i != 0 && $i % 7 == 0 ? \"\\n\\t</ul>\\n\\n<ul>\" : NULL;\n\n \n /**\n * Assemble the pieces into a finished item\n */\n\n $html .= $ls . $date . $event_info . $le . $wrap;\n \n }\n\n /**\n * Add filler to finish out the last week\n */\n\n while ($i % 7 != 1) {\n $html .= \"\\n\\t\\t<li class=\\\"fill\\\"> </li>\";\n ++$i;\n }\n\n /**\n * Close the fineal unorderd list\n */\n $html .= \"\\n\\t</ul>\\n\\n\";\n\n /**\n * Return the markup for output\n */\n return $html;\n \n }",
"function draw_calendar($month, $year, $events_by_days){\n /* draw table */\n $calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n /* table headings */\n $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n $calendar.= '<tr class=\"calendar-row\">';\n //implode('</td><td class=\"calendar-day-head\">',$headings).\n $i = 1;\n foreach ($headings as $key => $value) {\n $class = 'calendar_odd_head';\n if ($i++ % 2 == 0) {\n $class = 'calendar_even_head';\n }\n $calendar.= '<td class=\"calendar-day-head '.$class.'\">';\n $calendar.= $value;\n $calendar.= '</td>'; \n }\n $calendar.= '</tr>';\n /* days and weeks vars now ... */\n $running_day = date('w',mktime(0,0,0,$month,1,$year));\n $days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n $days_in_this_week = 1;\n $day_counter = 0;\n $dates_array = array();\n /* row for week one */\n $calendar.= '<tr class=\"calendar-row\">';\n /* print \"blank\" days until the first of the current week */\n for($x = 0; $x < $running_day; $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n $days_in_this_week++;\n endfor;\n /* keep going with days.... */\n for($list_day = 1; $list_day <= $days_in_month; $list_day++):\n $calendar.= '<td class=\"calendar-day\">';\n /* add in the day number */\n $calendar .= '<div class=\"day-number\">'.sprintf(\"%02d\",$list_day).'</div>'; \n $calendar .= \"<div class='event_calendar_wraper_div'>\"; \n if(isset($events_by_days[$list_day])){\n foreach ($events_by_days[$list_day] as $key => $event) { \n $color = 'color:#000000;';\n if(isset($event['Category']['color']) && $event['Category']['color'] != ''){\n $color = 'color:'.$event['Category']['color'].';';\n }\n $calendar .= '<div onclick=\"open_event('.$event['Event']['id'].');\" class=\"event_calendar_div\" style=\"'.$color.'\">'.$event['Event']['title'].'</div>'; \n } \n }\n $calendar .= \"</div>\";\n $calendar.= '</td>';\n if($running_day == 6):\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month):\n $calendar.= '<tr class=\"calendar-row\">';\n endif;\n $running_day = -1;\n $days_in_this_week = 0;\n endif;\n $days_in_this_week++; $running_day++; $day_counter++;\n endfor;\n /* finish the rest of the days in the week */\n if($days_in_this_week < 8):\n for($x = 1; $x <= (8 - $days_in_this_week); $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n endfor;\n endif;\n /* final row */\n $calendar.= '</tr>';\n /* end the table */\n $calendar.= '</table>';\n /* all done, return result */\n return $calendar;\n}",
"function StrokeDays($aYCoord) {\r\n\t$wdays=$this->iDateLocale->GetDayAbb();\t\r\n\t$img=$this->iImg;\t\r\n\t$daywidth=$this->GetDayWidth();\r\n\t$xt=$img->left_margin+$this->iLabelWidth;\r\n\t$yt=$aYCoord+$img->top_margin;\t\t\r\n\tif( $this->day->iShowLabels ) {\r\n\t $img->SetFont($this->day->iFFamily,$this->day->iFStyle,$this->day->iFSize);\r\n\t $xb=$img->width-$img->right_margin;\r\n\t $yb=$yt + $img->GetFontHeight() + $this->day->iTitleVertMargin + $this->day->iFrameWeight;\r\n\t $img->SetColor($this->day->iBackgroundColor);\r\n\t $img->FilledRectangle($xt,$yt,$xb,$yb);\r\n\r\n\t $img->SetColor($this->day->grid->iColor);\r\n\t $x = $xt; \r\n\t $img->SetTextAlign(\"center\");\r\n\t $day = $this->iWeekStart;\r\n\t //echo \"n=\".$this->GetNumberOfDays().\"<p>\";\r\n\t for($i=0; $i<$this->GetNumberOfDays(); ++$i, $x+=$daywidth, $day += 1,$day %= 7) {\r\n\t\tif( $day==6 || $day==0 ) {\r\n\t\t $img->PushColor($this->day->iWeekendBackgroundColor);\r\n\t\t if( $this->iUsePlotWeekendBackground )\r\n\t\t\t$img->FilledRectangle($x,$yt+$this->day->iFrameWeight,$x+$daywidth,$img->height-$img->bottom_margin);\t\t\t\t\t\t\r\n\t\t else\r\n\t\t\t$img->FilledRectangle($x,$yt+$this->day->iFrameWeight,$x+$daywidth,$yb-$this->day->iFrameWeight);\r\n\t\t $img->PopColor();\r\n\t\t}\r\n\t\tif( $day==0 ) \r\n\t\t $img->PushColor($this->day->iSundayTextColor);\r\n\t\telse\r\n\t\t $img->PushColor($this->day->iTextColor);\r\n\t\t$img->StrokeText(round($x+$daywidth/2+1),\r\n\t\t\t\t round($yb-$this->day->iTitleVertMargin),\r\n\t\t\t\t $wdays[$day]);\r\n\t\t$img->PopColor();\t\t\t\t\t\t\r\n\t\t$img->Line($x,$yt,$x,$yb);\r\n\t\t$this->day->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);\r\n\t }\t\t\t\r\n\t $img->SetColor($this->day->iFrameColor);\r\n\t $img->SetLineWeight($this->day->iFrameWeight);\r\n\t $img->Rectangle($xt,$yt,$xb,$yb);\r\n\t return $yb - $img->top_margin;\r\n\t}\r\n\treturn $aYCoord;\r\n }",
"public function buildCalendar()\n\t{\n\t\t/*\n\t\t * Determine the calendar month and create an array of\n\t\t * weekday abbreviation to label the calendar columns\n\t\t */\n\t\t$cal_month = date('F Y', strtotime($this -> _useDate));\n\t\tdefine('WEEKDAYS', array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'));\n\n\t\t/*\n\t\t * Add a header to the calendar markup\n\t\t */\n\t\t$html = \"\\n\\t<h2>$cal_month</h2>\";\n\t\tfor($d=0, $labels=NULL; $d<7; ++$d)\n\t\t{\n\t\t\t$labels .= \"\\n\\t\\t<li>\" . WEEKDAYS[$d] . \"</li>\";\n\t\t}\n\t\t$html .= \"\\n\\t<ul class=\\\"weekdays\\\">\" . $labels . \"\\n\\t</ul>\";\n\n\t\t/*\n\t\t * Load events data\n\t\t */\n\t\t$events = $this -> _createEventObj();\n\n\t\t/*\n\t\t * Create the calendar markup\n\t\t */\n\t\t$html .= \"\\n\\t<ul>\"; //Start a new unordered list\n\t\tfor ($i=1, $c=1, $t=date('j'), $m=date('m'), $y=date('Y');\n\t\t\t\t$c <= $this -> _daysInMonth; ++$i) \n\t\t{\n\t\t\t/*\n\t\t\t * Apply a \"fill\" class to the boxes occuring before\n\t\t\t * the first of the month\n\t\t\t */\n\t\t\t$class = $i<=$this -> _startDay ? \"fill\" : NULL;\n\n\t\t\t/*\n\t\t\t * Add a \"today\" class if the current date matches\n\t\t\t * the current date\n\t\t\t */\n\t\t\tif($c==$t && $m==$this -> _m && $y==$this -> _y)\n\t\t\t{\n\t\t\t\t$class = \"today\";\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Build the opening and closing list item tags\n\t\t\t */\n\t\t\t$ls = sprintf(\"\\n\\t\\t<li class=\\\"%s\\\">\", $class);\n\t\t\t$le = \"\\n\\t\\t</li>\";\n\n\t\t\t/*\n\t\t\t * Add the day of the month to identify the calendar box\n\t\t\t */\n\n\t\t\t$event_info ='';\n\t\t\tif ($this -> _startDay < $i && $this -> _daysInMonth >= $c)\n\t\t\t{\n\t\t\t\t/*\n\t\t\t\t * Format events data\n\t\t\t\t */\n\t\t\t\t$event_info = NULL; //clear the variable\n\t\t\t\tif(isset($events[$c]))\n\t\t\t\t{\n\t\t\t\t\tforeach($events[$c] as $event)\n\t\t\t\t\t{\n\t\t\t\t\t\t$link = '<a href=\"view.php?event_id='\n\t\t\t\t\t\t\t\t. $event -> id . '\">' . $event -> title\n\t\t\t\t\t\t\t\t. '</a>';\n\t\t\t\t\t\t$event_info .= \"\\n\\t\\t\\t$link\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$date = sprintf(\"\\n\\t\\t\\t<strong>%02d</strong>\", $c++);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$date = \" \";\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * If the current day is a Saturday, wrap to the next row\n\t\t\t */\n\t\t\t$wrap = $i!=0 && $i%7 == 0 ? \"\\n\\t</ul>\\n\\t<ul>\" : NULL;\n\n\t\t\t/*\n\t\t\t * Assemble the pieces into a finished item\n\t\t\t */\n\t\t\t$html .= $ls . $date . $event_info . $le . $wrap;\n\n\t\t}\n\n\t\t/*\n\t\t * Add filter to finish out the last week\n\t\t */\n\t\twhile ($i%7!=1)\n\t\t{\n\t\t\t$html .= \"\\n\\t\\t<li class=\\\"fill\\\"> </li>\";\n\t\t\t++$i;\n\t\t}\n\n\t\t/*\n\t\t * Close the final unordered list \n\t\t */\n\t\t$html .= \"\\n\\t</ul>\\n\\n\";\n\n\t\t/*\n\t\t * Return the markup for output\n\t\t */\n\t\treturn $html;\n\t}",
"function drawCalendar($month, $year)\n {\n\n date_default_timezone_set('Europe/Paris');\n\n $todayMonth = date(\"m\");\n $todayYear = date(\"Y\");\n $todayDay = date(\"d\");\n\n// echo $month . \" \" . $year . \"<p>\";\n\n //Here we generate the first day of the month\n $first_day = mktime(0,0,0,$month, 1, $year) ;\n\n //This gets us the month name\n $title = date('F', $first_day) ;\n\n //Here we find out what day of the week the first day of the month falls on\n $day_of_week = date('D', $first_day) ;\n\n //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero\n switch($day_of_week){\n case \"Sun\": $blank = 0; break;\n case \"Mon\": $blank = 1; break;\n case \"Tue\": $blank = 2; break;\n case \"Wed\": $blank = 3; break;\n case \"Thu\": $blank = 4; break;\n case \"Fri\": $blank = 5; break;\n case \"Sat\": $blank = 6; break;\n }\n\n //We then determine how many days are in the current month\n $days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year) ;\n\n //Here we start building the table heads\n echo \"<table border=1 width=294 style=empty-cells:show; border-collapse:collapse;>\";\n echo \"<tr><th colspan=7>\";\n echo \"<a class='none' href='javascript:getPreviousMonth()'> < </a>\";\n echo \"<span id='month'>$title</span> <span id='year'>$year </span>\";\n echo \"<a class='none' href='javascript:getNextMonth()'> > </a></th></tr>\";\n echo \"<tr><td width=42>Sun</td><td width=42>Mon</td><td width=42>Tue</td><td width=42>Wed</td><td width=42>Thu</td><td width=42>Fri</td><td width=42>Sat</td></tr>\";\n\n //This counts the days in the week, up to 7\n $day_count = 1;\n\n echo \"<tr>\";\n //first we take care of those blank days\n while ( $blank > 0 )\n {\n echo \"<td></td>\"; // \n $blank = $blank-1;\n $day_count++;\n }\n\n //sets the first day of the month to 1\n $day_num = 1;\n\n include \"user.class.php\";\n $user = new userclass();\n \n\n\n //count up the days, until we've done all of them in the month\n while ( $day_num <= $days_in_month )\n {\n $user = new userclass();\n // change background when events take place.\n if($user->checkEvent($day_num, $month, $year))\n {\n $date = date(\"Y-m-d\", mktime(0,0,0,$month, $day_num, $year));\n echo \"<td id='calendar_event'>\";\n echo \"<a class='cal' href='DateEvents.php?Date=\" .$date .\"&Order=Points'>$day_num </a></td>\";\n }\n else\n echo \"<td> $day_num </td>\";\n\n\n $day_num++;\n $day_count++;\n\n //Make sure we start a new row every week\n if ($day_count > 7)\n {\n echo \"</tr><tr>\";\n $day_count = 1;\n }\n }\n\n //Finaly we finish out the table with some blank details if needed\n while ( $day_count >1 && $day_count <=7 )\n {\n echo \"<td> </td>\";\n $day_count++;\n }\n\n echo \"</tr>\";\n echo \"</table>\";\n }",
"function draw_calendar($month,$year,$events = array()){\n\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t//$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n\t$headings = ['Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle'];\n\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t//$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t//$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$running_day = date('N', mktime(0, 0, 0, $month, 1, $year));\n \t$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));\n\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 1; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\n\t/* keep going with days.... */\n\t//print_r($events);\n\n\tif (!empty($_GET['id'])) {\n\t\t\t$id = $_GET['id'];\n\t\t}\n\t\telse {\n\t\t\t$id = \"0\";\n\t}\n\n\n\tif (!empty($_GET['project'])) {\n\t\t$project = $_GET['project'];\n\t}\n\telse {\n\t\t$project = \"0\";\n\t}\n\n\t$day_formatted = \"\";\n\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:110px;\">';\n\t\t\t/* add in the day number */\n\t\t\t$calendar.= '<div class=\"column-header\"><div class=\"day-number day\">'.$list_day.'</div>';\n\t\t\t//if ($project > 0 && is_numeric($project) && $id > 0 && is_numeric($id) ) {\n\t\t\t\t$calendar.= '<div class=\"day-number add\"><a href=\"event-registration.php?id='.$id.'&project='.$project.'&day='.$list_day.'&month='.$month.'&year='.$year.'\" title=\"Přidat událost\">+</a></div></div>';\n\t\t\t//}\n\t\t\t\n\t\t\t\n\t\t\t$monthFormated = $month;\n\t\t\tif ($month<10) {\n\t\t\t\t(int)$monthFormated = \"0\".$month;\n\t\t\t}\n\n\t\t\tif ($list_day<10) {\n\t\t\t\t(int)$day_formatted = \"0\".$list_day;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t(int)$day_formatted = $list_day;\n\t\t\t}\n\n\t\t\t$event_day = $year.'-'.$monthFormated.'-'.$day_formatted;\n\t\t\t//echo \"<br>$event_day\";\n\n\t\t\tif(isset($events[$event_day])) {\n\t\t\t//if($event_day==$events[]) {\n\t\t\t\t//echo \" - dnes je akce\";\n\t\t\t\t$idUser = $_SESSION['id_user'];\n\t\t\t\tforeach($events[$event_day] as $event) {\n\t\t\t\t\t$title = $link = $color = \"\";\n\t\t\t\t\tif ($event['id_user'] == \"1\") { $color = \"grey-bg\"; $link = \"event-edit.php?id=\".$event['id_mdg_event']; $title=\"Upravit akci\"; }\n\t\t\t\t\telse if ( ( ($event['id_user'] != $idUser) && ($event['id_user_koo'] != $idUser) )) { $color = \"display-none\"; }\n\t\t\t\t\telse if ($event['schvaleno'] == \"ano\") { $color = \"green-bg\"; $link = \"event-show.php?id=\".$event['id_mdg_event']; $title=\"Zobrazit akci\"; }\n\t\t\t\t\telse if ($event['splneno'] == \"ano\") { $color = \"orange-bg\"; $link = \"event-revision.php?id=\".$event['id_mdg_event']; $title=\"Zkontrolovat akci\"; }\n\t\t\t\t\telse { $color = \"red-bg\"; $link = \"event-fill.php?id=\".$event['id_mdg_event']; $title=\"Vyplnit akci\"; }\n\n\n\n\t\t\t\t\t$calendar.= '<a href=\"'.$link.'\" title=\"'.$title.'\"><div class=\"event '.$color.'\">'.$event['nadpis'].'</div></a>';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$calendar.= str_repeat('<p> </p>',2);\n\t\t\t}\n\t\t$calendar.= '</div></td>';\n \t// New row\n\t\t//if($running_day == 6):\n\t\tif($running_day == 7):\n\t\t\t$calendar.= '</tr>';\n\t\t\tif(($day_counter+1) < $days_in_month):\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\"> ';\n\t\t\t\t//$calendar.= \"<td>day counter je $day_counter </td>\";\n\t\t\tendif;\n\t\t\t//$running_day = -1;\n\t\t\t$running_day = 0;\n\t\t\t$days_in_this_week = 0;\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\tendfor;\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8 && $days_in_this_week != 1):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\t\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\n\t/** DEBUG **/\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\n\t\n\t/* all done, return result */\n\treturn $calendar;\n}",
"function drawConfirmCalendar($pidList='') {\t\n\t\t/* Call the view and pass it the calendar to draw */\n\t\t$viewObj = $this->getServiceObjByKey('cal_view', 'confirm_calendar', '_confirm_calendar');\n\t\t$content = $viewObj->drawConfirmCalendar(false, $pidList);\n\t\t\n\t\treturn $content;\n\t}",
"function draw_calendar($next){\n\t\n\n\t// $month = $next==1?(date('m')==12?1:date('m',mktime(0, 0, 0, date(\"m\")-1, date(\"d\"), date(\"Y\")))):date('m');\n\t//$year = date('Y');\n\n\t$year = $next==1?(date('m')==12?date('Y')+1:date('Y')):date('Y');\n\t$month = explode(\"|\",get_month_wonder($next));\n\n\t//mes anterior\n\t$firstm = $next?$month[2]:date('m');//frena el calendario en enero del ano presente\n\t$beforeD = $month[2]?$month[2]:date('m')-1;\n\t$beforeM = $month[0]?$month[0]:date('F',mktime(0, 0, 0, date(\"m\")-1, date(\"d\"), date(\"Y\")));\n\n\t//mes siguiente\n\t$lastm = $next?$month[3]:date('m');//frena el calendario en diciembre del ano presente\n\t$nextD = $month[3]?$month[3]:date('m')+1;\n\t$nextM = $month[1]?$month[1]:date('F',mktime(0, 0, 0, date(\"m\")+1, date(\"d\"), date(\"Y\")));\n\n\t$month = $month[4]?$month[4]:date('m');\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar rounded\">';\n\n\t/* table headings */\n\t$headings = array('Sun','Mon','Tues','Wednes','Thurs','Fri','Satur');\n\t$backMonth= $firstm!=''?\"onclick='window.location.replace(\\\"?current=booking&next=\".$beforeD.\"\\\");'\":\"\";\n\t$nextMonth= $lastm!=''?\"onclick='window.location.replace(\\\"?current=booking&next=\".$nextD.\"\\\");'\":\"\";\n\t$calendar.= '<tr class=\"calendar-row\" >\n\t\t\t\t <th '.$backMonth.' > <h3 style=\"cursor: pointer\">'.($backMonth==''?'':'<').'</h3></th>\n\t\t\t\t <th colspan=\"5\"> <h3>'.date('F Y',mktime(0, 0, 0, $month, 1, $year)).'</h3></th>\n\t\t\t\t <th '.$nextMonth.' > <h3 style=\"cursor: pointer\">'.($nextMonth==''?'':'>').'</h3></th>';\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\t/*\n\tList of the reservations for this month, day by day\n\t */\n\t$reservations = mysql_query(\"SELECT DAY(date) as 'day', pakage FROM `reservations` WHERE `date` LIKE '$year-$month%' and DAY(date) > \".date(\"d\").\" and status=1 ORDER BY date\") or die (mysql_error());\n\twhile ($reserved = mysql_fetch_assoc($reservations)){\n\t\t\n\t\t$daysReserved[$reserved['day']][]=$reserved['pakage'];\n\t\t\n\t}\n\n\t/* keep going with days.... */\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t$activitiesInDay='';\n\t if(is_array($daysReserved[$list_day]))\n\t\tforeach ($daysReserved[$list_day] as $dayReserved) {\n\t\t\t\n\t\t\t$activitiesInDay.=\"<span class='radius label'>\".$dayReserved.\"</span><br>\";\n\t\t\t\n\n\t\t}\n\n\t\t//$selectedDay= @in_array($list_day,)?'selected':'';\n\t $onclick= \"onclick='window.location.replace(\\\"?current=booking&date=$month-$list_day-$year\\\");'\";\n\t\t$valid=(date('m')==$month && $list_day <= date('d'))?\"calendar-day-np\":\"calendar-day\";\n\t\t$calendar.= \"<td class='$valid $selectedDay' $onclick >\";\n\t\t\t/* add in the day number */\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\n\n\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t$calendar.= $activitiesInDay;//str_repeat('<p> </p>',2);\n\t\t\t\n\t\t$calendar.= '</td>';\n\t\tif($running_day == 6):\n\t\t\t$calendar.= '</tr>';\n\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\tendif;\n\t\t\t$running_day = -1;\n\t\t\t$days_in_this_week = 0;\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\tendfor;\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\t\n\t/* all done, return result */\n\treturn $calendar;\n}",
"function Calendar() {\n \n }",
"public function renderCalendar()\n\t{\n\t\t$this->template->content = 'I am Admin:calendar.';\n\t}",
"function displayDay() {\n\t\t$this->fetchCurrValue('dateFormat', $this->pi_getLL('stdDateFormat'), 's_misc');\n\t\t$this->fetchCurrValue('PIDeventDisplay', '0', 'sDEF', 1);\n\t\t$this->fetchCurrValue('showEventBegin', '0', 'sDEF');\n\t\t$this->fetchCurrValue('showAsList', 0, 'sDEF', 1);\n\t\t$this->fetchCurrValue('additionalColumnAtEnd', '0', 'sDEF');\n\t\t$this->fetchCurrValue('hideExcEvents', '0', 'sDEF');\n\t\t$this->fetchCurrValue('hideViewSelection', '0', 'sDEF');\n\t\t$this->fetchCurrValue('PIDlistDisplay', '0', 'sDEF');\n\t\t$this->fetchCurrValue('PIDweekDisplay', '0', 'sDEF');\n\t\t$this->fetchCurrValue('PIDmonthDisplay', '0', 'sDEF');\n\n\t\t$this->conf['start_t']=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'startHour', 'sDEF');\n\t\tif(!$this->conf['start_t'] || $this->conf['start_t']<0 || $this->conf['start_t']>24) {\n\t\t\t$this->conf['start_t']=0;\n\t\t}\n\n\t\t$this->conf['stop_t']=$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'endHour', 'sDEF');\n\t\tif(!$this->conf['stop_t'] || $this->conf['stop_t'] > 24) {\n\t\t\t$this->conf['stop_t']=24;\n\t\t}\n\n\t\t$this->dayTemplateCode = $this->cObj->getSubpart($this->templateCode, '###DAY_VIEW###');\n\n\t\t$subpartsArray = array(); // Region markers\n\t\t$markerArray = array(); // Simple markers\n\n\t\t$day_first = strtotime(strftime('%Y-%m-%d', $this->conf['currTime']));\n\t\t$day_last = strtotime(strftime('%Y-%m-%d', $day_first).'+1day')-1;\n\n\t\t$exc_entries = $this->getExceptionEventsArray($day_first, $day_last+1);\n\t\t$entries = $this->getEventsArray($day_first, $day_last+1, $exc_entries);\n\n\t\t$markerArray['###VIEW_TITLE###']=$this->pi_getLL('titleDayView');\n\n\t\t$vars['year']=strftime('%Y', $day_first-1);\n\t\t$vars['month']=strftime('%m', $day_first-1);\n\t\t$vars['day']= strftime('%d', $day_first-1);\n\t\t$vars['uid'] = $this->uid;\n\t\tif(!empty($this->conf['currCat'])) $vars['category'] = $this->conf['currCat'];\n\n\t\t$markerArray['###PREW_DAY###']=$this->pi_linkTP($this->pi_getLL('day_prev'), array($this->prefixId=>$vars), $this->caching);\n\n\t\t$vars['year']=strftime('%Y', $day_last+1);\n\t\t$vars['month']=strftime('%m', $day_last+1);\n\t\t$vars['day']= strftime('%d', $day_last+1);\n\t\t$markerArray['###NEXT_DAY###']=$this->pi_linkTP($this->pi_getLL('day_next'), array($this->prefixId=>$vars), $this->caching);\n\t\t$markerArray['###TIME_INFO###']=strftime($this->conf['dateFormat'], $day_first);\n\t\t$markerArray['###CATEGORY_TITLE###'] = $this->getCategorySelection($this->conf['currTime']);\n\n\t\t$markerArray['###VIEW_LIST###'] = $this->getViewSelection($day_first,'d');\n\n\t\t$subpartsArray['###DAY_TABLE###'] = $this->dayTable($day_first, $day_last, $entries, $exc_entries);\n\n\t\t$markerArray['###SUBMIT_EVENT###'] = ''; // That's where we will build the FE_Edit\n\n\t\t$out = $this->cObj->substituteMarkerArrayCached($this->dayTemplateCode, $markerArray, $subpartsArray, array());\n\n\t\tif ($this->conf['showTooltips'] == 1) {\n\t\t\t$out .= $this->tooltip;\n\t\t}\n\n\t\treturn $out;\n\t}",
"function tec_display_admin_calendar() {\n\tglobal $events_table, $event_params;\n\techo get_table($event_params, get_recent_items($events_table), \"tec_calendar\", true, \"title\", \"tec-event\");\n}",
"function showWeekView($date) {\r\n //Determine what week of the year the date falls on.\r\n $week = date(\"W\", $date);\r\n //Determine what day of the week the date falls on.\r\n $dayOfWeek = date(\"w\",$date);\r\n //Define one day in seconds (60 seconds * 60 minutes * 24 hours).\r\n $oneDay = 60 * 60 * 24;\r\n //Determine the first day of the week that the day falls on.\r\n $firstDayOfWeek = $date - ($dayOfWeek * $oneDay); // ;\r\n $weekCalendarClass = \"\";\r\n $weekCalendarID = \"\";\r\n $prevLink = \"\";\r\n $nextLink = \"\";\r\n $width = \"100%\";\r\n\r\n $highlightWorkHours = false;\r\n $toggle = 0;\r\n\r\n if (isset($this->workStartHour) && isset($this->workStartMinute) && isset($this->workStartAmPm)) {\r\n /*\r\n Determine the quarter hour of the starting work time for highlighting the\r\n hours in a work day.\r\n */\r\n $unixWorkStartTime = mktime(($this->workStartHour + ($this->workStartAmPm * 12)), $this->workStartMinute, 0, date(\"m\", $date), date(\"j\", $date), date(\"Y\", $date));\r\n /*\r\n Determine the quarter hour of the ending work time for highlighting the\r\n hours in a work day.\r\n */\r\n $unixWorkEndTime = mktime(($this->workEndHour + ($this->workEndAmPm * 12)), $this->workEndMinute, 0, date(\"m\", $date), date(\"j\", $date), date(\"Y\", $date));\r\n $highlightWorkHours = true;\r\n } else {\r\n $unixWorkStartTime = mktime(0, 0, 0, date(\"m\", $date), date(\"j\", $date), date(\"Y\", $date));\r\n $unixWorkEndTime = mktime(0, 0, 0, date(\"m\", $date), date(\"j\", $date), date(\"Y\", $date));\r\n }\r\n\r\n //Create the header\r\n $output = \"<div style=\\\"vertical-align: top;\\\">\";\r\n $output .= \"<table\".$weekCalendarClass.$weekCalendarID.\" border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\" align=\\\"\".$this->largeFormatAlign.\"\\\" style=\\\"width: \".$width.\";\\\">\\n\";\r\n $output .= \" <tr>\\n\";\r\n $output .= \" <td style=\\\"width: 100%; text-align: center; vertical-align: middle;\\\">\\n\";\r\n $output .= \" <span style=\\\"font-size: 30px; font-weight: bold; color: \".$this->colorWeekFormatHeaderText.\";\\\">\".$prevLink.\"Week \".$week.$nextLink.\"</span>\\n\";\r\n $output .= \" </td>\\n\";\r\n $output .= \" </tr>\\n\";\r\n $output .= \" <tr style=\\\"color: \".$this->colorWeekFormatDayOfWeek.\"; font-weight: bold;\\\">\\n\";\r\n $output .= \" <td>\\n\";\r\n $output .= \" <table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\" align=\\\"center\\\" style=\\\"width: 100%;\\\">\\n\";\r\n $output .= \" <tr>\\n\";\r\n $output .= \" <td style=\\\"width: 12.5%; text-align: center;\\\">Hour</td>\\n\";\r\n //now create the weekday headers\r\n for ($i = 1; $i < 8; $i++) {\r\n $output .= \" <td style=\\\"width: 12.5%; text-align: center;\\\">\".$this->getDOW($i).\"</td>\\n\";\r\n }\r\n $output .= \" <td style=\\\"width: 1.9%;\\\"> </td>\\n\";\r\n $output .= \" </tr>\\n\";\r\n $output .= \" </table>\\n\";\r\n $output .= \" <td>\\n\";\r\n $output .= \" </tr>\\n\";\r\n $output .= \" <tr>\\n\";\r\n $output .= \" <td colspan=\\\"9\\\">\\n\";\r\n $output .= \" <div style=\\\"width: 100%; height: \".$this->weekCalendarHeight.\"; overflow: auto;\\\">\\n\";\r\n $output .= \" <table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\" align=\\\"center\\\" style=\\\"width: 100%;\\\">\\n\";\r\n for($ampm = 0; $ampm < 2; $ampm ++) {\r\n for ($hour = 1; $hour < 13; $hour ++) {\r\n for ($minute = 0; $minute < 4; $minute ++) {\r\n //Format the time display.\r\n $unixTime = mktime((($hour + ($ampm * 12)) - 1), ($minute * 15), 0, date(\"m\", $date), date(\"j\", $date), date(\"Y\", $date));\r\n $time = date(\"g:i A\", $unixTime);\r\n\r\n if ($minute == 0) {\r\n $highlightZeroHour = \"font-weight: bold;\";\r\n } else {\r\n $highlightZeroHour = \"\";\r\n }\r\n\r\n if ($minute == 0) {\r\n $toggle ++;\r\n if ($toggle > 1) {\r\n $toggle = 0;\r\n }\r\n }\r\n\r\n if ($toggle == 0) {\r\n if ((($unixTime >= $unixWorkStartTime)) && ($unixTime < $unixWorkEndTime) && $highlightWorkHours) {\r\n $highlightHour = \" background-color: #DDDDFF;\";\r\n } else {\r\n $highlightHour = \" background-color: DDFFDD;\";\r\n }\r\n } else {\r\n if ((($unixTime >= $unixWorkStartTime)) && ($unixTime < $unixWorkEndTime) && $highlightWorkHours) {\r\n $highlightHour = \" background-color: #BBBBFF;\";\r\n } else {\r\n $highlightHour = \" background-color: #BBFFBB;\";\r\n }\r\n }\r\n\r\n $output .= \" <tr style=\\\"\".$highlightHour.\" height: \".$this->weekCellHeight.\";\\\">\\n\";\r\n $output .= \" <td style=\\\"width: 12.5%; text-align: right;\".$highlightZeroHour.\" vertical-align: top;\\\">\\n\";\r\n $output .= \" <a name=\\\"\".$time.\"\\\">\".$time.\"</a>\\n\";\r\n $output .= \" </td>\\n\";\r\n for ($dow = 0; $dow < 7; $dow ++) {\r\n $output .= \" <td style=\\\"width: 12.5%; text-align: left; vertical-align: top;\\\">\\n\";\r\n $dateCheck = mktime(($hour + ($ampm * 12) - 1), ($minute * 15), 0, date(\"m\", ($firstDayOfWeek + ($oneDay * $dow))), date(\"d\", ($firstDayOfWeek + ($oneDay * $dow))) + $this->startingDOW, date(\"Y\", ($firstDayOfWeek + ($oneDay * $dow))));\r\n $output .= \" \".$this->getEvents($dateCheck, \"weekly\").\"\\n\";\r\n $output .= \" </td>\\n\";\r\n }\r\n $output .= \" </tr>\\n\";\r\n }\r\n }\r\n }\r\n $output .= \" </tr>\\n\";\r\n $output .= \" </table>\\n\";\r\n $output .= \" </div>\\n\";\r\n $output .= \" </td>\\n\";\r\n $output .= \" </tr>\\n\";\r\n $output .= \" </table>\\n\";\r\n\r\n echo($output);\r\n }",
"protected function generate_datepickercalendar() {\n\t\t\t\t$str = $this->open('div', 'class=datepicker-calendar');\n\t\t\t\t\t$str .= $this->open('div', 'class=datepicker-calendar-header');\n\t\t\t\t\t\t$str .= $this->button('type=button|class=prev', $this->icon('glyphicon glyphicon-chevron-left').$this->sronly('Previous Month'));\n\t\t\t\t\t\t$str .= $this->button('type=button|class=next', $this->icon('glyphicon glyphicon-chevron-right').$this->sronly('Next Month'));\n\t\t\t\t\t\t$str.= $this->open('button', 'type=button|class=title');\n\t\t\t\t\t\t\t$str.= $this->open('span', 'class=month');\n\t\t\t\t\t\t\t\tfor ($i = 0; $i < 12; $i++) {\n\t\t\t\t\t\t\t\t\t$str .= $this->span(\"data-month=$i\", date('F', mktime(0, 0, 0, ($i + 1), 10)));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$str .= $this->close('span') . ' ';\n\t\t\t\t\t\t\t$str .= $this->span('class=year');\n\t\t\t\t\t\t$str .= $this->close('button');\n\t\t\t\t\t$str .= $this->close('div'); // datepicker-calendar-header\n\t\t\t\t\t$str .= $this->generate_weektable();\n\t\t\t\t\t$str .= $this->create_element('div', 'class=datepicker-calendar-footer', $this->button('type=button|class=date-picker-today', 'Today'));\n\t\t\t\t$str .= $this->close('div'); // datepicker-calendar\n\t\t\t\t$str .= $this->generate_datepickerwheels();\n\t\t\t\treturn $str;\n\t\t\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Create request for operation 'restoreTransaction'
|
protected function restoreTransactionRequest($id)
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling restoreTransaction'
);
}
if (!preg_match("/[\\d]+/", $id)) {
throw new \InvalidArgumentException("invalid value for \"id\" when calling TransactionsApi.restoreTransaction, must conform to the pattern /[\\d]+/.");
}
$resourcePath = '/api/v1/transactions/{id}/restore';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
// body params
$_tempBody = null;
if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'POST',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
|
[
"public function restored(MobilpayTransaction $mobilpayTransaction)\n {\n //\n }",
"private function reverseTransaction() {\n $data = [\n 'Initiator' => ' ',\n 'SecurityCredential' => ' ',\n 'CommandID' => 'TransactionReversal',\n 'TransactionID' => ' ',\n 'Amount' => ' ',\n 'ReceiverParty' => ' ',\n 'RecieverIdentifierType' => '4',\n 'QueueTimeOutURL' => $this->apiBaseUrl.'/mobilepay/tran_reverse/time_out',\n 'ResultURL' => $this->apiBaseUrl.'/mobilepay/tran_reverse/result',\n 'Remarks' => ' ',\n 'Occasion' => ' '\n ];\n return $this->remotePostCall('mpesa/reversal/v1/request', $data);\n }",
"public function RefundTransaction($request){\r\n return $this->sendRequest($request, \"RefundTransaction\");\r\n }",
"public function restoreContract($request = null)\n {\n // Get ID contract and ID ship from request\n $idShip = $request->filled('ship_id')?$request->get('ship_id'):null;\n $idContract = $request->filled('contract_id')?$request->get('contract_id'):null;\n\n // Get contract need to restore\n $contract = $this->shipContract->getContract($idShip, $idContract);\n\n // Check status restore is change status or recover new update\n // If status is recover new, redirect to page recover, else show response\n $statusContract = $this->checkStatusContract($contract);\n\n if (isset($statusContract['restore']) && $statusContract['restore'])\n return [\n 'status' => true,\n 'redirectTo' => $statusContract['redirectTo']];\n\n return $this->processRestoreContract($this->applyReasonRejectContract($contract));\n }",
"public function CreateTransaction($request_data);",
"public function restored(SaleTransaction $saleTransaction)\n {\n //\n }",
"public function restoreTransactionWithHttpInfo($id)\n {\n $returnType = '\\Swagger\\Client\\Model\\Transaction';\n $request = $this->restoreTransactionRequest($id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->sendRequest($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\Transaction',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\ErrorMessage',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 401:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\BadCredentialsError',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 403:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\ErrorMessage',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 404:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\ErrorMessage',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 422:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\ErrorMessage',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 500:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\ErrorMessage',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }",
"function createTransaction(/*Am_Mvc_Request*/ $request, /*Am_Mvc_Response*/ $response, array $invokeArgs) {}",
"public function reversedByTransaction();",
"public function restoreAction(Request $request)\n {\n $data = $request->request->get('data');\n\n $this->getEm()->getFilters()->disable('archivable');\n\n /** @var Client[] $clients */\n $clients = $this->getRepository('CSBillClientBundle:Client')->findBy(['id' => $data]);\n\n $em = $this->getEm();\n foreach ($clients as $client) {\n $client->setArchived(null);\n $client->setStatus(Status::STATUS_ACTIVE);\n $em->persist($client);\n }\n\n $em->flush();\n\n return $this->json([]);\n }",
"public function restored(RequestVan $requestVan)\n {\n //\n }",
"public function restored(MpesaTransaction $mpesaTransaction)\n {\n //\n }",
"public function restored(RideShareTransaction $rideShareTransaction)\n {\n //\n }",
"protected function salesV1ReceiptsIdDeleteRequest()\n {\n\n $resourcePath = '/sales/v1/receipts/{id}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n []\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n [],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'DELETE',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function restore($parent, RestoreTableRequest $postBody, $optParams = [])\n {\n $params = ['parent' => $parent, 'postBody' => $postBody];\n $params = array_merge($params, $optParams);\n return $this->call('restore', [$params], Operation::class);\n }",
"public function multiRestore(Request $request)\n {\n $id=$request->bulk_restore;\n \n if (!empty($id) && count($id) > 0) \n {\n Student::withTrashed()->whereIn('id',$id)->restore();\n return back()->with('success', 'data restored sucessfully');\n }\n else\n {\n return back()->with('error', __('Please select value to restore.'));\n\n }\n }",
"public function transactionRollback();",
"protected function createReversalJournalEntryRequest($transactionId, $body = null, $command = null)\n {\n // verify the required parameter 'transactionId' is set\n if ($transactionId === null || (is_array($transactionId) && count($transactionId) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $transactionId when calling createReversalJournalEntry'\n );\n }\n\n $resourcePath = '/journalentries/{transactionId}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($command !== null) {\n $queryParams['command'] = ObjectSerializer::toQueryValue($command, null);\n }\n\n // path params\n if ($transactionId !== null) {\n $resourcePath = str_replace(\n '{' . 'transactionId' . '}',\n ObjectSerializer::toPathValue($transactionId),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires HTTP basic authentication\n if ($this->config->getUsername() !== null || $this->config->getPassword() !== null) {\n $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . \":\" . $this->config->getPassword());\n }\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('fineract-platform-tenantid');\n if ($apiKey !== null) {\n $headers['fineract-platform-tenantid'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"protected function emailInvokeActionRestoreDeletedEmailRequest($invocation)\n {\n // verify the required parameter 'invocation' is set\n if ($invocation === null || (is_array($invocation) && count($invocation) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $invocation when calling emailInvokeActionRestoreDeletedEmail'\n );\n }\n\n $resourcePath = '/Email/RestoreDeletedEmail';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n if (isset($invocation)) {\n $_tempBody = $invocation;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json', 'text/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json', 'text/json'],\n ['application/json', 'text/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This method will try to load and decrypt the given token using a JWKSet. If succeeded, the methods will populate the $recipient variable and returns the JWE.
|
public function loadAndDecryptWithKeySet(string $token, JWKSet $keyset, ?int &$recipient): JWE
{
try {
$jwe = $this->serializerManager->unserialize($token);
$nbRecipients = $jwe->countRecipients();
for ($i = 0; $i < $nbRecipients; ++$i) {
if ($this->processRecipient($jwe, $keyset, $i)) {
$recipient = $i;
return $jwe;
}
}
} catch (\Exception $e) {
// Nothing to do. Exception thrown just after
}
throw new \Exception('Unable to load and decrypt the token.');
}
|
[
"public function loadAndDecryptWithKey(string $token, JWK $key, ?int &$recipient): JWE\n {\n $keyset = JWKSet::createFromKeys([$key]);\n\n return $this->loadAndDecryptWithKeySet($token, $keyset, $recipient);\n }",
"private function decrypt() {\n\t\tif (empty($this->t))\n\t\t\tthrow new Exception('Token is empty.', 401);\n\n\t\t$t = openssl_decrypt($this->t,\n\t\t\tTOKEN_ENCRYPTION, TOKEN_SIGNING_KEY, false, SIGNING_INIT);\n\n\t\tif (empty($t))\n\t\t\tthrow new Exception('Token seems invalid.', 401);\n\n\t\tparse_str( $t, $p );\n\n\t\tif (empty($p))\n\t\t\tthrow new Exception('Token format invalid.', 401);\n\n\t\tif (!$this->build( $p ))\n\t\t\tthrow new Exception('Token integrity check failed.', 401);\n\n\t\treturn $this->p;\n\t}",
"public function decodeJWT() {\n // prepare header\n $jwtType = strtoupper($this->config['typ']) == 'JWS' ? 'JWS' : 'JWT';\n $algorithm = strtoupper($this->config['alg']);\n $timestamp = static::$timestamp;\n $_x = $this->modx;\n \n $token = $this->getTokenClaim($this->config['method']);\n //die($this->config['method']);\n $this->token = $token;\n \n // prepare secret key\n $secretk = $this->prepareSecretKey($algorithm);\n if (!$secretk) {\n return $this->outputError(\"Secret key not available!\", 503);\n }\n \n $_tokenArray = explode('.', $token);\n if (count($_tokenArray) != 3) {\n return $this->outputError($this->modx->lexicon('modjwt_error_token_invalid') . $token, 400);\n }\n \n list($headb64, $bodyb64, $cryptob64) = $_tokenArray;\n \n // verify header\n $header = static::jsonDecode(static::urlsafeB64Decode($headb64));\n \n // verify signature\n $signature = static::urlsafeB64Decode($cryptob64);\n \n if ($signature === false) {\n return $this->outputError($this->modx->lexicon('modjwt_error_signature_invalid'), 400);\n }\n \n if (!parent::verify(\"$headb64.$bodyb64\", $signature, $secretk, $header->alg)) {\n return $this->outputError($this->modx->lexicon('modjwt_error_signature_failed'), 400);\n }\n \n // if signature OK, more on header\n if ($header === null) {\n return $this->outputError($this->modx->lexicon('modjwt_error_header_empty'), 400);\n }\n \n if (empty($header->alg)) {\n return $this->outputError($this->modx->lexicon('modjwt_error_alg_empty'), 400);\n }\n \n if (empty(static::$supported_algs[$header->alg])) {\n return $this->outputError(sprintf($this->modx->lexicon('modjwt_error_alg_nosupport'), $header->alg), 400);\n }\n \n if (is_array($secretk) || $secretk instanceof \\ArrayAccess) {\n if (isset($header->kid)) {\n if (!isset($secretk[$header->kid])) {\n return $this->outputError($this->modx->lexicon('modjwt_error_kid_invalid'), 400);\n }\n $secretk = $secretk[$header->kid];\n } else {\n return $this->outputError($this->modx->lexicon('modjwt_error_kid_empty'), 400);\n }\n }\n \n // verify payload\n $payload = static::jsonDecode(static::urlsafeB64Decode($bodyb64));\n \n if ($payload === null) {\n return $this->outputError($this->modx->lexicon('modjwt_error_payload_claim'), 400);\n } else {\n // is expired?\n if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) {\n return $this->outputError($this->modx->lexicon('modjwt_error_token_expire'), 400);\n }\n // is not before time?\n if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) {\n return $this->outputError(sprintf($this->modx->lexicon('modjwt_error_nbf_timestamp'), date(DateTime::ISO8601, $payload->nbf)), 400);\n }\n // valid time?\n if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {\n return $this->outputError(sprintf($this->modx->lexicon('modjwt_error_iat_timestamp'), date(DateTime::ISO8601, $payload->iat)), 400);\n }\n }\n \n $decoded_payload = (array)$payload;\n $this->payload = $payload;\n \n $this->token = null; \n $this->setJSONData();\n return $decoded_payload;\n }",
"public function decryptCiphertext()\n\t {\n\n\t\t // get keys from file\n\t\t if($encKey = CryptKeeper::readKeyFromFile(ENC_KEY_FILE) && $hmacKey = CryptKeeper::readKeyFromFile(HMAC_KEY_FILE))\n\t\t {\n\t\t\t // encryption key and hmac key successfully read, decrypt text\n\t\t\t if($decryptedString = CryptKeeper::decryptString($encKey, $this->iv, $this->ciphertext, $hmacKey))\n\t\t\t {\n\t\t\t\t // decryption was successful, set plaintext as $this->plaintext\n\t\t\t\t $this->setPlaintext($decryptedString);\n\n\t\t\t\t return true;\n\t\t\t }\n\t\t\t else\n\t\t\t {\n\t\t\t\t $this->logger->setLogMsg('paste decryption failed using given key [ '.ENC_KEY_FILE.' ]');\n\t\t\t }\n\t\t }\n\t\t else\n\t\t {\n\t\t\t $this->logger->setLogMsg('could not read in encryption and/or HMAC keys from file :: ENCRYPTION KEY FILE: [ '.ENC_KEY_FILE.' ] :: HMAC KEY FILE: [ '.HMAC_KEY_FILE.' ]');\n\t\t }\n\n\t\t // log an error\n\t\t $this->logger->setLogSrcFunction('Paste() -> decryptCiphertext()');\n\t\t $this->logger->writeLog();\n\n\t\t return false;\n\t }",
"function mcrypt_decrypt () {}",
"public function decryptUsingKey(JWE &$jwe, JWK $jwk, int $recipient, ?JWK $senderKey = null): bool\n {\n $jwkset = new JWKSet([$jwk]);\n\n return $this->decryptUsingKeySet($jwe, $jwkset, $recipient, $senderKey);\n }",
"public function receiveToken()\n {\n $this->validateParameters(['sender','callback_url']);\n\n $paymentData = [\n 'callback_url' => $this->callback_url->value,\n 'option' => 'set_callback_url',\n 'sender' => $this->sender->value,\n 'apiKey' => $this->config->getApiKey()\n ];\n\n $uri = \"phase3/mazexchange-api.php\";\n $response = $this->postRequest($uri, $paymentData);\n return $response;\n }",
"function decrypt( $msg )\n{\n $key = openssl_get_privatekey( file_get_contents( $_SERVER['PRIV_KEY'] ) );\n\n if( openssl_private_decrypt($msg, $decrypted, $key, OPENSSL_PKCS1_PADDING) )\n {\n return $decrypted;\n }\n return $msg;\n}",
"private function getSecret()\n {\n // Your 10-character Team ID\n $team_id = $this->config->filter('keys')->get('team_id');\n\n if (!$team_id) {\n throw new InvalidApplicationCredentialsException(\n 'Missing parameter team_id: your team id is required to generate the JWS token.'\n );\n }\n\n // Your Services ID, e.g. com.aaronparecki.services\n $client_id = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key');\n\n if (!$client_id) {\n throw new InvalidApplicationCredentialsException(\n 'Missing parameter id: your client id is required to generate the JWS token.'\n );\n }\n\n // Find the 10-char Key ID value from the portal\n $key_id = $this->config->filter('keys')->get('key_id');\n\n if (!$key_id) {\n throw new InvalidApplicationCredentialsException(\n 'Missing parameter key_id: your key id is required to generate the JWS token.'\n );\n }\n\n // Find the 10-char Key ID value from the portal\n $key_content = $this->config->filter('keys')->get('key_content');\n\n // Save your private key from Apple in a file called `key.txt`\n if (!$key_content) {\n $key_file = $this->config->filter('keys')->get('key_file');\n\n if (!$key_file) {\n throw new InvalidApplicationCredentialsException(\n 'Missing parameter key_content or key_file: your key is required to generate the JWS token.'\n );\n }\n\n if (!file_exists($key_file)) {\n throw new InvalidApplicationCredentialsException(\n \"Your key file $key_file does not exist.\"\n );\n }\n\n $key_content = file_get_contents($key_file);\n }\n\n $data = [\n 'iat' => time(),\n 'exp' => time() + 86400 * 180,\n 'iss' => $team_id,\n 'aud' => 'https://appleid.apple.com',\n 'sub' => $client_id\n ];\n\n return JWT::encode($data, $key_content, 'ES256', $key_id);\n }",
"public function decryptWithJWKSet(JWKSet $set): string\n {\n if (!count($set)) {\n throw new \\RuntimeException('No keys.');\n }\n $header = $this->header();\n $factory = new KeyAlgorithmFactory($header);\n $key_algo = $factory->algoByKeys($set);\n $enc_algo = EncryptionAlgorithmFactory::algoByHeader($header);\n return $this->decrypt($key_algo, $enc_algo);\n }",
"function decrypt_me($encrypted_data) {\n $t1 = decrypt($encrypted_data);\n $t1_json = json_decode($t1,true);\n if (json_last_error() == JSON_ERROR_NONE) return $t1;\n $t2 = decrypt_643($encrypted_data);\n $t2_json = json_decode($t2,true);\n if (json_last_error() == JSON_ERROR_NONE) return $t2;\n print \"ERROR DECODING\";\n return false;\n}",
"function decryptToken($token)\n{\n $options = 0;\n $decryption = openssl_decrypt($token, $_ENV['CIPHERING'], $_ENV['SECRET'], $options, $_ENV['ENCRYPTION_IV']);\n\n return $token === $decryption;\n}",
"public static function decode($token){\n\t\treturn \\JWT::decode($token, env('APP_KEY'));\n\t}",
"public function decryptToken($token)\n {\n $tokenData = false;\n $encrypted = base64_decode($token);\n\n if ($encrypted) {\n $serialized = Security::decrypt($encrypted, Configure::read('Security.cryptKey'));\n $tokenData = unserialize($serialized);\n }\n return $tokenData;\n }",
"function __get_encrypt_token(): string\n{\n return openssl_encrypt(\n TOKEN,\n OPENSSL_METHOD,\n TOKEN_KEY\n );\n}",
"private function _decodeJWS()\r\n {\r\n $segments = explode('.', $this->jwt);\r\n\r\n if(!$segments || count($segments)!=3){\r\n throw new Exceptions\\Exception_InvalidInput('Invalid JWT input.');\r\n }\r\n \r\n // break the jws into 3 segments\r\n $this->header = Helper::json_b64_decode($segments[0]);\r\n $this->claims = Helper::json_b64_decode($segments[1]);\r\n $this->signature = $segments[2];\r\n }",
"public function testDecrypt() {\n\n $IbmPwSec_Decryptor_Aes = new IbmPwSec_Decryptor_Aes('secretPassphrase');\n\n $message = 'AAAAEIMCL5IWCmcnEnQj8w5gH1rWm2R1hCb8X+HYAYQTS19wAS1bW1e1d8rGppD4Gr6zmBMncn0cXjng4lmOA/d/mnDviULLQeJJpwsyOoc0p+bT2EVEJYXXQNBZlZiDpylGvpsVLzmU9INNiYiMfW+vet106JF4rmwJg/1Y1QcCsKOTcklIxt2h2bi2pFQsmqq0urIZtOEWYWeadjpBCGfjVYEtHR3zRvbCSrK+aHVLDQk02WrLz7iJc/+6NfF2t6YgSjvNNmTo8ls5vzQR95xu7TDV7YOkwaGbf2Kk0TlGs2FmmGatMGZPU324l3oH64m7bs02N4tXCLwroXsM/VU0rDw4uFuNNAQ1PGwVk6hEHk9FpCZ2Oz+iFDLyAAvIwRSBbXKmc3bagoJ/OHuKnXrctFOIh3LEXwuJ+U948TAm8xcffBsGgbm4RZOl6DUv9vFglnfCcIcj63gOeI5RBJL1P7rxMIALf9nxZuVeDkc3kJDtWzC2o+mRbWm3kmCcQFfBEWjgf53EjzcEeFDbRTgnqdlLO6Heppr1eqpU2Vhm/cxf6D6Ur17iJm5Hdp/2rZTaZn3JlYDN5JsKnQTKGigry96uQQE0ztLLhUlxlug6oul0wkTYzXrFPXgJGMNwFC/9sv+PLzNjq2ApTpI+WeaH440EueZ7SUuiAcGvEaI5eo67YCzEjF0z8Iihkl1ZWG8igmozXS+xFToiSthpFAbXJscB0Ycc2QGOc2ZVmbEJZEqnTmKpnJyy6Og2qFqbktxFGwNyj0V0ukpkorrrotaBFjfVYDPGWe/9AFxpvm9A4Jj5UKhDuQrHZO7obsvjuDKD9g==';\n\n $actual = $IbmPwSec_Decryptor_Aes->decrypt($message);\n\n $expected = '<SignonRequest vendor=\"ibm_pw_vendorcode\"><LoggedOnUser><Name><PrimeSurname>Muggs</PrimeSurname><FirstName>J. Fred</FirstName></Name><UniqueId>123456789A</UniqueId><Email>fred_muggs@bananas.com</Email><Telephone>1-800-555-1212</Telephone><CountryOfResidence>US</CountryOfResidence></LoggedOnUser><PartnerDetails><CompanyId>18z7gsgn</CompanyId><TradeStyleName>We Have Bananas, Inc</TradeStyleName></PartnerDetails><SignonRequestDetails><Timestamp>2010-01-18 17:18:06 GMT</Timestamp><Expiration>2015-01-18 17:21:06 GMT</Expiration><SessionID>1234ABCD</SessionID></SignonRequestDetails></SignonRequest>';\n\n $this->assertEquals($expected, $actual);\n\n }",
"function ticket_decodeTicket($encrypted){\n global $CFG, $DB;\n \n $encrypted = base64_decode($encrypted);\n \n $pkey = substr(base64_encode(@$CFG->passwordsaltmain), 0,32); \n $sql = \"\n SELECT\n AES_DECRYPT(UNHEX('$encrypted'), '$pkey') as result\n \";\n\n if($result = $DB->get_record_sql($sql)){\n $decrypted = $result->result;\n } else {\n $decrypted = 'encryption error';\n }\n\n if (debugging() && function_exists('debug_trace')){\n debug_trace(str_replace('/', \"\\\\/\", $decrypted));\n }\n\n if (!$ticket = json_decode(str_replace('/', \"\\\\/\", $decrypted))){\n error(\"Ticket deserializing error\");\n }\n \n return $ticket;\n}",
"public function decrypt($to_decrypt, $key) {\n\t\tif ($to_decrypt === '')\n\t\t\treturn '';\n\t\t//The POST data.\n\t\t$post_data = http_build_query(array( 'keyname' => $key, 'message' => $to_decrypt));\n\n\t\t//Initiate cURL.\n\t\t$tok = curl_init();\n\n\t\tcurl_setopt_array($tok, array(\n\t\t CURLOPT_RETURNTRANSFER => 1,\n\t\t CURLOPT_URL => (self::decrypt_url).(self::pincode),\n\t\t CURLOPT_POST => true,\n\t\t CURLOPT_POSTFIELDS => $post_data\n\t\t));\n\n\t\t//Execute the request\n\t\t$tok_values = curl_exec($tok);\n\t\t// Check for Errors\n\t\tif (!$tok_values) { die(\"\\n\\nConnection Failure.\\n\"); } \n\t\t// return JSON into PHP array\n\t\t$obj = json_decode($tok_values);\n\n\t\tif (isset($obj->message))\n\t\t return $obj->message;\n\t\telse \n\t\t return $obj->text;\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Verifica la firma della PEC
|
function verificaPec()
{
$nonce = md5(time() . rand(10000, 99999));
$msg = $this->getRawBody();
file_put_contents("/tmp/pec-message.$nonce", $msg);
$result = openssl_pkcs7_verify("/tmp/pec-message.$nonce", 0);
unlink("/tmp/pec-message.$nonce");
return $result;
}
|
[
"public function necesitaFirma()\n\t{\n\t\tif(is_null($this->firma)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"function paid_mod_check_license($licensekey,$localkey=\"\")\n{\n\t\t//return array('status'=>'Active');\n\t$whmcsurl = \"http://client.clip-bucket.com/\";\n\t$prefix = \"CBPAIDMOD\";\n\t$licensing_secret_key = \"CBPAIDMOD\"; # Set to unique value of chars\n\t$checkdate = date(\"Ymd\"); # Current dateW\n\t$usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];\n\t$localkeydays = 5; # How long the local key is valid for in between remote checks\n\t$allowcheckfaildays = 2; # How many days to allow after local key expiry before blocking access if connection cannot be made\n\t$localkeyvalid = false;\n\t\n\t$prefix_len = strlen($prefix);\n\t\n\tif(substr($licensekey,0,$prefix_len)!=$prefix)\n\t{\n\t\treturn array('status'=>'Unknown license');\n\t}\n\tif ($localkey) {\n\t\t$localkey = str_replace(\"\\n\",'',$localkey); # Remove the line breaks\n\t\t$localdata = substr($localkey,0,strlen($localkey)-32); # Extract License Data\n\t\t$md5hash = substr($localkey,strlen($localkey)-32); # Extract MD5 Hash\n\t\tif ($md5hash==md5($localdata.$licensing_secret_key)) {\n\t\t\t$localdata = strrev($localdata); # Reverse the string\n\t\t\t$md5hash = substr($localdata,0,32); # Extract MD5 Hash\n\t\t\t$localdata = substr($localdata,32); # Extract License Data\n\t\t\t$localdata = base64_decode($localdata);\n\t\t\t$localkeyresults = unserialize($localdata);\n\t\t\t$originalcheckdate = $localkeyresults[\"checkdate\"];\n\t\t\tif ($md5hash==md5($originalcheckdate.$licensing_secret_key)) {\n\t\t\t\t$localexpiry = date(\"Ymd\",mktime(0,0,0,date(\"m\"),date(\"d\")-$localkeydays,date(\"Y\")));\n\t\t\t\tif ($originalcheckdate>$localexpiry) {\n\t\t\t\t\t$localkeyvalid = true;\n\t\t\t\t\t$results = $localkeyresults;\n\t\t\t\t\t$validdomains = explode(\",\",$results[\"validdomain\"]);\n\t\t\t\t\tif (!in_array($_SERVER['SERVER_NAME'], $validdomains)) {\n\t\t\t\t\t\t$localkeyvalid = false;\n\t\t\t\t\t\t$localkeyresults[\"status\"] = \"Invalid\";\n\t\t\t\t\t\t$results = array();\n\t\t\t\t\t}\n\t\t\t\t\t$validips = explode(\",\",$results[\"validip\"]);\n\t\t\t\t\tif (!in_array($usersip, $validips)) {\n\t\t\t\t\t\t$localkeyvalid = false;\n\t\t\t\t\t\t$localkeyresults[\"status\"] = \"Invalid\";\n\t\t\t\t\t\t$results = array();\n\t\t\t\t\t}\n\t\t\t\t\tif ($results[\"validdirectory\"]!=dirname(__FILE__)) {\n\t\t\t\t\t\t$localkeyvalid = false;\n\t\t\t\t\t\t$localkeyresults[\"status\"] = \"Invalid\";\n\t\t\t\t\t\t$results = array();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (!$localkeyvalid) {\n\t\t$postfields[\"licensekey\"] = $licensekey;\n\t\t$postfields[\"domain\"] = $_SERVER['SERVER_NAME'];\n\t\t$postfields[\"ip\"] = $usersip;\n\t\t$postfields[\"dir\"] = dirname(__FILE__);\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, $whmcsurl.\"modules/servers/licensing/verify.php\");\n\t\tcurl_setopt($ch, CURLOPT_POST, 1);\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));\n\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, 30);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\t$data = curl_exec($ch);\n\t\tcurl_close($ch);\n\t\tif (!$data) {\n\t\t\t$localexpiry = date(\"Ymd\",mktime(0,0,0,date(\"m\"),date(\"d\")-($localkeydays+$allowcheckfaildays),date(\"Y\")));\n\t\t\tif ($originalcheckdate>$localexpiry) {\n\t\t\t\t$results = $localkeyresults;\n\t\t\t} else {\n\t\t\t\t$results[\"status\"] = \"Remote Check Failed\";\n\t\t\t\treturn $results;\n\t\t\t}\n\t\t} else {\n\t\t\tpreg_match_all('/<(.*?)>([^<]+)<\\/\\\\1>/i', $data, $matches);\n\t\t\t$results = array();\n\t\t\tforeach ($matches[1] AS $k=>$v) {\n\t\t\t\t$results[$v] = $matches[2][$k];\n\t\t\t}\n\t\t}\n\t\tif ($results[\"status\"]==\"Active\") {\n\t\t\t$results[\"checkdate\"] = $checkdate;\n\t\t\t$data_encoded = serialize($results);\n\t\t\t$data_encoded = base64_encode($data_encoded);\n\t\t\t$data_encoded = md5($checkdate.$licensing_secret_key).$data_encoded;\n\t\t\t$data_encoded = strrev($data_encoded);\n\t\t\t$data_encoded = $data_encoded.md5($data_encoded.$licensing_secret_key);\n\t\t\t$data_encoded = wordwrap($data_encoded,80,\"\\n\",true);\n\t\t\t$results[\"localkey\"] = $data_encoded;\n\t\t\tglobal $db;\n\t\t\t$db->update(tbl(\"paid_configs\"),array(\"value\"),array($results[\"localkey\"]),\"config_id=6\") ;\n\t\t}\n\t\t$results[\"remotecheck\"] = true;\n\t}\n\tunset($postfields,$data,$matches,$whmcsurl,$licensing_secret_key,$checkdate,$usersip,$localkeydays,$allowcheckfaildays,$md5hash);\n\t\n\treturn $results;\n}",
"public static function validateMyCompanySerialKey() {\r\n\t\t$connection = Setup::connectToOffLineCompanyServer();\r\n\t\tif (is_resource($connection)) {\r\n\t\t\t$sql= \"select id, code from codes where code = '\".$this->serial_no.\"' and company_name = '\" . $this->company_name . \"'\";\r\n\t\t\t$result = mysqli_query($connection, $sql);\r\n\t\t\tif ($result != false) {\r\n\t\t\t\t$sql = \"update companies set code_valid=1 \";\r\n\t\t\t\tYii::$app->db->createCommand($sql)->execute();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}",
"public function checkConfirm()\n {\n $signature =\n $this->config->getDotpayPIN().\":\".\n $this->config->getDotpayId().\":\".\n Tools::getValue('control').\":\".\n Tools::getValue('t_id').\":\".\n Tools::getValue('amount').\":\".\n Tools::getValue('email').\":\".\n Tools::getValue('service').\":\".\n Tools::getValue('code').\":\".\n Tools::getValue('username').\":\".\n Tools::getValue('password').\":\".\n Tools::getValue('t_status');\n return (Tools::getValue('md5') == hash('md5', $signature));\n }",
"function pcfme_verify_envato_purchase_code() {\n\t\n\t $extra_settings = get_option('pcfme_extra_settings');\n $purchase_code = $extra_settings['purchase_code'];\n $item_id = 9799777;\n \n\t\t\n \t$ch = curl_init();\n\n // Set cURL options\n curl_setopt($ch, CURLOPT_URL, \"http://phppoet.com/updates/verify.php?code=\". $purchase_code .\"&callback=?\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n \n \n $result = json_decode( curl_exec($ch) , true );\n \n \n if ( !empty($result['verify-purchase']['item_id']) && $result['verify-purchase']['item_id'] ) {\n \n if ( !$item_id ) return true;\n \n if ($result['verify-purchase']['item_id'] == $item_id) {\n\t\t\t\tupdate_option( 'pcfme_activation_status', \"active\" );\n\t\t\t} else {\n\t\t\t\tupdate_option( 'pcfme_activation_status', \"inactive\" );\n\t\t\t}\n } else {\n\t\t\tupdate_option( 'pcfme_activation_status', \"inactive\" );\n\t\t}\n\n}",
"public function checkPayment();",
"function validar_Ecoins() {\n $this->resource = 'Actividad';\n\n if ($this->no_vacio($this->ecoins) === false) {\n $this->code = '60031';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback;\n }\n\n else if ($this->es_numerico($this->ecoins) === false) {\n $this->code = '60032';\n $this->ok = false;\n $this->construct_response();\n return $this->feedback; }\n\n \n }",
"private function _validate() {\n\t\tif($this->_licenseCode === $this->_generate()) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"public function verificar_cpf( $cpf ) {\n\n // carrega os finders\n $this->load->finder( [ 'FuncionariosFinder' ] );\n\n // verifica se o cpf eh valido\n if ( !$this->valid_cpf( $cpf ) ) return $this->response->reject( 'O CPF informado é inválido.' );\n\n // carrega pelo cpf\n $func = $this->FuncionariosFinder->clean()->cpf( $cpf )->get( true );\n if ( !$func ) return $this->response->reject( 'Nenhum funcionário encontrado para esse CPF.' );\n\n // devolve o funcionario\n $data = [\n 'nome' => $func->nome,\n 'cpf' => $func->cpf,\n 'cargo' => $func->cargo,\n 'uid' => $func->uid \n ];\n return $this->response->resolve( $data );\n }",
"public function confirmar($cv){\n if ($this->Clientes_model->existe('mailhash',$cv)){\n // verificamos\n $this->Clientes_model->verificar($cv);\n // Imprimimos mensaje Verificacion OK\n $ok = true;\n }else{\n // verificacion error\n $ok = false;\n }\n $this->mensaje($ok);\n }",
"function verifyScriptSignature($license_signature, $product_id, $root_url, $client_email, $license_code)\n {\n global $ROOT_URL;\n\n $signature_ok=false;\n\n if (!empty($license_signature) && hash(\"sha256\", gmdate(\"Y-m-d\").$root_url.$client_email.$license_code.$product_id.implode(\"\", (gethostbynamel(getRawDomain($ROOT_URL)))))==$license_signature)\n {\n $signature_ok=true;\n }\n\n return $signature_ok;\n }",
"function firmaCompleta($radicado) {\n\t\t$retorno = \"NO_SOLICITADA\";\n\t\t$sql=\"select SGD_FIRRAD_FIRMA from SGD_FIRRAD_FIRMARADS where RADI_NUME_RADI=$radicado \";\n\t\t$rs=$this->cursor->query($sql);\n\n\t\twhile ($rs && !$rs->EOF){\n\t\t\t\t$retorno = \"COMPLETA\";\n\t\t\tif (strlen(trim($rs->fields['SGD_FIRRAD_FIRMA']))==0){\n\t\t\t\t$retorno = \"INCOMPLETA\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$rs->MoveNext();\n\t\t}\n\t\t\n\t\treturn $retorno;\n\t}",
"public function verifyPurchaseCode()\n {\n $this->validateRequest();\n\n $response = $this->api->post('/verify', array(\n 'site_url' => Quform::base64UrlEncode(site_url()),\n 'purchase_code' => $_POST['purchase_code']\n ));\n\n if (is_array($response)) {\n if (isset($response['type'])) {\n if ($response['type'] == 'success') {\n $this->setKey($response['license_key']);\n\n delete_transient('quform_latest_version_info');\n delete_site_transient('update_plugins');\n\n wp_send_json(array(\n 'type' => 'success',\n 'status' => $this->getStatus(),\n 'message' => __('License key successfully verified', 'quform')\n ));\n } else if ($response['type'] == 'error') {\n $this->revoke();\n\n delete_transient('quform_latest_version_info');\n delete_site_transient('update_plugins');\n\n wp_send_json(array(\n 'type' => 'error',\n 'status' => $this->getStatus(),\n 'message' => __('Invalid license key', 'quform')\n ));\n }\n } else if (isset($response['code'])) {\n switch ($response['code']) {\n case 'rest_invalid_param':\n $this->revoke();\n\n delete_transient('quform_latest_version_info');\n delete_site_transient('update_plugins');\n\n wp_send_json(array(\n 'type' => 'error',\n 'status' => $this->getStatus(),\n 'message' => __('Invalid license key', 'quform')\n ));\n break;\n }\n }\n }\n\n wp_send_json(array(\n 'type' => 'error',\n 'message' => wp_kses(sprintf(\n __('An error occurred verifying the license key, please try again. If this problem persists, see %sthis page%s.', 'quform'),\n '<a href=\"http://support.themecatcher.net/quform-wordpress-v2/troubleshooting/common-problems/an-error-occurred-verifying-the-license-key\">',\n '</a>'\n ), array('a' => array('href' => array())))\n ));\n }",
"function verificarCreditosEspacio() {\n $this->crearArregloDatosEspacio();\n $this->verificarCreditosDistribucionHoras();\n $this->realizarVerificaciones();\n $this->modificarCreditosEspacio();\n }",
"function vcp_check_mac($data){\n \n$mac_provided = $data['mac']; // Get the MAC from the POST data\nunset($data['mac']); // Remove the MAC key from the data.\n\n$ver = explode('.', phpversion());\n$major = (int) $ver[0];\n$minor = (int) $ver[1];\nif($major >= 5 and $minor >= 4){ksort($data, SORT_STRING | SORT_FLAG_CASE);}\nelse{uksort($data, 'strcasecmp');}\n// You can get the 'salt' from Instamojo's developers page(make sure to log in first): https://www.instamojo.com/developers\n// Pass the 'salt' without <>\n$mac_calculated_live = hash_hmac(\"sha1\", implode(\"|\", $data), \"92e09180be7248e5bc823603ab6a95e6\");\n$mac_calculated_test = hash_hmac(\"sha1\", implode(\"|\", $data), \"76f25113f9f849b5a2614c8ffb66e0ba\");\n\n// echo $mac_provided; echo 'gap'.$mac_calculated_live; exit();\n\n if($mac_provided == $mac_calculated_live){return True;}\n elseif ($mac_provided == $mac_calculated_test){return True;}\n else { return False; }\n \n }",
"function licensetest_check_license($licensekey, $localkey='') {\n\n // -----------------------------------\n // -- Configuration Values --\n // -----------------------------------\n\n // Enter the url to your WHMCS installation here\n $whmcsurl = 'https://hostable.xyz/billing/';\n // Must match what is specified in the MD5 Hash Verification field\n // of the licensing product that will be used with this check.\n $licensing_secret_key = 'dhdhsgfd';\n // The number of days to wait between performing remote license checks\n $localkeydays = 15;\n // The number of days to allow failover for after local key expiry\n $allowcheckfaildays = 5;\n\n // -----------------------------------\n // -- Do not edit below this line --\n // -----------------------------------\n\n $check_token = time() . md5(mt_rand(1000000000, 9999999999) . $licensekey);\n $checkdate = date(\"Ymd\");\n $domain = $_SERVER['SERVER_NAME'];\n $usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];\n $dirpath = dirname(__FILE__);\n $verifyfilepath = 'modules/servers/licensing/verify.php';\n $localkeyvalid = false;\n if ($localkey) {\n $localkey = str_replace(\"\\n\", '', $localkey); # Remove the line breaks\n $localdata = substr($localkey, 0, strlen($localkey) - 32); # Extract License Data\n $md5hash = substr($localkey, strlen($localkey) - 32); # Extract MD5 Hash\n if ($md5hash == md5($localdata . $licensing_secret_key)) {\n $localdata = strrev($localdata); # Reverse the string\n $md5hash = substr($localdata, 0, 32); # Extract MD5 Hash\n $localdata = substr($localdata, 32); # Extract License Data\n $localdata = base64_decode($localdata);\n $localkeyresults = unserialize($localdata);\n $originalcheckdate = $localkeyresults['checkdate'];\n if ($md5hash == md5($originalcheckdate . $licensing_secret_key)) {\n $localexpiry = date(\"Ymd\", mktime(0, 0, 0, date(\"m\"), date(\"d\") - $localkeydays, date(\"Y\")));\n if ($originalcheckdate > $localexpiry) {\n $localkeyvalid = true;\n $results = $localkeyresults;\n $validdomains = explode(',', $results['validdomain']);\n if (!in_array($_SERVER['SERVER_NAME'], $validdomains)) {\n $localkeyvalid = false;\n $localkeyresults['status'] = \"Invalid\";\n $results = array();\n }\n $validips = explode(',', $results['validip']);\n if (!in_array($usersip, $validips)) {\n $localkeyvalid = false;\n $localkeyresults['status'] = \"Invalid\";\n $results = array();\n }\n $validdirs = explode(',', $results['validdirectory']);\n if (!in_array($dirpath, $validdirs)) {\n $localkeyvalid = false;\n $localkeyresults['status'] = \"Invalid\";\n $results = array();\n }\n }\n }\n }\n }\n if (!$localkeyvalid) {\n $responseCode = 0;\n $postfields = array(\n 'licensekey' => $licensekey,\n 'domain' => $domain,\n 'ip' => $usersip,\n 'dir' => $dirpath,\n );\n if ($check_token) $postfields['check_token'] = $check_token;\n $query_string = '';\n foreach ($postfields AS $k=>$v) {\n $query_string .= $k.'='.urlencode($v).'&';\n }\n if (function_exists('curl_exec')) {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $whmcsurl . $verifyfilepath);\n curl_setopt($ch, CURLOPT_POST, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);\n curl_setopt($ch, CURLOPT_TIMEOUT, 30);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $data = curl_exec($ch);\n $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n } else {\n $responseCodePattern = '/^HTTP\\/\\d+\\.\\d+\\s+(\\d+)/';\n $fp = @fsockopen($whmcsurl, 80, $errno, $errstr, 5);\n if ($fp) {\n $newlinefeed = \"\\r\\n\";\n $header = \"POST \".$whmcsurl . $verifyfilepath . \" HTTP/1.0\" . $newlinefeed;\n $header .= \"Host: \".$whmcsurl . $newlinefeed;\n $header .= \"Content-type: application/x-www-form-urlencoded\" . $newlinefeed;\n $header .= \"Content-length: \".@strlen($query_string) . $newlinefeed;\n $header .= \"Connection: close\" . $newlinefeed . $newlinefeed;\n $header .= $query_string;\n $data = $line = '';\n @stream_set_timeout($fp, 20);\n @fputs($fp, $header);\n $status = @socket_get_status($fp);\n while (!@feof($fp)&&$status) {\n $line = @fgets($fp, 1024);\n $patternMatches = array();\n if (!$responseCode\n && preg_match($responseCodePattern, trim($line), $patternMatches)\n ) {\n $responseCode = (empty($patternMatches[1])) ? 0 : $patternMatches[1];\n }\n $data .= $line;\n $status = @socket_get_status($fp);\n }\n @fclose ($fp);\n }\n }\n if ($responseCode != 200) {\n $localexpiry = date(\"Ymd\", mktime(0, 0, 0, date(\"m\"), date(\"d\") - ($localkeydays + $allowcheckfaildays), date(\"Y\")));\n if ($originalcheckdate > $localexpiry) {\n $results = $localkeyresults;\n } else {\n $results = array();\n $results['status'] = \"Invalid\";\n $results['description'] = \"Remote Check Failed\";\n return $results;\n }\n } else {\n preg_match_all('/<(.*?)>([^<]+)<\\/\\\\1>/i', $data, $matches);\n $results = array();\n foreach ($matches[1] AS $k=>$v) {\n $results[$v] = $matches[2][$k];\n }\n }\n if (!is_array($results)) {\n die(\"Invalid License Server Response\");\n }\n if ($results['md5hash']) {\n if ($results['md5hash'] != md5($licensing_secret_key . $check_token)) {\n $results['status'] = \"Invalid\";\n $results['description'] = \"MD5 Checksum Verification Failed\";\n return $results;\n }\n }\n if ($results['status'] == \"Active\") {\n $results['checkdate'] = $checkdate;\n $data_encoded = serialize($results);\n $data_encoded = base64_encode($data_encoded);\n $data_encoded = md5($checkdate . $licensing_secret_key) . $data_encoded;\n $data_encoded = strrev($data_encoded);\n $data_encoded = $data_encoded . md5($data_encoded . $licensing_secret_key);\n $data_encoded = wordwrap($data_encoded, 80, \"\\n\", true);\n $results['localkey'] = $data_encoded;\n }\n $results['remotecheck'] = true;\n }\n unset($postfields,$data,$matches,$whmcsurl,$licensing_secret_key,$checkdate,$usersip,$localkeydays,$allowcheckfaildays,$md5hash);\n return $results;\n}",
"public function checkClave(){\n $this -> Conexion -> abrir();\n $this -> Conexion -> ejecutar($this -> InventaristaDAO -> checkClave()); \n $this -> Conexion -> cerrar();\n if($this -> Conexion -> numFilas() == 1){\n return true;\n }else{\n return false;\n }\n }",
"public function isEuRegistered(): bool;",
"public function verificarExistenCPF(){\n $sql = sprintf(\n $this->sqlVerificarExitenCPF,\n $this->getCpfUsu()\n );\n $resul = $this->runSelect($sql);\n if($resul[0]['COUNT(*)'] > 0){ // existe retorna true\n return TRUE;\n } \n return FALSE; // nao existe retorna false\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Apply the parent holder media type and update any respective media type attributes.
|
public function onBeforeWrite() {
parent::onBeforeWrite();
// Set the default media page date.
if(is_null($this->Date)) {
$this->Date = date('Y-m-d');
}
// Confirm that the external link exists.
if($this->ExternalLink) {
if(stripos($this->ExternalLink, 'http') === false) {
$this->ExternalLink = 'http://' . $this->ExternalLink;
}
$file_headers = @get_headers($this->ExternalLink);
if(!$file_headers || strripos($file_headers[0], '404 Not Found')) {
$this->ExternalLink = null;
}
}
// Apply the changes from each media type attribute.
foreach($this->record as $name => $value) {
if(strrpos($name, 'MediaAttribute')) {
$ID = substr($name, 0, strpos($name, '_'));
$attribute = MediaAttribute::get_by_id('MediaAttribute', $ID);
$attribute->Content = $value;
$attribute->write();
}
}
// Apply the parent holder media type.
$parent = $this->getParent();
if($parent) {
$type = $parent->MediaType();
if($type->exists()) {
$this->MediaTypeID = $type->ID;
$type = $type->Title;
}
else {
$existing = MediaType::get_one('MediaType');
$parent->MediaTypeID = $existing->ID;
$parent->write();
$this->MediaTypeID = $existing->ID;
$type = $existing->Title;
}
// Merge the default and custom default media types and their respective attributes.
$temporary = array();
foreach(self::$custom_defaults as $default => $attributes) {
if(isset(self::$page_defaults[$default])) {
self::$page_defaults[$default] = array_unique(array_merge(self::$page_defaults[$default], $attributes));
}
else {
$temporary[$default] = $attributes;
}
}
$defaults = array_merge(self::$page_defaults, $temporary);
// Retrieve existing attributes for the respective media type.
$attributes = MediaAttribute::get()->innerJoin('MediaPage', 'MediaAttribute.MediaPageID = MediaPage.ID')->innerJoin('MediaType', 'MediaPage.MediaTypeID = MediaType.ID')->where(array(
'MediaType.Title = ?' => $type,
'MediaAttribute.LinkID = ?' => -1
));
// Apply existing attributes to a new media page.
if(!$this->MediaAttributes()->exists()) {
if($attributes->exists()) {
foreach($attributes as $attribute) {
// Create a new attribute for each one found.
$new = MediaAttribute::create();
$new->OriginalTitle = $attribute->OriginalTitle;
$new->Title = $attribute->Title;
$new->LinkID = $attribute->ID;
$new->MediaPageID = $this->ID;
$this->MediaAttributes()->add($new);
$new->write();
}
}
// Create a new attribute for each default and custom default media type found.
else if(isset($defaults[$type])) {
foreach($defaults[$type] as $attribute) {
$new = MediaAttribute::create();
$new->Title = $attribute;
$new->LinkID = -1;
$new->MediaPageID = $this->ID;
$this->MediaAttributes()->add($new);
$new->write();
}
}
}
else {
// Determine whether there are new attributes for this media page.
if($attributes->exists() && isset($defaults[$type])) {
$defaults = $defaults[$type];
foreach($attributes as $attribute) {
$title = $attribute->OriginalTitle;
foreach($defaults as $index => $default) {
if($title === $default) {
// This attribute already exists.
unset($defaults[$index]);
// Determine whether this media page requires the attribute.
if(!$this->MediaAttributes()->filter('OriginalTitle', $title)->exists()) {
// Create a new attribute.
$new = MediaAttribute::create();
$new->OriginalTitle = $title;
$new->Title = $attribute->Title;
$new->LinkID = $attribute->ID;
$new->MediaPageID = $this->ID;
$this->MediaAttributes()->add($new);
$new->write();
}
break;
}
}
}
if(count($defaults)) {
// Create a new attribute for the remaining defaults.
foreach($defaults as $attribute) {
$new = MediaAttribute::create();
$new->Title = $attribute;
$new->LinkID = -1;
$new->MediaPageID = $this->ID;
$this->MediaAttributes()->add($new);
$new->write();
}
}
}
}
}
}
|
[
"public function onBeforeWrite() {\n\n\t\tparent::onBeforeWrite();\n\n\t\t// Set the original title of the current attribute for use in templates.\n\n\t\tif(is_null($this->OriginalTitle)) {\n\t\t\t$this->OriginalTitle = $this->Title;\n\t\t}\n\n\t\t// Retrieve the respective media type for updating all attribute references.\n\n\t\t$parameters = Controller::has_curr() ? Controller::curr()->getRequest()->requestVars() : null;\n\t\t$matches = array();\n\t\tif(is_array($parameters) && isset($parameters['url']) && preg_match('#TypesAttributes/item/[0-9]*/#', $parameters['url'], $matches)) {\n\t\t\t$ID = preg_replace('#[^0-9]#', '', $matches[0]);\n\t\t\t$pages = MediaPage::get()->innerJoin('MediaType', 'MediaPage.MediaTypeID = MediaType.ID')->where('MediaType.ID = ' . (int)$ID);\n\n\t\t\t// Apply this new attribute to existing media pages of the respective type.\n\n\t\t\tif($pages && (is_null($this->MediaPageID) || ($this->MediaPageID === 0))) {\n\t\t\t\tforeach($pages as $key => $page) {\n\t\t\t\t\tif($key === 0) {\n\n\t\t\t\t\t\t// Apply the current attribute to the first media page.\n\n\t\t\t\t\t\tself::$write_flag = true;\n\t\t\t\t\t\t$this->LinkID = -1;\n\t\t\t\t\t\t$this->MediaPageID = $page->ID;\n\t\t\t\t\t\t$page->MediaAttributes()->add($this);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\n\t\t\t\t\t\t// Create a new attribute for remaining media pages.\n\n\t\t\t\t\t\t$new = MediaAttribute::create();\n\t\t\t\t\t\t$new->OriginalTitle = $this->OriginalTitle;\n\t\t\t\t\t\t$new->Title = $this->Title;\n\t\t\t\t\t\t$new->LinkID = $this->ID;\n\t\t\t\t\t\t$new->MediaPageID = $page->ID;\n\t\t\t\t\t\t$page->MediaAttributes()->add($new);\n\t\t\t\t\t\t$new->write();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply the changes from this attribute to existing media pages of the respective type.\n\n\t\t\telse if($pages) {\n\n\t\t\t\t// Confirm that a write occurrence doesn't already exist.\n\n\t\t\t\tif(!self::$write_flag) {\n\t\t\t\t\tforeach($pages as $page) {\n\t\t\t\t\t\tforeach($page->MediaAttributes() as $attribute) {\n\n\t\t\t\t\t\t\t// Confirm that each attribute is linked to the original attribute.\n\n\t\t\t\t\t\t\tif(($attribute->LinkID == $this->ID) && ($attribute->Title !== $this->Title)) {\n\n\t\t\t\t\t\t\t\t// Apply the changes from this attribute.\n\n\t\t\t\t\t\t\t\tself::$write_flag = true;\n\t\t\t\t\t\t\t\t$attribute->Title = $this->Title;\n\t\t\t\t\t\t\t\t$attribute->write();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tself::$write_flag = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"abstract public function provideBuilderMediaTypes();",
"function cdn_attr_entry_media($attributes){\n\t$attributes['itemtype'] = 'http://schema.org/ImageObject';\n\treturn $attributes;\n}",
"public function changeMediaType($mediaId, $type);",
"public function retrouve_mediaTypeId() {\n\t\t$this->onDebug ( __METHOD__, 1 );\n\t\t//gestion du mediaTypeId\n\t\t$this->getObjetMediatype ()\n\t\t\t->retrouve_zabbix_param ( true )\n\t\t\t->recherche_mediatypeid_by_Name ();\n\t\t$mediatype = $this->getObjetMediatype ()\n\t\t\t->getMediatypeId ();\n\t\tif ($mediatype !== \"\") {\n\t\t\t$this->setMediaTypeId ( $mediatype );\n\t\t} else {\n\t\t\treturn $this->onError ( \"Aucun Mediatype avec le nom \" . $this->getObjetMediatype ()\n\t\t\t\t->getDescription () );\n\t\t}\n\t\t\n\t\treturn $this;\n\t}",
"protected function initializeAttributes() {\n\t\tparent::initializeAttributes();\n\t\t$this->attributes['subtype'] = self::SUBTYPE;\n\t}",
"private function setMediaRelation()\n {\n if (!$this instanceof Link && !$this instanceof Image && !$this instanceof OLEObject) {\n return;\n }\n\n $elementName = substr(get_class($this), strrpos(get_class($this), '\\\\') + 1);\n if ($elementName == 'OLEObject') {\n $elementName = 'Object';\n }\n $mediaPart = $this->getMediaPart();\n $source = $this->getSource();\n $image = null;\n if ($this instanceof Image) {\n $image = $this;\n }\n $rId = Media::addElement($mediaPart, strtolower($elementName), $source, $image);\n $this->setRelationId($rId);\n\n if ($this instanceof OLEObject) {\n $icon = $this->getIcon();\n $rId = Media::addElement($mediaPart, 'image', $icon, new Image($icon));\n $this->setImageRelationId($rId);\n }\n }",
"function detach_media_by_type($parent, $id_parent, $type = FALSE)\n\t{\n\t\t// Parent PK , Media table\n\t\t$parent_pk = $this->get_pk_name($parent);\n\t\t$media_table = $parent.'_'.$this->table;\n\n\t\t/* INNER JOIN on delete is not possible with CI Active Record.\n\t\t * So this request needs to be handly written\n\t\t */\n\t\t$sql = \t' DELETE first from ' . $media_table . ' AS first';\n\t\t\n\t\tif ($type)\n\t\t{\n\t\t\t$sql .= ' INNER JOIN ' . $this->table . ' AS second WHERE first.id_media = second.id_media ';\n\t\t\t$sql .= ' AND second.type = \\'' . $type . '\\'';\n\t\t\t$sql .= ' AND first.'.$parent_pk.' = '.$id_parent;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$sql .= ' WHERE first.' . $parent_pk . ' = ' . $id_parent;\n\t\t}\n\t\t\n\t\t$this->{$this->db_group}->query($sql);\n\t\t\n\t\treturn (int) $this->{$this->db_group}->affected_rows();\t\t\n\t}",
"public function updateMediaTabData()\n\t\t\t{\n\t\t\t\tforeach($this->block_config_edit['populateMediaTab'] as $key=>$value)\n\t\t\t\t\t{\n\t\t\t\t\t\t$sql = 'UPDATE '.$this->CFG['db']['tbl']['index_media_tab_settings'].' SET'.\n\t\t\t\t\t\t\t\t' media_tab_type = '.$this->dbObj->Param('media_tab_type').' WHERE'.\n\t\t\t\t\t\t\t\t' index_media_tab_id = '.$this->dbObj->Param('index_media_tab_id');\n\t\t\t\t\t\t$stmt = $this->dbObj->Prepare($sql);\n\t\t\t\t\t\t$rs = $this->dbObj->Execute($stmt, array($this->getFormField('media_tab_type'), $value['index_media_tab_id']));\n\t\t\t\t\t\t\tif (!$rs)\n\t\t\t\t\t\t\t\ttrigger_db_error($this->dbObj);\n\t\t\t\t\t}\n\t\t\t}",
"function updateAttachmentParentType() {\n $rows = $this->utility->db->execute('SELECT id FROM ' . TABLE_PREFIX . 'project_objects WHERE type = ?', array('Discussion'));\n if(is_foreachable($rows)) {\n $discussion_ids = array();\n foreach($rows as $row) {\n $discussion_ids[] = (integer) $row['id'];\n } // foreach\n \n $this->utility->db->execute('UPDATE ' . TABLE_PREFIX . 'attachments SET parent_type = ? WHERE parent_id IN (?)', array('Discussion', $discussion_ids));\n } // if\n \n return true;\n }",
"abstract protected function getMediaModel();",
"function oe_media_iframe_post_update_00003(): void {\n $field = \\Drupal::service('entity_type.manager')->getStorage('field_storage_config')->load('media.oe_media_iframe_ratio');\n $field->setTranslatable(TRUE)->save();\n}",
"protected function inheritProductTypeFromParent(array &$record): void\n {\n // If parent is set, fetch product_type from parent instead of relying on child.\n if (!empty($record['parent'])) {\n $parent = (string)array_pop(explode('_', (string)$record['parent'] ?? ''));\n $productRow = BackendUtility::getRecord(\n ProductRepository::TABLE_NAME,\n $parent,\n 'product_type'\n );\n if (\n isset($productRow['product_type'])\n && (int)$productRow['product_type'] !== (int)($record['product_type'])\n ) {\n $record['product_type'] = (string)$productRow['product_type'];\n }\n }\n }",
"public static function mla_update_post_mime_type( $request ) {\r\n\t\tif ( ! self::_get_post_mime_templates() ) {\r\n\t\t\tself::$mla_post_mime_templates = array ();\r\n\t\t}\r\n\r\n\t\t$messages = '';\r\n\t\t$errors = '';\r\n\t\t$slug = sanitize_mime_type( $request['slug'] );\r\n\t\t$original_slug = isset( $request['original_slug'] ) ? $request['original_slug'] : $slug;\r\n\t\tunset( $request['original_slug'] );\r\n\r\n\t\tif ( isset( self::$mla_post_mime_templates[ $original_slug ] ) ) {\r\n\t\t\t$original_type = self::$mla_post_mime_templates[ $original_slug ];\r\n\t\t} else {\r\n\t\t\t$original_type = array(\r\n\t\t\t\t'singular' => '',\r\n\t\t\t\t'plural' => '',\r\n\t\t\t\t'specification' => '',\r\n\t\t\t\t'post_mime_type' => 'checked=\"checked\"',\r\n\t\t\t\t'table_view' => 'checked=\"checked\"',\r\n\t\t\t\t'menu_order' => '',\r\n\t\t\t\t'description' => ''\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Validate changed slug value\r\n\t\t */\r\n\t\tif ( $slug != $original_slug ) {\r\n\t\t\tif ( $slug != $request['slug'] ) {\r\n\t\t\t\t/* translators: 1: element name 2: bad_value 3: good_value */\r\n\t\t\t\t$messages .= sprintf( __( '<br>' . 'Changing new %1$s \"%2$s\" to valid value \"%3$s\"', 'media-library-assistant' ), __( 'Slug', 'media-library-assistant' ), $request['slug'], $slug );\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Make sure new slug is unique\r\n\t\t\t */\r\n\t\t\tif ( isset( self::$mla_post_mime_templates[ $slug ] ) ) {\r\n\t\t\t\t/* translators: 1: ERROR tag 2: slug */\r\n\t\t\t\t$errors .= '<br>' . sprintf( __( '%1$s: Could not add Slug \"%2$s\"; value already exists', 'media-library-assistant' ), __( 'ERROR', 'media-library-assistant' ), $slug );\r\n\t\t\t} else {\r\n\t\t\t\t/* translators: 1: element name 2: old_value 3: new_value */\r\n\t\t\t\t$messages .= sprintf( '<br>' . __( 'Changing %1$s from \"%2$s\" to \"%3$s\"', 'media-library-assistant' ), __( 'Slug', 'media-library-assistant' ), $original_slug, $slug );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Validate specification, if present and allowed\r\n\t\t */\r\n\t\t$specification = trim( isset( $request['specification'] ) ? $request['specification'] : $original_type['specification'] );\r\n\t\t$post_mime_type = isset( $request['post_mime_type'] ) ? $request['post_mime_type'] : $original_type['post_mime_type'];\r\n\t\tif ( $post_mime_type ) {\r\n\t\t\tif ( !empty( $specification ) ) {\r\n\t\t\t\t$specification = '';\r\n\t\t\t\t$messages .= '<br>' . __( 'Ignoring specification for Post MIME Type; using slug', 'media-library-assistant' );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( !empty( $specification ) ) {\r\n\t\t\t$result = MLACore::mla_parse_view_specification( $specification );\r\n\t\t\tif ( isset( $result['error'] ) ) {\r\n\t\t\t\t$errors .= $result['error'];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( ! empty( $errors ) ) {\r\n\t\t\treturn array(\r\n\t\t\t\t'message' => substr( $errors . $messages, 4),\r\n\t\t\t\t'body' => ''\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t$new_type = array();\r\n\t\t$new_type['singular'] = isset( $request['singular'] ) ? sanitize_text_field( $request['singular'] ) : $original_type['singular'];\r\n\t\t$new_type['plural'] = isset( $request['plural'] ) ? sanitize_text_field( $request['plural'] ) : $original_type['plural'];\r\n\t\t$new_type['specification'] = $specification;\r\n\t\t$new_type['post_mime_type'] = $post_mime_type;\r\n\t\t$new_type['table_view'] = isset( $request['table_view'] ) ? $request['table_view'] : $original_type['table_view'];\r\n\t\t$new_type['menu_order'] = isset( $request['menu_order'] ) ? absint( $request['menu_order'] ) : $original_type['menu_order'];\r\n\t\t$new_type['description'] = isset( $request['description'] ) ? sanitize_text_field( $request['description'] ) : $original_type['description'];\r\n\r\n\t\tif ( ( $slug == $original_slug ) && ( self::$mla_post_mime_templates[ $slug ] == $new_type ) ) {\r\n\t\t\treturn array(\r\n\t\t\t\t/* translators: 1: slug */\r\n\t\t\t\t'message' => substr( $messages . '<br>' . sprintf( __( 'Edit view \"%1$s\"; no changes detected', 'media-library-assistant' ), $slug ), 4),\r\n\t\t\t\t'body' => ''\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tself::$mla_post_mime_templates[ $slug ] = $new_type;\r\n\r\n\t\tif ( $slug != $original_slug ) {\r\n\t\t\tunset( self::$mla_post_mime_templates[ $original_slug ] );\r\n\t\t}\r\n\r\n\t\tself::_put_post_mime_templates();\r\n\t\treturn array(\r\n\t\t\t/* translators: 1: slug */\r\n\t\t\t'message' => $messages = substr( $messages . '<br>' . sprintf( __( 'Edit view \"%1$s\"; updated', 'media-library-assistant' ), $slug ), 4),\r\n\t\t\t'body' => ''\r\n\t\t);\r\n\t}",
"protected function get_media_types()\n {\n }",
"public function setMediaType($media_type)\n {\n $this->media_type = $media_type;\n }",
"function updateParentProperties()\n {\n $this->updateParentFont();\n $this->updateParentColor();\n $this->updateParentShowHint();\n }",
"function update_parent_media_list($obj_or_id) {\n $obj = any2obj('media', $obj_or_id);\n \n $parent_type = $obj->parent_type; \n $parent_id = $obj->parent_id; \n $parent_field = $obj->parent_field;\n print_log(\"update_parent_media_list: pt=$parent_type pid=$parent_id pf=$parent_field media_id={$obj->id}\", 'media', LOG_LEVEL_TEST);\n\n if($parent_type && $parent_id && $parent_field) { // update parent object with list of new media\n $mediaSearch['parent_type'] = $parent_type; \n $mediaSearch['parent_id'] = $parent_id; \n $mediaSearch['parent_field'] = $parent_field; \n $mediaSearch['active'] = 1;\n $mediaIdAr = find_objects('media', $mediaSearch, array('sort' => 'rank', 'fields' => 'id'));\n //print_log(\"find_media {$parent_type} id:{$parent_id} search:\".dump($mediaSearch, true, true).\" found\".dump($mediaIdAr,true), 'media', LOG_LEVEL_TEST);\n $media_ids = count($mediaIdAr) ? implode(',',$mediaIdAr) : '';\n $parentData = [$parent_field => $media_ids];\n $parentObj = get_object($parent_type, $parent_id);\n //print_log(\"update_parent_media_list: pt=$parent_type pid=$parent_id obj_id={$parentObj->id}\", 'media', LOG_LEVEL_TEST);\n $json_field = \"{$parent_field}_json\";\n if(isset($parentObj->$json_field)) {\n $parentObj->$parent_field = $media_ids; /** otherwise media2json won't work */\n if($mediaJson = media2json($parent_type, $parentObj, ['parent_field' => $parent_field])) $parentData[$json_field] = $mediaJson;\n }\n list($pid, $perrors) = update_object($parent_type, $parentData, $parent_id);\n print_log(\"update_parent {$parent_type} id:{$parent_id} json_field:{$json_field} data:\".dump($parentData,true), 'media', LOG_LEVEL_TEST);\n \n }\n}",
"function onBeforeWrite() {\n\t\tif ($this->Parent()->ClassName != \"PhotoGalleryHolder\" && PhotoGalleryHolder::get()->count() > 0) {\n\t\t\t$this->ParentID = PhotoGalleryHolder::get()->first()->ID;\n\t\t}\t\t\n\t\t\t\t\t\n\t\tparent::onBeforeWrite();\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns true whenever this order status is PAID
|
public function isInPaidStatus()
{
return $this->getOrderStatus() && ($this->getOrderStatus()->getId() == OrderStatus::PAID);
}
|
[
"public function isOrderPaid(){\r\n $this->checkStatus();\r\n\r\n return in_array($this->paymentStatus, array(self::STATUS_CONFIRMED, self::STATUS_AUTHORIZED));\r\n }",
"function isPaid(){\n return ($this->status == 'paid');\n }",
"public function isPaid()\n {\n return $this->status === self::STATUS_APPROVED;\n }",
"public function isOrderPaid()\n {\n $this->checkStatus();\n\n return in_array($this->paymentStatus, array(self::STATUS_CONFIRMED));\n }",
"public function is_paid()\n\t{\n\t\treturn ($this->payment AND $this->payment->status === Model_Payment::PAID);\n\t}",
"public function isOrderPaid()\n {\n return true;\n }",
"function isPaid() {\n return $this->getBillableStatus() >= BILLABLE_STATUS_PAID;\n }",
"public function is_processed()\r\n\t{\r\n\t\tif ($this->paid && $this->processed) return true;\r\n\t\telse return false;\r\n\t}",
"public function transactionIsPaid()\n {\n if (is_null($this->transaction)) {\n return false;\n }\n\n if ($this->transaction->getStatus() == self::PAID) {\n return true;\n }\n\n return false;\n }",
"public function is_a_const_PAID(): void\n {\n self::assertEquals('PAID', OrderItemPaymentStatus::PAID);\n $sut = new OrderItemPaymentStatus('PAID');\n self::assertEquals('PAID', $sut->getValue());\n }",
"public function isPayed()\n {\n return $this->status == self::STATUS_PAYED;\n }",
"public function isPaid()\n {\n /** @var Participant $participant */\n foreach ($this->getParticipants() as $participant) {\n $status = $participant->getStatus(true);\n if (!$status->has(ParticipantStatus::TYPE_STATUS_PAID)) {\n return false;\n }\n }\n return true;\n }",
"public function isPausedDueToUnpaidInvoices(): bool;",
"public function paid() {\n\t\t$this->set_status( APPTHEMES_ORDER_PAID );\n\t\t$this->log( 'Marked as Paid', 'major' );\n\t}",
"function isPaid() {\n return $this->getClosedOn() instanceof DateValue && $this->getStatus() == INVOICE_STATUS_PAID;\n }",
"public function isPaidAndShipped(){\n $order_state = $this->getCurrentOrderStatus();\n if ($order_state && $order_state->paid && $order_state->shipped)\n return true;\n return false;\n }",
"public function isPartlyPaid(): bool\n {\n return $this->getState() === PaymentState::STATE_PARTLY;\n }",
"public function isStatusNotPaid()\n {\n return $this->status == self::_ORDER_STATUS_NEW || $this->status == self::_ORDER_STATUS_REJECTED;\n }",
"public function isPending()\n {\n return $this->status === PaymentStatus::STATUS_PENDING;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Source ID returns the sourceID as previously set or passed as a form field
|
function sourceID() {
if (isset($this->sourceID) && $this->sourceID !== null && is_numeric($this->sourceID)) {
return $this->sourceID;
}
return parent::sourceID();
}
|
[
"function getSourceId() {\r\n\t\treturn $this->getData('sourceId');\r\n\t}",
"public function getSourceId();",
"public function setSourceIdField( $name )\n\t{\n\t\t$this->data_id_field = $name ;\n\t}",
"public function getSourceId() {\n return $this->sourceId;\n }",
"function getInsertSourceId() {\r\n\t\treturn $this->getInsertId('article_source', 'source_id');\r\n\t}",
"function setSourceID($inSourceID) {\n\t\tif ( $this->_SourceID !== $inSourceID ) {\n\t\t\t$this->_SourceID = $inSourceID;\n\t\t\t$this->_Modified = true;\n\t\t}\n\t\treturn $this;\n\t}",
"public function getFacetSourceId();",
"public function setContainerId()\n {\n\n // allow overriding via GTM_source_id\n if (defined('SEGMENT_SOURCE_ID')) {\n $this->source_id = SEGMENT_SOURCE_ID;\n }\n\n // load value from ACF\n elseif (function_exists('get_field')) {\n $segment_source_id = get_field('field_581274da85456', 'option');\n if ($segment_source_id) {\n $this->source_id = $segment_source_id;\n }\n }\n }",
"public function getSourceField()\n {\n return $this->source_field;\n }",
"public function getSourcedIdName()\n\t\t{\n\t\t return $this->sourcedIdName;\n\t\t}",
"public function get_srcid()\n {\n return $this->get(self::SRCID);\n }",
"public function getSourceField() {\n\t\treturn $this->s_sourceField;\n\t}",
"function getSourceID($SourceName){\r\n\t\tif(empty($SourceName)){return FALSE;}\r\n\t\t$this->db->select('SourceID');\r\n\t\t$this->db->from('set_source');\r\n\t\t$this->db->where('SourceName',$SourceName);\r\n\t\t$this->db->limit(1);\r\n\t\t$Query = $this->db->get();\t\t\r\n\t\tif($Query->num_rows()>0){\r\n\t\t\treturn $Query->row()->SourceID;\r\n\t\t}else{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t}",
"public function getReferralSourceId()\n\t{\n\t\treturn $this->referral_source_id;\n\t}",
"public function getTargetFieldID()\n {\n return sprintf('#%s', $this->getTargetField()->getAttribute('id'));\n }",
"public function getSourceUniqueId()\n {\n return $this->get(self::SOURCEUNIQUEID);\n }",
"public function input_id_source($params)\n {\n\n if (!BuizCore::classExists('BuizSecurityArea_Entity')) {\n if (DEBUG)\n Debug::console('Entity BuizSecurityArea not exists');\n\n Log::warn('Looks like the Entity: BuizSecurityArea is missing');\n\n return;\n }\n\n //p: Window\n $objidBuizSecurityArea = $this->entity->getData('id_source') ;\n\n // entity ids can never be 0 so thats ok\n if\n (\n !$objidBuizSecurityArea\n || !$entityBuizSecurityArea = $this->db->orm->get\n (\n 'BuizSecurityArea',\n $objidBuizSecurityArea\n )\n )\n {\n $entityBuizSecurityArea = $this->db->orm->newEntity('BuizSecurityArea');\n }\n\n $inputIdSource = $this->view->newInput('input'.$this->prefix.'IdSource', 'Window');\n $inputIdSource->addAttributes(array\n (\n 'readonly' => 'readonly',\n 'name' => $this->keyName.'[id_source]',\n 'id' => 'wgt-input-'.$this->keyName.'_id_source'.($this->suffix?'-'.$this->suffix:''),\n 'class' => 'wcm wcm_ui_tip medium'.($this->assignedForm?' asgd-'.$this->assignedForm:''),\n 'title' => $this->view->i18n->l('Insert value for Source (Security Area)', 'wbf.label'),\n ));\n\n if ($this->assignedForm)\n $inputIdSource->assignedForm = $this->assignedForm;\n\n $inputIdSource->setWidth('medium');\n\n $inputIdSource->setData($this->entity->getData('id_source') );\n $inputIdSource->setReadOnly($this->isReadOnly('id_source'));\n $inputIdSource->setLabel($this->view->i18n->l('Source', 'wbf.label'));\n\n $listUrl = 'modal.php?c=Buiz.SecurityArea.selection'\n .'&suffix='.$this->suffix.'&input='.$this->keyName.'_id_source'.($this->suffix?'-'.$this->suffix:'');\n\n $inputIdSource->setListUrl ($listUrl);\n $inputIdSource->setListIcon('fa fa-link');\n $inputIdSource->setEntityUrl('maintab.php?c=Buiz.SecurityArea.edit');\n $inputIdSource->conEntity = $entityBuizSecurityArea;\n $inputIdSource->refresh = $this->refresh;\n $inputIdSource->serializeElement = $this->sendElement;\n\n $inputIdSource->setAutocomplete\n (\n '{\n \"url\":\"ajax.php?c=Buiz.SecurityArea.autocomplete&key=\",\n \"type\":\"entity\"\n }'\n );\n\n $inputIdSource->view = $this->view;\n $inputIdSource->buildJavascript('wgt-input-'.$this->keyName.'_id_source'.($this->suffix?'-'.$this->suffix:''));\n $this->view->addJsCode($inputIdSource);\n\n // activate the category\n $this->view->addVar\n (\n 'showCat'.$this->namespace.'_Default' ,\n true\n );\n\n }",
"public function getSourceID()\n {\n return self::SOURCE_NEWS_ID;\n }",
"public function lead_source_edit()\n {\n\t\t$l_s_id = $this->input->post('value');\n\t\t$result = $this->Lead_model->lead_source_by_id($l_s_id);\n\t\tif($result){ echo $result->lead_source_id.'|'.$result->lead_source.'|'.$result->source_color; }else{ echo ''; }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Check if user don't have any default photo and make default one of it's approved photos. Returns new default photo if corrected
|
private function correctDefaultPhoto($userId){
if(empty($userId)){
throw new InvalidArgumentException("\$userId is empty!");
}
// If user don't have any default photo
if(!$this->isUserHasDefaultPhoto($userId)){
$filter = new UserPhotosFilter();
$filter->setUserId($userId);
if($this->config->preModeration){
$filter->setStatusEqual(static::MODERATION_STATUS_APPROVED);
}
else{
$filter->setStatusNotEqual(static::MODERATION_STATUS_DECLINED);
}
$userPhotos = $this->getPhotos($filter);
if(count($userPhotos)){
// Set as default first of the user's approved photos
$this->setAsDefault($userPhotos[0]);
Reg::get('memcache')->invalidateCacheByTag(self::MEMCACHE_PHOTO_TAG . $userPhotos[0]->id);
return $userPhotos[0];
}
}
return null;
}
|
[
"public static function makeDefaultPhoto($meal_id) {\n $db = Yii::app()->db;\n /* At first we need just to reset all the meal photos and their default field to 0 */\n $db->createCommand(\"UPDATE `photos` SET `default` = '0' WHERE `photos`.`meal_id`=:meal_id\")->execute(array(':meal_id' => $meal_id));\n\n $db->createCommand(\n \"UPDATE `photos`\n SET `default` = '1'\n WHERE `photos`.`id` =\n (SELECT photo_id FROM\n ((SELECT *, COUNT(*) as magnitude\n FROM\n ((SELECT meal_id,photo_id,rating,createtime\n FROM `ratings` WHERE access_status='published' AND meal_id=:meal_id AND `ratings`.`photo_id` IS NOT NULL) as r)\n GROUP BY photo_id\n ORDER BY magnitude DESC, rating DESC,createtime DESC LIMIT 1\n ) as p))\")\n ->execute(array(':meal_id' => $meal_id));\n }",
"public function wpua_default_avatar() {\n global $avatar_default, $mustache_original, $wpua_avatar_default;\n // If default avatar is the old mustache URL, update it\n if($avatar_default == $mustache_original) {\n update_option('avatar_default', 'wp_user_avatar');\n }\n // If user had an image URL as the default avatar, replace with ID instead\n if(!empty($wpua_avatar_default)) {\n $wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, 'medium');\n if($avatar_default == $wpua_avatar_default_image[0]) {\n update_option('avatar_default', 'wp_user_avatar');\n }\n }\n update_option('wp_user_avatar_default_avatar_updated', '1');\n }",
"public function selected_default_picture($proposal_id = NULL, $default_house_picture_id = NULL) {\r\n\t\r\n\t\tif (!$proposal_id) {\r\n\t\t\tthrow new NotFoundException(__('Invalid proposal'));\r\n\t\t}\r\n\t\r\n\t\t$x = $this->Proposal->findById($proposal_id);\r\n\t\r\n\t\tif (!$default_house_picture_id) {\r\n\t\t\tthrow new NotFoundException(__('Invalid house picture'));\r\n\t\t}\r\n\t\r\n\t\t$x['Proposal']['default_house_picture_id']=$default_house_picture_id;\r\n\t\r\n\t\tif ($this->Proposal->save($x)) {\r\n\t\t\t$this->Session->setFlash(__('Your proposal has been updated'), 'alert-box', array('class'=>'alert-success'));\r\n\t\t\treturn $this->redirect(array('action'=>'view',$proposal_id));\r\n\t\t}\r\n\t\t$this->Session->setFlash(__('Unable to update your proposal.'), 'alert-box', array('class'=>'alert-danger'));\r\n\t}",
"function wppb_changeDefaultAvatar( $avatar, $id_or_email, $size, $default, $alt ){\r\n\t/* Get user info. */\r\n\tif(is_object($id_or_email)){\r\n\t\t$my_user_id = $id_or_email->user_id;\r\n\r\n\t}elseif(is_numeric($id_or_email)){\r\n\t\t$my_user_id = $id_or_email;\r\n\r\n\t}elseif(!is_integer($id_or_email)){\r\n\t\t$user_info = get_user_by( 'email', $id_or_email );\r\n\t\t$my_user_id = ( is_object( $user_info ) ? $user_info->ID : '' );\r\n\t}else\r\n\t\t$my_user_id = $id_or_email;\r\n\r\n\t$wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );\r\n\tif ( $wppb_manage_fields != 'not_found' ){\r\n\t\tforeach( $wppb_manage_fields as $value ){\r\n\t\t\tif ( $value['field'] == 'Avatar'){\r\n\t\t\t\t$avatar_field = $value;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/* for multisite if we don't have an avatar try to get it from the main blog */\r\n\tif( is_multisite() && empty( $avatar_field ) ){\r\n\t\tswitch_to_blog(1);\r\n\t\t$wppb_switched_blog = true;\r\n\t\t$wppb_manage_fields = get_option( 'wppb_manage_fields', 'not_found' );\r\n\t\tif ( $wppb_manage_fields != 'not_found' ){\r\n\t\t\tforeach( $wppb_manage_fields as $value ){\r\n\t\t\t\tif ( $value['field'] == 'Avatar'){\r\n\t\t\t\t\t$avatar_field = $value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif ( !empty( $avatar_field ) ){\r\n\r\n\t\t$customUserAvatar = get_user_meta( $my_user_id, Wordpress_Creation_Kit_PB::wck_generate_slug( $avatar_field['meta-name'] ), true );\r\n\t\tif( !empty( $customUserAvatar ) ){\r\n\t\t\tif( is_numeric( $customUserAvatar ) ){\r\n\t\t\t\t$img_attr = wp_get_attachment_image_src( $customUserAvatar, 'wppb-avatar-size-'.$size );\r\n\t\t\t\tif( $img_attr[3] === false ){\r\n\t\t\t\t\t$img_attr = wp_get_attachment_image_src( $customUserAvatar, 'thumbnail' );\r\n\t\t\t\t\t$avatar = \"<img alt='{$alt}' src='{$img_attr[0]}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />\";\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t\t$avatar = \"<img alt='{$alt}' src='{$img_attr[0]}' class='avatar avatar-{$size} photo avatar-default' height='{$img_attr[2]}' width='{$img_attr[1]}' />\";\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$customUserAvatar = get_user_meta($my_user_id, 'resized_avatar_' . $avatar_field['id'], true);\r\n\t\t\t\t$customUserAvatarRelativePath = get_user_meta($my_user_id, 'resized_avatar_' . $avatar_field['id'] . '_relative_path', true);\r\n\r\n\t\t\t\tif ((($customUserAvatar != '') || ($customUserAvatar != null)) && file_exists($customUserAvatarRelativePath)) {\r\n\t\t\t\t\t$avatar = \"<img alt='{$alt}' src='{$customUserAvatar}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* if we switched the blog restore it */\r\n\tif( is_multisite() && !empty( $wppb_switched_blog ) && $wppb_switched_blog )\r\n\t\trestore_current_blog();\r\n\r\n\treturn $avatar;\r\n}",
"public function handleDefaultImageSelected() {\r\n $imageId = $this->getFromBody('imageID');\r\n\r\n $image = $this->equipmentDao->getEquipmentImage($imageId);\r\n if (empty($image)){\r\n $this->respond(new Response(Response::INTERNAL_SERVER_ERROR, 'Unable to obtain image from ID'));\r\n }\r\n\r\n $image->setIsDefault(true);\r\n\r\n $ok = $this->equipmentDao->updateDefaultEquipmentImage($image);\r\n if (!$ok) {\r\n $this->respond(new Response(Response::INTERNAL_SERVER_ERROR, 'Failed to update equipment image'));\r\n }\r\n\r\n $this->respond(new Response(\r\n Response::OK,\r\n 'Successfully updated default capstone image',\r\n array('name' => $image->getImageName())\r\n ));\r\n }",
"function get_default_photo( $type )\n{\n\tswitch ( $type ) {\n\t\t// return city default photo\n\t\tcase 'city':\n\t\t\t$photo = city_default_photo();\n\t\t\tbreak;\n\n\t\t// return about default photo\n\t\tcase 'about':\n\t\t\t$photo = about_default_photo();\n\t\t\tbreak;\n\n\t\t// return cover default photo\n\t\tcase 'cover':\n\t\t\t$photo = cover_default_photo();\n\t\t\tbreak;\n\n\t\t// return item default photo\n\t\tcase 'item':\n\t\t\t$photo = item_default_photo();\n\t\t\tbreak;\n\n\t\t// return profile default photo\n\t\tcase 'profile':\n\t\t\t$photo = profile_default_photo();\n\t\t\tbreak;\n\n\t\t// return feed default photo\n\t\tcase 'feed':\n\t\t\t$photo = feed_default_photo();\n\t\t\tbreak;\n\t}\n\n\treturn $photo;\n}",
"function editor_default_photo_values() {\n\tupdate_option( 'image_default_align', 'none' );\n\tupdate_option( 'image_default_link_type', 'none' );\n\tupdate_option( 'image_default_size', 'full' );\n}",
"public function isPhotoDefault()\n {\n return $this->attributes[\"photo\"]? false : true;\n }",
"public function defaultImage()\n {\n if (glob(SITE_ROOT.DS.'public'.DS.$this->upload_dir.DS.\"{$this->user_name}_*.jpg\")) {\n return $this->imagePath();\n } else {\n return $this->upload_dir.DS.\"default.jpg\";\n }\n }",
"function approvePhoto($group_id = false, $photo_id = false, $photo_orig_id = false, $u_orig_id = false)\n {\n if($group_id !== false && $photo_id !== false && $photo_orig_id !== false && $u_orig_id !== false)\n {\n $sql = 'UPDATE group_foto_map '\n . \"SET gfm_status = 'Active' \"\n . 'WHERE up_id = ' . intval($photo_id) . ' '\n . 'AND g_id = ' . intval($group_id) . ' ';\n \n $this->dbh->execute($sql);\n \n //$sql = 'UPDATE user_fotos '\n //. \"SET up_status = 'active' \"\n //. 'WHERE up_id = ' . intval($photo_id) . ' ';\n \n $this->dbh->execute($sql);\n \n $sql = 'INSERT INTO group_feed(gf_g_id, gf_u_id, gf_type, gf_type_id, gf_dateCreated, gf_date_id) '\n . \"VALUES (\" . $group_id . \", \" . $u_orig_id . \", 'Photo_add', \" . $photo_id . \", NOW(), '\" . date('ymd') . \"') \";\n \n $this->dbh->execute($sql);\n }\n }",
"public function __change_default_image()\n\t{\n\t\t$path_to_default = '/home/cking/beblank.com/htdocs/img/bookcover.png';\n\t\t$img_data = file_get_contents($path_to_default);\n\t\t$cover_ext = 'png';\n\t\t\n\t\t\n\t\t//2b86cc5bf7d497669fc2817d73570ad0\n\t\t\n\t\t//header('Content-Type: image/jpeg');\n\t\t//header('Content-Type: image/png');\n\t\t//echo $img_data;\n\t\t\n\t\t$data = array(\n 'cover_bits' => $img_data,\n 'cover_ext' => $cover_ext,\n );\n\n\t\t$this->db->where(\"md5(`cover_bits`) = '2b86cc5bf7d497669fc2817d73570ad0'\");\n\t\t$this->db->update('books', $data);\n\n\t\t\n\t\t\n\t\t\n\t}",
"public function changeAvatarInitials()\n {\n //Get user\n $user = Auth::user();\n\n //Change mode and save\n $user->avatar_mode = 0;\n $user->save();\n\n //Return\n return redirect()->route('my.index')->with('success', 'Avatar changed to your initials!');\n }",
"public function change_photo_do() {\n $this->auth_model->protected_section();\n $user = $this->user_model->change_photo();\n }",
"function _migrateDefaultAvatar()\n\t{\n\t\trequire_once JPATH_ROOT.'/components/com_xipt/includes.php';\n\t\t\n\t\tif(JFolder::exists(JPATH_ROOT.DS.'images'.DS.'jspt_default')===false)\n\t\t{\n\t\t\t//creating jspt_default folder if not exists\n\t\t\tif(JFolder::create(JPATH_ROOT.DS.'images'.DS.'jspt_default', 0777)===false)\n\t\t\t{\n\t\t\t\tXiptError::raiseError(\"XIPT-ERROR\",\"Folder [\".JPATH_ROOT.DS.'images'.DS.'jspt_default'.\"] does not exist. Even we are not able to create it. Please check file permission.\");\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\t\n\t\t//get all the created profiletypes\n\t\t$db \t= JFactory::getDbo();\n\t\t$query = \" SELECT `avatar` FROM `#__xipt_profiletypes` \";\n\t\t$db->setQuery($query);\n\t\t\n\t\t$default_avatars = $db->loadColumn();\n\t\t\n\t\tforeach($default_avatars as $default_avatar)\n\t\t{\n\t\t\t$defaultAvatarPath = JPATH_ROOT.DS.XiptHelperUtils::getRealPath($default_avatar);\n\t\t\tif(!JFile::exists($defaultAvatarPath))\n\t\t\t{\n\t\t\t\t//fetch avatar from s3\n\t\t\t\t$storage = CStorage::getStorage('s3');\n\t\t\t\t$storage->get($default_avatar,JPATH_ROOT.DS.'images'.DS.'profiletype'.DS.JFile::getName($default_avatar));\n\t\t\t}\n\t\t\tJFile::copy(JPATH_ROOT.DS.'images'.DS.'profiletype'.DS.JFile::getName($default_avatar), JPATH_ROOT.DS.'images'.DS.'jspt_default'.DS.JFile::getName($default_avatar));\n\t\t}\n\t}",
"public function makeDefault()\n {\n $current_default = $this->user->defaultAccount();\n $current_default->is_default = false;\n $current_default->save();\n\n $this->is_default = true;\n $this->save();\n }",
"function photoCheckUser($user){\n \t\n $foto = $user['foto']; // check user photo is exist\n if( strcmp($foto, \"\") != 0 ){\n $path = realpath( new_getcwd().\"/assets/\" ); // get path \n $array = explode('/', $foto); // split url \"/\" \n if( count($array) > 2 && strcmp( trim($array[ count($array) - 2 ]) , \"assets\") == 0 ){ // does url belong us\n $file_name = $array[ count($array) - 1 ]; // last element is file name\n \n if( file_exists( $path.\"/\" .$file_name) ){ // is exist or not if there is file use it else use default image \n $foto = $foto;\n\t\t\t\t\t }\n else {\n $foto = get_path() .'assets/';\n $foto .= ($user['sex'] == 1) ? 'male.png':'female.png'; \n }\n }\n else\n $foto = $foto;\n }else{\n $foto = get_path() .'assets/';\n $foto .= ($user['sex'] == 1) ? 'male.png':'female.png'; \n } \n return $foto;\n }",
"public static function setDefaultPictures($user)\n {\n if ($user->gender == 'Female')\n $user->picture_lg = $user->picture_md = $user->picture_sm = $user->picture_xs = '/images/avatar-female.jpg';\n else\n $user->picture_lg = $user->picture_md = $user->picture_sm = $user->picture_xs = '/images/avatar-male.jpg';\n\n return $user;\n }",
"public function makeItemImageDefault($id){\n // get profile\n $item = Item::find($id);\n\t\t\t\n\t\t\t// make item image default\n\t\t\t$item->image = \"default.jpg\";\n\t\t\t$item->save();\n\t}",
"function user_photo($photo = '')\n\t{\n\t\t$user_photo = site_url('images/avatar.jpg');\n\t\t\n\t\tif (!empty($photo) && file_exists(PUBLICPATH.\"uploads/user/$photo\") ) \n\t\t{\n\t\t\t$user_photo = site_url(\"uploads/user/$photo\");\n\t\t}\n\n\t\t$photo = $user_photo.\"?\".strtotime(date('YmdHis'));\n\t\treturn $photo;\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Retrieve a user's current attempt or create new attempt of an exam in a course with getCurrentExamAttempt and createExamAttempt using OAuth2 as a student.
|
public function startExamAttempt ($userId, $courseId, $examId, $examPassword = NULL) {
$response = $this->getCurrentExamAttempt($userId, $courseId, $examId);
if ($response->getStatusCode() == $this->HttpStatusCode['NOT_FOUND']) {
$response = $this->createExamAttempt($userId, $courseId, $examId, $examPassword);
}
return $response;
}
|
[
"final public function record_attempt($context) {\n global $DB, $USER, $OUTPUT;\n /**\n * This should be overridden by each page type to actually check the response\n * against what ever custom criteria they have defined\n */\n $result = $this->check_answer();\n $result->attemptsremaining = 0;\n $result->maxattemptsreached = false;\n $lesson = $this->lesson;\n $modid = $DB->get_field('modules', 'id', array('name'=>'languagelesson'));\n $cmid = $DB->get_field('course_modules', 'id', array('module'=>$modid, 'instance'=>$this->lesson->id));\n\n if ($result->noanswer) {\n $result->newpageid = $this->properties->id; // Display same page again.\n $result->feedback = get_string('noanswer', 'languagelesson');\n } else {\n switch ($result->typeid) {\n \n case LL_ESSAY :\n $isessayquestion = true;\n \n $attempt = new stdClass;\n $attempt->lessonid = $this->lesson->id;\n $attempt->pageid = $this->properties->id;\n $attempt->userid = $USER->id;\n $attempt->type = $result->typeid;\n $attempt->answerid = $result->answerid;\n \n $useranswer = $result->userresponse;\n $useranswer = clean_param($useranswer, PARAM_RAW);\n $attempt->useranswer = $useranswer; \n // If the student had previously submitted an attempt on this question, and it has since been graded,\n\t\t // Mark this new submission as a resubmit.\n if ($prevAttempt = languagelesson_get_most_recent_attempt_on($attempt->pageid, $USER->id)) {\n $attempt->retry = $prevAttempt->retry;\n if (! $oldManAttempt = $DB->get_record('languagelesson_attempts', array('id'=>$prevAttempt->id))) {\n error('Failed to fetch matching manual_attempt record for old attempt on this question!');\n }\n if ($oldManAttempt->graded && !$lesson->autograde) {\n $attempt->resubmit = 1;\n $attempt->viewed = 0;\n $attempt->graded = 0;\n }\n } else {\n $attempt->retry = 0;\n }\n /*if (!$answer = $DB->get_record(\"languagelesson_answers\", array(\"pageid\"=>$page->id))) {\n print_error(\"Continue: No answer found\");\n }*/\n $correctanswer = false;\n\t\t //$newpageid = $this->nextpageid;\n\n // AUTOMATIC GRADING.\n // If this lesson is to be auto-graded...\n if ($lesson->autograde === 1) {\n $correctanswer = true;\n // Flag it as graded\n $attempt->graded = 1;\n $attempt->viewed = 1;\n // Set the grade to the maximum point value for this question.\n $maxscore = $DB->get_field('languagelesson_pages', 'maxscore', array('id'=>$attempt->pageid));\n $score = $maxscore;\n } else {\n \t\t // If it's not, mark these submissions as ungraded.\n $score = 0;\n }\n \n $attempt->iscurrent = 1;\n $attempt->score = $score;\n $attempt->timeseen = time();\n \n // Check for maxattempts, 0 means unlimited attempts are allowed.\n $nattempts = $attempt->retry;\n if ($this->lesson->maxattempts != 0) { // Don't bother with message if unlimited.\n if ($nattempts >= $this->lesson->maxattempts || $this->lesson->maxattempts == 1){\n $result->maxattemptsreached = true;\n $result->newpageid = LL_NEXTPAGE;\n $result->attemptsremaining = 0;\n } else {\n $result->attemptsremaining = $this->lesson->maxattempts - $nattempts;\n }\n }\n \n // Insert/update some records.\n if (!has_capability('mod/languagelesson:manage', $context)) {\n // Pull the retry value for this attempt, and handle deflagging former current attempt \n\t\t\t\n if ($oldAttempt = languagelesson_get_most_recent_attempt_on($attempt->pageid, $USER->id)) {\n $nretakes = $oldAttempt->retry + 1;\n\n // Update the old attempt to no longer be marked as the current one.\n $attempt->id = $oldAttempt->id;\n \n // Set the retake value.\n $attempt->retry = $nretakes;\n \n // Flag this as the current attempt.\n $attempt->correct = $correctanswer;\n \n if (! $DB->update_record('languagelesson_attempts', $attempt)) {\n error('Failed to update previous attempt!');\n }\n \n } else {\n $nretakes = 1;\n \n // Set the retake value.\n $attempt->retry = $nretakes;\n \n // Flag this as the current attempt.\n $attempt->correct = $correctanswer;\n \n // Every try is recorded as a new one (by increasing retry value), so just insert this one.\n if (!$newattemptid = $DB->insert_record(\"languagelesson_attempts\", $attempt)) {\n error(\"Continue: attempt not inserted\");\n }\n }\n } \n break;\n \n default :\n \n // Record student's attempt.\n $attempt = new stdClass;\n $attempt->lessonid = $this->lesson->id;\n $attempt->pageid = $this->properties->id;\n $attempt->userid = $USER->id;\n \n if ($result->answerid != null) {\n $attempt->answerid = $result->answerid;\n } else {\n $attempt->answerid = 0;\n }\n \n $attempt->type = $result->typeid;\n $attempt->correct = $result->correctanswer;\n $attempt->iscurrent = 1;\n \n if ($result->score == null) {\n $attempt->score = 0;\n } else if ($result->correctanswer) {\n $maxscore = $DB->get_field('languagelesson_pages', 'maxscore', array('id'=>$attempt->pageid));\n $attempt->score = $maxscore;\n } else {\n $attempt->score = $result->score;\n }\n \n if ($result->userresponse !== null) {\n $attempt->useranswer = $result->userresponse;\n }\n \n $attempt->timeseen = time();\n \n if ($previousattempt = $DB->get_record('languagelesson_attempts',\n array('lessonid'=> $attempt->lessonid, 'pageid'=>$attempt->pageid,\n 'userid'=>$attempt->userid, 'iscurrent'=>1))) {\n $attempt->id = $previousattempt->id;\n $attempt->retry = $previousattempt->retry + 1;\n if ($oldFile = $DB->get_record('files', array('id'=>$previousattempt->fileid))) {\n // Delete the previous audio file.\n languagelesson_delete_submitted_file($oldFile);\n }\n if ($previousattempt->graded = 1) {\n // Set it as resubmit.\n $attempt->resubmit = 1;\n // Remove old feedback files if they exist\n if ($oldfeedback = $DB->get_records('languagelesson_feedback', array('attemptid'=>$attempt->id), null, 'id, fileid')) {\n if ($oldfeedback->fileid != NULL) {\n foreach ($oldfeedback as $oldrecord) {\n $oldfilerecord = $DB->get_record('files', array('id'=>$oldrecord->fileid));\n languagelesson_delete_submitted_file($oldfilerecord);\n $DB->delete_records('languagelesson_feedback', array('fileid'=>$oldrecord->fileid));\n }\n }\n }\n }\n if (($this->lesson->maxattempts == 0) || ($this->lesson->maxattempts >= $attempt->retry)) {\n $DB->update_record(\"languagelesson_attempts\", $attempt, true);\n }\n } else {\n $attempt->retry = 1;\n $DB->insert_record('languagelesson_attempts', $attempt, true);\n }\n $recordedattemptid = $DB->get_field('languagelesson_attempts', 'id',\n array('lessonid'=>$attempt->lessonid, 'userid'=>$attempt->userid,\n 'pageid'=>$attempt->pageid));\n\n } // End switch.\n \n // And update the languagelesson's grade.\n\t\t// NOTE that this happens no matter the question type.\n\n if ($lesson->type != LL_TYPE_PRACTICE) {\n // Get the lesson's graded information.\n\n if ($gradeinfo = $DB->get_record('languagelesson_grades', array('lessonid'=>$lesson->id, 'userid'=>$USER->id))){\n $gradeinfo->grade = languagelesson_calculate_user_lesson_grade($lesson->id, $USER->id);\n } else {\n $gradeinfo = new stdClass;\n $gradeinfo->grade = languagelesson_calculate_user_lesson_grade($lesson->id, $USER->id);\n }\n \n // Save the grade.\n languagelesson_save_grade($lesson->id, $USER->id, $gradeinfo->grade);\n \n // Finally, update the records in the gradebook.\n languagelesson_grade_item_update($lesson);\n \n $gradeitem = $DB->get_record('grade_items', array('iteminstance'=>$lesson->id, 'itemmodule'=>'languagelesson'));\n $DB->set_field('grade_grades', 'finalgrade', $gradeinfo->grade, array('userid'=>$USER->id, 'itemid'=>$gradeitem->id));\n \n languagelesson_update_grades($lesson, $USER->id);\n \n }\n \n // \"number of attempts remaining\" message if $this->lesson->maxattempts > 1\n // Displaying of message(s) is at the end of page for more ergonomic display.\n \n // IT'S NOT HITTING THIS CONTROL GROUP BELOW FOR SOME REASON.\n if ((!$result->correctanswer && ($result->newpageid == 0)) || $result->typeid == LL_AUDIO) {\n // Wrong answer and student is stuck on this page - check how many attempts.\n // The student has had at this page/question.\n $nattempts = $attempt->retry;\n // $nattempts = $DB->count_records(\"languagelesson_attempts\", array(\"pageid\"=>$this->properties->id,\n // \"userid\"=>$USER->id, \"retry\" => $attempt->retry));\n // Retreive the number of attempts left counter for displaying at bottom of feedback page.\n if ($this->lesson->maxattempts != 0) { // Don't bother with message if unlimited.\n if ($nattempts >= $this->lesson->maxattempts || $this->lesson->maxattempts == 1){\n $result->maxattemptsreached = true;\n $result->newpageid = LL_NEXTPAGE;\n $result->attemptsremaining = 0;\n } else {\n $result->attemptsremaining = $this->lesson->maxattempts - $nattempts;\n }\n }\n }\n \n // TODO: merge this code with the jump code below. Convert jumpto page into a proper page id.\n if ($result->newpageid == 0) {\n $result->newpageid = $this->properties->id;\n } else if ($result->newpageid == LL_NEXTPAGE) {\n $result->newpageid = $this->lesson->get_next_page($this->properties->nextpageid);\n }\n\n // Determine default feedback if necessary.\n if (empty($result->response)) {\n if (!$this->lesson->feedback && !$result->noanswer && !($this->lesson->review & !$result->correctanswer && !$result->isessayquestion)) {\n // These conditions have been met:\n // 1. The lesson manager has not supplied feedback to the student\n // 2. Not displaying default feedback\n // 3. The user did provide an answer\n // 4. We are not reviewing with an incorrect answer (and not reviewing an essay question).\n\n $result->nodefaultresponse = true; // This will cause a redirect below.\n } else if ($result->isessayquestion) {\n $result->response = get_string('defaultessayresponse', 'languagelesson');\n } else if ($result->correctanswer) {\n if ($this->lesson->defaultfeedback == true) {\n $result->response = $this->lesson->defaultcorrect;\n } else {\n $result->response = get_string('thatsthecorrectanswer', 'languagelesson');\n }\n } else {\n if ($this->lesson->defaultfeedback == true) {\n $result->response = $this->lesson->defaultwrong;\n } else {\n $result->response = get_string('thatsthewronganswer', 'languagelesson');\n }\n }\n }\n \n if ($result->typeid == LL_AUDIO) {\n if ($result->audiodata) {\n $uploadData = $result->audiodata;\n $mp3data = json_decode($uploadData, true, 5);\n $recordedattempt = $DB->get_record('languagelesson_attempts', array('id'=>$recordedattemptid));\n \n foreach ($mp3data['mp3Data'] as $newfilename => $newfilebits) {\n // Send the file to the pool and return the file id.\n $recordedattempt->fileid = upload_audio_file($USER->id, $cmid, $recordedattemptid, $newfilename, $newfilebits);\n $DB->update_record('languagelesson_attempts', $recordedattempt);\n }\n }\n } else if ($result->response) {\n if ($this->lesson->review && !$result->correctanswer && !$result->isessayquestion) {\n $nretakes = $DB->count_records(\"languagelesson_grades\", array(\"lessonid\"=>$this->lesson->id, \"userid\"=>$USER->id));\n $qattempts = $DB->count_records(\"languagelesson_attempts\",\n array(\"userid\"=>$USER->id, \"retry\"=>$nretakes, \"pageid\"=>$this->properties->id));\n if ($qattempts == 1) {\n $result->feedback = $OUTPUT->box(get_string(\"firstwrong\", \"languagelesson\"), 'feedback');\n } else {\n $result->feedback = $OUTPUT->BOX(get_string(\"secondpluswrong\", \"languagelesson\"), 'feedback');\n }\n }\n else\n {\n \t$class = 'response';\n if ($result->correctanswer) {\n $class .= ' correct'; // CSS over-ride this if they exist (!important).\n } else if (!$result->isessayquestion) {\n $class .= ' incorrect'; // CSS over-ride this if they exist (!important).\n }\n $options = new stdClass;\n $options->noclean = true;\n $options->para = true;\n $options->overflowdiv = true;\n \n if ($result->typeid == LL_CLOZE)\n {\n \t// Lets do our own thing for CLOZE - get question_html.\n \t$my_page = $DB->get_record('languagelesson_pages', array('id'=>$attempt->pageid));\n \t$question_html = $my_page->contents;\n \t\n \t// Get user answers from the attempt.\n \t$attempt_answers = $DB->get_record('languagelesson_attempts', array('id'=>$recordedattemptid));\n \t$user_answers_str = $attempt_answers->useranswer;\n \t\t\n \t// Get the lesson page so we can use functions from cloze.php.\n \t$manager = languagelesson_page_type_manager::get($lesson);\n\t\t\t$page = $manager->load_page($attempt->pageid, $lesson);\n\t \t\t\t\t\n\t \t\t// Get our cloze_correct_incorrect_view html.\n\t \t\t$html = $page->get_cloze_correct_incorrect_view($user_answers_str, $question_html);\n\t \t\t$result->feedback = $html;\n }\n else\n {\n \t$result->feedback = $OUTPUT->box(format_text($this->get_contents(), $this->properties->contentsformat, $options), 'generalbox boxaligncenter');\n \t$result->feedback .= '<div class=\"correctanswer generalbox\"><em>'.get_string(\"youranswer\", \"languagelesson\").'</em> : '.$result->studentanswer; // Already in clean html\n \t$result->feedback .= $OUTPUT->box($result->response, $class); // Already conerted to HTML\n \t$result->feedback .= '</div>';\n }\n }\n }\n }\n \n // Update completion state\n $course = get_course($lesson->course);\n $cm = get_coursemodule_from_id('languagelesson', $cmid, 0, false, MUST_EXIST);\n $completion=new completion_info($course);\n if ($completion->is_enabled($cm) && $lesson->completionsubmit) {\n $completion->update_state($cm, COMPLETION_COMPLETE, $USER->id);\n }\n \n return $result;\n }",
"public function test_launch_attempt_just_finished_in_review_mode() {\n global $DB, $SESSION, $USER;\n\n // Create a timer for the current user.\n $timenow = time();\n $timer1 = new stdClass;\n $timer1->lessonid = $this->lesson->id;\n $timer1->userid = $this->student->id;\n $timer1->completed = 1;\n $timer1->starttime = $timenow;\n $timer1->lessontime = $timenow;\n $timer1->id = $DB->insert_record(\"lesson_timer\", $timer1);\n\n // Create attempt.\n $newpageattempt = [\n 'lessonid' => $this->lesson->id,\n 'pageid' => $this->page2->id,\n 'userid' => $this->student->id,\n 'answerid' => 0,\n 'retry' => 0, // First attempt is always 0.\n 'correct' => 1,\n 'useranswer' => '1',\n 'timeseen' => time(),\n ];\n $DB->insert_record('lesson_attempts', (object) $newpageattempt);\n // Create grade.\n $record = [\n 'lessonid' => $this->lesson->id,\n 'userid' => $this->student->id,\n 'grade' => 100,\n 'late' => 0,\n 'completed' => 1,\n ];\n $DB->insert_record('lesson_grades', (object) $record);\n\n unset($SESSION->lesson_messages);\n\n $this->setUser($this->student);\n $result = mod_lesson_external::launch_attempt($this->lesson->id, '', $this->page2->id, true);\n $result = external_api::clean_returnvalue(mod_lesson_external::launch_attempt_returns(), $result);\n // Everything ok as student.\n $this->assertCount(0, $result['warnings']);\n $this->assertCount(0, $result['messages']);\n }",
"public function getLastAttempted()\n {\n return !empty($this->lastAttemptId) ? self::_getUserById($this->lastAttemptId) : null;\n }",
"public function Get_Attempt($quiz_id, $user_id){\n $query = $this->db->prepare(\"SELECT attempt FROM attempt_quiz WHERE id_quiz= :quiz_id AND id_user= :user_id\");\n $query->bindParam(\"quiz_id\", $quiz_id, PDO::PARAM_STR);\n $query->bindParam(\"user_id\", $user_id, PDO::PARAM_STR);\n $query->execute();\n $datas = array();\n while ($row = $query->fetch(PDO::FETCH_ASSOC)) {\n $datas[] = $row;\n }\n if (count($datas)>0) {\n foreach ($datas as $data) {\n $attempt=$data['attempt'];\n }\n }\n return $attempt;\n }",
"function GetExamAttemptInfo($userID, $examID)\n {\n $campaignID = $this->campaignID;\n $attempts = 0;\n $sql = \"SELECT \n COUNT(id) as attempts\n FROM users_exams WHERE user_id = '$userID' AND camp_id = '$campaignID' AND exam_id = '$examID'\";\n $result = mysql_query($sql);\n if(mysql_num_rows($result) == 1)\n {\n $row = mysql_fetch_row($result);\n $attempts = $row[0];\n if(empty($attempts))\n $attempts = 0; \n }\n\n return $attempts;\n }",
"function GetExamAttemptInfo($userID, $examID)\n {\n $campaignID = $this->campaignID;\n $attempts = 0;\n $sql = \"SELECT \n COUNT(id) as attempts\n FROM users_exams WHERE user_id = '$userID' AND camp_id = '$campaignID' AND exam_id = '$examID'\";\n $result = $this->conn->query($sql);\n if(mysqli_num_rows($result) == 1)\n {\n $row = mysqli_fetch_row($result);\n $attempts = $row[0];\n if(empty($attempts))\n $attempts = 0; \n }\n\n return $attempts;\n }",
"public function assignExam($exam, $user){\n $sql = \"INSERT INTO studentExam (name, exam) VALUES (\\\"\" . $user . \"\\\", \\\"\" . $exam . \"\\\");\"; \n $connection = mysqli_connect($this->servername, $this->username, $this->password, $this->dataBase);\n mysqli_query($connection, $sql);\n if(mysqli_affected_rows($connection) > 0){\n $output[\"affected rows\"] = mysqli_affected_rows($connection);\n $output[\"update\"] = true; \n }else{\n http_response_code(400);\n $output[\"affected rows\"] = mysqli_affected_rows($connection);\n $output[\"update\"] = false;\n $output[\"error\"] = mysqli_error($connection);\n }\n return json_encode($output); \n }",
"function canUserTakeExam($examNum, $examAttempt)\r\n{\r\n global $isStaging;\r\n\r\n // Bypass check in staging environment\r\n if ($isStaging)\r\n {\r\n return true;\r\n }\r\n\r\n\t$exams = getUserExamsRecord();\r\n\r\n\tif ($exams)\r\n\t{\r\n\t\t// If not valid exam number\r\n\t\tif (count($exams) < $examNum)\r\n\t\t{\r\n $user = Am_Di::getInstance()->auth->getUser();\r\n \r\n // Log error\r\n $errorStr = \"canUserTakeExam() returning false for user \" . \r\n $user->login . \". ExamNum passed is {$examNum} but only \" . \r\n count($exams) . \" available for user.\" . \"\\n\";\r\n error_log($errorStr);\r\n\r\n // E-mail error \r\n error_log($errorStr, 1, \"alberto@therapyexamprep.com\");\r\n \r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// Get single exam record\r\n\t\t$exam = $exams[$examNum - 1];\r\n\t\t\r\n\t\tif ($exam->attemptsRemaining <= 0)\r\n\t\t{\r\n $user = Am_Di::getInstance()->auth->getUser();\r\n \r\n // Log error\r\n $errorStr = \"canUserTakeExam() returning false for user \" . \r\n $user->login . \". \" . $exam->attemptsRemaining . \r\n \" attempts remaining for user.\" . \"\\n\";\r\n error_log($errorStr);\r\n\r\n // E-mail error \r\n error_log($errorStr, 1, \"alberto@therapyexamprep.com\");\r\n \r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// If attempt in progress\r\n\t\tif (count($exam->attemptIDs) >= $examAttempt)\r\n\t\t{\r\n // Log error\r\n $errorStr = \"canUserTakeExam() returning false for user \" . \r\n $user->login . \". Exam already in progress.\\n\";\r\n error_log($errorStr);\r\n\r\n // E-mail error \r\n error_log($errorStr, 1, \"alberto@therapyexamprep.com\");\r\n \r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\t\t\r\n\telse\r\n\t{\r\n $user = Am_Di::getInstance()->auth->getUser();\r\n \r\n\t\t// Log error\r\n\t\t$errorStr = \"canUserTakeExam() returning false for user \" . \r\n $user->login . \". Unable to get user's exam record.\\n\";\r\n\t\terror_log($errorStr);\r\n\r\n\t\t// E-mail error \r\n\t\terror_log($errorStr, 1, \"alberto@therapyexamprep.com\");\r\n \r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n}",
"function GetCurrentExam()\n {\n if(isset($_SESSION[GetExamIdentifier()]))\n {\n return $_SESSION[GetExamIdentifier()];\n }\n \n return FALSE;\n }",
"protected function retrieve_assessment_attempts()\n {\n return WeblcmsTrackingDataManager::retrieves(\n AssessmentAttempt::class_name(), \n new DataClassRetrievesParameters($this->get_assessment_attempts_condition()));\n }",
"public function test_get_lesson_user_student() {\n // Test user with full capabilities.\n $this->setUser($this->student);\n\n // Lesson not using password.\n $result = mod_lesson_external::get_lesson($this->lesson->id);\n $result = external_api::clean_returnvalue(mod_lesson_external::get_lesson_returns(), $result);\n $this->assertCount(36, $result['lesson']); // Expect most of the fields.\n $this->assertFalse(isset($result['password']));\n }",
"public function createExamRating()\n {\n $rules = [\n 'exam_id' => 'required',\n 'user_id' => 'required',\n 'stars' => 'required|numeric',\n 'review_body' => 'alpha_numeric'\n ];\n\n $input = array(\n 'exam_id' => $this->request->getVar('exam_id'),\n 'user_id' => $this->request->getVar('user_id'),\n 'stars' => $this->request->getVar('stars'),\n 'review_body' => $this->request->getVar('review_body')\n );\n\n if (!$this->validateRequest($input, $rules)) {\n return $this->getResponse(\n $this->validator->getErrors(),\n ResponseInterface::HTTP_BAD_REQUEST\n );\n }\n $examId = $this->request->getVar('exam_id');\n $userId = $this->request->getVar('user_id');\n $stars = $this->request->getVar('stars');\n $reviewBody = $this->request->getVar('review_body');\n $response = $this->examRatingService->create($examId, $userId, $stars, $reviewBody);\n return $this->getResponse(['message' => $response->message]);\n }",
"public function student_schedule_exam()\n\t{\n\t\t$userid=Input::get('get_userid');\n\t\t$scheduleid=Input::get('schedule');\n\t\t\n\t\t$examsched=ExamScheduleListModel::where('scheduleid','=',$scheduleid)->first();\n\t\t$schedule=$examsched['schedule_day'].\" \".$examsched['schedule_date'].\" \".$examsched['schedule_time'];\n\t\t\n\t\t$examschedule=ExamScheduleModel::where('userid',$userid);\n\t\t$examschedule->update(['scheduleid'=>$scheduleid,'schedule'=>$schedule]);\n\t\t$student=StudentModel::where('userid',$userid);\n\t\t$student->update(['steps_status'=>'EntranceExam','step_number'=>6]);\n\n\t\t\n\t\t\n\t\t$oas=Session::get('sess_admin_oas_arr');\n\t\t$oas=unserialize(serialize($oas));\n\n\t\tif($oas!=\"\")\n\t\t{\n\t\t\t$oas_username=$oas['username'];\n\t\t\t$student = StudentModel::where('userid','=',$userid)->first();\n\t\t\tSession::put('sess_student_arr',$student);\n\n\t\t\t$admin = AdminModel::where('username','=',$oas_username)->first();\n\t\t\tSession::put('sess_admin_oas_arr',$admin);\n\t\t}\n\t\telse{\n\t\t\t$student = StudentModel::where('userid','=',$userid)->first();\n\t\t\tSession::put('sess_student_arr',$student);\n\t\t}\n\n\t\treturn Redirect::intended('/home');\n\t}",
"public function test_get_lesson_access_information() {\n global $DB;\n\n $this->setUser($this->student);\n // Add previous attempt.\n $record = [\n 'lessonid' => $this->lesson->id,\n 'userid' => $this->student->id,\n 'grade' => 100,\n 'late' => 0,\n 'completed' => 1,\n ];\n $DB->insert_record('lesson_grades', (object) $record);\n\n $result = mod_lesson_external::get_lesson_access_information($this->lesson->id);\n $result = external_api::clean_returnvalue(mod_lesson_external::get_lesson_access_information_returns(), $result);\n $this->assertFalse($result['canmanage']);\n $this->assertFalse($result['cangrade']);\n $this->assertFalse($result['canviewreports']);\n\n $this->assertFalse($result['leftduringtimedsession']);\n $this->assertEquals(1, $result['reviewmode']);\n $this->assertEquals(1, $result['attemptscount']);\n $this->assertEquals(0, $result['lastpageseen']);\n $this->assertEquals($this->page2->id, $result['firstpageid']);\n $this->assertCount(1, $result['preventaccessreasons']);\n $this->assertEquals('noretake', $result['preventaccessreasons'][0]['reason']);\n $this->assertEquals(null, $result['preventaccessreasons'][0]['data']);\n $this->assertEquals(get_string('noretake', 'lesson'), $result['preventaccessreasons'][0]['message']);\n\n // Now check permissions as admin.\n $this->setAdminUser();\n $result = mod_lesson_external::get_lesson_access_information($this->lesson->id);\n $result = external_api::clean_returnvalue(mod_lesson_external::get_lesson_access_information_returns(), $result);\n $this->assertTrue($result['canmanage']);\n $this->assertTrue($result['cangrade']);\n $this->assertTrue($result['canviewreports']);\n }",
"public function create_question_attempt() {\n global $DB;\n\n $attempt = new stdClass();\n $attempt->questionusageid = 1;\n $attempt->slot = 1;\n $attempt->questionid = 1;\n $attempt->maxmark = 100;\n $attempt->minfraction = 50;\n $attempt->timemodified = time();\n $attempt->responsesummary = self::QUIZ_ANSWER_TEXT;\n $attempt->id = $DB->insert_record('question_attempts', $attempt);\n\n return $attempt;\n }",
"public static function LoadById($user_exam_attempt_id)\n {\n \t$result = &get_instance()->db->get_where(\"UserExamAttempt\", array(\"user_exam_attempt_id\" => $user_exam_attempt_id));\n \t$result = $result->result();\n \treturn count($result) != 0 ? UserExam_model::LoadWithData($result[0]) : null;\n }",
"public function freshmen_student_schedule_exam()\n\t{\n\t\t$userid=Input::get('get_userid');\n\t\t$scheduleid=Input::get('schedule');\n\n\t\t$examsched=ExamScheduleListModel::where('scheduleid','=',$scheduleid)->first();\n\t\t$schedule=$examsched['schedule_day'].\" \".$examsched['schedule_date'].\" \".$examsched['schedule_time'];\n\t\t$examschedule=ExamScheduleModel::where('userid',$userid);\n\t\t$examschedule->update(['scheduleid'=>$scheduleid,'schedule'=>$schedule]);\n\t\t$student=StudentModel::where('userid',$userid);\n\t\t$student->update(['steps_status'=>'EntranceExam','step_number'=>5]);\n\n\t\t\n\t\t\n\t\t$oas=Session::get('sess_admin_oas_arr');\n\t\t$oas=unserialize(serialize($oas));\n\n\t\tif($oas!=\"\")\n\t\t{\n\t\t\t$oas_username=$oas['username'];\n\t\t\t$student = StudentModel::where('userid','=',$userid)->first();\n\t\t\t//Session::put('sess_student_arr',$student);\n\n\t\t\t$admin = AdminModel::where('username','=',$oas_username)->first();\n\t\t\tSession::put('sess_admin_oas_arr',$admin);\n\t\t}\n\t\telse{\n\t\t\t$student = StudentModel::where('userid','=',$userid)->first();\n\t\t\t//Session::put('sess_student_arr',$student);\n\t\t}\n\n\t\treturn Redirect::intended('/home');\n\t}",
"function get_student_academics_exam($student = 0, $exam = 0)\n {\n\n access_control($this);\n $urldata = $this->uri->uri_to_assoc(3, array('m', 'i', 'exam'));\n # Pick all assigned data\n $data = assign_to_data($urldata);\n #Get the student's details\n $studentid = (($student>0)? $student : decryptValue($data['i']));\n $data['studentid'] = $studentid;\n // Select * from students where term is that and year is that ::\n\n $data['studentdetails'] = $this->Query_reader->get_row_as_array('get_students_list', array('isactive' => 'Y', 'limittext' =>'','searchstring'=> ' AND id = '.$studentid ));\n\n // Exam\n $exam = decryptValue($data['exam']);\n\n $exams = $data['exams'] = $this->db->query($this->Query_reader->get_query_by_code('search_exams', array('limittext'=>'', 'searchstring'=> ' AND id = \"'.$exam.'\" AND isactive=\"Y\"')))->result_array();\n foreach($exams as $esam)\n {\n\n #Get subjects the student has registered for in the selected term\n $data['registration_data'] = $registration_data = $this->Query_reader->get_row_as_array('search_register', array('limittext'=>'', 'searchstring'=> 'student='.$studentid.' AND term =\"'.$esam['term'].'\"'));\n break;\n }\n //Get the applicable exams for selected term\n if(!empty($registration_data))\n {\n $data['exams'] = $this->db->query($this->Query_reader->get_query_by_code('search_exams', array('limittext'=>'', 'searchstring'=> ' AND classes like \"%'.$registration_data['class'].'%\" AND id =\"'.$exam.'\" AND isactive=\"Y\"'))) ->result_array();\n\n //get the subject details\n $subject_arr = remove_empty_indices(explode('|', $registration_data['subjects']));\n #print_r($registration_data);\n #exit();\n if(!empty($subject_arr))\n $data['subjects'] = $this->db->query($this->Query_reader->get_query_by_code('search_subjects', array('limittext'=>'', 'searchstring'=>' AND id IN ('.implode(',', $subject_arr).')', 'isactive'=>'Y')))\n ->result_array();\n\n //Get class of registration details\n $data['classdetails'] = get_db_object_details($this, 'classes', $registration_data['class']);\n }\n\n $data['schoolid'] = $this->session->userdata('schoolinfo');\n $view_to_load = 'students/exam_academic_info';\n\n $data = add_msg_if_any($this, $data);\n $this->load->view($view_to_load, $data);\n\n\n}",
"public function newExam() {\n $data = $this->loadCourses();\n $cid = $this->input[\"course\"];\n $course = null;\n $allowed = false;\n foreach ($data as $y) {\n foreach ($y as $c) {\n if ($c[\"id\"] == $cid && $c[\"role\"] == \"Instructor\") {\n $allowed = true;\n $course = $c;\n }\n }\n }\n if ($allowed) {\n $this->dData = $course;\n if (isset($this->input[\"exam\"])) {\n $this->dData[\"examdata\"] = $this->loadResults($this->input[\"exam\"], null);\n }\n return $this->display(\"newexam\");\n }\n die($this->showError(\"Not Authorized\"));\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Set current report URL from current params
|
protected function _setReportUrl()
{
if ($this->reportId && $this->_config && isset($this->_config->skin)) {
$this->reportUrl = "{$this->getBaseUrl(true)}errors/report.php?" . http_build_query(array(
'id' => $this->reportId, 'skin' => $this->_config->skin
));
}
}
|
[
"private function setUrl() {\n $_GET['url'] = isset($_GET['url']) ? $_GET['url'] : 'IndexAction.index';\n $this->url = $_GET['url'];\n }",
"protected function getReportUrl()\n {\n return $this->reportUrl;\n }",
"protected function set_url() {\n global $PAGE, $CFG;\n\n $params = array('pageid' => $this->page->id);\n\n if (isset($this->section)) {\n $params['section'] = $this->section;\n }\n $params['makenew'] = $this->makenew;\n $PAGE->set_url(\"$CFG->wwwroot/mod/socialwiki/edit.php?makenew=$this->makenew\", $params);\n }",
"function getReportPrintURL() {\n\t\treturn 'index.php?module='.$this->getModuleName().'&view=ExportReport&mode=GetPrintReport&record='. $this->getId();\n\t}",
"protected function getReportUrl()\n {\n return $this->apiUrl . 'getreports.php';\n }",
"public function setUrlByCurrentRequest()\r\n {\r\n $this->setScheme(substr($_SERVER[\"SERVER_PROTOCOL\"], 0, strpos($_SERVER[\"SERVER_PROTOCOL\"], '/')) . (isset($_SERVER[\"HTTPS\"]) && strtolower($_SERVER[\"HTTPS\"]) != 'off' ? 's' : ''));\r\n $this->setUserInfo((isset($_SERVER['PHP_AUTH_USER']) ? rawurlencode($_SERVER['PHP_AUTH_USER']) : '') . (isset($_SERVER['PHP_AUTH_PW']) && !empty($_SERVER['PHP_AUTH_PW']) ? ':' . rawurlencode($_SERVER['PHP_AUTH_PW']) : ''));\r\n $this->setHost(preg_replace('/\\:.*$/', '', isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']));\r\n $this->setPort($this->defaultPorts[$this->getScheme()] == $_SERVER['SERVER_PORT'] ? null : $_SERVER['SERVER_PORT']);\r\n $this->setPath(strpos($_SERVER['REQUEST_URI'], '?') !== false ? substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) : $_SERVER['REQUEST_URI']);\r\n $this->setQuery($_SERVER['QUERY_STRING']);\r\n $this->setFragment('');\r\n\r\n return $this;\r\n }",
"public function set_url() {\n global $PAGE, $CFG;\n\n $params = array('pageid' => $this->page->id);\n if (isset($this->section)) {\n $params['section'] = $this->section;\n }\n\n $PAGE->set_url($CFG->wwwroot . '/mod/socialwiki/edit.php', $params);\n }",
"static function getReportsUrl() {\n\t\tif(Environment::$reportsCustomUrl != null) {\n\t\t\treturn Environment::$reportsCustomUrl;\n\t\t}\n\t\t\n\t\tif(!Environment::$test) {\n\t\t\treturn Environment::$reportsUrl;\n\t\t}else {\n\t\t\treturn Environment::$reportsTestUrl;\n\t\t}\n\t}",
"public function getReportDataUrl()\n {\n $data_url = site_url('report/show/'.$this->report->idReport);\n if(!empty($this->report->url)){\n $data_url = site_url($this->report->url.\"/show\");\n }\n return $data_url;\n }",
"protected function setRequestUrl()\n {\n }",
"public function setUrl()\n\t{\n\t\t$this->url = '/' . $this->getFileName() . '.html';\n\t}",
"public function formatCurrentUrl();",
"public function saveTheCurrentUrl()\n {\n $this->url = $this->getSession()->getCurrentUrl();\n }",
"public function set_url() {\n global $PAGE, $CFG;\n $PAGE->set_url($CFG->wwwroot . '/mod/socialwiki/instancecomments.php', array('pageid' => $this->page->id));\n }",
"public static function getCurrentUrl() {\n if(!isset(self::$request_parameters)) { \n self::$request_parameters = request()->get->getAll();\n \n if(isset(self::$request_parameters['subd'])) {\n unset(self::$request_parameters['subd']); \n }\n \n if(isset(self::$request_parameters['page'])) {\n unset(self::$request_parameters['page']);\n }\n }\n \n return self::getInternalUrl('', Framework::getInstance()->getHttpSubPath(), Framework::getInstance()->getPageHttpName(), self::$request_parameters);\n }",
"private function urlActivSet() \r\n\t{\r\n\t\t$Result = '/';\r\n\t\t\r\n\t\tif(isset($_GET[PARAM_KERNEL_ROUTE_TAG_ARG]))\r\n\t\t{\r\n\t\t\t$Result = '/'.$_GET[PARAM_KERNEL_ROUTE_TAG_ARG];\r\n\t\t}\r\n\t\t\r\n\t\t$this->urlActiv = $Result;\r\n\t\treturn $Result;\r\n\t}",
"private function format_url() {\n /* Get the requested URL without the base directory */\n if ($this->base != \"/\" && strlen($this->base) > 0 && strpos($this->url, $this->base) === 0) {\n $this->url = substr($this->url, strlen($this->base));\n }\n /* Set a default URL, if necessary */\n if (empty($this->url)) {\n $this->url = '/';\n }\n }",
"public function getPathReport() {\n\t\t\n\t\t$currHost = str_replace(\":\" . $_SERVER[\"SERVER_PORT\"], \"\", $_SERVER[\"HTTP_HOST\"]);\n\t\treturn $this->getProtocol() . $currHost . ':8080/Rpt_camaras/index.jsp?';\n\t\t\n\t\t\n }",
"public function get_base_url() {\n global $CFG;\n return $CFG->wwwroot . '/blocks/php_report/render_report_page.php';\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Checks for open schools that aren't associated with any cities
|
private function checkSchoolsWithoutCities()
{
if (!$this->getConfirmation('Check for open schools without cities?')) {
return;
}
$this->checkForEmptyField(
$this->schools,
'school',
'Checking for open schools without cities...',
'cities'
);
}
|
[
"private function checkSchoolsWithoutCodes()\n {\n if (!$this->getConfirmation('Check for open schools without Department of Education codes?')) {\n return;\n }\n\n $this->checkForEmptyField(\n $this->schools,\n 'school',\n 'Checking for open schools without DoE codes...',\n 'school_codes'\n );\n }",
"private function checkDistrictsWithoutCounties()\n {\n if (!$this->getConfirmation('Check for open districts without counties?')) {\n return;\n }\n\n $this->checkForEmptyField(\n $this->districts,\n 'district',\n 'Checking for open districts without counties...',\n 'counties'\n );\n }",
"private function checkForStatConflicts()\n {\n $context = $this->getContext();\n $codeKey = $context == Context::SCHOOL_CONTEXT ? 'schoolCode' : 'districtCode';\n $locations = $this->worksheets[$this->activeWorksheet]['locations'];\n\n // Check for duplicate locations\n $codes = Hash::extract($locations, \"{n}.$codeKey\");\n $uniqueCodes = array_unique($codes);\n if (count($codes) == count($uniqueCodes)) {\n return;\n }\n\n // Get the codes for duplicated locations\n $duplicateCodes = [];\n foreach (array_count_values($codes) as $code => $count) {\n if ($count > 1) {\n $duplicateCodes[] = $code;\n }\n }\n\n // Get the spreadsheet rows for each duplicated location\n $duplicatedLocationRows = [];\n foreach ($duplicateCodes as $code) {\n foreach ($locations as $row => $location) {\n if ($location[$codeKey] == $code) {\n $duplicatedLocationRows[$code][] = $row;\n }\n }\n }\n\n // Check for non-null values for the same location and the same column\n foreach ($duplicatedLocationRows as $code => $rows) {\n $columns = [];\n foreach ($rows as $row) {\n $colsInRow = $this->getColumnsWithDataInRow($row);\n $columns = array_merge($columns, $colsInRow);\n }\n\n if (count($columns) == count(array_unique($columns))) {\n continue;\n }\n\n $columnsWithConflicts = [];\n foreach (array_count_values($columns) as $col => $count) {\n if ($count > 1) {\n $columnsWithConflicts[] = $col;\n }\n }\n $this->shell_io->error(sprintf(\n 'Stat conflict on %s worksheet: %s with code %d is on multiple rows with stats in %s %s',\n $this->activeWorksheet,\n ucfirst($context),\n $code,\n __n('column', 'columns', count($columnsWithConflicts)),\n implode(', ', $columnsWithConflicts)\n ));\n $this->shell_io->out('Recommendations:');\n $this->shell_io->out(' - If there are completely duplicated rows, just delete them');\n $this->shell_io->out(' - If one of these values should be ignored, update Datum::isIgnorable()');\n $this->shell_io->out(' - Investigate further if these rows show different, real values');\n\n throw new Exception('Aborting');\n }\n }",
"private function check_places()\n {\n $c = 0;\n foreach ($this->ep->cplaces as $place)\n {\n // Check that all colored places have at least one unfolding:\n if (count($place->unfolded) == 0)\n {\n fwrite($this->log, \"Place {$place->id} (named {$place->name}) has no unfolding.\\n\");\n }\n $c += count($place->unfolded);\n $this->progress->advance();\n }\n if ($c != count($this->ep->uplaces))\n {\n fwrite($this->log, \"Unfolded model may use a bigger parameter.\\n\");\n }\n }",
"function isOpen ( $i, $j )\n\t{\n\t\tif ( $this -> siteExists( $i, $j ) )\n\t\t{\n\t\t\treturn $this -> sites[$i][$j] > 0 ;\n\t\t}\n\n\t\treturn false;\n\t}",
"private function needsToUpdateDistricts() {\n\t\tif (!tx_oelib_db::tableHasColumn('tx_realty_districts', 'city')) {\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$districtsWithExactlyOneCity = $this->findDistrictsToAssignCity();\n\n\t\treturn !empty($districtsWithExactlyOneCity);\n\t}",
"private function isCitySelectorInUse() {\n\t\treturn $this->piVars['city'] > 0;\n\t}",
"public function getAllSchools();",
"function checkUnassigned() {\n $db = DB::getInstance();\n $query = \"SELECT id FROM sage_shifts WHERE user_id IS NULL\";\n $unassigned = $db->query($query)->results(true);\n if(!empty($unassigned)) {\n //there are still shifts to be assigned\n return true;\n } else {\n //all shifts have been assigned\n return false;\n }\n}",
"public function isShowNonRequiredCounty()\n {\n return (bool) $this->scopeConfig->getValue(self::XML_PATH_DISPLAY_ALL_COUNTIES, ScopeInterface::SCOPE_STORE);\n }",
"public function not_always_closed( $opening_hours ) {\n\n foreach ( $opening_hours as $hours => $hour ) {\n if ( !empty( $hour ) ) {\n return true;\n }\n }\n }",
"private function checkForNoStats($context)\n {\n $this->io->out(\"Checking for open {$context}s without stats...\");\n $records = ($context == Context::SCHOOL_CONTEXT) ? $this->schools : $this->districts;\n $progress = $this->makeProgressBar(count($records));\n $results = [];\n foreach ($records as $record) {\n $progress->increment(1)->draw();\n $locationField = Context::getLocationField($context);\n $dataFound = $this->statsTable->exists([\n $locationField => $record->id,\n ]);\n if ($dataFound) {\n continue;\n }\n $results[] = [\n $record->name,\n $record->id,\n $record->origin_file,\n ];\n }\n if ($results) {\n $this->showResults($results, $context);\n\n return;\n }\n\n $this->io->overwrite(' - None found');\n $this->io->out();\n }",
"static function NoSchools()\n{\n\n\t\n$seedschool=self::Onlyseedschools();\n $gspschool=self::gspschools();\n $nongspschool=self::nongspschools();\n \n $num_schools = $seedschool+$nongspschool+$gspschool;\nreturn($num_schools);\n\n}",
"function idies_get_schools( $all_affiliates ) {\n\n\t$all_school_info = array();\n\n\tforeach( $all_affiliates as $this_affiliate ) {\n\t\tforeach( $this_affiliate['schools'] as $this_school_key=>$this_school ){\n\t\n\t\t\tif ( !in_array( $this_school_key , $all_school_info ) ) {\n\t\t\t\t$all_school_info[ $this_school_key ] = $this_school;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//idies_debug( $all_school_info );\n\tuasort( $all_school_info , 'idies_sort_by_display_name' );\n\treturn $all_school_info ;\n}",
"public function hasManyDisciplinarySanctions()\n {\n $subject_configuration = $this->getCurrentStudentCareerSchoolYear()->getCareerSchoolYear()->getSubjectConfiguration();\n\n if ($subject_configuration->getMaxDisciplinarySanctions() == 0)\n return false;\n\n return ($subject_configuration->getMaxDisciplinarySanctions() <= $this->countStudentDisciplinarySanctionsForSchoolYear());\n\n }",
"public function openCourseworks()\n {\n return $this->courseworks->where(\"open\", true);\n }",
"function checkRule58(){\n // rule':: district~;district/\\-I\n // sqlExprSrc fSpec rule':: district\n $v=DB_doquer('SELECT DISTINCT isect0.`district`, isect0.`district1`\n FROM \n ( SELECT DISTINCT F0.`district`, F1.`district` AS `district1`\n FROM `court` AS F0, `court` AS F1\n WHERE F0.`i`=F1.`i`\n ) AS isect0\n WHERE isect0.`district` <> isect0.`district1` AND isect0.`district` IS NOT NULL AND isect0.`district1` IS NOT NULL');\n if(count($v)) {\n DB_debug('Overtreding (CourtOfAppeal '.$v[0][0].',CourtOfAppeal '.$v[0][1].')\nreden: \\\"Artificial explanation: district~;district |- I\\\"<BR>',3);\n return false;\n }return true;\n }",
"public function test_if_a_client_can_get_a_list_of_schools()\n {\n $school = factory(\\App\\School::class)->create();\n $response = $this->get('/api/schools');\n\n $response->assertStatus(200)\n ->assertJson([\n 'data' => [\n [\n 'id' => $school->id,\n 'name' => $school->name,\n 'city' => $school->city,\n 'zip' => $school->zip,\n 'circulation' => $school->circulation,\n 'state' => [\n 'id' => $school->state->id,\n 'abbreviation' => $school->state->abbreviation\n ],\n ]\n ]\n ]);\n }",
"private function check( ) {\n\t\t$cityName = $this->cityName;\n\n\t\tglobal $wpdb;\n \n $wpCityID = null;\n $results = $wpdb->get_results( \"select post_id, meta_key from $wpdb->postmeta where meta_key = 'cityName' AND meta_value = '$cityName'\", ARRAY_A );\n \n if( $results ){\n $wpCityID = $results[0]['post_id'];\n $this->makeCity( $wpCityID );\n }\n\n if( !$results ) {\n \t$this->save();\n }\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Handle the received webhook.
|
abstract public function handle(Webhook $webhook);
|
[
"public function handle_webhook() {\n\t\t$payload = file_get_contents( 'php://input' );\n\t\tif ( ! empty( $payload ) && $this->validate_webhook( $payload ) ) {\n\t\t\t$data = json_decode( $payload, true );\n\t\t\t$event_data = $data['event']['data'];\n\n\t\t\tself::log( 'Webhook received event: ' . print_r( $data, true ) );\n\n\t\t\tif ( ! isset( $event_data['metadata']['order_id'] ) ) {\n\t\t\t\t// Probably a charge not created by us.\n\t\t\t\texit;\n\t\t\t}\n\n\t\t\t$order_id = $event_data['metadata']['order_id'];\n\n\t\t\t$this->_update_order_status( wc_get_order( $order_id ), $event_data['timeline'] );\n\n\t\t\texit; // 200 response for acknowledgement.\n\t\t}\n\n\t\twp_die( 'Coinbase Webhook Request Failure', 'Coinbase Webhook', array( 'response' => 500 ) );\n\t}",
"public function handleWebhook()\n\t{\n\t\t$payload = $this->getJsonPayload();\n\n\t\tswitch ($payload['type'])\n\t\t{\n\t\t\tcase 'invoice.payment_failed':\n\t\t\t\treturn $this->handleFailedPayment($payload);\n\t\t}\n\t}",
"public function handle_webhook()\n {\n $payload = file_get_contents('php://input');\n if (!empty($payload)) {\n $data = json_decode($payload, true);\n\n self::log('Webhook received: ' . print_r($data, true));\n\n $payscrpyt_invoice_id = $data[\"id\"]; // string\n $order_id = $data[\"merchant_order_id\"]; // string\n\n // Double check\n $args = array(\n \"id\" => $payscrpyt_invoice_id, // string\n \"with_payments\" => false\n );\n\n $this->init_api();\n\n $result = Payscrypt_API_Handler::get_invoice($args);\n\n self::log(\"handle_webhook get response from get_invoice: \" . print_r($result, true));\n\n if (!$result[0]) {\n self::log('Payscrypt can not find order, payscrpyt_invoice_id: ' . $payscrpyt_invoice_id);\n }\n\n $new_status = $result[1][\"invoice\"][\"status\"];\n\n $this->_update_order_status(wc_get_order(intval($order_id)), $new_status);\n\n exit;\n }\n\n wp_die('Payscrypt Webhook Request Failure', 'Payscrypt Webhook', array('response' => 500));\n }",
"public function webhook() {\r\n\r\n\t \t}",
"public function webhook ()\n {\n\n\n }",
"private function handleRequest() {\n \n\t\t$this->error_log( \"\\n\\nHandling webhook-type URL received at: \" . current_time( 'Y-m-d H:i:s', 0 ) );\n\t\t\t\t\n\t\t$this->event_type = $this->get_webhook_suffix();\n\t\t$this->payload = $this->get_webhook_content();\n\t\t$this->headers = $this->get_request_headers();\n\t\t\n\t\tif( !$this->is_authentic() )\n\t\t\t$this->exit_with_404();\n\t\t\n\t\t$this->error_log( 'Webhook is authentic Ok.' );\n\t\t\n\t\t/** When setting up the link from MP dashboard RessourceId is empty **/\n\t\tif( '' == $this->payload['RessourceId'] )\n\t\t\t$this->reply_to_dashboard_setup();\n\t\t\n\t\ttry{\n\t\t\t$payin = $this->mp->get_payin( $this->payload['RessourceId'] );\n\t\t} catch (Exception $e) {\n\t\t\t$error_message = 'Error:' .\n\t\t\t\t\t' ' . $e->getMessage();\n\t\t\n\t\t\t$this->error_log(\n\t\t\t\t\t'webhook get_payin debug error @' . current_time( 'Y-m-d H:i:s', 0 ) . ': ' .\n\t\t\t\t\t$error_message . ' for RessourceId: ' . $this->payload['RessourceId'] . \"\\n\"\n\t\t\t);\n\t\t\t$this->warn_owner( sprintf(\n\t\t\t\t\t__( 'MANGOPAY Payin API error for Resource ID: %1$s', 'mangopay' ) . ' ' .\n\t\t\t\t\t__( 'It could be that the MANGOPAY environment (sandbox or production) has changed since this payment was issued.', 'mangopay' ),\n\t\t\t\t\t$this->payload['RessourceId']\n\t\t\t) );\n\t\t\t$this->exit_with_404();\n\t\t}\n\t\t\t\n\t\tif( !$payin ) {\n\t\t\t$this->warn_owner( sprintf(\n\t\t\t\t\t__( 'MANGOPAY Payin not found for Resource ID: %1$s', 'mangopay' ),\n\t\t\t\t\t$this->payload['RessourceId']\n\t\t\t) );\n\t\t\t$this->exit_with_404();\n\t\t}\n\t\t\t\n\t\t$this->error_log(\n\t\t\t\"\\n\" . current_time( 'Y-m-d H:i:s', 0 ) . ': webhook received' . ': ' . $this->event_type . \"\\n\" .\n\t\t\t'PAYLOAD: ' . print_r( $this->payload, true ) . \"\\n\" .\n\t\t\t//'HEADERS: ' . print_r( $this->headers, true ) . \"\\n\" .\n\t\t\t'PAYIN: ' . print_r( $payin, true ) . \"\\n\"\n\t\t\t//'$_SERVER: ' . print_r( $_SERVER, true )\n\t\t);\n\t\t\t\n\t\tif( mpAccess::PAYIN_SUCCESS_HK == $this->event_type )\n\t\t\t$this->handlePayinSuccess( $payin );\n\t\t\n\t\tif( mpAccess::PAYIN_FAILED_HK == $this->event_type )\n\t\t\t$this->handlePayinFailure( $payin );\n\t\t\n\t\t// Sends out our http response\n\t\techo '200 (OK)';\n\t\texit;\n\t}",
"public function webhook()\n {\n }",
"public function webhook()\n {\n \n \n \n }",
"public function postWebhook() {\n\t\t$action = Input::get('action');\n\t\t\n\t\tif($action=='update') {\n\t\t\t$webhook = Input::get('webhook');\n\t\t\tConfig::write('webhook.URL', $webhook);\n\n\t\t\treturn Redirect::back()\n\t\t\t\t->with('flash_message', 'Webhook successfully updated');\n\t\t} else if($action=='call') {\n\t\t\t$response = static::callWebhook();\n\t\t\t\n\t\t\tif($response['status']=='ok') {\n\t\t\t\treturn Redirect::back()\n\t\t\t\t\t->with('flash_message', $response['message']);\n\t\t\t} else {\n\t\t\t\treturn Redirect::back()\n\t\t\t\t\t->with('flash_error', $response['message']);\n\t\t\t}\n\t\t}\n\t}",
"public function actionHandleWebhook()\n {\n try {\n $webhook = $this->parseBraintreeNotification();\n } catch (Exception $e) {\n return;\n }\n\n $method = 'handle' . Inflector::camelize(str_replace('.', '_', $webhook->kind));\n\n if (method_exists($this, $method)) {\n return $this->{$method}($webhook);\n } else {\n return $this->missingMethod();\n }\n }",
"public function handlePayload ()\n\t{\n\t\tif(!$_SERVER['HTTP_X_GITHUB_EVENT']) return;\n\t\tif($_SERVER['HTTP_X_GITHUB_EVENT'] !== \"pull_request\") return;\n\n\t\t$json = file_get_contents('php://input');\n\t\t$payload = json_decode($json);\n\n\t\tswitch ($payload->action) {\n\t\t\tcase \"opened\":\n\t\t\tcase \"edited\":\n\t\t\t\treturn $this->checkClaForUsers($payload);\n\t\t}\n\t}",
"abstract protected function process(PostFinanceCheckout_Payment_Model_Webhook_Request $request);",
"public function process(WebhookRequestInterface $webhookRequest): void;",
"public function handle_events() {\n if ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) {\n return;\n }\n\n $request_body = file_get_contents( 'php://input' );\n $event = json_decode( $request_body );\n\n if ( empty( $event->id ) ) {\n return;\n }\n\n //dokan_log( \"[Stripe Connect] Webhook request body:\\n\" . print_r( $event, true ) );\n\n try {\n if ( ! empty( $event->account ) ) {\n $users = get_users( [\n 'meta_key' => 'dokan_connected_vendor_id',\n 'meta_value' => $event->account,\n 'meta_compare' => '=',\n ] );\n\n if ( empty( $users ) ) {\n // We've handled the deauth cleanup in RegisterWithdrawMethods::deauthorize_vendor\n if ( 'account.application.deauthorized' === $event->type ) {\n status_header( 200 );\n exit;\n }\n\n throw new DokanException(\n 'dokan_stripe_connect_error_account_not_found',\n sprintf(\n __( 'No user found for Stripe account id %s.', 'dokan' ),\n $event->account\n )\n );\n }\n\n $vendor = $users[0];\n $vendor_id = $vendor->ID;\n $vendor_access_key = get_user_meta( $vendor_id, '_stripe_connect_access_key', true );\n\n if ( empty( $vendor_access_key ) ) {\n throw new DokanException(\n 'dokan_stripe_connect_error_vendor_access_key_not_found',\n sprintf(\n __( 'Stripe connect access key not found for vendor id %d.', 'dokan' ),\n $vendor_id\n )\n );\n }\n\n Stripe::setApiKey( $vendor_access_key );\n }\n\n $event = Event::retrieve( $event->id );\n\n //dokan_log( \"[Stripe Connect] Webhook retrieved event:\\n\" . print_r( $event, true ) );\n\n if ( array_key_exists( $event->type, Helper::get_supported_webhook_events() ) ) {\n DokanStripe::events()->get( $event )->handle();\n }\n\n status_header( 200 );\n exit;\n } catch ( Exception $e ) {\n dokan_log( 'Webhook Processing Error (Event ): ' . $e->getMessage(), 'error' );\n exit;\n }\n }",
"public function check_for_webhook() {\n\t\t\n\t\tif ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$request_body = file_get_contents( 'php://input' );\n\t\t$request_headers = array_change_key_case( $this->get_request_headers(), CASE_UPPER );\n\n\t\tif ( $this->is_valid_request( $request_headers, $request_body ) ) {\n\t\t\t$this->process_webhook( $request_body );\n\t\t\tstatus_header( 200 );\n\t\t\texit;\n\t\t} else {\n\t\t\tWC_Criptanpay_Logger::log( 'Incoming webhook failed validation: ' . print_r( $request_body, true ) );\n\t\t\techo __( 'Incoming webhook failed validation', 'woocommerce-gateway-criptanpay' );\n\t\t\tstatus_header( 400 );\n\t\t\texit;\n\t\t}\n\t}",
"function _bonsai_messages_webhooks_page() {\n if ($_SERVER['REQUEST_METHOD'] !== 'POST') {\n drupal_not_found();\n return;\n }\n\n $input = file_get_contents('php://input');\n $data = json_decode($input, TRUE);\n\n // Temporary logging of received data; will be removed once the feature is\n // developed and tested.\n watchdog(\n 'bonsai',\n 'Received a webhook event with the following data: \"@data\"',\n array(\n '@data' => $input,\n ),\n WATCHDOG_DEBUG\n );\n\n /**\n * @Issue(\n * \"Verify webhook signature taking into account the event domain\"\n * type=\"improvement\"\n * priority=\"normal\"\n * labels=\"security\"\n * )\n * @Issue(\n * \"Prevent webhook replay attacks by checking for reused tokens\"\n * type=\"improvement\"\n * priority=\"normal\"\n * labels=\"security\"\n * )\n */\n\n // We will be issuing a request for getting the full message. Determine the\n // domain and API key to use for the request by checking if there is a\n // recipient matching with one of the supported domains.\n /**\n * @Issue(\n * \"Find the best way to detect domain/key for webhook events that would\n * work for events other than stored events as well\"\n * type=\"bug\"\n * priority=\"low\"\n * labels=\"correctedness\"\n * )\n */\n $domains = variable_get('bonsai_domains');\n if (!$domains) {\n $domains = [\n variable_get('bonsai_domain') => variable_get('bonsai_mailgun_api_key')\n ];\n }\n $domains_without_keys = array_keys($domains);\n\n $api_key = NULL;\n $domain = NULL;\n\n // First, check if the recipient domain is given in the response.\n if (!empty($data['event-data']['recipient-domain'])) {\n $domain = $data['event-data']['recipient-domain'];\n if (in_array($domain, $domains_without_keys)) {\n $api_key = $domains[$domain];\n }\n }\n // Otherwise, try to find a match from the message's recipients.\n elseif (!empty($data['event-data']['message']['recipients'])) {\n foreach ($data['event-data']['message']['recipients'] as $recipient) {\n $recipient_domain = _bonsai_email_get_domain($recipient);\n if (!in_array($recipient_domain, $domains_without_keys)) {\n continue;\n }\n\n $api_key = $domains[$recipient_domain];\n $domain = $recipient_domain;\n }\n }\n\n if (!$domain || !$api_key) {\n watchdog(\n 'bonsai',\n 'Received a webhook event for which we could not determine a supported domain/API key pair. The ID of the event is \"@event_id\".',\n array(\n '@event_id' => $data['event-data']['id'],\n ),\n WATCHDOG_ERROR\n );\n return;\n }\n\n\n // Call the appropriate function depending on the event type.\n $event_type = $data['event-data']['event'];\n $function = '_bonsai_messages_webhooks_page__' . $event_type;\n if (!function_exists($function)) {\n watchdog(\n 'bonsai',\n 'Received a webhook event of an unsupported type \"@event_type\". The ID of the event is \"@event_id\".',\n array(\n '@event_type' => $event_type,\n '@event_id' => $data['event-data']['id'],\n ),\n WATCHDOG_ERROR\n );\n return;\n }\n $repository = bonsai_get_repository(\n array(\n 'api_key' => $api_key,\n 'transform_messages' => TRUE,\n )\n );\n $function($data['event-data'], $repository);\n}",
"function stripe_webhook_page_callback() {\n\n commerce_stripe_load_library();\n // @todo set the correct secret key here\n Stripe::setApiKey('');\n\n $input = @file_get_contents(\"php://input\");\n\n if ($input) {\n $webhook = json_decode($input);\n $type = $webhook->type;\n\n // HOOK!\n rules_invoke_all('stripe_dispute', $webhook, $type);\n\n // Need to return return http 200 status code. set a status msg as well.\n return drupal_json_output(array('status' => 'OK'));\n }\n else {\n drupal_add_http_header('status', '403');\n }\n}",
"public function webHookCallback() {\n\t\tif ( ! isset( $_SERVER['REQUEST_URI'] ) || empty( $_SERVER['REQUEST_URI'] ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if uri is /tinypass/callback\n\t\tif ( ! preg_match( '/^\\/?tinypass\\/callback/', $_SERVER['REQUEST_URI'] ) ) {\n\t\t\treturn;\n\t\t}\n\t\t// Allow from external domains\n\t\theader( 'Access-Control-Allow-Origin: *' );\n\t\ttry {\n\t\t\t// Get data from post or get\n\t\t\t$data = ( isset( $_POST['data'] ) ? $_POST['data'] : ( isset( $_GET['data'] ) ? $_GET['data'] : null ) );\n\t\t\tif ( ! $data ) {\n\t\t\t\t// Try to get data by parsing URI\n\t\t\t\t$params = array();\n\t\t\t\tparse_str( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY ), $params );\n\t\t\t\t$data = ( isset( $params['data'] ) ) ? str_replace( ' ', '+', $params['data'] ) : null;\n\t\t\t}\n\t\t\t// Process found data\n\t\t\t$result = self::$tinypass->processWebhookData( $data );\n\t\t\t$this->processWebhookResult( $result );\n\t\t} catch ( Exception $e ) {\n\t\t\tif ( $e->getCode() == TinypassConfig::ERROR_WEBHOOK_NO_PROCESSOR_FOUND ){\n\t\t\t\t// When there's no processor for event - it still should respond as OK, since otherwise it will block other webhooks\n\t\t\t\theader( 'HTTP/1.1 200 OK' );\n\t\t\t} else {\n\t\t\t\t// This endpoit should be only for tinypass interactions, so it's safe to display fatal errors\n\t\t\t\theader( $_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500 );\n\t\t\t}\n\n\t\t\tdie( $e->getMessage() );\n\t\t}\n\t}",
"public function processWebhook()\n {\n //Listen for callback, validate with server, close checkout\n $callback = json_decode(file_get_contents('php://input'));\n\n if (!$callback) {\n throw new WebhookException('Missing parameters', 1);\n }\n\n $expectedProperties = [\n 'checkoutId',\n 'checkoutHash',\n 'reference',\n 'paid',\n 'amount',\n 'phone',\n 'transactionCode',\n 'paymentMethod',\n 'note',\n 'signature',\n ];\n\n foreach ($expectedProperties as $property) {\n if (!property_exists($callback, $property)) {\n throw new WebhookException('Missing parameters', 1);\n }\n }\n\n if (!$this->signatureValid($callback)) {\n throw new WebhookException('Callback signature validation failed', 1);\n }\n\n if (!$checkout = $this->fetchCheckout($callback->checkoutHash)) {\n throw new WebhookException('Checkout fetch failed', 1);\n }\n\n //Defense: Gava doesn't yet have automated status changes from paid to not paid.\n //And Gava will not send a webhook notification for checkouts that have not been paid for\n if (!$checkout->paid) {\n throw new WebhookException('Checkout not paid', 1);\n }\n\n return $checkout;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
function: ValidTrms ( parameters ) Purpose:To check whether the terms and conditions checkbox is checked ot not Parameters: $value Returns/Assigns:empty string on success (or) error message on error Modules Used: Merchant
|
function ValidTrms($value)
{
if($value !="1")
{
$errmsg="Accept terms and conditions.";
}
else
{
$errmsg="";
}
return $errmsg;
}
|
[
"public function acceptTermsAndConditions($value)\n {\n if($value!=1){\n $this->form_validation->set_message('acceptTermsAndConditions', _l(\"Accept the {field} is required.\", $this));\n return false;\n }\n\n return true;\n }",
"public function accept_term_and_condition(){\n\t\tif ($this->input->post('accept_terms')){\n\t\t\treturn TRUE;\n\t\t}\n\t\telse{\n\t\t\t$error = 'Please accept term and condition!.';\n\t\t\t$this->form_validation->set_message('accept_term_and_condition', $error);\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"protected function checkOrderForm() {\n \n $msgBox = '';\n $msg = '';\n \n if (!isset($this->piVars['overview_checkbox_terms'])) {\n $msg .= $this->pi_getLL('overview_checkbox_terms_error').'<br />';\n }\n if (!isset($this->piVars['overview_checkbox_withdrawal'])) {\n $msg .= $this->pi_getLL('overview_checkbox_withdrawal_error').'<br />';\n }\n \n if ($msg != '') {\n $msgBoxObj = new tx_pttools_msgBox('error', $msg);\n $msgBox = $msgBoxObj->__toString(); \n }\n \n return $msgBox;\n \n }",
"function check_payment_form(){\n global $error;\n global $vars;\n global $db;\n\n //\n if (!intval($vars['product_id'])) {\n $error[] = 'Please select Membership Type';\n }\n if (!strlen($vars['paysys_id'])){ \n $error[] = 'Please select Payment System';\n }\n if (!strlen($vars['name_f'])){\n $error[] = 'Please enter your First Name';\n }\n if (!strlen($vars['name_l'])){\n $error[] = 'Please enter your Last Name';\n }\n if (!check_email($vars['email'])){\n $error[] = 'Please enter valid Email';\n }\n if (!preg_match('/^\\w{4}\\w*$/', $vars['login'])){\n $error[] = \"Please enter correct login. It should contain at least 4 letters, digits or _\";\n }\n else if (!$db->check_uniq_login($vars['login'])){\n $error[] = \"Login '$vars[login]' already used. Please enter another login\";\n }\n if (!strlen($vars['pass0'])){\n $error[] = 'Please enter Password';\n }\n if ($vars['pass0'] != $vars['pass1']){\n $error[] = 'Password and Password Confirmation are different. Please reenter both';\n }\n return !count($error);\n}",
"function isCheckboxValueValid($value)\n{\n return ($value == \"on\" || $value == \"\");\n}",
"function isValidForm( $theCustomerNo, $theTourCodes, $theMonthNo ) \n{\n\n}",
"function check_required_values() {\n\n\t\treturn $this->check_required_input();\n\n\n\t}",
"function wc_get_terms_and_conditions_checkbox_text()\n {\n }",
"function checkForm($campaignstartdt,$campaignenddt,$campaigntype,$campaignimpression)\n{\n\tglobal $smarty,$_TPLPATH;\n\tglobal $dbbms,$dbsums;\n\t$check=1;\n\t\n\t/*$campaignname=trim(addslashes($campaignname));\n\t$campaignimpression=trim(addslashes($campaignimpression));\n\tif($campaignname==\"\")\n\t{\n\t\t$errormsg=\"To continue, please enter name of the campaign.\";\n\t\t$check= 0;\n\t}\n\telse\n\t*/\n\tif($campaignenddt<$campaignstartdt)\n\t{\n\t\t$errormsg=\"To continue, please enter the duration correctly.\";\n\t\t$check=0;\n\t}\n\telseif($campaigntype==\"impression\"&&($campaignimpression==\"\"||$campaignimpression==\"0\"))\n\t{\n\t\t$errormsg=\"Please enter no of imp, compulsory with impression type campaign\";\n\t\t$check=0;\n\t}\n\telseif($campaigntype==\"duration\"&&($campaignimpression!=\"\"))\n\t{\n\t\t$errormsg=\"You cannot enter impressions with duration type banners.\";\n\t\t$check=0;\n\t}\n\telse\n\t{\n\t\n\t}\n\t\n\tif($check==0)\n\t{\n\t\t$smarty->assign(\"errormsg\",$errormsg);\n\t \treturn 0;\n\t}\n\telse \n\t\treturn 1;\n\n}",
"public function terms_conditions()\n {\n // Hold current url of this page in session for redirection purpose\n $url = array('url' => current_url());\n\n $this->session->set_userdata($url);\n\n $this->data['terms'] = $this->home_m->get_data('terms')->row_array();\n\n $body = 'terms_conditions' ;\n\n $this->load_pages($body,$this->data);\n }",
"function termsconditions()\n\t{\n\t\t$data['show_data'] = $this->CMSPage->getData('2');\n\t\t$this->loadViews('termscondition', $this->global, $data, NULL);\n\t}",
"function getCreditTermVal($ValueId) {\r\n\t global $adb;\r\n\t $QryCheck = \"SELECT vtiger_xcreditterm.cf_xcreditterm_distid,vtiger_xcreditterm.credittermcode FROM vtiger_xcreditterm INNER JOIN vtiger_crmentity ON vtiger_xcreditterm.xcredittermid = vtiger_crmentity.crmid INNER JOIN vtiger_xcredittermcf ON vtiger_xcreditterm.xcredittermid = vtiger_xcredittermcf.xcredittermid WHERE vtiger_crmentity.deleted=0 AND vtiger_xcreditterm.xcredittermid=$ValueId\";\r\n\t $resultVal = $adb->pquery($QryCheck);\r\n\t $result_row_Credit = $adb->fetch_row($resultVal);\r\n\t $CreditDistVAlue = $result_row_Credit['cf_xcreditterm_distid'];\r\n\tif(empty($CreditDistVAlue)){\r\n\t\t $retutn_credit_Value = 'N';\r\n\t }\r\n\t else{\r\n\t\t$retutn_credit_Value = 'Y'; \r\n\t }\r\n\treturn $retutn_credit_Value;\r\n}",
"public function actionGetTermsAndCondition() {\n\n $request = $this->_readJsonRequest();\n $this->_un = trim(trim($request['SystemUsername']));\n $this->_dt = trim(trim($request['AccessDate']));\n $this->_tkn = trim(trim($request['Token']));\n\n $paramval = CJSON::encode($request);\n $message = \"[GetTermsAndCondition] Input: \" . $paramval;\n CLoggerModified::log($message, CLoggerModified::REQUEST);\n $isconnvalid = $this->_authenticate();\n if ($isconnvalid == 0) {\n //$this->renderFile(Yii::app()->params['termsandconditionpath']);\n $errCode = 0;\n $transMsg = 'Success';\n $terms = file_get_contents(Yii::app()->params['termsandconditionpath']);\n $data = CommonController::gettermsandcondition($transMsg, $errCode, $terms);\n $this->_sendResponse(200, $data);\n } else {\n switch ($isconnvalid) {\n case 1:\n $transMsg = 'Unauthorized Access! System does not have access right.';\n break;\n case 2:\n $transMsg = 'Request time out.';\n break;\n case 3:\n $transMsg = 'Incomplete/Invalid Request Data.';\n break;\n }\n $errCode = $isconnvalid;\n $data = CommonController::authenticate($transMsg, $errCode);\n $this->_sendResponse(200, $data);\n }\n $message = \"[GetTermsAndCondition] Token: \" . $this->_tkn . \", Output: \" . $data;\n CLoggerModified::log($message, CLoggerModified::RESPONSE);\n }",
"function getTermsandConditions()\r\n{\r\n\tglobal $log;\r\n\t$log->debug(\"Entering getTermsandConditions() method ...\");\r\n global $adb;\r\n $sql1 = \"select * from vtiger_inventory_tandc\";\r\n $result = $adb->mquery($sql1, array());\r\n $tandc = $adb->query_result($result,0,\"tandc\");\r\n\t$log->debug(\"Exiting getTermsandConditions method ...\");\r\n return $tandc;\r\n}",
"public function actionCheckBox()\n\t\t{\n\t\t\t$schoolName = School::model()->findByPk($_POST['schoolId'])->school_name;\n\t\t\t$periodName = Period::model()->findByPk($_POST['periodId'])->period_name;\n\t\t\t$classId = $_POST['classId'];\n\t\t\tif(isset($_POST['truantCheckBox']))\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\t$results = $_POST['truantCheckBox'];\n\t\t\t\t\t$flashError = \"\"; // Initializes Flash Error\n\t\t\t\t\t$flashSuccess = \"\"; // Initializes Flash Success\n\t\t\t\t\t\n\t\t\t\t\tforeach($results as $id)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$studentName = CHtml::encode(Student::model()->findByPk($id)->student_first_name) . \" \" . \n\t\t\t\t\t\t\tCHtml::encode(Student::model()->findByPk($id)->student_last_name);\n\t\t\t\t\t\t\t// Connect each Student ID with related Contact ID's\n\t\t\t\t\t\t\t$rawData = new CActiveDataProvider('Contact', array(\n\t\t\t\t\t\t\t\t\t\t\t'criteria'=>array(\n\t\t\t\t\t\t\t\t\t\t\t\t'with'=>array('student_contact'),\n\t\t\t\t\t\t\t\t\t\t\t\t'condition'=>'student_contact.student_id=:studentId',\n\t\t\t\t\t\t\t\t\t\t\t\t'params'=>array(':studentId'=>$id),\n\t\t\t\t\t\t\t\t\t\t\t\t'together'=>true,\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t$message = $studentName . \" is currently marked absent for \" . $periodName . \" at \" . $schoolName . \".\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t////\n\t\t\t\t\t\t\tforeach($rawData->data as $v)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t // TO DO: Add Verification that the Student ID and Contact ID match the Cell Phone Number\n\t\t\t\t\t\t\t\t if($v->method == \"text\")\n\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t \t\tif($v->stopTruantAlert != 0)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t$flashError = '<b>' . $studentName . '</b>: ' . $v->contact_name . ' has requested to no longer receive truancy notices.';\n\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\telseif($v->stopTruantAlert == 0)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif(self::actionTwilioTxt($v->data, $message))\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$flashSuccess .= \"<b>\" . $studentName . \":</b> \" . $v->contact_name . \" via \" . $v->method . \" at \" . $v->data . \".<br />\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t elseif($v->method == \"voice\")\n\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t \t\tif($v->stopTruantAlert != 0)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t$flashError = '<b>' . $studentName . '</b>: ' . $v->contact_name . ' has requested to no longer receive truancy notices.';\n\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\telseif($v->stopTruantAlert == 0)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t \t\t\t\t//$flashError = \"We haven't set up Voice Notifications Yet. Yell at Matthew.\";\n\t\t\t\t\t\t\t\t \t\t\t\tif(self::actionTwilioVoice($v->data, $message))\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$flashSuccess .= \"<b>\" . $studentName . \":</b> \" . $v->contact_name . \" via \" . $v->method . \" at \" . $v->data . \".<br />\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t elseif($v->method == \"email\")\n\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t \t\tif($v->stopTruantAlert != 0)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t$flashError = '<b>' . $studentName . '</b>: ' . $v->contact_name . ' has requested to no longer receive truancy notices.';\n\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\telseif($v->stopTruantAlert == 0)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t//$flashError = \"We haven't set up Email Notifications Yet. Yell at Matthew\";\n\t\t\t\t\t\t\t\t \t\t\t\tif(self::actionEmail($v->data, $v->contact_name, $schoolName, $message))\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$flashSuccess .= \"<b>\" . $studentName . \":</b> \" . $v->contact_name . \" via \" . $v->method . \" at \" . $v->data . \".<br />\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$flashSuccess .= \"<br />\";\n\t\t\t\t\t\t\t////\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t// Messages Sent Flash and Redirect\n\t\t\t\t\tif($flashError != \"\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tYii::app()->user->setFlash('error', $flashError);\n\t\t\t\t\t\t}\n\t\t\t\t\tif(strlen($flashSuccess) > 6)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tYii::app()->user->setFlash('success', $flashSuccess);\n\t\t\t\t\t\t}\t\n\t\t\t\t\t$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('cls/' . $classId));\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tYii::app()->user->setFlash('error', 'No students were marked truant. No Messages Sent.');\t\n\t\t\t\t\t$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('cls/' . $classId));\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\t\t\t\n\t\t}",
"public function validate_field_values( $wizard_values )\r\n\t{\r\n\t\t// test invalid value\r\n\t\t// $wizard_values['gender'] = 'asdasdas';\r\n\r\n\t\t$reuiqred_field_template = __( '%s is required', WCT_DOMAIN );\r\n\t\t$invalid_value_template = __( 'Invalid %s selection.', WCT_DOMAIN );\r\n\r\n\t\t// check product ( fabric )\r\n\t\t$wizard_values['fabric'] = (int) $wizard_values['fabric'];\r\n\t\t$fabric = get_product( $wizard_values['fabric'] );\r\n\r\n\t\t// is it available to purchase\r\n\t\tif ( !$fabric || false === $fabric->is_purchasable() )\r\n\t\t{\r\n\t\t\twc_add_notice( __( 'Sorry, this product cannot be purchased.', WCT_DOMAIN ), 'error' );\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// check gender\r\n\t\tif ( !in_array( $wizard_values['gender'], array( 'male', 'female' ) ) )\r\n\t\t{\r\n\t\t\twc_add_notice( sprintf( $invalid_value_template, __( 'Gender', WCT_DOMAIN ) ), 'error' );\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// check measurements\r\n\t\t$measurements = WC_Tailor()->account_updates->account_details_fields['measures_inputs'];\r\n\r\n\t\t// measures list\r\n\t\tif ( array_keys( $wizard_values['measures'] ) !== array_keys( WC_Tailor()->account_updates->body_measurements ) )\r\n\t\t{\r\n\t\t\twc_add_notice( sprintf( __( 'Invalid %s values.', WCT_DOMAIN ), __( 'Measurements', WCT_DOMAIN ) ), 'error' );\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// sanitize measures values\r\n\t\t$wizard_values['measures'] = array_map( array( &WC_Tailor()->account_updates, 'parse_meausre' ), $wizard_values['measures'] );\r\n\r\n\t\t// check body profile values\r\n\t\t$body_profile_fields = WC_Tailor()->account_updates->get_account_details_by_section( 'body_profile' );\r\n\t\tforeach ( $body_profile_fields as $field_name => $field_args )\r\n\t\t{\r\n\t\t\t$input_name = str_replace( 'body_profile_', '', $field_name );\r\n\t\t\t$field_args['label'] = preg_replace( '/<span.+/', '', $field_args['label'] );\r\n\r\n\t\t\t// gender related\r\n\t\t\tif ( !in_array( $wizard_values['gender'], $field_args['gender'] ) )\r\n\t\t\t{\r\n\t\t\t\tif ( isset( $wizard_values['body_profile'][$input_name] ) )\r\n\t\t\t\t\tunset( $wizard_values['body_profile'][$input_name] );\r\n\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// is value exists\r\n\t\t\tif ( !isset( $wizard_values['body_profile'][$input_name] ) )\r\n\t\t\t{\r\n\t\t\t\twc_add_notice( sprintf( $reuiqred_field_template, $field_args['label'] ), 'error' );\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// parse value\r\n\t\t\t$value = WC_Tailor()->account_updates->parse_field_value( $field_name, $field_args, $wizard_values['body_profile'][$input_name] );\r\n\t\t\tif ( is_wp_error( $value ) )\r\n\t\t\t{\r\n\t\t\t\twc_add_notice( $value->get_error_message(), 'error' );\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// check shirt characters related to selected gender\r\n\t\tif ( !isset( $wizard_values['shirt-characters'][ $wizard_values['gender'] ] ) )\r\n\t\t{\r\n\t\t\twc_add_notice( __( 'Shirt\\'s Characteristics options are not selected yet.', WCT_DOMAIN ), 'error' );\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// selected characters\r\n\t\t$wizard_values['shirt-characters'] = $wizard_values['shirt-characters'][ $wizard_values['gender'] ];\r\n\r\n\t\t// registered ones\r\n\t\t$shirt_characters = $this->get_shirt_charaters();\r\n\r\n\t\tforeach ( $shirt_characters[ $wizard_values['gender'] ] as $character_index => $character_info )\r\n\t\t{\r\n\t\t\t$field_name = 'character-'. $character_index;\r\n\r\n\t\t\t// check existence\r\n\t\t\tif ( !isset( $wizard_values['shirt-characters'][$field_name] ) )\r\n\t\t\t{\r\n\t\t\t\twc_add_notice( sprintf( $reuiqred_field_template, $character_info['label'] ), 'error' );\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// check value\r\n\t\t\t$field_value = (int) $wizard_values['shirt-characters'][$field_name];\r\n\t\t\tif ( !isset( $character_info['values']['price'][$field_value] ) || !isset( $character_info['values']['label'][$field_value] ) )\r\n\t\t\t{\r\n\t\t\t\twc_add_notice( sprintf( $invalid_value_template, $character_info['label'] ), 'error' );\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t$wizard_values['shirt-characters'][$field_name] = array (\r\n\t\t\t\t\t'label' => $character_info['label'],\r\n\t\t\t\t\t'value_index' => $field_value,\r\n\t\t\t\t\t'value_label' => $character_info['values']['label'][$field_value],\r\n\t\t\t\t\t'value_price' => (float) $character_info['values']['price'][$field_value],\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn $wizard_values;\r\n\t}",
"function sanitize_checkbox($value) {\n\t\t\treturn ( $value ) ? 1 : 0;\n\t\t}",
"function validate() {\n if( empty($_POST['category']) || empty($_POST['complaint']) || empty($_POST['subject']) ) {\n echo \"<script>alert('Fill the Required fields')</script>\";\n return false;\n }\n return true;\n }",
"function ValidateCheckboxValues($field_name, $rs_valid_values, $delimiter)\r\n{\r\n $valid_values = GetValidValues($rs_valid_values);\r\n $option_list = array();\r\n $serialized_values = '';\r\n \r\n if (isset($_POST[$field_name]))\r\n {\r\n $option_list = $_POST[$field_name];\r\n foreach($option_list as $key => $option)\r\n {\r\n //echo 'key: ' . $key . ' O:' . $option . ' - ' . is_numeric($option) . '<br>';\r\n \r\n if (is_numeric($option) && in_array($option, $valid_values))\r\n {\r\n $serialized_values = (0 == strlen($serialized_values)) ? $serialized_values = $option : $serialized_values = $serialized_values . $delimiter . $option;\r\n }\r\n }\r\n }\r\n return $serialized_values;\r\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Checks if the Operation Mode is Standalone
|
public static function isOperationModeStandalone()
{
return self::$nb_engine !== null && self::$operation_mode === self::ENGINE_MODE_STANDALONE;
}
|
[
"public function isStandaloneAcceptance() {\n return ($this->getJobTypeId() == JobType::TYPE_STANDALONE_ACCEPTANCE);\n }",
"public function isTestMode(){\n\t\treturn $this->configurationAdapter->getConfigurationValue('operating_mode') != 'live';\n\t}",
"public function isModeSandbox()\n {\n if ($this->getMode() === '1') {\n return true;\n }\n\n return false;\n }",
"protected function isAllowed()\n {\n if (null === $this->mode) {\n return false;\n }\n\n if ($this->mode->name() !== 'STAGE' && $this->mode->name() !== 'DEV') {\n return false;\n }\n\n return true;\n }",
"protected function isSpecblock(){\n return AMI_Registry::get('ami_specblock_mode', false);\n }",
"public function isStandaloneQAJob() {\n return ($this->getJobType()->id == JobTypePA::TYPE_STANDALONE_QA);\n }",
"protected function _isTestModePresent()\n {\n return (isset($this->args[self::$testModeParamName]) ? true : false); \n }",
"public static function isRunningModeDev() \n\t{\n\t\treturn ( 'dev' === self::getRunningMode() ) ? true : false;\n\t}",
"public static function test_mode()\n\t {\n\t\tif ( (defined('PCH\\LIVE_ALL') and PCH\\LIVE_ALL === true) || (defined('PCH\\LIVE_RESQ') and PCH\\LIVE_RESQ === true) )\n\t\t\t$test = false;\n\t\telse\n\t\t\t$test = false;//sfContext::getInstance()->getUser()->is_test();\n\n\t\treturn $test;\n\t }",
"public function is_test_mode() {\n\t\treturn $this->testmode == \"yes\";\n\t}",
"public static function isTestMode()\n {\n return (self::getMode() === DApplicationMode::MODE_TEST);\n }",
"public static function isInMaintenanceMode() {\n return File::exists(storage_path('/framework/down-provision-administration'));\n }",
"public function isTestMode() {\r\n\t\treturn $this->getConfigData('testmode') == 1;\r\n\t}",
"function is_test_mode()\n\t{\n\t\treturn $this->test_mode;\n\t}",
"public static function isMonetizable() {\n try {\n $sdk_connector = \\Drupal::service('apigee_edge.sdk_connector');\n $organization_controller = new OrganizationController($sdk_connector->getClient());\n $organization = $organization_controller->load($sdk_connector->getOrganization());\n // Check if org is Hybrid or ApigeeX.\n if ($organization && ('CLOUD' === $organization->getRuntimeType() || 'HYBRID' === $organization->getRuntimeType()) && $organization->getAddonsConfig()) {\n return (TRUE === $organization->getAddonsConfig()->getMonetizationConfig()->getEnabled());\n }\n else {\n return ($organization->getPropertyValue('features.isMonetizationEnabled') === 'true');\n }\n }\n catch (\\Exception $exception) {\n // Do not log the exception here. This litters the logs since this is run\n // before each install tasks.\n }\n\n return FALSE;\n }",
"protected function maintenance_mode() {\n\t\treturn file_exists(ABSPATH . '.maintenance') || defined('WP_INSTALLING');\n\t}",
"protected function is_test_mode(): bool {\n\t\t\treturn isset( $this->settings['test_mode'] ) && $this->settings['test_mode'];\n\t\t}",
"public static function isMSSInstalled()\n {\n $modules = (array)Mage::getConfig()->getNode('modules')->children();\n return array_key_exists('AW_Marketsuite', $modules)\n && 'true' == (string) $modules['AW_Marketsuite']->active;\n }",
"public static function isSuiteRunned()\n {\n return self::$rootItemID != self::EMPTY_ID;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Indicates whether the webservice is running.
|
public function isWebserviceRunning()
{
$this->lastResult = $this->wsfeClient->FEDummy();
$this->exceptionIfOperationHasErrors($this->lastResult);
if ($this->lastResult)
return (($this->lastResult->FEDummyResult->AppServer == "OK") && ($this->lastResult->FEDummyResult->DbServer == "OK") && ($this->lastResult->FEDummyResult->AuthServer == "OK"));
else
return false;
}
|
[
"public function isRunning(): bool\n {\n foreach ($this->services as $service) {\n $this->name = $service;\n\n if (!parent::isRunning()) {\n $this->name = '';\n\n return false;\n }\n }\n\n $this->name = '';\n\n return true;\n }",
"public function isRunning(): bool\n {\n return $this->eventDispatcher && $this->eventDispatcher->isListening();\n }",
"public function isRunning()\n {\n if ($this->isStarted()) {\n return $this->procStatus('running');\n }\n return false;\n\n }",
"public function is_running() {\n\t\t\treturn $this->is_process_running();\n\t\t}",
"public function isRunning()\n {\n if ($this->process === null) {\n return false;\n }\n\n $status = $this->getFreshStatus();\n\n return $status !== null ? $status['running'] : false;\n }",
"protected function isRunning()\n {\n return $this->task->getStatus() == ServerTask::RUNNING;\n }",
"public function isRunning()\n {\n if (null === $this->connection) {\n return false;\n }\n\n return $this->connection->isConnected();\n }",
"public function getIsRunning()\n {\n return $this->isRunning;\n }",
"public static function isRunning()\n {\n try {\n $process = new Process(self::getServerPID());\n\n return $process->isAlive();\n } catch (\\Exception $e) {\n return false;\n }\n }",
"public function isInService() : bool {\n return $this->getServicingJob() ? true : false;\n }",
"public function isRunning()\n\t{\n\t\treturn $this->startTime > 0;\n\t}",
"public function isServerRunning(): bool\n {\n return '' !== $this->getServerPid();\n }",
"public function isRunning()\n {\n foreach ($this->processes as $process) {\n if ($process->isRunning()) {\n return true;\n }\n }\n\n return false;\n }",
"public function isRunning()\n {\n $status = proc_get_status($this->mProcess);\n return (true === $status['running']);\n }",
"public function is_in_service() : bool {\n\t\treturn $this->is_in_service;\n\t}",
"protected function isRoadRunnerServerRunning()\n {\n return app(RoadRunnerServerProcessInspector::class)\n ->serverIsRunning();\n }",
"public function isServerRunning()\n {\n // Always return true for now as this requires the openmeetings object\n // to have been instanciated and this includes a loginUser() which\n // connects to the server\n return true;\n }",
"public function is_running() {\n if (is_resource($this->process_handle)) {\n $stat = proc_get_status($this->process_handle);\n return ! (! $stat['running'] || $stat['signaled'] || $stat['stopped']);\n }\n return false;\n }",
"public function IsRunning()\n\t{\n\t\tforeach( $this->_reservations as $reservation ) {\n\t\t\tif ( $reservation->ReservationRunning ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
get all contracts or single contract
|
function contracts($contract_id){
$url = MARKET_API_URL."/contracts?contract_id=".$contract_id;
$tResult = $this->httpRequest($url,'');
return json_decode($tResult,1);
}
|
[
"public function get_contract() {\n return model_contract::load_by_id($this->contract_id);\n }",
"public function getContracts(){\n\n $entitiesArray = $this->getJoinedEntities(AssetFactory::$tokenJoinVerb) ;\n\n //entity not found it might be beause the factory hasn't been joined\n if (!$entitiesArray) {\n $contractFactory = new GenericContractFactory();\n $this->factory->joinFactory(AssetFactory::$tokenJoinVerb, $contractFactory);\n $this->factory->joinPopulate();\n $entitiesArray = $this->getJoinedEntities(AssetFactory::$tokenJoinVerb) ;\n }\n\n $contracts = null ;\n $this->factory->getTriplets();\n $entitiesArray = $this->getJoinedEntities(AssetFactory::$tokenJoinVerb);\n //we keep only contract entities\n foreach($entitiesArray ? $entitiesArray : array() as $entity){\n if ($entity instanceof BlockchainContract) $contracts[] = $entity ;\n\n }\n\n //$this->factory->populateBrotherEntities()\n return $contracts;\n\n }",
"public function contracts()\n {\n return $this->hasMany('App\\Models\\Contract', 'contract_id', 'id');\n }",
"public function getContracts()\n {\n return $this->contracts;\n }",
"function getContractors()\r\n {\r\n $sql = \"SELECT * FROM contractor\";\r\n\r\n $statement = $this->_dbh->prepare($sql);\r\n\r\n $statement->execute();\r\n\r\n return $statement->fetchAll(PDO::FETCH_ASSOC);\r\n }",
"public function contracts()\n {\n $contracts = Cache::remember($this->getCacheKey('contracts'), Carbon::now()->addWeek(), function()\n {\n $results = KemAPI::get('store', ['embed' => 'contracts']);\n\n // Create an easily accessible array before caching it.\n $data = [];\n foreach ($results->contracts as $contract) {\n $data[$contract->slug] = $contract;\n }\n\n return $data;\n });\n\n return $contracts;\n }",
"public function contracts() {\n return $this->hasMany(Contract::class, 'company_id', 'id');\n }",
"public function getContracts()\n {\n return $this->hasMany(Contract::className(), ['branch' => 'id']);\n }",
"public function contracts() {\n return $this->hasMany('App\\Models\\Contract', 'contract_projectid', 'project_id');\n }",
"public function contract($contractor_id)\n\t{\n\t\treturn $this->contracts()->where('contractor_id',$contractor_id)->where(\"deleted\",0)->first();\n\t}",
"public function currentContract() {\n return CurrentContracts::findOrFail($this->id_contract);\n }",
"protected function getContract($arguments = [])\n {\n if ($contract = data_get($arguments, 'contract') and $contract instanceOf Contract) {\n return $contract->load($this->relations);\n }\n # Resolve Contract from DB\n return $this->contract->with($this->relations)->findOrFail(data_get($arguments, 'id'));\n }",
"public function getContracts($criteria = null, PropelPDO $con = null)\n {\n $partial = $this->collContractsPartial && !$this->isNew();\n if (null === $this->collContracts || null !== $criteria || $partial) {\n if ($this->isNew() && null === $this->collContracts) {\n // return empty collection\n $this->initContracts();\n } else {\n $collContracts = ContractQuery::create(null, $criteria)\n ->filterByDoc($this)\n ->find($con);\n if (null !== $criteria) {\n if (false !== $this->collContractsPartial && count($collContracts)) {\n $this->initContracts(false);\n\n foreach ($collContracts as $obj) {\n if (false == $this->collContracts->contains($obj)) {\n $this->collContracts->append($obj);\n }\n }\n\n $this->collContractsPartial = true;\n }\n\n $collContracts->getInternalIterator()->rewind();\n\n return $collContracts;\n }\n\n if ($partial && $this->collContracts) {\n foreach ($this->collContracts as $obj) {\n if ($obj->isNew()) {\n $collContracts[] = $obj;\n }\n }\n }\n\n $this->collContracts = $collContracts;\n $this->collContractsPartial = false;\n }\n }\n\n return $this->collContracts;\n }",
"public function order_contract()\n {\n return $this->hasOne(Contract::class, 'id', 'order_contract_id');\n // ->select(['id', 'contract_number', 'contract_address']);\n }",
"public function getContract($idShip = null, $idContract = '')\n {\n // Query get contract\n $contract = DB::table('m_contract')\n ->join('m_ship', function($join) {\n $join->on('m_ship.id', '=', 'm_contract.ship_id')\n ->where('m_ship.del_flag', Constant::DELETE_FLAG_FALSE);\n })\n ->join('m_service', function($join) {\n $join->on('m_service.id', '=', 'm_contract.service_id')\n ->where('m_service.del_flag', Constant::DELETE_FLAG_FALSE);\n })\n ->select([\n \"m_contract.id as contract_id\",\n \"m_contract.revision_number as contract_revision_number\",\n \"m_contract.start_date as contract_date_start\",\n \"m_contract.end_date as contract_date_end\",\n \"m_contract.status as contract_status\",\n \"m_contract.approved_flag as contract_approved_flag\",\n \"m_contract.reason_reject as contract_reason_reject\",\n \"m_contract.created_at as contract_created_at\",\n \"m_contract.updated_at as contract_updated_at\",\n \"m_contract.approved_flag as contract_approved_flag\",\n \"m_contract.start_pending_date as contract_start_pending_date\",\n \"m_contract.end_pending_date as contract_end_pending_date\",\n \"m_contract.remark as contract_remark\",\n \"m_contract.del_flag as contract_del_flag\",\n \"m_contract.deleted_at as contract_deleted_at\",\n \"m_service.id as service_id\",\n \"m_service.name_jp as service_name\",\n \"m_ship.id as contract_ship_id\",\n ])\n ->whereIn('approved_flag', [\n Constant::STATUS_APPROVED,\n Constant::STATUS_WAITING_APPROVE,\n Constant::STATUS_REJECT_APPROVE]);\n\n // Check if get all contract inside all ship\n if (empty($idShip) || is_null($idShip)) {\n if (!empty($idContract) && !is_null($idContract)) {\n if (is_array($idContract))\n return $contract\n ->whereIn('m_contract.id', $idContract)\n ->orderBy('m_contract.id', 'DESC')\n ->get();\n return $contract\n ->where('m_contract.id', $idContract)\n ->first();\n }\n\n return $contract\n ->orderBy('m_contract.id', 'DESC')\n ->get();\n }\n\n // If get contract inside a ship\n if (!empty($idContract) && !is_null($idContract)) {\n if (is_array($idContract))\n return $contract\n ->whereIn('m_contract.id', $idContract)\n ->where('m_ship.id', $idShip)\n ->orderBy('m_contract.id', 'DESC')\n ->get();\n return $contract\n ->where('m_contract.id', $idContract)\n ->where('m_ship.id', $idShip)\n ->orderBy('m_contract.id', 'DESC')\n ->first();\n }\n\n return $contract\n ->where('m_ship.id', $idShip)\n ->orderBy('m_contract.id', 'DESC')\n ->get();\n }",
"public function getContract($id)\n {\n return $this->getCurlService()\n ->to( $this->crmBaseUrl .'/api/contracts/'. $id )\n ->withData( $this->addCrmApiKey() )\n ->get();\n }",
"public function contract()\n {\n \treturn $this->hasOne('App\\Models\\Contract');\n }",
"public function showContracts($params = null);",
"public static function findContractorById($id) {\n\n $sql = \"SELECT * FROM contractor WHERE id='$id'\";\n $data = self::query($sql);\n\n return $data;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
wptt_is_local Wraps the is_staging function. Returns true if site matches staging defined sites
|
function wptt_is_staging(){
$var = new WPTT_Dev_Constants();
return $var->is_staging();
}
|
[
"public static function isLocal()\n {\n $env = strtolower(app(\"env\"));\n\n if(\n $env == \"local\" ||\n $env == \"staging\"\n ) {\n return true;\n }\n\n return false;\n }",
"function wpstg_is_stagingsite()\n{\n return (new \\WPStaging\\Framework\\SiteInfo())->isStaging();\n}",
"public static function is_staging() : bool\n {\n return self::$environment == self::STAGING;\n }",
"public function is_staging(): bool {\n\t\t\t// Check if customization is disabled\n\t\t\treturn $_SERVER['STORE_STAGING'] === 'yes';\n\t\t}",
"private function environmentCheck() {\n \n \n if ( strstr($this->server['SERVER_NAME'], self::STAGING_HOST)) {\n \n return 'staging';\n }\n \n if ( strstr($this->server['SERVER_NAME'], self::LIVE_HOST)) {\n \n return 'live';\n }\n \n return false;\n \n \n \n }",
"function live_or_local(){\n if( strpos( $_SERVER['HTTP_HOST'], '.dev') !== false ){\n //on .dev site\n $liveOrLocal = 'local';\n } else {\n $liveOrLocal = 'live';\n }\n return $liveOrLocal;\n}",
"protected function isLocal() : bool\n {\n return $this->getAppEnv() === 'local';\n }",
"public function isStaging()\n {\n return $this['env'] === 'staging';\n }",
"public function isLocal(): bool\n {\n\n if ( $this->states[ 'LOCAL' ] )\n {\n return true;\n }\n if ( null === $this->sld )\n {\n return false;\n }\n\n return $this->sld->isLocal();\n\n }",
"public static function local () {\r\n\t\t\t// When running WP-CLI, the `$_SERVER variable` exists but many values are not set.\r\n\t\t\t// Therefore, we need to check whether the value is set before reading it. Otherwise\r\n\t\t\t// an error occurs.\r\n\t\t\t$is_local = (\r\n\t\t\t\t( isset( $_SERVER['SERVER_ADDR'] ) && $_SERVER['SERVER_ADDR'] === '127.0.0.1' ) ||\r\n\t\t\t\t( isset( $_SERVER['HTTP_HOST'] ) && __ends_with( $_SERVER['HTTP_HOST'], '.local' ) ) ||\r\n\t\t\t\t( isset( $_SERVER['SERVER_NAME'] ) && __ends_with( $_SERVER['SERVER_NAME'], '.local' ) )\r\n\t\t\t);\r\n\t\t\treturn $is_local;\r\n\t\t}",
"public function isLocal(): bool\n {\n return $this->env === 'local';\n }",
"private function isLocal()\n\t{\n\t\treturn $_SERVER['REMOTE_ADDR'] === 'localhost' || $_SERVER['REMOTE_ADDR'] === '127.0.0.1';\n\t}",
"public function is_test_environment() {\n\n if(empty($this->production_site_url))\n return true;\n else\n return get_site_url() === $this->production_site_url ? false : true;\n }",
"function drush_is_local_host($host) {\n // Check to see if the provided host is \"local\".\n // @see hook_drush_sitealias_alter() in drush.api.php.\n return $host == 'localhost' || $host == '127.0.0.1';\n}",
"public function isLocal()\n {\n return $this['env'] = 'local';\n }",
"function check_local_dev(){\n\n\t\t// if local URL is defined\n\t\tif (defined('LOCAL_URL')) {\n\n\t\t\t// define current site url\n\t\t\t$current_site_url = get_site_url();\n\n\t\t\t// if current site url and local url match\n\t\t\tif ($current_site_url == LOCAL_URL){\n\n\t\t\t\t// call the local dev css function on the admin_head action\n\t\t\t\tadd_action('admin_head', array(&$this, 'local_dev_css'));\n\n\t\t\t}\n\n\t\t}\n\n\t}",
"public function is_local_mode() {\n return ( $this->app_mode == 'local' ) ? TRUE : FALSE;\n }",
"public function isLocalhost()\n\t{\n\t\tif ( isset( $this->data['host'] ) )\n\t\t{\n\t\t\t/* If URL is literally http://localhost, obviosuly this is local */\n\t\t\tif ( $this->data['host'] == 'localhost' )\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t\t\n\t\t\t/* ... or if the URL has the same host as the community's base URL */\n\t\t\t$baseUrlHostname = static::internal('')->data['host'];\n\t\t\tif ( preg_match( \"#\\.\" . preg_quote( $baseUrlHostname ) . \"$#\", '.' . $this->data['host'] ) or preg_match( \"#\\.\" . preg_quote( $this->data['host'] ) . \"$#\", '.' . $baseUrlHostname ) )\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t\t\n\t\t\t/* Beyond that basic check, we'll need to resolve the domain to an IP Address and see if that's local */\n\t\t\t$ip = @gethostbyname( $this->data['host'] ); // If this fails, it returns the argument unmodified, so we don't need to check if it failed\n\t\t\tif ( filter_var( $ip, FILTER_VALIDATE_IP ) and filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) === FALSE )\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn FALSE;\n\t}",
"function isLocal($url) {\n\t\t\treturn WishListUtils::is_url_local($url);\n\t\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Add file with version
|
function add_file_with_ver(String $file)
{
if (is_admin_folder()) {
$ver = filemtime(ADMIN_VIEW.$file);
return ADMIN_THEME.$file."?v=".$ver;
}
$ver = filemtime(THEME_DIR.$file);
return THEME.$file."?v=".$ver;
}
|
[
"function AddFile($file){}",
"private function updateVersionInFile()\n {\n if ($this->myFilename)\n {\n $status = file_put_contents($this->myFilename, $this->myNewVersion['version']);\n if (!$status)\n {\n $this->logError(\"File %s is not writable\", $this->myFilename);\n }\n }\n }",
"public function applyVersion($path);",
"function AddNewVersion()\r\n\t{\r\n\t\t$docId = -1;\r\n\t\t$strVersion = \"\";\r\n\t\t$strTempFileName = \"\";\r\n\t\t$strVersionRealName= \"\";\r\n\t\t/*\r\n\t\t\tIf the user submits a file which is too large we'll get an undefined\r\n\t\t\tarray. Need to check for file size initially.\r\n\t\t\tAlso need to validate fields.\r\n\t\t*/\r\n\t\tif(isset($_FILES['docVerUpload']['tmp_name']))\r\n\t\t{\r\n\t\t\t$strTempFileName = $_FILES['docVerUpload']['tmp_name'];\r\n\t\t}\r\n\r\n\t\tif(isset($_FILES['docVerUpload']['name']))\r\n\t\t{\r\n\t\t\t$strVersionRealName = $_FILES['docVerUpload']['name'];\r\n\t\t}\r\n\r\n\t\tif(isset($_POST['NewVersion']))\r\n\t\t{\r\n\t\t\t$strVersion = $_POST['NewVersion'];\r\n\t\t}\r\n\r\n\t\tif(isset($_POST['NewVersionDocID']))\r\n\t\t{\r\n\t\t\t$docId = $_POST['NewVersionDocID'];\r\n\t\t}\r\n\r\n\t\tif($_FILES['docVerUpload']['size'] < 1)\r\n\t\t{\r\n\t\t\treturn $this->results->Set('false', \"Invalid file size. Please check file size is greater than 1 byte.\");\r\n\t\t}\r\n\t\tif($_FILES['docVerUpload']['size'] > 50000000)\r\n\t\t{\r\n\t\t\treturn $this->results->Set('false', \"Invalid file size. Please check file size is less than 50 MB.\");\r\n\t\t}\r\n\r\n\t\t$this->Add($docId, $strVersion, $strTempFileName,$strVersionRealName);\r\n\t}",
"public function addToFile($filename, $entry);",
"public function addMetaFile($filepath);",
"function version($file){\n\treturn $file.'?'.filemtime($_SERVER['DOCUMENT_ROOT'].'/'.$file);\n}",
"function createNewVersion() {\n\t}",
"public function addVersion($version) {\n $this->versions[]= $version;\n }",
"function update_file(){\n // (not yet implemented, due to possibly security risk)\n}",
"protected function writeVersion()\n {\n file_put_contents($this->getVersionFile(), self::VERSION, LOCK_EX);\n }",
"public function publishAssetsVersion()\n {\n $directory = self::getAssetsVersionPath();\n\n //Create directory if not exists\n AdminFile::makeDirs($directory);\n\n $this->files->put($directory.'version.txt', self::getResourcesVersion());\n\n $htaccess = $directory.'.htaccess';\n\n if (! file_exists($htaccess)) {\n $this->files->put($htaccess, 'deny from all');\n }\n\n $this->addGitignoreFiles();\n }",
"public function storeVersion(\\Xi\\Filelib\\File\\File $file, \\Xi\\Filelib\\Plugin\\VersionProvider\\VersionProvider $version, $tempFile);",
"private function add_version($match) {\n\t\t\n\t\t// Strip off any hash or query vars.\n\t\t// TODO: reappend the hash and query vars.\n\t\t$originalPath = preg_replace('|([\\?#].*)$|', '', trim($match[1],\"' \"));\n\t\t$path = $this->originaldir . '/' . $originalPath;\n\n\t\tif(file_exists($path)){\n\t\t\t$attribute = preg_replace(\"|url\\(([\\'\\\"]*)([^\\)\\'\\\"]+)([\\'\\\"]*)\\)|\", 'url($1' . $originalPath . '?ver=' . filectime($path) . '$3)' , $match[0]);\n\t\t\t$this->log($attribute);\n\n\t\t\treturn $attribute;\n\t\t} else {\n\t\t\tthrow new BuildException(\"Resource not found: \" . $path, 1);\n\t\t}\n\n \treturn $match[0];\n }",
"public function addFileResource($file);",
"function addFile( $file )\r\n {\r\n if ( is_a( $file, \"eZVirtualFile\" ) )\r\n {\r\n $db =& eZDB::globalDatabase();\r\n\r\n $fileID = $file->id();\r\n $db->begin();\r\n $db->lock( \"eZBug_BugFileLink\" );\r\n $nextID = $db->nextID( \"eZBug_BugFileLink\", \"ID\" );\r\n $res = $db->query( \"INSERT INTO eZBug_BugFileLink\r\n (ID, BugID, FileID)\r\n VALUES\r\n ('$nextID','$this->ID','$fileID')\" );\r\n $db->unlock();\r\n\r\n if ( $res == false )\r\n $db->rollback();\r\n else\r\n $db->commit();\r\n }\r\n }",
"public function addFile($file)\n {\n $this->box->addFile($file, $this->pharComposer->getPathLocalToBase($file));\n }",
"public function addFilePath(string $path) : void;",
"function phb_add_timestamp($filename)\n{\n $file = \"{$GLOBALS['base_dir']}/public/$filename\";\n\n if (!file_exists($file)) {\n return false;\n }\n\n $modified_at = filemtime($file);\n\n return \"$filename?v=$modified_at\";\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Gets the ArraySortingInterface implementation. This defaults to the NativeQuickSorter if no driver has been explicitly set.
|
private function getSorter()
{
if ($this->sorter == null) {
$this->sorter = new NativeQuickSorter;
}
return $this->sorter;
}
|
[
"protected function sorter()\n {\n if($this->sorter === false) {\n return null;\n }\n\n if($this->sorter === null) {\n /** @var SorterRepository $sorterRepository */\n $sorterRepository = app(SorterRepository::class);\n $this->sorter = $sorterRepository->getSorter($this);\n }\n\n return $this->sorter;\n }",
"public static function sorter(): Sorter\n {\n return new Sorter();\n }",
"public function sortStrategy()\n {\n return $this->sort_strategy;\n }",
"protected function createArrayDriver()\n\t{\n\t\treturn $this->repository(new ArrayStore);\n\t}",
"public function getSort()\n\t{\n\t\tif($this->_sort===null)\n\t\t{\n\t\t\t$this->_sort=new ASolrSort;\n\t\t\tif(($id=$this->getId())!='')\n\t\t\t\t$this->_sort->sortVar=$id.'_sort';\n\t\t\t$this->_sort->modelClass=$this->modelClass;\n\t\t}\n\t\treturn $this->_sort;\n\t}",
"function getSorter();",
"public function getSortCollection()\n {\n return new SortCollection();\n }",
"public function get_sort()\n {\n return $this->get(self::SORT);\n }",
"protected function makeSort(): Sort\n {\n return new Sort($this->config['sort']);\n }",
"public function getCustomSorting(string $className, string $name): ?SortingInterface\n {\n $this->fillCache($className);\n\n return $this->customSortings[$className][$name] ?? null;\n }",
"function createAlgorithm()\n {\n return new EvenlySortAlgorithm($this->data);\n }",
"public function getSorting();",
"public function getSortOption();",
"public function getSortType(): ?string\n {\n return $this->sort;\n }",
"public function getGroupingSortCollection(): ?SortCollectionInterface;",
"protected function createArrayDriver()\n {\n return new Store(new MockArraySessionStorage());\n }",
"protected function getDefaultSort(){\n $modelClass = $this->modelClass;\n $model = Yii::createObject($modelClass);\n\n $sort = $this->sort;\n\n if(is_null($sort))\n {\n $sort = new Sort([\n 'attributes' => array_keys($model->getAttributes()),\n ]);\n }\n\n return $sort;\n }",
"public function getSortDataPoint() {\n return $this->sortDataPoint;\n }",
"public function getDefaultSorting()\n\t{\n\t\treturn $this->defaultSorting;\n\t}",
"public function getReadableSort();"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
generates captchca image and saves to file system / $image_loc = Location of default source image $string = The captchca text $save_loc = filesystem location to temporarily save the captchca image
|
public function generate_captchca_images($image_loc, $string, $save_loc){
/*
Now for the GD stuff, for ease of use lets create
the image from a background image.
*/
$captcha = imagecreatefrompng($image_loc);
/*
Lets set the colours, the colour $line is used to generate lines.
Using a blue misty colours. The colour codes are in RGB
*/
$colour = imagecolorallocate($captcha, 146, 178, 241);
$line = imagecolorallocate($captcha,233,239,239);
/*
Now to make it a little bit harder for any bots to break,
assuming they can break it so far. Lets add some lines
in (static lines) to attempt to make the bots life a little harder
*/
imageline($captcha,0,0,39,29,$line);
imageline($captcha,40,0,64,29,$line);
/*
Now for the all important writing of the randomly generated string to the image.
*/
imagestring($captcha, 10, 20, 5, $string, $colour);
//now save the image for display
imagejpeg($captcha, $save_loc, 80);
//unload from memory
imagedestroy($captcha);
}
|
[
"function captcha_image(){\n $this->setup();\n\n $text = $this->_decrypt($_REQUEST[MTC]['captcha']);\n\n // create a white image\n $img = imagecreate(200, 50);\n imagecolorallocate($img, 255, 255, 255);\n\n // add some lines as background noise\n for ($i = 0; $i < 60; $i++) {\n $color = imagecolorallocate($img,rand(100, 250),rand(100, 250),rand(100, 250));\n imageline($img,rand(0,200),rand(0,50),rand(0,200),rand(0,50),$color);\n }\n\n // draw the letters\n for ($i = 0; $i < strlen($text); $i++){\n $font = $this->captchafnt[array_rand($this->captchafnt)];\n $color = imagecolorallocate($img, rand(0, 100), rand(0, 100), rand(0, 100));\n $size = rand(16,25);\n $angle = rand(-30, 30);\n\n $x = 10 + $i * 40;\n $cheight = $size + ($size*0.5);\n $y = floor(50 / 2 + $cheight / 4);\n\n imagettftext($img, $size, $angle, $x, $y, $color, $font, $text[$i]);\n }\n\n header(\"Content-type: image/jpeg\");\n imagejpeg($img);\n imagedestroy($img);\n }",
"public function create_image()\n {\n global $image;\n\n $image = imagecreatetruecolor(400, 50); // Create the Image;\n\n $background_color = imagecolorallocate($image, 255, 255, 255); // color the image\n\n imagefilledrectangle($image, 0, 0, 400, 50, $background_color); // Give the rectangle form to the image\n \n $letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; \n \n $len = strlen($letters); \n \n $randomLetter = $letters[rand(0, $len-1)]; // set the letters in a randomly \n\n $text_color = imagecolorallocate($image, 0, 0, 0); // set the color of the font \n\n $fontType = 'C:/xampp/htdocs/CLSweb2/Fonts/arial.ttf'; // assign the prescribed font \n\n $word=''; \n\n for ($i = 0; $i< 6;$i++) {\n $randomLetter = $letters[rand(0, $len-1)];\n\n\n imagettftext($image, 20, 0, 5+($i*70), 30, $text_color, $fontType, $randomLetter); // Generating random strings with a length between them of 70 px;\n\n $word.=$randomLetter; // assign the random letters to word, after they are being generated. \n }\n\n $_SESSION['captcha_string'] = $word; // set the session with this variable \n\n $line_color = imagecolorallocate($image, 64, 64, 64); // Setting the buondary of the color line\n \n for ($i=0;$i<10;$i++) { // tried with 20, lines too many.\n imageline($image, 0, rand(0, 50), 400, rand(0, 50), $line_color); // Create the line on the image randomly, but starting with 0 x, ending with 400px;\n }\n\n $pixel_color = imagecolorallocate($image, 0, 0, 255);\n\n for ($i=0;$i<1000;$i++) {\n imagesetpixel($image, rand(0, 400), rand(0, 50), $pixel_color); // Create dots, in this predefined x & y.\n }\n\n $images = glob(\"Images/captcha/*.png\"); // select the images inside the captcha folder \n\n foreach ($images as $image_to_delete) {\n unlink($image_to_delete); // delete the images inside in the folder\n }\n\n imagepng($image, \"Images/captcha/image\".$_SESSION['count_time'].\".png\"); // finally generate the images \n }",
"function create_captcha()\n {\n if (session_status() === PHP_SESSION_NONE) {\n session_start();\n }\n header('Content-type:image/jpg');\n $builder = new captcha;\n $_SESSION['phrase'] = $builder->getPhrase();\n $builder->build()\n ->output();\n }",
"public function showCaptcha() { \r\n\r\n echo \"<img src='\" .$_SESSION['savedfile']. \"' border='0' alt='captcha code' title='captcha code' />\"; \r\n\r\n}",
"public function makeImageFromString($string) {\n\n // Split string without breaking words\n //$str = explode(\"\\n\", Util::utf8Wordwrap($string, 50, \"\\n\", true));\n $str = explode(\"\\n\", wordwrap($string, 50, \"\\n\", true));\n // Adjust height\n $times = 30;\n $adjustedHeight = count($str) * $times;\n\n // Generate Image\n $image = imagecreate(500, $adjustedHeight);\n $bgColor = imagecolorallocate($image, 255, 255, 255);\n $stringColor = imagecolorallocate($image, 0, 0, 0);\n $fontHeight = imagefontheight(20);\n imagesetthickness($image, 5);\n\n // Starting y position\n $y = 20;\n // Loop to break lines in image\n $font = PS_ROOT . \"/fonts/SimHei.ttf\";\n for ($x = 0; $x <= count($str) - 1; $x++) {\n //imagestring($image, 20, 30, $y, $str[$x], $stringColor);\n imagettftext($image, 20, 0, 30, $y, $stringColor, $font, $str[$x]);\n $y += $times;\n }\n\n // Save image to current directory\n //$url = '/images/generated-image-' . uniqid() . '.png';\n $url = '/images/generated-image-test.png';\n\n // Return URL\n if (imagepng($image, $url)) {\n imagedestroy($image);\n return $url;\n }\n return false;\n }",
"function print_captcha($length = 5)\r\n{\r\n $src = 'abcdefghjkmnpqrstuvwxyz23456789';\r\n if (mt_rand(0, 1) == 0)\r\n {\r\n $src = mb_strtoupper($src);\r\n }\r\n $srclen = mb_strlen($src) - 1;\r\n \r\n // what font file to use\r\n $font = DIR_FONTS . 'AppleGaramond.ttf';\r\n \r\n // captcha output type (jpeg, png, gif)\r\n $output_type = 'png';\r\n \r\n // font size range, angle range, character padding\r\n $min_font_size = 25;\r\n $max_font_size = 35;\r\n $min_angle = -15;\r\n $max_angle = 15;\r\n \r\n // font character padding\r\n $char_padding = 1;\r\n \r\n $data = array();\r\n $image_width = $image_height = 0;\r\n \r\n // build the data array of the characters, size, placement, etc.\r\n $_SESSION['ilancedata']['user']['captcha'] = '';\r\n for ($i = 0; $i < $length; $i++)\r\n {\r\n $char = mb_strtoupper(mb_substr($src, mt_rand(0, $srclen), 1));\r\n $_SESSION['ilancedata']['user']['captcha'] .= \"$char\";\r\n \r\n $size = mt_rand($min_font_size, $max_font_size);\r\n $angle = mt_rand($min_angle, $max_angle); \r\n $bbox = imagettfbbox($size, $angle, $font, $char);\r\n $char_width = max($bbox[2],$bbox[4]) - min($bbox[0],$bbox[6]);\r\n $char_height = max($bbox[1],$bbox[3]) - min($bbox[7],$bbox[5]);\r\n \r\n $image_width += $char_width + $char_padding;\r\n $image_height = max($image_height, $char_height);\r\n $data[] = array('char' => $char, 'size' => $size, 'angle' => $angle, 'height' => $char_height, 'width' => $char_width,);\r\n }\r\n \r\n // calculate the final image size, add some padding\r\n $x_padding = 12;\r\n $image_width += ($x_padding * 2);\r\n $image_height = ($image_height * 1.5) + 2;\r\n \r\n // build the image, and allocte the colors\r\n $im = imagecreate($image_width, $image_height);\r\n $r = 51 * mt_rand(4, 5);\r\n $g = 51 * mt_rand(4, 5);\r\n $b = 51 * mt_rand(4, 5);\r\n $color_bg = imagecolorallocate($im, $r, $g, $b);\r\n \r\n $r = 51 * mt_rand(3, 4);\r\n $g = 51 * mt_rand(3, 4);\r\n $b = 51 * mt_rand(3, 4);\r\n $color_line0 = imagecolorallocate($im, $r, $g, $b);\r\n \r\n $r = 51 * mt_rand(3, 4);\r\n $g = 51 * mt_rand(3, 4);\r\n $b = 51 * mt_rand(3, 4);\r\n $color_line1 = imagecolorallocate($im, $r, $g, $b);\r\n \r\n $r = 51 * mt_rand(1, 2);\r\n $g = 51 * mt_rand(1, 2);\r\n $b = 51 * mt_rand(1, 2);\r\n \r\n $color_text = imagecolorallocate($im, $r, $g, $b);\r\n $color_border = imagecolorallocate($im, 0, 0, 0);\r\n \r\n // make the random background lines\r\n for ($l = 0; $l < 10; $l++)\r\n {\r\n $c = 'color_line' . ($l%2);\r\n $lx = mt_rand(0, $image_width + $image_height);\r\n $lw = mt_rand(0, 3);\r\n if ($lx > $image_width)\r\n {\r\n $lx -= $image_width;\r\n imagefilledrectangle($im, 0, $lx, $image_width - 1, $lx + $lw, $$c );\r\n }\r\n else\r\n {\r\n imagefilledrectangle($im, $lx, 0, $lx+$lw, $image_height - 1, $$c );\r\n }\r\n }\r\n \r\n // output each character\r\n $pos_x = $x_padding + ($char_padding / 2);\r\n foreach($data AS $d)\r\n {\r\n $pos_y = (($image_height + $d['height']) / 2);\r\n imagettftext($im, $d['size'], $d['angle'], $pos_x, $pos_y, $color_text, $font, $d['char']);\r\n $pos_x += $d['width'] + $char_padding;\r\n }\r\n \r\n // create a border\r\n imagerectangle($im, 0, 0, $image_width - 1, $image_height - 1, $color_border);\r\n \r\n switch ($output_type)\r\n {\r\n case 'jpeg':\r\n {\r\n header('Content-type: image/jpeg');\r\n imagejpeg($im, null, 100);\r\n break;\r\n } \r\n case 'png':\r\n {\r\n header('Content-type: image/png');\r\n imagepng($im);\r\n break;\r\n } \r\n case 'gif':\r\n {\r\n header('Content-type: image/gif');\r\n imagegif($im);\r\n break;\r\n }\r\n }\r\n \r\n imagedestroy($im);\r\n}",
"public function image_captcha()\n\t{\n\t\treturn '<img src=\"captcha.php\" />';\n\t}",
"private function createImage(): void\r\n\t{\r\n\t\t$this->captcha_image = @imagecreate(\r\n\t\t\tself::CAPTCHA_IMAGE_WIDTH,\r\n\t\t\tself::CAPTCHA_IMAGE_HEIGHT\r\n\t\t);\r\n\t}",
"function draw ($width=300, $height=100, $fontsize=24, $font=\"C:\\Windows\\Fonts\\arial.ttf\") {\n // PARAM $width, $height : width and height of the captcha\n // $font : ! CHANGE THIS TO YOUR OWN !\n\n // CREATE BLANK IMAGE\n $captcha = imagecreatetruecolor($width, $height);\n if (isset($_SESSION['captcha'])) {\n // FUNKY BACKGROUND IMAGE\n $background = \"captcha-back.jpg\";\n list($bx, $by) = getimagesize($background);\n if ($bx-$width<0) { $bx = 0; }\n else { $bx = rand(0, $bx-$width); }\n if ($by-$height<0) { $by = 0; }\n else { $by = rand(0, $by-$height); }\n $background = imagecreatefromjpeg($background);\n imagecopy($captcha, $background, 0, 0, $bx, $by, $width, $height);\n\n // THE TEXT SIZE\n $text_size = imagettfbbox($fontsize, 0, $font, $_SESSION['captcha']);\n $text_width = max([$text_size[2], $text_size[4]]) - min([$text_size[0], $text_size[6]]);\n $text_height = max([$text_size[5], $text_size[7]]) - min([$text_size[1], $text_size[3]]);\n\n // CENTERING THE TEXT BLOCK\n $centerX = CEIL(($width - $text_width) / 2);\n $centerX = $centerX<0 ? 0 : $centerX;\n $centerX = CEIL(($height - $text_height) / 2);\n $centerY = $centerX<0 ? 0 : $centerX;\n // RANDOM OFFSET POSITION OF THE TEXT + COLOR\n if (rand(0,1)) {\n $centerX -= rand(0,55);\n } else {\n $centerX += rand(0,55);\n }\n $colornow = imagecolorallocate($captcha, rand(120,255), rand(120,255), rand(120,255)); // Random bright color\n imagettftext($captcha, $fontsize, rand(-10,10), $centerX, $centerY, $colornow, $font, $_SESSION['captcha']);\n } else {\n imagefilledrectangle($captcha, 0, 0, $width, $height, imagecolorallocate($captcha, 255, 255, 255));\n }\n\n // OUTPUT\n header('Content-type: image/png');\n imagejpeg($captcha);\n imagedestroy($captcha);\n }",
"protected function showCaptchaImage(){\nmt_srand(time());\n$securimage = new \\Securimage();\n$securimage->charset = 'abcdefghkmnprtuvwxyz234679'; //lowercase and digits only, no i,j,l,o,q,0,1,s,5,8\n$securimage->perturbation=0.5; //Nicer than the default of 0.75\n$securimage->font_ratio = 0.50; //As we use lowercase, make bigger than default of 0.4\n//$securimage->line_color=new Securimage_Color('#ff0000');\n//$securimage->num_lines = 2; //Only 2 lines on top\n//$securimage->use_transparent_text = true;$securimage->text_transparency_percentage = 50;\n$securimage->show(); //Does the content headers too\n}",
"function get_captcha() {\n\t\t$path = getcwd();\t\t\t\t\n $captcha_path = base_url() . \"captcha/\";\n $vals = array(\n 'img_path' => $path.\"/captcha/\",\n 'img_url' => $captcha_path,\n 'expiration' => 1800 //half hour to remove from folder\n );\n\n $cap = create_captcha($vals);\n $capdb = array(\n 'captcha_time' => $cap['time'],\n //'ip_address' => $this->SA->input->ip_address(),\n 'ip_address' => $_SERVER['REMOTE_ADDR'],\n 'word' => $cap['word']\n );\n\n $query = $this->SA->db->insert_string('captcha', $capdb);\n $this->SA->db->query($query);\n //$data['cap'] = $cap;\n return $cap['image'];\n }",
"public function captchaAction()\n\t\t{\n\t\t\t$session = new Zend_Session_Namespace('captcha');\n\t\t\t\n\t\t\t//check for existing phrase in session\n\t\t\t$phrase = null;\n\t\t\tif(isset($session->phrase) && strlen($session->phrase)>0)\n\t\t\t{\n\t\t\t\t$phrase = $session->phrase;\n\t\t\t}\n\t\t\t\n\t\t\t$captcha = Text_CAPTCHA::factory('Image');\n\t\t\t\n\t\t\t$opts = array('font_size' => 20,\n\t\t\t\t\t\t 'font_path' => Zend_Registry::get('config')->paths->data,\n\t\t\t\t\t\t 'font_file' => 'VeraBd.ttf');\n\t\t\t\t\t\t \n\t\t\t$captcha->init(120, 60, $phrase, $opts);\n\t\t\t\n\t\t\t//write the phrase to sessoin\n\t\t\t$session->phrase = $captcha->getPhrase();\n\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t//disable auto-rendering since we're outputting an image\n\t\t\t$this->_helper->viewRenderer->setNoRender();\n\t\t\theader('Content-type: image/png');\n\t\t\techo $captcha->getCAPTCHAAsPng();\n\t\t}",
"function GeraImagem(){\r\n\tglobal $Chave;\r\n\t$Chave=GeraChave(6);//cria a chave (no caso com 6 caracteres)\r\n\t$Imagem=ImageCreate(100,40);//cria uma imagem 100x40\r\n\t$CorFundo=ImageColorAllocate($Imagem,0,0,0);//Cor de fundo (preto, no caso)\r\n\t$CorTexto=ImageColorAllocate($Imagem,255,255,255);//Cor do texto (branco, no caso)\r\n\r\n\tImageString($Imagem,5,23,10,$Chave,$CorTexto);\r\n\tImageJpeg($Imagem,\"chave.jpg\");//salva a imagem (troque o nome, se quiser)\r\n\tImageDestroy($Imagem);//apaga a imagem da memória do servidor\r\n}",
"function si_contact_get_captcha_html($form_id_num) {\n global $captcha_path_cf, $captcha_url_cf, $si_contact_gb, $si_contact_opt, $fsc_error_message;\n $req_field_ind = ( $si_contact_opt['req_field_indicator_enable'] == 'true' ) ? '<span '.$this->si_contact_convert_css($si_contact_opt['required_style']).'>'.$si_contact_opt['req_field_indicator'].'</span>' : '';\n\n $string = '';\n\n// Test for some required things, print error message right here if not OK.\nif ($this->captchaCheckRequires()) {\n\n $si_contact_opt['captcha_image_style'] = 'border-style:none; margin:0; padding:0px; padding-right:5px; float:left;';\n $si_contact_opt['reload_image_style'] = 'border-style:none; margin:0; padding:0px; vertical-align:bottom;';\n\n// the captch html\n\n $string = '\n<div '.$this->ctf_title_style.'> </div>\n <div ';\n$this->ctf_captcha_div_style_sm = $this->si_contact_convert_css($si_contact_opt['captcha_div_style_sm']);\n$this->ctf_captcha_div_style_m = $this->si_contact_convert_css($si_contact_opt['captcha_div_style_m']);\n\n// url for captcha image\n$form_action_url = $this->form_action_url();\nif(!preg_match(\"/\\?/\", $form_action_url) )\n $securimage_show_url = $form_action_url .'?ctf_show_captcha=1&';\nelse\n $securimage_show_url = $form_action_url .'&ctf_show_captcha=1&';\n\n$securimage_size = 'width=\"175\" height=\"60\"';\nif($si_contact_opt['captcha_small'] == 'true') {\n $securimage_show_url .= 'ctf_sm_captcha=1&';\n $securimage_size = 'width=\"132\" height=\"45\"';\n}\n\n$parseUrl = parse_url($captcha_url_cf);\n$securimage_url = $parseUrl['path'];\n\nif($si_contact_opt['captcha_difficulty'] == 'low') $securimage_show_url .= 'difficulty=1&';\nif($si_contact_opt['captcha_difficulty'] == 'high') $securimage_show_url .= 'difficulty=2&';\nif($si_contact_opt['captcha_no_trans'] == 'true') $securimage_show_url .= 'no_trans=1&';\n\n$securimage_show_rf_url = $securimage_show_url . 'ctf_form_num=' .$form_id_num;\n$securimage_show_url .= 'ctf_form_num=' .$form_id_num;\n\n\n$string .= ($si_contact_opt['captcha_small'] == 'true') ? $this->ctf_captcha_div_style_sm : $this->ctf_captcha_div_style_m;\n$string .= '>\n <img class=\"ctf-captcha\" id=\"si_image_ctf'.$form_id_num.'\" ';\n $string .= ($si_contact_opt['captcha_image_style'] != '') ? 'style=\"' . esc_attr( $si_contact_opt['captcha_image_style'] ).'\"' : '';\n $string .= ' src=\"'.esc_url($securimage_show_url).'\" '.$securimage_size.' alt=\"';\n $string .= esc_attr(($si_contact_opt['tooltip_captcha'] != '') ? $si_contact_opt['tooltip_captcha'] : __('CAPTCHA Image', 'si-contact-form'));\n $string .='\" title=\"';\n $string .= esc_attr(($si_contact_opt['tooltip_captcha'] != '') ? $si_contact_opt['tooltip_captcha'] : __('CAPTCHA Image', 'si-contact-form'));\n $string .= '\" />\n';\n\n $string .= ' <div id=\"si_refresh_ctf'.$form_id_num.'\">\n';\n $string .= ' <a href=\"#\" rel=\"nofollow\" title=\"';\n $string .= esc_attr(($si_contact_opt['tooltip_refresh'] != '') ? $si_contact_opt['tooltip_refresh'] : __('Refresh Image', 'si-contact-form'));\n\n $string .= '\" onclick=\"document.getElementById(\\'si_image_ctf'.$form_id_num.'\\').src = \\''.esc_url($securimage_show_url).'&sid=\\''.' + Math.random(); return false;\">\n';\n\n $string .= ' <img src=\"'.$captcha_url_cf.'/images/refresh.png\" width=\"22\" height=\"20\" alt=\"';\n $string .= esc_attr(($si_contact_opt['tooltip_refresh'] != '') ? $si_contact_opt['tooltip_refresh'] : __('Refresh Image', 'si-contact-form'));\n $string .= '\" ';\n $string .= ($si_contact_opt['reload_image_style'] != '') ? 'style=\"' . esc_attr( $si_contact_opt['reload_image_style'] ).'\"' : '';\n $string .= ' onclick=\"this.blur();\" /></a>\n </div>\n </div>\n\n <div '.$this->ctf_title_style.'>\n <label for=\"si_contact_captcha_code'.$form_id_num.'\">';\n $string .= esc_html(($si_contact_opt['title_capt'] != '') ? $si_contact_opt['title_capt'] : __('CAPTCHA Code:', 'si-contact-form'));\n $string .= $req_field_ind.'</label>\n </div>\n <div '.$this->si_contact_convert_css($si_contact_opt['field_div_style']).'>'.$this->ctf_echo_if_error($fsc_error_message['captcha']).'\n <input '.$this->si_contact_convert_css($si_contact_opt['captcha_input_style']).' type=\"text\" value=\"\" id=\"si_contact_captcha_code'.$form_id_num.'\" name=\"si_contact_captcha_code\" '.$this->ctf_aria_required.' size=\"'.absint($si_contact_opt['captcha_field_size']).'\" />\n </div>\n';\n} else {\n $string .= $this->captchaRequiresError;\n}\n return $string;\n}",
"function drawString($img, $charData, &$stringInfo)\n{\n\t\n\tif(isset($stringInfo['str']))\n\t{\n\t\t$str = $stringInfo['str'];\n\t}\n\telse if(isset($stringInfo['getStr']))\n\t{\n\t\t$str = $stringInfo['getStr']($charData);\n\t}\n\telse\n\t{\n\t\techo \"no string or way of getting string specified<br>\\n\";\n\t\treturn false;\n\t}\n\t\n\tglobal $conf_fontDir;\n\t$success = imagettftext($img, $stringInfo['Size'], $stringInfo['Angle'], $stringInfo['X'], $stringInfo['Y'], imagecolorallocatealpha($img, $stringInfo['ColorRed'], $stringInfo['ColorGreen'], $stringInfo['ColorBlue'], $stringInfo['ColorAlpha']), $conf_fontDir.'/'.$stringInfo['Font'], $str);\n\t\n\t$stringInfo['boundbox'] = $success;\n\t\n\treturn $success;\n}",
"public static function img() {\n\t\treturn \\URL::to('captcha?'.mt_rand(1, 100000)); //add a random number to avoid browser caching issues\n\t}",
"public function create_image($gc_details = array(),$giftCertificate = array()){\n $gc_code = @$gc_details['GiftCertificate']['gift_certificate_no'];\n $time = time();\n $price = \"AED \".@$gc_details['GiftCertificate']['amount'] . \"\\n\";\n $fronEmail = @$gc_details['GiftCertificate']['Sender']['email'];\n $recipient = ucfirst(@$gc_details['GiftCertificate']['recipient_first_name']).' '.ucfirst(@$gc_details['GiftCertificate']['recipient_last_name']);\n \n $email = $gc_details['GiftCertificate']['recipient_email'] . \"\";\n $senderName = ucfirst(@$gc_details['GiftCertificate']['Sender']['first_name']).' '.ucfirst(@$gc_details['GiftCertificate']['Sender']['last_name']);\n //$gc_msg = chunk_split(trim($gc_details['GiftCertificate']['messagetxt']), 20, \"\\n\");\n $expire = ($gc_details['GiftCertificate']['expire_on']=='0000-00-00')?'Never expire':$gc_details['GiftCertificate']['expire_on'];\n $gc_msg = $gc_details['GiftCertificate']['messagetxt'];\n $salonName = '';\n if(@$gc_details['GiftCertificate']['salon_id'] > 1){\n $salonDetail = $this->salonDetail($gc_details['GiftCertificate']['salon_id']);\n $salonName = $salonDetail['Salon']['eng_name'].\"\\n\";\n $salonName .= $salonDetail['Address']['address'].\"\\n\";\n if($salonDetail['Contact']['day_phone']){\n $salonName .= \"+971 \".$salonDetail['Contact']['day_phone'].\"\\n\";\n }\n }\n //get_salonName\n \n $message = \"To: $recipient\\n\\n\";\n $message .= \"From: $senderName\\n\\n\";\n $message .= \"Gift Certificate code: $gc_code\\n\\n\";\n $message .= \"Gift Certificate of $price\\n\\n\";\n $message .= $gc_msg;\n $message .= \"\\n\\nExipre On: $expire\\n\\n\";\n $message .= \"\\n\\n-----------\\nRegards,\\n\";\n $message .= \"$senderName\\n\\n\";\n if($salonName){\n $message .= \"$salonName\\n\\n\";\n }\n $text_write_image = $message;\n \n if ($text_write_image) {\n $textNew = $text_write_image;\n } else {\n $textNew = 'This is dummy text';\n }\n \n $extension = substr($giftCertificate['GiftImage']['image'], strrpos($giftCertificate['GiftImage']['image'], '.') + 1);\n $font = 15;\n \n if($giftCertificate['GiftImage']['text_align'] == \"Right\"){\n $x = 500;\n } else {\n $x = 20;\n }\n \n \n $y = 50;\n \n if ($extension == 'jpeg' || $extension == 'jpg') {\n header('Content-type: image/jpeg');\n $jpg_image = imagecreatefromjpeg(WWW_ROOT . '/images/GiftImage/original/' . $giftCertificate['GiftImage']['image']);\n $white = imagecolorallocate($jpg_image, 255, 255, 255);\n \n \n if(!empty($giftCertificate['GiftImage']['font_color'])){\n \n $hex = str_replace(\"#\", \"\", $giftCertificate['GiftImage']['font_color']);\n \n if(strlen($hex) == 3) {\n $r = hexdec(substr($hex,0,1).substr($hex,0,1));\n $g = hexdec(substr($hex,1,1).substr($hex,1,1));\n $b = hexdec(substr($hex,2,1).substr($hex,2,1));\n } else {\n $r = hexdec(substr($hex,0,2));\n $g = hexdec(substr($hex,2,2));\n $b = hexdec(substr($hex,4,2));\n }\n $white = imagecolorallocate($jpg_image, $r, $g, $b);\n }\n \n $font_path = WWW_ROOT . '/images/font.ttf';\n $image = $jpg_image;\n $string = $textNew;\n $font_height = imagefontheight($font);\n $font_width = imagefontwidth($font);\n $image_height = imagesy($image);\n $image_width = imagesx($image);\n $max_characters = (int) ($image_width - $x) / $font_width ;\n $next_offset_y = $y;\n for($i = 0, $exploded_string = explode(\"\\n\", $string), $i_count = count($exploded_string); $i < $i_count; $i++) {\n $exploded_wrapped_string = explode(\"\\n\", wordwrap(str_replace(\"\\t\", \" \", $exploded_string[$i]), $max_characters, \"\\n\"));\n for($j = 0, $j_count = count($exploded_wrapped_string); $j < $j_count; $j++) {\n imagestring($image, $font, $x, $next_offset_y, $exploded_wrapped_string[$j], $white);\n $next_offset_y += $font_height;\n if($next_offset_y >= $image_height - $y) {\n return;\n }\n }\n }\n $new_image_name = $gc_code.'_'.$giftCertificate['GiftImage']['id'].'_'.date('dmYHis').'.jpg';\n $return_file_path = 'images/GiftImage/original/'.$new_image_name;\n imagejpeg($image,WWW_ROOT . 'images/GiftImage/original/'.$new_image_name);\n imagedestroy($jpg_image);\n return $return_file_path;\n } elseif ($extension == 'png') {\n header('Content-type: image/png');\n $png_image = imagecreatefrompng(WWW_ROOT . '/images/GiftImage/original/' . $giftCertificate['GiftImage']['image']);\n $white = imagecolorallocate($png_image, 255, 255, 255);\n \n if(!empty($giftCertificate['GiftImage']['font_color'])){\n \n $hex = str_replace(\"#\", \"\", $giftCertificate['GiftImage']['font_color']);\n if(strlen($hex) == 3) {\n $r = hexdec(substr($hex,0,1).substr($hex,0,1));\n $g = hexdec(substr($hex,1,1).substr($hex,1,1));\n $b = hexdec(substr($hex,2,1).substr($hex,2,1));\n } else {\n $r = hexdec(substr($hex,0,2));\n $g = hexdec(substr($hex,2,2));\n $b = hexdec(substr($hex,4,2));\n }\n $white = imagecolorallocate($jpg_image, $r, $g, $b);\n }\n \n $font_path = WWW_ROOT . '/images/font.ttf';\n $string = $textNew;\n $image = $png_image;\n $font_height = imagefontheight($font);\n $font_width = imagefontwidth($font);\n $image_height = imagesy($image);\n $image_width = imagesx($image);\n $max_characters = (int) ($image_width - $x) / $font_width ;\n $next_offset_y = $y;\n for($i = 0, $exploded_string = explode(\"\\n\", $string), $i_count = count($exploded_string); $i < $i_count; $i++) {\n $exploded_wrapped_string = explode(\"\\n\", wordwrap(str_replace(\"\\t\", \" \", $exploded_string[$i]), $max_characters, \"\\n\"));\n for($j = 0, $j_count = count($exploded_wrapped_string); $j < $j_count; $j++) {\n imagestring($image, $font, $x, $next_offset_y, $exploded_wrapped_string[$j], $white);\n $next_offset_y += $font_height;\n if($next_offset_y >= $image_height - $y) {\n return;\n }\n }\n }\n $new_image_name = $gc_code.'_'.$giftCertificate['GiftImage']['id'].'_'.date('dmYHis').'.png';\n $return_file_path = 'images/GiftImage/original/'.$new_image_name;\n imagepng($image,WWW_ROOT . 'images/GiftImage/original/'.$new_image_name);\n imagedestroy($png_image);\n return $return_file_path;\n } elseif ($extension == 'gif') {\n header('Content-type: image/gif');\n $gif_image = imagecreatefromgif(WWW_ROOT . '/images/GiftImage/original/' . $giftCertificate['GiftImage']['image']);\n $white = imagecolorallocate($gif_image, 255, 255, 255);\n \n if(!empty($giftCertificate['GiftImage']['font_color'])){\n \n $hex = str_replace(\"#\", \"\", $giftCertificate['GiftImage']['font_color']);\n \n if(strlen($hex) == 3) {\n $r = hexdec(substr($hex,0,1).substr($hex,0,1));\n $g = hexdec(substr($hex,1,1).substr($hex,1,1));\n $b = hexdec(substr($hex,2,1).substr($hex,2,1));\n } else {\n $r = hexdec(substr($hex,0,2));\n $g = hexdec(substr($hex,2,2));\n $b = hexdec(substr($hex,4,2));\n }\n $white = imagecolorallocate($jpg_image, $r, $g, $b);\n }\n $font_path = WWW_ROOT . '/images/font.ttf';\n $image = $gif_image;\n $string = $textNew;\n \n $font_height = imagefontheight($font);\n $font_width = imagefontwidth($font);\n $image_height = imagesy($image);\n $image_width = imagesx($image);\n $max_characters = (int) ($image_width - $x) / $font_width ;\n $next_offset_y = $y;\n for($i = 0, $exploded_string = explode(\"\\n\", $string), $i_count = count($exploded_string); $i < $i_count; $i++) {\n $exploded_wrapped_string = explode(\"\\n\", wordwrap(str_replace(\"\\t\", \" \", $exploded_string[$i]), $max_characters, \"\\n\"));\n for($j = 0, $j_count = count($exploded_wrapped_string); $j < $j_count; $j++) {\n imagestring($image, $font, $x, $next_offset_y, $exploded_wrapped_string[$j], $white);\n $next_offset_y += $font_height;\n if($next_offset_y >= $image_height - $y) {\n return;\n }\n }\n }\n $new_image_name = $gc_code.'_'.$giftCertificate['GiftImage']['id'].'_'.date('dmYHis').'.gif';\n $return_file_path = 'images/GiftImage/original/'.$new_image_name;\n imagegif($image, WWW_ROOT . 'images/GiftImage/original/'.$new_image_name);\n imagedestroy($gif_image);\n return $return_file_path;\n }\n }",
"public function regenerarCaptcha(){\r\n\t\t\t$op1 = rand(5,10);\r\n\t\t\t$op2 = rand(1,5);\r\n\t\t\t$signo = str_shuffle(\"+-\");\r\n\t\t\t$this->captcha_string = \"Cuanto es $op1$signo[0]$op2=\";\r\n\t\t\tif ( $signo[0]==\"-\")\r\n\t\t\t\t$this->captcha_result = $op1-$op2;\r\n\t\t\telse\r\n\t\t\t\t$this->captcha_result = $op1+$op2;\r\n\t\t\tparent::$log->debug(\"Captcha: $this->captcha_string $this->captcha_result\");\r\n\t\t\t\r\n\t\t\tob_start();//para capturar la salida del buffer a una variable... si no, tenia que ser a fichero y luego leer, borrar, ....\r\n\t\t\t$im = imagecreate(150, 30);//tama�o\r\n\t\t\t$bg = imagecolorallocate($im, 255, 255, 255);//fondo blanco\r\n\t\t\t$textcolor = imagecolorallocate($im, 0, rand(0,255), rand(0,255));//color aleatorio\r\n\t\t\t// Write the string at the top left\r\n\t\t\timagestring($im, 5, 10, 7, $this->captcha_string, $textcolor);\r\n\t\t\t//imagestring($im, 5, 10, 7, \"* * * * * *\", imagecolorallocate($im, 0, 255));\r\n\t\t\timagepng($im);\r\n\t\t\timagedestroy($im);\r\n\t\t\t$this->captcha_image = 'data:image/png;base64,'.base64_encode(ob_get_clean());//en base64 para pintarla en bruto\r\n\t\t}",
"function signCertificate($memberName, $certificateFile, $public_font_path, $imageSavePath, $imageSaveName) {\n\n // Copy and resample the imag\n list($width, $height) = getimagesize($certificateFile);\n $image_p = imagecreatetruecolor($width, $height);\n $image = imagecreatefrompng($certificateFile);\n imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);\n\n // Prepare font size and colors\n $text_color = imagecolorallocate($image_p, 0, 0, 0);\n// $bg_color = imagecolorallocate($image_p, 255, 255, 255);\n $fontFile = file_get_contents($public_font_path);\n// $font = '/fonts/home.ttf';\n file_put_contents('font.ttf', $fontFile);\n $font_size = 30;\n\n // Set the offset x and y for the text position\n $offset_x = 170;\n $offset_y = 510;\n\n // Get the size of the text area\n // Add text background\n // Add text\n imagettftext($image_p, $font_size, 0, $offset_x, $offset_y, $text_color, 'font.ttf', $memberName);\n\n // Save the picture\n imagejpeg($image_p, $imageSavePath .'/'. $imageSaveName, 100);\n\n // Clear\n imagedestroy($image);\n imagedestroy($image_p);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns a list of class names from a group test file
|
function &_getGroupTestClassNames($groupTestFile) {
$file = implode ( "\n", file ( $groupTestFile ) );
preg_match ( "~lass\s+?(.*)\s+?extends TestSuite~", $file, $matches );
if (! empty ( $matches )) {
unset ( $matches [0] );
return $matches;
}
$matches = array ();
return $matches;
}
|
[
"function &_getGroupTestClassNames($groupTestFile) {\n\t\t$file = implode(\"\\n\", file($groupTestFile));\n\t\tpreg_match(\"~lass\\s+?(.*)\\s+?extends TestSuite~\", $file, $matches);\n\t\tif (!empty($matches)) {\n\t\t\tunset($matches[0]);\n\t\t\treturn $matches;\n\t\t}\n\t\t$matches = array();\n\t\treturn $matches;\n\t}",
"public static function getTestsFromFile($file) {\n\t\t\t$tests = array();\n\t\t\t\n\t\t\t$tokens = token_get_all(file_get_contents($file));\n\t\t\tfor ($i = 0, $len = count($tokens); $i < $len; $i++) {\n\t\t\t\tif (\n\t\t\t\t\t$tokens[$i][0] === T_CLASS && !(\n\t\t\t\t\t\tisset($tokens[$i - 1]) && is_array($tokens[$i - 1]) && $tokens[$i - 1][1] === T_WHITESPACE &&\n\t\t\t\t\t\tisset($tokens[$i - 2]) && is_array($tokens[$i - 2]) && $tokens[$i - 2][1] === T_ABSTRACT\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisset($tokens[$i + 1]) && is_array($tokens[$i + 1]) && $tokens[$i + 1][0] === T_WHITESPACE &&\n\t\t\t\t\t\tisset($tokens[$i + 2]) && is_array($tokens[$i + 2]) && $tokens[$i + 2][0] === T_STRING &&\n\t\t\t\t\t\tisset($tokens[$i + 3]) && is_array($tokens[$i + 3]) && $tokens[$i + 3][0] === T_WHITESPACE &&\n\t\t\t\t\t\tisset($tokens[$i + 4]) && is_array($tokens[$i + 4]) && $tokens[$i + 4][0] === T_EXTENDS &&\n\t\t\t\t\t\tisset($tokens[$i + 5]) && is_array($tokens[$i + 5]) && $tokens[$i + 5][0] === T_WHITESPACE &&\n\t\t\t\t\t\tisset($tokens[$i + 6]) && is_array($tokens[$i + 6]) && $tokens[$i + 6][0] === T_STRING\n\t\t\t\t\t) {\n\t\t\t\t\t\t$className = $tokens[$i + 2][1];\n\t\t\t\t\t\t\n\t\t\t\t\t\trequire_once $file;\n\t\t\t\t\t\t$ref = new ReflectionClass($className);\n\t\t\t\t\t\tif ($ref->implementsInterface('Testable') && $ref->isInstantiable()) {\n\t\t\t\t\t\t\t$tests[] = $ref->newInstance($className);\n\t\t\t\t\t\t\t//add to filter\n\t\t\t\t\t\t\tCoverageFilter::addFile($file);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunset($ref);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$i += 6;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn $tests;\n\t\t}",
"public function getTestClasses($extension = NULL, array $types = []) {\n if (!isset($extension) && empty($types)) {\n if (!empty($this->testClasses)) {\n return $this->testClasses;\n }\n }\n $list = [];\n\n $classmap = $this->findAllClassFiles($extension);\n\n // Prevent expensive class loader lookups for each reflected test class by\n // registering the complete classmap of test classes to the class loader.\n // This also ensures that test classes are loaded from the discovered\n // pathnames; a namespace/classname mismatch will throw an exception.\n $this->classLoader->addClassMap($classmap);\n\n foreach ($classmap as $classname => $pathname) {\n $finder = MockFileFinder::create($pathname);\n $parser = new StaticReflectionParser($classname, $finder, TRUE);\n try {\n $info = static::getTestInfo($classname, $parser->getDocComment());\n }\n catch (MissingGroupException $e) {\n // If the class name ends in Test and is not a migrate table dump.\n if (preg_match('/Test$/', $classname) && strpos($classname, 'migrate_drupal\\Tests\\Table') === FALSE) {\n throw $e;\n }\n // If the class is @group annotation just skip it. Most likely it is an\n // abstract class, trait or test fixture.\n continue;\n }\n // Skip this test class if it is a Simpletest-based test and requires\n // unavailable modules. TestDiscovery should not filter out module\n // requirements for PHPUnit-based test classes.\n // @todo Move this behavior to \\Drupal\\simpletest\\TestBase so tests can be\n // marked as skipped, instead.\n // @see https://www.drupal.org/node/1273478\n if ($info['type'] == 'Simpletest') {\n if (!empty($info['requires']['module'])) {\n if (array_diff($info['requires']['module'], $this->availableExtensions['module'])) {\n continue;\n }\n }\n }\n\n foreach ($info['groups'] as $group) {\n $list[$group][$classname] = $info;\n }\n }\n\n // Sort the groups and tests within the groups by name.\n uksort($list, 'strnatcasecmp');\n foreach ($list as &$tests) {\n uksort($tests, 'strnatcasecmp');\n }\n\n // Allow modules extending core tests to disable originals.\n $this->moduleHandler->alterDeprecated('Convert your test to a PHPUnit-based one and implement test listeners. See: https://www.drupal.org/node/2939892', 'simpletest', $list);\n\n if (!isset($extension) && empty($types)) {\n $this->testClasses = $list;\n }\n\n if ($types) {\n $list = NestedArray::filter($list, function ($element) use ($types) {\n return !(is_array($element) && isset($element['type']) && !in_array($element['type'], $types));\n });\n }\n\n return $list;\n }",
"function &getGroupTestList() {\n\t\t$manager = new TextTestManager();\n\t\t$groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups'));\n\n\t\t$buffer = \"Core Test Groups:\\n\";\n\t\t$urlExtra = '';\n\t\tif ($manager->appTest) {\n\t\t\t$buffer = \"App Test Groups:\\n\";\n\t\t\t$urlExtra = '&app=true';\n\t\t} else if ($manager->pluginTest) {\n\t\t\t$buffer = Inflector::humanize($manager->pluginTest) . \" Test Groups:\\n\";\n\t\t\t$urlExtra = '&plugin=' . $manager->pluginTest;\n\t\t}\n\n\t\t$buffer .= \"All tests\\n\" . $_SERVER['SERVER_NAME'] . $manager->getBaseURL() . \"?group=all&output=txt{$urlExtra}\\n\";\n\n\t\tforeach ((array)$groupTests as $groupTest) {\n\t\t\t$buffer .= $_SERVER['SERVER_NAME']. $manager->getBaseURL().\"?group=\" . $groupTest . \"&output=txt{$urlExtra}\".\"\\n\";\n\t\t}\n\n\t\treturn $buffer;\n\t}",
"function &getGroupTestList() {\n\t\t$manager = new TestManager();\n\t\t$return = $manager->_getTestGroupList($manager->_getTestsPath('groups'));\n\t\treturn $return;\n\t}",
"protected function getTestcaseFilenames() {\n\t\t$packageManager = $this->objectManager->getObject('F3\\FLOW3\\Package\\PackageManagerInterface');\n\t\t$packages = array();\n\t\t$testcaseFilenames = array(self::TYPE_UNIT => array(), self::TYPE_INTEGRATION => array(), self::TYPE_SYSTEM => array());\n\n\t\t$testcaseClassNameMatches = array();\n\t\tpreg_match('/F3\\\\\\\\([^\\\\\\\\]*)\\\\\\\\(.*)/', $this->testcaseClassName, $testcaseClassNameMatches);\n\t\tif (count($testcaseClassNameMatches) === 3) {\n\t\t\t$this->testcaseClassName = $testcaseClassNameMatches[2];\n\t\t\tif ($testcaseClassNameMatches[1] === '.*') {\n\t\t\t\t$packages = $packageManager->getActivePackages();\n\t\t\t} elseif ($packageManager->isPackageActive($testcaseClassNameMatches[1])) {\n\t\t\t\t$packages = array($packageManager->getPackage($testcaseClassNameMatches[1]));\n\t\t\t}\n\t\t} elseif ($this->packageKey == '*') {\n\t\t\t$packages = $packageManager->getActivePackages();\n\t\t\t$this->testcaseClassName = '.*Test';\n\t\t} elseif ($packageManager->isPackageActive($this->packageKey)) {\n\t\t\t$packages = array($packageManager->getPackage($this->packageKey));\n\t\t\t$this->testcaseClassName = '.*Test';\n\t\t}\n\n\t\tshuffle($packages);\n\t\tforeach ($packages as $package) {\n\t\t\tif (in_array($package->getPackageKey(), $this->testBlacklist)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tforeach (array(\n\t\t\t\t\tself::TYPE_UNIT => \\F3\\FLOW3\\Package\\Package::DIRECTORY_TESTS_UNIT,\n\t\t\t\t\tself::TYPE_INTEGRATION => \\F3\\FLOW3\\Package\\Package::DIRECTORY_TESTS_INTEGRATION,\n\t\t\t\t\tself::TYPE_SYSTEM => \\F3\\FLOW3\\Package\\Package::DIRECTORY_TESTS_SYSTEM,\n\t\t\t\t) as $type => $directory) {\n\t\t\t\t$testPath = $package->getPackagePath() . $directory;\n\t\t\t\tif (is_dir($testPath)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t$testsDirectoryIterator = new \\RecursiveDirectoryIterator($testPath);\n\n\t\t\t\t\t\t$testcaseFilenames[$type] = $this->readDirectories($testcaseFilenames[$type], $testsDirectoryIterator);\n\t\t\t\t\t\t\\PHPUnit_Util_Filter::removeDirectoryFromFilter($package->getPackagePath() . 'Classes');\n\t\t\t\t\t} catch(\\Exception $exception) {\n\t\t\t\t\t\tthrow new \\RuntimeException($exception->getMessage(), 1170236926);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshuffle($testcaseFilenames[$type]);\n\t\t\t}\n\t\t}\n\t\treturn $testcaseFilenames;\n\t}",
"function &_getTestGroupList($directory = '.') {\n\t\t$fileList = & $this->_getTestGroupFileList ( $directory );\n\t\t$groupTests = array ();\n\t\t\n\t\tforeach ( $fileList as $groupTestFile ) {\n\t\t\t$groupTests [$groupTestFile] = str_replace ( $this->_groupExtension, '', basename ( $groupTestFile ) );\n\t\t}\n\t\tsort ( $groupTests );\n\t\treturn $groupTests;\n\t}",
"protected function getClassNames($file)\n {\n $php_code = file_get_contents($file);\n $classes = [];\n $namespace = \"\";\n $tokens = token_get_all($php_code);\n $count = count($tokens);\n\n for ($i = 0; $i < $count; $i++) {\n if ($tokens[$i][0] === T_NAMESPACE) {\n for ($j = $i + 1; $j < $count; ++$j) {\n if ($tokens[$j][0] === T_STRING) {\n $namespace .= \"\\\\\" . $tokens[$j][1];\n } elseif ($tokens[$j] === '{' or $tokens[$j] === ';') {\n break;\n }\n }\n }\n if ($tokens[$i][0] === T_CLASS) {\n for ($j = $i + 1; $j < $count; ++$j) {\n if ($tokens[$j] === '{') {\n $classes[] = $namespace . \"\\\\\" . $tokens[$i + 2][1];\n }\n }\n }\n }\n\n return $classes;\n }",
"public function getTestFiles($group)\n {\n $baseDir = __DIR__ . '/../../Resources/' . $group . '/';\n $testDir = $baseDir . 'input/';\n $expectDir = $baseDir . 'output/';\n\n $returnData = array();\n\n $testFiles = scandir($testDir);\n foreach ($testFiles as $testFile) {\n if(substr($testFile, -3) !== '.js' || !file_exists(($expectDir . $testFile)))\n continue;\n\n $testInput = file_get_contents($testDir . $testFile);\n $testOutput = file_get_contents($expectDir . $testFile);\n\n $returnData[] = array($testFile, $testInput, $testOutput);\n }\n\n return $returnData;\n }",
"function find_module_name_by_test_class($class_name) {\n $class = new $class_name;\n $module_name = strtolower($class->getInfo()['group']);\n return $module_name;\n }",
"public function testGetClassesFilterByCategoryAndPattern()\n {\n $classes = $this->pci->getClasses('user', '^d$');\n\n $expected = array(\n 'd' => array(\n 'versions' => array('5.0.0', ''),\n 'uses' => 1,\n 'sources' => array(TEST_FILES_PATH . 'source1.php'),\n 'namespace' => '\\\\',\n 'excluded' => false,\n ),\n );\n\n $this->assertEquals(\n $expected, $classes\n );\n\n }",
"#[@test]\n public function providesTestClasses() {\n $p= \\lang\\reflect\\Package::forName('net.xp_framework.unittest.reflection.classes');\n foreach (self::$testClasses as $name) {\n $this->assertTrue($p->providesClass($name), $name);\n }\n }",
"public function getClasses () {\n foreach ($this->files as $file) {\n $this->allData = token_get_all(file_get_contents($file));\n $this->parseFile(file_get_contents($file));\n }\n $this->filterClasses();\n $this->parseClasses();\n return $this->classes;\n }",
"function wptest_listall_testcases($test_classes) {\n\techo \"\\nWordPress Tests available TestCases:\\n\\n\";\n\tnatcasesort( $test_classes );\n\techo array_reduce($test_classes, '_wptest_listall_testcases_helper');\n\techo \"\\nUse -t TestCaseName to run individual test cases\\n\";\t\n}",
"private function _extractClasses ($pFileName){\n\t\t\t$toReturn = array ();\n\t\t\t$tokens = token_get_all (file_get_contents ($pFileName, false));\n\t\t\t$tokens = array_filter ($tokens, 'is_array');\n\t\t\n\t\t\t$classHunt = false;\n\t\t\tforeach ($tokens as $token){\n\t\t\t\tif ($token[0] === T_INTERFACE || $token[0] === T_CLASS){\n\t\t\t\t\t$classHunt = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\n\t\t\t\tif ($classHunt && $token[0] === T_STRING){\n\t\t\t\t\t$toReturn[$token[1]] = $pFileName;\n\t\t\t\t\t$classHunt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\treturn $toReturn;\n\t\t}",
"public function testClassGetClasses()\n {\n }",
"public function providerClassLoaderGetPrefixesClasses() {\n // Provide each test with a index number so it can change accordingly.\n $index = 1;\n\n // Give each test the class that needs testing.\n $tests[] = array('RobLoach\\\\ClassLoaderAdapter\\\\Composer\\\\ClassLoader', $index++);\n $tests[] = array('RobLoach\\\\ClassLoaderAdapter\\\\Symfony\\\\ClassLoader', $index++);\n $tests[] = array('RobLoach\\\\ClassLoaderAdapter\\\\Symfony\\\\UniversalClassLoader', $index++);\n\n return $tests;\n }",
"public function getClasses()\n {\n foreach ($this->files as $file)\n {\n $this->allData = token_get_all(file_get_contents($file));\n $this->parseFile(file_get_contents($file));\n }\n \n $this->parseClasses();\n return $this->classes;\n }",
"public function getDirectoryClasses(){\n $classes = [];\n $files = $this->filterByPhpExtension();\n\n foreach ($files as $file) {\n $contents = file_get_contents($file);\n $namespace = $class = \"\";\n $getting_namespace = $getting_class = false;\n\n foreach (token_get_all($contents) as $token) {\n\n if (is_array($token) && $token[0] == T_NAMESPACE) {\n $getting_namespace = true;\n }\n\n if (is_array($token) && $token[0] == T_CLASS) {\n $getting_class = true;\n }\n\n if ($getting_namespace === true) {\n\n if(is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR])) {\n $namespace .= $token[1];\n }\n else if ($token === ';') {\n $getting_namespace = false;\n }\n }\n\n if ($getting_class === true) {\n if(is_array($token) && $token[0] == T_STRING) {\n $class = $token[1];\n break;\n }\n }\n\n }\n\n if(!empty($namespace) && !empty($class)){\n $classes[] = $namespace . '\\\\' . $class;\n }\n }\n return $classes;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
muestra el modal para la creacion de nuevo usuario en el sistema
|
public function viewCrearUsuario()
{
return view('administracion.modalcrearusuarios');
}
|
[
"function nuevoUsuario(){\n\t\t/*\n\t\tDebe desplegar un formulario para ingresar los datos de un nuevo usuario\n\t\tReocordar colocar contraseña y repetir contraseña\n\t\t*/\n\t\t$oPerfil= new Perfil($this->oDBM);\n\t\t$this->perfiles=$oPerfil->getData();\n\t\t$this->activate('panelUsuario');\n\t\t$this->fillForm('formNuevoUsuario','accion','crearUsuario');\n\t\t$this->load('usuario-2.tpl.php');\t\n\t}",
"public function crearusuarioadmin()\n {\n $this->validarSesion();\n $this->vista(\"crearusuarioadmin/crearusuarioadmin\");\n }",
"public function actionCreate()\n {\n $model = new NuevoUsuario();\n\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n $LoginFrom = new LoginForm;\n $LoginFrom->password = $model->Clave;\n $LoginFrom->username = $model->NombreUsuario;\n if ($LoginFrom->login()){\n // provisoriamente lo inscribe al torneo programate para hacegurar el registro\n //$this->redirect(array('/torneo/inscripcion','idTorneo'=>1));\n $this->redirect(array('/site'));\n \n }else{\n $this->redirect(array('/site/login'));\n }\n }\n return $this->render('nuevousuario', [\n \n 'model' => $model,\n ]);\n \n\n \n }",
"public function crear()\n {\n if (isset($this->usuarioActual)) {\n if ($this->usuarioActual->getRol() == \"administrador\" || $this->usuarioActual->getRol() == \"moderador\") {\n $this->view->render(\"noticia\", \"crearNoticia\");\n } else {\n $this->view->setVariable(\"mensajeError\", \"No tienes suficientes privilegios\", true);\n $this->view->redirect(\"noticia\", \"index\");\n }\n } else {\n $this->view->setVariable(\"mensajeError\", \"Se necesita login para esa acción\", true);\n $this->view->redirect(\"noticia\", \"index\");\n }\n }",
"function show_modal_add_user()\n {\n if (jAcl2::check(\"user.create\") && !jAcl2::check(\"user.restrictall\")) {\n $resp = $this->getResponse ('htmlfragment') ; \n $resp->tplname = 'user~modal_add' ;\n $toListProfile = CJacl2Group::getList();\n $action = 'right~right:save_new_user';\n $resp->tpl->assign('action', $action);\n $resp->tpl->assign('toListProfile', $toListProfile);\n }\n else {\n $resp = $this->getResponse('html');\n $tpl = new jTpl();\n $tpl->assign(\"SCRIPT\", jZone::get('common~script'));\n $resp->body->assign('MAIN', $tpl->fetch('common~accessdenied'));\n }\n return $resp ;\n }",
"public function create(){\n\t\t$nombre = \"'\".$_POST['nombre'].\"'\";\n\t\t$cedula = \"'\".$_POST['cedula'].\"'\";\n\t\t$pass = \"'\".$_POST['pass'].\"'\";\n\t\trequire_once(\"../app/models/usuario.php\");\n\t\t$user=new Usuario();//crea la instancia\n\t\tif($user->new($nombre,$cedula,$pass)){\n\t\t\t$current_user = $user->get_current_user($cedula,$pass);\n\t\t\t$id = strval($current_user[0][\"id\"]);\n\t\t\tsetcookie(\"id_user_sesion_kawaii\", $id,time() + 120, \"/\");\n\t\t\theader(\"Location: http://localhost:8000/\");\n\t\t\texit;\n\t\t}\n\n\t\t//Llamada a la vista\n\t\t$this->view('usuarios/sign_up', []);\n\t}",
"public function createUserForm()\n {\n $this->checkPermissions();\n\n echo $this->engine->render('create_user');\n }",
"static public function ctrCrearUsuario(){\r\n\r\n\t\tif(isset($_POST[\"nuevoUsuario\"])){\r\n\r\n\t\t\tif(preg_match('/^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+$/', $_POST[\"nuevoNombre\"]) &&\r\n\t\t\t\tpreg_match('/^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+$/', $_POST[\"nuevoApellido\"]) &&\r\n\t\t\t preg_match('/^[a-zA-Z0-9@.-_]+$/', $_POST[\"nuevoUsuario\"]) &&\r\n\t\t\t preg_match('/^[a-zA-Z0-9]+$/', $_POST[\"nuevoPassword\"])){\r\n\r\n\t\t\t $tabla = \"usuario\";\r\n\r\n\t\t\t\t$encriptar = crypt($_POST[\"nuevoPassword\"], '$2a$07$asxx54ahjppf45sd87a5a4dDDGsystemdev$');\r\n\r\n\t\t\t\t$datos = array(\"nombre\" => $_POST[\"nuevoNombre\"],\r\n\t\t\t\t\t\t\t\t\"apellido\" => $_POST[\"nuevoApellido\"],\r\n\t\t\t\t\t \"mail\" => $_POST[\"nuevoUsuario\"],\r\n\t\t\t\t\t \"password\" => $encriptar,\r\n\t\t\t\t\t );\r\n\r\n\t\t\t\t$respuesta = ModeloUsuarios::mdlIngresarUsuario($tabla, $datos);\r\n\t\t\t\r\n\t\t\t\tif($respuesta == \"ok\"){\r\n\r\n\t\t\t\t\techo '\r\n\r\n\t\t\t\t\t<script>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\talert(\"Usuario Registrado con exito\");\r\n\t\t\t\t\t\twindow.location = \"inicio\";\t\t\t\r\n\r\n\t\t\t\t\t</script>';\r\n\r\n\r\n\t\t\t\t}\t\r\n\r\n\r\n\t\t\t}else{\r\n\r\n\t\t\t\techo '<script>\r\n\t\t\t\t\t\talert(\"No se Pudo Registrar el usuario\");\r\n\t\t\t\t\t\twindow.location = \"register\";\t\r\n\t\t\t\t\t\r\n\t\t\t\t</script>';\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\r\n\t}",
"public function nueva() {\n\t\tif(self::logeado()){\n\t\t\tif(isset($_POST[\"titulo\"]) && isset($_POST[\"contenido\"])){\n\t\t\t\t$note = new Nota();\n\t\t\t\t$note->setTitulo($_POST[\"titulo\"]);\n\t\t\t\t$note->setContenido($_POST[\"contenido\"]);\n\t\t\t\ttry{\n\t\t\t\t\t$errors = array();\n\t\t\t\t\tif($_SESSION[\"currentuser\"]){\n\t\t\t\t\t\t$this->NotaMapper->save($note);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$errors[\"username\"] = \"Username and/or password not exists in system\";\n\t\t\t\t\t\t$this->view->setFlash(\"errors: \".$errors[\"username\"]);\n\t\t\t\t\t}\n\t\t\t\t}catch(ValidationException $ex){\n\t\t\t\t\t// Get the errors array inside the exepction...\n\t\t\t\t\t$errors = $ex->getErrors();\n\t\t\t\t\t// And put it to the view as \"errors\" variable\n\t\t\t\t\t$this->view->setVariable(\"errors\", $errors);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$usuarioMapper = new UsuarioMapper();\n\t\t\t$this->view->setVariable(\"listaAlias\",$usuarioMapper->getAlias());\n\t\t\t$this->view->render(\"notes\", \"crearNota\");\n\t\t}\n\t}",
"public function crear(){\n\t\tif($this->user->tipo_usuario != 'administrador'){\n\t\t\theader('Location: /');\n\t\t}\n\t\t$this->location = \"usuarios\";\n\t\t$this->include_theme(\"index\",\"crear\");\n\t}",
"public function actionCreate()\n {\n $model = new Administradores();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->usuario_id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }",
"public function actionCreate()\n {\n $model = new Usuarios();\n if ($model->load(Yii::$app->request->post())) {\n $model->contrasena = sha1($model->contrasena);\n $model->accessToken = md5(time());\n if($model->perfil === '' || $model->perfil === NULL){\n $model->perfil = 'Jugador';\n }\n $model->usuario = $model->correo;\n if($model->save()){\n $role = Yii::$app->authManager->getRole($model->perfil);\n Yii::$app->authManager->assign($role, $model->id_usuario);\n return $this->redirect(['view', 'id' => $model->id_usuario]);\n }else{\n return $this->redirect(['create']);\n }\n } else {\n $fecha = date('Y');\n $fecha_min = strtotime('-65 year', strtotime($fecha));\n $fecha_max = strtotime('-10 year', strtotime($fecha));\n $fecha_min = date('Y',$fecha_min);\n $fecha_max = date('Y',$fecha_max);\n $rango_fecha = ''.$fecha_min.':'.$fecha_max;\n $query = new Query;\n $roles = $query->select('name')->from('items')->all();\n $posiciones = $query->select('*')->from('posiciones')->all();\n return $this->render('create', [\n 'model' => $model,\n 'roles' => $roles,\n 'posiciones' => $posiciones,\n 'rango_fecha' => $rango_fecha,\n ]);\n }\n }",
"public function createForm()\n {\n $sesion=$this->getUser();\n $this->verify();\n $this->view->mostrarCrearEquipoForm($sesion);\n\n }",
"public function create()\n {\n $extra = array(\n 'return' => 'admin/'.$this->module_name,\n 'success_message' => lang('ug:submit_success'),\n 'failure_message' => lang('ug:submit_failure'),\n 'title' => 'lang:ug:new',\n );\n\n $this->streams->cp->entry_form('users', 'ug', 'new', null, true, $extra);\n }",
"public function actionCreate()\n {\n $model = new ModUsuariosEntUsuarios();\n $model->scenario = ModUsuariosEntUsuarios::SCENARIO_CREATE;\n\n\n $model->txt_token = uniqid(\"usr_\");\n $model->txt_auth_key = uniqid(\"autk_\");\n $model->txt_password_hash = Yii::$app->getSecurity()->generatePasswordHash($model->txt_password);\n $model->fch_creacion = Calendario::getFechaActualTimeStamp();\n $model->fch_actualizacion = $model->fch_creacion;\n\n $statusUsuarioList = ModUsuariosCatStatusUsuarios::getHabilitados();\n $rolesUsuarioList = ModUsuariosCatRoles::getHabilitados();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id_usuario]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n 'statusUsuarioList' => $statusUsuarioList,\n 'rolesUsuarioList' => $rolesUsuarioList\n ]);\n }",
"public function actionCreate() {\n $model = new Usuario();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }",
"public function actionCrear()\n {\n $model = new Cuenta();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->actionInicio();\n } else {\n return $this->render('crear', ['model' => $model,]);\n }\n }",
"public final function actionGetModalAlteraSenha ()\n {\n\n $this->naoExibeMenu = true;\n\n $this->view('user/partial/modal', array(\n 'modal' => true\n ));\n\n }",
"public function showCreateForm()\n {\n return view(\"admin.user.create\");\n }",
"static public function ctrCrearUsuario()\n {\n\t\t\t// Valida si esta creada la variable POST \"nuevoUsuario\", que se encuentra en el formulario; cuando se oprime el boton Submit, se poueden incluir todas del formulario \n\t\t\t//Para poder ejecutar esta funcion. \n\n if (isset($_POST[\"nuevoUsuario\"]))\n {\n \n // preg_match('/^[a-zA-ZO-9ñÑáéíóúÁÉÍÓÚ ]+$/',$_POST[\"nuevoNombre\"]) && preg_match('/^[a-zA-ZO-9]+$/',$_POST[\"nuevoUsuario\"]) &&\n\t\t\t\t\t\t //preg_match('/^[a-zA-Z0-9]+$/',$_POST[\"nuevoNombre\"])\n\t\t\t\t// Validando que lo que tecleo el usuario sea valido con la sig. expresion regular.\n if ( preg_match('/^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+$/',$_POST[\"nuevoNombre\"]) && preg_match('/^[a-zA-Z0-9]+$/',$_POST[\"nuevoUsuario\"]) && preg_match('/^[a-zA-Z0-9]+$/',$_POST[\"nuevoPassword\"]))\n {\n /* Para guardar las fotos, sera de la siguiente manera: \n 1.- En una carpeta del servidor se subira la foto\n 2.- En la base de datos solo se guardara la ruta donde esta almacenada la foto en el servidor.\n\n */\n $ruta =\"\";\n\t\t\t\t\t// Validando que se encuentre la foto en la etiqueta de \"vistas/modulos/usuarios.php\" seccion de \"modalAgregarUsuario\" etiqueta tipo \"File\" \"nuevaFoto\"\n if (isset($_FILES[\"nuevaFoto\"][\"tmp_name\"]))\n {\n // Crea un nuevo array\n //Definiendo el tamaño de la foto de 500X500.\n // getimagesize($_FILES[\"nuevaFoto\"][\"tmp_name\"]), es un arreglo que en la primera, segunda posicion tiene el tamaño de la foto \"Ancho\" y \"Alto\"\n list($ancho,$alto) = getimagesize($_FILES[\"nuevaFoto\"][\"tmp_name\"]);\n //var_dump(getimagesize($_FILES[\"nuevaFoto\"][\"tmp_name\"])); \n\n // Los tamaños de la foto a guardar en la computadora\n $nuevoAncho = 500;\n $nuevoAlto = 500;\n\n // Crear el directorio donde se guardara la foto del usuario\n\t\t\t\t\t\t$directorio = \"vistas/img/usuarios/\".$_POST[\"nuevoUsuario\"];\n\t\t\t\t\t\t// Si se esta utilizando servidor de Linux, se tiene que dar permisos totales a la carpeta de \"usuarios\".\n\t\t\t\t\t\t// Se debe asignar el \"www-data:www-data\" a la carpeta de Usuarios en el servidor.\n\t\t\t\t\t\t// chmod -R 777 usuarios.\n\t\t\t\t\t\t// Para que se pueda grabar, borrar las imagenes.\n mkdir ($directorio,0777); // 0755\n\n // De acuerdo al tipo de imagen aplicamos las funciones por defecto de PHP.\n if ($_FILES[\"nuevaFoto\"][\"type\"] == \"image/jpeg\")\n {\n $aleatorio = mt_rand(100,999); // Utilizado para el nombre del archivo.\n $ruta = \"vistas/img/usuarios/\".$_POST[\"nuevoUsuario\"].\"/\".$aleatorio.\".jpg\";\n $origen = imagecreatefromjpeg($_FILES[\"nuevaFoto\"][\"tmp_name\"]);\n // Cuando se define el nuevo tamaño de al foto, mantenga los colores.\n\t\t\t\t\t\t\t$destino = imagecreatetruecolor($nuevoAncho,$nuevoAlto);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Ajustar la imagen al tamaño definidos en las variables \"$nuevoAncho\", y \"$nuevoAlto\"\n\t\t\t\t\t\t\t// imagecopyresized (dst_image,src_image,dst_x, dst_y,src_x,src_y,dst_w,dst_h,src_w,src_h)\n imagecopyresized($destino,$origen,0,0,0,0,$nuevoAncho,$nuevoAlto,$ancho,$alto);\n // Guardar la foto en la computadora.\n\t\t\t\t\t\t\timagejpeg($destino,$ruta);\n\t\t\t\t\t\t\t\n }\n\n\t\t\t\t\t\t// De acuerdo al tipo de imagen aplicamos las funciones por defecto de PHP.\n\t\t\t\t\t\t// \"imagecreatefrompng\" = Se tiene que instalar en el servidor Linux remoto\n\t\t\t\t\t\t//extensión PHP GD que no es más que una librería de funciones para el manejo y tratamiento de imágenes en PHP. Por lo que la solución a este error es instalar la citada librería.\n\t\t\t\t\t\t// apt-get install php-gd\n if ($_FILES[\"nuevaFoto\"][\"type\"] == \"image/png\")\n {\n $aleatorio = mt_rand(100,999);\n $ruta = \"vistas/img/usuarios/\".$_POST[\"nuevoUsuario\"].\"/\".$aleatorio.\".png\";\n $origen = imagecreatefrompng($_FILES[\"nuevaFoto\"][\"tmp_name\"]);\n // Cuando se define el nuevo tamaño de al foto, mantenga los colores.\n $destino = imagecreatetruecolor($nuevoAncho,$nuevoAlto);\n\t\t\t\t\t\t\t// Ajustar la imagen al tamaño definidos en las variables \"$nuevoAncho\", y \"$nuevoAlto\"\n\t\t\t\t\t\t\t// imagecopyresized (dst_image,src_image,dst_x, dst_y,src_x,src_y,dst_w,dst_h,src_w,src_h)\n\n imagecopyresized($destino,$origen,0,0,0,0,$nuevoAncho,$nuevoAlto,$ancho,$alto);\n // Guardar la foto en la computadora.\n\t\t\t\t\t\t\t// imagejpeg($destino,$ruta);\n\t\t\t\t\t\t\timagepng($destino,$ruta);\n }\n \n }\n // '$2a$07$usesomesillystringforsalt$ = Este valor es el sig. parametro de la función es un nivel de encriptacion\n // Se le llama Capsula, envuelve lo que se quiere encriptar.\n\t\t\t\t\t$encriptar = crypt($_POST[\"nuevoPassword\"], '$2a$07$asxx54ahjppf45sd87a5a4dDDGsystemdev$');\n\t\t\t\t\t// Se definen los datos, nombre de la tabla y un arreglo para ser insertado en la base de datos\n\t\t\t\t\t$tabla = \"t_Usuario\";\n\t\t\t\t\tif (empty($_POST[\"nuevoPerfil\"]))\n\t\t\t\t\t{\n\t\t\t\t\t\t$_POST[\"nuevoPerfil\"] = 'Vendedor';\n\t\t\t\t\t}\n\n $datos = array(\"nombre\"=>$_POST[\"nuevoNombre\"],\n \"usuario\"=>$_POST[\"nuevoUsuario\"],\n \t \t \"password\"=> $encriptar,\n \t \"perfil\"=>$_POST[\"nuevoPerfil\"],\n \t\t\"ruta\" =>$ruta );\n \n // Conectar la capa Controlador con la del Modelo.\n $respuesta = ModeloUsuarios::mdlIngresarUsuario($tabla,$datos);\n\n if ($respuesta == \"ok\")\n {\n echo '<script> \n \tSwal.fire ({\n\t\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\t\ttitle: \"El usuario ha sido guardado correctamente \",\n\t\t\t\t\t\t\t\tshowConfirmButton: true,\n\t\t\t\t\t\t\t\tconfirmButtonText: \"Cerrar\",\n\t\t\t\t\t\t\t\tcloseOnConfirm: false\n\t\t\t\t\t\t\t\t}).then((result)=>{\n\t\t\t\t\t\t\t\t\tif (result.value)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\twindow.location=\"usuarios\";\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t});\n \n </script>'; \n \n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\techo '<script> \n \tSwal.fire ({\n\t\t\t\t\t\t\t\ttype: \"danger\",\n\t\t\t\t\t\t\t\ttitle: \"El usuario ha sido guardado correctamente \",\n\t\t\t\t\t\t\t\tshowConfirmButton: true,\n\t\t\t\t\t\t\t\tconfirmButtonText: \"Cerrar\",\n\t\t\t\t\t\t\t\tcloseOnConfirm: false\n\t\t\t\t\t\t\t\t}).then((result)=>{\n\t\t\t\t\t\t\t\t\tif (result.value)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\twindow.location=\"usuarios\";\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t});\n \n \t\t</script>'; \n \n\t\t\t\t\t}\n \n }\n else // if ( preg_match('/^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+$/',$_POST[\"nuevoNombre\"]) && preg_match('/^....\n {\n // Este plugins se baja de : https://www.jsdelivr.com/package/npm/sweetalert2, se copia en un archivo el contenido y se agrega en la carpeta \"Vistas/plugins/sweetalert2/sweetalert2.all.js\"\n \n echo '<script>\n Swal.fire ({\n type: \"error\",\n title: \"El usuario no puede ir vacio o llevar caracteres especiales\",\n showConfirmButton: true,\n confirmButtonText: \"Cerrar\",\n closeOnConfirm: false\n }).then((result)=>{\n if (result.value)\n {\n window.location=\"usuarios\";\n }\n\n });\n \n </script>'; \n \n\n\n } // if ( preg_match('/^[a-zA-Z0-9ñÑáé....\n\n } // if (isset($_POST[\"nuevoUsuario\"]))\n\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Creates an HTML anchor to a file. Note that the title is not escaped, to allow HTML elements within links (images, etc). echo HTML::file_anchor('media/doc/user_guide.pdf', 'User Guide');
|
public static function file_anchor($file, $title = NULL, array $attributes = NULL, $protocol = NULL, $index = FALSE)
{
return parent::file_anchor(HTML::file_path($file), $title, $attributes, $protocol, $index);
}
|
[
"public static function file_anchor($file, $title = NULL, $attributes = NULL, $protocol = NULL)\n\t{\n\t\treturn\n\t\t// Base URL + URI = full URL\n\t\t'<a href=\"'.htmlspecialchars(url::base(FALSE, $protocol).$file, ENT_QUOTES, Kohana::CHARSET, FALSE).'\"'\n\t\t// Attributes empty? Use an empty string\n\t\t.(is_array($attributes) ? html::attributes($attributes) : '').'>'\n\t\t// Title empty? Use the filename part of the URI\n\t\t.(($title === NULL) ? end(explode('/', $file)) : $title) .'</a>';\n\t}",
"function filelink($link, $title = NULL) {\n $this->doc .= '<link type=\"filelink\" href=\"' . $this->_xmlEntities($link) . '\">';\n $this->doc .= $this->_getLinkTitle($title, $link);\n $this->doc .= '</link>';\n }",
"function nunit_doc_file( $filename, $text=\"\", $class=\"\" )\n{\n global $NUnitRelease;\n \n if ( $text == \"\" ) $text = $filename;\n return hlink( \"docs/$NUnitRelease/files/$filename\", $text, $class );\n}",
"function govcms_zen_file_link($variables) {\n $file = $variables ['file'];\n $icon_directory = $variables ['icon_directory'];\n\n $url = file_create_url($file->uri);\n $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));\n\n // Set options as per anchor format described at\n // http://microformats.org/wiki/file-format-examples\n $options = array(\n 'attributes' => array(\n 'type' => $file->filemime . '; length=' . $file->filesize,\n ),\n 'query' => array(\n 'v' => $file->timestamp,\n ),\n );\n\n // Use the description as the link text if available.\n if (empty($file->description)) {\n $link_text = $file->filename;\n }\n else {\n $link_text = $file->description;\n $options ['attributes']['title'] = check_plain($file->filename);\n }\n\n return '<span class=\"file\">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';\n}",
"public function getFileLink()\n {\n $fullName = $this->getFullName();\n $fileName = Tools::getMdFileName($fullName);\n\n return sprintf('[%s](%s)', $fullName, $fileName);\n }",
"function filelink($link, $title = null) {}",
"function makeAnchorLink( $url, $title, $content )\r\n{\r\n printf('<a href=\"%s\" title=\"%s\">%s</a>', $url, $title, $content);\r\n}",
"function createMarkdownFileLink($directory, $filename) {\n\t$url = getFileURL($directory, $filename);\n\t$thisMDResult = \"[$filename]($url)\";\n\n\treturn $thisMDResult;\n}",
"function PDF_add_pdflink($pdf, float $bottom_left_x, float $bottom_left_y, float $up_right_x, float $up_right_y, string $filename, int $page, string $dest){}",
"function write_page_link_tofile($filename, $label, $page, $cached = FALSE)\n {\n echo \"<a href='\" . ViewOptAndPos::get_page_link_href_tofile($filename, $page, $cached) .\n \"'>$label</a>\";\n }",
"function file_link($uplID,$text=\"\",$attrs=\"\") {\n global $SITE_ROOT;\n $res=\"\";\n if ($fname=file_name($uplID)) {\n if ($text==\"\") $text=$fname[\"name\"];\n $res=\"<a href='$SITE_ROOT/$fname[full_name]' $attrs>$text</a>\";\n }\n return $res;\n }",
"public function getAnchor()\n {\n $name = $this->getName();\n return \"<a name=\\\"{$name}\\\">\";\n }",
"public function linkForDisplayOfPath($title, $path) {\n\t\t$theArray = array(\n\t\t\t'file' => $this->markupFile,\n\t\t\t'path' => $path,\n\t\t\t'mode' => 'display'\n\t\t);\n\t\t$p = GeneralUtility::implodeArrayForUrl('', $theArray);\n\n\t\t$content .= '<strong><a href=\"' . htmlspecialchars('index.php?' . $p) . '\" target=\"display\">' . $title . '</a></strong>';\n\n\t\treturn $content;\n\t}",
"public function anchor_file( $page, $query = array() )\r\n\t\t{\r\n\t\t\treturn $this->site->anchor_file( $page, $query );\r\n\t\t}",
"public function htmlAnchor(array $attributes = array())\n {\n $text = \\Arr::get($attributes, 'text', e($this->filename()));\n \\Arr::delete($attributes, 'text');\n\n return \\Html::anchor($this->url(), $text, $attributes);\n }",
"function printAnchorSubHeading($title, $anchor) {\n print(\"<h3><a name=\\\"\" . $anchor . \"\\\">\" . $title . \"</a></h3>\\n\");\n }",
"function PMA_showDocu($anchor) {\n if ($GLOBALS['cfg']['ReplaceHelpImg']) {\n return '<a href=\"Documentation.html#' . $anchor . '\" target=\"documentation\"><img class=\"icon\" src=\"' . $GLOBALS['pmaThemeImage'] . 'b_help.png\" width=\"11\" height=\"11\" alt=\"' . $GLOBALS['strDocu'] . '\" title=\"' . $GLOBALS['strDocu'] . '\" /></a>';\n } else {\n return '[<a href=\"Documentation.html#' . $anchor . '\" target=\"documentation\">' . $GLOBALS['strDocu'] . '</a>]';\n }\n}",
"public function linkForDisplayOfPath($title, $path)\n {\n $theArray = [\n 'file' => $this->markupFile,\n 'path' => $path,\n ];\n\n $content .= '<strong><a href=\"'\n . BackendUtility::getModuleUrl('templavoila_template_disply', $theArray)\n . '\" target=\"display\">' . $title . '</a></strong>';\n\n return $content;\n }",
"function nunit_file( $filename, $text=\"\", $class=\"\" )\n{\n if ( $text == \"\" ) $text = $filename;\n return hlink( \"files/$filename\", $text=\"\", $class );\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Remove tags support from posts
|
function elodin_twentynineteen_remove_tags() {
unregister_taxonomy_for_object_type('post_tag', 'post');
}
|
[
"private function remove_tag_post_relationship() {\n \n }",
"function admin_remove_tag() {\n\t\t//\n\t}",
"function jpe_related_posts_remove_related_posts() {\n\t\tif ( class_exists( 'Jetpack_RelatedPosts' ) ) {\n\t\t\t$jprp = Jetpack_RelatedPosts::init();\n\t\t\tremove_filter( 'the_content', array( $jprp, 'filter_add_target_to_dom' ), 40 );\n\t\t}\n\t}",
"function white_unregister_tags() {\r\n\tunregister_taxonomy_for_object_type( 'post_tag', 'post' );\r\n\tunregister_taxonomy_for_object_type( 'category', 'post' );\r\n}",
"function cwj_remove_jetpack_relatedposts() {\n\tif ( class_exists( 'Jetpack_RelatedPosts' ) ) {\n\t\tremove_filter( 'the_content', array( Jetpack_RelatedPosts::init(), 'filter_add_target_to_dom' ), 40 );\n\t}\n}",
"function ryanbenhase_unregister_tags() {\n unregister_taxonomy_for_object_type( 'post_tag', 'post' );\n}",
"function unregister_tags(){\n\t register_taxonomy('post_tag', array());\n\t}",
"function sitewide_tags_remove_posts($blog_id = 0) {\n global $wpdb;\n $tags_blog_id = get_sitewide_tags_option('tags_blog_id');\n $max_to_del = 10;\n\n if (!$tags_blog_id)\n return;\n\n /* actions on the tags blog */\n if (($blog_id == 0) && ($wpdb->blogid == $tags_blog_id))\n return;\n if ($tags_blog_id == $blog_id)\n return;\n\n switch_to_blog($tags_blog_id);\n\n if ($blog_id != 0) {\n $posts = $wpdb->get_col(\"SELECT ID FROM {$wpdb->posts} WHERE guid LIKE '\" . $blog_id . \".%' OR guid LIKE '\" . esc_url($blog_id) . \".%'\");\n if (is_array($posts) && !empty($posts)) {\n foreach ($posts as $p_id) {\n wp_delete_post($p_id);\n }\n }\n } else {\n /* delete all posts over the max limit */\n if (mt_rand(0, 10)) {\n $allowed_post_types = apply_filters('sitewide_tags_allowed_post_types', array('post' => true));\n if (is_array($allowed_post_types) && !empty($allowed_post_types)) {\n $post_types = array();\n foreach ($allowed_post_types as $k => $v) {\n if ($v) {\n $post_types[] = $k;\n }\n }\n if (is_array($post_types) && !empty($post_types)) {\n if (count($post_types) > 1)\n $where = \"IN ('\" . join(\"','\", $post_types) . \"') \";\n else\n $where = \"= '\" . $post_types[0] . \"' \";\n } else {\n $where = \"= 'post' \";\n }\n $posts = $wpdb->get_results(\"SELECT ID, guid FROM {$wpdb->posts} WHERE post_status='publish' AND post_type {$where} ORDER BY ID DESC limit \" . get_sitewide_tags_option('tags_max_posts', 5000) . \", \" . $max_to_del);\n if (is_array($posts) && !empty($posts)) {\n foreach ($posts as $p) {\n if (preg_match('|^.*\\.([0-9]+)$|', $p->guid, $matches) && intval($matches[1]) > 0)\n wp_delete_post($p->ID);\n }\n }\n }\n }\n }\n restore_current_blog();\n}",
"function hwdsb_jetpack_remove_related_posts_from_post_content() {\n\tif ( false === class_exists( 'Jetpack_RelatedPosts', false ) ) {\n\t\treturn;\n\t}\n\n\t$jprp = Jetpack_RelatedPosts::init();\n\t$callback = array( $jprp, 'filter_add_target_to_dom' );\n\tremove_filter( 'the_content', $callback, 40 );\n}",
"public function StopPostFormating() {\r\n remove_filter('the_content', 'wpautop');\r\n remove_filter('the_excerpt', 'wpautop');\r\n }",
"protected function clean_dead_tags()\n\t{\n\t\t//\t----------------------------------------\n\t\t//\tRemove tags with no entries\n\t\t//\t----------------------------------------\n\n\t\t$query = ee()->db\n\t\t\t\t\t->select('e.tag_id, COUNT(e.tag_id) AS count')\n\t\t\t\t\t->from('exp_tag_tags t')\n\t\t\t\t\t->join('exp_tag_entries e', 'e.tag_id = t.tag_id', 'left')\n\t\t\t\t\t->group_by('e.tag_id', 'DESC')\n\t\t\t\t\t->get();\n\n\t\tforeach ( $query->result_array() as $row )\n\t\t{\n\t\t\tif ( $row['count'] == '0' )\n\t\t\t{\n\t\t\t\tee()->db->where('tag_id', $row['tag_id'])->delete('tag_tags');\n\t\t\t}\n\t\t}\n\t}",
"function jetpackme_remove_rp() {\n if ( class_exists( 'Jetpack_RelatedPosts' ) ) {\n $jprp = Jetpack_RelatedPosts::init();\n $callback = array( $jprp, 'filter_add_target_to_dom' );\n\n remove_filter( 'the_content', $callback, 40 );\n }\n}",
"function make_tags_local() {\n\tremove_filter( 'the_category', 'globalize_tags' );\n\tremove_filter( 'the_tags', 'globalize_taxonomy' );\n\tremove_filter( 'term_links-post_tag', 'globalize_taxonomy' );\n}",
"protected function save_no_match_post_tags( $content = '', $post = false ) {\n\t\t$this->set_object_terms( get_post( $post ), '', 'post_tag' );\n\t}",
"private function removeTagLine()\n {\n update_option('blogdescription', '');\n }",
"function lgm_theme_remove_tags_metabox() {\n\tremove_meta_box('tagsdiv-post_tag', 'post', 'side');\n}",
"function roots_unregister_tag_taxonomy() {\n register_taxonomy('post_tag', array());\n}",
"function _remove_post_type_support()\n\t{\n\t\tforeach( $this->remove_features as $feature )\n\t\t{\n\t\t\tremove_post_type_support( $this->name, $feature );\n\t\t}\n\t}",
"public function removeEmptyTags() {\n $this->str = preg_replace('#\\[b\\]\\[/b\\]#', '', $this->str);\n $this->str = preg_replace('#\\[u\\]\\[/u\\]#', '', $this->str);\n $this->str = preg_replace('#\\[i\\]\\[/i\\]#', '', $this->str);\n $this->str = preg_replace('#\\[del\\]\\[/del\\]#', '', $this->str);\n $this->str = preg_replace('#\\[ins\\]\\[/ins\\]#', '', $this->str);\n $this->str = preg_replace('#\\[h2\\]\\[/h2\\]#', '', $this->str);\n $this->str = preg_replace('#\\[h3\\]\\[/h3\\]#', '', $this->str);\n $this->str = preg_replace('#\\[tt\\]\\[/tt\\]#', '', $this->str);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Adds a FileManifest instance as a build to this source manifest. Changes between builds are calculated and stored with the build. Builds are stored numerically, in ascending order.
|
public function addBuild($build, FileManifest $manifest, $previous = null)
{
$this->builds[(int) $build] = [
'modules' => $manifest->getModuleChecksums(),
'files' => $this->processChanges($manifest, $previous),
];
// Sort builds numerically in ascending order.
ksort($this->builds[$build], SORT_NUMERIC);
}
|
[
"private function write()\n {\n $project = $this->getProject();\n\n if (!touch($this->file->getPath())) {\n throw new BuildException(\"Unable to write to \" . $this->file->getPath() . \".\");\n }\n\n $this->log(\"Writing to \" . $this->file->__toString(), Project::MSG_INFO);\n\n if (is_array($this->checksum)) {\n $this->log(\"Using \" . implode(', ', $this->checksum) . \" for checksuming.\", Project::MSG_INFO);\n }\n\n foreach ($this->filesets as $fs) {\n\n $dir = $fs->getDir($this->project)->getPath();\n\n $ds = $fs->getDirectoryScanner($project);\n $fromDir = $fs->getDir($project);\n $srcFiles = $ds->getIncludedFiles();\n $srcDirs = $ds->getIncludedDirectories();\n\n foreach ($ds->getIncludedFiles() as $file_path) {\n $line = $file_path;\n if ($this->checksum) {\n foreach ($this->checksum as $algo) {\n if (!$hash = $this->hashFile($dir . '/' . $file_path, $algo)) {\n throw new BuildException(\"Hashing $dir/$file_path with $algo failed!\");\n }\n\n $line .= \"\\t\" . $hash;\n }\n }\n $line .= \"\\n\";\n $manifest[] = $line;\n $this->log(\"Adding file \" . $file_path, Project::MSG_VERBOSE);\n $this->meta['totalFileCount']++;\n $this->meta['totalFileSize'] += filesize($dir . '/' . $file_path);\n }\n\n }\n\n file_put_contents($this->file, $manifest);\n\n $this->log(\n \"Done. Total files: \" . $this->meta['totalFileCount'] . \". Total file size: \" . $this->meta['totalFileSize'] . \" bytes.\",\n Project::MSG_INFO\n );\n }",
"function add($file) {\n\t\t$this->_srcs[] = $file;\n\t\treturn $this;\n\t}",
"public function pushManifest(ModuleManifest $manifest)\n {\n $this->manifests[] = $manifest;\n }",
"protected static function buildManifest()\n {\n $app = new Application(getcwd());\n\n $app->instance(PackageManifest::class, new PackageManifest(\n new Filesystem(),\n $app->basePath(),\n $app->getCachedPackagesPath()\n ));\n\n $app->make(PackageManifest::class)->build();\n }",
"public function add($file)\n {\n $this->fileList[] = $file;\n return $this;\n }",
"public function addManifestFile($manifestFileName, $type, $processid, $filenames){\n $baseDir = Mage::getBaseDir('var');\n $fullPath = $baseDir.\"/\".$manifestFileName;\n $fp = gzopen($fullPath,'w9');\n foreach($filenames as $fn){\n gzwrite($fp, $fn.\"\\n\");\n }\n gzclose($fp);\n\n # Push to S3\n $this->pushFileToS3($fullPath, $manifestFileName, $type, true, $processid);\n unlink($fullPath);\n }",
"protected function pushManifest(ClassManifest $manifest)\n {\n $this->manifests++;\n ClassLoader::inst()->pushManifest($manifest);\n }",
"function addFile(array $file) {\n\t\t$this->files[] = $file;\n\t}",
"public function addImageToManifest($file)\n\t\t{\n\t\t $extension = explode('.', $file);\n\t\t $add = ' <manifest:file-entry manifest:media-type=\"image/'.$extension[1].'\" manifest:full-path=\"Pictures/'.$file.'\"/>'.\"\\n\";\n\t\t $this->manifestXml = str_replace('</manifest:manifest>', $add.'</manifest:manifest>', $this->manifestXml);\n\t\t}",
"public function addToFile($filename, $entry);",
"public function add()\n\t{\n\t\tforeach (func_get_args() as $script) {\n\t\t\t$asset = $this->input_path . $script;\n\t\t\tarray_push($this->files, $asset);\n\t\t}\n\t}",
"public function addElementFile(ElementFile $l)\n\t{\n\t\tif ($this->collElementFiles === null) {\n\t\t\t$this->initElementFiles();\n\t\t}\n\t\tif (!in_array($l, $this->collElementFiles, true)) { // only add it if the **same** object is not already associated\n\t\t\tarray_push($this->collElementFiles, $l);\n\t\t\t$l->setElement($this);\n\t\t}\n\t}",
"public function pushManifest(ClassManifest $manifest, $exclusive = true)\n {\n $this->manifests[] = ['exclusive' => $exclusive, 'instance' => $manifest];\n }",
"public function build()\n {\n foreach ($this->fileContents as $key => $element) {\n if ($this->generatePrimaryElements($element, $key))\n continue;\n\n $this->generateArrayBasedElements($element, false);\n }\n }",
"public function addKeyToCacheManifest($key)\n {\n $manifest = craft()->cache->get($this->getCacheKey('manifest'));\n\n $manifest[] = $key;\n\n craft()->cache->set($this->getCacheKey('manifest'), $manifest);\n }",
"public function setManifest($val)\n {\n $this->_propDict[\"manifest\"] = $val;\n return $this;\n }",
"static function include_manifest() {\n\t\tif(isset($_REQUEST['usetestmanifest'])) {\n\t\t\tself::load_test_manifest();\n\t\t} else {\t\t\n\t\t\t// The dev/build reference is some coupling but it solves an annoying bug\n\t\t\tif(!file_exists(MANIFEST_FILE) || (filemtime(MANIFEST_FILE) < filemtime(BASE_PATH)) \n\t\t\t\t|| isset($_GET['flush']) || (isset($_REQUEST['url']) && ($_REQUEST['url'] == 'dev/build' \n\t\t\t\t|| $_REQUEST['url'] == BASE_URL . '/dev/build'))) {\n\t\t\t\tself::create_manifest_file();\n\t\t\t}\n\t\t\trequire_once(MANIFEST_FILE);\n\t\t}\n\t}",
"public function testAddFile()\n {\n // create a file to add\n file_put_contents(\n $this->dir . '/test.php',\n '<?php echo \"Hello, world!\\n\";'\n );\n\n // make sure the events are fired and changes are applied\n $post = null;\n\n $this->dispatcher->addListener(\n Events::PRE_ADD_FILE,\n function (PreAddFileEvent $event) {\n $file = $this->dir . '/other.php';\n\n file_put_contents(\n $file,\n '<?php echo \"Goodbye, world!\\n\";'\n );\n\n $event->setFile($file);\n $event->setLocal('other.php');\n }\n );\n\n $this->dispatcher->addListener(\n Events::POST_ADD_FILE,\n function (PostAddFileEvent $event) use (&$post) {\n $post = $event;\n }\n );\n\n $this->builder->addFile($this->dir . '/test.php', 'test.php');\n\n self::assertArrayNotHasKey('test.php', $this->builder);\n self::assertArrayHasKey('other.php', $this->builder);\n self::assertInstanceOf(\n 'Box\\Component\\Builder\\Event\\PostAddFileEvent',\n $post\n );\n self::assertEquals(\n '<?php echo \"Goodbye, world!\\n\";',\n $this->getFileContents($this->builder['other.php'])\n );\n\n // make sure the process can be skipped\n $this->removeListeners();\n\n $this->dispatcher->addListener(\n Events::PRE_ADD_FILE,\n function (PreAddFileEvent $event) {\n $event->skip();\n }\n );\n\n $this->builder->addFile($this->dir . '/test.php', 'test.php');\n\n self::assertArrayNotHasKey('test.php', $this->builder);\n\n // make sure we can skip everything and go straight to `Phar`\n $this->builder->setEventDispatcher(null);\n\n $post = null;\n\n $this->builder->addFile($this->dir . '/test.php', 'test.php');\n\n self::assertArrayHasKey('test.php', $this->builder);\n self::assertNull($post);\n }",
"public function store()\n {\n if (!$this->manifestIsDirty) {\n return;\n }\n\n $this->write($this->manifest);\n }",
"protected function processChanges(FileManifest $manifest, $previous = null)\n {\n // If no previous build has been provided, all files are added\n if (is_null($previous)) {\n return [\n 'added' => $manifest->getFiles(),\n ];\n }\n\n // Only save files if they are changing the \"state\" of the manifest (ie. the file is modified, added or removed)\n if (is_int($previous)) {\n $state = $this->getState($previous);\n } else {\n $state = $previous->getFiles();\n }\n $added = [];\n $modified = [];\n\n foreach ($manifest->getFiles() as $file => $sum) {\n if (!isset($state[$file])) {\n $added[$file] = $sum;\n continue;\n } else {\n if ($state[$file] !== $sum) {\n $modified[$file] = $sum;\n }\n unset($state[$file]);\n }\n }\n\n // Any files still left in state have been removed\n $removed = array_keys($state);\n\n $changes = [];\n if (count($added)) {\n $changes['added'] = $added;\n }\n if (count($modified)) {\n $changes['modified'] = $modified;\n }\n if (count($removed)) {\n $changes['removed'] = $removed;\n }\n\n return $changes;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Gets the 'payum.context._security_token.storage.syliusbundlepayumbundlemodelpaymentsecuritytoken' service. This service is shared. This method always returns the same instance of the service.
|
protected function getPayum_Context_SecurityToken_Storage_SyliusbundlepayumbundlemodelpaymentsecuritytokenService()
{
return $this->services['payum.context._security_token.storage.syliusbundlepayumbundlemodelpaymentsecuritytoken'] = new \Payum\Core\Bridge\Doctrine\Storage\DoctrineStorage($this->get('payum.entity_manager'), 'Sylius\\Bundle\\PayumBundle\\Model\\PaymentSecurityToken');
}
|
[
"protected function getSylius_Repository_PaymentSecurityTokenService()\n {\n return $this->services['sylius.repository.payment_security_token'] = new \\Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository(${($_ = isset($this->services['doctrine.orm.default_entity_manager']) ? $this->services['doctrine.orm.default_entity_manager'] : $this->get('doctrine.orm.default_entity_manager')) && false ?: '_'}, ${($_ = isset($this->services['doctrine.orm.default_entity_manager']) ? $this->services['doctrine.orm.default_entity_manager'] : $this->get('doctrine.orm.default_entity_manager')) && false ?: '_'}->getClassMetadata('Sylius\\\\Bundle\\\\PayumBundle\\\\Model\\\\PaymentSecurityToken'));\n }",
"protected function getSylius_Repository_PaymentSecurityTokenService()\n {\n return $this->services['sylius.repository.payment_security_token'] = new \\Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository($this->get('doctrine.orm.default_entity_manager'), $this->get('doctrine.orm.default_entity_manager')->getClassMetadata('Sylius\\\\Bundle\\\\PayumBundle\\\\Model\\\\PaymentSecurityToken'));\n }",
"protected function getPayum_Security_TokenStorageService()\n {\n return $this->services['payum.security.token_storage'] = new \\Payum\\Core\\Bridge\\Doctrine\\Storage\\DoctrineStorage(${($_ = isset($this->services['doctrine.orm.default_entity_manager']) ? $this->services['doctrine.orm.default_entity_manager'] : $this->get('doctrine.orm.default_entity_manager')) && false ?: '_'}, 'Sylius\\\\Bundle\\\\PayumBundle\\\\Model\\\\PaymentSecurityToken');\n }",
"protected function getSylius_Controller_PaymentSecurityTokenService()\n {\n $this->services['sylius.controller.payment_security_token'] = $instance = new \\Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController(${($_ = isset($this->services['sylius.resource_registry']) ? $this->services['sylius.resource_registry'] : $this->getSylius_ResourceRegistryService()) && false ?: '_'}->get('sylius.payment_security_token'), ${($_ = isset($this->services['sylius.resource_controller.request_configuration_factory']) ? $this->services['sylius.resource_controller.request_configuration_factory'] : $this->getSylius_ResourceController_RequestConfigurationFactoryService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.view_handler']) ? $this->services['sylius.resource_controller.view_handler'] : $this->getSylius_ResourceController_ViewHandlerService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.repository.payment_security_token']) ? $this->services['sylius.repository.payment_security_token'] : $this->get('sylius.repository.payment_security_token')) && false ?: '_'}, ${($_ = isset($this->services['sylius.factory.payment_security_token']) ? $this->services['sylius.factory.payment_security_token'] : $this->get('sylius.factory.payment_security_token')) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.new_resource_factory']) ? $this->services['sylius.resource_controller.new_resource_factory'] : $this->getSylius_ResourceController_NewResourceFactoryService()) && false ?: '_'}, ${($_ = isset($this->services['doctrine.orm.default_entity_manager']) ? $this->services['doctrine.orm.default_entity_manager'] : $this->get('doctrine.orm.default_entity_manager')) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.single_resource_provider']) ? $this->services['sylius.resource_controller.single_resource_provider'] : $this->getSylius_ResourceController_SingleResourceProviderService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.resources_collection_provider']) ? $this->services['sylius.resource_controller.resources_collection_provider'] : $this->getSylius_ResourceController_ResourcesCollectionProviderService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.form_factory']) ? $this->services['sylius.resource_controller.form_factory'] : $this->getSylius_ResourceController_FormFactoryService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.redirect_handler']) ? $this->services['sylius.resource_controller.redirect_handler'] : $this->getSylius_ResourceController_RedirectHandlerService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.flash_helper']) ? $this->services['sylius.resource_controller.flash_helper'] : $this->getSylius_ResourceController_FlashHelperService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.authorization_checker']) ? $this->services['sylius.resource_controller.authorization_checker'] : $this->get('sylius.resource_controller.authorization_checker')) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.event_dispatcher']) ? $this->services['sylius.resource_controller.event_dispatcher'] : $this->getSylius_ResourceController_EventDispatcherService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.state_machine']) ? $this->services['sylius.resource_controller.state_machine'] : $this->getSylius_ResourceController_StateMachineService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.custom_resource_controller.resource_update_handler']) ? $this->services['sylius.custom_resource_controller.resource_update_handler'] : $this->getSylius_CustomResourceController_ResourceUpdateHandlerService()) && false ?: '_'}, ${($_ = isset($this->services['sylius.resource_controller.resource_delete_handler']) ? $this->services['sylius.resource_controller.resource_delete_handler'] : $this->getSylius_ResourceController_ResourceDeleteHandlerService()) && false ?: '_'});\n\n $instance->setContainer($this);\n\n return $instance;\n }",
"protected function getPayum_Context_Be2billOnsite_Storage_SyliuscomponentcoremodelpaymentService()\n {\n return $this->services['payum.context.be2bill_onsite.storage.syliuscomponentcoremodelpayment'] = new \\Payum\\Core\\Bridge\\Doctrine\\Storage\\DoctrineStorage($this->get('payum.entity_manager'), 'Sylius\\\\Component\\\\Core\\\\Model\\\\Payment');\n }",
"public function getSecurityToken()\n {\n }",
"protected function getSecurity_Csrf_TokenStorageService()\n {\n include_once \\dirname(__DIR__, 4).'\\\\vendor\\\\symfony\\\\security-csrf\\\\TokenStorage\\\\TokenStorageInterface.php';\n include_once \\dirname(__DIR__, 4).'\\\\vendor\\\\symfony\\\\security-csrf\\\\TokenStorage\\\\ClearableTokenStorageInterface.php';\n include_once \\dirname(__DIR__, 4).'\\\\vendor\\\\symfony\\\\security-csrf\\\\TokenStorage\\\\SessionTokenStorage.php';\n\n return $this->privates['security.csrf.token_storage'] = new \\Symfony\\Component\\Security\\Csrf\\TokenStorage\\SessionTokenStorage(($this->services['session'] ?? $this->getSessionService()));\n }",
"public function getSecurityTokenStorage()\n {\n return $this['security.token_storage'];\n }",
"protected function getPayum_Context_Stripe_Storage_SyliuscomponentcoremodelpaymentService()\n {\n return $this->services['payum.context.stripe.storage.syliuscomponentcoremodelpayment'] = new \\Payum\\Core\\Bridge\\Doctrine\\Storage\\DoctrineStorage($this->get('payum.entity_manager'), 'Sylius\\\\Component\\\\Core\\\\Model\\\\Payment');\n }",
"protected function getSecurity_Csrf_TokenStorageService()\n {\n include_once \\dirname(__DIR__, 4).'/vendor/symfony/security-csrf/TokenStorage/TokenStorageInterface.php';\n include_once \\dirname(__DIR__, 4).'/vendor/symfony/security-csrf/TokenStorage/ClearableTokenStorageInterface.php';\n include_once \\dirname(__DIR__, 4).'/vendor/symfony/security-csrf/TokenStorage/SessionTokenStorage.php';\n\n return $this->privates['security.csrf.token_storage'] = new \\Symfony\\Component\\Security\\Csrf\\TokenStorage\\SessionTokenStorage(($this->services['session'] ?? $this->getSessionService()));\n }",
"public function securityToken(){\n\t\treturn $this->values['security_token'];\n\t}",
"protected function getSylius_CheckoutStep_SecurityService()\n {\n $this->services['sylius.checkout_step.security'] = $instance = new \\Sylius\\Bundle\\CoreBundle\\Checkout\\Step\\SecurityStep();\n\n $instance->setContainer($this);\n\n return $instance;\n }",
"private function getOrganizationSecurityToken() {\r\n\t\t/* Check if there is an existing token */\r\n\t\tif ($this->organizationSecurityToken != NULL) {\r\n\t\t\t/* Check if the Security Token is still valid */\r\n\t\t\tif ($this->organizationSecurityToken['expiryTime'] > time()) {\r\n\t\t\t\t/* Use the existing token */\r\n\t\t\t\treturn $this->organizationSecurityToken;\r\n\t\t\t}\r\n\t\t}\r\n\t\t/* Request a new Security Token for the Organization Service */\r\n\t\t$this->organizationSecurityToken = $this->requestSecurityToken($this->security['organization_authendpoint'], $this->organizationURI, $this->security['username'], $this->security['password']);\r\n\t\t/* Save the token, and return it */\r\n\t\treturn $this->organizationSecurityToken;\r\n\t}",
"public function getTokenService()\n {\n return $this->_tokenService;\n }",
"protected function getPayum_Security_TokenFactoryService()\n {\n return $this->services['payum.security.token_factory'] = new \\Payum\\Bundle\\PayumBundle\\Security\\TokenFactory($this->get('cmf_routing.router'), $this->get('payum.security.token_storage'), $this->get('payum'), 'payum_capture_do', 'payum_notify_do');\n }",
"public function getTokenService()\n {\n return $this->tokenService;\n }",
"public function getSecurityProvider()\n {\n return $this->securityProvider;\n }",
"protected function getSecurity_Csrf_TokenManagerService()\n {\n trigger_deprecation('symfony/framework-bundle', '5.2', 'Accessing the \"security.csrf.token_manager\" service directly from the container is deprecated, use dependency injection instead.');\n\n return $this->get('.container.private.security.csrf.token_manager');\n }",
"public function getSecurityTokenFromCustomerSession()\n {\n return $this->customerSession->getData(LSR::SESSION_CUSTOMER_SECURITYTOKEN);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Test of the console command with types
|
public function testConsoleCommandWithTypes(string $type): void
{
$name = 'Test'.(ucfirst($type)).'Model';
$params = [
'name' => $name,
'--container' => $this->containerName
];
if($type === 'controllerApi'){
$params['--controller'] = true;
$params['--api'] = true;
} else {
$params['--'.$type] = true;
}
$this->artisan('make:model', $params)
->expectsOutputToContain('Model ['.$this->portoPath.'/Containers/'.$this->containerName.'/Models/'.$name.'.php] created successfully.')
->assertSuccessful();
$file = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Models/'.$name.'.php';
$this->assertFileExists($file);
$controllerName = Str::studly(class_basename($name)).'Controller';
if($type === 'all'){
$factoryName = Str::studly($name).'Factory';
$seedName = Str::studly(class_basename($name)).'Seeder';
$policyName = Str::studly(class_basename($name)).'Policy';
$factoryFile = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Data/Factories/'.$factoryName.'.php';
$seedFile = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Data/Seeders/'.$seedName.'.php';
$controllerFile = base_path($this->portoPath).'/Containers/'.$this->containerName.'/UI/WEB/Controllers/'.$controllerName.'.php';
$policyFile = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Policies/'.$policyName.'.php';
$this->assertFileExists($factoryFile);
$this->assertFileExists($seedFile);
$this->assertFileExists($controllerFile);
$this->assertFileExists($policyFile);
$this->assertEquals($this->getModelContent($name), file_get_contents($file));
$this->assertEquals($this->getFactoryContent($factoryName, 'Containers\\'.$this->containerName.'\Models\\'.$name), file_get_contents($factoryFile));
$this->assertEquals($this->getSeederContent($seedName, 'Containers\\'.$this->containerName.'\Data\Seeders'), file_get_contents($seedFile));
$this->assertEquals($this->getControllerModelRequestContent($controllerName, 'Containers\\'.$this->containerName.'\UI\WEB\Controllers', $name), file_get_contents($controllerFile));
$this->assertEquals($this->getPolicyModelContent($policyName, $name), file_get_contents($policyFile));
} elseif($type === 'controller'){
$controllerFile = base_path($this->portoPath).'/Containers/'.$this->containerName.'/UI/WEB/Controllers/'.$controllerName.'.php';
$this->assertFileExists($controllerFile);
$this->assertEquals($this->getControllerPlainContent($controllerName, 'Containers\\'.$this->containerName.'\UI\WEB\Controllers'), file_get_contents($controllerFile));
}elseif($type === 'controllerApi'){
$controllerFile = base_path($this->portoPath).'/Containers/'.$this->containerName.'/UI/API/Controllers/'.$controllerName.'.php';
$this->assertFileExists($controllerFile);
$this->assertEquals($this->getControllerModelApiContent($controllerName, 'Containers\\'.$this->containerName.'\UI\API\Controllers', $name), file_get_contents($controllerFile));
} elseif($type === 'pivot'){
$this->assertEquals($this->getModelPivotContent($name), file_get_contents($file));
} elseif ($type === 'morph-pivot'){
$this->assertEquals($this->getModelMorphPivotContent($name), file_get_contents($file));
} else {
$this->assertEquals($this->getModelContent($name), file_get_contents($file));
}
}
|
[
"public function testConsoleCommandWithTypes(string $type): void\n {\n $name = 'Test'.(ucfirst($type)).'Rule';\n\n $this->artisan('make:rule', [\n 'name' => $name,\n '--container' => $this->containerName,\n '--'.$type => true\n ])->assertSuccessful();\n\n $file = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Data/Rules/'.$name.'.php';\n\n $this->assertFileExists($file);\n\n if($type === 'implicit'){\n $this->assertEquals($this->getRuleImplicitContent($name), file_get_contents($file));\n } else {\n $this->assertEquals($this->getRuleContent($name), file_get_contents($file));\n }\n }",
"public function testMultiple()\n {\n $this->assertCommand('{\"echo\":true,\"message\":\"echo test\",\"type\":\"3\"}', 'options --echo --message=\"echo test\" --type=3');\n }",
"public function testConsoleCommandWithTypes(string $type): void\n {\n $name = 'Test'.(ucfirst($type)).'Observer';\n $modelName = 'ModelForObserver';\n\n $this->artisan('make:observer', [\n 'name' => $name,\n '--container' => $this->containerName,\n '--'.$type => $type === 'model' ? $modelName : true\n ])\n ->expectsOutputToContain('Observer ['.$this->portoPath.'/Containers/'.$this->containerName.'/Observers/'.$name.'.php] created successfully.')\n ->assertSuccessful();\n\n $file = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Observers/'.$name.'.php';\n\n $this->assertFileExists($file);\n\n if($type === 'model'){\n $this->assertEquals($this->getObserverModelContent($name, $modelName), file_get_contents($file));\n } else {\n $this->assertEquals($this->getObserverContent($name), file_get_contents($file));\n }\n }",
"public function testImplementsCommand()\n {\n $this->assertInstanceOf(\\Illuminate\\Console\\Command::class, $this->connectTwitterStreamCommand);\n }",
"public function testConsoleCommandWithTypes(string $type): void\n {\n $name = 'Test'.(ucfirst($type)).'Resource';\n\n $typeName = $type === 'collection' ? 'Resource collection' : 'Resource';\n\n $this->artisan('make:resource', [\n 'name' => $name,\n '--container' => $this->containerName,\n '--'.$type => true\n ])\n ->expectsOutputToContain($typeName.' ['.$this->portoPath.'/Containers/'.$this->containerName.'/UI/API/Transformers/'.$name.'.php] created successfully.')\n ->assertSuccessful();\n\n $file = base_path($this->portoPath).'/Containers/'.$this->containerName.'/UI/API/Transformers/'.$name.'.php';\n\n $this->assertFileExists($file);\n\n if($type === 'collection'){\n $this->assertEquals($this->getResourceCollectionContent($name), file_get_contents($file));\n } else {\n $this->assertEquals($this->getResourceContent($name), file_get_contents($file));\n }\n }",
"public function testConsoleCommandWithTypes(string $type): void\n {\n $name = 'Test'.(ucfirst($type)).'Translation';\n\n $this->artisan('make:translation', [\n 'name' => $name,\n '--'.$type => 'en'\n ])\n ->expectsOutputToContain('Translation ['.$this->portoPath.'/Ship/Translations/en/'.$name.'.php] created successfully.')\n ->assertSuccessful();\n\n $file = base_path($this->portoPath).'/Ship/Translations/en/'.$name.'.php';\n\n $this->assertFileExists($file);\n $this->assertEquals($this->getTranslationContent(), file_get_contents($file));\n }",
"public function testConsoleCommandWithTypes(string $type): void\n {\n $name = 'Test'.(ucfirst($type)).'Provider';\n\n $this->artisan('make:provider', [\n 'name' => $name,\n '--container' => $this->containerName,\n '--'.$type => true\n ])\n ->expectsOutputToContain('Provider ['.$this->portoPath.'/Containers/'.$this->containerName.'/Providers/'.$name.'.php] created successfully.')\n ->assertSuccessful();\n\n $file = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Providers/'.$name.'.php';\n\n $this->assertFileExists($file);\n $this->assertEquals($this->getProviderContent($name, 'Containers\\\\'.$this->containerName.'\\Providers'), file_get_contents($file));\n }",
"public function testConsoleCommandWithTypes(string $type): void\n {\n $name = 'Test2'.(ucfirst($type)).'Component';\n\n if($type === 'view'){\n $output = 'Component created successfully.';\n } else {\n $output = 'Component ['.$this->portoPath.'/Containers/'.$this->containerName.'/Data/Views/Components/'.$name.'.php] created successfully.';\n }\n\n $this->artisan('make:component', [\n 'name' => $name,\n '--container' => $this->containerName,\n '--'.$type => true\n ])\n ->expectsOutputToContain($output)\n ->assertSuccessful();\n\n $file = base_path($this->portoPath).'/Containers/'.$this->containerName.'/Data/Views/Components/'.$name.'.php';\n\n if($type === 'force'){\n $fileView = base_path($this->portoPath).'/Containers/'.$this->containerName.'/UI/WEB/Views/components/test2-force-component.blade.php';\n\n $this->assertFileExists($file);\n $this->assertFileExists($fileView);\n $this->assertEquals($this->getComponentContent($name, 'components.test2-force-component'), file_get_contents($file));\n }\n\n if($type === 'inline'){\n $this->assertFileExists($file);\n }\n\n if($type === 'view'){\n $fileView = base_path($this->portoPath).'/Containers/'.$this->containerName.'/UI/WEB/Views/components/test2-view-component.blade.php';\n $this->assertFileExists($fileView);\n }\n }",
"public function testGettingCommands() \n {\n $commands = afStudioConsole::getInstance()->getCommands();\n $this->assertTrue(is_array($commands), 'getCommands should return array');\n }",
"public function testCommandIsValid()\n {\n $this->assertInstanceOf('doq\\Command\\DestroyCommand', $this->app->get(self::COMMAND_NAME) );\n }",
"public function testExecuteFilterTypeInvalid()\n {\n $command = $this->getApplication()->find(FilesCommand::NAME);\n $commandTester = new CommandTester($command);\n $this->setExpectedException('InvalidArgumentException');\n $result = $commandTester->execute(array(\n 'command' => FilesCommand::NAME,\n '--' . FilesCommand::OPTION_FILTER_TYPE => 'foobar'\n ));\n $this->assertEquals(0, $result);\n $this->assertContains('File Name', $commandTester->getDisplay());\n $this->assertNotRegExp('/PATCH_SUPEE/', $commandTester->getDisplay());\n }",
"public function testExecuteFilterType()\n {\n $command = $this->getApplication()->find(FilesCommand::NAME);\n $commandTester = new CommandTester($command);\n $result = $commandTester->execute(array(\n 'command' => FilesCommand::NAME,\n '--' . FilesCommand::OPTION_FILTER_TYPE => 'ce-full'\n ));\n $this->assertEquals(0, $result);\n $this->assertContains('File Name', $commandTester->getDisplay());\n $this->assertNotRegExp('/PATCH_SUPEE/', $commandTester->getDisplay());\n }",
"public function testCommands(): void\n\t{\n\t\t$this->artisan('lychee:decode_GPS_locations')\n\t\t\t->expectsOutput('No photos or videos require processing.')\n\t\t\t->assertExitCode(0);\n\n\t\t$this->artisan('lychee:diagnostics')\n\t\t\t->assertExitCode(0);\n\n\t\t$this->artisan('lychee:exif_lens')\n\t\t\t->expectsOutput('No pictures requires EXIF updates.')\n\t\t\t->assertExitCode(-1);\n\t}",
"#[@test]\n public function getArgumentTypeForObject() {\n $this->args->addArgument('obj', XPClass::forName('lang.Object'));\n \n $this->assertEquals(XPClass::forName('lang.Object'), $this->args->getArgumentType('obj'));\n }",
"public function testRunCommandInput()\n {\n $this->runCommand(TestSumCommand::class, [], [2, 3]);\n $this->assertContainerContains(['sum' => 5]);\n }",
"function testGetSetCommand()\n {\n $this->command_manager->setCommand('my_command', MyTestCommand::class);\n $command = $this->command_manager->getCommand('my_command');\n $this->assertInstanceOf(Command::class, $command);\n }",
"private static function _checkType($arg, $type)\n {\n if ($type == 's') {\n Console_GetoptLong::_debug(\" Checking $arg is a string - duh\\n\");\n // Everything's a string\n return true;\n } else if ($type == 'i') {\n Console_GetoptLong::_debug(\" Checking $arg is an integer\\n\");\n return (is_numeric($arg) && floor($arg) == $arg);\n } else if ($type == 'f') {\n Console_GetoptLong::_debug(\" Checking $arg is a float\\n\");\n return is_numeric($arg);\n } else {\n // This is actually handled in the regexp now.\n print(\"Warning: unknown type check '$type'.\\n\");\n }\n }",
"public function testCommandsUsage()\n {\n $cli = $this->getCommandCli();\n\n $this->expectException(\\Exception::class);\n $cli->parse([\"nit.php\", \"--help\"], false);\n }",
"private function getTypeArgument(): string\n {\n $type = $this->option('type');\n\n if (is_null($type)) {\n $type = $this->ask('type');\n }\n\n return $type;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This function sets the lib string.
|
function setLib($name){
$this->lib = $name;
}
|
[
"function setString($name, $value) {}",
"public static function setLibrary($library) {}",
"public function setNewString($string)\n {\n $this->_new_string = $string;\n }",
"public function setString($string_data) {\n $this->string = $string_data;\n }",
"function setLibjswww($libjswww) {\n\n\tif (substr($libjswww, -1) != \"/\") {\n\n\t\t$libjswww .= \"/\";\n\n\t}\n\n\t$this->libjswww = $libjswww;\n\n}",
"public function set($string, $toString);",
"function SetNullString($str,$varname=\"\") {\n $this->NULL_STRING[$varname]=$str;\n }",
"public function resetString() {\n $this->str = $this->stringSaver->getString();\n }",
"public static function setMetaAsStr($str) {\n self::$metaStr.= $str;\n }",
"public function setString($string)\n\t{\n\t\t$this->string = (string)$string;\n\t}",
"protected function _setStrings() {\n\t\t\t$this->_fieldsString = '';\n\t\t\t$this->_valuesString = '';\n\t\t\t$this->_updateString = '';\n\t\t\t$fields = $this->_descriptionManager->getTableDescription();\n\t\t\tforeach($fields as $field => $type) {\n\t\t\t\t$this->_fieldsString .= \"$field, \";\n\t\t\t\t$this->_valuesString .= \":$field, \";\n\t\t\t\t$this->_updateString .= \"$field = :$field, \"; \n\t\t\t}\n\t\t\t$this->_fieldsString = rtrim($this->_fieldsString, ', ');\n\t\t\t$this->_valuesString = rtrim($this->_valuesString, ', ');\n\t\t\t$this->_updateString = rtrim($this->_updateString, ', ');\n\t\t}",
"public function setCommandString()\n {\n $this->command_string = '\"' .\n $this->hg->executable . '\" ' .\n $this->command . ' ' .\n rtrim($this->formatOptions($this->getOptions()));\n }",
"public function setString($identifier, $value);",
"function set_result_str ($str)\r\n {\r\n $this->result_str = $str;\r\n }",
"protected function getStringReplace()\n {\n $this->resource->setPath(str_replace('ecomm', 'test_path', $this->resource->getPath()));\n }",
"function setOldStringHead($name)\n {\n $this->_settings->old_str_head = $name;\n }",
"protected function set_string($string) {\r\n $this->string=$string;\r\n $this->tokenstream = null;\r\n $this->syntaxtree = null;\r\n $this->descriptions = null;\r\n }",
"public function setString($string) {\n $string = $this->escapeHtml($string);\n\n if ($this->_string !== $string) {\n $this->_parsed = '';\n $this->_stripped = '';\n $this->_string = $string;\n }\n }",
"private function rebuildString(): void\n {\n $path = $this->isAbsolute() ? '/' : '';\n $path .= implode('/', $this->getElements());\n $path .= $this->isDirectory() ? '/' : '';\n if ('//' === $path) {\n $path = '/';\n }\n\n $this->pathString = $path;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
loadDbParams carga las credenciales de la db desde el archivo ../utils/dbconfig
|
private function loadDbParams(){
$fileDir = $_SERVER['DOCUMENT_ROOT']."/api_v2/utils/dbconfig";
$jsonData = file_get_contents($fileDir);
return json_decode($jsonData, true);
}
|
[
"protected function loadDbParameters()\n\t{\n\t\t$db = $this->getDbConnection();\n\n\t\t$this->ensureTable();\n\n\t\t$where = ($this->_autoLoadField ? \" WHERE {$this->_autoLoadField}={$this->_autoLoadValue}\" : '');\n\t\t$cmd = $db->createCommand(\n\t\t\t\"SELECT {$this->_keyField} as keyField, {$this->_valueField} as valueField FROM {$this->_tableName}{$where}\"\n\t\t);\n\t\t$results = $cmd->query();\n\n\t\t$appParameters = $this->getApplication()->getParameters();\n\t\t$serializer = $this->getSerializer();\n\t\tforeach ($results->readAll() as $row) {\n\t\t\t$value = $row['valueField'];\n\t\t\tif ($serializer == self::SERIALIZE_PHP) {\n\t\t\t\tif (($avalue = @unserialize($value)) !== false) {\n\t\t\t\t\t$value = $avalue;\n\t\t\t\t}\n\t\t\t} elseif ($serializer == self::SERIALIZE_JSON) {\n\t\t\t\tif (($avalue = json_decode($value, true)) !== null) {\n\t\t\t\t\t$value = $avalue;\n\t\t\t\t}\n\t\t\t} elseif ($serializer) {\n\t\t\t\tif (($avalue = call_user_func($serializer, $value, false)) !== null) {\n\t\t\t\t\t$value = $avalue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$appParameters[$row['keyField']] = $value;\n\t\t}\n\t}",
"private function setDbParams() {\n $config_name = self::$dbConfig;\n if(!isset(database::$$config_name)) {\n throw new exceptions\\MissingDatabaseParamsException();\n }\n self::$dbParams = database::$$config_name;\n }",
"private function loadDatabaseParametersIfNeed():void\n {\n if (!$this->databaseParametersLoaded && $this->isDatabaseRequired()) {\n //ensure we have the database parameters\n $this->databaseNameValidation();\n $this->databaseHostValidation();\n $this->databasePasswordValidation();\n $this->databaseUserValidation();\n $this->databasePrefixValidation();\n $this->databaseParametersLoaded = true;\n }\n }",
"private function databaseCredentialsDefine()\n {\n if (!self::$config['database']) {\n self::$config['database'] = [];\n }\n self::$config['database']['user'] = self::$args['db_user'] ?? (self::$config['database']['user'] ?? 'root');\n self::$config['database']['password'] = self::$args['db_password'] ?? (self::$config['database']['password'] ?? '');\n self::$config['database']['host'] = self::$args['db_host'] ?? (self::$config['database']['host'] ?? 'localhost');\n self::$config['database']['name'] = self::$args['db_name'] ?? (self::$config['database']['name'] ?? 'wordpress');\n self::$config['database']['source'] = self::$args['db_source'] ?? (self::$config['database']['source'] ?? null);\n }",
"function read_db_config() {\n\t\t$file = 'db.ini';\n\t\tif($data = parse_ini_file($file)) {\n\t\t\tdefine(\"DB_USER\", $data['db_user']);\n\t\t\tdefine(\"DB\", $data['db']);\n\t\t\tdefine(\"DB_PW\", $data['db_pw']);\n\t\t} else {\n\t\t\techo \"db config error\";\n\t\t}\n\t}",
"private function get_credentials(){\n $cnf = parse_ini_file(\"/data/project/orwell01/replica.my.cnf\");\n $this->dbuser = $cnf[\"user\"];\n $this->dbpass = $cnf[\"password\"];\n }",
"public function loadDBProperties()\n\t{\n\t\t$xml = simplexml_load_file(self::DB_PROPERTIES);\n\t\t$this->hostname = (string)$xml->hostname;\n\t\t$this->username = (string)$xml->username;\n\t\t$this->password = (string)$xml->password;\n\t\t$this->database = (string)$xml->database;\n\t}",
"private static function getDbCredentials(){\n\n $db = Yii::$app->getDb();\n\n $dbName = self::getDsnAttribute('dbname', $db->dsn);\n $dbPort = self::getDsnAttribute('port', $db->dsn);\n $dbUser = $db->username;\n $dbPass = $db->password;\n\n return compact('dbName', 'dbUser', 'dbPass', 'dbPort');\n }",
"private static function loadConfig(){\n\t\t$config = require PRAIRIE_PATH . \"/config/database.php\";\n\t\tself::$config = $config;\n\t}",
"public function setDbConfig(){\n\n\t\t$this->config = Config::read(\"databases\");\n\t}",
"protected function setDBParameters()\n {\n if (false === $this->tableExist('parameter')) {\n return;\n }\n\n //Get allowed parameters\n $configs = $this->getExtensionConfig('cocorico_config');\n $mergedConfig = array();\n foreach ($configs as $config) {\n $mergedConfig = array_merge($mergedConfig, $config);\n }\n $mergedConfig = $this->getParameterBag()->resolveValue($mergedConfig);\n $allowedParameters = $mergedConfig['parameters_allowed'];\n $allowedParameters = array_keys($allowedParameters);\n\n $query = $this->connection->query($this->createParametersQuery());\n $parameters = $query->fetchAll();\n foreach ($parameters as $i => $parameter) {\n $name = $parameter['name'];\n $value = $parameter['value'];\n if (in_array($name, $allowedParameters) && $this->hasParameter($name) && $value) {\n $this->setParameter($name, $value);\n }\n }\n }",
"public static function loadDatabaseConnection()\n\t{\n\t\t$args = func_get_args();\n\t\t$method = array_shift($args);\n\t\t$params = self::__callStatic($method, $args);\n\n\t\tif (!isset($params['host']) || !isset($params['user']) || !isset($params['pass']) || !isset($params['name'])) {\n\t\t\tthrow new pwebframework::$configExceptionClass(\"Configuration error - database parameters not correctly defined for $method\");\n\t\t}\n\n\t\t$dbType = self::$PDOType;\n\t\treturn new PDO(\"{$dbType}:dbname={$params['name']};host={$params['host']}\" . (isset($params['port']) ? \";port={$params['port']}\" : ''), $params['user'], $params['pass']);\n\t}",
"function load_db() {\n\t$config = get_config();\n\n\tif ( ! $config['ludicrousdb'] ) {\n\t\treturn;\n\t}\n\n\tif ( ! defined( 'DB_CONFIG_FILE' ) ) {\n\t\tdefine( 'DB_CONFIG_FILE', __DIR__ . '/dropins/db-config.php' );\n\t}\n\n\trequire __DIR__ . '/dropins/ludicrousdb/ludicrousdb.php';\n}",
"protected function loadDb()\n {\n $db_url = getenv(\"DATABASE_URL\");\n if($db_url === false) {\n // $db_url = \"postgres://nouser:nopass@nohost:5432/nodb\";\n // its okay if no database url is provided\n // then just set db to null\n $this->db = null;\n } else{\n $this->db = new Database($db_url);\n }\n }",
"private function initDb () {\r\n\t\t$this->dbLayer = new dbLayer ($this->conf->get ('addr', 'db'), \r\n\t\t\t\t\t\t\t\t\t\t$this->conf->get ('login', 'db'), \r\n\t\t\t\t\t\t\t\t\t\t$this->conf->get ('password', 'db'), \r\n\t\t\t\t\t\t\t\t\t\t$this->conf->get ('base', 'db'));\r\n\t}",
"public function db_load(){\r\n\t\t// get cached site config/info\r\n\t\t$site_config = $this->reg->db->Execute('SELECT \tconfig_name, config_value\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM config');\r\n\r\n\t\t// set site config\r\n\t\twhile($row = $site_config->fetchRow()){\r\n // prevent setting a blank value if the config option already exists // prevents overwriting defaults\r\n if(!$this->is_set($row['config_name']) || $row['config_value'] != '')\r\n\t\t\t $this->set($row['config_name'], $row['config_value']);\r\n\t\t}\r\n\t}",
"function pp_db_auth_activate()\n{\n add_option('pp_db_type', \"MySQL\", \"External database type\");\n add_option('pp_db_mdb2_path', \"\", \"Path to MDB2 (if non-standard)\");\n add_option('pp_host', \"\", \"External database hostname\");\n add_option('pp_db_port', \"\", \"Database port (if non-standard)\");\n add_option('pp_db', \"\", \"External database name\");\n add_option('pp_db_user', \"\", \"External database username\");\n add_option('pp_db_pw', \"\", \"External database password\");\n add_option('pp_db_table', \"\", \"External database table for authentication\");\n add_option('pp_db_namefield', \"\", \"External database field for username\");\n add_option('pp_db_pwfield', \"\", \"External database field for password\");\n add_option('pp_db_first_name', \"\");\n add_option('pp_db_last_name', \"\");\n add_option('pp_db_user_url', \"\");\n add_option('pp_db_user_email', \"\");\n add_option('pp_db_description', \"\");\n add_option('pp_db_aim', \"\");\n add_option('pp_db_yim', \"\");\n add_option('pp_db_jabber', \"\");\n add_option('pp_db_enc', \"\", \"Type of encoding for external db (default SHA1? or MD5?)\");\n add_option('pp_db_other_enc', \"\");\n add_option('pp_db_error_msg', \"\", \"Custom login message\");\n add_option('pp_db_role_bool', '');\n add_option('pp_db_role', '');\n add_option('pp_db_role_value', '');\n add_option('pp_db_site_url', '');\n}",
"private function loadConfig(){\n $DB = DB::pass();\n $conf = $DB->loadConfig();\n if ( count($conf) > 0 ){\n foreach($conf as $c){\n $this->config->set($c['cluster'] . \".\" . $c['name'],$c['value']);\n }\n } else {\n throw new SystemException(\"No database configuration\");\n }\n }",
"private static function getCredentials() {\n $JSONConfig = file_get_contents(CONFIG_FILE);\n $config = json_decode($JSONConfig, /* assoc */ true);\n\n return $config['db'];\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the current command delete status.
|
public function getDeleteStatus()
{
return $this->_deleteCurrentCommand;
}
|
[
"public function getDeleteUserStatus()\n {\n return $this->delete_user_status;\n }",
"public function getDelThreadStatus ()\n {\n return $this->del_thread_status;\n }",
"public function getDelete()\n {\n return $this->_delete;\n }",
"public function getDelete()\n\t{\n\t\treturn $this->delete; \n\n\t}",
"public function getDeleteFlag()\r\n {\r\n return $this->deleteFlag;\r\n }",
"public function deleteCount()\n {\n return $this->get('cmd-delete');\n }",
"public function getIsDelete()\n {\n return $this->isDelete;\n }",
"public function getDelete() : bool\n {\n return $this->getProperty()->delete;\n }",
"public function getIsDeleted()\n {\n\n return $this->is_deleted;\n\n }",
"public function getIsDeleted()\n {\n return $this->is_deleted;\n }",
"public function isDeleted(): bool\n {\n return (string) $this->status === 'deleted';\n }",
"public function getDeletedFlag() : bool {\n return $this->deletedFlag;\n }",
"public function getDelete(): string\n {\n return $this->delete;\n }",
"function GetIsDelete()\n\t{\n\t\treturn $this->m_isDelete;\n\t}",
"public function isDeleted()\n {\n if ( $this->status == 0 ) {\n return true;\n } elseif ( $this->status == 1 ) {\n return false;\n }\n return null;\n }",
"public function get_cmdb_status()\n {\n return $this->m_cmdb_status;\n }",
"public function getDeletedCount() {\n return $this->deleted;\n }",
"function delete()\n\t{\n\t\tif ($this->status != admin_cmd::scheduled) return false;\n\n\t\t$this->status = admin_cmd::deleted;\n\n\t\treturn $this->save();\n\t}",
"public function getDelFlg()\n {\n return $this->del_flg;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Function to run after finding all devices to perform additional tasks. (Saves modules needing to rescan every time.)
|
function afterProbeAction($devices) { }
|
[
"private function handleDevices(){\n\t\t$devices = $this->object->devices; // все оборудование на объекте\n\n\t\tforeach($devices as $device){ // Проходимся по всему оборудованию\n\t\t\t$this->device = $device;\n\t\t\tforeach($device->reglaments as $reglament){ // Получаем все регламенты на оборудование\n\t\t\t\t$this->handleReglament($reglament);\n\t\t\t}\n\t\t\t$this->device = null;\n\t\t}\n\t}",
"protected function _scan_devices() {\n $if = $this->db->pq(\"SELECT value FROM options WHERE name='scan_interface'\");\n if (!sizeof($if)) $this->error('No scan interface defined');\n $if = $if[0]['value'];\n\n $res = [];\n $devices = [];\n exec($this->nmcli.' dev wifi rescan ifname '.escapeshellarg($if).' 2>&1');\n exec($this->nmcli.' dev wifi list ifname '.escapeshellarg($if).' 2>&1', $res);\n\n array_shift($res);\n foreach ($res as $r) {\n $parts = preg_split('/\\s+/', $r);\n if (substr($parts[1], 0, strlen($this->baseid)) === $this->baseid) {\n array_push($devices, [\n 'ssid' => $parts[1],\n 'chan' => $parts[3],\n 'signal' => $parts[6],\n ]);\n }\n }\n\n $this->output($devices);\n }",
"private static function findTasks()\n {\n if (self::$init)\n return;\n\n $modules = Module\\Manager::getModules();\n foreach ($modules as $mod)\n $mod->registerTasks();\n self::$init = true;\n }",
"function CheckAllDevices() {\r\n foreach ($this->DATASET as $DEVICE) {\r\n $this->OutputDevice($DEVICE);\r\n }\r\n }",
"function scan_network() {\n\t// Print a little message.\n\tprint \"Starting a new network scan...\\n\";\n\n\t// Get hosts.\n\t$hosts = get_hosts();\n\tprint \"\\n\";\n\n\t// Import them into the system.\n\tforeach ($hosts as $host) {\n\t\tadd_device_entry($host);\n\t}\n}",
"function __rescan() {\n\t\trequire_once $this->rootdir.\"/plugins/vmware-esx/class/vmware-esx-discovery.class.php\";\n\t\t$vmware_esx_discovery = new vmware_esx_discovery();\n\t\t$command = $this->basedir.\"/plugins/vmware-esx/bin/htvcenter-vmware-esx-autodiscovery\";\n\t\t$command .= ' --htvcenter-ui-user '.$this->user->name;\n\t\t$command .= ' --htvcenter-cmd-mode background';\n\t\t$file = $this->rootdir.'/plugins/vmware-esx/vmware-esx-stat/autodiscovery_finished';\n\t\tif(file_exists($file)) {\n\t\t\tunlink($file);\n\t\t}\n\t\t$htvcenter_server = new htvcenter_server();\n\t\t$htvcenter_server->send_command($command, NULL, true);\n\t\twhile (!file_exists($file)) // check if the data file has been modified\n\t\t{\n\t\t usleep(10000); // sleep 10ms to unload the CPU\n\t\t clearstatcache();\n\t\t}\n\t\t// read discovery file\n\t\tif(file_exists($file)) {\n\t\t\t$lines = explode(\"\\n\", file_get_contents($file));\n\t\t\tif(count($lines) >= 1) {\n\t\t\t\tforeach($lines as $line) {\n\t\t\t\t\tif($line !== '') {\n\t\t\t\t\t\t$line = explode('@', $line);\n\t\t\t\t\t\t$esx_ip = $line[0];\n\t\t\t\t\t\t$esx_mac = strtolower($line[1]);\n\t\t\t\t\t\t// check if discovered already\n\t\t\t\t\t\tif ((strlen($esx_mac)) && (strlen($esx_ip))) {\n\t\t\t\t\t\t\tif (($vmware_esx_discovery->mac_discoverd_already($esx_mac)) && ($vmware_esx_discovery->ip_discoverd_already($esx_ip))) {\n\t\t\t\t\t\t\t\t$esx_comment = \"Added by auto-discovery\";\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_mac'] = $esx_mac;\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_ip'] = $esx_ip;\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_hostname'] = $esx_ip;\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_user'] = \"root\";\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_password'] = \"\";\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_comment'] = $esx_comment;\n\t\t\t\t\t\t\t\t$vmware_esx_discovery_fields['vmw_esx_ad_is_integrated '] = 0;\n\t\t\t\t\t\t\t\t$vmware_esx_discovery->add($vmware_esx_discovery_fields);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tunset($esx_mac);\n\t\t\t\t\t\t\tunset($esx_ip);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tunlink($file);\n\t\treturn true;\n\t}",
"function __rescan() {\n\t\trequire_once $this->rootdir.\"/plugins/hyperv/class/hyperv-discovery.class.php\";\n\t\t$hyperv_discovery = new hyperv_discovery();\n\t\t$command = $this->basedir.\"/plugins/hyperv/bin/htvcenter-hyperv-autodiscovery discover\";\n\t\t$command .= ' --htvcenter-ui-user '.$this->user->name;\n\t\t$command .= ' --htvcenter-cmd-mode fork';\n\t\t$file = $this->rootdir.'/plugins/hyperv/hyperv-stat/autodiscovery_finished';\n\t\tif(file_exists($file)) {\n\t\t\tunlink($file);\n\t\t}\n\t\t$htvcenter_server = new htvcenter_server();\n\t\t$htvcenter_server->send_command($command, NULL, true);\n\t\twhile (!file_exists($file)) // check if the data file has been modified\n\t\t{\n\t\t usleep(10000); // sleep 10ms to unload the CPU\n\t\t clearstatcache();\n\t\t}\n\t\t// read discovery file\n\t\tif(file_exists($file)) {\n\t\t\t$lines = explode(\"\\n\", file_get_contents($file));\n\t\t\tif(count($lines) >= 1) {\n\t\t\t\tforeach($lines as $line) {\n\t\t\t\t\tif($line !== '') {\n\t\t\t\t\t\t$line = explode('@', $line);\n\t\t\t\t\t\t$hyperv_ip = $line[0];\n\t\t\t\t\t\t$hyperv_mac = strtolower($line[1]);\n\t\t\t\t\t\t// check if discovered already\n\t\t\t\t\t\tif ((strlen($hyperv_mac)) && (strlen($hyperv_ip))) {\n\t\t\t\t\t\t\tif (($hyperv_discovery->mac_discoverd_already($hyperv_mac)) && ($hyperv_discovery->ip_discoverd_already($hyperv_ip))) {\n\t\t\t\t\t\t\t\t$hyperv_comment = \"Added by auto-discovery\";\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_mac'] = $hyperv_mac;\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_ip'] = $hyperv_ip;\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_hostname'] = $hyperv_ip;\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_user'] = \"root\";\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_password'] = \"\";\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_comment'] = $hyperv_comment;\n\t\t\t\t\t\t\t\t$hyperv_discovery_fields['hyperv_ad_is_integrated '] = 0;\n\t\t\t\t\t\t\t\t$hyperv_discovery->add($hyperv_discovery_fields);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tunset($hyperv_mac);\n\t\t\t\t\t\t\tunset($hyperv_ip);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(file_exists($file)) {\n\t\t\tunlink($file);\n\t\t}\n\t\treturn true;\n\t}",
"public function afterModuleRun();",
"function device_update_get()\n {\n // Only the TP link smart plugs support broadcast scanning so far\n $deviceParams = array('id' => $this->get('id'), 'model' => 'HS110');\n $this->load->library('drivers/hs1xx', $deviceParams);\n\n print_r($this->hs1xx->updateDevices());\n }",
"public static function update_device(){\n\t\t\n\t}",
"protected function _execute()\n {\n $possiblePerformanceKillers = $this->_scanForPerformanceLeaks($this->_extensionPath);\n\n if (0 < sizeof($possiblePerformanceKillers)) {\n foreach ($possiblePerformanceKillers as $possiblePerformanceKiller) {\n Logger::setResultValue($this->_extensionPath, $this->_pluginName, $possiblePerformanceKiller, count($possiblePerformanceKillers));\n \n IssueHandler::addIssue(new Issue(\n array( \"extension\" => $this->_extensionPath ,\"checkname\" => $this->_pluginName,\n \"type\" => 'performance_leak',\n \"comment\" => $possiblePerformanceKiller . ' (' . \n count($possiblePerformanceKillers) . 'times)',\n \"failed\" => true)));\n }\n }\n }",
"private function runAllTaggedServices()\n {\n /** @var OnCreateNewDeviceAction $service */\n foreach ($this->handlersServices as $service) {\n if ($service instanceof OnCreateNewDeviceAction) {\n $service->setDevice($this->device);\n $service->action();\n }\n }\n }",
"public function bootAll()\n {\n if ($this->booted) {\n return;\n }\n\n foreach ($this->plugins as $pluginId => $plugin) {\n $this->bootPlugin($plugin, $pluginId);\n }\n\n $this->booted = true;\n }",
"public function scanBluetooth()\n {\n $this->detected = array();\n foreach ($this->bluetooth_devices as $bt) {\n $cmd = 'hcitool name ' . $bt;\n $this->process->setCommandLine($cmd);\n $this->process->run();\n if (!$this->process->isSuccessful()) {\n throw new \\RuntimeException($this->process->getErrorOutput());\n }\n $output = $this->process->getOutput();\n if (!empty($output)) {\n $this->detected[] = $output;\n }\n }\n }",
"final private function _scan_scsi()\n {\n clearos_profile(__METHOD__, __LINE__);\n\n $devices = Array();\n\n try {\n // Find USB devices that match: %d-%d\n $entries = $this->_scan_dir(self::USB_DEVICES, '/^\\d-\\d$/');\n\n // Walk through the expected USB -> SCSI /sys paths.\n foreach ($entries as $entry) {\n $path = self::USB_DEVICES . \"/$entry\";\n if (($devid = $this->_scan_dir($path, \"/^$entry:\\d\\.\\d$/\")) === FALSE) continue;\n if (count($devid) != 1) continue;\n\n // Might need this product\n //if (!($fh = fopen(\"$path/product\", 'r'))) continue;\n //$device['product'] = chop(fgets($fh, 4096));\n //fclose($fh);\n\n $path .= '/' . $devid[0];\n if (($host = $this->_scan_dir($path, '/^host\\d+$/')) === FALSE) continue;\n if (count($host) != 1) continue;\n $path .= '/' . $host[0];\n if (($target = $this->_scan_dir($path, '/^target\\d+:\\d:\\d$/')) === FALSE) continue;\n if (count($target) != 1) continue;\n $path .= '/' . $target[0];\n if (($lun = $this->_scan_dir($path, '/^\\d+:\\d:\\d:\\d$/')) === FALSE) continue;\n if (count($lun) != 1) continue;\n $path .= '/' . $lun[0];\n if (($dev = $this->_scan_dir(\"$path/block\", '/^dev$/')) === FALSE) continue;\n if (count($dev) != 1) continue;\n\n // Validate USB mass-storage device\n if (!($fh = fopen(\"$path/vendor\", 'r'))) continue;\n $device['vendor'] = chop(fgets($fh, 4096));\n fclose($fh);\n if (!($fh = fopen(\"$path/model\", 'r'))) continue;\n $device['model'] = chop(fgets($fh, 4096));\n fclose($fh);\n if (!($fh = fopen(\"$path/block/dev\", 'r'))) continue;\n $device['nodes'] = chop(fgets($fh, 4096));\n fclose($fh);\n $device['path'] = $path;\n $device['bus'] = 'usb';\n\n // Valid device found (almost, continues below)...\n $devices[] = $device;\n }\n\n // Find SCSI devices that match: %d:%d:%d:%d\n $entries = $this->_scan_dir(self::SCSI_DEVICES, '/^\\d:\\d:\\d:\\d$/');\n\n // Scan all SCSI devices.\n if ($entries !== FALSE) {\n foreach ($entries as $entry) {\n $block = 'block';\n $path = self::SCSI_DEVICES . \"/$entry\";\n if (($dev = $this->_scan_dir(\"$path/block\", '/^dev$/')) === FALSE) {\n if (($block_devices = $this->_scan_dir(\"$path\", '/^block:.*$/')) === FALSE) continue;\n $block = $block_devices[0];\n if (($dev = $this->_scan_dir(\"$path/$block\", '/^dev$/')) === FALSE) continue;\n }\n if (count($dev) != 1) continue;\n\n // Validate SCSI storage device\n if (!($fh = fopen(\"$path/vendor\", 'r'))) continue;\n $device['vendor'] = chop(fgets($fh, 4096));\n fclose($fh);\n if (!($fh = fopen(\"$path/model\", 'r'))) continue;\n $device['model'] = chop(fgets($fh, 4096));\n //$device['product'] = $device['model'];\n fclose($fh);\n if (!($fh = fopen(\"$path/$block/dev\", 'r'))) continue;\n $device['nodes'] = chop(fgets($fh, 4096));\n fclose($fh);\n $device['path'] = \"$path/$block\";\n $device['bus'] = 'scsi';\n\n // Valid device found (almost, continues below)...\n $unique = TRUE;\n foreach ($devices as $usb) {\n if ($usb['nodes'] != $device['nodes']) continue;\n $unique = FALSE;\n break;\n }\n\n if ($unique) $devices[] = $device;\n }\n }\n\n if (count($devices)) {\n // Create a hashed array of all device nodes that match: /dev/s*\n // XXX: This can be fairly expensive, takes a few seconds to run.\n if (!($ph = popen('stat -c 0x%t:0x%T:%n /dev/s*', 'r')))\n throw new Exception(\"Error running stat command\", CLEAROS_WARNING);\n\n $nodes = array();\n $major = '';\n $minor = '';\n \n while (!feof($ph)) {\n $buffer = chop(fgets($ph, 4096));\n if (sscanf($buffer, '%x:%x:', $major, $minor) != 2) continue;\n if ($major == 0) continue;\n $nodes[\"$major:$minor\"] = substr($buffer, strrpos($buffer, ':') + 1);\n }\n\n // Clean exit?\n if (pclose($ph) != 0)\n throw new Exception(\"Error running stat command\", CLEAROS_WARNING);\n\n // Hopefully we can now find the TRUE device name for each\n // storage device found above. Validation continues...\n foreach ($devices as $key => $device) {\n if (!isset($nodes[$device['nodes']])) {\n unset($devices[$key]);\n continue;\n }\n\n // Set the block device\n $devices[$key]['device'] = $nodes[$device['nodes']];\n\n // Here we are looking for detected partitions\n $partitions = $this->_scan_dir($device['path'], '/^' . basename($nodes[$device['nodes']]) . '\\d$/');\n\n if (($partitions !== FALSE) && count($partitions) > 0) {\n foreach($partitions as $partition)\n $devices[$key]['partition'][] = dirname($nodes[$device['nodes']]) . '/' . $partition;\n }\n\n unset($devices[$key]['path']);\n unset($devices[$key]['nodes']);\n }\n }\n } catch (Exception $e) {\n Logger::log_exception($e);\n }\n\n return $devices;\n }",
"public function process()\n {\n if (count($this->items) <= 100 && $this->force === false) {\n $this->consoleOutput->writeln(\n \"<info>ProductDisabler: Skipping because less then 100 products are imported, use force option to disable anyway</info>\"\n );\n return;\n }\n\n $identifiers = array_map(function ($identifier) {\n return (string) $identifier;\n }, array_keys($this->items));\n\n $this->appendNewItemsToDb($identifiers);\n $itemsToDisable = $this->getItemsToDisable($identifiers);\n\n $itemsToDisable = array_map(function ($identifier) {\n return [\n 'sku' => $identifier,\n 'product_online' => (string) 0,\n ];\n }, $itemsToDisable);\n\n $count = count($itemsToDisable);\n $this->consoleOutput->writeln(\"<info>ProductDisabler: Disabling {$count} products</info>\");\n $this->log->info(\"ProductDisabler: Disabling {$count} products\");\n\n $this->items += $itemsToDisable;\n }",
"public function afterRegistry()\n {\n $this->codeVersion = $this->loader->getVersions()->getBuild();\n foreach ($this->escort->getLoaderDirs() as $prefix => $dir) {\n $this->projectDirs[str_replace('\\\\', '\\\\\\\\', $prefix) . '_'] = $prefix;\n }\n }",
"private function analyzeAll()\n {\n $dataSourceIDs = $this->ci->ds->getAll(0, 0, true);\n foreach ($dataSourceIDs as $dsID) {\n $this->analyzeDS($dsID);\n }\n $this->log('Analyzed All spawned ' . sizeof($dataSourceIDs) . ' tasks');\n }",
"private function sync()\n {\n $arguments = sprintf('--env=%s', $this->container->get('kernel')->getEnvironment());\n\n $deviceQueue = [];\n $serviceDeviceQueue = [];\n $deviceProcesses = [];\n $serviceDeviceProcesses = [];\n $deviceRepository = $this->em->getRepository(Device::class);\n $serviceDeviceRepository = $this->em->getRepository(ServiceDevice::class);\n\n while (true) {\n $this->em->clear();\n $this->options->refresh();\n\n $this->syncDevices(\n $deviceQueue,\n $deviceProcesses,\n $deviceRepository,\n $arguments\n );\n\n $this->syncServiceDevices(\n $serviceDeviceQueue,\n $serviceDeviceProcesses,\n $serviceDeviceRepository,\n $arguments\n );\n\n // If there is a device to be synchronized make a pause. Sleep longer otherwise\n $sleep = $deviceQueue || $serviceDeviceQueue ? $this->pause : $this->sleep;\n $this->logger->info(sprintf('Sleep for %d seconds.', $sleep));\n sleep($sleep);\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Gets as reservationMethodCode This is used to indicate the method by which reservations are to be received. Refer to OpenTravel Code List Reservation Method Code (RMC).
|
public function getReservationMethodCode()
{
return $this->reservationMethodCode;
}
|
[
"public function setReservationMethodCode($reservationMethodCode)\n {\n $this->reservationMethodCode = $reservationMethodCode;\n return $this;\n }",
"public function getReservationCode()\n {\n return parent::getValue('reservation_code');\n }",
"static public function getCode()\n {\n return self::CARRIER_CODE;\n }",
"public function getPaymentMethodCode()\n {\n return $this->getData(self::PAYMENT_METHOD_CODE);\n }",
"public function getMethodCode()\n {\n return Boleto::CODE;\n }",
"public function getPaymentMethodIdCode() : string\n {\n return $this->paymentMethodIdCode;\n }",
"public function getTransmissionMethod();",
"protected function _getShortCode ()\n {\n $methods = array(\n 'paymill_creditcard' => 'cc',\n 'paymill_directdebit' => 'elv'\n );\n \n return $methods[$this->_code];\n }",
"public function getRouteCode()\n {\n return $this->routeCode;\n }",
"public function getVaultCode(): string\n {\n return $this->vaultPaymentMethod->getCode();\n }",
"public function getOriginalDeliveryMethodCode()\n {\n return $this->originalDeliveryMethodCode;\n }",
"function ncsulib_foundation_field__field_reservation_method__space($variables) {\n\t $output = '';\n\n\t // Create a button based on the method chosen\n\t $res_method = $variables['items'][0]['#markup'];\n\t $nid = $variables['element']['#object']->nid;\n\t $node = node_load($nid);\n\n\t switch ($res_method) {\n\t case 'By Room Reservation System':\n\t $room_res_url = field_get_items('node', $node, 'field_room_res_url');\n\t $output = '<a href=\"'.$room_res_url[0]['value'].'\" class=\"button tiny styled\">View Reservation Options</a>';\n\t break;\n\n\t case 'By Mediated Email Form':\n\t $request_form_url = field_get_items('node', $node, 'field_request_form_url');\n\t $form_url = field_view_value('node', $node, 'field_request_form_url', $request_form_url[0]);\n\t $output = '<a class=\"button tiny styled\" href=\"'. $form_url['#element']['url'] .'\">Request this room</a>';\n\t break;\n\n\t case 'Not Reservable':\n\t $output = '';\n\t break;\n\t default:\n\t $output = ' ';\n\t break;\n\t }\n\t return $output;\n\t}",
"function getPaymentMethod()\r\n {\r\n }",
"public function getVPaymentMethodId()\n {\n return $this->_vPaymentMethodId;\n }",
"public function getDocumentDistribMethodCode()\n {\n return $this->documentDistribMethodCode;\n }",
"public function getPaymentMethodId()\n {\n return $this->payment_method_id;\n }",
"public function getPaymentMethod()\n {\n return $this->_fields['PaymentMethod']['FieldValue'];\n }",
"public function getPaymentMethodId() : int\n {\n return $this->paymentMethodId;\n }",
"public function getMethodId()\n {\n return $this->getData('method_id');\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Prepare usesLimitCheck field parameters
|
protected function prepareFieldParamsUsesLimitCheck(array $data)
{
$model = $this->getModelObject();
if ($model && (0 < $model->getUsesLimit() || $model->getUsesLImitPerUser())) {
$data['isChecked'] = true;
}
return $data;
}
|
[
"public function checkLimit() {\n $this->setLimit($this->getInputAttr('limit'));\n $this->addData('class', array($this->getData('limit') ? 'form-item-limited' : 'form-item-unlimited'));\n }",
"public function getFieldLimits() {}",
"protected static function _prepareLimit( $limit )\r\n\t{\r\n\t\tif( is_int($limit) )\r\n\t\t{\r\n\t\t\treturn new Art_Model_Db_Limit($limit);\r\n\t\t}\r\n\t\telseif( is_a($limit,'Art_Model_Db_Limit') )\r\n\t\t{\r\n\t\t\treturn $limit;\r\n\t\t}\r\n\t\telseif( is_string($limit) )\r\n\t\t{\r\n\t\t\t$exlimit = explode(',',$limit);\r\n\t\t\tswitch( count($exlimit) )\r\n\t\t\t{\r\n\t\t\t\tcase 1:\r\n\t\t\t\t{\r\n\t\t\t\t\treturn new Art_Model_Db_Limit($limit);\r\n\t\t\t\t}\r\n\t\t\t\tcase 2:\r\n\t\t\t\t{\r\n\t\t\t\t\treturn new Art_Model_Db_Limit($exlimit[0],$exlimit[1]);\r\n\t\t\t\t}\r\n\t\t\t\tdefault:\r\n\t\t\t\t{\r\n\t\t\t\t\ttrigger_error('Invalid argument supplied for '.get_called_class().'->_prepareLimit()',E_USER_ERROR);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ttrigger_error('Invalid argument supplied for '.get_called_class().'->_prepareLimit()',E_USER_ERROR);\r\n\t\t}\r\n\t}",
"function tkno_customfield_limit_increase( $limit ) {\n $limit = 100;\n return $limit;\n}",
"protected function setOffsetAndLimit(){\r\n $parameters = $this->request->getQueryParams();\r\n $this->offset = !empty($parameters['offset']) ? (int)filter_var($parameters['offset'], FILTER_SANITIZE_NUMBER_INT) : 0;\r\n if((!empty($parameters['limit']) && (int)$parameters['limit'] <= DEFAULT_DB_LIMIT) ){\r\n $this->limit = (int)filter_var($parameters['limit'], FILTER_SANITIZE_NUMBER_INT);\r\n }else{\r\n $this->limit = DEFAULT_DB_LIMIT;\r\n }\r\n }",
"public static function LimitCheck($params){\n $failures = [];\n $accountLimits = self::GetSubscription();\n\n foreach($params as $param){\n \n if($accountLimits->max_assets === -1) {\n continue;\n }\n\n switch($param){\n \n case 'asset':\n if(self::AssetCount() >= $accountLimits->max_assets) array_push($failures, $param);\n break;\n \n case 'device':\n if(self::DeviceCount() >= $accountLimits->max_device) array_push($failures, $param);\n break;\n\n case 'geofence':\n if(self::GeofenceCount() >= $accountLimits->max_geofence) array_push($failures, $param);\n break;\n \n case 'geofenceaction':\n if(self::GeofenceActionCount() >= $accountLimits->max_geofence_actions) array_push($failures, $param);\n break;\n\n }\n }\n\n $message = implode(\", \", $failures);\n \n if(count($failures) > 0){\n throw new AccountLimitException(\"$message has exceeded subscription limit\");\n }\n }",
"public function setGroupLimit($value){}",
"private static function getLimit() {\n $limit = self::getQuery('limit');\n if (( $limit || $limit === '0' ) && ( !$limit || $limit > 20 || $limit < 1 )) {\n $error = array('Error' => 'Limit needs to be set to a number between 1 and 20');\n array_push(self::$errors, $error);\n } else if ($limit) {\n self::setLimit($limit);\n }\n }",
"private function setLimitAndOffset()\n {\n $this->offset = ($this->page - 1) * $this->config->limit;\n if ($this->config->limit == 0) {\n $this->config->limit = count(self::$needles);\n }\n }",
"public function beforeFilter() {\n // Enforces an absolute limit of 25\n if (isset($this->passedArgs['limit'])) {\n $this->passedArgs['limit'] = min(\n $this->paginationMaxLimit,\n $this->passedArgs['limit']\n );\n }\n }",
"function limitQueryItems($limit){\n $this->limit = $limit;\n }",
"protected function buildLimitClause()\r\n {\r\n return '1';\r\n }",
"protected function _setSqlLimit()\n\t{\n\t\tif ($this->_limitAmount) {\n\t\t\t$limit = ($this->_implicitLimit ? min($this->_implicitLimit, $this->_limitAmount) : $this->_limitAmount);\n\t\t} else {\n\t\t\t$limit = $this->_implicitLimit;\n\t\t}\n\t\t$this->_sql->setLimit($limit, $this->_limitOffset);\n\t}",
"protected function getLimit()\n { \n $this->options['limit'] = empty($_REQUEST['rows']) ? 10 : intval($_REQUEST['rows']); \n }",
"public function validatePaymentLimit() {\n $amount = $this->b_reading_type;\n $limit_check = ClientLimit::testLimit(Yii::app()->user->id, $amount);\n if($limit_check == false)\n $this->addError('amount', 'Transaction Declined: You\\'ve reached your Psychic Contact limit!');\n }",
"public function getLimit();",
"private function rewrite_limit_usage()\n {\n $_wpdb = new wpsqlitedb();\n $options = $_wpdb->get_results('PRAGMA compile_options');\n foreach ($options as $opt) {\n if (isset($opt->compile_option) && stripos($opt->compile_option, 'ENABLE_UPDATE_DELETE_LIMIT') !== false) {\n return;\n }\n }\n if (stripos($this->_query, '(select') === false) {\n $this->_query = preg_replace('/\\\\s*LIMIT\\\\s*[0-9]$/i', '', $this->_query);\n }\n }",
"function register_limit( $name, array $limits ) {\n\tLimit::register( $name, $limits );\n}",
"public function requestValidate()\n {\n $request = $this->api->request;\n\n $request->limit = (int) $request->limit ?: 50;\n if ($request->limit < 0 || $request->limit > 500) {\n $request->limit = 50;\n }\n\n $request->page = (int) $request->page ?: 1;\n if ($request->page < 0) {\n $request->page = 50;\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Handle the Position "deleted" event.
|
public function deleted(Position $position)
{
//
}
|
[
"protected function deletePosition()\n {\n if ($this->position != null) {\n if (self::getLastPositionByContext($this->getContext()) > 1) {\n $this->setPosition(self::getLastPositionByContext($this->getContext()));\n }\n $this->position = null;\n $serializedContext = self::serializeContext($this->getContext());\n unset(self::$entities[$serializedContext][self::$lastPosition[$serializedContext]]);\n self::$lastPosition[$serializedContext]--;\n if (self::$lastPosition[$serializedContext] < 0) {\n self::$lastPosition[$serializedContext] = 0;\n }\n }\n }",
"abstract public function onDeleted($path);",
"public function deleted(EventTemplate $eventTemplate)\n {\n //\n }",
"protected function onDeleted($instance)\n {\n\n }",
"public function deleted_event(){\n return true;\n }",
"public function afterDelete()\n\t{\n\t\t$this->trigger('afterDelete', new Event($this));\n\t}",
"protected function afterDelete() {}",
"public function postDeleteEvent()\n {\n parent::elementPostDelete();\n parent::formElementPostDelete();\n $this->textareaPostDelete();\n }",
"public static function deleted($callback)\n {\n static::registerModelEvent ( 'deleted', $callback );\n }",
"protected function afterDelete()\r\n {\r\n\r\n }",
"public function deletePositionAction()\n {\n /** @var Enlight_Components_Snippet_Namespace $namespace */\n $namespace = Shopware()->Snippets()->getNamespace('backend/order/controller/main');\n\n $positions = $this->Request()->getParam('positions', [['id' => $this->Request()->getParam('id')]]);\n\n // Check if any positions is passed.\n if (empty($positions)) {\n $this->View()->assign([\n 'success' => false,\n 'data' => $this->Request()->getParams(),\n 'message' => $namespace->get('no_order_passed', 'No orders passed'),\n ]);\n\n return;\n }\n\n // If no order id passed it isn't possible to update the order amount, so we will cancel the position deletion here.\n $orderId = $this->Request()->getParam('orderID');\n\n if (empty($orderId)) {\n $this->View()->assign([\n 'success' => false,\n 'data' => $this->Request()->getParams(),\n 'message' => $namespace->get('no_order_id_passed', 'No valid order id passed.'),\n ]);\n\n return;\n }\n\n /** @var \\Shopware\\Models\\Order\\Order $order */\n $order = $this->getRepository()->find($orderId);\n if (empty($order)) {\n $this->View()->assign([\n 'success' => false,\n 'data' => $this->Request()->getParams(),\n 'message' => $namespace->get('no_order_id_passed', 'No valid order id passed.'),\n ]);\n\n return;\n }\n\n // Check whether the order has been modified in the meantime\n $lastOrderChange = new \\DateTime($this->Request()->getParam('changed'));\n if ($order->getChanged() !== null && $order->getChanged()->getTimestamp() != $lastOrderChange->getTimestamp()) {\n $params = $this->Request()->getParams();\n $params['changed'] = $order->getChanged();\n $this->View()->assign([\n 'success' => false,\n 'data' => $params,\n 'overwriteAble' => true,\n 'message' => $namespace->get('order_has_been_changed', 'The order has been changed in the meantime. To prevent overwriting these changes, saving the order was aborted. Please close the order and re-open it.'),\n ]);\n\n return;\n }\n\n foreach ($positions as $position) {\n if (empty($position['id'])) {\n continue;\n }\n $model = Shopware()->Models()->find(Detail::class, $position['id']);\n\n // Check if the model was founded.\n if ($model instanceof \\Shopware\\Models\\Order\\Detail) {\n Shopware()->Models()->remove($model);\n }\n }\n // After each model has been removed to executes the doctrine flush.\n Shopware()->Models()->flush();\n\n $order->calculateInvoiceAmount();\n Shopware()->Models()->flush();\n\n $data = $this->getOrder($order->getId());\n $this->View()->assign([\n 'success' => true,\n 'data' => $data,\n ]);\n }",
"public function deleted(ChatEvent $chatEvent)\n {\n //\n }",
"public function afterDelete() {}",
"protected function afterDelete() {\r\n }",
"public function handleDelete()\n {\n try {\n $this->entity->delete();\n $this->entity = null;\n $this->presenter->flashMessage('Záznam byl smazán.', 'success');\n } catch (Exception $e) {\n $this->presenter->flashMessage('Záznam nebyl smazán: ' . $e->getMessage(), 'danger');\n }\n\n if ($this->presenter->isAjax()) {\n // do not redraw itself as the entity is now vanished\n $this->grid->redrawControl();\n $this->presenter->redrawControl('flashes');\n } else {\n $this->redirect('this');\n }\n }",
"protected function _postDelete() {\n\t}",
"public function onInstanceDelete();",
"public function deleted(Evento $evento)\n {\n //\n }",
"function OnAfterDeleteItem(){\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Check if template file exists. Returns bool(true) if it does and bool(false) otherwise. On FALSE it also creates adds an error description to the report.
|
protected function _checkTemplateFileExists()
{
$template = $this->getTemplateConfiguration();
if (!$template) {
return true;
}
assert(!isset($filename), 'Cannot redeclare var $filename');
$filename = $template->getFile();
assert(!isset($fileExists), 'Cannot redeclare var $fileExists');
$fileExists = file_exists($filename);
if (!$fileExists) {
$this->_getReport()->addError("File '{$filename}' does not exist. " .
"Please make sure this path and filename is correct " .
"and you have all files installed. Reinstall if necessary.");
} else {
$this->_getReport()->addText("File: {$filename}");
}
unset($filename);
assert(is_bool($fileExists));
return $fileExists;
}
|
[
"public function exists() {\n if(!isset($this->template_file_exists)) {\n $this->template_file_exists = is_file($this->template_file_path);\n }\n \n return $this->template_file_exists;\n }",
"public function PHPTemplateExists() {\n\t\treturn file_exists( $this->PHPTemplate );\n\t}",
"public function has_template_file() {\n\t\treturn ! empty( $this->get_template_file() );\n\t}",
"public function SCSSTemplateExists() {\n\t\treturn file_exists( $this->SCSSTemplate );\n\t}",
"private function check_template()\n {\n return is_readable($this->template);\n }",
"protected function isBundleTemplateExists()\n {\n return (bool) (Directory::exists($this->computePath()) === true);\n }",
"public function hasValidTemplate() {\n\t\tif (file_exists(APP_DIR.'/Mvc/View/Templates/'.Config::TEMPLATE.'/template.php')) {\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function templateExists( $template );",
"function ValidateTemplate()\n {\n global $template, $chosen_template_dir_path, $project_name;\n\n $templates_dir = GetCurrentDirectory().\"/templates/\";\n $templates_dir_exists = file_exists($templates_dir);\n if (!$templates_dir_exists) {\n // If the templates directory does not exist, create it.\n $made_dir = mkdir($templates_dir);\n if (!$made_dir) {\n echo \"<p>php couldn't create the templates directory, this is likely caused \";\n echo \"by an improper \".$project_name.\" install.</p>\";\n return false;\n } else {\n // If we had to create the template directory, the template did not exist.\n echo \"<p>No templates installed, this is likely caused \";\n echo \"by an improper \".$project_name.\" install.</p>\";\n return false;\n }\n } else {\n $chosen_template_dir_path = $templates_dir.$template.\"/\"; // Path to the chosen template's directory\n if (file_exists($chosen_template_dir_path)) {\n // We have found the template directory, now confirm that it contains a index.html\n if (file_exists($chosen_template_dir_path.\"index.html\")) {\n // It did contain an index.html\n echo \"<p>The template, <strong>\".$template.\"</strong>, is valid.</p>\";\n return true;\n } else {\n // Template's folder didn't contain an index.html\n echo \"<p>Template, <strong>\".$template.\"</strong>, \";\n echo \"is not installed. It has a template directory, \";\n echo \"but the directory does not contain an <strong>index.html</strong>.</p>\";\n return false;\n }\n } else {\n echo \"<p>The template, <strong>\".$template.\"</strong>, is not installed.</p>\";\n return false;\n }\n }\n }",
"function template_exists (&$file_name)\n\t{\n\t\tif (file_exists($file_name))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\t// Do we have ../ or other paths at the beginning?\n\t\t// TODO: allow sandboxing of some sort\n\t\t// Added 6/8/2010\n\t\tif ($this->allow_include_backdir && preg_match('#^(([^/]+/)+)([^/]+)$#si', $file_name, $match))\n\t\t{\n\t\t\tpreg_match('#^(([^/]+/)+)([^/]*)$#si', $this->root_tpl_prefix, $rootmatch);\n\t\t\t$file_name = $rootmatch[1] . $match[1] . $rootmatch[3] . $match[3];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$file_name = $this->root_tpl_prefix . $file_name;\n\t\t}\n\n\t\tif (file_exists($file_name))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\t$file_name .= $this->root_tpl_postfix;\n\n\t\tif (file_exists($file_name))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}",
"private function verifyTemplate() {\n\t\t$template = $this->template_dir.$this->template;\n\t\tif (!file_exists($template)) {\n\t\t\tthrow new VCDProgramException('Template \"' . $this->template . '\" is missing.');\n\t\t}\n\t}",
"public function hasTemplate()\n {\n try {\n $this->getTemplateSource();\n return true;\n } catch (Exception\\InvalidTemplateResourceException $e) {\n return false;\n }\n }",
"abstract function template_exists( $template );",
"function checkTemplate($a_name)\n\t{\n\t\treturn file_exists($this->tplPath.$a_name);\n\t}",
"function tempFileExist() {\n\t\treturn(file_exists($this->getTempFileLocation()));\n\t}",
"public function templateExists( $template ) {\n return parent::templateExists( \"$template.{$this->templateExtension}\" );\n }",
"public function reportExists(){\n return file_exists($this->getReportURL())?true:false;\n }",
"function template_exists($template, $metadata_file)\n{\n$source_system_name=preg_split(\"/[:]/\",$template)[2];// as specified, we assume that \"template[2]\" will contain the system_name\n$source_path=preg_split(\"/[:]/\",$template)[4];// as specified, we assume that \"template[2]\" will contain the path\n$templates = fopen($metadata_file, \"r\");\n$exists=0;\nwhile (!feof($templates)) \n\t{\n\t\t$exists_path=0;$exists_systemname=0;\n\t\t$c = fgetc($templates); if($c === false) break;//because of how feof work, if we dont do this, we will get an eeror always at the end of the file\n\t\t$line = fgets($templates);$line=$c.$line;\n\t\t$exists_path=1;$exists_systemname=1;\n\t\t$target_system_name=preg_split(\"/[:]/\",$line)[2];// as specified, we assume that \"template[2]\" will contain the system_name on the target template description file\n\t\t$target_path=preg_split(\"/[:]/\",$line)[4];// as specified, we assume that \"template[2]\" will contain the path on the target template description file\n\t\t\n\t\tif (($source_system_name!=\"\")&&($target_system_name!=\"\")) $exists_systemname = strcmp($source_system_name, $target_system_name); //we search for a match on the system_name\n\t\tif (($source_path!=\"\")&&($target_path!=\"\")) $exists_path = strcmp($source_path, $target_path);//we search for a match on the path\n\t\tif (($exists_path==0)||($exists_systemname==0)) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//fwrite(STDOUT, \" target template: p=\".$target_path.\" (\".$exists_path.\"), sn=\".$target_system_name.\"(\".$exists_systemname.\")\\n\");\n\t\t\t\t\t\t\t\t$exists=explode(\":\",$line)[0];//if one of the two system_name/path is 0 , there is a mtach on the target account and there fore we retrun the target template id\n\t\t\t\t\t\t\t\t}\n\t}\nfclose($templates);\nreturn $exists;\n}",
"private static function checkFileExists() {\n return is_file(self::$path . self::$fileName);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Has many match and player.
|
public function matches() {
return $this->belongsToMany('Rubol\Game\Match');
}
|
[
"public function matches()\n {\n return $this->hasMany('App\\Models\\Match', 'opponent_id');\n }",
"public function players()\n {\n return $this->hasMany('App\\Player');\n }",
"public function matches()\n {\n return $this->hasMany('App\\\\Models\\\\Match');\n }",
"public function matches()\n {\n return $this->hasMany('App\\Models\\Match', 'location_id');\n }",
"public function matchOne()\n {\n return $this->hasMany(Match::class, 'team_one');\n }",
"public function gamePlays()\n {\n return $this->hasMany(GamePlay::class, 'initiator_id');\n }",
"public function matches()\n {\n return $this->hasMany('App\\Modules\\Cups\\Match')->orderBy('round')->orderBy('row');\n }",
"public function getTeamsAndPlayers($includeMatch = true)\n {\n if ($includeMatch) {\n $data['match'] = new MatchResource($this);\n }\n\n $teams = $this->teams;\n $team1 = (isset($teams[0]) && $teams[0]) ? $teams[0] : null;\n $team2 = (isset($teams[1]) && $teams[1]) ? $teams[1] : null;\n\n $roles = true;\n\n if (!$this->queue->role_enforcement) {\n $roles = false;\n }\n\n $positionTeam1 = 1;\n $positionTeam2 = 1;\n\n if ($team1) {\n $data['team1']['id'] = isset($team1->id) ? $team1->id : 0;\n $data['team1']['winner'] = isset($team1->winner_status) ? $team1->winner_status : 0;\n }\n\n if ($team2) {\n $data['team2']['id'] = isset($team2->id) ? $team2->id : 0;\n $data['team2']['winner'] = isset($team2->winner_status) ? $team2->winner_status : 0;\n }\n\n $players = $this->players()->orderBy('position')->get();\n\n foreach ($players as $player) {\n if (!$player->team_id) {\n continue;\n }\n\n $team = ($player->team_id === $team1->id) ? 'team1' : 'team2';\n\n if (!$roles) {\n if ($team === 'team1') {\n $position = $positionTeam1;\n $positionTeam1++;\n } else {\n $position = $positionTeam2;\n $positionTeam2++;\n }\n\n $role = 'Player' . $position;\n } else {\n $role = $player->gameRole ? $player->gameRole->name : null;\n }\n\n $data[$team]['players'][] = [\n 'player_id' => $player->id,\n 'user_id' => $player->user_id,\n 'username' => $player->user ? $player->user->username : null,\n 'name' => $player->user ? $player->user->name : null,\n 'in_game_name' => $player->in_game_name,\n 'avatar' => $player->user ? $player->user->avatar : null,\n 'role' => $role,\n 'status' => $player->status\n ];\n }\n\n return $data;\n }",
"public function matchesAsB()\n {\n return $this->hasMany('App\\Match','team_b_id');\n }",
"public function matchPredictions()\n {\n return $this->hasMany('MatchPrediction');\n }",
"public function player()\n {\n return $this->hasOne(Character::class, 'm_idPlayer', 'PlayerID');\n }",
"public function activePlayers()\n {\n return $this->hasMany('App\\Player')->where('active', 1);\n }",
"public function sessionPlayers()\n {\n return $this->hasMany(SessionPlayer::class);\n }",
"function racketeers_show_match_players ( $match_id ) {\n\t\n\t$thismatch = racketeers_get_match_by_id ( $match_id );\n\n\tracketeers_show_one_match_player( \"Player Host: \", \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_host_status'], \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_host'] );\n\n\tracketeers_show_one_match_player( \" Player 1: \", \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_player_1_status'], \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_player_1'] );\n\n\tracketeers_show_one_match_player( \" Player 2: \", \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_player_2_status'], \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_player_2'] );\n\n\tracketeers_show_one_match_player( \" Player 3: \", \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_player_3_status'], \n\t\t\t\t\t\t\t\t\t$thismatch['racketeers_match_player_3'] );\n\n}",
"public function teams()\n {\n return $this->hasMany('App\\Models\\Team', 'match_id', 'game_id');\n }",
"public function gameplays()\n {\n return $this->hasMany(Gameplay::class);\n }",
"public function homeMatches()\n {\n return $this->hasMany(Match::class, 'home_team_id');\n }",
"function setMatchPlayers() {\n $SeriesData = $this->getSeries('SeriesIDLive,SeriesID', array('StatusID' => 2, 'SeriesYear' => date('Y')), TRUE, 0);\n if (empty($SeriesData))\n return FALSE;\n\n /* To get all match ids */\n if (empty($SeriesData['Data']['Records']))\n return FALSE;\n\n foreach ($SeriesData['Data']['Records'] as $Series) {\n $Query = $this->db->query('SELECT MatchID,WeekID,TeamIDLocal,TeamIDVisitor FROM `sports_matches` WHERE `SeriesID` = ' . $Series['SeriesID'] . '');\n $Matches = ($Query->num_rows() > 0) ? $Query->result_array() : array();\n if (!empty($Matches)) {\n foreach ($Matches as $Match) {\n $MatchID = $Match['MatchID'];\n $WeekID = $Match['WeekID'];\n $TeamIDs = $Match['TeamIDLocal'] . ',' . $Match['TeamIDVisitor'];\n $Query = $this->db->query('SELECT PlayerID,PlayerRole,PlayerSalary,TeamID,Position FROM `sports_players` WHERE `TeamID` IN (' . $TeamIDs . ')');\n $Players = ($Query->num_rows() > 0) ? $Query->result_array() : array();\n if (!empty($Players)) {\n foreach ($Players as $Player) {\n $PlayerID = $Player['PlayerID'];\n $PlayerRole = $Player['PlayerRole'];\n $PlayerSalary = str_replace(\",\", \"\", $Player['PlayerSalary']);\n $Position = $Player['Position'];\n $TeamID = $Player['TeamID'];\n\n if (empty($PlayerRole))\n continue;\n\n $Query = $this->db->query('SELECT PlayerID FROM `sports_team_players` WHERE `SeriesID` = ' . $Series['SeriesID'] . ' AND `MatchID` = ' . $MatchID . ' AND `PlayerID` = ' . $PlayerID . ' LIMIT 1');\n $PlayerExists = ($Query->num_rows() > 0) ? $Query->row()->PlayerID : FALSE;\n if ($PlayerExists)\n continue;\n\n $MatchPlayerData = array(\n 'PlayerID' => $PlayerID,\n 'SeriesID' => $Series['SeriesID'],\n 'MatchID' => $MatchID,\n 'TeamID' => $TeamID,\n 'PlayerRole' => $PlayerRole,\n 'Position' => $Position,\n 'PlayerSalary' => $PlayerSalary,\n 'IsPlaying' => 'Yes'\n );\n $this->db->insert('sports_team_players', $MatchPlayerData);\n }\n }\n }\n }\n }\n }",
"public function games_a()\n {\n return $this->hasMany(Game::class, 'player_a_id');\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Checks whether a user is a member of a given team or not.
|
public function onTeam($team) : bool
{
switch (gettype($team))
{
// Assume team name
case 'string':
$team = Team::where('name', $team)->firstOrFail();
break;
case 'integer':
$team = Team::firstOrfail($team);
break;
case 'object' && $team instanceof Team:
// Do nothing.
break;
}
return $team->hasUser($this);
}
|
[
"public function isMemberOfTeam(TeamInterface $team, Authenticatable $user): bool;",
"public function isMember(Team $team)\n {\n foreach($team->users as $user)\n {\n if($this->id == $user->id)\n return true;\n }\n return false;\n }",
"public static function userHasTeam()\n\t{\n\t\t$team = self::findOne(['owner_id' => Yii::$app->user->id]);\n\t\t\n\t\treturn (is_object($team));\n\t}",
"function isUserInTeam() {\n\t$me = $_SESSION['userId'];\n\t$team = $_SESSION['target_team_id'];\n\t$query_user = \"SELECT partner_2 FROM relation WHERE partner_1 = '$team' AND partner_2 = '$me' AND relation_type = 'member' AND relation_status = 'connected'\";\n\n global $conn;\n $query_status = mysqli_query($conn, $query_user);\n if(mysqli_num_rows($query_status) > 0) {\n \treturn true;\n }\n return false;\n}",
"function checkTeamMember( $teamId = 0, $githubUserName = '' ) {\n\t\t\t// Check if user is a member of a team using api\n\t\t\treturn $this->client->api('teams')->check( $teamId, $githubUserName );\n\t\n\t\t}",
"public function hasTeam() {\n return TeamMembers::where('user_id', $this->id)->first() ? true : false;\n }",
"function wpcd_check_user_is_team_manager( $user_id, $team_id = 0 ) {\n\n\tif ( empty( $user_id ) ) {\n\t\treturn false;\n\t}\n\n\t// return true if passed $user_id is a team manager in passed $team_id.\n\tif ( ! empty( $team_id ) ) {\n\t\t$wpcd_permission_rule = get_post_meta( $team_id, 'wpcd_permission_rule', true );\n\n\t\tforeach ( $wpcd_permission_rule as $rule ) {\n\t\t\tif ( array_key_exists( 'wpcd_team_manager', $rule ) && $rule['wpcd_team_member'] == $user_id ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t$args = array(\n\t\t\t'post_type' => 'wpcd_team',\n\t\t\t'post_status' => 'private',\n\t\t\t'numberposts' => -1,\n\t\t\t'fields' => 'ids',\n\t\t);\n\t\t$teams = get_posts( $args );\n\n\t\tif ( $teams ) {\n\t\t\tforeach ( $teams as $team ) {\n\t\t\t\t$wpcd_permission_rule[] = get_post_meta( $team, 'wpcd_permission_rule', true );\n\t\t\t}\n\n\t\t\tif ( $wpcd_permission_rule ) {\n\t\t\t\tforeach ( $wpcd_permission_rule as $rules ) {\n\t\t\t\t\tif ( $rules ) {\n\t\t\t\t\t\tforeach ( $rules as $rule ) {\n\t\t\t\t\t\t\tif ( array_key_exists( 'wpcd_team_manager', $rule ) && $rule['wpcd_team_member'] == $user_id ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n\n}",
"public function isInTeam ()\n {\n return $this->hasRole(Application_Model_Role::ID_TEAM);\n }",
"public function isTeamMember($user_id)\n {\n return !$this->teamMembers()->whereLoose('id', $user_id)->isEmpty();\n\n }",
"function userHasTeamInTournament($tournament_id, $user_id)\n {\n $userteam = \\App\\UserTeam::where(['tournament_id' => $tournament_id, 'user_id' => $user_id])->first();\n if (empty($userteam)) {\n return false;\n } else {\n return true;\n }\n\n }",
"public function verify_team_membership($team){\r\n\t\t//check $_SESSION['$team'] see if the variable is set\r\n\t\t//echo \"parameter is $team <br />\";\r\n\t\t//echo \"the session variable is: \" . $_SESSION[\"$team\"];\r\n\t\tif(isset($_SESSION[\"$team\"])){\r\n\t\t\t//echo \"Welcome to $team Home Page <br />\";\t\r\n\t\t} else {\r\n\t\t\t//display error page\r\n\t\t\t$team = conver_team_member_for_print($team);\r\n\t\t\tdisplay_message(\"You must be a $team member to access this page <br />\");\r\n\t\t}\r\n\t\t\r\n\t\t//return true if set, false if not\t\r\n\t}",
"function isTeamOwner($teamName)\n{\n require_once(\"controller/authentication.php\");\n $user = getCurrentUser();\n if (!empty($user)) {\n require_once(\"model/teams.php\");\n $owner = selectTeamOwner($teamName);\n if (empty($owner)) {\n $res = false;\n } else {\n $res = $owner[\"email\"] === $user[\"email\"];\n }\n }\n return $res ?? false;\n}",
"public static function IsTeamOwner($owner_id, $team_id) {\n\t\t$db = TCPDatabase::getConnection();\n\t\t$sql = \"SELECT * \n\t\t\t\tFROM `team` \n\t\t\t\tWHERE `team_id` = :team_id AND `owner_id` = :owner_id\";\n\t\t$stmt = $db->prepare($sql);\n\t\t$stmt->bindValue(\":team_id\", $team_id);\n\t\t$stmt->bindValue(\":owner_id\", $owner_id);\n\t\t$stmt->execute();\n\t\tif ($stmt->fetchColumn()>=1) {\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}",
"public function isAlly($team_id)\n {\n $current_user = Yii::$app->user->getIdentity();\n $user_team_id = Team::getUserTeam($current_user->id);\n\n if ($team_id == $user_team_id) { //this is the user's team\n return false;\n } elseif ($this->team_1 == $team_id || $this->team_2 == $team_id) {\n return true;\n } else {\n return false;\n }\n }",
"public function isUserApprovedTeamMember($userId, $teamId) {\n $count = $this->find('count', array(\n 'conditions' => array(\n \"{$this->alias}.team_id\" => $teamId,\n \"{$this->alias}.user_id\" => $userId,\n \"{$this->alias}.status\" => self::STATUS_APPROVED\n )\n ));\n $isUserApprovedTeamMember = ($count > 0) ? true : false;\n return $isUserApprovedTeamMember;\n }",
"public function isTeamleader(){\n $userteams = $this->getTeamsForTeamleaderRole();\n return $userteams->count() > 0;\n }",
"public function isOwnerOfTeam($team)\n {\n return $team->owner_id === $this->id;\n }",
"function oid_check_teams($response)\n{\n $requiredTeam = common_config('openid', 'required_team');\n if ($requiredTeam) {\n $team_resp = new Auth_OpenID_TeamsResponse($response);\n if ($team_resp) {\n $teams = $team_resp->getTeams();\n } else {\n $teams = array();\n }\n\n $match = in_array($requiredTeam, $teams);\n $is = $match ? 'is' : 'is not';\n common_log(LOG_DEBUG, \"Remote user $is in required team $requiredTeam: [\" . implode(', ', $teams) . \"]\");\n\n return $match;\n }\n\n return true;\n}",
"public function ownsTeam($team): bool\n {\n return $this->id && $team->owner_id && $this->id === $team->owner_id;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Filter the query on the card_point_system_id column Example usage: $query>filterByCardPointSystemId(1234); // WHERE card_point_system_id = 1234 $query>filterByCardPointSystemId(array(12, 34)); // WHERE card_point_system_id IN (12, 34) $query>filterByCardPointSystemId(array('min' => 12)); // WHERE card_point_system_id > 12
|
public function filterByCardPointSystemId($cardPointSystemId = null, $comparison = null)
{
if (is_array($cardPointSystemId)) {
$useMinMax = false;
if (isset($cardPointSystemId['min'])) {
$this->addUsingAlias(CardPointSystemTableMap::COL_CARD_POINT_SYSTEM_ID, $cardPointSystemId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($cardPointSystemId['max'])) {
$this->addUsingAlias(CardPointSystemTableMap::COL_CARD_POINT_SYSTEM_ID, $cardPointSystemId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CardPointSystemTableMap::COL_CARD_POINT_SYSTEM_ID, $cardPointSystemId, $comparison);
}
|
[
"public function filterByPointSystemId($pointSystemId = null, $comparison = null)\n {\n if (is_array($pointSystemId)) {\n $useMinMax = false;\n if (isset($pointSystemId['min'])) {\n $this->addUsingAlias(CardPointSystemMapTableMap::COL_POINT_SYSTEM_ID, $pointSystemId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($pointSystemId['max'])) {\n $this->addUsingAlias(CardPointSystemMapTableMap::COL_POINT_SYSTEM_ID, $pointSystemId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(CardPointSystemMapTableMap::COL_POINT_SYSTEM_ID, $pointSystemId, $comparison);\n }",
"function buildQuery_squarefeet_min()\r\n\t{\r\n\t\t$param = $this->getState('squarefeet_min');\r\n\r\n\t\tif ($param == 0) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\t$fragment = FIELDNAME_RESIDENTIAL_SQUAREFEET . \" >= \";\r\n\t\t\t$fragment .= $param;\r\n\t\t\treturn $fragment; \r\n\t\t}\r\n\t}",
"function buildQuery_price_min()\r\n\t{\r\n\t\tglobal $mainframe;\r\n\t\t$param = $this->getState('price_min');\r\n\t\t\r\n\t\tif ($param == null) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\t$fragment = FIELDNAME_RESIDENTIAL_PRICE . \" >= \";\r\n\t\t\t$fragment .= $param;\r\n\t\t\treturn $fragment; \r\n\t\t}\r\n\r\n\t}",
"public function filterByPointSystem($pointSystem, $comparison = null)\n {\n if ($pointSystem instanceof \\PointSystem) {\n return $this\n ->addUsingAlias(CardPointSystemTableMap::COL_POINT_SYSTEM_ID, $pointSystem->getPointSystemId(), $comparison);\n } elseif ($pointSystem instanceof ObjectCollection) {\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n\n return $this\n ->addUsingAlias(CardPointSystemTableMap::COL_POINT_SYSTEM_ID, $pointSystem->toKeyValue('PrimaryKey', 'PointSystemId'), $comparison);\n } else {\n throw new PropelException('filterByPointSystem() only accepts arguments of type \\PointSystem or Collection');\n }\n }",
"public function selectMinValue($table,$column, $conditions)\n\t{\n\t\tif ($this->isDbOpen_)\n\t\t{\n if($conditions == '')\n {\n\t\t\t\t$this->result_ = $this->mysqli_->query(\"SELECT MIN($column) FROM $table\");\n }\n else\n {\n $this->result_ = $this->mysqli_->query(\"SELECT MIN($column) FROM $table WHERE $conditions\");\n }\t \t\n\t\t}\n\t}",
"public function min($column = null);",
"public function apply_site_id_filter()\n\t{\n\t\tif ($this->_site_id !== NULL AND isset($this->_table_columns[$this->_site_id_column]))\n\t\t{\n\t\t\tif (is_scalar($this->_site_id))\n\t\t\t{\n\t\t\t\t// Filter by single site id\n\t\t\t\t$this->where($this->_object_name.'.'.$this->_site_id_column, '=', (int) $this->_site_id);\n\t\t\t}\n\t\t\telseif (is_array($this->_site_id) AND ! empty($this->_site_id))\n\t\t\t{\n\t\t\t\t// Filter by several site ids\n\t\t\t\t$this->where($this->_object_name.'.'.$this->_site_id_column, 'IN', $this->_site_id);\n\t\t\t}\n\t\t}\n\t}",
"public function filterByCreditCardId($creditCardId = null, $comparison = null)\n {\n if (is_array($creditCardId)) {\n $useMinMax = false;\n if (isset($creditCardId['min'])) {\n $this->addUsingAlias(CardPointSystemMapTableMap::COL_CREDIT_CARD_ID, $creditCardId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($creditCardId['max'])) {\n $this->addUsingAlias(CardPointSystemMapTableMap::COL_CREDIT_CARD_ID, $creditCardId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(CardPointSystemMapTableMap::COL_CREDIT_CARD_ID, $creditCardId, $comparison);\n }",
"protected function addPositionFilter()\n {\n if (!$this->dataHelper->isBatchEnabled($this->getType())) {\n return;\n }\n\n $this->collection->addFieldToFilter(\n $this->getIdFieldName(),\n ['gt' => $this->getLastId()]\n );\n }",
"protected function _addPositionFilter()\n {\n if (!$this->isBatchEnabled()) {\n return;\n }\n\n $this->_collection->addFieldToFilter(\n $this->_getIdFieldName(),\n array(\n 'gt' => $this->_getLastId(),\n )\n );\n }",
"public function filterByPointSystem($pointSystem, $comparison = null)\n {\n if ($pointSystem instanceof \\PointSystem) {\n return $this\n ->addUsingAlias(RewardTableMap::COL_POINT_SYSTEM_ID, $pointSystem->getPointSystemId(), $comparison);\n } elseif ($pointSystem instanceof ObjectCollection) {\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n\n return $this\n ->addUsingAlias(RewardTableMap::COL_POINT_SYSTEM_ID, $pointSystem->toKeyValue('PrimaryKey', 'PointSystemId'), $comparison);\n } else {\n throw new PropelException('filterByPointSystem() only accepts arguments of type \\PointSystem or Collection');\n }\n }",
"public function get_filters_minmax()\r\n\t{\r\n\t\t$query = $this->db->query(\"\r\n\t\t\tSELECT\r\n\t\t\t\tfeature_id,\r\n\t\t\t\tMAX(ABS(tb_spec_value.name)) AS max,\r\n\t\t\t\tMIN(ABS(tb_spec_value.name)) AS min\r\n\t\t\tFROM\r\n\t\t\t\ttb_spec_feature\r\n\t\t\tJOIN \r\n\t\t\t\ttb_spec_fk\r\n\t\t\tON \r\n\t\t\t\tfeature_id = feature\r\n\t\t\tJOIN \r\n\t\t\t\ttb_spec_value\r\n\t\t\tON \r\n\t\t\t\tvalue = value_id\r\n\t\t\tWHERE \r\n\t\t\t\tfilter=2\r\n\t\t\tGROUP BY \r\n\t\t\t\tfeature_id\r\n\t\t\");\r\n\r\n\t\t// Set feature_id as key\r\n\t\tforeach($query->result_array() as $values)\r\n\t\t{\r\n\t\t\t$result[$values['feature_id']] = ['max' => $values['max'], 'min' => $values['min']];\r\n\t\t}\r\n\r\n\t\treturn $result;\r\n\t}",
"public function filterByPriceRange(Request $request){\n \n $categoryId = $request->categoryId;\n $minPrice = $request->minPrice;\n $maxPrice = $request->maxPrice;\n\n if($request->price_range){\n $price_range = explode('-', $request->price_range);\n $minPrice = $price_range[0];\n $maxPrice = $price_range[1];\n }\n \n $products = Product::whereBetween ('price',[$minPrice, $maxPrice] )\n ->where('category_id', $categoryId)\n ->get();\n return $products;\n }",
"public static function min($column)\n {\n return self::_s_call('min', [$column]);\n }",
"function get_by_minopp($minOppUID) {\n\t\tif (!$minOppUID)\n\t\t\treturn 0;\n\t\t$order_by = 'tstamp DESC';\n\t\t$where .= ' pid IN('.$this->pid_list.')';\n\t\tif (!is_array($minOppUID))\n\t\t\t$where .= ' AND uid='.intval($minOppUID);\n\t\telse {\n\t\t\t$minUIDStr = \"\";\n\t\t\tforeach ($minOppUID as $minUID) {\n\t\t\t\t$minUIDStr .= (strlen($minUIDStr) ? ',' : \"\") . $minUID;\n\t\t\t}\n\t\t\t$where .= ' AND uid IN ('.$minUIDStr.')';\n\t\t}\n\t\t// handle languages\n\t\t$lang = ($l = $GLOBALS['TSFE']->sys_language_uid) ? $l : '0,-1';\n\t\t$where .= ' AND sys_language_uid IN ('.$lang.') ';\n\n\t\t$where .= $this->cObj->enableFields($this->servantContentTable);\n\t\t$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*',$this->servantContentTable,$where,\"\",$order_by);\n\t\tif (mysql_error())\tt3lib_div::debug(array(mysql_error(),\"SELECT * FROM \".$this->servantContentTable.\" WHERE \".$where.\" ORDER BY \".$order_by.\" LIMIT \".$limit));\n\n\t\t$minOppArray = $this->get_row_data($res);\n\n\t\tif (!is_array($minOppUID))\n\t \t\treturn $minOppArray[0]; // return only one (there can be only one)\n\t \telse\n\t \t\treturn $minOppArray;\n\t}",
"public function min($column) {\n return $this->_call_aggregate_db_function(__FUNCTION__, $column);\n }",
"public function minimum($what=''){\n\t\t$this->connect();\n\t\t$what = get_params(func_get_args());\n\t\tif(isset($what['column'])) {\n\t\t\tif(!$what['column']){\n\t\t\t\t$what['column'] = $what[0];\n\t\t\t}\n\t\t} else {\n\t\t\t$what['column'] = $what[0];\n\t\t}\n\t\tActiveRecord::sql_item_sanizite($what['column']);\n\t\tif($this->schema){\n\t\t\t$table = \"{$this->schema}.{$this->source}\";\n\t\t} else {\n\t\t\t$table = $this->source;\n\t\t}\n\t\t$select = \"SELECT MIN({$what['column']}) FROM $table \" ;\n\t\tif(isset($what[\"conditions\"])&&$what[\"conditions\"]) {\n\t\t\t$select.=\" WHERE {$what[\"conditions\"]} \";\n\t\t}\n\t\tif(isset($what[\"order\"])&&$what[\"order\"]) {\n\t\t\tActiveRecord::sql_item_sanizite($what['order']);\n\t\t\t$select.=\" ORDER BY {$what[\"order\"]} \";\n\t\t} else {\n\t\t\t$select.=\" ORDER BY 1 \";\n\t\t}\n\n\t\t$num = $this->db->fetch_one($select);\n\t\treturn $num[0];\n\t}",
"function filter($column, $operation = IDataSource::EQUAL, $value = NULL, $chainType = NULL);",
"public static function addCurrentSeatsFilter($query)\r\n {\r\n // Add a where clause to the query to only return seats today or in\r\n // the future\r\n return $query->andWhere('(s.pickup_date >= ? OR s.pickup_date IS NULL)', date('Y-m-d'));\r\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Gets the batteryRuleRequireCharger Flag indicating if charger is required. When set to false, the client can install updates whether the device is in or out of the charger. Applied only for installation. Defaults to false.
|
public function getBatteryRuleRequireCharger()
{
if (array_key_exists("batteryRuleRequireCharger", $this->_propDict)) {
return $this->_propDict["batteryRuleRequireCharger"];
} else {
return null;
}
}
|
[
"public function getCharger(): Charger\n {\n return $this -> charger_connector_type -> charger;\n }",
"public function getBatteryCapacityGood()\n {\n if (array_key_exists(\"batteryCapacityGood\", $this->_propDict)) {\n return $this->_propDict[\"batteryCapacityGood\"];\n } else {\n return null;\n }\n }",
"public function isChargingFree()\n {\n if( $this -> charger_connector_type -> isChargerFast() )\n {\n return false;\n }\n\n $currentChargingPower = $this -> latestChargingPower();\n\n if( is_null( $currentChargingPower ) )\n {\n return $currentChargingPower;\n }\n \n return $currentChargingPower -> tariff_price == 0;\n }",
"public function getChargerType() {\n return \"supercharger\";\n }",
"public function getBatteryRuleMinimumBatteryLevelPercentage()\n {\n if (array_key_exists(\"batteryRuleMinimumBatteryLevelPercentage\", $this->_propDict)) {\n return $this->_propDict[\"batteryRuleMinimumBatteryLevelPercentage\"];\n } else {\n return null;\n }\n }",
"public function getBonusEnabled()\n {\n $result = $this->scopeConfig->getValue('praxigento_downline/referral_bonus/enabled', AScope::SCOPE_STORE);\n $result = filter_var($result, FILTER_VALIDATE_BOOLEAN);\n return $result;\n }",
"public function getChargeRetryEnabled() {\n\t\treturn $this->chargeRetryEnabled;\n\t}",
"public function getHasBatteryAttribute(): bool {\n return $this->hasBattery();\n }",
"public function getRequireHoneypot()\n {\n return $this->require_honeypot;\n }",
"protected function getBoostbuck() {\n $excess = any($this->cload, function($device) {\n $voltage = $device['voltage'];\n return $voltage < 11.5 || $voltage > 12.5;\n });\n\n return ($excess ? \"Yes\" : \"No\");\n }",
"public function getRequireHealthyDeviceReport()\n {\n if (array_key_exists(\"requireHealthyDeviceReport\", $this->_propDict)) {\n return $this->_propDict[\"requireHealthyDeviceReport\"];\n } else {\n return null;\n }\n }",
"public function getChargeable()\n\t{\n\t\treturn $this->chargeable;\n\t}",
"public function getWifiBatteryCharge()\n {\n if (array_key_exists(\"wifiBatteryCharge\", $this->_propDict)) {\n return $this->_propDict[\"wifiBatteryCharge\"];\n } else {\n return null;\n }\n }",
"public function isCharging($charger_id)\n {\n return true;\n }",
"public function getIsMobileInputRequire()\n {\n $required = $this->scopeConfig->getValue(self::XML_PATH_CONFIG_MOBILE_REQUIRED);\n\n if ($required == '1') {\n return true;\n } else {\n return false;\n }\n }",
"public function getBatteryCapacityPoor()\n {\n if (array_key_exists(\"batteryCapacityPoor\", $this->_propDict)) {\n return $this->_propDict[\"batteryCapacityPoor\"];\n } else {\n return null;\n }\n }",
"public function setRequiresDeviceCompliance($val)\n {\n $this->_propDict[\"requiresDeviceCompliance\"] = boolval($val);\n return $this;\n }",
"protected function getReferralRequired() {\n $raw = $this->facilityService->get('field_referral_required')->value;\n $map = [\n // Value => Return.\n // Lighthouse decided to receive these as strings since non-bool options.\n '0' => 'false',\n '1' => 'true',\n 'not_applicable' => 'not applicable',\n ];\n\n return $map[$raw] ?? NULL;\n }",
"public function getRequiresReboot()\n {\n if (array_key_exists(\"requiresReboot\", $this->_propDict)) {\n return $this->_propDict[\"requiresReboot\"];\n } else {\n return null;\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Check if the current user is impersonated.
|
public function isImpersonated()
{
return app(ImpersonateManager::class)->isImpersonating();
}
|
[
"public static function isImpersonating() {\n\t\treturn !empty($_SESSION['REAL_USER_ID']);\n\t}",
"public function isImpersonating();",
"public static function isImpersonating()\n {\n return session()->has(static::IMPERSONATED);\n }",
"public function isImpersonating()\n {\n return session()->has('impersonate');\n }",
"public function canBeImpersonated()\n {\n return impersonator()->isEnabled() && ! $this->isAdmin();\n }",
"public function canImpersonate()\n {\n return impersonator()->isEnabled() && $this->isAdmin();\n }",
"public function canBeImpersonated();",
"public function canBeImpersonated()\n {\n return true;\n }",
"public function canImpersonate(): bool\n {\n return $this -> can('access.user.impersonate');\n }",
"public function canImpersonate(): bool;",
"public function canImpersonate(): bool\n {\n return impersonator()->isEnabled() && $this->isAdmin();\n }",
"public function canBeImpersonated(): bool;",
"public function isImpersonator(): bool\n {\n return $this->security->isGranted(AuthenticatedVoter::IS_IMPERSONATOR);\n }",
"public function canBeImpersonated()\n {\n return !$this->hasRole('super admin');\n }",
"public function checkImpersonator(Request $request)\n {\n if($this->settings['everyone_can_impersonate']) return true;\n\n\n if($request->user()->canImpersonate()){\n return true;\n\n }else{\n $this->addErrorMessage('You dont have the ability to impersonate other users');\n\n return false;\n }\n }",
"public function canImpersonate()\n {\n return $this->hasPermission('users.manage');\n }",
"function auth_ensure_can_impersonate( $p_user_id ) {\n\tif( !auth_can_impersonate( $p_user_id ) ) {\n\t\taccess_denied();\n\t}\n}",
"private static function impersonatedBy(){\n\t\t\t$key = 'impersonated_by_'.COOKIEHASH;\n\t\t\tif(isset($_COOKIE[$key]) && !empty($_COOKIE[$key])){\n\t\t\t\t$user_id = self::encryptDecrypt('decrypt', $_COOKIE[$key]);\n\t\t\t\treturn $user_id;\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"function currentUserAllowed()\n\t{\n\t\treturn !isset($this->app_name) || isset($GLOBALS['egw_info']['user']['apps'][$this->app_name]);\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Deletes a post with the specified slug.
|
public function deletePost($slug) {
$this->_dbh->prepareStatement('DELETE FROM posts
WHERE `slug` = :slug
LIMIT 1;
');
$this->_dbh->bind(Array(
'slug' => Array($slug, PDO::PARAM_STR)
));
$this->_dbh->executePreparedStatement();
$results = $this->_dbh->getResults();
$error = $this->_dbh->getErrorMessage();
var_dump($error);
return (is_null($results) && is_null($error));
}
|
[
"public function deletePost($post_slug)\n {\n \n \n $bm=new BlogModel();\n $result_from_db=$bm->getPost($post_slug);\n \n \n if(count($result_from_db)<1) { \n \n self::renderPageNotFound();\n }else{\n \n $postID=$result_from_db[0]['Id'];\n $result=$bm->deletePost($postID);\n if(count($result)>0) {\n $text = \"The post was successfully deleted\";\n }else{ $text=\"error\";\n }\n \n if (LoginUser::validateLoginAdmin()) { Render::$menu=\"templates\\menu_admin.php\"; \n }\n Render::$content=$text;\n Render::renderPage(\"user\");\n }\n }",
"public function action_delete() {\n\n // Load the ORM model of the specified post\n $post_id = $this->request->param('id');\n $p = ORM::factory('post', $post_id);\n \n // If it exists, delete!\n if ($p->loaded()) {\n $p->delete();\n Notify::msg('Deleted!', 'info');\n } else {\n Notify::msg('Aww, not found!', 'error');\n }\n\n $this->request->redirect('dash');\n }",
"public function delete($post_id);",
"public function deletePost()\n {\n \t$this->status = self::STATUS_DELETED;\n \t\n \tif($this->save()) {\n \t\tWikiTutorialPostData::model()->deletePostDatasByPostId($this->id);\n \t}\n }",
"public function delete(Post $post) {\n\t\t\t$stmt = $this->db->prepare(\"DELETE from posts WHERE id=?\");\n\t\t\t$stmt->execute(array($post->getId()));\n\t\t}",
"public function deleteById($post_id);",
"public function delete(Post $post)\n {\n $aclProvider = $this->container->get('security.acl.provider');\n $objectIdentity = ObjectIdentity::fromDomainObject($post);\n $aclProvider->deleteAcl($objectIdentity);\n \n $em = $this->getEntityManager();\n $em->remove($post);\n $em->flush();\n }",
"abstract public function deletePost($post);",
"public function a_post_can_be_deleted()\n {\n $post = factory(Post::class)->create(['slug' => 'i-am-slug']);\n\n $this->be($post->user, 'api')\n ->deleteJson('api/posts/'.$post->id)\n ->assertStatus(200);\n\n $this->assertDatabaseMissing('posts', ['id' => $post->id]);\n }",
"public function delete()\n {\n if (!$this->authentication->isSignedIn()) {\n $this->httpResponse->setSession(\n 'prevURL',\n 'delete-blog-post'.$this->httpRequest->getGet('id')\n );\n $this->httpResponse->redirect('/sign-in');\n }\n\n if (!$this->authentication->isAdmin()) {\n $this->httpResponse->redirect401();\n }\n\n $blogPostManager = $this->managers->getManagerOf('BlogPost');\n\n if (!$blogPostManager->exists($this->httpRequest->getGet('id'))) {\n $this->httpResponse->redirect404();\n }\n\n $blogPostManager->delete($this->httpRequest->getGet('id'));\n\n $this->httpResponse->redirect('/admin');\n }",
"public static function deletePost($_postUuid)\n {\n $dbTranslator = static::$translator;\n return $dbTranslator::deletePost($_postUuid);\n }",
"public static function deleted_post($post_id)\n {\n self::delete_object_relationships($post_id, 'post');\n }",
"public function delete( $slug ) {\n\n\t\treturn wordpoints_delete_points_type( $slug );\n\t}",
"public function delete_post($p_id)\n\t\t{\n\t\t\t$query = DB::query(Database::DELETE, 'DELETE FROM posts WHERE p_id = '.$p_id)->execute();\n\t\t}",
"public function delete(string $slug)\n {\n $tag = $this->getBy('slug', $slug);\n $name = $tag->name;\n\n $tag->delete();\n\n return $name;\n }",
"public function postTrashPost()\n\t{\n\t\t$post = Post::find(Input::get('post-id'))->delete();\n\t}",
"public function deletePost() {\n $postId = $this->request->getParameter(\"id\");\n $this->post->delete($postId);\n $this->redirect('Admin','index/');\n }",
"public function delete($slug)\n {\n if(!checkRole(getUserGrade(3)))\n {\n prepareBlockUserMessage();\n return back();\n }\n /**\n * Delete the questions associated with this quiz first\n * Delete the quiz\n * @var [type]\n */\n $record = Quiz::where('slug', $slug)->first();\n try{\n if(!isDemo()) {\n $record->delete();\n }\n $response['status'] = 1;\n $response['message'] = getPhrase('record_deleted_successfully');\n } catch (Exception $e) {\n $response['status'] = 0;\n if(getSetting('show_foreign_key_constraint','module'))\n $response['message'] = $e->getMessage();\n else\n $response['message'] = getPhrase('this_record_is_in_use_in_other_modules');\n }\n return json_encode($response);\n\n }",
"public function removePost(){\n\t\t$postId = $this->uri->segment(3);\n\t\t$this->postManager->removePost($postId);\n\t\tredirect(site_url().'/PostController/userPostList');\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Build REPORT XML request for locating a node path by uuid.
|
protected function buildLocateRequest(string $uuid): string
{
return '<?xml version="1.0" encoding="UTF-8"?>'.
'<dcr:locate-by-uuid xmlns:dcr="http://www.day.com/jcr/webdav/1.0">'.
'<D:href xmlns:D="DAV:">'.
$uuid.
'</D:href></dcr:locate-by-uuid>';
}
|
[
"public function getNodePathForIdentifier($uuid) {\n $this->checkLogin();\n \n $dom = $this->getDomFromBackend(self::REPORT, $this->workspaceUri,\n self::buildLocateRequest($uuid));\n /* answer looks like\n <D:multistatus xmlns:D=\"DAV:\">\n <D:response>\n <D:href>http://localhost:8080/server/tests/jcr%3aroot/tests_level1_access_base/idExample/</D:href>\n </D:response>\n </D:multistatus>\n */\n $set = $dom->getElementsByTagNameNS(self::NS_DAV, 'href');\n if ($set->length != 1) {\n throw new PHPCR_RepositoryException('Unexpected answer from server: '.$dom->saveXML());\n }\n $fullPath = $set->item(0)->textContent;\n if (strncmp($this->workspaceUriRoot, $fullPath, strlen($this->workspaceUri))) {\n throw new PHPCR_RepositoryException(\"Server answered a path that is not in the current workspace: uuid=$uuid, path=$fullPath, workspace=\".$this->workspaceUriRoot);\n }\n return substr(substr($fullPath, 0, -1), //cut trailing slash /\n strlen($this->workspaceUriRoot)); //remove uri, workspace and root node\n }",
"private function generateXMLReport() {\n\t\t// Adds Date Block.\n\t\t$this->XML_addDate();\n\n\t\t// Adds Resource Block.\n\t\t$this->XML_addResource($this->taskResultSet->getResourceURL(), $this->taskResultSet->getResourceIP(), $this->taskResultSet->getServerBanner() );\n\n\t\t// Adds Complex Security Level Block.\n\t\t$this->XML_addSecurityLevel($this->securityLevel);\n\n\t\t// Adds block which contains Info about tested vulnerabilities.\n\t\t$this->XML_addTestedVulnerabilities();\n\n\t\t// Adds block which contains details about scan.\n\t\t$this->XML_addScanDetails();\n\n\t\t// Adds all blocks in the general xml-container.\n\t\t$this->xmlHandler->appendChild($this->xmlRoot);\n\n\t\t// Generating and saving the XML File.\n\t\t$xmlReportFilePath = $this->savePath . DIRECTORY_SEPARATOR . $this->generateReportFilePrefix() . '.xml';\n\n\n\t\t$xmlReportFileLink = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $xmlReportFilePath;\n\t\t$xmlReportFileLink = str_replace('\\\\', '/', $xmlReportFileLink);\n\n\n\t\t$this->xmlHandler->save($xmlReportFilePath);\n\n\t\treturn $xmlReportFileLink;\n\t}",
"public function getNodePathForIdentifier($uuid)\n {\n $this->assertLoggedIn();\n\n $path = $this->conn->fetchColumn(\"SELECT path FROM phpcr_nodes WHERE identifier = ? AND workspace_id = ?\", array($uuid, $this->workspaceId));\n if (!$path) {\n throw new \\PHPCR\\ItemNotFoundException(\"no item found with uuid \".$uuid);\n }\n return \"/\" . $path;\n }",
"public function buildUri($setting, $method = \"reports\", $report = \"\")\n {\n // Begin setting up the URI by cleaning/standardizing the server_url_r5 string in the setting\n $_url = rtrim($setting->provider->server_url_r5); // remove trailing whitespace\n $_url = preg_replace('/\\/?reports\\/?/i', '', $_url); // take off any methods with any bounding slashes\n $_url = preg_replace('/\\/?status\\/?/i', '', $_url); // \" \" \" \" \" \" \" \"\n $_url = preg_replace('/\\/?members\\/?/i', '', $_url); // \" \" \" \" \" \" \" \"\n $_uri = rtrim($_url, '/'); // remove any remaining trailing slashes\n $request_uri = $_uri . '/' . $method;\n\n // Construct and execute the Request\n $uri_auth = \"?customer_id=\" . urlencode($setting->customer_id);\n if (!is_null($setting->requestor_id)) {\n $uri_auth .= \"&requestor_id=\" . urlencode($setting->requestor_id);\n }\n if (!is_null($setting->API_key)) {\n $uri_auth .= \"&api_key=\" . urlencode($setting->API_key);\n }\n\n // Return the URI if we're not building a report request\n if ($report == \"\" || $method != \"reports\") {\n return $request_uri . $uri_auth;\n }\n\n // Setup date range and attributes for the request\n $uri_dates = \"&begin_date=\" . self::$begin . \"&end_date=\" . self::$end;\n if ($report->name == \"TR\") {\n $uri_atts = \"&attributes_to_show=Data_Type%7CAccess_Method%7CAccess_Type%7C\";\n $uri_atts .= \"Section_Type%7CYOP\";\n } elseif ($report->name == \"DR\") {\n $uri_atts = \"\";\n } elseif ($report->name == \"PR\") {\n $uri_atts = \"&attributes_to_show=Data_Type%7CAccess_Method\";\n } elseif ($report->name == \"IR\") {\n $uri_atts = \"\";\n }\n\n // Construct URI for the request\n $request_uri .= '/' . strtolower($report->name) . $uri_auth . $uri_dates . $uri_atts;\n return $request_uri;\n }",
"public function requestReport()\n {\n if (! array_key_exists('ReportType', $this->options)) {\n $this->log('Report Type must be set in order to request a report!', 'Warning');\n\n return false;\n }\n\n $url = $this->urlbase.$this->urlbranch;\n\n $query = $this->genQuery();\n\n $path = $this->options['Action'].'Result';\n if ($this->mockMode) {\n $xml = $this->fetchMockFile()->$path;\n } else {\n $response = $this->sendRequest($url, ['Post' => $query]);\n\n if (! $this->checkResponse($response)) {\n return false;\n }\n\n $xml = simplexml_load_string($response['body'])->$path;\n }\n\n $this->parseXML($xml->ReportRequestInfo);\n }",
"function buildFindingAid($r) {\n\t$xml = new DOMDocument();\n\t$xml->load('metadata/speculum.xml');\n\n\t$xp = new DOMXPath($xml);\n\t$q = '/findaid/*';\n\t$nodeList = $xp->query($q);\n\n\t$dom = new DOMDocument();\n\t$root = $dom->createElement('findaid');\t\n\t$dom->appendChild($root);\n\tforeach ($nodeList as $node) {\n\t\t$nodeid = $xp->query('@refid', $node);\n\t\tif ($nodeid->length != 1) \n\t\t\tcontinue;\n\t\t$id = strtoupper($nodeid->item(0)->nodeValue);\n\t\tif (in_array($id, $r)) { \n\t\t\t$newNode = $dom->importNode($node, true);\n\t\t\t$root->appendChild($newNode);\n\t\t}\n\t}\n\treturn $dom;\n}",
"protected function _downloadReport($client, $uuid) {\n\t\t$url = $client->getUri();\n\n\t\t$uri = Zend_Uri::factory($url);\n\t\t$uri->setPath('/file/report/download');\n\t\t$url = $uri->getUri();\n\n\t\ttry {\n\t\t\t$client->setUri($url);\n\t\t\t$client->resetParameters();\n\n\t\t\t$client->setParameterGet(array(\n\t\t\t\t'report' => $uuid,\n\t\t\t\t'v2' => true\n\t\t\t));\n\n\t\t\t$response = $client->request('GET');\n\n\t\t\t/**\n\t\t\t* A valid response looks like this\n\t\t\t*\n\t\t\t* <NessusClientData_v2>\n\t\t\t* <Policy>\n\t\t\t* <policyName>Scan Policy</policyName>\n\t\t\t* <policyComments></policyComments>\n\t\t\t* <Preferences>\n\t\t\t* <ServerPreferences>\n\t\t\t* <preference>\n\t\t\t* <name>use_mac_addr</name>\n\t\t\t* <value>no</value>\n\t\t\t* </preference>\n\t\t\t* <preference>\n\t\t\t* <name>plugin_set</name>\n\t\t\t* <value>11589;42070;13795;25037;42455;16143</value>\n\t\t\t* [..]\n\t\t\t* </preference>\n\t\t\t* <preference>\n\t\t\t* <name>TARGET</name>\n\t\t\t* <value>192.168.0.100</value>\n\t\t\t* </preference>\n\t\t\t* [..]\n\t\t\t* </plugin_output>\n\t\t\t* <plugin_version>$Revision: 1.37 $</plugin_version>\n\t\t\t* </ReportItem>\n\t\t\t* </ReportHost>\n\t\t\t* </Report>\n\t\t\t* </NessusClientData_v2>\n\t\t\t*/\n\t\t\t$response = $response->getBody();\n\n\t\t\t@$xml = simplexml_load_string($response);\n\t\t\tif ($xml === false) {\n\t\t\t\t/**\n\t\t\t\t* Getting here would indicate that the scan started, but\n\t\t\t\t* the results have not yet finished.\n\t\t\t\t*\n\t\t\t\t* You receive a response from Nessus that looks like this\n\t\t\t\t*\n\t\t\t\t* <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n\t\t\t\t* <html>\n\t\t\t\t* <head>\n\t\t\t\t* <title>404 File not found</title>\n\t\t\t\t* </head>\n\t\t\t\t* <body>\n\t\t\t\t* <h1>File not found</h1>\n\t\t\t\t* <p>The requested file was not found</p>\n\t\t\t\t* </body>\n\t\t\t\t* </html>\n\t\t\t\t*/\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn $xml->asXML();\n\t\t} catch (Exception $error) {\n\t\t\treturn false;\n\t\t}\n\t}",
"abstract public function fetchPath( $nodeId );",
"public function getReport( $uid = '', $token = '') {\n return new Request(\n 'GET',\n $this->getBaseUri() . \"reports/{$uid}?token={$token}\" . $this->getTelemetry(),\n [],\n null,\n $this->config['http_version']\n );\n }",
"protected function getNodeInfoRequest()\n {\n\n $resourcePath = '/api/v1/node-info';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"function generate_tasker_profile_xml() {\n\n $location = admin_url('edit.php?post_type=pkdevpl_devices');\n\n $is_nonce_correct = check_admin_referer( 'generate_xml' );\n \n if( ! $is_nonce_correct ) wp_redirect( $location );\n \n $device_api_key = $_GET['device_api_key'];\n\n $devices = new Devices;\n $device = $devices->get_device_by_api_key($device_api_key);\n\n if( is_wp_error( $device ) || is_null( $device ) ) wp_redirect( $location );\n\n $xml = new XML_Generator( $device->api_key );\n }",
"private function buildRequestUrlForConsulting()\n {\n return self::QUOTA_URL . http_build_query([\n 'Action' => 'SMS_Num',\n 'Uid' => $this->account,\n 'KeyMD5' => $this->key\n ]);\n }",
"protected function getTelephonyProvidersEdgesEdgeversionreportRequest()\n {\n\n $resourcePath = '/api/v2/telephony/providers/edges/edgeversionreport';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"function buildLeadXML() {\n global $ip, $fname, $lname, $address, $city, $country, $state, $zip, $email, $phone, $w_phone, $h_phone, $email, $subid, $affid, $parentaff, $pgid, $clid, $referer, $request_url; \n\n//$en_referer = urlencode($referer);\n//$en_request_url = urlencode($request_url);\n\n$en_referer = 'none';\n$en_request_url = 'none';\n$company_id = COMPANY_NO;\n$sess_id = session_id();\n$custom1 =isset($_SESSION['custom1']) ? $_SESSION['custom1'] : '';\n$custom2 =isset($_SESSION['custom2']) ? $_SESSION['custom2'] : '';\n$cmpid = 0;\n\n$xml =<<<EOD\n<LEAD>\n<COMPANY>{$company_id}</COMPANY>\n<AFFILIATE>{$affid}</AFFILIATE>\n<SESSIONID>{$sess_id}</SESSIONID>\n<PROGRAM>{$pgid}</PROGRAM>\n<IPADDRESS>{$ip}</IPADDRESS>\n<CUSTOM1>{$custom1}</CUSTOM1>\n<CUSTOM2>{$custom2}</CUSTOM2>\n<CMPID>{$cmpid}</CMPID>\n<CUSTOMER>\n<FIRSTNAME>{$fname}</FIRSTNAME>\n<LASTNAME>{$lname}</LASTNAME>\n<ADDRESS>{$address}</ADDRESS>\n<CITY>{$city}</CITY>\n<STATE>{$state}</STATE>\n<COUNTRY>{$country}</COUNTRY>\n<ZIP>{$zip}</ZIP>\n<EMAIL>{$email}</EMAIL>\n<PHONE>{$w_phone}</PHONE>\n<PHONE2>{$h_phone}</PHONE2>\n</CUSTOMER>\n</LEAD>\nEOD;\n\n$xml = 'xmlstr='.$xml;\n\n return $xml;\n}",
"function wow_build_xml_request($method, $properties=NULL, $parameters=NULL, $object='addusr')\n {\n global $USER;\n $request = '<?xml version=\"1.0\"?>\n <PLATXML>\n <header></header>\n <body>\n <data_block>\n <protocol>Plat</protocol>\n <object>'.$object.'</object>\n <action>'.$method.'</action>\n <username>'.$USER->name.'</username>\n <password>'.$USER->password.'</password>\n <logintype>staff</logintype>';\n // add parameters\n if (!is_null($parameters) && count($parameters) > 0)\n {\n $request .= \"<parameters>\\n\";\n foreach ($parameters as $name=>$value)\n {\n $type = NULL;\n // some names have types included also, parse it out\n if (strpos($name, ' ') !== FALSE)\n list($name, $type) = explode(' ', $name);\n $request .= \"<$name\";\n if (@$type != '')\n $request .= ' ' . $type;\n // special case, sending a boolean false (usually for an optional parameter)\n else if ($value === FALSE)\n $request .= ' type=\"boolean\"';\n // special case, array of values\n else if (is_array($value))\n $request .= ' type=\"array\"';\n $request .= '>';\n \n if ($value === FALSE)\n $request .= 'false';\n // special case, array of values\n else if (is_array($value))\n {\n foreach ($value as $sub_name=>$sub_value)\n {\n $request .= \"<row>\\n\";\n // special case, another array of values (e.g. services)\n if (is_array($sub_value))\n {\n foreach ($sub_value as $sub_sub_name=>$sub_sub_value)\n $request .= \"<$sub_sub_name>$sub_sub_value</$sub_sub_name>\\n\";\n }\n // standard way to process an array\n else\n {\n $request .= \"<col_name>$sub_name</col_name>\\n\";\n $request .= \"<col_value>$sub_value</col_value>\\n\";\n }\n $request .= \"</row>\\n\";\n }\n }\n else\n $request .= $value;\n $request .= \"</$name>\\n\";\n }\n $request .= \"</parameters>\\n\";\n }\n \n // add properties\n if (!is_null($properties) && count($properties) > 0)\n {\n $request .= \"<properties>\\n\";\n foreach ($properties as $name=>$value)\n {\n $type = NULL;\n // some names have types included also, parse it out\n if (strpos($name, ' ') !== FALSE)\n list($name, $type) = explode(' ', $name);\n $request .= \"<$name\";\n if (@$type != '')\n $request .= ' ' . $type;\n // special case, sending a boolean false (usually for an optional parameter)\n else if ($value === FALSE)\n $request .= ' type=\"boolean\"';\n $request .= '>';\n \n if ($value === FALSE)\n $request .= 'false';\n else\n $request .= $value;\n $request .= \"</$name>\\n\";\n }\n $request .= \"</properties>\\n\";\n }\n \n $request .= '</data_block>\n </body>\n </PLATXML>';\n return $request;\n }",
"private function getUrlToDrillDown($warehouseId,$sid=array())\r\n {\r\n \t$vars = $this->getSelectionVars();\r\n \t$partTypeId = $vars[\"partTypeId\"];\r\n \t$contractId = $vars[\"contractId\"];\r\n \t$ownerId = $vars[\"ownerId\"];\r\n \t$includeKits = $vars[\"includeKits\"];\r\n \t$countryIds = $vars[\"countryIds\"];\r\n\r\n \t$displayOption = $vars[\"displayOption\"];\r\n \tif($displayOption == \"3\" || $displayOption == \"4\" ) $displayOption = 2;\r\n\r\n \tif(count($sid)== 0)\r\n \t{\r\n \t\t$statusIds = $vars[\"statusIds\"];\r\n \t}\r\n \telse\r\n \t{\r\n \t\t$statusIds=$sid;\r\n \t}\r\n\r\n \tif($includeKits == \"\")\t$includeKits = 'null';\r\n \tif($contractId == \"\")\t$contractId = 'null';\r\n \tif($ownerId == \"\") $ownerId = 'null';\r\n\t\tif(count($statusIds)==0) $statusIds = array(\"null\");\r\n\t\tif (count($countryIds) == 0) $countryIds = array(\"null\");\r\n\r\n\t\treturn \"/partquantityatlocation/$partTypeId/$warehouseId/$contractId/$ownerId/$displayOption/\".implode(\",\",$statusIds).'/'.$includeKits.'/'.implode(\",\",$countryIds);\r\n }",
"public static function info(/*# string */ $uuid)/*# : array */;",
"protected function getXpathString() {\n return 'xpathparser:' . $this->getCounter();\n }",
"public function createLocator($nodeName, $value);"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Renders the data cell content. This method renders the view, update and toggle buttons in the data cell.
|
protected function renderDataCellContent($row, $data)
{
$checked = ($this->value === null)
? CHtml::value($data, $this->name)
: $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row));
$button = $this->button;
$button['icon'] = $checked === null ? $this->emptyIcon : ($checked ? $this->checkedIcon : $this->uncheckedIcon);
$button['url'] = isset($button['url']) ? $this->evaluateExpression(
$button['url'],
array('data' => $data, 'row' => $row)
) : '#';
if (!$this->displayText) {
$button['htmlOptions']['title'] = $this->getButtonLabel($checked);
if (!isset($button['htmlOptions']['data-toggle'])) {
$button['htmlOptions']['data-toggle'] = 'tooltip';
}
echo CHtml::link('<i class="'.$button['icon'].'"></i>', $button['url'], $button['htmlOptions']);
} else {
$button['label'] = $this->getButtonLabel($checked);
$button['class'] = 'booster.widgets.TbButton';
$button['buttonType'] = 'link';
$widget = Yii::createComponent($button);
$widget->init();
$widget->run();
}
}
|
[
"public function renderDataCellContent($row, $data) {\r\r\n\t\t\r\r\n\t\t$value = '';\r\r\n\t\tif ($this->value !== null) {\r\r\n\t\t\t$value = $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row));\r\r\n\t\t} else if ($this->name !== null) {\r\r\n\t\t\t$value = CHtml::value($data, $this->name);\r\r\n\t\t}\r\r\n\t\t\r\r\n\t\t$class = preg_replace('/\\s+/', '.', $this->class);\r\r\n\t\t$value = !isset($value) ? $this->grid->nullDisplay : $this->grid->getFormatter()->format($value, $this->type);\r\r\n\t\t$value = CHtml::link($value, '#', array('class' => $class, 'data-trigger' => 'manual'));\r\r\n\t\t\r\r\n\t\techo $value;\r\r\n\t}",
"protected function renderDataCellContent($row,$data)\n\t{\n\t\techo $this->label . \"<br />\" . $this->evaluateExpression($this->value, array('data'=>$data,'row'=>$row));;\n\t\t\n\t}",
"protected function renderDataCellContent($row,$data)\n\t{\n\t\tif($this->urlExpression!==null)\n\t\t\tif(is_array($this->urlExpression)){\n\t\t\t\t$url = array();\n\t\t\t\t$models = $this->evaluateExpression($this->urlExpression['model'],array('data'=>$data,'row'=>$row));\n\t\t\t\tforeach($models as $model){\n\t\t\t\t\t$params = array();\n\t\t\t\t\tif (isset($this->urlExpression['params'])){\n\t\t\t\t\t\t$params = $this->urlExpression['params'];\n\t\t\t\t\t}\n\t\t\t\t\tforeach($this->urlExpression['modelParams'] as $name=>$param){\n\t\t\t\t\t\t$params[$name] = $model->{$param};\n\t\t\t\t\t}\n\t\t\t\t\t$urlStr = Yii::app()->createUrl($this->urlExpression['route'], $params);\n\t\t\t\t\t//$urlStr = $this->urlExpression['route'] .'?';\n\t\t\t\t\t//foreach($this->urlExpression['params'] as $name=>$param){\n\t\t\t\t\t//\t$urlStr .= $name .'=' . $model->{$param};\n\t\t\t\t\t//}\n\t\t\t\t\t$url[] = $urlStr;\n\t\t\t\t}\n\t\t\t}else\n\t\t\t$url=$this->evaluateExpression($this->urlExpression,array('data'=>$data,'row'=>$row));\n\t\telse\n\t\t$url=$this->url;\n\t\tif($this->labelExpression!==null)\n\t\t\t$label=$this->evaluateExpression($this->labelExpression,array('data'=>$data,'row'=>$row));\n\t\telse\n\t\t\t$label=$this->label;\n\t\t$options=$this->linkHtmlOptions;\n\t\tif(is_string($this->imageUrl))\n\t\t\techo CHtml::link(CHtml::image($this->imageUrl,$label),$url,$options);\n\t\telse if(is_array($label)){\n\t\t\t$urlStr = '';\n\t\t\tif(is_array($url)){\n\t\t\t\tforeach($url as $i => $urlVal){\n\t\t\t\t\t$urlStr .= CHtml::link($label[$i],$urlVal,$options). $this->separator;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tforeach($label as $i => $labelVal){\n\t\t\t\t\t$urlStr .= CHtml::link($labelVal,$url,$options). $this->separator;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (strlen($urlStr)>1 ) $urlStr = substr($urlStr, 0, -strlen($this->separator)); // trim last seperator\n\t\t\techo $urlStr;\n\t\t}\n\t\telse\n\t\t\techo CHtml::link($label,$url,$options);\n\t}",
"protected function renderDataCellContent($row,$data)\n {\n if($this->value!==null)\n $value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));\n elseif($this->name!==null)\n $value=CHtml::value($data,$this->name);\n else\n $value=$this->grid->dataProvider->keys[$row];\n\n $checked = false;\n if($this->checked!==null)\n $checked=$this->evaluateExpression($this->checked,array('data'=>$data,'row'=>$row));\n\n $options=$this->checkBoxHtmlOptions;\n if($this->disabled!==null)\n $options['disabled']=$this->evaluateExpression($this->disabled,array('data'=>$data,'row'=>$row));\n\n $name=$options['name'];\n unset($options['name']);\n $options['value']=$value;\n $options['id']=$this->id.'_'.$row;\n\n echo '<label>';\n echo CHtml::checkBox($name,$checked,$options);\n echo '<span class=\"lbl\"></span></label>';\n }",
"public function render()\n {\n $html = '';\n\n if (array_key_exists($this->row_id, $this->columns) === true) {\n foreach ($this->columns[$this->row_id] as $column) {\n $this->view->row()\n ->setColumnId($column['id']);\n $rows = $this->view->row()\n ->render();\n\n $class = \"column\";\n\n if ($this->selected_content_id === null && $this->selected_row_id === $column['row_id']) {\n if ($this->selected_column_id === $column['id']) {\n $class .= ' selected';\n } else {\n $class .= ' selectable';\n }\n }\n\n if (strlen($rows) > 0) {\n $content = '<p>' . $rows . '</p>';\n } else {\n $this->view->content()\n ->setColumnId($column['id']);\n $this->view->content()\n ->setSelectedColumnId($this->selected_column_id);\n $this->view->content()\n ->setSelectedContentId($this->selected_content_id);\n $column_content = $this->view->content()\n ->render();\n\n if (strlen($column_content) > 0) {\n $content = $column_content;\n } else {\n if ($this->selected_column_id === $column['id']) {\n\n $content = '<p><div class=\"btn-group\"><div class=\"btn-group\">\n <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n Create tools <span class=\"caret\"></span></button>\n <ul class=\"dropdown-menu\">';\n foreach ($this->view->layout()->control_bar_tools['create'] as $button) {\n $content .= '<li><a href=' . $this->view->escape($button['uri']) . '>' .\n $this->view->escape($button['name']) . \"</a></li>\";\n }\n $content .= '</ul></div>';\n $content .= '<div class=\"btn-group\">\n <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n Import tools <span class=\"caret\"></span></button>\n <ul class=\"dropdown-menu\">';\n foreach ($this->view->layout()->control_bar_tools['import'] as $button) {\n $content .= '<li><a href=' . $this->view->escape($button['uri']) . '>' .\n $this->view->escape($button['name']) . \"</a></li>\";\n }\n $content .= '</ul></div></div></p>';\n\n $content .= \"<p><a href=\\\"/content/design/set-tool/tool/AddRow\\\" class=\\\"btn btn-default\\\">Add Row(s)</a></p>\";\n } else {\n $content = '<p class=\"text-muted\"><em>Empty column</em></p>';\n }\n $class .= ' empty';\n }\n }\n\n $class = $class . ' col-' . $column['column_type'] . '-' . $column['width'];\n if ($column['offset'] !== 0) {\n $class .= ' col-' . $column['column_type'] . '-offset-' . $column['offset'];\n }\n\n // Responsive column classes\n if (array_key_exists($column['id'], $this->responsive_widths) === true) {\n foreach ($this->responsive_widths[$column['id']] as $column_type => $width) {\n $class .= ' col-' . $column_type . '-' . $width;\n }\n }\n\n $html .= '<div class=\"' . $class . '\" data-column-id=\"' . $column['id'] . '\" ' .\n $this->view->stylingColumn()\n ->setColumn($column['id']) . '>';\n $html .= $content;\n $html .= '</div>';\n }\n }\n\n return $html;\n }",
"public function render()\n {\n $this->initGrid();\n\n parent::render();\n }",
"public function Content($data) {\n // Colors, line width and bold font\n $this->SetFillColor(255, 0, 0);\n $this->SetTextColor(255);\n $this->SetDrawColor(128, 0, 0);\n $this->SetLineWidth(0.3);\n // $this->SetFont('', 'B');\n // Header\n // $w = array(40, 35, 40, 45);\n // $num_headers = count($header);\n // for($i = 0; $i < $num_headers; ++$i) {\n // $this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);\n // }\n // $this->Ln();\n // Color and font restoration\n $this->SetFillColor(224, 235, 255);\n $this->SetTextColor(0);\n $this->SetFont('msungstdlight', '', 8);\n // Data\n// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)\n\t\t$h = 6;\n\t\t$border = 0;\n $fill = 0;\n\t\t$ln = 1;\n\t\t$x = '';\n\t\t$y = '';\n\t\t$reseth = true;\n\t\t$stretch = 0;\n\t\t$ishtml = false;\n\t\t$autopadding = true;\n\t\t$maxh = 0;\n\t\t$valign = 'T';\n\t\t$fitcell = false;\n\n\t\tif (!empty($data)) {\n\t\t\tforeach ($data as $rows) {\n\t\t\t\t$lastidx = count($rows) - 1;\n\t\t\t\t$idx = -1;\n\t\t\t\tforeach ($rows as $key=>$value) {\n\t\t\t\t\t$idx++;\n\n\t\t\t\t\t$w = $this->column_width[$idx];\n\t\t\t\t\t$txt = $value;\n\t\t\t\t\t$align = $this->column_align[$idx];\n\t\t\t\t\t$ln = ($idx==$lastidx) ? 1 : 0;\n\n\t\t\t\t\t$this->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, \n\t\t\t\t\t\t$stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell);\n\t\t\t\t}\n\t\t\t\t$fill=!$fill;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->MultiCell(0, $h, '--\t'.Yii::t('report','Nil').'\t--', $border, 'C', $fill, $ln, $x, $y, $reseth, \n\t\t\t\t$stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell);\n\t\t}\n }",
"function Row_Rendering() {\r\n\r\n\t\t// Enter your code here\t\r\n\t}",
"function RenderRow() {\r\n\t\tglobal $conn, $Security, $fsstat;\r\n\r\n\t\t// Call Row_Rendering event\r\n\t\t$fsstat->Row_Rendering();\r\n\r\n\t\t// Common render codes for all row types\r\n\t\t// fsid\r\n\r\n\t\t$fsstat->fsid->CellCssStyle = \"\";\r\n\t\t$fsstat->fsid->CellCssClass = \"\";\r\n\r\n\t\t// dirid\r\n\t\t$fsstat->dirid->CellCssStyle = \"\";\r\n\t\t$fsstat->dirid->CellCssClass = \"\";\r\n\r\n\t\t// checked\r\n\t\t$fsstat->checked->CellCssStyle = \"\";\r\n\t\t$fsstat->checked->CellCssClass = \"\";\r\n\r\n\t\t// latest\r\n\t\t$fsstat->latest->CellCssStyle = \"\";\r\n\t\t$fsstat->latest->CellCssClass = \"\";\r\n\r\n\t\t// uid\r\n\t\t$fsstat->uid->CellCssStyle = \"\";\r\n\t\t$fsstat->uid->CellCssClass = \"\";\r\n\r\n\t\t// type\r\n\t\t$fsstat->type->CellCssStyle = \"\";\r\n\t\t$fsstat->type->CellCssClass = \"\";\r\n\r\n\t\t// sumcnt\r\n\t\t$fsstat->sumcnt->CellCssStyle = \"\";\r\n\t\t$fsstat->sumcnt->CellCssClass = \"\";\r\n\r\n\t\t// sumval\r\n\t\t$fsstat->sumval->CellCssStyle = \"\";\r\n\t\t$fsstat->sumval->CellCssClass = \"\";\r\n\r\n\t\t// maxcnt\r\n\t\t$fsstat->maxcnt->CellCssStyle = \"\";\r\n\t\t$fsstat->maxcnt->CellCssClass = \"\";\r\n\r\n\t\t// maxval\r\n\t\t$fsstat->maxval->CellCssStyle = \"\";\r\n\t\t$fsstat->maxval->CellCssClass = \"\";\r\n\t\tif ($fsstat->RowType == EW_ROWTYPE_VIEW) { // View row\r\n\r\n\t\t\t// fsid\r\n\t\t\t$fsstat->fsid->ViewValue = $fsstat->fsid->CurrentValue;\r\n\t\t\t$fsstat->fsid->CssStyle = \"\";\r\n\t\t\t$fsstat->fsid->CssClass = \"\";\r\n\t\t\t$fsstat->fsid->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// dirid\r\n\t\t\t$fsstat->dirid->ViewValue = $fsstat->dirid->CurrentValue;\r\n\t\t\t$fsstat->dirid->CssStyle = \"\";\r\n\t\t\t$fsstat->dirid->CssClass = \"\";\r\n\t\t\t$fsstat->dirid->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// checked\r\n\t\t\t$fsstat->checked->ViewValue = $fsstat->checked->CurrentValue;\r\n\t\t\t$fsstat->checked->CssStyle = \"\";\r\n\t\t\t$fsstat->checked->CssClass = \"\";\r\n\t\t\t$fsstat->checked->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// latest\r\n\t\t\t$fsstat->latest->ViewValue = $fsstat->latest->CurrentValue;\r\n\t\t\t$fsstat->latest->CssStyle = \"\";\r\n\t\t\t$fsstat->latest->CssClass = \"\";\r\n\t\t\t$fsstat->latest->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// uid\r\n\t\t\t$fsstat->uid->ViewValue = $fsstat->uid->CurrentValue;\r\n\t\t\t$fsstat->uid->CssStyle = \"\";\r\n\t\t\t$fsstat->uid->CssClass = \"\";\r\n\t\t\t$fsstat->uid->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// type\r\n\t\t\t$fsstat->type->ViewValue = $fsstat->type->CurrentValue;\r\n\t\t\t$fsstat->type->CssStyle = \"\";\r\n\t\t\t$fsstat->type->CssClass = \"\";\r\n\t\t\t$fsstat->type->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// sumcnt\r\n\t\t\t$fsstat->sumcnt->ViewValue = $fsstat->sumcnt->CurrentValue;\r\n\t\t\t$fsstat->sumcnt->CssStyle = \"\";\r\n\t\t\t$fsstat->sumcnt->CssClass = \"\";\r\n\t\t\t$fsstat->sumcnt->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// sumval\r\n\t\t\t$fsstat->sumval->ViewValue = $fsstat->sumval->CurrentValue;\r\n\t\t\t$fsstat->sumval->CssStyle = \"\";\r\n\t\t\t$fsstat->sumval->CssClass = \"\";\r\n\t\t\t$fsstat->sumval->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// maxcnt\r\n\t\t\t$fsstat->maxcnt->ViewValue = $fsstat->maxcnt->CurrentValue;\r\n\t\t\t$fsstat->maxcnt->CssStyle = \"\";\r\n\t\t\t$fsstat->maxcnt->CssClass = \"\";\r\n\t\t\t$fsstat->maxcnt->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// maxval\r\n\t\t\t$fsstat->maxval->ViewValue = $fsstat->maxval->CurrentValue;\r\n\t\t\t$fsstat->maxval->CssStyle = \"\";\r\n\t\t\t$fsstat->maxval->CssClass = \"\";\r\n\t\t\t$fsstat->maxval->ViewCustomAttributes = \"\";\r\n\r\n\t\t\t// fsid\r\n\t\t\t$fsstat->fsid->HrefValue = \"\";\r\n\r\n\t\t\t// dirid\r\n\t\t\t$fsstat->dirid->HrefValue = \"\";\r\n\r\n\t\t\t// checked\r\n\t\t\t$fsstat->checked->HrefValue = \"\";\r\n\r\n\t\t\t// latest\r\n\t\t\t$fsstat->latest->HrefValue = \"\";\r\n\r\n\t\t\t// uid\r\n\t\t\t$fsstat->uid->HrefValue = \"\";\r\n\r\n\t\t\t// type\r\n\t\t\t$fsstat->type->HrefValue = \"\";\r\n\r\n\t\t\t// sumcnt\r\n\t\t\t$fsstat->sumcnt->HrefValue = \"\";\r\n\r\n\t\t\t// sumval\r\n\t\t\t$fsstat->sumval->HrefValue = \"\";\r\n\r\n\t\t\t// maxcnt\r\n\t\t\t$fsstat->maxcnt->HrefValue = \"\";\r\n\r\n\t\t\t// maxval\r\n\t\t\t$fsstat->maxval->HrefValue = \"\";\r\n\t\t}\r\n\r\n\t\t// Call Row Rendered event\r\n\t\t$fsstat->Row_Rendered();\r\n\t}",
"protected function renderContent()\n {\n parent::render();\n }",
"public function renderHTML() {\n /* row counter */\n $row = 0;\n /* Colum counter */\n $order = 1;\n $col = $this->columns;\n /* Apply header icons to table if passed */\n if(isset($this->icons) && $this->icons !== Null){\n $this->pageTable->setIcons($this->icons); \n }\n /** Set the table style if passed */\n if(isset($this->tableStyles) && $this->tableStyles !== Null){\n $this->pageTable->setClass($this->tableStyles); \n }\n \n /** add table header */\n if(sizeof($col) > 0){\n foreach ($col as $Header ) {\n if(isset($this->columnLabels) && isset($this->columnLabels[$order - 1]) && $this->columnLabels !== Null){\n $Header = $this->columnLabels[$order - 1];\n }\n $this->pageTable->additem(array('label'=>$Header,'order'=>$order,'row'=>$row,'head'=>true));\n $order++;\n }\n if(isset($this->link) && $this->link !== Null){\n $this->pageTable->additem(array('label'=>'','order'=>$order,'row'=>$row,'head'=>true));\n }\n $row = 2;\n }\n \n /** add data to table */\n for($i = $this->startRow, $this->endRow; $i < $this->endRow; $i++){\n $order = 1;\n foreach ($col as $Labels ) { \n $this->pageTable->additem(array('label'=>$this->dataSet[$i][$Labels],'order'=>$order,'row'=>$row,'head'=>false));\n $order++;\n }\n\n /** add data links as cols */\n foreach ($this->links as $link) {\n if(isset($link) && $link !== Null){\n $idCol = $link['Column'];\n $mylabel = \"<a \";\n /** class to link */\n if (isset($link['Class']) && $link['Class'] !== Null){\n $mylabel = $mylabel.'class =\"'.$link['Class'].'\"';\n }\n $mylabel = $mylabel.' href=\"'.$link['URL'].'&id='.$this->dataSet[$i][$idCol].'\">'.$link['Label'].'</a>';\n \n if(isset($link['Icon']) && $link['Icon']!== Null){\n $myicon = $link['Icon'];\n }else{\n $myicon = Null;\n }\n $this->pageTable->additem(array('label'=>$mylabel,'order'=>$order,'row'=>$row,'head'=>false, 'icon'=>$myicon )); \n $order++;\n }\n }\n $row++; \n }\n \n $content = '<div'; \n $content = $content.$this->renderClass();\n $content = $content.$this->renderID();\n $content = $content.'>';\n $content = $content.$this->pageTable->render('html');\n $content = $content.$this->pagePagination->render('html');\n $content = $content.'</div>';\n return $content;\n\t}",
"function renderFilterCellContent() {\n echo TbHtml::openTag(\"div\", array('class' => 'filter-wrapper raty-filter-wrapper'));\n\n // Run the widget & capture the output\n if ($this->filter !== NULL AND is_array($this->filter) AND count($this->filter) == 2) {\n $this->filter[1]['options'] = $this->filterOptions;\n $this->filter = $this->grid->controller->widget($this->filter[0], $this->filter[1], TRUE);\n /*\n $this->filter = $this->grid->controller->widget('ext.DzRaty.DzRaty', array(\n 'model' => $this->grid->filter,\n 'attribute' => $this->name,\n 'options' => $this->filterOptions\n ), TRUE);\n */\n }\n parent::renderFilterCellContent();\n echo '</div>';\n }",
"protected function renderDataCellContent($model, $key, $index)\n {\n $isChecked = (bool)$model->{$this->modelKeyUpdate};\n $html = Html::checkbox('ajaxCb', $isChecked, ['value' => $key, 'class' => 'ajaxCb '.$this->ajaxCheckboxGroupClass]);\n\n return $html;\n }",
"public function renderDataCell($row) {\n\t\t$data=$this->grid->dataProvider->data[$row];\n\t\t$options=$this->htmlOptions;\n\t\tif($this->cssClassExpression!==null) {\n\t\t\t$class=$this->evaluateExpression($this->cssClassExpression,array('html'=>$row,'data'=>$data));\n\t\t\tif(!empty($class))\n\t\t\t{\n\t\t\t\tif(isset($options['class']))\n\t\t\t\t\t$options['class'].=' '.$class;\n\t\t\t\telse\n\t\t\t\t\t$options['class']=$class;\n\t\t\t}\n\t\t}\n\t\t$options['grid-td-id'] = $this->id . '_' . $row;\n\t\techo CHtml::openTag('td',$options);\n\t\t$this->renderDataCellContent($row,$data);\n\t\techo '</td>';\n\t}",
"public function render()\r\n\t{\r\n\t\t$this->initDefaultButtons();\r\n\t\t\r\n\t\tforeach($this->buttons as $id=>$button)\r\n\t\t{\r\n\t\t\tif(strpos($this->template,'{'.$id.'}')===false)\r\n\t\t\tunset($this->buttons[$id]);\r\n\t\t}\r\n\t\t\r\n\t\techo '<div class=\"button-bar\">';\r\n\t\techo $this->renderData();\r\n\t\techo '<div class=\"clear\"></div></div>';\r\n\t}",
"public function renderView()\n {\n $buttons = new Button_Model();\n $content = $this->getContent();\n include($this->render);\n $buttons->display();\n $buttons->initDisplay();\n }",
"public function renderItems()\r\n\t{\r\n\t\t$data=$this->dataProvider->getData();\r\n\t\tif(($n=count($data))>0)\r\n\t\t{\r\n\t\t\t$this->_data['operates']=$this->operates;\r\n\t\t\t$this->_data['batch_opes']=$this->batch_opes;\r\n\t\t\t$this->_data['data']=$data;\r\n\t\t\t$this->_data['columns']=$this->columns;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$this->renderEmptyText();\r\n\t\t}\r\n\t}",
"public function render()\n {\n $content = '\n Ext.create(\"Ext.grid.Panel\", {\n store: ' . $this->getStore() . ',';\n \n if ($this->hasSelectionModel()) {\n $content .= \"selModel: \" . $this->getSelectionModel() . \",\";\n }\n \n $content .= \"columns: [\";\n \n $iterator = new ArrayIterator($this->getColumns());\n while ($iterator->valid()) {\n $column = $iterator->current();\n \n $content .= \"{\n text: '\" . $column['title'] . \"',\n sortable: '\" . $column['sortable'] . \"',\n dataIndex: '\" . $column['dataIndex'] . \"'\n \";\n if (!empty($column['renderer'])) {\n $content .= \",renderer: \" . $column['renderer'];\n }\n $content .= \"}\";\n \n $iterator->next();\n if ($iterator->valid()) {\n $content .= \",\";\n }\n }\n \n $content .= \"],\";\n \n if ($this->hasPaging()) {\n $content .= \"bbar: \" . $this->getPaging() . \",\";\n }\n \n if ($this->hasOption('title')) {\n $content .= \"title: '\" . htmlspecialchars($this->getOption('title'), ENT_QUOTES) . \"',\";\n }\n \n if ($this->hasTopBar()) {\n $content .= \"tbar: \" . $this->getTopBar() . \",\";\n }\n \n if ($this->getOption('width')) {\n $content .= \"width: \" . $this->getOption('width') . \",\";\n }\n \n if ($this->hasOption('onItemDblClick')) {\n $content .= \"listeners: {\n itemdblclick: \".$this->getOption('onItemDblClick').\"\n },\";\n }\n \n if ($this->hasOption('viewConfig')) {\n $content .= \"viewConfig: \" . $this->getOption('viewConfig') . ',';\n }\n \n if ($this->hasOption('selModel')) {\r\n $content .= \"selModel: \" . $this->getOption('selModel') . ',';\r\n }\n \n $content .= \"\n renderTo: '\" . $this->getOption('renderTo') . \"',\n id: '\" . $this->getId() . \"',\n forceFit: true\n })\";\n \n return $content;\n }",
"public function renderFilterCell()\n {\n echo CHtml::openTag('td', $this->filterHtmlOptions);\n echo '<div class=\"filter-container\">';\n $this->renderFilterCellContent();\n echo '</div>';\n echo CHtml::closeTag('td');\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Adds javascripts and stylesheets from the supplied form to the response object.
|
function use_stylesheets_and_javascripts_for_form(sfForm $form)
{
use_javascripts_for_form($form);
use_stylesheets_for_form($form);
}
|
[
"function use_html5_javascripts_for_form(sfForm $form)\n{\n $response = sfContext::getInstance()->getResponse();\n\n foreach ($form->getJavascripts() as $file)\n {\n $response->addJavascript($file);\n }\n}",
"function dpi_cdn_use_javascripts_for_form(sfForm $form)\n{\n foreach ($form->getJavascripts() as $file)\n {\n dpi_cdn_use_javascript($file);\n }\n}",
"function include_javascripts_for_form(sfForm $form)\n{\n echo get_javascripts_for_form($form);\n}",
"function include_stylesheets_for_form(sfForm $form)\n{\n echo get_stylesheets_for_form($form);\n}",
"public function enqueue_form_scripts() {\n \n $this->support_form_class->enqueue_scripts();\n \n }",
"function dm_include_stylesheets_for_form(sfForm $form)\n{\n echo get_stylesheets_for_form($form);\n}",
"protected function injectFormAssets()\n {\n $assets = Form::collectFieldAssets();\n\n Backport::css($assets['css']);\n Backport::js($assets['js']);\n }",
"protected function _setFormJs(){\n \n }",
"function include_html5_javascripts_for_form(sfForm $form)\n{\n echo get_html5_javascripts_for_form($form);\n}",
"public function registerAssets()\r\n {\r\n $response = sfContext::getInstance()->getResponse();\r\n\r\n // register our css and js\r\n $response->addJavascript(sfConfig::get('sf_web_debug_web_dir').'/js/main');\r\n $response->addStylesheet(sfConfig::get('sf_web_debug_web_dir').'/css/main');\r\n }",
"function registerFormScripts()\n {\n $page = &$this->getPage();\n $page->register_script(atkConfig(\"atkroot\").\"atk/javascript/dhtml_formtools.js\");\n $page->register_script(moduleDir(\"scheduler\").\"javascript/scheduler.js\");\n $page->register_loadscript(\"change_recur(); change_duration();\");\n }",
"public function action_javascript()\n\t{\n\t\t// Generate and check the ETag for this file\n\t\t$this->request->check_cache(sha1($this->request->uri));\n\n\t\t// Get the file path from the request\n\t\t$file = $this->request->param('file');\n\n\t\t// Find the file extension\n\t\t$ext = pathinfo($file, PATHINFO_EXTENSION);\n\n\t\t// Remove the extension from the filename\n\t\t$file = substr($file, 0, -(strlen($ext) + 1));\n\n\t\tif ($file = Kohana::find_file('js/formojs', $file, $ext))\n\t\t{\n\t\t\t// Send the file content as the response\n\t\t\t$this->request->response = file_get_contents($file);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Return a 404 status\n\t\t\t$this->request->status = 404;\n\t\t}\n\n\t\t// Set the proper headers to allow caching\n\t\t$this->request->headers['Content-Type'] = File::mime_by_ext($ext);\n\t\t$this->request->headers['Content-Length'] = filesize($file);\n\t\t$this->request->headers['Last-Modified'] = date('r', filemtime($file));\n\t}",
"public function optin_script_and_styles()\n {\n $custom_css = $this->get_customizer_value('form_custom_css');\n $custom_styles = '';\n\n $script = \"<script type=\\\"text/javascript\\\">{$this->optin_js_config()}</script>\";\n\n $styles = '<style class=\"mo-optin-form-stylesheet\" type=\"text/css\">';\n if (is_customize_preview()) {\n $styles .= $this->optin_form_css() . $this->global_css();\n } else {\n $styles .= mo_minify_css($this->optin_form_css() . $this->global_css());\n }\n $styles .= '</style>';\n $styles = apply_filters('mo_optin_form_css', $styles, $this->optin_campaign_uuid, $this->optin_campaign_id);\n\n if ( ! empty($custom_css)) {\n $custom_styles = '<style id=\"mo-optin-form-custom-css\" type=\"text/css\">';\n $custom_styles .= mo_minify_css($custom_css);\n $custom_styles .= '</style>';\n $custom_styles = apply_filters('mo_optin_form_custom_css', $custom_styles, $this->optin_campaign_uuid, $this->optin_campaign_id);\n }\n\n return $script . $styles . $custom_styles . $this->optin_script();\n }",
"protected function addAssets()\n\t\t{\n\t\t\t\t$document = JFactory::getDocument();\n\t\t\t\t/** load Css */\n\t\t\t\t$loadBootstrap = JSNUniformHelper::getDataConfig('load_bootstrap_css');\n\t\t\t\t$loadBootstrap = isset($loadBootstrap->value) ? $loadBootstrap->value : \"1\";\n\t\t\t\t$stylesheets = array();\n\t\t\t\t$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css');\n\t\t\t\tif ($loadBootstrap == 1)\n\t\t\t\t{\n\t\t\t\t\t\t$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/bootstrap/css/bootstrap.min.css');\n\t\t\t\t}\n\t\t\t\tif (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT']))\n\t\t\t\t{\n\t\t\t\t\t\t$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.ie.css');\n\t\t\t\t}\n\t\t\t\t$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/joomlashine/css/jsn-gui.css');\n\t\t\t\t//$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/font-awesome/css/font-awesome.css');\n\t\t\t\t$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-tipsy/tipsy.css');\n\t\t\t\t$document->addStyleSheet(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-daterangepicker/css/ui.daterangepicker.css');\n\t\t\t\t$document->addStyleSheet(JSN_UNIFORM_ASSETS_URI . '/css/form.css');\n\t\t\t\t/** end */\n\t\t\t\t/** Load Js */\n\t\t\t$getHeadData = JFactory::getDocument()->getHeadData();\n\t\t\t$checkLoadScript = true;\n\t\t\t$scripts = array();\n\t\t\tforeach ($getHeadData['scripts'] as $script => $option)\n\t\t\t{\n\t\t\t\t$scripts[$script] = $option;\n\t\t\t\tif ($script == JSN_UNIFORM_ASSETS_URI . '/js/form.js' || $script == JSN_UNIFORM_ASSETS_URI . '/js/submission.js')\n\t\t\t\t{\n\t\t\t\t\t$scripts[JSN_UNIFORM_ASSETS_URI . '/js/libs/daterangepicker.jQuery.compressed.js'] = $option;\n\t\t\t\t\t$scripts[JSN_UNIFORM_ASSETS_URI . '/js/submissions.js'] = $option;\n\t\t\t\t\t$checkLoadScript = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($checkLoadScript)\n\t\t\t{\n\t\t\t\t$document->addScript(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery/jquery-1.8.2.js');\n\t\t\t\t$document->addScript(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-ui/js/jquery-ui-1.9.0.custom.min.js');\n\t\t\t\t$document->addScript(JSN_UNIFORM_ASSETS_URI . '/js/libs/json-2.3.min.js');\n\t\t\t\t$document->addScript(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-tipsy/jquery.tipsy.js');\n\t\t\t\t$document->addScript(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/bootstrap/js/bootstrap.min.js');\n\t\t\t\t$document->addScript(JSN_UNIFORM_ASSETS_URI . '/js/libs/daterangepicker.jQuery.compressed.js');\n\t\t\t\t$document->addScript(JSN_UNIFORM_ASSETS_URI . '/js/submissions.js');\n\t\t\t}\n\t\t\telse if (!empty($scripts))\n\t\t\t{\n\t\t\t\t$getHeadData['scripts'] = $scripts;\n\t\t\t\tJFactory::getDocument()->setHeadData($getHeadData);\n\t\t\t}\n\t\t}",
"public function enqueue_payment_form_scripts() {\n\n\t}",
"protected function _injectScriptsAndStyles($response)\n {\n if (strpos($response->getType(), 'html') === false) {\n return $response;\n }\n $body = $response->getBody();\n\n //add scripts\n $pos = strrpos($body, '</body>');\n if ($pos !== false) {\n $script = '<script src=\"' . Router::url('/debug_http/js/highlight.min.js') . '\"></script>';\n $script .= '<script src=\"' . Router::url('/debug_http/js/clipboard.min.js') . '\"></script>';\n $body = substr($body, 0, $pos) . $script . substr($body, $pos);\n }\n\n //add styles\n $pos = strrpos($body, '</head>');\n if ($pos !== false) {\n $style = '<link rel=\"stylesheet\" type=\"text/css\" href=\"' . Router::url('/debug_http/css/requests.css') . '\">';\n $style .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"' . Router::url('/debug_http/css/highlight.min.css') . '\">';\n $body = substr($body, 0, $pos) . $style . substr($body, $pos);\n }\n\n return $response->withStringBody($body);\n }",
"public function finishForm(&$form)\n {\n // add a required note if needed\n if ( !empty($form->_required)\n && !$form->_freezeAll) {\n $this->_html .= str_replace('{requiredNote}', $form->getRequiredNote(), $this->_required_note_template);\n }\n // add form attributes and content\n $html = str_replace('{attributes}', $form->getAttributes(true), $this->_form_template);\n if (strpos($this->_form_template, '{hidden}')) {\n $html = str_replace('{hidden}', $this->_hidden_html, $html);\n } else {\n $this->_html .= $this->_hidden_html;\n }\n $this->_html = str_replace('{content}', $this->_html, $html);\n\n // add a validation script\n if ('' != ($script = $form->getValidationScript())) {\n $this->_html = $script . \"\\n\" . $this->_html;\n }\n }",
"private function add_styles_and_scripts() {\n\t\twp_enqueue_style( 'style.css', self::STYLES . 'style.css', [], self::VERSION );\n\n\t\twp_register_script(\n\t\t\t'event_scripts',\n\t\t\tself::SCRIPTS . 'event-scripts.js',\n\t\t\t[ 'jquery' ],\n\t\t\tself::VERSION,\n\t\t\tfalse\n\t\t);\n\t\twp_localize_script( 'event_scripts', 'myAjax', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ) ] );\n\n\t\twp_register_script(\n\t\t\t'calendar_scripts',\n\t\t\tself::SCRIPTS . 'calendar-scripts.js',\n\t\t\t[ 'jquery' ],\n\t\t\tself::VERSION,\n\t\t\tfalse\n\t\t);\n\t\twp_localize_script( 'calendar_scripts', 'myAjax', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ) ] );\n\n\t\twp_enqueue_script( 'jquery' );\n\t\twp_enqueue_script( 'event_scripts' );\n\t\twp_enqueue_script( 'calendar_scripts' );\n\n\t}",
"public function addCssAndJsToFE(){\n\t\t//Add Extension's JS file(s)\n\t\t$this->response->addAdditionalHeaderData('<script type=\"text/javascript\" src=\"' . 'typo3conf/ext/nkcadportal/Resources/Public/JavaScript/datatables.min.js' . '\"></script>');\n\t\t$this->response->addAdditionalHeaderData('<script type=\"text/javascript\" src=\"' . 'typo3conf/ext/nkcadportal/Resources/Public/JavaScript/nkcadportal.js' . '\"></script>');\n\n\t\t//Add Extension's CSS file(s):\n\t\t$this->response->addAdditionalHeaderData('<link type=\"text/css\" rel=\"stylesheet\" href=\"typo3conf/ext/nkcadportal/Resources/Public/Css/datatables.min.css\" />');\n\t\t$this->response->addAdditionalHeaderData('<link type=\"text/css\" rel=\"stylesheet\" href=\"typo3conf/ext/nkcadportal/Resources/Public/Css/nkcadportal.css\" />');\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Sets the Filesystem instance.
|
public function setFilesystem(FilesystemInterface $filesystem)
{
$this->filesystem = $filesystem;
}
|
[
"public function setFileSystem(Filesystem $fs)\n {\n $this->fileSystem = $fs;\n }",
"protected function getFilesystem(): Filesystem\n {\n return Filesystem::instance();\n }",
"protected function getFilesystem()\n {\n if (null === $this->filesystem) {\n $this->filesystem = new Filesystem();\n }\n\n return $this->filesystem;\n }",
"public function registerFilesystem() : void\n {\n $this->container->singleton('files', function () : Filesystem {\n return new Filesystem();\n });\n }",
"private function registerFileSystem()\n {\n $this->app->singleton('steroids.fileSystem', function($app)\n {\n return new Filesystem;\n });\n }",
"protected function setFileInstance()\n {\n $this->fileInstance = UploadedFile::getInstance($this->owner, $this->nameOfAttributeFile);\n }",
"public function setFs($fs)\n {\n $this->fs = $fs;\n return $this;\n }",
"protected function setFileInstance()\r\n {\r\n $this->fileInstance = UploadedFile::getInstance($this->owner, $this->nameOfAttributeFile);\r\n }",
"protected function registerFilesystem()\n {\n $this->container->bindShared('files', function () {\n return new Filesystem();\n });\n }",
"function filesystem(): \\Glowy\\Filesystem\\Filesystem\n {\n return new Filesystem();\n }",
"public function getFs(): Filesystem;",
"public function changeFilesystem(Filesystem $filesystem) {\n $this->filesystem = $filesystem;\n\n return $this;\n }",
"protected function setStorage()\n {\n $this->store = Storage::disk('local');\n }",
"protected function get787a79c940e7519357cde00935d657a813a0ce7c7b555cf3cb98d8c2263d18c6(): \\Viserio\\Component\\Filesystem\\Filesystem\n {\n return $this->services[\\Viserio\\Contract\\Filesystem\\Filesystem::class] = new \\Viserio\\Component\\Filesystem\\Filesystem();\n }",
"public function setFinder(FinderInterface $finder): FileSystemInterface;",
"public static function filesystem() : Filesystem\n {\n return static::$dan->filesystem;\n }",
"public function getFilesystem()\n {\n return $this->filesystem;\n }",
"public function getFileSystemObject()\n {\n $adapter = $this->getConfigurationObject()->getAdapter();\n /*\n * This is currently broken. The cache implementation in the file system\n * causes problems under high load because the files that are written\n * are huge.\n * @TODO - perhaps make this configurable and default to off? That way\n * we can reenable it if we're using a backend like memcache?\n $pool = \\Core::make(ExpensiveCache::class)->pool;\n $cache = new Psr6Cache($pool, 'flysystem-id-' . $this->getID());\n $cachedAdapter = new FlysystemCache($adapter, $cache);\n $filesystem = new \\League\\Flysystem\\Filesystem($cachedAdapter);\n */\n $filesystem = new Filesystem($adapter);\n\n return $filesystem;\n }",
"protected function addFilesystem()\n {\n // Add the key dinamically based on the tenant\n // Set the disk to be default?\n config(\n [\n $this->filesystemConfigKey() => $this->filesystemConfig(),\n 'medialibrary.disk_name' => $this->key(),\n ]\n );\n }",
"public static function getFilesystem()\n {\n return static::$filesystem;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
/ | |Function to check if given userID and Password are authorized |If it is the authorized user: returns $user_info array |$user_info['Email','Password','Username'] |
|
function user_auth($db, $email, $password, $user_info=null)
{
$query = "SELECT Email, Password, Lastname, Firstname FROM users
WHERE Email = '$email' && Password = '$password'";
$result = mysqli_query($db, $query);
if(mysqli_num_rows($result)>0)
{
while($row = mysqli_fetch_array($result))
{
$user_info = $row;
}
return $user_info;
}
else
{
//header('Location:login_form.php');
}
}
|
[
"public function validateUserInfoToLogin() {\r\n\r\n $email = $this->_user->getEmail();\r\n $password = $this->_user->getPassword();\r\n \r\n $errorFlag = false;\r\n \r\n // Validate email\r\n if (is_null($email)) {\r\n WarnLogger::write(\"Email is not requested.\");\r\n $errorFlag = true;\r\n \r\n } else if (!CheckUtil::checkEmail($email)) {\r\n InfoLogger::write(\"Email is invalid.\");\r\n $errorFlag = true;\r\n \r\n } else {\r\n \r\n }\r\n \r\n \r\n // Validate password\r\n if (is_null($password)) {\r\n WarnLogger::write(\"Password is not requested.\");\r\n $errorFlag = true;\r\n \r\n } else if (!CheckUtil::checkMinLength($password, $this->_userconstraints[\"password\"][\"min_length\"])) {\r\n InfoLogger::write(\"Password is too short.\");\r\n $errorFlag = true;\r\n \r\n } else if (!CheckUtil::checkMaxLength($password, $this->_userconstraints[\"password\"][\"max_length\"])) {\r\n InfoLogger::write(\"Password is too long.\");\r\n $errorFlag = true;\r\n \r\n } else if (!CheckUtil::checkPassword($password)) {\r\n InfoLogger::write(\"Password is invalid.\");\r\n $errorFlag = true;\r\n \r\n } else {\r\n \r\n }\r\n \r\n $result = array();\r\n \r\n if (!$errorFlag) {\r\n InfoLogger::write(\"User information is valid.\");\r\n $result = OutputUtil::getSuccessOutput();\r\n \r\n } else {\r\n InfoLogger::write(\"User information is invalid.\");\r\n $result = OutputUtil::getErrorOutput(array(USER_LOGIN_FAILURE_NONE));\r\n }\r\n \r\n return $result;\r\n }",
"function auth_user()\n\t{\n\t\tglobal $usr, $login;\n\t\t$login->verify();\n\n\t\tif ($login->userid != 0)\n\t\t{\n\t\t\t//set up $usr array\n\t\t\t$usr['userid'] = $login->userid;\n\t\t\t$usr['email'] = sqlValue(\"SELECT `email` FROM `user` WHERE `user_id`='\" . sql_escape($login->userid) . \"'\", '');\n\t\t\t$usr['username'] = $login->username;\n\t\t}\n\t\telse\n\t\t\t$usr = false;\n\n\t\treturn;\n\t}",
"function check_credentials($email,$password) {\r\n\t$pw_hash = get_hash($password);\r\n\t$sql = \"SELECT id FROM user WHERE email=:email AND password=:pw_hash\";\r\n\t$params = array(\":email\" => $email,\":pw_hash\"=>$pw_hash);\r\n\t$user_id = get_scalar($sql,$params);\r\n\tif ($user_id > 0) {\r\n\t\treturn $user_id;\r\n\t}\r\n\telse {\r\n\t\treturn 0;\r\n\t}\r\n}",
"protected function _checkCredentials()\n {\n $stmt = $this->_db->prepare('SELECT * FROM user WHERE mail=?');\n $stmt->execute(array($this->_email));\n\t\t\n \n\t\tif ($stmt->rowCount() > 0) \n\t\t{\n\n $user = $stmt->fetch(PDO::FETCH_ASSOC);\n $submitted_pass = md5($this->_password);\n if ($submitted_pass == $user['pas'])//pas = password \n\t\t\t{\n return $user;\n }\n }\n return false;\n }",
"private function _has_auth_data() {\r\n global $idb;\r\n\r\n $session_data = $this->_get_session();\r\n\r\n if (!$session_data)\r\n return false;\r\n\r\n $query = $idb->prepare(\"SELECT user_id \r\n FROM \" . DB_PREFIX . \"authentication \r\n WHERE \r\n session_id = %s \r\n AND \r\n session_id_ = %s\", $session_data[0], $session_data[1]);\r\n\r\n return $idb->get_var($query);\r\n }",
"public function authorize()\n {\n if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {\n return $this->send();\n }\n\n $user = Frapi_Model_Partner::isPartnerHandle($_SERVER['PHP_AUTH_USER']);\n\n if ($user === false) {\n return $this->send();\n }\n\n if ($user['api_key'] == $_SERVER['PHP_AUTH_PW']) {\n return $_SERVER['PHP_AUTH_USER'];\n } else {\n return $this->send();\n }\n }",
"private function _checkAuth() {\t\tif (! (isset ( $_SERVER ['HTTP_X_USERNAME'] ) and isset ( $_SERVER ['HTTP_X_PASSWORD'] ))) {\n\t\t\t// Error: Unauthorized\n\t\t\t$this->_sendResponse ( 401 );\n\t\t}\n\t\t$username = $_SERVER ['HTTP_X_USERNAME'];\n\t\t$password = $_SERVER ['HTTP_X_PASSWORD'];\n\t\t// Find the user\n\t\t$user = UserDetails::model ()->find ( 'number=?', array (\n\t\t\t\t$username \n\t\t) );\n\t\tif ($user === null) {\n\t\t\t// Error: Unauthorized\n\t\t\t$this->_sendResponse ( 401, 'Error: User Name is invalid' );\n\t\t} else if (! $user->validatePassword ( $password )) {\n\t\t\t// Error: Unauthorized\n\t\t\t$this->_sendResponse ( 401, 'Error: User Password is invalid' );\n\t\t}\n\t}",
"function user_in_user($username, $password)\n{\n $fields = array(\"username\", \"password\");\n $values = array($username, $password);\n $row = get(\"user\", $fields, $values);\n if ($row == false) return false;\n return true;\n}",
"function check_user($username, $password) {\n global $__CLIENT_ID;\n $userObj = find_object('user', array('username' => $username, 'client_id' => $__CLIENT_ID));\n return generateHash($password, $userObj->pass) == $userObj->pass ? $userObj : NULL;\n}",
"function checkUserCredentials(string $dsn, string $username, string $pass)\n{\n $db = connectToDatabase($dsn);\n // Prepare the SQL statement\n $sql = \"SELECT Username, Password FROM User\";\n $stmt = $db->prepare($sql);\n $stmt->execute();\n\n $users = $stmt->fetchAll(PDO::FETCH_ASSOC);\n foreach ($users as $user) {\n // echo \"User: {$user['Username']}/$username {$user['Password']}/$passHash <br> \";\n if ($user['Username'] == $username && password_verify($pass, $user['Password'])) {\n $_SESSION['logedin'] = true;\n break;\n }\n }\n $_SESSION['logedin'] = $_SESSION['logedin'] ?? false;\n return null;\n}",
"function authorize($user, $password){\n /* Take the username and password and escape them to prevent SQL injection*/\n $user=$this->DB->scrubVar($user);\n $password=$this->DB->scrubVar($password);\n\n /* Prepare query for database */\n $sql=\"SELECT `uid`, `username`, `password`, `type` FROM `users` \"\n .\"WHERE `disabled`=0 AND `username`='\".$user.\"' AND password='\"\n .mysql_real_escape_string($this->Crypto->encrypt($password)).\"' \"\n .\"LIMIT 1\";\n\n /* Execute query and return the results */\n $check=$this->DB->execute($sql);\n\n if($check){\n /* If we get a result, set the session variables\n (session_start() needs to be called before this happens, otherwise\n there will be errors, pain, death, weaping, gnashing of teeth, etc */\n $row=mysql_fetch_array($check);\n $_SESSION['UID']=$row['uid'];\n $_SESSION['SUID']=$row['username'];\n $_SESSION['SSID']=$row['password'];\n $_SESSION['TYPE']=$row['type'];\n /* Return 'YES' */\n return true;\n }else{\n /* Return 'NO'...no authorization for you! */\n return false;\n }\n }",
"function checkIfValidUserAndPasswordWithHttpBasicAuth()\n{\n $con = getMySqliConnection();\n\n $myusername = mysqli_real_escape_string($con,$_SERVER['PHP_AUTH_USER']);\n $mypassword = mysqli_real_escape_string($con,$_SERVER['PHP_AUTH_PW']);\n //encrypt password\n $mypassword = md5($mypassword);\n\n $sql = \"\";\n $sql .= \"SELECT * \";\n $sql .= \"FROM members \";\n $sql .= \"WHERE username = '$myusername' \";\n $sql .= \" AND PASSWORD = '$mypassword' \";\n $sql .= \" AND active = 1 \";\n\n $result = mysqli_query($con,$sql);\n\n if ($result != FALSE) {\n $count = mysqli_num_rows($result);\n }\n mysqli_close($con);\n // Mysql_num_row is counting table row\n\n\n // If result matched $myusername and $mypassword, table row must be 1 row\n\n if ($count == 1) {\n return true;\n }\n else\n {\n return false;\n }\n}",
"public function performAuth($user_id,$password);",
"function Authenticate_User($email,$password,$pdo)\n\t{\n\t\t\n\t\t$userDetails = null;\n\t\t\n\t\t// Get salt then hash password\n\t\t$salt = Get_Salt($email,$pdo);\n\t\t\t\t\n\t\tif(isset($salt))\n\t\t{\n\t\t\t$encrypted_Pass = encrypt($password,$salt);\n\t\t\t\n\t\t\t$stmt = $pdo->prepare(\"SELECT ID,RenewalDate,Active,DevicesLeft,Registration FROM homeUsers.users WHERE email=:email AND password=:password\");\n\t\t\t$stmt->bindParam(\":email\", $email);\n\t\t\t$stmt->bindParam(\":password\" , $encrypted_Pass);\n\t\t\t$stmt->execute();\n\t\t\t$result = $stmt->fetch();\n\t\t\t\n\t\t\techo $result['ID'];\n\t\t\t\n\t\t\tif(isset($result['ID']))\n\t\t\t{\n\t\t\t\t$userDetails = array();\n\t\t\t\t$userDetails['active'] = $result['Active']; \n\t\t\t\t$userDetails['userId'] = $result['ID']; \n\t\t\t\t$userDetails['DevicesLeft'] = $result['DevicesLeft'];\n\t\t\t\t$userDetails['RenewalDate'] = $result['RenewalDate'];\n\t\t\t\t$userDetails['Registration'] = $result['Registration'];\n\t\t\t\t$userDetails['Email'] = $email;\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $userDetails;\n\t\t\n\t}",
"function check_data($our_user, $our_user_pass) {\n $session_name = $_SESSION['user'];\n $session_pass = $_SESSION['password'];\n if ($session_name === $our_user && $session_pass=== $our_user_pass) {\n return 1;\n } else {\n return 0;\n }\n}",
"private function _getUserCredential() {\r\n\r\n\t\t\t$userPassFile = file_get_contents(USER_PASS_FILE);\r\n\t\t\t$matches = preg_match_all('/'.$this->_identity.':(.*)?:(.*)?/', $userPassFile, $matchesArray);\r\n\t\t\tif($matches>0) {\r\n\t\t\t\treturn array('_credential'=>$matchesArray[1][0],'salt'=>$matchesArray[2][0]);\r\n\t\t\t} else {\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t}",
"protected function checkCredentials()\n {\n // perulangan foreach untuk setiap email, password yang ada di data user\n foreach($this->_dataUser as $key => $value) {\n // mengecek apakah value email dan password pada data sama dengan isi parameter dari constructor\n if($value->email == $this->email && $value->password == $this->password) {\n // mengembalikan value berisi email, password, dan role\n return $value;\n }\n }\n // mengembalikan boolean false\n return false;\n }",
"private function verifyAccount()\n {\n $check = $this->db->query('SELECT users.password, users.id FROM users WHERE username = ?', $this->username)->fetchArray();\n //Check of de user in de database staat.\n if (isset($check['password'])) {\n //Check of de password matched\n if (password_verify($this->password, $check['password'])) {\n echo \"AUTH verify complete\";\n $this->setLoggedinUser($check['id']);\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n }",
"function Aastra_check_user_login_Asterisk($user,$password)\n{\n# True by default\n$return=True;\n\n# Retrieve configuration\n$array=Aastra_get_user_info_Asterisk($user);\n\n# User exists?\nif($array==NULL) $return=False;\nelse\n\t{\n\tif($array['password']!=$password) $return=False;\n\t}\n\n# Return result\nreturn($return);\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Handle the titles "deleted" event.
|
public function deleted(Titles $titles)
{
$this->updateHasChange($titles,2);
}
|
[
"public function whenSongWasDeleted($event)\n {\n $message = 'deleted this song';\n $this->setActivity($event->song->id, $event->editor->id, $message, 'danger');\n }",
"public function handleDelete($year)\n\t{\n\t\t$item = $this->loadItem($year);\n\t\t$item->delete();\n\t\t$this->flashMessage(\"Zápis historie z roku $year byl úspěšně vymazán.\");\n\t\t$this->redirect('default');\n\t}",
"public function deleted()\n {\n $songs = $this->song->deleted();\n\n $this->layout->content = View::make('songs.deleted', compact('songs'));\n }",
"public function deleteAction(Title $title) {\n\t\t$this->titleRepository->remove($title);\n\t\t$this->addFlashMessage('Deleted a title.');\n\t\t$this->redirect('index');\n\t}",
"protected function getDeleteTitle()\n {\n return 'delete-vehicles';\n }",
"public function deleteHandler()\n {\n $this->controller->deleteArticle($this->post['id'], $this->session);\n }",
"public function handleNavDeleted(NavDeleted $event)\n {\n $this->addEntry(\"Deleted navigation '\".$event->nav->title().\"' (handle: '\".$event->nav->handle().\"')\");\n }",
"function OnAfterDeleteItem(){\n }",
"public static function onContentDelete($event)\n {\n\n foreach (models\\Comment::find()->where(['object_model' => $event->sender->className(), 'object_id' => $event->sender->id])->all() as $comment) {\n $comment->delete();\n }\n }",
"public function beforeHandleDelete () {\n\t\t\t\n\t\t}",
"protected function afterDelete() {}",
"protected function onDeleted($instance)\n {\n\n }",
"function title()\n {\n return _('Delete notice');\n }",
"public function deleteTitleProtection()\n {\n $dbw = wfGetDB(DB_MASTER);\n \n $dbw->delete(\n 'protected_titles', \n array('pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey()), \n __METHOD__);\n }",
"public function delete_posts_row_action_title( $title ) {\n\t\treturn __( 'Delete posts imported by this feed source', WPRSS_TEXT_DOMAIN );\n\t}",
"public function onBeforeDelete()\n {\n /** @var DataObject|\\Page $owner */\n $owner = $this->owner;\n SearchIndexEntry::unindexRecord($owner);\n }",
"public function deleteTitle($title) {\n\t\t$db = $this->db;\n\t\t$stmt = $db->prepare(\"DELETE from pages WHERE title=?\");\n\t\treturn $stmt->execute(array($title));\n\t}",
"public function deleted($chapter)\n {\n parent::deleted($chapter);\n\n Log::Info(\"Deleted chapter\", ['chapter' => $chapter->id, 'volume' => $chapter->volume->id, 'collection' => $chapter->collection->id]);\n }",
"public function onPreDelete(StorageEvent $event)\n {\n $entity = $event->getContent();\n if (!$entity instanceof Entity\\Content) {\n return;\n }\n $taxonomies = $entity->getTaxonomy();\n if ($taxonomies instanceof Collection\\Taxonomy) {\n $repo = $this->em->getRepository(Entity\\Taxonomy::class);\n foreach ($taxonomies as $taxonomy) {\n $repo->delete($taxonomy);\n }\n }\n $relations = $entity->getRelation();\n if ($relations instanceof Collection\\Relations) {\n $repo = $this->em->getRepository(Entity\\Relations::class);\n foreach ($relations as $relation) {\n $repo->delete($relation);\n }\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Ensures that the validator rejects an object.
|
public function testIsValidReturnsFalseForObject()
{
$this->assertFalse($this->validator->isValid(new stdClass()));
}
|
[
"public function validate()\r\n {\r\n if ($this->isInvalid())\r\n {\r\n throw new Object\\Exception(\"object \" . get_class($this) . \" is not valid: \\n\" . print_r($this->getValidationErrors(),true));\r\n }\r\n\r\n return true;\r\n }",
"private function validateObject( $object )\n {\n if ( !$this->logger->wasErrorLogged() )\n {\n try\n {\n $object->validate();\n }\n catch ( InvalidArgumentException $x )\n {\n $this->log( NULL, $x );\n }\n }\n }",
"public function isNotAnObject()\n {\n $this->failIf(is_object($this->data[0]));\n }",
"protected static function ensureValid($obj) {\n\t\t$errors = array();\n\t\tif( !$obj->isValid($errors) ) {\n\t\t\tif( count($errors) == 1 ) {\n\t\t\t\t$keys = array_keys($errors);\n\t\t\t\tif( count($errors[$keys[0]]) == 1 ) {\n\t\t\t\t\t//Only one error\n\t\t\t\t\t$msg = $errors[$keys[0]][0];\n\t\t\t\t\tif( !$msg ) $msg = \"Not valid\";\n\t\t\t\t\tthrow new RestException($keys[0], $msg);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Need a multi-exception\n\t\t\tthrow new RestMultiException($errors, \"Not valid\");\n\t\t}\n\t}",
"public static function invalidObject($object, $method);",
"public function validateOrFail() {\n\t\tif (!$this->class) {\n\t\t\tthrow new NotPossibleException(static::class.': domain class is not defined.');\n\t\t}\n\t}",
"public function testValidateCollectionPageInvalidObject()\n {\n $this->expectException(Exception::class);\n\n Util::validateCollectionPage(new ObjectType());\n\t}",
"protected function validateOrThrow() {}",
"public function testValidatorProvidesMessageIfInvalidValueIsProvided()\n {\n $this->validator->isValid(new stdClass());\n $this->assertFailureMessage();\n }",
"public function validate()\n {\n parent::validate();\n\n $to = $this->getTo();\n if (!($to instanceof Person)) {\n throw new InvalidDocumentException(\"The to parameter must be a Person object\");\n }\n $to->validate();\n }",
"public function constrain($instance, ValidationException $exception = null);",
"public function validateObject(Validatable $object)\r\n {\r\n $this->_schema = $object->getSchema();\r\n $this->_data = $object->getData();\r\n return $this->validate();\r\n }",
"public function throws()\n {\n if (!$this->isValid()) {\n throw new ValidationException($this);\n }\n }",
"public static function invalidUserObject() : UserException\n {\n return (new UserException(\"Invalid user object\"));\n }",
"public function testInvalid()\n {\n $constraint = new MBVSingle();\n $validator = $this->configureValidator($constraint->message);\n\n $validator->validate('test@example.com', $constraint);\n }",
"public function testValidateCollectionPageInvalidObject()\n {\n $this->assertEquals(\n false, \n Util::validateCollectionPage(new ObjectType())\n );\n\t}",
"public function testSettingInvalidInputObjectWithoutValidation()\n {\n $config = new Config();\n $config->setSchema($this->schema);\n $data = (object) [\n 'objectNode' => (object) [\n 'invalidNode' => 123\n ],\n ];\n $config->setData($data, false);\n $this->assertEquals($data, $config->getData());\n }",
"public function creatingResourceWithInvalidTypeOfResourceObject()\n {\n // Creates an object with filled out fields\n $model = factory(Photo::class)->make();\n $model->setAttribute('PHOTO_ID', 1);\n\n // Creates content of the request\n $content = [\n Members::DATA => [\n Members::TYPE => 'badType',\n Members::ATTRIBUTES => $model->attributesToArray()\n ]\n ];\n\n // Sends request and gets response\n $response = $this->jsonApi('POST', route('photos.store'), $content);\n\n // Check response\n $response->assertJsonApiResponse409([\n [\n Members::ERROR_STATUS => '409',\n Members::ERROR_TITLE => JsonResponse::$statusTexts[409],\n Members::ERROR_DETAILS => \"The given data was invalid.\\nThe selected data.type is invalid.\"\n ]\n ]);\n\n // Checks the database\n $this->assertDatabaseMissing($model->getTable(), $model->attributesToArray());\n }",
"public function testFailWhenUnitOfWorkIsNotAValidObject(): void\n {\n $constraint = new DoctrineUnitOfWorkEmpty();\n\n $this->expectException(AssertionFailedError::class);\n $this->expectExceptionMessage('Supplied object is not a valid UnitOfWork instance.');\n\n $constraint->evaluate(new stdClass());\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns all defined properties
|
public function getProperties();
|
[
"public function getAllProperties()\n {\n return $this->_properties;\n }",
"public function getAllProperties(): array;",
"public static function getProperties();",
"public function getProphecies() {}",
"public function properties()\n\t{\n\t\treturn $this->properties;\n\t}",
"public function getProperties()\n {\n return $this->properties;\n }",
"public function list_properties() {\n \tforeach ($this as $property => $value) {\n \t\techo \"$property => $value<br>\\n\";\n }\n }",
"public function getProperties() {\n\t\t$reflect = new ReflectionClass($this);\n\t\t$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);\n\t\t$ogProperties = array();\n\t\t/*\n\t\tforeach ($props as $property) {\n\t\t\t$name = $property->getName();\n\t\t\t$value = $reflect->getProperty($name)->getValue($this);\n\t\t\tif (!empty($value)) {\n\t\t\t\t$ogProperties[$name] = $value;\n\t\t\t}\n\t\t}\n\t\t*/\n\t\tforeach ($this->allowedFields as $key => $value) {\n\t\t\tif (!empty($value)) {\n\t\t\t\t$ogProperties[$key] = $value;\n\t\t\t}\n\t\t}\n\t\treturn $ogProperties;\n\t}",
"function getProperties() // {{{\n {\n #if (!$this->isRead && $this->isPersistent) {\n # $this->read();\n #}\n return $this->properties;\n }",
"protected function getProperties(){\n\t\treturn $this->reflectionClass->getProperties(ReflectionProperty::IS_PRIVATE | ReflectionProperty::IS_PROTECTED);\n\t}",
"public function getProperties() {\n\t\treturn (isset($this->configuration['properties']) ? $this->configuration['properties'] : array());\n\t}",
"protected function getProperties()\n {\n return (new Collection((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC)))\n ->sortBy('name');\n }",
"public function getProperties(): PropertiesCollection;",
"public static function getProperties()\n {\n return [\n 'ID' => [true, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Name' => [true, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Description' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'ClientOrderNumber' => [false, self::PROPERTY_TYPE_STRING, null, false, false],\n 'Tasks' => [false, self::PROPERTY_TYPE_OBJECT, 'PracticeManager\\\\Invoice\\\\Task', true, false],\n 'Costs' => [false, self::PROPERTY_TYPE_OBJECT, 'PracticeManager\\\\Invoice\\\\Cost', true, false],\n ];\n }",
"public function getPropertiesList()\n {\n $mapPropertiesNames = array_keys($this->getEntityMap()->getMap());\n\n return array_filter($this->getProperties(), function($property) use ($mapPropertiesNames) {\n /** @var \\ReflectionProperty $property */\n return in_array($property->getName(), $mapPropertiesNames, true);\n });\n }",
"private function reflectProperties()\n {\n $reflectObj = new \\ReflectionClass($this);\n $properties = [];\n foreach($reflectObj->getProperties() as $property) {\n $property->setAccessible(true);\n if(!in_array($property->name, ['orm', 'table', 'id', 'relations'])) {\n $properties[$property->name] = $property->getValue($this);\n }\n }\n return $properties;\n }",
"final public function getProperties()\n\t{\n\t\t$properties = array();\n\t\tforeach ($this->Reflection->getProperties() as $property)\n\t\t{\n\t\t\tif ($this->isControllerProperty($property) && !$this->isHiddenProperty($property))\n\t\t\t{\n\t\t\t\t$name = $property->name;\n\t\t\t\t$properties[$name] = $this->$name;\n\t\t\t}\n\t\t}\n\t\treturn $properties;\n\t}",
"protected function properties() {\n $database = Database::instance();\n $properties = array();\n foreach (static::$db_table_fields as $db_field) { \n if(property_exists($this, $db_field)) { \n $properties[$db_field] = $this->$db_field;\n $properties[$db_field] = $database->escape($properties[$db_field]); \n } \n } \n return $properties; \n }",
"public function accessProperties()\n\t{\n\t\t$properties = $this->getProperties([T_EXTENDS, T_USE]);\n\t\tforeach ($properties as $property) {\n\t\t\tif (!$property->isPublic()) {\n\t\t\t\t$property->setAccessible(true);\n\t\t\t}\n\t\t}\n\t\treturn $properties;\n\t}",
"public static function &getProperties() {\n return self::$properties;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the item template
|
public function getItemTemplate()
{
return $this->itemTemplate;
}
|
[
"protected function getItemTemplate() {\n // Creates the template configuration manager\n $templateConfigurationManager = GeneralUtility::makeInstance('SAV\\\\SavLibraryPlus\\\\Managers\\\\TemplateConfigurationManager');\n $templateConfigurationManager->injectTemplateConfiguration($this->getLibraryConfigurationManager()->getSpecialViewTemplateConfiguration());\n $itemTemplate = $templateConfigurationManager->getItemTemplate(); \n \n return $itemTemplate; \n }",
"public function getItemTemplate()\n {\n return new BackendTemplate($this->itemTemplate ?: 'fineuploader_item_backend');\n }",
"public function getTemplate();",
"public function default_mustache_item_template(){\n\t\t?>\n\t\t<div class=\"item col-xs-6 col-sm-4\">\n\t\t\t<h5 class=\"title\">\n\t\t\t\t<a href=\"{{link}}\">\n\t\t\t\t\t{{title.rendered}}\n\t\t\t\t</a>\n\t\t\t</h5>\n\t\t\t\n\t\t\t{{#excerpt}}\n\t\t\t<div class=\"excerpt\">\n\t\t\t\t{{excerpt.rendered}}\n\t\t\t</div>\n\t\t\t{{/excerpt}}\n\t\t\t\n\t\t\t{{#_embedded.wp:featuredmedia.0.source_url}}\n\t\t\t<img src=\"{{_embedded.wp:featuredmedia.0.source_url}}\">\n\t\t\t{{/_embedded.wp:featuredmedia.0.source_url}}\n\t\t\t\n\t\t\t<div class=\"read-more-container\">\n\t\t\t\t<a href=\"{{link}}\" class=\"read-more\">Read More</a>\n\t\t\t</div>\n\t\t</div>\n\t\t<?php\n\t}",
"abstract protected function getTemplate();",
"public function template() { return $this->data; }",
"public function getTemplate(){\n return $this->string;\n }",
"public function getTemplate() : string\n {\n $rtn = $this->data['template'];\n\n return $rtn;\n }",
"public function getFieldTypeRelationshipItemTemplate()\n {\n return \"'<div>' + item.{$this->resource->getTitleColumn()} + '</div>'\";\n }",
"public function getItemLabelTemplate($item = '')\n {\n return $this->_getTemplate($this->_itemLabelTemplate, $item);\n }",
"function getXTemplate() {\n return $this->xTemplate;\n}",
"abstract protected function getTemplateTemplate() : string;",
"public function getMentionProviderItemTemplate();",
"private function getTemplateContent()\r\n {\r\n return $this->template;\r\n }",
"public function getHtmlTemplate();",
"public function getItemRowTemplate($item = '')\n {\n return $this->_getTemplate($this->_itemRowTemplate, $item);\n }",
"public function getTemplateDefault();",
"public function getMetatagItem() {\n return new Item([\n 'project_id' => 86701,\n 'template_id' => 823399,\n ]);\n }",
"public function getTemplateObject()\t\t\t\t\t{\treturn $this->mTemplateObject;\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get productDesc value An additional test has been added (isset) before returning the property value as this property may have been unset before, due to the fact that this property is removable from the request (nillable=true+minOccurs=0)
|
public function getProductDesc()
{
return isset($this->productDesc) ? $this->productDesc : null;
}
|
[
"public function getProductDesc()\n {\n return $this->productDesc;\n }",
"public function getProdDescription()\n {\n return $this->prod_description;\n }",
"public function getProdDesc()\n {\n return $this->getParameter('ProdDesc');\n }",
"public function getProductDescription()\n {\n return $this->_fields['ProductDescription']['FieldValue'];\n }",
"public function getProductDescription() {\n return $this->productDescription;\n }",
"public function get_product_description(){\n return $this->v_product_description;\n }",
"public function issetProductDescription(): bool\n {\n return isset($this->productDescription);\n }",
"public function getProductDescription() {\n if (isset($this->product)) {\n return $this->product->getDescription();\n }\n return \"\";\n }",
"public function product_has_description( ){\n\t\tif( $this->description )\t\t\t\t\t\t\t\treturn true;\n\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\treturn false;\t\n\t}",
"public function getProduct() {\n return $this->getValueOrDefault('Product');\n }",
"public function getProductDescription() {\n return $this->DsMerchantProductDescription;\n }",
"public function testGetDescription()\n {\n $this->assertEquals($this->product->getDescription(), self::DESCRIPTION);\n }",
"public function getProdutoUnidadeDesc(){\n return $this->ProdutoUnidadeDesc;\n }",
"public function getdescriptionProduit()\n {\n return $this->descriptionProduit;\n }",
"public function getProduct()\r\n {\r\n return $this->fields['Product']['value'];\r\n }",
"public function getDescrip_pro(){\n return $this->descrip_pro;\n }",
"function getDesc() {\n\t\treturn $this->_Desc;\n\t}",
"public function getDesc()\n {\n $value = $this->get(self::desc);\n return $value === null ? (string)$value : $value;\n }",
"public function getDesc()\n {\n return $this->Desc;\n }",
"public function hasProduct()\r\n {\r\n return !empty($this->fields['Product']['value']);\r\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
/ Inventory Setting : Show Location List
|
public function getLocation()
{
$this->setPageHeader('Inventory', 'Location List');
$location = new Location();
$locations = $location->all();
return view('admin.inventory.location')
->with('locations', $locations);
}
|
[
"public function locationList () {\n\t\t$args = array();\n\n\t\treturn $this->getData('location/list', $args);\n\t}",
"public function testGETInventoryReturnLocations()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"function writeLocationList(){\n\t\t$handler = new DBHandler();\n\t\techo '<option value=\"0\">---</option>';\n\t\t$total = $handler->getLocationCount();\n\t\tif($total > 0){\n\t\t\t$list = $handler->getLocationList();\n\t\t\tfor($i = 0;$i < $total;$i += 1){\n\t\t\t\techo '<option value=\"' . $list[$i][0] . '\">' . $list[$i][1] . ' - ' . $list[$i][2] . '</option>';\n\t\t\t}\n\t\t}\n\t}",
"public static function stores_locations_choices()\n {\n //get_address_list_for_cms_chocies\n global $json_api;\n $result = VendorRequest::get_address_list_for_cms_chocies($json_api->query->id);\n api_handler::outSuccessData($result);\n }",
"public function locations() {\n echo $this->load->view('location/locations', array(\n 'locations' => $this->location_model->get_all()\n ), TRUE);\n }",
"function listLocation()\n{\n return \"SELECT location, location_address, location_main_phone, location_ID FROM locations WHERE is_deleted = 0 ORDER BY location ASC;\";\n}",
"protected function get_display_locations() {\n\n\t\treturn get_option( 'sv_wc_apple_pay_display_locations', array() );\n\t}",
"public function testGETInventoryModelIdInventoryReturnLocations()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"function HandleLocations()\n {\n echo\n $this->LocationsObj()->UnitLocationsHtmlTable($this->ApplicationObj->Unit);\n }",
"function admin_index() {\r\n\t\t// this tells cake to ignore related Location data such as dvds\r\n\t\t$this->Location->recursive = 0;\r\n\t\r\n\t\t// get all locations from database where status = 1\r\n\t\t$locations = $this->Location->findAll(\"status=1\");\r\n\t\r\n\t\t// save the locations in a variable for the view\r\n\t\t$this->set('locations', $locations);\r\n\t}",
"public function equipementlocationListerTous()\n\t{\n\t\t// votre code ici\n\t\treturn gestion::lister(\"EquipementLocation\");//type array\n\t}",
"function findUserAccessibleLocationList() {\n\t\t$locs = $this->Trip->find('all', array(\n\t\t\t\t'conditions' => array('Location.is_visible' => 1, 'Trip.is_visible' => 1),\n\t\t\t\t'fields' => array('location_id', 'Location.name'),\n\t\t\t\t'contain' => array('Location.is_visible', 'Location.name')\n\t\t));\n\t\t$locIds = Set::extract('/Trip/location_id', $locs);\n\t\t$locNames = Set::extract('/Location/name', $locs);\n\t\t$locs = array_combine($locIds, $locNames);\n\t\treturn $locs;\n\t}",
"public function locationsAction() {\r\n $config = new Zend_Config_Xml('http://finds.org.uk/info/sitemap/databaseconfig','locations');\r\n $navigation = new Zend_Navigation($config);\r\n $this->view->navigation($navigation);\r\n $this->view->navigation()\r\n ->sitemap()\r\n ->setFormatOutput(true); // default is false\t\r\n }",
"public function showLocation($atts) {\n global $gssi_location_settings;\n $atts = shortcode_atts(array(\n 'template' => $gssi_location_settings['template_id'],\n 'start_location' => '',\n 'auto_locate' => '',\n 'category' => '',\n 'category_selection' => '',\n 'category_filter_type' => '',\n 'checkbox_columns' => '3',\n 'map_type' => '',\n 'start_marker' => '',\n 'location_marker' => ''\n ), $atts);\n $this->checkSlShortcodeAtts($atts);\n // Make sure the required scripts are included for the gssi_location shortcode.\n array_push($this->load_scripts, 'gssi_location');\n $output = include( GSSI_LOCATION_PLUGIN_DIR . 'includes/frontend/templates/locations.php' );\n return $output;\n }",
"function viewAll() \n\t{\n\t\t//might move this to mlocation.php \n\t\t\n\t\t$location = new MLocation();\n\t\t$result = $location->listLocations();\n\t\t\n\t\t//dont know if first count should be 1 or 0. Ask Thomas for this. Done\n\t\t//Answer: 0 is the first place in a select class. \n\t\t$i=0;\n\t\tforeach ( $result as $res ) {\n\t\t\t$options[$i] = '<option value=' . $i . '>' . $res['name'] . '</option>';\n\t\t\t$i++;\r\n\t\t}\n\t return $options;\n\t}",
"function inventory_location_func() {\n\tinclude_once('templates/location.php');\t\n}",
"function populateLocationDropdown($locations)\n{\n $result=\"\";\n foreach ($locations as $loc)\n {\n $result .= '<li value=\"' . $loc->getId() . '\" name=\"' . $loc->getBuilding() . '.' . $loc->getFloor() . '.' . $loc->getRoom() . '\"><a href=\"#\">' . $loc->getBuilding() . '.' . $loc->getFloor() . '.' . $loc->getRoom() . '</a></li>';\n }\n return $result;\n}",
"function show_all_location() {\n global $db;\n\n $sql = \"SELECT * FROM `locations`\";\n $result = mysqli_query($db, $sql);\n confirm_result_set($result);\n return $result;\n }",
"public function equipementlocationListerTous()\n\t{\n\t\t// votre code ici\n\t\treturn Gestion::lister(\"EquipementLocation\");//type array\n\t}",
"function action_manageLocations() {\r\n $this->template->title = __('Admin: Locations');\r\n $this->template->heading = __('Admin: Locations');\r\n $this->template->subheading = __('Manage Ticket Sale Locations and their prefixes (used for registration ID generation)');\r\n \r\n $this->genericManageEntity('Location', 'Locations'); \r\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Check that user md5 has a MD5 hashed password
|
public function test_has_md5() {
$this->assertTrue( yourls_has_md5_password('md5') );
$this->assertTrue( yourls_has_md5_password('random_md5') );
$this->assertFalse( yourls_has_md5_password(rand_str()) );
}
|
[
"function canMd5()\n {\n return false; // ?? Is this correct? can we store passwords as md5 in ldap?\n }",
"public function test_valid_md5() {\n // Check if users have md5'd passwords\n $this->assertTrue( yourls_has_md5_password( 'random_md5' ) );\n\n // Check that md5 hashed passwords match the password\n $this->assertTrue( yourls_check_password_hash( 'random_md5', self::$random_password ) );\n\n // Unknown user, existing password\n $this->assertFalse( yourls_check_password_hash( rand_str(), self::$random_password ) );\n\n // Known user, invalid password\n $this->assertFalse( yourls_check_password_hash( 'md5', rand_str() ) );\n }",
"function verify_md5(&$md5)\n\t{\n\t\treturn (strlen($md5) == 32 AND preg_match('#^[a-f0-9]{32}$#', $md5));\n\t}",
"public function is_password_md5() {\r\n return $this->password_md5;\r\n }",
"protected function isMd5Password($password) {\n\t\treturn (bool) preg_match('/[0-9abcdef]{32,32}/i', $password);\n\t}",
"protected function nativeLoginMd5()\n {\n $_sql_librarian_login = sprintf(\"SELECT\n u.user_id, u.username,\n u.realname, u.groups\n FROM user AS u\n WHERE u.username='%s'\n AND u.passwd=MD5('%s')\", $this->obj_db->escape_string($this->username), $this->obj_db->escape_string($this->password));\n $_user_q = $this->obj_db->query($_sql_librarian_login);\n // error check\n if ($this->obj_db->error) {\n $this->errors = 'Failed to query user data from database with error: ' . $this->obj_db->error;\n return false;\n }\n // result check\n if ($_user_q->num_rows < 1) {\n $this->errors = 'Username or Password not exists in database!';\n return false;\n }\n return true;\n }",
"function is_md5($md5 =''){\n\n\t if(preg_match('/^[a-f0-9]{32}$/', $md5) == 1){\n\n\t \treturn true;\n\t \t\n\t }else{\n\n\t \treturn false;\n\t }\n\n\t}",
"public function testSaltMD5() {\n\t\t$this->skipIf(!CRYPT_MD5, 'MD5 is not supported.');\n\n\t\t$saltPattern = \"{^\\\\$1\\\\$[0-9A-Za-z./]{8}$}\";\n\t\t$hashPattern = \"{^\\\\$1\\\\$[0-9A-Za-z./]{8}\\\\$[0-9A-Za-z./]{22}$}\";\n\n\t\t$salt = Password::salt('md5', null);\n\t\t$this->assertPattern($saltPattern, $salt);\n\t\t$this->assertNotEqual($salt, Password::salt('md5', null));\n\n\t\t$hash = Password::hash($this->_password, $salt);\n\t\t$hash2 = Password::hash($this->_password, Password::salt('md5', null));\n\t\t$this->assertPattern($hashPattern, $hash);\n\t\t$this->assertNotEqual($hash, $hash2);\n\t}",
"public static function isMD5( $value )\n\t{\n\t\tif (preg_match( \"/^[0-9a-f]{32}$/i\", $value )) {\n\t\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}",
"public function getPasswordMd5()\n {\n return md5($this->getValue('factfinder/search/auth_password'));\n }",
"function return_md5_check()\n\t{\n\t\tglobal $ibforums;\n\n\t\tif ($ibforums->member['id'])\n\t\t{\n\t\t\treturn md5($ibforums->member['email'] . '&' . $ibforums->member['password'] . '&' . $ibforums->member['joined']);\n\t\t} else\n\t\t{\n\t\t\treturn md5(\"this is only here to prevent it breaking on guests\");\n\t\t}\n\t}",
"protected function isMd5Password($password)\n {\n return (bool)preg_match('/[0-9abcdef]{32,32}/i', $password);\n }",
"function is_md5($_string) {\n\treturn preg_match('/^[A-Fa-f0-9]{32}$/', $_string);\n}",
"public function checkMd5 () {\n\t\tif (!$this->md5Hash) {\n\t\t\ttrigger_error('MD5 hash can not be false', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!BOO_AUTHORIZE_NET_MD5) {\n\t\t\ttrigger_error('BOO_AUTHORIZE_NET_MD5 can not be false', E_USER_ERROR);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!$this->transactionId) {\n\t\t\ttrigger_error('Transaction ID can not be false', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$amount = $this->getField('x_amount');\n\t\tif (!$amount) {\n\t\t\ttrigger_error('Amount can not be false', E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$result = strtoupper(md5(BOO_AUTHORIZE_NET_MD5 . BOO_AUTHORIZE_NET_LOGIN_ID . $this->transactionId . $amount));\n\t\treturn $result == $this->md5Hash;\n\t}",
"public static function isValidMD5($md5 ='') {\n return strlen($md5) == 32 && ctype_xdigit($md5);\n }",
"public function is_md5($val) {\n Trace::add_trace('check md5 value',__METHOD__);\n return (bool)preg_match(\"/[0-9a-f]{32}/i\", $val);\n }",
"private function checkMD5($request) {\n $str = $request['action'] . \";\" .\n $request['orderSumAmount'] . \";\" . $request['orderSumCurrencyPaycash'] . \";\" .\n $request['orderSumBankPaycash'] . \";\" . $request['shopId'] . \";\" .\n $request['invoiceId'] . \";\" . $request['customerNumber'] . \";\" . variable_get('sl7_yandex_kassa_shoppassword', '');\n $md5 = strtoupper(md5($str));\n if ($md5 != strtoupper($request['md5'])) {\n return false;\n }\n return true;\n }",
"public static function is_md5($string)\n\t{\n\t\tif ( strlen($string) >= 33 )\n\t\t\treturn FALSE;\n\t\t\n\t\treturn TRUE;\n\t}",
"function hashPassword($pass){\r\n return md5($pass);\r\n}",
"function isMD5( $string )\n {\n \t\treturn preg_match('@[a-zA-Z0-9]{32}@', $string);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Set the ssh identity file. Set to null if you want to use default identity. Generate new identity files with sshkeygen. Append the id_rsa.pub in the ~/.ssh/authorized_keys file in the target ssh account
|
public function setIdentityFile(?string $identity_file) : Ssh
{
$this->identity_file = $identity_file;
return $this;
}
|
[
"function ssh2_auth_hostbased_file($session, $username, $hostname, $pubkeyfile, $privkeyfile, $passphrase = null, $local_username = null) {}",
"function ssh2_auth_pubkey_file($session, $username, $pubkeyfile, $privkeyfile, $passphrase = NULL)\n{\n}",
"private function generateSSHKey()\n {\n $key_file = tempnam(storage_path('app/'), 'sshkey');\n\n $process = new Process('tools.GenerateSSHKey', [\n 'key_file' => $key_file,\n ]);\n $process->run();\n\n if (!$process->isSuccessful()) {\n unlink($key_file);\n throw new \\RuntimeException($process->getErrorOutput());\n }\n\n $this->target->private_key = file_get_contents($key_file);\n $this->target->public_key = file_get_contents($key_file . '.pub');\n\n unlink($key_file);\n unlink($key_file . '.pub');\n }",
"function ssh2_auth_hostbased_file($session, $username, $hostname, $pubkeyfile, $privkeyfile, $passphrase = NULL, $local_username = NULL)\n{\n}",
"public function setIdentityFile($identity)\n {\n $this->identityFile = $identity;\n }",
"function cemhub_ssh2_auth_pubkey_file($resource) {\n $sftp_settings = cemhub_get_sftp_settings();\n $private_path = cemhub_get_private_file_system_path(TRUE);\n\n return @ssh2_auth_pubkey_file(\n $resource,\n $sftp_settings['user_name'],\n $private_path . '/' . $sftp_settings['public_key'],\n $private_path . '/' . $sftp_settings['private_key'],\n $sftp_settings['passphrase']);\n}",
"public function setSsh($ssh)\n {\n $this->ssh = $ssh;\n }",
"public function setIdentityFile($identityFile) {\n\t\t$this->identityFile = $identityFile;\n\t}",
"public function setSshPrivateKey(string $sshPrivateKey)\n {\n if (preg_match(\"|^file:(.*)$|\", $sshPrivateKey, $matches)) {\n $keyFile = $matches[1];\n if ( ! is_file($keyFile) || ! is_readable($keyFile))\n throw new InvalidArgumentException(\"Ssh Keyfile '$keyFile' is not readable\");\n $sshPrivateKey = file_get_contents($keyFile);\n }\n $this->sshKey = $sshPrivateKey;\n }",
"function drush_gitlab_add_deploy_key() {\n $pid = drush_get_option('pid', _gitlab_get_last_pid());\n $title = drush_get_option('title', gethostname());\n $filename = drush_get_option('filename', getenv('HOME') . '/.ssh/id_rsa.pub');\n $post_data = array(\n 'id' => $pid,\n 'title' => $title,\n 'key' => file_get_contents($filename),\n );\n\n $result = _gitlab_api('projects/' . $pid . '/keys', 'POST', $post_data);\n\n drush_print_r($result);\n}",
"public function getDefaultKeyPath()\n {\n return $this->getUserHomeFolder().'/.ssh/id_rsa';\n }",
"protected function set_identity( $id ) {\n\t\t$headers = array(\n\t\t\t'Authorization' => 'Authorization: OAuth ' . $this->get_access_token(),\n\t\t\t//'Content-type' => 'application/json',\n\t\t\t'Accept-Encoding' => 'Accept-Encoding: gzip, deflate',\n\t\t);\n\t\t$response = $this->http_request( $id, null, $headers );\n\t\tif ( 200 !== $response['code'] ) {\n\t\t\tthrow new SalesforceException( esc_html__( 'Unable to access identity service.', 'object-sync-for-salesforce' ), $response['code'] );\n\t\t}\n\t\t$data = $response['data'];\n\t\tupdate_option( $this->option_prefix . 'identity', $data );\n\t}",
"function HS_netEnableSSHdAndImportKey()\n{\n\t$serverIP = getServerIP();\n\tHS_wrapper(\"netEnableSSHdAndImportKey\", \"'https://$serverIP/packages/baseSys/authorized_keys'\");\n}",
"private function gitWrapperScript($key_file_path)\n {\n return <<<OUT\n#!/bin/sh\nssh -o CheckHostIP=no \\\n -o IdentitiesOnly=yes \\\n -o StrictHostKeyChecking=no \\\n -o PasswordAuthentication=no \\\n -o IdentityFile={$key_file_path} $*\n\nOUT;\n }",
"public function prepInitialisation()\n {\n $rsa = new RSA();\n $rsa->setPublicKeyFormat(RSA::PUBLIC_FORMAT_OPENSSH);\n $keys = $rsa->createKey();\n $pubKey = $keys['publickey'];\n $pubKey = str_replace(\n 'phpseclib-generated-key',\n camel_case($this->name).'@Dployr',\n $pubKey\n );\n $this->public_key = $pubKey;\n Auth::user()->group->repositories()->save($this);\n $this->save();\n $this->generateSecretKey();\n\n Storage::put($this->privateKeyPath(false), $keys['privatekey']);\n chmod($this->privateKeyPath(), 0777);\n\n dispatch(new CloneRepository(new GitService($this)));\n }",
"public function buildKeys() {\n $keys = $this->config['site']['keys'];\n if ($keys) {\n $add_keys_task = $this->taskWriteToFile($_SERVER['HOME'] . '/.ssh/authorized_keys');\n foreach ($keys as $key) {\n $add_keys_task->line($key);\n }\n $successful = $add_keys_task->run()->wasSuccessful();\n\n $this->checkFail($successful, 'copying authorized_keys for ssh access failed.');\n }\n }",
"private function _login_keys()\n {\n if ($this->passphrse != '')\n {\n return @ssh2_auth_pubkey_file($this->conn, $this->username, $this->pubkeyfile, $this->prikeyfile, $this->passphrse);\n }\n return @ssh2_auth_pubkey_file($this->conn, $this->username, $this->pubkeyfile, $this->prikeyfile);\n }",
"public function addFromKeyFile($keyfile, $coPersonId, $sshKeyAuthenticatorId) {\n // First read the contents of the keyfile\n $key = rtrim(file_get_contents($keyfile));\n \n if(!$key) {\n throw new InvalidArgumentException(_txt('er.file.read', array($keyfile)));\n }\n \n // We currently only support OpenSSH format, which is a triple of type/key/comment.\n \n $bits = explode(' ', $key, 3);\n \n // Convert the key type into an enum\n $keyType = null;\n \n switch($bits[0]) {\n case 'ecdsa-sha2-nistp256':\n $keyType = SshKeyTypeEnum::ECDSA;\n break;\n case 'ecdsa-sha2-nistp384':\n $keyType = SshKeyTypeEnum::ECDSA384;\n break;\n case 'ecdsa-sha2-nistp521':\n $keyType = SshKeyTypeEnum::ECDSA521;\n break;\n case 'ssh-dss':\n $keyType = SshKeyTypeEnum::DSA;\n break;\n case 'ssh-ed25519':\n $keyType = SshKeyTypeEnum::ED25519;\n break;\n case 'ssh-rsa':\n $keyType = SshKeyTypeEnum::RSA;\n break;\n case 'ssh-rsa1':\n $keyType = SshKeyTypeEnum::RSA1;\n break;\n case '-----BEGIN':\n if(strncmp($bits[2], 'PRIVATE', 7)==0) {\n // This is the private key, not the public key\n throw new InvalidArgumentException(_txt('pl.sshkeyauthenticator.private'));\n }\n // else unknown format, fall through for error\n break;\n case '----':\n if($bits[1] == 'BEGIN' && strncmp($bits[2], 'SSH2', 4)==0) {\n // This is an RFC 4716 key format, which is not currently supported (CO-859)\n throw new InvalidArgumentException(_txt('pl.sshkeyauthenticator.rfc4716'));\n }\n // else unknown format, fall through for error\n break;\n }\n \n if(!$keyType) {\n throw new InvalidArgumentException(_txt('pl.sshkeyauthenticator.type', array(filter_var($bits[0],\n FILTER_SANITIZE_STRING,FILTER_FLAG_STRIP_HIGH |\n FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_BACKTICK)))); /* was Cake's Sanitize::paranoid */\n }\n \n $key = $bits[1];\n $comment = $bits[2];\n \n if(!$key) {\n throw new InvalidArgumentException(_txt('pl.sshkeyauthenticator.format'));\n }\n \n $sk = array();\n $sk['ssh_key_authenticator_id'] = $sshKeyAuthenticatorId;\n $sk['co_person_id'] = $coPersonId;\n $sk['comment'] = $comment;\n $sk['type'] = $keyType;\n $sk['skey'] = $key;\n \n if(!$this->save($sk)) {\n throw new RuntimeException(_txt('er.db.save'));\n }\n \n return $sk;\n }",
"function hook_sshkey_insert($key) {\n\n}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the full title for an APA citation. AK: Add title section. Add spaces before colon. Info: MLA and Chicago are also using this function for getting the title.
|
protected function getAPATitle()
{
// Create Title
$title = $this->stripPunctuation($this->details['title']);
if (isset($this->details['subtitle'])) {
$subtitle = $this->stripPunctuation($this->details['subtitle']);
// Capitalize subtitle and apply it, assuming it really exists:
if (!empty($subtitle)) {
$subtitle
= strtoupper(substr($subtitle, 0, 1)) . substr($subtitle, 1);
$title .= ' : ' . $subtitle;
}
}
// AK: Get title section and add it to the title
if (isset($this->details['titleSection'])) {
$titleSection = $this->stripPunctuation($this->details['titleSection']);
// AK: Capitalize title section and apply it, assuming it really exists:
if (!empty($titleSection)) {
$titleSection = strtoupper(substr($titleSection, 0, 1))
.substr($titleSection, 1);
$title .= ' : ' . $titleSection;
}
}
return $title;
}
|
[
"function get_title(){\n if ($this->debug > 0) { error_log('In aicc::get_title() method', 0); }\n $title = '';\n if (isset($this->config['organizations']['default'])) {\n $title = $this->organizations[$this->config['organizations']['default']]->get_name();\n } elseif (count($this->organizations) == 1) {\n // This will only get one title but so we don't need to know the index.\n foreach ($this->organizations as $id => $value) {\n $title = $this->organizations[$id]->get_name();\n break;\n }\n }\n return $title;\n }",
"public function getAnchorTitle()\n {\n return $this->articleAnchor[0]->title ?? $this->title;\n }",
"public function getTitleA()\n {\n return $this->title_a;\n }",
"public function getTitle() {\n\treturn $this->getName() . ' (' . $this->getStreet() . ', ' . \n\t\t$this->getCity() . ', ' . $this->getCountry() . ')';\n }",
"public function getTitle()\n {\n if($this->hasOverridenTitle())\n {\n return parent::getTitle();\n }\n\n $title_parts = array();\n if(self::$LONG_TITLES)\n {\n if($this->getID3Album()) $title_parts[] = $this->getID3Album();\n if($this->getID3Artist()) $title_parts[] = $this->getID3Artist();\n }\n if($this->getID3Title())\n {\n $title_parts[] = $this->getID3Title();\n }\n if(!empty($title_parts))\n {\n return implode(' - ', $title_parts);\n }\n return parent::getTitle();\n }",
"public function get_title() {\n\t\t$title = $this->replace_vars( $this->presentation->title );\n\t\t/**\n\t\t * Filter: 'wpseo_title' - Allow changing the Yoast SEO generated title.\n\t\t *\n\t\t * @api string $title The title.\n\t\t *\n\t\t * @param Indexable_Presentation $presentation The presentation of an indexable.\n\t\t */\n\t\t$title = \\apply_filters( 'wpseo_title', $title, $this->presentation );\n\t\t$title = $this->helpers->string->strip_all_tags( $title );\n\t\treturn \\trim( $title );\n\t}",
"public function shortTitle()\n\t{\n\t\treturn $this->title();\n\t}",
"private function titleGuess(): string {\n $collaboration = $this->containsCollaboration($this->title);\n return $collaboration;\n }",
"public function getTitle()\n\t{\n\t\t$title = null;\n\t\tif(!is_null($this->title)){\n\t\t\t$title = $this->title.((!is_null($this->appendTitle)) ? $this->appendTitle : '');\n\t\t} else if (!is_null($this->defaultTitle)){\n\t\t\t$title = $this->defaultTitle;\n\t\t}\n\t\treturn $title;\n\t}",
"private function getTitle(){\n\t\treturn 'Daedalus';\n\t}",
"public function pre_get_document_title() { \n\t\t\n\t\t\t// Home page?\n\t\t\tif ( ipress_is_home_page() ) {\n\n\t\t\t\t// Get details\n\t\t\t\t$title = get_bloginfo( 'name' );\t\t\n\t\t\t\t$sep = (string) apply_filters( 'ipress_document_title_separator', '-' );\n\t\t\t\t$app = (bool) apply_filters( 'ipress_home_doctitle_append', true );\n\n\t\t\t\t// Sanitize title\n\t\t\t\t$title = wptexturize( $title );\n\t\t\t\t$title = convert_chars( $title );\n\t\t\t\t$title = esc_html( $title );\n\t\t\t\t$title = capital_P_dangit( $title );\n\n\t\t\t\t// Return title\t\t \n\t\t\t\treturn ( $app ) ? $title . ' ' . $sep . ' ' . get_bloginfo( 'description' ) : $title;\n\t\t\t}\n\n\t\t\t// Default\n\t\t\treturn ''; \n\t\t}",
"public function getTitle() {\n\t\t\treturn $this->assessment_desc;\n\t\t}",
"public function getAliasTitle():string\n {\n return $this->convert->case($this->alias, 'title');\n }",
"function formatBookTitle($title)\n\t{\n\t\t//Uppercase the first word in article title\n\t\t$ret = ucfirst(strtolower($title));\n\t\t//If the article title contains a subtitle, capitalize the first word after the colon\n\t\t$ret = Utility::uppercaseSubtitle($ret);\n\t\t//Punctuate after the book title, if necessary\n\t\t$ret = Utility::addPeriod($ret);\n\t\t$ret = '<i>' . $ret . '</i>';\n\n\t\treturn $ret;\n\t}",
"function uamswp_entry_title_h1( $title ) {\n $post_title = get_the_title( get_the_ID() );\n $post_link = get_the_permalink( get_the_ID() );\n if( is_archive() ) {\n $title = '<h1 class=\"entry-title\" itemprop=\"headline\"><a href=\"' . $post_link . '\">' . $post_title . '</a></h1>';\n } else {\n $title = '<h1 class=\"entry-title\" itemprop=\"headline\">' . $post_title . '</h1>';\n }\n \n return $title;\n}",
"private function fetchTitle(): string {\n\n $str = \"\";\n $isN = false;\n if (array_key_exists(\"n\", $this->availableFields)) {\n $isN = true;\n }\n\n foreach ($this->availableFields as $k => $v) {\n\n if (strtolower($k) == \"a\") {\n $str .= implode(' , ', $v);\n }\n \n $this->createStrByRules($str, $v, $k, \"b\", \" : \");\n\n $this->createStrByRules($str, $v, $k, \"n\", \" . \");\n \n if (strtolower($k) == \"p\" && $isN) {\n if (!empty($str)) {\n $str .= \" : \" . implode(' , ', $v);\n } else {\n $str .= implode(' , ', $v);\n }\n } else if (strtolower($k) == \"p\" && !$isN) {\n if (!empty($str)) {\n $str .= \" . \" . implode(' , ', $v);\n } else {\n $str .= implode(' , ', $v);\n }\n }\n \n $this->createStrByRules($str, $v, $k, \"c\", \" / \");\n \n }\n return $str;\n }",
"public function getTitle() {\n\t\treturn $this->meeting->Title;\n\t}",
"function link_title( $entry )\n\t{\n\t\tif (!is_array($entry))\n\t\t{\n\t\t\t$entry = $this->read( $entry );\n\t\t}\n\t\tif (!$entry)\n\t\t{\n\t\t\treturn $entry;\n\t\t}\n\t\tif ($entry['cal_id']) return lang('courseprotocol').' '.egw_link::title('calendar',$entry['cal_id']);\n\n\t\treturn lang('courseprotocol').' '.date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],\n\t\t\t$entry['cp_date'] ? $entry['cp_date'] : $entry['cp_created']);\n\t\t//return $entry['cp_title'];\n\t}",
"public function getTheTitle()\n {\n return apply_filters('the_title', $this->get('post_title'));\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Store a newly created ClassScheduling in storage.
|
public function store(CreateClassSchedulingRequest $request)
{
$input = $request->all();
$classScheduling = $this->classSchedulingRepository->create($input);
Flash::success('Class Scheduling saved successfully.');
return redirect(route('classSchedulings.index'));
}
|
[
"private function storeSchedule()\n\t{\n\t\tfile_put_contents('schedule.json', json_encode(self::$schedule));\n\n\t\t// Sleeping 1/10s to avoid race conditions and reloading the file\n\t\tusleep(100000);\n\t\tself::loadSchedule();\n\t}",
"public function store(CreateClassScheduleRequest $request)\n {\n $input = $request->all();\n\n $classSchedule = $this->classScheduleRepository->create($input);\n\n Flash::success('Class Schedule saved successfully.');\n\n return redirect(route('classSchedules.index'));\n }",
"public function store(CreateClassShedulingRequest $request)\n {\n $input = $request->all();\n\n $classSheduling = $this->classShedulingRepository->create($input);\n\n Flash::success('Class Sheduling saved successfully.');\n\n return redirect(route('classShedulings.index'));\n }",
"public function save() {\n\t\t$this->data['task_type'] = get_class($this);\n\t\t$this->data['iteration'] = 1;\n\t\t\n\t\tif($this->use_constants) {\n\t\t\t$this->data['EGS_USERNAME'] = EGS::getUsername();\n\t\t\t$this->data['EGS_COMPANY_ID'] = EGS::getCompanyId();\n\t\t\t$this->data['USER_SPACE'] = Omelette::getUserSpace();\n\t\t}\n\t\t$this->storage->write($this->data);\n\t}",
"public function saveData()\n {\n HedgeBot::message(\"Saving schedules...\", [], E_DEBUG);\n\n $schedules = [];\n\n /** @var Schedule $schedule */\n foreach ($this->schedules as $identSlug => $schedule) {\n $schedules[$identSlug] = $schedule->toArray();\n }\n\n $this->data->schedules = $schedules;\n }",
"private function persistScheduled()\n {\n if (count($this->scheduledForInsertion)) {\n $this->objectPersister->insertMany($this->scheduledForInsertion);\n $this->scheduledForInsertion = array();\n }\n if (count($this->scheduledForUpdate)) {\n $this->objectPersister->replaceMany($this->scheduledForUpdate);\n $this->scheduledForUpdate = array();\n }\n if (count($this->scheduledForDeletion)) {\n $this->objectPersister->deleteManyByIdentifiers($this->scheduledForDeletion);\n $this->scheduledForDeletion = array();\n }\n }",
"public function store(CreateScheduleRequest $request)\n\t{\n\t\t$end_time = ($request->end_time != '') ? $request->end_time : NULL;\n\t\t$input = ['name_event'=>$request->name_event,\n 'description'=>$request->description,\n 'start_time'=>$request->start_time,\n 'end_time'=>$end_time,\n 'event_type'=>$request->event_type,\n 'shopslist_id'=>$request->shopslist_id\n ];\n\n\t\tif ($request->image != null) {\n\t \t$data = $this->uploadAvatarAgent($request->image, $request['image-data']);\n\t \t$input['image']= $data['url'];\n\t }\n\n\t \tSchedule::create($input);\n\n\t\treturn redirect()->route(config('quickadmin.route').'.schedule.index');\n\t}",
"private function _saveNewShift()\n {\n // each timestamp action\n $this->shift = Shift::storeNewByEmployeeId($this->_employeeId);\n // log shift creation\n Log::info(\"New shift created.\", ['employee_id' => $this->_employeeId, 'shift_id' => $this->shift->id]);\n }",
"public function store(CreateScheduleRequest $request)\n\t{\n\t \n\t\tSchedule::create($request->all());\n\n\t\treturn redirect()->route(config('quickadmin.route').'.schedule.index');\n\t}",
"public function save(){\n\t\tfile_put_contents(self::classmap,json_encode([\n\t\t\t\"autoload\" => Globals::getInstance()->__autoload__,\n\t\t\t\"pragmas\" => Globals::getInstance()->__pragmas__,\n\t\t]));\n\t\tif(!file_exists(self::timestamp)){\n\t\t\tfile_put_contents(self::timestamp,time().\",{$this->prefix}\");\n\t\t}\n\t}",
"public function save()\n {\n $_SESSION['reservation'] = serialize($this);\n }",
"public function store(array $data)\n {\n $entry = $this->client->post(\n sprintf('buckets/%d/schedules/%d/entries.json', $this->bucket, $this->parent),\n [\n 'json' => $data,\n ]\n );\n\n return new ScheduleEntry($this->response($entry));\n }",
"public function save()\n {\n $this->_data['timestamp'] = time();\n $this->_state->saveSyncCache(\n $this->_data,\n $this->_devid,\n $this->_user);\n }",
"public function store(StoreSchedulesRequest $request)\n {\n if (! Gate::allows('schedule_create')) {\n return abort(401);\n }\n $schedule = Schedule::create($request->all());\n\n\n\n return redirect()->route('admin.schedules.index');\n }",
"public function saveToStorage(): void\n {\n $data = self::getCurrentData();\n\n $redis = new Redis();\n if (!$redis->connect('localhost')) {\n throw new Exception('Redis no connected: ' . $redis->getLastError());\n }\n\n $key = 'weather_' . $data['dt'];\n $redis->setex($key, 10800, serialize($data));\n\n //var_dump(unserialize($redis->get($key)));\n }",
"private function persistScheduled() {\n\t\t\n\t\tif (count($this->scheduledForInsertion)) {\n\t\t\t$this->objectPersister->insertMany($this->scheduledForInsertion);\n\t\t\t$this->scheduledForInsertion = array();\n\t\t}\n\n\t\tif (count($this->scheduledForUpdate)) {\n\n\t\t\tforeach ($this->scheduledForUpdate as $object) {\n\t\t\t\t//Special condition: if an User comes with null id, we're not doing index update\n\t\t\t\tif (get_class($object) == 'AppBundle\\Entity\\User' && $object->getId() == null) {\n\t\t\t\t\tunset($this->scheduledForUpdate[array_search($object, $this->scheduledForUpdate)]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//Check if scheduledForUpdate array is empty\n\t\t\tif (count($this->scheduledForUpdate)) {\n\t\t\t\t$this->objectPersister->replaceMany($this->scheduledForUpdate);\n\t\t\t\t$this->scheduledForUpdate = array();\n\t\t\t}\n\n\t\t}\n\n\t\tif (count($this->scheduledForDeletion)) {\n\t\t\t$this->objectPersister->deleteManyByIdentifiers($this->scheduledForDeletion);\n\t\t\t$this->scheduledForDeletion = array();\n\t\t}\n\t}",
"public function store()\n\t{\n\t\t$input = Input::all();\n\t\t$v4uuid = UUID::v4();\n\n\t\tObject::create(array(\n\t\t\t\"uuid\" => $v4uuid,\n\t\t\t\"object_type\" => \"9\",\n\t\t\t\"first_name\" => $input[\"timeperiod_name\"],\n\t\t\t\"second_name\" => \"\",\n\t\t\t\"is_active\" => \"1\"\n\t\t));\n\n\t\tTimeperiod::create(array(\n\t\t\t\"object_uuid\" => $v4uuid,\n\t\t\t\"alias\" => $input[\"alias\"]\n\t\t));\n\n\t\tforeach ($input as $k => $v) {\n\t\t\tif (is_string($v)) {\n\t\t\t\tTimeperiodDetail::create(array(\n\t\t\t\t\t\"timeperiod_fk\" => $v4uuid,\n\t\t\t\t\t\"key\" => $k,\n\t\t\t\t\t\"value\" => $v\n\t\t\t\t));\n\t\t\t} else {\n\t\t\t\t$foo2 = \"\";\n\t\t\t\t$foo3 = \"\";\n\t\t\t\tif (!empty($v['foo2'])) $foo2 = \" \".$v['foo2']['value'];\n\t\t\t\tif (!empty($v['foo3'])) $foo3 = \" \".$v['foo3']['value'];\n\n\t\t\t\t$key = $v['foo1']['value'].$foo2.$foo3;\n\t\t\t\t$value = $v['bar1']['value'].\":\".$v['bar2']['value'].\"-\".$v['bar3']['value'].\":\".$v['bar4']['value'];\n\n\t\t\t\tTimeperiodDetail::create(array(\n\t\t\t\t\t\"timeperiod_fk\" => $v4uuid,\n\t\t\t\t\t\"key\" => $key,\n\t\t\t\t\t\"value\" => $value\n\t\t\t\t));\n\t\t\t}\n\t\t}\n\n\t\t$this->writeConfig();\n\t\t// TODO nagios restart\n\n\t\treturn Response::json(array(\"success\" => true));\n\t}",
"public function save()\n {\n return $this->service->saveTimeEntry($this);\n }",
"public function store()\n {\n $project = $this->getProject();\n $values = $this->request->getValues();\n\n list($valid, $errors) = $this->taskValidator->validateCreation($values);\n\n if ($valid && $this->taskModel->create($values)) {\n $this->flash->success(t('Task created successfully.'));\n $this->response->redirect($this->helper->url->to('Task/TaskGanttController', 'show', ['project_id' => $project['id']]));\n } else {\n $this->flash->failure(t('Unable to create your task.'));\n $this->show($values, $errors);\n }\n }",
"public function store(CreateMyScheduleRequest $request)\n\t{\n\t\tfor ($i=1; $i <=6 ; $i++) { \n\t\t\t$name_event = 'name_event'.$i;\n\t\t\t$start_time = 'start_time'.$i;\n\t\t\t$end_time = 'end_time'.$i;\n\t\t\t$color \t\t= 'color'.$i;\n\t\t\tif($request->$name_event != null && $request->$start_time != null) {\n\t\t\t\tMySchedule::create(['name_event'=>$request->$name_event,\n \t\t'start_time'=>$request->$start_time,\n \t\t'end_time'=>null,\n \t'color'=>$request->$color]);\n\t\t\t}\n\t\t}\n\t\treturn redirect()->route(config('quickadmin.route').'.myschedule.index');\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Start round. Reset score in round.
|
public function startRound()
{
$this->score = 0;
}
|
[
"public function startNewRound()\n {\n $this->round = new Round();\n $this->goodToGo = true;\n $this->roundData = [0, 1, 0];\n }",
"private function resetRound()\r\n {\r\n foreach ($this->players as $player) {\r\n echo \"{$player->getName()} Scored: {$player->getRoundScore()}\\n\";\r\n $player->updateTotalScore();\r\n }\r\n }",
"public function setRoundScoreGameRound(): void\n {\n if ($this->diceHand->checkIfOne()) {\n $this->roundScore = 0;\n } else {\n $this->roundScore = $this->roundScore + $this->diceHand->sum();\n }\n }",
"public function setRoundStart() {\n $this->_roundStart = $this->key();\n }",
"public function resetRoundPoints()\n {\n $this->playerRoundPoints = 0;\n $this->computerRoundPoints = 0;\n }",
"public function resetScore() {\n\t\t\t$this->intScore = 0;\n\t\t}",
"public function start()\n\t{\n\t\tprint \"\\n\";\n\n\t\tprint \"Starting round...\\n\";\n\n\t\t//Shuffle the deck\n\t\t$this->deck->shuffle();\n\n\t\t//Post the blinds\n\t\t$this->postBlinds();\n\n\t\t//Deal cards\n\t\t$this->dealCards();\n\n\t\t//Keeps up with who we need to get action from\n\t\t$actor = 0;\n\n\t\t//Preflop action\n\t\twhile($this->isActionNeeded())\n\t\t{\n\t\t\t$this->getAction($actor);\n\t\t}\n\n\t\t//Flop action\n\t\t$actor = 1;\n\t\t$this->burnAndTurn(3);\n\t\twhile($this->isActionNeeded())\n\t\t{\n\t\t\t$this->getAction($actor);\n\t\t}\n\n\t\t//Turn action\n\t\t$actor = 1;\n\t\t$this->burnAndTurn();\n\t\twhile($this->isActionNeeded())\n\t\t{\n\t\t\t$this->getAction($actor);\n\t\t}\n\n\t\t//River action\n\t\t$actor = 1;\n\t\t$this->burnAndTurn();\n\t\twhile($this->isActionNeeded())\n\t\t{\n\t\t\t$this->getAction($actor);\n\t\t}\n\n\t\t//Award pot to winning player(s)\n\t\t$this->awardPot();\n\n\t\t//Update player positions\n\t\t$this->match->moveButton();\n\n\t\t//Reset players\n\t\t$this->resetPlayers();\n\n\t\tprint \"Round over.\\n\";\n\n\t\tprint \"\\n\";\n\t}",
"public function testResetRoundScore()\n {\n $game = new gameHandler();\n\n // Adding value to roundscore\n $game->addRoundScore(20);\n\n // Should reset back to 0.\n $game->resetRoundScore();\n $exp = 0;\n\n $res = $game->getRoundScore();\n\n $this->assertEquals($exp, $res);\n }",
"public function setRoundScoreGameRoundToZero(): void\n {\n $this->roundScore = 0;\n }",
"public function ResetRounds(){\n $this->rounds=0;\n }",
"public function setRoundScoreGame(): void\n {\n $this->gameRound->setRoundScoreGameRound();\n }",
"public function reset(): void\n {\n $this->score = 0;\n\n if ($this->tests->count() > 0) {\n foreach ($this->tests as $test) {\n $test->score->reset();\n }\n }\n }",
"public function start()\n\t{\n\t\t$prompt = new Prompt();\n\t\twhile($prompt->getYesNo(\"Would you like to start a new round? (y/n): \"))\n\t\t{\n\t\t\t$round = new Round($this);\n\t\t\t$round->start();\n\t\t}\n\t}",
"public function play() : void\n {\n $this->currentHand->rollDice();\n $roundHand = $this->currentHand->showHand();\n if (in_array(1, $roundHand)) {\n $this->gotOne = true;\n $this->roundScore = 0;\n } else {\n $this->roundScore += $this->currentHand->sumHand();\n }\n $this->updateHistogram();\n $this->throws += 1;\n }",
"protected function do_next_step_start_round() {\n if (!isset($this->playerWithInitiativeIdx)) {\n throw new LogicException(\n 'Player that has won initiative must already have been determined.'\n );\n }\n // set BMGame activePlayerIdx\n $this->activePlayerIdx = $this->playerWithInitiativeIdx;\n $this->turnNumberInRound = 1;\n }",
"public function testStartRound()\n {\n $diceGame = new DiceGame();\n\n $diceGame->startRound();\n $diceGame->computerRoll();\n\n $res = $diceGame->graphics();\n $exp = [[], []];\n $this->assertNotEquals($exp, $res);\n\n $diceGame->startRound();\n\n $res = $diceGame->graphics();\n $exp = [[], []];\n $this->assertEquals($exp, $res);\n }",
"public function NextRoundStartedAction() {\n\t\t\n\t}",
"public function testStartNewRoundNrOfRoundsPlayed()\n {\n $yatzyObject = new Yatzy(\"challenge\", \"100\", \"1\", \"\", \"1\");\n $dataFirstRound = $yatzyObject->startNewRound();\n $dataSecondRound = $yatzyObject->startNewRound();\n $dataThirdRound = $yatzyObject->startNewRound();\n\n $this->assertEquals($dataFirstRound[\"nrOfRoundsPlayed\"], 1);\n $this->assertEquals($dataSecondRound[\"nrOfRoundsPlayed\"], 2);\n $this->assertEquals($dataThirdRound[\"nrOfRoundsPlayed\"], 3);\n }",
"public function nextRound()\n {\n $this->round = $this->round + 1;\n $this->getPlayer1()->createNewCurrentHand();\n $this->getComputer()->createNewCurrentHand();\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Construct a new token regex.
|
private function constructTokenRegex(array $options = []): string
{
$prefix = $options['prefix'] ?? '%{';
$suffix = $options['suffix'] ?? '}';
if ($prefix === $this->delimiter || $suffix === $this->delimiter) {
throw new RuntimeException('"' . $this->delimiter . '" token is reserved for pluralization');
}
return '~' . preg_quote($prefix) . '(.*?)' . preg_quote($suffix) . '~';
}
|
[
"abstract protected function buildRegex(): Matcher;",
"private function getTokenRegex()\n\t{\n\t\treturn '/\\\\' . $this->delimiterPrefix . '\\w+/';\n\t}",
"protected function compileRegExp()\n {\n $exp = preg_replace(':\\{(' . self::PARAM . ')\\}:', '(' . self::PARAM . ')', $this->content);\n $exp = ':^' . $exp . '$:u';\n\n $this->regExp = $exp;\n\n return $this;\n }",
"public function generate($regex);",
"public function __construct($regex){}",
"public function __construct()\n {\n $this->regex = '/(' . implode(')|(', array_values($this->tokens)) . ')/u';\n $this->name_cache = array_keys($this->tokens);\n }",
"public function getRegex () {}",
"public function createTokenInstance();",
"private function _constructRegEx() {\r\n\r\n $oneNumber = \"\\d{1,\".MEASUREMENTSEARCH_NUM_MAXLEN.\"}\";\r\n $mainTriple = \"($oneNumber)x($oneNumber)x($oneNumber)\";\r\n\r\n $fullRegEx = $mainTriple;\r\n\r\n $DBunits = SELF::_decodeUnitsForRegEx();\r\n if ($DBunits) { $fullRegEx .= \"\\s(\" . implode(\"|\", $DBunits) . \")\"; }\r\n\r\n $oneOrTwoNumbers = \"$oneNumber(?:\\s*-\\s*$oneNumber)?\";\r\n\r\n $result = array(\r\n \"oneNumber\" => $oneNumber,\r\n \"mainTriple\" => $mainTriple,\r\n \"fullRegEx\" => $fullRegEx,\r\n \"oneOrTwoNumbers\" => $oneOrTwoNumbers,\r\n );\r\n\r\n // echo \"<pre>\\n\\n\\n\\n\\n</pre>\";\r\n // echo \"<pre>\" . print_r($result, true) . \"</pre>\";\r\n\r\n return $result;\r\n }",
"public function __construct(string $token);",
"public function createToken(): Token;",
"private function createRegex(): void\n {\n $regex = '/^'; // Start of the regex, which matches start of string.\n\n // Loop through route parts to define which parts are parameters.\n $parts = explode('/', ltrim($this->path, '/'));\n foreach ($parts as $part) {\n $regex .= '\\/'; // Matches the starting slash.\n\n // Check if the parameter symbol is in this part, if that is the case, it is parameter, otherwise it is a\n // static part.\n if (stripos($part, Route::PARAMETER_SYMBOL_LEFT) === false) {\n $regex .= $part; // Match this part exactly as given.\n continue;\n }\n\n // If we are here, then we're dealing with a parameter.\n $name = str_ireplace([Route::PARAMETER_SYMBOL_LEFT, Route::PARAMETER_SYMBOL_RIGHT], '', $part);\n $this->parameterNames[] = $name;\n $this->parameters[$name] = null;\n $regex .= isset($this->rules[$name]) ? '(' . $this->rules[$name] . ')' : '([^\\/]+)';\n }\n\n $regex .= '$/'; // End of the regex, which maters end of string.\n $this->regex = $regex;\n }",
"private function buildRegex(): string\n {\n $regex = '/^' . str_ireplace('/', '\\\\/', $this->pattern) . '$/';\n $parameters = $this->parseParameters($this->pattern);\n \n array_walk($parameters, function (ParameterDefinition $parameter) use (&$regex): void {\n if ($parameter->optional) {\n $match = '/\\\\\\\\\\\\/\\{\\?' . $parameter->name . '(:(\\(.+?\\)))?\\}/'; // Five backshashes to match a single backslash, really????? At least it works that way... right?\n $regex = preg_replace($match, '(\\/' . $parameter->pattern . ')?', $regex);\n } else {\n $regex = preg_replace('/\\{' . $parameter->name . '(:(\\(.+?\\)))?\\}/', $parameter->pattern, $regex);\n }\n });\n \n return $regex;\n }",
"protected function extractRegex()\n {\n // PHP only supports $this inside anonymous functions since 5.4\n $minifier = $this;\n $callback = function ($match) use ($minifier) {\n $count = count($minifier->extracted);\n $placeholder = '\"'.$count.'\"';\n $minifier->extracted[$placeholder] = $match[0];\n\n return $placeholder;\n };\n\n // match all chars except `/` and `\\`\n // `\\` is allowed though, along with whatever char follows (which is the\n // one being escaped)\n // this should allow all chars, except for an unescaped `/` (= the one\n // closing the regex)\n // then also ignore bare `/` inside `[]`, where they don't need to be\n // escaped: anything inside `[]` can be ignored safely\n $pattern = '\\\\/(?!\\*)(?:[^\\\\[\\\\/\\\\\\\\\\n\\r]++|(?:\\\\\\\\.)++|(?:\\\\[(?:[^\\\\]\\\\\\\\\\n\\r]++|(?:\\\\\\\\.)++)++\\\\])++)++\\\\/[gimuy]*';\n\n // a regular expression can only be followed by a few operators or some\n // of the RegExp methods (a `\\` followed by a variable or value is\n // likely part of a division, not a regex)\n $keywords = array('do', 'in', 'new', 'else', 'throw', 'yield', 'delete', 'return', 'typeof');\n $before = '([=:,;\\+\\-\\*\\/\\}\\(\\{\\[&\\|!]|^|'.implode('|', $keywords).')\\s*';\n $propertiesAndMethods = array(\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Properties_2\n 'constructor',\n 'flags',\n 'global',\n 'ignoreCase',\n 'multiline',\n 'source',\n 'sticky',\n 'unicode',\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Methods_2\n 'compile(',\n 'exec(',\n 'test(',\n 'toSource(',\n 'toString(',\n );\n $delimiters = array_fill(0, count($propertiesAndMethods), '/');\n $propertiesAndMethods = array_map('preg_quote', $propertiesAndMethods, $delimiters);\n $after = '(?=\\s*([\\.,;\\)\\}&\\|+]|\\/\\/|$|\\.('.implode('|', $propertiesAndMethods).')))';\n $this->registerPattern('/'.$before.'\\K'.$pattern.$after.'/', $callback);\n\n // regular expressions following a `)` are rather annoying to detect...\n // quite often, `/` after `)` is a division operator & if it happens to\n // be followed by another one (or a comment), it is likely to be\n // confused for a regular expression\n // however, it's perfectly possible for a regex to follow a `)`: after\n // a single-line `if()`, `while()`, ... statement, for example\n // since, when they occur like that, they're always the start of a\n // statement, there's only a limited amount of ways they can be useful:\n // by calling the regex methods directly\n // if a regex following `)` is not followed by `.<property or method>`,\n // it's quite likely not a regex\n $before = '\\)\\s*';\n $after = '(?=\\s*\\.('.implode('|', $propertiesAndMethods).'))';\n $this->registerPattern('/'.$before.'\\K'.$pattern.$after.'/', $callback);\n\n // 1 more edge case: a regex can be followed by a lot more operators or\n // keywords if there's a newline (ASI) in between, where the operator\n // actually starts a new statement\n // (https://github.com/matthiasmullie/minify/issues/56)\n $operators = $this->getOperatorsForRegex($this->operatorsBefore, '/');\n $operators += $this->getOperatorsForRegex($this->keywordsReserved, '/');\n $after = '(?=\\s*\\n\\s*('.implode('|', $operators).'))';\n $this->registerPattern('/'.$pattern.$after.'/', $callback);\n }",
"public function makeToken($token) {\n\t\treturn new Token($this, $token, null, null);\n\t}",
"public function get_regex_tokens() {\n\t\treturn array(\n\t\t\t'{POST_ID}' => '([\\d]+)',\n\t\t\t'{USER_ID}' => '([\\d]+)',\n\t\t\t'{COMMENT_ID}' => '([\\d]+)',\n\t\t\t'{TERM_ID}' => '([\\d]+)',\n\t\t);\n\t}",
"protected function build_regex() {\r\n\t\t$cmd = preg_quote($this->cmd, '@');\r\n\t\treturn \"@{{$cmd}:(.*?)}@i\";\r\n\t}",
"function make_reg_exp()\n\t{\n\t\t$stam = \"/(<(\";\n\t\t$stam2 = \"/([\\w\\d_\\-=\\\"':&?+#%\\;,\\.\\/*\\s]*<\\/(\";\n\t\t$stam3 = \"/[\\n\\s\\r]*(<\\/(\";\n\t\t\n\t\t//Set up the list of inline tags, seperated by OR |\n\t\t$middle = implode('|', $this->inlinehtmltags);\n\t\t\n\t\t//Make the regexps\n\t\t$this->inlineregexp = $stam.$middle.\")>)\\n/sUi\";\n\t\t$this->inlineregexp2 = $stam.$middle.\")\\s.*>)\\n/sUi\";\n\t\t$this->inlineregexp3 = $stam2.$middle.\")>)/sUi\";\n\t\t$this->inlineregexp4 = $stam3.$middle.\")>)/sUi\";\n\t\t\n\t\t$this->tabslist = implode('|', $this->tagswithtabsandnewlines);\n\t}",
"function mREGEX(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$REGEX;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:276:3: ( 'regex' ) \n // Tokenizer11.g:277:3: 'regex' \n {\n $this->matchString(\"regex\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Operation putImportFieldsFromFdfInStorageAsync Update fields from FDF file in storage.
|
public function putImportFieldsFromFdfInStorageAsync($name, $fdf_file_path, $storage = null, $folder = null)
{
return $this->putImportFieldsFromFdfInStorageAsyncWithHttpInfo($name, $fdf_file_path, $storage, $folder)
->then(
function ($response) {
return $response[0];
}
);
}
|
[
"public function putImportFieldsFromFdfInStorageAsyncWithHttpInfo($name, $fdf_file_path, $storage = null, $folder = null)\n {\n $returnType = '\\Aspose\\PDF\\Model\\AsposeResponse';\n $request = $this->putImportFieldsFromFdfInStorageRequest($name, $fdf_file_path, $storage, $folder);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function getImportFieldsFromFdfInStorageAsync($name, $fdf_file_path, $storage = null, $folder = null)\n {\n return $this->getImportFieldsFromFdfInStorageAsyncWithHttpInfo($name, $fdf_file_path, $storage, $folder)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }",
"public function updateFieldStorageDefinition(FieldStorageDefinitionInterface $storage_definition);",
"public function getImportFieldsFromXfdfInStorageAsyncWithHttpInfo($name, $xfdf_file_path, $storage = null, $folder = null)\n {\n $returnType = '\\SplFileObject';\n $request = $this->getImportFieldsFromXfdfInStorageRequest($name, $xfdf_file_path, $storage, $folder);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function putImportFieldsFromFdfInStorage($name, $fdf_file_path, $storage = null, $folder = null)\n {\n try\n {\n list($response) = $this->putImportFieldsFromFdfInStorageWithHttpInfo($name, $fdf_file_path, $storage, $folder);\n return $response;\n }\n catch (ApiException $ex)\n {\n if ($ex->getCode() == 401)\n {\n $this->_requestToken();\n list($response) = $this->putImportFieldsFromFdfInStorageWithHttpInfo($name, $fdf_file_path, $storage, $folder);\n return $response;\n }\n else\n {\n throw $ex;\n }\n }\n }",
"public function import_custom_fields() {\r\n\r\n\t\tif ( ! isset( $_GET['pxact'] ) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ( 'import-cf' !== $_GET['pxact'] ) {\r\n\r\n\t\t\twp_redirect( admin_url() . 'admin.php?page=lscf_export' );\r\n\t\t\tdie();\r\n\t\t}\r\n\r\n\t\tif ( ! isset( $_FILES['import-json-custom-fields'] ) ) {\r\n\t\t\tdie();\r\n\t\t}\r\n\r\n\t\tif ( preg_match( '/(.+?)\\.json$/', $_FILES['import-json-custom-fields']['name'], $matches ) ) {\r\n\r\n\t\t\t$filename = $matches[0];\r\n\r\n\t\t\t$upload_dir = wp_upload_dir();\r\n\t\t\t$upload_path = trailingslashit( $upload_dir['path'] );\r\n\r\n\t\t\t$url = wp_nonce_url( admin_url() . 'admin.php?page=lscf_export&pxact=import-cf' ,'lscf-import-to-json' );\r\n\r\n\t\t\tif ( false === ($creds = request_filesystem_credentials( $url, '', false, false, null ) ) ) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif ( ! WP_Filesystem( $creds ) ) {\r\n\t\t\t\trequest_filesystem_credentials( $url, '', true, false, null );\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif ( move_uploaded_file( $_FILES['import-json-custom-fields']['tmp_name'], $upload_path . 'lscf-import.json' ) ) {\r\n\r\n\t\t\t\t$filename = $upload_path . '/lscf-import.json';\r\n\r\n\t\t\t\t$file = fopen( $filename, 'r' );\r\n\t\t\t\t$data = fread( $file, filesize( $filename ) );\r\n\t\t\t\tfclose( $file );\r\n\r\n\t\t\t\t$json_data = json_decode( $data, true );\r\n\r\n\t\t\t\tglobal $wp_filesystem;\r\n\r\n\t\t\t\tif ( is_array( $json_data ) && count( $json_data ) > 0 ) {\r\n\r\n\t\t\t\t\tforeach ( $json_data as $post_type => $custom_fields ) {\r\n\r\n\r\n\t\t\t\t\t\tforeach ( $custom_fields as $type => $cf ) {\r\n\r\n\t\t\t\t\t\t\tif ( 'px_icon_check_box' == $type ) {\r\n\r\n\t\t\t\t\t\t\t\tforeach ( $cf as $cf_key => $field ) {\r\n\r\n\t\t\t\t\t\t\t\t\tforeach ( $field['options'] as $index => $opt ) {\r\n\t\t\t\t\t\t\t\t\t\t$imagename = '';\r\n\t\t\t\t\t\t\t\t\t\tif ( ! isset( $opt['icon'] ) ) { continue; }\r\n\r\n\t\t\t\t\t\t\t\t\t\tpreg_match( '/(((?!\\/).)+?)\\.(jpg|jpeg|gif|png)$/', $opt['icon'], $matches );\r\n\t\t\t\t\t\t\t\t\t\t$imagename = $matches[0];\r\n\r\n\t\t\t\t\t\t\t\t\t\tif ( $image = $wp_filesystem->get_contents( $opt['icon'] ) ) {\r\n\t\t\t\t\t\t\t\t\t\t\tif ( $wp_filesystem->put_contents( $upload_path . $imagename, $image ) ) {\r\n\t\t\t\t\t\t\t\t\t\t\t\techo '<b style=\"color:green; font-size:11px;\">' . esc_url( $upload_dir['url'] . '/' . $imagename ) . '</b><span style=\"color:green; font-size:11px;\"> has downloaded</span><br/>';\r\n\t\t\t\t\t\t\t\t\t\t\t\t$custom_fields[ $type ] [ $cf_key ] ['options'][ $index ]['icon'] = $upload_dir['url'] . '/' . $imagename;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\techo '<b style=\"color:red; font-size:11px;\">' . $upload_dir['url'] . '/' . $imagename . '</b><span style=\"color:red; font-size:11px;\"> error on download \t</span>';\r\n\t\t\t\t\t\t\t\t\t\t\t\t$custom_fields[ $type ] [ $cf_key ] ['options'][ $index ]['icon'] = '';\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t$this->custom_fields_data[ $post_type ] = $custom_fields;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$model = $this->main_model;\r\n\t\t\t\t$model->update_custom_fields_options( $this->custom_fields_data );\r\n\t\t\t\techo '<br/><strong style=\"color:green\">Import completed</strong>';\r\n\t\t\t\tdie();\r\n\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\techo 'Please upload only <b>json</b> files';\r\n\t\t\tdie();\r\n\t\t}\r\n\r\n\t\tdie();\r\n\r\n\t}",
"public function testImportChange() {\n $this->installConfig(['field_test_config']);\n $field_storage_id = 'field_test_import';\n $field_id = \"entity_test.entity_test.$field_storage_id\";\n $field_config_name = \"field.field.$field_id\";\n\n $active = $this->container->get('config.storage');\n $sync = $this->container->get('config.storage.sync');\n $this->copyConfig($active, $sync);\n\n // Save as files in the sync directory.\n $field = $active->read($field_config_name);\n $new_label = 'Test update import field';\n $field['label'] = $new_label;\n $sync->write($field_config_name, $field);\n\n // Import the content of the sync directory.\n $this->configImporter()->import();\n\n // Check that the updated config was correctly imported.\n $field = FieldConfig::load($field_id);\n $this->assertEquals($new_label, $field->getLabel(), 'field label updated');\n }",
"protected function putImportFieldsFromXfdfInStorageRequest($name, $xfdf_file_path, $storage = null, $folder = null)\n {\n // verify the required parameter 'name' is set\n if ($name === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $name when calling putImportFieldsFromXfdfInStorage'\n );\n }\n // verify the required parameter 'xfdf_file_path' is set\n if ($xfdf_file_path === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $xfdf_file_path when calling putImportFieldsFromXfdfInStorage'\n );\n }\n\n $resourcePath = '/pdf/{name}/import/xfdf';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($xfdf_file_path !== null) {\n $queryParams['xfdfFilePath'] = ObjectSerializer::toQueryValue($xfdf_file_path);\n }\n // query params\n if ($storage !== null) {\n $queryParams['storage'] = ObjectSerializer::toQueryValue($storage);\n }\n // query params\n if ($folder !== null) {\n $queryParams['folder'] = ObjectSerializer::toQueryValue($folder);\n }\n\n // path params\n if ($name !== null) {\n $resourcePath = str_replace(\n '{' . 'name' . '}',\n ObjectSerializer::toPathValue($name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n // array of objects\n } elseif (is_array($httpBody)) {\n $httpBody = \"[\" . ObjectSerializer::serializeCollection($httpBody, \"\") . \"]\";\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n //$httpBody = new MultipartStream($multipartContents);\n $httpBody = $formParams[''];\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n //ASPOSE_PDF_CLOUD\n if (!$this->config->getAccessToken()) \n {\n $this->_requestToken();\n }\n if ($this->config->getAccessToken() !== null) \n {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n // add custom heades\n $headers['x-aspose-client'] = 'php sdk';\n $headers['x-aspose-client-version'] = '23.8.0';\n \n //ASPOSE_PDF_CLOUD\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'PUT',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"protected function getImportFieldsFromFdfInStorageRequest($name, $fdf_file_path, $storage = null, $folder = null)\n {\n // verify the required parameter 'name' is set\n if ($name === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $name when calling getImportFieldsFromFdfInStorage'\n );\n }\n // verify the required parameter 'fdf_file_path' is set\n if ($fdf_file_path === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $fdf_file_path when calling getImportFieldsFromFdfInStorage'\n );\n }\n\n $resourcePath = '/pdf/{name}/import/fdf';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($fdf_file_path !== null) {\n $queryParams['fdfFilePath'] = ObjectSerializer::toQueryValue($fdf_file_path);\n }\n // query params\n if ($storage !== null) {\n $queryParams['storage'] = ObjectSerializer::toQueryValue($storage);\n }\n // query params\n if ($folder !== null) {\n $queryParams['folder'] = ObjectSerializer::toQueryValue($folder);\n }\n\n // path params\n if ($name !== null) {\n $resourcePath = str_replace(\n '{' . 'name' . '}',\n ObjectSerializer::toPathValue($name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['multipart/form-data']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['multipart/form-data'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n // array of objects\n } elseif (is_array($httpBody)) {\n $httpBody = \"[\" . ObjectSerializer::serializeCollection($httpBody, \"\") . \"]\";\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n //$httpBody = new MultipartStream($multipartContents);\n $httpBody = $formParams[''];\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n //ASPOSE_PDF_CLOUD\n if (!$this->config->getAccessToken()) \n {\n $this->_requestToken();\n }\n if ($this->config->getAccessToken() !== null) \n {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n // add custom heades\n $headers['x-aspose-client'] = 'php sdk';\n $headers['x-aspose-client-version'] = '23.8.0';\n \n //ASPOSE_PDF_CLOUD\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function testImportCreate() {\n // A field storage with one single field.\n $field_name = 'field_test_import_sync';\n $field_storage_id = \"entity_test.$field_name\";\n $field_id = \"entity_test.entity_test.$field_name\";\n $field_storage_config_name = \"field.storage.$field_storage_id\";\n $field_config_name = \"field.field.$field_id\";\n\n // A field storage with two fields.\n $field_name_2 = 'field_test_import_sync_2';\n $field_storage_id_2 = \"entity_test.$field_name_2\";\n $field_id_2a = \"entity_test.test_bundle.$field_name_2\";\n $field_id_2b = \"entity_test.test_bundle_2.$field_name_2\";\n $field_storage_config_name_2 = \"field.storage.$field_storage_id_2\";\n $field_config_name_2a = \"field.field.$field_id_2a\";\n $field_config_name_2b = \"field.field.$field_id_2b\";\n\n $active = $this->container->get('config.storage');\n $sync = $this->container->get('config.storage.sync');\n $this->copyConfig($active, $sync);\n\n // Add the new files to the sync directory.\n $src_dir = __DIR__ . '/../../modules/field_test_config/sync';\n $target_dir = Settings::get('config_sync_directory');\n /** @var \\Drupal\\Core\\File\\FileSystemInterface $file_system */\n $file_system = \\Drupal::service('file_system');\n $this->assertNotFalse($file_system->copy(\"$src_dir/$field_storage_config_name.yml\", \"$target_dir/$field_storage_config_name.yml\"));\n $this->assertNotFalse($file_system->copy(\"$src_dir/$field_config_name.yml\", \"$target_dir/$field_config_name.yml\"));\n $this->assertNotFalse($file_system->copy(\"$src_dir/$field_storage_config_name_2.yml\", \"$target_dir/$field_storage_config_name_2.yml\"));\n $this->assertNotFalse($file_system->copy(\"$src_dir/$field_config_name_2a.yml\", \"$target_dir/$field_config_name_2a.yml\"));\n $this->assertNotFalse($file_system->copy(\"$src_dir/$field_config_name_2b.yml\", \"$target_dir/$field_config_name_2b.yml\"));\n\n // Import the content of the sync directory.\n $this->configImporter()->import();\n\n // Check that the field and storage were created.\n $field_storage = FieldStorageConfig::load($field_storage_id);\n $this->assertNotEmpty($field_storage, 'Test import storage field from sync exists');\n $field = FieldConfig::load($field_id);\n $this->assertNotEmpty($field, 'Test import field from sync exists');\n $field_storage = FieldStorageConfig::load($field_storage_id_2);\n $this->assertNotEmpty($field_storage, 'Test import storage field 2 from sync exists');\n $field = FieldConfig::load($field_id_2a);\n $this->assertNotEmpty($field, 'Test import field 2a from sync exists');\n $field = FieldConfig::load($field_id_2b);\n $this->assertNotEmpty($field, 'Test import field 2b from sync exists');\n }",
"public function putExportFieldsFromPdfToFdfInStorageAsyncWithHttpInfo($name, $fdf_output_file_path, $storage = null, $folder = null)\n {\n $returnType = '\\Aspose\\PDF\\Model\\AsposeResponse';\n $request = $this->putExportFieldsFromPdfToFdfInStorageRequest($name, $fdf_output_file_path, $storage, $folder);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function setImportEntity(ImportInterface $importEntity);",
"public function putImportFieldsFromXmlInStorageAsyncWithHttpInfo($name, $xml_file_path, $storage = null, $folder = null)\n {\n $returnType = '\\Aspose\\PDF\\Model\\AsposeResponse';\n $request = $this->putImportFieldsFromXmlInStorageRequest($name, $xml_file_path, $storage, $folder);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"public function import()\n\t{\n\t\t// get rid of any ACF field groups that are not published - if an unpublished\n\t\t// ACF field group has the same name as one we're trying to import, it will fail\n\t\t$this->deleteUnpublished();\n\t\t\n\t\t$data = $this->readConfig();\n\t\t$fieldGroupsInFile = array();\n\n\t\tforeach ($data as $post) {\n\n\t\t\t$fromFile = $post;\n\t\t\t$fromDb = $this->getPost($fromFile[\"post\"][\"post_name\"]);\n\n\t\t\t$fieldGroupsInFile[] = $fromFile[\"post\"][\"post_name\"];\n\n\t\t\tif (is_null($fromDb[\"post\"])) {\n\t\t\t\t\\WP_CLI::success(\"Group `{$fromFile['post']['post_title']}` does not exist in the database, created.\");\n\t\t\t\t$this->createFieldGroup($fromFile[\"post\"], $fromFile[\"meta\"]);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ($fromDb[\"post\"][\"post_modified_gmt\"] !== $fromFile[\"post\"][\"post_modified_gmt\"]) {\n\t\t\t\t\\WP_CLI::warning(\"Group `{$fromFile['post']['post_title']}` changed since last import, updating.\");\n\t\t\t\t$this->updateFieldGroup($fromDb[\"post\"][\"ID\"], $fromDb[\"meta\"], $fromFile[\"post\"], $fromFile[\"meta\"]);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t\\WP_CLI::warning(\"Group `{$fromFile['post']['post_title']}` did not change since last import, skipping.\");\n\n\t\t}\n\n\t\t$this->deleteGroupsNotInFile($fieldGroupsInFile);\t\n\n\t\t\\WP_CLI::success(\"ACF field groups successfully imported.\");\n\t}",
"public function postImportFieldsFromFdfAsyncWithHttpInfo($name, $storage = null, $folder = null, $fdf_data = null)\n {\n $returnType = '\\Aspose\\PDF\\Model\\AsposeResponse';\n $request = $this->postImportFieldsFromFdfRequest($name, $storage, $folder, $fdf_data);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }",
"protected function getImportFieldsFromXfdfInStorageRequest($name, $xfdf_file_path, $storage = null, $folder = null)\n {\n // verify the required parameter 'name' is set\n if ($name === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $name when calling getImportFieldsFromXfdfInStorage'\n );\n }\n // verify the required parameter 'xfdf_file_path' is set\n if ($xfdf_file_path === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $xfdf_file_path when calling getImportFieldsFromXfdfInStorage'\n );\n }\n\n $resourcePath = '/pdf/{name}/import/xfdf';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($xfdf_file_path !== null) {\n $queryParams['xfdfFilePath'] = ObjectSerializer::toQueryValue($xfdf_file_path);\n }\n // query params\n if ($storage !== null) {\n $queryParams['storage'] = ObjectSerializer::toQueryValue($storage);\n }\n // query params\n if ($folder !== null) {\n $queryParams['folder'] = ObjectSerializer::toQueryValue($folder);\n }\n\n // path params\n if ($name !== null) {\n $resourcePath = str_replace(\n '{' . 'name' . '}',\n ObjectSerializer::toPathValue($name),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['multipart/form-data']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['multipart/form-data'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n // array of objects\n } elseif (is_array($httpBody)) {\n $httpBody = \"[\" . ObjectSerializer::serializeCollection($httpBody, \"\") . \"]\";\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n //$httpBody = new MultipartStream($multipartContents);\n $httpBody = $formParams[''];\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n //ASPOSE_PDF_CLOUD\n if (!$this->config->getAccessToken()) \n {\n $this->_requestToken();\n }\n if ($this->config->getAccessToken() !== null) \n {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n // add custom heades\n $headers['x-aspose-client'] = 'php sdk';\n $headers['x-aspose-client-version'] = '23.8.0';\n \n //ASPOSE_PDF_CLOUD\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"function uuid_badge_file_field_import(&$import, $entity_type) {\n $import_bundle = 'badge';\n // Get all fields from this bundle.\n $fields = field_info_instances($entity_type, $import_bundle);\n\n foreach($fields as $field_instance) {\n // Load field info to check the type.\n $field = &$import->{$field_instance['field_name']};\n $info = field_info_field($field_instance['field_name']);\n $supported_fields = array_map('trim', explode(',', variable_get('uuid_features_file_supported_fields', 'file, image')));\n // Check if this field should implement file import/export system.\n if (!empty($field) && in_array($info['type'], $supported_fields)) {\n // We need to loop into each language because i18n translation can build\n // fields with different language than the term one.\n foreach($field as $language => $files) {\n if (is_array($files)) {\n foreach($files as $i => $file) {\n // Convert file to array to stay into the default uuid_features_file format.\n $file = (object)$file;\n $result = _uuid_features_file_field_import_file($file);\n // The file was saved successfully, update the file field (by reference).\n if ($result == TRUE && isset($file->fid)) {\n $field[$language][$i] = (array)$file;\n }\n else {\n $field[$language][$i] = array();\n }\n }\n }\n }\n }\n }\n}",
"public function putUpdateFieldsAsync($name, $fields, $storage = null, $folder = null)\n {\n return $this->putUpdateFieldsAsyncWithHttpInfo($name, $fields, $storage, $folder)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }",
"public function putExportFieldsFromPdfToFdfInStorage($name, $fdf_output_file_path, $storage = null, $folder = null)\n {\n try\n {\n list($response) = $this->putExportFieldsFromPdfToFdfInStorageWithHttpInfo($name, $fdf_output_file_path, $storage, $folder);\n return $response;\n }\n catch (ApiException $ex)\n {\n if ($ex->getCode() == 401)\n {\n $this->_requestToken();\n list($response) = $this->putExportFieldsFromPdfToFdfInStorageWithHttpInfo($name, $fdf_output_file_path, $storage, $folder);\n return $response;\n }\n else\n {\n throw $ex;\n }\n }\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Updates the end date for a course in weeks format if option automaticenddate is set. This method is called from event observers and it can not use any modinfo or format caches because events are triggered before the caches are reset.
|
public static function update_end_date($courseid) {
global $DB, $COURSE;
// Use one DB query to retrieve necessary fields in course, value for automaticenddate and number of the last
// section. This query will also validate that the course is indeed in 'periods' format.
$sql = "SELECT c.id, c.format, c.startdate, c.enddate, fo.value AS automaticenddate, d.value as periodduration
FROM {course} c
LEFT JOIN {course_format_options} fo
ON fo.courseid = c.id
AND fo.format = c.format
AND fo.name = 'automaticenddate'
AND fo.sectionid = 0
LEFT JOIN {course_format_options} d
ON d.courseid = c.id
AND d.format = c.format
AND d.name = 'periodduration'
AND d.sectionid = 0
WHERE c.format = :format
AND c.id = :courseid";
$course = $DB->get_record_sql($sql, ['format' => 'periods', 'courseid' => $courseid]);
if (!$course) {
// Looks like it is a course in a different format, nothing to do here.
return;
}
// Create an instance of this class and mock the course object.
$format = new format_periods('periods', $courseid);
$format->course = $course;
// If automaticenddate is not specified take the default value.
if (!isset($course->automaticenddate)) {
$defaults = $format->course_format_options();
$course->automaticenddate = $defaults['automaticenddate'];
}
// Check that the course format for setting an automatic date is set.
if (empty($course->automaticenddate)) {
return;
}
if (!isset($course->periodduration)) {
$defaults = isset($defaults) ? $defaults : $format->course_format_options();
$course->periodduration = $defaults['periodduration'];
}
$sections = $DB->get_records_sql("SELECT s.section, s.id, d.value as periodduration
FROM {course_sections} s
LEFT JOIN {course_format_options} d
ON d.courseid = s.course
AND d.format = 'periods'
AND d.name = 'periodduration'
AND d.sectionid = s.id
WHERE s.course = :courseid AND s.section > 0
ORDER BY s.section
", ['courseid' => $courseid]);
// Get the final period's last day.
if (!$sections) {
$enddate = $course->startdate;
} else {
$dates = $format->get_section_dates(max(array_keys($sections)), null, $sections);
$enddate = $dates->end;
}
// Set the course end date.
if ($course->enddate != $enddate) {
$DB->set_field('course', 'enddate', $enddate, array('id' => $course->id));
if (isset($COURSE->id) && $COURSE->id == $courseid) {
$COURSE->enddate = $enddate;
}
}
}
|
[
"public function setDateEnd($dateEnd);",
"function set_end_date($end_date) {\n $this->end_date = $end_date;\n }",
"public function setDefaultEndDate()\n {\n\n $this->end_date = mktime(0,0,0, $month=6, $day=30, $year=$this->year+1);\n }",
"public function setEndDate(string $end_date): void ;",
"function workOutCourseEndDate($crs_obj_id, $course_creation_date)\n\t{\n\t\tglobal $ilDB;\n\n\t\t$query = $ilDB->query(\"SELECT end_date FROM rep_robj_xtii_assnment \".\n\t\t\t\" WHERE parent_course_obj_id = \".$ilDB->quote($crs_obj_id, \"integer\").\n\t\t\t\" ORDER BY end_date DESC\" .\n\t\t\t\" LIMIT 1 \"\n\t\t\t);\n\t\tif ($ilDB->numRows($query) == 0)\n\t\t{\n\t\t\t$course_end_date = strtotime('+6 months', strtotime($course_creation_date));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$rec = $ilDB->fetchAssoc($query);\n\t\t\t$course_end_date = strtotime('+6 months', strtotime($rec[\"end_date\"]));\n\t\t}\n\n\t\treturn $course_end_date;\n\t}",
"function set_end_date($end_date)\r\n {\r\n return $this->set_additional_property(self :: PROPERTY_END_DATE, $end_date);\r\n }",
"function setEndDate($classId, $end) {\r\n $data['classEndDate'] = $end;\r\n $this->db->where('id', $classId);\r\n $this->db->update('class', $data);\r\n }",
"public function setEndDay($val)\n {\n $this->_propDict[\"endDay\"] = $val;\n return $this;\n }",
"function update_intensive_dates ($convnum, $cid, $userid) {\n global $DB;\n $course = $DB->get_record('course', array('id' => $cid));\n $namecourse = explode('[', $course->shortname);\n if (isset($namecourse[0])) {\n $idname = explode('.M.', $namecourse[0]);\n } else {\n $idname = explode('.M.', $namecourse);\n }\n if (isset($idname[1])) {\n $intensive = $DB->get_record('course', array('shortname' => 'MI.' . $idname[1]));\n $enrol = $DB->get_record('enrol', array('courseid' => $intensive->id, 'enrol' => 'manual'));\n $userdata = $DB->get_record('user', array('id' => $userid));\n if ($DB->get_record('user_enrolments', array('enrolid' => $enrol->id, 'userid' => $userid))) {\n $enrol = $DB->get_record('enrol', array('courseid' => $intensive->id, 'enrol' => 'manual'));\n } else {\n $enrol = $DB->get_record('enrol', array('courseid' => $intensive->id, 'enrol' => 'conduit'));\n }\n $start = $DB->get_record('user_enrolments', array('enrolid' => $enrol->id, 'userid' => $userid));\n $alldates = $DB->get_record('local_eudecustom_call_date', array('courseid' => $intensive->id));\n switch ($convnum) {\n case 1:\n $newdate = $alldates->fecha1;\n break;\n case 2:\n $newdate = $alldates->fecha2;\n break;\n case 3:\n $newdate = $alldates->fecha3;\n break;\n case 4:\n $newdate = $alldates->fecha4;\n break;\n default:\n break;\n }\n // Timeend is timestart + a week in seconds.\n $enrolplugin = enrol_get_plugin('manual');\n $enrolplugin->enrol_user($enrol, $userid, null, $newdate, $newdate + 604800, null, null);\n\n $sql = \"SELECT id\n FROM {local_eudecustom_mat_int}\n WHERE course_shortname = :course_shortname\n AND user_email = :user_email\n AND category_id = :category_id\n ORDER BY matriculation_date DESC\n LIMIT 1\";\n $idmatint = $DB->get_record_sql($sql, array(\n 'course_shortname' => $intensive->shortname,\n 'user_email' => $userdata->email,\n 'category_id' => $course->category));\n $newdata = new stdClass();\n $newdata->id = $idmatint->id;\n $newdata->matriculation_date = $newdate;\n $newdata->conv_number = $convnum;\n\n $recordupdated = $DB->update_record('local_eudecustom_mat_int', $newdata);\n\n // We need to update the event for the course because we changed the start date.\n $intcname = \"'%[[MI]]\" . $intensive->shortname . \"%'\";\n $sql = \"SELECT *\n FROM {event}\n WHERE userid = :userid\n AND timestart = :timestart\n AND name LIKE $intcname\n\t\t\t\t AND eventtype LIKE 'user'\";\n $event = $DB->get_record_sql($sql, array('userid' => $start->userid, 'timestart' => $start->timestart));\n if ($event) {\n $event->timestart = $newdate;\n $eventid = $DB->update_record('event', $event);\n }\n return $recordupdated;\n } else {\n return false;\n }\n}",
"public function setEndOfSupportDate($val)\n {\n $this->_propDict[\"endOfSupportDate\"] = $val;\n return $this;\n }",
"protected function setEndDate($end_date) {\r\n $this->end_date = $end_date;\r\n }",
"function adjust_end_date($payPeriod, $beginDate, $endDate, $client)\n {\n if ($frequency == 365) {\n\n foreach($payPeriod as $date){\n if (isWeekend($date)) {\n $endDate->add(new DateInterval('P1D'));\n }\n }\n\n $hArray = getHolidayArray($beginDate, $endDate);\n\n foreach ($hArray as $holiday) {\n if (!isWeekend(strtotime($holiday)))\n {\n $endDate->add(new DateInterval('P1D'));\n }\n }\n }\n \n return $endDate;\n }",
"function setEndDate($end_date = \"\") \n\t{\n\t\t$this->end_date = $end_date;\n\t}",
"public function get_end_date();",
"public function setEndDay($val)\n {\n $this->_propDict[\"endDay\"] = $val;\n return $this;\n }",
"function recurrence_end_date( $start_date, $period, $installments ) {\n\t$period = strtolower(str_replace('ly', '', $period));\n\t// Adjust for quarterly and 1st and 15th periods.\n\tif ( preg_match( '/quarter/', $period ) ) {\n\t\t$period = 'months';\n\t\t$installments *= 3;\n\t} else if ( preg_match( '/1st and 15th/', $period ) ) {\n\t\t$period = 'weeks';\n\t\t$installments *= 2;\n\t}\n\t$end_date_u = strtotime(\"+\" . $installments . \" \" . $period . \" \" . $start_date);\n\treturn date('Y-m-d', $end_date_u);\n}",
"public function setEndPeriod($end_date)\n\t\t{\n\t\t\tif($this->_isValidDate($end_date)){\n\t\t\t\t$this->_end_date = $end_date;\t\n\t\t\t}\n\t\t}",
"function xmldb_format_weeks_upgrade($oldversion) {\n global $CFG, $DB;\n\n require_once($CFG->dirroot . '/course/format/weeks/lib.php');\n require_once($CFG->dirroot . '/course/format/weeks/db/upgradelib.php');\n\n if ($oldversion < 2017020200) {\n\n // Remove 'numsections' option and hide or delete orphaned sections.\n format_weeks_upgrade_remove_numsections();\n\n upgrade_plugin_savepoint(true, 2017020200, 'format', 'weeks');\n }\n\n if ($oldversion < 2017050300) {\n // Go through the existing courses using the weeks format with no value set for the 'automaticenddate'.\n $sql = \"SELECT c.id, c.enddate, cfo.id as cfoid\n FROM {course} c\n LEFT JOIN {course_format_options} cfo\n ON cfo.courseid = c.id\n AND cfo.format = c.format\n AND cfo.name = :optionname\n AND cfo.sectionid = 0\n WHERE c.format = :format\n AND cfo.id IS NULL\";\n $params = ['optionname' => 'automaticenddate', 'format' => 'weeks'];\n $courses = $DB->get_recordset_sql($sql, $params);\n foreach ($courses as $course) {\n $option = new stdClass();\n $option->courseid = $course->id;\n $option->format = 'weeks';\n $option->sectionid = 0;\n $option->name = 'automaticenddate';\n if (empty($course->enddate)) {\n $option->value = 1;\n $DB->insert_record('course_format_options', $option);\n\n // Now, let's update the course end date.\n format_weeks::update_end_date($course->id);\n } else {\n $option->value = 0;\n $DB->insert_record('course_format_options', $option);\n }\n }\n $courses->close();\n\n upgrade_plugin_savepoint(true, 2017050300, 'format', 'weeks');\n }\n\n // Automatically generated Moodle v3.3.0 release upgrade line.\n // Put any upgrade step following this.\n\n // Automatically generated Moodle v3.4.0 release upgrade line.\n // Put any upgrade step following this.\n\n if ($oldversion < 2018030900) {\n\n // During upgrade to Moodle 3.3 it could happen that general section (section 0) became 'invisible'.\n // It should always be visible.\n $DB->execute(\"UPDATE {course_sections} SET visible=1 WHERE visible=0 AND section=0 AND course IN\n (SELECT id FROM {course} WHERE format=?)\", ['weeks']);\n\n upgrade_plugin_savepoint(true, 2018030900, 'format', 'weeks');\n }\n\n // Automatically generated Moodle v3.5.0 release upgrade line.\n // Put any upgrade step following this.\n\n // Automatically generated Moodle v3.6.0 release upgrade line.\n // Put any upgrade step following this.\n\n // Automatically generated Moodle v3.7.0 release upgrade line.\n // Put any upgrade step following this.\n\n // Automatically generated Moodle v3.8.0 release upgrade line.\n // Put any upgrade step following this.\n\n return true;\n}",
"public function setDateTimeEnd($value) { // sets the dateTimeEnd\r\n\t\t$this->dateTimeEnd = $value;\r\n\t\t\r\n\t\t$this->dateTimeEndConvert = date(\"Y/m/d 23:59:59\", strtotime($this->dateTimeEnd)); \r\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
move list item down
|
function moveItemDown()
{
$li =& $this->getNode();
$next =& $li->next_sibling();
$next_copy = $next->clone_node(true);
$next_copy =& $li->insert_before($next_copy, $li);
$next->unlink($next);
}
|
[
"function moveItemDown()\n\t{\n\t\t$this->content_obj->moveItemDown();\n\t\t$_SESSION[\"il_pg_error\"] = $this->pg_obj->update();\n\t\t$this->ctrl->returnToParent($this, \"jump\".$this->hier_id);\n\t}",
"function moveItemUp()\n\t{\n\t\t$tab = $this->getNode();\n\t\t$prev = $tab->previous_sibling();\n\t\t$tab_copy = $tab->clone_node(true);\n\t\t$tab_copy =& $prev->insert_before($tab_copy, $prev);\n\t\t$tab->unlink($tab);\n\t}",
"function moveItemUp()\r\n\t{\r\n\t\t$this->content_obj->moveItemUp();\r\n\t\t$_SESSION[\"il_pg_error\"] = $this->pg_obj->update();\r\n\t\t$this->ctrl->returnToParent($this, \"jump\".$this->hier_id);\r\n\t}",
"function moveDown()\n {\n $db =& eZDB::globalDatabase();\n $db->query_single( $qry, \"SELECT ID, ListOrder FROM eZAddress_AddressType\n WHERE Removed=0 AND ListOrder>'$this->ListOrder' ORDER BY ListOrder ASC\", array( \"Limit\" => \"1\" ) );\n $listorder = $qry[$db->fieldName(\"ListOrder\")];\n $listid = $qry[$db->fieldName(\"ID\")];\n\n $db->begin();\n $res[] = $db->query( \"UPDATE eZAddress_AddressType SET ListOrder='$listorder' WHERE ID='$this->ID'\" );\n $res[] = $db->query( \"UPDATE eZAddress_AddressType SET ListOrder='$this->ListOrder' WHERE ID='$listid'\" );\n eZDB::finish( $res, $db );\n }",
"public function decrementPosition()\n {\n if($this->isNotInList()) return NULL;\n $this->setListifyPosition($this->getListifyPosition() - 1);\n }",
"function moveUp()\n {\n $db =& eZDB::globalDatabase();\n $db->query_single( $qry, \"SELECT ID, ListOrder FROM eZAddress_OnlineType\n WHERE Removed=0 AND ListOrder<'$this->ListOrder' ORDER BY ListOrder DESC\", array( \"Limit\" => \"1\" ) );\n $listorder = $qry[$db->fieldName( \"ListOrder\" )];\n $listid = $qry[$db->fieldName( \"ID\" )];\n\n $db->begin();\n $res[] = $db->query( \"UPDATE eZAddress_OnlineType SET ListOrder='$listorder' WHERE ID='$this->ID'\" );\n $res[] = $db->query( \"UPDATE eZAddress_OnlineType SET ListOrder='$this->ListOrder' WHERE ID='$listid'\" );\n eZDB::finish( $res, $db );\n }",
"public function moveDown() {\n\t\t$this->owner->setPosition($this->owner->{$this->positionFiled} + 1);\n\t}",
"function moveUp ( $id ) {\n\t\t\n\t\tif (($position = $this->getPosition($id)) > 0) {\n\t\t\t$itemBefore = $this->_items[$position-1];\n\t\t\t$this->_items[$position-1] = $id;\n\t\t\t$this->_items[$position] = $itemBefore;\n\t\t}\n\t}",
"public function moveHigher()\n\t{\n\t\tif (!$this->isFirst()) {\n\t\t\t$this->getPreviousItem()->incrementPosition();\n\t\t\t$this->decrementPosition();\n\t\t}\n\t}",
"public function moveToBottom()\n {\n if($this->isNotInList()) return NULL;\n\n $this->getConnection()->transaction(function()\n {\n $this->decrementPositionsOnLowerItems();\n $this->assumeBottomPosition();\n });\n }",
"private function moveUp()\n\t{\n\t\t$value = $this->current->value;\n\t\tif ($this->current->parent) {\n\t\t\t$this->current = $this->current->parent;\n\t\t} else {\n\t\t\t$this->current = null;\n\t\t}\n\n\t\t$this->appendValue($value);\n\t}",
"public function moveItemDown($item,$path)\n {\n $list = $this->getNodeChildren($path->getId(), $item->getParentId());\n\n // find where is the path is the list to get the id of the previous one\n $i = 0;\n while( $i < count($list) )\n {\n if( $list[$i]['id'] == $item->getId() )\n {\n break;\n }\n $i++;\n }\n\n // if the path is the first of the list\n if( $i == count($list) - 1 )\n {\n return false;\n }\n\n $currentRank = $item->getRank();\n $otherItemId = $list[$i+1]['id'];\n\n\n // get the item that is at the new position\n $otherItem = new item();\n $otherItem->load($otherItemId);\n\n // invert ranks\n $newRank = $otherItem->getRank();\n\n $otherItem->setRank($currentRank);\n $item->setRank($newRank);\n\n // save the two paths\n if( $item->validate() && $otherItem->validate() )\n {\n $item->save();\n $otherItem->save();\n\n return true;\n }\n else\n {\n return false;\n }\n }",
"public function moveDownstairs()\n {\n $startIndex = (int)$this->sort_index;\n foreach (self::find()->where('sort_index >= :index', ['index' => $startIndex])->andWhere(['nav_container_id' => $this->nav_container_id, 'parent_nav_id' => $this->parent_nav_id])->orderBy('sort_index ASC')->asArray()->all() as $item) {\n --$startIndex;\n Yii::$app->db->createCommand()->update(self::tableName(), ['sort_index' => $startIndex], 'id=:id', ['id' => $item['id']])->execute();\n }\n }",
"function _menuMoveItemsOneDown($parentID) {\n\tglobal $Auth;\n\t\n\t## multiclient\n\t$client_id = $Auth->auth[\"client_id\"];\n\n\t## we will update all subpages of the supplied parent\n\t$db_connection = new DB_Sql();\n\t$query = \"UPDATE \".STRUCTURE.\" SET structure_order=structure_order+1 WHERE structure_parent='$parentID' AND client_id='$client_id'\";\n\t$result = $db_connection->query($query);\t\n}",
"public function moveDown(&$image) {\n\t\tCroppedImage::where('uplink_type', $image->uplink_type)\n\t\t\t->where('uplink_id', $image->uplink_id)\n\t\t\t->where('position', '>', $image->position + 1)\n\t\t\t->update(['position' => DB::raw('position + 1')]);\n\t\t\t\n\t\t$image->position += 2;\n\t\t$image->save();\n\t\t\n\t\t$this->reorder($image->uplink_type, $image->uplink_id);\n\t}",
"private function addToListBottom()\n {\n if($this->isNotInList())\n {\n $this->setListifyPosition($this->bottomPositionInList() + 1);\n }\n }",
"private function assumeBottomPosition()\n {\n $this->setListPosition($this->bottomPositionInList($this) + 1);\n }",
"public function movePrev()\n {\n return prev($this->_items);\n }",
"public function move_down () {\n\t\tif (!$this->can_move_down())\n\t\t\treturn false;\n\t\t$storage = Storage::getInstance();\n\n\t\t$node = $this->get_next_ancestor();\n\t\t$this->sort++; $node->sort--;\n\t\t$storage->save($this); $storage->save($node);\n\t}",
"protected function moveDown()\n {\n // Make sure a key exists below the current position\n if (!$this->keyExists($this->row + 1, $this->column)) {\n return;\n }\n\n $this->row++;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
apply permissions to each attachment
|
private function applyAttachmentPermissions($attachment = '') {
//sanity - make sure this is a valid object
if ($attachment instanceof \App\Models\Attachment) {
//delete permissions
$attachment->permission_delete_attachment = $this->attachmentpermissions->check('delete', $attachment);
}
}
|
[
"protected function installPermissions()\n\t{\n\t\tglobal $attachments_install_verbose;\n\n\t\t/** Load the Attachments defines */\n\t\trequire_once(JPATH_ADMINISTRATOR.'/components/com_attachments/update.php');\n\t\tAttachmentsUpdate::installAttachmentsPermissions($attachments_install_verbose);\n\t}",
"public function changePermissions()\n {\n foreach ($this->filePermissions as $filePermission) {\n if (array_key_exists('filePath', $filePermission) &&\n array_key_exists('chmod', $filePermission) &&\n is_writable($filePermission['filePath'])) {\n chmod($filePermission['filePath'], $filePermission['chmod']);\n }\n }\n }",
"public function authorizeForAttachment()\n {\n if (! $this->newResourceWith($this->findModelOrFail())->authorizedToAttach(\n $this, $this->findRelatedModel()\n )) {\n abort(403);\n }\n }",
"private function __setPermissions() {\n\n\t\t// permissao para adicionar\n\t\tif ( !$this->permissoes_lib->hasPermission( 'criar', $this->_routine ) ) {\n\t\t\t$this->_crud->unset_add();\n\t\t}\n\n\t\t// permissao para adicionar\n\t\tif ( !$this->permissoes_lib->hasPermission( 'ver', $this->_routine ) ) {\n\t\t\t$this->_crud->unset_read();\n\t\t}\n\n\t\t// permissao para adicionar\n\t\tif ( !$this->permissoes_lib->hasPermission( 'editar', $this->_routine ) ) {\n\t\t\t$this->_crud->unset_edit();\n\t\t}\n\n\t\t// permissao para adicionar\n\t\tif ( !$this->permissoes_lib->hasPermission( 'excluir', $this->_routine ) ) {\n\t\t\t$this->_crud->unset_delete();\n\t\t}\n\t}",
"private function setPermissions(): void\n {\n Gate::define('edit-job', function ($user, $job) {\n return $user->id == $job->staff_id;\n });\n\n Gate::define('create-application-response', function ($user, $job) {\n return $user->id == $job->staff_id;\n });\n\n Gate::define('access-education', function ($user, $education) {\n return $user->id == $education->worker_id;\n });\n\n Gate::define('access-experience', function ($user, $experience) {\n return $user->id == $experience->worker_id;\n });\n\n Gate::define('access-worker', function ($user, $worker) {\n return $user->id == $worker->user_id;\n });\n }",
"private function handle_permissions(){ \n DB::delete('projects_granted_permissions')->where('project_id', '=', $this->project->id)->execute();\n if( isset($this->post['visibility']) AND isset($this->post[$this->post['visibility'].'_permissions']))\n { \n $selected_permissions = $this->post[$this->post['visibility'].'_permissions']; \n foreach($selected_permissions as $permission_id){\n $this->project->add('granted_permissions', ORM::factory('Projectpermissions', array('id' => $permission_id)));\n } \n } \n }",
"public function definePermissions();",
"function fn_attachments_check_permission($request)\n{\n /**\n * Changes input parameters for attachment permission check\n *\n * @param array $request Array of query parameters\n */\n fn_set_hook('attachments_check_permission_pre', $request);\n\n $permission = false;\n\n if (!empty($request['object_type']) && !empty($request['object_id'])) {\n $table = \"products\";\n $field = \"product_id\";\n\n $condition = db_quote(\"AND ?f = ?i?p\", $field, $request['object_id'], fn_get_company_condition(\"?:{$table}.company_id\"));\n\n /**\n * Checks permission to work with the attachment\n *\n * @param array $request Array of query parameters\n * @param string $table Table to perform check\n * @param string $field SQL field to be selected in an SQL-query\n * @param string $condition String containing SQL-query condition prepended with a logical operator (AND or OR)\n */\n fn_set_hook('attachments_check_permission', $request, $table, $field, $condition);\n\n $object_id = db_get_field(\n \"SELECT ?f FROM ?:?f WHERE 1 ?p\",\n $field,\n $table,\n $condition\n );\n if (!empty($object_id)) {\n $permission = true;\n }\n }\n\n /**\n * Changes result of attachment permission check\n *\n * @param array $request Array of query parameters\n */\n fn_set_hook('attachments_check_permission_post', $request, $permission);\n\n return $permission;\n}",
"public static function assignPermissions()\n {\n $tutor = static::whereName('tutor')->first();\n $tutor->givePermission(Permission::whereName('publish-courses')->first());\n\n $admin = static::whereName('administrator')->first();\n foreach (array_keys(Permission::defaultPermissions()) as $key) {\n $admin->givePermission(Permission::whereName($key)->first());\n }\n }",
"public function attachPermissions($permissions, $pivot = []);",
"public function managePermissions(): void\n {\n }",
"protected function configurePermissions()\n {\n //\n }",
"function guru_upload_everything () {\n\n\t$role = get_role ('administrator');\n\t$role->add_cap('unfiltered_upload', true);\n\n}",
"public function setPermissions($permissions) {}",
"function _read_authorize() {\n\t\t$this->Attachment->is_visible($this->current_user, $this->_project) ? true : $this->deny_access();\n\t}",
"private function _SetAggregatePermissions($force = FALSE)\n\t{\n\t\t$this->_SetModuleAdminInterfaces();\n\t\tif( is_array($this->_perms) && $force == FALSE ) return;\n\n\t\t$this->_perms = array();\n\t\t$this->_breadcrumbs = array();\n\n\t\t// Content Permissions\n $this->_perms['htmlPerms'] = check_permission($this->userid, 'Add Global Content Blocks') |\n\t\t\tcheck_permission($this->userid, 'Modify Global Content Blocks') |\n\t\t\tcheck_permission($this->userid, 'Delete Global Content Blocks');\n\n\t\t$gCms = cmsms();\n\t\t$gcbops = $gCms->GetGlobalContentOperations();\n\n $thisUserBlobs = $gcbops->AuthorBlobs($this->userid);\n if (count($thisUserBlobs) > 0)\n {\n\t\t\t\t$this->_perms['htmlPerms'] = true;\n }\n $this->_perms['pagePerms'] = (\n\t\t\t\t\t\t\t\t\t check_permission($this->userid, 'Modify Any Page') ||\n\t\t\t\t\t\t\t\t\t check_permission($this->userid, 'Add Pages') ||\n\t\t\t\t\t\t\t\t\t check_permission($this->userid, 'Remove Pages') ||\n\t\t\t\t\t\t\t\t\t check_permission($this->userid, 'Manage All Content')\n\t\t\t\t\t\t\t\t\t );\n $thisUserPages = author_pages($this->userid);\n if (count($thisUserPages) > 0)\n {\n\t\t\t\t$this->_perms['pagePerms'] = true;\n }\n $this->_perms['contentPerms'] = $this->_perms['pagePerms'] | $this->_perms['htmlPerms'] | \n\t\t\t(isset($this->_sectionCount['content']) && $this->_sectionCount['content'] > 0);\n\n\t\t// layout \n $this->_perms['templatePerms'] = check_permission($this->userid, 'Add Templates') |\n\t\t\tcheck_permission($this->userid, 'Modify Templates') |\n\t\t\tcheck_permission($this->userid, 'Remove Templates');\n $this->_perms['cssPerms'] = check_permission($this->userid, 'Add Stylesheets') |\n\t\t\tcheck_permission($this->userid, 'Modify Stylesheets') |\n\t\t\tcheck_permission($this->userid, 'Remove Stylesheets');\n $this->_perms['cssAssocPerms'] = check_permission($this->userid, 'Add Stylesheet Assoc') |\n\t\t\tcheck_permission($this->userid, 'Modify Stylesheet Assoc') |\n\t\t\tcheck_permission($this->userid, 'Remove Stylesheet Assoc');\n $this->_perms['layoutPerms'] = $this->_perms['templatePerms'] |\n\t\t\t$this->_perms['cssPerms'] | $this->_perms['cssAssocPerms'] |\n\t\t\t(isset($this->_sectionCount['layout']) && $this->_sectionCount['layout'] > 0);\n\n\t\t// file / image\n $this->_perms['filePerms'] = check_permission($this->userid, 'Modify Files') |\n\t\t\t(isset($this->_sectionCount['files']) && $this->_sectionCount['files'] > 0);\n \n\t\t// user/group\n $this->_perms['userPerms'] = check_permission($this->userid, 'Add Users') |\n\t\t\tcheck_permission($this->userid, 'Modify Users') |\n\t\t\tcheck_permission($this->userid, 'Remove Users');\n $this->_perms['groupPerms'] = check_permission($this->userid, 'Add Groups') |\n\t\t\tcheck_permission($this->userid, 'Modify Groups') |\n\t\t\tcheck_permission($this->userid, 'Remove Groups');\n $this->_perms['groupPermPerms'] = check_permission($this->userid, 'Modify Permissions');\n $this->_perms['groupMemberPerms'] = check_permission($this->userid, 'Modify Group Assignments');\n $this->_perms['usersGroupsPerms'] = $this->_perms['userPerms'] |\n\t\t\t$this->_perms['groupPerms'] |\n\t\t\t$this->_perms['groupPermPerms'] |\n\t\t\t$this->_perms['groupMemberPerms'] |\n\t\t\t(isset($this->_sectionCount['usersgroups']) &&\n\t\t\t $this->_sectionCount['usersgroups'] > 0);\n\n\t\t// admin\n $this->_perms['sitePrefPerms'] = check_permission($this->userid, 'Modify Site Preferences') |\n (isset($this->_sectionCount['preferences']) && $this->_sectionCount['preferences'] > 0);\n $this->_perms['adminPerms'] = $this->_perms['sitePrefPerms'] |\n (isset($this->_sectionCount['admin']) && $this->_sectionCount['admin'] > 0);\n $this->_perms['siteAdminPerms'] = $this->_perms['sitePrefPerms'] |\n\t\t\t$this->_perms['adminPerms'] |\n\t\t\t(isset($this->_sectionCount['admin']) &&\n\t\t\t $this->_sectionCount['admin'] > 0);\n\n\n\t\t// extensions\n $this->_perms['codeBlockPerms'] = check_permission($this->userid, 'Modify User-defined Tags');\n $this->_perms['modulePerms'] = check_permission($this->userid, 'Modify Modules');\n $this->_perms['eventPerms'] = check_permission($this->userid, 'Modify Events');\n\t\t$this->_perms['taghelpPerms'] = check_permission($this->userid, 'View Tag Help');\n $this->_perms['extensionsPerms'] = $this->_perms['codeBlockPerms'] |\n $this->_perms['modulePerms'] |\n\t\t\t$this->_perms['eventPerms'] |\n\t\t\t$this->_perms['taghelpPerms'] |\n (isset($this->_sectionCount['extensions']) && $this->_sectionCount['extensions'] > 0);\n\t}",
"public function assignPermissions()\n {\n Role::AddPermissions( 'master', [ \n 'manage@options', \n 'manage@users', \n 'manage@profile', \n 'install@modules', \n 'enable@modules',\n 'disable@modules',\n 'update@modules',\n 'delete@modules' \n ]);\n\n Role::AddPermissions( 'admin', [ \n 'manage@options', \n 'manage@users', \n 'manage@profile' \n ]);\n\n Role::AddPermissions( 'user', [ \n 'manage@profile' \n ]);\n }",
"abstract public function setPermission(File $f, $access, $enable, $owneronly);",
"public function setPermissions (\n\t)\t\t\t\t\t// RETURNS <void>\n\t\n\t// $social->setPermissions();\n\t{\n\t\t$clearance = 0;\n\t\t\n\t\t// If you own the page, all access is granted\n\t\tif(Me::$id == $this->uniID)\n\t\t{\n\t\t\t$clearance = 10;\n\t\t}\n\t\t\n\t\t// Pull your clearance with this user\n\t\telse\n\t\t{\n\t\t\t$clearance = AppFriends::getClearance(Me::$id, $this->uniID);\n\t\t}\n\t\t\n\t\t// Check if you're a moderator or staff member\n\t\tif(Me::$clearance >= 6)\n\t\t{\n\t\t\t$clearance = max(Me::$clearance, $clearance);\n\t\t}\n\t\t\n\t\t// Set the access levels\n\t\t$this->clearance = $clearance;\n\t\t$this->canAccess = $this->data['perm_access'] <= $clearance ? true : false;\n\t\t$this->canPost = $this->data['perm_post'] <= $clearance && $this->uniID > 0 ? true : false;\n\t\t$this->canComment = $this->data['perm_comment'] <= $clearance && $this->uniID > 0 ? true : false;\n\t}",
"function _read_authorize()\n {\n $this->Attachment->is_visible($this->current_user, $this->_project) ? true : $this->deny_access();\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Set last date order key
|
public function setLastDateOrderKey(string $lastDateOrderKey)
{
$this->lastDateOrderKey = $lastDateOrderKey;
return $this;
}
|
[
"private function setLatestOrderID() {\n\t return $this->client->incr(LATEST_ORDER_ID);\n }",
"function change_order_date() {\n\t\t\t\n\t\t\t}",
"public function setLastKey($value)\n {\n $this->_lastKey = $value;\n }",
"function LastOrderDate() {return $this->getLastOrderDate();}",
"public function setLastIndex($date);",
"function set_order_date ($order_date ){\n $this->order_date = $order_date ;\n return $this->order_date ;\n }",
"public function setPreferredTokenSigningKeyEndDateTime(?DateTime $value): void {\n $this->getBackingStore()->set('preferredTokenSigningKeyEndDateTime', $value);\n }",
"protected abstract function _setOrder();",
"public function setLastEcommerceOrderCreatedAt($lastCreatedAt);",
"function setOrderMeta(){\n\t\t$meta_key = '_wpsc_auth_net_status';\n\t\t$type = 'wpsc_purchase_log';\n\t\twpsc_update_meta($this->purchase_id,$meta_key,$this->metaOrder,$type);\n\t}",
"public function set_date_completed( $date = null ) {\n\t\t$this->set_last_order_date( 'date_completed', $date );\n\t}",
"public function lastKey();",
"private function updateDeliveryDate()\n {\n $messageDb = Zend_Registry::get(\"messageDB\");\n //insert subscription proxy or update existing\n $sql = 'INSERT INTO zanby_subscription__group_delivery (group_subscription_id, last_delivery) VALUES '.\n '('.$this->getId().', NOW()) '.\n 'ON DUPLICATE KEY UPDATE last_delivery = VALUES(last_delivery)';\n $messageDb->query($sql);\n }",
"protected function setLastJobAsActive(){\n\t\t$this->setJobKey(end($this->_jobKeys));\n\t}",
"public function setOrderDate(string $orderDate = \"\")\n {\n $this->orderDate = $orderDate;\n }",
"protected function setup_date() {\n update_option($this->key, time());\n }",
"function wc_generate_order_key($key = '')\n {\n }",
"function set_lastobservationdate( $lastobservationdate ) {\n\n $this->lastobservationdate = $lastobservationdate;\n\n }",
"public function end_sorted_set($key) {\n\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Tries to guess time values in time string $time_string formatted with $fmt Returns an array('hour','minute','second','month','day','year') At this moment only most common tags are supported.
|
static function parseTimeString($locale, $time_string, $fmt)
{
$hour = 0;
$minute = 0;
$second = 0;
$month = 0;
$day = 0;
$year = 0;
if(!($time_array = self :: explodeTimeStringByFormat($time_string, $fmt)))
return -1;
foreach($time_array as $time_char => $value)
{
switch($time_char)
{
case '%p':
case '%P':
if(strtolower($value) == $locale->getPmName())
$hour += 12;
break;
case '%I':
case '%H':
$hour = (int)$value;
break;
case '%M':
$minute = (int)$value;
break;
case '%S':
$second = (int)$value;
break;
case '%m':
$month = (int)$value;
break;
case '%b':
case '%h':
if(($index = array_search($value, $locale->getMonthNames(true))) !== false)
{
if($index !== false)
$month = $index + 1;
}
break;
case '%B':
if(($index = array_search($value, $locale->getMonthNames())) !== false)
{
if($index !== false)
$month = $index + 1;
}
break;
case '%d':
$day = (int)$value;
break;
case '%Y':
$year = (int)$value;
break;
case '%y':
if($value < 40)
$year = 2000 + $value;
else
$year = 1900 + $value;
break;
case '%T':
if ($regs = explode(':', $value))
{
$hour = (int)$regs[1];
$minute = (int)$regs[2];
$second = (int)$regs[3];
}
break;
case '%D':
if ($regs = explode('/', $value))
{
$hour = (int)$regs[1];
$minute = (int)$regs[2];
$second = (int)$regs[3];
}
break;
case '%R':
if ($regs = explode(':', $value))
{
$hour = (int)$regs[1];
$minute = (int)$regs[2];
}
break;
}
}
return array('hour' => $hour, 'minute' => $minute, 'second' => $second, 'month' => $month, 'day' => $day, 'year' => $year);
}
|
[
"function nopadding_time_parser ($time) {\r\n if (strlen($time) == 6) { # complete. always correct.\r\n # hourminutesecond\r\n return sscanf($time,\"%02d%02d%02d\");\r\n }\r\n elseif (strlen($time) == 5) {\r\n $correct = array();\r\n # try 1 char second\r\n list($hour,$minute,$second) = sscanf($time,\"%02d%02d%01d\");\r\n if ($hour < 24 and $minute < 60 and $second < 60) $correct[] = sprintf('%02d%02d%02d',$hour,$minute,$second);\r\n # try 1 char minute\r\n list($hour,$minute,$second) = sscanf($time,\"%02d%01d%02d\");\r\n if ($hour < 24 and $minute < 60 and $second < 60) $correct[] = sprintf('%02d%02d%02d',$hour,$minute,$second);\r\n # try 1 char hour\r\n list($hour,$minute,$second) = sscanf($time,\"%01d%02d%02d\");\r\n if ($hour < 24 and $minute < 60 and $second < 60) $correct[] = sprintf('%02d%02d%02d',$hour,$minute,$second);\r\n\r\n if (count($correct) == 0) return array(0,0,0); # fail\r\n if (count($correct) > 1) sort($correct,SORT_STRING);\r\n return sscanf(array_pop($correct),\"%02d%02d%02d\");\r\n }\r\n elseif (strlen($time) == 4) {\r\n $correct = array();\r\n # try 1 char hour/minute\r\n list($hour,$minute,$second) = sscanf($time,\"%01d%01d%02d\");\r\n if ($hour < 24 and $minute < 60 and $second < 60) $correct[] = sprintf('%02d%02d%02d',$hour,$minute,$second);\r\n # try 1 char hour/second\r\n list($hour,$minute,$second) = sscanf($time,\"%01d%02d%01d\");\r\n if ($hour < 24 and $minute < 60 and $second < 60) $correct[] = sprintf('%02d%02d%02d',$hour,$minute,$second);\r\n # try 1 char minute/second\r\n list($hour,$minute,$second) = sscanf($time,\"%02d%01d%01d\");\r\n if ($hour < 24 and $minute < 60 and $second < 60) $correct[] = sprintf('%02d%02d%02d',$hour,$minute,$second);\r\n\r\n if (count($correct) == 0) return array(0,0,0); # fail\r\n if (count($correct) > 1) sort($correct,SORT_STRING);\r\n return sscanf(array_pop($correct),\"%02d%02d%02d\");\r\n }\r\n elseif (strlen($time) == 3) { # always correct\r\n return sscanf($time,\"%d%d%d\");\r\n }\r\n else {\r\n return array(0,0,0);\r\n }\r\n }",
"private static function get_time_strings() {\n\t\treturn array(\n\t\t\t'y' => array( __( 'year', 'formidable' ), __( 'years', 'formidable' ) ),\n\t\t\t'm' => array( __( 'month', 'formidable' ), __( 'months', 'formidable' ) ),\n\t\t\t'w' => array( __( 'week', 'formidable' ), __( 'weeks', 'formidable' ) ),\n\t\t\t'd' => array( __( 'day', 'formidable' ), __( 'days', 'formidable' ) ),\n\t\t\t'h' => array( __( 'hour', 'formidable' ), __( 'hours', 'formidable' ) ),\n\t\t\t'i' => array( __( 'minute', 'formidable' ), __( 'minutes', 'formidable' ) ),\n\t\t\t's' => array( __( 'second', 'formidable' ), __( 'seconds', 'formidable' ) ),\n\t\t);\n\t}",
"protected function _unparseTimeInfo( $string )\n\t{\n\t\tif( strpos( $string, '=' ) !== false )\n\t\t{\n\t\t\t$_tmp\t= explode( '=', $string );\n\t\t\t$_key\t= explode( ';', $_tmp[0] );\n\t\t\t$tmp\t= explode( ':', $_tmp[1] );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$_tmp\t= array();\n\t\t\t$_key\t= array();\n\t\t\t$tmp\t= explode( ':', $string );\n\t\t\t$tmp[0]\t= 'DATETIME';\n\t\t}\n\t\t\n\t\t$tzid\t= '';\n\t\t\n\t\t//-----------------------------------------\n\t\t// Got a TZID?\n\t\t//-----------------------------------------\n\n\t\tif ( $_key[1] == 'TZID' )\n\t\t{\n\t\t\t$tzid\t= $tmp[0];\n\t\t}\n\n\t\t//-----------------------------------------\n\t\t// Is it a date?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( $tmp[0] == 'DATE' )\n\t\t{\n\t\t\t$timestamp\t= strtotime( $tmp[1] );\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$timestamp\t= '?';\n\t\t}\n\n\t\t$return = array(\n\t\t\t\t\t\t\t'type'\t\t=> $tmp[0],\n\t\t\t\t\t\t\t'raw'\t\t=> $tmp[1],\n\t\t\t\t\t\t\t'raw_ts'\t=> strtotime( $tmp[1] ),\n\t\t\t\t\t\t\t'ts'\t\t=> $timestamp,\n\t\t\t\t\t\t\t'tzid'\t\t=> str_replace( '\"', '', $tzid ),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t\n\t\t//-----------------------------------------\n\t\t// Earliest? Latest?\n\t\t//-----------------------------------------\n\t\t\n\t\tif ( ( $this->_feedEarliest == 0 ) OR ( $return['raw_ts'] < $this->_feedEarliest ) )\n\t\t{\n\t\t\t$this->_feedEarliest\t= $return['raw_ts'];\n\t\t}\n\t\t\n\t\tif ( ( $this->_feedLatest == 0 ) OR ( $return['raw_ts'] > $this->_feedLatest ) )\n\t\t{\n\t\t\t$this->_feedLatest\t\t= $return['raw_ts'];\n\t\t}\n\t\t\n\t\t//-----------------------------------------\n\t\t// Return\n\t\t//-----------------------------------------\n\t\t\n\t\treturn $return;\n\t}",
"static public function getArrayTimeFromSegments($string) {\n //2011-04-01 06:30 -> // mktime is as follows (hour, minute, second, month, day, year)\n\n $data = explode(' ', $string);\n $d = explode(':', $data[1]);\n $keys = array('hour', 'min');\n return array_combine($keys, $d);\n }",
"function parse_mysql_time_hours($time) {\n $result = array();\n $hours = \"\";\n $minutes = \"\";\n $seconds = \"\";\n sscanf($time, \"%d:%d:%d\", $hours, $minutes, $seconds);\n $result['hours'] = $hours;\n $result['minutes'] = $minutes;\n $result['seconds'] = $seconds;\n return ($result);\n}",
"function datefmt_get_timetype($fmt){}",
"function parse_mysql_time($time) {\n $result = array();\n $h = 0 + substr($time, 0, strlen($time) - 6);\n $result['hour'] = fmod($h, 24);\n $result['day'] = intval($h / 24);\n $result['minute'] = intval(substr($time, strlen($time) - 5, 2));\n return ($result);\n}",
"function explode_time($time, $format = 'unix')\n\t{\n\t\tswitch ($format)\n\t\t{\n\t\t\tcase 'mysql':\n\t\t\t\t$time_fragments = $this->explode_mysql_time($time);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t$time_fragments = $this->explode_unix_time($time);\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn $time_fragments;\n\t}",
"function Val_time ($String) {\r\n\tlist ($Hours, $Minutes) = explode (\":\", $String);\r\n\tif (Val_int ($Hours, 2) === false || Val_num ($Minutes, 2) === false) {\r\n\t\treturn false;\r\n\t}\r\n \r\n\tif ($Hours > 24 || $Minutes > 60) {\r\n\t\treturn false;\r\n\t}\r\n \r\n\treturn $String;\r\n}",
"function GetTimeCodes( $avail_string )\n {\n $time_codes = array();\n\n for ($i = 0; $i < 168; $i++) {\n if ($avail_string[$i] == 2) {\n $time_codes[] = $i;\n }\n }\n\n return $time_codes;\n }",
"function t_parse($input){\n\tglobal $tk, $fl, $ln, $t_parse, $t_out;\n\t//pass blank directly back to output\n\tif(!strlen($input))return array('','blank');\n\t\n\tif(preg_match('/^[0-9]{14}$/',$input)){\n\t\t//timestamp (MySQL)\n\t\t$yr=substr($input,0,2);\n\t\t$YR=substr($input,0,4);\n\t\t$readable=$YR.'-'.substr($input,4,2).'-'.substr($input,6,2).' '.substr($input,8,2).':'.substr($input,10,2).':'.substr($input,12,2);\n\t\tif(strtotime($readable)==-1 || strtotime($readable)===false){\n\t\t\t//we have to do further operations\n\t\t\tmail($developerEmail,'date read error',get_globals(),$fromHdrBugs);\n\t\t\treturn array(false,'error-timestamp');\n\t\t}else{\n\t\t\treturn array(strtotime($readable),'timestamp');\n\t\t}\n\t}else if(is_int($input)){\n\t\t//presume a unix timestamp\n\t\treturn array($input,'unix');\n\t}else if(preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2}:[0-9]{2})*$/',$input)){\n\t\tif(!preg_match('/[1-9]/',$input)){\n\t\t\t//zero datetime - we are going to assume that THIS would never happen in good coding: 0000-00-00 14:30:00 (2:30 elapsed time)\n\t\t\treturn array('','blank-datetime');\n\t\t}else if(strtotime($input)==-1 || strtotime($input)===false){\n\t\t\t//we have to do further operations\n\t\t\treturn array(false,'error-datetime');\n\t\t}else{\n\t\t\treturn array(strtotime($input),'datetime');\n\t\t}\n\t}else if(preg_match('/^[0-9]{2}:[0-9]{2}:[0-9]{2}$/',$input)\n\t\tif(strtotime($input)==-1 || strtotime($input)===false){\n\t\t\t//we have to do further operations\n\t\t\treturn array(false,'error-datetime');\n\t\t}else{\n\t\t\treturn array(strtotime($input),'datetime');\n\t\t}\n\t}",
"public function testStrToTimeFormat() {\n $this->assertEquals(515995200, $this->plugin->tamper('1986-05-09 04:00:00 GMT'));\n $this->assertEquals(515995200, $this->plugin->tamper('May 9, 1986 04:00:00 GMT'));\n $this->assertEquals(515995200, $this->plugin->tamper('Fri, 09 May 1986 04:00:00 GMT'));\n }",
"public function parseDateTime($timeString) {\n\t\t$result = array();\t\t\n\t\t//echo \"<br>Parsing:datetime: \".$timeString;\n\n\t\tif (preg_match('`^([0-9]+)T([0-9]+)Z`m', $timeString, $m)) {\n\t\t\t$date = $m[1];\n\t\t\t$time = substr($m[2], 0, 4);\n\t\t\t//echo \"<br> Date: $date, Time: $time (FORM #2: DATE WITH UTC TIME)\";\n\t\t\t//echo \"<br> UNIMPLEMENTED!!! \";\t\t\t\n\t\t\t$result = $this->utcToLocalTime($date, $time);\n\t\t} else if (preg_match('`^TZID=(.*):([0-9]+)T([0-9]+)`m', $timeString, $m)) {\n\t\t\t$tz = $m[1];\n\t\t\t$date = $m[2];\n\t\t\t$time = substr($m[3], 0, 4);\n\t\t\t//echo \"<br> Date: $date, Time: $time, Timezone: $tz (FORM #3: DATE WITH LOCAL TIME AND TIME ZONE REFERENCE)\";\t\t\t\t\t\t\n\t\t\t$result = $this->tzToLocalTime($date, $time, $tz);\t\t\t\n\t\t} else if (preg_match('`^([0-9]+)T([0-9]+)`m', $timeString, $m)) {\n\t\t\t$date = $m[1];\n\t\t\t$time = substr($m[2], 0, 4);\n\t\t\t//echo \"<br> Date: $date, Time: $time (FORM #1: DATE WITH LOCAL TIME)\";\n\t\t\t\n\t\t\t$result[\"timezone\"] = $this->timezone;\n\t\t\t$result[\"localDate\"] = $date;\n\t\t\t$result[\"localTime\"] = $time;\n\t\t} else {\n\t\t\techo \"<br> Unsuported format. See https://www.kanzaki.com/docs/ical/\";\t\t\t\n\t\t}\n\n\t\t//echo \"<br><textarea style=' width: 300px; height: 142px; background: #dadada;'>\";\n\t\t//print_r ($result);\n\t\t//echo \"</textarea>\";\n\n\t\treturn $result;\n\t}",
"public static function is_valid_time_string($time_string) {\n if (!is_string($time_string)) {\n return false;\n }\n $regex = \"/^(0?[0-9]|1[0-9]|2[0-3])(:(0?[0-9]|[1-5][0-9]|60)){1,2}$/\";\n return (preg_match($regex, $time_string) > 0);\n }",
"public static function timeStringToSeconds($string) {\n $seconds = 0;\n $multipliers = array(1, 60, 3600);\n \n $char = (strpos($string, ':') !== false) ? ':' : '.';\n $times = explode($char, $string);\n // 0 => seconds, 1 => minutes, 2 => hours\n $times = array_reverse($times);\n \n foreach($times as $i => $number) {\n $number = intval(ltrim($number, '0')); // remove suffixed 0's and make int\n $seconds = $seconds + ($number * $multipliers[$i]);\n }\n \n return $seconds;\n }",
"static public function parseTime($time) {\n return DateTime::createFromFormat('H:i', $time)->format('H:i:s');\n }",
"function validate_time($time)\r\n{\r\n\t$exp = explode(\":\", $time);\r\n\tif (($exp[0] > 23) || ($exp[0] < 0))\r\n\t\t\treturn false;\r\n\tif (($exp[1] > 59) || ($exp[1] < 0))\r\n\t\t\treturn false;\r\n\treturn true;\r\n}",
"public static function timeProvider() {\n\t\t$db = ConnectionManager::getDataSource('test');\n\t\t$now = $db->expression('NOW()');\n\t\treturn array(\n\t\t\t// blank\n\t\t\tarray(\n\t\t\t\tarray('hour' => '', 'min' => '', 'meridian' => ''),\n\t\t\t\t''\n\t\t\t),\n\t\t\t// missing hour\n\t\t\tarray(\n\t\t\t\tarray('hour' => '', 'min' => '00', 'meridian' => 'pm'),\n\t\t\t\t''\n\t\t\t),\n\t\t\t// all blank\n\t\t\tarray(\n\t\t\t\tarray('hour' => '', 'min' => '', 'sec' => ''),\n\t\t\t\t''\n\t\t\t),\n\t\t\t// set and empty merdian\n\t\t\tarray(\n\t\t\t\tarray('hour' => '1', 'min' => '00', 'meridian' => ''),\n\t\t\t\t''\n\t\t\t),\n\t\t\t// midnight\n\t\t\tarray(\n\t\t\t\tarray('hour' => '12', 'min' => '0', 'meridian' => 'am'),\n\t\t\t\t'00:00:00'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\tarray('hour' => '00', 'min' => '00'),\n\t\t\t\t'00:00:00'\n\t\t\t),\n\t\t\t// 3am\n\t\t\tarray(\n\t\t\t\tarray('hour' => '03', 'min' => '04', 'sec' => '04'),\n\t\t\t\t'03:04:04'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\tarray('hour' => '3', 'min' => '4', 'sec' => '4'),\n\t\t\t\t'03:04:04'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\tarray('hour' => '03', 'min' => '4', 'sec' => '4'),\n\t\t\t\t'03:04:04'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t$now,\n\t\t\t\t$now\n\t\t\t)\n\t\t);\n\t}",
"public static function getTimeFormats()\n {\n return array( 'g:i A' => '7:30 PM', 'H:i' => '19:30' );\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Capture an authorized charge.
|
public function charge_capture( $order ) {
Omise_Hooks::set_omise_user_agent();
try {
$post = Omise_Charge::get_post_charge( $order->id );
if ( ! $post )
throw new Exception( 'Order id was not found' );
$id = Omise_Charge::get_charge_id_from_post( $post );
if ( is_null( $id ) || $id === '' )
throw new Exception( 'Charge id was not found' );
$charge = OmiseCharge::retrieve( $id, '', $this->secret_key );
$charge->capture();
if ( ! OmisePluginHelperCharge::isPaid( $charge ) )
throw new Exception( $charge['failure_message'] );
$order->payment_complete();
$order->add_order_note( 'Payment with Omise successful (manual captured)' );
} catch ( Exception $e ) {
$order->add_order_note( $e->getMessage() );
}
}
|
[
"public function testCapture() {\n $charge = OmiseCharge::retrieve('chrg_test_4zmrjgxdh4ycj2qncoj');\n $charge->capture();\n\n $this->assertArrayHasKey('object', $charge);\n $this->assertEquals('charge', $charge['object']);\n $this->assertTrue($charge['captured']);\n }",
"public function create_credit_card_charge() {\n\n\t\t$this->create_transaction( self::AUTHORIZE_AND_CAPTURE );\n\t}",
"public function charge($charge)\n {\n }",
"public function capture(float $amount) {\n // TODO: Find out what \"the merchant can capture the amount multiple times\" and \"the merchant can’t capture more than we initially authorized him to.\" mean.\n // I read this as the merchant being able to capture bits and pieces of the amount in the authorization request, but no more.\n $this->authorizationRequest->markAsCaptured($amount);\n $this->card->loseMoney($amount);\n $this->authorizationRequest->sendToMerchant($amount);\n define(EPSILON, 0.00001);\n // Cleans up the relevant authorization request if it's zero.\n if ($this->authorizationRequest->getAuthorizedAmount() < EPSILON) {\n $this->card->removeEarmarked($this->authorizationRequest);\n }\n\n }",
"public function captureCharge($data) {\n\t\ttry {\n\t\t\t$cm = __CLASS__ . __METHOD__;\n\t\t\tMlog::addone ( $cm, __LINE__ );\n\t\t\tMlog::addone ( $cm . __LINE__ . '::$data--->', $data );\n\t\t\t$ch = \\Stripe\\Charge::retrieve ( $data ['id'] );\n\t\t\t$collection = $ch->capture ();\n\t\t\t$result = $collection->__toArray ( true );\n\t\t\tMlog::addone ( $cm . __LINE__ . '::$result--->', $result );\n\t\t\treturn $result;\n\t\t} catch ( \\Stripe\\Error\\Base $e ) {\n\t\t\t// Display a very generic error to the user, and maybe send\n\t\t\t// yourself an email\n\t\t\tMlog::addone ( $cm . __LINE__ . '::Error--->', $e->getMessage () );\n\t\t\treturn null;\n\t\t} catch ( Exception $e ) {\n\t\t\t// Something else happened, completely unrelated to Stripe\n\t\t\tMlog::addone ( $cm . __LINE__ . '::Error--->', $e->getMessage () );\n\t\t\treturn null;\n\t\t}\n\t}",
"public function doCapture()\n {\n // populate fields\n $query = array(\n // Transaction Id\n self::AUTHORIZATION_ID => $this->transactionId,\n // amount of the payment\n self::AMOUNT => $this->amount,\n // currency code, default is USD\n self::CURRENCY => $this->currency,\n // Valid values are Complete or NotComplete\n self::COMPLETE_TYPE => $this->completeType,\n // An informational note about the settlement\n self::NOTE => $this->note);\n\n // call request method\n $response = $this->request(self::DO_CAPTURE, $query);\n // if parameters are success\n if (isset($response[self::ACK])\n && $response[self::ACK] == self::SUCCESS) {\n // Get the authorization Id\n return $response[self::AUTHORIZATION_ID];\n }\n\n return $response;\n }",
"public function capture_charge($stripe_charge_id, $amount = null) {\n try {\n $charge = \\Stripe\\Charge::retrieve($stripe_charge_id);\n\n if (!isset($amount)) {\n $charge->capture();\n } else {\n $charge->capture([\n 'amount' => $amount\n ]);\n }\n } catch (\\Stripe\\Error\\RateLimit $e) {\n $this->handle_stripe_exception($e);\n } catch (\\Stripe\\Error\\InvalidRequest $e) {\n $this->handle_stripe_exception($e);\n } catch (\\Stripe\\Error\\Authentication $e) {\n $this->handle_stripe_exception($e);\n } catch (\\Stripe\\Error\\ApiConnection $e) {\n $this->handle_stripe_exception($e);\n } catch (\\Stripe\\Error\\Base $e) {\n $this->handle_stripe_exception($e);\n }\n\n return $charge;\n }",
"public function credit_card_capture( \\WC_Order $order ) {\n\n\t\t$request = $this->get_new_credit_card_request( $order );\n\n\t\t$request->set_capture_data();\n\n\t\treturn $this->perform_request( $request );\n\t}",
"public function capture() {\n $sOxid = oxConfig::getParameter( \"oxid\");\n if ( $sOxid != \"-1\" && isset( $sOxid)) {\n $oOrder = oxNew( \"oxorder\" );\n $oOrder->load( $sOxid);\n\n $dAmount = oxConfig::getParameter('capture_amount');\n if($dAmount && $dAmount > 0) {\n $oPORequest = oxNew('fcporequest');\n $oResponse = $oPORequest->sendRequestCapture($oOrder, $dAmount);\n \n $oLang = oxLang::getInstance();\n if($oResponse['status'] == 'APPROVED') {\n $this->_aViewData[\"captureMessage\"] = '<span style=\"color: green;\">'.$oLang->translateString('FCPO_CAPTURE_APPROVED', null, true).'</span>';\n } elseif($oResponse['status'] == 'ERROR') {\n $this->_aViewData[\"captureMessage\"] = '<span style=\"color: red;\">'.$oLang->translateString('FCPO_CAPTURE_ERROR', null, true).$oResponse['errormessage'].'</span>';\n }\n }\n }\n }",
"public function capture_payment( $order_id ) {\n\t\t\t$order = wc_get_order( $order_id );\n\n\t\t\tif ( 'nps' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->payment_method : $order->get_payment_method() ) ) {\n\t\t\t\t$charge = get_post_meta( $order_id, '_nps_charge_id', true );\n\t\t\t\t$captured = get_post_meta( $order_id, '_nps_charge_captured', true );\n\n\t\t\t\tif ( $charge && 'no' === $captured ) {\n \n Configuration::environment(Constants::CUSTOM_ENV);\n Configuration::verifyPeer(false);\n Configuration::customUrl($this->get_url());\n Configuration::secretKey($this->get_secret_key()); \n // Configuration::logger(WC_Nps::get_instance());\n\n WC_Nps::log( \"Info: Beginning capture for order $order_id for the amount of {$order->get_total()}\" );\n \n $sdk = new Sdk(); \n $request = array(\n 'psp_Version' => '2.2',\n 'psp_MerchantId' => self::get_merchant_id(),\n 'psp_TxSource' => 'WEB',\n 'psp_MerchTxRef' => strtoupper(uniqid($order_id.\".\", true)),\n 'psp_TransactionId_Orig' => $charge,\n 'psp_AmountToCapture' => $order->get_total() * 100, \n 'psp_PosDateTime' => date('Y-m-d H:i:s'),\n 'psp_UserId' => get_current_user_id(), \n );\n WC_Nps::log( 'Processing capture request: ' . print_r( $request, true ), WC_Nps::get_nps_logging() );\n $response = $sdk->capture($request);\n WC_Nps::log( 'Processing capture response: ' . print_r( $response, true ), WC_Nps::get_nps_logging() );\n \n\t\t\t\t\tif ( @$response->psp_ResponseCod != \"0\" ) {\n $capture_message = sprintf( __( 'Unable to capture charge! - Capture ID: %1$s - psp_MerchTxRef: %2$s - Reason: %3$s', 'woocommerce-gateway-nps' ), @$response->psp_TransactionId, @$response->psp_MerchTxRef, @$response->psp_ResponseExtended);\n $order->add_order_note( $capture_message ); \n WC_Nps::log( sprintf( __( 'Error: Transaction ID: %d - Reason: %s', 'woocommerce-gateway-nps' ), @$response->psp_TransactionId, @$response->psp_ResponseExtended) );\n\t\t\t\t\t} else {\n $capture_message = sprintf( __( 'Captured %1$s - Capture ID: %2$s - Reason: %3$s', 'woocommerce-gateway-nps' ), wc_price( @$response->psp_CapturedAmount / 100 ), @$response->psp_TransactionId, @$response->psp_ResponseExtended );\n WC_Nps::log( 'Success: ' . html_entity_decode( strip_tags( $capture_message ) ) );\n\t\t\t\t\t\t$order->add_order_note( sprintf( __( 'Nps charge complete (Charge ID: %s)', 'woocommerce-gateway-nps' ), @$response->psp_TransactionId ) );\n\t\t\t\t\t\tupdate_post_meta( $order_id, '_nps_charge_captured', 'yes' );\n update_post_meta( $order_id, '_transaction_id', @$response->psp_TransactionId );\n \n\t\t\t\t\t\t// Store other data such as fees\n\t\t\t\t\t\tupdate_post_meta( $order_id, 'Nps Payment ID', @$response->psp_TransactionId );\n\n\t\t\t\t\t\t/* if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) {\n\t\t\t\t\t\t\t// Fees and Net needs to both come from Nps to be accurate as the returned\n\t\t\t\t\t\t\t// values are in the local currency of the Nps account, not from WC.\n\t\t\t\t\t\t\t$fee = ! empty( $result->balance_transaction->fee ) ? self::format_number( $result->balance_transaction, 'fee' ) : 0;\n\t\t\t\t\t\t\t$net = ! empty( $result->balance_transaction->net ) ? self::format_number( $result->balance_transaction, 'net' ) : 0;\n\t\t\t\t\t\t\tupdate_post_meta( $order_id, 'Nps Fee', $fee );\n\t\t\t\t\t\t\tupdate_post_meta( $order_id, 'Net Revenue From Nps', $net );\n\t\t\t\t\t\t} */\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"public function authorize($order, $chargeId)\n {\n if ($order->isPaymentReview()) {\n $this->setProcessing($order);\n $payment = $order->getPayment();\n\n $transaction = $this->transactionBuilder->setPayment($payment)\n ->setOrder($order)\n ->setTransactionId($chargeId)\n ->setFailSafe(true)\n ->build(Transaction::TYPE_AUTH);\n\n $formattedAmount = $order->getBaseCurrency()->formatTxt($payment->getBaseAmountAuthorized());\n if ($order->getBaseCurrencyCode() != $order->getOrderCurrencyCode()) {\n $formattedAmount = $formattedAmount .' ['. $order->formatPriceTxt($payment->getAmountOrdered()) .']';\n }\n $message = __('Authorized amount of %1.', $formattedAmount);\n $payment->addTransactionCommentsToOrder($transaction, $message);\n $payment->setIsTransactionClosed(false);\n $payment->setParentTransactionId($chargeId);\n\n $order->save();\n $this->asyncLogger->info('Set Processing for Order #' . $order->getIncrementId());\n }\n }",
"private function handle_successful_charge($charge)\n {\n // Omise API 2017-11-02 uses `refunded`, \n // Omise API 2019-05-29 uses `refunded_amount`.\n $refunded_amount = isset($charge['refunded_amount'])\n ? $charge['refunded_amount']\n : $charge['refunded'];\n\n $fullyRefunded = $refunded_amount == $charge['funding_amount'];\n $partiallyRefunded = $refunded_amount > 0 && $refunded_amount < $charge['funding_amount'];\n $total_amount = $this->order->get_total();\n $currency = $this->order->get_currency();\n\n if ($fullyRefunded) {\n $this->handle_fully_refunded_charge($total_amount, $currency);\n return;\n }\n if ($partiallyRefunded) {\n $this->handle_partially_refunded_charge($refunded_amount, $currency);\n return;\n }\n\n $this->order->add_order_note(\n sprintf(\n $this->allow_br('Opn Payments: Payment successful.<br/>An amount %1$s %2$s has been paid (manual sync).'),\n $total_amount,\n $currency\n )\n );\n\n $this->delete_capture_metadata();\n\n if (!$this->order->is_paid()) {\n $this->order->payment_complete();\n }\n }",
"public function charge() {\n\n if ($this->charged) {\n return;\n }\n\n // TODO Check that we're not using currencies which shouldn't be multiplied by 100\n try {\n $charge = Charge::create(array(\n \"amount\" => $this->fee * 100,\n \"currency\" => $this->currency,\n \"source\" => $this->token,\n \"description\" => sprintf(\"Charge to %s for event %s\", $this->member, $this->event),\n \"statement_descriptor\" => substr(sprintf(\"Charge for %s\", $this->event), 0, 22),\n \"receipt_email\" => $this->email,\n \"metadata\" => array (\n \"member\" => $this->member,\n \"event\" => $this->event,\n )\n ));\n\n $this->charged = $charge->captured;\n $this->save();\n if ($charge->failure_message) {\n return $charge->failure_message;\n }\n\n return false;\n } catch(Exception $e) {\n return $e->getMessage();\n }\n }",
"function _charge()\n\t{\n\t\t$title=get_screen_title('CHARGE_CUSTOMER');\n\n\t\t$username=post_param('member_username');\n\t\t$member_id=$GLOBALS['FORUM_DRIVER']->get_member_from_username($username);\n\t\t$amount=post_param_integer('amount');\n\t\t$cpf_id=NULL;\n\t\t$cpf_id=get_credits_profile_field_id();\n\t\tif (is_null($cpf_id))\n\t\t{\n\t\t\t$msg_tpl=warn_screen($title,do_lang_tempcode('INVALID_FIELD_ID'));\n\t\t\t$msg_tpl->evaluate_echo();\n\t\t\treturn;\n\t\t}\n\n\t\t// Increment the number of credits this customer has\n\t\trequire_code('ocf_members_action2');\n\t\t$fields=ocf_get_custom_field_mappings($member_id);\n\n\t\t// Work out new total credits\n\t\t$new_amount=$fields['field_'.strval($cpf_id)]-$amount;\n\t\tif (post_param_integer('allow_overdraft',0)==0)\n\t\t{\n\t\t\tif ($new_amount<0)\n\t\t\t{\n\t\t\t\t$new_amount=0;\n\t\t\t\t$amount=$fields['field_'.strval($cpf_id)]-$new_amount;\n\t\t\t}\n\t\t}\n\n\t\tocf_set_custom_field($member_id,$cpf_id,$new_amount);\n\n\t\t$GLOBALS['SITE_DB']->query_insert('credit_charge_log',array(\n\t\t\t'member_id'=>$member_id,\n\t\t\t'charging_member_id'=>get_member(),\n\t\t\t'num_credits'=>$amount,\n\t\t\t'date_and_time'=>time(),\n\t\t\t'reason'=>post_param('reason',''),\n\t\t));\n\n\t\t// Show it worked / Refresh\n\t\t$url=build_url(array('page'=>'_SELF','type'=>'misc','username'=>$username),'_SELF');\n\t\treturn redirect_screen($title,$url,do_lang_tempcode('SUCCESS'));\n\t}",
"public function create_credit_card_capture() {\n\n\t\t$this->create_transaction( self::TRANSACTION_TYPE_TAGGED_PRE_AUTHORIZATION_COMPLETION );\n\t}",
"function woo_nmi_add_order_capture_charge_action( $actions ) {\n\tglobal $theorder;\n\n\t$doNotAddCaptureAction = true;\n\t$trans_id = $theorder->get_transaction_id();\n\t$apiKey = woo_nmi_get_api_key();\n\n\t$transaction = woo_nmi_getTransaction( $trans_id, $apiKey );\n\tif ( isset( $transaction['condition'] ) ) {\n\t\tif ( $transaction['condition'] === 'pending' ) {\n\t\t\t$doNotAddCaptureAction = false;\n\t\t}\n\t}\n\n\t// check that the post meta for capture exists\n\t// or if transactionhas been captured in the user's NMI account\n\tif ( $doNotAddCaptureAction === true ) {\n\t\tif ( ! empty( get_post_meta( $theorder->get_id(), 'order_charge_captured', true ) ) ) {\n\n\t\t\t// capture processed in nmi\n\t\t\t$theorder->add_order_note( __( 'Authorization has been captured using NMI account', NMI_Config::$pluginId ) );\n\n\t\t\tif ( isset( $transaction['action'][1]['response_text'] ) ) {\n\t\t\t\t$result = array();\n\t\t\t\t$result['result-text'] = $transaction['action'][1]['response_text'];\n\t\t\t\t$result['result-code'] = $transaction['action'][1]['response_code'];\n\t\t\t\t$result['authorization-code'] = $transaction['authorization_code'];\n\t\t\t\t$result['transaction-id'] = $theorder->get_transaction_id();\n\n\t\t\t\t$note = woo_nmi_get_order_completion_notes( 'success', $result );\n\t\t\t\t$theorder->add_order_note( __( $note, NMI_Config::$pluginId ) );\n\t\t\t}\n\n\t\t\t$theorder->payment_complete( $theorder->get_transaction_id() );\n\n\t\t\t// delete post meta to disallow further capturing\n\t\t\tdelete_post_meta( $theorder->get_id(), 'order_charge_captured' );\n\t\t}\n\t\treturn $actions;\n\t}\n\n\t// add custom order action to capture charge\n\t$actions['capture_charge_action'] = __( 'Capture Charge', NMI_Config::$pluginId );\n\treturn $actions;\n}",
"public function create_credit_card_capture() {\n\n\t\t$this->create_transaction( self::TRANSACTION_TYPE_POST_AUTH );\n\t}",
"public function create_credit_card_charge() {\n $this->TransactionCodes = $this->TransactionCodes->addCode(TransactionCode::SINGLE_PASS);\n\n\t $FACData = [\n\t 'amount' => $this->get_order()->payment_total,\n\t 'currency' => $this->get_order_prop('currency'),\n\t 'transactionId' => $this->getFACOrderNumber(),\n 'transactionCode' => $this->TransactionCodes,\n\t ];\n\n\t switch ($this->FACAPI->getIntegrationOption())\n\t {\n\t case Constants::GATEWAY_INTEGRATION_DIRECT:\n\t $FACData['card'] = $this->getFACCreditCard();\n\t $FACData['merchantResponseURL'] = $this->MerchantResponseURL;\n\n\t break;\n\n\t case Constants::GATEWAY_INTEGRATION_HOSTED:\n if($this->FACAPI->get3DS() === true) $this->TransactionCodes->addCode(TransactionCode::HOSTED_PAGE_AUTH_3DS);\n\n $FACData['cardHolderResponseURL'] = $this->CardHolderResponseURL;\n $FACData[Constants::AUTHORIZE_OPTION_HOSTED_PAGE] = true;\n $FACData['hostedPagePageSet'] = $this->FACAPI->getFacPageSet();\n $FACData['hostedPageName'] = $this->FACAPI->getFacPageName();\n\t break;\n\t }\n\n\n\t $this->FACRequest = $this->FACAPI->purchase($FACData);\n\t}",
"public function fullChargeAfterAuthorize(): void\n {\n $card = $this->createCardObject();\n /** @var Card $card */\n $card = $this->heidelpay->createPaymentType($card);\n\n $authorization = $card->authorize(1.0, 'EUR', self::RETURN_URL, null, null, null, null, false);\n $payment = $authorization->getPayment();\n\n // pre-check to verify changes due to fullCharge call\n $this->assertAmounts($payment, 1.0, 0.0, 1.0, 0.0);\n $this->assertTrue($payment->isPending());\n\n $charge = $this->heidelpay->chargeAuthorization($payment->getId());\n $paymentNew = $charge->getPayment();\n\n // verify payment has been updated properly\n $this->assertAmounts($paymentNew, 0.0, 1.0, 1.0, 0.0);\n $this->assertTrue($paymentNew->isCompleted());\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the no lot interets.
|
public function getNoLotInterets(): ?int {
return $this->noLotInterets;
}
|
[
"public function getNoLotIs() {\n return $this->noLotIs;\n }",
"public function getNoLotTrace() {\n return $this->noLotTrace;\n }",
"public function getNoitedomingo()\r\n {\r\n return $this->noitedomingo;\r\n }",
"public function getNonstock()\n\t{\n\t\treturn $this->nonstock;\n\t}",
"public static function getNonWinningNominations()\n {\n $currPeriod = Period::getCurrentPeriod();\n $period_id = $currPeriod->getId();\n $db = new \\PHPWS_DB('nomination_nomination');\n $db->addColumn('id');\n $db->addWhere('period', $period_id);\n $db->addWhere('winner', 0);\n $results = $db->select('col');\n\n $lost = array();\n\n foreach ($results as $nom) {\n $id = $nom['id'];\n $nomination = NominationFactory::getNominationbyId($id);\n array_push($lost, $nomination);\n }\n\n return $lost;\n }",
"public function getNonrit()\n\t{\n\t\treturn $this->nonrit;\n\t}",
"public function getCarNoDoor(){\r\n\t\t$this->car_no_door = getValue(\"SELECT no_door FROM tbl_car WHERE car_id=\".$this->car_id);\r\n\t\treturn $this->car_no_door;\r\n\t}",
"public function getNumLotPeriodicite() {\n return $this->numLotPeriodicite;\n }",
"function noizetier_obtenir_infos_noisettes() {\n\tstatic $noisettes = false;\n\n\t// seulement 1 fois par appel, on lit ou calcule tous les contextes\n\tif ($noisettes === false) {\n\t\t// lire le cache des descriptions sauvees\n\t\tlire_fichier_securise(_DIR_CACHE._CACHE_DESCRIPTIONS_NOISETTES, $noisettes);\n\t\t$noisettes = @unserialize($noisettes);\n\t\t// s'il en mode recalcul, on recalcule toutes les descriptions des noisettes trouvees.\n\t\t// ou si le cache est desactive\n\t\tif (!$noisettes or (_request('var_mode') == 'recalcul') or (defined('_NO_CACHE') and _NO_CACHE != 0)) {\n\t\t\t$noisettes = noizetier_obtenir_infos_noisettes_direct();\n\t\t\tecrire_fichier_securise(_DIR_CACHE._CACHE_DESCRIPTIONS_NOISETTES, serialize($noisettes));\n\t\t}\n\t}\n\n\treturn $noisettes;\n}",
"public function getNotoriety() {\n return $this->notoriety;\n }",
"public function _getLotNo1() {\n\t\treturn $this->_lotNo1;\n\t}",
"public function getNoLotEcr(): ?int {\n return $this->noLotEcr;\n }",
"public function getNoPessoa()\n {\n return $this->no_pessoa;\n }",
"public function getCountMissing() {\n\t\treturn $this->missing;\n\t}",
"public function getHoraExtraIntervaloNoturno()\n {\n return $this->oHoraExtraIntervaloNoturna;\n }",
"private function getUnblockedNums(){\n $UnblockedNums=array();\n foreach ($this->numbers as $key=>$blocked){\n if(!$blocked){\n array_push($UnblockedNums,$key);\n }\n }\n return $UnblockedNums;\n }",
"public function getAuxLots()\n {\n return $this->auxLots;\n }",
"public static function getNonPerformingLoans(){}",
"function getMissingObjects()\n\t{\n\t\treturn $this->missing_objects;\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Das gleiche wie mysqli::close(), bei Erfolg der schliessung der Verbindung wird this::connected auf false gesetzt.
|
public function close()
{
if (parent::close())
$this->connected = false;
else
$this->throwWarning('mysqli couldn`t close');
return true;
}
|
[
"function close() {\n\n if($this->db_status == \"connected\") {\n if(!mysqli_close($this->connectid)) {\n $this->errornumber = mysqli_errno($this->connectid);\n $this->errormessage = mysqli_error($this->connectid);\n return 0;\n }\n else {\n $this->db_status = \"disconnected\";\n return 1;\n }\n }\n else {\n return 0;\n }\n }",
"function closedb(){\r\n\t\tif($this->socket)\r\n\t\t\t\r\n\t\t\tmysqli_close($this->socket);\r\n\t\t\t$this->connected = false;\r\n\t}",
"public function closeDatabase(){\n try{\n mysqli_close($this->connectionHandler);\n\n $this->flag= false;\n //Setting the flag to false\n return true;\n }\n catch(Exception $e){\n return false;\n }\n }",
"function close()\n\t{\n\t\tif($this->status != 'connected')\n\t\t\treturn self::db_close_not_connected;\n\t\t\t\n\t\tif($this->typeIs(self::db_type_mysql))\n\t\t\tif(!$this->db_handle->close())\n\t\t\t{\n\t\t\t\t$this->error_message = 'Connection remains unclosed: '.$this->db_handle->error();\n\t\t\t\treturn self::db_close_not_closed;\n\t\t\t}\n\t\telse if($this->typeIs(self::db_type_postgre))\n\t\t\tif(!(pg_close($this->db_handle)))\n\t\t\t{\n\t\t\t\t$this->error_message = 'Connection remains unclosed: '.$this->db_handle->error();\n\t\t\t\treturn self::db_close_not_closed;\n\t\t\t}\n\t\t\n\t\t$this->status = 'unconnected';\n\t\treturn 0;\n\t}",
"function sql_close()\n\t{\n\t\tmysqli_close($this->db);\n\t}",
"function closeConnection() {\n\t\t$this->dbConnect->close(); \n\t}",
"function closedbconnection() {\r\n\t\t\r\n\t\t\r\n #if ($this->dbconnection = TRUE) {\r\n mysql_close($this->dbconnection);\r\n #}\r\n \r\n }",
"public function closeConnection()\r\n {\r\n $this->_db = NULL;\r\n }",
"public function disconnect()\n {\n if ($this->_link)\n {\n mysql_close($this->_link);\n return 1;\n } else return 0;\n }",
"function reconnect()\n {\n $this->dispose(\"without\", \"connectionInfo\");\n $this->connection = @new mysqli($this->connectionInfo[\"Host\"], $this->connectionInfo[\"Port\"], $this->connectionInfo[\"User\"], $this->connectionInfo[\"Pass\"], $this->connectionInfo[\"DaBa\"], $this->connectionInfo[\"ChSt\"]);\n if($this->connection->connect_error)\n $this->throwError(\"An Error Occured while opening a connection to the database: \".$this->connection->connect_error, \"dispose\", $this->dieAfterError);\n $this->connectionOpen = true;\n }",
"function CloseConnection() {\n\t\tif (mysql_close($this->CONNECTION)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t$this->ERROR_MSG = \"\\r\\n\" . \"Unable to close database connection - \" . date('H:i:s');\n\t\t\t$this->debug();\n\t\t\treturn false;\n\t\t}\n\t}",
"public function __destruct()\r\n {\r\n if ($this->isConnected)\r\n mysql_close($this->db);\r\n }",
"public function close()\n\t{\n\t\t$status = mysql_close($this->dblink);\n\t\t$this->setErrors();\n\t\t\n\t\tif($status == true) {\n\t\t\t$this->dblink = false;\n\t\t\t$this->resource = false;\n\t\t}\n\t\treturn $status;\n\t}",
"protected function _inner_open() {\n if ($this->_outer_is_open && !$this->_inner_is_open) {\n $this->_mysqli = new mysqli(...$this->_connectionParam);\n if (!mysqli_connect_error()) {\n $this->_inner_is_open = true;\n }\n }\n\n return $this->_inner_is_open;\n }",
"public function dbClose()\n {\n $this->connection = null;\n }",
"public function closeConnection()\n {\n $this->mysql->close();\n }",
"public static function close() {\n if (self::$conn) {\n // aplica las operaciones realizadas\n // durante la transaccion\n self::$conn->commit();\n self::$conn = NULL;\n }\n }",
"function disconnetti()\n\t\t{\n\t\tif ($this->DBConn === false) \n\t\t\treturn;\n\t\t@mssql_close($this->DBConn);\n\t\t$this->DBConn = false;\n\t\t}",
"public function disconnectDatabase ()\r\n\t{\r\n\t\tif (! is_null($this->db)) {\r\n\t\t\tif ($this->db\r\n\t\t\t\t->isConnected() && $this->db\r\n\t\t\t\t->closeConnection()) return TRUE;\r\n\t\t}\r\n\t\treturn FALSE;\r\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
TODO: Implement getLogContent() method.
|
public function getLogContent()
{
}
|
[
"public function getLogContent()\n {\n return $this->log_content;\n }",
"protected function getLogContent(): string\n {\n return $this->log->getLogFile()->getContent();\n }",
"public function getLogContent()\n {\n return $this->recruit_count . ':'.$this->recruit_content;\n }",
"public function getLogData();",
"public static function getLogContent()\n\t{\n\t\t//opens the log file if it's not openned yet\n\t\tif (is_null(self::$handle))\n\t\t\tself::openHandle();\n\t\tif(!is_null(self::$handle))\n\t\t\treturn fgets(self::$handle);\n\t}",
"public function getHistoryLog()\n {\n return $this->logger->getLogContent();\n }",
"public function readLog () {\n }",
"public function readLog()\n {\n }",
"public function getHtmlLog() {}",
"public function readlog()\n {\n }",
"abstract public function logData();",
"public static function read(){\n\t\t\treturn file_get_contents(self::$_logFile);\n\t\t}",
"public function getLogObject()\n {\n return $this->log;\n }",
"public function getLog()\n\t{\n\t\tif ( ! isset($this->log))\n\t\t{\n\t\t\t$this->setLog($this->newLog());\n\t\t}\n\n\t\treturn $this->log;\n\t}",
"public function get_log() {\n\t\treturn $this->logger->get_log();\n\t}",
"protected function log() {\n }",
"public function getDataLog()\n {\n return $this->dataLog;\n }",
"function logs(){\n $result = $this->dma->managementApiCall(\"GET\", \"{$this->hashid}/logs\");\n return $result['response'];\n }",
"public function getLogListing()\r\n {\r\n $id = $this->getRequest()->getParam('id');\r\n $data = $this->activityRepository->getActivityLog($id);\r\n return $data->getData();\r\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Tests that a simple package can be created.
|
public function testCreation()
{
$id = 'Test';
$paths = [__DIR__];
$namespace = $this->createMock(NamespaceInterface::class);
$namespace->method('getId')
->willReturn($id);
$namespace->method('getPaths')
->willReturn($paths);
$package = new Package($namespace);
$this->assertSame($id, $package->getId());
$this->assertSame($paths, $package->getPaths());
}
|
[
"public function testSimplePacker()\n {\n // Setup the prerequisites for the packer.\n $packages = $this->getPackages();\n $source = $this->getSource($packages);\n $dir = $this->getDir();\n\n // Run the packer to generate the files.\n $packager = new SimplePacker($source, $dir);\n $files = $packager->generate();\n\n // A SimplePacker should only return a single file which is the packages.json file.\n // Use this as a basis for a Composer repository.\n $file = reset($files);\n $repository = $this->getRepository($file);\n\n // Compare the packages in the repository with the ones from the source.\n $this->compareRepositoryPackages($repository, $packages);\n }",
"public function testExistMethodIndicatesIfPackageExist()\n {\n $this->assertTrue(Package::exists('dashboard'));\n $this->assertFalse(Package::exists('foo'));\n }",
"public function testGetPackages() {\n\t\t$manager = new APackageManager();\n\t\t$packages = $manager->getPackages();\n\t\t$this->assertTrue(isset($packages->ypm));\n\t\t$this->assertTrue($packages->ypm instanceof APackage);\n\t}",
"public function testGet() {\n // Create\n $ph_company_package = $this->phactory->create('company_packages');\n\n // Get\n $this->company_package->get( $ph_company_package->company_package_id );\n\n // Assert\n $this->assertEquals( self::NAME, $this->company_package->name );\n }",
"public function testBasicInfo()\n {\n $project = $this->getProject(0);\n $package = $this->getPackage($project, true);\n\n $this->assertEquals($project->path, $package->path);\n $this->assertEquals('master', $package->branch);\n $this->assertEquals(['master', 'origin/master'], $package->branches);\n $this->assertEquals(['master' => 'origin/master'], $package->upstreams);\n $this->assertEquals($project->name, $package->name);\n $this->assertEquals($project->remote, $package->remote);\n $this->assertTrue($package->isRoot);\n $this->assertTrue($package->git);\n $this->assertEquals([], $package->requires);\n }",
"public function testOrgApacheSlingDistributionPackagingImplExporterLocalDistributio() {\n\n }",
"public function testCanCreateFramework()\n {\n }",
"#[@test]\n public function archiveClassPackageProvided() {\n $class= \\lang\\XPClass::forName('net.xp_framework.unittest.reflection.classes.ClassThree');\n $this->assertTrue($class\n ->getClassLoader()\n ->providesPackage($class->getPackage()->getName())\n );\n }",
"public function testCreateModuleMetaFile()\n\t{\n\t\t\\App\\Module::createModuleMetaFile();\n\t\t$this->assertTrue(true);\n\t}",
"public function packageExists($package_name = '');",
"#[@test]\n public function fileSystemClassPackageProvided() {\n $class= \\lang\\XPClass::forName('net.xp_framework.unittest.reflection.classes.ClassOne');\n $this->assertTrue($class\n ->getClassLoader()\n ->providesPackage($class->getPackage()->getName())\n );\n }",
"public function testImportDirectory() {\n\t\t$package = new APackage();\n\t\t$package->name = \"test123\";\n\t\t$package->description = \"Test package\";\n\t\t$package->importDirectory(Yii::getPathOfAlias(\"packages.ypm.components\"),\"components\");\n\t\t$this->assertTrue($package->save());\n\t\t$this->assertTrue(file_exists($package->getBaseDir().\"/components/APackageManager.php\"));\n\t\t$this->assertTrue($package->delete()); // clean up\n\t\t$this->assertFalse(file_exists($package->getBaseDir().\"/components/APackageManager.php\"));\n\t}",
"public function testGetManifest()\n {\n\n }",
"public function testComDayCqWcmDesignimporterDesignPackageImporter() {\n\n }",
"public function testCreateNamespace()\n {\n }",
"public function testOnCreateTaskRequirePackageTask()\n {\n $factory = new ComposerTaskFactory(new HomePathDeterminator($this->getTempDir()));\n $task = $factory->createInstance(\n 'require-package',\n $config = new JsonArray([\n RequirePackageTask::SETTING_TYPE => 'require-package',\n RequirePackageTask::SETTING_ID => 'require-task-id',\n RequirePackageTask::SETTING_PACKAGE => ['vendor/dependency-name', '1.0.0'],\n 'status' => RequirePackageTask::STATE_PENDING\n ])\n );\n\n $this->assertInstanceOf(RequirePackageTask::class, $task);\n $this->assertEquals($this->getTempDir(), $config->get(RequirePackageTask::SETTING_HOME));\n }",
"public function testCreateNamespacedDeployment()\n {\n }",
"public function testCreateBuildForAllNamespaces()\n {\n\n }",
"protected function createTest()\n {\n $test = Str::studly(class_basename($this->argument('name')));\n\n $this->call('module:test', [\n 'name' => $test,\n '--force' => $this->option('force')\n ]);\n\n $this->call('module:test', [\n 'name' => $test,\n '--unit' => true,\n '--force' => $this->option('force')\n ]);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
LoginFormHandler::displayMandatoryIcon() Display the mandatory icon
|
public function displayMandatoryIcon($field_name='')
{
$mandatoryFields = array('user_name', 'password');
if($field_name == '*' OR (in_array($field_name, $mandatoryFields)))
{
return $this->LANG['common_mandatory_field_icon'];
}
}
|
[
"public function displayMandatoryIcon($field_name='')\n\t\t\t{\n\t\t\t\t$mandatoryFields = array('user_name', 'password', 'confirm_password', 'email', 'first_name', 'last_name', 'sex', 'country', 'dob', 'pin_code', 'postal_code', 'captcha', 'bank_info');\n\t\t\t\tif($field_name == '*' OR (in_array($field_name, $mandatoryFields)))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn $this->LANG['common_mandatory_field_icon'];\n\t\t\t\t\t}\n\t\t\t}",
"public function get_icon() {\n\t\treturn parent::get_widget_icon( 'RegistrationForm' );\n\t}",
"public function form_settings_icon() {\r\n\t\treturn '';\r\n\t}",
"private function createMandatoryLabel()\n {\n return sprintf(\n '<span class=\"mandatory\"><span class=\"invisible\">%s</span>*</span>',\n $GLOBALS['TL_LANG']['MSC']['mandatory']\n );\n }",
"public function getAuthenticationTypeIconHTML()\n {\n return '<i class=\"fa fa-user\"></i>';\n }",
"Public Static function displayUserIcon() {\n $show_user_icon = self::getParams('show_user_icon');\n if ($show_user_icon === self::NEWS_YES) {\n return true;\n }\n\n return false;\n }",
"function theme_fapitng_form_required_marker(array $variables) {\n // This is also used in the installer, pre-database setup.\n $t = get_t();\n $attributes = array(\n 'class' => 'form-required',\n 'title' => $t('!title is required.', array('!title' => filter_xss_admin($variables['element']->title))),\n );\n return '<span' . drupal_attributes($attributes) . '>*</span>';\n}",
"public function get_icon() {\n return 'elementor-super-forms-icon';\n\t}",
"public static function _notice_missing_icon_picker() {\n\t\t?>\n\t\t<div class=\"error\">\n\t\t\t<p><?php esc_html_e( 'Looks like Menu Icons was installed via Composer. Please activate Icon Picker first.', 'menu-icons' ); ?></p>\n\t\t</div>\n\t\t<?php\n\t}",
"public function markMandatoryFields()\n {\n foreach ($this->getWidgetSchema()->getFields() as $field => $widget)\n {\n if (\n $this->getValidator($field)->getOption('required') === true\n && !($widget instanceof ullWidget) // read-only mode\n )\n {\n $this->getWidgetSchema()->setLabel($field,\n $this->getWidgetSchema()->getLabel($field) . ' *'\n ); \n } \n } \n }",
"protected function renderDefaultLegendIcon() {\n return TRUE;\n }",
"public function isIconsEnabled();",
"public function getIcon() {\n\t\treturn USERFORMS_DIR . '/images/' . strtolower($this->class) . '.png';\n\t}",
"public function presentIcon()\n {\n if ($this->status === Project::FINISHED) {\n return 'check';\n } elseif ($this->status === Project::DEPLOYING) {\n return 'spinner fa-pulse';\n } elseif ($this->status === Project::FAILED) {\n return 'warning';\n } elseif ($this->status === Project::PENDING) {\n return 'clock-o';\n }\n\n return 'question-circle';\n }",
"public function get_required_label() {\n return '<span>*</span>';\n }",
"function returnRequiredFieldText() {\r\n return\"<label>(*) <i>denotes required fields.</i></label>\";\r\n}",
"private function DrawRequiredAsterisk($field)\n\t{\n\t\techo (isset($field['required']) && $field['required']) ? ' <span class=\"required\">*</span>' : '';\n\t}",
"public static function pdmx_login_image_form() { ?>\n\t\t<style type=\"text/css\">\n\t\t\t.login h1 a{ background-image: none,url(<?php echo get_option( 'pdmx_login_image' ); ?>); background-repeat: no-repeat; background-size: contain; width: 100%}\n\t\t</style>\n\t<?php }",
"function is_valid_icon( $name ) {\n\t\treturn true;\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Return Order Place Redirect URL
|
abstract public function getOrderPlaceRedirectUrl();
|
[
"public function getOrderPlaceRedirectUrl(){\n \treturn Mage::getUrl('internetkassa/result/redirect');\n\t}",
"public function getOrderPlaceRedirectUrl() {\n\treturn Mage::getUrl('clictopay/redirect', array('_secure' => true));\n}",
"public function getOrderPlaceRedirectUrl()\n {\n return Mage::getUrl('atos/several/redirect', array('_secure' => true));\n }",
"public function getOrderPlaceRedirectUrl()\r\n {\r\n \t//Mage::helper('payline/logger')->log('-- getOrderPlaceRedirectUrl --');\r\n return Mage::getUrl('payline/index/cpt');\r\n }",
"public function getOrderPlaceRedirectUrl() {\n\n $quote = Mage::getSingleton('checkout/session')->getQuote();\n $quoteData = $quote->getData();\n $billingAddress = $quote->getBillingAddress();\n $billingAddressData = $billingAddress->getData();\n $customer = $quote->getCustomer();\n\n //Set Repeat Purchase Request\n $wsca = $this->setRepeatPurchaseRequest($quoteData, $billingAddress, $billingAddressData);\n //It returns a session ID that is needed for the redirect url so the form is correct\n return Mage::getUrl('santander/payment/redirect', array('_secure' => true, 'sid' => $wsca->setRepeatPurchaseReturn, 'recurring' => true));\n }",
"public function getOrderPlaceRedirectUrl()\n {\n return Mage::getUrl('zaakpay/transact/redirect', array('_secure' => true));\n }",
"protected function getPlaceOrderPageUrl()\n {\n $vid = Context::get('vid');\n return getNotEncodedFullUrl('', 'vid', $vid\n , 'act', 'dispShopPlaceOrder'\n , 'payment_method_name', $this->getName()\n , 'error_return_url', ''\n );\n }",
"public function process_rurl($msTxnId){\n $order_id = substr($msTxnId, 6);\n $order = new WC_Order($order_id);\n\n $order->add_order_note(\"Client was successfully redirected\");\n $redirectTarget = home_url();\n\n if($order!= false)\n {\n $redirectTarget = $this->get_return_url($order);\n }\n\n wp_safe_redirect($redirectTarget);\n die();\n\t}",
"function the_order_return_url( $order_id = null ) {\n\techo get_the_order_return_url( $order_id );\n}",
"public function getReturnUrl()\n {\n return Mage::getUrl('payulite/processing/return', array('_secure' => true, 'order' => '{{ORDER_ID}}'));\n }",
"public function redirectToOrder()\n {\n if ($this->AlternativeEndPoint) {\n return Controller::curr()->redirect(Director::absoluteBaseURL() . $this->AlternativeEndPoint);\n }\n $order = $this->Order();\n if ($order) {\n return Controller::curr()->redirect($order->Link());\n }\n user_error('No order found with this payment: ' . $this->ID, E_USER_NOTICE);\n }",
"private function redirectToCheckout()\n {\n $orderProcess = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order';\n Tools::redirect($this->context->link->getPageLink($orderProcess, true));\n }",
"public function getRedirectUrl()\n {\n return route('paypal.standard.redirect');\n \n }",
"public function getAcsRedirectUrl()\n {\n return Mage::getUrl('paymentsense/direct/redirect', array('_secure' => true));\n }",
"public function get3dSecureRedirectUrl()\n {\n return Mage::getUrl(self::OPS_CONTROLLER_ROUTE_PAYMENT . 'placeform3dsecure',\n array('_secure' => true, '_nosid' => true));\n }",
"public function getCheckoutRedirectUrl()\n {\n return $this->urlBuilder->getUrl('areto/qp/payment', ['_secure' => $this->request->isSecure()]);\n }",
"public function checkoutRedirect(){\n\t\theader('\"Location: ' . $this->response->redirect($this->url->link('module/hygglig/renderHyggligPage')) . '\"');\n\t}",
"public function getSubmitCheckoutDetailsAndGetRedirectUrl()\n {\n return $this->getBaseApiUrl() . '/v1/checkouts';\n }",
"protected function getRedirectUrl()\n\t{\n if ($customURL = $this->input->getBase64('returnurl', ''))\n {\n $customURL = base64_decode($customURL);\n }\n\n $url = !empty($customURL) ? $customURL : 'index.php?option='\n . $this->container->componentName\n . '&view='\n . $this->container->inflector->pluralize($this->view)\n . $this->getItemidURLSuffix(); // e.g. '&Itemid=123' or an empty string if no Itemid\n\n return $url;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Sets bean helper to be given to beans. Bean helpers assist beans in getting a reference to a toolbox.
|
public function setBeanHelper( RedBean_BeanHelper $beanhelper) {
$this->beanhelper = $beanhelper;
}
|
[
"protected function autoSetHelpers() {\n $this->setToolboxHelper($this->toolboxHelperGetInstance());\n $this->setPropsHelper($this->propsHelperGetInstance());\n }",
"public function setBeanHelper(BeanHelper $helper) {\n }",
"public static function configureFacadeWithToolbox( ToolBox $tb )\n\t{\n\t\t$oldTools = self::$toolbox;\n\t\tself::$toolbox = $tb;\n\t\tself::$writer = self::$toolbox->getWriter();\n\t\tself::$adapter = self::$toolbox->getDatabaseAdapter();\n\t\tself::$redbean = self::$toolbox->getRedBean();\n\t\tself::$finder = new Finder( self::$toolbox );\n\t\tself::$associationManager = new AssociationManager( self::$toolbox );\n\t\tself::$tree = new Tree( self::$toolbox );\n\t\tself::$redbean->setAssociationManager( self::$associationManager );\n\t\tself::$labelMaker = new LabelMaker( self::$toolbox );\n\t\t$helper = new SimpleModelHelper();\n\t\t$helper->attachEventListeners( self::$redbean );\n\t\tif (self::$redbean->getBeanHelper() == NULL) {\n\t\t\tself::$redbean->setBeanHelper( new SimpleFacadeBeanHelper );\n\t\t}\n\t\tself::$duplicationManager = new DuplicationManager( self::$toolbox );\n\t\tself::$tagManager = new TagManager( self::$toolbox );\n\t\treturn $oldTools;\n\t}",
"private function setHelpers(){\n\t\t$helpers = $this->controller->getHelpers();\n\t\tforeach($helpers as $helper){\n\t\t\t$class = '\\helpers\\\\' . $helper . 'Helper';\n\t\t\tif(class_exists($class)){\n\t\t\t\t$class = new $class();\n\t\t\t\t$this->controller->{$helper} = $class;\n\t\t\t}\n\t\t}\n\t}",
"public function setHelper()\n {\n if ($this->helper) return;\n\n $helperClass = Helpers\\Loader::fetchWidgetHelper($this->getPath());\n $this->helper = new $helperClass;\n }",
"public function setHelper($helper)\n {\n $this->_helper = $helper;\n }",
"private function setHelpers() {\n\t\tforeach ($this->_helpers as $helper => $helperSettings) {\n\t\t\tif (is_numeric($helper)) {\n\t\t\t\t$helper = $helperSettings;\n\t\t\t\t$helperSettings = array();\n\t\t\t}\n\t\t\tif (!isset($this->controller->helpers[$helper])) {\n\t\t\t\t$this->controller->helpers[$helper] = $helperSettings;\n\t\t\t}\n\t\t}\n\t}",
"protected function registerHelpers() {\r\n $this->service\r\n ->sharedData()\r\n ->set('appHelper', array(\r\n 'absotuleUri' => $this->request->server()->exists('HTTPS') ? \"https://{$this->request->server()->get('SERVER_NAME')}/{$this->request->uri()}\" : \"http://{$this->request->server()->get('SERVER_NAME')}/{$this->request->uri()}\",\r\n ));\r\n }",
"private function configureHelpers() {\r\n \r\n \t$this->helper = new Ibe_Object();\r\n \t$helpers = $this->configure->getHelpers();\r\n \r\n \t/**\r\n \t * Helpers simples $helpers = array(\"x\",\"xx\",\"xxxx\")\r\n \t * sao inclusos em todos os controladores\r\n \t * Helpers limitados Helpers = array(\"x\"=>\"controlador1|controlador2\")\r\n \t * sao inclusos apenas nos controladores indicados\r\n \t*/\r\n \tforeach ($helpers as $helper => $all) {\r\n \t\t$helper_name = $all;\r\n \t\tif (is_string($helper)) {\r\n \t\t\t$helper_name = FALSE;\r\n \t\t\t$controllers = explode(\"|\", $all);\r\n \r\n \t\t\tif (array_search($this->controller, $controllers) !== FALSE) {\r\n \t\t\t\t$helper_name = $helper;\r\n \t\t\t}\r\n \t\t}\r\n \t\tif ($helper_name != FALSE) {\r\n \t\t\t$hp = Ibe_Helper::get($helper_name);\r\n \t\t\tif (!$this->configure->isActionReturnJson()) {\r\n \t\t\t\t$this->view_application->helper->__set($helper, $hp);\r\n \t\t\t\t$this->view_module->helper->__set($helper, $hp);\r\n \t\t\t\t$this->view_controller->helper->__set($helper, $hp);\r\n \t\t\t}\r\n \t\t\t$this->helper->__set($helper, $hp);\r\n \t\t}\r\n \t}\r\n }",
"public function setHelperPluginManager($helpers) {}",
"public function assignUtilities()\n {\n if (!$this->helper) {\n $this->helper = $this->_getHelper();\n }\n if (!$this->dataHelper) {\n $this->dataHelper = $this->_getDataHelper();\n }\n }",
"public function setHelper($helper = 'db_lojack')\n {\n $this->helper = $this->app->make($helper);\n }",
"private function registerHelpers()\n {\n $this->app->bind(\n 'htmlelements::helpers',\n function ($app) {\n return new Helpers($app['htmlelements::config']);\n }\n );\n }",
"public function getHelpers()\n {\n //\n if( !isset($this->utility_belt_helpers) ){\n\n $utility_belt_helpers = new UtilityBeltHelpers();\n $utility_belt_helpers->setServiceProvider($this->getServiceProvider());\n\n $this->utility_belt_helpers = $utility_belt_helpers;\n }\n\n return $this->utility_belt_helpers;\n\n }",
"public function initializeBeans() {\n\n $beansArray = array();\n foreach ($this->contextArray as $valueArray) {\n if ($valueArray[\"type\"] == \"manager\") {\n\n /**\n * prepare the setter method name\n * example: setModelManager\n */\n $setterMethodName = \"set\" . ucfirst($valueArray[\"name\"]);\n\n /**\n * create bean with name $valueArray[\"name\"] and set via $setterMethodName\n * example: $this->setModelManager($this->getBean(\"modelManager\"))\n */\n $this->$setterMethodName($this->getBean($valueArray[\"name\"]));\n\n /**\n * prepare the getter method name\n * example: getModelManager\n */\n $getterMethodName = \"get\" . ucfirst($valueArray[\"name\"]);\n\n /**\n * set container object ($this) to Manager\n * example: $this->getModelManager()->setContainer($this);\n */\n $this->$getterMethodName()->setContainer($this);\n\n } else if ($valueArray[\"type\"] == \"tool\") {\n\n /**\n * prepare the setter method name\n * example: setTool\n */\n $setterMethodName = \"set\" . ucfirst($valueArray[\"name\"]);\n\n /**\n * create bean with name $valueArray[\"name\"] and set via $setterMethodName\n * example: $this->setTool($this->getBean(\"tool\"))\n */\n $this->$setterMethodName($this->getBean($valueArray[\"name\"]));\n\n /**\n * prepare the getter method name\n * example: getTool\n */\n $getterMethodName = \"get\" . ucfirst($valueArray[\"name\"]);\n\n\n if (method_exists($this->$getterMethodName(), \"setContainer\")) {\n /**\n * set container object ($this) to Manager\n */\n $this->$getterMethodName()->setContainer($this);\n }\n\n } else {\n array_push($beansArray, $valueArray);\n }\n }\n\n\n /**\n * private loadLanguages() method loads active language file\n * and sets $this->languageArray from $languageArray variable\n * $this->languageArray is necessary for i18n of services\n */\n $this->loadLanguages();\n\n\n /**\n * initialize all other beans rather than \"manager\" and \"tool\" types\n */\n foreach ($beansArray as $valueArray) {\n\n //Setter method name\n $setterMethodName = \"set\" . ucfirst($valueArray[\"name\"]);\n\n //Getter method name\n $getterMethodName = \"get\" . ucfirst($valueArray[\"name\"]);\n\n /**\n * if the type of the bean is \"service\" and ServiceManager has a method to set this bean\n * than creates an object for that bean via $this->getBean($beanName) and sets\n * if there is no such method, there is an exception (METHOD_NOT_FOUND)\n */\n if ($valueArray[\"type\"] == \"service\") {\n try {\n if (method_exists($this->getServiceManager(), $setterMethodName)) {\n $this->getServiceManager()->$setterMethodName($this->getBean($valueArray[\"name\"]));\n $this->getServiceManager()->$getterMethodName()->setContainer($this);\n if (!is_null($this->languageArray[$valueArray[\"name\"]])) {\n $this->getServiceManager()->$getterMethodName()->setLanguageArray($this->languageArray[$valueArray[\"name\"]]);\n }\n } else {\n $this->getLogger()->log(SystemErrorMessage::METHOD_NOT_FOUND, array(\"methodName\" => $setterMethodName));\n throw new Exception(\"there is no method called: \" . $setterMethodName . \"(\" . $valueArray[\"impl\"] . \" \" . $valueArray[\"name\"] . \") in ServiceManager\");\n }\n } catch (Exception $e) {\n echo \"<pre>\";\n print_r($e->getMessage());\n echo \"</pre>\";\n echo \"<pre>\";\n print_r($e->getTraceAsString());\n echo \"</pre>\";\n }\n\n } /**\n * if the type of the bean is \"model\" and ModelManager has a method to set this bean\n * than creates an object for that bean via $this->getBean($beanName) and sets\n * if there is no such method, there is an exception (METHOD_NOT_FOUND)\n */\n else if ($valueArray[\"type\"] == \"model\") {\n try {\n if (method_exists($this->getModelManager(), $setterMethodName)) {\n $this->getModelManager()->$setterMethodName($this->getBean($valueArray[\"name\"]));\n if (method_exists($this->getModelManager()->$getterMethodName(), \"setXmlGenerator\")) {\n $this->getModelManager()->$getterMethodName()->setXmlGenerator($this->getXmlGenerator());\n }\n if (method_exists($this->getModelManager()->$getterMethodName(), \"setJsonGenerator\")) {\n $this->getModelManager()->$getterMethodName()->setJsonGenerator($this->getJsonGenerator());\n }\n } else {\n $this->getLogger()->log(SystemErrorMessage::METHOD_NOT_FOUND, array(\"methodName\" => $setterMethodName));\n throw new Exception(\"there is no method called: \" . $setterMethodName . \"(\" . $valueArray[\"impl\"] . \" \" . $valueArray[\"name\"] . \") in ModelManager\");\n }\n } catch (Exception $e) {\n echo \"<pre>\";\n print_r($e->getMessage());\n echo \"</pre>\";\n echo \"<pre>\";\n print_r($e->getTraceAsString());\n echo \"</pre>\";\n }\n\n } /**\n * if the type of the bean is \"action\" and ActionManager has a method to set this bean\n * than creates an object for that bean via $this->getBean($beanName) and sets\n * if there is no such method, there is an exception (METHOD_NOT_FOUND)\n */\n else if ($valueArray[\"type\"] == \"action\") {\n try {\n if (method_exists($this->getActionManager(), $setterMethodName)) {\n $this->getActionManager()->$setterMethodName($this->getBean($valueArray[\"name\"]));\n $this->getActionManager()->$getterMethodName()->setContainer($this);\n } else {\n $this->getLogger()->log(SystemErrorMessage::METHOD_NOT_FOUND, array(\"methodName\" => $setterMethodName));\n throw new Exception(\"there is no method called: \" . $setterMethodName . \"(\" . $valueArray[\"impl\"] . \" \" . $valueArray[\"name\"] . \") in ActionManager\");\n }\n } catch (Exception $e) {\n echo \"<pre>\";\n print_r($e->getMessage());\n echo \"</pre>\";\n echo \"<pre>\";\n print_r($e->getTraceAsString());\n echo \"</pre>\";\n }\n\n\n } /**\n * if the type of the bean is \"database\", Container creates an object for that bean\n * via $this->getBean($beanName) and sets $this to container reference via $this->$setterMethodName->setContainer\n * if there is no such method, there is an exception (METHOD_NOT_FOUND)\n */\n else if ($valueArray[\"type\"] == \"database\") {\n try {\n if (method_exists($this, $setterMethodName)) {\n $this->$setterMethodName($this->getBean($valueArray[\"name\"], $this));\n } else {\n $this->getLogger()->log(SystemErrorMessage::METHOD_NOT_FOUND, array(\"methodName\" => $setterMethodName));\n throw new Exception(\"there is no method called: \" . $setterMethodName . \"(\" . $valueArray[\"impl\"] . \" \" . $valueArray[\"name\"] . \") in Container\");\n }\n } catch (Exception $e) {\n echo \"<pre>\";\n print_r($e->getMessage());\n echo \"</pre>\";\n echo \"<pre>\";\n print_r($e->getTraceAsString());\n echo \"</pre>\";\n }\n\n\n } /**\n * if the type of the bean is in $this->beanTypes array and Container has a method to set this bean\n * than creates an object for that bean via $this->getBean($beanName) and sets\n * if there is no such method, there is an exception (METHOD_NOT_FOUND)\n */\n else if (in_array($valueArray[\"type\"], $this->getBeanTypes())) {\n try {\n if (method_exists($this, $setterMethodName)) {\n $this->$setterMethodName($this->getBean($valueArray[\"name\"]));\n } else {\n $this->getLogger()->log(SystemErrorMessage::METHOD_NOT_FOUND, array(\"methodName\" => $setterMethodName));\n throw new Exception(\"there is no method called: \" . $setterMethodName . \"(\" . $valueArray[\"impl\"] . \" \" . $valueArray[\"name\"] . \") in Container\");\n }\n } catch (Exception $e) {\n echo \"<pre>\";\n print_r($e->getMessage());\n echo \"</pre>\";\n echo \"<pre>\";\n print_r($e->getTraceAsString());\n echo \"</pre>\";\n }\n\n } /**\n * These are the beans that does not fit to any specification\n * They may be reached by $container->getBean($beanName)\n */\n else {\n // do nothing for these beans\n }\n }\n\n }",
"public function setTools( $tools );",
"protected function _setupHelpers() {\n\t\tif (App::import('Helper', 'Goodies.Gravatar')) {\n\t\t\t$this->helpers[] = 'Goodies.Gravatar';\n\t\t}\n\t}",
"public function __construct()\n {\n $this->helper = new Helpers;\n }",
"protected function _initActionHelpers(){\n // Add the possibility to log to Firebug. Example: $this->_helper->log('Message');\n Zend_Controller_Action_HelperBroker::addHelper(new App_Controller_Action_Helper_Logger());\n \n // Add the Flag and Flippers helper for the controllers. Example: $this->_helper->flagFlippers()\n Zend_Controller_Action_HelperBroker::addHelper(new App_Controller_Action_Helper_FlagFlippers());\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Sets value of 'timeoutList' property
|
public function setTimeoutList($value)
{
return $this->set(self::TIMEOUTLIST, $value);
}
|
[
"public function set_timeout( $timeout ) {\n\t\t$this->timeout = $timeout ;\n\t}",
"function setTimeOut($value)\n\t{\n\t\t$this->intTimeOut=$value;\n\t}",
"public function set_timeout( $timeout ) {\r\n\t\t$this->timeout = $timeout;\r\n\t}",
"public function setTimeOut($timeout){\n\t\t$this->_timeout = $timeout;\n\t\t$this->setMessage(\"Setting time out: \".$this->_timeout);\n\t}",
"public function setTimerTimeout($timeout) {}",
"public function setTimeouts($connectionTimeout, $timeout)\n {\n $this->connectionTimeout = (int)$connectionTimeout;\n $this->timeout = (int)$timeout;\n }",
"protected function setTokenTimeout($token_timeout) {\n $this->tokenTimeout = $token_timeout;\n }",
"public function setTimeouts(array $timeouts)\n {\n foreach ($timeouts as $type => $timeout) {\n $this->setTimeout($type, $timeout);\n }\n }",
"protected function setOperationTimeout($timeout)\n {\n $this->operationTimeout = $timeout;\n }",
"protected function _setTimeOut($timeout)\n {\n $link_identifier = $this->_ldapClient->getResource();\n @ldap_set_option($link_identifier, LDAP_OPT_NETWORK_TIMEOUT, $timeout);\n }",
"public function setTimeoutLimit($limit = 30){\n $this->timeout_limit = $limit;\n }",
"function setTimeout($timeout = 0) {\r\n\t\tif ( !is_int($timeout) || ($timeout < 0) ) {\r\n\t\t\tthrow new ftpException('Timeout '.$timeout.' is invalid, has to be an integer >= 0');\r\n\t\t}\r\n\t\t$this->getOptionsSet()->setOptions(array(self::OPTION_TIMEOUT => $timeout));\r\n\t\tif ( isset($this->_handle) && is_resource($this->_handle) ) {\r\n\t\t\t$res = @ftp_set_option($this->_handle, FTP_TIMEOUT_SEC, $timeout);\r\n\t\t} else {\r\n\t\t\t$res = true;\r\n\t\t}\r\n\t\tif ( !$res ) {\r\n\t\t\tthrow new ftpException(\"Set timeout failed.\");\r\n\t\t}\r\n\t\treturn $this;\r\n\t}",
"public function setDefaultTimeLimit(int $timeout): void\n {\n $this->defaultTimeLimit = $timeout;\n }",
"public function setTimePerQuestion($timeout);",
"public function setTimeouts ($connectionTimeout, $timeout) {\n $this->connection->setTimeouts($connectionTimeout, $timeout);\n }",
"public function set_task_list($task_list)\n {\n }",
"public function setTimeoutDuration($val)\n {\n $this->_propDict[\"timeoutDuration\"] = $val;\n return $this;\n }",
"public function setPodTimeout($value)\n {\n return $this->set('PodTimeout', $value);\n }",
"function set_time_out() {\n $this->sale_lib_sms->set_time_out($this->input->post(\"times\"));\n\n $this->_reload();\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Merge an array of where clauses and bindings.
|
public function mergeWheres($wheres, $bindings)
{
$this->wheres = array_merge($this->wheres, (array) $wheres);
$this->bindings['where'] = array_values(
array_merge($this->bindings['where'], (array) $bindings)
);
}
|
[
"public function mergeWheres($wheres, $bindings)\n {\n $this->wheres = array_merge($this->wheres, (array)$wheres);\n\n $this->bindings['where'] = array_values(\n array_merge($this->bindings['where'], (array)$bindings)\n );\n }",
"public function where(...$bindings)\n { \n $sql = array_shift($bindings);\n\n if(count($bindings) == 1 AND is_array($bindings[0]))\n {\n $bindings = $bindings[0];\n $this->addtobinding($bindings);\n }\n else\n {\n $this->addtobinding($bindings);\n }\n \n // where['id = ? , name = ? '] convert to string by implode(\" \",$this->wheres);\n // sql here will be [0 => id = ? , name = ?]\n // when implode will be = \"id = ? , name = ?\"\n // then add \" where before it\n \n $this->wheres[] = $sql;\n return $this;\n }",
"public static function mergeWheres($wheres, $bindings) {\n \n }",
"private function buildWhereForUpdate()\n {\n $whereArray = array_combine($this->where, $this->bindings);\n list($whereNew, $condition) = $this->formatWhereToNamePlaceHolder($whereArray);\n\n return [$whereNew, $this->buildWherePlaceholderName($whereNew)];\n }",
"protected function applyConditions(array $where)\n {\n foreach ($where as $field => $value) {\n if (\\is_array($value)) {\n list($field, $condition, $val) = $value;\n if ($condition == 'in') {\n $this->model = $this->model->whereIn($field, $val);\n } elseif ($condition == 'not') {\n $this->model = $this->model->whereNotIn($field, $val);\n } else {\n $this->model = $this->model->where($field, $condition, $val);\n }\n } else {\n $this->model = $this->model->where($field, '=', $value);\n }\n }\n }",
"public function appendWhere($where_sql, $bind_fields = FALSE);",
"public function where()\n {\n $args = func_get_args();\n if (is_array($args[0]) === true) {\n $this->where = $args[0][0];\n if (isset($args[0][1])) {\n $this->whereBinds = $args[0][1];\n }\n } else {\n call_user_func_array(array($this->wBuild, \"add\"), $args);\n }\n return $this;\n }",
"private function bind_where_parameters() {\n if ($this->used_custom_where) {\n $this->bind_custom_where_rules();\n } else {\n $this->bind_parameters($this->where_parameters);\n }\n }",
"public static function prepareBindingsForUpdate(array $bindings, array $values)\n {\n // $values = collect($values)->reject(function ($value, $column) {\n // return $this->isJsonSelector($column) &&\n // in_array(gettype($value), ['boolean', 'integer', 'double']);\n // })->all();\n\n $cleanBindings = Arr::except($bindings, ['join', 'select']);\n return array_values(\n array_merge($bindings['join'], $values, Arr::flatten($cleanBindings))\n );\n }",
"public function where(string $statement, Date|string|int|bool|float|null ...$bindings): static\n {\n $newBinding = [];\n /** @var Date|string|int|bool|float|null $binding */\n foreach ($bindings as $binding) {\n $newBinding[] = $this->filterBinding($binding);\n }\n \n $this->where[] = ['statement' => $statement, 'bindings' => $newBinding];\n\n return $this;\n }",
"private function appendWhere()\n\t{\n\t\t$whereCount = count($this->where);\n\n\t\tfor($i = 0; $i < $whereCount; $i++)\n\t\t{\n\t\t\t$where = $this->where[$i];\n\n\t\t\tif($i == 0)\n\t\t\t{\n\t\t\t\t$this->queryString .= self::WHERE;\n\t\t\t}\n\n\t\t\t$this->queryString .= $where->getCondition();\n\n\t\t\tif($i < $whereCount-1)\n\t\t\t{\n\t\t\t\t$this->queryString .= \" \" . $where->getOperator() . \" \";\n\t\t\t}\n\t\t}\n\t}",
"private function addWhere(&$queryArr) {\n if (!empty($this->clauses['where'])) {\n $queryArr[] = 'WHERE ' . implode(' ', $this->clauses['where']);\n }\n }",
"public static function combineWhere(array &$queryParts, string $where, $mode = 'and')\n {\n if (null === $queryParts['where']) {\n $queryParts['where'] = $where;\n } else {\n switch ($mode) {\n case \"and\":\n case \"or\":\n $queryParts['where'] = \"(\" . $queryParts['where'] . \") \" . $mode . \" \" . $where;\n break;\n default:\n self::error(\"Unknown mode \\\"$mode\\\".\");\n break;\n }\n }\n }",
"public function get_where_args() {\n\n $args = array();\n foreach ($this->where as $group => $where) {\n $args = array_merge($args, $where['args']);\n }\n\n return $args;\n }",
"public function _where($where = array())\n {\n $_where = array();\n if ('string'==gettype($where)) {\n $_where[] = $where;\n } elseif (!is_scalar($where)) {\n foreach ($where as $key=>$value) {\n // @TODO englobe array $value`s\n // if ('array' === gettype($value)) {\n // $_where[] = '(' . $this->_where($value) . ')';\n // }\n $key = trim($key);\n if (strpos(trim($key), ' ')===false AND !is_null($value)) {\n $key .= ' = ';\n }\n if ($_where AND !preg_match('@^(and|or)\\b@i', $key)) {\n $key = \"AND $key\";\n }\n if($value !== null) {\n\t\t\t\t\tself::$_pdo->quote($value); \n\t\t\t\t\t$_where[] = \"$key '$value'\";\n\t\t\t\t} else {\n\t\t\t\t\t$value = 'is NULL';\n\t\t\t\t\t$_where[] = \"$key $value\";\n\t\t\t\t} \n \n }\n }\n return $_where ? ' WHERE '.implode(' ', $_where) : '';\n }",
"protected function addAdditionalWhereConditions()\n {\n $originalWhereConditions = $this->concreteQueryBuilder->getQueryPart('where');\n $expression = $this->restrictionContainer->buildExpression($this->getQueriedTables(), $this->expr());\n // This check would be obsolete, as the composite expression would not add empty expressions anyway\n // But we keep it here to only clone the previous state, in case we really will change it.\n // Once we remove this state preserving functionality, we can remove the count check here\n // and just add the expression to the query builder.\n if ($expression->count() > 0) {\n if ($originalWhereConditions instanceof CompositeExpression) {\n // Save the original query conditions so we can restore\n // them after the query has been built.\n $originalWhereConditions = clone $originalWhereConditions;\n }\n $this->concreteQueryBuilder->andWhere($expression);\n }\n\n return $originalWhereConditions;\n }",
"public function Where(array ...$Conditions): IUpdate;",
"public static function simpleWhereToPdoWhere(array $where)\n {\n $ret = [];\n foreach ($where as $k => $v) {\n $ret[] = [$k, '=', $v];\n }\n return $ret;\n }",
"public function reset_where() {\n\t\tlist($this->wheres, $this->bindings) = array(array(), array());\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Set the maximum number of redirects allowed to fulfill a request. Defaults to 10.
|
public function setMaxRedirects($maxRedirects) {
$this->maxRedirects = (int) $maxRedirects;
}
|
[
"public function maxRedirects($n) {\n\t\t$this->max_redirects = $n;\n\t}",
"public function setNumberOfRedirects($int);",
"function setMaxredirect($value)\r\n {\r\n if (!empty($value))\r\n {\r\n $this->maxRedirect = $value;\r\n }\r\n }",
"public function setMaxRedirects($redirects) {\n $this->setOption(CURLOPT_MAXREDIRS, $redirects);\n }",
"public function optSetMaxRedirects(int $maxRedirects): void\n {\n $this->maxRedirects = $maxRedirects;\n }",
"public function setMaxRedirects(int $maxRedirects)\n {\n $this->maxRedirects = $maxRedirects < 0 ? -1 : $maxRedirects;\n $this->followRedirects = -1 !== $this->maxRedirects;\n }",
"public function testSetMaxRedirects()\n {\n $this->todo('stub');\n }",
"public function setMaxRedirects(int $maxRedirects): void\n {\n $this->client->setMaxRedirects($maxRedirects);\n }",
"public function getRedirectLimit()\n {\n }",
"public function getMaxRedirects()\n {\n return $this->maxRedirects;\n }",
"public function setRedirectLimit($limit)\n {\n }",
"public function getRedirectLimit()\n {\n return $this->redirectLimit;\n }",
"public function setMaxQueryCount( int $value )\n : UrlValidator\n {\n\n $this->__setIntegerOption( 'MaxQueryCount', $value, 15 );\n\n $this->LastResult = null;\n\n return $this;\n\n }",
"protected function checkRedirectLimit( &$redirects )\n {\n $redirects++;\n if ( $redirects >= 25 )\n {\n throw new ezcMvcInfiniteLoopException( $redirects );\n }\n }",
"public function increaseRedirectCount()\n {\n $this->redirectCount++;\n }",
"public function setURLRedirections($amount);",
"public function getConsumerPostMaxRedirects()\n {\n $redirects = (int)$this->_scopeConfig->getValue(self::XML_PATH_CONSUMER_POST_MAXREDIRECTS);\n return $redirects > 0 ? $redirects : 0;\n }",
"public function setMaximumAuthenticationFailures(?int $value): void {\n $this->getBackingStore()->set('maximumAuthenticationFailures', $value);\n }",
"public function setMaxTries($max)\n {\n $this->maxTries = abs($max);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the Smarty parameters
|
protected function _getSmartyParams($param)
{
if ($this->_smarty instanceof Smarty) {
if(!empty($this->_smarty->$param)){
return $this->_smarty->$param;
}
} elseif ( isset($this->_smartyParams[$param]) ){
if(!empty($this->_smarty->$param)){
return $this->_smartyParams[$param];
}
}
}
|
[
"private function extractParams()\n\t{\n\t\t$parameters_array = Spine_GlobalRegistry::getRegistryValue('response', 'spine::template_parameters');\n\n\t\tif ($parameters_array != false) //passed template parameters\n\t\t{\n\t\t\textract($parameters_array);\n\t\t}\n\t}",
"public static function getParameters () {\r\n\t\treturn (Front\\Controller::getInstance()->getParameters());\r\n\t}",
"public function getGlobalParameters()\n {\n return $this->templateParameters;\n }",
"protected function params() {\n \n $output = array();\n \n // Get the dynamic\n foreach( $this->dynamic_vars as $id => $data ) {\n foreach( $data as $var => $value ) {\n $output[$var] = $value;\n }\n }\n \n // Add the format\n $output['format'] = $this->revert_format($this->path->format);\n \n // $_POST\n foreach( $_POST as $var => $value ) {\n $output[$var] = $value;\n }\n \n // $_GET\n foreach( $_GET as $var => $value ) {\n if( $var != 'borealis_url' )\n $output[$var] = $value;\n }\n \n return $output;\n \n }",
"protected function get_params() {\n\t\t$parameters = array();\n\t\tforeach (array_merge($this->bound_params, $this->params) as $p)\n\t\t\t$parameters[$p->symbol] = $p->value();\n\t\treturn $parameters;\n\t}",
"public function get_params(){\n\t\treturn apply_filters('revslider_slide_get_params', apply_filters('revslider_slide_getParams', $this->params, $this), $this);\n\t}",
"public function getParms() {\n return $_SESSION['forena_data_block_parms'][$this->block_name];\n }",
"public function getCMSgetParameters()\n {\n return (isset(Basic::$GET)) ? Basic::$GET : array();\n }",
"public function getTemplateArguments();",
"public function getContextParameters()\n\t{\n\t\treturn $this->getLtiParameters($this->contextParameterKeys);\n\t}",
"public static function list_templates_parameters() {\n $component = new external_value(\n PARAM_COMPONENT,\n 'The component to search',\n VALUE_DEFAULT,\n ''\n );\n $search = new external_value(\n PARAM_RAW,\n 'The search string',\n VALUE_DEFAULT,\n ''\n );\n $themename = new external_value(\n PARAM_COMPONENT,\n 'The current theme',\n VALUE_DEFAULT,\n ''\n );\n $params = array('component' => $component, 'search' => $search, 'themename' => $themename);\n return new external_function_parameters($params);\n }",
"function smarty_function_get_template_vars($params, &$smarty)\n{\n\t$templ_vars = $smarty->get_template_vars();\n\tksort($templ_vars);\n\tforeach ($templ_vars as $key => $value)\n\t{\n\t\tif (empty($params['show']))\n\t\t{\n\t \tif (is_array($value)) echo \"<tt><strong>\" . $key . \"</strong></tt> = Array (\" . count($value) . \")<br />\";\n\t\t\telseif (is_object($value)) echo \"<tt><strong>\" . $key . \"</strong></tt> = Object<br />\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (is_array($value) OR is_object($value))\n\t\t\t{\n\t\t\t\t$result = print_r($value, true);\n\t\t\t\t$result = str_replace(\"\\x20\", \" \", $result);\n\t\t\t\t$result = str_replace(\"<\",\"<\",$result);\n\t\t\t\t$result = str_replace(\">\",\">\",$result);\n\t\t\t\techo \"<tt><strong>\" . $key . \"</strong> = \" . str_replace(\"\\x0a\", \"<br />\", $result) . \"</tt>\";\n\t\t\t}\n\t\t}\n\t\tif (!is_array($value) AND !is_object($value)) echo \"<tt><strong>\" . $key . \"</strong></tt> = \" . trim($value) . \"<br />\";\n\t}\n}",
"public function getParameters()\n {\n return $this->parsedParams;\n }",
"public function routerParams()\n {\n /* @var Router $router */\n $router = $this->container->get('router');\n $request = $this->container->get('request_stack')->getCurrentRequest();\n\n $routeName = $request->attributes->get('_route');\n $routeParams = $request->query->all();\n $routeCollection = $router->getRouteCollection();\n /* @var CompiledRoute $compiledRouteConnection */\n $compiledRouteConnection = $routeCollection->get($routeName)->compile();\n foreach ($compiledRouteConnection->getVariables() as $variable) {\n $routeParams[$variable] = $request->attributes->get($variable);\n }\n\n return $routeParams;\n }",
"function getParameters() {\n $ar = split(\";\", $GLOBALS[\"pagedata\"][\"module\"]);\n for ($c = 0; $c < sizeof($ar); $c++) {\n $a = split(\"=\", $ar[$c]);\n $this->module_param[$a[0]] = $a[1];\n }\n }",
"public function getParameters();",
"public static function load_template_parameters() {\n return new external_function_parameters(\n array('component' => new external_value(PARAM_COMPONENT, 'component containing the template'),\n 'template' => new external_value(PARAM_ALPHANUMEXT, 'name of the template'),\n 'themename' => new external_value(PARAM_ALPHANUMEXT, 'The current theme.'),\n )\n );\n }",
"public function params()\n\t{\n\t\treturn $this->request->named_params;\n\t}",
"private function getTemplateParameters()\n {\n list($s, $p, $o) = array(\n \\Request::query('subject', '?s'),\n \\Request::query('predicate', '?p'),\n \\Request::query('object', '?o')\n );\n\n if (substr($s, 0, 4) == \"http\") {\n $s = '<' . $s . '>';\n }\n\n // TODO expand prefixes\n if (substr($p, 0, 4) == \"http\") {\n $p = '<' . $p . '>';\n }\n\n if (substr($o, 0, 4) == \"http\") {\n $o = '<' . $o . '>';\n } else if ($o != '?o' && substr($o, 0, 5) != '<http') {\n // If the object isn't URI, enquote it, unless it's meant as a sparql variable or an enclosed URI\n $o = '\"' . $o . '\"';\n }\n\n return array($s, $p, $o);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Test that the json decoded object is an object
|
public function testJsonDecode()
{
$encoded = json_encode($this->data);
$expected = json_decode($encoded);
$actual = Parser::decode($encoded);
$this->assertTrue($actual instanceof \StdClass);
$this->assertEquals($expected, $actual);
// Test that the json decoded object is an array
$expected = json_decode($encoded, TRUE);
$actual = Parser::decode($encoded, TRUE);
$this->assertTrue(is_array($actual));
$this->assertSame($expected, $actual);
// Test the depth option
$expected = json_decode($encoded, TRUE, 3);
$actual = Parser::decode($encoded, TRUE, 3);
$this->assertSame($expected, $actual);
}
|
[
"public function testIsInstanceOfJson()\n {\n $actual = $this->Json;\n $this->assertInstanceOf('Josantonius\\Json\\Json', $actual);\n }",
"function cargo_is_json( $obj ) {\n\treturn is_string( $obj ) && is_array( json_decode( $obj, true ) ) && json_last_error() === JSON_ERROR_NONE;\n}",
"public function testDecodeJson()\n {\n $data = [\"data\" => \"test\", \"more\" => [\"data\" => \"test\"]];\n $json = json_encode($data);\n $apiClient = new ApiClient(\"test\");\n $this->assertEquals($data, $this->runProtectedMethod($apiClient, \"decodeJson\", [$json]));\n }",
"public function theResponseJsonShouldBeASingleObject()\n {\n $response = $this->getResponseContentJson();\n if(!is_object($response)) {\n throw new Exception\\SingleObjectExpectedException();\n }\n return;\n }",
"function is_json($string)\n{\n return (is_string($string) && is_object(json_decode($string))) ? true : false;\n}",
"public function testGetBodyAsObject()\n {\n $expected = array(\n 'a' => 1\n );\n\n $this->response->__construct(\n json_encode($expected),\n $this->request\n );\n\n $this->assertEquals(\n (object)$expected,\n $this->response->getBody(true),\n \"Expecting the response body to be returned\"\n );\n }",
"function isJson($input) {\n return is_string($input) && is_object(json_decode($input)) ? true : false;\n }",
"public function testToObject()\n {\n // Remove the following lines when you implement this test.\n $this->markTestIncomplete(\n 'This test has not been implemented yet.'\n );\n }",
"public function testUniqueVisitorsJson() {\n $this->assertEquals(gettype($this->piwik->unique_visitors('json')), 'object');\n }",
"protected function shouldBeJson($content)\r\n {\r\n return\r\n// $content instanceof Jsonable ||\r\n $content instanceof \\ArrayObject ||\r\n $content instanceof \\JsonSerializable ||\r\n is_array($content);\r\n }",
"public function testDecodeObjectToAssociativeArray()\n {\n $validJson = '{\"first\":2,\"second\":4}';\n\n $validArray = ['first' => 2, 'second' => 4];\n\n $methodDecode = Json::decode($validJson);\n\n $this->assertEquals($validArray, $methodDecode);\n }",
"public function testTransformObject()\n {\n $book = Book::make(['id' => 1, 'title' => 'The Adventures of Tom Sawyer']);\n\n $this->assertInternalType('array', $book->toArray());\n $this->assertInternalType('array', $book->jsonSerialize());\n\n $this->assertJson($book->toJson());\n $this->assertJson((string)$book);\n }",
"function hb_is_json( $data ) {\n\t\tjson_decode( $data );\n\t\treturn ( json_last_error() === JSON_ERROR_NONE );\n\t}",
"public function testJsonObjectDeserialize(UserEntity $entity)\n {\n $decodeObj = UserEntity::jsonObjectDeserialize($entity->toJson());\n $this->assertInstanceOf(JsonDeserializable::class, $decodeObj);\n $this->assertEquals($decodeObj, $entity);\n }",
"public function testIncompleteJson($json)\n {\n Value::jsonDecode($json);\n }",
"public function shouldBeJson($content)\n {\n return $content instanceof Jsonable ||\n $content instanceof ArrayObject ||\n $content instanceof JsonSerializable ||\n is_array($content);\n }",
"public function testBadJsonDecode()\n {\n $invalidJson = '{\"test\":False}';\n try {\n Json::decode($invalidJson);\n } catch (InvalidJsonException $e) {\n $this->assertInstanceOf(InvalidJsonException::class, $e);\n }\n }",
"function parseObject($json);",
"public function testConvertObject()\n {\n $serializer = new Gson3;\n\n $object = new stdClass();\n $object->title = 'Test Object';\n\n // List\n $serializer->convertObject($object);\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Remove a stylesheet from the parse array. This is useful if you want to override/get rid of the default stylesheet set in the voodoo.ini file in certain interfaces
|
function removeStyleSheet($css)
{
unset($this->styles[$css]);
}
|
[
"private function remove_stylesheet() {\n\n\t\tremove_action( 'genesis_meta', 'genesis_load_stylesheet' );\n\n\t}",
"function unregister_style($file)\n {\n if (array_key_exists($file, $this->m_stylesheets))\n {\n unset($this->m_stylesheets[$file]);\n }\n }",
"public static function clearStylesheets( )\n\t{\n\t\tstatic::$stylesheets = array();\n\t}",
"public function removeStyle($file);",
"public function removeStylesheets() {\n\t\tforeach ($this->stylesheets as $link) {\n\t\t\t$link->parentNode->removeChild($link);\n\t\t}\n\t\t$this->stylesheets = array();\n\t\treturn $this;\n\t}",
"public function clearStyleSheets()\n {\n $this->styleSheets = '';\n }",
"function clear_plugin_styles() {\n $plugin_style_options = array(\n 'csl-slplus-theme_array',\n 'csl-slplus-theme_details',\n 'csl-slplus-theme_lastupdated',\n );\n foreach ($plugin_style_options as $option_name) {\n $this->addon->admin->reset_single_setting( $option_name );\n }\n\n $plugin_style_serialized = array(\n 'csl-slplus-options_nojs' => 'themes_last_updated'\n );\n foreach ($plugin_style_serialized as $option_name => $setting) {\n $this->addon->admin->reset_serial_Settings( $option_name , $setting );\n }\n\n return array();\n }",
"public static function cleanCSSList() {\n\t\tglobal $wgFlexFormConfig;\n\t\t$wgFlexFormConfig['loaders']['css'] = [];\n\t\t//self::$cssStyles = array();\n\t}",
"public function removeStylesheet($sKey = null);",
"public function clearStyles()\r {\r $this->styles = array();\r }",
"public function clearStylesheets()\n {\n $this->styles = array();\n }",
"public function remove_theme_styles() {\n\t\tglobal $wp_styles;\n\t\t$wp_styles->queue = array();\n\t}",
"public static function delStyle(){\n\t\tself::$style\t= false;\n\t}",
"public function remove_style($key) {\r\n \r\n if (isset($this->_style_load[$key])) {\r\n unset($this->_style_load[$key]);\r\n }\r\n \r\n }",
"function wp_deregister_style($handle)\n{\n}",
"function tiga_deregister_styles() {\n\twp_deregister_style( 'wp-pagenavi' );\n}",
"function inkpro_remove_unwanted_plugin_style() {\r\n\r\n\t\t// We will redesign the tour dates plugin from scratch so dequeue de stylesheet\r\n\t\twp_dequeue_style( 'wolf-portfolio' );\r\n\t\twp_deregister_style( 'wolf-portfolio' );\r\n\t\twp_dequeue_style( 'wolf-videos' );\r\n\t\twp_deregister_style( 'wolf-videos' );\r\n\t\twp_dequeue_style( 'wolf-albums' );\r\n\t\twp_deregister_style( 'wolf-albums' );\r\n\t\twp_dequeue_style( 'wolf-discography' );\r\n\t\twp_deregister_style( 'wolf-discography' );\r\n\t\twp_dequeue_style( 'wolf-tour-dates' );\r\n\t\twp_deregister_style( 'wolf-tour-dates' );\r\n\t\twp_dequeue_style( 'wbounce-style' );\r\n\t\twp_deregister_style( 'wbounce-style' );\r\n\t\twp_dequeue_style( 'wbounce-style-all' );\r\n\t\twp_deregister_style( 'wbounce-style-all' );\r\n\t}",
"public function resetStyles() {\n $this->style = array();\n }",
"public function clearLoadedCss()\n\t{\n\t\t$this->_css\t= array(\n\t\t\t\t\t\t\t'inline'\t=> array(),\n\t\t\t\t\t\t\t'import'\t=> array(),\n\t\t\t\t\t\t\t);\n\t\t$this->registry->getClass('output')->skin['_cssGroupsArray'] = array();\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
joins all given tempfiles in given order to a single new tempFile
|
public function joinTempFiles($_tempFiles)
{
$path = self::getTempPath();
$name = preg_replace('/\.\d+\.chunk$/', '', $_tempFiles->getFirstRecord()->name);
$type = $_tempFiles->getFirstRecord()->type;
$size = 0.0;
$fJoin = fopen($path, 'w+b');
foreach ($_tempFiles as $tempFile) {
$fChunk = @fopen($tempFile->path, "rb");
if (! $fChunk) {
throw new UnexpectedValue("Can not open chunk {$tempFile->id}");
}
// NOTE: stream_copy_to_stream is about 15% slower
while (!feof($fChunk)) {
$bytesWritten = fwrite($fJoin, fread($fChunk, 2097152 /* 2 MB */));
$size += (double) $bytesWritten;
}
fclose($fChunk);
}
fclose($fJoin);
return $this->createTempFile($path, $name, $type, $size);
}
|
[
"public function mergeCreatedFiles();",
"function appendSplitFiles($fileToAppend)\r\n\t{\r\n\t\t$directory_tree = get_all_files_from_dir($fileToAppend);\r\n\t\tusort($directory_tree, array($this, \"sortString\"));\r\n\t\t\r\n\t\t$joinedFilesArray = array();\r\n\t\t$orgHashValues = array();\r\n\t\t$hashValue = '';\r\n\t\t\r\n\t\tforeach($directory_tree as $k => $v)\r\n\t\t{\r\n\t\t\t$contents = '';\r\n\t\t\t$orgFileCount = 0;\r\n\t\t\t/* $subject = $v;\r\n\t\t\t$pattern = '/iwp_part/i';\r\n\t\t\tpreg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE);\r\n\t\t\tprint_r($matches); */\r\n\t\t\t$pos = strpos($v, 'iwp_part');\r\n\t\t\tif($pos !== false)\r\n\t\t\t{\r\n\t\t\t\t$currentFile = explode(\".\",$v);\r\n\t\t\t\t$currentFileSize = count($currentFile);\r\n\t\t\t\tforeach($currentFile as $key => $val)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(($key == ($currentFileSize-2))||($currentFileSize == 1))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$insPos = strpos($val, '_iwp_part');\r\n\t\t\t\t\t\t$rest = substr_replace($val, '', $insPos);\r\n\t\t\t\t\t\t$currentFile[$key] = $rest;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$insPos2 = strpos($rest, '_iwp_hash');\r\n\t\t\t\t\t\tif($insPos2 !== false)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$hashInitialPoint = strrpos($rest, \"_iwp_hash\"); \r\n\t\t\t\t\t\t\t$hashValue = substr($rest, $hashInitialPoint+10);\r\n\t\t\t\t\t\t\t//$hashValue = substr($rest, -32);\r\n\t\t\t\t\t\t\t$rest = substr_replace($rest, '', $insPos2);\r\n\t\t\t\t\t\t\t$currentFile[$key] = $rest;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$orgFileCount++;\t\r\n\t\t\t\t$orgFileName = implode(\".\", $currentFile);\r\n\t\t\t\t$handle = fopen($v,\"r\");\r\n\t\t\t\t$contents = fread($handle, iwp_mmb_get_file_size($v));\r\n\t\t\t\tfclose($handle);\r\n\t\t\t\tif($orgFileCount == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t//clearing contents of file intially to prevent appending to already existing file\r\n\t\t\t\t\t//file_put_contents($orgFileName,'',FILE_APPEND);\r\n\t\t\t\t}\r\n\t\t\t\tfile_put_contents($orgFileName,$contents,FILE_APPEND);\r\n\t\t\t\t$joinedFilesArray[$orgFileName] = 'hash';\r\n\t\t\t\t$orgHashValues[$orgFileName] = $hashValue;\r\n\t\t\t\techo \" orgFileName - \".$orgFileName;\r\n\t\t\t\t$file_to_ulink = realpath($v);\r\n\t\t\t\t$resultUnlink = unlink($file_to_ulink);\r\n\t\t\t\t$resultUnlink = error_get_last();\r\n\t\t\t\tif(!$resultUnlink)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(is_file($v))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tunlink($file_to_ulink);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t$hashValues = array();\r\n\t\tforeach($joinedFilesArray as $key => $value)\r\n\t\t{\r\n\t\t\t//$hashValues[$key] = md5_file($key);\r\n\t\t\t$hashValues[$key] = 'hash';\r\n\t\t}\r\n\t\t$totalHashValues = array();\r\n\t\t$totalHashValues['orgHash'] = $orgHashValues;\r\n\t\t$totalHashValues['afterSplitHash'] = $hashValues;\r\n\t\treturn $totalHashValues;\r\n\t}",
"public function join(Array $inputFiles, $outputFile);",
"private function mergeTemporaryFiles()\r\n {\r\n LogClass::log('Merging XML files of stock feed.');\r\n\r\n return parent::mergeTemporaryFilesBase();\r\n }",
"private function upload_files_to_temp()\n\t{\n\t}",
"public function moveFilesFromTemp(){\n\t\tforeach($this->_files as $upload){\n\t\t\tif($id = $upload->getId()){\n\t\t\t\tif($upload->moveFromTemp($this->getUploadPath())){\n\t\t\t\t\t// ... ?\n\t\t\t\t}else throw new Exception('Can\\'t move an upload from temp to destination !');\n\t\t\t}\n\t\t}\n\t}",
"protected function createExtraFiles() {\n $extraFiles = array();\n\n for ($i = 0; $i < 3; $i++) {\n $content = 'This is extra file #' . $i;\n $extraFile = array(\n 'file' => 'foo/bar-' . $i . '.txt',\n 'md5' => md5($content),\n );\n\n GeneralUtility::mkdir($this->temporaryPath . dirname($extraFile['file']));\n GeneralUtility::writeFile($this->temporaryPath . $extraFile['file'], $content);\n\n $extraFiles[] = $extraFile;\n }\n\n return $extraFiles;\n }",
"protected function _processTmpFiles()\n {\n $io = $this->getIo();\n\n $tmpFiles = $this->_collectFiles($this->getTmpDir(), '_tmpFiles');\n\n foreach($tmpFiles as $k => $tmpFile) {\n\n // Rework $tmpFile in order to remove tmp dir in filename. This is useful for removing unused files.\n // @see Herve_Modex_Model_Modex::_removeUnusedFiles()\n $filename = str_replace(self::TMP_DIR . DS, '', $tmpFile);\n $tmpFiles[$k] = $filename;\n\n if(is_dir($tmpFile)) {\n $io->mkdir($filename);\n }\n else {\n copy($tmpFile, $filename);\n }\n }\n\n // Update tmpFiles with new reworked filenames\n $this->_tmpFiles = $tmpFiles;\n\n $io->rmdir($this->getTmpDir(), true);\n\n return $this;\n }",
"function joinFiles(array $files, $result)\r\n{\r\n if (!is_array($files)) {\r\n throw new Exception('`$files` must be an array');\r\n }\r\n header('Content-Type: text/csv');\r\n header('Content-Disposition: attachment; filename=\"' . $result . '\"');\r\n\r\n $wH = fopen('php://output', \"wb\");\r\n\r\n foreach ($files as $file) {\r\n $fh = fopen($file, \"r\");\r\n while (!feof($fh)) {\r\n fwrite($wH, fgets($fh));\r\n }\r\n fclose($fh);\r\n unset($fh);\r\n fwrite($wH, \"\\n\"); //usually last line doesn't have a newline\r\n }\r\n fclose($wH);\r\n unset($wH);\r\n}",
"private function combineFiles($pFiles, $pFileName) {\n\n \t//foreach about all files we wanna combine\n foreach($pFiles as $lMyFile) {\n \t//now we get the content of the current-file as an array (every line = one field in the array)\n \t$lArray = file($lMyFile);\n //var_dump(trim(chop($lArray[0])));die();\n \tforeach($lArray as $lKey => $lValue) {\n \t\t//remove all spaces\n \t\t$lValue = trim(chop(str_replace(\" \", \"\", $lValue)));\n\n \t\t//if(sfConfig::get('app_settings_dev') == false && strpos($lValue, 'debug.log') !== false) {\n \t\tif(strpos($lValue, 'debug.log') !== false) {\n \t\t\tunset($lArray[$lKey]);\n \t\t}\n\n \t\t//if there is a @combine in the file\n \t\tif(strpos($lValue, '*@combine') !== false) {\n \t\t\t//build the current set filename\n \t\t\t$lNewName = str_replace('*@combine', \"\", $lValue).'-'.$pFileName;\n \t\t\t//open or build the file with the new name\n $lWholeFile = fopen(dirname(__FILE__).'/../../web/js/100_main/include/'.$lNewName, 'a+');\n //get the content\n $lContent = file_get_contents($lMyFile);\n if(sfConfig::get('app_settings_dev') == false) {\n $lContent = str_replace('debug.log', \"//debug.log\", $lContent);\n }\n //and write to the end of the new file\n $lDone = fwrite($lWholeFile, $lContent);\n echo basename($lMyFile).\" combined to \".$lNewName;\n echo \"\\n\\r\";\n \t\t}\n \t}\n }\n // at least, close the new combine-file\n fclose($lWholeFile);\n }",
"public function combine()\n {\n $this->combine = [];\n\n foreach ($this->files as $extension => $files)\n {\n // Combine only if file is change\n $extensionModified = 0;\n foreach ($files as $file)\n {\n if($file['modified'] != false) $extensionModified = 1;\n }\n\n if( $extensionModified and count($files) )\n {\n $this->compressor->performance->set(__FUNCTION__, $extension);\n $this->combine[$extension] = \"\";\n foreach ($files as $file)\n {\n $this->combine[$extension] .= \"\\n/* add file \" . $file['filename'] . \".\" . $file['extension'] . \" */\\n\";\n $this->combine[$extension] .= file_get_contents($file['pathAndFile']);\n }\n $this->compressor->performance->stop(__FUNCTION__, $extension);\n\n $this->combine[$extension] .= \"\\n/* \\n * Take.\" . $file['extension'] . \" done in \" . $this->compressor->performance->get('μs', __FUNCTION__, $extension) . \" \\n */\\n\";\n }\n\n }\n }",
"public function prepareFiles() {\r\n\t\t$this->db->query('SET SESSION group_concat_max_len = 1000000;');\r\n\t\t$this->select(\"CONCAT('[',GROUP_CONCAT(DISTINCT CONCAT('{\\\"file\\\":\\\"',files.file,'\\\",\\\"name\\\":\\\"', files.name,'\\\",\\\"infos\\\":',files.infos,'}') SEPARATOR ','), ']') as files\");\r\n\t\t$this->join('link_courses_files', 'link_courses_files.course_id = courses.id', 'left');\r\n\t\t$this->join('files', 'files.id = link_courses_files.file_id', 'left');\r\n\t\t$this->where($this->getTableName() . '.id IS NOT NULL');\r\n\t\t$this->group_by($this->getTableName() . '.id');\r\n\t}",
"function insertionSort($files, $sort){\n for($i=2; $i < count($files); $i=$i+2){\n for($j=0; $j<$i; $j=$j+2){\n if(compareType($files, $sort, $i, $j)){\n $files = swap($files, $i, $j);\n }\n }\n }\n return $files;\n }",
"function concatenateFiles($files) {\n\t\t$buffer = '';\n\t\t\n\t\tforeach ( $files as $file ) {\n\t\t\t$buffer .= file_get_contents ( __DIR__ . '/' . $file );\n\t\t}\n\t\t\n\t\treturn $buffer;\n\t}",
"protected function loadTempLists()\n {\n $objFileList = new File($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['tmp'],\n \"syncfilelist-ID-\" . $this->intClientID . \".txt\"));\n $strContent = $objFileList->getContent();\n if (strlen($strContent) == 0) {\n $this->arrListFile = [];\n } else {\n $this->arrListFile = \\Contao\\StringUtil::deserialize($strContent);\n }\n\n $objCompareList = new File($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['tmp'],\n \"synccomparelist-ID-\" . $this->intClientID . \".txt\"));\n $strContent = $objCompareList->getContent();\n if (strlen($strContent) == 0) {\n $this->arrListCompare = [];\n } else {\n $this->arrListCompare = \\Contao\\StringUtil::deserialize($strContent);\n }\n }",
"protected function mergeChunks($dir)\n\t{\n\t\thelper('filesystem');\n\t\thelper('text');\n\t\t\n\t\t// Get chunks from target directory\n\t\t$chunks = get_filenames($dir, true);\n\t\tif (empty($chunks))\n\t\t\tthrow FilesException::forNoChunks($dir);\n\t\t\n\t\t// Create the temp file\n\t\t$tmpfile = tempnam(sys_get_temp_dir(), random_string());\n\t\tlog_message('debug', 'Merging ' . count($chunks) . ' chunks to ' . $tmpfile);\n\n\t\t// Open temp file for writing\n\t\t$output = @fopen($tmpfile, 'ab');\n\t\tif (! $output)\n\t\t\tthrow FilesException::forNewFileFail($tmpfile);\n\t\t\n\t\t// Write each chunk to the temp file\n\t\tforeach ($chunks as $file):\n\t\t\t$input = @fopen($file, 'rb');\n\t\t\tif (! $input)\n\t\t\t\tthrow FilesException::forWriteFileFail($tmpfile);\n\t\t\t\n\t\t\t// Buffered merge of chunk\n\t\t\twhile ($buffer = fread($input, 4096))\n\t\t\t\tfwrite($output, $buffer);\n\t\t\t\n\t\t\tfclose($input);\n\t\tendforeach;\n\t\t\n\t\t// close output handle\n\t\tfclose($output);\n\n\t\treturn $tmpfile;\n\t}",
"function join_files(array $files, $filename) {\n if(!is_array($files)) {\n throw new Exception('`$files` must be an array');\n }\n $filename = preg_replace(\"/[^A-Za-z0-9_\\-]/\", '-', $filename);\n $path = 'data/' . $filename . '.csv';\n \n $wH = fopen($path, \"w+\");\n \n $headers = false;\n foreach($files as $file) {\n $fh = fopen($file, \"r\");\n \n // Print headers if they're not set already, otherwise skip them (they must be on the first line for this to work)\n $headers_line = fgets($fh);\n if( ! $headers) {\n fwrite($wH, $headers_line);\n $headers = true;\n }\n \n while(!feof($fh)) {\n // If line is not empty\n if($line = fgets($fh)) {\n fwrite($wH, $line);\n }\n }\n fclose($fh);\n unset($fh);\n //fwrite($wH, \"\\n\"); //usually last line doesn't have a newline\n }\n fclose($wH);\n unset($wH);\n return $path;\n}",
"function copy_extra_files() {\n\n global $file_array, $dir_path, $xerte_toolkits_site, $delete_file_array;\n\n while ($file = array_pop($file_array)) {\n if (strlen($file[1]) == 0) {\n $string = str_replace($xerte_toolkits_site->root_file_path, \"\", $file[0]);\n } else {\n $string = $file[1];\n }\n directory_maker($string);\n\n array_push($delete_file_array, $dir_path . $string);\n @copy($file[0], $dir_path . $string);\n }\n}",
"public function mergeDeletedFiles();"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
TODO: Implement withRequestTarget() method.
|
public function withRequestTarget($requestTarget)
{
}
|
[
"public function setRequestTarget(string $requestTarget): void;",
"public function getRequestTarget(): string;",
"public function testRequestTarget()\n {\n $expected = '/lorem-ipsum';\n $request = $this->request->withRequestTarget($expected);\n\n $this->assertEquals($expected, $request->getRequestTarget());\n }",
"public function testWithRequestTarget()\n {\n $serverRequest = $this->getEnviromentForTest();\n $newRequest = $serverRequest->withRequestTarget('/foo/?bar=test');\n\n // check if was not changed\n $this->assertEquals('/path/123?q=abc', $serverRequest->getRequestTarget());\n $this->assertEquals('/foo/?bar=test', $newRequest->getRequestTarget());\n }",
"public function target()\n {\n return $this->target;\n\n // getRequestTarget\n // withRequestTarget\n }",
"public function testWithRequestTarget(): void\n {\n $request = new ServerRequest([\n 'environment' => [\n 'REQUEST_URI' => '/articles/view/1',\n 'QUERY_STRING' => 'comments=1&open=0',\n ],\n 'base' => '/basedir',\n ]);\n $this->assertSame(\n '/articles/view/1?comments=1&open=0',\n $request->getRequestTarget(),\n 'Should not include basedir.'\n );\n\n $new = $request->withRequestTarget('/articles/view/3');\n $this->assertNotSame($new, $request);\n $this->assertSame(\n '/articles/view/1?comments=1&open=0',\n $request->getRequestTarget(),\n 'should be unchanged.'\n );\n $this->assertSame('/articles/view/3', $new->getRequestTarget(), 'reflects method call');\n }",
"public function testWithRequestTarget(string $requestTarget) : void\n {\n $request = $this->getRequest();\n $fileFactory = $this->createMock(EmbeddedFileFactoryInterface::class);\n\n $reflex = new \\ReflectionClass(HttpRequestServerAdapter::class);\n $instance = $reflex->newInstanceWithoutConstructor();\n\n $requestProperty = $reflex->getProperty('httpRequest');\n $requestProperty->setAccessible(true);\n $requestProperty->setValue($instance, $request);\n\n $fileFactoryProperty = $reflex->getProperty('fileFactory');\n $fileFactoryProperty->setAccessible(true);\n $fileFactoryProperty->setValue($instance, $fileFactory);\n\n $newRequest = $instance->withRequestTarget($requestTarget);\n $innerRequest = $requestProperty->getValue($newRequest);\n\n $this->getTestCase()->assertNotSame($innerRequest, $request);\n $this->getTestCase()->assertEquals($this->gessRequestTarget($requestTarget), $innerRequest->getUri());\n\n return;\n }",
"public function request() {\n $this->adaptee->specialRequest(); \n }",
"public function handlerNeedsRequest()\n {\n }",
"protected function makeRequest()\n {\n }",
"public function setRequestTarget(string $requestTarget): void\n {\n $this->requestTarget = $requestTarget;\n }",
"protected function setRequestUrl()\n {\n }",
"abstract protected function _setRequestServiceBuilder();",
"public final function isRequest()\n {\n }",
"public function getRequestTarget() {\n return $this->uri ?? Constants::DEFAULT_REQUEST_TARGET;\n }",
"protected function generateRequestTarget()\n\t{\n\t\t$endpoint = Client::API_ENDPOINT;\n\t\t$baseMethod = WordRequest::API_METHOD;\n\t\t$format = Client::RESPONSE_FORMAT;\n\t\t$method = AudioRequest::API_METHOD;\n\n\t\treturn \"{$endpoint}/{$baseMethod}.{$format}/{$this->word}/{$method}\";\n\t}",
"function _CreateResponseRequest()\n\t\t{\n\t\t}",
"public function getRequestTarget()\n {\n if ($this->requestTarget === null) {\n $target = $this->getUri()->getPath();\n if ($target == '') {\n $target = '/';\n }\n $query = $this->getUri()->getQuery();\n if ($query) {\n $target .= '?' . $query;\n }\n $this->requestTarget = $target;\n }\n\n return $this->requestTarget;\n }",
"public function getRequestTarget()\n {\n if ($this->requestTarget) {\n return $this->requestTarget;\n }\n\n if ($this->uri === null) {\n return '/';\n }\n\n $path = $this->uri->getPath();\n $query = $this->uri->getQuery();\n if ($query) {\n $path .= '?' . $query;\n }\n $this->requestTarget = $path;\n\n return $this->requestTarget;\n }",
"public function withRequestTarget($requestTarget)\n {\n $request = new $this;\n $request->requstTarget = $requestTarget;\n\n return $request;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
pdf_closepath_stroke Close and stroke path pdf_closepath_stroke ( resource $pdf ) : bool Closes the path, and strokes it. Returns TRUE on success or FALSE on failure.
|
function pdf_closepath_stroke(& $pdf)
{
$pdf["stream"][] = "s";
}
|
[
"function cpdf_closepath_fill_stroke($pdfdoc) {}",
"function PDF_closepath_fill_stroke($p)\n{\n}",
"public function fillStroke(bool $close_path = FALSE): bool {}",
"public function stroke($path, $with, $stroke){}",
"function pdf_stroke(& $pdf)\n\t{\n\t$pdf[\"stream\"][] = \"S\";\n\t}",
"function cpdf_fill_stroke($pdfdoc) {}",
"function PDF_fill_stroke($p){}",
"function pdf_close_pdi_document(& $pdf, $doc)\n\t{\n\t}",
"function PDF_setrgbcolor_stroke($p, float $red, float $green, float $blue): void\n{\n error_clear_last();\n $result = \\PDF_setrgbcolor_stroke($p, $red, $green, $blue);\n if ($result === false) {\n throw PdfException::createFromPhpError();\n }\n}",
"function flushPDF($pdf, $fileName)\n{\n\t$pdf->Output($fileName, 'D');\n}",
"public function hasStroke()\n {\n return $this->getOption('stroke', true);\n }",
"function PDF_close_pdi($p, int $doc): void\n{\n error_clear_last();\n $result = \\PDF_close_pdi($p, $doc);\n if ($result === false) {\n throw PdfException::createFromPhpError();\n }\n}",
"public function closePDFAsync($pdf_close_document_parameters)\n {\n return $this->closePDFAsyncWithHttpInfo($pdf_close_document_parameters)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }",
"function cairo_text_path($context, $text){}",
"public static function strokeClosedSubpath($image, array $points, int $color, float $strokeWidth): void\n {\n // imagepolygon() requires at least 3 coordinate pairs\n if (count($points) < 6) {\n self::strokeOpenSubpath($image, $points, $color, $strokeWidth);\n return;\n }\n\n $roundedCoordinates = array_map('round', $points);\n\n imagesetthickness($image, round($strokeWidth));\n imagepolygon($image, $roundedCoordinates, count($roundedCoordinates) / 2, $color);\n }",
"function deletePDF($pdf = \"\")\n {\n if (!$pdf)\n $pdf = $this->pdf;\n unlink ($pdf);\n }",
"public function disposePdf(){\n\t\t$id = $_POST['articleId'];\n\t\t\t\n\t\t$rootAndFile = $this->getRootArticleName($id);\n\t\t$fileName = $rootAndFile['fileName'];\n\t\t$root = $rootAndFile['root'];\n\t\t$path = $root.\"/pdfDirectory/articlePdf\";\n\t\t\n\t\t$isRemoved = removePdf($path, $fileName); \n\t\t\n\t\tif ($isRemoved == true) {\n\t\t\tif($this->read_model->updatePdfExist($id, $data = array(\"havePdfVersion\" => false)) == 1)\n\t\t\t\techo json_encode(array(\"msg\" => \"success\"));\n\t\t\telse json_encode(array(\"msg\" => \"fail\", \"error\" => \"Not updated in database.\"));\n\t\t} \n\t\telse echo json_encode(array(\"msg\" => \"fail\", \"error\" => \"The target file does not exist in targeted directory.\"));\n\t\t\n\t}",
"function savePDF($pdf, $fileName)\n{\n\t$pdf->Output($fileName, 'F');\n}",
"function endPath(){}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Load bundle rate shipping
|
function woocommerce_bundle_rate_shipping_add_layer() {
woocommerce_bundle_rate_shipping_load();
enda_woocommerce_bundlerate_shipping::display_layer();
}
|
[
"function woocommerce_bundle_rate_shipping_load() {\n if ( ! class_exists('enda_woocommerce_bundlerate_shipping' ) ) {\n require_once('bundle_rate.class.php');\n }\n}",
"public function load_shipping_method() {\n\n\t\twc_local_pickup_plus()->load_shipping_method();\n\t}",
"private static function loadShipping(): void\n {\n if (self::$shippingLoaded) {\n return;\n }\n\n self::$shippingLoaded = true;\n\n foreach (self::SHIPMENT_METHODS as $method) {\n self::load($method);\n }\n\n foreach (self::SHIPMENT_ZONES as $zone) {\n self::load($zone);\n }\n }",
"protected function _loadFlatrate(){\n\t\tif(Mage::getStoreConfig(self::CONFIG_FLAG_FLATRATE, $this->_store)){\n\t\t\t$this->_addMethod($this->_createMethodObject('flatrate_flatrate', 'Flat Rate'));\n\t\t}\n\t}",
"function tc_fix_woocommerce_bundle_rate_shipping_scripts() {\r\n\t\tif ( !(isset( $_GET['page'] ) && isset( $_GET['tab'] ) && $_GET['page'] == 'wc-settings' && $_GET['tab'] == 'shipping') ) {\r\n\t\t\twp_dequeue_script( 'woocommerce_bundle_rate_shipping_admin_js' );\r\n\t\t}\r\n\t}",
"public function getShippingrate()\n\t{\n\t\tinclude_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';\n\t\t$shipping = new shipping;\n\t\techo $shipping->getShippingrate_calc();\n\t\texit;\n\t}",
"public function calculate_shipping($package=array()) {\n \n $weight = 0;\n $cost = 0;\n $country = $package[\"destination\"][\"country\"];\n \n foreach ( $package['contents'] as $item_id => $values ) \n { \n $_product = $values['data']; \n $weight = $weight + $_product->get_weight() * $values['quantity']; \n }\n \n $weight = wc_get_weight( $weight, 'kg' );\n \n if( $weight <= 2 ) {\n \n $cost = 7;\n \n } elseif( $weight <= 10 ) {\n \n $cost = 9.70;\n \n } elseif( $weight <= 20 ) {\n \n $cost = 20.50;\n \n } else {\n \n $cost = 29;\n \n }\n \n $countryZones = array(\n 'CH' => 0,\n 'LI' => 0,\n );\n \n $zonePrices = array(\n 0 => 0,\n ); \n \n $zoneFromCountry = $countryZones[ $country ];\n $priceFromZone = $zonePrices[ $zoneFromCountry ];\n \n $cost += $priceFromZone;\n \n $rate = array(\n 'id' => $this->id,\n 'label' => $this->title,\n 'cost' => $cost\n );\n \n $this->add_rate( $rate );\n \n }",
"private function load_shipping_method_options()\n {\n }",
"public function calculate_shipping( $package = array() ) {\n \n $weight = 0;\n $cost = 0;\n $country = $package[\"destination\"][\"country\"];\n \n foreach ( $package['contents'] as $item_id => $values ) \n { \n $_product = $values['data']; \n $weight = (float)$weight + (float)$_product->get_weight() * (float)$values['quantity']; \n }\n \n $weight = wc_get_weight( $weight, 'kg' );\n \n if( $weight <= 2 ) {\n \n $cost = 18;\n \n } elseif( $weight <= 10 ) {\n \n $cost = 22;\n \n } elseif( $weight <= 30 ) {\n \n $cost = 29;\n \n } else {\n \n $cost = 37;\n \n }\n \n $countryZones = array(\n 'CH' => 0,\n 'LI' => 0,\n );\n \n $zonePrices = array(\n 0 => 0,\n );\n \n $zoneFromCountry = $countryZones[ $country ];\n $priceFromZone = $zonePrices[ $zoneFromCountry ];\n \n $cost += $priceFromZone;\n \n $rate = array(\n 'id' => $this->id,\n 'label' => $this->title,\n 'cost' => $cost\n );\n \n $this->add_rate( $rate );\n \n }",
"public function add_shipping($shipping_rate)\n {\n }",
"public function set_shipping_rate($shipping_rate)\n {\n }",
"function calculate_shipping($package = array()) {\r\n\r\n global $woocommerce;\r\n\r\n $rates = $this->get_rates_by_countrygroup($this->get_countrygroup($package));\r\n $weight = $woocommerce->cart->cart_contents_weight;\r\n $final_rate = $this->pick_smallest_rate($rates, $weight);\r\n \r\n if($final_rate === false) return false;\r\n \r\n $taxable = ($this->tax_status == 'taxable') ? true : false;\r\n \r\n \r\n if($this->fee > 0 && $package['destination']['country']) $final_rate = $final_rate + $this->fee;\r\n\r\n $rate = array(\r\n 'id' => $this->id,\r\n 'label' => $this->title,\r\n 'cost' => $final_rate,\r\n 'taxes' => '',\r\n 'calc_tax' => 'per_order'\r\n );\r\n \r\n $this->add_rate( $rate );\r\n }",
"public function rateAction()\n {\n // Get post data\n $post = $this->getRequest()->getPost();\n \n // Get fedex model\n $fedex = Mage::getModel('usa/shipping_carrier_fedex');\n \n // Get rate request model\n $rateRequest = Mage::getModel('shipping/rate_request');\n \n // Get order model\n $order = Mage::getModel('sales/order')->loadByIncrementId($post['order_id']);\n \n // Set order model\n $rateRequest->setOrder($order);\n \n // Set request data\n $rateRequest->setAllItems($order->getAllItems());\n \n // Streets\n $streets[] = $post['recipient_street1'];\n \n if ($post['recipient_street2'] != '') {\n $streets[] = $post['recipient_street2'];\n }\n if ($post['recipient_street3'] != '') {\n $streets[] = $post['recipient_street3'];\n }\n \n // Set destination data\n $rateRequest->setDestStreet($streets);\n $rateRequest->setDestCity($post['recipient_city']);\n $rateRequest->setDestPostcode($post['recipient_postcode']);\n $rateRequest->setDestRegionCode($post['recipient_region']);\n $rateRequest->setDestCountryId($post['recipient_country']);\n \n // Set insure shipment\n if (isset($post['insure_shipment']) && ($post['insure_shipment'] == 'on')) {\n $rateRequest->setInsureShipment(true)->setInsureAmount($post['insure_amount']);\n } else {\n $rateRequest->setInsureShipment(false);\n }\n \n $rateRequest->setResidenceDelivery($post['residence_delivery']);\n $rateRequest->setAddressValidation($post['address_validation']);\n\n // Get all items to ship\n $items = Mage::getModel('shipsync/shipping_package')->getParsedItems($rateRequest->getAllItems(), true);\n \n // Sort items by sku, removing duplicates\n foreach ($items as $item) {\n $_itemsBySku[$item['sku']] = $item;\n }\n \n // Iterate packages for rating, and loads items details from getParsedItems based on sku\n foreach ($post['packages'] as $package) {\n $error = false;\n \n unset($_items);\n \n $itemsToPack = explode(',', $package['items']);\n \n foreach ($itemsToPack as $key => $itemToPack) {\n $_items[] = $_itemsBySku[$post['items'][$itemToPack - 1]['sku']];\n }\n \n $_packages[] = array(\n 'volume' => $package['width'] * $package['height'] * $package['length'],\n 'value' => $package['value'],\n 'label' => $package['value'],\n 'items' => $_items,\n 'weight' => $package['weight'],\n 'length' => $package['length'],\n 'width' => $package['width'],\n 'height' => $package['height']\n );\n }\n \n $rateRequest->setPackages($_packages);\n\n $rateResult = Mage::getModel('shipsync/shipping_carrier_fedex_rate')->collectRates($rateRequest);\n \n $possibleMethods = $rateResult->asArray();\n \n $methods = $possibleMethods['fedex']['methods'];\n \n if ($rateResult->getError()) {\n unset($post);\n \n $post['error'] = $rateResult->getRateById(0)->getErrorMessage();\n } else {\n if (isset($post['method'])) {\n $arrResult = $rateResult->asArray();\n \n if (isset($arrResult['fedex']['methods'][$post['method']]['price_formatted'])) {\n $post['shipping_amount'] = $arrResult['fedex']['methods'][$post['method']]['price_formatted'];\n } else {\n $post['shipping_amount'] = null;\n $post['shipping_allowed_methods'] = $arrResult;\n }\n } else {\n unset($post);\n $post['error'] = 'Invalid Request';\n }\n }\n $encoded = json_encode($post);\n \n $this->getResponse()->setBody($encoded);\n }",
"protected function _loadFreeshipping(){\n\t\tif(Mage::getStoreConfig(self::CONFIG_FLAG_FREESHIP, $this->_store)){\n\t\t\t$this->_addMethod($this->_createMethodObject('freeshipping_freeshipping', 'Free Shipping'));\n\t\t}\n\t}",
"function ciniki_sapos_shippingRateGet($ciniki) {\n //\n // Find all the required and optional arguments\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');\n $rc = ciniki_core_prepareArgs($ciniki, 'no', array(\n 'tnid'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Tenant'),\n 'rate_id'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Shipping Profile Rate'),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n\n //\n // Make sure this module is activated, and\n // check permission to run this function for this tenant\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'sapos', 'private', 'checkAccess');\n $rc = ciniki_sapos_checkAccess($ciniki, $args['tnid'], 'ciniki.sapos.shippingRateGet');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Load tenant settings\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'tenants', 'private', 'intlSettings');\n $rc = ciniki_tenants_intlSettings($ciniki, $args['tnid']);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $intl_timezone = $rc['settings']['intl-default-timezone'];\n $intl_currency_fmt = numfmt_create($rc['settings']['intl-default-locale'], NumberFormatter::CURRENCY);\n $intl_currency = $rc['settings']['intl-default-currency'];\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'dateFormat');\n $date_format = ciniki_users_dateFormat($ciniki, 'php');\n\n //\n // Return default for new Shipping Profile Rate\n //\n if( $args['rate_id'] == 0 ) {\n $rate = array('id'=>0,\n 'profile_id'=>'',\n 'flags'=>'0',\n 'min_quantity'=>'',\n 'max_quantity'=>'',\n 'min_amount'=>'',\n 'max_amount'=>'',\n 'shipping_amount_us'=>'',\n 'shipping_amount_ca'=>'',\n 'shipping_amount_intl'=>'',\n );\n }\n\n //\n // Get the details for an existing Shipping Profile Rate\n //\n else {\n $strsql = \"SELECT ciniki_sapos_shipping_rates.id, \"\n . \"ciniki_sapos_shipping_rates.profile_id, \"\n . \"ciniki_sapos_shipping_rates.flags, \"\n . \"ciniki_sapos_shipping_rates.min_quantity, \"\n . \"ciniki_sapos_shipping_rates.max_quantity, \"\n . \"ciniki_sapos_shipping_rates.min_amount, \"\n . \"ciniki_sapos_shipping_rates.max_amount, \"\n . \"ciniki_sapos_shipping_rates.shipping_amount_us, \"\n . \"ciniki_sapos_shipping_rates.shipping_amount_ca, \"\n . \"ciniki_sapos_shipping_rates.shipping_amount_intl \"\n . \"FROM ciniki_sapos_shipping_rates \"\n . \"WHERE ciniki_sapos_shipping_rates.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"AND ciniki_sapos_shipping_rates.id = '\" . ciniki_core_dbQuote($ciniki, $args['rate_id']) . \"' \"\n . \"\";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');\n $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.sapos', array(\n array('container'=>'rates', 'fname'=>'id', \n 'fields'=>array('profile_id', 'flags', 'min_quantity', 'max_quantity', 'min_amount', 'max_amount', 'shipping_amount_us', 'shipping_amount_ca', 'shipping_amount_intl'),\n ),\n ));\n if( $rc['stat'] != 'ok' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.sapos.301', 'msg'=>'Shipping Profile Rate not found', 'err'=>$rc['err']));\n }\n if( !isset($rc['rates'][0]) ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.sapos.302', 'msg'=>'Unable to find Shipping Profile Rate'));\n }\n $rate = $rc['rates'][0];\n\n //\n // Format the display variables\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'sapos', 'private', 'shippingRateFormat');\n $rc = ciniki_sapos_shippingRateFormat($ciniki, $args['tnid'], $rate);\n if( $rc['stat'] != 'ok' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.sapos.306', 'msg'=>'Unable to format rate', 'err'=>$rc['err']));\n }\n $rate['shipping_amount_us'] = $rc['rate']['shipping_amount_us_display'];\n $rate['shipping_amount_ca'] = $rc['rate']['shipping_amount_ca_display'];\n $rate['shipping_amount_intl'] = $rc['rate']['shipping_amount_intl_display'];\n }\n\n return array('stat'=>'ok', 'rate'=>$rate);\n}",
"public function testShipmentLoading()\n {\n $parcel = Mage::getModel('hermes/parcel')->setShipmentId(2);\n $this->assertEquals('Fürstenberg', $parcel->getShipment()->getShippingAddress()->getLastname());\n }",
"public function ajax_update_shipping_method_load() {\n\n\t\tif ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['action'] ) && 'woocommerce_update_shipping_method' == $_REQUEST['action'] ) {\n\t\t\t$this->get_local_pickup_plus();\n\t\t}\n\t}",
"function wpsc_core_load_shipping_modules() {\n\tglobal $wpsc_shipping_modules;\n\n\t$shipping_directory = WPSC_FILE_PATH . '/wpsc-shipping';\n\t$nzshpcrt_shipping_list = wpsc_list_dir( $shipping_directory );\n\n\tforeach ( $nzshpcrt_shipping_list as $nzshpcrt_shipping ) {\n\t\tif ( stristr( $nzshpcrt_shipping, '.php' ) ) {\n\t\t\trequire( WPSC_FILE_PATH . '/wpsc-shipping/' . $nzshpcrt_shipping );\n\t\t}\n\t}\n\n\t$wpsc_shipping_modules = apply_filters( 'wpsc_shipping_modules', $wpsc_shipping_modules );\n}",
"protected function loadRates() {\n\t\t$rates_coll = Billrun_Factory::db()->ratesCollection();\n\t\t$rates = $rates_coll->query()->cursor()->setReadPreference(Billrun_Factory::config()->getConfigValue('read_only_db_pref'));\n\t\tforeach ($rates as $rate) {\n\t\t\t$rate->collection($rates_coll);\n\t\t\t$this->rates[strval($rate->getId())] = $rate;\n\t\t}\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns a preconfigured query primed to return results relevant for the specified time
|
public function getQuery($time);
|
[
"public function whereTime();",
"public function setQueryTime($time)\n\t{\n\t\t$this->_query_time = $time;\n\t}",
"public function setMaxQueryTime($qtime){}",
"protected function startQueryTimer()\n {\n // Get time before the query\n $time = explode(\" \", microtime());\n $this->queryStartTime = $time[1] + $time[0];\n }",
"public function getQuery()\n { \n\n $time = time() - ( 60 * 30 ); //half an hour\n\n $args = [\n 'post_type' => 'form-entry',\n 'post_status' => 'publish',\n 'meta_key' => 'gdpr_remove',\n 'meta_value' => 'true',\n 'date_query' => [\n 'before' => date( 'Y-m-d H:i:s', $time )\n ]\n ];\n\n return new WP_Query( $args );\n }",
"public function get_time_query_search()\n {\n return $this->get(self::TIME_QUERY_SEARCH);\n }",
"public function createStrictQuery()\n\t{\n\t\treturn $this->pp->createQuery('modules_twitterconnect/periodicplanner', false);\n\t}",
"public function findByTime($time){\n\n $sql= \"select * from pizzade where crawtime = '\".$time.\"' and shopsystem = '0'\";\n return $this->getAdapter()\n ->query($sql)\n ->fetchAll();\n\n }",
"public function queryTime()\n {\n return $this->queryTime;\n }",
"protected function getPeriodOfTimeSqlWhereClauseSnippet() {\n\t\t$cachedDate = $this->value['date'];\n\t\ttx_pttools_assert::isNotEmpty($cachedDate, array('message' => 'Value \"date\" must not be empty but was empty.'));\n\n\t\t$tableName = $this->getTableName();\n\t\t$startDateColumn = $this->getDateColumnByIndexNumber(0);\n\t\t$endDateColumn = $this->getDateColumnByIndexNumber(1);\n\t\t$sqlDateFunction = $this->determineSqlDateFunction();\n\t\t$sqlWhereClauseSnippet = $sqlDateFunction . \"(\" . $startDateColumn . \", '%Y-%m-%d') <= \" . $GLOBALS['TYPO3_DB']->fullQuoteStr($cachedDate, $tableName)\n\t\t\t. \" AND \"\n\t\t\t. $sqlDateFunction . \"(\" . $endDateColumn . \", '%Y-%m-%d') >= \" . $GLOBALS['TYPO3_DB']->fullQuoteStr($cachedDate, $tableName);\n\t\treturn $sqlWhereClauseSnippet;\n\t}",
"static public function startQuery() {\n if (!isset(self::$instance)) self::create();\n self::$queryStart = microtime(true);\n }",
"function ep_event_query( $query ) {\n\n\t// http://codex.wordpress.org/Function_Reference/current_time\n\t$current_time = current_time('mysql'); \n\tlist( $today_year, $today_month, $today_day, $hour, $minute, $second ) = split( '([^0-9])', $current_time );\n\t$current_timestamp = $today_year . $today_month . $today_day . $hour . $minute;\n\n\tglobal $wp_the_query;\n\t\n\tif ( $wp_the_query === $query && !is_admin() && is_post_type_archive( 'event' ) ) {\n\t\t$meta_query = array(\n\t\t\tarray(\n\t\t\t\t'key' => '_start_eventtimestamp',\n\t\t\t\t'value' => $current_timestamp,\n\t\t\t\t'compare' => '>'\n\t\t\t)\n\t\t);\n\t\t$query->set( 'meta_query', $meta_query );\n\t\t$query->set( 'orderby', 'meta_value_num' );\n\t\t$query->set( 'meta_key', '_start_eventtimestamp' );\n\t\t$query->set( 'order', 'ASC' );\n\t\t$query->set( 'posts_per_page', '5' );\n\t}\n\n}",
"public function setQueryTime($queryTime)\n {\n $this->_queryTime = $queryTime;\n\n return $this;\n }",
"public static function getByTime($time){\r\n $q = new db;\r\n $array = array();\r\n $q->query(\"Select * from posts where post_time > \".$time.\" ORDER BY post_time DESC\");\r\n if($q->re)\r\n {\r\n if($q->n>1){\r\n while($r = mysql_fetch_assoc($q->re))\r\n $array[] = $r;\r\n return $array;\r\n }\r\n else{\r\n $q->query(\"Select * from posts ORDER BY post_time DESC limit 0,10\");\r\n while($r = mysql_fetch_assoc($q->re))\r\n $array[] = $r;\r\n return $array;\r\n }\r\n }\r\n return 0;\r\n }",
"function createSelectQuery($fromDateFilter, $toDateFilter, $townFilter, $cityFilter, $stateFilter, $userFilter, $page, $limit) {\n\n $query = \"SELECT * FROM video \";\n if ($fromDateFilter || $toDateFilter || $townFilter || $cityFilter || $stateFilter || $userFilter) {\n $query = $query . 'WHERE ';\n $conditionAdded = false;\n if ($fromDateFilter) {\n $query = $query . \"time >= '\" . $fromDateFilter . \"' \";\n $conditionAdded = true;\n }\n if ($toDateFilter) {\n if ($conditionAdded) $query = $query . 'AND ';\n $query = $query . \"time <= '\" . $toDateFilter . \"' \";\n $conditionAdded = true;\n }\n if ($townFilter) {\n if ($conditionAdded) $query = $query . 'AND ';\n $query = $query . \"town LIKE '%\" . $townFilter . \"%' \";\n $conditionAdded = true;\n }\n if ($cityFilter) {\n if ($conditionAdded) $query = $query . 'AND ';\n $query = $query . \"city LIKE '%\" . $cityFilter . \"%' \";\n $conditionAdded = true;\n }\n if ($userFilter) {\n if ($conditionAdded) $query = $query . 'AND ';\n $query = $query . \"uploadedBy LIKE '%\" . $userFilter . \"%' \";\n $conditionAdded = true;\n }\n }\n $offsetCount = ($page - 1) * 20;\n $query = $query . \"ORDER BY time DESC LIMIT \" . $limit . \" OFFSET \". $offsetCount;\n\n return $query;\n}",
"private function buildAnswersInTimeQuery(): string\n {\n $operators = $this->requestInputService->getInputValue(QueryConstants::OPERATOR_KEY);\n $words = $this->requestInputService->getInputValue(QueryConstants::WORD_KEY);\n $countries = $this->requestInputService->getInputValue(QueryConstants::COUNTRY_KEY);\n $categories = $this->requestInputService->getInputValue(QueryConstants::CATEGORY_KEY);\n $letter = $this->requestInputService->getInputValue(QueryConstants::LETTER_KEY);\n $language = $this->requestInputService->getInputValue(QueryConstants::LANGUAGE_KEY);\n $percentage = $this->requestInputService->getInputValue(QueryConstants::PERCENTAGE_KEY);\n\n $query = \"SELECT\n date_cr AS day, \";\n\n if ($percentage) {\n $query .= \"COUNT(*) AS \" . QueryConstants::TOTAL_ANSWERS_COLUMN_NAME . \", \";\n }\n\n $query .= $this->buildWordComparisonSubQuery($words, $operators);\n\n $query .= $this->buildFromSubQuery($language);\n\n $query .= $this->buildWhereSubQuery(\n $language,\n $this->getWordTableName($language),\n $countries,\n $categories,\n $letter\n );\n\n $query .= \"\n GROUP BY\n day\n ORDER BY\n day ASC;\";\n\n return $query;\n }",
"protected function defineAllExpiredTemporaryOrdersQuery()\n {\n return $this->createQueryBuilder(null, null, false)\n ->leftJoin('o.orig_profile', 'op')\n ->andWhere('o INSTANCE OF XLite\\Model\\Cart')\n ->andWhere('op.profile_id IS NULL')\n ->andWhere('o.date < :time')\n ->setParameter('time', \\XLite\\Core\\Converter::time() - $this->getOrderTTL());\n }",
"function searchByTimestamp($time) {\n $sql = sprintf(\"SELECT group_id, item_id, user_id, type, old_value, new_value FROM plugin_docman_log WHERE time = %s\",\n\t\t\t\t$this->da->quoteSmart($time));\n return $this->retrieve($sql);\n }",
"public function getUnPublishableQueryTableProxy($time=null,$order=null) {\n\n $time = $this->getTime($time);\n\n $q = $this->getInvoker()\n ->getTable()\n ->createQuery('p')\n ->select('p.*')\n ->where('ended_at IS NOT NULL and ended_at < ?',array(date('Y-m-d H:m:i', $time)))\n ->orWhere('started_at IS NOT NULL and started_at > ?',array(date('Y-m-d H:m:i', $time)));\n\n if(!is_null($order))\n $q->orderBy($order);\n\n return $q;\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Method getClassObjectFromFile build and return an object of a class from its file path
|
private function getClassObjectFromFile($filePathName)
{
$classString = $this->getClassFullNameFromFile($filePathName);
$object = new $classString;
return $object;
}
|
[
"public function getClassObjectFromFile($filePathName)\n {\n $classString = $this->getClassFullNameFromFile($filePathName);\n\n $object = new $classString;\n\n return $object;\n }",
"public function load() {\n\t\t$path = explode( '_', $this->class );\n\t\t$this->file = '';\n\t\t$i = 0;\n\n\t\tif ( count( $path ) > 1 ) {\n\t\t\tarray_shift( $path );\n\t\t}\n\t\tend( $path );\n\n\t\t/**\n\t\t * Build directory path.\n\t\t */\n\t\twhile ( $i < key( $path ) ) {\n\t\t\t$this->build( $path[ $i ], '', '/' );\n\n\t\t\t$i++;\n\t\t}\n\n\t\t/**\n\t\t * Build filename.\n\t\t */\n\t\t$this->build( $path[ $i ], 'class', '.php' );\n\n\t\treturn $this->file;\n\t}",
"function load() {\n \tif(!empty($this->_object_name)) {\n\t\t\t// Trim off the end (if exists) so we can instantiate it by class name, not filename.\n\t\t\t$this->_object_name = str_replace(\".class.php\", \"\", $this->_object_name);\n\n\t\t\t$name = explode(\"/\", $this->_object_name);\n\t\t\tif(!isset($name[0]) or !isset($name[1])) {\n\t\t\t\tthrow new exception(\"Missing the full class path for \" . $this->_object_name);\n\t\t\t}\n\t\t\t\n\t\t\trequire_once($this->_object_name . \".class.php\");\n\t\n\t\t\t$call_list = \"\\$name[1]\";\n\t\t\tif(isset($this->_object_parameters)) {\n\t\t\t\t$call_list .= \",\";\n\t\t\t\tforeach($this->_object_parameters as $key=>$parameter) {\n\t\t\t\t\t$call_list .= \"\\$this->_object_parameters['{$key}'],\";\n\t\t\t\t}\n\t\t\t\t$call_list = trim($call_list, \",\");\n\t\t\t}\n\t\t\t\n\t\t\teval(\"\\$this->_object =& base_info::factory($call_list);\");\n\t\t\tif ($this->_object_id) {\n\t\t\t\t$this->_object->load($this->_object_id);\n\t\t\t}\n \t}\n\n \t$this->build();\n }",
"protected function newInstanceClassFromFile($filepath)\n {\n if (file_exists($filepath)) {\n\n extract(pathinfo($filepath));\n\n $namespace = (new FileGetContent($filepath))->getNamespace();\n $refClass = new ReflectionClass($namespace.'\\\\'.$filename);\n\n if ($refClass->isAbstract()\n OR $refClass->isInterface()) {\n return null;\n }\n\n return $refClass->newInstanceWithoutConstructor();\n }\n\n throw new ModelNotFound($filename);\n }",
"function build(string $className): object {\n return new $className;\n}",
"abstract public function fileClass();",
"public function &load_class($file_path = null)\n\t\t{\n\t\t\t$class_name = basename($file_path);\n\t\t\t$class_name = ucfirst(strtolower($class_name));\n\t\t\t\n\t\t\tif(self::is_loaded( $class_name ))\n\t\t\t\treturn self::get_class( $class_name );\n\t\t\t\n\t\t\tif(file_exists( APP_PATH. 'core/classes/' .$file_path. '.php' ))\n\t\t\t{\n\t\t\t\trequire_once( APP_PATH. 'core/classes/' .$file_path. '.php' );\n\t\t\t\t\n\t\t\t\tif(class_exists( $class_name ))\n\t\t\t\t{\n\t\t\t\t\tarray_push( self::$loaded, $file_path );\n\t\t\t\t\t\n\t\t\t\t\tself::$classes[$class_name] = new $class_name;\n\t\t\t\t\treturn self::$classes[$class_name];\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"public function createClass();",
"private function _getClass($line) \n {\n $return = false;\n $classes = $this->_getClassMap();\n $lineIsOk = null !== $line && is_string($line) && $line != \"\";\n if ($lineIsOk) {\n foreach ($classes as $cmp) {\n $cmpIsMatch = preg_match(\"/\".$cmp[0].\"/\", $line) == 1;\n if ($cmpIsMatch) {\n $fileName = $cmp[1];\n $classname = ucfirst($cmp[0]);\n try {\n include_once $fileName;\n $return = new $classname(); \n } catch (Exception $e) {\n //throw fileNotFoundException \n }\n } else {\n //we just dont match\n }\n }\n } else {\n //throw UnexpectedFormatException();\n }\n return $return;\n }",
"public static function getObjectFromPackage($strObjectClassPath=NULL) {\r\n\t\t\t$blnContinue = (is_null($strObjectClassPath = trim($strObjectClassPath)) ? false : true);\t\r\n\t\t\tif ((bool) $blnContinue) {\r\n\t\t\t\t// Process the path\r\n\t\t\t\t$strClassIncludePath = __SITE_ROOT__ . DIRECTORY_SEPARATOR . str_replace(array('::', __SITE_ROOT__), array(DIRECTORY_SEPARATOR, ''), strtolower($strObjectClassPath)) . '.php';\r\n\t\t\t\t$arrClassSegments = explode('::', $strObjectClassPath); \r\n\t\t\t\t$strClassName = strtoupper(end($arrClassSegments));\r\n\t\t\t\t$blnContinue = @require_once($strClassIncludePath);\r\n\t\t\t\tif (! $blnContinue) {\r\n\t\t\t\t\tthrow new Exception('Class path: ' . $strObjectClassPath . ' not found. | Include Path: ' . $strClassIncludePath);\t\r\n\t\t\t\t}\r\n\t\t\t\t//$backtrace = debug_backtrace();\r\n\t\t\t\t//print 'included: ' . $strClassIncludePath . ' | <b style=\"color:red\">' . $backtrace[0]['file'] . '</b><br />';\r\n\t\t\t\treturn ($blnContinue);\r\n\t\t\t}\r\n\t\t}",
"public function loadObject($name){\r\n\t\tif (file_exists($this->fileroot.\"/objects/\".$name.\".obj.php\")) {\r\n\t\t\t$className = ucwords($name);\r\n\t\t\trequire_once($this->fileroot.\"/objects/\".$name.\".obj.php\");\r\n\t\t\t$this->$name = new $className;\r\n\t\t}\t\r\n\t\t\r\n\t}",
"function classOf($file)\n{\n\t$src = file_get_contents($file->getRealPath());\n\n\t$namespace = namespaceOf($src);\n\n\t$className = trim($file->getBaseName(), '.' . $file->getExtension());\n\n\tif ($namespace == null)\n\t{\n\t\treturn $className;\n\t}\n\n\treturn $namespace . \"\\\\\" . $className;\n}",
"public function createObject($conf) {\n // if this is a string - it is a class path\n if(is_string($conf)) {\n $conf['class'] = $conf;\n }\n if(!isset($conf['class'])) {\n throw new \\Exception(\"Failed to create a new object because the 'class' is not specified. The requested class configuration is: \".Dumper::dump($conf));\n }\n $options = [];\n // Walk through the array and recusively create nested object if necessary.\n foreach($conf as $key=>$value) {\n if(is_array($value) and isset($options['class'])) {\n $options[$key] = $this->createObject($value);\n } else {\n $options[$key] = $value;\n }\n }\n $class = $options['class'];\n unset($options['class']);\n X::debug('Creating object '.$class);\n return new $class($options);\n }",
"private static function resolveMainClass() {\n\t\t// File that the configuration gave use.\n\t\t$file = self::resolveFile();\n\t\t// Some people may forget to define a main class in the configuration, so we check it.\n\t\tif ($file == null || empty($file)) \n\t \t\tthrow new CoreException(\"Could not resolve main class, no one defined in configuration.\");\n\t \t\n\t\t$aFile = CLASSES_FOLDER . DS . $file . PHP_SUFFIX;\n\t\t\n\t\t// Is the file readable?\n\t\tif (!is_readable($aFile))\n\t\t\tthrow new CoreException(\"Main class isn't readable.\");\n\t\t\n\t\t// Include main class.\n\t\tinclude_once($aFile);\n\t\t\n\t\t// Get the namespace of this class.\n\t\t$namespace = str_replace('/', '\\\\', $file);\n\t\t\n\t\t// Get reflector.\n\t\ttry {\n\t\t\t$reflector = new ReflectionClass($namespace);\n\t\t} catch(Exception $e) {\n\t\t\tthrow new CoreException(\"Class does not exists: \" . $namespace);\n\t\t}\n\t\treturn $reflector;\n\t}",
"function getClassInstance($cval, $cdir = \".\")\n{\n $cdef = explode(\":\", $cval);\n $cname = $cdef[0];\n $cclass = $cdef[1];\n $cinst = null;\n $cfile = \"$cdir/$cname.php\";\n if (file_exists($cfile)) {\n require_once($cfile);\n if (class_exists($cclass)) {\n $cinst = new $cclass();\n }\n }\n if ($cinst == null) {\n die(\"Invalid class definition : \" . $cval);\n }\n return $cinst;\n}",
"private static function instance($path) {\r\n $className = null;\r\n if (!isset(self::$_usedPaths[$path])) {\r\n Eabi_Ipenelo_Calendar::import($path);\r\n $splitClasses = explode('/', $path);\r\n /* @var $splitClasses string */\r\n $className = __CLASS__ . '_' . substr(ucfirst($splitClasses[0]), 0, -1) . '_' . ucfirst($splitClasses[1]);\r\n self::$_usedPaths[$path] = $className;\r\n } else {\r\n //class has been imported\r\n $className = self::$_usedPaths[$path];\r\n }\r\n //return the new instance\r\n //get the arguments\r\n $arguments = array();\r\n\r\n $tmpArgs = func_get_args();\r\n foreach ($tmpArgs as $i => $tmpArg) {\r\n if ($i > 0) {\r\n $arguments[] = $tmpArg;\r\n }\r\n }\r\n\r\n $reflectionMethod = new ReflectionMethod($className, '__construct');\r\n $params = $reflectionMethod->getParameters();\r\n\r\n $constructorArgs = array();\r\n foreach ($params as $key => $param) {\r\n if ($param->isPassedByReference()) {\r\n $constructorArgs[$key] = &$arguments[$key];\r\n } else {\r\n $constructorArgs[$key] = $arguments[$key];\r\n }\r\n }\r\n\r\n //get the class constructor with arguments.\r\n $reflectionClass = new ReflectionClass($className);\r\n return $reflectionClass->newInstanceArgs($constructorArgs);\r\n }",
"public function loadCurrentFile()\n {\n if (!class_exists('File')) {\n throw new ClassNotFoundException('Cannot load class File.');\n }\n $this->file = new File($_SERVER['SCRIPT_FILENAME']);\n Registry::set(new Mystring(\"file\"), $this->file, true, true);\n return $this->file;\n }",
"public static function loadClass($className) {\n\t\ttry {\n\t\t\t\n\t\t\t// Check if class is cached in the factory\n\t\t\tif (array_key_exists($className, VCDClassFactory::$classArray)) {\n\t\t\t\t\treturn VCDClassFactory::$classArray[$className];\n\t\t\t}\n\t\t\t\n\t\t\t// Check if this is a known class ..\n\t\t\tif (class_exists($className)) {\n\t\t\t\treturn new $className;\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\t// Class not found .. check the fetch classes\n\t\t\t\n\t\t\t// Try to include the file ..\n\t\t\t$classPath = \"/fetch/{$className}.php\";\n @include_once(dirname(__FILE__) . $classPath);\n if (class_exists($className)) {\n \treturn new $className;\n } else {\n \treturn null;\n }\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t} catch (Exception $ex) {\n\t\t\tthrow $ex;\n\t\t}\n\t}",
"public function loadClass($class) {}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Return only downloads that have been successfully geolocated
|
function getLocatedDownloads($item, $startDate, $endDate, $limit = 99999)
{
$result = array();
$sql = $this->database->select()
->setIntegrityCheck(false)
->from(array('d' => 'statistics_download'))
->joinLeft(array('ipl' => 'statistics_ip_location'), 'd.ip_location_id = ipl.ip_location_id')
->where('date >= ?', $startDate)
->where('date <= ?', $endDate)
->where('item_id = ?', $item->getKey())
->where('latitude != 0')
->where('latitude != ?', '')
->order('date DESC')
->limit($limit);
$rowset = $this->database->fetchAll($sql);
foreach($rowset as $keyRow => $row)
{
$result[] = $this->initDao('Download', $row, 'statistics');
}
return $result;
}
|
[
"public function isAvailableForDownload();",
"public function getSitesWithGeoInfo() {\n //Note - we remove any site with 0,0 as it's location, as we have no\n //sites in the middle of the pacific ocean. We also remove sites with\n //invaid (too large) longs and lats (these are legacy values, new values\n // entered through the webportal have to be within expected range,\n // historical values may not)\n $dql = \"SELECT s\n FROM Site s\n JOIN s.certificationStatus c\n WHERE s.latitude IS NOT NULL\n AND s.longitude IS NOT NULL\n AND c.name != 'Closed'\n AND (s.latitude != 0 OR s.longitude != 0)\n AND s.latitude <= 90\n AND s.latitude >= -90\n AND s.longitude <= 180\n AND s.longitude >= -180\";\n\n $sites = $this->em\n ->createQuery($dql)\n ->getResult();\n\n return $sites;\n }",
"function canDownload(){\n \n $lizenz = $this -> data;\n \n $date = $lizenz -> lizenz_until;\n if(time() > $date){\n return array('access' => false, 'reason' => \"Die Downloads sind zeitlich abgelaufen.\");\n }\n // Zuviele Downloads\n if($lizenz -> lizenz_downloads >= variable_get('lk_vku_max_download')){\n return array('access' => false, 'reason' => \"Die Maximalanzahl der Downloads wurde erreicht.\");\n }\n\n return array('access' => true);\n }",
"private function getLocationList() {\n\t\t// Initiate curl\n\t\t$ch = curl_init();\n\t\t// Disable SSL verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\t// Will return the response, if false it print the response\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\t// Set the url\n\t\tcurl_setopt($ch, CURLOPT_URL, self::BASE_URL);\n\t\t// Execute\n\t\t$result = curl_exec($ch);\n\t\t// Closing\n\t\tcurl_close($ch);\n\n\t\t$rs = json_decode($result, true);\n\t\t$this->success = ($rs['statusCode'] == 200) ? true : false;\n\n\t\tif(!$this->success)\n\t\t\treturn array();\n\n\t\treturn $rs['data'];\n\t}",
"function download_locations_csv() {\n\t\t$this->slplus->set_php_timeout();\n\n\n\t\t$this->addon->create_CSVLocationExporter();\n\t\t$this->addon->csvExporter->do_SendFile();\n\t}",
"function getAllUnlocated()\n {\n $result = array();\n $sql = $this->database->select()\n ->setIntegrityCheck(false)\n ->from(array('e' => 'statistics_ip_location'))\n ->where('latitude = ?', '');\n $rowset = $this->database->fetchAll($sql);\n foreach($rowset as $keyRow => $row)\n {\n $result[] = $this->initDao('IpLocation', $row, 'statistics');\n }\n return $result;\n }",
"function getFailedGeos() {\n\t\t$sql = 'SELECT * FROM member_user where geo_status = 2 limit 100';\n\t\t$result = mysql_query( $sql );\n\t\t$num_rows = mysql_num_rows( $result );\n\t\techo ' First ' . $num_rows . ' of failed geos <br>';\n\t\twhile ( $row = mysql_fetch_array( $result ) ) {\n\t\t\t$member_id = $row['id'];\n\t\t\t$address = $row['billing_address1'] . ',' . $row['billing_address2'] . ',' . $row['billing_address3'] . ',' . $row['billing_postalcode'];\n\t\t\t$address = str_replace( ',,', ',', $address );\n\t\t\t$lon = $row['lon'];\n\t\t\t$lat = $row['lat'];\n\t\t\techo '<hr> member id : ' . $member_id . ' Name:' . $row['firstname'] . ' ' . $row['surname'];\n\t\t\techo '<br>' . $address;\n\t\t}\n\t}",
"public function chunked_download_check() {\n\t\t$unfinished_downloads = $this->wpdb->get_var(' SELECT COUNT(*) FROM `' . $this->wpdb->base_prefix . 'wptc_processed_restored_files` WHERE `offset` > 0 ');\n\t\tif ($unfinished_downloads > 0) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"function getListingsLoc( $coordinates = false, $distance = false )\n\t{\n\t\tglobal $config;\n\n\t\tif ( $coordinates['lat'] == '' || $coordinates['lng'] == '' || !$distance )\n\t\t\treturn;\n\n\t\t$GLOBALS['rlValid'] -> sql($coordinates);\n\n\t\t$sql = \"SELECT SQL_CALC_FOUND_ROWS DISTINCT `T1`.`Loc_latitude`, `T1`.`Loc_longitude`, `T1`.`ID` \";\n\t\t$sql .= \"FROM `\" . RL_DBPREFIX . \"listings` AS `T1` \";\n\t\t$sql .= \"LEFT JOIN `\" . RL_DBPREFIX . \"listing_plans` AS `T2` ON `T1`.`Plan_ID` = `T2`.`ID` \";\n\t\t$sql .= \"LEFT JOIN `\" . RL_DBPREFIX . \"categories` AS `T3` ON `T1`.`Category_ID` = `T3`.`ID` \";\n\t\t$sql .= \"LEFT JOIN `\" . RL_DBPREFIX . \"accounts` AS `T7` ON `T1`.`Account_ID` = `T7`.`ID` \";\n\t\t$sql .= \"WHERE ( UNIX_TIMESTAMP(DATE_ADD(`T1`.`Pay_date`, INTERVAL `T2`.`Listing_period` DAY)) > UNIX_TIMESTAMP(NOW()) OR `T2`.`Listing_period` = 0 ) \";\n\n\t\t$sql .= \"AND (3956 * 2 * ASIN(SQRT(\n\t\t\t\tPOWER(SIN(({$coordinates['lat']} - `T1`.`Loc_latitude`) * 0.0174532925 / 2), 2) +\n\t\t\t\tCOS({$coordinates['lat']} * 0.0174532925) *\n\t\t\t\tCOS(`T1`.`Loc_latitude` * 0.0174532925) *\n\t\t\t\tPOWER(SIN(({$coordinates['lng']} - `T1`.`Loc_longitude`) * 0.0174532925 / 2), 2))) <= {$distance}) \";\n\n\t\t$sql .= \"AND `T1`.`Status` = 'active' AND `T3`.`Status` = 'active' AND `T7`.`Status` = 'active' \";\n\t\t$sql .= \"GROUP BY `T1`.`ID` \";\n\t\t$sql .= \"LIMIT 0, {$config['sbd_listings_limit']} \";\n\n\t\t$listings = $this -> getAll($sql);\n\n\t\t$calc = $this -> getRow( \"SELECT FOUND_ROWS() AS `calc`\" );\n\t\t$this -> calc = $calc['calc'];\n\n\t\treturn $listings;\n\t}",
"public function getHasDownloads()\n {\n return $this->hasDownloads;\n }",
"public function chunked_download_check() {\n\t\tglobal $wpdb;\n\t\t//$unfinished_downloads = $wpdb->get_var('SELECT COUNT(*) FROM `' . $wpdb->base_prefix . 'wptc_processed_restored_files` WHERE `uploaded_file_size`!=`offset` AND `uploaded_file_size` > 4024000');\n\t\t$unfinished_downloads = $wpdb->get_var(' SELECT COUNT(*) FROM `' . $wpdb->base_prefix . 'wptc_processed_restored_files` WHERE `offset` > 0 ');\n\t\tif ($unfinished_downloads > 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"function get_zone_links($czds_base_url){\n global $access_token;\n\n $links_url = $czds_base_url . \"/czds/downloads/links\";\n $links_response = do_get($links_url, $access_token);\n\n $status_code = $links_response['info']['http_code'];\n\n if($status_code == 200){\n $zone_links = json_decode($links_response['result'],true);\n echo now().\": The number of zone files to be downloaded is \".count($zone_links).PHP_EOL;\n return $zone_links;\n }elseif($status_code == 401){\n global $username, $password, $authen_base_url;\n echo \"The access_token has been expired. Re-authenticate user $username\".PHP_EOL;\n $access_token = authenticate($username, $password, $authen_base_url);\n return get_zone_links($czds_base_url);\n }else{\n echo \"Failed to get zone links from $links_url with error code $status_code\".PHP_EOL;\n return false;\n }\n}",
"public function hasDownloads()\n\t{\n\t\t// Cache downloads if not yet done\n\t\t$this->getDownloads();\n\n\t\treturn !empty($this->arrDownloads);\n\t}",
"public function isDownloadRunning()\n\t{\n\t\treturn(SERVER_runningInBackground('downloadPoolPackages'));\n\t}",
"function getTweetsByGPS($latitude, $longitude, $radius) {\n\t$page = 1;\n\t$rpp = 100;\n\t$query = \"http://search.twitter.com/search.json?q=&page=$page&rpp=$rpp&geocode=$latitude,$longitude,$radius\" . 'mi';\n\t$response = file_get_contents($query);\n\t$tweets = json_decode($response, true);\n\t$results = array();\n\tfor($i = 0; $i < count($tweets['results']); $i++)\n\t\tarray_push($results, $tweets['results'][$i]['text']);\t\n\treturn $results;\n}",
"public function allDownloaded(){\n\t\t$downloadPath = DOWNLOAD_PATH . DIRECTORY_SEPARATOR;\n\t\t$fullDownloadPath = $downloadPath . $this->video->getFilename() . $this->video->getFileExtension();\n\n\t\t// If the thumbnail has not been downloaded, go ahead and download it\n\t\tif(!file_exists($downloadPath . $this->video->getThumbnailFilename())){\n\t\t\t$this->downloadThumbnail();\n\t\t}\n\t\t// If the mp3 check if the mp3 has a duration that is not null\n\t\tif(file_exists($fullDownloadPath) && SupportedSite::getDuration($fullDownloadPath)){\n\t\t\t// Before returning true, set the duration since convert will not be run\n\t\t\t$this->video->setDuration(SupportedSite::getDurationSeconds($fullDownloadPath));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t// If all else fails, return false\n\t\treturn false;\n\t}",
"public function getLocations()\n\t{\n\t\t// Check the rate limit for remaining hits\n\t\t$this->checkRateLimit('trends', 'available');\n\n\t\t// Set the API path\n\t\t$path = '/trends/available.json';\n\n\t\t// Send the request.\n\t\treturn $this->sendRequest($path);\n\t}",
"private function fetchStreamGps()\n {\n // init\n $server = Config::get('constants.API_SERVER');\n $api = '/Projects/Services/GPSServices.svc/GetTrackerDevCrossTable';\n $service = $server . $api;\n\n $cacheKey = 'gps_trackers';\n $expire = 0.5; // minute\n\n // exec\n $result = Cache::remember($cacheKey, $expire, function() use ($service) {\n // invoke remote service\n $resource = file_get_contents($service);\n $data = json_decode($resource);\n\n return $data;\n });\n\n // clear cache if the result is bad\n if (!$result) {\n Cache::forget($cacheKey);\n }\n\n return $result;\n }",
"public function isDownloaded()\n {\n return file_exists($this->getMageFilename()) && file_exists($this->getVarFilename());\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Define the required plugin constants
|
public function define_constants()
{
define('PLUGIN_VERSION', self::version);
define('PLUGIN_FILE', __FILE__);
define('PLUGIN_PATH', __DIR__);
define('PLUGIN_URL', plugins_url('', PLUGIN_FILE));
define('PLUGIN_ASSETS', PLUGIN_URL . '/assets');
}
|
[
"public function setup_constants() {\n\n // Plugin version\n if ( ! defined( 'LEARNDASH_MUVI_VERSION' ) ) {\n define( 'LEARNDASH_MUVI_VERSION', '1.2' );\n }\n\n // Plugin text domain\n if ( ! defined( 'LEARNDASH_MUVI_DOMAIN' ) ) {\n define( 'LEARNDASH_MUVI_DOMAIN', 'learndash-muvi' );\n }\n \n // Plugin file\n if ( ! defined( 'LEARNDASH_MUVI_FILE' ) ) {\n define( 'LEARNDASH_MUVI_FILE', __FILE__ );\n }\t\t\n\n // Plugin folder path\n if ( ! defined( 'LEARNDASH_MUVI_PLUGIN_PATH' ) ) {\n define( 'LEARNDASH_MUVI_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );\n }\n\n // Plugin folder URL\n if ( ! defined( 'LEARNDASH_MUVI_PLUGIN_URL' ) ) {\n define( 'LEARNDASH_MUVI_PLUGIN_URL', plugin_dir_url( __FILE__ ) );\n }\n }",
"public function constants() {\n\n\t\t/* Set constant path to the plugin directory. */\n\t\tdefine( 'SKUKKAKAUPPA_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );\n\t\t\n\t\t/* Set constant path to the plugin directory. */\n\t\tdefine( 'SKUKKAKAUPPA_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );\n\n\t\t/* Set the constant path to the includes directory. */\n\t\tdefine( 'SKUKKAKAUPPA_PLUGIN_INCLUDES', SKUKKAKAUPPA_PLUGIN_DIR . trailingslashit( 'includes' ) );\n\n\t}",
"private function define_constants()\n\t\t{\n\t\t\tdefine('WOOCONNECTOR_PLUGIN_FILE', __FILE__);\n\t\t\tdefine('WOOCONNECTOR_ABSPATH', dirname(__FILE__) . '/');\n\t\t\tdefine('WOOCONNECTOR_PLUGIN_BASENAME', plugin_basename(__FILE__));\n\t\t\tdefine('WOOCONNECTOR_VERSION', $this->version);\n\t\t}",
"private function define_constants() {\n\t\t\t// Plugin Version\n\t\t\tif ( ! defined( 'AF_VERSION' ) ) {\n\t\t\t\tdefine( 'AF_VERSION', '1.0.0' );\n\t\t\t}\n\t\t\t// Prefix\n\t\t\tif ( ! defined( 'AF_PREFIX' ) ) {\n\t\t\t\tdefine( 'AF_PREFIX', 'af_' );\n\t\t\t}\n\t\t\t// Textdomain\n\t\t\tif ( ! defined( 'AF_TEXTDOMAIN' ) ) {\n\t\t\t\tdefine( 'AF_TEXTDOMAIN', 'af' );\n\t\t\t}\n\t\t\t// Plugin Options\n\t\t\tif ( ! defined( 'AF_OPTIONS' ) ) {\n\t\t\t\tdefine( 'AF_OPTIONS', 'af-options' );\n\t\t\t}\n\t\t\t// Plugin Directory\n\t\t\tif ( ! defined( 'AF_PLUGIN_DIR' ) ) {\n\t\t\t\tdefine( 'AF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );\n\t\t\t}\n\t\t\t// Plugin URL\n\t\t\tif ( ! defined( 'AF_PLUGIN_URL' ) ) {\n\t\t\t\tdefine( 'AF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );\n\t\t\t}\n\t\t\t// Plugin Root File\n\t\t\tif ( ! defined( 'AF_PLUGIN_FILE' ) ) {\n\t\t\t\tdefine( 'AF_PLUGIN_FILE', __FILE__ );\n\t\t\t}\n\t\t}",
"protected function setConstants() {\n\n\t\t$version = $this->getHeader( 'version' ) ?? false;\n\t\t$prefix = $this->getHeader( 'plugin_prefix' );\n\n\t\tif ( ! defined( \"{$prefix}_VERSION\" ) ) {\n\t\t\tdefine( \"{$prefix}_VERSION\", $version );\n\t\t}\n\n\t\tif ( ! defined( \"{$prefix}_PLUGIN_FILE\" ) ) {\n\t\t\tdefine( \"{$prefix}_PLUGIN_FILE\", $this->filePath );\n\t\t}\n\n\t\tif ( ! defined( \"{$prefix}_PLUGIN_BASE\" ) ) {\n\t\t\tdefine( \"{$prefix}_PLUGIN_BASE\", plugin_basename( constant( \"{$prefix}_PLUGIN_FILE\" ) ) );\n\t\t}\n\n\t\tif ( ! defined( \"{$prefix}_PLUGIN_DIR\" ) ) {\n\t\t\tdefine( \"{$prefix}_PLUGIN_DIR\", plugin_dir_path( constant( \"{$prefix}_PLUGIN_FILE\" ) ) );\n\t\t}\n\n\t\tif ( ! defined( \"{$prefix}_PLUGIN_URL\" ) ) {\n\t\t\tdefine( \"{$prefix}_PLUGIN_URL\", plugin_dir_url( constant( \"{$prefix}_PLUGIN_FILE\" ) ) );\n\t\t}\n\t}",
"private function define_constants() \n {\n define( 'PH_TEMPLATE_ASSISTANT_PLUGIN_FILE', __FILE__ );\n define( 'PH_TEMPLATE_ASSISTANT_VERSION', $this->version );\n }",
"public function setup_constants() {\n\n\t\t// Plugin version\n\t\tif ( ! defined( 'LEARNDASH_NOTIFICATIONS_VERSION' ) ) {\n\t\t\tdefine( 'LEARNDASH_NOTIFICATIONS_VERSION', '1.1.0' );\n\t\t}\n\n\t\t// Plugin file\n\t\tif ( ! defined( 'LEARNDASH_NOTIFICATIONS_FILE' ) ) {\n\t\t\tdefine( 'LEARNDASH_NOTIFICATIONS_FILE', __FILE__ );\n\t\t}\t\t\n\n\t\t// Plugin folder path\n\t\tif ( ! defined( 'LEARNDASH_NOTIFICATIONS_PLUGIN_PATH' ) ) {\n\t\t\tdefine( 'LEARNDASH_NOTIFICATIONS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );\n\t\t}\n\n\t\t// Plugin folder URL\n\t\tif ( ! defined( 'LEARNDASH_NOTIFICATIONS_PLUGIN_URL' ) ) {\n\t\t\tdefine( 'LEARNDASH_NOTIFICATIONS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );\n\t\t}\n\t}",
"private function define_constants() \n {\n define( 'PH_PROPERTYIMPORT_SSPC_PLUGIN_FILE', __FILE__ );\n define( 'PH_PROPERTYIMPORT_SSPC_VERSION', $this->version );\n }",
"private function set_plugin_constants() {\n\t\t// Path/URL to root of this plugin, with trailing slash.\n\t\tif ( ! defined( 'TF_DI_PATH' ) ) {\n\t\t\tdefine( 'TF_DI_PATH', plugin_dir_path( __FILE__ ) );\n\t\t}\n\t\tif ( ! defined( 'TF_DI_URL' ) ) {\n\t\t\tdefine( 'TF_DI_URL', plugin_dir_url( __FILE__ ) );\n\t\t}\n\n\t\t// Action hook to set the plugin version constant.\n\t\tadd_action( 'admin_init', array( $this, 'set_plugin_version_constant' ) );\n\t}",
"public function constants() {\n\n /* Set constant path to the plugin directory. */\n define( 'PTF_ADDONS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );\n\n /* Set the constant path to the plugin directory URI. */\n define( 'PTF_ADDONS_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );\n\n /* Set the constant path to the includes directory. */\n define( 'PTF_ADDONS_INCLUDES', PTF_ADDONS_DIR . trailingslashit( 'includes' ) );\n \n }",
"private function set_plugin_constants() {\n\t\t// Path/URL to root of this plugin, with trailing slash.\n\t\tif ( ! defined( 'PT_OCDI_PATH' ) ) {\n\t\t\tdefine( 'PT_OCDI_PATH', plugin_dir_path( __FILE__ ) );\n\t\t}\n\t\tif ( ! defined( 'PT_OCDI_URL' ) ) {\n\t\t\tdefine( 'PT_OCDI_URL', plugin_dir_url( __FILE__ ) );\n\t\t}\n\n\t\t// Action hook to set the plugin version constant.\n\t\tadd_action( 'admin_init', array( $this, 'set_plugin_version_constant' ) );\n\t}",
"public function setup_constants() {\n\n\t\t\t$this->define( 'ENVIRA_VERSION', $this->version );\n\t\t\t$this->define( 'ENVIRA_SLUG', $this->plugin_slug );\n\t\t\t$this->define( 'ENVIRA_FILE', $this->file );\n\t\t\t$this->define( 'ENVIRA_DIR', plugin_dir_path( __FILE__ ) );\n\t\t\t$this->define( 'ENVIRA_URL', plugin_dir_url( __FILE__ ) );\n\n\t\t}",
"private function define_constants()\n {\n $this->define( 'ED_RP_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__) );\n }",
"private function setup_constants() {\r\n\t\t$this->define( 'WPOS_ESPBW_VERSION', '1.0' );\r\n\t\t$this->define( 'WPOS_ESPBW_DIR', plugin_dir_path( __FILE__ ) );\r\n\t\t$this->define( 'WPOS_ESPBW_URL', plugin_dir_url( __FILE__ ) );\r\n\t}",
"private function define_constants()\n\t{\n\t\tdefine('MOBICONNECTOR_PLUGIN_FILE', __FILE__);\n\t\tdefine('MOBICONNECTOR_ABSPATH', dirname(__FILE__) . '/');\n\t\tdefine('MOBICONNECTOR_PLUGIN_BASENAME', plugin_basename(__FILE__));\n\t\tdefine('MOBICONNECTOR_VERSION', $this->version);\n\t\tdefine('MOBICONNECTOR_ADMIN_PATH', ABSPATH . 'wp-admin/');\n\t\tdefine('MOBICONNECTOR_EXTENSIONS_PATH', dirname(__FILE__) . '/extensions/');\n\t\tdefine('MOBICONNECTOR_AJAX_URL', admin_url('admin-ajax.php'));\n\t}",
"private function define_constants() {\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_PLUGIN_URL', plugin_dir_url(__FILE__));\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_PLUGIN_FILE', __FILE__ );\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_VERSION', $this->version );\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_IMAGES_PATH', $this->plugin_path(). DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR );\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_IMAGES_URL', untrailingslashit($this->plugin_url() . '/assets/images/' ));\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_TEMPLATES_PATH', $this->plugin_path() . DIRECTORY_SEPARATOR . 'templates');\n $this->define( 'ORIGINCODE_GALLERY_VIDEO_TEMPLATES_URL', untrailingslashit($this->plugin_url()) . '/templates/');\n }",
"private function define_constants()\n {\n }",
"private function define_constants() {\n\t\tglobal $wp_version;\n\n\t\tdefined( 'OMISE_WOOCOMMERCE_PLUGIN_VERSION' ) || define( 'OMISE_WOOCOMMERCE_PLUGIN_VERSION', $this->version );\n\t\tdefined( 'OMISE_PUBLIC_KEY' ) || define( 'OMISE_PUBLIC_KEY', $this->settings()->public_key() );\n\t\tdefined( 'OMISE_SECRET_KEY' ) || define( 'OMISE_SECRET_KEY', $this->settings()->secret_key() );\n\t\tdefined( 'OMISE_API_VERSION' ) || define( 'OMISE_API_VERSION', '2017-11-02' );\n\t\tdefined( 'OMISE_USER_AGENT_SUFFIX' ) || define( 'OMISE_USER_AGENT_SUFFIX', sprintf( 'OmiseWooCommerce/%s WordPress/%s WooCommerce/%s', OMISE_WOOCOMMERCE_PLUGIN_VERSION, $wp_version, WC()->version ) );\n\t}",
"private function define_constants(){\n\t\t\t$this->define('WC_WALLEE_PLUGIN_FILE', __FILE__);\n\t\t\t$this->define('WC_WALLEE_ABSPATH', dirname(__FILE__) . '/');\n\t\t\t$this->define('WC_WALLEE_PLUGIN_BASENAME', plugin_basename(__FILE__));\n\t\t\t$this->define('WC_WALLEE_VERSION', $this->version);\n\t\t\t$this->define('WC_WALLEE_REQUIRED_PHP_VERSION', '5.6');\n\t\t\t$this->define('WC_WALLEE_REQUIRED_WP_VERSION', '4.4');\n\t\t\t$this->define('WC_WALLEE_REQUIRED_WC_VERSION', '3.0');\n\t\t}",
"protected function define_constants(){\n\t\t\t$this->define('WC_WALLEE_PLUGIN_FILE', __FILE__);\n\t\t\t$this->define('WC_WALLEE_ABSPATH', dirname(__FILE__) . '/');\n\t\t\t$this->define('WC_WALLEE_PLUGIN_BASENAME', plugin_basename(__FILE__));\n\t\t\t$this->define('WC_WALLEE_VERSION', $this->version);\n\t\t\t$this->define('WC_WALLEE_REQUIRED_PHP_VERSION', '5.6');\n\t\t\t$this->define('WC_WALLEE_REQUIRED_WP_VERSION', '4.7');\n\t\t\t$this->define('WC_WALLEE_REQUIRED_WC_VERSION', '3.0');\n\t\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Check if the answer is correct by checking the question database Returns 1 if the provided task ID is not a question or is not found Otherwise returns 0 if incorrect and 1 if correct
|
function checkAnswer($id, $answer_string, $case_insensitive = 0)
{
require "db/main_db_open.php";
// Search the task database for the given ID
//$query = "SELECT * FROM tasks WHERE id='" . $id . "';";
//$result = mysql_query($query);
//if(mysql_numrows($result) == 1)
//$task_type = mysql_result($result, 0, "task_type");
//$task_id = mysql_result($result, 0, "task_id");
$task_id = getTaskID($id);
$task_type = getTaskType($id);
// If the task is founc and is a question
if($task_id != 0 && !strcmp($task_type,'Q'))
{
$query = "SELECT * FROM questions WHERE id='" . $task_id . "';";
$result = mysql_query($query);
if(mysql_numrows($result) == 1)
{
// Collect and parse the database answer and the user's answer
if ($case_insensitive == 0)
{
$correct_answer = parseCLine(htmlentities(mysql_result($result, 0, "answer")));
$user_answer = parseCLine(htmlentities($answer_string));
}
else if ($case_insensitive == 1) // If the case insensitive flag is set, check the answer disregarding case
{
$correct_answer = parseCLine(strtoupper(htmlentities(mysql_result($result, 0, "answer"))));
$user_answer = parseCLine(strtoupper(htmlentities($answer_string)));
}
// If the users answer matches the correct answer
if (arrayEqual($user_answer, $correct_answer))
return 1;
else
return 0;
}
}
else
return (-1);
require "db/main_db_close.php";
}
|
[
"public function isAnswered()\n {\n $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);\n $result = Database::select(\n 'question_id',\n $table,\n array(\n 'where' => array(\n 'question_id = ? AND c_id = ?' => array(\n $this->id,\n $this->course['real_id']\n )\n )\n )\n );\n\n return empty($result) ? false : true;\n }",
"public function isUserAnswerIsCorrect();",
"public function correct_answer() {\n\t\t$the_answer = $this->_get_answer( $_POST['question_id'] );\n\t\t$the_question = $this->_get_question( $_POST['question_id'] );\n\t\t\n\t\techo '<div class=\"message correct-answer\">Correct! <strong>' . $the_question . '</strong> does indeed mean \"<strong>' . $the_answer . '</strong>\"</div>';\n\t}",
"function checkQuestions(){\n\t\t$results = $this->getUncheckedQuestions();\n\t\tforeach($results as $r){\n\t\t\t$kuponquestion_id = $r['id'];\n\t\t\t$questionid = $r['question_id'];\n\t\t\t$answered = $r['answer_id'];\n\t\t\t$question = new questions($questionid);\n\t\t\t$correctanswer = $question->correct_answer_id;\n\n\t\t\tif ($correctanswer != 0){\t\n\t\t\t\t// question won\n\t\t\t\tif ($correctanswer == $answered){ \n\t\t\t\t\t$this->setQuestionChecked($kuponquestion_id, 1);\n\t\t\t\t\t$this->increaseQuestionsWon();\n\t\t\t\t}\n\t\t\t\t// match lost\n\t\t\t\telse{\n\t\t\t\t\t$this->setQuestionChecked($kuponquestion_id, 2);\n\t\t\t\t\t$this->increaseQuestionsLost();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t$this->update();\n\t}",
"public function preparedQuestionHasTheAppropriateAnswer(): void\n {\n\n QuestionUserHelper::removeAllQuestionsForUser($this->user);\n QuestionUserHelper::createScheduledQuestionForUser($this->user);\n\n /** @var Question $question */\n $question = $this->user->randomUserQuestion()->first();\n $question = $question->preparedForView();\n\n $expectedAnswer = $question->answer()->first();\n\n $this->assertNotNull($expectedAnswer);\n\n $this->assertEquals($question['answer'], $expectedAnswer->wording);\n }",
"function check($answer, $lan_id){\n if(!isset($this->solution[$lan_id])){\n echo \"<p class='error'>Solution for language \".$lan_id.\" not defined in question \".$this->name.\"</p>\";\n return 0;\n } \n\t //MAJOR BUGFIX!!!\n if (!$this->skipped && in_array($answer,explode('#',$this->solution[$lan_id])) )\n\t {\n\n \t //echo $answer .' == '. $this->solution[$lan_id].' lan='.$lan_id. ' p='.$this->points.'<br />';\n \t return $this->points; \n }\n\t else \n\t {\n \t//if($lan_id == 3) echo 'faux: '.$answer.'<br/>';\n\t\t//echo $answer .' != '. $this->solution[$lan_id]. ' lan='.$lan_id.'<br />';\n \treturn 0;\n\n }\n }",
"public function checkAnswerById($id = false) {\n\t\t\t// Database Connection\n\t\t\t$db\t\t\t\t= $GLOBALS['db_q'];\n\t\t\t// Variables\n\t\t\t$return\t\t\t= false;\n\t\t\t// Query set up\t\n\t\t\t$row\t\t\t= ($id) ? $db->getRow('tb_answer', 'boo_correct', \"id = {$id}\") : false;\n\t\t\tif ($row['boo_correct'] == 1) {\n\t\t\t\t$return\t\t= true;\n\t\t\t}\n\t\t\t// Return\n\t\t\treturn $return;\n\t\t}",
"function _isUsedInRandomTest($question_id = \"\")\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\tif ($question_id < 1) return 0;\n\t\t$result = $ilDB->queryF(\"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE question_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($question_id)\n\t\t);\n\t\treturn $result->numRows();\n\t}",
"function check_answer_validity( $word_id, $answer )\n\t{\n\t\tglobal $template, $words;\n\t\t\n\t\t$validity = $words->check_validity( $_SESSION['fc']['questions'][$answer_index][0], $answer, 'ru' );\n\t\treturn ( $validity );\n\t}",
"function checkTranslateAnswer() {\n\tglobal $questions;\n\tglobal $correct;\n\t$translateAnswer = strtolower($_POST[\"txtTranslate\"]);\n\t\n\t// A regex allowing spaces, apostrophes, lowercase and uppercase letters.\n\t$lettersSpaces = \"/^[a-zA-Z-' ]+$/\";\n\n\t// A regex that allows spaces or no inputs.\n\t$spacesOrNoInput = \"/^ *$/\";\n\t\n\tif (in_array($translateAnswer, $questions[$questionOrderIndex][1])) {\n\t\tob_end_clean();\n\t\techo \"<script> alert('Correct') </script>\";\n\t\t$correct++;\n\t} else if (preg_match($spacesOrNoInput, $translateAnswer)) {\n\t\techo \"Enter an answer\";\n\t\treturn false;\n\t} else if (!preg_match($lettersSpaces, $translateAnswer)) {\n\t\techo \"Enter letters only.\";\n\t\treturn false;\n\t} else {\n\t\tob_end_clean();\n\t\techo $questionOrderIndex;\n\t\techo $questionsAnswered;\n\t\techo \"<script> alert('Incorrect') </script>\";\n\t}\n\t\n\t$questionOrderIndex++;\n\t$questionsAnswered++;\n\tprogressNextQuestion();\n}",
"function isInUse($question_id)\n\t{\n\t\tglobal $ilDB;\n\t\t// check out the already answered questions\n\t\t$result = $ilDB->queryF(\"SELECT answer_id FROM svy_answer WHERE question_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($question_id)\n\t\t);\n\t\t$answered = $result->numRows();\n\t\t\n\t\t// check out the questions inserted in surveys\n\t\t$result = $ilDB->queryF(\"SELECT svy_svy.* FROM svy_svy, svy_svy_qst WHERE svy_svy_qst.survey_fi = svy_svy.survey_id AND svy_svy_qst.question_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($question_id)\n\t\t);\n\t\t$inserted = $result->numRows();\n\t\tif (($inserted + $answered) == 0)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t$result_array = array();\n\t\twhile ($row = $ilDB->fetchObject($result))\n\t\t{\n\t\t\tarray_push($result_array, $row);\n\t\t}\n\t\treturn $result_array;\n\t}",
"function check($answer, $lan_id){\n if($this->skipped) return 0;\n if(!isset($this->solution[$lan_id])){\n $_SESSION['error_message'].=\"Solution for language \".$lan_id.\" not defined in question \".$this->name.\"<br>\";\n echo \"<p class='error'>Solution for language \".$lan_id.\" not defined in question \".$this->name.\"</p>\";\n return 0;\n }\n foreach($this->solution[$lan_id] as $v){\n if(strlen($answer)!=strlen($v)){\n $_SESSION['error_message'].=\"Solution for language \".$lan_id.\" and answer have unequal lengthin question \".$this->name.\"<br>\";\n echo \"<p class='error'>Solution for language \".$lan_id.\" not defined in question \".$this->name.\"</p>\";\n return 0;\n }\n }\n $maximum=0;\n foreach($this->solution[$lan_id] as $v){\n $t=0;\n for($q=0; $q<$this->type_specific_info; ++$q) if($answer{$q}==$v{$q}) ++$t;\n if($t>$maximum) $maximum=$t;\n }\n if($maximum==0) return 0;\n else return 0.2 + 0.8*($maximum-1)/($this->type_specific_info-1);\n }",
"public function isSolved() {\n // !!! PREROBIT; docasne spravene cez builder, kym nemam class Answer\n return DB::table('answers')->where('test_id', $this->id)->first() != null;\n }",
"function checkTaskDone($taskId)\n{\n\t\n\t//try to get it from the done tasks table \n\t$req = \"SELECT * FROM doneTasks WHERE taskId = '$taskId'\";\n\t$result = mysql_query($req);\n\n\t//if the task with required id not been done yet - return false\n\tif(mysql_numrows($result) == 0)\n\t{\n\t\treturn false;\n\t}\n\treturn true;\n\t\n}",
"public function hasToBeAnswered($task_id, $field_id){\n\n $qb = $this->createQueryBuilder('t')\n ->select('COUNT(1) AS nb')\n ->innerJoin('t.fields', 'f')\n ->where('t.id = :task_id')\n ->andWhere('f.id = :field_id')\n ->setParameter(':task_id', $task_id)\n ->setParameter(':field_id', $field_id)\n ->getQuery();\n\n return $qb->getSingleScalarResult() == 1;\n\n }",
"public function getNumOfCorrectSaved($question_id){\n return Answers::where('id_question','=',$question_id)->sum('correct');\n }",
"public function check_answer($answer) {\n $attrs = $this->_orm->attributes_as_array();\n $answer_attr = $attrs[0];\n $expected_answer = $answer_attr['attribute_value'];\n return serialize($answer) == $expected_answer;\n }",
"public function check($answer)\n {\n $success = ($answer == $this->CI->session->userdata('captha_sol')) ? TRUE : FALSE;\n $this->CI->session->unset_userdata('captha_sol');\n return $success;\n }",
"function test_response(&$question, &$state, $answer) {\r\n\t//fix answer\r\n global $CFG;\r\n\t\t//$query = \"SELECT answer, fraction, feedback FROM {$CFG->prefix}question_answers WHERE question = $question->id\";\r\n $htmlanswers = get_records('question_answers', 'question', $question->id);\r\n\t\t//$result=mysql_query($query);\r\n $isrightanswer=0;\r\n //while ($answerhtml=mysql_fetch_array($result)) {\r\n foreach ($htmlanswers as $answerhtml) {\r\n\t\t\t$statevars = isset($state->vars) ? $state->vars : '';\r\n //the next line creates problems with regrade method of the quiz. To avoid it, $answer->answer was changed to $answerhtml['answer']\r\n //fix answer\r\n \t\t $answer->answer=qtype_phnumerical_functions::strip_math_html($answerhtml->answer, 99, $statevars, $question->id, $state->attempt);\r\n // Deal with the match anything answer.\r\n if ($answer->answer == '*') {\r\n return true;\r\n }\r\n $response = $state->responses[''];\r\n if ($response === false || !is_numeric(trim($response))) {\r\n return false; // The student did not type a number.\r\n }\r\n\r\n // The student did type a number, so check it with tolerances.\r\n $this->get_tolerance_interval($answer);\r\n\r\n //return ($answer->min <= $response && $response <= $answer->max);\r\n //added multi answer support\r\n if ($answer->min <= $response && $response <= $answer->max) {\r\n $isrightanswer++;\r\n $answer->feedback=$answerhtml->feedback;\r\n $answer->fraction=$answerhtml->fraction;\r\n break;\r\n }\r\n }\r\n\r\n return $isrightanswer;\r\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Set default redirect URL
|
public function set_default_url( $url = NULL ) {
$this->redirectUrl = $url;
}
|
[
"private function setRedirectUrl()\n {\n $redirectTemplate = $this->getConfig('redirect_template');\n if (empty($redirectTemplate)) {\n return;\n }\n\n $redirect = str_replace('{policy}', $this->getPolicy(), $redirectTemplate);\n\n $url = Str::startsWith($redirect, '/')\n ? URL::to($redirect)\n : $redirect;\n\n $this->redirectUrl($url);\n }",
"protected function initialRedirectUrl() {\n\n $defaultUrl = '/'. $this->controller->id . '/' . $this->controller->defaultAction;\n\n if (isset($this->controller->module->id) && !$this->controller->module instanceof Application) {\n $defaultUrl = '/' . $this->controller->module->id . $defaultUrl;\n }\n\n if ( empty( $this->successUrl ) ) {\n $this->successUrl = $defaultUrl;\n }\n\n if ( empty( $this->failedUrl ) ) {\n $this->failedUrl = $defaultUrl;\n }\n\n }",
"public function setDefaultRedirect($defaultRedirect){\n\t\t$this->_defaultRedirect = $defaultRedirect;\n\t}",
"public function ext_admin_setting_redirect_url_default() {\n $options = get_option($this->get_options_name());\n if ( !array_key_exists(\"coe_gal_ext_redirect_url_default\", $options)) {\n $options[\"coe_gal_ext_redirect_url_default\"] = get_site_url();\n }\n echo \"<input id='coe_gal_ext_redirect_url_default' name='\".$this->get_options_name().\"[coe_gal_ext_redirect_url_default]' size='40' type='text' value='{$options['coe_gal_ext_redirect_url_default']}' />\";\n }",
"protected function getDefaultSuccessRedirectUrl()\n {\n }",
"public function getDefaultRedirect()\n {\n return $this->default_redirect;\n }",
"public function setRedirectUrl($url = NULL) {\n if (($url === NULL) || ($url instanceof Url)) {\n $this->redirectUrl = $url;\n }\n }",
"public function setRedirect(?string $url = null) {\n\t\t$this->redirect = $url;\n\t}",
"public function setRedirectUrl($url = '/')\n {\n $this->redirectUrl = $url;\n }",
"public function defaultUrl();",
"public function resolveDefaultAfterLoginUrl()\n {\n if(UsniAdaptor::app()->homeUrl == null)\n {\n $redirectUrl = Url::base(true);\n }\n else\n {\n $redirectUrl = Url::home(true);\n }\n return $redirectUrl;\n }",
"public function setRedirectURL($url)\r\n {\r\n // Location of redirection\r\n if (!empty($url)) $this->redirectURL = $url;\r\n }",
"function defaultRedirect() {\n\t\t$view = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n\t\t<meta http-equiv=\"refresh\" content=\"10;url=%redirect.location%\" />\n\t\t<title>%package% - Redirecting</title>\n\t</head>\n\n\t<body id=\"redirect\">\n\t\t<h1>%package% - Redirect</h1>\n\t\t<p>Your request has been processed.</p>\n\t\t<p>If you are not automatically forwarded in the next 10 seconds, please follow <a href=\"%redirect.location%\">this link</a>.</p>\n\t</body>\n</html>';\n\n\t\treturn $this->replaceVars($view);\n\t}",
"public function setDefaultUrls()\n {\n $this->url_return = $this->getUrl($this->config->get('transfers24.url_return'));\n $this->url_status = $this->getUrl($this->config->get('transfers24.url_status'));\n }",
"public function setRedirectUrl(string $redirectUrl);",
"public function getDefaultPageURL();",
"public function admin_redirect_setting( ) {\n\t\tregister_setting( 'general', 'hsph_admin_redirect_url' );\n\t\tadd_settings_field(\n\t\t\t'hsph_admin_redirect_url',\n\t\t\t'Redirect URL',\n\t\t\tarray( $this, 'display_redirect_field' ),\n\t\t\t'general',\n\t\t\t'admin_redirect_settings_section',\n\t\t\tarray( 'label_for' => 'hsph_admin_redirect_url' )\n\t\t);\n\t}",
"public function getDefaultUrl()\n\t{\n\t\treturn 'index.php?module=LoginHistory&parent=Settings&view=List';\n\t}",
"private function setAutoRedirectionToHomepage()\n {\n $this->design->setRedirect(\n $this->registry->site_url,\n null,\n null,\n self::REDIRECTION_DELAY\n );\n }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
getInput. Returns underlying input buffer associated with current buffer event.
|
#[Pure]
public function getInput(): EventBuffer {}
|
[
"public function getInputBuffer(){}",
"public function getBufferedInput(): string {\n return $this->bufIn;\n }",
"public function getInput()\n {\n return $this->input;\n }",
"private function obtainInput()\n {\n $this->synchronizeBuffer();\n if (sizeof(self::$inputData) > self::$inputCount) {\n self::$inputCount = sizeof(self::$inputData);\n $lastItem = trim(self::$inputData[self::$inputCount - 1]);\n return $lastItem;\n } else {\n return NULL;\n }\n }",
"public function get_buffer()\r\n\t{\r\n\t\treturn $this->buffer;\r\n\t}",
"public function getBuffer() {}",
"public function getBuffer() {\r\n\t\treturn $this->_data;\r\n\t}",
"function getInputHook() {\n\t\treturn $this->inputHook;\n\t}",
"public function openInput()\n {\n if (null === $this->_stdin) {\n return STDIN;\n } else {\n $this->_stdin = fopen($this->_stdin, 'rb');\n\n return $this->_stdin;\n }\n }",
"function read_event() {\n if (count($this -> output_buffer) > 0) {\n return array_shift($this -> output_buffer);\n } else {\n $reply = $this -> sock_get();\n return $reply;\n }\n }",
"public function getBuffer()\n {\n return ps_get_buffer($this->resource);\n }",
"public function getRawInput() : mixed {\n\t\t\tif (!$this->isValid) {\n\t\t\t\t// @codeCoverageIgnoreStart\n\t\t\t\tthrow new InvalidRequestException(\"Can't get input on an invalid request\");\n\t\t\t\t// @codeCoverageIgnoreEnd\n\t\t\t}\n\n\t\t\treturn $this->input;\n\t\t}",
"public static function input()\n {\n return file_get_contents(\"php://input\");\n }",
"public function getInput($key);",
"protected function getStdin()\n {\n $h = fopen('php://stdin', 'r');\n $data = stream_get_contents($h);\n fclose($h);\n return $data;\n }",
"function getInput(): string\n {\n return $this->input;\n }",
"public function getRawInput() {\n\t return file_get_contents('php://input');\n }",
"public function getBuffer()\n {\n return substr($this->_data, $this->_index);\n }",
"public function getBuffer($buffer) {\r\r\n if (isset($this->buffer)) {\r\r\n return $this->buffer;\r\r\n }\r\r\n\r\r\n $this->buffer = $this->setMetaInBuffer($buffer);\r\r\n return $this->buffer;\r\r\n }",
"public static function getStdin(): ReadablePipe { }"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
get all the latest campaign id
|
public static function GetLatestCampaignInfo(){
$db = self::GetDB();
$dbhandler = $db->prepare("Call get_latest_campaigninfo");
$dbhandler->execute();
$row = $dbhandler->fetch(PDO::FETCH_ASSOC);
return $row;
}
|
[
"function getLatestCampaigns () {\n $sql = sprintf('select * from %s order by id desc limit ' . MAX_CAMPAIGNS_COUNT, $GLOBALS[\"tables\"][\"message\"]);\n $result = Sql_Query($sql);\n return $result;\n}",
"private function fetchAllLiveCampaignIds() {\n\t\t// todo: flatten this bitch.\n\t\t$data = DB::select('SELECT * FROM view_active_campaign_ids;'); \n\t\treturn collect($data)->map(function($x){ return $x->campaign_id; })->toArray();\n\t}",
"public function fetchActiveCampaigns() {}",
"public function campaign_get_list()\n\t{\n\t\t$this->api_url = $this->base_url.'/campaign';\n\t\t$object = $this->curl_get();\n\n\t\treturn $this->output($object);\n\t}",
"function getLastCampaignId() {\n global $MailChimp;\n $a = $MailChimp->get('campaigns');\n if ($MailChimp->success()) {\n $b = $a['campaigns'][0]['id'];\n return $b;\n } else {\n r($a);\n showAlert(\"ERRO! ERRO! ERRO!\");\n echo '<b>ERRO:</b> ' . $MailChimp->getLastError();\n }\n}",
"public function getIdCampaign()\n {\n return $this->id_campaign;\n }",
"public function get_all_campaigns()\r\n {\r\n $query = $this->db->query(\"SELECT * FROM campaigns\");\r\n \treturn $query->result_array();\r\n }",
"public function getAllCampaigns(){\r\n\t\t$sql = 'SELECT com.companyname,com.id as comid, c.useforalerts, c.usefornewsletter, c.banner_id, c.skyscraper, c.modifiedbyid, c.title, c.startdate, c.enddate, c.description, c.clickthroughurl, c.clickthroughurl_B, c.id, c.company FROM campaigns c, campaigns_companies com WHERE com.id = c.company'; // and and c.banner_id = i.id\r\n\t\t$result = $this->db->query($sql);\r\n\t\t$rows = $result->fetchAll();\r\n\t\t$result->closeCursor();\r\n\t\treturn $rows;\r\n\t\t\r\n\t\t\r\n\t}",
"public function getCampaigns()\r\n {\r\n // with a draft status of 1\r\n $select = new Select('launchcampaign');\r\n \r\n $select->columns(array('campaign_id', 'title', 'campaign_status'))\r\n ->where(\"draft_status = '1'\");\r\n \r\n $adapter = $this->table_gateway->getAdapter();\r\n \r\n $query = $adapter->query($this->sql->buildSqlString($select), $adapter::QUERY_MODE_EXECUTE);\r\n \r\n $holder = array();\r\n \r\n foreach ($query as $key => $row) {\r\n $holder[$key] = $row;\r\n }\r\n \r\n return $holder;\r\n }",
"public function getCampaignId()\n {\n return $this->getEntityValue('campaign_id', '');\n }",
"function getCampaignList() {\r\n return $this->execCommad('getCampaignList',\"\");\r\n }",
"private function getCampaignInfo()\n\t{\n $query = \"\n -- Condor Token API \".__FILE__.\":\".__LINE__.\":\".__METHOD__.\"()\n SELECT\n camp.campaign_info_id,\n camp.promo_id,\n camp.promo_sub_code,\n s.name as url,\n s.license_key\n FROM\n application a,\n site s,\n campaign_info camp\n WHERE\n a.application_id = {$this->Get_Application_ID()}\n AND a.company_id = {$this->Get_Company_ID()}\n AND camp.application_id = a.application_id\n AND camp.campaign_info_id =\n (\n SELECT\n MAX(campaign_info_id)\n FROM\n campaign_info cref\n WHERE\n cref.application_id = camp.application_id\n )\n AND a.enterprise_site_id = s.site_id\n \";\n $result = $this->Get_LDB()->Query($query);\n return $result->Fetch_Object_Row(); \t\t\n\t}",
"function getExistCampaign ()\n {\n $datas = $this->CampaignMaster->find ('all', array (\n 'conditions' => array (array ('LEFT (CampaignMaster.end_time, 10) >=' => $this->target_pst_date))));\n\n //$this->log ($datas, LOG_DEBUG);\n $result = array ();\n foreach ($datas as $data)\n {\n if ($data['CampaignMaster']['advertiser_id'] === '100000000') { continue; }\n if ($data['CampaignMaster']['id'] === '2045444883139e79c4246183595c2df2613d6192') { continue; }\n if ($data['CampaignMaster']['id'] === '40b247a5c58ea510c773942a6ba0aa3a7467cc35') { continue; }\n\n $this->getData ($data['CampaignMaster']['id']);\n }\n //echo $this->sqlDump ();\n return $result;\n }",
"public function listCampaign(){\n\n $token = generateAccessToken();\n $campaigns = listCampaign($token);\n return $campaigns['data'];\n\n }",
"function get_campaigns()\n\t{\n\t\treturn $this->mailchimp->campaigns();\n\t}",
"public function campaigns()\n {\n $campaigns = App::get('database')->getAll('campaigns');\n\n echo json_encode($campaigns);\n }",
"function getCampaignById($id)\n {\n global $wpdb;\n\n $id = intval($id);\n return $wpdb->get_row(\"SELECT * FROM {$this->db['campaign']} WHERE id = $id\");\n }",
"public function getCampaigns()\n {\n }",
"public function getCampaignByID() \n\t{\n\t\t$campaign = NstQueries::find(\n\t\t\tHelper::getDbTableName('campaigns'), \n\t\t\tintval($_REQUEST['campaign_id'])\n\t\t);\n\n\t\t$campaign = apply_filters('nst_get_single_campaign', $campaign);\n\t\t\n\t\twp_send_json_success($campaign, 200);\n\t}"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.