public static function PageLinks() { $strPrevious = null; $strNext = null; $blnFound = false; $strScript = QApplication::$ScriptName; if (strpos($strScript, "plugin") !== false && strpos($strScript, "vendor") !== false) { // a plugin $strLink = QHtml::RenderLink(QHtml::MakeUrl(__DEVTOOLS_ASSETS__ . '/plugin_manager.php'), "Plugin Manager", ["class" => "headerLink"]); return $strLink; } foreach (Examples::$Categories as $objExampleCategory) { if (!$blnFound) { $strPrevious = null; $strNext = null; foreach ($objExampleCategory as $strKey => $strExample) { if (is_numeric($strKey)) { // Pull out the URL fragment from the example tree $intPosition = strpos($strExample, ' '); $strScriptName = substr($strExample, 0, $intPosition); $strDescription = substr($strExample, $intPosition + 1); $qapp = QApplication::$ScriptName; if (!$blnFound) { if (strpos(QApplication::$ScriptName, $strScriptName) !== false || strpos($strScriptName, QApplication::$ScriptName) !== false) { // for plugins examples $blnFound = true; } else { $strPrevious = sprintf('<strong><a href="%s" class="headerLink"><< %s</a></strong>', $strScriptName, $strDescription); } } else { if (!$strNext) { $strNext = sprintf('<strong><a href="%s" class="headerLink">%s >></a></strong>', $strScriptName, $strDescription); } } } } } } $strToReturn = ''; if ($strPrevious) { $strToReturn = $strPrevious; } else { $strToReturn = '<span class="headerGray"><< Previous</span>'; } $intCategoryId = Examples::GetCategoryId(); if ($intCategoryId < 3) { $intPartId = 1; } else { if ($intCategoryId < 10) { $intPartId = 2; } else { $intPartId = 3; } } $strToReturn .= ' | '; $strToReturn .= sprintf('<strong><a href="%s/index.php%s" class="headerLink">Back to Main</a></strong>', __VIRTUAL_DIRECTORY__ . __EXAMPLES__, $intPartId == 1 ? "" : "/" . $intPartId); $strToReturn .= ' | '; if ($strNext) { $strToReturn .= $strNext; } else { $strToReturn .= '<span class="headerGray">Next >></span>'; } return $strToReturn; }
<?php // The url to send to view_source.php // first encode the basic info $strCatId = Examples::GetCategoryId(); $strUrl = __VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/view_source.php/' . $strCatId . '/' . Examples::GetExampleId(); if ($strCatId == "plugin") { $strFile = Examples::GetPluginFile(); $strUrl .= '/' . $strFile . '/' . $strFile; } else { $strUrl .= '/' . basename(QApplication::$ScriptName); } if (!isset($mainPage)) { ?> <button id="viewSource">View Source</button> <?php } ?> </section> <footer> <div id="tagline"><a href="http://qcubed.github.com/" title="QCubed Homepage"><img id="logo" src="<?php _p(__VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__ . '/qcubed_logo_footer.png', false); ?> " alt="QCubed Framework" /> <span class="version"><?php _p(QCUBED_VERSION); ?> </span></a></div> </footer> <script type="text/javascript"> // jQuery isn't always available
while installing, as well as uninstalling your plugin.<br /><br /> Then, create a few folders under the root, and place the files that you want to be distributed with the plugin there - the structure is entirely up to you. You may want to put all your included PHP files under the includes directory, or you may not; you can put all images in a separate folder, or just keep them as siblings of the configuration file. <br /><br /> A plugin is described through a <b>QPlugin</b> object - you can see all the properties of that object by inspecting the <b><?php echo substr(__QCUBED_CORE__, strlen(__DOCROOT__)); ?> /framework/QPluginInterface.class.php</b> file. <a href="javascript:ViewSource(<?php _p(Examples::GetCategoryId() . ',' . Examples::GetExampleId() . ',"__CORE_FRAMEWORK__QPluginInterface.class.php"'); ?> );">Take a look </a>at it now.<br /><br /> To define the QPlugin object, we'll first set simple metadata on it: <div style="padding-left: 50px;"> <code> $objPlugin = new QPlugin();<br /> $objPlugin->strName = "MyCoolPlugin"; // no spaces allowed<br /> $objPlugin->strDescription = 'A great little plugin that does this and that';<br /> $objPlugin->strVersion = "0.1";<br /> $objPlugin->strPlatformVersion = "1.1"; // version of QCubed that this plugin works well with<br /> $objPlugin->strAuthorName = "Alex Weinstein, a.k.a. alex94040";<br /> $objPlugin->strAuthorEmail ="alex94040 [at] yahoo [dot] com"; </code>
public static function PageLinks() { $strPrevious = null; $strNext = null; $blnFound = false; foreach (Examples::$Categories as $objExampleCategory) { if (!$blnFound) { $strPrevious = null; $strNext = null; foreach ($objExampleCategory as $strKey => $strExample) { if (is_numeric($strKey)) { // Pull out the URL fragment from the example tree $intPosition = strpos($strExample, ' '); $strScriptName = substr($strExample, 0, $intPosition); $strDescription = substr($strExample, $intPosition + 1); if (!$blnFound) { if (strpos(QApplication::$ScriptName, $strScriptName) !== false) { $blnFound = true; } else { $strPrevious = sprintf('<b><a href="%s/examples%s" class="headingLink"><< %s</a></b>', __VIRTUAL_DIRECTORY__, $strScriptName, $strDescription); } } else { if (!$strNext) { $strNext = sprintf('<b><a href="%s/examples%s" class="headingLink">%s >></a></b>', __VIRTUAL_DIRECTORY__, $strScriptName, $strDescription); } } } } } } $strToReturn = ''; if ($strPrevious) { $strToReturn = $strPrevious; } else { $strToReturn = '<span class="headingLeftGray"><< Previous</span>'; } $intCategoryId = Examples::GetCategoryId(); if ($intCategoryId < 3) { $intPartId = 1; } else { if ($intCategoryId < 10) { $intPartId = 2; } else { $intPartId = 3; } } $strToReturn .= ' | '; $strToReturn .= sprintf('<b><a href="%s/examples/index.php/%s" class="headingLink">Back to Main</a></b>', __VIRTUAL_DIRECTORY__, $intPartId); $strToReturn .= ' | '; if ($strNext) { $strToReturn .= $strNext; } else { $strToReturn .= '<span class="headingLeftGray">Next >></span>'; } return $strToReturn; }
_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> <header> <div class="breadcrumb"> <?php if (!isset($mainPage)) { ?> <span class="category-name"><?php _p(Examples::GetCategoryId() + 1 . '. ' . Examples::$Categories[Examples::GetCategoryId()]['name'], false); ?> </span> / <?php } ?> <strong class="page-name"><?php _p(Examples::PageName(), false); ?> </strong> </div> <?php if (!isset($mainPage)) { ?> <nav class="page-links"><?php
<script type="text/javascript"> // jQuery isn't always available var viewSource = document.getElementById('viewSource'); if (viewSource) { viewSource.onclick = function (){ var fileNameSection = "", objWindow; if (arguments.length == 3) { fileNameSection = "/" + strFilename; } objWindow = window.open("<?php echo __VIRTUAL_DIRECTORY__ . __EXAMPLES__; ?> /view_source.php/<?php _p(Examples::GetCategoryId() . "/" . Examples::GetExampleId()); ?> " + fileNameSection, "ViewSource", "menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=750,left=50,top=50"); objWindow.focus(); return false; }; } window.gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { window.pageTracker = _gat._getTracker("UA-7231795-1"); pageTracker._trackPageview(); } catch(err) {} </script> </body>
<?php _p(Examples::GetCategoryId() + 1 . '. ' . Examples::$Categories[Examples::GetCategoryId()]['name'], false); ?> <br/> </span> <?php _p(Examples::PageName(), false); ?> <br/> <span class="headingLeftSmall"> <?php _p(Examples::PageLinks(), false); ?> </span> </td> <td class="headingRight"><br/> <b><a href="javascript:ViewSource(<?php _p(Examples::GetCategoryId() . ',' . Examples::GetExampleId()); ?> );" class="headingLink">View Source</a></b> <!-- <a href="#" onclick="window.open('http://localhost/validator/htdocs/check?uri=<?php _p(urlencode('http://qcodo/' . QApplication::$RequestUri)); ?> '); return false;" style="color: #ffffff;">Validate</a>--> <br/> <span class="headingLeftSmall">will open in a new window</span> </td> </tr> </table> <div class="page">
<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> <script type="text/javascript"> function ViewSource(intCategoryId, intExampleId) { var objWindow = window.open("../view_source.php/" + intCategoryId + "/" + intExampleId, "ViewSource", "menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=750,left=50,top=50"); objWindow.focus(); } </script> </head> <body> <table border="0" cellspacing="0" width="100%"> <tr> <td class="headingLeft"><span class="headingLeftSmall"> <?php _p((Examples::GetCategoryId() + 1) . '. ' . Examples::$Categories[Examples::GetCategoryId()]['name'], false); ?><br/> </span> <?php _p(Examples::PageName(), false); ?><br/> <span class="headingLeftSmall"> <?php _p(Examples::PageLinks(), false); ?> </span> </td> <td class="headingRight"><br/> <b><a href="javascript:ViewSource(<?php _p(Examples::GetCategoryId() . ',' . Examples::GetExampleId()); ?>);" class="headingLink">View Source</a></b> <!-- <a href="#" onclick="window.open('http://localhost/validator/htdocs/check?uri=<?php _p(urlencode('http://qcodo/' . QApplication::$RequestUri)); ?>'); return false;" style="color: #ffffff;">Validate</a>--> <br/> <span class="headingLeftSmall">will open in a new window</span> </td> </tr> </table> <div class="page">