Plugin Directory

Changeset 3033309


Ignore:
Timestamp:
02/08/2024 04:58:06 PM (2 years ago)
Author:
sided
Message:

1.3.3 - Send tags to Sided

Location:
sided
Files:
33 added
4 edited

Legend:

Unmodified
Added
Removed
  • sided/trunk/partials/functions.php

    r3006142 r3033309  
    7777}
    7878
    79 function add_send_cat_script(){
     79function add_send_cat_script() {
    8080    $send_cats_to_sided = get_option('send_cats_to_sided');
    81     if ($send_cats_to_sided == 'true' && (is_single() || is_page())) {
    82         $categories = get_the_category();
    83 
    84         $category_names = array();
    85         foreach ($categories as $category) {
    86             $category_names[] = $category->name;
    87         }
    88         if(count($category_names) > 0){
     81    $send_tags_to_sided = get_option('send_tags_to_sided');
     82
     83    if (($send_cats_to_sided == 'true' || $send_tags_to_sided == 'true') && (is_single() || is_page())) {
     84        $names = [];
     85
     86        if ($send_cats_to_sided == 'true') {
     87            $categories = get_the_category();
     88            foreach ($categories as $category) {
     89                $names[] = $category->name;
     90            }
     91        }
     92
     93        if ($send_tags_to_sided == 'true') {
     94            $tags = get_the_tags();
     95            foreach ($tags as $tag) {
     96                $names[] = $tag->name;
     97            }
     98        }
     99
     100        if (count($names) > 0) {
    89101            echo "<script>
    90                 console.log('send_cats_to_sided');
    91102                window.sidedScriptPayload = window.sidedScriptPayload || {};
    92                 window.sidedScriptPayload.categories = ['" . implode("', '", $category_names) . "'];
     103                window.sidedScriptPayload.categories = ['" . implode("', '", $names) . "'];
    93104            </script>";
    94105        }
     
    111122{
    112123    echo update_option('send_cats_to_sided', sanitize_text_field($_POST['checked']));
     124    wp_die();
     125}
     126
     127add_action('wp_ajax_wpa_send_tags_to_sided', 'sided_wpa_send_tags_to_sided_callback');
     128add_action('wp_ajax_nopriv_wpa_send_tags_to_sided', 'sided_wpa_send_tags_to_sided_callback');
     129function sided_wpa_send_tags_to_sided_callback()
     130{
     131    echo update_option('send_tags_to_sided', sanitize_text_field($_POST['checked']));
    113132    wp_die();
    114133}
  • sided/trunk/partials/sided-settings.php

    r3029321 r3033309  
    2121    delete_option('sided_sided_embed_placement_options');
    2222    delete_option('send_cats_to_sided');
     23    delete_option('send_tags_to_sided');
    2324}
    2425
    2526$sided_initiate_script = get_option('sided_sided_initiate_script');
    2627$send_cats_to_sided = get_option('send_cats_to_sided');
     28$send_tags_to_sided = get_option('send_tags_to_sided');
    2729
    2830include 'includes/sided-authenticate-apikey.php';
     
    7981    <?php if($status_aat === 'Valid Token'){ ?>
    8082        <hr/>
    81         <div class="wrap one-click-integration common-form ">
     83        <div class="wrap one-click-integration common-form">
    8284            <label>One Click Integration</label>
    8385
     
    100102
    101103            <label class="mt-3">Match polls by post category</label>
    102             <label class="mb-3 mt-2"><input type="checkbox" <?php if($send_cats_to_sided == 'true') { echo 'checked'; } ?> name="send_cats_to_sided"><span class="fadedSpan">&nbsp;Send categories to Sided.</span></label>
    103 
     104            <label class="mb-3 mt-2">
     105                <input type="checkbox" <?php if ($send_cats_to_sided == 'true') { echo 'checked'; } ?> name="send_cats_to_sided">
     106                <span class="fadedSpan">&nbsp;Send categories to Sided</span>
     107            </label>
     108            <label class="mb-3 mt-2">
     109                <input type="checkbox" <?php if ($send_tags_to_sided == 'true') { echo 'checked'; } ?> name="send_tags_to_sided">
     110                <span class="fadedSpan">&nbsp;Send tags to Sided</span>
     111            </label>
    104112        </div>
    105113    <?php } ?>
     
    128136        var data = {
    129137            action: 'wpa_send_cats_to_sided',
     138            checked: $(this).is(":checked") ? true : false,
     139        };
     140        jQuery.post( ajaxurl, data, function(response) {
     141            console.log(response);
     142        });
     143    });
     144
     145    $('input[name="send_tags_to_sided"]').change(function() {
     146        var data = {
     147            action: 'wpa_send_tags_to_sided',
    130148            checked: $(this).is(":checked") ? true : false,
    131149        };
  • sided/trunk/readme.txt

    r3029321 r3033309  
    55Requires at least: 4.7
    66Tested up to: 6.2
    7 Stable tag: 1.3.2
     7Stable tag: 1.3.3
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    3838
    3939== Changelog ==
     40= 1.3.3 =
     41* Send tags to Sided
     42
    4043= 1.3.2 =
    4144* Optimizations
  • sided/trunk/sided.php

    r3029321 r3033309  
    44* Plugin URI: https://sided.co/
    55* Description: It is a wordpress plugin to embed sided polls in your Wordpress website.
    6 * Version: 1.3.2
     6* Version: 1.3.3
    77* Author: Sided
    88**/
    99
    10 define( 'SIDED_VERSION', '1.3.2' );
     10define( 'SIDED_VERSION', '1.3.3' );
    1111define( 'SIDED_PLUGIN', __FILE__ );
    1212define( 'SIDED_PLUGIN_DIR', untrailingslashit( dirname( SIDED_PLUGIN ) ) );
Note: See TracChangeset for help on using the changeset viewer.