'frm_affiliates_icon', 'limit' => 99, 'active' => true, 'priority' => 50, ); $this->FrmFormAction( 'affiliates', esc_html__( 'Affiliates', 'affiliates-formidable' ), $action_ops ); } /** * Get the HTML for the affiliates action settings * * @param Object $form_action * @param array $args */ public function form( $form_action, $args = array() ) { $form = isset( $args['form'] ) ? $args['form'] : null; $action_key = isset( $args['action_key'] ) ? $args['action_key'] : null; $values = isset( $args['values'] ) ? $args['values'] : null; if ( $form === null ) { return; } $action_control = $this; $form_id = $form->id; $enable = !empty( $form_action->post_content[self::ENABLE] ); $base_amount = !empty( $form_action->post_content[self::BASE_AMOUNT] ) ? trim( $form_action->post_content[self::BASE_AMOUNT] ) : ''; $currency = !empty( $form_action->post_content[self::CURRENCY] ) ? trim( $form_action->post_content[self::CURRENCY] ) : ''; $currency_id = isset( $form_action->post_content[self::CURRENCY_ID] ) ? $form_action->post_content[self::CURRENCY_ID] : ''; if ( !Affiliates_Formidable::using_rates() ) { $amount_value = isset( $form_action->post_content[self::AMOUNT] ) ? $form_action->post_content[self::AMOUNT] : ''; $rate_value = isset( $form_action->post_content[self::RATE] ) ? $form_action->post_content[self::RATE] : ''; } echo '
'; echo '
'; echo esc_html__( 'Referrals', 'affiliates-formidable' ); echo '
'; echo '

'; echo ''; echo '

'; $fields = FrmField::getAll( array( 'fi.form_id' => $form_id ), 'field_order' ); echo '

'; echo ''; echo '

'; echo '

'; echo ''; echo ' '; echo __( 'or', 'affiliates-formidable' ); echo ' '; echo ''; echo '

'; if ( Affiliates_Formidable::using_rates() ) { echo '
'; echo esc_html__( 'Rates', 'affiliates-formidable' ); echo '
'; $rates = Affiliates_Rate::get_rates( array( 'integration' => 'affiliates-formidable', 'object_id' => $form_id ) ); if ( count( $rates ) > 0 ) { echo '

'; echo esc_html( _n( 'This specific rate applies to this form', 'These specific rates apply to this form.', count( $rates ), 'affiliates-formidable' ) ); echo '

'; $odd = true; $is_first = true; echo ''; foreach ( $rates as $rate ) { if ( $is_first ) { echo wp_kses_post( $rate->view( array( 'style' => 'table', 'titles' => true, 'exclude' => 'integration', 'prefix_class' => 'odd' ) ) ); } else { echo wp_kses_post( $rate->view( array( 'style' => 'table', 'exclude' => 'integration', 'prefix_class' => $odd ? 'odd' : 'even' ) ) ); } $is_first = false; $odd = !$odd; } echo '
'; } else { echo '

'; echo esc_html( __( 'This form has no specific applicable rates.', 'affiliates-formidable' ) ); echo '

'; } if ( current_user_can( AFFILIATES_ADMINISTER_OPTIONS ) ) { echo '

'; $url = wp_nonce_url( add_query_arg( array( 'object_id' => $form_id, 'integration' => 'affiliates-formidable', 'action' => 'create-rate' ), admin_url( 'admin.php?page=affiliates-admin-rates' ) ) ); echo sprintf( '', esc_url( $url ) ); echo esc_html__( 'Create a rate', 'affiliates-formidable' ); echo ''; echo '

'; } } else { echo '

'; echo ''; echo '

'; echo '

'; echo ''; echo '

'; } echo '
'; // .affiliates-form-settings } /** * Add the default values for the affiliates action field. */ public function get_defaults() { $defaults = array(); $defaults[self::ENABLE] = 0; $defaults[self::BASE_AMOUNT] = ''; $defaults[self::CURRENCY] = ''; $defaults[self::CURRENCY_ID] = ''; if ( !Affiliates_Formidable::using_rates() ) { $defaults[self::AMOUNT] = ''; $defaults[self::RATE] = ''; } return $defaults; } } Affiliates_Formidable_Affiliates_Action::init();