idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
6,500 | protected function processImage ( $ action , InterventionImage $ image ) { $ action = explode ( '_' , $ action ) ; if ( count ( $ action ) > 1 ) { list ( $ method , $ param ) = $ action ; } else { $ method = current ( $ action ) ; $ param = [ ] ; } if ( $ method === 'crop' ) { $ params = explode ( ',' , $ param ) ; cal... | Processes the image with given action |
6,501 | protected function saveImage ( InterventionImage $ image ) { $ filename = Uploader :: getNewFileName ( $ this -> getFileExtension ( ) ) ; list ( $ absolutePath , $ relativePath ) = Uploader :: getUploadPath ( ) ; $ image -> save ( $ absolutePath . '/' . $ filename ) ; $ this -> refreshImageMetadata ( $ image ) ; return... | Saves the processed image |
6,502 | protected function refreshImageMetadata ( InterventionImage $ image ) { $ this -> setMetadata ( 'width' , $ image -> width ( ) ) ; $ this -> setMetadata ( 'height' , $ image -> height ( ) ) ; } | Refreshes the image metadata |
6,503 | protected function setClient ( Client $ client = null ) { if ( is_null ( $ client ) ) { $ this -> httpClient = $ this -> createHttpClient ( ) ; } else { $ this -> httpClient = $ client ; } } | Sets Guzzle client . |
6,504 | public function write ( array $ queries , int $ concurrency = 5 ) : array { $ result = [ ] ; $ openedStreams = [ ] ; foreach ( $ queries as $ query ) { $ requests = function ( Query $ query ) use ( & $ openedStreams ) { if ( ! empty ( $ query -> getFiles ( ) ) ) { foreach ( $ query -> getFiles ( ) as $ file ) { $ heade... | Executes write queries . |
6,505 | protected function getTempTableQueryParams ( TempTable $ table ) { list ( $ structure , $ withColumns ) = $ this -> assembleTempTableStructure ( $ table ) ; return [ $ table -> getName ( ) . '_' . ( $ withColumns ? 'structure' : 'types' ) => $ structure , $ table -> getName ( ) . '_format' => $ table -> getFormat ( ) ,... | Parse temp table data to append it to request . |
6,506 | protected function assembleTempTableStructure ( TempTable $ table ) { $ structure = $ table -> getStructure ( ) ; $ withColumns = true ; $ preparedStructure = [ ] ; foreach ( $ structure as $ column => $ type ) { if ( is_int ( $ column ) ) { $ withColumns = false ; $ preparedStructure [ ] = $ type ; } else { $ prepared... | Assembles string from TempTable structure . |
6,507 | protected function parseReason ( Query $ query ) { return function ( $ reason ) use ( $ query ) { if ( $ reason instanceof RequestException ) { $ response = $ reason -> getResponse ( ) ; if ( is_null ( $ response ) ) { throw TransportException :: connectionError ( $ query -> getServer ( ) , $ reason -> getMessage ( ) )... | Determines the reason why request was rejected . |
6,508 | protected function assembleResult ( Query $ query , ResponseInterface $ response ) : Result { $ response = $ response -> getBody ( ) -> getContents ( ) ; try { $ result = \ GuzzleHttp \ json_decode ( $ response , true ) ; $ statistic = new QueryStatistic ( $ result [ 'statistics' ] [ 'rows_read' ] ?? 0 , $ result [ 'st... | Assembles Result instance from server response . |
6,509 | protected function buildRequestUri ( Server $ server , array $ query = [ ] , array $ settings = [ ] ) : string { $ uri = $ server -> getOptions ( ) -> getProtocol ( ) . '://' . $ server -> getHost ( ) . ':' . $ server -> getPort ( ) ; if ( ! is_null ( $ server -> getDatabase ( ) ) ) { $ query [ 'database' ] = $ server ... | Builds uri with necessary params . |
6,510 | public function getGallery ( $ ids ) { if ( empty ( $ ids ) || $ ids === '{}' || $ ids === '[]' ) return null ; $ ids = $ this -> parseGalleryIds ( $ ids ) ; $ placeholders = implode ( ',' , array_fill ( 0 , count ( $ ids ) , '?' ) ) ; $ imageModel = $ this -> getImageModelName ( ) ; $ gallery = call_user_func_array ( ... | Returns the gallery by given ids |
6,511 | public function getCover ( $ ids ) { if ( empty ( $ ids ) || $ ids === '{}' || $ ids === '[]' ) return null ; $ ids = $ this -> parseGalleryIds ( $ ids ) ; $ id = current ( $ ids ) ; $ imageModel = $ this -> getImageModelName ( ) ; return call_user_func_array ( [ $ imageModel , 'find' ] , [ $ id ] ) ; } | Returns the cover for given ids |
6,512 | protected function parseGalleryIds ( $ ids ) { if ( is_array ( $ ids ) ) { return $ ids ; } if ( 0 !== ( int ) $ ids ) { return ( array ) $ ids ; } return json_decode ( $ ids , true ) ; } | Parses a gallery array |
6,513 | protected function setTransport ( TransportInterface $ transport = null ) { if ( is_null ( $ transport ) ) { $ this -> transport = $ this -> createTransport ( ) ; } else { $ this -> transport = $ transport ; } } | Sets transport . |
6,514 | protected function setMapper ( QueryMapperInterface $ mapper = null ) : self { if ( is_null ( $ mapper ) ) { return $ this -> setDefaultMapper ( ) ; } $ this -> mapper = $ mapper ; return $ this ; } | Sets Mapper . |
6,515 | public function onCluster ( ? string $ cluster ) { $ this -> clusterName = $ cluster ; $ this -> serverHostname = null ; return $ this ; } | Client will use servers from specified cluster |
6,516 | public function usingRandomServer ( ) { $ this -> serverHostname = function ( ) { if ( $ this -> isOnCluster ( ) ) { return $ this -> serverProvider -> getRandomServerFromCluster ( $ this -> getClusterName ( ) ) ; } else { return $ this -> serverProvider -> getRandomServer ( ) ; } } ; return $ this ; } | Client will return random server on each query |
6,517 | public function getServer ( ) : Server { if ( $ this -> serverHostname instanceof \ Closure ) { $ server = call_user_func ( $ this -> serverHostname ) ; } else { if ( $ this -> isOnCluster ( ) ) { if ( is_null ( $ this -> serverHostname ) ) { $ server = $ this -> serverProvider -> getRandomServerFromCluster ( $ this ->... | Returns server to perform request |
6,518 | public function readOne ( string $ query , array $ bindings = [ ] , array $ files = [ ] , array $ settings = [ ] ) : Result { $ query = $ this -> createQuery ( $ this -> getServer ( ) , $ query , $ bindings , $ files , $ settings ) ; $ result = $ this -> getTransport ( ) -> read ( [ $ query ] , 1 ) ; return $ result [ ... | Performs select query and returns one result |
6,519 | public function read ( array $ queries , int $ concurrency = 5 ) : array { foreach ( $ queries as $ i => $ query ) { if ( ! $ query instanceof Query ) { $ queries [ $ i ] = $ this -> guessQuery ( $ query ) ; } } return $ this -> getTransport ( ) -> read ( $ queries , $ concurrency ) ; } | Performs batch of select queries . |
6,520 | public function writeOne ( string $ query , array $ bindings = [ ] , array $ files = [ ] , array $ settings = [ ] ) : bool { if ( ! $ query instanceof Query ) { $ query = $ this -> createQuery ( $ this -> getServer ( ) , $ query , $ bindings , $ files , $ settings ) ; } $ result = $ this -> getTransport ( ) -> write ( ... | Performs insert or simple statement query . |
6,521 | public function writeFiles ( string $ table , array $ columns , array $ files , string $ format = Format :: TSV , array $ settings = [ ] , int $ concurrency = 5 ) { $ sql = 'INSERT INTO ' . $ table . ' (' . implode ( ', ' , $ columns ) . ') FORMAT ' . strtoupper ( $ format ) ; foreach ( $ files as $ i => $ file ) { if ... | Performs async insert queries using local csv or tsv files . |
6,522 | protected function createQuery ( Server $ server , string $ sql , array $ bindings = [ ] , array $ files = [ ] , array $ settings = [ ] ) : Query { $ preparedSql = $ this -> prepareSql ( $ sql , $ bindings ) ; return new Query ( $ server , $ preparedSql , $ files , $ settings ) ; } | Creates query instance from specified arguments . |
6,523 | protected function guessQuery ( array $ query ) : Query { $ server = $ query [ 'server' ] ?? $ this -> getServer ( ) ; $ sql = $ query [ 'query' ] ; $ bindings = $ query [ 'bindings' ] ?? [ ] ; $ tables = $ query [ 'files' ] ?? [ ] ; $ settings = $ query [ 'settings' ] ?? [ ] ; return $ this -> createQuery ( $ server ,... | Parses query array and returns query instance . |
6,524 | public function sendInvite ( $ socialInviteRequest , $ socialInviteAppSecret ) { $ restUrl = $ this -> getRestUrl ( '/1/social-invite/invitation' ) ; $ sender = $ this -> getOrCreateSenderId ( $ socialInviteRequest -> senderAddress ) ; if ( is_string ( $ socialInviteRequest -> recipients ) ) { $ temp = explode ( ',' , ... | Send social invitation |
6,525 | public function compile ( ) : bool { if ( file_exists ( $ this -> cachePath ) ) { $ this -> removeDirectory ( $ this -> cachePath ) ; } if ( ! file_exists ( $ this -> cachePath ) ) { mkdir ( $ this -> cachePath ) ; } $ this -> twig -> disableDebug ( ) ; $ this -> twig -> enableAutoReload ( ) ; if ( ! $ this -> twig -> ... | Compile all twig templates . |
6,526 | private function compileFiles ( string $ viewPath ) { $ directory = new RecursiveDirectoryIterator ( $ viewPath , FilesystemIterator :: SKIP_DOTS ) ; foreach ( new RecursiveIteratorIterator ( $ directory , RecursiveIteratorIterator :: SELF_FIRST ) as $ file ) { if ( $ file -> isFile ( ) && $ file -> getExtension ( ) ==... | Compile Twig files . |
6,527 | protected function normalizeOptions ( ) { $ this -> options [ 'data' ] = ArrayHelper :: getValue ( $ this -> options , 'data' , [ ] ) ; $ this -> options [ 'style' ] = ArrayHelper :: getValue ( $ this -> options , 'style' , '' ) ; $ this -> options [ 'data' ] [ 'hash' ] = $ this -> hash ? : ArrayHelper :: getValue ( $ ... | This function sets default values to options for further usage |
6,528 | public function previewWith ( $ filter , $ compact = false ) { return $ this -> wrapPreview ( $ this -> imageWith ( $ filter ) , $ compact ) ; } | Previews the image with given filter |
6,529 | public static function slugify ( $ text ) { $ text = preg_replace ( '#[^\\pL\d]+#u' , '-' , $ text ) ; $ text = trim ( $ text , '-' ) ; if ( function_exists ( 'iconv' ) ) { $ text = iconv ( 'utf-8' , 'us-ascii//TRANSLIT' , $ text ) ; } $ text = mb_strtolower ( $ text ) ; $ text = preg_replace ( '#[^-\w]+#' , '' , $ tex... | Vrati seo friendly slug . |
6,530 | public static function cliMessage ( $ string ) { $ preString = ' | ' ; if ( is_array ( $ string ) ) { echo $ preString . implode ( "\n==> " , $ string ) . "\n" ; } else { echo $ preString . $ string . "\n" ; } } | Vrati zpravu do prikazove radky . |
6,531 | public static function idize ( $ string , $ capitalize = false ) { $ string = mb_strtolower ( static :: stripDiacritics ( $ string ) ) ; $ string = preg_replace ( '/[^0-9a-zA-Z-]/i' , '-' , $ string ) ; $ string = preg_replace ( '/(-+)/i' , '-' , $ string ) ; $ string = trim ( $ string , '-' ) ; return $ capitalize ? m... | Upravi zadany retezec do podoby ktera muze byt bezpecne pouzita jako id nebo predevsim v url jako rewrite string . |
6,532 | public static function parseName ( $ name ) { $ name = urldecode ( $ name ) ; $ names = explode ( ' ' , str_replace ( ',' , '' , $ name ) ) ; $ pretitle = $ first_name = $ last_name = $ posttitle = '' ; foreach ( $ names as $ name ) { if ( ( '.' === mb_substr ( $ name , - 1 ) || 'et' === $ name ) && empty ( $ first_nam... | Rozparsuje jmeno vcetne titulu pred a za jmenem . |
6,533 | public static function getImageDpi ( $ filename ) { $ a = fopen ( $ filename , 'r' ) ; $ string = fread ( $ a , 20 ) ; fclose ( $ a ) ; $ data = bin2hex ( mb_substr ( $ string , 14 , 4 ) ) ; $ x = mb_substr ( $ data , 0 , 4 ) ; $ y = mb_substr ( $ data , 0 , 4 ) ; return [ hexdec ( $ x ) , hexdec ( $ y ) ] ; } | Counts image DPI . |
6,534 | public static function identifyImage ( $ filename ) { $ dpi = static :: getImageDpi ( $ filename ) ; $ data = [ ] ; $ data [ 'dpi_x' ] = $ dpi [ 0 ] ; $ data [ 'dpi_y' ] = $ dpi [ 1 ] ; if ( 10752 === $ data [ 'dpi_x' ] ) { $ data [ 'dpi_x' ] = 72 ; } if ( 10752 === $ data [ 'dpi_y' ] ) { $ data [ 'dpi_y' ] = 72 ; } $ ... | Identify image without Imagick . |
6,535 | public static function dirSize ( $ directory ) { $ size = 0 ; foreach ( new \ RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ directory , \ FilesystemIterator :: KEY_AS_PATHNAME ) ) as $ file ) { $ size += $ file -> getSize ( ) ; } return $ size ; } | Get the directory size . |
6,536 | public function login ( $ username , $ password ) { $ data = $ this -> matrix ( ) -> request ( 'POST' , $ this -> endpoint ( 'login' ) , [ 'type' => 'm.login.password' , 'user' => $ username , 'password' => $ password ] ) ; $ this -> setData ( $ data ) ; return $ this -> data ; } | Authenticates the user and issues an access token they can use to authorize themself in subsequent requests . |
6,537 | public function logout ( ) { if ( $ this -> check ( ) ) { $ this -> matrix ( ) -> request ( 'POST' , $ this -> endpoint ( 'logout' ) , [ ] , [ 'access_token' => $ this -> data [ 'access_token' ] ] ) ; $ this -> setData ( null ) ; return true ; } throw new \ Exception ( 'Not authenticated' ) ; } | Invalidates an existing access token so that it can no longer be used for authorization . |
6,538 | protected function countBindingsFromQuery ( string $ query ) { preg_match_all ( $ this -> getBindingPattern ( ) , $ query , $ matches ) ; return count ( $ matches [ 0 ] ?? [ ] ) ; } | Counts bindings in query by given pattern . |
6,539 | protected function escapeBindings ( array $ bindings ) : array { foreach ( $ bindings as $ key => $ value ) { $ bindings [ $ key ] = Sanitizer :: escape ( $ value ) ; } return $ bindings ; } | Escapes values . |
6,540 | public function get3pid ( ) { if ( $ this -> check ( ) ) { return $ this -> matrix ( ) -> request ( 'GET' , $ this -> endpoint ( 'account/3pid' ) , [ ] , [ 'access_token' => $ this -> data [ 'access_token' ] ] ) ; } throw new \ Exception ( 'Not authenticated' ) ; } | Gets a list of the third party identifiers that the homeserver has associated with the user s account . |
6,541 | public function set3pid ( $ data ) { if ( $ this -> check ( ) ) { return $ this -> matrix ( ) -> request ( 'POST' , $ this -> endpoint ( 'account/3pid' ) , $ data , [ 'access_token' => $ this -> data [ 'access_token' ] ] ) ; } throw new \ Exception ( 'Not authenticated' ) ; } | Adds contact information to the user s account . |
6,542 | public function deactivate ( ) { if ( $ this -> check ( ) ) { return $ this -> matrix ( ) -> request ( 'POST' , $ this -> endpoint ( 'account/deactivate' ) , [ 'auth' => [ 'type' => 'm.login.password' ] ] , [ 'access_token' => $ this -> data [ 'access_token' ] ] ) ; } throw new \ Exception ( 'Not authenticated' ) ; } | Deactivate the user s account removing all ability for the user to login again . |
6,543 | public function password ( $ oldPassword , $ newPassword ) { if ( $ this -> check ( ) ) { return $ this -> matrix ( ) -> request ( 'POST' , $ this -> endpoint ( 'account/password' ) , [ 'auth' => [ 'type' => 'm.login.password' , 'user' => $ this -> data [ 'user_id' ] , 'password' => $ oldPassword ] , 'new_password' => ... | Changes the password for an account on this homeserver . |
6,544 | public function getProfile ( $ userId = null ) { if ( ! $ userId ) { if ( ! $ this -> check ( ) ) { throw new \ Exception ( 'Not authenticated' ) ; } $ userId = $ this -> data [ 'user_id' ] ; } return $ this -> matrix ( ) -> request ( 'GET' , $ this -> endpoint ( 'profile/' . urlencode ( $ userId ) ) ) ; } | Get the combined profile information for this user . This API may be used to fetch the user s own profile information or other users ; either locally or on remote homeservers . |
6,545 | public function presentHtmlMedia ( $ mediaType ) { $ html = '<source src="' . $ this -> entity -> getPublicURL ( ) . '" type="' . $ this -> mimetype . '">' ; foreach ( $ this -> entity -> substitutes as $ substitute ) { $ html .= '<source src="' . uploaded_asset ( $ substitute -> path ) . '" type="' . $ substitute -> m... | Presents audio html |
6,546 | public function getVerbosityAsParameter ( OutputInterface $ output ) { switch ( $ output -> getVerbosity ( ) ) { case OutputInterface :: VERBOSITY_DEBUG : $ verbosity = ' -vvv' ; break ; case OutputInterface :: VERBOSITY_VERY_VERBOSE : $ verbosity = ' -vv' ; break ; case OutputInterface :: VERBOSITY_VERBOSE : $ verbosi... | Returns OutputInterface verbosity as parameter that can be used in cli command |
6,547 | private function addFieldToSort ( Search $ search , $ sortField ) { $ search -> addSort ( new FieldSort ( $ sortField [ 'field' ] , $ sortField [ 'order' ] , isset ( $ sortField [ 'mode' ] ) ? [ 'mode' => $ sortField [ 'mode' ] ] : [ ] ) ) ; } | Adds sort field parameters into given search object . |
6,548 | public function getOpponents ( $ moduleName ) { if ( ! isset ( $ this -> moduleNames [ $ moduleName ] ) ) { return array ( ) ; } $ opponents = $ this -> moduleNames ; unset ( $ opponents [ $ moduleName ] ) ; return array_keys ( $ opponents ) ; } | Returns the opposing module names in the conflict . |
6,549 | private function resizeByWidth ( $ originalWidth , $ originalHeight , $ targetWidth ) { $ targetHeight = ( $ targetWidth * $ originalHeight ) / $ originalWidth ; return $ this -> verifySize ( $ originalWidth , $ originalHeight , $ targetWidth , $ targetHeight ) ; } | Get Resize size when width > height . |
6,550 | private function resizeByHeight ( $ originalWidth , $ originalHeight , $ targetHeight ) { $ targetWidth = ( $ targetHeight * $ originalWidth ) / $ originalHeight ; return $ this -> verifySize ( $ originalWidth , $ originalHeight , $ targetWidth , $ targetHeight ) ; } | get resize size when height > width . |
6,551 | private function verifySize ( $ originalWidth , $ originalHeight , $ targetWidth , $ targetHeight ) { if ( $ originalWidth < $ targetWidth && $ originalHeight < $ targetHeight ) { return array ( 'width' => $ originalWidth , 'height' => $ originalHeight , ) ; } return array ( 'width' => $ targetWidth , 'height' => $ tar... | Verify if the target size > originial size if true return original size . |
6,552 | public function add ( $ item , $ url = '' ) { $ this -> validateItemClassType ( $ item ) ; $ this -> createSitemapFile ( ) ; $ xmlData = $ item -> build ( ) ; if ( false === $ this -> isNewFileIsRequired ( ) && false === $ this -> isSurpassingFileSizeLimit ( $ xmlData ) ) { $ this -> appendToFile ( $ xmlData ) ; ++ $ t... | Adds a new sitemap item . |
6,553 | public function isValid ( $ value ) { if ( ! $ value ) { $ this -> error ( self :: MISSING_VALUE ) ; return false ; } $ response = $ this -> getService ( ) -> verify ( $ value ) ; if ( $ response -> getStatus ( ) === true ) { return true ; } $ this -> error ( self :: ERR_CAPTCHA ) ; return false ; } | Check if captcha is valid |
6,554 | public function setStartDate ( $ startDate ) : void { if ( is_string ( $ startDate ) ) { $ startDate = new Time ( $ startDate ) ; } $ this -> startDate = $ startDate ; } | Set Start Date of event |
6,555 | public function setEndDate ( $ endDate ) : void { if ( is_string ( $ endDate ) ) { $ endDate = new Time ( $ endDate ) ; } $ this -> endDate = $ endDate ; } | Set End Date of event |
6,556 | private function insertContextInAllowedExtensions ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> contexts ) ) { throw new \ Exception ( 'The context ' . $ name . ' is not defined.' ) ; } $ this -> allowedExtensions = array_merge ( $ this -> contexts [ $ name ] , $ this -> allowedExtensions ) ; } | Insert contexts extensions in allowed extensions . |
6,557 | public function addContexts ( $ contexts ) { if ( is_array ( $ contexts ) ) { foreach ( $ contexts as $ context ) { $ this -> insertContextInAllowedExtensions ( $ context ) ; } } elseif ( $ contexts !== false ) { $ this -> insertContextInAllowedExtensions ( $ contexts ) ; } return $ this ; } | Add other context . |
6,558 | public function addEvent ( Event $ event , EntityInterface $ entity , ArrayObject $ options = null ) : void { $ entities = $ result = [ ] ; if ( empty ( $ options ) ) { $ options = new ArrayObject ( ) ; } $ table = $ event -> getSubject ( ) ; $ calendarsTable = TableRegistry :: get ( 'Qobo/Calendar.Calendars' ) ; $ eve... | Add CalendarEvent from App |
6,559 | public function getPluginCalendars ( Event $ event , array $ options = [ ] ) : void { $ content = $ result = [ ] ; $ table = TableRegistry :: get ( 'Qobo/Calendar.Calendars' ) ; if ( ! empty ( $ event -> result ) ) { $ result = $ event -> result ; } $ options = array_merge ( $ options , [ 'conditions' => [ 'source LIKE... | Get calendars from the plugin only . |
6,560 | public function getPluginCalendarEvents ( Event $ event , EntityInterface $ calendar , array $ options = [ ] ) : void { $ table = TableRegistry :: get ( 'Qobo/Calendar.CalendarEvents' ) ; $ events = $ table -> getEvents ( $ calendar , $ options ) ; $ event -> result = $ events ; } | Get calendar events from the plugin only . |
6,561 | public function setFocusLeft ( $ focusLeft ) { if ( $ focusLeft !== $ this -> focusLeft ) { $ this -> focusIsEdited = true ; $ this -> focusLeft = $ focusLeft ; } return $ this ; } | Set focusLeft . |
6,562 | public function setFocusTop ( $ focusTop ) { if ( $ focusTop !== $ this -> focusTop ) { $ this -> focusIsEdited = true ; $ this -> focusTop = $ focusTop ; } return $ this ; } | Set focusTop . |
6,563 | public static function send ( $ url ) { if ( false === \ filter_var ( $ url , FILTER_VALIDATE_URL , [ 'options' => [ 'flags' => FILTER_FLAG_PATH_REQUIRED ] ] ) ) { throw new SitemapException ( 'The value for $url is not a valid URL resource.' ) ; } return self :: submitSitemap ( $ url ) ; } | Submits a Sitemap to the available search engines . If provided it will first to send the GZipped version . |
6,564 | protected static function submitSitemap ( $ url ) { $ response = [ ] ; foreach ( self :: $ sites as $ site => $ baseUrl ) { $ submitUrl = \ str_replace ( '{{sitemap}}' , $ url , $ baseUrl ) ; $ response = self :: executeCurl ( $ submitUrl , $ response , $ site ) ; } return $ response ; } | Submits a sitemap to the search engines using file_get_contents . |
6,565 | public static function checkLogin ( ) { if ( TL_MODE !== 'FE' ) { return false ; } if ( ! is_subclass_of ( 'BackendUser' , UserInterface :: class ) && ! \ Input :: cookie ( 'BE_USER_AUTH' ) ) { return false ; } $ User = FrontendHelperUser :: getInstance ( ) ; if ( ! $ User -> authenticate ( ) ) { return false ; } if ( ... | checks if a Backend User is logged in |
6,566 | public function getBackendModuleLabel ( $ config , $ id = null , $ withParentTable = false ) { if ( $ withParentTable ) { \ Controller :: loadDataContainer ( $ config [ 'table' ] ) ; if ( ! empty ( $ GLOBALS [ 'TL_DCA' ] [ $ config [ 'table' ] ] [ 'config' ] [ 'ptable' ] ) ) { $ ptable = $ GLOBALS [ 'TL_DCA' ] [ $ conf... | get the label for a backend module link |
6,567 | protected static function addTemplateURL ( $ data ) { if ( substr ( $ data [ 'templatePath' ] , 0 , 10 ) === 'templates/' ) { $ data [ 'templateURL' ] = static :: getBackendURL ( 'tpl_editor' , null , $ data [ 'templatePath' ] , 'source' ) ; \ System :: loadLanguageFile ( 'tl_files' ) ; $ data [ 'templateLabel' ] = spr... | Add templateURL and templateLabel to data array |
6,568 | protected function getThemeAssistantStylesheet ( ) { if ( ! $ GLOBALS [ 'objPage' ] || ! $ GLOBALS [ 'objPage' ] -> getRelated ( 'layout' ) ) { return null ; } if ( ! $ stylesheets = $ GLOBALS [ 'objPage' ] -> getRelated ( 'layout' ) -> external ) { return null ; } $ stylesheets = \ StringUtil :: deserialize ( $ styles... | Get path to the . css . base file of the current layout |
6,569 | protected static function getBackendURL ( $ do , $ table , $ id , $ act = 'edit' , array $ params = array ( ) ) { $ addParams = array ( ) ; foreach ( array ( 'do' , 'table' , 'act' , 'id' ) as $ key ) { if ( $ $ key ) { $ addParams [ $ key ] = $ $ key ; } } $ params = array_merge ( $ addParams , $ params ) ; $ params [... | create backend edit URL |
6,570 | public function rollback ( ) { for ( $ i = count ( $ this -> completedOperations ) - 1 ; $ i >= 0 ; -- $ i ) { $ this -> completedOperations [ $ i ] -> rollback ( ) ; } $ this -> completedOperations = array ( ) ; } | Rolls back all executed operations . |
6,571 | public function get ( $ serverName ) { if ( ! isset ( $ this -> servers [ $ serverName ] ) ) { throw NoSuchServerException :: forServerName ( $ serverName ) ; } return $ this -> servers [ $ serverName ] ; } | Returns the server with the given name . |
6,572 | public static function parseHex ( $ color ) { if ( ! preg_match ( '/^#[A-Fa-f0-9]{6}$/' , $ color ) ) { throw new WrongColorFormatException ( $ color ) ; } return new Color ( hexdec ( substr ( $ color , 1 , 2 ) ) , hexdec ( substr ( $ color , 3 , 2 ) ) , hexdec ( substr ( $ color , 5 , 2 ) ) ) ; } | Parses a hex string to create a Color object . |
6,573 | public function makeFilesystem ( array $ configs ) { $ adapter = $ this -> getAdapter ( $ configs ) ; if ( ! $ adapter instanceof Adapter ) { throw new \ Exception ( 'The adapter must has instance of Gaufrette\Adapter' ) ; } $ this -> filesystem = new Filesystem ( $ adapter ) ; return $ this ; } | Make Gaufrette filesystem . |
6,574 | public function setUrl ( $ url ) { $ this -> urlAbsolute = preg_replace ( '#/$#' , '' , $ url ) ; if ( $ this -> urlRelative === null ) { $ this -> urlRelative = $ this -> urlAbsolute ; } return $ this ; } | Set absolute url . |
6,575 | public function takeSnapshot ( ) { $ this -> enabledTypeBefore = null ; if ( $ this -> typeDescriptors -> contains ( $ this -> typeName ) ) { foreach ( $ this -> typeDescriptors -> listByTypeName ( $ this -> typeName ) as $ typeDescriptor ) { if ( $ typeDescriptor -> isEnabled ( ) ) { $ this -> enabledTypeBefore = $ ty... | Records whether the type name is currently enabled . |
6,576 | private function buildRelationsTree ( $ relationType ) { $ filter = new ArrayNodeDefinition ( $ relationType ) ; $ filter -> validate ( ) -> ifTrue ( function ( $ v ) { return empty ( $ v [ 'include' ] ) && empty ( $ v [ 'exclude' ] ) ; } ) -> thenInvalid ( 'Relation must have "include" or "exclude" fields specified.' ... | Builds relations config tree for given relation name . |
6,577 | public function addContent ( FilterResponseEvent $ event ) { if ( HttpKernel :: MASTER_REQUEST != $ event -> getRequestType ( ) ) { return ; } $ response = $ event -> getResponse ( ) ; $ content = $ response -> getContent ( ) ; if ( strpos ( $ content , 'data-apoutchika-media="' ) !== false ) { $ js = array ( ) ; $ lib... | Detect if the response has media field in her content and add css js and templates for mustaches . |
6,578 | protected function reloadBindingDescriptor ( BindingDescriptor $ bindingDescriptor ) { if ( ! $ bindingDescriptor -> isLoaded ( ) ) { return ; } $ containingModule = $ bindingDescriptor -> getContainingModule ( ) ; $ typeName = $ bindingDescriptor -> getTypeName ( ) ; $ typeDescriptor = $ this -> typeDescriptors -> get... | Unloads and loads a binding descriptor . |
6,579 | public function add ( BindingTypeDescriptor $ typeDescriptor ) { $ this -> map -> set ( $ typeDescriptor -> getTypeName ( ) , $ typeDescriptor -> getContainingModule ( ) -> getName ( ) , $ typeDescriptor ) ; } | Adds a type descriptor . |
6,580 | public function getEnabled ( $ typeName ) { if ( ! $ this -> contains ( $ typeName ) ) { return null ; } foreach ( $ this -> listByTypeName ( $ typeName ) as $ typeDescriptor ) { if ( $ typeDescriptor -> isEnabled ( ) ) { return $ typeDescriptor ; } } return null ; } | Returns the enabled type descriptor for a given type name . |
6,581 | public function getCalendars ( array $ options = [ ] ) : array { $ result = $ conditions = [ ] ; if ( ! empty ( $ options [ 'conditions' ] ) ) { $ conditions = $ options [ 'conditions' ] ; } $ query = $ this -> find ( ) -> where ( $ conditions ) -> order ( [ 'name' => 'ASC' ] ) -> all ( ) ; $ result = $ query -> toArra... | Get Calendar entities . |
6,582 | public function getColor ( ? EntityInterface $ entity = null ) : string { $ color = Configure :: read ( 'Calendar.Configs.color' ) ; if ( $ entity instanceof EntityInterface && ! empty ( $ entity -> get ( 'color' ) ) ) { $ color = $ entity -> get ( 'color' ) ; } if ( ! $ color ) { $ color = '#337ab7' ; } return $ color... | Get Default calendar color . |
6,583 | public function getByAllowedEventTypes ( ? string $ tableName = null , array $ options = [ ] ) : array { $ result = [ ] ; $ query = $ this -> find ( ) ; $ query -> execute ( ) ; $ query -> all ( ) ; if ( ! $ query -> count ( ) ) { return $ result ; } $ resultSet = $ query -> all ( ) ; foreach ( $ resultSet as $ calenda... | Get the list of Calendar instances |
6,584 | public function saveCalendarEntity ( array $ calendar = [ ] , array $ options = [ ] ) : array { $ response = [ 'errors' => [ ] , 'status' => false , 'entity' => null , ] ; $ query = $ this -> find ( ) -> where ( $ options [ 'conditions' ] ) ; $ query -> execute ( ) ; if ( ! $ query -> count ( ) ) { $ entity = $ this ->... | Save Calendar Entity |
6,585 | protected function getEventTypes ( ? string $ data = null ) : array { $ result = [ ] ; if ( empty ( $ data ) ) { return $ result ; } $ result = json_decode ( $ data , true ) ; return $ result ; } | Get Event Types saved within Calendar |
6,586 | public function toEntity ( ) : EntityInterface { $ data = [ ] ; $ entityProvider = $ this -> getEntityProvider ( ) ; foreach ( get_object_vars ( $ this ) as $ property => $ value ) { $ method = Inflector :: variable ( 'get ' . $ property ) ; if ( method_exists ( $ this , $ method ) && is_callable ( [ $ this , $ method ... | Convert Generic Object to corresponding Cake \ ORM \ Entity |
6,587 | public function createReference ( MediaInterface $ media ) { $ allowed = false ; foreach ( $ this -> contexts as $ context ) { if ( in_array ( $ media -> getExtension ( ) , $ context ) ) { $ allowed = true ; break ; } } if ( $ allowed === false ) { $ this -> error = array ( 'error.extensionNotAllowed' , array ( '%exten... | Create reference for media . |
6,588 | public function search ( $ filterKey , $ q = null , $ type = null ) { if ( $ type == 0 ) { $ type = null ; } if ( ! $ this -> filter -> has ( $ filterKey ) ) { return array ( ) ; } $ qb = $ this -> entityManager -> getRepository ( $ this -> class ) -> createQueryBuilder ( 'm' ) -> select ( 'm.id as id' ) ; $ filter = $... | Query for search medias with keywords and type . |
6,589 | public function findAllByFiltersKeys ( array $ filtersKeys ) { $ qb = $ this -> entityManager -> getRepository ( $ this -> class ) -> createQueryBuilder ( 'm' ) ; $ filters = array ( ) ; $ addNull = false ; $ inversedfilters = array ( ) ; foreach ( $ filtersKeys as $ filter ) { if ( $ this -> filter -> has ( $ filter )... | Custom find all sort by createAt desc . |
6,590 | public function delete ( $ media , $ flush = true ) { parent :: delete ( $ media , $ flush ) ; foreach ( $ this -> filesystemManipulator -> keys ( ) as $ key ) { if ( preg_match ( '#/' . $ media -> getReference ( ) . '$#' , $ key ) ) { $ this -> filesystemManipulator -> delete ( $ key ) ; } } } | Delete media entity and files . |
6,591 | private function saveFile ( MediaInterface $ media ) { $ file = $ media -> getFile ( ) ; $ fileInfo = new FileInfo ( $ file ) ; $ type = $ fileInfo -> getType ( ) ; $ media -> setType ( $ type ) ; if ( $ media -> getName ( ) === null ) { $ media -> setName ( $ fileInfo -> getName ( ) ) ; $ media -> setAlt ( $ fileInfo ... | Save new file . |
6,592 | public function setSizeWidthAndHeight ( MediaInterface $ media ) { $ key = $ this -> originalDir . '/' . $ media -> getReference ( ) ; $ media -> setSize ( $ this -> filesystemManipulator -> size ( $ key ) ) ; if ( $ media -> getType ( ) === $ media :: IMAGE ) { $ image = $ this -> imagine -> load ( $ this -> filesyste... | Set size of file if it s image set width and height . |
6,593 | public function getUrl ( MediaInterface $ media , $ alias = null ) { return $ this -> filesystemManipulator -> url ( $ this -> getAliasAndKey ( $ media , $ alias ) ) ; } | Get relative url of media . |
6,594 | public function getAbsoluteUrl ( MediaInterface $ media , $ alias = null ) { return $ this -> filesystemManipulator -> url ( $ this -> getAliasAndKey ( $ media , $ alias ) , true ) ; } | Get absolute url of media . |
6,595 | public function getPath ( MediaInterface $ media , $ alias = null ) { return $ this -> filesystemManipulator -> path ( $ this -> getAliasAndKey ( $ media , $ alias ) ) ; } | Get path of media . |
6,596 | public function getContent ( MediaInterface $ media , $ alias = null ) { return $ this -> filesystemManipulator -> read ( $ this -> getAliasAndKey ( $ media , $ alias ) ) ; } | Get content of file . |
6,597 | public function getAliasAndKey ( MediaInterface $ media , $ alias = null ) { $ aliasManipulator = $ this -> aliasManipulatorFactory -> setAlias ( $ alias ) ; if ( $ media -> getType ( ) === $ media :: IMAGE ) { $ alias = $ aliasManipulator -> getAliasName ( ) ; if ( $ alias !== $ this -> originalDir ) { $ this -> cropI... | Get key of media for filesystem . If image with alias crop it . |
6,598 | private function cropImage ( MediaInterface $ media , AliasManipulator $ aliasManipulator ) { $ aliasName = $ aliasManipulator -> getAliasName ( ) ; $ aliasArray = $ aliasManipulator -> getAliasArray ( ) ; $ mediaPath = $ aliasName . '/' . $ media -> getReference ( ) ; if ( $ this -> filesystemManipulator -> has ( $ me... | Crop image if is not exists in alias . |
6,599 | public function getHtml ( MediaInterface $ media , $ alias = null ) { if ( $ media -> getType ( ) == $ media :: IMAGE ) { $ template = 'ApoutchikaMediaBundle:Render:image.html.twig' ; } elseif ( $ media -> getType ( ) == $ media :: VIDEO ) { $ template = 'ApoutchikaMediaBundle:Render:video.html.twig' ; } elseif ( $ med... | Render html of media . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.