idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
24,000 | public function getAnnotationCountForDates ( $ idSite , $ date , $ period , $ lastN = false , $ getAnnotationText = false ) { Piwik :: checkUserHasViewAccess ( $ idSite ) ; list ( $ startDate , $ endDate ) = self :: getDateRangeForPeriod ( $ date , $ period , $ lastN ) ; if ( $ period == 'range' ) { $ period = 'day' ; ... | Returns the count of annotations for a list of periods including the count of starred annotations . |
24,001 | public static function getDateRangeForPeriod ( $ date , $ period , $ lastN = false ) { if ( $ date === false ) { return array ( false , false ) ; } $ isMultiplePeriod = Range :: isMultiplePeriod ( $ date , $ period ) ; if ( $ period == 'range' ) { $ oPeriod = new Range ( 'day' , $ date ) ; $ startDate = $ oPeriod -> ge... | Returns start & end dates for the range described by a period and optional lastN argument . |
24,002 | private function checkDateIsValid ( $ date , $ canBeNull = false ) { if ( $ date === null && $ canBeNull ) { return ; } Date :: factory ( $ date ) ; } | Utility function makes sure date string is valid date and throws if otherwise . |
24,003 | protected function _throw ( $ file , $ errorType ) { $ this -> _value = $ file [ 'name' ] ; switch ( $ errorType ) { case Zend_Validate_File_MimeType :: FALSE_TYPE : $ errorType = self :: FALSE_TYPE ; break ; case Zend_Validate_File_MimeType :: NOT_DETECTED : $ errorType = self :: NOT_DETECTED ; break ; case Zend_Valid... | Throws an error of the given type Duplicates parent method due to OOP Problem with late static binding in PHP 5 . 2 |
24,004 | public static function deleteArchiveTables ( ) { foreach ( ArchiveTableCreator :: getTablesArchivesInstalled ( ) as $ table ) { Log :: debug ( "Dropping table $table" ) ; Db :: query ( "DROP TABLE IF EXISTS `$table`" ) ; } ArchiveTableCreator :: refreshTableList ( $ forceReload = true ) ; } | Deletes archive tables . For use in tests . |
24,005 | public function setElementTemplateForGroupClass ( $ groupClass , $ elementClass , $ template ) { $ this -> elementTemplatesForGroupClass [ strtolower ( $ groupClass ) ] [ strtolower ( $ elementClass ) ] = $ template ; return $ this ; } | Sets grouped elements templates using group class |
24,006 | public function setElementTemplateForGroupId ( $ groupId , $ elementClass , $ template ) { $ this -> elementTemplatesForGroupId [ $ groupId ] [ strtolower ( $ elementClass ) ] = $ template ; return $ this ; } | Sets grouped elements templates using group id |
24,007 | public function reset ( ) { $ this -> html = array ( array ( ) ) ; $ this -> hiddenHtml = '' ; $ this -> errors = array ( ) ; $ this -> hasRequired = false ; $ this -> groupId = array ( ) ; return $ this ; } | Resets the accumulated data |
24,008 | public function renderElement ( HTML_QuickForm2_Node $ element ) { $ elTpl = $ this -> prepareTemplate ( $ this -> findTemplate ( $ element ) , $ element ) ; $ this -> html [ count ( $ this -> html ) - 1 ] [ ] = str_replace ( array ( '{element}' , '{id}' ) , array ( $ element , $ element -> getId ( ) ) , $ elTpl ) ; } | Renders a generic element |
24,009 | public function renderHidden ( HTML_QuickForm2_Node $ element ) { if ( $ this -> options [ 'group_hiddens' ] ) { $ this -> hiddenHtml .= $ element -> __toString ( ) ; } else { $ this -> html [ count ( $ this -> html ) - 1 ] [ ] = str_replace ( '{element}' , $ element , $ this -> findTemplate ( $ element ) ) ; } } | Renders a hidden element |
24,010 | public function finishContainer ( HTML_QuickForm2_Node $ container ) { array_pop ( $ this -> groupId ) ; $ cTpl = str_replace ( array ( '{attributes}' , '{id}' ) , array ( $ container -> getAttributes ( true ) , $ container -> getId ( ) ) , $ this -> prepareTemplate ( $ this -> findTemplate ( $ container , '{content}' ... | Finishes rendering a generic container called after processing contained elements |
24,011 | public function finishGroup ( HTML_QuickForm2_Node $ group ) { $ gTpl = str_replace ( array ( '{attributes}' , '{id}' ) , array ( $ group -> getAttributes ( true ) , array_pop ( $ this -> groupId ) ) , $ this -> prepareTemplate ( $ this -> findTemplate ( $ group , '{content}' ) , $ group ) ) ; $ separator = $ group -> ... | Finishes rendering a group called after processing grouped elements |
24,012 | public function finishForm ( HTML_QuickForm2_Node $ form ) { $ formTpl = str_replace ( array ( '{attributes}' , '{hidden}' , '{errors}' ) , array ( $ form -> getAttributes ( true ) , $ this -> hiddenHtml , $ this -> outputGroupedErrors ( ) ) , $ this -> findTemplate ( $ form , '{content}' ) ) ; $ this -> hiddenHtml = '... | Finishes rendering a form called after processing contained elements |
24,013 | public function outputGroupedErrors ( ) { if ( empty ( $ this -> errors ) ) { return '' ; } if ( ! empty ( $ this -> options [ 'errors_prefix' ] ) ) { $ errorHtml = str_replace ( array ( '<qf:message>' , '</qf:message>' , '{message}' ) , array ( '' , '' , $ this -> options [ 'errors_prefix' ] ) , $ this -> templatesFor... | Creates a error list if group_errors option is true |
24,014 | public function findTemplate ( HTML_QuickForm2_Node $ element , $ default = '{element}' ) { if ( ! empty ( $ this -> templatesForId [ $ element -> getId ( ) ] ) ) { return $ this -> templatesForId [ $ element -> getId ( ) ] ; } $ class = strtolower ( get_class ( $ element ) ) ; $ groupId = end ( $ this -> groupId ) ; $... | Finds a proper template for the element |
24,015 | public function markRequired ( $ elTpl , $ required ) { if ( $ required ) { $ this -> hasRequired = true ; $ elTpl = str_replace ( array ( '<qf:required>' , '</qf:required>' ) , array ( '' , '' ) , $ elTpl ) ; } else { $ elTpl = preg_replace ( '!<qf:required>.*</qf:required>!isU' , '' , $ elTpl ) ; } return $ elTpl ; } | Marks element required or removes required block |
24,016 | public function outputError ( $ elTpl , $ error ) { if ( $ error && ! $ this -> options [ 'group_errors' ] ) { $ elTpl = str_replace ( array ( '<qf:error>' , '</qf:error>' , '{error}' ) , array ( '' , '' , $ error ) , $ elTpl ) ; } else { if ( $ error && $ this -> options [ 'group_errors' ] ) { $ this -> errors [ ] = $... | Outputs element error removes empty error blocks |
24,017 | public function getWidgetConfigs ( ) { $ widgetClasses = $ this -> getAllWidgetClassNames ( ) ; $ configs = array ( ) ; Piwik :: postEvent ( 'Widget.addWidgetConfigs' , array ( & $ configs ) ) ; foreach ( $ widgetClasses as $ widgetClass ) { $ configs [ ] = $ this -> getWidgetConfigForClassName ( $ widgetClass ) ; } re... | Get all existing widget configs . |
24,018 | public function getWidgetContainerConfigs ( ) { $ configs = array ( ) ; $ widgetContainerConfigs = $ this -> getAllWidgetContainerConfigClassNames ( ) ; foreach ( $ widgetContainerConfigs as $ widgetClass ) { $ configs [ ] = StaticContainer :: get ( $ widgetClass ) ; } return $ configs ; } | Get all existing widget container configs . |
24,019 | public function factory ( $ module , $ action ) { if ( empty ( $ module ) || empty ( $ action ) ) { return ; } try { if ( ! $ this -> pluginManager -> isPluginActivated ( $ module ) ) { return ; } $ plugin = $ this -> pluginManager -> getLoadedPlugin ( $ module ) ; } catch ( \ Exception $ e ) { return ; } $ widgets = $... | Get the widget defined by the given module and action . |
24,020 | public function logCurrentUserLastSeenTime ( ) { $ module = Common :: getRequestVar ( 'module' , false ) ; $ currentUserLogin = Piwik :: getCurrentUserLogin ( ) ; if ( $ module == 'API' || $ module == 'Proxy' || Piwik :: isUserIsAnonymous ( ) ) { return ; } $ optionName = self :: OPTION_PREFIX . $ currentUserLogin ; $ ... | Saves the current time for a user as an option if the current request is for something in the reporting UI the current user is not anonymous and the time hasn t been saved in the last 5 minutes . |
24,021 | public static function build ( $ idSites , $ period , $ strDate , $ segment = false , $ _restrictSitesToLogin = false ) { return StaticContainer :: get ( ArchiveQueryFactory :: class ) -> build ( $ idSites , $ period , $ strDate , $ segment , $ _restrictSitesToLogin ) ; } | Returns a new Archive instance that will query archive data for the given set of sites and periods using an optional Segment . |
24,022 | public static function factory ( Segment $ segment , array $ periods , array $ idSites , $ idSiteIsAll = false , $ isMultipleDate = false ) { return StaticContainer :: get ( ArchiveQueryFactory :: class ) -> factory ( $ segment , $ periods , $ idSites , $ idSiteIsAll , $ isMultipleDate ) ; } | Returns a new Archive instance that will query archive data for the given set of sites and periods using an optional segment . |
24,023 | public function getNumeric ( $ names ) { $ data = $ this -> get ( $ names , 'numeric' ) ; $ resultIndices = $ this -> getResultIndices ( ) ; $ result = $ data -> getIndexedArray ( $ resultIndices ) ; if ( empty ( $ resultIndices ) && count ( $ result ) <= 1 && ( ! is_array ( $ names ) || count ( $ names ) == 1 ) ) { $ ... | Queries and returns metric data in an array . |
24,024 | public function getDataTableFromNumeric ( $ names ) { $ data = $ this -> get ( $ names , 'numeric' ) ; return $ data -> getDataTable ( $ this -> getResultIndices ( ) ) ; } | Queries and returns metric data in a DataTable instance . |
24,025 | public function getDataTable ( $ name , $ idSubtable = null ) { $ data = $ this -> get ( $ name , 'blob' , $ idSubtable ) ; return $ data -> getDataTable ( $ this -> getResultIndices ( ) ) ; } | Queries and returns one or more reports as DataTable instances . |
24,026 | public function getDataTableExpanded ( $ name , $ idSubtable = null , $ depth = null , $ addMetadataSubtableId = true ) { $ data = $ this -> get ( $ name , 'blob' , self :: ID_SUBTABLE_LOAD_ALL_SUBTABLES ) ; return $ data -> getExpandedDataTable ( $ this -> getResultIndices ( ) , $ idSubtable , $ depth , $ addMetadataS... | Queries and returns one report with all of its subtables loaded . |
24,027 | private function getRequestedPlugins ( $ archiveNames ) { $ result = array ( ) ; foreach ( $ archiveNames as $ name ) { $ result [ ] = self :: getPluginForReport ( $ name ) ; } return array_unique ( $ result ) ; } | Returns the list of plugins that archive the given reports . |
24,028 | public static function createDataTableFromArchive ( $ recordName , $ idSite , $ period , $ date , $ segment , $ expanded = false , $ flat = false , $ idSubtable = null , $ depth = null ) { Piwik :: checkUserHasViewAccess ( $ idSite ) ; if ( $ flat && ! $ idSubtable ) { $ expanded = true ; } $ archive = Archive :: build... | Helper function that creates an Archive instance and queries for report data using query parameter data . API methods can use this method to reduce code redundancy . |
24,029 | protected function get ( $ archiveNames , $ archiveDataType , $ idSubtable = null ) { if ( ! is_array ( $ archiveNames ) ) { $ archiveNames = array ( $ archiveNames ) ; } if ( $ idSubtable !== null && $ idSubtable != self :: ID_SUBTABLE_LOAD_ALL_SUBTABLES ) { $ dataNames = array ( ) ; foreach ( $ archiveNames as $ name... | Queries archive tables for data and returns the result . |
24,030 | private function getDoneStringForPlugin ( $ plugin , $ idSites ) { return Rules :: getDoneStringFlagFor ( $ idSites , $ this -> params -> getSegment ( ) , $ this -> getPeriodLabel ( ) , $ plugin ) ; } | Returns the done string flag for a plugin using this instance s segment & periods . |
24,031 | private function getResultIndices ( ) { $ indices = array ( ) ; if ( count ( $ this -> params -> getIdSites ( ) ) > 1 || $ this -> forceIndexedBySite ) { $ indices [ 'site' ] = 'idSite' ; } if ( count ( $ this -> params -> getPeriods ( ) ) > 1 || $ this -> forceIndexedByDate ) { $ indices [ 'period' ] = 'date' ; } retu... | Returns an array describing what metadata to use when indexing a query result . For use with DataCollection . |
24,032 | private function getArchiveGroupOfPlugin ( $ plugin ) { $ periods = $ this -> params -> getPeriods ( ) ; $ periodLabel = reset ( $ periods ) -> getLabel ( ) ; if ( Rules :: shouldProcessReportsAllPlugins ( $ this -> params -> getIdSites ( ) , $ this -> params -> getSegment ( ) , $ periodLabel ) ) { return self :: ARCHI... | Returns the archiving group identifier given a plugin . |
24,033 | public static function getPluginForReport ( $ report ) { if ( in_array ( $ report , Metrics :: getVisitsMetricNames ( ) ) ) { $ report = 'VisitsSummary_CoreMetrics' ; } elseif ( strpos ( $ report , 'Goal_' ) === 0 ) { $ report = 'Goals_Metrics' ; } elseif ( strrpos ( $ report , '_returning' ) === strlen ( $ report ) - ... | Returns the name of the plugin that archives a given report . |
24,034 | public function setTable ( Zend_Db_Table_Abstract $ table ) { $ this -> _table = $ table ; $ this -> _connected = false ; foreach ( $ this as $ row ) { $ connected = $ row -> setTable ( $ table ) ; if ( $ connected == true ) { $ this -> _connected = true ; } } return $ this -> _connected ; } | Set the table object to re - establish a live connection to the database for a Rowset that has been de - serialized . |
24,035 | public function toArray ( ) { foreach ( $ this -> _rows as $ i => $ row ) { $ this -> _data [ $ i ] = $ row -> toArray ( ) ; } return $ this -> _data ; } | Returns all data as an array . |
24,036 | public function set12HourClock ( $ login , $ use12HourClock ) { $ query = 'INSERT INTO ' . $ this -> table . ' (login, use_12_hour_clock) VALUES (?,?) ON DUPLICATE KEY UPDATE use_12_hour_clock=?' ; $ bind = array ( $ login , $ use12HourClock , $ use12HourClock ) ; Db :: query ( $ query , $ bind ) ; return true ; } | Sets whether the given user wants to use 12 hout clock |
24,037 | private function makeRegionCityLabelsUnique ( & $ row ) { foreach ( $ this -> dimensions as $ column ) { $ row [ $ column ] = str_replace ( self :: LOCATION_SEPARATOR , '' , $ row [ $ column ] ) ; } if ( ! empty ( $ row [ self :: REGION_FIELD ] ) ) { $ row [ self :: REGION_FIELD ] = $ row [ self :: REGION_FIELD ] . sel... | Makes sure the region and city of a query row are unique . |
24,038 | protected function loadSubtable ( $ dataTable , $ row ) { if ( ! ( $ this -> apiModule && $ this -> apiMethod && count ( $ this -> request ) ) ) { return null ; } $ request = $ this -> request ; $ idSubTable = $ row -> getIdSubDataTable ( ) ; if ( $ idSubTable === null ) { return null ; } $ request [ 'idSubtable' ] = $... | Load the subtable for a row . Returns null if none is found . |
24,039 | protected function getApiMethodForSubtable ( $ request ) { if ( ! $ this -> apiMethodForSubtable ) { if ( ! empty ( $ request [ 'idSite' ] ) ) { $ idSite = $ request [ 'idSite' ] ; } else { $ idSite = 'all' ; } $ apiParameters = array ( ) ; $ entityNames = StaticContainer :: get ( 'entities.idNames' ) ; foreach ( $ ent... | Extract the API method for loading subtables from the meta data |
24,040 | private function getHost ( $ ipStr ) { $ ip = IP :: fromStringIP ( $ ipStr ) ; $ host = $ ip -> getHostname ( ) ; $ host = ( $ host === null ? $ ipStr : $ host ) ; return trim ( strtolower ( $ host ) ) ; } | Returns the hostname given the IP address string |
24,041 | public function hasCache ( $ name ) { if ( isset ( $ this -> _caches [ $ name ] ) || $ this -> hasCacheTemplate ( $ name ) ) { return true ; } return false ; } | Check if the Cache Manager contains the named cache object or a named configuration template to lazy load the cache object |
24,042 | public function getCache ( $ name ) { if ( isset ( $ this -> _caches [ $ name ] ) ) { return $ this -> _caches [ $ name ] ; } if ( isset ( $ this -> _optionTemplates [ $ name ] ) ) { if ( $ name == self :: PAGECACHE && ( ! isset ( $ this -> _optionTemplates [ $ name ] [ 'backend' ] [ 'options' ] [ 'tag_cache' ] ) || ! ... | Fetch the named cache object or instantiate and return a cache object using a named configuration template |
24,043 | public function getCaches ( ) { $ caches = $ this -> _caches ; foreach ( $ this -> _optionTemplates as $ name => $ tmp ) { if ( ! isset ( $ caches [ $ name ] ) ) { $ caches [ $ name ] = $ this -> getCache ( $ name ) ; } } return $ caches ; } | Fetch all available caches |
24,044 | public function setCacheTemplate ( $ name , $ options ) { if ( $ options instanceof Zend_Config ) { $ options = $ options -> toArray ( ) ; } elseif ( ! is_array ( $ options ) ) { throw new Zend_Cache_Exception ( 'Options passed must be in' . ' an associative array or instance of Zend_Config' ) ; } $ this -> _optionTemp... | Set a named configuration template from which a cache object can later be lazy loaded |
24,045 | public function setTemplateOptions ( $ name , $ options ) { if ( $ options instanceof Zend_Config ) { $ options = $ options -> toArray ( ) ; } elseif ( ! is_array ( $ options ) ) { throw new Zend_Cache_Exception ( 'Options passed must be in' . ' an associative array or instance of Zend_Config' ) ; } if ( ! isset ( $ th... | Pass an array containing changes to be applied to a named configuration template |
24,046 | protected function _mergeOptions ( array $ current , array $ options ) { if ( isset ( $ options [ 'frontend' ] [ 'name' ] ) ) { $ current [ 'frontend' ] [ 'name' ] = $ options [ 'frontend' ] [ 'name' ] ; } if ( isset ( $ options [ 'backend' ] [ 'name' ] ) ) { $ current [ 'backend' ] [ 'name' ] = $ options [ 'backend' ]... | Simple method to merge two configuration arrays |
24,047 | protected function _toByteString ( $ size ) { $ sizes = array ( 'B' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ) ; for ( $ i = 0 ; $ size >= 1024 && $ i < 9 ; $ i ++ ) { $ size /= 1024 ; } return round ( $ size , 2 ) . $ sizes [ $ i ] ; } | Returns the formatted size |
24,048 | protected function _fromByteString ( $ size ) { if ( is_numeric ( $ size ) ) { return ( integer ) $ size ; } $ type = trim ( substr ( $ size , - 2 , 1 ) ) ; $ value = substr ( $ size , 0 , - 1 ) ; if ( ! is_numeric ( $ value ) ) { $ value = substr ( $ value , 0 , - 1 ) ; } switch ( strtoupper ( $ type ) ) { case 'Y' : ... | Returns the unformatted size |
24,049 | public function filter ( $ labels , $ dataTable , $ addLabelIndex = false ) { if ( ! is_array ( $ labels ) ) { $ labels = array ( $ labels ) ; } $ this -> labels = $ labels ; $ this -> addLabelIndex = ( bool ) $ addLabelIndex ; return $ this -> manipulate ( $ dataTable ) ; } | Filter a data table by label . The filtered table is returned which might be a new instance . |
24,050 | private function doFilterRecursiveDescend ( $ labelParts , $ dataTable ) { $ dataTable -> rebuildIndex ( ) ; $ labelPart = array_shift ( $ labelParts ) ; $ row = false ; foreach ( $ this -> getLabelVariations ( $ labelPart ) as $ labelPart ) { $ row = $ dataTable -> getRowFromLabel ( $ labelPart ) ; if ( $ row !== fals... | Method for the recursive descend |
24,051 | private function getLabelVariations ( $ originalLabel ) { static $ pageTitleReports = array ( 'getPageTitles' , 'getEntryPageTitles' , 'getExitPageTitles' ) ; $ originalLabel = trim ( $ originalLabel ) ; $ isTerminal = substr ( $ originalLabel , 0 , 1 ) == self :: TERMINAL_OPERATOR ; if ( $ isTerminal ) { $ originalLab... | Use variations of the label to make it easier to specify the desired label |
24,052 | public function delete ( $ idSegment ) { $ segment = $ this -> getSegmentOrFail ( $ idSegment ) ; $ this -> checkUserCanEditOrDeleteSegment ( $ segment ) ; Piwik :: postEvent ( 'SegmentEditor.deactivate' , array ( $ idSegment ) ) ; $ this -> getModel ( ) -> deleteSegment ( $ idSegment ) ; return true ; } | Deletes a stored segment . |
24,053 | public function update ( $ idSegment , $ name , $ definition , $ idSite = false , $ autoArchive = false , $ enabledAllUsers = false ) { $ segment = $ this -> getSegmentOrFail ( $ idSegment ) ; $ this -> checkUserCanEditOrDeleteSegment ( $ segment ) ; $ idSite = $ this -> checkIdSite ( $ idSite ) ; $ this -> checkSegmen... | Modifies an existing stored segment . |
24,054 | public function add ( $ name , $ definition , $ idSite = false , $ autoArchive = false , $ enabledAllUsers = false ) { $ this -> checkUserCanAddNewSegment ( $ idSite ) ; $ idSite = $ this -> checkIdSite ( $ idSite ) ; $ this -> checkSegmentName ( $ name ) ; $ definition = $ this -> checkSegmentValue ( $ definition , $ ... | Adds a new stored segment . |
24,055 | public function get ( $ idSegment ) { Piwik :: checkUserHasSomeViewAccess ( ) ; if ( ! is_numeric ( $ idSegment ) ) { throw new Exception ( "idSegment should be numeric." ) ; } $ segment = $ this -> getModel ( ) -> getSegment ( $ idSegment ) ; if ( empty ( $ segment ) ) { return false ; } try { if ( ! $ segment [ 'enab... | Returns a stored segment by ID |
24,056 | public function setType ( $ type ) { $ allowed = array ( Zend_Mime :: MULTIPART_ALTERNATIVE , Zend_Mime :: MULTIPART_MIXED , Zend_Mime :: MULTIPART_RELATED , ) ; if ( ! in_array ( $ type , $ allowed ) ) { throw new Zend_Mail_Exception ( 'Invalid content type "' . $ type . '"' ) ; } $ this -> _type = $ type ; return $ t... | Set content type |
24,057 | public function setHeaderEncoding ( $ encoding ) { $ allowed = array ( Zend_Mime :: ENCODING_BASE64 , Zend_Mime :: ENCODING_QUOTEDPRINTABLE ) ; if ( ! in_array ( $ encoding , $ allowed ) ) { throw new Zend_Mail_Exception ( 'Invalid encoding "' . $ encoding . '"' ) ; } $ this -> _headerEncoding = $ encoding ; return $ t... | Set the encoding of mail headers |
24,058 | public function setBodyText ( $ txt , $ charset = null , $ encoding = Zend_Mime :: ENCODING_QUOTEDPRINTABLE ) { if ( $ charset === null ) { $ charset = $ this -> _charset ; } $ mp = new Zend_Mime_Part ( $ txt ) ; $ mp -> encoding = $ encoding ; $ mp -> type = Zend_Mime :: TYPE_TEXT ; $ mp -> disposition = Zend_Mime :: ... | Sets the text body for the message . |
24,059 | public function getBodyText ( $ textOnly = false ) { if ( $ textOnly && $ this -> _bodyText ) { $ body = $ this -> _bodyText ; return $ body -> getContent ( ) ; } return $ this -> _bodyText ; } | Return text body Zend_Mime_Part or string |
24,060 | public function getBodyHtml ( $ htmlOnly = false ) { if ( $ htmlOnly && $ this -> _bodyHtml ) { $ body = $ this -> _bodyHtml ; return $ body -> getContent ( ) ; } return $ this -> _bodyHtml ; } | Return Zend_Mime_Part representing body HTML |
24,061 | public function addAttachment ( Zend_Mime_Part $ attachment ) { $ this -> addPart ( $ attachment ) ; $ this -> hasAttachments = true ; return $ this ; } | Adds an existing attachment to the mail message |
24,062 | public function createAttachment ( $ body , $ mimeType = Zend_Mime :: TYPE_OCTETSTREAM , $ disposition = Zend_Mime :: DISPOSITION_ATTACHMENT , $ encoding = Zend_Mime :: ENCODING_BASE64 , $ filename = null ) { $ mp = new Zend_Mime_Part ( $ body ) ; $ mp -> encoding = $ encoding ; $ mp -> type = $ mimeType ; $ mp -> disp... | Creates a Zend_Mime_Part attachment |
24,063 | protected function _encodeHeader ( $ value ) { if ( Zend_Mime :: isPrintable ( $ value ) === false ) { if ( $ this -> getHeaderEncoding ( ) === Zend_Mime :: ENCODING_QUOTEDPRINTABLE ) { $ value = Zend_Mime :: encodeQuotedPrintableHeader ( $ value , $ this -> getCharset ( ) , Zend_Mime :: LINELENGTH , Zend_Mime :: LINEE... | Encode header fields |
24,064 | protected function _storeHeader ( $ headerName , $ value , $ append = false ) { if ( isset ( $ this -> _headers [ $ headerName ] ) ) { $ this -> _headers [ $ headerName ] [ ] = $ value ; } else { $ this -> _headers [ $ headerName ] = array ( $ value ) ; } if ( $ append ) { $ this -> _headers [ $ headerName ] [ 'append'... | Add a header to the message |
24,065 | protected function _addRecipientAndHeader ( $ headerName , $ email , $ name ) { $ email = $ this -> _filterEmail ( $ email ) ; $ name = $ this -> _filterName ( $ name ) ; $ this -> _recipients [ $ email ] = 1 ; $ this -> _storeHeader ( $ headerName , $ this -> _formatAddress ( $ email , $ name ) , true ) ; } | Helper function for adding a recipient and the corresponding header |
24,066 | public function clearHeader ( $ headerName ) { if ( isset ( $ this -> _headers [ $ headerName ] ) ) { unset ( $ this -> _headers [ $ headerName ] ) ; } return $ this ; } | Clear header from the message |
24,067 | public function clearRecipients ( ) { $ this -> _recipients = array ( ) ; $ this -> _to = array ( ) ; $ this -> clearHeader ( 'To' ) ; $ this -> clearHeader ( 'Cc' ) ; $ this -> clearHeader ( 'Bcc' ) ; return $ this ; } | Clears list of recipient email addresses |
24,068 | public function setFrom ( $ email , $ name = null ) { if ( null !== $ this -> _from ) { throw new Zend_Mail_Exception ( 'From Header set twice' ) ; } $ email = $ this -> _filterEmail ( $ email ) ; $ name = $ this -> _filterName ( $ name ) ; $ this -> _from = $ email ; $ this -> _storeHeader ( 'From' , $ this -> _format... | Sets From - header and sender of the message |
24,069 | public function setFromToDefaultFrom ( ) { $ from = self :: getDefaultFrom ( ) ; if ( $ from === null ) { throw new Zend_Mail_Exception ( 'No default From Address set to use' ) ; } $ this -> setFrom ( $ from [ 'email' ] , $ from [ 'name' ] ) ; return $ this ; } | Sets From - name and - email based on the defaults |
24,070 | public function setReplyToFromDefault ( ) { $ replyTo = self :: getDefaultReplyTo ( ) ; if ( $ replyTo === null ) { throw new Zend_Mail_Exception ( 'No default Reply-To Address set to use' ) ; } $ this -> setReplyTo ( $ replyTo [ 'email' ] , $ replyTo [ 'name' ] ) ; return $ this ; } | Sets ReplyTo - name and - email based on the defaults |
24,071 | public function setReturnPath ( $ email ) { if ( $ this -> _returnPath === null ) { $ email = $ this -> _filterEmail ( $ email ) ; $ this -> _returnPath = $ email ; $ this -> _storeHeader ( 'Return-Path' , $ email , false ) ; } else { throw new Zend_Mail_Exception ( 'Return-Path Header set twice' ) ; } return $ this ; ... | Sets the Return - Path header of the message |
24,072 | public function setSubject ( $ subject ) { if ( $ this -> _subject === null ) { $ subject = $ this -> _filterOther ( $ subject ) ; $ this -> _subject = $ this -> _encodeHeader ( $ subject ) ; $ this -> _storeHeader ( 'Subject' , $ this -> _subject ) ; } else { throw new Zend_Mail_Exception ( 'Subject set twice' ) ; } r... | Sets the subject of the message |
24,073 | public function setDate ( $ date = null ) { if ( $ this -> _date === null ) { if ( $ date === null ) { $ date = date ( 'r' ) ; } else if ( is_int ( $ date ) ) { $ date = date ( 'r' , $ date ) ; } else if ( is_string ( $ date ) ) { $ date = strtotime ( $ date ) ; if ( $ date === false || $ date < 0 ) { throw new Zend_Ma... | Sets Date - header |
24,074 | public function setMessageId ( $ id = true ) { if ( $ id === null || $ id === false ) { return $ this ; } elseif ( $ id === true ) { $ id = $ this -> createMessageId ( ) ; } if ( $ this -> _messageId === null ) { $ id = $ this -> _filterOther ( $ id ) ; $ this -> _messageId = $ id ; $ this -> _storeHeader ( 'Message-Id... | Sets the Message - ID of the message |
24,075 | public function createMessageId ( ) { $ time = time ( ) ; if ( $ this -> _from !== null ) { $ user = $ this -> _from ; } elseif ( isset ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { $ user = $ _SERVER [ 'REMOTE_ADDR' ] ; } else { $ user = getmypid ( ) ; } $ rand = mt_rand ( ) ; if ( $ this -> _recipients !== array ( ) ) { $ reci... | Creates the Message - ID |
24,076 | public function addHeader ( $ name , $ value , $ append = false ) { $ prohibit = array ( 'to' , 'cc' , 'bcc' , 'from' , 'subject' , 'reply-to' , 'return-path' , 'date' , 'message-id' , ) ; if ( in_array ( strtolower ( $ name ) , $ prohibit ) ) { throw new Zend_Mail_Exception ( 'Cannot set standard header from addHeader... | Add a custom header to the message |
24,077 | public function send ( $ transport = null ) { if ( $ transport === null ) { if ( ! self :: $ _defaultTransport instanceof Zend_Mail_Transport_Abstract ) { $ transport = new Zend_Mail_Transport_Sendmail ( ) ; } else { $ transport = self :: $ _defaultTransport ; } } if ( $ this -> _date === null ) { $ this -> setDate ( )... | Sends this email using the given transport or a previously set DefaultTransport or the internal mail function if no default transport had been set . |
24,078 | protected function _formatAddress ( $ email , $ name ) { if ( $ name === '' || $ name === null || $ name === $ email ) { return $ email ; } else { $ encodedName = $ this -> _encodeHeader ( $ name ) ; if ( $ encodedName === $ name && strcspn ( $ name , '()<>[]:;@\\,' ) != strlen ( $ name ) ) { $ format = '"%s" <%s>' ; }... | Formats e - mail address |
24,079 | public function filter ( $ translations ) { $ cleanedTranslations = array ( ) ; foreach ( $ translations as $ pluginName => $ pluginTranslations ) { if ( empty ( $ this -> baseTranslations [ $ pluginName ] ) ) { $ this -> filteredData [ $ pluginName ] = $ pluginTranslations ; continue ; } foreach ( $ pluginTranslations... | Removes all translations that aren t present in the base translations set in constructor |
24,080 | private function _clean ( $ dir , $ mode ) { $ d = @ dir ( $ dir ) ; if ( ! $ d ) { return false ; } $ result = true ; while ( false !== ( $ file = $ d -> read ( ) ) ) { if ( $ file == '.' || $ file == '..' ) { continue ; } $ file = $ d -> path . $ file ; if ( is_dir ( $ file ) ) { $ result = ( $ this -> _clean ( $ fil... | Clean a directory and recursivly go over it s subdirectories |
24,081 | public function getRank ( $ url ) { Piwik :: checkUserHasSomeViewAccess ( ) ; $ metricProvider = new ProviderCache ( new Aggregator ( ) ) ; $ domain = Url :: getHostFromUrl ( $ url ) ; $ metrics = $ metricProvider -> getMetrics ( $ domain ) ; return $ this -> toDataTable ( $ metrics ) ; } | Returns SEO statistics for a URL . |
24,082 | public static function loadClass ( $ className , $ includeFile = null ) { if ( class_exists ( $ className , false ) || interface_exists ( $ className , false ) ) { return true ; } if ( empty ( $ includeFile ) ) { $ includeFile = str_replace ( '_' , DIRECTORY_SEPARATOR , $ className ) . '.php' ; } include $ includeFile ... | Tries to load a given class |
24,083 | public static function fileExists ( $ fileName ) { $ fp = @ fopen ( $ fileName , 'r' , true ) ; if ( is_resource ( $ fp ) ) { fclose ( $ fp ) ; return true ; } return false ; } | Checks whether the file exists in the include path |
24,084 | public function deleteFromLogTable ( $ tableName , $ visitIds ) { $ sql = "DELETE FROM `" . Common :: prefixTable ( $ tableName ) . "` WHERE idvisit IN " . $ this -> getInFieldExpressionWithInts ( $ visitIds ) ; $ statement = Db :: query ( $ sql ) ; return $ statement -> rowCount ( ) ; } | Deletes conversions for the supplied visit IDs from log_conversion . This method does not cascade so conversion items will not be deleted . |
24,085 | public function deleteConversionItems ( $ visitIds ) { $ sql = "DELETE FROM `" . Common :: prefixTable ( 'log_conversion_item' ) . "` WHERE idvisit IN " . $ this -> getInFieldExpressionWithInts ( $ visitIds ) ; $ statement = Db :: query ( $ sql ) ; return $ statement -> rowCount ( ) ; } | Deletes conversion items for the supplied visit IDs from log_conversion_item . |
24,086 | public function deleteUnusedLogActions ( ) { if ( ! Db :: isLockPrivilegeGranted ( ) ) { throw new \ Exception ( "RawLogDao.deleteUnusedLogActions() requires table locking permission in order to complete without error." ) ; } $ maxIds = $ this -> getMaxIdsInLogTables ( ) ; $ this -> createTempTableForStoringUsedActions... | Deletes all unused entries from the log_action table . This method uses a temporary table to store used actions and then deletes rows from log_action that are not in this temporary table . |
24,087 | public function hasSiteVisitsBetweenTimeframe ( $ fromDateTime , $ toDateTime , $ idSite ) { $ sites = Db :: fetchOne ( "SELECT 1 FROM " . Common :: prefixTable ( 'log_visit' ) . " WHERE idsite = ? AND visit_last_action_time > ? AND visit_last_action_time < ? ... | Returns the list of the website IDs that received some visits between the specified timestamp . |
24,088 | private function createLogIterationQuery ( $ logTable , $ idField , $ fields , $ conditions , $ iterationStep ) { $ bind = array ( ) ; $ sql = "SELECT " . implode ( ', ' , $ fields ) . " FROM `" . Common :: prefixTable ( $ logTable ) . "` WHERE $idField > ?" ; foreach ( $ conditions as $ condition ) { list ( $ column ,... | mapping for dimensions = > segments and each dimension should automatically have a segment . |
24,089 | protected function insertActionsToKeep ( $ maxIds , $ olderThan = true , $ insertIntoTempIterationStep = 100000 ) { $ tempTableName = Common :: prefixTable ( self :: DELETE_UNUSED_ACTIONS_TEMP_TABLE_NAME ) ; $ idColumns = $ this -> getTableIdColumns ( ) ; foreach ( $ this -> dimensionMetadataProvider -> getActionRefere... | protected for testing purposes |
24,090 | private function makeSitesFlatAndApplyGenericFilters ( DataTable $ table , $ request ) { $ filterOffset = $ request [ 'filter_offset' ] ; $ filterLimit = $ request [ 'filter_limit' ] ; unset ( $ request [ 'filter_offset' ] ) ; unset ( $ request [ 'filter_limit' ] ) ; if ( ! empty ( $ request [ 'filter_sort_column' ] ) ... | Makes sure to not have any subtables anymore . |
24,091 | public static function getDoneFlags ( array $ plugins , Segment $ segment ) { $ doneFlags = array ( ) ; $ doneAllPlugins = self :: getDoneFlagArchiveContainsAllPlugins ( $ segment ) ; $ doneFlags [ $ doneAllPlugins ] = $ doneAllPlugins ; $ plugins = array_unique ( $ plugins ) ; foreach ( $ plugins as $ plugin ) { $ don... | Return done flags used to tell how the archiving process for a specific archive was completed |
24,092 | public static function getSelectableDoneFlagValues ( ) { $ possibleValues = array ( ArchiveWriter :: DONE_OK , ArchiveWriter :: DONE_OK_TEMPORARY ) ; if ( ! Rules :: isRequestAuthorizedToArchive ( ) ) { $ possibleValues [ ] = ArchiveWriter :: DONE_INVALIDATED ; } return $ possibleValues ; } | Returns done flag values allowed to be selected |
24,093 | protected function buildTableStructure ( $ table , $ columnToAdd = null , $ valueToAdd = null ) { $ i = $ this -> i ; $ someMetadata = false ; $ someIdSubTable = false ; if ( ! ( $ table instanceof DataTable ) ) { throw new Exception ( "HTML Renderer does not work with this combination of parameters" ) ; } foreach ( $ ... | Adds the given data table to the table structure array |
24,094 | protected function renderDataTable ( ) { $ html = "<table " . ( $ this -> tableId ? "id=\"{$this->tableId}\" " : "" ) . "border=\"1\">\n<thead>\n\t<tr>\n" ; foreach ( $ this -> allColumns as $ name => $ toDisplay ) { if ( $ toDisplay !== false ) { if ( $ name === 0 ) { $ name = 'value' ; } if ( $ this -> translateColum... | Computes the output for the table structure array |
24,095 | public function isSpam ( Request $ request ) { $ spammers = $ this -> getSpammerListFromCache ( ) ; $ referrerUrl = $ request -> getParam ( 'urlref' ) ; foreach ( $ spammers as $ spammerHost ) { if ( stripos ( $ referrerUrl , $ spammerHost ) !== false ) { Common :: printDebug ( 'Referrer URL is a known spam: ' . $ spam... | Check if the request is from a known spammer host . |
24,096 | public function setGetAllHtmlPrefix ( $ referrerType ) { $ indexTranslation = '' ; switch ( $ referrerType ) { case Common :: REFERRER_TYPE_DIRECT_ENTRY : $ indexTranslation = 'Referrers_DirectEntry' ; break ; case Common :: REFERRER_TYPE_SEARCH_ENGINE : $ indexTranslation = 'General_ColumnKeyword' ; break ; case Commo... | DataTable filter callback that returns the HTML prefix for a label in the getAll report based on the row s referrer type . |
24,097 | public static function getSiteIdFromMetadata ( DataTable $ table ) { $ site = $ table -> getMetadata ( 'site' ) ; if ( empty ( $ site ) ) { return null ; } else { return $ site -> getId ( ) ; } } | Returns the ID of the site a table is related to based on the site metadata entry or null if there is none . |
24,098 | public function make ( $ index , $ resultIndices ) { $ keyMetadata = $ this -> getDefaultMetadata ( ) ; if ( empty ( $ resultIndices ) ) { if ( empty ( $ index ) && $ this -> isNumericDataType ( ) ) { $ index = $ this -> defaultRow ; } $ dataTable = $ this -> createDataTable ( $ index , $ keyMetadata ) ; } else { $ dat... | Creates a DataTable|Set instance using an index of archive data . |
24,099 | private function makeFromBlobRow ( $ blobRow , $ keyMetadata ) { if ( $ blobRow === false ) { return new DataTable ( ) ; } if ( count ( $ this -> dataNames ) === 1 ) { return $ this -> makeDataTableFromSingleBlob ( $ blobRow , $ keyMetadata ) ; } else { return $ this -> makeIndexedByRecordNameDataTable ( $ blobRow , $ ... | Creates a DataTable|Set instance using an array of blobs . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.