idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
50,400 | private function createCallableObjects ( ) { foreach ( $ this -> aClassOptions as $ sClassName => $ aClassOptions ) { if ( ! key_exists ( $ sClassName , $ this -> aCallableObjects ) ) { $ this -> _getCallableObject ( $ sClassName , $ aClassOptions ) ; } } $ sDS = DIRECTORY_SEPARATOR ; foreach ( $ this -> aNamespaceOptions as $ sNamespace => $ aOptions ) { if ( key_exists ( $ sNamespace , $ this -> aNamespaces ) ) { continue ; } $ this -> aNamespaces [ $ sNamespace ] = $ sNamespace ; $ sDirectory = $ aOptions [ 'directory' ] ; $ itDir = new RecursiveDirectoryIterator ( $ sDirectory ) ; $ itFile = new RecursiveIteratorIterator ( $ itDir ) ; foreach ( $ itFile as $ xFile ) { if ( ! $ xFile -> isFile ( ) || $ xFile -> getExtension ( ) != 'php' ) { continue ; } $ sClassPath = $ sNamespace ; $ sRelativePath = substr ( $ xFile -> getPath ( ) , strlen ( $ sDirectory ) ) ; $ sRelativePath = trim ( str_replace ( $ sDS , '\\' , $ sRelativePath ) , '\\' ) ; if ( $ sRelativePath != '' ) { $ sClassPath .= '\\' . $ sRelativePath ; } $ this -> aNamespaces [ $ sClassPath ] = [ 'separator' => $ aOptions [ 'separator' ] ] ; $ sClassName = $ sClassPath . '\\' . $ xFile -> getBasename ( '.php' ) ; if ( ! key_exists ( $ sClassName , $ this -> aCallableObjects ) ) { $ aClassOptions = $ this -> getOptionsFromNamespace ( $ sClassName , $ sNamespace ) ; if ( $ aClassOptions !== null ) { $ this -> _getCallableObject ( $ sClassName , $ aClassOptions ) ; } } } } } | Create callable objects for all registered namespaces |
50,401 | protected function getRegisteredObject ( $ sClassName ) { $ xCallableObject = $ this -> getCallableObject ( $ sClassName ) ; return ( $ xCallableObject ) ? $ xCallableObject -> getRegisteredObject ( ) : null ; } | Find a user registered callable object by class name |
50,402 | public function generateHash ( ) { $ this -> createCallableObjects ( ) ; $ sHash = '' ; foreach ( $ this -> aNamespaces as $ sNamespace => $ aOptions ) { $ sHash .= $ sNamespace . $ aOptions [ 'separator' ] ; } foreach ( $ this -> aCallableObjects as $ sClassName => $ xCallableObject ) { $ sHash .= $ sClassName . implode ( '|' , $ xCallableObject -> getMethods ( ) ) ; } return md5 ( $ sHash ) ; } | Generate a hash for the registered callable objects |
50,403 | public function getScript ( ) { $ this -> createCallableObjects ( ) ; $ sPrefix = $ this -> getOption ( 'core.prefix.class' ) ; $ aJsClasses = [ ] ; $ sCode = '' ; foreach ( array_keys ( $ this -> aNamespaces ) as $ sNamespace ) { $ offset = 0 ; $ sJsNamespace = str_replace ( '\\' , '.' , $ sNamespace ) ; $ sJsNamespace .= '.Null' ; while ( ( $ dotPosition = strpos ( $ sJsNamespace , '.' , $ offset ) ) !== false ) { $ sJsClass = substr ( $ sJsNamespace , 0 , $ dotPosition ) ; if ( ! key_exists ( $ sJsClass , $ aJsClasses ) ) { $ sCode .= "$sPrefix$sJsClass = {};\n" ; $ aJsClasses [ $ sJsClass ] = $ sJsClass ; } $ offset = $ dotPosition + 1 ; } } foreach ( $ this -> aCallableObjects as $ sClassName => $ xCallableObject ) { $ aConfig = $ this -> aCallableOptions [ $ sClassName ] ; $ aCommonConfig = key_exists ( '*' , $ aConfig ) ? $ aConfig [ '*' ] : [ ] ; $ aMethods = [ ] ; foreach ( $ xCallableObject -> getMethods ( ) as $ sMethodName ) { $ aMethodConfig = key_exists ( $ sMethodName , $ aConfig ) ? array_merge ( $ aCommonConfig , $ aConfig [ $ sMethodName ] ) : $ aCommonConfig ; $ aMethods [ ] = [ 'name' => $ sMethodName , 'config' => $ aMethodConfig , ] ; } $ sCode .= $ this -> render ( 'jaxon::support/object.js' , [ 'sPrefix' => $ sPrefix , 'sClass' => $ xCallableObject -> getJsName ( ) , 'aMethods' => $ aMethods , ] ) ; } return $ sCode ; } | Generate client side javascript code for the registered callable objects |
50,404 | private function _setOptions ( array $ aOptions , $ sPrefix = '' , $ nDepth = 0 ) { $ sPrefix = trim ( ( string ) $ sPrefix ) ; $ nDepth = intval ( $ nDepth ) ; if ( $ nDepth < 0 || $ nDepth > 9 ) { throw new \ Jaxon \ Config \ Exception \ Data ( jaxon_trans ( 'config.errors.data.depth' , array ( 'key' => $ sPrefix , 'depth' => $ nDepth ) ) ) ; } foreach ( $ aOptions as $ sName => $ xOption ) { if ( is_int ( $ sName ) ) { continue ; } $ sName = trim ( $ sName ) ; $ sFullName = ( $ sPrefix ) ? $ sPrefix . '.' . $ sName : $ sName ; $ this -> aOptions [ $ sFullName ] = $ xOption ; if ( is_array ( $ xOption ) ) { $ this -> _setOptions ( $ xOption , $ sFullName , $ nDepth + 1 ) ; } } } | Recursively set Jaxon options from a data array |
50,405 | public function setOptions ( array $ aOptions , $ sKeys = '' ) { $ aKeys = explode ( '.' , ( string ) $ sKeys ) ; foreach ( $ aKeys as $ sKey ) { if ( ( $ sKey ) ) { if ( ! array_key_exists ( $ sKey , $ aOptions ) || ! is_array ( $ aOptions [ $ sKey ] ) ) { return ; } $ aOptions = $ aOptions [ $ sKey ] ; } } $ this -> _setOptions ( $ aOptions ) ; } | Set the values of an array of config options |
50,406 | public function setClassName ( $ sClass ) { $ this -> sPrefix = $ this -> getOption ( 'core.prefix.function' ) ; $ sClass = trim ( $ sClass , '.\\ ' ) ; if ( ! $ sClass ) { return $ this ; } if ( ! ( $ xCallable = $ this -> xRepository -> getCallableObject ( $ sClass ) ) ) { return $ this ; } $ this -> sPrefix = $ this -> getOption ( 'core.prefix.class' ) . $ xCallable -> getJsName ( ) . '.' ; return $ this ; } | Set the name of the class to call |
50,407 | public function setCallable ( CallableObject $ xCallable ) { $ this -> sPrefix = $ this -> getOption ( 'core.prefix.class' ) . $ xCallable -> getJsName ( ) . '.' ; return $ this ; } | Set the callable object to call |
50,408 | public function call ( $ sFunction ) { $ aArguments = func_get_args ( ) ; $ sFunction = ( string ) $ sFunction ; array_shift ( $ aArguments ) ; if ( strpos ( $ sFunction , '.' ) !== false ) { $ this -> sPrefix = $ this -> getOption ( 'core.prefix.class' ) ; } $ xRequest = new Request ( $ this -> sPrefix . $ sFunction ) ; $ xRequest -> useSingleQuote ( ) ; $ xRequest -> addParameters ( $ aArguments ) ; return $ xRequest ; } | Return the javascript call to a Jaxon function or object method |
50,409 | public function func ( $ sFunction ) { $ aArguments = func_get_args ( ) ; $ sFunction = ( string ) $ sFunction ; array_shift ( $ aArguments ) ; $ xRequest = new Request ( $ sFunction ) ; $ xRequest -> useSingleQuote ( ) ; $ xRequest -> addParameters ( $ aArguments ) ; return $ xRequest ; } | Return the javascript call to a generic function |
50,410 | public function paginate ( $ nItemsTotal , $ nItemsPerPage , $ nCurrentPage ) { $ aArgs = array_slice ( func_get_args ( ) , 3 ) ; $ request = call_user_func_array ( [ $ this , 'call' ] , $ aArgs ) ; $ paginator = jaxon ( ) -> paginator ( $ nItemsTotal , $ nItemsPerPage , $ nCurrentPage , $ request ) ; return $ paginator -> toHtml ( ) ; } | Make the pagination links for a registered Jaxon class method |
50,411 | public static function make ( $ xValue ) { if ( $ xValue instanceof Interfaces \ Parameter ) { return $ xValue ; } elseif ( is_numeric ( $ xValue ) ) { return new Parameter ( Jaxon :: NUMERIC_VALUE , $ xValue ) ; } elseif ( is_string ( $ xValue ) ) { return new Parameter ( Jaxon :: QUOTED_VALUE , $ xValue ) ; } elseif ( is_bool ( $ xValue ) ) { return new Parameter ( Jaxon :: BOOL_VALUE , $ xValue ) ; } else { return new Parameter ( Jaxon :: JS_VALUE , $ xValue ) ; } } | Create a Parameter instance using the given value |
50,412 | public function getScript ( ) { $ sJsCode = '' ; switch ( $ this -> sType ) { case Jaxon :: FORM_VALUES : $ sJsCode = $ this -> getJsCall ( 'getFormValues' , $ this -> xValue ) ; break ; case Jaxon :: INPUT_VALUE : $ sJsCode = $ this -> getJsCall ( '$' , $ this -> xValue ) . '.value' ; break ; case Jaxon :: CHECKED_VALUE : $ sJsCode = $ this -> getJsCall ( '$' , $ this -> xValue ) . '.checked' ; break ; case Jaxon :: ELEMENT_INNERHTML : $ sJsCode = $ this -> getJsCall ( '$' , $ this -> xValue ) . '.innerHTML' ; break ; case Jaxon :: QUOTED_VALUE : $ sJsCode = $ this -> getQuotedValue ( addslashes ( $ this -> xValue ) ) ; break ; case Jaxon :: BOOL_VALUE : $ sJsCode = ( $ this -> xValue ) ? 'true' : 'false' ; break ; case Jaxon :: PAGE_NUMBER : $ sJsCode = ( string ) $ this -> xValue ; break ; case Jaxon :: NUMERIC_VALUE : $ sJsCode = ( string ) $ this -> xValue ; break ; case Jaxon :: JS_VALUE : if ( is_array ( $ this -> xValue ) || is_object ( $ this -> xValue ) ) { $ sJsCode = str_replace ( [ '"' ] , [ "'" ] , json_encode ( $ this -> xValue , JSON_HEX_APOS | JSON_HEX_QUOT ) ) ; } else { $ sJsCode = ( string ) $ this -> xValue ; } break ; } return $ sJsCode ; } | Generate the javascript code . |
50,413 | public function toTempData ( ) { return [ 'type' => $ this -> sType , 'name' => $ this -> sName , 'filename' => $ this -> sFilename , 'extension' => $ this -> sExtension , 'size' => $ this -> sSize , 'path' => $ this -> sPath , ] ; } | Convert the UploadedFile instance to array . |
50,414 | public static function fromTempData ( array $ aFile ) { $ xFile = new UploadedFile ( ) ; $ xFile -> sType = $ aFile [ 'type' ] ; $ xFile -> sName = $ aFile [ 'name' ] ; $ xFile -> sFilename = $ aFile [ 'filename' ] ; $ xFile -> sExtension = $ aFile [ 'extension' ] ; $ xFile -> sSize = $ aFile [ 'size' ] ; $ xFile -> sPath = $ aFile [ 'path' ] ; return $ xFile ; } | Create an instance of this class using data from an array . |
50,415 | public function configure ( $ sName , $ sValue ) { switch ( $ sName ) { case 'class' : $ this -> xUserFunction = [ $ sValue , $ this -> xUserFunction ] ; break ; case 'alias' : $ this -> sJsFunction = $ sValue ; break ; case 'include' : $ this -> sInclude = $ sValue ; break ; default : $ this -> aConfiguration [ $ sName ] = $ sValue ; break ; } } | Set call options for this instance |
50,416 | public function getScript ( ) { $ sPrefix = $ this -> getOption ( 'core.prefix.function' ) ; $ sJsFunction = $ this -> getName ( ) ; return $ this -> render ( 'jaxon::support/function.js' , array ( 'sPrefix' => $ sPrefix , 'sAlias' => $ sJsFunction , 'sFunction' => $ sJsFunction , 'aConfig' => $ this -> aConfiguration , ) ) ; } | Generate the javascript function stub that is sent to the browser on initial page load |
50,417 | public function call ( $ aArgs = [ ] ) { if ( ( $ this -> sInclude ) ) { require_once $ this -> sInclude ; } if ( is_array ( $ this -> xUserFunction ) && is_string ( $ this -> xUserFunction [ 0 ] ) ) { $ sClassName = $ this -> xUserFunction [ 0 ] ; $ this -> xUserFunction [ 0 ] = new $ sClassName ; } return call_user_func_array ( $ this -> xUserFunction , $ aArgs ) ; } | Call the registered user function including an external file if needed and passing along the specified arguments |
50,418 | public function title ( string $ title = null ) : Htmlable { $ page = Paginator :: resolveCurrentPage ( ) ; $ data = [ 'site' => [ 'name' => $ this -> site ] , 'page' => [ 'title' => $ title , 'number' => $ page ] , ] ; $ data [ 'site' ] [ 'name' ] = $ this -> getHtmlTitleFormatForSite ( $ data ) ; $ output = $ this -> getHtmlTitleFormatForPage ( $ data ) ; return $ this -> html -> create ( 'title' , trim ( $ output ) ) ; } | Create the title . |
50,419 | public function attributable ( array $ attributes , array $ defaults = [ ] ) : string { return $ this -> attributes ( $ this -> decorate ( $ attributes , $ defaults ) ) ; } | Build a list of HTML attributes from one or two array and generate HTML attributes . |
50,420 | public function addParameters ( array $ aParameters ) { foreach ( $ aParameters as $ xParameter ) { if ( $ xParameter instanceof JsCall ) { $ this -> addParameter ( Jaxon :: JS_VALUE , 'function(){' . $ xParameter -> getScript ( ) . ';}' ) ; } else { $ this -> pushParameter ( Parameter :: make ( $ xParameter ) ) ; } } } | Add a set of parameters to this request |
50,421 | public function checkboxes ( $ name , array $ list = [ ] , $ checked = null , array $ options = [ ] , $ separator = '<br>' ) { $ group = [ ] ; $ name = \ str_replace ( '[]' , '' , $ name ) ; foreach ( $ list as $ id => $ label ) { $ group [ ] = $ this -> generateCheckboxByGroup ( $ id , $ label , $ name , $ checked , $ options ) ; } return \ implode ( $ separator , $ group ) ; } | Create a checkboxes input field . |
50,422 | protected function generateCheckboxByGroup ( $ id , $ label , $ name , $ checked , array $ options ) { $ identifier = \ sprintf ( '%s_%s' , $ name , $ id ) ; $ key = \ sprintf ( '%s[]' , $ name ) ; $ active = \ in_array ( $ id , ( array ) $ checked ) ; $ options [ 'id' ] = $ identifier ; $ control = $ this -> checkbox ( $ key , $ id , $ active , $ options ) ; $ label = $ this -> label ( $ identifier , $ label ) ; return \ implode ( ' ' , [ $ control , $ label ] ) ; } | Generate checkbox by group . |
50,423 | public function data ( ) : array { if ( empty ( $ this -> data ) && ! empty ( $ this -> model ) ) { $ this -> buildRowsFromModel ( $ this -> model ) ; } return $ this -> data ; } | Get raw data . |
50,424 | public function header ( Closure $ callback = null ) { if ( \ is_null ( $ callback ) ) { return $ this -> header ; } $ this -> header = $ callback ; return null ; } | Add or append grid header attributes . |
50,425 | public function column ( $ name , $ callback = null ) { list ( $ name , $ column ) = $ this -> buildColumn ( $ name , $ callback ) ; $ this -> columns [ ] = $ column ; $ this -> keyMap [ $ name ] = \ count ( $ this -> columns ) - 1 ; return $ column ; } | Append a new column to the table . |
50,426 | public function paginate ( $ perPage ) { if ( \ filter_var ( $ perPage , FILTER_VALIDATE_INT , [ 'options' => [ 'min_range' => 1 ] ] ) && ! \ is_bool ( $ perPage ) ) { $ this -> perPage = $ perPage ; $ this -> paginate = true ; } elseif ( \ filter_var ( $ perPage , FILTER_VALIDATE_BOOLEAN ) ) { $ this -> perPage = null ; $ this -> paginate = $ perPage ; } else { $ this -> perPage = null ; $ this -> paginate = false ; } return $ this ; } | Setup pagination . |
50,427 | public function searchable ( array $ attributes , string $ key = 'q' ) : void { $ model = $ this -> resolveQueryBuilderFromModel ( $ this -> model ) ; $ request = $ this -> app -> make ( 'request' ) ; $ value = $ request -> input ( $ key ) ; $ request -> merge ( [ "{$key}" => \ rawurlencode ( $ value ) ] ) ; $ this -> set ( 'search' , [ 'attributes' => $ attributes , 'key' => $ key , 'value' => $ value , ] ) ; $ this -> model = $ this -> setupWildcardQueryFilter ( $ model , $ value , $ attributes ) ; } | Execute searchable filter on model instance . |
50,428 | public function sortable ( array $ orderColumns = [ ] , string $ orderByKey = 'order_by' , string $ directionKey = 'direction' ) : void { $ model = $ this -> resolveQueryBuilderFromModel ( $ this -> model ) ; $ request = $ this -> app -> make ( 'request' ) ; $ orderByValue = $ request -> input ( $ orderByKey ) ; $ directionValue = $ request -> input ( $ directionKey ) ; $ this -> set ( 'filter.order_by' , [ 'key' => $ orderByKey , 'value' => $ orderByValue ] ) ; $ this -> set ( 'filter.direction' , [ 'key' => $ directionKey , 'value' => $ directionValue ] ) ; $ this -> set ( 'filter.columns' , $ orderColumns ) ; $ this -> model = $ this -> setupBasicQueryFilter ( $ model , [ 'order_by' => $ orderByValue , 'direction' => $ directionValue , 'columns' => $ orderColumns , ] ) ; } | Execute sortable query filter on model instance . |
50,429 | protected function buildModel ( $ model ) { try { $ query = $ this -> resolveQueryBuilderFromModel ( $ model ) ; } catch ( InvalidArgumentException $ e ) { $ query = $ model ; } if ( $ this -> paginate === true && \ method_exists ( $ query , 'paginate' ) ) { $ query = $ query -> paginate ( $ this -> perPage , [ '*' ] , $ this -> pageName ) ; } elseif ( $ this -> isQueryBuilder ( $ query ) ) { $ query = $ query -> get ( ) ; } return $ query ; } | Convert the model to Paginator when available or convert it to a collection . |
50,430 | protected function buildRowsFromModel ( $ model ) : void { $ this -> model = $ model = $ this -> buildModel ( $ model ) ; if ( $ model instanceof Paginator ) { $ this -> setRowsData ( $ model -> items ( ) ) ; $ this -> paginate = true ; } elseif ( $ model instanceof Collection ) { $ this -> setRowsData ( $ model -> all ( ) ) ; } elseif ( $ model instanceof Arrayable ) { $ this -> setRowsData ( $ model -> toArray ( ) ) ; } elseif ( \ is_array ( $ model ) ) { $ this -> setRowsData ( $ model ) ; } else { throw new InvalidArgumentException ( 'Unable to convert $model to array.' ) ; } } | Get rows from model instance . |
50,431 | protected function resolveQueryBuilderFromModel ( $ model ) { if ( $ this -> isEloquentModel ( $ model ) ) { return $ model -> newQuery ( ) ; } elseif ( $ this -> isEloquentRelationModel ( $ model ) ) { return $ model -> getQuery ( ) ; } elseif ( ! $ this -> isQueryBuilder ( $ model ) ) { throw new InvalidArgumentException ( 'Unable to load Query Builder from $model' ) ; } return $ model ; } | Resolve query builder from model instance . |
50,432 | public function getPages ( ) { $ pages = [ ] ; if ( $ this -> numPages <= 1 ) { return [ ] ; } if ( $ this -> numPages <= $ this -> maxPagesToShow ) { for ( $ i = 1 ; $ i <= $ this -> numPages ; $ i ++ ) { $ pages [ ] = $ this -> createPage ( $ i , $ i == $ this -> currentPage ) ; } } else { $ numAdjacents = ( int ) floor ( ( $ this -> maxPagesToShow - 3 ) / 2 ) ; if ( $ this -> currentPage + $ numAdjacents > $ this -> numPages ) { $ slidingStart = $ this -> numPages - $ this -> maxPagesToShow + 2 ; } else { $ slidingStart = $ this -> currentPage - $ numAdjacents ; } if ( $ slidingStart < 2 ) { $ slidingStart = 2 ; } $ slidingEnd = $ slidingStart + $ this -> maxPagesToShow - 3 ; if ( $ slidingEnd >= $ this -> numPages ) { $ slidingEnd = $ this -> numPages - 1 ; } $ pages [ ] = $ this -> createPage ( 1 , $ this -> currentPage == 1 ) ; if ( $ slidingStart > 2 ) { $ pages [ ] = $ this -> createPageEllipsis ( ) ; } for ( $ i = $ slidingStart ; $ i <= $ slidingEnd ; $ i ++ ) { $ pages [ ] = $ this -> createPage ( $ i , $ i == $ this -> currentPage ) ; } if ( $ slidingEnd < $ this -> numPages - 1 ) { $ pages [ ] = $ this -> createPageEllipsis ( ) ; } $ pages [ ] = $ this -> createPage ( $ this -> numPages , $ this -> currentPage == $ this -> numPages ) ; } return $ pages ; } | Get an array of paginated page data . |
50,433 | private function __convertStringToBool ( $ sValue ) { if ( strcasecmp ( $ sValue , 'true' ) == 0 ) { return true ; } if ( strcasecmp ( $ sValue , 'false' ) == 0 ) { return false ; } if ( is_numeric ( $ sValue ) ) { if ( $ sValue == 0 ) { return false ; } return true ; } return false ; } | Converts a string to a boolean var |
50,434 | private function __convertValue ( $ sValue ) { $ cType = substr ( $ sValue , 0 , 1 ) ; $ sValue = substr ( $ sValue , 1 ) ; switch ( $ cType ) { case 'S' : $ value = ( $ sValue === false ? '' : $ sValue ) ; break ; case 'B' : $ value = $ this -> __convertStringToBool ( $ sValue ) ; break ; case 'N' : $ value = ( $ sValue == floor ( $ sValue ) ? ( int ) $ sValue : ( float ) $ sValue ) ; break ; case '*' : default : $ value = null ; break ; } return $ value ; } | Convert an Jaxon request argument to its value |
50,435 | private function __argumentDecode ( & $ sArg ) { if ( $ sArg == '' ) { return '' ; } $ sType = 'multipart/form-data' ; $ iLen = strlen ( $ sType ) ; $ sContentType = '' ; if ( key_exists ( 'CONTENT_TYPE' , $ _SERVER ) ) { $ sContentType = substr ( $ _SERVER [ 'CONTENT_TYPE' ] , 0 , $ iLen ) ; } elseif ( key_exists ( 'HTTP_CONTENT_TYPE' , $ _SERVER ) ) { $ sContentType = substr ( $ _SERVER [ 'HTTP_CONTENT_TYPE' ] , 0 , $ iLen ) ; } if ( $ sContentType == $ sType ) { $ sArg = urldecode ( $ sArg ) ; } $ data = json_decode ( $ sArg , true ) ; if ( $ data !== null && $ sArg != $ data ) { $ sArg = $ data ; } else { $ sArg = $ this -> __convertValue ( $ sArg ) ; } } | Decode and convert an Jaxon request argument from JSON |
50,436 | private function __argumentDecodeUTF8_iconv ( & $ mArg ) { if ( is_array ( $ mArg ) ) { foreach ( $ mArg as $ sKey => & $ xArg ) { $ sNewKey = $ sKey ; $ this -> __argumentDecodeUTF8_iconv ( $ sNewKey ) ; if ( $ sNewKey != $ sKey ) { $ mArg [ $ sNewKey ] = $ xArg ; unset ( $ mArg [ $ sKey ] ) ; $ sKey = $ sNewKey ; } $ this -> __argumentDecodeUTF8_iconv ( $ xArg ) ; } } elseif ( is_string ( $ mArg ) ) { $ mArg = iconv ( "UTF-8" , $ this -> getOption ( 'core.encoding' ) . '//TRANSLIT' , $ mArg ) ; } } | Decode an Jaxon request argument and convert to UTF8 with iconv |
50,437 | private function __argumentDecodeUTF8_mb_convert_encoding ( & $ mArg ) { if ( is_array ( $ mArg ) ) { foreach ( $ mArg as $ sKey => & $ xArg ) { $ sNewKey = $ sKey ; $ this -> __argumentDecodeUTF8_mb_convert_encoding ( $ sNewKey ) ; if ( $ sNewKey != $ sKey ) { $ mArg [ $ sNewKey ] = $ xArg ; unset ( $ mArg [ $ sKey ] ) ; $ sKey = $ sNewKey ; } $ this -> __argumentDecodeUTF8_mb_convert_encoding ( $ xArg ) ; } } elseif ( is_string ( $ mArg ) ) { $ mArg = mb_convert_encoding ( $ mArg , $ this -> getOption ( 'core.encoding' ) , "UTF-8" ) ; } } | Decode an Jaxon request argument and convert to UTF8 with mb_convert_encoding |
50,438 | private function __argumentDecodeUTF8_utf8_decode ( & $ mArg ) { if ( is_array ( $ mArg ) ) { foreach ( $ mArg as $ sKey => & $ xArg ) { $ sNewKey = $ sKey ; $ this -> __argumentDecodeUTF8_utf8_decode ( $ sNewKey ) ; if ( $ sNewKey != $ sKey ) { $ mArg [ $ sNewKey ] = $ xArg ; unset ( $ mArg [ $ sKey ] ) ; $ sKey = $ sNewKey ; } $ this -> __argumentDecodeUTF8_utf8_decode ( $ xArg ) ; } } elseif ( is_string ( $ mArg ) ) { $ mArg = utf8_decode ( $ mArg ) ; } } | Decode an Jaxon request argument from UTF8 |
50,439 | public function processArguments ( ) { if ( ( $ this -> getOption ( 'core.decode_utf8' ) ) ) { $ sFunction = '' ; if ( function_exists ( 'iconv' ) ) { $ sFunction = "iconv" ; } elseif ( function_exists ( 'mb_convert_encoding' ) ) { $ sFunction = "mb_convert_encoding" ; } elseif ( $ this -> getOption ( 'core.encoding' ) == "ISO-8859-1" ) { $ sFunction = "utf8_decode" ; } else { throw new \ Jaxon \ Exception \ Error ( $ this -> trans ( 'errors.request.conversion' ) ) ; } $ mFunction = array ( & $ this , '__argumentDecodeUTF8_' . $ sFunction ) ; array_walk ( $ this -> aArgs , $ mFunction ) ; $ this -> setOption ( 'core.decode_utf8' , false ) ; } return $ this -> aArgs ; } | Return the array of arguments that were extracted and parsed from the GET or POST data |
50,440 | public function canProcessRequest ( ) { foreach ( $ this -> xPluginManager -> getRequestPlugins ( ) as $ xPlugin ) { if ( $ xPlugin -> getName ( ) != Jaxon :: FILE_UPLOAD && $ xPlugin -> canProcessRequest ( ) ) { return true ; } } return false ; } | Check if the current request can be processed |
50,441 | public function processRequest ( ) { foreach ( $ this -> xPluginManager -> getRequestPlugins ( ) as $ xPlugin ) { if ( $ xPlugin -> getName ( ) != Jaxon :: FILE_UPLOAD && $ xPlugin -> canProcessRequest ( ) ) { $ xUploadPlugin = $ this -> xPluginManager -> getRequestPlugin ( Jaxon :: FILE_UPLOAD ) ; if ( $ xUploadPlugin != null ) { $ xUploadPlugin -> processRequest ( ) ; } return $ xPlugin -> processRequest ( ) ; } } return false ; } | Process the current request |
50,442 | public function read ( $ sConfigFile ) { $ sExt = pathinfo ( $ sConfigFile , PATHINFO_EXTENSION ) ; switch ( $ sExt ) { case 'php' : $ aConfigOptions = Php :: read ( $ sConfigFile ) ; break ; case 'yaml' : case 'yml' : $ aConfigOptions = Yaml :: read ( $ sConfigFile ) ; break ; case 'json' : $ aConfigOptions = Json :: read ( $ sConfigFile ) ; break ; default : $ sErrorMsg = jaxon_trans ( 'config.errors.file.extension' , array ( 'path' => $ sConfigFile ) ) ; throw new \ Jaxon \ Config \ Exception \ File ( $ sErrorMsg ) ; } return $ aConfigOptions ; } | Read options from a config file |
50,443 | abstract public function __construct ( Request $ request , Translator $ translator , View $ view , GridContract $ grid ) ; | Create a new Builder instance . |
50,444 | public function get ( $ sClass ) { if ( $ this -> sentryContainer != null && $ this -> sentryContainer -> has ( $ sClass ) ) { return $ this -> sentryContainer -> get ( $ sClass ) ; } return $ this -> coreContainer [ $ sClass ] ; } | Get a class instance |
50,445 | public function addViewRenderer ( $ sId , $ xClosure ) { $ this -> coreContainer [ 'jaxon.sentry.view.base.' . $ sId ] = $ xClosure ; $ this -> coreContainer [ 'jaxon.sentry.view.' . $ sId ] = function ( $ c ) use ( $ sId ) { $ renderer = $ c [ 'jaxon.sentry.view.base.' . $ sId ] ; $ aNamespaces = $ this -> coreContainer [ 'jaxon.view.data.namespaces' ] ; if ( key_exists ( $ sId , $ aNamespaces ) ) { foreach ( $ aNamespaces [ $ sId ] as $ ns ) { $ renderer -> addNamespace ( $ ns [ 'namespace' ] , $ ns [ 'directory' ] , $ ns [ 'extension' ] ) ; } } return $ renderer ; } ; } | Add a view renderer |
50,446 | public function canExportJavascript ( ) { if ( ! $ this -> getOption ( 'js.app.extern' ) || ! $ this -> getOption ( 'js.app.uri' ) || ! $ this -> getOption ( 'js.app.dir' ) ) { return false ; } $ sJsAppDir = $ this -> getOption ( 'js.app.dir' ) ; if ( ! is_dir ( $ sJsAppDir ) || ! is_writable ( $ sJsAppDir ) ) { return false ; } return true ; } | Check if the javascript code generated by Jaxon can be exported to an external file |
50,447 | private function generateHash ( ) { $ sHash = jaxon ( ) -> getVersion ( ) ; foreach ( $ this -> xPluginManager -> getRequestPlugins ( ) as $ xPlugin ) { $ sHash .= $ xPlugin -> generateHash ( ) ; } foreach ( $ this -> xPluginManager -> getResponsePlugins ( ) as $ xPlugin ) { $ sHash .= $ xPlugin -> generateHash ( ) ; } return md5 ( $ sHash ) ; } | Generate a hash for all the javascript code generated by the library |
50,448 | private function getOptionVars ( ) { return [ 'sResponseType' => self :: RESPONSE_TYPE , 'sVersion' => $ this -> getOption ( 'core.version' ) , 'sLanguage' => $ this -> getOption ( 'core.language' ) , 'bLanguage' => $ this -> hasOption ( 'core.language' ) ? true : false , 'sRequestURI' => $ this -> getOption ( 'core.request.uri' ) , 'sDefaultMode' => $ this -> getOption ( 'core.request.mode' ) , 'sDefaultMethod' => $ this -> getOption ( 'core.request.method' ) , 'sCsrfMetaName' => $ this -> getOption ( 'core.request.csrf_meta' ) , 'bDebug' => $ this -> getOption ( 'core.debug.on' ) , 'bVerboseDebug' => $ this -> getOption ( 'core.debug.verbose' ) , 'sDebugOutputID' => $ this -> getOption ( 'core.debug.output_id' ) , 'nResponseQueueSize' => $ this -> getOption ( 'js.lib.queue_size' ) , 'sStatusMessages' => $ this -> getOption ( 'js.lib.show_status' ) ? 'true' : 'false' , 'sWaitCursor' => $ this -> getOption ( 'js.lib.show_cursor' ) ? 'true' : 'false' , 'sDefer' => $ this -> getOption ( 'js.app.options' ) , ] ; } | Get the correspondances between previous and current config options |
50,449 | 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 ( 'assets.include.all' ) ) { return false ; } return true ; } | Check if the assets of this plugin shall be included in Jaxon generated code |
50,450 | private function setDefaultOptions ( ) { $ this -> di ( ) -> getConfig ( ) -> setOptions ( [ 'core.version' => $ this -> getVersion ( ) , 'core.language' => 'en' , 'core.encoding' => 'utf-8' , 'core.decode_utf8' => false , 'core.prefix.function' => 'jaxon_' , 'core.prefix.class' => 'Jaxon' , 'core.request.mode' => 'asynchronous' , 'core.request.method' => 'POST' , 'core.response.merge.ap' => true , 'core.response.merge.js' => true , 'core.debug.on' => false , 'core.debug.verbose' => false , 'core.process.exit' => true , 'core.process.clean' => false , 'core.process.timeout' => 6000 , 'core.error.handle' => false , 'core.error.log_file' => '' , 'core.jquery.no_conflict' => false , 'js.lib.output_id' => 0 , 'js.lib.queue_size' => 0 , 'js.lib.load_timeout' => 2000 , 'js.lib.show_status' => false , 'js.lib.show_cursor' => true , 'js.app.dir' => '' , 'js.app.minify' => true , 'js.app.options' => '' , ] ) ; } | Set the default options of all components of the library |
50,451 | public function register ( $ sType , $ sCallable , $ aOptions = [ ] ) { return $ this -> getPluginManager ( ) -> register ( $ sType , $ sCallable , $ aOptions ) ; } | Register request handlers including functions callable classes and directories . |
50,452 | public function setup ( $ sConfigFile ) { $ aConfigOptions = $ this -> config ( ) -> read ( $ sConfigFile ) ; $ sLibKey = 'lib' ; $ xLibConfig = $ this -> di ( ) -> getConfig ( ) ; $ xLibConfig -> setOptions ( $ aConfigOptions , $ sLibKey ) ; $ sAppKey = 'app' ; $ xAppConfig = new \ Jaxon \ Config \ Config ( ) ; $ xAppConfig -> setOptions ( $ aConfigOptions , $ sAppKey ) ; $ this -> getPluginManager ( ) -> registerFromConfig ( $ xAppConfig ) ; return $ this ; } | Read config options from a config file and setup the library |
50,453 | public function processRequest ( ) { if ( headers_sent ( $ filename , $ linenumber ) ) { echo $ this -> trans ( 'errors.output.already-sent' , array ( 'location' => $ filename . ':' . $ linenumber ) ) , "\n" , $ this -> trans ( 'errors.output.advice' ) ; exit ( ) ; } if ( ! $ this -> canProcessRequest ( ) ) { return ; } $ bEndRequest = false ; $ mResult = true ; $ xResponseManager = $ this -> getResponseManager ( ) ; if ( isset ( $ this -> aProcessingEvents [ self :: PROCESSING_EVENT_BEFORE ] ) ) { $ this -> aProcessingEvents [ self :: PROCESSING_EVENT_BEFORE ] -> call ( array ( & $ bEndRequest ) ) ; } if ( ! $ bEndRequest ) { try { $ mResult = $ this -> getRequestHandler ( ) -> processRequest ( ) ; } catch ( Exception $ e ) { $ xResponseManager -> clear ( ) ; $ xResponseManager -> append ( new Response \ Response ( ) ) ; $ xResponseManager -> debug ( $ e -> getMessage ( ) ) ; $ mResult = false ; if ( $ e instanceof \ Jaxon \ Exception \ Error ) { $ sEvent = self :: PROCESSING_EVENT_INVALID ; $ aParams = array ( $ e -> getMessage ( ) ) ; } else { $ sEvent = self :: PROCESSING_EVENT_ERROR ; $ aParams = array ( $ e ) ; } if ( isset ( $ this -> aProcessingEvents [ $ sEvent ] ) ) { $ this -> aProcessingEvents [ $ sEvent ] -> call ( $ aParams ) ; } else { throw $ e ; } } } if ( ( $ this -> getOption ( 'core.process.clean' ) ) ) { $ er = error_reporting ( 0 ) ; while ( ob_get_level ( ) > 0 ) { ob_end_clean ( ) ; } error_reporting ( $ er ) ; } if ( $ mResult === true ) { if ( isset ( $ this -> aProcessingEvents [ self :: PROCESSING_EVENT_AFTER ] ) ) { $ bEndRequest = false ; $ this -> aProcessingEvents [ self :: PROCESSING_EVENT_AFTER ] -> call ( array ( $ bEndRequest ) ) ; } if ( $ xResponseManager -> hasNoResponse ( ) ) { $ xResponseManager -> append ( $ this -> getResponse ( ) ) ; } } $ xResponseManager -> printDebug ( ) ; if ( ( $ this -> getOption ( 'core.process.exit' ) ) ) { $ xResponseManager -> sendOutput ( ) ; exit ( ) ; } } | If this is a jaxon request call the requested PHP function build the response and send it back to the browser |
50,454 | public function with ( $ data ) { if ( \ is_array ( $ data ) ) { $ data = new Fluent ( $ data ) ; } $ this -> data = $ data ; return $ this ; } | Attach data . |
50,455 | 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 . |
50,456 | 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 . |
50,457 | protected function getLinks ( ) { $ sLinks = '' ; foreach ( $ this -> xPaginator -> getPages ( ) as $ page ) { if ( $ page [ 'call' ] ) { $ sTemplate = ( $ page [ 'isCurrent' ] ? 'pagination::links/current' : 'pagination::links/enabled' ) ; $ sLinks .= $ this -> xTemplate -> render ( $ sTemplate , [ 'call' => $ page [ 'call' ] , 'text' => $ page [ 'num' ] ] ) ; } else { $ sLinks .= $ this -> xTemplate -> render ( 'pagination::links/disabled' , [ 'text' => $ page [ 'num' ] ] ) ; } } return $ sLinks ; } | Render the pagination links . |
50,458 | 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 ( ) , 103 ) ; $ this -> registerPlugin ( new FileUpload ( ) , 104 ) ; } | Register the Jaxon request plugins |
50,459 | 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 ( $ sConfigFile ) ; $ aConfigOptions = json_decode ( $ sFileContent , true ) ; if ( ! is_array ( $ aConfigOptions ) ) { throw new \ Jaxon \ Config \ Exception \ File ( jaxon_trans ( 'config.errors.file.content' , array ( 'path' => $ sConfigFile ) ) ) ; } return $ aConfigOptions ; } | Read options from a JSON formatted config file |
50,460 | public function set ( string $ key , $ value ) { return Arr :: set ( $ this -> meta , $ key , $ value ) ; } | Set meta value . |
50,461 | 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 ) ; $ callback = null ; } else { $ name = Str :: lower ( $ name ) ; $ label = Str :: humanize ( $ name ) ; } return [ $ label , $ name , $ callback ] ; } | Build basic name label and callback option . |
50,462 | private function setPluginPriority ( Plugin $ xPlugin , $ nPriority ) { while ( isset ( $ this -> aPlugins [ $ nPriority ] ) ) { $ nPriority ++ ; } $ this -> aPlugins [ $ nPriority ] = $ xPlugin ; ksort ( $ this -> aPlugins ) ; } | Inserts an entry into an array given the specified priority number |
50,463 | public function registerPackage ( string $ sPackageClass , Closure $ xClosure ) { $ this -> aPackages [ ] = $ sPackageClass ; jaxon ( ) -> di ( ) -> set ( $ sPackageClass , $ xClosure ) ; } | Register a package |
50,464 | 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 $ xPlugin -> register ( $ sType , $ sCallable , $ aOptions ) ; } | Register a function event or callable object |
50,465 | public function registerFromConfig ( $ xAppConfig ) { $ aFunctionsConfig = $ xAppConfig -> getOption ( 'functions' , [ ] ) ; foreach ( $ aFunctionsConfig as $ xKey => $ xValue ) { if ( is_integer ( $ xKey ) && is_string ( $ xValue ) ) { $ this -> register ( Jaxon :: USER_FUNCTION , $ xValue ) ; } elseif ( is_string ( $ xKey ) && is_array ( $ xValue ) ) { $ this -> register ( Jaxon :: USER_FUNCTION , $ xKey , $ xValue ) ; } else { continue ; } } $ aClassesConfig = $ xAppConfig -> getOption ( 'classes' , [ ] ) ; foreach ( $ aClassesConfig as $ xKey => $ xValue ) { if ( is_integer ( $ xKey ) && is_string ( $ xValue ) ) { $ this -> register ( Jaxon :: CALLABLE_CLASS , $ xValue ) ; } elseif ( is_string ( $ xKey ) && is_array ( $ xValue ) ) { $ this -> register ( Jaxon :: CALLABLE_CLASS , $ xKey , $ xValue ) ; } elseif ( is_integer ( $ xKey ) && is_array ( $ xValue ) ) { if ( ! key_exists ( 'directory' , $ xValue ) ) { continue ; } $ sDirectory = $ xValue [ 'directory' ] ; $ aOptions = [ ] ; if ( key_exists ( 'options' , $ xValue ) && ( is_array ( $ xValue [ 'options' ] ) || is_string ( $ xValue [ 'options' ] ) ) ) { $ aOptions = $ xValue [ 'options' ] ; } if ( key_exists ( 'namespace' , $ xValue ) ) { $ aOptions [ 'namespace' ] = $ xValue [ 'namespace' ] ; } if ( key_exists ( 'separator' , $ xValue ) ) { $ aOptions [ 'separator' ] = $ xValue [ 'separator' ] ; } $ this -> register ( Jaxon :: CALLABLE_DIR , $ sDirectory , $ aOptions ) ; } else { continue ; } } } | Read and set Jaxon options from a JSON config file |
50,466 | 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 |
50,467 | 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 |
50,468 | 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 |
50,469 | 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' ; $ class = $ app -> make ( 'config' ) -> get ( "{$namespace}.presenter" , BootstrapThreePresenter :: class ) ; return $ app -> make ( $ class ) ; } ) ; $ this -> app -> singleton ( 'orchestra.form' , function ( Application $ app ) { return new FormFactory ( $ app ) ; } ) ; } | Register the Orchestra \ Form builder instance . |
50,470 | 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' ) -> setConfig ( $ config -> get ( "{$namespace}table" ) ) ; } | Boot extension configurations . |
50,471 | 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' ) , "{$path}/config/table.php" => \ config_path ( 'orchestra/table.php' ) , ] ) ; } | Boot using Laravel setup . |
50,472 | public function plugin ( $ sName ) { $ xPlugin = $ this -> getPluginManager ( ) -> getResponsePlugin ( $ sName ) ; if ( ! $ xPlugin ) { return null ; } $ xPlugin -> setResponse ( $ this ) ; return $ xPlugin ; } | Provides access to registered response plugins |
50,473 | public function addCommand ( $ aAttributes , $ mData ) { if ( in_array ( $ aAttributes [ 'cmd' ] , array ( 'js' , 'ap' ) ) ) { if ( ( $ aLastCommand = array_pop ( $ this -> aCommands ) ) ) { if ( $ aLastCommand [ 'cmd' ] == $ aAttributes [ 'cmd' ] ) { if ( $ this -> getOption ( 'core.response.merge.js' ) && $ aLastCommand [ 'cmd' ] == 'js' ) { $ mData = $ aLastCommand [ 'data' ] . '; ' . $ mData ; } elseif ( $ this -> getOption ( 'core.response.merge.ap' ) && $ aLastCommand [ 'cmd' ] == 'ap' && $ aLastCommand [ 'id' ] == $ aAttributes [ 'id' ] && $ aLastCommand [ 'prop' ] == $ aAttributes [ 'prop' ] ) { $ mData = $ aLastCommand [ 'data' ] . ' ' . $ mData ; } else { $ this -> aCommands [ ] = $ aLastCommand ; } } else { $ this -> aCommands [ ] = $ aLastCommand ; } } } $ aAttributes [ 'data' ] = $ mData ; $ this -> aCommands [ ] = $ aAttributes ; return $ this ; } | Add a response command to the array of commands that will be sent to the browser |
50,474 | 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 |
50,475 | 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 |
50,476 | 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 |
50,477 | 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 |
50,478 | public function replace ( $ sTarget , $ sAttribute , $ sSearch , $ sData ) { return $ this -> addCommand ( array ( 'cmd' => 'rp' , 'id' => trim ( ( string ) $ sTarget , " \t" ) , 'prop' => trim ( ( string ) $ sAttribute , " \t" ) ) , array ( 's' => trim ( ( string ) $ sSearch , " \t\n" ) , 'r' => trim ( ( string ) $ sData , " \t\n" ) ) ) ; } | Add a command to replace a specified value with another value within the given element s attribute |
50,479 | 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 |
50,480 | 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 |
50,481 | public function redirect ( $ sURL , $ iDelay = 0 ) { $ queryStart = strpos ( $ sURL , '?' , strrpos ( $ sURL , '/' ) ) ; if ( $ queryStart !== false ) { $ queryStart ++ ; $ queryEnd = strpos ( $ sURL , '#' , $ queryStart ) ; if ( $ queryEnd === false ) $ queryEnd = strlen ( $ sURL ) ; $ queryPart = substr ( $ sURL , $ queryStart , $ queryEnd - $ queryStart ) ; parse_str ( $ queryPart , $ queryParts ) ; $ newQueryPart = "" ; if ( $ queryParts ) { $ first = true ; foreach ( $ queryParts as $ key => $ value ) { if ( $ first ) $ first = false ; else $ newQueryPart .= '&' ; $ newQueryPart .= rawurlencode ( $ key ) . '=' . rawurlencode ( $ value ) ; } } elseif ( $ _SERVER [ 'QUERY_STRING' ] ) { $ newQueryPart = rawurlencode ( $ _SERVER [ 'QUERY_STRING' ] ) ; } $ sURL = str_replace ( $ queryPart , $ newQueryPart , $ sURL ) ; } if ( $ iDelay ) $ this -> script ( 'window.setTimeout("window.location = \'' . $ sURL . '\';",' . ( $ iDelay * 1000 ) . ');' ) ; else $ this -> script ( 'window.location = "' . $ sURL . '";' ) ; return $ this ; } | Add a command to ask the browser to navigate to the specified URL |
50,482 | 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 |
50,483 | 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 |
50,484 | 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 |
50,485 | 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" ) ) , trim ( ( string ) $ sName , " \t\n" ) ) ; } | Add a command to create an input element on the browser |
50,486 | 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" ) ) , trim ( ( string ) $ sName , " \t\n" ) ) ; } | Add a command to insert a new input element preceding the specified element |
50,487 | 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" ) ) , trim ( ( string ) $ sName , " \t\n" ) ) ; } | Add a command to insert a new input element after the specified element |
50,488 | 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 |
50,489 | 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 |
50,490 | 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 |
50,491 | 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 |
50,492 | 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 ( ( string ) $ sReturnValueVar , " \t" ) ) , $ aScripts ) ; } | Add a command to construct a wrapper function around an existing javascript function on the browser |
50,493 | 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 ( $ command , trim ( ( string ) $ sFileName , " \t" ) ) ; } | Add a command to include a javascript file on the browser if it has not already been loaded |
50,494 | 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 |
50,495 | 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 . |
50,496 | 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 |
50,497 | 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-revalidate" ) ; header ( "Pragma: no-cache" ) ; } $ sCharacterSet = '' ; $ sCharacterEncoding = trim ( $ this -> getOption ( 'core.encoding' ) ) ; if ( ( $ sCharacterEncoding ) && strlen ( $ sCharacterEncoding ) > 0 ) { $ sCharacterSet = '; charset="' . trim ( $ sCharacterEncoding ) . '"' ; } header ( 'content-type: ' . $ this -> sContentType . ' ' . $ sCharacterSet ) ; } | Used internally to generate the response headers |
50,498 | public function getOutput ( ) { $ response = [ ] ; if ( ( $ this -> returnValue ) ) { $ response [ 'jxnrv' ] = $ this -> returnValue ; } $ response [ 'jxnobj' ] = [ ] ; foreach ( $ this -> aCommands as $ xCommand ) { $ response [ 'jxnobj' ] [ ] = $ xCommand ; } return json_encode ( $ response ) ; } | Return the output generated from the commands added to the response that will be sent to the browser |
50,499 | private function _loadTranslations ( $ sLanguage , $ sPrefix , array $ aTranslations ) { foreach ( $ aTranslations as $ sName => $ xTranslation ) { $ sName = trim ( $ sName ) ; $ sName = ( $ sPrefix ) ? $ sPrefix . '.' . $ sName : $ sName ; if ( ! is_array ( $ xTranslation ) ) { $ this -> aTranslations [ $ sLanguage ] [ $ sName ] = $ xTranslation ; } else { $ this -> _loadTranslations ( $ sLanguage , $ sName , $ xTranslation ) ; } } } | Recursively load translated strings from a array |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.