コード例 #1
0
<?php

include "./inc/config.inc";
include "../phploader/loader.php";
$loader = new YAHOO_util_Loader($yuiCurrentVersion);
//Specify YUI components to load
$loader->load("calendar");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>YUI PHP Loader Utility Advanced Example: Loading YUI Calendar with the YUI PHP Loader Utility</title>
	<?php 
//Output the CSS link tags
echo $loader->css();
?>
</head>

<body class="yui-skin-sam">

<h1>YUI PHP Loader Utility Advanced Example: Loading the YUI Calendar Control with the YUI PHP Loader Utility</h1>

<p>In this example, we bring a YUI component onto the page using the <a href="http://developer.yahoo.com/yui/phploader/">YUI PHP Loader Utility</a>. This example implements YUI PHP Loader via a <code>YAHOO_util_Loader</code> instance.  We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page &mdash; and what we want to do once it <em>is</em> loaded.  The main difference between this advanced example and the simple one show <a href="./phploader-basic.html">here</a> is that this one outputs the CSS and JavaScript files separately with two different method calls.  The CSS files are included in the document head and the JavaScript files are included just before the closing body node.  This is done in accordance with the best practice performance recommendations outlined <a href="http://developer.yahoo.com/performance/rules.html">here</a>.</p>

<div id="calendar_container"></div>

