Plugin Directory

Changeset 3046302


Ignore:
Timestamp:
03/06/2024 11:55:39 AM (2 years ago)
Author:
sided
Message:

1.3.5 - Optimizations

Location:
sided
Files:
39 added
3 edited

Legend:

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

    r3045866 r3046302  
    5555
    5656            } else {
    57                 $url = SIDED_API_URL . '/admin/embedPlacement/getEmbed/' . $embed_placement_option['placement_id'] . '?clientId=' . $sided_selected_network;
    58                 $args = array('timeout' => 50,
    59                     'method' => 'GET',
    60                     'headers' => array('Content-Type' => 'application/json',
    61                         'x-source-type' => 'wp-plugin',
    62                         'x-private-access-token' => get_option('sided_sided_private_access_token')),
    63                     'data_format' => 'body',
     57                // $url = SIDED_API_URL . '/admin/embedPlacement/getEmbed/' . $embed_placement_option['placement_id'] . '?clientId=' . $sided_selected_network;
     58                // $args = array('timeout' => 50,
     59                //     'method' => 'GET',
     60                //     'headers' => array('Content-Type' => 'application/json',
     61                //         'x-source-type' => 'wp-plugin',
     62                //         'x-private-access-token' => get_option('sided_sided_private_access_token')),
     63                //     'data_format' => 'body',
     64                // );
     65                // $response = wp_remote_post($url, $args);
     66                // $response_arr = json_decode($response['body']);
     67                // if ($response_arr->status == 'success') {
     68                //     $embed_code = $response_arr->data->html;
     69                //     echo htmlentities($embed_code);die();
     70                //     $content = get_the_content();
     71                //     add_filter('the_content', function ($content) use ($embed_code) {
     72                //         return add_after_post_content($content, $embed_code);
     73                //     }, 12);
     74                // }
     75            }
     76        }
     77    }
     78}
     79
     80add_filter('the_content', function ($content) {
     81    if (is_single()) {
     82        $sided_selected_network = get_option('sided_sided_selected_network');
     83        $sided_embed_placement_options = get_option('sided_sided_embed_placement_options');
     84        unset($sided_embed_placement_options['updated_at']);
     85
     86        foreach ($sided_embed_placement_options as $embed_placement_option) {
     87            if ($embed_placement_option['active'] == 'true' && $embed_placement_option['embed_location_on_page'] !== 'sidebar') {
     88                return sprintf(
     89                    '%s<div class="sided-widget" clientId="%d" placementId="%d"></div>',
     90                    $content,
     91                    $sided_selected_network,
     92                    $sided_selected_network
    6493                );
    65                 $response = wp_remote_post($url, $args);
    66                 $response_arr = json_decode($response['body']);
    67                 if ($response_arr->status == 'success') {
    68                     $embed_code = $response_arr->data->html;
    69                     $content = get_the_content();
    70                     add_filter('the_content', function ($content) use ($embed_code) {
    71                         return add_after_post_content($content, $embed_code);
    72                     }, 12);
    73                 }
    74             }
    75         }
    76     }
    77 }
     94            }
     95        }   
     96    }
     97}, 12);
    7898
    7999function add_send_cat_script() {
  • sided/trunk/readme.txt

    r3045869 r3046302  
    55Requires at least: 4.7
    66Tested up to: 6.2
    7 Stable tag: 1.3.4
     7Stable tag: 1.3.5
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    3838
    3939== Changelog ==
     40= 1.3.5 =
     41* Optimizations
     42
    4043= 1.3.4 =
    4144* Remove embeds from pages (keep it on posts only)
  • sided/trunk/sided.php

    r3045869 r3046302  
    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.4
     6* Version: 1.3.5
    77* Author: Sided
    88**/
    99
    10 define( 'SIDED_VERSION', '1.3.4' );
     10define( 'SIDED_VERSION', '1.3.5' );
    1111define( 'SIDED_PLUGIN', __FILE__ );
    1212define( 'SIDED_PLUGIN_DIR', untrailingslashit( dirname( SIDED_PLUGIN ) ) );
Note: See TracChangeset for help on using the changeset viewer.