diff --git a/classes/controllers/FrmFieldsController.php b/classes/controllers/FrmFieldsController.php
index e6d6691c0b..3537b38f47 100644
--- a/classes/controllers/FrmFieldsController.php
+++ b/classes/controllers/FrmFieldsController.php
@@ -48,7 +48,7 @@ public static function load_field() {
wp_die();
}
- public static function create(){
+ public static function create() {
check_ajax_referer( 'frm_ajax', 'nonce' );
$field_type = sanitize_text_field( $_POST['field'] );
@@ -62,6 +62,9 @@ public static function create(){
wp_die();
}
+ /**
+ * @param integer $form_id
+ */
public static function include_new_field($field_type, $form_id) {
$values = array();
if ( FrmAppHelper::pro_is_installed() ) {
@@ -116,7 +119,7 @@ public static function edit_name($field = 'name', $id = '') {
wp_die();
}
- public static function update_ajax_option(){
+ public static function update_ajax_option() {
check_ajax_referer( 'frm_ajax', 'nonce' );
$field = FrmField::getOne($_POST['field']);
@@ -140,7 +143,7 @@ public static function update_ajax_option(){
wp_die();
}
- public static function duplicate(){
+ public static function duplicate() {
check_ajax_referer( 'frm_ajax', 'nonce' );
global $wpdb;
@@ -188,7 +191,7 @@ public static function include_single_field( $field_id, $values, $form_id = 0 )
return $field;
}
- public static function destroy(){
+ public static function destroy() {
check_ajax_referer( 'frm_ajax', 'nonce' );
FrmField::destroy($_POST['field_id']);
@@ -198,7 +201,7 @@ public static function destroy(){
/* Field Options */
//Add Single Option or Other Option
- public static function add_option(){
+ public static function add_option() {
check_ajax_referer( 'frm_ajax', 'nonce' );
$id = (int) $_POST['field_id'];
@@ -302,7 +305,7 @@ public static function edit_option() {
wp_die();
}
- public static function delete_option(){
+ public static function delete_option() {
check_ajax_referer( 'frm_ajax', 'nonce' );
$field = FrmField::getOne( (int) $_POST['field_id'] );
@@ -388,7 +391,7 @@ public static function import_choices() {
wp_die();
}
- public static function import_options(){
+ public static function import_options() {
check_ajax_referer( 'frm_ajax', 'nonce' );
if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) {
@@ -449,7 +452,7 @@ public static function import_options(){
wp_die();
}
- public static function update_order(){
+ public static function update_order() {
check_ajax_referer( 'frm_ajax', 'nonce' );
if ( isset($_POST) && isset($_POST['frm_field_id']) ) {
foreach ( $_POST['frm_field_id'] as $position => $item ) {
@@ -459,7 +462,7 @@ public static function update_order(){
wp_die();
}
- public static function change_type($type){
+ public static function change_type($type) {
$type_switch = array(
'scale' => 'radio',
'10radio' => 'radio',
@@ -479,8 +482,8 @@ public static function change_type($type){
return $type;
}
- public static function display_field_options($display){
- switch($display['type']){
+ public static function display_field_options($display) {
+ switch($display['type']) {
case 'captcha':
$display['required'] = false;
$display['invalid'] = true;
@@ -673,7 +676,7 @@ public static function check_value( $opt, $opt_key, $field ) {
return $opt;
}
- public static function check_label($opt){
+ public static function check_label($opt) {
if ( is_array($opt) ) {
$opt = (isset($opt['label']) ? $opt['label'] : reset($opt));
}
diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php
index 2df7c2df59..9fc22f7666 100644
--- a/classes/controllers/FrmFormsController.php
+++ b/classes/controllers/FrmFormsController.php
@@ -1,6 +1,6 @@
1), 'name');
require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new-selection.php');
}
@@ -103,7 +103,7 @@ public static function create( $values = false ) {
$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
- }else{
+ } else {
FrmForm::update( $id, $values, true );
die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
}
@@ -125,7 +125,7 @@ public static function settings( $id = false, $message = '' ) {
return self::get_settings_vars($id, '', $message);
}
- public static function update_settings(){
+ public static function update_settings() {
FrmAppHelper::permission_check('frm_edit_forms');
$id = FrmAppHelper::get_param('id');
@@ -143,7 +143,7 @@ public static function update_settings(){
return self::get_settings_vars($id, '', $message);
}
- public static function edit_key(){
+ public static function edit_key() {
check_ajax_referer( 'frm_ajax', 'nonce' );
FrmAppHelper::permission_check('frm_edit_forms', 'hide');
@@ -156,7 +156,7 @@ public static function edit_key(){
wp_die();
}
- public static function edit_description(){
+ public static function edit_description() {
check_ajax_referer( 'frm_ajax', 'nonce' );
FrmAppHelper::permission_check('frm_edit_forms', 'hide');
@@ -208,7 +208,7 @@ public static function bulk_create_template($ids) {
return __( 'Form template was Successfully Created', 'formidable' );
}
- public static function duplicate(){
+ public static function duplicate() {
FrmAppHelper::permission_check('frm_edit_forms');
$params = FrmFormsHelper::get_params();
@@ -221,7 +221,7 @@ public static function duplicate(){
}
}
- public static function page_preview(){
+ public static function page_preview() {
$params = FrmFormsHelper::get_params();
if ( ! $params['form'] ) {
return;
@@ -234,7 +234,7 @@ public static function page_preview(){
return self::show_form($form->id, '', true, true);
}
- public static function preview(){
+ public static function preview() {
do_action('frm_wp');
global $frm_vars;
@@ -377,7 +377,7 @@ public static function scheduled_delete($delete_timestamp = '') {
return $count;
}
- public static function insert_form_button($content){
+ public static function insert_form_button($content) {
if ( current_user_can('frm_view_forms') ) {
$content .= ' Formidable';
@@ -385,7 +385,7 @@ public static function insert_form_button($content){
return $content;
}
- public static function insert_form_popup(){
+ public static function insert_form_popup() {
$page = basename($_SERVER['PHP_SELF']);
if ( ! in_array($page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php') ) ) {
return;
@@ -494,7 +494,7 @@ public static function get_sortable_columns() {
);
}
- public static function hidden_columns($result){
+ public static function hidden_columns($result) {
$return = false;
foreach ( (array) $result as $r ) {
if ( ! empty( $r ) ) {
@@ -518,7 +518,7 @@ public static function hidden_columns($result){
return $result;
}
- public static function save_per_page($save, $option, $value){
+ public static function save_per_page($save, $option, $value) {
if ( $option == 'formidable_page_formidable_per_page' ) {
$save = (int) $value;
}
@@ -620,7 +620,7 @@ public static function form_classes($form) {
}
}
- public static function get_email_html(){
+ public static function get_email_html() {
check_ajax_referer( 'frm_ajax', 'nonce' );
echo FrmEntriesController::show_entry_shortcode( array(
'form_id' => $_POST['form_id'],
@@ -717,7 +717,7 @@ public static function add_default_templates( $path, $default = true, $template
$path = untrailingslashit(trim($path));
$templates = glob( $path .'/*.php' );
- for($i = count($templates) - 1; $i >= 0; $i--){
+ for($i = count($templates) - 1; $i >= 0; $i--) {
$filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
$template_query = array( 'form_key' => $filename);
if ( $template ) {
@@ -753,7 +753,7 @@ public static function add_default_templates( $path, $default = true, $template
}
}
- public static function route(){
+ public static function route() {
$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
$vars = array();
if ( isset( $_POST['frm_compact_fields'] ) ) {
@@ -775,7 +775,7 @@ public static function route(){
$vars = FrmAppHelper::json_to_array($json_vars);
$action = $vars[ $action ];
}
- }else{
+ } else {
$action = FrmAppHelper::get_param($action);
if ( isset( $_REQUEST['delete_all'] ) ) {
// override the action for this page
@@ -1022,7 +1022,7 @@ public static function get_form_contents($form, $title, $description, $atts) {
return;
}
- if ( $created && is_numeric($created) ){
+ if ( $created && is_numeric($created) ) {
$message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
$class = 'frm_message';
} else {
diff --git a/classes/controllers/FrmHooksController.php b/classes/controllers/FrmHooksController.php
index 6b39f3dd1b..28c9f96954 100644
--- a/classes/controllers/FrmHooksController.php
+++ b/classes/controllers/FrmHooksController.php
@@ -1,6 +1,6 @@
store();
$message = __( 'Settings Saved', 'formidable' );
}
- }else{
+ } else {
$message = __( 'Settings Saved', 'formidable' );
}
diff --git a/classes/controllers/FrmStatisticsController.php b/classes/controllers/FrmStatisticsController.php
index 5532a1d0f2..d082af99a9 100644
--- a/classes/controllers/FrmStatisticsController.php
+++ b/classes/controllers/FrmStatisticsController.php
@@ -1,18 +1,18 @@
'. __( 'Views', 'formidable' ) .'', 'administrator', 'formidable-entry-templates', 'FrmStatisticsController::list_displays' );
}
- public static function list_reports(){
+ public static function list_reports() {
add_filter('frm_form_stop_action_reports', '__return_true');
$form = FrmAppHelper::get_param('form', false);
require(FrmAppHelper::plugin_path() .'/classes/views/frm-statistics/list.php');
}
- public static function list_displays(){
+ public static function list_displays() {
$form = FrmAppHelper::get_param('form', false);
require(FrmAppHelper::plugin_path() .'/classes/views/frm-statistics/list_displays.php');
}
diff --git a/classes/controllers/FrmStylesController.php b/classes/controllers/FrmStylesController.php
index cace6b87b2..7c97fd760d 100644
--- a/classes/controllers/FrmStylesController.php
+++ b/classes/controllers/FrmStylesController.php
@@ -1,6 +1,6 @@
1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] );
} else {
$where[ $table . '.status !' ] = 'draft';
diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php
index c665e6b76e..2195ff76cc 100644
--- a/classes/helpers/FrmAppHelper.php
+++ b/classes/helpers/FrmAppHelper.php
@@ -3,7 +3,7 @@
die( 'You are not allowed to call this page directly.' );
}
-class FrmAppHelper{
+class FrmAppHelper {
public static $db_version = 19; //version of the database we are moving to
public static $pro_db_version = 27;
@@ -16,7 +16,7 @@ class FrmAppHelper{
* @since 1.07.02
*
* @param none
- * @return float The version of this plugin
+ * @return string The version of this plugin
*/
public static function plugin_version() {
return self::$plug_version;
@@ -26,7 +26,7 @@ public static function plugin_folder() {
return basename(self::plugin_path());
}
- public static function plugin_path(){
+ public static function plugin_path() {
return dirname(dirname(dirname(__FILE__)));
}
@@ -46,7 +46,7 @@ public static function plugin_url( $url = '' ) {
/**
* @return string Site URL
*/
- public static function site_url(){
+ public static function site_url() {
$url = self::plugin_url(site_url());
return $url;
}
@@ -68,7 +68,7 @@ public static function site_name() {
* @since 2.0
*
* @param None
- * @return Object $frm_setings
+ * @return FrmSettings $frm_setings
*/
public static function get_settings() {
global $frm_settings;
@@ -83,7 +83,7 @@ public static function get_settings() {
*
* @since 2.0
*/
- public static function update_message($features, $class = ''){
+ public static function update_message($features, $class = '') {
if ( ! self::pro_is_installed() ) {
include(self::plugin_path() .'/classes/views/shared/update_message.php');
}
@@ -162,6 +162,7 @@ public static function is_empty_value( $value, $empty = '' ) {
* Get any value from the $_SERVER
*
* @since 2.0
+ * @param string $value
* @return string
*/
public static function get_server_value($value) {
@@ -174,7 +175,7 @@ public static function get_server_value($value) {
*
* @return string The IP address of the current user
*/
- public static function get_ip_address(){
+ public static function get_ip_address() {
foreach ( array(
'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
@@ -399,21 +400,21 @@ public static function widget_text_filter_callback( $matches ) {
return do_shortcode( $matches[0] );
}
- public static function load_scripts($scripts){
+ public static function load_scripts($scripts) {
_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
foreach ( (array) $scripts as $s ) {
wp_enqueue_script($s);
}
}
- public static function load_styles($styles){
+ public static function load_styles($styles) {
_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
foreach ( (array) $styles as $s ) {
wp_enqueue_style($s);
}
}
- public static function get_pages(){
+ public static function get_pages() {
return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => 999, 'orderby' => 'title', 'order' => 'ASC' ) );
}
@@ -490,7 +491,7 @@ public static function frm_capabilities($type = 'auto') {
return $cap;
}
- public static function user_has_permission($needed_role){
+ public static function user_has_permission($needed_role) {
if ( $needed_role == '-1' ) {
return false;
}
@@ -550,6 +551,7 @@ public static function permission_check($permission, $show_message = 'show') {
/**
* Check user permission and nonce
* @since 2.0
+ * @param string $permission
* @return false|string The permission message or false if allowed
*/
public static function permission_nonce_error($permission, $nonce_name = '', $nonce = '') {
@@ -576,7 +578,7 @@ public static function checked( $values, $current ) {
}
}
- public static function check_selected($values, $current){
+ public static function check_selected($values, $current) {
self::recursive_trim($values);
$current = trim($current);
@@ -680,7 +682,7 @@ public static function get_other_val( $opt_key, $field, $parent = false, $pointe
* @param array $args should include opt_key and field name
* @return string $other_val
*/
- public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ){
+ public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
//Check if this is an "Other" option
if ( !self::is_other_opt( $args['opt_key'] ) ) {
return;
@@ -735,7 +737,7 @@ public static function recursive_trim(&$value) {
public static function array_flatten( $array ) {
$return = array();
foreach ( $array as $key => $value ) {
- if ( is_array($value) ){
+ if ( is_array($value) ) {
$return = array_merge( $return, self::array_flatten($value) );
} else {
$return[ $key ] = $value;
@@ -761,7 +763,7 @@ public static function use_wpautop($content) {
return $content;
}
- public static function replace_quotes($val){
+ public static function replace_quotes($val) {
//Replace double quotes
$val = str_replace( array( '“', '”', '″'), '"', $val);
//Replace single quotes
@@ -802,11 +804,11 @@ public static function script_version($handle) {
return $ver;
}
- public static function js_redirect($url){
+ public static function js_redirect($url) {
return '';
}
- public static function get_user_id_param($user_id){
+ public static function get_user_id_param($user_id) {
if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
return $user_id;
}
@@ -998,6 +1000,9 @@ private static function fill_field_opts($field, array &$field_array, $args) {
$field_array['size'] = self::get_field_size($field_array);
}
+ /**
+ * @param string $table
+ */
private static function fill_form_opts($record, $table, $post_values, array &$values) {
if ( $table == 'entries' ) {
$form = $record->form_id;
@@ -1108,17 +1113,17 @@ public static function insert_opt_html($args) {
esc_like( $term );
} else {
$term = like_escape( $term );
@@ -1356,6 +1365,10 @@ public static function prepend_and_or_where( $starts_with = ' WHERE ', $where =
}
// Pagination Methods
+
+ /**
+ * @param integer $current_p
+ */
public static function get_last_record_num( $r_count, $current_p, $p_size ) {
return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
}
@@ -1366,7 +1379,7 @@ public static function get_last_record_num( $r_count, $current_p, $p_size ) {
public static function get_first_record_num( $r_count, $current_p, $p_size ) {
if ( $current_p == 1 ) {
return 1;
- } else{
+ } else {
return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
}
}
@@ -1403,6 +1416,9 @@ public static function get_referer_info(){
return self::get_server_value('HTTP_REFERER');
}
+ /**
+ * @return boolean
+ */
public static function json_to_array($json_vars){
$vars = array();
foreach ( $json_vars as $jv ) {
@@ -1455,6 +1471,10 @@ public static function json_to_array($json_vars){
return $vars;
}
+ /**
+ * @param string $name
+ * @param string $l1
+ */
public static function add_value_to_array( $name, $l1, $val, &$vars ) {
if ( $name == '' ) {
$vars[] = $val;
@@ -1525,17 +1545,19 @@ public static function prepare_and_encode( $post_content ) {
return $post_content;
}
- public static function maybe_json_decode($string){
+ public static function maybe_json_decode($string) {
if ( is_array($string) ) {
return $string;
}
$new_string = json_decode($string, true);
- if ( function_exists('json_last_error') ) { // php 5.3+
+ if ( function_exists('json_last_error') ) {
+// php 5.3+
if ( json_last_error() == JSON_ERROR_NONE ) {
$string = $new_string;
}
- } else if ( isset($new_string) ) { // php < 5.3 fallback
+ } else if ( isset($new_string) ) {
+// php < 5.3 fallback
$string = $new_string;
}
return $string;
diff --git a/classes/helpers/FrmEntriesHelper.php b/classes/helpers/FrmEntriesHelper.php
index a4bc3a4fb6..18e38d88f6 100644
--- a/classes/helpers/FrmEntriesHelper.php
+++ b/classes/helpers/FrmEntriesHelper.php
@@ -3,7 +3,7 @@
die( 'You are not allowed to call this page directly.' );
}
-class FrmEntriesHelper{
+class FrmEntriesHelper {
public static function setup_new_vars( $fields, $form = '', $reset = false ) {
global $frm_vars;
@@ -112,7 +112,7 @@ public static function setup_new_vars( $fields, $form = '', $reset = false ) {
return apply_filters('frm_setup_new_entry', $values);
}
- public static function setup_edit_vars($values, $record){
+ public static function setup_edit_vars($values, $record) {
//$values['description'] = maybe_unserialize( $record->description );
$values['item_key'] = isset($_POST['item_key']) ? $_POST['item_key'] : $record->item_key;
$values['form_id'] = $record->form_id;
@@ -120,7 +120,7 @@ public static function setup_edit_vars($values, $record){
return apply_filters('frm_setup_edit_entry_vars', $values, $record);
}
- public static function get_admin_params($form=null){
+ public static function get_admin_params($form=null) {
$form_id = $form;
if ( $form === null ) {
$form_id = self::get_current_form_id();
@@ -140,7 +140,7 @@ public static function get_admin_params($form=null){
return $values;
}
- public static function set_current_form($form_id){
+ public static function set_current_form($form_id) {
global $frm_vars, $wpdb;
$query = array( 'is_template' => 0, 'status' => array( null, '', 'published' ) );
@@ -165,7 +165,7 @@ public static function get_current_form($form_id = 0) {
return self::set_current_form($form_id);
}
- public static function get_current_form_id(){
+ public static function get_current_form_id() {
$form = self::get_current_form();
$form_id = $form ? $form->id : 0;
@@ -385,7 +385,7 @@ public static function replace_default_message($message, $atts) {
foreach ( $shortcodes[0] as $short_key => $tag ) {
$add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
- if ( $add_atts ){
+ if ( $add_atts ) {
$this_atts = array_merge($atts, $add_atts);
} else {
$this_atts = $atts;
@@ -494,7 +494,8 @@ public static function display_value($value, $field, $atts = array()) {
if ( is_array($value) && $atts['type'] != 'file' ) {
foreach ( $value as $val ) {
- if ( is_array($val) ) { //TODO: add options for display (li or ,)
+ if ( is_array($val) ) {
+//TODO: add options for display (li or ,)
$new_value .= implode($atts['sep'], $val);
if ( $atts['type'] != 'data' ) {
$new_value .= '
';
@@ -582,7 +583,7 @@ public static function maybe_set_other_validation( $field, &$value, &$args ) {
* @param string|array $value
* @param array $args
*/
- public static function set_other_repeating_vals( $field, &$value, &$args ){
+ public static function set_other_repeating_vals( $field, &$value, &$args ) {
if ( ! $args['parent_field_id'] ) {
return;
}
@@ -649,7 +650,7 @@ public static function entries_dropdown() {
_deprecated_function( __FUNCTION__, '1.07.09');
}
- public static function enqueue_scripts($params){
+ public static function enqueue_scripts($params) {
do_action('frm_enqueue_form_scripts', $params);
}
diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php
index 4b46463387..6ae6eadb03 100644
--- a/classes/helpers/FrmFieldsHelper.php
+++ b/classes/helpers/FrmFieldsHelper.php
@@ -3,9 +3,9 @@
die( 'You are not allowed to call this page directly.' );
}
-class FrmFieldsHelper{
+class FrmFieldsHelper {
- public static function field_selection(){
+ public static function field_selection() {
$fields = apply_filters('frm_available_fields', array(
'text' => __( 'Single Line Text', 'formidable' ),
'textarea' => __( 'Paragraph Text', 'formidable' ),
@@ -20,7 +20,7 @@ public static function field_selection(){
return $fields;
}
- public static function pro_field_selection(){
+ public static function pro_field_selection() {
return apply_filters('frm_pro_available_fields', array(
'end_divider' => array(
'name' => __( 'End Section', 'formidable' ),
@@ -147,7 +147,7 @@ public static function setup_new_vars($type = '', $form_id = '') {
if ( isset( $setting ) && ! empty( $setting ) ) {
if ( 'data' == $type ) {
$values['field_options']['data_type'] = $setting;
- }else{
+ } else {
$values['field_options'][ $setting ] = 1;
}
}
@@ -204,7 +204,7 @@ public static function setup_edit_vars( $record, $doing_ajax = false ) {
unset($var, $default);
}
- foreach ( array( 'field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default){
+ foreach ( array( 'field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default) {
$values[ $var ] = FrmAppHelper::get_param( $var, $default );
unset($var, $default);
}
@@ -281,7 +281,7 @@ public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
/**
* @since 2.0
*/
- public static function get_error_msg($field, $error){
+ public static function get_error_msg($field, $error) {
$frm_settings = FrmAppHelper::get_settings();
$default_settings = $frm_settings->default_options();
@@ -300,8 +300,8 @@ public static function get_form_fields( $form_id, $error = false ) {
return $fields;
}
- public static function get_default_html($type='text'){
- if (apply_filters('frm_normal_field_type_html', true, $type)){
+ public static function get_default_html($type='text') {
+ if (apply_filters('frm_normal_field_type_html', true, $type)) {
$input = (in_array($type, array( 'radio', 'checkbox', 'data'))) ? '