idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
50,700 | public function img ( $ email = '' , $ alt = '' , array $ attr = [ ] ) { if ( empty ( $ email ) ) { $ email = $ this -> _options [ 'email' ] ; } $ img = '<img src="' . $ this -> src ( $ email , $ attr ) . '"' ; if ( ! empty ( $ alt ) ) { $ img .= ' alt="' . $ alt . '"' ; } if ( isset ( $ attr [ 'width' ] ) ) { $ img .=... | Generates and returns the HTML image . |
50,701 | public function showAction ( Request $ request , $ access , $ id ) { $ em = $ this -> getDoctrineManager ( ) ; $ message = null ; if ( $ id instanceof Message ) { $ message = $ id ; } elseif ( is_numeric ( $ id ) ) { $ message = $ em -> getRepository ( 'BisonLabSakonninBundle:Message' ) -> find ( $ id ) ; } else { $ me... | Finds and displays a Message entity . |
50,702 | public function searchContextGetAction ( Request $ request , $ access , $ system , $ object_name , $ external_id ) { $ this -> denyAccessUnlessGranted ( 'index' , new Message ( ) ) ; $ context_conf = $ this -> container -> getParameter ( 'app.contexts' ) ; $ conf = $ context_conf [ 'BisonLabSakonninBundle' ] [ 'Message... | Lists all Messages with that context . |
50,703 | public function deleteAction ( Request $ request , $ access , Message $ message ) { $ this -> denyAccessUnlessGranted ( 'edit' , $ message ) ; $ form = $ this -> createDeleteForm ( $ message ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctr... | Deletes a message entity . |
50,704 | public function checkUnreadAction ( Request $ request , $ access ) { $ em = $ this -> getDoctrineManager ( ) ; $ sm = $ this -> container -> get ( 'sakonnin.messages' ) ; $ user = $ this -> getUser ( ) ; $ repo = $ em -> getRepository ( 'BisonLabSakonninBundle:Message' ) ; $ messages = $ sm -> getMessagesForLoggedIn ( ... | Check for unread messages |
50,705 | public function newAction ( Request $ request , $ access ) { $ message = new Message ( ) ; if ( $ message_type = $ request -> get ( 'message_type' ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ message -> setMessageType ( $ em -> getRepository ( 'BisonLabSakonninBundle:MessageType' ) -> find ( $ message_type ) ) ; }... | Creates a new person entity . |
50,706 | public function createDeleteForm ( Message $ message , $ access = "ajax" ) { $ form_name = "message_delete_" . $ message -> getId ( ) ; return $ this -> get ( 'form.factory' ) -> createNamedBuilder ( $ form_name , FormType :: class ) -> setAction ( $ this -> generateUrl ( 'message_delete' , array ( 'id' => $ message ->... | Creates a form to delete a message entity . |
50,707 | public function checkChars ( $ value ) { if ( $ value [ 0 ] == '(' ) { $ value = substr ( $ value , 1 ) ; if ( $ value [ strlen ( $ value ) - 1 ] == ')' ) { $ value = substr ( $ value , 0 , - 1 ) ; } else { return false ; } } return parent :: checkChars ( $ value ) ; } | Allows start and stop tag within checked chars |
50,708 | public function getExtension ( $ extensionName ) { if ( ! $ this -> hasExtension ( $ extensionName ) ) { $ this -> addExtension ( new $ extensionName ) ; } return $ this -> extensions [ $ extensionName ] ; } | Get the named extension create one if not injected yet |
50,709 | protected function decorateService ( $ service ) { $ extName = DecorateExtension :: EXTENSION_CLASS ; if ( $ this -> hasExtension ( $ extName ) ) { $ ext = $ this -> getExtension ( $ extName ) ; $ ext -> decorateService ( $ service ) ; } return $ this ; } | Decorate the service object if DecorateExtension loaded |
50,710 | public static function splitClassName ( $ className ) { $ chunk = explode ( '\\' , $ className ) ; $ className = array_pop ( $ chunk ) ; $ namespace = implode ( '\\' , $ chunk ) ; $ result = array ( $ namespace , $ className ) ; return $ result ; } | Split class name |
50,711 | final public function showTables ( ) { $ q = $ this -> query ( 'SHOW TABLES' ) ; $ q -> execute ( ) ; return $ q -> fetchAll ( self :: FETCH_COLUMN ) ; } | Returns an array of available database tables |
50,712 | final public function describe ( $ table ) { $ q = $ this -> query ( "DESCRIBE `{$table}`" ) ; $ q -> execute ( ) ; return $ q -> fetchAll ( self :: FETCH_COLUMN ) ; } | Describe a table |
50,713 | public function actionLogin ( array $ confirm_data , $ goto ) { $ url = 'http://hiapi.ahnames.com/verifyConfirmation?' . http_build_query ( [ 'auth_ip' => Yii :: $ app -> request -> getUserIp ( ) , 'what' => 'redirect_hipanel' , 'confirm_data' => $ confirm_data , ] ) ; $ res = Json :: decode ( file_get_contents ( $ url... | Implements login from MRDP panel . |
50,714 | public function setBreadcrumbElement ( $ element ) { if ( ! empty ( trim ( $ element ) ) && is_string ( $ element ) ) { $ this -> breadcrumbElement = trim ( $ element ) ; } return $ this ; } | Sets the main element to give to list style breadcrumb menus |
50,715 | public function setBreacrumbLinks ( $ links ) { if ( is_array ( $ links ) && ! empty ( $ links ) ) { $ this -> links = $ links ; } return $ this ; } | Sets the link to include in the breadcrumb element |
50,716 | private static function createConfiguration ( array $ config , ContainerInterface $ container = null ) { $ cache = $ config [ 'cache' ] ; if ( $ container && is_string ( $ config [ 'cache' ] ) && $ container -> has ( $ config [ 'cache' ] ) ) { $ cache = $ container -> get ( $ config [ 'cache' ] ) ; } return Setup :: cr... | Creates the ORM configuration . |
50,717 | public function get_string_from_code ( $ code ) { $ errors = [ self :: ERR_GENERAL => 'General Error' , self :: ERR_BAD_REQUEST => 'Bad Request' , self :: ERR_UNAUTHORIZED => 'Unauthorized' , self :: ERR_FORBIDDEN => 'Forbidden' , self :: ERR_INTERNAL_ERROR => 'Internal Error' , self :: ERR_PRECONDITION_FAILED => 'Prec... | Translate an error code into a human - readable string explaining the problem . |
50,718 | private function setClientFilename ( $ clientFilename ) { if ( preg_match ( '`[/\\]+`' , $ clientFilename ) > 0 ) { throw new \ InvalidArgumentException ( 'Filename contain invalid character "\" or "/" in his name.' ) ; } $ this -> clientFilename = ( empty ( $ clientFilename ) ? null : ( string ) $ clientFilename ) ; r... | Set client filename . |
50,719 | private function setSize ( $ size = null ) { if ( $ size !== null ) { $ size = ( int ) $ size ; if ( $ size < 0 ) { throw new \ RuntimeException ( 'File size cannot be a negative value ! (size: ' . $ size . ')' ) ; } } $ this -> size = $ size ; return $ this ; } | Set file size |
50,720 | public function getDefault ( $ key ) { $ schema = $ this -> getModelSchema ( ) ; if ( array_key_exists ( 'default' , $ schema [ $ key ] ) ) return $ schema [ $ key ] [ 'default' ] ; return null ; } | Returns the default value of the field . |
50,721 | public function getFieldTitle ( $ key ) { $ schema = $ this -> getModelSchema ( ) ; if ( array_key_exists ( 'title' , $ schema [ $ key ] ) ) return $ schema [ $ key ] [ 'title' ] ; return $ key ; } | Returns the field title . |
50,722 | public function getValidation ( $ field = null ) { $ validation = array ( ) ; $ schema = $ this -> getModelSchema ( ) ; if ( $ field != null ) $ schema = array ( $ field => $ schema [ $ field ] ) ; foreach ( $ schema as $ key => $ value ) { if ( ! isset ( $ value [ 'validation' ] ) ) throw new Exception ( 'Validation m... | Returns the model schema which we ll use for validation |
50,723 | public function append ( ) { $ args = func_get_args ( ) ; foreach ( $ args as $ arg ) { if ( $ arg instanceof Element ) { if ( $ arg -> _used ) { continue ; } $ arg -> _used = true ; } $ this -> _html [ ] = $ arg ; } } | Append content or other elements . |
50,724 | protected function outputOpeningTag ( ) { echo '<' , htmlspecialchars ( $ this -> _tag ) ; foreach ( $ this -> _attributes as $ name => $ value ) { echo ' ' , htmlspecialchars ( $ name ) , '="' , htmlspecialchars ( $ value ) , '"' ; } echo '>' ; if ( $ this -> _tag == 'html' || $ this -> _tag == 'head' || $ this -> _ta... | Output opening HTML . |
50,725 | protected function outputContent ( ) { foreach ( $ this -> _html as $ part ) { if ( $ part instanceof Element ) { $ part -> output ( ) ; } else { echo $ part ; } } } | Output inner HTML . |
50,726 | protected function outputClosingTag ( ) { echo '</' , htmlspecialchars ( $ this -> _tag ) , '>' ; if ( $ this -> _tag == 'html' || $ this -> _tag == 'head' || $ this -> _tag == 'body' ) { echo "\n" ; } } | Output closing HTML . |
50,727 | public function validate ( $ value ) { return in_array ( $ value , $ this -> choices ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: INVALID_CHOICE ] ) ; } | Tells if a given value is a valid choice according to the property s definition . |
50,728 | public function tags ( Tags $ tags = null ) { if ( is_null ( $ tags ) ) { return $ this -> tags ; } $ this -> tags = $ tags ; return $ this ; } | This needs a tag collection . |
50,729 | protected function getEventPriority ( $ eventName ) { $ suffix = $ this -> getEventSuffix ( $ eventName ) ; if ( $ suffix === static :: UPDATE ) { return 9999 ; } elseif ( $ suffix === static :: INSERT ) { return 9998 ; } elseif ( $ suffix === static :: DELETE ) { return 9997 ; } return parent :: getEventPriority ( $ e... | Returns the event priority . |
50,730 | public static function getMimeType ( $ filename ) { $ mime_types = static :: getMimeTypes ( ) ; $ extension = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; $ extension = strtolower ( $ extension ) ; if ( array_key_exists ( $ extension , $ mime_types ) ) { return $ mime_types [ $ extension ] ; } elseif ( function_exist... | Get the mime - type of a file |
50,731 | public function addTaxAmount ( TaxAmount $ taxAmount ) { $ this -> total += $ taxAmount -> getAmount ( ) ; foreach ( $ this -> taxes as $ tax ) { if ( $ tax -> getTax ( ) == $ taxAmount -> getTax ( ) ) { $ tax -> addAmount ( $ taxAmount -> getAmount ( ) ) ; return ; } } $ this -> taxes [ ] = $ taxAmount ; } | Adds a tax amount |
50,732 | public function bind ( ViewModelInterface $ model ) { $ this -> scoped [ '@file' ] = $ model -> getResource ( ) ; $ this -> scoped [ '@model' ] = $ this -> model = $ model ; $ this -> scoped [ '@context' ] = $ this ; $ this -> renderer -> triggerContextBound ( $ this ) ; } | Bind this express context to the given view model triggering a context - bound event in the process . |
50,733 | public function get ( $ key ) { if ( array_key_exists ( $ key , $ this -> scoped ) ) { return $ this -> scoped [ $ key ] ; } return $ this -> model -> get ( $ key , NULL ) ; } | Get the value of a scoped variable or fallback to the view model . |
50,734 | public function set ( $ key , $ value ) { if ( array_key_exists ( $ key , $ this -> scoped ) ) { $ val = $ this -> scoped [ $ key ] ; if ( $ value === NULL ) { unset ( $ this -> scoped [ $ key ] ) ; } else { $ this -> scoped [ $ key ] = $ value ; } return $ val ; } if ( $ value !== NULL ) { $ this -> scoped [ $ key ] =... | Set the given variable in the scope and return the previous value if present setting a value of NULL will remove the value from the context . |
50,735 | protected function processStatistics ( $ query = null ) { $ this -> skips = 0 ; $ this -> success = 0 ; $ this -> failures = 0 ; $ this -> noops = 0 ; $ reports = $ this -> getReportService ( ) -> getAllForToday ( $ query ) ; foreach ( $ reports as $ report ) { if ( $ report -> getStatus ( ) == Model \ ReportInterface ... | Browse all reports and process all the statistics |
50,736 | public function curlGETauth ( $ curlUrl ) { if ( ! isset ( $ this -> auth ) ) { $ this -> authenticate ( ) ; } $ results = $ this -> curlGET ( $ curlUrl , true ) ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: curlGETauth' , 1 ) ; return $ results ; } | cURL GET with authentication |
50,737 | public function curlPOSTauth ( $ curlUrl , $ post ) { if ( ! isset ( $ this -> auth ) ) { $ this -> authenticate ( ) ; } $ results = $ this -> curlPOST ( $ curlUrl , $ post , true ) ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: curlPOSTauth' , 1 ) ; return $ results ; } | cURL POSTs with authentication |
50,738 | public function curlDELETEauth ( $ curlUrl ) { if ( ! isset ( $ this -> auth ) ) { $ this -> authenticate ( ) ; } $ results = $ this -> curlDELETE ( $ curlUrl , true ) ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: curlDELETEauth' , 1 ) ; return $ results ; } | cURL DELETE with authentication |
50,739 | private function authenticate ( ) { $ dsDrupalAPIConfig = $ this -> mbConfig -> getProperty ( 'ds_drupal_api_config' ) ; if ( ! empty ( $ dsDrupalAPIConfig [ 'username' ] ) && ! empty ( $ dsDrupalAPIConfig [ 'password' ] ) ) { $ post = [ 'username' => $ dsDrupalAPIConfig [ 'username' ] , 'password' => $ dsDrupalAPIConf... | Authenticate for Drupal API access |
50,740 | public function buildcURL ( $ settings ) { if ( isset ( $ settings [ 'host' ] ) ) { $ curlUrl = $ settings [ 'host' ] ; $ port = $ settings [ 'port' ] ; if ( $ port > 0 && is_numeric ( $ port ) ) { $ curlUrl .= ':' . ( int ) $ port ; } $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: buildcURL' , 1 ) ; retu... | buildURL - Common construction utility for URLs of API paths . |
50,741 | private function isNorthstar ( $ northstarConfig , $ curlUrl ) { if ( empty ( $ northstarConfig [ 'host' ] ) ) { $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: isNorthstar false' , 1 ) ; return false ; } if ( empty ( $ northstarConfig [ 'id' ] ) ) { $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_c... | Test if the Northstar configuration settings are valid and the cURL is for Northstar . |
50,742 | public function create ( $ table , Closure $ closure ) { $ blueprint = $ this -> createBlueprint ( $ table , $ closure ) ; $ blueprint -> create ( ) ; } | Creates table from migration . |
50,743 | public function update ( $ table , Closure $ closure ) { $ blueprint = $ this -> createBlueprint ( $ table , $ closure ) ; $ blueprint -> update ( ) ; } | updates table from migration . |
50,744 | private function seedAdminUser ( ) { tap ( new User ( $ this -> getAdminUserAttributes ( ) ) , function ( User $ admin ) { $ admin -> save ( ) ; $ adminRole = Role :: admin ( ) -> first ( ) ; $ adminRole -> attachUser ( $ admin ) ; } ) ; } | Seed the admin account . |
50,745 | private function getAdminUserAttributes ( ) { $ attributes = [ 'username' => 'admin' , 'first_name' => 'Super' , 'last_name' => 'ADMIN' , 'email' => env ( 'ADMIN_EMAIL' , 'admin@example.com' ) , 'password' => env ( 'ADMIN_PASSWORD' , 'password' ) , 'is_admin' => true , 'activated_at' => $ now = now ( ) , ] ; if ( UserC... | Get the admin user s attributes . |
50,746 | protected function sendThroughPipeline ( array $ middleware , \ Closure $ then ) { if ( count ( $ middleware ) > 0 ) { return ( new Pipeline ( $ this ) ) -> send ( $ this ) -> through ( $ middleware ) -> then ( $ then ) ; } return $ then ( ) ; } | Send the request through the pipeline with the given callback . |
50,747 | public function get ( $ name , $ type = self :: TYPE_GET , $ default = null ) { return ( isset ( $ this -> vars [ $ type ] ) && isset ( $ this -> vars [ $ type ] [ $ name ] ) ) ? $ this -> vars [ $ type ] [ $ name ] : $ default ; } | This method return request value |
50,748 | public function xmlRequest ( $ url = '' , $ data = '' , $ timeout = 60 ) { $ this -> debug -> debug ( __FUNCTION__ , '/---------- . __FUNCTION__ . ' <------------\\' ) ; $ inputParams = [ 'url' => $ url , 'data' => $ data , 'timeout' => $ timeout , ] ; $ this -> debug -> info ( __FUNCTION__ , 'input Params: ' , $ input... | Function xmlRequest Send XML Request to Server |
50,749 | public function decode ( $ assoc = false , $ depth = 512 , $ options = 0 ) { return json_decode ( $ this -> content , $ assoc , $ depth , $ options ) ; } | Decodes the given JSON string |
50,750 | protected function createBitbucketDriver ( ) { $ config = $ this -> app [ 'config' ] [ 'services.bitbucket' ] ; return new BitbucketProvider ( $ this -> app [ 'request' ] , new BitbucketServer ( $ this -> formatConfig ( $ config ) ) ) ; } | Create an instance of Bitbucket driver . |
50,751 | public function addFile ( $ file ) { $ baseName = basename ( $ file , '.php' ) ; $ components = explode ( '.' , $ baseName ) ; $ language = $ components [ 1 ] ; $ data = require ( $ file ) ; $ this -> add ( $ data , $ language ) ; } | Add translation file content |
50,752 | private function add ( $ data , $ language ) { $ parts = explode ( '-' , $ language ) ; foreach ( $ data as $ key => $ translation ) { if ( count ( $ parts ) == 1 ) { $ this -> translations [ $ language ] [ $ key ] = $ translation ; } elseif ( count ( $ parts ) == 2 ) { $ this -> translations [ $ parts [ 0 ] ] [ $ part... | Add translation data for a language |
50,753 | public static function getParserByKey ( $ key ) { switch ( strtolower ( $ key ) ) { case "twig" : return new TwigTemplateParser ( ) ; default : if ( isset ( self :: $ customParsers [ $ key ] ) ) return self :: $ customParsers [ $ key ] ; else return new MustacheTemplateParser ( ) ; } } | Get a view parser by key . |
50,754 | public static function start ( ) { if ( is_null ( self :: $ _transaction ) ) { $ object = self :: $ _transaction = new self ( ) ; $ object -> _stored = Config :: getDataAdapter ( ) ; Config :: setDataAdapter ( $ object ) ; $ result = true ; } else { $ result = false ; } return $ result ; } | Start transaction and save current config adapter |
50,755 | private static function _stop ( ) { $ adapter = self :: $ _transaction -> _stored ; if ( is_null ( $ adapter ) ) { Config :: clearDataAdapter ( ) ; } else { Config :: setDataAdapter ( $ adapter ) ; } } | Restore old data adapter |
50,756 | public function cmdGetConfig ( ) { $ result = $ this -> getListConfig ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableConfig ( $ result ) ; $ this -> output ( ) ; } | Callback for config - get command |
50,757 | protected function getListConfig ( ) { $ name = $ this -> getParam ( 0 ) ; if ( isset ( $ name ) ) { $ result = $ this -> config -> get ( $ name ) ; if ( ! isset ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ list = array ( $ name => $ result ) ; } else { $ list = $ this -> conf... | Returns an array of configurations |
50,758 | public function cmdDeleteConfig ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } if ( ! $ this -> config -> reset ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; } | Callback for config - delete command |
50,759 | public function cmdSetConfig ( ) { $ key = $ this -> getParam ( 0 ) ; $ value = $ this -> getParam ( 1 ) ; if ( ! isset ( $ key ) || ! isset ( $ value ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! $ this -> config -> set ( $ key , $ value ) ) { $ this -> errorAndExit ( $ this -> text ... | Callback for config - set command |
50,760 | protected function doExecute ( \ Closure $ cb ) { try { return $ cb ( $ this -> manager , $ this -> collection ) ; } catch ( \ Exception $ e ) { throw Exception \ Translator \ MongoDb :: translate ( $ e ) ; } } | Executes something in the context of the collection . |
50,761 | public function insertLog ( $ idObject = "" , $ objJson = "" , $ idFunzione = "" , $ dettagli = "" ) { $ intranetLogApp = new IntranetLogApp ( ) ; $ intranetLogApp -> setDettagli ( $ dettagli ) ; if ( ! empty ( $ idFunzione ) ) { $ repository = $ this -> em -> getRepository ( 'retItaliaAuthenticationBundle:SaFunzione' ... | Questa funzione inserisce una nuova occorrenza nel file di log |
50,762 | public function initC2Ms ( $ overrideExisting = true ) { if ( null !== $ this -> collC2Ms && ! $ overrideExisting ) { return ; } $ collectionClassName = C2MTableMap :: getTableMap ( ) -> getCollectionClassName ( ) ; $ this -> collC2Ms = new $ collectionClassName ; $ this -> collC2Ms -> setModel ( '\Attogram\SharedMedia... | Initializes the collC2Ms collection . |
50,763 | public function countC2Ms ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collC2MsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collC2Ms || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collC2Ms ) { return ... | Returns the number of related C2M objects . |
50,764 | public function addC2M ( ChildC2M $ l ) { if ( $ this -> collC2Ms === null ) { $ this -> initC2Ms ( ) ; $ this -> collC2MsPartial = true ; } if ( ! $ this -> collC2Ms -> contains ( $ l ) ) { $ this -> doAddC2M ( $ l ) ; if ( $ this -> c2MsScheduledForDeletion and $ this -> c2MsScheduledForDeletion -> contains ( $ l ) )... | Method called to associate a ChildC2M object to this object through the ChildC2M foreign key attribute . |
50,765 | public function getC2MsJoinMedia ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildC2MQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'Media' , $ joinBehavior ) ; return $ this -> getC2Ms ( $ query , $ con ) ; } | If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Category is new it will return an empty collection ; or if this Category has previously been saved it will retrieve related C2Ms from storage . |
50,766 | public function countC2Ps ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collC2PsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collC2Ps || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collC2Ps ) { return ... | Returns the number of related C2P objects . |
50,767 | public function getC2PsJoinPage ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildC2PQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'Page' , $ joinBehavior ) ; return $ this -> getC2Ps ( $ query , $ con ) ; } | If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Category is new it will return an empty collection ; or if this Category has previously been saved it will retrieve related C2Ps from storage . |
50,768 | public function makeRoot ( ) { if ( $ this -> getLeftValue ( ) || $ this -> getRightValue ( ) ) { throw new PropelException ( 'Cannot turn an existing node into a root node.' ) ; } $ this -> setLeftValue ( 1 ) ; $ this -> setRightValue ( 2 ) ; $ this -> setLevel ( 0 ) ; return $ this ; } | Creates the supplied node as the root node . |
50,769 | public function isDescendantOf ( ChildCategory $ parent ) { return $ this -> isInTree ( ) && $ this -> getLeftValue ( ) > $ parent -> getLeftValue ( ) && $ this -> getRightValue ( ) < $ parent -> getRightValue ( ) ; } | Tests if node is a descendant of another node |
50,770 | public function getParent ( ConnectionInterface $ con = null ) { if ( null === $ this -> aNestedSetParent && $ this -> hasParent ( ) ) { $ this -> aNestedSetParent = ChildCategoryQuery :: create ( ) -> ancestorsOf ( $ this ) -> orderByLevel ( true ) -> findOne ( $ con ) ; } return $ this -> aNestedSetParent ; } | Gets parent node for the current object if it exists The result is cached so further calls to the same method don t issue any queries |
50,771 | public function hasPrevSibling ( ConnectionInterface $ con = null ) { if ( ! ChildCategoryQuery :: isValid ( $ this ) ) { return false ; } return ChildCategoryQuery :: create ( ) -> filterByTreeRight ( $ this -> getLeftValue ( ) - 1 ) -> exists ( $ con ) ; } | Determines if the node has previous sibling |
50,772 | public function getPrevSibling ( ConnectionInterface $ con = null ) { return ChildCategoryQuery :: create ( ) -> filterByTreeRight ( $ this -> getLeftValue ( ) - 1 ) -> findOne ( $ con ) ; } | Gets previous sibling for the given node if it exists |
50,773 | public function hasNextSibling ( ConnectionInterface $ con = null ) { if ( ! ChildCategoryQuery :: isValid ( $ this ) ) { return false ; } return ChildCategoryQuery :: create ( ) -> filterByTreeLeft ( $ this -> getRightValue ( ) + 1 ) -> exists ( $ con ) ; } | Determines if the node has next sibling |
50,774 | public function getNextSibling ( ConnectionInterface $ con = null ) { return ChildCategoryQuery :: create ( ) -> filterByTreeLeft ( $ this -> getRightValue ( ) + 1 ) -> findOne ( $ con ) ; } | Gets next sibling for the given node if it exists |
50,775 | public function getChildren ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( null === $ this -> collNestedSetChildren || null !== $ criteria ) { if ( $ this -> isLeaf ( ) || ( $ this -> isNew ( ) && null === $ this -> collNestedSetChildren ) ) { $ this -> initNestedSetChildren ( ) ; } else { $ c... | Gets the children of the given node |
50,776 | public function countChildren ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( null === $ this -> collNestedSetChildren || null !== $ criteria ) { if ( $ this -> isLeaf ( ) || ( $ this -> isNew ( ) && null === $ this -> collNestedSetChildren ) ) { return 0 ; } else { return ChildCategoryQuery ::... | Gets number of children for the given node |
50,777 | public function getFirstChild ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( $ this -> isLeaf ( ) ) { return null ; } else { return ChildCategoryQuery :: create ( null , $ criteria ) -> childrenOf ( $ this ) -> orderByBranch ( ) -> findOne ( $ con ) ; } } | Gets the first child of the given node |
50,778 | public function getSiblings ( $ includeNode = false , Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( $ this -> isRoot ( ) ) { return array ( ) ; } else { $ query = ChildCategoryQuery :: create ( null , $ criteria ) -> childrenOf ( $ this -> getParent ( $ con ) ) -> orderByBranch ( ) ; if ( ! $ i... | Gets the siblings of the given node |
50,779 | public function getDescendants ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( $ this -> isLeaf ( ) ) { return array ( ) ; } else { return ChildCategoryQuery :: create ( null , $ criteria ) -> descendantsOf ( $ this ) -> orderByBranch ( ) -> find ( $ con ) ; } } | Gets descendants for the given node |
50,780 | public function countDescendants ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( $ this -> isLeaf ( ) ) { return 0 ; } else { return ChildCategoryQuery :: create ( null , $ criteria ) -> descendantsOf ( $ this ) -> count ( $ con ) ; } } | Gets number of descendants for the given node |
50,781 | public function getBranch ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { return ChildCategoryQuery :: create ( null , $ criteria ) -> branchOf ( $ this ) -> orderByBranch ( ) -> find ( $ con ) ; } | Gets descendants for the given node plus the current node |
50,782 | public function getAncestors ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { if ( $ this -> isRoot ( ) ) { return array ( ) ; } else { return ChildCategoryQuery :: create ( null , $ criteria ) -> ancestorsOf ( $ this ) -> orderByBranch ( ) -> find ( $ con ) ; } } | Gets ancestors for the given node starting with the root node Use it for breadcrumb paths for instance |
50,783 | protected function assignOriginalArguments ( ) { $ originalRequest = $ this -> request -> getOriginalRequest ( ) ; if ( ! empty ( $ originalRequest ) ) { $ originalArguments = $ originalRequest -> getArguments ( ) ; $ this -> view -> assign ( 'originalArguments' , $ originalArguments ) ; } } | Assigns the arguments from the original request . |
50,784 | public function setDescription ( $ text , $ length = 80 ) { $ description = array ( ) ; $ split = str_split ( $ text , $ length ) ; array_walk ( $ split , function ( $ value ) use ( & $ description ) { $ description [ ] = $ value ; } ) ; $ this -> description = $ description ; return $ this ; } | Set description at top of docblock |
50,785 | public function addVar ( $ name , $ type = '' , $ description = '' ) { $ this -> var_types [ $ name ] = $ type == '' ? $ type : $ type . ' ' ; $ this -> var_descriptions [ $ name ] = $ description ; return $ this ; } | Add a var on a docblock |
50,786 | public static function convertDate ( $ sourceFormat , $ targetFormat , $ value ) { $ dateObject = date_create_from_format ( $ sourceFormat , $ value ) ; if ( $ dateObject ) { return $ dateObject -> format ( $ targetFormat ) ; } else { return null ; } } | Convert a date from one format to another |
50,787 | public static function convertSecondsToElapsedTime ( $ seconds ) { $ hours = floor ( $ seconds / 3600 ) ; $ remainder = $ seconds - ( $ hours * 3600 ) ; $ minutes = floor ( $ remainder / 60 ) ; $ seconds = round ( $ remainder - ( $ minutes * 60 ) ) ; return sprintf ( "%02d" , $ hours ) . ":" . sprintf ( "%02d" , $ minu... | Convert seconds to an elapsed time value |
50,788 | protected function getCurrentInstance ( ) { $ instance = $ this -> getRequest ( ) -> getSession ( ) -> get ( 'instance' ) ; if ( $ instance ) { $ instance = $ this -> getManager ( ) -> find ( $ instance -> getId ( ) ) ; } return $ instance ; } | Get the current instance if exists |
50,789 | protected function getWorker ( ) { $ instance = $ this -> getCurrentInstance ( ) ; if ( $ instance ) { $ worker = $ this -> get ( 'ringo_php_redmon.instance_worker' ) -> setInstance ( $ instance ) ; if ( $ worker -> ping ( ) ) { return $ worker ; } $ this -> getRequest ( ) -> getSession ( ) -> set ( 'instance' , null )... | Get instance worker initialized with current instance |
50,790 | public function getConfig ( $ refresh = false ) { return $ this -> getCache ( 'plugins-config' , $ refresh , function ( ) { return [ 'wei' => [ 'aliases' => $ this -> getWeiAliases ( ) , ] , 'app' => [ 'controllerMap' => $ this -> getAppControllerMap ( ) , ] , 'plugin' => [ 'pluginClasses' => $ this -> getPluginClasses... | Receive plugin relatives service configs |
50,791 | protected function getPluginClasses ( $ refresh = false ) { if ( $ refresh || ! $ this -> pluginClasses ) { $ this -> pluginClasses = [ ] ; $ files = $ this -> globByDirs ( $ this -> dirs , '/Plugin.php' ) ; foreach ( $ files as $ file ) { $ class = $ this -> guessClassName ( $ file ) ; $ name = explode ( '\\' , $ clas... | Get all plugin classes |
50,792 | public function parseResource ( $ resource ) { $ pluginId = $ file = null ; if ( isset ( $ resource [ 0 ] ) && $ resource [ 0 ] == '@' ) { list ( $ pluginId , $ file ) = explode ( '/' , $ resource , 2 ) ; $ pluginId = substr ( $ pluginId , 1 ) ; } if ( strpos ( $ resource , ':' ) !== false ) { wei ( ) -> logger -> warn... | Parse a resource and return the components contains path and file |
50,793 | public function install ( $ id ) { $ plugin = $ this -> getById ( $ id ) ; if ( ! $ plugin ) { return [ 'code' => - 1 , 'message' => 'Plugin not found' ] ; } if ( $ this -> isInstalled ( $ id ) ) { return [ 'code' => - 2 , 'message' => 'Plugin has been installed' ] ; } $ ret = $ plugin -> install ( ) ; if ( $ ret [ 'co... | Install a plugin by ID |
50,794 | public function uninstall ( $ id ) { $ plugin = $ this -> getById ( $ id ) ; if ( ! $ plugin ) { return [ 'code' => - 3 , 'message' => 'Plugin not found' ] ; } if ( ! $ this -> isInstalled ( $ id ) ) { return [ 'code' => - 4 , 'message' => 'Plugin not installed' ] ; } if ( $ this -> isBuildIn ( $ id ) ) { return [ 'cod... | Uninstall a plugin by ID |
50,795 | protected function getPluginClass ( $ id ) { return isset ( $ this -> pluginClasses [ $ id ] ) ? $ this -> pluginClasses [ $ id ] : null ; } | Returns the plugin class by plugin ID |
50,796 | protected function getEventsById ( $ id ) { $ events = [ ] ; $ methods = get_class_methods ( $ this -> getPluginClass ( $ id ) ) ; foreach ( $ methods as $ method ) { if ( substr ( $ method , 0 , 2 ) != 'on' ) { continue ; } $ event = lcfirst ( substr ( $ method , 2 ) ) ; if ( is_numeric ( substr ( $ event , - 1 ) ) ) ... | Returns the event definitions by plugin ID |
50,797 | public function loadEvent ( $ name ) { if ( isset ( $ this -> loadedEvents [ $ name ] ) ) { return ; } $ this -> loadedEvents [ $ name ] = true ; $ events = $ this -> getEvents ( ) ; if ( ! isset ( $ events [ $ name ] ) ) { return ; } $ baseMethod = 'on' . ucfirst ( $ name ) ; foreach ( $ events [ $ name ] as $ priorit... | Load plugin event by name |
50,798 | public function generateClassMap ( array $ dirs , $ pattern , $ type , $ ignoreProject = true ) { $ patterns = ( array ) $ pattern ; $ types = ( array ) $ type ; $ map = [ ] ; foreach ( $ patterns as $ i => $ pattern ) { $ files = $ this -> globByDirs ( $ dirs , $ pattern ) ; foreach ( $ files as $ file ) { $ class = $... | Generate class map |
50,799 | protected function guessClassName ( $ file , $ ignoreProject = false ) { if ( $ file [ 0 ] === '.' ) { $ file = '\\' . ltrim ( $ file , './' ) ; } list ( $ dir , $ className ) = explode ( 'src/' , $ file ) ; if ( $ dir == '\\' ) { $ dir = '' ; } $ composerJson = ( $ dir ? ( $ dir . '/' ) : '' ) . 'composer.json' ; if (... | Guest class name by file name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.