예제 #1
0
 protected function basePath($url, $path, $args)
 {
     $config = $this->config;
     $path_object = new Path('');
     $rewriting = $config->get('concrete.seo.url_rewriting');
     $rewrite_all = $config->get('concrete.seo.url_rewriting_all');
     $in_dashboard = $this->dashboard->inDashboard($path);
     // If rewriting is disabled, or all_rewriting is disabled and we're
     // in the dashboard, add the dispatcher.
     if (!$rewriting || !$rewrite_all && $in_dashboard) {
         $path_object->prepend(DISPATCHER_FILENAME);
     }
     return $path_object;
 }
예제 #2
0
 public function canAccess()
 {
     $dh = new Dashboard();
     return $dh->canRead();
 }
<?php

use Concrete\Core\Application\Service\Dashboard;
use Concrete\Core\Http\Service\Json;
use Concrete\Core\Marketplace\RemoteItemList as MarketplaceRemoteItemList;
$dh = new Dashboard();
if ($dh->canRead()) {
    session_write_close();
    $js = new Json();
    $mri = new MarketplaceRemoteItemList();
    $mri->setItemsPerPage(5);
    $mri->setIncludeInstalledItems(false);
    $mri->setType('addons');
    $keywords = $_REQUEST['q'];
    $mri->filterByKeywords($keywords);
    $mri->execute();
    $items = $mri->getPage();
    $r = array();
    foreach ($items as $it) {
        $obj = new stdClass();
        $obj->mpID = $it->getMarketplaceItemID();
        $obj->name = $it->getName();
        $obj->img = $it->getRemoteIconURL();
        $obj->href = $it->getRemoteURL();
        $r[] = $obj;
    }
    print $js->encode($r);
    exit;
}