idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
9,600 | private static function buildList ( array $ list , Structure $ structure ) { $ insertTab = ( $ structure -> getTab ( ) ) ? true : false ; $ result = '' ; foreach ( $ list as $ value ) { $ result .= ( $ insertTab ? $ structure -> getTab ( ) : '' ) . $ structure -> getIteratorCharacter ( ) . ' ' . $ value . PHP_EOL ; } r... | Render a structure of type list |
9,601 | private static function buildArray ( array $ array , Structure $ structure ) { $ maxKeyLength = Util :: getMaxKeyLength ( $ array ) ; $ maxValueLength = Util :: getMaxValueLength ( $ array ) ; $ drawBorders = ( $ structure -> getBorder ( ) ) ? true : false ; $ insertTab = ( $ structure -> getTab ( ) ) ? true : false ; ... | Render a structure of type array |
9,602 | public function registerPseudoFilter ( $ name , $ object , $ entity = "value" ) { if ( is_callable ( $ object ) ) { $ this -> _pseudoFilters [ $ name ] = array ( "classname" => "CssParserFilterPseudoUserDefined" , "user_def_function" => $ object , "entity" => $ entity ) ; } else { $ this -> _pseudoFilters [ $ name ] = ... | Registers a new user defined pseudo - filter . |
9,603 | public function registerCombinator ( $ name , $ object ) { if ( is_callable ( $ object ) ) { $ this -> _combinators [ $ name ] = array ( "classname" => "CssParserCombinatorUserDefined" , "user_def_function" => $ object ) ; } else { $ this -> _combinators [ $ name ] = array ( "classname" => $ object , "user_def_function... | Registers a new user defined combinator . |
9,604 | protected function combinator ( ) { $ ret = false ; $ combinatorNames = array_keys ( $ this -> _combinators ) ; if ( list ( $ name ) = $ this -> in ( $ combinatorNames ) ) { $ combinator = $ this -> _combinators [ $ name ] ; $ ret = CssParserCombinatorFactory :: getInstance ( $ combinator [ "classname" ] , $ combinator... | Is the next thing a combinator? |
9,605 | protected function value ( ) { if ( ! ( list ( $ value ) = $ this -> str ( ) ) && ! ( list ( $ value ) = $ this -> number ( ) ) && ! ( list ( $ value ) = $ this -> match ( CssParser :: IDENTIFIER ) ) ) { return false ; } return array ( $ value ) ; } | Is the next thing a value? |
9,606 | protected function pseudoFilter ( ) { if ( ! $ this -> match ( "/^\:/" ) ) { return false ; } if ( ! list ( $ name ) = $ this -> is ( "identifier" ) ) { throw new TextParserException ( "Invalid identifier" , $ this ) ; } $ filter = Arr :: get ( $ this -> _pseudoFilters , $ name , null ) ; if ( $ filter === null ) { thr... | Is the next thing a speudo filter? |
9,607 | protected function attrFilter ( ) { $ attrName = "" ; $ op = "" ; $ value = "" ; if ( ! $ this -> match ( "/^\[/" ) ) { return false ; } if ( ! list ( $ attrName ) = $ this -> is ( "identifier" ) ) { throw new TextParserException ( "Invalid identifier" , $ this ) ; } if ( list ( $ op ) = $ this -> is ( "attrOperator" )... | Is the next thing an attribute filter? |
9,608 | protected function idFilter ( ) { $ id = "" ; if ( ! $ this -> match ( "/^\#/" ) ) { return false ; } if ( ! list ( $ id ) = $ this -> is ( "identifier" ) ) { throw new TextParserException ( "Invalid identifier" , $ this ) ; } return new CssParserFilterId ( $ id ) ; } | Is the next thing an id filter? |
9,609 | protected function classFilter ( ) { $ className = "" ; if ( ! $ this -> match ( "/^\./" ) ) { return false ; } if ( ! list ( $ className ) = $ this -> is ( "identifier" ) ) { throw new TextParserException ( "Invalid identifier" , $ this ) ; } return new CssParserFilterClass ( $ className ) ; } | Is the next thing a class filter? |
9,610 | protected function filter ( ) { $ filter = null ; if ( ( ! $ filter = $ this -> is ( "classFilter" ) ) && ( ! $ filter = $ this -> is ( "idFilter" ) ) && ( ! $ filter = $ this -> is ( "attrFilter" ) ) && ( ! $ filter = $ this -> is ( "pseudoFilter" ) ) ) { return false ; } return $ filter ; } | Is the next thing a filter? |
9,611 | protected function element ( ) { $ element = null ; $ filter = null ; $ tagName = "*" ; $ this -> match ( "\s+" ) ; if ( ( list ( $ name ) = $ this -> eq ( "*" ) ) || ( list ( $ name ) = $ this -> is ( "identifier" ) ) ) { $ tagName = $ name ? $ name : "*" ; } elseif ( ! $ filter = $ this -> is ( "filter" ) ) { return ... | Is the next thing an element? |
9,612 | protected function factor ( ) { $ combinator = null ; if ( $ combinator = $ this -> is ( "combinator" ) ) { if ( ! $ element = $ this -> is ( "element" ) ) { throw new TextParserException ( "Invalid expression" , $ this ) ; } } elseif ( $ element = $ this -> is ( "element" ) ) { $ combinator = CssParserCombinatorFactor... | Is the next thing a factor? |
9,613 | protected function selector ( ) { $ factor = null ; if ( ! $ factor = $ this -> is ( "factor" ) ) { return false ; } $ selector = new CssParserModelSelector ( ) ; $ selector -> addFactor ( $ factor ) ; while ( $ factor = $ this -> is ( "factor" ) ) { $ selector -> addFactor ( $ factor ) ; } return $ selector ; } | Is the next thing a selector? |
9,614 | protected function selectorList ( ) { $ nodes = array ( ) ; do { if ( ! $ selector = $ this -> is ( "selector" ) ) { break ; } $ nodes = Dom :: mergeNodes ( $ nodes , $ selector -> filter ( $ this -> _node ) ) ; } while ( $ this -> eq ( "," ) ) ; return new ArrayObject ( Dom :: sortNodes ( $ nodes ) ) ; } | Is the next thing a selectorList? |
9,615 | private function _load ( $ source , $ charset = "" , $ mimetype = "" ) { $ content = null ; if ( $ this -> _isURL ( $ source ) ) { list ( $ content , $ charset , $ mimetype ) = $ this -> _loadUrl ( $ source , $ charset , $ mimetype ) ; } elseif ( ! is_file ( $ source ) ) { $ content = $ source ; } if ( strlen ( $ chars... | Loads an XML or HTML document . |
9,616 | private function _loadUrl ( $ source , $ charset = "" , $ mimetype = "" ) { $ loadHeaders = ( strlen ( $ mimetype ) == 0 ) || ( strlen ( $ charset ) == 0 ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ source ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_HEADER ... | Loads url contents . |
9,617 | public static function toSerializationContext ( array $ context ) : SerializationContext { $ ctx = new SerializationContext ( ) ; if ( isset ( $ context [ 'groups' ] ) ) { $ ctx -> setGroups ( $ context [ 'groups' ] ) ; } return $ ctx ; } | Converts to SerializationContext . |
9,618 | public static function toDeserializationContext ( array $ context ) : DeserializationContext { $ ctx = new DeserializationContext ( ) ; if ( isset ( $ context [ 'object_to_populate' ] ) ) { $ ctx -> setAttribute ( 'target' , $ context [ 'object_to_populate' ] ) ; } if ( isset ( $ context [ 'groups' ] ) ) { $ ctx -> set... | Converts to DeserializationContext . |
9,619 | public static function arg ( $ value ) : string { switch ( gettype ( $ value ) ) { case 'NULL' : return 'NULL' ; case 'boolean' : return $ value ? 'true' : 'false' ; case 'array' : return 'Array' ; case 'object' : return 'Object(' . get_class ( $ value ) . ')' ; case 'string' : return "'" . self :: cutString ( ( string... | Represents an argument of a method as a string |
9,620 | public static function method ( array $ item ) : string { if ( empty ( $ item [ 'function' ] ) ) { return '' ; } $ method = $ item [ 'function' ] ; if ( ! empty ( $ item [ 'class' ] ) ) { $ type = ( empty ( $ item [ 'type' ] ) ? '->' : $ item [ 'type' ] ) ; $ class = $ item [ 'class' ] . $ type ; } else { $ class = '' ... | Represents a method call as a string |
9,621 | public static function point ( array $ item ) : string { if ( empty ( $ item [ 'file' ] ) ) { $ result = '[internal function]' ; } else { $ result = $ item [ 'file' ] ; if ( ! empty ( $ item [ 'line' ] ) ) { $ result .= '(' . $ item [ 'line' ] . ')' ; } } return $ result ; } | Represents a call point as a string |
9,622 | public static function item ( array $ item , ? int $ number = null ) : string { if ( $ number !== null ) { $ number = '#' . $ number . ' ' ; } return $ number . self :: point ( $ item ) . ': ' . self :: method ( $ item ) ; } | Represents a trace item as a string |
9,623 | public static function trace ( array $ items , string $ sep = PHP_EOL ) : string { $ lines = [ ] ; foreach ( $ items as $ number => $ item ) { $ lines [ ] = self :: item ( $ item , $ number ) ; } $ lines [ ] = '#' . ( count ( $ items ) ) . ' {main}' ; return implode ( $ sep , $ lines ) . $ sep ; } | Represents a trace as a string |
9,624 | private static function cutString ( string $ str ) : string { static $ mb ; if ( $ mb === null ) { $ mb = function_exists ( 'mb_strlen' ) ; } if ( $ mb ) { $ len = mb_strlen ( $ str , 'UTF-8' ) ; } else { $ len = strlen ( $ str ) ; } if ( $ len > self :: MAX_LEN ) { if ( $ mb ) { return mb_substr ( $ str , 0 , self :: ... | Cuts a string by the max length |
9,625 | public function scheduleOccurrences ( $ game , array $ data ) { set_time_limit ( 0 ) ; if ( $ game -> getOccurrenceType ( ) === 'code' ) { return $ this -> scheduleCodeOccurrences ( $ game , $ data ) ; } elseif ( $ game -> getOccurrenceType ( ) === 'datetime' ) { return $ this -> scheduleDateOccurrences ( $ game ) ; } ... | We can create Instant win occurrences dynamically |
9,626 | public function isInstantWinner ( $ game , $ user , $ value = null ) { $ occurrenceMapper = $ this -> getInstantWinOccurrenceMapper ( ) ; if ( $ game -> getOccurrenceType ( ) == 'datetime' ) { $ entry = $ this -> findLastActiveEntry ( $ game , $ user ) ; $ occurrence = $ occurrenceMapper -> checkDateOccurrenceByGameId ... | return true if the player has won . False otherwise . |
9,627 | public function getPayloadForDataIdentifier ( $ dataIdentifier ) { if ( $ dataIdentifier === null ) { return null ; } $ resourceConverter = new ResourceConverter ( ) ; $ resource = $ resourceConverter -> convertFrom ( $ dataIdentifier , Schema \ Resource :: class ) ; return $ resource -> getPayload ( ) ; } | If a proper data identifier structure is given the corresponding payload is returned . |
9,628 | protected function initializeControllerContext ( ) { $ request = new ActionRequest ( Request :: createFromEnvironment ( ) ) ; $ request -> setDispatched ( true ) ; if ( isset ( $ this -> flowHttpSettings [ 'baseUri' ] ) ) { $ request -> getHttpRequest ( ) -> setBaseUri ( new Uri ( $ this -> flowHttpSettings [ 'baseUri'... | The Resource Information most likely needs an UriBuilder so having a ControllerContext in place might come in handy . |
9,629 | public function onBeforeEditSeoCommit ( BeforeEditSeoCommitEvent $ event ) { if ( $ event -> isAborted ( ) ) { return ; } $ values = $ event -> getValues ( ) ; if ( ! is_array ( $ values ) ) { throw new InvalidArgumentException ( 'exception_invalid_value_array_required' ) ; } if ( array_key_exists ( "oldPermalink" , $ ... | Adds the page attributes when a new page is added for each language of the site |
9,630 | protected function initDefaultButtons ( ) { $ this -> buttons = ArrayHelper :: merge ( [ 'first' => [ 'icon' => 'triangle-top' , 'visible' => function ( $ model ) { if ( $ this -> attribute !== null && isset ( $ model [ $ this -> attribute ] ) ) { return $ model [ $ this -> attribute ] > 1 ; } return true ; } , 'option... | Initializes the default buttons . |
9,631 | protected function renderButton ( $ name , $ model , $ key , $ index ) { if ( ! isset ( $ this -> buttons [ $ name ] ) ) { return '' ; } $ button = $ this -> buttons [ $ name ] ; if ( $ button instanceof \ Closure ) { $ url = $ this -> createUrl ( $ name , $ model , $ key , $ index ) ; return call_user_func ( $ button ... | Renders button . |
9,632 | public function createUrl ( $ position , $ model , $ key , $ index ) { if ( is_callable ( $ this -> urlCreator ) ) { return call_user_func ( $ this -> urlCreator , $ position , $ model , $ key , $ index ) ; } else { $ params = array_merge ( Yii :: $ app -> getRequest ( ) -> getQueryParams ( ) , is_array ( $ key ) ? $ k... | Creates a URL for the given position and model . This method is called for each button and each row . |
9,633 | public function index ( Request $ request ) { $ images = $ this -> imageRepository -> getPaginated ( $ request -> get ( 'limit' , 50 ) ) ; if ( $ request -> ajax ( ) ) return $ images ; return view ( 'laramanager::images.index' , compact ( 'images' ) ) ; } | This provides the gallery of images |
9,634 | public function update ( UpdateImageRequest $ request , $ imageId ) { return $ this -> imageRepository -> update ( $ imageId , $ request -> all ( ) ) ; } | Update image from form |
9,635 | public function search ( Request $ request ) { $ images = $ this -> imageRepository -> search ( $ request -> term ) ; if ( $ request -> ajax ( ) ) return response ( ) -> json ( [ 'images' => view ( 'laramanager::browser.images' , compact ( 'images' ) ) -> render ( ) ] ) ; return view ( 'laramanager::images.index' , com... | Returns images from search results |
9,636 | public function imageBrowser ( Request $ request ) { return view ( 'laramanager::browser.wysiwyg' ) -> with ( 'funcNum' , $ request -> has ( 'CKEditorFuncNum' ) ? $ request -> get ( 'CKEditorFuncNum' ) : '' ) -> with ( 'images' , $ this -> imageRepository -> getPaginated ( ) ) ; } | Show image browser in the WYSIWYG editor |
9,637 | public function store ( UploadImageRequest $ request ) { $ upload = $ this -> uploader -> upload ( $ request -> file ( 'image' ) , storage_path ( 'app/laramanager/images' ) ) ; return $ this -> imageRepository -> create ( $ upload -> toArray ( ) ) ; } | Upload and save image information |
9,638 | public function setup ( ) { $ jaxon = jaxon ( ) ; $ this -> xResponse = $ jaxon -> getResponse ( ) ; $ this -> addViewRenderer ( 'sentry' , function ( ) { return new \ Jaxon \ Sentry \ View \ View ( ) ; } ) ; $ this -> addViewNamespace ( 'pagination' , '' , '' , 'sentry' ) ; $ jaxon -> setPaginationRenderer ( function ... | Setup the library . |
9,639 | public function addClassNamespace ( $ sDirectory , $ sNamespace , $ sSeparator = '.' , array $ aProtected = array ( ) ) { $ sSeparator = trim ( $ sSeparator ) ; if ( $ sSeparator != '_' ) { $ sSeparator = '.' ; } jaxon ( ) -> addClassDir ( trim ( $ sDirectory ) , trim ( $ sNamespace ) , $ sSeparator , $ aProtected ) ; ... | Add a class namespace . |
9,640 | public function addClassNamespaces ( $ xAppConfig ) { if ( $ xAppConfig -> hasOption ( 'classes' ) && is_array ( $ xAppConfig -> getOption ( 'classes' ) ) ) { $ aNamespaces = $ xAppConfig -> getOption ( 'classes' ) ; $ protected = array ( ) ; $ baseClass = new \ ReflectionClass ( '\\Jaxon\\Sentry\\Armada' ) ; foreach (... | Read class namespaces from config values . |
9,641 | public function mergeClassOptions ( $ aOptions ) { foreach ( $ aOptions as $ class => $ aClassOption ) { if ( ! array_key_exists ( $ class , $ this -> aClassOptions ) ) { $ this -> aClassOptions [ $ class ] = $ aClassOption ; } else { foreach ( $ aClassOption as $ key => $ aOption ) { $ this -> aClassOptions [ $ class ... | Read class options from config values . |
9,642 | public function addViewNamespace ( $ sNamespace , $ sDirectory , $ sExtension , $ sRenderer ) { $ aNamespace = array ( 'namespace' => $ sNamespace , 'directory' => $ sDirectory , 'extension' => $ sExtension , ) ; if ( key_exists ( $ sRenderer , $ this -> aViewNamespaces ) ) { $ this -> aViewNamespaces [ $ sRenderer ] [... | Add a view namespace and set the corresponding renderer . |
9,643 | public function addViewNamespaces ( $ xAppConfig ) { $ sDefaultNamespace = $ xAppConfig -> getOption ( 'options.views.default' , false ) ; if ( is_array ( $ namespaces = $ xAppConfig -> getOptionNames ( 'views' ) ) ) { foreach ( $ namespaces as $ namespace => $ option ) { if ( $ sDefaultNamespace == false ) { $ sDefaul... | Set the view namespaces . |
9,644 | public function setLibraryOptions ( $ bExtern , $ bMinify , $ sJsUri , $ sJsDir ) { $ jaxon = jaxon ( ) ; if ( ! $ jaxon -> hasOption ( 'js.app.extern' ) ) { $ jaxon -> setOption ( 'js.app.extern' , $ bExtern ) ; } if ( ! $ jaxon -> hasOption ( 'js.app.minify' ) ) { $ jaxon -> setOption ( 'js.app.minify' , $ bMinify ) ... | Set the Jaxon library default options . |
9,645 | protected function initInstance ( Armada $ instance ) { if ( ! ( $ instance ) || ( $ instance -> response ) ) { return ; } $ instance -> response = $ this -> xResponse ; $ instance -> rqFactory = new Factory \ Request ( $ instance ) ; $ instance -> pgFactory = new Factory \ Paginator ( $ instance ) ; if ( ( $ this -> x... | Initialize a class instance . |
9,646 | public function request ( $ classname ) { $ instance = $ this -> instance ( $ classname ) ; return ( $ instance != null ? $ instance -> request ( ) : null ) ; } | Get a Jaxon request to a given class . |
9,647 | public function onEventBefore ( & $ bEndRequest ) { $ class = $ _POST [ 'jxncls' ] ; $ method = $ _POST [ 'jxnmthd' ] ; if ( ! $ this -> validateClass ( $ class ) || ! $ this -> validateMethod ( $ method ) ) { $ bEndRequest = true ; return $ this -> xResponse ; } $ this -> xRequestObject = $ this -> instance ( $ class ... | This is the pre - request processing callback passed to the Jaxon library . |
9,648 | public function onEventAfter ( ) { if ( ( $ this -> xAfterCallback ) ) { call_user_func_array ( $ this -> xAfterCallback , array ( $ this -> xRequestObject , $ this -> sRequestMethod ) ) ; } return $ this -> xResponse ; } | This is the post - request processing callback passed to the Jaxon library . |
9,649 | public function processRequest ( ) { $ jaxon = jaxon ( ) ; if ( $ jaxon -> canProcessRequest ( ) ) { $ jaxon -> register ( Jaxon :: PROCESSING_EVENT , Jaxon :: PROCESSING_EVENT_BEFORE , array ( $ this , 'onEventBefore' ) ) ; $ jaxon -> register ( Jaxon :: PROCESSING_EVENT , Jaxon :: PROCESSING_EVENT_AFTER , array ( $ t... | Process the current Jaxon request . |
9,650 | protected function buildIconClasses ( $ icon ) { $ icon = preg_replace ( '/(?<![^ ])(?=[^ ])(?!fa)/' , 'fa-' , $ icon ) ; $ icon = ! is_array ( $ icon ) ? preg_split ( '/\s+/' , $ icon , - 1 , PREG_SPLIT_NO_EMPTY ) : $ icon ; if ( ! count ( array_intersect ( [ 'fa' , 'fab' , 'fal' , 'far' , 'fas' ] , $ icon ) ) ) { arr... | Internal method to build icon classes |
9,651 | public function addIconToText ( $ text , OptionsParser $ options ) { $ icon = $ options -> consume ( 'icon' ) ; $ align = $ options -> consume ( 'icon-align' ) ; if ( ! $ icon ) { return [ $ text , $ options ] ; } $ icon = $ this -> icon ( $ icon ) ; if ( empty ( $ text ) ) { $ text = $ icon ; } elseif ( $ align === 'r... | Adds icons to text |
9,652 | public function badge ( $ text , array $ options = [ ] ) { $ options = optionsParser ( $ options ) -> append ( 'class' , 'badge' ) ; return self :: tag ( 'span' , $ text , $ options -> toArray ( ) ) ; } | Creates a badge according to Bootstrap |
9,653 | public function css ( $ path , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'block' => true ] ) ; return parent :: css ( $ path , $ options -> toArray ( ) ) ; } | Adds a css file to the layout . |
9,654 | public function cssEnd ( ) { $ buffer = ob_get_clean ( ) ; $ options = $ this -> _cssBlockOptions ; $ this -> _cssBlockOptions = [ ] ; return $ this -> cssBlock ( $ buffer , $ options ) ; } | End a buffered section of css capturing . Generates a style tag inline or appends to specified view block depending on the settings used when the cssBlock was started . |
9,655 | public function heading ( $ text , array $ options = [ ] , $ small = null , array $ smallOptions = [ ] ) { $ options = optionsParser ( $ options ) ; $ type = $ options -> consume ( 'type' ) ; $ type = is_string ( $ type ) && preg_match ( '/^h[1-6]$/' , $ type ) ? $ type : 'h2' ; $ text = $ small ? sprintf ( '%s %s' , $... | Creates an heading according to Bootstrap . |
9,656 | public function icon ( $ icon ) { $ icon = func_num_args ( ) > 1 ? func_get_args ( ) : $ icon ; return $ this -> formatTemplate ( 'tag' , [ 'attrs' => $ this -> templater ( ) -> formatAttributes ( [ 'class' => $ this -> buildIconClasses ( $ icon ) ] ) , 'content' => ' ' , 'tag' => 'i' , ] ) ; } | Returns icons tag . |
9,657 | public function label ( $ text , array $ options = [ ] ) { $ options = optionsParser ( $ options ) ; $ options -> append ( 'class' , sprintf ( 'label label-%s' , $ options -> consume ( 'type' ) ? : 'default' ) ) ; return self :: tag ( 'span' , $ text , $ options -> toArray ( ) ) ; } | Create a label according to the Bootstrap component . |
9,658 | public function link ( $ title , $ url = null , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'escape' => false , 'title' => $ title ] ) ; $ options -> add ( 'title' , trim ( h ( strip_tags ( $ options -> get ( 'title' ) ) ) ) ) -> tooltip ( ) ; list ( $ title , $ options ) = $ this -> addIconToTe... | Creates an HTML link |
9,659 | public function script ( $ url , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'block' => true ] ) ; return parent :: script ( $ url , $ options -> toArray ( ) ) ; } | Adds a js file to the layout . |
9,660 | public function scriptBlock ( $ code , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'block' => true ] ) ; return parent :: scriptBlock ( $ code , $ options -> toArray ( ) ) ; } | Returns a Javascript code block |
9,661 | public function tag ( $ name , $ text = null , array $ options = [ ] ) { $ options = optionsParser ( $ options ) -> tooltip ( ) ; list ( $ text , $ options ) = $ this -> addIconToText ( $ text , $ options ) ; return parent :: tag ( $ name , is_null ( $ text ) ? '' : $ text , $ options -> toArray ( ) ) ; } | Returns a formatted block tag |
9,662 | public function viewport ( array $ options = [ ] ) { $ content = http_build_query ( [ 'initial-scale' => '1' , 'shrink-to-fit' => 'no' , 'width' => 'device-width' , ] , null , ', ' ) ; return self :: meta ( array_merge ( [ 'name' => 'viewport' ] , compact ( 'content' ) ) , null , $ options ) ; } | Adds the viewport meta tag . By default it uses options as required by Bootstrap |
9,663 | public function youtube ( $ id , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'allowfullscreen' => 'allowfullscreen' , 'height' => 480 , 'ratio' => '16by9' , 'width' => 640 , ] ) ; return self :: iframe ( sprintf ( 'https://www.youtube.com/embed/%s' , $ id ) , $ options -> toArray ( ) ) ; } | Adds a YouTube video . |
9,664 | public static function style ( $ styleID ) { if ( ! in_array ( $ styleID , static :: getKnownStyles ( ) ) ) { throw new Exception ( "Unknown style ID $styleID" ) ; } $ style = new Style ( $ styleID ) ; return $ style ; } | Format given string in chosen style |
9,665 | public static function getKnownStyles ( ) { $ styles = array ( static :: BOLD => static :: BASH_BOLD , static :: UNDERLINE => static :: BASH_UNDERLINE , static :: BLINK => static :: BASH_BLINK , static :: INVISIBLE => static :: BASH_INVISIBLE , ) ; return $ styles ; } | Get allowed styles |
9,666 | public function cooAction ( ) { $ sg = $ this -> getAdminGameService ( ) ; $ this -> checkGame ( ) ; $ models = $ sg -> getTradingCardModelMapper ( ) -> findBy ( array ( 'game' => $ this -> game ) ) ; if ( $ this -> getRequest ( ) -> isXmlHttpRequest ( ) && $ this -> getRequest ( ) -> isPost ( ) ) { $ position = json_d... | This function helps the admin to position UGC image on a card model |
9,667 | public static function decode ( $ code ) { $ data = self :: getData ( $ code ) ; $ chatlinkType = $ data [ 0 ] ; switch ( $ chatlinkType ) { case self :: TYPE_ITEM : return ItemChatlink :: decode ( $ code ) ; case self :: TYPE_COIN : return CoinChatlink :: decode ( $ code ) ; case self :: TYPE_TEXT : return TextChatlin... | Decodes a base64 encoded chat code . |
9,668 | protected static function getData ( $ code ) { if ( preg_match ( '/^\[&([a-z\d+\/]+=*)\]$/i' , $ code , $ matches ) !== 1 ) { throw new ChatlinkFormatException ( "Chatcode does not match the expected format." ) ; } $ base64 = $ matches [ 1 ] ; $ data = [ ] ; foreach ( str_split ( base64_decode ( $ base64 ) ) as $ char ... | Parses base64 encoded chat code and returns byte array . |
9,669 | protected function configureNewRelic ( Application $ app ) { if ( isset ( $ app [ 'newrelic.options' ] [ 'application_name' ] ) && $ app [ 'newrelic.options' ] [ 'application_name' ] ) { $ app [ 'newrelic' ] -> setAppName ( $ app [ 'newrelic.options' ] [ 'application_name' ] ) ; } if ( isset ( $ app [ 'newrelic.options... | For a complete overview of the newrelic configuration options see link |
9,670 | final public function run ( int $ maxRuntime = 300 ) : void { if ( $ this -> isRunning ) { $ this -> logger -> notice ( sprintf ( 'Consumer [%s] is already running.' , $ this -> consumerName ) ) ; return ; } $ jitter = mt_rand ( 0 , 3000 ) ; usleep ( $ jitter * 1000 ) ; $ maxRuntime += mt_rand ( 0 , 20 ) ; $ maxRuntime... | Runs the consumer until a signal is caught or the max runtime is reached . |
9,671 | public static function columnSum ( $ dataProvider , $ attributes ) { $ result = 0 ; foreach ( $ dataProvider -> models as $ model ) { foreach ( ( array ) $ attributes as $ attribute ) { $ result += $ model [ $ attribute ] ; } } return $ result ; } | Gets sum for GridList model attribute |
9,672 | public static function viaListFormat ( $ model , $ attribute , $ options = [ ] ) { $ relation = $ model -> getRelation ( $ attribute ) ; $ relationClass = $ relation -> modelClass ; $ columns = Yii :: $ app -> db -> getTableSchema ( $ relationClass :: tableName ( ) ) -> columnNames ; $ titles = array_intersect ( [ 'tit... | Renders grid column for list value of via table data |
9,673 | public static function dateFormat ( $ model , $ attribute , $ options = [ ] , $ pickerOptions = [ ] ) { $ pickerOptions = array_merge ( [ 'language' => Yii :: $ app -> language == 'en' ? 'en-US' : Yii :: $ app -> language , 'model' => $ model , 'attribute' => $ attribute , 'options' => [ 'class' => 'form-control' ] , ]... | Renders Date format Grid column |
9,674 | public static function arrayFormat ( $ model , $ attribute , $ options = [ ] ) { $ replacer = function ( $ v ) { return '<pre>' . preg_replace ( [ '#[\s\n]*\)#' , '#Array[\s\n]*\(#' ] , [ '' , '' ] , print_r ( $ v , true ) ) . '</pre>' ; } ; return array_merge ( [ 'attribute' => $ attribute , 'format' => 'raw' , 'value... | Renders Grid column for array value |
9,675 | public function create ( DynamoDbClient $ client , string $ tableName ) : void { try { $ client -> describeTable ( [ 'TableName' => $ tableName ] ) ; return ; } catch ( DynamoDbException $ e ) { } try { $ client -> createTable ( [ 'TableName' => $ tableName , 'AttributeDefinitions' => [ [ 'AttributeName' => self :: HAS... | Creates a DynamoDb table with the scheduler schema . |
9,676 | public function describe ( DynamoDbClient $ client , string $ tableName ) : string { try { $ result = $ client -> describeTable ( [ 'TableName' => $ tableName ] ) ; return json_encode ( $ result -> toArray ( ) , JSON_PRETTY_PRINT ) ; } catch ( \ Throwable $ e ) { throw new SchedulerOperationFailed ( sprintf ( '%s::Unab... | Describes a DynamoDb table . |
9,677 | public function release ( $ count ) { $ count = min ( $ count , $ this -> size ) ; if ( ! $ count ) { return ; } $ this -> size -= $ count ; call_user_func ( $ this -> releaseFn , $ count ) ; } | Releases the specified number of resources from this allocation |
9,678 | public function apply ( $ element , string $ type , string $ context = '' ) : string { if ( ! empty ( $ style = $ this -> getStyle ( $ type , $ context ) ) ) { return \ Spiral \ interpolate ( $ this -> element , compact ( 'style' , 'element' ) ) ; } return $ element ; } | Stylize content using pre - defined style . |
9,679 | public function paginate ( $ perPage = null , $ page = 1 ) { $ this -> paginated ( true ) ; $ this -> perPage = $ perPage ? : $ this -> perPage ; $ this -> page = $ page ; return $ this ; } | Set per page and page parameters . |
9,680 | public function makeSelect ( array $ columns = null ) { $ columns = $ columns ? : $ this -> columns ( ) ; $ selects = [ ] ; foreach ( $ columns as $ key => $ select ) { if ( is_int ( $ key ) ) { $ selects [ ] = $ select ; } else { $ selects [ ] = DB :: raw ( $ select . ' as ' . $ key ) ; } } return $ selects ; } | Create an array of select parameters from the columns declaration transforming string indexed element to have an alias as . |
9,681 | public function getColumns ( array $ columnKeys ) { $ columns = [ ] ; foreach ( $ columnKeys as $ columnKey ) { $ columns [ ] = $ this -> getColumn ( $ columnKey ) ; } return $ columns ; } | Get the actual columns of the given column keys . |
9,682 | protected function searchableQuery ( ) { $ query = $ this -> makeQuery ( ) ; if ( $ this -> paginated ) { $ query -> limit ( $ this -> pageLimitter ( ) -> limit ( ) ) ; $ query -> offset ( $ this -> pageLimitter ( ) -> offset ( ) ) ; } return $ query ; } | Prepare and return the searchable query . |
9,683 | public function searcher ( ) { return new SublimeSearch ( $ this -> searchableQuery ( ) , $ this -> searchOperator === 'having' ? $ this -> columnKeys ( ) : array_values ( $ this -> columns ( ) ) , $ this -> sortSearch , method_exists ( $ this , 'sortColumns' ) ? $ this -> sortColumns ( ) : $ this -> columns ( ) , $ th... | Return a searcher the search query logic and algorithm . |
9,684 | public function columnKeys ( ) { $ columnKeys = [ ] ; foreach ( $ this -> columns ( ) as $ key => $ column ) { if ( is_string ( $ key ) ) { $ columnKeys [ ] = $ key ; } elseif ( str_contains ( $ column , '.' ) ) { list ( $ table , $ columnKey ) = explode ( '.' , $ column ) ; $ columnKeys [ ] = $ columnKey ; } else { $ ... | Get the keys of columns to be used in the query result . |
9,685 | public static function fromString ( string $ envelope ) : self { $ envelope = json_decode ( $ envelope , true ) ; if ( ! is_array ( $ envelope ) ) { throw new \ InvalidArgumentException ( 'Envelope is invalid. ' . json_last_error_msg ( ) ) ; } $ serializer = isset ( $ envelope [ 'serializer' ] ) ? $ envelope [ 'seriali... | Recreates the envelope from a json string . |
9,686 | function initializeClassAttribute ( $ classAttribute ) { if ( $ classAttribute -> attribute ( self :: DEFAULT_ZONE_LAYOUT_FIELD ) === null ) $ classAttribute -> setAttribute ( self :: DEFAULT_ZONE_LAYOUT_FIELD , '' ) ; $ classAttribute -> store ( ) ; } | Sets the default values in class attribute |
9,687 | function serializeContentClassAttribute ( $ classAttribute , $ attributeNode , $ attributeParametersNode ) { $ defaultZoneLayout = $ classAttribute -> attribute ( self :: DEFAULT_ZONE_LAYOUT_FIELD ) ; $ dom = $ attributeParametersNode -> ownerDocument ; $ defaultLayoutNode = $ dom -> createElement ( 'default-layout' ) ... | Serialize contentclass attribute |
9,688 | function unserializeContentClassAttribute ( $ classAttribute , $ attributeNode , $ attributeParametersNode ) { $ defaultZoneLayoutItem = $ attributeParametersNode -> getElementsByTagName ( 'default-layout' ) -> item ( 0 ) ; if ( $ defaultZoneLayoutItem !== null && $ defaultZoneLayoutItem -> textContent !== false ) $ cl... | Unserialize contentclass attribute |
9,689 | function hasObjectAttributeContent ( $ contentObjectAttribute ) { $ page = $ contentObjectAttribute -> content ( ) ; $ zones = $ page -> attribute ( 'zones' ) ; if ( ! is_array ( $ zones ) ) return false ; foreach ( $ zones as $ zone ) { if ( $ zone -> getBlockCount ( ) > 0 ) return true ; } return false ; } | Checks if contentobject attribute has content |
9,690 | function fetchClassAttributeHTTPInput ( $ http , $ base , $ classAttribute ) { if ( $ http -> hasPostVariable ( $ base . '_ezpage_default_layout_' . $ classAttribute -> attribute ( 'id' ) ) ) { $ defaultLayout = $ http -> postVariable ( $ base . '_ezpage_default_layout_' . $ classAttribute -> attribute ( 'id' ) ) ; $ c... | Fetches all variables inputed on content class level return true if fetching of class attributes are successfull false if not |
9,691 | function objectAttributeContent ( $ contentObjectAttribute ) { $ source = $ contentObjectAttribute -> attribute ( 'data_text' ) ; $ page = eZPage :: createFromXML ( $ source ) ; return $ page ; } | Returns the content data for the given content object attribute . |
9,692 | protected function initializeActionMethodArguments ( ) { if ( $ this -> getOriginalRequest ( ) -> getControllerActionName ( ) === 'index' ) { switch ( $ this -> request -> getHttpRequest ( ) -> getMethod ( ) ) { case 'POST' : case 'PUT' : $ arguments = $ this -> request -> getArguments ( ) ; if ( ! isset ( $ arguments ... | The content of the root request is used as resource argument . |
9,693 | protected function extractRequestBody ( ) { $ propertyMappingConfiguration = new PropertyMappingConfiguration ( ) ; $ propertyMappingConfiguration -> setTypeConverter ( $ this -> objectManager -> get ( MediaTypeConverterInterface :: class ) ) ; $ propertyMappingConfiguration -> setTypeConverterOption ( MediaTypeConvert... | The content of the HTTP request is provided as json in a jsonapi . org structure . |
9,694 | public static function overlapLeftMerge ( $ overlap , $ attribute , $ field ) { $ overlap = explode ( '.' , $ overlap ) ; $ attribute = explode ( '.' , $ attribute ) ; $ field = explode ( '.' , $ field ) ; for ( $ i = 0 ; $ i < count ( $ overlap ) ; $ i ++ ) { $ field [ $ i ] = $ attribute [ $ i ] ; } return implode ( ... | Merge the overlap of pattern field and attribute . |
9,695 | public static function newFromSwiftAuth ( $ account , $ key , $ url ) { $ headers = array ( 'X-Auth-User' => $ account , 'X-Auth-Key' => $ key , ) ; $ client = \ HPCloud \ Transport :: instance ( ) ; $ res = $ client -> doRequest ( $ url , 'GET' , $ headers ) ; $ token = $ res -> header ( 'X-Auth-Token' ) ; $ newUrl = ... | Create a new instance after getting an authenitcation token . |
9,696 | public static function newFromIdentity ( $ identity , $ region ) { $ cat = $ identity -> serviceCatalog ( ) ; $ tok = $ identity -> token ( ) ; return self :: newFromServiceCatalog ( $ cat , $ tok , $ region ) ; } | Given an IdentityServices instance create an ObjectStorage instance . |
9,697 | public static function newFromServiceCatalog ( $ catalog , $ authToken , $ region ) { $ c = count ( $ catalog ) ; for ( $ i = 0 ; $ i < $ c ; ++ $ i ) { if ( $ catalog [ $ i ] [ 'type' ] == self :: SERVICE_TYPE ) { foreach ( $ catalog [ $ i ] [ 'endpoints' ] as $ endpoint ) { if ( isset ( $ endpoint [ 'publicURL' ] ) &... | Given a service catalog and an token create an ObjectStorage instance . |
9,698 | public function useCDN ( $ cdn ) { if ( empty ( $ cdn ) ) { throw new \ HPCloud \ Exception ( 'Cannot use CDN: No CDN provided.' ) ; } $ containers = $ cdn -> containers ( TRUE ) ; $ buffer = array ( ) ; foreach ( $ containers as $ item ) { if ( $ item [ 'cdn_enabled' ] == 1 ) { $ buffer [ $ item [ 'name' ] ] = array (... | Indicate that this ObjectStorage instance should use the given CDN service . |
9,699 | public function cdnUrl ( $ containerName , $ ssl = TRUE ) { if ( ! empty ( $ this -> cdnContainers [ $ containerName ] ) ) { $ key = $ ssl ? 'sslUrl' : 'url' ; return $ this -> cdnContainers [ $ containerName ] [ $ key ] ; } } | Return the CDN URL for a particular container . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.