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


PHP QApplication::MakeDirectory方法代码示例

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


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

示例1: SaveHeadShot

 /**
  * Given a Temp File Path, this will save the database record AND copy the file at the temporary file path
  * to the file assets directory for headshots
  * @param string $strTempFilePath
  * @return void
  */
 public function SaveHeadShot($strTempFilePath)
 {
     // Figure out the Image Type
     $mixImageInfo = getimagesize($strTempFilePath);
     switch ($mixImageInfo['mime']) {
         case 'image/gif':
             $this->intImageTypeId = ImageType::gif;
             break;
         case 'image/jpeg':
             $this->intImageTypeId = ImageType::jpg;
             break;
         case 'image/png':
             $this->intImageTypeId = ImageType::png;
             break;
         default:
             throw new QCallerException('Image Type Not Supported: ' . $mixImageInfo['mime']);
     }
     // Start the Transaction
     HeadShot::GetDatabase()->TransactionBegin();
     // Save the DB Record, Make Folders (if appicable) and Save the File
     $this->Save();
     QApplication::MakeDirectory($this->Folder, 0777);
     copy($strTempFilePath, $this->Path);
     chmod($this->Path, 0777);
     // Commit the Transaction
     HeadShot::GetDatabase()->TransactionCommit();
 }
开发者ID:alcf,项目名称:chms,代码行数:33,代码来源:HeadShot.class.php

示例2: Log

 /**
  * This will log a message to the Qcodo Log.  Location of the log file is defined in __QCODO_LOG__
  * 
  * By default, this will log a "Normal" level log entry in the "default" Qcodo log file, which is
  * located at __QCODO_LOG__/default.log.txt
  * 
  * Either parameter can be overridden.
  * 
  * @param string $strMessage
  * @param integer $intLogLevel
  * @param string $strLogModule
  * @return void
  */
 public static function Log($strMessage, $intLogLevel = QLogLevel::Normal, $strLogModule = 'default')
 {
     // Cancel out if log level is too low
     if ($intLogLevel > self::$MinimumLogLevel) {
         return;
     }
     // Setup Log Path
     if (!defined('__QCODO_LOG__')) {
         throw new QCallerException('__QCODO_LOG__ must be defined before running QLog::Log');
     }
     // Cancel out if log path is null
     if (!__QCODO_LOG__) {
         return;
     }
     // Create the Log Directory if it does NOT yet exist
     if (!is_dir(__QCODO_LOG__)) {
         QApplication::MakeDirectory(__QCODO_LOG__, 0777);
     }
     // Setup the Line
     $strLine = sprintf("%5s | %s | %s | %s\r\n", getmypid(), QLogLevel::$NameArray[$intLogLevel], QDateTime::Now()->NowToString(QDateTime::FormatIso), self::FormatMessage($strMessage));
     // Open the File for Writing
     $strLogFilePath = __QCODO_LOG__ . '/' . $strLogModule . self::$Extension;
     $objFile = fopen($strLogFilePath, 'a');
     // Write the Line
     fwrite($objFile, $strLine);
     fclose($objFile);
 }
开发者ID:klucznik,项目名称:qcodo,代码行数:40,代码来源:QLog.class.php

