Renders and echo's an admin page that lets users generate custom JavaScript
tracking code and custom image tracker links.
543433
public function trackingCodeGenerator()
    {
        Piwik::checkUserHasSomeViewAccess();
        
        $view = new View('@CoreAdminHome/trackingCodeGenerator');
        $this->setBasicVariablesView($view);
        $view->topMenu  = MenuTop::getInstance()->getMenu();

        $viewableIdSites = APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess();

        $defaultIdSite = reset($viewableIdSites);
        $view->idSite = $this->idSite ?: $defaultIdSite;

        if ($view->idSite) {
            try {
                $view->siteName = Site::getNameFor($view->idSite);
            } catch (Exception $e) {
                // ignore if site no longer exists
            }
        }

        $view->defaultReportSiteName = Site::getNameFor($view->idSite);
        $view->defaultSiteRevenue = Site::getCurrencySymbolFor($view->idSite);
        $view->maxCustomVariables = CustomVariables::getNumUsableCustomVariables();

        $view->defaultSite = array('id' => $view->idSite, 'name' => $view->defaultReportSiteName);

        $allUrls = APISitesManager::getInstance()->getSiteUrlsFromId($view->idSite);
        if (isset($allUrls[1])) {
            $aliasUrl = $allUrls[1];
        } else {
            $aliasUrl = 'x.domain.com';
        }
        $view->defaultReportSiteAlias = $aliasUrl;

        $mainUrl = Site::getMainUrlFor($view->idSite);
        $view->defaultReportSiteDomain = @parse_url($mainUrl, PHP_URL_HOST);

        $dntChecker = new DoNotTrackHeaderChecker();
        $view->serverSideDoNotTrackEnabled = $dntChecker->isActive();

        return $view->render();
    }
960376
def render_javascript_template!(uri_path)
      javascript_match = File.join(settings.javascripts, "*")
      javascript_path  = File.expand_path(uri_path, settings.javascripts)

      return unless File.fnmatch(javascript_match, javascript_path)

      JAVASCRIPT_TEMPLATE_ENGINES.each do |engine, extension|
        @preferred_extension = extension.to_s
        find_template(settings.javascripts, uri_path, engine) do |file|
          next unless File.file?(file)
          halt send(extension, uri_path.to_sym, views: settings.javascripts)
        end
      end
    end
31889
public function renderView()
    {
        if ($this->path) {
            $this->js(true)->tab(
                ['cache' => false, 'auto' => true, 'path' => $this->path, 'apiSettings' => ['data' => ['__atk_tab' => 1]]]
            );
        } else {
            $this->js(true)->tab();
        }

        if ($this->owner->activeTabName == $this->name) {
            $this->js(true)->click();
        }

        parent::renderView();
    }
1331473
private function mapAdminRoutes()
    {
        $this->name('tracker.')
             ->prefix($this->config()->get('arcanesoft.tracker.route.prefix', 'tracker'))
             ->group(function () {
                 Routes\Admin\TrackerRoutes::register();
             });
    }
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();
    }
616852
function _add_tracking_links() {
            if ( ! current_user_can( 'manage_options' ) ) {
                return;
            }

            $this->_logger->entrance();

            /**
             * If the activation has been delegated to site admins, no tracking-related actions for now.
             *
             * @author Leo Fajardo (@leorw)
             */
            if ( $this->_is_network_active && $this->is_network_delegated_connection() ) {
                return;
            }

            if ( fs_request_is_action_secure( $this->get_unique_affix() . '_reconnect' ) ) {
                if ( ! $this->is_registered() && $this->is_anonymous() ) {
                    $this->connect_again();

                    return;
                }
            }

            if ( ( $this->is_plugin() && ! self::is_plugins_page() ) ||
                 ( $this->is_theme() && ! self::is_themes_page() )
            ) {
                // Only show tracking links on the plugins and themes pages.
                return;
            }

            if ( ! $this->is_enable_anonymous() ) {
                // Don't allow to opt-out if anonymous mode is disabled.
                return;
            }

            if ( ! $this->is_free_plan() ) {
                // Don't allow to opt-out if running in paid plan.
                return;
            }

            if ( $this->add_ajax_action( 'stop_tracking', array( &$this, '_stop_tracking_callback' ) ) ) {
                return;
            }

            if ( $this->add_ajax_action( 'allow_tracking', array( &$this, '_allow_tracking_callback' ) ) ) {
                return;
            }

            $url = '#';

            if ( $this->is_registered() ) {
                if ( $this->is_tracking_allowed() ) {
                    $link_text_id = $this->get_text_inline( 'Opt Out', 'opt-out' );
                } else {
                    $link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );
                }

                add_action( 'admin_footer', array( &$this, '_add_optout_dialog' ) );
            } else {
                $link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );

                $params = ! $this->is_anonymous() ?
                    array() :
                    array(
                        'nonce'     => wp_create_nonce( $this->get_unique_affix() . '_reconnect' ),
                        'fs_action' => ( $this->get_unique_affix() . '_reconnect' ),
                    );

                $url = $this->get_activation_url( $params );
            }

            if ( $this->is_plugin() && self::is_plugins_page() ) {
                $this->add_plugin_action_link(
                    $link_text_id,
                    $url,
                    false,
                    13,
                    "opt-in-or-opt-out {$this->_slug}"
                );
            }
        }
