当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::name方法代码示例

本文整理汇总了PHP中Filesystem::name方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::name方法的具体用法?PHP Filesystem::name怎么用?PHP Filesystem::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filesystem的用法示例。


在下文中一共展示了Filesystem::name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStaticProperUrl

 /**
  * Return URL with fingerprint
  * @param type $sRootPath Path from root
  */
 public static function getStaticProperUrl($sRootPath)
 {
     $sFilePath = Filesystem::path($sRootPath);
     $sFileName = Filesystem::name($sRootPath);
     $sFileExtension = Filesystem::extension($sRootPath);
     $sFileLastModificationDate = filemtime($sRootPath);
     $sUrl = Config::get('app.url') . $sFilePath . Config::get('format.dir.slash') . $sFileName . '_' . $sFileLastModificationDate . '_.' . $sFileExtension;
     return $sUrl;
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:13,代码来源:Http.php

示例2: productimage

 /**
  * Get a default image for the store item
  *
  * @param      string $option   Component name
  * @param      string $item     Item ID
  * @param      string $root     Root path
  * @param      string $wpath    Base path for files
  * @param      string $alt      Image alt text
  * @param      string $category Item category
  * @return     string HTML
  */
 public static function productimage($option, $item, $root, $wpath, $alt, $category)
 {
     if ($wpath) {
         $wpath = DS . trim($wpath, DS) . DS;
     }
     $d = @dir($root . $wpath . $item);
     $images = array();
     $html = '';
     if ($d) {
         while (false !== ($entry = $d->read())) {
             $img_file = $entry;
             if (is_file($root . $wpath . $item . DS . $img_file) && substr($entry, 0, 1) != '.' && strtolower($entry) !== 'index.html') {
                 if (preg_match("#bmp|gif|jpg|png|swf#i", $img_file)) {
                     $images[] = $img_file;
                 }
             }
         }
         $d->close();
     } else {
         if ($category == 'service') {
             $html = '<span class="nophoto"></span>';
         } else {
             $html = '<span class="nophoto premium"></span>';
         }
     }
     sort($images);
     $els = '';
     $k = 0;
     $g = 0;
     for ($i = 0, $n = count($images); $i < $n; $i++) {
         $ext = \Filesystem::extension($images[$i]);
         $tn = \Filesystem::name($images[$i]) . '-tn.';
         if (!is_file($root . $wpath . $item . DS . $tn . $ext)) {
             $ext = 'gif';
         }
         $tn = $tn . $ext;
         if (is_file($root . $wpath . $item . DS . $tn)) {
             $k++;
             $els .= '<a rel="lightbox" href="' . $wpath . $item . '/' . $images[$i] . '" title="' . $alt . '"><img src="' . $wpath . $item . '/' . $tn . '" alt="' . $alt . '" /></a>';
         }
     }
     if ($els) {
         $html .= $els;
     }
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:57,代码来源:html.php

示例3: getTypeOptionsFromLayouts

 protected function getTypeOptionsFromLayouts($component, $view)
 {
     // Initialise variables.
     $options = array();
     $layouts = array();
     $layoutNames = array();
     $templateLayouts = array();
     $lang = Lang::getRoot();
     // Get the layouts from the view folder.
     $path = PATH_CORE . '/components/' . $component . '/views/' . $view . '/tmpl';
     $path2 = PATH_CORE . '/components/' . $component . '/site/views/' . $view . '/tmpl';
     if (Filesystem::exists($path)) {
         $layouts = array_merge($layouts, Filesystem::files($path, '.xml$', false, true));
     } else {
         if (Filesystem::exists($path2)) {
             $layouts = array_merge($layouts, Filesystem::files($path2, '.xml$', false, true));
         } else {
             return $options;
         }
     }
     // build list of standard layout names
     foreach ($layouts as $layout) {
         $layout = trim($layout, '/');
         // Ignore private layouts.
         if (strpos(basename($layout), '_') === false) {
             $file = $layout;
             // Get the layout name.
             $layoutNames[] = Filesystem::name(basename($layout));
         }
     }
     // get the template layouts
     // TODO: This should only search one template -- the current template for this item (default of specified)
     $folders = Filesystem::directories(JPATH_SITE . '/templates', '', false, true);
     // Array to hold association between template file names and templates
     $templateName = array();
     foreach ($folders as $folder) {
         if (Filesystem::exists($folder . '/html/' . $component . '/' . $view)) {
             $template = basename($folder);
             $lang->load('tpl_' . $template . '.sys', JPATH_SITE, null, false, true) || $lang->load('tpl_' . $template . '.sys', JPATH_SITE . '/templates/' . $template, null, false, true);
             $templateLayouts = Filesystem::files($folder . '/html/' . $component . '/' . $view, '.xml$', false, true);
             foreach ($templateLayouts as $layout) {
                 $file = trim($layout, '/');
                 // Get the layout name.
                 $templateLayoutName = Filesystem::name(basename($layout));
                 // add to the list only if it is not a standard layout
                 if (array_search($templateLayoutName, $layoutNames) === false) {
                     $layouts[] = $layout;
                     // Set template name array so we can get the right template for the layout
                     $templateName[$layout] = basename($folder);
                 }
             }
         }
     }
     // Process the found layouts.
     foreach ($layouts as $layout) {
         $layout = trim($layout, '/');
         // Ignore private layouts.
         if (strpos(basename($layout), '_') === false) {
             $file = $layout;
             // Get the layout name.
             $layout = Filesystem::name(basename($layout));
             // Create the menu option for the layout.
             $o = new \Hubzero\Base\Object();
             $o->title = ucfirst($layout);
             $o->description = '';
             $o->request = array('option' => $component, 'view' => $view);
             // Only add the layout request argument if not the default layout.
             if ($layout != 'default') {
                 // If the template is set, add in format template:layout so we save the template name
                 $o->request['layout'] = isset($templateName[$file]) ? $templateName[$file] . ':' . $layout : $layout;
             }
             // Load layout metadata if it exists.
             if (is_file($file)) {
                 // Attempt to load the xml file.
                 if ($xml = simplexml_load_file($file)) {
                     // Look for the first view node off of the root node.
                     if ($menu = $xml->xpath('layout[1]')) {
                         $menu = $menu[0];
                         // If the view is hidden from the menu, discard it and move on to the next view.
                         if (!empty($menu['hidden']) && $menu['hidden'] == 'true') {
                             unset($xml);
                             unset($o);
                             continue;
                         }
                         // Populate the title and description if they exist.
                         if (!empty($menu['title'])) {
                             $o->title = trim((string) $menu['title']);
                         }
                         if (!empty($menu->message[0])) {
                             $o->description = trim((string) $menu->message[0]);
                         }
                     }
                 }
             }
             // Add the layout to the options array.
             $options[] = $o;
         }
     }
     return $options;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:100,代码来源:menutypes.php

示例4: createThumbName

 /**
  * Create thumb name
  *
  * @param      string $image
  * @param      string $tn
  * @param      string $ext
  *
  * @return     string
  */
 public static function createThumbName($image = null, $tn = '_thumb', $ext = 'png')
 {
     return \Filesystem::name($image) . $tn . '.' . $ext;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:13,代码来源:html.php

示例5: displayTask

 /**
  * Display an image
  *
  * @param   integer  $id  Item ID
  * @return  void
  */
 public function displayTask($id = 0)
 {
     $this->view->type = $this->type;
     // Load the component config
     $this->view->config = $this->config;
     // Do have an ID or do we need to get one?
     $this->view->id = $id ? $id : Request::getInt('id', 0);
     // Do we have a file or do we need to get one?
     //$this->view->file = ($file) ? $file : Request::getVar('file', '');
     // Build the directory path
     $this->view->path = DS . trim($this->config->get('webpath', '/site/store'), DS) . DS . $this->view->id;
     $folders = array();
     $docs = array();
     $imgs = array();
     $path = PATH_APP . $this->view->path;
     if (is_dir($path)) {
         // Loop through all files and separate them into arrays of images, folders, and other
         $dirIterator = new DirectoryIterator($path);
         foreach ($dirIterator as $file) {
             if ($file->isDot()) {
                 continue;
             }
             if ($file->isDir()) {
                 $name = $file->getFilename();
                 $folders[$path . DS . $name] = $name;
                 continue;
             }
             if ($file->isFile()) {
                 $name = $file->getFilename();
                 if ('cvs' == strtolower($name) || '.svn' == strtolower($name)) {
                     continue;
                 }
                 if (preg_match("#bmp|gif|jpg|png|swf#i", $name)) {
                     $base = \Filesystem::name($name);
                     if (substr($base, -3) == '-tn') {
                         continue;
                     }
                     $imgs[$path . DS . $name] = $name;
                 } else {
                     $docs[$path . DS . $name] = $name;
                 }
             }
         }
         ksort($folders);
         ksort($docs);
     }
     $this->view->file = array_shift($imgs);
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('display')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:60,代码来源:media.php

示例6: thumbnail

 /**
  * Generate a thumbnail name from a file name
  *
  * @param      string $pic File name
  * @return     string
  */
 public static function thumbnail($pic)
 {
     return \Filesystem::name($pic) . '-tn.gif';
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:10,代码来源:html.php

示例7: createThumbName

 /**
  * Create a thumbnail name
  *
  * @param   string  $image  Image name
  * @param   string  $tn     Thumbnail prefix
  * @return  string
  */
 public function createThumbName($image = null, $tn = '-tn')
 {
     if (!$image) {
         $image = $this->image;
     }
     if (!$image) {
         $this->setError(Lang::txt('No image set.'));
         return false;
     }
     $ext = \Filesystem::extension($image);
     $thumb = \Filesystem::name($image) . $tn . '.' . $ext;
     return $thumb;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:20,代码来源:imghandler.php

示例8: exportToJson

 private function exportToJson($sJsonFilePath, array $aData, $bCompress = false)
 {
     $sNewJsonContent = Conversion::getJsonFromArray($aData, $bCompress);
     if (Filesystem::put($sJsonFilePath, $sNewJsonContent) !== false) {
         return Filesystem::name($sJsonFilePath) . '.' . Filesystem::extension($sJsonFilePath);
     } else {
         throw new FileNotCreatedException('File : ' . $sJsonFilePath);
     }
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:9,代码来源:JSRealService.php

示例9: special

 /**
  * Get a list of special pages
  *
  * @return  array
  */
 public function special()
 {
     static $pages;
     if (!isset($pages)) {
         $path = PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'site' . DS . 'views' . DS . 'special' . DS . 'tmpl';
         $pages = array();
         if (is_dir($path)) {
             // Loop through all files and separate them into arrays of images, folders, and other
             $dirIterator = new \DirectoryIterator($path);
             foreach ($dirIterator as $file) {
                 if ($file->isDot() || $file->isDir()) {
                     continue;
                 }
                 if ($file->isFile()) {
                     $name = $file->getFilename();
                     if (\Filesystem::extension($name) != 'php' || 'cvs' == strtolower($name) || '.svn' == strtolower($name)) {
                         continue;
                     }
                     $pages[] = strtolower(\Filesystem::name($name));
                 }
             }
             sort($pages);
         }
     }
     return $pages;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:book.php


注:本文中的Filesystem::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。