<?php 
//Output the script tags
echo $loader->script();
?>
<script type="text/javascript">
コード例 #2
0
ファイル: verify.php プロジェクト: runt18/phploader
    /*
            // Make the request
            $xml = file_get_contents($url);
        // Retrieve HTTP status code
            list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3);
    */
    if ($status_code[0] == 200) {
        print_r("<dt>" . $name . ":</dt><dd>ok</dd>");
    } else {
        print_r("<dt>" . $name . ":</dt><dd>failed - " . $status_code[0] . ", " . $url . "</dd>");
    }
}
// create the loader instance, this sets up the platform config as well,
// which we need right away because we are iterating the packages to
// generate a list of available modules.
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$output = "";
$checked = "";
$modules = array();
//$target  = $yui_load_manager->LOCAL;
//$target  = $yui_load_manager->PROD;
//$target  = $yui_load_manager->DEBUG;
//$target  = $yui_load_manager->DEV;
$moduletype = null;
$contenttype = null;
// Module type is "css" for just css, "javascript" for just script
// otherwise everything is sent out.
if (isset($_GET["moduletype"])) {
    $moduletype = $_GET["moduletype"];
    if ($moduletype == "YAHOO_util_CSS") {
        $moduletype = "css";
コード例 #3
0
<?php

include "./inc/config.inc";
include "../phploader/loader.php";
//Create a custom module metadata set
$customModules = array("customJS" => array("name" => 'customJS', "type" => 'js', "fullpath" => './assets/custom/data.js', "requires" => array("event", "dom", "json")), "customCSS" => array("name" => 'customCSS', "type" => 'css', "fullpath" => './assets/custom/custom.css'));
//Get a new YAHOO_util_Loader instance which includes our custom metadata along with the base YUI metadata
//Note: rand is used here to help cache bust the example
$loader = new YAHOO_util_Loader($yuiCurrentVersion, 'my_custom_config_' . rand(), $customModules);
$loader->load("customJS", "customCSS");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>YUI PHP Loader Utility Example: Adding Custom Modules with YUI Dependencies</title>
	<?php 
echo $loader->css();
?>
</head>
<body>
    <h1>YUI PHP Loader Utility Example: Adding Custom Modules with YUI Dependencies</h1>
    
    <p><a href="http://developer.yahoo.com/yui/phploader/">The YUI PHP Loader Utility</a> is designed, of course, to 
    help you put YUI components on the page.  While the YUI PHP Loader is great at loading YUI resources it is important 
    to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page 
    as well.  These can be mixed in with YUI dependencies and/or be all custom modules.</p>
    
コード例 #4
0
<?php

include "./inc/config.inc";
include "../phploader/loader.php";
$loader = new YAHOO_util_Loader($yuiCurrentVersion);
//$customModules
//Specify YUI components to load
$loader->load("calendar");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>YUI PHP Loader Utility Basic Example: Loading YUI Calendar with the YUI PHP Loader Utility</title>
	<?php 
//Output the CSS and JavaScript tags
echo $loader->tags();
?>
</head>

<body class="yui-skin-sam">

<h1>YUI PHP Loader Utility Basic Example: Loading the YUI Calendar Control with the YUI PHP Loader Utility</h1>

<p>In this example, we bring a YUI component onto the page using the <a href="http://developer.yahoo.com/yui/phploader/">YUI PHP Loader Utility</a>. This example implements YUI PHP Loader via a <code>YAHOO_util_Loader</code> instance.  We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page &mdash; and what we want to do once it <em>is</em> loaded.</p>

<div id="calendar_container"></div>

<script type="text/javascript">
    YAHOO.util.Event.onAvailable("calendar_container", function() {
		var myCal = new YAHOO.widget.Calendar("mycal_id", "calendar_container");
		myCal.render();
コード例 #5
0
ファイル: combo.php プロジェクト: valentijnvenus/geocloud
    $s = getenv('HTTPS') ? '' : getenv('HTTPS') == 'on' ? 's' : '';
    $protocol = substr(strtolower(getenv('SERVER_PROTOCOL')), 0, strpos(strtolower(getenv('SERVER_PROTOCOL')), '/')) . $s;
    $port = getenv('SERVER_PORT') == '80' ? '' : ":" . getenv('SERVER_PORT');
    return $protocol . "://" . getenv('HTTP_HOST') . $port;
}
$queryString = getenv('QUERY_STRING') ? urldecode(getenv('QUERY_STRING')) : '';
if (isset($queryString) && !empty($queryString)) {
    $yuiFiles = explode("&amp;", $queryString);
    $contentType = strpos($yuiFiles[0], ".js") ? 'application/x-javascript' : ' text/css';
    //Use the first module to determine which version of the YUI meta info to load
    if (isset($yuiFiles) && !empty($yuiFiles)) {
        $metaInfo = explode("/", $yuiFiles[0]);
        $yuiVersion = $metaInfo[0];
    }
    include "./loader.php";
    $loader = new YAHOO_util_Loader($yuiVersion);
    $base = PATH_TO_LOADER . $loader->comboDefaultVersion . "/build/";
    //Defaults to current version
    //Detect and load the required components now
    $baseOverrides = array();
    $yuiComponents = array();
    foreach ($yuiFiles as $yuiFile) {
        $parts = explode("/", $yuiFile);
        if (isset($parts[0]) && isset($parts[1]) && isset($parts[2])) {
            //Add module to array for loading
            $yuiComponents[] = $parts[2];
        } else {
            die('<!-- Unable to determine module name! -->');
        }
    }
    //Load the components
コード例 #6
0
ファイル: combo.php プロジェクト: runt18/phploader
 }
 if ($cache) {
     //Set cache headers and output cache content
     header("Cache-Control: max-age=315360000");
     header("Expires: " . date("D, j M Y H:i:s", strtotime("now + 10 years")) . " GMT");
     header("Content-Type: " . $contentType);
     echo $cache;
 } else {
     //Use the first module to determine which version of the YUI meta info
     //to load
     if (isset($yuiFiles) && !empty($yuiFiles)) {
         $metaInfo = explode("/", $yuiFiles[0]);
         $yuiVersion = $metaInfo[0];
     }
     include "./loader.php";
     $loader = new YAHOO_util_Loader($yuiVersion);
     $base = PATH_TO_LIB . $yuiVersion . "/build/";
     $loader->base = $base;
     //Detect and set a filter as needed (defaults to minified version)
     if (strpos($queryString, "-debug.js") !== false) {
         $loader->filter = YUI_DEBUG;
     } else {
         if (strpos($queryString, "-min.js") === false && strpos($queryString, "-debug.js") === false) {
             $loader->filter = YUI_RAW;
         }
     }
     //Verify this version of the library exists locally
     $localPathToBuild = "../lib/" . $yuiVersion . "/build/";
     if (file_exists($localPathToBuild) === false || is_readable($localPathToBuild) === false) {
         throw new Exception('Unable to locate the YUI build directory!');
     }
コード例 #7
0
ファイル: test-loader.php プロジェクト: runt18/phploader
<?php

/**
 *  Copyright (c) 2009, Yahoo! Inc. All rights reserved.
 *  Code licensed under the BSD License:
 *  http://developer.yahoo.net/yui/license.html
 *  version: 1.0.0b2
 */
error_reporting(E_ALL);
include "../loader.php";
define("YUI_VERSION_TO_TEST", "2.8.0r4");
// create the loader instance, this sets up the platform config as well,
// which we need right away because we are iterating the packages to
// generate a list of available modules.
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$output = "";
$checked = "";
$modules = array();
$embed = false;
$loadOptional = false;
$combine = false;
if (isset($_GET["module"])) {
    $modules = $_GET['module'];
    $moduletype = null;
    $contenttype = "TAGS";
    // Module type is "css" for just css, "script" for just script
    // otherwise everything is sent out.
    if (isset($_GET["moduletype"])) {
        $moduletype = $_GET["moduletype"];
        // backwards compatible
        if ($moduletype == "YAHOO_util_CSS") {
コード例 #8
0
<?php

include "./inc/config.inc";
include "../phploader/loader.php";
$loader = new YAHOO_util_Loader($yuiCurrentVersion);
//Specify YUI components to load
$loader->load("calendar");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>YUI PHP Loader Utility Advanced Example: Mixed Loading Methods</title>
	<?php 
//Output the CSS link tags
echo $loader->css();
?>
</head>

<body class="yui-skin-sam">

    <h1>YUI PHP Loader Utility Advanced Example: Mixed Loading Methods</h1>

    <p>In this example, we bring a YUI component onto the page using the <a href="http://developer.yahoo.com/yui/phploader/">YUI PHP Loader Utility</a>. 
    This example implements YUI PHP Loader via a <code>YAHOO_util_Loader</code> instance.  We include the YUI PHP Loader class file, then specify in 
    configuration which component we want loaded on the page &mdash; and what we want to do once it <em>is</em> loaded.  The main difference between 
    this example and the previous advanced example is that we have mixed the component loading methods.  The Calender component requires the Yahoo, Dom, 
    and Event modules.  In the previous example we let PHP Loader bring these into the document for us.  However, in this case we placed a static 
    script include into the document that brings in these resources.  We do not wish to have PHP Loader duplicate the loading of these components so 
    we utilize the <em>setLoaded</em> method to notify PHP Loader that we already have these components in the document and to skip loading them a second time.</p>

    <div id="calendar_container"></div>
コード例 #9
0
<?php

/**
 *  Copyright (c) 2009, Yahoo! Inc. All rights reserved.
 *  Code licensed under the BSD License:
 *  http://developer.yahoo.net/yui/license.html
 *  version: 1.0.0b2
 */
include "../loader.php";
define("YUI_VERSION_TO_TEST", "2.8.0r4");
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
//Specify YUI components to load
$loader->combine = true;
$loader->comboBase = "http://localhost/phploader/phploader/combo.php?";
//modify as needed
$loader->load("editor", "calendar", "container", "animation", "fonts");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Calendar Plugin</title>

    <style type="text/css">
    /*margin and padding on body element
      can introduce errors in determining
      element position and are not recommended;
      we turn them off as a foundation for YUI
      CSS treatments. */
    body {
コード例 #10
0
ファイル: 2.0.php プロジェクト: runt18/phploader
 */
include "../loader.php";
define("YUI_VERSION_TO_TEST", "2.8.0r4");
function encoded_out($str)
{
    echo htmlentities($str);
}
$customConfig = array("test1" => array("name" => 'test1', "type" => 'js', "path" => 'path/to/file1.js', "requires" => array(0 => 'event', 1 => 'dom'), "optional" => array(0 => 'connection')), "test2" => array("name" => 'test2', "type" => 'js', "path" => 'path/to/file2.js', "requires" => array(0 => 'test1')), "test3" => array("name" => 'test3', "type" => 'js', "path" => 'path/to/file3.js', "global" => true));
// arg1: Unique APC cache key.  This is combined with the YUI base
//       so that updates to YUI will force a new cache entry.
//       However, if your custom config changes, this key should
//       be changed (otherwise the old values will be used until
//       the cache expires --- currently set to 30 minutes).
// arg2: a list of custom modules
// arg3: pass true if you do not want the YUI metadata
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST, 'config_v_2', $customConfig);
// What to load
$loader->load("menu", "animation", "test2");
// Automatically pull in optional dependencies
// $loader->loadOptional = true;
// Specify modules that are already on the page that should not
// be loaded again.
// $loader->setLoaded("event", "dom");
// $loader->setLoaded("yahoo-dom-event"); // bug 1081006
// The base will be combined with the module's 'path' attribute
// to create its URL, unless the module has a 'fullpath' attribute.
// The default is the path to the current YUI version yahooapis
$loader->base = "/build/";
// Configure the base dir for a set of modules.  This overrides
// the global base property
$loader->overrideBase("/otherbasedir/", array("test1", "test2", "test3"));
コード例 #11
0
ファイル: test.php プロジェクト: runt18/phploader
encoded_out("<!-- css -->\n");
encoded_out($l8->css());
encoded_out("<!-- js -->\n");
encoded_out($l8->script());
/* separate css and js output */
//////////////////////////////////////////////////////////////////////////
encoded_out("\n\nTest 9:\n\n");
$l9 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l9->load("calendar");
encoded_out($l9->json());
/* json */
//////////////////////////////////////////////////////////////////////////
encoded_out("\n\nTest 10:\n\n");
$l10 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l10->load("calendar");
encoded_out($l10->embed());
///////////////////////////////////////////
encoded_out("\n\nTest 11:\n\n");
//$yui_config->configDebug(array(
//"menu" => true
//));
$l11 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l11->base = "../../build/";
$l11->filter = YUI_DEBUG;
$l11->load("menu");
encoded_out($l11->tags());
encoded_out($l11->getLoadedModulesAsJSON());
/* embed */
?>

コード例 #12
0
<?php

include "./inc/config.inc";
include "../phploader/loader.php";
//Create a custom module metadata set
$customModules = array("JSONModule" => array("name" => 'JSONModule', "type" => 'js', "fullpath" => 'http://www.json.org/json2.js'), "customJS" => array("name" => 'customJS', "type" => 'js', "fullpath" => './assets/custom/data.js', "requires" => array('JSONModule')), "customCSS" => array("name" => 'customCSS', "type" => 'css', "fullpath" => './assets/custom/custom.css'));
//Get a new YAHOO_util_Loader instance which includes just our custom metadata (No YUI metadata)
//Note: rand is used here to help cache bust the example
$loader = new YAHOO_util_Loader($yuiCurrentVersion, 'my_custom_config_' . rand(), $customModules, true);
$loader->load("JSONModule", "customJS", "customCSS");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>YUI PHP Loader Utility Example: Adding Custom (Non-YUI) Content with YUI PHP Loader</title>
	<?php 
echo $loader->css();
?>
</head>
<body>
    <h1>YUI PHP Loader Utility Example: Adding Custom (Non-YUI) Content with YUI PHP Loader</h1>

    <p><a href="http://developer.yahoo.com/yui/phploader/">The YUI PHP Loader Utility</a> is designed, of course, to 
    help you put YUI components on the page.  While the YUI PHP Loader is great at loading YUI resources it is important 
    to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page 
    as well.  These can be mixed in with YUI dependencies and/or be all custom modules.</p>
    
コード例 #13
0
ファイル: json.php プロジェクト: runt18/phploader
<?php

/**
 *  Copyright (c) 2009, Yahoo! Inc. All rights reserved.
 *  Code licensed under the BSD License:
 *  http://developer.yahoo.net/yui/license.html
 *  version: 1.0.0b2
 */
include "../loader.php";
define("YUI_VERSION_TO_TEST", "2.8.0r4");
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$output = "";
$checked = "";
$modules = array();
$target = $yui_load_manager->PROD;
if (isset($_REQUEST["module"])) {
    $modules = $_REQUEST['module'];
    $moduletype = null;
    $contenttype = null;
    // Module type is "css" for just css, "script" for just script
    // otherwise everything is sent out.
    if (isset($_REQUEST["moduletype"])) {
        $moduletype = $_REQUEST["moduletype"];
    }
    // content type is "EMBED" to inline the files, otherwise links
    // to the files are generated.  This is not implemented on the test
    // page (we always generate links)
    if (isset($_REQUEST["contenttype"])) {
        $contenttype = $_REQUEST["contenttype"];
    }
    // target is "PE_DEV" or "PE_PROD" for makeover or akamai respectively