本文整理匯總了PHP中ImpExData::import_forum方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImpExData::import_forum方法的具體用法?PHP ImpExData::import_forum怎麽用?PHP ImpExData::import_forum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImpExData
的用法示例。
在下文中一共展示了ImpExData::import_forum方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
function parse_folder($data)
{
/*
// this method is not particularly extensible. Using these flags, 2 bits
// were found to always be on, 0x180000. Any forum with either of these
// bits will now be imported
$valid_folder_flags = array(
'00181000',
'00190800',
'00191000',
'00193000',
'001B1800',
'08181000',
'08190800',
'081B1800',
);
if ($data['type'] == 'open' AND in_array($data['attributes']['flags'], $valid_folder_flags))
*/
if ($data['type'] == 'open') {
if ($forum =& $this->get_first_tag('folder') and !empty($forum['__ignorechildren'])) {
// we're ignoring a parent, so ignore this one as well
$data['__ignorechildren'] = true;
$this->push_stack($data);
return;
}
if (!(hexdec($data['attributes']['flags']) & 0x180000) or in_array(trim($data['attributes']['name']), array('In', 'system', 'common', 'Click Here to Begin', 'Quick Help', 'plugins', 'Templates', 'webxTemplates', 'Images'))) {
// wrong flags or is a special forum we don't want, so
// don't import it and ignore any children it may have
$data['__ignorechildren'] = true;
$this->push_stack($data);
return;
} else {
$this->push_stack($data);
}
$stack_size = $this->fetch_stack_size();
if ($stack_size == 0) {
//eeke !
die('no push');
} else {
if ($stack_size == 1) {
// One deep its a cat
$category_object = new ImpExData($this->Db_object, $this->session, 'forum');
$category_object->set_value('mandatory', 'title', $data['attributes']['title'] ? $data['attributes']['title'] : $data['attributes']['name']);
$category_object->set_value('mandatory', 'displayorder', '1');
$category_object->set_value('mandatory', 'parentid', '-1');
$category_object->set_value('mandatory', 'importforumid', '0');
$category_object->set_value('mandatory', 'importcategoryid', hexdec($data['attributes']['unique']));
$category_object->set_value('mandatory', 'options', $this->_default_cat_permissions);
$category_object->set_value('nonmandatory', 'description', $data['attributes']['heading']);
if ($cat_id = $category_object->import_category($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\">Category -- <b>" . $category_object->how_complete() . "%</b></span> :: " . $category_object->get_value('mandatory', 'title');
$this->session->add_session_var('currentcat', $cat_id);
$this->session->add_session_var('currentforum', $cat_id);
flush();
} else {
echo "<br />'" . trim($attributes['attributes']['name']) . " not imported";
}
unset($category_object);
} else {
if ($stack_size == 2) {
// Two deep its a forum
$forum_object = new ImpExData($this->Db_object, $this->session, 'forum');
$forum_object->set_value('mandatory', 'parentid', $this->session->get_session_var('currentcat'));
$forum_object->set_value('mandatory', 'title', $data['attributes']['name']);
$forum_object->set_value('mandatory', 'displayorder', $data['attributes']['sortSeq']);
$forum_object->set_value('mandatory', 'importforumid', hexdec($data['attributes']['unique']));
$forum_object->set_value('mandatory', 'importcategoryid', '0');
$forum_object->set_value('mandatory', 'options', $this->_default_forum_permissions);
$forum_object->set_value('nonmandatory', 'description', $forum['heading']);
$forum_object->set_value('nonmandatory', 'visible', '1');
if ($forum_id = $forum_object->import_forum($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\">Forum -- <b>" . $forum_object->how_complete() . "%</b></span> :: forum " . $forum_object->get_value('mandatory', 'title');
$this->session->add_session_var('currentforum', $forum_id);
flush();
} else {
echo "<br />'" . trim($data['attributes']['name']) . " not imported";
}
unset($forum_object);
} else {
// Two deep its a sub forum, with a folder tag
$forum_object = new ImpExData($this->Db_object, $this->session, 'forum');
$forum_object->set_value('mandatory', 'parentid', $this->session->get_session_var('currentforum'));
$forum_object->set_value('mandatory', 'title', $data['attributes']['name']);
$forum_object->set_value('mandatory', 'displayorder', $data['attributes']['sortSeq']);
$forum_object->set_value('mandatory', 'importforumid', hexdec($data['attributes']['unique']));
$forum_object->set_value('mandatory', 'importcategoryid', '0');
$forum_object->set_value('mandatory', 'options', $this->_default_forum_permissions);
$forum_object->set_value('nonmandatory', 'description', $forum['heading']);
$forum_object->set_value('nonmandatory', 'visible', '1');
if ($forum_id = $forum_object->import_forum($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
echo "<br /><span class=\"isucc\">Sub Forum -- <b>" . $forum_object->how_complete() . "%</b></span> :: forum " . $forum_object->get_value('mandatory', 'title');
$this->session->add_session_var('currentforum', $forum_id);
flush();
} else {
echo "<br />'" . trim($data['attributes']['name']) . " not imported";
}
unset($forum_object);
}
}
}
//.........這裏部分代碼省略.........