Plugin Directory

Changeset 2975241


Ignore:
Timestamp:
10/05/2023 02:01:13 PM (2 years ago)
Author:
wpgrids
Message:

Release 1.2.3

Location:
ai-content-generation
Files:
88 added
4 edited

Legend:

Unmodified
Added
Removed
  • ai-content-generation/trunk/assets/js/post-generator.js

    r2964507 r2975241  
    11(function ($) {
    2 
    3     $(document).ready(function () {
    4 
    5         const $parent = $('#wpwand-bulk-post-generator');
    6 
    7         // bacek functionality
    8         $parent.find('.wpwand-pgs-back-button').on('click', function (e) {
    9             e.preventDefault();
    10             let target = $(this).data('target');
    11 
    12             $parent.find('.step-content').removeClass('active');
    13             $parent.find('.wpwand-pgs-header .step').removeClass('active');
    14 
    15             $parent.find('#' + target).addClass('active');
    16             $parent.find('[data-id=' + target + ']').addClass('active');
    17         })
    18 
    19 
    20 
    21 
    22 
    23         // approve functionality
    24         $('.wpwand-pgdc-approve-button').on('click', function (e) {
    25             e.preventDefault(); // Prevent the default behavior (navigating) until the user confirms
    26 
    27             Swal.fire({
    28                 title: 'Are you sure you want to approve this??',
    29                 text: 'After your confirmation, it will be added as a Draft post in your blog.',
    30                 showDenyButton: true,
    31                 confirmButtonText: 'Confirm',
    32                 denyButtonText: `Cancel`,
    33                 customClass: {
    34                     popup: 'wpwand-swal-alert wpwand-swal-alert-approve-pgc',
    35                     // icon: 'wpwand-swal-alert',
    36                 }
    37             }).then((result) => {
    38                 if (result.isConfirmed) {
    39                     Swal.fire({
    40                         title: 'Successfully Added to Post!',
    41                         icon: 'success',
    42                         showConfirmButton: false,
    43                         timer: 1500,
    44                         customClass: {
    45                             popup: 'wpwand-swal-alert wpwand-swal-alert-approve-pgc',
    46                             // icon: 'wpwand-swal-alert',
    47                         }
    48                     }).then(() => {
    49                         window.location.href = $(this).attr('href');
    50                     });
    51 
    52                 }
    53             });
    54         });
    55         $('#wpwand-bulk-post-generator .delete').on('click', function (e) {
    56             e.preventDefault(); // Prevent the default behavior (navigating) until the user confirms
    57 
    58             wpwand_delete_alert(this, 'Are you sure you want to delete?')
    59         });
    60 
    61 
    62         $('.wpwand-pg-form').on('submit', function (e) {
    63             e.preventDefault();
    64 
    65             const $this = $(this);
    66             const is_custom_form = $this.is('#wpwand-pgf-custom');
    67 
    68 
    69             if (is_custom_form) {
    70                 // Get the text from the textarea
    71                 $parent.find('#wpwand-post-content-generate-form .wpwand-pcgf-title-list').html('');
    72 
    73                 // Split the text into an array of lines using the newline character as the delimiter
    74                 var text = $("#titles").val();
    75                 var linesArray = text.split('\n');
    76                 linesArray = linesArray.filter(function (line) {
    77                     return line.trim() !== ''; // Remove lines that are empty or contain only whitespace
    78                 });
    79 
    80                 // You can iterate through the linesArray and perform further processing as needed
    81                 let count = 0;
    82                 $.each(linesArray, function (index, line) {
    83                     count++;
    84                     // Do something with each line
    85                     console.log("Line " + (index + 1) + ": " + line);
    86 
    87                     $parent.find('#wpwand-post-content-generate-form .wpwand-pcgf-title-list').append(`
     2  $(document).ready(function () {
     3    const $parent = $("#wpwand-bulk-post-generator");
     4
     5    // bacek functionality
     6    $parent.find(".wpwand-pgs-back-button").on("click", function (e) {
     7      e.preventDefault();
     8      let target = $(this).data("target");
     9
     10      $parent.find(".step-content").removeClass("active");
     11      $parent.find(".wpwand-pgs-header .step").removeClass("active");
     12
     13      $parent.find("#" + target).addClass("active");
     14      $parent.find("[data-id=" + target + "]").addClass("active");
     15    });
     16
     17    // approve functionality
     18    $(".wpwand-pgdc-approve-button").on("click", function (e) {
     19      e.preventDefault(); // Prevent the default behavior (navigating) until the user confirms
     20
     21      Swal.fire({
     22        title: "Are you sure you want to approve this??",
     23        text: "After your confirmation, it will be added as a Draft post in your blog.",
     24        showDenyButton: true,
     25        confirmButtonText: "Confirm",
     26        denyButtonText: `Cancel`,
     27        customClass: {
     28          popup: "wpwand-swal-alert wpwand-swal-alert-approve-pgc",
     29          // icon: 'wpwand-swal-alert',
     30        },
     31      }).then((result) => {
     32        if (result.isConfirmed) {
     33          Swal.fire({
     34            title: "Successfully Added to Post!",
     35            icon: "success",
     36            showConfirmButton: false,
     37            timer: 1500,
     38            customClass: {
     39              popup: "wpwand-swal-alert wpwand-swal-alert-approve-pgc",
     40              // icon: 'wpwand-swal-alert',
     41            },
     42          }).then(() => {
     43            window.location.href = $(this).attr("href");
     44          });
     45        }
     46      });
     47    });
     48    $("#wpwand-bulk-post-generator .delete").on("click", function (e) {
     49      e.preventDefault(); // Prevent the default behavior (navigating) until the user confirms
     50
     51      wpwand_delete_alert(this, "Are you sure you want to delete?");
     52    });
     53
     54    $(".wpwand-pg-form").on("submit", function (e) {
     55      e.preventDefault();
     56
     57      const $this = $(this);
     58      const is_custom_form = $this.is("#wpwand-pgf-custom");
     59
     60      if (is_custom_form) {
     61        // Get the text from the textarea
     62        $parent
     63          .find("#wpwand-post-content-generate-form .wpwand-pcgf-title-list")
     64          .html("");
     65
     66        // Split the text into an array of lines using the newline character as the delimiter
     67        var text = $("#titles").val();
     68        var linesArray = text.split("\n");
     69        linesArray = linesArray.filter(function (line) {
     70          return line.trim() !== ""; // Remove lines that are empty or contain only whitespace
     71        });
     72
     73        // You can iterate through the linesArray and perform further processing as needed
     74        let count = 0;
     75        $.each(linesArray, function (index, line) {
     76          count++;
     77          // Do something with each line
     78          console.log("Line " + (index + 1) + ": " + line);
     79
     80          $parent
     81            .find("#wpwand-post-content-generate-form .wpwand-pcgf-title-list")
     82            .append(
     83              `
    8884                    <div class="wpwand-pcgf-heading-item">
    8985                        <div class="wpwand-pcgf-heading-content">
    90                             <input type="checkbox" id="selected_headings-` + index + 1 + `" name="selected_headings[]" value="` + line + `" checked>
    91                             <label for="selected_headings-` + index + 1 + `">` + line + `</label>
     86                            <input type="checkbox" id="selected_headings-` +
     87                index +
     88                1 +
     89                `" name="selected_headings[]" value="` +
     90                line +
     91                `" checked>
     92                            <label for="selected_headings-` +
     93                index +
     94                1 +
     95                `">` +
     96                line +
     97                `</label>
    9298                        </div>
    9399                    </div>
    94                     `)
    95                 });
    96 
    97 
    98                 $parent.find('.wpwand-pg-info-topic').parent().hide();
    99                 $parent.find('.wpwand-pg-info-count').html(count);
    100 
    101                 $this.find('button[type=submit]').css('opacity', '1')
    102                 $parent.find('.step-content').removeClass('active');
    103                 $parent.find('.wpwand-pgs-header .step').removeClass('active');
    104 
    105                 $parent.find('#step-2').addClass('active');
    106                 $parent.find('[data-id=step-2]').addClass('active');
    107 
    108 
    109 
    110                 return;
    111             } else {
    112 
    113                 const topic = $this.find('input[name=topic]').val();
    114                 const count = $this.find('input[name=post_count]').val();
    115 
    116                 $this.find('button[type=submit]').css('opacity', '.6')
    117                 $parent.find('.wpwand-pg-info-topic').html(topic);
    118                 $parent.find('.wpwand-pg-info-count').html(count);
    119                 // Use $.post instead of $.ajax for simpler code
    120                 $.post({
    121                     url: wpwand_glb.ajax_url,
    122                     data: {
    123                         action: 'wpwand_post_generator',
    124                         topic,
    125                         count
    126 
    127                     },
    128                     success: function (response) {
    129 
    130                         $this.find('button[type=submit]').css('opacity', '1')
    131                         $parent.find('.step-content').removeClass('active');
    132                         $parent.find('.wpwand-pgs-header .step').removeClass('active');
    133 
    134                         $parent.find('#step-2').addClass('active');
    135                         $parent.find('[data-id=step-2]').addClass('active');
    136 
    137                         $parent.find('#wpwand-post-content-generate-form .wpwand-pcgf-title-list').html(response)
    138 
    139 
    140 
    141                     }
    142                 });
    143             }
    144 
    145 
    146         });
    147 
    148         $parent.find('#wpwand-post-content-generate-form button[type=button]').on('click', function (e) {
    149             e.preventDefault();
    150 
    151             $parent.find('.step-content').removeClass('active');
    152             $parent.find('.wpwand-pgs-header .step').removeClass('active');
    153 
    154             $parent.find('#step-3').addClass('active');
    155             $parent.find('[data-id=step-3]').addClass('active');
    156 
    157             let total_selected = $parent.find('input[name="selected_headings[]"]:checked').length
    158             $parent.find('.wpwand-pg-info-total-selected').html(total_selected);
    159         });
    160 
    161         $parent.find('#step-3 button.start-generation').on('click', function (e) {
    162             e.preventDefault();
    163             $parent.find('#wpwand-post-content-generate-form').submit();
    164         })
    165 
    166         $parent.find('#wpwand-post-content-generate-form').on('submit', function (e) {
    167             e.preventDefault();
    168 
    169             const $this = $(this);
    170 
    171             const selected_title = [];
    172             const keyword = $this.find('#keyword').val();
    173             const tone = $this.find('#tone').val();
    174             const toc_include = $this.find('#toc_include').is(':checked');
    175             const faq_include = $this.find('#faq_include').is(':checked');
    176             $this.find('input[name="selected_headings[]"]:checked').siblings('label').each(function () {
    177                 selected_title.push($(this).text());
    178             });
    179 
    180 
    181             $.post({
    182                 url: wpwand_glb.ajax_url,
    183                 data: {
    184                     action: 'wpwand_post_content_generator',
    185                     selected_title,
    186                     keyword,
    187                     tone,
    188                     toc_include,
    189                     faq_include,
    190                 },
    191                 success: function (response) {
    192                     console.log(response);
    193                     // $this.find('button[type=submit]').css('opacity', '1')
    194                     window.location = wpwand_glb.admin_url + '/admin.php?page=wpwand-post-generator&generated-post';
    195                 }
    196             });
    197         });
    198 
    199 
    200         function wpwand_delete_alert($this, title) {
    201             Swal.fire({
    202                 title: title,
    203                 showDenyButton: true,
    204                 confirmButtonText: 'Yes',
    205                 cancelButtonText: `No`,
    206                 customClass: {
    207                     popup: 'wpwand-swal-alert wpwand-swal-alert-approve-pgc',
    208                 }
    209             }).then((result) => {
    210                 if (result.isConfirmed) {
    211 
    212                     Swal.fire({
    213                         title: 'Successfully Deleted!',
    214                         icon: 'success',
    215                         showConfirmButton: false,
    216                         timer: 1500,
    217                         customClass: {
    218                             popup: 'wpwand-swal-alert wpwand-swal-alert-approve-pgc',
    219                             // icon: 'wpwand-swal-alert',
    220                         }
    221                     }).then(() => {
    222                         window.location.href = $($this).attr('href');
    223                     });
    224 
    225                 }
    226             });
     100                    `
     101            );
     102        });
     103
     104        $parent.find(".wpwand-pg-info-topic").parent().hide();
     105        $parent.find(".wpwand-pg-info-count").html(count);
     106
     107        $this.find("button[type=submit]").css("opacity", "1");
     108        $parent.find(".step-content").removeClass("active");
     109        $parent.find(".wpwand-pgs-header .step").removeClass("active");
     110
     111        $parent.find("#step-2").addClass("active");
     112        $parent.find("[data-id=step-2]").addClass("active");
     113
     114        return;
     115      } else {
     116        const topic = $this.find("input[name=topic]").val();
     117        const count = $this.find("input[name=post_count]").val();
     118
     119        $this.find("button[type=submit]").css("opacity", ".6");
     120        $parent.find(".wpwand-pg-info-topic").html(topic);
     121        $parent.find(".wpwand-pg-info-count").html(count);
     122        // Use $.post instead of $.ajax for simpler code
     123        $.post({
     124          url: wpwand_glb.ajax_url,
     125          data: {
     126            action: "wpwand_post_generator",
     127            topic,
     128            count,
     129          },
     130          success: function (response) {
     131            $this.find("button[type=submit]").css("opacity", "1");
     132            $parent.find(".step-content").removeClass("active");
     133            $parent.find(".wpwand-pgs-header .step").removeClass("active");
     134
     135            $parent.find("#step-2").addClass("active");
     136            $parent.find("[data-id=step-2]").addClass("active");
     137
     138            $parent
     139              .find(
     140                "#wpwand-post-content-generate-form .wpwand-pcgf-title-list"
     141              )
     142              .html(response);
     143          },
     144        });
     145      }
     146    });
     147
     148    $parent
     149      .find("#wpwand-post-content-generate-form button[type=button]")
     150      .on("click", function (e) {
     151        e.preventDefault();
     152
     153        $parent.find(".step-content").removeClass("active");
     154        $parent.find(".wpwand-pgs-header .step").removeClass("active");
     155
     156        $parent.find("#step-3").addClass("active");
     157        $parent.find("[data-id=step-3]").addClass("active");
     158
     159        let total_selected = $parent.find(
     160          'input[name="selected_headings[]"]:checked'
     161        ).length;
     162        $parent.find(".wpwand-pg-info-total-selected").html(total_selected);
     163      });
     164
     165    $parent.find("#step-3 button.start-generation").on("click", function (e) {
     166      e.preventDefault();
     167      $parent.find("#wpwand-post-content-generate-form").submit();
     168    });
     169
     170    $parent
     171      .find("#wpwand-post-content-generate-form")
     172      .on("submit", function (e) {
     173        e.preventDefault();
     174
     175        const $this = $(this);
     176
     177        const selected_title = [];
     178        const keyword = $this.find("#keyword").val();
     179        const tone = $this.find("#tone").val();
     180        const toc_include = $this.find("#toc_include").is(":checked");
     181        const faq_include = $this.find("#faq_include").is(":checked");
     182        $this
     183          .find('input[name="selected_headings[]"]:checked')
     184          .siblings("label")
     185          .each(function () {
     186            selected_title.push($(this).text());
     187          });
     188
     189        $.post({
     190          url: wpwand_glb.ajax_url,
     191          data: {
     192            action: "wpwand_post_content_generator",
     193            selected_title,
     194            keyword,
     195            tone,
     196            toc_include,
     197            faq_include,
     198          },
     199          success: function (response) {
     200            console.log(response);
     201            // $this.find('button[type=submit]').css('opacity', '1')
     202            window.location =
     203              wpwand_glb.admin_url +
     204              "/admin.php?page=wpwand-post-generator&generated-post";
     205          },
     206        });
     207      });
     208
     209    function wpwand_delete_alert($this, title) {
     210      Swal.fire({
     211        title: title,
     212        showDenyButton: true,
     213        confirmButtonText: "Yes",
     214        cancelButtonText: `No`,
     215        customClass: {
     216          popup: "wpwand-swal-alert wpwand-swal-alert-approve-pgc",
     217        },
     218      }).then((result) => {
     219        if (result.isConfirmed) {
     220          Swal.fire({
     221            title: "Successfully Deleted!",
     222            icon: "success",
     223            showConfirmButton: false,
     224            timer: 1500,
     225            customClass: {
     226              popup: "wpwand-swal-alert wpwand-swal-alert-approve-pgc",
     227              // icon: 'wpwand-swal-alert',
     228            },
     229          }).then(() => {
     230            window.location.href = $($this).attr("href");
     231          });
    227232        }
    228 
    229 
    230         function wpwandCheckProgress(id, $this) {
    231             $.post({
    232                 url: wpwand_glb.ajax_url,
    233                 data: {
    234                     action: 'wpwand_post_generation_progress',
    235                     id
    236                 },
    237                 success: function (response) {
    238                     if (response == 'done') {
    239                         $this.removeClass('pending')
    240                         $this.addClass('done')
    241                         $this.text('Complete')
    242                     }
    243                 },
    244                 complete: function () {
    245                     // Call the function again after a certain interval
    246                     if ($this.hasClass('pending')) {
    247                         setTimeout(wpwandCheckProgress(id, $this), 3000); // Adjust the interval as needed
    248                     }
    249                     if (!$parent.find('.wpwand-pgdc-page table.wp-list-table td span.status').hasClass('pending')) {
    250                         $parent.find('.wpwand-pgdc-page .wpwand-pgdc-header').hide();
    251                     }
    252                 }
    253             });
     233      });
     234    }
     235
     236    function wpwandCheckProgress(id, $this) {
     237      $.post({
     238        url: wpwand_glb.ajax_url,
     239        data: {
     240          action: "wpwand_post_generation_progress",
     241          id,
     242        },
     243        success: function (response) {
     244          if (response == "complete") {
     245            $this.removeClass("pending");
     246            $this.removeClass("failed");
     247            $this.addClass("done");
     248            $this.text("Complete");
     249          }
     250          if (response == "failed") {
     251            $this.removeClass("pending");
     252            $this.addClass("failed");
     253            $this.text("Failed");
     254          }
     255          if (response == "in-progress") {
     256            $this.removeClass("failed");
     257            $this.text("On Progress");
     258          }
     259          console.log(response);
     260        },
     261        complete: function () {
     262          // Call the function again after a certain interval
     263          if ($this.hasClass("pending") || $this.hasClass("failed")) {
     264            setTimeout(wpwandCheckProgress(id, $this), 3000); // Adjust the interval as needed
     265          }
     266          if (
     267            !$parent
     268              .find(".wpwand-pgdc-page table.wp-list-table td span.status")
     269              .hasClass("pending")
     270          ) {
     271            $parent.find(".wpwand-pgdc-page .wpwand-pgdc-header").hide();
     272          }
     273        },
     274        error: function (msg) {},
     275      });
     276    }
     277
     278    // Call the function to start updating the current item
     279
     280    $parent
     281      .find(".wpwand-pgdc-page table.wp-list-table td span.status")
     282      .each(function () {
     283        if (!$(this).hasClass("done")) {
     284          var id = $(this).closest("tr").data("id");
     285          wpwandCheckProgress(id, $(this));
    254286        }
    255 
    256         // Call the function to start updating the current item
    257 
    258         $parent.find('.wpwand-pgdc-page table.wp-list-table td span.status').each(function () {
    259             if ($(this).hasClass('pending')) {
    260                 var id = $(this).closest('tr').data('id');
    261                 wpwandCheckProgress(id, $(this))
    262             }
    263         })
    264     })
    265 
     287      });
     288  });
    266289})(jQuery);
  • ai-content-generation/trunk/inc/frontend.php

    r2967041 r2975241  
    8585                        <div class="wpwand-template-list">
    8686                            <?php if (is_array(wpwand_templates())):
     87                                                                            $custom_prompt = wpwand_get_custom_prpompts('aichar');
     88
    8789                                foreach (wpwand_templates() as $key => $template):
    8890                                    if (!isset($template['number_of_results'])) {
     
    396398                                                </div>
    397399                                                <?php
    398                                                 $custom_prompt = wpwand_get_custom_prpompts('aichar');
    399400                                                if (function_exists('wpwand_pro_tala_check') && wpwand_pro_tala_check()): ?>
    400401                                                    <div class="wpwand-form-field">
  • ai-content-generation/trunk/readme.txt

    r2967041 r2975241  
    55Requires at least: 5.0
    66Tested up to: 6.3
    7 Stable tag: 1.2.2
     7Stable tag: 1.2.3
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    307307
    308308== Changelog ==
     309= 1.2.3 =
     310* Fixed: Minor Issue.
    309311
    310312= 1.2.2 =
  • ai-content-generation/trunk/wp-wand.php

    r2967041 r2975241  
    44 * Plugin URI: https://wpwand.com/
    55 * Description: WP Wand is a AI content generation plugin for WordPress that helps your team create high quality content 10X faster and 50x cheaper. No monthly subscription required.
    6  * Version: 1.2.2
     6 * Version: 1.2.3
    77 * Author: WP Wand
    88 * Author URI: https://wpwand.com/
Note: See TracChangeset for help on using the changeset viewer.