本文整理匯總了PHP中printc函數的典型用法代碼示例。如果您正苦於以下問題:PHP printc函數的具體用法?PHP printc怎麽用?PHP printc使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了printc函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: editor_activex
function editor_activex($textarea, $cols, $rows, $text)
{
//style sheet for active-x editor
printc("<style type=\"text/css\">\n");
printc("<!--\n");
printc(" .btn { BORDER-WIDTH: 1; width: 26px; height: 24px; }\n");
printc(" .btnDN { BORDER-WIDTH: 1; width: 26px; height: 24px; BORDER-STYLE: inset; BACKGROUND-COLOR: buttonhighlight; }\n");
printc(" .btnNA { BORDER-WIDTH: 1; width: 26px; height: 24px; filter: alpha(opacity=25); }\n");
printc("-->\n");
printc("</style>\n");
printc("<style type=\"text/css\">\n");
printc("<!--\n");
printc(" body, td { font-family: arial; font-size: 12px; }\n");
printc(" .headline { font-family: arial black, arial; font-size: 28px; letter-spacing: -2px; }\n");
printc(" .subhead { font-family: arial, verdana; font-size: 12px; let!ter-spacing: -1px; }\n");
printc("-->\n");
printc("</style>\n");
// Begin modification 4 - 11.11.02 - afranco
// Add explanation of how to get <br />s
printc("<div class='desc'><b>Note:</b> To get a single line break, hold down SHIFT while pressing enter.");
// Begin modification 2 - 10.26.02 - rlange
// Added an id tag to the textarea definition
printc("<textarea name='{$textarea}' id='{$textarea}' cols='{$cols}' rows='{$rows}'>");
printc(spchars($text));
printc("</textarea>");
// End modification 2 - 10.26.02 - rlange
// Begin modification 3 - 10.26.02 - rlange
// Create the iView from JavaScript for the above textarea
printc("<script language=\"javascript1.2\">\n");
printc("editor_generate('{$textarea}');\n");
printc("</script>\n");
}
示例2: countit
function countit()
{
static $count = 0;
// default value
$count++;
printc("Count: {$count}");
}
示例3: printStoryEditLinks
function printStoryEditLinks()
{
global $thisSite, $thisSection, $thisPage, $thisStory, $tagged_page, $site_owner, $o, $story_set, $s, $sid, $site, $section, $page, $cfg;
printc("<div class='edit_links'>");
if ($cfg['disable_edit_content'] == TRUE && $_SESSION['ltype'] != 'admin') {
printc("<div align='right'>editing disabled</div>");
} else {
/******************************************************************************
* edit, delete options
******************************************************************************/
if ($_REQUEST['tag']) {
$envvars = "&site=" . $thisSite->name;
if ($tagged_section) {
$envvars .= "&section=" . $tagged_section;
}
if ($tagged_page) {
$envvars .= "&page=" . $tagged_page;
}
}
//printpre($story_set);
$l = array();
if ($_SESSION[auser] == $site_owner || $_SESSION[auser] != $site_owner && !$o->getField("locked")) {
if (!$_REQUEST['tag']) {
if (($thisPage->getField("storyorder") == 'custom' || $thisPage->getField("storyorder") == '') && $thisPage->hasPermission("edit")) {
if ($_REQUEST[showorder] == "story") {
$l[] = "<a href='{$PHP_SELF}?{$sid}{$envvars}&action=viewsite&site={$site}&section={$section}&page={$page}&showorder=0" . ($story_set ? "&story_set=" . ($story_set + 1) : "") . "' class='small' title='Reorder content blocks on this page'>hide order</a>";
} else {
$l[] = "<a href='{$PHP_SELF}?{$sid}{$envvars}&action=viewsite&site={$site}&section={$section}&page={$page}&showorder=story" . ($story_set ? "&story_set=" . ($story_set + 1) : "") . "' class='small' title='Reorder content blocks on this page'>reorder</a>";
}
}
if (($thisPage->getField("archiveby") == '' || $thisPage->getField("archiveby") == 'none' || !$thisPage->getField("archiveby")) && $thisPage->hasPermission("edit")) {
// if ($i!=0 && ($thisPage->getField("storyorder") == 'custom' || $thisPage->getField("storyorder") == '')) {
// $l[] = "<a href='$PHP_SELF?$sid$envvars&action=viewsite&reorder=story&direction=up&id=$s' class='small' title='Move this Content Block up'><b>↑</b></a>";
// }
// if ($i!=count($thisPage->stories)-1 && ($thisPage->getField("storyorder") == 'custom' || $thisPage->getField("storyorder") == '')) {
// $l[] = "<a href='$PHP_SELF?$sid$envvars&action=viewsite&reorder=story&direction=down&id=$s' class='small' title='Move this Content Block down'><b>↓</b></a>";
// }
}
if ($thisPage->hasPermission("edit") || $o->hasPermission("edit")) {
$l[] = "<a href='copy_parts.php?{$sid}&site={$site}&section={$section}&page={$page}&story={$s}&type=story' class='small' title='Move/Copy this Content Block to another page' onclick=\"doWindow('copy_parts','300','250')\" target='copy_parts'>move</a>";
}
}
if ($thisPage->hasPermission("edit") || $o->hasPermission("edit")) {
$l[] = "<a href='{$PHP_SELF}?{$sid}{$envvars}&action=edit_story&site={$site}&section={$section}&page={$page}&edit_story={$s}&comingFrom=viewsite" . ($story_set ? "&story_set=" . ($story_set + 1) : "") . "' class='small' title='Edit this Content Block'>edit</a>";
}
if ($thisPage->hasPermission("delete") || $o->hasPermission("delete")) {
$l[] = "<a href='javascript:doconfirm(\"Are you sure you want to delete this content?\",\"{$PHP_SELF}?{$sid}{$envvars}&site={$site}&section={$section}&page={$page}&action=delete_story&delete_story={$s}\")' class='small' title='Delete this Content Block'>delete</a>";
}
if ($thisPage->hasPermission("edit") || $o->hasPermission("edit")) {
$l[] = "<a href='index.php?{$sid}&action=viewsite&site={$site}&section={$section}&page={$page}&story=" . $s . "&versioning=" . $s . "' class='small' title='View the history of this content'>versions</a>";
}
}
printc(implode(" | ", $l));
}
printc("</div>");
}
示例4: fexplode
function fexplode(&$arr)
{
//Task 3
printf("\n\nTask Explode\n\n");
if (!isset($arr)) {
//must throw exception here
return;
}
$target = "I love ZaraLab";
$index = array_search($target, $arr);
if ($index !== false) {
//printf("format");
$temp = explode(" ", $arr[$index]);
$arr[$index] = $temp;
}
printc($arr);
}
示例5: _execute_db_update
function _execute_db_update($KG_Path, $KG_Thumb)
{
global $super_array;
global $database_table;
printc("Updating Database ...");
mysql_query("TRUNCATE TABLE {$database_table}");
$files = array();
if (is_dir($KG_Path)) {
if ($dh = opendir($KG_Path)) {
while (($file = readdir($dh)) !== false) {
if ($file != "." and $file != "..") {
$type = filetype("{$KG_Path}/" . $file);
if ($type == 'dir') {
_get_contents_indir($KG_Path, $KG_Thumb, $file);
}
}
}
closedir($dh);
}
}
//print_r($super_array);
_insert_to_sql($super_array);
printc("Updating Database Complete");
}
示例6: array_search
<?php
$search = 'I love ZaraLab';
$search_index = array_search($search, $array);
$new = explode(" ", $search);
$array[$search_index] = $new;
printc($array);
示例7: makedownloadbar
<?php
/* $Id$ */
include "output_modules/common.inc.php";
$t = makedownloadbar($o);
$st = convertTagsToInteralLinks($site, $t);
if ($o->getField("texttype") == 'text') {
$st = nl2br($st);
}
$wikiResolver =& WikiResolver::instance();
$st = $wikiResolver->parseText($st, $site, $section, $page);
printc($st);
if ($o->getField("discuss")) {
include dirname(__FILE__) . "/discussionLink.inc.php";
}
示例8: addOne
<?php
require_once './lib/functions.php';
$var = 10;
function addOne()
{
global $var;
$var++;
}
addOne();
$message = sprintf('Value of $var is %d', $var);
printc($message);
function addOneAlt()
{
$GLOBALS['var']++;
}
addOneAlt();
$message = sprintf('Value of $var is %d', $var);
printc($message);
示例9: printc
printc("</td></tr>\n");
}
/******************************************************************************
* print out title and options
******************************************************************************/
printc("<tr><td align='left'>");
printc("<a href='index.php?action=" . $action . "&" . $getinfo2 . "'>" . spchars($pageObj->getField('title')) . "</a>");
if ($storyObj->getField('title')) {
printc(" > " . spchars($storyObj->getField('title')));
}
if ($_REQUEST['oldversion'] && $_REQUEST['newversion']) {
printc(" > <a href='index.php?{$sid}&action=" . $action . "&site=" . $_REQUEST['site'] . "&section=" . $_REQUEST['section'] . "&page=" . $_REQUEST['page'] . "&story=" . $_REQUEST['story'] . "&versioning=" . $_REQUEST['story'] . "'>All Versions</a>");
printc(" > Selected Versions");
} else {
if ($_REQUEST['versioning']) {
printc(" > All Versions");
/******************************************************************************
* if particular version then get version details
******************************************************************************/
} else {
if ($_REQUEST['version']) {
printc(" > <a href='index.php?{$sid}&action=" . $action . "&site=" . $_REQUEST['site'] . "&section=" . $_REQUEST['section'] . "&page=" . $_REQUEST['page'] . "&story=" . $_REQUEST['story'] . "&versioning=" . $_REQUEST['story'] . "'>All Versions</a>");
printc(" > Revision " . $version_num);
} else {
printc(" > in depth");
}
}
}
printc("</td></tr>\n");
printc("</table>\n");
示例10: array_search
<?php
$search = "I love ZaraLab";
$key = array_search($search, $array);
$new = explode(' ', $search);
$array[$key] = $new;
printc('Taks Explode', $array);
示例11: printc
/******************************************************************************
* print out story content
******************************************************************************/
printc("<div class='story'>");
printc(stripslashes($st));
printc("</div>");
/******************************************************************************
* Append link to more and discussion
******************************************************************************/
if ($o->getField("discuss") || $o->getField("longertext")) {
if ($o->getField("longertext") && !ereg("^[\n\r]*<br />\$", $o->getField("longertext"))) {
if ($action == 'viewsite') {
$discussAction = 'viewsite';
} else {
if (ereg("preview_edit_as|preview_as", $action)) {
$discussAction = ereg_replace("preview_edit_as", "preview_as", $action);
} else {
$discussAction = 'site';
}
}
$link = "index.php?{$sid}&action=" . $discussAction . "&site={$site}&section={$section}&page={$page}&story=" . $o->id . "&detail=" . $o->id;
printc("<a href='" . $link . "'>" . " ...more</a>\n");
}
include dirname(__FILE__) . "/discussionLink.inc.php";
}
if ($tagged_section) {
$section = $source_section;
}
if ($tagged_page) {
$page = $source_page;
}
示例12: main
function main()
{
$options = getopt("hdsrp:", array('help', 'debug', 'silent', 'remove', 'path:'));
// Check if help requested
if (hasOption($options, 'h', 'help')) {
printc(HELP);
die;
}
if (!hasOption($options, 'p', 'path')) {
printc("Error: path required\n");
printc(HELP);
die;
}
$silent = hasOption($options, 's', 'silent');
$debug = hasOption($options, 'd', 'debug');
// Disable silent on debug
if ($debug) {
$silent = false;
}
$remove = hasOption($options, 'r', 'remove');
// Process path
$path = array_key_exists('p', $options) ? $options['p'] : $options['path'];
printc('Using path: ' . $path, $silent);
printc('Remove is: ' . ($remove ? 'on' : 'off'), $silent);
printc('Remove debug is: ' . ($debug ? 'on' : 'off'), $silent);
$path = realpath($path);
if ($path === NULL || !is_dir($path)) {
printc('Error: directory does not exists');
die;
}
// Add directory separator to path
$ds = DIRECTORY_SEPARATOR;
$path = rtrim($path, $ds) . $ds;
// Include Wordpress files
printc('Loading Wordpress', $silent);
define('BASE_PATH', $path);
define('WP_USE_THEMES', false);
// Require main wp loader
require_once $path . 'wp-load.php';
require_once $path . 'wp-admin' . $ds . 'includes' . $ds . 'image.php';
require_once $path . 'wp-admin' . $ds . 'includes' . $ds . 'file.php';
$regenerator = new Regenerator($remove, $debug, $silent);
$regenerator->run();
}
示例13: _output
function _output($cr, $o)
{
global $sid, $error, $showallauthors, $showposts, $uploadurl, $site_owner, $_full_uri;
$siteOwnerId = db_get_value("user", "user_id", "user_uname='" . addslashes($site_owner) . "'");
$parentAuthorId = db_get_value("discussion", "FK_author", "discussion_id='" . addslashes($this->parentid) . "'");
//print $siteOwnerId;
//printc("author=".$parentAuthorId);
$siteObj =& $this->storyObj->owningSiteObj;
$siteLevelEditors = $siteObj->getSiteLevelEditors();
$isSiteEditor = in_array($_SESSION[auser], $siteLevelEditors);
if ($showposts == 1 || ($_SESSION[auser] == $this->authoruname || $o == 1 || $isSiteEditor || $site_owner == $this->authoruname && $_SESSION[aid] == $parentAuthorId && $_SESSION[auser] || in_array($this->authoruname, $siteLevelEditors) && $_SESSION[aid] == $parentAuthorId && $_SESSION[auser])) {
// check to see if we have any info to commit
$this->_commithttpdata();
if ($_REQUEST['discuss'] == 'edit' && $_REQUEST['id'] == $this->id) {
$this->_outputform('edit');
return true;
}
if ($_REQUEST['discuss'] == 'del' && $_REQUEST['id'] == $this->id) {
$this->_del();
return true;
}
if ($_REQUEST['discuss'] == 'rate' && $_REQUEST['id'] == $this->id) {
$this->_outputform('rate');
return true;
}
//$script = $_SERVER['SCRIPT_NAME'];
/******************************************************************************
* Outputs html for displaying posts
* outputs discussion post info
******************************************************************************/
if (!$this->id) {
return false;
}
printc("\n<tr>");
$s = "<a href='" . $_full_uri . "/index.php?{$sid}&action=site&" . $this->getinfo . "&expand=" . $this->id . "' name='" . $this->id . "'>" . $this->subject . "</a>\n";
// printc ("</form>");
// $s = $this->subject;
//printpre($_SESSION);
$a = "";
if ($showallauthors == 1 || $_SESSION[auser] && ($o || $_SESSION[auser] == $this->authoruname || $site_owner == $this->authoruname && $_SESSION[aid] == $parentAuthorId)) {
if ($this->opt("showauthor")) {
$a .= "by <span class='subject'>" . $this->authorfname . "</span>\n";
}
if ($this->opt("showauthor") && $this->opt("showtstamp")) {
$a .= " on ";
}
} else {
$a .= "posted on ";
}
if ($this->opt("showtstamp")) {
$a .= timestamp2usdate($this->tstamp);
}
// Wiki-markup example
global $storyObj;
$a .= WikiResolver::getMarkupExample($storyObj->getField("title"), $this->id);
/******************************************************************************
* collect possible actions to current post (rely | del | edit | rate)
******************************************************************************/
$b = array();
if ($cfg['disable_discussion'] != TRUE && ($cfg['disable_discussion'] != TRUE && $_SESSION['ltype'] == 'admin')) {
if ($cr) {
$b[] = "<a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&replyto=" . $this->id . "&action=site&discuss=reply#reply'>reply</a>\n";
}
if ($o || $_SESSION[auser] == $this->authoruname && !$this->dbcount()) {
$b[] = "| <a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&action=site&discuss=del&id=" . $this->id . "'>delete</a>\n";
}
if ($_SESSION[auser] == $this->authoruname && !$this->dbcount()) {
$b[] = " | <a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&id=" . $this->id . "&action=site&discuss=edit#" . $this->id . "'>edit</a>\n";
}
if ($o) {
$ratelink = "<a href='" . $_full_uri . "/index.php?{$sid}" . $this->getinfo . "&id=" . $this->id . "&action=site&discuss=rate#" . $this->id . "'>rate</a>\n";
}
}
/******************************************************************************
* if there are dicussion actions (reply | del | edit | rate) then print
******************************************************************************/
if ($a != "" || count($b)) {
$c = '';
if (count($b)) {
$c .= implode(" ", $b);
}
/******************************************************************************
* discussion post header info (subject=$s, author and timestamp=$a, options=$c)
******************************************************************************/
//printc ("<table width='100%' cellspacing='0px'>\n");
printc("\n<td class='dheader3'>\n");
printc("<table width='100%' cellspacing='0px'>\n");
printc("<tr><td align='left'>\n");
printc("<span class='subject'>\n");
// subject
printc($s);
// rating
if ($this->rating !== NULL) {
printc(" (Rating: " . $this->rating . ")");
}
printc("</span></td>\n");
// link for rating
printc("<td align='right'>{$ratelink}</td>\n");
printc("</tr><tr>\n");
printc("<td>{$a}\n");
//.........這裏部分代碼省略.........
示例14: multiply10
<?php
require_once './lib/functions.php';
function multiply10($value)
{
$value = $value * 10;
return $value;
}
function multiply10ref(&$byReference)
{
$byReference = multiply10($byReference);
}
$value = 2;
$multiply = multiply10($value);
$message1 = sprintf('%d * 10 = %d', $value, $multiply);
$message2 = sprintf('$value after multiply is %d', $value);
printc($message1);
printc($message2);
multiply10ref($value);
$message3 = sprintf('$value after multiply by reference is %d', $value);
printc($message3);
示例15: handlearchive
function handlearchive($stories, $pa)
{
global $startday, $startmonth, $startyear, $endday, $endmonth, $endyear, $usestart, $useend, $months;
global $usesearch;
global $site, $section, $page;
$newstories = array();
if (!$usesearch) {
$endyear = date("Y");
$endmonth = date("n");
$endday = date("j");
}
printc("<div>");
// printc("<b>Search:</b> ");
printc("Display content in date rage: ");
printc("<form action='{$PHP_SELF}?{$sid}&action=site&site={$site}&section={$section}&page={$page}' method='post'>");
printc("<input type='hidden' name='usesearch' value='1' />");
printc("<select name='startday'>");
for ($i = 1; $i <= 31; $i++) {
printc("<option" . ($startday == $i ? " selected" : "") . ">{$i}\n");
}
printc("</select>\n");
printc("<select name='startmonth'>");
for ($i = 0; $i < 12; $i++) {
printc("<option value=" . ($i + 1) . ($startmonth == $i + 1 ? " selected" : "") . ">{$months[$i]}\n");
}
printc("</select>\n<select name='startyear'>");
$curryear = date("Y");
for ($i = $curryear - 10; $i <= $curryear; $i++) {
printc("<option" . ($startyear == $i ? " selected" : "") . ">{$i}\n");
}
printc("</select>");
// printc("<br />");
printc(" to <select name='endday'>");
for ($i = 1; $i <= 31; $i++) {
printc("<option" . ($endday == $i ? " selected" : "") . ">{$i}\n");
}
printc("</select>\n");
printc("<select name='endmonth'>");
for ($i = 0; $i < 12; $i++) {
printc("<option value=" . ($i + 1) . ($endmonth == $i + 1 ? " selected" : "") . ">{$months[$i]}\n");
}
printc("</select>\n<select name='endyear'>");
for ($i = $curryear; $i <= $curryear + 5; $i++) {
printc("<option" . ($endyear == $i ? " selected" : "") . ">{$i}\n");
}
printc("</select>");
printc(" <input type='submit' class='button' value='go' />");
printc("</form></div>");
$start = mktime(1, 1, 1, $startmonth, $startday, $startyear);
$end = mktime(1, 1, 1, $endmonth, $endday, $endyear);
if ($pa == 'week') {
if (!$usesearch) {
$start = mktime(0, 0, 0, date("n"), date('j') - 7, date('Y'));
$end = time();
}
}
if ($pa == 'month') {
if (!$usesearch) {
$start = mktime(0, 0, 0, date("n") - 1, date('j'), date("Y"));
$end = time();
}
}
if ($pa == 'year') {
if (!$usesearch) {
$start = mktime(0, 0, 0, date("n"), date('j'), date("Y") - 1);
$end = time();
}
}
$txtstart = date("n/j/y", $start);
$txtend = date("n/j/y", $end);
foreach ($stories as $s) {
$a = db_get_line("stories", "id='" . addslashes($s) . "'");
$added = $a[addedtimestamp];
ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $added, $regs);
$year = (int) $regs[1];
$month = (int) $regs[2];
$day = (int) $regs[3];
$t = mktime(0, 0, 0, $month, $day, $year);
// $week = date("W",$t-(date("w",$t)*86400));
//
// if ($startyear == $year && $startweek == $week)
// $newstories[] = $s;
// if ((!$usestart || $start < $t) && (!$useend || $t < $end)) {
if ($start < $t && $t < $end || false) {
$newstories[$s] = $t;
}
}
// print_r($newstories);
arsort($newstories, SORT_NUMERIC);
// print_r($newstories);
$newstories = array_keys($newstories);
printc("<b>Content ranging from {$txtstart} to {$txtend}.</b><br /><br />");
return $newstories;
}