@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class FrmSettings{ |
|
| 3 | +class FrmSettings { |
|
| 4 | 4 | public $option_name = 'frm_options'; |
| 5 | 5 | public $menu; |
| 6 | 6 | public $mu_menu; |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | public $re_msg; |
| 29 | 29 | |
| 30 | 30 | public function __construct() { |
| 31 | - if ( ! defined('ABSPATH') ) { |
|
| 32 | - die('You are not allowed to call this page directly.'); |
|
| 31 | + if ( ! defined( 'ABSPATH' ) ) { |
|
| 32 | + die( 'You are not allowed to call this page directly.' ); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $settings = get_transient($this->option_name); |
|
| 35 | + $settings = get_transient( $this->option_name ); |
|
| 36 | 36 | |
| 37 | - if ( ! is_object($settings) ) { |
|
| 38 | - $settings = $this->translate_settings($settings); |
|
| 37 | + if ( ! is_object( $settings ) ) { |
|
| 38 | + $settings = $this->translate_settings( $settings ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | foreach ( $settings as $setting_name => $setting ) { |
| 42 | 42 | $this->{$setting_name} = $setting; |
| 43 | - unset($setting_name, $setting); |
|
| 43 | + unset( $setting_name, $setting ); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $this->set_default_options(); |
@@ -48,24 +48,24 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | private function translate_settings( $settings ) { |
| 50 | 50 | if ( $settings ) { //workaround for W3 total cache conflict |
| 51 | - return unserialize(serialize($settings)); |
|
| 51 | + return unserialize( serialize( $settings ) ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $settings = get_option($this->option_name); |
|
| 55 | - if ( is_object($settings) ) { |
|
| 56 | - set_transient($this->option_name, $settings); |
|
| 54 | + $settings = get_option( $this->option_name ); |
|
| 55 | + if ( is_object( $settings ) ) { |
|
| 56 | + set_transient( $this->option_name, $settings ); |
|
| 57 | 57 | return $settings; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // If unserializing didn't work |
| 61 | 61 | if ( $settings ) { //workaround for W3 total cache conflict |
| 62 | - $settings = unserialize(serialize($settings)); |
|
| 62 | + $settings = unserialize( serialize( $settings ) ); |
|
| 63 | 63 | } else { |
| 64 | 64 | $settings = $this; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - update_option($this->option_name, $settings); |
|
| 68 | - set_transient($this->option_name, $settings); |
|
| 67 | + update_option( $this->option_name, $settings ); |
|
| 68 | + set_transient( $this->option_name, $settings ); |
|
| 69 | 69 | |
| 70 | 70 | return $settings; |
| 71 | 71 | } |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | private function set_default_options() { |
| 99 | 99 | $this->fill_recaptcha_settings(); |
| 100 | 100 | |
| 101 | - if ( ! isset($this->load_style) ) { |
|
| 102 | - if ( ! isset($this->custom_style) ) { |
|
| 101 | + if ( ! isset( $this->load_style ) ) { |
|
| 102 | + if ( ! isset( $this->custom_style ) ) { |
|
| 103 | 103 | $this->custom_style = true; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -109,16 +109,16 @@ discard block |
||
| 109 | 109 | $this->fill_with_defaults(); |
| 110 | 110 | |
| 111 | 111 | if ( is_multisite() && is_admin() ) { |
| 112 | - $mu_menu = get_site_option('frm_admin_menu_name'); |
|
| 113 | - if ( $mu_menu && ! empty($mu_menu) ) { |
|
| 112 | + $mu_menu = get_site_option( 'frm_admin_menu_name' ); |
|
| 113 | + if ( $mu_menu && ! empty( $mu_menu ) ) { |
|
| 114 | 114 | $this->menu = $mu_menu; |
| 115 | 115 | $this->mu_menu = 1; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $frm_roles = FrmAppHelper::frm_capabilities('pro'); |
|
| 119 | + $frm_roles = FrmAppHelper::frm_capabilities( 'pro' ); |
|
| 120 | 120 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 121 | - if ( ! isset($this->$frm_role) ) { |
|
| 121 | + if ( ! isset( $this->$frm_role ) ) { |
|
| 122 | 122 | $this->$frm_role = 'administrator'; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | $settings = $this->default_options(); |
| 129 | 129 | |
| 130 | 130 | foreach ( $settings as $setting => $default ) { |
| 131 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
| 132 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
| 133 | - } else if ( ! isset($this->{$setting}) ) { |
|
| 131 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
| 132 | + $this->{$setting} = $params['frm_' . $setting]; |
|
| 133 | + } else if ( ! isset( $this->{$setting}) ) { |
|
| 134 | 134 | $this->{$setting} = $default; |
| 135 | 135 | } |
| 136 | - unset($setting, $default); |
|
| 136 | + unset( $setting, $default ); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -141,23 +141,23 @@ discard block |
||
| 141 | 141 | $privkey = ''; |
| 142 | 142 | $re_lang = 'en'; |
| 143 | 143 | |
| 144 | - if ( ! isset($this->pubkey) ) { |
|
| 144 | + if ( ! isset( $this->pubkey ) ) { |
|
| 145 | 145 | // get the options from the database |
| 146 | - $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha'); |
|
| 147 | - $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : ''; |
|
| 148 | - $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey; |
|
| 149 | - $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang; |
|
| 146 | + $recaptcha_opt = is_multisite() ? get_site_option( 'recaptcha' ) : get_option( 'recaptcha' ); |
|
| 147 | + $this->pubkey = isset( $recaptcha_opt['pubkey'] ) ? $recaptcha_opt['pubkey'] : ''; |
|
| 148 | + $privkey = isset( $recaptcha_opt['privkey'] ) ? $recaptcha_opt['privkey'] : $privkey; |
|
| 149 | + $re_lang = isset( $recaptcha_opt['re_lang'] ) ? $recaptcha_opt['re_lang'] : $re_lang; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ( ! isset($this->re_msg) || empty($this->re_msg) ) { |
|
| 152 | + if ( ! isset( $this->re_msg ) || empty( $this->re_msg ) ) { |
|
| 153 | 153 | $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( ! isset($this->privkey) ) { |
|
| 156 | + if ( ! isset( $this->privkey ) ) { |
|
| 157 | 157 | $this->privkey = $privkey; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ( ! isset($this->re_lang) ) { |
|
| 160 | + if ( ! isset( $this->re_lang ) ) { |
|
| 161 | 161 | $this->re_lang = $re_lang; |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -168,31 +168,31 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | public function update( $params ) { |
| 171 | - $this->fill_with_defaults($params); |
|
| 172 | - $this->update_settings($params); |
|
| 171 | + $this->fill_with_defaults( $params ); |
|
| 172 | + $this->update_settings( $params ); |
|
| 173 | 173 | |
| 174 | 174 | if ( $this->mu_menu ) { |
| 175 | - update_site_option('frm_admin_menu_name', $this->menu); |
|
| 176 | - } else if ( current_user_can('administrator') ) { |
|
| 177 | - update_site_option('frm_admin_menu_name', false); |
|
| 175 | + update_site_option( 'frm_admin_menu_name', $this->menu ); |
|
| 176 | + } else if ( current_user_can( 'administrator' ) ) { |
|
| 177 | + update_site_option( 'frm_admin_menu_name', false ); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $this->update_roles($params); |
|
| 180 | + $this->update_roles( $params ); |
|
| 181 | 181 | |
| 182 | 182 | do_action( 'frm_update_settings', $params ); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | private function update_settings( $params ) { |
| 186 | - $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0; |
|
| 186 | + $this->mu_menu = isset( $params['frm_mu_menu'] ) ? $params['frm_mu_menu'] : 0; |
|
| 187 | 187 | |
| 188 | - $this->pubkey = trim($params['frm_pubkey']); |
|
| 188 | + $this->pubkey = trim( $params['frm_pubkey'] ); |
|
| 189 | 189 | $this->privkey = $params['frm_privkey']; |
| 190 | 190 | $this->re_lang = $params['frm_re_lang']; |
| 191 | 191 | |
| 192 | 192 | $this->load_style = $params['frm_load_style']; |
| 193 | 193 | $this->preview_page_id = (int) $params['frm-preview-page-id']; |
| 194 | 194 | |
| 195 | - $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0; |
|
| 195 | + $this->use_html = isset( $params['frm_use_html'] ) ? $params['frm_use_html'] : 0; |
|
| 196 | 196 | //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0; |
| 197 | 197 | $this->jquery_css = isset( $params['frm_jquery_css'] ) ? absint( $params['frm_jquery_css'] ) : 0; |
| 198 | 198 | $this->accordion_js = isset( $params['frm_accordion_js'] ) ? absint( $params['frm_accordion_js'] ) : 0; |
@@ -205,30 +205,30 @@ discard block |
||
| 205 | 205 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 206 | 206 | $roles = get_editable_roles(); |
| 207 | 207 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 208 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 208 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
| 209 | 209 | |
| 210 | - if ( count($this->$frm_role) === 1 ) { |
|
| 211 | - $set_role = reset($this->$frm_role); |
|
| 210 | + if ( count( $this->$frm_role ) === 1 ) { |
|
| 211 | + $set_role = reset( $this->$frm_role ); |
|
| 212 | 212 | switch ( $set_role ) { |
| 213 | 213 | case 'subscriber': |
| 214 | - array_push($this->$frm_role, 'contributor'); |
|
| 214 | + array_push( $this->$frm_role, 'contributor' ); |
|
| 215 | 215 | case 'contributor': |
| 216 | - array_push($this->$frm_role, 'author'); |
|
| 216 | + array_push( $this->$frm_role, 'author' ); |
|
| 217 | 217 | case 'author': |
| 218 | - array_push($this->$frm_role, 'editor'); |
|
| 218 | + array_push( $this->$frm_role, 'editor' ); |
|
| 219 | 219 | case 'editor': |
| 220 | - array_push($this->$frm_role, 'administrator'); |
|
| 220 | + array_push( $this->$frm_role, 'administrator' ); |
|
| 221 | 221 | } |
| 222 | - unset($set_role); |
|
| 222 | + unset( $set_role ); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | foreach ( $roles as $role => $details ) { |
| 226 | - if ( in_array($role, $this->$frm_role) ) { |
|
| 226 | + if ( in_array( $role, $this->$frm_role ) ) { |
|
| 227 | 227 | $wp_roles->add_cap( $role, $frm_role ); |
| 228 | 228 | } else { |
| 229 | 229 | $wp_roles->remove_cap( $role, $frm_role ); |
| 230 | 230 | } |
| 231 | - unset($role, $details); |
|
| 231 | + unset( $role, $details ); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -236,10 +236,10 @@ discard block |
||
| 236 | 236 | public function store() { |
| 237 | 237 | // Save the posted value in the database |
| 238 | 238 | |
| 239 | - update_option('frm_options', $this); |
|
| 239 | + update_option( 'frm_options', $this ); |
|
| 240 | 240 | |
| 241 | - delete_transient('frm_options'); |
|
| 242 | - set_transient('frm_options', $this); |
|
| 241 | + delete_transient( 'frm_options' ); |
|
| 242 | + set_transient( 'frm_options', $this ); |
|
| 243 | 243 | |
| 244 | 244 | do_action( 'frm_store_settings' ); |
| 245 | 245 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class FrmSettings{ |
|
| 3 | +class FrmSettings { |
|
| 4 | 4 | public $option_name = 'frm_options'; |
| 5 | 5 | public $menu; |
| 6 | 6 | public $mu_menu; |
@@ -47,7 +47,8 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | private function translate_settings( $settings ) { |
| 50 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 50 | + if ( $settings ) { |
|
| 51 | +//workaround for W3 total cache conflict |
|
| 51 | 52 | return unserialize(serialize($settings)); |
| 52 | 53 | } |
| 53 | 54 | |
@@ -58,7 +59,8 @@ discard block |
||
| 58 | 59 | } |
| 59 | 60 | |
| 60 | 61 | // If unserializing didn't work |
| 61 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 62 | + if ( $settings ) { |
|
| 63 | +//workaround for W3 total cache conflict |
|
| 62 | 64 | $settings = unserialize(serialize($settings)); |
| 63 | 65 | } else { |
| 64 | 66 | $settings = $this; |
@@ -1,246 +1,246 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class FrmSettings{ |
| 4 | - public $option_name = 'frm_options'; |
|
| 5 | - public $menu; |
|
| 6 | - public $mu_menu; |
|
| 7 | - public $preview_page_id; |
|
| 8 | - public $use_html; |
|
| 9 | - public $jquery_css; |
|
| 10 | - public $accordion_js; |
|
| 11 | - |
|
| 12 | - public $success_msg; |
|
| 13 | - public $blank_msg; |
|
| 14 | - public $unique_msg; |
|
| 15 | - public $invalid_msg; |
|
| 16 | - public $failed_msg; |
|
| 17 | - public $submit_value; |
|
| 18 | - public $login_msg; |
|
| 19 | - public $admin_permission; |
|
| 20 | - |
|
| 21 | - public $email_to; |
|
| 22 | - public $load_style; |
|
| 23 | - public $custom_style; |
|
| 24 | - |
|
| 25 | - public $pubkey; |
|
| 26 | - public $privkey; |
|
| 27 | - public $re_lang; |
|
| 28 | - public $re_msg; |
|
| 29 | - |
|
| 30 | - public function __construct() { |
|
| 31 | - if ( ! defined('ABSPATH') ) { |
|
| 32 | - die('You are not allowed to call this page directly.'); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $settings = get_transient($this->option_name); |
|
| 36 | - |
|
| 37 | - if ( ! is_object($settings) ) { |
|
| 38 | - $settings = $this->translate_settings($settings); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - foreach ( $settings as $setting_name => $setting ) { |
|
| 42 | - $this->{$setting_name} = $setting; |
|
| 43 | - unset($setting_name, $setting); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - $this->set_default_options(); |
|
| 47 | - } |
|
| 4 | + public $option_name = 'frm_options'; |
|
| 5 | + public $menu; |
|
| 6 | + public $mu_menu; |
|
| 7 | + public $preview_page_id; |
|
| 8 | + public $use_html; |
|
| 9 | + public $jquery_css; |
|
| 10 | + public $accordion_js; |
|
| 11 | + |
|
| 12 | + public $success_msg; |
|
| 13 | + public $blank_msg; |
|
| 14 | + public $unique_msg; |
|
| 15 | + public $invalid_msg; |
|
| 16 | + public $failed_msg; |
|
| 17 | + public $submit_value; |
|
| 18 | + public $login_msg; |
|
| 19 | + public $admin_permission; |
|
| 20 | + |
|
| 21 | + public $email_to; |
|
| 22 | + public $load_style; |
|
| 23 | + public $custom_style; |
|
| 24 | + |
|
| 25 | + public $pubkey; |
|
| 26 | + public $privkey; |
|
| 27 | + public $re_lang; |
|
| 28 | + public $re_msg; |
|
| 29 | + |
|
| 30 | + public function __construct() { |
|
| 31 | + if ( ! defined('ABSPATH') ) { |
|
| 32 | + die('You are not allowed to call this page directly.'); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $settings = get_transient($this->option_name); |
|
| 36 | + |
|
| 37 | + if ( ! is_object($settings) ) { |
|
| 38 | + $settings = $this->translate_settings($settings); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + foreach ( $settings as $setting_name => $setting ) { |
|
| 42 | + $this->{$setting_name} = $setting; |
|
| 43 | + unset($setting_name, $setting); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + $this->set_default_options(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | private function translate_settings( $settings ) { |
| 50 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 51 | - return unserialize(serialize($settings)); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - $settings = get_option($this->option_name); |
|
| 55 | - if ( is_object($settings) ) { |
|
| 56 | - set_transient($this->option_name, $settings); |
|
| 57 | - return $settings; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - // If unserializing didn't work |
|
| 61 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 62 | - $settings = unserialize(serialize($settings)); |
|
| 63 | - } else { |
|
| 64 | - $settings = $this; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - update_option($this->option_name, $settings); |
|
| 68 | - set_transient($this->option_name, $settings); |
|
| 69 | - |
|
| 70 | - return $settings; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @return array |
|
| 75 | - */ |
|
| 50 | + if ( $settings ) { //workaround for W3 total cache conflict |
|
| 51 | + return unserialize(serialize($settings)); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + $settings = get_option($this->option_name); |
|
| 55 | + if ( is_object($settings) ) { |
|
| 56 | + set_transient($this->option_name, $settings); |
|
| 57 | + return $settings; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + // If unserializing didn't work |
|
| 61 | + if ( $settings ) { //workaround for W3 total cache conflict |
|
| 62 | + $settings = unserialize(serialize($settings)); |
|
| 63 | + } else { |
|
| 64 | + $settings = $this; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + update_option($this->option_name, $settings); |
|
| 68 | + set_transient($this->option_name, $settings); |
|
| 69 | + |
|
| 70 | + return $settings; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @return array |
|
| 75 | + */ |
|
| 76 | 76 | public function default_options() { |
| 77 | - return array( |
|
| 78 | - 'menu' => __( 'Forms', 'formidable' ), |
|
| 79 | - 'mu_menu' => 0, |
|
| 80 | - 'preview_page_id' => 0, |
|
| 81 | - 'use_html' => true, |
|
| 82 | - 'jquery_css' => false, |
|
| 83 | - 'accordion_js' => false, |
|
| 84 | - |
|
| 85 | - 'success_msg' => __( 'Your responses were successfully submitted. Thank you!', 'formidable' ), |
|
| 86 | - 'blank_msg' => __( 'This field cannot be blank.', 'formidable' ), |
|
| 87 | - 'unique_msg' => __( 'This value must be unique.', 'formidable' ), |
|
| 88 | - 'invalid_msg' => __( 'There was a problem with your submission. Errors are marked below.', 'formidable' ), |
|
| 89 | - 'failed_msg' => __( 'We\'re sorry. It looks like you\'ve already submitted that.', 'formidable' ), |
|
| 90 | - 'submit_value' => __( 'Submit', 'formidable' ), |
|
| 91 | - 'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ), |
|
| 92 | - 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
|
| 93 | - |
|
| 94 | - 'email_to' => '[admin_email]', |
|
| 95 | - ); |
|
| 96 | - } |
|
| 77 | + return array( |
|
| 78 | + 'menu' => __( 'Forms', 'formidable' ), |
|
| 79 | + 'mu_menu' => 0, |
|
| 80 | + 'preview_page_id' => 0, |
|
| 81 | + 'use_html' => true, |
|
| 82 | + 'jquery_css' => false, |
|
| 83 | + 'accordion_js' => false, |
|
| 84 | + |
|
| 85 | + 'success_msg' => __( 'Your responses were successfully submitted. Thank you!', 'formidable' ), |
|
| 86 | + 'blank_msg' => __( 'This field cannot be blank.', 'formidable' ), |
|
| 87 | + 'unique_msg' => __( 'This value must be unique.', 'formidable' ), |
|
| 88 | + 'invalid_msg' => __( 'There was a problem with your submission. Errors are marked below.', 'formidable' ), |
|
| 89 | + 'failed_msg' => __( 'We\'re sorry. It looks like you\'ve already submitted that.', 'formidable' ), |
|
| 90 | + 'submit_value' => __( 'Submit', 'formidable' ), |
|
| 91 | + 'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ), |
|
| 92 | + 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
|
| 93 | + |
|
| 94 | + 'email_to' => '[admin_email]', |
|
| 95 | + ); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | private function set_default_options() { |
| 99 | - $this->fill_recaptcha_settings(); |
|
| 100 | - |
|
| 101 | - if ( ! isset($this->load_style) ) { |
|
| 102 | - if ( ! isset($this->custom_style) ) { |
|
| 103 | - $this->custom_style = true; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $this->load_style = 'all'; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - $this->fill_with_defaults(); |
|
| 110 | - |
|
| 111 | - if ( is_multisite() && is_admin() ) { |
|
| 112 | - $mu_menu = get_site_option('frm_admin_menu_name'); |
|
| 113 | - if ( $mu_menu && ! empty($mu_menu) ) { |
|
| 114 | - $this->menu = $mu_menu; |
|
| 115 | - $this->mu_menu = 1; |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - $frm_roles = FrmAppHelper::frm_capabilities('pro'); |
|
| 120 | - foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
| 121 | - if ( ! isset($this->$frm_role) ) { |
|
| 122 | - $this->$frm_role = 'administrator'; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 99 | + $this->fill_recaptcha_settings(); |
|
| 100 | + |
|
| 101 | + if ( ! isset($this->load_style) ) { |
|
| 102 | + if ( ! isset($this->custom_style) ) { |
|
| 103 | + $this->custom_style = true; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $this->load_style = 'all'; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + $this->fill_with_defaults(); |
|
| 110 | + |
|
| 111 | + if ( is_multisite() && is_admin() ) { |
|
| 112 | + $mu_menu = get_site_option('frm_admin_menu_name'); |
|
| 113 | + if ( $mu_menu && ! empty($mu_menu) ) { |
|
| 114 | + $this->menu = $mu_menu; |
|
| 115 | + $this->mu_menu = 1; |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + $frm_roles = FrmAppHelper::frm_capabilities('pro'); |
|
| 120 | + foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
| 121 | + if ( ! isset($this->$frm_role) ) { |
|
| 122 | + $this->$frm_role = 'administrator'; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | 127 | public function fill_with_defaults( $params = array() ) { |
| 128 | - $settings = $this->default_options(); |
|
| 128 | + $settings = $this->default_options(); |
|
| 129 | 129 | |
| 130 | - foreach ( $settings as $setting => $default ) { |
|
| 130 | + foreach ( $settings as $setting => $default ) { |
|
| 131 | 131 | if ( isset( $params[ 'frm_' . $setting ] ) ) { |
| 132 | 132 | $this->{$setting} = $params[ 'frm_' . $setting ]; |
| 133 | - } else if ( ! isset($this->{$setting}) ) { |
|
| 134 | - $this->{$setting} = $default; |
|
| 135 | - } |
|
| 136 | - unset($setting, $default); |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - private function fill_recaptcha_settings() { |
|
| 141 | - $privkey = ''; |
|
| 142 | - $re_lang = 'en'; |
|
| 143 | - |
|
| 144 | - if ( ! isset($this->pubkey) ) { |
|
| 145 | - // get the options from the database |
|
| 146 | - $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha'); |
|
| 147 | - $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : ''; |
|
| 148 | - $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey; |
|
| 149 | - $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - if ( ! isset($this->re_msg) || empty($this->re_msg) ) { |
|
| 153 | - $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' ); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - if ( ! isset($this->privkey) ) { |
|
| 157 | - $this->privkey = $privkey; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if ( ! isset($this->re_lang) ) { |
|
| 161 | - $this->re_lang = $re_lang; |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - public function validate( $params, $errors ) { |
|
| 166 | - $errors = apply_filters( 'frm_validate_settings', $errors, $params ); |
|
| 167 | - return $errors; |
|
| 168 | - } |
|
| 133 | + } else if ( ! isset($this->{$setting}) ) { |
|
| 134 | + $this->{$setting} = $default; |
|
| 135 | + } |
|
| 136 | + unset($setting, $default); |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + private function fill_recaptcha_settings() { |
|
| 141 | + $privkey = ''; |
|
| 142 | + $re_lang = 'en'; |
|
| 143 | + |
|
| 144 | + if ( ! isset($this->pubkey) ) { |
|
| 145 | + // get the options from the database |
|
| 146 | + $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha'); |
|
| 147 | + $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : ''; |
|
| 148 | + $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey; |
|
| 149 | + $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + if ( ! isset($this->re_msg) || empty($this->re_msg) ) { |
|
| 153 | + $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' ); |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + if ( ! isset($this->privkey) ) { |
|
| 157 | + $this->privkey = $privkey; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if ( ! isset($this->re_lang) ) { |
|
| 161 | + $this->re_lang = $re_lang; |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + public function validate( $params, $errors ) { |
|
| 166 | + $errors = apply_filters( 'frm_validate_settings', $errors, $params ); |
|
| 167 | + return $errors; |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | 170 | public function update( $params ) { |
| 171 | - $this->fill_with_defaults($params); |
|
| 172 | - $this->update_settings($params); |
|
| 171 | + $this->fill_with_defaults($params); |
|
| 172 | + $this->update_settings($params); |
|
| 173 | 173 | |
| 174 | - if ( $this->mu_menu ) { |
|
| 175 | - update_site_option('frm_admin_menu_name', $this->menu); |
|
| 176 | - } else if ( current_user_can('administrator') ) { |
|
| 177 | - update_site_option('frm_admin_menu_name', false); |
|
| 178 | - } |
|
| 174 | + if ( $this->mu_menu ) { |
|
| 175 | + update_site_option('frm_admin_menu_name', $this->menu); |
|
| 176 | + } else if ( current_user_can('administrator') ) { |
|
| 177 | + update_site_option('frm_admin_menu_name', false); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - $this->update_roles($params); |
|
| 180 | + $this->update_roles($params); |
|
| 181 | 181 | |
| 182 | - do_action( 'frm_update_settings', $params ); |
|
| 183 | - } |
|
| 182 | + do_action( 'frm_update_settings', $params ); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | private function update_settings( $params ) { |
| 186 | - $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0; |
|
| 186 | + $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0; |
|
| 187 | 187 | |
| 188 | - $this->pubkey = trim($params['frm_pubkey']); |
|
| 189 | - $this->privkey = $params['frm_privkey']; |
|
| 190 | - $this->re_lang = $params['frm_re_lang']; |
|
| 188 | + $this->pubkey = trim($params['frm_pubkey']); |
|
| 189 | + $this->privkey = $params['frm_privkey']; |
|
| 190 | + $this->re_lang = $params['frm_re_lang']; |
|
| 191 | 191 | |
| 192 | - $this->load_style = $params['frm_load_style']; |
|
| 193 | - $this->preview_page_id = (int) $params['frm-preview-page-id']; |
|
| 192 | + $this->load_style = $params['frm_load_style']; |
|
| 193 | + $this->preview_page_id = (int) $params['frm-preview-page-id']; |
|
| 194 | 194 | |
| 195 | - $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0; |
|
| 196 | - //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0; |
|
| 195 | + $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0; |
|
| 196 | + //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0; |
|
| 197 | 197 | $this->jquery_css = isset( $params['frm_jquery_css'] ) ? absint( $params['frm_jquery_css'] ) : 0; |
| 198 | 198 | $this->accordion_js = isset( $params['frm_accordion_js'] ) ? absint( $params['frm_accordion_js'] ) : 0; |
| 199 | - } |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | 201 | private function update_roles( $params ) { |
| 202 | - //update roles |
|
| 203 | - global $wp_roles; |
|
| 204 | - |
|
| 205 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
| 206 | - $roles = get_editable_roles(); |
|
| 207 | - foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
| 208 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 209 | - |
|
| 210 | - if ( count($this->$frm_role) === 1 ) { |
|
| 211 | - $set_role = reset($this->$frm_role); |
|
| 212 | - switch ( $set_role ) { |
|
| 213 | - case 'subscriber': |
|
| 214 | - array_push($this->$frm_role, 'contributor'); |
|
| 215 | - case 'contributor': |
|
| 216 | - array_push($this->$frm_role, 'author'); |
|
| 217 | - case 'author': |
|
| 218 | - array_push($this->$frm_role, 'editor'); |
|
| 219 | - case 'editor': |
|
| 220 | - array_push($this->$frm_role, 'administrator'); |
|
| 221 | - } |
|
| 222 | - unset($set_role); |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - foreach ( $roles as $role => $details ) { |
|
| 226 | - if ( in_array($role, $this->$frm_role) ) { |
|
| 227 | - $wp_roles->add_cap( $role, $frm_role ); |
|
| 228 | - } else { |
|
| 229 | - $wp_roles->remove_cap( $role, $frm_role ); |
|
| 230 | - } |
|
| 231 | - unset($role, $details); |
|
| 232 | - } |
|
| 233 | - } |
|
| 234 | - } |
|
| 202 | + //update roles |
|
| 203 | + global $wp_roles; |
|
| 204 | + |
|
| 205 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
| 206 | + $roles = get_editable_roles(); |
|
| 207 | + foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
| 208 | + $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 209 | + |
|
| 210 | + if ( count($this->$frm_role) === 1 ) { |
|
| 211 | + $set_role = reset($this->$frm_role); |
|
| 212 | + switch ( $set_role ) { |
|
| 213 | + case 'subscriber': |
|
| 214 | + array_push($this->$frm_role, 'contributor'); |
|
| 215 | + case 'contributor': |
|
| 216 | + array_push($this->$frm_role, 'author'); |
|
| 217 | + case 'author': |
|
| 218 | + array_push($this->$frm_role, 'editor'); |
|
| 219 | + case 'editor': |
|
| 220 | + array_push($this->$frm_role, 'administrator'); |
|
| 221 | + } |
|
| 222 | + unset($set_role); |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + foreach ( $roles as $role => $details ) { |
|
| 226 | + if ( in_array($role, $this->$frm_role) ) { |
|
| 227 | + $wp_roles->add_cap( $role, $frm_role ); |
|
| 228 | + } else { |
|
| 229 | + $wp_roles->remove_cap( $role, $frm_role ); |
|
| 230 | + } |
|
| 231 | + unset($role, $details); |
|
| 232 | + } |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | public function store() { |
| 237 | - // Save the posted value in the database |
|
| 237 | + // Save the posted value in the database |
|
| 238 | 238 | |
| 239 | - update_option('frm_options', $this); |
|
| 239 | + update_option('frm_options', $this); |
|
| 240 | 240 | |
| 241 | - delete_transient('frm_options'); |
|
| 242 | - set_transient('frm_options', $this); |
|
| 241 | + delete_transient('frm_options'); |
|
| 242 | + set_transient('frm_options', $this); |
|
| 243 | 243 | |
| 244 | - do_action( 'frm_store_settings' ); |
|
| 245 | - } |
|
| 244 | + do_action( 'frm_store_settings' ); |
|
| 245 | + } |
|
| 246 | 246 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | <?php |
| 5 | 5 | |
| 6 | 6 | foreach ( $plugins as $slug => $plugin ) { |
| 7 | - $license = get_option( 'edd_'. $slug .'_license_key' ); |
|
| 8 | - $status = get_option( 'edd_'. $slug .'_license_active' ); |
|
| 7 | + $license = get_option( 'edd_' . $slug . '_license_key' ); |
|
| 8 | + $status = get_option( 'edd_' . $slug . '_license_active' ); |
|
| 9 | 9 | $activate = ( false !== $license && $status == 'valid' ) ? 'deactivate' : 'activate'; |
| 10 | 10 | $icon_class = ( empty( $license ) ) ? 'frm_hidden' : ''; |
| 11 | 11 | ?> |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! isset( $entry) ) { |
| 3 | - $entry = $record; |
|
| 3 | + $entry = $record; |
|
| 4 | 4 | } ?> |
| 5 | 5 | |
| 6 | 6 | <div class="misc-pub-section curtime misc-pub-curtime"> |
| 7 | 7 | <span id="timestamp"> |
| 8 | 8 | <?php |
| 9 | - $date_format = __( 'M j, Y @ G:i' ); |
|
| 9 | + $date_format = __( 'M j, Y @ G:i' ); |
|
| 10 | 10 | printf( __( 'Published on: <b>%1$s</b>' ), FrmAppHelper::get_localized_date( $date_format, $entry->created_at ) ); ?> |
| 11 | 11 | </span> |
| 12 | 12 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! isset( $entry) ) { |
|
| 2 | +if ( ! isset( $entry ) ) { |
|
| 3 | 3 | $entry = $record; |
| 4 | 4 | } ?> |
| 5 | 5 | |
@@ -18,4 +18,4 @@ discard block |
||
| 18 | 18 | </div> |
| 19 | 19 | <?php } ?> |
| 20 | 20 | |
| 21 | -<?php do_action('frm_entry_shared_sidebar', $entry); ?> |
|
| 21 | +<?php do_action( 'frm_entry_shared_sidebar', $entry ); ?> |
|
@@ -4,30 +4,30 @@ |
||
| 4 | 4 | <?php |
| 5 | 5 | } |
| 6 | 6 | if ( isset( $message ) && $message != '' ) { |
| 7 | - if ( FrmAppHelper::is_admin() ) { |
|
| 7 | + if ( FrmAppHelper::is_admin() ) { |
|
| 8 | 8 | ?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php |
| 9 | 9 | } else { |
| 10 | - FrmFormsHelper::get_scroll_js($form->id); |
|
| 10 | + FrmFormsHelper::get_scroll_js($form->id); |
|
| 11 | 11 | |
| 12 | 12 | // we need to allow scripts here for javascript in the success message |
| 13 | 13 | echo $message; |
| 14 | - } |
|
| 14 | + } |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) { |
| 18 | 18 | |
| 19 | 19 | if ( isset( $form ) && is_object( $form ) ) { |
| 20 | - FrmFormsHelper::get_scroll_js( $form->id ); |
|
| 20 | + FrmFormsHelper::get_scroll_js( $form->id ); |
|
| 21 | 21 | } ?> |
| 22 | 22 | <div class="frm_error_style"> |
| 23 | 23 | <?php |
| 24 | 24 | $img = ''; |
| 25 | 25 | if ( ! FrmAppHelper::is_admin() ) { |
| 26 | - $img = apply_filters('frm_error_icon', $img); |
|
| 27 | - if ( $img && ! empty($img) ) { |
|
| 28 | - ?><img src="<?php echo esc_attr( $img ) ?>" alt="" /> |
|
| 26 | + $img = apply_filters('frm_error_icon', $img); |
|
| 27 | + if ( $img && ! empty($img) ) { |
|
| 28 | + ?><img src="<?php echo esc_attr( $img ) ?>" alt="" /> |
|
| 29 | 29 | <?php |
| 30 | - } |
|
| 30 | + } |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | FrmFormsHelper::show_errors( compact( 'img', 'errors' ) ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( isset($include_extra_container) ) { ?> |
|
| 2 | +if ( isset( $include_extra_container ) ) { ?> |
|
| 3 | 3 | <div class="<?php echo esc_attr( $include_extra_container ) ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
| 4 | 4 | <?php |
| 5 | 5 | } |
@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | if ( FrmAppHelper::is_admin() ) { |
| 8 | 8 | ?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php |
| 9 | 9 | } else { |
| 10 | - FrmFormsHelper::get_scroll_js($form->id); |
|
| 10 | + FrmFormsHelper::get_scroll_js( $form->id ); |
|
| 11 | 11 | |
| 12 | 12 | // we need to allow scripts here for javascript in the success message |
| 13 | 13 | echo $message; |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if ( isset($errors) && is_array( $errors ) && ! empty( $errors ) ) { |
|
| 17 | +if ( isset( $errors ) && is_array( $errors ) && ! empty( $errors ) ) { |
|
| 18 | 18 | |
| 19 | 19 | if ( isset( $form ) && is_object( $form ) ) { |
| 20 | 20 | FrmFormsHelper::get_scroll_js( $form->id ); |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | <?php |
| 24 | 24 | $img = ''; |
| 25 | 25 | if ( ! FrmAppHelper::is_admin() ) { |
| 26 | - $img = apply_filters('frm_error_icon', $img); |
|
| 27 | - if ( $img && ! empty($img) ) { |
|
| 26 | + $img = apply_filters( 'frm_error_icon', $img ); |
|
| 27 | + if ( $img && ! empty( $img ) ) { |
|
| 28 | 28 | ?><img src="<?php echo esc_attr( $img ) ?>" alt="" /> |
| 29 | 29 | <?php |
| 30 | 30 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | <?php |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | -if ( isset($include_extra_container) ) { ?> |
|
| 40 | +if ( isset( $include_extra_container ) ) { ?> |
|
| 41 | 41 | </div> |
| 42 | 42 | <?php |
| 43 | 43 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | </div> |
| 6 | 6 | </div> |
| 7 | 7 | <?php |
| 8 | - return; |
|
| 8 | + return; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | global $frm_vars; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } else { |
| 39 | 39 | do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) ); |
| 40 | 40 | } |
| 41 | - do_action('frm_get_field_scripts', $field, $form, $form->id); |
|
| 41 | + do_action('frm_get_field_scripts', $field, $form, $form->id); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | // close open collapsible toggle div |
| 65 | 65 | if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) { |
| 66 | - echo "</div>\n"; |
|
| 67 | - unset($frm_vars['collapse_div']); |
|
| 66 | + echo "</div>\n"; |
|
| 67 | + unset($frm_vars['collapse_div']); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if ( FrmForm::show_submit( $form ) ) { |
| 80 | - unset($values['fields']); |
|
| 81 | - FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values); |
|
| 80 | + unset($values['fields']); |
|
| 81 | + FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values); |
|
| 82 | 82 | } |
| 83 | 83 | ?> |
| 84 | 84 | </fieldset> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( empty($values) || ! isset($values['fields']) || empty($values['fields']) ) { ?> |
|
| 3 | -<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($form); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 2 | +if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?> |
|
| 3 | +<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $form ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 4 | 4 | <div class="frm_error_style"><strong><?php _e( 'Oops!', 'formidable' ) ?></strong> <?php printf( __( 'You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable' ), '<a href="' . esc_url( admin_url( '?page=formidable&frm_action=edit&id=' . $form->id ) ) . '">', '</a>' ) ?> |
| 5 | 5 | </div> |
| 6 | 6 | </div> |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | <div class="frm_form_fields <?php echo esc_attr( apply_filters( 'frm_form_fields_class', '', $values ) ); ?>"> |
| 22 | 22 | <fieldset> |
| 23 | 23 | <?php echo FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ); ?> |
| 24 | -<input type="hidden" name="frm_action" value="<?php echo esc_attr($form_action) ?>" /> |
|
| 25 | -<input type="hidden" name="form_id" value="<?php echo esc_attr($form->id) ?>" /> |
|
| 26 | -<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr($frm_hide_fields) ?>" /> |
|
| 24 | +<input type="hidden" name="frm_action" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
| 25 | +<input type="hidden" name="form_id" value="<?php echo esc_attr( $form->id ) ?>" /> |
|
| 26 | +<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr( $frm_hide_fields ) ?>" /> |
|
| 27 | 27 | <input type="hidden" name="frm_helpers_<?php echo esc_attr( $form->id ) ?>" id="frm_helpers_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr( $frm_helpers ) ?>" /> |
| 28 | -<input type="hidden" name="form_key" value="<?php echo esc_attr($form->form_key) ?>" /> |
|
| 28 | +<input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ) ?>" /> |
|
| 29 | 29 | <input type="hidden" name="item_meta[0]" value="" /> |
| 30 | 30 | <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?> |
| 31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } else { |
| 39 | 39 | do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) ); |
| 40 | 40 | } |
| 41 | - do_action('frm_get_field_scripts', $field, $form, $form->id); |
|
| 41 | + do_action( 'frm_get_field_scripts', $field, $form, $form->id ); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | if ( FrmAppHelper::is_admin() ) { ?> |
| 47 | 47 | <div class="frm_form_field form-field"> |
| 48 | 48 | <label class="frm_primary_label"><?php _e( 'Entry Key', 'formidable' ) ?></label> |
| 49 | -<input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" /> |
|
| 49 | +<input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" /> |
|
| 50 | 50 | </div> |
| 51 | 51 | <?php } else { ?> |
| 52 | -<input type="hidden" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" /> |
|
| 52 | +<input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" /> |
|
| 53 | 53 | <?php } |
| 54 | 54 | |
| 55 | -do_action('frm_entry_form', $form, $form_action, $errors); |
|
| 55 | +do_action( 'frm_entry_form', $form, $form_action, $errors ); |
|
| 56 | 56 | |
| 57 | 57 | global $frm_vars; |
| 58 | 58 | // close open section div |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // close open collapsible toggle div |
| 65 | -if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) { |
|
| 65 | +if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) { |
|
| 66 | 66 | echo "</div>\n"; |
| 67 | - unset($frm_vars['collapse_div']); |
|
| 67 | + unset( $frm_vars['collapse_div'] ); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); |
|
| 70 | +echo FrmFormsHelper::replace_shortcodes( $values['after_html'], $form ); |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | -if ( has_action('frm_entries_footer_scripts') ) { ?> |
|
| 73 | +if ( has_action( 'frm_entries_footer_scripts' ) ) { ?> |
|
| 74 | 74 | <script type="text/javascript"> |
| 75 | -<?php do_action('frm_entries_footer_scripts', $values['fields'], $form); ?> |
|
| 75 | +<?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?> |
|
| 76 | 76 | </script><?php |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if ( FrmForm::show_submit( $form ) ) { |
| 80 | - unset($values['fields']); |
|
| 81 | - FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values); |
|
| 80 | + unset( $values['fields'] ); |
|
| 81 | + FrmFormsHelper::get_custom_submit( $values['submit_html'], $form, $submit, $form_action, $values ); |
|
| 82 | 82 | } |
| 83 | 83 | ?> |
| 84 | 84 | </fieldset> |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <div id="form_entries_page" class="wrap"> |
| 2 | 2 | <div class="frmicon icon32"><br/></div> |
| 3 | 3 | <h2><?php _e( 'Entries', 'formidable' ); ?> |
| 4 | - <?php do_action('frm_entry_inside_h2', $form); ?> |
|
| 4 | + <?php do_action( 'frm_entry_inside_h2', $form ); ?> |
|
| 5 | 5 | </h2> |
| 6 | 6 | |
| 7 | - <?php require(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?> |
|
| 7 | + <?php require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
|
| 8 | 8 | |
| 9 | 9 | <form id="posts-filter" method="get"> |
| 10 | 10 | <div id="poststuff"> |
| 11 | 11 | <div id="post-body" class="metabox-holder columns-2"> |
| 12 | 12 | <div id="post-body-content"> |
| 13 | - <?php FrmAppController::get_form_nav($form, true, 'hide'); ?> |
|
| 13 | + <?php FrmAppController::get_form_nav( $form, true, 'hide' ); ?> |
|
| 14 | 14 | </div> |
| 15 | 15 | <div id="postbox-container-1" class="postbox-container"> |
| 16 | 16 | <input type="hidden" name="page" value="formidable-entries" /> |
@@ -1,17 +1,17 @@ |
||
| 1 | -<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($values); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 1 | +<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $values ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 2 | 2 | <?php |
| 3 | 3 | if ( ! isset( $include_form_tag ) || $include_form_tag ) { |
| 4 | 4 | ?> |
| 5 | -<form enctype="<?php echo esc_attr( apply_filters( 'frm_form_enctype', 'multipart/form-data', $form ) ) ?>" method="post" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" id="form_<?php echo esc_attr( $form->form_key ) ?>" <?php echo $frm_settings->use_html ? '' : 'action=""'; ?>> |
|
| 5 | +<form enctype="<?php echo esc_attr( apply_filters( 'frm_form_enctype', 'multipart/form-data', $form ) ) ?>" method="post" class="frm-show-form <?php do_action( 'frm_form_classes', $form ) ?>" id="form_<?php echo esc_attr( $form->form_key ) ?>" <?php echo $frm_settings->use_html ? '' : 'action=""'; ?>> |
|
| 6 | 6 | <?php |
| 7 | 7 | } else { ?> |
| 8 | -<div id="form_<?php echo esc_attr( $form->form_key ) ?>" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" > |
|
| 8 | +<div id="form_<?php echo esc_attr( $form->form_key ) ?>" class="frm-show-form <?php do_action( 'frm_form_classes', $form ) ?>" > |
|
| 9 | 9 | <?php |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php'); |
|
| 12 | +include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' ); |
|
| 13 | 13 | $form_action = 'create'; |
| 14 | -require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/form.php'); |
|
| 14 | +require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/form.php' ); |
|
| 15 | 15 | |
| 16 | 16 | if ( ! isset( $include_form_tag ) || $include_form_tag ) { |
| 17 | 17 | ?> |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <div class="frmcenter frm_no_entries_form"> |
| 2 | 2 | <?php |
| 3 | -if ( $form && isset($form->options['no_save']) && $form->options['no_save'] ) { ?> |
|
| 3 | +if ( $form && isset( $form->options['no_save'] ) && $form->options['no_save'] ) { ?> |
|
| 4 | 4 | <h3><?php _e( 'This form is not set to save any entries.', 'formidable' ) ?></h3> |
| 5 | -<p>If you would like entries in this form to be saved, go to the <a href="<?php echo esc_url(admin_url('admin.php?page=formidable') . '&frm_action=settings&id='. $form->id) ?>">form Settings</a> page and uncheck the "Do not store any entries submitted from this form" box.</p> |
|
| 5 | +<p>If you would like entries in this form to be saved, go to the <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable' ) . '&frm_action=settings&id=' . $form->id ) ?>">form Settings</a> page and uncheck the "Do not store any entries submitted from this form" box.</p> |
|
| 6 | 6 | <?php |
| 7 | 7 | } else if ( $form ) { |
| 8 | 8 | ?> |
| 9 | -<div class="frm_no_entries_header"><?php printf(__( 'No Entries for form: %s', 'formidable' ), $form->name); ?></div> |
|
| 10 | -<p class="frm_no_entries_text"><?php printf( __( 'For instructions on publishing your form see %1$sthis page%2$s <br/> or click "%3$sAdd New%4$s" above to add an entry from here (Requires License)', 'formidable' ), '<a href="https://formidablepro.com/knowledgebase/publish-your-forms/" target="_blank">', '</a>', '<a href="' . esc_url( admin_url('admin.php?page=formidable-entries&frm_action=new&form=' . $form->id ) ) . '">', '</a>' ); ?></p> |
|
| 9 | +<div class="frm_no_entries_header"><?php printf( __( 'No Entries for form: %s', 'formidable' ), $form->name ); ?></div> |
|
| 10 | +<p class="frm_no_entries_text"><?php printf( __( 'For instructions on publishing your form see %1$sthis page%2$s <br/> or click "%3$sAdd New%4$s" above to add an entry from here (Requires License)', 'formidable' ), '<a href="https://formidablepro.com/knowledgebase/publish-your-forms/" target="_blank">', '</a>', '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&frm_action=new&form=' . $form->id ) ) . '">', '</a>' ); ?></p> |
|
| 11 | 11 | <?php |
| 12 | 12 | } else { |
| 13 | 13 | ?> |
| 14 | 14 | <div class="frm_no_entries_header"><?php _e( 'You have not created any forms yet.', 'formidable' ); ?></div> |
| 15 | -<p class="frm_no_entries_text"><?php printf( __( 'To view entries, you must first %1$sbuild a form%2$s', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin.php?page=formidable&frm_action=new' ) ) . '">', '</a>' ); ?></p> |
|
| 15 | +<p class="frm_no_entries_text"><?php printf( __( 'To view entries, you must first %1$sbuild a form%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=new' ) ) . '">', '</a>' ); ?></p> |
|
| 16 | 16 | <?php |
| 17 | 17 | } ?> |
| 18 | 18 | </div> |
@@ -15,43 +15,43 @@ |
||
| 15 | 15 | <div class="inside"> |
| 16 | 16 | <table class="form-table"><tbody> |
| 17 | 17 | <?php |
| 18 | - $first_h3 = 'frm_first_h3'; |
|
| 19 | - foreach ( $fields as $field ) { |
|
| 18 | + $first_h3 = 'frm_first_h3'; |
|
| 19 | + foreach ( $fields as $field ) { |
|
| 20 | 20 | if ( in_array( $field->type, array( 'captcha', 'html', 'end_divider', 'form' ) ) ) { |
| 21 | - continue; |
|
| 22 | - } |
|
| 21 | + continue; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - if ( in_array($field->type, array( 'break', 'divider' ) ) ) { |
|
| 25 | - ?> |
|
| 24 | + if ( in_array($field->type, array( 'break', 'divider' ) ) ) { |
|
| 25 | + ?> |
|
| 26 | 26 | </tbody></table> |
| 27 | 27 | <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3> |
| 28 | 28 | <table class="form-table"><tbody> |
| 29 | 29 | <?php |
| 30 | - $first_h3 = ''; |
|
| 31 | - } else { |
|
| 32 | - ?> |
|
| 30 | + $first_h3 = ''; |
|
| 31 | + } else { |
|
| 32 | + ?> |
|
| 33 | 33 | <tr> |
| 34 | 34 | <th scope="row"><?php echo esc_html( $field->name ) ?>:</th> |
| 35 | 35 | <td> |
| 36 | 36 | <?php |
| 37 | 37 | $embedded_field_id = ( $entry->form_id != $field->form_id ) ? 'form' . $field->form_id : 0; |
| 38 | - $atts = array( |
|
| 39 | - 'type' => $field->type, 'post_id' => $entry->post_id, |
|
| 40 | - 'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id, |
|
| 41 | - 'embedded_field_id' => $embedded_field_id, |
|
| 42 | - ); |
|
| 43 | - echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts); |
|
| 38 | + $atts = array( |
|
| 39 | + 'type' => $field->type, 'post_id' => $entry->post_id, |
|
| 40 | + 'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id, |
|
| 41 | + 'embedded_field_id' => $embedded_field_id, |
|
| 42 | + ); |
|
| 43 | + echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts); |
|
| 44 | 44 | |
| 45 | - if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) { |
|
| 46 | - $to_emails[] = $display_value; |
|
| 47 | - } |
|
| 48 | - ?> |
|
| 45 | + if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) { |
|
| 46 | + $to_emails[] = $display_value; |
|
| 47 | + } |
|
| 48 | + ?> |
|
| 49 | 49 | </td> |
| 50 | 50 | </tr> |
| 51 | 51 | <?php } |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - ?> |
|
| 54 | + ?> |
|
| 55 | 55 | |
| 56 | 56 | <?php if ( $entry->parent_item_id ) { ?> |
| 57 | 57 | <tr><th><?php _e( 'Parent Entry ID', 'formidable' ) ?>:</th> |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <div id="form_show_entry_page" class="wrap"> |
| 2 | 2 | <div class="frmicon icon32"><br/></div> |
| 3 | 3 | <h2><?php _e( 'View Entry', 'formidable' ) ?> |
| 4 | - <?php do_action('frm_entry_inside_h2', $entry->form_id); ?> |
|
| 4 | + <?php do_action( 'frm_entry_inside_h2', $entry->form_id ); ?> |
|
| 5 | 5 | </h2> |
| 6 | 6 | |
| 7 | 7 | <div class="frm_forms"> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <div id="poststuff"> |
| 10 | 10 | <div id="post-body" class="metabox-holder columns-2"> |
| 11 | 11 | <div id="post-body-content"> |
| 12 | - <?php FrmAppController::get_form_nav($entry->form_id, true); ?> |
|
| 12 | + <?php FrmAppController::get_form_nav( $entry->form_id, true ); ?> |
|
| 13 | 13 | <div class="postbox"> |
| 14 | 14 | <h3 class="hndle"><span><?php _e( 'Entry', 'formidable' ) ?></span></h3> |
| 15 | 15 | <div class="inside"> |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | continue; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if ( in_array($field->type, array( 'break', 'divider' ) ) ) { |
|
| 24 | + if ( in_array( $field->type, array( 'break', 'divider' ) ) ) { |
|
| 25 | 25 | ?> |
| 26 | 26 | </tbody></table> |
| 27 | 27 | <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3> |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | 'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id, |
| 41 | 41 | 'embedded_field_id' => $embedded_field_id, |
| 42 | 42 | ); |
| 43 | - echo $display_value = FrmEntriesHelper::prepare_display_value($entry, $field, $atts); |
|
| 43 | + echo $display_value = FrmEntriesHelper::prepare_display_value( $entry, $field, $atts ); |
|
| 44 | 44 | |
| 45 | - if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) { |
|
| 45 | + if ( is_email( $display_value ) && ! in_array( $display_value, $to_emails ) ) { |
|
| 46 | 46 | $to_emails[] = $display_value; |
| 47 | 47 | } |
| 48 | 48 | ?> |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | </td></tr> |
| 60 | 60 | <?php } ?> |
| 61 | 61 | </tbody></table> |
| 62 | - <?php do_action('frm_show_entry', $entry); ?> |
|
| 62 | + <?php do_action( 'frm_show_entry', $entry ); ?> |
|
| 63 | 63 | </div> |
| 64 | 64 | </div> |
| 65 | 65 | |
| 66 | - <?php do_action('frm_after_show_entry', $entry); ?> |
|
| 66 | + <?php do_action( 'frm_after_show_entry', $entry ); ?> |
|
| 67 | 67 | |
| 68 | 68 | </div> |
| 69 | - <?php require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-show.php'); ?> |
|
| 69 | + <?php require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-show.php' ); ?> |
|
| 70 | 70 | </div> |
| 71 | 71 | </div> |
| 72 | 72 | </div> |