idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
11,500 | public static function recursiveCopy ( $ src , $ dst ) { if ( is_dir ( $ src ) ) { if ( ! is_dir ( $ dst ) && ! mkdir ( $ dst ) ) { throw new IOException ( "Cannot mkdir '$dst'" , 0 , null , $ path ) ; } $ files = scandir ( $ src ) ; foreach ( $ files as $ file ) { if ( $ file != "." && $ file != ".." ) { self :: recur... | cp - r |
11,501 | public function loadClassMetadata ( LoadClassMetadataEventArgs $ eventArgs ) { $ metadata = $ eventArgs -> getClassMetadata ( ) ; $ reflectionClass = $ metadata -> getReflectionClass ( ) ; if ( ! $ reflectionClass || ! $ this -> hasTrait ( $ reflectionClass , 'Blast\BaseEntitiesBundle\Entity\Traits\Timestampable' ) ) {... | define Timestampable mapping at runtime . |
11,502 | public function disconnect ( ) { if ( $ this -> state != self :: STATE_NOT_CONNECTED ) { $ this -> connection -> sendData ( 'QUIT' ) ; $ this -> connection -> getLine ( ) ; $ this -> state = self :: STATE_UPDATE ; $ this -> connection -> close ( ) ; $ this -> connection = null ; $ this -> state = self :: STATE_NOT_CONN... | Disconnects the transport from the POP3 server . |
11,503 | public function listMessages ( ) { if ( $ this -> state != self :: STATE_TRANSACTION ) { throw new ezcMailTransportException ( "Can't call listMessages() on the POP3 transport when not successfully logged in." ) ; } $ this -> connection -> sendData ( "LIST" ) ; $ response = $ this -> connection -> getLine ( ) ; if ( ! ... | Returns an array of the message numbers on the server and the size of the messages in bytes . |
11,504 | public function listUniqueIdentifiers ( $ msgNum = null ) { if ( $ this -> state != self :: STATE_TRANSACTION ) { throw new ezcMailTransportException ( "Can't call ListUniqueIdentifiers() on the POP3 transport when not successfully logged in." ) ; } $ result = array ( ) ; if ( $ msgNum !== null ) { $ this -> connection... | Returns the unique identifiers for messages on the POP3 server . |
11,505 | public function status ( & $ numMessages , & $ sizeMessages ) { if ( $ this -> state != self :: STATE_TRANSACTION ) { throw new ezcMailTransportException ( "Can't call status() on the POP3 transport when not successfully logged in." ) ; } $ this -> connection -> sendData ( "STAT" ) ; $ response = $ this -> connection -... | Returns information about the messages on the server . |
11,506 | public function fetchAll ( $ deleteFromServer = false ) { $ messages = $ this -> listMessages ( ) ; return new ezcMailPop3Set ( $ this -> connection , array_keys ( $ messages ) , $ deleteFromServer ) ; } | Returns an ezcMailPop3Set with all the messages on the server . |
11,507 | public function getLine ( $ trim = false ) { $ data = '' ; $ line = '' ; if ( is_resource ( $ this -> connection ) ) { while ( strpos ( $ data , self :: CRLF ) === false ) { $ line = fgets ( $ this -> connection , 512 ) ; if ( $ line === false ) { $ this -> connection = null ; throw new ezcMailTransportException ( 'Cou... | Returns one line of data from the stream . |
11,508 | public function clear ( ) { $ files = glob ( ERDIKO_VAR . "/cache/*" ) ; foreach ( $ files as $ file ) { if ( is_file ( $ file ) ) { parent :: delete ( basename ( $ file ) ) ; } } } | Delete all keys |
11,509 | private function verifyElementsType ( array $ elements ) : void { $ allowedType = $ this -> getAllowedType ( ) ; if ( $ allowedType !== DTO :: class && ( ! \ class_exists ( $ allowedType ) || ! \ in_array ( DTO :: class , \ class_implements ( $ allowedType ) , true ) ) ) { throw new InvalidCollectionTypeException ( \ s... | Verify collection elements type . |
11,510 | function beforeSave ( Model $ Model , $ options = array ( ) ) { if ( ! array_key_exists ( 'Media' , $ Model -> belongsTo ) ) { $ Model -> bindModel ( array ( 'belongsTo' => array ( 'Media' => array ( 'className' => 'Risto.Media' ) ) ) ) ; } if ( isset ( $ Model -> data [ $ Model -> alias ] [ $ this -> _form_field_name ... | beforeSave if a file is found upload it and then save the filename according to the settings |
11,511 | public static function create ( $ postType , $ config , $ throwExceptionOnInvalidWriter = false ) { $ className = 'Fillet\\Writer\\' . ucfirst ( $ postType ) . 'Writer' ; if ( class_exists ( $ className ) ) { $ writer = new $ className ( $ config [ 'destinationFolders' ] [ $ postType ] , $ config ) ; return $ writer ; ... | Create a new instance of a writer based on the post type |
11,512 | public function styles ( ) { $ assets = array ( ) ; foreach ( $ this -> assets as $ asset ) { if ( 'css' !== $ asset [ 'ext' ] && 'less' !== $ asset [ 'ext' ] ) { continue ; } $ assets [ ] = $ this -> route ? $ asset : $ this -> process ( $ asset ) ; } if ( empty ( $ assets ) ) { return '' ; } if ( $ this -> route ) { ... | Get the HTML links to all of the registered CSS assets . |
11,513 | public function scripts ( ) { $ assets = array ( ) ; foreach ( $ this -> assets as $ asset ) { if ( 'js' !== $ asset [ 'ext' ] ) { continue ; } $ assets [ ] = $ this -> route ? $ asset : $ this -> process ( $ asset ) ; } if ( empty ( $ assets ) ) { return '' ; } if ( $ this -> route ) { return $ this -> prepareForContr... | Get the HTML links to all of the registered JavaScript assets . |
11,514 | public function prepareForController ( $ assets , $ type ) { $ controller_url = $ this -> cdn ? $ this -> cdn . '/' : '/' ; $ controller_url .= $ this -> route . '/' . $ type ; $ controller_url .= '?c=' . urlencode ( $ this -> name ) ; $ links = array ( ) ; foreach ( $ assets as & $ asset ) { $ attributes = $ asset [ '... | Prepare the given assets to be rendered to call the Casset controller and return the HTML link to that resource . |
11,515 | public function content ( $ type ) { $ assets = array ( ) ; foreach ( $ this -> assets as $ asset ) { if ( 'style' == $ type && 'css' !== $ asset [ 'ext' ] && 'less' !== $ asset [ 'ext' ] ) { continue ; } else if ( 'script' == $ type && 'js' !== $ asset [ 'ext' ] ) { continue ; } $ assets [ ] = $ this -> process ( $ as... | Process and return the contents for this container for the requested file type . |
11,516 | public function image ( $ source , $ alt = null , $ attributes = array ( ) ) { $ url = $ source ; if ( false === strstr ( $ source , '://' ) && '//' !== substr ( $ source , 0 , 2 ) ) { $ url = $ this -> cdn ( $ source ) ; } return HTML :: image ( $ url , $ alt , $ attributes ) ; } | Add an image asset to the container . |
11,517 | public function cdn ( $ source ) { $ url = str_ireplace ( $ this -> public_path , '' , $ this -> assets_path . '/' . ltrim ( $ source , '/' ) ) ; $ url = $ this -> cdn ? $ this -> cdn . $ url : $ url ; return $ url ; } | Get the URL to the CDN for an asset . |
11,518 | public function needsProcessing ( array $ asset ) { if ( isset ( static :: $ needs_processing [ $ asset [ 'source' ] ] ) ) { return static :: $ needs_processing [ $ asset [ 'source' ] ] ; } $ path = $ this -> path ( $ asset [ 'source' ] ) ; $ is_public = ( bool ) stristr ( $ path , $ this -> public_path ) ; $ compiled_... | Returns whether or not a file needs to be processed . |
11,519 | public function compile ( $ path ) { switch ( pathinfo ( $ path , PATHINFO_EXTENSION ) ) { case 'less' : $ less = new Less_Parser ; $ content = '/*' . md5 ( File :: get ( $ path ) ) . "*/\n" . $ less -> parseFile ( $ path ) -> getCss ( ) ; break ; default : $ content = File :: get ( $ path ) ; } return $ content ; } | Compile and return the content for the given asset according to it s extension . |
11,520 | public function combine ( array $ assets , $ type ) { $ paths = array ( ) ; $ lastmod = 0 ; foreach ( $ assets as $ asset ) { $ paths [ ] = $ asset [ 'path' ] ; $ mod = File :: lastModified ( $ asset [ 'path' ] ) ; if ( $ mod > $ lastmod ) { $ lastmod = $ mod ; } } $ file = $ this -> cache_path . '/casset-' . md5 ( imp... | Combine the given array of assets . Minify if enabled . Returns new array containing one asset . |
11,521 | protected function fetchContentOptions ( $ model , $ key , $ index ) { $ options = parent :: fetchContentOptions ( $ model , $ key , $ index ) ; if ( ! empty ( $ this -> columnOptions ) ) { foreach ( $ this -> columnOptions as $ option => $ value ) { $ options [ 'data-column-' . $ option ] = $ value ; } } return $ opti... | Parses and fetches updated content options for grid visibility and format |
11,522 | public function getValue ( ) { $ values = [ ] ; foreach ( $ this -> values as $ key => $ value ) { $ values [ $ key ] = $ value -> getValue ( ) ; } return $ values ; } | returns the value . the value maybe invalid . |
11,523 | public function getValidValue ( ) { $ values = [ ] ; foreach ( $ this -> values as $ key => $ value ) { if ( $ this -> isValidValue ( $ value ) ) { $ values [ $ key ] = $ value -> getValidValue ( ) ; } } return $ values ; } | return the validated value . returns false if validation fails . |
11,524 | public function query ( $ key = null , $ default = null ) { $ queries = $ this -> getQueryParams ( ) ; return is_null ( $ key ) ? $ queries : data_get ( $ queries , $ key , $ default ) ; } | Retrieve a query string item from the request . |
11,525 | public function post ( $ key = null , $ default = null ) { $ posts = $ this -> getPostParams ( ) ; return is_null ( $ key ) ? $ posts : data_get ( $ posts , $ key , $ default ) ; } | Retrieve a post data item from the request . |
11,526 | public function server ( $ key = null , $ default = null ) { $ servers = $ this -> getServerParams ( ) ; return is_null ( $ key ) ? $ servers : data_get ( $ servers , $ key , $ default ) ; } | Retrieve a server variable from the request . |
11,527 | public function cookie ( $ key = null , $ default = null ) { $ cookies = $ this -> getCookieParams ( ) ; return is_null ( $ key ) ? $ cookies : data_get ( $ cookies , $ key , $ default ) ; } | Retrieve a cookie from the request . |
11,528 | public function loadConfigurationFile ( Module $ module ) { $ finder = ( new Finder ) -> name ( '#customer[-_\.]?group\.xml#i' ) -> in ( $ module -> getAbsoluteConfigPath ( ) ) ; $ count = $ finder -> count ( ) ; if ( $ count > 1 ) { throw new InvalidConfigurationException ( 'Too many configuration file.' ) ; } else { ... | Find parse and load customer group configuration file for module |
11,529 | protected function applyConfig ( array $ moduleConfiguration ) { foreach ( $ moduleConfiguration [ 'customer_group' ] as $ customerGroupData ) { if ( CustomerGroupQuery :: create ( ) -> findOneByCode ( $ customerGroupData [ 'code' ] ) === null ) { $ customerGroup = ( new CustomerGroup ) -> setCode ( $ customerGroupData... | Save new customer group to database |
11,530 | protected function resetDefault ( ) { $ defaultGroups = CustomerGroupQuery :: create ( ) -> filterByIsDefault ( true ) -> find ( ) ; foreach ( $ defaultGroups as $ defaultGroup ) { $ defaultGroup -> setIsDefault ( false ) -> save ( ) ; } } | Remove is_default flag |
11,531 | public function generate ( WorkPackage $ work ) { $ description = $ work -> getTaskDescription ( ) ; $ command = $ description -> getCommand ( ) ; if ( ! $ this -> isValidCommand ( $ command ) ) { throw new TaskCommandGeneratorException ( "This command is not usable '{$command}' is not valid" ) ; } $ cmd = escapeshella... | Generates a symfony2 console command to execute from the task |
11,532 | private function generateArguments ( TaskDescriptionInterface $ description ) { $ cmdPart = '' ; $ arguments = $ description -> getArguments ( ) ; if ( ! is_array ( $ arguments ) ) { return $ cmdPart ; } foreach ( $ arguments as $ argumentValue ) { if ( is_string ( $ argumentValue ) || is_integer ( $ argumentValue ) ) ... | Generates the argument part of the command |
11,533 | private function generateOptions ( TaskDescriptionInterface $ description ) { $ cmdPart = '' ; $ options = $ description -> getOptions ( ) ; if ( ! is_array ( $ options ) ) { return $ cmdPart ; } foreach ( $ options as $ optionName => $ optionValue ) { if ( ! $ this -> isValidOptionName ( $ optionName ) ) { continue ; ... | Generates the options part of the command |
11,534 | public function getTheme ( $ themeName ) { if ( empty ( $ themeName ) ) { throw new \ InvalidArgumentException ( 'The theme name must not be empty.' ) ; } elseif ( ! $ this -> hasTheme ( $ themeName ) ) { throw new \ LogicException ( sprintf ( 'Unable to retrieve definition for theme "%s".' , $ themeName ) ) ; } if ( !... | Gets theme model instance |
11,535 | protected function getRequiredModule ( string $ className ) { if ( \ array_key_exists ( $ className , $ this -> modules ) ) { return $ this -> modules [ $ className ] ; } else { throw new ConfigurationException ( __CLASS__ . ' tried to request module ' . $ className . ', but it was not listed as a dependency or has not... | Returns a module that has been set as required . This is only available after the constructor has finished . |
11,536 | public function updated ( Option $ model ) { $ option = Option :: query ( ) -> firstOrNew ( [ 'name' => 'notifications_remove_after_days' ] ) ; $ option -> value = input ( 'days' ) ; return $ option -> save ( ) ; } | Save notifications configuration |
11,537 | static function countWithSubscriberID ( $ subscriberID , $ languageID = false , $ enabled = false ) { $ cond = array ( ) ; $ cond [ 'subscriber_id' ] = $ subscriberID ; if ( $ enabled !== false ) { $ cond [ 'enabled' ] = $ enabled ; } if ( $ languageID !== false ) { $ cond [ 'language_id' ] = $ languageID ; } $ count =... | get the count of subscription in a subscriber ID |
11,538 | public function contentObject ( ) { $ contentID = $ this -> attribute ( 'content_id' ) ; $ languageID = $ this -> attribute ( 'language_id' ) ; return eZContentObject :: fetch ( $ contentID ) ; } | get the content of the subscription |
11,539 | static function exists ( $ contentID , $ languageID , $ subscriptionType , $ email = null , $ enabled = false ) { $ emailString = '' ; if ( ! is_null ( $ email ) ) { $ emailString = " WHERE email = '$email'" ; } $ countArray = null ; $ db = eZDB :: instance ( ) ; if ( $ enabled === false ) { $ countArray = $ db -> arra... | Check if the subscription exists by a given contentID |
11,540 | public function render ( ) { Merchant :: script ( $ this -> script ( ) ) ; view ( ) -> share ( [ 'path' => $ this -> path , 'keyName' => $ this -> model -> getKeyName ( ) , 'branchView' => $ this -> view [ 'branch' ] , 'branchCallback' => $ this -> branchCallback , ] ) ; return view ( $ this -> view [ 'tree' ] , $ this... | Render a tree . |
11,541 | public function send ( $ data ) { $ pieces = [ $ this -> config [ 'apiKey' ] , $ this -> config [ 'prefix' ] , $ data . ' ' . time ( ) , ] ; $ message = implode ( '.' , $ pieces ) . PHP_EOL ; return $ this -> sendData ( $ this -> config [ 'host' ] , $ this -> config [ 'port' ] , $ message ) ; } | Data to send to Graphite host |
11,542 | public static function __callstatic ( $ name , $ arguments ) { $ services = Client :: getServices ( isset ( $ arguments [ 'context' ] ) ? $ arguments [ 'context' ] : null ) ; if ( array_key_exists ( $ name , $ services ) ) { $ service = $ services [ $ name ] ; switch ( $ service [ 'type' ] ) { case 'collection' : retur... | Magic method for static calls |
11,543 | public function getTagAndSetLocale ( $ name , $ locale = null ) { $ tag = $ this -> getTag ( $ name ) ; $ locale = $ locale ? : $ tag -> getLocaleForName ( $ name ) ; set_app_locale ( $ locale ) ; return $ tag ; } | Returns a tag by name and sets the locale |
11,544 | private function createCreateForm ( Episode $ entity ) { $ form = $ this -> createForm ( EpisodeType :: class , $ entity , array ( 'action' => $ this -> generateUrl ( 'oktolab_episode_create' ) , 'method' => 'POST' , ) ) ; $ form -> add ( 'submit' , SubmitType :: class , [ 'label' => 'oktolab_media.new_episode_create_b... | Creates a form to create a Episode entity . |
11,545 | public function newAction ( Request $ request ) { $ entity = new Episode ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; return [ 'entity' => $ entity , 'form' => $ form -> createView ( ) , ] ; } | Displays a form to create a new Episode entity . |
11,546 | private function createEditForm ( Episode $ entity ) { $ form = $ this -> createForm ( new EpisodeType ( ) , $ entity , [ 'action' => $ this -> generateUrl ( 'oktolab_episode_update' , [ 'id' => $ entity -> getId ( ) ] ) , 'method' => 'POST' ] ) ; $ form -> add ( 'submit' , 'submit' , [ 'label' => 'oktolab_media.edit_e... | Creates a form to edit a Episode entity . |
11,547 | public function deleteAction ( Request $ request , $ id ) { $ form = $ this -> createDeleteForm ( $ id ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'OktolabMediaBundle:Episode' ) -> find ( $ id ) ; if (... | Deletes a Episode entity . |
11,548 | function Image_Toolbox ( ) { $ args = func_get_args ( ) ; $ argc = func_num_args ( ) ; $ gd_info = function_exists ( 'gd_info' ) ? gd_info ( ) : $ this -> _gd_info ( ) ; preg_match ( "/\A[\D]*([\d+\.]*)[\D]*\Z/" , $ gd_info [ 'GD Version' ] , $ matches ) ; list ( $ this -> _gd_version_string , $ this -> _gd_version_num... | The class constructor . |
11,549 | function getServerFeatures ( ) { $ features = array ( ) ; $ features [ 'gd_version' ] = $ this -> _gd_version_number ; $ features [ 'gif' ] = $ this -> _types [ 1 ] [ 'supported' ] ; $ features [ 'jpg' ] = $ this -> _types [ 2 ] [ 'supported' ] ; $ features [ 'png' ] = $ this -> _types [ 3 ] [ 'supported' ] ; $ feature... | Returns an assocative array with information about the image features of this server |
11,550 | function newImage ( ) { $ args = func_get_args ( ) ; $ argc = func_num_args ( ) ; if ( $ this -> _addImage ( $ argc , $ args ) ) { foreach ( $ this -> _img [ 'operator' ] as $ key => $ value ) { $ this -> _img [ 'main' ] [ $ key ] = $ value ; } $ this -> _img [ 'main' ] [ 'output_type' ] = $ this -> _img [ 'main' ] [ '... | Flush all image resources and init a new one |
11,551 | function _hexToPHPColor ( $ hex ) { $ length = strlen ( $ hex ) ; $ dr = hexdec ( substr ( $ hex , $ length - 6 , 2 ) ) ; $ dg = hexdec ( substr ( $ hex , $ length - 4 , 2 ) ) ; $ db = hexdec ( substr ( $ hex , $ length - 2 , 2 ) ) ; $ color = ( $ dr << 16 ) + ( $ dg << 8 ) + $ db ; return $ color ; } | Convert a color defined in hexvalues to the PHP color format |
11,552 | function _hexToDecColor ( $ hex ) { $ length = strlen ( $ hex ) ; $ color [ 'red' ] = hexdec ( substr ( $ hex , $ length - 6 , 2 ) ) ; $ color [ 'green' ] = hexdec ( substr ( $ hex , $ length - 4 , 2 ) ) ; $ color [ 'blue' ] = hexdec ( substr ( $ hex , $ length - 2 , 2 ) ) ; return $ color ; } | Convert a color defined in hexvalues to corresponding dezimal values |
11,553 | function _addImage ( $ argc , $ args ) { if ( ( $ argc == 2 || $ argc == 3 ) && is_int ( $ args [ 0 ] ) && is_int ( $ args [ 1 ] ) && ( is_string ( $ args [ 2 ] ) || ! isset ( $ args [ 2 ] ) ) ) { $ this -> _img [ 'operator' ] [ 'width' ] = $ args [ 0 ] ; $ this -> _img [ 'operator' ] [ 'height' ] = $ args [ 1 ] ; ( $ ... | Generate a new image resource based on the given parameters |
11,554 | function _loadFile ( $ filename ) { if ( file_exists ( $ filename ) ) { $ info = getimagesize ( $ filename ) ; $ filedata [ 'width' ] = $ info [ 0 ] ; $ filedata [ 'height' ] = $ info [ 1 ] ; ( $ filedata [ 'width' ] >= $ filedata [ 'height' ] ) ? ( $ filedata [ 'bias' ] = IMAGE_TOOLBOX_BIAS_HORIZONTAL ) : ( $ filedata... | Loads a image file |
11,555 | function setResizeMethod ( $ method ) { switch ( $ method ) { case 1 : case 'resize' : $ this -> _resize_function = 'imagecopyresized' ; break ; case 2 : case 'resample' : if ( ! function_exists ( 'imagecopyresampled' ) ) { return null ; } $ this -> _resize_function = 'imagecopyresampled' ; break ; case 3 : case 'resam... | Sets the resize method of choice |
11,556 | function addImage ( ) { $ args = func_get_args ( ) ; $ argc = func_num_args ( ) ; if ( $ this -> _addImage ( $ argc , $ args ) ) { return true ; } else { return false ; } } | Adds a new image resource based on the given parameters . |
11,557 | function addText ( $ text , $ font , $ size , $ color , $ x , $ y , $ angle = 0 ) { global $ HTTP_SERVER_VARS ; if ( substr ( $ font , 0 , 1 ) == DIRECTORY_SEPARATOR || ( substr ( $ font , 1 , 1 ) == ":" && ( substr ( $ font , 2 , 1 ) == "\\" || substr ( $ font , 2 , 1 ) == "/" ) ) ) { $ prepath = '' ; } else { $ prepa... | Writes text over the image |
11,558 | function _imageCopyResampledWorkaround ( & $ dst_img , & $ src_img , $ dst_x , $ dst_y , $ src_x , $ src_y , $ dst_w , $ dst_h , $ src_w , $ src_h ) { $ scaleX = ( $ src_w - 1 ) / $ dst_w ; $ scaleY = ( $ src_h - 1 ) / $ dst_h ; $ scaleX2 = $ scaleX / 2.0 ; $ scaleY2 = $ scaleY / 2.0 ; for ( $ j = $ src_y ; $ j < $ src... | workaround function for bicubic resizing . works well for downsizing only . VERY slow . taken from php . net comments |
11,559 | function _imageCopyResampledWorkaround2 ( & $ dst_img , & $ src_img , $ dst_x , $ dst_y , $ src_x , $ src_y , $ dst_w , $ dst_h , $ src_w , $ src_h ) { ImagePaletteCopy ( $ dst_img , $ src_img ) ; $ rX = $ src_w / $ dst_w ; $ rY = $ src_h / $ dst_h ; $ w = 0 ; for ( $ y = $ dst_y ; $ y < $ dst_h ; $ y ++ ) { $ ow = $ w... | alternative workaround function for bicubic resizing . works well for downsizing and upsizing . VERY VERY slow . taken from php . net comments |
11,560 | public static function fromString ( $ headerString ) { $ headerString = trim ( $ headerString ) ; list ( $ name , $ value ) = explode ( ': ' , trim ( $ headerString ) , 2 ) ; return new self ( $ name , $ value ) ; } | Creates a header from a string representing a single header . |
11,561 | protected function installDotEnv ( PackageInterface $ package ) { $ templatePath = $ this -> getTempPath ( $ package ) . '/.env.template' ; $ dotEnvPath = $ this -> getInstallPath ( $ package ) . '/.env' ; $ dotEnvExamplePath = $ this -> getInstallPath ( $ package ) . '/.env.example' ; if ( ! file_exists ( $ templatePa... | Set up the . env file . |
11,562 | protected function checkWordPressInstallation ( ) { $ defaultWpInstallDir = $ this -> plugin -> getRootDirectory ( ) . '/wordpress' ; $ wpInstallDir = $ this -> getComposerConfigurator ( ) -> getWordPressInstallDirectory ( ) ; if ( file_exists ( $ defaultWpInstallDir ) && is_dir ( $ defaultWpInstallDir ) ) { if ( ! is_... | Check if WordPress is installed in the correct directory and move it there if it is not . |
11,563 | protected function selectPreferredLanguageOnWordPressInstall ( ) { $ wpInstallScriptPath = $ this -> getComposerConfigurator ( ) -> getWordPressInstallDirectory ( ) . '/wp-admin/install.php' ; if ( file_exists ( $ wpInstallScriptPath ) ) { $ wpInstallScript = file_get_contents ( $ wpInstallScriptPath ) ; $ wpInstallScr... | Select the preferred en_GB option in the WordPress installation language form . |
11,564 | protected function installFiles ( $ installPath , $ downloadPath , $ publicPath , $ files = [ ] ) { foreach ( $ files as $ file => $ overwrite ) { if ( $ overwrite || ( ! $ overwrite && ! file_exists ( $ installPath . '/' . $ file ) ) ) { if ( ! file_exists ( $ downloadPath . '/' . $ file ) ) { throw new FilesystemExce... | Install files . |
11,565 | private function compileTemplate ( $ templatePath , $ destinationPath , $ data = null ) { if ( $ data == null ) { $ data = $ destinationPath ; $ destinationPath = null ; } if ( ! isset ( $ this -> templates [ $ templatePath ] ) ) { $ this -> templates [ $ templatePath ] = file_get_contents ( $ templatePath ) ; } $ comp... | Compile a template file . |
11,566 | private function sortRules ( & $ rules ) { sort ( $ rules ) ; usort ( $ rules , function ( $ a , $ b ) { return strlen ( $ a ) - strlen ( $ b ) ; } ) ; } | Sort gitignore rules . |
11,567 | private function generateSalt ( ) { $ str = '' ; $ length = 64 ; $ chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(){}[]/|`,.?+-_=:;<> ' ; $ count = strlen ( $ chars ) ; while ( $ length -- ) { $ str .= $ chars [ mt_rand ( 0 , $ count - 1 ) ] ; } return 'base64:' . base64_encode ( $ str ... | Generate a Salt Key . |
11,568 | public function removeElementClass ( $ class ) { $ delClass = [ ] ; if ( is_string ( $ class ) || is_array ( $ class ) ) { $ delClass = ( array ) $ class ; } foreach ( $ delClass as $ del ) { if ( ( $ key = array_search ( $ del , $ this -> elementClass ) ) ) { unset ( $ this -> elementClass [ $ key ] ) ; } } return $ t... | Remove element class . |
11,569 | public function getView ( ) { if ( ! empty ( $ this -> view ) ) { return $ this -> view ; } $ class = explode ( '\\' , get_called_class ( ) ) ; return 'merchant::form.' . strtolower ( end ( $ class ) ) ; } | Get view of this field . |
11,570 | public function updateComment ( $ comment , $ user = null , $ time = null , $ notified = null ) { if ( $ time === null ) { $ time = time ( ) ; } $ beforeUpdating = $ this -> beforeUpdatingComment ( $ comment , $ notified , $ time ) ; if ( $ beforeUpdating !== true ) { return $ beforeUpdating ; } $ comment -> store ( ) ... | Update the comment |
11,571 | public static function instance ( ) { if ( ! isset ( self :: $ instance ) ) { $ ini = eZINI :: instance ( 'ezcomments.ini' ) ; $ className = $ ini -> variable ( 'ManagerClasses' , 'CommentManagerClass' ) ; self :: $ instance = new $ className ( ) ; } return self :: $ instance ; } | create an instance of ezcomCommentManager |
11,572 | protected static function staticRequest ( $ method , $ url , $ params ) { $ requestor = new ApiRequestor ( ) ; list ( $ response , $ code ) = $ requestor -> request ( $ method , $ url , $ params ) ; return array ( $ response , $ code ) ; } | Make the http GET or POST request |
11,573 | public function xml ( ) { try { $ xml = new \ SimpleXMLElement ( ( string ) $ this -> body ? : '<root />' ) ; } catch ( \ Exception $ e ) { throw new RuntimeException ( 'Unable to parse response body into XML: ' . $ e -> getMessage ( ) ) ; } return $ xml ; } | Parse the XML response body and return a SimpleXMLElement |
11,574 | public static function mergeConfigurations ( $ target , $ source ) { foreach ( [ 'attributes' , 'entities' , 'relationships' , 'autocode' , 'languages' , 'frameworks' , 'orms' ] as $ configurationPart ) { if ( isset ( $ source [ $ configurationPart ] ) ) { $ target [ $ configurationPart ] = self :: mergeArrays ( $ targ... | Complete the different configuration sections on the target array with those ones found on the source array |
11,575 | public static function loadConfiguration ( ) { $ defaultsFile = __DIR__ . '/../../../../app/config/defaults.yml' ; $ draggyFile = __DIR__ . '/../../../../app/config/draggy.yml' ; $ userFile = __DIR__ . '/../../../../app/config/user.yml' ; $ defaultsArray = Yaml :: parse ( $ defaultsFile ) ; $ configurationArray = is_fi... | Load the model configuration merge it onto the default one and return the result array |
11,576 | public function build ( ) { $ soapClient = ( new Factory ) -> getClient ( $ this -> getEndpoint ( ) , $ this -> getSoapOptions ( ) ) ; $ params [ 'user_id' ] = $ this -> userId ; $ params [ 'agent_code' ] = $ this -> agentCode ; $ params [ 'agent_seq' ] = $ this -> agentSeq ; $ client = new $ this -> client ( $ soapCli... | Build a new client s instance |
11,577 | protected function parseResponse ( $ string ) { $ exp = explode ( Driver :: SEP , $ string ) ; if ( $ exp [ 0 ] != 0 ) { throw new HSException ( isset ( $ exp [ 2 ] ) ? $ exp [ 2 ] : '' , $ exp [ 0 ] ) ; } array_shift ( $ exp ) ; $ numCols = intval ( array_shift ( $ exp ) ) ; $ exp = array_map ( [ $ this -> socket , 'd... | Parse response from server |
11,578 | private function connect ( ) { if ( ! $ this -> socket -> isOpened ( ) ) { $ this -> socket -> open ( ) ; if ( $ this -> secret ) { $ this -> socket -> send ( join ( Driver :: SEP , [ 'A' , 1 , Driver :: encode ( $ this -> secret ) ] ) . Driver :: EOL ) ; } } } | Connect to Handler Socket |
11,579 | public function moveSortableItemAction ( Request $ request ) { $ admin = $ this -> container -> get ( 'sonata.admin.pool' ) -> getInstance ( $ request -> get ( 'admin_code' ) ) ; $ class = $ admin -> getClass ( ) ; $ id = $ request -> get ( 'id' ) ; $ prev_rank = ( int ) $ request -> get ( 'prev_rank' ) ; $ next_rank =... | Move a sortable item . |
11,580 | function bump ( $ user_id = 0 ) { global $ db , $ user ; $ current_time = time ( ) ; if ( $ user_id == 0 ) $ user_id = $ user -> data [ 'user_id' ] ; $ db -> sql_transaction ( 'begin' ) ; $ sql = 'UPDATE ' . POSTS_TABLE . " SET post_time = $current_time WHERE post_id = {$this->topic_last_post_id} AND topic_id = {$th... | bumps the topic |
11,581 | public function version ( ) { $ json = ( string ) $ this -> client -> request ( 'GET' , '/' ) -> getBody ( ) ; $ value = JSONEncoder :: decode ( $ json ) ; return $ value [ 'version' ] ; } | Get the couchdb version . |
11,582 | public function listDatabases ( ) { $ json = ( string ) $ this -> client -> request ( 'GET' , '/_all_dbs' ) -> getBody ( ) ; $ databases = JSONEncoder :: decode ( $ json ) ; return $ databases ; } | Show all databases . |
11,583 | public function dropDatabase ( $ name ) { if ( $ this -> eventManager -> hasListeners ( Events :: PRE_DROP_DATABASE ) ) { $ this -> eventManager -> dispatchEvent ( Events :: PRE_DROP_DATABASE , new EventArgs ( $ this , $ name ) ) ; } $ response = $ this -> client -> request ( 'DELETE' , sprintf ( '/%s/' , urlencode ( $... | Drop a database . |
11,584 | public function removeListener ( string $ eventName , $ listener ) : void { $ this -> dispatcher -> removeListener ( $ eventName , $ listener ) ; } | Remove event listener |
11,585 | public function removeListeners ( string $ eventName ) : void { foreach ( $ this -> dispatcher -> getListeners ( $ eventName ) as $ listener ) { $ this -> removeListener ( $ eventName , $ listener ) ; } } | Remove all event listeners |
11,586 | public function setTo ( $ to ) { $ attr = $ this -> createAttribute ( 'to' ) ; $ this -> doc -> appendChild ( $ attr ) ; $ attr -> appendChild ( $ this -> createTextNode ( $ to ) ) ; } | Sets the to jid of the message |
11,587 | public function setFrom ( $ from ) { $ attr = $ this -> createAttribute ( 'from' ) ; $ this -> doc -> appendChild ( $ attr ) ; $ attr -> appendChild ( $ this -> createTextNode ( $ from ) ) ; } | Sets the from jid of the message |
11,588 | public function addXML ( $ xml ) { $ next_elem = $ this -> createDocumentFragment ( ) ; $ next_elem -> appendXML ( $ xml ) ; $ this -> doc -> appendChild ( $ next_elem ) ; } | Adds an arbitrary XML string to the packet s root node |
11,589 | public function findBy ( array $ conditions ) { $ s = $ this -> selector ( ) ; foreach ( $ conditions as $ column => $ value ) { $ s -> where ( $ column , '=' , $ value ) ; } return $ s -> execute ( ) ; } | Select entities matching an array of conditions . |
11,590 | public function findOneBy ( array $ conditions ) { $ s = $ this -> selector ( ) -> one ( ) ; foreach ( $ conditions as $ column => $ value ) { $ s -> where ( $ column , '=' , $ value ) ; } return $ s -> execute ( ) ; } | Select a single entity matching an array of conditions . |
11,591 | public function captureMessage ( $ message , $ params = [ ] , $ data = [ ] , $ stack = false , $ vars = null ) { if ( ! Configure :: read ( 'CakeMonitor.Sentry.enabled' ) || error_reporting ( ) === 0 ) { return false ; } if ( is_callable ( Configure :: read ( 'CakeMonitor.Sentry.extraDataCallback' ) ) ) { $ data [ 'ext... | Capture a message via sentry |
11,592 | protected function validate ( GeneratorData $ data ) { $ source = $ data -> getSource ( ) ; if ( ! ( is_array ( $ source ) && isset ( $ source [ self :: NODE_ACTIONS ] ) && is_array ( $ source [ self :: NODE_ACTIONS ] ) ) ) { throw new SyntaxException ( sprintf ( 'expected array with "%s" node' , self :: NODE_ACTIONS )... | Validates given resource data checks that actions node exists and consist valid actions . |
11,593 | private function flash ( $ type , $ message ) { $ flash = Session :: has ( $ type ) ? Session :: get ( $ type ) : array ( ) ; if ( ! in_array ( $ message , $ flash ) ) $ flash [ ] = $ message ; Session :: flash ( $ type , $ flash ) ; } | Flashes a Message to the Session . |
11,594 | public function mbox_exists ( $ name ) { if ( $ this -> is_connected ( ) && ! empty ( $ name ) ) { $ names = $ this -> get_all_names_mboxes ( ) ; if ( ! empty ( $ names ) && \ in_array ( $ name , $ names ) ) { return true ; } } return false ; } | Check if a mailbox exists |
11,595 | public function issueCreate ( $ title , $ description , $ assignee_email , $ labels = '' ) { $ post = [ 'id' => $ this -> id , 'title' => $ title , 'description' => $ description ] ; if ( $ assignee_email ) { $ user = new \ sb \ Gitlab \ User ( $ assignee_email , $ this -> _client ) ; $ post [ 'assignee_id' ] = $ user ... | Adds an issue to a git repository |
11,596 | public function issueClose ( \ sb \ Gitlab \ Issue $ issue ) { $ response = $ this -> _client -> get ( "/projects/" . $ this -> id . "/issues/" . $ issue -> id , [ 'state_event' => 'close' ] , 'PUT' ) ; if ( is_object ( $ response ) && isset ( $ response -> message ) ) { throw new \ Exception ( "Could not close issue "... | Closes an issue by id within the project |
11,597 | public static function fromObject ( $ object ) { $ issue = new \ sb \ Gitlab \ P ( ) ; foreach ( get_object_vars ( $ object ) as $ k => $ v ) { switch ( $ k ) { case 'assignee' : case 'author' : if ( ! is_object ( $ v ) ) { $ issue -> { $ k } = $ v ; break ; } $ user = new \ sb \ Gitlab \ User ( ) ; foreach ( get_objec... | Convert stdClass Object to actual \ sb \ Gitlab \ Issue |
11,598 | public function put ( $ url , $ params = null ) { $ this -> params = $ params ; $ this -> method = 'PUT' ; $ this -> url = $ url ; return $ this -> request ( ) ; } | Make a PUT query |
11,599 | public function post ( $ url , $ params = null ) { $ this -> params = $ params ; $ this -> method = 'POST' ; $ this -> url = $ url ; return $ this -> request ( ) ; } | Make a POST query |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.