Former Staff .InyaProduction 1124 Posted November 25, 2014 Former Staff Share Posted November 25, 2014 Hey guys, im currently working on a small PHP library called DreamPHP and I'm searching for some contributors. I just started and well its just a beginning till now. For the first thing this library collection support I've made a Gravatar library. More will follow in the next days and i hope to find someone who has fun developing this with me. The library is completely free and open source. If you want to contribute please feel free to contact me and for some informations head over here: DreamPHP This is the hidden content, please Sign In or Sign Up Also make suggestions, what you want to see. It can be metin2 related stuff aswell as everything else. Some ideas i got in my head is: Bootstrap support (loading, generating forms and tables etc) MySQL, MySQLi, PDO librarys and some other stuff you can ask me for that Greetings, Inya PS: I don't want opinions about frameworks like smarty or anything (which can be used beside this lib anyways and may be integrated). Im just searching for contributors 1 1 Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted November 25, 2014 Premium Share Posted November 25, 2014 Nice project, I'll follow it for sure Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted November 25, 2014 Author Former Staff Share Posted November 25, 2014 Nice project, I'll follow it for sure Thank you, I hope to find some contributors too, so that its faster and with more than just 2 eyes 1 Link to comment Share on other sites More sharing options...
lolor2 73 Posted November 25, 2014 Share Posted November 25, 2014 if(!in_array($rating, $ratings)) die("No valid rating type"); $this->_settings['rating'] = $rating; please dont else something like the apple bug gonna happen again do full brackets around the IF statement Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted November 25, 2014 Author Former Staff Share Posted November 25, 2014 What apple bug? oO Yeah well i will correct that asap Link to comment Share on other sites More sharing options...
Mashkin 16 Posted November 25, 2014 Share Posted November 25, 2014 What apple bug? oO Yeah well i will correct that asap http://embeddedgurus.com/barr-code/2014/03/apples-gotofail-ssl-security-bug-was-easily-preventable/ Missing braces around blocks can easily lead to false branching. I think your project needs some clear (rough) aim so interested developers can think about what could benefit this project. There are already plenty of specialized libraries for e.g. database abstraction. There are also many sites providing useful classes and helpers (with questionable code quality, maybe). What I'm actually missing is an easy Bootstrap widget system for PHP - there are some for several frameworks but not for plain PHP. Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted November 25, 2014 Author Former Staff Share Posted November 25, 2014 What apple bug? oO Yeah well i will correct that asap http://embeddedgurus.com/barr-code/2014/03/apples-gotofail-ssl-security-bug-was-easily-preventable/ Missing braces around blocks can easily lead to false branching. I think your project needs some clear (rough) aim so interested developers can think about what could benefit this project. There are already plenty of specialized libraries for e.g. database abstraction. There are also many sites providing useful classes and helpers (with questionable code quality, maybe). What I'm actually missing is an easy Bootstrap widget system for PHP - there are some for several frameworks but not for plain PHP. Well that bootstrap thing is the next thing i was planning to do. I did something similar earlier but just for forms. Ill append the source code at the bottom. In the dreamPHP it will be a lot more clean, with templates and so on. <?php /** * @name: form * @package: modules * @version: 1.0 * @author: DreamChain * @last-modified: 13/11/2014 * @last-modifier: DreamChain * @description: * form handler * * @license: * This CMS is developed and owned by DreamChain (.InyaProduction) * Dont use this CMS without my permission! * * @copyright: * ©2014 DreamChain and Pollux2 * * @sources: * Admin Panel built with Bootstrap v2.3.2 (http://getbootstrap.com/2.3.2/) */ class form_manager{ public function initForm($method, $action, $mfd = false){ return new form($method, $action, $mfd); } } class form{ protected $_form = array(); public function __construct($method, $action, $mfd = false){ $this->_form = array( 'method' => $method, 'action' => $action, 'mfd' => $mfd, //multipart/formdata 'child' => array(), ); } public function setMultipartFormData($bool){ $this->_form['mfd'] = $bool; } public function addField($name, $type, $options = array()){ $this->_form['child'][] = array( 'name' => $name, 'type' => $type, 'options' => $options ); } protected function _generateChild($element){ $html = ""; if(isset($element['options']['label'])){ $html .= '<label for="'.$element['name'].'">'.$element['options']['label'].'</label>'; } switch($element['type']){ case "text": case "hidden": case "password": default: $html .= '<input type="'.$element['type'].'" '; $html .= 'name="'.$element['name'].'" '; $html .= 'id="'.$element['name'].'" '; $html .= 'class="form-control'; if(isset($element['options']['class'])){ $html .= ' '.$element['options']['class']; } $html .= '" '; if(isset($element['options']['placeholder'])){ $html .= 'placeholder="'.$element['options']['placeholder'].'" '; } if(isset($element['options']['value'])){ $html .= 'value="'.$element['options']['value'].'" '; } $html .= "/>"; break; case "textarea": $html .= '<textarea '; $html .= 'name="'.$element['name'].'" '; $html .= 'id="'.$element['name'].'" '; $html .= 'class="form-control'; if(isset($element['options']['class'])){ $html .= ' '.$element['options']['class']; } $html .= '" '; if(isset($element['options']['size'])){ $html .= 'size="'.$element['options']['size'].'" '; } $html .= ">"; //content if(isset($element['options']['value'])){ $html .= 'value="'.$element['options']['value'].'" '; } $html .= '</textarea>'; break; case "select": $html .= '<select '; $html .= 'name="'.$element['name'].'" '; $html .= 'id="'.$element['name'].'" '; $html .= 'class="form-control'; if(isset($element['options']['class'])){ $html .= ' '.$element['options']['class']; } $html .= '" '; $html .= ">"; if(isset($element['options']['options'])){ foreach($element['options']['options'] as $value => $name){ $html .= '<option value="'.$value.'">'; $html .= $name; $html .= '</option>'; } } $html .= '</select>'; break; case "submit": case "reset": $html .= '<button type="'.$element['type'].'" class="btn '; if(isset($element['options']['secondary']) && $element['options']['secondary']){ $html .= 'btn-default">'; } else { $html .= 'btn-primary">'; } $html .= $element['name']; $html .= '</button>'; break; case "break": $html .= '<br />'; break; case "headline": $html .= '<h2>'.$element['name'].'</h2>'; break; } return $html; } public function outputForm(){ $html = ""; $html .= '<form action="'.$this->_form['action'].'" method="'.$this->_form['method'].'" '.(($this->_form['mfd'] == true) ? 'enctype="multipart/form-data"' : '').'>'; $html .= '<div class="form-group">'; foreach($this->_form['child'] as $element){ $html .= $this->_generateChild($element); } $html .= '</div>'; return $html; } } Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted November 26, 2014 Author Former Staff Share Posted November 26, 2014 I just added the first bootstrap support, containing a handler for their "label" element to show how I'm going to expand this. There are a few bigger elements in bootstrap that will take more time and will be done in the future. Every help here is apreciated http://dreamchain.wordpress.com/docs/bootstrap/label/ Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted November 26, 2014 Author Former Staff Share Posted November 26, 2014 And another update, i added Geolocation support. Header over here: https://dreamchain.wordpress.com/docs/geolocation/to get some information Link to comment Share on other sites More sharing options...
Mashkin 16 Posted November 27, 2014 Share Posted November 27, 2014 And another update, i added Geolocation support. Header over here: https://dreamchain.wordpress.com/docs/geolocation/to get some information You could enrich this feature by adding JS-based browser geolocation. Maybe some server-side code for implementing and processing JS geolocation would be helpful. As it is, most mobile devices today provide means to acquire its location, and even desktop browser can easily determine the location without GPS (I didn't expect that until I tested it myself - http://html5demos.com/geo). This might be not very common in the sphere of Metin2, or helpful in location-based service restrictions or logging, but it can impact location-based services like "What's around?" services. This is just because I haven't seen much adoption of browser-based geolocation features yet (outside of native mobile apps). In general, I would love to see some information about required the minimum PHP version, and especially about the code structure/pattern. For one, I must say that I dislike the used __callStatic() pattern. I would much prefer to see an autoloading-based aproach, where the current "core class" can effectively be replace by any comliant autoloader, like C omposer. If PHP versions prior to 5.3 (DEPRECATED!) are out of scope, namespaces would be a great addition to divide different feature sets. Doing so could later allow you to propagate the overall package - or parts of it - on e.g. Packagist, which would make installation and updating easier and will also encourage new developers to adapt clean, modern code organization. 1 Link to comment Share on other sites More sharing options...
Former Staff .InyaProduction 1124 Posted November 27, 2014 Author Former Staff Share Posted November 27, 2014 You could enrich this feature by adding JS-based browser geolocation. Maybe some server-side code for implementing and processing JS geolocation would be helpful. As it is, most mobile devices today provide means to acquire its location, and even desktop browser can easily determine the location without GPS (I didn't expect that until I tested it myself - http://html5demos.com/geo). Well i saw that browser supported locating and was thinking about integrating it as it's a pretty nice and easy tool. As you mentioned it now, it will follow in the next days. This might be not very common in the sphere of Metin2, or helpful in location-based service restrictions or logging, but it can impact location-based services like "What's around?" services. DreamPHP shouldn't be metin2-only its a general lib for webdevelopers who dont like big frameworks (thats why I dont build a network between different library parts, so that you can just remove them if they aren't needed) In general, I would love to see some information about required the minimum PHP version, and especially about the code structure/pattern. Thats a good idea, well i have to clean the code up anyways then i think ill add a standart code structure For one, I must say that I dislike the used __callStatic() pattern. I would much prefer to see an autoloading-based aproach, where the current "core class" can effectively be replace by any comliant autoloader, like C omposer. If PHP versions prior to 5.3 (DEPRECATED!) are out of scope, namespaces would be a great addition to divide different feature sets. Doing so could later allow you to propagate the overall package - or parts of it - on e.g. Packagist, which would make installation and updating easier and will also encourage new developers to adapt clean, modern code organization. I have to admit I didn't work with autoloading yet. I would really appreciate if you participate at this point. I don't even know if there would be compatibility problems if the homepage where the lib is used in has an autoloader itself too, so i just used the method i got teached about a year ago at work. About namespaces: Namespaces are a great thing but like you said not useable with all php versions and I wan't this lib to be useable whereever possible Link to comment Share on other sites More sharing options...
Mashkin 16 Posted November 28, 2014 Share Posted November 28, 2014 For one, I must say that I dislike the used __callStatic() pattern. I would much prefer to see an autoloading-based aproach, where the current "core class" can effectively be replace by any comliant autoloader, like C omposer. If PHP versions prior to 5.3 (DEPRECATED!) are out of scope, namespaces would be a great addition to divide different feature sets. Doing so could later allow you to propagate the overall package - or parts of it - on e.g. Packagist, which would make installation and updating easier and will also encourage new developers to adapt clean, modern code organization. I have to admit I didn't work with autoloading yet. I would really appreciate if you participate at this point. I don't even know if there would be compatibility problems if the homepage where the lib is used in has an autoloader itself too, so i just used the method i got teached about a year ago at work. About namespaces: Namespaces are a great thing but like you said not useable with all php versions and I wan't this lib to be useable whereever possible Decisions have to be made, anyways. As you don't know the version constraints right now, you could very well have some incompatibilities with old PHP versions already. Namespaces have been added as core feature with PHP 5.3. PHP 5.3 has reached its end of active support in mid-2013, and end of live passed in mid-2014. Even PHP 5.4 is about to reach its end of active support in two months, so one could expect that namespaces are reasonably adopted by now. You can see a list of added features in PHP 5.3 here: http://php.net/manual/en/migration53.new-features.php As you will see, even __callStatic() has only been added then, so you already require at least 5.3 for your library to work. Entire (now widely used) frameworks like Symfony2 build upon PHP 5.3 because of e.g. closures that have drastically changed application flow, because event-based structures became easy with callbacks. I would never encourage any PHP user to employ or keep an utterly outdated version just to support the very few ones that didn't yet update their systems (newer stable versions have been available for 2 1/2 years). Espacially not in the case of PHP 5.3. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now