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


PHP Framework类代码示例

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


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

示例1: setFramework

 public function setFramework(Framework $framework)
 {
     $this->_framework = $framework;
     $this->_router = $framework->getRouter();
     $this->_dispatcher = $framework->getDispatcher();
     return $this;
 }
开发者ID:sohoa,项目名称:framework,代码行数:7,代码来源:ErrorHandler.php

示例2: escapeString

function escapeString($string)
{
    if (Framework::getDb() != null) {
        return mysql_real_escape_string($string, Framework::getDb()->getLink());
    }
    return mysql_escape_string($string);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:7,代码来源:functions.php

示例3: __autoload_modules

function __autoload_modules($class)
{
    $class_file = Framework::classLocate($class);
    if (file_exists($class_file)) {
        require_once $class_file;
    }
}
开发者ID:MrYogi,项目名称:hasoffers-promotional-platform,代码行数:7,代码来源:bootstrap.php

示例4: testUrl

 /**
  * undocumented
  * @author Joshua Davey
  */
 public function testUrl()
 {
     Framework::$uriPathDynamic = '/madeam/';
     Framework::$uriPathStatic = '/madeam/public/';
     $this->assertEquals('/madeam/test', Framework::url('test'));
     $this->assertEquals('/madeam/public/test', Framework::url('/test'));
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: init

 public function init()
 {
     // check if logged in session is valid, if not redir to main page
     if (!isset($_SESSION['loginHash'])) {
         Framework::Redir("site/index");
         die;
     }
     $activeSession = R::findOne('session', ' hash = ? AND ip = ? AND expires > ?', array($_SESSION['loginHash'], $_SERVER['REMOTE_ADDR'], time()));
     if (!$activeSession) {
         unset($_SESSION['loginHash']);
         Framework::Redir("site/index/main/session_expired");
         die;
     }
     $activeSession->expires = time() + SESSION_MAX_AGE * 2;
     R::store($activeSession);
     $this->session = $activeSession;
     $this->user = R::load('user', $this->session->user->getId());
     Framework::TPL()->assign('user_premium', $this->user->hasPremium());
     // check needed rights if any
     foreach ($this->_rights as $r) {
         if (!$this->user->hasRight($r)) {
             Framework::Redir("game/index");
             die;
         }
     }
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:26,代码来源:Controller_GameAuth.class.php

示例6: setUrlParams

 protected function setUrlParams($url_params)
 {
     $utilities = \Framework::utilities();
     $this->controller = isset($url_params[0]) ? $utilities->formater($url_params[0], Utilities::FORMAT_CAMELCASE) : 'Index';
     $this->action = isset($url_params[1]) ? $utilities->formater($url_params[1], Utilities::FORMAT_CAMELCASE_2) : 'index';
     $this->parameters = isset($url_params[2]) ? array_slice($url_params, 2) : [];
 }
开发者ID:vituhugo,项目名称:framework-router,代码行数:7,代码来源:abstract_router.php

示例7: getItems

 /**
  * @return array<list_Item>
  */
 public final function getItems()
 {
     $request = Controller::getInstance()->getContext()->getRequest();
     $form = null;
     $conditionOn = null;
     try {
         $conditionOnId = intval($request->getParameter('documentId', 0));
         if ($conditionOnId > 0) {
             $conditionOn = DocumentHelper::getDocumentInstance($conditionOnId);
             $form = $conditionOn->getForm();
         } else {
             $parent = DocumentHelper::getDocumentInstance(intval($request->getParameter('parentId', 0)));
             if ($parent instanceof form_persistentdocument_baseform) {
                 $form = $parent;
             } else {
                 if ($parent instanceof form_persistentdocument_group) {
                     $form = $parent->getForm();
                 }
             }
         }
     } catch (Exception $e) {
         Framework::exception($e);
     }
     if (!$form instanceof form_persistentdocument_baseform) {
         return array();
     }
     $results = array();
     $excludeIds = $this->getExcludeIds($conditionOn);
     foreach ($form->getDocumentService()->getValidActivationFields($form, $excludeIds) as $field) {
         $results[] = new list_Item($field->getLabel(), $field->getId());
     }
     return $results;
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:36,代码来源:ListActivationfieldsService.class.php

示例8: addError

 public function addError()
 {
     if (func_num_args() < 1) {
         \Framework::debug("Need at least 1 parameter");
     }
     $args = func_get_args();
     switch (count($args)) {
         case 1:
             if (is_object($args[0])) {
                 $this->errors->add($args[0]);
             } elseif (is_string($args[0])) {
                 $this->errors->add(new ErrorGlobal($args[0]));
             } else {
                 \Framework::debug("Wrong argument passed to add errors");
             }
             break;
         case 2:
             $this->errors->add(new ErrorForm($args[0], $args[1]));
             break;
         case 3:
             $this->errors->add(new ErrorForm($args[0], $args[1], $args[2]));
             break;
         default:
             \Framework::debug("This function can't has " . count($args) . " arguments");
             break;
     }
 }
开发者ID:czahoo,项目名称:api-framework,代码行数:27,代码来源:ObjectErrors.php

示例9: __construct

 /**
  * Create a new MailManager and set all the relevant header flags for
  * sending a message from $sender to $pers->getEmail
  *
  * @param $pers Person A person object containing recipient information
  * @param $sender string The sender, as to be defined in the mail's
  *                       envelope
  * @param $senderName string The name that should appear in the sender
  *                           field
  * @param $sendHeader string The sender, as to be defined in the mail's
  *                           header
  */
 public function __construct($pers, $sender, $senderName, $sendHeader, $alternateAddress = null)
 {
     if (!$pers instanceof Person) {
         throw new ConfusaGenException("Error: First argument to the " . "MailManager constructor is not a " . "valid person object!");
     }
     $this->mailer = new PHPMailer();
     if (is_null($this->mailer)) {
         Framework::error_output("Could not create mailer. Aborting");
         return;
     }
     $this->mailer->CharSet = "UTF-8";
     $this->mailer->Mailer = "sendmail";
     /* set the envelope "from" address using the sendmail option -f, and
      * the return-path header */
     $this->mailer->Sender = $sender;
     /* set the header "from" address */
     $this->mailer->From = $sendHeader;
     $this->mailer->FromName = $senderName;
     $this->mailer->WordWrap = 80;
     $this->toAddr = $pers->getEmail();
     if (!is_null($alternateAddress)) {
         $this->toAddr = $alternateAddress;
     }
     $this->mailer->AddAddress($this->toAddr, $pers->getName());
     $help_desk = $pers->getSubscriber()->getHelpEmail();
     /* add a reply-to to the helpdesk, if a helpdesk is defined */
     if (isset($help_desk)) {
         $support_name = $pers->getSubscriber()->getOrgName() . " support";
         $this->mailer->AddReplyTo($help_desk, $support_name);
     }
 }
开发者ID:henrikau,项目名称:confusa,代码行数:43,代码来源:MailManager.php

示例10: getItems

 /**
  * @return array<list_Item>
  */
 public final function getItems()
 {
     try {
         $request = Controller::getInstance()->getContext()->getRequest();
         $questionId = intval($request->getParameter('questionId', 0));
         $question = DocumentHelper::getDocumentInstance($questionId);
     } catch (Exception $e) {
         if (Framework::isDebugEnabled()) {
             Framework::debug(__METHOD__ . ' EXCEPTION: ' . $e->getMessage());
         }
         return array();
     }
     // Here we must use instanceof and not getDocumentModelName to work with injection.
     $results = array();
     if ($question instanceof form_persistentdocument_boolean) {
         $trueLabel = $question->getTruelabel();
         $falseLabel = $question->getFalselabel();
         $results[$trueLabel] = new list_Item($trueLabel, $trueLabel);
         $results[$falseLabel] = new list_Item($falseLabel, $falseLabel);
     } else {
         if ($question instanceof form_persistentdocument_list) {
             $results = $question->getDataSource()->getItems();
         }
     }
     return $results;
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:29,代码来源:ListActivationvaluesService.class.php

示例11: preSave

 /**
  * @param form_persistentdocument_mail $document
  * @param Integer $parentNodeId Parent node ID where to save the document (optionnal => can be null !).
  * @throws form_ReplyToFieldAlreadyExistsException
  * @return void
  */
 protected function preSave($document, $parentNodeId = null)
 {
     if ($document->getMultiline()) {
         $document->setValidators('emails:true');
     } else {
         $document->setValidators('email:true');
     }
     if ($parentNodeId !== NULL) {
         $form = DocumentHelper::getDocumentInstance($parentNodeId);
     } else {
         $form = $this->getFormOf($document);
     }
     if ($form === null) {
         if (Framework::isWarnEnabled()) {
             Framework::warn(__METHOD__ . ' the mail field document (' . $document->__toString() . ')is not in a form');
         }
     } else {
         if ($document->getUseAsReply()) {
             $oldReplyField = form_BaseFormService::getInstance()->getReplyToField($form);
             if ($oldReplyField !== null && $oldReplyField !== $document) {
                 Framework::error(__METHOD__ . ' Old reply field :' . $oldReplyField->__toString());
                 throw new form_ReplyToFieldAlreadyExistsException(f_Locale::translate('&modules.form.bo.errors.Mail-field-for-replyto-exists'));
             }
         }
     }
     parent::preSave($document, $parentNodeId);
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:33,代码来源:MailService.class.php

示例12: show_Main

 public function show_Main()
 {
     $charImg = array();
     for ($i = 1; $i <= HIGHEST_CHAR_IMG; $i++) {
         $charImg[] = array("id" => $i, "name" => $i < 10 ? "0" . $i : $i);
     }
     Framework::TPL()->assign('charImg', $charImg);
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:8,代码来源:Game_Character.class.php

示例13: sendFile_Rangable

function sendFile_Rangable($filename, $contentType = "binary/octet")
{
    if (!file_exists($filename)) {
        return Framework::debug(DEBUG_FATAL, "sendFile_Ranagable() - Unknown file {$filename}");
    }
    header("Content-Type: {$contentType}");
    $fp = @fopen($filename, 'rb');
    header("Accept-Ranges: bytes");
    $size = filesize($filename);
    // File size
    $length = $size;
    // Content length
    $start = 0;
    // Start byte
    $end = $size - 1;
    // End byte
    if (isset($_SERVER['HTTP_RANGE'])) {
        $c_start = $start;
        $c_end = $end;
        list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
        if (strpos($range, ',') !== false) {
            header('HTTP/1.1 416 Requested Range Not Satisfiable');
            header("Content-Range: bytes {$start}-{$end}/{$size}");
            exit;
        }
        if ($range == '-') {
            $c_start = $size - substr($range, 1);
        } else {
            $range = explode('-', $range);
            $c_start = $range[0];
            $c_end = isset($range[1]) && is_numeric($range[1]) ? $range[1] : $size;
        }
        $c_end = $c_end > $end ? $end : $c_end;
        if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
            header('HTTP/1.1 416 Requested Range Not Satisfiable');
            header("Content-Range: bytes {$start}-{$end}/{$size}");
            exit;
        }
        $start = $c_start;
        $end = $c_end;
        $length = $end - $start + 1;
        fseek($fp, $start);
        header('HTTP/1.1 206 Partial Content');
    }
    header("Content-Range: bytes {$start}-{$end}/{$size}");
    header("Content-Length: " . $length);
    $buffer = 1024 * 8;
    while (!feof($fp) && ($p = ftell($fp)) <= $end) {
        if ($p + $buffer > $end) {
            $buffer = $end - $p + 1;
        }
        set_time_limit(0);
        echo fread($fp, $buffer);
        flush();
    }
    fclose($fp);
    exit;
}
开发者ID:Enderboi,项目名称:DVR_Web,代码行数:58,代码来源:Utils.php

示例14: loadHits

 public function loadHits()
 {
     $page = $_SERVER['REQUEST_URI'];
     $rowAll = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "'");
     $rowToday = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "' AND added >= DATE_FORMAT('Y-m-d', NOW())");
     $rowMonth = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "' AND added >= DATE_FORMAT('Y-m', NOW())");
     $rowYear = Framework::getDb()->getFirstRow("SELECT SUM(hits) AS hits FROM page_hits WHERE page = '" . esc($page) . "' AND added >= DATE_FORMAT('Y', NOW())");
     $this->PageHits = array('all' => $rowAll ? $rowAll['hits'] : 0, 'today' => $rowToday ? $rowToday['hits'] : 0, 'month' => $rowMonth ? $rowMonth['hits'] : 0, 'hits' => $rowYear ? $rowYear['hits'] : 0);
 }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:9,代码来源:RoItem.class.php

示例15: start

 /**
  * start 
  * 
  * @param mixed $dsn 
  * @access public
  * @return void
  */
 public function start($dsn)
 {
     Framework::$db = DB::connect($dsn);
     if (!PEAR::isError(Framework::$db)) {
         Framework::$db->setFetchMode(DB_FETCHMODE_ASSOC);
     } else {
         throw new Framework_Exception(Framework::$db);
     }
 }
开发者ID:shupp,项目名称:Framework,代码行数:16,代码来源:DB.php


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