承接 wcactus/typographru 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wcactus/typographru

Composer 安装命令:

composer require wcactus/typographru

包简介

Laravel 5 screen typography module for russian language

README 文档

README

Usage / Demonstration

For unicode text:

$input = 'Falcon Heavy (букв. с англ. "Тяжёлый "Сокол"") - американская ракета-носитель (РН) сверхтяжёлого  класса с возможностью повторного использования 1-й ступени , спроектированная и произведённая-таки компанией SpaceX...';
echo TypographRu::typograph($input);
/*
output (with nonbreaking spaces, nonbreaking dashes and other special unicode symbols):
Falcon Heavy (букв. с англ. «Тяжёлый „Сокол“») – американская ракета-носитель (РН) сверхтяжёлого класса с возможностью повторного использования 1‑й ступени, спроектированная и произведённая‑таки компанией SpaceX…
*/

The screen typography is best viewed here for win-1251-encoded text:

$input = 'Falcon Heavy (букв. с англ. "Тяжёлый "Сокол"") - американская ракета-носитель (РН) сверхтяжёлого  класса с возможностью повторного использования 1-й ступени , спроектированная и произведённая-таки компанией SpaceX...';
echo TypographRu::typograph($input);
/*
output:
Falcon Heavy (букв. с&nbsp;англ. &laquo;Тяжёлый &bdquo;Сокол&ldquo;&raquo;)&nbsp;&ndash; американская ракета-носитель (РН) сверхтяжёлого класса с&nbsp;возможностью повторного использования <nobr>1-й</nobr> ступени, спроектированная и&nbsp;<nobr>произведённая-таки</nobr> компанией SpaceX&hellip;
*/

Installation

Add TypographRu to your Laravel project: composer require wcactus/typographru

Facade and service provider will be autoloaded.

The middle-length dash (the same as &ndash; HTML entity) is used by default. If you prefer the longest dash (the same as &mdash; HTML entity), you need to publish configuration file info config/typographru.php using php artisan vendor:publish --tag=typographru command and then set use_mdash configuration property to true.

Methods

TypographRu::typograph(string $text, [string $language = null, [boolean $forceQuotes = true]])

Applies screen typography to unicode string. It is assumed that all special characters in the source string are represented by unicode characters, rather than HTML entities. If some HTML entities are used as special characters, they will be converted to unicode characters (except of non-typography-specific entities). All changes in the returned string are performed using unicode characters.

string $text: text to typograph.

string $language: Optional. Can be TypographRu::LANGUAGE_RU, TypographRu::LANGUAGE_EN or null (i.e. auto-detect russian language). Affects only the kind of quotation marks, the screen typography does not fully applied to the english language. May be useful in multilanguage websites.

boolean $forceQuotes: Optional. If true, the previously placed «correct» quotes will be re-placed again.

TypographRu::typographWin1251(string $text, [string $language = null, [boolean $forceQuotes = true]])

Applies screen typography to win-1251-encoded string. It is assumed that all special characters in the source string are represented by HTML entities due to the limitations of Win-1251 encoding. All changes in the returned string are performed using HTML entities.

string $text: text to typograph.

string $language: Optional. Can be TypographRu::LANGUAGE_RU, TypographRu::LANGUAGE_EN or null (i.e. auto-detect russian language). Affects only the kind of quotation marks, the screen typography does not fully applied to the english language. May be useful in multilanguage websites.

boolean $forceQuotes: Optional. If true, the previously placed «correct» quotes will be re-placed again.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固