idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
12,000 | public function getCountriesArray ( ) { $ return = json_decode ( $ this -> Country ) ; if ( empty ( $ return ) && isset ( $ this -> Country ) ) { $ return = [ $ this -> Country ] ; } return $ return ; } | Return an array of all associated countries |
12,001 | protected function getSpecification ( $ file , $ settings , $ artifact ) { return fphp \ Specification \ ChunkSpecification :: fromArrayAndSettings ( $ file , $ settings ) ; } | Returns a chunk specification from a plain settings array . |
12,002 | protected function compileJsonUpdateColumn ( $ key , JsonExpression $ value ) { $ path = explode ( '->' , $ key ) ; $ field = $ this -> wrapValue ( array_shift ( $ path ) ) ; $ accessor = '"$.' . implode ( '.' , $ path ) . '"' ; return "{$field} = json_set({$field}, {$accessor}, {$value->getValue()})" ; } | Prepares a JSON column being updated using the JSON_SET function . |
12,003 | public function parseGitAttributesLine ( $ line ) { $ parts = preg_split ( '#\s+#' , $ line ) ; if ( count ( $ parts ) != 2 ) { return null ; } if ( $ parts [ 1 ] === 'export-ignore' ) { return $ this -> generatePattern ( $ parts [ 0 ] ) ; } } | Callback parser which finds export - ignore rules in git attribute lines |
12,004 | public function hasData ( ) { if ( count ( $ this -> files ) >= 1 ) { if ( $ this -> files [ 0 ] === 'php://stdin' || filesize ( $ this -> files [ 0 ] ) > 0 ) { return true ; } } return false ; } | Returns whether the file set contains files |
12,005 | private function openFile ( $ isFirst = false ) { if ( $ this -> fp != null ) { fclose ( $ this -> fp ) ; $ this -> fp = null ; } $ file = $ isFirst ? current ( $ this -> files ) : next ( $ this -> files ) ; while ( $ this -> fp == null && $ file !== false ) { if ( $ file === 'php://stdin' || file_exists ( $ file ) ) {... | Opens the next file in the set and returns true on success . |
12,006 | public function export ( ) { $ messages = implode ( "\n" , array_map ( [ $ this , 'formatMessage' ] , $ this -> messages ) ) . "\n" ; $ stdout = fopen ( 'php://stdout' , 'w' ) ; if ( $ stdout === false ) { throw new InvalidConfigException ( 'Unable to open stdout stream' ) ; } fwrite ( $ stdout , $ messages ) ; fclose ... | Write yii logs to stdout |
12,007 | public static function enterScope ( $ scope ) { if ( ! is_scalar ( $ scope ) ) { throw new \ InvalidArgumentException ( "Only scalars allowed as scope identifiers" ) ; } array_push ( self :: $ scope , $ scope ) ; list ( $ call ) = debug_backtrace ( 0 ) ; array_push ( self :: $ scopeChange , $ call ) ; } | Keeps track of scope |
12,008 | private function _make_power_operation ( $ sid , $ action ) { $ data = $ this -> _data ; $ data [ 'sid' ] = $ sid ; $ data [ 'action' ] = $ action ; try { return $ this -> _make_request ( self :: POWER_OP_URL , $ data , 'POST' ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( 'Something gone wrong' , 0 , $ e ) ... | Perform the power operation on the server |
12,009 | private static function fixHttpHeaderField ( $ header ) { if ( ! is_array ( $ header ) ) { $ header = explode ( "\r\n" , $ header ) ; } uasort ( $ header , function ( $ el ) { return preg_match ( '{^content-type}i' , $ el ) ? 1 : - 1 ; } ) ; return $ header ; } | A bug in PHP prevents the headers from correctly being sent when a content - type header is present and NOT at the end of the array |
12,010 | public function stop_track ( $ id_task , $ message = false , $ id_user = false ) { $ ok = false ; $ now = time ( ) ; if ( ( $ active_track = $ this -> get_active_track ( $ id_user ) ) && ( $ active_track [ 'id_task' ] === $ id_task ) ) { $ ok = true ; if ( ! empty ( $ message ) && ! ( $ id_note = $ this -> comment ( $ ... | Stops a track . |
12,011 | public function getRootId ( ) { if ( empty ( $ this -> hierarchy ) ) { throw new Exception \ LogicException ( 'The root item does not exist.' ) ; } reset ( $ this -> hierarchy ) ; $ id = key ( $ this -> hierarchy ) ; return $ id ; } | Returns the identifier of the root item |
12,012 | public function get ( array $ path ) { $ current = & $ this -> hierarchy ; foreach ( $ path as $ childId ) { if ( ! isset ( $ current [ $ childId ] ) ) { return [ ] ; } $ current = & $ current [ $ childId ] ; } return $ current ; } | Gets hierarchy by the path |
12,013 | public function remove ( array $ path ) { $ current = & $ this -> hierarchy ; $ pathLength = count ( $ path ) ; for ( $ i = 0 ; $ i < $ pathLength ; $ i ++ ) { if ( ! isset ( $ current [ $ path [ $ i ] ] ) ) { break ; } if ( $ i === $ pathLength - 1 ) { unset ( $ current [ $ path [ $ i ] ] ) ; break ; } $ current = & $... | Removes the item from the hierarchy |
12,014 | public function createService ( ServiceLocatorInterface $ viewHelperManager ) { $ serviceLocator = $ viewHelperManager -> getServiceLocator ( ) ; $ config = $ serviceLocator -> has ( 'config' ) ? $ serviceLocator -> get ( 'config' ) : array ( ) ; if ( isset ( $ config [ 'dojo' ] ) ) { $ this -> config ( $ config [ 'doj... | Create and configure service |
12,015 | public function setDebug ( $ flag = true ) { $ this -> debug = $ this -> getSession ( ) -> debug = ( bool ) $ flag ; if ( true == $ this -> debug ) { if ( isset ( $ this -> options [ 'debugOptions' ] ) && is_array ( $ this -> options [ 'debugOptions' ] ) ) { $ this -> initializeOptions ( $ this -> options [ 'debugOptio... | Set debug flag |
12,016 | public function initialize ( ) { if ( true == $ this -> initialized ) { return ; } $ this -> initialized = true ; if ( $ this -> isEnabled ( ) ) { $ headScript = $ this -> getView ( ) -> plugin ( 'headScript' ) ; $ headScript -> prependFile ( $ this -> src ) ; $ options = array ( ) ; foreach ( array ( 'async' , 'parseO... | Add Dojo configuration to HeadScript . Should only be called once . |
12,017 | private function getFolderContent ( $ dir ) { $ finder = Finder :: create ( ) -> ignoreVCS ( false ) -> ignoreDotFiles ( false ) -> depth ( 0 ) -> in ( $ dir ) ; return iterator_to_array ( $ finder ) ; } | Returns the folder content excluding dotfiles |
12,018 | public function import ( $ page , $ areaHandle , SimpleXMLElement $ blockNode ) { parent :: import ( $ page , $ areaHandle , $ blockNode ) ; } | Runs when a block is being imported . |
12,019 | public function add ( $ element , $ index = null ) { if ( $ index === null ) { $ this -> array [ $ this -> count ( ) ] = $ element ; } else { array_splice ( $ this -> array , $ index , 0 , $ element ) ; } return $ this ; } | Adds an element to that array |
12,020 | protected function doSort ( & $ array , $ cmp , callable $ usort , callable $ sort ) { if ( is_callable ( $ cmp ) ) { $ usort ( $ array , $ cmp ) ; } else if ( $ cmp instanceof Comparator ) { $ usort ( $ array , function ( $ a , $ b ) use ( $ cmp ) { return $ cmp -> compare ( $ a , $ b ) ; } ) ; } else { $ sort ( $ arr... | Internal sort function |
12,021 | public function find ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } foreach ( $ this -> array as $ element ) { $ return = func_num_args ( ) == 1 ? $ callback ( $ element ) : $ callback ( $ element , $ query ) ; if ( $ r... | Searches the array with a given callback and returns the first element if found . |
12,022 | public function findLast ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ reverse = array_reverse ( $ this -> array , true ) ; foreach ( $ reverse as $ element ) { $ return = func_num_args ( ) == 1 ? $ callback ( $ elem... | Searches the array with a given callback and returns the last element if found . |
12,023 | public function findAll ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ array = [ ] ; foreach ( $ this -> array as $ k => $ element ) { $ return = func_num_args ( ) == 1 ? $ callback ( $ element ) : $ callback ( $ elem... | Searches the array with a given callback and returns all matching elements . |
12,024 | protected function registerPlugin ( $ name = '' ) { $ view = $ this -> getView ( ) ; if ( $ this -> clientOptions !== false ) { $ options = empty ( $ this -> clientOptions ) ? '' : Json :: encode ( $ this -> clientOptions ) ; $ js = "$(document).foundation({ '$name' : { $options } });" ; $ view -> registerJs ( $ js ) ;... | Registers a specific Foundation plugin and call related methods |
12,025 | public function resolveOptions ( $ blockType , array $ options = [ ] ) { $ resolver = $ this -> getOptionResolver ( $ blockType ) ; return $ resolver -> resolve ( $ options ) ; } | Returns the combination of the default options for the given block type and the passed options |
12,026 | public function write ( ) { $ data = array ( ) ; $ dumper = new ArrayDumper ( ) ; foreach ( $ this -> getCanonicalPackages ( ) as $ package ) { $ data [ ] = $ dumper -> dump ( $ package ) ; } $ this -> file -> write ( $ data ) ; } | Writes writable repository . |
12,027 | public function append ( $ middleware , $ priority = 0 ) : Server { return $ this -> appendOnCondition ( $ middleware , $ this -> buildAlwaysTrue ( ) , $ priority ) ; } | Always adds a middleware to the stack . |
12,028 | public function appendOnPath ( $ middleware , string $ path , $ priority = 0 ) : Server { return $ this -> appendOnCondition ( $ middleware , $ this -> buildPathCondition ( $ path ) , $ priority ) ; } | Adds a middleware to the stack only if the request path matches . |
12,029 | public function appendOnCondition ( $ middleware , callable $ condition , $ priority = 0 ) : Server { if ( ! is_array ( $ middleware ) ) { $ middleware = [ $ middleware ] ; } foreach ( $ middleware as $ mw ) { $ this -> stack [ $ priority ] [ ] = [ $ condition , $ mw ] ; } return $ this ; } | Adds a middleware to the stack only if the condition returns true . |
12,030 | protected function setup_components ( ) { $ this -> load_components ( ) ; $ components = $ this -> get_components ( ) ; $ this -> set_component_parents ( $ components ) ; foreach ( $ components as $ component ) { if ( method_exists ( $ component , 'init' ) ) { $ component -> init ( ) ; } } } | Setup components and run init |
12,031 | protected function get_components ( ) { $ components = ( new \ ReflectionClass ( $ this ) ) -> getProperties ( ) ; $ components = array_map ( function ( $ property ) { return $ property -> name ; } , $ components ) ; $ components = array_filter ( $ components , [ $ this , 'is_component' ] ) ; $ components = array_map (... | Get all components with a getter and that uses the Component trait |
12,032 | protected function load ( $ component , $ args = [ ] ) { $ args = ( array ) $ args ; if ( ! property_exists ( $ this , $ component ) ) { return false ; } $ class = $ this -> $ component ; if ( ! is_string ( $ class ) ) { return false ; } if ( ! class_exists ( $ class ) ) { throw new \ Exception ( sprintf ( 'Can not fin... | Load any property on the current component based on its string value as the class via the container |
12,033 | public function toSql ( Connection $ connection , Grammar $ grammar ) { $ this -> addImpliedCommands ( ) ; $ statements = [ ] ; foreach ( $ this -> commands as $ command ) { $ method = 'compile' . ucfirst ( $ command -> name ) ; if ( method_exists ( $ grammar , $ method ) ) { if ( ! is_null ( $ sql = $ grammar -> { $ m... | Get the raw SQL statements for the blueprint . |
12,034 | public function render ( ) { $ items = [ 'header' => $ this -> header , 'description' => $ this -> description , 'breadcrumb' => $ this -> breadcrumb , 'content' => $ this -> build ( ) , ] ; return view ( 'merchant::content' , $ items ) -> render ( ) ; } | Render this content . |
12,035 | public function getToolTipTemplate ( $ field ) { if ( array_key_exists ( $ field , $ this -> toolTips ( ) ) ) { $ toolTip = Html :: tag ( 'span' , "{label}" , [ 'data-content' => $ this -> toolTips ( ) [ $ field ] , 'data-toggle' => 'popover' , 'data-trigger' => 'hover' , 'style' => 'cursor:help; border-bottom: 1px das... | Generate the tool tip template to use in form . |
12,036 | public function import ( $ modelName , $ defaultValues = [ ] , $ updateMultipleModel = false , $ queryConfigs = [ ] ) { $ isSuccessful = true ; $ sheetData = $ this -> arrayFromExcel ; $ this -> header = array_shift ( $ sheetData ) ; foreach ( $ sheetData as $ record ) { if ( $ updateMultipleModel ) { $ parentId = $ th... | Import the excel to the model using active record |
12,037 | public function getCellValue ( $ value , $ model , $ record , $ key , $ isParent = true ) { if ( $ isParent ) { if ( isset ( $ model -> importSafeAttributes ( ) [ $ value ] ) && is_array ( $ model -> importSafeAttributes ( ) [ $ value ] ) ) { $ array = $ model -> importSafeAttributes ( ) [ $ value ] ; return $ array [ ... | Get excel cell value . If the import safe attributes has the model declared it will grab the id from that model instead of the cell value |
12,038 | public function callbackFunction ( $ route = null , $ parameters = [ ] ) { if ( $ route === null || ! is_string ( $ route ) ) { $ uri = $ this -> request -> getUri ( ) ; } else { $ uri = $ this -> router -> generate ( $ route , $ parameters , Router :: ABSOLUTE_URL ) ; } $ result = parse_url ( $ uri ) ; if ( isset ( $ ... | Removes callbacks from query |
12,039 | protected function getCommandsByName ( Blueprint $ blueprint , $ name ) { return array_filter ( $ blueprint -> getCommands ( ) , function ( $ value ) use ( $ name ) { return $ value -> name === $ name ; } ) ; } | Get all of the commands with a given name . |
12,040 | public function activate ( Composer $ composer , IOInterface $ io , $ pluginName ) { $ plugin = $ this -> prepare ( __FUNCTION__ , $ composer , $ io , $ pluginName ) ; if ( $ plugin ) { $ result = $ this -> wp ( function ( ) use ( $ plugin ) { wp_cache_set ( 'plugins' , [ ] , 'plugins' ) ; return activate_plugin ( $ pl... | Activate a plugin . |
12,041 | public function deactivate ( Composer $ composer , IOInterface $ io , $ pluginName ) { $ plugin = $ this -> prepare ( __FUNCTION__ , $ composer , $ io , $ pluginName ) ; if ( $ plugin ) { $ result = $ this -> wp ( function ( ) use ( $ plugin ) { return deactivate_plugins ( $ plugin ) ; } ) ; $ this -> succeeded ( __FUN... | Deactivate a plugin . |
12,042 | public function uninstall ( Composer $ composer , IOInterface $ io , $ pluginName ) { $ plugin = $ this -> prepare ( __FUNCTION__ , $ composer , $ io , $ pluginName ) ; if ( $ plugin ) { $ result = $ this -> wp ( function ( ) use ( $ plugin ) { return uninstall_plugin ( $ plugin ) ; } ) ; $ this -> succeeded ( __FUNCTI... | Uninstall a plugin . |
12,043 | protected function prepare ( $ action , Composer $ composer , IOInterface $ io , $ pluginName ) { $ this -> composer = $ composer ; $ this -> io = $ io ; if ( $ this -> isPluginExcluded ( $ action , $ pluginName ) ) { return $ this -> excluded ( $ action , $ pluginName ) && false ; } $ plugin = $ this -> getPlugin ( $ ... | Prepare plugin interaction . |
12,044 | protected function getPlugin ( $ plugin ) { $ path = $ this -> plugin -> getPublicDirectory ( ) . '/plugins/' . $ plugin ; if ( file_exists ( $ path ) && is_dir ( $ path ) ) { $ files = scandir ( $ path ) ; foreach ( $ files as $ file ) { $ pattern = defined ( 'HHVM_VERSION' ) ? '/\.(php|hh)$/' : '/\.php$/' ; if ( preg... | Get the main plugin file for a plugin . |
12,045 | protected function executing ( $ action , $ plugin ) { $ this -> io -> write ( ' - ' . ucfirst ( $ this -> getActionExecuting ( $ action ) ) . ' plugin <info>' . $ plugin . '</info>' ) ; $ this -> io -> write ( '' ) ; } | Write action executing . |
12,046 | protected function wp ( Closure $ cmd ) { $ cmd = new ReflectionFunction ( $ cmd ) ; $ code = implode ( array_slice ( file ( $ cmd -> getFileName ( ) ) , ( $ startLine = $ cmd -> getStartLine ( ) - 1 ) , $ cmd -> getEndLine ( ) - $ startLine ) ) ; preg_match ( '/\\{(.*)\\}/s' , $ code , $ body ) ; $ vars = $ cmd -> get... | Run a closure in the WordPress environment . |
12,047 | public function store ( $ contentId ) { $ content = $ this -> repository -> getById ( $ contentId ) ; if ( ! empty ( $ content ) ) { $ this -> authorize ( 'create' , $ content ) ; $ this -> authorize ( 'update' , $ content ) ; if ( $ content -> type != 'category' ) { $ input = $ this -> validator -> validate ( 'create'... | Stores newly created route for specified content entity in database . |
12,048 | public static function lazyConnection ( $ dsn , $ name = false ) { Eresus_Kernel :: log ( __METHOD__ , LOG_DEBUG , '("%s", %s)' , $ dsn , $ name ) ; self :: $ lazyConnectionDSNs [ $ name ] = $ dsn ; } | Configures lazy connection to DB |
12,049 | public static function configureObject ( $ name ) { Eresus_Kernel :: log ( __METHOD__ , LOG_DEBUG , '(%s)' , $ name ) ; if ( ! isset ( self :: $ lazyConnectionDSNs [ $ name ] ) ) { throw new Eresus_DB_Exception ( 'DSN for lazy connection "' . $ name . '" not found' ) ; } $ dsn = self :: $ lazyConnectionDSNs [ $ name ] ... | eZ Components lazy init |
12,050 | public function subst ( $ query ) { foreach ( $ this -> values as $ key => $ value ) { $ query = preg_replace ( "/$key(\s|,|$)/" , "$value$1" , $ query ) ; } return $ query ; } | Substitute values in query |
12,051 | public function takeSnapShot ( $ user_agent = 'Surebert Kamera' , $ options = Array ( ) ) { $ ch = curl_init ( $ this -> url . '/jpg/1/image.jpg?timestamp=' . time ( ) ) ; curl_setopt ( $ ch , CURLOPT_HTTPAUTH , CURLAUTH_DIGEST ) ; curl_setopt ( $ ch , CURLOPT_USERPWD , $ this -> uname . ':' . $ this -> pass ) ; curl_s... | Retrives a current snapshot |
12,052 | public function saveSnapshot ( $ dir ) { if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0775 , true ) ; } $ jpeg = $ this -> takeSnapShot ( ) ; $ file = $ dir . '/' . date ( 'Y_m_d_H_i_s' ) . '.jpg' ; if ( file_put_contents ( $ file , $ jpeg ) ) { return $ file ; } return '' ; } | Retrieves and stores a snapshot by date |
12,053 | protected function checkEnvironment ( InputInterface $ input , OutputInterface $ output ) { $ env = $ input -> getParameterOption ( [ '--env' , '-e' ] , getenv ( 'SYMFONY_ENV' ) ? : 'dev' ) ; if ( 'test' != $ env ) { $ output -> writeln ( '<bg=red> </bg=red> <fg=red>Warning, make sure your tests are being run against ... | Check environment . If not test add a notice |
12,054 | private function sanitize ( $ filename ) { $ filename = preg_replace ( '/[^A-Za-z0-9\-\._]/' , '.' , ( string ) $ filename ) ; return trim ( substr ( preg_replace ( '/[_\.\-]{2,}/' , '.' , $ filename ) , 0 , 40 ) , '._-' ) ; } | Sanitizes filename . |
12,055 | public function pane ( ) { global $ step ; require_privs ( 'rah_backup' ) ; $ steps = array ( 'browser' => false , 'create' => true , 'download' => true , 'multi_edit' => true , ) ; if ( ! $ step || ! bouncer ( $ step , $ steps ) || ! has_privs ( 'rah_backup_' . $ step ) ) { $ step = 'browser' ; } $ this -> $ step ( ) ... | Delivers panels . |
12,056 | public function head ( ) { global $ event , $ theme ; if ( $ event != 'rah_backup' ) { return ; } gTxtScript ( array ( 'rah_backup_confirm_backup' , ) ) ; $ msg = array ( 'backup' => escape_js ( $ theme -> announce_async ( gTxt ( 'rah_backup_taking' ) ) ) , 'error' => escape_js ( $ theme -> announce_async ( gTxt ( 'rah... | Adds the panel s CSS and JavaScript to the < ; head> ; . |
12,057 | private function create ( ) { try { callback_event ( 'rah_backup.backup' ) ; } catch ( Rah_Backup_Exception $ e ) { $ this -> browser ( array ( $ e -> getMessage ( ) , E_ERROR ) ) ; return ; } catch ( Exception $ e ) { $ this -> browser ( array ( txpspecialchars ( $ e -> getMessage ( ) ) , E_ERROR ) ) ; return ; } $ th... | The panel that creates new backups . |
12,058 | private function download ( ) { $ file = ( string ) gps ( 'file' ) ; try { $ backups = $ this -> getBackups ( ) ; } catch ( Exception $ e ) { } if ( empty ( $ backups ) || ! isset ( $ backups [ $ file ] ) ) { $ this -> browser ( array ( gTxt ( 'rah_backup_can_not_download' ) , E_ERROR ) ) ; return ; } extract ( $ backu... | Streams backups for downloading . |
12,059 | private function multi_edit ( ) { extract ( psa ( array ( 'selected' , 'edit_method' , ) ) ) ; require_privs ( 'rah_backup_' . ( ( string ) $ edit_method ) ) ; if ( ! is_string ( $ edit_method ) || empty ( $ selected ) || ! is_array ( $ selected ) ) { $ this -> browser ( array ( gTxt ( 'rah_backup_select_something' ) ,... | Multi - edit handler . |
12,060 | private function multi_option_delete ( ) { $ selected = ps ( 'selected' ) ; $ deleted = array ( ) ; try { foreach ( $ this -> getBackups ( ) as $ name => $ file ) { if ( in_array ( $ name , $ selected , true ) ) { $ deleted [ $ name ] = $ file [ 'path' ] ; @ unlink ( $ file [ 'path' ] ) ; } } } catch ( Exception $ e ) ... | Deletes selected backups . |
12,061 | private function getBackups ( $ sort = 'name' , $ direction = 'asc' , $ offset = 0 , $ limit = null ) { $ directory = txpath . '/' . get_pref ( 'rah_backup_path' ) ; if ( ! get_pref ( 'rah_backup_path' ) || ! file_exists ( $ directory ) || ! is_dir ( $ directory ) || ! is_readable ( $ directory ) ) { throw new Rah_Back... | Gets a list of backups . |
12,062 | public function injectStylesAndScripts ( array $ params , PageLayoutController $ ref ) : string { $ jsCallbackFunction = null ; if ( $ ref -> MOD_SETTINGS [ 'function' ] === '2' ) { $ jsCallbackFunction = 'function(ColumnLayout) { ColumnLayout.settings.isTranslationView = true; }' ; } $ ref ->... | Hook for header rendering of the PageLayoutController to inject stylesheet required for custom column layout display . |
12,063 | protected function skipRendering ( PageLayoutView & $ parentObject , array $ row ) : bool { $ tsConf = $ parentObject -> modTSconfig [ 'column_layout' ] ?? [ ] ; return ( $ tsConf [ 'hidePreview' ] ?? false || empty ( $ row [ 'tx_column_layout_column_config' ] ) || $ tsConf [ 'disabled' ] ?? false ) ; } | Checks if the rendering of the column markup should be skipped . |
12,064 | public function get ( ) { if ( ! isset ( $ this -> request -> args [ 0 ] ) ) { exit ; } $ url = $ this -> request -> args [ 0 ] ; $ query_string = http_build_query ( $ this -> request -> get ) ; $ destination_url = $ url . ( $ query_string ? '?' . $ query_string : '' ) ; if ( $ this -> onBeforeGet ( $ destination_url )... | proxies request and responds |
12,065 | protected function headerCallBack ( $ ch , $ data ) { if ( ! is_null ( $ data ) ) { if ( preg_match ( "~^HTTP/.*? 404~" , $ data ) ) { header ( trim ( $ data ) ) ; while ( ob_get_level ( ) > 0 ) { ob_end_flush ( ) ; } } if ( preg_match ( "~^Content-disposition~" , $ data ) ) { header ( str_replace ( "filename=" , 'file... | Called to process headers from URL being proxied |
12,066 | function auth ( $ proxy = NULL , $ attr = array ( ) , array $ reqd = NULL ) { $ fw = Base :: instance ( ) ; $ root = $ fw -> get ( 'SCHEME' ) . '://' . $ fw -> get ( 'HOST' ) ; if ( empty ( $ this -> args [ 'trust_root' ] ) ) $ this -> args [ 'trust_root' ] = $ root . $ fw -> get ( 'BASE' ) . '/' ; if ( empty ( $ this ... | Initiate OpenID authentication sequence ; Return FALSE on failure or redirect to OpenID provider URL |
12,067 | public function send ( Message $ message ) { $ buildMessage = $ this -> buildMessage ( $ message ) ; $ this -> streamSocket -> connect ( ) ; $ bytesSend = $ this -> streamSocket -> write ( $ buildMessage ) ; if ( strlen ( $ buildMessage ) !== $ bytesSend ) { $ this -> streamSocket -> disconnect ( ) ; throw new Connecti... | Send a message without waiting on response . |
12,068 | public static function check ( ) { return ( \ is_object ( self :: $ db ) && \ is_object ( self :: $ dbs ) && self :: $ db -> check ( ) && self :: $ dbs -> check ( ) ) ; } | Checks if the initialization has been all right |
12,069 | public function deserialize ( StringLiteral $ data ) { $ data = json_decode ( $ data -> toNative ( ) , $ this -> assoc ) ; if ( null === $ data ) { throw new NotWellFormedException ( 'Invalid JSON' ) ; } return $ data ; } | Decodes a JSON string into a generic PHP object . |
12,070 | public function login ( $ serviceName , AbstractUser $ response ) { $ userId = $ this -> repo -> getUserIdBySocialId ( $ response -> id , $ serviceName ) ; if ( auth ( ) -> check ( ) ) { $ user = auth ( ) -> user ( ) ; if ( $ userId ) { session ( ) -> put ( 'url.intended' , route ( 'connectedServices' ) ) ; throw new S... | Login using social service . |
12,071 | public static function getUrlStatusCode ( $ url ) { $ epi_curl_checker = EpiCurl :: getInstance ( ) ; $ url_check = $ epi_curl_checker -> addURL ( $ url ) ; return $ url_check -> code ; } | This function obtains an HTTP status code from a given URL . |
12,072 | public function prepare ( $ command , array $ arguments = array ( ) ) { $ commandline = $ command ; foreach ( $ arguments as $ option => $ value ) { if ( is_bool ( $ value ) ) { if ( $ value === true ) { $ commandline .= ' ' . $ option ; } } else { $ seperator = ' ' ; if ( ! is_integer ( $ option ) ) { $ commandline .=... | Prepares a commandline |
12,073 | protected function addChild ( $ mom_node , $ name , $ value = '' ) { return $ this -> oai_pmh -> addChild ( $ mom_node , $ name , $ value ) ; } | A worker function for easily adding a newly created node to current XML Doc . |
12,074 | protected function create_regObject ( $ group , $ key , $ originatingSource ) { $ regObj_node = $ this -> addChild ( $ this -> working_node , 'registryObject' ) ; $ regObj_node -> setAttribute ( 'group' , $ group ) ; $ this -> addChild ( $ regObj_node , 'key' , $ key ) ; $ this -> addChild ( $ regObj_node , 'originatin... | Create a single registryObject node . Each set has its own structure but they all have an attribute of group a key node and an originatingSource node . The newly created node will be used as the working node . |
12,075 | protected function create_dcs_node ( $ set_name , $ set_type ) { $ this -> working_node = $ this -> addChild ( $ this -> working_node , $ set_name ) ; $ this -> working_node -> setAttribute ( 'type' , $ set_type ) ; } | RIF - CS node is the content node of RIF - CS metadata node which starts from regObjects . Each set supportted in RIF - CS has its own content model . The created node will be used as the root node of this record for following nodes will be created . |
12,076 | protected function leadGIF ( ) { $ exif = exif_imagetype ( $ this -> file ) === IMAGETYPE_GIF ; if ( $ exif ) { return $ this -> closeCase ( "gif" , "image/gif" ) ; } return null ; } | Checks if thise file is a GIF . |
12,077 | protected function leadJPG ( ) { $ exif = exif_imagetype ( $ this -> file ) === IMAGETYPE_JPEG ; if ( $ exif ) { return $ this -> closeCase ( "jpg" , "image/jpg" ) ; } return null ; } | Checks if thise file is a JPG . |
12,078 | protected function leadPNG ( ) { $ exif = exif_imagetype ( $ this -> file ) === IMAGETYPE_PNG ; if ( $ exif ) { return $ this -> closeCase ( "png" , "image/png" ) ; } return null ; } | Checks if thise file is a PNG . |
12,079 | protected function leadSWF ( ) { $ exif = exif_imagetype ( $ this -> file ) ; $ flash = ( $ exif === IMAGETYPE_SWF || $ exif === IMAGETYPE_SWC ) ; if ( $ exif ) { return $ this -> closeCase ( "swf" , "application/x-shockwave-flash" ) ; } return null ; } | Checks if the file is a SWF . |
12,080 | public function getAdapter ( ) { if ( $ this -> repositoryAdapter instanceof AdapterInterface ) { return $ this -> repositoryAdapter ; } foreach ( $ this -> adapters as $ adapterClass ) { if ( class_exists ( $ adapterClass ) === false || in_array ( 'Accompli\Chrono\Adapter\AdapterInterface' , class_implements ( $ adapt... | Returns the supported adapter for the repository . |
12,081 | public function onKernelTerminate ( PostResponseEvent $ event ) { if ( ! $ event -> getRequest ( ) -> hasSession ( ) ) { return ; } $ session = $ event -> getRequest ( ) -> getSession ( ) ; $ this -> registry -> refreshLastUsed ( $ session -> getId ( ) , $ session -> getMetadataBag ( ) -> getLastUsed ( ) ) ; } | Refresh the last used timestamp for the given session if registered . |
12,082 | public function exec ( $ command , $ timeout = 30 , $ with_login_env = true ) { stream_set_timeout ( $ this -> shell , $ timeout ) ; if ( $ with_login_env ) { $ command = 'bash -l ' . $ command ; } return fwrite ( $ this -> shell , $ command . PHP_EOL ) ; } | Execute a command on the interactive shell |
12,083 | public function get ( $ format ) { if ( ! array_key_exists ( $ format , $ this -> encoders ) ) { throw new \ RuntimeException ( sprintf ( 'The expression encoder for "%s" formatting was not found.' , $ format ) ) ; } return $ this -> encoders [ $ format ] ; } | Returns the encoder for the given format |
12,084 | public function handle ( NotificationInterface $ notification , $ level ) { if ( $ notification instanceof AttributeAwareInterface ) { $ options = $ notification -> attributes ( ) ; } else { $ options = [ ] ; } if ( $ notification instanceof TitleAwareInterface ) { $ options [ 'header' ] = $ notification -> title ( ) ;... | Handle a notification . |
12,085 | public static function inline ( $ value , $ options = array ( ) ) { $ filter = new static ( ) ; $ filter -> setOptions ( $ options ) ; return $ filter -> filter ( $ value ) ; } | Static function to execute filter |
12,086 | public static function cleanFileName ( $ str ) { preg_match ( '~\.\w{1,4}$~' , $ str , $ ext ) ; $ str = preg_replace ( '~\.\w{1,4}$~' , '' , $ str ) ; return str_replace ( Array ( ' ' , '.' , '-' ) , "_" , $ str ) . $ ext [ 0 ] ; } | Cleans up file names and removes extraneous spaces symbols etc |
12,087 | public static function stripMicrosoftChars ( $ str ) { $ chars = array ( chr ( 133 ) => '...' , chr ( 145 ) => "'" , chr ( 146 ) => "'" , chr ( 147 ) => '"' , chr ( 148 ) => '"' , chr ( 149 ) => '*' , chr ( 150 ) => '-' , chr ( 151 ) => '-' , chr ( 165 ) => '*' , chr ( 201 ) => '...' , chr ( 208 ) => '-' , chr ( 209 ) ... | Removes microsoft characters and replace them with their ascii counterparts |
12,088 | public static function truncate ( $ str , $ maxlength = 20 ) { if ( strlen ( $ str ) > $ maxlength ) { $ str = substr ( $ str , 0 , $ maxlength - 3 ) . '...' ; } return $ str ; } | Truncates a string to a certain length and right padswith ... |
12,089 | protected function getConverter ( InputInterface $ input ) { $ converter = parent :: getConverter ( $ input ) ; $ this -> configureConverterFromInputOptions ( $ converter , $ input ) ; return $ converter ; } | Returns and configures the converter for this operation . |
12,090 | public function generateHeaders ( ) { if ( $ this -> contentDisposition !== null && ( $ this -> contentDisposition instanceof ezcMailContentDispositionHeader ) ) { $ cdHeader = $ this -> contentDisposition ; $ cd = "{$cdHeader->disposition}" ; if ( $ cdHeader -> fileName !== null ) { $ fileInfo = null ; if ( $ cdHeader... | Returns the headers set for this part as a RFC 822 string . |
12,091 | public function deleteDirectory ( string $ path , bool $ withFiles = false ) { if ( $ path == '*' ) $ this -> abort ( 'Can not delete "*", please specify folder or file.' ) ; $ files = glob ( $ path . '/*' ) ; foreach ( $ files as $ file ) { if ( is_file ( $ file ) && ! $ withFiles ) return ; is_dir ( $ file ) ? $ this... | Deleting existing folder |
12,092 | public function getToReplace ( array $ ignoreSymbols ) : array { if ( empty ( $ ignoreSymbols ) ) return $ this -> toReplace ; return array_diff ( $ this -> toReplace , $ ignoreSymbols ) ; } | Get replaceable symbols |
12,093 | protected function stringWithUnderscore ( string $ string , array $ ignoreToReplace = [ ] ) { return str_replace ( $ this -> getToReplace ( $ ignoreToReplace ) , '_' , trim ( $ string , '/' ) ) ; } | Get string in underscore |
12,094 | protected function stringWithDash ( string $ string , array $ ignoreToReplace = [ ] ) { return str_replace ( $ this -> getToReplace ( $ ignoreToReplace ) , '-' , trim ( $ string , '/' ) ) ; } | Get string in dash |
12,095 | protected function stringOnly ( string $ string , array $ ignoreToReplace = [ ] ) { return str_replace ( $ this -> getToReplace ( $ ignoreToReplace ) , '' , trim ( $ string , '/' ) ) ; } | Remove all items from string |
12,096 | public function iShouldGetALogEntry ( $ string ) { $ found = false ; foreach ( explode ( "\n" , $ this -> getOutput ( ) ) as $ line ) { if ( trim ( $ line ) == $ string ) { $ found = true ; } } if ( ! $ found ) { throw new \ Exception ( "Actual output is:\n" . $ this -> getOutput ( ) ) ; } } | Verifies whether one of the log entries is the same as the given . |
12,097 | public function iShouldGetALogEntryContaining ( $ string ) { $ found = false ; foreach ( explode ( "\n" , $ this -> getOutput ( ) ) as $ line ) { if ( strpos ( trim ( $ line ) , $ string ) !== false ) { $ found = true ; } } if ( ! $ found ) { throw new \ Exception ( "Actual output is:\n" . $ this -> getOutput ( ) ) ; }... | Verifies whether a log entry contains the given substring . |
12,098 | public function iRunPhpDocumentorAgainstTheFile ( $ file_path ) { $ tmp = self :: getTmpFolder ( ) ; $ fullPath = __DIR__ . '/../../' . $ file_path ; $ this -> iRunPhpdoc ( "-f $fullPath -t $tmp --config='{$this->getTempXmlConfigurationPath()}' --force" ) ; } | Runs phpDocumentor with only the file that is provided in this command . |
12,099 | public function iRunPhpDocumentorWith ( PyStringNode $ code , $ extraParameters = '' ) { $ tmp = self :: getTmpFolder ( ) ; $ file = tempnam ( $ tmp , 'pdb' ) ; file_put_contents ( $ file , $ code ) ; $ this -> iRunPhpdoc ( "-f $file -t $tmp --config='{$this->getTempXmlConfigurationPath()}' --force $extraParameters" ) ... | Parses the given PHP code with phpDocumentor . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.