Skip to content

Commit

Permalink
Merge pull request #2 from pi-engine/master
Browse files Browse the repository at this point in the history
update with Pi Master
  • Loading branch information
krisxoofoo committed Jul 8, 2013
2 parents 717e2ff + 5e83dc5 commit 28850e4
Show file tree
Hide file tree
Showing 91 changed files with 1,860 additions and 944 deletions.
32 changes: 19 additions & 13 deletions README-GIT.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# USING THE GIT REPOSITORY TO WORK ON PI ENGINE

1. Setup a GitHub account (http://github.com/), if you haven't yet
2. Clone the repo locally and enter it (use your own GitHub username
in the statement below)
Pi Engine Github Skeleton
=========================

```sh
% git clone https://github.com/pi-engine/pi.git
% cd pi
```
Pi Engine Core
----------------
* [pi-engine/pi](https://github.com/pi-engine/pi): Pi Engine core repo
* [pi-engine/pi/wiki](https://github.com/pi-engine/pi/wiki): Pi Engine documents

# GIT REPO SKELETON FOR PI ENGINE

* [pi-engine/pi](https://github.com/pi-engine/pi): Pi Engine core repo
* pi-engine/pi-{modulename}: repo for module {modulename}, for instance [pi-engine/pi-tag](https://github.com/pi-engine/pi-tag) for module tag
* pi-engine/pi-theme-{themename}: repo for theme {themename}, for instance [pi-engine/pi-theme-pi](https://github.com/pi-engine/pi-theme-pi) for theme pi
* pi-engine/{reponame}: repo for non-pi components
Pi Engine Module
----------------
* [pi-module](https://github.com/pi-module): repos for modules
* Eeach module has its own repo, for instance [pi-module/tag](https://github.com/pi-module/tag) for module tag

Pi Engine Theme
---------------
* [pi-theme](https://github.com/pi-theme): repos for themes
* Each theme has its ownrepo, for instance [pi-theme/pi](https://github.com/pi-theme/pi) for theme pi

Pi Engine Extras
----------------
* [pi-extra](https://github.com/pi-extra): repos for extra components
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,37 @@ Pi Engine
=================

Pi Engine is a role oriented application development engine for web and mobile, designed as the next generation and a successor to Xoops.
Pi is developed upon PHP and MySQL with selected third-party frameworks including but not limited to [Zend Framework library](https://github.com/zendframework/zf2), [jQuery](https://github.com/jquery/jquery), [Bootstrap](https://github.com/twitter/bootstrap) and [Backbone](https://github.com/documentcloud/backbone).
Pi is developed upon PHP and MySQL with selected third-party frameworks including but not limited to [Zend Framework 2](https://github.com/zendframework/zf2), jQuery, Bootstrap and Backbone.

Pi Project follows the philosophy of open standard, open design, open development and open structure. Pi is born as a complete open source project and intended to build a sustainable ecosystem that benefits all contributors and users.
Pi Project follows the philosophy of open standard, open design, open development and open management. Pi is born as a complete open source project and intended to build a sustainable ecosystem that benefits all contributors and users.

Pi Engine is started by [Taiwen Jiang](http://github.com/taiwen) (Xoops Project Lead and Dev Lead), [Marc Desrousseaux](http://github.com/MarcoXoops) (Xoops QA Lead), [Hossein Azizabadi](http://github.com/voltan) (Xoops Persian Lead), [Kris](http://github.com/krisxoofoo) (Xoops Council Member and Xoops France Lead), etc. [Pi Team](https://github.com/pi-engine/pi/wiki/Pi-Team) is highly inspired by the Xoops led by onokazu (Ono Kazumi), skalpa and phppp (Taiwen Jiang, or D.J.) successively since 2001 and will continue to support and promote Xoops.

**Check out [Latest Release](https://github.com/pi-engine/pi/blob/master/doc/releasenotes.md).**


Highlights
-------------
1. **Sustainable ecosystem:** A sustainable ecosystem built upon open standard, open source code, open development and open management on Github.
2. **Engineered development:** Quality ensured engineering development with short learning curve, low skill requirements with clean MVC architecture, semantic templating, sophisticated API and strict starndards.
3. **Visualized management:** Easy and responsive application and content management based on visualized mangement tools and interface with page and widget mechanism.
4. **Agile workflow:** Role oriented architecture and deployment skeleton supports manageable agile development workflow.

Features and practices
----------------------
1. Modularization for functionality and applications
2. Components for basic libraries and services for fundamental system functions
3. Theming for presentation and appearance
4. Design-friendly templating
5. DevOps oriented architecture
6. Centralized security enhancement
* Modularization for functionality and applications
* Components for basic libraries and services for fundamental system functions
* Theming for presentation and appearance
* Design-friendly templating
* DevOps oriented architecture
* Centralized security enhancement

Quick start
-----------
* Documents at [Pi Wiki](https://github.com/pi-engine/pi/wiki)
* Download the [latest stable code](https://github.com/xoops/pi/zipball/master) and [latest dev code](https://github.com/xoops/pi/zipball/develop).
* Clone Pi repo `git clone git://github.com/pi-engine/pi.git` and [keep updated](https://help.github.com/articles/fork-a-repo#pull-in-upstream-changes).
* Demo sites with shared deployment: Pi Dialogue ([pialog.org](http://pialog.org) | [pialogue.org](http://pialogue.org)), Pi Demo ([pi-demo.org](http://pi-demo.org)) and Xoops/Pi ([xoopsengine.org](http://demo.xoopsengine.org)).
* Documents at [Pi Wiki](https://github.com/pi-engine/pi/wiki).
* Download the [latest stable code](https://github.com/pi-engine/pi/zipball/master) and [latest dev code](https://github.com/pi-engine/pi/zipball/develop).
* Clone Pi repo `git clone git://github.com/pi-engine/pi.git`.
* Get extension resources at [Pi module and theme repos](https://github.com/pi-engine/pi/blob/master/README-GIT.md).

Development
----------
Expand All @@ -40,3 +46,9 @@ Copyright and License
The Engine is released under a [New BSD License](https://github.com/pi-engine/pi/blob/master/doc/license.txt).


Demos
-----
Demo sites with shared deployment:
* Pi Dialogue ([pialog.org](http://pialog.org) | [pialogue.org](http://pialogue.org))
* Pi Demo ([pi-demo.org](http://pi-demo.org))
* Xoops/Pi ([xoopsengine.org](http://demo.xoopsengine.org))
Binary file added doc/PiArchitectureDiagram-TaiwenJiang.pdf
Binary file not shown.
34 changes: 34 additions & 0 deletions doc/README.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<p>
Pi Engine is a role oriented application development engine for web and mobile, designed as the next generation and a successor to Xoops.
Pi is developed upon PHP and MySQL with selected third-party frameworks including but not limited to Zend Framework library, jQuery, Bootstrap and Backbone.
</p>

<p>
Pi Project follows the philosophy of open standard, open design, open development and open structure. Pi is born as a complete open source project and intended to build a sustainable ecosystem that benefits all contributors and users.
</p>

<p>
The Engine is released under a New BSD License.
</p>

<p>
<ol>
Selected features and practices:
<li>Modularization for functionality and applications
<li>Components for basic libraries and services for fundamental system functions
<li>Theming for presentation and appearance
<li>Design-friendly templating
<li>DevOps oriented architecture
<li>Centralized security enhancement
<ol>
</p>

<p>
<ul>
Quick start:
<li>Pi Engine website: <a href="http://pialog.org" title="Pi Engine">Pi Dialog</a>
<li>Latest download: <a href="https://github.com/pi-engine/pi/zipball/master" title="Latest stable code">Stable Download</a>
<li>Pi Engine documents: <a href="https://github.com/pi-engine/pi/wiki" title="Pi Wiki">Pi Documentation</a>
<li>Feature and Issues: <a href="https://github.com/pi-engine/pi/issues" title="Issue Tracker">Pi Tracker</a>
</ul>
</p>
19 changes: 19 additions & 0 deletions doc/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
Pi Engine Changelog


June 24th, 2013
=============================
1. Added doc "Pi Engine Architecture Diagram"
2. Added Pi\File\Transfer\Download for file download and script/download.php for single file download
3. Added Pi\Service\Log::mute() and Debugger::mute to disable debugger output for some use cases.
4. Fixes Issue #113: Navigation page active is not properly detected
5. Added function for translation register: _t('Message to be translated later.')
6. Renamed Setup translation function name to _s() to avoid conflicts with translation placeholder function _t()
7. Added listener for error ViewModel under JSON/AJAX/Feed request
8. Added "pi-feature" and "pi-spotlight" blocks to homepage on installation
9. Added two new block zones to theme font layout: $block['0'] for head blocks and $block['99'] for foot blocks
10. Added browser support indication to theme configuration
11. Fixed Issue #121: exception messages were missed by ErrorStrategy template overwritten
12. Merged theme/template/error-exception.phtml to error.phtml
13. Modified config: var/config/config.application.php -- changed 'exception_template' value
14. Formulated return of Ajax/JSON request with format: array('status' => 1, 'message' => '', 'data' => array())


June 19th, 2013
=============================
1. Upgraded ZF2 to 2.2.1
Expand Down
2 changes: 1 addition & 1 deletion lib/Pi/Application/Model/RowGateway/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Config extends RowGateway
*/
protected function encode($data)
{
if (!empty($data['filter'])) {
if (!empty($data['filter']) && isset($data['value'])) {
$data['value'] = $this->encodeValueColumn($data['value'], $data['filter']);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Pi/Application/Registry/AbstractRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected function loadData($meta = array())
* Load cache data matching the meta
*
* @param array $meta
* @return array
* @return array|bool
*/
protected function loadCacheData($meta = array())
{
Expand Down
71 changes: 56 additions & 15 deletions lib/Pi/Application/Service/I18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* @author Taiwen Jiang <[email protected]>
* @package Pi\Application
* @subpackage Service
* @since 3.0
* @version $Id$
*/

/**
Expand Down Expand Up @@ -138,7 +136,35 @@
* __('A test message', 'theme/default', 'en');
* </code>
*
* 7. Format a date
*
* 7. Register a message that will be translated in different lanauges, but not translated at the place where it is registered
* <code>
* _t('Message to be translated and used later.');
* </code>
* // Use case, register module config
* // Registered in a module's config.php
* <code>
* $config['key'] = array('title' => _t('Config Title'), 'description' => _t('Config hint'), '...'));
* </code>
* // Load translated message in the module config setting page
* // module/system/src/Controller/Admin/ConfigController.php calls ConfigForm.php:
* <code>
* // Module\System\Form\ConfigForm::addElement()
*
* protected function addElement($config)
* {
* // ...
* $attributes['description'] = __($config->description);
* $options = array(
* 'label' => __($config->title),
* 'module' => $this->module,
* );
* // ...
* }
* </code>
*
*
* 8. Format a date
* <code>
* _date(time(), 'fa-IR', 'long', 'short', 'Asia/Tehran', 'persian');
* _date(time(), array('locale' => 'fa-IR', 'datetype' => 'long', 'timetype' => 'short', 'timezone' => 'Asia/Tehran', 'calendar' => 'persian'));
Expand Down Expand Up @@ -167,22 +193,22 @@
* _date(time(), ...);
* </code>
*
* 8. Format a number
* 9. Format a number
* <code>
* _number(123.4567, 'decimal', '#0.# kg', 'zh-CN', 'default');
* _number(123.4567, 'decimal', '#0.# kg', 'zh-CN');
* _number(123.4567, 'scientific');
* _number(123.4567, 'spellout');
* </code>
*
* 9. Format a currency
* 10. Format a currency
* <code>
* _currency(123.45, 'USD', 'en-US');
* _currency(123.45, 'USD');
* _currency(123.45);
* </code>
*
* 10. Get a date formatter
* 11. Get a date formatter
* <code>
* Pi::service('i18n')->getDateFormatter('fa-IR', 'long', 'short', 'Asia/Tehran', 'persian');
* Pi::service('i18n')->getDateFormatter(array('locale' => 'fa-IR', 'datetype' => 'long', 'timetype' => 'short', 'timezone' => 'Asia/Tehran', 'calendar' => 'persian'));
Expand All @@ -194,7 +220,7 @@
* Pi::service('i18n')->getDateFormatter(array('pattern' => 'yyyy-MM-dd HH:mm:ss'));
* </code>
*
* 11. Get a number formatter
* 12. Get a number formatter
* <code>
* // Get a number formatter
* Pi::service('i18n')->getNumberFormatter('decimal', '#0.# kg', 'zh-CN');
Expand Down Expand Up @@ -392,7 +418,7 @@ public function __get($name)
* Normalize domain in Intl resources, including Translator, Locale, Date, NumberFormatter, etc.
*
* @param string $domain
* @return array pair of component and domain
* @return array pair of component and domain
*/
public function normalizeDomain($rawDomain)
{
Expand All @@ -410,17 +436,19 @@ public function normalizeDomain($rawDomain)
*
* @param array|string $domain
* @param string|null $locale
* @return Intl
* @return I18n
*/
public function load($domain, $locale = null)
{
$domain = is_array($domain) ? $domain : $this->normalizeDomain($domain);
$locale = $locale ?: $this->getLocale();

$this->getTranslator()->load($domain, $locale);
$result = $this->getTranslator()->load($domain, $locale);

if (Pi::service()->hasService('log')) {
Pi::service()->getService('log')->info(sprintf('Translation "%s" is loaded', implode(':', $domain)));
$message = $result
? sprintf('Translation "%s.%s" is loaded.', implode(':', $domain), $locale)
: sprintf('Translation "%s.%s" is empty.', implode(':', $domain), $locale);
Pi::service()->getService('log')->info($message);
}

return $this;
Expand All @@ -432,14 +460,14 @@ public function load($domain, $locale = null)
* @param string $domain
* @param string $module
* @param string $locale
* @return Intl
* @return I18n
*/
public function loadModule($domain, $module = null, $locale = null)
{
$module = $module ?: Pi::service('module')->current();
$component = array('module/' . $module, $domain);

$this->load($component, $locale);

return $this;
}

Expand All @@ -449,13 +477,14 @@ public function loadModule($domain, $module = null, $locale = null)
* @param string $domain
* @param string $theme
* @param string $locale
* @return Intl
* @return I18n
*/
public function loadTheme($domain, $theme = null, $locale = null)
{
$theme = $theme ?: Pi::service('theme')->current();
$component = array('theme/' . $theme, $domain);
$this->load($component, $locale);

return $this;
}

Expand Down Expand Up @@ -688,6 +717,18 @@ function _e($message, $domain = null, $locale = null)
echo __($message, $domain, $locale);
}

/**
* Register a message to translation queue
*
*
* @param string $message The string to be localized
* @return void
*/
function _t($message)
{
return $message;
}

/**
* Check if Intl functions are available
*/
Expand Down
17 changes: 16 additions & 1 deletion lib/Pi/Application/Service/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Log extends AbstractService

/**
* Whether or not to the service is active
* @var boolean
* @var bool
*/
protected $active;
protected $debugger;
Expand Down Expand Up @@ -133,6 +133,21 @@ public function active($flag = null)
return $this->active;
}

/**
* Enable/disable debugger
*
* @param bool $flag
* @return bool|null return previous muted value or null if no debugger available
*/
public function mute($flag = true)
{
$muted = null;
if ($this->debugger) {
$muted = $this->debugger->mute($flag);
}
return $muted;
}

/**
* Get logger, instantiate it if not available
*
Expand Down
Loading

0 comments on commit 28850e4

Please sign in to comment.