本文整理汇总了PHP中kFile::getFileNameNoExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP kFile::getFileNameNoExtension方法的具体用法?PHP kFile::getFileNameNoExtension怎么用?PHP kFile::getFileNameNoExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFile
的用法示例。
在下文中一共展示了kFile::getFileNameNoExtension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
/**
* Executes index action
*/
protected function executeImpl(kshow $kshow)
{
$this->xml_content = "";
$kshow_id = $this->kshow_id;
if ($kshow_id == NULL || $kshow_id == 0) {
return sfView::SUCCESS;
}
$metadata_creator = new myKshowMetadataCreator();
$this->show_metadata = $metadata_creator->createMetadata($kshow_id);
// $kshow = kshowPeer:retrieveByPK( $kshow_id );
$entry = entryPeer::retrieveByPK($kshow->getShowEntryId());
// TODO - this should never happen
if ($entry == NULL) {
// there is no show entry for this show !
$entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kshow->getProducerId());
}
$content_path = myContentStorage::getFSContentRootPath();
$file_path = $content_path . $entry->getDataPath();
// check to see if the content of the file changed
$current_metadata = kFile::getFileContent($file_path);
$comp_result = strcmp($this->show_metadata, $current_metadata);
if ($comp_result != 0) {
$ext = pathinfo($file_path, PATHINFO_EXTENSION);
if ($ext != "xml") {
// this is for the first time - override the template path by setting the data to NULL
$entry->setData(NULL);
$file_path = pathinfo($file_path, PATHINFO_DIRNAME) . "/" . kFile::getFileNameNoExtension($file_path) . ".xml";
}
// this will increment the name if needed
$entry->setData($file_path);
$file_path = $content_path . $entry->getDataPath();
$entry->save();
kFile::fullMkdir($file_path);
kFile::setFileContent($file_path, $this->show_metadata);
$this->xml_content = $this->show_metadata;
}
}
示例2: generateFilePathArr
/**
* (non-PHPdoc)
* @see lib/model/ISyncableFile#generateFilePathArr()
*/
public function generateFilePathArr($sub_type, $version = null)
{
static::validateFileSyncSubType($sub_type);
if ($sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_DATA) {
$data = $this->getData();
if ($this->getType() == entryType::MIX && (!$this->getData() || !strpos($this->getData(), 'xml'))) {
$data .= ".xml";
}
$res = myContentStorage::getGeneralEntityPath("entry/data", $this->getIntId(), $this->getId(), $data, $version);
// $res = myContentStorage::getGeneralEntityPath("entry/data", $this->getIntId(), $this->getId(), $this->getData(), $version);
} elseif ($sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT) {
$res = myContentStorage::getFileNameEdit(myContentStorage::getGeneralEntityPath("entry/data", $this->getIntId(), $this->getId(), $this->getData(), $version));
} elseif ($sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_THUMB) {
$res = myContentStorage::getGeneralEntityPath("entry/bigthumbnail", $this->getIntId(), $this->getId(), $this->getThumbnail(), $version);
} elseif ($sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_ARCHIVE) {
$res = null;
$data_path = myContentStorage::getGeneralEntityPath("entry/data", $this->getIntId(), $this->getId(), $this->getData(), $version);
// assume the suffix is not the same as the one on the data
$archive_path = dirname(str_replace("content/entry/", "archive/", $data_path)) . "/" . $this->getId();
if ($this->getArchiveExtension()) {
$res = $archive_path . "." . $this->getArchiveExtension();
} else {
$archive_pattern = $archive_path . ".*";
$arc_files = glob(myContentStorage::getFSContentRootPath() . $archive_pattern);
foreach ($arc_files as $full_path_name) {
// return the first file found
$res = $full_path_name;
break;
}
if (!$res) {
$res = $archive_pattern;
}
}
} elseif ($sub_type == self::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD) {
// in this case the $version is used as the format
$basename = kFile::getFileNameNoExtension($this->getData());
$path = myContentStorage::getGeneralEntityPath("entry/download", $this->getIntId(), $this->getId(), $basename);
$download_path = $path . ".{$version}";
$res = $download_path;
} else {
$path = "entry/data";
switch ($sub_type) {
case self::FILE_SYNC_ENTRY_SUB_TYPE_ISM:
$basename = $this->generateBaseFileName(0, $this->getIsmVersion());
$basename .= '.ism';
break;
case self::FILE_SYNC_ENTRY_SUB_TYPE_ISMC:
$basename = $this->generateBaseFileName(0, $this->getIsmVersion());
$basename .= '.ismc';
break;
case self::FILE_SYNC_ENTRY_SUB_TYPE_CONVERSION_LOG:
$basename = $this->generateBaseFileName(0, $this->getIsmVersion());
$basename .= '.log';
break;
}
$res = myContentStorage::getGeneralEntityPath($path, $this->getIntId(), $this->getId(), $basename);
}
return array(myContentStorage::getFSContentRootPath(), $res);
}
示例3: getThumbnailPath
private static function getThumbnailPath($path, $new_extension = '')
{
$fixed = str_replace("uploads/", "uploads/thumbnail/thumb_", $path);
return kFile::getFileNameNoExtension($fixed, true) . $new_extension;
}
示例4: getUrlAndName
private static function getUrlAndName($entry)
{
$data = kFileSyncUtils::getReadyLocalFilePathForKey($entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA));
// replaced__getDataPath
$entry_type = self::getEntryType($entry);
if ($entry_type->type == self::TYPE_RTMP) {
// the url should be where the RTMP service is
$url = self::getRTMPPath();
// the name should start with the content directory
// and should not include the file extension !
$name = pathinfo($data, PATHINFO_DIRNAME) . "/" . kFile::getFileNameNoExtension($data);
} else {
$url = requestUtils::getHost() . $data;
$name = pathinfo($data, PATHINFO_BASENAME);
}
$url_name = new urlName();
$url_name->url = $url;
$url_name->name = $name;
return $url_name;
}
示例5: getAllVersions_deprecated
public static function getAllVersions_deprecated($entityName, $int_id, $id, $fileName)
{
$c = strstr($fileName, '^') ? '^' : '&';
$parts = explode($c, $fileName);
if (count($parts) == 2 && strlen($parts[1])) {
// a template has no versions
$dir = '/content/templates/' . $entityName . '/';
$file_base = "";
//$parts[1];
return $dir . $file_base;
} else {
// $dir = '/content/'.$entityName.'/'.
// (intval($id / 1048576)).'/'.
// (intval($id / 1024) % 1024).'/';
//
$dir = '/content/' . $entityName . '/' . self::dirForId($int_id, $id, "");
$file_base = $id . '_';
//.$fileName;
}
$id_len = strlen($id . "_");
// iterate the directory and find all the files that start with $file_base
// the result will be tuples where the first element is the file's name, second is the file size
// TODO - use glob rather than dirListExtended
//$pattern = "|" . self::getFSContentRootPath(). "/" . $dir . "/^{$file_base}.*\.xml$";
$files = kFile::dirListExtended(self::getFSContentRootPath() . "/" . $dir, false, false, '/^' . $file_base . ".*\\.xml\$/");
if ($files == null) {
return null;
}
// from each file - strip the id and the file extension
// use the refernce to file_tuple - it will be modified
foreach ($files as &$file_tuple) {
// the file_name includes the id and the _, then the verson and finally the file extension
$file_version = substr(kFile::getFileNameNoExtension($file_tuple[0]), $id_len);
$file_tuple[] = $file_version;
// set the version in the forth place of the tuple.
}
if ($files == null) {
return null;
}
sort($files);
return $files;
}
示例6: flvFileName
public static function flvFileName($full_file_path)
{
$full_path = kFile::getFileNameNoExtension($full_file_path, true) . ".flv";
return $full_path;
}
示例7: getEntryIdFromFileName
protected static function getEntryIdFromFileName($file_name)
{
return kFile::getFileNameNoExtension($file_name);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:4,代码来源:kConversionClientBase.class.php
示例8: parse
private static function parse($searchImages, $content)
{
$results = array();
$message = '';
/*
* $object = array ( "id" => $entry->getId() ,
"url" => $entry->getDataUrl() ,
"tags" => $entry->getTags() ,
"title" => $entry->getName() ,
"thumb" => $entry->getThumbnailUrl() ,
"description" => $entry->getTags() );
*/
/*
* The result is in one single line - ends with new line
*
* <div class="tb pa">
* <div class="tm" id="Komondor_Westminster_Dog_Show.jpg" onclick="g('Komondor_Westminster_Dog_Show.jpg')">
* <div class="cl">
* <a href="http://commons.wikimedia.org/wiki/Image:Komondor_Westminster_Dog_Show.jpg">
* <img src="http://commons.wikimedia.org/w/thumb.php?f=Komondor_Westminster_Dog_Show.jpg&w=78" alt="Komondor_Westminster_Dog_Show.jpg" title="Komondor_Westminster_Dog_Show.jpg" />
* </a>
* </div>
* <div class="caption">Komondor_Westmins...</div>
* </div>
* <div class="ct">
* <strong>Categories:</strong>
* <a href="http://commons.wikimedia.org/wiki/Category:Westminster_Kennel_Club_Dog_Show">Westminster Kennel Club Dog Show</a>
* (<a href="search.php?a=1&t=r&z=30&q=dog+%2BCategory:Westminster_Kennel_Club_Dog_Show">+</a>/<a href="search.php?a=1&t=r&z=30&q=dog+-Category:Westminster_Kennel_Club_Dog_Show">-</a>),
* <a href="http://commons.wikimedia.org/wiki/Category:White_dogs">White dogs</a>
* (<a href="search.php?a=1&t=r&z=30&q=dog+%2BCategory:White_dogs">+</a>/<a href="search.php?a=1&t=r&z=30&q=dog+-Category:White_dogs">-</a>),
* <a href="http://commons.wikimedia.org/wiki/Category:Dogs">Dogs</a>
* (<a href="search.php?a=1&t=r&z=30&q=dog+%2BCategory:Dogs">+</a>/<a href="search.php?a=1&t=r&z=30&q=dog+-Category:Dogs">-</a>)
* <br /><br />
* <img src="images/by_icon.png" alt="BY" title="Attribution required" />
* <img src="images/sa_icon.png" alt="SA" title="Share-alike" />
* </div>
* </div>
*
*
*/
//<div class="tb pa">
// analyze search page thumbnails
if (preg_match_all('/<div [^>]*class="tb [^"]*">(.*?"cl".*?"ct".*?)<\\/div><\\/div>/s', $content, $entryContainers)) {
$i = 1;
foreach ($entryContainers[1] as $entryContainer) {
$data = null;
$tag = "";
if (preg_match('/<div class="cl">.*<a href="([^"]*)".*<img src="([^"]*)".*title="([^"]*)".*<\\/div>/s', $entryContainer, $entryData)) {
$url = $entryData[1];
// 1
$thumbnail = urldecode($entryData[2]);
//2
$title = kFile::getFileNameNoExtension($entryData[3]);
if ($title) {
$title = str_replace("_", " ", $title);
}
$data = array('thumb' => $thumbnail, 'title' => $title, 'id' => $url);
}
// We need to hit again any way to fetch the actual image - no use in extracting the tags here
//if (preg_match_all('/class="ct">.*?(.*?)$/s', $entryContainer, $entryTags ))
//if (preg_match_all('/class="ct">.*(<a [^>]*>(.*)<\/a>)*$/s', $entryContainer, $entryTags))
//if (preg_match_all('/class="ct">.*?(<a [^>]*>(.*?)<\/a>)+.*$/ms', $entryContainer, $entryTags )) //, PREG_SET_ORDER))
//if (preg_match_all('(class.*?(<a\s*[^>]*>))', $entryContainer, $entryTags )) //, PREG_SET_ORDER))
if (preg_match('/class="ct">.*?$/s', $entryContainer, $entryTagsContainer)) {
$tag = "";
if (preg_match_all('/<a [^>]*>(.*?)<\\/a>/s', $entryTagsContainer[0], $entryTags)) {
foreach ($entryTags[1] as $entryTag) {
if (strlen($entryTag) > 3) {
$tag .= ($tag ? ", " : "") . $entryTag;
}
}
$data["tags"] = $tag;
}
}
$results[] = $data;
$i++;
}
$status = "ok";
} else {
$status = "error";
}
return array('status' => $status, 'message' => $message, 'objects' => $results, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}