本文整理汇总了PHP中isa函数的典型用法代码示例。如果您正苦于以下问题:PHP isa函数的具体用法?PHP isa怎么用?PHP isa使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isa函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testAllPages
/**
* Test that we can instantiate and run AllPages plugin without error.
*/
function testAllPages()
{
global $request;
$lp = new WikiPlugin_AllPages();
$this->assertEquals("AllPages", $lp->getName());
$args = "";
$this->assertType('object', $request->_dbi, 'isa WikiDB');
/*
*/
$result = $lp->run($request->_dbi, $args, $request, "AllPages");
$this->assertType('object', $result, 'isa PageList');
$this->assertType('object', $request->_dbi, 'isa WikiDB');
if (!isa($request->_dbi, "WikiDB")) {
// very very strange bug
$request->_dbi = WikiDB::open($GLOBALS['DBParams']);
if (!isa($request->_dbi, "WikiDB")) {
trigger_error("strange php bug\n", E_USER_WARNING);
return;
}
}
$xml = $result->asXml();
$this->assertType('object', $result, 'isa XmlContent');
//$xml->asString();
//$this->assertType('object', $result, 'isa XmlContent');
}
开发者ID:hugcoday,项目名称:wiki,代码行数:28,代码来源:AllPagesTest.php
示例2: RatingsDb
function RatingsDb()
{
global $request;
$this->_dbi =& $request->_dbi;
$this->_backend =& $this->_dbi->_backend;
$this->dimension = null;
if (RATING_STORAGE == 'SQL') {
if (isa($this->_backend, 'WikiDB_backend_PearDB')) {
$this->_sqlbackend =& $this->_backend;
$this->dbtype = "PearDB";
} elseif (isa($this->_backend, 'WikiDB_backend_ADODOB')) {
$this->_sqlbackend =& $this->_backend;
$this->dbtype = "ADODB";
} else {
include_once "lib/WikiDB/backend/ADODB.php";
// It is not possible to decouple a ref from the source again. (4.3.11)
// It replaced the main request backend. So we don't initialize _sqlbackend before.
//$this->_sqlbackend = clone($this->_backend);
$this->_sqlbackend = new WikiDB_backend_ADODB($GLOBALS['DBParams']);
$this->dbtype = "ADODB";
}
$this->iter_class = "WikiDB_backend_" . $this->dbtype . "_generic_iter";
extract($this->_sqlbackend->_table_names);
if (empty($rating_tbl)) {
$rating_tbl = (!empty($GLOBALS['DBParams']['prefix']) ? $GLOBALS['DBParams']['prefix'] : '') . 'rating';
$this->_sqlbackend->_table_names['rating_tbl'] = $rating_tbl;
}
} else {
$this->iter_class = "WikiDB_Array_PageIterator";
}
}
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:RatingsDb.php
示例3: RatingsDb
function RatingsDb()
{
global $request;
$this->_dbi =& $request->_dbi;
$this->_backend =& $this->_dbi->_backend;
$this->dimension = null;
if (RATING_STORAGE == 'SQL') {
$this->_sqlbackend =& $this->_backend;
if (isa($this->_backend, 'WikiDB_backend_PearDB')) {
$this->dbtype = "PearDB";
} elseif (isa($this->_backend, 'WikiDB_backend_ADODOB')) {
$this->dbtype = "ADODB";
} else {
include_once "lib/WikiDB/backend/ADODB.php";
$this->_sqlbackend = new WikiDB_backend_ADODB($GLOBALS['DBParams']);
$this->dbtype = "ADODB";
}
$this->iter_class = "WikiDB_backend_" . $this->dbtype . "_generic_iter";
extract($this->_sqlbackend->_table_names);
if (empty($rating_tbl)) {
$rating_tbl = (!empty($GLOBALS['DBParams']['prefix']) ? $GLOBALS['DBParams']['prefix'] : '') . 'rating';
$this->_sqlbackend->_table_names['rating_tbl'] = $rating_tbl;
}
} else {
$this->iter_class = "WikiDB_Array_PageIterator";
}
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:27,代码来源:RatingsDb.php
示例4: DbSession
/**
* Constructor
*
* @param mixed $dbh
* DB handle, or WikiDB object (from which the DB handle will
* be extracted.
*
* @param string $table
* Name of SQL table containing session data.
*/
function DbSession(&$dbh, $table = 'session')
{
// Check for existing DbSession handler
$db_type = $dbh->getParam('dbtype');
if (isa($dbh, 'WikiDB')) {
// will fail with php4 and case-sensitive filesystem
//$db_type = substr(get_class($dbh),7);
// < 4.1.2 crash on dba sessions at session_write_close().
// (Tested with 4.1.1 and 4.1.2)
// Didn't try postgres sessions.
if (!check_php_version(4, 1, 2) and $db_type == 'dba') {
return false;
}
@(include_once "lib/DbSession/" . $db_type . ".php");
$class = "DbSession_" . $db_type;
if (class_exists($class)) {
// dba has no ->_dbh, so this is used for the session link
$this->_backend = new $class($dbh->_backend->_dbh, $table);
return $this;
}
}
//Fixme: E_USER_WARNING ignored!
trigger_error(sprintf(_("Your WikiDB DB backend '%s' cannot be used for DbSession.") . " " . _("Set USE_DB_SESSION to false."), $db_type), E_USER_WARNING);
return false;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:35,代码来源:DbSession.php
示例5: _FilePassUser
function _FilePassUser($UserName = '', $prefs = false, $file = '')
{
if (!$this->_prefs and isa($this, "_FilePassUser")) {
if ($prefs) {
$this->_prefs = $prefs;
}
if (!isset($this->_prefs->_method)) {
_PassUser::_PassUser($UserName);
}
}
$this->_userid = $UserName;
// read the .htaccess style file. We use our own copy of the standard pear class.
$this->_may_change = defined('AUTH_USER_FILE_STORABLE') && AUTH_USER_FILE_STORABLE;
if (empty($file) and defined('AUTH_USER_FILE')) {
$file = AUTH_USER_FILE;
}
// same style as in main.php
include_once dirname(__FILE__) . "/../pear/File_Passwd.php";
// "__PHP_Incomplete_Class"
if (!empty($file) or empty($this->_file) or !isa($this->_file, "File_Passwd")) {
$this->_file = new File_Passwd($file, false, $file . '.lock');
} else {
return false;
}
return $this;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:26,代码来源:File.php
示例6: linkUnknownWikiWord
function linkUnknownWikiWord($wikiword, $linktext = '')
{
global $request;
// Get rid of anchors on unknown wikiwords
if (isa($wikiword, 'WikiPageName')) {
$default_text = $wikiword->shortName;
$wikiword = $wikiword->name;
} else {
$default_text = $wikiword;
}
$url = WikiURL($wikiword, array('action' => 'create'));
//$link = HTML::span(HTML::a(array('href' => $url), '?'));
$button = $this->makeButton('?', $url);
$button->addTooltip(sprintf(_("Create: %s"), $wikiword));
$link = HTML::span($button);
if (!empty($linktext)) {
$link->unshiftContent(HTML::u($linktext));
$link->setAttr('class', 'named-wikiunknown');
} else {
$link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
$link->setAttr('class', 'wikiunknown');
}
if ($request->getArg('frame')) {
$link->setAttr('target', '_top');
}
return $link;
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:27,代码来源:themeinfo.php
示例7: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
// If the ratings table does not exist, or on dba it will break otherwise.
// Check if Theme isa 'wikilens'
if ($info == 'pagename' and isa($GLOBALS['WikiTheme'], 'wikilens')) {
$info .= ",top3recs";
}
if ($info) {
$info = split(',', $info);
} else {
$info = array();
}
if (in_array('top3recs', $info)) {
require_once 'lib/wikilens/Buddy.php';
require_once 'lib/wikilens/PageListColumns.php';
$active_user = $request->getUser();
$active_userid = $active_user->_userid;
// if userids is null or empty, fill it with just the active user
if (!isset($userids) || !is_array($userids) || !count($userids)) {
// TKL: moved getBuddies call inside if statement because it was
// causing the userids[] parameter to be ignored
if (is_string($active_userid) and strlen($active_userid) and $active_user->isSignedIn()) {
$userids = getBuddies($active_userid, $dbi);
} else {
$userids = array();
// XXX: this wipes out the category caption...
$caption = _("You must be logged in to view ratings.");
}
}
// find out which users we should show ratings for
$allowed_users = array();
foreach ($userids as $userid) {
$user = new RatingsUser($userid);
if ($user->allow_view_ratings($active_user)) {
array_push($allowed_users, $user);
}
// PHP's silly references... (the behavior with this line commented
// out is... odd)
unset($user);
}
$options = array('dimension' => $dimension, 'users' => $allowed_users);
$args = array_merge($options, $args);
}
if (empty($pages) and $pages != '0') {
return '';
}
if (in_array('numbacklinks', $info)) {
$args['types']['numbacklinks'] = new _PageList_Column_ListPages_count('numbacklinks', _("#"), true);
}
if (in_array('numpagelinks', $info)) {
$args['types']['numpagelinks'] = new _PageList_Column_ListPages_count('numpagelinks', _("#"));
}
$pagelist = new PageList($info, $exclude, $args);
$pages_array = is_string($pages) ? explodePageList($pages) : (is_array($pages) ? $pages : array());
$pagelist->addPageList($pages_array);
return $pagelist;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:59,代码来源:ListPages.php
示例8: _print
function _print($val)
{
if (isa($val, 'Template')) {
$this->_expandSubtemplate($val);
} else {
PrintXML($val);
}
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:Template.php
示例9: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
// if (empty($args['s']))
// return '';
$html = HTML();
extract($args);
// prevent from dump
if ($q and $request->isPost()) {
require_once "lib/Google.php";
$google = new Google();
if (!$google) {
return '';
}
switch ($mode) {
case 'search':
$result = $google->doGoogleSearch($q);
break;
case 'cache':
$result = $google->doGetCachedPage($q);
break;
case 'spell':
$result = $google->doSpellingSuggestion($q);
break;
default:
trigger_error("Invalid mode");
}
if (isa($result, 'HTML')) {
$html->pushContent($result);
}
if (isa($result, 'GoogleSearchResults')) {
//TODO: result template
if (!empty($result->resultElements)) {
$list = HTML::ol();
foreach ($result->resultElements as $res) {
$li = HTML::li(LinkURL($res['URL'], $res['directoryTitle']), HTML::br(), $res['directoryTitle'] ? HTML(HTML::raw(' '), HTML::em($res['summary']), ' -- ', LinkURL($res['URL'])) : '');
$list->pushContent($li);
}
$html->pushContent($list);
} else {
return _("Nothing found");
}
}
if (is_string($result)) {
// cache content also?
$html->pushContent(HTML::blockquote(HTML::raw($result)));
}
}
if ($formsize < 1) {
$formsize = 30;
}
// todo: template
$form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('pagename' => $basepage, 'mode' => $mode)));
$form->pushContent(HTML::input(array('type' => 'text', 'value' => $q, 'name' => 'q', 'size' => $formsize)));
$form->pushContent(HTML::input(array('type' => 'submit', 'class' => 'button', 'value' => gettext($mode))));
return HTML($html, $form);
}
开发者ID:hugcoday,项目名称:wiki,代码行数:57,代码来源:GooglePlugin.php
示例10: _testLink
function _testLink($wiki, $expected = null)
{
if (is_null($expected)) {
$ta = $this->_tests();
$expected = $ta[$wiki];
}
$xml = TransformInline($wiki);
$this->assertTrue(isa($xml, 'XmlContent'));
$expectobj = unserialize($expected);
/* if (DEBUG & _DEBUG_VERBOSE)
echo "\t\"",$wiki,'" => \'',serialize($xml),"',\n"; flush(); */
$this->assertEquals($expectobj, $xml);
}
开发者ID:hugcoday,项目名称:wiki,代码行数:13,代码来源:InlineParserTest.php
示例11: _EMailConfirmPassUser
function _EMailConfirmPassUser($UserName = '', $prefs = false, $file = '')
{
if (!$this->_prefs and isa($this, "_EMailPassUser")) {
if ($prefs) {
$this->_prefs = $prefs;
}
if (!isset($this->_prefs->_method)) {
_PassUser::_PassUser($UserName);
}
}
$this->_userid = $UserName;
return $this;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:13,代码来源:EMailConfirm.php
示例12: DbSession
/**
* Constructor
*
* @param mixed $dbh
* DB handle, or WikiDB object (from which the DB handle will
* be extracted.
*
* @param string $table
* Name of SQL table containing session data.
*/
function DbSession(&$dbh, $table = 'session')
{
// Check for existing DbSession handler
$db_type = $dbh->getParam('dbtype');
if (isa($dbh, 'WikiDB')) {
@(include_once "lib/DbSession/" . $db_type . ".php");
$class = "DbSession_" . $db_type;
if (class_exists($class)) {
// dba has no ->_dbh, so this is used for the session link
$this->_backend = new $class($dbh->_backend->_dbh, $table);
return $this;
}
}
//Fixme: E_USER_WARNING ignored!
trigger_error(sprintf(_("Your WikiDB DB backend '%s' cannot be used for DbSession.") . " " . _("Set USE_DB_SESSION to false."), $db_type), E_USER_WARNING);
return false;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:27,代码来源:DbSession.php
示例13: testLinks
function testLinks()
{
$uplink = 'http://' . (defined('SERVER_NAME') ? SERVER_NAME : '') . DATA_PATH . '/uploads/image.jpg';
$tests = array("[label|link]" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:4:"link";s:6:"_label";s:5:"label";}i:2;s:0:"";}}', "[ label | link.jpg ]" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:8:"link.jpg";s:6:"_label";s:5:"label";}i:2;s:0:"";}}', "[ image.jpg | link ]" => check_php_version(5) ? 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:4:"link";s:6:"_label";O:11:"HtmlElement":4:{s:4:"_tag";s:6:"object";s:5:"_attr";a:5:{s:3:"src";s:0:"";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:12:"inlineobject";s:4:"type";b:0;}s:8:"_content";a:1:{i:0;O:11:"HtmlElement":4:{s:4:"_tag";s:5:"embed";s:5:"_attr";a:5:{s:3:"src";s:0:"";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:12:"inlineobject";s:4:"type";b:0;}s:8:"_content";a:0:{}s:11:"_properties";i:4;}}s:11:"_properties";i:6;}}i:2;s:0:"";}}' : 'o:10:"xmlcontent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;o:15:"cached_wikilink":2:{s:5:"_page";s:4:"link";s:6:"_label";o:11:"htmlelement":4:{s:8:"_content";a:1:{i:0;o:11:"htmlelement":4:{s:8:"_content";a:0:{}s:4:"_tag";s:5:"embed";s:5:"_attr";a:5:{s:3:"src";s:0:"";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:12:"inlineobject";s:4:"type";b:0;}s:11:"_properties";i:4;}}s:4:"_tag";s:6:"object";s:5:"_attr";a:5:{s:3:"src";s:0:"";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:12:"inlineobject";s:4:"type";b:0;}s:11:"_properties";i:6;}}i:2;s:0:"";}}', "[ Upload:image.jpg | link ]" => !check_php_version(5) ? 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:4:"link";s:6:"_label";O:11:"HtmlElement":4:{s:8:"_content";a:0:{}s:4:"_tag";s:3:"img";s:5:"_attr";a:4:{s:3:"src";s:' . strlen($uplink) . ':"' . $uplink . '";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:11:"inlineimage";}s:11:"_properties";i:7;}}i:2;s:0:"";}}' : 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:4:"link";s:6:"_label";O:11:"HtmlElement":4:{s:4:"_tag";s:3:"img";s:5:"_attr";a:4:{s:3:"src";s:' . strlen($uplink) . ':"' . $uplink . '";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:11:"inlineimage";}s:8:"_content";a:0:{}s:11:"_properties";i:7;}}i:2;s:0:"";}}', "[ http://server/image.jpg | link ]" => !check_php_version(5) ? 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:4:"link";s:6:"_label";O:11:"HtmlElement":4:{s:8:"_content";a:0:{}s:4:"_tag";s:3:"img";s:5:"_attr";a:4:{s:3:"src";s:23:"http://server/image.jpg";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:11:"inlineimage";}s:11:"_properties";i:7;}}i:2;s:0:"";}}' : 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:15:"Cached_WikiLink":2:{s:5:"_page";s:4:"link";s:6:"_label";O:11:"HtmlElement":4:{s:4:"_tag";s:3:"img";s:5:"_attr";a:4:{s:3:"src";s:23:"http://server/image.jpg";s:3:"alt";s:4:"link";s:5:"title";s:4:"link";s:5:"class";s:11:"inlineimage";}s:8:"_content";a:0:{}s:11:"_properties";i:7;}}i:2;s:0:"";}}', "[ label | http://server/link ]" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:19:"Cached_ExternalLink":2:{s:4:"_url";s:18:"http://server/link";s:6:"_label";s:5:"label";}i:2;s:0:"";}}', "[ label | Upload:link ]" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:20:"Cached_InterwikiLink":2:{s:5:"_link";s:11:"Upload:link";s:6:"_label";s:5:"label";}i:2;s:0:"";}}', "[ label | phpwiki:action=link ]" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:17:"Cached_PhpwikiURL":2:{s:4:"_url";s:19:"phpwiki:action=link";s:6:"_label";s:5:"label";}i:2;s:0:"";}}', "Upload:image.jpg" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:20:"Cached_InterwikiLink":1:{s:5:"_link";s:16:"Upload:image.jpg";}i:2;s:0:"";}}', "http://server/image.jpg" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:19:"Cached_ExternalLink":1:{s:4:"_url";s:23:"http://server/image.jpg";}i:2;s:0:"";}}', "http://server/link" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:19:"Cached_ExternalLink":1:{s:4:"_url";s:18:"http://server/link";}i:2;s:0:"";}}', "[http:/server/~name/]" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:19:"Cached_ExternalLink":1:{s:4:"_url";s:18:"http:/server/name/";}i:2;s:0:"";}}', "http:/server/~name/" => 'O:10:"XmlContent":1:{s:8:"_content";a:3:{i:0;s:0:"";i:1;O:19:"Cached_ExternalLink":1:{s:4:"_url";s:18:"http:/server/name/";}i:2;s:0:"";}}');
//$i = 0;
foreach ($tests as $wiki => $expected) {
//print $i++ . " .. ";
$xml = TransformInline($wiki);
$this->assertTrue(isa($xml, 'XmlContent'));
$actual = serialize($xml);
if (!check_php_version(5)) {
$expected = strtolower($expected);
$actual = strtolower($actual);
}
$this->assertEquals($expected, $actual);
}
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:17,代码来源:InlineParserTest.php
示例14: _PdoDbPassUser
function _PdoDbPassUser($UserName = '', $prefs = false)
{
if (!$this->_prefs and isa($this, "_PdoDbPassUser")) {
if ($prefs) {
$this->_prefs = $prefs;
}
}
if (!isset($this->_prefs->_method)) {
_PassUser::_PassUser($UserName);
} elseif (!$this->isValidName($UserName)) {
trigger_error(_("Invalid username."), E_USER_WARNING);
return false;
}
$this->_userid = $UserName;
// make use of session data. generally we only initialize this every time,
// but do auth checks only once
$this->_auth_crypt_method = $GLOBALS['request']->_dbi->getAuthParam('auth_crypt_method');
return $this;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:19,代码来源:PdoDb.php
示例15: _AdoDbPassUser
function _AdoDbPassUser($UserName = '', $prefs = false)
{
if (!$this->_prefs and isa($this, "_AdoDbPassUser")) {
if ($prefs) {
$this->_prefs = $prefs;
}
if (!isset($this->_prefs->_method)) {
_PassUser::_PassUser($UserName);
}
}
if (!$this->isValidName($UserName)) {
trigger_error(_("Invalid username."), E_USER_WARNING);
return false;
}
$this->_userid = $UserName;
$this->getAuthDbh();
$this->_auth_crypt_method = $GLOBALS['request']->_dbi->getAuthParam('auth_crypt_method');
// Don't prepare the configured auth statements anymore
return $this;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:20,代码来源:AdoDb.php
示例16: linkUnknownWikiWord
function linkUnknownWikiWord($wikiword, $linktext = '')
{
global $request;
if (isa($wikiword, 'WikiPageName')) {
$default_text = $wikiword->shortName;
$wikiword = $wikiword->name;
} else {
$default_text = $wikiword;
}
$url = WikiURL($wikiword, array('action' => 'create'));
$link = HTML::span(HTML::a(array('href' => $url, 'rel' => 'nofollow'), '?'));
if (!empty($linktext)) {
$link->unshiftContent(HTML::u($linktext));
$link->setAttr('class', 'named-wikiunknown');
} else {
$link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
$link->setAttr('class', 'wikiunknown');
}
return $link;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:20,代码来源:themeinfo.php
示例17: linkExistingWikiWord
function linkExistingWikiWord($wikiword, $linktext = '', $version = false)
{
global $request;
if ($version !== false and !$this->HTML_DUMP_SUFFIX) {
$url = WikiURL($wikiword, array('version' => $version));
} else {
$url = WikiURL($wikiword);
}
// Extra steps for dumping page to an html file.
if ($this->HTML_DUMP_SUFFIX) {
$url = preg_replace('/^\\./', '%2e', $url);
// dot pages
}
$link = HTML::a(array('href' => $url));
if (isa($wikiword, 'WikiPageName')) {
$default_text = $wikiword->shortName;
} else {
$default_text = $wikiword;
}
if (!empty($linktext)) {
$link->pushContent($linktext);
$link->setAttr('class', 'named-wiki');
$link->setAttr('title', $this->maybeSplitWikiWord($default_text));
} else {
//TODO: check if wikiblog
$link->pushContent($this->maybeSplitWikiWord($default_text));
$link->setAttr('class', 'wiki');
}
return $link;
}
开发者ID:hugcoday,项目名称:wiki,代码行数:30,代码来源:themeinfo.php
示例18: handle_plugin_args_cruft
function handle_plugin_args_cruft($argstr, $args)
{
$allowed = array("editbox", "hidden", "checkbox", "radiobutton", "radio", "pulldown", "submit", "reset", "combobox");
// no editbox[] = array(...) allowed (space)
$arg_array = preg_split("/\n/", $argstr);
// for security we should check this better
$arg = '';
for ($i = 0; $i < count($arg_array); $i++) {
//TODO: we require an name=value pair here, but submit may go without also.
if (preg_match("/^\\s*(" . join("|", $allowed) . ")\\[\\](.*)\$/", $arg_array[$i], $m)) {
$name = $m[1];
// one of the allowed input types
$this->inputbox[][$name] = array();
$j = count($this->inputbox) - 1;
$curargs = trim($m[2]);
// must match name=NAME and also value=<!plugin-list name !>
while (preg_match("/^(\\w+)=((?:\".*\")|(?:\\w+)|(?:\"?<!plugin-list.+!>\"?))\\s*/", $curargs, $m)) {
$attr = $m[1];
$value = $m[2];
$curargs = substr($curargs, strlen($m[0]));
if (preg_match("/^\"(.*)\"\$/", $value, $m)) {
$value = $m[1];
}
if (in_array($name, array("pulldown", "checkbox", "radio", "radiobutton", "combobox")) and preg_match('/^<!plugin-list.+!>$/', $value, $m)) {
$loader = new WikiPluginLoader();
$markup = null;
$basepage = null;
$plugin_str = preg_replace(array("/^<!/", "/!>\$/"), array("<?", "?>"), $value);
// will return a pagelist object! pulldown,checkbox,radiobutton
$value = $loader->expandPI($plugin_str, $GLOBALS['request'], $markup, $basepage);
if (isa($value, 'PageList')) {
$value = $value->_pages;
} elseif (!is_array($value)) {
trigger_error(sprintf("Invalid argument %s ignored", htmlentities($arg_array[$i])), E_USER_WARNING);
}
} elseif (defined($value)) {
$value = constant($value);
}
$this->inputbox[$j][$name][$attr] = $value;
}
//trigger_error("not yet finished");
//eval('$this->inputbox[]["'.$m[1].'"]='.$m[2].';');
} else {
trigger_error(sprintf("Invalid argument %s ignored", htmlentities($arg_array[$i])), E_USER_WARNING);
}
}
return;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:48,代码来源:WikiFormRich.php
示例19: setWidth
function setWidth($ncols)
{
assert($ncols >= $this->_ncols);
if ($ncols <= $this->_ncols) {
return;
}
$rows =& $this->_content;
for ($i = 0; $i < count($rows); $i++) {
$row =& $rows[$i];
if (isa($row, 'Block_table_dl_defn')) {
$row->setWidth($ncols - 1);
} else {
$n = count($row->_content);
$lastcol =& $row->_content[$n - 1];
if (!empty($lastcol)) {
$lastcol->setAttr('colspan', $ncols - 1);
}
}
}
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:20,代码来源:BlockParser.php
示例20: _tryinsertInterWikiMap
function _tryinsertInterWikiMap($content)
{
$goback = false;
if (strpos($content, "<verbatim>")) {
//$error_html = " The newly loaded pgsrc already contains a verbatim block.";
$goback = true;
}
if (!$goback && !defined('INTERWIKI_MAP_FILE')) {
$error_html = sprintf(" " . _("%s: not defined"), "INTERWIKI_MAP_FILE");
$goback = true;
}
$mapfile = FindFile(INTERWIKI_MAP_FILE, 1);
if (!$goback && !file_exists($mapfile)) {
$error_html = sprintf(" " . _("%s: file not found"), INTERWIKI_MAP_FILE);
$goback = true;
}
if (!empty($error_html)) {
trigger_error(_("Default InterWiki map file not loaded.") . $error_html, E_USER_NOTICE);
}
if ($goback) {
return $content;
}
// if loading from virgin setup do echo, otherwise trigger_error E_USER_NOTICE
if (!isa($GLOBALS['request'], 'MockRequest')) {
echo sprintf(_("Loading InterWikiMap from external file %s."), $mapfile), "<br />";
}
$fd = fopen($mapfile, "rb");
$data = fread($fd, filesize($mapfile));
fclose($fd);
$content = $content . "\n<verbatim>\n{$data}</verbatim>\n";
return $content;
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:32,代码来源:loadsave.php
注:本文中的isa函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论