本文整理汇总了PHP中Wiki::get_namespaces方法的典型用法代码示例。如果您正苦于以下问题:PHP Wiki::get_namespaces方法的具体用法?PHP Wiki::get_namespaces怎么用?PHP Wiki::get_namespaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wiki
的用法示例。
在下文中一共展示了Wiki::get_namespaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construction method for the Image class
*
* @access public
* @param Wiki &$wikiClass The Wiki class object
* @param string $title The title of the image
* @param int $pageid The ID of the image page (optional)
* @return Image
*/
public function __construct(Wiki &$wikiClass, $title = null, $pageid = null)
{
$this->wiki =& $wikiClass;
$this->title = $title;
if ($this->wiki->removeNamespace($title) == $title) {
$namespaces = $this->wiki->get_namespaces();
$this->title = $namespaces[6] . ':' . $title;
}
$ii = $this->imageinfo();
if (is_array($ii)) {
$this->title = $ii[0]['canonicaltitle'];
$this->rawtitle = $this->wiki->removeNamespace($this->title);
$this->localname = str_replace(array(' ', '+'), array('_', '_'), urlencode($this->rawtitle));
$this->page =& $this->wiki->initPage($this->title, $pageid);
$this->mime = $ii[0]['mime'];
$this->bitdepth = $ii[0]['bitdepth'];
$this->hash = $ii[0]['sha1'];
$this->size = $ii[0]['size'];
$this->width = $ii[0]['width'];
$this->height = $ii[0]['height'];
$this->url = $ii[0]['url'];
$this->timestamp = $ii[0]['timestamp'];
$this->user = $ii[0]['user'];
if (is_array($ii[0]['metadata'])) {
foreach ($ii[0]['metadata'] as $metadata) {
$this->metadata[$metadata['name']] = $metadata['value'];
}
} else {
$this->exists = false;
}
}
}
示例2: get_namespace
/**
* Gets ID or name of the namespace
*
* @param bool $id Set to true to get namespace ID, set to false to get namespace name. Default true
* @return int|string
*/
public function get_namespace($id = true)
{
if ($id) {
return $this->namespace_id;
} else {
$namespaces = $this->wiki->get_namespaces();
return $namespaces[$this->namespace_id];
}
}