本文整理汇总了PHP中kFile::getFileContent方法的典型用法代码示例。如果您正苦于以下问题:PHP kFile::getFileContent方法的具体用法?PHP kFile::getFileContent怎么用?PHP kFile::getFileContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFile
的用法示例。
在下文中一共展示了kFile::getFileContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
/**
* Executes addComment action, which returns a form enabling the insertion of a comment
* The request may include 1 fields: entry id.
*/
protected function executeImpl(kshow $kshow, entry &$entry)
{
$version = @$_REQUEST["version"];
// it's a path on the disk
if (kString::beginsWith($version, ".")) {
// someone is trying to hack in the system
return sfView::ERROR;
}
// in case we're making a roughcut out of a regular invite, we start from scratch
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry->getDataPath($version) === null) {
$this->xml_content = "<xml></xml>";
return;
}
// fetch content of file from disk - it should hold the XML
$file_name = myContentStorage::getFSContentRootPath() . "/" . $entry->getDataPath($version);
//echo "[$file_name]";
if (kString::endsWith($file_name, "xml")) {
if (file_exists($file_name)) {
$this->xml_content = kFile::getFileContent($file_name);
// echo "[" . $this->xml_content . "]" ;
} else {
$this->xml_content = "<xml></xml>";
}
myMetadataUtils::updateEntryForPending($entry, $version, $this->xml_content);
} else {
return sfView::ERROR;
}
// this is NOT an xml file we are looking for !
}
示例2: 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;
}
}
示例3: transferVideoChunk
private static function transferVideoChunk($fb, $accessToken, $sessionId, $startOffset, $endOffset, $filePath, $workingDir, $pageId)
{
$chunkContent = kFile::getFileContent($filePath, $startOffset, $endOffset);
$chunkFilePath = $workingDir . DIRECTORY_SEPARATOR . 'file_' . $startOffset;
kFile::setFileContent($chunkFilePath, $chunkContent);
$data = array('upload_phase' => 'transfer', 'start_offset' => $startOffset, 'video_file_chunk' => $fb->videoToUpload($chunkFilePath), 'upload_session_id' => $sessionId);
$response = $fb->post("/" . $pageId . "/videos", $data, $accessToken);
$graphNode = $response->getGraphNode();
return $graphNode;
}