1 | <?php |
||
7 | class GravityView_Entry_Notes { |
||
8 | |||
9 | /** |
||
10 | * GravityView_Entry_Notes constructor. |
||
11 | */ |
||
12 | public function __construct() { |
||
15 | |||
16 | /** |
||
17 | * @since 1.15 |
||
18 | */ |
||
19 | private function add_hooks() { |
||
22 | |||
23 | |||
24 | /** |
||
25 | * Alias for GFFormsModel::add_note() with default note_type of 'gravityview' |
||
26 | * @see GFFormsModel::add_note() |
||
27 | * @since 1.15 |
||
28 | * @param int $lead_id ID of the Entry |
||
29 | * @param int $user_id ID of the user creating the note |
||
30 | * @param string $user_name User name of the user creating the note |
||
31 | * @param string $note Note content. |
||
32 | * @param string $note_type Type of note. Default: `gravityview` |
||
33 | */ |
||
34 | public static function add_note( $lead_id, $user_id, $user_name, $note = '', $note_type = 'gravityview' ) { |
||
57 | |||
58 | /** |
||
59 | * Alias for GFFormsModel::delete_note() |
||
60 | * @see GFFormsModel::delete_note() |
||
61 | * @param int $note_id Entry note ID |
||
62 | */ |
||
63 | public static function delete_note( $note_id ) { |
||
66 | |||
67 | /** |
||
68 | * Delete an array of notes |
||
69 | * Alias for GFFormsModel::delete_notes() |
||
70 | * @todo Write more efficient delete note method using SQL |
||
71 | * @param int[] $note_ids Array of entry note ids |
||
72 | */ |
||
73 | public static function delete_notes( $note_ids = array() ) { |
||
81 | |||
82 | /** |
||
83 | * Alias for GFFormsModel::get_lead_notes() |
||
84 | * |
||
85 | * @see GFFormsModel::get_lead_notes |
||
86 | * @param int $entry_id Entry to get notes for |
||
87 | * |
||
88 | * @return stdClass[] Integer-keyed array of note objects |
||
89 | */ |
||
90 | public static function get_notes( $entry_id ) { |
||
103 | |||
104 | /** |
||
105 | * Use the GravityView avatar for notes created by GravityView |
||
106 | * Note: The function is static so that it's easier to remove the filter: `remove_filter( 'gform_notes_avatar', array( 'GravityView_Entry_Notes', 'filter_avatar' ) );` |
||
107 | * @since 1.15 |
||
108 | * @param string $avatar Avatar image, if available. 48px x 48px by default. |
||
109 | * @param object $note Note object with id, user_id, date_created, value, note_type, user_name, user_email vars |
||
110 | * @return string Possibly-modified avatar |
||
111 | */ |
||
112 | public static function filter_avatar( $avatar = '', $note ) { |
||
120 | |||
121 | } |
||
122 | |||
123 | new GravityView_Entry_Notes; |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.