コード例 #1
0
function logFileBasic($logEntry, $rowNumber)
{
    $logEntry = $rowNumber . ' - ' . $logEntry . "\n";
    $fileName = $_SERVER['DOCUMENT_ROOT'] . "/log.txt";
    file_put_contents($fileName, $logEntry, FILE_APPEND | LOCK_EX);
    pp($logEntry);
}
コード例 #2
0
ファイル: censusapp.php プロジェクト: escobar022/cens_wp
 /**
  * censusApp Constructor
  */
 public function __construct()
 {
     $this->registerPostType();
     add_action('add_meta_boxes', array($this, 'add_custom_meta_box'));
     add_action('save_post', array($this, 'save_custom_meta'));
     wp_register_script('wp_quiz_main_js', pp() . '/js/custom-js.js', array('jquery', 'jquery-ui-sortable'), null, true);
     wp_enqueue_script('wp_quiz_main_js');
 }
コード例 #3
0
 public function showAction()
 {
     $uid = (int) $_GET['uid'];
     $memeber = $this->model('member')->findByPrk($uid);
     pp($memeber);
     $this->model('member')->debug = true;
     $s = $this->model('member')->findField('username', array('uid' => $uid, 'username' => $memeber['username']));
     pp($s);
 }
function getFile()
{
    //$file = "data/Alchemy_Extract_final.csv";
    $file = "data/2016-02-04-Long_Names.csv";
    //$file = "data/a_testing.csv";
    $sr = serverRoot();
    //pp($sr.$file);
    if (file_exists($sr . $file) == 'true') {
        //pp($sr.$file);
        return $sr . $file;
    } else {
        pp('Source file ' . $sr . $file . ' does not exist');
    }
}
コード例 #5
0
ファイル: a.php プロジェクト: BLOODAXED/gw2_thing
function pp($arr)
{
    $retStr = '<ul>';
    if (is_array($arr)) {
        foreach ($arr as $key => $val) {
            if (is_array($val)) {
                $retStr .= '<li>' . $key . ' => ' . pp($val) . '</li>';
            } else {
                $retStr .= '<li>' . $key . ' => ' . $val . '</li>';
            }
        }
    }
    $retStr .= '</ul>';
    return $retStr;
}
コード例 #6
0
ファイル: UserAddressImport.php プロジェクト: saiber/livecart
 protected function getInstance($record, CsvImportProfile $profile)
 {
     pp('User address import get instance');
     $fields = $profile->getSortedFields();
     if (isset($fields['UserAddress']['ID'])) {
         $instance = ActiveRecordModel::getInstanceByID('UserAddress', $record[$fields['UserAddress']['ID']], true);
     } else {
         if (isset($fields['AddressUser']['ID'])) {
             $owner = User::getInstanceByID($record[$fields['AddressUser']['ID']], true);
         } else {
             if (isset($fields['AddressUser']['email'])) {
                 $owner = User::getInstanceByEmail($record[$fields['AddressUser']['email']]);
             }
         }
     }
     if (isset($owner)) {
         if ($profile->isColumnSet('AddressUser.isShipping')) {
             $type = $this->evalBool(strtolower($record[$profile->getColumnIndex('AddressUser.isShipping')])) ? 'ShippingAddress' : 'BillingAddress';
         } else {
             $type = 'BillingAddress';
         }
         $owner->loadAddresses();
     }
     if (empty($instance)) {
         if (empty($owner)) {
             return;
         }
         $isDefault = $profile->isColumnSet('AddressUser.isDefault') && $this->evalBool(strtolower($record[$profile->getColumnIndex('AddressUser.isDefault')]));
         if ($isDefault) {
             $field = 'default' . $type;
             $addressType = $owner->{$field}->get();
             $instance = $addressType->userAddress->get();
         }
         if (empty($addressType)) {
             $instance = UserAddress::getNewInstance();
             $addressType = call_user_func_array(array($type, 'getNewInstance'), array($owner, $instance));
             if ($isDefault) {
                 $owner->{$field}->set($addressType);
             }
         }
         $addressType->userAddress->set($instance);
         $instance->addressType = $addressType;
     }
     return $instance;
 }
