Esempio n. 1
0
 /**
  * Return URL for module icon
  *
  * @return string
  */
 public static function getIconURL()
 {
     list($author, $name) = explode('\\', \Includes\Utils\ModulesManager::getModuleNameByClassName(get_called_class()));
     $path = \Includes\Utils\ModulesManager::getModuleIconFile($author, $name);
     $url = '';
     if (\Includes\Utils\FileManager::isFileReadable($path)) {
         $url = \XLite\Core\Converter::buildURL('module', null, compact('author', 'name'), 'image.php');
     }
     return $url;
 }
Esempio n. 2
0
 /**
  * Return icon URL
  *
  * @return string
  */
 public function getIconURL()
 {
     $url = $this->getMetadata('IconLink');
     if (!$url) {
         list($author, $name) = explode('\\', $this->getActualName());
         $path = \Includes\Utils\ModulesManager::getModuleIconFile($author, $name);
         if (\Includes\Utils\FileManager::isFileReadable($path)) {
             $url = \XLite\Core\Converter::buildURL('module', null, array('author' => $author, 'name' => $name), 'image.php');
         }
     }
     return $url ?: static::DEFAULT_ICON_URL;
 }
Esempio n. 3
0
 * @link      http://www.x-cart.com/
 */
// To avoid superflous checks
define('XLITE_INSTALL_MODE', true);
define('LC_DO_NOT_REBUILD_CACHE', true);
require_once __DIR__ . DIRECTORY_SEPARATOR . 'top.inc.php';
if (isset($_REQUEST['target'])) {
    $path = null;
    switch ($_REQUEST['target']) {
        case 'module':
            if (!empty($_REQUEST['author']) && !empty($_REQUEST['name'])) {
                $image = isset($_REQUEST['image']) ? $_REQUEST['image'] : null;
                switch ($image) {
                    case 'icon.png':
                    default:
                        $path = \Includes\Utils\ModulesManager::getModuleIconFile($_REQUEST['author'], $_REQUEST['name']);
                        break;
                }
            }
            break;
        default:
            // ...
    }
    if (!empty($path)) {
        $type = 'png';
        $data = \Includes\Utils\FileManager::read($path);
        $length = strlen($data);
        header('Content-Type: image/' . $type);
        header('Content-Length: ' . $length);
        echo $data;
    }