示例#1
0
 function refresh_columns()
 {
     $WJ_Field = new WJ_Field();
     $custom_fields = $WJ_Field->get_all();
     if (!empty($custom_fields)) {
         foreach ($custom_fields as $row) {
             $this->columns['cf_' . $row->id] = array();
         }
     }
 }
示例#2
0
 function getFields()
 {
     $fields = array();
     // add custom fields
     $WJ_Field = new WJ_Field();
     $custom_fields = $WJ_Field->get_all();
     if (!empty($custom_fields)) {
         foreach ($custom_fields as $row) {
             $fields['cf_' . $row->id] = $row->name;
         }
     }
     return array_merge($this->defaults, $fields);
 }
示例#3
0
    function importmatch($data)
    {
        ?>
	<form class="form-valid" action="admin.php?page=wysija_subscribers&action=lists" id="wysija-edit" method="post"  name="wysija-edit">
	    <div class="list" style="overflow:auto">
		<table cellspacing="0" class="widefat fixed" >
		    <thead>
			<tr class="thead">
			    <th id="first-row"><?php 
        _e('Match data', WYSIJA);
        ?>
</th>
			    <?php 
        $columns = array('nomatch' => __('Ignore column...', WYSIJA), 'email' => __('Email', WYSIJA), 'firstname' => __('First name', WYSIJA), 'lastname' => __('Last name', WYSIJA), 'ip' => __('IP address', WYSIJA), 'status' => __('Status', WYSIJA));
        $WJ_Field = new WJ_Field();
        $custom_fields = $WJ_Field->get_all();
        $extended_columns = array();
        if (!empty($custom_fields)) {
            foreach ($custom_fields as $row) {
                $extended_columns['cf_' . $row->id] = $row->name;
            }
        }
        $helper_form = WYSIJA::get('forms', 'helper');
        $i = 0;
        $email_column_matched = false;
        $this->new_column_can_be_imported = array();
        $data['csv'][0] = array_map('trim', $data['csv'][0]);
        foreach ($data['csv'][0] as $column_key => $column_name) {
            $selected = '';
            $columns_array = $columns;
            // we make a key out of the column name
            $column_name_key = str_replace(array(' ', '-', '_'), '', strtolower($column_name));
            // we try to automatically match columns with previous matches recorded in the past
            $import_fields = get_option('wysija_import_fields');
            if (isset($import_fields[$column_name_key]) && substr($import_fields[$column_name_key], 0, 10) != 'new_field|') {
                $selected = $import_fields[$column_name_key];
            } else {
                // we're making the matches dropdown with an extra value 'Import as "name of the column"'
                // since we didn't detect it in the previously matched columns
                $columns_array = array();
                foreach ($columns as $col_key => $col_val) {
                    // we need to put that extra value right after the ignore column value
                    if (count($columns_array) === 1) {
                        $column_name = preg_replace('|[^a-z0-9#_.-]|i', '', $column_name);
                        $columns_array['new_field|input|' . $column_name] = sprintf(__('Import as "%1$s"', WYSIJA), $column_name);
                        $columns_array['new_field|date|' . $column_name] = sprintf(__('Import "%1$s" as date field', WYSIJA), $column_name);
                        $this->new_column_can_be_imported[$column_key] = true;
                    } else {
                        $columns_array[$col_key] = $col_val;
                    }
                }
            }
            // if it is an email column we set it by default as email
            if (!$email_column_matched && isset($data['keyemail'][$column_key])) {
                $selected = 'email';
                $email_column_matched = true;
                $columns_array = $columns;
            }
            $columns_array = array_map('trim', array_merge($columns_array, $extended_columns));
            // we're building one dropdown per column
            $dropdown = '<div class="match-dropdown">' . $helper_form->dropdown(array('id' => 'column-match-' . $i, 'name' => 'wysija[match][' . $i . ']', 'class' => 'create_extra row-' . $column_key), $columns_array, $selected) . '</div>';
            /**
             * We need to improve the import, fields come back to options for columns later on.
            if (isset($this->new_column_can_be_imported[$column_key])) {
            	$dropdown .= '<div class="import-new-field" id="column-match-date-wrap-'.$i.'"><input id="column-match-date-'.$i.'"  type="checkbox" name="wysija[ignore_invalid_date]['.$i.']"\><label for="column-match-date-'.$i.'">' . __('Ignore invalid dates', WYSIJA) . '</label></div>';
            }
            */
            echo '<th>' . $dropdown . '</th>';
            $i++;
        }
        ?>
			</tr>
		    </thead>

		    <tbody class="list:<?php 
        echo $this->model->table_name . ' ' . $this->model->table_name . '-list" id="wysija-' . $this->model->table_name . '"';
        ?>
>

	    <?php 
        $listingRows = '';
        $alt = true;
        $i = 0;
        foreach ($data['csv'] as $columns) {
            $classRow = '';
            if ($alt) {
                $classRow = ' class="alternate" ';
            }
            echo "<tr {$classRow}>";
            if (isset($data['firstrowisdata'])) {
                $j = $i + 1;
            } else {
                $j = $i;
            }
            if ($i == 0) {
                $valuefrow = '';
                if (isset($data['firstrowisdata'])) {
                    $valuefrow = '1<input value="1" type="hidden" id="firstrowdata" name="firstrowisdata"  />';
                }
                echo '<td>' . $valuefrow . '</td>';
                //echo '<td><label for="firstrowdata" class="title" title="'.__("This line is not a header description, it is data and needs to be inserted!",WYSIJA).'"><input '.$checked.' type="checkbox" id="firstrowdata" name="firstrowisdata"  />'.__("Insert line!",WYSIJA).'</label></td>';
            } else {
                echo '<td>' . $j . '</td>';
            }
            foreach ($columns as $key_col => $val) {
                $val = esc_html($val);
                if ($i == 0 && !isset($data['firstrowisdata'])) {
                    echo '<td><strong>' . $val . '</strong></td>';
                } else {
                    if (!empty($this->new_column_can_be_imported[$key_col])) {
                        $timestamp = strtotime($val);
                        if ($timestamp > 0) {
                            $val_converted = '<span class="converted-field-to-date row-' . $key_col . '" title="' . __('Verify that the date in blue matches the original one.', WYSIJA) . '">' . date(get_option('date_format') . ' ' . get_option('time_format'), $timestamp) . '</span>';
                        } else {
                            $val_converted = '<span class="converted-field-error row-' . $key_col . '" title="' . __('Do not match as a \'date field\' if most of the rows for that column return the same error.', WYSIJA) . '">' . __('Error matching date.', WYSIJA) . '</span>';
                        }
                        $val = ' <span class="imported-field">' . $val . '</span>' . $val_converted;
                    }
                    echo '<td>' . $val . '</td>';
                }
            }
            echo '</tr>';
            $alt = !$alt;
            $i++;
        }
        if ($data['totalrows'] > 3) {
            ?>

	    		   <tr class="alternate" >
		<?php 
            echo '<td>...</td>';
            foreach ($data['csv'][0] as $col) {
                echo '<td>...</td>';
            }
            ?>
	    		   </tr>
	    		<tr><td><?php 
            echo $data['totalrows'];
            ?>
</td>
	    <?php 
            foreach ($data['lastrow'] as $key_col => $val) {
                $val = esc_html($val);
                if (!empty($this->new_column_can_be_imported[$key_col])) {
                    $timestamp = strtotime($val);
                    if ($timestamp > 0) {
                        $val_converted = '<span class="converted-field-to-date row-' . $key_col . '" title="' . __('Verify that the date in blue matches the original one.', WYSIJA) . '">' . date(get_option('date_format') . ' ' . get_option('time_format'), $timestamp) . '</span>';
                    } else {
                        $val_converted = '<span class="converted-field-error row-' . $key_col . '" title="' . __('Do not match as a \'date field\' if most of the rows for that column return the same error.', WYSIJA) . '">' . __('Error matching date.', WYSIJA) . '</span>';
                    }
                    $val = ' <span class="imported-field">' . $val . '</span>' . $val_converted;
                }
                echo '<td>' . $val . '</td>';
            }
            ?>
	    		</tr>
		<?php 
        }
        ?>
		    </tbody>
		</table>
	    </div>
	<?php 
        if ($data['errormatch']) {
        } else {
            ?>
	        <table class="form-table">
	    	<tbody>
	    	    <tr>
	    		<th scope="row">
	    		    <label for="name"><?php 
            _e('Pick one or many lists', WYSIJA);
            ?>
 </label>
	    	<p class="description"><?php 
            _e('Pick the lists you want to import those subscribers to.', WYSIJA);
            ?>
 </p>
	    	</th>
	    	<td>
	    <?php 
            //create an array of existing lists to import within
            $model_list = WYSIJA::get('list', 'model');
            $lists = $model_list->get(array('name', 'list_id'), array('is_enabled' => 1));
            //first value is to create new list
            $lists[] = array('name' => __('New list', WYSIJA), 'list_id' => 0);
            //create an array of active(status 99) follow_up emails aossicated to a list_id
            $helper_email = WYSIJA::get('email', 'helper');
            $follow_ups_per_list = $helper_email->get_active_follow_ups(array('subject', 'params'));
            $follow_up_name_per_list = array();
            foreach ($follow_ups_per_list as $list_id => $follow_ups) {
                if (!isset($follow_up_name_per_list[$list_id])) {
                    $follow_up_name_per_list[$list_id] = array();
                }
                foreach ($follow_ups as $follow_up) {
                    $follow_up_name_per_list[$list_id][] = $follow_up['subject'];
                }
            }
            $helper_form = WYSIJA::get('forms', 'helper');
            //field name for processing
            $field = 'list';
            $fieldHTML = '<div>';
            foreach ($lists as $list) {
                if ($list['list_id'] == 0) {
                    $fieldHTML .= '<p><label for="' . $field . $list['list_id'] . '">';
                    $fieldHTML .= $helper_form->checkbox(array('class' => 'validate[minCheckbox[1]] checkbox', 'id' => $field . $list['list_id'], 'name' => "wysija[user_list][{$field}][]"), $list['list_id']) . '<span>' . $list['name'] . '</span>';
                    $fieldHTML .= '</label> ';
                    $fieldHTML .= '<span id="blocknewlist">' . $helper_form->input(array('class' => 'validate[required]', 'id' => 'namenewlist', 'size' => 30, 'name' => 'wysija[list][newlistname]', 'value' => __('Type name of your new list', WYSIJA))) . '</span></p>';
                } else {
                    $fieldHTML .= '<p><label for="' . $field . $list['list_id'] . '">' . $helper_form->checkbox(array('class' => 'validate[minCheckbox[1]] checkbox', 'id' => $field . $list['list_id'], 'name' => "wysija[user_list][{$field}][]"), $list['list_id']) . $list['name'];
                    if (isset($follow_up_name_per_list[$list['list_id']])) {
                        $fieldHTML .= ' <span style="margin-left:10px;"><strong>' . __('Note:', WYSIJA) . ' </strong>' . sprintf(__('subscribers will receive "%1$s" after import.', WYSIJA), implode(', ', $follow_up_name_per_list[$list['list_id']])) . '</span>';
                    }
                    $fieldHTML .= '</label></p>';
                }
            }
            $fieldHTML .= '</div>';
            echo $fieldHTML;
            ?>
	    	</td>
	    	</tr>
	    	</tbody>
	        </table>
	        <p class="submit">
	    <?php 
            $this->secure(array('action' => 'import_save'));
            ?>
	    	<input type="hidden" value="<?php 
            echo esc_attr($data['dataImport']);
            ?>
" name="wysija[dataImport]" />

	    	<input type="hidden" value="import_save" name="action" />
	    	<input type="submit" value="<?php 
            echo esc_attr(__('Import', WYSIJA));
            ?>
" class="button-primary wysija">
	        </p>
	    <?php 
        }
        ?>
	</form>
	<?php 
    }
