Message-ID: <623616841.10621.1711647992411.JavaMail.confluence@docs1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10620_2112974412.1711647992410" ------=_Part_10620_2112974412.1711647992410 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html App Configuration

App Configuration

Requires: phpFox 4.5+

=20
All configurations for your apps are set up in=20 Install.php file. Below is an example ( ToDoList app):

=20
=20
=20 =20  Expand source=20 =20
=20
=20
<?php

namespace Apps\TodoList;

use Core\App;

class Install extends App\App
{
    private $_app_phrases =3D [];

    protected function setId()
    {
        //Set ID for your app. This action is required.
        $this->id =3D 'TodoList';
    }
    protected function setSupportVersion()
    {
        //Start support version
        $this->start_support_version =3D '4.5.0';
    }

    protected function setAlias()
    {
        //Set alias for your app
        $this->alias =3D 'todo';
    }

    protected function setName()
    {
        //Set Name for your app, this name will display in manage apps (adm=
incp)
        $this->name =3D 'TodoList';
    }

    protected function setVersion()
    {
        //Set version for your app
        $this->version =3D '4.1.2';
    }

    protected function setSettings()
    {
        //Define settings for your app
        $this->settings =3D [
            'td_can_user_privacy' =3D> [
                'var_name' =3D> 'td_can_user_privacy',
                'info' =3D> 'Allow user add privacy',
                'description' =3D> 'Enable this setting in case you want=
 your user can use privacy during adding new todo list',
                'type' =3D> 'boolean',
                'value' =3D> '1',
            ],
            'td_feature_price' =3D> [
                'var_name' =3D> 'td_feature_price',
                'info' =3D> 'How much does it cost to feature a todo lis=
t?',
                'type' =3D> 'currency',
                'value' =3D> serialize(['USD' =3D> 1, 'EUR' =3D> 1=
, 'GBP' =3D> 1])
            ]
        ];
    }

    protected function setUserGroupSettings()
    {
        //Define user group settings for your app
        $this->user_group_settings =3D [
            'td_can_add_new_todo_list' =3D> [
                'var_name' =3D> 'td_can_add_new_todo_list',
                'info' =3D> 'Can add new todo list?',
                'type' =3D> 'boolean',
                'value' =3D> [
                    "1" =3D> "1",
                    "2" =3D> "1",
                    "3" =3D> "1",
                    "4" =3D> "1",
                    "5" =3D> "0"
                ],
                'ordering' =3D> 1,
            ],
            'can_sponsor_todo' =3D> [
                'info' =3D> 'Can members of this user group mark a todo =
list as Sponsor without paying fee?',
                'type' =3D> 'boolean',
                'value' =3D> [
                    '1' =3D> '1',
                    '2' =3D> '0',
                    '3' =3D> '0',
                    '4' =3D> '0',
                    '5' =3D> '0'
                ],
                'ordering' =3D> 1,
            ],
            'todo_sponsor_price' =3D> [
                'var_name' =3D> 'td_user_sponsor_price',
                'info' =3D> 'How much does it cost to sponsor a todo lis=
t',
                'type' =3D> 'currency',
                'value' =3D> [
                    '1' =3D> ['USD' =3D> 1],
                    '2' =3D> ['USD' =3D> 2],
                    '3' =3D> ['USD' =3D> 3],
                    '4' =3D> ['USD' =3D> 4],
                    '5' =3D> ['USD' =3D> 5],
                ],
            ],
            'auto_publish_sponsored_todo' =3D> [
                'info' =3D> 'Auto publish sponsored todo list?',
                'description' =3D> 'After the user has purchased a spons=
ored space, should the todo list be published right away? If set to No, the=
 admin will have to approve each new purchased sponsored todo list space be=
fore it is shown in the site.',
                'type' =3D> 'boolean',
                'value' =3D> [
                    '1' =3D> '1',
                    '2' =3D> '0',
                    '3' =3D> '0',
                    '4' =3D> '0',
                    '5' =3D> '0'
                ],
            ],
        ];
    }

    protected function setComponent()
    {
        //Define component for your app
        $this->component =3D [
            "block" =3D> [
                "recent_items" =3D> "",
            ],
            "controller" =3D> [
                "index" =3D> "todo.index",
            ]
        ];
    }

    protected function setComponentBlock()
    {
        //Define component block for your app
        $this->component_block =3D [
            "Recent Items" =3D> [
                "type_id"      =3D> "0",
                "m_connection" =3D> "todo.index",
                "component"    =3D> "recent_items",
                "location"     =3D> "3",
                "is_active"    =3D> "1",
                "ordering"     =3D> "1"
            ],
        ];
    }

    protected function setPhrase()
    {
        //Add more phrase for your app. However, for mow please define in p=
hrase.json
        $this->phrase =3D $this->_app_phrases;
    }

    protected function setOthers()
    {
        //Default page of your app in AdminCP
        $this->admincp_route =3D {your_admincp_route};

        //Set action menu to your app in AdminCP
        $this->admincp_action_menu =3D [
            '{your_action_menu_link}' =3D> {your_action_menu_name}
        ];

        //Set default menu when view app detail in AdminCP
        $this->admincp_menu =3D [
            'Manage To Do' =3D> 'todo', // 'todo' is your app's alias
        ];

        //Add your app menu into main menu in frontend
        $this->menu =3D [
            "name" =3D> "To Do List",  // Menu label
            "url" =3D> "/to-do-list", // Menu Url
            "icon" =3D> "tasks"      // Menu icons, see http://fontaweso=
me.io/icons/
        ];

        //Your company name
        $this->_publisher =3D 'phpFox';

        //Your company website
        $this->_publisher_url =3D 'http://store.phpfox.com/';

        //Include your external paths
        $this->external_paths =3D [
            [
                'path' =3D> 'PF.Base/example_folder'
                'removeable =3D> true
            ],
            [
                'path' =3D> 'PF.Base/example_file'
                'removeable =3D> false
            ]
        ];

        //Include database class name
        $this->database =3D [
            'TodoTaskTable'
        ];
    }
}
=20
=20
=20

