Retrieves an Asset Report that has been previously created.

@param string $assetReportToken The token returned in create or filter response.
@param bool $includeInsights Requires activation of feature by Plaid.
172782
public function get($assetReportToken, $includeInsights = false)
    {
        $data = [
            'asset_report_token' => $assetReportToken,
        ];

        if ($includeInsights) {
            $data['include_insights'] = $includeInsights;
        }

        return $this->client->post('/asset_report/get', $data);
    }
1113977
public function report($reportName, $report, $path)
    {
        switch ($reportName) {
            case '{DAV:}principal-property-search':
                $this->server->transactionType = 'report-principal-property-search';
                $this->principalPropertySearchReport($path, $report);

                return false;
            case '{DAV:}principal-search-property-set':
                $this->server->transactionType = 'report-principal-search-property-set';
                $this->principalSearchPropertySetReport($path, $report);

                return false;
            case '{DAV:}expand-property':
                $this->server->transactionType = 'report-expand-property';
                $this->expandPropertyReport($path, $report);

                return false;
            case '{DAV:}principal-match':
                $this->server->transactionType = 'report-principal-match';
                $this->principalMatchReport($path, $report);

                return false;
            case '{DAV:}acl-principal-prop-set':
                $this->server->transactionType = 'acl-principal-prop-set';
                $this->aclPrincipalPropSetReport($path, $report);

                return false;
        }
    }
1159129
public function findUntagged(AssetCollection $assetCollection = null)
    {
        $query = $this->createQuery();
        $query->matching($query->isEmpty('tags'));
        $this->addImageVariantFilterClause($query);
        $this->addAssetCollectionToQueryConstraints($query, $assetCollection);
        return $query->execute();
    }
694159
public function beforeHandleAssetFile(AssetEvent $event)
    {
        $asset = $event->sender;
        $filename = $asset->filename;
        $path = $asset->tempFilePath;

        if (!$path) {
            return;
        }

        // Because this is fired on the before-save event, and validation hasn't kicked in yet
        // we check it here. Otherwise, we potentially process it twice when there's a conflict.
        if (!$asset->validate()) {
            return;
        }

        // Should we be modifying images in this source?
        if (!ImageResizer::$plugin->service->getSettingForAssetSource($asset->volumeId, 'enabled')) {
            ImageResizer::$plugin->logs->resizeLog(null, 'skipped-volume-disabled', $filename);

            return;
        }

        // Resize the image
        ImageResizer::$plugin->resize->resize($asset, $filename, $path);
    }
1007920
public function registerCreatedAsset(AssetInterface $asset)
    {
        if (!$asset instanceof AssetVariantInterface || !$asset instanceof AssetSourceAwareInterface) {
            return;
        }

        $variantAssetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
        $originalAsset = $asset->getOriginalAsset();
        $originalAssetIdentifier = $this->persistenceManager->getIdentifierByObject($originalAsset);

        $originalImportedAsset = $this->importedAssetRepository->findOneByLocalAssetIdentifier($originalAssetIdentifier);
        if ($originalImportedAsset instanceof ImportedAsset) {
            $asset->setAssetSourceIdentifier($originalImportedAsset->getAssetSourceIdentifier());

            $variantImportedAsset = new ImportedAsset(
                $originalImportedAsset->getAssetSourceIdentifier(),
                $originalImportedAsset->getRemoteAssetIdentifier(),
                $variantAssetIdentifier, new \DateTimeImmutable(),
                $originalAssetIdentifier
            );

            $this->importedAssetRepository->add($variantImportedAsset);
            $this->logger->debug(sprintf('Asset created: %s / %s', $asset->getResource()->getFilename(), $this->persistenceManager->getIdentifierByObject($asset)));
        }
    }
426555
public function getAssetFile($type, $assetName)
    {
        if (!$this->hasAsset($type, $assetName)) {
            return false;
        }
    
        // Sort the files by dependnecies
        $file = $this->assets[$type][$assetName];
    
        return $file;
    }
