コード例 #1
0
    echo '/rtCorePlugin/images/mime-types/' . rtAssetToolkit::translateExtensionToBase($asset->getOriginalFilename()) . '.png';
    ?>
" />
      <?php 
}
?>
    </div>
  </div>
  <div class="rt-core-upload-metadata">
    <?php 
echo truncate_text($asset->getOriginalFilename(), 30);
?>
<br />
    <span>
      <?php 
echo rtAssetToolkit::getFormattedBytes($asset->getFilesize());
?>
 - 
      <a href="#" class="edit-button" onclick="editAsset('<?php 
echo $asset->getId();
?>
', '<?php 
echo $asset->getOriginalFilename();
?>
')">edit</a>
    </span>
  </div>
<?php 
$open = '\\n[';
$close = sprintf('](asset:%s)\\n', $asset->getOriginalFilename());
if ($asset->isImage()) {
コード例 #2
0
 /**
  * Replace occurances of docs tag with list of attached assets.
  *
  * @param array $matches
  * @return string
  */
 protected function _markupDocsInText($matches)
 {
     $string = '';
     $assets = $this->_options['object']->getAssets();
     if (isset($matches[2])) {
         $asset_names = explode(',', $matches[2]);
         $assets = array();
         foreach ($asset_names as $name) {
             $asset = $this->_options['object']->getAssetByName($name);
             if ($asset) {
                 $assets[] = $asset;
             }
         }
     }
     if (count($assets) > 0) {
         $string .= '<div class="rt-docs-holder"><ul class="rt-docs">';
         foreach ($assets as $asset) {
             if ($asset->isImage()) {
                 continue;
             }
             $title = trim($asset->getTitle()) !== '' ? $asset->getTitle() : $asset->getOriginalFilename();
             $description = '';
             if (trim($asset->getDescription()) !== '') {
                 $description = rtMarkdownToolkit::transformBase($asset->getDescription());
             }
             $string .= sprintf('<li class="rt-docs-%s"><span class="rt-docs-title">%s%s</span>%s</li>', $asset->getExtension(), link_to($title, $asset->getWebPath()), sprintf(' <span class="rt-docs-fiesize">(%s)</span>', rtAssetToolkit::getFormattedBytes($asset->getFilesize())), $description);
         }
         $string .= "\n</ul>\n</div>\n";
     }
     return $string;
 }