示例#4
0
 public static function get_all($user_id)
 {
     $fields = WJ_Field::get_all();
     if (isset($fields) && !empty($fields)) {
         $collection = array();
         foreach ($fields as $field) {
             $user_field = new self();
             $user_field->user_id = $user_id;
             $user_field->field = $field;
             $collection[] = $user_field;
         }
         return $collection;
     } else {
         return null;
     }
 }
示例#5
0
 /**
  * match columns together with the csv data based on the data passed
  */
 private function _match_columns_to_insert()
 {
     // we're going through all of the selected value in each dropdown when importing
     foreach ($this->_match as $csv_column_number => $column_in_user_table) {
         // Reduce matching twice the same column
         if ($this->_is_column_matched($column_in_user_table)) {
             continue;
         }
         // Ignore `nomatch` columns
         if ($column_in_user_table == 'nomatch') {
             continue;
         }
         // Check if maybe it's a new field
         preg_match($this->_regex_new_field, $column_in_user_table, $maybe_newfield);
         if (!empty($maybe_newfield) && in_array($maybe_newfield[1], array('date', 'input'))) {
             // TODO need to change to WJ_Field I guess when Marco is done moving the files
             // saving a new custom field
             $custom_field = new WJ_Field();
             $custom_field->set(array('name' => $maybe_newfield[2], 'type' => $maybe_newfield[1], 'required' => false, 'settings' => array('label' => $maybe_newfield[2], 'date_type' => 'year_month_day', 'is_default_today' => 0, 'date_order' => 'mm/dd/yyyy')));
             $custom_field->save();
             // this is the column name in the database so this is where we need to import that field
             $column_in_user_table = $custom_field->user_column_name();
             $this->_match[$csv_column_number] = $column_in_user_table;
         }
         // keep the match of CSV column number to column key in our database
         // not sure why do we trim the column key ...
         $this->_data_to_insert[$csv_column_number] = trim($column_in_user_table);
         // this column is the email column, let's keep track of it for later validation etc..
         if ($column_in_user_table == 'email') {
             $this->_email_key = $csv_column_number;
         }
     }
     $this->_set_custom_fields();
     // if the status column is not matched, we make sure that we have an entry for the status column so that we default it to some value on import
     if (!in_array('status', $this->_data_to_insert)) {
         $this->_data_to_insert['status'] = 'status';
     }
 }
