GetExampleScriptPath() public static method

public static GetExampleScriptPath ( $intCategoryId, $intExampleId )
コード例 #1
0
 public static function CodeLinks($strCategoryId, $strExampleId, $strSubId, $strCurrentScript)
 {
     $blnIsScript = false;
     $strReference = Examples::GetExampleScriptPath($strCategoryId, $strExampleId, $strSubId);
     if ($strCurrentScript == 'header.inc.php') {
         $strToReturn = '<span class="headerGray">header.inc.php</span>';
         $blnIsScript = true;
     } else {
         $strToReturn = sprintf('<a href="%s/../header.inc.php" class="headerLink">header.inc.php</a>', QApplication::$RequestUri);
     }
     $strToReturn .= ' &nbsp; | &nbsp; ';
     if ($strCurrentScript == 'footer.inc.php') {
         $strToReturn .= '<span class="headerGray">footer.inc.php</span>';
         $blnIsScript = true;
     } else {
         $strToReturn .= sprintf('<a href="%s/../footer.inc.php" class="headerLink">footer.inc.php</a>', QApplication::$RequestUri);
     }
     $strToReturn .= ' &nbsp; | &nbsp; ';
     if ($strCurrentScript == 'examples.css') {
         $strToReturn .= '<span class="headerGray">examples.css</span>';
         $blnIsScript = true;
     } else {
         $strToReturn .= sprintf('<a href="%s/../examples.css" class="headerLink">examples.css</a>', QApplication::$RequestUri);
     }
     $strToReturn .= ' &nbsp; | &nbsp; ';
     $strScriptname = substr($strReference, strrpos($strReference, '/') + 1);
     if ($strCurrentScript == $strScriptname) {
         $strToReturn .= sprintf('<span class="headerGray">%s</span>', $strScriptname);
         $blnIsScript = true;
     } else {
         $strToReturn .= sprintf('<a href="%s/../%s" class="headerLink">%s</a>', QApplication::$RequestUri, $strScriptname, $strScriptname);
     }
     // Current Number of Code Links
     $intCount = 4;
     if (file_exists(__DOCROOT__ . str_replace('.php', '.tpl.php', $strReference))) {
         $strToReturn .= ' &nbsp; | &nbsp; ';
         $strScriptname = substr(str_replace('.php', '.tpl.php', $strReference), strrpos(str_replace('.php', '.tpl.php', $strReference), '/') + 1);
         if ($strCurrentScript == $strScriptname) {
             $strToReturn .= sprintf('<span class="headerGray">%s</span>', $strScriptname);
             $blnIsScript = true;
         } else {
             $strToReturn .= sprintf('<a href="%s/../%s" class="headerLink">%s</a>', QApplication::$RequestUri, $strScriptname, $strScriptname);
         }
         $intCount++;
     }
     if ($strCategoryId == 'plugin') {
         if (!empty(Examples::$PluginAdditions[$strExampleId][$strSubId])) {
             $extraFiles = Examples::$PluginAdditions[$strExampleId][$strSubId];
         }
     }
     if (array_key_exists($strReference, Examples::$AdditionalCode)) {
         $extraFiles = Examples::$AdditionalCode[$strReference];
     }
     if (!empty($extraFiles)) {
         foreach ($extraFiles as $strCode) {
             if ($intCount % 7 == 0) {
                 $strToReturn .= '<br/>';
             } else {
                 $strToReturn .= ' &nbsp; | &nbsp; ';
             }
             $strScriptname = $strCode;
             if ($strCurrentScript == $strScriptname) {
                 $strToReturn .= sprintf('<span class="headerGray">%s</span>', preg_replace('/__.*__/', '', $strScriptname));
                 $blnIsScript = true;
             } else {
                 $strToReturn .= sprintf('<a href="%s/../%s" class="headerLink">%s</a>', QApplication::$RequestUri, $strScriptname, preg_replace('/__.*__/', '', $strScriptname));
             }
             $intCount++;
         }
     }
     if ($blnIsScript) {
         return $strToReturn;
     } else {
         QApplication::CloseWindow();
     }
 }
コード例 #2
0
ファイル: view_source.php プロジェクト: eliud254/q-auction
<?php

require_once dirname(__FILE__) . '/../../../../qcubed.inc.php';
require 'includes/examples.inc.php';
$intCategoryId = QApplication::PathInfo(0);
$intExampleId = QApplication::PathInfo(1);
$strScript = QApplication::PathInfo(2);
$strReference = Examples::GetExampleScriptPath($intCategoryId, $intExampleId);
$strName = Examples::GetExampleName($intCategoryId, $intExampleId);
if (!$strScript) {
    QApplication::Redirect(QApplication::$RequestUri . substr($strReference, strrpos($strReference, '/')));
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=<?php 
_p(QApplication::$EncodingType);
?>
" />
		<title>QCubed PHP 5 Development Framework - View Source</title>
		<link rel="stylesheet" type="text/css" href="<?php 
_p(__VIRTUAL_DIRECTORY__ . __CSS_ASSETS__ . '/styles.css');
?>
"></link>
		<link rel="stylesheet" type="text/css" href="<?php 
_p(__VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/includes/examples.css');
?>
"></link>
	</head>
	<body>
		<div id="page">