idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
24,400 | public function insertSiteUrl ( $ idSite , $ url ) { $ db = $ this -> getDb ( ) ; $ db -> insert ( Common :: prefixTable ( "site_url" ) , array ( 'idsite' => ( int ) $ idSite , 'url' => $ url ) ) ; } | Insert the list of alias URLs for the website . The URLs must not exist already for this website! |
24,401 | public function deleteSiteAliasUrls ( $ idsite ) { $ db = $ this -> getDb ( ) ; $ db -> query ( "DELETE FROM " . Common :: prefixTable ( "site_url" ) . " WHERE idsite = ?" , $ idsite ) ; } | Delete all the alias URLs for the given idSite . |
24,402 | protected function _ehlo ( $ host ) { try { $ this -> _send ( 'EHLO ' . $ host ) ; $ this -> _expect ( 250 , 300 ) ; } catch ( Zend_Mail_Protocol_Exception $ e ) { $ this -> _send ( 'HELO ' . $ host ) ; $ this -> _expect ( 250 , 300 ) ; } catch ( Zend_Mail_Protocol_Exception $ e ) { throw $ e ; } } | Send EHLO or HELO depending on capabilities of smtp host |
24,403 | public function mail ( $ from ) { if ( $ this -> _sess !== true ) { throw new Zend_Mail_Protocol_Exception ( 'A valid session has not been started' ) ; } $ this -> _send ( 'MAIL FROM:<' . $ from . '>' ) ; $ this -> _expect ( 250 , 300 ) ; $ this -> _mail = true ; $ this -> _rcpt = false ; $ this -> _data = false ; } | Issues MAIL command |
24,404 | public function rcpt ( $ to ) { if ( $ this -> _mail !== true ) { throw new Zend_Mail_Protocol_Exception ( 'No sender reverse path has been supplied' ) ; } $ this -> _send ( 'RCPT TO:<' . $ to . '>' ) ; $ this -> _expect ( array ( 250 , 251 ) , 300 ) ; $ this -> _rcpt = true ; } | Issues RCPT command |
24,405 | public function data ( $ data ) { if ( $ this -> _rcpt !== true ) { throw new Zend_Mail_Protocol_Exception ( 'No recipient forward path has been supplied' ) ; } $ this -> _send ( 'DATA' ) ; $ this -> _expect ( 354 , 120 ) ; foreach ( explode ( Zend_Mime :: LINEEND , $ data ) as $ line ) { if ( strpos ( $ line , '.' ) =... | Issues DATA command |
24,406 | public function rset ( ) { $ this -> _send ( 'RSET' ) ; $ this -> _expect ( array ( 250 , 220 ) ) ; $ this -> _mail = false ; $ this -> _rcpt = false ; $ this -> _data = false ; } | Issues the RSET command and validates answer |
24,407 | public static function getViewDataTableId ( ) { $ id = static :: ID ; if ( empty ( $ id ) ) { $ message = sprintf ( 'ViewDataTable %s does not define an ID. Set the ID constant to fix this issue' , get_called_class ( ) ) ; throw new \ Exception ( $ message ) ; } return $ id ; } | Returns the viewDataTable ID for this DataTable visualization . |
24,408 | public function isRequestingSingleDataTable ( ) { $ requestArray = $ this -> request -> getRequestArray ( ) + $ _GET + $ _POST ; $ date = Common :: getRequestVar ( 'date' , null , 'string' , $ requestArray ) ; $ period = Common :: getRequestVar ( 'period' , null , 'string' , $ requestArray ) ; $ idSite = Common :: getR... | Returns true if this instance will request a single DataTable false if requesting more than one . |
24,409 | public function & get ( $ name ) { if ( ! isset ( $ this -> mergedSettings [ $ name ] ) ) { $ this -> mergedSettings [ $ name ] = array ( ) ; } $ result = & $ this -> mergedSettings [ $ name ] ; return $ result ; } | Return setting section by reference . |
24,410 | public function dumpChanges ( $ header = '' ) { $ userSettingsFile = $ this -> getUserSettingsFile ( ) ; $ defaultSettings = $ this -> getMergedDefaultSettings ( ) ; $ existingMutableSettings = $ this -> settingsChain [ $ userSettingsFile ] ; $ dirty = false ; $ configToWrite = array ( ) ; foreach ( $ this -> mergedSet... | Writes the difference of the in - memory setting values and the on - disk user settings file setting values to a string in INI format and returns it . |
24,411 | public function reload ( $ defaultSettingsFiles = array ( ) , $ userSettingsFile = null ) { if ( ! empty ( $ defaultSettingsFiles ) || ! empty ( $ userSettingsFile ) ) { $ this -> resetSettingsChain ( $ defaultSettingsFiles , $ userSettingsFile ) ; } $ reader = new IniReader ( ) ; foreach ( $ this -> settingsChain as $... | Reloads settings from disk . |
24,412 | protected function encodeValues ( & $ values ) { if ( is_array ( $ values ) ) { foreach ( $ values as & $ value ) { $ value = $ this -> encodeValues ( $ value ) ; } } elseif ( is_float ( $ values ) ) { $ values = Common :: forceDotAsSeparatorForDecimalPoint ( $ values ) ; } elseif ( is_string ( $ values ) ) { $ values ... | Encode HTML entities |
24,413 | protected function decodeValues ( & $ values ) { if ( is_array ( $ values ) ) { foreach ( $ values as & $ value ) { $ value = $ this -> decodeValues ( $ value ) ; } return $ values ; } elseif ( is_string ( $ values ) ) { return html_entity_decode ( $ values , ENT_COMPAT , 'UTF-8' ) ; } return $ values ; } | Decode HTML entities |
24,414 | public function setToken ( $ token ) { $ this -> _tokenString = ( string ) $ token ; $ this -> _token = $ token ; return $ this ; } | Set token against which to compare |
24,415 | protected function _addLog ( $ value ) { if ( $ this -> _maximumLog >= 0 && count ( $ this -> _log ) >= $ this -> _maximumLog ) { array_shift ( $ this -> _log ) ; } $ this -> _log [ ] = $ value ; } | Add the transaction log |
24,416 | protected function _connect ( $ remote ) { $ errorNum = 0 ; $ errorStr = '' ; $ this -> _socket = @ stream_socket_client ( $ remote , $ errorNum , $ errorStr , self :: TIMEOUT_CONNECTION ) ; if ( $ this -> _socket === false ) { if ( $ errorNum == 0 ) { $ errorStr = 'Could not open socket' ; } throw new Zend_Mail_Protoc... | Connect to the server using the supplied transport and target |
24,417 | protected function _send ( $ request ) { if ( ! is_resource ( $ this -> _socket ) ) { throw new Zend_Mail_Protocol_Exception ( 'No connection has been established to ' . $ this -> _host ) ; } $ this -> _request = $ request ; $ result = fwrite ( $ this -> _socket , $ request . self :: EOL ) ; $ this -> _addLog ( $ reque... | Send the given request followed by a LINEEND to the server . |
24,418 | public function index ( ) { $ view = $ this -> _getDashboardView ( '@Dashboard/index' ) ; $ view -> dashboardSettingsControl = new DashboardManagerControl ( ) ; $ view -> hasSomeAdminAccess = Piwik :: isUserHasSomeAdminAccess ( ) ; $ view -> dashboards = array ( ) ; if ( ! Piwik :: isUserIsAnonymous ( ) ) { $ login = P... | this is the exported widget |
24,419 | public function resetLayout ( ) { $ this -> checkTokenInUrl ( ) ; if ( Piwik :: isUserIsAnonymous ( ) ) { $ session = new SessionNamespace ( "Dashboard" ) ; $ session -> dashboardLayout = $ this -> dashboard -> getDefaultLayout ( ) ; $ session -> setExpirationSeconds ( 1800 ) ; } else { Request :: processRequest ( 'Das... | Resets the dashboard to the default widget configuration |
24,420 | public function getAllDashboards ( ) { $ this -> checkTokenInUrl ( ) ; if ( Piwik :: isUserIsAnonymous ( ) ) { Json :: sendHeaderJSON ( ) ; return '[]' ; } $ login = Piwik :: getCurrentUserLogin ( ) ; $ dashboards = $ this -> dashboard -> getAllDashboards ( $ login ) ; Json :: sendHeaderJSON ( ) ; return json_encode ( ... | Outputs all available dashboards for the current user as a JSON string |
24,421 | public function saveLayout ( ) { $ this -> checkTokenInUrl ( ) ; $ layout = Common :: unsanitizeInputValue ( Common :: getRequestVar ( 'layout' ) ) ; $ layout = strip_tags ( $ layout ) ; $ idDashboard = Common :: getRequestVar ( 'idDashboard' , 1 , 'int' ) ; $ name = Common :: getRequestVar ( 'name' , '' , 'string' ) ;... | Saves the layout for the current user anonymous = in the session authenticated user = in the DB |
24,422 | public function saveLayoutAsDefault ( ) { $ this -> checkTokenInUrl ( ) ; if ( Piwik :: hasUserSuperUserAccess ( ) ) { $ layout = Common :: unsanitizeInputValue ( Common :: getRequestVar ( 'layout' ) ) ; $ layout = strip_tags ( $ layout ) ; $ this -> getModel ( ) -> createOrUpdateDashboard ( '' , '1' , $ layout ) ; } } | Saves the layout as default |
24,423 | public function addTable ( $ table ) { $ this -> nextTableId ++ ; $ this [ $ this -> nextTableId ] = $ table ; return $ this -> nextTableId ; } | Add a DataTable to the registry |
24,424 | public function deleteAll ( $ deleteWhenIdTableGreaterThan = 0 ) { foreach ( $ this as $ id => $ table ) { if ( $ id > $ deleteWhenIdTableGreaterThan ) { $ this -> deleteTable ( $ id ) ; } } if ( $ deleteWhenIdTableGreaterThan == 0 ) { $ this -> exchangeArray ( array ( ) ) ; $ this -> nextTableId = 0 ; } } | Delete all the registered DataTables from the manager |
24,425 | public function dumpAllTables ( ) { echo "<hr />Manager->dumpAllTables()<br />" ; foreach ( $ this as $ id => $ table ) { if ( ! ( $ table instanceof DataTable ) ) { echo "Error table $id is not instance of datatable<br />" ; var_export ( $ table ) ; } else { echo "<hr />" ; echo "Table (index=$id) TableId = " . $ tabl... | Debug only . Dumps all tables currently registered in the Manager |
24,426 | public static function getUnit ( $ column , $ idSite ) { $ nameToUnit = array ( '_rate' => '%' , 'revenue' => Site :: getCurrencySymbolFor ( $ idSite ) , '_time_' => 's' ) ; $ unit = null ; Piwik :: postEvent ( 'Metrics.getEvolutionUnit' , [ & $ unit , $ column , $ idSite ] ) ; if ( ! empty ( $ unit ) ) { return $ unit... | Derive the unit name from a column name |
24,427 | public static function isEnabled ( ) { if ( is_null ( self :: $ isEnabled ) ) { self :: $ isEnabled = ( bool ) Config :: getInstance ( ) -> Development [ 'enabled' ] ; } return self :: $ isEnabled ; } | Returns true if development mode is enabled and false otherwise . |
24,428 | private function truncateSmallValues ( ) { $ metricColumns = array_keys ( $ this -> ordinateSeries ) ; $ metricColumn = $ metricColumns [ 0 ] ; $ ordinateValuesSum = 0 ; foreach ( $ this -> ordinateSeries [ $ metricColumn ] as $ ordinateValue ) { $ ordinateValuesSum += $ ordinateValue ; } $ truncatedOrdinateSeries [ $ ... | this method logic is close to Piwik s core filter_truncate . it uses a threshold to determine if an abscissa value should be drawn on the PIE discarded abscissa values are summed in the other abscissa value |
24,429 | protected function getPersistentContent ( ) { if ( ! $ this -> persistent || null === ( $ value = $ this -> getValue ( ) ) ) { return '' ; } return '<input type="hidden"' . self :: getAttributesString ( array ( 'name' => $ this -> getName ( ) , 'value' => $ value , 'id' => $ this -> getId ( ) ) ) . ' />' ; } | Generates hidden form field containing the element s value |
24,430 | public function render ( HTML_QuickForm2_Renderer $ renderer ) { foreach ( $ this -> rules as $ rule ) { if ( $ rule [ 1 ] & HTML_QuickForm2_Rule :: RUNAT_CLIENT ) { $ renderer -> getJavascriptBuilder ( ) -> addRule ( $ rule [ 0 ] ) ; } } $ renderer -> renderElement ( $ this ) ; return $ renderer ; } | Renders the element using the given renderer |
24,431 | protected function downloadFile ( $ dbType , $ url ) { $ url = trim ( $ url ) ; $ ext = GeoIP2AutoUpdater :: getGeoIPUrlExtension ( $ url ) ; $ zippedFilename = LocationProviderGeoIp2 :: $ dbNames [ $ dbType ] [ 0 ] . '.' . $ ext ; $ zippedOutputPath = LocationProviderGeoIp2 :: getPathForGeoIpDatabase ( $ zippedFilenam... | Downloads a GeoIP 2 database archive extracts the . mmdb file and overwrites the existing old database . |
24,432 | public static function getConfiguredUrls ( ) { $ result = array ( ) ; foreach ( self :: $ urlOptions as $ key => $ optionName ) { $ result [ $ key ] = Option :: get ( $ optionName ) ; } return $ result ; } | Retrieves the URLs used to update various GeoIP 2 database files . |
24,433 | public static function getSchedulePeriod ( ) { $ period = Option :: get ( self :: SCHEDULE_PERIOD_OPTION_NAME ) ; if ( $ period === false ) { $ period = self :: SCHEDULE_PERIOD_MONTHLY ; } return $ period ; } | Returns the configured update period either week or month . Defaults to month . |
24,434 | public static function getGeoIPUrlExtension ( $ url ) { if ( preg_match ( '/suffix=([^&]+)/' , $ url , $ matches ) ) { $ ext = $ matches [ 1 ] ; } else { $ filenameParts = explode ( '.' , basename ( $ url ) , 2 ) ; if ( count ( $ filenameParts ) > 1 ) { $ ext = end ( $ filenameParts ) ; } else { $ ext = reset ( $ filen... | Returns the extension of a URL used to update a GeoIP 2 database if it can be found . |
24,435 | private function getOldAndNewPathsForBrokenDb ( $ possibleDbNames ) { $ pathToDb = LocationProviderGeoIp2 :: getPathToGeoIpDatabase ( $ possibleDbNames ) ; $ newPath = false ; if ( $ pathToDb !== false ) { $ newPath = $ pathToDb . ".broken" ; } return array ( $ pathToDb , $ newPath ) ; } | Returns the path to a GeoIP 2 database and a path to rename it to if it s broken . |
24,436 | public static function getLastRunTime ( ) { $ timestamp = Option :: get ( self :: LAST_RUN_TIME_OPTION_NAME ) ; return $ timestamp === false ? false : Date :: factory ( ( int ) $ timestamp ) ; } | Returns the time the auto updater was last run . |
24,437 | private function fillDayPeriods ( $ startDate , $ endDate ) { while ( ( $ startDate -> isEarlier ( $ endDate ) || $ startDate == $ endDate ) ) { $ this -> addSubperiod ( new Day ( $ startDate ) ) ; $ startDate = $ startDate -> addDay ( 1 ) ; } } | Fills the periods from startDate to endDate with days |
24,438 | public function & get ( $ idSite , $ period ) { if ( ! isset ( $ this -> data [ $ idSite ] [ $ period ] ) ) { $ this -> data [ $ idSite ] [ $ period ] = $ this -> defaultRow ; } return $ this -> data [ $ idSite ] [ $ period ] ; } | Returns a reference to the data for a specific site & period . If there is no data for the given site ID & period it is set to the default row . |
24,439 | public function set ( $ idSite , $ period , $ name , $ value ) { $ row = & $ this -> get ( $ idSite , $ period ) ; $ row [ $ name ] = $ value ; } | Set data for a specific site & period . If there is no data for the given site ID & period it is set to the default row . |
24,440 | public function addMetadata ( $ idSite , $ period , $ name , $ value ) { $ row = & $ this -> get ( $ idSite , $ period ) ; $ row [ self :: METADATA_CONTAINER_ROW_KEY ] [ $ name ] = $ value ; } | Adds a new metadata to the data for specific site & period . If there is no data for the given site ID & period it is set to the default row . |
24,441 | public function getIndexedArray ( $ resultIndices ) { $ indexKeys = array_keys ( $ resultIndices ) ; $ result = $ this -> createOrderedIndex ( $ indexKeys ) ; foreach ( $ this -> data as $ idSite => $ rowsByPeriod ) { foreach ( $ rowsByPeriod as $ period => $ row ) { if ( empty ( $ this -> periods [ $ period ] ) ) { co... | Returns archive data as an array indexed by metadata . |
24,442 | public function getDataTable ( $ resultIndices ) { $ dataTableFactory = new DataTableFactory ( $ this -> dataNames , $ this -> dataType , $ this -> sitesId , $ this -> periods , $ this -> defaultRow ) ; $ index = $ this -> getIndexedArray ( $ resultIndices ) ; return $ dataTableFactory -> make ( $ index , $ resultIndic... | Returns archive data as a DataTable indexed by metadata . Indexed data will be represented by Map instances . |
24,443 | public function getExpandedDataTable ( $ resultIndices , $ idSubTable = null , $ depth = null , $ addMetadataSubTableId = false ) { if ( $ this -> dataType != 'blob' ) { throw new Exception ( "DataCollection: cannot call getExpandedDataTable with " . "{$this->dataType} data types. Only works with blob data." ) ; } if (... | Returns archive data as a DataTable indexed by metadata . Indexed data will be represented by Map instances . Each DataTable will have its subtable IDs set . |
24,444 | private function putRowInIndex ( & $ index , $ metadataNamesToIndexBy , $ row , $ idSite , $ period ) { $ currentLevel = & $ index ; foreach ( $ metadataNamesToIndexBy as $ metadataName ) { if ( $ metadataName == DataTableFactory :: TABLE_METADATA_SITE_INDEX ) { $ key = $ idSite ; } elseif ( $ metadataName == DataTable... | Puts an archive data row in an index . |
24,445 | public static function cancelAllNonPersistent ( ) { foreach ( static :: getAllNotifications ( ) as $ id => $ notification ) { if ( Notification :: TYPE_PERSISTENT != $ notification -> type ) { static :: removeNotification ( $ id ) ; } } } | Removes all temporary notifications . |
24,446 | public static function getAllNotificationsToDisplay ( ) { $ notifications = static :: getAllNotifications ( ) ; uasort ( $ notifications , function ( $ n1 , $ n2 ) { if ( $ n1 -> getPriority ( ) == $ n2 -> getPriority ( ) ) { return 0 ; } return $ n1 -> getPriority ( ) > $ n2 -> getPriority ( ) ? - 1 : 1 ; } ) ; return... | Determine all notifications that needs to be displayed . They are sorted by priority . Highest priorities first . |
24,447 | public function setValue ( $ value ) { if ( empty ( $ value ) ) { $ value = array ( ) ; } elseif ( is_scalar ( $ value ) ) { if ( ! is_numeric ( $ value ) ) { $ value = strtotime ( $ value ) ; } $ arr = explode ( '-' , date ( 'w-j-n-Y-g-G-i-s-a-A-W' , ( int ) $ value ) ) ; $ value = array ( 'D' => $ arr [ 0 ] , 'l' => ... | Tries to convert the given value to a usable date before setting the element value |
24,448 | public function getApiDocumentationAsString ( $ outputExampleUrls = true ) { list ( $ toc , $ str ) = $ this -> generateDocumentation ( $ outputExampleUrls , $ prefixUrls = '' , $ displayTitlesAsAngularDirective = true ) ; return "<div piwik-content-block content-title='Quick access to APIs' id='topApiRef' name='topApi... | Returns a HTML page containing help for all the successfully loaded APIs . |
24,449 | public function getApiDocumentationAsStringForDeveloperReference ( $ outputExampleUrls = true , $ prefixUrls = '' ) { list ( $ toc , $ str ) = $ this -> generateDocumentation ( $ outputExampleUrls , $ prefixUrls , $ displayTitlesAsAngularDirective = false ) ; return "<h2 id='topApiRef' name='topApiRef'>Quick access to ... | Used on developer . piwik . org |
24,450 | public static function setConfigValue ( $ name , $ value ) { $ section = self :: getConfig ( ) ; $ section [ $ name ] = $ value ; Config :: getInstance ( ) -> Tracker = $ section ; } | Update Tracker config |
24,451 | public function generate ( ) { $ availableLogTables = array ( ) ; $ this -> tables -> sort ( ) ; foreach ( $ this -> tables as $ i => $ table ) { if ( is_array ( $ table ) ) { $ alias = isset ( $ table [ 'tableAlias' ] ) ? $ table [ 'tableAlias' ] : $ table [ 'table' ] ; if ( isset ( $ table [ 'join' ] ) ) { $ this -> ... | Generate the join sql based on the needed tables |
24,452 | public function addLabelColumn ( $ labelColumn ) { if ( is_array ( $ labelColumn ) ) { foreach ( $ labelColumn as $ label ) { $ this -> addLabelColumn ( $ label ) ; } return ; } $ this -> labelColumns [ $ labelColumn ] = true ; } | Add a label column . Labels are the columns that are replaced with Others after the limit . |
24,453 | public function addColumn ( $ column , $ aggregationFunction = false ) { if ( is_array ( $ column ) ) { foreach ( $ column as $ c ) { $ this -> addColumn ( $ c , $ aggregationFunction ) ; } return ; } $ this -> additionalColumns [ $ column ] = $ aggregationFunction ; } | Add a column that has be added to the outer queries . |
24,454 | public function execute ( $ innerQuery , $ bind = array ( ) ) { $ query = $ this -> generateRankingQuery ( $ innerQuery ) ; $ data = Db :: fetchAll ( $ query , $ bind ) ; if ( $ this -> columnToMarkExcludedRows !== false ) { $ excludedFromLimit = array ( ) ; $ result = array ( ) ; foreach ( $ data as & $ row ) { if ( $... | Executes the query . The object has to be configured first using the other methods . |
24,455 | public function getColumns ( $ table ) { $ table = str_replace ( "`" , "" , $ table ) ; $ columns = Db :: fetchAll ( "SHOW COLUMNS FROM `" . $ table . "`" ) ; $ columnNames = array ( ) ; foreach ( $ columns as $ column ) { $ columnNames [ ] = $ column [ 'Field' ] ; } return $ columnNames ; } | Returns the list of column names for a table . |
24,456 | public function getIdActionColumnNames ( $ table ) { $ columns = $ this -> getColumns ( $ table ) ; $ columns = array_filter ( $ columns , function ( $ columnName ) { return strpos ( $ columnName , 'idaction' ) !== false ; } ) ; return array_values ( $ columns ) ; } | Returns the list of idaction columns in a table . A column is assumed to be an idaction reference if it has idaction in its name ( eg idaction_url or idaction_content_name . |
24,457 | public function createNewIdAction ( $ name , $ type , $ urlPrefix ) { $ newActionId = $ this -> insertNewAction ( $ name , $ type , $ urlPrefix ) ; $ realFirstActionId = $ this -> getIdActionMatchingNameAndType ( $ name , $ type ) ; if ( $ realFirstActionId != $ newActionId ) { $ this -> deleteDuplicateAction ( $ newAc... | Inserts a new action into the log_action table . If there is an existing action that was inserted due to another request pre - empting this one the newly inserted action is deleted . |
24,458 | public function getIdsAction ( $ actionsNameAndType ) { $ sql = "SELECT MIN(idaction) as idaction, type, name FROM " . Common :: prefixTable ( 'log_action' ) . " WHERE" ; $ bind = array ( ) ; $ i = 0 ; foreach ( $ actionsNameAndType as $ actionNameType ) { $ name = $ actionNameType [ 'name' ] ; if ( empty ( $ name ) ) ... | Returns the IDs for multiple actions based on name + type values . |
24,459 | public function isSiteEmpty ( $ siteId ) { $ sql = sprintf ( 'SELECT idsite FROM %s WHERE idsite = ? limit 1' , Common :: prefixTable ( 'log_visit' ) ) ; $ result = \ Piwik \ Db :: fetchOne ( $ sql , array ( $ siteId ) ) ; return $ result == null ; } | Returns true if the site doesn t have raw data . |
24,460 | public function saveLanguage ( ) { if ( DbHelper :: isInstalled ( ) ) { $ this -> checkTokenInUrl ( ) ; } $ language = $ this -> getParam ( 'language' ) ; LanguagesManager :: setLanguageForSession ( $ language ) ; Url :: redirectToReferrer ( ) ; } | Save language selection in session - store |
24,461 | private function createConfigFile ( $ dbInfos ) { $ config = Config :: getInstance ( ) ; if ( count ( $ headers = ProxyHeaders :: getProxyClientHeaders ( ) ) > 0 ) { $ config -> General [ 'proxy_client_headers' ] = $ headers ; } if ( count ( $ headers = ProxyHeaders :: getProxyHostHeaders ( ) ) > 0 ) { $ config -> Gene... | Write configuration file from session - store |
24,462 | private function redirectToNextStep ( $ currentStep , $ parameters = array ( ) ) { $ steps = array_keys ( $ this -> steps ) ; $ nextStep = $ steps [ 1 + array_search ( $ currentStep , $ steps ) ] ; Piwik :: redirectToModule ( 'Installation' , $ nextStep , $ parameters ) ; } | Redirect to next step |
24,463 | private function extractHost ( $ url ) { $ urlParts = parse_url ( $ url ) ; if ( isset ( $ urlParts [ 'host' ] ) && strlen ( $ host = $ urlParts [ 'host' ] ) ) { return $ host ; } return false ; } | Extract host from URL |
24,464 | private function addTrustedHosts ( $ siteUrl ) { $ trustedHosts = array ( ) ; if ( ( $ host = $ this -> extractHost ( 'http://' . Url :: getHost ( ) ) ) !== false ) { $ trustedHosts [ ] = $ host ; } if ( ( $ host = $ this -> extractHost ( urldecode ( $ siteUrl ) ) ) !== false ) { $ trustedHosts [ ] = $ host ; } $ trust... | Add trusted hosts |
24,465 | public function hasEnoughTablesToReuseDb ( $ tablesInstalled ) { if ( empty ( $ tablesInstalled ) || ! is_array ( $ tablesInstalled ) ) { return false ; } $ archiveTables = ArchiveTableCreator :: getTablesArchivesInstalled ( ) ; $ baseTablesInstalled = count ( $ tablesInstalled ) - count ( $ archiveTables ) ; $ minimum... | should be private but there s a bug in php 5 . 3 . 6 |
24,466 | public function getAllRoleIds ( ) { $ ids = array ( ) ; foreach ( $ this -> getAllRoles ( ) as $ role ) { $ ids [ ] = $ role -> getId ( ) ; } return $ ids ; } | Returns the list of the existing Access level . Useful when a given API method requests a given acccess Level . We first check that the required access level exists . |
24,467 | public function manipulate ( Config $ config ) { if ( $ this -> isArrayAppend ) { $ this -> appendToArraySetting ( $ config ) ; } else { $ this -> setSingleConfigValue ( $ config ) ; } } | Performs the INI config manipulation . |
24,468 | public function export ( ) { return array ( self :: COLUMNS => $ this -> getArrayCopy ( ) , self :: METADATA => $ this -> metadata , self :: DATATABLE_ASSOCIATED => $ this -> subtableId , ) ; } | Used when archiving to serialize the Row s properties . |
24,469 | public function getMetadata ( $ name = null ) { if ( is_null ( $ name ) ) { return $ this -> metadata ; } if ( ! isset ( $ this -> metadata [ $ name ] ) ) { return false ; } return $ this -> metadata [ $ name ] ; } | Returns the array of all metadata or one requested metadata value . |
24,470 | public function getSubtable ( ) { if ( $ this -> isSubtableLoaded ) { try { return Manager :: getInstance ( ) -> getTable ( $ this -> subtableId ) ; } catch ( TableNotFoundException $ e ) { } } return false ; } | Returns the associated subtable if one exists . Returns false if none exists . |
24,471 | public function sumSubtable ( DataTable $ subTable ) { if ( $ this -> isSubtableLoaded ) { $ thisSubTable = $ this -> getSubtable ( ) ; } else { $ this -> warnIfSubtableAlreadyExists ( ) ; $ thisSubTable = new DataTable ( ) ; $ this -> setSubtable ( $ thisSubTable ) ; } $ columnOps = $ subTable -> getMetadata ( DataTab... | Sums a DataTable to this row s subtable . If this row has no subtable a new one is created . |
24,472 | public function setSubtable ( DataTable $ subTable ) { $ this -> subtableId = $ subTable -> getId ( ) ; $ this -> isSubtableLoaded = true ; return $ subTable ; } | Attaches a subtable to this row overwriting the existing subtable if any . |
24,473 | public function deleteMetadata ( $ name = false ) { if ( $ name === false ) { $ this -> metadata = array ( ) ; return true ; } if ( ! isset ( $ this -> metadata [ $ name ] ) ) { return false ; } unset ( $ this -> metadata [ $ name ] ) ; return true ; } | Deletes one metadata value or all metadata values . |
24,474 | public function addColumn ( $ name , $ value ) { if ( isset ( $ this [ $ name ] ) ) { throw new Exception ( "Column $name already in the array!" ) ; } $ this -> setColumn ( $ name , $ value ) ; } | Add a new column to the row . If the column already exists throws an exception . |
24,475 | public function addColumns ( $ columns ) { foreach ( $ columns as $ name => $ value ) { try { $ this -> addColumn ( $ name , $ value ) ; } catch ( Exception $ e ) { } } if ( ! empty ( $ e ) ) { throw $ e ; } } | Add many columns to this row . |
24,476 | public function addMetadata ( $ name , $ value ) { if ( isset ( $ this -> metadata [ $ name ] ) ) { throw new Exception ( "Metadata $name already in the array!" ) ; } $ this -> setMetadata ( $ name , $ value ) ; } | Add a new metadata to the row . If the metadata already exists throws an exception . |
24,477 | public static function isEqual ( Row $ row1 , Row $ row2 ) { $ cols1 = $ row1 -> getColumns ( ) ; $ cols2 = $ row2 -> getColumns ( ) ; $ diff1 = array_udiff ( $ cols1 , $ cols2 , array ( __CLASS__ , 'compareElements' ) ) ; $ diff2 = array_udiff ( $ cols2 , $ cols1 , array ( __CLASS__ , 'compareElements' ) ) ; if ( $ di... | Helper function that tests if two rows are equal . |
24,478 | public function parse ( Twig_Token $ token ) { $ parser = $ this -> parser ; $ stream = $ parser -> getStream ( ) ; $ view = $ parser -> getExpressionParser ( ) -> parseExpression ( ) ; $ variablesOverride = new Twig_Node_Expression_Array ( array ( ) , $ token -> getLine ( ) ) ; if ( $ stream -> test ( Twig_Token :: NA... | Parses the Twig stream and creates a Twig_Node_Include instance that includes the View s template . |
24,479 | public function main ( ) { if ( $ this -> isMaintenanceModeEnabled ( ) ) { $ this -> logger -> info ( "Archiving won't run because maintenance mode is enabled" ) ; return ; } $ self = $ this ; Access :: doAsSuperUser ( function ( ) use ( $ self ) { $ self -> init ( ) ; $ self -> run ( ) ; $ self -> runScheduledTasks ( ... | Initializes and runs the cron archiver . |
24,480 | public function end ( ) { Piwik :: postEvent ( 'CronArchive.end' , array ( $ this ) ) ; if ( empty ( $ this -> errors ) ) { Option :: set ( self :: OPTION_ARCHIVING_FINISHED_TS , time ( ) ) ; return ; } $ this -> logSection ( "SUMMARY OF ERRORS" ) ; foreach ( $ this -> errors as $ error ) { $ this -> logger -> info ( "... | End of the script |
24,481 | private function logSection ( $ title = "" ) { $ this -> logger -> info ( "---------------------------" ) ; if ( ! empty ( $ title ) ) { $ this -> logger -> info ( $ title ) ; } } | Logs a section in the output |
24,482 | private function initStateFromParameters ( ) { $ this -> todayArchiveTimeToLive = Rules :: getTodayArchiveTimeToLive ( ) ; $ this -> processPeriodsMaximumEverySeconds = $ this -> getDelayBetweenPeriodsArchives ( ) ; $ this -> lastSuccessRunTimestamp = $ this -> getLastSuccessRunTimestamp ( ) ; $ this -> shouldArchiveOn... | Initializes the various parameters to the script based on input parameters . |
24,483 | public function initWebsiteIds ( ) { if ( count ( $ this -> shouldArchiveSpecifiedSites ) > 0 ) { $ this -> logger -> info ( "- Will process " . count ( $ this -> shouldArchiveSpecifiedSites ) . " websites (--force-idsites)" ) ; return $ this -> shouldArchiveSpecifiedSites ; } $ this -> findWebsiteIdsInTimezoneWithNewD... | Returns the list of sites to loop over and archive . |
24,484 | private function hadWebsiteTrafficSinceMidnightInTimezone ( $ idSite ) { $ timezone = Site :: getTimezoneFor ( $ idSite ) ; $ nowInTimezone = Date :: factory ( 'now' , $ timezone ) ; $ midnightInTimezone = $ nowInTimezone -> setTime ( '00:00:00' ) ; $ secondsSinceMidnight = $ nowInTimezone -> getTimestamp ( ) - $ midni... | Detects whether a site had visits since midnight in the websites timezone |
24,485 | private function getTimezonesHavingNewDaySinceLastRun ( ) { $ timestamp = $ this -> lastSuccessRunTimestamp ; $ uniqueTimezones = APISitesManager :: getInstance ( ) -> getUniqueSiteTimezones ( ) ; $ timezoneToProcess = array ( ) ; foreach ( $ uniqueTimezones as & $ timezone ) { $ processedDateInTz = Date :: factory ( (... | Returns the list of timezones where the specified timestamp in that timezone is on a different day than today in that timezone . |
24,486 | public function detectGoalsMatchingUrl ( $ idSite , $ action ) { if ( ! Common :: isGoalPluginEnabled ( ) ) { return array ( ) ; } $ goals = $ this -> getGoalDefinitions ( $ idSite ) ; $ convertedGoals = array ( ) ; foreach ( $ goals as $ goal ) { $ convertedUrl = $ this -> detectGoalMatch ( $ goal , $ action ) ; if ( ... | Look at the URL or Page Title and sees if it matches any existing Goal definition |
24,487 | public function detectGoalMatch ( $ goal , Action $ action ) { $ actionType = $ action -> getActionType ( ) ; $ attribute = $ goal [ 'match_attribute' ] ; if ( ( ( $ attribute == 'url' || $ attribute == 'title' ) && $ actionType != Action :: TYPE_PAGE_URL ) || ( $ attribute == 'file' && $ actionType != Action :: TYPE_D... | Detects if an Action matches a given goal . If it does the URL that triggered the goal is returned . Otherwise null is returned . |
24,488 | public function recordGoals ( VisitProperties $ visitProperties , Request $ request ) { $ visitorInformation = $ visitProperties -> getProperties ( ) ; $ visitCustomVariables = $ request -> getMetadata ( 'CustomVariables' , 'visitCustomVariables' ) ? : array ( ) ; $ action = $ request -> getMetadata ( 'Actions' , 'acti... | Records one or several goals matched in this request . |
24,489 | private function getEcommerceItemsFromRequest ( Request $ request ) { $ items = $ request -> getParam ( 'ec_items' ) ; if ( empty ( $ items ) ) { Common :: printDebug ( "There are no Ecommerce items in the request" ) ; return array ( ) ; } if ( ! is_array ( $ items ) ) { Common :: printDebug ( "Error while json_decode ... | Returns Items read from the request string |
24,490 | protected function updateEcommerceItems ( $ goal , $ itemsToUpdate ) { if ( empty ( $ itemsToUpdate ) ) { return ; } Common :: printDebug ( "Goal data used to update ecommerce items:" ) ; Common :: printDebug ( $ goal ) ; foreach ( $ itemsToUpdate as $ item ) { $ newRow = $ this -> getItemRowEnriched ( $ goal , $ item ... | Updates the cart items in the DB that have been modified since the last cart update |
24,491 | protected function insertEcommerceItems ( $ goal , $ itemsToInsert ) { if ( empty ( $ itemsToInsert ) ) { return ; } Common :: printDebug ( "Ecommerce items that are added to the cart/order" ) ; Common :: printDebug ( $ itemsToInsert ) ; $ items = array ( ) ; foreach ( $ itemsToInsert as $ item ) { $ items [ ] = $ this... | Inserts in the cart in the DB the new items that were not previously in the cart |
24,492 | protected function getItemRowCast ( $ row ) { return array ( ( string ) ( int ) $ row [ self :: INTERNAL_ITEM_SKU ] , ( string ) ( int ) $ row [ self :: INTERNAL_ITEM_NAME ] , ( string ) ( int ) $ row [ self :: INTERNAL_ITEM_CATEGORY ] , ( string ) ( int ) $ row [ self :: INTERNAL_ITEM_CATEGORY2 ] , ( string ) ( int ) ... | Casts the item array so that array comparisons work nicely |
24,493 | public static function formatRegex ( $ pattern ) { if ( strpos ( $ pattern , '/' ) !== false && strpos ( $ pattern , '\\/' ) === false ) { $ pattern = str_replace ( '/' , '\\/' , $ pattern ) ; } return '/' . $ pattern . '/' ; } | Formats a goal regex pattern to a usable regex |
24,494 | public function process ( DataTableInterface $ dataTable ) { $ dataTable = $ this -> applyPivotByFilter ( $ dataTable ) ; $ dataTable = $ this -> applyTotalsCalculator ( $ dataTable ) ; $ dataTable = $ this -> applyFlattener ( $ dataTable ) ; if ( $ this -> callbackBeforeGenericFilters ) { call_user_func ( $ this -> ca... | Apply post - processing logic to a DataTable of a report for an API request . |
24,495 | public static function makeArchiver ( $ url , InputInterface $ input ) { $ archiver = new CronArchive ( ) ; $ archiver -> disableScheduledTasks = $ input -> getOption ( 'disable-scheduled-tasks' ) ; $ archiver -> acceptInvalidSSLCertificate = $ input -> getOption ( "accept-invalid-ssl-certificate" ) ; $ archiver -> sho... | also used by another console command |
24,496 | public static function getIdsWithInheritance ( $ klass ) { $ klasses = Common :: getClassLineage ( $ klass ) ; $ result = array ( ) ; foreach ( $ klasses as $ klass ) { try { $ result [ ] = $ klass :: getViewDataTableId ( ) ; } catch ( \ Exception $ e ) { continue ; } } return $ result ; } | Returns the viewDataTable IDs of a visualization s class lineage . |
24,497 | public static function getAvailableViewDataTables ( ) { $ cache = Cache :: getTransientCache ( ) ; $ cacheId = 'ViewDataTable.getAvailableViewDataTables' ; $ dataTables = $ cache -> fetch ( $ cacheId ) ; if ( ! empty ( $ dataTables ) ) { return $ dataTables ; } $ klassToExtend = '\\Piwik\\Plugin\\ViewDataTable' ; $ vis... | Returns all registered visualization classes . Uses the Visualization . getAvailable event to retrieve visualizations . |
24,498 | public static function getNonCoreViewDataTables ( ) { $ result = array ( ) ; foreach ( static :: getAvailableViewDataTables ( ) as $ vizId => $ vizClass ) { if ( false === strpos ( $ vizClass , 'Piwik\\Plugins\\CoreVisualizations' ) && false === strpos ( $ vizClass , 'Piwik\\Plugins\\Goals\\Visualizations\\Goals' ) ) {... | Returns all available visualizations that are not part of the CoreVisualizations plugin . |
24,499 | public static function configureFooterIcons ( ViewDataTable $ view ) { $ result = array ( ) ; $ normalViewIcons = self :: getNormalViewIcons ( $ view ) ; if ( ! empty ( $ normalViewIcons [ 'buttons' ] ) ) { $ result [ ] = $ normalViewIcons ; } $ insightsViewIcons = array ( 'class' => 'tableInsightViews' , 'buttons' => ... | This method determines the default set of footer icons to display below a report . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.