diff --git a/src/admin/file_class.php b/src/admin/file_class.php index 04c4b9d4..a5e4a3e1 100644 --- a/src/admin/file_class.php +++ b/src/admin/file_class.php @@ -1,5 +1,5 @@ '; exit (); } else { - header ( "location:/404.html" ); + header ("location:/404.html"); die (); } } diff --git a/src/system/autoload7.inc.php b/src/system/autoload7.inc.php index f4f83ae6..272974b0 100755 --- a/src/system/autoload7.inc.php +++ b/src/system/autoload7.inc.php @@ -1,5 +1,5 @@ '; exit (); } else { - header ( "location:/404.html" ); + header ("location:/404.html"); die (); } } diff --git a/src/system/channelunit.class.php b/src/system/channelunit.class.php index 1049c109..fc5dae46 100755 --- a/src/system/channelunit.class.php +++ b/src/system/channelunit.class.php @@ -1,5 +1,5 @@ * if (!function_exists('HelloDede')) * { @@ -240,10 +240,10 @@ if (!function_exists('CheckSql')) { * } * } * - * 开发中使用这个小助手的时候直接使用函数helper('test');初始化它,然后在文件中就可以直接使用:HelloDede();调用 + * 开发中使用这个助手的时候直接使用函数helper('test');初始化它,然后在文件中就可以直接使用:HelloDede();调用 * * @access public - * @param mix $helpers 小助手名称,可以是数组,可以是单个字符串 + * @param mix $helpers 助手名称,可以是数组,可以是单个字符串 * @return void */ $_helpers = array(); @@ -263,7 +263,7 @@ function helper($helpers) include_once(DEDEINC.'/helpers/'.$helpers.'.helper.php'); $_helpers[$helpers] = TRUE; } - //无法载入小助手 + //无法载入助手 if (!isset($_helpers[$helpers])) { exit('Unable to load the requested file: helpers/'.$helpers.'.helper.php'); } @@ -276,7 +276,7 @@ function dede_htmlspecialchars($str) else return htmlspecialchars($str); } /** - * 载入小助手,这里会员可能载入用helps载入多个小助手 + * 载入助手,这里会员可能载入用helps载入多个助手 * * @access public * @param string diff --git a/src/system/common.inc.php b/src/system/common.inc.php index 426a2cc9..5b8f1842 100755 --- a/src/system/common.inc.php +++ b/src/system/common.inc.php @@ -263,23 +263,23 @@ if ($GLOBALS['cfg_dbtype'] == 'mysql' || $GLOBALS['cfg_dbtype'] == 'mysqli') { } else { require_once(DEDEINC.'/database/dedesqlite.class.php'); } -//载入小助手配置,并对其进行默认初始化 +//载入助手配置,并对其进行默认初始化 $cfg_helper_autoload = array( - 'charset', /* 编码小助手 */ - 'channelunit',/* 模型单元小助手 */ - 'string', /* 字符串小助手 */ - 'time', /* 日期小助手 */ - 'file', /* 文件小助手 */ - 'util', /* 单元小助手 */ - 'validate', /* 数据验证小助手 */ - 'filter', /* 过滤器小助手 */ - 'cookie', /* cookies小助手 */ - 'debug', /* 调试小助手 */ - 'archive', /* 文档小助手 */ - 'upload', /* 上传小助手 */ - 'extend', /* 扩展小助手 */ - 'code', /* 代码小助手 */ + 'charset', /* 编码助手 */ + 'channelunit',/* 模型单元助手 */ + 'string', /* 字符串助手 */ + 'time', /* 日期助手 */ + 'file', /* 文件助手 */ + 'util', /* 单元助手 */ + 'validate', /* 数据验证助手 */ + 'filter', /* 过滤器助手 */ + 'cookie', /* cookies助手 */ + 'debug', /* 调试助手 */ + 'archive', /* 文档助手 */ + 'upload', /* 上传助手 */ + 'extend', /* 扩展助手 */ + 'code', /* 代码助手 */ ); -//初始化小助手 +//初始化助手 helper($cfg_helper_autoload); ?> \ No newline at end of file diff --git a/src/system/customfields.func.php b/src/system/customfields.func.php index 33996a22..3be2e9c8 100755 --- a/src/system/customfields.func.php +++ b/src/system/customfields.func.php @@ -1,5 +1,5 @@ SourceString); - //这里是获得Tag的名称,可视情况是否需要 - //如果不在这个里解析,则在解析整个Tag时解析 - //属性中不应该存在tagname这个名称 + //这里是获得Tag的名称,可视情况是否需要,如果不在这个里解析,则在解析整个Tag时解析,属性中不应该存在tagname这个名称 for ($i = 0; $i < $strLen; $i++) { $d = substr($this->SourceString, $i, 1); if ($d == ' ') { @@ -155,7 +153,6 @@ class DedeAttParse } else if ($startdd == 0) { switch ($d) { case ' ': - //continue; break; case '\'': $ddtag = '\''; @@ -174,7 +171,7 @@ class DedeAttParse } else if ($startdd == 1) { if ($d == $ddtag) { $this->CAtt->Count++; - $this->CAtt->Items[$tmpatt] = trim($tmpvalue); //strtolower(trim($tmpvalue)); + $this->CAtt->Items[$tmpatt] = trim($tmpvalue); $tmpatt = ""; $tmpvalue = ""; $startdd = -1; @@ -185,10 +182,9 @@ class DedeAttParse } if ($tmpatt != "") { $this->CAtt->Count++; - $this->CAtt->Items[$tmpatt] = trim($tmpvalue); //strtolower(trim($tmpvalue)); - } //完成属性解析 - - } //for - } //has Attribute -}//End DedeAttParse + $this->CAtt->Items[$tmpatt] = trim($tmpvalue); + } + } + } +} ?> \ No newline at end of file diff --git a/src/system/dedecollection.func.php b/src/system/dedecollection.func.php index 5376ce08..8f615abc 100644 --- a/src/system/dedecollection.func.php +++ b/src/system/dedecollection.func.php @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/src/system/enums.func.php b/src/system/enums.func.php index ecaff0fb..d167f8a8 100755 --- a/src/system/enums.func.php +++ b/src/system/enums.func.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/src/system/filter.inc.php b/src/system/filter.inc.php index b580af52..ffb92511 100755 --- a/src/system/filter.inc.php +++ b/src/system/filter.inc.php @@ -1,5 +1,5 @@ $_v) { ${$_k} = _FilterAll($_k, $_v); diff --git a/src/system/helpers/archive.helper.php b/src/system/helpers/archive.helper.php index e6fd0bde..20317a20 100755 --- a/src/system/helpers/archive.helper.php +++ b/src/system/helpers/archive.helper.php @@ -1,7 +1,7 @@ __construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans, $trueMarkimg, $attach); diff --git a/src/system/image.func.php b/src/system/image.func.php index 53e6e6d3..a72d84ae 100755 --- a/src/system/image.func.php +++ b/src/system/image.func.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/src/system/inc/inc_fun_funAdmin.php b/src/system/inc/inc_fun_funAdmin.php index 888e75e6..423ec1d9 100755 --- a/src/system/inc/inc_fun_funAdmin.php +++ b/src/system/inc/inc_fun_funAdmin.php @@ -1,5 +1,5 @@ ||/isU","",$str); diff --git a/src/system/libraries/agent.class.php b/src/system/libraries/agent.class.php index f79051c7..129c31db 100644 --- a/src/system/libraries/agent.class.php +++ b/src/system/libraries/agent.class.php @@ -1,5 +1,5 @@ $value) { - if (mb_strpos($value, ' ') !== false) - { + if (mb_strpos($value, ' ') !== false) { $value = '"'.$value.'"'; } $out .= "-{$name} $value "; @@ -124,8 +104,7 @@ class DedeCli } public static function newLine(int $num = 1) { - for ($i = 0; $i < $num; $i++) - { + for ($i = 0; $i < $num; $i++) { static::write(''); } } @@ -135,25 +114,20 @@ class DedeCli } public static function color(string $text, string $foreground, string $background = null, string $format = null) { - if (static::isWindows() && ! isset($_SERVER['ANSICON'])) - { + if (static::isWindows() && ! isset($_SERVER['ANSICON'])) { return $text; } - if ( ! array_key_exists($foreground, static::$foreground_colors)) - { + if ( ! array_key_exists($foreground, static::$foreground_colors)) { throw new \RuntimeException('Invalid CLI foreground color: '.$foreground); } - if ($background !== null && ! array_key_exists($background, static::$background_colors)) - { + if ($background !== null && ! array_key_exists($background, static::$background_colors)) { throw new \RuntimeException('Invalid CLI background color: '.$background); } $string = "\033[".static::$foreground_colors[$foreground]."m"; - if ($background !== null) - { + if ($background !== null) { $string .= "\033[".static::$background_colors[$background]."m"; } - if ($format === 'underline') - { + if ($format === 'underline') { $string .= "\033[4m"; } $string .= $text."\033[0m"; @@ -161,16 +135,14 @@ class DedeCli } public static function getWidth(int $default = 80): int { - if (static::isWindows()) - { + if (static::isWindows()) { return $default; } return (int)shell_exec('tput cols'); } public static function getHeight(int $default = 32): int { - if (static::isWindows()) - { + if (static::isWindows()) { return $default; } return (int)shell_exec('tput lines'); @@ -178,13 +150,11 @@ class DedeCli public static function showProgress($thisStep = 1, int $totalSteps = 10, int $pos = 0,int $total = 0) { static $inProgress = false; - if ($inProgress !== false && $inProgress <= $thisStep) - { + if ($inProgress !== false && $inProgress <= $thisStep) { fwrite(STDOUT, "\033[1A"); } $inProgress = $thisStep; - if ($thisStep !== false) - { + if ($thisStep !== false) { $thisStep = abs($thisStep); $totalSteps = $totalSteps < 1 ? 1 : $totalSteps; $percent = intval(($thisStep / $totalSteps) * 100); @@ -201,28 +171,23 @@ class DedeCli } public static function wrap(string $string = null, int $max = 0, int $pad_left = 0): string { - if (empty($string)) - { + if (empty($string)) { return ''; } - if ($max == 0) - { + if ($max == 0) { $max = DedeCli::getWidth(); } - if (DedeCli::getWidth() < $max) - { + if (DedeCli::getWidth() < $max) { $max = DedeCli::getWidth(); } $max = $max - $pad_left; $lines = wordwrap($string, $max); - if ($pad_left > 0) - { + if ($pad_left > 0) { $lines = explode(PHP_EOL, $lines); $first = true; array_walk($lines, function (&$line, $index) use ($max, $pad_left, &$first) { - if ( ! $first) - { + if ( ! $first) { $line = str_repeat(" ", $pad_left).$line; } else { $first = false; @@ -240,25 +205,19 @@ class DedeCli } public static function input(string $prefix = null): string { - if (static::$readline_support) - { + if (static::$readline_support) { return readline($prefix); } echo $prefix; return fgets(STDIN); } /** - * 询问会员输入.这个可以1个或2个参数. - * - * 使用: - * + * 询问会员输入,可以1个或2个参数 + * * //等待任何输入 * DedeCli::prompt(); - * * $color = DedeCli::prompt('What is your favorite color?'); - * * $color = DedeCli::prompt('What is your favourite color?', 'white'); - * * $ready = DedeCli::prompt('Are you ready?', array('y','n')); * * @return string the user input @@ -298,29 +257,21 @@ class DedeCli $output = $args[0]; } break; - } - if ($output !== '') - { + } if ($output !== '') { $extra_output = ''; - if ($default !== null) - { + if ($default !== null) { $extra_output = ' [ Default: "'.$default.'" ]'; - } - elseif ($options !== []) - { + } elseif ($options !== []) { $extra_output = ' [ '.implode(', ', $options).' ]'; } fwrite(STDOUT, $output.$extra_output.': '); } $input = trim(static::input()) ? : $default; - if (empty($input) && $required === true) - { + if (empty($input) && $required === true) { static::write('This is required.'); static::newLine(); $input = forward_static_call_array([__CLASS__, 'prompt'], $args); - } - if ( ! empty($options) && ! in_array($input, $options)) - { + } if (! empty($options) && ! in_array($input, $options)) { static::write('This is not a valid option. Please try again.'); static::newLine(); $input = forward_static_call_array([__CLASS__, 'prompt'], $args); @@ -329,8 +280,7 @@ class DedeCli } public static function wait(int $seconds, bool $countdown = false) { - if ($countdown === true) - { + if ($countdown === true) { $time = $seconds; while ($time > 0) { @@ -340,8 +290,7 @@ class DedeCli } static::write(); } else { - if ($seconds > 0) - { + if ($seconds > 0) { sleep($seconds); } else { static::write(static::$wait_msg); @@ -351,16 +300,14 @@ class DedeCli } public static function error(string $text, string $foreground = 'light_red', string $background = null) { - if ($foreground || $background) - { + if ($foreground || $background) { $text = static::color($text, $foreground, $background); } fwrite(STDERR, $text.PHP_EOL); } public static function write(string $text = '', string $foreground = null, string $background = null) { - if ($foreground || $background) - { + if ($foreground || $background) { $text = static::color($text, $foreground, $background); } fwrite(STDOUT, $text.PHP_EOL); diff --git a/src/system/libraries/crawlerdetect.class.php b/src/system/libraries/crawlerdetect.class.php index 3844f2fc..3ebd6575 100644 --- a/src/system/libraries/crawlerdetect.class.php +++ b/src/system/libraries/crawlerdetect.class.php @@ -1,5 +1,5 @@ filters[] = $filter; return $this; } - /** * Apply filters. * @@ -101,7 +86,6 @@ class ImageResize $function($image, $filterType); } } - /** * Loads image source and its properties to the instanciated object * @@ -114,15 +98,12 @@ class ImageResize if (!defined('IMAGETYPE_WEBP')) { define('IMAGETYPE_WEBP', 18); } - if (!defined('IMAGETYPE_BMP')) { define('IMAGETYPE_BMP', 6); } - if ($filename === null || empty($filename) || (substr($filename, 0, 5) !== 'data:' && !is_file($filename))) { throw new ImageResizeException('File does not exist'); } - $finfo = finfo_open(FILEINFO_MIME_TYPE); $checkWebp = false; if (strstr(finfo_file($finfo, $filename), 'image') === false) { @@ -136,91 +117,68 @@ class ImageResize $checkWebp = true; $this->source_type = IMAGETYPE_WEBP; } - if (!$image_info = getimagesize($filename, $this->source_info)) { $image_info = getimagesize($filename); } - if (!$checkWebp) { if (!$image_info) { if (strstr(finfo_file($finfo, $filename), 'image') !== false) { throw new ImageResizeException('Unsupported image type'); } - throw new ImageResizeException('Could not read file'); } - $this->original_w = $image_info[0]; $this->original_h = $image_info[1]; $this->source_type = $image_info[2]; } - switch ($this->source_type) { case IMAGETYPE_GIF: $this->source_image = imagecreatefromgif($filename); break; - case IMAGETYPE_JPEG: $this->source_image = $this->imageCreateJpegfromExif($filename); - // set new width and height for image, maybe it has changed $this->original_w = imagesx($this->source_image); $this->original_h = imagesy($this->source_image); - break; - case IMAGETYPE_PNG: $this->source_image = imagecreatefrompng($filename); break; - case IMAGETYPE_WEBP: $this->source_image = imagecreatefromwebp($filename); $this->original_w = imagesx($this->source_image); $this->original_h = imagesy($this->source_image); - break; - case IMAGETYPE_BMP: if (version_compare(PHP_VERSION, '7.2.0', '<')) { throw new ImageResizeException('For bmp support PHP >= 7.2.0 is required'); } $this->source_image = imagecreatefrombmp($filename); break; - default: throw new ImageResizeException('Unsupported image type'); } - if (!$this->source_image) { throw new ImageResizeException('Could not load image'); } - finfo_close($finfo); - return $this->resize($this->getSourceWidth(), $this->getSourceHeight()); } - - // http://stackoverflow.com/a/28819866 + //http://stackoverflow.com/a/28819866 public function imageCreateJpegfromExif($filename) { $img = imagecreatefromjpeg($filename); - if (!function_exists('exif_read_data') || !isset($this->source_info['APP1']) || strpos($this->source_info['APP1'], 'Exif') !== 0) { return $img; - } - - try { + } try { $exif = @exif_read_data($filename); } catch (Exception $e) { $exif = null; } - if (!$exif || !isset($exif['Orientation'])) { return $img; } - $orientation = $exif['Orientation']; - if ($orientation === 6 || $orientation === 5) { $img = imagerotate($img, 270, 0); } elseif ($orientation === 3 || $orientation === 4) { @@ -228,14 +186,11 @@ class ImageResize } elseif ($orientation === 8 || $orientation === 7) { $img = imagerotate($img, 90, 0); } - if ($orientation === 5 || $orientation === 4 || $orientation === 7) { imageflip($img, IMG_FLIP_HORIZONTAL); } - return $img; } - /** * Saves new image * @@ -250,70 +205,61 @@ class ImageResize { $image_type = $image_type ?: $this->source_type; $quality = is_numeric($quality) ? (int) abs($quality) : null; - switch ($image_type) { case IMAGETYPE_GIF: - if( !empty($exact_size) && is_array($exact_size) ){ + if (!empty($exact_size) && is_array($exact_size)) { $dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]); - } else{ + } else { $dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight()); } - $background = imagecolorallocatealpha($dest_image, 255, 255, 255, 1); imagecolortransparent($dest_image, $background); imagefill($dest_image, 0, 0, $background); imagesavealpha($dest_image, true); break; - case IMAGETYPE_JPEG: - if( !empty($exact_size) && is_array($exact_size) ){ + if (!empty($exact_size) && is_array($exact_size)) { $dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]); $background = imagecolorallocate($dest_image, 255, 255, 255); imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background); - } else{ + } else { $dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight()); $background = imagecolorallocate($dest_image, 255, 255, 255); imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background); } break; - case IMAGETYPE_WEBP: if (version_compare(PHP_VERSION, '5.5.0', '<')) { throw new ImageResizeException('For WebP support PHP >= 5.5.0 is required'); } - if( !empty($exact_size) && is_array($exact_size) ){ + if (!empty($exact_size) && is_array($exact_size)) { $dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]); $background = imagecolorallocate($dest_image, 255, 255, 255); imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background); - } else{ + } else { $dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight()); $background = imagecolorallocate($dest_image, 255, 255, 255); imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background); } - imagealphablending($dest_image, false); imagesavealpha($dest_image, true); - break; - case IMAGETYPE_PNG: if (!$this->quality_truecolor || !imageistruecolor($this->source_image)) { - if( !empty($exact_size) && is_array($exact_size) ){ + if (!empty($exact_size) && is_array($exact_size)) { $dest_image = imagecreate($exact_size[0], $exact_size[1]); - } else{ + } else { $dest_image = imagecreate($this->getDestWidth(), $this->getDestHeight()); } } else { - if( !empty($exact_size) && is_array($exact_size) ){ + if(!empty($exact_size) && is_array($exact_size)) { $dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]); - } else{ + } else { $dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight()); } } - imagealphablending($dest_image, false); imagesavealpha($dest_image, true); - $background = imagecolorallocatealpha($dest_image, 255, 255, 255, 127); imagecolortransparent($dest_image, $background); imagefill($dest_image, 0, 0, $background); @@ -323,8 +269,7 @@ class ImageResize if (version_compare(PHP_VERSION, '7.2.0', '<')) { throw new ImageResizeException('For WebP support PHP >= 7.2.0 is required'); } - - if(!empty($exact_size) && is_array($exact_size)) { + if (!empty($exact_size) && is_array($exact_size)) { $dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]); $background = imagecolorallocate($dest_image, 255, 255, 255); imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background); @@ -335,14 +280,11 @@ class ImageResize } break; } - imageinterlace($dest_image, $this->interlace); - if ($this->gamma_correct) { imagegammacorrect($this->source_image, 2.2, 1.0); } - - if( !empty($exact_size) && is_array($exact_size) ) { + if (!empty($exact_size) && is_array($exact_size)) { if ($this->getSourceHeight() < $this->getSourceWidth()) { $this->dest_x = 0; $this->dest_y = ($exact_size[1] - $this->getDestHeight()) / 2; @@ -352,7 +294,6 @@ class ImageResize $this->dest_y = 0; } } - imagecopyresampled( $dest_image, $this->source_image, @@ -365,27 +306,20 @@ class ImageResize $this->source_w, $this->source_h ); - if ($this->gamma_correct) { imagegammacorrect($dest_image, 1.0, 2.2); } - - $this->applyFilter($dest_image); - switch ($image_type) { case IMAGETYPE_GIF: imagegif($dest_image, $filename); break; - case IMAGETYPE_JPEG: if ($quality === null || $quality > 100) { $quality = $this->quality_jpg; } - imagejpeg($dest_image, $filename, $quality); break; - case IMAGETYPE_WEBP: if (version_compare(PHP_VERSION, '5.5.0', '<')) { throw new ImageResizeException('For WebP support PHP >= 5.5.0 is required'); @@ -393,32 +327,24 @@ class ImageResize if ($quality === null) { $quality = $this->quality_webp; } - imagewebp($dest_image, $filename, $quality); break; - case IMAGETYPE_PNG: if ($quality === null || $quality > 9) { $quality = $this->quality_png; } - imagepng($dest_image, $filename, $quality); break; - case IMAGETYPE_BMP: imagebmp($dest_image, $filename, $quality); break; } - if ($permissions) { chmod($filename, $permissions); } - imagedestroy($dest_image); - return $this; } - /** * Convert the image to string * @@ -429,16 +355,11 @@ class ImageResize public function getImageAsString($image_type = null, $quality = null) { $string_temp = tempnam(sys_get_temp_dir(), ''); - $this->save($string_temp, $image_type, $quality); - $string = file_get_contents($string_temp); - unlink($string_temp); - return $string; } - /** * Convert the image to string with the current settings * @@ -448,7 +369,6 @@ class ImageResize { return $this->getImageAsString(); } - /** * Outputs image to browser * @param string $image_type @@ -457,12 +377,9 @@ class ImageResize public function output($image_type = null, $quality = null) { $image_type = $image_type ?: $this->source_type; - header('Content-Type: '.image_type_to_mime_type($image_type)); - $this->save(null, $image_type, $quality); } - /** * Resizes image according to the given short side (short side proportional) * @@ -475,18 +392,14 @@ class ImageResize if ($this->getSourceHeight() < $this->getSourceWidth()) { $ratio = $max_short / $this->getSourceHeight(); $long = (int) ($this->getSourceWidth() * $ratio); - $this->resize($long, $max_short, $allow_enlarge); } else { $ratio = $max_short / $this->getSourceWidth(); $long = (int) ($this->getSourceHeight() * $ratio); - $this->resize($max_short, $long, $allow_enlarge); } - return $this; } - /** * Resizes image according to the given long side (short side proportional) * @@ -499,18 +412,14 @@ class ImageResize if ($this->getSourceHeight() > $this->getSourceWidth()) { $ratio = $max_long / $this->getSourceHeight(); $short = (int) ($this->getSourceWidth() * $ratio); - $this->resize($short, $max_long, $allow_enlarge); } else { $ratio = $max_long / $this->getSourceWidth(); $short = (int) ($this->getSourceHeight() * $ratio); - $this->resize($max_long, $short, $allow_enlarge); } - return $this; } - /** * Resizes image according to the given height (width proportional) * @@ -522,12 +431,9 @@ class ImageResize { $ratio = $height / $this->getSourceHeight(); $width = (int) ($this->getSourceWidth() * $ratio); - $this->resize($width, $height, $allow_enlarge); - return $this; } - /** * Resizes image according to the given width (height proportional) * @@ -539,12 +445,9 @@ class ImageResize { $ratio = $width / $this->getSourceWidth(); $height = (int) ($this->getSourceHeight() * $ratio); - $this->resize($width, $height, $allow_enlarge); - return $this; } - /** * Resizes image to best fit inside the given dimensions * @@ -558,19 +461,15 @@ class ImageResize if ($this->getSourceWidth() <= $max_width && $this->getSourceHeight() <= $max_height && $allow_enlarge === false) { return $this; } - $ratio = $this->getSourceHeight() / $this->getSourceWidth(); $width = $max_width; $height = (int) ($width * $ratio); - if ($height > $max_height) { $height = $max_height; $width = (int) ($height / $ratio); } - return $this->resize($width, $height, $allow_enlarge); } - /** * Resizes image according to given scale (proportionally) * @@ -581,12 +480,9 @@ class ImageResize { $width = (int) ($this->getSourceWidth() * $scale / 100); $height = (int) ($this->getSourceHeight() * $scale / 100); - $this->resize($width, $height, true); - return $this; } - /** * Resizes image according to the given width and height * @@ -601,25 +497,19 @@ class ImageResize // if the user hasn't explicitly allowed enlarging, // but either of the dimensions are larger then the original, // then just use original dimensions - this logic may need rethinking - if ($width > $this->getSourceWidth() || $height > $this->getSourceHeight()) { $width = $this->getSourceWidth(); $height = $this->getSourceHeight(); } } - $this->source_x = 0; $this->source_y = 0; - $this->dest_w = $width; $this->dest_h = $height; - $this->source_w = $this->getSourceWidth(); $this->source_h = $this->getSourceHeight(); - return $this; } - /** * Crops image according to the given width, height and crop position * @@ -635,42 +525,30 @@ class ImageResize // this logic is slightly different to resize(), // it will only reset dimensions to the original // if that particular dimenstion is larger - if ($width > $this->getSourceWidth()) { $width = $this->getSourceWidth(); } - if ($height > $this->getSourceHeight()) { $height = $this->getSourceHeight(); } } - $ratio_source = $this->getSourceWidth() / $this->getSourceHeight(); $ratio_dest = $width / $height; - if ($ratio_dest < $ratio_source) { $this->resizeToHeight($height, $allow_enlarge); - $excess_width = (int) (($this->getDestWidth() - $width) * $this->getSourceWidth() / $this->getDestWidth()); - $this->source_w = $this->getSourceWidth() - $excess_width; $this->source_x = $this->getCropPosition($excess_width, $position); - $this->dest_w = $width; } else { $this->resizeToWidth($width, $allow_enlarge); - $excess_height = (int) (($this->getDestHeight() - $height) * $this->getSourceHeight() / $this->getDestHeight()); - $this->source_h = $this->getSourceHeight() - $excess_height; $this->source_y = $this->getCropPosition($excess_height, $position); - $this->dest_h = $height; } - return $this; } - /** * Crops image according to the given width, height, x and y * @@ -692,19 +570,15 @@ class ImageResize } else { $this->source_w = $width; } - if ($height > $this->getSourceHeight() - $y) { $this->source_h = $this->getSourceHeight() - $y; } else { $this->source_h = $height; } - $this->dest_w = $width; $this->dest_h = $height; - return $this; } - /** * Gets source width * @@ -714,7 +588,6 @@ class ImageResize { return $this->original_w; } - /** * Gets source height * @@ -724,7 +597,6 @@ class ImageResize { return $this->original_h; } - /** * Gets width of the destination image * @@ -734,7 +606,6 @@ class ImageResize { return $this->dest_w; } - /** * Gets height of the destination image * @return integer @@ -743,7 +614,6 @@ class ImageResize { return $this->dest_h; } - /** * Gets crop position (X or Y) according to the given position * @@ -769,7 +639,6 @@ class ImageResize } return (int) $size; } - /** * Enable or not the gamma color correction on the image, enabled by default * @@ -779,7 +648,6 @@ class ImageResize public function gamma($enable = false) { $this->gamma_correct = $enable; - return $this; } } \ No newline at end of file diff --git a/src/system/libraries/jsonq/Condition.php b/src/system/libraries/jsonq/Condition.php index c0925de2..7ec44e51 100644 --- a/src/system/libraries/jsonq/Condition.php +++ b/src/system/libraries/jsonq/Condition.php @@ -1,5 +1,5 @@ diff --git a/src/system/sdks/WeMini/crypt/wxBizDataCrypt.php b/src/system/sdks/WeMini/crypt/wxBizDataCrypt.php index 8150692a..82b223fd 100644 --- a/src/system/sdks/WeMini/crypt/wxBizDataCrypt.php +++ b/src/system/sdks/WeMini/crypt/wxBizDataCrypt.php @@ -1,5 +1,5 @@ true, diff --git a/src/system/sdks/_test/config.php b/src/system/sdks/_test/config.php index 7497d241..a2462aa9 100644 --- a/src/system/sdks/_test/config.php +++ b/src/system/sdks/_test/config.php @@ -1,5 +1,5 @@ function ($name, $value, $expired = 360) { diff --git a/src/system/sdks/_test/mini-login.php b/src/system/sdks/_test/mini-login.php index 4e60b9ac..be2b3279 100644 --- a/src/system/sdks/_test/mini-login.php +++ b/src/system/sdks/_test/mini-login.php @@ -1,5 +1,5 @@ '',//企业id 'appsecret' => '',//应用的凭证密钥 diff --git a/src/system/sdks/_test/work-department.php b/src/system/sdks/_test/work-department.php index 58e57122..98d0a603 100644 --- a/src/system/sdks/_test/work-department.php +++ b/src/system/sdks/_test/work-department.php @@ -1,5 +1,5 @@