1. 云栖社区>
  2. PHP教程>
  3. 正文

WordPress Replaces PHP with JavaScript

作者:用户 来源:互联网 时间:2017-12-01 14:34:49

WordPress Replaces PHP with JavaScript - 摘要: 本文讲的是WordPress Replaces PHP with JavaScript, WordPress has replaced PHP with web technologies and a RESTful back-end API for the administration console. Writin

WordPress has replaced PHP with web technologies and a RESTful back-end API for the administration console.

Writing about why WordPress decided to move from PHP to JavaScript, Matt Mullenweg, Founder and CEOof Automattic Inc., the company behind WordPress, said that the foundations of the platform were not strong enough for what is to come, and some of WordPress’ strengths were also drawbacks. The main component affected by this overhaul is the administrative interface which saw a remake in version 3.8., but gave Mullenweg the conviction that an “incremental approach wouldn’t give us the improvements we needed.” He added that “backward compatibility and working without JavaScript “ were the main culprits inhaving the interface the way it should be.

Automattic decided back in 2014 to create a new admin interface called Calypsobuilt using web technologies–JavaScript, HTML, CSS, Node.js, React, Flow, WebPack, Babel– and accessing the back-end through a RESTful API. Andy Peatling, Calypso Project Lead, has written on what it meant for a PHP/MySQL company to switch to JavaScript. They had a few advanced JavaScript developers who could contribute to the project, the others being “intimidated” by Calypso. They had also used Trac for project management andhad done very little code review. Starting using GitHub and its pull request system followed by commit and code review helped them see “how much easier internal collaboration could be, and how to allow for much greater feedback on individual work being done.” Although initially intimidating, code review “greatly increased the quality of our codebase and helped everyone level up their JavaScript skills.” Over a period of 20 months they went from 7 contributors to 127 and over 26,000 commits. The team has also implemented continuous integration.

The new interface is asingle page application with a responsive design adapting to screens of various sizes. According to thisfeature comparison table, Calypso is fast with near instant page loads, instant publishing, in-page previews for multiple targets, and changes are applied in real time without reloading.

One of the benefits of using a JavaScript responsive design is that creating desktop or mobile clients is much easier than before, as Peatling remarked:

By the middle of 2015 the Calypso codebase was in good enough shape to be usedoutside of the web browser. Since Calypso is entirely JavaScript, HTML, and CSS, it can run locally on a device with a lightweight node.jsserver setup. Using a technology called Electron, we built native desktop clients running the same code bundled inside the applications. We started work first on a native Mac desktop app, which is now available, and continued that work on soon-to-be-launched Windows and Linux apps. Seeing these apps come together and using them internally really started to justify all the hard work we’d spent building the Calypso codebase.

Automattic has open sourced Calypso, but they still have “a ton to figure out around plugins, extensibility, contributions, Windows and Linux releases, API speed, localization, and harmonizing the WordPress.com API and WP-API so it can work with core WordPress,” according to Mullenweg. Also, they leave it to the community to decide the inclusion of Calypso in the Core WordPressto replace or not the current admin interface.

WordPress is currently used by a quarter of world’s CMSes, according to W3Techs, up from 13% as it was in 2011.

以上是WordPress Replaces PHP with JavaScript的全部内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有其他相关内容,欢迎继续使用右上角搜索按钮进行搜索,以便于您获取更多的相关知识。