Other XenForo Cheat Sheets General Coding - Mã hóa chung XenForo Cheat Sheets

PVS

Super Moderator
Thành viên BQT
Tham gia
28/02/2015
Bài viết
16,829
Được Like
12,691
XenForo Cheat Sheets General Coding - Mã hóa chung XenForo Cheat Sheets

XenForo Cheat Sheets Project là một dự án nhằm giảm khó khăn cho các nhà phát triển addon mới, phát triển addon chất lượng cao bằng cách cung cấp các bảng chức năng/tags/thông tin khác, mã takeaway họ có thể lộn xộn, phá vỡ và học từ, và các nội dung khác sẽ giúp các nhà phát triển addon học cách XenForo hoạt động.

Tất cả các tài liệu liên quan đến dự án này được phát hành theo Giấy phép CC By-Sa 3.0 Unported.

Dự án sẽ sử dụng Resource Manager cho đến khi nội dung là quá lớn để có thể duy trì qua RM. Nếu ngày đó đến, chúng tôi sẽ chuyển đến MediaWiki.

Hỗ trợ nhiều phiên bản của XenForo

Mô tả: Bạn thường xuyên có thể nhận được các loại lỗi:
Mã:
Strict Standards: Declaration of childClass::customMethod() should be compatible with that of parentClass::customMethod()

Để thực hiện các addon của bạn tương thích với tất cả các phiên bản của XenForo (cho đến khi họ thay đổi cấu trúc addon để sử dụng namespaces), bạn sẽ phải thực hiện nhiều phiên bản của các class của bạn.

Bạn có thể sử dụng mã này để quyết định class được mở rộng trong các cuộc gọi listener.

Bạn cũng có thể sử dụng chức năng determineVersion một cách nhanh chóng của việc xác định phiên bản chính.

Hoạt động trên tất cả các phiên bản của XenForo
Mã:
if (XenForo_Application::$versionId >= 1020000 and XenForo_Application::$versionId < 1030000) {
    // 1.2 specific code here
} elseif (XenForo_Application::$versionId >= 1010000 and XenForo_Application::$versionId < 1020000) {
    // 1.1 specific code here
} elseif (XenForo_Application::$versionId >= 1000000 and XenForo_Application::$versionId < 1010000) {
    // 1.0 specific code here
}

function determineVersion() {
    $versionStrSplit = str_split(XenForo_Application::$versionId);
    return strval($versionStrSplit[0].$versionStrSplit[2]);
}

Cấu hình tất cả các mục
Mô tả: Tất cả các tùy chọn cấu hình trong file config.php. Vào thông qua XenForo_Application.
Hoạt động trên: N/A
1.1:
Mã:
            'db' => array(
                'adapter' => 'mysqli',
                'host' => 'localhost',
                'port' => '3306',
                'username' => '',
                'password' => '',
                'dbname' => '',
                'adapterNamespace' => 'Zend_Db_Adapter'
            ),
            'cache' => array( // See http://framework.zend.com/manual/1.12/en/zend.cache.html
                'enabled' => false,
                'cacheSessions' => false,
                'frontend' => 'core',
                'frontendOptions' => array(
                    'caching' => true,
                    'cache_id_prefix' => 'xf_'
                ),
                'backend' => 'file',
                'backendOptions' => array(
                    'file_name_prefix' => 'xf_'
                )
            ),
            'debug' => false,
            'enableListeners' => true,
            'development' => array( // TODO: Need information about this
                'directory' => '', // relative to the configuration directory
                'default_addon' => ''
            ),
            'superAdmins' => '1',
            'globalSalt' => '', // Global Salt used. Differs per each download of the XenForo license.
            'jsVersion' => '',
            'cookie' => array(
                'prefix' => 'xf_',
                'path' => '/',
                'domain' => ''
            ),
            'enableMail' => true,
            'internalDataPath' => 'internal_data',
            'externalDataPath' => 'data',
            // The follow variables below can be used to set up the CDN
            'externalDataUrl' => 'data',
            'javaScriptUrl' => 'js',
            'checkVersion' => true,
            'enableGzip' => true,
            'enableContentLength' => true,
            'adminLogLength' => 60, // number of days to keep admin log entries
            'chmodWritableValue' => 0,
            'rebuildMaxExecution' => 10, // Max actions the cache rebuilding process will perform. Raising this limit can cause big boards to timeout during this, but will however speed up cache rebuilding process on smaller boards/development boards.
            'enableClickjackingProtection' => true,
            'maxImageResizePixelCount' => 16000000 // Width*Height

Thay đổi 1.2:

Entries mới:
Mã:
            'passwordIterations' => 10, // Used for bcrypt. Increasing this value will make the password harder to break, but will sacrifice performance. Tinker with caution!
            'enableTemplateModificationCallbacks' => true,

Thay đổi entries:
Mã:
            'maxImageResizePixelCount' => 20000000 // From 16000000

Chúc các bạn thành công.


Nguồn: xenforo.com​
 

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mobile/Zalo: 0906081284

Telegram: anhanhxf

Chỉ nhận web nội dung lành mạnh

Nhà Tài Trợ

Mút Xốp Không Gian
Mút Sofa Không Gian
Top Bottom