sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function getJs() { $sJsLibUri = $this->getJsLibUri(); $sJsLibExt = $this->getJsLibExt(); $sJsCoreUrl = $sJsLibUri . 'jaxon.core' . $sJsLibExt; $sJsDebugUrl = $sJsLibUri . 'jaxon.debug' . $sJsLibExt; // $sJsVerboseUrl = $sJsLibUri . 'jaxon.verbose' . $sJsLibExt; ...
Get the HTML tags to include Jaxon javascript files into the page @return string
entailment
private function getOptionVars() { return [ 'sResponseType' => self::RESPONSE_TYPE, 'sVersion' => $this->getOption('core.version'), 'sLanguage' => $this->getOption('core.language'), 'bLanguage' => $t...
Get the correspondances between previous and current config options They are used to keep the deprecated config options working. They will be removed when the deprecated options will lot be supported anymore. @return array
entailment
private function _getScript() { $aVars = $this->getOptionVars(); $sYesScript = 'jaxon.ajax.response.process(command.response)'; $sNoScript = 'jaxon.confirm.skip(command);jaxon.ajax.response.process(command.response)'; $sConfirmScript = jaxon()->dialog()->confirm('msg', $sYesScript, $...
Get the javascript code to be sent to the browser @return string
entailment
public function getScript() { // Set the template engine cache dir $this->setTemplateCacheDir(); $this->makePluginsCode(); if($this->canExportJavascript()) { $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; $sJsAppDir = rtrim($this->getO...
Get the javascript code to be sent to the browser Also call each of the request plugins giving them the opportunity to output some javascript to the page being generated. This is called only when the page is being loaded initially. This is not called when processing a request. @return string
entailment
public function getOption($sName, $xDefault = null) { return Container::getInstance()->getConfig()->getOption($sName, $xDefault); }
Get the value of a config option @param string $sName The option name @param mixed $xDefault The default value, to be returned if the option is not defined @return mixed The option value, or null if the option is unknown
entailment
protected function includeAssets() { $sPluginOptionName = 'assets.include.' . $this->getName(); if($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName)) { return false; } if($this->hasOption('assets.include.all') && !$this->getOption('asse...
Check if the assets of this plugin shall be included in Jaxon generated code @return boolean
entailment
private function setDefaultOptions() { // The default configuration settings. $this->di()->getConfig()->setOptions([ 'core.version' => $this->getVersion(), 'core.language' => 'en', 'core.encoding' => 'ut...
Set the default options of all components of the library @return void
entailment
public function register($sType, $sCallable, $aOptions = []) { return $this->getPluginManager()->register($sType, $sCallable, $aOptions); }
Register request handlers, including functions, callable classes and directories. @param string $sType The type of request handler being registered Options include: - Jaxon::USER_FUNCTION: a function declared at global scope - Jaxon::CALLABLE_CLASS: a class who's methods are to be registered - Jaxon:...
entailment
public function setup($sConfigFile) { $aConfigOptions = $this->config()->read($sConfigFile); // Setup the config options into the library. $sLibKey = 'lib'; $xLibConfig = $this->di()->getConfig(); $xLibConfig->setOptions($aConfigOptions, $sLibKey); $sAppKey = 'app';...
Read config options from a config file and setup the library @param string $sConfigFile The full path to the config file @return Jaxon
entailment
public function getScript($bIncludeJs = false, $bIncludeCss = false) { if(!$this->getOption('core.request.uri')) { $this->setOption('core.request.uri', URI::detect()); } $sCode = ''; $xCodeGenerator = $this->di()->getCodeGenerator(); if(($bIncludeCss)) ...
Returns the Jaxon Javascript header and wrapper code to be printed into the page The javascript code returned by this function is dependent on the plugins that are included and the functions and classes that are registered. @param boolean $bIncludeJs Also get the JS files @param boolean $bInc...
entailment
public function processRequest() { // Check to see if headers have already been sent out, in which case we can't do our job if(headers_sent($filename, $linenumber)) { echo $this->trans('errors.output.already-sent', array( 'location' => $filename . ':' . $linenumbe...
If this is a jaxon request, call the requested PHP function, build the response and send it back to the browser This is the main server side engine for Jaxon. It handles all the incoming requests, including the firing of events and handling of the response. If your RequestURI is the same as your web page, then this fu...
entailment
public function initiate(array $config): void { $this->fieldsets = new Collection(); foreach ($config as $key => $value) { if (\property_exists($this, $key)) { $this->{$key} = $value; } } $this->data = new Fluent(); }
Load grid configuration. @param array $config @return void
entailment
public function with($data) { if (\is_array($data)) { $data = new Fluent($data); } $this->data = $data; return $this; }
Attach data. <code> // assign a data $form->with(DB::table('users')->get()); </code> @param array|\stdClass|\Illuminate\Database\Eloquent\Model $data @return mixed
entailment
public function fieldset($name, Closure $callback = null): FieldsetContract { $fieldset = new Fieldset($this->app, $this->templates, $name, $callback); if (\is_null($name = $fieldset->getName())) { $name = \sprintf('fieldset-%d', $this->fieldsets->count()); } else { ...
Create a new Fieldset instance. @param string|\Closure $name @param \Closure|null $callback @return \Orchestra\Contracts\Html\Form\Fieldset
entailment
public function hidden(string $name, $callback = null): void { $value = \data_get($this->data, $name); $field = new Fluent([ 'name' => $name, 'value' => $value ?: '', 'attributes' => [], ]); if ($callback instanceof Closure) { $callba...
Add hidden field. @param string $name @param \Closure $callback @return void
entailment
public function resource(Presenter $listener, $url, Model $model, array $attributes = []) { $method = 'POST'; if ($model->exists) { $url = "{$url}/{$model->getKey()}"; $method = 'PUT'; } $attributes['method'] = $method; return $this->setup($listener...
Setup form configuration. @param \Orchestra\Contracts\Html\Form\Presenter $listener @param string $url @param \Illuminate\Database\Eloquent\Model $model @param array $attributes @return $this
entailment
public function setup(Presenter $listener, $url, $model, array $attributes = []) { $attributes = \array_merge($attributes, [ 'url' => $listener->handles($url), 'method' => $attributes['method'] ?? 'POST', ]); $this->with($model); $this->attributes($attributes...
Setup simple form configuration. @param \Orchestra\Contracts\Html\Form\Presenter $listener @param string $url @param \Illuminate\Database\Eloquent\Model $model @param array $attributes @return $this
entailment
protected function getPrevLink() { if(!($sCall = $this->xPaginator->getPrevCall())) { return ''; } return $this->xTemplate->render('pagination::links/prev', ['call' => $sCall, 'text' => $this->xPaginator->getPreviousText()]); }
Render the previous link. @return string
entailment
protected function getNextLink() { if(!($sCall = $this->xPaginator->getNextCall())) { return ''; } return $this->xTemplate->render('pagination::links/next', ['call' => $sCall, 'text' => $this->xPaginator->getNextText()]); }
Render the next link. @return string
entailment
protected function getLinks() { $sLinks = ''; foreach($this->xPaginator->getPages() as $page) { if($page['call']) { $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); $sLinks .= $this->xTempla...
Render the pagination links. @return string
entailment
public function render() { return $this->xTemplate->render('pagination::wrapper', [ 'links' => $this->getLinks(), 'prev' => $this->getPrevLink(), 'next' => $this->getNextLink(), ]); }
Render an HTML pagination control. @return string
entailment
public function registerPlugin(\Jaxon\Plugin\Plugin $xPlugin, $nPriority = 1000) { $this->getPluginManager()->registerPlugin($xPlugin, $nPriority); }
Register a plugin Below is a table for priorities and their description: - 0 thru 999: Plugins that are part of or extensions to the jaxon core - 1000 thru 8999: User created plugins, typically, these plugins don't care about order - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin ...
entailment
public function registerRequestPlugins() { $callableRepository = $this->di()->get(CallableRepository::class); $this->registerPlugin(new CallableClass($callableRepository), 101); $this->registerPlugin(new CallableDir($callableRepository), 102); $this->registerPlugin(new UserFunction()...
Register the Jaxon request plugins @return void
entailment
public static function read($sConfigFile) { $sConfigFile = realpath($sConfigFile); if(!is_readable($sConfigFile)) { throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); } $sFileContent = file_get_contents...
Read options from a JSON formatted config file @param string $sConfigFile The full path to the config file @return array
entailment
public function set(string $key, $value) { return Arr::set($this->meta, $key, $value); }
Set meta value. @param string $key @param mixed $value @return array
entailment
protected function buildFluentAttributes($name, $callback = null): array { $label = $name; if (! \is_string($label)) { $callback = $label; $name = ''; $label = ''; } elseif (\is_string($callback)) { $name = Str::lower($callback); $...
Build basic name, label and callback option. @param mixed $name @param mixed $callback @return array
entailment
public function __isset(string $key): bool { if (! \in_array($key, $this->definition['__isset'])) { throw new InvalidArgumentException("Unable to use __isset for [{$key}]."); } return isset($this->{$key}); }
Magic Method for checking dynamically-set data. @param string $key @throws \InvalidArgumentException @return bool
entailment
public function register($sType, $sClassName, $aOptions) { if($sType != $this->getName()) { return false; } if(!is_string($sClassName)) { throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); } if(is_str...
Register a callable class @param string $sType The type of request handler being registered @param string $sClassName The name of the class being registered @param array|string $aOptions The associated options @return boolean
entailment
public function canProcessRequest() { // Check the validity of the class name if(($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) || ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))) { $this->sRequ...
Check if this plugin can process the incoming Jaxon request @return boolean
entailment
public function processRequest() { if(!$this->canProcessRequest()) { return false; } // Find the requested method $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass); if(!$xCallableObject || !$xCallableObject->hasMethod($this-...
Process the incoming Jaxon request @return boolean
entailment
private function setPluginPriority(Plugin $xPlugin, $nPriority) { while (isset($this->aPlugins[$nPriority])) { $nPriority++; } $this->aPlugins[$nPriority] = $xPlugin; // Sort the array by ascending keys ksort($this->aPlugins); }
Inserts an entry into an array given the specified priority number If a plugin already exists with the given priority, the priority is automatically incremented until a free spot is found. The plugin is then inserted into the empty spot in the array. @param Plugin $xPlugin An instance of a plugi...
entailment
public function registerPlugin(Plugin $xPlugin, $nPriority = 1000) { $bIsAlert = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Alert); $bIsConfirm = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Confirm); if($xPlugin instanceof Request) { // The name of a request plugin i...
Register a plugin Below is a table for priorities and their description: - 0 thru 999: Plugins that are part of or extensions to the jaxon core - 1000 thru 8999: User created plugins, typically, these plugins don't care about order - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin ...
entailment
public function registerPackage(string $sPackageClass, Closure $xClosure) { $this->aPackages[] = $sPackageClass; jaxon()->di()->set($sPackageClass, $xClosure); }
Register a package @param string $sPackageClass The package class name @param Closure $xClosure A closure to create package instance @return void
entailment
public function register($sType, $sCallable, $aOptions = []) { if(!key_exists($sType, $this->aRequestPlugins)) { throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); } $xPlugin = $this->aRequestPlugins[$sType]; return $xPl...
Register a function, event or callable object Call the request plugin with the $sType defined as name. @param string $sType The type of request handler being registered @param string $sCallable The callable entity being registered @param array|string $aOptions The associated options...
entailment
public function registerFromConfig($xAppConfig) { // Register user functions $aFunctionsConfig = $xAppConfig->getOption('functions', []); foreach($aFunctionsConfig as $xKey => $xValue) { if(is_integer($xKey) && is_string($xValue)) { // Register...
Read and set Jaxon options from a JSON config file @param Config $xAppConfig The config options @return void
entailment
public function getResponsePlugin($sName) { if(array_key_exists($sName, $this->aResponsePlugins)) { return $this->aResponsePlugins[$sName]; } return null; }
Find the specified response plugin by name and return a reference to it if one exists @param string $sName The name of the plugin @return \Jaxon\Plugin\Response
entailment
public function getRequestPlugin($sName) { if(array_key_exists($sName, $this->aRequestPlugins)) { return $this->aRequestPlugins[$sName]; } return null; }
Find the specified request plugin by name and return a reference to it if one exists @param string $sName The name of the plugin @return \Jaxon\Plugin\Request
entailment
public function paginator($nItemsTotal, $nItemsPerPage, $nCurrentPage, $xRequest) { $paginator = Container::getInstance()->getPaginator(); $paginator->setup($nItemsTotal, $nItemsPerPage, $nCurrentPage, $xRequest); return $paginator; }
Get the pagination object for a Jaxon request @param integer $nItemsTotal The total number of items @param integer $nItemsPerPage The number of items per page page @param integer $nCurrentPage The current page @param Jaxon\Request\Request $xRe...
entailment
protected function registerOrchestraFormBuilder(): void { $this->app->singleton(FormControlContract::class, Control::class); $this->app->singleton(TemplateContract::class, function (Application $app) { $namespace = $this->hasPackageRepository() ? 'orchestra/html::form' : 'orchestra.form...
Register the Orchestra\Form builder instance. @return void
entailment
protected function bootConfiguration(): void { $config = $this->app->make('config'); $namespace = $this->hasPackageRepository() ? 'orchestra/html::' : 'orchestra.'; $this->app->make('orchestra.form')->setConfig($config->get("{$namespace}form")); $this->app->make('orchestra.table')->...
Boot extension configurations. @return void
entailment
protected function bootComponents(): void { $path = realpath(__DIR__.'/../'); $this->addConfigComponent('orchestra/html', 'orchestra/html', "{$path}/config"); $this->addViewComponent('orchestra/html', 'orchestra/html', "{$path}/resources/views"); if (! $this->hasPackageRepository()...
Boot extension components. @return void
entailment
protected function bootUsingLaravel(string $path): void { $this->mergeConfigFrom("{$path}/config/form.php", 'orchestra.form'); $this->mergeConfigFrom("{$path}/config/table.php", 'orchestra.table'); $this->publishes([ "{$path}/config/form.php" => \config_path('orchestra/form.php'...
Boot using Laravel setup. @param string $path @return void
entailment
public function addViewNamespace($sNamespace, $sDirectory, $sExtension = '') { return Container::getInstance()->getTemplate()->addNamespace($sNamespace, $sDirectory, $sExtension); }
Add a namespace to the template system @param string $sNamespace The namespace name @param string $sDirectory The namespace directory @param string $sExtension The extension to append to template names @return void
entailment
public function plugin($sName) { $xPlugin = $this->getPluginManager()->getResponsePlugin($sName); if(!$xPlugin) { return null; } $xPlugin->setResponse($this); return $xPlugin; }
Provides access to registered response plugins Pass the plugin name as the first argument and the plugin object will be returned. You can then access the methods of the plugin directly. @param string $sName The name of the plugin @return null|\Jaxon\Plugin\Response
entailment
public function addCommand($aAttributes, $mData) { /* merge commands if possible */ if(in_array($aAttributes['cmd'], array('js', 'ap'))) { if(($aLastCommand = array_pop($this->aCommands))) { if($aLastCommand['cmd'] == $aAttributes['cmd']) ...
Add a response command to the array of commands that will be sent to the browser @param array $aAttributes Associative array of attributes that will describe the command @param mixed $mData The data to be associated with this command @return \Jaxon\Plugin\Response
entailment
public function addPluginCommand($xPlugin, $aAttributes, $mData) { $aAttributes['plg'] = $xPlugin->getName(); return $this->addCommand($aAttributes, $mData); }
Add a response command that is generated by a plugin @param \Jaxon\Plugin\Plugin $xPlugin The plugin object @param array $aAttributes The attributes for this response command @param mixed $mData The data to be sent with this command @return \Jaxon\Plugin...
entailment
public function appendResponse($mCommands, $bBefore = false) { $aCommands = []; if($mCommands instanceof Response) { $this->returnValue = $mCommands->returnValue; $aCommands = $mCommands->aCommands; } elseif(is_array($mCommands)) { ...
Merge the response commands from the specified <Response> object with the response commands in this <Response> object @param Response $mCommands The <Response> object @param boolean $bBefore Add the new commands to the beginning of the list @return void
entailment
public function assign($sTarget, $sAttribute, $sData) { return $this->addCommand( array( 'cmd' => 'as', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sAttribute, " \t") ), trim((string)$sData, " \t\n") ...
Add a command to assign the specified value to the given element's attribute @param string $sTarget The id of the html element on the browser @param string $sAttribute The attribute to be assigned @param string $sData The value to be assigned to the attribute ...
entailment
public function append($sTarget, $sAttribute, $sData) { return $this->addCommand( array( 'cmd' => 'ap', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sAttribute, " \t") ), trim((string)$sData, " \t\n") ...
Add a command to append the specified data to the given element's attribute @param string $sTarget The id of the element to be updated @param string $sAttribute The name of the attribute to be appended to @param string $sData The data to be appended to the attr...
entailment
public function prepend($sTarget, $sAttribute, $sData) { return $this->addCommand( array( 'cmd' => 'pp', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sAttribute, " \t") ), trim((string)$sData, " \t\n") ...
Add a command to prepend the specified data to the given element's attribute @param string $sTarget The id of the element to be updated @param string $sAttribute The name of the attribute to be prepended to @param string $sData The value to be prepended to the ...
entailment
public function replace($sTarget, $sAttribute, $sSearch, $sData) { return $this->addCommand( array( 'cmd' => 'rp', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sAttribute, " \t") ), array( '...
Add a command to replace a specified value with another value within the given element's attribute @param string $sTarget The id of the element to update @param string $sAttribute The attribute to be updated @param string $sSearch The needle to search for @param st...
entailment
public function clear($sTarget, $sAttribute) { return $this->assign(trim((string)$sTarget, " \t"), trim((string)$sAttribute, " \t"), ''); }
Add a command to clear the specified attribute of the given element @param string $sTarget The id of the element to be updated. @param string $sAttribute The attribute to be cleared @return \Jaxon\Plugin\Response
entailment
public function contextAssign($sAttribute, $sData) { return $this->addCommand( array( 'cmd' => 'c:as', 'prop' => trim((string)$sAttribute, " \t") ), trim((string)$sData, " \t\n") ); }
Add a command to assign a value to a member of a javascript object (or element) that is specified by the context member of the request The object is referenced using the 'this' keyword in the sAttribute parameter. @param string $sAttribute The attribute to be updated @param string $sData ...
entailment
public function contextAppend($sAttribute, $sData) { return $this->addCommand( array( 'cmd' => 'c:ap', 'prop' => trim((string)$sAttribute, " \t") ), trim((string)$sData, " \t\n") ); }
Add a command to append a value onto the specified member of the javascript context object (or element) specified by the context member of the request The object is referenced using the 'this' keyword in the sAttribute parameter. @param string $sAttribute The attribute to be appended to @param strin...
entailment
public function contextPrepend($sAttribute, $sData) { return $this->addCommand( array( 'cmd' => 'c:pp', 'prop' => trim((string)$sAttribute, " \t") ), trim((string)$sData, " \t\n") ); }
Add a command to prepend the speicified data to the given member of the current javascript object specified by context in the current request The object is access via the 'this' keyword in the sAttribute parameter. @param string $sAttribute The attribute to be updated @param string $sData ...
entailment
public function redirect($sURL, $iDelay=0) { // we need to parse the query part so that the values are rawurlencode()'ed // can't just use parse_url() cos we could be dealing with a relative URL which // parse_url() can't deal with. $queryStart = strpos($sURL, '?', strrpos($sURL, '/'...
Add a command to ask the browser to navigate to the specified URL @param string $sURL The relative or fully qualified URL @param integer $iDelay Number of seconds to delay before the redirect occurs @return \Jaxon\Plugin\Response
entailment
public function call($sFunc) { $aArgs = func_get_args(); array_shift($aArgs); return $this->addCommand( array( 'cmd' => 'jc', 'func' => $sFunc ), $aArgs ); }
Add a command to call the specified javascript function with the given (optional) parameters @param string $sFunc The name of the function to call @return \Jaxon\Plugin\Response
entailment
public function create($sParent, $sTag, $sId) { return $this->addCommand( array( 'cmd' => 'ce', 'id' => trim((string)$sParent, " \t"), 'prop' => trim((string)$sId, " \t") ), trim((string)$sTag, " \t\n") ); }
Add a command to create a new element on the browser @param string $sParent The id of the parent element @param string $sTag The tag name to be used for the new element @param string $sId The id to assign to the new element @return \Jaxon\Plugin\Response
entailment
public function insert($sBefore, $sTag, $sId) { return $this->addCommand( array( 'cmd' => 'ie', 'id' => trim((string)$sBefore, " \t"), 'prop' => trim((string)$sId, " \t") ), trim((string)$sTag, " \t\n") ); }
Add a command to insert a new element just prior to the specified element @param string $sBefore The id of the element used as a reference point for the insertion @param string $sTag The tag name to be used for the new element @param string $sId The id to as...
entailment
public function insertAfter($sAfter, $sTag, $sId) { return $this->addCommand( array( 'cmd' => 'ia', 'id' => trim((string)$sAfter, " \t"), 'prop' => trim((string)$sId, " \t") ), trim((string)$sTag, " \t\n") ); }
Add a command to insert a new element after the specified @param string $sAfter The id of the element used as a reference point for the insertion @param string $sTag The tag name to be used for the new element @param string $sId The id to assign to the new ...
entailment
public function createInput($sParent, $sType, $sName, $sId) { return $this->addCommand( array( 'cmd' => 'ci', 'id' => trim((string)$sParent, " \t"), 'prop' => trim((string)$sId, " \t"), 'type' => trim((string)$sType, " \t") ...
Add a command to create an input element on the browser @param string $sParent The id of the parent element @param string $sType The type of the new input element @param string $sName The name of the new input element @param string $sId ...
entailment
public function insertInput($sBefore, $sType, $sName, $sId) { return $this->addCommand( array( 'cmd' => 'ii', 'id' => trim((string)$sBefore, " \t"), 'prop' => trim((string)$sId, " \t"), 'type' => trim((string)$sType, " \t") ...
Add a command to insert a new input element preceding the specified element @param string $sBefore The id of the element to be used as the reference point for the insertion @param string $sType The type of the new input element @param string $sName The name...
entailment
public function insertInputAfter($sAfter, $sType, $sName, $sId) { return $this->addCommand( array( 'cmd' => 'iia', 'id' => trim((string)$sAfter, " \t"), 'prop' => trim((string)$sId, " \t"), 'type' => trim((string)$sType, " \t") ...
Add a command to insert a new input element after the specified element @param string $sAfter The id of the element to be used as the reference point for the insertion @param string $sType The type of the new input element @param string $sName The name ...
entailment
public function setEvent($sTarget, $sEvent, $sScript) { return $this->addCommand( array( 'cmd' => 'ev', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sEvent, " \t") ), trim((string)$sScript, " \t\n") ...
Add a command to set an event handler on the browser @param string $sTarget The id of the element that contains the event @param string $sEvent The name of the event @param string $sScript The javascript to execute when the event is fired @return \Jaxon\Plugin...
entailment
public function addHandler($sTarget, $sEvent, $sHandler) { return $this->addCommand( array( 'cmd' => 'ah', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sEvent, " \t") ), trim((string)$sHandler, " \t\n") ...
Add a command to install an event handler on the specified element You can add more than one event handler to an element's event using this method. @param string $sTarget The id of the element @param string $sEvent The name of the event @param string $sHandler ...
entailment
public function removeHandler($sTarget, $sEvent, $sHandler) { return $this->addCommand( array( 'cmd' => 'rh', 'id' => trim((string)$sTarget, " \t"), 'prop' => trim((string)$sEvent, " \t") ), trim((string)$sHandler, " \t\n") ...
Add a command to remove an event handler from an element @param string $sTarget The id of the element @param string $sEvent The name of the event @param string $sHandler The name of the javascript function called when the event is fired @return \Jaxon\Plugin\Re...
entailment
public function setFunction($sFunction, $sArgs, $sScript) { return $this->addCommand( array( 'cmd' => 'sf', 'func' => trim((string)$sFunction, " \t"), 'prop' => trim((string)$sArgs, " \t") ), trim((string)$sScript, " \t\n") ...
Add a command to construct a javascript function on the browser @param string $sFunction The name of the function to construct @param string $sArgs Comma separated list of parameter names @param string $sScript The javascript code that will become the body of t...
entailment
public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar) { return $this->addCommand( array( 'cmd' => 'wpf', 'func' => trim((string)$sFunction, " \t"), 'prop' => trim((string)$sArgs, " \t"), 'type' => trim((strin...
Add a command to construct a wrapper function around an existing javascript function on the browser @param string $sFunction The name of the existing function to wrap @param string $sArgs The comma separated list of parameters for the function @param array $aScripts ...
entailment
public function includeScriptOnce($sFileName, $sType = null, $sId = null) { $command = array('cmd' => 'ino'); if(($sType)) $command['type'] = trim((string)$sType, " \t"); if(($sId)) $command['elm_id'] = trim((string)$sId, " \t"); return $this->addCommand($c...
Add a command to include a javascript file on the browser if it has not already been loaded @param string $sFileName The relative or fully qualified URI of the javascript file @param string $sType Determines the script type. Defaults to 'text/javascript' @return \Jaxon\Plugin\R...
entailment
public function removeScript($sFileName, $sUnload = '') { return $this->addCommand( array( 'cmd' => 'rjs', 'unld' => trim((string)$sUnload, " \t") ), trim((string)$sFileName, " \t") ); }
Add a command to remove a SCRIPT reference to a javascript file on the browser Optionally, you can call a javascript function just prior to the file being unloaded (for cleanup). @param string $sFileName The relative or fully qualified URI of the javascript file @param string $sUnload ...
entailment
public function includeCSS($sFileName, $sMedia = null) { $command = array('cmd' => 'css'); if(($sMedia)) $command['media'] = trim((string)$sMedia, " \t"); return $this->addCommand($command, trim((string)$sFileName, " \t")); }
Add a command to include a LINK reference to the specified CSS file on the browser. This will cause the browser to load and apply the style sheet. @param string $sFileName The relative or fully qualified URI of the css file @param string $sMedia The media type of the CSS file. ...
entailment
public function domRemoveChildren($parent, $skip = null, $remove = null) { $command = array('cmd' => 'DRC'); if(($skip)) $command['skip'] = $skip; if(($remove)) $command['remove'] = $remove; return $this->addCommand($command, $parent); }
Add a command to remove children from a DOM element @param string $parent The DOM parent element @param string $skip The ?? @param string $remove The ?? @return \Jaxon\Plugin\Response
entailment
public function sendHeaders() { if($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET) { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalid...
Used internally to generate the response headers @return void
entailment
public function getOutput() { $response = []; if(($this->returnValue)) { $response['jxnrv'] = $this->returnValue; } $response['jxnobj'] = []; foreach($this->aCommands as $xCommand) { $response['jxnobj'][] = $xCommand; } ...
Return the output, generated from the commands added to the response, that will be sent to the browser @return string
entailment
public function setProperties($nItemsTotal, $nItemsPerPage, $nCurrentPage) { $this->nItemsTotal = $nItemsTotal; $this->nItemsPerPage = $nItemsPerPage; $this->nCurrentPage = $nCurrentPage; return $this; }
Set the paginator properties @param integer $nItemsTotal the total number of items @param integer $nItemsPerPage the number of items per page @param integer $nCurrentPage the current page @return Paginator
entailment
private function _loadTranslations($sLanguage, $sPrefix, array $aTranslations) { foreach($aTranslations as $sName => $xTranslation) { $sName = trim($sName); $sName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName; if(!is_array($xTranslation)) { ...
Recursively load translated strings from a array @param string $sLanguage The language of the translations @param string $sPrefix The prefix for names @param array $aTranslations The translated strings @return void
entailment
public function loadTranslations($sFilePath, $sLanguage) { if(!file_exists($sFilePath)) { return; } $aTranslations = require($sFilePath); if(!is_array($aTranslations)) { return; } // Load the translations if(!array_key_e...
Load translated strings from a file @param string $sFilePath The file full path @param string $sLanguage The language of the strings in this file @return void
entailment
public function trans($sText, array $aPlaceHolders = [], $sLanguage = null) { $sText = trim((string)$sText); if(!$sLanguage) { $sLanguage = $this->xConfig->getOption('language'); } if(!$sLanguage) { $sLanguage = $this->sDefaultLocale; }...
Get a translated string @param string $sText The key of the translated string @param string $aPlaceHolders The placeholders of the translated string @param string $sLanguage The language of the translated string @return string The translated string
entailment
public function getField($row, array $templates = []): string { $value = $this->attributes['field']($row, $this, $templates); if ($value instanceof Renderable) { return $value->render(); } return $value; }
Get value of column. @param mixed $row @param array $templates @return string
entailment
public function attributes(array $value = []) { $this->attributes['attributes'] = $this->decorate( $value, $this->attributes['attributes'] ); return $this; }
Setup attributes via decorate. @param array $value @return $this
entailment
protected function filterFilename($sFilename, $sVarName) { if(($this->fFileFilter)) { $fFileFilter = $this->fFileFilter; $sFilename = (string)$fFileFilter($sFilename, $sVarName); } return $sFilename; }
Filter uploaded file name @param string $sFilename The filename @param string $sVarName The associated variable name @return string
entailment
protected function getUploadDir($sFieldId) { // Default upload dir $sDefaultUploadDir = $this->getOption('upload.default.dir'); $sUploadDir = $this->getOption('upload.files.' . $sFieldId . '.dir', $sDefaultUploadDir); $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRE...
Get the path to the upload dir @param string $sFieldId The filename @return string
entailment
protected function getUploadTempDir() { // Default upload dir $sUploadDir = $this->getOption('upload.default.dir'); $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; // Verify that the upload dir exists and is writable if(!is_writable($sUpload...
Get the path to the upload temp dir @return string
entailment
protected function getUploadTempFile() { $sUploadDir = $this->getOption('upload.default.dir'); $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR; $sUploadTempFile = $sUploadDir . $this->sTempFile . '.json'; ...
Get the path to the upload temp file @return string
entailment
protected function readFromHttpData() { // Check validity of the uploaded files $aTempFiles = []; foreach($_FILES as $sVarName => $aFile) { if(is_array($aFile['name'])) { $nFileCount = count($aFile['name']); for($i = 0; $i < $nF...
Read uploaded files info from HTTP request data @return void
entailment
protected function saveToTempFile() { // Convert uploaded file to an array $aFiles = []; foreach($this->aUserFiles as $sVarName => $aUserFiles) { $aFiles[$sVarName] = []; foreach($aUserFiles as $aUserFile) { $aFiles[$sVarName][] = ...
Save uploaded files info to a temp file @return void
entailment
protected function readFromTempFile() { // Upload temp file $sUploadTempFile = $this->getUploadTempFile(); $aFiles = json_decode(file_get_contents($sUploadTempFile), true); foreach($aFiles as $sVarName => $aUserFiles) { $this->aUserFiles[$sVarName] = []; ...
Read uploaded files info from a temp file @return void
entailment
public function processRequest() { if(!$this->canProcessRequest()) { return false; } if(count($_FILES) > 0) { $this->readFromHttpData(); } elseif(($this->sTempFile)) { $this->readFromTempFile(); } ret...
Process the uploaded files into the HTTP request @return boolean
entailment
public function ifeq($sValue1, $sValue2) { $this->sCondition = '(' . Parameter::make($sValue1) . '==' . Parameter::make($sValue2) . ')'; return $this; }
Check if a value is equal to another before sending the request @param string $sValue1 The first value to compare @param string $sValue2 The second value to compare @return Request
entailment
public function ifne($sValue1, $sValue2) { $this->sCondition = '(' . Parameter::make($sValue1) . '!=' . Parameter::make($sValue2) . ')'; return $this; }
Check if a value is not equal to another before sending the request @param string $sValue1 The first value to compare @param string $sValue2 The second value to compare @return Request
entailment
public function ifgt($sValue1, $sValue2) { $this->sCondition = '(' . Parameter::make($sValue1) . '>' . Parameter::make($sValue2) . ')'; return $this; }
Check if a value is greater than another before sending the request @param string $sValue1 The first value to compare @param string $sValue2 The second value to compare @return Request
entailment
public function ifge($sValue1, $sValue2) { $this->sCondition = '(' . Parameter::make($sValue1) . '>=' . Parameter::make($sValue2) . ')'; return $this; }
Check if a value is greater or equal to another before sending the request @param string $sValue1 The first value to compare @param string $sValue2 The second value to compare @return Request
entailment
public function iflt($sValue1, $sValue2) { $this->sCondition = '(' . Parameter::make($sValue1) . '<' . Parameter::make($sValue2) . ')'; return $this; }
Check if a value is lower than another before sending the request @param string $sValue1 The first value to compare @param string $sValue2 The second value to compare @return Request
entailment
public function ifle($sValue1, $sValue2) { $this->sCondition = '(' . Parameter::make($sValue1) . '<=' . Parameter::make($sValue2) . ')'; return $this; }
Check if a value is lower or equal to another before sending the request @param string $sValue1 The first value to compare @param string $sValue2 The second value to compare @return Request
entailment
public static function read($sConfigFile) { $sConfigFile = realpath($sConfigFile); if(!is_readable($sConfigFile)) { throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); } $aConfigOptions = include($sConfi...
Read options from a PHP config file @param string $sConfigFile The full path to the config file @return array
entailment
public function element($sSelector = '', $sContext = '') { $xElement = new Element($sSelector, $sContext); $this->addCommand(array('cmd' => 'jquery'), $xElement); return $xElement; }
Create a JQuery Element with a given selector, and link it to the current response. Since this element is linked to a response, its code will be automatically sent to the client. The returned object can be used to call jQuery functions on the selected elements. @param string $sSelector The jQuery se...
entailment
public function render(): string { $grid = $this->grid; // Add paginate value for current listing while appending query string, // however we also need to remove ?page from being added twice. $input = Arr::except($this->request->query(), [$grid->pageName]); $grid->data(); ...
{@inheritdoc}
entailment
public static function read($sConfigFile) { $sConfigFile = realpath($sConfigFile); if(!extension_loaded('yaml')) { throw new \Jaxon\Config\Exception\Yaml(jaxon_trans('config.errors.yaml.install')); } if(!is_readable($sConfigFile)) { throw new \...
Read options from a YAML formatted config file @param string $sConfigFile The full path to the config file @return array
entailment
public function checkbox(FieldContract $field): Htmlable { return $this->form->checkbox( $field->get('name'), $field->get('value'), $field->get('checked'), $field->get('attributes') ); }
Checkbox template. @param \Orchestra\Contracts\Html\Form\Field $field @return \Illuminate\Contracts\Support\Htmlable
entailment
public function checkboxes(FieldContract $field): Htmlable { return $this->form->checkboxes( $field->get('name'), $this->asArray($field->get('options')), $field->get('checked'), $field->get('attributes') ); }
Checkboxes template. @param \Orchestra\Contracts\Html\Form\Field $field @return \Illuminate\Contracts\Support\Htmlable
entailment