idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
9,500 | public function getPageUrl ( $ page , $ queryData = null , $ dropIndex = true ) { if ( is_array ( $ queryData ) ) { $ queryData = http_build_query ( $ queryData , '' , '&' ) ; } elseif ( ( $ queryData !== null ) && ! is_string ( $ queryData ) ) { throw new InvalidArgumentException ( 'Argument 2 passed to ' . get_called... | Returns the URL to a given page |
9,501 | public function getPageId ( $ path ) { $ contentDir = $ this -> getConfig ( 'content_dir' ) ; $ contentDirLength = strlen ( $ contentDir ) ; if ( substr ( $ path , 0 , $ contentDirLength ) !== $ contentDir ) { return null ; } $ contentExt = $ this -> getConfig ( 'content_ext' ) ; $ contentExtLength = strlen ( $ content... | Returns the page ID of a given content file |
9,502 | public function getBaseThemeUrl ( ) { $ themeUrl = $ this -> getConfig ( 'theme_url' ) ; if ( $ themeUrl ) { return $ themeUrl ; } if ( isset ( $ _SERVER [ 'SCRIPT_FILENAME' ] ) && ( $ _SERVER [ 'SCRIPT_FILENAME' ] !== 'index.php' ) ) { $ basePath = dirname ( $ _SERVER [ 'SCRIPT_FILENAME' ] ) ; $ basePath = ! in_array ... | Returns the URL of the themes folder of this Pico instance |
9,503 | protected function filterVariable ( $ variable , $ filter = '' , $ options = null , $ flags = null ) { $ defaultValue = null ; if ( is_array ( $ options ) ) { $ defaultValue = isset ( $ options [ 'default' ] ) ? $ options [ 'default' ] : null ; } elseif ( $ options !== null ) { $ defaultValue = $ options ; $ options = ... | Filters a variable with a specified filter |
9,504 | public function getFiles ( $ directory , $ fileExtension = '' , $ order = self :: SORT_ASC ) { $ directory = rtrim ( $ directory , '/' ) ; $ result = array ( ) ; $ files = scandir ( $ directory , $ order ) ; $ fileExtensionLength = strlen ( $ fileExtension ) ; if ( $ files !== false ) { foreach ( $ files as $ file ) { ... | Recursively walks through a directory and returns all containing files matching the specified file extension |
9,505 | public function getAbsolutePath ( $ path ) { if ( DIRECTORY_SEPARATOR === '\\' ) { if ( preg_match ( '/^(?>[a-zA-Z]:\\\\|\\\\\\\\)/' , $ path ) !== 1 ) { $ path = $ this -> getRootDir ( ) . $ path ; } } else { if ( $ path [ 0 ] !== '/' ) { $ path = $ this -> getRootDir ( ) . $ path ; } } return rtrim ( $ path , '/\\' )... | Makes a relative path absolute to Pico s root dir |
9,506 | public function triggerEvent ( $ eventName , array $ params = array ( ) ) { foreach ( $ this -> nativePlugins as $ plugin ) { $ plugin -> handleEvent ( $ eventName , $ params ) ; } } | Triggers events on plugins using the current API version |
9,507 | public function feedback ( ) { $ adapterParams = [ ] ; $ adapterParams [ 'certificate' ] = $ this -> certificatePath ; $ adapterParams [ 'passPhrase' ] = $ this -> passPhrase ; $ pushManager = new PushManager ( $ this -> environment ) ; $ apnsAdapter = new ApnsAdapter ( $ adapterParams ) ; $ this -> feedback = $ pushMa... | Use feedback to get not registered tokens from last send and remove them from your DB |
9,508 | protected function getOpenedServiceClient ( ) { if ( ! isset ( $ this -> openedClient ) ) { $ this -> openedClient = $ this -> getOpenedClient ( new ServiceClient ( ) ) ; } return $ this -> openedClient ; } | Get opened ServiceClient |
9,509 | private function getOpenedFeedbackClient ( ) { if ( ! isset ( $ this -> feedbackClient ) ) { $ this -> feedbackClient = $ this -> getOpenedClient ( new ServiceFeedbackClient ( ) ) ; } return $ this -> feedbackClient ; } | Get opened ServiceFeedbackClient |
9,510 | public function setAdapterParameters ( array $ config = [ ] ) { if ( ! is_array ( $ config ) || empty ( $ config ) ) { throw new InvalidArgumentException ( '$config must be an associative array with at least 1 item.' ) ; } if ( $ this -> httpClient === null ) { $ this -> httpClient = new HttpClient ( ) ; $ this -> http... | Send custom parameters to the Http Adapter without overriding the Http Client . |
9,511 | private function getAdapterClassFromArgument ( $ argument ) { if ( ! class_exists ( $ adapterClass = $ argument ) && ! class_exists ( $ adapterClass = '\\Sly\\NotificationPusher\\Adapter\\' . ucfirst ( $ argument ) ) ) { throw new AdapterException ( sprintf ( 'Adapter class %s does not exist' , $ adapterClass ) ) ; } r... | Get adapter class from argument . |
9,512 | public function push ( array $ tokens = [ ] , array $ notifications = [ ] , array $ params = [ ] ) { if ( ! $ tokens || ! $ notifications ) { return null ; } $ adapterParams = [ ] ; $ deviceParams = [ ] ; $ messageParams = [ ] ; if ( isset ( $ params ) && ! empty ( $ params ) ) { if ( isset ( $ params [ 'adapter' ] ) )... | params keys adapter message device |
9,513 | private function checkDevicesTokens ( ) { $ devices = $ this -> getDevices ( ) ; $ adapter = $ this -> getAdapter ( ) ; foreach ( $ devices as $ device ) { if ( false === $ adapter -> supports ( $ device -> getToken ( ) ) ) { throw new AdapterException ( sprintf ( 'Adapter %s does not support %s token\'s device' , ( st... | Check devices tokens . |
9,514 | public function addResponse ( DeviceInterface $ device , $ response ) { $ this -> getResponses ( ) -> add ( $ device -> getToken ( ) , $ response ) ; } | adds a response |
9,515 | public function getFeedback ( AdapterInterface $ adapter ) { if ( ! $ adapter instanceof FeedbackAdapterInterface ) { throw new AdapterException ( sprintf ( '%s adapter has no dedicated "getFeedback" method' , ( string ) $ adapter ) ) ; } $ adapter -> setEnvironment ( $ this -> getEnvironment ( ) ) ; return $ adapter -... | Get feedback . |
9,516 | function gdversion ( $ full = false ) { static $ gd_version = null ; static $ gd_full_version = null ; if ( $ gd_version === null ) { if ( $ this -> function_enabled ( 'gd_info' ) ) { $ gd = gd_info ( ) ; $ gd = $ gd [ "GD Version" ] ; $ regex = "/([\d\.]+)/i" ; } else { ob_start ( ) ; phpinfo ( 8 ) ; $ gd = ob_get_con... | Returns the version of GD |
9,517 | function function_enabled ( $ func ) { static $ disabled = null ; if ( $ disabled === null ) $ disabled = array_map ( 'trim' , array_map ( 'strtolower' , explode ( ',' , ini_get ( 'disable_functions' ) ) ) ) ; static $ blacklist = null ; if ( $ blacklist === null ) $ blacklist = extension_loaded ( 'suhosin' ) ? array_m... | Checks if a function is available |
9,518 | function rmkdir ( $ path , $ mode = 0755 ) { return is_dir ( $ path ) || ( $ this -> rmkdir ( dirname ( $ path ) , $ mode ) && $ this -> _mkdir ( $ path , $ mode ) ) ; } | Creates directories recursively |
9,519 | function imagecreatenew ( $ x , $ y , $ fill = true , $ trsp = false ) { if ( $ x < 1 ) $ x = 1 ; if ( $ y < 1 ) $ y = 1 ; if ( $ this -> gdversion ( ) >= 2 && ! $ this -> image_is_palette ) { $ dst_im = imagecreatetruecolor ( $ x , $ y ) ; if ( empty ( $ this -> image_background_color ) || $ trsp ) { imagealphablendin... | Creates a container image |
9,520 | function imagetransfer ( $ src_im , $ dst_im ) { if ( is_resource ( $ dst_im ) ) imagedestroy ( $ dst_im ) ; $ dst_im = & $ src_im ; return $ dst_im ; } | Transfers an image from the container to the destination image |
9,521 | function clean ( ) { $ this -> log .= '<b>cleanup</b><br />' ; $ this -> log .= '- delete temp file ' . $ this -> file_src_pathname . '<br />' ; @ unlink ( $ this -> file_src_pathname ) ; } | Deletes the uploaded file from its temporary location |
9,522 | function imagebmp ( & $ im , $ filename = "" ) { if ( ! $ im ) return false ; $ w = imagesx ( $ im ) ; $ h = imagesy ( $ im ) ; $ result = '' ; if ( ! imageistruecolor ( $ im ) ) { $ tmp = imagecreatetruecolor ( $ w , $ h ) ; imagecopy ( $ tmp , $ im , 0 , 0 , 0 , 0 , $ w , $ h ) ; imagedestroy ( $ im ) ; $ im = & $ tm... | Saves a BMP image |
9,523 | public function initChunks ( ) { if ( ! $ this -> t_head ) { $ this -> t_head = $ this -> template -> cloneRegion ( 'Head' ) ; $ this -> t_row_master = $ this -> template -> cloneRegion ( 'Row' ) ; $ this -> t_totals = $ this -> template -> cloneRegion ( 'Totals' ) ; $ this -> t_empty = $ this -> template -> cloneRegio... | initChunks method will create one column object that will be used to render all columns in the table unless you have specified a different column object . |
9,524 | public function setFilterColumn ( $ cols = null ) { if ( ! $ this -> model ) { throw new Exception ( 'Model need to be defined in order to use column filtering.' ) ; } if ( ! $ cols ) { foreach ( $ this -> model -> elements as $ key => $ field ) { if ( isset ( $ this -> columns [ $ key ] ) && $ this -> columns [ $ key ... | Set Popup action for columns filtering . |
9,525 | public function addDecorator ( $ name , $ seed ) { if ( ! $ this -> columns [ $ name ] ) { throw new Exception ( [ 'No such column, cannot decorate' , 'name' => $ name ] ) ; } $ decorator = $ this -> _add ( $ this -> factory ( $ seed , [ 'table' => $ this ] , 'TableColumn' ) ) ; if ( ! is_array ( $ this -> columns [ $ ... | Add column Decorator . |
9,526 | public function getColumnDecorators ( $ name ) { $ dec = $ this -> columns [ $ name ] ; return is_array ( $ dec ) ? $ dec : [ $ dec ] ; } | Return array of column decorators for particular column . |
9,527 | public function decoratorFactory ( \ atk4 \ data \ Field $ f , $ seed = [ ] ) { $ seed = $ this -> mergeSeeds ( $ seed , isset ( $ f -> ui [ 'table' ] ) ? $ f -> ui [ 'table' ] : null , isset ( $ this -> typeToDecorator [ $ f -> type ] ) ? $ this -> typeToDecorator [ $ f -> type ] : null , [ $ this -> default_column ? ... | Will come up with a column object based on the field object supplied . By default will use default column . |
9,528 | public function resizableColumn ( $ fx = null , $ widths = null , $ resizerOptions = null ) { $ options = [ ] ; if ( $ fx && is_callable ( $ fx ) ) { $ cb = $ this -> add ( 'jsCallBack' ) ; $ cb -> set ( $ fx , [ 'widths' => 'widths' ] ) ; $ options [ 'uri' ] = $ cb -> getJSURL ( ) ; } elseif ( $ fx && is_array ( $ fx ... | Make columns resizable by dragging column header . |
9,529 | public function addJsPaginator ( $ ipp , $ options = [ ] , $ container = null , $ scrollRegion = 'Body' ) { $ options = array_merge ( $ options , [ 'appendTo' => 'tbody' ] ) ; return parent :: addJsPaginator ( $ ipp , $ options , $ container , $ scrollRegion ) ; } | Add a dynamic paginator i . e . when user is scrolling content . |
9,530 | public function setModel ( \ atk4 \ data \ Model $ m , $ columns = null ) { parent :: setModel ( $ m ) ; if ( $ columns === null ) { $ columns = [ ] ; foreach ( $ m -> elements as $ name => $ element ) { if ( ! $ element instanceof \ atk4 \ data \ Field ) { continue ; } if ( $ element -> isVisible ( ) ) { $ columns [ ]... | Sets data Model of Table . |
9,531 | public function updateTotals ( ) { foreach ( $ this -> totals_plan as $ key => $ val ) { if ( is_array ( $ val ) ) { $ f = $ val [ 0 ] ; if ( ! isset ( $ this -> totals [ $ key ] ) ) { $ this -> totals [ $ key ] = 0 ; } if ( $ f instanceof \ Closure ) { $ this -> totals [ $ key ] += ( $ f ( $ this -> model [ $ key ] , ... | Executed for each row if totals are enabled to add up values . |
9,532 | public function getHeaderRowHTML ( ) { $ output = [ ] ; foreach ( $ this -> columns as $ name => $ column ) { if ( is_array ( $ column ) ) { $ column = $ column [ 0 ] ; } if ( ! is_int ( $ name ) ) { $ field = $ this -> model -> getElement ( $ name ) ; $ output [ ] = $ column -> getHeaderCellHTML ( $ field ) ; } else {... | Responds with the HTML to be inserted in the header row that would contain captions of all columns . |
9,533 | public function getTotalsRowHTML ( ) { $ output = [ ] ; foreach ( $ this -> columns as $ name => $ column ) { if ( ! isset ( $ this -> totals_plan [ $ name ] ) ) { $ output [ ] = $ column -> getTag ( 'foot' , '-' ) ; continue ; } if ( is_array ( $ this -> totals_plan [ $ name ] ) ) { $ field = $ this -> model -> getEle... | Responds with HTML to be inserted in the footer row that would contain totals for all columns . |
9,534 | public function getDataRowHTML ( ) { $ output = [ ] ; foreach ( $ this -> columns as $ name => $ column ) { if ( ! is_int ( $ name ) ) { $ field = $ this -> model -> getElement ( $ name ) ; } else { $ field = null ; } if ( ! is_array ( $ column ) ) { $ column = [ $ column ] ; } $ cell = null ; $ cnt = count ( $ column ... | Collects cell templates from all the columns and combine them into row template . |
9,535 | public function _typecastSaveField ( \ atk4 \ data \ Field $ f , $ value ) { if ( $ f -> serialize ) { $ value = $ this -> serializeSaveField ( $ f , $ value ) ; } $ v = is_object ( $ value ) ? clone $ value : $ value ; switch ( $ f -> type ) { case 'boolean' : return $ v ? $ this -> yes : $ this -> no ; case 'money' :... | This method contains the logic of casting generic values into user - friendly format . |
9,536 | public function _typecastLoadField ( \ atk4 \ data \ Field $ f , $ value ) { if ( $ f -> serialize && $ value ) { try { $ new_value = $ this -> serializeLoadField ( $ f , $ value ) ; } catch ( \ Exception $ e ) { throw new Exception ( [ 'Value must be ' . $ f -> serialize , 'serializator' => $ f -> serialize , 'value' ... | Interpret user - defined input for various types . |
9,537 | public static function factoryType ( $ field ) { $ data = [ ] ; $ persistence = new Persistence_Array ( $ data ) ; $ filterDomain = 'atk4\\ui\\TableColumn\\FilterModel\Type' ; if ( empty ( $ type = $ field -> type ) ) { $ type = 'string' ; } $ class = $ filterDomain . ucfirst ( $ type ) ; if ( ! empty ( $ field -> filt... | Factory method that will return a FilerModel Type class . |
9,538 | public function afterInit ( ) { $ this -> addField ( 'name' , [ 'default' => $ this -> lookupField -> short_name , 'system' => true ] ) ; if ( isset ( $ this -> _sessionTrait ) && $ this -> _sessionTrait ) { $ this -> name = 'filter_model_' . $ this -> lookupField -> short_name ; if ( @ $ _GET [ 'atk_clear_filter' ] ) ... | Perform further initialisation . |
9,539 | protected function addTabMenuItem ( $ name ) { if ( is_object ( $ name ) ) { $ tab = $ name ; } else { $ tab = new Tab ( $ name ) ; } $ tab = $ this -> add ( [ $ tab , 'class' => [ 'item' ] ] , 'Menu' ) -> setElement ( 'a' ) -> setAttr ( 'data-tab' , $ tab -> name ) ; if ( empty ( $ this -> activeTabName ) ) { $ this -... | Add a tab menu item . |
9,540 | public function setTransition ( $ openTransition , $ closeTransition = null ) { $ this -> options [ 'openTransition' ] = $ openTransition ; if ( $ closeTransition ) { $ this -> options [ 'closeTransition' ] = $ closeTransition ; } return $ this ; } | Set open and close transition for the notifier . - any transition define in semantic ui can be used . |
9,541 | public function jsRender ( ) { if ( $ this -> attachTo ) { $ final = $ this -> attachTo -> js ( ) ; } else { $ final = new jsChain ( ) ; } $ final -> atkNotify ( $ this -> options ) ; return $ final -> jsRender ( ) ; } | Render the notifier . |
9,542 | public function set ( $ fx = [ ] , $ arg2 = null ) { if ( ! is_object ( $ fx ) && ! ( $ fx instanceof Closure ) ) { throw new Exception ( 'Error: Need to pass a function to Modal::set()' ) ; } $ this -> fx = [ $ fx ] ; $ this -> enableCallback ( ) ; return $ this ; } | Set callback function for this modal . |
9,543 | public function enableCallback ( ) { $ this -> cb_view = $ this -> add ( 'View' ) ; $ this -> cb_view -> stickyGet ( '__atk_m' , $ this -> name ) ; $ this -> cb = $ this -> cb_view -> add ( 'CallbackLater' ) ; $ this -> cb -> set ( function ( ) { if ( $ this -> cb -> triggered ( ) && $ this -> fx ) { $ this -> fx [ 0 ]... | Add View to be loaded in this modal and attach CallbackLater to it . The cb_view only will be loaded dynamically within modal div . atk - content . |
9,544 | public function setOptions ( $ options ) { if ( isset ( $ this -> options [ 'modal_option' ] ) ) { $ this -> options [ 'modal_option' ] = array_merge ( $ this -> options [ 'modal_option' ] , $ options ) ; } else { $ this -> options [ 'modal_option' ] = $ options ; } return $ this ; } | Set modal options passing an array . |
9,545 | public function addDenyAction ( $ label , $ jsAction ) { $ b = new Button ( ) ; $ b -> set ( $ label ) -> addClass ( 'red cancel' ) ; $ this -> addButtonAction ( $ b ) ; $ this -> options [ 'modal_option' ] [ 'onDeny' ] = $ jsAction ; return $ this ; } | Add a deny action to modal . |
9,546 | public function onScroll ( $ fx = null ) { if ( is_callable ( $ fx ) ) { if ( $ this -> triggered ( ) ) { $ page = $ this -> getPage ( ) ; $ this -> set ( function ( ) use ( $ fx , $ page ) { return call_user_func_array ( $ fx , [ $ page ] ) ; } ) ; } } } | Callback when container has been scroll to bottom . |
9,547 | public function sendEvent ( $ id , $ data , $ eventName ) { $ this -> sendBlock ( $ id , $ data , $ eventName ) ; $ this -> flush ( ) ; } | Output a SSE Event . |
9,548 | protected function getModelFields ( \ atk4 \ data \ Model $ model ) { $ fields = [ ] ; foreach ( $ model -> elements as $ f ) { if ( ! $ f instanceof \ atk4 \ data \ Field ) { continue ; } if ( $ f -> isEditable ( ) || $ f -> isVisible ( ) ) { $ fields [ ] = $ f -> short_name ; } } return $ fields ; } | Returns array of names of fields to automatically include them in form . This includes all editable or visible fields of the model . |
9,549 | public function getField ( $ name ) { if ( empty ( $ this -> form ) ) { throw new Exception ( [ 'Incorrect value for $form' , 'form' => $ this -> form ] ) ; } return $ this -> form -> getField ( $ name ) ; } | Return Field decorator associated with the form s field . |
9,550 | protected function initDropdown ( $ chain ) { $ settings = array_merge ( [ 'fields' => [ 'name' => 'name' , 'value' => 'id' ] , 'apiSettings' => array_merge ( [ 'url' => $ this -> getCallbackURL ( ) . '&q={query}' ] , $ this -> apiConfig ) , ] , $ this -> settings ) ; $ chain -> dropdown ( $ settings ) ; } | Override this method if you want to add more logic to the initialization of the auto - complete field . |
9,551 | public function & getTagRef ( $ tag ) { if ( $ this -> isTopTag ( $ tag ) ) { return $ this -> template ; } $ a = explode ( '#' , $ tag ) ; $ tag = array_shift ( $ a ) ; if ( ! isset ( $ this -> tags [ $ tag ] ) ) { throw $ this -> exception ( 'Tag not found in Template' ) -> addMoreInfo ( 'tag' , $ tag ) -> addMoreInf... | This is a helper method which returns reference to element of template array referenced by a said tag . |
9,552 | public function hasTag ( $ tag ) { if ( is_array ( $ tag ) ) { foreach ( $ tag as $ t ) { if ( ! $ this -> hasTag ( $ t ) ) { return false ; } } return true ; } $ a = explode ( '#' , $ tag ) ; $ tag = array_shift ( $ a ) ; return isset ( $ this -> tags [ $ tag ] ) || $ this -> isTopTag ( $ tag ) ; } | Checks if template has defined a specified tag . If multiple tags are passed in as array then return true if all of them exist . |
9,553 | protected function rebuildTagsRegion ( & $ template ) { foreach ( $ template as $ tag => & $ val ) { if ( is_numeric ( $ tag ) ) { continue ; } $ a = explode ( '#' , $ tag ) ; $ key = array_shift ( $ a ) ; $ ref = array_shift ( $ a ) ; $ this -> tags [ $ key ] [ $ ref ] = & $ val ; if ( is_array ( $ val ) ) { $ this ->... | Add tags from a specified region . |
9,554 | public function setHTML ( $ tag , $ value = null ) { return $ this -> _setOrAppend ( $ tag , $ value , false , false , true ) ; } | Set value of a tag to a HTML content . The value is set without encoding so you must be sure to sanitize . |
9,555 | public function appendHTML ( $ tag , $ value ) { return $ this -> _setOrAppend ( $ tag , $ value , false , true , true ) ; } | Add more content inside a tag . The content is appended without encoding so you must be sure to sanitize . |
9,556 | public function eachTag ( $ tag , $ callable ) { if ( ! $ this -> hasTag ( $ tag ) ) { return $ this ; } if ( is_array ( $ tag ) ) { foreach ( $ tag as $ t ) { $ this -> eachTag ( $ t , $ callable ) ; } return $ this ; } $ template = $ this -> getTagRefList ( $ tag ) ; if ( $ template != $ this -> template ) { foreach ... | Executes call - back for each matching tag in the template . |
9,557 | public function cloneRegion ( $ tag ) { if ( $ this -> isTopTag ( $ tag ) ) { return clone $ this ; } $ cl = get_class ( $ this ) ; $ n = new $ cl ( ) ; $ n -> app = $ this -> app ; $ n -> template = unserialize ( serialize ( [ '_top#1' => $ this -> get ( $ tag ) ] ) ) ; $ n -> rebuildTags ( ) ; $ n -> source = 'clone ... | Creates a new template using portion of existing template . |
9,558 | public function load ( $ filename ) { if ( $ t = $ this -> tryLoad ( $ filename ) ) { return $ t ; } throw new Exception ( [ 'Unable to read template from file' , 'cwd' => getcwd ( ) , 'file' => $ filename , ] ) ; } | Loads template from a specified file . |
9,559 | public function loadTemplateFromString ( $ str ) { $ this -> source = 'string: ' . $ str ; $ this -> template = $ this -> tags = [ ] ; if ( ! $ str ) { return ; } $ this -> tag_cnt = [ ] ; $ str = preg_replace ( '/{\$([-_:\w]+)}/' , '{\1}{/\1}' , $ str ) ; $ this -> parseTemplate ( $ str ) ; return $ this ; } | Initialize current template from the supplied string . |
9,560 | protected function parseTemplateRecursive ( & $ input , & $ template ) { if ( ! is_array ( $ input ) || empty ( $ input ) ) { return ; } while ( true ) { $ tag = current ( $ input ) ; next ( $ input ) ; if ( $ tag === false ) { break ; } $ firstChar = substr ( $ tag , 0 , 1 ) ; switch ( $ firstChar ) { case '/' : retur... | Recursively find nested tags inside a string converting them to array . |
9,561 | protected function parseTemplate ( $ str ) { $ tag = '/{([\/$]?[-_:\w]*)}/' ; $ input = preg_split ( $ tag , $ str , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; $ prefix = current ( $ input ) ; next ( $ input ) ; $ this -> template = [ $ prefix ] ; $ this -> parseTemplateRecursive ( $ input , $ this -> template ) ; } | Deploys parse recursion . |
9,562 | public function render ( $ region = null ) { if ( $ region ) { return $ this -> recursiveRender ( $ this -> get ( $ region ) ) ; } return $ this -> recursiveRender ( $ this -> template ) ; } | Render either a whole template or a specified region . Returns current contents of a template . |
9,563 | protected function recursiveRender ( $ template ) { $ output = '' ; foreach ( $ template as $ val ) { if ( is_array ( $ val ) ) { $ output .= $ this -> recursiveRender ( $ val ) ; } else { $ output .= $ val ; } } return $ output ; } | Walk through the template array collecting the values and returning them as a string . |
9,564 | public function onSelectItem ( $ fx ) { if ( is_callable ( $ fx ) ) { if ( $ this -> triggered ( ) ) { $ param = [ $ _GET [ 'id' ] , @ $ _GET [ 'item' ] ] ; $ this -> set ( function ( ) use ( $ fx , $ param ) { return call_user_func_array ( $ fx , $ param ) ; } ) ; } } } | Function to call when header menu item is select . |
9,565 | public function addSection ( $ title , $ callback = null , $ icon = 'dropdown' ) { $ section = parent :: addSection ( $ title , $ callback , $ icon ) ; return $ section -> add ( [ $ this -> formLayout , 'form' => $ this -> form ] ) ; } | Return an accordion section with a form layout associate with a form . |
9,566 | public function getSectionIdx ( $ section ) { if ( $ section instanceof \ atk4 \ ui \ AccordionSection ) { return parent :: getSectionIdx ( $ section ) ; } return parent :: getSectionIdx ( $ section -> owner ) ; } | Return a section index . |
9,567 | public function addJsPaginator ( $ ipp , $ options = [ ] , $ container = null , $ scrollRegion = null ) { $ this -> ipp = $ ipp ; $ this -> jsPaginator = $ this -> add ( [ 'jsPaginator' , 'view' => $ container , 'options' => $ options ] ) ; $ this -> model -> setLimit ( $ ipp ) ; $ this -> jsPaginator -> onScroll ( fun... | Add Dynamic paginator when scrolling content via Javascript . Will output x item in lister set per ipp until user scroll content to the end of page . When this happen content will be reload x number of items . |
9,568 | public function onReorder ( $ fx = null ) { if ( is_callable ( $ fx ) ) { if ( $ this -> triggered ( ) ) { $ sortOrders = explode ( ',' , @ $ _POST [ 'order' ] ) ; $ source = @ $ _POST [ 'source' ] ; $ newIdx = @ $ _POST [ 'new_idx' ] ; $ orgIdx = @ $ _POST [ 'org_idx' ] ; $ this -> set ( function ( ) use ( $ fx , $ so... | Callback when container has been reorder . |
9,569 | public function createAtkVue ( $ id , $ component , $ data = [ ] ) { return $ this -> service -> createAtkVue ( $ id , $ component , $ data ) ; } | Create a new Vue instance using a component managed by ATK . |
9,570 | public function createVue ( $ id , $ componentName , $ component , $ data = [ ] ) { return $ this -> service -> createVue ( $ id , $ componentName , $ component , $ data ) ; } | Create a new Vue instance using an external component . External component should be load via js file and define properly . |
9,571 | public function addCrumb ( $ section = null , $ link = null ) { if ( is_array ( $ link ) ) { $ link = $ this -> url ( $ link ) ; } $ this -> path [ ] = [ 'section' => $ section , 'link' => $ link , 'divider' => $ this -> dividerClass ] ; } | Adds a new link that will appear on the right . |
9,572 | public function addCrumbReverse ( $ section = null , $ link = null ) { array_unshift ( $ this -> path , [ 'section' => $ section , 'link' => $ link ] ) ; } | Adds a new link that will appear on the left . |
9,573 | protected function buildTemplate ( ) { $ this -> t_wrap -> del ( 'rows' ) ; $ this -> t_wrap -> appendHTML ( 'rows' , '{rows}' ) ; for ( $ row = 1 ; $ row <= $ this -> rows ; $ row ++ ) { $ this -> t_row -> del ( 'column' ) ; for ( $ col = 1 ; $ col <= $ this -> columns ; $ col ++ ) { $ this -> t_col -> set ( 'Content'... | Build and set view template . |
9,574 | public function set ( $ callback = null , $ event = null ) { if ( ! $ callback ) { throw new Exception ( 'Please specify the $callback argument' ) ; } if ( isset ( $ event ) ) { $ this -> event = $ event ; } $ this -> sse = $ this -> add ( 'jsSSE' ) ; $ this -> sse -> set ( function ( ) use ( $ callback ) { $ this -> s... | Set a callback method which will be executed with the output sent back to the terminal . |
9,575 | public function outputHTML ( $ message , $ context = [ ] ) { $ message = preg_replace_callback ( '/{([a-z0-9_-]+)}/i' , function ( $ match ) use ( $ context ) { if ( isset ( $ context [ $ match [ 1 ] ] ) && is_string ( $ context [ $ match [ 1 ] ] ) ) { return $ context [ $ match [ 1 ] ] ; } return '{' . $ match [ 1 ] .... | Output un - escaped HTML line . Use this to send HTML . |
9,576 | public function send ( $ js ) { $ this -> _output_bypass = true ; $ this -> sse -> send ( $ js ) ; $ this -> _output_bypass = false ; return $ this ; } | Executes a JavaScript action . |
9,577 | public function exec ( $ exec , $ args = [ ] ) { if ( ! $ this -> sseInProgress ) { $ this -> set ( function ( ) use ( $ exec , $ args ) { $ a = $ args ? ( ' with ' . count ( $ args ) . ' arguments' ) : '' ; $ this -> output ( '--[ Executing ' . $ exec . $ a . ' ]--------------' ) ; $ this -> exec ( $ exec , $ args ) ;... | Executes command passing along escaped arguments . |
9,578 | public function set ( $ fx = null , $ arg2 = null ) { if ( ! is_object ( $ fx ) && ! ( $ fx instanceof Closure ) ) { throw new Exception ( 'Error: Need to pass a function to Popup::set()' ) ; } if ( $ arg2 ) { throw new Exception ( 'Only one argument is needed by Popup::set()' ) ; } $ this -> cb = $ this -> add ( 'Call... | Set callback for loading content dynamically . Callback will reveive a view attach to this popup for adding content to it . |
9,579 | public function jsPopup ( ) { $ name = $ this -> triggerBy ; if ( ! is_string ( $ this -> triggerBy ) ) { $ name = '#' . $ this -> triggerBy -> name ; if ( $ this -> triggerBy instanceof FormField \ Generic ) { $ name = '#' . $ this -> triggerBy -> name . '_input' ; } } $ chain = new jQuery ( $ name ) ; $ chain -> popu... | Return js action need to display popup . When a grid is reloading this method can be call in order to display the popup once again . |
9,580 | public function setThumbnailSrc ( $ src ) { $ this -> thumbnail -> setAttr ( [ 'src' => $ src ] ) ; $ action = $ this -> thumbnail -> js ( ) ; $ action -> attr ( 'src' , $ src ) ; $ this -> addJSAction ( $ action ) ; } | Set the thumbnail img src value . |
9,581 | public function clearThumbnail ( $ defaultThumbnail = null ) { $ action = $ this -> thumbnail -> js ( ) ; if ( isset ( $ defaultThumbnail ) ) { $ action -> attr ( 'src' , $ defaultThumbnail ) ; } else { $ action -> removeAttr ( 'src' ) ; } $ this -> addJSAction ( $ action ) ; } | Clear the thumbnail src . You can also supply a default thumbnail src . |
9,582 | private function _renderArgs ( $ args = [ ] ) { return '(' . implode ( ',' , array_map ( function ( $ arg ) { if ( $ arg instanceof jsExpressionable ) { return $ arg -> jsRender ( ) ; } return $ this -> _json_encode ( $ arg ) ; } , $ args ) ) . ')' ; } | Renders JS chain arguments . |
9,583 | public function jsRender ( ) { $ ret = '' ; $ ret .= $ this -> _library ; if ( $ this -> _constructorArgs ) { $ ret .= $ this -> _renderArgs ( $ this -> _constructorArgs ) ; } foreach ( $ this -> _chain as $ chain ) { if ( is_array ( $ chain ) ) { $ ret .= '.' . $ chain [ 0 ] . $ this -> _renderArgs ( $ chain [ 1 ] ) ;... | Produce String representing this JavaScript extension . |
9,584 | public function flatternArray ( $ response ) { if ( ! is_array ( $ response ) ) { return [ $ response ] ; } $ out = [ ] ; foreach ( $ response as $ element ) { $ out = array_merge ( $ out , $ this -> flatternArray ( $ element ) ) ; } return $ out ; } | When multiple jsExpressionable s are collected inside an array and may have some degree of nesting convert it into a one - dimensional array so that it s easier for us to wrap it into a function body . |
9,585 | public function terminate ( $ ajaxec , $ msg = null , $ success = true ) { $ this -> app -> terminate ( json_encode ( [ 'success' => $ success , 'message' => $ msg , 'atkjs' => $ ajaxec ] ) ) ; } | A proper way to finish execution of AJAX response . Generates JSON which is returned to frontend . |
9,586 | public function set ( $ fx = [ ] , $ args = null ) { if ( ! is_callable ( $ fx ) ) { throw new Exception ( 'Error: Need to pass a callable function to Loader::set()' ) ; } $ this -> cb -> set ( function ( ) use ( $ fx ) { call_user_func ( $ fx , $ this ) ; $ this -> app -> terminate ( $ this -> renderJSON ( ) ) ; } ) ;... | Set callback function for this loader . |
9,587 | public function renderView ( ) { if ( ! $ this -> cb -> triggered ( ) ) { if ( $ this -> loadEvent ) { $ this -> js ( $ this -> loadEvent , $ this -> jsLoad ( ) ) ; } $ this -> add ( $ this -> shim ) ; } return parent :: renderView ( ) ; } | Automatically call the jsLoad on a supplied event unless it was already triggered or if user have invoked jsLoad manually . |
9,588 | public function addSection ( $ title , $ callback = null , $ icon = 'dropdown' ) { $ section = $ this -> add ( [ 'AccordionSection' , 'title' => $ title , 'icon' => $ icon ] ) ; if ( $ callback ) { $ section -> virtualPage = $ section -> add ( [ 'VirtualPage' , 'ui' => '' ] ) ; $ section -> virtualPage -> stickyGet ( '... | Add an accordion section . You can add static View within your section or pass a callback for dynamic content . |
9,589 | public function getSectionIdx ( $ section ) { $ idx = - 1 ; foreach ( $ this -> sections as $ key => $ accordion_section ) { if ( $ accordion_section -> name === $ section -> name ) { $ idx = $ key ; break ; } } return $ idx ; } | Return the index of an accordion section in collection . |
9,590 | public function addMenu ( $ name ) { if ( is_array ( $ name ) ) { $ label = $ name [ 0 ] ; unset ( $ name [ 0 ] ) ; } else { $ label = $ name ; $ name = [ ] ; } $ sub_menu = $ this -> add ( [ new self ( ) , 'defaultTemplate' => 'submenu.html' , 'ui' => 'dropdown' , 'in_dropdown' => true ] ) ; $ sub_menu -> set ( 'label... | Adds sub - menu . |
9,591 | public function addGroup ( $ title ) { $ group = $ this -> add ( [ new self ( ) , 'defaultTemplate' => 'menugroup.html' , 'ui' => false ] ) ; if ( is_string ( $ title ) ) { $ group -> set ( 'title' , $ title ) ; } else { if ( isset ( $ title [ 'icon' ] ) && $ title [ 'icon' ] ) { $ group -> add ( new Icon ( $ title [ '... | Adds menu group . |
9,592 | public function addMenuRight ( ) { $ menu = $ this -> add ( [ new self ( ) , 'ui' => false ] , 'RightMenu' ) ; $ menu -> removeClass ( 'item' ) -> addClass ( 'right menu' ) ; return $ menu ; } | Add right positioned menu . |
9,593 | public function add ( $ object , $ region = null ) { $ item = parent :: add ( $ object , $ region ) ; $ item -> addClass ( 'item' ) ; return $ item ; } | Add Item . |
9,594 | public function setModel ( \ atk4 \ data \ Model $ m , $ defaultFields = null ) { if ( $ defaultFields !== null ) { $ this -> fieldsDefault = $ defaultFields ; } parent :: setModel ( $ m , $ this -> fieldsRead ? : $ this -> fieldsDefault ) ; $ this -> model -> unload ( ) ; if ( $ this -> canCreate ) { $ this -> initCre... | Sets data model of CRUD . |
9,595 | public function initCreate ( ) { if ( ! $ this -> itemCreate ) { $ this -> itemCreate = $ this -> menu -> addItem ( $ this -> itemCreate ? : [ 'Add new' , 'icon' => 'plus' ] ) ; $ this -> itemCreate -> on ( 'click.atk_CRUD' , new jsModal ( 'Add new' , $ this -> pageCreate , [ $ this -> name . '_sort' => $ this -> getSo... | Initializes interface elements for new record creation . |
9,596 | public function initUpdate ( ) { $ this -> addAction ( [ 'icon' => 'edit' ] , new jsModal ( 'Edit' , $ this -> pageUpdate , [ $ this -> name => $ this -> jsRow ( ) -> data ( 'id' ) , $ this -> name . '_sort' => $ this -> getSortBy ( ) ] ) ) ; $ this -> pageUpdate -> set ( function ( ) { $ this -> model -> load ( $ this... | Initializes interface elements for editing records . |
9,597 | public function jsSave ( $ notifier ) { return [ new jsExpression ( '$(".atk-dialog-content").trigger("close")' ) , $ this -> factory ( $ notifier ) , $ this -> container -> jsReload ( [ $ this -> name . '_sort' => $ this -> getSortBy ( ) ] ) , ] ; } | Default js action when saving form . |
9,598 | public function initDelete ( ) { $ this -> addAction ( [ 'icon' => 'red trash' ] , function ( $ jschain , $ id ) { $ this -> model -> load ( $ id ) -> delete ( ) ; return $ jschain -> closest ( 'tr' ) -> transition ( 'fade left' ) ; } , 'Are you sure?' ) ; } | Initialize UI for deleting records . |
9,599 | public function set ( $ fileId = null , $ fileName = null , $ junk = null ) { $ this -> setFileId ( $ fileId ) ; if ( ! $ fileName ) { $ fileName = $ fileId ; } return $ this -> setInput ( $ fileName , $ junk ) ; } | Allow to set file id and file name - fileId will be the file id sent with onDelete callback . - fileName is the field value display to user . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.