1174770
public function &draw_report_link_panel($link_or_import, $tag, $label, $preselectedvalue = false)
    {
        $text = '<TD class="reportico-maintain-set-field" style="text-align: right; color: #eeeeee; background-color: #000000;" colspan="1">';
        $type = "TEXTFIELD";
        $translateoptions = false;

        $striptag = preg_replace("/ .*/", "", $tag);
        $showtag = preg_replace("/ /", "_", $tag);
        $subtitle = "";
        if (preg_match("/ /", $tag)) {
            $subtitle = preg_replace("/.* /", " ", $tag);
        }

        if (array_key_exists($striptag, $this->field_display)) {
            $arval = $this->field_display[$striptag];
            if (array_key_exists("Title", $arval)) {
                $title = $arval["Title"] . $subtitle;
            }

            if (array_key_exists("Type", $arval)) {
                $type = $arval["Type"];
            }

            if (array_key_exists("XlateOptions", $arval)) {
                $translateoptions = $arval["XlateOptions"];
            }

            if (array_key_exists("EditMode", $arval)) {
                $edit_mode = $arval["EditMode"];
            }

            if (array_key_exists("Values", $arval)) {
                $tagvals = $arval["Values"];
            }

        }

        $default = ReporticoApp::getDefaultConfig($striptag, ".");

        $helppage = "importlink";
        if ($helppage) {
            if ($this->query->url_path_to_assets) {
                $helpimg = $this->query->url_path_to_assets . "/images/help.png";
                $text .= '<a target="_blank" href="' . $this->helpPath($helppage, $striptag) . '">';
                $text .= '<img class="reportico-maintain-help-image" alt="tab" src="' . $helpimg . '">';
                $text .= '</a>&nbsp;';
            } else {
                $helpimg = ReporticoUtility::findBestUrlInIncludePath("images/help.png");
                $dr = ReporticoUtility::getReporticoUrlPath();
                $text .= '<a target="_blank" href="' . $this->helpPath($helppage, $striptag) . '">';
                $text .= '<img class="reportico-maintain-help-image" alt="tab" src="' . $dr . $helpimg . '">';
                $text .= '</a>&nbsp;';
            }
        }

        // Show options options to import or link
        $listarr = array();
        if ($link_or_import == "IMPORT" || $link_or_import == "LINKANDIMPORT") {
            $listarr["import"] = ReporticoLang::templateXlate("IMPORTREPORT");
        }

        if ($link_or_import == "LINK" || $link_or_import == "LINKANDIMPORT") {
            $listarr["linkto"] = ReporticoLang::templateXlate("MAKELINKTOREPORT");
        }

        $text .= $this->drawArrayDropdown("linkorimport_" . $this->id, $listarr, $this->query->reportlink_or_import, false, false, true);

        $text .= '</a>&nbsp;&nbsp;';

        // Draw report names we can link to
        $text .= $this->drawSelectFileList($this->query->reports_path, "/.*\.xml/", false, $preselectedvalue, true, false, "reportlink");
        $text .= '<input class="' . $this->query->getBootstrapStyle('design_ok') . 'reportico-maintain-button reportico-submit" style="margin-right: 20px" type="submit" name="submit_' . $this->id . '_REPORTLINK" value="' . ReporticoLang::templateXlate("OK") . '">';

        if ($this->query->reportlink_report) {
            // Draw report criteria items we can link to
            $q = ReporticoUtility::loadExistingReport($this->query->reportlink_report, $this->query->projects_folder);
            if (!$q) {
                trigger_error(ReporticoLang::templateXlate("NOOPENLINK") . $this->query->reportlink_report, E_USER_NOTICE);
            } else if (!$q->lookup_queries || count($q->lookup_queries) == 0) {
                trigger_error(ReporticoLang::templateXlate("NOCRITLINK") . $this->query->reportlink_report, E_USER_NOTICE);
            } else {
                if ($link_or_import == "LINK") {
                    $text .= ReporticoLang::templateXlate("MAKELINKTOREPORTITEM");
                } else {
                    $text .= ReporticoLang::templateXlate("IMPORTREPORT");
                }

                $text .= "&nbsp;";
                $listarr = array();
                $listarr["ALLITEMS"] = ReporticoLang::templateXlate("ALLITEMS");
                if ($tag == "mainquercrit") {
                    $lq = $q->lookup_queries;
                    foreach ($lq as $k => $v) {
                        $listarr[$v->query_name] = $v->query_name;
                    }

                } else if ($tag == "mainquerassg") {
                    $lq = $q->assignment;
                    foreach ($lq as $k => $v) {
                        if (strlen($v->expression) > 30) {
                            $listarr[$k] = $v->query_name . " = " . substr($v->expression, 0, 30) . "...";
                        } else {
                            $listarr[$k] = $v->query_name . " = " . $v->expression;
                        }

                    }
                } else if ($tag == "mainqueroutppghd") {
                    $lq = $q->pageHeaders;
                    foreach ($lq as $k => $v) {
                        if (strlen($v->text) > 30) {
                            $listarr[$k] = $k . " = " . substr($v->text, 0, 30) . "...";
                        } else {
                            $listarr[$k] = $k . " = " . $v->text;
                        }

                    }
                } else if ($tag == "mainqueroutppgft") {
                    $lq = $q->pageFooters;
                    foreach ($lq as $k => $v) {
                        if (strlen($v->text) > 30) {
                            $listarr[$k] = $k . " = " . substr($v->text, 0, 30) . "...";
                        } else {
                            $listarr[$k] = $k . " = " . $v->text;
                        }

                    }
                }

                $text .= $this->drawArrayDropdown("reportlinkitem_" . $this->id, $listarr, false, false, false, true);
                $text .= '<input class="' . $this->query->getBootstrapStyle('design_ok') . 'reportico-maintain-button reportico-submit" style="margin-right: 20px" type="submit" name="submit_' . $this->id . '_REPORTLINKITEM" value="' . ReporticoLang::templateXlate("OK") . '">';
            }
        }

        $text .= '</TD>';
        //$text .= '</TR>';

        return $text;
    }
