Completed
Push — master ( 707409...ea219b )
by Stephanie
10:05
created

FrmTipsHelper::get_styling_tip()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %
Metric Value
dl 10
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
class FrmTipsHelper {
4
5
	public static function pro_tip( $callback ) {
6
		if ( FrmAppHelper::pro_is_installed() ) {
7
			return;
8
		}
9
10
		$tip = self::$callback();
11
		?>
12
		<a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( $tip['link'] ) ) ?>" target="_blank" class="frm_pro_tip">
13
			<span><i class="frm_icon_font frm_check1_icon"></i>  Pro Tip:</span>
14
			<?php echo $tip['tip'] ?>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$tip'
Loading history...
15
			<?php if ( isset( $tip['call'] ) ) { ?>
16
				<span><?php echo $tip['call'] ?></span>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$tip'
Loading history...
17
			<?php } ?>
18
		</a>
19
		<?php
20
	}
21
22
	public static function get_builder_tip() {
23
		$tips = array(
24
			array(
25
				'link' => 'https://formidablepro.com/section-tip',
26
				'tip'  => __( 'Long forms can still be beautiful and manageable with sections.', 'formidable' ),
27
				'call' => __( 'Upgrade to Pro.', 'formidable' ),
28
			),
29
			array(
30
				'link' => 'https://formidablepro.com/conditional-logic-tip',
31
				'tip'  => __( 'Use conditional logic to shorten your forms and increase conversions.', 'formidable' ),
32
				'call' => __( 'Upgrade to Pro.', 'formidable' ),
33
			),
34
			array(
35
				'link' => 'https://formidablepro.com/page-break-tip',
36
				'tip'  => __( 'Increase conversions by showing fewer fields at a time with page breaks.', 'formidable' ),
37
				'call' => __( 'Upgrade to Pro.', 'formidable' ),
38
			),
39
			array(
40
				'link' => 'https://formidablepro.com/file-upload-tip',
41
				'tip'  => __( 'Cut down on back-and-forth with clients.', 'formidable' ),
42
				'call' => __( 'Allow file uploads in your form.', 'formidable' ),
43
			),
44
		);
45
46
		return self::get_random_tip( $tips );
47
	}
48
49
	public static function get_form_settings_tip() {
50
		$tips = array(
51
			array(
52
				'link' => 'https://formidablepro.com/front-end-editing-tip',
53
				'tip'  => __( 'A site with dynamic, maintainable, user-generated content is within reach.', 'formidable' ),
54
				'call' => __( 'Add front-end editing.', 'formidable' ),
55
			),
56
			array(
57
				'link' => 'https://formidablepro.com/save-drafts-tip',
58
				'tip'  => __( 'Have a long form that takes time to complete?', 'formidable' ),
59
				'call' => __( 'Let logged-in users save a draft and return later.', 'formidable' ),
60
			),
61
		);
62
		return self::get_random_tip( $tips );
63
	}
64
65
	public static function get_form_action_tip() {
66
		$tips = array(
67
			array(
68
				'link' => 'https://formidablepro.com/email-routing-tip',
69
				'tip'  => __( 'Save time by sending the email to the right person automatically.', 'formidable' ),
70
				'call' => __( 'Add email routing.', 'formidable' ),
71
			),
72
			array(
73
				'link' => 'https://formidablepro.com/create-posts-tip',
74
				'tip'  => __( 'Allow anyone to create a blog post right from your form.', 'formidable' ),
75
				'call' => __( 'Upgrade to Pro.', 'formidable' ),
76
			),
77
			array(
78
				'link' => 'https://formidablepro.com/downloads/mailchimp/',
79
				'tip'  => __( 'Grow your business with automated email follow-up.', 'formidable' ),
80
				'call' => __( 'Send leads straight to MailChimp.', 'formidable' ),
81
			),
82
			array(
83
				'link' => 'https://formidablepro.com/downloads/paypal-standard/',
84
				'tip'  => __( 'Save hours and increase revenue by collecting payments with every submission.', 'formidable' ),
85
				'call' => __( 'Use PayPal with this form.', 'formidable' ),
86
			),
87
			array(
88
				'link' => 'https://formidablepro.com/downloads/registration-lite/',
89
				'tip'  => __( 'Start building up your site membership.', 'formidable' ),
90
				'call' => __( 'Automatically create user accounts.', 'formidable' ),
91
			),
92
			array(
93
				'link' => 'https://formidablepro.com/downloads/twilio/',
94
				'tip'  => __( 'Want a text when this form is submitted or when a payment is received?', 'formidable' ),
95
				'call' => __( 'Use Twilio with this form.', 'formidable' ),
96
			),
97
		);
98
99
		return self::get_random_tip( $tips );
100
	}
101
102 View Code Duplication
	public static function get_styling_tip() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
103
		$tips = array(
104
			array(
105
				'link' => 'https://formidablepro.com/visual-styling-tip',
106
				'tip'  => __( 'Want your sidebar or footer form to look different from the rest?', 'formidable' ),
107
				'call' => __( 'Use multiple stylesheets.', 'formidable' ),
108
			),
109
		);
110
		return $tips[0];
111
	}
112
113 View Code Duplication
	public static function get_entries_tip() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
114
		$tips = array(
115
			array(
116
				'link' => 'https://formidablepro.com/manage-entries-tip',
117
				'tip'  => __( 'Are you looking for a specific entry? Do you want to delete or edit your submissions?', 'formidable' ),
118
				'call' => __( 'Add entry management.', 'formidable' ),
119
			),
120
		);
121
		return $tips[0];
122
	}
123
124 View Code Duplication
	public static function get_import_tip() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
125
		$tips = array(
126
			array(
127
				'link' => 'https://formidablepro.com/import-entries-tip/',
128
				'tip'  => __( 'Want to import entries into your forms?', 'formidable' ),
129
				'call' => __( 'Upgrade to Pro.', 'formidable' ),
130
			),
131
		);
132
		return $tips[0];
133
	}
134
135
	public static function get_random_tip( $tips ) {
136
		$random = rand( 0, count( $tips ) - 1 );
137
		return $tips[ $random ];
138
	}
139
}
140