public function draw_salesforce_form($form_fields, $service, $field_values = '') { //hide verision # and hardcoded it to 34.0 $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%8$s</label> <input type="text" value="%15$s" id="%1$s">%22$s </div> <div class="rad_dashboard_account_row"> <label for="%3$s">%10$s</label> <input type="password" value="%17$s" id="%3$s">%22$s </div> <div class="rad_dashboard_account_row"> <label for="%4$s">%11$s</label> <input type="password" value="%18$s" id="%4$s">%22$s </div> <div class="rad_dashboard_account_row"> <label for="%5$s">%12$s</label> <input type="text" value="%19$s" id="%5$s">%22$s </div> <div class="rad_dashboard_account_row"> <label for="%6$s">%13$s</label> <input type="password" value="%20$s" id="%6$s">%22$s </div> <div class="rad_dashboard_account_row"> <label for="%7$s">%14$s</label> <input type="password" value="%21$s" id="%7$s">%22$s </div> <div class="rad_dashboard_account_row"> <label style="display:none;" for="%2$s">%9$s</label> <input type="hidden" value="34.0" id="%2$s"> </div> ', esc_attr('url_' . $service), esc_attr('version_' . $service), esc_attr('client_key_' . $service), esc_attr('client_secret_' . $service), esc_attr('username_sf_' . $service), esc_attr('password_sf_' . $service), esc_attr('token_' . $service), __('Instance Number', 'rapidology'), __('Salesforce version #', 'rapidology'), __('Consumer key', 'rapidology'), __('Consumer secret', 'rapidology'), __('Salesforce username', 'rapidology'), __('Salesforce password', 'rapidology'), __('Secuirty token', 'rapidology'), '' !== $field_values && isset($field_values['url']) ? esc_attr($field_values['url']) : '', '' !== $field_values && isset($field_values['version']) ? esc_attr($field_values['version']) : '', '' !== $field_values && isset($field_values['client_key']) ? esc_attr($field_values['client_key']) : '', '' !== $field_values && isset($field_values['client_secret']) ? esc_attr($field_values['client_secret']) : '', '' !== $field_values && isset($field_values['username_sf']) ? esc_attr($field_values['username']) : '', '' !== $field_values && isset($field_values['password_sf']) ? esc_attr($field_values['password']) : '', '' !== $field_values && isset($field_values['token']) ? esc_attr($field_values['token']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs#' . $service . '" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); return $form_fields; }
public function draw_getresponse_form($form_fields, $service, $field_values) { $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%2$s</label> <input type="password" value="%3$s" id="%1$s">%4$s </div>', esc_attr('api_key_' . $service), __('API key', 'rapidology'), '' !== $field_values && isset($field_values['api_key']) ? esc_attr($field_values['api_key']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs#' . $service . '" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); return $form_fields; }
public function draw_emma_form($form_fields, $service, $field_values) { $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%4$s</label> <input type="password" value="%7$s" id="%1$s">%10$s </div> <div class="rad_dashboard_account_row"> <label for="%2$s">%5$s</label> <input type="password" value="%8$s" id="%2$s">%10$s </div> <div class="rad_dashboard_account_row"> <label for="%3$s">%6$s</label> <input type="password" value="%9$s" id="%3$s">%10$s </div>', esc_attr('api_key_' . $service), esc_attr('client_id_' . $service), esc_attr('username_' . $service), __('Public API Key', 'rapidology'), __('Private API key', 'rapidology'), __('Account ID', 'rapidology'), '' !== $field_values && isset($field_values['api_key_']) ? esc_html($field_values['api_key_']) : '', '' !== $field_values && isset($field_values['client_id_']) ? esc_html($field_values['client_id_']) : '', '' !== $field_values && isset($field_values['username_']) ? esc_html($field_values['username_']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs#' . $service . '" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); return $form_fields; }
/** * Generates fields for the account authorization form based on the service * @return string */ function generate_new_account_form($service, $account_name = '', $display_name = true) { $field_values = ''; if ('' !== $account_name) { $options_array = RAD_Rapidology::grad_rapidology_options(); $field_values = $options_array['accounts'][$service][$account_name]; } $form_fields = sprintf('<div class="account_settings_fields" data-service="%1$s">', esc_attr($service)); if (true === $display_name) { $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%2$s</label> <input type="text" value="%3$s" id="%1$s">%4$s </div>', esc_attr('name_' . $service), __('Account Name', 'rapidology'), esc_attr($account_name), RAD_Rapidology::generate_hint(__('Enter the name for your account', 'rapidology'), true)); } switch ($service) { case 'madmimi': $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%3$s</label> <input type="password" value="%5$s" id="%1$s">%7$s </div> <div class="rad_dashboard_account_row"> <label for="%2$s">%4$s</label> <input type="password" value="%6$s" id="%2$s">%7$s </div>', esc_attr('username_' . $service), esc_attr('api_key_' . $service), __('Username', 'rapidology'), __('API key', 'rapidology'), '' !== $field_values && isset($field_values['username']) ? esc_html($field_values['username']) : '', '' !== $field_values && isset($field_values['api_key']) ? esc_html($field_values['api_key']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); break; case 'mailchimp': case 'constant_contact': case 'getresponse': case 'sendinblue': case 'campaign_monitor': case 'feedblitz': $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%2$s</label> <input type="password" value="%3$s" id="%1$s">%4$s </div>', esc_attr('api_key_' . $service), __('API key', 'rapidology'), '' !== $field_values && isset($field_values['api_key']) ? esc_attr($field_values['api_key']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); $form_fields .= 'constant_contact' == $service ? sprintf('<div class="rad_dashboard_account_row"> <label for="%1$s">%2$s</label> <input type="password" value="%3$s" id="%1$s">%4$s </div>', esc_attr('token_' . $service), __('Token', 'rapidology'), '' !== $field_values && isset($field_values['token']) ? esc_attr($field_values['token']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)) : ''; break; case 'aweber': $app_id = '7365f385'; $aweber_auth_endpoint = 'https://auth.aweber.com/1.0/oauth/authorize_app/' . $app_id; $form_fields .= sprintf(' <div class="rad_dashboard_account_row rad_dashboard_aweber_row">%1$s%2$s</div>', sprintf(__('Step 1: <a href="%1$s" target="_blank">Generate authorization code</a><br/>', 'rapidology'), esc_url($aweber_auth_endpoint)), sprintf(' %2$s <input type="password" value="%3$s" id="%1$s">', esc_attr('api_key_' . $service), __('Step 2: Paste in the authorization code and click "Authorize" button: ', 'rapidology'), '' !== $field_values && isset($field_values['api_key']) ? esc_attr($field_values['api_key']) : '')); break; case 'icontact': $form_fields .= sprintf(' <div class="rad_dashboard_account_row">%1$s</div>', sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%4$s</label> <input type="password" value="%7$s" id="%1$s">%10$s </div> <div class="rad_dashboard_account_row"> <label for="%2$s">%5$s</label> <input type="password" value="%8$s" id="%2$s">%10$s </div> <div class="rad_dashboard_account_row"> <label for="%3$s">%6$s</label> <input type="password" value="%9$s" id="%3$s">%10$s </div>', esc_attr('client_id_' . $service), esc_attr('username_' . $service), esc_attr('password_' . $service), __('App ID', 'rapidology'), __('Username', 'rapidology'), __('Password', 'rapidology'), '' !== $field_values && isset($field_values['client_id']) ? esc_html($field_values['client_id']) : '', '' !== $field_values && isset($field_values['username']) ? esc_html($field_values['username']) : '', '' !== $field_values && isset($field_values['password']) ? esc_html($field_values['password']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false))); break; case 'ontraport': $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%3$s</label> <input type="password" value="%5$s" id="%1$s">%7$s </div> <div class="rad_dashboard_account_row"> <label for="%2$s">%4$s</label> <input type="password" value="%6$s" id="%2$s">%7$s </div>', esc_attr('api_key_' . $service), esc_attr('client_id_' . $service), __('API key', 'rapidology'), __('APP ID', 'rapidology'), '' !== $field_values && isset($field_values['api_key']) ? esc_attr($field_values['api_key']) : '', '' !== $field_values && isset($field_values['client_id']) ? esc_attr($field_values['client_id']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); break; case 'infusionsoft': $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%3$s</label> <input type="password" value="%5$s" id="%1$s">%7$s </div> <div class="rad_dashboard_account_row"> <label for="%2$s">%4$s</label> <input type="password" value="%6$s" id="%2$s">%7$s </div>', esc_attr('api_key_' . $service), esc_attr('client_id_' . $service), __('API Key', 'rapidology'), __('Application name', 'rapidology'), '' !== $field_values && isset($field_values['api_key']) ? esc_attr($field_values['api_key']) : '', '' !== $field_values && isset($field_values['client_id']) ? esc_attr($field_values['client_id']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); break; } $form_fields .= '</div>'; return $form_fields; }
/** * Generates fields for the account authorization form based on the service * @return string */ function generate_new_account_form($service, $account_name = '', $display_name = true) { $field_values = ''; if ('' !== $account_name) { $options_array = RAD_Rapidology::get_rapidology_options(); $field_values = $options_array['accounts'][$service][$account_name]; } $form_fields = sprintf('<div class="account_settings_fields" data-service="%1$s">', esc_attr($service)); if (true === $display_name) { $form_fields .= sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%2$s</label> <input type="text" value="%3$s" id="%1$s">%4$s </div>', esc_attr('name_' . $service), __('Account Name', 'rapidology'), esc_attr($account_name), RAD_Rapidology::generate_hint(__('Enter the name for your account', 'rapidology'), true)); } $default_fields = sprintf(' <div class="rad_dashboard_account_row"> <label for="%1$s">%2$s</label> <input type="password" value="%3$s" id="%1$s">%4$s </div>', esc_attr('api_key_' . $service), __('API key', 'rapidology'), '' !== $field_values && isset($field_values['api_key']) ? esc_attr($field_values['api_key']) : '', RAD_Rapidology::generate_hint(sprintf('<a href="http://www.rapidology.com/docs#' . $service . '" target="_blank">%1$s</a>', __('Click here for more information', 'rapidology')), false)); //include class to get functions below if (!class_exists('rapidology_' . $service)) { require_once RAD_RAPIDOLOGY_PLUGIN_DIR . 'includes/classes/integrations/class.rapidology-' . $service . '.php'; } switch ($service) { case 'madmimi': $madmimi = new rapidology_madmimi(); $form_fields = $madmimi->draw_madmimi_form($form_fields, $service, $field_values); break; case 'emma': $emma = new rapidology_emma(); $form_fields = $emma->draw_emma_form($form_fields, $service, $field_values); break; case 'salesforce': $salesforce_form = new rapidology_salesforce(); $form_fields = $salesforce_form->draw_salesforce_form($form_fields, $service, $field_values); break; case 'activecampaign': $activecampaign = new rapidology_activecampaign(); $form_fields = $activecampaign->draw_activecampaign_form($form_fields, $service, $field_values); break; case 'hubspot-standard': $hubspot_standard = new rapidology_hubspot_standard(); $form_fields = $hubspot_standard->draw_hubspot_standard_form($form_fields, $service, $field_values); break; case 'constant_contact': $constant_contact = new rapidology_constant_contact(); $form_fields = $constant_contact->draw_contstant_contact_form($form_fields, $service, $field_values); break; case 'mailchimp': $mailchimp = new rapidology_mailchimp(); $form_fields = $mailchimp->draw_mailchimp_form($form_fields, $service, $field_values); break; case 'hubspot': $hubspot = new rapidology_hubspot(); $form_fields = $hubspot->draw_hubspot_form($form_fields, $service, $field_values); break; case 'getresponse': $getresponse = new rapidology_getresponse(); $form_fields = $getresponse->draw_getresponse_form($form_fields, $service, $field_values); break; case 'sendinblue': $sendinblue = new rapidology_sendinblue(); $form_fields = $sendinblue->draw_sendinblue_form($form_fields, $service, $field_values); break; case 'campaign_monitor': $mailchimp = new rapidology_campaign_monitor(); $mailchimp->draw_campaign_monitor_form($form_fields, $service, $field_values); break; case 'feedblitz': $feedblitz = new rapidology_feedblitz(); $form_fields = $feedblitz->draw_feedbliz_form($form_fields, $service, $field_values); break; case 'aweber': $aweber = new rapidology_aweber(); $form_fields = $aweber->draw_aweber_form($form_fields, $service, $field_values); break; case 'icontact': $icontact = new rapidology_icontact(); $form_fields = $icontact->draw_icontact_form($form_fields, $service, $field_values); break; case 'ontraport': $ontraport = new rapidology_ontraport(); $form_fields = $ontraport->draw_ontraport_form($form_fields, $service, $field_values); break; case 'infusionsoft': $infusionsoft = new rapidology_infusionsoft(); $form_fields = $infusionsoft->draw_infusionsoft_form($form_fields, $service, $field_values); break; } $form_fields .= '</div>'; return $form_fields; }