idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
16,900 | public static function getComparator ( DataTablesMappingInterface $ mapping ) { if ( null === $ mapping -> getParent ( ) ) { return "LIKE" ; } switch ( $ mapping -> getParent ( ) -> getType ( ) ) { case DataTablesColumnInterface :: DATATABLES_TYPE_DATE : case DataTablesColumnInterface :: DATATABLES_TYPE_HTML_NUM : case... | Get a comparator . |
16,901 | public static function getWhere ( DataTablesMappingInterface $ mapping ) { $ where = [ static :: getAlias ( $ mapping ) , static :: getComparator ( $ mapping ) , static :: getParam ( $ mapping ) , ] ; return implode ( " " , $ where ) ; } | Get a where . |
16,902 | public function deleteAction ( Request $ request , $ name , $ id ) { $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; try { $ entity = $ this -> getDataTablesEntityById ( $ dtProvider , $ id ) ; $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_PRE_DELETE , [ $ entity ] ) ; $ em = $ this -> ... | Delete an existing entity . |
16,903 | public function editAction ( Request $ request , $ name , $ id , $ data , $ value ) { $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; $ dtEditor = $ this -> getDataTablesEditor ( $ dtProvider ) ; $ dtColumn = $ this -> getDataTablesColumn ( $ dtProvider , $ data ) ; try { $ entity = $ this -> getDataTablesE... | Edit an existing entity . |
16,904 | public function exportAction ( Request $ request , $ name ) { $ windows = DataTablesExportHelper :: isWindows ( $ request ) ; $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; $ dtExporter = $ this -> getDataTablesCSVExporter ( $ dtProvider ) ; $ repository = $ this -> getDataTablesRepository ( $ dtProvider )... | Export all entities . |
16,905 | public function optionsAction ( $ name ) { $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; $ dtWrapper = $ this -> getDataTablesWrapper ( $ dtProvider ) ; $ dtOptions = DataTablesWrapperHelper :: getOptions ( $ dtWrapper ) ; return new JsonResponse ( $ dtOptions ) ; } | Options of a DataTables . |
16,906 | public function showAction ( $ name , $ id ) { $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; try { $ entity = $ this -> getDataTablesEntityById ( $ dtProvider , $ id ) ; $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_PRE_SHOW , [ $ entity ] ) ; } catch ( EntityNotFoundException $ ex ) ... | Show an existing entity . |
16,907 | public function loadPsr4 ( ) { $ data = $ this -> getData ( ) ; if ( isset ( $ data [ 'always' ] ) ) { $ this -> loadPsr4Group ( $ data [ 'always' ] ) ; } if ( is_admin ( ) && isset ( $ data [ 'admin' ] ) ) { $ this -> loadPsr4Group ( $ data [ 'admin' ] ) ; } if ( ! is_admin ( ) && isset ( $ data [ 'frontend' ] ) ) { $... | Autoload all the classes inside the PSR4 sections for our groups |
16,908 | public function instantiateClasses ( ) { $ data = $ this -> getData ( ) ; if ( isset ( $ data [ 'always' ] ) ) { $ this -> instantiateGroup ( $ data [ 'always' ] ) ; } if ( is_admin ( ) && isset ( $ data [ 'admin' ] ) ) { $ this -> instantiateGroup ( $ data [ 'admin' ] ) ; } if ( ! is_admin ( ) && isset ( $ data [ 'fro... | Automatically instanciate all the classes inside the instanciate sections for our groups |
16,909 | private function loadPsr4Group ( $ group ) { if ( ! isset ( $ group [ 'psr4' ] ) ) { return ; } foreach ( $ group [ 'psr4' ] as $ prefix => $ paths ) { $ this -> objectRegistry -> addPsr4 ( $ prefix , $ paths ) ; } } | Autoload the classes for a group |
16,910 | private function instantiateGroup ( $ group ) { if ( ! isset ( $ group [ 'instantiate' ] ) ) { return ; } foreach ( $ group [ 'instantiate' ] as $ nickname => $ className ) { $ this -> objectRegistry -> register ( $ nickname , new $ className ( ) ) ; } } | Instantiate the classes for a group |
16,911 | private function createUser ( array $ user ) { $ this -> fields = [ 'id' => $ this -> getValue ( 'id' , $ user ) , 'name' => $ this -> getValue ( 'name' , $ user ) , 'username' => $ this -> getValue ( 'username' , $ user ) , 'description' => $ this -> getValue ( 'description' , $ user ) , 'location' => $ this -> getVal... | Set most used user properties |
16,912 | public function configureKirki ( ) { self :: $ OPTIONS_DEFAULTS [ 'logo_image' ] = Urls :: assets ( 'images/admin/customizer.png' ) ; self :: $ OPTIONS_DEFAULTS [ 'url_path' ] = Urls :: baobabFramework ( 'vendor/aristath/kirki/' ) ; self :: $ OPTIONS_DEFAULTS [ 'description' ] = Strings :: translate ( 'This is the them... | Configure the Kirki library |
16,913 | public function registerControls ( $ controls ) { $ data = $ this -> getData ( ) ; $ customControls = $ data [ 'controls' ] ; foreach ( $ customControls as & $ c ) { $ c [ 'label' ] = $ this -> translateValueIfKeyExists ( $ c , 'label' ) ; $ c [ 'description' ] = $ this -> translateValueIfKeyExists ( $ c , 'description... | Register the controls in the various panels and sections |
16,914 | public function createPanels ( $ wp_customize ) { $ data = $ this -> getData ( ) ; $ defaultPanel = $ data [ 'options' ] [ 'default_panel' ] ; $ wp_customize -> add_panel ( $ defaultPanel [ 'id' ] , array ( 'priority' => 10 , 'title' => Strings :: translate ( $ defaultPanel [ 'title' ] ) , 'description' => '' ) ) ; $ e... | Create all panels and sections |
16,915 | public function getTweetsFromUser ( $ username , $ count = 10 , $ cacheMinutes = 30 , $ returnEntities = true ) { $ count = $ this -> getVerifiedCount ( $ count , 1 , 200 ) ; $ endpoint = '/statuses/user_timeline.json' ; $ url = $ this -> urlHelper -> joinSlugs ( [ $ this -> baseUrl , $ this -> apiVersion , $ endpoint ... | Get tweets from a specific user |
16,916 | public function indexAction ( ) { $ em = $ this -> getDoctrine ( ) -> getEntityManager ( ) ; $ entities = $ em -> getRepository ( 'DMSLauncherBundle:PreUser' ) -> findAll ( ) ; return array ( 'entities' => $ entities ) ; } | Lists all PreUser entities . |
16,917 | public function showAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getEntityManager ( ) ; $ entity = $ em -> getRepository ( 'DMSLauncherBundle:PreUser' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find PreUser entity.' ) ; } return array ( 'entity' => $ entity , ... | Finds and displays a PreUser entity . |
16,918 | public function containers ( $ limit = 10000 , $ marker = '' ) { $ response = $ this -> api -> request ( 'GET' , '/' , [ 'query' => [ 'limit' => intval ( $ limit ) , 'marker' => $ marker , ] , ] ) ; if ( $ response -> getStatusCode ( ) !== 200 ) { throw new ApiRequestFailedException ( 'Unable to list containers.' , $ r... | Available containers . |
16,919 | public function createContainer ( $ name , $ type = 'public' ) { if ( ! in_array ( $ type , [ 'public' , 'private' , 'gallery' ] ) ) { throw new InvalidArgumentException ( 'Unknown type "' . $ type . '" provided.' ) ; } $ response = $ this -> api -> request ( 'PUT' , '/' . trim ( $ name , '/' ) , [ 'headers' => [ 'X-Co... | Creates new container . |
16,920 | protected function transformContainers ( array $ items ) { if ( ! count ( $ items ) ) { return [ ] ; } $ containers = [ ] ; foreach ( $ items as $ item ) { $ container = new Container ( $ this -> api , $ this -> uploader , $ item [ 'name' ] , $ item ) ; $ containers [ $ container -> name ( ) ] = $ container ; } return ... | Transforms containers response to Container objects . |
16,921 | protected function setupMigrations ( ) { $ migrations = realpath ( __DIR__ . '/../database/migrations' ) ; $ this -> publishes ( [ $ migrations => $ this -> app -> databasePath ( ) . '/migrations' , ] ) ; } | Setup the Migrations . |
16,922 | protected function setupSeeds ( ) { $ seeds = realpath ( __DIR__ . '/../database/seeds' ) ; $ this -> publishes ( [ $ seeds => $ this -> app -> databasePath ( ) . '/seeds' , ] ) ; } | Setup the Seeds . |
16,923 | public function getMailer ( ) { if ( $ this -> isTestMode ) { $ className = \ Tx_Oelib_EmailCollector :: class ; } else { $ className = \ Tx_Oelib_RealMailer :: class ; } if ( ! is_object ( $ this -> mailer ) || ( get_class ( $ this -> mailer ) !== $ className ) ) { $ this -> mailer = GeneralUtility :: makeInstance ( $... | Retrieves the singleton mailer instance . Depending on the mode this instance is either an e - mail collector or a real mailer . |
16,924 | protected function requestAppAccessToken ( ) { $ credentials = $ this -> authHelper -> generateAppCredentials ( $ this -> apiKey , $ this -> apiSecret ) ; $ endpoint = '/oauth2/token' ; $ url = $ this -> urlHelper -> joinSlugs ( [ $ this -> baseUrl , $ endpoint ] ) ; $ data = [ 'grant_type' => 'client_credentials' ] ; ... | Request an app access token |
16,925 | protected function getVerifiedCount ( $ count , $ min = 1 , $ max = 100 ) { settype ( $ count , "integer" ) ; settype ( $ min , "integer" ) ; settype ( $ max , "integer" ) ; if ( $ min > $ max ) $ min = $ max ; if ( $ count < $ min ) { $ count = $ min ; } elseif ( $ count > $ max ) { $ count = $ max ; } return $ count ... | Verify that the count parameter is in range |
16,926 | protected function createTweetEntities ( $ tweets ) { $ entities = [ ] ; foreach ( $ tweets as $ tweet ) { $ user = $ this -> twitterFactory -> createUser ( $ tweet [ 'user' ] ) ; $ entities [ ] = $ this -> twitterFactory -> createTweet ( $ tweet , $ user ) ; } return $ entities ; } | Create Tweet Entities |
16,927 | private function registerConfigurator ( ) { $ this -> app -> bind ( 'CodeZero\Twitter\Twitter' , function ( $ app ) { $ config = $ app [ 'config' ] -> has ( "twitter" ) ? $ app [ 'config' ] -> get ( "twitter" ) : $ app [ 'config' ] -> get ( "twitter::config" ) ; $ configurator = new \ CodeZero \ Configurator \ DefaultC... | Register the configurator binding |
16,928 | public function registerAction ( ) { $ entity = new PreUser ( ) ; $ request = $ this -> getRequest ( ) ; $ form = $ this -> createForm ( new RegistrationForm ( ) , $ entity ) ; $ form -> bindRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ entity -> setRegisteredOn ( new \ DateTime ( 'now' ) ) ; $ em = $ this -... | Creates a new PreUser entity . |
16,929 | public function commafy ( $ _ ) { if ( ! preg_match ( '/^\d{1,4}$/' , $ _ ) ) { return strrev ( ( string ) preg_replace ( '/(\d{3})(?=\d)(?!\d*\.)/' , '$1,' , strrev ( $ _ ) ) ) ; } else { return $ _ ; } } | Avoid grouping whole numbers between 0 to 9999 |
16,930 | public function addParam ( $ param , $ value ) { if ( ! $ this -> requestMethod -> hasParam ( $ param ) ) { throw new GiroCheckout_SDK_Exception_helper ( 'Failure: param "' . $ param . '" not valid or misspelled. Please check API Params List.' ) ; } if ( $ value instanceof GiroCheckout_SDK_Request_Cart ) { $ this -> pa... | Adds a key value pair to the params variable . Used to fill the request with data . |
16,931 | public function getResponseParam ( $ param ) { if ( isset ( $ this -> response [ $ param ] ) ) { return $ this -> response [ $ param ] ; } return null ; } | Returns the value from the response of the request . |
16,932 | public function redirectCustomerToPaymentProvider ( ) { if ( isset ( $ this -> response [ 'redirect' ] ) ) { header ( 'location:' . $ this -> response [ 'redirect' ] ) ; exit ; } elseif ( isset ( $ this -> response [ 'url' ] ) ) { header ( 'location:' . $ this -> response [ 'url' ] ) ; exit ; } } | modifies header to sent redirect location by GiroCheckout |
16,933 | public function getAvailableDevices ( ) { $ availableDevices = array ( ) ; $ rules = array_change_key_case ( $ this -> detector -> getRules ( ) ) ; foreach ( $ rules as $ device => $ rule ) { $ availableDevices [ $ device ] = static :: fromCamelCase ( $ device ) ; } return $ availableDevices ; } | Returns an array of all available devices |
16,934 | protected function loadInterfaceMetadata ( $ metadata ) { foreach ( $ metadata -> getReflectionClass ( ) -> getInterfaces ( ) as $ interface ) { $ metadata -> mergeRules ( $ this -> getClassMetadata ( $ interface -> getName ( ) ) ) ; } } | Checks if the object has interfaces and cascades parsing of annotatiosn to all the interfaces |
16,935 | public function hasParam ( $ paramName ) { if ( isset ( $ this -> paramFields [ $ paramName ] ) ) { return true ; } elseif ( 'sourceId' === $ paramName ) { return true ; } elseif ( 'userAgent' === $ paramName ) { return true ; } elseif ( 'orderId' === $ paramName ) { return true ; } elseif ( 'customerId' === $ paramNam... | Checks if the param exists . Check is case sensitive . |
16,936 | public function getSubmitParams ( $ params ) { $ submitParams = array ( ) ; foreach ( $ this -> paramFields as $ k => $ mandatory ) { if ( isset ( $ params [ $ k ] ) && strlen ( $ params [ $ k ] ) > 0 ) { $ submitParams [ $ k ] = $ params [ $ k ] ; } elseif ( ( ! isset ( $ params [ $ k ] ) || strlen ( $ params [ $ k ] ... | Returns all API call param fields in the correct order . Complains if a mandatory field is not present or empty . |
16,937 | public function checkResponse ( $ response ) { if ( ! is_array ( $ response ) ) { return FALSE ; } $ responseParams = array ( ) ; foreach ( $ this -> responseFields as $ k => $ mandatory ) { if ( isset ( $ response [ $ k ] ) ) { $ responseParams [ $ k ] = $ response [ $ k ] ; } elseif ( ! isset ( $ response [ $ k ] ) &... | Returns all response param fields in the correct order . |
16,938 | public function checkNotification ( $ notify ) { if ( ! is_array ( $ notify ) ) { return FALSE ; } $ notifyParams = array ( ) ; foreach ( $ this -> notifyFields as $ k => $ mandatory ) { if ( isset ( $ notify [ $ k ] ) ) { $ notifyParams [ $ k ] = $ notify [ $ k ] ; } elseif ( ! isset ( $ notify [ $ k ] ) && $ mandator... | Returns all notify param fields in the correct order . |
16,939 | public function registerAssets ( ) { $ data = $ this -> getData ( ) ; $ manifest = $ this -> loadManifest ( ) ; if ( isset ( $ data [ 'styles' ] ) ) { foreach ( $ data [ 'styles' ] as $ handle => $ props ) { $ this -> handleStyleAction ( 'register' , $ handle , $ props , $ manifest ) ; } } if ( isset ( $ data [ 'script... | Register the assets before we eventually enqueue them |
16,940 | public function enqueueAssets ( ) { $ data = $ this -> getData ( ) ; if ( isset ( $ data [ 'editor' ] ) ) { add_editor_style ( $ data [ 'editor' ] ) ; } if ( isset ( $ data [ 'styles' ] ) ) { foreach ( $ data [ 'styles' ] as $ handle => $ props ) { $ this -> handleStyleAction ( 'enqueue' , $ handle , $ props ) ; } } if... | Enqueue the assets |
16,941 | protected function loadManifest ( ) { $ manifestPath = Paths :: assets ( 'manifest.json' ) ; if ( file_exists ( $ manifestPath ) ) { return json_decode ( file_get_contents ( $ manifestPath ) , true ) ; } return null ; } | Read the manifest file that can be found at the root of the theme s asset folder . |
16,942 | protected function objectData ( $ key , $ default = null ) { if ( ! $ this -> dataLoaded ) { $ this -> loadContainerData ( ) ; } return isset ( $ this -> data [ $ key ] ) ? $ this -> data [ $ key ] : $ default ; } | Returns specific container data . |
16,943 | protected function loadContainerData ( ) { $ response = $ this -> api -> request ( 'HEAD' , $ this -> absolutePath ( ) ) ; if ( $ response -> getStatusCode ( ) !== 204 ) { throw new ApiRequestFailedException ( 'Container "' . $ this -> name ( ) . '" was not found.' ) ; } $ this -> dataLoaded = true ; $ this -> data = [... | Container data lazy loader . |
16,944 | public function jsonSerialize ( ) { return [ 'name' => $ this -> name ( ) , 'type' => $ this -> type ( ) , 'files_count' => $ this -> filesCount ( ) , 'size' => $ this -> size ( ) , 'uploaded_bytes' => $ this -> uploadedBytes ( ) , 'downloaded_bytes' => $ this -> downloadedBytes ( ) , ] ; } | JSON representation of container . |
16,945 | public function setType ( $ type ) { if ( $ this -> type ( ) === $ type ) { return $ type ; } try { $ this -> setMeta ( [ 'Type' => $ type ] ) ; } catch ( ApiRequestFailedException $ e ) { throw new ApiRequestFailedException ( 'Unable to set container type to "' . $ type . '".' , $ e -> getCode ( ) ) ; } return $ this ... | Updates container type . |
16,946 | public function createDir ( $ name ) { $ response = $ this -> api -> request ( 'PUT' , $ this -> absolutePath ( $ name ) , [ 'headers' => [ 'Content-Type' => 'application/directory' , ] , ] ) ; if ( $ response -> getStatusCode ( ) !== 201 ) { throw new ApiRequestFailedException ( 'Unable to create directory "' . $ name... | Creates new directory . |
16,947 | public function deleteDir ( $ name ) { $ response = $ this -> api -> request ( 'DELETE' , $ this -> absolutePath ( $ name ) ) ; if ( $ response -> getStatusCode ( ) !== 204 ) { throw new ApiRequestFailedException ( 'Unable to delete directory "' . $ name . '".' , $ response -> getStatusCode ( ) ) ; } return true ; } | Deletes directory . |
16,948 | public function uploadFromString ( $ path , $ contents , array $ params = [ ] , $ verifyChecksum = true ) { return $ this -> uploader -> upload ( $ this -> api , $ this -> absolutePath ( $ path ) , $ contents , $ params , $ verifyChecksum ) ; } | Uploads file contents from string . Returns ETag header value if upload was successful . |
16,949 | public function uploadFromStream ( $ path , $ resource , array $ params = [ ] ) { return $ this -> uploader -> upload ( $ this -> api , $ this -> absolutePath ( $ path ) , $ resource , $ params , false ) ; } | Uploads file from stream . Returns ETag header value if upload was successful . |
16,950 | public function delete ( ) { $ response = $ this -> api -> request ( 'DELETE' , $ this -> absolutePath ( ) ) ; switch ( $ response -> getStatusCode ( ) ) { case 204 : return ; case 404 : throw new ApiRequestFailedException ( 'Container "' . $ this -> name ( ) . '" was not found.' ) ; case 409 : throw new ApiRequestFail... | Deletes container . Container must be empty in order to perform this operation . |
16,951 | public function getName ( ) { if ( $ this -> hasString ( 'name' ) ) { $ result = $ this -> getAsString ( 'name' ) ; } elseif ( $ this -> hasFirstName ( ) || $ this -> hasLastName ( ) ) { $ result = trim ( $ this -> getFirstName ( ) . ' ' . $ this -> getLastName ( ) ) ; } else { $ result = $ this -> getUserName ( ) ; } ... | Gets this user s real name . |
16,952 | public function hasGroupMembership ( $ uidList ) { if ( $ uidList === '' ) { throw new \ InvalidArgumentException ( '$uidList must not be empty.' , 1331488635 ) ; } $ isMember = false ; foreach ( GeneralUtility :: trimExplode ( ',' , $ uidList , true ) as $ uid ) { if ( $ this -> getUserGroups ( ) -> hasUid ( $ uid ) )... | Checks whether this user is a member of at least one of the user groups provided as comma - separated UID list . |
16,953 | public function setGender ( $ genderKey ) { $ validGenderKeys = [ self :: GENDER_MALE , self :: GENDER_FEMALE , self :: GENDER_UNKNOWN ] ; if ( ! in_array ( $ genderKey , $ validGenderKeys , true ) ) { throw new \ InvalidArgumentException ( '$genderKey must be one of the predefined constants, but actually is: ' . $ gen... | Sets the gender . |
16,954 | public function getAge ( ) { if ( ! $ this -> hasDateOfBirth ( ) ) { return 0 ; } $ currentTimestamp = $ GLOBALS [ 'EXEC_TIME' ] ; $ birthTimestamp = $ this -> getDateOfBirth ( ) ; $ currentYear = ( int ) strftime ( '%Y' , $ currentTimestamp ) ; $ currentMonth = ( int ) strftime ( '%m' , $ currentTimestamp ) ; $ curren... | Returns this user s age in years . |
16,955 | public function getCountry ( ) { $ countryCode = $ this -> getAsString ( 'static_info_country' ) ; if ( $ countryCode === '' ) { return null ; } try { $ countryMapper = \ Tx_Oelib_MapperRegistry :: get ( \ Tx_Oelib_Mapper_Country :: class ) ; $ country = $ countryMapper -> findByIsoAlpha3Code ( $ countryCode ) ; } catc... | Returns the country of this user as \ Tx_Oelib_Model_Country . |
16,956 | public function setCountry ( \ Tx_Oelib_Model_Country $ country = null ) { $ countryCode = ( $ country !== null ) ? $ country -> getIsoAlpha3Code ( ) : '' ; $ this -> setAsString ( 'static_info_country' , $ countryCode ) ; } | Sets the country of this user . |
16,957 | public function search ( $ interval ) { if ( is_null ( $ this -> top_node ) ) { return array ( ) ; } $ result = $ this -> find_intervals ( $ interval ) ; $ result = array_values ( $ result ) ; usort ( $ result , function ( RangeInterface $ a , RangeInterface $ b ) { $ x = $ a -> getStart ( ) ; $ y = $ b -> getStart ( )... | Search for ranges that overlap the specified value or range . |
16,958 | public function post ( $ url , $ requestBody = null ) { $ posturl = $ this -> url . $ url ; return $ this -> restRequest ( $ posturl , 'POST' , $ requestBody ) ; } | Generic Post Request |
16,959 | public function run ( ) { $ this -> generator -> addRaw ( array ( 'location' => 'example.com' , 'last_modified' => '2013-01-28' , 'change_frequency' => 'weekly' , 'priority' => '0.65' ) ) ; $ this -> generator -> addRaw ( array ( 'location' => 'example.com/test' , 'last_modified' => '2013-12-28' , 'change_frequency' =>... | Run generator commands |
16,960 | public function canBuild ( ) { $ configuration = $ this -> getEmailConfiguration ( ) ; $ emailAddress = ( string ) $ configuration [ 'defaultMailFromAddress' ] ; return \ filter_var ( $ emailAddress , FILTER_VALIDATE_EMAIL ) !== false ; } | Checks whether a valid email address has been set as defaultMailFromAddress . |
16,961 | protected function getCachedRelationCount ( $ propertyName ) { if ( array_key_exists ( $ propertyName , $ this -> cachedRelationCountsCount ) ) { return $ this -> cachedRelationCountsCount [ $ propertyName ] ; } $ this -> cachedRelationCountsCount [ $ propertyName ] = $ this -> getUncachedRelationCount ( $ propertyName... | Retrieves and caches the relation count for the given property . |
16,962 | protected function getUncachedRelationCount ( $ propertyName ) { if ( $ this -> $ propertyName instanceof LazyObjectStorage ) { $ reflectionClass = new \ ReflectionClass ( LazyObjectStorage :: class ) ; $ reflectionProperty = $ reflectionClass -> getProperty ( 'fieldValue' ) ; $ reflectionProperty -> setAccessible ( tr... | Retrieves the relation count for the given property . |
16,963 | public function getPageUid ( ) { switch ( $ this -> getCurrentSource ( ) ) { case self :: SOURCE_MANUAL : $ result = $ this -> storedPageUid ; break ; case self :: SOURCE_FRONT_END : $ result = ( int ) $ this -> getFrontEndController ( ) -> id ; break ; case self :: SOURCE_BACK_END : $ result = ( int ) GeneralUtility :... | Returns the UID of the current page . |
16,964 | public function getCurrentSource ( ) { if ( $ this -> manualPageUidSource !== self :: SOURCE_AUTO ) { $ result = $ this -> manualPageUidSource ; } elseif ( $ this -> hasManualPageUid ( ) ) { $ result = self :: SOURCE_MANUAL ; } elseif ( $ this -> hasFrontEnd ( ) ) { $ result = self :: SOURCE_FRONT_END ; } elseif ( $ th... | Returns the current source for the page UID . |
16,965 | public static function pickView ( $ stack ) { $ viewRoot = trailingslashit ( Paths :: views ( ) ) ; foreach ( $ stack as $ id ) { $ innerPath = str_replace ( '.' , '/' , $ id ) ; $ innerPath .= '.blade.php' ; if ( file_exists ( $ viewRoot . $ innerPath ) ) return $ id ; } return null ; } | Pick the first view found in the stack |
16,966 | public static function mainPageTitle ( ) { if ( is_home ( ) ) { if ( get_option ( 'page_for_posts' , true ) ) { return get_the_title ( get_option ( 'page_for_posts' , true ) ) ; } else { return __ ( 'Latest Posts' , 'baobab' ) ; } } elseif ( is_archive ( ) ) { $ term = get_term_by ( 'slug' , get_query_var ( 'term' ) , ... | You can use this to output a proper title for your page . This handles special cases such as archive page titles taxonomy archives etc . |
16,967 | protected function buildDataTablesCountExported ( DataTablesProviderInterface $ dtProvider ) { $ prefix = $ dtProvider -> getPrefix ( ) ; $ qb = $ this -> createQueryBuilder ( $ prefix ) -> select ( "COUNT(" . $ prefix . ")" ) ; return $ qb ; } | Build a query builder Count exported . |
16,968 | protected function buildDataTablesCountFiltered ( DataTablesWrapperInterface $ dtWrapper ) { $ prefix = $ dtWrapper -> getMapping ( ) -> getPrefix ( ) ; $ qb = $ this -> createQueryBuilder ( $ prefix ) -> select ( "COUNT(" . $ prefix . ")" ) ; DataTablesRepositoryHelper :: appendWhere ( $ qb , $ dtWrapper ) ; return $ ... | Build a query builder Count filtered . |
16,969 | protected function buildDataTablesCountTotal ( DataTablesWrapperInterface $ dtWrapper ) { $ prefix = $ dtWrapper -> getMapping ( ) -> getPrefix ( ) ; $ qb = $ this -> createQueryBuilder ( $ prefix ) -> select ( "COUNT(" . $ prefix . ")" ) ; return $ qb ; } | Build a query builder Count total . |
16,970 | protected function buildDataTablesFindAll ( DataTablesWrapperInterface $ dtWrapper ) { $ prefix = $ dtWrapper -> getMapping ( ) -> getPrefix ( ) ; $ qb = $ this -> createQueryBuilder ( $ prefix ) -> setFirstResult ( $ dtWrapper -> getRequest ( ) -> getStart ( ) ) ; if ( 0 < $ dtWrapper -> getRequest ( ) -> getLength ( ... | Build a query builder Find all . |
16,971 | public static function isWindows ( Request $ request ) { if ( false === $ request -> headers -> has ( "user-agent" ) ) { return false ; } $ dd = new DeviceDetector ( $ request -> headers -> get ( "user-agent" ) ) ; $ dd -> parse ( ) ; $ os = $ dd -> getOs ( "name" ) ; return 1 === preg_match ( "/Windows/" , $ os ) ; } | Determines if the operating system is windows . |
16,972 | public function generateNonceField ( $ action ) { $ nonceName = $ this -> namespace . '_' . $ action ; return wp_nonce_field ( md5 ( $ nonceName ) , $ nonceName , true , false ) ; } | Get the HTML hidden field to print in your form to protect it |
16,973 | protected function getCacheTagsAndLifetime ( ) { $ lifetime = null ; $ tags = array ( ) ; $ entriesMetadata = $ this -> contentCacheFrontend -> getAllMetadata ( ) ; foreach ( $ entriesMetadata as $ identifier => $ metadata ) { $ entryTags = isset ( $ metadata [ 'tags' ] ) ? $ metadata [ 'tags' ] : array ( ) ; $ entryLi... | Get cache tags and lifetime from the cache metadata that was extracted by the special cache frontend |
16,974 | public function banAll ( $ domains = null , $ contentType = null ) { $ this -> cacheInvalidator -> invalidateRegex ( '.*' , $ contentType , $ domains ) ; $ this -> logger -> log ( sprintf ( 'Cleared all Varnish cache%s%s' , $ domains ? ' for domains "' . ( is_array ( $ domains ) ? implode ( ', ' , $ domains ) : $ domai... | Clear all cache in Varnish for a optionally given domain & content type . |
16,975 | public function banByTags ( array $ tags , $ domains = null ) { if ( count ( $ this -> settings [ 'ignoredCacheTags' ] ) > 0 ) { $ tags = array_diff ( $ tags , $ this -> settings [ 'ignoredCacheTags' ] ) ; } foreach ( $ tags as $ key => $ tag ) { $ tags [ $ key ] = strtr ( $ tag , '.:' , '_-' ) ; } if ( $ domains ) { $... | Clear all cache in Varnish for given tags . |
16,976 | protected function addFallthroughRoute ( $ controller , $ uri ) { $ missing = $ this -> any ( $ uri . '/{_missing}' , $ controller . '@missingMethod' ) ; $ missing -> where ( '_missing' , '(.*)' ) ; } | Add a fallthrough route for a controller . |
16,977 | public static function select ( $ fields , $ tableNames , $ whereClause = '' , $ groupBy = '' , $ orderBy = '' , $ limit = '' ) { if ( $ tableNames === '' ) { throw new \ InvalidArgumentException ( 'The table names must not be empty.' , 1331488261 ) ; } if ( $ fields === '' ) { throw new \ InvalidArgumentException ( '$... | Executes a SELECT query . |
16,978 | public static function selectSingle ( $ fields , $ tableNames , $ whereClause = '' , $ groupBy = '' , $ orderBy = '' , $ offset = 0 ) { $ result = self :: selectMultiple ( $ fields , $ tableNames , $ whereClause , $ groupBy , $ orderBy , $ offset . ',' . 1 ) ; if ( empty ( $ result ) ) { throw new \ Tx_Oelib_Exception_... | Executes a SELECT query and returns the single result row as an associative array . |
16,979 | public static function selectMultiple ( $ fieldNames , $ tableNames , $ whereClause = '' , $ groupBy = '' , $ orderBy = '' , $ limit = '' ) { $ result = [ ] ; $ dbResult = self :: select ( $ fieldNames , $ tableNames , $ whereClause , $ groupBy , $ orderBy , $ limit ) ; $ databaseConnection = self :: getDatabaseConnect... | Executes a SELECT query and returns the result rows as a two - dimensional associative array . |
16,980 | public function generate ( ) { $ this -> loadWebmasterTags ( ) ; $ title = $ this -> getTitle ( ) ; $ description = $ this -> getDescription ( ) ; $ keywords = $ this -> getKeywords ( ) ; $ metatags = $ this -> metatags ; $ html = array ( ) ; $ html [ ] = "<title>$title</title>" ; $ html [ ] = sprintf ( '<meta name="de... | Render the meta tags . |
16,981 | public function fromObject ( MetaAware $ object ) { $ data = $ object -> getMetaData ( ) ; if ( array_key_exists ( 'title' , $ data ) ) { $ this -> setTitle ( $ data [ 'title' ] ) ; } if ( array_key_exists ( 'description' , $ data ) ) { $ this -> setDescription ( $ data [ 'description' ] ) ; } if ( array_key_exists ( '... | Use the meta data of a MetaAware object . |
16,982 | public function setTitle ( $ title ) { $ title = strip_tags ( $ title ) ; $ this -> title_session = $ title ; $ this -> title = $ title . $ this -> getDefault ( 'separator' ) . $ this -> getDefault ( 'title' ) ; } | Set the Meta title . |
16,983 | public function setDescription ( $ description ) { $ description = strip_tags ( $ description ) ; if ( mb_strlen ( $ description ) > 160 ) { $ description = mb_substr ( $ description , 0 , 160 ) ; } $ this -> description = $ description ; } | Set the Meta description . |
16,984 | public function getKeywords ( ) { $ keywords = $ this -> keywords ? : $ this -> getDefault ( 'keywords' ) ; return ( is_array ( $ keywords ) ) ? implode ( ', ' , $ keywords ) : $ keywords ; } | Get the Meta keywords . |
16,985 | public function loadWebmasterTags ( ) { foreach ( $ this -> webmaster as $ name => $ value ) : if ( ! empty ( $ value ) ) : $ meta = array_get ( self :: $ webmasterTags , $ name , $ name ) ; $ this -> addMeta ( $ meta , $ value ) ; endif ; endforeach ; } | Load Webmaster tags |
16,986 | public function getLastVisited ( $ locale = null , $ query = null ) { $ query = $ this -> determineLocaleAndQuery ( $ locale , $ query ) ; $ lastVisited = $ query -> orderBy ( 'created_at' , 'desc' ) -> first ( ) ; return $ lastVisited ? $ lastVisited -> created_at : null ; } | Returns the last visited date |
16,987 | public function getTotalVisitCount ( $ locale = null , $ query = null ) { $ query = $ this -> determineLocaleAndQuery ( $ locale , $ query ) ; return $ query -> count ( ) ; } | Gets the total visit count |
16,988 | public function getTodayCount ( $ locale = null , $ query = null ) { $ query = $ this -> determineLocaleAndQuery ( $ locale , $ query ) ; return $ query -> where ( 'created_at' , '>=' , Carbon :: today ( ) ) -> count ( ) ; } | Gets today s visit count |
16,989 | public function getCountInBetween ( Carbon $ from , Carbon $ until = null , $ locale = null , $ query = null , $ cacheKey = null ) { if ( is_null ( $ until ) ) { $ until = Carbon :: now ( ) ; } if ( ! is_null ( $ cacheKey ) ) { $ count = $ this -> getCachedCountBetween ( $ from , $ until , $ locale , $ cacheKey ) ; if ... | Gets visit count in between dates |
16,990 | protected function getCachedCountBetween ( Carbon $ from , Carbon $ until , $ locale , $ cacheKey ) { $ key = $ this -> makeBetweenCacheKey ( $ from , $ until , $ locale , $ cacheKey ) ; return $ this -> cache -> get ( $ key ) ; } | Gets the cached count if there is any |
16,991 | protected function cacheCountBetween ( $ count , Carbon $ from , Carbon $ until , $ locale , $ cacheKey ) { if ( $ cacheKey && ( $ until -> timestamp < Carbon :: now ( ) -> timestamp ) ) { $ key = $ this -> makeBetweenCacheKey ( $ from , $ until , $ locale , $ cacheKey ) ; $ this -> cache -> put ( $ key , $ count , 525... | Caches count between if cacheKey is present |
16,992 | protected function makeBetweenCacheKey ( Carbon $ from , Carbon $ until , $ locale , $ cacheKey ) { $ key = 'tracker.between.' . $ cacheKey . '.' ; $ key .= ( is_null ( $ locale ) ? '' : $ locale . '.' ) ; return $ key . $ from -> timestamp . '-' . $ until -> timestamp ; } | Makes the cache key |
16,993 | public function getRelativeYearCount ( $ end = null , $ locale = null , $ query = null , $ cacheKey = null ) { if ( is_null ( $ end ) ) { $ end = Carbon :: today ( ) ; } return $ this -> getCountInBetween ( $ end -> copy ( ) -> subYear ( ) -> startOfDay ( ) , $ end -> endOfDay ( ) , $ locale , $ query , $ cacheKey ) ; ... | Get relative year visit count |
16,994 | public function getRelativeMonthCount ( $ end = null , $ locale = null , $ query = null , $ cacheKey = null ) { if ( is_null ( $ end ) ) { $ end = Carbon :: today ( ) ; } return $ this -> getCountInBetween ( $ end -> copy ( ) -> subMonth ( ) -> addDay ( ) -> startOfDay ( ) , $ end -> endOfDay ( ) , $ locale , $ query ,... | Get relative month visit count |
16,995 | public function getRelativeWeekCount ( $ end = null , $ locale = null , $ query = null , $ cacheKey = null ) { if ( is_null ( $ end ) ) { $ end = Carbon :: today ( ) ; } return $ this -> getCountInBetween ( $ end -> copy ( ) -> subWeek ( ) -> addDay ( ) -> startOfDay ( ) , $ end -> endOfDay ( ) , $ locale , $ query , $... | Get relative week visit count |
16,996 | public function getRelativeDayCount ( $ end = null , $ locale = null , $ query = null , $ cacheKey = null ) { if ( is_null ( $ end ) ) { $ end = Carbon :: today ( ) ; } return $ this -> getCountInBetween ( $ end , $ end -> copy ( ) -> endOfDay ( ) , $ locale , $ query , $ cacheKey ) ; } | Get relative day visit count |
16,997 | public function getCountForDay ( Carbon $ day = null , $ locale = null , $ query = null , $ cacheKey = null ) { if ( is_null ( $ day ) ) { $ day = Carbon :: now ( ) ; } return $ this -> getCountInBetween ( $ day -> startOfDay ( ) , $ day -> copy ( ) -> endOfDay ( ) , $ locale , $ query , $ cacheKey ) ; } | Gets count for given day |
16,998 | public function getCountPerMonth ( Carbon $ from , Carbon $ until = null , $ locale = null , $ query = null , $ cacheKey = null ) { return $ this -> getCountPer ( 'Month' , $ from , $ until , $ locale , $ query , $ cacheKey ) ; } | Get count per month in between |
16,999 | protected function getCountPer ( $ span , Carbon $ from , Carbon $ until = null , $ locale = null , $ query = null , $ cacheKey = null ) { $ query = $ this -> determineLocaleAndQuery ( $ locale , $ query ) ; $ statistics = [ ] ; $ labels = [ ] ; if ( is_null ( $ until ) ) { $ until = Carbon :: now ( ) ; } $ until -> { ... | Gets count per timespan |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.