PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.13.1
GiveWP – Donation Plugin and Fundraising Platform v2.13.1
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / TestData / Factories / PageFactory.php
PageFactory.php
68 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\TestData\Factories;
4
5 use Give\TestData\Framework\Factory;
6
7 /**
8 * Class PageFactory
9 * @package Give\TestData\Factories
10 */
11 class PageFactory extends Factory {
12
13 /**
14 * Donor definition
15 *
16 * @return array
17 * @since 1.0.0
18 */
19 public function definition() {
20 return [
21 'post_title' => 'GiveWP Demonstration page',
22 'post_content' => $this->getContent(),
23 'post_status' => 'publish',
24 'post_author' => $this->randomAuthor(),
25 'post_type' => 'page',
26 ];
27 }
28
29 /**
30 * Page content
31 *
32 * @return string
33 * @since 1.0.0
34 */
35 public function getContent() {
36
37 $giveShortcodes = $this->getGiveShortcodes();
38
39 $content = '';
40
41 foreach ( $giveShortcodes as $shortcode ) {
42 $content .= "<h3>[{$shortcode}]</h3>";
43 $content .= "[{$shortcode}]";
44 }
45
46 return $content;
47
48 }
49
50 /**
51 * Get GiveWP shortcodes
52 *
53 * @return array
54 */
55 private function getGiveShortcodes() {
56
57 $shortcodes = [];
58
59 foreach ( $GLOBALS['shortcode_tags'] as $shortcode => $action ) {
60 if ( false !== strpos( $shortcode, 'give_' ) ) {
61 $shortcodes[] = $shortcode;
62 }
63 }
64
65 return $shortcodes;
66 }
67 }
68