Changeset 995564
- Timestamp:
- 09/23/2014 05:41:58 PM (11 years ago)
- Location:
- because/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (1 diff)
-
public/assets/css/public.css (modified) (3 diffs)
-
public/assets/js/public.js (modified) (4 diffs)
-
social-polling.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
because/trunk/README.txt
r992786 r995564 7 7 Tested up to: 4.0 8 8 <<<<<<< .mine 9 Stable tag: 1.3. 09 Stable tag: 1.3.1 10 10 ======= 11 Stable tag: 1.3. 011 Stable tag: 1.3.1 12 12 >>>>>>> .r969865 13 13 License: GPLv2 or later -
because/trunk/public/assets/css/public.css
r992786 r995564 207 207 .sp_comment-list .comment_controls{ 208 208 font-size:.8em; 209 float:left; 210 margin-right:10px; 209 211 210 212 } … … 389 391 { 390 392 border-bottom: 1px solid #ccc; 393 min-height: 90px; 391 394 } 392 395 … … 396 399 margin:0; 397 400 padding:0; 398 max-height:25px;399 max-width:25px;401 height:auto; 402 width:25px; 400 403 } 401 404 -
because/trunk/public/assets/js/public.js
r953144 r995564 52 52 53 53 54 var $comment_box_offset = $('#respond').offset().top + 'px'; 55 56 setTimeout(function() { 57 $("html, body").animate({ scrollTop: $comment_box_offset }, 450); 58 }, 2000); 59 54 60 55 61 … … 57 63 //console.log(data+ajaxurl); 58 64 59 65 60 66 61 67 }//success … … 68 74 69 75 })//$(document).on('click', 'button.answer_divs', function(){ 70 71 76 72 77 … … 167 172 $('#answer_2_wrapper .poll_results').html($answer2_html); 168 173 169 $('#social_polling_see_results_wrapper').html(' <button class="joindiscussion">Join the discussion below</button>');174 $('#social_polling_see_results_wrapper').html(''); 170 175 171 176 -
because/trunk/social-polling.php
r992786 r995564 34 34 35 35 <<<<<<< .mine 36 * Version: 1.3. 036 * Version: 1.3.1 37 37 ======= 38 * Version: 1.3. 038 * Version: 1.3.1 39 39 >>>>>>> .r969865 40 40 … … 90 90 require_once( plugin_dir_path( __FILE__ ) . 'public/includes/class-sp_comments.php' ); 91 91 92 /* 93 94 * Register hooks that are fired when the plugin is activated or deactivated. 95 96 * When the plugin is deleted, the uninstall.php file is loaded. 97 98 * 99 100 * @TODO: 101 102 * 103 104 * - replace Social_Polling with the name of the class defined in 105 106 * `class-social-polling.php` 107 108 */ 92 109 93 110 94 // SETTINGS … … 113 97 define('BECAUSE_ADMIN_SECRET_TOKEN_NAME', 'secretToken'); 114 98 define('BECAUSE_ADMIN_SECRET_TOKEN_VALUE', 'X-Secret-Token'); 99 100 101 /* 102 103 * Register hooks that are fired when the plugin is activated or deactivated. 104 105 * When the plugin is deleted, the uninstall.php file is loaded. 106 107 * 108 109 * @TODO: 110 111 * 112 113 * - replace Social_Polling with the name of the class defined in 114 115 * `class-social-polling.php` 116 117 */ 118 115 119 register_activation_hook( __FILE__, 'because_plugin_activate' ); 120 register_deactivation_hook( __FILE__, 'because_plugin_deactivate' ); 121 122 123 /* executes the static activate functions from the social_polling and spComments classes to create new tables */ 124 register_activation_hook( __FILE__, array( 'Social_Polling', 'activate' ) ); 125 register_deactivation_hook( __FILE__, array( 'Social_Polling', 'deactivate' ) ); 126 register_activation_hook( __FILE__, array( 'spComments', 'activate' ) ); 127 register_deactivation_hook( __FILE__, array( 'spComments', 'deactivate' ) ); 128 129 116 130 function because_plugin_activate(){ 117 because_old_activation();118 $data = get_wp_data();119 $data['isActivation'] = '1';120 send_statistic_data($data);121 } 122 register_deactivation_hook( __FILE__, 'because_plugin_deactivate' ); 131 because_old_activation(); 132 $data = get_wp_data(); 133 $data['isActivation'] = '1'; 134 send_statistic_data($data); 135 } 136 123 137 function because_plugin_deactivate() 124 138 { 125 $data = get_wp_data(); 126 $data['isActivation'] = '0'; 127 send_statistic_data($data);} 139 $data = get_wp_data(); 140 $data['isActivation'] = '0'; 141 send_statistic_data($data); 142 } 143 128 144 function get_wp_data(){ 129 $site_url = get_site_url(); 130 $site_name = get_bloginfo('name'); 131 $site_ip_addr = get_ip(); 132 $data_arr = array( 133 'siteIpAddress' => $site_ip_addr, 134 'siteName' => $site_name, 135 'siteUrl' => $site_url 136 ); 137 return $data_arr; 138 } 145 $site_url = get_site_url(); 146 $site_name = get_bloginfo('name'); 147 $site_ip_addr = get_ip(); 148 $data_arr = array( 149 'siteIpAddress' => $site_ip_addr, 150 'siteName' => $site_name, 151 'siteUrl' => $site_url 152 ); 153 return $data_arr; 154 } 155 156 139 157 function send_statistic_data($data) 140 158 { 141 try { 142 $ch = curl_init(); 143 curl_setopt($ch, CURLOPT_URL, BECAUSE_ADMIN_SERVER_URL); 144 curl_setopt($ch, CURLOPT_POST, 1); 145 $header = array(BECAUSE_ADMIN_SECRET_TOKEN_NAME.': ' . 146 BECAUSE_ADMIN_SECRET_TOKEN_VALUE); 147 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 148 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 149 curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); 150 $response = curl_exec ($ch); 151 $error = curl_error($ch); 152 curl_close ($ch); 153 }catch (Exception $error) { 154 $this->debug(__METHOD__, 'CURL error: ' . $error); 155 return $response; 156 } 157 } 158 159 function get_ip() 160 { 161 162 if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) 163 $ip = getenv("HTTP_CLIENT_IP"); 164 else if (getenv("HTTP_X_FORWARDED_FOR") && 165 strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) 166 $ip = getenv("HTTP_X_FORWARDED_FOR"); 167 else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) 168 $ip = getenv("REMOTE_ADDR"); 169 else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && 170 strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) 171 $ip = $_SERVER['REMOTE_ADDR']; 172 else 173 $ip = "unknown"; 174 return($ip); 159 try { 160 $ch = curl_init(); 161 curl_setopt($ch, CURLOPT_URL, BECAUSE_ADMIN_SERVER_URL); 162 curl_setopt($ch, CURLOPT_POST, 1); 163 $header = array(BECAUSE_ADMIN_SECRET_TOKEN_NAME.': ' . 164 BECAUSE_ADMIN_SECRET_TOKEN_VALUE); 165 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 166 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 167 curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); 168 $response = curl_exec ($ch); 169 $error = curl_error($ch); 170 curl_close ($ch); 171 } 172 catch (Exception $error) { 173 $this->debug(__METHOD__, 'CURL error: ' . $error); 174 return $response; 175 } 176 } 177 178 function get_ip(){ 179 if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) 180 $ip = getenv("HTTP_CLIENT_IP"); 181 else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) 182 $ip = getenv("HTTP_X_FORWARDED_FOR"); 183 else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) 184 $ip = getenv("REMOTE_ADDR"); 185 else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) 186 $ip = $_SERVER['REMOTE_ADDR']; 187 else 188 $ip = "unknown"; 189 return($ip); 175 190 } 176 191 177 192 178 193 function because_old_activation(){ 179 ob_start(); 180 //Site Name 181 $site_name = urlencode(get_option ('blogname')); 182 //Site Url 183 $site_url = urlencode(get_option ('siteurl')); 184 //Site Description 185 $site_description = urlencode(get_option('blogdescription')); 186 // Get cURL resource 187 $curl = curl_init(); 188 // Set some options - we are passing in a useragent too here 189 curl_setopt_array($curl, array( 190 CURLOPT_RETURNTRANSFER => 1, 191 CURLOPT_URL => 'http://www.teambecause.com/pluginactivated.php?sitename='.$site_name.'&site_url='.$site_url.'&site_description='.$site_description, 192 CURLOPT_USERAGENT => 'Codular Sample cURL Request' 193 )); 194 // Send the request & save response to $resp 195 $resp = curl_exec($curl); 196 // Close request to clear up some resources 197 curl_close($curl); 198 //exit; 199 ob_end_clean(); 200 } 194 ob_start(); 195 //Site Name 196 $site_name = urlencode(get_option ('blogname')); 197 //Site Url 198 $site_url = urlencode(get_option ('siteurl')); 199 //Site Description 200 $site_description = urlencode(get_option('blogdescription')); 201 // Get cURL resource 202 $curl = curl_init(); 203 // Set some options - we are passing in a useragent too here 204 curl_setopt_array($curl, array( 205 CURLOPT_RETURNTRANSFER => 1, 206 CURLOPT_URL => 'http://www.teambecause.com/pluginactivated.php?sitename='.$site_name.'&site_url='.$site_url.'&site_description='.$site_description, 207 CURLOPT_USERAGENT => 'Codular Sample cURL Request' 208 )); 209 // Send the request & save response to $resp 210 $resp = curl_exec($curl); 211 // Close request to clear up some resources 212 curl_close($curl); 213 //exit; 214 ob_end_clean(); 215 } 216 217 218 219 220 201 221 202 222 /*
Note: See TracChangeset
for help on using the changeset viewer.