Returns the piwik code.

@return string
973860
private function getCode()
    {
        $_paq = '';
        foreach ($this->options as $key => $values) {
            foreach ($values as &$value) {
                $value = "'".$value."'";
            }
            $_paq .= sprintf("_paq.push([%s]);\n", implode($values, ','));
        }

        return <<<PWK
<script>
var _paq = _paq || [];
{$_paq}
(function() {
    var u="{$this->piwikUrl}";
    _paq.push(['setSiteId', {$this->siteId}]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="{$this->piwikUrl}piwik.php?idsite={$this->siteId}" style="border:0;" alt="" /></p></noscript>
PWK;
    }
729247
public function hashCode()
    {
        $validPk = null !== $this->getCategoryId() &&
            null !== $this->getMediaId();

        $validPrimaryKeyFKs = 2;
        $primaryKeyFKs = [];

        //relation c2m_fk_904832 to table category
        if ($this->aCategory && $hash = spl_object_hash($this->aCategory)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        //relation c2m_fk_32dfd1 to table media
        if ($this->aMedia && $hash = spl_object_hash($this->aMedia)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        if ($validPk) {
            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
        } elseif ($validPrimaryKeyFKs) {
            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
        }

        return spl_object_hash($this);
    }
1223178
public function getOrganizationCode()
    {
        if (! $this->_orgCode) {
            $this->_orgCode = $this->currentOrganization->getCode();
            if (! $this->_orgCode) {
                $this->_orgCode = \MUtil_File::cleanupName($this->currentOrganization->getName());
            }

        }

        return $this->_orgCode;
    }
211492
public static function guid()
    {
        return sprintf(
            '%s-%s-%s-%s-%s',
            bin2hex(openssl_random_pseudo_bytes(4)),
            bin2hex(openssl_random_pseudo_bytes(2)),
            bin2hex(openssl_random_pseudo_bytes(2)),
            bin2hex(openssl_random_pseudo_bytes(2)),
            bin2hex(openssl_random_pseudo_bytes(6))
        );
    }
1059262
public function getServerCode()
    {
        if (isset($this->_details[self::ENTRY_CODE])) {
            return $this->_details[self::ENTRY_CODE];
        }

        return $this->getCode();
    }
1027180
public static function getDummyId() {
    return 'wcmf'.md5(uniqid(ip2long(@$_SERVER['REMOTE_ADDR']) ^ (int)@$_SERVER['REMOTE_PORT'] ^ @getmypid() ^ @disk_free_space(sys_get_temp_dir()), 1));
  }
1161086
public function trackingCode()
    {
        $this->checkPiwikIsNotInstalled();

        $view = new View(
            '@Installation/trackingCode',
            $this->getInstallationSteps(),
            __FUNCTION__
        );

        $siteName = Common::unsanitizeInputValue($this->getParam('site_name'));
        $idSite = $this->getParam('site_idSite');

        // Load the Tracking code and help text from the SitesManager
        $viewTrackingHelp = new \Piwik\View('@SitesManager/_displayJavascriptCode');
        $viewTrackingHelp->displaySiteName = $siteName;
        $javascriptGenerator = new TrackerCodeGenerator();
        $viewTrackingHelp->jsTag = $javascriptGenerator->generate($idSite, Url::getCurrentUrlWithoutFileName());
        $viewTrackingHelp->idSite = $idSite;
        $viewTrackingHelp->piwikUrl = Url::getCurrentUrlWithoutFileName();
        $viewTrackingHelp->isInstall = true;

        $view->trackingHelp = $viewTrackingHelp->render();
        $view->displaySiteName = $siteName;

        $view->displayfirstWebsiteSetupSuccess = true;
        $view->showNextStep = true;

        return $view->render();
    }
1144210
public function getMissingDependenciesAsString($piwikVersion = null)
    {
        if ($this->requiresInternetConnection() && !SettingsPiwik::isInternetEnabled()) {
            return Piwik::translate('CorePluginsAdmin_PluginRequiresInternet');
        }

        if (empty($this->pluginInformation['require'])) {
            return '';
        }
        $dependency = $this->makeDependency($piwikVersion);

        $missingDependencies = $dependency->getMissingDependencies($this->pluginInformation['require']);

        if(empty($missingDependencies)) {
            return '';
        }

        $causedBy = array();
        foreach ($missingDependencies as $dependency) {
            $causedBy[] = ucfirst($dependency['requirement']) . ' ' . $dependency['causedBy'];
        }

        return Piwik::translate("CorePluginsAdmin_PluginRequirement", array(
            $this->getPluginName(),
            implode(', ', $causedBy)
        ));
    }
1177828
public function getcfg(){
		$str='//'.$this->name.PHP_EOL;
		$str.='define(\''.$this->alias.'\','.(int)$this->getVal().');'.PHP_EOL;
		return $str;
		}
1278242
protected function getBaseUrl()
    {
        if (empty(self::$URL)) {
            throw new Exception(
                'You must first set the Piwik Tracker URL by calling
                 PiwikTracker::$URL = \'http://your-website.org/piwik/\';'
            );
        }
        if (strpos(self::$URL, '/piwik.php') === false
            && strpos(self::$URL, '/proxy-piwik.php') === false
            && strpos(self::$URL, '/matomo.php') === false
            && strpos(self::$URL, '/proxy-matomo.php') === false
        ) {
            self::$URL .= '/piwik.php';
        }

        return self::$URL;
    }
1151443
protected function getSign()
    {
        $content = wordwrap($this->config->get('private_key'), 64, "\n", true);
        $string = "-----BEGIN RSA PRIVATE KEY-----\n{$content}\n-----END RSA PRIVATE KEY-----";
        if ($this->options->get('sign_type') === 'RSA2') {
            openssl_sign($this->getSignContent($this->options->get(), true), $sign, $string, OPENSSL_ALGO_SHA256);
        } else {
            openssl_sign($this->getSignContent($this->options->get(), true), $sign, $string, OPENSSL_ALGO_SHA1);
        }
        return base64_encode($sign);
    }
661524
function downloadPiwikTracker()
    {
        $path = PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/';
        $filename = 'PiwikTracker.php';
        Common::sendHeader('Content-type: text/php');
        Common::sendHeader('Content-Disposition: attachment; filename="' . $filename . '"');
        return file_get_contents($path . $filename);
    }
94648
public function getPreProcessedCode(): string
    {
        $code = $this->getCode();

        $filePath = $this->getFilePath();
        $code = str_replace(
            '__FILE__',
            "'" . $filePath . "'",
            $code
        );
        $code = str_replace(
            '__DIR__',
            "'" . dirname($filePath) . "'",
            $code
        );
        $code = preg_replace(
            '/([^\w:])(__CLASS__)\(/',
            '$1' . $this->getClassName() . '(',
            $code
        );
        $code = str_replace(
            '__CLASS__',
            "'" . $this->getClassName() . "'",
            $code
        );
        $code = preg_replace(
            '/^(assert)\(/',
            'test_flight_assert(',
            $code
        );
        $code = preg_replace(
            '/([^\w:])(assert)\(/',
            '$1test_flight_assert(',
            $code
        );

        return $code;
    }
424429
public function getAsBBCode() {
        $s = "";
        foreach($this->getChildren() as $child)
            $s .= $child->getAsBBCode();
        return $s;
    }
1099206
public static function getUUID()
    {
        return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            // 32 bits for "time_low"
            mt_rand(0, 0xffff), mt_rand(0, 0xffff),

            // 16 bits for "time_mid"
            mt_rand(0, 0xffff),

            // 16 bits for "time_hi_and_version",
            // four most significant bits holds version number 4
            mt_rand(0, 0x0fff) | 0x4000,

            // 16 bits, 8 bits for "clk_seq_hi_res",
            // 8 bits for "clk_seq_low",
            // two most significant bits holds zero and one for variant DCE1.1
            mt_rand(0, 0x3fff) | 0x8000,

            // 48 bits for "node"
            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
        );
    }
351693
public function getPID()
    {
        $id = (string) $this->objectID;

        // PID is stored as little-endian, flip it around
        $pid = substr($id, 16, 2) . substr($id, 14, 2);
        return hexdec($pid);
    }
160913
public function hashCode()
    {
        $validPk = null !== $this->getCategoryId() &&
            null !== $this->getPageId();

        $validPrimaryKeyFKs = 2;
        $primaryKeyFKs = [];

        //relation c2p_fk_904832 to table category
        if ($this->aCategory && $hash = spl_object_hash($this->aCategory)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        //relation c2p_fk_c9a38a to table page
        if ($this->aPage && $hash = spl_object_hash($this->aPage)) {
            $primaryKeyFKs[] = $hash;
        } else {
            $validPrimaryKeyFKs = false;
        }

        if ($validPk) {
            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
        } elseif ($validPrimaryKeyFKs) {
            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
        }

        return spl_object_hash($this);
    }