idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
240,200 | public function buildEmbedHtml ( array $ attributes = [ ] , array $ parameters = [ ] ) { $ attributes = array_merge ( $ this -> attributes , $ attributes , [ 'src' => $ this -> buildEmbedUrl ( $ parameters ) , ] ) ; $ attributeStrings = [ '' ] ; foreach ( $ attributes as $ name => $ value ) { $ attributeString = ( stri... | Build the valid HTML code to embed this resource |
240,201 | public static function slugify ( $ title , $ length = 200 ) { $ title = strip_tags ( $ title ) ; $ title = preg_replace ( '|%([a-fA-F0-9][a-fA-F0-9])|' , '---$1---' , $ title ) ; $ title = str_replace ( '%' , '' , $ title ) ; $ title = preg_replace ( '|---([a-fA-F0-9][a-fA-F0-9])---|' , '%$1' , $ title ) ; $ title = se... | Sanitizes title replacing whitespace with dashes . |
240,202 | protected function sendResponseHeadersToClient ( WebRequest $ request , $ code , $ message ) { $ headers = [ "Date" => gmdate ( "D, d M Y H:i:s T" ) , "Connection" => "close" ] ; $ bytes = $ this -> sendToClient ( $ request -> getVersion ( ) . " {$code} {$message}\r\n" ) ; foreach ( $ headers as $ header => $ value ) {... | Sends the response headers through the client socket |
240,203 | protected function sendToClient ( $ line ) { $ bytes = 0 ; $ len = strlen ( $ line ) ; if ( $ len ) { while ( true ) { $ sent = socket_write ( $ this -> client , $ line , $ len ) ; if ( false === $ sent ) { throw new Exceptions \ HttpStatusError ( "Internal server error." , 500 ) ; } $ bytes += $ sent ; if ( $ sent < $... | Sends a string through the client socket |
240,204 | protected function getFile ( WebRequest $ request ) { $ path = realpath ( $ this -> dirRoot . DIRECTORY_SEPARATOR . $ request -> getPath ( ) ) ; if ( false === $ path ) { throw new Exceptions \ HttpStatusError ( "File not found." , 404 ) ; } if ( is_dir ( $ path ) ) { $ path .= DIRECTORY_SEPARATOR . $ this -> index ; }... | Returns the data for the requested file |
240,205 | public function parseComponent ( $ str ) { if ( ! is_string ( $ str ) ) { throw new InvalidUrlException ( 'Unexpected type.' ) ; } if ( strpos ( $ str , ' ' ) !== false ) { throw new InvalidUrlException ( 'Path contains whitespace.' ) ; } $ p = explode ( '/' , $ str ) ; foreach ( $ p as $ i => $ v ) { $ p [ $ i ] = raw... | Parses a path component as it appears in a URL . |
240,206 | public function get ( ) { if ( is_null ( $ this -> url ) ) { return $ this -> path -> get ( ) ; } if ( ! $ this -> url -> host -> isEmpty ( ) ) { return Path :: info ( '/' ) -> resolve ( $ this -> path ) -> get ( ) ; } return $ this -> path -> get ( ) ; } | Returns the decoded path . |
240,207 | public function set ( $ str ) { if ( $ str instanceof Path ) { $ this -> path -> set ( $ str -> get ( ) ) ; } else if ( $ str instanceof UrlPath ) { $ this -> path -> set ( $ str -> get ( ) ) ; } else if ( is_string ( $ str ) ) { $ this -> path -> set ( $ str ) ; } else { throw new \ InvalidArgumentException ( 'Unexpec... | Sets the decoded path . |
240,208 | public function isAbsolute ( ) { if ( ! is_null ( $ this -> url ) && $ this -> path -> isEmpty ( ) ) { return ! $ this -> url -> host -> isEmpty ( ) ; } return $ this -> path -> isAbsolute ( ) ; } | URLs can be relative if scheme and host are omitted . |
240,209 | public function dirname ( ) { if ( ! is_null ( $ this -> url ) && $ this -> path -> isEmpty ( ) && ! $ this -> url -> host -> isEmpty ( ) ) { return '/' ; } return $ this -> path -> dirname ( ) ; } | Return the path excluding the filename . |
240,210 | public function sizeUrl ( $ size ) { if ( ( $ this -> base [ 'return_format' ] === 'array' ) && isset ( $ this -> base [ 'value' ] [ 'sizes' ] [ $ size ] ) ) { return $ this -> base [ 'value' ] [ 'sizes' ] [ $ size ] ; } elseif ( $ this -> base [ 'return_format' ] === 'id' ) { if ( $ src = wp_get_attachment_image_src (... | Get an image URL of a specic size . |
240,211 | public function setOption ( $ key , $ value ) { if ( ! in_array ( $ key , $ this -> availableOptions ) ) { throw new Exception \ InvalidArgumentException ( 'Invalid option for Tooltip' ) ; } if ( is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } if ( ! is_string ( $ value ) ) { throw new Exception \ Inva... | Set a single option to the Tooltip |
240,212 | public static function currentIpAddress ( ) { if ( function_exists ( 'apache_request_headers' ) ) { $ headers = apache_request_headers ( ) ; } else { $ headers = $ _SERVER ; } if ( array_key_exists ( 'X-Forwarded-For' , $ headers ) && filter_var ( $ headers [ 'X-Forwarded-For' ] , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ... | Get the ip address from the current request . |
240,213 | public function setLabel ( $ label ) { if ( null !== $ label && ! is_string ( $ label ) ) { throw new Exception ( 'Invalid argument: $label must be a string or null' ) ; } $ this -> _label = $ label ; return $ this ; } | Sets page label |
240,214 | public function setFragment ( $ fragment ) { if ( null !== $ fragment && ! is_string ( $ fragment ) ) { throw new Exception ( 'Invalid argument: $fragment must be a string or null' ) ; } $ this -> _fragment = $ fragment ; return $ this ; } | Sets a fragment identifier |
240,215 | public function setId ( $ id = null ) { if ( null !== $ id && ! is_string ( $ id ) && ! is_numeric ( $ id ) ) { throw new Exception ( 'Invalid argument: $id must be a string, number or null' ) ; } $ this -> _id = null === $ id ? $ id : ( string ) $ id ; return $ this ; } | Sets page id |
240,216 | public function setTitle ( $ title = null ) { if ( null !== $ title && ! is_string ( $ title ) ) { throw new Exception ( 'Invalid argument: $title must be a non-empty string' ) ; } $ this -> _title = $ title ; return $ this ; } | Sets page title |
240,217 | public function setTarget ( $ target = null ) { if ( null !== $ target && ! is_string ( $ target ) ) { throw new Exception ( 'Invalid argument: $target must be a string or null' ) ; } $ this -> _target = $ target ; return $ this ; } | Sets page target |
240,218 | public function setAccesskey ( $ character = null ) { if ( null !== $ character && ( ! is_string ( $ character ) || 1 != strlen ( $ character ) ) ) { throw new Exception ( 'Invalid argument: $character must be a single character or null' ) ; } $ this -> _accesskey = $ character ; return $ this ; } | Sets access key for this page |
240,219 | public function setRel ( $ relations = null ) { $ this -> _rel = array ( ) ; if ( null !== $ relations ) { if ( ! is_array ( $ relations ) ) { throw new Exception ( 'Invalid argument: $relations must be an array' ) ; } foreach ( $ relations as $ name => $ relation ) { if ( is_string ( $ name ) ) { $ this -> _rel [ $ na... | Sets the page s forward links to other pages |
240,220 | public function getRel ( $ relation = null ) { if ( null !== $ relation ) { return isset ( $ this -> _rel [ $ relation ] ) ? $ this -> _rel [ $ relation ] : null ; } return $ this -> _rel ; } | Returns the page s forward links to other pages |
240,221 | public function setRev ( $ relations = null ) { $ this -> _rev = array ( ) ; if ( null !== $ relations ) { if ( ! is_array ( $ relations ) ) { throw new Exception ( 'Invalid argument: $relations must be an array' ) ; } foreach ( $ relations as $ name => $ relation ) { if ( is_string ( $ name ) ) { $ this -> _rev [ $ na... | Sets the page s reverse links to other pages |
240,222 | public function getRev ( $ relation = null ) { if ( null !== $ relation ) { return isset ( $ this -> _rev [ $ relation ] ) ? $ this -> _rev [ $ relation ] : null ; } return $ this -> _rev ; } | Returns the page s reverse links to other pages |
240,223 | public function setCustomHtmlAttrib ( $ name , $ value ) { if ( ! is_string ( $ name ) ) { throw new Exception ( 'Invalid argument: $name must be a string' ) ; } if ( null !== $ value && ! is_string ( $ value ) ) { throw new Exception ( 'Invalid argument: $value must be a string or null' ) ; } if ( null === $ value && ... | Sets a single custom HTML attribute |
240,224 | public function getCustomHtmlAttrib ( $ name ) { if ( ! is_string ( $ name ) ) { throw new Exception ( 'Invalid argument: $name must be a string' ) ; } if ( isset ( $ this -> _customHtmlAttribs [ $ name ] ) ) { return $ this -> _customHtmlAttribs [ $ name ] ; } return null ; } | Returns a single custom HTML attributes by name |
240,225 | public function setCustomHtmlAttribs ( array $ attribs ) { foreach ( $ attribs as $ key => $ value ) { $ this -> setCustomHtmlAttrib ( $ key , $ value ) ; } return $ this ; } | Sets multiple custom HTML attributes at once |
240,226 | public function removeCustomHtmlAttrib ( $ name ) { if ( ! is_string ( $ name ) ) { throw new Exception ( 'Invalid argument: $name must be a string' ) ; } if ( isset ( $ this -> _customHtmlAttribs [ $ name ] ) ) { unset ( $ this -> _customHtmlAttribs [ $ name ] ) ; } } | Removes a custom HTML attribute from the page |
240,227 | public function setOrder ( $ order = null ) { if ( is_string ( $ order ) ) { $ temp = ( int ) $ order ; if ( $ temp < 0 || $ temp > 0 || $ order == '0' ) { $ order = $ temp ; } } if ( null !== $ order && ! is_int ( $ order ) ) { throw new Exception ( 'Invalid argument: $order must be an integer or null, ' . 'or a strin... | Sets page order to use in parent container |
240,228 | public function setResource ( $ resource = null ) { if ( null === $ resource || is_string ( $ resource ) || $ resource instanceof Acl ) { $ this -> _resource = $ resource ; } else { require_once 'Zend/Navigation/Exception.php' ; throw new Exception ( 'Invalid argument: $resource must be null, a string, ' . ' or an inst... | Sets ACL resource assoicated with this page |
240,229 | public function setPrivilege ( $ privilege = null ) { $ this -> _privilege = is_string ( $ privilege ) ? $ privilege : null ; return $ this ; } | Sets ACL privilege associated with this page |
240,230 | public function setVisible ( $ visible = true ) { if ( is_string ( $ visible ) && 'false' == strtolower ( $ visible ) ) { $ visible = false ; } $ this -> _visible = ( bool ) $ visible ; return $ this ; } | Sets whether the page should be visible or not |
240,231 | public function isVisible ( $ recursive = false ) { if ( $ recursive && isset ( $ this -> _parent ) && $ this -> _parent instanceof Page ) { if ( ! $ this -> _parent -> isVisible ( true ) ) { return false ; } } return $ this -> _visible ; } | Returns a boolean value indicating whether the page is visible |
240,232 | public function setParent ( Container $ parent = null ) { if ( $ parent === $ this ) { throw new Exception ( 'A page cannot have itself as a parent' ) ; } if ( $ parent === $ this -> _parent ) { return $ this ; } if ( null !== $ this -> _parent ) { $ this -> _parent -> removePage ( $ this ) ; } $ this -> _parent = $ pa... | Sets parent container |
240,233 | public function set ( $ property , $ value ) { if ( ! is_string ( $ property ) || empty ( $ property ) ) { throw new Exception ( 'Invalid argument: $property must be a non-empty string' ) ; } $ method = 'set' . self :: _normalizePropertyName ( $ property ) ; if ( $ method != 'setOptions' && $ method != 'setConfig' && m... | Sets the given property |
240,234 | public function get ( $ property ) { if ( ! is_string ( $ property ) || empty ( $ property ) ) { throw new Exception ( 'Invalid argument: $property must be a non-empty string' ) ; } $ method = 'get' . self :: _normalizePropertyName ( $ property ) ; if ( method_exists ( $ this , $ method ) ) { return $ this -> $ method ... | Returns the value of the given property |
240,235 | public function __isset ( $ name ) { $ method = 'get' . self :: _normalizePropertyName ( $ name ) ; if ( method_exists ( $ this , $ method ) ) { return true ; } return isset ( $ this -> _properties [ $ name ] ) ; } | Checks if a property is set |
240,236 | public function addRel ( $ relation , $ value ) { if ( is_string ( $ relation ) ) { $ this -> _rel [ $ relation ] = $ value ; } return $ this ; } | Adds a forward relation to the page |
240,237 | public function addRev ( $ relation , $ value ) { if ( is_string ( $ relation ) ) { $ this -> _rev [ $ relation ] = $ value ; } return $ this ; } | Adds a reverse relation to the page |
240,238 | public function removeRel ( $ relation ) { if ( isset ( $ this -> _rel [ $ relation ] ) ) { unset ( $ this -> _rel [ $ relation ] ) ; } return $ this ; } | Removes a forward relation from the page |
240,239 | public function removeRev ( $ relation ) { if ( isset ( $ this -> _rev [ $ relation ] ) ) { unset ( $ this -> _rev [ $ relation ] ) ; } return $ this ; } | Removes a reverse relation from the page |
240,240 | public function addAttribute ( $ key , $ value = null ) { $ this -> element -> addAttribute ( $ key , $ value ) ; return $ this ; } | Add attribute on element |
240,241 | protected function showHelp ( $ msg = '' , $ code = 0 ) { $ usage = Cli :: color ( 'USAGE:' , 'brown' ) ; $ commands = Cli :: color ( 'COMMANDS:' , 'brown' ) ; $ sOptions = Cli :: color ( 'SPECIAL OPTIONS:' , 'brown' ) ; $ pOptions = Cli :: color ( 'PUBLIC OPTIONS:' , 'brown' ) ; $ version = Cli :: color ( self :: VERS... | Shows the scripts help info with optional error message |
240,242 | public function isValid ( $ key ) { if ( ! isset ( $ this [ 'sso' ] , $ this [ 'sig' ] ) ) { return false ; } return $ this [ 'sig' ] === Secret :: create ( $ key ) -> sign ( $ this [ 'sso' ] ) ; } | Checks the validity of this QueryString s against a secret key . |
240,243 | public static function fromString ( $ query , array $ data = [ ] ) { $ url = parse_url ( $ query ) ; $ query = isset ( $ url [ 'query' ] ) ? $ url [ 'query' ] : $ url [ 'path' ] ; parse_str ( $ query , $ data ) ; return new QueryString ( $ data ) ; } | Creates a QueryString from a string . |
240,244 | static public function normalize ( array $ params ) { $ qs = http_build_query ( $ params , null , '&' ) ; if ( '' == $ qs ) { return '' ; } $ parts = array ( ) ; $ order = array ( ) ; foreach ( explode ( '&' , $ qs ) as $ param ) { if ( '' === $ param || '=' === $ param [ 0 ] ) { continue ; } $ keyValuePair = explode (... | Builds a normalized query string from the given parameters . |
240,245 | private function resolveContainer ( ) : ContainerInterface { if ( $ this -> container === null ) { $ container = $ this -> containerFactory -> build ( $ this ) ; if ( ! $ container instanceof ContainerInterface ) { throw new \ RuntimeException ( "Invalid factory result, expected ContainerInterface" ) ; } $ this -> cont... | Instantiate the container if not and return it |
240,246 | public function listAction ( Request $ request ) { $ theme = $ request -> attributes -> get ( 'synapse_theme' , $ this -> container -> get ( 'synapse' ) -> enableDefaultTheme ( ) -> getCurrentTheme ( ) ) ; $ templateCollection = $ this -> container -> get ( 'synapse.template.loader' ) -> retrieveAll ( array ( 'scope' =... | Templates listing action . |
240,247 | public function initAction ( Request $ request , $ templateType , $ contentType , $ contentId = null ) { $ templateDomain = $ this -> container -> get ( 'synapse.template.domain' ) ; $ template = empty ( $ contentId ) ? $ templateDomain -> createGlobal ( $ contentType , $ templateType ) : $ templateDomain -> createLoca... | Template init action . |
240,248 | public function editAction ( $ id , Request $ request ) { $ template = $ this -> container -> get ( 'synapse.template.orm_loader' ) -> retrieveOne ( array ( 'id' => $ id , 'scope' => TemplateInterface :: GLOBAL_SCOPE ) ) ; if ( ! $ template ) { throw new NotFoundHttpException ( sprintf ( 'No global template found for i... | Global template edition action . Requires an activated or activable theme . |
240,249 | public function addComponentAction ( $ id , $ zoneTypeId , $ componentTypeId , Request $ request ) { if ( ! $ template = $ this -> container -> get ( 'synapse.template.loader' ) -> retrieve ( $ id ) ) { throw new NotFoundHttpException ( sprintf ( 'No template found under id "%s"' , $ id ) ) ; } if ( ! $ zoneType = $ te... | Adds a component of given type id into given template id and zone type id . |
240,250 | public function getBuildableEnvironmentsByApplication ( Application $ application ) { $ region = sprintf ( self :: ENV_QUERY_REGION , $ application -> id ( ) ) ; $ dql = sprintf ( self :: DQL_BY_APPLICATION , Target :: class , Environment :: class ) ; $ query = $ this -> getEntityManager ( ) -> createQuery ( $ dql ) ->... | Get all buildable environments for an application . |
240,251 | public function clearBuildableEnvironmentsByApplication ( Application $ application ) { $ region = sprintf ( self :: ENV_QUERY_REGION , $ application -> id ( ) ) ; $ cache = $ this -> getEntityManager ( ) -> getCache ( ) ; $ cache -> getQueryCache ( $ region ) -> clear ( ) ; } | Clear cache for buildable environments for an application . |
240,252 | public function addCookie ( string $ key , $ value , \ DateTimeInterface $ expire ) { $ this -> cookies [ $ key ] = $ this -> cookieFactory -> build ( $ key , $ value , $ expire ) ; } | Adds a cookie |
240,253 | public function send ( ) { $ this -> sendCookies ( ) ; $ this -> sendHeaders ( ) ; if ( $ this -> request -> server ( 'REQUEST_METHOD' ) === 'HEAD' ) { return '' ; } echo $ this -> body ; } | Sends the response to the client |
240,254 | private function sendHeaders ( ) { if ( ! array_key_exists ( 'Content-Type' , $ this -> headers ) ) { $ this -> headers [ 'Content-Type' ] = 'text/html; charset=UTF-8' ; } $ this -> headers [ 'Content-Length' ] = strlen ( $ this -> body ) ; header ( sprintf ( 'HTTP/%s %s %s' , $ this -> request -> server ( 'SERVER_PROT... | Sends the headers to the client |
240,255 | public function getImageUrl ( $ size = 'thumbnail' ) { $ res = wp_get_attachment_image_src ( $ this -> getId ( ) , $ size ) ; return $ res && isset ( $ res [ 0 ] ) ? $ res [ 0 ] : null ; } | Get attachment image URL . |
240,256 | public function save ( ) { if ( $ this -> id ) { $ this -> id = shmop_open ( $ this -> key , $ this -> mode , $ this -> permission , $ this -> size ) ; } @ shmop_write ( $ this -> id , serialize ( $ this -> data ) , $ this -> offset ) ; return true ; } | saves the data of an entry |
240,257 | public function delete ( ) { if ( empty ( $ this -> id ) ) { $ this -> id = shmop_open ( $ this -> key , $ this -> mode , $ this -> permission , $ this -> size ) ; } @ shmop_delete ( $ this -> id ) ; @ shmop_close ( $ this -> id ) ; return true ; } | deletes the entry |
240,258 | public function validate ( Request $ request , array $ rules , array $ messages = [ ] ) { foreach ( $ rules as $ param => $ options ) { $ value = $ request -> getParam ( $ param ) ; $ this -> data [ $ param ] = $ value ; $ isRule = $ options instanceof V ; try { if ( $ isRule ) { $ options -> assert ( $ value ) ; } els... | Validate request params with the given rules |
240,259 | public function addErrors ( $ param , array $ messages ) { foreach ( $ messages as $ message ) { $ this -> errors [ $ param ] [ ] = $ message ; } return $ this ; } | Add errors for param |
240,260 | public function setDelay ( $ delay ) { if ( is_string ( $ delay ) && ctype_digit ( $ delay ) ) { $ delay = ( int ) $ delay ; } elseif ( ! is_int ( $ delay ) ) { throw new \ RuntimeException ( 'Delay should be an integer in MS.' ) ; } $ this -> delay = $ delay ; return $ this ; } | Defines how long the client should wait for the AlphaRPC instances to respond . If the time is reached the next AlphaRPC instance will be asked to execute the request . |
240,261 | public function setTimeout ( $ timeout ) { if ( is_string ( $ timeout ) && ctype_digit ( $ timeout ) ) { $ timeout = ( int ) $ timeout ; } elseif ( ! is_int ( $ timeout ) ) { throw new \ RuntimeException ( 'Unable to set timeout.' ) ; } $ this -> timeout = $ timeout ; return $ this ; } | Sets the timeout in MS . |
240,262 | public function addManager ( $ manager ) { if ( is_array ( $ manager ) ) { foreach ( $ manager as $ item ) { $ this -> managerList -> add ( $ item ) ; } return $ this ; } $ this -> managerList -> add ( $ manager ) ; return $ this ; } | Adds an address to a AlphaRPC daemon . |
240,263 | public function startRequest ( $ function , array $ params = array ( ) , $ cache = null ) { if ( $ cache !== null && ! is_string ( $ cache ) ) { throw new \ RuntimeException ( '$cache is an id for the request and should be a string or null.' ) ; } $ request = new Request ( $ function , $ params ) ; $ prioritizedManager... | Starts a request . |
240,264 | public function request ( $ function , array $ params = array ( ) , $ cache = null ) { $ request = $ this -> startRequest ( $ function , $ params , $ cache ) ; return $ this -> fetchResponse ( $ request ) ; } | Does a full request and returns the result . |
240,265 | protected function getSocket ( $ server ) { if ( isset ( $ this -> socket [ $ server ] ) ) { return $ this -> socket [ $ server ] ; } $ context = new ZMQContext ( ) ; $ socket = Socket :: create ( $ context , ZMQ :: SOCKET_REQ , $ this -> logger ) ; $ socket -> connect ( $ server ) ; $ this -> socket [ $ server ] = $ s... | Returns a socket for the given server . |
240,266 | protected function serializeParams ( array $ params ) { $ serialized = array ( ) ; foreach ( $ params as $ param ) { $ serialized [ ] = $ this -> serializer -> serialize ( $ param ) ; } return $ serialized ; } | Serializes parameters . |
240,267 | protected function sendExecuteRequest ( $ manager , Request $ request , $ cache = null ) { $ serialized = $ this -> serializeParams ( $ request -> getParams ( ) ) ; $ msg = new ExecuteRequest ( $ cache , $ request -> getFunction ( ) , $ serialized ) ; $ socket = $ this -> getSocket ( $ manager ) ; $ stream = $ socket -... | Send a request to the ClientHandler . |
240,268 | public function fetchResponse ( Request $ request , $ waitForResult = true ) { if ( $ request -> hasResponse ( ) ) { return $ request -> getResponse ( ) ; } $ timer = $ this -> getFetchTimer ( $ waitForResult ) ; $ req = new FetchRequest ( $ request -> getRequestId ( ) , $ waitForResult ) ; do { try { $ response = $ th... | Fetches the response for a request . |
240,269 | private function getManagerForRequest ( Request $ request ) { if ( ! $ request -> getManager ( ) ) { $ request -> setManager ( $ this -> managerList -> get ( ) ) ; } return $ request -> getManager ( ) ; } | Returns a manager for the Request . |
240,270 | private function decodeLockFile ( ) : array { $ data = [ ] ; $ encoder = $ this -> jsonEncoderFactory -> getEncoder ( ) ; if ( file_exists ( $ this -> rootDirectory . 'composer.lock' ) ) { $ data = $ encoder -> decode ( file_get_contents ( $ this -> rootDirectory . 'composer.lock' ) , JsonEncoder :: FORMAT ) ; } return... | Returns the decoded lock file data . |
240,271 | public function executeRule ( $ user , $ item , $ params ) { if ( $ item -> ruleName === null ) { return true ; } $ rule = $ this -> domain -> rule -> getRule ( $ item -> ruleName ) ; if ( $ rule instanceof Rule ) { return $ rule -> execute ( $ user , $ item , $ params ) ; } throw new InvalidConfigException ( "Rule not... | Executes the rule associated with the specified auth item . |
240,272 | public function install ( array $ data , $ db ) { $ this -> db = $ db ; $ this -> data = $ data ; $ this -> data [ 'step' ] = 0 ; if ( GC_CLI ) { $ this -> installCli ( ) ; return array ( ) ; } return $ this -> installHttp ( ) ; } | Performs initial system installation . Step 0 |
240,273 | protected function installHttp ( ) { $ result = array ( 'message' => '' , 'severity' => 'success' , 'redirect' => 'install/' . ( $ this -> data [ 'step' ] + 1 ) ) ; try { $ this -> start ( ) ; $ this -> process ( ) ; } catch ( Exception $ ex ) { $ result = array ( 'redirect' => '' , 'severity' => 'warning' , 'message' ... | Performs installation via classic web UI |
240,274 | protected function installCli ( ) { try { $ this -> process ( ) ; $ this -> installCliStep1 ( ) ; $ this -> installCliStep2 ( ) ; $ this -> installCliStep3 ( ) ; $ this -> cli -> line ( $ this -> getSuccessMessage ( ) ) ; } catch ( Exception $ ex ) { $ this -> cli -> error ( $ ex -> getMessage ( ) ) ; } } | Install in CLI mode |
240,275 | protected function installCliStep1 ( ) { $ this -> data [ 'step' ] = 1 ; $ this -> setCliMessage ( 'Configuring modules...' ) ; $ result = $ this -> installModules ( $ this -> data , $ this -> db ) ; if ( $ result [ 'severity' ] !== 'success' ) { throw new UnexpectedValueException ( $ result [ 'message' ] ) ; } } | Process step 1 in CLI mode |
240,276 | protected function installCliStep2 ( ) { $ title = $ this -> translation -> text ( 'Please select a demo content package (enter a number)' ) ; $ this -> data [ 'demo_handler_id' ] = $ this -> cli -> menu ( $ this -> getDemoOptions ( ) , '' , $ title ) ; if ( ! empty ( $ this -> data [ 'demo_handler_id' ] ) ) { $ this -... | Process step 2 in CLI mode |
240,277 | protected function installCliStep3 ( ) { $ this -> data [ 'step' ] = 3 ; $ result = $ this -> installFinish ( $ this -> data , $ this -> db ) ; if ( $ result [ 'severity' ] !== 'success' ) { throw new UnexpectedValueException ( $ result [ 'message' ] ) ; } } | Precess step 3 in CLI mode |
240,278 | public function installModules ( array $ data , $ db ) { $ this -> db = $ db ; $ this -> data = $ data ; try { $ this -> install_model -> installModules ( ) ; $ this -> configureModules ( ) ; return array ( 'message' => '' , 'severity' => 'success' , 'redirect' => 'install/' . ( $ this -> data [ 'step' ] + 1 ) ) ; } ca... | Installs required modules . Step 1 |
240,279 | public function installDemo ( array $ data , $ db ) { set_time_limit ( 0 ) ; $ this -> db = $ db ; $ this -> data = $ data ; $ success_result = array ( 'message' => '' , 'severity' => 'success' , 'redirect' => 'install/' . ( $ this -> data [ 'step' ] + 1 ) ) ; if ( empty ( $ data [ 'demo_handler_id' ] ) ) { return $ su... | Install a demo - content . Step 2 |
240,280 | public function installFinish ( array $ data , $ db ) { $ this -> db = $ db ; $ this -> data = $ data ; $ result = $ this -> finish ( ) ; $ errors = $ this -> getContextErrors ( ) ; if ( empty ( $ errors ) ) { if ( $ this -> getContext ( 'demo_handler_id' ) ) { $ store_id = $ this -> getContext ( 'store_id' ) ; $ this ... | Performs final tasks . Step 3 |
240,281 | protected function getDemoOptions ( ) { $ options = array ( '' => $ this -> translation -> text ( 'No demo' ) ) ; foreach ( $ this -> install_model -> getDemoHandlers ( ) as $ id => $ handler ) { $ options [ $ id ] = $ handler [ 'title' ] ; } return $ options ; } | Returns an array of demo content options |
240,282 | protected function configureModuleDevice ( ) { $ store_id = $ this -> getContext ( 'store_id' ) ; $ settings = array ( ) ; $ settings [ 'theme' ] [ $ store_id ] [ 'mobile' ] = 'mobile' ; $ settings [ 'theme' ] [ $ store_id ] [ 'tablet' ] = 'mobile' ; $ this -> module -> setSettings ( 'device' , $ settings ) ; } | Configure Device module settings |
240,283 | protected function configureModuleGaReport ( ) { $ info = $ this -> module -> getInfo ( 'ga_report' ) ; $ info [ 'settings' ] [ 'dashboard' ] = array ( 'visit_date' , 'pageview_date' , 'content_statistic' , 'top_pages' , 'source' , 'keyword' , 'audience' ) ; $ this -> module -> setSettings ( 'ga_report' , $ info [ 'set... | Configure Google Analytics Report module settings |
240,284 | public function initialize ( $ url , $ reset = true ) { if ( ( bool ) $ reset ) $ this -> reset ( ) ; $ this -> currentRequestUrl = $ url ; $ this -> state = self :: STATE_INITIALIZED ; return $ this ; } | Create a new CURL resource |
240,285 | public function setRequestHeader ( $ name , $ value ) { if ( ! is_string ( $ name ) ) throw new \ InvalidArgumentException ( 'Argument 1 expected to be string, ' . gettype ( $ name ) . ' seen.' ) ; if ( ! is_string ( $ value ) ) throw new \ InvalidArgumentException ( 'Argument 2 expected to be string, ' . gettype ( $ v... | Add a header string to the request |
240,286 | public function setCurlOpt ( $ opt , $ val ) { if ( ! is_int ( $ opt ) ) { throw new \ InvalidArgumentException ( sprintf ( '%s::setCurlOpt - Argument 1 expected to be integer, %s seen.' , get_class ( $ this ) , gettype ( $ opt ) ) ) ; } $ this -> curlOpts [ $ opt ] = $ val ; return $ this ; } | Set CURL option |
240,287 | public function close ( ) { if ( 'resource' === gettype ( $ this -> ch ) ) curl_close ( $ this -> ch ) ; $ this -> state = self :: STATE_CLOSED ; return $ this ; } | Close the curl resource if exists |
240,288 | public function reset ( ) { $ this -> close ( ) ; $ this -> curlOpts = array ( ) ; $ this -> requestHeaders = array ( ) ; $ this -> currentRequestUrl = null ; $ this -> state = self :: STATE_NEW ; return $ this ; } | Reset to new state |
240,289 | public function curlOptSet ( $ opt ) { return isset ( $ this -> curlOpts [ $ opt ] ) || array_key_exists ( $ opt , $ this -> curlOpts ) ; } | Returns true if passed in curl option has a value |
240,290 | public function execute ( $ resetAfterExecution = false ) { $ this -> buildRequest ( ) ; $ response = new CurlPlusResponse ( curl_exec ( $ this -> ch ) , curl_getinfo ( $ this -> ch ) , curl_error ( $ this -> ch ) , $ this -> getCurlOpts ( ) ) ; if ( $ resetAfterExecution ) $ this -> reset ( ) ; return $ response ; } | Execute CURL command |
240,291 | protected function buildRequest ( ) { if ( self :: STATE_NEW === $ this -> state ) { throw new \ RuntimeException ( sprintf ( '%s::execute - Could not execute request, curl has not been initialized.' , get_class ( $ this ) ) ) ; } if ( self :: STATE_EXECUTED === $ this -> state ) $ this -> close ( ) ; if ( self :: STAT... | Attempts to set up the client for a request throws an exception if it cannot |
240,292 | public static function merge ( array $ array ) { $ result = array ( ) ; foreach ( $ array as $ config ) { if ( is_string ( $ config ) ) { if ( ! file_exists ( $ config ) ) { continue ; } $ config = require ( $ config ) ; } if ( ! is_array ( $ config ) ) { continue ; } $ result = self :: mergeArray ( $ result , $ config... | Merges the given configurations into a single configuration array . |
240,293 | public function parent ( Int $ index = 1 ) : stdClass { return $ this -> _layer ( $ this -> debug , $ index , $ index + 1 ) ; } | Parent Debug Data |
240,294 | protected function resolveDumpPath ( ) { $ path = $ this -> basePath . '/' . $ this -> dumpPath ; $ this -> ensureDirectory ( $ path ) ; return realpath ( $ path ) . '/' . $ this -> dumpFile ; } | Returns the path to the dump - file . |
240,295 | protected function normalizeOptions ( $ options ) { $ result = array ( ) ; foreach ( $ options as $ name => $ value ) { $ result [ ] = "--$name=\"$value\"" ; } return implode ( ' ' , $ result ) ; } | Normalizes the given options to a string |
240,296 | protected function getDb ( ) { if ( isset ( $ this -> _db ) ) { return $ this -> _db ; } else { if ( ( $ db = Yii :: app ( ) -> getComponent ( $ this -> connectionID ) ) === null ) { throw new CException ( sprintf ( 'Failed to get database connection. Component %s not found.' , $ this -> connectionID ) ) ; } return $ t... | Returns the database connection component . |
240,297 | public function get ( $ name ) { if ( ! $ this -> attributeExists ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute does not exist!' ) ; } if ( ! $ this -> attributeGet ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute get is disabled!' ) ; } i... | Return an attribute value if allowed by attribute getter |
240,298 | public function set ( $ name , $ val , $ validate = TRUE ) { if ( ! $ this -> attributeExists ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute does not exist!' ) ; } if ( ! $ this -> attributeSet ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribu... | Set an attribute value if allowed by attribute setter |
240,299 | public function reset ( $ name ) { if ( ! $ this -> attributeExists ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute does not exist!' ) ; } if ( ! $ this -> attributeReset ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute reset is disabled!' )... | Reset an attribute value to its default |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.