示例#6
0
 function getTranslations()
 {
     return array('dropHeaderNotice' => __('Drop your logo in this header.', WYSIJA), 'dropFooterNotice' => __('Drop your footer image here.', WYSIJA), 'dropBannerNotice' => __('If you leave this area empty, it will not display once you send your email', WYSIJA), 'clickToEditText' => __('Click here to add a title or text.', WYSIJA), 'alignmentLeft' => __('Align left', WYSIJA), 'alignmentCenter' => __('Align center', WYSIJA), 'alignmentRight' => __('Align right', WYSIJA), 'addImageLink' => __('Add link / Alternative text', WYSIJA), 'removeImageLink' => __('Remove link', WYSIJA), 'removeImage' => __('Remove image', WYSIJA), 'remove' => __('Remove', WYSIJA), 'editText' => __('Edit text', WYSIJA), 'removeText' => __('Remove text', WYSIJA), 'textLabel' => __('Titles & text', WYSIJA), 'dividerLabel' => __('Horizontal line', WYSIJA), 'customDividerLabel' => __('Custom horizontal line', WYSIJA), 'postLabel' => __('WordPress post', WYSIJA), 'styleBodyLabel' => __('Text', WYSIJA), 'styleViewbrowserLabel' => __('"View in browser"', WYSIJA), 'styleH1Label' => __('Heading 1', WYSIJA), 'styleH2Label' => __('Heading 2', WYSIJA), 'styleH3Label' => __('Heading 3', WYSIJA), 'styleLinksLabel' => __('Links', WYSIJA), 'styleLinksDecorationLabel' => __('underline', WYSIJA), 'styleFooterLabel' => __('Footer text', WYSIJA), 'styleFooterBackgroundLabel' => __('Footer background', WYSIJA), 'styleBodyBackgroundLabel' => __('Newsletter', WYSIJA), 'styleHtmlBackgroundLabel' => __('Background', WYSIJA), 'styleHeaderBackgroundLabel' => __('Header background', WYSIJA), 'styleDividerLabel' => __('Horizontal line', WYSIJA), 'styleUnsubscribeColorLabel' => __('Unsubscribe', WYSIJA), 'articleSelectionTitle' => __('Post Selection', WYSIJA), 'bookmarkSelectionTitle' => __('Social Bookmark Selection', WYSIJA), 'dividerSelectionTitle' => __('Divider Selection', WYSIJA), 'abouttodeletetheme' => __('You are about to delete the theme : %1$s. Do you really want to do that?', WYSIJA), 'addLinkTitle' => __('Add Link & Alternative text', WYSIJA), 'styleTransparent' => __('Check this box if you want transparency', WYSIJA), 'ajaxLoading' => __('Loading...', WYSIJA), 'customFieldsLabel' => __('Insert dynamic data about your subscribers, the newsletter, today\'s date, etc...', WYSIJA), 'autoPostSettingsTitle' => __('Selection options', WYSIJA), 'autoPostEditSettings' => __('Edit Automatic latest content', WYSIJA), 'autoPostImmediateNotice' => __('You can only add one widget when designing a post notification sent immediately after an article is published', WYSIJA), 'toggleImagesTitle' => __('Preview without images', WYSIJA), 'tags_user' => __('Subscriber', WYSIJA), 'tags_user_firstname' => __('First Name', WYSIJA), 'tags_user_lastname' => __('Last Name', WYSIJA), 'tags_user_email' => __('Email Address', WYSIJA), 'tags_user_displayname' => __('WordPress user display name', WYSIJA), 'tags_user_count' => __('Total of subscribers', WYSIJA), 'tags_newsletter' => __('Newsletter', WYSIJA), 'tags_newsletter_subject' => __('Newsletter Subject', WYSIJA), 'tags_newsletter_autonl' => __('Post Notifications', WYSIJA), 'tags_newsletter_total' => __('Total number of posts or pages', WYSIJA), 'tags_newsletter_post_title' => __('Latest post title', WYSIJA), 'tags_newsletter_number' => __('Issue number', WYSIJA), 'tags_date' => __('Date', WYSIJA), 'tags_date_d' => __('Current day of the month number', WYSIJA), 'tags_date_dordinal' => __('Current day of the month in ordinal, ie. 2nd, 3rd, etc.', WYSIJA), 'tags_date_dtext' => __('Full name of current day', WYSIJA), 'tags_date_m' => __('Current month number', WYSIJA), 'tags_date_mtext' => __('Full name of current month', WYSIJA), 'tags_date_y' => __('Year', WYSIJA), 'tags_global' => __('Links', WYSIJA), 'tags_global_unsubscribe' => __('Unsubscribe link', WYSIJA), 'tags_global_manage' => __('Edit subscription page link', WYSIJA), 'tags_global_browser' => __('View in browser link', WYSIJA), 'custom_fields_title' => __('Custom Fields', WYSIJA), 'custom_fields_list' => WJ_Field::get_all_names(), 'theme_setting_default' => __('Saving default style...', WYSIJA), 'theme_saved_default' => __('Default style saved.', WYSIJA), 'theme_save_as_default' => __('Set as default style.', WYSIJA), 'drop_block_here' => __('Insert block here', WYSIJA));
 }
