protected function makeJModel($jMember, $name) { $j = new J(); $j->jMember = $jMember; $j->name = $name; $this->assertTrue($j->save()); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); SecurityTestHelper::createSuperAdmin(); $i = new I(); $i->iMember = 'iString1'; $i->name = 'd'; assert($i->save()); // Not Coding Standard $i = new I(); $i->iMember = 'xString1'; $i->name = 'e'; assert($i->save()); // Not Coding Standard $i = new I(); $i->iMember = 'yString1'; $i->name = 'f'; assert($i->save()); // Not Coding Standard $j = new J(); $j->jMember = 'jString1'; $j->name = 'a'; assert($j->save()); // Not Coding Standard $j = new J(); $j->jMember = 'xString1'; $j->name = 'b'; assert($j->save()); // Not Coding Standard $j = new J(); $j->jMember = 'yString1'; $j->name = 'c'; assert($j->save()); // Not Coding Standard $k = new K(); $k->kMember = 'kString1'; $k->name = 'g'; assert($k->save()); // Not Coding Standard $k = new K(); $k->kMember = 'xString1'; $k->name = 'i'; assert($k->save()); // Not Coding Standard $k = new K(); $k->kMember = 'yString1'; $k->name = 'h'; assert($k->save()); // Not Coding Standard }
public static function run() { $frontFilterClassName = APP_NAMESPACE . "\\FrontFilter"; $url = $frontFilterClassName::getUrl(); $module = J::strtoken($url, 2, "/"); $class = J::strtoken($url, 3, "/"); if ($class == "") { $class = "index"; } $className = APP_NAMESPACE . "\\" . str_replace("-", "", ucfirst($class)) . "Controller"; if (file_exists(APP_PATH . "/{$module}/services/{$class}.php")) { include APP_PATH . "/{$module}/services/{$class}.php"; } if (!J::strtoken($url, 4, "/")) { $method = strtolower($_SERVER["REQUEST_METHOD"]); } else { if (method_exists($className, J::strtoken($url, 4, "/"))) { $method = J::strtoken($url, 4, "/"); } else { $method = strtolower($_SERVER["REQUEST_METHOD"]); J::setParam("p1", J::strtoken($url, 4, "/")); } } if (file_exists(APP_PATH . "/{$module}/services/{$class}.php")) { if (method_exists($className, $method)) { $className::$method(); } else { J::setError(404, "Not Found"); } } else { J::setError(404, "Not Found"); } }
function ubb2html($content, $attach = 0, $type) { $content = preg_replace(array("/\\[div\\]/i", "/\\[\\/div\\]/i", "/\n|\r|\r\n/", "/\\[code\\](.+?)\\[\\/code\\]/i", "/\\[quote\\](.+?)\\[\\/quote\\]/i", "/\\[h3\\](.+?)\\[\\/h3\\]/i", "/\\[url=([^\\]]+?)\\](.+?)\\[\\/url\\]/i", "/\\[(b|i|u|kbd)\\](.+?)\\[\\/\\1\\]/i", "/\\[hr\\]/i", "/\\[img=([^\\]]+?)\\]/i"), array('<div>', '</div>', '<br>', '<pre>$1</pre>', '<blockquote>$1</blockquote>', '<h3>$1</h3>', '<a href="$1" target="_blank">$2</a>', '<$1>$2</$1>', '<hr>', '<img src="$1" width="600px">'), $content); if ($attach) { $resattachs = J::t('image')->fetch_all('id,path,thumbH', "aid={$attach} AND type='article'"); if ($resattachs) { $find = $replace = array(); foreach ($resattachs as $k => $v) { $find[] = "/\\[attach\\]" . $v['id'] . "\\[\\/attach\\]/i"; $width = $suff = ''; if ($v['thumbH']) { $width = 'width="600px"'; $suff = '.thumb.jpg'; } $imgurl = $_B['siteurl'] . $v['path'] . $suff; if ($type == 'update') { $replace[] = '<img src="' . $imgurl . '" ' . $width . '>'; } else { $replace[] = '<img src="' . IMGDIR . 'l.gif" class="lazy" data-original="' . $imgurl . '" ' . $width . '>'; } } $content = preg_replace($find, $replace, $content); } } //<img src="{IMGDIR}l.gif" class="lazy" data-original="{$imgids[$v['aid']]}"> return $content; }
function test() { D::D(); $X = "D"; $m = "D"; D::$m(); $X::$m(); $X::$m(); G::D(); J::D(); J::J(); $X = "G"; $m = "D"; G::$m(); $X::$m(); $X = "J"; $m = "D"; J::$m(); $X::$m(); $m = "J"; J::$m(); $X::$m(); }
<?php $a->B = new \C($b->D['E'], $c->F['G'], $d->H['I']) or \J::K('L');
if ($errorcode < 0) { $data = $upload->errormsg(); @unlink($file['target']); jsonOutput(2, $data); } //判断是否开启了exif,并获取照片的exif信息 $my_exif = array(); if (extension_loaded('exif') && extension_loaded('mbstring')) { $my_exif = exif_read_data($file['target'], "EXIF"); } $image = new class_image($file['target']); $image->exif = $my_exif; $status = $image->Thumb(); if ($status <= 0) { $data = $image->errormsg($status); @unlink($file['target']); jsonOutput(2, $data); } $insert = array('uid' => $_B['uid'], 'aid' => 0, 'path' => $file['imgurl'], 'type' => 'article', 'size' => $image->imginfo['size'], 'width' => $image->imginfo['width'], 'height' => $image->imginfo['height'], 'thumbH' => $image->imginfo['thumbH'], 'status' => 0, 'dateline' => TIMESTAMP); $aid = J::t('image')->insert($insert, true); if (!is_numeric($aid) || $aid <= 0) { @unlink($file['target']); jsonOutput(2, '上传失败 0071'); } $data['url'] = $_B['siteurl'] . $file['imgurl'] . '.thumb.jpg'; $data['aid'] = $aid; jsonOutput(1, $data); break; case 'view': case 'new': }
$group[$v['pid']][] = $v; } } foreach (multi_array_sort($pinfos, 'displayorder') as $k => $v) { $sortpinfos[$v['id']] = $v; } foreach ($group as $k => $v) { $sortpinfos[$k]['downnav'] = multi_array_sort($v, 'displayorder'); } J::t('setting')->replace('nav', $sortpinfos); jsonOutput($return); } exit; } else { if (empty($_B['setting']['nav'])) { $navinfos = J::t('nav')->fetch_all(); foreach ($navinfos as $k => $v) { if ($v['pid'] == 0) { $pinfos[$v['id']] = $v; } else { $group[$v['pid']][] = $v; } } foreach (multi_array_sort($pinfos, 'displayorder') as $k => $v) { $sortpinfos[$v['id']] = $v; } foreach ($group as $k => $v) { $sortpinfos[$k]['downnav'] = multi_array_sort($v, 'displayorder'); } $nav = $sortpinfos; } else {
jsonOutput(2, '不允许的操作'); } } elseif ($do == 'get') { if (!$_B['ajax']) { jsonOutput(2, '不允许的操作'); } if (!is_numeric($_B['page'])) { jsonOutput(2, '数据出错,请刷新重试'); } if (!is_numeric($_GET['aid']) || $_GET['aid'] <= 0) { jsonOutput(2, '数据出错,请刷新重试'); } $aid = $_GET['aid']; $comlimit = 30; $start = ($_B['page'] - 1) * $comlimit; $comlist = J::t('comment')->fetch_list('*', "classify='article' AND aid={$aid} AND `status`=1", $start, $comlimit); $next = ''; if ($comlist) { require_once libfile('article'); foreach ($comlist as $k => $v) { $comlist[$k]['formattime'] = btime($v['dateline'], 1); $comlist[$k]['time'] = btime($v['dateline']); $comlist[$k]['avatar'] = IMGDIR . 'jam.png'; $comlist[$k]['content'] = ubb2html($v['content']); } if (count($comlist) >= $comlimit) { $next = 'index.php?m=comment&do=get&aid=' . $aid . '&page=' . ($_B['page'] + 1); } } $data['content'] = display('_comment', 0, true, array('comlist' => $comlist)); $data['next'] = $next;
$limit = 5; $start = ($_B['page'] - 1) * $limit; if ($do == 'list') { $count = J::t('tag')->fetch_count(); $taginfo = J::t('tag')->fetch_all($start, $limit); $pagehtml = page($count, $_B['page'], $limit, 'admin.php?action=tag&do=list'); } elseif ($do == 'add') { if ($_B['ajax']) { $return['status'] = 1; $return['data'] = ''; $tagname = $_GET['tagname']; if (J::t('tag')->find_by_tagname($tagname)) { $return['status'] = 2; $return['data'] = '已存在该标签'; } else { $tagid = J::t('tag')->insert(array('tagname' => $tagname, 'dateline' => TIMESTAMP)); if ($tagid > 0) { $return['data'] = $tagid; } else { $return['status'] = 2; $return['data'] = '插入失败'; } } jsonOutput($return); } exit; } //$articles=J::t('article')->fetch_all($start,$limit); $menu_active[$action] = 'class="myactive"'; $side_active[$do] = 'class="myactive"'; include display('header', 1);
{ echo __CLASS__; } public static function lancerTest() { parent::callWhoIs(); } } class J extends I { public static function whoIs() { echo __CLASS__; } } J::lancerTest(); // Return J ?> </p> <h2>Exemple 5</h2> <p class="col-sm-12"> <?php // Exemple 5 class myParent { public function __construct() { static::whoIs(); }
class H extends \C\D\F { static function cdf(\K\L $object) { echo 'hello !'; } } } namespace I { use C\D\G as foo; $r = new \K\L(); foo\H::cdf($r); class J extends foo\H implements \O { } J::cdf($r); use C\D as cd, A\B; class Boo extends \K\L implements B\E { } } namespace K { use C\D\G as B; use I as M; use C\D\G\H as test; class Boo extends B\H { } class L { function boo(M\J &$j, array $k = array('a' => 'b'))
<?php $a['B'] = C::D('E'); $b['F'] = G::H('I'); if (J::K('L')) { $c['M'] = N::O('P'); } if (!empty($d->Q)) { $e['R'] = $f->S; } T::U($g->V()->W($h));
} } jsonOutput($status, $data); } if (!$_B['uid']) { shownotice('请先登录', array('referer' => $_B['referer'])); } $navtitle = $_B['setting']['blog']['blogName'] . ' - 写文章'; $defaultcontent = ''; break; case 'update': if ($_B['ajax'] && $_GET['type'] == 'update') { } $aid = $_GET['aid'] ?: 0; if (!$aid || !is_numeric($aid)) { shownotice('该文章不存在', array('referer' => $_B['referer'])); } $article = J::t('article')->find_by_pk($aid); if (!$article) { shownotice('该文章不存在', array('referer' => $_B['referer'])); } if ($_B['uid'] != $article['authorid'] || $article['status'] != 1 && !$_B['admin']) { shownotice('无权编辑该文章', array('referer' => $_B['referer'])); } $navtitle = '编辑文章 - ' . $article['subject']; $aidattach = $article['image'] ? $article['aid'] : 0; $defaultcontent = ubb2html($article['content'], $aidattach, 'update'); $do = 'new'; break; } include display('article_' . $do);
function __construct() { print "In K::__construct()\n"; } } C::__construct(); D::D(); E::E(); E::__construct(); F::__construct(); G::D(); H::E(); H::__construct(); I::__construct(); J::D(); J::J(); K::E(); K::K(); K::__construct(); $X = "C"; $m = "__construct"; C::$m(); $X::$m(); $X = "D"; $m = "D"; D::$m(); $X::$m(); $X::$m(); $X = "E"; $m = "E"; E::$m();
function getUser($uid) { static $users = array(); if (empty($users[$uid])) { $users[$uid] = J::t('users')->find_by_pk($uid); } return $users[$uid]; }
<?php B('C') or die; D::E('F'); ?> G<?php echo H::E(J::K()->L(), M, $b->N('O')); ?> P<?php if ($b->N('R')) { ?> S<?php if ($b->N('U') == 1) { echo V::W('X', Y($c->N('U'))); } else { echo V::W('X', Y($c->N('AG'))); } ?> AH<?php } ?> AI<?php echo V::E('AL'); ?> AM<?php echo $d; ?> AN<?php echo D::E('AQ'); ?> AR
$c->sMeth(); $c = new D(); $c->D(); $c = new E(); $c->E(); $c->__construct(); $c = new F(); $c->__construct(); $c = new G(); $c->D(); $c = new H(); $c->E(); $c->__construct(); $c = new I(); $c->__construct(); $c = new J(); $c->D(); $c->J(); $c = new K(); $c->E(); $c->K(); $c->__construct(); $c = new C(); $m = "__construct"; $c->{$m}(); $m = "sMeth"; $c->{$m}(); $c = new D(); $m = "D"; $c->{$m}(); $c = new E();
function __autoload($class) { //自动加载类(老版本) return jam::autoload($class); } } class DB extends blog_database { } class J extends jam { } J::creatapp(); DB::init($_B['config']['db']); //初始化用户 J::app()->init_web(); class jam { private static $_app; private static $_imports; private static $_tables; //数据表的类名(自动加载类文件,类文件名需要和类名相同) public static function app() { return self::$_app; } //实例化 application public static function creatapp() { if (!is_object(self::$_app)) { self::$_app = jam_application::instance();
private function _init_setting() { $cachepath = BLOG_ROOT . '/' . CACHEDIR . '/setting.txt'; if ($cache = cache($cachepath)) { $this->b['setting'] = $cache; } else { $setting = J::t('setting')->fetch_all(); foreach ($setting as $k => $v) { $this->b['setting'][$k] = json_decode($v['svalue'], true); } cache($cachepath, $this->b['setting']); } }
<?php namespace jumper; $dir = explode("/", str_replace("\\", "/", __DIR__)); $appPath = ""; for ($i = 0; $i < sizeof($dir) - 4; $i++) { $appPath .= $dir[$i] . "/"; } define("APP_PATH", $appPath . "src"); if (file_exists(APP_PATH . "/../vendor/autoload.php")) { include APP_PATH . "/../vendor/autoload.php"; } include __DIR__ . "/router.php"; if (file_exists(APP_PATH . "/../conf/conf.php")) { include APP_PATH . "/../conf/conf.php"; } if (file_exists(APP_PATH . "/../conf/frontFilter.php")) { include APP_PATH . "/../conf/frontFilter.php"; } include __DIR__ . "/adapter.php"; if (defined("APP_NAMESPACE")) { class_alias('\\jumper\\J', APP_NAMESPACE . '\\f'); } J::initialize(); Router::run(); J::execute();