Permalink
Browse files

3.0.7

  • Loading branch information...
1 parent 35e83e9 commit 55ad840d46b529aae4a94bb9d24f965aaeef8619 Kris Thom White committed Oct 31, 2013
@@ -18,12 +18,18 @@ function searchForComponents()
$arr[basename($moduleDirectory)] = array('class'=>'ext.wsshipping.'.basename($moduleDirectory).'.'.basename($moduleDirectory));
//Load any custom payment components
- foreach (glob(dirname(__FILE__).'/../../../custom/extensions/payment/*', GLOB_ONLYDIR) as $moduleDirectory)
- $arr[basename($moduleDirectory)] = array('class'=>'custom.extensions.payment.'.basename($moduleDirectory).'.'.basename($moduleDirectory));
+ $path = realpath(dirname(__FILE__).'/../../../custom/extensions/payment');
+ $arrCustom = glob($path.'/*', GLOB_ONLYDIR);
+ if($arrCustom !== false && !empty($arrCustom))
+ foreach ($arrCustom as $moduleDirectory)
+ $arr[basename($moduleDirectory)] = array('class'=>'custom.extensions.payment.'.basename($moduleDirectory).'.'.basename($moduleDirectory));
//Load any custom shipping components
- foreach (glob(dirname(__FILE__).'/../../../custom/extensions/shipping/*', GLOB_ONLYDIR) as $moduleDirectory)
- $arr[basename($moduleDirectory)] = array('class'=>'custom.extensions.shipping.'.basename($moduleDirectory).'.'.basename($moduleDirectory));
+ $path = realpath(dirname(__FILE__).'/../../../custom/extensions/shipping');
+ $arrCustom = glob($path.'/*', GLOB_ONLYDIR);
+ if($arrCustom !== false && !empty($arrCustom))
+ foreach ($arrCustom as $moduleDirectory)
+ $arr[basename($moduleDirectory)] = array('class'=>'custom.extensions.shipping.'.basename($moduleDirectory).'.'.basename($moduleDirectory));
$arr['Smtpmail'] = array('class'=>'application.extensions.smtpmail.PHPMailer');
@@ -1,5 +1,5 @@
<?php
-define('XLSWS_VERSION', '3.0.6');
-define('XLSWS_VERSIONBUILD', 3060);
-define('XLSWS_BUILDDATE', '2013-10-22 11:28:35');
+define('XLSWS_VERSION', '3.0.7');
+define('XLSWS_VERSIONBUILD', 3070);
+define('XLSWS_BUILDDATE', '2013-10-29 12:09:18');
@@ -43,6 +43,10 @@ public function actionIndex()
if (!($model instanceof CustomPage))
_xls_404();
+ //If we are in multilanguage mode, parse the description and display only the local language.
+ if(_xls_get_conf('LANG_MENU',0))
+ $model->page = _xls_parse_language($model->page);
+
$this->pageTitle=$model->PageTitle;
$this->pageDescription=$model->meta_description;
$this->pageImageUrl = '';
@@ -53,8 +57,6 @@ public function actionIndex()
$this->CanonicalUrl = $model->CanonicalUrl;
$this->render('index',array('model'=>$model,'objCustomPage'=>$model));
-
-
}
@@ -71,6 +73,10 @@ public function actionContact()
$model->title=>$model->RequestUrl,
);
+ //If we are in multilanguage mode, parse the description and display only the local language.
+ if(_xls_get_conf('LANG_MENU',0))
+ $model->page = _xls_parse_language($model->page);
+
$ContactForm=new ContactForm;
if(isset($_POST['ContactForm']))
{
@@ -119,11 +119,18 @@ protected function createThumb($objImage,$intNewWidth,$intNewHeight,$type)
$image = Yii::app()->image->load($strOriginalFileWithPath);
- $image->resize($intNewWidth,$intNewHeight)
- ->quality(_xls_get_conf('IMAGE_QUALITY','75'))
- ->sharpen(_xls_get_conf('IMAGE_SHARPEN','20'));
-
+ $quality = _xls_get_conf('IMAGE_QUALITY', '75');
+ $sharpness = _xls_get_conf('IMAGE_SHARPEN', '20');
+
+ if($sharpness != 0){
+ $image->resize($intNewWidth,$intNewHeight)
+ ->quality($quality)
+ ->sharpen($sharpness);
+ } else {
+ $image->resize($intNewWidth,$intNewHeight)
+ ->quality($quality);
+ }
if (Images::IsWritablePath($strNewThumbnail)) //Double-check folder permissions
{
@@ -257,31 +257,61 @@ public function SaveImageFolder($strFolder) {
/* Save blob to file */
public function SaveImageData($strName, $blbImage) {
- $this->DeleteImage();
+ $this->DeleteImage();
- $strPath = Images::GetImagePath($strName);
- $arrPath = mb_pathinfo($strPath);
+ $strPath = Images::GetImagePath($strName);
+ $arrPath = mb_pathinfo($strPath);
- $strFolder = $arrPath['dirname'];
- $strSaveFunc = 'imagepng';
+ $strFolder = $arrPath['dirname'];
+ $strSaveFunc = 'imagepng';
- if ($arrPath['extension'] == 'jpg')
- $strSaveFunc = 'imagejpeg';
+ if ($arrPath['extension'] == 'jpg')
+ $strSaveFunc = 'imagejpeg';
- if ($arrPath['extension'] == 'gif')
- $strSaveFunc = 'imagegif';
+ if ($arrPath['extension'] == 'gif')
+ $strSaveFunc = 'imagegif';
- if ($this->SaveImageFolder($strFolder) && $strSaveFunc($blbImage, $strPath))
+ if ($strSaveFunc=="imagepng")
+ {
+ //Set transparency
+ $retVal = $this->check_transparent($blbImage);
+ if($retVal)
{
- $this->image_path = $strName;
- return true;
- }
- else {
- Yii::log("Failed to save file $strName", 'image', __FUNCTION__);
- return false;
+ imagealphablending($blbImage, false);
+ imagesavealpha($blbImage, true);
}
+ }
+
+ if ($this->SaveImageFolder($strFolder) && $strSaveFunc($blbImage, $strPath))
+ {
+ $this->image_path = $strName;
+ return true;
+ }
+ else {
+ Yii::log("Failed to save file $strName", 'image', __FUNCTION__);
+ return false;
+ }
+
+
+ }
+
+ protected function check_transparent($im) {
+ $width = imagesx($im); // Get the width of the image
+ $height = imagesy($im); // Get the height of the image
+ // We run the image pixel by pixel and as soon as we find a transparent pixel we stop and return true.
+ for($i = 0; $i < $width; $i++) {
+ for($j = 0; $j < $height; $j++) {
+ $rgba = imagecolorat($im, $i, $j);
+ if(($rgba & 0x7F000000) >> 24) {
+ return true;
+ }
+ }
+ }
+
+ // If we don't find any pixel the function will return false.
+ return false;
}
/* If we do not have an image, pass back our default Not Found graphic URL
@@ -126,6 +126,7 @@ h3 { margin-top: 2px; }
#thememanage .theme {
margin-left: 0px;
}
+.langedit { margin-bottom: -1px; }
#btnCopy { display: hidden;}
@@ -93,9 +93,28 @@ public function actionEdit()
$this->redirect($this->createUrl("custompage/index"));
}
- if(isset($_POST['CustomPage']))
+
+ if (_xls_get_conf('LANG_MENU'))
{
+ $langs = _xls_comma_to_array(_xls_get_conf('LANGUAGES'));
+ $def = _xls_get_conf('LANG_CODE');
+
+ Yii::log('POST: ' . print_r($_POST,true), 'error', 'application.'.__CLASS__.".".__FUNCTION__);
+
+ if(isset($_POST['content-'.$def]))
+ $_POST['CustomPage']['page']='<'.$def.'>'.$_POST['content-'.$def].'</'.$def.'>';
+
+ foreach ($langs as $i=>$v)
+ if(isset($_POST['content-'.substr($v,0,2)]))
+ {
+ $_POST['CustomPage']['page'].='<'.substr($v,0,2).'>'.$_POST['content-'.substr($v,0,2)].'</'.substr($v,0,2).'>';
+ }
+
+
+ }
+ if(isset($_POST['CustomPage']))
+ {
$model->attributes = $_POST['CustomPage'];
if ($model->validate())
{
@@ -98,7 +98,7 @@ public function getInstructions($id)
return "To edit the actual language strings, use the Translation menu options under ".CHtml::link("Database",$this->createUrl("databaseadmin/index"));
case self::PRODUCT_PHOTOS:
- return "Photo sizes are now under the ".CHtml::link("Themes->Set Photo Sizes",$this->createUrl('theme/edit',array('id'=>self::THEME_PHOTOS)))." menu. Please note these settings affect photos as they are uploaded. You will need to reflag a product photo and Update Store to see the changes. Note: Using FancyBox requires additional one-time license purchase from ".CHtml::link('http://www.fancyapps.com/store/','http://www.fancyapps.com/store/');
+ return "Photo sizes are now under the ".CHtml::link("Themes->Set Photo Sizes",$this->createUrl('theme/edit',array('id'=>self::THEME_PHOTOS)))." menu. Please note these settings affect photos as they are uploaded. You will need to reflag a product photo and Update Store to see the changes.";
case self::SEO_PRODUCT:
return "<P>These settings control the Page Title and Meta Description using keys that represent product information. Each of these keys is wrapped with a percentage ({) sign. Most represent fields in the Product Card. {crumbtrail} and {rcrumbtrail} (reverse crumbtrail) are the product's category path. Below is the available list of keys:</p><P>{storename}, {name}, {description}, {shortdescription}, {longdescription}, {price}, {family}, {class}, {crumbtrail}, {rcrumbtrail}</p>You can use {storename} and {storetagline} for the homepage.";
@@ -59,27 +59,60 @@
</div>
+
<div class="span11">
<h4>Edit Page Content</h4>
<div class="tip">Click on the first tool on the toolbar to switch to editing HTML directly. Note this editor can be used for HTML and CSS, but any scripting language like JavaScript will not be functional.</div>
- <?php
- $this->widget('ImperaviRedactorWidget', array(
- 'model' => $model,
- 'attribute' => 'page',
- 'htmlOptions'=>array('style'=>"height: 400px; padding-bottom: 20px;"),
- 'options' => array(
- 'lang' => 'en',
- 'width'=> '500',
- 'height'=> '400',
- 'autoresize'=>false,
- 'convertDivs'=>false,
- ),
- ));
- ?>
- </div>
+ <p></p>
+
+
+ <?php if (_xls_get_conf('LANG_MENU'))
+ $langs = _xls_comma_to_array(_xls_get_conf('LANG_OPTIONS'));
+ else $langs=array("en:English");
+ ?>
+ <div class="tabbable">
+ <ul class="nav nav-tabs langedit">
+ <?php if(count($langs)>1)
+ foreach($langs as $lang)
+ {
+ $langa = explode(":",$lang);
+ echo '<li '.($langa[0]=='en' ? 'class="active"' : '').
+ '><a href="#'.$langa[0].'" data-toggle="tab">'.$langa[1].'</a></li>';
+ }
+ ?>
+ </ul>
+
+ <div class="tab-content">
+ <?php
+ $origLang = Yii::app()->language;
+ foreach($langs as $lang)
+ {
+ $langa = explode(":",$lang);
+ Yii::app()->language = $langa[0];
+ echo '<div class="tab-pane'.($langa[0]=='en' ? ' active' : '').'" id="'.$langa[0].'">';
+ $this->widget('ImperaviRedactorWidget', array(
+ 'name' => (count($langs)>1 ? 'content-'.$langa[0] : 'CustomPage[page]'),
+ 'value'=> (count($langs)>1 ? _xls_parse_language($model->page) : $model->page),
+ 'attribute' => 'page',
+ 'htmlOptions'=>array('style'=>"height: 400px; padding-bottom: 20px;"),
+ 'options' => array(
+ 'width'=> '500',
+ 'height'=> '400',
+ 'autoresize'=>false,
+ 'convertDivs'=>false,
+ 'linebreaks'=>true,
+ ),
+ ));
+ echo '</div>';
+ }
+ Yii::app()->language = $origLang;
+ ?>
+ </div>
+ </div>
+ </div> <!-- /tabbable -->
- <div class="row">
+ <div class="row">
<div class="span11">
<div class="row">
<P></P>

0 comments on commit 55ad840

Please sign in to comment.