Squiz Labs Blog - The latest news from the R&D division of Squiz®

Subscribe to our RSS feeds

Squiz Matrix Newsletter #483

Squiz Matrix 5.0.4.1

At the beginning of the week, we released Squiz Matrix v5.0.4.1. This is a patch release, containing seven minor bug fixes.

You can head to the Release Information page of the Squiz Matrix User Manual Library to view our release schedule, as well as find patch notes on all our past versions of Matrix.

-----

This week we have two new features to report, including new options to specify the Edit+ Editor tools to make available to your back-end users. Continue reading below for more information on all this week's developments.

Edit+ Editor Plugin Options 

Due for release in version 5.1.0.0   

With the release of Edit+ for Squiz Matrix in 2012, we introduced a new WYSIWYG editor, providing an intuitive interface for creating and maintaining your content.

As of our release of Squiz Matrix 5, earlier this year, this WYSIWYG editor became available for use within the administration interface (for Squiz Plus customers), providing access to the full range of content editor features that were previously only available in Edit mode.

The Edit  Editor in the Admin Interface 

This feature extends the support of the Edit+ Editor within the administration interface, adding new system configuration options to specify the editing tools that you want to make available to your back-end users.

The new Edit+ Editor Plugins settings can be found on the Global Preferences system configuration screen, and lists the editing tools that are available on the Edit+ Editor. By default, all the editing tools available will be enabled.

The Edit  Editor Plugin Options 

These settings work in a similar manner to the existing WYSIWYG Plugin tools, allowing you to enable and disable the editing tools that you want to make available within the Edit+ editing interface.

The Edit+ Editor tools available are:

  • Accessibility
  • Choose Language
  • Cursor Assist
  • Format Fonts
  • Formatting
  • History
  • Inline Toolbar
  • Insert Image
  • Insert Link
  • Keyboard Editor
  • Keywords
  • Listing
  • Matrix Editing Tools
  • Search and Replace
  • Special Chars
  • Table Editing
  • Viper Toolbar
  • View Source
  • Viper Editing Tools

This feature has been added to provide greater control over the editing interface and tools available to your content editors. 

Remap Manager: Improved Purge All Remaps Note

Due for release in version 5.1.0.0   

Squiz Matrix's Remap Manager allows you to view and manage the current remaps and redirects that have been configured on your system.

The Purge All Remaps option is available within these settings to provide a easy method of mass deleting all remapped URLs on a system, except those marked as Never Delete.

The Purge All Remaps field 

Previously, the information provided under this field did not make it clear that this option would ignore any URL filters applied, when deleting remaps.

This feature modifies the message under this field to make the usage of the Purge All Remaps option clearer. The new field message is as follows:

This will delete ALL the remaps having "Never Delete" option set to "No".
The URL filters below will be ignored when purging these remaps. 

Squiz Matrix 4.18.8, 5.0.4.0 & Edit+ 5.0.4 Released

Our latest releases of Squiz Matrix are available today. These releases include the latest version of our 4.18.x branch, as well as a micro releases for Squiz Matrix and Edit+ 5.

Version 4.18.8 is the latest release of our 4.18.x branch, launched late last year. This release contains twenty nine bug fixes.

Squiz Matrix 5.0.4.0 is the latest micro release of Matrix 5, after launching back in April. This release contains twenty five bug fixes.

Edit+ 5.0.4 is the latest micro release of Edit+ for Matrix 5, after launching back in April. This release contains 6 bug fixes.

Please be sure to follow the relevant user guides when updating or installing your system. 


Squiz Matrix Newsletter #482

This week we have four new features to report, including new Form Question functions on the JavaScript API. Continue reading below for more information on all this week's developments.

JS API: New Form Question Functions

Due for release in version 5.1.0.0 

New functions have been added to the JavaScript API to allow you to create, update and remove questions on Custom Forms.

These new functions can be enabled in the new Form Questions section of the Details screen of the JavaScript API. 

The JS API's Form Question Functions

Create Questions

The createQuestion function allows you to create a new question on your Custom Form.

This function takes four parameters:

  • assetid: the ID of the form or form section to create the question on.
  • type_code: the type of question to create (Text, by default).
  • units: the number of questions to create (1, by default).
  • dataCallback: the custom callback function (optional). 

The format of the createQuestion function is shown below: 

function createQuestion(assetid, type_code, units, dataCallback) 

