Squashed 'public/legacy/' changes from ace35f6573..23d711b703

23d711b703 [Legacy] update install language label
58fe59c8da [Legacy] Dashlet Settings Modal Styling Fixes
b880c34877 [Legacy] User Profile Mobile Styling Fixes
ab33cfc7cf [Legacy] Add acls calculation on legacy list data calls
220bf5b8be [Legacy] Get list of visible modules from module name mapper
a7a0754a2d Fix valid module check
020a5dcb1b [Legacy] add widget acl metadata - update acl config for top widget
89e8f7c0f2 [Legacy] Subpanels Action Button Styling Fixes
6c287af813 remove photo widgets for contacts and leads
4ac8347d61 [Legacy] Admin Release Styling Fixes
3336b10790 Suite8 ChangeLog ModalPopup Styling Fixes
8df8ad992c [Legacy] Add close menu label
1dfdf6a005 [Legacy] Add not module selected label
b234b8a1fe [Legacy] Add parent type ApiBeanMapper
4def7cdfc6 [Legacy] Fix username display for unauthorized users
c9771bd330 [Legacy] DetailView Header Title Overlaps fixes
0a0dd3c2c5 [Legacy] Fix htaccess generation
687d5ea7bd Fix Date Filed for Targets
5f863f4b16 [Legacy] Remove Button Hover Fixes
78672e7a27 [Legacy] Reports footer button removed fixes
4b3a9778e8 [Legacy] Reports Styling Fixes
3ab39b6584 [Legacy] Maps Button Position Fixes
e50f76f3fc [Legacy] Add Tab Dashlet Sapcing Fixes
d2f6433a06 [Legacy] Dashlet Setting Modal Label Fix & Button Fixes
e5137262f7 [Legacy] Activity Stream Post Button Hover color fixes
71d44b7274 [Legacy] Bump version to 8.0.0-rc
abafbc280b [Legacy] Remove license from install app strings
43281fae73 Fix ignore system checks valitation
feab3f0abf [Legacy] Add install labels
b0fc8ac7a6 [Legacy] add new install labels
8fea1b7c7f [Legacy] add install validator class
e4f7648e50 [Legacy] Add Label for Subpanel Edit Line Action
b8ecc0a37e [Legacy] Dashboard Mobile Styling Fixes
7d427720f5 [Legacy] History Subpanel Button Styling Fixes
63d10c40d6 [Legacy] Workflow Stying Fixes
811ad79455 [Legacy] Convert Lead Styling Fixes
01764542a1 [Legacy] Roles Styling Fixes
7ecc573f0e [Legacy] Admin Modules label font fixes
9f13c91e22 [Legacy] HomePage Mobile Fixes
005d1ac949 update legacy handlers to apply new logic considering - base actions - action resolvers - fix url navigation issue in classic view
b3c7a14380 [Legacy] Module framework - move suite 8 module config to legacy
542198ac5c [Legacy] Add support for more metadata on listviewdefs
e3c82fc9ea [Legacy] Add Support for all modules with parent css classes
f2dd774903 [Legacy] Security Group Styling Fixes
b6e5591cc4 [Legacy] Password Management Mobile Fixes
1624fdcfad [Leagcy] Email Settings Fixes
e033259dac [Legacy] Products Modules Buttons fixes
eae8efde52 [Legacy] OAUTH2 Clients and tokens fixes
f90c5f5315 [Legacy] adapt legacy install scripts to work with Suite8 install
d099fac028 [Legacy] add labels for S8 Installer
8be5c78c4c [Legacy] Add widget not found label
eb4449777b [Legacy] Email Action DropDown Styling Fixes
06aff4ce92 SuiteCRM 7.12.0 Release
1cf315c98b Fix BasicSearchResults hit counter
c7458ea520 Update PDF samples for compatibility with new PDF Engine
a2a392f6d3 Update Reports PDF for compatibility with new PDF Engine
575561903b Update PDF Engines for backward compatibility
3ed5326ca1 Deprecate TCPDF
b6c4a4941f Fix TCPDF image scale
d6c47de2f5 Fix TCPDF filename
412fd0d006 Add optional malicious file scanner
f88149fcfe Feature: Allow configuring the Calendar name for the Google Sync via the config.
ae836af690 Fix SearchFormView visible options
5f3545193f Update workflow acceptance test
7c54f0fbc4 SuiteCRM 7.12.0-RC Release
0159e0cd86 Remove unused currency config entries
1c49d879ad Default new MySQL based installs to use utf8mb4
dee7ba0594 Clean up search setting
b9b6aeae3a Cleanup old CSS files
ed59f5f6d9 Add missing admin icons
732e84c6a3 Move Workflow to default as admin function
60dce30854 Update admin panel to improve grouping
6f7524b46a Fix filepath for mPDF class
cdab640886 Add default Engines
f79cc55782 Remove MPDFEngine Test
77d38a259d Add check for MPDF class
59261aac8d Remove PDF_Lib
49fb8525a0 Implement TCPDF

git-subtree-dir: public/legacy
git-subtree-split: 23d711b70345ccf90d7508ce6aa5ddc8fd3dc4dd
This commit is contained in:
Dillon-Brown 2021-11-05 15:19:00 +00:00
parent dd455a1c2d
commit 75ea167930
306 changed files with 6323 additions and 234741 deletions

1681
files.md5

File diff suppressed because it is too large Load diff

View file

@ -85,6 +85,8 @@ class GoogleSyncBase
/** @var object A Logger Instance */
protected $logger;
/** @var string The name of the Google Calendar to use */
protected $suiteCalendarName = 'SuiteCRM';
/**
* Class Constructor
*
@ -97,6 +99,9 @@ class GoogleSyncBase
$this->authJson = $this->getAuthJson($sugarConfig);
$this->db = DBManagerFactory::getInstance();
$this->logger->debug(__FILE__ . ':' . __LINE__ . ' ' . __METHOD__ . ' - ' . '__construct');
if(!empty($sugarConfig['google_calendar_sync_name'])){
$this->suiteCalendarName = $sugarConfig['google_calendar_sync_name'];
}
}
/**
@ -350,7 +355,7 @@ class GoogleSyncBase
$helper = new GoogleSyncHelper;
$helper->wipeLocalSyncData($this->workingUser->id);
$calendar = new \Google\Service\Calendar\Calendar();
$calendar->setSummary('SuiteCRM');
$calendar->setSummary($this->suiteCalendarName);
$calendar->setTimeZone($this->timezone);
$createdCalendar = $this->gService->calendars->insert($calendar);
@ -374,7 +379,7 @@ class GoogleSyncBase
protected function getSuiteCRMCalendar(Google\Service\Calendar\CalendarList $calendarList)
{
foreach ($calendarList->getItems() as $calendarListEntry) {
if ($calendarListEntry->getSummary() == 'SuiteCRM') {
if ($calendarListEntry->getSummary() == $this->suiteCalendarName) {
return $calendarListEntry->getId();
break;
}

View file

@ -150,6 +150,52 @@ class ListViewFacade
return $displayColumns;
}
/**
* Retrieves list view metadata
*
* @param string $module
* @return array
*/
public static function getMetadata($module): array
{
$metadataFile = null;
$foundViewDefs = false;
if (file_exists('custom/modules/' . $module . '/metadata/listviewdefs.php')) {
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
$foundViewDefs = true;
} elseif (file_exists('custom/modules/' . $module . '/metadata/metafiles.php')) {
require_once('custom/modules/' . $module . '/metadata/metafiles.php');
if (!empty($metafiles[$module]['listviewdefs'])) {
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
} elseif (file_exists('modules/' . $module . '/metadata/metafiles.php')) {
require_once('modules/' . $module . '/metadata/metafiles.php');
if (!empty($metafiles[$module]['listviewdefs'])) {
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}
if (!$foundViewDefs && file_exists('modules/' . $module . '/metadata/listviewdefs.php')) {
$metadataFile = 'modules/' . $module . '/metadata/listviewdefs.php';
}
$listViewDefs = null;
if ($metadataFile) {
if (!file_exists($metadataFile)) {
throw new RuntimeException("Metadata file '$metadataFile' not found for module '$module'.");
}
require $metadataFile;
}
$metadata = $viewdefs[$module] ?? [];
$metadata['ListView'] = $viewdefs[$module]['ListView'] ?? [];
$metadata['ListView']['templateMeta'] = $listViewDefs ?? [];
return $metadata['ListView'];
}
/**
* Retrieves display columns on list view of specified module
*

View file

@ -110,7 +110,6 @@ class Localization
public function getLocaleConfigDefaults()
{
$coreDefaults = array(
'currency' => '',
'datef' => 'm/d/Y',
'timef' => 'H:i',
'default_currency_significant_digits' => 2,

View file

@ -45,12 +45,17 @@ if (!defined('sugarEntry') || !sugarEntry) {
require_once __DIR__ . '/externalAPI/ExternalAPIFactory.php';
require_once __DIR__ . '/UploadStream.php';
use SuiteCRM\Exception\MalwareFoundException;
use SuiteCRM\Utility\AntiMalware\AntiMalwareTrait;
/**
* @api
* Manage uploaded files
*/
class UploadFile
{
use AntiMalwareTrait;
public $field_name;
public $stored_file_name;
public $uploaded_file_name;
@ -103,10 +108,10 @@ class UploadFile
/**
* Get URL for a document
* @deprecated
* @param string stored_file_name File name in filesystem
* @param string bean_id note bean ID
* @return string path with file name
* @deprecated
*/
public static function get_url($stored_file_name, $bean_id)
{
@ -296,6 +301,15 @@ class UploadFile
return false;
}
try {
$this->scanPathForMalware($_FILES[$this->field_name]['tmp_name']);
} catch (MalwareFoundException $exception) {
LoggerManager::getLogger()->security("Malware found, unable to save file: {$_FILES[$this->field_name]['name']}");
return false;
}
$this->mime_type = $this->getMime($_FILES[$this->field_name]);
$this->stored_file_name = $this->create_stored_filename();
$this->temp_file_location = $_FILES[$this->field_name]['tmp_name'];

View file

@ -45,6 +45,9 @@ if (!defined('sugarEntry') || !sugarEntry) {
require_once('include/externalAPI/ExternalAPIFactory.php');
require_once 'include/UploadStream.php';
use SuiteCRM\Exception\MalwareFoundException;
use SuiteCRM\Utility\AntiMalware\AntiMalwareTrait;
/**
* @api
* Manage uploaded files with multi-file support
@ -52,6 +55,8 @@ require_once 'include/UploadStream.php';
*/
class UploadMultipleFiles
{
use AntiMalwareTrait;
public $field_name;
public $stored_file_name;
public $uploaded_file_name;
@ -107,10 +112,10 @@ class UploadMultipleFiles
/**
* Get URL for a document
* @deprecated
* @param string stored_file_name File name in filesystem
* @param string bean_id note bean ID
* @return string path with file name
* @deprecated
*/
public static function get_url($stored_file_name, $bean_id)
{
@ -290,6 +295,14 @@ class UploadMultipleFiles
return false;
}
try {
$this->scanPathForMalware($_FILES[$this->field_name]['tmp_name'][$this->index]);
} catch (MalwareFoundException $exception) {
LoggerManager::getLogger()->security("Malware found, unable to save file: {$_FILES[$this->field_name]['name'][$this->index]}");
return false;
}
$this->mime_type = $this->getMime($_FILES[$this->field_name]);
$this->stored_file_name = $this->create_stored_filename();
$this->temp_file_location = $_FILES[$this->field_name]['tmp_name'][$this->index];

View file

@ -134,6 +134,12 @@ class DBManagerFactory
public static function getInstance($instanceName = '')
{
global $sugar_config;
if(empty($sugar_config['dbconfig']['db_name']))
{
return null;
}
static $count = 0, $old_count = 0;
//fall back to the default instance name

View file

@ -54,9 +54,14 @@ if (!defined('PHP_VERSION_ID')) {
define('PHP_VERSION_ID', ($version_array[0] * 10000 + $version_array[1] * 100 + $version_array[2]));
}
require_once 'include/SugarObjects/SugarConfig.php';
if (empty($GLOBALS['installing']) && !file_exists('config.php')) {
header('Location: install.php');
throw new Exception('SuiteCRM is not installed. Entry point needs an installed SuiteCRM, please install first.');
if (isset($GLOBALS['log'])) {
$GLOBALS['log']->fatal('SuiteCRM is not installed. Entry point needs an installed SuiteCRM, please install first.');
}
}
$BASE_DIR = realpath(dirname(__DIR__));
@ -70,6 +75,20 @@ if (file_exists($autoloader)) {
// config|_override.php
if (is_file('config.php')) {
require_once 'config.php'; // provides $sugar_config
} else {
// load minimal sugar config required to provide basic data to Suite8 application
$sugar_config = array(
'cache_dir' => 'cache/',
'default_currency_iso4217' => 'USD',
'default_currency_symbol' => '$',
'default_language' => 'en_us',
'default_theme' => 'suite8',
'languages' =>
array(
'en_us' => 'English (US)'
),
'translation_string_prefix' => false,
);
}
// load up the config_override.php file. This is used to provide default user settings
@ -78,12 +97,10 @@ if (is_file('config_override.php')) {
}
if (empty($GLOBALS['installing']) && empty($sugar_config['dbconfig']['db_name'])) {
header('Location: install.php');
exit();
}
// make sure SugarConfig object is available
$GLOBALS['sugar_config'] = !empty($sugar_config) ? $sugar_config : [];
require_once 'include/SugarObjects/SugarConfig.php';
///////////////////////////////////////////////////////////////////////////////
//// DATA SECURITY MEASURES
@ -119,7 +136,6 @@ require 'modules/DynamicFields/templates/Fields/TemplateText.php';
require_once 'include/utils/file_utils.php';
require_once 'include/SugarEmailAddress/SugarEmailAddress.php';
require_once 'include/SugarLogger/LoggerManager.php';
require_once 'modules/Trackers/BreadCrumbStack.php';
require_once 'modules/Trackers/Tracker.php';
require_once 'modules/Trackers/TrackerManager.php';
@ -146,11 +162,12 @@ if (!defined('SUGAR_PATH')) {
define('SUGAR_PATH', realpath(dirname(__FILE__).'/..'));
}
require_once 'include/SugarObjects/SugarRegistry.php';
require_once 'include/SugarLogger/LoggerManager.php';
$GLOBALS['log'] = LoggerManager::getLogger();
if (empty($GLOBALS['installing'])) {
if (empty($GLOBALS['installing']) && !empty($sugar_config['dbconfig']['db_name'])) {
///////////////////////////////////////////////////////////////////////////////
//// SETTING DEFAULT VAR VALUES
$GLOBALS['log'] = LoggerManager::getLogger();
$error_notice = '';
$use_current_user_login = false;

View file

@ -3777,6 +3777,7 @@ $app_strings['LBL_TOTAL'] = 'Total';
$app_strings['LBL_ACTIONS'] = 'Actions';
$app_strings['LBL_SELECT_SUBPANEL_BANNER'] = 'Select which subpanels to view';
$app_strings['LBL_SELECT_ITEM'] = 'Select an item';
$app_strings['LBL_WIDGET_NOT_FOUND'] = 'Widget not found';
$app_strings['LBL_BAD_CONFIG'] = 'Incorrect configuration';
$app_strings['LBL_CONFIG_BAD_CONTEXT'] = 'Incorrect configuration: context not properly configured';
$app_strings['LBL_CONFIG_NO_CONFIG'] = 'Incorrect configuration: missing config';
@ -3873,6 +3874,7 @@ $app_list_strings['sort_order']['desc'] = 'Descending';
// Labels used by subpanel unlink relationship process
$app_strings['LBL_LINK'] = 'Link';
$app_strings['LBL_UNLINK_RECORD'] = 'Unlink Record';
$app_strings['LBL_EDIT_RECORD'] = 'Edit Record';
$app_strings['LBL_UNLINK_RELATIONSHIP_CONFIRM'] = 'Are you sure you want to unlink this record? Only the relationship will be unlinked. The record will not be deleted.';
$app_strings['LBL_UNLINK_RELATIONSHIP_SUCCESS'] = 'Record unlinked successfully.';
$app_strings['LBL_UNLINK_RELATIONSHIP_FAILED'] = 'There was an error unlinking this record.';
@ -3892,3 +3894,5 @@ $app_strings['LBL_RECORD_CHANGED'] = 'Record Updated';
$app_strings['LBL_CREATE'] = "Create";
$app_strings['LBL_USE_ADVANCED_SEARCH'] = 'Use Advanced Search';
$app_strings['LBL_USE_BASIC_SEARCH'] = 'Use Basic Search';
$app_strings['LBL_NO_MODULE_SELECTED'] = 'No module selected';
$app_strings['LBL_CLOSE_MENU'] = 'Close Menu';

View file

@ -29,6 +29,7 @@ require_once __DIR__ . '/FieldMappers/AssignedUserMapper.php';
require_once __DIR__ . '/LinkMappers/LinkMapperInterface.php';
require_once __DIR__ . '/LinkMappers/EmailAddressLinkMapper.php';
require_once __DIR__ . '/TypeMappers/FullNameMapper.php';
require_once __DIR__ . '/TypeMappers/ParentMapper.php';
require_once __DIR__ . '/TypeMappers/DateMapper.php';
require_once __DIR__ . '/TypeMappers/DateTimeMapper.php';
require_once __DIR__ . '/TypeMappers/DateTimeComboMapper.php';
@ -65,6 +66,7 @@ class ApiBeanMapper
{
$this->fieldMappers[AssignedUserMapper::getField()] = new AssignedUserMapper();
$this->typeMappers[FullNameMapper::getType()] = new FullNameMapper();
$this->typeMappers[ParentMapper::getType()] = new ParentMapper();
$this->typeMappers[DateMapper::getType()] = new DateMapper();
$this->typeMappers[DateTimeMapper::getType()] = new DateTimeMapper();
$this->typeMappers[MultiEnumMapper::getType()] = new MultiEnumMapper();

View file

@ -56,7 +56,7 @@ class AssignedUserMapper implements FieldMapperInterface
return;
}
$container[$name] = get_assigned_user_name($bean->assigned_user_id);
$container[$name] = get_user_name($bean->assigned_user_id);
}
/**

View file

@ -0,0 +1,116 @@
<?php
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
require_once __DIR__ . '/TypeMapperInterface.php';
class ParentMapper implements TypeMapperInterface
{
/**
* @inheritDoc
*/
public static function getType(): string
{
return 'parent';
}
/**
* @inheritDoc
*/
public function toApi(SugarBean $bean, array &$container, string $name, string $alternativeName = ''): void
{
$newName = $name;
$definition = $bean->field_defs[$name] ?? null;
if (!empty($alternativeName)) {
$newName = $alternativeName;
}
if ($definition === null) {
$container[$newName] = [
'id' => ''
];
return;
}
$idFieldName = $definition['id_name'] ?? '';
$typeFieldName = $definition['type_name'] ?? '';
$rName = $definition['rname'] ?? 'name';
$relate = [
'id' => ''
];
$relate[$rName] = '';
if ($idFieldName === '' || $typeFieldName === '') {
$container[$newName] = $relate;
return;
}
$parentId = $bean->$idFieldName;
$parentType = $bean->$typeFieldName;
if (empty($parentType)) {
$container[$newName] = $relate;
return;
}
$relate['id'] = $parentId;
$relate[$rName] = $bean->$name ?? '';
$container[$newName] = $relate;
}
/**
* @inheritDoc
*/
public function toBean(SugarBean $bean, array &$container, string $name, string $alternativeName = ''): void
{
$definition = $bean->field_defs[$name] ?? null;
if ($definition === null) {
return;
}
$idFieldName = $definition['id_name'] ?? '';
$rName = $definition['rname'] ?? 'name';
$relate = $container[$name] ?? [];
$id = $relate['id'] ?? '';
$value = $relate[$rName] ?? '';
if ($idFieldName !== '') {
$container[$idFieldName] = $id;
}
$container[$name] = $value;
}
}

View file

@ -0,0 +1,191 @@
<?php
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
require_once __DIR__ . '/../../../install/install_utils.php';
require_once __DIR__ . '/../../utils.php';
require_once __DIR__ . '/../../utils/sugar_file_utils.php';
require_once __DIR__ . '/Traits/InstallErrorTrait.php';
require_once __DIR__ . '/Traits/InstallValidationTrait.php';
require_once __DIR__ . '/Traits/InstallValidationTrait.php';
require_once __DIR__ . '/../../SugarLogger/LoggerManager.php';
class InstallValidation
{
use InstallValidationTrait;
use InstallErrorTrait;
/**
* @var string $name
*/
private $name;
/**
* @var array $data
*/
private $data;
/**
* @var boolean
*/
private $ignoreWarnings;
/**
* @var string
*/
private $type;
/**
* Set entity name.
*
* @param string $name
* @return self
*/
public function name(string $name): self
{
$this->name = $name;
return $this;
}
/**
* Set entity type.
*
* @param string $type
* @return self
*/
public function type(string $type): self
{
$this->type = $type;
return $this;
}
/**
* Return validated array items
*
* @return array
*/
public function getData() : array
{
$result = $this->data;
if (!empty($this->ignoreWarnings) && $this->ignoreWarnings) {
$type = 'warning';
$result = array_filter($this->data, static function ($item) use ($type) {
return $item['type'] !== $type;
});
}
return $result;
}
/**
* @param string $status
* @param string $value
* @param array $data
* @return array
*/
public function setData(string $status, string $value = '', array $data = []): array
{
$this->data[$this->name]['type'] = $this->type;
$message = $this->messages[$this->name];
$this->data[$this->name]['label'] = $message['label'];
if ($status === 'error') {
$this->data[$this->name]['error'] = $message['error'];
}
$this->data[$this->name]['status'] = $status;
$this->data[$this->name]['info'] = $value;
$this->data[$this->name]['data'] = $data;
return $this->data;
}
/**
* Validation result.
*
* errors, warnings, info
*
* @return array
*/
public function result(): array
{
$data = $this->getData();
$status = 'error';
$errors = array_filter($data, static function ($item) use ($status) {
return $item['status'] === $status;
});
return [
'data' => $data ?? [],
'hasValidationError' => !empty($errors)
];
}
/**
* @param array $context
* @return $this
*/
public function validate(array $context): self
{
$this->ignoreWarnings = $this->isTrue($context['inputs']['sys_check_option'] ?? false);
$this->name('phpVersion')->type('info')->phpVersion();
$this->name('PCREVersion')->type('info')->PCREVersion();
$this->name('iisVersion')->type('info')->iisVersion();
$this->name('xml_parser_create')->type('error')->functionExists();
$this->name('json_decode')->type('error')->functionExists();
$this->name('mb_strlen')->type('error')->functionExists();
$this->name('gzclose')->type('error')->functionExists();
$this->name('imagecreatetruecolor')->type('error')->functionExists();
$this->name('ZipArchive')->type('error')->classExists();
$this->name('IsWritableCacheDir')->type('error')->IsWritableCacheDir();
$this->name('IsWritableModDir')->type('error')->IsWritableModDir();
$this->name('IsWritableConfig')->type('error')->IsWritableConfig();
$this->name('IsWritableConfigO')->type('error')->IsWritableConfigOverride();
$this->name('IsWritableCustomDir')->type('error')->IsWritableCustomDir();
$this->name('IsWritableUploadDir')->type('warning')->IsWritableUploadDir();
$this->name('curl_init')->type('warning')->functionExists();
$this->name('imap')->type('warning')->imapCheck();
$this->name('upload_limit')->type('warning')->uploadLimit();
$this->name('memory_limit')->type('warning')->memoryLimit();
return $this;
}
/**
* @param $value
* @return bool
*/
protected function isTrue($value): bool
{
return $value === 'true' || $value === '1' || $value === true || $value === 1;
}
}

View file

@ -0,0 +1,142 @@
<?php
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
trait InstallErrorTrait
{
/**
* @var array $messages
*/
protected $messages = [
'phpVersion' => [
'label' => 'LBL_CHECKSYS_PHPVER',
'error' => 'ERR_CHECKSYS_PCRE_VER'
],
'PCREVersion' => [
'label' => 'LBL_CHECKSYS_PCRE',
'error' => 'ERR_CHECKSYS_PHP_INVALID_VER'
],
'iisVersion' => [
'label' => 'LBL_CHECKSYS_IISVER',
'error' => 'ERR_CHECKSYS_IIS_INVALID_VER'
],
'fastCgi' => [
'label' => 'LBL_CHECKSYS_FASTCGI',
'error' => 'ERR_CHECKSYS_FASTCGI'
],
'fastCgiLogging' => [
'label' => 'LBL_CHECKSYS_FASTCGI',
'error' => 'ERR_CHECKSYS_FASTCGI_LOGGING'
],
'xml_parser_create' =>
[
'label' => 'LBL_CHECKSYS_XML',
'error' => 'LBL_CHECKSYS_XML_NOT_AVAILABLE'
],
'json_decode' =>
[
'label' => 'LBL_CHECKSYS_JSON',
'error' => 'ERR_CHECKSYS_JSON_NOT_AVAILABLE'
],
'mb_strlen' =>
[
'label' => 'LBL_CHECKSYS_MBSTRING',
'error' => 'ERR_CHECKSYS_MBSTRING'
],
'ZipArchive' =>
[
'label' => 'LBL_CHECKSYS_ZIP',
'error' => 'ERR_CHECKSYS_ZIP'
],
'IsWritableConfig' =>
[
'label' => 'LBL_CHECKSYS_CONFIG',
'error' => 'ERR_CHECKSYS_CONFIG_NOT_WRITABLE'
],
'IsWritableConfigO' =>
[
'label' => 'LBL_CHECKSYS_OVERRIDE_CONFIG',
'error' => 'ERR_CHECKSYS_CONFIG_OVERRIDE_NOT_WRITABLE'
],
'IsWritableCustomDir' =>
[
'label' => 'LBL_CHECKSYS_CUSTOM',
'error' => 'ERR_CHECKSYS_CUSTOM_NOT_WRITABLE'
],
'IsWritableCacheDir' =>
[
'label' => 'LBL_CHECKSYS_CACHE',
'error' => 'LBL_CHECKSYS_FIX_FILES'
],
'IsWritableModDir' =>
[
'label' => 'LBL_CHECKSYS_MODULE',
'error' => 'LBL_CHECKSYS_FIX_MODULE_FILES'
],
'IsWritableUploadDir' =>
[
'label' => 'LBL_CHECKSYS_ZLIB',
'error' => 'ERR_CHECKSYS_ZLIB'
],
'gzclose' =>
[
'label' => 'LBL_CHECKSYS_UPLOAD',
'error' => 'LBL_CHECKSYS_FIX_FILES'
],
'curl_init' =>
[
'label' => 'LBL_CHECKSYS_CURL',
'error' => 'ERR_CHECKSYS_CURL'
],
'upload_limit' =>
[
'label' => 'LBL_UPLOAD_MAX_FILESIZE_TITLE',
'error' => 'ERR_UPLOAD_MAX_FILESIZE'
],
'imagecreatetruecolor' =>
[
'label' => 'LBL_SPRITE_SUPPORT',
'error' => 'ERROR_SPRITE_SUPPORT'
],
'phpIniLocation' =>
[
'label' => 'LBL_CHECKSYS_PHP_INI',
'error' => ''
],
'imap' =>
[
'label' => 'LBL_CHECKSYS_IMAP',
'error' => 'ERR_CHECKSYS_IMAP'
],
'memory_limit' =>
[
'label' => 'LBL_CHECKSYS_MEM',
'error' => ''
]
];
}

View file

@ -0,0 +1,285 @@
<?php
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
trait InstallValidationTrait
{
public function noInstallScript(): bool
{
global $install_script;
return empty($install_script);
}
public function fastCgi(): bool
{
return !(PHP_SAPI !== 'cgi-fcgi');
}
/**
* @return bool
*/
public function fastCgiLogging(): bool
{
return !(ini_get('fastcgi.logging') === '0');
}
public function iisVersion(): void
{
$server_software = $_SERVER["SERVER_SOFTWARE"] ?? '';
if (strpos($server_software, 'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/",
$server_software, $out)) {
$iis_version = $out[1][0];
$value = $iis_version;
$status = 'success';
if (check_iis_version() === -1) {
$status = 'error';
}
$this->setData($status, $value);
}
}
public function phpVersion()
{
$value = constant('PHP_VERSION');
$status = 'success';
if (check_php_version() === -1) {
$status = 'error';
}
$this->setData($status, $value);
}
public function PCREVersion()
{
$value = constant('PCRE_VERSION');
$status = 'success';
if (!defined('PCRE_VERSION') || version_compare(PCRE_VERSION, '7.0') < 0) {
$status = 'error';
}
$this->setData($status, $value);
}
public function functionExists()
{
$value = '';
$status = 'success';
if (!function_exists($this->name)) {
$status = 'error';
}
$this->setData($status, $value);
}
public function classExists()
{
$value = '';
$status = 'success';
if (!class_exists($this->name)) {
$status = 'error';
}
$this->setData($status, $value);
}
public function writableFile($file)
{
return !file_exists($file) || is_writable($file) || make_writable($file);
}
public function IsWritableConfig()
{
$value = '';
$status = 'success';
if (!$this->writableFile(getcwd() . '/config.php')) {
$status = 'error';
}
$this->setData($status, $value);
}
public function IsWritableConfigOverride()
{
$value = '';
$status = 'success';
if (!$this->writableFile(getcwd() . '/config_override.php')) {
$status = 'error';
}
$this->setData($status, $value);
}
public function IsWritableCustomDir()
{
$value = '';
$status = 'success';
if (!$this->writableDir('./custom')) {
$status = 'error';
}
$this->setData($status, $value);
}
public function IsWritableUploadDir()
{
$value = '';
$status = 'success';
if (!$this->writableDir('./upload')) {
$status = 'error';
}
$this->setData($status, $value);
}
public function IsWritableCacheDir(): void
{
$value = '';
// cache dir
$cache_files[] = '';
$cache_files[] = 'images';
$cache_files[] = 'layout';
$cache_files[] = 'pdf';
$cache_files[] = 'xml';
$cache_files[] = 'include/javascript';
$data = [];
foreach ($cache_files as $c_file) {
$dirname = sugar_cached($c_file);
if (!$this->writableDir($dirname)) {
$data[] = getcwd() . "/$dirname";
}
}
$status = !empty($data) ? 'error' : 'success';
$this->setData($status, $value, $data);
}
public function writableDir($dirname)
{
$writable = false;
// set permissions to restrictive -
// use make_writable to change in a standard way to the required permissions
if ((is_dir($dirname)) || @sugar_mkdir($dirname, 0755, true)) {
$writable = make_writable($dirname);
}
return $writable;
}
public function IsWritableModDir()
{
$value = '';
$data = [];
$_SESSION['unwriteable_module_files'] = array();
recursive_make_writable('./modules');
if (!empty($_SESSION['unwriteable_module_files']['failed'])) {
foreach ($_SESSION['unwriteable_module_files'] as $key => $file) {
if ($key !== '.' && $key !== 'failed') {
$data[] = $file;
}
}
}
$status = !empty($data) ? 'error' : 'success';
$this->setData($status, $value, $data);
}
public function memoryLimit()
{
$memory_limit = ini_get('memory_limit');
if (empty($memory_limit)) {
$memory_limit = "-1";
}
if (!defined('SUGARCRM_MIN_MEM')) {
define('SUGARCRM_MIN_MEM', 64 * 1024 * 1024);
}
if ($memory_limit == "") {
$this->setData('success', 'LBL_CHECKSYS_MEM_OK');
} elseif ($memory_limit == "-1") {
$this->setData('success', 'LBL_CHECKSYS_MEM_UNLIMITED');
} else {
preg_match('/^\s*([0-9.]+)\s*([KMGTPE])B?\s*$/i', $memory_limit, $matches);
$num = (float)$matches[1];
// Don't break so that it falls through to the next case.
switch (strtoupper($matches[2])) {
case 'G':
$num = $num * 1024;
// no break
case 'M':
$num = $num * 1024;
// no break
case 'K':
$num = $num * 1024;
}
$memory_limit_int = (int)$num;
if ($memory_limit_int < constant('SUGARCRM_MIN_MEM')) {
$min_mem_in_megs = constant('SUGARCRM_MIN_MEM') / (1024 * 1024);
$this->setData('error', $memory_limit.'/'.$min_mem_in_megs);
} else {
$this->setData('success', $memory_limit);
}
}
}
public function imapCheck(): void
{
$value = '';
$status = 'success';
include_once './include/Imap/ImapHandlerFactory.php';
$imapFactory = new ImapHandlerFactory();
$imap = $imapFactory->getImapHandler();
if (!$imap->isAvailable()) {
$status = 'error';
}
$this->setData($status, $value);
}
public function uploadLimit(): void
{
$upload_max_filesize = ini_get('upload_max_filesize');
$upload_max_filesize_bytes = return_bytes($upload_max_filesize);
if (!defined('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) {
define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024);
}
$value = '';
$status = 'success';
if ($upload_max_filesize_bytes <= constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) {
$status = 'error';
}
$this->setData($status, $value);
}
}

View file

@ -110,8 +110,14 @@ class ListViewDataPort extends ListViewData
[$params, $order, $orderBy] = $this->buildOrderBy($filter_fields, $params, $current_user);
[$ret_array, $main_query] = $this->buildFindQuery($seed, $where, $filter_fields, $params, $singleSelect,
$orderBy);
[$ret_array, $main_query] = $this->buildFindQuery(
$seed,
$where,
$filter_fields,
$params,
$singleSelect,
$orderBy
);
[$result, $offset] = $this->runQuery($offset, $limit, $main_query);
@ -187,8 +193,14 @@ class ListViewDataPort extends ListViewData
[$params, $order, $orderBy] = $this->buildOrderBy($filter_fields, $params, $current_user);
[$ret_array] = $this->buildFindQuery($seed, $where, $filter_fields, $params, $singleSelect,
$orderBy);
[$ret_array] = $this->buildFindQuery(
$seed,
$where,
$filter_fields,
$params,
$singleSelect,
$orderBy
);
return $ret_array;
}
@ -205,7 +217,6 @@ class ListViewDataPort extends ListViewData
$offset = -1,
$limit = -1
): array {
$this->seed = $bean;
$mainQuery = $this->joinQueryParts([], $queryParts);
@ -253,8 +264,10 @@ class ListViewDataPort extends ListViewData
{
// if $params tell us to override all ordering
if (!empty($params['overrideOrder']) && !empty($params['orderBy'])) {
$order = $this->getOrderBy(strtolower($params['orderBy']),
(empty($params['sortOrder']) ? '' : $params['sortOrder'])); // retreive from $_REQUEST
$order = $this->getOrderBy(
strtolower($params['orderBy']),
(empty($params['sortOrder']) ? '' : $params['sortOrder'])
); // retreive from $_REQUEST
} else {
$order = $this->getOrderBy(); // retreive from $_REQUEST
}
@ -273,8 +286,10 @@ class ListViewDataPort extends ListViewData
$orderby = substr($order['orderBy'], strpos($order['orderBy'], '.') + 1);
}
if ($orderby !== 'date_entered' && empty($params['custom_order']) && !array_key_exists($orderby,
$filter_fields)) {
if ($orderby !== 'date_entered' && empty($params['custom_order']) && !array_key_exists(
$orderby,
$filter_fields
)) {
$order['orderBy'] = '';
$order['sortOrder'] = '';
}
@ -322,7 +337,6 @@ class ListViewDataPort extends ListViewData
$singleSelect,
$orderBy
): array {
$ret_array = $seed->create_new_list_query(
$orderBy,
$where,
@ -541,9 +555,24 @@ class ListViewDataPort extends ListViewData
*/
protected function addACLInfo(SugarBean $temp, array &$pageData, int $dataIndex): void
{
$detailViewAccess = $temp->ACLAccess('DetailView');
$editViewAccess = $temp->ACLAccess('EditView');
$pageData['rowAccess'][$dataIndex] = array('view' => $detailViewAccess, 'edit' => $editViewAccess);
$acls = [];
$rowAccess = [];
$actions = ['list', 'edit', 'view', 'delete', 'export', 'import'];
foreach ($actions as $action) {
$hasAccess = $temp->ACLAccess($action) ?? false;
$rowAccess[$action] = $hasAccess;
if ($hasAccess === true) {
$acls[] = $action;
}
}
$pageData['rowAccess'][$dataIndex] = $rowAccess;
$pageData['acls'][$temp->id] = $acls;
}
/**
@ -587,8 +616,14 @@ class ListViewDataPort extends ListViewData
$pageData['ordering'] = $order;
$pageData['ordering']['sortOrder'] = $this->getReverseSortOrder($pageData['ordering']['sortOrder']);
//get url parameters as an array
$pageData['queries'] = $this->generateQueries($pageData['ordering']['sortOrder'], $offset, $prevOffset,
$nextOffset, $endOffset, $totalCounted);
$pageData['queries'] = $this->generateQueries(
$pageData['ordering']['sortOrder'],
$offset,
$prevOffset,
$nextOffset,
$endOffset,
$totalCounted
);
//join url parameters from array to a string
$pageData['offsets'] = array(

View file

@ -66,11 +66,33 @@ class ModuleNameMapper
*/
public function isValidModule(string $module): bool
{
if (empty($this->map[$module])) {
global $moduleList;
global $modInvisList;
if (in_array($module, $moduleList, true)) {
return true;
}
if (in_array($module, $modInvisList, true)) {
return true;
}
if (in_array($module, ['History', 'Activities'], true)) {
return true;
}
return false;
}
return true;
/**
* Get visible modules
* @return array
*/
public function getVisibleModules(): array
{
global $moduleList;
return $moduleList;
}
/**
@ -143,5 +165,4 @@ class ModuleNameMapper
return $this->map[$module][$type];
}
}

View file

@ -33,15 +33,14 @@
*/
class UserACLService
{
/**
* Check User ACL against the following parameters
* @param string $routeModule
* @param string $routeURL
* @param string $routeAction
* @param bool $isActionAvailable
* @return array with feedback
*/
public function run(string $routeModule, string $routeURL, string $routeAction): array
public function run(string $routeModule, string $routeURL, bool $isActionAvailable): array
{
if (empty($routeModule)) {
return [
@ -50,14 +49,14 @@ class UserACLService
];
}
if (!$routeURL && !$this->handleAclRoles($routeModule, $routeAction)) {
if (!$routeURL && !$isActionAvailable) {
return [
'status' => false,
'message' => 'ERR_UNAUTHORIZED_PAGE_ACCESS_TO_HOME_PAGE'
];
}
if (!$this->handleAclRoles($routeModule, $routeAction)) {
if (!$isActionAvailable) {
return [
'status' => false,
'message' => 'ERR_UNAUTHORIZED_PAGE_ACCESS'
@ -69,17 +68,4 @@ class UserACLService
'message' => ''
];
}
/**
* Handle User Acl roles
* @param string $beanName
* @param string $routeAction
* @return bool
*/
protected function handleAclRoles(string $beanName, string $routeAction): bool
{
$routeAction = $routeAction ?: 'view';
return ACLController::checkAccess($beanName, $routeAction, true, 'module', true);
}
}

View file

@ -85,13 +85,6 @@ class SubpanelDataPort
return ['data' => [], 'offsets' => [], 'ordering' => []];
}
$beanList = $response['list'] ?? [];
$mappedBeans = [];
foreach ($beanList as $beanData) {
$mappedBeans[] = $this->apiBeanMapper->toApi($beanData);
}
$row_count = $response['row_count'];
$next_offset = $response['next_offset'];
$previous_offset = $response['previous_offset'];
@ -108,8 +101,8 @@ class SubpanelDataPort
$last_offset = $number_pages * $limit;
return [
'data' => $mappedBeans,
$lisData = [
'data' => [],
"offsets" => [
"current" => $offset,
"next" => $next_offset,
@ -121,8 +114,22 @@ class SubpanelDataPort
"ordering" => [
"orderBy" => $orderBy,
"sortOrder" => $sortOrder
]
],
'pageData' => []
];
$beanList = $response['list'] ?? [];
$mappedBeans = [];
foreach ($beanList as $key => $beanData) {
$this->addACLInfo($beanData, $lisData['pageData']);
$mappedBeans[] = $this->apiBeanMapper->toApi($beanData);
}
$lisData['data'] = $mappedBeans;
return $lisData;
}
/**
@ -166,6 +173,7 @@ class SubpanelDataPort
$aSubPanelObject,
$selectColumns
);
return $response;
} catch (Exception $ex) {
LoggerManager::getLogger()->fatal('[' . __METHOD__ . "] . {$ex->getMessage()}");
@ -174,4 +182,25 @@ class SubpanelDataPort
}
}
/**
* @param SugarBean $temp
* @param array $pageData
*/
protected function addACLInfo(SugarBean $temp, array &$pageData): void
{
$acls = [];
$actions = ['list', 'edit', 'view', 'delete', 'export', 'import'];
foreach ($actions as $action) {
$hasAccess = $temp->ACLAccess($action);
if ($hasAccess === true) {
$acls[] = $action;
}
}
$pageData['acls'][$temp->id] = $acls;
}
}

View file

@ -78,7 +78,6 @@ class PostUpgrade
require __DIR__ . '/../../../../config.php';
try {
ob_start();
$_SESSION['schema_change'] = 'sugar'; // we force-run all SQL
@ -151,7 +150,6 @@ class PostUpgrade
$phpErrors = ob_get_clean();
$this->log("Potential PHP generated error messages: {$phpErrors}");
} catch (Throwable $t) {
$response = [
'success' => false,

View file

@ -1,149 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
*/
//============================================================+
// File name : 2dbarcodes.php
// Begin : 2009-04-07
// Last Update : 2009-04-08
// Version : 1.0.000
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// ----------------------------------------------------------------------------
//
// Description : PHP class to creates array representations for
// 2D barcodes to be used with TCPDF.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* PHP class to creates array representations for 2D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf
* @abstract Functions for generating string representation of 2D barcodes.
* @author Nicola Asuni
* @copyright 2008-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 1.0.000
* Class for backwards compatibility only
*/
/**
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
* @name TCPDFBarcode
* @package com.tecnick.tcpdf
* @version 1.0.000
* @author Nicola Asuni
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*/
class TCPDF2DBarcode {
/**
* @var array representation of barcode.
* @access protected
*/
protected $barcode_array;
/**
* This is the class constructor.
* Return an array representations for 2D barcodes:<ul>
* <li>$arrcode['code'] code to be printed on text label</li>
* <li>$arrcode['num_rows'] required number of rows</li>
* <li>$arrcode['num_cols'] required number of columns</li>
* <li>$arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)</li></ul>
* @param string $code code to print
* @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul>
*/
public function __construct($code, $type) {
$this->setBarcode($code, $type);
}
/**
* Return an array representations of barcode.
* @return array
*/
public function getBarcodeArray() {
return $this->barcode_array;
}
/**
* Set the barcode.
* @param string $code code to print
* @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul>
* @return array
*/
public function setBarcode($code, $type) {
$mode = explode(',', $type);
switch (strtoupper($mode[0])) {
case 'TEST': { // TEST MODE
$this->barcode_array['num_rows'] = 5;
$this->barcode_array['num_cols'] = 15;
$this->barcode_array['bcode'] = array(
array(1,1,1,0,1,1,1,0,1,1,1,0,1,1,1),
array(0,1,0,0,1,0,0,0,1,0,0,0,0,1,0),
array(0,1,0,0,1,1,0,0,1,1,1,0,0,1,0),
array(0,1,0,0,1,0,0,0,0,0,1,0,0,1,0),
array(0,1,0,0,1,1,1,0,1,1,1,0,0,1,0)
);
break;
}
// ... Add here real 2D barcodes ...
default: {
$this->barcode_array = false;
}
}
}
} // end of class
//============================================================+
// END OF FILE
//============================================================+
?>

File diff suppressed because it is too large Load diff

View file

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View file

@ -1,86 +0,0 @@
TCPDF - README
============================================================
IF YOU'D LIKE TO SUPPORT TCPDF, PLEASE CONSIDER MAKING A
DONATION:
http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 4.6.013
Release date: 2009-05-28
Author: Nicola Asuni
Copyright (c) 2001-2009:
Nicola Asuni
Tecnick.com s.r.l.
Via Della Pace, 11
09044 Quartucciu (CA)
ITALY
www.tecnick.com
URLs:
http://www.tcpdf.org
http://www.sourceforge.net/projects/tcpdf
Description:
TCPDF is a PHP class for generating PDF files on-the-fly without requiring external extensions.
TCPDF has been originally derived from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).
Main Features:
// * no external libraries are required for the basic functions;
// * supports all ISO page formats;
// * supports custom page formats, margins and units of measure;
// * supports UTF-8 Unicode and Right-To-Left languages;
// * supports TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
// * supports document encryption;
// * includes methods to publish some XHTML code;
// * includes graphic (geometric) and transformation methods;
// * includes Javascript and forms support;
// * includes a method to print various barcode formats: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS;
// * includes methods to set Bookmarks and print a Table of Content;
// * includes methods to move and delete pages;
// * includes methods for automatic page header and footer management;
// * supports automatic page break;
// * supports automatic page numbering and page groups;
// * supports automatic line break and text justification;
// * supports JPEG and PNG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/www/formats.html)
// * supports stroke and clipping mode for text;
// * supports clipping masks;
// * supports Grayscale, RGB, CMYK, Spot Colors and Transparencies;
// * supports several annotations, including links, text and file attachments;
// * supports page compression (requires zlib extension);
// * supports text hyphenation.
// * supports transactions to UNDO commands.
Installation (full instructions on http://www.tcpdf.org):
1. copy the folder on your Web server
2. set your installation path and other parameters on the config/tcpdf_config.php
3. call the example/example_001.php page with your browser to see an example
Source Code Documentation:
doc/index.html
For Additional Documentation:
http://www.tcpdf.org
License
Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
See LICENSE.TXT file for more information.
============================================================

File diff suppressed because it is too large Load diff

View file

@ -1,73 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
*/
//============================================================+
// File name : eng.php
// Begin : 2004-03-03
// Last Update : 2008-11-17
//
// Description : Language module for TCPDF
// (contains translated texts)
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com s.r.l.
// Via Della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* TCPDF language file (contains translated texts).
* @package com.tecnick.tcpdf
* @abstract TCPDF language file.
* @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://tcpdf.sourceforge.net
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2004-03-03
* Class for backwards compatibility only
*/
// ENGLISH
global $l;
$l = Array();
// PAGE META DESCRIPTORS --------------------------------------
$l['a_meta_charset'] = 'UTF-8';
$l['a_meta_dir'] = 'ltr';
$l['a_meta_language'] = 'en';
// TRANSLATIONS --------------------------------------
$l['w_page'] = 'page';
//============================================================+
// END OF FILE
//============================================================+
?>

View file

@ -1,73 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
*/
//============================================================+
// File name : ita.php
// Begin : 2004-03-03
// Last Update : 2009-03-18
//
// Description : Language module for TCPDF
// (contains translated texts)
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com s.r.l.
// Via Della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* TCPDF language file (contains translated texts).
* @package com.tecnick.tcpdf
* @abstract TCPDF language file.
* @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://tcpdf.sourceforge.net
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2004-03-03
* Class for backwards compatibility only
*/
// ENGLISH
global $l;
$l = Array();
// PAGE META DESCRIPTORS --------------------------------------
$l['a_meta_charset'] = 'UTF-8';
$l['a_meta_dir'] = 'ltr';
$l['a_meta_language'] = 'it';
// TRANSLATIONS --------------------------------------
$l['w_page'] = 'pagina';
//============================================================+
// END OF FILE
//============================================================+
?>

View file

@ -1,266 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r57813 - 2010-08-19 10:34:44 -0700 (Thu, 19 Aug 2010) - kjing - Author: John Mertic <jmertic@sugarcrm.com>
Bug 39085 - When loading the opposite search panel via ajax on the ListViews, call the index action instead of the ListView action to avoid touching pre-MVC code by accident.
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
*/
//============================================================+
// File name : tcpdf_config.php
// Begin : 2004-06-11
// Last Update : 2009-03-18
//
// Description : Configuration file for TCPDF.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com s.r.l.
// Via Della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Configuration file for TCPDF.
* @author Nicola Asuni
* @copyright 2004-2008 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @package com.tecnick.tcpdf
* @version 4.0.014
* @link http://tcpdf.sourceforge.net
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2004-10-27
* Class for backwards compatibility only
*/
// If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored.
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
// DOCUMENT_ROOT fix for IIS Webserver
if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
if(isset($_SERVER['SCRIPT_FILENAME'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])));
} elseif(isset($_SERVER['PATH_TRANSLATED'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
} else {
// define here your DOCUMENT_ROOT path if the previous fails
$_SERVER['DOCUMENT_ROOT'] = '/var/www';
}
}
// Automatic calculation for the following K_PATH_MAIN constant
$k_path_main = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config'))));
if (substr($k_path_main, -1) != '/') {
$k_path_main .= '/';
}
/**
* Installation path (/var/www/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
*/
define ('K_PATH_MAIN', $k_path_main);
// Automatic calculation for the following K_PATH_URL constant
if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') {
$k_path_url = 'https://';
} else {
$k_path_url = 'http://';
}
$k_path_url .= $_SERVER['HTTP_HOST'];
$k_path_url .= str_replace( '\\', '/', substr($_SERVER['PHP_SELF'], 0, -24));
} else {
$k_path_url = '';
}
/**
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
*/
define ('K_PATH_URL', $k_path_url);
/**
* path for PDF fonts
* use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts
*/
define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
/**
* cache directory for temporary files (full path)
*/
define ('K_PATH_CACHE', sugar_cached(K_PATH_MAIN));
/**
* cache directory for temporary files (url path)
*/
define ('K_PATH_URL_CACHE', "cache/".K_PATH_URL);
/**
*images directory
*/
define ('K_PATH_IMAGES', K_PATH_MAIN.'images/');
/**
* blank image
*/
define ('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
/**
* page format
*/
define ('PDF_PAGE_FORMAT', 'A4');
/**
* page orientation (P=portrait, L=landscape)
*/
define ('PDF_PAGE_ORIENTATION', 'P');
/**
* document creator
*/
define ('PDF_CREATOR', 'TCPDF');
/**
* document author
*/
define ('PDF_AUTHOR', 'TCPDF');
/**
* header title
*/
define ('PDF_HEADER_TITLE', 'TCPDF Example');
/**
* header description string
*/
define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
/**
* image logo
*/
define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg');
/**
* header logo image width [mm]
*/
define ('PDF_HEADER_LOGO_WIDTH', 30);
/**
* document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
*/
define ('PDF_UNIT', 'mm');
/**
* header margin
*/
define ('PDF_MARGIN_HEADER', 5);
/**
* footer margin
*/
define ('PDF_MARGIN_FOOTER', 10);
/**
* top margin
*/
define ('PDF_MARGIN_TOP', 27);
/**
* bottom margin
*/
define ('PDF_MARGIN_BOTTOM', 25);
/**
* left margin
*/
define ('PDF_MARGIN_LEFT', 15);
/**
* right margin
*/
define ('PDF_MARGIN_RIGHT', 15);
/**
* default main font name
*/
define ('PDF_FONT_NAME_MAIN', 'helvetica');
/**
* default main font size
*/
define ('PDF_FONT_SIZE_MAIN', 10);
/**
* default data font name
*/
define ('PDF_FONT_NAME_DATA', 'helvetica');
/**
* default data font size
*/
define ('PDF_FONT_SIZE_DATA', 8);
/**
* default monospaced font name
*/
define ('PDF_FONT_MONOSPACED', 'courier');
/**
* Ratio used to scale the images
*/
define ('PDF_IMAGE_SCALE_RATIO', 4);
/**
* magnification factor for titles
*/
define('HEAD_MAGNIFICATION', 1.1);
/**
* height of cell repect font height
*/
define('K_CELL_HEIGHT_RATIO', 1.25);
/**
* title magnification respect main font size
*/
define('K_TITLE_MAGNIFICATION', 1.3);
/**
* reduction factor for small font
*/
define('K_SMALL_RATIO', 2/3);
/**
* if true allows to call TCPDF methods using HTML syntax
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
*/
define('K_TCPDF_CALLS_IN_HTML', true);
}
//============================================================+
// END OF FILE
//============================================================+
?>

View file

@ -1,259 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r57813 - 2010-08-19 10:34:44 -0700 (Thu, 19 Aug 2010) - kjing - Author: John Mertic <jmertic@sugarcrm.com>
Bug 39085 - When loading the opposite search panel via ajax on the ListViews, call the index action instead of the ListView action to avoid touching pre-MVC code by accident.
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
*/
//============================================================+
// File name : tcpdf_config.php
// Begin : 2004-06-11
// Last Update : 2009-03-18
//
// Description : Alternative configuration file for TCPDF.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com s.r.l.
// Via Della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Alternative configuration file for TCPDF.
* @author Nicola Asuni
* @copyright 2004-2008 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @package com.tecnick.tcpdf
* @version 4.0.014
* @link http://tcpdf.sourceforge.net
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2004-10-27
* Class for backwards compatibility only
*/
// DOCUMENT_ROOT fix for IIS Webserver
if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
if(isset($_SERVER['SCRIPT_FILENAME'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])));
} elseif(isset($_SERVER['PATH_TRANSLATED'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
} else {
// define here your DOCUMENT_ROOT path if the previous fails
$_SERVER['DOCUMENT_ROOT'] = '/var/www';
}
}
// Automatic calculation for the following K_PATH_MAIN constant
$k_path_main = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config'))));
if (substr($k_path_main, -1) != '/') {
$k_path_main .= '/';
}
/**
* Installation path (/var/www/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
*/
define ('K_PATH_MAIN', $k_path_main);
// Automatic calculation for the following K_PATH_URL constant
if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') {
$k_path_url = 'https://';
} else {
$k_path_url = 'http://';
}
$k_path_url .= $_SERVER['HTTP_HOST'];
$k_path_url .= str_replace( '\\', '/', substr($_SERVER['PHP_SELF'], 0, -24));
}
/**
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances..
*/
define ('K_PATH_URL', $k_path_url);
/**
* path for PDF fonts
* use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts
*/
define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
/**
* cache directory for temporary files (full path)
*/
define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');
/**
* cache directory for temporary files (url path)
*/
define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/');
/**
*images directory
*/
define ('K_PATH_IMAGES', K_PATH_MAIN.'images/');
/**
* blank image
*/
define ('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
/**
* page format
*/
define ('PDF_PAGE_FORMAT', 'A4');
/**
* page orientation (P=portrait, L=landscape)
*/
define ('PDF_PAGE_ORIENTATION', 'P');
/**
* document creator
*/
define ('PDF_CREATOR', 'TCPDF');
/**
* document author
*/
define ('PDF_AUTHOR', 'TCPDF');
/**
* header title
*/
define ('PDF_HEADER_TITLE', 'TCPDF Example');
/**
* header description string
*/
define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
/**
* image logo
*/
define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg');
/**
* header logo image width [mm]
*/
define ('PDF_HEADER_LOGO_WIDTH', 30);
/**
* document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
*/
define ('PDF_UNIT', 'mm');
/**
* header margin
*/
define ('PDF_MARGIN_HEADER', 5);
/**
* footer margin
*/
define ('PDF_MARGIN_FOOTER', 10);
/**
* top margin
*/
define ('PDF_MARGIN_TOP', 27);
/**
* bottom margin
*/
define ('PDF_MARGIN_BOTTOM', 25);
/**
* left margin
*/
define ('PDF_MARGIN_LEFT', 15);
/**
* right margin
*/
define ('PDF_MARGIN_RIGHT', 15);
/**
* default main font name
*/
define ('PDF_FONT_NAME_MAIN', 'helvetica');
/**
* default main font size
*/
define ('PDF_FONT_SIZE_MAIN', 10);
/**
* default data font name
*/
define ('PDF_FONT_NAME_DATA', 'helvetica');
/**
* default data font size
*/
define ('PDF_FONT_SIZE_DATA', 8);
/**
* default monospaced font name
*/
define ('PDF_FONT_MONOSPACED', 'courier');
/**
* Ratio used to scale the images
*/
define ('PDF_IMAGE_SCALE_RATIO', 4);
/**
* magnification factor for titles
*/
define('HEAD_MAGNIFICATION', 1.1);
/**
* height of cell repect font height
*/
define('K_CELL_HEIGHT_RATIO', 1.25);
/**
* title magnification respect main font size
*/
define('K_TITLE_MAGNIFICATION', 1.3);
/**
* reduction factor for small font
*/
define('K_SMALL_RATIO', 2/3);
/**
* if true allows to call TCPDF methods using HTML syntax
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
*/
define('K_TCPDF_CALLS_IN_HTML', true);
//============================================================+
// END OF FILE
//============================================================+
?>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,742 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r47930 - 2009-06-02 16:21:39 -0700 (Tue, 02 Jun 2009) - jenny - Updating with changes from bsoufflet.
*/
// BEGIN SUGARCRM SPECIFIC
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
// END SUGARCRM SPECIFIC
//============================================================+
// File name : makefont.php
// Begin : 2004-12-31
// Last Update : 2008-12-06
// Version : 1.2.004
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Nicola Asuni - Tecnick.com S.r.l.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// ----------------------------------------------------------------------------
//
// Description : Utility to generate font definition files fot TCPDF
//
// Authors: Nicola Asuni, Olivier Plathey, Steven Wittens
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Utility to generate font definition files fot TCPDF.
* @author Nicola Asuni, Olivier Plathey, Steven Wittens
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @package com.tecnick.tcpdf
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* Class for backwards compatibility only
*/
/**
*
* @param string $fontfile path to font file (TTF, OTF or PFB).
* @param string $fmfile font metrics file (UFM or AFM).
* @param boolean $embedded Set to false to not embed the font, true otherwise (default).
* @param string $enc Name of the encoding table to use. Omit this parameter for TrueType Unicode, OpenType Unicode and symbolic fonts like Symbol or ZapfDingBats.
* @param array $patch Optional modification of the encoding
*/
function MakeFont($fontfile, $fmfile, $embedded=true, $enc='cp1252', $patch=array()/* BEGIN SUGARCRM SPECIFIC */, $cidInfo=""/* END SUGARCRM SPECIFIC */)
{
//Generate a font definition file
set_magic_quotes_runtime(0);
ini_set('auto_detect_line_endings', '1');
if (!file_exists($fontfile)) {
die('Error: file not found: '.$fontfile);
}
if (!file_exists($fmfile)) {
die('Error: file not found: '.$fmfile);
}
$cidtogidmap = '';
$map = array();
$diff = '';
$dw = 0; // default width
$ffext = strtolower(substr($fontfile, -3));
$fmext = strtolower(substr($fmfile, -3));
if ($fmext == 'afm') {
if (($ffext == 'ttf') or ($ffext == 'otf')) {
$type = 'TrueType';
} elseif ($ffext == 'pfb') {
$type = 'Type1';
} else {
die('Error: unrecognized font file extension: '.$ffext);
}
if ($enc) {
$map = ReadMap($enc);
foreach ($patch as $cc => $gn) {
$map[$cc] = $gn;
}
}
$fm = ReadAFM($fmfile, $map);
if (isset($widths['.notdef'])) {
$dw = $widths['.notdef'];
}
if ($enc) {
$diff = MakeFontEncoding($map);
}
$fd = MakeFontDescriptor($fm, empty($map));
} elseif ($fmext == 'ufm') {
$enc = '';
if (($ffext == 'ttf') or ($ffext == 'otf')) {
$type = 'TrueTypeUnicode';
} else {
die('Error: not a TrueType font: '.$ffext);
}
$fm = ReadUFM($fmfile, $cidtogidmap);
$dw = $fm['MissingWidth'];
$fd = MakeFontDescriptor($fm, false);
}
//Start generation
$s = '<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r47930 - 2009-06-02 16:21:39 -0700 (Tue, 02 Jun 2009) - jenny - Updating with changes from bsoufflet.
*/
'."\n";
// BEGIN SUGARCRM SPECIFIC
if ($embedded) {
// END SUGARCRM SPECIFIC
$s .= '$type=\''.$type."';\n";
// BEGIN SUGARCRM SPECIFIC
} else {
$s .= '$type=\''."cidfont0';\n";
}
// END SUGARCRM SPECIFIC
$s .= '$name=\''.$fm['FontName']."';\n";
$s .= '$desc='.$fd.";\n";
if (!isset($fm['UnderlinePosition'])) {
$fm['UnderlinePosition'] = -100;
}
if (!isset($fm['UnderlineThickness'])) {
$fm['UnderlineThickness'] = 50;
}
$s .= '$up='.$fm['UnderlinePosition'].";\n";
$s .= '$ut='.$fm['UnderlineThickness'].";\n";
if ($dw <= 0) {
if (isset($fm['Widths'][32]) and ($fm['Widths'][32] > 0)) {
// assign default space width
$dw = $fm['Widths'][32];
} else {
$dw = 600;
}
}
// BEGIN SUGARCRM SPECIFIC
if ($embedded) {
// END SUGARCRM SPECIFIC
$s .= '$dw='.$dw.";\n";
// BEGIN SUGARCRM SPECIFIC
} else {
$s .= '$dw='."1000;\n";
}
// END SUGARCRM SPECIFIC
$w = MakeWidthArray($fm);
$s .= '$cw='.$w.";\n";
// BEGIN SUGARCRM SPECIFIC
if ($embedded) {
// END SUGARCRM SPECIFIC
$s .= '$enc=\''.$enc."';\n";
// BEGIN SUGARCRM SPECIFIC
}
// END SUGARCRM SPECIFIC
$s .= '$diff=\''.$diff."';\n";
$basename = substr(basename($fmfile), 0, -4);
// BEGIN SUGARCRM SPECIFIC
$dirname = dirname($fmfile);
// END SUGARCRM SPECIFIC
if ($embedded) {
//Embedded font
if (($type == 'TrueType') or ($type == 'TrueTypeUnicode')) {
CheckTTF($fontfile);
}
$f = fopen($fontfile, 'rb');
if (!$f) {
die('Error: Unable to open '.$fontfile);
}
$file = stream_get_contents($f);
fclose($f);
if ($type == 'Type1') {
//Find first two sections and discard third one
$header = (ord($file[0]) == 128);
if ($header) {
//Strip first binary header
$file = substr($file, 6);
}
$pos = strpos($file, 'eexec');
if (!$pos) {
die('Error: font file does not seem to be valid Type1');
}
$size1 = $pos + 6;
if ($header and (ord($file[$size1]) == 128)) {
//Strip second binary header
$file = substr($file, 0, $size1).substr($file, $size1+6);
}
$pos = strpos($file, '00000000');
if (!$pos) {
die('Error: font file does not seem to be valid Type1');
}
$size2 = $pos - $size1;
$file = substr($file, 0, ($size1 + $size2));
}
$basename = strtolower($basename);
if (function_exists('gzcompress')) {
$cmp = $basename.'.z';
// BEGIN SUGARCRM SPECIFIC
/*
// END SUGARCRM SPECIFIC
SaveToFile($cmp, gzcompress($file, 9), 'b');
// BEGIN SUGARCRM SPECIFIC
*/
SaveToFile($dirname."/".$cmp, gzcompress($file, 9), 'b');
// END SUGARCRM SPECIFIC
$s .= '$file=\''.$cmp."';\n";
print "Font file compressed (".$cmp.")\n";
if (!empty($cidtogidmap)) {
$cmp = $basename.'.ctg.z';
// BEGIN SUGARCRM SPECIFIC
/*
// END SUGARCRM SPECIFIC
SaveToFile($cmp, gzcompress($cidtogidmap, 9), 'b');
// BEGIN SUGARCRM SPECIFIC
*/
SaveToFile($dirname."/".$cmp, gzcompress($cidtogidmap, 9), 'b');
// END SUGARCRM SPECIFIC
print "CIDToGIDMap created and compressed (".$cmp.")\n";
$s .= '$ctg=\''.$cmp."';\n";
}
} else {
$s .= '$file=\''.basename($fontfile)."';\n";
print "Notice: font file could not be compressed (zlib extension not available)\n";
if (!empty($cidtogidmap)) {
$cmp = $basename.'.ctg';
// BEGIN SUGARCRM SPECIFIC
/*
// END SUGARCRM SPECIFIC
$f = fopen($cmp, 'wb');
// BEGIN SUGARCRM SPECIFIC
*/
$f = fopen($dirname."/".$cmp, 'wb');
// END SUGARCRM SPECIFIC
fwrite($f, $cidtogidmap);
fclose($f);
print "CIDToGIDMap created (".$cmp.")\n";
$s .= '$ctg=\''.$cmp."';\n";
}
}
if ($type == 'Type1') {
$s .= '$size1='.$size1.";\n";
$s .= '$size2='.$size2.";\n";
} else {
$s.='$originalsize='.filesize($fontfile).";\n";
}
} else {
//Not embedded font
// BEGIN SUGARCRM SPECIFIC
/*
// END SUGARCRM SPECIFIC
$s .= '$file='."'';\n";
// BEGIN SUGARCRM SPECIFIC
*/
$s .= $cidInfo;
// END SUGARCRM SPECIFIC
}
$s .= "?>";
// BEGIN SUGARCRM SPECIFIC
/*
// END SUGARCRM SPECIFIC
SaveToFile($basename.'.php',$s);
// BEGIN SUGARCRM SPECIFIC
*/
SaveToFile($dirname."/".$basename.'.php', $s);
// END SUGARCRM SPECIFIC
print "Font definition file generated (".$basename.".php)\n";
// BEGIN SUGARCRM SPECIFIC
return $dirname."/".$basename;
// END SUGARCRM SPECIFIC
}
/**
* Read the specified encoding map.
* @param string $enc map name (see /enc/ folder for valid names).
*/
function ReadMap($enc)
{
//Read a map file
$file = dirname(__FILE__).'/enc/'.strtolower($enc).'.map';
$a = file($file);
if (empty($a)) {
die('Error: encoding not found: '.$enc);
}
$cc2gn = array();
foreach ($a as $l) {
if ($l[0] == '!') {
$e = preg_split('/[ \\t]+/', rtrim($l));
$cc = hexdec(substr($e[0], 1));
$gn = $e[2];
$cc2gn[$cc] = $gn;
}
}
for ($i = 0; $i <= 255; $i++) {
if (!isset($cc2gn[$i])) {
$cc2gn[$i] = '.notdef';
}
}
return $cc2gn;
}
/**
* Read UFM file
*/
function ReadUFM($file, &$cidtogidmap)
{
//Prepare empty CIDToGIDMap
$cidtogidmap = str_pad('', (256 * 256 * 2), "\x00");
//Read a font metric file
$a = file($file);
if (empty($a)) {
die('File not found');
}
$widths = array();
$fm = array();
foreach ($a as $l) {
$e = explode(' ', rtrim($l));
if (count($e) < 2) {
continue;
}
$code = $e[0];
$param = $e[1];
if ($code == 'U') {
// U 827 ; WX 0 ; N squaresubnosp ; G 675 ;
//Character metrics
$cc = (int)$e[1];
if ($cc != -1) {
$gn = $e[7];
$w = $e[4];
$glyph = $e[10];
$widths[$cc] = $w;
if ($cc == ord('X')) {
$fm['CapXHeight'] = $e[13];
}
// Set GID
if (($cc >= 0) and ($cc < 0xFFFF) and $glyph) {
$cidtogidmap[($cc * 2)] = chr($glyph >> 8);
$cidtogidmap[(($cc * 2) + 1)] = chr($glyph & 0xFF);
}
}
if (($gn == '.notdef') and (!isset($fm['MissingWidth']))) {
$fm['MissingWidth'] = $w;
}
} elseif ($code == 'FontName') {
$fm['FontName'] = $param;
} elseif ($code == 'Weight') {
$fm['Weight'] = $param;
} elseif ($code == 'ItalicAngle') {
$fm['ItalicAngle'] = (double)$param;
} elseif ($code == 'Ascender') {
$fm['Ascender'] = (int)$param;
} elseif ($code == 'Descender') {
$fm['Descender'] = (int)$param;
} elseif ($code == 'UnderlineThickness') {
$fm['UnderlineThickness'] = (int)$param;
} elseif ($code == 'UnderlinePosition') {
$fm['UnderlinePosition'] = (int)$param;
} elseif ($code == 'IsFixedPitch') {
$fm['IsFixedPitch'] = ($param == 'true');
} elseif ($code == 'FontBBox') {
$fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
} elseif ($code == 'CapHeight') {
$fm['CapHeight'] = (int)$param;
} elseif ($code == 'StdVW') {
$fm['StdVW'] = (int)$param;
}
}
if (!isset($fm['MissingWidth'])) {
$fm['MissingWidth'] = 600;
}
if (!isset($fm['FontName'])) {
die('FontName not found');
}
$fm['Widths'] = $widths;
return $fm;
}
/**
* Read AFM file
*/
function ReadAFM($file, &$map)
{
//Read a font metric file
$a = file($file);
if (empty($a)) {
die('File not found');
}
$widths = array();
$fm = array();
$fix = array(
'Edot'=>'Edotaccent',
'edot'=>'edotaccent',
'Idot'=>'Idotaccent',
'Zdot'=>'Zdotaccent',
'zdot'=>'zdotaccent',
'Odblacute' => 'Ohungarumlaut',
'odblacute' => 'ohungarumlaut',
'Udblacute'=>'Uhungarumlaut',
'udblacute'=>'uhungarumlaut',
'Gcedilla'=>'Gcommaaccent'
,'gcedilla'=>'gcommaaccent',
'Kcedilla'=>'Kcommaaccent',
'kcedilla'=>'kcommaaccent',
'Lcedilla'=>'Lcommaaccent',
'lcedilla'=>'lcommaaccent',
'Ncedilla'=>'Ncommaaccent',
'ncedilla'=>'ncommaaccent',
'Rcedilla'=>'Rcommaaccent',
'rcedilla'=>'rcommaaccent',
'Scedilla'=>'Scommaaccent',
'scedilla'=>'scommaaccent',
'Tcedilla'=>'Tcommaaccent',
'tcedilla'=>'tcommaaccent',
'Dslash'=>'Dcroat',
'dslash'=>'dcroat',
'Dmacron'=>'Dcroat',
'dmacron'=>'dcroat',
'combininggraveaccent'=>'gravecomb',
'combininghookabove'=>'hookabovecomb',
'combiningtildeaccent'=>'tildecomb',
'combiningacuteaccent'=>'acutecomb',
'combiningdotbelow'=>'dotbelowcomb',
'dongsign'=>'dong'
);
foreach ($a as $l) {
$e = explode(' ', rtrim($l));
if (count($e) < 2) {
continue;
}
$code = $e[0];
$param = $e[1];
if ($code == 'C') {
//Character metrics
$cc = (int)$e[1];
$w = $e[4];
$gn = $e[7];
if (substr($gn, -4) == '20AC') {
$gn = 'Euro';
}
if (isset($fix[$gn])) {
//Fix incorrect glyph name
foreach ($map as $c => $n) {
if ($n == $fix[$gn]) {
$map[$c] = $gn;
}
}
}
if (empty($map)) {
//Symbolic font: use built-in encoding
$widths[$cc] = $w;
} else {
$widths[$gn] = $w;
if ($gn == 'X') {
$fm['CapXHeight'] = $e[13];
}
}
if ($gn == '.notdef') {
$fm['MissingWidth'] = $w;
}
} elseif ($code == 'FontName') {
$fm['FontName'] = $param;
} elseif ($code == 'Weight') {
$fm['Weight'] = $param;
} elseif ($code == 'ItalicAngle') {
$fm['ItalicAngle'] = (double)$param;
} elseif ($code == 'Ascender') {
$fm['Ascender'] = (int)$param;
} elseif ($code == 'Descender') {
$fm['Descender'] = (int)$param;
} elseif ($code == 'UnderlineThickness') {
$fm['UnderlineThickness'] = (int)$param;
} elseif ($code == 'UnderlinePosition') {
$fm['UnderlinePosition'] = (int)$param;
} elseif ($code == 'IsFixedPitch') {
$fm['IsFixedPitch'] = ($param == 'true');
} elseif ($code == 'FontBBox') {
$fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
} elseif ($code == 'CapHeight') {
$fm['CapHeight'] = (int)$param;
} elseif ($code == 'StdVW') {
$fm['StdVW'] = (int)$param;
}
}
if (!isset($fm['FontName'])) {
die('FontName not found');
}
if (!empty($map)) {
if (!isset($widths['.notdef'])) {
$widths['.notdef'] = 600;
}
if (!isset($widths['Delta']) and isset($widths['increment'])) {
$widths['Delta'] = $widths['increment'];
}
//Order widths according to map
for ($i = 0; $i <= 255; $i++) {
if (!isset($widths[$map[$i]])) {
print "Warning: character ".$map[$i]." is missing\n";
$widths[$i] = $widths['.notdef'];
} else {
$widths[$i] = $widths[$map[$i]];
}
}
}
$fm['Widths'] = $widths;
return $fm;
}
function MakeFontDescriptor($fm, $symbolic=false)
{
//Ascent
$asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
$fd = "array('Ascent'=>".$asc;
//Descent
$desc = (isset($fm['Descender']) ? $fm['Descender'] : -200);
$fd .= ",'Descent'=>".$desc;
//CapHeight
if (isset($fm['CapHeight'])) {
$ch = $fm['CapHeight'];
} elseif (isset($fm['CapXHeight'])) {
$ch = $fm['CapXHeight'];
} else {
$ch = $asc;
}
$fd .= ",'CapHeight'=>".$ch;
//Flags
$flags = 0;
if (isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) {
$flags += 1<<0;
}
if ($symbolic) {
$flags += 1<<2;
} else {
$flags += 1<<5;
}
if (isset($fm['ItalicAngle']) and ($fm['ItalicAngle'] != 0)) {
$flags += 1<<6;
}
$fd .= ",'Flags'=>".$flags;
//FontBBox
if (isset($fm['FontBBox'])) {
$fbb = $fm['FontBBox'];
} else {
$fbb = array(0, ($desc - 100), 1000, ($asc + 100));
}
$fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
//ItalicAngle
$ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
$fd .= ",'ItalicAngle'=>".$ia;
//StemV
if (isset($fm['StdVW'])) {
$stemv = $fm['StdVW'];
} elseif (isset($fm['Weight']) and eregi('(bold|black)', $fm['Weight'])) {
$stemv = 120;
} else {
$stemv = 70;
}
$fd .= ",'StemV'=>".$stemv;
//MissingWidth
if (isset($fm['MissingWidth'])) {
$fd .= ",'MissingWidth'=>".$fm['MissingWidth'];
}
$fd .= ')';
return $fd;
}
function MakeWidthArray($fm)
{
//Make character width array
$s = 'array(';
$cw = $fm['Widths'];
$els = array();
$c = 0;
foreach ($cw as $i => $w) {
if (is_numeric($i)) {
$els[] = (((($c++)%10) == 0) ? "\n" : '').$i.'=>'.$w;
}
}
$s .= implode(',', $els);
$s .= ')';
return $s;
}
function MakeFontEncoding($map)
{
//Build differences from reference encoding
$ref = ReadMap('cp1252');
$s = '';
$last = 0;
for ($i = 32; $i <= 255; $i++) {
if ($map[$i] != $ref[$i]) {
if ($i != $last+1) {
$s .= $i.' ';
}
$last = $i;
$s .= '/'.$map[$i].' ';
}
}
return rtrim($s);
}
function SaveToFile($file, $s, $mode='t')
{
$f = fopen($file, 'w'.$mode);
if (!$f) {
die('Can\'t write to file '.$file);
}
fwrite($f, $s, strlen($s));
fclose($f);
}
function ReadShort($f)
{
$a = unpack('n1n', fread($f, 2));
return $a['n'];
}
function ReadLong($f)
{
$a = unpack('N1N', fread($f, 4));
return $a['N'];
}
function CheckTTF($file)
{
//Check if font license allows embedding
$f = fopen($file, 'rb');
if (!$f) {
die('Error: unable to open '.$file);
}
//Extract number of tables
fseek($f, 4, SEEK_CUR);
$nb = ReadShort($f);
fseek($f, 6, SEEK_CUR);
//Seek OS/2 table
$found = false;
for ($i = 0; $i < $nb; $i++) {
if (fread($f, 4) == 'OS/2') {
$found = true;
break;
}
fseek($f, 12, SEEK_CUR);
}
if (!$found) {
fclose($f);
return;
}
fseek($f, 4, SEEK_CUR);
$offset = ReadLong($f);
fseek($f, $offset, SEEK_SET);
//Extract fsType flags
fseek($f, 8, SEEK_CUR);
$fsType = ReadShort($f);
$rl = ($fsType & 0x02) != 0;
$pp = ($fsType & 0x04) != 0;
$e = ($fsType & 0x08) != 0;
fclose($f);
if ($rl and (!$pp) and (!$e)) {
print "Warning: font license does not allow embedding\n";
}
}
// BEGIN SUGARCRM SPECIFIC
/*
// END SUGARCRM SPECIFIC
$arg = $GLOBALS['argv'];
if (count($arg) >= 3) {
ob_start();
array_shift($arg);
if (sizeof($arg) == 3) {
$arg[3] = $arg[2];
$arg[2] = true;
} else {
if (!isset($arg[2])) {
$arg[2] = true;
}
if (!isset($arg[3])) {
$arg[3] = 'cp1252';
}
}
if (!isset($arg[4])) {
$arg[4] = array();
}
MakeFont($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
$t = ob_get_clean();
print preg_replace('!<BR( /)?>!i', "\n", $t);
} else {
print "Usage: makefont.php <ttf/otf/pfb file> <afm/ufm file> <encoding> <patch>\n";
}
// BEGIN SUGARCRM SPECIFIC
*/
// END SUGARCRM SPECIFIC

View file

@ -1,231 +1,4 @@
<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
*/
//============================================================+
// File name : htmlcolors.php
// Begin : 2002-04-09
// Last Update : 2008-11-17
// Version : 1.0.002
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// ----------------------------------------------------------------------------
//
// Description : Array of WEB safe colors
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Array of WEB safe colors.
* @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @package com.tecnick.tcpdf
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2.9.000 (2008-03-26)
* Class for backwards compatibility only
*/
/**
* Array of WEB safe colors
*/
global $webcolor;
$webcolor = array (
'aliceblue' => 'f0f8ff',
'antiquewhite' => 'faebd7',
'aqua' => '00ffff',
'aquamarine' => '7fffd4',
'azure' => 'f0ffff',
'beige' => 'f5f5dc',
'bisque' => 'ffe4c4',
'black' => '000000',
'blanchedalmond' => 'ffebcd',
'blue' => '0000ff',
'blueviolet' => '8a2be2',
'brown' => 'a52a2a',
'burlywood' => 'deb887',
'cadetblue' => '5f9ea0',
'chartreuse' => '7fff00',
'chocolate' => 'd2691e',
'coral' => 'ff7f50',
'cornflowerblue' => '6495ed',
'cornsilk' => 'fff8dc',
'crimson' => 'dc143c',
'cyan' => '00ffff',
'darkblue' => '00008b',
'darkcyan' => '008b8b',
'darkgoldenrod' => 'b8860b',
'darkgray' => 'a9a9a9',
'darkgrey' => 'a9a9a9',
'darkgreen' => '006400',
'darkkhaki' => 'bdb76b',
'darkmagenta' => '8b008b',
'darkolivegreen' => '556b2f',
'darkorange' => 'ff8c00',
'darkorchid' => '9932cc',
'darkred' => '8b0000',
'darksalmon' => 'e9967a',
'darkseagreen' => '8fbc8f',
'darkslateblue' => '483d8b',
'darkslategray' => '2f4f4f',
'darkslategrey' => '2f4f4f',
'darkturquoise' => '00ced1',
'darkviolet' => '9400d3',
'deeppink' => 'ff1493',
'deepskyblue' => '00bfff',
'dimgray' => '696969',
'dimgrey' => '696969',
'dodgerblue' => '1e90ff',
'firebrick' => 'b22222',
'floralwhite' => 'fffaf0',
'forestgreen' => '228b22',
'fuchsia' => 'ff00ff',
'gainsboro' => 'dcdcdc',
'ghostwhite' => 'f8f8ff',
'gold' => 'ffd700',
'goldenrod' => 'daa520',
'gray' => '808080',
'grey' => '808080',
'green' => '008000',
'greenyellow' => 'adff2f',
'honeydew' => 'f0fff0',
'hotpink' => 'ff69b4',
'indianred ' => 'cd5c5c',
'indigo ' => '4b0082',
'ivory' => 'fffff0',
'khaki' => 'f0e68c',
'lavender' => 'e6e6fa',
'lavenderblush' => 'fff0f5',
'lawngreen' => '7cfc00',
'lemonchiffon' => 'fffacd',
'lightblue' => 'add8e6',
'lightcoral' => 'f08080',
'lightcyan' => 'e0ffff',
'lightgoldenrodyellow' => 'fafad2',
'lightgray' => 'd3d3d3',
'lightgrey' => 'd3d3d3',
'lightgreen' => '90ee90',
'lightpink' => 'ffb6c1',
'lightsalmon' => 'ffa07a',
'lightseagreen' => '20b2aa',
'lightskyblue' => '87cefa',
'lightslategray' => '778899',
'lightslategrey' => '778899',
'lightsteelblue' => 'b0c4de',
'lightyellow' => 'ffffe0',
'lime' => '00ff00',
'limegreen' => '32cd32',
'linen' => 'faf0e6',
'magenta' => 'ff00ff',
'maroon' => '800000',
'mediumaquamarine' => '66cdaa',
'mediumblue' => '0000cd',
'mediumorchid' => 'ba55d3',
'mediumpurple' => '9370d8',
'mediumseagreen' => '3cb371',
'mediumslateblue' => '7b68ee',
'mediumspringgreen' => '00fa9a',
'mediumturquoise' => '48d1cc',
'mediumvioletred' => 'c71585',
'midnightblue' => '191970',
'mintcream' => 'f5fffa',
'mistyrose' => 'ffe4e1',
'moccasin' => 'ffe4b5',
'navajowhite' => 'ffdead',
'navy' => '000080',
'oldlace' => 'fdf5e6',
'olive' => '808000',
'olivedrab' => '6b8e23',
'orange' => 'ffa500',
'orangered' => 'ff4500',
'orchid' => 'da70d6',
'palegoldenrod' => 'eee8aa',
'palegreen' => '98fb98',
'paleturquoise' => 'afeeee',
'palevioletred' => 'd87093',
'papayawhip' => 'ffefd5',
'peachpuff' => 'ffdab9',
'peru' => 'cd853f',
'pink' => 'ffc0cb',
'plum' => 'dda0dd',
'powderblue' => 'b0e0e6',
'purple' => '800080',
'red' => 'ff0000',
'rosybrown' => 'bc8f8f',
'royalblue' => '4169e1',
'saddlebrown' => '8b4513',
'salmon' => 'fa8072',
'sandybrown' => 'f4a460',
'seagreen' => '2e8b57',
'seashell' => 'fff5ee',
'sienna' => 'a0522d',
'silver' => 'c0c0c0',
'skyblue' => '87ceeb',
'slateblue' => '6a5acd',
'slategray' => '708090',
'slategrey' => '708090',
'snow' => 'fffafa',
'springgreen' => '00ff7f',
'steelblue' => '4682b4',
'tan' => 'd2b48c',
'teal' => '008080',
'thistle' => 'd8bfd8',
'tomato' => 'ff6347',
'turquoise' => '40e0d0',
'violet' => 'ee82ee',
'wheat' => 'f5deb3',
'white' => 'ffffff',
'whitesmoke' => 'f5f5f5',
'yellow' => 'ffff00',
'yellowgreen' => '9acd32'
);
//============================================================+
// END OF FILE
//============================================================+
?>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
@ -42,4 +42,5 @@ if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
require_once "include/UploadFile.php";
require_once __DIR__ . '/../lib/Utility/AntiMalware/AntiMalwareTrait.php';
require_once __DIR__ . '/../include/UploadFile.php';

View file

@ -114,6 +114,9 @@ function make_sugar_config(&$sugar_config)
'calculate_response_time' => empty($calculate_response_time) ? true : $calculate_response_time,
'create_default_user' => empty($create_default_user) ? false : $create_default_user,
'chartEngine' => 'Jit',
'pdf' => [
'defaultEngine' => 'TCPDFEngine'
],
'date_formats' => empty($dateFormats) ? array(
'Y-m-d' => '2010-12-23',
'd-m-Y' => '23-12-2010',
@ -280,6 +283,26 @@ function get_sugar_config_defaults(): array
$sugar_config_defaults = [
'disableAjaxUI' => true,
'admin_export_only' => false,
'anti_malware_scanners' => [
'SuiteCRM\Utility\AntiMalware\Providers\ClamTCP' => [
'name' => 'ClamAntiVirus TCP',
'support_page' => 'https://www.clamav.net/',
'enabled' => false,
'path' => null,
'options' => [
'ip' => '127.0.0.1',
'port' => 3310,
'type' => 'local'
],
],
'SuiteCRM\Utility\AntiMalware\Providers\Sophos' => [
'name' => 'Sophos Anti Virus (Linux)',
'support_page' => 'https://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-linux.aspx',
'enabled' => false,
'path' => '/opt/sophos-av/bin/savscan',
'options' => '-ss'
]
],
'export_delimiter' => ',',
'export_excel_compatible' => false,
'cache_dir' => 'cache/',
@ -514,8 +537,6 @@ function get_sugar_config_defaults(): array
$locale = new Localization();
}
$sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies();
$sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults);
return $sugar_config_defaults;

View file

@ -1897,11 +1897,11 @@ if (!isset($_SESSION['setup_db_manager'])) {
$db = getInstallDbInstance();
if(!isset($_SESSION['setup_db_collation']) || $_SESSION['setup_db_collation'] ==''){
$_SESSION['setup_db_collation'] = 'utf8_general_ci';
$_SESSION['setup_db_collation'] = 'utf8mb4_general_ci';
}
if(!isset($_SESSION['setup_db_charset']) || $_SESSION['setup_db_charset'] ==''){
$_SESSION['setup_db_charset'] = 'utf8';
$_SESSION['setup_db_charset'] = 'utf8mb4';
}

View file

@ -978,10 +978,7 @@ function handleHtaccess()
}
$htaccess_file = '.htaccess';
$contents = '';
$basePath = parse_url($sugar_config['site_url'], PHP_URL_PATH);
if (empty($basePath)) {
$basePath = '/';
}
$basePath = '/legacy';
$cacheDir = $sugar_config['cache_dir'];
$restrict_str = <<<EOQ
@ -1112,7 +1109,7 @@ EOQ;
// add custom content from current '.htaccess' before "# BEGIN SUITECRM RESTRICTIONS"
$haveBegin = false;
if (file_exists($htaccess_file)) {
if (is_file($htaccess_file)) {
$fp = fopen($htaccess_file, 'rb');
while ($line = fgets($fp)) {
if (preg_match("/\s*#\s*BEGIN\s*SUITECRM\s*RESTRICTIONS/i",
@ -1127,7 +1124,7 @@ EOQ;
// add default content
$contents .= $restrict_str . $cache_headers;
// add custom content from current '.htaccess' after "# END SUITECRM RESTRICTIONS"
if ($haveBegin && file_exists($htaccess_file)) {
if ($haveBegin && is_file($htaccess_file)) {
$skip = true;
$fp = fopen($htaccess_file, 'rb');
while ($line = fgets($fp)) {

View file

@ -91,6 +91,7 @@ $mod_strings = array(
'ERR_DB_EXISTS_PROCEED' => 'The provided Database Name already exists. You can<br>1. hit the back button and choose a new database name <br>2. click next and continue but all existing tables on this database will be dropped. <strong>This means your tables and data will be blown away.</strong>',
'ERR_DB_HOSTNAME' => 'Host name cannot be blank.',
'ERR_DB_INVALID' => 'Invalid database type selected.',
'ERR_DB_LOGIN_FAILURE_SHORT' => 'Database Connection Error: The provided database hostname, port, username, and/or password is invalid.',
'ERR_DB_LOGIN_FAILURE' => 'The provided database host, username, and/or password is invalid, and a connection to the database could not be established. Please enter a valid host, username and password',
'ERR_DB_LOGIN_FAILURE_MYSQL' => 'The provided database host, username, and/or password is invalid, and a connection to the database could not be established. Please enter a valid host, username and password',
'ERR_DB_LOGIN_FAILURE_MSSQL' => 'The provided database host, username, and/or password is invalid, and a connection to the database could not be established. Please enter a valid host, username and password',
@ -182,6 +183,7 @@ $mod_strings = array(
'LBL_CONFIRM_WILL' => 'will',
'LBL_DBCONF_DB_DROP' => 'Drop Tables',
'LBL_DBCONF_DB_NAME' => 'Database Name',
'LBL_DBCONF_DB_PORT' => 'Database Port',
'LBL_DBCONF_DB_PASSWORD' => 'SuiteCRM Database User Password',
'LBL_DBCONF_DB_PASSWORD2' => 'Re-enter SuiteCRM Database User Password',
'LBL_DBCONF_DB_USER' => 'SuiteCRM Database User',
@ -208,6 +210,7 @@ $mod_strings = array(
'LBL_DISABLED_HELP_1' => 'For installation help, please visit the SuiteCRM',
'LBL_DISABLED_HELP_LNK' => 'https://community.suitecrm.com',
'LBL_DISABLED_HELP_2' => 'support forums',
'LBL_APP_NOT_INSTALLED' => 'SuiteCRM is not installed. Entry point needs an installed SuiteCRM, please install first.',
'LBL_DISABLED_TITLE_2' => 'SuiteCRM Installation has been Disabled',
'LBL_HELP' => 'Help',
'LBL_INSTALL' => 'Install',
@ -228,6 +231,8 @@ $mod_strings = array(
'LBL_LANG_SUCCESS' => 'The language pack was successfully uploaded.',
'LBL_LANG_TITLE' => 'Language Pack',
'LBL_LAUNCHING_SILENT_INSTALL' => 'Installing SuiteCRM now. This may take up to a few minutes.',
'LBL_SILENT_INSTALL_SUCCESS' => 'SuiteCRM is successfully installed.',
'LBL_SILENT_INSTALL_FAILED' => 'SuiteCRM installation failed.',
'LBL_LANG_UPLOAD' => 'Upload a Language Pack',
'LBL_LICENSE_ACCEPTANCE' => 'License Acceptance',
'LBL_LICENSE_CHECKING' => 'Checking system for compatibility.',
@ -240,6 +245,7 @@ $mod_strings = array(
'LBL_LICENSE_PRINTABLE' => ' Printable View ',
'LBL_PRINT_SUMM' => 'Print Summary',
'LBL_LICENSE_TITLE_2' => 'SuiteCRM License',
'LBL_LICENSE' => 'LICENSE',
'LBL_LOCALE_NAME_FIRST' => 'David',
'LBL_LOCALE_NAME_LAST' => 'Livingstone',
@ -575,5 +581,9 @@ $contact_user_link_guid',
'LBL_DBCONFIG_MSG2_LABEL' => 'Host Name',
'LBL_DBCONFIG_MSG2' => 'Name of web server or machine (host) on which the database is located (such as www.mydomain.com). If installing locally, it\'s better to use \'localhost\' than \'127.0.0.1\', for performance reasons.',
'LBL_DBCONFIG_B_MSG1_LABEL' => '', // this label dynamically needed in install/installConfig.php:293
'LBL_DBCONFIG_B_MSG1' => 'The username and password of a database administrator who can create database tables and users and who can write to the database is necessary in order to set up the SuiteCRM database.'
'LBL_DBCONFIG_B_MSG1' => 'The username and password of a database administrator who can create database tables and users and who can write to the database is necessary in order to set up the SuiteCRM database.',
'LBL_SYS_CHECK_WARNING' => 'Ignore System Check Warnings',
'LBL_PROCEED' => 'PROCEED',
'LBL_CONFIG' => 'CONFIGURATION',
'LBL_VALIDATION_ERRORS' => 'There are validation errors, unable to perform action.'
);

View file

@ -532,12 +532,7 @@ FP;
$enabled_tabs[] = 'AOS_Products';
$enabled_tabs[] = 'AOS_Product_Categories';
$enabled_tabs[] = 'AOS_PDF_Templates';
$enabled_tabs[] = 'jjwg_Maps';
$enabled_tabs[] = 'jjwg_Markers';
$enabled_tabs[] = 'jjwg_Areas';
$enabled_tabs[] = 'jjwg_Address_Cache';
$enabled_tabs[] = 'AOR_Reports';
$enabled_tabs[] = 'AOW_WorkFlow';
$enabled_tabs[] = 'AOK_KnowledgeBase';
$enabled_tabs[] = 'AOK_Knowledge_Base_Categories';
$enabled_tabs[] = 'EmailTemplates';

View file

@ -3,13 +3,13 @@
$collations = array(
'mysql' =>
array(
array(
'name' => 'utf8_general_ci',
'charset' => 'utf8',
),
array(
'name' => 'utf8mb4_general_ci',
'charset' => 'utf8mb4',
),
array(
'name' => 'utf8_general_ci',
'charset' => 'utf8',
),
),
);

View file

@ -33,7 +33,6 @@ $enabled_tabs[] = 'jjwg_Markers';
$enabled_tabs[] = 'jjwg_Areas';
$enabled_tabs[] = 'jjwg_Address_Cache';
$enabled_tabs[] = 'AOR_Reports';
$enabled_tabs[] = 'AOW_WorkFlow';
$enabled_tabs[] = 'AOK_KnowledgeBase';
$enabled_tabs[] = 'AOK_Knowledge_Base_Categories';
$enabled_tabs[] = 'EmailTemplates';

View file

@ -48,6 +48,7 @@ namespace SuiteCRM\Enumerator;
*/
class ExceptionCode
{
const APPLICATION_MALWARE_FOUND = 4000;
const APPLICATION_UNHANDLED_BEHAVIOUR = 6000;
const APPLICTAION_MODULE_NOT_FOUND = 6005;
const API_EXCEPTION = 8000;

View file

@ -0,0 +1,82 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Exception;
use Psr\Log\LogLevel;
use SuiteCRM\Enumerator\ExceptionCode;
/**
* Class MalwareFound
* @package SuiteCRM\Exception
*/
class MalwareFoundException extends Exception
{
/**
* MalwareFound constructor.
* @param string $message
* @param int $code
* @param null $previous
*/
public function __construct($message = '', $code = ExceptionCode::APPLICATION_MALWARE_FOUND, $previous = null)
{
parent::__construct('[Malware Found] ' . $message . '', $code, $previous);
}
/**
* Gives addition details to what caused the exception
* @return string
* @see ApiController::generateJsonApiExceptionResponse()
*/
public function getDetail()
{
return 'SuiteCRM Anti Malware FileScanner has found malware in the request';
}
/**
* Determines the output message in log files.
* @return string PSR-3 log level
* @see LogLevel
*/
public function getLogLevel()
{
return LogLevel::EMERGENCY;
}
}

View file

@ -0,0 +1,65 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Interfaces;
use SuiteCRM\Exception\MalwareFoundException;
/**
* Interface AntiMalwareFileScanner
* @package SuiteCRM\Interfaces
*/
interface AntiMalwareFileScanner
{
/**
* Is the Anti-Malware FileScanner enabled and configured
*
* @return bool true === yes, false === no
*/
public function isAntiMalwareScannerAvailable(): bool;
/**
* Combines configuration and available scanners to scan for malware
*
* @param string $path - location in the file system
* @throws MalwareFoundException
*/
public function scanFilePath(string $path): void;
}

View file

@ -59,6 +59,11 @@ class MPDFEngine extends PDFEngine
*/
public $pdf;
/**
* @var string
*/
private static $configMapperFile = __DIR__ . '/../../../lib/PDF/MPDF/configMapping.php';
/**
* MPDFEngine constructor.
* @param mPDF|null $pdf
@ -88,9 +93,10 @@ class MPDFEngine extends PDFEngine
/**
* @param string $name
* @param string $destination
* @param string $fullName
* @return void|string
*/
public function outputPDF(string $name, string $destination): ?string
public function outputPDF(string $name, string $destination, string $fullName = ''): ?string
{
@$output = $this->pdf->Output($name, $destination);
@ -105,7 +111,7 @@ class MPDFEngine extends PDFEngine
*/
public function writeHeader(string $html): void
{
@$this->pdf->setHeader($html);
@$this->pdf->SetHTMLHeader($html);
}
/**
@ -114,7 +120,16 @@ class MPDFEngine extends PDFEngine
*/
public function writeFooter(string $html): void
{
@$this->pdf->setFooter($html);
@$this->pdf->SetHTMLFooter($html);
}
/**
* @param string $css
* @return void
*/
public function addCSS(string $css): void
{
$this->writeHTML($css, 1);
}
public function writeBlankPage(): void
@ -128,31 +143,20 @@ class MPDFEngine extends PDFEngine
*/
public function configurePDF(array $options): void
{
$configOptions = [
'mode' => $options['mode'] ?? '',
'page_size' => $options['page_size'] ?? 'A4',
'default_font_size' => $options['fontSize'] ?? 0,
'default_font' => $options['font'] ?? '',
'mgl' => $options['mgl'] ?? 15,
'mgr' => $options['mgr'] ?? 15,
'mgt' => $options['mgt'] ?? 16,
'mgb' => $options['mgb'] ?? 16,
'mgh' => $options['mgh'] ?? 9,
'mgf' => $options['mgf'] ?? 9,
'orientation' => $options['orientation'] ?? 'P'
];
/** @noinspection PhpIncludeInspection */
$configOptions = include self::$configMapperFile;
@$this->pdf = new mPDF(
$configOptions['mode'],
$configOptions['page_size'],
$configOptions['default_font_size'],
$configOptions['default_font'],
$configOptions['mgl'],
$configOptions['mgr'],
$configOptions['mgt'],
$configOptions['mgb'],
$configOptions['mgh'],
$configOptions['mgf'],
$configOptions['margin_left'],
$configOptions['margin_right'],
$configOptions['margin_top'],
$configOptions['margin_bottom'],
$configOptions['margin_header'],
$configOptions['margin_footer'],
$configOptions['orientation'],
);

View file

@ -0,0 +1,15 @@
<?php
return $configOptions = [
'mode' => $options['mode'] ?? '',
'page_size' => $options['page_size'] ?? 'A4',
'default_font_size' => $options['fontSize'] ?? 11,
'default_font' => $options['font'] ?? 'DejaVuSansCondensed',
'margin_left' => $options['margin_left'] ?? 15,
'margin_right' => $options['margin_right'] ?? 15,
'margin_top' => $options['margin_top'] ?? 16,
'margin_bottom' => $options['margin_bottom'] ?? 16,
'margin_header' => $options['margin_header'] ?? 9,
'margin_footer' => $options['margin_footer'] ?? 9,
'orientation' => $options['orientation'] ?? 'P',
'unit' => $options['unit'] ?? 'mm'
];

View file

@ -49,6 +49,11 @@ if (!defined('sugarEntry') || !sugarEntry) {
*/
abstract class PDFEngine
{
/**
* @var string
*/
private static $configMapperFile;
/**
* @param string $html
* @return void
@ -67,6 +72,12 @@ abstract class PDFEngine
*/
abstract public function writeHeader(string $html): void;
/**
* @param string $css
* @return void
*/
abstract public function addCSS(string $css): void;
/**
* @return void
*/
@ -75,9 +86,10 @@ abstract class PDFEngine
/**
* @param string $name
* @param string $destination
* @param string $fullName
* @return string|void
*/
abstract public function outputPDF(string $name, string $destination): ?string;
abstract public function outputPDF(string $name, string $destination, string $fullName = ''): ?string;
/**
* @param array $options

View file

@ -41,6 +41,7 @@ namespace SuiteCRM\PDF;
use SuiteCRM\PDF\Exceptions\PDFEngineNotFoundException;
use SuiteCRM\PDF\MPDF\MPDFEngine;
use SuiteCRM\PDF\TCPDF\TCPDFEngine;
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
@ -61,6 +62,11 @@ class PDFWrapper
'FQN' => MPDFEngine::class,
'filepath' => 'lib/PDF/MPDF/MPDFEngine.php'
],
'TCPDFEngine' => [
'name' => 'TCPDFEngine',
'FQN' => TCPDFEngine::class,
'filepath' => 'lib/PDF/TCPDF/TCPDFEngine.php'
],
];
/** @var string Path to the folder where to load custom engines from */
@ -98,6 +104,13 @@ class PDFWrapper
public static function getEngines(): array
{
$default = array_keys(self::$engines);
// Custom check for MPDF class
$MPDF = __DIR__ . '/../../modules/AOS_PDF_Templates/PDF_Lib/mpdf.php';
if (!file_exists($MPDF) && ($key = array_search('MPDFEngine', $default, true)) !== false) {
unset($default[$key]);
}
$custom = [];
foreach (glob(self::$customEnginePath . '*.php', GLOB_NOSORT) as $file) {
$file = pathinfo($file);

View file

@ -0,0 +1,91 @@
<?php
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\PDF\TCPDF;
use TCPDF;
class SuiteTCPDF extends TCPDF
{
protected $htmlHeader;
protected $htmlFooter;
/**
* @return string
*/
public function getHtmlHeader(): string
{
return $this->htmlHeader;
}
/**
* @param string $htmlHeader
*/
public function setHtmlHeader($htmlHeader): void
{
$this->htmlHeader = $htmlHeader;
}
/**
* @return string
*/
public function getHtmlFooter(): string
{
return $this->htmlFooter;
}
/**
* @param string $htmlFooter
*/
public function setHtmlFooter($htmlFooter): void
{
$htmlFooter = str_replace('{PAGENO}', $this->getAliasNumPage(), $htmlFooter);
$htmlFooter = preg_replace_callback(
'/{DATE\s+(.*?)}/',
static function ($matches) {
return date($matches[1]);
},
$htmlFooter
);
$this->htmlFooter = $htmlFooter;
}
public function Header(): void
{
$this->writeHTMLCell(0, 0, '', '', $this->getHtmlHeader());
}
public function Footer(): void
{
$this->writeHTMLCell(0, 0, '', '', $this->getHtmlFooter());
}
}

View file

@ -0,0 +1,200 @@
<?php
/**
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\PDF\TCPDF;
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
use SuiteCRM\PDF\PDFEngine;
/**
* Class TFPDFEngine
* @package SuiteCRM\PDF\TCPDF
*/
class TCPDFEngine extends PDFEngine
{
/**
* @var SuiteTCPDF
*/
public $pdf;
/**
* @var array
*/
public $pdfOptions;
/**
* @var string
*/
protected $defaultCSS = '';
/**
* @var string
*/
protected $css = '';
/**
* @var string
*/
private static $configMapperFile = __DIR__ . '/../../../lib/PDF/TCPDF/configMapping.php';
/**
* TFPDFEngine constructor.
* @param SuiteTCPDF|null $pdf
*/
public function __construct(SuiteTCPDF $pdf = null)
{
$this->pdf = $pdf ?? new SuiteTCPDF();
$stylesheet = file_get_contents(__DIR__ . '/../../../lib/PDF/TCPDF/default.css');
$this->defaultCSS = $stylesheet;
}
/**
* @param string $html
* @return void
*/
public function writeHTML(string $html): void
{
if ($this->pdf->getNumPages() < 1) {
$this->writeBlankPage();
}
$this->pdf->writeHTML($html . $this->getCSS());
}
/**
* @param string $name
* @param string $destination
* @param string $fullName
* @return string|null
*/
public function outputPDF(string $name, string $destination, string $fullName = ''): ?string
{
if ($destination === 'D') {
$this->pdf->Output($name, $destination);
} else {
$this->pdf->Output(__DIR__ . '/../../../' . $name, $destination);
}
return null;
}
/**
* @param string|array $html
* @return void
*/
public function writeHeader(string $html): void
{
$this->pdf->setPrintHeader(true);
$this->pdf->setHtmlHeader($html);
}
/**
* @param string|array $html
* @return void
*/
public function writeFooter(string $html): void
{
$this->pdf->setPrintFooter(true);
$this->pdf->setHtmlFooter($html);
}
/**
* @param string $css
* @return void
*/
public function addCSS(string $css): void
{
$this->css = $css;
}
/**
* @return string
*/
public function getCSS(): string
{
return '<style>' . $this->css . $this->defaultCSS . '</style>';
}
public function writeBlankPage(): void
{
$this->pdf->AddPage();
}
/**
* @param array $options
* @return void
*/
public function configurePDF(array $options): void
{
/** @noinspection PhpIncludeInspection */
$configOptions = include self::$configMapperFile;
$this->pdfOptions = $configOptions;
$this->pdf = new SuiteTCPDF(
$configOptions['orientation'],
$configOptions['unit'],
$configOptions['page_size'],
true,
'UTF-8',
false
);
$this->pdf->SetMargins(
$configOptions['margin_left'],
$configOptions['margin_top'],
$configOptions['margin_right']
);
$tagvs = ['div' => [['h' => 0, 'n' => 0], ['h' => 0, 'n' => 0]]];
$this->pdf->setHtmlVSpace($tagvs);
$this->pdf->setPrintHeader(false);
$this->pdf->setPrintFooter(false);
$this->pdf->setHeaderMargin($configOptions['margin_header']);
$this->pdf->setFooterMargin($configOptions['margin_footer']);
$this->pdf->SetAutoPageBreak(true, $configOptions['margin_bottom']);
$this->pdf->setImageScale($configOptions['image_scale']);
$this->pdf->SetFont($configOptions['default_font'], '', $configOptions['default_font_size']);
}
}

View file

@ -0,0 +1,15 @@
<?php
return $configOptions = [
'page_size' => $options['page_size'] ?? 'A4',
'orientation' => $options['orientation'] ?? 'P',
'unit' => $options['unit'] ?? 'mm',
'default_font_size' => $options['fontSize'] ?? 11,
'default_font' => $options['font'] ?? 'DejaVuSansCondensed',
'margin_left' => $options['margin_left'] ?? 15,
'margin_right' => $options['margin_right'] ?? 15,
'margin_top' => $options['margin_top'] ?? 16,
'margin_bottom' => $options['margin_bottom'] ?? 16,
'margin_header' => $options['margin_header'] ?? 9,
'margin_footer' => $options['margin_footer'] ?? 9,
'image_scale' => $options['image_scale'] ?? 1.33,
];

68
lib/PDF/TCPDF/default.css Normal file
View file

@ -0,0 +1,68 @@
body {
margin: 0;
line-height: normal;
color: #151319;
text-indent: 0;
}
h1 {
font-size: 2em;
font-weight: bold;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
font-weight: bold;
margin: 0.75em 0;
}
h3 {
font-size: 1.17em;
font-weight: bold;
margin: 0.83em 0;
}
h4 {
font-weight: bold;
margin: 1.12em 0;
}
h5 {
font-size: 0.83em;
font-weight: bold;
margin: 1.5em 0;
}
h6 {
font-size: 0.75em;
font-weight: bold;
margin: 1.67em 0;
}
p {
margin: 1.12em 0;
}
table {
margin: 0;
border-collapse: separate;
border-spacing: 2px;
empty-cells: show;
line-height: 1.2;
vertical-align: middle;
padding: 1.6px;
}
th {
font-weight: bold;
text-align: center;
}
td {
page-break-inside: avoid;
}
img {
margin: 0;
vertical-align: baseline;
}

View file

@ -88,8 +88,13 @@ class BasicSearchEngine extends SearchEngine
$end = microtime(true);
$elapsed = $end - $start;
$totalHits = 0;
return new SearchResults($results['modules'], true, $elapsed, count($results['hits']));
foreach ($results['modules'] as $moduleHit) {
$totalHits += count($moduleHit);
}
return new SearchResults($results['modules'], true, $elapsed, $totalHits);
}
/**

View file

@ -62,6 +62,8 @@ class SearchFormView extends View
/** @inheritdoc */
public function display(): void
{
global $sugar_config;
$sizes = $this->makeSizesFromConfig();
$engines = [];
@ -69,6 +71,16 @@ class SearchFormView extends View
$engines[$engine] = StringUtils::camelToTranslation($engine);
}
if ($sugar_config['search']['ElasticSearch']['enabled'] === false) {
unset($engines['ElasticSearchEngine']);
}
$currentEngine = SearchWrapper::getDefaultEngine();
if ($currentEngine === 'BasicSearchEngine' || $currentEngine === 'ElasticSearchEngine') {
$engines = [];
}
$this->smarty->assign('sizeOptions', $sizes);
$this->smarty->assign('engineOptions', $engines);

View file

@ -96,7 +96,7 @@ class SearchResultsController extends Controller
LoggerManager::getLogger()->warn('Failed to fetch list-view headers: ' . $e->getMessage());
}
$total = $this->results->getTotal();
$total = count($this->results->getHits());
if ($total > 1) {
$size = $this->query->getSize();
if ($size) {
@ -122,9 +122,10 @@ class SearchResultsController extends Controller
throw new SearchException('Search Size can not be Zero.', SearchException::ZERO_SIZE);
}
}
$totalResults = $this->results->getTotal();
$smarty = $this->view->getTemplate();
$smarty->assign('total', $total);
$smarty->assign('total', $totalResults);
$smarty->assign('headers', $headers);
$smarty->assign('results', $this->results);
try {

View file

@ -0,0 +1,69 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Utility\AntiMalware;
use SuiteCRM\Exception\MalwareFoundException;
/**
* Trait AntiMalwareTrait
* @package SuiteCRM\Utility\AntiMalware
*/
trait AntiMalwareTrait
{
/**
* Passes path of uploaded file to AntiMalware Interface for scanning
* @param string $path
* @return bool false if no malware scanner available, true if no malware detected.
* @throws MalwareFoundException
*/
public function scanPathForMalware(string $path): bool
{
$antiMalwareScanner = new FileScanner();
if ($antiMalwareScanner->isAntiMalwareScannerAvailable() === false) {
return false;
}
$antiMalwareScanner->scanFilePath($path);
return true;
}
}

View file

@ -0,0 +1,118 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Utility\AntiMalware;
use SuiteCRM\Exception\MalwareFoundException;
use SuiteCRM\Interfaces\AntiMalwareFileScanner;
use SuiteCRM\Utility\Configuration;
use SuiteCRM\Utility\SuiteLogger;
/**
* Class FileScanner
* @package SuiteCRM\Utility\AntiMalware
*
* @see /lib/Utility/AntiMalware/Providers/
* @see anti_malware_scanners config option
*
*/
class FileScanner implements AntiMalwareFileScanner
{
/**
* Is the Anti-Malware FileScanner enabled
*
* @return bool true === yes, false === no
*/
public function isAntiMalwareScannerAvailable(): bool
{
$logger = new SuiteLogger();
$globalConfig = new Configuration();
$configuration =
$globalConfig['anti_malware_scanners'] ?? null;
if (!empty($configuration)) {
foreach ($configuration as $antiMalwareScanner => $antiMalwareScannerConfiguration) {
if (class_exists($antiMalwareScanner)) {
/** @var AntiMalwareFileScanner $class */
$class = new $antiMalwareScanner();
if ($class->isAntiMalwareScannerAvailable()) {
return true;
}
} else {
$logger->warning('class/namespace does not exist ' . $antiMalwareScanner);
}
}
}
return false;
}
/**
* Combines configuration and available scanners to scan for malware
*
* @param string $path - location in the file system
* @throws MalwareFoundException
*/
public function scanFilePath(string $path): void
{
$logger = new SuiteLogger();
$globalConfig = new Configuration();
$configuration =
$globalConfig['anti_malware_scanners'] ?? null;
if (!empty($configuration)) {
foreach ($configuration as $antiMalwareScanner => $antiMalwareScannerConfiguration) {
if (class_exists($antiMalwareScanner)) {
/** @var AntiMalwareFileScanner $class */
$class = new $antiMalwareScanner();
if ($class->isAntiMalwareScannerAvailable()) {
$class->scanFilePath($path);
}
} else {
$logger->warning('class/namespace does not exist ' . $antiMalwareScanner);
}
}
}
}
}

View file

@ -0,0 +1,293 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Utility\AntiMalware\Providers;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use SuiteCRM\Exception\Exception;
use SuiteCRM\Exception\InvalidArgumentException;
use SuiteCRM\Exception\MalwareFoundException;
use SuiteCRM\Interfaces\AntiMalwareFileScanner;
use SuiteCRM\Utility\AntiMalware\AntiMalwareTrait;
use SuiteCRM\Utility\Configuration;
use SuiteCRM\Utility\SuiteLogger;
/**
* Class ClamTCP
* @package SuiteCRM\Utility\AntiMalware\Providers
*/
class ClamTCP implements AntiMalwareFileScanner, LoggerAwareInterface
{
use AntiMalwareTrait;
/**
* @var bool $enabled
*/
private $enabled = false;
/**
* @var string $ip
*/
private $ip = '127.0.0.1';
/**
* @var int $port
*/
private $port = 3306;
/**
* @var string $type local, remote
*/
private $type = 'local';
/**
* @see clamconf: StreamMaxLength
* @var int $chunkSize
*/
private $chunkSize = 26214400;
/**
* @see clamconf: MaxFileSize
* @var int $clamAvMax
*/
private $clamAvMax = 26214400;
/**
* @var LoggerInterface
*/
private $logger;
/**
* constructor.
*/
public function __construct()
{
$globalConfig = new Configuration();
$configuration = $globalConfig['anti_malware_scanners'][self::class] ?? null;
if (!empty($configuration)) {
$this->enabled = $configuration['enabled'] ?? $this->enabled;
$this->ip = $configuration['options']['ip'] ?? $this->ip;
$this->port = $configuration['options']['port'] ?? $this->port;
$this->type = $configuration['options']['type'] ?? $this->type;
}
$this->logger = new SuiteLogger();
}
/**
* Is the Anti-Malware FileScanner enabled
*
* @return bool true === yes, false === no
*/
public function isAntiMalwareScannerAvailable(): bool
{
return $this->isEnabled();
}
/**
* Scan path for malware
*
* @param string $path
* @throws InvalidArgumentException
* @throws Exception
*/
public function scanFilePath(string $path): void
{
$this->validatePath($path);
switch ($this->type) {
case 'local':
$this->scanLocalFile($path);
break;
case 'remote':
$this->streamScan($path);
break;
default:
throw new InvalidArgumentException(
'[ClamAntiVirus][scanPathForMalware] $type should be a recognised value'
);
}
}
/**
* Requests clamd scan of local file
*
* @param string $path
* @throws Exception
*/
protected function scanLocalFile(string $path): void
{
$response = $this->sendCommand('SCAN ' . $path);
$this->processResponse($path, $response);
}
/**
* Sends TCP Stream of local file to remote clamd for scanning
* @param $path
* @throws Exception
* @noinspection PhpComposerExtensionStubsInspection
*/
protected function streamScan($path): void
{
if ($scan_fh = fopen($path, 'rb')) {
$socket = $this->getSocket();
$chunkSize = filesize($path) < $this->chunkSize ? filesize($path) : $this->chunkSize;
// do not scan empty file
if ($chunkSize === 0) {
return;
}
$command = "zINSTREAM\0";
socket_send($socket, $command, strlen($command), 0);
while (!feof($scan_fh)) {
$data = fread($scan_fh, $chunkSize);
$packet = pack(sprintf("Na%d", strlen($data)), strlen($data), $data);
socket_send($socket, $packet, strlen($packet), 0);
}
$packet = pack("Nx", 0);
socket_send($socket, $packet, strlen($packet), 0);
socket_recv($socket, $response, $this->clamAvMax, 0);
socket_close($socket);
$this->processResponse($path, $response);
} else {
throw new Exception(
'[ClamAntiVirus][scanPathForMalware] cannot open file for scanning'
);
}
}
/**
* @param $command
* @return string|null
* @throws Exception
* @noinspection PhpComposerExtensionStubsInspection
*/
protected function sendCommand($command): ?string
{
$return = null;
$socket = $this->getSocket();
socket_send($socket, $command, strlen($command), 0);
socket_recv($socket, $return, $this->clamAvMax, 0);
socket_close($socket);
return $return;
}
/**
* @param string $path - location in the file system
* @param $response - clamd response
* @throws MalwareFoundException
*/
protected function processResponse(string $path, $response): void
{
$response = explode(':', $response);
$result = trim(end($response));
if ($result !== "OK") {
$this->logger->emergency($result);
throw new MalwareFoundException(
'[ClamAntiVirus][MalwareDetected]' . $path . $result
);
}
}
/**
* @throws Exception
* @noinspection PhpComposerExtensionStubsInspection
*/
protected function getSocket()
{
$socket = @socket_create(AF_INET, SOCK_STREAM, 0);
$status = @socket_connect($socket, $this->ip, $this->port);
if (!$status) {
throw new Exception(
'[ClamAntiVirus][scanPathForMalware] cannot connect to clamAV daemon'
);
}
return $socket;
}
/**
* @throws InvalidArgumentException
*/
private function validatePath($path): void
{
if (!is_string($path)) {
throw new InvalidArgumentException(
'[ClamAntiVirus][scanPathForMalware] $path should be a string'
);
}
if (!file_exists($path)) {
throw new InvalidArgumentException(
'[ClamAntiVirus][scanPathForMalware] ' . $path . ' not found'
);
}
}
/**
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* @return boolean
*/
private function isEnabled(): bool
{
return $this->enabled;
}
}

View file

@ -0,0 +1,213 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Utility\AntiMalware\Providers;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use SuiteCRM\Exception\Exception;
use SuiteCRM\Exception\InvalidArgumentException;
use SuiteCRM\Exception\MalwareFoundException;
use SuiteCRM\Interfaces\AntiMalwareFileScanner;
use SuiteCRM\Utility\AntiMalware\AntiMalwareTrait;
use SuiteCRM\Utility\Configuration;
use SuiteCRM\Utility\SuiteLogger;
/**
* Class Sophos
* @package SuiteCRM\Utility\AntiMalware\Providers
*/
class Sophos implements AntiMalwareFileScanner, LoggerAwareInterface
{
use AntiMalwareTrait;
/**
* @var bool $enabled
*/
private $enabled = false;
/**
* @var string $path
*/
private $path = '/opt/sophos-av/bin/savscan';
/**
* @var string $options
*/
private $options = '-ss';
/**
* @var LoggerInterface
*/
private $logger;
public function __construct()
{
$globalConfig = new Configuration();
$configuration =
$globalConfig['anti_malware_scanners'][self::class] ?? null;
if (!empty($configuration)) {
$this->enabled = $configuration['enabled'] ?? $this->enabled;
$this->path = $configuration['path'] ?? $this->path;
$this->options = $configuration['options'] ?? $this->options;
}
$this->logger = new SuiteLogger();
}
/**
* Is the Anti-Malware FileScanner enabled and configured
* @return bool true === yes, false === no
*/
public function isAntiMalwareScannerAvailable(): bool
{
if ($this->isEnabled()) {
return file_exists($this->getExecutablePath());
}
return false;
}
/**
* @param string $path - location in the file system
* @throws InvalidArgumentException
* @throws MalwareFoundException|Exception
*/
public function scanFilePath(string $path): void
{
$this->validatePath($path);
$command = $this->getExecutablePath() . ' ' . $this->getOptions() . ' ' . escapeshellarg($path);
$lineOutput = shell_exec($command);
$this->processResponse($path, $lineOutput);
}
/**
* @param string $path - location in the file system
* @param $lineOutput
* @throws Exception
* @throws MalwareFoundException
*/
private function processResponse(string $path, $lineOutput): void
{
$warningsFound = stripos($lineOutput, 'WARNING') !== false;
if ($warningsFound) {
$this->logger->warning($lineOutput);
throw new Exception(
'[SophosAntiVirus][Warnings Found]'
);
}
$errorsFound = stripos($lineOutput, 'ERROR') !== false;
if ($errorsFound) {
$this->logger->error($lineOutput);
throw new Exception(
'[SophosAntiVirus][Errors Found]'
);
}
$virusFound = stripos($lineOutput, 'FOUND') !== false;
if ($virusFound) {
$this->logger->emergency($lineOutput);
throw new MalwareFoundException(
'[SophosAntiVirus][MalwareDetected]' . $path
);
}
}
/**
* @throws InvalidArgumentException
*/
private function validatePath($path): void
{
if (!is_string($path)) {
throw new InvalidArgumentException(
'[SophosAntiVirus][scanPathForMalware] $path should be a string'
);
}
if (!file_exists($this->getExecutablePath())) {
throw new InvalidArgumentException(
'[SophosAntiVirus][scanPathForMalware] executable path not found'
);
}
if (!file_exists($path)) {
throw new InvalidArgumentException(
'[SophosAntiVirus][scanPathForMalware] ' . $path . ' not found'
);
}
}
/**
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* @return boolean
*/
private function isEnabled(): bool
{
return $this->enabled;
}
/**
* @return string
*/
private function getExecutablePath(): string
{
return $this->path;
}
/**
* @return string
*/
private function getOptions(): string
{
return $this->options;
}
}

View file

@ -0,0 +1,108 @@
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2021 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
namespace SuiteCRM\Utility;
use ArrayAccess;
use SuiteCRM\Exception\Exception;
/**
* Class Configuration
* @package SuiteCRM\Utility
*/
class Configuration implements ArrayAccess
{
private $container;
/**
* Configuration constructor.
*/
public function __construct()
{
global $sugar_config;
require_once 'modules/Configurator/Configurator.php';
$this->container = (new \Configurator())->config;
}
/**
* @param mixed $offset
* @param mixed $value
* @throws Exception
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
throw new Exception('[Configuration][missing offset]');
}
if (!isset($this->container[$offset])) {
throw new Exception('[Configuration][not found]');
}
$this->container[$offset] = $value;
}
/**
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* @param mixed $offset
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* @param mixed $offset
* @return mixed|null
*/
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
}

View file

@ -77,6 +77,10 @@ class ACLAction extends SugarBean
global $ACLActions;
$db = DBManagerFactory::getInstance();
if(empty($db->database)){
return;
}
if (isset($ACLActions[$type])) {
foreach ($ACLActions[$type]['actions'] as $action_name => $action_def) {
$action = BeanFactory::newBean('ACLActions');

View file

@ -78,7 +78,7 @@ EOD
</p>
</div>
<p>
<TABLE width='100%' class='detail view' border='0' cellpadding=0 cellspacing = 1 >
<TABLE width='100%' class='detail view role-detail' border='0' cellpadding=0 cellspacing = 1 >
<TR>
<td valign='top' width='15%' align='right'><b>{$MOD.LBL_NAME}:</b></td><td width='85%' colspan='3'>{$ROLE.name}</td>
</tr>

View file

@ -652,17 +652,8 @@ class AOR_Report extends Basic
}
}
// Fix #5427
$report_style = '';
$thead_style = '';
if ((isset($_REQUEST['action']) ? $_REQUEST['action'] : null) == 'DownloadPDF') {
$report_style = 'margin-top: 0px;';
$thead_style = 'background: #919798; color: #fff';
}
$html = '<div class="list-view-rounded-corners" style="' . $report_style . '">';
//End
$html.='<table id="report_table_'.$tableIdentifier.$group_value.'" cellpadding="0" cellspacing="0" width="100%" border="0" class="list view table-responsive aor_reports">';
$html = '<div class="list-view-rounded-corners">';
$html.='<table id="report_table_'.$tableIdentifier.$group_value.'" width="100%" border="0" class="list view table-responsive aor_reports">';
$sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY field_order ASC";
$result = $this->db->query($sql);
@ -706,7 +697,7 @@ class AOR_Report extends Basic
if ($fields[$label]['display']) {
// Fix #5427
$html .= "<th scope='col' style='{$thead_style}'>";
$html .= "<th scope='col'>";
// End
$html .= "<div>";
$html .= $field->label;
@ -820,7 +811,7 @@ class AOR_Report extends Basic
} else {
$params = [];
}
$html .= getModuleField(
$html .= trim(getModuleField(
$att['module'],
$att['field'],
$att['field'],
@ -829,7 +820,7 @@ class AOR_Report extends Basic
'',
$currency_id,
$params
);
));
}
if ($att['total']) {
@ -855,6 +846,7 @@ class AOR_Report extends Basic
$currentTheme = SugarThemeRegistry::current();
if (empty($_REQUEST['action']) || $_REQUEST['action'] !== 'DownloadPDF') {
$html .= " <script type=\"text/javascript\">
groupedReportToggler = {
@ -874,6 +866,7 @@ class AOR_Report extends Basic
};
</script>";
}
return $html;
}

View file

@ -196,16 +196,18 @@ class AOR_ReportsController extends SugarController
sugar_die('');
}
$d_image = explode('?', SugarThemeRegistry::current()->getImageURL('company_logo.png'), 2);
$companyLogo = explode('?', SugarThemeRegistry::current()->getImageURL('company_logo.png'), 2);
$reportName = strtoupper($this->bean->name);
$graphs = $_POST["graphsForPDF"];
$graphHtml = "<div class='reportGraphs' style='width:100%; text-align:center;'>";
$graphHtml = '';
$chartsPerRow = $this->bean->graphs_per_row;
if (is_countable($graphs)) {
$countOfCharts = count($graphs);
}
if (!empty($countOfCharts) && $countOfCharts > 0) {
$graphHtml = "<div class='reportGraphs' style='width:100%; text-align:center;'>";
$width = (100 / $chartsPerRow);
$modulusRemainder = $countOfCharts % $chartsPerRow;
@ -217,52 +219,51 @@ class AOR_ReportsController extends SugarController
foreach ($graphs as $x => $xValue) {
if (is_null($itemsWithModulus) || $x < $itemsWithModulus) {
$graphHtml .= "<img src='.$xValue.' style='width:$width%;' />";
$graphHtml .= "<img src='data:image/png;base64, @$xValue' style='width:$width%;' />";
} else {
$graphHtml .= "<img src='.$xValue.' style='width:$modulusWidth%;' />";
$graphHtml .= "<img src='data:image/png;base64, @$xValue' style='width:$modulusWidth%;' />";
}
}
$graphHtml .= "</div>";
}
$head = '<table style="width: 100%; font-family: Arial; text-align: center;" border="0" cellpadding="2" cellspacing="2">
$stylesheet = file_get_contents(get_custom_file_if_exists('modules/AOR_Reports/pdf/pdf.css'));
$footer = '{PAGENO}';
$head = '<table style="width: 100%; text-align: center;" border="0" cellpadding="2" cellspacing="2">
<tbody style="text-align: left;">
<tr style="text-align: left;">
<td style="text-align: left;">
<p><img src="' . $d_image[0] . '" style="float: left;"/>&nbsp;</p>
<p><img src="' . $companyLogo[0] . '" style="float: left;"/>&nbsp;</p>
</td>
<tr style="text-align: left;">
<td style="text-align: left;"></td>
</tr>
<tr style="text-align: left;">
<td style="text-align: left;">
</td>
<tr style="text-align: left;">
<td style="text-align: left;"></td>
</tr>
<tr style="text-align: left;">
<td style="text-align: left;">
<b>' . strtoupper($this->bean->name) . '</b>
<h2>' . $reportName . '</h2>
</td>
</tr>
</tbody>
</table><br />' . $graphHtml;
</table>';
if (!empty($graphHtml)) {
$head .= '<br />' . $graphHtml;
}
$this->bean->user_parameters = requestToUserParameters($this->bean);
$printable = $this->bean->build_group_report(-1, false);
$stylesheet = file_get_contents(SugarThemeRegistry::current()->getCSSURL('style.css', false));
$report = $this->bean->build_group_report(-1, false);
ob_clean();
try {
$pdf = PDFWrapper::getPDFEngine();
$pdf->configurePDF([
'mode' => 'en',
'font' => 'DejaVuSansCondensed',
]);
$pdf->writeFooter('{PAGENO}');
$pdf->writeHTML($stylesheet, 1);
$pdf->addCSS($stylesheet);
$pdf->writeFooter($footer);
$pdf->writeHTML($head, 2);
$pdf->writeHTML($printable, 3);
$pdf->writeHTML($report, 3);
$pdf->outputPDF($this->bean->name . '.pdf', 'D');
} catch (PDFException $e) {
LoggerManager::getLogger()->warn('PDFException: ' . $e->getMessage());

View file

@ -0,0 +1,41 @@
body {
margin: 0;
line-height: 20px;
color: #151319;
}
table.aor_reports {
border-spacing:0;
border-collapse: collapse;
border: 1px solid #D4D3D8;
padding: 5px 4px;
}
table.aor_reports tr {
padding: 5px 0 5px 0;
}
table.aor_reports th {
font-size: 11px;
font-weight: bold;
text-align: left;
color: #fff;
background-color: #534D64;
border: 1px solid #534D64;
padding: 10px 4px;
}
table.aor_reports td {
font-size: 11px;
text-align: left;
background-color: #F2F1F3;
border-bottom: 1px solid #fff;
padding: 5px 4px;
}
table.aor_reports tr.evenListRowS1 td {
background-color: #fff;
}

View file

@ -115,6 +115,6 @@
</div>
<div style="clear: both;"></div>
<div style="display: block; float: none;">
<div style="display: block; float: none;" class="reports-editview-footer-actions">
{{include file="include/EditView/footer.tpl"}}
</div>

View file

@ -1,25 +0,0 @@
================
mPDF 5.7.1
1/09/2013
================
1) FILES: mpdf.php
Bug fix; Dollar sign enclosed by <pre> tag causing error.
Test e.g.: <pre>Test $1.00 Test</pre> <pre>Test $2.00 Test</pre> <pre>Test $3.00 Test</pre> <pre>Test $4.00 Test</pre>
-----------------------------
2) FILES: includes/functions.php AND mpdf.php
Changes to preg_replace with /e modifier to use preg_replace_callback
(/e depracated from PHP 5.5)
-----------------------------
3) FILES: classes/barcode.php
Small change to function barcode_c128() which allows ASCII 0 - 31 to be used in C128A e.g. chr(13) in:
<barcode code="5432&#013;1068" type="C128A" />
-----------------------------
4) FILES: mpdf.php
Using $use_kwt ("keep-[heading]-with-table") if <h4></h4> before table is on 2 lines and pagebreak occurs after first line
the first line is displayed at the bottom of the 2nd page.
Edited so that $use_kwt only works if the HEADING is only one line. Else ignores (but prints correctly)
-----------------------------
5) FILES: mpdf.php
Clearing old temporary files from _MPDF_TEMP_PATH will now ignore "hidden" files e.g. starting with a "." .htaccess, .gitignore etc.
and also leave dummy.txt alone
-----------------------------

View file

@ -1,92 +0,0 @@
/*******************************************************************************
* Software: FPDF *
* Version: 1.53 *
* Date: 2004-12-31 *
* Author: Olivier PLATHEY *
* License: Freeware *
* *
* You may use and modify this software as you wish. *
*******************************************************************************/
/*******************************************************************************
* HTML2FPDF is a php script to read a HTML text and generate a PDF file. *
* Copyright (C) 2004-2005 Renato Coelho *
* *
* html2fpdf.php, htmltoolkit.php *
*******************************************************************************/
CREDITS From HTML2FPDF:
-Olivier Plathey for the fpdf.php class [http://www.fpdf.org]
-Damon Kohler for the Flowing Block script [mailto:damonkohler@yahoo.com]
-Clément Lavoillotte for HTML-oriented FPDF idea
-Yamasoft for the gif.php class [http://www.yamasoft.com/]
-Jérôme Fenal for the _parsegif() function
-"VIETCOM" for the PDFTable code [http://www.freepgs.com/vietcom/tool/pdftable/] [mailto:vncommando@yahoo.com]
-Yukihiro O. for the SetDash() function [mailto:yukihiro_o@infoseek.jp]
-Ron Korving for the WordWrap() function
-Michel Poulain for the DisplayPreferences() function
-Patrick Benny for the MultiCellBlt() function idea [no longer in use]
-Seb for the _SetTextRendering() and SetTextOutline() functions [mailto:captainseb@wanadoo.fr]
-MorphSoft for the colornames list idea
-W3SCHOOLS for HTML-related reference info [http://www.w3schools.com/]
/****************************************************************************
* Software: FPDF_Protection *
* Version: 1.02 *
* Date: 2005/05/08 *
* Author: Klemen VODOPIVEC *
* License: Freeware *
* *
* You may use and modify this software as you wish as stated in original *
* FPDF package. *
****************************************************************************/
/****************************************************************************
// FPDI - Version 1.2
//
// Copyright 2004-2007 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
****************************************************************************/
/****************************************************************************
* @copyright Khaled Al-Shamaa 2008
* @link http://www.ar-php.org
* @author Khaled Al-Shamaa <khaled@ar-php.org>
* @desc Set of PHP5 / UTF-8 Classes developed to enhance Arabic web
* applications by providing set of tools includes stem-based searching,
* translitiration, soundex, Hijri calendar, charset detection and
* converter, spell numbers, keyboard language, Muslim prayer time,
* auto-summarization, and more...
* @package Arabic
*
* @version 1.8 released in Feb 15, 2009
*
* @license LGPL
****************************************************************************/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
[http://www.opensource.org/licenses/lgpl-license.php]

View file

@ -1,164 +0,0 @@
=================
Open Source Fonts
=================
mPDF should be able to read most TrueType Unicode font files with a .ttf extension
Truetype fonts with .ttf or .otf extension and .ttc TrueType collections should also work OK.
You will probably therefore have access to any number of fonts, but here are some useful sources for
open-source or free-use fonts. Many of these were included with earlier versions of mPDF:
General collections
-------------------
- DejaVu font collection from: http://dejavu-fonts.org/wiki/Main_Page (included in the release)
- GNU FreeFont from: http://www.gnu.org/software/freefont/
- Linux Libertine from: http://www.linuxlibertine.org (use the .ttf files - not the .otf)
- Liberation Fonts from: https://fedorahosted.org/liberation-fonts/ or directly https://fedorahosted.org/releases/l/i/liberation-fonts/
Thai fonts
----------
- Collection of Thai fonts from: ftp://linux.thai.net/pub/thailinux/software/thai-ttf/
OCR-B
-----
OCRB (ocrb10) font: http://ansuz.sooke.bc.ca/software/ocrb.php
Useful for barcodes (included in the release)
Pan-Unicode fonts (fonts containing most characters defined in Unicode)
-----------------------------------------------------------------------
- BitStream Cyberbit from: http://aol-4.vo.llnwd.net/pub/communicator/extras/fonts/windows/
Cyberbit.ZIP (or just Google it)
(NB if run with $debug_fonts gives warning of invalid table checksum - just turn it off!)
- Code2000 (NB shareware) from: http://www.code2000.net/code2000_page.htm
- Quivira from: http://www.quivira-font.com/ (combining diacritics are not placed correctly, but has a very full set of glyphs)
CJK (Chinese-Japanese-Korean)
-----------------------------
HanNomA and B from: http://vietunicode.sourceforge.net/fonts/fonts_hannom.html
unBatang_0613 from: http://people.ktug.or.kr/~nomos/mine/UnBatang_0613.ttf
Sun-ExtA and Sun-ExtB from: http://www.alanwood.net/unicode/fonts-east-asian.html
(http://www.alanwood.net/downloads/index.html)
Fonts which contain both Unicode BMP and SIP (Supplementary Ideographic Plane)
characters in one file e.g. "AR PL UMing" and "AR PL UKai"
from: http://www.freedesktop.org
http://www.freedesktop.org/wiki/Software/CJKUnifonts/Download
[MS Windows fonts such as MS Mincho and MingLiU also work]
Japanese IPA fonts: http://ossipedia.ipa.go.jp/ipafont/index.html
Arabic/Eastern fonts
--------------------
- XW Zar fonts can be downloaded from: http://www.redlers.com/downloadfont.html
(2 of these fonts are included in the release)
(original site in Farsi: http://wiki.irmug.org/index.php/XWZar)
- See below for more details and font names of the fonts used in mPDF 4.x
Other sources
-------------
http://www.unifont.org/fontguide/
http://www.alanwood.net/unicode/fonts.html
http://cooltext.com (e.g. http://cooltext.com/Fonts-Unicode+Arabic)
ApparatusSIL, DoulosSIL, Padauk from SIL: http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&cat_id=FontDownloads
DaiBanna (Tai Le)
Mediaeval & Ancient Scripts
---------------------------
Junicode: http://junicode.sourceforge.net/
Cardo: http://scholarsfonts.net/cardofnt.html
Syriac fonts
------------
http://www.bethmardutho.org/meltho/
============
ARABIC FONTS
============
You can use any appropriate Unicode-encoded .ttf or .ttc font file for arabic text, but
the font file must include the Arabic Presentation Forms-B (U+FE70U+FEFF).
2 of the XW Zar fonts are included in the release.
===========
INDIC FONTS
===========
Indic scripts e.g. Hindi, Bengali etc. use conjuct forms which have no Unicode assignment. You
cannot therefore use any standard .ttf font files with mPDF.
A set of fonts has been adapted to use specifically with mPDF. They are based on a set of fonts from:
http://www.cdacmumbai.in/projects/indix/e_introduction.shtml
NB These fonts are released under GNU GPL Version 2 license
You need these adapted fonts (ind_bn_1_001.ttf etc.) to work with mPDF, as the glyphs have been
assigned to Unicode values in the Private Use area (U+E000 ->). These are included in the
mPDF download.
Users of mPDF v4.x
------------------
The original indic font files do not contain a full set of even basic ASCII
characters. The fonts supplied have been "fixed" to include those extra
characters. This now works whether the font is subset or not.
=========
CJK Fonts
=========
Supplemental Ideographic Plane
==============================
SIP = Supplemental Ideographic Plane ( = Plane 2) = U+20000 - U+2FFFF (131072 - 196607)
These characters are required for the HKSCS Hong Kong Supplementary Character Set. Fonts with
SIP characters are commonly divided into a second file e.g. MingLiU and MingLiU-ExtB
mPDF requires 2 fonts and they should be cross-referenced in config_fonts.php e.g.
"sun-exta" => array(
'R' => "Sun-ExtA.ttf",
'sip-ext' => 'sun-extb',
),
"sun-extb" => array(
'R' => "Sun-ExtB.ttf",
),
--OR--
(NB these ones also define the font number within the TTC Collection as TTCfontID)
'mingliu' => array (
'R' => 'mingliu.ttc',
'TTCfontID' => array (
'R' => 1,
),
'sip-ext' => 'mingliu-extb',
),
'mingliu-extb' => array (
'R' => 'mingliub.ttc',
'TTCfontID' => array (
'R' => 1,
),
),
'mingliu_hkscs' => array (
'R' => 'mingliu.ttc',
'TTCfontID' => array (
'R' => 3,
),
'sip-ext' => 'mingliu_hkscs-extb',
),
'mingliu_hkscs-extb' => array (
'R' => 'mingliub.ttc',
'TTCfontID' => array (
'R' => 3,
),
),

View file

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

File diff suppressed because it is too large Load diff

View file

@ -1,273 +0,0 @@
<?php
class bmp
{
public $mpdf = null;
public function __construct(&$mpdf)
{
$this->mpdf = $mpdf;
}
public function _getBMPimage($data, $file)
{
$info = array();
// Adapted from script by Valentin Schmidt
// http://staff.dasdeck.de/valentin/fpdf/fpdf_bmp/
$bfOffBits=$this->_fourbytes2int_le(substr($data, 10, 4));
$width=$this->_fourbytes2int_le(substr($data, 18, 4));
$height=$this->_fourbytes2int_le(substr($data, 22, 4));
$flip = ($height<0);
if ($flip) {
$height =-$height;
}
$biBitCount=$this->_twobytes2int_le(substr($data, 28, 2));
$biCompression=$this->_fourbytes2int_le(substr($data, 30, 4));
$info = array('w'=>$width, 'h'=>$height);
if ($biBitCount<16) {
$info['cs'] = 'Indexed';
$info['bpc'] = $biBitCount;
$palStr = substr($data, 54, ($bfOffBits-54));
$pal = '';
$cnt = strlen($palStr)/4;
for ($i=0;$i<$cnt;$i++) {
$n = 4*$i;
$pal .= $palStr[$n+2].$palStr[$n+1].$palStr[$n];
}
$info['pal'] = $pal;
} else {
$info['cs'] = 'DeviceRGB';
$info['bpc'] = 8;
}
if ($this->mpdf->restrictColorSpace==1 || $this->mpdf->PDFX || $this->mpdf->restrictColorSpace==3) {
if (($this->mpdf->PDFA && !$this->mpdf->PDFAauto) || ($this->mpdf->PDFX && !$this->mpdf->PDFXauto)) {
$this->mpdf->PDFAXwarnings[] = "Image cannot be converted to suitable colour space for PDFA or PDFX file - ".$file." - (Image replaced by 'no-image'.)";
}
return array('error' => "BMP Image cannot be converted to suitable colour space - ".$file." - (Image replaced by 'no-image'.)");
}
$biXPelsPerMeter=$this->_fourbytes2int_le(substr($data, 38, 4)); // horizontal pixels per meter, usually set to zero
//$biYPelsPerMeter=$this->_fourbytes2int_le(substr($data,42,4)); // vertical pixels per meter, usually set to zero
$biXPelsPerMeter=round($biXPelsPerMeter/1000 *25.4);
//$biYPelsPerMeter=round($biYPelsPerMeter/1000 *25.4);
$info['set-dpi'] = $biXPelsPerMeter;
switch ($biCompression) {
case 0:
$str = substr($data, $bfOffBits);
break;
case 1: # BI_RLE8
$str = $this->rle8_decode(substr($data, $bfOffBits), $width);
break;
case 2: # BI_RLE4
$str = $this->rle4_decode(substr($data, $bfOffBits), $width);
break;
}
$bmpdata = '';
$padCnt = (4-ceil(($width/(8/$biBitCount)))%4)%4;
switch ($biBitCount) {
case 1:
case 4:
case 8:
$w = floor($width/(8/$biBitCount)) + ($width%(8/$biBitCount)?1:0);
$w_row = $w + $padCnt;
if ($flip) {
for ($y=0;$y<$height;$y++) {
$y0 = $y*$w_row;
for ($x=0;$x<$w;$x++) {
$bmpdata .= $str[$y0+$x];
}
}
} else {
for ($y=$height-1;$y>=0;$y--) {
$y0 = $y*$w_row;
for ($x=0;$x<$w;$x++) {
$bmpdata .= $str[$y0+$x];
}
}
}
break;
case 16:
$w_row = $width*2 + $padCnt;
if ($flip) {
for ($y=0;$y<$height;$y++) {
$y0 = $y*$w_row;
for ($x=0;$x<$width;$x++) {
$n = (ord($str[$y0 + 2*$x + 1])*256 + ord($str[$y0 + 2*$x]));
$b = ($n & 31)<<3;
$g = ($n & 992)>>2;
$r = ($n & 31744)>>7128;
$bmpdata .= chr($r) . chr($g) . chr($b);
}
}
} else {
for ($y=$height-1;$y>=0;$y--) {
$y0 = $y*$w_row;
for ($x=0;$x<$width;$x++) {
$n = (ord($str[$y0 + 2*$x + 1])*256 + ord($str[$y0 + 2*$x]));
$b = ($n & 31)<<3;
$g = ($n & 992)>>2;
$r = ($n & 31744)>>7;
$bmpdata .= chr($r) . chr($g) . chr($b);
}
}
}
break;
case 24:
case 32:
$byteCnt = $biBitCount/8;
$w_row = $width*$byteCnt + $padCnt;
if ($flip) {
for ($y=0;$y<$height;$y++) {
$y0 = $y*$w_row;
for ($x=0;$x<$width;$x++) {
$i = $y0 + $x*$byteCnt ; # + 1
$bmpdata .= $str[$i+2].$str[$i+1].$str[$i];
}
}
} else {
for ($y=$height-1;$y>=0;$y--) {
$y0 = $y*$w_row;
for ($x=0;$x<$width;$x++) {
$i = $y0 + $x*$byteCnt ; # + 1
$bmpdata .= $str[$i+2].$str[$i+1].$str[$i];
}
}
}
break;
default:
return array('error' => 'Error parsing BMP image - Unsupported image biBitCount');
}
if ($this->mpdf->compress) {
$bmpdata=gzcompress($bmpdata);
$info['f']='FlateDecode';
}
$info['data']=$bmpdata;
$info['type']='bmp';
return $info;
}
public function _fourbytes2int_le($s)
{
//Read a 4-byte integer from string
return (ord($s[3])<<24) + (ord($s[2])<<16) + (ord($s[1])<<8) + ord($s[0]);
}
public function _twobytes2int_le($s)
{
//Read a 2-byte integer from string
return (ord(substr($s, 1, 1))<<8) + ord(substr($s, 0, 1));
}
# Decoder for RLE8 compression in windows bitmaps
# see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
public function rle8_decode($str, $width)
{
$lineWidth = $width + (3 - ($width-1) % 4);
$out = '';
$cnt = strlen($str);
for ($i=0;$i<$cnt;$i++) {
$o = ord($str[$i]);
switch ($o) {
case 0: # ESCAPE
$i++;
switch (ord($str[$i])) {
case 0: # NEW LINE
$padCnt = $lineWidth - strlen($out)%$lineWidth;
if ($padCnt<$lineWidth) {
$out .= str_repeat(chr(0), $padCnt);
} # pad line
break;
case 1: # END OF FILE
$padCnt = $lineWidth - strlen($out)%$lineWidth;
if ($padCnt<$lineWidth) {
$out .= str_repeat(chr(0), $padCnt);
} # pad line
break 3;
case 2: # DELTA
$i += 2;
break;
default: # ABSOLUTE MODE
$num = ord($str[$i]);
for ($j=0;$j<$num;$j++) {
$out .= $str[++$i];
}
if ($num % 2) {
$i++;
}
}
break;
default:
$out .= str_repeat($str[++$i], $o);
}
}
return $out;
}
# Decoder for RLE4 compression in windows bitmaps
# see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
public function rle4_decode($str, $width)
{
$w = floor($width/2) + ($width % 2);
$lineWidth = $w + (3 - (($width-1) / 2) % 4);
$pixels = array();
$cnt = strlen($str);
for ($i=0;$i<$cnt;$i++) {
$o = ord($str[$i]);
switch ($o) {
case 0: # ESCAPE
$i++;
switch (ord($str[$i])) {
case 0: # NEW LINE
while (count($pixels)%$lineWidth!=0) {
$pixels[]=0;
}
break;
case 1: # END OF FILE
while (count($pixels)%$lineWidth!=0) {
$pixels[]=0;
}
break 3;
case 2: # DELTA
$i += 2;
break;
default: # ABSOLUTE MODE
$num = ord($str[$i]);
for ($j=0;$j<$num;$j++) {
if ($j%2==0) {
$c = ord($str[++$i]);
$pixels[] = ($c & 240)>>4;
} else {
$pixels[] = $c & 15;
}
}
if ($num % 2) {
$i++;
}
}
break;
default:
$c = ord($str[++$i]);
for ($j=0;$j<$o;$j++) {
$pixels[] = ($j%2==0 ? ($c & 240)>>4 : $c & 15);
}
}
}
$out = '';
if (count($pixels)%2) {
$pixels[]=0;
}
$cnt = count($pixels)/2;
for ($i=0;$i<$cnt;$i++) {
$out .= chr(16*$pixels[2*$i] + $pixels[2*$i+1]);
}
return $out;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,478 +0,0 @@
<?php
class directw
{
public $mpdf = null;
public function __construct(&$mpdf)
{
$this->mpdf = $mpdf;
}
public function Write($h, $txt, $currentx=0, $link='', $directionality='ltr', $align='')
{
if (!$align) {
if ($directionality=='rtl') {
$align = 'R';
} else {
$align = 'L';
}
}
if ($h == 0) {
$this->mpdf->SetLineHeight();
$h = $this->mpdf->lineheight;
}
//Output text in flowing mode
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
$s=str_replace("\r", '', $txt);
if ($this->mpdf->usingCoreFont) {
$nb=strlen($s);
} else {
$nb=mb_strlen($s, $this->mpdf->mb_enc);
// handle single space character
if (($nb==1) && $s == " ") {
$this->mpdf->x += $this->mpdf->GetStringWidth($s);
return;
}
}
$sep=-1;
$i=0;
$j=0;
$l=0;
$nl=1;
if (!$this->mpdf->usingCoreFont) {
if (preg_match("/([".$this->mpdf->pregRTLchars."])/u", $txt)) {
$this->mpdf->biDirectional = true;
} // *RTL*
$checkCursive=false;
if ($this->mpdf->biDirectional) {
$checkCursive=true;
} // *RTL*
elseif (isset($this->mpdf->CurrentFont['indic']) && $this->mpdf->CurrentFont['indic']) {
$checkCursive=true;
} // *INDIC*
while ($i<$nb) {
//Get next character
$c = mb_substr($s, $i, 1, $this->mpdf->mb_enc);
if ($c == "\n") {
// WORD SPACING
$this->mpdf->ResetSpacing();
//Explicit line break
$tmp = rtrim(mb_substr($s, $j, $i-$j, $this->mpdf->mb_enc));
if ($directionality == 'rtl' && $align == 'J') {
$align = 'R';
} // *RTL*
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
$i++;
$sep = -1;
$j = $i;
$l = 0;
if ($nl == 1) {
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
}
$nl++;
continue;
}
if ($c == " ") {
$sep= $i;
}
$l += $this->mpdf->GetCharWidthNonCore($c); // mPDF 5.3.04
if ($l > $wmax) {
//Automatic line break (word wrapping)
if ($sep == -1) {
// WORD SPACING
$this->mpdf->ResetSpacing();
if ($this->mpdf->x > $this->mpdf->lMargin) {
//Move to next line
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
$this->mpdf->y+=$h;
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
$i++;
$nl++;
continue;
}
if ($i==$j) {
$i++;
}
$tmp = rtrim(mb_substr($s, $j, $i-$j, $this->mpdf->mb_enc));
if ($directionality == 'rtl' && $align == 'J') {
$align = 'R';
} // *RTL*
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
} else {
$tmp = rtrim(mb_substr($s, $j, $sep-$j, $this->mpdf->mb_enc));
if ($directionality == 'rtl' && $align == 'J') {
$align = 'R';
} // *RTL*
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
if ($align=='J') {
//////////////////////////////////////////
// JUSTIFY J using Unicode fonts (Word spacing doesn't work)
// WORD SPACING
// Change NON_BREAKING SPACE to spaces so they are 'spaced' properly
$tmp = str_replace(chr(194).chr(160), chr(32), $tmp);
$len_ligne = $this->mpdf->GetStringWidth($tmp);
$nb_carac = mb_strlen($tmp, $this->mpdf->mb_enc) ;
$nb_spaces = mb_substr_count($tmp, ' ', $this->mpdf->mb_enc) ;
$inclCursive=false;
if ($checkCursive) {
if (preg_match("/([".$this->mpdf->pregRTLchars."])/u", $tmp)) {
$inclCursive = true;
} // *RTL*
if (preg_match("/([".$this->mpdf->pregHIchars.$this->mpdf->pregBNchars.$this->mpdf->pregPAchars."])/u", $tmp)) {
$inclCursive = true;
} // *INDIC*
}
list($charspacing, $ws) = $this->mpdf->GetJspacing($nb_carac, $nb_spaces, ((($w-2) - $len_ligne) * _MPDFK), $inclCursive);
$this->mpdf->SetSpacing($charspacing, $ws);
//////////////////////////////////////////
}
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
$i=$sep+1;
}
$sep = -1;
$j = $i;
$l = 0;
if ($nl==1) {
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
$wmax = ($w - ($this->mpdf->cMarginL+$this->mpdf->cMarginR));
}
$nl++;
} else {
$i++;
}
}
//Last chunk
// WORD SPACING
$this->mpdf->ResetSpacing();
} else {
while ($i<$nb) {
//Get next character
$c=$s[$i];
if ($c == "\n") {
//Explicit line break
// WORD SPACING
$this->mpdf->ResetSpacing();
$this->mpdf->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, $align, $fill, $link);
$i++;
$sep = -1;
$j = $i;
$l = 0;
if ($nl == 1) {
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
$w = $this->mpdf->w - $this->mpdf->rMargin - $this->mpdf->x;
$wmax=$w-($this->mpdf->cMarginL+$this->mpdf->cMarginR);
}
$nl++;
continue;
}
if ($c == " ") {
$sep= $i;
}
$l += $this->mpdf->GetCharWidthCore($c); // mPDF 5.3.04
if ($l > $wmax) {
//Automatic line break (word wrapping)
if ($sep == -1) {
// WORD SPACING
$this->mpdf->ResetSpacing();
if ($this->mpdf->x > $this->mpdf->lMargin) {
//Move to next line
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
$this->mpdf->y+=$h;
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
$wmax=$w-($this->mpdf->cMarginL+$this->mpdf->cMarginR);
$i++;
$nl++;
continue;
}
if ($i==$j) {
$i++;
}
$this->mpdf->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, $align, $fill, $link);
} else {
$tmp = substr($s, $j, $sep-$j);
if ($align=='J') {
//////////////////////////////////////////
// JUSTIFY J using Unicode fonts (Word spacing doesn't work)
// WORD SPACING
// Change NON_BREAKING SPACE to spaces so they are 'spaced' properly
$tmp = str_replace(chr(160), chr(32), $tmp);
$len_ligne = $this->mpdf->GetStringWidth($tmp);
$nb_carac = strlen($tmp) ;
$nb_spaces = substr_count($tmp, ' ') ;
list($charspacing, $ws) = $this->mpdf->GetJspacing($nb_carac, $nb_spaces, ((($w-2) - $len_ligne) * _MPDFK), $false);
$this->mpdf->SetSpacing($charspacing, $ws);
//////////////////////////////////////////
}
$this->mpdf->Cell($w, $h, $tmp, 0, 2, $align, $fill, $link);
$i=$sep+1;
}
$sep = -1;
$j = $i;
$l = 0;
if ($nl==1) {
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
$w=$this->mpdf->w-$this->mpdf->rMargin-$this->mpdf->x;
$wmax=$w-($this->mpdf->cMarginL+$this->mpdf->cMarginR);
}
$nl++;
} else {
$i++;
}
}
// WORD SPACING
$this->mpdf->ResetSpacing();
}
//Last chunk
if ($i!=$j) {
if ($currentx != 0) {
$this->mpdf->x=$currentx;
} else {
$this->mpdf->x=$this->mpdf->lMargin;
}
if ($this->mpdf->usingCoreFont) {
$tmp = substr($s, $j, $i-$j);
} else {
$tmp = mb_substr($s, $j, $i-$j, $this->mpdf->mb_enc);
if ($directionality == 'rtl' && $align == 'J') {
$align = 'R';
} // *RTL*
$this->mpdf->magic_reverse_dir($tmp, true, $directionality); // *RTL*
}
$this->mpdf->Cell($w, $h, $tmp, 0, 0, $align, $fill, $link);
}
}
public function CircularText($x, $y, $r, $text, $align='top', $fontfamily='', $fontsizePt=0, $fontstyle='', $kerning=120, $fontwidth=100, $divider='')
{ // mPDF 5.5.23
if ($font || $fontstyle || $fontsizePt) {
$this->mpdf->SetFont($fontfamily, $fontstyle, $fontsizePt);
}
$kerning/=100;
$fontwidth/=100;
if ($kerning==0) {
$this->mpdf->Error('Please use values unequal to zero for kerning (CircularText)');
}
if ($fontwidth==0) {
$this->mpdf->Error('Please use values unequal to zero for font width (CircularText)');
}
$text=str_replace("\r", '', $text);
//circumference
$u=($r*2)*M_PI;
// mPDF 5.5.23
$checking = true;
$autoset = false;
while ($checking) {
$t=0;
$w = array();
if ($this->mpdf->usingCoreFont) {
$nb=strlen($text);
for ($i=0; $i<$nb; $i++) {
$w[$i]=$this->mpdf->GetStringWidth($text[$i]);
$w[$i]*=$kerning*$fontwidth;
$t+=$w[$i];
}
} else {
$nb=mb_strlen($text, $this->mpdf->mb_enc);
$lastchar = '';
$unicode = $this->mpdf->UTF8StringToArray($text);
for ($i=0; $i<$nb; $i++) {
$c = mb_substr($text, $i, 1, $this->mpdf->mb_enc);
$w[$i]=$this->mpdf->GetStringWidth($c);
$w[$i]*=$kerning*$fontwidth;
$char = $unicode[$i];
if ($this->mpdf->useKerning && $lastchar) {
if (isset($this->mpdf->CurrentFont['kerninfo'][$lastchar][$char])) {
$tk = $this->mpdf->CurrentFont['kerninfo'][$lastchar][$char] * ($this->mpdf->FontSize/ 1000) * $kerning * $fontwidth;
$w[$i] += $tk/2;
$w[$i-1] += $tk/2;
$t+=$tk;
}
}
$lastchar = $char;
$t+=$w[$i];
}
}
if ($fontsizePt>=0 || $autoset) {
$checking = false;
} else {
$t+=$this->mpdf->GetStringWidth(' ');
if ($divider) {
$t+=$this->mpdf->GetStringWidth(' ');
}
if ($fontsizePt==-2) {
$fontsizePt = $this->mpdf->FontSizePt * 0.5 * $u/$t;
} else {
$fontsizePt = $this->mpdf->FontSizePt * $u/$t;
}
$this->mpdf->SetFontSize($fontsizePt);
$autoset = true;
}
}
//total width of string in degrees
$d=($t/$u)*360;
$this->mpdf->StartTransform();
// rotate matrix for the first letter to center the text
// (half of total degrees)
if ($align=='top') {
$this->mpdf->transformRotate(-$d/2, $x, $y);
} else {
$this->mpdf->transformRotate($d/2, $x, $y);
}
//run through the string
for ($i=0; $i<$nb; $i++) {
if ($align=='top') {
//rotate matrix half of the width of current letter + half of the width of preceding letter
if ($i==0) {
$this->mpdf->transformRotate((($w[$i]/2)/$u)*360, $x, $y);
} else {
$this->mpdf->transformRotate((($w[$i]/2+$w[$i-1]/2)/$u)*360, $x, $y);
}
if ($fontwidth!=1) {
$this->mpdf->StartTransform();
$this->mpdf->transformScale($fontwidth*100, 100, $x, $y);
}
$this->mpdf->SetXY($x-$w[$i]/2, $y-$r);
} else {
//rotate matrix half of the width of current letter + half of the width of preceding letter
if ($i==0) {
$this->mpdf->transformRotate(-(($w[$i]/2)/$u)*360, $x, $y);
} else {
$this->mpdf->transformRotate(-(($w[$i]/2+$w[$i-1]/2)/$u)*360, $x, $y);
}
if ($fontwidth!=1) {
$this->mpdf->StartTransform();
$this->mpdf->transformScale($fontwidth*100, 100, $x, $y);
}
$this->mpdf->SetXY($x-$w[$i]/2, $y+$r-($this->mpdf->FontSize));
}
if ($this->mpdf->usingCoreFont) {
$c=$text[$i];
} else {
$c = mb_substr($text, $i, 1, $this->mpdf->mb_enc);
}
$this->mpdf->Cell(($w[$i]), $this->mpdf->FontSize, $c, 0, 0, 'C'); // mPDF 5.3.53
if ($fontwidth!=1) {
$this->mpdf->StopTransform();
}
}
$this->mpdf->StopTransform();
// mPDF 5.5.23
if ($align=='top' && $divider!='') {
$wc=$this->mpdf->GetStringWidth($divider);
$wc*=$kerning*$fontwidth;
$this->mpdf->StartTransform();
$this->mpdf->transformRotate(90, $x, $y);
$this->mpdf->SetXY($x-$wc/2, $y-$r);
$this->mpdf->Cell(($wc), $this->mpdf->FontSize, $divider, 0, 0, 'C');
$this->mpdf->StopTransform();
$this->mpdf->StartTransform();
$this->mpdf->transformRotate(-90, $x, $y);
$this->mpdf->SetXY($x-$wc/2, $y-$r);
$this->mpdf->Cell(($wc), $this->mpdf->FontSize, $divider, 0, 0, 'C');
$this->mpdf->StopTransform();
}
}
public function Shaded_box($text, $font='', $fontstyle='B', $szfont='', $width='70%', $style='DF', $radius=2.5, $fill='#FFFFFF', $color='#000000', $pad=2)
{
// F (shading - no line),S (line, no shading),DF (both)
if (!$font) {
$font= $this->mpdf->default_font;
}
if (!$szfont) {
$szfont = ($this->mpdf->default_font_size * 1.8);
}
$text = $this->mpdf->purify_utf8_text($text);
if ($this->mpdf->text_input_as_HTML) {
$text = $this->mpdf->all_entities_to_utf8($text);
}
if ($this->mpdf->usingCoreFont) {
$text = mb_convert_encoding($text, $this->mpdf->mb_enc, 'UTF-8');
}
// DIRECTIONALITY
$this->mpdf->magic_reverse_dir($text, true, $this->mpdf->directionality); // *RTL*
// Font-specific ligature substitution for Indic fonts
if (isset($this->mpdf->CurrentFont['indic']) && $this->mpdf->CurrentFont['indic']) {
$this->mpdf->ConvertIndic($text);
} // *INDIC*
$text = ' '.$text.' ';
if (!$width) {
$width = $this->mpdf->pgwidth;
} else {
$width=$this->mpdf->ConvertSize($width, $this->mpdf->pgwidth);
}
$midpt = $this->mpdf->lMargin+($this->mpdf->pgwidth/2);
$r1 = $midpt-($width/2); //($this->mpdf->w / 2) - 40;
$r2 = $r1 + $width; //$r1 + 80;
$y1 = $this->mpdf->y;
$mid = ($r1 + $r2) / 2;
$loop = 0;
while ($loop == 0) {
$this->mpdf->SetFont($font, $fontstyle, $szfont);
$sz = $this->mpdf->GetStringWidth($text);
if (($r1+$sz) > $r2) {
$szfont --;
} else {
$loop ++;
}
}
$y2 = $this->mpdf->FontSize+($pad*2);
$this->mpdf->SetLineWidth(0.1);
$fc = $this->mpdf->ConvertColor($fill);
$tc = $this->mpdf->ConvertColor($color);
$this->mpdf->SetFColor($fc);
$this->mpdf->SetTColor($tc);
$this->mpdf->RoundedRect($r1, $y1, ($r2 - $r1), $y2, $radius, $style);
$this->mpdf->SetX($r1);
$this->mpdf->Cell($r2-$r1, $y2, $text, 0, 1, "C");
$this->mpdf->SetY($y1+$y2+2); // +2 = mm margin below shaded box
$this->mpdf->Reset();
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,712 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////////////////////////////
// 2009-12-22 Adapted for mPDF 4.2
///////////////////////////////////////////////////////////////////////////////////////////////////
// GIF Util - (C) 2003 Yamasoft (S/C)
// http://www.yamasoft.com
// All Rights Reserved
// This file can be freely copied, distributed, modified, updated by anyone under the only
// condition to leave the original address (Yamasoft, http://www.yamasoft.com) and this header.
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// 2009-12-22 Adapted INB
// Functions calling functionname($x, $len = 0) were not working on PHP5.1.5 as pass by reference
// All edited to $len = 0; then call function.
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
class CGIFLZW
{
public $MAX_LZW_BITS;
public $Fresh;
public $CodeSize;
public $SetCodeSize;
public $MaxCode;
public $MaxCodeSize;
public $FirstCode;
public $OldCode;
public $ClearCode;
public $EndCode;
public $Next;
public $Vals;
public $Stack;
public $sp;
public $Buf;
public $CurBit;
public $LastBit;
public $Done;
public $LastByte;
///////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
public function __construct()
{
$this->MAX_LZW_BITS = 12;
unSet($this->Next);
unSet($this->Vals);
unSet($this->Stack);
unSet($this->Buf);
$this->Next = range(0, (1 << $this->MAX_LZW_BITS) - 1);
$this->Vals = range(0, (1 << $this->MAX_LZW_BITS) - 1);
$this->Stack = range(0, (1 << ($this->MAX_LZW_BITS + 1)) - 1);
$this->Buf = range(0, 279);
}
///////////////////////////////////////////////////////////////////////////
public function deCompress($data, &$datLen)
{
$stLen = strlen($data);
$datLen = 0;
$ret = "";
$dp = 0; // data pointer
// INITIALIZATION
$this->LZWCommandInit($data, $dp);
while (($iIndex = $this->LZWCommand($data, $dp)) >= 0) {
$ret .= chr($iIndex);
}
$datLen = $dp;
if ($iIndex != -2) {
return false;
}
return $ret;
}
///////////////////////////////////////////////////////////////////////////
public function LZWCommandInit(&$data, &$dp)
{
$this->SetCodeSize = ord($data[0]);
$dp += 1;
$this->CodeSize = $this->SetCodeSize + 1;
$this->ClearCode = 1 << $this->SetCodeSize;
$this->EndCode = $this->ClearCode + 1;
$this->MaxCode = $this->ClearCode + 2;
$this->MaxCodeSize = $this->ClearCode << 1;
$this->GetCodeInit($data, $dp);
$this->Fresh = 1;
for ($i = 0; $i < $this->ClearCode; $i++) {
$this->Next[$i] = 0;
$this->Vals[$i] = $i;
}
for (; $i < (1 << $this->MAX_LZW_BITS); $i++) {
$this->Next[$i] = 0;
$this->Vals[$i] = 0;
}
$this->sp = 0;
return 1;
}
public function LZWCommand(&$data, &$dp)
{
if ($this->Fresh) {
$this->Fresh = 0;
do {
$this->FirstCode = $this->GetCode($data, $dp);
$this->OldCode = $this->FirstCode;
} while ($this->FirstCode == $this->ClearCode);
return $this->FirstCode;
}
if ($this->sp > 0) {
$this->sp--;
return $this->Stack[$this->sp];
}
while (($Code = $this->GetCode($data, $dp)) >= 0) {
if ($Code == $this->ClearCode) {
for ($i = 0; $i < $this->ClearCode; $i++) {
$this->Next[$i] = 0;
$this->Vals[$i] = $i;
}
for (; $i < (1 << $this->MAX_LZW_BITS); $i++) {
$this->Next[$i] = 0;
$this->Vals[$i] = 0;
}
$this->CodeSize = $this->SetCodeSize + 1;
$this->MaxCodeSize = $this->ClearCode << 1;
$this->MaxCode = $this->ClearCode + 2;
$this->sp = 0;
$this->FirstCode = $this->GetCode($data, $dp);
$this->OldCode = $this->FirstCode;
return $this->FirstCode;
}
if ($Code == $this->EndCode) {
return -2;
}
$InCode = $Code;
if ($Code >= $this->MaxCode) {
$this->Stack[$this->sp++] = $this->FirstCode;
$Code = $this->OldCode;
}
while ($Code >= $this->ClearCode) {
$this->Stack[$this->sp++] = $this->Vals[$Code];
if ($Code == $this->Next[$Code]) { // Circular table entry, big GIF Error!
return -1;
}
$Code = $this->Next[$Code];
}
$this->FirstCode = $this->Vals[$Code];
$this->Stack[$this->sp++] = $this->FirstCode;
if (($Code = $this->MaxCode) < (1 << $this->MAX_LZW_BITS)) {
$this->Next[$Code] = $this->OldCode;
$this->Vals[$Code] = $this->FirstCode;
$this->MaxCode++;
if (($this->MaxCode >= $this->MaxCodeSize) && ($this->MaxCodeSize < (1 << $this->MAX_LZW_BITS))) {
$this->MaxCodeSize *= 2;
$this->CodeSize++;
}
}
$this->OldCode = $InCode;
if ($this->sp > 0) {
$this->sp--;
return $this->Stack[$this->sp];
}
}
return $Code;
}
///////////////////////////////////////////////////////////////////////////
public function GetCodeInit(&$data, &$dp)
{
$this->CurBit = 0;
$this->LastBit = 0;
$this->Done = 0;
$this->LastByte = 2;
return 1;
}
public function GetCode(&$data, &$dp)
{
if (($this->CurBit + $this->CodeSize) >= $this->LastBit) {
if ($this->Done) {
if ($this->CurBit >= $this->LastBit) {
// Ran off the end of my bits
return 0;
}
return -1;
}
$this->Buf[0] = $this->Buf[$this->LastByte - 2];
$this->Buf[1] = $this->Buf[$this->LastByte - 1];
$Count = ord($data[$dp]);
$dp += 1;
if ($Count) {
for ($i = 0; $i < $Count; $i++) {
$this->Buf[2 + $i] = ord($data[$dp+$i]);
}
$dp += $Count;
} else {
$this->Done = 1;
}
$this->LastByte = 2 + $Count;
$this->CurBit = ($this->CurBit - $this->LastBit) + 16;
$this->LastBit = (2 + $Count) << 3;
}
$iRet = 0;
for ($i = $this->CurBit, $j = 0; $j < $this->CodeSize; $i++, $j++) {
$iRet |= (($this->Buf[(int)($i / 8)] & (1 << ($i % 8))) != 0) << $j;
}
$this->CurBit += $this->CodeSize;
return $iRet;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class CGIFCOLORTABLE
{
public $m_nColors;
public $m_arColors;
///////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
public function __construct()
{
unSet($this->m_nColors);
unSet($this->m_arColors);
}
///////////////////////////////////////////////////////////////////////////
public function load($lpData, $num)
{
$this->m_nColors = 0;
$this->m_arColors = array();
for ($i = 0; $i < $num; $i++) {
$rgb = substr($lpData, $i * 3, 3);
if (strlen($rgb) < 3) {
return false;
}
$this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]);
$this->m_nColors++;
}
return true;
}
///////////////////////////////////////////////////////////////////////////
public function toString()
{
$ret = "";
for ($i = 0; $i < $this->m_nColors; $i++) {
$ret .=
chr(($this->m_arColors[$i] & 0x000000FF)) . // R
chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G
chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B
}
return $ret;
}
///////////////////////////////////////////////////////////////////////////
public function colorIndex($rgb)
{
$rgb = (int)$rgb & 0xFFFFFF;
$r1 = ($rgb & 0x0000FF);
$g1 = ($rgb & 0x00FF00) >> 8;
$b1 = ($rgb & 0xFF0000) >> 16;
$idx = -1;
for ($i = 0; $i < $this->m_nColors; $i++) {
$r2 = ($this->m_arColors[$i] & 0x000000FF);
$g2 = ($this->m_arColors[$i] & 0x0000FF00) >> 8;
$b2 = ($this->m_arColors[$i] & 0x00FF0000) >> 16;
$d = abs($r2 - $r1) + abs($g2 - $g1) + abs($b2 - $b1);
if (($idx == -1) || ($d < $dif)) {
$idx = $i;
$dif = $d;
}
}
return $idx;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class CGIFFILEHEADER
{
public $m_lpVer;
public $m_nWidth;
public $m_nHeight;
public $m_bGlobalClr;
public $m_nColorRes;
public $m_bSorted;
public $m_nTableSize;
public $m_nBgColor;
public $m_nPixelRatio;
public $m_colorTable;
///////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
public function __construct()
{
unSet($this->m_lpVer);
unSet($this->m_nWidth);
unSet($this->m_nHeight);
unSet($this->m_bGlobalClr);
unSet($this->m_nColorRes);
unSet($this->m_bSorted);
unSet($this->m_nTableSize);
unSet($this->m_nBgColor);
unSet($this->m_nPixelRatio);
unSet($this->m_colorTable);
}
///////////////////////////////////////////////////////////////////////////
public function load($lpData, &$hdrLen)
{
$hdrLen = 0;
$this->m_lpVer = substr($lpData, 0, 6);
if (($this->m_lpVer <> "GIF87a") && ($this->m_lpVer <> "GIF89a")) {
return false;
}
$this->m_nWidth = $this->w2i(substr($lpData, 6, 2));
$this->m_nHeight = $this->w2i(substr($lpData, 8, 2));
if (!$this->m_nWidth || !$this->m_nHeight) {
return false;
}
$b = ord(substr($lpData, 10, 1));
$this->m_bGlobalClr = ($b & 0x80) ? true : false;
$this->m_nColorRes = ($b & 0x70) >> 4;
$this->m_bSorted = ($b & 0x08) ? true : false;
$this->m_nTableSize = 2 << ($b & 0x07);
$this->m_nBgColor = ord(substr($lpData, 11, 1));
$this->m_nPixelRatio = ord(substr($lpData, 12, 1));
$hdrLen = 13;
if ($this->m_bGlobalClr) {
$this->m_colorTable = new CGIFCOLORTABLE();
if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
return false;
}
$hdrLen += 3 * $this->m_nTableSize;
}
return true;
}
///////////////////////////////////////////////////////////////////////////
public function w2i($str)
{
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class CGIFIMAGEHEADER
{
public $m_nLeft;
public $m_nTop;
public $m_nWidth;
public $m_nHeight;
public $m_bLocalClr;
public $m_bInterlace;
public $m_bSorted;
public $m_nTableSize;
public $m_colorTable;
///////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
public function __construct()
{
unSet($this->m_nLeft);
unSet($this->m_nTop);
unSet($this->m_nWidth);
unSet($this->m_nHeight);
unSet($this->m_bLocalClr);
unSet($this->m_bInterlace);
unSet($this->m_bSorted);
unSet($this->m_nTableSize);
unSet($this->m_colorTable);
}
///////////////////////////////////////////////////////////////////////////
public function load($lpData, &$hdrLen)
{
$hdrLen = 0;
$this->m_nLeft = $this->w2i(substr($lpData, 0, 2));
$this->m_nTop = $this->w2i(substr($lpData, 2, 2));
$this->m_nWidth = $this->w2i(substr($lpData, 4, 2));
$this->m_nHeight = $this->w2i(substr($lpData, 6, 2));
if (!$this->m_nWidth || !$this->m_nHeight) {
return false;
}
$b = ord($lpData{8});
$this->m_bLocalClr = ($b & 0x80) ? true : false;
$this->m_bInterlace = ($b & 0x40) ? true : false;
$this->m_bSorted = ($b & 0x20) ? true : false;
$this->m_nTableSize = 2 << ($b & 0x07);
$hdrLen = 9;
if ($this->m_bLocalClr) {
$this->m_colorTable = new CGIFCOLORTABLE();
if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
return false;
}
$hdrLen += 3 * $this->m_nTableSize;
}
return true;
}
///////////////////////////////////////////////////////////////////////////
public function w2i($str)
{
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class CGIFIMAGE
{
public $m_disp;
public $m_bUser;
public $m_bTrans;
public $m_nDelay;
public $m_nTrans;
public $m_lpComm;
public $m_gih;
public $m_data;
public $m_lzw;
///////////////////////////////////////////////////////////////////////////
public function __construct()
{
unSet($this->m_disp);
unSet($this->m_bUser);
unSet($this->m_bTrans);
unSet($this->m_nDelay);
unSet($this->m_nTrans);
unSet($this->m_lpComm);
unSet($this->m_data);
$this->m_gih = new CGIFIMAGEHEADER();
$this->m_lzw = new CGIFLZW();
}
///////////////////////////////////////////////////////////////////////////
public function load($data, &$datLen)
{
$datLen = 0;
while (true) {
$b = ord($data[0]);
$data = substr($data, 1);
$datLen++;
switch ($b) {
case 0x21: // Extension
$len = 0;
if (!$this->skipExt($data, $len)) {
return false;
}
$datLen += $len;
break;
case 0x2C: // Image
// LOAD HEADER & COLOR TABLE
$len = 0;
if (!$this->m_gih->load($data, $len)) {
return false;
}
$data = substr($data, $len);
$datLen += $len;
// ALLOC BUFFER
$len = 0;
if (!($this->m_data = $this->m_lzw->deCompress($data, $len))) {
return false;
}
$data = substr($data, $len);
$datLen += $len;
if ($this->m_gih->m_bInterlace) {
$this->deInterlace();
}
return true;
case 0x3B: // EOF
default:
return false;
}
}
return false;
}
///////////////////////////////////////////////////////////////////////////
public function skipExt(&$data, &$extLen)
{
$extLen = 0;
$b = ord($data[0]);
$data = substr($data, 1);
$extLen++;
switch ($b) {
case 0xF9: // Graphic Control
$b = ord($data[1]);
$this->m_disp = ($b & 0x1C) >> 2;
$this->m_bUser = ($b & 0x02) ? true : false;
$this->m_bTrans = ($b & 0x01) ? true : false;
$this->m_nDelay = $this->w2i(substr($data, 2, 2));
$this->m_nTrans = ord($data[4]);
break;
case 0xFE: // Comment
$this->m_lpComm = substr($data, 1, ord($data[0]));
break;
case 0x01: // Plain text
break;
case 0xFF: // Application
break;
}
// SKIP DEFAULT AS DEFS MAY CHANGE
$b = ord($data[0]);
$data = substr($data, 1);
$extLen++;
while ($b > 0) {
$data = substr($data, $b);
$extLen += $b;
$b = ord($data[0]);
$data = substr($data, 1);
$extLen++;
}
return true;
}
///////////////////////////////////////////////////////////////////////////
public function w2i($str)
{
return ord(substr($str, 0, 1)) + (ord(substr($str, 1, 1)) << 8);
}
///////////////////////////////////////////////////////////////////////////
public function deInterlace()
{
$data = $this->m_data;
for ($i = 0; $i < 4; $i++) {
switch ($i) {
case 0:
$s = 8;
$y = 0;
break;
case 1:
$s = 8;
$y = 4;
break;
case 2:
$s = 4;
$y = 2;
break;
case 3:
$s = 2;
$y = 1;
break;
}
for (; $y < $this->m_gih->m_nHeight; $y += $s) {
$lne = substr($this->m_data, 0, $this->m_gih->m_nWidth);
$this->m_data = substr($this->m_data, $this->m_gih->m_nWidth);
$data =
substr($data, 0, $y * $this->m_gih->m_nWidth) .
$lne .
substr($data, ($y + 1) * $this->m_gih->m_nWidth);
}
}
$this->m_data = $data;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class CGIF
{
public $m_gfh;
public $m_lpData;
public $m_img;
public $m_bLoaded;
///////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
public function __construct()
{
$this->m_gfh = new CGIFFILEHEADER();
$this->m_img = new CGIFIMAGE();
$this->m_lpData = "";
$this->m_bLoaded = false;
}
///////////////////////////////////////////////////////////////////////////
public function ClearData()
{
$this->m_lpData = '';
unset($this->m_img->m_data);
unset($this->m_img->m_lzw->Next);
unset($this->m_img->m_lzw->Vals);
unset($this->m_img->m_lzw->Stack);
unset($this->m_img->m_lzw->Buf);
}
public function loadFile(&$data, $iIndex)
{
if ($iIndex < 0) {
return false;
}
$this->m_lpData = $data;
// GET FILE HEADER
$len = 0;
if (!$this->m_gfh->load($this->m_lpData, $len)) {
return false;
}
$this->m_lpData = substr($this->m_lpData, $len);
do {
$imgLen = 0;
if (!$this->m_img->load($this->m_lpData, $imgLen)) {
return false;
}
$this->m_lpData = substr($this->m_lpData, $imgLen);
} while ($iIndex-- > 0);
$this->m_bLoaded = true;
return true;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -1,980 +0,0 @@
<?php
class grad
{
public $mpdf = null;
public function __construct(&$mpdf)
{
$this->mpdf = $mpdf;
}
// mPDF 5.3.A1
public function CoonsPatchMesh($x, $y, $w, $h, $patch_array=array(), $x_min=0, $x_max=1, $y_min=0, $y_max=1, $colspace='RGB', $return=false)
{
$s=' q ';
$s.=sprintf(' %.3F %.3F %.3F %.3F re W n ', $x*_MPDFK, ($this->mpdf->h-$y)*_MPDFK, $w*_MPDFK, -$h*_MPDFK);
$s.=sprintf(' %.3F 0 0 %.3F %.3F %.3F cm ', $w*_MPDFK, $h*_MPDFK, $x*_MPDFK, ($this->mpdf->h-($y+$h))*_MPDFK);
$n = count($this->mpdf->gradients)+1;
$this->mpdf->gradients[$n]['type'] = 6; //coons patch mesh
$this->mpdf->gradients[$n]['colorspace'] = $colspace; //coons patch mesh
$bpcd=65535; //16 BitsPerCoordinate
$trans = false;
$this->mpdf->gradients[$n]['stream']='';
for ($i=0;$i<count($patch_array);$i++) {
$this->mpdf->gradients[$n]['stream'].=chr($patch_array[$i]['f']); //start with the edge flag as 8 bit
for ($j=0;$j<count($patch_array[$i]['points']);$j++) {
//each point as 16 bit
if (($j % 2) == 1) { // Y coordinate (adjusted as input is From top left)
$patch_array[$i]['points'][$j]=(($patch_array[$i]['points'][$j]-$y_min)/($y_max-$y_min))*$bpcd;
$patch_array[$i]['points'][$j]=$bpcd-$patch_array[$i]['points'][$j];
} else {
$patch_array[$i]['points'][$j]=(($patch_array[$i]['points'][$j]-$x_min)/($x_max-$x_min))*$bpcd;
}
if ($patch_array[$i]['points'][$j]<0) {
$patch_array[$i]['points'][$j]=0;
}
if ($patch_array[$i]['points'][$j]>$bpcd) {
$patch_array[$i]['points'][$j]=$bpcd;
}
$this->mpdf->gradients[$n]['stream'].=chr(floor($patch_array[$i]['points'][$j]/256));
$this->mpdf->gradients[$n]['stream'].=chr(floor($patch_array[$i]['points'][$j]%256));
}
for ($j=0;$j<count($patch_array[$i]['colors']);$j++) {
//each color component as 8 bit
if ($colspace=='RGB') {
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][1]);
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][2]);
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][3]);
if (isset($patch_array[$i]['colors'][$j][4]) && ord($patch_array[$i]['colors'][$j][4])<100) {
$trans = true;
}
} elseif ($colspace=='CMYK') {
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][1])*2.55);
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][2])*2.55);
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][3])*2.55);
$this->mpdf->gradients[$n]['stream'].=chr(ord($patch_array[$i]['colors'][$j][4])*2.55);
if (isset($patch_array[$i]['colors'][$j][5]) && ord($patch_array[$i]['colors'][$j][5])<100) {
$trans = true;
}
} elseif ($colspace=='Gray') {
$this->mpdf->gradients[$n]['stream'].=($patch_array[$i]['colors'][$j][1]);
if ($patch_array[$i]['colors'][$j][2]==1) {
$trans = true;
} // transparency converted from rgba or cmyka()
}
}
}
// TRANSPARENCY
if ($trans) {
$this->mpdf->gradients[$n]['stream_trans']='';
for ($i=0;$i<count($patch_array);$i++) {
$this->mpdf->gradients[$n]['stream_trans'].=chr($patch_array[$i]['f']);
for ($j=0;$j<count($patch_array[$i]['points']);$j++) {
//each point as 16 bit
$this->mpdf->gradients[$n]['stream_trans'].=chr(floor($patch_array[$i]['points'][$j]/256));
$this->mpdf->gradients[$n]['stream_trans'].=chr(floor($patch_array[$i]['points'][$j]%256));
}
for ($j=0;$j<count($patch_array[$i]['colors']);$j++) {
//each color component as 8 bit // OPACITY
if ($colspace=='RGB') {
$this->mpdf->gradients[$n]['stream_trans'].=chr((int)(ord($patch_array[$i]['colors'][$j][4]) * 2.55));
} elseif ($colspace=='CMYK') {
$this->mpdf->gradients[$n]['stream_trans'].=chr((int)(ord($patch_array[$i]['colors'][$j][5]) * 2.55));
} elseif ($colspace=='Gray') {
$this->mpdf->gradients[$n]['stream_trans'].=chr((int)(ord($patch_array[$i]['colors'][$j][3]) * 2.55));
}
}
}
$this->mpdf->gradients[$n]['trans'] = true;
$s .= ' /TGS'.$n.' gs ';
}
//paint the gradient
$s .= '/Sh'.$n.' sh'."\n";
//restore previous Graphic State
$s .= 'Q'."\n";
if ($return) {
return $s;
} else {
$this->mpdf->_out($s);
}
}
// type = linear:2; radial: 3;
// Linear: $coords - array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg).
// The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
// Radial: $coords - array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1,
// (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg).
// (fx, fy) should be inside the circle, otherwise some areas will not be defined
// $col = array(R,G,B/255); or array(G/255); or array(C,M,Y,K/100)
// $stops = array('col'=>$col [, 'opacity'=>0-1] [, 'offset'=>0-1])
public function Gradient($x, $y, $w, $h, $type, $stops=array(), $colorspace='RGB', $coords='', $extend='', $return=false, $is_mask=false)
{
if (strtoupper(substr($type, 0, 1)) == 'L') {
$type = 2;
} // linear
elseif (strtoupper(substr($type, 0, 1)) == 'R') {
$type = 3;
} // radial
if ($colorspace != 'CMYK' && $colorspace != 'Gray') {
$colorspace = 'RGB';
}
$bboxw = $w;
$bboxh = $h;
$usex = $x;
$usey = $y;
$usew = $bboxw;
$useh = $bboxh;
if ($type < 1) {
$type = 2;
}
if ($coords[0]!==false && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $coords[0], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$coords[0] = $tmp/$w;
}
}
if ($coords[1]!==false && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $coords[1], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$coords[1] = 1-($tmp/$h);
}
}
// LINEAR
if ($type == 2) {
$angle = $coords[4];
$repeat = $coords[5];
// ALL POINTS SET (default for custom mPDF linear gradient) - no -moz
if ($coords[0]!==false && $coords[1]!==false && $coords[2]!==false && $coords[3]!==false) {
// do nothing - coords used as they are
}
// If both a <point> and <angle> are defined, the gradient axis starts from the point and runs along the angle. The end point is
// defined as before - in this case start points may not be in corners, and axis may not correctly fall in the right quadrant.
// NO end points (Angle defined & Start points)
elseif ($angle!==false && $coords[0]!==false && $coords[1]!==false && $coords[2]===false && $coords[3]===false) {
if ($angle==0 || $angle==360) {
$coords[3]=$coords[1];
if ($coords[0]==1) {
$coords[2]=2;
} else {
$coords[2]=1;
}
} elseif ($angle==90) {
$coords[2]=$coords[0];
$coords[3]=1;
if ($coords[1]==1) {
$coords[3]=2;
} else {
$coords[3]=1;
}
} elseif ($angle==180) {
if ($coords[4]==0) {
$coords[2]=-1;
} else {
$coords[2]=0;
}
$coords[3]=$coords[1];
} elseif ($angle==270) {
$coords[2]=$coords[0];
if ($coords[1]==0) {
$coords[3]=-1;
} else {
$coords[3]=0;
}
} else {
$endx=1;
$endy=1;
if ($angle <=90) {
if ($angle <=45) {
$endy=tan(deg2rad($angle));
} else {
$endx=tan(deg2rad(90-$angle));
}
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
$ny = 1 - $coords[1] - (tan($b) * (1-$coords[0]));
$tx = sin($b) * cos($b) * $ny;
$ty = cos($b) * cos($b) * $ny;
$coords[2] = 1+$tx;
$coords[3] = 1-$ty;
} elseif ($angle <=180) {
if ($angle <=135) {
$endx=tan(deg2rad($angle-90));
} else {
$endy=tan(deg2rad(180-$angle));
}
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
$ny = 1 - $coords[1] - (tan($b) * ($coords[0]));
$tx = sin($b) * cos($b) * $ny;
$ty = cos($b) * cos($b) * $ny;
$coords[2] = -$tx;
$coords[3] = 1-$ty;
} elseif ($angle <=270) {
if ($angle <=225) {
$endy=tan(deg2rad($angle-180));
} else {
$endx=tan(deg2rad(270-$angle));
}
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
$ny = $coords[1] - (tan($b) * ($coords[0]));
$tx = sin($b) * cos($b) * $ny;
$ty = cos($b) * cos($b) * $ny;
$coords[2] = -$tx;
$coords[3] = $ty;
} else {
if ($angle <=315) {
$endx=tan(deg2rad($angle-270));
} else {
$endy=tan(deg2rad(360-$angle));
}
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
$ny = $coords[1] - (tan($b) * (1-$coords[0]));
$tx = sin($b) * cos($b) * $ny;
$ty = cos($b) * cos($b) * $ny;
$coords[2] = 1+$tx;
$coords[3] = $ty;
}
}
}
// -moz If the first parameter is only an <angle>, the gradient axis starts from the box's corner that would ensure the
// axis goes through the box. The axis runs along the specified angle. The end point of the axis is defined such that the
// farthest corner of the box from the starting point is perpendicular to the gradient axis at that point.
// NO end points or Start points (Angle defined)
elseif ($angle!==false && $coords[0]===false && $coords[1]===false) {
if ($angle==0 || $angle==360) {
$coords[0]=0;
$coords[1]=0;
$coords[2]=1;
$coords[3]=0;
} elseif ($angle==90) {
$coords[0]=0;
$coords[1]=0;
$coords[2]=0;
$coords[3]=1;
} elseif ($angle==180) {
$coords[0]=1;
$coords[1]=0;
$coords[2]=0;
$coords[3]=0;
} elseif ($angle==270) {
$coords[0]=0;
$coords[1]=1;
$coords[2]=0;
$coords[3]=0;
} else {
if ($angle <=90) {
$coords[0]=0;
$coords[1]=0;
if ($angle <=45) {
$endx=1;
$endy=tan(deg2rad($angle));
} else {
$endx=tan(deg2rad(90-$angle));
$endy=1;
}
} elseif ($angle <=180) {
$coords[0]=1;
$coords[1]=0;
if ($angle <=135) {
$endx=tan(deg2rad($angle-90));
$endy=1;
} else {
$endx=1;
$endy=tan(deg2rad(180-$angle));
}
} elseif ($angle <=270) {
$coords[0]=1;
$coords[1]=1;
if ($angle <=225) {
$endx=1;
$endy=tan(deg2rad($angle-180));
} else {
$endx=tan(deg2rad(270-$angle));
$endy=1;
}
} else {
$coords[0]=0;
$coords[1]=1;
if ($angle <=315) {
$endx=tan(deg2rad($angle-270));
$endy=1;
} else {
$endx=1;
$endy=tan(deg2rad(360-$angle));
}
}
$b = atan2(($endy*$bboxh), ($endx*$bboxw));
$h2 = $bboxh - ($bboxh * tan($b));
$px = $bboxh + ($h2 * sin($b) * cos($b));
$py = ($bboxh * tan($b)) + ($h2 * sin($b) * sin($b));
$x1 = $px / $bboxh;
$y1 = $py / $bboxh;
if ($angle <=90) {
$coords[2] = $x1;
$coords[3] = $y1;
} elseif ($angle <=180) {
$coords[2] = 1-$x1;
$coords[3] = $y1;
} elseif ($angle <=270) {
$coords[2] = 1-$x1;
$coords[3] = 1-$y1;
} else {
$coords[2] = $x1;
$coords[3] = 1-$y1;
}
}
}
// -moz If the first parameter to the gradient function is only a <point>, the gradient axis starts from the specified point,
// and ends at the point you would get if you rotated the starting point by 180 degrees about the center of the box that the
// gradient is to be applied to.
// NO angle and NO end points (Start points defined)
elseif ((!isset($angle) || $angle===false) && $coords[0]!==false && $coords[1]!==false) { // should have start and end defined
$coords[2] = 1-$coords[0];
$coords[3] = 1-$coords[1];
$angle = rad2deg(atan2($coords[3]-$coords[1], $coords[2]-$coords[0]));
if ($angle < 0) {
$angle += 360;
} elseif ($angle > 360) {
$angle -= 360;
}
if ($angle!=0 && $angle!=360 && $angle!=90 && $angle!=180 && $angle!=270) {
if ($w >= $h) {
$coords[1] *= $h/$w ;
$coords[3] *= $h/$w ;
$usew = $useh = $bboxw;
$usey -= ($w-$h);
} else {
$coords[0] *= $w/$h ;
$coords[2] *= $w/$h ;
$usew = $useh = $bboxh;
}
}
}
// -moz If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient
// axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
else { // default values T2B
// All values are set in parseMozGradient - so won't appear here
$coords = array(0,0,1,0); // default for original linear gradient (L2R)
}
$s = ' q';
$s .= sprintf(' %.3F %.3F %.3F %.3F re W n', $x*_MPDFK, ($this->mpdf->h-$y)*_MPDFK, $w*_MPDFK, -$h*_MPDFK)."\n";
$s .= sprintf(' %.3F 0 0 %.3F %.3F %.3F cm', $usew*_MPDFK, $useh*_MPDFK, $usex*_MPDFK, ($this->mpdf->h-($usey+$useh))*_MPDFK)."\n";
}
// RADIAL
elseif ($type == 3) {
$radius = $coords[4];
$angle = $coords[5]; // ?? no effect
$shape = $coords[6];
$size = $coords[7];
$repeat = $coords[8];
// ALL POINTS AND RADIUS SET (default for custom mPDF radial gradient) - no -moz
if ($coords[0]!==false && $coords[1]!==false && $coords[2]!==false && $coords[3]!==false && $coords[4]!==false) {
// do nothing - coords used as they are
}
// If a <point> is defined
elseif ($shape!==false && $size!==false) {
if ($coords[2]==false) {
$coords[2] = $coords[0];
}
if ($coords[3]==false) {
$coords[3] = $coords[1];
}
// ELLIPSE
if ($shape=='ellipse') {
$corner1 = sqrt(pow($coords[0], 2) + pow($coords[1], 2));
$corner2 = sqrt(pow($coords[0], 2) + pow((1-$coords[1]), 2));
$corner3 = sqrt(pow((1-$coords[0]), 2) + pow($coords[1], 2));
$corner4 = sqrt(pow((1-$coords[0]), 2) + pow((1-$coords[1]), 2));
if ($size=='closest-side') {
$radius = min($coords[0], $coords[1], (1-$coords[0]), (1-$coords[1]));
} elseif ($size=='closest-corner') {
$radius = min($corner1, $corner2, $corner3, $corner4);
} elseif ($size=='farthest-side') {
$radius = max($coords[0], $coords[1], (1-$coords[0]), (1-$coords[1]));
} else {
$radius = max($corner1, $corner2, $corner3, $corner4);
} // farthest corner (default)
}
// CIRCLE
elseif ($shape=='circle') {
if ($w >= $h) {
$coords[1] = $coords[3] = ($coords[1] * $h/$w) ;
$corner1 = sqrt(pow($coords[0], 2) + pow($coords[1], 2));
$corner2 = sqrt(pow($coords[0], 2) + pow((($h/$w)-$coords[1]), 2));
$corner3 = sqrt(pow((1-$coords[0]), 2) + pow($coords[1], 2));
$corner4 = sqrt(pow((1-$coords[0]), 2) + pow((($h/$w)-$coords[1]), 2));
if ($size=='closest-side') {
$radius = min($coords[0], $coords[1], (1-$coords[0]), (($h/$w)-$coords[1]));
} elseif ($size=='closest-corner') {
$radius = min($corner1, $corner2, $corner3, $corner4);
} elseif ($size=='farthest-side') {
$radius = max($coords[0], $coords[1], (1-$coords[0]), (($h/$w)-$coords[1]));
} elseif ($size=='farthest-corner') {
$radius = max($corner1, $corner2, $corner3, $corner4);
} // farthest corner (default)
$usew = $useh = $bboxw;
$usey -= ($w-$h);
} else {
$coords[0] = $coords[2] = ($coords[0] * $w/$h) ;
$corner1 = sqrt(pow($coords[0], 2) + pow($coords[1], 2));
$corner2 = sqrt(pow($coords[0], 2) + pow((1-$coords[1]), 2));
$corner3 = sqrt(pow((($w/$h)-$coords[0]), 2) + pow($coords[1], 2));
$corner4 = sqrt(pow((($w/$h)-$coords[0]), 2) + pow((1-$coords[1]), 2));
if ($size=='closest-side') {
$radius = min($coords[0], $coords[1], (($w/$h)-$coords[0]), (1-$coords[1]));
} elseif ($size=='closest-corner') {
$radius = min($corner1, $corner2, $corner3, $corner4);
} elseif ($size=='farthest-side') {
$radius = max($coords[0], $coords[1], (($w/$h)-$coords[0]), (1-$coords[1]));
} elseif ($size=='farthest-corner') {
$radius = max($corner1, $corner2, $corner3, $corner4);
} // farthest corner (default)
$usew = $useh = $bboxh;
}
}
if ($radius==0) {
$radius=0.001;
} // to prevent error
$coords[4] = $radius;
}
// -moz If entire function consists of only <stop> values
else { // default values
// All values are set in parseMozGradient - so won't appear here
$coords = array(0.5,0.5,0.5,0.5); // default for radial gradient (centred)
}
$s = ' q';
$s .= sprintf(' %.3F %.3F %.3F %.3F re W n', $x*_MPDFK, ($this->mpdf->h-$y)*_MPDFK, $w*_MPDFK, -$h*_MPDFK)."\n";
$s .= sprintf(' %.3F 0 0 %.3F %.3F %.3F cm', $usew*_MPDFK, $useh*_MPDFK, $usex*_MPDFK, ($this->mpdf->h-($usey+$useh))*_MPDFK)."\n";
}
$n = count($this->mpdf->gradients) + 1;
$this->mpdf->gradients[$n]['type'] = $type;
$this->mpdf->gradients[$n]['colorspace'] = $colorspace;
$trans = false;
$this->mpdf->gradients[$n]['is_mask'] = $is_mask;
if ($is_mask) {
$trans = true;
}
if (count($stops) == 1) {
$stops[1] = $stops[0];
}
if (!isset($stops[0]['offset'])) {
$stops[0]['offset'] = 0;
}
if (!isset($stops[(count($stops)-1)]['offset'])) {
$stops[(count($stops)-1)]['offset'] = 1;
}
// Fix stop-offsets set as absolute lengths
if ($type==2) {
$axisx = ($coords[2]-$coords[0])*$usew;
$axisy = ($coords[3]-$coords[1])*$useh;
$axis_length = sqrt(pow($axisx, 2) + pow($axisy, 2));
} else {
$axis_length = $coords[4]*$usew;
} // Absolute lengths are meaningless for an ellipse - Firefox uses Width as reference
for ($i=0;$i<count($stops);$i++) {
if (isset($stops[$i]['offset']) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $stops[$i]['offset'], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
$stops[$i]['offset'] = $tmp/$axis_length;
}
}
if (isset($stops[0]['offset']) && $stops[0]['offset']>0) {
$firststop = $stops[0];
$firststop['offset'] = 0;
array_unshift($stops, $firststop);
}
if (!$repeat && isset($stops[(count($stops)-1)]['offset']) && $stops[(count($stops)-1)]['offset']<1) {
$endstop = $stops[(count($stops)-1)];
$endstop['offset'] = 1;
$stops[] = $endstop;
}
if ($stops[0]['offset'] > $stops[(count($stops)-1)]['offset']) {
$stops[0]['offset'] = 0;
$stops[(count($stops)-1)]['offset'] = 1;
}
for ($i=0;$i<count($stops);$i++) {
// mPDF 5.3.74
if ($colorspace == 'CMYK') {
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F %.3F %.3F %.3F', (ord($stops[$i]['col']{1})/100), (ord($stops[$i]['col']{2})/100), (ord($stops[$i]['col']{3})/100), (ord($stops[$i]['col']{4})/100));
} elseif ($colorspace == 'Gray') {
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F', (ord($stops[$i]['col']{1})/255));
} else {
$this->mpdf->gradients[$n]['stops'][$i]['col'] = sprintf('%.3F %.3F %.3F', (ord($stops[$i]['col']{1})/255), (ord($stops[$i]['col']{2})/255), (ord($stops[$i]['col']{3})/255));
}
if (!isset($stops[$i]['opacity'])) {
$stops[$i]['opacity'] = 1;
} elseif ($stops[$i]['opacity'] > 1 || $stops[$i]['opacity'] < 0) {
$stops[$i]['opacity'] = 1;
} elseif ($stops[$i]['opacity'] < 1) {
$trans = true;
}
$this->mpdf->gradients[$n]['stops'][$i]['opacity'] = $stops[$i]['opacity'];
// OFFSET
if ($i>0 && $i<(count($stops)-1)) {
if (!isset($stops[$i]['offset']) || (isset($stops[$i+1]['offset']) && $stops[$i]['offset']>$stops[$i+1]['offset']) || $stops[$i]['offset']<$stops[$i-1]['offset']) {
if (isset($stops[$i-1]['offset']) && isset($stops[$i+1]['offset'])) {
$stops[$i]['offset'] = ($stops[$i-1]['offset']+$stops[$i+1]['offset'])/2;
} else {
for ($j=($i+1);$j<count($stops);$j++) {
if (isset($stops[$j]['offset'])) {
break;
}
}
$int = ($stops[$j]['offset'] - $stops[($i-1)]['offset'])/($j-$i+1);
for ($f=0;$f<($j-$i-1);$f++) {
$stops[($i+$f)]['offset'] = $stops[($i+$f-1)]['offset'] + ($int);
}
}
}
}
$this->mpdf->gradients[$n]['stops'][$i]['offset'] = $stops[$i]['offset'];
$this->mpdf->gradients[$n]['stops'][$i]['offset'] = $stops[$i]['offset'];
}
if ($repeat) {
$ns = count($this->mpdf->gradients[$n]['stops']);
$offs = array();
for ($i=0;$i<$ns;$i++) {
$offs[$i] = $this->mpdf->gradients[$n]['stops'][$i]['offset'];
}
$gp = 0;
$inside=true;
while ($inside) {
$gp++;
for ($i=0;$i<$ns;$i++) {
$this->mpdf->gradients[$n]['stops'][(($ns*$gp)+$i)] = $this->mpdf->gradients[$n]['stops'][(($ns*($gp-1))+$i)];
$tmp = $this->mpdf->gradients[$n]['stops'][(($ns*($gp-1))+($ns-1))]['offset']+$offs[$i] ;
if ($tmp < 1) {
$this->mpdf->gradients[$n]['stops'][(($ns*$gp)+$i)]['offset'] = $tmp;
} else {
$this->mpdf->gradients[$n]['stops'][(($ns*$gp)+$i)]['offset'] = 1;
$inside = false;
break(2);
}
}
}
}
if ($trans) {
$this->mpdf->gradients[$n]['trans'] = true;
$s .= ' /TGS'.$n.' gs ';
}
if (!is_array($extend) || count($extend) <1) {
$extend=array('true', 'true'); // These are supposed to be quoted - appear in PDF file as text
}
$this->mpdf->gradients[$n]['coords'] = $coords;
$this->mpdf->gradients[$n]['extend'] = $extend;
//paint the gradient
$s .= '/Sh'.$n.' sh '."\n";
//restore previous Graphic State
$s .= ' Q '."\n";
if ($return) {
return $s;
} else {
$this->mpdf->_out($s);
}
}
public function parseMozGradient($bg)
{
// background[-image]: -moz-linear-gradient(left, #c7Fdde 20%, #FF0000 );
// background[-image]: linear-gradient(left, #c7Fdde 20%, #FF0000 ); // CSS3
if (preg_match('/repeating-/', $bg)) {
$repeat = true;
} else {
$repeat = false;
}
if (preg_match('/linear-gradient\((.*)\)/', $bg, $m)) {
$g = array();
$g['type'] = 2;
$g['colorspace'] = 'RGB';
$g['extend'] = array('true','true');
$v = trim($m[1]);
// Change commas inside e.g. rgb(x,x,x)
while (preg_match('/(\([^\)]*?),/', $v)) {
$v = preg_replace('/(\([^\)]*?),/', '\\1@', $v);
}
// Remove spaces inside e.g. rgb(x, x, x)
while (preg_match('/(\([^\)]*?)[ ]/', $v)) {
$v = preg_replace('/(\([^\)]*?)[ ]/', '\\1', $v);
}
$bgr = preg_split('/\s*,\s*/', $v);
for ($i=0;$i<count($bgr);$i++) {
$bgr[$i] = preg_replace('/@/', ',', $bgr[$i]);
}
// Is first part $bgr[0] a valid point/angle?
$first = preg_split('/\s+/', trim($bgr[0]));
if (preg_match('/(left|center|right|bottom|top|deg|grad|rad)/i', $bgr[0]) && !preg_match('/(<#|rgb|rgba|hsl|hsla)/i', $bgr[0])) {
$startStops = 1;
} elseif (trim($first[(count($first)-1)]) === "0") {
$startStops = 1;
} else {
$check = $this->mpdf->ConvertColor($first[0]);
if ($check) {
$startStops = 0;
} else {
$startStops = 1;
}
}
// first part a valid point/angle?
if ($startStops == 1) { // default values
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i', $bgr[0], $m)) {
$angle = $m[1] + 0;
if (strtolower($m[2])=='deg') {
$angle = $angle;
} elseif (strtolower($m[2])=='grad') {
$angle *= (360/400);
} elseif (strtolower($m[2])=='rad') {
$angle = rad2deg($angle);
}
while ($angle < 0) {
$angle += 360;
}
$angle = ($angle % 360);
} elseif (trim($first[(count($first)-1)]) === "0") {
$angle = 0;
}
if (preg_match('/left/i', $bgr[0])) {
$startx = 0;
} elseif (preg_match('/right/i', $bgr[0])) {
$startx = 1;
}
if (preg_match('/top/i', $bgr[0])) {
$starty = 1;
} elseif (preg_match('/bottom/i', $bgr[0])) {
$starty = 0;
}
// Check for %? ?% or %%
if (preg_match('/(\d+)[%]/i', $first[0], $m)) {
$startx = $m[1]/100;
} elseif (!isset($startx) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[0], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$startx = $m[1];
}
}
if (isset($first[1]) && preg_match('/(\d+)[%]/i', $first[1], $m)) {
$starty = 1 - ($m[1]/100);
} elseif (!isset($starty) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[1], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$starty = $m[1];
}
}
if (isset($startx) && !isset($starty)) {
$starty = 0.5;
}
if (!isset($startx) && isset($starty)) {
$startx = 0.5;
}
}
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
else { // default values T2B
$starty = 1;
$startx = 0.5;
$endy = 0;
$endx = 0.5;
}
$coords = array();
if (!isset($startx)) {
$startx = false;
}
if (!isset($starty)) {
$starty = false;
}
if (!isset($endx)) {
$endx = false;
}
if (!isset($endy)) {
$endy = false;
}
if (!isset($angle)) {
$angle = false;
}
$g['coords'] = array($startx ,$starty ,$endx ,$endy, $angle, $repeat );
$g['stops'] = array();
for ($i=$startStops;$i<count($bgr);$i++) {
$stop = array();
// parse stops
$el = preg_split('/\s+/', trim($bgr[$i]));
// mPDF 5.3.74
$col = $this->mpdf->ConvertColor($el[0]);
if ($col) {
$stop['col'] = $col;
} else {
$stop['col'] = $col = $this->mpdf->ConvertColor(255);
}
if ($col{0}==1) {
$g['colorspace'] = 'Gray';
} elseif ($col{0}==4 || $col{0}==6) {
$g['colorspace'] = 'CMYK';
}
if ($col{0}==5) {
$stop['opacity'] = ord($col{4})/100;
} // transparency from rgba()
elseif ($col{0}==6) {
$stop['opacity'] = ord($col{5})/100;
} // transparency from cmyka()
elseif ($col{0}==1 && $col{2}==1) {
$stop['opacity'] = ord($col{3})/100;
} // transparency converted from rgba or cmyka()
if (isset($el[1]) && preg_match('/(\d+)[%]/', $el[1], $m)) {
$stop['offset'] = $m[1]/100;
if ($stop['offset']>1) {
unset($stop['offset']);
}
} elseif (isset($el[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $el[1], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$stop['offset'] = $m[1];
}
}
$g['stops'][] = $stop;
}
if (count($g['stops'])) {
return $g;
}
} elseif (preg_match('/radial-gradient\((.*)\)/', $bg, $m)) {
$g = array();
$g['type'] = 3;
$g['colorspace'] = 'RGB';
$g['extend'] = array('true','true');
$v = trim($m[1]);
// Change commas inside e.g. rgb(x,x,x)
while (preg_match('/(\([^\)]*?),/', $v)) {
$v = preg_replace('/(\([^\)]*?),/', '\\1@', $v);
}
// Remove spaces inside e.g. rgb(x, x, x)
while (preg_match('/(\([^\)]*?)[ ]/', $v)) {
$v = preg_replace('/(\([^\)]*?)[ ]/', '\\1', $v);
}
$bgr = preg_split('/\s*,\s*/', $v);
for ($i=0;$i<count($bgr);$i++) {
$bgr[$i] = preg_replace('/@/', ',', $bgr[$i]);
}
// Is first part $bgr[0] a valid point/angle?
$startStops = 0;
$pos_angle = false;
$shape_size = false;
$first = preg_split('/\s+/', trim($bgr[0]));
$checkCol = $this->mpdf->ConvertColor($first[0]);
if (preg_match('/(left|center|right|bottom|top|deg|grad|rad)/i', $bgr[0]) && !preg_match('/(<#|rgb|rgba|hsl|hsla)/i', $bgr[0])) {
$startStops=1;
$pos_angle = $bgr[0];
} elseif (trim($first[(count($first)-1)]) === "0") {
$startStops=1;
$pos_angle = $bgr[0];
} elseif (preg_match('/(circle|ellipse|closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i', $bgr[0])) {
$startStops=1;
$shape_size = $bgr[0];
} elseif (!$checkCol) {
$startStops=1;
$pos_angle = $bgr[0];
}
if (preg_match('/(circle|ellipse|closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i', $bgr[1])) {
$startStops=2;
$shape_size = $bgr[1];
}
// If valid point/angle?
if ($pos_angle) { // default values
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
if (preg_match('/left/i', $pos_angle)) {
$startx = 0;
} elseif (preg_match('/right/i', $pos_angle)) {
$startx = 1;
}
if (preg_match('/top/i', $pos_angle)) {
$starty = 1;
} elseif (preg_match('/bottom/i', $pos_angle)) {
$starty = 0;
}
// Check for %? ?% or %%
if (preg_match('/(\d+)[%]/i', $first[0], $m)) {
$startx = $m[1]/100;
} elseif (!isset($startx) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[0], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$startx = $m[1];
}
}
if (isset($first[1]) && preg_match('/(\d+)[%]/i', $first[1], $m)) {
$starty = 1 - ($m[1]/100);
} elseif (!isset($starty) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[1], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
if ($tmp) {
$starty = $m[1];
}
}
/*
// ?? Angle has no effect in radial gradient (does not exist in CSS3 spec.)
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i',$pos_angle,$m)) {
$angle = $m[1] + 0;
if (strtolower($m[2])=='deg') { $angle = $angle; }
else if (strtolower($m[2])=='grad') { $angle *= (360/400); }
else if (strtolower($m[2])=='rad') { $angle = rad2deg($angle); }
while($angle < 0) { $angle += 360; }
$angle = ($angle % 360);
}
*/
if (!isset($starty)) {
$starty = 0.5;
}
if (!isset($startx)) {
$startx = 0.5;
}
}
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values, the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of the box.
else { // default values Center
$starty = 0.5;
$startx = 0.5;
$endy = 0.5;
$endx = 0.5;
}
// If valid shape/size?
$shape = 'ellipse'; // default
$size = 'farthest-corner'; // default
if ($shape_size) { // default values
if (preg_match('/(circle|ellipse)/i', $shape_size, $m)) {
$shape = $m[1];
}
if (preg_match('/(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/i', $shape_size, $m)) {
$size = $m[1];
if ($size=='contain') {
$size = 'closest-side';
} elseif ($size=='cover') {
$size = 'farthest-corner';
}
}
}
$coords = array();
if (!isset($startx)) {
$startx = false;
}
if (!isset($starty)) {
$starty = false;
}
if (!isset($endx)) {
$endx = false;
}
if (!isset($endy)) {
$endy = false;
}
if (!isset($radius)) {
$radius = false;
}
if (!isset($angle)) {
$angle = 0;
}
$g['coords'] = array($startx ,$starty ,$endx ,$endy, $radius, $angle, $shape, $size, $repeat );
$g['stops'] = array();
for ($i=$startStops;$i<count($bgr);$i++) {
$stop = array();
// parse stops
$el = preg_split('/\s+/', trim($bgr[$i]));
// mPDF 5.3.74
$col = $this->mpdf->ConvertColor($el[0]);
if ($col) {
$stop['col'] = $col;
} else {
$stop['col'] = $col = $this->mpdf->ConvertColor(255);
}
if ($col{0}==1) {
$g['colorspace'] = 'Gray';
} elseif ($col{0}==4 || $col{0}==6) {
$g['colorspace'] = 'CMYK';
}
if ($col{0}==5) {
$stop['opacity'] = ord($col{4})/100;
} // transparency from rgba()
elseif ($col{0}==6) {
$stop['opacity'] = ord($col{5})/100;
} // transparency from cmyka()
elseif ($col{0}==1 && $col{2}==1) {
$stop['opacity'] = ord($col{3})/100;
} // transparency converted from rgba or cmyka()
if (isset($el[1]) && preg_match('/(\d+)[%]/', $el[1], $m)) {
$stop['offset'] = $m[1]/100;
if ($stop['offset']>1) {
unset($stop['offset']);
}
} elseif (isset($el[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $el[1], $m)) {
$tmp = $this->mpdf->ConvertSize($m[1], $this->mpdf->w, $this->mpdf->FontSize, false);
$stop['offset'] = $el[1];
}
$g['stops'][] = $stop;
}
if (count($g['stops'])) {
return $g;
}
}
return array();
}
public function parseBackgroundGradient($bg)
{
// background-gradient: linear #00FFFF #FFFF00 0 0.5 1 0.5; or
// background-gradient: radial #00FFFF #FFFF00 0.5 0.5 1 1 1.2;
$v = trim($bg);
$bgr = preg_split('/\s+/', $v);
$g = array();
if (count($bgr)> 6) {
if (strtoupper(substr($bgr[0], 0, 1)) == 'L' && count($bgr)==7) { // linear
$g['type'] = 2;
//$coords = array(0,0,1,1 ); // 0 0 1 0 or 0 1 1 1 is L 2 R; 1,1,0,1 is R2L; 1,1,1,0 is T2B; 1,0,1,1 is B2T
// Linear: $coords - array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg).
// The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
$g['coords'] = array($bgr[3], $bgr[4], $bgr[5], $bgr[6]);
} elseif (count($bgr)==8) { // radial
$g['type'] = 3;
// Radial: $coords - array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1,
// (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg).
// (fx, fy) should be inside the circle, otherwise some areas will not be defined
$g['coords'] = array($bgr[3], $bgr[4], $bgr[5], $bgr[6], $bgr[7]);
}
$g['colorspace'] = 'RGB';
// mPDF 5.3.74
$cor = $this->mpdf->ConvertColor($bgr[1]);
if ($cor{0}==1) {
$g['colorspace'] = 'Gray';
} elseif ($cor{0}==4 || $cor{0}==6) {
$g['colorspace'] = 'CMYK';
}
if ($cor) {
$g['col'] = $cor;
} else {
$g['col'] = $this->mpdf->ConvertColor(255);
}
$cor = $this->mpdf->ConvertColor($bgr[2]);
if ($cor) {
$g['col2'] = $cor;
} else {
$g['col2'] = $this->mpdf->ConvertColor(255);
}
$g['extend'] = array('true','true');
$g['stops'] = array(array('col'=>$g['col'], 'opacity'=>1, 'offset'=>0), array('col'=>$g['col2'], 'opacity'=>1, 'offset'=>1));
return $g;
}
return false;
}
}

View file

@ -1,431 +0,0 @@
<?php
class indic {
public function __construct()
{
}
public function substituteIndic($earr, $lang, $font)
{
global $voltdata;
if (!isset($voltdata[$font])) {
include_once(_MPDF_PATH.'includes/'.$font.'.volt.php');
$voltdata[$font] = $volt;
}
foreach ($earr as $eid=>$char) {
$earr[$eid] = sprintf("%04s", strtoupper(dechex($char)));
}
$vstr = "0020 ".implode(" ", $earr)." 0020";
//============================
// Common Indic Punctuation marks
// If NOT devanagari
if ($lang!='hi') {
$vstr = str_replace('0964', '007C', $vstr); // U+0964 replace with "|"
$vstr = str_replace('0965', '007C 007C', $vstr); // U+0964 replace with "|"
}
//============================
// Tamil numeral for Zero missing Added mPDF 4.2
if ($lang=='ta') {
$vstr = str_replace('0BE6', '0030', $vstr); // U+0BEB replace with "0"
}
//============================
// Re-order vowels
// DEVANAGARI vowel sign matraI[093F] before consonant
if ($lang=='hi') {
$prebasedvowels = "(093F)";
$nukta = "093C";
$halant = "094D";
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/', '\\2 \\1 '.$nukta, $vstr); // before NUKTA
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT == VIRAMA
}
// BENGALI vowels [09BF 09C7 09C8]
elseif ($lang=='bn') {
// Khanda Ta 09CE not in font -> replace with 09A4|09CD
$vstr = preg_replace('/09CE/', '09A4 09CD 200D', $vstr); // mPDF 5.3.09
// BENGALI double-part vowels [09CB 09C7 09BE][09CC 09C7 09D7]
$vstr = str_replace('09CB', '09C7 09BE', $vstr); // convert to 2 parts
$vstr = str_replace('09CC', '09C7 09D7', $vstr); // 09C7 pre-based is then shifted below
$prebasedvowels = "(09BF|09C7|09C8)";
$nukta = "09BC";
$halant = "09CD";
// mPDF 5.0.044
$bnfullcons = "0995|0996|0997|0998|0999|099A|099B|099C|099D|099F|09A0|09A1|09A2|09A3|09A4|09A5|09A6|09A7|09A8|09AA|09AB|09AC|09AD|09AE|09AF|09B0|09B2|09B6|09B7|09B8|09B9|09DC|09DD|09DF";
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/', '\\2 \\1 '.$nukta, $vstr); // before NUKTA
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
// mPDF 5.0.044
// .. and shifting left-based vowel further to the left in case 3 consonants together.
$vstr = preg_replace('/('.$bnfullcons.') '.$halant.' '.$prebasedvowels.'/', '\\2 \\1 '.$halant, $vstr);
// mPDF 5.0.044
// If left-based vowel has now been shifted to left of RA/Halant (09B0/09CD)
// Convert here to above-line form (E068) as it would get missed later
// e.g. 09B0 09CD 09AD 09C7 would be changed above =>
// e.g. 09C7 09B0 09CD 09AD. The 09B0 09CD should => E068
// ??? need to add 09BF as well (09BF|09C7|09C8)
$vstr = preg_replace('/(09C7|09C8) 09B0 09CD/', '\\1 E068', $vstr);
}
// GUJARATI pre-based vowel [0ABF]
elseif ($lang=='gu') {
$prebasedvowels = "(0ABF)";
$nukta = "0ABC";
$halant = "0ACD";
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/', '\\2 \\1 '.$nukta, $vstr); // before NUKTA
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
}
// GURMUKHI/PUNJABI pre-based vowel [0ABF]
elseif ($lang=='pa') {
$prebasedvowels = "(0A3F)";
$nukta = "0A3C";
$halant = "0A4D";
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.' '.$nukta.'/', '\\2 \\1 '.$nukta, $vstr); // before NUKTA
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$prebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
}
// TAMIL pre-based vowel [0ABF]
elseif ($lang=='ta') {
// Shrii (Shree)
$vstr = preg_replace('/0BB6 0BCD 0BB0 0BC0/', 'E04B', $vstr);
// TAMIL double-part vowels [0BCA 0BC6 0BBE][0BCB 0BC7 0BBE][0BCC 0BC6 0BD7]
$vstr = preg_replace('/0BCA/', '0BC6 0BBE', $vstr); // convert to 2 parts
$vstr = preg_replace('/0BCB/', '0BC7 0BBE', $vstr); // pre-based is then shifted below
$vstr = preg_replace('/0BCC/', '0BC6 0BD7', $vstr);
$prebasedvowels = "(0BC6|0BC7|0BC8)";
// No nukta
$halant = "0BCD"; // Doesn't seem to move most in front of halanted consonants
$vstr = preg_replace('/([A-F0-9]{4}) '.$prebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
// ? Only for special case KSS (already moved to left of 0BB7)
$vstr = preg_replace('/0B95 '.$halant.' '.$prebasedvowels.' 0BB7/', '\\1 0B95 '.$halant.' 0BB7', $vstr);
}
// ORIYA
elseif ($lang=='or') {
// ORIYA double-part vowels []
$vstr = str_replace('0B48', '0B47 0B56', $vstr); // 2-part Vowel
$vstr = str_replace('0B4B', '0B47 0B3E', $vstr); // 2-part Vowel
$vstr = str_replace('0B4C', '0B47 0B57', $vstr); // 2-part Vowel
$orprebasedvowels = "(0B47)";
// No nukta
$halant = "0B4D";
$vstr = preg_replace('/([A-F0-9]{4}) '.$orprebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$orprebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$orprebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
}
// MALAYALAM
elseif ($lang=='ml') {
// Chillus - old forms - remove ZWNJ after
// This font Volt rules recognises e.g. "Na Halant(Virama)" as ChilluN
$vstr = preg_replace('/(0D23 0D4D|0D28 0D4D|0D30 0D4D|0D32 0D4D|0D33 0D4D) 200D/', '\\1', $vstr);
// See Chillus in Unicode [http://en.wikipedia.org/wiki/Malayalam_script]
$vstr = str_replace('0D7A', '0D23 0D4D', $vstr); // [mlymChilluNn]
$vstr = str_replace('0D7B', '0D28 0D4D', $vstr); // [mlymChilluN]
$vstr = str_replace('0D7C', '0D30 0D4D', $vstr); // [mlymChilluR]
$vstr = str_replace('0D7D', '0D32 0D4D', $vstr); // [mlymChilluL]
$vstr = str_replace('0D7E', '0D33 0D4D', $vstr); // [mlymChilluLl]
/*
// Chillus - 0D7A-0D7E not in font directly, but as E005-E009
$vstr = preg_replace('/0D23 0D4D 200D/','0D7A', $vstr);
$vstr = preg_replace('/0D28 0D4D 200D/','0D7B', $vstr);
$vstr = preg_replace('/0D30 0D4D 200D/','0D7C', $vstr);
$vstr = preg_replace('/0D32 0D4D 200D/','0D7D', $vstr);
$vstr = preg_replace('/0D33 0D4D 200D/','0D7E', $vstr);
$vstr = preg_replace('/0D7F/','E004', $vstr); // [mlymChilluK]
$vstr = preg_replace('/0D7A/','E005', $vstr); // [mlymChilluNn]
$vstr = preg_replace('/0D7B/','E006', $vstr); // [mlymChilluN]
$vstr = preg_replace('/0D7C/','E007', $vstr); // [mlymChilluR]
$vstr = preg_replace('/0D7D/','E008', $vstr); // [mlymChilluL]
$vstr = preg_replace('/0D7E/','E009', $vstr); // [mlymChilluLl]
*/
// MALAYALAM double-part vowels []
$vstr = str_replace('0D4A', '0D46 0D3E', $vstr); // 2-part Vowel
$vstr = str_replace('0D4B', '0D47 0D3E', $vstr); // 2-part Vowel
$vstr = str_replace('0D4C', '0D46 0D57', $vstr); // 2-part Vowel
$mlprebasedvowels = "(0D46|0D47|0D48)";
// No nukta
$halant = "0D4D";
$vstr = preg_replace('/([A-F0-9]{4}) '.$mlprebasedvowels.'/', '\\2 \\1', $vstr); // vowel sign pre-based shift left
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$mlprebasedvowels.'/', '\\2 \\1 '.$halant, $vstr); // before CHAR HALANT
}
// TELUGU
elseif ($lang=='te') {
// TELUGU double-part vowels [0C48 -> 0C46 0C56]
$vstr = str_replace('0C48', '0C46 0C56', $vstr); // 2-part Vowel
$prebasedvowels = "(0C46)";
$abvvowels = "(0C3E|0C3F|0C40|0C46|0C47|0C4A|0C4B|0C4C|0C55)";
// No nukta
$halant = "0C4D";
$tefullforms = "0C15|0C17|0C18|0C1A|0C1B|0C1C|0C1D|0C20|0C21|0C22|0C24|0C25|0C26|0C27|0C28|0C2A|0C2B|0C2D|0C2E|0C2F|0C30|0C33|0C35|0C36|0C37|0C38|0C39|E028|E029|E02A|E02B|E078|E07A|E07B";
$vstr = preg_replace('/('.$tefullforms .') '.$halant.' ('.$tefullforms .') '.$abvvowels .'/', '\\1 \\3 '.$halant.' \\2', $vstr); // before HALANT
}
// KANNADA
elseif ($lang=='kn') {
// KANNADA double-part vowels [0CC8 -> 0CC6 0CD6]
$vstr = str_replace('0CC0', '0CBF 0CD5', $vstr); // 2-part Vowel
$vstr = str_replace('0CC7', '0CC6 0CD5', $vstr); // 2-part Vowel
$vstr = str_replace('0CC8', '0CC6 0CD6', $vstr); // 2-part Vowel AI - no glyph for single
$vstr = str_replace('0CCA', '0CC6 0CC2', $vstr); // 2-part Vowel
$vstr = str_replace('0CCB', '0CC6 0CC2 0CD5', $vstr); // 2-part Vowel
$prebasedvowels = "(0CBF|0CC6)";
$halant = "0CCD";
}
//============================
// SPECIALS
// DEVANAGARI Ra Halant Ra
if ($lang=='hi') {
$vstr = str_replace('0930 094D 0930', 'E05D 0930', $vstr); // Ra Halant Ra => halfRa FullRa
}
// GUJARATI
if ($lang=='gu') {
$vstr = str_replace('0AB0 0AC2', 'E02E', $vstr); // Ra VowelUu => SpecialForm RaUu
}
// TELUGU Ra Halant <Consonant> Halant => halfRa Halant<Consonant> Halant
if ($lang=='te') {
$vstr = preg_replace('/0C30 0C4D ([A-F0-9]{4}) 0C4D/', 'E021 0C4D \\1 0C4D', $vstr);
}
// KANNADA
// Reph at end of word becomes E0CC instead of E00B
if ($lang=='kn') {
$vstr = str_replace('0CB0 0CCD 0020', 'E0CC 0020', $vstr); // mPDF 5.3.87
}
//============================
// MAIN BIT FROM VOLT RULES
foreach ($voltdata[$font] as $rid=>$reps) {
//echo $rid . ': ' . $vstr.'<br />';
$vstr = preg_replace('/'.$reps['match'].'/', $reps['replace'], $vstr);
}
//echo $vstr.'<br />'; exit;
//============================
// SPECIALS
// KANNADA
// <Base> <BelowBase1> [<BelowBase2> ] MatraI -> <Base/MatraI ligature> <Belowbase1> etc
if ($lang=='kn') {
$matraI = "0CBF";
$knbase = preg_split('/\|/', "0C95|0C96|0C97|0C98|0C9A|0C9B|0C9C|0C9D|0CA0|0CA1|0CA2|0CA3|0CA4|0CA5|0CA6|0CA7|0CA8|0CAA|0CAB|0CAC|0CAD|0CAE|0CAF|0CB0|0CB2|0CB3|0CB5|0CB6|0CB7|0CB8|0CB9|E0A3|E07D|E07E");
$knmatraIligature = preg_split('/\|/', "E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A4|E0A1|E0A2");
$belowbase1 = "E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037|E038|E039|E03A|E03B|E03C|E03D|E03E|E03F|E040|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E081";
$belowbase2 = "E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E081";
for ($i=0; $i<count($knbase);$i++) {
$vstr = preg_replace('/'.$knbase[$i].' ('.$belowbase1.') ('.$belowbase2.') '.$matraI.'/', $knmatraIligature[$i].' \\1 \\2', $vstr);
$vstr = preg_replace('/'.$knbase[$i].' ('.$belowbase1.') '.$matraI.'/', $knmatraIligature[$i].' \\1', $vstr);
}
}
// KANNADA
// [KanTtaFull] [matraI] => [KanTtaPartial] [matraI]
if ($lang=='kn') {
$vstr = preg_replace('/0C9F '.$matraI.'/', 'E015 '.$matraI, $vstr);
}
// ORIYA
if ($lang=='or') {
// SpecialCase Ra[0B30] Halant still left before [oryaFullNnNna] => E00F
$vstr = preg_replace('/0B30 '.$halant.' E00F/', 'E00F E069', $vstr); // convert to Reph
}
//============================
// SHIFT REPH
// DEVANAGARI Shift Reph [E015]
if ($lang=='hi') {
// FIRSTLY - halfRa = E05D - Change this to Reph [E015]
$himatchhalfforms = "E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D|E07E|E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E0D3|E0D4|E0D5|E0D6|E0D7|E0D8|E0D9|E0DA|E0DB|E0DC|E0DD|E0DE|E0DF|E0E0|E0E1|E0E2|E0E3|E0E4|E0E5|E0E6|E0E7|E0E8|E0E9|E0EA|E0EB|E0EC|E0ED|E0EE|E0EF|E0F0|E0F1|E0F2|E0F3|E0F4|E0F5|E0F6|E0F7|E0F8|E0F9|E0FA|E0FB|E0FC|E0FD|E0FE|E0FF|E100|E101|E102|E103|E104|E105|E106|E107|E108|E109|E10A|E10B|E10C|E10D|E10E|E10F|E110|E111|E112|E113|E114|E115|E116|E117|E118|E119|E11A|E13D|E13E|E13F|E140|E141|E142|E143|E144|E145";
$himatchfullforms = "0915|0916|0917|0918|0919|091A|091B|091C|091D|091E|091F|0920|0921|0922|0923|0924|0925|0926|0927|0928|092A|092B|092C|092D|092E|092F|0930|0932|0933|0935|0936|0937|0938|0939|E028|E029|0958|0959|095A|E02A|E02B|E02C|E02D|095B|E02E|E02F|E030|E031|095C|095D|E032|E033|E034|E035|E036|0929|E037|095E|E038|E039|E03A|095F|0931|E03B|0934|E03C|E03D|E03E|E03F|E040|E041|E042|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF|E0B0|E0B1|E0B2|E0B3|E0B4|E0B5|E0B6|E0B7|E0B8|E0B9|E0BA|E0BB|E0BC|E0BD|E0BE|E0BF|E0C0|E0C1|E0C2|E0C3|E0C4|E0C5|E0C6|E0C7|E0C8|E0C9|E0CA|E0CB|E0CC|E0CD|E0CE|E0CF|E0D0|E0D1|E0D2|E11E|E11F|E120|E121|E122|E123|E124|E125|E126|E127|E128|E129|E12A|E12B|E12C|E12D|E12E|E12F|E130|E131|E132|E133";
$vstr = preg_replace('/E05D ('.$himatchhalfforms.'|'.$himatchfullforms.')/', 'E015 \\1', $vstr);
// Reph = E015 - Shift Right to just after end of syllable
// FullAllForms + HalfAllForms + 093E matraA
while (preg_match('/E015 ('.$himatchhalfforms.')/', $vstr)) {
$vstr = preg_replace('/E015 ('.$himatchhalfforms.')/', '\\1 E015', $vstr);
}
$vstr = preg_replace('/E015 ('.$himatchfullforms.')/', '\\1 E015', $vstr);
// Now shift it beyond post-based vowels // ??? Need to add others e.g. 0949,094A,094B,094C + presentation forms like E198
$vstr = str_replace('E015 093E', '093E E015', $vstr);
$vstr = preg_replace('/E015 (0940|E194|E195|E196|E197|E198)/', '\\1 E014', $vstr); // (Small) reph [E014] to Right of matraI
$vstr = str_replace('E015 0947', '0947 E014', $vstr); // (Small) reph [E014] to Right of matraI
}
// BENGALI Shift Reph [E068]
elseif ($lang=='bn') {
$bnfullconjuncts = "E002|E003|E004|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D|E07E|E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF|E0B0|E0B1|E0B2|E0B3|E0B4|E0B5|E0B6|E0B7|E0B8|E0B9|E0BA|E0BB|E0BC|E0BD|E0BE|E0BF|E0C0|E0C1|E0C2|E0C3|E0C4|E0C5|E0C6|E0C7|E0C8|E0C9|E0CA|E0CB|E0CC|E0CD|E0CE|E0CF|E0D0|E0D1|E0D2|E0D3|E0D4|E0D5|E0D6|E0D7|E0D8|E0D9|E0DA|E0DB|E0DC|E0DD|E0DE|E0DF|E0E0|E0E1|E0E2|E0E3|E0E4|E0E5|E0E6|E0E7|E0E8|E0E9|E0EA|E0EB|E0EC|E0ED|E0EE|E0EF|E0F0|E0F1|E0F2|E0F3|E0F4|E0F5|E0F6|E0F7|E0F8|E0F9|E0FA|E0FB|E0FC|E0FD|E0FE|E0FF|E100|E101|E102|E103|E104|E105|E106|E107|E108|E109|E10A|E10B|E10C|E10D|E10E|E10F|E110|E111|E112|E113|E114|E115|E116|E117|E118|E119|E11A|E11B|E11C|E11D|E11E|E11F|E120|E121|E122|E123|E124|E125|E126|E127|E128|E129|E12A|E12B|E12C|E12D|E12E|E12F|E130|E131|E132|E133|E134|E135|E136|E137|E138|E139|E13A|E13B|E13C|E13D|E13E|E13F|E140|E141|E142|E143|E144|E145|E146|E147|E148|E149|E14A|E14B|E14C|E14D|E14E|E14F|E150|E151|E152|E153|E154|E155|E156|E157|E158|E159|E15A|E15B|E15C|E15D|E15E|E15F|E160|E161|E162|E163|E164|E165|E166|E167|E168|E169|E16A|E16B|E16C|E16D|E16E|E16F|E170|E171|E172|E173|E174|E175|E176|E177|E178|E179|E17A|E17B|E17C|E17D|E17E|E17F|E180|E181|E182|E183|E184|E185|E186|E187|E188|E189|E18A|E18B|E18C|E18D|E18E|E18F|E190|E191|E192|E193|E194|E195|E196|E197|E198|E199|E19A";
// $bnfullcons - set above;
$vstr = preg_replace('/E068 ('.$bnfullconjuncts.'|'.$bnfullcons.')/', '\\1 E068', $vstr);
// ? Need to shift it beyond post-base vowels 09BE, 09C0, 09D7 haven't found so can't test??
$vstr = preg_replace('/E068 (09BE|09C0|09D7)/', '\\1 E068', $vstr);
}
// GUJARATI Shift Reph [E032]
elseif ($lang=='gu') {
$gufullforms = "0A95|0A96|0A97|0A98|0A99|0A9A|0A9B|0A9C|0A9D|0A9E|0A9F|0AA0|0AA1|0AA2|0AA3|0AA4|0AA5|0AA6|0AA7|0AA8|0AAA|0AAB|0AAC|0AAD|0AAE|0AAF|0AB0|0AB2|0AB3|0AB5|0AB6|0AB7|0AB8|0AB9|E002|E003|E004|E005|E006|E007|E008|E009|E00A|E00B|E00C|E00D|E00E|E00F|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D|E07E|E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5";
$vstr = preg_replace('/E032 ('.$gufullforms.')/', '\\1 E032', $vstr);
// Now shift it beyond post-based vowels // ??? Need to add others e.g. 0949,094A,094B,094C + presentation forms like E198
// ? Need to shift it beyond post-base vowels 0ABE, 0AC0 haven't found so can't test??
$vstr = preg_replace('/E032 (0ABE|0AC0)/', '\\1 E032', $vstr);
}
// TELUGU Shift Reph to LEFT [E046|E069|E077] [TelRaSmallOne] => E046 [TelRaSmallTwo] => E069 [TelRaSmallThree] => E077
elseif ($lang=='te') {
// tefullforms defined earlier
$tepartialforms = "E00D|E00E|E00F|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E07C|E07D|E07E";
$matraligs = "E07F|E080|E081|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF";
$tevowels = "0C3E|0C3F|0C40|0C46|0C47|0C56|0C4A|0C4B|0C4C"
."|0C41|0C42|0C43|0C44"; // post matras
$vstr = preg_replace('/('.$tevowels.') (E046|E069|E077)/', '\\2 \\1', $vstr);
while (preg_match('/('.$tepartialforms.') (E046|E069|E077)/', $vstr)) {
$vstr = preg_replace('/('.$tepartialforms.') (E046|E069|E077)/', '\\2 \\1', $vstr);
}
$vstr = preg_replace('/('.$tefullforms .'|'.$matraligs.') (E046|E069|E077)/', '\\2 \\1', $vstr);
}
// KANNADA Shift Reph to RIGHT [E00B]
elseif ($lang=='kn') {
$knfullforms = "0C95|0C96|0C97|0C98|0C99|0C9A|0C9B|0C9C|0C9D|0C9E|0C9F|0CA0|0CA1|0CA2|0CA3|0CA4|0CA5|0CA6|0CA7|0CA8|0CAA|0CAB|0CAC|0CAD|0CAE|0CAF|0CB0|0CB1|0CB2|0CB3|0CB5|0CB6|0CB7|0CB8|0CB9|E07D|E07E|E0A3";
$knpartialforms = "E00C|E00D|E00E|E00F|E010|E011|E012|E013|E014|0C9E|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E028|E029|E02A|E02B|E02C|E02D|E07F";
while (preg_match('/E00B ('.$knpartialforms.')/', $vstr)) {
$vstr = preg_replace('/E00B ('.$knpartialforms.')/', '\\1 E00B', $vstr);
}
// mPDF 5.3.47 Also move Reph to right of matraIligatures
$knfullforms .= "|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A4|E0A1|E0A2";
$vstr = preg_replace('/E00B ('.$knfullforms.')/', '\\1 E00B', $vstr);
// ? Need to shift it beyond base or below-base forms - haven't found so can't test??
// mPDF 5.3.87
// E004 added to list (which is a transformed version of 0CBE)
$knvowels = "0CBE|0CC0|0CC1|0CC2|0CC3|0CC4|0CC7|0CC8|0CCA|0CCB|0CD5|0CD6|E004";
$vstr = preg_replace('/E00B ('.$knvowels.')/', '\\1 E00B', $vstr);
}
// ORIYA Shift Reph to RIGHT [E069|E06A|E06B|E06C]
elseif ($lang=='or') {
$orrephs = "E069|E06A|E06B|E06C";
$orfullforms = "0B15|0B16|0B17|0B18|0B19|0B1A|0B1B|0B1C|0B1D|0B1E|0B1F|0B20|0B21|0B22|0B23|0B24|0B25|0B26|0B27|0B28|0B29|0B2A|0B2B|0B2C|0B2D|0B2E|0B2F|0B30|0B31|0B32|0B33|0B34|0B35|0B36|0B37|0B38|E003|E004|E005|E006|E007|E008|E009|E00A|E00B|E00C|E00D|E00E|E00F|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E028|E029|E02A|E02B|E02C|E02D|E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037";
// E123 - E147 FullHalant forms ? add to FullForms
$orpartialforms = "E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB|E0AC|E0AD|E0AE|E0AF|E0B0|E0B1|E0B2|E0B3|E0B4|E0B5|E0B6|E0B7|E0B8|E0B9|E0BA|E0BB|E0BC|E0BD|E0BE|E0BF|E0C0|E0C1|E0C2|E0C3|E0C4|E0C5|E0C6|E0C7|E0C8|E0C9|E0CA|E0CB|E0CC|E0CD|E0CE|E0CF|E0D0|E0D1|E0D2|E0D3|E0D4|E0D5|E0D6|E0D7|E0D8|E0D9|E0DA|E0DB|E0DC|E0DD|E0DE|E0DF|E0E0|E0E1|E0E2|E0E3|E0E4|E0E5|E0E6|E0E7|E0E8|E0E9|E0EA|E0EB|E0EC|E0ED|E0EE|E0EF|E0F0|E0F1|E0F2|E0F3|E0F4|E0F5";
// Combined MatraIReph[E06D] split [0B3F & E069] to allow reph to be shifted forwards
$vstr = preg_replace('/('.$orfullforms.') E06D ('.$orfullforms.') 0B3E/', '\\1 0B3F E069 \\2 0B3E', $vstr);
while (preg_match('/('.$orrephs.') ('.$orpartialforms.')/', $vstr)) {
$vstr = preg_replace('/('.$orrephs.') ('.$orpartialforms.')/', '\\2 \\1', $vstr);
}
$vstr = preg_replace('/('.$orrephs.') ('.$orfullforms.')/', '\\2 \\1', $vstr);
// Combine Reph and MatraI
$vstr = str_replace('E069 0B3F', 'E06D', $vstr); // Reph and MatraI -> MatraIReph
$vstr = str_replace('E06A 0B3F', 'E06E', $vstr); // Reph and MatraI -> MatraIReph
$vstr = str_replace('E06B 0B3F', 'E06F', $vstr); // Reph and MatraI -> MatraIReph
}
// MALAYALAM Shift Reph to LEFT [E00E] (mlylmRaVattu)
elseif ($lang=='ml') {
$halant = "0D4D";
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' 0D30/', 'E00E \\1', $vstr); // 0D30 = Ra
$vstr = preg_replace('/([A-F0-9]{4}) '.$halant.' '.$mlprebasedvowels .' 0D30/', '\\2 E00E \\1', $vstr); // 0D30 = Ra
$mlfullforms = "0D15|0D16|0D17|0D18|0D19|0D1A|0D1B|0D1C|0D1D|0D1E|0D1F|0D20|0D21|0D22|0D23|0D24|0D25|0D26|0D27|0D28|0D2A|0D2B|0D2C|0D2D|0D2E|0D2F|0D30|0D31|0D32|0D33|0D34|0D35|0D36|0D37|0D38|0D39"
."|E010|E011|E012|E013|E014|E015|E016|E017|E018|E019|E01A|E01B|E01C|E01D|E01E|E01F|E020|E021|E022|E023|E024|E025|E026|E027|E028|E029|E02A|E02B|E02C|E02D|E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037|E038|E039|E03A|E03B|E03C|E03D|E03E|E03F|E040|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E|E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071|E072|E073|E074|E075|E076|E077|E078|E079|E07A|E07B|E07C|E07D";
// = FullConsonants + FullConjuncts
// = Add Chillu characters // mPDF 5.0.024
$mlfullforms .= "|E004|E005|E006|E007|E008|E009";
while (preg_match('/('.$mlfullforms.') E00E/', $vstr)) {
$vstr = preg_replace('/('.$mlfullforms.') E00E/', 'E00E \\1', $vstr);
}
}
//============================
// SHIFT post-based vowels to Left of SmallForms (NOT to left of full forms)
// TELUGU Shift
if ($lang=='te') {
// NB $tevowels defined above
// NB $tefullforms defined above
$tebelowbase1 = "E02C|E02D|E02E|E02F|E030|E031|E032|E033|E034|E035|E036|E037|E038|E039|E03A|E03B|E03C|E03D|E03E|E03F|E040|E041|E042|E043|E044|E045|E046|E047|E048|E049|E04A|E04B|E04C|E04D|E04E"; //'Small1KaToHa'
$tebelowbase2 = "E04F|E050|E051|E052|E053|E054|E055|E056|E057|E058|E059|E05A|E05B|E05C|E05D|E05E|E05F|E060|E061|E062|E063|E064|E065|E066|E067|E068|E069|E06A|E06B|E06C|E06D|E06E|E06F|E070|E071"; // 'Small2KaToHa'
$vstr = preg_replace('/('.$tebelowbase2.') ('.$tevowels.')/', '\\2 \\1', $vstr);
$vstr = preg_replace('/('.$tebelowbase1.') ('.$tevowels.')/', '\\2 \\1', $vstr);
}
// KANNADA Shift
elseif ($lang=='kn') {
$knvowels = "0CBE|0CC0|0CC1|0CC2|0CC3|0CC4|0CC7|0CC8|0CCA|0CCB|0CD5|0CD6"
// mPDF 5.3.87 Shouldn't swop E082 and E047 (belowbase1) below
// E082 is a matraIligature
// ."|E082|E083|E084|E085|E086|E087|E088|E089|E08A|E08B|E08C|E08D|E08E|E08F|E090|E091|E092|E093|E094|E095|E096|E097|E098|E099|E09A|E09B|E09C|E09D|E09E|E09F|E0A0|E0A1|E0A2|E0A3|E0A4|E0A5|E0A6|E0A7|E0A8|E0A9|E0AA|E0AB"
."|E004|E007|E008|E009|E00A";
// NB $knvowels defined above
// NB $fullforms defined above
// $belowbase1/2 defined above
$vstr = preg_replace('/('.$belowbase2.') ('.$knvowels.')/', '\\2 \\1', $vstr);
// mPDF 5.3.87
$vstr = preg_replace('/('.$belowbase1.') ('.$knvowels.')/', '\\2 \\1', $vstr);
//$vstr = preg_replace('/('.$fullforms.') ('.$knvowels.')/', '\\2 \\1', $vstr);
}
//============================
// Clear unwanted ZWJ, ZWNJ
// MALAYALAM
if ($lang=='ml') {
$vstr = preg_replace('/(200C|200D) /', '', $vstr);
}
//============================
// END & PUT IT BACK TOGETHER
$vstr = preg_replace('/^0020 (.*) 0020$/', '\\1', $vstr);
$varr = explode(" ", $vstr);
$e = '';
foreach ($varr as $v) {
$e.=code2utf(hexdec($v));
}
//============================
return $e;
}
}

View file

@ -1,228 +0,0 @@
<?php
class meter
{
public function __construct()
{
}
public function makeSVG($tag, $type, $value, $max, $min, $optimum, $low, $high)
{
$svg = '';
if ($tag == 'meter') {
if ($type=='2') {
/////////////////////////////////////////////////////////////////////////////////////
///////// CUSTOM <meter type="2">
/////////////////////////////////////////////////////////////////////////////////////
$h = 10;
$w = 160;
$border_radius = 0.143; // Factor of Height
$svg = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
<defs>
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
</linearGradient>
</defs>
';
$svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="#f4f4f4" stroke="none" />';
// LOW to HIGH region
//if ($low && $high && ($low != $min || $high != $max)) {
if ($low && $high) {
$barx = (($low-$min) / ($max-$min)) * $w;
$barw = (($high-$low) / ($max-$min)) * $w;
$svg .= '<rect x="'.$barx.'" y="0" width="'.$barw.'" height="'.$h.'" fill="url(#GrGRAY)" stroke="#888888" stroke-width="0.5px" />';
}
// OPTIMUM Marker (? AVERAGE)
if ($optimum) {
$barx = (($optimum-$min) / ($max-$min)) * $w;
$barw = $h/2;
$barcol = '#888888';
$svg .= '<rect x="'.$barx.'" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />';
}
// VALUE Marker
if ($value) {
if ($min != $low && $value < $low) {
$col = 'orange';
} elseif ($max != $high && $value > $high) {
$col = 'orange';
} else {
$col = '#008800';
}
$cx = (($value-$min) / ($max-$min)) * $w;
$cy = $h/2;
$rx = $h/3.5;
$ry = $h/2.2;
$svg .= '<ellipse fill="'.$col.'" stroke="#000000" stroke-width="0.5px" cx="'.$cx.'" cy="'.$cy.'" rx="'.$rx.'" ry="'.$ry.'"/>';
}
// BoRDER
$svg .= '<rect x="0" y="0" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
$svg .= '</g></svg>';
} else {
/////////////////////////////////////////////////////////////////////////////////////
///////// DEFAULT <meter>
/////////////////////////////////////////////////////////////////////////////////////
$h = 10;
$w = 50;
$border_radius = 0.143; // Factor of Height
$svg = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
<defs>
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
</linearGradient>
<linearGradient id="GrRED" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(255, 162, 162)" />
<stop offset="20%" stop-color="rgb(255, 218, 218)" />
<stop offset="25%" stop-color="rgb(255, 218, 218)" />
<stop offset="100%" stop-color="rgb(255, 0, 0)" />
</linearGradient>
<linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(102, 230, 102)" />
<stop offset="20%" stop-color="rgb(218, 255, 218)" />
<stop offset="25%" stop-color="rgb(218, 255, 218)" />
<stop offset="100%" stop-color="rgb(0, 148, 0)" />
</linearGradient>
<linearGradient id="GrBLUE" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(102, 102, 230)" />
<stop offset="20%" stop-color="rgb(238, 238, 238)" />
<stop offset="25%" stop-color="rgb(238, 238, 238)" />
<stop offset="100%" stop-color="rgb(0, 0, 128)" />
</linearGradient>
<linearGradient id="GrORANGE" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(255, 186, 0)" />
<stop offset="20%" stop-color="rgb(255, 238, 168)" />
<stop offset="25%" stop-color="rgb(255, 238, 168)" />
<stop offset="100%" stop-color="rgb(255, 155, 0)" />
</linearGradient>
</defs>
<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="url(#GrGRAY)" stroke="none" />
';
if ($value) {
$barw = (($value-$min) / ($max-$min)) * $w;
if ($optimum < $low) {
if ($value < $low) {
$barcol = 'url(#GrGREEN)';
} elseif ($value > $high) {
$barcol = 'url(#GrRED)';
} else {
$barcol = 'url(#GrORANGE)';
}
} elseif ($optimum > $high) {
if ($value < $low) {
$barcol = 'url(#GrRED)';
} elseif ($value > $high) {
$barcol = 'url(#GrGREEN)';
} else {
$barcol = 'url(#GrORANGE)';
}
} else {
if ($value < $low) {
$barcol = 'url(#GrORANGE)';
} elseif ($value > $high) {
$barcol = 'url(#GrORANGE)';
} else {
$barcol = 'url(#GrGREEN)';
}
}
$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />';
}
// Borders
//$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
if ($value) {
// $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
}
$svg .= '</g></svg>';
}
} else { // $tag == 'progress'
if ($type=='2') {
/////////////////////////////////////////////////////////////////////////////////////
///////// CUSTOM <progress type="2">
/////////////////////////////////////////////////////////////////////////////////////
} else {
/////////////////////////////////////////////////////////////////////////////////////
///////// DEFAULT <progress>
/////////////////////////////////////////////////////////////////////////////////////
$h = 10;
$w = 100;
$border_radius = 0.143; // Factor of Height
if ($value or $value==='0') {
$fill = 'url(#GrGRAY)';
} else {
$fill = '#f8f8f8';
}
$svg = '<svg width="'.$w.'px" height="'.$h.'px" viewBox="0 0 '.$w.' '.$h.'"><g>
<defs>
<linearGradient id="GrGRAY" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(222, 222, 222)" />
<stop offset="20%" stop-color="rgb(232, 232, 232)" />
<stop offset="25%" stop-color="rgb(232, 232, 232)" />
<stop offset="100%" stop-color="rgb(182, 182, 182)" />
</linearGradient>
<linearGradient id="GrGREEN" x1="0" y1="0" x2="0" y2="1" gradientUnits="boundingBox">
<stop offset="0%" stop-color="rgb(102, 230, 102)" />
<stop offset="20%" stop-color="rgb(218, 255, 218)" />
<stop offset="25%" stop-color="rgb(218, 255, 218)" />
<stop offset="100%" stop-color="rgb(0, 148, 0)" />
</linearGradient>
</defs>
<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="'.$fill.'" stroke="none" />
';
if ($value) {
$barw = (($value-$min) / ($max-$min)) * $w;
$barcol = 'url(#GrGREEN)';
$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="'.$barcol.'" stroke="none" />';
}
// Borders
$svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$w.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
if ($value) {
// $svg .= '<rect x="0" y="0" rx="'.($h*$border_radius).'px" ry="'.($h*$border_radius).'px" width="'.$barw.'" height="'.$h.'" fill="none" stroke="#888888" stroke-width="0.5px" />';
}
$svg .= '</g></svg>';
}
}
return $svg;
}
} // end of class

File diff suppressed because it is too large Load diff

View file

@ -1,689 +0,0 @@
<?php
class tocontents
{
public $mpdf = null;
public $_toc;
public $TOCmark;
public $TOCoutdent; // mPDF 5.6.31
public $TOCpreHTML;
public $TOCpostHTML;
public $TOCbookmarkText;
public $TOCusePaging;
public $TOCuseLinking;
public $TOCorientation;
public $TOC_margin_left;
public $TOC_margin_right;
public $TOC_margin_top;
public $TOC_margin_bottom;
public $TOC_margin_header;
public $TOC_margin_footer;
public $TOC_odd_header_name;
public $TOC_even_header_name;
public $TOC_odd_footer_name;
public $TOC_even_footer_name;
public $TOC_odd_header_value;
public $TOC_even_header_value;
public $TOC_odd_footer_value;
public $TOC_even_footer_value;
public $TOC_page_selector;
public $m_TOC;
public function __construct(&$mpdf)
{
$this->mpdf = $mpdf;
$this->_toc = array();
$this->TOCmark = 0;
$this->m_TOC = array();
}
public function TOCpagebreak($tocfont='', $tocfontsize='', $tocindent='', $TOCusePaging=true, $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=0, $toc_ehvalue=0, $toc_ofvalue=0, $toc_efvalue=0, $toc_preHTML='', $toc_postHTML='', $toc_bookmarkText='', $resetpagenum='', $pagenumstyle='', $suppress='', $orientation='', $mgl='', $mgr='', $mgt='', $mgb='', $mgh='', $mgf='', $ohname='', $ehname='', $ofname='', $efname='', $ohvalue=0, $ehvalue=0, $ofvalue=0, $efvalue=0, $toc_id=0, $pagesel='', $toc_pagesel='', $sheetsize='', $toc_sheetsize='', $tocoutdent='')
{ // mPDF 5.6.19
if (strtoupper($toc_id)=='ALL') {
$toc_id = '_mpdf_all';
} elseif (!$toc_id) {
$toc_id = 0;
} else {
$toc_id = strtolower($toc_id);
}
if ($TOCusePaging === false || strtolower($TOCusePaging) == "off" || $TOCusePaging === 0 || $TOCusePaging === "0" || $TOCusePaging === "") {
$TOCusePaging = false;
} else {
$TOCusePaging = true;
}
if (!$TOCuseLinking) {
$TOCuseLinking = false;
}
if ($toc_id) {
$this->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page;
$this->m_TOC[$toc_id]['TOCoutdent'] = $tocoutdent;
$this->m_TOC[$toc_id]['TOCorientation'] = $toc_orientation;
$this->m_TOC[$toc_id]['TOCuseLinking'] = $TOCuseLinking;
$this->m_TOC[$toc_id]['TOCusePaging'] = $TOCusePaging;
if ($toc_preHTML) {
$this->m_TOC[$toc_id]['TOCpreHTML'] = $toc_preHTML;
}
if ($toc_postHTML) {
$this->m_TOC[$toc_id]['TOCpostHTML'] = $toc_postHTML;
}
if ($toc_bookmarkText) {
$this->m_TOC[$toc_id]['TOCbookmarkText'] = $toc_bookmarkText;
}
$this->m_TOC[$toc_id]['TOC_margin_left'] = $toc_mgl;
$this->m_TOC[$toc_id]['TOC_margin_right'] = $toc_mgr;
$this->m_TOC[$toc_id]['TOC_margin_top'] = $toc_mgt;
$this->m_TOC[$toc_id]['TOC_margin_bottom'] = $toc_mgb;
$this->m_TOC[$toc_id]['TOC_margin_header'] = $toc_mgh;
$this->m_TOC[$toc_id]['TOC_margin_footer'] = $toc_mgf;
$this->m_TOC[$toc_id]['TOC_odd_header_name'] = $toc_ohname;
$this->m_TOC[$toc_id]['TOC_even_header_name'] = $toc_ehname;
$this->m_TOC[$toc_id]['TOC_odd_footer_name'] = $toc_ofname;
$this->m_TOC[$toc_id]['TOC_even_footer_name'] = $toc_efname;
$this->m_TOC[$toc_id]['TOC_odd_header_value'] = $toc_ohvalue;
$this->m_TOC[$toc_id]['TOC_even_header_value'] = $toc_ehvalue;
$this->m_TOC[$toc_id]['TOC_odd_footer_value'] = $toc_ofvalue;
$this->m_TOC[$toc_id]['TOC_even_footer_value'] = $toc_efvalue;
$this->m_TOC[$toc_id]['TOC_page_selector'] = $toc_pagesel;
$this->m_TOC[$toc_id]['TOCsheetsize'] = $toc_sheetsize;
} else {
$this->TOCmark = $this->mpdf->page;
$this->TOCoutdent = $tocoutdent;
$this->TOCorientation = $toc_orientation;
$this->TOCuseLinking = $TOCuseLinking;
$this->TOCusePaging = $TOCusePaging;
if ($toc_preHTML) {
$this->TOCpreHTML = $toc_preHTML;
}
if ($toc_postHTML) {
$this->TOCpostHTML = $toc_postHTML;
}
if ($toc_bookmarkText) {
$this->TOCbookmarkText = $toc_bookmarkText;
}
$this->TOC_margin_left = $toc_mgl;
$this->TOC_margin_right = $toc_mgr;
$this->TOC_margin_top = $toc_mgt;
$this->TOC_margin_bottom = $toc_mgb;
$this->TOC_margin_header = $toc_mgh;
$this->TOC_margin_footer = $toc_mgf;
$this->TOC_odd_header_name = $toc_ohname;
$this->TOC_even_header_name = $toc_ehname;
$this->TOC_odd_footer_name = $toc_ofname;
$this->TOC_even_footer_name = $toc_efname;
$this->TOC_odd_header_value = $toc_ohvalue;
$this->TOC_even_header_value = $toc_ehvalue;
$this->TOC_odd_footer_value = $toc_ofvalue;
$this->TOC_even_footer_value = $toc_efvalue;
$this->TOC_page_selector = $toc_pagesel;
$this->TOCsheetsize = $toc_sheetsize;
}
}
// Initiate, and Mark a place for the Table of Contents to be inserted
public function TOC($tocfont='', $tocfontsize=0, $tocindent=0, $resetpagenum='', $pagenumstyle='', $suppress='', $toc_orientation='', $TOCusePaging=true, $TOCuseLinking=false, $toc_id=0, $tocoutdent='')
{ // mPDF 5.6.19) {
if (strtoupper($toc_id)=='ALL') {
$toc_id = '_mpdf_all';
} elseif (!$toc_id) {
$toc_id = 0;
} else {
$toc_id = strtolower($toc_id);
}
// To use odd and even pages
// Cannot start table of contents on an even page
if (($this->mpdf->mirrorMargins) && (($this->mpdf->page)%2==0)) { // EVEN
if ($this->mpdf->ColActive) {
if (count($this->mpdf->columnbuffer)) {
$this->mpdf->printcolumnbuffer();
}
}
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', $resetpagenum, $pagenumstyle, $suppress);
} else {
$this->mpdf->PageNumSubstitutions[] = array('from'=>$this->mpdf->page, 'reset'=> $resetpagenum, 'type'=>$pagenumstyle, 'suppress'=>$suppress);
}
if ($toc_id) {
$this->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page;
$this->m_TOC[$toc_id]['TOCoutdent'] = $tocoutdent;
$this->m_TOC[$toc_id]['TOCorientation'] = $toc_orientation;
$this->m_TOC[$toc_id]['TOCuseLinking'] = $TOCuseLinking;
$this->m_TOC[$toc_id]['TOCusePaging'] = $TOCusePaging;
} else {
$this->TOCmark = $this->mpdf->page;
$this->TOCoutdent = $tocoutdent;
$this->TOCorientation = $toc_orientation;
$this->TOCuseLinking = $TOCuseLinking;
$this->TOCusePaging = $TOCusePaging;
}
}
public function insertTOC()
{
$notocs = 0;
if ($this->TOCmark) {
$notocs = 1;
}
$notocs += count($this->m_TOC);
if ($notocs==0) {
return;
}
if (count($this->m_TOC)) {
reset($this->m_TOC);
}
$added_toc_pages = 0;
if ($this->mpdf->ColActive) {
$this->mpdf->SetColumns(0);
}
if (($this->mpdf->mirrorMargins) && (($this->mpdf->page)%2==1)) { // ODD
$this->mpdf->AddPage($this->mpdf->CurOrientation);
$extrapage = true;
} else {
$extrapage = false;
}
for ($toci = 0; $toci<$notocs; $toci++) {
if ($toci==0 && $this->TOCmark) {
$toc_id = 0;
$toc_page = $this->TOCmark;
$tocoutdent = $this->TOCoutdent;
$toc_orientation = $this->TOCorientation;
$TOCuseLinking = $this->TOCuseLinking;
$TOCusePaging = $this->TOCusePaging;
$toc_preHTML = $this->TOCpreHTML;
$toc_postHTML = $this->TOCpostHTML;
$toc_bookmarkText = $this->TOCbookmarkText;
$toc_mgl = $this->TOC_margin_left;
$toc_mgr = $this->TOC_margin_right;
$toc_mgt = $this->TOC_margin_top;
$toc_mgb = $this->TOC_margin_bottom;
$toc_mgh = $this->TOC_margin_header;
$toc_mgf = $this->TOC_margin_footer;
$toc_ohname = $this->TOC_odd_header_name;
$toc_ehname = $this->TOC_even_header_name;
$toc_ofname = $this->TOC_odd_footer_name;
$toc_efname = $this->TOC_even_footer_name;
$toc_ohvalue = $this->TOC_odd_header_value;
$toc_ehvalue = $this->TOC_even_header_value;
$toc_ofvalue = $this->TOC_odd_footer_value;
$toc_efvalue = $this->TOC_even_footer_value;
$toc_page_selector = $this->TOC_page_selector;
$toc_sheet_size = $this->TOCsheetsize;
} else {
$arr = current($this->m_TOC);
$toc_id = key($this->m_TOC);
$toc_page = $this->m_TOC[$toc_id]['TOCmark'];
$tocoutdent = $this->m_TOC[$toc_id]['TOCoutdent'];
$toc_orientation = $this->m_TOC[$toc_id]['TOCorientation'];
$TOCuseLinking = $this->m_TOC[$toc_id]['TOCuseLinking'];
$TOCusePaging = $this->m_TOC[$toc_id]['TOCusePaging'];
if (isset($this->m_TOC[$toc_id]['TOCpreHTML'])) {
$toc_preHTML = $this->m_TOC[$toc_id]['TOCpreHTML'];
} else {
$toc_preHTML = '';
}
if (isset($this->m_TOC[$toc_id]['TOCpostHTML'])) {
$toc_postHTML = $this->m_TOC[$toc_id]['TOCpostHTML'];
} else {
$toc_postHTML = '';
}
if (isset($this->m_TOC[$toc_id]['TOCbookmarkText'])) {
$toc_bookmarkText = $this->m_TOC[$toc_id]['TOCbookmarkText'];
} else {
$toc_bookmarkText = '';
} // *BOOKMARKS*
$toc_mgl = $this->m_TOC[$toc_id]['TOC_margin_left'];
$toc_mgr = $this->m_TOC[$toc_id]['TOC_margin_right'];
$toc_mgt = $this->m_TOC[$toc_id]['TOC_margin_top'];
$toc_mgb = $this->m_TOC[$toc_id]['TOC_margin_bottom'];
$toc_mgh = $this->m_TOC[$toc_id]['TOC_margin_header'];
$toc_mgf = $this->m_TOC[$toc_id]['TOC_margin_footer'];
$toc_ohname = $this->m_TOC[$toc_id]['TOC_odd_header_name'];
$toc_ehname = $this->m_TOC[$toc_id]['TOC_even_header_name'];
$toc_ofname = $this->m_TOC[$toc_id]['TOC_odd_footer_name'];
$toc_efname = $this->m_TOC[$toc_id]['TOC_even_footer_name'];
$toc_ohvalue = $this->m_TOC[$toc_id]['TOC_odd_header_value'];
$toc_ehvalue = $this->m_TOC[$toc_id]['TOC_even_header_value'];
$toc_ofvalue = $this->m_TOC[$toc_id]['TOC_odd_footer_value'];
$toc_efvalue = $this->m_TOC[$toc_id]['TOC_even_footer_value'];
$toc_page_selector = $this->m_TOC[$toc_id]['TOC_page_selector'];
$toc_sheet_size = $this->m_TOC[$toc_id]['TOCsheetsize'];
next($this->m_TOC);
}
// mPDF 5.6.31
if (!$toc_orientation) {
$toc_orientation= $this->mpdf->DefOrientation;
}
$this->mpdf->AddPage($toc_orientation, '', '', '', "on", $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);
$this->mpdf->writingToC = true; // mPDF 5.6.38
// mPDF 5.6.31
$tocstart=count($this->mpdf->pages);
if ($toc_preHTML) {
$this->mpdf->WriteHTML($toc_preHTML);
}
// mPDF 5.6.19
$html ='<div class="mpdf_toc" id="mpdf_toc_'.$toc_id.'">';
foreach ($this->_toc as $t) {
if ($t['toc_id']==='_mpdf_all' || $t['toc_id']===$toc_id) {
$html .= '<div class="mpdf_toc_level_'.$t['l'].'">';
if ($TOCuseLinking) {
$html .= '<a class="mpdf_toc_a" href="#__mpdfinternallink_'.$t['link'].'">';
}
$html .= '<span class="mpdf_toc_t_level_'.$t['l'].'">'.$t['t'].'</span>';
if ($TOCuseLinking) {
$html .= '</a>';
}
if (!$tocoutdent) {
$tocoutdent = '0';
}
if ($TOCusePaging) {
$html .= ' <dottab outdent="'.$tocoutdent.'" /> ';
if ($TOCuseLinking) {
$html .= '<a class="mpdf_toc_a" href="#__mpdfinternallink_'.$t['link'].'">';
}
$html .= '<span class="mpdf_toc_p_level_'.$t['l'].'">'.$this->mpdf->docPageNum($t['p']).'</span>';
if ($TOCuseLinking) {
$html .= '</a>';
}
}
$html .= '</div>';
}
}
$html .= '</div>';
$this->mpdf->WriteHTML($html);
if ($toc_postHTML) {
$this->mpdf->WriteHTML($toc_postHTML);
}
$this->mpdf->writingToC = false; // mPDF 5.6.38
$this->mpdf->AddPage($toc_orientation, 'E');
$n_toc = $this->mpdf->page - $tocstart + 1;
if ($toci==0 && $this->TOCmark) {
$TOC_start = $tocstart ;
$TOC_end = $this->mpdf->page;
$TOC_npages = $n_toc;
} else {
$this->m_TOC[$toc_id]['start'] = $tocstart ;
$this->m_TOC[$toc_id]['end'] = $this->mpdf->page;
$this->m_TOC[$toc_id]['npages'] = $n_toc;
}
}
$s = '';
$s .= $this->mpdf->PrintBodyBackgrounds();
$s .= $this->mpdf->PrintPageBackgrounds();
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', "\n".$s."\n".'\\1', $this->mpdf->pages[$this->mpdf->page]);
$this->mpdf->pageBackgrounds = array();
//Page footer
$this->mpdf->InFooter=true;
$this->mpdf->Footer();
$this->mpdf->InFooter=false;
// 2nd time through to move pages etc.
$added_toc_pages = 0;
if (count($this->m_TOC)) {
reset($this->m_TOC);
}
for ($toci = 0; $toci<$notocs; $toci++) {
if ($toci==0 && $this->TOCmark) {
$toc_id = 0;
$toc_page = $this->TOCmark + $added_toc_pages;
$toc_orientation = $this->TOCorientation;
$TOCuseLinking = $this->TOCuseLinking;
$TOCusePaging = $this->TOCusePaging;
$toc_bookmarkText = $this->TOCbookmarkText; // *BOOKMARKS*
$tocstart = $TOC_start ;
$tocend = $n = $TOC_end;
$n_toc = $TOC_npages;
} else {
$arr = current($this->m_TOC);
$toc_id = key($this->m_TOC);
$toc_page = $this->m_TOC[$toc_id]['TOCmark'] + $added_toc_pages;
$toc_orientation = $this->m_TOC[$toc_id]['TOCorientation'];
$TOCuseLinking = $this->m_TOC[$toc_id]['TOCuseLinking'];
$TOCusePaging = $this->m_TOC[$toc_id]['TOCusePaging'];
$toc_bookmarkText = $this->m_TOC[$toc_id]['TOCbookmarkText']; // *BOOKMARKS*
$tocstart = $this->m_TOC[$toc_id]['start'] ;
$tocend = $n = $this->m_TOC[$toc_id]['end'] ;
$n_toc = $this->m_TOC[$toc_id]['npages'] ;
next($this->m_TOC);
}
// Now pages moved
$added_toc_pages += $n_toc;
$this->mpdf->MovePages($toc_page, $tocstart, $tocend) ;
$this->mpdf->pgsIns[$toc_page] = $tocend - $tocstart + 1;
/*-- BOOKMARKS --*/
// Insert new Bookmark for Bookmark
if ($toc_bookmarkText) {
$insert = -1;
foreach ($this->mpdf->BMoutlines as $i=>$o) {
if ($o['p']<$toc_page) { // i.e. before point of insertion
$insert = $i;
}
}
$txt = $this->mpdf->purify_utf8_text($toc_bookmarkText);
if ($this->mpdf->text_input_as_HTML) {
$txt = $this->mpdf->all_entities_to_utf8($txt);
}
$newBookmark[0] = array('t'=>$txt,'l'=>0,'y'=>0,'p'=>$toc_page );
array_splice($this->mpdf->BMoutlines, ($insert+1), 0, $newBookmark);
}
/*-- END BOOKMARKS --*/
}
// Delete empty page that was inserted earlier
if ($extrapage) {
unset($this->mpdf->pages[count($this->mpdf->pages)]);
$this->mpdf->page--; // Reset page pointer
}
}
public function openTagTOC($attr)
{
if (isset($attr['OUTDENT']) && $attr['OUTDENT']) {
$tocoutdent = $attr['OUTDENT'];
} else {
$tocoutdent = '';
} // mPDF 5.6.19
if (isset($attr['RESETPAGENUM']) && $attr['RESETPAGENUM']) {
$resetpagenum = $attr['RESETPAGENUM'];
} else {
$resetpagenum = '';
}
if (isset($attr['PAGENUMSTYLE']) && $attr['PAGENUMSTYLE']) {
$pagenumstyle = $attr['PAGENUMSTYLE'];
} else {
$pagenumstyle= '';
}
if (isset($attr['SUPPRESS']) && $attr['SUPPRESS']) {
$suppress = $attr['SUPPRESS'];
} else {
$suppress = '';
}
if (isset($attr['TOC-ORIENTATION']) && $attr['TOC-ORIENTATION']) {
$toc_orientation = $attr['TOC-ORIENTATION'];
} else {
$toc_orientation = '';
}
if (isset($attr['PAGING']) && (strtoupper($attr['PAGING'])=='OFF' || $attr['PAGING']==='0')) {
$paging = false;
} else {
$paging = true;
}
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS'])=='ON' || $attr['LINKS']==1)) {
$links = true;
} else {
$links = false;
}
if (isset($attr['NAME']) && $attr['NAME']) {
$toc_id = strtolower($attr['NAME']);
} else {
$toc_id = 0;
}
$this->TOC('', 0, 0, $resetpagenum, $pagenumstyle, $suppress, $toc_orientation, $paging, $links, $toc_id, $tocoutdent); // mPDF 5.6.19 5.6.31
}
public function openTagTOCPAGEBREAK($attr)
{
if (isset($attr['NAME']) && $attr['NAME']) {
$toc_id = strtolower($attr['NAME']);
} else {
$toc_id = 0;
}
if ($toc_id) {
if (isset($attr['OUTDENT']) && $attr['OUTDENT']) {
$this->m_TOC[$toc_id]['TOCoutdent'] = $attr['OUTDENT'];
} else {
$this->m_TOC[$toc_id]['TOCoutdent'] = '';
} // mPDF 5.6.19
if (isset($attr['TOC-ORIENTATION']) && $attr['TOC-ORIENTATION']) {
$this->m_TOC[$toc_id]['TOCorientation'] = $attr['TOC-ORIENTATION'];
} else {
$this->m_TOC[$toc_id]['TOCorientation'] = '';
}
if (isset($attr['PAGING']) && (strtoupper($attr['PAGING'])=='OFF' || $attr['PAGING']==='0')) {
$this->m_TOC[$toc_id]['TOCusePaging'] = false;
} else {
$this->m_TOC[$toc_id]['TOCusePaging'] = true;
}
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS'])=='ON' || $attr['LINKS']==1)) {
$this->m_TOC[$toc_id]['TOCuseLinking'] = true;
} else {
$this->m_TOC[$toc_id]['TOCuseLinking'] = false;
}
$this->m_TOC[$toc_id]['TOC_margin_left'] = $this->m_TOC[$toc_id]['TOC_margin_right'] = $this->m_TOC[$toc_id]['TOC_margin_top'] = $this->m_TOC[$toc_id]['TOC_margin_bottom'] = $this->m_TOC[$toc_id]['TOC_margin_header'] = $this->m_TOC[$toc_id]['TOC_margin_footer'] = '';
if (isset($attr['TOC-MARGIN-RIGHT'])) {
$this->m_TOC[$toc_id]['TOC_margin_right'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-RIGHT'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-LEFT'])) {
$this->m_TOC[$toc_id]['TOC_margin_left'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-LEFT'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-TOP'])) {
$this->m_TOC[$toc_id]['TOC_margin_top'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-TOP'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-BOTTOM'])) {
$this->m_TOC[$toc_id]['TOC_margin_bottom'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-BOTTOM'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-HEADER'])) {
$this->m_TOC[$toc_id]['TOC_margin_header'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-HEADER'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-FOOTER'])) {
$this->m_TOC[$toc_id]['TOC_margin_footer'] = $this->mpdf->ConvertSize($attr['TOC-MARGIN-FOOTER'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
$this->m_TOC[$toc_id]['TOC_odd_header_name'] = $this->m_TOC[$toc_id]['TOC_even_header_name'] = $this->m_TOC[$toc_id]['TOC_odd_footer_name'] = $this->m_TOC[$toc_id]['TOC_even_footer_name'] = '';
if (isset($attr['TOC-ODD-HEADER-NAME']) && $attr['TOC-ODD-HEADER-NAME']) {
$this->m_TOC[$toc_id]['TOC_odd_header_name'] = $attr['TOC-ODD-HEADER-NAME'];
}
if (isset($attr['TOC-EVEN-HEADER-NAME']) && $attr['TOC-EVEN-HEADER-NAME']) {
$this->m_TOC[$toc_id]['TOC_even_header_name'] = $attr['TOC-EVEN-HEADER-NAME'];
}
if (isset($attr['TOC-ODD-FOOTER-NAME']) && $attr['TOC-ODD-FOOTER-NAME']) {
$this->m_TOC[$toc_id]['TOC_odd_footer_name'] = $attr['TOC-ODD-FOOTER-NAME'];
}
if (isset($attr['TOC-EVEN-FOOTER-NAME']) && $attr['TOC-EVEN-FOOTER-NAME']) {
$this->m_TOC[$toc_id]['TOC_even_footer_name'] = $attr['TOC-EVEN-FOOTER-NAME'];
}
$this->m_TOC[$toc_id]['TOC_odd_header_value'] = $this->m_TOC[$toc_id]['TOC_even_header_value'] = $this->m_TOC[$toc_id]['TOC_odd_footer_value'] = $this->m_TOC[$toc_id]['TOC_even_footer_value'] = 0;
if (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='ON')) {
$this->m_TOC[$toc_id]['TOC_odd_header_value'] = 1;
} elseif (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='OFF')) {
$this->m_TOC[$toc_id]['TOC_odd_header_value'] = -1;
}
if (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='ON')) {
$this->m_TOC[$toc_id]['TOC_even_header_value'] = 1;
} elseif (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='OFF')) {
$this->m_TOC[$toc_id]['TOC_even_header_value'] = -1;
}
if (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='ON')) {
$this->m_TOC[$toc_id]['TOC_odd_footer_value'] = 1;
} elseif (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='OFF')) {
$this->m_TOC[$toc_id]['TOC_odd_footer_value'] = -1;
}
if (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='ON')) {
$this->m_TOC[$toc_id]['TOC_even_footer_value'] = 1;
} elseif (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='OFF')) {
$this->m_TOC[$toc_id]['TOC_even_footer_value'] = -1;
}
if (isset($attr['TOC-PAGE-SELECTOR']) && $attr['TOC-PAGE-SELECTOR']) {
$this->m_TOC[$toc_id]['TOC_page_selector'] = $attr['TOC-PAGE-SELECTOR'];
} else {
$this->m_TOC[$toc_id]['TOC_page_selector'] = '';
}
if (isset($attr['TOC-SHEET-SIZE']) && $attr['TOC-SHEET-SIZE']) {
$this->m_TOC[$toc_id]['TOCsheetsize'] = $attr['TOC-SHEET-SIZE'];
} else {
$this->m_TOC[$toc_id]['TOCsheetsize'] = '';
}
if (isset($attr['TOC-PREHTML']) && $attr['TOC-PREHTML']) {
$this->m_TOC[$toc_id]['TOCpreHTML'] = htmlspecialchars_decode($attr['TOC-PREHTML'], ENT_QUOTES);
}
if (isset($attr['TOC-POSTHTML']) && $attr['TOC-POSTHTML']) {
$this->m_TOC[$toc_id]['TOCpostHTML'] = htmlspecialchars_decode($attr['TOC-POSTHTML'], ENT_QUOTES);
}
if (isset($attr['TOC-BOOKMARKTEXT']) && $attr['TOC-BOOKMARKTEXT']) {
$this->m_TOC[$toc_id]['TOCbookmarkText'] = htmlspecialchars_decode($attr['TOC-BOOKMARKTEXT'], ENT_QUOTES);
} // *BOOKMARKS*
} else {
if (isset($attr['OUTDENT']) && $attr['OUTDENT']) {
$this->TOCoutdent = $attr['OUTDENT'];
} else {
$this->TOCoutdent = '';
} // mPDF 5.6.19
if (isset($attr['TOC-ORIENTATION']) && $attr['TOC-ORIENTATION']) {
$this->TOCorientation = $attr['TOC-ORIENTATION'];
} else {
$this->TOCorientation = '';
}
if (isset($attr['PAGING']) && (strtoupper($attr['PAGING'])=='OFF' || $attr['PAGING']==='0')) {
$this->TOCusePaging = false;
} else {
$this->TOCusePaging = true;
}
if (isset($attr['LINKS']) && (strtoupper($attr['LINKS'])=='ON' || $attr['LINKS']==1)) {
$this->TOCuseLinking = true;
} else {
$this->TOCuseLinking = false;
}
$this->TOC_margin_left = $this->TOC_margin_right = $this->TOC_margin_top = $this->TOC_margin_bottom = $this->TOC_margin_header = $this->TOC_margin_footer = '';
if (isset($attr['TOC-MARGIN-RIGHT'])) {
$this->TOC_margin_right = $this->mpdf->ConvertSize($attr['TOC-MARGIN-RIGHT'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-LEFT'])) {
$this->TOC_margin_left = $this->mpdf->ConvertSize($attr['TOC-MARGIN-LEFT'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-TOP'])) {
$this->TOC_margin_top = $this->mpdf->ConvertSize($attr['TOC-MARGIN-TOP'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-BOTTOM'])) {
$this->TOC_margin_bottom = $this->mpdf->ConvertSize($attr['TOC-MARGIN-BOTTOM'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-HEADER'])) {
$this->TOC_margin_header = $this->mpdf->ConvertSize($attr['TOC-MARGIN-HEADER'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
if (isset($attr['TOC-MARGIN-FOOTER'])) {
$this->TOC_margin_footer = $this->mpdf->ConvertSize($attr['TOC-MARGIN-FOOTER'], $this->mpdf->w, $this->mpdf->FontSize, false);
}
$this->TOC_odd_header_name = $this->TOC_even_header_name = $this->TOC_odd_footer_name = $this->TOC_even_footer_name = '';
if (isset($attr['TOC-ODD-HEADER-NAME']) && $attr['TOC-ODD-HEADER-NAME']) {
$this->TOC_odd_header_name = $attr['TOC-ODD-HEADER-NAME'];
}
if (isset($attr['TOC-EVEN-HEADER-NAME']) && $attr['TOC-EVEN-HEADER-NAME']) {
$this->TOC_even_header_name = $attr['TOC-EVEN-HEADER-NAME'];
}
if (isset($attr['TOC-ODD-FOOTER-NAME']) && $attr['TOC-ODD-FOOTER-NAME']) {
$this->TOC_odd_footer_name = $attr['TOC-ODD-FOOTER-NAME'];
}
if (isset($attr['TOC-EVEN-FOOTER-NAME']) && $attr['TOC-EVEN-FOOTER-NAME']) {
$this->TOC_even_footer_name = $attr['TOC-EVEN-FOOTER-NAME'];
}
$this->TOC_odd_header_value = $this->TOC_even_header_value = $this->TOC_odd_footer_value = $this->TOC_even_footer_value = 0;
if (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='ON')) {
$this->TOC_odd_header_value = 1;
} elseif (isset($attr['TOC-ODD-HEADER-VALUE']) && ($attr['TOC-ODD-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-HEADER-VALUE'])=='OFF')) {
$this->TOC_odd_header_value = -1;
}
if (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='ON')) {
$this->TOC_even_header_value = 1;
} elseif (isset($attr['TOC-EVEN-HEADER-VALUE']) && ($attr['TOC-EVEN-HEADER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-HEADER-VALUE'])=='OFF')) {
$this->TOC_even_header_value = -1;
}
if (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='ON')) {
$this->TOC_odd_footer_value = 1;
} elseif (isset($attr['TOC-ODD-FOOTER-VALUE']) && ($attr['TOC-ODD-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-ODD-FOOTER-VALUE'])=='OFF')) {
$this->TOC_odd_footer_value = -1;
}
if (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='ON')) {
$this->TOC_even_footer_value = 1;
} elseif (isset($attr['TOC-EVEN-FOOTER-VALUE']) && ($attr['TOC-EVEN-FOOTER-VALUE']=='-1' || strtoupper($attr['TOC-EVEN-FOOTER-VALUE'])=='OFF')) {
$this->TOC_even_footer_value = -1;
}
if (isset($attr['TOC-PAGE-SELECTOR']) && $attr['TOC-PAGE-SELECTOR']) {
$this->TOC_page_selector = $attr['TOC-PAGE-SELECTOR'];
} else {
$this->TOC_page_selector = '';
}
if (isset($attr['TOC-SHEET-SIZE']) && $attr['TOC-SHEET-SIZE']) {
$this->TOCsheetsize = $attr['TOC-SHEET-SIZE'];
} else {
$this->TOCsheetsize = '';
}
if (isset($attr['TOC-PREHTML']) && $attr['TOC-PREHTML']) {
$this->TOCpreHTML = htmlspecialchars_decode($attr['TOC-PREHTML'], ENT_QUOTES);
}
if (isset($attr['TOC-POSTHTML']) && $attr['TOC-POSTHTML']) {
$this->TOCpostHTML = htmlspecialchars_decode($attr['TOC-POSTHTML'], ENT_QUOTES);
}
if (isset($attr['TOC-BOOKMARKTEXT']) && $attr['TOC-BOOKMARKTEXT']) {
$this->TOCbookmarkText = htmlspecialchars_decode($attr['TOC-BOOKMARKTEXT'], ENT_QUOTES);
}
}
if ($this->mpdf->y == $this->mpdf->tMargin && (!$this->mpdf->mirrorMargins ||($this->mpdf->mirrorMargins && $this->mpdf->page % 2==1))) {
if ($toc_id) {
$this->m_TOC[$toc_id]['TOCmark'] = $this->mpdf->page;
} else {
$this->TOCmark = $this->mpdf->page;
}
// Don't add a page
if ($this->mpdf->page==1 && count($this->mpdf->PageNumSubstitutions)==0) {
$resetpagenum = '';
$pagenumstyle = '';
$suppress = '';
if (isset($attr['RESETPAGENUM'])) {
$resetpagenum = $attr['RESETPAGENUM'];
}
if (isset($attr['PAGENUMSTYLE'])) {
$pagenumstyle = $attr['PAGENUMSTYLE'];
}
if (isset($attr['SUPPRESS'])) {
$suppress = $attr['SUPPRESS'];
}
if (!$suppress) {
$suppress = 'off';
}
if (!$resetpagenum) {
$resetpagenum= 1;
}
$this->mpdf->PageNumSubstitutions[] = array('from'=>1, 'reset'=> $resetpagenum, 'type'=>$pagenumstyle, 'suppress'=> $suppress);
}
return array(true, $toc_id);
}
// No break - continues as PAGEBREAK...
return array(false, $toc_id);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,511 +0,0 @@
<?php
require_once(_MPDF_PATH.'classes/ttfontsuni.php');
class TTFontFile_Analysis extends TTFontFile
{
// Used to get font information from files in directory
public function extractCoreInfo($file, $TTCfontID=0)
{
$this->filename = $file;
$this->fh = fopen($file, 'rb');
if (!$this->fh) {
return ('ERROR - Can\'t open file ' . $file);
}
$this->_pos = 0;
$this->charWidths = '';
$this->glyphPos = array();
$this->charToGlyph = array();
$this->tables = array();
$this->otables = array();
$this->ascent = 0;
$this->descent = 0;
$this->numTTCFonts = 0;
$this->TTCFonts = array();
$this->version = $version = $this->read_ulong();
$this->panose = array(); // mPDF 5.0
if ($version==0x4F54544F) {
return("ERROR - NOT ADDED as Postscript outlines are not supported - " . $file);
}
if ($version==0x74746366) {
if ($TTCfontID > 0) {
$this->version = $version = $this->read_ulong(); // TTC Header version now
if (!in_array($version, array(0x00010000,0x00020000))) {
return("ERROR - NOT ADDED as Error parsing TrueType Collection: version=".$version." - " . $file);
}
} else {
return("ERROR - Error parsing TrueType Collection - " . $file);
}
$this->numTTCFonts = $this->read_ulong();
for ($i=1; $i<=$this->numTTCFonts; $i++) {
$this->TTCFonts[$i]['offset'] = $this->read_ulong();
}
$this->seek($this->TTCFonts[$TTCfontID]['offset']);
$this->version = $version = $this->read_ulong(); // TTFont version again now
$this->readTableDirectory(false);
} else {
if (!in_array($version, array(0x00010000,0x74727565))) {
return("ERROR - NOT ADDED as Not a TrueType font: version=".$version." - " . $file);
}
$this->readTableDirectory(false);
}
/* Included for testing...
$cmap_offset = $this->seek_table("cmap");
$this->skip(2);
$cmapTableCount = $this->read_ushort();
$unicode_cmap_offset = 0;
for ($i=0;$i<$cmapTableCount;$i++) {
$x[$i]['platformId'] = $this->read_ushort();
$x[$i]['encodingId'] = $this->read_ushort();
$x[$i]['offset'] = $this->read_ulong();
$save_pos = $this->_pos;
$x[$i]['format'] = $this->get_ushort($cmap_offset + $x[$i]['offset'] );
$this->seek($save_pos );
}
print_r($x); exit;
*/
///////////////////////////////////
// name - Naming table
///////////////////////////////////
/* Test purposes - displays table of names
$name_offset = $this->seek_table("name");
$format = $this->read_ushort();
if ($format != 0 && $format != 1) // mPDF 5.3.73
die("Unknown name table format ".$format);
$numRecords = $this->read_ushort();
$string_data_offset = $name_offset + $this->read_ushort();
for ($i=0;$i<$numRecords; $i++) {
$x[$i]['platformId'] = $this->read_ushort();
$x[$i]['encodingId'] = $this->read_ushort();
$x[$i]['languageId'] = $this->read_ushort();
$x[$i]['nameId'] = $this->read_ushort();
$x[$i]['length'] = $this->read_ushort();
$x[$i]['offset'] = $this->read_ushort();
$N = '';
if ($x[$i]['platformId'] == 1 && $x[$i]['encodingId'] == 0 && $x[$i]['languageId'] == 0) { // Roman
$opos = $this->_pos;
$N = $this->get_chunk($string_data_offset + $x[$i]['offset'] , $x[$i]['length'] );
$this->_pos = $opos;
$this->seek($opos);
}
else { // Unicode
$opos = $this->_pos;
$this->seek($string_data_offset + $x[$i]['offset'] );
$length = $x[$i]['length'] ;
if ($length % 2 != 0)
$length -= 1;
// die("PostScript name is UTF-16BE string of odd length");
$length /= 2;
$N = '';
while ($length > 0) {
$char = $this->read_ushort();
$N .= (chr($char));
$length -= 1;
}
$this->_pos = $opos;
$this->seek($opos);
}
$x[$i]['names'][$nameId] = $N;
}
print_r($x); exit;
*/
$name_offset = $this->seek_table("name");
$format = $this->read_ushort();
if ($format != 0 && $format != 1) { // mPDF 5.3.73
return("ERROR - NOT ADDED as Unknown name table format ".$format." - " . $file);
}
$numRecords = $this->read_ushort();
$string_data_offset = $name_offset + $this->read_ushort();
$names = array(1=>'',2=>'',3=>'',4=>'',6=>'');
$K = array_keys($names);
$nameCount = count($names);
for ($i=0;$i<$numRecords; $i++) {
$platformId = $this->read_ushort();
$encodingId = $this->read_ushort();
$languageId = $this->read_ushort();
$nameId = $this->read_ushort();
$length = $this->read_ushort();
$offset = $this->read_ushort();
if (!in_array($nameId, $K)) {
continue;
}
$N = '';
if ($platformId == 3 && $encodingId == 1 && $languageId == 0x409) { // Microsoft, Unicode, US English, PS Name
$opos = $this->_pos;
$this->seek($string_data_offset + $offset);
if ($length % 2 != 0) {
$length += 1;
}
$length /= 2;
$N = '';
while ($length > 0) {
$char = $this->read_ushort();
$N .= (chr($char));
$length -= 1;
}
$this->_pos = $opos;
$this->seek($opos);
} elseif ($platformId == 1 && $encodingId == 0 && $languageId == 0) { // Macintosh, Roman, English, PS Name
$opos = $this->_pos;
$N = $this->get_chunk($string_data_offset + $offset, $length);
$this->_pos = $opos;
$this->seek($opos);
}
if ($N && $names[$nameId]=='') {
$names[$nameId] = $N;
$nameCount -= 1;
if ($nameCount==0) {
break;
}
}
}
if ($names[6]) {
$psName = preg_replace('/ /', '-', $names[6]);
} elseif ($names[4]) {
$psName = preg_replace('/ /', '-', $names[4]);
} elseif ($names[1]) {
$psName = preg_replace('/ /', '-', $names[1]);
} else {
$psName = '';
}
if (!$names[1] && !$psName) {
return("ERROR - NOT ADDED as Could not find valid font name - " . $file);
}
$this->name = $psName;
if ($names[1]) {
$this->familyName = $names[1];
} else {
$this->familyName = $psName;
}
if ($names[2]) {
$this->styleName = $names[2];
} else {
$this->styleName = 'Regular';
}
///////////////////////////////////
// head - Font header table
///////////////////////////////////
$this->seek_table("head");
$ver_maj = $this->read_ushort();
$ver_min = $this->read_ushort();
if ($ver_maj != 1) {
return('ERROR - NOT ADDED as Unknown head table version '. $ver_maj .'.'. $ver_min." - " . $file);
}
$this->fontRevision = $this->read_ushort() . $this->read_ushort();
$this->skip(4);
$magic = $this->read_ulong();
if ($magic != 0x5F0F3CF5) {
return('ERROR - NOT ADDED as Invalid head table magic ' .$magic." - " . $file);
}
$this->skip(2);
$this->unitsPerEm = $unitsPerEm = $this->read_ushort();
$scale = 1000 / $unitsPerEm;
$this->skip(24);
$macStyle = $this->read_short();
$this->skip(4);
$indexLocFormat = $this->read_short();
///////////////////////////////////
// OS/2 - OS/2 and Windows metrics table
///////////////////////////////////
$sFamily = '';
$panose = '';
$fsSelection = '';
if (isset($this->tables["OS/2"])) {
$this->seek_table("OS/2");
$this->skip(30);
$sF = $this->read_short();
$sFamily = ($sF >> 8);
$this->_pos += 10; //PANOSE = 10 byte length
$panose = fread($this->fh, 10);
$this->panose = array();
for ($p=0;$p<strlen($panose);$p++) {
$this->panose[] = ord($panose[$p]);
}
$this->skip(20);
$fsSelection = $this->read_short();
}
///////////////////////////////////
// post - PostScript table
///////////////////////////////////
$this->seek_table("post");
$this->skip(4);
$this->italicAngle = $this->read_short() + $this->read_ushort() / 65536.0;
$this->skip(4);
$isFixedPitch = $this->read_ulong();
///////////////////////////////////
// cmap - Character to glyph index mapping table
///////////////////////////////////
$cmap_offset = $this->seek_table("cmap");
$this->skip(2);
$cmapTableCount = $this->read_ushort();
$unicode_cmap_offset = 0;
for ($i=0;$i<$cmapTableCount;$i++) {
$platformID = $this->read_ushort();
$encodingID = $this->read_ushort();
$offset = $this->read_ulong();
$save_pos = $this->_pos;
if (($platformID == 3 && $encodingID == 1) || $platformID == 0) { // Microsoft, Unicode
$format = $this->get_ushort($cmap_offset + $offset);
if ($format == 4) {
if (!$unicode_cmap_offset) {
$unicode_cmap_offset = $cmap_offset + $offset;
}
}
} elseif ((($platformID == 3 && $encodingID == 10) || $platformID == 0)) { // Microsoft, Unicode Format 12 table HKCS
$format = $this->get_ushort($cmap_offset + $offset);
if ($format == 12) {
$unicode_cmap_offset = $cmap_offset + $offset;
break;
}
}
$this->seek($save_pos);
}
if (!$unicode_cmap_offset) {
return('ERROR - Font ('.$this->filename .') NOT ADDED as it is not Unicode encoded, and cannot be used by mPDF');
}
$rtl = false;
$indic = false;
$cjk = false;
$sip = false;
$smp = false;
$pua = false;
$puaag = false;
$glyphToChar = array();
$unAGlyphs = '';
// Format 12 CMAP does characters above Unicode BMP i.e. some HKCS characters U+20000 and above
if ($format == 12) {
$this->seek($unicode_cmap_offset + 4);
$length = $this->read_ulong();
$limit = $unicode_cmap_offset + $length;
$this->skip(4);
$nGroups = $this->read_ulong();
for ($i=0; $i<$nGroups ; $i++) {
$startCharCode = $this->read_ulong();
$endCharCode = $this->read_ulong();
$startGlyphCode = $this->read_ulong();
if (($endCharCode > 0x20000 && $endCharCode < 0x2A6DF) || ($endCharCode > 0x2F800 && $endCharCode < 0x2FA1F)) {
$sip = true;
}
if ($endCharCode > 0x10000 && $endCharCode < 0x1FFFF) {
$smp = true;
}
if (($endCharCode > 0x0590 && $endCharCode < 0x077F) || ($endCharCode > 0xFE70 && $endCharCode < 0xFEFF) || ($endCharCode > 0xFB50 && $endCharCode < 0xFDFF)) {
$rtl = true;
}
if ($endCharCode > 0x0900 && $endCharCode < 0x0DFF) {
$indic = true;
}
if ($endCharCode > 0xE000 && $endCharCode < 0xF8FF) {
$pua = true;
if ($endCharCode > 0xF500 && $endCharCode < 0xF7FF) {
$puaag = true;
}
}
if (($endCharCode > 0x2E80 && $endCharCode < 0x4DC0) || ($endCharCode > 0x4E00 && $endCharCode < 0xA4CF) || ($endCharCode > 0xAC00 && $endCharCode < 0xD7AF) || ($endCharCode > 0xF900 && $endCharCode < 0xFAFF) || ($endCharCode > 0xFE30 && $endCharCode < 0xFE4F)) {
$cjk = true;
}
$offset = 0;
// Get each glyphToChar - only point if going to analyse un-mapped Arabic Glyphs
if (isset($this->tables['post'])) {
for ($unichar=$startCharCode;$unichar<=$endCharCode;$unichar++) {
$glyph = $startGlyphCode + $offset ;
$offset++;
$glyphToChar[$glyph][] = $unichar;
}
}
}
} else { // Format 4 CMap
$this->seek($unicode_cmap_offset + 2);
$length = $this->read_ushort();
$limit = $unicode_cmap_offset + $length;
$this->skip(2);
$segCount = $this->read_ushort() / 2;
$this->skip(6);
$endCount = array();
for ($i=0; $i<$segCount; $i++) {
$endCount[] = $this->read_ushort();
}
$this->skip(2);
$startCount = array();
for ($i=0; $i<$segCount; $i++) {
$startCount[] = $this->read_ushort();
}
$idDelta = array();
for ($i=0; $i<$segCount; $i++) {
$idDelta[] = $this->read_short();
}
$idRangeOffset_start = $this->_pos;
$idRangeOffset = array();
for ($i=0; $i<$segCount; $i++) {
$idRangeOffset[] = $this->read_ushort();
}
for ($n=0;$n<$segCount;$n++) {
if (($endCount[$n] > 0x0590 && $endCount[$n] < 0x077F) || ($endCount[$n] > 0xFE70 && $endCount[$n] < 0xFEFF) || ($endCount[$n] > 0xFB50 && $endCount[$n] < 0xFDFF)) {
$rtl = true;
}
if ($endCount[$n] > 0x0900 && $endCount[$n] < 0x0DFF) {
$indic = true;
}
if (($endCount[$n] > 0x2E80 && $endCount[$n] < 0x4DC0) || ($endCount[$n] > 0x4E00 && $endCount[$n] < 0xA4CF) || ($endCount[$n] > 0xAC00 && $endCount[$n] < 0xD7AF) || ($endCount[$n] > 0xF900 && $endCount[$n] < 0xFAFF) || ($endCount[$n] > 0xFE30 && $endCount[$n] < 0xFE4F)) {
$cjk = true;
}
if ($endCount[$n] > 0xE000 && $endCount[$n] < 0xF8FF) {
$pua = true;
if ($endCount[$n] > 0xF500 && $endCount[$n] < 0xF7FF) {
$puaag = true;
}
}
// Get each glyphToChar - only point if going to analyse un-mapped Arabic Glyphs
if (isset($this->tables['post'])) {
$endpoint = ($endCount[$n] + 1);
for ($unichar=$startCount[$n];$unichar<$endpoint;$unichar++) {
if ($idRangeOffset[$n] == 0) {
$glyph = ($unichar + $idDelta[$n]) & 0xFFFF;
} else {
$offset = ($unichar - $startCount[$n]) * 2 + $idRangeOffset[$n];
$offset = $idRangeOffset_start + 2 * $n + $offset;
if ($offset >= $limit) {
$glyph = 0;
} else {
$glyph = $this->get_ushort($offset);
if ($glyph != 0) {
$glyph = ($glyph + $idDelta[$n]) & 0xFFFF;
}
}
}
$glyphToChar[$glyph][] = $unichar;
}
}
}
}
// 'POST' table for un-mapped arabic glyphs
if (isset($this->tables['post'])) {
$this->seek_table("post");
// Only works on Format 2.0
$formata = $this->read_ushort();
$formatb = $this->read_ushort();
if ($formata == 2 && $formatb == 0) {
$this->skip(28);
$nGlyfs = $this->read_ushort();
$glyphNameIndex = array();
for ($i=0; $i<$nGlyfs; $i++) {
$glyphNameIndex[($this->read_ushort())] = $i;
}
$opost = $this->get_table('post');
$ptr = 34+($nGlyfs*2);
for ($i=0; $i<$nGlyfs; $i++) {
$len = ord(substr($opost, $ptr, 1));
$ptr++;
$name = substr($opost, $ptr, $len);
$gid = $glyphNameIndex[$i+258];
// Select uni0600.xxx(x) - uni06FF.xxx(x)
if (preg_match('/^uni(06[0-9a-f]{2})\.(fina|medi|init|fin|med|ini)$/i', $name, $m)) {
if (!isset($glyphToChar[$gid]) || (isset($glyphToChar[$gid]) && is_array($glyphToChar[$gid]) && count($glyphToChar[$gid])==1 && $glyphToChar[$gid][0]>57343 && $glyphToChar[$gid][0]<63489)) { // if set in PUA private use area E000-F8FF, or NOT Unicode mapped
$uni = hexdec($m[1]);
$form = strtoupper(substr($m[2], 0, 1));
// Assign new PUA Unicode between F500 - F7FF
$bit = $uni & 0xFF;
if ($form == 'I') {
$bit += 0xF600;
} elseif ($form == 'M') {
$bit += 0xF700;
} else {
$bit += 0xF500;
}
$unAGlyphs .= $gid;
$name = 'uni'.strtoupper($m[1]).'.'.strtolower($m[2]);
$unAGlyphs .= ' : '.$name;
$unihexstr = $m[1];
$unAGlyphs .= ' : '.$unihexstr;
$unAGlyphs .= ' : '.$uni;
$unAGlyphs .= ' : '.$form;
// if already set in PUA private use area E000-F8FF
if (isset($glyphToChar[$gid]) && $glyphToChar[$gid][0]>57343 && $glyphToChar[$gid][0]<63489) {
$unAGlyphs .= ' : '.$glyphToChar[$gid][0].' {'.dechex($glyphToChar[$gid][0]).'}';
}
//else $unAGlyphs .= ':';
$unAGlyphs .= ' : '.strtoupper(dechex($bit));
$unAGlyphs .= '<br />';
}
}
$ptr += $len;
}
if ($unAGlyphs) {
$unAGlyphs = 'GID:Name:Unicode base Hex:Dec:Form:PUA Unicode<br />'.$unAGlyphs ;
}
}
}
$bold = false;
$italic = false;
$ftype = '';
if ($macStyle & (1 << 0)) {
$bold = true;
} // bit 0 bold
elseif ($fsSelection & (1 << 5)) {
$bold = true;
} // 5 BOLD Characters are emboldened
if ($macStyle & (1 << 1)) {
$italic = true;
} // bit 1 italic
elseif ($fsSelection & (1 << 0)) {
$italic = true;
} // 0 ITALIC Font contains Italic characters, otherwise they are upright
elseif ($this->italicAngle <> 0) {
$italic = true;
}
if ($isFixedPitch) {
$ftype = 'mono';
} elseif ($sFamily >0 && $sFamily <8) {
$ftype = 'serif';
} elseif ($sFamily ==8) {
$ftype = 'sans';
} elseif ($sFamily ==10) {
$ftype = 'cursive';
}
// Use PANOSE
if ($panose) {
$bFamilyType=ord($panose[0]);
if ($bFamilyType==2) {
$bSerifStyle=ord($panose[1]);
if (!$ftype) {
if ($bSerifStyle>1 && $bSerifStyle<11) {
$ftype = 'serif';
} elseif ($bSerifStyle>10) {
$ftype = 'sans';
}
}
$bProportion=ord($panose[3]);
if ($bProportion==9 || $bProportion==1) {
$ftype = 'mono';
} // ==1 i.e. No Fit needed for OCR-a and -b
} elseif ($bFamilyType==3) {
$ftype = 'cursive';
}
}
fclose($this->fh);
return array($this->familyName, $bold, $italic, $ftype, $TTCfontID, $rtl, $indic, $cjk, $sip, $smp, $puaag, $pua, $unAGlyphs);
}
}

View file

@ -1,274 +0,0 @@
<?php
class wmf
{
public $mpdf = null;
public $gdiObjectArray;
public function __construct(&$mpdf)
{
$this->mpdf = $mpdf;
}
public function _getWMFimage($data)
{
$k = _MPDFK;
$this->gdiObjectArray = array();
$a=unpack('stest', "\1\0");
if ($a['test']!=1) {
return array(0, 'Error parsing WMF image - Big-endian architecture not supported');
}
// check for Aldus placeable metafile header
$key = unpack('Lmagic', substr($data, 0, 4));
$p = 18; // WMF header
if ($key['magic'] == (int)0x9AC6CDD7) {
$p +=22;
} // Aldus header
// define some state variables
$wo=null; // window origin
$we=null; // window extent
$polyFillMode = 0;
$nullPen = false;
$nullBrush = false;
$endRecord = false;
$wmfdata = '';
while ($p < strlen($data) && !$endRecord) {
$recordInfo = unpack('Lsize/Sfunc', substr($data, $p, 6));
$p += 6;
// size of record given in WORDs (= 2 bytes)
$size = $recordInfo['size'];
// func is number of GDI function
$func = $recordInfo['func'];
if ($size > 3) {
$parms = substr($data, $p, 2*($size-3));
$p += 2*($size-3);
}
switch ($func) {
case 0x020b: // SetWindowOrg
// do not allow window origin to be changed
// after drawing has begun
if (!$wmfdata) {
$wo = array_reverse(unpack('s2', $parms));
}
break;
case 0x020c: // SetWindowExt
// do not allow window extent to be changed
// after drawing has begun
if (!$wmfdata) {
$we = array_reverse(unpack('s2', $parms));
}
break;
case 0x02fc: // CreateBrushIndirect
$brush = unpack('sstyle/Cr/Cg/Cb/Ca/Shatch', $parms);
$brush['type'] = 'B';
$this->_AddGDIObject($brush);
break;
case 0x02fa: // CreatePenIndirect
$pen = unpack('Sstyle/swidth/sdummy/Cr/Cg/Cb/Ca', $parms);
// convert width from twips to user unit
$pen['width'] /= (20 * $k);
$pen['type'] = 'P';
$this->_AddGDIObject($pen);
break;
// MUST create other GDI objects even if we don't handle them
case 0x06fe: // CreateBitmap
case 0x02fd: // CreateBitmapIndirect
case 0x00f8: // CreateBrush
case 0x02fb: // CreateFontIndirect
case 0x00f7: // CreatePalette
case 0x01f9: // CreatePatternBrush
case 0x06ff: // CreateRegion
case 0x0142: // DibCreatePatternBrush
$dummyObject = array('type'=>'D');
$this->_AddGDIObject($dummyObject);
break;
case 0x0106: // SetPolyFillMode
$polyFillMode = unpack('smode', $parms);
$polyFillMode = $polyFillMode['mode'];
break;
case 0x01f0: // DeleteObject
$idx = unpack('Sidx', $parms);
$idx = $idx['idx'];
$this->_DeleteGDIObject($idx);
break;
case 0x012d: // SelectObject
$idx = unpack('Sidx', $parms);
$idx = $idx['idx'];
$obj = $this->_GetGDIObject($idx);
switch ($obj['type']) {
case 'B':
$nullBrush = false;
if ($obj['style'] == 1) {
$nullBrush = true;
} else {
$wmfdata .= $this->mpdf->SetFColor($this->mpdf->ConvertColor('rgb('.$obj['r'].','.$obj['g'].','.$obj['b'].')'), true)."\n";
}
break;
case 'P':
$nullPen = false;
$dashArray = array();
// dash parameters are custom
switch ($obj['style']) {
case 0: // PS_SOLID
break;
case 1: // PS_DASH
$dashArray = array(3,1);
break;
case 2: // PS_DOT
$dashArray = array(0.5,0.5);
break;
case 3: // PS_DASHDOT
$dashArray = array(2,1,0.5,1);
break;
case 4: // PS_DASHDOTDOT
$dashArray = array(2,1,0.5,1,0.5,1);
break;
case 5: // PS_NULL
$nullPen = true;
break;
}
if (!$nullPen) {
$wmfdata .= $this->mpdf->SetDColor($this->mpdf->ConvertColor('rgb('.$obj['r'].','.$obj['g'].','.$obj['b'].')'), true)."\n";
$wmfdata .= sprintf("%.3F w\n", $obj['width']*$k);
}
if (!empty($dashArray)) {
$s = '[';
for ($i=0; $i<count($dashArray);$i++) {
$s .= $dashArray[$i] * $k;
if ($i != count($dashArray)-1) {
$s .= ' ';
}
}
$s .= '] 0 d';
$wmfdata .= $s."\n";
}
break;
}
break;
case 0x0325: // Polyline
case 0x0324: // Polygon
$coords = unpack('s'.($size-3), $parms);
$numpoints = $coords[1];
for ($i = $numpoints; $i > 0; $i--) {
$px = $coords[2*$i];
$py = $coords[2*$i+1];
if ($i < $numpoints) {
$wmfdata .= $this->_LineTo($px, $py);
} else {
$wmfdata .= $this->_MoveTo($px, $py);
}
}
if ($func == 0x0325) {
$op = 's';
} elseif ($func == 0x0324) {
if ($nullPen) {
if ($nullBrush) {
$op = 'n';
} // no op
else {
$op = 'f';
} // fill
} else {
if ($nullBrush) {
$op = 's';
} // stroke
else {
$op = 'b';
} // stroke and fill
}
if ($polyFillMode==1 && ($op=='b' || $op=='f')) {
$op .= '*';
} // use even-odd fill rule
}
$wmfdata .= $op."\n";
break;
case 0x0538: // PolyPolygon
$coords = unpack('s'.($size-3), $parms);
$numpolygons = $coords[1];
$adjustment = $numpolygons;
for ($j = 1; $j <= $numpolygons; $j++) {
$numpoints = $coords[$j + 1];
for ($i = $numpoints; $i > 0; $i--) {
$px = $coords[2*$i + $adjustment];
$py = $coords[2*$i+1 + $adjustment];
if ($i == $numpoints) {
$wmfdata .= $this->_MoveTo($px, $py);
} else {
$wmfdata .= $this->_LineTo($px, $py);
}
}
$adjustment += $numpoints * 2;
}
if ($nullPen) {
if ($nullBrush) {
$op = 'n';
} // no op
else {
$op = 'f';
} // fill
} else {
if ($nullBrush) {
$op = 's';
} // stroke
else {
$op = 'b';
} // stroke and fill
}
if ($polyFillMode==1 && ($op=='b' || $op=='f')) {
$op .= '*';
} // use even-odd fill rule
$wmfdata .= $op."\n";
break;
case 0x0000:
$endRecord = true;
break;
}
}
return array(1,$wmfdata,$wo,$we);
}
public function _MoveTo($x, $y)
{
return "$x $y m\n";
}
// a line must have been started using _MoveTo() first
public function _LineTo($x, $y)
{
return "$x $y l\n";
}
public function _AddGDIObject($obj)
{
// find next available slot
$idx = 0;
if (!empty($this->gdiObjectArray)) {
$empty = false;
$i = 0;
while (!$empty) {
$empty = !isset($this->gdiObjectArray[$i]);
$i++;
}
$idx = $i-1;
}
$this->gdiObjectArray[$idx] = $obj;
}
public function _GetGDIObject($idx)
{
return $this->gdiObjectArray[$idx];
}
public function _DeleteGDIObject($idx)
{
unset($this->gdiObjectArray[$idx]);
}
}

View file

@ -1,176 +0,0 @@
<?php
$excl = array( 'HTML-CSS', 'DIRECTW', 'TABLES', 'LISTS', 'IMAGES-CORE',
'IMAGES-BMP', 'IMAGES-WMF', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'COLUMNS', 'TOC', 'INDEX', 'BOOKMARKS', 'BARCODES', 'FORMS', 'WATERMARK', 'CJK-FONTS', 'RTL', 'INDIC', 'ANNOTATIONS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS', 'HYPHENATION', 'ENCRYPTION', 'IMPORTS', 'PROGRESS-BAR');
// *DIRECTW* = Write, WriteText, WriteCell, Text, Shaded_box, AutosizeText
// IMAGES-CORE = [PNG, GIF, and JPG] NB background-images and watermark images
// Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS'
// Text is marked in mpdf_source.php with e.g. :
/*-- TABLES-ADVANCED-BORDERS --*/
/*-- END TABLES-ADVANCED-BORDERS --*/
// *TABLES-ADVANCED-BORDERS*
if (!isset($_POST['generate']) || $_POST['generate']!='generate') {
if (!file_exists('mpdf_source.php')) {
die("ERROR - Could not find mpdf_source.php file in current directory. Please rename mpdf.php as mpdf_source.php");
}
echo '<html>
<head>
<script language=javascript>
checked=false;
function checkedAll (frm1) {
var aa= document.getElementById("frm1");
if (checked == false)
{
checked = true
}
else
{
checked = false
}
for (var i =0; i < aa.elements.length; i++)
{
aa.elements[i].checked = checked;
}
}
</script>
</head>
<body>
<p><span style="color:red; font-weight: bold;">WARNING</span>: This utility will OVERWRITE mpdf.php file in the current directory.</p>
<p>Select the functions you wish to INCLUDE in your mpdf.php program. When you click generate, a new mpdf.php file will be written to the current directory.</p>
<div><b>Notes</b>
<ul>
<li>HTML-CSS is required for many of the other functions to work including: Tables, Lists, Backgrounds, Forms, Border-radius and all other CSS</li>
<li>DIRECTW includes the functions to Write directly to the PDF file e.g. Write, WriteText, WriteCell, Text, Shaded_box, AutosizeText</li>
<li>You must include either HTML-CSS or DIRECTW</li>
<li>JPG, PNG and JPG images are supported with IMAGES-CORE</li>
<li>For WMF Images, you must include both IMAGES-CORE and IMAGES-WMF</li>
<li>IMAGES-CORE are required for BACKGROUNDS (IMAGES) or WATERMARKS to work</li>
</ul>
</div>
<input type="checkbox" name="checkall" onclick="checkedAll(frm1);"> <i>Select/Unselect All</i><br /><br />
<form id="frm1" action="compress.php" method="POST">
';
foreach ($excl as $k=>$ex) {
echo '<input type="checkbox" value="1" name="inc['.$ex.']"';
if ($k==0 || ($k > 1 && $k < 5)) {
echo ' checked="checked"';
}
echo ' /> '.$ex.'<br />';
}
echo '<br />
<input type="submit" name="generate" value="generate" />
</form>
</body>
</html>';
exit;
}
$inc = $_POST['inc'];
if (is_array($inc) && count($inc)>0) {
foreach ($inc as $i=>$v) {
$key = array_search($i, $excl);
unset($excl[$key]);
}
}
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
if (PHP_VERSION_ID < 50300) {
$mqr = @get_magic_quotes_runtime();
} else {
$mqr=0;
}
if ($mqr) {
set_magic_quotes_runtime(0);
}
$l = file('mpdf_source.php');
if (!count($l)) {
die("ERROR - Could not find mpdf_source.php file in current directory");
}
$exclflags = array();
$x = '';
// Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS'
if ($excl[0]=='HTML-CSS') {
$excl[] = 'TABLES';
$excl[] = 'LISTS';
$excl[] = 'TABLES-ADVANCED-BORDERS';
$excl[] = 'HTMLHEADERS-FOOTERS';
$excl[] = 'FORMS';
$excl[] = 'BACKGROUNDS';
$excl[] = 'CSS-FLOAT';
$excl[] = 'CSS-IMAGE-FLOAT';
$excl[] = 'CSS-POSITION';
$excl[] = 'CSS-PAGE';
$excl[] = 'BORDER-RADIUS';
}
$excl = array_unique($excl);
foreach ($l as $k=>$ln) {
$exclude = false;
// *XXXXX*
preg_match_all("/\/\/ \*([A-Za-z\-]+)\*/", $ln, $m);
foreach ($m[1] as $mm) {
if (in_array($mm, $excl)) {
$exclude = true;
}
}
/*-- XXXXX --*/
preg_match_all("/\/\*-- ([A-Za-z\-]+) --\*\//", $ln, $m);
foreach ($m[1] as $mm) {
if (in_array($mm, $excl)) {
$exclflags[$mm] = true;
}
$exclude = true;
}
$exclflags = array_unique($exclflags);
/*-- END XXXX --*/
preg_match_all("/\/\*-- END ([A-Za-z\-]+) --\*\//", $ln, $m);
foreach ($m[1] as $mm) {
if (in_array($mm, $excl)) {
unset($exclflags[$mm]);
}
$exclude = true;
}
if (count($exclflags)==0 && !$exclude) {
$x .= $ln;
}
}
// mPDF 5.0
if (function_exists('file_put_contents')) {
$check = file_put_contents('mpdf.php', $x);
} else {
$f=fopen('mpdf.php', 'wb');
$check = fwrite($f, $x);
fclose($f);
}
if (!$check) {
die("ERROR - Could not write to mpdf.php file. Are permissions correctly set?");
}
echo '<p><b>mPDF file generated successfully!</b></p>';
echo '<div>mPDF file size '.number_format((strlen($x)/1024)).' kB</div>';
unset($l);
unset($x);
include('mpdf.php');
$mpdf = new mPDF();
echo '<div>Memory usage on loading mPDF class '.number_format((memory_get_usage(true)/(1024*1024)), 2).' MB</div>';
exit;

View file

@ -1,568 +0,0 @@
<?php
// mPDF 5.7
// Specify whether to automatically generate bookmarks or ToC entries from h1 - h6 tags
$this->h2bookmarks = array();
$this->h2toc = array();
/* Define arrays with e.g. the tag=>ToC-level
Remember bookmark and ToC levels start at 0
(does not work inside tables)
Only the default ToC will be used if > 1 ToCs are defined for the document
H1 - H6 must be uppercase
$this->h2toc = array('H1'=>0, 'H2'=>1, 'H3'=>2);
$this->h2bookmarks = array('H1'=>0, 'H2'=>1, 'H3'=>2);
*/
// mPDF 5.7
// Text-align on decimal marks
// Allowed characters for alignment on decimal marks. Additional codes must start with D
// Non-ASCII characters should be in utf-8 encoding
// DM - middot U+00B7
// DA - arabic decimal mark U+066B
$this->decimal_align = array('DP'=>'.', 'DC'=>',', 'DM'=>"\xc2\xb7", 'DA'=>"\xd9\xab", 'DD'=>'-');
// PAGING
$this->mirrorMargins = 0;
$this->restoreBlockPagebreaks = false;
$this->forcePortraitMargins = false;
$this->displayDefaultOrientation = false;
$this->printers_info = false; // Adds date and page info for printer when using @page and "marks:crop;"
$this->bleedMargin = 5;
$this->crossMarkMargin = 5; // Distance of cross mark from margin in mm
$this->cropMarkMargin = 8; // Distance of crop mark from margin in mm
$this->cropMarkLength = 18; // Default length in mm of crop line
$this->nonPrintMargin = 8; // Non-printable border at edge of paper sheet in mm
// mPDF 5.5
// Avoid just the border/background-color of the end of a block being moved on to next page
$this->margBuffer = 2; // Allows an (empty) end of block to extend beyond the bottom margin by this amount (mm)
// PAGE NUMBERING
$this->pagenumPrefix;
$this->pagenumSuffix;
$this->nbpgPrefix;
$this->nbpgSuffix;
// FONTS, LANGUAGES & CHARACTER SETS
// Set maximum size of TTF font file to allow non-subsets - in kB
// Used to avoid e.g. Arial Unicode MS (perhaps used for substitutions) to ever be fully embedded
// NB Free serif is 1.5MB, most files are <= 600kB (most 200-400KB)
$this->maxTTFFilesize = 2000;
// this value determines whether to subset or not
// 0 - 100 = percent characters
// i.e. if ==40, mPDF will embed whole font if >40% characters in that font
// or embed subset if <40% characters
// 0 will force whole file to be embedded (NO subsetting)
// 100 will force always to subset
// This value is overridden if you set new mPDF('s)
// and/or Can set at runtime
$this->percentSubset = 30;
$this->useAdobeCJK = true; // Uses Adobe CJK fonts for CJK languages
// default TRUE; only set false if you have defined some available fonts that support CJK
// If true this will not stop use of other CJK fonts if specified by font-family:
// and vice versa i.e. only dictates behaviour when specified by lang="" incl. AutoFont()
// When embedding full TTF font files, remakes the font file using only core tables
// May improve function with some PostScript printers (GhostScript/GSView)
// Does not work with TTC font collections
// Slightly smaller file; increased processing time
$this->repackageTTF = false;
// Allows automatic character set conversion if "charset=xxx" detected in html header (WriteHTML() )
$this->allow_charset_conversion = true;
$this->biDirectional=false; // automatically determine BIDI text in LTR page
$this->autoFontGroupSize = 2; // 1: individual words are spanned; 2: words+; 3: as big chunks as possible.
$this->useLang = true; // Default changed in mPDF 4.0
$this->useSubstitutions = false; // Substitute missing characters in UTF-8(multibyte) documents - from other fonts
$this->falseBoldWeight = 5; // Weight for bold text when using an artificial (outline) bold; value 0 (off) - 10 (rec. max)
// CONFIGURATION
$this->allow_output_buffering = false;
$this->enableImports = false; // Adding mPDFI functions
$this->collapseBlockMargins = true; // Allows top and bottom margins to collapse between block elements
$this->progressBar = 0; // Shows progress-bars whilst generating file 0 off, 1 simple, 2 advanced
$this->progbar_heading = 'mPDF file progress';
$this->progbar_altHTML = ''; // Should include <html> and <body> but NOT end tags
// Can incude <head> and link to stylesheet etc.
// e.g. '<html><body><p><img src="loading.gif" /> Creating PDF file. Please wait...</p>';
$this->dpi = 96; // To interpret "px" pixel values in HTML/CSS (see img_dpi below)
// Automatically correct for tags where HTML specifies optional end tags e.g. P,LI,DD,TD
// If you are confident input html is valid XHTML, turning this off may make it more reliable(?)
$this->allow_html_optional_endtags = true;
$this->ignore_invalid_utf8 = false;
$this->text_input_as_HTML = false; // Converts all entities in Text inputs to UTF-8 before encoding
$this->useGraphs = false;
// When writing a block element with position:fixed and overflow:auto, mPDF scales it down to fit in the space
// by repeatedly rewriting it and making adjustments. These values give the adjustments used, depending how far out
// the previous guess was. The lower the number, the quicker it will finish, but the less accurate the fit may be.
// FPR1 is for coarse adjustments, and FPR4 for fine adjustments when it is getting closer.
$this->incrementFPR1 = 10; // i.e. will alter by 1/[10]th of width and try again until within closer limits
$this->incrementFPR2 = 20;
$this->incrementFPR3 = 30;
$this->incrementFPR4 = 50; // i.e. will alter by 1/[50]th of width and try again when it nearly fits
// COLORSPACE
// 1 - allow GRAYSCALE only [convert CMYK/RGB->gray]
// 2 - allow RGB / SPOT COLOR / Grayscale [convert CMYK->RGB]
// 3 - allow CMYK / SPOT COLOR / Grayscale [convert RGB->CMYK]
$this->restrictColorSpace = 0;
// PDFX/1-a Compliant files
$this->PDFX = false; // true=Forces compliance with PDFX-1a spec
// Cannot be used with $this->restrictColorSpace (i.e. no RGB)
$this->PDFXauto = false; // Overrides warnings making changes when possible to force PDFX1-a compliance
// PDFA1-b Compliant files
$this->PDFA = false; // true=Forces compliance with PDFA-1b spec
// Can use with $this->restrictColorSpace=3 (for a CMYK file)
// Any other settings, uses RGB profile
$this->PDFAauto = false; // Overrides warnings making changes when possible to force PDFA1-b compliance
$this->ICCProfile = ''; // Colour profile OutputIntent
// sRGB_IEC61966-2-1 (=default if blank and PDFA), or other added .icc profile
// Must be CMYK for PDFX, or appropriate type for PDFA(RGB or CMYK)
// DEBUGGING & DEVELOPERS
$this->showStats = false;
$this->debug = false;
$this->debugfonts = false; // Checks and reports on errors when parsing TTF files - adds significantly to processing time
$this->showImageErrors = false;
$this->table_error_report = false; // Die and report error if table is too wide to contain whole words
$this->table_error_report_param = ''; // Parameter which can be passed to show in error report i.e. chapter number being processed//
// ANNOTATIONS
$this->title2annots = false;
$this->annotSize = 0.5; // default mm for Adobe annotations - nominal
$this->annotMargin; // default position for Annotations
$this->annotOpacity = 0.5; // default opacity for Annotations
// BOOKMARKS
$this->anchor2Bookmark = 0; // makes <a name=""> into a bookmark as well as internal link target; 1 = just name; 2 = name (p.34)
// Set an optional array to specify appearance of Bookmarks (by level)
// Default values are Black and normal style
/*
Example:
$this->bookmarkStyles = array(
0 => array('color'=> array(0,64,128), 'style'=>'B'),
1 => array('color'=> array(128,0,0), 'style'=>''),
2 => array('color'=> array(0,128,0), 'style'=>'I'),
);
*/
$this->bookmarkStyles = array();
// CSS & STYLES
$this->CSSselectMedia='print'; // screen, print, or any other CSS @media type (not "all")
// PAGE HEADERS & FOOTERS
$this->forcePortraitHeaders = false;
// Values used if simple FOOTER/HEADER given i.e. not array
$this->defaultheaderfontsize = 8; // pt
$this->defaultheaderfontstyle = 'BI'; // '', or 'B' or 'I' or 'BI'
$this->defaultheaderline = 1; // 1 or 0 - line under the header
$this->defaultfooterfontsize = 8; // pt
$this->defaultfooterfontstyle = 'BI'; // '', or 'B' or 'I' or 'BI'
$this->defaultfooterline = 1; // 1 or 0 - line over the footer
$this->header_line_spacing = 0.25; // spacing between bottom of header and line (if present) - function of fontsize
$this->footer_line_spacing = 0.25; // spacing between bottom of header and line (if present) - function of fontsize
// If 'pad' margin-top sets fixed distance in mm (padding) between bottom of header and top of text.
// If 'stretch' margin-top sets a minimum distance in mm between top of page and top of text, which expands if header is too large to fit.
$this->setAutoTopMargin = false;
$this->setAutoBottomMargin = false;
$this->autoMarginPadding = 2; // distance in mm used as padding if 'stretch' mode is used
// TABLES
$this->simpleTables = false; // Forces all cells to have same border, background etc. Improves performance
$this->packTableData = false; // Reduce memory usage processing tables (but with increased processing time)
// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased
// executon time and disk access (read and write)
$this->cacheTables = false;
$this->ignore_table_percents = false;
$this->ignore_table_widths = false;
$this->keep_table_proportions = false; // If table width set > page width, force resizing but keep relative sizes
// Also forces respect of cell widths set by %
$this->shrink_tables_to_fit = 1.4; // automatically reduce fontsize in table if words would have to split ( not in CJK)
// 0 or false to disable; value (if set) gives maximum factor to reduce fontsize
$this->tableMinSizePriority = false; // If page-break-inside:avoid but cannot fit on full page without
// exceeding autosize; setting this value to true will force respsect for
// autosize, and disable the page-break-inside:avoid
$this->use_kwt = false; // "Keep-with-table"
$this->iterationCounter = false; // Set to TRUE to use table Head iteration counter
$this->splitTableBorderWidth = 0; // Use table border (using this width in mm) when table breaks across pages
// Recommended to use small value e.g. 0.01
// IMAGES
$this->img_dpi = 96; // Default dpi to output images if size not defined
// See also above "dpi"
// TEXT SPACING & JUSTIFICATION
$this->useKerning = false; // true to use kerning
$this->justifyB4br = false; // In justified text, <BR> does not cause the preceding text to be justified in browsers
// Change to true to force justification (as in MS Word)
$this->tabSpaces = 8; // Number of spaces to replace for a TAB in <pre> sections
// Notepad uses 6, HTML specification recommends 8
$this->jSWord = 0.4; // Proportion (/1) of space (when justifying margins) to allocate to Word vs. Character
$this->jSmaxChar = 2; // Maximum spacing to allocate to character spacing. (0 = no maximum)
$this->jSmaxCharLast = 1; // Maximum character spacing allowed (carried over) when finishing a last line
$this->jSmaxWordLast = 2; // Maximum word spacing allowed (carried over) when finishing a last line
$this->normalLineheight = 1.33; // Value used for line-height when CSS specified as 'normal' (default)
// Small Caps
$this->smCapsScale = 0.75; // Factor of 1 to scale capital letters
$this->smCapsStretch = 110; // % to stretch small caps horizontally (i.e. 100 = no stretch)
// CJK Line-breaking
$this->allowCJKorphans = true; // FALSE=always wrap to next line; TRUE=squeeze or overflow
$this->allowCJKoverflow = false; // FALSE=squeeze; TRUE=overflow (only some characters, and disabled in tables)
$this->CJKforceend = false; // Forces overflowng punctuation to hang outside right margin mPDF 5.6.40
// HYPHENATION
$this->SHYlang = "en"; // Should be one of: 'en','de','es','fi','fr','it','nl','pl','ru','sv'
$this->SHYleftmin = 2;
$this->SHYrightmin = 2;
$this->SHYcharmin = 2;
$this->SHYcharmax = 10;
// COLUMNS
$this->keepColumns = false; // Set to go to the second column only when the first is full of text etc.
$this->max_colH_correction = 1.15; // Maximum ratio to adjust column height when justifying - too large a value can give ugly results
$this->ColGap=5;
// LISTS
$this->list_align_style = 'R'; // Determines alignment of numbers in numbered lists
$this->list_indent_first_level = 0; // 1/0 yex/no to indent first level of list
$this->list_number_suffix = '.'; // Content to follow a numbered list marker e.g. '.' gives 1. or IV.; ')' gives 1) or a)
// ACTIVE FORMS
$this->useActiveForms = false;
// WATERMARKS
$this->watermarkImgBehind = false;
$this->showWatermarkText = 0;
$this->showWatermarkImage = 0;
$this->watermarkText = '';
$this->watermarkImage = '';
$this->watermark_font = '';
$this->watermarkTextAlpha = 0.2;
$this->watermarkImageAlpha = 0.2;
$this->watermarkImgAlphaBlend = 'Normal';
// Accepts any PDF spec. value: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn,
// HardLight, SoftLight, Difference, Exclusion
// "Multiply" works well for watermark image on top
// BORDERS
$this->autoPadding = false; // Automatically increases padding in block elements when border-radius set - if required
//////////////////////////////////////////////
// Default values if no style sheet offered (cf. http://www.w3.org/TR/CSS21/sample.html)
$this->defaultCSS = array(
'BODY' => array(
'FONT-FAMILY' => 'serif',
'FONT-SIZE' => '11pt',
'TEXT-INDENT' => '0pt',
'LINE-HEIGHT' => 'normal',
'MARGIN-COLLAPSE' => 'collapse', /* Custom property to collapse top/bottom margins at top/bottom of page - ignored in tables/lists */
'HYPHENS' => 'manual', /* mPDF 5.6.08 */
),
'P' => array(
'MARGIN' => '1.12em 0',
),
'H1' => array(
'FONT-SIZE' => '2em',
'FONT-WEIGHT' => 'bold',
'MARGIN' => '0.67em 0',
'PAGE-BREAK-AFTER' => 'avoid',
),
'H2' => array(
'FONT-SIZE' => '1.5em',
'FONT-WEIGHT' => 'bold',
'MARGIN' => '0.75em 0',
'PAGE-BREAK-AFTER' => 'avoid',
),
'H3' => array(
'FONT-SIZE' => '1.17em',
'FONT-WEIGHT' => 'bold',
'MARGIN' => '0.83em 0',
'PAGE-BREAK-AFTER' => 'avoid',
),
'H4' => array(
'FONT-WEIGHT' => 'bold',
'MARGIN' => '1.12em 0',
'PAGE-BREAK-AFTER' => 'avoid',
),
'H5' => array(
'FONT-SIZE' => '0.83em',
'FONT-WEIGHT' => 'bold',
'MARGIN' => '1.5em 0',
'PAGE-BREAK-AFTER' => 'avoid',
),
'H6' => array(
'FONT-SIZE' => '0.75em',
'FONT-WEIGHT' => 'bold',
'MARGIN' => '1.67em 0',
'PAGE-BREAK-AFTER' => 'avoid',
),
'HR' => array(
'COLOR' => '#888888',
'TEXT-ALIGN' => 'center',
'WIDTH' => '100%',
'HEIGHT' => '0.2mm',
'MARGIN-TOP' => '0.83em',
'MARGIN-BOTTOM' => '0.83em',
),
'PRE' => array(
'MARGIN' => '0.83em 0',
'FONT-FAMILY' => 'monospace',
),
'S' => array(
'TEXT-DECORATION' => 'line-through',
),
'STRIKE' => array(
'TEXT-DECORATION' => 'line-through',
),
'DEL' => array(
'TEXT-DECORATION' => 'line-through',
),
'SUB' => array(
'VERTICAL-ALIGN' => 'sub',
'FONT-SIZE' => '55%', /* Recommended 0.83em */
),
'SUP' => array(
'VERTICAL-ALIGN' => 'super',
'FONT-SIZE' => '55%', /* Recommended 0.83em */
),
'U' => array(
'TEXT-DECORATION' => 'underline',
),
'INS' => array(
'TEXT-DECORATION' => 'underline',
),
'B' => array(
'FONT-WEIGHT' => 'bold',
),
'STRONG' => array(
'FONT-WEIGHT' => 'bold',
),
'I' => array(
'FONT-STYLE' => 'italic',
),
'CITE' => array(
'FONT-STYLE' => 'italic',
),
'Q' => array(
'FONT-STYLE' => 'italic',
),
'EM' => array(
'FONT-STYLE' => 'italic',
),
'VAR' => array(
'FONT-STYLE' => 'italic',
),
'SAMP' => array(
'FONT-FAMILY' => 'monospace',
),
'CODE' => array(
'FONT-FAMILY' => 'monospace',
),
'KBD' => array(
'FONT-FAMILY' => 'monospace',
),
'TT' => array(
'FONT-FAMILY' => 'monospace',
),
'SMALL' => array(
'FONT-SIZE' => '83%',
),
'BIG' => array(
'FONT-SIZE' => '117%',
),
'ACRONYM' => array(
'FONT-SIZE' => '77%',
'FONT-WEIGHT' => 'bold',
),
'ADDRESS' => array(
'FONT-STYLE' => 'italic',
),
'BLOCKQUOTE' => array(
'MARGIN-LEFT' => '40px',
'MARGIN-RIGHT' => '40px',
'MARGIN-TOP' => '1.12em',
'MARGIN-BOTTOM' => '1.12em',
),
'A' => array(
'COLOR' => '#0000FF',
'TEXT-DECORATION' => 'underline',
),
'UL' => array(
'MARGIN' => '0.83em 0', /* only applied to top-level of nested lists */
'TEXT-INDENT' => '1.3em', /* Custom effect - list indent */
),
'OL' => array(
'MARGIN' => '0.83em 0', /* only applied to top-level of nested lists */
'TEXT-INDENT' => '1.3em', /* Custom effect - list indent */
),
'DL' => array(
'MARGIN' => '1.67em 0',
),
'DT' => array(
),
'DD' => array(
'PADDING-LEFT' => '40px',
),
'TABLE' => array(
'MARGIN' => '0',
'BORDER-COLLAPSE' => 'separate',
'BORDER-SPACING' => '2px',
'EMPTY-CELLS' => 'show',
'LINE-HEIGHT' => '1.2',
'VERTICAL-ALIGN' => 'middle',
),
'THEAD' => array(
),
'TFOOT' => array(
),
'TH' => array(
'FONT-WEIGHT' => 'bold',
'TEXT-ALIGN' => 'center',
'PADDING-LEFT' => '0.1em',
'PADDING-RIGHT' => '0.1em',
'PADDING-TOP' => '0.1em',
'PADDING-BOTTOM' => '0.1em',
),
'TD' => array(
'PADDING-LEFT' => '0.1em',
'PADDING-RIGHT' => '0.1em',
'PADDING-TOP' => '0.1em',
'PADDING-BOTTOM' => '0.1em',
),
'CAPTION' => array(
'TEXT-ALIGN' => 'center',
),
'IMG' => array(
'MARGIN' => '0',
'VERTICAL-ALIGN' => 'baseline',
),
'INPUT' => array(
'FONT-FAMILY' => 'sans-serif',
'VERTICAL-ALIGN' => 'middle',
'FONT-SIZE' => '0.9em',
),
'SELECT' => array(
'FONT-FAMILY' => 'sans-serif',
'FONT-SIZE' => '0.9em',
'VERTICAL-ALIGN' => 'middle',
),
'TEXTAREA' => array(
'FONT-FAMILY' => 'monospace',
'FONT-SIZE' => '0.9em',
'VERTICAL-ALIGN' => 'text-bottom',
),
'MARK' => array( /* mPDF 5.5.09 */
'BACKGROUND-COLOR' => 'yellow',
),
);
//////////////////////////////////////////////////
// VALUES ONLY LIKELY TO BE CHANGED BY DEVELOPERS
//////////////////////////////////////////////////
$this->pdf_version = '1.4';
// Hyphenation
$this->SHYlanguages = array('en','de','es','fi','fr','it','nl','pl','ru','sv'); // existing defined patterns
$this->default_lineheight_correction=1.2; // Value 1 sets lineheight=fontsize height;
// Value used if line-height not set by CSS (usuallly is)
$this->fontsizes = array('XX-SMALL'=>0.7, 'X-SMALL'=>0.77, 'SMALL'=>0.86, 'MEDIUM'=>1, 'LARGE'=>1.2, 'X-LARGE'=>1.5, 'XX-LARGE'=>2);
// CHARACTER PATTERN MATCHES TO DETECT LANGUAGES
// pattern used to detect RTL characters -> force RTL
$this->pregRTLchars = "\x{0590}-\x{06FF}\x{0700}-\x{083E}\x{FB00}-\x{FDFD}\x{FE70}-\x{FEFF}";
// CJK Chars which require changing and are distinctive of specific charset
$this->pregUHCchars = "\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}";
$this->pregSJISchars = "\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3190}-\x{319F}\x{31F0}-\x{31FF}";
// Chars which distinguish CJK but not between different
$this->pregCJKchars = "\x{1100}-\x{11FF}\x{2E80}-\x{A4CF}\x{A800}-\x{D7AF}\x{F900}-\x{FAFF}\x{FE30}-\x{FE6F}\x{FF00}-\x{FFEF}\x{20000}-\x{2FA1F}";
// For CJK Line-breaking
//Leading characters - Not allowed at end of line
$this->CJKleading = "\$\(\*\[\{\x{00a3}\x{00a5}\x{00ab}\x{00b7}\x{2018}\x{201c}\x{2035}\x{3005}\x{3007}\x{3008}\x{300a}\x{300c}\x{300e}\x{3010}\x{3014}\x{3016}\x{3018}\x{301d}\x{fe34}\x{fe57}\x{fe59}\x{fe5b}\x{ff04}\x{ff08}\x{ff0e}\x{ff3b}\x{ff5b}\x{ff5f}\x{ffe1}\x{ffe5}\x{ffe6}";
// Following characters - Not allowed at start
$this->CJKfollowing = "!%\),\.:;>\?\]\}\x{00a2}\x{00a8}\x{00b0}\x{00b7}\x{00bb}\x{02c7}\x{02c9}\x{2010}\x{2013}-\x{2016}\x{2019}\x{201d}-\x{201f}\x{2020}-\x{2022}\x{2025}\x{2027}\x{203a}\x{203c}\x{2047}-\x{2049}\x{2103}\x{2236}\x{2574}\x{3001}-\x{3003}\x{3005}\x{3006}\x{3009}\x{300b}\x{300d}\x{300f}\x{3011}\x{3015}\x{3017}\x{3019}\x{301c}\x{301e}\x{301f}\x{303b}\x{3041}\x{3043}\x{3045}\x{3047}\x{3049}\x{3063}\x{3083}\x{3085}\x{3087}\x{308e}\x{3095}\x{3096}\x{30a0}\x{30a1}\x{30a3}\x{30a5}\x{30a7}\x{30a9}\x{30c3}\x{30e3}\x{30e5}\x{30e7}\x{30ee}\x{30f5}\x{30f6}\x{30fb}-\x{30fe}\x{31f0}-\x{31ff}\x{fe30}-\x{fe33}\x{fe50}-\x{fe56}\x{fe58}\x{fe5a}\x{fe5c}\x{ff01}\x{ff02}\x{ff05}\x{ff07}\x{ff09}\x{ff0c}\x{ff0e}\x{ff1a}\x{ff1b}\x{ff1f}\x{ff3d}\x{ff40}\x{ff5c}-\x{ff5e}\x{ff60}\x{ff64}";
// Characters which are allowed to overflow the right margin
$this->CJKoverflow = "\.,\x{ff61}\x{ff64}\x{3001}\x{3002}\x{ff0c}\x{ff0e}";
// ASCII Chars which shouldn't break string
// Use for very specific words
$this->pregASCIIchars1 = "\x{0021}-\x{002E}\x{0030}-\x{003B}?"; // no [SPACE]
// Use for words+
$this->pregASCIIchars2 = "\x{0020}-\x{002E}\x{0030}-\x{003B}?"; // [SPACE] punctuation and 0-9
// Use for chunks > words
$this->pregASCIIchars3 = "\x{0000}-\x{002E}\x{0030}-\x{003B}\x{003F}-\x{007E}"; // all except <>
// Vietnamese - specific
$this->pregVIETchars = "\x{01A0}\x{01A1}\x{01AF}\x{01B0}\x{1EA0}-\x{1EF1}";
// Vietnamese - Chars which shouldn't break string
$this->pregVIETPluschars = "\x{0000}-\x{003B}\x{003F}-\x{00FF}\x{0300}-\x{036F}\x{0102}\x{0103}\x{0110}\x{0111}\x{0128}\x{0129}\x{0168}\x{0169}\x{1EF1}-\x{1EF9}"; // omits < >
// Arabic
$this->pregARABICchars = "\x{0600}-\x{06FF}\x{0750}-\x{077F}\x{FB50}-\x{FDFD}\x{FE70}-\x{FEFF}";
// Characters of Urdu, Pashto, Sindhi (but NOT arabic or persian/farsi) [not covered by DejavuSans font]
$this->pregNonARABICchars = "\x{0671}-\x{067D}\x{067F}-\x{0685}\x{0687}-\x{0697}\x{0699}-\x{06A8}\x{06AA}-\x{06AE}\x{06B0}-\x{06CB}\x{06CD}-\x{06D3}";
$this->pregHEBchars = "\x{0590}-\x{05FF}\x{FB00}-\x{FB49}"; // Hebrew
// INDIC
$this->pregHIchars = "\x{0900}-\x{0963}\x{0966}-\x{097F}"; // Devanagari (Hindi) minus the common indic punctuation 0964,0965
$this->pregBNchars = "\x{0980}-\x{09FF}"; // Bengali
$this->pregPAchars = "\x{0A00}-\x{0A7F}"; // Gurmukhi (Punjabi)
$this->pregGUchars = "\x{0A80}-\x{0AFF}"; // Gujarati
$this->pregORchars = "\x{0B00}-\x{0B7F}"; // Oriya
$this->pregTAchars = "\x{0B80}-\x{0BFF}"; // Tamil
$this->pregTEchars = "\x{0C00}-\x{0C7F}"; // Telugu
$this->pregKNchars = "\x{0C80}-\x{0CFF}"; // Kannada
$this->pregMLchars = "\x{0D00}-\x{0D7F}"; // Malayalam
$this->pregSHchars = "\x{0D80}-\x{0DFF}"; // Sinhala
$this->pregINDextra = "\x{200B}-\x{200D}\x{0964}\x{0965}\x{0020}-\x{0022}\x{0024}-\x{002E}\x{003A}-\x{003F}\x{005B}-\x{0060}\x{007B}-\x{007E}\x{00A0}";
// 200B-D=Zero-width joiners; 0964,0965=Generic Indic punctuation; NBSP & general punctuation (excludes # and / so can use in autoFont() )
$this->allowedCSStags = 'DIV|P|H1|H2|H3|H4|H5|H6|FORM|IMG|A|BODY|TABLE|HR|THEAD|TFOOT|TBODY|TH|TR|TD|UL|OL|LI|PRE|BLOCKQUOTE|ADDRESS|DL|DT|DD';
$this->allowedCSStags .= '|ARTICLE|ASIDE|FIGURE|FIGCAPTION|FOOTER|HEADER|HGROUP|NAV|SECTION|MARK|DETAILS|SUMMARY|METER|PROGRESS|TIME'; // mPDF 5.5.09
$this->allowedCSStags .= '|SPAN|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|STRIKE|S|U|DEL|INS|Q|FONT';
$this->allowedCSStags .= '|SELECT|INPUT|TEXTAREA|CAPTION|FIELDSET|LEGEND'; // mPDF 5.4.18
$this->allowedCSStags .= '|TEXTCIRCLE|DOTTAB'; // mPDF 5.5.23 // mPDF 5.6.33
$this->outerblocktags = array('DIV','FORM','CENTER','DL','FIELDSET','ARTICLE','ASIDE','FIGURE','FIGCAPTION', 'FOOTER','HEADER','HGROUP','NAV','SECTION','DETAILS','SUMMARY'); // mPDF 5.5.09 // mPDF 5.5.22
$this->innerblocktags = array('P','BLOCKQUOTE','ADDRESS','PRE','H1','H2','H3','H4','H5','H6','DT','DD','CAPTION');

View file

@ -1,154 +0,0 @@
<?php
function GetLangOpts($llcc, $adobeCJK)
{
if (strlen($llcc) == 5) {
$lang = substr(strtolower($llcc), 0, 2);
$country = substr(strtoupper($llcc), 3, 2);
} else {
$lang = strtolower($llcc);
$country = '';
}
$unifonts = "";
$coreSuitable = false;
switch ($lang) {
case "en":
case "ca":
case "cy":
case "da":
case "de":
case "es":
case "eu":
case "fr":
case "ga":
case "fi":
case "is":
case "it":
case "nl":
case "no":
case "pt":
case "sv":
// Edit this value to define how mPDF behaves when using new mPDF('-x')
// If set to TRUE, mPDF will use Adobe core fonts only when it recognises the languages above
$coreSuitable = true; break;
// RTL Languages
case "he":
case "yi":
$unifonts = "dejavusans,dejavusansB,dejavusansI,dejavusansBI"; break;
// Arabic
case "ar":
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
case "fa":
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
case "ps":
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
case "ur":
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
// Sindhi (can be Arabic or Devanagari)
case "sd":
if ($country == "IN") {
$unifonts = "ind_hi_1_001";
}
// else if ($country == "PK") { $unifonts = ""; }
// else { $unifonts = ""; }
break;
// INDIC
// Assamese
case "as": $unifonts = "ind_bn_1_001"; break;
// Bengali
case "bn": $unifonts = "ind_bn_1_001"; break;
// Gujarati
case "gu": $unifonts = "ind_gu_1_001"; break;
// Hindi (Devanagari)
case "hi": $unifonts = "ind_hi_1_001"; break;
// Kannada
case "kn": $unifonts = "ind_kn_1_001"; break;
// Kashmiri
case "ks": $unifonts = "ind_hi_1_001"; break;
// Malayalam
case "ml": $unifonts = "ind_ml_1_001"; break;
// Nepali (Devanagari)
case "ne": $unifonts = "ind_hi_1_001"; break;
// Oriya
case "or": $unifonts = "ind_or_1_001"; break;
// Punjabi (Gurmukhi)
case "pa": $unifonts = "ind_pa_1_001"; break;
// Tamil
case "ta": $unifonts = "ind_ta_1_001"; break;
// Telegu
case "te": $unifonts = "ind_te_1_001"; break;
// THAI
case "th": $unifonts = "garuda,garudaB,garudaI,garudaBI,norasi,norasiB,norasiI,norasiBI"; break;
// VIETNAMESE
case "vi":
$unifonts = "dejavusanscondensed,dejavusanscondensedB,dejavusanscondensedI,dejavusanscondensedBI,dejavusans,dejavusansB,dejavusansI,dejavusansBI"; break;
// CJK Langauges
case "ja":
if ($adobeCJK) {
$unifonts = "sjis,sjisB,sjisI,sjisBI";
}
/* Uncomment these lines if CJK fonts available */
// else {
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
// }
break;
case "ko":
if ($adobeCJK) {
$unifonts = "uhc,uhcB,uhcI,uhcBI";
}
/* Uncomment these lines if CJK fonts available */
// else {
// $unifonts = "unbatang_0613";
// }
break;
case "zh":
if ($country == "HK" || $country == "TW") {
if ($adobeCJK) {
$unifonts = "big5,big5B,big5I,big5BI";
}
/* Uncomment these lines if CJK fonts available */
// else {
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
// }
} elseif ($country == "CN") {
if ($adobeCJK) {
$unifonts = "gb,gbB,gbI,gbBI";
}
/* Uncomment these lines if CJK fonts available */
// else {
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
// }
} else {
if ($adobeCJK) {
$unifonts = "gb,gbB,gbI,gbBI";
}
/* Uncomment these lines if CJK fonts available */
// else {
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
// }
}
break;
}
$unifonts_arr = array();
if ($unifonts) {
$unifonts_arr = preg_split('/\s*,\s*/', $unifonts);
}
return array($coreSuitable ,$unifonts_arr);
}

View file

@ -1,302 +0,0 @@
<?php
// Optionally define a folder which contains TTF fonts
// mPDF will look here before looking in the usual _MPDF_TTFONTPATH
// Useful if you already have a folder for your fonts
// e.g. on Windows: define("_MPDF_SYSTEM_TTFONTS", 'C:/Windows/Fonts/');
// Leave undefined if not required
// define("_MPDF_SYSTEM_TTFONTS", '');
// Optionally set font(s) (names as defined below in $this->fontdata) to use for missing characters
// when using useSubstitutions. Use a font with wide coverage - dejavusanscondensed is a good start
// only works using subsets (otherwise would add very large file)
// doesn't do Indic or arabic
// More than 1 font can be specified but each will add to the processing time of the script
$this->backupSubsFont = array('dejavusanscondensed');
// Optionally set a font (name as defined below in $this->fontdata) to use for CJK characters
// in Plane 2 Unicode (> U+20000) when using useSubstitutions.
// Use a font like hannomb or sun-extb if available
// only works using subsets (otherwise would add very large file)
// Leave undefined or blank if not not required
// $this->backupSIPFont = 'sun-extb';
/*
This array defines translations from font-family in CSS or HTML
to the internal font-family name used in mPDF.
Can include as many as want, regardless of which fonts are installed.
By default mPDF will take a CSS/HTML font-family and remove spaces
and change to lowercase e.g. "Arial Unicode MS" will be recognised as
"arialunicodems"
You only need to define additional translations.
You can also use it to define specific substitutions e.g.
'frutiger55roman' => 'arial'
Generic substitutions (i.e. to a sans-serif or serif font) are set
by including the font-family in $this->sans_fonts below
To aid backwards compatability some are included:
*/
$this->fonttrans = array(
'helvetica' => 'arial',
'times' => 'timesnewroman',
'courier' => 'couriernew',
'trebuchet' => 'trebuchetms',
'comic' => 'comicsansms',
'franklin' => 'franklingothicbook',
'albertus' => 'albertusmedium',
'arialuni' => 'arialunicodems',
'zn_hannom_a' => 'hannoma',
'ocr-b' => 'ocrb',
'ocr-b10bt' => 'ocrb',
);
/*
This array lists the file names of the TrueType .ttf or .otf font files
for each variant of the (internal mPDF) font-family name.
['R'] = Regular (Normal), others are Bold, Italic, and Bold-Italic
Each entry must contain an ['R'] entry, but others are optional.
Only the font (files) entered here will be available to use in mPDF.
Put preferred default first in order.
This will be used if a named font cannot be found in any of
$this->sans_fonts, $this->serif_fonts or $this->mono_fonts
['indic'] = true; for special mPDF fonts containing Indic characters
['sip-ext'] = 'hannomb'; name a related font file containing SIP characters
If a .ttc TrueType collection file is referenced, the number of the font
within the collection is required. Fonts in the collection are numbered
starting at 1, as they appear in the .ttc file e.g.
"cambria" => array(
'R' => "cambria.ttc",
'B' => "cambriab.ttf",
'I' => "cambriai.ttf",
'BI' => "cambriaz.ttf",
'TTCfontID' => array(
'R' => 1,
),
),
"cambriamath" => array(
'R' => "cambria.ttc",
'TTCfontID' => array(
'R' => 2,
),
),
*/
$this->fontdata = array(
"dejavusanscondensed" => array(
'R' => "DejaVuSansCondensed.ttf",
'B' => "DejaVuSansCondensed-Bold.ttf",
'I' => "DejaVuSansCondensed-Oblique.ttf",
'BI' => "DejaVuSansCondensed-BoldOblique.ttf",
),
"dejavusans" => array(
'R' => "DejaVuSans.ttf",
'B' => "DejaVuSans-Bold.ttf",
'I' => "DejaVuSans-Oblique.ttf",
'BI' => "DejaVuSans-BoldOblique.ttf",
),
"dejavuserif" => array(
'R' => "DejaVuSerif.ttf",
'B' => "DejaVuSerif-Bold.ttf",
'I' => "DejaVuSerif-Italic.ttf",
'BI' => "DejaVuSerif-BoldItalic.ttf",
),
"dejavuserifcondensed" => array(
'R' => "DejaVuSerifCondensed.ttf",
'B' => "DejaVuSerifCondensed-Bold.ttf",
'I' => "DejaVuSerifCondensed-Italic.ttf",
'BI' => "DejaVuSerifCondensed-BoldItalic.ttf",
),
"dejavusansmono" => array(
'R' => "DejaVuSansMono.ttf",
'B' => "DejaVuSansMono-Bold.ttf",
'I' => "DejaVuSansMono-Oblique.ttf",
'BI' => "DejaVuSansMono-BoldOblique.ttf",
),
/* OCR-B font for Barcodes */
"ocrb" => array(
'R' => "ocrb10.ttf",
),
/* Thai fonts */
"garuda" => array(
'R' => "Garuda.ttf",
'B' => "Garuda-Bold.ttf",
'I' => "Garuda-Oblique.ttf",
'BI' => "Garuda-BoldOblique.ttf",
),
"norasi" => array(
'R' => "Norasi.ttf",
'B' => "Norasi-Bold.ttf",
'I' => "Norasi-Oblique.ttf",
'BI' => "Norasi-BoldOblique.ttf",
),
/* Indic fonts */
"ind_bn_1_001" => array(
'R' => "ind_bn_1_001.ttf",
'indic' => true,
),
"ind_hi_1_001" => array(
'R' => "ind_hi_1_001.ttf",
'indic' => true,
),
"ind_ml_1_001" => array(
'R' => "ind_ml_1_001.ttf",
'indic' => true,
),
"ind_kn_1_001" => array(
'R' => "ind_kn_1_001.ttf",
'indic' => true,
),
"ind_gu_1_001" => array(
'R' => "ind_gu_1_001.ttf",
'indic' => true,
),
"ind_or_1_001" => array(
'R' => "ind_or_1_001.ttf",
'indic' => true,
),
"ind_ta_1_001" => array(
'R' => "ind_ta_1_001.ttf",
'indic' => true,
),
"ind_te_1_001" => array(
'R' => "ind_te_1_001.ttf",
'indic' => true,
),
"ind_pa_1_001" => array(
'R' => "ind_pa_1_001.ttf",
'indic' => true,
),
/* XW Zar Arabic fonts */
"xbriyaz" => array(
'R' => "XB Riyaz.ttf",
'B' => "XB RiyazBd.ttf",
'I' => "XB RiyazIt.ttf",
'BI' => "XB RiyazBdIt.ttf",
'unAGlyphs' => true,
),
"xbzar" => array(
'R' => "XB Zar.ttf",
'B' => "XB Zar Bd.ttf",
'I' => "XB Zar It.ttf",
'BI' => "XB Zar BdIt.ttf",
'unAGlyphs' => true,
),
/* Examples of some CJK fonts */
/*
"unbatang_0613" => array(
'R' => "UnBatang_0613.ttf",
),
"sun-exta" => array(
'R' => "Sun-ExtA.ttf",
'sip-ext' => 'sun-extb',
),
"sun-extb" => array(
'R' => "Sun-ExtB.ttf",
),
"hannoma" => array(
'R' => "HAN NOM A.ttf",
'sip-ext' => 'hannomb',
),
"hannomb" => array(
'R' => "HAN NOM B.ttf",
),
'mingliu' => array (
'R' => 'mingliu.ttc',
'TTCfontID' => array (
'R' => 1,
),
'sip-ext' => 'mingliu-extb',
),
'pmingliu' => array (
'R' => 'mingliu.ttc',
'TTCfontID' => array (
'R' => 2,
),
'sip-ext' => 'pmingliu-extb',
),
'mingliu_hkscs' => array (
'R' => 'mingliu.ttc',
'TTCfontID' => array (
'R' => 3,
),
'sip-ext' => 'mingliu_hkscs-extb',
),
'mingliu-extb' => array (
'R' => 'mingliub.ttc',
'TTCfontID' => array (
'R' => 1,
),
),
'pmingliu-extb' => array (
'R' => 'mingliub.ttc',
'TTCfontID' => array (
'R' => 2,
),
),
'mingliu_hkscs-extb' => array (
'R' => 'mingliub.ttc',
'TTCfontID' => array (
'R' => 3,
),
),
*/
);
// Add fonts to this array if they contain characters in the SIP or SMP Unicode planes
// but you do not require them. This allows a more efficient form of subsetting to be used.
$this->BMPonly = array(
"dejavusanscondensed",
"dejavusans",
"dejavuserifcondensed",
"dejavuserif",
"dejavusansmono",
);
// These next 3 arrays do two things:
// 1. If a font referred to in HTML/CSS is not available to mPDF, these arrays will determine whether
// a serif/sans-serif or monospace font is substituted
// 2. The first font in each array will be the font which is substituted in circumstances as above
// (Otherwise the order is irrelevant)
// Use the mPDF font-family names i.e. lowercase and no spaces (after any translations in $fonttrans)
// Always include "sans-serif", "serif" and "monospace" etc.
$this->sans_fonts = array('dejavusanscondensed','dejavusans','freesans','liberationsans','sans','sans-serif','cursive','fantasy',
'arial','helvetica','verdana','geneva','lucida','arialnarrow','arialblack','arialunicodems',
'franklin','franklingothicbook','tahoma','garuda','calibri','trebuchet','lucidagrande','microsoftsansserif',
'trebuchetms','lucidasansunicode','franklingothicmedium','albertusmedium','xbriyaz','albasuper','quillscript'
);
$this->serif_fonts = array('dejavuserifcondensed','dejavuserif','freeserif','liberationserif','serif',
'timesnewroman','times','centuryschoolbookl','palatinolinotype','centurygothic',
'bookmanoldstyle','bookantiqua','cyberbit','cambria',
'norasi','charis','palatino','constantia','georgia','albertus','xbzar','algerian','garamond',
);
$this->mono_fonts = array('dejavusansmono','freemono','liberationmono','courier', 'mono','monospace','ocrb','ocr-b','lucidaconsole',
'couriernew','monotypecorsiva'
);

View file

@ -1,8 +0,0 @@
<?php
for ($i=0;$i<=255;$i++) {
$cw[chr($i)]=600;
}
$desc=array('Ascent'=>629,'Descent'=>-157,'CapHeight'=>562,'FontBBox'=>'[-23 -250 715 805]');
$up=-100;
$ut=50;

View file

@ -1,7 +0,0 @@
<?php
for ($i=0;$i<=255;$i++) {
$cw[chr($i)]=600;
}
$desc=array('Ascent'=>629,'Descent'=>-157,'CapHeight'=>562,'FontBBox'=>'[-113 -250 749 801]');
$up=-100;
$ut=50;

View file

@ -1,7 +0,0 @@
<?php
for ($i=0;$i<=255;$i++) {
$cw[chr($i)]=600;
}
$desc=array('Ascent'=>629,'Descent'=>-157,'CapHeight'=>562,'FontBBox'=>'[-57 -250 869 801]');
$up=-100;
$ut=50;

View file

@ -1,7 +0,0 @@
<?php
for ($i=0;$i<=255;$i++) {
$cw[chr($i)]=600;
}
$desc=array('Ascent'=>629,'Descent'=>-157,'CapHeight'=>562,'FontBBox'=>'[-27 -250 849 805]');
$up=-100;
$ut=50;

View file

@ -1,19 +0,0 @@
<?php
$cw=array(
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
$desc=array('Ascent'=>718,'Descent'=>-207,'CapHeight'=>718,'FontBBox'=>'[-166 -225 1000 931]');
$up=-100;
$ut=50;
$kerninfo=array( chr(49)=> array( chr(49)=> -74, ), chr(65)=> array( chr(84)=> -74, chr(86)=> -74, chr(87)=> -37, chr(89)=> -74, chr(118)=> -18, chr(119)=> -18, chr(121)=> -18, chr(146)=> -74, ), chr(70)=> array( chr(44)=> -110, chr(46)=> -110, chr(65)=> -55, ), chr(76)=> array( chr(84)=> -74, chr(86)=> -74, chr(87)=> -74, chr(89)=> -74, chr(121)=> -37, chr(146)=> -55, ), chr(80)=> array( chr(44)=> -128, chr(46)=> -128, chr(65)=> -74, ), chr(82)=> array( chr(84)=> -18, chr(86)=> -18, chr(87)=> -18, chr(89)=> -18, ), chr(84)=> array( chr(44)=> -110, chr(46)=> -110, chr(58)=> -110, chr(65)=> -74, chr(79)=> -18, chr(97)=> -110, chr(99)=> -110, chr(101)=> -110, chr(105)=> -37, chr(111)=> -110, chr(114)=> -37, chr(115)=> -110, chr(117)=> -37, chr(119)=> -55, chr(121)=> -55, ), chr(86)=> array( chr(44)=> -91, chr(46)=> -91, chr(58)=> -37, chr(65)=> -74, chr(97)=> -74, chr(101)=> -55, chr(105)=> -18, chr(111)=> -55, chr(114)=> -37, chr(117)=> -37, chr(121)=> -37, ), chr(87)=> array( chr(44)=> -55, chr(46)=> -55, chr(58)=> -18, chr(65)=> -37, chr(97)=> -37, chr(101)=> -18, chr(105)=> 0, chr(111)=> -18, chr(114)=> -18, chr(117)=> -18, chr(121)=> -8, ), chr(89)=> array( chr(44)=> -128, chr(46)=> -128, chr(58)=> -55, chr(65)=> -74, chr(97)=> -74, chr(101)=> -91, chr(105)=> -37, chr(111)=> -91, chr(112)=> -74, chr(113)=> -91, chr(117)=> -55, chr(118)=> -55, ), chr(102)=> array( chr(102)=> -18, chr(146)=> 18, ), chr(114)=> array( chr(44)=> -55, chr(46)=> -55, chr(146)=> 37, ), chr(118)=> array( chr(44)=> -74, chr(46)=> -74, ), chr(119)=> array( chr(44)=> -55, chr(46)=> -55, ), chr(121)=> array( chr(44)=> -74, chr(46)=> -74, ), chr(145)=> array( chr(145)=> -18, ), chr(146)=> array( chr(115)=> -18, chr(146)=> -18, ), );

View file

@ -1,19 +0,0 @@
<?php
$cw=array(
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
$desc=array('Ascent'=>718,'Descent'=>-207,'CapHeight'=>718,'FontBBox'=>'[-170 -228 1003 962]');
$up=-100;
$ut=50;
$kerninfo=array( chr(49)=> array( chr(49)=> -55, ), chr(65)=> array( chr(84)=> -74, chr(86)=> -74, chr(87)=> -55, chr(89)=> -91, chr(118)=> -37, chr(119)=> -18, chr(121)=> -37, chr(146)=> -55, ), chr(70)=> array( chr(44)=> -110, chr(46)=> -110, chr(65)=> -55, ), chr(76)=> array( chr(84)=> -74, chr(86)=> -74, chr(87)=> -55, chr(89)=> -91, chr(121)=> -37, chr(146)=> -55, ), chr(80)=> array( chr(44)=> -128, chr(46)=> -128, chr(65)=> -74, ), chr(82)=> array( chr(86)=> -18, chr(87)=> -18, chr(89)=> -37, ), chr(84)=> array( chr(44)=> -110, chr(46)=> -110, chr(58)=> -110, chr(65)=> -74, chr(79)=> -18, chr(97)=> -74, chr(99)=> -74, chr(101)=> -74, chr(105)=> -18, chr(111)=> -74, chr(114)=> -55, chr(115)=> -74, chr(117)=> -74, chr(119)=> -74, chr(121)=> -74, ), chr(86)=> array( chr(44)=> -91, chr(46)=> -91, chr(58)=> -55, chr(65)=> -74, chr(97)=> -55, chr(101)=> -55, chr(105)=> -18, chr(111)=> -74, chr(114)=> -55, chr(117)=> -37, chr(121)=> -37, ), chr(87)=> array( chr(44)=> -55, chr(46)=> -55, chr(58)=> -18, chr(65)=> -55, chr(97)=> -37, chr(101)=> -18, chr(105)=> -8, chr(111)=> -18, chr(114)=> -18, chr(117)=> -18, chr(121)=> -18, ), chr(89)=> array( chr(44)=> -110, chr(46)=> -110, chr(58)=> -74, chr(65)=> -91, chr(97)=> -55, chr(101)=> -55, chr(105)=> -37, chr(111)=> -74, chr(112)=> -55, chr(113)=> -74, chr(117)=> -55, chr(118)=> -55, ), chr(102)=> array( chr(146)=> 18, ), chr(114)=> array( chr(44)=> -55, chr(46)=> -55, chr(146)=> 37, ), chr(118)=> array( chr(44)=> -74, chr(46)=> -74, ), chr(119)=> array( chr(44)=> -37, chr(46)=> -37, ), chr(121)=> array( chr(44)=> -74, chr(46)=> -74, ), chr(145)=> array( chr(145)=> -37, ), chr(146)=> array( chr(115)=> -37, chr(146)=> -37, ), );

View file

@ -1,19 +0,0 @@
<?php
$cw=array(
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
$desc=array('Ascent'=>718,'Descent'=>-207,'CapHeight'=>718,'FontBBox'=>'[-174 -228 1114 962]');
$up=-100;
$ut=50;
$kerninfo=array( chr(49)=> array( chr(49)=> -74, ), chr(65)=> array( chr(84)=> -74, chr(86)=> -74, chr(87)=> -55, chr(89)=> -74, chr(146)=> -55, ), chr(70)=> array( chr(44)=> -110, chr(46)=> -110, chr(65)=> -55, ), chr(76)=> array( chr(84)=> -74, chr(86)=> -55, chr(87)=> -55, chr(89)=> -74, chr(146)=> -74, ), chr(80)=> array( chr(44)=> -128, chr(46)=> -128, chr(65)=> -74, ), chr(82)=> array( chr(84)=> -18, chr(87)=> -18, chr(89)=> -18, ), chr(84)=> array( chr(44)=> -74, chr(46)=> -74, chr(58)=> -74, chr(65)=> -74, chr(79)=> -18, chr(97)=> -37, chr(99)=> -37, chr(101)=> -37, chr(105)=> -18, chr(111)=> -37, chr(114)=> -18, chr(115)=> -37, chr(117)=> -18, chr(119)=> -37, chr(121)=> -37, ), chr(86)=> array( chr(44)=> -91, chr(46)=> -91, chr(58)=> -37, chr(65)=> -74, chr(97)=> -37, chr(101)=> -37, chr(105)=> -37, chr(111)=> -37, chr(114)=> -18, chr(117)=> -18, chr(121)=> -18, ), chr(87)=> array( chr(44)=> -74, chr(46)=> -74, chr(58)=> -37, chr(65)=> -55, chr(97)=> -18, chr(101)=> -18, chr(105)=> -8, chr(111)=> -18, chr(114)=> -18, chr(117)=> -18, chr(121)=> -18, ), chr(89)=> array( chr(44)=> -91, chr(46)=> -91, chr(58)=> -55, chr(65)=> -74, chr(97)=> -37, chr(101)=> -37, chr(105)=> -37, chr(111)=> -37, chr(112)=> -37, chr(113)=> -37, chr(117)=> -37, chr(118)=> -37, ), chr(102)=> array( chr(102)=> -18, chr(146)=> 18, ), chr(114)=> array( chr(44)=> -55, chr(46)=> -55, chr(146)=> 37, ), chr(118)=> array( chr(44)=> -55, chr(46)=> -55, ), chr(119)=> array( chr(44)=> -37, chr(46)=> -37, ), chr(121)=> array( chr(44)=> -37, chr(46)=> -37, ), chr(145)=> array( chr(145)=> -37, ), chr(146)=> array( chr(115)=> -18, chr(116)=> 18, chr(146)=> -37, ), );

View file

@ -1,19 +0,0 @@
<?php
$cw=array(
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
$desc=array('Ascent'=>718,'Descent'=>-207,'CapHeight'=>718,'FontBBox'=>'[-170 -225 1116 931]');
$up=-100;
$ut=50;
$kerninfo=array( chr(49)=> array( chr(49)=> -74, ), chr(65)=> array( chr(84)=> -74, chr(86)=> -55, chr(87)=> -18, chr(89)=> -74, chr(118)=> -18, chr(119)=> -18, chr(121)=> -8, chr(146)=> -37, ), chr(70)=> array( chr(44)=> -128, chr(46)=> -128, chr(65)=> -74, ), chr(76)=> array( chr(84)=> -74, chr(86)=> -55, chr(87)=> -37, chr(89)=> -91, chr(121)=> -18, chr(146)=> -55, ), chr(80)=> array( chr(44)=> -128, chr(46)=> -128, chr(65)=> -74, ), chr(82)=> array( chr(84)=> -18, chr(86)=> -18, chr(87)=> -18, chr(89)=> -37, ), chr(84)=> array( chr(44)=> -91, chr(46)=> -91, chr(58)=> -74, chr(65)=> -74, chr(79)=> -18, chr(97)=> -91, chr(99)=> -91, chr(101)=> -91, chr(105)=> -8, chr(111)=> -91, chr(114)=> -74, chr(115)=> -91, chr(117)=> -74, chr(119)=> -74, chr(121)=> -74, ), chr(86)=> array( chr(44)=> -74, chr(46)=> -74, chr(58)=> -18, chr(65)=> -55, chr(97)=> -37, chr(101)=> -37, chr(105)=> -18, chr(111)=> -37, chr(114)=> -18, chr(117)=> -18, chr(121)=> -18, ), chr(87)=> array( chr(44)=> -37, chr(46)=> -37, chr(65)=> -18, chr(97)=> -18, chr(101)=> -18, chr(105)=> -8, ), chr(89)=> array( chr(44)=> -91, chr(46)=> -91, chr(58)=> -37, chr(65)=> -55, chr(97)=> -74, chr(101)=> -55, chr(105)=> -18, chr(111)=> -55, chr(112)=> -55, chr(113)=> -55, chr(117)=> -37, chr(118)=> -37, ), chr(102)=> array( chr(146)=> 37, ), chr(114)=> array( chr(44)=> -55, chr(46)=> -37, chr(146)=> 37, ), chr(118)=> array( chr(44)=> -74, chr(46)=> -74, ), chr(119)=> array( chr(44)=> -55, chr(46)=> -55, ), chr(121)=> array( chr(44)=> -74, chr(46)=> -74, ), chr(145)=> array( chr(145)=> -37, ), chr(146)=> array( chr(115)=> -18, chr(146)=> -37, ), );

Some files were not shown because too many files have changed in this diff Show more