diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/core/CodeIgniter.php | 40 | ||||
-rw-r--r-- | system/core/Common.php | 5 | ||||
-rw-r--r-- | system/core/Security.php | 2 | ||||
-rw-r--r-- | system/database/DB_driver.php | 2 | ||||
-rw-r--r-- | system/database/DB_forge.php | 2 | ||||
-rw-r--r-- | system/database/DB_query_builder.php | 2 | ||||
-rw-r--r-- | system/database/DB_result.php | 14 | ||||
-rw-r--r-- | system/libraries/Image_lib.php | 76 |
8 files changed, 82 insertions, 61 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 8c936e018..d830c1829 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -159,6 +159,29 @@ if ( ! is_php('5.4')) /* * ------------------------------------------------------ + * Should we use a Composer autoloader? + * ------------------------------------------------------ + */ + if ($composer_autoload = config_item('composer_autoload')) + { + if ($composer_autoload === TRUE) + { + file_exists(APPPATH.'vendor/autoload.php') + ? require_once(APPPATH.'vendor/autoload.php') + : log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.'); + } + elseif (file_exists($composer_autoload)) + { + require_once($composer_autoload); + } + else + { + log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload); + } + } + +/* + * ------------------------------------------------------ * Start the timer... tick tock tick tock... * ------------------------------------------------------ */ @@ -461,23 +484,6 @@ if ( ! is_php('5.4')) /* * ------------------------------------------------------ - * Should we use a Composer autoloader? - * ------------------------------------------------------ - */ - if ($composer_autoload = config_item('composer_autoload')) - { - if ($composer_autoload === TRUE && file_exists(APPPATH.'vendor/autoload.php')) - { - require_once(APPPATH.'vendor/autoload.php'); - } - elseif (file_exists($composer_autoload)) - { - require_once($composer_autoload); - } - } - -/* - * ------------------------------------------------------ * Is there a "pre_controller" hook? * ------------------------------------------------------ */ diff --git a/system/core/Common.php b/system/core/Common.php index 5c5672e99..c3198b31f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -555,15 +555,14 @@ if ( ! function_exists('set_status_header')) } } - $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - if (strpos(PHP_SAPI, 'cgi') === 0) { header('Status: '.$code.' '.$text, TRUE); } else { - header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); + $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; + header($server_protocol.' '.$code.' '.$text, TRUE, $code); } } } diff --git a/system/core/Security.php b/system/core/Security.php index 8b3149c07..7c18c7406 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -75,7 +75,7 @@ class CI_Security { /** * Character set * - * Will be overriden by the constructor. + * Will be overridden by the constructor. * * @var string */ diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index dd93abc11..a0803f170 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1643,7 +1643,7 @@ abstract class CI_DB_driver { /** * Close DB Connection * - * This method would be overriden by most of the drivers. + * This method would be overridden by most of the drivers. * * @return void */ diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index c8d773c98..f6ee2a63a 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -828,7 +828,7 @@ abstract class CI_DB_forge { */ protected function _attr_type(&$attributes) { - // Usually overriden by drivers + // Usually overridden by drivers } // -------------------------------------------------------------------- diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index c9377e082..79cbfb3ad 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1699,7 +1699,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * Groups tables in FROM clauses if needed, so there is no confusion * about operator precedence. * - * Note: This is only used (and overriden) by MySQL and CUBRID. + * Note: This is only used (and overridden) by MySQL and CUBRID. * * @return string */ diff --git a/system/database/DB_result.php b/system/database/DB_result.php index af58e3c39..746f2a110 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -556,7 +556,7 @@ class CI_DB_result { /** * Number of fields in the result set * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return int */ @@ -572,7 +572,7 @@ class CI_DB_result { * * Generates an array of column names. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return array */ @@ -588,7 +588,7 @@ class CI_DB_result { * * Generates an array of objects containing field meta-data. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return array */ @@ -602,7 +602,7 @@ class CI_DB_result { /** * Free the result * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return void */ @@ -620,7 +620,7 @@ class CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @param int $n * @return bool @@ -637,7 +637,7 @@ class CI_DB_result { * * Returns the result set as an array. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return array */ @@ -653,7 +653,7 @@ class CI_DB_result { * * Returns the result set as an object. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @param string $class_name * @return object diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 92e47507f..e056654bb 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1311,12 +1311,14 @@ class CI_Image_lib { $y_axis = $this->wm_vrt_offset + $this->wm_padding; if ($this->wm_use_drop_shadow === FALSE) + { $this->wm_shadow_distance = 0; + } $this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]); $this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]); - // Set verticle alignment + // Set vertical alignment if ($this->wm_vrt_alignment === 'M') { $y_axis += ($this->orig_height / 2) + ($fontheight / 2); @@ -1325,53 +1327,67 @@ class CI_Image_lib { { $y_axis += $this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight / 2); } - - $x_shad = $x_axis + $this->wm_shadow_distance; - $y_shad = $y_axis + $this->wm_shadow_distance; - + + // Set horizontal alignment + if ($this->wm_hor_alignment === 'R') + { + $x_axis += $this->orig_width - ($fontwidth * strlen($this->wm_text)) - $this->wm_shadow_distance; + } + elseif ($this->wm_hor_alignment === 'C') + { + $x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); + } + if ($this->wm_use_drop_shadow) { - // Set horizontal alignment - if ($this->wm_hor_alignment === 'R') - { - $x_shad += $this->orig_width - ($fontwidth * strlen($this->wm_text)); - $x_axis += $this->orig_width - ($fontwidth * strlen($this->wm_text)); - } - elseif ($this->wm_hor_alignment === 'C') - { - $x_shad += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); - $x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); - } - - /* Set RGB values for text and shadow + // Offset from text + $x_shad = $x_axis + $this->wm_shadow_distance; + $y_shad = $y_axis + $this->wm_shadow_distance; + + /* Set RGB values for shadow * * First character is #, so we don't really need it. * Get the rest of the string and split it into 2-length * hex values: */ - $txt_color = str_split(substr($this->wm_font_color, 1, 6), 2); - $txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2])); $drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2); $drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[1]), hexdec($drp_color[2])); - - // Add the text to the source image + + // Add the shadow to the source image if ($this->wm_use_truetype) { imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); - imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); } else { imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); - imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); } + } + + /* Set RGB values for text + * + * First character is #, so we don't really need it. + * Get the rest of the string and split it into 2-length + * hex values: + */ + $txt_color = str_split(substr($this->wm_font_color, 1, 6), 2); + $txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2])); - // We can preserve transparency for PNG images - if ($this->image_type === 3) - { - imagealphablending($src_img, FALSE); - imagesavealpha($src_img, TRUE); - } + // Add the text to the source image + if ($this->wm_use_truetype) + { + imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); + } + else + { + imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); + } + + // We can preserve transparency for PNG images + if ($this->image_type === 3) + { + imagealphablending($src_img, FALSE); + imagesavealpha($src_img, TRUE); } // Output the final image |