These are all properties you can define for your app:

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

ID

Define

Type

Note

Version

In Function

Required?

1

id

String

This is your app ID, it must be the same fold= er name stored your app. Space is not allowed. This ID can't change.

=20

4.5+

setId

Yes

2

name

String

The name of your app, it will display in mana= ge app in admincp

4.5+

setName

Yes

3

version

String

Version of your app. It has to follow version= naming convention.

4.5+

setVersion

Yes

4

alias

String

This value is used for: admincp url, block na= me, component name, ajax name,... This value must be lower case and no spac= e. If your app is simple, this value can be empty.

4.5+

setAlias

No

5

icon

String

Define Icon of your app. We support 3 ways to= define your app icon: Image link: Put image link of your icon here. Font a= wesome class: Put font awesome class here: it will display icon from font a= wsome. Icon image: Don't set or set empty this value, we will get file "ico= n.png"

4.5+

setOthers

No

6

admincp_route

String

Default page of your app in admincp

4.5+

setOthers

No

7

admincp_menu

String

Your app menu in admincp

4.5+

setOthers

No

8

admincp_help

String

You can help admin by providing your instruct= ions external and add your url here.

4.5+

setOthers

No

9

admincp_action_menu

String

Action button of your app in admincp (The top= right button)

4.5+

setOthers

No

10

map

String

Support search in feed

4.5+

setOthers

No

11

map_search

String

Support search in feed

4.5+

setOthers

No

12

menu

Array

Add a menu for your app on main menu bar

<= /td>=20

4.5+

setOthers

No

13

settings

Array

Your app's settings

4.5+

setSettings

No

14

user_group_settings

Array

Your app's user groups settings

4.5+

setUserGroupSettings

No

15

database

Array

Define database structure for your app

=20

4.5+

setOthers

No

16

component

Array

App's components

4.5+

setComponent

No

17

component_block

Array

Default blocks

4.5+

setComponentBlock

No

18

component_block_remove

Array

Old blocks that you want to remove on upgrade= your app

4.5.2+

component_block_remove

setComponentBlock

No

19

start_support_version

String

Oldest phpFox version your app can support

4.5+

setSupportVersion

No

20

end_support_version

String

Newest phpFox version your app can support

4.5+

setSupportVersion

No

21

phrase

Array

Advanced phrases

4.5+

setPhrase

No

22

_publisher

String

Your company name

4.5+

setOthers

No

23

_publisher_url

String

Your company home page

4.5+

setOthers

No

24

_apps_dir

String

Your app directory name

4.5+

setOthers

No

25

_admin_cp_menu_ajax

Boolean

Set true: menu in admincp will load by ajax; = false: menu will load by refresh page. Default is true

4.5+

setOthers

No

26

_writable_dirs

Array

List all directories that your app need writa= ble permission

4.5.3+

setOthers

No

27

external_paths

Array

List all your external directories/files that= outside your app folder. You also can define which files/directories will = be removed when uninstall your app.

4.5.3+

setOthers

No

28

store_id

Integer

Support to alert site admin when new version = has been available in the store.

4.5+

setOthers

No

------=_Part_10620_2112974412.1711647992410--