Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit 3b751a3

Browse files
committed
Updated to version 1.0.9
1 parent fadb771 commit 3b751a3

File tree

74 files changed

+2461
-12296
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2461
-12296
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CHANGELOG
22

3-
## 1.1.0 - 2018-01-17
3+
## 1.1.1 - 2018-02-16
44

55
* Unit tests supported by `PHPUnit` were added.
66

@@ -18,6 +18,8 @@
1818

1919
* Implemented `Codecov` to coverage reports.
2020

21+
## 1.1.0 - 2018-01-17
22+
2123
* Added `Eliasis\Complement\Complement::getCurrentID()` method.
2224

2325
* Added `Eliasis\Complement\Complement::setCurrentID()` method.

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "eliasis-framework/complement",
3-
"version": "1.0.9",
43
"description": "PHP library for adding addition of complements for Eliasis Framework.",
54
"type": "library",
65
"keywords": [

gulpfile.js

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/**
2+
* PHP library for adding addition of complements for Eliasis Framework.
3+
*
4+
* @author Josantonius <[email protected]>
5+
* @copyright 2017 - 2018 (c) Josantonius - Eliasis Complement
6+
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
7+
* @link https://github.com/Eliasis-Framework/Complement
8+
* @since 1.0.9
9+
*/
10+
11+
var gulp = require('gulp'),
12+
concat = require('gulp-concat'),
13+
uglify = require('gulp-uglify-es').default,
14+
sass = require('gulp-sass'),
15+
plumber = require('gulp-plumber'),
16+
rename = require('gulp-rename'),
17+
cleanCSS = require('gulp-clean-css'),
18+
notify = require('gulp-notify'),
19+
sourcemaps = require('gulp-sourcemaps'),
20+
pump = require('pump'),
21+
autoprefixer = require('gulp-autoprefixer');
22+
23+
gulp.task('vue+vue-resource+eliasis-complement', function (cb) {
24+
pump([
25+
gulp.src([
26+
'node_modules/vue/dist/vue.min.js',
27+
'node_modules/vue-resource/dist/vue-resource.min.js',
28+
'node_modules/vue-module-manager/dist/vue-module-manager.min.js',
29+
'node_modules/vue-simple-notify/dist/vue-simple-notify.min.js',
30+
'src/static/js/source/eliasis-complement.js'
31+
]),
32+
concat('vue+vue-resource+eliasis-complement.min.js'),
33+
uglify(),
34+
gulp.dest('src/static/js/')
35+
], cb);
36+
});
37+
38+
gulp.task('vue-resource+eliasis-complement', function (cb) {
39+
pump([
40+
gulp.src([
41+
'node_modules/vue-resource/dist/vue-resource.min.js',
42+
'node_modules/vue-module-manager/dist/vue-module-manager.min.js',
43+
'node_modules/vue-simple-notify/dist/vue-simple-notify.min.js',
44+
'src/static/js/source/eliasis-complement.js'
45+
]),
46+
concat('vue-resource+eliasis-complement.min.js'),
47+
uglify(),
48+
gulp.dest('src/static/js/')
49+
], cb);
50+
});
51+
52+
gulp.task('vue+eliasis-complement', function (cb) {
53+
54+
pump([
55+
gulp.src([
56+
'node_modules/vue/dist/vue.min.js',
57+
'node_modules/vue-module-manager/dist/vue-module-manager.min.js',
58+
'node_modules/vue-simple-notify/dist/vue-simple-notify.min.js',
59+
'src/static/js/source/eliasis-complement.js'
60+
]),
61+
concat('vue+eliasis-complement.min.js'),
62+
uglify(),
63+
gulp.dest('src/static/js/'),
64+
], cb);
65+
66+
});
67+
68+
gulp.task('eliasis-complement', function (cb) {
69+
pump([
70+
gulp.src([
71+
'node_modules/vue-module-manager/dist/vue-module-manager.min.js',
72+
'src/static/js/source/eliasis-complement.js'
73+
]),
74+
concat('eliasis-complement.min.js'),
75+
uglify(),
76+
gulp.dest('src/static/js/'),
77+
notify({ message: 'Scripts task complete' })
78+
], cb);
79+
});
80+
81+
gulp.task('js', [
82+
'vue+vue-resource+eliasis-complement',
83+
'vue-resource+eliasis-complement',
84+
'vue+eliasis-complement',
85+
'eliasis-complement'
86+
]);
87+
88+
gulp.task('css', function () {
89+
90+
gulp.src([
91+
'node_modules/vue-module-manager/dist/vue-module-manager.min.css',
92+
'node_modules/vue-simple-notify/dist/vue-simple-notify.min.css'
93+
])
94+
.pipe(plumber())
95+
.pipe(autoprefixer({
96+
browsers: ['last 2 versions'],
97+
cascade: true
98+
}))
99+
.pipe(concat('eliasis-complement.min.css'))
100+
.pipe(cleanCSS({
101+
compatibility: 'ie8'
102+
}))
103+
.pipe(gulp.dest('src/static/css/'))
104+
.pipe(notify({ message: 'Styles task complete' }));
105+
106+
});
107+
108+
gulp.task('watch', function () {
109+
110+
var jsFiles = ['src/static/js/source/*'];
111+
112+
gulp.watch(jsFiles, ['js']);
113+
114+
});
115+
116+
gulp.task('default', ['js', 'css']);

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "complement",
3+
"version": "1.1.0",
4+
"description": "PHP library for adding addition of complements for Eliasis Framework.",
5+
"main": "gulpfile.js",
6+
"directories": {
7+
"test": "tests"
8+
},
9+
"dependencies": {},
10+
"devDependencies": {
11+
"gulp": "^3.9.1",
12+
"gulp-autoprefixer": "^4.0.0",
13+
"gulp-clean-css": "^3.9.0",
14+
"gulp-concat": "^2.6.1",
15+
"gulp-filter": "^5.0.1",
16+
"gulp-notify": "^3.0.0",
17+
"gulp-plumber": "^1.1.0",
18+
"gulp-rename": "^1.2.2",
19+
"gulp-sass": "^3.1.0",
20+
"gulp-sourcemaps": "^2.6.1",
21+
"gulp-uglify": "^3.0.0",
22+
"gulp-uglify-es": "^1.0.0",
23+
"pump": "^3.0.0",
24+
"uglify-es": "^3.3.10",
25+
"vue": "^2.5.13",
26+
"vue-module-manager": "^1.0.1",
27+
"vue-resource": "^1.3.6",
28+
"vue-simple-notify": "^1.0.5"
29+
},
30+
"repository": {
31+
"type": "git",
32+
"url": "git+https://github.com/Eliasis-Framework/Complement.git"
33+
},
34+
"author": "Josantonius",
35+
"license": "MIT",
36+
"bugs": {
37+
"url": "https://github.com/Eliasis-Framework/Complement/issues"
38+
},
39+
"homepage": "https://github.com/Eliasis-Framework/Complement#readme"
40+
}

