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


PHP Error::setPrepend方法代码示例

本文整理汇总了PHP中Error::setPrepend方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::setPrepend方法的具体用法?PHP Error::setPrepend怎么用?PHP Error::setPrepend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


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

示例1: wikipedia_search

function wikipedia_search($procd_descr)
{
    profiling_start('wikipedia_search');
    $TERMS = wikipedia_process_term($procd_descr);
    $url = wikipedia_url($TERMS);
    $data = cached_file_get_contents($url);
    Error::setPrepend($data);
    Error::generate('debug', 'WIKIPEDIA');
    eval('$arr = ' . $data . ';');
    foreach ($arr['query']['pages'] as $k => $v) {
        $title = urlencode($v['title']);
        $url = urlencode($v['fullurl']);
        // https://dgl.cx/2008/10/wikipedia-summary-dns
        if ($k == -1) {
            // not found
            return array();
        }
        break;
    }
    // this is probably a topic from a random unintended field like "frequency analysis (cryptoanalysis)"
    if (strlen($title) < strlen($TERMS) - 5 || strlen($title) > strlen($TERMS) + 5 || strrchr($title, '%28')) {
        return array();
    }
    $store = array('title' => urldecode(str_replace('+', ' ', $title)), 'link' => urldecode($url), 'source' => 'wikipedia');
    profiling_end('wikipedia_search');
    return array($store);
}
开发者ID:ritthai,项目名称:LMS,代码行数:27,代码来源:wikipedia.util.php

示例2: Memcached

<?php

@session_start();
@db_connect();
$memcached = new Memcached();
$memcached->addServer('localhost', 11211);
controller_prefix();
if (isset($_SESSION)) {
    Error::setPrepend($_SESSION);
}
Error::generate('debug', 'start controller');
@(include "{$ROOT}/includes/tags.inc");
@(include "dataacquisition/search.util.php");
@(include "{$ROOT}/includes/subjects.inc");
@(include "{$ROOT}/includes/universities.inc");
@(include "{$ROOT}/includes/geography.inc");
$CONTROLLER = 'course';
$PAGE_REL_URL = "{$HTMLROOT}";
$ACTIONS = array('search' => new HttpAction("{$PAGE_REL_URL}/search", 'get', array('id')), 'search2' => new HttpAction("{$PAGE_REL_URL}/search", 'get', array('terms')), 'list' => new HttpAction("{$PAGE_REL_URL}/list", 'get', array()), 'show' => new HttpAction("{$PAGE_REL_URL}/show", 'get', array('id')), 'list2' => new HttpAction("{$PAGE_REL_URL}/show", 'get', array()), 'post' => new HttpAction("{$PAGE_REL_URL}/post", 'post', array('subject', 'body', 'cid')), 'contact' => new HttpAction("{$PAGE_REL_URL}/contact", 'get', array()), 'terms' => new HttpAction("{$PAGE_REL_URL}/terms", 'get', array()), 'privacy' => new HttpAction("{$PAGE_REL_URL}/privacy", 'get', array()), 'about' => new HttpAction("{$PAGE_REL_URL}/about", 'get', array()), 'countries' => new HttpAction("{$PAGE_REL_URL}/countries", 'get', array()), 'areas' => new HttpAction("{$PAGE_REL_URL}/areas", 'get', array('country')), 'universities' => new HttpAction("{$PAGE_REL_URL}/universities", 'get', array('area')), 'subjects' => new HttpAction("{$PAGE_REL_URL}/subjects", 'get', array('university')), 'subject' => new HttpAction("{$PAGE_REL_URL}/subject", 'get', array('university', 'code')), 'index' => new HttpAction("{$PAGE_REL_URL}/", 'get', array()), 'autocomplete' => new HttpAction("{$PAGE_REL_URL}/autocomplete", 'get', array('list')), 'favs' => new HttpAction("{$PAGE_REL_URL}/favs", 'post', array('cid', 'owner', 'type')), 'favsrm' => new HttpAction("{$PAGE_REL_URL}/favsrm", 'post', array('cid', 'owner', 'type')), 'voteup' => new HttpAction("{$PAGE_REL_URL}/voteup", 'post', array('id', 'cid', 'owner', 'type')), 'votedown' => new HttpAction("{$PAGE_REL_URL}/votedown", 'post', array('id', 'cid', 'owner', 'type')), 'check_lock' => new HttpAction("{$PAGE_REL_URL}/check_lock", 'post', array('cid')), 'invalidate' => new HttpAction("{$PAGE_REL_URL}/invalidate", 'get', array('id'), 'admin'));
$search_results = array();
$action = false;
$params = array();
foreach ($ACTIONS as $key => $val) {
    if ($val->wasCalled()) {
        if (!$action) {
            $action = $key;
        }
        $params = array_merge($params, $ACTIONS[$action]->getParams());
        break;
    }
}
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:index.php

示例3: array

<?php 
}
?>
                            <div id="sidebar_course_recommendations">People who viewed this course also viewed:</div>
								<div id="sidebar_recommendation_tagcloud_hidden" class="hidden">
<?php 
$ctr = 0;
Error::setPrepend($other_views);
Error::generate('debug', 'Recommendation array');
$reduced_recs = array();
$i = 0;
foreach ($other_views as $k => $v) {
    $reduced_recs[$i++] = $v;
}
$n_rrecs = $i;
Error::setPrepend($reduced_recs);
Error::generate('debug', 'Reduced Recommendation array');
$topn = 10;
// limit to $topn top results
foreach ($other_views as $k => $v) {
    if (++$ctr == $topn) {
        break;
    }
    // limit to $topn top results
    $id = intval($k);
    $subj = ucfirst(Comment::GetSubject($id));
    $crs = new CourseDefn($subj);
    $success = $crs->load();
    $hrefid = $crs->id;
    // cloudinizr javascript is in template_end
    for ($i = 0; $i < $v / $reduced_recs[min(10, $n_rrecs - 1)]; $i++) {
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:recommendations.pview.php

示例4: arsort

arsort($similarities);
if ($similarities && count($similarities) > 0) {
    ?>
                        <div id="course_similarities">
<?php 
} else {
    ?>
                        <div id="course_similarities" class="hidden">
<?php 
}
?>
                            <div id="sidebar_course_similarities">Similar courses:</div>
								<div id="sidebar_similarities_tagcloud_hidden" class="hidden">
<?php 
$ctr = 0;
Error::setPrepend($similarities);
Error::generate('debug', 'Similarity array');
$topn = 10;
// limit to $topn top results
foreach ($similarities as $k => $v) {
    if (++$ctr == $topn) {
        break;
    }
    // limit to $topn top results
    $id = intval($k);
    $subj = ucfirst(Comment::GetSubject($id));
    $crs = new CourseDefn($subj);
    $crs->load();
    $hrefid = $crs->id;
    // cloudinizr javascript is in template_end
    for ($i = 0; $i < (double) $similarities[$k] * 10; $i++) {
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:similar.pview.php


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