734806
public function getAssetUrl($type, $assetName)
    {
        $file = $this->assetManager->getAssetFile($type, $assetName);
        
        if ($file === false) {
            return;
        }
        
        $cachedFile = $this->generateCachedFile($type, $file->getFileName());
        
        return $this->getUrlToTheAssetLoader($cachedFile['file']);
    }
626720
protected function _include($path, array $options = [], $type = 'css')
    {
        $doc = $this->Document;
        $options += ['once' => true, 'block' => null, 'fullBase' => true, 'weight' => 10];
        $external = false;

        $assetArray = $this->_arrayInclude($path, $options, $type);
        if ($assetArray) {
            return $assetArray;
        }

        $path = $this->_getCurrentPath($path, $assetArray);
        if (empty($path)) {
            return null;
        }

        $options += ['alias' => Str::slug($path)];
        list($url, $options, $external) = $this->_getCurrentUrlAndOptions($path, $options, $type, $external);

        if (($this->_isOnceIncluded($path, $type, $options)) || $this->_hasAsset($path, $type, $external)) {
            return null;
        }

        unset($options['once']);
        $this->_includedAssets[$type][$path] = true;

        $out = $this->_getTypeOutput($options, $url, $type);

        $options['alias'] = Str::low($options['alias']);
        if ($options['block'] === 'assets') {
            $this->_assets[$type][$options['alias']] = [
                'url'    => $url,
                'output' => $out,
                'path'   => $path,
                'weight' => $options['weight'],
            ];

            return null;
        }

        if (empty($options['block'])) {
            return $out;
        }

        $options = $this->_setFetchBlock($options, $type);
        $this->_View->append($options['block'], $out . $doc->eol);
    }
1259764
public function get(array $metrics = [], ?int $since = null, ?int $until = null): InsightsResponse
    {
        $metrics = $this->isValidMetrics($metrics);

        $request = new InsightsRequest($this->pageToken, $metrics, $since, $until);
        $response = $this->client->get('me/insights', $request->build());

        return new InsightsResponse($response);
    }
1066551
private function addExternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping)
    {
        $data = $this->queryExternalReferrers(
            $idaction, $actionType, $logAggregator, $limitBeforeGrouping);

        $report['pageMetrics']['entries'] = 0;
        $report['referrers'] = array();
        foreach ($data->getRows() as $row) {
            $referrerId = $row->getColumn('label');
            $visits = $row->getColumn(Metrics::INDEX_NB_VISITS);
            if ($visits) {
                // load details (i.e. subtables)
                $details = array();
                $subTable = $row->getSubtable();
                if ($subTable) {
                    foreach ($subTable->getRows() as $subRow) {
                        $details[] = array(
                            'label'     => $subRow->getColumn('label'),
                            'referrals' => $subRow->getColumn(Metrics::INDEX_NB_VISITS)
                        );
                    }
                }
                $report['referrers'][] = array(
                    'label'     => $this->getReferrerLabel($referrerId),
                    'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeFromShortName($referrerId),
                    'visits'    => $visits,
                    'details'   => $details
                );
                $report['pageMetrics']['entries'] += $visits;
            }
        }

        // if there's no data for referrers, ResponseBuilder::handleMultiDimensionalArray
        // does not detect the multi dimensional array and the data is rendered differently, which
        // causes an exception.
        if (count($report['referrers']) == 0) {
            $report['referrers'][] = array(
                'label'     => $this->getReferrerLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
                'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
                'visits'    => 0
            );
        }
    }