311756
function _account_page_render() {
            $this->_logger->entrance();

            $template = 'account.php';
            $vars     = array( 'id' => $this->_module_id );

            /**
             * Added filter to the template to allow developers wrapping the template
             * in custom HTML (e.g. within a wizard/tabs).
             *
             * @author Vova Feldman (@svovaf)
             * @since  1.2.1.6
             */
            echo $this->apply_filters( "templates/{$template}", fs_get_template( $template, $vars ) );
        }
417412
public function generateScripts()
    {
        $parameters = $this->generateJson();

        return new HtmlString(
            sprintf($this->template(), $this->getTableAttribute('id'), $parameters)
        );
    }
315668
protected function renderJavascript()
    {
        $html = "";

        foreach( $this->javascript as $item )
        {
            $html .= sprintf( MPageController::JAVASCRIPT_TEMPLATE, $item["src"] ) . "\n";
        }

        $domQuery = $this->qp->find( "head" );
        if( $domQuery->count() <= 0 )
        {
            trigger_error( 'head tag not found in page', E_USER_WARNING );
        }
        else
        {
            $domQuery->append( $html );
        }
    }
626624
function track(backend, eventName, action, label) {

        action = action || location.pathname;
        switch (backend) {

        // ##### Google-Analytics
        case "google-analytics":
            var pageTracker = window._gat && window._gat._getTracker(settings.backends[backend].accountid);
            if (! pageTracker) {
                return;
            }
            if (eventName == PAGEVIEW) {
                pageTracker._trackPageview(action);
            } else {
                // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
                pageTracker._trackEvent("pilotfish:" + eventName, action, label || "");
            }
            break;

        // ##### Mixpanel
        case "mixpanel":
            if (eventName == PAGEVIEW) {
                window.mixpanel && window.mixpanel.track_pageview(action);
            } else {
                window.mixpanel && window.mixpanel.track(eventName, {action: action, label: label});
            }
            break;

        // ##### Pilotfish Session
        case "pilotfish-session":
            var session = window.sessionStorage;

            if (! session) {
                return;
            }
            if (eventName == PAGEVIEW) {
                // Increment a counter in sessionStorage.
                // Retrieve with `Pilotfish('session', 'pageViews')`
                Pilotfish('session', 'INCR', 'pageViews');
            } else {
                // Store events in a list in sessionStorage as JSON
                // Retrieve with `Pilotfish('session', 'events')`
                Pilotfish('session', 'PUSH', 'events', {eventName: eventName, action: action, label: label});
            }
            break;

        // ##### TODO: Pilotfish API as a backend

        // ##### Quantcast
        case "quantcast":
            if (eventName == PAGEVIEW) {
                window._qevents && window._qevents.push({qacct: settings.backends[backend].accountid});
                // Reload the js. It won't *actually* reload it network-wise, because it will be cached
                Pilotfish('loadScript', (location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js");
            }
            break;


        // ##### Unrecognized
        default:
            Pilotfish('perror', "Invalid backend for recorder");
            break;
        }
    }
395913
function createPageHandler(page) {
        if (DEBUG && !page.phantom) inspectArgs("createPageHandler: ", page);

        phPage = page;
        var matches;

        if (option.viewportsize) {
            matches = option.viewportsize.match(/^(\d+)x(\d+)$/);
            if (matches !== null) {
                page.property("viewportSize", {width: matches[1], height: matches[2]});
            }
        }

        if (option.cliprect) {
            matches = option.cliprect.match(/^(\d+)x(\d+)x(\d+)x(\d+)$/);
            if (matches !== null) {
                page.setting("clipRect", {top: matches[1], left: matches[2],
                    width: matches[3], height: matches[4]});
            }
        }

        if (option["user-agent"]) {
            page.setting("userAgent", option["user-agent"]);
        }

        if (option.zoomfactor) {
            page.setting("zoomFactor", parseFloat(option.zoomfactor));
        }

        if (option.timeout) {
            timer = setTimeout(function () {
                var err = `capturejs: cannot access ${option.uri}: request timed out`;
                console.error(err);
                phInstance.exit();
                process.nextTick(function () { callback(err) });
            }, +option.timeout);
        }

        return page.open(option.uri);
    }
285541
function() {
			if(!this.rendered) { return; }

			// Set tracking flag
			var posOptions = this.options.position;
			this.tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse);

			// Reassign events
			this._unassignEvents();
			this._assignEvents();
		}
1090807
def batch_generate_pdfs(submission_batch_data, opts = {})
      data, _status_code, _headers = batch_generate_pdfs_with_http_info(submission_batch_data, opts)
      data
    end
1355210
public function generateSite()
    {

        $template = new TemplateImpl($this->backendContainer);
        $pageStrategy = $this->backendContainer->getCurrentPageStrategyInstance();


        $cacheControl = $this->backendContainer->getCacheControlInstance();
        if ($this->config->isDebugMode()) {
            $cacheControl->disableCache();
            $template->setTwigDebug(true);
        }


        $currentPage = $pageStrategy->getCurrentPage();
        $template->setTemplateFromConfig($currentPage->getTemplate(), "_main");

        $ajaxServer = $this->backendContainer->getAJAXServerInstance();
        $id = null;
        if (($id = $this->GETValueOfIndexIfSetElseDefault('ajax')) !== null) {
            $template->onlyInitialize();
            $ajaxServer->registerHandlersFromConfig();
        }

        //Decide output mode
        if ($id !== null) {
            echo json_encode($ajaxServer->handleFromFunctionString($id, $this->GETValueOfIndexIfSetElseDefault('token')), $this->config->isDebugMode()?JSON_PRETTY_PRINT:0);

        } else if (!$cacheControl->setUpCache()) {
            echo $template->render();
        }

    }
507973
function generatePage(output, page) {
    var book = output.getBook();
    var engine = createTemplateEngine(output);

    return timing.measure(
        'page.generate',
        Promise(page)
        .then(function(resultPage) {
            var file = resultPage.getFile();
            var filePath = file.getPath();
            var parser = file.getParser();
            var context = JSONUtils.encodeOutputWithPage(output, resultPage);

            if (!parser) {
                return Promise.reject(error.FileNotParsableError({
                    filename: filePath
                }));
            }

            // Call hook "page:before"
            return callPageHook('page:before', output, resultPage)

            // Escape code blocks with raw tags
            .then(function(currentPage) {
                return parser.preparePage(currentPage.getContent());
            })

            // Render templating syntax
            .then(function(content) {
                var absoluteFilePath = path.join(book.getContentRoot(), filePath);
                return Templating.render(engine, absoluteFilePath, content, context);
            })

            .then(function(output) {
                var content = output.getContent();

                return parser.parsePage(content)
                .then(function(result) {
                    return output.setContent(result.content);
                });
            })

            // Post processing for templating syntax
            .then(function(output) {
                return Templating.postRender(engine, output);
            })

            // Return new page
            .then(function(content) {
                return resultPage.set('content', content);
            })

            // Call final hook
            .then(function(currentPage) {
                return callPageHook('page', output, currentPage);
            });
        })
    );
}
1164723
public function renderJavascript()
	{
		if (!$this->isEnabled()) {
			return;
		}

		return $this->view->make('googlmapper::javascript')
			->withView($this->view)
			->withOptions($this->generateRenderOptions())
			->render();
	}
1280703
public function create_admin_page() {
		$action = is_multisite() ? 'edit.php?action=github-updater' : 'options.php';
		$tab    = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : 'github_updater_settings';
		$subtab = isset( $_GET['subtab'] ) ? esc_attr( $_GET['subtab'] ) : 'github_updater';
		$logo   = plugins_url( basename( GITHUB_UPDATER_DIR ) . '/assets/GitHub_Updater_logo_small.png' ); ?>
		<div class="wrap github-updater-settings">
			<h1>
				<a href="https://github.com/afragen/github-updater" target="_blank"><img src="<?php esc_attr_e( $logo ); ?>" alt="GitHub Updater logo" /></a><br>
				<?php esc_html_e( 'GitHub Updater', 'github-updater' ); ?>
			</h1>
			<?php $this->options_tabs(); ?>
			<?php $this->admin_page_notices(); ?>
			<?php if ( 'github_updater_settings' === $tab ) : ?>
				<?php $this->options_sub_tabs(); ?>
				<form class="settings" method="post" action="<?php esc_attr_e( $action ); ?>">
					<?php
					settings_fields( 'github_updater' );
					if ( 'github_updater' === $subtab ) {
						do_settings_sections( 'github_updater_install_settings' );
						$this->add_hidden_settings_sections();
					} else {
						do_settings_sections( 'github_updater_' . $subtab . '_install_settings' );
						$this->display_ghu_repos( $subtab );
						$this->add_hidden_settings_sections( $subtab );
					}
					submit_button();
					?>
				</form>
				<?php $refresh_transients = add_query_arg( [ 'github_updater_refresh_transients' => true ], $action ); ?>
				<form class="settings" method="post" action="<?php esc_attr_e( $refresh_transients ); ?>">
					<?php submit_button( esc_html__( 'Refresh Cache', 'github-updater' ), 'primary', 'ghu_refresh_cache' ); ?>
				</form>
			<?php endif; ?>

			<?php
			/**
			 * Action hook to add admin page data to appropriate $tab.
			 *
			 * @since 8.0.0
			 *
			 * @param string $tab    Name of tab.
			 * @param string $action Save action for appropriate WordPress installation.
			 *                       Single site or Multisite.
			 */
			do_action( 'github_updater_add_admin_page', $tab, $action );
			?>
		</div>
		<?php
	}