Skip to content

Commit

Permalink
Fixed Coding Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
sensorario committed Jul 20, 2012
1 parent 30bd45e commit 01ed3b5
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 21 deletions.
32 changes: 20 additions & 12 deletions lyiightbox/ConfigWidget.php → ConfigWidget.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,63 @@
*
* @author Simone Gentili <sensorario@gmail.com>
*/
class ConfigWidget extends CWidget {

class ConfigWidget extends CWidget
{
private $scripts = null;
private $css = null;
private $assetsFolder = null;
private $assetsFolderName = 'assets';
private $baseUrl = null;

/* @todo: user patter singleton */
public function __construct() {
public function __construct()
{
parent::__construct();
}

private function populateCssArrayFiles() {
private function populateCssArrayFiles()
{
$this->css = array(
'/css/lightbox.css'
);
}

private function populateJsarrayScripts() {
private function populateJsarrayScripts()
{
$this->scripts = array(
'/js/prototype.js',
'/js/scriptaculous.js?load=effects,builder',
'/js/lightbox.js',
);
}

private function loadAllJsScript() {
private function loadAllJsScript()
{
$this->populateJsarrayScripts();

Yii::app()->getClientScript()->registerScript('_', 'lyiightboxAssetUrl = "' . (Yii::app()->getAssetManager()->publish($this->assetsFolder)) . '";', CClientScript::POS_HEAD);

foreach ($this->scripts as $filename)
foreach ($this->scripts as $filename) {
Yii::app()->getClientScript()->registerScriptFile($this->baseUrl . $filename, CClientScript::POS_END);
}
}

private function loadAllCssScripts() {
private function loadAllCssScripts()
{
$this->populateCssArrayFiles();
foreach ($this->css as $filename)
foreach ($this->css as $filename) {
Yii::app()->getClientScript()->registerCssFile($this->baseUrl . $filename);
}
}

private function setAssetsFolder() {
private function setAssetsFolder()
{
$this->assetsFolder = dirname(__FILE__) . DIRECTORY_SEPARATOR . $this->assetsFolderName;
$this->baseUrl = CHtml::asset($this->assetsFolder);
}

protected function config() {

protected function config()
{
$this->setAssetsFolder();
$this->loadAllJsScript();
$this->loadAllCssScripts();
Expand Down
25 changes: 16 additions & 9 deletions lyiightbox/Galleryii.php → Galleryii.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
*
* @author Simone Gentili <sensorario@gmail.com>
*/
class Galleryii extends ConfigWidget {

class Galleryii extends ConfigWidget
{
public $rootFolder;
public $baseFolder = '/images/galleryii';
public $thumbnails = '/thumbnails';
public $images = '/images';
public $thumbSide = 120;

private function showHelpPage() {
private function showHelpPage()
{
echo ""
. "<div class=\"form\"><div class=\"errorMessage\">"
. "Galleryii is not correctly configured.<br />"
Expand All @@ -37,15 +38,17 @@ private function showHelpPage() {
. "</div></div>";
}

private function showNumberOfFolder() {
private function showNumberOfFolder()
{
echo ""
. "<div class=\"form\"><div class=\"errorMessage\">"
. "I've found a folder for Galleryii's widget. But I've not found folders <strong>{$this->thumbnails}</strong> and <strong>{$this->images}</strong>.<br />"
. "Create theme and then reload this page."
. "</div></div>";
}

private function showThumbnails() {
private function showThumbnails()
{
$path = dirname(__FILE__) . '/../../..' . $this->baseFolder . $this->thumbnails;
$dirHandle = opendir($path);
$countImages = 0;
Expand All @@ -55,7 +58,8 @@ private function showThumbnails() {
closedir($dirHandle);
}

private function countfiles() {
private function countfiles()
{
$path = dirname(__FILE__) . '/../../..' . $this->baseFolder;
$dirHandle = opendir($path);
$dirToFound = array(
Expand All @@ -72,7 +76,8 @@ private function countfiles() {
closedir($dirHandle);
}

private function countImages() {
private function countImages()
{
$root = dirname(__FILE__) . '/../../..';
$path = $root . $this->baseFolder;
if (is_dir($path)) {
Expand All @@ -82,11 +87,13 @@ private function countImages() {
}
}

public function __construct() {
public function __construct()
{
parent::__construct();
}

public function init() {
public function init()
{
parent::config();
$this->countImages();
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Empty file modified lyiightbox.readme.makrdown
100644 → 100755
Empty file.

0 comments on commit 01ed3b5

Please sign in to comment.