定制 raffaelj/cpmultiplane 二次开发

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

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

raffaelj/cpmultiplane

Composer 安装命令:

composer create-project raffaelj/cpmultiplane

包简介

A small PHP frontend for Cockpit CMS v1

README 文档

README

A small PHP front end for the fast and headless Cockpit CMS.

Docs (work in progress), i18n

CpMultiplane is not compatible with Cockpit CMS v2.

See also Cockpit CMS v1 docs, Cockpit CMS v1 repo and Cockpit CMS v2 docs, Cockpit CMS v2 repo.

My main goals:

  1. privacy by design and privacy by default
  2. developer friendliness
  • no plugins to deactivate half of the core features needed
  • ability to adjust everything
  1. clean and structured backend for my clients - Cockpit CMS with addons and modifications
  2. structured data - keep the system and the data portable and future proof
  3. modular, small and reusable code
  4. semantic html, responsive css, usable without javascript
  5. multilingualism by design

CpMultiplane is no classic Cockpit addon. It uses Cockpit as a library, registers multiplane as a new module and than uses cockpit's core features. The backend still works as a standalone tool to manage and structure data.

It is the refactored version of Monoplane, which is not maintained anymore.

Requirements

  • PHP >= 7.1
  • PDO + SQLite (or MongoDB)
  • GD extension
  • pecl intl extension (optional)
  • mod_rewrite, mod_versions enabled (on apache)

Make also sure that $_SERVER['DOCUMENT_ROOT'] exists and is set correctly.

You can find the detailed version and a cli install example in docs/installation.

Installation

manually

  • copy all files of this repository into your web root
  • copy .htaccess.dist to .htaccess
  • copy Cockpit in a subfolder of your web root and name it cockpit
  • copy additional addons, create your collections, adjust some settings

via git

cd ~/html
git clone https://github.com/raffaelj/CpMultiplane.git .
cp .htaccess.dist .htaccess
git clone https://github.com/agentejo/cockpit.git cockpit
git clone https://github.com/raffaelj/cockpit_CpMultiplaneGUI.git cockpit/addons/CpMultiplaneGUI
git clone https://github.com/raffaelj/cockpit_FormValidation.git cockpit/addons/FormValidation
git clone https://github.com/raffaelj/cockpit_UniqueSlugs.git cockpit/addons/UniqueSlugs

via composer

cd ~/html
composer create-project --ignore-platform-reqs raffaelj/cpmultiplane .

If you use composer, Cockpit and the addons CpMultiplaneGUI, FormValidation and UniqueSlugs are installed automatically.

via docker

The docker image comes preinstalled with the quickstart routine of the "basic" template, with a default admin user (password: admin) and with dummy data from installed addons.

This is not meant for production use, but for local development.

docker pull raffaelj/cpmultiplane
docker run --rm -d --name cpmultiplane -p 8080:80 raffaelj/cpmultiplane

Now open your browser on localhost:8080 and see it in action.

Features

  • pages and sub pages (e. g. posts)
  • multilingual with language prefix, e. g.: example.com/en/my-page
  • 2 modes for structured content
    1. one collection per content type, e. g. a collection named pages and a collection named posts
    2. a single collection named pages - each entry has a type page or post (experimental)
  • maintenance mode with option for allowed ips
  • simple content preview while editing pages
  • two basic responsive themes with scss files
  • simple privacy notice banner, that gets enabled when clicking on video link
  • contact forms - fully functional without javascript
  • pre-rendering of markdown fields
  • multiple ways to change everything
  • GUI via CpMultiplaneGUI addon
  • full-text search
  • ...

Recommended Addons

Install these addons in cockpit/addons/.

  • CpMultiplaneGUI
    • adds a few fields to the sidebar, so you don't have to define them in your collection definitions
    • some gui tweaks for easier access
    • work in progress...
  • UniqueSlugs
    • If links should point to slug instead of _id
    • for multilingual slugs in language switch
  • rljUtils
    • fixes security issues in Admin UI for multi user setups
    • big language buttons for multilingual setups
  • FormValidation
    • The inbuilt Forms Controller requires field definitions from this addon
    • The inbuilt views and css files are written to match the field definitions
  • VideoLinkField
    • inbuilt /assets/js/mp.js, some views and css files are designed to load videos privacy friendly with a privacy notice, that pops up only when a user clicks a play button
  • SimpleImageFixBlackBackgrounds
    • replaces the SimpleImage library with a modified version to fix black backgrounds of transparent png and gif files on hosts with a non-bundled PHP GD version
  • EditorFormats - if you want to give your users a Wysiwyg field

Intended use

Backend - Cockpit

  1. Create a singleton site for your default page definitions.
  2. Create a collection pages for all of your pages.
  3. Create a collection posts for all of your blog posts.
  4. Use the CpMultiplaneGUI addon.

Frontend - CpMultiplane

  1. create a child theme of rljbase or create your own theme
  2. adjust defaults in /child-theme/config/config.php
  3. add snippets to /child-theme/bootstrap.php, that are explicitly for your theme
  4. add snippets to /config/bootstrap.php, that are specifically for your setup
  5. change some partials to fit your needs

Settings

The fastest way to change some defaults, is to add some values to /cockpit/config/config.php:

<?php
return [
    'app.name' => 'CpMultiplane',

    'i18n' => 'en',
    'languages' => [
        'default' => 'English',
        'de' => 'Deutsch',
    ],

    // define settings here
    'multiplane' => [
        'pages' => 'pages',
        'siteSingleton' => 'site',
        'slugName' => 'slug',
        'use' => [
            'collections' => [
                'pages',
                'posts',
                'products',
            ],
            'singletons' => [
                'site',
            ],
            'forms' => [
                'contact',
            ],
        ],
    ],
];

The cleaner and more user friendly way is to use the GUI. Create a profile, name it my-profile and set multiplane to the profile name:

return [
    'app.name' => 'CpMultiplane',

    'i18n' => 'en',
    'languages' => [
        'default' => 'English',
        'de' => 'Deutsch',
    ],

    // define settings via profile
    'multiplane' => [
        'profile' => 'my-profile',
    ],
];

Reserved routes

  • /login - Calling example.com/login reroutes to the admin folder, e. g. example.com/cockpit
  • /search - full-text search
  • /getImage - Calling /getImage?src=assets_id?w=100&h=100&m=thumbnail returns images/thumbnails with predefined settings, that can be adjusted with params
  • /submit/form_name and /form/form_name - for contact forms
  • /getPreview and /livePreview for content preview
  • /clearcache to clear cockpit's cache (only in debug mode)

Copyright and License

Copyright 2019 Raffael Jesche under the MIT license.

See LICENSE for more information.

Credits and third party resources

Without Cockpit, CpMultiplane couldn't exist. Thanks to Artur Heinze and to all contributors.

raffaelj/cpmultiplane 适用场景与选型建议

raffaelj/cpmultiplane 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98 次下载、GitHub Stars 达 17, 最近一次更新时间为 2020 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「frontend」 「cockpit」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 raffaelj/cpmultiplane 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 raffaelj/cpmultiplane 我们能提供哪些服务?
定制开发 / 二次开发

基于 raffaelj/cpmultiplane 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-09