示例#7
0
 function form_field_delete()
 {
     $data = $this->_wysija_form_get_data();
     // check for field_id parameter
     if (isset($data['field_id']) && (int) $data['field_id'] > 0) {
         // get custom field by id
         $custom_field = WJ_Field::get($data['field_id']);
         // if the custom field exists
         if ($custom_field !== null) {
             // we need to remove the field in any form
             // get all forms
             $model_forms = WYSIJA::get('forms', 'model');
             $forms = $model_forms->getRows();
             // get custom field name
             $field_name = $custom_field->user_column_name();
             if (is_array($forms) && count($forms) > 0) {
                 // loop through each form
                 foreach ($forms as $i => $form) {
                     $requires_update = false;
                     // decode form data
                     $data = unserialize(base64_decode($form['data']));
                     // loop through each block
                     foreach ($data['body'] as $j => $block) {
                         // in case we find a text block
                         if ($block['field'] === $field_name) {
                             unset($data['body'][$j]);
                             // flag form to be updated
                             $requires_update = true;
                         }
                     }
                     // if the form requires update, let's do it
                     if ($requires_update === true) {
                         $model_forms->reset();
                         $model_forms->update(array('data' => base64_encode(serialize($data))), array('form_id' => (int) $form['form_id']));
                     }
                 }
             }
             // delete custom field
             $custom_field->delete();
         }
     }
 }