295646
public function buildReport($reportUri, $format = 'html', $assetUrl = '') {
        //Check connection
        if ($this->isConnected()) {
            //Get the report
            $report = new Report($reportUri, $format);

            //Create an instance of the report builder
            $reportBuilder = new ReportBuilder(
                $this->jasperClient
                , $report
                , '&page=1'
                , $assetUrl
                , 'Fallback'
           );
        } else {
            return false;
        }
    }
1069405
public function saveInclude($include_name, array $include_fields = [ ]) {
        $data = $include_fields;
        $data['include'] = $include_name;
        return $this->apiPost('include', $data);
    }
898501
static function findFileToInclude($file_path, &$new_file_path, &$rel_to_include = "")
    {
        // First look in path of current file
        static $_path_array = null;
        if (__DIR__) {
            $selfdir = dirname(__DIR__);
            $new_file_path = $selfdir . "/" . $file_path;
            $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler", 0);
            if (@file_exists($new_file_path) || is_dir($new_file_path)) {
                $new_file_path = $selfdir . "/" . $file_path;
                $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
                return true;
            }
            $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
        }

        // else look in incude path
        if (!isset($_path_array)) {
            $_ini_include_path = get_include_path();

            if (defined("__DIR __")) {
                $selfdir = dirname(__DIR__);
            } else {
                $selfdir = dirname(dirname(__FILE__));
            }

            if (strstr($_ini_include_path, ';')) {
                $_ini_include_path = $selfdir . ";" . $_ini_include_path;
                $_path_array = explode(';', $_ini_include_path);
            } else {
                $_ini_include_path = $selfdir . ":" . $_ini_include_path;
                $_path_array = explode(':', $_ini_include_path);
            }
        }
        // Turn off Error handling for the following to avoid open_basedir errors
        $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler", 0);
        foreach ($_path_array as $_include_path) {
            if (@file_exists($_include_path . "/" . $file_path)) {
                $new_file_path = $_include_path . "/" . $file_path;
                $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
                return true;
            }
        }
        $old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");

        $new_file_path = $file_path;
        return false;
    }
295542
public function showAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void
    {
        $assetSources = $this->assetSourceService->getAssetSources();
        if (!isset($assetSources[$assetSourceIdentifier])) {
            $this->throwStatus(404, 'Asset source not found');
        }

        $assetProxyRepository = $assetSources[$assetSourceIdentifier]->getAssetProxyRepository();
        $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier);
        if (!$assetProxy) {
            $this->throwStatus(404, 'Asset proxy not found');
        }

        $this->view->assign('assetProxy', $assetProxy);
    }
449564
protected function getAssetFilesPathFromDirectory($sDirPath, $sAssetType)
    {
        if (!is_string($sDirPath) || !($sDirPath = $this->getOptions()->getRealPath($sDirPath)) && !is_dir($sDirPath)) {
            throw new \InvalidArgumentException('Directory not found : ' . $sDirPath);
        }
        if (!\AssetsBundle\AssetFile\AssetFile::assetFileTypeExists($sAssetType)) {
            throw new \InvalidArgumentException('Asset\'s type is undefined : ' . $sAssetType);
        }

        $oDirIterator = new \DirectoryIterator($sDirPath);
        $aAssets = array();
        $bRecursiveSearch = $this->getOptions()->allowsRecursiveSearch();

        // Defined expected extensions forthe given type
        if ($sAssetType === \AssetsBundle\AssetFile\AssetFile::ASSET_MEDIA) {
            $aExpectedExtensions = $this->getOptions()->getMediaExt();
        } else {
            $aExpectedExtensions = array(\AssetsBundle\AssetFile\AssetFile::getAssetFileDefaultExtension($sAssetType));
        }

        foreach ($oDirIterator as $oFile) {
            if ($oFile->isFile()) {
                if (in_array(strtolower(pathinfo($oFile->getFilename(), PATHINFO_EXTENSION)), $aExpectedExtensions, true)) {
                    $aAssets[] = $oFile->getPathname();
                }
            } elseif ($oFile->isDir() && !$oFile->isDot() && $bRecursiveSearch) {
                $aAssets = array_merge(
                        $aAssets, $this->getAssetFilesPathFromDirectory($oFile->getPathname(), $sAssetType)
                );
            }
        }
        return $aAssets;
    }
749673
public function includeDefaultAssets()
    {
        if (false === $this->assetHandlerConnectorStates->defaultAssetsWereIncluded()) {
            $this->assetHandlerConnectorStates->markDefaultAssetsAsIncluded();

            $this->getJavaScriptAssetHandlerConnector()->includeDefaultJavaScriptFiles();
            $this->getCssAssetHandlerConnector()->includeDefaultCssFiles();
        }

        return $this;
    }