idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
226,400
protected function isSuccess ( $ result ) : bool { return ! is_null ( $ result ) ? ( is_string ( $ result ) && $ result === 'true' ) || ( is_bool ( $ result ) && $ result ) : false ; }
Determine if the given result is success .
226,401
public function send ( $ authyId , $ method = 'sms' , $ force = false , $ action = null , $ actionMessage = null ) : Response { $ url = $ this -> api . $ method . "/{$authyId}" ; $ params = $ this -> params + [ 'query' => [ 'force' => $ force ? 'true' : 'false' , 'action' => $ action , 'actionMessage' => $ actionMessag...
Send verification token to the given Authy user .
226,402
public function verify ( $ token , $ authyId , $ force = false , $ action = null ) : Response { $ url = $ this -> api . "verify/{$token}/{$authyId}" ; $ params = $ this -> params + [ 'query' => [ 'force' => $ force ? 'true' : 'false' , 'action' => $ action ] ] ; return new Response ( $ this -> http -> get ( $ url , $ p...
Verify the given token for the given Authy user .
226,403
public function register ( $ email , $ cellphone , $ countryCode , $ sendInstallLink = true ) : Response { $ url = $ this -> api . 'users/new' ; $ params = $ this -> params + [ 'form_params' => [ 'send_install_link_via_sms' => ( bool ) $ sendInstallLink , 'user' => [ 'email' => $ email , 'cellphone' => preg_replace ( '...
Register a new Authy user .
226,404
public function registerActivity ( $ authyId , $ type , $ data , $ ip = null ) : Response { $ url = $ this -> api . "users/{$authyId}/register_activity" ; $ params = $ this -> params + [ 'form_params' => [ 'type' => $ type , 'data' => $ data , 'user_ip' => $ ip ] ] ; return new Response ( $ this -> http -> post ( $ url...
Register the given user activity .
226,405
public function status ( $ authyId , $ ip = null ) : Response { $ url = $ this -> api . "users/{$authyId}/status" ; $ params = $ this -> params + [ 'query' => [ 'user_ip' => $ ip ] ] ; return new Response ( $ this -> http -> get ( $ url , $ params ) ) ; }
Get status of the given user .
226,406
public function delete ( $ authyId , $ ip = null ) : Response { $ url = $ this -> api . "users/{$authyId}/delete" ; $ params = $ this -> params + [ 'form_params' => [ 'ip' => $ ip ] ] ; return new Response ( $ this -> http -> post ( $ url , $ params ) ) ; }
Delete the given Authy user .
226,407
protected function getDetail ( $ detail ) { $ fromDetails = $ this -> docvertDetails [ $ detail ] ; if ( $ fromDetails ) { return $ fromDetails ; } $ fromConfig = $ this -> config ( ) -> get ( $ detail ) ; if ( $ fromConfig ) { return $ fromConfig ; } $ fromEnv = Environment :: getEnv ( 'DOCVERT_' . strtoupper ( $ deta...
Retrieves detail in priority order from 1 . local instance field 2 . Config 3 . Environment
226,408
public function upload ( HTTPRequest $ request ) { if ( $ this -> isDisabled ( ) || $ this -> isReadonly ( ) ) { return $ this -> httpError ( 403 ) ; } $ token = $ this -> getForm ( ) -> getSecurityToken ( ) ; if ( ! $ token -> checkRequest ( $ request ) ) { return $ this -> httpError ( 400 ) ; } $ tmpfile = $ request ...
Process the document immediately upon upload .
226,409
protected function preserveSourceDocument ( $ tmpfile , $ chosenFolderID = null ) { $ upload = Upload :: create ( ) ; $ file = File :: create ( ) ; $ upload -> loadIntoFile ( $ tmpfile , $ file , $ chosenFolderID ) ; $ page = $ this -> form -> getRecord ( ) ; $ page -> ImportedFromFileID = $ file -> ID ; $ page -> writ...
Preserves the source file by copying it to a specified folder .
226,410
protected function writeTOC ( $ publishPages = false , $ preservedDocument = null ) { $ page = $ this -> form -> getRecord ( ) ; $ content = '<ul>' ; if ( $ page ) { if ( $ page -> Children ( ) -> Count ( ) > 0 ) { foreach ( $ page -> Children ( ) as $ child ) { $ content .= '<li><a href="' . $ child -> Link ( ) . '">'...
Builds and writes the table of contents for the document .
226,411
protected function writeContent ( $ subtitle , $ subdoc , $ subnode , $ sort = null , $ publishPages = false ) { $ record = $ this -> form -> getRecord ( ) ; if ( $ subtitle ) { $ page = DataObject :: get_one ( 'Page' , sprintf ( '"Title" = \'%s\' AND "ParentID" = %d' , $ subtitle , $ record -> ID ) ) ; if ( ! $ page )...
Used only when writing the document that has been split by headers . Can write both to the chapter pages as well as the master page .
226,412
public function regenerate ( ) { $ this -> init ( ) ; session_start ( ) ; session_regenerate_id ( ) ; $ this -> id = session_id ( ) ; session_write_close ( ) ; return $ this -> id ; }
Update the current session id with a newly generated one .
226,413
public function destroy ( ) : SessionInterface { $ this -> init ( ) ; @ session_start ( ) ; session_destroy ( ) ; setcookie ( $ this -> name , "" , time ( ) - 86400 , $ this -> cookie -> getPath ( ) , $ this -> cookie -> getDomain ( ) , $ this -> cookie -> isSecure ( ) , $ this -> cookie -> isHttpOnly ( ) ) ; $ this ->...
Tear down the session and wipe all its data .
226,414
public static function formatOn ( $ on , $ r = '' ) { if ( isset ( $ on [ 0 ] ) && is_array ( $ on [ 0 ] ) ) { foreach ( $ on as $ on2 ) { $ r = self :: formatOn ( $ on2 , $ r ) ; } } else { $ on2 = array_keys ( $ on ) ; $ r .= ( ! empty ( $ r ) ? ' AND ' : '' ) . '`' . key ( $ on ) . '`.`' . current ( $ on ) . '` = `'...
SQL rendering for JOIN ON
226,415
public static function arrayToCsv ( $ array , $ header_row = true , $ col_sep = "," , $ row_sep = "\n" , $ qut = '"' ) { if ( ! is_array ( $ array ) || ! isset ( $ array [ 0 ] ) || ! is_array ( $ array [ 0 ] ) ) { return false ; } $ output = '' ; if ( $ header_row ) { foreach ( $ array [ 0 ] as $ key => $ val ) { $ key...
Convert an array in a string CSV
226,416
public static function fromRuleSet ( RuleSet $ ruleSet , array $ overrideRules = [ ] ) { if ( \ PHP_VERSION_ID < $ ruleSet -> targetPhpVersion ( ) ) { throw new \ RuntimeException ( \ sprintf ( 'Current PHP version "%s is less than targeted PHP version "%s".' , \ PHP_VERSION_ID , $ ruleSet -> targetPhpVersion ( ) ) ) ;...
Creates a configuration based on a rule set .
226,417
public static function createFromIni ( ) : CookieInterface { $ params = session_get_cookie_params ( ) ; return ( new static ( ) ) -> withLifetime ( $ params [ "lifetime" ] ) -> withPath ( $ params [ "path" ] ) -> withDomain ( $ params [ "domain" ] ) -> withSecure ( $ params [ "secure" ] ) -> withHttpOnly ( $ params [ "...
Create a new instance from the current environment settings .
226,418
public function clear ( ) : SessionInterface { $ values = $ this -> getAll ( ) ; $ values = array_map ( function ( $ value ) { return null ; } , $ values ) ; $ this -> set ( $ values ) ; return $ this ; }
Clear all previously set values .
226,419
public function getFlash ( string $ key ) { $ key = $ this -> flashKey ( $ key ) ; $ value = $ this -> get ( $ key ) ; $ this -> delete ( $ key ) ; return $ value ; }
Retrieve a one - time value from the session data .
226,420
public function setFlash ( string $ key , $ value ) : SessionInterface { $ key = $ this -> flashKey ( $ key ) ; return $ this -> set ( $ key , $ value ) ; }
Set a one - time value within session data .
226,421
public function handle ( ServerRequestInterface $ request ) : ResponseInterface { $ storageless = $ request -> getAttribute ( SessionMiddleware :: SESSION_ATTRIBUTE ) ; $ session = new Session ( $ storageless ) ; $ request = $ request -> withAttribute ( SessionInterface :: class , $ session ) ; return $ this -> handler...
Wrap the storageless session from the request in our session interface .
226,422
public static function instance ( $ id = 'datatable' ) { $ cls = get_called_class ( ) ; if ( ! isset ( self :: $ instance [ $ id ] ) ) { self :: $ instance [ $ id ] = new $ cls ( $ id ) ; } return self :: $ instance [ $ id ] ; }
Get a table initialized if exist else initialize one
226,423
public function setJsInitParams ( $ params ) { foreach ( $ params as $ k => $ v ) { $ this -> setJsInitParam ( $ k , $ v ) ; } return $ this ; }
Add dataTables . js Init Params
226,424
protected function setTHead ( & $ params ) { $ k = $ this -> getColumnIndex ( $ params ) ; if ( isset ( $ params [ 'parent' ] ) ) { $ this -> theadChild [ ] = [ 'title' => $ params [ 'title' ] , 'class' => isset ( $ params [ 'className' ] ) ? $ params [ 'className' ] : null , 'colspan' => 1 , ] ; $ this -> thead [ $ k ...
Add a new column header
226,425
protected function setTFoot ( & $ params ) { if ( isset ( $ params [ 'sFilter' ] ) ) { if ( isset ( $ params [ 'sFilter' ] [ 'type' ] ) && in_array ( $ params [ 'sFilter' ] [ 'type' ] , self :: $ columFilteringParams [ 'type' ] ) ) { $ params [ 'sFilter' ] = array_merge ( self :: $ columFilteringParams , $ params [ 'sF...
Manage the column tfoot Normalize sFilter params if exist
226,426
public function setColumn ( $ params , $ show = true ) { if ( $ show ) { $ this -> setTHead ( $ params ) ; $ this -> setTFoot ( $ params ) ; $ this -> columns [ ] = $ params ; } else { $ this -> unsetColumns [ ] = $ params ; } return $ this ; }
Add a column to the table
226,427
public function setColumns ( $ columns ) { foreach ( $ columns as $ c ) { $ this -> setColumn ( $ c , isset ( $ c [ 'show' ] ) ? $ c [ 'show' ] : true ) ; } return $ this ; }
Add columns to the table
226,428
public function getJavascript ( ) { if ( ! empty ( $ this -> columns ) ) { $ this -> setJsInitParam ( 'columns' , $ this -> getColumnsForJs ( ) ) ; } $ js = 'var ' . $ this -> tableName . ' = $("#' . $ this -> tableName . '").dataTable(' . "\n" . ( ! empty ( $ this -> jsInitParameters ) ? PHPToJS :: render ( ( object )...
Return javascript string to activate table
226,429
protected function getJavascriptSearchPart ( ) { if ( ! $ this -> individualColumnFiltering ) { return '' ; } $ js = 'var ' . $ this -> tableName . 'Api = ' . $ this -> tableName . '.api(true);' . "\n" . '$("#' . $ this -> tableName . ' tfoot th").each( function(colI) {' . "\n" . '$(".sSearch", this).on("keyup change",...
Generate the javascript relative to the individual column filtering
226,430
protected function formatOption ( $ name , $ value , $ label ) { return '<option value="' . $ value . '"' . ( isset ( $ this -> filters [ $ name ] ) && strpos ( $ this -> filters [ $ name ] , $ value ) === 0 ? ' selected' : '' ) . '>' . ( isset ( $ label ) ? $ label : $ value ) . '</option>' ; }
Render option for select
226,431
public function setFrom ( $ table , $ alias = null ) { $ this -> table = $ table ; $ this -> aliasTable = $ alias === null ? $ table : $ alias ; return $ this ; }
Set the mysql table to request
226,432
public function setJoin ( $ table , $ on , $ join = 'LEFT JOIN' , $ duplicate = false ) { $ this -> join [ ] = $ join . ' ' . $ table . ' ON ' . Helper :: formatOn ( $ on ) ; if ( $ duplicate !== false ) { $ this -> patchDuplicateRow [ 'pKey' ] = $ duplicate [ 0 ] ; if ( is_array ( $ duplicate [ 1 ] ) ) { $ this -> pat...
Join data from other tables
226,433
public function setGroupBy ( $ column ) { $ this -> groupBy = ( isset ( $ this -> groupBy ) ? $ this -> groupBy . ',' : '' ) . $ column ; return $ this ; }
Group by a SQL column
226,434
protected function initFilters ( ) { $ initColumnSearch = $ this -> initColumnSearch ; foreach ( $ this -> columns as $ c ) { if ( isset ( $ c [ 'sqlFilter' ] ) ) { $ where_condition = $ this -> generateSQLColumnFilter ( $ this -> toSQLColumn ( $ c , 2 ) , $ c [ 'sqlFilter' ] ) ; if ( ! $ this -> setHaving ( $ where_co...
SQL Rendering for the initial filters set
226,435
public function globalFilter ( ) { $ globalSearch = [ ] ; if ( isset ( $ this -> request [ 'search' ] ) && ! empty ( $ this -> request [ 'search' ] [ 'value' ] ) ) { for ( $ i = 0 , $ ien = count ( $ this -> request [ 'columns' ] ) ; $ i < $ ien ; $ i ++ ) { if ( self :: isSearchable ( $ this -> columns [ $ i ] ) ) { $...
SQL Rendering for the global search
226,436
protected function individualColumnFilters ( ) { $ columnSearch = [ ] ; if ( isset ( $ this -> individualColumnFiltering ) ) { $ this -> sRangeSeparator = isset ( $ this -> sRangeSeparator ) ? $ this -> sRangeSeparator : '~' ; for ( $ i = 0 , $ ien = count ( $ this -> columns ) ; $ i < $ ien ; $ i ++ ) { if ( self :: i...
SQL Rendering for the invidividual column filters
226,437
protected function toSQLColumn ( $ column , $ onlyAlias = 0 , $ filter = false ) { if ( ! isset ( $ column [ 'sql_name' ] ) && ! isset ( $ column [ 'data' ] ) ) { self :: sendFatal ( 'Houston, we have a problem with one of your column : can\'t draw it SQL name because it don\'t have data or sql_name define.' . "\n" . j...
Give a column s sql name
226,438
protected function patchDuplicateRow ( $ d , $ pKey , array $ columns ) { $ id = $ d [ $ pKey ] ; if ( isset ( $ this -> rData [ $ id ] ) ) { foreach ( $ columns as $ c => $ separator ) { $ this -> rData [ $ id ] [ $ c ] .= $ separator . $ d [ $ c ] ; } } else { $ this -> rData [ $ id ] = $ d ; } }
To avoid duplicate row when LEFT JOIN if GROUP BY is not set
226,439
public function exec ( array $ request , $ csv = false ) { if ( $ csv ) { $ this -> request [ 'length' ] = - 1 ; } $ queries = $ this -> generateSQLRequest ( $ request ) ; $ this -> addToSend ( 'sqlQuery' , $ queries [ 'data' ] ) ; $ pdo = $ this -> pdoLink ; try { $ q = $ pdo -> query ( $ queries [ 'data' ] ) ; $ this...
Execute the ajax request and send the result in json
226,440
protected function sendData ( $ data , $ recordsFiltered , $ recordsTotal ) { $ toJson = array ( 'draw' => intval ( $ this -> request [ 'draw' ] ) , 'recordsTotal' => intval ( $ recordsTotal ) , 'recordsFiltered' => intval ( $ recordsFiltered ) , 'data' => $ this -> dataOutput ( $ data ) , ) ; if ( isset ( $ this -> to...
Send the json encoded result for DataTables . js
226,441
protected static function sendCsv ( $ data ) { header ( "Content-Disposition: attachment; filename=" . uniqid ( 'dataExpl' ) . '.csv' ) ; header ( "Content-Type: application/force-download" ) ; header ( "Content-Type: application/octet-stream" ) ; header ( "Content-Type: application/download" ) ; header ( "Content-Desc...
Return the csv
226,442
public static function sendFatal ( $ error , $ toSend = null ) { $ toJson = [ 'error' => utf8_encode ( $ error ) ] ; if ( isset ( $ toSend ) ) { $ toJson = array_merge ( $ toSend , $ toJson ) ; } exit ( json_encode ( $ toJson ) ) ; }
Throw a fatal error . This writes out an error message in a JSON string which DataTables will see and show to the user in the browser .
226,443
public static function getInstance ( ) : SessionInterface { if ( static :: $ session instanceof SessionInterface ) { return static :: $ session ; } if ( strlen ( static :: $ name ) < 1 ) { throw new \ Exception ( "Cannot start session, no name has been specified, you must call Session::name() before using this class" )...
Ensure the session instance has been created .
226,444
public function createNamespace ( string $ name ) : SessionInterface { $ name = $ this -> getNamespacedKey ( $ name ) ; return new SessionNamespace ( $ name , $ this -> session ) ; }
Create a new namespaced section of this session to avoid clashes .
226,445
public function getAll ( ) : array { $ namespace = $ this -> getNamespace ( ) ; $ length = mb_strlen ( $ namespace ) ; $ values = [ ] ; $ data = $ this -> session -> getAll ( ) ; foreach ( $ data as $ key => $ val ) { if ( mb_substr ( $ key , 0 , $ length ) === $ namespace ) { $ key = mb_substr ( $ key , $ length ) ; $...
Get all the current session data .
226,446
public function updateInstances ( $ route , $ request ) { $ this -> request = $ request ; if ( $ request ) { $ this -> uri = urldecode ( $ request -> path ( ) ) ; } $ this -> route = $ route ; if ( $ route ) { $ this -> action = $ route -> getActionName ( ) ; $ actionSegments = Str :: parseCallback ( $ this -> action ,...
Update the route and request instances
226,447
public function checkUri ( $ uris ) { if ( ! $ this -> request ) { return false ; } foreach ( ( array ) $ uris as $ uri ) { if ( $ this -> uri == $ uri ) { return true ; } } return false ; }
Check if the URI of the current request matches one of the specific URIs
226,448
public function checkRoute ( $ routeNames ) { if ( ! $ this -> route ) { return false ; } $ routeName = $ this -> route -> getName ( ) ; if ( in_array ( $ routeName , ( array ) $ routeNames ) ) { return true ; } return false ; }
Check if the name of the current route matches one of specific values
226,449
public function checkRoutePattern ( $ patterns ) { if ( ! $ this -> route ) { return false ; } $ routeName = $ this -> route -> getName ( ) ; if ( $ routeName == null ) { return in_array ( null , $ patterns ) ; } foreach ( ( array ) $ patterns as $ p ) { if ( str_is ( $ p , $ routeName ) ) { return true ; } } return fa...
Check the current route name with one or some patterns
226,450
public function checkRouteParam ( $ param , $ value ) { if ( ! $ this -> route ) { return false ; } $ paramValue = $ this -> route -> parameter ( $ param ) ; if ( is_a ( $ paramValue , Model :: class ) ) { return $ paramValue -> { $ paramValue -> getKeyName ( ) } == $ value ; } return $ paramValue == $ value ; }
Check if the parameter of the current route has the correct value
226,451
public function checkAction ( $ actions ) { if ( ! $ this -> action ) { return false ; } if ( in_array ( $ this -> action , ( array ) $ actions ) ) { return true ; } return false ; }
Return active class if current route action match one of provided action names
226,452
public function checkController ( $ controllers ) { if ( ! $ this -> controller ) { return false ; } if ( in_array ( $ this -> controller , ( array ) $ controllers ) ) { return true ; } return false ; }
Check if the current controller class matches one of specific values
226,453
public function getFileNameVersioned ( ) { return static :: buildFileNameVersioned ( $ this -> strFileName , static :: getVersionForFileName ( $ this -> intVersionMajor , $ this -> intVersionMinor , $ this -> intVersionPatch ) , $ this -> strFileType ) ; }
Return the complete versioned filename string for this document .
226,454
public function getFileSize ( $ strUnit , $ blnFormatted = false ) { $ doubleFileSize = \ Document :: convertFileSize ( $ this -> intFileSize , self :: FILE_SIZE_UNIT_BYTE , $ strUnit ) ; if ( $ doubleFileSize < 0 ) { throw new \ Exception ( sprintf ( 'Invalid file size [%s] or unit [%s] for document.' , $ this -> intF...
Return the file size for the given unit .
226,455
public static function convertFileSize ( $ doubleFileSize , $ strSourceUnit , $ strTargetUnit ) { if ( $ strSourceUnit == $ strTargetUnit ) { return $ doubleFileSize ; } if ( $ strSourceUnit == \ Document :: FILE_SIZE_UNIT_BYTE ) { switch ( $ strTargetUnit ) { case \ Document :: FILE_SIZE_UNIT_KB : return $ doubleFileS...
Utility function to convert file size from a source unit into a target unit .
226,456
public static function formatFileSize ( $ doubleFileSize , $ strUnit ) { $ value = number_format ( $ doubleFileSize , 2 , $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'file_size_format' ] [ 'dec_point' ] , $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'file_size_format' ] [ '$thousands_sep' ] ) ; if ( substr ( $ value , - 3 ) == ( $ GLOB...
Utility function to format file size values
226,457
private function applyReadPermissionsToCategories ( Array $ arrCategories ) { $ arrSecureCategories = $ arrCategories ; foreach ( $ arrSecureCategories as $ category ) { if ( ! $ category -> isPublished ( ) || ( $ this -> dmsHideEmptyCategories && ! $ category -> hasPublishedDocuments ( ) ) || ( $ this -> dmsHideLocked...
Apply the read permissions to the categories .
226,458
public function isPublished ( ) { $ time = time ( ) ; $ published = ( $ this -> published && ( $ this -> publicationStart == '' || $ this -> publicationStart < $ time ) && ( $ this -> publicationStop == '' || $ this -> publicationStop > $ time ) ) ; return $ published ; }
Return if this category is published .
226,459
public function shouldPublishDocumentsPerDefault ( ) { if ( $ this -> strPublishDocumentsPerDefault == self :: PUBLISH_DOCUMENTS_PER_DEFAULT_ENABLE ) { return true ; } else if ( $ this -> strPublishDocumentsPerDefault == self :: PUBLISH_DOCUMENTS_PER_DEFAULT_INHERIT && $ this -> hasParentCategory ( ) ) { return $ this ...
Return if documents uploaded to this category should be published per default .
226,460
public function hasDocumentsInSubCategories ( ) { if ( $ this -> hasSubCategories ( ) ) { foreach ( $ this -> arrSubCategories as $ subCategory ) { if ( $ subCategory -> hasDocuments ( ) || $ subCategory -> hasDocumentsInSubCategories ( ) ) { return true ; } } } return false ; }
Return if this category has documents in any of its subcategories .
226,461
public function getPublishedDocumentCount ( ) { $ count = 0 ; foreach ( $ this -> arrDocuments as $ document ) { if ( $ document -> isPublished ( ) ) { $ count ++ ; } } return $ count ; }
Get the number of published documents .
226,462
public function isReadableForCurrentMember ( ) { if ( $ this -> generalReadPermission == self :: GENERAL_READ_PERMISSION_ALL ) { return true ; } else if ( $ this -> generalReadPermission == self :: GENERAL_READ_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN ) { return true ; } else if ( $ this -> generalReadPermission == ...
Return if this category is readable for the current logged member .
226,463
public function isAccessibleForCurrentMember ( $ strAccessRight ) { if ( $ this -> generalManagePermission == self :: GENERAL_MANAGE_PERMISSION_LOGGED_USER && FE_USER_LOGGED_IN ) { return true ; } else if ( $ this -> generalManagePermission == self :: GENERAL_MANAGE_PERMISSION_CUSTOM && FE_USER_LOGGED_IN ) { $ blnIsAcc...
Return if the current logged member has access with the given right to this category .
226,464
public function getPath ( $ blnSkipThis ) { $ arrPath = array ( ) ; if ( ! $ this -> isRootCategory ( ) && $ this -> hasParentCategory ( ) ) { $ arrPath = $ this -> parentCategory -> getPath ( false ) ; } if ( ! $ blnSkipThis ) { $ arrPath [ ] = $ this ; } return $ arrPath ; }
Returns the path from the root node of this category to this category in context of the current structure of categories .
226,465
public function getPathNames ( $ blnSkipThis ) { $ arrPath = array ( ) ; if ( ! $ this -> isRootCategory ( ) && $ this -> hasParentCategory ( ) ) { $ arrPath = $ this -> parentCategory -> getPathNames ( false ) ; } if ( ! $ blnSkipThis ) { $ arrPath [ ] = $ this -> name ; } return $ arrPath ; }
Returns the names in the path from the root node of this category to this category in context of the current structure of categories .
226,466
public function getAllowedFileTypes ( ) { $ arrFileTypesOfParents = array ( ) ; if ( $ this -> fileTypesInherit && ! $ this -> isRootCategory ( ) && $ this -> hasParentCategory ( ) ) { $ arrFileTypesOfParents = $ this -> parentCategory -> getAllowedFileTypes ( ) ; } $ arrFileTypes = DmsUtils :: getUniqueFileTypes ( $ t...
Returns an array of file types which are allowed to be uploaded into this category .
226,467
public function isFileTypeAllowed ( $ strFileType , $ blnCaseSensitive = false ) { $ arrAllowedFileTypes = $ this -> getAllowedFileTypes ( ) ; if ( ! $ blnCaseSensitive ) { $ strFileType = strtolower ( $ strFileType ) ; } return in_array ( $ strFileType , $ arrAllowedFileTypes ) ; }
Returns if the given file type is allowed to be uploaded into this category .
226,468
protected function encodeSetOf ( SetOfType $ setOf ) { if ( \ count ( $ setOf -> getChildren ( ) ) === 0 ) { return '' ; } $ children = [ ] ; foreach ( $ setOf as $ type ) { $ child = [ 'original' => $ this -> encode ( $ type ) ] ; $ child [ 'length' ] = \ strlen ( $ child [ 'original' ] ) ; $ children [ ] = $ child ; ...
X . 690 Section 11 . 6
226,469
public function addAlias ( $ alias , $ tagName ) { if ( $ this -> getComponentFactory ( $ tagName ) ) { $ this -> alias [ ( string ) $ alias ] = ( string ) $ tagName ; } return $ this ; }
Adds an alisa for a component
226,470
public function getComponentFactory ( $ tagName ) { if ( isset ( $ this -> alias [ $ tagName ] ) ) { $ tagName = $ this -> alias [ $ tagName ] ; } if ( isset ( $ this -> componentFactory [ $ tagName ] ) && $ this -> componentFactory [ $ tagName ] instanceof ComponentFactoryInterface ) { return $ this -> componentFactor...
returns a Component Factory for a given tag or alias
226,471
public function handle ( WillSerializeData $ event ) { if ( $ event -> isController ( Controller \ ShowDiscussionController :: class ) ) { $ posts = $ event -> data -> posts ; } elseif ( $ event -> isController ( Controller \ ShowPostController :: class ) || $ event -> isController ( Controller \ CreatePostController :...
Apply visibility permissions to API data .
226,472
private function uploadSelectFile ( & $ params , & $ dmsLoader , & $ uploadCategory , & $ arrMessages , & $ blnShowStart ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ uploadCategory , $ params ) ; if ( $ c...
Display the file select screen for upload
226,473
private function manageSelectDocument ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = true ; $ category = $ dmsLoader -> loadCategory ( $ manageCategory , $ params ) ; if ( ...
Display the document select screen for managing
226,474
private function managePublishDocument ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart , $ documentId ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ manageCategory , $...
Execute publishing documents
226,475
private function manageDeleteDocument ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart , $ documentId ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ manageCategory , $ ...
Execute unpublishing documents
226,476
private function manageEditDocumentEnterProperties ( & $ params , & $ dmsLoader , & $ manageCategory , & $ arrMessages , & $ blnShowStart , $ documentId ) { $ params -> loadRootCategory = true ; $ params -> loadAccessRights = true ; $ params -> loadDocuments = false ; $ category = $ dmsLoader -> loadCategory ( $ manage...
Edit a document
226,477
private function applyAccessPermissionsToCategories ( Array $ arrCategories ) { $ arrSecureCategories = $ arrCategories ; foreach ( $ arrSecureCategories as $ category ) { if ( ! $ category -> isPublished ( ) || ( $ this -> dmsHideLockedCategories && ( ! $ category -> isUploadableForCurrentMember ( ) && ! $ category ->...
Apply the access permissions to the categories .
226,478
public function addBreadcrumb ( \ DataContainer $ dc ) { if ( isset ( $ _GET [ 'cat' ] ) ) { $ this -> Session -> set ( 'tl_category_id' , $ this -> Input -> get ( 'cat' ) ) ; $ this -> redirect ( preg_replace ( '/&cat=[^&]*/' , '' , $ this -> Environment -> request ) ) ; } $ intCategoryId = $ this -> Session -> get ( ...
Add the breadcrumb menu
226,479
public function checkPermission ( ) { switch ( $ this -> Input -> get ( 'act' ) ) { case 'delete' : if ( ! $ this -> isCategoryDeletable ( $ this -> Input -> get ( 'id' ) ) ) { $ this -> log ( 'Deleting the non empty category with ID "' . $ this -> Input -> get ( 'id' ) . '" is not allowed.' , 'tl_dms_categories checkP...
Check permissions to avoid not allowd deleting
226,480
public function getDeleteButton ( $ row , $ href , $ label , $ title , $ icon , $ attributes ) { if ( ! $ this -> isCategoryDeletable ( $ row [ 'id' ] ) ) { return $ this -> generateImage ( 'delete_.gif' , $ GLOBALS [ 'TL_LANG' ] [ 'tl_dms_categories' ] [ 'delete_' ] [ 0 ] , 'title="' . sprintf ( $ GLOBALS [ 'TL_LANG' ...
Return the delete button
226,481
public function saveFileTypes ( $ varValue , DataContainer $ dc ) { if ( strlen ( $ varValue ) > 0 ) { $ arrFileTypes = \ DmsUtils :: getUniqueFileTypes ( $ varValue ) ; $ varValue = implode ( "," , $ arrFileTypes ) ; } return $ varValue ; }
Cleanup the files types before saving
226,482
private function getPhpUploadMaxFilesize ( ) { $ param = trim ( ini_get ( 'upload_max_filesize' ) ) ; $ unit = strtolower ( substr ( $ param , - 1 ) ) ; $ val = ( double ) $ param ; switch ( $ unit ) { case 'k' : $ val = \ Document :: convertFileSize ( ( double ) substr ( $ param , 0 , - 1 ) , \ Document :: FILE_SIZE_U...
Get the value of the upload_max_filesize set in PHP .
226,483
public function add ( $ item ) { if ( is_array ( $ item ) ) { return array_map ( [ $ this , 'add' ] , $ item ) ; } if ( ! $ item | strlen ( trim ( $ item ) ) === 0 ) { return false ; } $ this -> collection [ ] = trim ( strip_tags ( $ item ) ) ; }
Add an item to the collection .
226,484
public function get ( $ direction = 'regular' ) { if ( $ this -> count ( ) == 0 ) { return $ this -> default ; } if ( $ direction === 'downward' ) { $ this -> collection = array_reverse ( $ this -> collection ) ; } $ this -> addPageName ( ) ; if ( $ direction === 'reverse' ) { $ this -> collection = array_reverse ( $ t...
Get the page title .
226,485
protected function addPageName ( ) { if ( ! empty ( $ this -> getPageName ( ) ) && ! in_array ( $ this -> getPageName ( ) , $ this -> collection ) ) { $ this -> add ( $ this -> getPageName ( ) ) ; } }
Add the page name to the collection .
226,486
public function isActive ( ) { $ time = time ( ) ; $ active = ( $ this -> active && ( $ this -> activationStart == '' || $ this -> activationStart < $ time ) && ( $ this -> activationStop == '' || $ this -> activationStop > $ time ) ) ; return $ active ; }
Return if this access right is active .
226,487
public function toBinary ( ) { $ bytes = '' ; foreach ( str_split ( $ this -> value , 8 ) as $ piece ) { $ bytes .= chr ( bindec ( $ piece ) ) ; } return $ bytes ; }
Get the packed binary representation .
226,488
public static function fromBinary ( $ bytes , ? int $ minLength = null ) { $ bitstring = '' ; $ length = strlen ( $ bytes ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ bitstring .= sprintf ( '%08d' , decbin ( ord ( $ bytes [ $ i ] ) ) ) ; } if ( $ minLength && strlen ( $ bitstring ) < $ minLength ) { $ bitstring = ...
Construct the bit string from a binary string value .
226,489
public static function fromInteger ( int $ int , ? int $ minLength = null ) { $ pieces = str_split ( decbin ( $ int ) , 8 ) ; $ num = count ( $ pieces ) ; if ( $ num === 1 && strlen ( $ pieces [ 0 ] ) !== 8 ) { $ pieces [ 0 ] = str_pad ( $ pieces [ 0 ] , 8 , '0' , STR_PAD_LEFT ) ; } elseif ( $ num > 0 && strlen ( $ pie...
Construct the bit string from an integer .
226,490
public function storeDocument ( \ Document $ document ) { $ arrSet = $ this -> buildDocumentDataArray ( $ document , false ) ; $ objDocument = $ this -> Database -> prepare ( "INSERT INTO tl_dms_documents %s" ) -> set ( $ arrSet ) -> execute ( ) ; $ document -> id = $ objDocument -> insertId ; return $ document ; }
Store the new document in the given category .
226,491
public function updateDocument ( \ Document $ document ) { $ arrSet = $ this -> buildDocumentDataArray ( $ document , false ) ; $ this -> Database -> prepare ( "UPDATE tl_dms_documents %s WHERE id=?" ) -> set ( $ arrSet ) -> execute ( $ document -> id ) ; return $ document ; }
Update the document .
226,492
public function addEncore ( PageModel $ page , LayoutModel $ layout , PageRegular $ pageRegular ) { $ this -> doAddEncore ( $ page , $ layout , $ pageRegular ) ; }
Modify the page object .
226,493
public static function getValidFileTypesForCategory ( ) { $ db = \ Database :: getInstance ( ) ; $ input = \ Input :: getInstance ( ) ; if ( $ db -> tableExists ( 'tl_dms_categories' ) && $ db -> tableExists ( 'tl_dms_documents' ) ) { $ objCategory = $ db -> prepare ( 'SELECT cat.* FROM tl_dms_categories cat JOIN tl_dm...
Determine the valid file types for the current category
226,494
public function resortDocuments ( \ DataContainer $ dc ) { if ( ! $ this -> Input -> get ( 'act' ) ) { $ db = \ Database :: getInstance ( ) ; $ stmt = "UPDATE tl_dms_documents doc, " . " (SELECT @rownum := @rownum + 1 ROWNUM, t.id ID " . " FROM " . " (SELECT @rownum := 0) r, " . " (SELECT * FROM tl_dms_documents ORDER ...
Resort the document sorting value
226,495
public function pasteDocument ( \ DataContainer $ dc , $ row , $ table , $ cr , $ arrClipboard = null ) { $ imagePasteAfter = $ this -> generateImage ( 'pasteafter.gif' , sprintf ( $ GLOBALS [ 'TL_LANG' ] [ $ dc -> table ] [ 'pasteafter' ] [ 1 ] , $ row [ 'id' ] ) , 'class="blink"' ) ; $ imagePasteInto = $ this -> gene...
Return the paste document button
226,496
public function deleteFile ( \ DataContainer $ dc ) { $ filePath = TL_ROOT . '/' . $ this -> getFullFilePath ( $ dc -> activeRecord -> data_file_name , $ dc ) ; if ( file_exists ( $ filePath ) ) { unlink ( $ filePath ) ; } }
Delete the file if the document will be deleted .
226,497
public function loadCategories ( \ DmsLoaderParams $ params ) { $ rootCategory = null ; if ( $ params -> loadRootCategory && $ params -> rootCategoryId > 0 ) { $ rootCategory = $ this -> loadCategory ( $ params -> rootCategoryId , $ params ) ; $ arrCategories = $ this -> getCategoryLevel ( $ params -> rootCategoryId , ...
Load the categories structure without consideration of access rights .
226,498
public static function flattenCategories ( Array $ arrCategories ) { $ arrFlattend = array ( ) ; foreach ( $ arrCategories as $ category ) { $ arrFlattend [ ] = $ category ; if ( $ category -> hasSubCategories ( ) ) { $ arrFlattend = array_merge ( $ arrFlattend , \ DmsLoader :: flattenCategories ( $ category -> subCate...
Flatten a categories structure .
226,499
public function loadCategory ( $ categoryId , \ DmsLoaderParams $ params ) { $ objCategory = $ this -> Database -> prepare ( "SELECT * FROM tl_dms_categories WHERE id = ?" ) -> limit ( 1 ) -> execute ( $ categoryId ) ; $ category = null ; if ( $ objCategory -> numRows ) { $ category = $ this -> buildCategory ( $ objCat...
Load the category with the given id .