Closed tomvlk closed 8 years ago
@tomvlk You are kind to explain more detailed?
Also, look to some change there:
https://github.com/LuckyCyborg/simple-mvc-framework/tree/3.0-final-stage
@tomvlk BTW, you are about to kill the \Nova\Net\Router :smirk:
It use all those Classes.
@LuckyCyborg some lines in the actual 3.0-beta:
In the \Nova\Core\Controller:
View::addHeader('Content-Type: application/json');
and
View::addHeader('Content-Type: text/html; charset=UTF-8');
Btw, please test your eventmanager, view and stuff on this pull: https://github.com/simple-mvc-framework/framework/pull/285
Yep, it is OK, for now, using this support from View.
In future, maybe we enhance \Nova\Net\Response and we move the headers there.
And please revert all changes on Routing and Controllers!
You kill the Routing, man!
@LuckyCyborg is it in the pull? And in the reformat commit? Or changed earlier? Because I think the reformat isn't carefully done... I will correct tomorrow.
@tomvlk Look, I work now right on Controllers, integration with EventManager, and Routing. Do not enter there, because our changes will overload. OK?
@tomvlk Also, I work in Templates, as the Hooks being nuked. All its job is done right now by EventManager.
@LuckyCyborg I will revert the reformat commit.
@tomvlk BTW, how about to move TableBuilder in \Nova\Database namespace?
@tomvlk If you want to see how EventManager works, look in my branch, in \App\Core\BaseController
And revert, please:
https://github.com/tomvlk/php-framework/commit/2bdd5bcec00669663fb0becf38f16f888024a281
I have the habit to look at uses to see what use the Class
Could you check out https://github.com/tomvlk/php-framework/tree/3.0-cleanup-code-styles again. Is it still conflicting? I revert the reformat commit in a new commit. The only stuff that should be changed is phpdoc, returning statements and some other bugs!
@LuckyCyborg Done
@tomvlk OK. Again, us to work together, we need to work in different components. OR we hit the heads in code. :smile:
@tomvlk Even there you touched the Routing
https://github.com/tomvlk/php-framework/commit/2e26e4ef914bc1725b907c61b991eb7230f4cbdf
@tomvlk BTW, you want to do something very useful? How strong you are on REGEX?
@tomvlk And another thing, to understand what is my work:
There is an internal repository, where is a framework arrived around 20 times bigger than what we write, from were I try to catch the essentials elements, to port there, leaving open the window to extend the App to original level. Wat I do is so called backporting
Because those are the orders, to enhance SVMC and use as Base Framework. That's why some time appear code sequences who looks strange for moment.
@LuckyCyborg, what we need to do with RegEx?
@LuckyCyborg tomvlk@2e26e4e has some good improvements in it. My RegEx is not pro pro but I heard @volter9 is good in it?!? :laughing: Anyway, merging this wouldn't a big problem!
@tomvlk haha, dark sarcasm in the classroom :)
I'm just asking if I could help with RegEx.
@LuckyCyborg Btw, I got something better than the Form helper. (https://github.com/ValkSystems/bootbuilder) @volter9 :laughing:
@volter9 There is a little Language Files Updater script, living in /scripts/makelangs.php, who do, in few words:
Look in all PHP files for translation functions, the __() and __d(), then extract the variables.
In first one, it extract first string and update the App Language files, in second case, capture both first and second parameter string. Then update the files from Language Domains, ie System, Modules, Templates.
The thing works, but there is a small problem: do not find right the counterpart ')', when in the transation string is (), the result is visible there:
'The :field field may only contain alpha characters (a-z' => '',
See something strange? It eat the last part of string: ').'
Will be very nice to be enhanced this little script to find the right ().
@tomvlk How about to have AdminLTE by default, for Admin/Backend part? :smirk:
@LuckyCyborg I believe it would be something like that: http://rubular.com/r/gubQemZXUG
Right now I'm writing from mobile, so I can't really test it out in action, but RegEx is working. You can tweak it to get the best result. :)
@volter9 Cool! And for language domains ? It is _d('domain', 'translated string', param, param, ...)
The functions accept variable parameters.
Depends on what you want to parse those parameters as. Gimme some input -> value so I had the idea of how does RegEx should look like.
@volter9 For example:
__d('system', 'anc )', $test1, $test2);
__('foo ) 123', $test1, $test2);
First case, serve to capture in preg_match both domain and second string In the second case, should capture only first string
@volter9 The real offender line:
'validate_alpha' => __d('system', 'The :field field may only contain alpha characters (a-z).'),
@volter9 The NOW regex-es:
if($workPath == 'app') {
$pattern = '#__\((\'|")(.*)\1(?:,.*){0,1}\)#smU';
}
else {
$pattern = '#__d\((.+?),(.+?)\)#s';
}
So you basically need to parse only those first two values?
@volter9 the pattern for __d need to capture the first two strings, being separated with ',', while the pattern for __() should capture the first string. Both function have optional parameters starting with, guess what? '$' Those should be ignored.
Try this with domain strings: http://rubular.com/r/u4CpfThbnY
I can't really think straight, I'll try more tomorrow. I also don't think that RegEx is the right tool for this job.
@volter9 Thanks! And we will leave to tomorrow!
BTW, the domain one works almost perfect, with no parameters, but if you add one, do not match nothing.
Another try: http://rubular.com/r/M1zCEPGMY0
This one captures with additional parameters, but there's one problem, it can't have $
sign inside of the string.
@volter9 Nice! Thanks! I will look!
BTW, I arrived to those patterns right now:
__\(\'(.*)\'(?:,.*)?\)
__d\(\'(?:.*)?\',.?\s?\'(.*)\'(?:,.*)?\)
First one is for __() and both support $ in string. Also, I tested there for real PHP PCRE style.
Sure, there is huge room for enhancing, to make our little script tool smart. :smirk:
BUT, I believe that to make the updater smart-ass, there is where to work, in regex-es. To note that are used with preg_match_all.
@volter9 Also, I know you being an "oldie" in SMVC. About what exactly is/was used the Hooks system in SVMC?
That Hooks system create problems in now SMVC3/Nova code, with our style of Controller/View and EventManager.
So, I suggest nuking the Hooks, and using the Events for doing its job. Eventually, we can write a particular Hooks system, "similar" with old one, but working in the new environment. Looks there how is possible to collect Views variables via Events system and Controllers.
@volter9 For example... there is an example, and the message text is received from another Controller, via Events Manager.
@volter9 Looks there for my current development:
https://github.com/LuckyCyborg/simple-mvc-framework/tree/3.0-final-stage
I'm not that "oldie" :) I started watching this repo in September of 2014, I think. I never used hook system, though. Right now I'm not doing PHP much. I'm just watching this repository :)
By the way, you did a great job. 400 commits, wow!
I noticed by doing a big cleanup and bugfix that on some files the View class functions are called staticly. @LuckyCyborg can you please look into this if you have any time? I wasn't 100% sure what to do there.