Changeset 1908445
- Timestamp:
- 07/12/2018 08:02:43 PM (8 years ago)
- Location:
- pressbooks-mpdf/trunk
- Files:
-
- 20 edited
-
autoloader.php (modified) (3 diffs)
-
composer.json (modified) (1 diff)
-
composer.lock (modified) (5 diffs)
-
inc/modules/export/mpdf/class-pdf.php (modified) (22 diffs)
-
inc/modules/themeoptions/class-mpdfoptions.php (modified) (2 diffs)
-
pressbooks-mpdf.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/composer/installed.json (modified) (4 diffs)
-
vendor/mpdf/mpdf/src/Mpdf.php (modified) (2 diffs)
-
vendor/mpdf/mpdf/src/TableOfContents.php (modified) (3 diffs)
-
vendor/paragonie/random_compat/lib/byte_safe_strings.php (modified) (7 diffs)
-
vendor/paragonie/random_compat/lib/cast_to_int.php (modified) (1 diff)
-
vendor/paragonie/random_compat/lib/random.php (modified) (2 diffs)
-
vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php (modified) (4 diffs)
-
vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php (modified) (5 diffs)
-
vendor/paragonie/random_compat/lib/random_bytes_libsodium.php (modified) (3 diffs)
-
vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php (modified) (1 diff)
-
vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php (modified) (2 diffs)
-
vendor/paragonie/random_compat/lib/random_int.php (modified) (9 diffs)
-
vendor/paragonie/random_compat/psalm.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pressbooks-mpdf/trunk/autoloader.php
r1839558 r1908445 3 3 * PSR-4 compliant autoload. 4 4 * 5 * @modified from https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md 5 * @modified from 6 * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md 6 7 * 7 8 * @param string $class The fully-qualified class name. … … 12 13 function ( $class ) { 13 14 14 // project-specific namespace prefix15 $prefix = 'BCcampus';15 // project-specific namespace prefix 16 $prefix = 'BCcampus'; 16 17 17 // base directory for the namespace prefix18 $base_dir = __DIR__ . '/inc';18 // base directory for the namespace prefix 19 $base_dir = __DIR__ . '/inc'; 19 20 20 // does the class use the namespace prefix?21 $len = \strlen( $prefix );21 // does the class use the namespace prefix? 22 $len = \strlen( $prefix ); 22 23 23 24 if ( \strncmp( $prefix, $class, $len ) !== 0 ) { … … 26 27 } 27 28 28 // get the relative class name 29 $relative_class = \substr( $class, $len ); 29 // get the relative class name 30 $relative_class = \substr( $class, $len ); 31 $last_ns_pos = strripos( $relative_class, '\\' ); 30 32 31 if ( false !== ( $last_ns_pos = strripos( $relative_class, '\\' )) ) {33 if ( false !== ( $last_ns_pos ) ) { 32 34 $namespace = substr( $relative_class, 0, $last_ns_pos ); 33 35 $class = substr( $relative_class, $last_ns_pos + 1 ); 34 36 $file = str_replace( '\\', DIRECTORY_SEPARATOR, $namespace ) . DIRECTORY_SEPARATOR; 35 37 } 36 $file .= 'class-' . str_replace( '_', '-', $class ) . '.php';38 $file .= 'class-' . str_replace( '_', '-', $class ) . '.php'; 37 39 38 $path = $base_dir . strtolower( $file );40 $path = $base_dir . strtolower( $file ); 39 41 40 // if the file exists, require it42 // if the file exists, require it 41 43 if ( \file_exists( $path ) ) { 42 44 require $path; -
pressbooks-mpdf/trunk/composer.json
r1897333 r1908445 3 3 "description": "Open source PDF generation for Pressbooks via the mPDF library.", 4 4 "type": "wordpress-plugin", 5 "version": "3. 1.3",5 "version": "3.2.0", 6 6 "homepage": "https://github.com/bccampus/pressbooks-mpdf", 7 7 "license": "GPL-2.0+", -
pressbooks-mpdf/trunk/composer.lock
r1897333 r1908445 5 5 "This file is @generated automatically" 6 6 ], 7 "content-hash": " dcfa5cf459a8119290b56a667cdd761b",7 "content-hash": "0a754beef6ea55d85e5f003924532d27", 8 8 "packages": [ 9 9 { 10 10 "name": "mpdf/mpdf", 11 "version": "v7.1. 0",11 "version": "v7.1.1", 12 12 "source": { 13 13 "type": "git", 14 14 "url": "https://github.com/mpdf/mpdf.git", 15 "reference": "8 e3d0d7bf74f71d04904215fb487d01e924c469a"16 }, 17 "dist": { 18 "type": "zip", 19 "url": "https://api.github.com/repos/mpdf/mpdf/zipball/8 e3d0d7bf74f71d04904215fb487d01e924c469a",20 "reference": "8 e3d0d7bf74f71d04904215fb487d01e924c469a",15 "reference": "800a7f9d93474988cc2ffb8c155497ca5910fb09" 16 }, 17 "dist": { 18 "type": "zip", 19 "url": "https://api.github.com/repos/mpdf/mpdf/zipball/800a7f9d93474988cc2ffb8c155497ca5910fb09", 20 "reference": "800a7f9d93474988cc2ffb8c155497ca5910fb09", 21 21 "shasum": "" 22 22 }, … … 73 73 "utf-8" 74 74 ], 75 "time": "2018-0 5-18T05:41:37+00:00"75 "time": "2018-07-02T14:26:48+00:00" 76 76 }, 77 77 { … … 122 122 { 123 123 "name": "paragonie/random_compat", 124 "version": "v2.0.1 5",124 "version": "v2.0.17", 125 125 "source": { 126 126 "type": "git", 127 127 "url": "https://github.com/paragonie/random_compat.git", 128 "reference": " 10bcb46e8f3d365170f6de9d05245aa066b81f09"129 }, 130 "dist": { 131 "type": "zip", 132 "url": "https://api.github.com/repos/paragonie/random_compat/zipball/ 10bcb46e8f3d365170f6de9d05245aa066b81f09",133 "reference": " 10bcb46e8f3d365170f6de9d05245aa066b81f09",128 "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" 129 }, 130 "dist": { 131 "type": "zip", 132 "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", 133 "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", 134 134 "shasum": "" 135 135 }, … … 167 167 "random" 168 168 ], 169 "time": "2018-0 6-08T15:26:40+00:00"169 "time": "2018-07-04T16:31:37+00:00" 170 170 }, 171 171 { … … 1623 1623 { 1624 1624 "name": "symfony/yaml", 1625 "version": "v3.4.1 1",1625 "version": "v3.4.12", 1626 1626 "source": { 1627 1627 "type": "git", -
pressbooks-mpdf/trunk/inc/modules/export/mpdf/class-pdf.php
r1897333 r1908445 115 115 // lives and dies with the instantiation of the object 116 116 if ( $memory_available < $this->memoryNeeded ) { 117 ini_set( 'memory_limit', $this->memoryNeeded . 'M' ); 117 ini_set( 'memory_limit', $this->memoryNeeded . 'M' ); // @codingStandardsIgnoreLine 118 118 } 119 119 … … 131 131 if ( ! empty( $_REQUEST['preview'] ) ) { 132 132 $this->url .= '&' . http_build_query( 133 [134 'preview' => $_REQUEST['preview'],135 ]136 );133 [ 134 'preview' => $_REQUEST['preview'], 135 ] 136 ); 137 137 } 138 138 } … … 149 149 $args = []; 150 150 if ( defined( 'WP_ENV' ) && WP_ENV === 'development' ) { 151 $args['sslverify'] = FALSE;151 $args['sslverify'] = false; 152 152 } 153 153 $contents = wp_remote_get( $this->url, $args ); … … 157 157 \error_log( 'BCcampus\Modules\Export\Mpdf\convert failed to get remote url' . $contents->get_error_message() ); 158 158 159 return FALSE;159 return false; 160 160 } 161 161 $doc = ( class_exists( HTML5::class ) ) ? new HTML5() : new \DOMDocument(); 162 $doc->preserveWhiteSpace = FALSE;162 $doc->preserveWhiteSpace = false; 163 163 $dom = $doc->loadHTML( $contents ); 164 164 … … 171 171 // @see https://mpdf.github.io/reference/mpdf-functions/overview.html 172 172 $this->mpdf->SetBasePath( home_url( '/' ) ); 173 $this->mpdf->SetCompression( TRUE);173 $this->mpdf->SetCompression( true ); 174 174 175 175 // iterate over the xhtml domdocument … … 186 186 * works but mpdf headers and footer functionality is lost 187 187 *****************************************/ 188 //$this->mpdf->WriteHTML( $contents ); 188 //$this->mpdf->WriteHTML( $contents ); // @codingStandardsIgnoreLine 189 189 190 190 // make the thing … … 195 195 } 196 196 197 return TRUE;197 return true; 198 198 } 199 199 … … 232 232 'margin_footer' => 9, 233 233 'orientation' => 'P', 234 'enableImports' => FALSE,234 'enableImports' => false, 235 235 'anchor2Bookmark' => 1, 236 236 'mirrorMargins' => 1, 237 237 'tempDir' => _MPDF_TEMP_PATH, 238 238 'defaultCssFile' => $css_file, 239 'autoLangToFont' => TRUE,240 'ignore_invalid_utf8' => TRUE,239 'autoLangToFont' => true, 240 'ignore_invalid_utf8' => true, 241 241 'defaultfooterline' => 0, 242 242 'defaultheaderline' => 0, … … 244 244 'defaultfooterfontstyle' => 'I', 245 245 'shrink_tables_to_fit' => 1, 246 'use_kwt' => TRUE,247 // 'debug' => true,246 'use_kwt' => true, 247 //'debug' => true, // @codingStandardsIgnoreLine 248 248 ]; 249 249 … … 285 285 286 286 $options = [ 287 'paging' => TRUE,288 'links' => TRUE,287 'paging' => true, 288 'links' => true, 289 289 'tocindent' => 1, 290 290 'suppress' => 'on', … … 354 354 355 355 case 'fron': 356 $display_header = FALSE;357 $display_footer = TRUE;356 $display_header = false; 357 $display_footer = true; 358 358 $page_options = [ 359 359 'suppress' => 'off', … … 364 364 $class = 'front-matter-title'; 365 365 $title = $this->getNodeValue( $page, $element, $class ); 366 $add_to_toc = TRUE;366 $add_to_toc = true; 367 367 break; 368 368 369 369 case 'chap': 370 $display_header = TRUE;371 $display_footer = TRUE;370 $display_header = true; 371 $display_footer = true; 372 372 $page_options = [ 373 373 'suppress' => 'off', … … 378 378 $class = 'chapter-title'; 379 379 $title = $this->getNodeValue( $page, $element, $class ); 380 $add_to_toc = TRUE;380 $add_to_toc = true; 381 381 break; 382 382 383 383 case 'part': 384 $display_header = FALSE;385 $display_footer = TRUE;384 $display_header = false; 385 $display_footer = true; 386 386 $page_options = [ 387 387 'suppress' => 'on', … … 392 392 $class = 'part-title'; 393 393 $title = $this->getNodeValue( $page, $element, $class ); 394 $add_to_toc = TRUE;394 $add_to_toc = true; 395 395 break; 396 396 397 397 case 'back': 398 $display_header = FALSE;399 $display_footer = TRUE;398 $display_header = false; 399 $display_footer = true; 400 400 $page_options = [ 401 401 'suppress' => 'off', … … 406 406 $class = 'back-matter-title'; 407 407 $title = $this->getNodeValue( $page, $element, $class ); 408 $add_to_toc = TRUE;408 $add_to_toc = true; 409 409 break; 410 410 411 411 default: 412 $display_header = FALSE;413 $display_footer = FALSE;412 $display_header = false; 413 $display_footer = false; 414 414 $page_options = [ 415 415 'suppress' => 'on', … … 421 421 $class = ''; 422 422 $title = ''; 423 $add_to_toc = FALSE;423 $add_to_toc = false; 424 424 425 425 } … … 489 489 static $chap_id = 1; 490 490 491 if ( 'part-title' == $class ) {491 if ( 'part-title' === $class ) { 492 492 $entry = $part_id . '. ' . $title; 493 493 $part_id ++; 494 } elseif ( 'chapter-title' == $class ) {494 } elseif ( 'chapter-title' === $class ) { 495 495 $entry = $chap_id . '. ' . $title; 496 496 $chap_id ++; … … 514 514 515 515 // bail early 516 if ( FALSE=== $display ) {516 if ( false === $display ) { 517 517 return ''; 518 518 } … … 541 541 542 542 // bail early 543 if ( FALSE=== $display ) {543 if ( false === $display ) { 544 544 return ''; 545 545 } … … 590 590 591 591 if ( ! $this->isPdf( $this->outputPath ) ) { 592 return FALSE;593 } 594 595 return TRUE;592 return false; 593 } 594 595 return true; 596 596 } 597 597 … … 607 607 $mime = static::mimeType( $file ); 608 608 609 return ( strpos( $mime, 'application/pdf' ) !== FALSE);609 return ( strpos( $mime, 'application/pdf' ) !== false ); 610 610 } 611 611 … … 622 622 if ( is_array( $val ) ) { 623 623 if ( $this->atLeastOneExport( $val ) ) { 624 return TRUE;624 return true; 625 625 } 626 626 } elseif ( 'export' === (string) $key && $val ) { 627 return TRUE;627 return true; 628 628 } 629 629 } 630 630 631 return FALSE;631 return false; 632 632 } 633 633 -
pressbooks-mpdf/trunk/inc/modules/themeoptions/class-mpdfoptions.php
r1881029 r1908445 58 58 */ 59 59 function init() { 60 $_page = $_option = 'pressbooks_theme_options_' . $this->getSlug(); 60 $_page = 'pressbooks_theme_options_' . $this->getSlug(); 61 $_option = 'pressbooks_theme_options_' . $this->getSlug(); 61 62 $_section = $this->getSlug() . '_options_section'; 62 63 … … 190 191 ); 191 192 192 // add_settings_field(193 // 'mpdf_indent_paragraphs',194 // __( 'Indent paragraphs', 'pressbooks-mpdf' ),195 // [ $this, 'renderIndentParagraphsField' ],196 // $_page,197 // $_section,198 // [199 // __( 'Indent paragraphs', 'pressbooks-mpdf' )200 // ]201 // );202 //203 // add_settings_field(204 // 'mpdf_hyphens',205 // __( 'Hyphens', 'pressbooks-mpdf' ),206 // [ $this, 'renderHyphensField' ],207 // $_page,208 // $_section,209 // [210 // __( 'Enable hyphenation', 'pressbooks-mpdf' )211 // ]212 // );213 //214 // add_settings_field(215 // 'mpdf_fontsize',216 // __( 'Increase Font Size', 'pressbooks-mpdf' ),217 // [ $this, 'renderFontSizeField' ],218 // $_page,219 // $_section,220 // [221 // __( 'Increases font size and line height for greater accessibility', 'pressbooks-mpdf' )222 // ]223 // );224 225 193 /** 226 194 * Add custom settings fields. -
pressbooks-mpdf/trunk/pressbooks-mpdf.php
r1897333 r1908445 7 7 * Plugin Name: mPDF for Pressbooks 8 8 * Description: Open source PDF generation for Pressbooks via the mPDF library. 9 * Version: 3. 1.39 * Version: 3.2.0 10 10 * Author: Brad Payne 11 11 * Author URI: https://github.com/bdolor … … 16 16 * Network: True 17 17 * Tags: pressbooks, OER, publishing, PDF, export 18 * Pressbooks tested up to: 5. 3.318 * Pressbooks tested up to: 5.4.0 19 19 */ 20 20 /** … … 72 72 73 73 require_once __DIR__ . '/autoloader.php'; 74 74 75 // Load Composer Dependencies 75 if ( file_exists( $composer = __DIR__ . '/vendor/autoload.php' ) ) { 76 $composer = __DIR__ . '/vendor/autoload.php'; 77 if ( file_exists( $composer ) ) { 76 78 require_once( $composer ); 77 79 } -
pressbooks-mpdf/trunk/readme.txt
r1897333 r1908445 3 3 Donation link: https://github.com/BCcampus/pressbooks-mpdf 4 4 Tags: pressbooks, textbook, mPDF 5 Requires at least: 4.9. 56 Tested up to: 4.9. 67 Stable tag: 3. 1.35 Requires at least: 4.9.6 6 Tested up to: 4.9.7 7 Stable tag: 3.2.0 8 8 Requires PHP: 7.0 9 9 License: GPLv2 … … 61 61 62 62 See: https://github.com/BCcampus/pressbooks-mpdf/commits/master for more detail 63 64 = 3.2.0 (2018/07/12) = 65 * update mPDF to v7.1.1 63 66 64 67 = 3.1.3 (2018/06/18) = -
pressbooks-mpdf/trunk/vendor/composer/installed.json
r1897333 r1908445 2 2 { 3 3 "name": "mpdf/mpdf", 4 "version": "v7.1. 0",5 "version_normalized": "7.1. 0.0",4 "version": "v7.1.1", 5 "version_normalized": "7.1.1.0", 6 6 "source": { 7 7 "type": "git", 8 8 "url": "https://github.com/mpdf/mpdf.git", 9 "reference": "8 e3d0d7bf74f71d04904215fb487d01e924c469a"10 }, 11 "dist": { 12 "type": "zip", 13 "url": "https://api.github.com/repos/mpdf/mpdf/zipball/8 e3d0d7bf74f71d04904215fb487d01e924c469a",14 "reference": "8 e3d0d7bf74f71d04904215fb487d01e924c469a",9 "reference": "800a7f9d93474988cc2ffb8c155497ca5910fb09" 10 }, 11 "dist": { 12 "type": "zip", 13 "url": "https://api.github.com/repos/mpdf/mpdf/zipball/800a7f9d93474988cc2ffb8c155497ca5910fb09", 14 "reference": "800a7f9d93474988cc2ffb8c155497ca5910fb09", 15 15 "shasum": "" 16 16 }, … … 35 35 "ext-zlib": "Needed for compression of embedded resources, such as fonts" 36 36 }, 37 "time": "2018-0 5-18T05:41:37+00:00",37 "time": "2018-07-02T14:26:48+00:00", 38 38 "type": "library", 39 39 "extra": { … … 119 119 { 120 120 "name": "paragonie/random_compat", 121 "version": "v2.0.1 5",122 "version_normalized": "2.0.1 5.0",121 "version": "v2.0.17", 122 "version_normalized": "2.0.17.0", 123 123 "source": { 124 124 "type": "git", 125 125 "url": "https://github.com/paragonie/random_compat.git", 126 "reference": " 10bcb46e8f3d365170f6de9d05245aa066b81f09"127 }, 128 "dist": { 129 "type": "zip", 130 "url": "https://api.github.com/repos/paragonie/random_compat/zipball/ 10bcb46e8f3d365170f6de9d05245aa066b81f09",131 "reference": " 10bcb46e8f3d365170f6de9d05245aa066b81f09",126 "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" 127 }, 128 "dist": { 129 "type": "zip", 130 "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", 131 "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", 132 132 "shasum": "" 133 133 }, … … 141 141 "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." 142 142 }, 143 "time": "2018-0 6-08T15:26:40+00:00",143 "time": "2018-07-04T16:31:37+00:00", 144 144 "type": "library", 145 145 "installation-source": "dist", -
pressbooks-mpdf/trunk/vendor/mpdf/mpdf/src/Mpdf.php
r1881029 r1908445 56 56 { 57 57 58 const VERSION = '7.1. 0';58 const VERSION = '7.1.1'; 59 59 60 60 const SCALE = 72 / 25.4; … … 25691 25691 $toc_sheetsize = (isset($a['toc_sheetsize']) ? $a['toc_sheetsize'] : (isset($a['toc-sheet-size']) ? $a['toc-sheet-size'] : '')); 25692 25692 25693 $this->TOCpagebreak( $tocfont, $tocfontsize, $tocindent, $TOCusePaging, $TOCuseLinking, $toc_orientation, $toc_mgl, $toc_mgr, $toc_mgt, $toc_mgb, $toc_mgh, $toc_mgf, $toc_ohname, $toc_ehname, $toc_ofname, $toc_efname, $toc_ohvalue, $toc_ehvalue, $toc_ofvalue, $toc_efvalue, $toc_preHTML, $toc_postHTML, $toc_bookmarkText, $resetpagenum, $pagenumstyle, $suppress, $orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $toc_id, $pagesel, $toc_pagesel, $sheetsize, $toc_sheetsize, $tocoutdent);25693 $this->TOCpagebreak('', '', '', $TOCusePaging, $TOCuseLinking, $toc_orientation, $toc_mgl, $toc_mgr, $toc_mgt, $toc_mgb, $toc_mgh, $toc_mgf, $toc_ohname, $toc_ehname, $toc_ofname, $toc_efname, $toc_ohvalue, $toc_ehvalue, $toc_ofvalue, $toc_efvalue, $toc_preHTML, $toc_postHTML, $toc_bookmarkText, $resetpagenum, $pagenumstyle, $suppress, $orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $toc_id, $pagesel, $toc_pagesel, $sheetsize, $toc_sheetsize, $tocoutdent); 25694 25694 } 25695 25695 -
pressbooks-mpdf/trunk/vendor/mpdf/mpdf/src/TableOfContents.php
r1881029 r1908445 316 316 $tocClassClone->insertTOC(); 317 317 $this->_toc = $tocClassClone->_toc; 318 $this->mpdf->PageNumSubstitutions = $tocClassClone->mpdf->PageNumSubstitutions;319 318 } 320 319 … … 440 439 $this->mpdf->AddPage($toc_orientation, '', $tp_reset, $tp_pagenumstyle, $tp_suppress, $toc_mgl, $toc_mgr, $toc_mgt, $toc_mgb, $toc_mgh, $toc_mgf, $toc_ohname, $toc_ehname, $toc_ofname, $toc_efname, $toc_ohvalue, $toc_ehvalue, $toc_ofvalue, $toc_efvalue, $toc_page_selector, $toc_sheet_size); // mPDF 6 441 440 442 443 441 $this->mpdf->writingToC = true; // mPDF 5.6.38 442 443 /* 444 * Ensure the TOC Page Number Style doesn't effect the TOC Numbering (added automatically in `AddPage()` above) 445 * Ensure the page numbers show in the TOC when the 'suppress' setting is enabled 446 * @see https://github.com/mpdf/mpdf/issues/792 447 * @see https://github.com/mpdf/mpdf/issues/777 448 */ 449 if (isset($tocClassClone)) { 450 $this->mpdf->PageNumSubstitutions = array_map(function ($sub) { 451 $sub['suppress'] = ''; 452 return $sub; 453 }, $tocClassClone->mpdf->PageNumSubstitutions); 454 } 455 444 456 // mPDF 5.6.31 445 457 $tocstart = count($this->mpdf->pages); … … 447 459 $this->mpdf->WriteHTML($toc_preHTML); 448 460 } 449 450 461 451 462 // mPDF 5.6.19 -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/byte_safe_strings.php
r1897333 r1908445 29 29 if (!is_callable('RandomCompat_strlen')) { 30 30 if ( 31 defined('MB_OVERLOAD_STRING') && 32 ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING 31 defined('MB_OVERLOAD_STRING') 32 && 33 ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING 33 34 ) { 34 35 /** … … 83 84 if ( 84 85 defined('MB_OVERLOAD_STRING') 85 &&86 ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING86 && 87 ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING 87 88 ) { 88 89 /** … … 94 95 * @param string $binary_string 95 96 * @param int $start 96 * @param int $length (optional)97 * @param int|null $length (optional) 97 98 * 98 99 * @throws TypeError … … 119 120 * PHP 5.3, so we have to find the length ourselves. 120 121 */ 122 /** @var int $length */ 121 123 $length = RandomCompat_strlen($binary_string) - $start; 122 124 } elseif (!is_int($length)) { … … 134 136 } 135 137 136 return (string) mb_substr($binary_string, $start, $length, '8bit'); 138 return (string) mb_substr( 139 (string) $binary_string, 140 (int) $start, 141 (int) $length, 142 '8bit' 143 ); 137 144 } 138 145 … … 146 153 * @param string $binary_string 147 154 * @param int $start 148 * @param int $length (optional)155 * @param int|null $length (optional) 149 156 * 150 157 * @throws TypeError … … 173 180 } 174 181 175 return (string) substr($binary_string, $start, $length); 182 return (string) substr( 183 (string )$binary_string, 184 (int) $start, 185 (int) $length 186 ); 176 187 } 177 188 178 return (string) substr($binary_string, $start); 189 return (string) substr( 190 (string) $binary_string, 191 (int) $start 192 ); 179 193 } 180 194 } -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/cast_to_int.php
r1897333 r1908445 51 51 $number += 0; 52 52 } elseif (is_numeric($number)) { 53 /** @psalm-suppress InvalidOperand */ 53 54 $number += 0; 54 55 } 56 /** @var int|float $number */ 55 57 56 58 if ( 57 59 is_float($number) 58 &&60 && 59 61 $number > ~PHP_INT_MAX 60 &&62 && 61 63 $number < PHP_INT_MAX 62 64 ) { -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random.php
r1897333 r1908445 4 4 * for using the new PHP 7 random_* API in PHP 5 projects 5 5 * 6 * @version 2.0.1 57 * @released 2018-0 6-086 * @version 2.0.17 7 * @released 2018-07-04 8 8 * 9 9 * The MIT License (MIT) … … 204 204 * 205 205 * @param mixed $length 206 * @psalm-suppress MissingReturnType207 206 * @psalm-suppress InvalidReturnType 208 207 * @throws Exception -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php
r1897333 r1908445 42 42 { 43 43 try { 44 /** @var int $bytes */ 44 45 $bytes = RandomCompat_intval($bytes); 45 46 } catch (TypeError $ex) { … … 55 56 } 56 57 58 /** @var string $buf */ 57 59 $buf = ''; 58 60 if (!class_exists('COM')) { … … 61 63 ); 62 64 } 65 /** @var COM $util */ 63 66 $util = new COM('CAPICOM.Utilities.1'); 64 67 $execCount = 0; … … 69 72 */ 70 73 do { 71 $buf .= base64_decode( $util->GetRandom($bytes, 0));74 $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); 72 75 if (RandomCompat_strlen($buf) >= $bytes) { 73 76 /** 74 77 * Return our random entropy buffer here: 75 78 */ 76 return RandomCompat_substr($buf, 0, $bytes);79 return (string) RandomCompat_substr($buf, 0, $bytes); 77 80 } 78 81 ++$execCount; -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php
r1897333 r1908445 47 47 function random_bytes($bytes) 48 48 { 49 /** @var resource $fp */ 49 50 static $fp = null; 51 50 52 /** 51 53 * This block should only be run once … … 56 58 * We never fall back to /dev/random 57 59 */ 60 /** @var resource|bool $fp */ 58 61 $fp = fopen('/dev/urandom', 'rb'); 59 if (!empty($fp)) { 62 if (is_resource($fp)) { 63 /** @var array<string, int> $st */ 60 64 $st = fstat($fp); 61 65 if (($st['mode'] & 0170000) !== 020000) { … … 65 69 } 66 70 67 if ( !empty($fp)) {71 if (is_resource($fp)) { 68 72 /** 69 73 * stream_set_read_buffer() does not exist in HHVM … … 84 88 85 89 try { 90 /** @var int $bytes */ 86 91 $bytes = RandomCompat_intval($bytes); 87 92 } catch (TypeError $ex) { … … 104 109 * page load. 105 110 */ 106 if ( !empty($fp)) {111 if (is_resource($fp)) { 107 112 /** 108 113 * @var int -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php
r1897333 r1908445 44 44 { 45 45 try { 46 /** @var int $bytes */ 46 47 $bytes = RandomCompat_intval($bytes); 47 48 } catch (TypeError $ex) { … … 61 62 * generated in one invocation. 62 63 */ 64 /** @var string|bool $buf */ 63 65 if ($bytes > 2147483647) { 64 66 $buf = ''; … … 70 72 } 71 73 } else { 74 /** @var string|bool $buf */ 72 75 $buf = \Sodium\randombytes_buf($bytes); 73 76 } 74 77 75 if ( $buf !== false) {78 if (is_string($buf)) { 76 79 if (RandomCompat_strlen($buf) === $bytes) { 77 80 return $buf; -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php
r1897333 r1908445 44 44 { 45 45 try { 46 /** @var int $bytes */ 46 47 $bytes = RandomCompat_intval($bytes); 47 48 } catch (TypeError $ex) { -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
r1897333 r1908445 43 43 { 44 44 try { 45 /** @var int $bytes */ 45 46 $bytes = RandomCompat_intval($bytes); 46 47 } catch (TypeError $ex) { … … 56 57 } 57 58 58 $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); 59 /** @var string|bool $buf */ 60 $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); 59 61 if ( 60 $buf !== false61 &&62 is_string($buf) 63 && 62 64 RandomCompat_strlen($buf) === $bytes 63 65 ) { -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/lib/random_int.php
r1897333 r1908445 52 52 53 53 try { 54 /** @var int $min */ 54 55 $min = RandomCompat_intval($min); 55 56 } catch (TypeError $ex) { … … 60 61 61 62 try { 63 /** @var int $max */ 62 64 $max = RandomCompat_intval($max); 63 65 } catch (TypeError $ex) { … … 91 93 */ 92 94 $attempts = $bits = $bytes = $mask = $valueShift = 0; 95 /** @var int $attempts */ 96 /** @var int $bits */ 97 /** @var int $bytes */ 98 /** @var int $mask */ 99 /** @var int $valueShift */ 93 100 94 101 /** … … 96 103 * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to 97 104 * a float and we will lose some precision. 105 * 106 * @var int|float $range 98 107 */ 99 108 $range = $max - $min; … … 116 125 */ 117 126 $bytes = PHP_INT_SIZE; 127 /** @var int $mask */ 118 128 $mask = ~0; 119 129 … … 130 140 ++$bits; 131 141 $range >>= 1; 142 /** @var int $mask */ 132 143 $mask = $mask << 1 | 1; 133 144 } … … 135 146 } 136 147 148 /** @var int $val */ 137 149 $val = 0; 138 150 /** … … 140 152 * random integers until one falls between $min and $max 141 153 */ 154 /** @psalm-suppress RedundantCondition */ 142 155 do { 143 156 /** … … 170 183 $val |= ord($randomByteString[$i]) << ($i * 8); 171 184 } 185 /** @var int $val */ 172 186 173 187 /** -
pressbooks-mpdf/trunk/vendor/paragonie/random_compat/psalm.xml
r1897333 r1908445 2 2 <psalm 3 3 autoloader="psalm-autoload.php" 4 stopOnFirstError="false"5 4 useDocblockTypes="true" 5 totallyTyped="true" 6 6 > 7 7 <projectFiles> … … 10 10 <issueHandlers> 11 11 <RedundantConditionGivenDocblockType errorLevel="info" /> 12 <!-- We have to be explicit because PHP 5 lacks scalar types --> 12 13 <UnresolvableInclude errorLevel="info" /> 14 <!-- Because we put the variants into their own subdirectory --> 13 15 <DuplicateClass errorLevel="info" /> 14 <InvalidOperand errorLevel="info" /> 16 <!-- Later versions of Psalm are only PHP 7 compatible, which 17 sees our redefinition of Error and TypeError as duplicate 18 class errors. --> 15 19 <UndefinedConstant errorLevel="info" /> 20 <!-- The Mcrypt constants aren't defined in PHP 7.2 --> 16 21 <MissingReturnType errorLevel="info" /> 22 <!-- False positive with some versions of (Psalm, PHP) --> 17 23 <InvalidReturnType errorLevel="info" /> 24 <!-- The "last resort" function in lib/random.php --> 25 <MixedInferredReturnType errorLevel="suppress" /> 26 <!-- Only used in totallyTyped mode --> 18 27 </issueHandlers> 19 28 </psalm>
Note: See TracChangeset
for help on using the changeset viewer.