示例3: SaveFile

 public function SaveFile($strPayload, $strPayloadCompressed)
 {
     QApplication::MakeDirectory($this->GetFolder(), 0777);
     file_put_contents($this->GetFilePath(), $strPayload);
     file_put_contents($this->GetFilePathCompressed(), $strPayloadCompressed, FILE_BINARY);
     chmod($this->GetFilePath(), 0666);
     chmod($this->GetFilePathCompressed(), 0666);
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:8,代码来源:PackageVersion.class.php

示例4: SaveFile

 /**
  * Given a file at a temp file path location, this will save the file to the repository
  * and save the db row record.
  * @param string $strTemporaryFilePath the temporary file path to the file being saved to the repository
  * @param string $strFileName the name of the file that was originally uploaded
  * @return void
  */
 public function SaveFile($strTemporaryFilePath, $strFileName)
 {
     // Update wiki file metadata
     $this->FileName = $strFileName;
     $this->FileSize = filesize($strTemporaryFilePath);
     $this->FileMime = QMimeType::GetMimeTypeForFilename($strFileName);
     // Save the Row
     $this->Save();
     // Copy the File
     QApplication::MakeDirectory($this->GetFolder(), 0777);
     copy($strTemporaryFilePath, $this->GetPath());
     chmod($this->GetPath(), 0666);
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:20,代码来源:WikiFile.class.php

示例5: RenderImageMagickHelper

 /**
  * Used by custom RenderImage method to output the final image.
  * Uses $this->strImageType to determine type of image to be rendered.
  * This version is to be used when rendering an image using the Imagick library.
  * 
  * If strPath is not set, output to the screen.  If it is, save to strPath.
  *
  * @param Imagick $objFinalImage image as an instance of the Imagick class
  * @param string $strPath
  */
 protected function RenderImageMagickHelper($objFinalImage, $strPath)
 {
     // Output the Image (if path isn't specified, output to buffer.  Otherwise, output to disk)
     if (!$strPath) {
         $strPath = $this->strImagickTempFilePath . '/image_' . str_replace('.', '_', microtime(true));
         // Output to a temporary location
         switch ($this->strImageType) {
             case QImageType::Gif:
                 $strPath .= '.gif';
                 $objFinalImage->setImageFormat('gif');
                 header('Content-Type: image/gif');
                 break;
             case QImageType::AnimatedGif:
                 $strPath .= '.gif';
                 $objFinalImage->setImageFormat('gif');
                 header('Content-Type: image/gif');
                 break;
             case QImageType::Jpeg:
                 $strPath .= '.jpg';
                 $objFinalImage->setImageFormat('jpeg');
                 $objFinalImage->setCompressionQuality($this->intJpegQuality);
                 header('Content-Type: image/jpeg');
                 break;
             default:
                 $strPath .= '.png';
                 $objFinalImage->setImageFormat('png');
                 header('Content-Type: image/png');
                 break;
         }
         if ($this->strImageType == QImageType::AnimatedGif) {
             file_put_contents($strPath, $objFinalImage->GetImagesBlob());
         } else {
             $objFinalImage->writeImage($strPath);
         }
         QApplication::$ProcessOutput = false;
         header('Cache-Control: cache');
         header('Expires: Wed, 20 Mar 2019 05:00:00 GMT');
         header('Pragma: cache');
         print file_get_contents($strPath);
         unlink($strPath);
     } else {
         // Make Directory
         QApplication::MakeDirectory(dirname($strPath), 0777);
         // Output to Disk
         switch ($this->strImageType) {
             case QImageType::Gif:
                 $objFinalImage->setImageFormat('gif');
                 break;
             case QImageType::AnimatedGif:
                 $objFinalImage->setImageFormat('gif');
                 break;
             case QImageType::Jpeg:
                 $objFinalImage->setImageFormat('jpeg');
                 $objFinalImage->setCompressionQuality($this->intJpegQuality);
                 break;
             default:
                 $objFinalImage->setImageFormat('png');
                 break;
         }
         $objFinalImage->writeImage($strPath);
         chmod($strPath, 0777);
     }
     $objFinalImage->Destroy();
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:74,代码来源:QImageBase.class.php

示例6: ini_set

<?php

ini_set("memory_limit", "1024M");
// Make the Directory
if (!is_dir(STATISTICS_PDF_PATH)) {
    QApplication::MakeDirectory(STATISTICS_PDF_PATH, 0777);
}
// Anything to Load?
if (is_file(STATISTICS_PDF_PATH . '/run.txt')) {
    $strTokens = explode(' ', trim(file_get_contents(STATISTICS_PDF_PATH . '/run.txt')));
    $intYear = intval($strTokens[0]);
    unlink(STATISTICS_PDF_PATH . '/run.txt');
} else {
    exit(0);
}
if ($intYear < 1950 || $intYear > 2500) {
    exit(0);
}
// Setup Zend Framework load
set_include_path(get_include_path() . ':' . __INCLUDES__);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Pdf');
print "Generating Statistics PDF for " . $intYear . "\r\n";
// Delete Old Files
exec('rm -r -f ' . STATISTICS_PDF_PATH . '/StatisticsFor' . $intYear . '*.pdf');
// Create the PDF Object for the PDF
$objStatisticPdf = new Zend_Pdf();
$dtxAfterValue = new QDateTime("1/1/" . $intYear);
$dtxBeforeValue = new QDateTime("12/31/" . $intYear);
// Get the Data
$objContributionCursor = StewardshipContribution::QueryCursor(QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, $dtxAfterValue), QQ::LessOrEqual(QQN::StewardshipContribution()->DateCredited, $dtxBeforeValue)));
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:generate-giving-statistics.cli.php

示例7: SaveWithImage

 public function SaveWithImage($strTemporaryFilePath)
 {
     // Get Image Info and Ensure a Valid Image
     $arrValues = getimagesize($strTemporaryFilePath);
     if (!$arrValues || !count($arrValues) || !$arrValues[0] || !$arrValues[1] || !$arrValues[2]) {
         throw new QCallerException('Not a valid image file: ' . $strTemporaryFilePath);
     }
     // Update image metadata info
     switch ($arrValues[2]) {
         case IMAGETYPE_JPEG:
             $this->intImageFileTypeId = ImageFileType::Jpeg;
             break;
         case IMAGETYPE_PNG:
             $this->intImageFileTypeId = ImageFileType::Png;
             break;
         case IMAGETYPE_GIF:
             $this->intImageFileTypeId = ImageFileType::Gif;
             break;
         default:
             throw new QCallerException('Not a valid image file: ' . $strTemporaryFilePath);
     }
     $this->Save();
     QApplication::MakeDirectory($this->GetImageFolder(), 0777);
     copy($strTemporaryFilePath, $this->GetImagePath());
     chmod($this->GetImagePath(), 0666);
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:26,代码来源:ShowcaseItem.class.php

示例8: GetThumbPath

 /**
  * This will return the web/docroot-relative path for the thumbnail image for this wiki image
  * NOTE: if the thumbnail does not exist, this will also CREATE the thumbnail
  * @return string
  */
 public function GetThumbPath()
 {
     // calculate the web/docroot-relative path
     $strThumbPath = $this->GetThumbFolder() . '/' . $this->intWikiVersionId . '.' . ImageFileType::$ExtensionArray[$this->intImageFileTypeId];
     // See if the thumbnail image, itself exists
     if (file_exists(__DOCROOT__ . $strThumbPath)) {
         return $strThumbPath;
     }
     // It does NOT exist -- we need to create it first
     QApplication::MakeDirectory(__DOCROOT__ . $this->GetThumbFolder(), 0777);
     $objImageControl = new QImageControl(null);
     $objImageControl->ImagePath = $this->GetPath();
     $objImageControl->Width = 240;
     $objImageControl->Height = 240;
     $objImageControl->ScaleCanvasDown = true;
     $objImageControl->ScaleImageUp = false;
     $objImageControl->RenderImage(__DOCROOT__ . $strThumbPath);
     return $strThumbPath;
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:24,代码来源:WikiImage.class.php

示例9: Run

 protected static function Run()
 {
     // Get the RenderedPage (if applicable)
     if (ob_get_length()) {
         QErrorHandler::$RenderedPage = ob_get_contents();
         ob_clean();
     }
     // Setup the FileLinesArray
     QErrorHandler::$FileLinesArray = file(QErrorHandler::$Filename);
     // Set up the MessageBody
     QErrorHandler::$MessageBody = htmlentities(QErrorHandler::$Message);
     QErrorHandler::$MessageBody = str_replace(" ", "&nbsp;", str_replace("\n", "<br/>\n", QErrorHandler::$MessageBody));
     QErrorHandler::$MessageBody = str_replace(":&nbsp;", ": ", QErrorHandler::$MessageBody);
     // Figure Out DateTime (and if we are logging, the filename of the error log)
     $strMicrotime = microtime();
     $strParts = explode(' ', $strMicrotime);
     $strMicrotime = substr($strParts[0], 2);
     $intTimestamp = $strParts[1];
     QErrorHandler::$DateTimeOfError = date('l, F j Y, g:i:s.' . $strMicrotime . ' A T', $intTimestamp);
     QErrorHandler::$IsoDateTimeOfError = date('Y-m-d H:i:s T', $intTimestamp);
     if (defined('__ERROR_LOG__') && __ERROR_LOG__ && defined('ERROR_LOG_FLAG') && ERROR_LOG_FLAG) {
         QErrorHandler::$FileNameOfError = sprintf('qcodo_error_%s_%s.html', date('Y-m-d_His', $intTimestamp), $strMicrotime);
     }
     // Cleanup
     unset($strMicrotime);
     unset($strParts);
     unset($strMicrotime);
     unset($intTimestamp);
     // Generate the Error Dump
     if (!ob_get_level()) {
         ob_start();
     }
     require __QCODO_CORE__ . '/assets/error_dump.inc.php';
     // Do We Log???
     if (defined('__ERROR_LOG__') && __ERROR_LOG__ && defined('ERROR_LOG_FLAG') && ERROR_LOG_FLAG) {
         // Log to File in __ERROR_LOG__
         $strContents = ob_get_contents();
         QApplication::MakeDirectory(__ERROR_LOG__, 0777);
         $strFileName = sprintf('%s/%s', __ERROR_LOG__, QErrorHandler::$FileNameOfError);
         file_put_contents($strFileName, $strContents);
         @chmod($strFileName, 0666);
     }
     if (QApplication::$RequestMode == QRequestMode::Ajax) {
         if (defined('ERROR_FRIENDLY_AJAX_MESSAGE') && ERROR_FRIENDLY_AJAX_MESSAGE) {
             // Reset the Buffer
             while (ob_get_level()) {
                 ob_end_clean();
             }
             // Setup the Friendly Response
             header('Content-Type: text/xml');
             $strToReturn = '<controls/><commands><command>alert("' . str_replace('"', '\\"', ERROR_FRIENDLY_AJAX_MESSAGE) . '");</command></commands>';
             if (QApplication::$EncodingType) {
                 printf("<?xml version=\"1.0\" encoding=\"%s\"?><response>%s</response>\r\n", QApplication::$EncodingType, $strToReturn);
             } else {
                 printf("<?xml version=\"1.0\"?><response>%s</response>\r\n", $strToReturn);
             }
             return false;
         }
     } else {
         if (defined('ERROR_FRIENDLY_PAGE_PATH') && ERROR_FRIENDLY_PAGE_PATH) {
             // Reset the Buffer
             while (ob_get_level()) {
                 ob_end_clean();
             }
             header("HTTP/1.1 500 Internal Server Error");
             require ERROR_FRIENDLY_PAGE_PATH;
         }
     }
     exit;
 }
开发者ID:klucznik,项目名称:qcodo,代码行数:70,代码来源:QErrorHandler.class.php

示例10: GenerateFile

 /**
  * Generates a php code using a template file
  *
  * @param string $strModuleName
  * @param string $strFilename
  * @param boolean $blnOverrideFlag whether we are using the _core template, or using a custom one
  * @param mixed[] $mixArgumentArray
  * @param boolean $blnSave whether or not to actually perform the save
  * @throws QCallerException
  * @throws Exception
  * @return mixed returns the evaluated template or boolean save success.
  */
 public function GenerateFile($strModuleName, $strFilename, $blnOverrideFlag, $mixArgumentArray, $blnSave = true)
 {
     // Figure out the actual TemplateFilePath
     if ($blnOverrideFlag) {
         $strTemplateFilePath = __QCUBED__ . QCodeGen::TemplatesPathCustom . $strModuleName . '/' . $strFilename;
     } else {
         $strTemplateFilePath = __QCUBED_CORE__ . QCodeGen::TemplatesPath . $strModuleName . '/' . $strFilename;
     }
     // Setup Debug/Exception Message
     if (QCodeGen::DebugMode) {
         _p("Evaluating {$strTemplateFilePath}<br/>", false);
     }
     // Check to see if the template file exists, and if it does, Load It
     if (!file_exists($strTemplateFilePath)) {
         throw new QCallerException('Template File Not Found: ' . $strTemplateFilePath);
     }
     // Evaluate the Template
     if (substr($strFilename, strlen($strFilename) - 8) == '.tpl.php') {
         // make sure paths are set up to pick up included files from both the override directory and _core directory
         $strSearchPath = __QCUBED__ . QCodeGen::TemplatesPathCustom . $strModuleName . PATH_SEPARATOR . __QCUBED_CORE__ . QCodeGen::TemplatesPath . $strModuleName . PATH_SEPARATOR . get_include_path();
         set_include_path($strSearchPath);
         if ($strSearchPath != get_include_path()) {
             throw new QCallerException('Can\'t override include path. Make sure your apache or server settings allow include paths to be overridden. ');
         }
         $strTemplate = $this->EvaluatePHP($strTemplateFilePath, $strModuleName, $mixArgumentArray, $templateSettings);
         restore_include_path();
         if (!isset($templateSettings) || !$templateSettings) {
             // check if we have old style <template .../> settings
             $templateSettings = $this->getTemplateSettings($strTemplateFilePath, $strTemplate);
         }
     } else {
         $strTemplate = file_get_contents($strTemplateFilePath);
         $strTemplate = $this->EvaluateTemplate($strTemplate, $strModuleName, $mixArgumentArray);
         $templateSettings = $this->getTemplateSettings($strTemplateFilePath, $strTemplate);
     }
     $blnOverwriteFlag = QType::Cast($templateSettings['OverwriteFlag'], QType::Boolean);
     $blnDocrootFlag = QType::Cast($templateSettings['DocrootFlag'], QType::Boolean);
     $strTargetDirectory = QType::Cast($templateSettings['TargetDirectory'], QType::String);
     $strDirectorySuffix = QType::Cast($templateSettings['DirectorySuffix'], QType::String);
     $strTargetFileName = QType::Cast($templateSettings['TargetFileName'], QType::String);
     if (is_null($blnOverwriteFlag) || is_null($strTargetFileName) || is_null($strTargetDirectory) || is_null($strDirectorySuffix) || is_null($blnDocrootFlag)) {
         throw new Exception('the template settings cannot be null');
     }
     if ($blnSave && $strTargetDirectory) {
         // Figure out the REAL target directory
         if ($blnDocrootFlag) {
             $strTargetDirectory = __DOCROOT__ . $strTargetDirectory . $strDirectorySuffix;
         } else {
             $strTargetDirectory = $strTargetDirectory . $strDirectorySuffix;
         }
         // Create Directory (if needed)
         if (!is_dir($strTargetDirectory)) {
             if (!QApplication::MakeDirectory($strTargetDirectory, 0777)) {
                 throw new Exception('Unable to mkdir ' . $strTargetDirectory);
             }
         }
         // Save to Disk
         $strFilePath = sprintf('%s/%s', $strTargetDirectory, $strTargetFileName);
         if ($blnOverwriteFlag || !file_exists($strFilePath)) {
             $intBytesSaved = file_put_contents($strFilePath, $strTemplate);
             $this->setGeneratedFilePermissions($strFilePath);
             return $intBytesSaved == strlen($strTemplate);
         } else {
             // Becuase we are not supposed to overwrite, we should return "true" by default
             return true;
         }
     }
     // Why Did We Not Save?
     if ($blnSave) {
         // We WANT to Save, but QCubed Configuration says that this functionality/feature should no longer be generated
         // By definition, we should return "true"
         return true;
     }
     // Running GenerateFile() specifically asking it not to save -- so return the evaluated template instead
     return $strTemplate;
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:88,代码来源:QCodeGenBase.class.php

示例11: GenerateFile

 /**
  * Enter description here...
  *
  * @param string $strModuleName
  * @param string $strFilename
  * @param boolean $blnOverrideFlag whether we are using the _core template, or using a custom one
  * @param mixed[] $mixArgumentArray
  * @param boolean $blnSave wheather or not to actually perform the save
  * @return mixed returns the evaluated template or boolean save success.
  */
 public function GenerateFile($strModuleName, $strFilename, $blnOverrideFlag, $mixArgumentArray, $blnSave = true)
 {
     // Figure out the actual TemplateFilePath
     if ($blnOverrideFlag) {
         $strTemplateFilePath = __QCUBED__ . QCodeGen::TemplatesPathCustom . $strModuleName . '/' . $strFilename;
     } else {
         $strTemplateFilePath = __QCUBED_CORE__ . QCodeGen::TemplatesPath . $strModuleName . '/' . $strFilename;
     }
     // Setup Debug/Exception Message
     if (QCodeGen::DebugMode) {
         _p("Evaluating {$strTemplateFilePath}<br/>", false);
     }
     $strError = 'Template\'s first line must be <template OverwriteFlag="boolean" DocrootFlag="boolean" TargetDirectory="string" DirectorySuffix="string" TargetFileName="string"/>: ' . $strTemplateFilePath;
     // Check to see if the template file exists, and if it does, Load It
     if (!file_exists($strTemplateFilePath)) {
         throw new QCallerException('Template File Not Found: ' . $strTemplateFilePath);
     }
     $strTemplate = file_get_contents($strTemplateFilePath);
     // Evaluate the Template
     if (substr($strFilename, strlen($strFilename) - 8) == '.tpl.php') {
         // make sure paths are set up to pick up included files from both the override directory and _core directory
         $strSearchPath = __QCUBED__ . QCodeGen::TemplatesPathCustom . $strModuleName . PATH_SEPARATOR . __QCUBED_CORE__ . QCodeGen::TemplatesPath . $strModuleName . PATH_SEPARATOR . get_include_path();
         set_include_path($strSearchPath);
         if ($strSearchPath != get_include_path()) {
             throw new QCallerException('Can\'t override include path. Make sure your apache or server settings allow include paths to be overriden. ');
         }
         $strTemplate = $this->EvaluatePHP($strTemplateFilePath, $strModuleName, $mixArgumentArray);
         restore_include_path();
     } else {
         $strTemplate = $this->EvaluateTemplate($strTemplate, $strModuleName, $mixArgumentArray);
     }
     // Parse out the first line (which contains path and overwriting information)
     $intPosition = strpos($strTemplate, "\n");
     if ($intPosition === false) {
         throw new Exception($strError);
     }
     $strFirstLine = trim(substr($strTemplate, 0, $intPosition));
     $strTemplate = substr($strTemplate, $intPosition + 1);
     $objTemplateXml = null;
     // Attempt to Parse the First Line as XML
     try {
         @($objTemplateXml = new SimpleXMLElement($strFirstLine));
     } catch (Exception $objExc) {
     }
     if (is_null($objTemplateXml) || !$objTemplateXml instanceof SimpleXMLElement) {
         throw new Exception($strError);
     }
     $blnOverwriteFlag = QType::Cast($objTemplateXml['OverwriteFlag'], QType::Boolean);
     $blnDocrootFlag = QType::Cast($objTemplateXml['DocrootFlag'], QType::Boolean);
     $strTargetDirectory = QType::Cast($objTemplateXml['TargetDirectory'], QType::String);
     $strDirectorySuffix = QType::Cast($objTemplateXml['DirectorySuffix'], QType::String);
     $strTargetFileName = QType::Cast($objTemplateXml['TargetFileName'], QType::String);
     if (is_null($blnOverwriteFlag) || is_null($strTargetFileName) || is_null($strTargetDirectory) || is_null($strDirectorySuffix) || is_null($blnDocrootFlag)) {
         throw new Exception($strError);
     }
     if ($blnSave && $strTargetDirectory) {
         // Figure out the REAL target directory
         if ($blnDocrootFlag) {
             $strTargetDirectory = __DOCROOT__ . $strTargetDirectory . $strDirectorySuffix;
         } else {
             $strTargetDirectory = $strTargetDirectory . $strDirectorySuffix;
         }
         // Create Directory (if needed)
         if (!is_dir($strTargetDirectory)) {
             if (!QApplication::MakeDirectory($strTargetDirectory, 0777)) {
                 throw new Exception('Unable to mkdir ' . $strTargetDirectory);
             }
         }
         // Save to Disk
         $strFilePath = sprintf('%s/%s', $strTargetDirectory, $strTargetFileName);
         if ($blnOverwriteFlag || !file_exists($strFilePath)) {
             $intBytesSaved = file_put_contents($strFilePath, $strTemplate);
             $this->setGeneratedFilePermissions($strFilePath);
             return $intBytesSaved == strlen($strTemplate);
         } else {
             // Becuase we are not supposed to overwrite, we should return "true" by default
             return true;
         }
     }
     // Why Did We Not Save?
     if ($blnSave) {
         // We WANT to Save, but QCubed Configuration says that this functionality/feature should no longer be generated
         // By definition, we should return "true"
         return true;
     } else {
         // Running GenerateFile() specifically asking it not to save -- so return the evaluated template instead
         return $strTemplate;
     }
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:99,代码来源:QCodeGenBase.class.php

示例12: SaveFileFromQpm

 /**
  * This will save the contents of the base64_decoded data to the filesystem.
  * @param string $strAlternateToken
  * @return void
  */
 public function SaveFileFromQpm($strAlternateToken = null)
 {
     $strDecodedData = base64_decode($this->Base64Data);
     if (md5($strDecodedData) != $this->Md5) {
         print "WARNING: Invalid MD5 Match for " . $this->Path . "\r\n";
     }
     QApplication::MakeDirectory(dirname($this->GetFullPath()));
     if ($strAlternateToken) {
         file_put_contents($this->GetFullPathWithAlternateToken($strAlternateToken), $strDecodedData);
     } else {
         file_put_contents($this->GetFullPath(), $strDecodedData);
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:18,代码来源:_manifest_helpers.inc.php

示例13: ini_set

<?php

ini_set("memory_limit", "1024M");
// Make the Directory
if (!is_dir(RECEIPT_PDF_PATH)) {
    QApplication::MakeDirectory(RECEIPT_PDF_PATH, 0777);
}
// Anything to Load?
if (is_file(RECEIPT_PDF_PATH . '/run.txt')) {
    $strTokens = explode(' ', trim(file_get_contents(RECEIPT_PDF_PATH . '/run.txt')));
    $intYear = intval($strTokens[0]);
    $blnAnnual = strtolower($strTokens[1]) == 'annual';
    $intQuarter = intval($strTokens[1]);
    unlink(RECEIPT_PDF_PATH . '/run.txt');
} else {
    exit(0);
}
if ($intYear < 1950 || $intYear > 2500) {
    exit(0);
}
$strFileToken = $blnAnnual ? '_Annual' : '_Quarterly';
$fltMinimumAmount = $blnAnnual ? 0 : 249.99;
// Setup Zend Framework load
set_include_path(get_include_path() . ':' . __INCLUDES__);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Pdf');
print "Generating Receipts PDF for " . $intYear . "\r\n";
// Delete Old Files
exec('rm -r -f ' . RECEIPT_PDF_PATH . '/ReceiptsFor' . $intYear . '*.pdf');
// Create the PDF Object for the Single and Multiple-page PDFs
$intSingplePageCount = 1;
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:generate-receipt-pdfs.cli.php

示例14: SaveImageFile

 /**
  * Given a path to a TIFF image, this will save that image file
  * to the contribution_image repository
  * @param string $strTemporaryFilePath
  */
 public function SaveImageFile($strTemporaryFilePath)
 {
     if (!$this->Id) {
         throw new QCallerException('Cannot Save Image File on an unsaved Contribution record');
     }
     $this->DeleteImageFile();
     if (!is_dir($this->Folder)) {
         QApplication::MakeDirectory($this->Folder, 0777);
     }
     copy($strTemporaryFilePath, $this->Path);
     chmod($this->Path, 0777);
 }
开发者ID:alcf,项目名称:chms,代码行数:17,代码来源:StewardshipContribution.class.php

示例15: GenerateFile

 /**
  * Enter description here...
  *
  * @param string $strModuleName
  * @param string $strFilename
  * @param boolean $blnOverrideFlag whether we are using the _core template, or using a custom one
  * @param mixed[] $mixArgumentArray
  * @param boolean $blnSave wheather or not to actually perform the save
  * @return mixed returns the evaluated template or boolean save success.
  */
 public function GenerateFile($strModuleName, $strFilename, $blnOverrideFlag, $mixArgumentArray, $blnSave = true)
 {
     // Figure out the actual TemplateFilePath
     if ($blnOverrideFlag) {
         $strTemplateFilePath = __QCODO__ . QCodeGen::TemplatesPathCustom . $strModuleName . '/' . $strFilename;
     } else {
         $strTemplateFilePath = __QCODO_CORE__ . QCodeGen::TemplatesPath . $strModuleName . '/' . $strFilename;
     }
     // Setup Debug/Exception Message
     if (QCodeGen::DebugMode) {
         _p("Evaluating {$strTemplateFilePath}<br/>", false);
     }
     $strError = 'Template\'s first line must be <template OverwriteFlag="boolean" DocrootFlag="boolean" TargetDirectory="string" DirectorySuffix="string" TargetFileName="string"/>: ' . $strTemplateFilePath;
     // Check to see if the template file exists, and if it does, Load It
     if (!file_exists($strTemplateFilePath)) {
         throw new QCallerException('Template File Not Found: ' . $strTemplateFilePath);
     }
     $strTemplate = file_get_contents($strTemplateFilePath);
     // Evaluate the Template
     $strTemplate = $this->EvaluateTemplate($strTemplate, $strModuleName, $mixArgumentArray);
     // Parse out the first line (which contains path and overwriting information)
     $intPosition = strpos($strTemplate, "\n");
     if ($intPosition === false) {
         throw new Exception($strError);
     }
     $strFirstLine = trim(substr($strTemplate, 0, $intPosition));
     $strTemplate = substr($strTemplate, $intPosition + 1);
     $objTemplateXml = null;
     // Attempt to Parse the First Line as XML
     try {
         @($objTemplateXml = new SimpleXMLElement($strFirstLine));
     } catch (Exception $objExc) {
     }
     if (is_null($objTemplateXml) || !$objTemplateXml instanceof SimpleXMLElement) {
         throw new Exception($strError);
     }
     $blnOverwriteFlag = QType::Cast($objTemplateXml['OverwriteFlag'], QType::Boolean);
     $blnDocrootFlag = QType::Cast($objTemplateXml['DocrootFlag'], QType::Boolean);
     $strTargetDirectory = QType::Cast($objTemplateXml['TargetDirectory'], QType::String);
     $strDirectorySuffix = QType::Cast($objTemplateXml['DirectorySuffix'], QType::String);
     $strTargetFileName = QType::Cast($objTemplateXml['TargetFileName'], QType::String);
     if (is_null($blnOverwriteFlag) || is_null($strTargetFileName) || is_null($strTargetDirectory) || is_null($strDirectorySuffix) || is_null($blnDocrootFlag)) {
         throw new Exception($strError);
     }
     if ($blnSave && $strTargetDirectory) {
         // Figure out the REAL target directory
         if ($blnDocrootFlag) {
             $strTargetDirectory = __DOCROOT__ . $strTargetDirectory . $strDirectorySuffix;
         } else {
             $strTargetDirectory = $strTargetDirectory . $strDirectorySuffix;
         }
         // Create Directory (if needed)
         if (!is_dir($strTargetDirectory)) {
             if (!QApplication::MakeDirectory($strTargetDirectory, 0777)) {
                 throw new Exception('Unable to mkdir ' . $strTargetDirectory);
             }
         }
         // Save to Disk
         $strFilePath = sprintf('%s/%s', $strTargetDirectory, $strTargetFileName);
         if ($blnOverwriteFlag || !file_exists($strFilePath)) {
             $intBytesSaved = file_put_contents($strFilePath, $strTemplate);
             // CHMOD to full read/write permissions (applicable only to nonwindows)
             // Need to ignore error handling for this call just in case
             QApplication::SetErrorHandler(null);
             chmod($strFilePath, 0666);
             QApplication::RestoreErrorHandler();
             return $intBytesSaved == strlen($strTemplate);
         } else {
             // Becuase we are not supposed to overwrite, we should return "true" by default
             return true;
         }
     }
     // Why Did We Not Save?
     if ($blnSave) {
         // We WANT to Save, but Qcodo Configuration says that this functionality/feature should no longer be generated
         // By definition, we should return "true"
         return true;
     } else {
         // Running GenerateFile() specifically asking it not to save -- so return the evaluated template instead
         return $strTemplate;
     }
 }
开发者ID:kmcelhinney,项目名称:qcodo,代码行数:92,代码来源:QCodeGenBase.class.php


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