Wordpress po/mo classes - php

I am trying to make a simple system with plugin and themes support, but I need translation for them. The file path of languages with /en/LC_MESSAGES is too big and I want simple and it should be put only in languages folder of the plugin, just like Wordpress. I see that Wordpress seems to use a hardcoded version of gettext stored in the folder pomo. Is it taken from another project? Will it be easy to extract this classes and adapt to my project? Do you know any other project that I can reach the same result?
PS: I don't want to recreate Wordpress, it is a very simple Framework and not a CMS system. It is mandatory to have localization, so I have to find a way to do this and make the simplest as possible to the users.
Any help appreciated.
Thanks in advance and sorry for my bad English,
Vinicius.

Found this class written by Danilo Segan that does exactly what I need, standalone gettext parser

Related

How can I tell if a project is done with a PHP framework?

I am working on a project (already started), but I do not know if it is done with framework since there are files in many different folders, but I do not see any syntax referring to some framework that I know of.
I hope someone can help me...
Well it would depend on the Folder Hierarchies and the code.
If the views folder has the term "blade" on it, it's definitely laravel.
If the the code of the library has the term "CI Controller" somewhere in the libraries its definitely CodeIgniter.
If the code has a lot of "wp-" string in its code, its definitely Wordpress.
TIP: Put the whole folder in Sublime, search the folder (right click the folder and choose "Find in folder...") and search for terms that are generally reserved words for mostly used frameworks.
There are different methods to identify the PHP framework used by a web application. But one of the easiest way I would like to share it with you to use this extension in your browser called Wappalyzer.
Wappalyzer is a cross-platform utility that uncovers the technologies used on websites. It detects content management systems, e-commerce platforms, web frameworks, server software, analytics tools and many more.
There are a few other tools out there that analyze what a website is using.
BuiltWith - Stand alone site, also available as a plugin
W3Techs - Stand alone site, also available as a plugin
Auto-generated comments may also help. In my case, I can tell from the comments in index.php that it's written in CodeIgniter.
If you have a copy of the project hosted somewhere you can use https://builtwith.com

Drupal modules be used without Drupal

Problem, can I use Drupal modules in my own PHP application? ( without setting up Drupal ). I searched a bit, there seems to be .zip file for the module, init where there are .inc files.
Is it possible to use this without setting up Drupal ?
I need to configure Solr search, Drupal seems to have a search API and thought I could use it.
You can use the PHP solr library, instead of trying to hitting your brain on drupal modules files. With few extra code you can able to do indexing, searching ,etc. There is a good library https://code.google.com/p/solr-php-client/ .
There is a good tutorial on Solr installation and usage in PHP. http://www.ibm.com/developerworks/library/os-php-apachesolr/
You can not use Drupal modules anywhere outside from Drupal.
But, you can download the modules, and extract the main php functionality to make it work with your business requirements.
Some modules have also open frameworks that can help you.
Hope that this helps.

Implementing language translations for frameworks

I'm in planing process of my e-commerce solution and now the final question is how to implement language system.
In past i worked with e-commerce solutions such as Magento, eCommerce and OpenCart however i would like to avoid their approach as it was horrible and in the end it slowed down the entire application.
Take Magento for instance, it keeps language files in seperate folders and then code loads languages from files in that folder. The language files have over 10k lines and a lot of words and sentances repeat it selves for diffirent modules and the file has to be read on each load.
I have a HMVC arhitecture and was thinking to expand that where each module that is part of the solution would have it's own language file however this is Magentos approach and it's not the best of solutions.
I want my language file system to be as simple as possible and short keeping button names and label names in it and allowing anyone that wants to translate it to have easy time doing so.
As i have a HMVC arhitecture i wanted to expand it and make it so that each module has it's own language file/class this way you only need to translate those modules that you are actually using instead of the appliaction to load all translations at once even for modules that are not being displayed.
But i feel that keeping translations like this could prove problematic for performance and simplicity. I did look in to GoogleTranslate plugin option and while it's pretty decent i fell it's not ready yet nor a proper solution.
What would be the best approach here.
If your HMVC architecture uses some kind of PHP framework, it may have APIs for dealing with translation issues. For example, in CodeIgniter you can use the Language Class, and in CakePHP you can use the i18n class.
Note that CodeIgniter currently uses plain PHP files to load the languages, so it's probably not as efficient as CakePHP (that can load the files from .po/.mo files or databases).
If you are not currently using one, you can try the Zend Framework's translation module. Note that you don't need to use all the Zend Framework (as it is highly modular too). If you still don't want that to clutter your project's space, you can use plain gettext().

PHP-based CMS that can use static files as pages and include a forum and blog?

I am currently working on a project documentation site for an OSS PHP project. Presently all of the docs are written in Markdown and stored as separate files.
I would really like to keep the core documentation as static files within the project so that they can be downloaded and used as well as read on my website. But on the website, I'd like to render those pages from within a CMS.
In addition to presenting the code docs, I also want to provide a forum for discussion and a blog.
Wordpress is what I have experience with, but is there a better system for what I am trying to accomplish specifically?
For Blog and CMS I would suggest stick with Wordpress since you already have experience on it. And as far as Forum is concerned I would suggest SimplePress forum. I have been using it on my Wordpress installation and found it really good. You can see live forum on the link above to see how it looks in real world.
Also Wordpress has several nice plugins like Download Manager that will give you ability to manage your downloads/files.
Can't confirm if wp is the best, but it's certainly good enough.
To include your docs, you'll have to write a plugin, not likely that you will find one existing that does exactly what you want.
For forum, you should find a plugin. Google for posts similar to this to choose a best match.
Firstly Wordpress isn't a framework.
I believe CakePHP has the functionality to load hardcoded pages when they're placed in the webroot folder of the app. I'm unsure as to how they're loaded in regards to routing/templating however.

php plugin based script

I'm thinking of building a plugin based application.
At the moment, I am not sure what type of plugins will be used so I don't have a requirement.
I wish to know how such applications are designed so I can start my application around that.
Does anyone have any experience with this? I don't mind what sort of system it is or what your plugins do. What I want are some ideas on how others have achieved this so I can formulate and make my own.
Thanks.
I use this for all of my plugins: http://failover.co.za/2010/10/20/writing-a-pluggable-php-application-part-1/
If the plugins are going to be built by people who won't be editing the script, then you can just include the file for the plugin.
I think it's better for you to work with MVC Framework and then create an application core (modules and all apps need and require this), then think global and create other apps and modules.
Also I suggest you look at an Open Source CMS like Wordpress, Drupal, etc.

Categories