Plugin Directory

Changeset 991121


Ignore:
Timestamp:
09/16/2014 02:45:45 PM (11 years ago)
Author:
tjsantilo
Message:

Fixed missing bracket in new hook

Location:
because/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • because/trunk/README.txt

    r987352 r991121  
    77Tested up to: 4.0
    88<<<<<<< .mine
    9 Stable tag: 1.2.8
     9Stable tag: 1.2.9
    1010=======
    11 Stable tag: 1.2.8
     11Stable tag: 1.2.9
    1212>>>>>>> .r969865
    1313License: GPLv2 or later
  • because/trunk/social-polling.php

    r987357 r991121  
    108108 */
    109109
    110 register_activation_hook( __FILE__, array( 'Social_Polling', 'activate' ) );
    111 
    112 register_deactivation_hook( __FILE__, array( 'Social_Polling', 'deactivate' ) );
    113 
    114 
    115 
    116 
    117 function social_poll_activate() {
    118 ob_start();
    119 //Site Name
    120 $site_name = urlencode(get_option ('blogname'));
    121 //Site Url
    122 $site_url =  urlencode(get_option ('siteurl'));
    123 //Site Description
    124 $site_description =  urlencode(get_option('blogdescription')); 
    125    
    126 // Get cURL resource
    127 $curl = curl_init();
    128 // Set some options - we are passing in a useragent too here
    129 curl_setopt_array($curl, array(
    130     CURLOPT_RETURNTRANSFER => 1,
    131     CURLOPT_URL => 'http://www.teambecause.com/pluginactivated.php?sitename='.$site_name.'&site_url='.$site_url.'&site_description='.$site_description,
    132     CURLOPT_USERAGENT => 'Codular Sample cURL Request'
    133 ));
    134 // Send the request & save response to $resp
    135 $resp = curl_exec($curl);
    136 // Close request to clear up some resources
    137 curl_close($curl); 
    138 
    139 //exit;
    140 
    141 ob_end_clean();
    142 }//social_poll_activate
    143 register_activation_hook( __FILE__, 'social_poll_activate' );
    144 
    145 
    146 
    147 //COMEBACKVERB
    148 
    149 register_activation_hook( __FILE__, array( 'spComments', 'activate' ) );
    150 
    151 register_deactivation_hook( __FILE__, array( 'spComments', 'deactivate' ) );
    152 
     110// SETTINGS
     111define('BECAUSE_ADMIN_SERVER_URL', 'http://108.174.62.50/because/symfony/web/api/ <replace with your own location>
     112action');
     113define('BECAUSE_ADMIN_SECRET_TOKEN_NAME', 'secretToken');
     114define('BECAUSE_ADMIN_SECRET_TOKEN_VALUE', 'X-Secret-Token');
     115register_activation_hook( __FILE__, 'because_plugin_activate' );
     116function because_plugin_activate(){
     117 $data = get_wp_data();
     118 $data['isActivation'] = '1';
     119 send_statistic_data($data);
     120}
     121register_deactivation_hook( __FILE__, 'because_plugin_deactivate' );
     122function because_plugin_deactivate()
     123{
     124 $data = get_wp_data();
     125 $data['isActivation'] = '0';
     126 send_statistic_data($data);}
     127function get_wp_data(){
     128 $site_url = get_site_url();
     129 $site_name = get_bloginfo('name');
     130 $site_ip_addr = get_ip();
     131 $data_arr = array(
     132 'siteIpAddress' => $site_ip_addr,
     133 'siteName' => $site_name,
     134 'siteUrl' => $site_url
     135 );
     136 return $data_arr;
     137}
     138function send_statistic_data($data)
     139{
     140 try {
     141 $ch = curl_init();
     142 curl_setopt($ch, CURLOPT_URL, BECAUSE_ADMIN_SERVER_URL);
     143 curl_setopt($ch, CURLOPT_POST, 1);
     144$header = array(BECAUSE_ADMIN_SECRET_TOKEN_NAME.': ' .
     145BECAUSE_ADMIN_SECRET_TOKEN_VALUE);
     146 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     147 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     148 curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
     149 $response = curl_exec ($ch);
     150 $error = curl_error($ch);
     151 curl_close ($ch);
     152 }catch (Exception $error) {
     153 $this->debug(__METHOD__, 'CURL error: ' . $error);
     154 return $response;
     155 }
     156}
     157
     158function get_ip()
     159{
     160
     161 if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
     162 $ip = getenv("HTTP_CLIENT_IP");
     163else if (getenv("HTTP_X_FORWARDED_FOR") &&
     164strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
     165 $ip = getenv("HTTP_X_FORWARDED_FOR");
     166 else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
     167 $ip = getenv("REMOTE_ADDR");
     168else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] &&
     169strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
     170 $ip = $_SERVER['REMOTE_ADDR'];
     171 else
     172 $ip = "unknown";
     173 return($ip);
     174}
    153175/*
    154176
Note: See TracChangeset for help on using the changeset viewer.