コード例 #7
0
ファイル: Visitors.php プロジェクト: runekaagaard/snowscript
function pp($obj, $indent = 0)
{
    foreach ($obj as $k => $v) {
        $type = gettype($v);
        if (\snow_eq($type, "string") || \snow_eq($type, "integer") || \snow_eq($type, "NULL")) {
            echo sprintf("%s%s: %s\n", str_repeat(" ", $indent * 2), (string) $k, (string) $v);
        } elseif (\snow_eq($type, "boolean")) {
            echo sprintf("%s%s: %s\n", str_repeat(" ", $indent * 2), (string) $k, $v ? "true" : "false");
        } elseif (\snow_eq($type, "object")) {
            echo sprintf("%s%s - %s\n", str_repeat(" ", $indent * 2), $k, get_class($v));
            pp($v, $indent + 1);
        } elseif (\snow_eq($type, "array")) {
            echo sprintf("%s%s - %s\n", str_repeat(" ", $indent * 2), $k, "array");
            pp($v, $indent + 1);
        } else {
            var_dump($type);
            throw new Exception("Type not implemented: " . $type);
        }
    }
    unset($k, $v);
}
コード例 #8
0
ファイル: gestion_absences.php プロジェクト: rhertzog/lcs
		if ( $nom_photo === NULL or !file_exists($photos) ) {
			$photos = "../../mod_trombinoscopes/images/trombivide.jpg";
		}
		$valeur = redimensionne_image($photos);
    ?>
			<img src="<?php echo $photos; ?>" style="width: <?php echo $valeur[0]; ?>px; height: <?php echo $valeur[1]; ?>px; border: 0px" alt="" title="" />
	<?php
    } ?>
		</div>
		<div style="float: left; margin: 12.5px 0px 0px 0px; width: 36%">
			Nom : <strong><?php echo $nom_eleve; ?></strong><br />
			Prénom : <strong><?php echo $prenom_eleve; ?></strong><br />
			Date de naissance : <?php echo $naissance_eleve; ?><br />
			Age : <strong><?php echo age($date_de_naissance); ?> ans</strong><br />
			<br />
			Classe : <a href="#" class="info"><?php echo classe_de($login_eleve); ?><span style="width: 300px;">(Suivi par : <?php echo pp(classe_court_de($login_eleve)); ?>)</span></a>
		</div>
		<div style="float: left; background-image: url(../images/responsable.png); background-repeat:no-repeat; height: 175px; width: 20px; margin-left: 10px;">&nbsp;</div>
		<div style="float: left; margin: 12.5px; overflow: auto;  width: 40%;">
	<?php
		// L'affichage des responsables : le 1 est en rouge et est identifié comme tel
		$cpt_responsable = 0;
		while ( !empty($responsable_eleve[$cpt_responsable]) )
		{
			if ($responsable_eleve[$cpt_responsable]['resp_legal'] == 1) {
				$style = ' style="color: red;"';
				$text = '(resp. 1)';
			}else {
				if ($responsable_eleve[$cpt_responsable]['resp_legal'] == 2) {
					$style='';
					$text = '(resp. 2)';
コード例 #9
0
ファイル: FormBuilder.php プロジェクト: NukaCode/Foundation
 private function strpos_array($haystack, $needles, $offset = 0)
 {
     if (is_array($needles)) {
         pp($needles);
         foreach ($needles as $needle) {
             $pos = $this->strpos_array($haystack, $needle);
             if ($pos !== false) {
                 return $pos;
             }
         }
         return false;
     } else {
         return strpos($haystack, $needles, $offset);
     }
 }
コード例 #10
0
ファイル: exception_html.php プロジェクト: jonthornton/JMVC
		<?php 
}
?>
		
	</div>

	<div id="left">
		<h1><?php 
echo $ex->getMessage();
?>
</h1>
		<?php 
if ($ex->getLine() == 0) {
    ?>
			<div><?php 
    pp($ex->getFile());
    ?>
</div>
		<?php 
} else {
    ?>
			<div>Error on line <?php 
    echo $ex->getLine();
    ?>
 of <?php 
    echo $ex->getFile();
    ?>
</div>
		<?php 
}
?>
コード例 #11
0
ファイル: debug.php プロジェクト: NeoCortexBg/zf2-todo
function ppv($v)
{
    ob_start();
    var_dump($v);
    pp(ob_get_clean());
}
コード例 #12
0
ファイル: class.auth.php プロジェクト: saiber/www
 /**
  * check if the user has logged
  *
  * @return boolean
  */
 function isLoggedIn()
 {
     pp(111);
     return !empty($_SESSION[$this->__loginIndexInSession]) ? true : false;
 }
コード例 #13
0
ファイル: demo.php プロジェクト: alexxxnf/nf_pp
}
$a = new testClass();
$b = new emptyTestClass();
$res = fopen(__FILE__, 'r');
$val = array('string' => 'string', 'int' => 123, 'float' => 123.3, 'subarray' => array('a' => 'Lorem ipsum dolor sit amet, neptune reddens pater unica suae in fuerat construeret in fuerat accidens inquit merui litore. Opto cum magna aliter refundens domum sum in lucem exempli paupers coniunx in lucem exitum atque bona delata iuvenis. Eo debeas ait regem ut sua confusus eos, viam iube es ego esse ait est in. Musis nihilominus admonendus tu mihi quidditas. Tum vero rex ut diem obiecti ad te finis puellam effari ergo accipiet si. Vituperia ad suis caelo in rei exultant deo hanc! Taliarchum in fuerat est se sed, nuptui tradiditque corpus multis miraculum manibus dimittit in! Nuntiatur quae ait Cumque hoc ait regem consolatus dum veniens Theophilum vinum dolor Jesus Circumdat flante vestibus mundo anima. Lycoridem Apollonio vidit pater beneficiorum universos civitatem auri tecum ad suis ut libertatem accipies. Redde pariter necandum loco in deinde vero rex in modo. Acceptis codicello de his domino nostrud exercitu necessitate sit dolor ad per dicis ubi diu desideriis meo.', 'b' => 'Quattuordecim anulum in modo invenit', 'subsubarray' => array('Lorem ipsum dolor sit amet', 'deducitur potest meum festinus', 'pervenissem filia omnes deo', 'hanc nec caecatus dum animae')), 'false' => FALSE, 'true' => TRUE, 'null' => NULL, 'object' => $a, 'resource' => $res, 'emptyArray' => array(), 'emptyObject' => $b);
?>
<div style="overflow: hidden">
	<div style="width: 50%; float: left;"><h2>pp( $val )</h2><?php 
pp($val);
?>
</div>
	<div style="width: 50%; float: left;"><h2>print_r( $val ) + &lt;pre&gt;</h2><pre><?php 
print_r($val);
?>
</pre></div>
</div>
<h2 id="autoCollapsed">Folded array</h2>
<?php 
pp($val, TRUE);
?>
<h2 id="autoOpened">Array unfolded to keys "c" and "subarray"</h2>
<?php 
pp($val, array('autoOpen' => array('c', 'subarray')));
?>
<h2 id="autoOpened2">Array unfolded to key "c"</h2>
<?php 
pp($val, 'c');
fclose($res);
?>
</body>
</html>
コード例 #14
0
ファイル: 4-fib.php プロジェクト: kiltec/higherorder-php
<?php

require 'pp.php';
$fib = function ($n) use(&$fib) {
    switch ($n) {
        case 0:
            return 0;
        case 1:
            return 1;
        default:
            return $fib($n - 1) + $fib($n - 2);
    }
};
pp('fib', $fib(7));
$calls = 0;
$counted = function ($f) {
    return function ($f) use($f) {
        global $calls;
        $args = func_get_args();
        $calls++;
        return $f($args[0]);
    };
};
$fib = $counted($fib);
//$calls = 0;
//printf("%d called 'fib' %d times\n", $fib(30), $calls);
//$calls = 0;
//printf("%d called 'fib' %d times\n", $fib(31), $calls);
$memoize = function ($f, $normalize = null) {
    $results = array();
    if (!$normalize) {
コード例 #15
0
ファイル: init.php プロジェクト: jonthornton/JMVC
/**
 * Dump the contents of a variable and exit(). Similar to pp()
 * @param mixed $data
 * @return void
 */
function pd($data)
{
    if (!IS_PRODUCTION) {
        pp($data);
        die;
    }
}
コード例 #16
0
function pp($arr)
{
    $retStr = '<ul style="margin-left:5px; margin-right:0; padding-left:10px; padding-right:0;">';
    if (is_array($arr)) {
        foreach ($arr as $key => $val) {
            if (is_array($val)) {
                $retStr .= '<li>' . $key . ': ' . pp($val) . '</li>';
            } else {
                $retStr .= '<li>' . $key . ': ' . $val . '</li>';
            }
        }
    }
    $retStr .= '</ul>';
    return $retStr;
}
コード例 #17
0
ファイル: 11-functions-wip.php プロジェクト: nsimms/php-tuts
{
    return sprintf("Hello %s", $name);
}
echo sayHello();
?>
    <hr />
    <p>function to apply pre tags around print_r</p>
    <?php 
$idxfamily = array('nev', 'clare', 'freddy');
function pp($arr)
{
    echo "<pre>";
    print_r($arr);
    echo "</pre>";
}
pp($idxfamily);
?>
    <hr />
    <p>Array pluck </p>
    <?php 
$people = array(array('name' => 'nev', 'age' => '41', 'job' => 'web dev'), array('name' => 'clare', 'age' => '36', 'job' => 'events'), array('name' => 'fred', 'age' => '0', 'job' => 'being cute'));
function arrPluck($arr, $topluck = 'name')
{
    $out = array();
    foreach ($arr as $item) {
        array_push($out, $item[$topluck]);
    }
    return $out;
}
var_dump(arrPluck($people, 'name'));
?>
コード例 #18
0
 /**
  * Pretty Print Debug and Die
  *
  * <code>
  * dd( $something_to_pretty_print );
  * </code>
  *
  * @todo  Add localhost check.
  *
  * @param mixed $value Any value.
  */
 function dd($value)
 {
     pp($value);
     die;
 }
コード例 #19
0
ファイル: index.php プロジェクト: brianseitel/salem
function pd($array)
{
    pp($array);
    die;
}
コード例 #20
0
 /**
  * 数据库备份/还原列表
  * @param  String $type import-还原,export-备份
  * @author kevin <*****@*****.**>
  */
 public function index($type = null)
 {
     switch ($type) {
         /* 数据还原 */
         case 'import':
             //列出备份文件列表
             $path = C('DATA_BACKUP_PATH');
             if (!is_dir($path)) {
                 mkdir($path, 0755, true);
             }
             $path = realpath($path);
             $fileObj = \FilesystemIterator::KEY_AS_FILENAME;
             $glob = new \FilesystemIterator($path, $fileObj);
             $list = array();
             foreach ($glob as $name => $file) {
                 pp($name, $file);
                 //自定义封装的一个打印输出函数
                 if (preg_match('/^\\d{8,8}-\\d{6,6}-\\d+\\.sql(?:\\.gz)?$/', $name)) {
                     $name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
                     $date = "{$name[0]}-{$name[1]}-{$name[2]}";
                     $time = "{$name[3]}:{$name[4]}:{$name[5]}";
                     $part = $name[6];
                     if (isset($list["{$date} {$time}"])) {
                         $info = $list["{$date} {$time}"];
                         $info['part'] = max($info['part'], $part);
                         //获取文件大小
                         $info['size'] = $info['size'] + $file->getSize();
                     } else {
                         $info['part'] = $part;
                         //获取文件大小
                         $info['size'] = $file->getSize();
                     }
                     /**
                      * pathinfo(path,options)
                      * PATHINFO_DIRNAME - 只返回 dirname
                      * PATHINFO_BASENAME - 只返回 basename
                      * PATHINFO_EXTENSION - 只返回 extension
                      */
                     $extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION));
                     $info['compress'] = $extension === 'SQL' ? '-' : $extension;
                     $info['time'] = strtotime("{$date} {$time}");
                     $list["{$date} {$time}"] = $info;
                 }
             }
             $title = '数据还原';
             break;
             /* 数据备份 */
         /* 数据备份 */
         case 'export':
             $Db = Db::getInstance();
             $list = $Db->query('SHOW TABLE STATUS');
             $list = array_map('array_change_key_case', $list);
             $title = '数据备份';
             break;
         default:
             $this->error('参数错误!');
     }
     //渲染模板
     $this->assign('meta_title', $title);
     $this->assign('list', $list);
     $this->display($type);
 }
コード例 #21
0
ファイル: page_user.php プロジェクト: Eidn/shanghai
 function fenye($page, $order, $linkPage, $role, $username, $realname, $deleted = 0, $select = 0)
 {
     global $page_size, $departmentArr;
     $linkPage .= strpos($linkPage, "?") > 0 ? "&" : "?";
     //$self = $_SERVER["PHP_SELF"];
     $by = "order by ";
     switch ($order) {
         case 1:
             $by .= "time desc";
             break;
         case 2:
             $by .= "time";
             break;
         case 3:
             $by .= "department desc";
             break;
     }
     $where = "where deleted=" . $deleted;
     if ($role) {
         $where .= " and role=" . $role;
     }
     if ($username) {
         $where .= " and username like '%" . $username . "%'";
     }
     if ($realname) {
         $where .= " and realname like '%" . $realname . "%'";
     }
     $sql = "select * from `user` {$where}";
     $result = mysql_query($sql);
     $amount = mysql_num_rows($result);
     //表中的总纪录数
     if ($amount) {
         $page_total = ceil($amount / $page_size);
     } else {
         echo "没有记录";
         return null;
     }
     if ($page > $page_total) {
         $page = $page_total;
     }
     $page_start = ($page - 1) * $page_size;
     if ($select) {
         echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'></th>\n\t\t\t\t\t\t<th width='20%' align='center' class='th1'>用户名</th>\n\t\t\t\t\t\t<th width='20%' align='center' class='th1'>姓名</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>类别</th>\n\t\t\t\t\t\t<th width='15%' align='center' class='th1'>部门</th>\n\t\t\t\t\t\t<th width='25%' align='center' class='th1'>创建时间</th>\n\t\t\t\t\t</tr>";
     } else {
         echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>用户名</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>真实姓名</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>邮箱</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>部门</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>创建时间</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>操作</th>\n\t\t\t\t\t</tr>";
     }
     $res = mysql_query("select * from user {$where} {$by} limit {$page_start},{$page_size}");
     if ($deleted) {
         //只显示已删除的用户
         while ($arr = mysql_fetch_array($res)) {
             $realname = $arr["realname"] != "" ? $arr["realname"] : "未填写";
             echo "<tr><td><a href='course_for_user.php?id={$arr['id']}&title=" . $realname . "'>{$arr['username']}</a></td><td>{$realname}</td><td>{$arr['mail']}</td><td>" . ($arr["department"] ? $departmentArr[$arr["department"]] : "<span style='color:#999'>未选择</span>") . "</td><td>{$arr['time']}</td><td><a href='revertTodo.php?type=3&id={$arr['id']}'><img src='../img/document-revert.png' width='22' title='恢复' alt='恢复'></a> <a href='delete.php?type=103&id={$arr['id']}'><img src='../img/delete.png' title='彻底删除' alt='彻底删除'></a></td></tr>";
         }
     } else {
         //只显示未删除的用户
         if ($select) {
             //分页复选模式
             while ($arr = mysql_fetch_array($res)) {
                 $username = $arr["username"];
                 $realname = $arr["realname"] != "" ? $arr["realname"] : "未填写";
                 if ($arr["role"] == '1') {
                     $role = "管理员";
                 } else {
                     if ($arr["role"] == '2') {
                         $role = "教员";
                     } else {
                         if ($arr["role"] == '3') {
                             $role = "学员";
                         } else {
                             $role = "无身份";
                         }
                     }
                 }
                 switch ($arr["department"]) {
                     case 0:
                         $department = "暂无部门";
                         break;
                     case 1:
                         $department = "生产部";
                         break;
                     case 2:
                         $department = "测试部";
                         break;
                     case 3:
                         $department = "装机部";
                         break;
                     case 4:
                         $department = "试飞部";
                         break;
                     case 5:
                         $department = "维修部";
                         break;
                     default:
                         $department = "暂无部门";
                         break;
                 }
                 echo "<tr><td><input type='checkbox' value='" . $arr["id"] . "'>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>{$username}</td>\n\t\t\t\t\t\t<td>{$realname}</td>\n\t\t\t\t\t\t<td>{$role}</td>\n\t\t\t\t\t\t<td>{$department}</td>\n\t\t\t\t\t\t<td>{$arr['time']}</td>\n\t\t\t\t\t\t</tr>";
             }
         } else {
             //正常显示
             while ($arr = mysql_fetch_array($res)) {
                 $realname = $arr["realname"] != "" ? $arr["realname"] : "未填写";
                 echo "<tr><td><a href='course_for_user.php?id={$arr['id']}&title=" . $realname . "'>{$arr['username']}</a></td><td>{$realname}</td><td>{$arr['mail']}</td><td>" . ($arr["department"] ? $departmentArr[$arr["department"]] : "<span style='color:#999'>未选择</span>") . "</td><td>{$arr['time']}</td><td><a href='userAdd.php?id={$arr['id']}'><img src='../img/edit.png' title='编辑' alt='编辑'></a> <a href='delete.php?type=5&id={$arr['id']}'><img src='../img/delete.png' title='删除' alt='删除'></a></td></tr>";
             }
         }
     }
     echo "</table>";
     //显示[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
     function pp($a, $page, $page_total, $linkpage, $role)
     {
         global $page_size;
         for ($i = $page - $a; $i <= $page + $a; $i++) {
             if ($i > 0 && $i <= $page_total) {
                 if ($i == $page) {
                     echo " <font color='red'>[{$i}]</font> ";
                 } else {
                     echo " <a href='{$linkpage}" . "page={$i}&{$role}={$role}'>[{$i}]</a> ";
                 }
             }
         }
     }
     $page_up = $page - 1;
     $page_down = $page + 1;
     if ($page == 1) {
         $s = "首页 | 上一页 | ";
     } else {
         $s = "<a href='{$linkPage}" . "page=1&role={$role}'>首页</a> | \n\t\t\t\t<a href='{$linkPage}" . "page={$page_up}&role={$role}'>上一页</a> | ";
     }
     if ($page == $page_total) {
         $x = " | 下一页 | 尾页<br />";
     } else {
         $x = " | <a href='{$linkPage}" . "page={$page_down}&role={$role}'>下一页</a> | \n\t\t\t\t<a href='{$linkPage}" . "page={$page_total}&role={$role}'>尾页</a><br />";
     }
     echo "<p /><center>共 {$amount} 条记录,每页显示 {$page_size} 条<br />";
     echo $s;
     pp(5, $page, $page_total, "{$linkPage}", $role);
     echo $x;
     echo "转到第<input type='text' size=1 maxlength=7 value={$page} onchange='window.location=\"{$linkPage}" . "role={$role}&page=\"+this.value'>页&nbsp;&nbsp;<font color=blue>跳转</font>&nbsp;&nbsp;共 {$page_total} 页,当前第 {$page} 页";
 }
コード例 #22
0
<?php

/*
  +---------------------------------------+
  | Smallight OOP framework version 3.0.0 |
  +---------------------------------------+
  +---------------------------------------+
  | Author: Cosor Alexandru               |
  |---------------------------------------|
  | Email: alexandru.cosor@smallight.com  |
  +---------------------------------------+
*/
session_start();
//----- Include the libraries -----\\
require_once 'Smallight.lib.php';
//----- Define constants -----\\
define("DRIVER", 'mysql');
define("HOST", 'localhost');
define("DATA", 'smallight');
define("USER", 'root');
define("PASS", '');
//----- Initialize tables -----\\
$users = (new Smallight('users'))->all();
pp($users);
コード例 #23
0
ファイル: Output.php プロジェクト: im286er/madphp
 /**
  * 输出数组
  */
 public static function asArray($data, $return = false, $fromType = null)
 {
     $output = self::getInstance($data);
     $outputData = Format::factory($output->data, $fromType)->toArray();
     if (!$return) {
         pp($outputData, false);
     }
     return $outputData;
 }
コード例 #24
0
ファイル: sample.php プロジェクト: brianseitel/ook
function pd($a)
{
    pp($a);
    die;
}
コード例 #25
0
ファイル: page_course.php プロジェクト: Eidn/shanghai
 function fenye($page, $order, $linkPage, $userid, $keyword, $deleted = 0, $select = 0)
 {
     global $page_size;
     $linkPage .= strpos($linkPage, "?") > 0 ? "&" : "?";
     //$self = $_SERVER["PHP_SELF"];
     $by = "order by ";
     switch ($order) {
         case 1:
             $by .= "time desc";
             break;
         case 2:
             $by .= "time";
             break;
         case 3:
             $by .= "userid";
             break;
         case 4:
             $by .= "title";
             break;
         case 5:
             $by .= "type desc";
             break;
     }
     $where = "where deleted=" . $deleted;
     if ($keyword != "") {
         $where .= " and (title like '%" . $keyword . "%' or description like '%" . $keyword . "%')";
     }
     if ($userid) {
         $where .= " and userid=" . $userid;
     }
     $sql = "select * from course {$where}";
     //echo $sql;
     //die();
     $result = mysql_query($sql);
     //在course表中查询所有课程信息
     $amount = mysql_num_rows($result);
     //表中的总纪录数
     if ($amount) {
         $page_total = ceil($amount / $page_size);
     } else {
         echo "没有记录";
         return;
     }
     if ($page > $page_total) {
         $page = $page_total;
     }
     $page_start = ($page - 1) * $page_size;
     if ($select) {
         echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'></th>\n\t\t\t\t\t\t<th width='20%' align='center' class='th1'>课程名称</th>\n\t\t\t\t\t\t<th width='20%' align='center' class='th1'>课程类别</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>创建者</th>\n\t\t\t\t\t\t<th width='15%' align='center' class='th1'>课程开始时间</th>\n\t\t\t\t\t\t<th width='15%' align='center' class='th1'>课程结束时间</th>\n\t\t\t\t\t</tr>";
     } else {
         echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th width='20%' align='center' class='th1'>课程名称</th>\n\t\t\t\t\t\t\t<th width='10%' align='center' class='th1'>课程类别</th>\n\t\t\t\t\t\t\t<th width='10%' align='center' class='th1'>创建者</th>\n\t\t\t\t\t\t\t<th width='15%' align='center' class='th1'>创建时间</th>\n\t\t\t\t\t\t\t<th width='15%' align='center' class='th1'>课程开始时间</th>\n\t\t\t\t\t\t\t<th width='15%' align='center' class='th1'>课程结束时间</th>\n\t\t\t\t\t\t\t<th width='15%' align='center' class='th1'>操作</th>\n\t\t\t\t\t\t</tr>";
     }
     $res = mysql_query("select * from course {$where} {$by} limit {$page_start},{$page_size}");
     //在course表中查询符合条件的所有课程
     //输出课程
     if ($deleted) {
         //只显示已删除的课程
         while ($arr = mysql_fetch_array($res)) {
             $userinfo = getUserinfoById($arr["userid"]);
             $type = $arr["type"] ? "学习课程" : "参考课程";
             echo "<tr><td><a href='courseCategory_for_course.php?id={$arr['id']}&title={$arr['title']}'>" . $arr["title"] . "</a></td><td>{$type}</td><td><a href=''>" . $userinfo["realname"] . "</a></td><td>{$arr['time']}</td><td>{$arr['starttime']}</td><td>{$arr['endtime']}</td><td><a href='revertTodo.php?type=2&id={$arr['id']}'><img src='../img/document-revert.png' width='22' title='恢复' alt='恢复'></a> <a href='delete.php?type=102&id={$arr['id']}' title='彻底删除' alt='彻底删除'><img src='../img/delete.png'></a></td></tr>";
         }
     } else {
         //只显示未删除的课程
         if ($select) {
             //分页复选模式
             while ($arr = mysql_fetch_array($res)) {
                 $userinfo = getUserinfoById($arr["userid"]);
                 $type = $arr["type"] ? "学习课程" : "参考课程";
                 echo "<tr>\n\t\t\t\t\t\t<td><input type='checkbox' value='" . $arr["id"] . "'></td>\n\t\t\t\t\t\t<td>" . $arr["title"] . "</td>\n\t\t\t\t\t\t<td>{$type}</td>\n\t\t\t\t\t\t<td>" . $userinfo["realname"] . "</td>\n\t\t\t\t\t\t<td>" . $arr["starttime"] . "</td>\n\t\t\t\t\t\t<td>" . $arr["endtime"] . "</td>\n\t\t\t\t\t\t</tr>";
             }
         } else {
             //正常显示
             while ($arr = mysql_fetch_array($res)) {
                 $userinfo = getUserinfoById($arr["userid"]);
                 $type = $arr["type"] ? "学习课程" : "参考课程";
                 $title = urlencode($arr['title']);
                 echo "<tr><td><a href='courseCategory_for_course.php?id={$arr['id']}&title={$title}'>" . $arr["title"] . "</a></td><td>{$type}</td><td><a href=''>" . $userinfo["realname"] . "</a></td><td>{$arr['time']}</td><td>{$arr['starttime']}</td><td>{$arr['endtime']}</td><td><a href='javascript:;' onclick='copy(\"{$arr['id']}\")'><img src='../img/copy.png' width='22' title='复制' alt='复制'></a> <a href='courseAdd.php?id={$arr['id']}'><img src='../img/edit.png' title='编辑' alt='编辑'></a> <a href='delete.php?type=4&id={$arr['id']}' title='删除' alt='删除'><img src='../img/delete.png'></a></td></tr>";
             }
         }
     }
     echo "</table>";
     //显示[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
     function pp($a, $page, $page_total, $linkpage, $userid)
     {
         global $page_size, $keyword, $order;
         for ($i = $page - $a; $i <= $page + $a; $i++) {
             if ($i > 0 && $i <= $page_total) {
                 if ($i == $page) {
                     echo " <font color='red'>[{$i}]</font> ";
                 } else {
                     echo " <a href='{$linkpage}" . "page={$i}&userid={$userid}&k={$keyword}&order={$order}'>[{$i}]</a> ";
                 }
             }
         }
     }
     $page_up = $page - 1;
     $page_down = $page + 1;
     if ($page == 1) {
         $s = "首页 | 上一页 | ";
     } else {
         $s = "<a href='{$linkPage}" . "page=1&userid={$userid}&k={$keyword}&order={$order}'>首页</a> | \n\t\t\t\t<a href='{$linkPage}" . "page={$page_up}&userid={$userid}&k={$keyword}&order={$order}'>上一页</a> | ";
     }
     if ($page == $page_total) {
         $x = " | 下一页 | 尾页<br />";
     } else {
         $x = " | <a href='{$linkPage}" . "page={$page_down}&userid={$userid}&k={$keyword}&order={$order}'>下一页</a> | \n\t\t\t\t<a href='{$linkPage}" . "page={$page_total}&userid={$userid}&k={$keyword}&order={$order}'>尾页</a><br />";
     }
     echo "<p /><center>共 {$amount} 条记录,每页显示 {$page_size} 条<br />";
     echo $s;
     pp(5, $page, $page_total, "{$linkPage}", $userid);
     echo $x;
     echo "转到第<input type='text' size=1 maxlength=7 value={$page} onchange='window.location=\"{$linkPage}" . "userid={$userid}&k={$keyword}&order={$order}&page=\"+this.value'>页&nbsp;&nbsp;<font color=blue>跳转</font>&nbsp;&nbsp;共 {$page_total} 页,当前第 {$page} 页";
 }
コード例 #26
0
ファイル: fiche_eleve.php プロジェクト: rhertzog/lcs
		if ( getSettingValue("active_module_trombinoscopes")=='y' ) {
		$nom_photo = nom_photo($select_fiche_eleve_photo,"eleves",2);
	             $photos = $nom_photo;
	                // if (($nom_photo == "") or (!(file_exists($photos)))) { $photos = "../../mod_trombinoscopes/images/trombivide.jpg"; }
	                 if (($nom_photo==NULL) or (!(file_exists($photos)))) { $photos = "../../mod_trombinoscopes/images/trombivide.jpg"; }
			       $valeur=redimensionne_image($photos);
	                 ?><img src="<?php echo $photos; ?>" style="width: <?php echo $valeur[0]; ?>px; height: <?php echo $valeur[1]; ?>px; border: 0px" alt="" title="" /><?php
	             }
		?>
	</div>
	<div style="text-align: left; margin: 2px;">
		Nom : <?php echo $nom_eleve; ?><br />
		Prénom : <?php echo $prenom_eleve; ?><br />
		Date de naissance : <?php echo $naissance_eleve; ?><br />
		Age : <?php echo age($date_de_naissance); ?> ans <br /><br />
		Classe : <?php echo classe_de($login_eleve); ?> (Suivi par : <?php echo pp(classe_court_de($login_eleve)); ?>)
	</div>
</div>
<div class="couleur_ligne_3" style="width: 450px; margin: auto; border-bottom: 2px solid #2F4F4F; border-left: 2px solid #2F4F4F; border-right: 2px solid #2F4F4F; text-align: left;">
 	<div style="font-size: 130%; background: #555555; color: #FFFFFF;"><?php if ( !empty($responsable_eleve[1]) ) { ?>Les responsables<?php } else { ?>Le reponsable<?php } ?></div>
	<div style="margin: 5px;">
		<?php
			$cpt_responsable = 0;
			while ( !empty($responsable_eleve[$cpt_responsable]) )
			{
				echo $responsable_eleve[$cpt_responsable]['civilite'].' '.strtoupper($responsable_eleve[$cpt_responsable]['nom']).' '.ucfirst($responsable_eleve[$cpt_responsable]['prenom']).'<br />';
				$telephone = '';
					if ( !empty($responsable_eleve[$cpt_responsable]['tel_pers']) ) { $telephone = $telephone.'Tél. <strong>'.$responsable_eleve[$cpt_responsable]['tel_pers'].'</strong> '; }
					if ( !empty($responsable_eleve[$cpt_responsable]['tel_prof']) ) { $telephone = $telephone.'Prof. <strong>'.$responsable_eleve[$cpt_responsable]['tel_prof'].'</strong> '; }
					if ( !empty($responsable_eleve[$cpt_responsable]['tel_port']) ) { $telephone = $telephone.'Port. '.$responsable_eleve[$cpt_responsable]['tel_port'].'<img src="../images/attention.png" alt="Attention numéro surtaxé" title="Attention numéro surtaxé" border="0" height="13" width="13" />'; }
				echo $telephone;
コード例 #27
0
ファイル: page_courseUnit.php プロジェクト: Eidn/shanghai
 function fenye($page, $order, $linkPage, $userid, $keyword, $deleted = 0, $select = 0, $version = 0)
 {
     global $page_size;
     $linkPage .= strpos($linkPage, "?") > 0 ? "&" : "?";
     //$self = $_SERVER["PHP_SELF"];
     $by = "order by ";
     switch ($order) {
         case 1:
             $by .= "time desc";
             break;
         case 2:
             $by .= "time";
             break;
         case 3:
             $by .= "userid";
             break;
         case 4:
             $by .= "title";
             break;
     }
     $where = "where deleted=" . $deleted;
     if ($keyword != "") {
         $where .= " and (title like '%" . $keyword . "%' or description like '%" . $keyword . "%')";
     }
     if ($userid) {
         $where .= " and userid=" . $userid;
     }
     $sql = "select * from courseunit {$where}";
     //die($sql);
     $result = mysql_query($sql);
     $amount = mysql_num_rows($result);
     //表中的总纪录数
     if ($amount) {
         $page_total = ceil($amount / $page_size);
     } else {
         echo "没有记录";
         return;
     }
     if ($page > $page_total) {
         $page = $page_total;
     }
     $page_start = ($page - 1) * $page_size;
     if ($select) {
         echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>\n\t\t\t\t\t<tr>";
         if (!$version) {
             echo "<th width='10%' align='center' class='th1'></th>";
         }
         echo "<th width='40%' align='center' class='th1'>课程单元名称</th>\n\t\t\t\t\t<th width='10%' align='center' class='th1'>创建者</th>\n\t\t\t\t\t<th width='15%' align='center' class='th1'>创建时间</th>\n\t\t\t\t</tr>";
     } else {
         echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width='40%' align='center' class='th1'>课程单元名称</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>创建者</th>\n\t\t\t\t\t\t<th width='15%' align='center' class='th1'>创建时间</th>\n\t\t\t\t\t\t<th width='10%' align='center' class='th1'>操作</th>\n\t\t\t\t\t</tr>";
     }
     $res = mysql_query("select * from courseunit {$where} {$by} limit {$page_start},{$page_size}");
     if ($deleted) {
         //只显示已删除的课程单元
         while ($arr = mysql_fetch_array($res)) {
             //if($arr["lpid"]){
             //$title = "<a href='scormShow.php?id=$arr[lpid]' target='_blank'><img src='../img/scorm.png' width='25' title='Scorm'>".$arr["title"]."</a>";
             //}else{
             $title = "<a href='courseUnitShow.php?id={$arr['id']}'>" . $arr["title"] . "</a>";
             //}
             $userinfo = getUserinfoById($arr["userid"]);
             echo "<tr><td>{$title}</td><td><a href=''>" . $userinfo["realname"] . "</a></td><td>{$arr['time']}</td><td><a href='revertTodo.php?type=1&id={$arr['id']}'><img src='../img/document-revert.png' width='22' title='恢复' alt='恢复'></a> <a href='delete.php?type=101&id={$arr['id']}'><img src='../img/delete.png' title='彻底删除' alt='彻底删除'></a></td></tr>";
         }
     } else {
         //只显示未删除的课程单元
         if ($select) {
             //分页复选模式显示
             if ($version) {
                 //显示课程单元所有版本信息
                 $index = 0;
                 while ($arr = mysql_fetch_array($res)) {
                     $index++;
                     $title = "<a href='courseUnitShow.php?id={$arr['id']}' target='_blank'>" . $arr["title"] . "</a>";
                     $userinfo = getUserinfoById($arr["userid"]);
                     echo "<tr><td>" . $title . "<br>";
                     $res_courseunitversion_rel_attachment = mysql_query("select * from courseunitversion_rel_attachment where deleted=0 and courseunitid=" . $arr["id"]);
                     $i = 1;
                     $num = mysql_num_rows($res_courseunitversion_rel_attachment);
                     if ($num >= 1) {
                         while ($arr_courseunitversion_rel_attachment = mysql_fetch_array($res_courseunitversion_rel_attachment)) {
                             //$c = $i++==$num ? "checked" : "";
                             echo "<label><input class='subitem_check' type='checkbox' value='{$arr_courseunitversion_rel_attachment['id']}' name='v-{$arr['id']}' title='创建日期:{$arr_courseunitversion_rel_attachment['time']}'>{$arr_courseunitversion_rel_attachment['versionname']}</label> &nbsp;";
                         }
                     }
                     echo "</td><td><a href=''>" . $userinfo["realname"] . "</a></td><td>{$arr['time']}</td></tr>";
                 }
             } else {
                 //不显示课程单元所有版本信息
                 while ($arr = mysql_fetch_array($res)) {
                     $title = "<a href='courseUnitShow.php?id={$arr['id']}' target='_blank'>" . $arr["title"] . "</a>";
                     $userinfo = getUserinfoById($arr["userid"]);
                     echo "<tr><td><input type='checkbox' value='" . $arr["id"] . "'></td><td>{$title}</td><td><a href=''>" . $userinfo["realname"] . "</a></td><td>{$arr['time']}</td></tr>";
                 }
             }
         } else {
             //正常显示,即只显示课程单元列表
             while ($arr = mysql_fetch_array($res)) {
                 //if($arr["lpid"]){
                 //$title = "<a href='scormShow.php?id=$arr[lpid]' target='_blank'><img src='../img/scorm.png' width='25' title='Scorm'>".$arr["title"]."</a>";
                 //}else{
                 $title = "<a href='courseUnitShow.php?id={$arr['id']}'>" . $arr["title"] . "</a>";
                 //}
                 $userinfo = getUserinfoById($arr["userid"]);
                 echo "<tr><td>{$title}</td><td><a href=''>" . $userinfo["realname"] . "</a></td><td>{$arr['time']}</td><td><a href='courseUnitSetting.php?id={$arr['id']}&title={$arr['title']}'><img src='../img/edit.png' title='编辑' alt='编辑'></a> <a href='delete.php?type=3&id={$arr['id']}'><img src='../img/delete.png' title='删除' alt='删除'></a></td></tr>";
             }
         }
     }
     echo "</table>";
     //显示[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
     function pp($a, $page, $page_total, $linkpage, $userid)
     {
         global $page_size, $keyword, $order;
         for ($i = $page - $a; $i <= $page + $a; $i++) {
             if ($i > 0 && $i <= $page_total) {
                 if ($i == $page) {
                     echo " <font color='red'>[{$i}]</font> ";
                 } else {
                     echo " <a href='{$linkpage}" . "page={$i}&userid={$userid}&k={$keyword}&order={$order}'>[{$i}]</a> ";
                 }
             }
         }
     }
     $page_up = $page - 1;
     $page_down = $page + 1;
     if ($page == 1) {
         $s = "首页 | 上一页 | ";
     } else {
         $s = "<a href='{$linkPage}" . "page=1&userid={$userid}&k={$keyword}&order={$order}'>首页</a> | \n\t\t\t\t<a href='{$linkPage}" . "page={$page_up}&userid={$userid}&k={$keyword}&order={$order}'>上一页</a> | ";
     }
     if ($page == $page_total) {
         $x = " | 下一页 | 尾页<br />";
     } else {
         $x = " | <a href='{$linkPage}" . "page={$page_down}&userid={$userid}&k={$keyword}&order={$order}'>下一页</a> | \n\t\t\t\t<a href='{$linkPage}" . "page={$page_total}&userid={$userid}&k={$keyword}&order={$order}'>尾页</a><br />";
     }
     echo "<p /><center>共 {$amount} 条记录,每页显示 {$page_size} 条<br />";
     echo $s;
     pp(5, $page, $page_total, "{$linkPage}", $userid);
     echo $x;
     echo "转到第<input type='text' size=1 maxlength=7 value={$page} onchange='window.location=\"{$linkPage}" . "userid={$userid}&k={$keyword}&order={$order}&page=\"+this.value'>页&nbsp;&nbsp;<font color=blue>跳转</font>&nbsp;&nbsp;共 {$page_total} 页,当前第 {$page} 页";
 }
コード例 #28
0
ファイル: function3.php プロジェクト: awesomehans/testing
<?php

function say_hello($name = 'Buddy')
{
    //default is 'Buddy'
    return 'Hi, there ' . $name;
}
function pp($value)
{
    echo "<pre>";
    print_r($value);
    echo "</pre>";
}
function array_pluck($to_pluck, $arr)
{
    $new_array = array();
    foreach ($arr as $item) {
        $new_array[] = $item['age'];
    }
}
echo say_hello('Joe');
echo '<br>';
$arr = array('name' => 'Joe', 'age' => 40, 'occupation' => 'teacher');
echo "<pre>";
print_r($arr);
echo "</pre>";
pp($arr);
$people = array(array('name' => 'Joe', 'age' => 40, 'occupation' => 'teacher'), array('name' => 'Matt', 'age' => 34, 'occupation' => 'doctor'), array('name' => 'Dude', 'age' => 56, 'occupation' => 'janitor'));
array_pluck('name', $people);
//
コード例 #29
0
ファイル: example.php プロジェクト: devfake/rese
// Show $_SESSION with just created key/value:
echo '<h4>Session with new value:</h4>';
pp(session()->get());
// Get a session.
echo '<h4>Get a session by key:</h4>';
echo session('Stark')->get();
// Add nested session:
session('who.knows.nothing')->set('Jon Snow');
// Show $_SESSION with just created nested key/value:
echo '<h4>Add nested session:</h4>';
pp(session()->get());
// Remove key from nested session ('nothing' will be deleted):
session('who.knows.nothing')->remove();
// or session('who.knows.nothing')->delete();
// Show $_SESSION with without 'nothing':
echo '<h4>Show session with deleted key:</h4>';
pp(session()->get());
// Check if value exists:
echo '<h4>Check if "Stark" exists:</h4>';
pp(session('Stark')->exists());
// Compare two values:
echo '<h4>Compare if value from "Stark" is "A Lannister always pays his debts"</h4>';
if (session('Stark')->is('A Lannister always pays his debts')) {
    echo "yep";
} else {
    echo "nope";
}
?>

</body>
</html>
コード例 #30
0
ファイル: 3-injector.php プロジェクト: kiltec/higherorder-php
<?php

require 'pp.php';
require 'inject.php';
function arity($function)
{
    $r = new ReflectionObject($function);
    return $r->getMethod('__invoke')->getNumberOfParameters();
}
function with_list($f)
{
    $arity = arity($f);
    return function () use($f, $arity) {
        $args = func_get_args();
        if ($arity > 0 && count($args) != $arity - 1) {
            throw new BadFunctionCallException('Oops');
        }
        return function ($xs) use($f, $args) {
            return $f($args[0], $args[1], $xs);
        };
    };
}
$injector = with_list($inject);
$sum = $injector(0, function ($a, $b) {
    return $a + $b;
});
pp('sum', $sum(array(4, 1)));