Mecha CMS

Mecha CMS blog and documentation.

Version 1.1.3

Updated: Sunday, 07 August 2016

Changelog in Mecha 1.1.3.

Added

  • Method
    • Base::*()
    • Cell::*()
    • Config::kin()
    • Config::plug()
    • Config::reset()
    • Config::url()
    • Converter::str()
    • Converter::toArray() → alias for Text::toArray()
    • Converter::toText()
    • Converter::url()
    • Date::GMT()
    • File::explore()
    • File::get()
    • File::inspect()
    • File::path()
    • File::pocket()
    • File::url()
    • Form::*()
    • Get::articlePath()
    • Get::tag()
    • Get::pagePath()
    • Get::rawTag()
    • Get::timezone()
    • Guardian::ally()
    • Guardian::choked()
    • HTTP::*()
    • Jot::*()
    • Mecha::alter()
    • Mecha::after()
    • Mecha::append()
    • Mecha::before()
    • Mecha::count()
    • Mecha::current()
    • Mecha::edge()
    • Mecha::extend()
    • Mecha::first()
    • Mecha::get()
    • Mecha::index()
    • Mecha::key()
    • Mecha::last()
    • Mecha::next()
    • Mecha::prepend()
    • Mecha::prev()
    • Mecha::replace()
    • Mecha::to()
    • Mecha::walk()
    • Page::*()
    • Plugin::*()
    • Request::method()
    • Route::get()
    • Route::is()
    • Route::over()
    • Route::post()
    • Session::start()
    • Shield::path()
  • Weapon
    • comment_form_input
    • on_error_destruct
    • shield_cache_after
    • shield_cache_before
  • Filter
    • guardian:kick
    • shield:cache
    • shield:lot
    • widget:custom.snake_case_mode → alias for widget:custom.snakeCaseMode
    • widget:search.form
    • Missing filters like slug, url, time and date are now added.

Removed

  • Method
    • File::dir() → replaced by File::pocket()
    • Get::fileExtract() → replaced by File::inspect()
    • Get::rawTagsBy() → replaced by Get::rawTag()
    • Get::summary() → replaced by Converter::curt()
    • Get::tagsBy() → replaced by Get::tag()
    • Shield::define() → replaced by Shield::lot()
    • Shield::undefine() → replaced by Shield::apart()
    • Text::toObject()
  • Weapon
    • after_shield_config_redefine
    • before_route_function_call → replaced by Route::over() method
    • before_shield_config_redefine → replaced by shield:lot filter
    • on_plugin_mounted → replaced by on_plugin_mount
    • on_plugin_*_mounted → replaced by on_plugin_*_mount

Updated

  • Method
    • Converter::attr()
    • Converter::detractShell()
    • Converter::detractSkeleton()
    • Converter::detractSword()
    • File::size()
    • File::upload()
    • Get::adjacentFiles()
    • Get::files()
    • Get::inclusiveAdjacentFiles()
    • Get::inclusiveFiles()
    • Guardian::captcha()
    • Mecha::chunk()
    • Mecha::order()
    • Menu::create()
    • Route::reject()
    • Text::toArray()
    • Text::toPage()
    • Widget::manager()
    • Widget::recentComment()

Faster Page Type Checking

Better page type detection by checking the URL pattern. This is faster, because users now can check the current page type without having to reload the configuration value, the current page type value will be cached in $config->page_type variable quickly, even if it’s placed outside the route. Works for all page types, except 404 page. Example:

// < 1.1.3
Filter::add('content', function($content) {
    $config = Config::get(); // reload …
    if($config->page_type === 'article') {
        // do stuff …
    }
});
// >= 1.1.3
if($config->page_type === 'article') {
    Filter::add('content', function($content) {
        // do stuff …
    });
}
// >= 1.1.3
Filter::add('content', function($content) use($config) {
    if($config->page_type === 'article') {
        // do stuff …
    }
});

Better Method in Text Parser and Input Validator

Added better and safer method in Text::parse() and Guardian::check() for faster parsing and checking process.

// < 1.1.3

Text::parser('to_lower_case', function($text) {
    return strtolower($text);
});

echo Text::parse('ABC')->to_lower_case;
// >= 1.1.3

Text::parser('to_lower_case', function($text) {
    return strtolower($text);
});

echo Text::parse('ABC', '->lower_case');

By default, all text parser will be executed with this old way. It will creates an object of all available text parsers, even if you just want to show the to_html parser result. Consider this broken case:

// < 1.1.3

Text::parser('to_lower_case', function($text) {
    exit('This text should not be printed!');
});

echo Text::parse('ABC')->to_html; // broken!

The new method will be able to outputs only the called method. So, the function below will exactly ignite a text parser you want to call, in this case to_html:

// >= 1.1.3

Text::parser('to_lower_case', function($text) {
    exit('This text should not be printed!');
});

echo Text::parse('ABC', '->html'); // not broken!

Include Plugin Launcher Only in Backend

Added ability to include plugin launcher only in backend by prefixing the folder name or the launch.php file with two underscores:

__plugin-folder/
│
└── launch.php → backend only
plugin-folder/
│
├── __launch.php → backend only
└── launch.php → frontend and backend

Added ability to create manual excerpt link text:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

<!-- cut -->

Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.

JavaScript Hook Changes

Some backward incompatible changes have been made. For example, the JavaScript hook parameter data are now no longer shipped as array, but as object:

DASHBOARD.add('on_control_click', function(data) {
    alert(data.event);
    alert(data.target);
    alert(data.id);
    alert(data.index);
    …
});

This will make the output data easier to remember and with these changes, I also don’t need to determine the order in which data are delivered as the previous specification, which is bad:

DASHBOARD.add('on_control_click', function(data) {
    alert(data[0]);
    alert(data[1]);
    alert(data[3]); // ?
    alert(data[2]); // ?
    …
});

Attach Button on Shield Manager Page

Added Attach button on the shield manager page.

Improved Asset Management System

Added ability to create folder in asset manager page.

Fixed Bugs

Fixed bug of page data that will break the page converter if you put some separator characters in it. Example:

Title: Test Title ====
Description: "Test description ===="
Author: Test Author ====
Content Type: Markdown
Fields: {"test":{"type":"t","value":"===="}}

====

Lorem ipsum dolor sit amet.

====

Lorem ipsum dolor sit amet.

====

Lorem ipsum dolor sit amet.

Download Mecha v1.1.3

Donation and Email Subscription