Exemplo n.º 1
0
 /** 
  * Gets a full URL to the directory containing all of a block's items, including JavaScript, tools, icons, etc...
  * @param BlockType $bt
  * @return string $url
  */
 public function getBlockTypeAssetsURL($bt, $file = false)
 {
     $ff = '';
     if ($file != false) {
         $ff = '/' . $file;
     }
     if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $bt->getBlockTypeHandle() . $ff)) {
         $url = DIR_REL . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff;
     } else {
         if ($bt->getPackageID() > 0) {
             $db = Loader::db();
             $h = $bt->getPackageHandle();
             $dirp = is_dir(DIR_PACKAGES . '/' . $h) ? DIR_PACKAGES . '/' . $h : DIR_PACKAGES_CORE . '/' . $h;
             if (file_exists($dirp . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff)) {
                 $url = is_dir(DIR_PACKAGES . '/' . $h) ? DIR_REL : ASSETS_URL;
                 $url = $url . '/' . DIRNAME_PACKAGES . '/' . $h . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff;
             }
         } else {
             if (file_exists(DIR_FILES_BLOCK_TYPES_CORE . '/' . $bt->getBlockTypeHandle() . $ff)) {
                 $url = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff;
             }
         }
     }
     return $url;
 }