/**
  * Init social share links
  * @param \Runalyze\View\Activity\Linker $linker
  */
 protected function initShareLinks(Linker $linker)
 {
     $this->ToolbarLinks[] = '<li class="with-submenu"><span class="link"><i class="fa fa-fw fa-share-alt"></i> ' . __('Share') . '</span><ul class="submenu">';
     if ($this->Context->activity()->isPublic()) {
         $this->ToolbarLinks[] = '<li><a href="' . $linker->publicUrl() . '" target="_blank">' . Icon::$ATTACH . ' ' . __('Public link') . '</a></li>';
     }
     foreach (Export\Share\Types::getEnum() as $typeid) {
         $Exporter = Export\Share\Types::get($typeid, $this->Context);
         if ($Exporter->isPossible()) {
             $link = '<li><a href="' . $Exporter->url() . '"' . ($Exporter->isExternalLink() ? ' target="_blank"' : '') . '><i class="fa fa-fw ' . $Exporter->iconClass() . '"></i> ' . $Exporter->name() . '</a></li>';
             $this->ToolbarLinks[] = !$Exporter->isExternalLink() ? Ajax::window($link) : $link;
         }
     }
     $this->ToolbarLinks[] = '</ul></li>';
 }
<?php

/**
 * File for displaying statistic plugins.
 * Call:   call.Exporter.export.php?id=...[&typeid=...[&social=true]]
 */
require '../inc/class.Frontend.php';
$Frontend = new Frontend(true);
use Runalyze\View\Activity\Context;
use Runalyze\Export\Share;
use Runalyze\Export\File;
if (isset($_GET['social']) && Share\Types::isValidValue((int) $_GET['typeid'])) {
    $Context = new Context((int) $_GET['id'], SessionAccountHandler::getId());
    $Exporter = Share\Types::get((int) $_GET['typeid'], $Context);
    if ($Exporter instanceof Share\AbstractSnippetSharer) {
        $Exporter->display();
    }
} elseif (isset($_GET['file']) && File\Types::isValidValue((int) $_GET['typeid'])) {
    $Context = new Context((int) $_GET['id'], SessionAccountHandler::getId());
    $Exporter = File\Types::get((int) $_GET['typeid'], $Context);
    if ($Exporter instanceof File\AbstractFileExporter) {
        $Exporter->downloadFile();
        exit;
    }
}