示例#1
0
文件: demo.php 项目: jiripudil/texy
    $text = file_get_contents('sample.texy');
    $html = $texy->process($text);
    // that's all folks!
    // echo formated output
    echo $html;
    // and echo generated HTML code
    echo '<pre>';
    echo htmlSpecialChars($html);
    echo '</pre>';
    echo '<hr />';
}
header('Content-type: text/html; charset=utf-8');
echo '<h2>Enable nearly all valid tags</h2>';
// by default
doIt($texy);
echo '<h2>Texy::ALL - enables all tags</h2>';
$texy->allowedTags = Texy::ALL;
doIt($texy);
echo '<h2>safeMode() - enables only some "safe" tags</h2>';
TexyConfigurator::safeMode($texy);
doIt($texy);
echo '<h2>disableLinks() - disable all links</h2>';
TexyConfigurator::disableLinks($texy);
doIt($texy);
echo '<h2>Texy::NONE - disables all tags</h2>';
$texy->allowedTags = Texy::NONE;
doIt($texy);
echo '<h2>Enable custom tags</h2>';
$texy->allowedTags = array('myExtraTag' => array('attr1'), 'strong' => array());
doIt($texy);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>Lesson 7 - callback functions</title>
		<meta http-equiv="content-type"
				content="text/html; charset=utf-8"/>
	</head>
	<body>
		
<?php 
// This function uses a callback function.
function doIt($callback)
{
    $data = "CPR Helpdesk";
    $callback($data);
}
// This is a sample callback function for doIt().
function myCallback($data)
{
    echo 'App is: ', $data, "\n";
}
// Call doIt() and pass our sample callback function's name.
doIt('myCallback');
?>

	</body>
</html>
示例#3
0
}
abstract class Booze
{
    public abstract function buzz($s = \HACKLIB_UNINIT);
}
class BooImpl extends Booze implements Boo
{
    public function fizz($v = \HACKLIB_UNINIT)
    {
        if ($v === \HACKLIB_UNINIT) {
            $v = new \HH\Vector(array(1, 2));
        }
        echo join(", ", (array) \hacklib_cast_as_array($v)) . "\n";
    }
    public function buzz($s = \HACKLIB_UNINIT)
    {
        if ($s === \HACKLIB_UNINIT) {
            $s = \HH\Map::hacklib_new(array('a'), array('z'));
        }
        echo join(", ", (array) \hacklib_cast_as_array($s)) . "\n";
    }
}
function doIt($i)
{
    $i->fizz();
    if ($i instanceof Booze) {
        $i->buzz();
    }
}
doIt(new BooImpl());
示例#4
0
namespace Publish;

function doIt($fn)
{
    echo "doIt\n";
    return $fn();
}
function doMe()
{
    echo "doMe\n";
}
// I am using a closure here.
// There may be a more clever way to "get the function-object" representing a given
// named function, but I do not know what it is. Again, I *don't use PHP* :-)
echo doIt(function () {
    doMe();
});
function funcRef($func)
{
    return create_function('', "return call_user_func_array('{$func}', func_get_args());");
}
function foo($a, $b, $c)
{
    return sprintf("A:%s B:%s C:%s", $a, $b, $c);
}
$b = funcRef("foo");
echo $b("hello", "world", 123);
//=> A:hello B:world C:123
class Odd
{
    function __construct()
示例#5
0
function callTESearch()
{
    $newMarketSearch = new MarketSearch("INTC");
    $newMarketSearch . doIt();
}
示例#6
0
<?php

require_once "../../../../../class/autoload.inc";
function doIt($s_role, $s_ids, $con)
{
    foreach ($s_ids as $s_id) {
        $ex = "update student set s_role='{$s_role}' where s_id={$s_id}";
        $con->exec($ex);
    }
}
$s_ids1 = explode(" ", $_POST['s_id1']);
$s_ids2 = explode(" ", $_POST['s_id2']);
$s_role1 = util::getInt('s_role1', -1);
$s_role2 = util::getInt('s_role2', -1);
$con = new DB_Connect();
doIt($s_role1, $s_ids1, $con);
doIt($s_role2, $s_ids2, $con);
示例#7
0
function callTeBuy()
{
    $newMarketBuy = new MarketBuy(1, "INTC", 3);
    $newMarketBuy . doIt();
}
function runXMLtest($xmlFileName)
{
    $config = new KalturaConfiguration("100");
    $config->serviceUrl = 'trunk';
    $client = new KalturaClient($config);
    $client->setKs('YjQ2ZjFlY2FkNzJiMTRlYWZhZjhjZGVhY2ZkNjFjMmVlZDBhODZmY3wxMDA7MTAwOzEyODkyMjA2Mjc7MjsxMjg5MTM0MjI3LjQ3OzEwMDs7');
    //	dofileSync($client, '0_t2jxptmg');
    doIt($client, $xmlFileName, "k:\\media\\join\\avidemuxTest.scp");
    return;
    kLog::Log($xmlFileName);
    $xml = simplexml_load_file(realpath($xmlFileName));
    print_r($xml);
    foreach ($xml->VideoAssets->vidAsset as $vidAsset) {
        $attr = $vidAsset->attributes();
        $entryId = $attr[k_id];
        $attr = $vidAsset->StreamInfo->attributes();
        $fileName = $attr[file_name];
        echo "\nEntryId ({$entryId}), FileName({$fileName})\n";
        $results = $client->flavorAsset->getByEntryId('0_tyg28fov');
        print_r($results[0]->videoCodecId);
    }
    return;
}