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


PHP twfy_debug函数代码示例

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


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

示例1: wikipedize

function wikipedize($source)
{
    $was_array = false;
    if (is_array($source)) {
        $source = join('|||', $source);
        $was_array = true;
    }
    # Set up various variables
    $capsword = "[A-Z][a-zA-Z'0-9]*";
    # not starting with number, as catches too much
    $fillerwords = "of|and|in|on|under|the";
    $middlewordre = "(?:{$capsword}|{$fillerwords})\\s*";
    $endwordre = "(?:{$capsword})\\s*";
    # and, of etc. can't appear at ends
    # Match either "Two Endwords" or "Endword and Some Middle Words"
    $greedyproperre = "/\\b{$endwordre}(?:{$middlewordre})*{$endwordre}\\b/ms";
    # Match without filler words (so if you have a phrase like
    # "Amnesty International and Human Rights Watch" you also get both parts
    # separately "Amnesty International" and "Human Rights Watch")
    $frugalproperre = "/\\b(?:{$endwordre}){2,}\\b/ms";
    # And do a greedy without the first word of a sentence
    $greedynotfirst = "/\\.\\s+\\S+\\s+({$endwordre}(?:{$middlewordre})*{$endwordre})\\b/ms";
    preg_match_all($greedyproperre, $source, $propernounphrases1);
    preg_match_all($frugalproperre, $source, $propernounphrases2);
    preg_match_all($greedynotfirst, $source, $propernounphrases3);
    # Three Letter Acronyms
    preg_match_all("/\\b[A-Z]{2,}/ms", $source, $acronyms);
    # We don't want no steenking duplicates
    $phrases = array_unique(array_merge($propernounphrases1[0], $propernounphrases2[0], $propernounphrases3[1], $acronyms[0]));
    # Sort into order, largest first
    usort($phrases, "lensort");
    foreach ($phrases as $i => $phrase) {
        $phrases[$i] = mysql_real_escape_string(str_replace(' ', '_', trim($phrase)));
    }
    # Open up a db connection, and whittle our list down even further, against
    # the real titles.
    $matched = array();
    $db = new ParlDB();
    $source = explode('|||', $source);
    $q = $db->query("SELECT title FROM titles WHERE title IN ('" . join("','", $phrases) . "')");
    for ($i = 0; $i < $q->rows(); $i++) {
        $wikistring = $q->field($i, 'title');
        $phrase = str_replace('_', ' ', $wikistring);
        # See if already matched a string this one is contained within
        foreach ($matched as $got) {
            if (strstr($got, $phrase)) {
                continue 2;
            }
        }
        # Go ahead
        twfy_debug("WIKIPEDIA", "Matched '{$phrase}'");
        # 1 means only replace one match for phrase per paragraph
        $source = preg_replace("/{$phrase}/", "<a href=\"http://en.wikipedia.org/wiki/{$wikistring}\">{$phrase}</a>", $source, 1);
        array_push($matched, $phrase);
    }
    if (!$was_array) {
        $source = join('|||', $source);
    }
    return $source;
}
开发者ID:leowmjw,项目名称:twfy,代码行数:60,代码来源:wikipedia.php

示例2: array

            'trackback_id'	=> '37',
            'gid' 			=> '2003-02-28.475.3',
            'url' 			=> 'http://www.gyford.com/weblog/my_entry.html',
            'blog_name' 	=> "Phil's weblog",
            'title' 		=> 'Interesting speech',
            'excerpt' 		=> 'My MP has posted an interesting speech, etc',
            'posted'		=> '2003-12-31 23:00:00'
        ),
        array (
            [as above]
        ),
        etc.
    );