src/Complement.php

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static function __callstatic($index, $params = false)
8383

8484
if (! array_key_exists($index, self::$instances[$appID][$type])) {
8585
$msg = self::getType('ucfirst', false) . ' not found';
86-
throw new ComplementException($msg . ': ' . $index . '.');
86+
throw new ComplementException($msg . ': ' . $index);
8787
}
8888

8989
self::$id = $index;
@@ -110,6 +110,10 @@ public static function __callstatic($index, $params = false)
110110
*/
111111
public static function run()
112112
{
113+
if (!session_id()) {
114+
session_start();
115+
}
116+
113117
$complementType = self::getType('strtoupper');
114118

115119
$path = App::$complementType();
@@ -120,7 +124,6 @@ public static function run()
120124
$_path = Url::addBackSlash($path->getPath());
121125
$slug = $path->getBasename();
122126
$file = $_path . $slug . '/' . $slug . '.jsond';
123-
124127
if (! File::exists($file)) {
125128
continue;
126129
}
@@ -139,15 +142,15 @@ public static function run()
139142
* @param string $path → complement path
140143
*
141144
* @uses \Josantonius\Json\Json::fileToArray()
142-
* @uses \Eliasis\Complement\ComplementHandler->_setComplement()
145+
* @uses \Eliasis\Complement\ComplementHandler->setComplement()
143146
*/
144147
public static function load($file, $path = false)
145148
{
146149
$complement = Json::fileToArray($file);
147150
$complement['config-file'] = $file;
148-
self::setCurrentID(isset($complement['id']) ? $complement['id'] : 'unknown');
151+
self::$id = isset($complement['id']) ? $complement['id'] : 'unknown';
149152
$that = self::getInstance();
150-
$that->_setComplement($complement, $path);
153+
$that->setComplement($complement, $path);
151154
}
152155

153156
/**
@@ -203,14 +206,13 @@ public static function getInfo($filter = 'all', $sort = 'asort')
203206
'license' => $complement['license'],
204207
'state' => $complement['state'],
205208
'slug' => $complement['slug'],
206-
'image' => $img = $complement['image'],
207-
'image_style' => "background: url(\"$img\") center / cover;",
209+
'image' => $img = $complement['image']
208210
];
209211
}
210212

211-
self::setCurrentID($id);
213+
self::setCurrentID($complementID);
212214

213-
$that->complement = $complement;
215+
self::getInstance();
214216

215217
$sorting = '|asort|arsort|krsort|ksort|natsort|rsort|shuffle|sort|';
216218

@@ -242,7 +244,9 @@ public static function getCurrentID()
242244
*/
243245
public static function setCurrentID($id)
244246
{
245-
if (array_key_exists($id, self::$instances)) {
247+
$type = self::getType();
248+
$appID = App::getCurrentID();
249+
if (array_key_exists($id, self::$instances[$appID][$type])) {
246250
self::$id = $id;
247251

248252
return true;
@@ -254,33 +258,38 @@ public static function setCurrentID($id)
254258
/**
255259
* Set and get url script and vue file.
256260
*
257-
* @param string $pathUrl → url where JS files will be created & loaded
261+
* @param string $pathUrl → url where JS files will be created & loaded
262+
* @param boolean $vue → include Vue.js in the script
263+
* @param boolean $vueResource → include vue-resource in the script
258264
*
259-
* @uses \Eliasis\Complement\ComplementView::_setFile()
265+
* @uses \Eliasis\Complement\ComplementView::setFile()
260266
*
261267
* @return array → urls of the scripts
262268
*/
263-
public static function script($pathUrl = null)
269+
public static function script($pathUrl = null, $vue = true, $vueResource = true)
264270
{
265271
$that = self::getInstance();
266272

267-
return $that->_setFile('eliasis-complement-min', 'script', $pathUrl);
273+
$file = $vue ? 'vue+' : '';
274+
$file .= $vueResource ? 'vue-resource+' : '';
275+
276+
return $that->setFile($file . 'eliasis-complement.min', 'script', $pathUrl);
268277
}
269278

270279
/**
271280
* Set and get url style.
272281
*
273282
* @param string $pathUrl → url where CSS files will be created & loaded
274283
*
275-
* @uses \Eliasis\Complement\ComplementView::_setFile()
284+
* @uses \Eliasis\Complement\ComplementView::setFile()
276285
*
277286
* @return array → urls of the styles
278287
*/
279288
public static function style($pathUrl = null)
280289
{
281290
$that = self::getInstance();
282291

283-
return $that->_setFile('eliasis-complement-min', 'style', $pathUrl);
292+
return $that->setFile('eliasis-complement.min', 'style', $pathUrl);
284293
}
285294

286295
/**
@@ -335,12 +344,12 @@ public static function getLibraryVersion()
335344
* @param array $external → urls of the external optional complements
336345
* @param string $sort → PHP sorting function to complements sort
337346
*
338-
* @uses \Eliasis\Complement\ComplementView::_renderizate()
347+
* @uses \Eliasis\Complement\ComplementView::renderizate()
339348
*/
340349
public static function render($filter = 'all', $external = 0, $sort = 'asort')
341350
{
342351
$that = self::getInstance();
343-
$that->_renderizate($filter, $external, $sort);
352+
$that->renderizate($filter, $external, $sort);
344353
}
345354

346355
/**
@@ -357,9 +366,8 @@ protected static function getInstance()
357366
$appID = App::getCurrentID();
358367
$complementID = self::getCurrentID();
359368
$complement = get_called_class();
360-
361369
if (! isset(self::$instances[$appID][$type][$complementID])) {
362-
self::$instances[$appID][$type][$complementID] = new $complement;
370+
self::$instances[$appID][$type][$complementID] = new $complement();
363371
}
364372

365373
return self::$instances[$appID][$type][$complementID];

src/Traits/ComplementAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function setAction($action)
9191
public function doAction($action)
9292
{
9393
$controller = $this->getOption('hooks-controller');
94-
$instance = $this->instance($controller, 'controller');
94+
$instance = $this->getControllerInstance($controller);
9595

9696
if (is_object($instance) && method_exists($instance, $action)) {
9797
$response = call_user_func([$instance, $action]);

0 commit comments

Comments
 (0)