Plugin Directory

Changeset 1909568


Ignore:
Timestamp:
07/16/2018 02:22:02 AM (8 years ago)
Author:
alexmacarthur
Message:

Update to version 1.0.2.

Location:
wp-typeit
Files:
154 added
9 edited

Legend:

Unmodified
Added
Removed
  • wp-typeit/trunk/composer.json

    r1900108 r1909568  
    55  "minimum-stability": "stable",
    66  "license": "GPL-2.0",
    7   "version": "1.0.1",
     7  "version": "1.0.2",
    88  "authors": [
    99    {
  • wp-typeit/trunk/readme.txt

    r1900108 r1909568  
    44Donate link: paypal.me/alexmacarthur
    55Tags: typewriter effect, text effect, text animation
     6Requires PHP: 5.6
    67Requires at least: 4.0
    7 Tested up to: 4.9.6
    8 Stable tag: 1.0.1
     8Tested up to: 4.9.7
     9Stable tag: 1.0.2
    910License: GPLv2 or later
    1011License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5051`
    5152
    52 = Defing Strings in an SEO-Friendly Way =
     53= Define Strings in an SEO-Friendly Way =
    5354As demonstrated, you can define a string to be typed by passing it in as a "strings" attribute. However, you may also define them by passing them inside of two enclosing shortcode tags:
    5455
     
    8283* Fix bug causing camel-cased shortcode attributes to work improperly.
    8384
     85= 1.0.2 =
     86* Improve code structure.
     87* Make code more easily hookable for developers.
     88
    8489== Feedback ==
    8590
  • wp-typeit/trunk/src/Utilities.php

    r1900108 r1909568  
    33namespace TypeIt;
    44
    5 class Utilities {
     5class Utilities
     6{
    67
    7     public static function get_typed_options($options = array()) {
     8    public static function get_typed_options($options = array())
     9    {
    810
    9         //-- Weird way of ensuring each value matches the type of the defaults.
    10         $formattedOptions = array();
     11        //-- Weird way of ensuring each value matches the type of the defaults.
     12        $formattedOptions = array();
    1113
    12         foreach($options as $key => $value) {
     14        foreach ($options as $key => $value) {
    1315
    14             //-- Lowercase this because shortcode attributes MUST be lowercase.
    15             $key = strtolower($key);
     16            //-- Lowercase this because shortcode attributes MUST be lowercase.
     17            $key = strtolower($key);
    1618
    17             $default = Store::get('option_defaults')[$key];
     19            $defaults = Store::get('option_defaults');
    1820
    19             //-- Make sure the given key is set in case it needs capital letters for JS use.
     21            //-- @todo: add test!
     22            if (!isset($defaults[$key])) {
     23                continue;
     24            }
     25           
     26            $default = $defaults[$key];
     27           
     28            //-- Make sure the given key is set in case it needs capital letters for JS use.
    2029            $givenKey = isset($default['js_key']) ? $default['js_key'] : $key;
     30           
     31            //-- If we've designated this can have many values (like 'strings'), enforce array type.
     32            $type = isset($default['can_have_many']) && $default['can_have_many']
     33            ? 'array'
     34            : gettype($default['default_value']);
    2135
    22             $type = gettype($default['default_value']);
     36            switch ($type) {
     37                case 'string':
     38                    $formattedOptions[$givenKey] = (string) $value;
     39                    break;
     40                case 'integer':
     41                    $formattedOptions[$givenKey] = (int) $value;
     42                    break;
     43                case 'array':
     44                    $formattedOptions[$givenKey] = (array) $value;
     45                    break;
     46                case 'boolean':
    2347
    24             switch($type) {
    25                 case 'string':
    26                     $formattedOptions[$givenKey] = (string) $value;
    27                     break;
    28                 case 'integer':
    29                     $formattedOptions[$givenKey] = (int) $value;
    30                     break;
    31                 case 'array':
    32                     $formattedOptions[$givenKey] = (array) $value;
    33                     break;
    34                 case 'boolean':
     48                    if (gettype($value) === 'boolean') {
     49                        $formattedOptions[$givenKey] = $value;
     50                        break;
     51                    }
    3552
    36                     if(gettype($value) === 'boolean') {
    37                         $formattedOptions[$givenKey] = $value;
    38                         break;
    39                     }
     53                    if (gettype($value) === 'string') {
     54                        $formattedOptions[$givenKey] = in_array($value, array('true', 'on')) ? true : false;
     55                    }
    4056
    41                     if(gettype($value) === 'string') {
    42                         $formattedOptions[$givenKey] = in_array($value, array('true', 'on')) ? true : false;
    43                     }
     57                    break;
    4458
    45                     break;
    46                    
    47                 default:
    48                     if(is_numeric($value)) {
    49                         $formattedOptions[$givenKey] = (int) $value;
    50                     } else {
    51                         $formattedOptions[$givenKey] = $value;
    52                     }
    53             }
    54         }
     59                default:
     60                    if (is_numeric($value)) {
     61                        $formattedOptions[$givenKey] = (int) $value;
     62                    } else {
     63                        $formattedOptions[$givenKey] = $value;
     64                    }
     65            }
     66        }
    5567
    56         return $formattedOptions;
    57     }
     68        return $formattedOptions;
     69    }
    5870}
  • wp-typeit/trunk/src/default-options.php

    r1900108 r1909568  
    1212        "input_type" => "text",
    1313        "required" => true,
     14        "can_have_many" => true
    1415    ),
    1516
  • wp-typeit/trunk/src/hooks/shortcode.php

    r1900108 r1909568  
    44
    55add_shortcode('typeit', '\TypeIt\register_shortcode');
     6add_filter('typeit:shortcode_atts', '\TypeIt\convert_to_string');
    67
    78function register_shortcode($atts, $content = '') {
     
    2223    return '<span id="' . $id . '">' . $content . '</span>';
    2324}
     25
     26function convert_to_string($args) {
     27
     28    //-- Ensure that for the free version, just a single simple string is passed.
     29    $args["strings"] = $args["strings"][0];
     30
     31    //-- Make sure break tags don't have closing slash.
     32    $args["strings"] = str_replace("<br />", "<br>", $args["strings"]);
     33
     34    return $args;
     35}
  • wp-typeit/trunk/typeit.php

    r1900108 r1909568  
    44* Plugin URI: https://typeitjs.com
    55* Description: Easily create and manage typewriter effects using the JavaScript utility, TypeIt.
    6 * Version: 1.0.1
     6* Version: 1.0.2
    77* Author: Alex MacArthur
    88* Author URI: https://macarthur.me
     
    1010* License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111*/
     12
    1213namespace TypeIt;
    1314
     
    3536
    3637      require_once($realpath . '/src/hooks/shortcode.php');
    37 
    38       add_filter( 'plugin_row_meta', array($this, 'add_plugin_meta'), 10, 4);
    39       add_action( 'wp_enqueue_scripts', array($this, 'set_up_front_styles_and_scripts' ));
    40       add_action( 'wp_head', array($this, 'insert_header_comment'));
     38      require_once($realpath . '/src/hooks/plugin-meta.php');
     39      require_once($realpath . '/src/hooks/enqueue-assets.php');
    4140    }
    42 
    43     public function add_plugin_meta($plugin_meta, $plugin_file, $plugin_data, $status) {
    44       if(strpos($plugin_file, 'wp-typeit') === false) return $plugin_meta;
    45       $plugin_meta[] = '<a href="https://typeitjs.com">Visit the TypeIt Website</a>';
    46       return $plugin_meta;
    47     }
    48 
    49     /**
    50      * Spit out a nice logo in the site's header.
    51      *
    52      * @return void
    53      */
    54     public static function insert_header_comment() {
    55       echo "
    56 <!--
    57   This site uses TypeIt, the most versatile animated typing utility on the planet.
    58  
    59   https://typeitjs.com
    60   ______               ___ _   
    61   |_   _|  _ _ __  ___|_ _| |_
    62     | || || | '_ \/ -_)| ||  _|
    63     |_| \_, | .__/\___|___|\__|
    64         |__/|_|               
    65 -->\n\n";
    66     }
    67 
    68     public function set_up_front_styles_and_scripts() {
    69       wp_register_script(
    70         'typeit',
    71         'https://cdnjs.cloudflare.com/ajax/libs/typeit/' . Store::get('typeit_version') . '/typeit.min.js',
    72         array(),
    73         null,
    74         true );
    75     }
     41   
    7642  }
    7743
  • wp-typeit/trunk/vendor/autoload.php

    r1900108 r1909568  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit4ddb7cf317f1be52666fe7f05c97ec7a::getLoader();
     7return ComposerAutoloaderInit8220111dcb269efe2ea897f75c6b3cac::getLoader();
  • wp-typeit/trunk/vendor/composer/autoload_real.php

    r1900108 r1909568  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4ddb7cf317f1be52666fe7f05c97ec7a
     5class ComposerAutoloaderInit8220111dcb269efe2ea897f75c6b3cac
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit4ddb7cf317f1be52666fe7f05c97ec7a', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInit8220111dcb269efe2ea897f75c6b3cac', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit4ddb7cf317f1be52666fe7f05c97ec7a', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit8220111dcb269efe2ea897f75c6b3cac', 'loadClassLoader'));
    2525
    2626        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInit4ddb7cf317f1be52666fe7f05c97ec7a::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInit8220111dcb269efe2ea897f75c6b3cac::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
  • wp-typeit/trunk/vendor/composer/autoload_static.php

    r1900108 r1909568  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4ddb7cf317f1be52666fe7f05c97ec7a
     7class ComposerStaticInit8220111dcb269efe2ea897f75c6b3cac
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3737    {
    3838        return \Closure::bind(function () use ($loader) {
    39             $loader->prefixLengthsPsr4 = ComposerStaticInit4ddb7cf317f1be52666fe7f05c97ec7a::$prefixLengthsPsr4;
    40             $loader->prefixDirsPsr4 = ComposerStaticInit4ddb7cf317f1be52666fe7f05c97ec7a::$prefixDirsPsr4;
     39            $loader->prefixLengthsPsr4 = ComposerStaticInit8220111dcb269efe2ea897f75c6b3cac::$prefixLengthsPsr4;
     40            $loader->prefixDirsPsr4 = ComposerStaticInit8220111dcb269efe2ea897f75c6b3cac::$prefixDirsPsr4;
    4141
    4242        }, null, ClassLoader::class);
Note: See TracChangeset for help on using the changeset viewer.