*/
global $PAGE, $this_page, $DATA;
twfy_debug("TEMPLATE", "trackbacks.php");
$info = $data['info'];
$data = $data['data'];
if (count($data) > 0) {
    if ($info['view'] == 'recent') {
        $title = $info['num'] . ' most recent trackbacks';
    } else {
        $title = 'Some sites linking to this page';
    }
    if (!$PAGE->within_stripe()) {
        $PAGE->stripe_start();
        $stripe_must_be_ended = true;
    } else {
        $stripe_must_be_ended = false;
    }
    ?>
开发者ID:udp12,项目名称:theyworkforyou,代码行数:31,代码来源:trackbacks.php

示例3: array

$data = array (
	'info' => array (
		'order' => 'first_name'
	),
	'data' => array (
		'first_name'	=> 'Fred',
		'last_name'		=> 'Bloggs,
		'person_id'		=> 23,
		'constituency'	=> 'Here',
		'party'			=> 'Them'
	)
);
*/
global $this_page;
twfy_debug("TEMPLATE", "people_mps.php");
$order = $data['info']['order'];
$URL = new URL($this_page);
if ($order == 'name') {
    $th_name = 'Name';
} else {
    $URL->insert(array('o' => 'n'));
    $th_name = '<a href="' . $URL->generate() . '">Name</a>';
}
$URL->insert(array('o' => 'p'));
$th_party = '<a href="' . $URL->generate() . '">Party</a>';
if ($order == 'party') {
    $th_party = 'Party';
}
?>
                <div class="sort">
开发者ID:palfrey,项目名称:twfy,代码行数:30,代码来源:people_peers.php

示例4: _get_data_by_column

 function _get_data_by_column($args)
 {
     global $this_page;
     twfy_debug(get_class($this), "getting data by column");
     $input = array('amount' => array('body' => true, 'comment' => true), 'where' => array('hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%'), 'order' => 'hpos');
     $data = $this->_get_hansard_data($input);
     #		$data = array();
     #		$itemdata = $this->_get_item($args);
     #		if ($itemdata) {
     #	$data['info']['date'] = $itemdata['hdate'];
     #			$data['info']['text'] = $itemdata['body'];
     #			$data['info']['major'] = $this->major;
     #		}
     return $data;
 }
开发者ID:rhaleblian,项目名称:twfy,代码行数:15,代码来源:hansardlist.php

示例5: array

// Remember, we are currently within the HANSARDLIST class,
// in the render() function.
// The array $data will be packed full of luverly stuff about hansard objects.
// See the bottom of hansard_gid.php for general information about its structure and contents...
/*

$data['info'] = array (
	'results_per_page' => 10,
	'total_results' => 1240,
	'first_result' => 0,
	'page' => 1,
	's' => 'fox+hunting'
);
*/
global $PAGE, $this_page, $GLOSSARY, $hansardmajors;
twfy_debug("TEMPLATE", "hansard_search.php");
$info = $data['info'];
$searchdescription = $data['searchdescription'];
if (isset($info['total_results']) && $info['total_results'] > 0) {
    // If we're getting matches and no glossary entry, we can trigger them to add a definition
    // Obviously, only if it's a proper noun
    if ($info['total_results'] > 0 && $GLOSSARY['num_search_matches'] == 0) {
        // I'll be leaving this empty for now, pending search engine improvements...
    }
    $last_result = $info['first_result'] + $info['results_per_page'] - 1;
    if ($last_result > $info['total_results']) {
        $last_result = $info['total_results'];
    }
    print "\t\t\t\t<h3 style='font-weight:normal'>Results <strong>" . number_format($info['first_result']) . '-' . number_format($last_result) . '</strong> of ' . number_format($info['total_results']) . " for <strong>" . htmlentities($searchdescription) . "</strong></h3>\n";
} elseif ($info['total_results'] == 0) {
    echo '<h3 style="font-weight:normal">Your search for <strong>', htmlentities($searchdescription), '</strong> did not match anything.</h3>';
开发者ID:palfrey,项目名称:twfy,代码行数:31,代码来源:hansard_search.php

示例6: set_postcode_cookie

 function set_postcode_cookie($pc)
 {
     // Set the user's postcode.
     // Doesn't change it in the DB, as it's probably mainly for
     // not-logged-in users.
     $this->postcode = $pc;
     if (!headers_sent()) {
         // if in debug mode
         setcookie(POSTCODE_COOKIE, $pc, time() + 7 * 86400, "/", COOKIEDOMAIN);
     }
     twfy_debug('USER', "Set the cookie named '" . POSTCODE_COOKIE . " to '{$pc}' for " . COOKIEDOMAIN . " domain");
 }
开发者ID:bruno,项目名称:openaustralia-app,代码行数:12,代码来源:user.php

示例7: twfy_debug

<?php

// For displaying the main Hansard content listings (by date).
// Remember, we are currently within the DEBATELIST or WRANSLISTS class,
// in the render() function.
// The array $data will be packed full of luverly stuff about hansard objects.
// See the bottom of hansard_gid for information about its structure and contents...
global $PAGE, $DATA, $this_page, $hansardmajors;
twfy_debug("TEMPLATE", "hansard_bill.php");
$PAGE->page_start();
$PAGE->stripe_start();
if (isset($data['rows'])) {
    $prevlevel = '';
    print "\t\t\t\t<ul id=\"hansard-day\" class=\"hansard-day\">\n";
    // Cycle through each row...
    foreach ($data['rows'] as $row) {
        // Start a top-level item, eg a section.
        if ($row['htype'] == '10') {
            if ($prevlevel == 'sub') {
                print "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
            } elseif ($prevlevel == 'top') {
                print "</li>\n";
            }
            print "\t\t\t\t<li>";
            // Start a sub-level item, eg a subsection.
        } else {
            if ($prevlevel == '') {
                print "\t\t\t\t<li>\n";
            } elseif ($prevlevel == 'top') {
                print "\n\t\t\t\t\t<ul>\n";
            }
开发者ID:udp12,项目名称:theyworkforyou,代码行数:31,代码来源:hansard_bill.php

示例8: set_constituency_cookie

 function set_constituency_cookie($constituency)
 {
     $this->constituency = $constituency;
     if (!headers_sent()) {
         // if in debug mode
         setcookie(CONSTITUENCY_COOKIE, $constituency, time() + 7 * 86400, "/", COOKIEDOMAIN);
     }
     twfy_debug('USER', "Set the cookie named '" . CONSTITUENCY_COOKIE . " to '{$constituency}' for " . COOKIEDOMAIN . " domain");
 }
开发者ID:bruno,项目名称:twfy,代码行数:9,代码来源:user.php

示例9: twfy_debug

<?php

// For displaying the main Hansard content listings (by gid),
// and individual Hansard items (the comments are handled separately
// by COMMENTLIST and the comments.php template).
// Remember, we are currently within the DEBATELIST or WRANSLISTS class,
// in the render() function.
// The array $data will be packed full of luverly stuff about hansard objects.
// See the bottom of this document for information about its structure and contents...
global $PAGE, $this_page, $GLOSSARY, $hansardmajors, $DATA;
include_once INCLUDESPATH . "easyparliament/searchengine.php";
include_once INCLUDESPATH . "easyparliament/member.php";
twfy_debug("TEMPLATE", "hansard_gid.php");
// Will set the page headings and start the page HTML if it hasn't
// already been started.
if (!isset($data['info'])) {
    // No data! We'll be exiting here! but send a 404 so that spiders stop indexing the page.
    header("HTTP/1.0 404 Not Found");
    # Bots have some fiddled with wrans, so we get errors here sometimes that don't
    # signify a real problem.
    #trigger_error("Not enough data to display anything.", E_USER_ERROR);
    exit;
}
$PAGE->page_start();
$PAGE->supress_heading = true;
/*
$PAGE->stripe_start('head-1', '');

$sidebar = $hansardmajors[$data['info']['major']]['sidebar_short'];

$PAGE->stripe_end(array(
开发者ID:nallachaitu,项目名称:theyworkforyou,代码行数:31,代码来源:hansard_gid.php

示例10: run_search

 function run_search($first_result, $results_per_page, $sort_order = 'relevance')
 {
     $start = getmicrotime();
     // NOTE: this is to do sort by date
     switch ($sort_order) {
         case 'date':
             $this->enquire->set_sort_by_value_then_relevance(0, true);
             break;
         case 'created':
             $this->enquire->set_sort_by_value_then_relevance(6, true);
         default:
             //do nothing, default ordering is by relevance
             break;
     }
     $matches = $this->enquire->get_mset($first_result, $results_per_page);
     $this->gids = array();
     $this->created = array();
     $this->relevances = array();
     $iter = $matches->begin();
     $end = $matches->end();
     while (!$iter->equals($end)) {
         $relevancy = $iter->get_percent();
         $weight = $iter->get_weight();
         $doc = $iter->get_document();
         $gid = $doc->get_data();
         if ($sort_order == 'created') {
             array_push($this->created, $doc->get_value(6));
         }
         twfy_debug("SEARCH", "gid: {$gid} relevancy: {$relevancy}% weight: {$weight}");
         array_push($this->gids, "uk.org.publicwhip/" . $gid);
         array_push($this->relevances, $relevancy);
         $iter->next();
     }
     $duration = getmicrotime() - $start;
     twfy_debug("SEARCH", "Run search took {$duration} seconds.");
 }
开发者ID:bruno,项目名称:twfy,代码行数:36,代码来源:searchengine.php

示例11: page_footer

    function page_footer($extra = null)
    {
        global $DATA, $this_page;
        // This makes the tracker appear on all sections, but only actually on openaustralia.org
        //if ($DATA->page_metadata($this_page, 'track') ) {
        if (substr(DOMAIN, -18) == "openaustralia.org" && substr(DOMAIN, 0, 7) != "staging") {
            // We want to track this page.
            // Kind of fake URLs needed for the tracker.
            $url = urlencode('http://' . DOMAIN . '/' . $this_page);
            ?>
<script type="text/javascript"><!--
an=navigator.appName;sr='http://x3.extreme-dm.com/';srw="na";srb="na";d=document;r=41;function pr(n) {
d.write("<div><img alt=\"\" src=\""+sr+"n\/?tag=fawkes&p=<?php 
            echo $url;
            ?>
&j=y&srw="+srw+"&srb="+srb+"&l="+escape(d.referrer)+"&rs="+r+"\" height=\"1\" width=\"1\"></"+"div>");}
s=screen;srw=s.width;an!="Netscape"?srb=s.colorDepth:srb=s.pixelDepth
pr()//-->
</script><noscript><div><img alt="" src="http://x3.extreme-dm.com/z/?tag=fawkes&amp;p=<?php 
            echo $url;
            ?>
&amp;j=n" height="1" width="1"></div></noscript>
<?php 
            if (get_http_var('c4') || get_http_var('c4x')) {
                ?>
<script type="text/javascript" src="http://www.channel4.com/media/scripts/statstag.js"></script> <!--//end WEB STATS --> <noscript><div style="display:none"><img width="1" height="1" src="http://stats.channel4.com/njs.gif?dcsuri=/nojavascript&amp;WT.js=No" alt=""></div></noscript>
<?php 
            }
            // mySociety tracking, not on staging
            if (defined('OPTION_TRACKING') && OPTION_TRACKING) {
                track_event($extra);
            }
        }
        // DAMN, this really shouldn't be in PAGE.
        $db = new ParlDB();
        $db->display_total_duration();
        $duration = getmicrotime() - STARTTIME;
        twfy_debug("TIME", "Total time for page: {$duration} seconds.");
        if (!isset($_SERVER['WINDIR'])) {
            $rusage = getrusage();
            $duration = $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec'] - STARTTIMEU;
            twfy_debug('TIME', "Total user time: {$duration} microseconds.");
            $duration = $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec'] - STARTTIMES;
            twfy_debug('TIME', "Total system time: {$duration} microseconds.");
        }
        ?>
</div> <!-- end #container -->

</body>
</html>
<?php 
        ob_end_flush();
    }
开发者ID:archoo,项目名称:twfy,代码行数:53,代码来源:page.php

示例12: send_email

function send_email($to, $subject, $message, $bulk = false, $from = '', $want_bounces = false)
{
    // Use this rather than PHP's mail() direct, so we can make alterations
    // easily to all the emails we send out from the site.
    // eg, we might want to add a .sig to everything here...
    if (!$from) {
        $from = CONTACTEMAIL;
    }
    $headers = "From: TheyWorkForYou <{$from}>\r\n" . "Content-Type: text/plain; charset=iso-8859-1\r\n" . "MIME-Version: 1.0\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . ($bulk ? "Precedence: bulk\r\n" : "") . "X-Mailer: PHP/" . phpversion();
    twfy_debug('EMAIL', "Sending email to {$to} with subject of '{$subject}'");
    if ($want_bounces) {
        $envelope_sender = twfy_verp_envelope_sender($to);
        $success = mail($to, $subject, $message, $headers, '-f ' . $envelope_sender);
    } else {
        $success = mail($to, $subject, $message, $headers);
    }
    return $success;
}
开发者ID:palfrey,项目名称:twfy,代码行数:18,代码来源:utility.php

示例13: header

# vim:sw=4:ts=4:et:nowrap

include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH."easyparliament/member.php";
include_once INCLUDESPATH."easyparliament/glossary.php";

// From http://cvs.sourceforge.net/viewcvs.py/publicwhip/publicwhip/website/
include_once INCLUDESPATH."postcode.inc";

if (get_http_var('pid') == 16407) {
    header('Location: /search/?pid=10133');
    exit;
}

$searchstring = construct_search_string();
twfy_debug('SEARCH', $searchstring);

$this_page = 'search';

$warning = '';
if (preg_match('#^\s*[^\s]+\.\.[^\s]+\s*$#', $searchstring)) {
    $warning = 'You cannot search for just a date range, please select some other criteria as well.';
}
if (preg_match('#\.\..*?\.\.#', $searchstring)) {
    $warning = 'You cannot search for more than one date range.';
}

if (get_http_var('adv') || $warning) {
	$PAGE->page_start();
	$PAGE->stripe_start();
    if ($warning) echo "<p id='warning'>$warning</p>";
开发者ID:henare,项目名称:theyworkforyou,代码行数:31,代码来源:index.php

示例14: send_email

function send_email($to, $subject, $message, $bulk = false)
{
    // Use this rather than PHP's mail() direct, so we can make alterations
    // easily to all the emails we send out from the site.
    // eg, we might want to add a .sig to everything here...
    // Everything is not BCC'd to REPORTLIST (unless it's already going to the list!).
    $headers = "From: OpenAustralia.org <" . CONTACTEMAIL . ">\n" . "Reply-To: OpenAustralia.org <" . CONTACTEMAIL . ">\n" . "Content-Type: text/plain; charset=iso-8859-1\n" . "Content-Transfer-Encoding: 8bit\n" . ($bulk ? "Precedence: bulk\n" : "") . "X-Mailer: PHP/" . phpversion();
    /* 
    	if ($to != REPORTLIST) {
      		$headers .= "\r\nBcc: " . BCCADDRESS;
    	}
    */
    twfy_debug('EMAIL', "Sending email to {$to} with subject of '{$subject}'");
    $success = mail($to, $subject, $message, $headers);
    return $success;
}
开发者ID:leowmjw,项目名称:twfy,代码行数:16,代码来源:utility.php

示例15: twfy_debug

<?php

// For displaying the main Hansard content listings (by date).
// Remember, we are currently within the DEBATELIST or WRANSLISTS class,
// in the render() function.
// The array $data will be packed full of luverly stuff about hansard objects.
// See the bottom of hansard_gid for information about its structure and contents...
global $PAGE, $DATA, $this_page, $hansardmajors;
twfy_debug("TEMPLATE", "hansard_column.php");
$PAGE->page_start();
$PAGE->stripe_start();
print_r($data);
if (isset($data)) {
    $prevlevel = '';
    print "\t\t\t\t<ul id=\"hansard-day\" class=\"hansard-day\">\n";
    // Cycle through each row...
    for ($i = 0; $i < count($data); $i++) {
        $row = $data[$i];
        // Start a top-level item, eg a section.
        if ($row['htype'] == '10') {
            if ($prevlevel == 'sub') {
                print "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
            } elseif ($prevlevel == 'top') {
                print "</li>\n";
            }
            print "\t\t\t\t<li>";
            // Start a sub-level item, eg a subsection.
        } else {
            if ($prevlevel == '') {
                print "\t\t\t\t<li>\n";
            } elseif ($prevlevel == 'top') {
开发者ID:udp12,项目名称:theyworkforyou,代码行数:31,代码来源:hansard_column.php


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