From e580832934c7bd17e25fbf60c70faffbd88fe6dc Mon Sep 17 00:00:00 2001 From: rMalie Date: Thu, 26 Apr 2012 08:55:55 +0000 Subject: [PATCH] // Use protected instead of private for classes we can override #PSCFV-1976 --- classes/AddressFormat.php | 2 +- classes/County.php | 4 +- classes/FileUploader.php | 7 +-- classes/Language.php | 2 +- classes/ObjectModel.php | 2 +- classes/Profile.php | 2 +- classes/Tools.php | 2 +- classes/Upgrader.php | 6 +- classes/shop/ShopUrl.php | 4 +- classes/tax/TaxRulesTaxManager.php | 2 +- .../webservice/WebserviceOutputBuilder.php | 12 ++-- .../WebserviceSpecificManagementImages.php | 58 +++++++++---------- .../admin/AdminAddressesController.php | 2 +- .../admin/AdminAttachmentsController.php | 2 +- .../AdminAttributeGeneratorController.php | 12 ++-- .../admin/AdminCategoriesController.php | 2 +- .../admin/AdminCmsContentController.php | 6 +- controllers/admin/AdminCmsController.php | 2 +- .../admin/AdminEmployeesController.php | 6 +- controllers/admin/AdminImagesController.php | 4 +- controllers/admin/AdminImportController.php | 20 +++---- .../admin/AdminManufacturersController.php | 2 +- controllers/admin/AdminModulesController.php | 38 ++++++------ .../admin/AdminModulesPositionsController.php | 2 +- controllers/admin/AdminShippingController.php | 2 +- .../admin/AdminSupplyOrdersController.php | 2 +- controllers/admin/AdminThemesController.php | 2 +- 27 files changed, 103 insertions(+), 104 deletions(-) diff --git a/classes/AddressFormat.php b/classes/AddressFormat.php index e715a16f2..74ac2b9cd 100644 --- a/classes/AddressFormat.php +++ b/classes/AddressFormat.php @@ -36,7 +36,7 @@ class AddressFormatCore extends ObjectModel /** @var string */ public $format; - private $_errorFormatList = array(); + protected $_errorFormatList = array(); /** * @see ObjectModel::$definition diff --git a/classes/County.php b/classes/County.php index f75e4e93f..8fa357b72 100644 --- a/classes/County.php +++ b/classes/County.php @@ -49,8 +49,8 @@ class CountyCore extends ObjectModel ), ); - private static $_cache_get_counties = array(); - private static $_cache_county_zipcode = array(); + protected static $_cache_get_counties = array(); + protected static $_cache_county_zipcode = array(); const USE_BOTH_TAX = 0; const USE_COUNTY_TAX = 1; diff --git a/classes/FileUploader.php b/classes/FileUploader.php index 39b9bcc97..77823d139 100755 --- a/classes/FileUploader.php +++ b/classes/FileUploader.php @@ -27,10 +27,9 @@ class FileUploaderCore { - - private $allowedExtensions = array(); - private $file; - private $sizeLimit; + protected $allowedExtensions = array(); + protected $file; + protected $sizeLimit; public function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760) { diff --git a/classes/Language.php b/classes/Language.php index 0e948a7f4..76533b7ba 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -698,7 +698,7 @@ class LanguageCore extends ObjectModel return copy(dirname(__FILE__).'/../img/l/none.jpg', dirname(__FILE__).'/../img/l/'.$id.'.jpg'); } - private static $_cache_language_installation = null; + protected static $_cache_language_installation = null; public static function isInstalled($iso_code) { if (self::$_cache_language_installation === null) diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index c05098853..034a927a5 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -59,7 +59,7 @@ abstract class ObjectModelCore protected $id_shop = null; - private $get_shop_from_context = true; + protected $get_shop_from_context = true; protected static $fieldsRequiredDatabase = null; diff --git a/classes/Profile.php b/classes/Profile.php index ed4d03446..cd8ad2533 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -43,7 +43,7 @@ class ProfileCore extends ObjectModel ), ); - private static $_cache_accesses = array(); + protected static $_cache_accesses = array(); /** * Get all available profiles diff --git a/classes/Tools.php b/classes/Tools.php index 2b8d32d21..6b62167cf 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1534,7 +1534,7 @@ class ToolsCore return Media::cccJS($js_files); } - private static $_cache_nb_media_servers = null; + protected static $_cache_nb_media_servers = null; public static function getMediaServer($filename) { diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 4337bb8ce..a0cd12f9a 100644 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -33,9 +33,9 @@ class UpgraderCore /** * @var boolean contains true if last version is not installed */ - private $need_upgrade = false; - private $changed_files = array(); - private $missing_files = array(); + protected $need_upgrade = false; + protected $changed_files = array(); + protected $missing_files = array(); public $version_name; public $version_num; diff --git a/classes/shop/ShopUrl.php b/classes/shop/ShopUrl.php index 40ffc25ea..b1331b9ce 100644 --- a/classes/shop/ShopUrl.php +++ b/classes/shop/ShopUrl.php @@ -35,8 +35,8 @@ class ShopUrlCore extends ObjectModel public $main; public $active; - private static $main_domain = null; - private static $main_domain_ssl = null; + protected static $main_domain = null; + protected static $main_domain_ssl = null; /** * @see ObjectModel::$definition diff --git a/classes/tax/TaxRulesTaxManager.php b/classes/tax/TaxRulesTaxManager.php index ecf22bc28..40b049565 100644 --- a/classes/tax/TaxRulesTaxManager.php +++ b/classes/tax/TaxRulesTaxManager.php @@ -35,7 +35,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface public $type; public $tax_calculator; - private static $cache_tax_calculator; + protected static $cache_tax_calculator; /** diff --git a/classes/webservice/WebserviceOutputBuilder.php b/classes/webservice/WebserviceOutputBuilder.php index ba1e00fa5..f149856c2 100755 --- a/classes/webservice/WebserviceOutputBuilder.php +++ b/classes/webservice/WebserviceOutputBuilder.php @@ -420,7 +420,7 @@ class WebserviceOutputBuilderCore * @param $ws_params webserviceParams from the entity * @return string */ - private function renderSchema($object, $ws_params) + protected function renderSchema($object, $ws_params) { $output = $this->objectRender->renderNodeHeader($ws_params['objectNodeName'], $ws_params); foreach ($ws_params['fields'] as $field_name => $field) @@ -499,7 +499,7 @@ class WebserviceOutputBuilderCore * @param int $depth * @return string */ - private function renderField($object, $ws_params, $field_name, $field, $depth) + protected function renderField($object, $ws_params, $field_name, $field, $depth) { $output = ''; $show_field = true; @@ -560,7 +560,7 @@ class WebserviceOutputBuilderCore * @param $ws_params * @return string */ - private function renderAssociations($object, $depth, $associations, $ws_params) + protected function renderAssociations($object, $depth, $associations, $ws_params) { $output = $this->objectRender->renderAssociationWrapperHeader(); foreach ($associations as $assoc_name => $association) @@ -643,7 +643,7 @@ class WebserviceOutputBuilderCore return $output; } - private function renderFlatAssociation($object, $depth, $assoc_name, $resource_name, $fields_assoc, $object_assoc, $parent_details) + protected function renderFlatAssociation($object, $depth, $assoc_name, $resource_name, $fields_assoc, $object_assoc, $parent_details) { $output = ''; $more_attr = array(); @@ -721,7 +721,7 @@ class WebserviceOutputBuilderCore $this->specificFields[$field_name] = array('entity'=>$entity_name, 'object' => $object, 'method' => $method, 'type' => gettype($object)); return $this; } - private function validateObjectAndMethod($object, $method) + protected function validateObjectAndMethod($object, $method) { if (is_string($object) && !class_exists($object)) throw new WebserviceException ('The object you want to set in '.__METHOD__.' is not allowed.', array(98, 500)); @@ -732,7 +732,7 @@ class WebserviceOutputBuilderCore { return $this->specificFields; } - private function overrideSpecificField($entity_name, $field_name, $field, $entity_object, $ws_params) + protected function overrideSpecificField($entity_name, $field_name, $field, $entity_object, $ws_params) { if (array_key_exists($field_name, $this->specificFields) && $this->specificFields[$field_name]['entity'] == $entity_name) { diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index ebba1f0ca..3a0853554 100755 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -39,7 +39,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage /** * @var array The type of images (general, categories, manufacturers, suppliers, stores...) */ - private $imageTypes = array( + protected $imageTypes = array( 'general' => array( 'header' => array(), 'mail' => array(), @@ -56,12 +56,12 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage /** * @var string The image type (product, category, general,...) */ - private $imageType = NULL; + protected $imageType = null; /** * @var int The maximum size supported when uploading images, in bytes */ - private $imgMaxUploadSize = 3000000; + protected $imgMaxUploadSize = 3000000; /** * @var array The list of supported mime types @@ -71,7 +71,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage /** * @var string The product image declination id */ - protected $productImageDeclinationId = NULL; + protected $productImageDeclinationId = null; /** * @var boolean If the current image management has to manage a "default" image (i.e. "No product available") @@ -150,7 +150,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * * @return boolean */ - private function manageImages() + protected function manageImages() { /* * available cases api/... : @@ -315,7 +315,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * * @return boolean */ - private function manageGeneralImages() + protected function manageGeneralImages() { $path = ''; $alternative_path = ''; @@ -393,7 +393,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage break; case 'PUT': - if ($this->writePostedImageOnDisk($path, NULL, NULL)) + if ($this->writePostedImageOnDisk($path, null, null)) { if ($this->wsObject->urlSegment[2] == 'header') { @@ -410,7 +410,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage } } - private function manageDefaultDeclinatedImages($directory, $normal_image_sizes) + protected function manageDefaultDeclinatedImages($directory, $normal_image_sizes) { $this->defaultImage = true; // Get the language iso code list @@ -455,7 +455,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage } } - private function manageListDeclinatedImages($directory, $normal_image_sizes) + protected function manageListDeclinatedImages($directory, $normal_image_sizes) { // Check if method is allowed if ($this->wsObject->method != 'GET') @@ -502,7 +502,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage return true; } - private function manageEntityDeclinatedImages($directory, $normal_image_sizes) + protected function manageEntityDeclinatedImages($directory, $normal_image_sizes) { $normal_image_size_names = array(); foreach ($normal_image_sizes as $normal_image_size) @@ -634,7 +634,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * @param string $directory the file path of the root of the images folder type * @return boolean */ - private function manageDeclinatedImages($directory) + protected function manageDeclinatedImages($directory) { // Get available image sizes for the current image type $normal_image_sizes = ImageType::getImagesTypes($this->imageType); @@ -655,7 +655,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage } - private function manageProductImages() + protected function manageProductImages() { $this->manageDeclinatedImages(_PS_PROD_IMG_DIR_); } @@ -669,7 +669,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * @param string $directory * @return boolean */ - private function manageDeclinatedImagesCRUD($filename_exists, $filename, $imageSizes, $directory) + protected function manageDeclinatedImagesCRUD($filename_exists, $filename, $imageSizes, $directory) { switch ($this->wsObject->method) { @@ -684,7 +684,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage // Modify the image case 'PUT': if ($filename_exists) - if ($this->writePostedImageOnDisk($filename, NULL, NULL, $imageSizes, $directory)) + if ($this->writePostedImageOnDisk($filename, null, null, $imageSizes, $directory)) { $this->imgToDisplay = $filename; return true; @@ -716,7 +716,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage throw new WebserviceException('This image already exists. To modify it, please use the PUT method', array(65, 400)); else { - if ($this->writePostedImageOnDisk($filename, NULL, NULL, $imageSizes, $directory)) + if ($this->writePostedImageOnDisk($filename, null, null, $imageSizes, $directory)) return true; else throw new WebserviceException('Unable to save this image', array(66, 500)); @@ -735,7 +735,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * @param string $parentPath The parent path * @return boolean */ - private function deleteImageOnDisk($filePath, $imageTypes = NULL, $parentPath = NULL) + protected function deleteImageOnDisk($filePath, $imageTypes = null, $parentPath = null) { $this->wsObject->setOutputEnabled(false); if (file_exists($filePath)) @@ -778,13 +778,13 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * @param string $parentPath * @return string */ - private function writeImageOnDisk($basePath, $newPath, $destWidth = NULL, $destHeight = NULL, $imageTypes = NULL, $parentPath = NULL) + protected function writeImageOnDisk($basePath, $newPath, $destWidth = null, $destHeight = null, $imageTypes = null, $parentPath = null) { list($sourceWidth, $sourceHeight, $type, $attr) = getimagesize($basePath); if (!$sourceWidth) throw new WebserviceException('Image width was null', array(68, 400)); - if ($destWidth == NULL) $destWidth = $sourceWidth; - if ($destHeight == NULL) $destHeight = $sourceHeight; + if ($destWidth == null) $destWidth = $sourceWidth; + if ($destHeight == null) $destHeight = $sourceHeight; switch ($type) { case 1: @@ -802,14 +802,14 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage $widthDiff = $destWidth / $sourceWidth; $heightDiff = $destHeight / $sourceHeight; - if ($widthDiff > 1 AND $heightDiff > 1) + if ($widthDiff > 1 && $heightDiff > 1) { $nextWidth = $sourceWidth; $nextHeight = $sourceHeight; } else { - if ((int)(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 OR ((int)(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 AND $widthDiff > $heightDiff)) + if ((int)(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 2 || ((int)(Configuration::get('PS_IMAGE_GENERATION_METHOD')) == 0 && $widthDiff > $heightDiff)) { $nextHeight = $destHeight; $nextWidth = (int)(($sourceWidth * $nextHeight) / $sourceHeight); @@ -888,11 +888,11 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage * @param string $parentPath * @return boolean */ - private function writePostedImageOnDisk($receptionPath, $destWidth = NULL, $destHeight = NULL, $imageTypes = NULL, $parentPath = NULL) + protected function writePostedImageOnDisk($receptionPath, $destWidth = null, $destHeight = null, $imageTypes = null, $parentPath = null) { if ($this->wsObject->method == 'PUT') { - if (isset($_FILES['image']['tmp_name']) AND $_FILES['image']['tmp_name']) + if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) { $file = $_FILES['image']; if ($file['size'] > $this->imgMaxUploadSize) @@ -923,7 +923,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage throw new WebserviceException('Error while uploading image. Please change your server\'s settings', array(74, 400)); // Try to copy image file to a temporary file - if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['image']['tmp_name'], $tmpName)) + if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($_FILES['image']['tmp_name'], $tmpName)) throw new WebserviceException('Error while copying image to the temporary directory', array(75, 400)); // Try to copy image file to the image directory else @@ -938,15 +938,15 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage } elseif ($this->wsObject->method == 'POST') { - if (isset($_FILES['image']['tmp_name']) AND $_FILES['image']['tmp_name']) + if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) { $file = $_FILES['image']; if ($file['size'] > $this->imgMaxUploadSize) throw new WebserviceException(sprintf('The image size is too large (maximum allowed is %d KB)', ($this->imgMaxUploadSize/1000)), array(72, 400)); require_once(_PS_ROOT_DIR_.'/images.inc.php'); - if (ImageManager::validateUpload($file)) + if ($error = ImageManager::validateUpload($file)) throw new WebserviceException('Image upload error : '.$error, array(76, 400)); - if (isset($file['tmp_name']) AND $file['tmp_name'] != NULL) + if (isset($file['tmp_name']) && $file['tmp_name'] != null) { if ($this->imageType == 'products') { @@ -974,7 +974,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if (!(Configuration::get('PS_OLD_FILESYSTEM') && file_exists(_PS_PROD_IMG_DIR_.$product->id.'-'.$image->id.'.jpg'))) $image->createImgFolder(); - if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($file['tmp_name'], $tmpName)) + if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($file['tmp_name'], $tmpName)) throw new WebserviceException('An error occurred during the image upload', array(76, 400)); elseif (!ImageManager::resize($tmpName, _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format)) throw new WebserviceException('An error occurred while copying image', array(76, 400)); @@ -990,7 +990,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage } elseif ($this->imageType == 'categories') { - if (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($file['tmp_name'], $tmpName)) + if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($file['tmp_name'], $tmpName)) throw new WebserviceException('An error occurred during the image upload', array(76, 400)); elseif (!ImageManager::resize($tmpName, $receptionPath)) throw new WebserviceException('An error occurred while copying image', array(76, 400)); diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 7756ed9bd..71c83ccc6 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -28,7 +28,7 @@ class AdminAddressesControllerCore extends AdminController { /** @var array countries list */ - private $countries_array = array(); + protected $countries_array = array(); public function __construct() { diff --git a/controllers/admin/AdminAttachmentsController.php b/controllers/admin/AdminAttachmentsController.php index 36a0c0445..47a763444 100644 --- a/controllers/admin/AdminAttachmentsController.php +++ b/controllers/admin/AdminAttachmentsController.php @@ -28,7 +28,7 @@ class AdminAttachmentsControllerCore extends AdminController { - private $product_attachements = array(); + protected $product_attachements = array(); public function __construct() { diff --git a/controllers/admin/AdminAttributeGeneratorController.php b/controllers/admin/AdminAttributeGeneratorController.php index 83ca7c67b..cd5a1eb38 100644 --- a/controllers/admin/AdminAttributeGeneratorController.php +++ b/controllers/admin/AdminAttributeGeneratorController.php @@ -29,8 +29,8 @@ class AdminAttributeGeneratorControllerCore extends AdminController { - private $combinations = array(); - private $product; + protected $combinations = array(); + protected $product; public function __construct() { @@ -61,7 +61,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController return array(); } - private static function createCombinations($list) + protected static function createCombinations($list) { if (count($list) <= 1) return count($list) ? array_map(create_function('$v', 'return (array($v));'), $list[0]) : $list; @@ -135,7 +135,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController } } - private static function displayAndReturnAttributeJs() + protected static function displayAndReturnAttributeJs() { $attributes = Attribute::getAttributes(Context::getContext()->language->id, true); $attribute_js = array(); @@ -158,7 +158,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController return $attribute_js; } - private static function setAttributesImpacts($id_product, $tab) + protected static function setAttributesImpacts($id_product, $tab) { $attributes = array(); foreach ($tab as $group) @@ -172,7 +172,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController ); } - private static function getAttributesImpacts($id_product) + protected static function getAttributesImpacts($id_product) { $tab = array(); $result = Db::getInstance()->executeS( diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index e1a07cee2..25321fffb 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -30,7 +30,7 @@ class AdminCategoriesControllerCore extends AdminController /** * @var object Category() instance for navigation */ - private $_category = null; + protected $_category = null; protected $position_identifier = 'id_category_to_move'; public function __construct() diff --git a/controllers/admin/AdminCmsContentController.php b/controllers/admin/AdminCmsContentController.php index 31b247b3c..1c5217fb0 100644 --- a/controllers/admin/AdminCmsContentController.php +++ b/controllers/admin/AdminCmsContentController.php @@ -28,13 +28,13 @@ class AdminCmsContentControllerCore extends AdminController { /** @var object adminCMSCategories() instance */ - private $adminCMSCategories; + protected $adminCMSCategories; /** @var object adminCMS() instance */ - private $adminCMS; + protected $adminCMS; /** @var object Category() instance for navigation*/ - private static $_category = null; + protected static $_category = null; public function __construct() { diff --git a/controllers/admin/AdminCmsController.php b/controllers/admin/AdminCmsController.php index 86fa5a138..a98cac5e1 100644 --- a/controllers/admin/AdminCmsController.php +++ b/controllers/admin/AdminCmsController.php @@ -27,7 +27,7 @@ class AdminCmsControllerCore extends AdminController { - private $_category; + protected $_category; public $id_cms_category; diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index 9e7618aca..ee963517e 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -28,13 +28,13 @@ class AdminEmployeesControllerCore extends AdminController { /** @var array profiles list */ - private $profiles_array = array(); + protected $profiles_array = array(); /** @var array themes list*/ - private $themes = array(); + protected $themes = array(); /** @var array tabs list*/ - private $tabs_list = array(); + protected $tabs_list = array(); public function __construct() { diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index 928b4b4f8..e138353aa 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -27,8 +27,8 @@ class AdminImagesControllerCore extends AdminController { - private $start_time = 0; - private $max_execution_time = 7200; + protected $start_time = 0; + protected $max_execution_time = 7200; public function __construct() { diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 81510736c..f4d9f7e39 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -592,7 +592,7 @@ class AdminImportControllerCore extends AdminController )); } - private static function rewindBomAware($handle) + protected static function rewindBomAware($handle) { // A rewind wrapper that skip BOM signature wrongly rewind($handle); @@ -600,19 +600,19 @@ class AdminImportControllerCore extends AdminController rewind($handle); } - private static function getBoolean($field) + protected static function getBoolean($field) { return (boolean)$field; } - private static function getPrice($field) + protected static function getPrice($field) { $field = ((float)str_replace(',', '.', $field)); $field = ((float)str_replace('%', '', $field)); return $field; } - private static function split($field) + protected static function split($field) { if (empty($field)) return array(); @@ -633,7 +633,7 @@ class AdminImportControllerCore extends AdminController } - private static function createMultiLangField($field) + protected static function createMultiLangField($field) { $languages = Language::getLanguages(false); $res = array(); @@ -709,14 +709,14 @@ class AdminImportControllerCore extends AdminController return $res; } - private static function setDefaultValues(&$info) + protected static function setDefaultValues(&$info) { foreach (self::$default_values as $k => $v) if (!isset($info[$k]) || $info[$k] == '') $info[$k] = $v; } - private static function setEntityDefaultValues(&$entity) + protected static function setEntityDefaultValues(&$entity) { $members = get_object_vars($entity); foreach (self::$default_values as $k => $v) @@ -724,7 +724,7 @@ class AdminImportControllerCore extends AdminController $entity->$k = $v; } - private static function fillInfo($infos, $key, &$entity) + protected static function fillInfo($infos, $key, &$entity) { if (isset(self::$validators[$key][1]) && self::$validators[$key][1] == 'createMultiLangField' && Tools::getValue('iso_lang')) { @@ -760,7 +760,7 @@ class AdminImportControllerCore extends AdminController * @param string entity 'products' or 'categories' * @return void */ - private static function copyImg($id_entity, $id_image = null, $url, $entity = 'products') + protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products') { $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $watermark_types = explode(',', Configuration::get('WATERMARK_TYPES')); @@ -2108,7 +2108,7 @@ class AdminImportControllerCore extends AdminController return count($tmp); } - private static function usortFiles($a, $b) + protected static function usortFiles($a, $b) { $a = strrev(substr(strrev($a), 0, 14)); $b = strrev(substr(strrev($b), 0, 14)); diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index f3686780d..5eda7d5c0 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -28,7 +28,7 @@ class AdminManufacturersControllerCore extends AdminController { /** @var array countries list */ - private $countries_array = array(); + protected $countries_array = array(); public function __construct() { diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 2b72d943b..320733165 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -31,7 +31,7 @@ class AdminModulesControllerCore extends AdminController /* ** @var array map with $_GET keywords and their callback */ - private $map = array( + protected $map = array( 'install' => 'install', 'uninstall' => 'uninstall', 'configure' => 'getContent', @@ -39,27 +39,27 @@ class AdminModulesControllerCore extends AdminController 'delete' => 'delete' ); - private $list_modules_categories = array(); - private $list_partners_modules = array(); - private $list_natives_modules = array(); + protected $list_modules_categories = array(); + protected $list_partners_modules = array(); + protected $list_natives_modules = array(); - private $nb_modules_total = 0; - private $nb_modules_installed = 0; - private $nb_modules_activated = 0; + protected $nb_modules_total = 0; + protected $nb_modules_installed = 0; + protected $nb_modules_activated = 0; - private $serial_modules = ''; - private $modules_authors = array(); + protected $serial_modules = ''; + protected $modules_authors = array(); - private $id_employee; - private $iso_default_country; - private $filter_configuration = array(); + protected $id_employee; + protected $iso_default_country; + protected $filter_configuration = array(); - private $xml_modules_list = 'api.prestashop.com/xml/modules_list.xml'; - private $addons_url = 'api.addons.prestashop.com'; - private $logged_on_addons = false; - private $cache_file_modules_list = '/config/xml/modules_list.xml'; - private $cache_file_default_country_modules_list = '/config/xml/default_country_modules_list.xml'; - private $cache_file_customer_modules_list = '/config/xml/customer_modules_list.xml'; + protected $xml_modules_list = 'api.prestashop.com/xml/modules_list.xml'; + protected $addons_url = 'api.addons.prestashop.com'; + protected $logged_on_addons = false; + protected $cache_file_modules_list = '/config/xml/modules_list.xml'; + protected $cache_file_default_country_modules_list = '/config/xml/default_country_modules_list.xml'; + protected $cache_file_customer_modules_list = '/config/xml/customer_modules_list.xml'; /* ** Admin Modules Controller Constructor @@ -779,7 +779,7 @@ class AdminModulesControllerCore extends AdminController ** Display Modules Lists ** */ - private $translationsTab = array(); + protected $translationsTab = array(); public function displayModuleOptions($module) { if (!isset($this->translationsTab['Disable this module'])) diff --git a/controllers/admin/AdminModulesPositionsController.php b/controllers/admin/AdminModulesPositionsController.php index 10c1d7191..aba786d1e 100644 --- a/controllers/admin/AdminModulesPositionsController.php +++ b/controllers/admin/AdminModulesPositionsController.php @@ -27,7 +27,7 @@ class AdminModulesPositionsControllerCore extends AdminController { - private $display_key = 0; + protected $display_key = 0; public function postProcess() { diff --git a/controllers/admin/AdminShippingController.php b/controllers/admin/AdminShippingController.php index a3dbeee35..b100d45a8 100644 --- a/controllers/admin/AdminShippingController.php +++ b/controllers/admin/AdminShippingController.php @@ -27,7 +27,7 @@ class AdminShippingControllerCore extends AdminController { - private $_fieldsHandling; + protected $_fieldsHandling; public function __construct() { diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 69bfc7224..07cebff81 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -34,7 +34,7 @@ class AdminSupplyOrdersControllerCore extends AdminController /* * @var array List of warehouses */ - private $warehouses; + protected $warehouses; public function __construct() { diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 8333535ac..e2ed9107e 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -273,7 +273,7 @@ class AdminThemesControllerCore extends AdminController * @param string $target_theme_dir relative path to target dir * @return boolean true if success */ - private static function copyTheme($base_theme_dir, $target_theme_dir) + protected static function copyTheme($base_theme_dir, $target_theme_dir) { $res = true; $base_theme_dir = rtrim($base_theme_dir, '/').'/';