idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
14,100 | public function get ( $ coord ) { $ coord = rad2deg ( $ coord ) ; $ degrees = ( integer ) $ coord ; $ compass = '' ; if ( $ this -> direction == N :: LAT ) { if ( $ degrees < 0 ) $ compass = 'S' ; elseif ( $ degrees > 0 ) $ compass = 'N' ; } elseif ( $ this -> direction == N :: LONG ) { if ( $ degrees < 0 ) $ compass =... | Get a string representation of the coordinate in DMS notation |
14,101 | protected function convertRow ( array $ row , Connection $ connection , Table $ table ) { $ result = [ ] ; foreach ( $ row as $ key => $ value ) { $ type = $ table -> getColumn ( $ key ) -> getType ( ) ; $ val = $ type -> convertToPHPValue ( $ value , $ connection -> getDatabasePlatform ( ) ) ; if ( $ type instanceof T... | Converts a raw database row to the correct PHP types |
14,102 | public static function renderStatic ( array $ arguments , \ Closure $ renderChildrenClosure , RenderingContextInterface $ renderingContext ) : string { $ key = $ arguments [ 'key' ] ; $ value = $ arguments [ 'value' ] ; array_push ( $ GLOBALS [ 'TSFE' ] -> registerStack , $ GLOBALS [ 'TSFE' ] -> register ) ; $ GLOBALS ... | Renders the viewhelper . |
14,103 | public function guessParser ( $ coord ) { if ( ! is_numeric ( $ coord ) and ! is_null ( $ coord ) ) { return new C \ DmsParser ; } return new C \ DecimalParser ; } | Guess the correct parser for a given coordinate |
14,104 | public function Master ( ) { if ( Translatable :: get_current_locale ( ) != Translatable :: default_locale ( ) ) { if ( $ master = $ this -> owner -> getTranslation ( Translatable :: default_locale ( ) ) ) { return $ master ; } } return $ this -> owner ; } | Get the translation master of this page |
14,105 | public static function create ( $ term , $ taxonomy = null ) { if ( is_string ( $ term ) && class_exists ( $ term ) ) { return new $ term ; } if ( ! is_object ( $ term ) ) { $ term = get_term ( $ term , $ taxonomy ) ; } $ class = str_replace ( ' ' , '' , ucwords ( str_replace ( Base :: SEPARATOR , ' ' , $ term -> taxon... | Create an instance based on a term object This basically autoloads the meta data |
14,106 | public static function createMultiple ( $ terms , $ taxonomy = null ) { if ( ! Arr :: iterable ( $ terms ) ) { return $ terms ; } $ out = array ( ) ; foreach ( $ terms as $ term ) { $ instance = self :: create ( $ term , $ taxonomy ) ; $ out [ $ instance -> get ( 'term_id' ) ] = $ instance ; } return $ out ; } | Create multiple instances based on term objects This basically autoloads the meta data |
14,107 | public function signupUpdate ( Request $ request ) { $ this -> middleware ( 'auth:api' ) ; $ data = $ request -> all ( ) ; $ validator = Validator :: make ( $ data , [ 'firstname' => 'sometimes|required|max:255' , 'surname' => 'sometimes|required|max:255' , 'email' => 'sometimes|required|email|max:255|unique:users' , '... | Update user signup instance . |
14,108 | public static function encode ( $ value , $ options = 0 , $ depth = 512 ) { $ options |= JSON_UNESCAPED_UNICODE ; $ data = version_compare ( PHP_VERSION , '5.5.0' , '>=' ) ? json_encode ( $ value , $ options , $ depth ) : json_encode ( $ value , $ options ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { return $ da... | PHP > = 5 . 3 JSON_UNESCAPED_UNICODE constant supported |
14,109 | public static function getExtensionConfig ( ) : array { $ supportedMimeTypes = self :: DEFAULT_SUPPORTED_MIME_TYPES ; $ desktopWidth = self :: DEFAULT_DESKTOP_WIDTH ; $ tabletWidth = self :: DEFAULT_TABLET_WIDTH ; $ smartphoneWidth = self :: DEFAULT_SMARTPHONE_WIDTH ; if ( isset ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXT... | Returns extension management configuration as array . |
14,110 | public static function load ( $ class ) { $ instance = new $ class ; $ taxonomy_key = $ instance -> getTaxonomyKey ( ) ; if ( is_admin ( ) ) { add_action ( sprintf ( 'created_%s' , $ taxonomy_key ) , array ( $ instance , 'addSaveHooks' ) ) ; add_action ( sprintf ( 'edited_%s' , $ taxonomy_key ) , array ( $ instance , '... | Load a term |
14,111 | private function calculateHash ( ) { $ hashType = $ this -> getHashType ( ) ; if ( $ hashType == 'sign' ) { throw new InvalidResponseException ( 'Control sign forming method "SIGN" is not supported' ) ; } elseif ( $ hashType == null ) { throw new InvalidResponseException ( 'Invalid signature type' ) ; } return strtoupp... | Calculate hash to verify transaction details . |
14,112 | public function load ( $ id , $ load_terms = true ) { $ info = ( is_object ( $ id ) ) ? $ id : get_post ( $ id ) ; if ( ! is_object ( $ info ) ) { return false ; } if ( isset ( $ info -> post_title ) && preg_match ( '/[&]{1,}/' , $ info -> post_title ) ) { $ info -> post_title = html_entity_decode ( $ info -> post_titl... | Load a post by ID |
14,113 | public function loadTerms ( ) { $ taxonomy_keys = $ this -> getTaxonomyKeys ( ) ; if ( ! Arr :: iterable ( $ taxonomy_keys ) ) { return false ; } $ taxonomies_subclasses = array ( ) ; $ subclasses = Term \ Loader :: getSubclasses ( ) ; foreach ( $ subclasses as $ subclass ) { $ term_instance = new $ subclass ; $ term_i... | Load the terms |
14,114 | public function getDefaults ( ) { global $ user ; return array ( 'post_type' => $ this -> getPostType ( ) , 'post_author' => ( is_object ( $ user ) ) ? $ user -> ID : null , 'post_date' => current_time ( 'mysql' ) , 'post_category' => array ( 0 ) , 'post_status' => 'publish' ) ; } | Get default values Override this |
14,115 | public function registerPostType ( ) { $ config = $ this -> getPostTypeConfig ( ) ; if ( empty ( $ config ) ) { return ; } register_post_type ( $ this -> getPostType ( ) , $ config ) ; } | Register the post type Override this if you need to |
14,116 | public function getTaxonomy ( $ key ) { $ taxonomies = $ this -> getTaxonomies ( ) ; if ( ! Arr :: iterable ( $ taxonomies ) ) { return false ; } $ taxonomy = ( array_key_exists ( $ key , $ taxonomies ) ) ? $ taxonomies [ $ key ] : false ; if ( ! $ taxonomy ) { return false ; } if ( is_string ( $ taxonomy ) ) { $ taxon... | Get a taxonomy by name |
14,117 | public function getTaxonomyKeys ( ) { $ taxonomies = $ this -> getTaxonomies ( ) ; if ( ! Arr :: iterable ( $ taxonomies ) ) { return array ( ) ; } $ out = array ( ) ; foreach ( $ taxonomies as $ k => $ taxonomy ) { $ taxonomy = $ this -> getTaxonomy ( $ k ) ; $ out [ ] = $ this -> getTaxonomyKey ( $ k , $ taxonomy ) ;... | Get the taxonomy keys |
14,118 | public function getTaxonomyKey ( $ key , $ taxonomy = array ( ) ) { if ( is_string ( $ key ) ) { return $ key ; } if ( is_array ( $ taxonomy ) && array_key_exists ( 'label' , $ taxonomy ) ) { return Str :: machine ( $ taxonomy [ 'label' ] , Base :: SEPARATOR ) ; } return $ key ; } | Get a taxonomy key |
14,119 | public function getTaxonomiesInfo ( ) { $ taxonomies = $ this -> getTaxonomies ( ) ; if ( ! Arr :: iterable ( $ taxonomies ) ) { return array ( ) ; } $ out = array ( ) ; foreach ( $ taxonomies as $ k => $ taxonomy ) { $ taxonomy = $ this -> getTaxonomy ( $ k ) ; $ key = $ this -> getTaxonomyKey ( $ k , $ taxonomy ) ; $... | Get the taxonomy info |
14,120 | public function getPostTypeConfig ( ) { if ( in_array ( $ this -> getPostType ( ) , array ( 'post' , 'page' ) ) ) { return null ; } return array ( 'labels' => array ( 'name' => _x ( $ this -> getPlural ( ) , 'post type general name' ) , 'singular_name' => _x ( $ this -> getSingular ( ) , 'post type singular name' ) , '... | Get the post type config |
14,121 | public function getMenuIcon ( ) { $ reflector = new \ ReflectionClass ( get_called_class ( ) ) ; $ dir = basename ( dirname ( $ reflector -> getFileName ( ) ) ) ; $ post_type = $ this -> getPostType ( ) ; $ fnames = array ( $ post_type . '.png' , $ post_type . '.gif' , $ post_type . '.jpg' ) ; foreach ( $ fnames as $ f... | Get the menu icon |
14,122 | public function sortAdminColumns ( $ vars ) { if ( ! isset ( $ vars [ 'orderby' ] ) ) { return $ vars ; } $ admin_columns = $ this -> getAdminColumns ( ) ; if ( ! Arr :: iterable ( $ admin_columns ) ) { return $ vars ; } foreach ( $ admin_columns as $ k ) { if ( $ vars [ 'orderby' ] !== $ k ) { continue ; } $ vars = ar... | Sort the admin columns if necessary |
14,123 | public function makeAdminTaxonomyColumnsSortable ( $ clauses , $ wp_query ) { global $ wpdb ; if ( ! array_key_exists ( 'orderby' , $ wp_query -> query ) ) { return $ clauses ; } if ( $ wp_query -> query [ 'orderby' ] !== 'meta_value' ) { return $ clauses ; } if ( ! array_key_exists ( 'meta_key' , $ wp_query -> query )... | Make the admin taxonomy columns sortable Admittedly this is a bit hackish |
14,124 | public function getHideTitleFromAdminColumns ( ) { if ( in_array ( 'title' , $ this -> getAdminColumns ( ) ) ) { return false ; } $ supports = $ this -> getSupports ( ) ; if ( is_array ( $ supports ) && in_array ( 'title' , $ supports ) ) { return false ; } return true ; } | Hide the title from admin columns? |
14,125 | public function getPostType ( ) { $ called_class_segments = explode ( '\\' , get_called_class ( ) ) ; $ class_name = end ( $ called_class_segments ) ; return ( is_null ( $ this -> post_type ) ) ? Str :: machine ( Str :: camelToHuman ( $ class_name ) , Base :: SEPARATOR ) : $ this -> post_type ; } | Get the post type |
14,126 | public static function getPairs ( $ args = array ( ) ) { $ called_class = get_called_class ( ) ; $ instance = Post \ Factory :: create ( $ called_class ) ; if ( ! Arr :: iterable ( $ args ) ) { global $ wpdb ; $ sql = sprintf ( "SELECT p.ID, p.post_title FROM $wpdb->... | Get the pairs |
14,127 | public static function getWhere ( $ args = array ( ) , $ load_terms = true ) { $ instance = Post \ Factory :: create ( get_called_class ( ) ) ; $ default_orderby = $ instance -> getDefaultOrderBy ( ) ; $ default_order = $ instance -> getDefaultOrder ( ) ; $ default_args = array ( 'post_type' => $ instance -> getPostTyp... | Get posts with conditions |
14,128 | public static function getByTerm ( $ taxonomy , $ terms , $ field = 'slug' , $ args = array ( ) , $ load_terms = true ) { $ args = array_merge ( $ args , array ( 'tax_query' => array ( array ( 'taxonomy' => $ taxonomy , 'terms' => $ terms , 'field' => $ field ) ) , ) ) ; return static :: getWhere ( $ args , $ load_term... | Get by a taxonomy and term |
14,129 | public static function getOneByTerm ( $ taxonomy , $ terms , $ field = 'slug' , $ args = array ( ) , $ load_terms = true ) { $ args [ 'numberposts' ] = 1 ; $ result = static :: getByTerm ( $ taxonomy , $ terms , $ field , $ args , $ load_terms ) ; return ( count ( $ result ) ) ? current ( $ result ) : null ; } | Get one by a taxonomy and term |
14,130 | public static function getPage ( $ page = 1 , $ args = array ( ) , $ load_terms = true ) { $ instance = Post \ Factory :: create ( get_called_class ( ) ) ; $ criteria = array ( 'post_type' => $ instance -> getPostType ( ) , 'orderby' => 'date' , 'order' => 'DESC' , 'posts_per_page' => $ instance -> getPostsPerPage ( ) ... | Get results by page |
14,131 | public function setTerms ( $ term_ids , $ taxonomy = null , $ append = false ) { $ taxonomy = ( $ taxonomy ) ? $ taxonomy : 'post_tag' ; if ( ! is_array ( $ this -> _terms ) ) { $ this -> _terms = array ( ) ; } if ( ! array_key_exists ( $ taxonomy , $ this -> _terms ) ) { $ this -> _terms [ $ taxonomy ] = array ( ) ; }... | Set the terms |
14,132 | public function getTerms ( $ taxonomy = null ) { if ( $ taxonomy ) { return ( array_key_exists ( $ taxonomy , $ this -> _terms ) ) ? $ this -> _terms [ $ taxonomy ] : array ( ) ; } return $ this -> _terms ; } | Get the terms |
14,133 | public function hasTerm ( $ term_id ) { $ taxonomy_terms = $ this -> getTerms ( ) ; if ( ! Arr :: iterable ( $ taxonomy_terms ) ) { return false ; } foreach ( $ taxonomy_terms as $ taxonomy_key => $ terms ) { if ( ! Arr :: iterable ( $ terms ) ) { continue ; } foreach ( $ terms as $ term ) { if ( ( int ) $ term -> term... | Does this post have this term? |
14,134 | public function getPostAttachment ( $ size = 'full' , $ property = null ) { $ post_id = $ this -> get ( 'ID' ) ; if ( ! has_post_thumbnail ( $ post_id ) ) { return false ; } $ attachment_id = get_post_thumbnail_id ( $ post_id ) ; $ image_properties = array ( 'url' , 'width' , 'height' , 'is_resized' ) ; $ image_array =... | Get the image attachment array for post s featured image |
14,135 | public function getRenderPublicField ( $ key , $ field = null , $ load_value = true ) { $ class = get_called_class ( ) ; if ( $ key === self :: KEY_CLASS ) { $ attribs = array ( 'type' => 'hidden' , 'name' => $ key , 'value' => $ class ) ; return Html :: tag ( 'input' , null , $ attribs ) ; } if ( $ key === self :: KEY... | Render a public field |
14,136 | public function getPublicFormKey ( $ suffix = null ) { $ val = sprintf ( '%s_public_form' , $ this -> getPostType ( ) ) ; return ( $ suffix ) ? sprintf ( '%s_%s' , $ val , $ suffix ) : $ val ; } | Get the public form key This is useful for integrations with FlashData and the like when you want to persist data from the form to another page . For instance in the case of error messages and form values . |
14,137 | public static function find ( $ post_id , $ load_terms = true ) { $ instance = Post \ Factory :: create ( get_called_class ( ) ) ; $ instance -> load ( $ post_id , $ load_terms ) ; return $ instance ; } | Find a post |
14,138 | public function getLinkURL ( $ field ) { $ link_attr = self :: decodeLinkObject ( $ this -> get ( $ field ) ) ; if ( ! is_object ( $ link_attr ) ) { return $ this -> get ( $ field ) ; } if ( ! ( strlen ( $ link_attr -> href ) && strlen ( $ link_attr -> title ) && strlen ( $ link_attr -> target ) ) ) { $ field_attribs =... | Get just the URL from a field type of link |
14,139 | public function linkAttribsToHTMLString ( $ link_attr , $ body = '' , $ classes = '' , $ id = '' , $ styles = '' ) { $ link_text = null ; if ( strlen ( $ link_attr -> title ) ) { $ link_text = $ link_attr -> title ; } elseif ( strlen ( $ body ) ) { $ link_text = $ body ; } else { $ link_text = $ link_attr -> href ; } r... | Get an HTML link from attributes that come from a link object This is mainly used with the field type of link |
14,140 | public static function getLinkHTMLFromObject ( $ object_string , $ body = '' , $ classes = '' , $ id = '' , $ styles = '' ) { return self :: linkAttribsToHTMLString ( self :: decodeLinkObject ( $ object_string ) , $ body , $ classes , $ id , $ styles ) ; } | Get an HTML link from an encoded link object |
14,141 | public function generateToken ( $ save = false ) { $ attributes = [ 'token' => str_random ( 16 ) , 'is_used' => false , 'user_id' => $ this -> id , 'created_at' => time ( ) ] ; $ token = App :: make ( Token :: class ) ; $ token -> fill ( $ attributes ) ; if ( $ save ) { $ token -> save ( ) ; } return $ token ; } | Generate a token for the current user . |
14,142 | public function enterExpression ( Expression $ expr ) { $ hash = spl_object_hash ( $ expr ) ; if ( $ expr instanceof Key ) { if ( ! count ( $ this -> hashes ) ) { $ this -> qb -> andWhere ( $ this -> toExpr ( $ expr ) ) ; } else { $ lastHash = end ( $ this -> hashes ) ; $ this -> map [ $ lastHash ] [ ] = $ this -> toEx... | Adds Key expressions to the query or stores children of OrX and AndX expressions in memory to be added on the leaveExpression for OrX or AndX expressions . |
14,143 | public function leaveExpression ( Expression $ expr ) { if ( $ expr instanceof OrX || $ expr instanceof AndX ) { $ hash = spl_object_hash ( $ expr ) ; if ( $ expr instanceof OrX ) { $ composite = $ this -> qb -> expr ( ) -> orX ( ) ; $ composite -> addMultiple ( $ this -> map [ $ hash ] ) ; } else { $ composite = $ thi... | Adds the AndX and OrX Doctrine expressions to the query |
14,144 | public function shouldJoin ( $ key , $ prefix = null ) { $ parts = explode ( '.' , $ key ) ; if ( ! $ prefix ) { $ prefix = $ this -> getRootAlias ( ) ; } if ( ! in_array ( $ parts [ 0 ] , $ this -> qb -> getAllAliases ( ) ) ) { $ this -> qb -> leftJoin ( $ prefix . '.' . $ parts [ 0 ] , $ parts [ 0 ] ) ; } if ( count ... | Strips the key parts and creates joins if they don t exist yet . |
14,145 | private function validateKey ( $ key ) { $ details = openssl_pkey_get_details ( $ key ) ; if ( ! isset ( $ details [ 'key' ] ) || $ details [ 'type' ] !== OPENSSL_KEYTYPE_RSA ) { throw new \ InvalidArgumentException ( 'This key is not compatible with RSA signatures' ) ; } } | Returns if the key type is equals with expected type |
14,146 | public function downloadMediaAction ( $ filename ) { $ media = $ this -> mediaManager -> getRepository ( ) -> findOneByReference ( $ filename ) ; $ provider = $ this -> container -> get ( 'opifer.media.provider.pool' ) -> getProvider ( $ media -> getProvider ( ) ) ; $ mediaUrl = $ provider -> getUrl ( $ media ) ; $ fil... | Download media item . |
14,147 | protected function getDisplayLogicPrototypes ( BlockInterface $ block ) { $ collection = new PrototypeCollection ( [ new OrXPrototype ( ) , new AndXPrototype ( ) , new EventPrototype ( 'click_event' , 'Click Event' , 'event.type.click' ) , new TextPrototype ( 'dom_node_id' , 'DOM Node Id' , 'node.id' ) ] ) ; $ owner = ... | Builds the default display condition prototypes |
14,148 | public function onAuthenticationSuccess ( Request $ request , TokenInterface $ token ) { if ( $ user = $ token -> getUser ( ) ) { if ( ! $ user -> getFirstName ( ) || ! $ user -> getLastName ( ) ) { return new RedirectResponse ( $ this -> router -> generate ( 'opifer_cms_user_profile' ) ) ; } } return parent :: onAuthe... | Checks if the user has actually filled in some mandatory data . If not it redirects to the users profile page . |
14,149 | public function fromBase64URL ( $ data ) { if ( $ remainder = strlen ( $ data ) % 4 ) { $ data .= str_repeat ( '=' , 4 - $ remainder ) ; } return base64_decode ( strtr ( $ data , '-_' , '+/' ) ) ; } | Deserializes from base64url |
14,150 | public function synchronise ( Subscription $ subscription ) { try { $ contact = [ 'update' => true , 'purge' => false , 'contact' => [ 'externalId' => $ subscription -> getId ( ) , 'properties' => [ 'email' => $ subscription -> getEmail ( ) , ] , ] , ] ; $ response = $ this -> post ( 'contact' , $ contact ) ; if ( $ re... | Synchronize a subscription |
14,151 | public function getHeader ( $ name , $ default = null ) { if ( $ this -> hasHeader ( $ name ) ) { return $ this -> getHeaderValue ( $ name ) ; } if ( $ default === null ) { throw new \ OutOfBoundsException ( 'Requested header is not configured' ) ; } return $ default ; } | Returns the value of a token header |
14,152 | private function getHeaderValue ( $ name ) { $ header = $ this -> headers [ $ name ] ; if ( $ header instanceof Claim ) { return $ header -> getValue ( ) ; } return $ header ; } | Returns the value stored in header |
14,153 | public function getClaim ( $ name , $ default = null ) { if ( $ this -> hasClaim ( $ name ) ) { return $ this -> claims [ $ name ] -> getValue ( ) ; } if ( $ default === null ) { throw new \ OutOfBoundsException ( 'Requested claim is not configured' ) ; } return $ default ; } | Returns the value of a token claim |
14,154 | public function verify ( Signer $ signer , $ key ) { if ( $ this -> signature === null ) { throw new \ BadMethodCallException ( 'This token is not signed' ) ; } if ( $ this -> headers [ 'alg' ] !== $ signer -> getAlgorithmId ( ) ) { return false ; } return $ this -> signature -> verify ( $ signer , $ this -> getPayload... | Verify if the key matches with the one that created the signature |
14,155 | public function validate ( ValidationData $ data ) { foreach ( $ this -> getValidatableClaims ( ) as $ claim ) { if ( ! $ claim -> validate ( $ data ) ) { return false ; } } return true ; } | Validates if the token is valid |
14,156 | private function getValidatableClaims ( ) { $ claims = array ( ) ; foreach ( $ this -> claims as $ claim ) { if ( $ claim instanceof Validatable ) { $ cliams [ ] = $ claim ; } } return $ claims ; } | Yields the validatable claims |
14,157 | public function create ( $ projectKey , $ issueTypeName ) { $ fieldsMetadata = $ this -> getCreateMetadataFields ( $ projectKey , $ issueTypeName ) ; $ fluentIssueCreate = new FluentIssueCreate ( $ this -> client , $ fieldsMetadata ) ; return $ fluentIssueCreate -> field ( Field :: PROJECT , $ projectKey ) -> field ( F... | Creates an issue or a sub - task |
14,158 | public function addComment ( $ issue , $ body , $ visibilityType = null , $ visibilityName = null , $ expand = false ) { $ path = "/issue/{$issue}/comment" . ( $ expand ? '?expand' : '' ) ; $ data = array ( 'body' => $ body ) ; if ( $ visibilityType !== null && $ visibilityName !== null ) { $ data [ 'visibility' ] = ar... | Adds a new comment to an issue . |
14,159 | public function deleteComment ( $ issue , $ commentId ) { $ path = "/issue/{$issue}/comment/{$commentId}" ; try { $ this -> client -> callDelete ( $ path ) ; } catch ( Exception $ e ) { throw new JiraException ( "Failed to delete comment" , $ e ) ; } } | Deletes an existing comment |
14,160 | public function getEditMetadata ( $ issue ) { $ path = "/issue/{$issue}/editmeta" ; try { $ data = $ this -> client -> callGet ( $ path ) -> getData ( ) ; if ( ! isset ( $ data [ 'fields' ] ) ) { throw new JiraException ( "Bad metadata" ) ; } return $ data ; } catch ( Exception $ e ) { throw new JiraException ( "Failed... | Returns the meta data for editing an issue . |
14,161 | public function addWatcher ( $ issue , $ login ) { $ path = "/issue/{$issue}/watchers" ; try { $ this -> client -> callPost ( $ path , $ login ) ; } catch ( Exception $ e ) { throw new JiraException ( "Failed to add watcher '{$login}' to issue '{$issue}'" , $ e ) ; } return $ this ; } | Adds a user to an issue s watcher list . |
14,162 | public function deleteWatcher ( $ issue , $ login ) { $ path = "/issue/{$issue}/watchers?username={$login}" ; try { $ this -> client -> callDelete ( $ path ) ; } catch ( Exception $ e ) { throw new JiraException ( "Failed to delete watcher '{$login}' to issue '{$issue}'" , $ e ) ; } } | Removes a user from an issue s watcher list . |
14,163 | public function get ( $ issue , $ includedFields = null , $ expandFields = false ) { $ params = array ( ) ; if ( $ includedFields !== null ) { $ params [ 'fields' ] = $ includedFields ; } if ( $ expandFields ) { $ params [ 'expand' ] = '' ; } $ path = "/issue/{$issue}?" . http_build_query ( $ params ) ; $ result = $ th... | Returns a full representation of the issue for the given issue key . |
14,164 | protected function findall ( string $ haystack , $ needle ) : array { $ lastPos = 0 ; $ positions = [ ] ; while ( ( $ lastPos = strpos ( $ haystack , $ needle , $ lastPos ) ) !== false ) { $ positions [ ] = $ lastPos ; $ lastPos = $ lastPos + 1 ; } return $ positions ; } | Find all occurrences of a needle in a string |
14,165 | protected function findFirstPacketOffset ( ) { $ positions = $ this -> findall ( $ this -> buffer , 'G' ) ; while ( count ( $ positions ) > 0 ) { $ position = array_shift ( $ positions ) ; for ( $ i = 1 ; $ i <= $ this -> consecutivePacketsBeforeLock ; $ i ++ ) { if ( ! in_array ( $ position + 188 * $ i , $ positions )... | Find the offset of the first MPEG TS packet in the current buffer |
14,166 | protected function extGetLL ( $ key , $ convertWithHtmlspecialchars = true ) { $ labelStr = $ this -> getLanguageService ( ) -> getLL ( $ key ) ; if ( $ convertWithHtmlspecialchars ) { $ labelStr = htmlspecialchars ( $ labelStr ) ; } return $ labelStr ; } | Translate given key |
14,167 | public function extGetFeAdminValue ( $ sectionName , $ val = '' ) { $ beUser = $ this -> getBackendUser ( ) ; if ( $ val && isset ( $ beUser -> extAdminConfig [ 'override.' ] [ $ sectionName . '.' ] [ $ val ] ) ) { return $ beUser -> extAdminConfig [ 'override.' ] [ $ sectionName . '.' ] [ $ val ] ; } if ( ! $ val && i... | Returns the value for an Admin Panel setting . |
14,168 | protected function loadCollection ( BlockInterface $ block ) { $ properties = $ block -> getProperties ( ) ; $ conditions = ( isset ( $ properties [ 'conditions' ] ) ) ? $ properties [ 'conditions' ] : '[]' ; $ conditions = $ this -> expressionEngine -> deserialize ( $ conditions ) ; if ( empty ( $ conditions ) ) { ret... | Load the collection if any conditions are defined . |
14,169 | protected function setResponseHeaders ( BlockInterface $ block , Response $ response ) { if ( $ block && $ block -> getReference ( ) ) { if ( $ this -> getReferenceService ( $ block ) -> isEsiEnabled ( $ block -> getReference ( ) ) ) { $ this -> getReferenceService ( $ block ) -> setResponseHeaders ( $ block -> getRefe... | Sets the response headers defined on the reference service |
14,170 | public function listAction ( ) { $ source = new Entity ( $ this -> get ( 'opifer.form.post_manager' ) -> getClass ( ) ) ; $ formColumn = new TextColumn ( [ 'id' => 'posts' , 'title' => 'Form' , 'source' => false , 'filterable' => false , 'sortable' => false , 'safe' => false ] ) ; $ formColumn -> manipulateRenderCell (... | Lists all posts from every form |
14,171 | public function onAfterRoute ( ) { $ app = JFactory :: getApplication ( ) ; $ username = $ app -> input -> server -> get ( 'PHP_AUTH_USER' , null , 'string' ) ; $ password = $ app -> input -> server -> get ( 'PHP_AUTH_PW' , null , 'string' ) ; if ( $ username && $ password ) { if ( ! $ this -> _login ( $ username , $ p... | Ask for authentication and log the user in into the application . |
14,172 | protected function _login ( $ username , $ password , $ application ) { if ( $ application -> login ( array ( 'username' => $ username , 'password' => $ password ) ) !== true ) { return false ; } if ( class_exists ( 'Koowa' ) ) { $ manager = KObjectManager :: getInstance ( ) ; $ request = $ manager -> getInstance ( ) -... | Logs in a given user to an application . |
14,173 | public function getReadableFilesize ( ) { $ size = $ this -> filesize ; if ( $ size < 1 ) { return $ size ; } if ( $ size < 1024 ) { return $ size . 'b' ; } else { $ help = $ size / 1024 ; if ( $ help < 1024 ) { return round ( $ help , 1 ) . 'kb' ; } else { return round ( ( $ help / 1024 ) , 1 ) . 'mb' ; } } } | Get filesize with filesize extension . |
14,174 | public function createQueryBuilderFromRequest ( Request $ request ) { $ qb = $ this -> createQueryBuilder ( 'm' ) ; if ( $ request -> get ( 'ids' ) ) { $ ids = explode ( ',' , $ request -> get ( 'ids' ) ) ; $ qb -> andWhere ( 'm.id IN (:ids)' ) -> setParameter ( 'ids' , $ ids ) ; } $ qb -> andWhere ( 'm.status = :statu... | Create the query builder from request . |
14,175 | public function search ( $ term , $ limit , $ offset , $ orderBy = null ) { $ qb = $ this -> createQueryBuilder ( 'm' ) ; $ qb -> where ( 'm.name LIKE :term' ) -> andWhere ( 'm.status IN (:statuses)' ) -> setParameters ( array ( 'term' => '%' . $ term . '%' , 'statuses' => array ( 0 , 1 ) , ) ) ; if ( $ limit ) { $ qb ... | Search media items by a searchterm . |
14,176 | public function setQuerystring ( array $ str = array ( ) , $ append = true , $ default = true ) { if ( is_null ( $ this -> filterable ) ) { $ this -> resetFilterableOptions ( ) ; } if ( sizeof ( $ str ) == 0 && $ default ) { parse_str ( $ _SERVER [ 'QUERY_STRING' ] , $ this -> filterable [ 'qstring' ] ) ; } else { $ th... | Parse the query string |
14,177 | public function scopeFilterColumns ( $ query , $ columns = array ( ) , $ validate = false ) { if ( sizeof ( $ columns ) > 0 ) { $ this -> setColumns ( $ columns ) ; } if ( $ validate ) { $ this -> validateColumns ( ) ; } if ( sizeof ( $ this -> filterable [ 'filters' ] ) == 0 ) { $ this -> setQuerystring ( ) ; } if ( s... | Laravel Eloquent query scope . |
14,178 | public function getAllBlocks ( ) { $ this -> load ( ) ; $ blocks = [ ] ; foreach ( $ this -> blockCache as $ blockCache ) { $ blocks = array_merge ( $ blocks , $ blockCache ) ; } return $ blocks ; } | Get all cached blocks |
14,179 | public function verify ( Signer $ signer , $ payload , $ key ) { return $ signer -> verify ( $ this -> hash , $ payload , $ key ) ; } | Verifies if the current hash matches with with the result of the creation of a new signature with given data |
14,180 | public function buildCreateForm ( FormBuilderInterface $ builder , array $ options ) { $ builder -> add ( 'files' , DropzoneType :: class , [ 'mapped' => false , 'path' => $ this -> router -> generate ( 'opifer_api_media_upload' ) , 'form_action' => $ this -> router -> generate ( 'opifer_media_media_updateall' ) , 'lab... | Build the add file form . |
14,181 | public function findByIds ( $ ids ) { if ( ! is_array ( $ ids ) ) { $ ids = explode ( ',' , $ ids ) ; } return $ this -> createQueryBuilder ( 'ml' ) -> andWhere ( 'ml.id IN (:ids)' ) -> setParameter ( 'ids' , $ ids ) -> getQuery ( ) -> getResult ( ) ; } | Find the mailinglist by an array of IDs |
14,182 | public function getDiscriminatorMap ( ) { $ map = array ( ) ; foreach ( $ this -> blockManager -> getValues ( ) as $ alias => $ value ) { $ map [ $ alias ] = $ value -> getEntity ( ) ; } return $ map ; } | Transforms the registered blocks into a discriminatorMap |
14,183 | public function validate ( $ value , Constraint $ constraint ) { if ( is_array ( $ value ) ) { $ value = json_encode ( $ value ) ; } if ( ! json_decode ( $ value , true ) ) { $ this -> context -> addViolation ( $ constraint -> message , array ( ) ) ; } } | Checks if the passed value is a valid JSON string . If it s already converted by for example Doctrine s json_array type encode the value first and then check if the encode value is valid . |
14,184 | public function createMissingValueSet ( Content $ content ) { if ( $ content -> getContentType ( ) !== null && $ content -> getValueSet ( ) === null ) { $ valueSet = new ValueSet ( ) ; $ this -> em -> persist ( $ valueSet ) ; $ valueSet -> setSchema ( $ content -> getContentType ( ) -> getSchema ( ) ) ; $ content -> se... | Creates a ValueSet entity for Content when missing and there is a ContentType set . |
14,185 | protected function stripMetadata ( array $ array , $ stripped = [ ] ) { $ allowed = [ 'id' , '__children' ] ; foreach ( $ array as $ item ) { if ( count ( $ item [ '__children' ] ) ) { $ item [ '__children' ] = $ this -> stripMetadata ( $ item [ '__children' ] , $ stripped ) ; } $ stripped [ ] = array_intersect_key ( $... | Strips metadata that should not be stored |
14,186 | public function var_dump ( $ item ) { if ( $ this -> hasCollector ( 'vardump' ) ) { $ collector = $ this -> getCollector ( 'vardump' ) ; $ collector -> addVarDump ( $ item ) ; } } | Adds an item to the VarDumpCollector |
14,187 | public function preSetData ( FormEvent $ event ) { $ data = $ event -> getData ( ) ; $ form = $ event -> getForm ( ) ; $ fields = $ form -> getConfig ( ) -> getOption ( 'fields' ) ; if ( null === $ data || '' === $ data ) { $ data = [ ] ; } if ( ! is_array ( $ data ) && ! ( $ data instanceof \ Traversable && $ data ins... | Listens to the PRE_SET_DATA event and adds form fields dynamically . |
14,188 | public function verifyHash ( array $ params ) { $ result = false ; try { $ this -> sdk -> CheckOutFeedback ( $ params ) ; $ result = true ; } catch ( Exception $ e ) { } return $ result ; } | Verify if the hash of the given parameter is correct . |
14,189 | public function editAction ( Request $ request , $ id ) { $ manager = $ this -> get ( 'opifer.redirect.redirect_manager' ) ; $ redirect = $ manager -> getRepository ( ) -> find ( $ id ) ; $ form = $ this -> createForm ( RedirectType :: class , $ redirect ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubm... | Edit a redirect |
14,190 | public function deleteAction ( $ id ) { $ manager = $ this -> get ( 'opifer.redirect.redirect_manager' ) ; $ redirect = $ manager -> getRepository ( ) -> find ( $ id ) ; $ manager -> remove ( $ redirect ) ; $ this -> addFlash ( 'success' , $ this -> get ( 'translator' ) -> trans ( 'opifer_redirect.flash.deleted' ) ) ; ... | Delete a redirect |
14,191 | public function getContentByReference ( $ reference ) { if ( is_numeric ( $ reference ) ) { $ nestedContent = $ this -> getRepository ( ) -> find ( $ reference ) ; } else { $ template = $ this -> em -> getRepository ( $ this -> templateClass ) -> findOneByName ( $ reference ) ; $ nestedContent = $ this -> eavManager ->... | Get the content by a reference |
14,192 | private function detachAndPersist ( $ entity ) { $ this -> em -> detach ( $ entity ) ; $ this -> em -> persist ( $ entity ) ; } | For cloning purpose |
14,193 | private function hasChangedParent ( SluggableAdapter $ ea , $ object , $ getter ) { $ relation = $ object -> $ getter ( ) ; if ( ! $ relation ) { return false ; } $ changeSet = $ ea -> getObjectChangeSet ( $ this -> om -> getUnitOfWork ( ) , $ relation ) ; if ( isset ( $ changeSet [ $ this -> usedOptions [ 'relationFie... | Check if the given object has a changed parent recursively |
14,194 | public function typeAction ( $ type ) { $ contentType = $ this -> get ( 'opifer.content.content_type_manager' ) -> getRepository ( ) -> find ( $ type ) ; if ( ! $ contentType ) { throw $ this -> createNotFoundException ( sprintf ( 'Content Type with ID %d could not be found.' , $ type ) ) ; } $ queryBuilder = $ this ->... | Index view of content by type |
14,195 | public function getTemperature ( $ withUnit = false ) { if ( ! $ this -> lastResponse || ! isset ( $ this -> lastResponse [ 'item' ] [ 'condition' ] [ 'temp' ] ) ) { return '' ; } $ return = $ this -> lastResponse [ 'item' ] [ 'condition' ] [ 'temp' ] ; if ( $ withUnit ) { $ return .= ' ' . $ this -> lastResponse [ 'un... | Get current temperature . |
14,196 | public function getWind ( $ withUnit = false ) { if ( ! $ this -> lastResponse || ! isset ( $ this -> lastResponse [ 'wind' ] [ 'speed' ] ) ) { return array ( ) ; } $ response = array ( 'chill' => $ this -> lastResponse [ 'wind' ] [ 'chill' ] , 'direction' => $ this -> lastResponse [ 'wind' ] [ 'direction' ] , 'speed' ... | get Wind . |
14,197 | public function subscribeAction ( Block $ block ) { $ response = $ this -> execute ( $ block ) ; $ properties = $ block -> getProperties ( ) ; if ( $ this -> subscribed && isset ( $ properties [ 'responseType' ] ) && $ properties [ 'responseType' ] == 'redirect' ) { $ content = $ this -> contentManager -> getRepository... | Processes a POST request to subscribe . |
14,198 | public function transform ( $ slug ) { if ( null === $ slug ) { return ; } if ( substr ( $ slug , - 1 ) == '/' ) { return '/' ; } $ array = explode ( '/' , $ slug ) ; $ slug = end ( $ array ) ; return $ slug ; } | Removes the directory path from the slug . |
14,199 | public function create ( ) { $ class = $ this -> getClass ( ) ; $ contentType = new $ class ( ) ; $ schema = $ this -> schemaManager -> create ( ) ; $ schema -> setObjectClass ( $ this -> contentManager -> getClass ( ) ) ; $ contentType -> setSchema ( $ schema ) ; return $ contentType ; } | Create a new contentType instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.