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


PHP helper类代码示例

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


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

示例1: run

 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $helper = new helper();
     $values = array('description' => '', 'dateFrom' => '', 'dateTo' => '', 'allDay' => '');
     if (isset($_POST['save']) === true) {
         if (isset($_POST['allDay']) === true) {
             $allDay = 'true';
         } else {
             $allDay = 'false';
         }
         if (isset($_POST['dateFrom']) === true && isset($_POST['timeFrom']) === true) {
             $dateFrom = $helper->date2timestamp($_POST['dateFrom'], $_POST['timeFrom']);
         }
         if (isset($_POST['dateTo']) === true && isset($_POST['timeTo']) === true) {
             $dateTo = $helper->date2timestamp($_POST['dateTo'], $_POST['timeTo']);
         }
         $values = array('description' => $_POST['description'], 'dateFrom' => $dateFrom, 'dateTo' => $dateTo, 'allDay' => $allDay);
         if ($values['description'] !== '') {
             if ($helper->validateTime($_POST['timeFrom']) === true) {
                 $this->addEvent($values);
                 $msgKey = $tpl->setNotification('SAVE_SUCCESS', 'success');
             } else {
                 $tpl->setNotification('WRONG_TIME_FORMAT', 'error');
             }
         } else {
             $tpl->setNotification('NO_DESCRIPTION', 'error');
         }
         $tpl->assign('values', $values);
     }
     $tpl->assign('helper', $helper);
     $tpl->display('calendar.addEvent');
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:38,代码来源:class.addEvent.php

