Skip to content

Commit feb4d7b

Browse files
authored
Merge pull request #954 from ExpressionEngine/7.dev
Additional Doc Updates Live
2 parents 35d5183 + 8bdd643 commit feb4d7b

File tree

4 files changed

+236
-40
lines changed

4 files changed

+236
-40
lines changed

docs/control-panel/settings/captcha.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@
1111

1212
**Control Panel Location: `Settings > CAPTCHA`**
1313

14-
This section of the Control Panel allows you to set [CAPTCHA](security/captchas.md) preferences for your website.
14+
This section of the Control Panel allows you to set the [CAPTCHA](security/captchas.md) preferences for your website.
1515

1616
## Settings
1717

1818
### Require CAPTCHA?
1919

20-
If you enable this preference, then site visitors will be required to pass a CAPTCHA to submit any front-end form, including Channel Form, comment forms, and member registrations. If members are logged in, they will not have to enter a CAPTCHA unless the [Require CAPTCHA while logged in?](#require-captcha-while-logged-in) preference is enabled below.
20+
If you enable this preference, then site visitors will be required to pass a CAPTCHA to submit any front-end form, including Channel Form, comment forms, contact forms, and member registrations. If members are logged in, they will not have to enter a CAPTCHA unless the [Require CAPTCHA while logged in?](#require-captcha-while-logged-in) preference is enabled.
21+
22+
### Require CAPTCHA while logged in?
23+
24+
If you enable this preference, then even members who are logged in will need to fill out CAPTCHA information in order to post, for example, comments (assuming you've enabled CAPTCHA support for comment posting). If you disable this setting, then members who are logged in will bypass the CAPTCHA check.
25+
26+
### Use reCAPTCHA v3?
27+
28+
If you enable this preference then the system will use reCAPTCHA v3 in place of the built-in image based solution.
29+
30+
## Built-in CAPTCHA Settings
2131

2232
### Use TrueType font?
2333

@@ -27,10 +37,6 @@ If your server supports TrueType Fonts, then you can enable this setting. If you
2737

2838
Specify whether to add a random three-digit number to the end of each generated CAPTCHA word. This makes it more difficult for scripts to guess or brute-force the form submission.
2939

30-
### Require CAPTCHA while logged in?
31-
32-
If you enable this preference, then members who are logged in will need to fill out CAPTCHA information in order to post comments (assuming you've enabled CAPTCHA support for comment posting). If you disable this setting, then members who are logged in can bypass the CAPTCHA check.
33-
3440
### CAPTCHA directory
3541

3642
The URL to your [CAPTCHA](security/captchas.md) images. In most cases, this will be similar to:
@@ -51,11 +57,7 @@ If you do not know what to use for your full server path, contact your Host or s
5157

5258
## reCAPTCHA v3 Settings
5359

54-
If you wish to use Google reCAPTCH v3 as a replacement you will need to ensure that the site is set up with Google to gain the required site key and secret. See https://www.google.com/recaptcha/admin/create
55-
56-
### Use reCAPTCHA v3?
57-
58-
If you enable this preference then the system will use reCAPTCHA v3 in place of the older image based solution.
60+
If you wish to use (Google reCAPTCHA v3)[https://cloud.google.com/security/products/recaptcha#how-it-works] as a replacement for the built-in functionality, you will need to ensure that the site is set up with Google with the required site key and secret. Note that there is currently a monthly limit on the number of free CAPTCHAs that Google provides. See https://www.google.com/recaptcha/admin/create
5961

6062
### reCAPTCHA site key
6163

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
---
2+
lang: php
3+
---
4+
5+
<!--
6+
This source file is part of the open source project
7+
ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide)
8+
9+
@link https://expressionengine.com/
10+
@copyright Copyright (c) 2003-2025, Packet Tide, LLC (https://packettide.com)
11+
@license https://expressionengine.com/license Licensed under Apache License, Version 2.0
12+
-->
13+
14+
# Database SmartForge Class
15+
16+
**class `Smartforge`**
17+
18+
[TOC]
19+
20+
The Smartforge Class contains utility methods to help you manage your database. Load the Forge Class as follows:
21+
22+
ee()->load->library('smartforge')
23+
24+
Once initialized you will access the methods using the `ee()->smartforge` object:
25+
26+
ee()->smartforge->some_method();
27+
28+
Some Smartforge class functions duplicate similar dbforge class functions but adds more intelligence to these transaction - for example by checking that the
29+
table / column / index actually exist before executing the function. The other Smartforge functions are novel to the class.
30+
31+
## Utility functions
32+
33+
[TOC=3]
34+
35+
### `create_table($table)`
36+
37+
| Parameter | Type | Description |
38+
| --------- | -------------- | ----------------------------------------- |
39+
| \$table | `String` | The name of the table to create |
40+
| Returns | `CI_DB_result` | The result of the `CREATE TABLE` query |
41+
42+
Creates a table within the current EE database. Function will check to make sure the existing table doesn't exist before creating it.
43+
44+
ee()->smartforge->create_table('cat_watch_list');
45+
46+
### `rename_table($table, $new_table)`
47+
48+
| Parameter | Type | Description |
49+
| ----------- | ---------------------- | -------------------------------------------------------------- |
50+
| \$table | `String` | The name of the table to rename |
51+
| \$new_table | `String` | The new name for the table. |
52+
| Returns | `CI_DB_result| bool` | The result of the `ALTER TABLE .. RENAME TO ..` query or false |
53+
54+
Renames a table. Function will check to make sure the existing table name actually exists and the new table name doesn't.
55+
56+
ee()->smartforge->rename_table('cat_watch_list','malicious_feline_ids');
57+
58+
### `add_column($table = '', $field = array(), $after_field = '')`
59+
60+
| Parameter | Type | Description |
61+
| -------------- | ---------------------- | -------------------------------------------------------------- |
62+
| \$table | `String` | The name of the table to add a column to |
63+
| \$field | `Array` | A multiddimensional associative array containing field names as the keys and an associative array of parameters for creating database fields: <br> `type`: The type of field to create (e.g. `INT`, `VARCHAR`, `TEXT`) <br> `constraint`: The length of the field <br> `unsigned`: Set to `TRUE` to generate `UNSIGNED` in the field definition. <br> `default`: Set to a value to generate a default value in the field definition. <br> `null`: Set to `TRUE` to generate `NULL` in the field definition. Without this, the field will default to `NOT NULL`. <br> `auto_increment`: Set to `TRUE` to generate an `auto_increment` flag on the field. Note that the field type must be a type that supports this, such as integer. |
64+
| \$after_field | `String` | The field that should come before this new field, leave empty to be the last field |
65+
| Returns | `bool` | True if the column add succeeds, otherwise false |
66+
67+
Adds one or more columns to a table, optionally starting the insertion after a nominated column. For each column to add it checks to see if column already exists in the DB; if it does it skips adding that column.
68+
69+
ee()->smartforge->add_column('cat_watch_list','malicious_feline_ids');
70+
$fields = array(
71+
'preferences' => array('type' => 'TEXT')
72+
);
73+
ee()->smartforge->add_column('table_name', $fields);
74+
75+
You can also take advantage of MySQL's `AFTER` and `FIRST` clauses to position the new column:
76+
77+
// Will place the new column after the `another_field` column:
78+
$fields = array(
79+
'preferences' => array('type' => 'TEXT', 'after' => 'another_field')
80+
);
81+
82+
// Will place the new column at the start of the table definition:
83+
$fields = array(
84+
'preferences' => array('type' => 'TEXT', 'first' => TRUE)
85+
);
86+
87+
### `drop_column($table, $column_name)`
88+
89+
| Parameter | Type | Description |
90+
| ------------- | -------------- | --------------------------------- |
91+
| \$table | `String` | The table to drop the column from |
92+
| \$column_name | `String` | The name of column to drop |
93+
| Returns | `CI_DB_result|bool` | The result of the `DROP` query or false if it fails |
94+
95+
Drop a column in the given database table if it already exists.
96+
97+
ee()->smartforge->drop_column('table_name', 'name_of_col_7');
98+
99+
### `drop_column_batch($table, $column_names)`
100+
101+
| Parameter | Type | Description |
102+
| ------------- | -------------- | --------------------------------- |
103+
| \$table | `String` | The table to drop the column from |
104+
| \$column_names | `Array` | An array of column names to drop |
105+
| Returns | `CI_DB_result|bool` | The result of the `DROP` query or false if it fails |
106+
107+
Drop multiple columns in the given database table if they already exists.
108+
109+
ee()->smartforge->drop_column('table_name', ['name_of_col_11','name_of_col_33']);
110+
111+
### `drop_table($table)`
112+
113+
| Parameter | Type | Description |
114+
| --------- | -------------- | ---------------------------------------------- |
115+
| \$table | `String` | The name of the table to drop |
116+
| Returns | `CI_DB_result|bool` | The result of the `DROP TABLE IF EXISTS` query or false if it fails|
117+
118+
Drops a table from the database if it exists.
119+
120+
ee()->smartforge->drop_table('table_name');
121+
122+
### `modify_column($table = '', $field = array())`
123+
124+
| Parameter | Type | Description |
125+
| --------- | -------------- | ------------------------------------------------------ |
126+
| \$table | `String` | The table to add the column to |
127+
| \$field | `Array` | The column definition (see `add_column()` for details) |
128+
| Returns | `bool` | True if it succeeds, false otherwise |
129+
130+
Modify a database column (if it exists) with the added check that if the column is being renamed and both current column (A) and proposed column (B) names exist, drop column A and leave column B.
131+
132+
If both columns exist, it's likely this update is being run again from a version further back than the point the DB is actually at (an overlay, if you will). Therefore, column B is probably the one with all the data in it, and column A has only very recently (as in, within seconds) been created.
133+
134+
$fields = array(
135+
'old_name' => array(
136+
'name' => 'new_name',
137+
'type' => 'TEXT',
138+
),
139+
);
140+
141+
ee()->smartforge->modify_column('table_name', $fields);
142+
143+
### `insert_set($table = '', $values = array(), $unique = array())`
144+
145+
| Parameter | Type | Description |
146+
| --------- | -------------- | ------------------------------------------------------ |
147+
| \$table | `String` | The table to add the column to |
148+
| \$values | `Array` | An associative array of column names => row values |
149+
| \$unique | `Array` | An associative array of column names => row values (can only include key/value pairs from $values) |
150+
| Returns | `bool` | True if it succeeds, false otherwise |
151+
152+
Insert values into the database, with optional unique column name/values in a given column(s).
153+
154+
If the unique field content already exists in the column in the DB, function return FALSE since this set of values cannot be inserted into the column without breaking the uniqueness test.
155+
156+
ee()->smartforge->insert_set('table_name', $values, $unique);
157+
158+
### `add_key($table = '', $col_name = '', $key_name = '')`
159+
160+
| Parameter | Type | Description |
161+
| ------------ | -------------- | ------------------------------------------------ |
162+
| \$table | `String` | The name of the table to drop |
163+
| \$col_name | `String|array` | The name(s) of the column(s) to include in index |
164+
| \$key_name | `String` | The name for the new key (optional) |
165+
| Returns | `bool` | True if it succeeds, false otherwise |
166+
167+
Add a new key to the given database table if it doesn't already exist. Will create a composite primary key if `$col_name` is array and key name is PRIMARY.
168+
169+
ee()->smartforge->add_key('table_name', 'name_of_column_22', 'index_for_22');
170+
171+
### `drop_key($table = '', $key_name = '')`
172+
173+
| Parameter | Type | Description |
174+
| ------------ | -------------- | ------------------------------------------------ |
175+
| \$table | `String` | The name of the table to drop |
176+
| \$key_name | `String` | The name of the key to drop |
177+
| Returns | `bool` | True if it succeeds, false otherwise |
178+
179+
Add a new key to the given database table if it doesn't already exist. Will create a composite primary key if `$col_name` is array and key name is PRIMARY.
180+
181+
ee()->smartforge->drop_key('table_name', 'index_for_22');
182+

docs/development/services/modal.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ Finally, we need to create our Bulk Action Controls with some special data attri
130130

131131
Now when a user selects some content in the table, the bulk action controls should appear, and when "Remove" is selected and submitted, a modal will appear showing a list of content about to be deleted, where they can then confirm the deletion and your `POST` handler will be fired.
132132

133+
## Advanced functionality
134+
135+
### Automatically open a modal
136+
137+
If you manually build a modal view, you can add `.app-modal` and a `rev` attribute like:
138+
139+
<div class="modal-wrap app-modal" rev="my-automatic-modal">
140+
141+
Then, visiting the CP page with `#my-automatic-modal` in the URL will automatically open this modal on page load.
142+
143+
NOTE: Note: the `rev` value must be longer than 5 characters in order for this to work. `#test` would not work, but `#testing` would.
144+
133145
## CP/Modal Service Methods
134146

135147
**class `ExpressionEngine\Service\Modal\ModalCollection`**

0 commit comments

Comments
 (0)