Plugin Directory

Changeset 3096505

Timestamp:
06/03/2024 04:39:12 AM (6 weeks ago)
Author:
matteoenna
Message:

optimization

Location:
social-bot
Files:
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • social-bot/tags/1.8.1/include/bot-class.php

    r2921300 r3096505  
    181181
    182182        public function getResponseString() {
    183             return json_encode($this->getResponse());
     183            return json_encode($this->getResponse());
    184184        }
    185185
    186186        public function getResponseForceString($user, $message) {
    187187            $this->sender = $user;
    188             return json_encode($this->getResponse($message));
     188            return json_encode($this->getResponse($message));
    189189        }
    190190
  • social-bot/tags/1.8.1/include/messenger-news-type.php

    r2921300 r3096505  
    5454    add_action( 'save_post', 'scb_messengerbotnews_meta_save' );
    5555
    56     /* Save function for the entered data */
    5756    function scb_messengerbotnews_meta_save( $post_id ) {
     57
     58
     59
    5860
    59         $list_post = scb_utilities::sanitizePostInput($_POST['messenger_post']) ;
    60         $messenge = scb_utilities::sanitizePostInput($_POST['scb_news_message']) ;
    61 
    62         update_post_meta($post_id,'scb_messenger_post',$list_post);
    63         update_post_meta($post_id,'scb_news_message',$messenge);
     61        if ( ! isset( $_POST['scb_messengerbotnews_nonce'] ) || ! wp_verify_nonce( $_POST['scb_messengerbotnews_nonce'], 'scb_messengerbotnews_save' ) ) {
     62            return;
     63        }
     64   
     65        if ( isset( $_POST['messenger_post'] ) && isset( $_POST['scb_news_message'] ) ) {
     66            $list_post = scb_utilities::sanitizePostInput( $_POST['messenger_post'] );
     67            $messenge = scb_utilities::sanitizePostInput( $_POST['scb_news_message'] );
     68   
     69            update_post_meta( $post_id, 'scb_messenger_post', $list_post );
     70            update_post_meta( $post_id, 'scb_news_message', $messenge );
     71        }
    6472    }
    6573?>
  • social-bot/tags/1.8.1/include/messenger-post-type.php

    r2968070 r3096505  
    197197        $command = sanitize_text_field( $_POST['command'] );
    198198            echo '<div class="scb_box row-command output_text_sender">
    199             Command:<input type="text" name="messengerbotDetails['.$c.'][command]" value="'.$command.'" />
     199            Command:<input type="text" name="messengerbotDetails['..'" />
    200200            Type:'.scb_getOptionType(false, false, esc_attr($c)).'<span class="textBlock">
    201             Response:</span> <textarea name="messengerbotDetails['.$c.'][response]" rows="4" cols="50"  class="textBlock" ></textarea>
    202             <span class="categoryBlock">Categoty:</span>'.scb_getOptionCategory(false, false, esc_attr($c)).'
    203             <span class="tagBlock">Tag:</span>'.scb_getOptionTag(false, false, esc_attr($c)).'
     201            Response:</span> <textarea name="messengerbotDetails['..'][response]" rows="4" cols="50"  class="textBlock" ></textarea>
     202            <span class="categoryBlock">Categoty:</span>'.scb_getOptionCategory(false, false, ).'
     203            <span class="tagBlock">Tag:</span>'.scb_getOptionTag(false, false, ).'
    204204            <p></p><a href="#" class="remove-package">Remove</a></div>';
    205205
  • social-bot/tags/1.8.1/include/post-type.php

    r2927613 r3096505  
    5151        public function createLabel () {
    5252            $labels = array(
    53                 'name' => __( $this->getName(), 'social-bot' ),
    54                 'singular_name' => __( $this->getName(), 'social-bot' ),
     53                'name' => ),
     54                'singular_name' => ),
    5555                'add_new' => __( 'Add New', 'social-bot' ),
    5656                'add_new_item' => sprintf(
     57
    5758                    __( 'Add New %s', 'social-bot' ),
    5859                    $this->getName()
    5960                ),
    6061                'edit_item' => sprintf(
     62
    6163                    __( 'Edit %s', 'social-bot' ),
    6264                    $this->getName()
    6365                ),
    6466                'new_item' => sprintf(
     67
    6568                    __( 'New %s', 'social-bot' ),
    6669                    $this->getName()
    6770                ),
    6871                'all_items' => sprintf(
     72
    6973                    __( 'All %s', 'social-bot' ),
    7074                    $this->getName()
    7175                ),
    7276                'view_item' => sprintf(
     77
    7378                    __( 'View %s', 'social-bot' ),
    7479                    $this->getName()
    7580                ),
    7681                'search_items' => sprintf(
     82
    7783                    __( 'Search %s', 'social-bot' ),
    7884                    $this->getName()
    7985                ),
    8086                'not_found' => sprintf(
     87
    8188                    __( 'No %s found', 'social-bot' ),
    8289                    $this->getName()
    8390                ),
    8491                'not_found_in_trash' => sprintf(
     92
    8593                    __( 'No %s found  in the Trash', 'social-bot' ),
    8694                    $this->getName()
     
    103111                'labels' => $this->getLabel(),
    104112                'description' => sprintf(
     113
    105114                    __( 'Displays %s and their ratings', 'social-bot' ),
    106115                    $this->getName()
  • social-bot/tags/1.8.1/include/settings-page.php

    r2920353 r3096505  
    33    // Contenuto della pagina di configurazione
    44    echo '<div class="wrap">';
    5     echo '<h1>'.__('Social Bot settings', 'social-bot').'</h1>';
     5    echo '<h1>'.__('Social Bot settings', 'social-bot').'</h1>';
    66
    77    // Output del form di configurazione
     
    1717
    1818function social_bot_add_settings_page() {
    19     add_options_page(__('Social Bot settings'), __('Social Bot configuration'), 'manage_options', 'social_bot', 'social_bot_settings_page');
     19    add_options_page(__('Social Bot settings''), 'manage_options', 'social_bot', 'social_bot_settings_page');
    2020}
    2121add_action('admin_menu', 'social_bot_add_settings_page');
     
    6868// Callback per la sezione di configurazione
    6969function social_bot_section_messenger_callback() {
    70     echo __('By clicking on "Enable Facebook Messenger Bot", there will be additional options.', 'social-bot');
     70    echo __('By clicking on "Enable Facebook Messenger Bot", there will be additional options.', 'social-bot');
    7171}
    7272
     
    8585// Callback per la sezione di configurazione
    8686function social_bot_section_telegram_callback() {
    87     echo __('By clicking on "Enable Telegram Bot", there will be additional options.', 'social-bot');
     87    echo __('By clicking on "Enable Telegram Bot", there will be additional options.', 'social-bot');
    8888}
    8989
     
    102102// Callback per la sezione di configurazione
    103103function social_bot_dev_section_callback() {
    104     echo __('Select this option if you want to perform tests using var_dump. Useful if you use tools like Postman.', 'social-bot');
     104    echo __('Select this option if you want to perform tests using var_dump. Useful if you use tools like Postman.', 'social-bot');
    105105}
    106106
  • social-bot/tags/1.8.1/part/form.php

    r2831393 r3096505  
    5959    </p>
    6060    <p class="meta-options scb_field">
    61         <label for="scb_error_msg"><?php echo __('Error message', 'social-bot'); ?></label>
     61        <label for="scb_error_msg"><?php echo __('Error message', 'social-bot'); ?></label>
    6262        <input id="scb_error_msg"
    6363            type="text"
     
    6666    </p>
    6767    <p class="meta-options scb_field">
    68         <label for="scb_delete_user_msg"><?php echo __('Message that subscribers can use to unsubscribe', 'social-bot'); ?></label>
     68        <label for="scb_delete_user_msg"><?php echo __('Message that subscribers can use to unsubscribe', 'social-bot'); ?></label>
    6969        <input id="scb_delete_user_msg"
    7070            type="text"
     
    7373    </p>
    7474</div>
    75 <span class="helper"><?php echo __('To create your own Facebook Messenger Bot you can do it on <a href="https://developers.facebook.com/apps/create/" target="_blank">the official Developer Facebook page', 'social-bot'); ?></a></span>
     75<span class="helper"><?php echo __('To create your own Facebook Messenger Bot you can do it on <a href="https://developers.facebook.com/apps/create/" target="_blank">the official Developer Facebook page', 'social-bot'); ?></a></span>
    7676<script>
    7777    function changetype(event) {
  • social-bot/tags/1.8.1/part/form_choice_messenger_bot.php

    r2826719 r3096505  
    1212        if($post->ID==get_post_meta($postID, 'scb_messenger_post', true)) $select ="selected";
    1313?>
    14         <option value="<?php the_ID(); ?>" <?php echo $select; ?>><?php echo the_title_attribute( 'echo=0' ); ?></option>
     14        <option value="<?php the_ID(); ?>" <?php echo ; ?>><?php echo the_title_attribute( 'echo=0' ); ?></option>
    1515<?php endwhile; ?>
    1616</select>
  • social-bot/tags/1.8.1/part/form_manage_error.php

    r2831393 r3096505  
    3333foreach($message_fail_list as $single_error) {
    3434    if(trim($single_error))
    35     echo '<div class="single_error" data-command="'.$single_error.'">
    36             <p class=" "><span>'.$single_error.'</span></p>
     35    echo '<div class="single_error" data-command="'..'">
     36            <p class=" "><span>'..'</span></p>
    3737            <ul class="btn-list">
    3838                <li class="add_package button" onclick="addFailMessage(event)">
    39                     '. __( 'Add Command', 'social-bot' ).'
     39                    '. __( 'Add Command', 'social-bot' ).'
    4040                </li>
    4141                <li class="add_package button" onclick="removeFailMessage(event)">
    42                     '. __( 'Remove Command', 'social-bot' ).'
     42                    '. __( 'Remove Command', 'social-bot' ).'
    4343                </li>
    4444            </ul>
  • social-bot/tags/1.8.1/part/messengerbot_meta_item.php

    r2919317 r3096505  
    2121                    Type: '.scb_getOptionType(true, $messengerbotDetail['response_type']).'
    2222                    <span class="textBlock">Response:</span><textarea name="messengerbotDetails[%1$s][response]" class="textBlock" rows="4" cols="50" >%4$s</textarea>
    23                     <span class="categoryBlock">'.__('Category').':</span>'.scb_getOptionCategory(true, $response_cat).'
    24                     <span class="tagBlock">'.__('Tag').':</span>'.scb_getOptionTag(true, $response_tag).'
    25                     <p></p> <a href="#" class="remove-package">%5$s</a></div>', $c, $messengerbotDetail['command'], $messengerbotDetail['response_type'], $messengerbotDetail['response'], 'Remove' );
     23                    <span class="categoryBlock">'.').':</span>'.scb_getOptionCategory(true, $response_cat).'
     24                    <span class="tagBlock">'.').':</span>'.scb_getOptionTag(true, $response_tag).'
     25                    <p></p> <a href="#" class="remove-package">%5$s</a></div>', , 'Remove' );
    2626                    $c = $c +1;
    2727                }
     
    3131        ?>
    3232    <span id="output-package"></span>
    33     <a href="#" class="add_package button add_command"><?php __('Add Messenger Bot'); ?></a>
     33    <a href="#" class="add_package button add_command"><?php ot'); ?></a>
    3434    <script>
    3535        var $ =jQuery.noConflict();
  • social-bot/tags/1.8.1/readme.txt

    r3089055 r3096505  
    66Requires at least: 5.0
    77Tested up to: 6.5.3
    8 Stable tag: 1.8
     8Stable tag: 1.8
    99License: GPLv2 or later
    1010
  • social-bot/tags/1.8.1/social-bot.php

    r3089055 r3096505  
    33   Plugin Name: Social Bot
    44   description: A plugin to create response for Facebook Messenger bot
    5    Version: 1.8
     5   Version: 1.8
    66   Author: Matteo Enna
    77   Author URI: https://matteoenna.it/it/wordpress-work/
  • social-bot/trunk/include/bot-class.php

    r2921300 r3096505  
    181181
    182182        public function getResponseString() {
    183             return json_encode($this->getResponse());
     183            return json_encode($this->getResponse());
    184184        }
    185185
    186186        public function getResponseForceString($user, $message) {
    187187            $this->sender = $user;
    188             return json_encode($this->getResponse($message));
     188            return json_encode($this->getResponse($message));
    189189        }
    190190
  • social-bot/trunk/include/messenger-news-type.php

    r2921300 r3096505  
    5454    add_action( 'save_post', 'scb_messengerbotnews_meta_save' );
    5555
    56     /* Save function for the entered data */
    5756    function scb_messengerbotnews_meta_save( $post_id ) {
     57
     58
     59
    5860
    59         $list_post = scb_utilities::sanitizePostInput($_POST['messenger_post']) ;
    60         $messenge = scb_utilities::sanitizePostInput($_POST['scb_news_message']) ;
    61 
    62         update_post_meta($post_id,'scb_messenger_post',$list_post);
    63         update_post_meta($post_id,'scb_news_message',$messenge);
     61        if ( ! isset( $_POST['scb_messengerbotnews_nonce'] ) || ! wp_verify_nonce( $_POST['scb_messengerbotnews_nonce'], 'scb_messengerbotnews_save' ) ) {
     62            return;
     63        }
     64   
     65        if ( isset( $_POST['messenger_post'] ) && isset( $_POST['scb_news_message'] ) ) {
     66            $list_post = scb_utilities::sanitizePostInput( $_POST['messenger_post'] );
     67            $messenge = scb_utilities::sanitizePostInput( $_POST['scb_news_message'] );
     68   
     69            update_post_meta( $post_id, 'scb_messenger_post', $list_post );
     70            update_post_meta( $post_id, 'scb_news_message', $messenge );
     71        }
    6472    }
    6573?>
  • social-bot/trunk/include/messenger-post-type.php

    r2968070 r3096505  
    197197        $command = sanitize_text_field( $_POST['command'] );
    198198            echo '<div class="scb_box row-command output_text_sender">
    199             Command:<input type="text" name="messengerbotDetails['.$c.'][command]" value="'.$command.'" />
     199            Command:<input type="text" name="messengerbotDetails['..'" />
    200200            Type:'.scb_getOptionType(false, false, esc_attr($c)).'<span class="textBlock">
    201             Response:</span> <textarea name="messengerbotDetails['.$c.'][response]" rows="4" cols="50"  class="textBlock" ></textarea>
    202             <span class="categoryBlock">Categoty:</span>'.scb_getOptionCategory(false, false, esc_attr($c)).'
    203             <span class="tagBlock">Tag:</span>'.scb_getOptionTag(false, false, esc_attr($c)).'
     201            Response:</span> <textarea name="messengerbotDetails['..'][response]" rows="4" cols="50"  class="textBlock" ></textarea>
     202            <span class="categoryBlock">Categoty:</span>'.scb_getOptionCategory(false, false, ).'
     203            <span class="tagBlock">Tag:</span>'.scb_getOptionTag(false, false, ).'
    204204            <p></p><a href="#" class="remove-package">Remove</a></div>';
    205205
  • social-bot/trunk/include/post-type.php

    r2927613 r3096505  
    5151        public function createLabel () {
    5252            $labels = array(
    53                 'name' => __( $this->getName(), 'social-bot' ),
    54                 'singular_name' => __( $this->getName(), 'social-bot' ),
     53                'name' => ),
     54                'singular_name' => ),
    5555                'add_new' => __( 'Add New', 'social-bot' ),
    5656                'add_new_item' => sprintf(
     57
    5758                    __( 'Add New %s', 'social-bot' ),
    5859                    $this->getName()
    5960                ),
    6061                'edit_item' => sprintf(
     62
    6163                    __( 'Edit %s', 'social-bot' ),
    6264                    $this->getName()
    6365                ),
    6466                'new_item' => sprintf(
     67
    6568                    __( 'New %s', 'social-bot' ),
    6669                    $this->getName()
    6770                ),
    6871                'all_items' => sprintf(
     72
    6973                    __( 'All %s', 'social-bot' ),
    7074                    $this->getName()
    7175                ),
    7276                'view_item' => sprintf(
     77
    7378                    __( 'View %s', 'social-bot' ),
    7479                    $this->getName()
    7580                ),
    7681                'search_items' => sprintf(
     82
    7783                    __( 'Search %s', 'social-bot' ),
    7884                    $this->getName()
    7985                ),
    8086                'not_found' => sprintf(
     87
    8188                    __( 'No %s found', 'social-bot' ),
    8289                    $this->getName()
    8390                ),
    8491                'not_found_in_trash' => sprintf(
     92
    8593                    __( 'No %s found  in the Trash', 'social-bot' ),
    8694                    $this->getName()
     
    103111                'labels' => $this->getLabel(),
    104112                'description' => sprintf(
     113
    105114                    __( 'Displays %s and their ratings', 'social-bot' ),
    106115                    $this->getName()
  • social-bot/trunk/include/settings-page.php

    r2920353 r3096505  
    33    // Contenuto della pagina di configurazione
    44    echo '<div class="wrap">';
    5     echo '<h1>'.__('Social Bot settings', 'social-bot').'</h1>';
     5    echo '<h1>'.__('Social Bot settings', 'social-bot').'</h1>';
    66
    77    // Output del form di configurazione
     
    1717
    1818function social_bot_add_settings_page() {
    19     add_options_page(__('Social Bot settings'), __('Social Bot configuration'), 'manage_options', 'social_bot', 'social_bot_settings_page');
     19    add_options_page(__('Social Bot settings''), 'manage_options', 'social_bot', 'social_bot_settings_page');
    2020}
    2121add_action('admin_menu', 'social_bot_add_settings_page');
     
    6868// Callback per la sezione di configurazione
    6969function social_bot_section_messenger_callback() {
    70     echo __('By clicking on "Enable Facebook Messenger Bot", there will be additional options.', 'social-bot');
     70    echo __('By clicking on "Enable Facebook Messenger Bot", there will be additional options.', 'social-bot');
    7171}
    7272
     
    8585// Callback per la sezione di configurazione
    8686function social_bot_section_telegram_callback() {
    87     echo __('By clicking on "Enable Telegram Bot", there will be additional options.', 'social-bot');
     87    echo __('By clicking on "Enable Telegram Bot", there will be additional options.', 'social-bot');
    8888}
    8989
     
    102102// Callback per la sezione di configurazione
    103103function social_bot_dev_section_callback() {
    104     echo __('Select this option if you want to perform tests using var_dump. Useful if you use tools like Postman.', 'social-bot');
     104    echo __('Select this option if you want to perform tests using var_dump. Useful if you use tools like Postman.', 'social-bot');
    105105}
    106106
  • social-bot/trunk/part/form.php

    r2831393 r3096505  
    5959    </p>
    6060    <p class="meta-options scb_field">
    61         <label for="scb_error_msg"><?php echo __('Error message', 'social-bot'); ?></label>
     61        <label for="scb_error_msg"><?php echo __('Error message', 'social-bot'); ?></label>
    6262        <input id="scb_error_msg"
    6363            type="text"
     
    6666    </p>
    6767    <p class="meta-options scb_field">
    68         <label for="scb_delete_user_msg"><?php echo __('Message that subscribers can use to unsubscribe', 'social-bot'); ?></label>
     68        <label for="scb_delete_user_msg"><?php echo __('Message that subscribers can use to unsubscribe', 'social-bot'); ?></label>
    6969        <input id="scb_delete_user_msg"
    7070            type="text"
     
    7373    </p>
    7474</div>
    75 <span class="helper"><?php echo __('To create your own Facebook Messenger Bot you can do it on <a href="https://developers.facebook.com/apps/create/" target="_blank">the official Developer Facebook page', 'social-bot'); ?></a></span>
     75<span class="helper"><?php echo __('To create your own Facebook Messenger Bot you can do it on <a href="https://developers.facebook.com/apps/create/" target="_blank">the official Developer Facebook page', 'social-bot'); ?></a></span>
    7676<script>
    7777    function changetype(event) {
  • social-bot/trunk/part/form_choice_messenger_bot.php

    r2826719 r3096505  
    1212        if($post->ID==get_post_meta($postID, 'scb_messenger_post', true)) $select ="selected";
    1313?>
    14         <option value="<?php the_ID(); ?>" <?php echo $select; ?>><?php echo the_title_attribute( 'echo=0' ); ?></option>
     14        <option value="<?php the_ID(); ?>" <?php echo ; ?>><?php echo the_title_attribute( 'echo=0' ); ?></option>
    1515<?php endwhile; ?>
    1616</select>
  • social-bot/trunk/part/form_manage_error.php

    r2831393 r3096505  
    3333foreach($message_fail_list as $single_error) {
    3434    if(trim($single_error))
    35     echo '<div class="single_error" data-command="'.$single_error.'">
    36             <p class=" "><span>'.$single_error.'</span></p>
     35    echo '<div class="single_error" data-command="'..'">
     36            <p class=" "><span>'..'</span></p>
    3737            <ul class="btn-list">
    3838                <li class="add_package button" onclick="addFailMessage(event)">
    39                     '. __( 'Add Command', 'social-bot' ).'
     39                    '. __( 'Add Command', 'social-bot' ).'
    4040                </li>
    4141                <li class="add_package button" onclick="removeFailMessage(event)">
    42                     '. __( 'Remove Command', 'social-bot' ).'
     42                    '. __( 'Remove Command', 'social-bot' ).'
    4343                </li>
    4444            </ul>
  • social-bot/trunk/part/messengerbot_meta_item.php

    r2919317 r3096505  
    2121                    Type: '.scb_getOptionType(true, $messengerbotDetail['response_type']).'
    2222                    <span class="textBlock">Response:</span><textarea name="messengerbotDetails[%1$s][response]" class="textBlock" rows="4" cols="50" >%4$s</textarea>
    23                     <span class="categoryBlock">'.__('Category').':</span>'.scb_getOptionCategory(true, $response_cat).'
    24                     <span class="tagBlock">'.__('Tag').':</span>'.scb_getOptionTag(true, $response_tag).'
    25                     <p></p> <a href="#" class="remove-package">%5$s</a></div>', $c, $messengerbotDetail['command'], $messengerbotDetail['response_type'], $messengerbotDetail['response'], 'Remove' );
     23                    <span class="categoryBlock">'.').':</span>'.scb_getOptionCategory(true, $response_cat).'
     24                    <span class="tagBlock">'.').':</span>'.scb_getOptionTag(true, $response_tag).'
     25                    <p></p> <a href="#" class="remove-package">%5$s</a></div>', , 'Remove' );
    2626                    $c = $c +1;
    2727                }
     
    3131        ?>
    3232    <span id="output-package"></span>
    33     <a href="#" class="add_package button add_command"><?php __('Add Messenger Bot'); ?></a>
     33    <a href="#" class="add_package button add_command"><?php ot'); ?></a>
    3434    <script>
    3535        var $ =jQuery.noConflict();
  • social-bot/trunk/readme.txt

    r3089055 r3096505  
    66Requires at least: 5.0
    77Tested up to: 6.5.3
    8 Stable tag: 1.8
     8Stable tag: 1.8
    99License: GPLv2 or later
    1010
  • social-bot/trunk/social-bot.php

    r3089055 r3096505  
    33   Plugin Name: Social Bot
    44   description: A plugin to create response for Facebook Messenger bot
    5    Version: 1.8
     5   Version: 1.8
    66   Author: Matteo Enna
    77   Author URI: https://matteoenna.it/it/wordpress-work/
Note: See TracChangeset for help on using the changeset viewer.