Plugin Directory

Changeset 738400


Ignore:
Timestamp:
07/09/2013 06:03:23 PM (13 years ago)
Author:
cliffcrocker
Message:

Simplified regex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mpulse-real-user-measurement/trunk/mpulse-real-user-measurement.php

    r738380 r738400  
    5050    if (isset($_POST['submit'])) {
    5151        $mp_key = trim($_POST['mpulse_api_key']);
    52         $mp_pattern = '/[A-Z0-9]{5}\-[A-Z0-9]{5}\-[A-Z0-9]{5}\-[A-Z0-9]{5}\-[A-Z0-9]{5}/';
     52        $mp_pattern = '/^([A-Z0-9]{5}-){4}[A-Z0-9]{5}$/';
    5353        if (preg_match($mp_pattern, $mp_key)) {
    5454            update_option('mpulse_api_key', $mp_key);
    5555            echo "<div id=\"footer\" class=\"soasta_footer\"> <p>Your key has been updated.</p></div>";
    5656        } else {
    57             echo "<div id=\"footer\" class=\"soasta_footer\"> <p>Your API key is invalid! Format: A1A1A-B2B2B-C3C3C-D4D4D </p></div>";
     57            echo "<div id=\"footer\" class=\"soasta_footer\"> <p>Your API key is invalid! Format: A1A1A-B2B2B-C3C3C-D4D4Dl-E5E5E </p></div>";
    5858        }
    5959    }
     
    6565<h1>mPulse - Real User Measurement</h1>
    6666
    67 <p>Please enter your API KEY below. This can be found in your domain configuration within mPulse. If you do not yet have an mPulse account, you can <a href="http://www.soasta.com/free" target="new" title="Create a free mPulse account">set one up (For FREE!)</a></p>
     67<p>Please enter your API KEY below. This can be found in your domain configuration within mPulse. If you do not yet have an mPulse account, you can <a href="http://www.soasta.com/free" target="_blank" title="Create a free mPulse account">set one up (For FREE!)</a></p>
    6868        <form method="post" action="" class="soasta_form">
    6969            <input name="mpulse_api_key" type="text" id="mpulse_api_key" class="soasta_input" value="<?php echo get_option('mpulse_api_key');?>" maxlength="29" placeholder="A1A1A-B2B2B-C3C3C-D4D4D-E5E5E"/>
Note: See TracChangeset for help on using the changeset viewer.