當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Core::throwError方法代碼示例

本文整理匯總了PHP中Core::throwError方法的典型用法代碼示例。如果您正苦於以下問題:PHP Core::throwError方法的具體用法?PHP Core::throwError怎麽用?PHP Core::throwError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Core的用法示例。


在下文中一共展示了Core::throwError方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(CustomField &$field, $data = null)
 {
     if ($field === null) {
         Core::throwError('First parameter is null.');
     }
     $this->field = $field;
     $this->setData($data);
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:8,代碼來源:class.CustomFieldData.php

示例2: __construct

 public function __construct($position, $baseUri, array $mainFields)
 {
     if (count($mainFields) == 0) {
         Core::throwError('Please provide fields to show.', INTERNAL_ERROR);
     }
     $this->position = Core::constructObject($position);
     $this->baseUri = $baseUri;
     $this->mainFields = $mainFields;
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:9,代碼來源:class.FieldDataPages.php

示例3: load

 public function load($file)
 {
     $file = $this->getFilePath($file);
     if (file_exists($file)) {
         return new TemplateBit($file);
     } else {
         Core::throwError("Template not found: '{$file}'");
         return null;
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:10,代碼來源:class.Template.php

示例4: loadMenu

 protected function loadMenu()
 {
     require self::MENU_FILE;
     $this->menu = $config;
     if (empty($this->menu['Pages'])) {
         Core::throwError("No pages in admin menu table found.", INTERNAL_ERROR);
     }
     foreach ($this->menu['Pages'] as $key => $menuClass) {
         $this->menu['Pages'][$key] = Core::constructObject($menuClass);
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:11,代碼來源:class.AdminModuleObject.php

示例5: checkACL

 public static function checkACL($gid, $right)
 {
     $cache = Core::getObject('Core.Cache.CacheServer');
     $p = $cache->load('permissions');
     $acl = $p->getPermissions($gid);
     if (isset($acl[$right])) {
         return $acl[$right] == 1;
     } else {
         Core::throwError('No permission with name "' . $right . '" found.', INTERNAL_NOTICE);
         return false;
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:12,代碼來源:class.UserUtils.php

示例6: formatDataForDb

 public function formatDataForDb($data)
 {
     if ($data !== null) {
         $dt = DT::createFromFormat(Config::get('intl.date_format'), $data);
         if ($dt !== null) {
             $data = $dt->dbDate();
         } else {
             Core::throwError('Could not convert DateTime-data for database.');
         }
     }
     return $data;
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:12,代碼來源:class.CustomDatePicker.php

示例7: __autoload

/**
 * Loads the required classes automatically from ClassManager (only indexed classes).
 *
 * @param string Class Name
 */
function __autoload($className)
{
    if ($className === 'parent') {
        // Avoid calling parent when using callback function.
        // See: http://www.php.net/manual/de/function.call-user-func.php#106391
        return;
    }
    $classManager = Core::getObject('Core.System.ClassManager');
    if (Config::get('core.debug')) {
        Core::throwError("Autoloaded class with name '{$className}'", INTERNAL_DEBUG);
    }
    $file = $classManager->loadFile($className);
    if ($file == null) {
        Core::throwError('Class "{$className}" not found', INTERNAL_ERROR);
    }
}
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:21,代碼來源:function.core.php

示例8: connect

 /**
  * Attempts to open a connection to the MySQL Server.
  *
  * The host can be either a host name or an IP address. Passing the null value or the
  * string "localhost" to this parameter, the local host is assumed. If successful,
  * the the function will return an object representing the connection to the database,
  * or null on failure. The port and socket parameters are used in conjunction with the
  * host parameter to further control how to connect to the database server. The port
  * parameter specifies the port number to attempt to connect to the MySQL server on,
  * while the socket parameter specifies the socket or named pipe that should be used.
  * If all values are null, the data from the configuration file will be read and used.
  * If one value is not null, the data specified will be used. Default values are in this
  * case:<br>
  * Host: localhost<br>
  * Username: root<br>
  * Password: <empty> (An warning will occur)<br>
  * Port: 3306<br>
  * Socket: null<br>
  *
  * @param string Host
  * @param string Username
  * @param string Password
  * @param int Port
  * @param string Socket or null
  **/
 public function connect($username = null, $password = null, $host = null, $port = null, $socket = null)
 {
     if (false == ($username == null && $password == null && $host == null && $port == null && $socket == null)) {
         $this->username = empty($username) ? 'root' : $username;
         $this->password = $password;
         if (empty($this->password) == true) {
             Core::throwError("Password for SQL-Connection is empty. It is highly recommended to set a password for your Database.");
         }
         $this->host = empty($host) ? 'localhost' : $host;
         $this->port = empty($port) ? '3306' : $port;
         $this->socket = $socket;
     }
     $host = $this->host . iif(is_id($port), ":{$this->port}") . iif(!empty($this->socket), ":{$this->socket}");
     $this->connection = mysqli_connect($host, $this->username, $this->password);
     if ($this->hasConnection() == false) {
         Core::throwError('Could not connect to database! Pleasy try again later or check the database settings!', INTERNAL_ERROR);
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:43,代碼來源:class.MySQL.php

示例9: loadFile

 /**
  * Loads the class with the given class name from the index.
  *
  * @param	string	Class Name
  * @return	mixed	Filename or null on failure
  * @access	public
  */
 public function loadFile($className)
 {
     if (isset($this->index[$className]) == true) {
         if (file_exists($this->index[$className]) == true) {
             $filename = $this->index[$className];
             include_once $filename;
         } else {
             $this->deleteIndex();
             Core::throwError('ClassManager index seems to be outdated. File for class ' . $className . ' not found: ' . $this->index[$className] . '. New index scan scheduled. Please refresh this page.', INTERNAL_ERROR);
             $filename = null;
         }
     } else {
         $this->deleteIndex();
         Core::throwError('ClassManager has no class with name ' . $className . ' indexed. New index scan scheduled. Please refresh this page.', INTERNAL_ERROR);
         $filename = null;
     }
     return $filename;
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:25,代碼來源:class.ClassManager.php

示例10: findNearestStep

 public static function findNearestStep($value, $min = 0, $max = 5, $step = 0.5)
 {
     if ($step <= 0) {
         Core::throwError("Step has to be > 0, given {$step}.", INTERNAL_ERROR);
     }
     if ($value <= $min) {
         return $min;
     } else {
         if ($value >= $max) {
             return $max;
         } else {
             $margin = $step / 2;
             for ($i = $min; $i < $max; $i += $step) {
                 if ($value > $i - $margin && $value <= $i + $margin) {
                     return $i;
                 }
             }
             return $max;
         }
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:21,代碼來源:class.CustomRating.php

示例11: parse

 /**
  * Looks for class names in a PHP code
  *
  * @param string File to scan for class name.
  * @todo Reine PHP Alternative um Klassen zu erkennen (RegExp)
  */
 private function parse($filepath)
 {
     $file = new File($filepath);
     if ($file->exists() == true) {
         $code = $file->read();
         $tokens = @token_get_all($code);
         foreach ($tokens as $token) {
             if (!isset($token[0])) {
                 continue;
             }
             // next token after this one is our desired class name
             if ($token[0] == T_CLASS) {
                 $this->next = true;
             }
             if ($token[0] == T_STRING && $this->next === true) {
                 if (isset($this->data[$token[1]]) == true) {
                     Core::throwError('Class with name "' . $token[1] . '" was found more than once. Only file "' . $file->absPath() . '" has been indexed!', INTERNAL_NOTICE);
                 }
                 $this->data[$token[1]] = $file->relPath();
                 $this->next = false;
             }
         }
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:30,代碼來源:class.cache_classes.php

示例12: read

 /**
  * Reads a file (in three different ways).
  *
  * If the parameter is -1 (FILE_COMPLETE) or if no parameter is given, the complete file will be returned at once.<br />
  *
  * If the parameter is -2 (FILE_LINES) or -3 (FILE_LINES_TRIM), the function returns the file in an array.
  * Each element of the array corresponds to a line in the file.
  * If the parameter is -2 (FILE_LINES) the newline/carriage return will be still attached, -3 (FILE_LINES_TRIM) removes them at the end.<br />
  *
  * If the parameter is > 0, the function reads up to the specified amount of bytes from the file pointer.
  * When the end of file (EOF) is reached the function returns null.
  * If the file does not exist or an error occurs, null will be returned.
  *
  * Example:
  * <code>
  *	$f = new File('file.txt');
  *	while ($data = $f->read(1024)) {
  *		echo $data;
  *	}
  * </code>
  *
  * @param	int	Type to read the file. Standard: -1 (FILE_COMPLETE)
  * @return	mixed	Requested content (as array or string) or null
  * @todo Better trim for FILE_LINES_TRIM (replace foreach with ...?)
  */
 public function read($type = FILE_COMPLETE)
 {
     if ($this->readable() == false) {
         return null;
     }
     if ($type == FILE_COMPLETE) {
         $contents = file_get_contents($this->path);
         if ($contents != false) {
             return $contents;
         } else {
             return null;
         }
     } elseif ($type == FILE_LINES || $type == FILE_LINES_TRIM) {
         // When files are bigger than 8 MB then use another method to read file into array.
         if ($this->size() <= 8 * 1024 * 1024) {
             $array = file($this->path);
         } else {
             $array = array();
             $this->handle = fopen($this->path, 'rb');
             if (is_resource($this->handle) == false) {
                 return null;
             }
             while (feof($this->handle) == false) {
                 $array[] = fgets($this->handle);
             }
             fclose($this->handle);
         }
         if ($array != false) {
             if ($type == FILE_LINES_TRIM) {
                 foreach ($array as $key => $value) {
                     $array[$key] = rtrim($value, "\r\n");
                 }
             }
             return $array;
         } else {
             return null;
         }
     } elseif ($type > 0) {
         if (is_resource($this->handle) == false) {
             $this->handle = fopen($this->path, 'rb');
             if (is_resource($this->handle) == false) {
                 return null;
             }
         }
         if (feof($this->handle) == false) {
             $part = fread($this->handle, $type);
             if ($part != false) {
                 return $part;
             } else {
                 return null;
             }
         } else {
             fclose($this->handle);
             return null;
         }
     } else {
         Core::throwError('The specified type (' . $type . ') to read the file "' . $this->path . '" is not supported.');
         return null;
     }
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:85,代碼來源:class.File.php

示例13: display

 /**
  * 顯示控製器對應的模板輸出內容
  * @param string $name
  */
 public function display($name = '')
 {
     $engine = isset($GLOBALS['_template_engine']) ? $GLOBALS['_template_engine'] : 'php';
     if (is_file($name)) {
         $themeFile = $name;
     } else {
         $themeFile = $this->getThemeFile($name);
     }
     if (!is_file($themeFile)) {
         if (APP_DEBUG) {
             $filestr = ' [' . $themeFile . ']';
         } else {
             $filestr = '';
         }
         $args = array('{template_file}' => $filestr);
         Core::throwError('template_file_not_exist', __FILE__, __LINE__, $args);
     }
     // 需要獲取緩存衝區內容
     if (!empty($_GET['ob_html'])) {
         ob_start();
     }
     if ($engine == 'php') {
         include $themeFile;
     } else {
         if ($engine == 'dophin') {
             $suffix = isset($GLOBALS['_suffix']) ? $GLOBALS['_suffix'] : '';
             $left = isset($GLOBALS['_tpl_delimiter_left']) ? $GLOBALS['_tpl_delimiter_left'] : '';
             $right = isset($GLOBALS['_tpl_delimiter_right']) ? $GLOBALS['_tpl_delimiter_right'] : '';
             $tpl = new Template($themeFile, $this->themePath, $suffix, $left, $right);
             $tpl->load($this->_vars);
         } else {
             echo 'unknow template engine!';
         }
     }
     // 輸出內容到html靜態文件
     if (!empty($_GET['make_html'])) {
         if (!empty($_GET['html_file'])) {
             $htmlFile = HTML_PATH . $_GET['html_file'];
         } else {
             if (isset($GLOBALS['html_file'])) {
                 $htmlFile = HTML_PATH . $GLOBALS['html_file'];
             } else {
                 if ($this->html_cache_file) {
                     $htmlFile = HTML_PATH . $this->html_cache_file;
                 } else {
                     if (!empty($_GET['id']) && !ctype_digit($_GET['id'])) {
                         $htmlFile = HTML_PATH . $this->co . '_' . $this->do . '_' . $_GET['id'] . '.html';
                     } else {
                         $htmlFile = HTML_PATH . $this->co . '_' . $this->do . '.html';
                     }
                 }
             }
         }
         $dir = dirname($_GET['html_file']);
         if (!is_dir($dir)) {
             mkdir($dir, 0775, true);
         }
         $html = ob_get_contents();
         file_put_contents($_GET['html_file'], $html);
         if ($_GET['html_display']) {
             ob_end_flush();
         } else {
             ob_end_clean();
             return true;
         }
     }
     if ($GLOBALS['_output_process_time']) {
         echo microtime(1) - APP_BEGIN_TIME;
     }
     // 顯示完頁麵不執行後麵代碼
     exit;
 }
開發者ID:noikiy,項目名稱:dophin,代碼行數:76,代碼來源:Controller.class.php

示例14: load

 /**
  * This method loads a cache item and adds it to the cache manager.
  *
  * If the cache class file is not found or the cache file is corrupt a new
  * CacheItem will be constructed. An USER_NOTICE will be thrown.
  *
  * @param string Name of the cache file (class.cache_ will be added before the name and .php will be added after the name)
  * @param string Path to the folder with the cache files or null for default source directory.
  * @return object
  **/
 public function load($name, $sourcedir = null)
 {
     $this->loadClass($name, $sourcedir);
     $className = "cache_{$name}";
     if (class_exists($className)) {
         $object = new $className($name, $this->cachedir);
     } elseif (class_exists($name)) {
         $object = new $name($name, $this->cachedir);
     } else {
         Core::throwError('Cache Class of type "' . $name . '" could not be loaded.', INTERNAL_NOTICE);
         $object = new CacheItem($name, $this->cachedir);
     }
     $this->data[$name] = $object;
     return $object;
 }
開發者ID:BackupTheBerlios,項目名稱:viscacha-svn,代碼行數:25,代碼來源:class.CacheServer.php

示例15: __call

 /**
  * Magic call for FTP functions using
  * this class resource
  *
  * This allows usage like this:
  *
  * $ftp = new ftp('ftp://example.com');
  * $ftp->ftp_login('username', 'password');
  * $ftp->ftp_put('source', 'destination');
  *
  * @param   string      $func       - The function name
  * @param   mixed       $a          - The function parameters
  * @return  mixed
  */
 public function __call($func, $a)
 {
     if (strstr($func, 'ftp_') !== false && function_exists($func)) {
         array_unshift($a, $this->conn);
         return call_user_func_array($func, $a);
     } else {
         Core::throwError('Internal Invalid call: ' . $func);
     }
 }
開發者ID:elvisdandrea,項目名稱:delicatessi,代碼行數:23,代碼來源:Ftp.php


注:本文中的Core::throwError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。