idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
6,300 | public function hasPermissions ( $ permissions ) { if ( $ this -> user ( ) === null ) { return null ; } if ( ! is_array ( $ permissions ) ) { $ permissions = func_get_args ( ) ; } return count ( array_intersect ( $ permissions , $ this -> permissions ) ) === count ( $ permissions ) ; } | Check if authenticated user has all permission passed by parameter |
6,301 | public function isBlocked ( ) { if ( $ this -> user ( ) === null ) { return null ; } if ( $ this -> user instanceof User ) { return $ this -> user -> blocked ; } return false ; } | Return if current user is blocked |
6,302 | function addPlayerInTeam ( $ login , $ teamId ) { switch ( $ teamId ) { case 0 : if ( array_search ( $ login , $ this -> team2 ) ) { throw new \ InvalidArgumentException ( ) ; } if ( ! array_search ( $ login , $ this -> team1 ) ) { $ this -> team1 [ ] = $ login ; } break ; case 1 : if ( array_search ( $ login , $ this ... | add a login in a team throw an exception if the login is already teamed or if the team does not exist |
6,303 | public function enableTracy ( $ logDirectory = null , $ email = null ) { Tracy \ Debugger :: $ strictMode = true ; Tracy \ Debugger :: enable ( $ this -> mode , $ logDirectory , $ email ) ; } | Enable Tracy Tools . |
6,304 | public function createAutoload ( $ path ) { $ loader = new Loaders \ RobotLoader ; $ loader -> setCacheStorage ( new Caching \ Storages \ FileStorage ( $ this -> temp ) ) ; $ loader -> addDirectory ( $ path ) -> register ( ) ; return $ loader ; } | Autoloading classes . |
6,305 | protected static function buildQueryStatement ( & $ objQueryBuilder , iCondition $ objConditions , $ objOptionalClauses , $ mixParameterArray , $ blnCountOnly ) { $ objDatabase = static :: getDatabase ( ) ; $ strTableName = static :: getTableName ( ) ; $ objQueryBuilder = new Builder ( $ objDatabase , $ strTableName ) ... | Takes a query builder object and outputs the sql query that corresponds to its structure and the given parameters . |
6,306 | protected static function _QueryArray ( iCondition $ objConditions , $ objOptionalClauses = null , $ mixParameterArray = null ) { try { $ strQuery = static :: buildQueryStatement ( $ objQueryBuilder , $ objConditions , $ objOptionalClauses , $ mixParameterArray , false ) ; } catch ( Caller $ objExc ) { $ objExc -> incr... | Static Qcubed Query method to query for an array of objects . Uses BuildQueryStatment to perform most of the work . Is called by QueryArray function of each object so that the correct return type will be put in the comments . |
6,307 | public static function queryCursor ( iCondition $ objConditions , $ objOptionalClauses = null , $ mixParameterArray = null ) { try { $ strQuery = static :: buildQueryStatement ( $ objQueryBuilder , $ objConditions , $ objOptionalClauses , $ mixParameterArray , false ) ; } catch ( Caller $ objExc ) { $ objExc -> increme... | Static Qcubed query method to issue a query and get a cursor to progressively fetch its results . Uses BuildQueryStatment to perform most of the work . |
6,308 | public static function queryCount ( iCondition $ objConditions , $ objOptionalClauses = null , $ mixParameterArray = null ) { try { $ strQuery = static :: buildQueryStatement ( $ objQueryBuilder , $ objConditions , $ objOptionalClauses , $ mixParameterArray , true ) ; } catch ( Caller $ objExc ) { $ objExc -> increment... | Static Qcubed Query method to query for a count of objects . Uses BuildQueryStatment to perform most of the work . |
6,309 | public static function expandArray ( $ objDbRow , $ strAliasPrefix , $ objNode , $ objPreviousItemArray , $ strColumnAliasArray ) { if ( ! $ objNode -> ChildNodeArray ) { return null ; } $ blnExpanded = null ; $ pk = static :: getRowPrimaryKey ( $ objDbRow , $ strAliasPrefix , $ strColumnAliasArray ) ; foreach ( $ objP... | Do a possible array expansion on the given node . If the node is an ExpandAsArray node it will add to the corresponding array in the object . Otherwise it will follow the node so that any leaf expansions can be handled . |
6,310 | protected function getTableFields ( Table $ table ) { $ fileds = [ ] ; foreach ( $ table -> getColumns ( ) as $ column ) { $ fileds [ ] = [ 'name' => $ column -> getName ( ) , 'type' => $ column -> getType ( ) -> getName ( ) , 'not_null' => $ column -> getNotnull ( ) , 'length' => $ column -> getLength ( ) , 'unsigned'... | get database fileds |
6,311 | protected function isPrimaryKey ( Table $ table , Column $ column ) { if ( $ table -> hasPrimaryKey ( ) ) { $ primaryKeys = $ table -> getPrimaryKey ( ) -> getColumns ( ) ; return in_array ( $ column -> getName ( ) , $ primaryKeys ) ; } return false ; } | check is column primary key |
6,312 | protected function isForeignKey ( Table $ table , Column $ column ) { $ foreignKey = false ; foreach ( $ table -> getIndexes ( ) as $ key => $ index ) { if ( $ key !== 'primary' ) { try { $ fkConstrain = $ table -> getForeignkey ( $ key ) ; $ foreignKey = in_array ( $ column -> getName ( ) , $ fkConstrain -> getColumns... | check is column foreign key |
6,313 | public function getFields ( $ table ) { if ( isset ( $ this -> tables [ $ table ] ) ) { return new Collection ( $ this -> tables [ $ table ] ) ; } } | get table fields |
6,314 | public function isFieldExists ( $ table , $ field ) { if ( isset ( $ this -> tables [ $ table ] ) ) { $ fields = $ this -> getFields ( $ table ) ; return $ fields -> where ( 'name' , $ field ) -> count ( ) > 0 ; } return false ; } | check is model table exists |
6,315 | public function filter ( $ value , array $ options = [ ] ) { if ( ! is_string ( $ value ) ) return $ value ; $ value = trim ( $ value ) ; if ( ! Str :: startsWith ( $ value , [ 'http://' , 'https://' ] ) ) { $ value = "http://$value" ; } return filter_var ( $ value , FILTER_SANITIZE_URL ) ; } | Sanitize url of the given string . |
6,316 | public static function add ( $ key , $ value , $ expires ) { $ cache = self :: instance ( ) ; if ( $ cache && $ value != null ) { $ cache -> set ( $ key , $ value , $ expires * 60 ) ; } } | Adds a value to cache . |
6,317 | public static function has ( $ key ) { $ cache = self :: instance ( ) ; if ( $ cache ) { return $ cache -> isExisting ( $ key ) ; } return false ; } | Returns flag if a given key has a value in cache or not . |
6,318 | public static function remember ( $ key , $ expires , Closure $ closure ) { $ cache = self :: instance ( ) ; if ( $ cache ) { if ( $ cache -> isExisting ( $ key ) ) { return $ cache -> get ( $ key ) ; } else if ( $ closure != null ) { $ value = $ closure ( ) ; $ cache -> set ( $ key , $ value , $ expires * 60 ) ; retur... | Returns the value of a given key . If it doesn t exist then the value pass by is returned . |
6,319 | protected function defineActivationHooks ( ) : void { $ backend = $ this -> getBackend ( ) ; $ pluginName = $ this -> getFilename ( ) ; $ handlers = [ "activate" , "deactivate" , "uninstall" ] ; foreach ( $ handlers as $ handler ) { $ hook = $ handler . "_" . $ pluginName ; $ this -> loader -> addAction ( $ hook , $ ba... | Defines hooks using the Backend object for the activate deactivate and uninstall actions of this plugin . |
6,320 | private function _createEntries ( array $ data ) { foreach ( $ data as $ row ) { $ mandatories = array ( 'title' , 'link' , 'description' ) ; foreach ( $ mandatories as $ mandatory ) { if ( ! isset ( $ row [ $ mandatory ] ) ) { require_once 'Zend/Feed/Builder/Exception.php' ; throw new Zend_Feed_Builder_Exception ( "$m... | Create the array of article entries |
6,321 | private function getAttrAsArray ( \ DOMElement $ element ) { $ return = [ ] ; for ( $ i = 0 ; $ i < $ element -> attributes -> length ; ++ $ i ) { $ return [ $ element -> attributes -> item ( $ i ) -> nodeName ] = $ element -> attributes -> item ( $ i ) -> nodeValue ; } return $ return ; } | Get element attributes as array . |
6,322 | private function setCover ( Item $ item , $ id , $ type ) { $ item -> setCover ( self :: NAME . '/' . $ id . '/1.jpg' ) ; return $ this -> uploadImage ( $ this -> getCoverUrl ( $ id , $ type ) , $ item ) ; } | Get cover from source id . |
6,323 | private function getGenreByName ( $ name ) { if ( isset ( $ this -> genres [ $ name ] ) ) { return $ this -> doctrine -> getRepository ( 'AnimeDbCatalogBundle:Genre' ) -> findOneByName ( $ this -> genres [ $ name ] ) ; } } | Get real genre by name . |
6,324 | private function getTypeByName ( $ name ) { if ( isset ( $ this -> types [ $ name ] ) ) { return $ this -> doctrine -> getRepository ( 'AnimeDbCatalogBundle:Type' ) -> find ( $ this -> types [ $ name ] ) ; } } | Get real type by name . |
6,325 | public function getFrames ( $ id , $ type ) { $ dom = $ this -> browser -> getDom ( '/' . $ type . '/' . $ type . '_photos.php?id=' . $ id ) ; if ( ! $ dom ) { return [ ] ; } $ images = ( new \ DOMXPath ( $ dom ) ) -> query ( '//table//table//table//img' ) ; $ frames = [ ] ; foreach ( $ images as $ image ) { $ src = $ ... | Get item frames . |
6,326 | private function getNodeValueAsText ( \ DOMNode $ node ) { $ text = $ node -> ownerDocument -> saveHTML ( $ node ) ; $ text = str_replace ( [ "<br>\n" , "\n" , '<br>' ] , [ '<br>' , ' ' , "\n" ] , $ text ) ; return trim ( strip_tags ( $ text ) ) ; } | Get node value as text . |
6,327 | private function getStudio ( \ DOMXPath $ xpath , \ DOMNode $ body ) { $ studios = $ xpath -> query ( '//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]' , $ body ) ; if ( $ studios -> length ) { foreach ( $ studios as $ studio ) { $ url = $ studio -> attributes -> getNamedItem ( 'src' ) -> nodeValue ... | Get item studio . |
6,328 | public function getItemType ( $ url ) { if ( strpos ( $ url , self :: ITEM_TYPE_ANIMATION . '/' . self :: ITEM_TYPE_ANIMATION ) !== false ) { return self :: ITEM_TYPE_ANIMATION ; } elseif ( strpos ( $ url , self :: ITEM_TYPE_CINEMA . '/' . self :: ITEM_TYPE_CINEMA ) !== false ) { return self :: ITEM_TYPE_CINEMA ; } els... | Get item type by URL . |
6,329 | protected function fillAnimationNames ( Item $ item , \ DOMXPath $ xpath , \ DOMElement $ head ) { $ names = $ xpath -> query ( 'table[1]/tr/td' , $ head ) -> item ( 0 ) -> nodeValue ; $ names = explode ( "\n" , trim ( $ names ) ) ; $ name = preg_replace ( '/\[\d{4}\]/' , '' , array_shift ( $ names ) ) ; $ name = preg_... | Fill names for Animation type . |
6,330 | public function getCoverUrl ( $ id , $ type ) { switch ( $ type ) { case self :: ITEM_TYPE_ANIMATION : return $ this -> browser -> getHost ( ) . '/' . $ type . '/img/' . ( ceil ( $ id / 1000 ) * 1000 ) . '/' . $ id . '/1.jpg' ; case self :: ITEM_TYPE_CINEMA : return $ this -> browser -> getHost ( ) . '/' . $ type . '/i... | Get cover URL . |
6,331 | public function preSend ( Event $ e ) { $ validator = new NotEmpty ( ) ; if ( ! isset ( $ this -> options [ 'tokenOrLogin' ] ) || ! $ validator -> isValid ( $ this -> options [ 'tokenOrLogin' ] ) ) { throw new Exception \ InvalidArgumentException ( 'You need to set OAuth token!' ) ; } $ request = $ e -> getTarget ( ) ;... | Add access token to Request Parameters |
6,332 | final protected function initPostStatusesTrait ( ) : void { $ postStatuses = $ this -> getPostStatuses ( ) ; $ options = [ ] ; foreach ( $ postStatuses as $ postStatus ) { $ args = $ this -> getPostStatusArguments ( $ postStatus ) ; add_action ( "init" , function ( ) use ( $ postStatus , $ args ) { register_post_status... | When we initialize this trait we want to register our post statuses and ensure that they appear in the status drop - downs throughout Word - Press core . |
6,333 | public static function insert ( $ table , $ values = array ( ) , $ handler = null ) { return Query_Insert :: create ( $ table , $ handler ) -> values ( $ values ) ; } | Create an insert |
6,334 | public function or_where ( $ column , $ param1 = null , $ param2 = null ) { return $ this -> where ( $ column , $ param1 , $ param2 , 'or' ) ; } | Create an or where statement |
6,335 | public function getLogManager ( ) : ? LogManager { if ( ! $ this -> hasLogManager ( ) ) { $ this -> setLogManager ( $ this -> getDefaultLogManager ( ) ) ; } return $ this -> logManager ; } | Get log manager |
6,336 | public static function bundle ( $ name , $ path = null ) { static :: $ bundles [ $ name ] = $ path ; static :: $ namespaces [ $ name ] = $ path . CCDIR_CLASS ; } | Add a bundle A bundle is a CCF style package with classes controllers views etc . |
6,337 | public static function map ( $ name , $ path = null ) { if ( is_array ( $ name ) ) { static :: $ namespaces = array_merge ( static :: $ namespaces , $ name ) ; return ; } static :: $ namespaces [ $ name ] = $ path ; } | Add one or more maps A map is simply a class namepsace |
6,338 | public static function shadow ( $ name , $ namespace , $ path = null ) { static :: $ shadows [ $ name ] = $ class = $ namespace . "\\" . $ name ; if ( ! is_null ( $ path ) ) { static :: bind ( $ name , $ class ) ; } } | Add a shadow class A shadow class is a global class and gets liftet to the global namespace . |
6,339 | public static function alias ( $ name , $ path = null ) { if ( is_array ( $ name ) ) { static :: $ aliases = array_merge ( static :: $ aliases , $ name ) ; return ; } static :: $ aliases [ $ name ] = $ path ; } | Add one or more aliases An alias can overwrite an shadow . This way we can extend other classes . |
6,340 | public static function bind ( $ name , $ path = null ) { if ( is_array ( $ name ) ) { static :: $ classes = array_merge ( static :: $ classes , $ name ) ; return ; } static :: $ classes [ $ name ] = $ path ; } | Add one or more class to the autoloader |
6,341 | public static function package ( $ dir , $ classes ) { foreach ( $ classes as $ name => $ path ) { static :: $ classes [ $ name ] = $ dir . $ path ; } } | This simply adds some classes with a prefix |
6,342 | public static function shadow_package ( $ dir , $ namespace , $ shadows ) { foreach ( $ shadows as $ name => $ path ) { static :: $ shadows [ $ name ] = $ class = $ namespace . "\\" . $ name ; static :: $ classes [ $ class ] = $ dir . $ path ; } } | This simply adds some shadows with a prefix |
6,343 | public function setData ( $ data , $ key = null ) { if ( is_array ( $ data ) && $ key === null ) { $ this -> data = $ data ; return $ this ; } if ( $ key === null ) $ key = 'data' ; $ this -> data [ $ key ] = $ data ; return $ this ; } | setting data to add for the logging action |
6,344 | public function body ( CryptographyEngine $ cryptographyEngine ) { $ body = array ( 'hash' => $ cryptographyEngine -> hash ( $ this -> email ) , 'action' => $ this -> action , ) ; if ( ! empty ( $ this -> scope ) ) $ body [ 'scope' ] = $ this -> scope ; if ( ! empty ( $ this -> data ) ) $ body [ 'data' ] = $ cryptograp... | returns the body |
6,345 | public function getPath ( $ id ) { $ node = $ this -> getNode ( $ id ) ; if ( ! $ node ) { return [ ] ; } $ left = $ this -> getConfig ( 'leftField' ) ; $ right = $ this -> getConfig ( 'rightField' ) ; return $ this -> getRepository ( ) -> select ( ) -> where ( $ left , '<' , $ node [ $ left ] ) -> where ( $ right , '>... | Return the hierarchical path to the current node . |
6,346 | public function getTree ( $ id = null ) { $ parent = $ this -> getConfig ( 'parentField' ) ; $ left = $ this -> getConfig ( 'leftField' ) ; $ right = $ this -> getConfig ( 'rightField' ) ; $ query = $ this -> getRepository ( ) -> select ( ) -> orderBy ( $ left , 'asc' ) ; if ( $ id ) { if ( $ parentNode = $ this -> get... | Return a tree of nested nodes . If no ID is provided the top level root will be used . |
6,347 | public function mapList ( array $ nodes , $ key , $ value , $ spacer ) { $ tree = [ ] ; $ stack = [ ] ; $ key = $ key ? : $ this -> getRepository ( ) -> getPrimaryKey ( ) ; $ value = $ value ? : $ this -> getRepository ( ) -> getDisplayField ( ) ; $ right = $ this -> getConfig ( 'rightField' ) ; foreach ( $ nodes as $ ... | Map a nested tree using the primary key and display field as the values to populate the list . Nested lists will be prepended with a spacer to indicate indentation . |
6,348 | public function mapTree ( array $ nodes , array $ mappedNodes = [ ] ) { if ( ! $ mappedNodes ) { return $ nodes ; } $ tree = [ ] ; $ pk = $ this -> getRepository ( ) -> getPrimaryKey ( ) ; foreach ( $ nodes as $ node ) { $ id = $ node [ $ pk ] ; if ( isset ( $ mappedNodes [ $ id ] ) ) { $ node [ $ this -> getConfig ( '... | Map a nested tree of arrays using the parent node stack and the mapped nodes by parent ID . |
6,349 | public function preDelete ( Event $ event , Query $ query , $ id ) { if ( ! $ this -> getConfig ( 'onDelete' ) ) { return true ; } if ( $ node = $ this -> getNode ( $ id ) ) { $ count = $ this -> getRepository ( ) -> select ( ) -> where ( $ this -> getConfig ( 'parentField' ) , $ id ) -> count ( ) ; if ( $ count ) { re... | Before a delete fetch the node and save its left index . If a node has children the delete will fail . |
6,350 | public function postDelete ( Event $ event , $ id , $ count ) { if ( ! $ this -> getConfig ( 'onDelete' ) || ! $ this -> _deleteIndex ) { return ; } $ this -> _removeNode ( $ id , $ this -> _deleteIndex ) ; $ this -> _deleteIndex = null ; } | After a delete shift all nodes up using the base index . |
6,351 | public function postSave ( Event $ event , $ id , $ count ) { if ( ! $ this -> getConfig ( 'onSave' ) || ! $ this -> _saveIndex ) { return ; } $ this -> _insertNode ( $ id , $ this -> _saveIndex ) ; $ this -> _saveIndex = null ; } | After an insert shift all nodes down using the base index . |
6,352 | protected function _moveNode ( Closure $ callback , array $ data ) { return $ this -> getRepository ( ) -> updateMany ( $ data , $ callback , [ 'before' => false , 'after' => false ] ) ; } | Move a node or nodes by applying a where clause to an update query and saving data . Disable before and after callbacks to recursive events don t trigger . |
6,353 | protected function _removeNode ( $ id , $ index ) { $ pk = $ this -> getRepository ( ) -> getPrimaryKey ( ) ; foreach ( [ $ this -> getConfig ( 'leftField' ) , $ this -> getConfig ( 'rightField' ) ] as $ field ) { $ this -> _moveNode ( function ( Query $ query ) use ( $ field , $ index , $ id , $ pk ) { $ query -> wher... | Prepares a node for removal by moving all following nodes up . |
6,354 | protected function _reOrder ( $ parent_id , $ left , array $ order = [ ] ) { $ parent = $ this -> getConfig ( 'parentField' ) ; $ repo = $ this -> getRepository ( ) ; $ pk = $ repo -> getPrimaryKey ( ) ; $ right = $ left + 1 ; $ children = $ repo -> select ( ) -> where ( $ parent , $ parent_id ) -> orderBy ( $ order ) ... | Re - order the tree by recursively looping through all parents and children ordering the results and generating the correct left and right indexes . |
6,355 | public function getPath ( $ node ) { $ qb = $ this -> createQueryBuilder ( 'node' ) ; $ qb -> where ( $ qb -> expr ( ) -> lte ( 'node.lft' , $ node -> getLft ( ) ) ) -> andWhere ( $ qb -> expr ( ) -> gte ( 'node.rgt' , $ node -> getRgt ( ) ) ) -> andWhere ( 'node.context = :context' ) -> orderBy ( 'node.lft' , 'ASC' ) ... | Get the path of a node |
6,356 | public function menu ( array $ links , array $ options = array ( ) ) { $ align = ( isset ( $ options [ 'pull' ] ) ) ? ' navbar-' . $ options [ 'pull' ] : '' ; unset ( $ options [ 'pull' ] ) ; return "\n\t" . '<ul class="nav navbar-nav' . $ align . '">' . $ this -> links ( 'li' , $ links , $ options ) . '</ul>' ; } | Create a menu of links across your navbar . |
6,357 | public function text ( $ string , $ pull = false ) { $ align = ( in_array ( $ pull , array ( 'left' , 'right' ) ) ) ? ' navbar-' . $ pull : '' ; return "\n\t" . '<p class="navbar-text' . $ align . '">' . $ this -> addClass ( $ string , array ( 'a' => 'navbar-link' ) ) . '</p>' ; } | Add a string of text to your navbar . |
6,358 | public function assets ( $ type = 'css' ) { $ output = [ ] ; $ assets = $ this -> Assets -> getAssets ( $ type ) ; foreach ( $ assets as $ asset ) { $ output [ ] = $ asset [ 'output' ] ; } return implode ( $ this -> eol , $ output ) ; } | Get assets fot layout render . |
6,359 | public function beforeLayout ( Event $ event , $ layoutFile ) { $ pluginEvent = Plugin :: getData ( 'Core' , 'View.beforeLayout' ) ; if ( is_callable ( $ pluginEvent -> find ( 0 ) ) && Plugin :: hasManifestEvent ( 'View.beforeLayout' ) ) { call_user_func_array ( $ pluginEvent -> find ( 0 ) , [ $ this -> _View , $ event... | Is called before layout rendering starts . Receives the layout filename as an argument . |
6,360 | public function beforeRenderFile ( Event $ event , $ viewFile ) { $ pluginEvent = Plugin :: getData ( 'Core' , 'View.beforeRenderFile' ) ; if ( is_callable ( $ pluginEvent -> find ( 0 ) ) && Plugin :: hasManifestEvent ( 'View.beforeRenderFile' ) ) { call_user_func_array ( $ pluginEvent -> find ( 0 ) , [ $ this -> _View... | Is called before each view file is rendered . This includes elements views parent views and layouts . |
6,361 | public function getBodyClasses ( ) { $ prefix = ( $ this -> request -> getParam ( 'prefix' ) ) ? 'prefix-' . $ this -> request -> getParam ( 'prefix' ) : 'prefix-site' ; $ classes = [ $ prefix , 'theme-' . Str :: low ( $ this -> _View -> theme ) , 'plugin-' . Str :: low ( $ this -> _View -> plugin ) , 'view-' . Str :: ... | Get body classes by view data . |
6,362 | public function head ( ) { $ output = [ 'meta' => $ this -> _View -> fetch ( 'meta' ) , 'assets' => $ this -> assets ( 'css' ) , 'fetch_css' => $ this -> _View -> fetch ( 'css' ) , 'fetch_css_bottom' => $ this -> _View -> fetch ( 'css_bottom' ) , ] ; return implode ( '' , $ output ) ; } | Create head for layout . |
6,363 | public function lang ( $ isLang = true ) { list ( $ lang , $ region ) = explode ( '_' , $ this -> locale ) ; return ( $ isLang ) ? Str :: low ( $ lang ) : Str :: low ( $ region ) ; } | Site language . |
6,364 | public function meta ( array $ rows , $ block = null ) { $ output = [ ] ; foreach ( $ rows as $ row ) { $ output [ ] = trim ( $ row ) ; } $ output = implode ( $ this -> eol , $ output ) . $ this -> eol ; if ( $ block !== null ) { $ this -> _View -> append ( $ block , $ output ) ; return null ; } return $ output ; } | Creates a link to an external resource and handles basic meta tags . |
6,365 | public function type ( ) { $ lang = $ this -> lang ( ) ; $ html = [ '<!doctype html>' , '<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7 ie6" ' . 'lang="' . $ lang . '" dir="' . $ this -> dir . '"> <![endif] , '<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8 ie7" ' . 'lang="' . $ lang . '" dir="' . $ this -> di... | Create html 5 document type . |
6,366 | protected function _assignMeta ( $ key ) { if ( Arr :: key ( $ key , $ this -> _View -> viewVars ) ) { $ this -> _View -> assign ( $ key , $ this -> _View -> viewVars [ $ key ] ) ; } return $ this ; } | Assign data from view vars . |
6,367 | public static function select ( $ type , $ sql , $ binds = null ) { if ( in_array ( $ type , self :: $ types ) == false ) { $ exception = bootstrap :: get_library ( 'exception' ) ; throw new $ exception ( 'unknown select type' ) ; } $ results = self :: query ( $ sql , $ binds ) ; return self :: { 'as_' . $ type } ( $ r... | executes a SELECT statement and returns the result as array row or single field |
6,368 | public static function query ( $ sql , $ binds = null ) { if ( ! empty ( $ binds ) ) { $ sql = self :: merge ( $ sql , $ binds ) ; } if ( preg_match ( '{^(UPDATE|DELETE)\s}' , $ sql ) && preg_match ( '{\s(WHERE|LIMIT)\s}' , $ sql ) == false ) { $ exception = bootstrap :: get_library ( 'exception' ) ; throw new $ except... | executes any query on the database |
6,369 | private static function merge ( $ sql , $ binds ) { if ( is_array ( $ binds ) == false ) { $ binds = ( array ) $ binds ; } if ( is_null ( self :: $ connection ) ) { $ exception = bootstrap :: get_library ( 'exception' ) ; $ response = bootstrap :: get_library ( 'response' ) ; throw new $ exception ( 'no db connection' ... | merges bind values while escaping them |
6,370 | protected function registerPlugin ( ) { $ id = $ this -> options [ 'id' ] ; $ view = $ this -> getView ( ) ; MasonryAsset :: register ( $ view ) ; ImagesLoadedAsset :: register ( $ view ) ; $ js = [ ] ; $ js [ ] = "var mscontainer$id = $('#$id');" ; $ js [ ] = "mscontainer$id.imagesLoaded(function(){mscontainer$id.maso... | Registers the widget and the related events |
6,371 | public static function getError ( $ unset = false ) { JLog :: add ( 'JError::getError() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; if ( ! isset ( self :: $ stack [ 0 ] ) ) { return false ; } if ( $ unset ) { $ error = array_shift ( self :: $ stack ) ; } else { $ error = & self :: $ stack [ 0 ] ; } return $ er... | Method for retrieving the last exception object in the error stack |
6,372 | public static function addToStack ( JException & $ e ) { JLog :: add ( 'JError::addToStack() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; self :: $ stack [ ] = & $ e ; } | Method to add non - JError thrown JExceptions to the JError stack for debugging purposes |
6,373 | public static function raise ( $ level , $ code , $ msg , $ info = null , $ backtrace = false ) { JLog :: add ( 'JError::raise() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ class = $ code == 404 ? 'JExceptionNotFound' : 'JException' ; $ exception = new $ class ( $ msg , $ code , $ level , $ info , $ backtrac... | Create a new JException object given the passed arguments |
6,374 | public static function setErrorHandling ( $ level , $ mode , $ options = null ) { JLog :: add ( 'JError::setErrorHandling() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ levels = self :: $ levels ; $ function = 'handle' . ucfirst ( $ mode ) ; if ( ! is_callable ( array ( 'JError' , $ function ) ) ) { return se... | Method to set the way the JError will handle different error levels . Use this if you want to override the default settings . |
6,375 | public static function registerErrorLevel ( $ level , $ name , $ handler = 'ignore' ) { JLog :: add ( 'JError::registerErrorLevel() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; if ( isset ( self :: $ levels [ $ level ] ) ) { return false ; } self :: $ levels [ $ level ] = $ name ; self :: setErrorHandling ( $ l... | Method to register a new error level for handling errors |
6,376 | public static function handleEcho ( & $ error , $ options ) { JLog :: add ( 'JError::handleEcho() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ level_human = self :: translateErrorLevel ( $ error -> get ( 'level' ) ) ; if ( JDEBUG ) { $ backtrace = $ error -> getTrace ( ) ; $ trace = '' ; for ( $ i = count ( $... | Echo error handler - Echos the error message to output |
6,377 | public static function handleVerbose ( & $ error , $ options ) { JLog :: add ( 'JError::handleVerbose() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ level_human = self :: translateErrorLevel ( $ error -> get ( 'level' ) ) ; $ info = $ error -> get ( 'info' ) ; if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ) { echo... | Verbose error handler - Echos the error message to output as well as related info |
6,378 | public static function handleDie ( & $ error , $ options ) { JLog :: add ( 'JError::handleDie() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ level_human = self :: translateErrorLevel ( $ error -> get ( 'level' ) ) ; if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ) { jexit ( "<br /><b>J$level_human</b>: " . $ error ... | Die error handler - Echos the error message to output and then dies |
6,379 | public static function handleMessage ( & $ error , $ options ) { JLog :: add ( 'JError::hanleMessage() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ appl = JFactory :: getApplication ( ) ; $ type = ( $ error -> get ( 'level' ) == E_NOTICE ) ? 'notice' : 'error' ; $ appl -> enqueueMessage ( $ error -> get ( 'me... | Message error handler Enqueues the error message into the system queue |
6,380 | public static function handleLog ( & $ error , $ options ) { JLog :: add ( 'JError::handleLog() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; static $ log ; if ( $ log == null ) { $ options [ 'text_file' ] = date ( 'Y-m-d' ) . '.error.log' ; $ options [ 'format' ] = "{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}" ;... | Log error handler Logs the error message to a system log file |
6,381 | public static function handleCallback ( & $ error , $ options ) { JLog :: add ( 'JError::handleCallback() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; return call_user_func ( $ options , $ error ) ; } | Callback error handler - Send the error object to a callback method for error handling |
6,382 | public static function customErrorHandler ( $ level , $ msg ) { JLog :: add ( 'JError::customErrorHandler() is deprecated.' , JLog :: WARNING , 'deprecated' ) ; self :: raise ( $ level , '' , $ msg ) ; } | Display a message to the user |
6,383 | public function getDefaultStorage ( ) : ? Filesystem { $ manager = Storage :: getFacadeRoot ( ) ; if ( isset ( $ manager ) ) { return $ manager -> disk ( ) ; } return $ manager ; } | Get a default storage value if any is available |
6,384 | protected function buildEndpoint ( $ type , $ resource , $ datetime ) { $ accountType = $ this -> isSubAccount ? 'SubAccounts' : 'Accounts' ; $ sig = strtoupper ( md5 ( $ this -> accountSid . $ this -> accountToken . $ datetime ) ) ; return sprintf ( self :: ENDPOINT_TEMPLATE , self :: SERVER_IP , self :: SERVER_PORT ,... | Build endpoint url . |
6,385 | public function add ( $ field , $ op , $ value ) { $ param = new Expr ( $ field , $ op , $ value ) ; $ this -> _params [ ] = $ param ; if ( $ param -> useValue ( ) ) { $ this -> addBinding ( $ field , $ value ) ; } return $ this ; } | Process a parameter before adding it to the list . Set the primary predicate type if it has not been set . |
6,386 | public function also ( Closure $ callback ) { $ predicate = new Predicate ( self :: ALSO ) ; $ predicate -> bindCallback ( $ callback ) ; $ this -> _params [ ] = $ predicate ; $ this -> addBinding ( null , $ predicate ) ; return $ this ; } | Generate a new sub - grouped AND predicate . |
6,387 | public function between ( $ field , $ start , $ end ) { $ this -> add ( $ field , Expr :: BETWEEN , [ $ start , $ end ] ) ; return $ this ; } | Adds a between range BETWEEN expression . |
6,388 | public function bindCallback ( Closure $ callback , $ query = null ) { call_user_func_array ( $ callback , [ $ this , $ query ] ) ; return $ this ; } | Bind a Closure callback to this predicate and execute it . |
6,389 | public function either ( Closure $ callback ) { $ predicate = new Predicate ( self :: EITHER ) ; $ predicate -> bindCallback ( $ callback ) ; $ this -> _params [ ] = $ predicate ; $ this -> addBinding ( null , $ predicate ) ; return $ this ; } | Generate a new sub - grouped OR predicate . |
6,390 | public function eq ( $ field , $ value ) { if ( is_array ( $ value ) ) { $ this -> in ( $ field , $ value ) ; } else if ( $ value === null ) { $ this -> null ( $ field ) ; } else { $ this -> add ( $ field , '=' , $ value ) ; } return $ this ; } | Adds an equals = expression . |
6,391 | public function hasParam ( $ field ) { foreach ( $ this -> getParams ( ) as $ param ) { if ( $ param instanceof Expr && $ param -> getField ( ) === $ field ) { return true ; } } return false ; } | Return true if a field has been used in a param . |
6,392 | public function like ( $ field , $ value ) { $ this -> add ( $ field , Expr :: LIKE , $ value ) ; return $ this ; } | Adds a like wildcard LIKE expression . |
6,393 | public function maybe ( Closure $ callback ) { $ predicate = new Predicate ( self :: MAYBE ) ; $ predicate -> bindCallback ( $ callback ) ; $ this -> _params [ ] = $ predicate ; $ this -> addBinding ( null , $ predicate ) ; return $ this ; } | Generate a new sub - grouped XOR predicate . |
6,394 | public function neither ( Closure $ callback ) { $ predicate = new Predicate ( self :: NEITHER ) ; $ predicate -> bindCallback ( $ callback ) ; $ this -> _params [ ] = $ predicate ; $ this -> addBinding ( null , $ predicate ) ; return $ this ; } | Generate a new sub - grouped NOR predicate . |
6,395 | public function notBetween ( $ field , $ start , $ end ) { $ this -> add ( $ field , Expr :: NOT_BETWEEN , [ $ start , $ end ] ) ; return $ this ; } | Adds a not between range NOT BETWEEN expression . |
6,396 | public function notEq ( $ field , $ value ) { if ( is_array ( $ value ) ) { $ this -> notIn ( $ field , $ value ) ; } else if ( $ value === null ) { $ this -> notNull ( $ field ) ; } else { $ this -> add ( $ field , '!=' , $ value ) ; } return $ this ; } | Adds a not equals ! = expression . |
6,397 | public function notLike ( $ field , $ value ) { $ this -> add ( $ field , Expr :: NOT_LIKE , $ value ) ; return $ this ; } | Adds a not like wildcard LIKE expression . |
6,398 | public function getTimezoneHourOffset ( $ origin_tz = 'UTC' , $ format = 'h' ) { $ remote_tz = 'UTC' ; if ( $ origin_tz === 'UTC' ) { return 0 . 'h' ; } $ origin_dtz = new \ DateTimeZone ( $ origin_tz ) ; $ remote_dtz = new \ DateTimeZone ( $ remote_tz ) ; $ origin_dt = new \ DateTime ( "now" , $ origin_dtz ) ; $ remot... | Get timezone offset in hours |
6,399 | public function arrayMultiSearch ( $ needle , $ haystack ) { foreach ( $ haystack as $ key => $ data ) { if ( in_array ( $ needle , $ data ) ) { return $ key ; } } return false ; } | Find key by sub value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.