idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
54,600
public function getUser ( $ item = null ) { if ( isset ( $ item ) ) { return gplcart_array_get ( $ this -> current_user , $ item ) ; } return $ this -> current_user ; }
Returns a data of the current user
54,601
public function getJs ( $ position ) { $ js = $ this -> asset -> get ( 'js' , $ position ) ; if ( isset ( $ js [ 'js_settings' ] [ 'asset' ] ) ) { $ json = gplcart_json_encode ( $ js [ 'js_settings' ] [ 'asset' ] ) ; $ js [ 'js_settings' ] [ 'asset' ] = "Gplcart.settings=$json;" ; } return $ js ; }
Returns an array of JS scripts
54,602
public function configTheme ( $ key = null , $ default = null ) { if ( ! isset ( $ key ) ) { return $ this -> theme_settings ; } $ value = gplcart_array_get ( $ this -> theme_settings , $ key ) ; return isset ( $ value ) ? $ value : $ default ; }
Returns a setting from the current theme settings
54,603
public function filter ( $ string , $ filter = null ) { if ( ! isset ( $ filter ) ) { $ filter = $ this -> current_filter ; } $ delimiter = $ this -> config ( 'teaser_delimiter' , '<!--teaser ) ; $ string = str_replace ( $ delimiter , htmlspecialchars ( $ delimiter ) , $ string ) ; return $ this -> filter -> run ( $ string , $ filter ) ; }
Clean up HTML string using defined HTML filters
54,604
protected function explodeText ( $ text ) { $ delimiter = $ this -> config ( 'teaser_delimiter' , '<!--teaser ) ; $ text = str_replace ( htmlspecialchars ( $ delimiter ) , $ delimiter , $ text ) ; $ parts = array_filter ( array_map ( 'trim' , explode ( $ delimiter , $ text , 2 ) ) ) ; return array_pad ( $ parts , 2 , '' ) ; }
Explodes a text by teaser and full text
54,605
public function attributes ( array $ attributes ) { foreach ( $ attributes as $ attribute => & $ data ) { $ data = implode ( ' ' , ( array ) $ data ) ; $ data = $ attribute . '="' . htmlspecialchars ( $ data , ENT_QUOTES , 'UTF-8' ) . '"' ; } return empty ( $ attributes ) ? '' : ' ' . implode ( ' ' , $ attributes ) ; }
Formats tag attributes
54,606
public function teaser ( $ text , $ enable_filter = true , $ filter_id = null ) { $ summary = '' ; if ( $ text !== '' ) { $ parts = $ this -> explodeText ( $ text ) ; $ summary = reset ( $ parts ) ; } if ( $ summary !== '' && $ enable_filter ) { $ summary = $ this -> filter ( $ summary , $ filter_id ) ; } return $ summary ; }
Returns a string from a text before the teaser delimiter
54,607
protected function getTemplateFiles ( $ file ) { $ module_id = $ this -> theme ; if ( strpos ( $ file , '|' ) !== false ) { list ( $ module_id , $ file ) = explode ( '|' , $ file , 2 ) ; } else if ( gplcart_path_is_absolute ( $ file ) ) { $ template = substr ( $ file , 0 , ( strrpos ( $ file , '.' ) ) ) ; return array ( $ template , $ template ) ; } return array ( GC_DIR_MODULE . "/$module_id/templates/$file" , GC_DIR_MODULE . "/{$this->theme}/override/templates/$module_id/$file" ) ; }
Returns an array of full template paths without file extension
54,608
public function isPosted ( $ key = null ) { if ( isset ( $ key ) ) { $ value = $ this -> request -> post ( $ key , null ) ; return isset ( $ value ) ; } return $ this -> server -> requestMethod ( ) === 'POST' ; }
Whether the key exists in POST query or current query is POST type
54,609
public function getPosted ( $ name , $ default = null , $ filter = true , $ type = 'string' ) { return $ this -> request -> post ( $ name , $ default , $ filter , $ type ) ; }
Returns a data from POST query
54,610
public function isQuery ( $ key = null ) { $ value = $ this -> request -> get ( $ key ) ; return ! empty ( $ value ) ; }
Whether a key is presented in the GET query
54,611
public function getQuery ( $ key = null , $ default = null , $ type = 'string' ) { return $ this -> request -> get ( $ key , $ default , $ type ) ; }
Returns a GET query
54,612
protected function setThemeProperties ( ) { $ this -> theme_frontend = $ this -> config ( 'theme' , 'frontend' ) ; $ this -> theme_backend = $ this -> config ( 'theme_backend' , 'backend' ) ; if ( $ this -> is_backend ) { $ this -> theme = $ this -> theme_backend ; } elseif ( $ this -> is_install ) { $ this -> theme = $ this -> theme_frontend ; } elseif ( ! empty ( $ this -> current_store ) ) { $ this -> theme_frontend = $ this -> store -> getConfig ( 'theme' ) ; $ this -> theme = $ this -> theme_frontend ; } $ this -> hook -> attach ( 'theme' , $ this ) ; if ( empty ( $ this -> theme ) ) { $ this -> response -> outputError404 ( ) ; } $ this -> current_theme = $ this -> module -> getInfo ( $ this -> theme ) ; if ( empty ( $ this -> current_theme ) ) { $ this -> response -> outputError404 ( ) ; } $ this -> theme_settings = ( array ) $ this -> getModuleSettings ( $ this -> theme , null , array ( ) ) ; $ this -> templates = $ this -> getDefaultTemplates ( ) ; if ( ! empty ( $ this -> current_theme [ 'data' ] [ 'templates' ] ) ) { $ this -> templates = array_merge ( $ this -> templates , $ this -> current_theme [ 'data' ] [ 'templates' ] ) ; } }
Sets theme properties
54,613
public function getModuleSettings ( $ module_id , $ key = null , $ default = null ) { return $ this -> module -> getSettings ( $ module_id , $ key , $ default ) ; }
Returns all or a single module setting
54,614
public function setData ( $ key , $ value ) { gplcart_array_set ( $ this -> data , $ key , $ value ) ; return $ this -> data ; }
Sets a template variable
54,615
public function setSubmitted ( $ key = null , $ value = null , $ filter = true ) { if ( ! isset ( $ key ) ) { if ( isset ( $ value ) ) { return $ this -> submitted = ( array ) $ value ; } $ this -> submitted = ( array ) $ this -> request -> post ( null , array ( ) , $ filter , 'array' ) ; return $ this -> submitted ; } if ( ! isset ( $ value ) && empty ( $ this -> submitted ) ) { $ this -> post_key = ( string ) $ key ; $ this -> submitted = ( array ) $ this -> request -> post ( $ key , array ( ) , $ filter , 'array' ) ; return $ this -> submitted ; } gplcart_array_set ( $ this -> submitted , $ key , $ value ) ; return $ this -> submitted ; }
Sets an array of submitted data
54,616
public function filterSubmitted ( array $ allowed ) { $ this -> submitted = array_intersect_key ( $ this -> submitted , array_flip ( $ allowed ) ) ; return $ this -> submitted ; }
Limit an array of submitted data to the allowed keys
54,617
public function setSubmittedBool ( $ key ) { $ bool = ( bool ) $ this -> getSubmitted ( $ key ) ; $ this -> setSubmitted ( $ key , $ bool ) ; return $ bool ; }
Converts a submitted value to boolean
54,618
public function setSubmittedArray ( $ key ) { $ value = $ this -> getSubmitted ( $ key ) ; if ( isset ( $ value ) && is_string ( $ value ) ) { $ array = gplcart_string_explode_multiline ( $ value ) ; $ this -> setSubmitted ( $ key , $ array ) ; return $ array ; } return array ( ) ; }
Converts a submitted value to array using multiline delimiter
54,619
public function getData ( $ key = null , $ default = null ) { if ( ! isset ( $ key ) ) { return $ this -> data ; } $ result = gplcart_array_get ( $ this -> data , $ key ) ; return isset ( $ result ) ? $ result : $ default ; }
Returns a value from an array of template variables
54,620
protected function controlCommonAccess ( ) { if ( ! $ this -> isInstall ( ) ) { if ( ! empty ( $ this -> uid ) ) { $ this -> controlAccessCredentials ( ) ; } $ this -> controlCsrf ( ) ; $ this -> controlAccessUpload ( ) ; $ this -> controlAccessRestrictedArea ( ) ; $ this -> controlAccessAdmin ( ) ; $ this -> controlAccessAccount ( ) ; } }
Controls user access to the current page
54,621
protected function controlAccessCredentials ( ) { if ( empty ( $ this -> current_user [ 'hash' ] ) || empty ( $ this -> current_user [ 'status' ] ) ) { $ this -> session -> delete ( ) ; $ this -> url -> redirect ( 'login' ) ; } if ( ! gplcart_string_equals ( $ this -> current_user [ 'hash' ] , $ this -> user -> getSession ( 'hash' ) ) ) { $ this -> session -> delete ( ) ; $ this -> url -> redirect ( 'login' ) ; } if ( $ this -> current_user [ 'role_id' ] != $ this -> user -> getRoleId ( ) ) { $ this -> session -> delete ( ) ; $ this -> url -> redirect ( 'login' ) ; } }
Controls the current user credentials such as status role password hash ...
54,622
protected function controlAccessRestrictedArea ( ) { if ( ( $ this -> is_backend || $ this -> url -> isAccount ( ) ) && empty ( $ this -> uid ) ) { $ this -> url -> redirect ( 'login' , array ( 'target' => $ this -> path ) ) ; } }
Controls access to restricted areas
54,623
protected function controlToken ( $ key = null ) { $ control = isset ( $ key ) ? isset ( $ this -> query [ $ key ] ) : ! empty ( $ this -> query ) ; if ( $ control && ( empty ( $ this -> query [ 'token' ] ) || ! gplcart_string_equals ( $ this -> token , $ this -> query [ 'token' ] ) ) ) { $ this -> response -> outputError403 ( ) ; } }
Controls token in the URL query
54,624
protected function controlAccessAdmin ( ) { if ( $ this -> is_backend && ! $ this -> isSuperadmin ( ) ) { if ( empty ( $ this -> current_user [ 'role_status' ] ) || ! $ this -> access ( 'admin' ) ) { $ this -> redirect ( '/' , $ this -> text ( 'No access' ) , 'warning' ) ; } if ( isset ( $ this -> current_route [ 'access' ] ) && ! $ this -> access ( $ this -> current_route [ 'access' ] ) ) { $ this -> setHttpStatus ( 403 ) ; } } }
Controls access to admin pages
54,625
protected function controlAccessAccount ( ) { $ account_id = $ this -> url -> getAccountId ( ) ; if ( $ account_id === false || $ this -> uid === $ account_id ) { return null ; } if ( $ this -> isSuperadmin ( $ account_id ) && ! $ this -> isSuperadmin ( ) ) { $ this -> setHttpStatus ( 403 ) ; return null ; } if ( ! $ this -> access ( 'user' ) ) { $ this -> setHttpStatus ( 403 ) ; } }
Controls access to account pages
54,626
protected function controlMaintenanceMode ( ) { $ allowed_path = $ this -> is_install || $ this -> is_backend || in_array ( $ this -> path , array ( 'login' , 'logout' , 'forgot' ) ) ; if ( $ this -> is_maintenance && ! $ allowed_path ) { if ( ! $ this -> isFront ( ) ) { $ this -> redirect ( '/' ) ; } $ this -> outputMaintenance ( ) ; } }
Switches the site to maintenance mode
54,627
public function redirect ( $ url = '' , $ message = '' , $ severity = 'info' , $ exclude_lang = false ) { $ this -> setMessage ( $ message , $ severity , true ) ; $ parsed = parse_url ( $ url ) ; $ query = array ( ) ; if ( isset ( $ parsed [ 'query' ] ) ) { parse_str ( $ parsed [ 'query' ] , $ query ) ; } $ full = strpos ( $ url , $ this -> base ) === 0 ; $ this -> url -> redirect ( $ url , ( array ) $ query , $ full , $ exclude_lang ) ; }
Redirects to a new location
54,628
protected function setJsTranslation ( array $ scripts ) { if ( ! empty ( $ this -> langcode ) && ! is_file ( $ this -> translation -> getContextJsFile ( ) ) ) { foreach ( $ scripts as $ key => $ script ) { if ( strpos ( $ key , 'system/modules/' ) === 0 && strpos ( $ key , '/vendor/' ) === false && ! empty ( $ script [ 'file' ] ) ) { $ string = file_get_contents ( $ script [ 'file' ] ) ; $ this -> translation -> createJsTranslation ( $ string ) ; } } } }
Extracts translatable strings from JS files and creates translation
54,629
protected function prepareDataOutput ( ) { $ this -> data [ '_css' ] = $ this -> getCss ( ) ; foreach ( array ( 'top' , 'bottom' ) as $ position ) { $ this -> data [ "_js_$position" ] = $ this -> getJs ( $ position ) ; $ this -> setJsTranslation ( $ this -> data [ "_js_$position" ] ) ; } $ this -> hook -> attach ( 'template.data' , $ this -> data , $ this ) ; gplcart_array_sort ( $ this -> data [ '_css' ] ) ; gplcart_array_sort ( $ this -> data [ '_js_top' ] ) ; gplcart_array_sort ( $ this -> data [ '_js_bottom' ] ) ; }
Prepare template data variables before output
54,630
protected function renderOutput ( $ templates ) { $ html = '' ; if ( ! $ this -> isInternalRoute ( ) ) { if ( ! is_array ( $ templates ) ) { $ templates = array ( 'region_content' => ( string ) $ templates ) ; } $ templates = array_merge ( $ this -> templates , $ templates ) ; $ layout = $ templates [ 'layout' ] ; unset ( $ templates [ 'layout' ] ) ; $ body = $ data = $ this -> data ; foreach ( $ templates as $ id => $ template ) { if ( strpos ( $ id , 'region_' ) === 0 ) { $ body [ $ id ] = $ this -> renderRegion ( $ id , $ template ) ; } } $ data [ '_head' ] = $ data [ '_body' ] = '' ; if ( ! empty ( $ templates [ 'head' ] ) ) { $ data [ '_head' ] = $ this -> render ( $ templates [ 'head' ] , $ this -> data ) ; } if ( ! empty ( $ templates [ 'body' ] ) ) { $ data [ '_body' ] = $ this -> render ( $ templates [ 'body' ] , $ body ) ; } $ html = $ this -> render ( $ layout , $ data , false ) ; } $ this -> hook -> attach ( 'template.output' , $ html , $ this ) ; return $ html ; }
Renders all templates before sending them to a browser
54,631
protected function renderRegion ( $ region , $ template ) { if ( ! isset ( $ this -> data [ $ region ] ) ) { return $ this -> render ( $ template , $ this -> data ) ; } $ this -> data [ $ region ] = ( array ) $ this -> data [ $ region ] ; gplcart_array_sort ( $ this -> data [ $ region ] ) ; $ items = array ( ) ; foreach ( $ this -> data [ $ region ] as $ item ) { $ items [ ] = isset ( $ item [ 'rendered' ] ) ? ( string ) $ item [ 'rendered' ] : ( string ) $ item ; } $ this -> data [ $ region ] = $ this -> render ( $ template , array ( $ region => $ items ) ) ; return $ this -> data [ $ region ] ; }
Renders a region
54,632
final public function output ( $ templates = null , array $ options = array ( ) ) { if ( empty ( $ templates ) ) { $ templates = $ this -> templates ; } $ this -> prepareDataOutput ( ) ; $ this -> prepareOutput ( $ templates , $ options ) ; $ this -> response -> outputHtml ( $ this -> renderOutput ( $ templates ) , $ options ) ; }
Outputs rendered page
54,633
public function setRegion ( $ region , $ item ) { if ( is_array ( $ item ) ) { $ template = array_shift ( $ item ) ; $ data = $ item ? reset ( $ item ) : array ( ) ; $ content = $ this -> render ( $ template , $ data ) ; } else { $ content = trim ( $ item ) ; } if ( $ content !== '' && isset ( $ this -> templates [ "region_$region" ] ) ) { $ weight = 1 ; if ( isset ( $ this -> data [ "region_$region" ] ) ) { $ weight = count ( $ this -> data [ "region_$region" ] ) + 1 ; } $ this -> data [ "region_$region" ] [ ] = array ( 'rendered' => $ content , 'weight' => $ weight ) ; } }
Adds an item to a region
54,634
public function renderPhpTemplate ( $ template , array $ data ) { extract ( $ data , EXTR_SKIP ) ; unset ( $ data ) ; ob_start ( ) ; include $ template ; return ob_get_clean ( ) ; }
Renders PHP templates
54,635
protected function setDefaultJs ( ) { foreach ( $ this -> getDefaultData ( ) as $ key => $ value ) { $ this -> setJsSettings ( ltrim ( $ key , '_' ) , $ value , 60 ) ; } $ json = gplcart_json_encode ( $ this -> translation -> loadJsTranslation ( ) ) ; $ this -> setJs ( "Gplcart.translations=$json;" ) ; }
Adds default JS
54,636
public function setJsSettings ( $ key , $ data , $ weight = null ) { $ asset = array ( 'type' => 'js' , 'weight' => $ weight , 'key' => 'js_settings' , 'merge' => 'js_settings' , 'asset' => array ( $ key => $ data ) ) ; $ this -> asset -> set ( $ asset ) ; }
Adds JSON string with JS settings
54,637
protected function getDefaultData ( ) { $ data = array ( ) ; $ data [ '_uid' ] = $ this -> uid ; $ data [ '_uri' ] = $ this -> uri ; $ data [ '_path' ] = $ this -> path ; $ data [ '_base' ] = $ this -> base ; $ data [ '_host' ] = $ this -> host ; $ data [ '_token' ] = $ this -> token ; $ data [ '_query' ] = $ this -> query ; $ data [ '_scheme' ] = $ this -> scheme ; $ data [ '_cart_uid' ] = $ this -> cart_uid ; $ data [ '_is_front' ] = $ this -> isFront ( ) ; $ data [ '_is_logged_in' ] = ! empty ( $ this -> uid ) ; $ data [ '_is_admin' ] = $ this -> access ( 'admin' ) ; $ data [ '_is_superadmin' ] = $ this -> isSuperadmin ( ) ; $ data [ '_langcode' ] = empty ( $ this -> langcode ) ? 'en' : $ this -> langcode ; $ data [ '_url' ] = $ this -> scheme . $ this -> host . $ this -> base . $ this -> path ; return $ data ; }
Returns global template variables
54,638
protected function setDefaultData ( ) { $ this -> data = array_merge ( $ this -> data , $ this -> getDefaultData ( ) ) ; $ this -> data [ '_version' ] = gplcart_version ( ) ; $ this -> data [ '_user' ] = $ this -> current_user ; $ this -> data [ '_store' ] = $ this -> current_store ; $ this -> data [ '_language' ] = $ this -> current_language ; $ this -> data [ '_maintenance' ] = $ this -> is_maintenance ; $ this -> data [ '_messages' ] = $ this -> session -> getMessage ( ) ; $ default_langcode = $ this -> language -> getDefault ( ) ; foreach ( $ this -> language -> getList ( ) as $ code => $ language ) { if ( ! empty ( $ language [ 'status' ] ) || $ code === $ default_langcode ) { $ this -> data [ '_languages' ] [ $ code ] = $ language ; } } $ this -> data [ '_store_title' ] = $ this -> store -> getTranslation ( 'title' , $ this -> langcode ) ; if ( ! empty ( $ this -> current_store [ 'data' ] [ 'logo' ] ) ) { $ this -> data [ '_store_logo' ] = $ this -> image ( $ this -> current_store [ 'data' ] [ 'logo' ] ) ; } if ( ! empty ( $ this -> current_store [ 'data' ] [ 'favicon' ] ) ) { $ this -> data [ '_store_favicon' ] = $ this -> image ( $ this -> current_store [ 'data' ] [ 'favicon' ] ) ; } $ this -> setClasses ( ) ; $ this -> setDefaultJs ( ) ; }
Sets default template variables
54,639
protected function setClasses ( ) { $ classes = array ( ) ; if ( isset ( $ this -> current_route [ 'pattern' ] ) ) { $ pattern = $ this -> current_route [ 'pattern' ] ? $ this -> current_route [ 'pattern' ] : 'front' ; foreach ( explode ( '/' , $ pattern ) as $ part ) { if ( ctype_alpha ( $ part ) ) { $ classes [ ] = "gc-$part" ; } } } if ( $ this -> is_maintenance ) { $ classes [ ] = "gc-maintenance" ; } $ this -> data [ '_classes' ] = $ classes ; }
Sets an array of body CSS classes
54,640
public function setJs ( $ script , array $ options = array ( ) ) { $ options [ 'type' ] = 'js' ; $ options [ 'asset' ] = $ script ; return $ this -> asset -> set ( $ options ) ; }
Adds a JS on the page
54,641
public function setCss ( $ css , array $ options = array ( ) ) { $ options [ 'asset' ] = $ css ; $ options [ 'type' ] = 'css' ; return $ this -> asset -> set ( $ options ) ; }
Adds a CSS on the page
54,642
public function addAssetLibrary ( $ library_id , array $ options = array ( ) ) { $ added = array ( ) ; foreach ( $ this -> library -> getFiles ( $ library_id ) as $ file ) { $ extension = pathinfo ( $ file , PATHINFO_EXTENSION ) ; if ( $ extension === 'js' ) { $ result = $ this -> setJs ( $ file , $ options ) ; } else if ( $ extension === 'css' ) { $ result = $ this -> setCss ( $ file , $ options ) ; } if ( ! empty ( $ result ) ) { $ added [ ] = $ file ; } } return $ added ; }
Adds single or multiple asset libraries
54,643
public function setMeta ( $ content ) { $ key = '_meta_tags' ; if ( ! isset ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] = array ( ) ; } $ this -> data [ $ key ] [ ] = $ content ; }
Sets a meta tag on the page
54,644
public function setBreadcrumb ( array $ breadcrumb ) { $ key = '_breadcrumbs' ; if ( ! isset ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] = array ( ) ; } $ this -> data [ $ key ] [ ] = $ breadcrumb ; }
Sets a single page breadcrumb
54,645
protected function setMetaEntity ( array $ data ) { if ( ! empty ( $ data [ 'meta_title' ] ) ) { $ this -> setTitle ( $ data [ 'meta_title' ] , false ) ; } if ( ! empty ( $ data [ 'meta_description' ] ) ) { $ this -> setMeta ( array ( 'name' => 'description' , 'content' => $ data [ 'meta_description' ] ) ) ; } $ this -> setMeta ( array ( 'rel' => 'canonical' , 'href' => $ this -> path ) ) ; }
Set meta tags on entity page
54,646
public function setHtmlFilter ( $ data ) { $ role_id = isset ( $ data [ 'role_id' ] ) ? $ data [ 'role_id' ] : 0 ; $ this -> current_filter = $ this -> filter -> getByRole ( $ role_id ) ; }
Sets HTML filter globally
54,647
public function hasErrors ( $ message = true ) { if ( empty ( $ this -> errors ) ) { return false ; } if ( $ message ) { $ this -> setMessage ( $ this -> text ( 'One or more errors occurred' ) , 'danger' ) ; } if ( isset ( $ this -> post_key ) ) { $ this -> setData ( $ this -> post_key , $ this -> submitted ) ; } return true ; }
Returns true if an error occurred and pass back to template the submitted data
54,648
public function validateComponent ( $ handler_id , array $ options = array ( ) ) { $ result = $ this -> validator -> run ( $ handler_id , $ this -> submitted , $ options ) ; if ( $ result === true ) { return array ( ) ; } return $ this -> errors = ( array ) $ result ; }
Validates a submitted set of elements
54,649
protected function validateElement ( $ field , $ handler_id , $ arguments = array ( ) ) { if ( is_array ( $ field ) ) { $ label = reset ( $ field ) ; $ field = key ( $ field ) ; } $ options = array ( 'field' => $ field , 'arguments' => ( array ) $ arguments , 'label' => empty ( $ label ) ? $ this -> text ( 'Field' ) : $ label ) ; $ result = $ this -> validator -> run ( $ handler_id , $ this -> submitted , $ options ) ; if ( $ result === true ) { return true ; } settype ( $ result , 'array' ) ; $ this -> errors = gplcart_array_merge ( $ this -> errors , $ result ) ; return false ; }
Validates a single element
54,650
public function setMessage ( $ messages , $ severity = 'info' , $ once = false ) { if ( ! empty ( $ messages ) ) { foreach ( gplcart_array_flatten ( ( array ) $ messages ) as $ message ) { if ( $ once ) { $ this -> session -> setMessage ( $ message , $ severity ) ; } else { $ this -> data [ '_messages' ] [ $ severity ] [ ] = $ message ; } } } }
Sets a message or an array of messages
54,651
public function setFilter ( array $ allowed = array ( ) , $ query = null ) { if ( ! isset ( $ query ) ) { $ query = $ this -> getFilterQuery ( ) ; } $ this -> setFilterData ( $ allowed , $ query ) ; $ this -> query_filter = array_filter ( $ query , 'is_string' ) ; }
Sets filter variables to the data array
54,652
public function getFilterQuery ( array $ default = array ( ) , $ allowed = array ( ) ) { $ query = $ this -> query ; foreach ( $ query as $ key => $ value ) { if ( ! is_string ( $ value ) ) { continue ; } if ( $ key === 'sort' && strpos ( $ value , '-' ) !== false ) { list ( $ sort , $ order ) = explode ( '-' , $ value , 2 ) ; $ query [ 'sort' ] = $ sort ; $ query [ 'order' ] = $ order ; } if ( $ value === 'any' ) { unset ( $ query [ $ key ] ) ; } } $ query += $ default ; if ( empty ( $ allowed ) ) { return $ query ; } return array_intersect_key ( $ query , array_flip ( $ allowed ) ) ; }
Returns an array of prepared GET values used for filtering and sorting
54,653
public function setPager ( array $ options ) { $ pager = $ this -> getPager ( $ options ) ; $ this -> data [ '_pager' ] = $ pager [ 'rendered' ] ; return $ pager [ 'limit' ] ; }
Sets the pager
54,654
public function getPager ( array $ options = array ( ) ) { $ options += array ( 'query' => $ this -> getFilterQuery ( ) , 'limit' => $ this -> config ( 'list_limit' , 20 ) ) ; return array ( 'rendered' => $ this -> getWidgetPager ( $ options ) , 'limit' => $ this -> pager -> getLimit ( ) ) ; }
Returns a rendered pager
54,655
public function getWidgetPager ( array $ options ) { $ options += array ( 'key' => 'p' , 'page' => 1 , 'template' => 'common/pager' , 'query' => $ this -> getQuery ( null , array ( ) , 'array' ) ) ; if ( isset ( $ options [ 'query' ] [ $ options [ 'key' ] ] ) ) { $ options [ 'page' ] = ( int ) $ options [ 'query' ] [ $ options [ 'key' ] ] ; } $ options [ 'query' ] [ $ options [ 'key' ] ] = '%num' ; $ data = array ( 'options' => $ options , 'pager' => $ this -> pager -> build ( $ options ) -> get ( ) ) ; return $ this -> render ( $ options [ 'template' ] , $ data ) ; }
Returns the rendered pager
54,656
public function routeHttp ( ) { if ( $ this -> config -> isInitialized ( ) || $ this -> url -> isInstall ( ) ) { $ this -> route -> process ( ) ; } else { $ this -> url -> redirect ( 'install' ) ; } }
Routes HTTP requests
54,657
public function get ( $ zone_id ) { $ result = null ; $ this -> hook -> attach ( 'zone.get.before' , $ zone_id , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ result = $ this -> db -> fetch ( 'SELECT * FROM zone WHERE zone_id=?' , array ( $ zone_id ) ) ; $ this -> hook -> attach ( 'zone.get.after' , $ zone_id , $ result , $ this ) ; return $ result ; }
Loads a zone from the database
54,658
public function validator ( Factory $ factory ) { if ( ! $ this -> shouldBeValidated ( ) ) { return $ factory -> make ( [ ] , [ ] ) ; } $ rules = app ( ) -> call ( [ $ this , 'rules' ] ) ; return $ factory -> make ( $ this -> all ( ) , $ rules , $ this -> messages ( ) , $ this -> attributes ( ) ) ; }
Injects validator with rules and data if validation is required
54,659
public function category ( array & $ submitted , array $ options = array ( ) ) { $ this -> options = $ options ; $ this -> submitted = & $ submitted ; $ this -> validateCategory ( ) ; $ this -> validateWeight ( ) ; $ this -> validateBool ( 'status' ) ; $ this -> validateTitle ( ) ; $ this -> validateMetaTitle ( ) ; $ this -> validateMetaDescription ( ) ; $ this -> validateDescriptionCategory ( ) ; $ this -> validateGroupCategory ( ) ; $ this -> validateParentCategory ( ) ; $ this -> validateTranslation ( ) ; $ this -> validateImages ( ) ; $ this -> validateAlias ( ) ; $ this -> validateUploadImages ( 'category' ) ; $ this -> unsetSubmitted ( 'update' ) ; return $ this -> getResult ( ) ; }
Performs full category data validation
54,660
protected function validateCategory ( ) { $ id = $ this -> getUpdatingId ( ) ; if ( $ id === false ) { return null ; } $ data = $ this -> category -> get ( $ id ) ; if ( empty ( $ data ) ) { $ this -> setErrorUnavailable ( 'update' , $ this -> translation -> text ( 'Category' ) ) ; return false ; } $ this -> setUpdating ( $ data ) ; return true ; }
Validates a category to be updated
54,661
protected function validateParentCategory ( ) { $ field = 'parent_id' ; $ value = $ this -> getSubmitted ( $ field ) ; if ( empty ( $ value ) ) { return null ; } $ label = $ this -> translation -> text ( 'Parent category' ) ; if ( ! is_numeric ( $ value ) ) { $ this -> setErrorNumeric ( $ field , $ label ) ; return false ; } $ category = $ this -> getSubmitted ( 'category' ) ; if ( isset ( $ category [ 'category_id' ] ) && $ category [ 'category_id' ] == $ value ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ parent_category = $ this -> category -> get ( $ value ) ; if ( empty ( $ parent_category [ 'category_id' ] ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } return true ; }
Validates parent category group ID
54,662
protected function validateDescriptionCategory ( ) { $ fields = array ( 'description_1' => $ this -> translation -> text ( 'First description' ) , 'description_2' => $ this -> translation -> text ( 'Second description' ) ) ; $ errors = 0 ; foreach ( $ fields as $ field => $ label ) { $ value = $ this -> getSubmitted ( $ field ) ; if ( isset ( $ value ) && mb_strlen ( $ value ) > 65535 ) { $ errors ++ ; $ this -> setErrorLengthRange ( $ field , $ label , 0 , 65535 ) ; } } return empty ( $ errors ) ; }
Validates first and second description
54,663
public function userLogOut ( ) { $ result = $ this -> user_action -> logout ( ) ; $ this -> redirect ( $ result [ 'redirect' ] , $ result [ 'message' ] , $ result [ 'severity' ] ) ; }
Logs out a user
54,664
public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ pluginManagerClass = static :: PLUGIN_MANAGER_CLASS ; $ plugins = new $ pluginManagerClass ( ) ; $ plugins -> setServiceLocator ( $ serviceLocator ) ; return $ plugins ; }
Create and return a plugin manager . Classes that extend this should provide a valid class for the PLUGIN_MANGER_CLASS constant .
54,665
public function listFile ( ) { $ this -> downloadFile ( ) ; $ this -> actionListFile ( ) ; $ this -> setTitleListFile ( ) ; $ this -> setBreadcrumbListFile ( ) ; $ this -> setFilterListFile ( ) ; $ this -> setPagerListFile ( ) ; $ this -> setData ( 'files' , $ this -> getListFile ( ) ) ; $ this -> setData ( 'entities' , $ this -> file -> getEntities ( ) ) ; $ this -> outputListFile ( ) ; }
Displays the file overview page
54,666
protected function actionListFile ( ) { list ( $ selected , $ action ) = $ this -> getPostedAction ( ) ; $ disk = $ db = 0 ; foreach ( $ selected as $ file_id ) { if ( $ action === 'delete' && $ this -> access ( 'file_delete' ) ) { $ this -> file -> deleteAll ( $ file_id , $ db , $ disk ) ; } } if ( ! empty ( $ selected ) ) { $ severity = $ disk && $ disk == $ db ? 'success' : 'warning' ; $ message = $ this -> text ( 'Deleted from database: %db, disk: %disk' , array ( '%db' => $ db , '%disk' => $ disk ) ) ; $ this -> setMessage ( $ message , $ severity ) ; } }
Applies an action to the selected files
54,667
protected function prepareListFile ( array & $ list ) { foreach ( $ list as & $ item ) { $ path = strval ( str_replace ( "\0" , "" , $ item [ 'path' ] ) ) ; $ item [ 'url' ] = '' ; if ( $ path && file_exists ( GC_DIR_FILE . '/' . $ path ) ) { $ item [ 'url' ] = $ this -> url -> file ( $ item [ 'path' ] ) ; } } }
Prepare an array of files
54,668
public function editFile ( $ file_id = null ) { $ this -> downloadFile ( ) ; $ this -> setFile ( $ file_id ) ; $ this -> setTitleEditFile ( ) ; $ this -> setBreadcrumbEditFile ( ) ; $ this -> controlAccessEditFile ( ) ; $ this -> setData ( 'file' , $ this -> data_file ) ; $ this -> setData ( 'can_delete' , $ this -> canDeleteFile ( ) ) ; $ this -> setData ( 'extensions' , $ this -> file -> supportedExtensions ( true ) ) ; $ this -> setData ( 'languages' , $ this -> language -> getList ( array ( 'enabled' => true ) ) ) ; $ this -> submitEditFile ( ) ; $ this -> outputEditFile ( ) ; }
Displays the file edit page
54,669
protected function setFile ( $ file_id ) { $ this -> data_file = array ( ) ; if ( is_numeric ( $ file_id ) ) { $ conditions = array ( 'language' => 'und' , 'file_id' => $ file_id ) ; $ this -> data_file = $ this -> file -> get ( $ conditions ) ; if ( empty ( $ this -> data_file ) ) { $ this -> outputHttpStatus ( 404 ) ; } $ this -> prepareFile ( $ this -> data_file ) ; } }
Sets a file data
54,670
protected function submitEditFile ( ) { if ( $ this -> isPosted ( 'delete' ) && isset ( $ this -> data_file [ 'file_id' ] ) ) { $ this -> deleteFile ( ) ; } else if ( $ this -> isPosted ( 'save' ) && $ this -> validateEditFile ( ) ) { if ( isset ( $ this -> data_file [ 'file_id' ] ) ) { $ this -> updateFile ( ) ; } else { $ this -> addFile ( ) ; } } }
Saves an array of submitted values
54,671
protected function deleteFile ( ) { $ this -> controlAccess ( 'file_delete' ) ; if ( $ this -> file -> deleteAll ( $ this -> data_file [ 'file_id' ] ) ) { $ this -> redirect ( 'admin/content/file' , $ this -> text ( 'File has been deleted from database and disk' ) , 'success' ) ; } $ this -> redirect ( 'admin/content/file' , $ this -> text ( 'An error occurred' ) , 'warning' ) ; }
Deletes a file from the database an disk
54,672
protected function addFile ( ) { $ this -> controlAccess ( 'file_add' ) ; if ( $ this -> file -> add ( $ this -> getSubmitted ( ) ) ) { $ this -> redirect ( 'admin/content/file' , $ this -> text ( 'File has been added' ) , 'success' ) ; } $ this -> redirect ( '' , $ this -> text ( 'File has not been added' ) , 'warning' ) ; }
Adds a new file
54,673
protected function setTitleEditFile ( ) { if ( isset ( $ this -> data_file [ 'file_id' ] ) ) { $ title = $ this -> text ( 'Edit %name' , array ( '%name' => $ this -> data_file [ 'title' ] ) ) ; } else { $ title = $ this -> text ( 'Add file' ) ; } $ this -> setTitle ( $ title ) ; }
Sets titles on the edit file page
54,674
protected function setBreadcrumbEditFile ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin' ) , 'text' => $ this -> text ( 'Dashboard' ) ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin/content/file' ) , 'text' => $ this -> text ( 'Files' ) ) ; $ this -> setBreadcrumbs ( $ breadcrumbs ) ; }
Sets breadcrumbs on the edit file page
54,675
public function getList ( ) { $ routes = & gplcart_static ( 'route.list' ) ; if ( isset ( $ routes ) ) { return $ routes ; } $ routes = ( array ) gplcart_config_get ( GC_FILE_CONFIG_ROUTE ) ; $ this -> hook -> attach ( 'route.list' , $ routes , $ this ) ; return $ routes ; }
Returns an array of all available routes
54,676
public function process ( ) { try { $ this -> processAlias ( ) ; $ this -> processRoute ( ) ; $ this -> output404 ( ) ; } catch ( Exception $ ex ) { trigger_error ( $ ex -> getMessage ( ) ) ; $ this -> response -> outputError500 ( ) ; } }
Processes the route
54,677
public function processAlias ( $ path = null ) { if ( ! isset ( $ path ) ) { $ path = $ this -> path ; } if ( $ this -> db -> isInitialized ( ) && $ this -> config -> get ( 'alias' , true ) ) { foreach ( array_keys ( $ this -> findAlias ( $ path ) ) as $ pattern ) { $ this -> callAliasController ( $ pattern , $ path , null ) ; } } }
Finds an alias for a path
54,678
protected function findAlias ( $ path ) { $ routes = $ this -> getList ( ) ; $ alias = $ this -> db -> fetch ( 'SELECT entity, entity_id FROM alias WHERE alias=?' , array ( $ path ) ) ; foreach ( $ routes as $ pattern => $ route ) { if ( isset ( $ route [ 'status' ] ) && empty ( $ route [ 'status' ] ) ) { unset ( $ routes [ $ pattern ] ) ; continue ; } if ( empty ( $ route [ 'handlers' ] [ 'alias' ] ) ) { unset ( $ routes [ $ pattern ] ) ; continue ; } $ this -> callAliasController ( $ pattern , $ path , $ alias ) ; } return $ routes ; }
Try to find and call an alias handler using the URL path
54,679
public function processRoute ( ) { foreach ( $ this -> getList ( ) as $ pattern => $ route ) { if ( isset ( $ route [ 'status' ] ) && empty ( $ route [ 'status' ] ) ) { continue ; } $ arguments = array ( ) ; if ( gplcart_path_match ( $ this -> path , $ pattern , $ arguments ) ) { $ this -> callController ( $ pattern , $ arguments ) ; } } }
Find an appropriate controller for the URL
54,680
public function aliasCallback ( $ pattern , $ path , $ alias ) { if ( ! empty ( $ alias [ 'entity' ] ) && ! empty ( $ alias [ 'entity_id' ] ) ) { if ( strpos ( $ pattern , "{$alias['entity']}/" ) === 0 ) { $ this -> callController ( $ pattern , array ( $ alias [ 'entity_id' ] ) ) ; } } if ( ! isset ( $ alias ) ) { $ arguments = array ( ) ; if ( gplcart_path_match ( $ path , $ pattern , $ arguments ) ) { $ conditions = array ( strtok ( $ pattern , '/' ) , reset ( $ arguments ) ) ; $ sql = 'SELECT alias FROM alias WHERE entity=? AND entity_id=?' ; $ alias_path = $ this -> db -> fetchColumn ( $ sql , $ conditions ) ; } if ( ! empty ( $ alias_path ) ) { $ this -> url -> redirect ( $ alias_path ) ; } } }
Route alias callback
54,681
public function callController ( $ route , array $ arguments = array ( ) ) { $ route = $ this -> set ( $ route , $ arguments ) ; $ callback = Handler :: get ( $ route , null , 'controller' ) ; if ( ! $ callback [ 0 ] instanceof Controller ) { throw new LogicException ( 'Controller must be instance of \gplcart\core\Controller' ) ; } call_user_func_array ( $ callback , $ route [ 'arguments' ] ) ; throw new LogicException ( 'An error occurred while processing the route' ) ; }
Call a controller for the route
54,682
public function callAliasController ( $ pattern , $ path , $ alias ) { $ route = $ this -> set ( $ pattern , array ( $ pattern , $ path , $ alias ) ) ; Handler :: call ( $ route , null , 'alias' , $ route [ 'arguments' ] ) ; }
Calls an alias controller for the route
54,683
public function set ( $ route , array $ arguments = array ( ) ) { if ( ! is_array ( $ route ) ) { $ pattern = $ route ; $ list = $ this -> getList ( ) ; if ( empty ( $ list [ $ pattern ] ) ) { throw new OutOfBoundsException ( "Unknown route pattern $pattern" ) ; } $ route = $ list [ $ pattern ] ; $ route += array ( 'arguments' => array ( ) , 'pattern' => $ pattern ) ; $ route [ 'simple_pattern' ] = preg_replace ( '@\(.*?\)@' , '*' , $ pattern ) ; if ( ! empty ( $ arguments ) ) { $ route [ 'arguments' ] = array_merge ( $ arguments , $ route [ 'arguments' ] ) ; } } return $ this -> route = $ route ; }
Sets a route
54,684
public function used ( array $ condition , array $ data ) { if ( ! isset ( $ data [ 'rule' ] [ 'used' ] ) ) { return false ; } return $ this -> compare ( $ data [ 'rule' ] [ 'used' ] , $ condition [ 'value' ] , $ condition [ 'operator' ] ) ; }
Returns true if the number of usage condition is met
54,685
public function shippingMethod ( array $ values ) { $ existing = array_filter ( $ values , function ( $ method_id ) { return ( bool ) $ this -> shipping -> get ( $ method_id ) ; } ) ; if ( count ( $ values ) != count ( $ existing ) ) { return $ this -> translation -> text ( '@name is unavailable' , array ( '@name' => $ this -> translation -> text ( 'Shipping' ) ) ) ; } return true ; }
Validates the shipping method condition
54,686
public function paymentMethod ( array $ values ) { $ existing = array_filter ( $ values , function ( $ method_id ) { return ( bool ) $ this -> payment -> get ( $ method_id ) ; } ) ; if ( count ( $ values ) != count ( $ existing ) ) { return $ this -> translation -> text ( '@name is unavailable' , array ( '@name' => $ this -> translation -> text ( 'Payment' ) ) ) ; } return true ; }
Validates the payment method condition
54,687
public function editProductBundle ( $ product_id ) { $ this -> setProductProductBundle ( $ product_id ) ; $ this -> setTitleEditProductBundle ( ) ; $ this -> setBreadcrumbEditProductBundle ( ) ; $ this -> setData ( 'product' , $ this -> data_product ) ; $ this -> submitEditProductBundle ( ) ; $ this -> setDataItemsProductBundle ( ) ; $ this -> outputEditProductBundle ( ) ; }
Displays the edit product bundle page
54,688
protected function setProductProductBundle ( $ product_id ) { $ this -> data_product = $ this -> product -> get ( $ product_id ) ; if ( empty ( $ this -> data_product ) ) { $ this -> outputHttpStatus ( 404 ) ; } $ this -> prepareProductBundle ( $ this -> data_product ) ; }
Sets the product data
54,689
protected function validateEditProductBundle ( ) { $ this -> setSubmitted ( 'product' ) ; $ this -> setSubmitted ( 'product_id' , $ this -> data_product [ 'product_id' ] ) ; $ this -> validateComponent ( 'product_bundle' ) ; return ! $ this -> hasErrors ( ) ; }
Validates a product bundle data
54,690
protected function saveProductBundle ( ) { $ this -> controlAccess ( 'product_bundle_edit' ) ; $ product_id = $ this -> getSubmitted ( 'product_id' ) ; $ products = $ this -> getSubmitted ( 'products' , array ( ) ) ; if ( $ this -> product_bundle -> set ( $ product_id , $ products ) ) { $ this -> redirect ( 'admin/content/product' , $ this -> text ( 'Product bundle has been updated' ) , 'success' ) ; } $ this -> redirect ( '' , $ this -> text ( 'Product bundle has not been updated' ) , 'warning' ) ; }
Saves a product bundle
54,691
protected function setBreadcrumbEditProductBundle ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin' ) , 'text' => $ this -> text ( 'Dashboard' ) ) ; $ breadcrumbs [ ] = array ( 'text' => $ this -> text ( 'Products' ) , 'url' => $ this -> url ( 'admin/content/product' ) ) ; $ this -> setBreadcrumbs ( $ breadcrumbs ) ; }
Sets breadcrumbs on the edit product bundle page
54,692
public function build ( array $ items ) { $ this -> graph = array ( ) ; foreach ( $ items as $ id => $ item ) { $ this -> graph [ $ id ] [ 'edges' ] = array ( ) ; if ( empty ( $ item [ 'dependencies' ] ) ) { continue ; } foreach ( $ item [ 'dependencies' ] as $ did => $ ddata ) { $ this -> graph [ $ id ] [ 'edges' ] [ $ did ] = $ ddata ; } } $ this -> search ( ) ; foreach ( $ this -> graph as $ id => $ data ) { $ items [ $ id ] [ 'required_by' ] = isset ( $ data [ 'reverse_paths' ] ) ? $ data [ 'reverse_paths' ] : array ( ) ; $ items [ $ id ] [ 'requires' ] = isset ( $ data [ 'paths' ] ) ? $ data [ 'paths' ] : array ( ) ; $ items [ $ id ] [ 'sort' ] = $ data [ 'weight' ] ; } return $ items ; }
Determines which components require and are required by each component
54,693
public function sort ( array $ ids , array $ list ) { $ data = array ( ) ; foreach ( $ ids as $ key ) { if ( ! isset ( $ list [ $ key ] ) ) { return array ( ) ; } $ data [ $ key ] = $ list [ $ key ] [ 'sort' ] ; foreach ( array_keys ( $ list [ $ key ] [ 'requires' ] ) as $ dependency ) { if ( ! isset ( $ data [ $ dependency ] ) ) { $ data [ $ dependency ] = 0 ; } } } arsort ( $ data ) ; return array_keys ( $ data ) ; }
Sort a list of IDs according to their dependencies Dependent items always go last
54,694
protected function search ( ) { $ this -> state = array ( 'last_visit_order' => array ( ) , 'components' => array ( ) , ) ; foreach ( $ this -> graph as $ start => $ data ) { $ this -> searchComponent ( $ start ) ; } $ component_weights = array ( ) ; foreach ( $ this -> state [ 'last_visit_order' ] as $ vertex ) { $ component = $ this -> graph [ $ vertex ] [ 'component' ] ; if ( ! isset ( $ component_weights [ $ component ] ) ) { $ component_weights [ $ component ] = 0 ; } $ this -> graph [ $ vertex ] [ 'weight' ] = $ component_weights [ $ component ] -- ; } }
Performs a depth - first search and sort on a directed acyclic graph
54,695
protected function searchComponent ( $ start ) { if ( ! isset ( $ this -> component ) ) { $ this -> component = $ start ; } if ( isset ( $ this -> graph [ $ start ] [ 'paths' ] ) ) { return null ; } $ this -> graph [ $ start ] [ 'paths' ] = array ( ) ; $ this -> graph [ $ start ] [ 'component' ] = $ this -> component ; $ this -> state [ 'components' ] [ $ this -> component ] [ ] = $ start ; if ( isset ( $ this -> graph [ $ start ] [ 'edges' ] ) ) { foreach ( $ this -> graph [ $ start ] [ 'edges' ] as $ end => $ v ) { $ this -> graph [ $ start ] [ 'paths' ] [ $ end ] = $ v ; if ( isset ( $ this -> graph [ $ end ] [ 'component' ] ) && $ this -> component != $ this -> graph [ $ end ] [ 'component' ] ) { $ new_component = $ this -> graph [ $ end ] [ 'component' ] ; foreach ( $ this -> state [ 'components' ] [ $ this -> component ] as $ vertex ) { $ this -> graph [ $ vertex ] [ 'component' ] = $ new_component ; $ this -> state [ 'components' ] [ $ new_component ] [ ] = $ vertex ; } unset ( $ this -> state [ 'components' ] [ $ this -> component ] ) ; $ this -> component = $ new_component ; } if ( isset ( $ this -> graph [ $ end ] ) ) { $ this -> searchComponent ( $ end ) ; $ this -> graph [ $ start ] [ 'paths' ] += $ this -> graph [ $ end ] [ 'paths' ] ; } } } foreach ( $ this -> graph [ $ start ] [ 'paths' ] as $ end => $ v ) { if ( isset ( $ this -> graph [ $ end ] ) ) { $ this -> graph [ $ end ] [ 'reverse_paths' ] [ $ start ] = $ v ; } } $ this -> state [ 'last_visit_order' ] [ ] = $ start ; return null ; }
Performs a depth - first search on a graph
54,696
public function addBookmark ( ) { $ this -> setBookmark ( ) ; $ this -> controlAccess ( 'bookmark_add' ) ; $ options = array ( 'user_id' => $ this -> uid , 'title' => $ this -> data_title ) ; $ this -> bookmark -> set ( $ this -> data_path , $ options ) ; $ this -> redirect ( $ this -> data_path ) ; }
Page callback to add a bookmark
54,697
public function deleteBookmark ( ) { $ this -> setBookmark ( ) ; $ this -> controlAccess ( 'bookmark_delete' ) ; $ this -> bookmark -> delete ( array ( 'path' => $ this -> data_path ) ) ; $ this -> redirect ( $ this -> data_target ) ; }
Page callback to delete a bookmark
54,698
protected function setBookmark ( ) { $ this -> data_path = $ this -> getQuery ( 'path' ) ; $ this -> data_title = $ this -> getQuery ( 'title' ) ; $ this -> data_target = $ this -> getQuery ( 'target' , $ this -> data_path ) ; if ( empty ( $ this -> data_path ) ) { $ this -> outputHttpStatus ( 403 ) ; } }
Sets bookmark data
54,699
public function listBookmark ( ) { $ this -> setTitleListBookmark ( ) ; $ this -> setBreadcrumbListBookmark ( ) ; $ this -> setFilterListBookmark ( ) ; $ this -> setPagerlListBookmark ( ) ; $ this -> setData ( 'bookmarks' , $ this -> getListBookmark ( ) ) ; $ this -> outputListBookmark ( ) ; }
Displays the bookmark overview page