Example #1
0
 /**
  * To compute shortcode insert in a page.
  *
  * @param string     $attr
  * @param null|mixed $content
  */
 public function shortcode($attr, $content = null)
 {
     $formId = $this->getFormId($attr);
     //Get fields to display
     $formFieldsList = $this->sellsyPlugin->listSelectedFields();
     $result = $this->validateForm($formFieldsList, $attr, $formId);
     if (is_readable(SELLSY_WP_PATH_INC . '/front-page.php')) {
         $options = $this->options;
         $messageSent = false;
         if (true === $result) {
             $messageSent = true;
         } elseif (!empty($result)) {
             $errors = $result;
         }
         $opportunityId = $this->sellsyPlugin->getOpportunityCurrentIdent();
         include SELLSY_WP_PATH_INC . '/front-page.php';
     }
 }
Example #2
0
 /**
  * Return the list of available settings in the wordpress admin.
  *
  * @return array
  */
 public function loadSettings()
 {
     //Extract entity type to use to extract custom fields
     $element = 'prospect';
     //Extract usable ordered list of selected fields
     $selectedFieldsList = array_map(function (Field $field) {
         return $field->getName();
     }, $this->sellsyPlugin->listSelectedFields());
     //Get available fields
     $availableFields = $this->sellsyPlugin->listFields($element);
     //Reorder them
     $availableOrderedFieldsList = array();
     foreach ($selectedFieldsList as $fieldName => $name) {
         if (isset($availableFields[$fieldName])) {
             $availableOrderedFieldsList[$fieldName] = $availableFields[$fieldName];
             unset($availableFields[$fieldName]);
         }
     }
     //Add other field at end
     $availableOrderedFieldsList = array_merge($availableOrderedFieldsList, $availableFields);
     return array(self::CONSUMER_TOKEN => array('title' => __('Consumer Token', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_connexion', 'originalKey' => 'WPIconsumer_token'), self::CONSUMER_SECRET => array('title' => __('Consumer Secret', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_connexion', 'originalKey' => 'WPIconsumer_secret'), self::ACCESS_TOKEN => array('title' => __('User Token', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_connexion', 'originalKey' => 'WPIutilisateur_token'), self::ACCESS_SECRET => array('title' => __('User Secret', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_connexion', 'originalKey' => 'WPIutilisateur_secret'), self::OPPORTUNITY_CREATION => array('title' => __('Create', 'wpsellsy'), 'desc' => '', 'type' => 'radio', 'std' => '', 'section' => 'sellsy_options', 'choices' => array('prospectOnly' => __('Only a lead', 'wpsellsy'), 'prospectOpportunity' => __('A lead with its opportunity', 'wpsellsy')), 'originalKey' => 'WPIcreer_prospopp'), self::OPPORTUNITY_SOURCE => array('title' => __('Opportunity source names', 'wpsellsy'), 'desc' => __('You must define this parameter if you must create an opportunity. The source must exist on your <a href="https://www.sellsy.com/?_f=prospection_prefs&action=sources" target="_blank">Sellsy.com</a> account. Several sources can be defined, splited by a comma.', 'wpsellsy'), 'std' => '', 'type' => 'text', 'section' => 'sellsy_options', 'originalKey' => 'WPInom_opp_source'), self::FORM_NAME => array('title' => __('Form name', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_display', 'originalKey' => 'WPInom_form'), self::DISPLAY_FORM_NAME => array('title' => __('Display the form name', 'wpsellsy'), 'desc' => __('To display the name of the form in your page and article.', 'wpsellsy'), 'type' => 'radio', 'std' => '', 'section' => 'sellsy_display', 'choices' => array('displayTitle' => __('Yes', 'wpsellsy'), 'none' => __('No', 'wpsellsy')), 'originalKey' => 'WPIaff_form'), self::SPLIT_COLUMNS => array('title' => __('Split fields in several columns', 'wpsellsy'), 'desc' => __('To dispatch fields in several columns. By default, all fields are displayed in a column', 'wpsellsy'), 'type' => 'text', 'std' => '1', 'section' => 'sellsy_display', 'originalKey' => 'WPIaff_form'), self::COLUMNS_CLASS => array('title' => __('Column HTML classes', 'wpsellsy'), 'desc' => __('To define the class to use in your HTML column.', 'wpsellsy'), 'type' => 'text', 'std' => '', 'section' => 'sellsy_display', 'originalKey' => 'WPIaff_form'), self::FORM_CUSTOM_HEADER => array('title' => __('HTML form header', 'wpsellsy'), 'desc' => __('HTML code to print before the form', 'wpsellsy'), 'type' => 'textarea', 'std' => '', 'section' => 'sellsy_display', 'originalKey' => null), self::FORM_CUSTOM_FOOTER => array('title' => __('HTML form footer', 'wpsellsy'), 'desc' => __('HTML code to print after the form', 'wpsellsy'), 'type' => 'textarea', 'std' => '', 'section' => 'sellsy_display', 'originalKey' => null), self::MESSAGE_SENT => array('title' => __('Confirmation message', 'wpsellsy'), 'desc' => __('To define the message to display when the lead has been created', 'wpsellsy'), 'type' => 'textarea', 'std' => __('Thanks, your message has been sent.', 'wpsellsy'), 'section' => 'sellsy_display', 'originalKey' => null), self::MESSAGE_ERROR => array('title' => __('Error message', 'wpsellsy'), 'desc' => __('To define the message to display when an error has been encountered', 'wpsellsy'), 'type' => 'textarea', 'std' => __('Your message has not been sent, please check these following fields :', 'wpsellsy'), 'section' => 'sellsy_display', 'originalKey' => null), self::SUBMIT_NOTIFICATION => array('title' => __('Send a notification by email', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_notification', 'originalKey' => 'WPIenvoyer_copie'), self::FROM_NOTIFICATION => array('title' => __('Email sender', 'wpsellsy'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'sellsy_notification', 'originalKey' => null), self::ENABLE_HTML_CHECK => array('title' => __('Enable HTML5 validation', 'wpsellsy'), 'desc' => __('Enable frontside validation build on HTML5 capacity.', 'wpsellsy'), 'type' => 'radio', 'std' => '', 'section' => 'sellsy_frontValid', 'choices' => array('enableJsValidation' => __('Yes', 'wpsellsy'), 'disableJsValidation' => __('No', 'wpsellsy')), 'originalKey' => 'WPIjsValid'), self::FIELDS_SELECTED => array('title' => __('Fields', 'wpsellsy'), 'desc' => __('Select and sort fields to display in the form', 'wpsellsy'), 'type' => 'multiselect', 'std' => '', 'section' => 'sellsy_Champs', 'choices' => $availableOrderedFieldsList, 'originalKey' => null), self::MANDATORIES_FIELDS => array('title' => __('Mandatories Fields', 'wpsellsy'), 'desc' => __('Select mandatories fields in fhe form', 'wpsellsy'), 'type' => 'multiselect', 'std' => '', 'section' => 'sellsy_Champs', 'choices' => $selectedFieldsList, 'originalKey' => null));
 }