本文整理汇总了PHP中unknown::get_sections方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::get_sections方法的具体用法?PHP unknown::get_sections怎么用?PHP unknown::get_sections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::get_sections方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_getcontent
/**
*
*
* @param unknown $params
* @param unknown $bBlog (reference)
*/
function smarty_function_getcontent($params, &$bBlog)
{
// Retrieving data
$bBlog->get_sections();
$sections = $bBlog->sections;
foreach ($sections as $object) {
$new[$object->sectionid] = $object;
}
$sections = $new;
$current_section = $bBlog->get_template_vars("sectionid");
// Return
$bBlog->assign("content", $sections[$current_section]->content);
}
示例2: admin_plugin_rssfeedmaker_run
/**
*
*
* @param unknown $bBlog (reference)
*/
function admin_plugin_rssfeedmaker_run(&$bBlog)
{
if (isset($_POST['sub']) && $_POST['sub'] == 'y') {
$url = BLOGURL . 'rss.php?';
if ($_POST['version'] == 2) {
$url .= 'ver=2';
} elseif ($_POST['version'] == 'atom03') {
$url .= 'ver=atom03';
} else {
$url .= 'ver=0.92';
}
if (is_numeric($_POST['num'])) {
$url .= '&num=' . $_POST['num'];
}
if ($_POST['sectionid'] > 0) {
$url .= '&sectionid=' . $_POST['sectionid'];
}
if (is_numeric($_POST['year'])) {
$url .= '&year=' . $_POST['year'];
}
if (is_numeric($_POST['month'])) {
$url .= '&year=' . $_POST['day'];
}
if (is_numeric($_POST['day'])) {
$url .= '&year=' . $_POST['day'];
}
$bBlog->assign('results', TRUE);
$bBlog->assign('feedurl', $url);
}
$sections = $bBlog->get_sections();
$sectionlist = '';
foreach ($sections as $section) {
$sectionlist .= "<option value='{$section->sectionid}'>{$section->nicename}</option>";
}
$bBlog->assign('sectionlist', $sectionlist);
}
示例3: smarty_function_getsections
/**
*
*
* @param unknown $params
* @param unknown $bBlog (reference)
* @return unknown
*/
function smarty_function_getsections($params, &$bBlog)
{
if (!T_SECTIONS) {
die("Some problem around the definition of T_SECTION");
}
// Temporary bugtrap to see if i'm right. (lordwo)
// Default values
if (!isset($params['limit'])) {
$params['limit'] = 'both';
}
if (isset($params['separator'])) {
$params['after'] = $params['separator'];
$params['before'] = '';
}
// Retrieving data
$bBlog->get_sections();
// Generating links
$i = 0;
foreach ($bBlog->sections as $row) {
if ($params['limit'] == 'both') {
$print = TRUE;
} elseif ($params['limit'] == 'content' && $row->content != '') {
$print = TRUE;
} elseif ($params['limit'] == 'blog' && $row->content == '') {
$print = TRUE;
} else {
$print = FALSE;
}
if ($print == TRUE) {
$i++;
$returned_values .= $params['before'] . "<a href='?sectionid=" . $row->sectionid . "'>" . $row->nicename . "</a>" . $params['after'];
}
}
// Return
return $returned_values;
}
示例4: admin_plugin_sections_run
/**
*
*
* @param unknown $bBlog (reference)
*/
function admin_plugin_sections_run(&$bBlog)
{
// Again, the plugin API needs work.
if (isset($_GET['sectdo'])) {
$sectdo = $_GET['sectdo'];
} elseif (isset($_POST['sectdo'])) {
$sectdo = $_POST['sectdo'];
} else {
$sectdo = '';
}
switch ($sectdo) {
case 'new':
// sections are being editied
$bBlog->query("insert into " . T_SECTIONS . "\n\t\t\tset nicename='" . my_addslashes($_POST['nicename']) . "',\n\t\t\tname='" . my_addslashes($_POST['urlname']) . "'");
$insid = $bBlog->insert_id;
$bBlog->get_sections();
// update the section cache
break;
case "Delete":
// delete section
// have to remove all references to the section in the posts
$sect_id = $bBlog->sect_by_name[$_POST['sname']];
if ($sect_id > 0) {
//
$posts_in_section_q = $bBlog->make_post_query(array("sectionid" => $sect_id));
$posts_in_section = $bBlog->get_posts($posts_in_section_q, TRUE);
if ($posts_in_section) {
foreach ($posts_in_section as $post) {
unset($tmpr);
$tmpr = array();
$tmpsections = explode(":", $post->sections);
foreach ($tmpsections as $tmpsection) {
if ($tmpsection != $sect_id) {
$tmpr[] = $tmpsection;
}
}
$newsects = implode(":", $tmpr);
// update the posts to remove the section
$bBlog->query("update " . T_POSTS . " set sections='{$newsects}'\n \twhere postid='{$post->postid}'");
}
// end foreach ($post_in_section as $post)
}
// end if($posts_in_section)
// delete the section
//$bBlog->get_results("delete from ".T_SECTIONS." where sectionid='$sect_id'");
$bBlog->query("delete from " . T_SECTIONS . " where sectionid='{$sect_id}'");
//echo "delete from ".T_SECTIONS." where sectionid='$sect_id'";
$bBlog->get_sections();
//$bBlog->debugging=TRUE;
}
// else show error
// else show error
case "Save":
$sect_id = $bBlog->sect_by_name[$_POST['sname']];
if ($sect_id < 1) {
break;
}
$bBlog->query("update " . T_SECTIONS . " set nicename='" . my_addslashes($_POST['nicename']) . "'\n where sectionid='{$sect_id}'");
$bBlog->get_sections();
// update section cache
break;
default:
// show form
break;
}
$bBlog->assign('esections', $bBlog->sections);
}