@@ -43,7 +43,7 @@ |
||
43 | 43 | // load all the privacy policy stuff |
44 | 44 | // add post policy text |
45 | 45 | foreach ($this->loadPrivateDataExporterCollection() as $exporter) { |
46 | - $exporters[ get_class($exporter) ] = array( |
|
46 | + $exporters[get_class($exporter)] = array( |
|
47 | 47 | 'exporter_friendly_name' => $exporter->name(), |
48 | 48 | 'callback' => array($exporter, 'export'), |
49 | 49 | ); |
@@ -22,68 +22,68 @@ |
||
22 | 22 | */ |
23 | 23 | class PersonalDataExporterManager |
24 | 24 | { |
25 | - public function __construct() |
|
26 | - { |
|
27 | - add_filter( |
|
28 | - 'wp_privacy_personal_data_exporters', |
|
29 | - array($this, 'hookInExporters') |
|
30 | - ); |
|
31 | - } |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + add_filter( |
|
28 | + 'wp_privacy_personal_data_exporters', |
|
29 | + array($this, 'hookInExporters') |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Adds EE's exporters to the list of WP exporters |
|
36 | - * |
|
37 | - * @param array $exporters |
|
38 | - * @return array |
|
39 | - */ |
|
40 | - public function hookInExporters($exporters) |
|
41 | - { |
|
42 | - // load all the privacy policy stuff |
|
43 | - // add post policy text |
|
44 | - foreach ($this->loadPrivateDataExporterCollection() as $exporter) { |
|
45 | - $exporters[ get_class($exporter) ] = array( |
|
46 | - 'exporter_friendly_name' => $exporter->name(), |
|
47 | - 'callback' => array($exporter, 'export'), |
|
48 | - ); |
|
49 | - } |
|
50 | - return $exporters; |
|
51 | - } |
|
34 | + /** |
|
35 | + * Adds EE's exporters to the list of WP exporters |
|
36 | + * |
|
37 | + * @param array $exporters |
|
38 | + * @return array |
|
39 | + */ |
|
40 | + public function hookInExporters($exporters) |
|
41 | + { |
|
42 | + // load all the privacy policy stuff |
|
43 | + // add post policy text |
|
44 | + foreach ($this->loadPrivateDataExporterCollection() as $exporter) { |
|
45 | + $exporters[ get_class($exporter) ] = array( |
|
46 | + 'exporter_friendly_name' => $exporter->name(), |
|
47 | + 'callback' => array($exporter, 'export'), |
|
48 | + ); |
|
49 | + } |
|
50 | + return $exporters; |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * @return CollectionInterface|PersonalDataExporterInterface[] |
|
56 | - * @throws InvalidIdentifierException |
|
57 | - * @throws InvalidInterfaceException |
|
58 | - * @throws InvalidFilePathException |
|
59 | - * @throws InvalidEntityException |
|
60 | - * @throws InvalidDataTypeException |
|
61 | - * @throws InvalidClassException |
|
62 | - */ |
|
63 | - protected function loadPrivateDataExporterCollection() |
|
64 | - { |
|
65 | - $loader = new CollectionLoader( |
|
66 | - new CollectionDetails( |
|
67 | - // collection name |
|
68 | - 'personal_data_exporters', |
|
69 | - // collection interface |
|
70 | - 'EventEspresso\core\services\privacy\export\PersonalDataExporterInterface', |
|
71 | - // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
72 | - apply_filters( |
|
73 | - 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
|
74 | - array('EventEspresso\core\domain\services\admin\privacy\export') |
|
75 | - ), |
|
76 | - // filepaths to classes to add |
|
77 | - array(), |
|
78 | - // file mask to use if parsing folder for files to add |
|
79 | - '', |
|
80 | - // what to use as identifier for collection entities |
|
81 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
82 | - CollectionDetails::ID_CLASS_NAME |
|
83 | - ) |
|
84 | - ); |
|
85 | - return $loader->getCollection(); |
|
86 | - } |
|
54 | + /** |
|
55 | + * @return CollectionInterface|PersonalDataExporterInterface[] |
|
56 | + * @throws InvalidIdentifierException |
|
57 | + * @throws InvalidInterfaceException |
|
58 | + * @throws InvalidFilePathException |
|
59 | + * @throws InvalidEntityException |
|
60 | + * @throws InvalidDataTypeException |
|
61 | + * @throws InvalidClassException |
|
62 | + */ |
|
63 | + protected function loadPrivateDataExporterCollection() |
|
64 | + { |
|
65 | + $loader = new CollectionLoader( |
|
66 | + new CollectionDetails( |
|
67 | + // collection name |
|
68 | + 'personal_data_exporters', |
|
69 | + // collection interface |
|
70 | + 'EventEspresso\core\services\privacy\export\PersonalDataExporterInterface', |
|
71 | + // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
72 | + apply_filters( |
|
73 | + 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
|
74 | + array('EventEspresso\core\domain\services\admin\privacy\export') |
|
75 | + ), |
|
76 | + // filepaths to classes to add |
|
77 | + array(), |
|
78 | + // file mask to use if parsing folder for files to add |
|
79 | + '', |
|
80 | + // what to use as identifier for collection entities |
|
81 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
82 | + CollectionDetails::ID_CLASS_NAME |
|
83 | + ) |
|
84 | + ); |
|
85 | + return $loader->getCollection(); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // End of file PersonalDataExporterManager.php |
@@ -40,7 +40,7 @@ |
||
40 | 40 | // load all the privacy policy stuff |
41 | 41 | // add post policy text |
42 | 42 | foreach ($this->loadPrivateDataEraserCollection() as $eraser) { |
43 | - $erasers[ get_class($eraser) ] = array( |
|
43 | + $erasers[get_class($eraser)] = array( |
|
44 | 44 | 'eraser_friendly_name' => $eraser->name(), |
45 | 45 | 'callback' => array($eraser, 'erase'), |
46 | 46 | ); |
@@ -22,65 +22,65 @@ |
||
22 | 22 | */ |
23 | 23 | class PersonalDataEraserManager |
24 | 24 | { |
25 | - public function __construct() |
|
26 | - { |
|
27 | - add_filter( |
|
28 | - 'wp_privacy_personal_data_erasers', |
|
29 | - array($this, 'hookInErasers') |
|
30 | - ); |
|
31 | - } |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + add_filter( |
|
28 | + 'wp_privacy_personal_data_erasers', |
|
29 | + array($this, 'hookInErasers') |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * For all the registered `PrivateDataEraserInterface`s, add them as erasers |
|
36 | - */ |
|
37 | - public function hookInErasers($erasers) |
|
38 | - { |
|
39 | - // load all the privacy policy stuff |
|
40 | - // add post policy text |
|
41 | - foreach ($this->loadPrivateDataEraserCollection() as $eraser) { |
|
42 | - $erasers[ get_class($eraser) ] = array( |
|
43 | - 'eraser_friendly_name' => $eraser->name(), |
|
44 | - 'callback' => array($eraser, 'erase'), |
|
45 | - ); |
|
46 | - } |
|
47 | - return $erasers; |
|
48 | - } |
|
34 | + /** |
|
35 | + * For all the registered `PrivateDataEraserInterface`s, add them as erasers |
|
36 | + */ |
|
37 | + public function hookInErasers($erasers) |
|
38 | + { |
|
39 | + // load all the privacy policy stuff |
|
40 | + // add post policy text |
|
41 | + foreach ($this->loadPrivateDataEraserCollection() as $eraser) { |
|
42 | + $erasers[ get_class($eraser) ] = array( |
|
43 | + 'eraser_friendly_name' => $eraser->name(), |
|
44 | + 'callback' => array($eraser, 'erase'), |
|
45 | + ); |
|
46 | + } |
|
47 | + return $erasers; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @return CollectionInterface|PersonalDataEraserInterface[] |
|
53 | - * @throws InvalidIdentifierException |
|
54 | - * @throws InvalidInterfaceException |
|
55 | - * @throws InvalidFilePathException |
|
56 | - * @throws InvalidEntityException |
|
57 | - * @throws InvalidDataTypeException |
|
58 | - * @throws InvalidClassException |
|
59 | - */ |
|
60 | - protected function loadPrivateDataEraserCollection() |
|
61 | - { |
|
62 | - $loader = new CollectionLoader( |
|
63 | - new CollectionDetails( |
|
64 | - // collection name |
|
65 | - 'privacy_erasers', |
|
66 | - // collection interface |
|
67 | - 'EventEspresso\core\services\privacy\erasure\PersonalDataEraserInterface', |
|
68 | - // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
69 | - apply_filters( |
|
70 | - 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
|
71 | - array('EventEspresso\core\domain\services\admin\privacy\erasure') |
|
72 | - ), |
|
73 | - // filepaths to classes to add |
|
74 | - array(), |
|
75 | - // file mask to use if parsing folder for files to add |
|
76 | - '', |
|
77 | - // what to use as identifier for collection entities |
|
78 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
79 | - CollectionDetails::ID_CLASS_NAME |
|
80 | - ) |
|
81 | - ); |
|
82 | - return $loader->getCollection(); |
|
83 | - } |
|
51 | + /** |
|
52 | + * @return CollectionInterface|PersonalDataEraserInterface[] |
|
53 | + * @throws InvalidIdentifierException |
|
54 | + * @throws InvalidInterfaceException |
|
55 | + * @throws InvalidFilePathException |
|
56 | + * @throws InvalidEntityException |
|
57 | + * @throws InvalidDataTypeException |
|
58 | + * @throws InvalidClassException |
|
59 | + */ |
|
60 | + protected function loadPrivateDataEraserCollection() |
|
61 | + { |
|
62 | + $loader = new CollectionLoader( |
|
63 | + new CollectionDetails( |
|
64 | + // collection name |
|
65 | + 'privacy_erasers', |
|
66 | + // collection interface |
|
67 | + 'EventEspresso\core\services\privacy\erasure\PersonalDataEraserInterface', |
|
68 | + // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
69 | + apply_filters( |
|
70 | + 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
|
71 | + array('EventEspresso\core\domain\services\admin\privacy\erasure') |
|
72 | + ), |
|
73 | + // filepaths to classes to add |
|
74 | + array(), |
|
75 | + // file mask to use if parsing folder for files to add |
|
76 | + '', |
|
77 | + // what to use as identifier for collection entities |
|
78 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
79 | + CollectionDetails::ID_CLASS_NAME |
|
80 | + ) |
|
81 | + ); |
|
82 | + return $loader->getCollection(); |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | // End of file PersonalDataEraserManager.php |
86 | 86 | // Location: EventEspresso\core\domain\services\admin/PersonalDataEraserManager.php |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | $this->request = $request; |
33 | 33 | $this->response = $response; |
34 | 34 | // check required WP version |
35 | - if (! $this->minimumWordPressVersionRequired()) { |
|
35 | + if ( ! $this->minimumWordPressVersionRequired()) { |
|
36 | 36 | $this->request->unSetRequestParam('activate', true); |
37 | 37 | add_action('admin_notices', array($this, 'minimumWpVersionError'), 1); |
38 | 38 | $this->response->terminateRequest(); |
39 | 39 | $this->response->deactivatePlugin(); |
40 | 40 | } |
41 | 41 | // check recommended PHP version |
42 | - if (! $this->minimumPhpVersionRecommended()) { |
|
42 | + if ( ! $this->minimumPhpVersionRecommended()) { |
|
43 | 43 | $this->displayMinimumRecommendedPhpVersionNotice(); |
44 | 44 | } |
45 | 45 | // upcoming required version |
46 | - if (! $this->upcomingRequiredPhpVersion()) { |
|
46 | + if ( ! $this->upcomingRequiredPhpVersion()) { |
|
47 | 47 | $this->displayUpcomingRequiredVersion(); |
48 | 48 | } |
49 | 49 | $this->response = $this->processRequestStack($this->request, $this->response); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | if ($this->request->isAdmin()) { |
144 | 144 | new PersistentAdminNotice( |
145 | - 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
145 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
146 | 146 | sprintf( |
147 | 147 | esc_html__( |
148 | 148 | 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request) |
181 | 181 | && current_user_can('update_plugins') |
182 | 182 | ) { |
183 | - add_action('admin_notices', function () { |
|
183 | + add_action('admin_notices', function() { |
|
184 | 184 | echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
185 | 185 | . sprintf( |
186 | 186 | esc_html__( |
@@ -18,183 +18,183 @@ |
||
18 | 18 | */ |
19 | 19 | class RecommendedVersions extends Middleware |
20 | 20 | { |
21 | - /** |
|
22 | - * converts a Request to a Response |
|
23 | - * |
|
24 | - * @param RequestInterface $request |
|
25 | - * @param ResponseInterface $response |
|
26 | - * @return ResponseInterface |
|
27 | - * @throws InvalidDataTypeException |
|
28 | - */ |
|
29 | - public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
30 | - { |
|
31 | - $this->request = $request; |
|
32 | - $this->response = $response; |
|
33 | - // check required WP version |
|
34 | - if (! $this->minimumWordPressVersionRequired()) { |
|
35 | - $this->request->unSetRequestParam('activate', true); |
|
36 | - add_action('admin_notices', array($this, 'minimumWpVersionError'), 1); |
|
37 | - $this->response->terminateRequest(); |
|
38 | - $this->response->deactivatePlugin(); |
|
39 | - } |
|
40 | - // check recommended PHP version |
|
41 | - if (! $this->minimumPhpVersionRecommended()) { |
|
42 | - $this->displayMinimumRecommendedPhpVersionNotice(); |
|
43 | - } |
|
44 | - // upcoming required version |
|
45 | - if (! $this->upcomingRequiredPhpVersion()) { |
|
46 | - $this->displayUpcomingRequiredVersion(); |
|
47 | - } |
|
48 | - $this->response = $this->processRequestStack($this->request, $this->response); |
|
49 | - return $this->response; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * Helper method to assess installed wp version against given values. |
|
55 | - * By default this compares the required minimum version of WP for EE against the installed version of WP |
|
56 | - * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked |
|
57 | - * against) so consider that when sending in your values. |
|
58 | - * |
|
59 | - * @param string $version_to_check |
|
60 | - * @param string $operator |
|
61 | - * @return bool |
|
62 | - */ |
|
63 | - public static function compareWordPressVersion($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
64 | - { |
|
65 | - global $wp_version; |
|
66 | - return version_compare( |
|
67 | - // first account for wp_version being pre-release |
|
68 | - // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519 |
|
69 | - strpos($wp_version, '-') > 0 |
|
70 | - ? substr($wp_version, 0, strpos($wp_version, '-')) |
|
71 | - : $wp_version, |
|
72 | - $version_to_check, |
|
73 | - $operator |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @return boolean |
|
80 | - */ |
|
81 | - private function minimumWordPressVersionRequired() |
|
82 | - { |
|
83 | - return RecommendedVersions::compareWordPressVersion(); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @param string $min_version |
|
89 | - * @return boolean |
|
90 | - */ |
|
91 | - private function checkPhpVersion($min_version = EE_MIN_PHP_VER_RECOMMENDED) |
|
92 | - { |
|
93 | - return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @return boolean |
|
99 | - */ |
|
100 | - private function minimumPhpVersionRecommended() |
|
101 | - { |
|
102 | - return $this->checkPhpVersion(); |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public function minimumWpVersionError() |
|
110 | - { |
|
111 | - global $wp_version; |
|
112 | - ?> |
|
21 | + /** |
|
22 | + * converts a Request to a Response |
|
23 | + * |
|
24 | + * @param RequestInterface $request |
|
25 | + * @param ResponseInterface $response |
|
26 | + * @return ResponseInterface |
|
27 | + * @throws InvalidDataTypeException |
|
28 | + */ |
|
29 | + public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
30 | + { |
|
31 | + $this->request = $request; |
|
32 | + $this->response = $response; |
|
33 | + // check required WP version |
|
34 | + if (! $this->minimumWordPressVersionRequired()) { |
|
35 | + $this->request->unSetRequestParam('activate', true); |
|
36 | + add_action('admin_notices', array($this, 'minimumWpVersionError'), 1); |
|
37 | + $this->response->terminateRequest(); |
|
38 | + $this->response->deactivatePlugin(); |
|
39 | + } |
|
40 | + // check recommended PHP version |
|
41 | + if (! $this->minimumPhpVersionRecommended()) { |
|
42 | + $this->displayMinimumRecommendedPhpVersionNotice(); |
|
43 | + } |
|
44 | + // upcoming required version |
|
45 | + if (! $this->upcomingRequiredPhpVersion()) { |
|
46 | + $this->displayUpcomingRequiredVersion(); |
|
47 | + } |
|
48 | + $this->response = $this->processRequestStack($this->request, $this->response); |
|
49 | + return $this->response; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * Helper method to assess installed wp version against given values. |
|
55 | + * By default this compares the required minimum version of WP for EE against the installed version of WP |
|
56 | + * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked |
|
57 | + * against) so consider that when sending in your values. |
|
58 | + * |
|
59 | + * @param string $version_to_check |
|
60 | + * @param string $operator |
|
61 | + * @return bool |
|
62 | + */ |
|
63 | + public static function compareWordPressVersion($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
64 | + { |
|
65 | + global $wp_version; |
|
66 | + return version_compare( |
|
67 | + // first account for wp_version being pre-release |
|
68 | + // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519 |
|
69 | + strpos($wp_version, '-') > 0 |
|
70 | + ? substr($wp_version, 0, strpos($wp_version, '-')) |
|
71 | + : $wp_version, |
|
72 | + $version_to_check, |
|
73 | + $operator |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @return boolean |
|
80 | + */ |
|
81 | + private function minimumWordPressVersionRequired() |
|
82 | + { |
|
83 | + return RecommendedVersions::compareWordPressVersion(); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @param string $min_version |
|
89 | + * @return boolean |
|
90 | + */ |
|
91 | + private function checkPhpVersion($min_version = EE_MIN_PHP_VER_RECOMMENDED) |
|
92 | + { |
|
93 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @return boolean |
|
99 | + */ |
|
100 | + private function minimumPhpVersionRecommended() |
|
101 | + { |
|
102 | + return $this->checkPhpVersion(); |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public function minimumWpVersionError() |
|
110 | + { |
|
111 | + global $wp_version; |
|
112 | + ?> |
|
113 | 113 | <div class="error"> |
114 | 114 | <p> |
115 | 115 | <?php |
116 | - printf( |
|
117 | - esc_html__( |
|
118 | - 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', |
|
119 | - 'event_espresso' |
|
120 | - ), |
|
121 | - EE_MIN_WP_VER_REQUIRED, |
|
122 | - $wp_version, |
|
123 | - '<br/>', |
|
124 | - '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>' |
|
125 | - ); |
|
126 | - ?> |
|
116 | + printf( |
|
117 | + esc_html__( |
|
118 | + 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', |
|
119 | + 'event_espresso' |
|
120 | + ), |
|
121 | + EE_MIN_WP_VER_REQUIRED, |
|
122 | + $wp_version, |
|
123 | + '<br/>', |
|
124 | + '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>' |
|
125 | + ); |
|
126 | + ?> |
|
127 | 127 | </p> |
128 | 128 | </div> |
129 | 129 | <?php |
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * _display_minimum_recommended_php_version_notice |
|
135 | - * |
|
136 | - * @access private |
|
137 | - * @return void |
|
138 | - * @throws InvalidDataTypeException |
|
139 | - */ |
|
140 | - private function displayMinimumRecommendedPhpVersionNotice() |
|
141 | - { |
|
142 | - if ($this->request->isAdmin()) { |
|
143 | - new PersistentAdminNotice( |
|
144 | - 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
145 | - sprintf( |
|
146 | - esc_html__( |
|
147 | - 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
148 | - 'event_espresso' |
|
149 | - ), |
|
150 | - EE_MIN_PHP_VER_RECOMMENDED, |
|
151 | - PHP_VERSION, |
|
152 | - '<br/>', |
|
153 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
154 | - ) |
|
155 | - ); |
|
156 | - } |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * Returns whether the provided php version number is less than the current version of php installed on the server. |
|
162 | - * |
|
163 | - * @param string $version_required |
|
164 | - * @return bool |
|
165 | - */ |
|
166 | - private function upcomingRequiredPhpVersion($version_required = '5.5') |
|
167 | - { |
|
168 | - return true; |
|
169 | - // return $this->checkPhpVersion($version_required); |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * Sets a notice for an upcoming required version of PHP in the next update of EE core. |
|
175 | - */ |
|
176 | - private function displayUpcomingRequiredVersion() |
|
177 | - { |
|
178 | - if ( |
|
179 | - $this->request->isAdmin() |
|
180 | - && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request) |
|
181 | - && current_user_can('update_plugins') |
|
182 | - ) { |
|
183 | - add_action('admin_notices', function () { |
|
184 | - echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
|
185 | - . sprintf( |
|
186 | - esc_html__( |
|
187 | - 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater. Your web server\'s PHP version is %3$s. You can contact your host and ask them to update your PHP version to at least PHP 5.6. Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s', |
|
188 | - 'event_espresso' |
|
189 | - ), |
|
190 | - '<strong>', |
|
191 | - '</strong>', |
|
192 | - PHP_VERSION, |
|
193 | - '<a href="https://wordpress.org/support/upgrade-php/">', |
|
194 | - '</a>' |
|
195 | - ) |
|
196 | - . '</p></div>'; |
|
197 | - }); |
|
198 | - } |
|
199 | - } |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * _display_minimum_recommended_php_version_notice |
|
135 | + * |
|
136 | + * @access private |
|
137 | + * @return void |
|
138 | + * @throws InvalidDataTypeException |
|
139 | + */ |
|
140 | + private function displayMinimumRecommendedPhpVersionNotice() |
|
141 | + { |
|
142 | + if ($this->request->isAdmin()) { |
|
143 | + new PersistentAdminNotice( |
|
144 | + 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
145 | + sprintf( |
|
146 | + esc_html__( |
|
147 | + 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
148 | + 'event_espresso' |
|
149 | + ), |
|
150 | + EE_MIN_PHP_VER_RECOMMENDED, |
|
151 | + PHP_VERSION, |
|
152 | + '<br/>', |
|
153 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
154 | + ) |
|
155 | + ); |
|
156 | + } |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * Returns whether the provided php version number is less than the current version of php installed on the server. |
|
162 | + * |
|
163 | + * @param string $version_required |
|
164 | + * @return bool |
|
165 | + */ |
|
166 | + private function upcomingRequiredPhpVersion($version_required = '5.5') |
|
167 | + { |
|
168 | + return true; |
|
169 | + // return $this->checkPhpVersion($version_required); |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * Sets a notice for an upcoming required version of PHP in the next update of EE core. |
|
175 | + */ |
|
176 | + private function displayUpcomingRequiredVersion() |
|
177 | + { |
|
178 | + if ( |
|
179 | + $this->request->isAdmin() |
|
180 | + && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request) |
|
181 | + && current_user_can('update_plugins') |
|
182 | + ) { |
|
183 | + add_action('admin_notices', function () { |
|
184 | + echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
|
185 | + . sprintf( |
|
186 | + esc_html__( |
|
187 | + 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater. Your web server\'s PHP version is %3$s. You can contact your host and ask them to update your PHP version to at least PHP 5.6. Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s', |
|
188 | + 'event_espresso' |
|
189 | + ), |
|
190 | + '<strong>', |
|
191 | + '</strong>', |
|
192 | + PHP_VERSION, |
|
193 | + '<a href="https://wordpress.org/support/upgrade-php/">', |
|
194 | + '</a>' |
|
195 | + ) |
|
196 | + . '</p></div>'; |
|
197 | + }); |
|
198 | + } |
|
199 | + } |
|
200 | 200 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /** @var Asset $asset */ |
76 | 76 | $asset = $this->current(); |
77 | 77 | if ($asset->type() === $type) { |
78 | - $files[ $asset->handle() ] = $asset; |
|
78 | + $files[$asset->handle()] = $asset; |
|
79 | 79 | } |
80 | 80 | $this->next(); |
81 | 81 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /** @var JavascriptAsset $asset */ |
97 | 97 | $asset = $this->current(); |
98 | 98 | if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) { |
99 | - $files[ $asset->handle() ] = $asset; |
|
99 | + $files[$asset->handle()] = $asset; |
|
100 | 100 | } |
101 | 101 | $this->next(); |
102 | 102 | } |
@@ -23,193 +23,193 @@ |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * AssetCollection constructor |
|
28 | - * |
|
29 | - * @throws InvalidInterfaceException |
|
30 | - */ |
|
31 | - public function __construct() |
|
32 | - { |
|
33 | - parent::__construct('EventEspresso\core\domain\values\assets\Asset'); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @return StylesheetAsset[] |
|
39 | - * @since 4.9.62.p |
|
40 | - */ |
|
41 | - public function getStylesheetAssets(): array |
|
42 | - { |
|
43 | - return $this->getAssetsOfType(Asset::TYPE_CSS); |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @return JavascriptAsset[] |
|
49 | - * @since 4.9.62.p |
|
50 | - */ |
|
51 | - public function getJavascriptAssets(): array |
|
52 | - { |
|
53 | - return $this->getAssetsOfType(Asset::TYPE_JS); |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * @return ManifestFile[] |
|
59 | - * @since 4.9.62.p |
|
60 | - */ |
|
61 | - public function getManifestFiles(): array |
|
62 | - { |
|
63 | - return $this->getAssetsOfType(Asset::TYPE_MANIFEST); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @param string $type |
|
69 | - * @return JavascriptAsset[]|StylesheetAsset[]|ManifestFile[] |
|
70 | - * @since 4.9.62.p |
|
71 | - */ |
|
72 | - protected function getAssetsOfType(string $type): array |
|
73 | - { |
|
74 | - $files = []; |
|
75 | - $this->rewind(); |
|
76 | - while ($this->valid()) { |
|
77 | - /** @var Asset $asset */ |
|
78 | - $asset = $this->current(); |
|
79 | - if ($asset->type() === $type) { |
|
80 | - $files[ $asset->handle() ] = $asset; |
|
81 | - } |
|
82 | - $this->next(); |
|
83 | - } |
|
84 | - $this->rewind(); |
|
85 | - return $files; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @return JavascriptAsset[] |
|
91 | - * @since 4.9.62.p |
|
92 | - */ |
|
93 | - public function getJavascriptAssetsWithData(): array |
|
94 | - { |
|
95 | - $files = []; |
|
96 | - $this->rewind(); |
|
97 | - while ($this->valid()) { |
|
98 | - /** @var JavascriptAsset $asset */ |
|
99 | - $asset = $this->current(); |
|
100 | - if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) { |
|
101 | - $files[ $asset->handle() ] = $asset; |
|
102 | - } |
|
103 | - $this->next(); |
|
104 | - } |
|
105 | - $this->rewind(); |
|
106 | - return $files; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * returns TRUE or FALSE |
|
112 | - * depending on whether the object is within the Collection |
|
113 | - * based on the supplied $identifier and type |
|
114 | - * |
|
115 | - * @param string $identifier |
|
116 | - * @param string $type |
|
117 | - * @return bool |
|
118 | - * @since 4.9.63.p |
|
119 | - */ |
|
120 | - public function hasAssetOfType(string $identifier, string $type = Asset::TYPE_JS): bool |
|
121 | - { |
|
122 | - $this->rewind(); |
|
123 | - while ($this->valid()) { |
|
124 | - if ($this->getInfo() === $identifier && $this->current()->type() === $type) { |
|
125 | - $this->rewind(); |
|
126 | - return true; |
|
127 | - } |
|
128 | - $this->next(); |
|
129 | - } |
|
130 | - return false; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * returns TRUE or FALSE |
|
136 | - * depending on whether the Javascript Asset is within the Collection |
|
137 | - * based on the supplied $identifier |
|
138 | - * |
|
139 | - * @param string $identifier |
|
140 | - * @return bool |
|
141 | - * @since 4.9.63.p |
|
142 | - */ |
|
143 | - public function hasJavascriptAsset(string $identifier): bool |
|
144 | - { |
|
145 | - return $this->hasAssetOfType($identifier, Asset::TYPE_JS); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * returns TRUE or FALSE |
|
151 | - * depending on whether the Stylesheet Asset is within the Collection |
|
152 | - * based on the supplied $identifier |
|
153 | - * |
|
154 | - * @param string $identifier |
|
155 | - * @return bool |
|
156 | - * @since 4.9.63.p |
|
157 | - */ |
|
158 | - public function hasStylesheetAsset(string $identifier): bool |
|
159 | - { |
|
160 | - return $this->hasAssetOfType($identifier, Asset::TYPE_CSS); |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * returns the object from the Collection |
|
166 | - * based on the supplied $identifier and type |
|
167 | - * |
|
168 | - * @param string $identifier |
|
169 | - * @param string $type |
|
170 | - * @return JavascriptAsset|StylesheetAsset |
|
171 | - * @since 4.9.63.p |
|
172 | - */ |
|
173 | - public function getAssetOfType(string $identifier, string $type = Asset::TYPE_JS) |
|
174 | - { |
|
175 | - $this->rewind(); |
|
176 | - while ($this->valid()) { |
|
177 | - if ($this->getInfo() === $identifier && $this->current()->type() === $type) { |
|
178 | - /** @var JavascriptAsset|StylesheetAsset $object */ |
|
179 | - $object = $this->current(); |
|
180 | - $this->rewind(); |
|
181 | - return $object; |
|
182 | - } |
|
183 | - $this->next(); |
|
184 | - } |
|
185 | - return null; |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * returns the Stylesheet Asset from the Collection |
|
191 | - * based on the supplied $identifier |
|
192 | - * |
|
193 | - * @param string $identifier |
|
194 | - * @return StylesheetAsset |
|
195 | - * @since 4.9.63.p |
|
196 | - */ |
|
197 | - public function getStylesheetAsset(string $identifier) |
|
198 | - { |
|
199 | - return $this->getAssetOfType($identifier, Asset::TYPE_CSS); |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * returns the Javascript Asset from the Collection |
|
205 | - * based on the supplied $identifier |
|
206 | - * |
|
207 | - * @param string $identifier |
|
208 | - * @return JavascriptAsset |
|
209 | - * @since 4.9.63.p |
|
210 | - */ |
|
211 | - public function getJavascriptAsset(string $identifier) |
|
212 | - { |
|
213 | - return $this->getAssetOfType($identifier, Asset::TYPE_JS); |
|
214 | - } |
|
26 | + /** |
|
27 | + * AssetCollection constructor |
|
28 | + * |
|
29 | + * @throws InvalidInterfaceException |
|
30 | + */ |
|
31 | + public function __construct() |
|
32 | + { |
|
33 | + parent::__construct('EventEspresso\core\domain\values\assets\Asset'); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @return StylesheetAsset[] |
|
39 | + * @since 4.9.62.p |
|
40 | + */ |
|
41 | + public function getStylesheetAssets(): array |
|
42 | + { |
|
43 | + return $this->getAssetsOfType(Asset::TYPE_CSS); |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @return JavascriptAsset[] |
|
49 | + * @since 4.9.62.p |
|
50 | + */ |
|
51 | + public function getJavascriptAssets(): array |
|
52 | + { |
|
53 | + return $this->getAssetsOfType(Asset::TYPE_JS); |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * @return ManifestFile[] |
|
59 | + * @since 4.9.62.p |
|
60 | + */ |
|
61 | + public function getManifestFiles(): array |
|
62 | + { |
|
63 | + return $this->getAssetsOfType(Asset::TYPE_MANIFEST); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @param string $type |
|
69 | + * @return JavascriptAsset[]|StylesheetAsset[]|ManifestFile[] |
|
70 | + * @since 4.9.62.p |
|
71 | + */ |
|
72 | + protected function getAssetsOfType(string $type): array |
|
73 | + { |
|
74 | + $files = []; |
|
75 | + $this->rewind(); |
|
76 | + while ($this->valid()) { |
|
77 | + /** @var Asset $asset */ |
|
78 | + $asset = $this->current(); |
|
79 | + if ($asset->type() === $type) { |
|
80 | + $files[ $asset->handle() ] = $asset; |
|
81 | + } |
|
82 | + $this->next(); |
|
83 | + } |
|
84 | + $this->rewind(); |
|
85 | + return $files; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @return JavascriptAsset[] |
|
91 | + * @since 4.9.62.p |
|
92 | + */ |
|
93 | + public function getJavascriptAssetsWithData(): array |
|
94 | + { |
|
95 | + $files = []; |
|
96 | + $this->rewind(); |
|
97 | + while ($this->valid()) { |
|
98 | + /** @var JavascriptAsset $asset */ |
|
99 | + $asset = $this->current(); |
|
100 | + if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) { |
|
101 | + $files[ $asset->handle() ] = $asset; |
|
102 | + } |
|
103 | + $this->next(); |
|
104 | + } |
|
105 | + $this->rewind(); |
|
106 | + return $files; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * returns TRUE or FALSE |
|
112 | + * depending on whether the object is within the Collection |
|
113 | + * based on the supplied $identifier and type |
|
114 | + * |
|
115 | + * @param string $identifier |
|
116 | + * @param string $type |
|
117 | + * @return bool |
|
118 | + * @since 4.9.63.p |
|
119 | + */ |
|
120 | + public function hasAssetOfType(string $identifier, string $type = Asset::TYPE_JS): bool |
|
121 | + { |
|
122 | + $this->rewind(); |
|
123 | + while ($this->valid()) { |
|
124 | + if ($this->getInfo() === $identifier && $this->current()->type() === $type) { |
|
125 | + $this->rewind(); |
|
126 | + return true; |
|
127 | + } |
|
128 | + $this->next(); |
|
129 | + } |
|
130 | + return false; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * returns TRUE or FALSE |
|
136 | + * depending on whether the Javascript Asset is within the Collection |
|
137 | + * based on the supplied $identifier |
|
138 | + * |
|
139 | + * @param string $identifier |
|
140 | + * @return bool |
|
141 | + * @since 4.9.63.p |
|
142 | + */ |
|
143 | + public function hasJavascriptAsset(string $identifier): bool |
|
144 | + { |
|
145 | + return $this->hasAssetOfType($identifier, Asset::TYPE_JS); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * returns TRUE or FALSE |
|
151 | + * depending on whether the Stylesheet Asset is within the Collection |
|
152 | + * based on the supplied $identifier |
|
153 | + * |
|
154 | + * @param string $identifier |
|
155 | + * @return bool |
|
156 | + * @since 4.9.63.p |
|
157 | + */ |
|
158 | + public function hasStylesheetAsset(string $identifier): bool |
|
159 | + { |
|
160 | + return $this->hasAssetOfType($identifier, Asset::TYPE_CSS); |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * returns the object from the Collection |
|
166 | + * based on the supplied $identifier and type |
|
167 | + * |
|
168 | + * @param string $identifier |
|
169 | + * @param string $type |
|
170 | + * @return JavascriptAsset|StylesheetAsset |
|
171 | + * @since 4.9.63.p |
|
172 | + */ |
|
173 | + public function getAssetOfType(string $identifier, string $type = Asset::TYPE_JS) |
|
174 | + { |
|
175 | + $this->rewind(); |
|
176 | + while ($this->valid()) { |
|
177 | + if ($this->getInfo() === $identifier && $this->current()->type() === $type) { |
|
178 | + /** @var JavascriptAsset|StylesheetAsset $object */ |
|
179 | + $object = $this->current(); |
|
180 | + $this->rewind(); |
|
181 | + return $object; |
|
182 | + } |
|
183 | + $this->next(); |
|
184 | + } |
|
185 | + return null; |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * returns the Stylesheet Asset from the Collection |
|
191 | + * based on the supplied $identifier |
|
192 | + * |
|
193 | + * @param string $identifier |
|
194 | + * @return StylesheetAsset |
|
195 | + * @since 4.9.63.p |
|
196 | + */ |
|
197 | + public function getStylesheetAsset(string $identifier) |
|
198 | + { |
|
199 | + return $this->getAssetOfType($identifier, Asset::TYPE_CSS); |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * returns the Javascript Asset from the Collection |
|
205 | + * based on the supplied $identifier |
|
206 | + * |
|
207 | + * @param string $identifier |
|
208 | + * @return JavascriptAsset |
|
209 | + * @since 4.9.63.p |
|
210 | + */ |
|
211 | + public function getJavascriptAsset(string $identifier) |
|
212 | + { |
|
213 | + return $this->getAssetOfType($identifier, Asset::TYPE_JS); |
|
214 | + } |
|
215 | 215 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $html .= $this->_attributes_string( |
33 | 33 | array( |
34 | 34 | 'for' => $html_id, |
35 | - 'id' => $html_id . '-lbl', |
|
35 | + 'id' => $html_id.'-lbl', |
|
36 | 36 | 'class' => apply_filters( |
37 | 37 | 'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class', |
38 | - 'ee-radio-label-after' . $label_size_class, |
|
38 | + 'ee-radio-label-after'.$label_size_class, |
|
39 | 39 | $this, |
40 | 40 | $input, |
41 | 41 | $value |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $html .= '> '; |
64 | 64 | $html .= $display_text; |
65 | - $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; |
|
65 | + $html .= EEH_HTML::nl(-1, 'radio').'</label>'; |
|
66 | 66 | } |
67 | 67 | $html .= EEH_HTML::div('', '', 'clear-float'); |
68 | 68 | $html .= EEH_HTML::divx(); |
@@ -11,61 +11,61 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Radio_Button_Display_Strategy extends EE_Compound_Input_Display_Strategy |
13 | 13 | { |
14 | - /** |
|
15 | - * |
|
16 | - * @throws EE_Error |
|
17 | - * @return string of html to display the field |
|
18 | - */ |
|
19 | - public function display() |
|
20 | - { |
|
21 | - $input = $this->get_input(); |
|
22 | - $input->set_label_sizes(); |
|
23 | - $label_size_class = $input->get_label_size_class(); |
|
24 | - $html = ''; |
|
25 | - foreach ($input->options() as $value => $display_text) { |
|
26 | - $value = $input->get_normalization_strategy()->unnormalize($value); |
|
14 | + /** |
|
15 | + * |
|
16 | + * @throws EE_Error |
|
17 | + * @return string of html to display the field |
|
18 | + */ |
|
19 | + public function display() |
|
20 | + { |
|
21 | + $input = $this->get_input(); |
|
22 | + $input->set_label_sizes(); |
|
23 | + $label_size_class = $input->get_label_size_class(); |
|
24 | + $html = ''; |
|
25 | + foreach ($input->options() as $value => $display_text) { |
|
26 | + $value = $input->get_normalization_strategy()->unnormalize($value); |
|
27 | 27 | |
28 | - $html_id = $this->get_sub_input_id($value); |
|
29 | - $html .= EEH_HTML::nl(0, 'radio'); |
|
28 | + $html_id = $this->get_sub_input_id($value); |
|
29 | + $html .= EEH_HTML::nl(0, 'radio'); |
|
30 | 30 | |
31 | - $html .= $this->_opening_tag('label'); |
|
32 | - $html .= $this->_attributes_string( |
|
33 | - array( |
|
34 | - 'for' => $html_id, |
|
35 | - 'id' => $html_id . '-lbl', |
|
36 | - 'class' => apply_filters( |
|
37 | - 'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class', |
|
38 | - 'ee-radio-label-after' . $label_size_class, |
|
39 | - $this, |
|
40 | - $input, |
|
41 | - $value |
|
42 | - ) |
|
43 | - ) |
|
44 | - ); |
|
45 | - $html .= '>'; |
|
46 | - $html .= EEH_HTML::nl(1, 'radio'); |
|
47 | - $html .= $this->_opening_tag('input'); |
|
48 | - $attributes = array( |
|
49 | - 'id' => $html_id, |
|
50 | - 'name' => $input->html_name(), |
|
51 | - 'class' => $input->html_class(), |
|
52 | - 'style' => $input->html_style(), |
|
53 | - 'type' => 'radio', |
|
54 | - 'value' => $value, |
|
55 | - 0 => $input->other_html_attributes(), |
|
56 | - 'data-question_label' => $input->html_label_id() |
|
57 | - ); |
|
58 | - if ($input->raw_value() === $value) { |
|
59 | - $attributes['checked'] = 'checked'; |
|
60 | - } |
|
61 | - $html .= $this->_attributes_string($attributes); |
|
31 | + $html .= $this->_opening_tag('label'); |
|
32 | + $html .= $this->_attributes_string( |
|
33 | + array( |
|
34 | + 'for' => $html_id, |
|
35 | + 'id' => $html_id . '-lbl', |
|
36 | + 'class' => apply_filters( |
|
37 | + 'FHEE__EE_Radio_Button_Display_Strategy__display__option_label_class', |
|
38 | + 'ee-radio-label-after' . $label_size_class, |
|
39 | + $this, |
|
40 | + $input, |
|
41 | + $value |
|
42 | + ) |
|
43 | + ) |
|
44 | + ); |
|
45 | + $html .= '>'; |
|
46 | + $html .= EEH_HTML::nl(1, 'radio'); |
|
47 | + $html .= $this->_opening_tag('input'); |
|
48 | + $attributes = array( |
|
49 | + 'id' => $html_id, |
|
50 | + 'name' => $input->html_name(), |
|
51 | + 'class' => $input->html_class(), |
|
52 | + 'style' => $input->html_style(), |
|
53 | + 'type' => 'radio', |
|
54 | + 'value' => $value, |
|
55 | + 0 => $input->other_html_attributes(), |
|
56 | + 'data-question_label' => $input->html_label_id() |
|
57 | + ); |
|
58 | + if ($input->raw_value() === $value) { |
|
59 | + $attributes['checked'] = 'checked'; |
|
60 | + } |
|
61 | + $html .= $this->_attributes_string($attributes); |
|
62 | 62 | |
63 | - $html .= '> '; |
|
64 | - $html .= $display_text; |
|
65 | - $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; |
|
66 | - } |
|
67 | - $html .= EEH_HTML::div('', '', 'clear-float'); |
|
68 | - $html .= EEH_HTML::divx(); |
|
69 | - return apply_filters('FHEE__EE_Radio_Button_Display_Strategy__display', $html, $this, $this->_input); |
|
70 | - } |
|
63 | + $html .= '> '; |
|
64 | + $html .= $display_text; |
|
65 | + $html .= EEH_HTML::nl(-1, 'radio') . '</label>'; |
|
66 | + } |
|
67 | + $html .= EEH_HTML::div('', '', 'clear-float'); |
|
68 | + $html .= EEH_HTML::divx(); |
|
69 | + return apply_filters('FHEE__EE_Radio_Button_Display_Strategy__display', $html, $this, $this->_input); |
|
70 | + } |
|
71 | 71 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | // if there are no standard caps for this model, then for now all we know |
75 | 75 | // if they need the default cap to access this |
76 | - if (! $this->model()->cap_slug()) { |
|
76 | + if ( ! $this->model()->cap_slug()) { |
|
77 | 77 | return array( |
78 | 78 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
79 | 79 | ); |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | // if they don't have the basic event cap, they can't access ANY non-default items |
86 | 86 | EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
87 | 87 | // if they don't have the others event cap, they can't access others' non-default items |
88 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
89 | - array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
88 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_others') => new EE_Default_Where_Conditions( |
|
89 | + array($this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder) |
|
90 | 90 | ), |
91 | 91 | // if they have basic and others, but not private, they can't access others' private non-default items |
92 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => new EE_Default_Where_Conditions( |
|
93 | 93 | array( |
94 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
94 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => $this->addPublishedPostConditions( |
|
95 | 95 | array( |
96 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
97 | 97 | ), |
98 | 98 | false, |
99 | 99 | $this->_path_to_event_model |
@@ -16,89 +16,89 @@ |
||
16 | 16 | */ |
17 | 17 | class EE_Restriction_Generator_Event_Related_Protected extends EE_Restriction_Generator_Base |
18 | 18 | { |
19 | - /** |
|
20 | - * Path to the event model from the model this restriction generator will be applied to; |
|
21 | - * including the event model itself. Eg "Ticket.Datetime.Event" |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $_path_to_event_model = null; |
|
19 | + /** |
|
20 | + * Path to the event model from the model this restriction generator will be applied to; |
|
21 | + * including the event model itself. Eg "Ticket.Datetime.Event" |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $_path_to_event_model = null; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Capability context on event model when creating restrictions. |
|
28 | - * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
29 | - * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
30 | - * EDIT EVENTS in order to DELETE DATETIMES. |
|
31 | - * @var string one of EEM_Base::valid_cap_contexts() |
|
32 | - */ |
|
33 | - protected $_cap_context_on_event_model = null; |
|
34 | - /** |
|
35 | - * |
|
36 | - * @param string $path_to_event_model |
|
37 | - * @param string $cap_context_on_event_model capability context on event model when creating restrictions. |
|
38 | - * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
39 | - * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
40 | - * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same |
|
41 | - * as on the primary model. |
|
42 | - */ |
|
43 | - public function __construct($path_to_event_model, $cap_context_on_event_model = null) |
|
44 | - { |
|
45 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
46 | - $path_to_event_model .= '.'; |
|
47 | - } |
|
48 | - $this->_path_to_event_model = $path_to_event_model; |
|
49 | - $this->_cap_context_on_event_model = $cap_context_on_event_model; |
|
50 | - } |
|
26 | + /** |
|
27 | + * Capability context on event model when creating restrictions. |
|
28 | + * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
29 | + * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
30 | + * EDIT EVENTS in order to DELETE DATETIMES. |
|
31 | + * @var string one of EEM_Base::valid_cap_contexts() |
|
32 | + */ |
|
33 | + protected $_cap_context_on_event_model = null; |
|
34 | + /** |
|
35 | + * |
|
36 | + * @param string $path_to_event_model |
|
37 | + * @param string $cap_context_on_event_model capability context on event model when creating restrictions. |
|
38 | + * Eg, although we may want capability restrictions relating to deleting datetimes, |
|
39 | + * they don't need to be able to DELETE EVENTS, they just need to be able to |
|
40 | + * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same |
|
41 | + * as on the primary model. |
|
42 | + */ |
|
43 | + public function __construct($path_to_event_model, $cap_context_on_event_model = null) |
|
44 | + { |
|
45 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
46 | + $path_to_event_model .= '.'; |
|
47 | + } |
|
48 | + $this->_path_to_event_model = $path_to_event_model; |
|
49 | + $this->_cap_context_on_event_model = $cap_context_on_event_model; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Returns `$this->_cap_context_on_event_model`, the relevant action ("read", |
|
54 | - * "read_admin", "edit" or "delete") for the EVENT related to this model. |
|
55 | - * @see EE_Restriction_Generator_Event_Related_Protected::__construct() |
|
56 | - * @return string one of EEM_Base::valid_cap_contexts() |
|
57 | - */ |
|
58 | - protected function action_for_event() |
|
59 | - { |
|
60 | - if ($this->_cap_context_on_event_model) { |
|
61 | - return $this->_cap_context_on_event_model; |
|
62 | - } else { |
|
63 | - return $this->action(); |
|
64 | - } |
|
65 | - } |
|
52 | + /** |
|
53 | + * Returns `$this->_cap_context_on_event_model`, the relevant action ("read", |
|
54 | + * "read_admin", "edit" or "delete") for the EVENT related to this model. |
|
55 | + * @see EE_Restriction_Generator_Event_Related_Protected::__construct() |
|
56 | + * @return string one of EEM_Base::valid_cap_contexts() |
|
57 | + */ |
|
58 | + protected function action_for_event() |
|
59 | + { |
|
60 | + if ($this->_cap_context_on_event_model) { |
|
61 | + return $this->_cap_context_on_event_model; |
|
62 | + } else { |
|
63 | + return $this->action(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * |
|
69 | - * @return \EE_Default_Where_Conditions |
|
70 | - */ |
|
71 | - protected function _generate_restrictions() |
|
72 | - { |
|
73 | - // if there are no standard caps for this model, then for now all we know |
|
74 | - // if they need the default cap to access this |
|
75 | - if (! $this->model()->cap_slug()) { |
|
76 | - return array( |
|
77 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
78 | - ); |
|
79 | - } |
|
67 | + /** |
|
68 | + * |
|
69 | + * @return \EE_Default_Where_Conditions |
|
70 | + */ |
|
71 | + protected function _generate_restrictions() |
|
72 | + { |
|
73 | + // if there are no standard caps for this model, then for now all we know |
|
74 | + // if they need the default cap to access this |
|
75 | + if (! $this->model()->cap_slug()) { |
|
76 | + return array( |
|
77 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | - $event_model = EEM_Event::instance(); |
|
82 | - return array( |
|
83 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
84 | - // if they don't have the basic event cap, they can't access ANY non-default items |
|
85 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
|
86 | - // if they don't have the others event cap, they can't access others' non-default items |
|
87 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
88 | - array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
89 | - ), |
|
90 | - // if they have basic and others, but not private, they can't access others' private non-default items |
|
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
92 | - array( |
|
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
94 | - array( |
|
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | - ), |
|
97 | - false, |
|
98 | - $this->_path_to_event_model |
|
99 | - ) |
|
100 | - ) |
|
101 | - ), |
|
102 | - ); |
|
103 | - } |
|
81 | + $event_model = EEM_Event::instance(); |
|
82 | + return array( |
|
83 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
84 | + // if they don't have the basic event cap, they can't access ANY non-default items |
|
85 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event()) => new EE_Return_None_Where_Conditions(), |
|
86 | + // if they don't have the others event cap, they can't access others' non-default items |
|
87 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others') => new EE_Default_Where_Conditions( |
|
88 | + array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ) |
|
89 | + ), |
|
90 | + // if they have basic and others, but not private, they can't access others' private non-default items |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + array( |
|
93 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => $this->addPublishedPostConditions( |
|
94 | + array( |
|
95 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + ), |
|
97 | + false, |
|
98 | + $this->_path_to_event_model |
|
99 | + ) |
|
100 | + ) |
|
101 | + ), |
|
102 | + ); |
|
103 | + } |
|
104 | 104 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | // if there are no standard caps for this model, then for now all we know |
44 | 44 | // if they need the default cap to access this |
45 | - if (! $this->model()->cap_slug()) { |
|
45 | + if ( ! $this->model()->cap_slug()) { |
|
46 | 46 | return array( |
47 | 47 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
48 | 48 | ); |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ), |
62 | 62 | // if they don't have the others event cap, they can't access others' non-default items |
63 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
63 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions( |
|
64 | 64 | array( |
65 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
65 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => $this->addPublishedPostConditions( |
|
66 | 66 | array( |
67 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
67 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
68 | 68 | ), |
69 | 69 | true, |
70 | 70 | $this->_path_to_event_model |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | ) |
73 | 73 | ), |
74 | 74 | // if they have basic and others, but not private, they can't access others' private non-default items |
75 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
75 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions( |
|
76 | 76 | array( |
77 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
77 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => $this->addPublishedPostConditions( |
|
78 | 78 | array( |
79 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
79 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
80 | 80 | ), |
81 | 81 | false, |
82 | 82 | $this->_path_to_event_model |
@@ -16,72 +16,72 @@ |
||
16 | 16 | */ |
17 | 17 | class EE_Restriction_Generator_Event_Related_Public extends EE_Restriction_Generator_Base |
18 | 18 | { |
19 | - /** |
|
20 | - * Path to the event model from the model this restriction generator will be applied to; |
|
21 | - * including the event model itself. Eg "Ticket.Datetime.Event" |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $_path_to_event_model; |
|
25 | - /** |
|
26 | - * |
|
27 | - * @param string $path_to_event_model |
|
28 | - */ |
|
29 | - public function __construct($path_to_event_model) |
|
30 | - { |
|
31 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
32 | - $path_to_event_model .= '.'; |
|
33 | - } |
|
34 | - $this->_path_to_event_model = $path_to_event_model; |
|
35 | - } |
|
36 | - /** |
|
37 | - * |
|
38 | - * @return \EE_Default_Where_Conditions |
|
39 | - */ |
|
40 | - protected function _generate_restrictions() |
|
41 | - { |
|
42 | - // if there are no standard caps for this model, then for now all we know |
|
43 | - // if they need the default cap to access this |
|
44 | - if (! $this->model()->cap_slug()) { |
|
45 | - return array( |
|
46 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
47 | - ); |
|
48 | - } |
|
19 | + /** |
|
20 | + * Path to the event model from the model this restriction generator will be applied to; |
|
21 | + * including the event model itself. Eg "Ticket.Datetime.Event" |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $_path_to_event_model; |
|
25 | + /** |
|
26 | + * |
|
27 | + * @param string $path_to_event_model |
|
28 | + */ |
|
29 | + public function __construct($path_to_event_model) |
|
30 | + { |
|
31 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
32 | + $path_to_event_model .= '.'; |
|
33 | + } |
|
34 | + $this->_path_to_event_model = $path_to_event_model; |
|
35 | + } |
|
36 | + /** |
|
37 | + * |
|
38 | + * @return \EE_Default_Where_Conditions |
|
39 | + */ |
|
40 | + protected function _generate_restrictions() |
|
41 | + { |
|
42 | + // if there are no standard caps for this model, then for now all we know |
|
43 | + // if they need the default cap to access this |
|
44 | + if (! $this->model()->cap_slug()) { |
|
45 | + return array( |
|
46 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - $event_model = EEM_Event::instance(); |
|
51 | - return array( |
|
52 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
53 | - // if they don't have the basic event cap, they can only read things for published events |
|
54 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions( |
|
55 | - $this->addPublishedPostConditions( |
|
56 | - array(), |
|
57 | - true, |
|
58 | - $this->_path_to_event_model |
|
59 | - ) |
|
60 | - ), |
|
61 | - // if they don't have the others event cap, they can't access others' non-default items |
|
62 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
63 | - array( |
|
64 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
65 | - array( |
|
66 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
67 | - ), |
|
68 | - true, |
|
69 | - $this->_path_to_event_model |
|
70 | - ) |
|
71 | - ) |
|
72 | - ), |
|
73 | - // if they have basic and others, but not private, they can't access others' private non-default items |
|
74 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
75 | - array( |
|
76 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
77 | - array( |
|
78 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
79 | - ), |
|
80 | - false, |
|
81 | - $this->_path_to_event_model |
|
82 | - ) |
|
83 | - ) |
|
84 | - ), |
|
85 | - ); |
|
86 | - } |
|
50 | + $event_model = EEM_Event::instance(); |
|
51 | + return array( |
|
52 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
53 | + // if they don't have the basic event cap, they can only read things for published events |
|
54 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions( |
|
55 | + $this->addPublishedPostConditions( |
|
56 | + array(), |
|
57 | + true, |
|
58 | + $this->_path_to_event_model |
|
59 | + ) |
|
60 | + ), |
|
61 | + // if they don't have the others event cap, they can't access others' non-default items |
|
62 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
63 | + array( |
|
64 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
65 | + array( |
|
66 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
67 | + ), |
|
68 | + true, |
|
69 | + $this->_path_to_event_model |
|
70 | + ) |
|
71 | + ) |
|
72 | + ), |
|
73 | + // if they have basic and others, but not private, they can't access others' private non-default items |
|
74 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
75 | + array( |
|
76 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
77 | + array( |
|
78 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
79 | + ), |
|
80 | + false, |
|
81 | + $this->_path_to_event_model |
|
82 | + ) |
|
83 | + ) |
|
84 | + ), |
|
85 | + ); |
|
86 | + } |
|
87 | 87 | } |
@@ -12,74 +12,74 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Restriction_Generator_Public extends EE_Restriction_Generator_Base |
14 | 14 | { |
15 | - protected function _generate_restrictions() |
|
16 | - { |
|
17 | - // if there are no standard caps for this model, then for allow full access |
|
18 | - if (! $this->model()->cap_slug()) { |
|
19 | - return array( |
|
20 | - ); |
|
21 | - } |
|
15 | + protected function _generate_restrictions() |
|
16 | + { |
|
17 | + // if there are no standard caps for this model, then for allow full access |
|
18 | + if (! $this->model()->cap_slug()) { |
|
19 | + return array( |
|
20 | + ); |
|
21 | + } |
|
22 | 22 | |
23 | - $restrictions = array(); |
|
24 | - // does the basic cap exist? (eg 'ee_read_registrations') |
|
25 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
|
26 | - if ($this->model() instanceof EEM_CPT_Base) { |
|
27 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
28 | - $this->addPublishedPostConditions() |
|
29 | - ); |
|
30 | - } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
31 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | - array( $this->model()->deleted_field_name() => false ) |
|
33 | - ); |
|
34 | - } else { |
|
35 | - // don't impose any restrictions if they don't have the basic reading cap |
|
36 | - } |
|
37 | - // does the others cap exist? (eg 'ee_read_others_registrations') |
|
38 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
39 | - if ($this->model() instanceof EEM_CPT_Base) { |
|
40 | - // then if they don't have the others cap, AT MOST show them their own and other published ones |
|
41 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
42 | - array( |
|
43 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
44 | - array( |
|
45 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
46 | - ) |
|
47 | - ) |
|
48 | - ) |
|
49 | - ); |
|
50 | - } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
51 | - // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
|
52 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
53 | - array( |
|
54 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
55 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
56 | - $this->model()->deleted_field_name() => false |
|
57 | - ) |
|
58 | - ) |
|
59 | - ); |
|
60 | - } else { |
|
61 | - // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
|
62 | - } |
|
63 | - // does the private cap exist (eg 'ee_read_others_private_events') |
|
64 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | - // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
|
66 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
67 | - array( |
|
68 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
69 | - array( |
|
70 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
71 | - ), |
|
72 | - false, |
|
73 | - '' |
|
74 | - ) |
|
75 | - ) |
|
76 | - ); |
|
77 | - } |
|
78 | - } |
|
79 | - } else { |
|
80 | - // there is no basic cap. So allow full access |
|
81 | - $restrictions = array(); |
|
82 | - } |
|
83 | - return $restrictions; |
|
84 | - } |
|
23 | + $restrictions = array(); |
|
24 | + // does the basic cap exist? (eg 'ee_read_registrations') |
|
25 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
|
26 | + if ($this->model() instanceof EEM_CPT_Base) { |
|
27 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
28 | + $this->addPublishedPostConditions() |
|
29 | + ); |
|
30 | + } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
31 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | + array( $this->model()->deleted_field_name() => false ) |
|
33 | + ); |
|
34 | + } else { |
|
35 | + // don't impose any restrictions if they don't have the basic reading cap |
|
36 | + } |
|
37 | + // does the others cap exist? (eg 'ee_read_others_registrations') |
|
38 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
39 | + if ($this->model() instanceof EEM_CPT_Base) { |
|
40 | + // then if they don't have the others cap, AT MOST show them their own and other published ones |
|
41 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
42 | + array( |
|
43 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
44 | + array( |
|
45 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
46 | + ) |
|
47 | + ) |
|
48 | + ) |
|
49 | + ); |
|
50 | + } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
|
51 | + // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
|
52 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
53 | + array( |
|
54 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
55 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
56 | + $this->model()->deleted_field_name() => false |
|
57 | + ) |
|
58 | + ) |
|
59 | + ); |
|
60 | + } else { |
|
61 | + // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
|
62 | + } |
|
63 | + // does the private cap exist (eg 'ee_read_others_private_events') |
|
64 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | + // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
|
66 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
67 | + array( |
|
68 | + 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
69 | + array( |
|
70 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
71 | + ), |
|
72 | + false, |
|
73 | + '' |
|
74 | + ) |
|
75 | + ) |
|
76 | + ); |
|
77 | + } |
|
78 | + } |
|
79 | + } else { |
|
80 | + // there is no basic cap. So allow full access |
|
81 | + $restrictions = array(); |
|
82 | + } |
|
83 | + return $restrictions; |
|
84 | + } |
|
85 | 85 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | protected function _generate_restrictions() |
16 | 16 | { |
17 | 17 | // if there are no standard caps for this model, then for allow full access |
18 | - if (! $this->model()->cap_slug()) { |
|
18 | + if ( ! $this->model()->cap_slug()) { |
|
19 | 19 | return array( |
20 | 20 | ); |
21 | 21 | } |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | // does the basic cap exist? (eg 'ee_read_registrations') |
25 | 25 | if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) { |
26 | 26 | if ($this->model() instanceof EEM_CPT_Base) { |
27 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
27 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions( |
|
28 | 28 | $this->addPublishedPostConditions() |
29 | 29 | ); |
30 | 30 | } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
31 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions( |
|
32 | - array( $this->model()->deleted_field_name() => false ) |
|
31 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions( |
|
32 | + array($this->model()->deleted_field_name() => false) |
|
33 | 33 | ); |
34 | 34 | } else { |
35 | 35 | // don't impose any restrictions if they don't have the basic reading cap |
36 | 36 | } |
37 | 37 | // does the others cap exist? (eg 'ee_read_others_registrations') |
38 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist |
|
38 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others')) {// both caps exist |
|
39 | 39 | if ($this->model() instanceof EEM_CPT_Base) { |
40 | 40 | // then if they don't have the others cap, AT MOST show them their own and other published ones |
41 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
41 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions( |
|
42 | 42 | array( |
43 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => $this->addPublishedPostConditions( |
|
43 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => $this->addPublishedPostConditions( |
|
44 | 44 | array( |
45 | 45 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
46 | 46 | ) |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } elseif ($this->model() instanceof EEM_Soft_Delete_Base) { |
51 | 51 | // then if they don't have the other cap, AT MOST show them their own or non deleted ones |
52 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions( |
|
52 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions( |
|
53 | 53 | array( |
54 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array( |
|
54 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => array( |
|
55 | 55 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
56 | 56 | $this->model()->deleted_field_name() => false |
57 | 57 | ) |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones |
62 | 62 | } |
63 | 63 | // does the private cap exist (eg 'ee_read_others_private_events') |
64 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) { |
|
64 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_private') && $this->model() instanceof EEM_CPT_Base) { |
|
65 | 65 | // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private |
66 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions( |
|
66 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private')] = new EE_Default_Where_Conditions( |
|
67 | 67 | array( |
68 | - 'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => $this->addPublishedPostConditions( |
|
68 | + 'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private') => $this->addPublishedPostConditions( |
|
69 | 69 | array( |
70 | 70 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
71 | 71 | ), |
@@ -18,110 +18,110 @@ |
||
18 | 18 | class EE_Restriction_Generator_Default_Public extends EE_Restriction_Generator_Base |
19 | 19 | { |
20 | 20 | /** |
21 | - * Name of the field on this model (or a related model, including the model chain to it) |
|
22 | - * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $_default_field_name; |
|
21 | + * Name of the field on this model (or a related model, including the model chain to it) |
|
22 | + * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $_default_field_name; |
|
26 | 26 | |
27 | - /** |
|
28 | - * The model chain to follow to get to the event model, including the event model itself. |
|
29 | - * Eg 'Ticket.Datetime.Event' |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - protected $_path_to_event_model; |
|
33 | - /** |
|
34 | - * |
|
35 | - * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it) |
|
36 | - * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
37 | - * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself. |
|
38 | - * Eg 'Ticket.Datetime.Event' |
|
39 | - */ |
|
40 | - public function __construct($default_field_name, $path_to_event_model) |
|
41 | - { |
|
42 | - $this->_default_field_name = $default_field_name; |
|
43 | - if (substr($path_to_event_model, -1, 1) != '.') { |
|
44 | - $path_to_event_model .= '.'; |
|
45 | - } |
|
46 | - $this->_path_to_event_model = $path_to_event_model; |
|
47 | - } |
|
27 | + /** |
|
28 | + * The model chain to follow to get to the event model, including the event model itself. |
|
29 | + * Eg 'Ticket.Datetime.Event' |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + protected $_path_to_event_model; |
|
33 | + /** |
|
34 | + * |
|
35 | + * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it) |
|
36 | + * that is a boolean indicating whether or not a model object is considered "Default" or not |
|
37 | + * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself. |
|
38 | + * Eg 'Ticket.Datetime.Event' |
|
39 | + */ |
|
40 | + public function __construct($default_field_name, $path_to_event_model) |
|
41 | + { |
|
42 | + $this->_default_field_name = $default_field_name; |
|
43 | + if (substr($path_to_event_model, -1, 1) != '.') { |
|
44 | + $path_to_event_model .= '.'; |
|
45 | + } |
|
46 | + $this->_path_to_event_model = $path_to_event_model; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return EE_Default_Where_Conditions |
|
51 | - * @throws EE_Error |
|
52 | - */ |
|
53 | - protected function _generate_restrictions() |
|
54 | - { |
|
55 | - // if there are no standard caps for this model, then for now all we know |
|
56 | - // if they need the default cap to access this |
|
57 | - if (!$this->model()->cap_slug()) { |
|
58 | - return array( |
|
59 | - self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
60 | - ); |
|
61 | - } |
|
49 | + /** |
|
50 | + * @return EE_Default_Where_Conditions |
|
51 | + * @throws EE_Error |
|
52 | + */ |
|
53 | + protected function _generate_restrictions() |
|
54 | + { |
|
55 | + // if there are no standard caps for this model, then for now all we know |
|
56 | + // if they need the default cap to access this |
|
57 | + if (!$this->model()->cap_slug()) { |
|
58 | + return array( |
|
59 | + self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - $event_model = EEM_Event::instance(); |
|
63 | + $event_model = EEM_Event::instance(); |
|
64 | 64 | |
65 | - $restrictions = array( |
|
66 | - // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
67 | - // if they don't have the basic event cap, they can't access ANY non-default items |
|
68 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
|
69 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | - array( |
|
71 | - $this->_default_field_name => true, |
|
72 | - ), |
|
73 | - true, |
|
74 | - $this->_path_to_event_model |
|
75 | - ) |
|
76 | - )), |
|
77 | - // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
|
78 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
79 | - array( |
|
80 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
81 | - array( |
|
82 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | - $this->_default_field_name => true, |
|
84 | - ), |
|
85 | - true, |
|
86 | - $this->_path_to_event_model |
|
87 | - ) |
|
88 | - ) |
|
89 | - ), |
|
90 | - // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
|
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
92 | - array( |
|
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
94 | - array( |
|
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | - $this->_default_field_name => true |
|
97 | - ), |
|
98 | - false, |
|
99 | - $this->_path_to_event_model |
|
100 | - ) |
|
101 | - ) |
|
102 | - ), |
|
103 | - // second: access to defaults is controlled by the default capabilities |
|
104 | - // if they don't have the basic default capability, restrict access to only non-default items |
|
105 | - EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | - array( $this->_default_field_name => false ) |
|
107 | - ), |
|
108 | - ); |
|
109 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
110 | - // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
|
111 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
112 | - array( |
|
113 | - // if they don't have the others default cap, they can't access others default items (but they can access |
|
114 | - // their own default items, and non-default items) |
|
115 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
116 | - 'AND' => array( |
|
117 | - EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
118 | - $this->_default_field_name => true |
|
119 | - ), |
|
120 | - $this->_default_field_name => false |
|
121 | - ) |
|
122 | - ) |
|
123 | - ); |
|
124 | - } |
|
125 | - return $restrictions; |
|
126 | - } |
|
65 | + $restrictions = array( |
|
66 | + // first: basically access to non-defaults is essentially controlled by which events are accessible |
|
67 | + // if they don't have the basic event cap, they can't access ANY non-default items |
|
68 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
|
69 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | + array( |
|
71 | + $this->_default_field_name => true, |
|
72 | + ), |
|
73 | + true, |
|
74 | + $this->_path_to_event_model |
|
75 | + ) |
|
76 | + )), |
|
77 | + // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
|
78 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
79 | + array( |
|
80 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
81 | + array( |
|
82 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | + $this->_default_field_name => true, |
|
84 | + ), |
|
85 | + true, |
|
86 | + $this->_path_to_event_model |
|
87 | + ) |
|
88 | + ) |
|
89 | + ), |
|
90 | + // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
92 | + array( |
|
93 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
94 | + array( |
|
95 | + $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | + $this->_default_field_name => true |
|
97 | + ), |
|
98 | + false, |
|
99 | + $this->_path_to_event_model |
|
100 | + ) |
|
101 | + ) |
|
102 | + ), |
|
103 | + // second: access to defaults is controlled by the default capabilities |
|
104 | + // if they don't have the basic default capability, restrict access to only non-default items |
|
105 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | + array( $this->_default_field_name => false ) |
|
107 | + ), |
|
108 | + ); |
|
109 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
110 | + // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
|
111 | + $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
112 | + array( |
|
113 | + // if they don't have the others default cap, they can't access others default items (but they can access |
|
114 | + // their own default items, and non-default items) |
|
115 | + 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
116 | + 'AND' => array( |
|
117 | + EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
|
118 | + $this->_default_field_name => true |
|
119 | + ), |
|
120 | + $this->_default_field_name => false |
|
121 | + ) |
|
122 | + ) |
|
123 | + ); |
|
124 | + } |
|
125 | + return $restrictions; |
|
126 | + } |
|
127 | 127 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | // if there are no standard caps for this model, then for now all we know |
56 | 56 | // if they need the default cap to access this |
57 | - if (!$this->model()->cap_slug()) { |
|
57 | + if ( ! $this->model()->cap_slug()) { |
|
58 | 58 | return array( |
59 | 59 | self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions() |
60 | 60 | ); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // first: basically access to non-defaults is essentially controlled by which events are accessible |
67 | 67 | // if they don't have the basic event cap, they can't access ANY non-default items |
68 | 68 | EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( |
69 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
69 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => $this->addPublishedPostConditions( |
|
70 | 70 | array( |
71 | 71 | $this->_default_field_name => true, |
72 | 72 | ), |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | ) |
76 | 76 | )), |
77 | 77 | // if they don't have the others event cap, they can only access their own, others' that are for published events, or defaults |
78 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions( |
|
78 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions( |
|
79 | 79 | array( |
80 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => $this->addPublishedPostConditions( |
|
80 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => $this->addPublishedPostConditions( |
|
81 | 81 | array( |
82 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
82 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
83 | 83 | $this->_default_field_name => true, |
84 | 84 | ), |
85 | 85 | true, |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | // if they have basic and others, but not private, they can access default, their own, and others' that aren't private |
91 | - EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions( |
|
91 | + EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions( |
|
92 | 92 | array( |
93 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => $this->addPublishedPostConditions( |
|
93 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => $this->addPublishedPostConditions( |
|
94 | 94 | array( |
95 | - $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
95 | + $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder, |
|
96 | 96 | $this->_default_field_name => true |
97 | 97 | ), |
98 | 98 | false, |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | ), |
103 | 103 | // second: access to defaults is controlled by the default capabilities |
104 | 104 | // if they don't have the basic default capability, restrict access to only non-default items |
105 | - EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions( |
|
106 | - array( $this->_default_field_name => false ) |
|
105 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_default') => new EE_Default_Where_Conditions( |
|
106 | + array($this->_default_field_name => false) |
|
107 | 107 | ), |
108 | 108 | ); |
109 | - if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) { |
|
109 | + if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others_default')) { |
|
110 | 110 | // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones |
111 | - $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions( |
|
111 | + $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default')] = new EE_Default_Where_Conditions( |
|
112 | 112 | array( |
113 | 113 | // if they don't have the others default cap, they can't access others default items (but they can access |
114 | 114 | // their own default items, and non-default items) |
115 | - 'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array( |
|
115 | + 'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default') => array( |
|
116 | 116 | 'AND' => array( |
117 | 117 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder, |
118 | 118 | $this->_default_field_name => true |