示例#8
0
 function form_widget_settings()
 {
     $this->iframeTabs = array('form_widget_settings' => __('Widget Settings', WYSIJA));
     $this->js[] = 'wysija-admin-ajax';
     $this->js[] = 'wysija-base-script-64';
     $this->js[] = 'wysija-scriptaculous';
     $_GET['tab'] = 'form_widget_settings';
     // if there is a field id, let's get all that from this field
     if (isset($_REQUEST['field_id'])) {
         $field_id = (int) $_REQUEST['field_id'] > 0 ? (int) $_REQUEST['field_id'] : 0;
         // if the id is positive then try to fetch field data
         $custom_field = WJ_Field::get($field_id);
         // if field has been found
         if ($custom_field !== NULL) {
             $this->data['name'] = isset($_REQUEST['name']) ? $_REQUEST['name'] : $custom_field->name;
             $this->data['type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : $custom_field->type;
             $this->data['field'] = $custom_field->user_column_name();
             $this->data['params'] = $custom_field->settings;
         } else {
             $this->data['name'] = isset($_REQUEST['name']) ? $_REQUEST['name'] : null;
             $this->data['type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
             $this->data['field'] = null;
             $this->data['params'] = null;
         }
         $this->data['field_id'] = $field_id;
     } else {
         // extract parameters from url
         $params = array();
         if (isset($_REQUEST['params']) && trim(strlen($_REQUEST['params'])) > 0) {
             $pairs = explode('|', $_REQUEST['params']);
             if (count($pairs) > 0) {
                 foreach ($pairs as $pair) {
                     // extract both key and value
                     list($key, $value) = explode(':', $pair);
                     // decode value
                     $value = base64_decode($value);
                     // unserialize if necessary (using is_serialized from WordPress)
                     if (is_serialized($value) === true) {
                         $value = unserialize($value);
                     }
                     $params[$key] = $value;
                 }
             }
         }
         // common widget data
         $this->data['name'] = isset($_REQUEST['name']) ? $_REQUEST['name'] : null;
         $this->data['type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
         $this->data['field'] = isset($_REQUEST['field']) ? $_REQUEST['field'] : null;
         // widget params
         $this->data['params'] = $params;
         // extra data that needs to be fetched for some widget
         $extra = array();
         switch ($this->data['type']) {
             // in case of the list widget, we need to pass an array of all available lists
             case 'list':
                 $model_list = WYSIJA::get('list', 'model');
                 // get lists users can subscribe to (aka "enabled list")
                 $extra['lists'] = $model_list->get(array('name', 'list_id', 'is_public'), array('is_enabled' => 1));
                 break;
         }
         $this->data['extra'] = $extra;
     }
     return $this->popupContent();
     exit;
 }
示例#9
0
 public function get_custom_fields()
 {
     if ($this->_fields === null) {
         // get available custom fields
         $custom_fields = WJ_Field::get_all(array('order_by' => 'name ASC'));
         $user_fields = array();
         if (!empty($custom_fields)) {
             foreach ($custom_fields as $custom_field) {
                 $user_fields[] = array('field_id' => $custom_field->id, 'name' => $custom_field->name, 'column_name' => $custom_field->user_column_name(), 'column_type' => $custom_field->type, 'params' => $custom_field->settings);
             }
         }
         // we need to figure out the default list for the "List selection" widget
         $lists = $this->get_lists();
         // select default list
         $default_list = array();
         if (!empty($lists)) {
             $default_list[] = array('list_id' => $lists[0]['list_id'], 'is_checked' => 0);
         }
         // extra widgets that can be added more than once
         $extra_fields = array(array('name' => __('Divider', WYSIJA), 'column_name' => 'divider', 'column_type' => 'divider'), array('name' => __('First name', WYSIJA), 'column_name' => 'firstname', 'column_type' => 'input'), array('name' => __('Last name', WYSIJA), 'column_name' => 'lastname', 'column_type' => 'input'), array('name' => __('List selection', WYSIJA), 'column_name' => 'list', 'column_type' => 'list', 'params' => array('label' => __('Select list(s):', WYSIJA), 'values' => $default_list)), array('name' => __('Random text or HTML', WYSIJA), 'column_name' => 'html', 'column_type' => 'html', 'params' => array('text' => __('Subscribe to our newsletter and join our [total_subscribers] subscribers.', WYSIJA))));
         // set data to be passed to the view
         $this->_fields = array_merge($user_fields, $extra_fields);
     }
     return $this->_fields;
 }
示例#10
0
 private function custom_fields_radio()
 {
     global $wpdb;
     $field = new WJ_Field();
     $table_name = $field->get_table_name();
     $result = $wpdb->get_var("SELECT COUNT(*) as radios\r\n        FROM  {$table_name}\r\n        WHERE type = 'radio'");
     if ($result == null) {
         $result = '0';
     }
     return $result;
 }
示例#11
0
 /**
  * @see OptimizePress_Modules_Email_ProviderInterface::getListFields()
  */
 public function getListFields($listId)
 {
     $fields = array('firstname' => __('First Name', 'optimizepress'), 'lastname' => __('Last Name', 'optimizepress'));
     $customFields = WJ_Field::get_all(array('order_by' => 'name ASC'));
     if (!empty($customFields)) {
         foreach ($customFields as $customField) {
             $fields[$customField->user_column_name()] = $customField->name;
         }
     }
     $this->logger->info("Fields (MailPoet): " . print_r($fields, true));
     return $fields;
 }