本文整理汇总了PHP中M类的典型用法代码示例。如果您正苦于以下问题:PHP M类的具体用法?PHP M怎么用?PHP M使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了M类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canEval
public static function canEval($sExtension)
{
if (M::PRODUCTION()) {
return in_array($sExtension, self::$_aEvaledExtensionsProd);
}
return in_array($sExtension, self::$_aEvaledExtensionsDev);
}
示例2: __construct
public function __construct($p1)
{
$this->prop = $p1;
echo "Inside instance " . __METHOD__ . "\n";
parent::__construct();
M::__construct();
// allowed
N::__construct();
// allowed
$clName = "M";
$clName::__construct();
// allowed
// "M"::__construct(); // not allowed
// can call instance and static methods using both -> and ::
$this->gi();
// $this explicitly used (and passed)
P::gi();
// $this implicitly used (and passed)
self::gi();
// $this implicitly used (and passed)
$this->gs();
// call to static method, so no $this passed
P::gs();
// call to static method, so no $this passed
self::gs();
// call to static method, so no $this passed
}
示例3: doExecApplier
public function doExecApplier()
{
$form = new MyQuickForm('applyform', 'POST', M_Office::URL());
$opts = M::tablesWithPlugin('tag');
$opts = array_combine($opts, $opts);
$form->addElement('select', 'table', 'Table', $opts);
$form->addElement('textarea', 'clause', 'clause', 'rows="4" cols="60"');
$form->addElement('text', 'tagname', 'tagname');
$form->addElement('text', 'tagdel', 'tagdel');
$form->addElement('checkbox', 'distinct', 'distinct');
$form->addElement('submit', '__submit__', 'Apply');
$form->addFormRule(array($this, 'checkApplier'));
if ($form->validate()) {
@set_time_limit(0);
ini_set('memory_limit', '1024M');
$values = $form->exportValues();
$t = DB_DataObject::factory($values['table']);
$query = 'SELECT ' . ($values['distinct'] ? 'DISTINCT ' : ' ') . $values['table'] . '.* FROM ' . $values['table'] . ' ' . $values['clause'];
$t->query($query);
while ($t->fetch()) {
if ($values['tagname']) {
$t->addTag($values['tagname']);
}
if ($values['tagdel']) {
$t->removeTag($values['tagdel']);
}
$applied++;
}
$this->assign('success', 1);
$this->assign('applied', $applied);
}
$this->assign('form', $form);
}
示例4: run
public function run()
{
$params = M::getRoot();
//组装参数
$params["scope"] = "sliderbar";
//指定定查询范围
//获取菜单数组
$navarr = FrontMenu::getChildMenu($params);
$this->render('navbar', array('nav' => $navarr));
}
示例5: conn
/**
* 连接数据库
*/
private function conn()
{
require dirname(__FILE__) . '/../config.php';
$db_name = $dbname;
$db_encode = 'utf8';
$this->prefix = 'weixin_';
$this->link = mysql_connect("{$host}:{$port}", $user, $pwd) or die('数据库服务器连接错误:' . mysql_error());
M::$wlink = $this->link;
mysql_select_db($db_name) or die('数据库连接错误:' . mysql_error());
mysql_query("set names '{$db_encode}'");
}
示例6: getQuotaInfo
/**
* Returns available diskspace information
*
* @return array
*/
public function getQuotaInfo()
{
$stats = M::stats();
return array(10000000000.0 - $stats['totalSize'], 10000000000.0);
/*
return array(
disk_total_space($this->path)-disk_free_space($this->path),
disk_free_space($this->path)
);
*/
}
示例7: setup
public function setup()
{
M_Office_Util::$mainOptions = PEAR::getStaticProperty('m_office', 'options');
M::addPaths('module', array(APP_ROOT . 'app/_shared/modules/', APP_ROOT . 'app/' . APP_NAME . '/modules/', 'M/Office/modules/'));
M::addPaths('template', array(OFFICE_TEMPLATES_FOLDER, APP_ROOT . 'app/_shared/templates/', APP_ROOT . 'app/' . APP_NAME . '/templates/'));
if (Config::getPref('theme')) {
M::addPaths('template', array(APP_ROOT . 'public/themes/' . Config::getPref('theme') . '/templates/'));
}
$tpl = new Mtpl(M::getPaths('template'));
$tpl->assign('jsdir', SITE_URL . 'js/');
Mreg::set('tpl', $tpl);
}
示例8: run
public function run()
{
//获取
$params = M::getRoot();
//组装参数
$params["scope"] = "sliderbar";
//指定定查询范围
//获取菜单数组
$navarr = FrontMenu::getChildMenu($params);
$service_arr = array('orders' => '订单管理', 'quos' => '查看报价单', 'returns' => '退货管理');
$dealer_arr = array('orders' => '订单管理', 'quos' => '管理报价单', 'returns' => '退货管理');
foreach ($navarr as $key => $val) {
if (Yii::app()->user->isServicer()) {
if ($val['name'] != '采购管理') {
unset($navarr[$key]);
continue;
}
foreach ($navarr[$key]['children'] as $k => $v) {
if ($v['name'] == $service_arr['orders']) {
$data['order'] = $v['name'];
} else {
if ($v['name'] == $service_arr['quos']) {
$data['quo'] = $v['name'];
} else {
if ($v['name'] == $service_arr['returns']) {
$data['return'] = $v['name'];
}
}
}
}
}
if (Yii::app()->user->isDealer()) {
if ($val['name'] != '销售管理') {
unset($navarr[$key]);
continue;
}
foreach ($navarr[$key]['children'] as $k => $v) {
if ($v['name'] == $dealer_arr['orders']) {
$data['order'] = $v['name'];
} else {
if ($v['name'] == $dealer_arr['quos']) {
$data['quo'] = $v['name'];
} else {
if ($v['name'] == $dealer_arr['returns']) {
$data['return'] = $v['name'];
}
}
}
}
}
}
$this->render('topnews', array('mesmenu' => $data));
}
示例9: writeinto
function writeinto($info)
{
$infoarr = json_decode($info, true);
$flag = new M('flag');
$count = $flag->find("openid='" . $infoarr['openid'] . "'", '*', 'count');
$sqlarr = array("nickname" => bin2hex($infoarr['nickname']), "avatar" => $infoarr['headimgurl'], "fakeid" => randStr(), "sex" => $infoarr['sex'], "fromtype" => 'weixin', "datetime" => time(), "flag" => "2");
if (isset($infoarr['shadyphone'])) {
$shady = new M('cj_shady');
$shadyarr = $shady->find("phone=" . $infoarr['shadyphone']);
if (empty($shadyarr)) {
$addarr = array('phone' => $infoarr['shadyphone'], 'shady' => $shadyarr['grade']);
$sqlarr = array_merge($sqlarr, $addarr);
}
}
if ($count) {
$savve = $flag->update("openid='" . $infoarr['openid'] . "'", $sqlarr);
}
if ($savve) {
echo "ok";
}
}
示例10: getData
static function getData($id)
{
PDOSql::$pdobj = pdoConnect();
$d = PDOSql::select("SELECT name, bg_image, subtitle FROM users WHERE id = ?", array($id));
if (count($d) > 0) {
$data['name'] = $d[0]['name'];
$data['bg_image'] = $d[0]['bg_image'];
$data['subtitle'] = $d[0]['subtitle'];
return M::cr(true, $data);
} else {
return M::cr(false, array('user' => array()), 'No se encontraron datos del usuario');
}
}
示例11: testItWorks
public function testItWorks()
{
$mock = M::mock('mindofmicah\\GoodReads\\Curl');
$mock->shouldReceive('fetchInfo')->once()->andReturn(file_get_contents(__DIR__ . '/stubs/shelves/list.txt'));
$response = Request::shelves('list', array('id' => 21308373), $mock);
$this->assertInstanceOf('mindofmicah\\GoodReads\\Response', $response);
$this->assertInstanceOf('mindofmicah\\GoodReads\\ResponseObj', $response->get('shelves'));
$this->assertEquals('shelf_list', $response->headers('method'));
$first_shelf = $response->get('shelves');
$this->assertInstanceOf('mindofmicah\\GoodReads\\ResponseObj', $first_shelf);
$first_child = current($first_shelf->child());
// print_r($first_child);
$this->assertEquals('user_shelf', $first_child[0]->getType());
$this->assertEquals(1, count($response->get('shelves')));
}
示例12: send_msgc
function send_msgc($msg, $isNotify = true)
{
global $db;
if (!is_array($msg)) {
return;
}
$uid = $sql = $mc_sql = array();
$userService = L::loadClass('UserService', 'user');
/* @var $userService PW_UserService */
foreach ($msg as $k => $v) {
$username = $userService->getUserNameByUserId($v[0]);
if (!$username) {
continue;
}
M::sendNotice(array($username), array('title' => $v[6], 'content' => $v[7]));
}
}
示例13: execute
public function execute($params)
{
$db = MDB2::factory(M::getDatabaseDSN());
$h = $db->dsn['hostspec'];
$u = $db->dsn['username'];
$p = $db->dsn['password'];
$dbn = $db->database_name;
$mysqlbin = '/usr/bin/env mysql';
$catbin = '/usr/bin/env cat';
$file = $this->baseFolder . 'src/tag.sql';
$sys = "{$catbin} {$file} | {$mysqlbin} --host={$h} --user={$u} --password={$p} {$dbn}";
system($sys, $return);
$this->line('Creating tables :');
$this->line('* tag');
$this->line('* tag_record');
$this->line('* tag_history');
}
示例14: sendMessage
/**
* 以某个用户的身份给另一个用户发送短消息
* @param int $userId 发送者uid
* @param string $receiver 接受者用户名
* @param string $subject 标题
* @param string $content 内容
* return bool
*/
function sendMessage($userId, $receiver, $subject, $content)
{
global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM;
$userService = $this->_getUserService();
$winddb = $userService->get($userId, true, true);
$winduid = $winddb['uid'];
$groupid = $winddb['groupid'];
$windid = $winddb['username'];
$groupid == '-1' && ($groupid = $winddb['memberid']);
if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) {
extract(pwCache::getData(S::escapePath(D_P . "data/groupdb/group_{$groupid}.php", false)));
} else {
extract(pwCache::getData(D_P . 'data/groupdb/group_1.php', false));
}
M::sendMessage($userId, array($receiver), array('create_uid' => $winduid, 'create_username' => $windid, 'title' => S::escapeChar(stripslashes($subject)), 'content' => S::escapeChar(stripslashes($content))));
return new ApiResponse(true);
}
示例15: run
public function run()
{
//获取是经销商还是服务店菜单
$params = M::getRoot();
//组装参数
$params["scope"] = "sliderbar";
//指定定查询范围
//获取菜单数组
$navarr = FrontMenu::getChildMenu($params);
foreach ($navarr as $key => $val) {
if ($val['name'] != '信息管理') {
unset($navarr[$key]);
continue;
}
}
$this->render('topNav', array('permenu' => $navarr));
}