idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
24,100 | private function makeDataTableFromSingleBlob ( $ blobRow , $ keyMetadata ) { $ recordName = reset ( $ this -> dataNames ) ; if ( $ this -> idSubtable !== null ) { $ recordName .= '_' . $ this -> idSubtable ; } if ( ! empty ( $ blobRow [ $ recordName ] ) ) { $ table = DataTable :: fromSerializedArray ( $ blobRow [ $ rec... | Creates a DataTable for one record from an archive data row . |
24,101 | private function makeIndexedByRecordNameDataTable ( $ blobRow , $ keyMetadata ) { $ table = new DataTable \ Map ( ) ; $ table -> setKeyName ( 'recordName' ) ; $ tableMetadata = array_merge ( DataCollection :: getDataRowMetadata ( $ blobRow ) , $ keyMetadata ) ; foreach ( $ blobRow as $ name => $ blob ) { $ newTable = D... | Creates a DataTable for every record in an archive data row and puts them in a DataTable \ Map instance . |
24,102 | private function createDataTableMapFromIndex ( $ index , $ resultIndices , $ keyMetadata ) { $ result = new DataTable \ Map ( ) ; $ result -> setKeyName ( reset ( $ resultIndices ) ) ; $ resultIndex = key ( $ resultIndices ) ; array_shift ( $ resultIndices ) ; $ hasIndices = ! empty ( $ resultIndices ) ; foreach ( $ in... | Creates a Set from an array index . |
24,103 | private function createDataTable ( $ data , $ keyMetadata ) { if ( $ this -> dataType == 'blob' ) { $ result = $ this -> makeFromBlobRow ( $ data , $ keyMetadata ) ; } else { $ result = $ this -> makeFromMetricsArray ( $ data , $ keyMetadata ) ; } return $ result ; } | Creates a DataTable instance from an index row . |
24,104 | private function prettifyIndexLabel ( $ labelType , $ label ) { if ( $ labelType == self :: TABLE_METADATA_PERIOD_INDEX ) { $ period = $ this -> periods [ $ label ] ; $ label = $ period -> getLabel ( ) ; if ( $ label === 'week' || $ label === 'range' ) { return $ period -> getRangeString ( ) ; } return $ period -> getP... | Returns the pretty version of an index label . |
24,105 | private static function getReport ( $ apiAction ) { if ( strpos ( $ apiAction , '.' ) === false ) { return ; } list ( $ module , $ action ) = explode ( '.' , $ apiAction ) ; $ report = ReportsProvider :: factory ( $ module , $ action ) ; return $ report ; } | Return the report object for the given apiAction |
24,106 | private static function getDefaultViewTypeForReport ( $ report , $ apiAction ) { if ( ! empty ( $ report ) && $ report -> isEnabled ( ) ) { return $ report -> getDefaultTypeViewDataTable ( ) ; } return false ; } | Returns the default viewDataTable ID to use when determining which visualization to use . |
24,107 | public function getGoal ( $ idSite , $ idGoal ) { Piwik :: checkUserHasViewAccess ( $ idSite ) ; $ goal = $ this -> getModel ( ) -> getActiveGoal ( $ idSite , $ idGoal ) ; if ( ! empty ( $ goal ) ) { return $ this -> formatGoal ( $ goal ) ; } } | Return a single goal . |
24,108 | public function getGoals ( $ idSite ) { $ cacheId = self :: getCacheId ( $ idSite ) ; $ cache = $ this -> getGoalsInfoStaticCache ( ) ; if ( ! $ cache -> contains ( $ cacheId ) ) { $ idSite = Site :: getIdSitesFromIdSitesString ( $ idSite ) ; if ( empty ( $ idSite ) ) { return array ( ) ; } Piwik :: checkUserHasViewAcc... | Returns all Goals for a given website or list of websites |
24,109 | public function addGoal ( $ idSite , $ name , $ matchAttribute , $ pattern , $ patternType , $ caseSensitive = false , $ revenue = false , $ allowMultipleConversionsPerVisit = false , $ description = '' , $ useEventValueAsRevenue = false ) { Piwik :: checkUserHasWriteAccess ( $ idSite ) ; $ this -> checkPatternIsValid ... | Creates a Goal for a given website . |
24,110 | public function deleteGoal ( $ idSite , $ idGoal ) { Piwik :: checkUserHasWriteAccess ( $ idSite ) ; $ this -> getModel ( ) -> deleteGoal ( $ idSite , $ idGoal ) ; $ this -> getModel ( ) -> deleteGoalConversions ( $ idSite , $ idGoal ) ; $ this -> getGoalsInfoStaticCache ( ) -> delete ( self :: getCacheId ( $ idSite ) ... | Soft deletes a given Goal . Stats data in the archives will still be recorded but not displayed . |
24,111 | protected static function convertSpecialGoalIds ( $ idGoal ) { if ( $ idGoal == Piwik :: LABEL_ID_GOAL_IS_ECOMMERCE_ORDER ) { return GoalManager :: IDGOAL_ORDER ; } else if ( $ idGoal == Piwik :: LABEL_ID_GOAL_IS_ECOMMERCE_CART ) { return GoalManager :: IDGOAL_CART ; } else { return $ idGoal ; } } | Helper function that checks for special string goal IDs and converts them to their integer equivalents . |
24,112 | public function get ( $ idSite , $ period , $ date , $ segment = false , $ idGoal = false , $ columns = array ( ) , $ showAllGoalSpecificMetrics = false ) { Piwik :: checkUserHasViewAccess ( $ idSite ) ; $ table = null ; $ segments = array ( '' => false , '_new_visit' => self :: NEW_VISIT_SEGMENT , '_returning_visit' =... | Returns Goals data . |
24,113 | protected function getGoalSpecificDataTable ( $ recordName , $ idSite , $ period , $ date , $ segment , $ idGoal ) { Piwik :: checkUserHasViewAccess ( $ idSite ) ; $ archive = Archive :: build ( $ idSite , $ period , $ date , $ segment ) ; $ realGoalId = $ idGoal != true ? false : self :: convertSpecialGoalIds ( $ idGo... | Utility method that retrieve an archived DataTable for a specific site date range segment and goal . If not goal is specified this method will retrieve and sum the data for every goal . |
24,114 | public function getDaysToConversion ( $ idSite , $ period , $ date , $ segment = false , $ idGoal = false ) { $ dataTable = $ this -> getGoalSpecificDataTable ( Archiver :: DAYS_UNTIL_CONV_RECORD_NAME , $ idSite , $ period , $ date , $ segment , $ idGoal ) ; $ dataTable -> queueFilter ( 'Sort' , array ( 'label' , 'asc'... | Gets a DataTable that maps ranges of days to the number of conversions that occurred within those ranges for the specified site date range segment and goal . |
24,115 | public function getVisitsUntilConversion ( $ idSite , $ period , $ date , $ segment = false , $ idGoal = false ) { $ dataTable = $ this -> getGoalSpecificDataTable ( Archiver :: VISITS_UNTIL_RECORD_NAME , $ idSite , $ period , $ date , $ segment , $ idGoal ) ; $ dataTable -> queueFilter ( 'Sort' , array ( 'label' , 'as... | Gets a DataTable that maps ranges of visit counts to the number of conversions that occurred on those visits for the specified site date range segment and goal . |
24,116 | protected function enrichItemsTableWithViewMetrics ( $ dataTable , $ recordName , $ idSite , $ period , $ date , $ segment ) { $ customVariables = \ Piwik \ Plugins \ CustomVariables \ API :: getInstance ( ) -> getCustomVariables ( $ idSite , $ period , $ date , $ segment , $ expanded = false , $ _leavePiwikCoreVariabl... | Enhances the dataTable with Items attributes found in the Custom Variables report . |
24,117 | protected function configureView ( $ view ) { $ this -> setBasicVariablesNoneAdminView ( $ view ) ; $ view -> linkTitle = Piwik :: getRandomTitle ( ) ; $ view -> nonce = Nonce :: getNonce ( 'Login.login' ) ; } | Configure common view properties |
24,118 | function logme ( ) { $ password = Common :: getRequestVar ( 'password' , null , 'string' ) ; $ login = Common :: getRequestVar ( 'login' , null , 'string' ) ; if ( Piwik :: hasTheUserSuperUserAccess ( $ login ) ) { throw new Exception ( Piwik :: translate ( 'Login_ExceptionInvalidSuperUserAccessAuthenticationMethod' , ... | Form - less login |
24,119 | public function ajaxNoAccess ( $ errorMessage ) { return sprintf ( '<div class="alert alert-danger"> <p><strong>%s:</strong> %s</p> <p><a href="%s">%s</a></p> </div>' , Piwik :: translate ( 'General_Error' ) , htmlentities ( $ errorMessage , Common :: HTML_ENCODING_QUOTE_STYLE ,... | Error message shown when an AJAX request has no access |
24,120 | protected function authenticateAndRedirect ( $ login , $ password , $ urlToRedirect = false , $ passwordHashed = false ) { Nonce :: discardNonce ( 'Login.login' ) ; $ this -> auth -> setLogin ( $ login ) ; if ( $ passwordHashed === false ) { $ this -> auth -> setPassword ( $ password ) ; } else { $ this -> auth -> setP... | Authenticate user and password . Redirect if successful . |
24,121 | function resetPassword ( ) { $ infoMessage = null ; $ formErrors = null ; $ form = new FormResetPassword ( ) ; if ( $ form -> validate ( ) ) { $ nonce = $ form -> getSubmitValue ( 'form_nonce' ) ; if ( Nonce :: verifyNonce ( 'Login.login' , $ nonce ) ) { $ formErrors = $ this -> resetPasswordFirstStep ( $ form ) ; if (... | Reset password action . Stores new password as hash and sends email to confirm use . |
24,122 | protected function resetPasswordFirstStep ( $ form ) { $ loginMail = $ form -> getSubmitValue ( 'form_login' ) ; $ password = $ form -> getSubmitValue ( 'form_password' ) ; try { $ this -> passwordResetter -> initiatePasswordResetProcess ( $ loginMail , $ password ) ; } catch ( Exception $ ex ) { Log :: debug ( $ ex ) ... | Saves password reset info and sends confirmation email . |
24,123 | public function confirmResetPassword ( ) { $ errorMessage = null ; $ login = Common :: getRequestVar ( 'login' , '' ) ; $ resetToken = Common :: getRequestVar ( 'resetToken' , '' ) ; try { $ this -> passwordResetter -> confirmNewPassword ( $ login , $ resetToken ) ; } catch ( Exception $ ex ) { Log :: debug ( $ ex ) ; ... | Password reset confirmation action . Finishes the password reset process . Users visit this action from a link supplied in an email . |
24,124 | public function logout ( ) { Piwik :: postEvent ( 'Login.logout' , array ( Piwik :: getCurrentUserLogin ( ) ) ) ; self :: clearSession ( ) ; $ logoutUrl = @ Config :: getInstance ( ) -> General [ 'login_logout_url' ] ; if ( empty ( $ logoutUrl ) ) { Piwik :: redirectToModule ( 'CoreHome' ) ; } else { Url :: redirectToU... | Logout current user |
24,125 | public function and_ ( HTML_QuickForm2_Rule $ next ) { if ( $ next instanceof HTML_QuickForm2_Rule_Required ) { throw new HTML_QuickForm2_InvalidArgumentException ( 'and_(): Cannot add a "required" rule' ) ; } $ this -> chainedRules [ count ( $ this -> chainedRules ) - 1 ] [ ] = $ next ; return $ this ; } | Adds a rule to the chain with an and operator |
24,126 | public function or_ ( HTML_QuickForm2_Rule $ next ) { if ( $ next instanceof HTML_QuickForm2_Rule_Required ) { throw new HTML_QuickForm2_InvalidArgumentException ( 'or_(): Cannot add a "required" rule' ) ; } $ this -> chainedRules [ ] = array ( $ next ) ; return $ this ; } | Adds a rule to the chain with an or operator |
24,127 | protected function setOwnerError ( ) { if ( strlen ( $ this -> getMessage ( ) ) && ! $ this -> owner -> getError ( ) ) { $ this -> owner -> setError ( $ this -> getMessage ( ) ) ; } } | Sets the error message on the owner element |
24,128 | public function getJavascript ( ) { $ js = "{\n\tcallback: " . $ this -> getJavascriptCallback ( ) . ",\n" . "\telementId: '" . $ this -> owner -> getId ( ) . "',\n" . "\terrorMessage: '" . strtr ( $ this -> getMessage ( ) , array ( "\r" => '\r' , "\n" => '\n' , "\t" => '\t' , "'" => "\\'" , '"' => '\"' , '\\' => '\\\\... | Returns the client - side representation of the Rule |
24,129 | public static function get ( ) { if ( SettingsServer :: isTrackerApiRequest ( ) ) { return Tracker :: getDatabase ( ) ; } if ( ! self :: hasDatabaseObject ( ) ) { self :: createDatabaseObject ( ) ; } return self :: $ connection ; } | Returns the database connection and creates it if it hasn t been already . |
24,130 | public static function getDatabaseConfig ( $ dbConfig = null ) { $ config = Config :: getInstance ( ) ; if ( is_null ( $ dbConfig ) ) { $ dbConfig = $ config -> database ; } Piwik :: postEvent ( 'Db.getDatabaseConfig' , array ( & $ dbConfig ) ) ; $ dbConfig [ 'profiler' ] = @ $ config -> Debug [ 'enable_sql_profiler' ]... | Returns an array with the Database connection information . |
24,131 | public static function fetchOne ( $ sql , $ parameters = array ( ) ) { try { self :: logSql ( __FUNCTION__ , $ sql , $ parameters ) ; return self :: get ( ) -> fetchOne ( $ sql , $ parameters ) ; } catch ( Exception $ ex ) { self :: logExtraInfoIfDeadlock ( $ ex ) ; throw $ ex ; } } | Executes an SQL SELECT statement and returns the first column value of the first row in the result set . |
24,132 | public static function deleteAllRows ( $ table , $ where , $ orderBy , $ maxRowsPerQuery = 100000 , $ parameters = array ( ) ) { $ orderByClause = $ orderBy ? "ORDER BY $orderBy" : "" ; $ sql = "DELETE FROM $table $where $orderByClause LIMIT " . ( int ) $ maxRowsPerQuery ; $ totalRowsDeleted = 0 ; do { $... | Deletes all desired rows in a table while using a limit . This function will execute many DELETE queries until there are no more rows to delete . |
24,133 | public static function optimizeTables ( $ tables , $ force = false ) { $ optimize = Config :: getInstance ( ) -> General [ 'enable_sql_optimize_queries' ] ; if ( empty ( $ optimize ) && ! $ force ) { return false ; } if ( empty ( $ tables ) ) { return false ; } if ( ! is_array ( $ tables ) ) { $ tables = array ( $ tabl... | Runs an OPTIMIZE TABLE query on the supplied table or tables . |
24,134 | public static function dropTables ( $ tables ) { if ( ! is_array ( $ tables ) ) { $ tables = array ( $ tables ) ; } return self :: query ( "DROP TABLE `" . implode ( '`,`' , $ tables ) . "`" ) ; } | Drops the supplied table or tables . |
24,135 | public static function lockTables ( $ tablesToRead , $ tablesToWrite = array ( ) ) { if ( ! is_array ( $ tablesToRead ) ) { $ tablesToRead = array ( $ tablesToRead ) ; } if ( ! is_array ( $ tablesToWrite ) ) { $ tablesToWrite = array ( $ tablesToWrite ) ; } $ lockExprs = array ( ) ; foreach ( $ tablesToWrite as $ table... | Locks the supplied table or tables . |
24,136 | public static function segmentedFetchFirst ( $ sql , $ first , $ last , $ step , $ params = array ( ) ) { $ result = false ; if ( $ step > 0 ) { for ( $ i = $ first ; $ result === false && $ i <= $ last ; $ i += $ step ) { $ result = self :: fetchOne ( $ sql , array_merge ( $ params , array ( $ i , $ i + $ step ) ) ) ;... | Performs a SELECT statement on a table one chunk at a time and returns the first successfully fetched value . |
24,137 | public static function segmentedFetchOne ( $ sql , $ first , $ last , $ step , $ params = array ( ) ) { $ result = array ( ) ; if ( $ step > 0 ) { for ( $ i = $ first ; $ i <= $ last ; $ i += $ step ) { $ result [ ] = self :: fetchOne ( $ sql , array_merge ( $ params , array ( $ i , $ i + $ step ) ) ) ; } } else { for ... | Performs a SELECT on a table one chunk at a time and returns an array of every fetched value . |
24,138 | public static function segmentedFetchAll ( $ sql , $ first , $ last , $ step , $ params = array ( ) ) { $ result = array ( ) ; if ( $ step > 0 ) { for ( $ i = $ first ; $ i <= $ last ; $ i += $ step ) { $ currentParams = array_merge ( $ params , array ( $ i , $ i + $ step ) ) ; $ result = array_merge ( $ result , self ... | Performs a SELECT on a table one chunk at a time and returns an array of every fetched row . |
24,139 | public static function segmentedQuery ( $ sql , $ first , $ last , $ step , $ params = array ( ) ) { if ( $ step > 0 ) { for ( $ i = $ first ; $ i <= $ last ; $ i += $ step ) { $ currentParams = array_merge ( $ params , array ( $ i , $ i + $ step ) ) ; self :: query ( $ sql , $ currentParams ) ; } } else { for ( $ i = ... | Performs a UPDATE or DELETE statement on a table one chunk at a time . |
24,140 | public static function getDbLock ( $ lockName , $ maxRetries = 30 ) { if ( strlen ( $ lockName ) > 64 ) { throw new \ Exception ( 'DB lock name has to be 64 characters or less for MySQL 5.7 compatibility.' ) ; } $ sql = 'SELECT GET_LOCK(?, 1)' ; $ db = self :: get ( ) ; while ( $ maxRetries > 0 ) { $ result = $ db -> f... | Attempts to get a named lock . This function uses a timeout of 1s but will retry a set number of times . |
24,141 | public static function releaseDbLock ( $ lockName ) { $ sql = 'SELECT RELEASE_LOCK(?)' ; $ db = self :: get ( ) ; return $ db -> fetchOne ( $ sql , array ( $ lockName ) ) == '1' ; } | Releases a named lock . |
24,142 | public static function isLockPrivilegeGranted ( ) { if ( is_null ( self :: $ lockPrivilegeGranted ) ) { try { Db :: lockTables ( Common :: prefixTable ( 'log_visit' ) ) ; Db :: unlockAllTables ( ) ; self :: $ lockPrivilegeGranted = true ; } catch ( Exception $ ex ) { self :: $ lockPrivilegeGranted = false ; } } return ... | Checks whether the database user is allowed to lock tables . |
24,143 | public static function cleanupNotRemovedFiles ( ) { $ timeOneWeekAgo = strtotime ( '-1 week' ) ; $ files = _glob ( self :: getTmpPath ( ) . '/*' ) ; if ( empty ( $ files ) ) { return ; } foreach ( $ files as $ file ) { if ( file_exists ( $ file ) ) { $ timeLastModified = filemtime ( $ file ) ; if ( $ timeLastModified !... | Remove files older than one week . They should be cleaned up automatically after each request but for whatever reason there can be always some files left . |
24,144 | public static function getRankingQueryLimit ( ) { $ configGeneral = Config :: getInstance ( ) -> General ; $ configLimit = $ configGeneral [ 'archiving_ranking_query_row_limit' ] ; $ limit = $ configLimit == 0 ? 0 : max ( $ configLimit , $ configGeneral [ 'datatable_archiving_maximum_rows_actions' ] , $ configGeneral [... | Returns the limit to use with RankingQuery for this plugin . |
24,145 | public static function getUnknownActionName ( $ type ) { if ( empty ( self :: $ defaultActionNameWhenNotDefined ) ) { self :: $ defaultActionNameWhenNotDefined = Piwik :: translate ( 'General_NotDefined' , Piwik :: translate ( 'Actions_ColumnPageName' ) ) ; self :: $ defaultActionUrlWhenNotDefined = Piwik :: translate ... | Returns default label for the action type |
24,146 | public static function getActionExplodedNames ( $ name , $ type , $ urlPrefix = null ) { if ( $ type == Action :: TYPE_SITE_SEARCH ) { return array ( $ name ) ; } $ name = str_replace ( "\n" , "" , $ name ) ; if ( $ type == Action :: TYPE_PAGE_TITLE && self :: $ actionTitleCategoryDelimiter === '' ) { if ( $ name === '... | Explodes action name into an array of elements . |
24,147 | private static function setCachedActionRow ( $ idAction , $ actionType , $ actionRow ) { $ cacheLabel = self :: getCachedActionRowKey ( $ idAction , $ actionType ) ; self :: $ cacheParsedAction [ $ cacheLabel ] = $ actionRow ; } | Set cached action row for an id & type . |
24,148 | protected function prepareCoreMetricsArchive ( $ visits , $ visitsConverted ) { $ createSeparateArchiveForCoreMetrics = $ this -> mustProcessVisitCount ( $ visits ) && ! $ this -> doesRequestedPluginIncludeVisitsSummary ( ) ; if ( $ createSeparateArchiveForCoreMetrics ) { $ requestedPlugin = $ this -> params -> getRequ... | Prepares the core metrics if needed . |
24,149 | protected function loadExistingArchiveIdFromDb ( ) { $ noArchiveFound = array ( false , false , false ) ; $ minDatetimeArchiveProcessedUTC = $ this -> getMinTimeArchiveProcessed ( ) ; if ( $ this -> isArchivingForcedToTrigger ( ) ) { return $ noArchiveFound ; } $ idAndVisits = ArchiveSelector :: getArchiveIdAndVisits (... | Returns the idArchive if the archive is available in the database for the requested plugin . Returns false if the archive needs to be processed . |
24,150 | protected function getMinTimeArchiveProcessed ( ) { $ endDateTimestamp = self :: determineIfArchivePermanent ( $ this -> params -> getDateEnd ( ) ) ; $ isArchiveTemporary = ( $ endDateTimestamp === false ) ; $ this -> temporaryArchive = $ isArchiveTemporary ; if ( $ endDateTimestamp ) { return $ endDateTimestamp ; } $ ... | Returns the minimum archive processed datetime to look at . Only public for tests . |
24,151 | public static function make ( ) { $ visit = null ; Piwik :: postEvent ( 'Tracker.makeNewVisitObject' , array ( & $ visit ) ) ; if ( ! isset ( $ visit ) ) { $ visit = new Visit ( ) ; } elseif ( ! ( $ visit instanceof VisitInterface ) ) { throw new Exception ( "The Visit object set in the plugin must implement VisitInter... | Returns the Tracker_Visit object . This method can be overwritten to use a different Tracker_Visit object |
24,152 | protected function addPlugin ( $ index , HTML_QuickForm2_Renderer_Plugin $ plugin ) { $ methods = array ( ) ; $ reflection = new ReflectionObject ( $ plugin ) ; foreach ( $ reflection -> getMethods ( ReflectionMethod :: IS_PUBLIC ) as $ method ) { $ lower = strtolower ( $ method -> getName ( ) ) ; if ( 'HTML_QuickForm2... | Adds a plugin for the current renderer instance |
24,153 | public function prepare ( $ sql ) { $ this -> _connect ( ) ; $ stmtClass = $ this -> _defaultStmtClass ; if ( ! class_exists ( $ stmtClass ) ) { Zend_Loader :: loadClass ( $ stmtClass ) ; } $ stmt = new $ stmtClass ( $ this , $ sql ) ; $ stmt -> setFetchMode ( $ this -> _fetchMode ) ; return $ stmt ; } | Returns an SQL statement for preparation . |
24,154 | protected function _determineI5 ( ) { $ this -> _isI5 = ( php_uname ( 's' ) == 'OS400' ) ? true : false ; if ( isset ( $ this -> _config [ 'os' ] ) ) { if ( strtolower ( $ this -> _config [ 'os' ] ) === 'i5' ) { $ this -> _isI5 = true ; } else { $ this -> _isI5 = false ; } } } | Check the connection parameters according to verify type of used OS |
24,155 | protected function _i5listTables ( $ schema = null ) { $ tables = array ( ) ; if ( $ schema ) { $ tablesStatement = db2_tables ( $ this -> _connection , null , $ schema ) ; while ( $ rowTables = db2_fetch_assoc ( $ tablesStatement ) ) { if ( $ rowTables [ 'TABLE_NAME' ] !== null ) { $ tables [ ] = $ rowTables [ 'TABLE_... | Db2 On I5 specific method |
24,156 | public function addExtension ( $ extension ) { $ extensions = $ this -> getExtension ( ) ; if ( is_string ( $ extension ) ) { $ extension = explode ( ',' , $ extension ) ; } foreach ( $ extension as $ content ) { if ( empty ( $ content ) || ! is_string ( $ content ) ) { continue ; } $ extensions [ ] = trim ( $ content ... | Adds the file extensions |
24,157 | protected function _throw ( $ file , $ errorType ) { if ( null !== $ file ) { $ this -> _value = $ file [ 'name' ] ; } $ this -> _error ( $ errorType ) ; return false ; } | Throws an error of the given type |
24,158 | protected function makeSetting ( $ name , $ defaultValue , $ type , $ configureCallback ) { $ userLogin = Piwik :: getCurrentUserLogin ( ) ; $ setting = new UserSetting ( $ name , $ defaultValue , $ type , $ this -> pluginName , $ userLogin ) ; $ setting -> setConfigureCallback ( $ configureCallback ) ; $ this -> addSe... | Creates a new user setting . |
24,159 | public function determineWhichRowsAreSelectable ( ) { if ( $ this -> config -> row_picker_match_rows_by === false ) { return ; } $ self = $ this ; $ this -> dataTable -> filter ( function ( $ dataTable ) use ( $ self ) { foreach ( $ dataTable -> getRows ( ) as $ row ) { $ rowLabel = $ row -> getColumn ( 'label' ) ; if ... | Determines what rows are selectable and stores them in the selectable_rows property in a format the SeriesPicker JavaScript class can use . |
24,160 | public function afterAllFiltersAreApplied ( ) { $ this -> determineWhichRowsAreSelectable ( ) ; $ selectableColumns = $ this -> config -> selectable_columns ; if ( false === $ selectableColumns ) { $ this -> generateSelectableColumns ( ) ; } $ this -> ensureValidColumnsToDisplay ( ) ; $ this -> addTranslations ( ) ; $ ... | Defaults the selectable_columns property if it has not been set and then transforms it into something the SeriesPicker JavaScript class can use . |
24,161 | public function exists ( ) { $ query = $ this -> db -> query ( 'SELECT * FROM ' . $ this -> table . ' WHERE name = ?' , $ this -> name ) ; return $ query -> rowCount ( ) > 0 ; } | Returns true if the sequence exist . |
24,162 | public function getCurrentId ( ) { $ sql = 'SELECT value FROM ' . $ this -> table . ' WHERE name = ?' ; $ id = $ this -> db -> fetchOne ( $ sql , array ( $ this -> name ) ) ; if ( ! empty ( $ id ) || '0' === $ id || 0 === $ id ) { return ( int ) $ id ; } } | Returns the current max id . |
24,163 | public function removeSparklineMetric ( $ metricNames ) { foreach ( $ this -> sparkline_metrics as $ index => $ metric ) { if ( $ metric [ 'columns' ] === $ metricNames ) { array_splice ( $ this -> sparkline_metrics , $ index , 1 ) ; break ; } } } | Removes an existing sparkline entry . Especially useful in dataTable filters in case sparklines should be not displayed depending on the fetched data . |
24,164 | public function replaceSparklineMetric ( $ metricNames , $ replacementColumns ) { foreach ( $ this -> sparkline_metrics as $ index => $ metric ) { if ( $ metric [ 'columns' ] === $ metricNames ) { $ this -> sparkline_metrics [ $ index ] [ 'columns' ] = $ replacementColumns ; } } } | Replaces an existing sparkline entry with different columns . Especially useful in dataTable filters in case sparklines should be not displayed depending on the fetched data . |
24,165 | private function getUrlSparkline ( $ customParameters = array ( ) ) { $ customParameters [ 'viewDataTable' ] = 'sparkline' ; $ params = $ this -> getGraphParamsModified ( $ customParameters ) ; foreach ( $ params as & $ value ) { if ( is_array ( $ value ) ) { $ value = rawurlencode ( implode ( ',' , $ value ) ) ; } } $... | Returns a URL to a sparkline image for a report served by the current plugin . |
24,166 | public function cacheDataByArchiveNameReports ( ) { $ api = API :: getInstance ( ) ; $ api -> getIndividualReportsSummary ( true ) ; $ api -> getIndividualMetricsSummary ( true ) ; $ now = Date :: now ( ) -> getLocalized ( Date :: DATE_FORMAT_SHORT ) ; Option :: set ( DBStats :: TIME_OF_LAST_TASK_RUN_OPTION , $ now ) ;... | Caches the intermediate DataTables used in the getIndividualReportsSummary and getIndividualMetricsSummary reports in the option table . |
24,167 | public function getSessionContainer ( ) { if ( empty ( $ this -> sessionContainer ) ) { $ this -> sessionContainer = new HTML_QuickForm2_Controller_SessionContainer ( $ this ) ; } return $ this -> sessionContainer ; } | Returns the session container with the controller data |
24,168 | public function destroySessionContainer ( ) { unset ( $ _SESSION [ sprintf ( self :: KEY_CONTAINER , $ this -> id ) ] ) ; $ this -> sessionContainer = null ; } | Removes the session variable containing the controller data |
24,169 | public function getActionName ( ) { if ( is_array ( $ this -> actionName ) ) { return $ this -> actionName ; } if ( empty ( $ this -> pages ) ) { throw new HTML_QuickForm2_NotFoundException ( 'No pages added to the form' ) ; } $ names = array_map ( 'preg_quote' , array_keys ( $ this -> pages ) ) ; $ regex = '/^_qf_(' .... | Extracts the name of the page and the action to perform with it from HTTP request data |
24,170 | public function addPage ( HTML_QuickForm2_Controller_Page $ page ) { $ pageId = $ page -> getForm ( ) -> getId ( ) ; if ( ! empty ( $ this -> pages [ $ pageId ] ) ) { throw new HTML_QuickForm2_InvalidArgumentException ( "Duplicate page ID '{$pageId}'" ) ; } $ page -> setController ( $ this ) ; $ this -> pages [ $ pageI... | Adds a new page to the form |
24,171 | public function getPage ( $ pageId ) { if ( ! empty ( $ this -> pages [ $ pageId ] ) ) { return $ this -> pages [ $ pageId ] ; } else { throw new HTML_QuickForm2_NotFoundException ( "Unknown page '{$pageId}'" ) ; } } | Returns a page |
24,172 | public function previousPage ( HTML_QuickForm2_Controller_Page $ reference ) { $ previous = null ; foreach ( $ this -> pages as $ page ) { if ( $ page === $ reference ) { return $ previous ; } $ previous = $ page ; } return null ; } | Returns the page preceding the given one |
24,173 | public function isValid ( HTML_QuickForm2_Controller_Page $ reference = null ) { $ container = $ this -> getSessionContainer ( ) ; foreach ( $ this -> pages as $ id => $ page ) { if ( $ reference === $ page ) { return true ; } if ( ! $ container -> getValidationStatus ( $ id ) ) { if ( ! $ this -> isWizard ( ) && null ... | Checks whether the pages of the controller are valid |
24,174 | public function getFirstInvalidPage ( ) { foreach ( $ this -> pages as $ id => $ page ) { if ( ! $ this -> getSessionContainer ( ) -> getValidationStatus ( $ id ) ) { return $ page ; } } return null ; } | Returns the first page that failed validation |
24,175 | public function addDataSource ( HTML_QuickForm2_DataSource $ datasource ) { $ this -> getSessionContainer ( ) -> storeDatasources ( array_merge ( $ this -> getSessionContainer ( ) -> getDatasources ( ) , array ( $ datasource ) ) ) ; } | Adds a new data source to the Controller |
24,176 | public function getValue ( ) { $ values = array ( ) ; foreach ( array_keys ( $ this -> pages ) as $ id ) { $ pageValues = $ this -> getSessionContainer ( ) -> getValues ( $ id ) ; foreach ( $ pageValues as $ key => $ value ) { if ( 0 !== strpos ( $ key , '_qf' ) ) { if ( isset ( $ values [ $ key ] ) && is_array ( $ val... | Returns the form s values |
24,177 | private function fetchFirstVisit ( ) { $ response = Request :: processRequest ( 'Live.getFirstVisitForVisitorId' , [ 'idSite' => $ this -> getIdSite ( ) , 'visitorId' => $ this -> getVisitorId ( ) , ] ) ; return $ response -> getFirstRow ( ) ; } | Fetch first visit from Live API |
24,178 | private function getVisitorProfileVisitSummary ( $ visit ) { $ today = Date :: today ( ) ; $ serverDate = $ visit -> getColumn ( 'firstActionTimestamp' ) ; return array ( 'date' => $ serverDate , 'prettyDate' => Date :: factory ( $ serverDate ) -> getLocalized ( Date :: DATE_FORMAT_LONG ) , 'daysAgo' => ( int ) Date ::... | Returns a summary for an important visit . Used to describe the first & last visits of a visitor . |
24,179 | public static function getReferrerSummaryForVisit ( $ visit ) { $ referrerType = $ visit -> getColumn ( 'referrerType' ) ; if ( $ referrerType === false || $ referrerType == 'direct' ) { return Piwik :: translate ( 'Referrers_DirectEntry' ) ; } if ( $ referrerType == 'search' ) { $ referrerName = $ visit -> getColumn (... | Returns a summary for a visit s referral . |
24,180 | public static function decode ( $ yaml ) { $ lines = explode ( "\n" , $ yaml ) ; reset ( $ lines ) ; return self :: _decodeYaml ( 0 , $ lines ) ; } | Very dumb YAML parser |
24,181 | protected static function _replaceConstants ( $ value ) { foreach ( self :: _getConstants ( ) as $ constant ) { if ( strstr ( $ value , $ constant ) ) { $ value = str_replace ( $ constant , constant ( $ constant ) , $ value ) ; } } return $ value ; } | Replace any constants referenced in a string with their values |
24,182 | public static function factory ( $ module , $ action ) { $ listApiToReport = self :: getMapOfModuleActionsToReport ( ) ; $ api = $ module . '.' . ucfirst ( $ action ) ; if ( ! array_key_exists ( $ api , $ listApiToReport ) ) { return null ; } $ klassName = $ listApiToReport [ $ api ] ; return new $ klassName ; } | Get an instance of a specific report belonging to the given module and having the given action . |
24,183 | public function getAllReports ( ) { $ reports = $ this -> getAllReportClasses ( ) ; $ cacheId = CacheId :: siteAware ( CacheId :: languageAware ( 'Reports' . md5 ( implode ( '' , $ reports ) ) ) ) ; $ cache = PiwikCache :: getTransientCache ( ) ; if ( ! $ cache -> contains ( $ cacheId ) ) { $ instances = array ( ) ; Pi... | Returns a list of all available reports . Even not enabled reports will be returned . They will be already sorted depending on the order and category of the report . |
24,184 | public function addReference ( $ ruleKey , $ columns , $ refTableClass , $ refColumns , $ onDelete = null , $ onUpdate = null ) { $ reference = array ( self :: COLUMNS => ( array ) $ columns , self :: REF_TABLE_CLASS => $ refTableClass , self :: REF_COLUMNS => ( array ) $ refColumns ) ; if ( ! empty ( $ onDelete ) ) { ... | Add a reference to the reference map |
24,185 | public function setDefaultSource ( $ defaultSource = self :: DEFAULT_NONE ) { if ( ! in_array ( $ defaultSource , array ( self :: DEFAULT_CLASS , self :: DEFAULT_DB , self :: DEFAULT_NONE ) ) ) { $ defaultSource = self :: DEFAULT_NONE ; } $ this -> _defaultSource = $ defaultSource ; return $ this ; } | set the defaultSource property - this tells the table class where to find default values |
24,186 | public function setDefaultValues ( Array $ defaultValues ) { foreach ( $ defaultValues as $ defaultName => $ defaultValue ) { if ( array_key_exists ( $ defaultName , $ this -> _metadata ) ) { $ this -> _defaultValues [ $ defaultName ] = $ defaultValue ; } } return $ this ; } | set the default values for the table class |
24,187 | protected function _setupDatabaseAdapter ( ) { if ( ! $ this -> _db ) { $ this -> _db = self :: getDefaultAdapter ( ) ; if ( ! $ this -> _db instanceof Zend_Db_Adapter_Abstract ) { throw new Zend_Db_Table_Exception ( 'No adapter found for ' . get_class ( $ this ) ) ; } } } | Initialize database adapter . |
24,188 | protected function _getReferenceMapNormalized ( ) { $ referenceMapNormalized = array ( ) ; foreach ( $ this -> _referenceMap as $ rule => $ map ) { $ referenceMapNormalized [ $ rule ] = array ( ) ; foreach ( $ map as $ key => $ value ) { switch ( $ key ) { case self :: COLUMNS : case self :: REF_COLUMNS : if ( ! is_arr... | Returns a normalized version of the reference map |
24,189 | public function select ( $ withFromPart = self :: SELECT_WITHOUT_FROM_PART ) { $ select = new Zend_Db_Table_Select ( $ this ) ; if ( $ withFromPart == self :: SELECT_WITH_FROM_PART ) { $ select -> from ( $ this -> info ( self :: NAME ) , Zend_Db_Table_Select :: SQL_WILDCARD , $ this -> info ( self :: SCHEMA ) ) ; } ret... | Returns an instance of a Zend_Db_Table_Select object . |
24,190 | public function isIdentity ( $ column ) { $ this -> _setupPrimaryKey ( ) ; if ( ! isset ( $ this -> _metadata [ $ column ] ) ) { throw new Zend_Db_Table_Exception ( 'Column "' . $ column . '" not found in table.' ) ; } return ( bool ) $ this -> _metadata [ $ column ] [ 'IDENTITY' ] ; } | Check if the provided column is an identity of the table |
24,191 | protected function _fetch ( Zend_Db_Table_Select $ select ) { $ stmt = $ this -> _db -> query ( $ select ) ; $ data = $ stmt -> fetchAll ( Zend_Db :: FETCH_ASSOC ) ; return $ data ; } | Support method for fetching rows . |
24,192 | public static function getArchiveIds ( $ siteIds , $ periods , $ segment , $ plugins ) { if ( empty ( $ siteIds ) ) { throw new \ Exception ( "Website IDs could not be read from the request, ie. idSite=" ) ; } foreach ( $ siteIds as $ index => $ siteId ) { $ siteIds [ $ index ] = ( int ) $ siteId ; } $ getArchiveIdsSql... | Queries and returns archive IDs for a set of sites periods and a segment . |
24,193 | public static function getArchiveData ( $ archiveIds , $ recordNames , $ archiveDataType , $ idSubtable ) { $ chunk = new Chunk ( ) ; $ loadAllSubtables = $ idSubtable == Archive :: ID_SUBTABLE_LOAD_ALL_SUBTABLES ; if ( $ loadAllSubtables ) { $ name = reset ( $ recordNames ) ; $ nameEnd = strlen ( $ name ) + 1 ; $ name... | Queries and returns archive data using a set of archive IDs . |
24,194 | private static function getNameCondition ( array $ plugins , Segment $ segment ) { $ doneFlags = Rules :: getDoneFlags ( $ plugins , $ segment ) ; $ allDoneFlags = "'" . implode ( "','" , $ doneFlags ) . "'" ; $ possibleValues = Rules :: getSelectableDoneFlagValues ( ) ; return "((name IN ($allDoneFlags)) AND (value IN... | Returns the SQL condition used to find successfully completed archives that this instance is querying for . |
24,195 | public function setTable ( $ table ) { if ( ! is_array ( $ table ) && ! ( $ table instanceof DataTableInterface ) ) { throw new Exception ( "DataTable renderers renderer accepts only DataTable, Simple and Map instances, and arrays." ) ; } $ this -> table = $ table ; } | Set the DataTable to be rendered |
24,196 | public static function formatValueXml ( $ value ) { if ( is_string ( $ value ) && ! is_numeric ( $ value ) ) { $ value = html_entity_decode ( $ value , ENT_COMPAT , 'UTF-8' ) ; if ( function_exists ( 'mb_convert_encoding' ) ) { $ value = @ mb_convert_encoding ( $ value , 'UTF-8' , 'UTF-8' ) ; } $ value = htmlspecialcha... | Format a value to xml |
24,197 | protected function translateColumnNames ( $ names ) { if ( ! $ this -> apiMethod ) { return $ names ; } if ( $ this -> columnTranslations === false ) { $ meta = $ this -> getApiMetaData ( ) ; if ( $ meta === false ) { return $ names ; } $ t = Metrics :: getDefaultMetricTranslations ( ) ; foreach ( array ( 'metrics' , '... | Translate column names to the current language . Used in subclasses . |
24,198 | public function isConnected ( ) { return ( ( bool ) ( is_resource ( $ this -> _connection ) && ( get_resource_type ( $ this -> _connection ) == 'oci8 connection' || get_resource_type ( $ this -> _connection ) == 'oci8 persistent connection' ) ) ) ; } | Test if a connection is active |
24,199 | public function getLobAsString ( ) { if ( $ this -> _lobAsString === null ) { if ( isset ( $ this -> _config [ 'driver_options' ] ) && isset ( $ this -> _config [ 'driver_options' ] [ 'lob_as_string' ] ) ) { $ this -> _lobAsString = ( bool ) $ this -> _config [ 'driver_options' ] [ 'lob_as_string' ] ; } else { $ this -... | Return whether or not LOB are returned as string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.