/**
  * Constructs a comment ID row via AJAX.
  *
  * @since 141111 First documented version.
  *
  * @param int $post_id A post ID.
  *
  * @return string HTML markup for this select field row.
  *                If no options (or too many options; this returns an input field instead.
  *
  * @see   MenuPageActions::subFormCommentIdRowViaAjax()
  */
 public static function commentIdRowViaAjax($post_id)
 {
     $plugin = plugin();
     if (!current_user_can($plugin->manage_cap)) {
         if (!current_user_can($plugin->cap)) {
             return '';
             // Unauthenticated; ignore.
         }
     }
     $post_id = (int) $post_id;
     $form_fields = new FormFields(static::$form_field_args);
     return $form_fields->selectRow(['placeholder' => __('— All Comments/Replies —', 'comment-mail'), 'label' => __('<i class="fa fa-fw fa-comment-o"></i> Comment ID #', 'comment-mail'), 'name' => 'comment_id', 'required' => false, 'options' => '%%comments%%', 'post_id' => $post_id, 'current_value' => null, 'input_fallback_args' => ['type' => 'number', 'maxlength' => 20, 'other_attrs' => 'min="1" max="18446744073709551615"']]);
 }
Example #2
0
 private function _generateId()
 {
     $id = str_random(10);
     if (!FormFields::where('unique_id', $id)->get()->isEmpty()) {
         return $this->_generateId();
     }
     return $id;
 }
Example #3
0
 /**
  * Displays pro updater.
  *
  * @since 141111 First documented version.
  */
 protected function proUpdaterX()
 {
     if (!IS_PRO) {
         return '';
         // Pro only.
     }
     $_this = $this;
     $form_field_args = ['ns_id_suffix' => '-pro-updater-form', 'ns_name_suffix' => '[pro_update]', 'class_prefix' => 'pmp-pro-updater-form-'];
     $form_fields = new FormFields($form_field_args);
     $current_value_for = function ($key) use($_this) {
         if (strpos($key, 'template__') === 0 && isset($_this->plugin->options[$key])) {
             if ($_this->plugin->options[$key]) {
                 return $_this->plugin->options[$key];
             }
             $data = Template::optionKeyData($key);
             $default_template = new Template($data->file, $data->type, true);
             return $default_template->fileContents();
         }
         return isset($_this->plugin->options[$key]) ? $_this->plugin->options[$key] : null;
     };
     echo '<div class="' . esc_attr(SLUG_TD . '-menu-page ' . SLUG_TD . '-menu-page-pro-updater ' . SLUG_TD . '-menu-page-area') . '">' . "\n";
     echo '   <form method="post" enctype="multipart/form-data" autocomplete="off" action="' . esc_attr($this->plugin->utils_url->pageNonceOnly()) . '" novalidate="novalidate">' . "\n";
     echo '     ' . $this->heading(__('Pro Updater', 'comment-mail'), 'logo.png') . '     ' . $this->notes();
     // Heading/notifications.
     echo '     <div class="pmp-body">' . "\n";
     /* ----------------------------------------------------------------------------------------- */
     $_panel_body = '<i class="fa fa-user fa-4x" style="float:right; margin: 0 0 0 25px;"></i>' . "\n";
     $_panel_body .= '<p style="margin-top:0;">' . sprintf(__('From this page you can update to the latest version of %1$s Pro for WordPress. %1$s Pro is a premium product available for purchase @ <a href="%2$s" target="_blank">%3$s</a>. In order to connect with our update servers, we ask that you supply your account login details for <a href="%2$s" target="_blank">%3$s</a>. If you prefer not to provide your password, you can use your License Key in place of your password. Your License Key is located under "My Account" when you log in @ <a href="%2$s" target="_blank">%3$s</a>. This will authenticate your copy of %1$s Pro; providing you with access to the latest version. You only need to enter these credentials once. %1$s Pro will save them in your WordPress database.', 'comment-mail'), esc_html(NAME), esc_attr($this->plugin->utils_url->productPage()), esc_html(DOMAIN)) . '</p>' . "\n";
     $_panel_body .= ' <table>' . '   <tbody>' . $form_fields->inputRow(['name' => 'username', 'label' => __('Customer Username', 'comment-mail'), 'placeholder' => __('e.g., johndoe22', 'comment-mail'), 'current_value' => $current_value_for('pro_update_username'), 'other_attrs' => 'autocomplete="new-password"']) . '   </tbody>' . ' </table>';
     $_panel_body .= ' <table>' . '   <tbody>' . $form_fields->inputRow(['type' => 'password', 'name' => 'password', 'label' => __('Customer Password or Product License Key', 'comment-mail'), 'current_value' => $current_value_for('pro_update_password'), 'other_attrs' => 'autocomplete="new-password"']) . '   </tbody>' . ' </table>';
     echo $this->panel(__('Update Credentials', 'comment-mail'), $_panel_body, ['icon' => '<i class="fa fa-key"></i>', 'open' => true, 'pro_only' => true]);
     unset($_panel_body);
     // Housekeeping.
     /* ----------------------------------------------------------------------------------------- */
     $_panel_body = ' <table>' . '   <tbody>' . $form_fields->selectRow(['name' => 'check', 'label' => '', 'placeholder' => __('Select an Option...', 'comment-mail'), 'current_value' => $current_value_for('pro_update_check'), 'allow_arbitrary' => false, 'options' => ['1' => __('Yes, display a notification in my WordPress Dashboard when a new version is available.', 'comment-mail'), '0' => __('No, do not display any update notifications in my WordPress Dashboard.', 'comment-mail')], 'notes_after' => '<p>' . sprintf(__('When a new version of %1$s Pro becomes available, %1$s Pro can display a notification in your WordPress Dashboard prompting you to return to this page and perform an upgrade.', 'comment-mail'), esc_html(NAME)) . '</p>']) . '   </tbody>' . ' </table>';
     echo $this->panel(__('Update Notifier', 'comment-mail'), $_panel_body, ['icon' => '<i class="fa fa-bullhorn"></i>', 'open' => true, 'pro_only' => true]);
     unset($_panel_body);
     // Housekeeping.
     /* ----------------------------------------------------------------------------------------- */
     echo '         <div class="pmp-save">' . "\n";
     echo '            <button type="submit">' . __('Update Now', 'comment-mail') . ' <i class="fa fa-magic"></i></button>' . "\n";
     echo '         </div>' . "\n";
     /* ----------------------------------------------------------------------------------------- */
     echo '     </div>';
     echo '   </form>';
     echo '</div>';
 }
Example #4
0
 public function getEmbedForm($id = null)
 {
     if ($form = Forms::where('unique_id', $id)->where('status', 'active')->first()) {
         $form = Forms::where('unique_id', $id)->where('status', 'active')->first();
         $fields = FormFields::where('form_id', $form->id)->get();
         return View::make('frontend/forms/embed', compact('form', 'fields'));
     }
 }