options['disable_HTMLemail'] == '1' ) ? 'checked' : '';
echo "";
}
public function dependentplugin_activate() {
/* check for jetpack on every admin page load */
$jetpack = new Theme_Plugin_Dependency( 'jetpack', 'http://wordpress.org/extend/plugins/jetpack/' );
if ( $jetpack->check_active() ) {
$this->has_jetpack = true;
}
if ( $_GET['page'] == '42u-jetpack-booster/42u-jetpack-booster.php' && current_user_can( 'install_plugins' ) ) {
if ( ! $jetpack->check_active() ) {
$jetpack_msg = "What, no Jetpack? Jetpack greatly enhances the display of user profiles and managing feedback, along with a host of other cool features. It's free, you should try it out. This plugin won't do much without it.";
if ( $jetpack->check() ) {
$jetpack_msg .= ' Click here to activate it!';
} else if ( $install_link = $jetpack->install_link() ) {
$jetpack_msg .= ' Click here to install it!';
}
$jetpack_obj = new FTU_Admin_Notices( 'jetpack', $jetpack_msg, 'updated', true);
}
}
}
public function custom_post_type_icon() {
FTU::set_post_type_icon($image_urls=array('plugin'=>'jetpack-booster',
'admin-image'=>'images/jetpack_booster_adminmenu16-sprite.png',
'posts-image'=>'images/jetpack_booster_adminpage32.png',
'admin-imageX2'=>'images/jetpack_booster_adminmenu16-sprite_2x.png',
'posts-imageX2'=>'images/jetpack_booster_adminpage32_2x.png',
'file' => __FILE__
));
}
public function mail_content_type() {
return "text/html";
}
public function contact_form_redirect() {
global $JETTPACKBOOSTER_REDIRECT;
if ($JETTPACKBOOSTER_REDIRECT) {
echo("");
}
}
public function wp_mail_hook($data) {
/* we only want to do this if JetPack is installed and we have contact form fields */
global $post;
global $contact_form_fields, $grunion_form, $JETTPACKBOOSTER_REDIRECT;
$jetpack = new Theme_Plugin_Dependency( 'jetpack', 'http://wordpress.org/extend/plugins/jetpack/' );
if ( $jetpack->check_active() ) {
$this->has_jetpack = true;
}
if( $this->has_jetpack && $contact_form_fields) {
foreach ($contact_form_fields as $v) {
$match = preg_match('/redirect/', $v['id']);
if ($match === 1) {
$JETTPACKBOOSTER_REDIRECT = $v['default'];
}
}
if ($this->options['disable_HTMLemail']) {
$pattern = '/redirect:.*?\n/i';
$data["message"] = preg_replace($pattern, '', $data["message"]);
} else {
add_filter("wp_mail_content_type", array($this,'mail_content_type'));
$subject = $data["subject"];
$pattern = '/redirect:.*?\n/i';
$message = nl2br(preg_replace($pattern, '', $data["message"]));
$template = $this->options['email_template'];
$footer_links = "You have received this email because you are a contact at " . get_bloginfo('name') . ". Log in to change your preferences.";
$template = preg_replace('/!!!EMAIL_BODY!!!/',$message,$template);
$template = preg_replace('/!!!EMAIL_SUBJECT!!!/',$subject,$template);
$template = preg_replace('/!!!EMAIL_FOOTER_LINKS!!!/',$footer_links,$template);
$data["message"] = $template;
}
}
return $data;
}
}
$jetpack_booster = new _42UJETPACK_BOOSTER();