Plugin Directory

Changeset 738380


Ignore:
Timestamp:
07/09/2013 05:29:22 PM (13 years ago)
Author:
cliffcrocker
Message:

Fixed indentations, added key validation, css tuning

Location:
mpulse-real-user-measurement/trunk
Files:
2 edited

Legend:

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

    r738117 r738380  
    88*/
    99
     10// Make sure we don't expose any info if called directly
     11if ( !function_exists( 'add_action' ) ) {
     12    echo 'Hi there!  I\'m just a plugin, not much I can do when called directly.';
     13    exit;
     14}
     15
    1016//Clean up after ourselves on delete
    1117function mpulse_cleanup() {
     
    1319}
    1420
    15 //Add submenu to plugin menue
     21//Add submenu to plugin menu
    1622function mpulse_plugin_config() {
    1723    add_submenu_page( 'plugins.php', 'mPulse Real User Measurement Configuration', 'mPulse RUM', 'manage_options', 'mpulse_plugin_page', 'mpulse_plugin_page' );
     
    2026//Add plugin action link to Plugin page for mPulse Settings
    2127function  mpulse_plugin_action_links($links, $file) {
    22     static $this_plugin;
     28    static $this_plugin;
    2329
    24     if (!$this_plugin) {
    25         $this_plugin = plugin_basename(__FILE__);
    26     }
     30    if (!$this_plugin) {
     31        $this_plugin = plugin_basename(__FILE__);
     32    }
    2733
    28     if ($file == $this_plugin) {
    29         // The "page" query string value must be equal to the slug
    30         // of the Settings admin page we defined earlier, which in
    31         // this case equals "myplugin-settings".
    32         $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=mpulse_plugin_page">Settings</a>';
    33         array_unshift($links, $settings_link);
    34     }
     34    if ($file == $this_plugin) {
     35        $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=mpulse_plugin_page">Settings</a>';
     36        array_unshift($links, $settings_link);
     37    }
    3538
    36     return $links;
     39    return $links;
    3740}
    3841
     
    4649
    4750    if (isset($_POST['submit'])) {
    48         $mp_key = trim($_POST['mpulse_api_key']);
    49         update_option('mpulse_api_key', $mp_key);
    50         ?><div id="footer" class="soasta_footer"> <p>Your key has been updated.</p></div><?php
     51        $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}/';
     53        if (preg_match($mp_pattern, $mp_key)) {
     54            update_option('mpulse_api_key', $mp_key);
     55            echo "<div id=\"footer\" class=\"soasta_footer\"> <p>Your key has been updated.</p></div>";
     56        } else {
     57            echo "<div id=\"footer\" class=\"soasta_footer\"> <p>Your API key is invalid! Format: A1A1A-B2B2B-C3C3C-D4D4D </p></div>";
     58        }
    5159    }
    52 
    5360?>
    5461
     
    5865<h1>mPulse - Real User Measurement</h1>
    5966
    60 <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 set this up <a href="http://www.soasta.com/free" target="new">here.</a> (For FREE!).</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="new" title="Create a free mPulse account">set one up (For FREE!)</a></p>
    6168        <form method="post" action="" class="soasta_form">
    6269            <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"/>
     
    7279function mpulse_add_rum_header() {
    7380?>   
    74   <script type='text/javascript'>(function(){
    75   var dom,doc,where,iframe = document.createElement('iframe');
    76   iframe.src = "javascript:false";
    77   (iframe.frameElement || iframe).style.cssText = "width: 0; height: 0; border: 0";
    78   where = document.getElementsByTagName('script')[0];
    79   where.parentNode.insertBefore(iframe, where);
    80   try {
    81     doc = iframe.contentWindow.document;
    82   } catch(e) {
    83     dom = document.domain;
    84     iframe.src="javascript:var d=document.open();d.domain='"+dom+"';void(0);";
    85     doc = iframe.contentWindow.document;
    86   }
    87   doc.open()._l = function() {
    88     var js = this.createElement("script");
    89     if(dom) this.domain = dom;
    90     js.id = "boomr-if-as";
    91     js.src = '//c.go-mpulse.net/boomerang/' +
    92     '<?php echo get_option('mpulse_api_key');?>';
    93     BOOMR_lstart=new Date().getTime();
    94     this.body.appendChild(js);
    95   };
    96   doc.write('<body onload="document._l();">');
    97   doc.close();
    98   })();</script>;
     81    <script type='text/javascript'>(function(){
     82    var dom,doc,where,iframe = document.createElement('iframe');
     83    iframe.src = "javascript:false"; iframe.title = ""; iframe.role="presentation";
     84    (iframe.frameElement || iframe).style.cssText = "width: 0; height: 0; border: 0";
     85    where = document.getElementsByTagName('script')[0];
     86    where.parentNode.insertBefore(iframe, where);
     87    try {
     88        doc = iframe.contentWindow.document;
     89    } catch(e) {
     90    dom = document.domain;
     91    iframe.src="javascript:var d=document.open();d.domain='"+dom+"';void(0);";
     92    doc = iframe.contentWindow.document;
     93    }
     94    doc.open()._l = function() {
     95    var js = this.createElement("script");
     96    if(dom) this.domain = dom;
     97    js.id = "boomr-if-as";
     98    js.src = '//c.go-mpulse.net/boomerang/' +
     99    '<?php echo get_option('mpulse_api_key');?>';
     100    BOOMR_lstart=new Date().getTime();
     101    this.body.appendChild(js);
     102    };
     103    doc.write('<body onload="document._l();">');
     104    doc.close();
     105    })();</script>;
    99106
    100107<?php
     
    109116    register_uninstall_hook(__FILE__, 'mpulse_cleanup');
    110117}
    111 
    112 // Make sure we don't expose any info if called directly
    113 if ( !function_exists( 'add_action' ) ) {
    114     echo 'Hi there!  I\'m just a plugin, not much I can do when called directly.';
    115     exit;
    116 }
    117 
    118118?>
  • mpulse-real-user-measurement/trunk/soasta_wp.css

    r738117 r738380  
    44
    55.soasta_container {
    6     margin: 50px 0 0 10px;
    7     width: 500px;
    8     font-size: 14px;
     6    margin: 50px 0 0 10px;
     7    width: 500px;
     8    font-size: 1.000em;
    99    line-height: 1.4;
    1010    color: #565656;
     
    1414   
    1515.soasta_footer {
    16    position:absolute;
    17    bottom:0;
    18    width:500px;
    19    height:40px;   /* Height of the footer */
    20    margin: 10px 0px 0px 10px;
    21    padding-left: 10px;
    22    border: 2px solid red;
    23    font-size: 14px;
    24    line-height: 1.4;
    25    color: white;
    26    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    27    background:#42B4E6;
     16    position:absolute;
     17    bottom:0;
     18    width:500px;
     19    height:40px;   /* Height of the footer */
     20    margin: 10px 0px 0px 10px;
     21    padding-left: 10px;
     22    border: 2px solid red;
     23    font-size: 1.000em;
     24    line-height: 1.4em;
     25    color: white;
     26    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
     27    background:#42B4E6;
    2828}
    2929   
    3030.soasta_container h1 {
    3131    font-size: 2.5em;
    32     line-height: 1.333em;
     32    line-height: 1.4em;
    3333    font-weight: 200;
    3434    color: #8F8F8F;
     
    3737.soasta_form { 
    3838    background-color: #d8d9da;
    39     border: 1px solid #a8a8a8;
    40     margin-top: 20px;
    41     padding-left: 5px;
    42     padding-right: 5px;
    43     padding-top: 5px;
    44     padding-bottom: 5px;
     39    border: 1px solid #a8a8a8;
     40    margin-top: 20px;
     41    padding: 5px;
    4542}
    4643
    4744.soasta_input {
    48     font-size: 14px;
     45    font-size: 1.000em;
    4946    width: 390px;
    5047}
     
    5350    background:#42B4E6;
    5451    border: 1px solid #a8a8a8;
    55     -webkit-border-radius: 6px 6px 6px 6px;
    56     -moz-border-radius: 6px;
    57     border-radius: 6px;
    58     margin-left: 6px;
    59     color: white;
    60     font-size: 14px;
     52        border-radius: 6px;
     53    margin-left: 6px;
     54    color: white;
     55    font-size: 1.000em;
    6156    width: 80px;
    6257}
Note: See TracChangeset for help on using the changeset viewer.