本文整理汇总了PHP中isDebug函数的典型用法代码示例。如果您正苦于以下问题:PHP isDebug函数的具体用法?PHP isDebug怎么用?PHP isDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isDebug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Video Validate.
*
* @return boolean
* @throws \PH7\Framework\Error\CException\PH7BadMethodCallException If the video file is not found.
*/
public function validate()
{
if (!is_file($this->aFile['tmp_name'])) {
if (!isDebug()) {
return false;
} else {
throw new \PH7\Framework\Error\CException\PH7BadMethodCallException('Video file not found: The video file \'' . $this->aFile['tmp_name'] . '\' could not be found.');
}
} else {
switch ($this->sType) {
// Files supported List.
case 'mov':
case 'avi':
case 'flv':
case 'mp4':
case 'mpg':
case 'mpeg':
case 'wmv':
case 'ogg':
case 'ogv':
case 'webm':
case 'mkv':
return true;
break;
default:
return false;
}
}
}
示例2: __construct
public function __construct()
{
parent::__construct();
/**
* This can cause minor errors (eg if a user sent a file that is not a video).
* So we hide the errors if we are not in development mode.
*/
if (!isDebug()) {
error_reporting(0);
}
// Resizing and saving the video album thumbnail
$oPicture = new Image($_FILES['album']['tmp_name']);
if (!$oPicture->validate()) {
\PFBC\Form::setError('form_video_album', Form::wrongImgFileTypeMsg());
} else {
$iApproved = DbConfig::getSetting('videoManualApproval') == 0 ? '1' : '0';
$sFileName = Various::genRnd($oPicture->getFileName(), 1) . '-thumb.' . $oPicture->getExt();
(new VideoModel())->addAlbum($this->session->get('member_id'), $this->httpRequest->post('name'), $this->httpRequest->post('description'), $sFileName, $this->dateTime->get()->dateTime('Y-m-d H:i:s'), $iApproved);
$iLastAlbumId = (int) Db::getInstance()->lastInsertId();
$oPicture->square(200);
/* Set watermark text on thumbnail */
$sWatermarkText = DbConfig::getSetting('watermarkTextImage');
$iSizeWatermarkText = DbConfig::getSetting('sizeWatermarkTextImage');
$oPicture->watermarkText($sWatermarkText, $iSizeWatermarkText);
$sPath = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'video/file/' . $this->session->get('member_username') . PH7_DS . $iLastAlbumId . PH7_DS;
$this->file->createDir($sPath);
$oPicture->save($sPath . $sFileName);
/* Clean VideoModel Cache */
(new Framework\Cache\Cache())->start(VideoModel::CACHE_GROUP, null, null)->clear();
HeaderUrl::redirect(Uri::get('video', 'main', 'addvideo', $iLastAlbumId));
}
}
示例3: __construct
/**
* DataPool constructor.
* @param array $conf
*/
public function __construct($conf = [])
{
if (!$conf) {
$conf = \Flight::get('config')->get('datapool');
$conf['debug'] = isDebug();
}
$this->dataPool = new DefaultDataPool($conf, ROOT);
}
示例4: enableLogging
/**
* 设置是否写SQL日志
*
* @return bool
*/
public static function enableLogging($bool = null)
{
if (null !== $bool) {
self::$_enableLogging = (bool) $bool;
}
// 非调试模式下永远为否
return !isDebug() ? false : self::$_enableLogging;
}
示例5: debug
function debug($msg, $debugReason = 'other')
{
if (isDebug($debugReason)) {
if (is_array($msg)) {
$msg = print_r($msg, true);
}
echo PHP_EOL . '<!-- ' . date(DATE_RFC822) . PHP_EOL . $msg . PHP_EOL . ' -->' . PHP_EOL;
}
}
示例6: __construct
public function __construct()
{
parent::__construct();
/***** Securing the server for DDoS attack only! Not for the attacks DoS *****/
if (!isDebug() && M\DbConfig::getSetting('DDoS')) {
$oDDoS = new Stop();
if ($oDDoS->cookie() || $oDDoS->session()) {
sleep(PH7_DDOS_DELAY_SLEEP);
}
unset($oDDoS);
}
/*
if ($this->browser->isMobile())
{
\PH7\Framework\Url\HeaderUrl::redirect('mobile');
}
*/
/***** Assign the values for Registry Class *****/
// URL
$this->registry->site_url = PH7_URL_ROOT;
$this->registry->url_relative = PH7_RELATIVE;
$this->registry->page_ext = PH7_PAGE_EXT;
// Site Name
$this->registry->site_name = M\DbConfig::getSetting('siteName');
/***** Internationalization *****/
// Default path language
$this->lang->load('global', PH7_PATH_APP_LANG);
/***** PH7Tpl Template Engine initialization *****/
/*** Assign the global variables ***/
/*** Objects ***/
$this->view->config = $this->config;
$this->view->design = $this->design;
/***** Info *****/
$oInfo = M\DbConfig::getMetaMain(PH7_LANG_NAME);
$aMetaVars = ['site_name' => $this->registry->site_name, 'page_title' => $oInfo->pageTitle, 'slogan' => $oInfo->slogan, 'meta_description' => $oInfo->metaDescription, 'meta_keywords' => $oInfo->metaKeywords, 'meta_author' => $oInfo->metaAuthor, 'meta_robots' => $oInfo->metaRobots, 'meta_copyright' => $oInfo->metaCopyright, 'meta_rating' => $oInfo->metaRating, 'meta_distribution' => $oInfo->metaDistribution, 'meta_category' => $oInfo->metaCategory, 'header' => 0];
$this->view->assigns($aMetaVars);
unset($oInfo);
/**
* This test is not necessary because if there is no session,
* the get() method of the \PH7\Framework\Session\Session object an empty value and revisit this avoids having undefined variables in some modules (such as the "connect" module).
*/
//if (\PH7\UserCore::auth()) {
$this->view->count_unread_mail = \PH7\MailCoreModel::countUnreadMsg($this->session->get('member_id'));
$this->view->count_pen_friend_request = \PH7\FriendCoreModel::getPenFd($this->session->get('member_id'));
//}
/***** Display *****/
$this->view->setTemplateDir($this->registry->path_module_views . PH7_TPL_MOD_NAME);
/***** End Template Engine PH7Tpl *****/
// For permission the modules
if (is_file($this->registry->path_module_config . 'Permission.php')) {
require $this->registry->path_module_config . 'Permission.php';
new \PH7\Permission();
}
}
示例7: validate
/**
* Video Validate.
*
* @return boolean
* @throws \PH7\Framework\Error\CException\PH7BadMethodCallException If the video file is not found.
*/
public function validate()
{
if (!is_uploaded_file($this->aFile['tmp_name'])) {
if (!isDebug()) {
return false;
} else {
throw new \PH7\Framework\Error\CException\PH7BadMethodCallException('The file could not be uploaded. Possibly too large.');
}
} else {
return in_array($this->sType, $this->aAllowedTypes);
}
}
示例8: jQuery_migrate_init
function jQuery_migrate_init()
{
global $thisfile_GSJQM, $SITEURL;
i18n_merge($thisfile_GSJQM) || i18n_merge($thisfile_GSJQM, GSDEFAULTLANG);
# register plugin
register_plugin($thisfile_GSJQM, i18n_r($thisfile_GSJQM . '/GSJQMigrate_TITLE'), '1.0', 'GetSimpleCMS', 'http://get-simple.info', i18n_r($thisfile_GSJQM . '/GSJQMigrate_DESC'), '', '');
$asset = isDebug() ? 'jquery-migrate-1.2.1.js' : 'jquery-migrate-1.2.1.min.js';
// when debug is on, migrate will output to console with deprecated notices.
$url = $SITEURL . 'plugins/' . $thisfile_GSJQM . '/assets/js/' . $asset;
register_script('jquerymigrate', $url, '', FALSE);
queue_script('jquerymigrate', GSBACK);
}
示例9: index
/**
* Displaying the main homepage of the website.
*/
public function index()
{
// We must not put the title as this is the homepage, so this is the default title is used.
// For Profiles Carousel
$this->view->userDesignModel = new UserDesignCoreModel();
$this->view->userDesign = new UserDesignCore();
// Only visitors
if (!UserCore::auth()) {
// Set CSS and JS files
$this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'splash.css,tooltip.css,js/jquery/carousel.css');
$this->design->addJs(PH7_DOT, PH7_STATIC . PH7_JS . 'jquery/carouFredSel.js,' . PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_JS . 'splash.js');
// Assigns the promo text to the view
$this->view->promo_text = DbConfig::getMetaMain(PH7_LANG_NAME)->promoText;
// Assign the background video option
$this->view->is_bg_video = DbConfig::getSetting('bgSplashVideo');
// To check if the site is called by a mobile native app
$bMobApp = $this->view->is_mobapp = MobApp::is();
/**
* When you are in the development mode, you can force the guest page by set a "force" GET request with the "splash" or "classic" parameter.
* Example: "/?force=splash" or "/?force=classic"
*/
if (isDebug() && $this->httpRequest->getExists('force')) {
switch ($this->httpRequest->get('force')) {
case 'classic':
$sPage = 'index.guest';
break;
case 'splash':
$sPage = 'index.guest_splash';
break;
default:
exit('You can only choose between "classic" or "splash"');
}
} elseif ($bMobApp) {
$sPage = 'index.guest_splash';
} else {
$bIsSplashPage = (bool) DbConfig::getSetting('splashPage');
$sPage = $bIsSplashPage ? 'index.guest_splash' : 'index.guest';
}
$this->manualTplInclude($sPage . '.inc.tpl');
} elseif (UserCore::auth()) {
// Set CSS and JS files
$this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'zoomer.css');
$this->design->addJs(PH7_STATIC . PH7_JS, 'zoomer.js,Wall.js');
// Assigns the user's first name to the view for the Welcome Message
$this->view->first_name = $this->session->get('member_first_name');
$this->manualTplInclude('index.user.inc.tpl');
}
$this->output();
}
示例10: validate
/**
* @desc Image Validate.
* @return boolean
* @throws \PH7\Framework\Error\CException\PH7BadMethodCallException If the image file is not found.
*/
public function validate()
{
$mImgType = $this->getType();
if (!is_file($this->sFile) || !$mImgType) {
if (isDebug()) {
throw new \PH7\Framework\Error\CException\PH7BadMethodCallException('The file could not be uploaded. Possibly too large.');
} else {
return false;
}
} else {
switch ($mImgType) {
// JPG
case static::JPG:
$this->rImage = imagecreatefromjpeg($this->sFile);
$this->sType = 'jpg';
break;
// PNG
// PNG
case static::PNG:
$this->rImage = imagecreatefrompng($this->sFile);
$this->sType = 'png';
break;
// GIF
// GIF
case static::GIF:
$this->rImage = imagecreatefromgif($this->sFile);
$this->sType = 'gif';
break;
case static::WEBP:
$this->rImage = imagecreatefromgif($this->sFile);
$this->sType = 'webp';
break;
// Invalid Zone
// Invalid Zone
default:
return false;
// File type incompatible. Please save the image in .jpg, .png or .gif
}
$this->iWidth = imagesx($this->rImage);
$this->iHeight = imagesy($this->rImage);
// Automatic resizing if the image is too large
if ($this->iWidth > $this->iMaxWidth or $this->iHeight > $this->iMaxHeight) {
$this->dynamicResize($this->iMaxWidth, $this->iMaxHeight);
}
return true;
}
}
示例11: process
/**
* 记录异常处理日志
*
* @param Exception $e
* @param string $msg
* @return boolean
*/
public static function process($e, $msg, $sqlInfo = array())
{
$msg .= "\n";
if ($sqlInfo) {
$msg .= self::_sqlInfoToString($sqlInfo) . "\n";
}
$msg .= $e->getMessage() . "\n";
foreach ($e->getTrace() as $key => $trace) {
if (!isset($trace['file']) && !isset($trace['line'])) {
continue;
}
$msg .= $key + 1 . ' File:' . $trace['file'] . ' Line:' . $trace['line'] . "\n";
}
if (isDebug()) {
throw new self($msg);
}
}
示例12: validate
/**
* @desc Image Validate.
* @return boolean
* @throws \PH7\Framework\Error\CException\PH7BadMethodCallException If the image file is not found.
*/
public function validate()
{
if (!is_file($this->sFile)) {
if (isDebug()) {
throw new \PH7\Framework\Error\CException\PH7BadMethodCallException('Image file not found: The image file \'' . $this->sFile . '\' could not be found.');
} else {
return false;
}
} else {
$this->aInfo = getimagesize($this->sFile);
switch ($this->aInfo[2]) {
// JPG
case self::JPG:
$this->rImage = imagecreatefromjpeg($this->sFile);
$this->sType = 'jpg';
break;
// PNG
// PNG
case self::PNG:
$this->rImage = imagecreatefrompng($this->sFile);
$this->sType = 'png';
break;
// GIF
// GIF
case self::GIF:
$this->rImage = imagecreatefromgif($this->sFile);
$this->sType = 'gif';
break;
// Invalid Zone
// Invalid Zone
default:
return false;
// File type incompatible. Please save the image in .jpg, .png or .gif
}
$this->iWidth = imagesx($this->rImage);
$this->iHeight = imagesy($this->rImage);
// Automatic resizing if the image is too large
if ($this->iWidth > $this->iMaxWidth or $this->iHeight > $this->iMaxHeight) {
$this->dynamicResize($this->iMaxWidth, $this->iMaxHeight);
}
return true;
}
}
示例13: getPage
function getPage($url)
{
debug($url, 'json');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.5 Safari/537.17");
$page = curl_exec($ch);
if (curl_errno($ch)) {
echo '<font color=red> Database temporarily unavailable: ';
echo curl_errno($ch) . ' ' . curl_error($ch);
if (isDebug()) {
echo $url;
}
echo '</font><br>';
}
curl_close($ch);
debug(print_r($page, true), 'json');
return $page;
}
示例14: i18n_r
}
}
echo '</div>';
if ($allowcreatefolder) {
echo '<div id="new-folder">
<a href="#" id="createfolder">' . i18n_r('CREATE_FOLDER') . '</a>
<form action="upload.php"> <input type="hidden" name="path" value="' . $subPath . '" />
<input type="hidden" name="nonce" value="' . get_nonce("createfolder") . '" />
<input type="text" class="text" name="newfolder" id="foldername" />
<input type="submit" class="submit" value="' . i18n_r('CREATE_FOLDER') . '" />
<a href="#" class="cancel">' . i18n_r('CANCEL') . '</a>
</form>
</div>';
}
echo '</div>';
$showperms = $isUnixHost && isDebug() && function_exists('posix_getpwuid');
echo '<table class="highlight" id="imageTable"><thead>';
echo '<tr><th class="imgthumb" ></th><th>' . i18n_r('FILE_NAME') . '</th>';
echo '<th class="file_size right">' . i18n_r('FILE_SIZE') . '</th>';
if ($showperms) {
echo '<th class="file_perms right">' . i18n_r('PERMS') . '</th>';
}
echo '<th class="file_date right">' . i18n_r('DATE') . '</th>';
echo '<th class="file_actions"><!-- actions --></th></tr>';
echo '</thead><tbody>';
if (count($dirsSorted) != 0) {
$foldercount = 0;
// show folders
foreach ($dirsSorted as $upload) {
# check to see if folder is empty
$directory_delete = null;
示例15: setBackground
/**
* Set a background on user profile.
*
* @param integer $iProfileId
* @param string $sUsername
* @param string $sFile
* @param integer $iApproved (1 = approved 0 = pending) Default 1
* @return boolean TRUE if succes, FALSE if the extension is wrong.
*/
public function setBackground($iProfileId, $sUsername, $sFile, $iApproved = 1)
{
/**
* This can cause minor errors (eg if a user sent a file that is not a photo).
* So we hide the errors if we are not in development mode.
*/
if (!isDebug()) {
error_reporting(0);
}
$oWallpaper = new Framework\Image\Image($sFile, 600, 800);
if (!$oWallpaper->validate()) {
return false;
}
// We removes the old background if it exists and we delete the cache at the same time.
$this->deleteBackground($iProfileId, $sUsername);
$sPath = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'user/background/img/' . $sUsername . PH7_SH;
(new File())->createDir($sPath);
$sFileName = Various::genRnd($oWallpaper->getFileName(), 1);
$sFile = $sFileName . '.' . $oWallpaper->getExt();
// Add the profile background
(new UserCoreModel())->addBackground($iProfileId, $sFile, $iApproved);
// Saved the new background
$oWallpaper->save($sPath . $sFile);
unset($oWallpaper);
return true;
}