示例2: view

 /**
  * View an article.
  * 
  * @param int $articleID 
  * @param int $currentCategory 
  * @access public
  * @return void
  */
 public function view($articleID, $currentCategory = 0)
 {
     $article = $this->loadModel('article')->getByID($articleID);
     if (!$article) {
         die($this->fetch('error', 'index'));
     }
     if ($article->link) {
         helper::header301($article->link);
     }
     /* fetch category for display. */
     $category = array_slice($article->categories, 0, 1);
     $category = $category[0]->id;
     $currentCategory = $this->session->articleCategory;
     if ($currentCategory > 0 && isset($article->categories[$currentCategory])) {
         $category = $currentCategory;
     }
     $category = $this->loadModel('tree')->getByID($category);
     $title = $article->title . ' - ' . $category->name;
     $keywords = $article->keywords . ' ' . $category->keywords . ' ' . $this->config->site->keywords;
     $desc = strip_tags($article->summary);
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->article = $article;
     $this->view->prevAndNext = $this->loadModel('article')->getPrevAndNext($article->id, $category->id);
     $this->view->category = $category;
     $this->view->contact = $this->loadModel('company')->getContact();
     $this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($articleID)->exec(false);
     $this->display();
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:38,代码来源:control.php

示例3: browse

 /** 
  * Browse product in front.
  * 
  * @param int    $categoryID   the category id
  * @param int    $pageID       current page id
  * @access public
  * @return void
  */
 public function browse($categoryID = 0, $pageID = 1)
 {
     $category = $this->loadModel('tree')->getByID($categoryID, 'product');
     if ($category && $category->link) {
         helper::header301($category->link);
     }
     $this->app->loadClass('pager', $static = true);
     $pager = new pager(0, $this->config->product->recPerPage, $pageID);
     $categoryID = is_numeric($categoryID) ? $categoryID : $category->id;
     $products = $this->product->getList($this->tree->getFamily($categoryID), '`order` desc', $pager);
     if (!$category and $categoryID != 0) {
         die($this->fetch('error', 'index'));
     }
     if ($categoryID == 0) {
         $category = new stdclass();
         $category->id = 0;
         $category->name = $this->lang->product->home;
         $category->alias = '';
         $category->keywords = '';
         $category->desc = '';
     }
     $title = $category->name;
     $keywords = trim($category->keywords . ' ' . $this->config->site->keywords);
     $desc = strip_tags($category->desc) . ' ';
     $this->session->set('productCategory', $category->id);
     $this->view->title = $title;
     $this->view->keywords = $keywords;
     $this->view->desc = $desc;
     $this->view->category = $category;
     $this->view->products = $products;
     $this->view->pager = $pager;
     $this->view->contact = $this->loadModel('company')->getContact();
     $this->display();
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:42,代码来源:control.php

示例4: browse

 /**
  * Browse surveys.
  *
  * @param  string   $status
  * @access public
  * @return void
  */
 public function browse($status = 'installed')
 {
     $packages = $this->survey->getLocalPackages($status);
     $versions = array();
     if ($packages and $status == 'installed') {
         /* Get latest release from remote. */
         $extCodes = helper::safe64Encode(join(',', array_keys($packages)));
         $results = $this->survey->getPackagesByAPI('bycode', $extCodes, $recTotal = 0, $recPerPage = 1000, $pageID = 1);
         if (isset($results->extensions)) {
             $remoteReleases = $results->extensions;
             foreach ($remoteReleases as $release) {
                 if (!isset($packages[$release->code])) {
                     continue;
                 }
                 $package = $packages[$release->code];
                 $package->viewLink = $release->viewLink;
                 if (isset($release->latestRelease) and $package->version != $release->latestRelease->releaseVersion and $this->package->checkVersion($release->latestRelease->chanzhiCompatible)) {
                     $upgradeLink = inlink('upgrade', "package={$release->code}&downLink=" . helper::safe64Encode($release->latestRelease->downLink) . "&md5={$release->latestRelease->md5}&type={$release->type}");
                     $upgradeLink = ($release->latestRelease->charge or !$release->latestRelease->public) ? $release->latestRelease->downLink : $upgradeLink;
                     $package->upgradeLink = $upgradeLink;
                 }
             }
         }
     }
     $this->view->title = $this->lang->survey->browse;
     $this->view->position[] = $this->lang->survey->browse;
     $this->view->tab = $status;
     $this->view->packages = $packages;
     $this->view->versions = $versions;
     $this->view->status = $status;
     $this->display();
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:39,代码来源:control.php

示例5: index

 /**
  * The error page.
  * 
  * @access public
  * @return void
  */
 public function index($type, $locate = '')
 {
     $this->view->title = $this->lang->error->common;
     $this->view->message = isset($this->lang->error->typeList[$type]) ? $this->lang->error->typeList[$type] : $this->lang->error->typeList['notFound'];
     $this->view->locate = helper::safe64Decode($locate);
     $this->display();
 }
开发者ID:leowh,项目名称:colla,代码行数:13,代码来源:control.php

示例6: getEfforts

 /**
  * Get efforts. 
  * 
  * @param  string $account 
  * @param  int    $date 
  * @param  string $project 
  * @access public
  * @return void
  */
 public function getEfforts($account = 'all', $date, $project = '', $begin = '', $end = '')
 {
     $this->loadModel('todo');
     $efforts = array();
     if ($date == 'today') {
         $begin = $this->todo->today();
         $end = $begin;
     } elseif ($date == 'thisweek') {
         extract($this->todo->getThisWeek());
     } elseif ($date == 'lastweek') {
         extract($this->todo->getLastWeek());
     } elseif ($date == 'thismonth') {
         extract($this->todo->getThisMonth());
     } elseif ($date == 'lastmonth') {
         extract($this->todo->getLastMonth());
     } elseif ($date == 'select') {
         if ($begin == '') {
             $begin = helper::today();
         }
         if ($end == '') {
             $end = helper::today();
         }
     } elseif ($date == 'all') {
         $begin = '1970-01-01';
         $end = '2109-01-01';
     } else {
         $begin = $end = $date;
     }
     $efforts = $this->dao->select('*')->from(TABLE_SUNEFFORTEVERYDAY)->where('account')->eq($this->app->user->account)->andWhere("date >= '{$begin}'")->andWhere("date <= '{$end}'")->beginIF($project != '')->andWhere('project')->eq($project)->fi()->beginIF($account != 'all')->andWhere('account')->eq($account)->fi()->fetchAll('id');
     return $efforts;
 }
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:40,代码来源:user.php

示例7: add

 public function add($userId, $reason = "")
 {
     $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
     $currentTime = time();
     $ip_addr = helper::ip_addr();
     $u_agent = helper::u_agent();
     $stmt = $this->db->prepare("INSERT INTO profile_blacklist (blockedByUserId, blockedUserId, reason, createAt, ip_addr, u_agent) value (:blockedByUserId, :blockedUserId, :reason, :createAt, :ip_addr, :u_agent)");
     $stmt->bindParam(":blockedByUserId", $this->requestFrom, PDO::PARAM_INT);
     $stmt->bindParam(":blockedUserId", $userId, PDO::PARAM_INT);
     $stmt->bindParam(":reason", $reason, PDO::PARAM_STR);
     $stmt->bindParam(":createAt", $currentTime, PDO::PARAM_INT);
     $stmt->bindParam(":ip_addr", $ip_addr, PDO::PARAM_STR);
     $stmt->bindParam(":u_agent", $u_agent, PDO::PARAM_STR);
     if ($stmt->execute()) {
         $result = array("error" => false, "error_code" => ERROR_SUCCESS);
         $my_profile = new profile($this->db, $this->requestFrom);
         if ($my_profile->is_friend_exists($userId)) {
             $friends = new friends($this->db, $this->requestFrom);
             $friends->remove($userId);
             unset($friends);
         } else {
             if ($my_profile->is_follower_exists($userId)) {
                 // Unfollow
                 $my_profile->addFollower($userId);
             }
             $profile = new profile($this->db, $userId);
             if ($profile->is_follower_exists($this->requestFrom)) {
                 $profile->addFollower($this->requestFrom);
             }
             unset($profile);
         }
         unset($my_profile);
     }
     return $result;
 }
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:35,代码来源:class.blacklist.inc.php

示例8: m__set_level

function m__set_level()
{
    global $dbm;
    $_POST = helper::sqlxss($_POST);
    $aid = isset($_POST['aid']) ? intval($_POST['aid']) : 0;
    $gid = isset($_POST['gid']) ? intval($_POST['gid']) : 0;
    $_POST['level'] = isset($_POST['level']) ? $_POST['level'] : array();
    if ($aid < 0 && $gid < 0) {
        die('{"code":"1","msg":"请选择权限设置对象,无法设置"}');
    }
    if ($gid > 0) {
        if ($gid == 1) {
            die('{"code":"100","msg":"超级管理组权限无需设置"}');
        }
        check_level("B0301");
        $fields['g_urank'] = implode(',', $_POST['level']);
        $rs = $dbm->single_update(TB_PREFIX . 'admin_group', $fields, "group_id='{$gid}'");
        logs("设置组权限成功:" . $fields['g_urank']);
        die('{"code":"0","msg":"设置用户组权限成功"}');
    }
    if ($aid > 0) {
        check_level("B0302");
        //die(print_r($_POST));
        $fields['alevel'] = implode(',', $_POST['level']);
        $rs = $dbm->single_update(TB_PREFIX . 'admin_list', $fields, "admin_id='{$aid}'");
        logs("设置组权限成功:" . $fields['alevel']);
        die('{"code":"0","msg":"设置用户权限成功"}');
    }
}
开发者ID:cranefly,项目名称:crane,代码行数:29,代码来源:level.php

示例9: __construct

 public function __construct()
 {
     global $table;
     $this->table = $table;
     $this->cdb = helper::getDB('phpcms');
     $this->wdb = helper::getDB('cmsware');
 }
开发者ID:lestatmq,项目名称:cms,代码行数:7,代码来源:base.php

示例10: m__edit

function m__edit()
{
    global $l_obj, $t_obj;
    check_level("H0701");
    $post = $_POST;
    //处理数据隐藏安全
    foreach ($post as $k => $n) {
        $post[$k] = urldecode(helper::escape($n));
    }
    //验证数据合法性
    if (!is_numeric($post['keyword_id'])) {
        die('{"code":"100","msg":"标签ID必须是数字"}');
    }
    if (empty($post['keyword'])) {
        die('{"code":"100","msg":"标签不能为空"}');
    }
    if ($post['keyword_id'] > 0) {
        // 编辑
        $res = $t_obj->update($post, $post['keyword_id']);
        if ($res['state'] == 0) {
            $l_obj->insert("编辑成功:" . $post['keyword']);
            die('{"code":"0","msg":"编辑成功","kid":"' . $post['keyword_id'] . '"}');
        }
        die('{"code":"240","msg":"编辑失败"}');
    } else {
        // 添加
        $res = $t_obj->insert($post);
        if ($res['state'] == 0) {
            $l_obj->insert("添加成功:" . $post['keyword']);
            die('{"code":"0","msg":"添加成功","kid":"' . $res['msg'] . '"}');
        }
        die('{"code":"100","msg":"添加失败,"' . $res['msg'] . '}');
    }
}
开发者ID:cranefly,项目名称:crane,代码行数:34,代码来源:tags.php

示例11: m__list

function m__list()
{
    //判断操作权限
    check_level("E08");
    global $dbm, $resource_list;
    // 查询 mcms_resource_list 表
    $params['where'] = " 1=1";
    $params['table_name'] = TB_PREFIX . "resource_list";
    $params['count'] = 1;
    $params['suffix'] = " order by id DESC ";
    $params['pagesize'] = PAGESIZE;
    $params['suffix'] .= $dbm->get_limit_sql(PAGESIZE, $_GET['p']);
    $resource_list = $dbm->single_query($params);
    //开始循环 进行比对数据 找出关联的资源
    $i = 0;
    //数组排序时用到
    foreach ($resource_list['list'] as $k => $v) {
        //调用函数对数据进行比对
        $result = check_resource($v['id'], $v['info_id'], $v['resource_url']);
        //添加排序元素
        if ($result['info']['table_name'] == 'undefined' && 'undefined' == $result['info']['qita']) {
            $resource_list['list'][$k]['paixu'] = ++$i;
        } else {
            $resource_list['list'][$k]['paixu'] = 0;
        }
        $resource_list['list'][$k]['info'] = $result['info'];
    }
    $resource_list['list'] = helper::array_sort($resource_list['list'], 'paixu', 'desc');
    //将无效资源排在前面
    //print_r($resource_list);exit;
}
开发者ID:cranefly,项目名称:crane,代码行数:31,代码来源:resource.php

示例12: obtain

 /**
  * Obtain web app. 
  * 
  * @param  string $type 
  * @param  string $param 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function obtain($type = 'byUpdatedTime', $param = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     $this->lang->webapp->menu = $this->lang->entry->menu;
     $this->lang->menuGroups->webapp = 'entry';
     /* Init vars. */
     $type = strtolower($type);
     $moduleID = $type == 'bymodule' ? (int) $param : 0;
     $webapps = array();
     $pager = null;
     /* Set the key. */
     if ($type == 'bysearch') {
         $param = helper::safe64Encode($this->post->key);
     }
     /* Get results from the api. */
     $recPerPage = $this->cookie->pagerWebappObtain ? $this->cookie->pagerWebappObtain : $recPerPage;
     $results = $this->webapp->getAppsByAPI($type, $param, $recTotal, $recPerPage, $pageID);
     if ($results) {
         $this->app->loadClass('pager', $static = true);
         $pager = new pager($results->dbPager->recTotal, $results->dbPager->recPerPage, $results->dbPager->pageID);
         $webapps = $results->webapps;
     }
     $this->view->title = $this->lang->webapp->common . $this->lang->colon . $this->lang->webapp->obtain;
     $this->view->position[] = $this->lang->webapp->obtain;
     $this->view->moduleTree = $this->webapp->getModulesByAPI();
     $this->view->webapps = $webapps;
     $this->view->installeds = $this->webapp->getLocalApps();
     $this->view->pager = $pager;
     $this->view->tab = 'obtain';
     $this->view->type = $type;
     $this->view->moduleID = $moduleID;
     $this->display();
 }
开发者ID:leowh,项目名称:colla,代码行数:43,代码来源:control.php

示例13: notify

 /**
  * show notify in msgBox.
  * 
  * @access public
  * @return string
  */
 public function notify()
 {
     $messages = $this->dao->select('COUNT(*) as count')->from(TABLE_MESSAGE)->where('`to`')->eq($this->app->user->account)->andWhere('readed')->eq(0)->fetch('count');
     if ($messages) {
         echo html::a(helper::createLink('user', 'message'), sprintf($this->lang->user->message->mine, $messages));
     }
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:13,代码来源:control.php

示例14: request

 /**
  * Request the api.
  * 
  * @param  string $moduleName 
  * @param  string $methodName 
  * @param  string $action 
  * @access public
  * @return void
  */
 public function request($moduleName, $methodName, $action)
 {
     $host = common::getSysURL() . $this->config->webRoot;
     $param = '';
     if ($action == 'extendModel') {
         if (!isset($_POST['noparam'])) {
             foreach ($_POST as $key => $value) {
                 $param .= ',' . $key . '=' . $value;
             }
             $param = ltrim($param, ',');
         }
         $url = rtrim($host, '/') . inlink('getModel', "moduleName={$moduleName}&methodName={$methodName}&params={$param}", 'json');
         $url .= $this->config->requestType == "PATH_INFO" ? '?' : '&';
         $url .= $this->config->sessionVar . '=' . session_id();
     } else {
         if (!isset($_POST['noparam'])) {
             foreach ($_POST as $key => $value) {
                 $param .= '&' . $key . '=' . $value;
             }
             $param = ltrim($param, '&');
         }
         $url = rtrim($host, '/') . helper::createLink($moduleName, $methodName, $param, 'json');
         $url .= $this->config->requestType == "PATH_INFO" ? '?' : '&';
         $url .= $this->config->sessionVar . '=' . session_id();
     }
     /* Unlock session. After new request, restart session. */
     session_write_close();
     $content = file_get_contents($url);
     session_start();
     return array('url' => $url, 'content' => $content);
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:40,代码来源:model.php

示例15: ajaxUpload

 /**
  * AJAX: the api to recive the file posted through ajax.
  * 
  * @param  string $uid 
  * @access public
  * @return array
  */
 public function ajaxUpload($uid)
 {
     if (RUN_MODE == 'front' and !commonModel::isAvailable('forum')) {
         exit;
     }
     if (!$this->loadModel('file')->canUpload()) {
         $this->send(array('error' => 1, 'message' => $this->lang->file->uploadForbidden));
     }
     $file = $this->file->getUpload('imgFile');
     $file = $file[0];
     if ($file) {
         if (!$this->file->checkSavePath()) {
             $this->send(array('error' => 1, 'message' => $this->lang->file->errorUnwritable));
         }
         if (!in_array(strtolower($file['extension']), $this->config->file->imageExtensions)) {
             $this->send(array('error' => 1, 'message' => $this->lang->fail));
         }
         move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname']);
         if (in_array(strtolower($file['extension']), $this->config->file->imageExtensions) !== false) {
             $this->file->compressImage($this->file->savePath . $file['pathname']);
             $imageSize = $this->file->getImageSize($this->file->savePath . $file['pathname']);
             $file['width'] = $imageSize['width'];
             $file['height'] = $imageSize['height'];
         }
         $url = $this->file->webPath . $file['pathname'];
         $file['addedBy'] = $this->app->user->account;
         $file['addedDate'] = helper::now();
         $file['editor'] = 1;
         unset($file['tmpname']);
         $this->dao->insert(TABLE_FILE)->data($file)->exec();
         $_SESSION['album'][$uid][] = $this->dao->lastInsertID();
         die(json_encode(array('error' => 0, 'url' => $url)));
     }
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:41,代码来源:control.php


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