sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function renderRows()
{
$this->odd_even = null;
$this->total_rows = 0;
$this->template->del($this->container_tag);
// render data rows
$iter = $this->getIterator();
foreach ($iter as $this->current_id => $this->current_row) {
if ($this->current_row... | Render lister rows. | entailment |
public function renderDataRow()
{
$this->formatRow();
$this->template->appendHTML(
$this->container_tag,
$this->rowRender($this->row_t)
);
} | Render data row. | entailment |
public function renderTotalsRow()
{
$this->current_row = $this->current_row_html = array();
if ($this->totals !== false && is_array($this->totals) && $this->totals_t) {
$this->current_row = $this->totals;
$this->formatTotalsRow();
$this->template->appendHTML(
... | Render Totals row. | entailment |
public function formatRow()
{
parent::formatRow();
if (is_array($this->current_row) || $this->current_row instanceof ArrayAccess) {
$this->odd_even =
$this->odd_even == $this->odd_css_class
? $this->even_css_class
: $this->odd_css_... | Format lister row. | entailment |
public function formatTotalsRow()
{
$this->formatRow();
$this->hook('formatTotalsRow');
// deal with plural - not localizable!
if ($this->current_row['row_count'] == 0) {
$this->current_row['row_count'] = 'no';
$this->current_row['plural_s'] = 's';
} ... | Additional formatting for Totals row.
@todo This plural_s method suits only English locale !!! | entailment |
public function updateTotals()
{
if (is_array($this->totals)) {
foreach ($this->totals as $key => $val) {
if (is_object($this->current_row[$key])) {
continue;
}
$this->totals[$key] = $val + $this->current_row[$key];
... | Add current rendered row values to totals.
Called before each formatRow() call. | entailment |
public function updateGrandTotals()
{
// get model
$m = $this->getIterator();
// create DSQL query for sum and count request
$fields = array_keys($this->totals);
// select as sub-query
$sub_q = $m->dsql()->del('limit')->del('order');
$q = $this->app->db->ds... | Calculate grand totals of all rows.
Called one time on rendering phase - before renderRows() call. | entailment |
public function formatRow()
{
parent::formatRow();
$page = $this->model['page'];
if (!$page && $this->max_depth) {
// by default resort to parent pages
$tmp = array();
for ($i = 0; $i < $this->max_depth; ++$i) {
$tmp[] = '..';
... | Format row (overwrite) | entailment |
public function render()
{
$this->max_depth = count($this->setModel($this->model)) - 1;
return parent::render();
} | Render object | entailment |
public function send(OutgoingMessage $message)
{
$composeMessage = $message->composeMessage();
foreach ($message->getTo() as $to) {
$data = [
'to' => $to,
'messagebody' => $composeMessage,
];
$this->buildBody($data);
... | Sends a SMS message.
@param \SimpleSoftwareIO\SMS\OutgoingMessage $message | entailment |
public function send(OutgoingMessage $message)
{
$from = $message->getFrom();
$composeMessage = $message->composeMessage();
foreach ($message->getTo() as $to) {
$response = $this->plivo->send_message([
'dst' => $to,
'src' => $from,
... | Sends a SMS message.
@param \SimpleSoftwareIO\SMS\OutgoingMessage $message | entailment |
protected function processReceive($raw)
{
$incomingMessage = $this->createIncomingMessage();
$incomingMessage->setRaw($raw);
$incomingMessage->setMessage($raw->resource_uri);
$incomingMessage->setFrom($raw->message_uuid);
$incomingMessage->setId($raw->message_uuid);
$... | Processing the raw information from a request and inputs it into the IncomingMessage object.
@param $raw | entailment |
public function checkMessages(array $options = [])
{
$start = array_key_exists('start', $options) ? $options['start'] : 0;
$end = array_key_exists('end', $options) ? $options['end'] : 25;
$rawMessages = $this->plivo->get_messages([
'offset' => $start,
'limit' => $en... | Checks the server for messages and returns their results.
@param array $options
@return array | entailment |
public function getMessage($messageId)
{
$rawMessage = $this->plivo->get_message(['record_id' => $messageId]);
$incomingMessage = $this->createIncomingMessage();
$this->processReceive($incomingMessage, $rawMessage);
return $incomingMessage;
} | Gets a single message by it's ID.
@param string|int $messageId
@return \SimpleSoftwareIO\SMS\IncomingMessage | entailment |
public function receive($raw)
{
if ($this->verify) {
$this->validateRequest();
}
$incomingMessage = $this->createIncomingMessage();
$incomingMessage->setRaw($raw->get());
$incomingMessage->setMessage($raw->get('resource_uri'));
$incomingMessage->setFrom($... | Receives an incoming message via REST call.
@param mixed $raw
@return \SimpleSoftwareIO\SMS\IncomingMessage | entailment |
protected function validateRequest()
{
$data = $_POST;
$url = $this->url;
$signature = $_SERVER['X-Plivo-Signature'];
$authToken = $this->authToken;
if (!$this->plivo->validate_signature($url, $data, $signature, $authToken)) {
throw new \InvalidArgumentException(... | Checks if a message is authentic from Plivo.
@throws \InvalidArgumentException | entailment |
public function useOldTemplateTags()
{
$this->app->setConfig(array('template' => array(
'ldelim' => '<\?',
'rdelim' => '\?>',
)));
if ($this->app->template) {
// reload it
$this->app->template->settings = array_merge(
$this->a... | Forces Agile Toolkit to use <?tag?> templates instead of {tag} | entailment |
public function useNoPublic()
{
$this->app->pathfinder->base_location->defineContents(array(
'public' => 'atk4/public/atk4',
'js' => 'atk4/public/atk4/js',
));
$this->app->pathfinder->base_location->setBaseURL($this->app->pm->base_url);
return $this;
} | Agile Toolkit 43 expects public/atk4 to point to atk4/public/atk4. If
you can't do that, oh well | entailment |
public function init()
{
parent::init();
$this->app->requires('atk', $this->atk_version);
if (!$this->addon_name) {
throw $this->exception('Addon name must be specified in it\'s Controller');
}
$this->namespace = substr(get_class($this), 0, strrpos(get_class($th... | ??? | entailment |
public function routePages($page_prefix)
{
if ($this->app instanceof App_Frontend) {
/** @type App_Frontend $this->app */
$this->app->routePages($page_prefix, $this->namespace);
}
} | This routes certain prefixes to an add-on. Call this method explicitly
from init() if necessary. | entailment |
public function addLocation($contents, $public_contents = null)
{
$this->location = $this->app->pathfinder->addLocation($contents);
$this->location->setBasePath($this->addon_base_path);
// If class has assets, those have probably been installed
// into the public location
//... | This defines the location data for the add-on. Call this method
explicitly from init() if necessary. | entailment |
public function send(OutgoingMessage $message)
{
foreach ($message->getTo() as $number) {
$this->logger->notice("Sending SMS message to: $number");
}
} | Sends a SMS message.
@param \SimpleSoftwareIO\SMS\OutgoingMessage $message | entailment |
protected function processReceive($rawMessage)
{
$incomingMessage = $this->createIncomingMessage();
$incomingMessage->setRaw($rawMessage);
$incomingMessage->setFrom((string) $rawMessage->FromNumber);
$incomingMessage->setMessage((string) $rawMessage->TextRecord->Message);
$in... | Creates many IncomingMessage objects and sets all of the properties.
@param $rawMessage
@return mixed | entailment |
public function composeMessage()
{
// Attempts to make a view.
// If a view can not be created; it is assumed that simple message is passed through.
try {
return $this->views->make($this->view, $this->data)->render();
} catch (\InvalidArgumentException $e) {
... | Composes a message.
@return \Illuminate\View\Factory | entailment |
public function attachImage($image)
{
$this->mms = true;
if (is_array($image)) {
$this->attachImages = array_merge($this->attachImages, $image);
} else {
$this->attachImages[] = $image;
}
} | Attaches an image to a message.
@param string $image Path to image. | entailment |
public function init()
{
parent::init();
if (@$_GET[$this->owner->name.'_cut_field'] == $this->name) {
$this->app->addHook('pre-render', array($this, '_cutField'));
}
/* TODO: finish refactoring
// find the form
$obj=$this->owner;
while(!$obj inst... | / }}} | entailment |
public function addButton($label, $options = array())
{
$position = 'after';
if (is_string($options)) {
$position = $options;
} else {
if (isset($options['position'])) {
$position = $options['position'];
}
}
if ($position ==... | Position can be either 'before' or 'after' | entailment |
public function addIcon($icon, $link = null)
{
if (!$this->_icon) {
$this->_icon = $this->add('Icon', null, 'icon');
}
$this->_icon->set($icon);
if ($link) {
$this->_icon->setElement('a')
->setAttr('href', $link);
}
$this->temp... | Wraps input field into a <span> to align icon correctly | entailment |
public function validate($rule = null)
{
if (is_null($rule)) {
throw $this->exception('Incorrect usage of field validation');
}
if (is_string($rule)) {
// If string is passed, prefix with the field name
$rule = $this->short_name.'|'.$rule;
} elsei... | This method has been refactored to integrate with Controller_Validator. | entailment |
public function validateField($condition, $msg = null)
{
if (is_callable($condition)) {
$this->form->addHook('validate', array($this, '_validateField'), array($condition, $msg));
} else {
$this->form->addHook('validate', 'if(!('.$condition.'))$this->displayFieldError("'.
... | Executes a callback. If callback returns string, shows it as error message.
If callback returns "false" shows either $msg or a standard error message.
about field being incorrect | entailment |
public function validateNotNULL($msg = null)
{
$this->setMandatory();
if ($msg && $msg !== true) {
$msg = $this->app->_($msg);
} else {
$msg = sprintf($this->app->_('%s is a mandatory field'), $this->caption);
}
$this->validateField(array($this, '_vali... | Adds "X is a mandatory field" message | entailment |
public function init()
{
parent::init();
$this->page = null;
$this->saved_base_path = $this->pm->base_path;
$this->pm->base_path .= basename($_SERVER['SCRIPT_NAME']);
$this->add('jUI');
$this->template->trySet('version', 'Web Software Installer');
$this->s... | Initialization. | entailment |
public function makePage($step, $template = 'step/default')
{
return $this->layout->add($this->page_class, null, null, array($template));
} | @todo Description
@param string $step Unused parameter !!!
@param string $template
@return View | entailment |
public function initStep($step)
{
$step_method = 'step_'.$step;
/** @type H1 $h */
$h = $this->add('H1');
if (!$this->hasMethod($step_method)) {
return $h->set('No such step');
}
$h->set('Step '.$this->s_cnt.': '.$this->s_title);
$page = $this->mak... | @todo Description
@param string $step
@return mixed | entailment |
public function showIntro($v)
{
/** @type H1 $h */
$h = $v->add('H1');
$h->set('Welcome to Web Software');
/** @type P $p */
$p = $v->add('P');
$p->set('Thank you for downloading this software. '.
'This wizard will guide you through the installation proce... | @todo Description
@param View $v | entailment |
public function stepURL($position)
{
$s = 's_'.$position;
$s = $this->$s;
return $this->url(null, array('step' => $s));
} | @todo Description.
@param string $position
@return URL | entailment |
public function postInit()
{
foreach ($this->elements as $x => $field) {
if ($field instanceof Form_Field) {
$field->set($this->recall($x));
if ($field->no_save || !$field->get()) {
continue;
}
// also apply th... | Remembers values and uses them as condition. | entailment |
public function memorizeAll()
{
// memorize() method doesn't memorize anything if value is null
foreach ($this->get() as $field => $value) {
if ((isset($this->reset) && $this->isClicked($this->reset)) || is_null($value)) {
$this->forget($field);
} else {
... | Memorize filtering parameters. | entailment |
public function addButtons()
{
$this->save = $this->addSubmit('Save');
$this->reset = $this->addSubmit('Reset');
return $this;
} | Add Save and Reset buttons.
@return $this | entailment |
public function submitted()
{
if (parent::submitted()) {
if (isset($this->reset) && $this->isClicked($this->reset)) {
$this->forget();
$this->js(null, $this->view->js()->reload())->reload()->execute();
} else {
$this->memorizeAll();
... | On form submit memorize or forget filtering parameters. | entailment |
public function send(OutgoingMessage $message)
{
$composedMessage = $message->composeMessage();
$data = [
'PhoneNumbers' => $message->getTo(),
'Message' => $composedMessage,
];
$this->buildCall('/sending/messages');
$this->buildBody($data);
... | Sends a SMS message.
@param \SimpleSoftwareIO\SMS\OutgoingMessage $message | entailment |
public function checkMessages(array $options = [])
{
$this->buildCall('/incoming-messages');
$this->buildBody($options);
$rawMessages = $this->getRequest()->json();
return $this->makeMessages($rawMessages['Response']['Entries']);
} | Checks the server for messages and returns their results.
@param array $options
@return array | entailment |
public function getMessage($messageId)
{
$this->buildCall('/incoming-messages');
$this->buildCall('/'.$messageId);
$rawMessage = $this->getRequest()->json();
return $this->makeMessage($rawMessage['Response']['Entry']);
} | Gets a single message by it's ID.
@param string|int $messageId
@return \SimpleSoftwareIO\SMS\IncomingMessage | entailment |
protected function processReceive($rawMessage)
{
$incomingMessage = $this->createIncomingMessage();
$incomingMessage->setRaw($rawMessage);
$incomingMessage->setFrom($rawMessage['PhoneNumber']);
$incomingMessage->setMessage($rawMessage['Message']);
$incomingMessage->setId($raw... | Returns an IncomingMessage object with it's properties filled out.
@param $rawMessage
@return mixed|\SimpleSoftwareIO\SMS\IncomingMessage | entailment |
public function receive($raw)
{
//Due to the way EZTexting handles Keyword Submits vs Replys
//We must check both values.
$from = $raw->get('PhoneNumber') ? $raw->get('PhoneNumber') : $raw->get('from');
$message = $raw->get('Message') ? $raw->get('Message') : $raw->get('message');
... | Receives an incoming message via REST call.
@param mixed $raw
@return \SimpleSoftwareIO\SMS\IncomingMessage | entailment |
public function addSeparator($template = null)
{
$this->items[] = $this->add(
'MenuSeparator',
$this->short_name.'_separator'.count($this->items),
'Item',
$template
);
return $this;
} | /*function insertMenuItem($index,$label,$href=null){
$tail=array_slice($this->data,$index);
$this->data=array_slice($this->data,0,$index);
$this->addMenuItem($label,$href);
$this->data=array_merge($this->data,$tail);
return $this;
} | entailment |
public function init()
{
parent::init();
if ($this->include_id_column) {
$this->addColumn('text', 'id');
}
$this->addColumn('text', 'name');
$this->addColumn('text', 'value');
} | Initialization | entailment |
public function setNoText($icon = null)
{
$this->options['text'] = false;
if ($icon !== null) {
$this->setIcon($icon);
}
return $this;
} | Set button without text and optionally with icon.
@param string $icon Icon CSS class
@return $this | entailment |
public function setIcon($icon)
{
if ($icon[0] != '<') {
$icon = '<i class="icon-'.$icon.'"></i>';
}
$this->template->trySetHTML('icon', $icon);
return $this;
} | Sets icon for button.
@param string $icon Icon CSS class
@return $this
@todo Implement this trough Icon view | entailment |
public function setLabel($label)
{
if (is_array($label) && $label['icon']) {
$this->setIcon($label['icon']);
} elseif (is_string($label)) {
return $this->setText($label);
}
return $this;
} | Sets label of button.
@param string|array $label
@return $this | entailment |
public function render()
{
$this->addClass('atk-button');
$c = $this->template->get('Content');
if (is_array($c)) {
$c = $c[0];
}
if ($this->template->get('icon') && $c) {
$this->template->setHTML('nbsp', ' ');
}
parent::render();
... | Render button. | entailment |
public function link($page, $args = array())
{
$this->setElement('a');
$this->setAttr('href', $this->app->url($page, $args));
return $this;
} | Set button as HTML link object <a href="">.
@param string $page
@param array $args
@return $this | entailment |
public function addPopover($js_options = array(), $class_options = null)
{
$this->options['icons']['secondary'] = $this->js_triangle_class;
/** @type View_Popover $popover */
$popover = $this->owner->add($this->popover_class, $class_options, $this->spot);
$this->js('click', $popove... | When button is clicked, opens a frame containing generic view.
Because this is based on a dialog (popover), this is a modal action
even though it does not add dimming / transparency.
@param array $js_options Options to pass to popover JS widget
@param array $class_options Options to pass to popover PHP class
@retu... | entailment |
public function addSplitButton($options = null)
{
$options = array_merge(
array(
'text' => false,
'icons' => array(
'primary' => $this->js_triangle_class,
),
),
$options ?: array()
);
/**... | Adds another button after this one with an arrow and returns it.
@param array $options Options to pass to new Button class
@return Button New button object (button with triangle) | entailment |
public function addMenu($options = array(), $vertical = false)
{
$this->options['icons']['secondary'] = $this->js_triangle_class;
// add menu
$this->menu = $this->owner->add($this->menu_class, $options, $this->spot);
/** @type Menu_jUI $this->menu */
$this->menu->addStyle('d... | Show menu when clicked. For example, dropdown menu.
@param array $options Options to pass to Menu class
@param bool $vertical Direction of menu (false=horizontal, true=vertical)
@return Menu | entailment |
public function isClicked($message = null)
{
$cl = $this->js('click')->univ();
if ($message !== null) {
$cl->confirm($message);
}
$cl->ajaxec($this->app->url(null, array($this->name => 'clicked')), true);
return isset($_GET[$this->name]);
} | Add click handler on button and returns true if button was clicked.
@param string $message Confirmation question to ask
@return bool | entailment |
public function onClick($callback, $confirm_msg = null)
{
if ($this->isClicked($confirm_msg)) {
// TODO: add try catch here
$ret = call_user_func($callback, $this, $_POST);
// if callback response is JS, then execute it
if ($ret instanceof jQuery_Chain) {
... | Add click handler on button and executes $callback if button was clicked.
@param callback $callback Callback function to execute
@param string $confirm_msg Confirmation question to ask
@return $this | entailment |
public function onClickConsole($callback, $title = null)
{
if (is_null($title)) {
$title = $this->template->get('Content');
}
$this->virtual_page = $this->add('VirtualPage', ['type' => 'frameURL']);
/** @type VirtualPage $this->virtual_page */
$this->virtual_page... | Add click handler on button, that will execute callback. Similar to
onClick, however output from callback execution will appear in a
dialog window with a console.
@param callable $callback
@param string $title | entailment |
public function convertDate($date, $from = null, $to = 'Y-m-d')
{
if (!$date) {
return null;
}
if ($from === null) {
$from = $this->app->getConfig('locale/date', null);
}
if ($from === null) {
// no format configured, so use our best guess.... | Convert date from one format to another.
@param string $date Date in string format
@param string $from Optional source format, or null to use locale/date from configuration
@param string $to Optional target format, or null to use locale/date from configuration
@return string|null | entailment |
public function getIdsFromConditions($rows, $conditions, $limit = null)
{
$withLimit = !is_null($limit) && (is_array($limit) && !is_null($limit[0]));
if ($withLimit) {
$max = is_null($limit[1]) ? $limit[0] : ($limit[0] + $limit[1]);
}
$ids = array();
foreach ($ro... | resolve all conditions | entailment |
public function init()
{
parent::init();
try {
// Extra 24-hour protection
parent::init();
$this->getLogger();
$this->pm = $this->add($this->pagemanager_class, $this->pagemanager_options);
/** @type Controller_PageManager $this->pm */
... | Initialization. | entailment |
public function encodeOutput($data)
{
// TODO - use HTTP_ACCEPT here ?
//var_dump($_SERVER['HTTP_ACCEPT']);
if ($_GET['format'] == 'xml') {
throw $this->exception('only JSON format is supported', null, 406);
}
if ($_GET['format'] == 'json_pretty') {
... | Output will be properly fromatted.
@param mixed $data | entailment |
public function execute()
{
try {
try {
$file = $this->app->locatePath('endpoint', str_replace('_', '/', $this->page).'.php');
include_once $file;
$this->pm->base_path = '/';
} catch (Exception $e) {
http_response_code(... | Execute. | entailment |
public function setAttr($attribute, $value = null)
{
if (is_array($attribute) && is_null($value)) {
foreach ($attribute as $k => $v) {
$this->setAttr($k, $v);
}
return $this;
}
$this->template->appendHTML('attributes', ' '.$attribute.'="'.... | Add attribute to element. Previously added attributes are not affected.
@param string|array $attribute Name of the attribute, or hash
@param string $value New value of the attribute
@return $this | entailment |
public function addClass($class)
{
if (is_array($class)) {
foreach ($class as $c) {
$this->addClass($class);
}
return $this;
}
$this->template->append('class', ' '.$class);
return $this;
} | Add CSS class to element. Previously added classes are not affected.
Multiple CSS classes can also be added if passed as space separated
string or array of class names.
@param string|array $class CSS class name or array of class names
@return $this | entailment |
public function addComponents(array $class, $append_to_tag = 'class')
{
foreach ($class as $key => $value) {
if (is_array($value)) {
continue;
}
if ($value === true) {
$this->template->append($append_to_tag, ' atk-'.$key);
c... | Agile Toolkit CSS now supports concept of Components. Using this method
you can define various components for this element:.
addComponents( [ 'size'=>'mega', 'swatch'=>'green' ] ); | entailment |
public function removeClass($class)
{
$cl = ' '.$this->template->get('class').' ';
$cl = str_replace(' '.trim($class).' ', ' ', $cl);
$this->template->set('class', trim($cl));
return $this;
} | Remove CSS class from element, if it was added with setClass
or addClass.
@param string $class Single CSS class name to remove
@return $this | entailment |
public function setStyle($property, $style = null)
{
$this->template->del('style');
$this->addStyle($property, $style);
return $this;
} | Set inline CSS style of element. Old styles will be removed.
Multiple CSS styles can also be set if passed as array.
@param string|array $property CSS Property or hash
@param string $style CSS Style definition
@return $this | entailment |
public function addStyle($property, $style = null)
{
if (is_array($property) && is_null($style)) {
foreach ($property as $k => $v) {
$this->addStyle($k, $v);
}
return $this;
}
$this->template->append('style', ';'.$property.':'.$style);
... | Add inline CSS style to element.
Multiple CSS styles can also be set if passed as array.
@param string|array $property CSS Property or hash
@param string $style CSS Style definition
@return $this | entailment |
public function removeStyle($property)
{
// get string or array of style tags added
$st = $this->template->get('style');
// if no style, do nothing
if (!$st) {
return $this;
}
// if only one style, then put it in array
if (!is_array($st)) {
... | Remove inline CSS style from element, if it was added with setStyle
or addStyle.
@param string $property CSS Property to remove
@return $this | entailment |
public function set($text)
{
if (!is_array($text)) {
return $this->setText($text);
}
if (!is_null($text[0])) {
$this->setText($text[0]);
}
// If icon is defined, it will either insert it into
// a designated spot or will combine it with text
... | Sets text to appear inside element. Automatically escapes
HTML characters. See also setHTML().
4.3: You can now pass array to this, which will cleverly
affect components of this widget and possibly assign
icon
@param string|array $text Text
@return $this | entailment |
public function setText($text)
{
$this->template->trySet('Content', $this->app->_($text));
return $this;
} | Sets text to appear inside element. Automatically escapes
HTML characters. See also setHTML().
@param string $text Text
@return $this
@TODO: Imants: I believe we should use set() here not trySet() | entailment |
public function render()
{
$c = $this->template->get('current');
$this->template->del('current');
$parts = explode('_', $this->app->page);
$matched = false;
while (!empty($parts)) {
$tag = implode('_', $parts);
if ($this->template->is_set('current_'... | }}} | entailment |
public function importFields($model, $fields = null)
{
$this->model = $model;
$this->form = $this->owner;
if ($fields === false) {
return;
}
if (!$fields) {
$fields = 'editable';
}
if (!is_array($fields)) {
// note: $field... | Import model fields in form.
Use $fields === false if you want to associate form with model, but don't create form fields.
@param Model $model
@param array|string|bool $fields
@return void|$this | entailment |
public function importField($field, $field_name = null)
{
$field = $this->model->hasElement($field);
if (!$field) {
return;
}
/** @type Field $field */
if (!$field->editable()) {
return;
}
if ($field_name === null) {
$field... | Import one field from model into form.
@param string $field
@param string $field_name
@return void|Form_Field | entailment |
public function getFields()
{
$models = array();
/**
* @var Form_Field $form_field
* @var Field $model_field
*/
foreach ($this->field_associations as $form_field => $model_field) {
$v = $this->form->get($form_field);
$model_field->set($v);
... | Returns array of models model_name => Model used in this form.
@return array | entailment |
public function getFieldType($field)
{
// default form field type
$type = 'Line';
// try to find associated form field type
if (isset($this->type_associations[$field->type()])) {
$type = $this->type_associations[$field->type()];
}
if ($field instanceof Fi... | Returns form field type associated with model field.
Redefine this method to add special handling of your own fields.
@param Field $field
@return string | entailment |
public function rule_if($a)
{
$b = $this->pullRule();
if (!$this->get($b)) {
$this->stop();
}
return $a;
} | Advanced logic. | entailment |
public function send(OutgoingMessage $message)
{
$composeMessage = $message->composeMessage();
//Convert to callfire format.
$numbers = implode(',', $message->getTo());
$data = [
'To' => $numbers,
'Message' => $composeMessage,
];
$this-... | Sends a SMS message.
@param \SimpleSoftwareIO\SMS\OutgoingMessage $message | entailment |
public function checkMessages(array $options = [])
{
$this->buildCall('/text');
$rawMessages = $this->getRequest()->xml();
return $this->makeMessages($rawMessages->Text);
} | Checks the server for messages and returns their results.
@param array $options
@return array | entailment |
public function getMessage($messageId)
{
$this->buildCall('/text/'.$messageId);
return $this->makeMessage($this->getRequest()->xml()->Text);
} | Gets a single message by it's ID.
@param string|int $messageId
@return \SimpleSoftwareIO\SMS\IncomingMessage | entailment |
public function set($fx)
{
/** @type VirtualPage $p */
$p = $this->add('VirtualPage');
$p->set($fx);
$this->setURL($p->getURL());
return $this;
} | If callable is passed, it will be executed when the dialog is popped
through the use of VirtualPage.
@param callable $fx
@return $this | entailment |
public function showJS($options = null, $options_compat = array())
{
if (!empty($options_compat)) {
$options = $options_compat;
}
$loader_js = $this->url ?
$this->js()->atk4_load(array($this->url)) : $options['open_js'] ?: null;
$this->js(true)->dialog(array... | Returns JS which will position this element and show it.
@param array $options
@param array $options_compat Deprecated options
@return jQuery_Chain | entailment |
public function send(OutgoingMessage $message)
{
$from = $message->getFrom();
$composeMessage = $message->composeMessage();
foreach ($message->getTo() as $number) {
$data = [
'from' => $from,
'to' => $number,
'b... | Sends a SMS message.
@param \SimpleSoftwareIO\SMS\OutgoingMessage $message
@return void | entailment |
public function checkMessages(array $options = [])
{
$this->buildBody($options);
$rawMessages = json_decode($this->getRequest()->getBody()->getContents());
return $this->makeMessages($rawMessages->data);
} | Checks the server for messages and returns their results.
See https://developer.flowroute.com/docs/lookup-a-set-of-messages.
@param array $options
@return array | entailment |
protected function processReceive($rawMessage)
{
$incomingMessage = $this->createIncomingMessage();
$incomingMessage->setRaw($rawMessage);
$incomingMessage->setFrom((string) $rawMessage->attributes->from);
$incomingMessage->setMessage((string) $rawMessage->attributes->body);
... | Creates many IncomingMessage objects and sets all of the properties.
@param $rawMessage
@return mixed | entailment |
public function getMessage()
{
if (!is_a($this->container, 'PhpBotFramework\Entities\Message')) {
$this->container['message'] = new Message($this->container['message']);
}
return $this->container['message'];
} | \brief Get message attached to this callback.
@return Message $message Message object attached to this callback. | entailment |
public function buildView(FormView $view, FormInterface $form, array $options)
{
$resolver = $this->getResolver($options);
$itemProperty = $options['item_property'];
$accessor = PropertyAccess::createPropertyAccessor();
$data = $form->getData();
if($data) {
$ite... | {@inheritdoc} | entailment |
public static function paginateItems(
$items,
int $index,
Keyboard &$keyboard,
callable $format_item,
int $item_per_page = 3,
string $prefix = 'list',
string $delimiter = DELIMITER
) : string {
// Assign the position of first item to show
$item... | \brief Paginate a number of items got as a result by a query.
\details Take items to show in the page $index, delimiting in by $delimiter, and call the closure $format_item on each item paginated.
Taking a select query result, take items that have to be shown on page of index $index (calculated with $item_per_page).
@p... | entailment |
public function getUpdates(int $offset = 0, int $limit = 100, int $timeout = 60)
{
$parameters = [
'offset' => $offset,
'limit' => $limit,
'timeout' => $timeout,
];
return $this->execRequest('getUpdates?' . http_build_query($parameters));
} | \brief Request bot updates.
\details Request updates received by the bot using method getUpdates of Telegram API. [API reference](https://core.telegram.org/bots/api#getupdates)
@param int $offset <i>Optional</i>. Identifier of the first update to be returned. Must be greater by one than the highest among the identifier... | entailment |
public function createView($options = []): View
{
$view = View::create(null, 200);
$templateVars = [];
$templateVars['stylesheets'] = $options['stylesheets'];
$templateVars['javascripts'] = $options['javascripts'];
if($options['translations']) {
$templateVars['t... | {@inheritdoc} | entailment |
public function getResources(SyliusRequestConfiguration $requestConfiguration, RepositoryInterface $repository)
{
if($requestConfiguration instanceof RequestConfiguration && $repository instanceof EntityRepositoryInterface) {
if($requestConfiguration->hasFilters()) {
$query = $th... | {@inheritdoc} | entailment |
public function connect(array $params) : bool
{
$params = $this->addDefaultValue($params);
$config = $this->getDns($params);
try {
$this->pdo = new \PDO($config, $params['username'], $params['password'], $params['options']);
$this->pdo->setAttribute(\PDO::ATTR_ERRMOD... | \brief Open a database connection using PDO.
\details Provides a simple way to initialize a database connection
and create a PDO instance.
@param array $params Parameters for initialize connection.
Index required:
- <code>username</code>
- <code>password</code> (can be an empty string)
Optional index:
- <code>dbname</c... | entailment |
public function getPreviewResponse($resource, $options = array())
{
$map = $this->container->getParameter('cmf_routing.controllers_by_class');
$controllerDefinition = null;
foreach ($map as $class => $value) {
if ($resource instanceof $class) {
$controllerDefiniti... | {@inheritdoc} | entailment |
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('enhavo_newsletter');
$rootNode
->children()
// Driver used by the resource bundle
->scalarNode('driver')->defaultValue('doctrine/orm')->end(... | {@inheritdoc} | entailment |
public function getFcm()
{
if (!isset($this->_fcm)) {
$this->_fcm = $this->createFcm();
}
return $this->_fcm;
} | Returns FCM client
@return \paragraph1\phpFCM\Client | entailment |
protected function createFcm()
{
$client = new \paragraph1\phpFCM\Client();
$client->setApiKey($this->apiKey);
$client->setProxyApiUrl($this->proxyApiUrl);
$client->injectHttpClient($this->getHttpClient());
return $client;
} | Creates FCM client
@return \paragraph1\phpFCM\Client | entailment |
public function getHttpClient()
{
if (!isset($this->_httpClient)) {
$this->_httpClient = Yii::createObject($this->guzzleClass, [$this->guzzleConfig]);
}
return $this->_httpClient;
} | Returns Guzzle client
@return \GuzzleHttp\ClientInterface | entailment |
public function createMessage($deviceTokens = [])
{
$message = new Message();
if (is_string($deviceTokens)) {
$deviceTokens = [$deviceTokens];
}
if (!is_array($deviceTokens)) {
throw new InvalidParamException("\$deviceTokens must be string or array");
... | Creates Message object
@param string[]|string $deviceTokens tokens of recipient devices
@return Message | entailment |
public function getLanguageDatabase() : string
{
$pdo = $this->bot->getPDO();
// Get the language from the bot
$sth = $pdo->prepare('SELECT language FROM ' . $this->user_table . ' WHERE '
. $this->id_column . ' = :chat_id');
... | \brief Get current user's language from the database, and set it in $language.
@return string Language set for the current user, throw error if there is language is not set for the user. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.