定制 suki/ohara 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

suki/ohara

Composer 安装命令:

composer require suki/ohara

包简介

Helper class for SMF mods

README 文档

README

A helper class to be used by SMF modifications (Mods).

To be able to use this helper class you need to follow some requirements:

  • Needs PHP 7.0 or higher. SMF 2.1.
  • Include it or require it on your own file. You can also use composer:
$ composer require suki/ohara
  • Ohara uses composer/installers this means the class will be automatically placed inside SMF's Sources folder unless you overwrite it on your own composer.json file.

To use this helper simply extend the parent class Ohara using the Suki\Ohara namespace:

class YourClass extends Suki\Ohara
{
...
  • You need to define the $name property, ideally from a declaration:

    
    

public static $name = CLASS;


$name is the unique identifier for your main class. Can be any name but usually "__CLASS__" fits quite well.

- You need to call $this->setRegistry(), ideally on your construct method to register your class, have access to several SMF's global variables, create Pimple's service and execute any "on-the-fly" hook declarations.

Thats it, you now have all the power of Ohara. All services are stored as keys in your $this var:

$parsedText = $this['tools']->parser($text, $replacements);

- The class can largely be used as it is but some methods expects info provided by the mod author.

- All your settings ($modSettings) and text strings ($txt) must follow the same pattern:

```php
   $txt['Mod_something'];
   $modSetting['Mod_something'];

Where Mod is whatever you used in your $name property.

To be able to use a setting you simply call $this->setting('something'); or $this->text('something'); for a text string. Both values return false if there isn't a $modSetting or $txt associated with it.

$this->setting('something') also accepts a second argument to provide a fallback incase the $modSetting doesn't exists:

$something = $this->setting('something', 'not found!');

  • Ohara is named after One Piece island: Ohara.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MPL-2.0
  • 更新时间: 2014-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固