wordpress 数据库_WordPress使用JavaScript和PHP库

wordpress 数据库

Almost all modern software (including platforms such as WordPress) rely on third party libraries. That’s because, as developers, we don’t need to reinvent the wheel.

几乎所有现代软件(包括WordPress等平台)都依赖第三方库。 这是因为,作为开发人员,我们不需要重新发明轮子。

If I had to develop software that uses HTTP abstraction, I might use a package like Symfony HttpKernel or similar. If my software needed more than that (unlikely by the way, but let’s imagine that for our example), I could extend that package, or in the worst case, create one from scratch. Creating something from scratch isn’t a bad thing. It can actually be a good thing, since it makes you a better developer. But commonly, in most modern projects, you’ll have to depend on third party libraries (or packages). In this article we’ll take a look at the various third party JavaScript and PHP libraries used by WordPress.

如果必须开发使用HTTP抽象的软件,则可以使用Symfony HttpKernel之类的程序包或类似程序。 如果我的软件需要更多的东西(顺便说一下,这不太可能,但是让我们想象一下这个例子),我可以扩展该软件包,或者在最坏的情况下,从头开始创建一个。 从头开始创建东西不是一件坏事。 实际上,这可能是一件好事,因为它使您成为更好的开发人员。 但是通常,在大多数现代项目中,您将不得不依赖第三方库(或程序包)。 在本文中,我们将介绍WordPress使用的各种第三方JavaScript和PHP库。

WordPress中使用的图书馆列表 (List of Used Libraries in WordPress)

In WordPress, third party libraries live alongside WordPress files. To better understand how files are structured in WordPress, the WordPress Codebase page will give you some answers. The wp-includes folder holds some of the libraries that are included when the application is executed. Also, in wp-admin you’ll find a second include folder that does the same as the first. In both folders you will find PHP and JavaScript files.

在WordPress中,第三方库与WordPress文件并存。 为了更好地了解WordPress中文件的结构,“ WordPress代码库”页面将为您提供一些答案。 wp-includes文件夹包含执行应用程序时包含的某些库。 此外,在wp-admin您将找到第二个include文件夹,该文件夹与第一个相同。 在这两个文件夹中,您将找到PHP和JavaScript文件。

The third party PHP libraries are named with class-*.php (single files) or live inside their own folder. Other PHP files named class-*.php can be WordPress files (not third party). PHP files live under the wp-include or wp-admin/include folders.

第三方PHP库以class-*.php (单个文件)命名或位于其自己的文件夹中。 其他名为class-*.php PHP文件可以是WordPress文件(不是第三方)。 PHP文件位于wp-includewp-admin/include文件夹下。

JavaScript files also reside under these folders, but they are grouped in the js folder.

JavaScript文件也位于这些文件夹下,但是它们被分组在js文件夹中。

The CSS files are mainly jQuery or TinyMCE CSS files, found under CSS folder in the include folders.

CSS文件主要是jQuery或TinyMCE CSS文件,位于include文件夹中的CSS文件夹下。

JavaScript库 (JavaScript Libraries)

Let’s start with the JavaScript libraries. WordPress uses jQuery heavily. It uses:

让我们从JavaScript库开始。 WordPress大量使用jQuery 。 它用:

As you might notice, some of these libraries don’t have a link. That’s because some are them are very old and the repos don’t exist anymore. Let’s check them out one-by-one.

您可能会注意到,其中一些库没有链接。 那是因为它们有些很旧,并且回购不再存在。 让我们一一检查一下。

jQuery is a famous library, one that doesn’t need an introduction.

jQuery是一个著名的库,不需要介绍。

jQuery Masonry is plugin that makes easier to create masonry layouts like this one:

jQuery Masonry是一个插件,可以更轻松地创建这样的砌体布局:

jQuery Masonry plugin

Layouts like this are a bit hard to do from scratch, jQuery Masonry makes this easy.

像这样的布局从头开始很难做,jQuery Masonry使这变得容易。

jQuery Hotkeys deals with shortcuts on the browser. If you’re used to tools such as StackEdit.io, you may use ‘ctrl+s’ (command+s) to save a file on gDrive or other cloud providers. The (ctrl+s) shortcut by default in your browser can be used to save a web page, using this plugin you can override these default shortcuts.

jQuery Hotkeys处理浏览器上的快捷方式。 如果您习惯使用StackEdit.io之类的工具,则可以使用“ ctrl + s”(command + s)将文件保存在gDrive或其他云提供商上。 您浏览器中的默认(ctrl + s)快捷方式可用于保存网页,使用此插件,您可以覆盖这些默认快捷方式。

