当前位置: 首页>>代码示例>>PHP>>正文


PHP get_category_info函数代码示例

本文整理汇总了PHP中get_category_info函数的典型用法代码示例。如果您正苦于以下问题:PHP get_category_info函数的具体用法?PHP get_category_info怎么用?PHP get_category_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_category_info函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_category_info

<?php

if (isset($p->file)) {
    $url = $p->file;
} else {
    $url = $oldfile;
}
$desc = get_category_info(null);
$content = file_get_contents($url);
$oldtitle = get_content_tag('t', $content, 'Untitled');
$olddescription = get_content_tag('d', $content);
$oldtag = get_content_tag('tag', $content);
$oldimage = get_content_tag('image', $content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
$isdraft = explode('/', $dir);
$oldurl = explode('_', $url);
if (empty($oldtag)) {
    $oldtag = $oldurl[1];
}
$oldmd = str_replace('.md', '', $oldurl[2]);
if (isset($_GET['destination'])) {
    $destination = $_GET['destination'];
} else {
    $destination = 'admin';
}
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
// Category string
$cat = explode('/', $replaced);
$category = $cat[count($cat) - 3];
$dt = str_replace($replaced, '', $oldurl[0]);
开发者ID:kareshok,项目名称:htmly,代码行数:31,代码来源:edit-image.html.php

示例2: get_posts

function get_posts($posts, $page = 1, $perpage = 0)
{
    if (empty($posts)) {
        $posts = get_post_sorted();
    }
    $tmp = array();
    // Extract a specific page with results
    $posts = array_slice($posts, ($page - 1) * $perpage, $perpage);
    foreach ($posts as $index => $v) {
        $post = new stdClass();
        $filepath = $v['dirname'] . '/' . $v['basename'];
        // Extract the date
        $arr = explode('_', $filepath);
        // Replaced string
        $replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
        // Author string
        $str = explode('/', $replaced);
        $author = $str[count($str) - 5];
        if ($str[count($str) - 3] == 'uncategorized') {
            $category = default_category();
            $post->category = '<a href="' . $category->url . '">' . $category->title . '</a>';
            $post->categoryb = '<a property="v:title" rel="v:url" href="' . $category->url . '">' . $category->title . '</a>';
        } else {
            $category = get_category_info($str[count($str) - 3]);
            $post->category = '<a href="' . $category[0]->url . '">' . $category[0]->title . '</a>';
            $post->categoryb = '<a property="v:title" rel="v:url" href="' . $category[0]->url . '">' . $category[0]->title . '</a>';
        }
        $type = $str[count($str) - 2];
        // The post author + author url
        $post->author = $author;
        $post->authorUrl = site_url() . 'author/' . $author;
        $post->type = $type;
        $dt = str_replace($replaced, '', $arr[0]);
        $t = str_replace('-', '', $dt);
        $time = new DateTime($t);
        $timestamp = $time->format("Y-m-d H:i:s");
        // The post date
        $post->date = strtotime($timestamp);
        // The archive per day
        $post->archive = site_url() . 'archive/' . date('Y-m', $post->date);
        if (config('permalink.type') == 'post') {
            $post->url = site_url() . 'post/' . str_replace('.md', '', $arr[2]);
        } else {
            $post->url = site_url() . date('Y/m', $post->date) . '/' . str_replace('.md', '', $arr[2]);
        }
        $post->file = $filepath;
        $content = file_get_contents($filepath);
        // Extract the title and body
        $post->title = get_content_tag('t', $content, 'Untitled: ' . date('l jS \\of F Y', $post->date));
        $post->image = get_content_tag('image', $content);
        $post->video = get_youtube_id(get_content_tag('video', $content));
        $post->link = get_content_tag('link', $content);
        $post->quote = get_content_tag('quote', $content);
        $post->audio = get_content_tag('audio', $content);
        $tag = array();
        $url = array();
        $bc = array();
        $rel = array();
        $tagt = get_content_tag('tag', $content);
        $t = explode(',', rtrim($arr[1], ','));
        if (!empty($tagt)) {
            $tl = explode(',', rtrim($tagt, ','));
            $tCom = array_combine($t, $tl);
            foreach ($tCom as $key => $val) {
                if (!empty($val)) {
                    $tag[] = array($val, site_url() . 'tag/' . strtolower($key));
                } else {
                    $tag[] = array($key, site_url() . 'tag/' . strtolower($key));
                }
            }
        } else {
            foreach ($t as $tt) {
                $tag[] = array($tt, site_url() . 'tag/' . strtolower($tt));
            }
        }
        foreach ($tag as $a) {
            $url[] = '<a rel="tag" href="' . $a[1] . '">' . $a[0] . '</a>';
            $bc[] = '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . $a[1] . '">' . $a[0] . '</a></span>';
        }
        $post->tag = implode(' ', $url);
        $post->tagb = implode(' » ', $bc);
        $post->related = rtrim($arr[1], ',');
        // Get the contents and convert it to HTML
        $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
        if (config('views.counter') == 'true') {
            $post->views = get_views($post->file);
        }
        $post->description = get_content_tag("d", $content, get_description($post->body));
        $tmp[] = $post;
    }
    return $tmp;
}
开发者ID:kareshok,项目名称:htmly,代码行数:92,代码来源:functions.php

示例3: session_start

<?php

$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
// extract ( $_SESSION , EXTR_REFS ) ;
$err_message = " Unable to process your request due to the follow problems: <br>\n";
do_html_header("Edit Category");
$catID =& $_GET["catID"];
//Call the funtion to get the category information
$editCatInfo = get_category_info($catID);
?>
<form name="form1" method="post" action="process_edit_category.php">
  <table width="100%" border="0" cellpadding="1" cellspacing="0">
    <tr> 
      <td width="20%">&nbsp;</td>
      <td width="80%">&nbsp;</td>
      <input type="hidden" name="catID" value="<?php 
echo $editCatInfo->CategoryID;
?>
">
    </tr>
    <tr> 
      <td>Category Name:</td>
      <td> <input name="catName" type="text" id="catname" size="40" maxlength="50" value="<?php 
echo $editCatInfo->CategoryName;
?>
"> 
      </td>
    </tr>
开发者ID:alexzita,项目名称:alex_blog,代码行数:31,代码来源:edit_category.php

示例4: get_category_info

                 $adv_qry = "&amp;adv=1";
             }
             if ($type != "") {
                 $type_qry = "&amp;type={$type}";
             }
             //      display links to more result pages
             include "" . $template_dir . "/html/070_more-results.html";
         }
     }
     break;
 default:
     if (!$cat_sel) {
         //  if not multiple category selection
         if ($show_categories) {
             if ($_REQUEST['catid'] && is_numeric($catid)) {
                 $cat_info = get_category_info($catid);
             } else {
                 $cat_info = get_categories_view();
             }
         }
         //  get name of current category
         $sql_query = "SELECT category from " . $mysql_table_prefix . "categories where category_id = '{$catid}'";
         $result = $db_con->query($sql_query);
         if ($debug && $db_con->errno) {
             $err_row = __LINE__ - 2;
             printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
             if (__FUNCTION__) {
                 printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
             } else {
                 printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
             }
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:31,代码来源:search_40.php

示例5: config

        }
        if (empty($content)) {
            $message['error'] .= '<li>Content field is required.</li>';
        }
        if (!$proper) {
            $message['error'] .= '<li>CSRF Token not correct.</li>';
        }
        config('views.root', 'system/admin/views');
        render('edit-page', array('title' => 'Edit category - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'error' => '<ul>' . $message['error'] . '</ul>', 'oldfile' => $oldfile, 'postTitle' => $title, 'postUrl' => $url, 'postContent' => $content, 'type' => 'is_category', 'bodyclass' => 'editcategory', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Edit category'));
    }
});
// Delete category
get('/category/:category/delete', function ($category) {
    if (login()) {
        config('views.root', 'system/admin/views');
        $post = get_category_info($category);
        if (!$post) {
            not_found();
        }
        $post = $post[0];
        render('delete-category', array('title' => 'Delete category - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'bodyclass' => 'editpage', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; ' . $post->title, 'p' => $post, 'type' => 'categoryPage'));
    } else {
        $login = site_url() . 'login';
        header("location: {$login}");
    }
});
// Get deleted category data
post('/category/:category/delete', function () {
    $proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
    if ($proper && login()) {
        $file = from($_REQUEST, 'file');
开发者ID:robihidayat,项目名称:htmly,代码行数:31,代码来源:htmly.php

示例6: category_list

function category_list($custom = null)
{
    $dir = "cache/widget";
    $filename = "cache/widget/category.list.cache";
    $tmp = array();
    $cat = array();
    $list = array();
    if (is_dir($dir) === false) {
        mkdir($dir, 0775, true);
    }
    if (file_exists($filename)) {
        $cat = unserialize(file_get_contents($filename));
    } else {
        $arr = get_category_info(null);
        foreach ($arr as $a) {
            $cat[] = array($a->md, $a->title);
        }
        array_push($cat, array('uncategorized', 'Uncategorized'));
        asort($cat);
        $tmp = serialize($cat);
        file_put_contents($filename, print_r($tmp, true));
    }
    if (!empty($custom)) {
        return $cat;
    }
    echo '<ul>';
    foreach ($cat as $k => $v) {
        if (get_categorycount($v['0']) !== 0) {
            echo '<li><a href="' . site_url() . 'category/' . $v['0'] . '">' . $v['1'] . '</a></li>';
        }
    }
    echo '</ul>';
}
开发者ID:austinvernsonger,项目名称:htmly,代码行数:33,代码来源:functions.php

示例7: get_all_themes

   get_all_themes();
   break;
 case 'getThemeInfo':
   get_theme_info();
   break;
 case 'saveThemeInfo':
   save_theme_info();
   break;
 case 'deleteTheme':
   delete_theme();
   break;
 case 'getAllCategoriesList':
   get_all_categories_list();
   break;
 case 'getCategoryInfo':
   get_category_info();
   break;
 case 'saveCategoryInfo':
   save_category_info();
   break;
 case 'deleteCategory':
   delete_category();
   break;
 case 'getAllLayersList':
   get_all_layers_list();
   break;
 case 'getThemeLayerMapping':
   get_theme_layer_mapping();
   break;
 case 'saveThemeLayerMapping':
   save_theme_layer_mapping();
开发者ID:rahool,项目名称:maplocator,代码行数:31,代码来源:ml_json_data.php


注:本文中的get_category_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。