public static function supported()
 {
     /***
      * Check if supported 3rd party plugins are active that require exceptions
      ***/
     /* Gravity Forms ( http://www.gravityforms.com/ ) */
     if (rs_wpss_is_plugin_active('gravityforms/gravityforms.php', TRUE)) {
         if (!defined('WPSS_SOFT_COMPAT_MODE')) {
             define('WPSS_SOFT_COMPAT_MODE', TRUE);
         }
     }
 }
Пример #2
0
 public static function insert_footer_js($ret = FALSE)
 {
     /***
      * Insert WP-SpamShield JS into footer. This adds essential hidden fields to the relevant forms via jQuery. (REF2XJS and FVFJS)
      * Added 1.8.9.9
      ***/
     if ((!is_admin() && is_user_logged_in() || !is_user_logged_in()) && !rs_wpss_is_admin_sproc()) {
         /* REF2XJS and FVFJS code */
         $wpss_key_values = rs_wpss_get_key_values();
         $wpss_js_key = $wpss_key_values['wpss_js_key'];
         $wpss_js_val = $wpss_key_values['wpss_js_val'];
         global $spamshield_options;
         if (empty($spamshield_options)) {
             $spamshield_options = get_option('spamshield_options');
         }
         $comment_min_length = !empty($spamshield_options['comment_min_length']) ? $spamshield_options['comment_min_length'] : '15';
         $cm_var = $cm_str = $bp_str = '';
         if (rs_wpss_comments_open()) {
             $cm_var = 'cm4S="form[action=\'' . WPSS_COMMENTS_POST_URL . '\']";' . WPSS_EOL;
             $cm_str = ', "+cm4S+"';
         }
         if (class_exists('BuddyPress')) {
             $bp_single = rs_wpss_is_3p_register_page() ? ', #signup_form' : '';
             $bp_str = ', #buddypress #signup_form, #buddypress #register-page #signup_form, .buddypress #signup_form' . $bp_single;
         }
         $cf7_str = defined('WPCF7_VERSION') ? ', .wpcf7-form' : '';
         $gf_str = class_exists('GFForms') ? ', .gform_wrapper form' : '';
         $tpr_str = rs_wpss_is_3p_register_page() ? ', .login-form.register-form' : '';
         $js = WPSS_EOL;
         global $wpss_ao_active;
         $ao_noop_open = $ao_noop_close = '';
         if (empty($wpss_ao_active)) {
             $wpss_ao_active = rs_wpss_is_plugin_active('autoptimize/autoptimize.php');
         }
         if (!empty($wpss_ao_active)) {
             $ao_noop_open = '<!--noptimize-->';
             $ao_noop_close = '<!--/noptimize-->';
         }
         /* Add noptimize tags if Autoptimize is active */
         $js .= $ao_noop_open . '<script type=\'text/javascript\'>' . WPSS_EOL . '/* <![CDATA[ */' . WPSS_EOL . WPSS_REF2XJS . '=escape(document[\'referrer\']);' . WPSS_EOL . 'hf4N=\'' . $wpss_js_key . '\';' . WPSS_EOL . 'hf4V=\'' . $wpss_js_val . '\';' . WPSS_EOL . $cm_var . 'jQuery(document).ready(function($){' . 'var e="#commentform, .comment-respond form, .comment-form' . $cm_str . ', #lostpasswordform, #registerform, #loginform, #login_form' . $tpr_str . ', #wpss_contact_form' . $cf7_str . $gf_str . $bp_str;
         $js .= WPSS_Compatibility::footer_js();
         $js .= '";$(e).submit(function(){$("<input>").attr("type","hidden").attr("name","' . WPSS_REF2XJS . '").attr("value",' . WPSS_REF2XJS . ').appendTo(e);';
         if (FALSE === WPSS_COMPAT_MODE && !defined('WPSS_SOFT_COMPAT_MODE')) {
             $js .= '$("<input>").attr("type","hidden").attr("name",hf4N).attr("value",hf4V).appendTo(e);';
         }
         $js .= 'return true;});';
         if (TRUE === WPSS_COMPAT_MODE || defined('WPSS_SOFT_COMPAT_MODE')) {
             $js .= 'var h="form[method=\'post\']";$(h).submit(function(){$("<input>").attr("type","hidden").attr("name",hf4N).attr("value",hf4V).appendTo(h);return true;});';
         } else {
             $js .= '$("#comment").attr({minlength:"' . $comment_min_length . '",maxlength:"15360"})';
         }
         $js .= '});' . WPSS_EOL . '/* ]]> */' . WPSS_EOL . '</script>' . $ao_noop_close . " " . WPSS_EOL;
         if (TRUE === $ret) {
             return $js;
         } else {
             echo $js;
         }
     }
 }