In the example below we are creating two new Country question types under our Form asset (#100).

createQuestion(100, 'Country', 2, function(e){console.log(e);}); 

When using the Enhanced JS API, the above example would be as follows:

js_api.createQuestion({
assetid:100,
type_code:'Country' units:2 dataCallback: function(e){console.log(e);}
}) 

Update Questions

The updateQuestion function allows you to update the field information of an existing question on your Custom Form.

This function takes four parameters:

  • assetid: the ID of the form or form section to update the question on.
  • question_id: the ID of the question to update.
  • field_info: a json object containing the field data to update (the property names being the attributes of the specified question type).
  • dataCallback: the custom callback function (optional).  

The format of the updateQuestion function is shown below:  

function updateQuestion(assetid, question_id, field_info, dataCallback)  

In the example below we are updating a question (q35) under our form asset (#100) with the specified field info.

field_info = {
'cust_required_error': 'This is custom Text',                                                     //text type
'is_required': 1,                                                                                 // boolean type
'default':  '2014-10-10 10:59:39',                                                                // datetime type
'name': 'Date Time Question',                                                                     // text type
'show': show_array,                                                                               // serialise type
'text': 'a:3:{s:1:"d";s:9:"date text";s:1:"m";s:10:"month text";s:1:"y";s:9:"year text";}'        // also serialise type
};

updateQuestion('100', 'q35', field_info, function(e){console.log(e);}) 

When using the Enhanced JS API, the above example would be as follows:

field_info = {
'cust_required_error': 'This is custom Text',                                                     //text type
'is_required': 1,                                                                                 // boolean type
'default':  '2014-10-10 10:59:39',                                                                // datetime type
'name': 'Date Time Question',                                                                     // text type
'show': show_array,                                                                               // serialise type
'text': 'a:3:{s:1:"d";s:9:"date text";s:1:"m";s:10:"month text";s:1:"y";s:9:"year text";}'        // also serialise type
}; js_api.updateQuestion({
assetid:100,
question_id: 'q35',
field_info: field_info,
dataCallback: function(e){console.log(e);}
})  

Remove Questions

The removeQuestion function allows you to remove a question from your Custom Form.

This function takes three parameters:

  • assetid: the ID of the form or form section to remove the question from.
  • question_id: the ID of the question to remove. 
  • dataCallback: the custom callback function (optional).   

The format of the removeQuestion function is shown below:

function removeQuestion(assetid, question_id, dataCallback) 

In the example below, we are removing a question (q35) under our form asset (#100).

removeQuestion('100', 'q35',function(e){console.log(e);}); 

When using the Enhanced JS API, the above example would be as follows:

js_api.removeQuestion({
assetid:100,
question_id: 'q35',
dataCallback: function(e){console.log(e);}
}) 

Update Question Order

The updateQuestionOrder function allows you to update the order of questions on your Custom Form.

This function takes three parameters:

  • assetid: the ID of the form or form section to update the question order of.
  • sort_order: an array containing the new sort order of the questions.
  • dataCallback: the custom callback function (optional).  

The format of the updateQuestionOrder function is shown below: 

function updateQuestionOrder(assetid, sort_order, dataCallback) 

In the example below, we are updating our form (#100) with the specified new sort order.

question_order = ['100:q52', '100:q51', '100:q50', '100:q49''];
updateQuestionOrder(100, question_order, function(e){console.log(e);}) 

When using the Enhanced JS API, the above example would be as follows:

question_order = ['100:q52', '100:q51', '100:q50', '100:q49''];
js_api.updateQuestionOrder({
assetid:100,
sort_order: question_order,
dataCallback: function(e){console.log(e);}
})  

Remove SQ_ACTION=login Parameter After Logging In

Due for release in version 5.1.0.0 

Previously, when logging into Matrix, the system would add a SQ_ACTION=login query parameter to the your URL, like so:

www.site.com?SQ_ACTION=login

While this was generally not an issue, it could cause issues upon refresh, especially when in Edit mode.

The feature adds a new redirect to remove this query parameter when logging into the system, and also the similar SQ_ACTION=logout when logging out of the system. This redirect will preserve any other query strings contained within the URL.

www.site.com?SQ_ACTION=login&var=value ==> www.site.com?var=value 

OAuth: Sync User Attributes

Due for release in version 5.1.0.0 

Squiz Matrix's OAuth Account Manager asset facilitates the integration of OAuth2 authentication within your system, allowing users to login as local system users using, for example, their Facebook or Google accounts.

When configuring the settings of the OAuth Account Manager, you are able to define the user attributes of your OAuth authorised users, using the profile data returned from the API.

These settings, however, did not update these values once they were initially populated. This meant that the values within Matrix could be outdated or out of sync, if updated externally.

This feature introduces a new Sync User Attributes section to combat this issue.

The OAuth Sync User Attributes settings

The Sync User Attributes options will work in a similar manner to the existing populate attributes functionality, except that it will sync user attribute data each time the user logs into Matrix. This will ensure that the profile data in Matrix is consistently updated and current.

JavaScript Processing on Call REST Resource Form & Trigger Actions

Due for release in version 5.1.0.0 

The Call REST Resource form submission and trigger actions within Squiz Matrix allows you to communicate with web services exposing themselves using Representational State Transfer (REST) methods, on the submission of a form or when a trigger is fired.

This feature extends the functionality of these actions, adding new settings to enable JavaScript processing of the response from the REST resource call.

The JavaScript Processing settings

The JavaScript Processing settings work in a similar manner to the existing REST Resource JavaScript asset, allowing you to either select a JS File and/or manually enter JavaScript to determine the content that will be processed.

Additionally, these actions will now store the response of the HTTP request as an array in the Matrix session sandbox, as specified in a new Session Var Name field. Any JavaScript processing that has been configured will overwrite the stored response array.

The REST response information can be printed using the following keyword format (where [session_var_name] is the variable name set):

%globals_session_[session_var_name]% 

You can use array modifiers to specify the information to print from the response array, for example:

%globals_session_[session_var_name]^index:responses^index:0^index:body%

Analysis of Coding Conventions

Coding standards tend to vary between projects. Even projects that use the same written standard can vary in a number of ways as standards tend to leave a lot of room to apply your own coding style in various areas. To get a better idea of what coding styles PHP developers are using, I used PHP_CodeSniffer to analyse and report on a number of big and small public PHP projects hosted on Github.

The result of the analysis is here: http://squizlabs.github.io/PHP_CodeSniffer/analysis/

There are currently 63 projects being analysed, with trend data recorded for about the last 8 months. The report currently lists 42 different coding style conventions ranging from "how many spaces surround the concat operator" to the classic "tabs or spaces for line indent". The coding conventions are listed from most contentious to least contentious. So the ones at the top show the most variations between projects while the ones at the bottom are generally accepted by all projects.

Each coding convention provides a list of projects that use each of the style variations within it. Clicking on any of those projects will take you to a project-specific report showing the coding conventions used within it and how often the same style is followed within the project. So you can take a look at the coding conventions for CakePHP, Drupal, Symfony2 or even PHP_CodeSniffer itself. 

How did you pick the projects to analyse?

A combination of popular PHP projects on Github, projects that I've used, and projects that have received some attention while the report was being built.

Can you include my project in the report?

If it is a public PHP project on Github, I sure can. All the repositories that are being analysed are listed in the repos.json file.

For each one, I need to know the name of the project, the URL (organisation/repository), the path in the project where PHP_CodeSniffer should start analysing code (default: /), any files or directories that should be ignored (default: none), and a list of additional PHP file extensions to check beyond .php and .inc (default: none). Here is an example:

{
    "name": "My Project",
    "url": "squizlabs/my-project",
    "path": "src",
    "ignore": "3rdparty/*,includes/*",
    "extensions": "phtml,module"
}

There are also 63 other examples in the repos.json file to take a look at. Submit a PR or send me a gist on Twitter. If you have no idea what the values should be, get me the Github URL and I'll figure it out for you.

How is the report generated?

From version 2.0.0a2, PHP_CodeSniffer collects metrics about the code it is checking. These are used to determine coding conventions and can be displayed using --report=info. The coding convention report uses a custom PHP_CodeSniffer report that outputs these metrics as a JSON file instead of to the screen. To save a lot of time, a custom coding standard is used to limit checks to just the sniffs that generate the metrics that the report wants to use. Some ugly custom wrapper scripts deal with updating the repostories, keeping trend data for each coding convention, and generating the HTML reports. The whole thing runs through HHVM to make it as fast as possible.


Stay up to date on all PHP_CodeSniffer changes, including new features and releases, by subscribing to the RSS feed or following me on Twitter.


Squiz Matrix Newsletter #481

This week we have a great new feature to report, new Maintenance Mode functions within Squiz Matrix. Continue reading below for more information on all this exciting new development.  

Squiz Matrix Maintenance Mode

Due for release in version 5.1.0.0 

This feature introduces a new Maintenance Mode within Squiz Matrix, that when enabled, will disable the functionality of specified assets on the front-end, instead printing a maintenance message for your users.

The Maintenance Mode configuration settings can be accessed on the System Maintenance screen of your Squiz Matrix system. 

The Maintenance Mode Settings 

The Maintenance Mode settings allow you to enable Maintenance Mode and modify the associated messages that will be displayed to your users.

Additional fields allow you to modify the affected asset types and root nodes, as well as any root nodes to exclude. By default, Maintenance Mode will affect all Asset BuilderAccount Manager, Custom Form and Checkout Page assets and any associated child asset types.

A Notify status is also available, that can be used prior to undergoing maintenance, notifying your users that site functions will soon be deactivated. This can give users the chance to finish their work, submissions, etc.

The Maintenance Mode Enabled Message

This new Maintenance Mode feature has been added to assist in the system upgrade process, where previously, these assets types would have to be manually edited before an upgrade could start. By effectively automating this process, the upgrading of systems should be more efficient and safer.


Newer posts Older posts

Squiz Labs

R & D division of Squiz Pty Ltd

Open source web experience management solutions

Squiz Labs is the research and development division of Squiz, the company behind the Squiz Suite of web experience management and development tools.

Our PHP and JavaScript developers are responsible for producing innovative enterprise-quality software while our interface designers and testing team ensure our products both look great and are easy to use.