jQuery Form deals with forms and AJAX calls. If you’re curious and want to learn more about this plugin, you can check out their docs.

jQuery Form处理表单和AJAX调用。 如果您好奇并想了解有关此插件的更多信息,可以查看其文档

jQuery Color is used by WordPress for color manipulation and animation.

WordPress使用jQuery Color进行颜色处理和动画处理。

jQuery("#go").click(function(){
    jQuery("#block").animate({
            backgroundColor: "#abcdef"
    }, 1500 );
});

The first line selects the element with id="go" and tells the browser that it should animate the background color of the element with id="block" in 1.5 seconds.

第一行选择id="go"的元素,并告诉浏览器应在1.5秒内为id="block"的元素设置背景色动画。

jQuery Migrate helps you when dealing with earlier jQuery codebases. This is very important for WordPress because it is a platform that should be backwards compatible.

使用早期的jQuery代码库时,jQuery Migrate可以为您提供帮助。 这对于WordPress非常重要,因为它是一个向后兼容的平台。

As a matter of fact, backwards compatibility is one of the most well known features of WordPress. On the other hand, it’s one of the problems with WordPress. WordPress was released in 2003, the PHP version that was used for that release is ancient. Today, PHP is a modern language and has borrowed many useful features from other languages. But this is another topic, one for a future article.

实际上,向后兼容性是WordPress最著名的功能之一。 另一方面,这是WordPress的问题之一。 WordPress于2003年发布,该版本使用PHP版本是古老的。 今天,PHP是一种现代语言,并从其他语言中借鉴了许多有用的功能。 但这是另一个主题,将在以后的文章中讨论。

WordPress also uses other JavaScript libraries, not just jQuery. Here are some other popular libraries it uses:

WordPress还使用其他JavaScript库,而不仅仅是jQuery。 这是它使用的其他一些流行的库:

And the list goes on and on.

这样的例子不胜枚举。

The most famous from this list is TinyMCE and Backbone. TineMCE is used to compose new Posts and Pages in the WordPress dashboard.

该列表中最著名的是TinyMCE和Backbone。 TineMCE用于在WordPress仪表板中撰写新的帖子和页面。

Backbone is a front-end framework, in fact it was one of the first. It is still being used today, but loosing a lot of market share from Angular and other front-end frameworks. And yes, I’m talking to you Meteor. But don’t worry, in the JavaScript universe, frameworks (libraries) are forgotten as fast as they become popular.

Backbone是一个前端框架,实际上它是第一个。 它至今仍在使用,但是从Angular和其他前端框架中失去了很多市场份额。 是的,我在和你说流星 。 但是不用担心,在JavaScript领域中,框架(库)的流行与日俱增。

PHP库 (PHP Libraries)

The list of PHP libraries is a bit different. We saw that JavaScript was mainly influenced by jQuery and some other popular libraries. With PHP, things are different, as most of the third party libraries are just one class (file). Here’s a short list of the current third party PHP libraries:

PHP库的列表有些不同。 我们看到JavaScript主要受jQuery和其他一些流行库的影响。 使用PHP,情况有所不同,因为大多数第三方库只是一个类(文件)。 以下是当前第三方PHP库的简短列表:

公开讨论 (An Open Discussion)

Many of the libraries are a bit outdated. This is when discussions on topics such as architecture tend to happen. I would personally like to see Bower and Composer integration with WordPress. I would like to ask the SitePoint community about these ideas, and have an open discussion on how things can be improved with WordPress. Please leave your comments and thoughts below.

许多库有些过时了。 这是关于诸如架构之类的话题的讨论趋于发生的时候。 我个人希望看到Bower和Composer与WordPress集成。 我想向SitePoint社区询问这些想法,并就如何使用WordPress进行改进进行公开讨论。 请在下面留下您的评论和想法。

结论 (Conclusion)

In this article we’ve seen the various third party libraries that WordPress uses. Knowing what WordPress uses behind the scenes, you’ll have a much better understanding on how it works. The better your understanding, the faster and smarter you’ll be able to work with WordPress. Maybe you can even work towards contributing to WordPress core. After all, this is the world of Open Source, we learn from each other and share ideas (both code and pizza!).

在本文中,我们已经看到了WordPress使用的各种第三方库。 了解WordPress在幕后的用途,您将对其工作原理有更好的了解。 了解得越多,使用WordPress就能越快,越聪明。 也许您甚至可以致力于为WordPress核心做出贡献。 毕竟,这就是开源的世界,我们彼此学习并分享想法(包括代码和披萨!)。

翻译自: https://www.sitepoint.com/javascript-and-php-libraries-used-by-wordpress/

wordpress 数据库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值