Plugin Directory

Changeset 2710735


Ignore:
Timestamp:
04/17/2022 12:44:06 PM (4 years ago)
Author:
zonnix
Message:

edits

Location:
typed/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • typed/trunk/readme.txt

    r2694968 r2710735  
    44Requires at least: 3.0
    55Tested up to: 5.9.2
    6 Stable tag: 5.9.2
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6060* Add support to wordpress version 4.9.4
    6161
    62 = 1.1.4 =
     62= 1.2 =
    6363* Add support to wordpress version 5.9.2
    6464* Add support to PHP 8
  • typed/trunk/typed.php

    r2694968 r2710735  
    33  Plugin Name: Typed
    44  Description: Typed Plugin created based on "typed.js" a jQuery plugin that types. Enter in any string, and watch it type at the speed you've set, backspace what it's typed, and begin a new sentence for however many strings you've set.
    5   Version: 1.1.5
     5  Version: 1.2
    66  Author: zonnix
    77  Author URI: http://zonnix.net
     
    8585                $strings .= $string . ';#$#;';
    8686            }
    87             $strings = trim($strings, ';#$#;');
    88             $font_size = get_post_meta($post_id, 'font_size', true);
    89             $font_type = get_post_meta($post_id, 'font_type', true);
    90             $color = get_post_meta($post_id, 'font_color', true);
    91             $font_weight = get_post_meta($post_id, 'font_weight', true);
    92             $anchor_color = get_post_meta($post_id, 'anchor_color', true);
    93             $cursor_color = get_post_meta($post_id, 'cursor_color', true);
     87            $strings = esc_html(trim($strings, ';#$#;'));
     88            $font_size = esc_html(get_post_meta($post_id, 'font_size', true));
     89            $font_type = esc_html(get_post_meta($post_id, 'font_type', true));
     90            $color = esc_html(get_post_meta($post_id, 'font_color', true));
     91            $font_weight = esc_html(get_post_meta($post_id, 'font_weight', true));
     92            $anchor_color = esc_html(get_post_meta($post_id, 'anchor_color', true));
     93            $cursor_color = esc_html(get_post_meta($post_id, 'cursor_color', true));
    9494            ?>
    9595            <style>
    96                
     96
    9797                <?php if (get_post_meta($post_id, 'blinking_cursor', true) == 'yes'): ?>
    98                 .typed-div-<?php echo $post_id; ?> .typed-cursor{
    99                     opacity: 1;
    100                     -webkit-animation: blink 0.7s infinite;
    101                     -moz-animation: blink 0.7s infinite;
    102                     animation: blink 0.7s infinite;
    103                 }
    104                 @keyframes blink{
    105                     0% { opacity:1; }
    106                     50% { opacity:0; }
    107                     100% { opacity:1; }
    108                 }
    109                 @-webkit-keyframes blink{
    110                     0% { opacity:1; }
    111                     50% { opacity:0; }
    112                     100% { opacity:1; }
    113                 }
    114                 @-moz-keyframes blink{
    115                     0% { opacity:1; }
    116                     50% { opacity:0; }
    117                     100% { opacity:1; }
    118                 }
     98                    .typed-div-<?php echo $post_id; ?> .typed-cursor{
     99                        opacity: 1;
     100                        -webkit-animation: blink 0.7s infinite;
     101                        -moz-animation: blink 0.7s infinite;
     102                        animation: blink 0.7s infinite;
     103                    }
     104                    @keyframes blink{
     105                        0% { opacity:1; }
     106                        50% { opacity:0; }
     107                        100% { opacity:1; }
     108                    }
     109                    @-webkit-keyframes blink{
     110                        0% { opacity:1; }
     111                        50% { opacity:0; }
     112                        100% { opacity:1; }
     113                    }
     114                    @-moz-keyframes blink{
     115                        0% { opacity:1; }
     116                        50% { opacity:0; }
     117                        100% { opacity:1; }
     118                    }
    119119                <?php endif; ?>
    120120                .typed-div-<?php echo $post_id; ?> {
     
    123123                    endif;
    124124                    ?>
    125                      <?php if ($font_type): ?>font-family: <?php
    126                         echo $font_type . ';';
    127                     endif;
    128                     ?>
     125                        <?php if ($font_type): ?>font-family: <?php
     126                            echo $font_type . ';';
     127                        endif;
     128                        ?>
    129129                        <?php if ($color): ?>color: <?php
    130130                            echo $color . ';';
     
    152152            </style>
    153153            <div class="typed-div-<?php echo $post_id; ?>">   
    154                 <span style="white-space:pre;word-wrap: break-word;line-height: 1;" class="typed_perview_div" data-cursor-char="<?php echo get_post_meta($post_id, 'cursor_char', true); ?>" data-cursor="<?php echo get_post_meta($post_id, 'show_cursor', true); ?>" data-strings="<?php echo $strings; ?>" data-speed="<?php echo get_post_meta($post_id, 'type_speed', true); ?>" data-delay="<?php echo get_post_meta($post_id, 'start_delay', true); ?>" data-back-delay="<?php echo get_post_meta($post_id, 'back_delay', true); ?>" data-back-speed="<?php echo get_post_meta($post_id, 'back_speed', true); ?>" data-loop="<?php echo get_post_meta($post_id, 'typed_loop', true); ?>"></span>
     154                <span style="white-space:pre;word-wrap: break-word;line-height: 1;" class="typed_perview_div" data-cursor-char="<?php echo esc_attr(get_post_meta($post_id, 'cursor_char', true)); ?>" data-cursor="<?php echo esc_attr(get_post_meta($post_id, 'show_cursor', true)); ?>" data-strings="<?php echo esc_attr($strings); ?>" data-speed="<?php echo esc_attr(get_post_meta($post_id, 'type_speed', true)); ?>" data-delay="<?php echo esc_attr(get_post_meta($post_id, 'start_delay', true)); ?>" data-back-delay="<?php echo esc_attr(get_post_meta($post_id, 'back_delay', true)); ?>" data-back-speed="<?php echo esc_attr(get_post_meta($post_id, 'back_speed', true)); ?>" data-loop="<?php echo esc_attr(get_post_meta($post_id, 'typed_loop', true)); ?>"></span>
    155155            </div>
    156156            <br><pre class="update-nag shorCode">Generated Shortcode: [typed id='<?php echo $post_id; ?>']</pre>
     
    177177                                foreach ($typed_strings as $string):
    178178                                    ?>
    179                                     <p><input type="text" name="typed_strings[]" value="<?php echo str_replace('"', "'", $string); ?>"/> <a href="javascript:void(0)" class="add_typed_string button-secondary">+</a> <?php if ($index > 0): ?><a href="javascript:void(0)" class="remove_typed_string button-secondary">-</a><?php endif; ?></p>
     179                                    <p><input type="text" name="typed_strings[]" value="<?php echo esc_attr(str_replace('"', "'", $string)); ?>"/> <a href="javascript:void(0)" class="add_typed_string button-secondary">+</a> <?php if ($index > 0): ?><a href="javascript:void(0)" class="remove_typed_string button-secondary">-</a><?php endif; ?></p>
    180180                                    <?php
    181181                                    $index++;
     
    192192                        <td>Type Speed</td>
    193193                        <td>
    194                             <input type="text" value="<?php echo get_post_meta($post_id, 'type_speed', true) ? get_post_meta($post_id, 'type_speed', true) : 0; ?>" name="type_speed"/>
     194                            <input type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'type_speed', true)) ? esc_attr(get_post_meta($post_id, 'type_speed', true)) : 0; ?>" name="type_speed"/>
    195195                            <br><span class="description">type speed in milliseconds </span>
    196196                        </td>
     
    199199                        <td>Start Delay</td>
    200200                        <td>
    201                             <input type="text" value="<?php echo get_post_meta($post_id, 'start_delay', true) ? get_post_meta($post_id, 'start_delay', true) : 0; ?>" name="start_delay"/>
     201                            <input type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'start_delay', true)) ? esc_attr(get_post_meta($post_id, 'start_delay', true)) : 0; ?>" name="start_delay"/>
    202202                            <br><span class="description">time before typing starts in milliseconds </span>
    203203                        </td>
     
    206206                        <td>Back Speed</td>
    207207                        <td>
    208                             <input type="text" value="<?php echo get_post_meta($post_id, 'back_speed', true) ? get_post_meta($post_id, 'back_speed', true) : 0; ?>" name="back_speed"/>
     208                            <input type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'back_speed', true)) ? esc_attr(get_post_meta($post_id, 'back_speed', true)) : 0; ?>" name="back_speed"/>
    209209                            <br><span class="description">backspacing speed in milliseconds </span>
    210210                        </td>
     
    213213                        <td>Back Delay</td>
    214214                        <td>
    215                             <input type="text" value="<?php echo get_post_meta($post_id, 'back_delay', true) ? get_post_meta($post_id, 'back_delay', true) : 500; ?>" name="back_delay"/>
     215                            <input type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'back_delay', true)) ? esc_attr(get_post_meta($post_id, 'back_delay', true)) : 500; ?>" name="back_delay"/>
    216216                            <br><span class="description">time before backspacing in milliseconds </span>
    217217                        </td>
     
    234234                        <td>Cursor Char</td>
    235235                        <td>
    236                             <input type="text" value="<?php echo get_post_meta($post_id, 'cursor_char', true) ? get_post_meta($post_id, 'cursor_char', true) : '|'; ?>" name="cursor_char"/>
     236                            <input type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'cursor_char', true)) ? esc_attr(get_post_meta($post_id, 'cursor_char', true)) : '|'; ?>" name="cursor_char"/>
    237237                            <br><span class="description">character for cursor</span>
    238238                        </td>
     
    258258                        <td style="width: 15%;">Font Size</td>
    259259                        <td>
    260                             <input type="text" placeholder="eg. 24" value="<?php echo get_post_meta($post_id, 'font_size', true); ?>" name="font_size"/>
     260                            <input type="text" placeholder="eg. 24" value="<?php echo esc_attr(get_post_meta($post_id, 'font_size', true)); ?>" name="font_size"/>
    261261                        </td>
    262262                    </tr>
     
    264264                        <td style="width: 15%;">Font Family</td>
    265265                        <td>
    266                             <input type="text" placeholder='Helvetica,Arial,sans-serif' value="<?php echo get_post_meta($post_id, 'font_type', true); ?>" name="font_type"/>
     266                            <input type="text" placeholder='Helvetica,Arial,sans-serif' value="<?php echo esc_attr(get_post_meta($post_id, 'font_type', true)); ?>" name="font_type"/>
    267267                        </td>
    268268                    </tr>
     
    270270                        <td style="width: 15%;">Font Weight</td>
    271271                        <td>
    272                             <input type="text" placeholder="eg. 300" value="<?php echo get_post_meta($post_id, 'font_weight', true); ?>" name="font_weight"/>
     272                            <input type="text" placeholder="eg. 300" value="<?php echo esc_attr(get_post_meta($post_id, 'font_weight', true)); ?>" name="font_weight"/>
    273273                        </td>
    274274                    </tr>
     
    276276                        <td>Color</td>
    277277                        <td>
    278                             <input class="typed-color-field" type="text" value="<?php echo get_post_meta($post_id, 'font_color', true); ?>" name="font_color"/>
     278                            <input class="typed-color-field" type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'font_color', true)); ?>" name="font_color"/>
    279279                        </td>
    280280                    </tr>
     
    282282                        <td>Anchor Color</td>
    283283                        <td>
    284                             <input class="typed-color-field" type="text" value="<?php echo get_post_meta($post_id, 'anchor_color', true); ?>" name="anchor_color"/>
     284                            <input class="typed-color-field" type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'anchor_color', true)); ?>" name="anchor_color"/>
    285285                        </td>
    286286                    </tr>
     
    288288                        <td>Cursor Color</td>
    289289                        <td>
    290                             <input class="typed-color-field" type="text" value="<?php echo get_post_meta($post_id, 'cursor_color', true); ?>" name="cursor_color"/>
     290                            <input class="typed-color-field" type="text" value="<?php echo esc_attr(get_post_meta($post_id, 'cursor_color', true)); ?>" name="cursor_color"/>
    291291                        </td>
    292292                    </tr>                   
     
    319319            if (isset($_POST['post_type']) && 'typed' == $_POST['post_type']) {
    320320                if (isset($_POST['font_size']))
    321                     update_post_meta($post_id, 'font_size', $_POST['font_size']);
     321                    update_post_meta($post_id, 'font_size', sanitize_text_field($_POST['font_size']));
    322322
    323323                if (isset($_POST['font_type']))
    324                     update_post_meta($post_id, 'font_type', $_POST['font_type']);
     324                    update_post_meta($post_id, 'font_type', sanitize_text_field($_POST['font_type']));
    325325
    326326                if (isset($_POST['font_color']))
    327                     update_post_meta($post_id, 'font_color', $_POST['font_color']);
     327                    update_post_meta($post_id, 'font_color', sanitize_text_field($_POST['font_color']));
    328328
    329329                if (isset($_POST['anchor_color']))
    330                     update_post_meta($post_id, 'anchor_color', $_POST['anchor_color']);
     330                    update_post_meta($post_id, 'anchor_color', sanitize_text_field($_POST['anchor_color']));
    331331
    332332                if (isset($_POST['cursor_color']))
    333                     update_post_meta($post_id, 'cursor_color', $_POST['cursor_color']);
     333                    update_post_meta($post_id, 'cursor_color', sanitize_text_field($_POST['cursor_color']));
    334334
    335335                if (isset($_POST['font_weight']))
    336                     update_post_meta($post_id, 'font_weight', $_POST['font_weight']);
    337 
    338                 if (isset($_POST['typed_strings'])){
    339                     $_POST['typed_strings'] = array_map( 'esc_attr', $_POST['typed_strings'] );               
     336                    update_post_meta($post_id, 'font_weight', sanitize_text_field($_POST['font_weight']));
     337
     338                if (isset($_POST['typed_strings'])) {
     339                    $_POST['typed_strings'] = array_map('esc_attr', $_POST['typed_strings']);
    340340                    update_post_meta($post_id, 'typed_strings', $_POST['typed_strings']);
    341341                }
    342                
     342
    343343                if (isset($_POST['type_speed']))
    344                     update_post_meta($post_id, 'type_speed', $_POST['type_speed']);
     344                    update_post_meta($post_id, 'type_speed', sanitize_text_field($_POST['type_speed']));
    345345
    346346                if (isset($_POST['start_delay']))
    347                     update_post_meta($post_id, 'start_delay', $_POST['start_delay']);
     347                    update_post_meta($post_id, 'start_delay', sanitize_text_field($_POST['start_delay']));
    348348
    349349                if (isset($_POST['back_speed']))
    350                     update_post_meta($post_id, 'back_speed', $_POST['back_speed']);
     350                    update_post_meta($post_id, 'back_speed', sanitize_text_field($_POST['back_speed']));
    351351
    352352                if (isset($_POST['back_delay']))
    353                     update_post_meta($post_id, 'back_delay', $_POST['back_delay']);
     353                    update_post_meta($post_id, 'back_delay', sanitize_text_field($_POST['back_delay']));
    354354
    355355                if (isset($_POST['typed_loop']))
    356                     update_post_meta($post_id, 'typed_loop', $_POST['typed_loop']);
     356                    update_post_meta($post_id, 'typed_loop', sanitize_text_field($_POST['typed_loop']));
    357357                else
    358358                    update_post_meta($post_id, 'typed_loop', 'no');
    359359
    360360                if (isset($_POST['show_cursor']))
    361                     update_post_meta($post_id, 'show_cursor', $_POST['show_cursor']);
     361                    update_post_meta($post_id, 'show_cursor', sanitize_text_field($_POST['show_cursor']));
    362362                else
    363363                    update_post_meta($post_id, 'show_cursor', 'no');
    364364
    365365                if (isset($_POST['blinking_cursor']))
    366                     update_post_meta($post_id, 'blinking_cursor', $_POST['blinking_cursor']);
     366                    update_post_meta($post_id, 'blinking_cursor', sanitize_text_field($_POST['blinking_cursor']));
    367367                else
    368368                    update_post_meta($post_id, 'blinking_cursor', 'no');
    369                
     369
    370370                if (isset($_POST['cursor_char']))
    371                     update_post_meta($post_id, 'cursor_char', $_POST['cursor_char']);
     371                    update_post_meta($post_id, 'cursor_char', sanitize_text_field($_POST['cursor_char']));
    372372            }
    373373        }
     
    391391                $typed = get_post($post_id);
    392392                if ($typed) :
    393                     $font_size = get_post_meta($post_id, 'font_size', true);
    394                     $font_type = get_post_meta($post_id, 'font_type', true);
    395                     $color = get_post_meta($post_id, 'font_color', true);
    396                     $font_weight = get_post_meta($post_id, 'font_weight', true);
    397                     $anchor_color = get_post_meta($post_id, 'anchor_color', true);
    398                     $cursor_color = get_post_meta($post_id, 'cursor_color', true);
     393                    $font_size = esc_html(get_post_meta($post_id, 'font_size', true));
     394                    $font_type = esc_html(get_post_meta($post_id, 'font_type', true));
     395                    $color = esc_html(get_post_meta($post_id, 'font_color', true));
     396                    $font_weight = esc_html(get_post_meta($post_id, 'font_weight', true));
     397                    $anchor_color = esc_html(get_post_meta($post_id, 'anchor_color', true));
     398                    $cursor_color = esc_html(get_post_meta($post_id, 'cursor_color', true));
    399399                    $typed_strings = get_post_meta($post_id, 'typed_strings', true);
    400400                    if (!$typed_strings)
     
    405405                        $strings .= $string . ';#$#;';
    406406                    }
    407                     $strings = trim($strings, ';#$#;');
     407                    $strings = esc_html(trim($strings, ';#$#;'));
    408408                    ?>
    409409                    <style>
     
    413413                            endif;
    414414                            ?>
    415                             <?php if ($font_type): ?>font-family: <?php
    416                                 echo $font_type . ';';
    417                             endif;
    418                             ?>
     415                                <?php if ($font_type): ?>font-family: <?php
     416                                    echo $font_type . ';';
     417                                endif;
     418                                ?>
    419419                                <?php if ($color): ?>color: <?php
    420420                                    echo $color . ';';
     
    440440                            ?>
    441441                        }
    442                        
     442
    443443                        <?php if (get_post_meta($post_id, 'blinking_cursor', true) == 'yes'): ?>
    444444                            .typed-div-<?php echo $post_id; ?> .typed-cursor{
     
    466466                    </style>
    467467                    <div class="typed-div-<?php echo $post_id; ?>">                       
    468                         <span style="white-space:pre;" class="typed_perview_div" data-cursor-char="<?php echo get_post_meta($post_id, 'cursor_char', true); ?>" data-cursor="<?php echo get_post_meta($post_id, 'show_cursor', true); ?>" data-strings="<?php echo $strings; ?>" data-speed="<?php echo get_post_meta($post_id, 'type_speed', true); ?>" data-delay="<?php echo get_post_meta($post_id, 'start_delay', true); ?>" data-back-delay="<?php echo get_post_meta($post_id, 'back_delay', true); ?>" data-back-speed="<?php echo get_post_meta($post_id, 'back_speed', true); ?>" data-loop="<?php echo get_post_meta($post_id, 'typed_loop', true); ?>"></span>
     468                        <span style="white-space:pre;" class="typed_perview_div" data-cursor-char="<?php echo esc_attr(get_post_meta($post_id, 'cursor_char', true)); ?>" data-cursor="<?php echo esc_attr(get_post_meta($post_id, 'show_cursor', true)); ?>" data-strings="<?php echo esc_attr($strings); ?>" data-speed="<?php echo esc_attr(get_post_meta($post_id, 'type_speed', true)); ?>" data-delay="<?php echo esc_attr(get_post_meta($post_id, 'start_delay', true)); ?>" data-back-delay="<?php echo esc_attr(get_post_meta($post_id, 'back_delay', true)); ?>" data-back-speed="<?php echo esc_attr(get_post_meta($post_id, 'back_speed', true)); ?>" data-loop="<?php echo esc_attr(get_post_meta($post_id, 'typed_loop', true)); ?>"></span>
    469469                    </div>
    470470                    <?php
Note: See TracChangeset for help on using the changeset viewer.