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


PHP Loader::plugin方法代码示例

本文整理汇总了PHP中Loader::plugin方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::plugin方法的具体用法?PHP Loader::plugin怎么用?PHP Loader::plugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Loader的用法示例。


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

示例1: showManage

 /**
  * 内容列表,内容管理
  * @param $cid
  */
 public function showManage($cid)
 {
     $cid = intval($cid);
     $category = model('category')->where('cid', $cid)->getOne();
     $category['is_page'] = model('model')->where('modelid', $category['cat_modelid'])->getOne('is_page');
     $category['is_page'] = $category['is_page'][0];
     if ($category['is_page'] == 1) {
         header('Location:' . Router::$router->url('Content/page/edit', array('cid' => $cid)));
     } else {
         $page = isset($_GET['page']) ? $_GET['page'] : 1;
         if ($page < 1) {
             $page = 1;
         }
         $num = 10;
         //页面显示的结果数量
         $categoryDet = model($category['catetable'])->where('id', $category['catid'])->getOne('catname');
         $data['catname'] = $categoryDet['catname'];
         $count = model($category['contable'])->where('cid', $cid)->count();
         $pageO = Loader::plugin('page');
         $pageO->init($count, Router::$router->url('content/content/manage', array('page' => '%page%', 'cid' => $cid)), $page, $num);
         $pages = $pageO->p();
         $content = model($category['contable'])->where('cid', $cid)->orderby($category['contable'] . '.listorder desc')->limit($pages['min'], $num)->query();
         $data['cid'] = $cid;
         $data['content'] = model()->stripslashes($content);
         $data['pages'] = $pages['html'];
         $data['pageNum'] = $pages['pageNum'];
         view('Content/content_manage', $data);
     }
     //var_dump($category);
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:34,代码来源:contentModule.php

示例2: thumb

/**
 * 图片等比缩放,优先宽度
 * @param $imgUrl           图片地址
 * @param bool $width       宽度
 * @param bool $height      高度
 */
function thumb($imgUrl, $width = 'auto', $height = 'auto')
{
    if ($width == false && $height == false) {
        echo $imgUrl;
        return;
    } else {
        if ($width == 'auto' && $height == 'auto') {
            echo $imgUrl;
            return;
        }
        $img = Loader::plugin('image');
        $info = pathinfo($imgUrl);
        $dir = explode('/', $info['dirname']);
        $dir = $dir[3];
        $picPath = __ROOT__ . 'runtime/thumb/' . $dir . '/' . $info['filename'] . '/' . $width . 'X' . $height . '.png';
        $urlpath = '/runtime/thumb/' . $dir . '/' . $info['filename'] . '/' . $width . 'X' . $height . '.png';
        $info = pathinfo($picPath);
        if (!is_dir($info['dirname'])) {
            mkdir($info['dirname'], 0777, 1);
        }
        //var_dump($info);exit;
        if (file_exists($picPath)) {
            echo $urlpath;
            return;
        }
        $image = $img->CreateThumbnail(__ROOT__ . $imgUrl, $width == 'auto' ? false : $width, $height == 'auto' ? false : $height, $picPath);
        echo $urlpath;
    }
}
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:35,代码来源:gouwanmei.func.php

示例3: checkcode

 function checkcode()
 {
     $checkcode = Loader::plugin('checkcode');
     if (isset($_GET['code_len']) && intval($_GET['code_len'])) {
         $checkcode->code_len = intval($_GET['code_len']);
     }
     if ($checkcode->code_len > 8 || $checkcode->code_len < 2) {
         $checkcode->code_len = 4;
     }
     if (isset($_GET['font_size']) && intval($_GET['font_size'])) {
         $checkcode->font_size = intval($_GET['font_size']);
     }
     if (isset($_GET['width']) && intval($_GET['width'])) {
         $checkcode->width = intval($_GET['width']);
     }
     if ($checkcode->width <= 0) {
         $checkcode->width = 130;
     }
     if (isset($_GET['height']) && intval($_GET['height'])) {
         $checkcode->height = intval($_GET['height']);
     }
     if ($checkcode->height <= 0) {
         $checkcode->height = 50;
     }
     $max_width = $checkcode->code_len * 28;
     $max_height = $checkcode->font_size * 2;
     if ($checkcode->width > $max_width) {
         $checkcode->width = $max_width;
     }
     if ($checkcode->height > $max_height) {
         $checkcode->height = $max_height;
     }
     if (isset($_GET['font_color']) && trim(urldecode($_GET['font_color'])) && preg_match('/(^#[a-z0-9]{6}$)/im', trim(urldecode($_GET['font_color'])))) {
         $checkcode->font_color = trim(urldecode($_GET['font_color']));
     }
     if (isset($_GET['background']) && trim(urldecode($_GET['background'])) && preg_match('/(^#[a-z0-9]{6}$)/im', trim(urldecode($_GET['background'])))) {
         $checkcode->background = trim(urldecode($_GET['background']));
     }
     $checkcode->doimage();
     $_SESSION['code'] = $checkcode->get_code();
     exit;
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:42,代码来源:UseController.php

示例4: edit_profile

 /**
  * @param $user          要修改的用户信息
  * @param $userid        用户ID
  * @return bool OR int   状态或者错误码
  */
 public function edit_profile($user, $userid)
 {
     $user = $this->addslashes($user);
     $validate = Loader::plugin('validate');
     ######### 会删除掉无用的字段 ########
     foreach ($user as $field => $v) {
         if (!in_array($field, $this->allowField)) {
             unset($user[$field]);
         }
     }
     if (isset($user['nickername'])) {
         if (!$validate->check($user['nickername'], 'nickername')) {
             return 1;
         }
     }
     //昵称不合法
     if (isset($user['email'])) {
         if (!$validate->check($user['email'], 'email')) {
             return 2;
         }
     }
     //邮箱不合法
     if (isset($user['qq'])) {
         if (!$validate->check($user['qq'], 'qq')) {
             return 3;
         }
     }
     //qq号码不合法
     if (isset($user['mobile'])) {
         if (!$validate->check($user['mobile'], 'mobile')) {
             return 4;
         }
     }
     //手机号码不正确
     if ($this->where('userid', $userid)->update($user)) {
         return 0;
     } else {
         return -1;
     }
     return true;
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:46,代码来源:memberModel.php

示例5: attach

 /**
  * @param string $action
  * @param string $type
  * @param int $page
  */
 public function attach($action = 'manage', $type = 'all', $page = 1)
 {
     if ($action == 'manage') {
         $page = intval($page);
         $listNum = 10;
         //列表数量
         if ($type == 'all') {
             $atm = model('attaches');
         } elseif ($type == 'image') {
             $atm = model('attaches')->where('attachtype', 'image');
         } elseif ($type == 'file') {
             $atm = model('attaches')->where('attachtype', 'file');
         } elseif ($type == 'flash') {
             $atm = model('attaches')->where('attachtype', 'flash');
         } elseif ($type == 'media') {
             $atm = model('attaches')->where('attachtype', 'media');
         } else {
             $atm = model('attaches')->where('attachtype', 'image');
         }
         $select = array('admin.realname', 'admin.username', 'attaches.*');
         $atm->leftJoin('admin', 'admin.userid', 'attaches.userid')->select($select);
         $atm1 = clone $atm;
         //克隆模型
         $count = $atm->count();
         $pager = Loader::plugin('page');
         $pager->init($count, Router::$router->url('Content/attach/manage/' . $type . '/%page%'), $page, $listNum);
         $pres = $pager->p();
         $data = array();
         $data['attaches'] = $atm1->limit($pres['min'], $listNum)->query();
         $data['pager'] = $pres['html'];
         $this->assign($data);
         $this->display('Content/attach');
     } elseif ($action == 'del') {
         $status = array('status' => 'error', 'msg' => '您没有选择附件!');
         if (!isset($_POST['attacheid'])) {
             echo json_encode($status);
             exit;
         } else {
             $attacheid = explode(',', $_POST['attacheid']);
             $root = substr(__ROOT__, 0, strlen(__ROOT__) - 1);
             foreach ($attacheid as $id) {
                 if ($id != '') {
                     $id = intval($id);
                 } else {
                     continue;
                 }
                 $attach = model('attaches')->where('attachid', $id)->getOne('attachpath,attachname');
                 //var_dump($attach);
                 if (unlink($root . $attach['attachpath'])) {
                     if (model('attaches')->where('attachid', $id)->delete()) {
                         $status = array('status' => 'info', 'msg' => '附件' . $attach['attachname'] . '删除成功!');
                         //echo json_encode($status);exit;
                     } else {
                         $status = array('status' => 'error', 'msg' => '附件' . $attach['attachname'] . '数据库删除失败!');
                         echo json_encode($status);
                         exit;
                     }
                 } else {
                     $status = array('status' => 'error', 'msg' => '附件从磁盘中' . $attach['attachname'] . '删除失败!');
                     echo json_encode($status);
                     exit;
                 }
             }
             if (count($attacheid) > 1) {
                 $status['msg'] = '您选中的附件删除成功了!';
             }
             $path = __ROOT__ . Config::cms('upload_path');
             /**
              * 清除空文件夹
              * @param $path
              */
             function rm_empty_dir($path)
             {
                 if (is_dir($path) && ($handle = opendir($path)) !== false) {
                     while (($file = readdir($handle)) !== false) {
                         // 遍历文件夹
                         if ($file != '.' && $file != '..') {
                             $curfile = $path . '/' . $file;
                             // 当前目录
                             if (is_dir($curfile)) {
                                 // 目录
                                 rm_empty_dir($curfile);
                                 // 如果是目录则继续遍历
                                 if (count(scandir($curfile)) == 2) {
                                     // 目录为空,=2是因为. 和 ..存在
                                     rmdir($curfile);
                                     // 删除空目录
                                 }
                             }
                         }
                     }
                     closedir($handle);
                 }
             }
             rm_empty_dir($path);
//.........这里部分代码省略.........
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:101,代码来源:ContentController.php

示例6: ContentListByModel

 /**
  * 获取模型表下的内容
  * @param $mid
  * @param $num
  * @param int $page
  */
 public function ContentListByModel($mid, $num = 10, $page = 1, $reutrnpage = false)
 {
     //
     $table = model('category')->where('con_modelid', intval($mid))->getOne('contable');
     if (empty($table) || is_null($table['contable'])) {
         return array();
     }
     $table = $table['contable'];
     $count = model($table)->count();
     //获取内容总数量
     Loader::$load->template()->assign(array('resnum' => $count));
     $pageclass = Loader::plugin('cmspage');
     if (!isset($_GET)) {
         $_GET = array();
     }
     $_GET['page'] = '%page%';
     $action = Router::$router->routers['controller'] . '/' . Router::$router->routers['method'];
     if (Router::$router->routers['var'] != false) {
         $action .= '/' . implode('/', Router::$router->routers['var']);
     }
     $url = Router::$router->url($action, $_GET);
     $pageclass->init($count, $url, $page, $num);
     if ($reutrnpage != false) {
         if (method_exists($pageclass, $reutrnpage)) {
             $pageclass->{$reutrnpage}();
         }
     }
     $rpage = $pageclass->output();
     $min = $rpage['min'];
     Loader::$load->template()->assign(array('pages' => $rpage['html'], 'allpages' => $rpage['allpages']));
     $ncontent = array();
     $num = intval($num);
     $content = model($table)->orderBy($table . '.listorder ' . $this->ContentOrder)->limit("{$min},{$num}")->query();
     foreach ($content as $con) {
         $inputtime = $con['inputtime'];
         $updatetime = $con['updatetime'];
         $ncon = model('model_field')->parse($mid, $con);
         $ncon['cid'] = $con['cid'];
         $ncon['id'] = $con['id'];
         $ncon['url'] = $this->getContentUrl($con['cid'], $con['id']);
         $ncon['inputtime'] = $inputtime;
         $ncon['updatetime'] = $updatetime;
         unset($con);
         $ncontent[] = $ncon;
     }
     return $ncontent;
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:53,代码来源:contentModule.php

示例7: send_mail

/**
 * 发送邮件
 * @param $address      邮件地址 如果为数组,则为多个
 * @param $Subject      邮件主题
 * @param $body         内容
 * @param $is_html      是否为HTML
 */
function send_mail($address, $Subject, $body, $is_html = false)
{
    $Mailer = Loader::plugin('Mailer');
    $Mailer = $Mailer->init();
    if (is_array($address)) {
        foreach ($address as $adr) {
            $Mailer->addAddress($adr);
        }
    } else {
        $Mailer->addAddress($address);
    }
    $Mailer->isHTML($is_html);
    $Mailer->Subject = $Subject;
    $Mailer->Body = $body;
    return $Mailer->send();
}
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:23,代码来源:Base.func.php

示例8: manage

 public function manage($act = 'manage', $id = 0)
 {
     if ($act == 'manage') {
         $fid = isset($_GET['formid']) ? intval($_GET['formid']) : false;
         if (!$fid) {
             $var = array('error', '参数不完整,禁止非法进入!', '禁止非法进入。。。');
             controller('Admin', 'show_message', $var);
             exit;
         }
         $form = model('form')->where('formid', $fid)->getOne();
         $count = model('form_content')->where('fid', $fid)->count();
         //echo $count;
         $num = 10;
         //页面显示的结果数量
         $page = isset($_GET['page']) ? $_GET['page'] : 1;
         if ($page < 1) {
             $page = 1;
         }
         $pageO = Loader::plugin('page');
         $pageO->init($count, Router::$router->url('Form/manage', array('page' => '%page%', 'formid' => $fid)), $page, $num);
         $pages = $pageO->p();
         $content = model('form_content')->where('fid', $fid)->orderby('form_content.formid desc')->limit($pages['min'], $num)->query();
         //var_dump($content);
         $data['fid'] = $fid;
         $fcontent = array();
         foreach ($content as $value) {
             $formcon = unserialize($value['value']);
             $formcon['ip'] = $value['ip'];
             $formcon['id'] = $value['formid'];
             $formcon['time'] = date("Y-m-d H:i:s", $value['time']);
             $fcontent[] = $formcon;
         }
         $data['fcontent'] = $fcontent;
         $data['pages'] = $pages['html'];
         $data['pageNum'] = $pages['pageNum'];
         $formField = unserialize($form['formsetting']);
         $data['name'] = $form['formname'];
         $data['formField'] = $formField;
         view('Form/manage', $data);
     } elseif ($act == 'show') {
         $this->show($id);
     } elseif ($act == 'del') {
         $this->del();
     }
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:45,代码来源:FormController.php

示例9: do_pay

 /**
  * 创建支付流水号并去支付
  */
 public function do_pay($method = "", $order_id = '')
 {
     // 加载订单模型
     // 创建支付插件实例
     $payobj = Loader::plugin('payment.' . $this->payment['type'] . '.' . $this->payment['type']);
     $pay_vars = get_object_vars($payobj);
     // 创建支付实例
     if ($this->to_create()) {
         $html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n                \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n                <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-US\" lang=\"en-US\" dir=\"ltr\">\n                <head>\n</header><body><div>Redirecting...</div>";
         $payObj->_payment = $this->payment['payment'];
         $toSubmit = $payobj->toSubmit($this->get_payment_info($method));
         if ("utf8" != strtolower($payobj->charset)) {
             $toSubmit = array_iconv($toSubmit, CHARSET, $payobj->charset);
         }
         $html .= "<form id=\"payment\" action=\"" . $payobj->submitUrl . "\" method=\"" . $payobj->method . "\">";
         $buffer = '';
         foreach ($toSubmit as $k => $v) {
             if ($k != "ikey") {
                 $html .= "<input name=\"" . urldecode($k) . "\" type=\"hidden\" value=\"" . htmlspecialchars($v) . "\" />";
                 if ($v) {
                     $buffer .= urldecode($k) . "=" . $v . "&";
                 }
             }
         }
         if (strtoupper($this->payment['type']) == "TENPAYTRAD") {
             $buffer = substr($buffer, 0, strlen($buffer) - 1);
             $md5_sign = strtoupper(md5($buffer . "&key=" . $toSubmit['ikey']));
             $url = $payObj->submitUrl . "?" . $buffer . "&sign=" . $md5_sign;
             echo "<script language='javascript'>";
             echo "window.location.href='" . $url . "';";
             echo "</script>";
         }
         $html .= "\n</form>\n<script language=\"javascript\">\ndocument.getElementById('payment').submit();\n</script>\n</html>";
     } else {
         $html = "<html>\n<meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\"/>\n<script language=\"javascript\">\nalert('创建支付流水号错误!');\n//location.href=document.referrer;\n</script>\n</html>";
     }
     echo $html;
 }
开发者ID:hubs,项目名称:yuncms,代码行数:41,代码来源:payment_model.php


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