Ver Fonte

Bumped version to 0.0.35

Jannick Knudsen há 4 anos atrás
pai
commit
22f4dbf81b

+ 1 - 1
VERSION

@@ -1 +1 @@
-v0.0.34
+v0.0.35

+ 1 - 0
VERSIONLOG

@@ -33,3 +33,4 @@ v0.0.31
 v0.0.32
 v0.0.33
 v0.0.34
+v0.0.35

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "dagsplug",
-  "version": "0.0.34",
+  "version": "0.0.35",
   "description": "",
   "main": "script_backend.js",
   "scripts": {

+ 1 - 1
plug_body.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_body")) {
 	class plug_body {	
-		function plug_body($ns) {
+		function __construct($ns) {
 			$this->title = __("Body classes","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_classic.php

@@ -936,7 +936,7 @@ endif;
 
 if (!class_exists("plug_classic")) {
 	class plug_classic {	
-		function plug_classic($ns) {
+		function __construct($ns) {
 			$this->title = __("Classic Editor","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_color_admin_posts.php

@@ -10,7 +10,7 @@ if (!class_exists("plug_color_admin_posts")) {
 		private $settings = array(); // Set $setting in array
 		var $hasform = true;
 		var $startet = false;
-		function plug_color_admin_posts() {
+		function __construct() {
 			$this->title = __("Color admin posts","dagsopt");
 		}
 		function start(){

+ 1 - 1
plug_custom_header.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_custom_header")) {
 	class plug_custom_header {	
-		function plug_custom_header($ns) {
+		function __construct($ns) {
 			$this->title = __("Custom Header Code","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_dashboard.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_dashboard")) {
 	class plug_dashboard {	
-		function plug_dashboard($ns) {
+		function __construct($ns) {
 			$this->title = __("Dashboard","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_footer.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_footer")) {
 	class plug_footer {	
-		function plug_footer($ns) {
+		function __construct($ns) {
 			$this->title = __("Footer","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_google_analytics.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_google_analytics")) {
 	class plug_google_analytics {	
-		function plug_google_analytics($ns) {
+		function __construct($ns) {
 			$this->title = __("Google Analytics","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_login.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_login")) {
 	class plug_login {	
-		function plug_login($ns) {
+		function __construct($ns) {
 			$this->title = __("Login","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_post_thumbs.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_post_thumbs")) {
 	class plug_post_thumbs {	
-		function plug_post_thumbs($ns) {
+		function __construct($ns) {
 			$this->title = __("Admin post thumbs","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_shortcodes.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_shortcodes")) {
 	class plug_shortcodes {	
-		function plug_shortcodes($ns) {
+		function __construct($ns) {
 			$this->title = __("Misc Shortcodes","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 1 - 1
plug_styled_editor.php

@@ -2,7 +2,7 @@
 
 if (!class_exists("plug_styled_editor")) {
 	class plug_styled_editor {	
-		function plug_styled_editor($ns) {
+		function __construct($ns) {
 			$this->title = __("Styled editor","dagsopt");
 			$this->pluginname = $ns->pluginname;
 			$this->file = $ns->file;

+ 149 - 0
plug_woohook.php

@@ -0,0 +1,149 @@
+<?php
+
+if (!class_exists("plug_wookook")) {
+
+ 	if(!function_exists("sanitize_username")){
+	function sanitize_username($username) {
+	  $parts = explode("@", $username);
+	  if (count($parts) == 2) {
+	     $username = $parts[0];
+	  }
+	  return $username;
+	}
+
+ 	}
+
+
+
+	class plug_wookook {	
+		function __construct($ns) {
+			$this->title = __("plug_wookook","dagsopt");
+			$this->pluginname = $ns->pluginname;
+			$this->file = $ns->file;
+			$this->ns = $ns;
+
+		}
+		function start() {
+ 
+				//add_role( "betalende-abonnent", "Betalende abonnent", array( 'read' => true, 'level_0' => true ) );
+
+						add_action('wp_loaded',array(&$this,'header'),1);
+
+		
+		}
+ 
+
+		 function header(){
+
+		 	if(isset($_REQUEST['woohook'])){
+ 				$rr = file_get_contents('php://input');
+				$itemnumbers = explode(",",get_option($this->pluginname."_wookook_items",false));
+				$found = false;
+				try {
+					$order = json_decode($rr,true);
+					if(isset($order['date_paid_gmt'])){
+						foreach ($order['line_items'] as $num => $line) {
+							if(in_array($line['product_id'],$itemnumbers)){
+								$found = true;
+							}
+						}
+					}
+				} catch (Exception $e) {
+				    echo 'Caught exception: ',  $e->getMessage(), "\n";
+				}
+				$testmode = false;
+
+				if($found){
+						$resu = array();
+							$user_email = $order['billing']['email'];
+							$user_name = sanitize_username("O".$order['id']);
+				    		$user_id = username_exists( $user_name );
+								if ( ! $user_id && false == email_exists( $user_email ) ) {
+								    $random_password = wp_generate_password( $length = 12, $include_standard_special_chars = false );
+								   if($testmode){
+									$resu[] = "$user_id mock created : $user_name $user_email ";
+								   }else{
+								    $user_id = wp_create_user( $user_name, $random_password, $user_email );
+								    wp_update_user( array( 'ID' => $user_id, 'role' => 'betalende-abonnent' ) );
+									wp_send_new_user_notifications($user_id,'both');
+									$resu[] = "$user_id created : $user_name $user_email ";
+								   }
+								} else {
+									$resu[] = "$user_id or $user_email exists";
+								    $random_password = __( 'User already exists.  Password inherited.', 'textdomain' );
+								}
+							  $aemail = get_bloginfo('admin_email');
+							  $rr = wp_mail($aemail, 'CCR '. count($resu)." : ". getenv('HOSTNAME')." : ".$_SERVER['REMOTE_ADDR']." : " . $_SERVER['SERVER_ADDR'] . " : ". $_SERVER['SERVER_NAME']." ".date("U"), "::".print_r($resu,true));
+								    	echo("DONE live");
+
+					print_r($resu);
+					die("done $rr");
+				}else{
+					die("no action done");
+				}
+		 	}
+	}
+
+
+	function help(){
+		?>
+		plug_wookook			
+	<?php		
+	}
+
+
+ 
+ 	function Option($pre){
+ 
+			update_option ( $pre.'_items', $_POST [ $pre.'_items' ] );
+ 
+ 
+ 
+
+
+ 		
+	}
+
+ 
+
+
+  	 
+
+
+	 	function admin_line($pre){
+	 	 
+
+?>
+<table>
+ 
+
+			<tr><td>
+ 			</td><td>
+ 			</td></tr>	
+						<tr><td>
+				  
+			</td><td>
+ 			</td></tr>	
+ 
+ 			<tr><td> <?php echo(__("Item numbers:","dagsopt")) ?><br><textarea name="<?php echo( $pre.'_items' ); ?>"><?php echo(stripcslashes(get_option($pre."_items"))); ?></textarea> <br></td></tr>
+ 
+			 
+			</table>	
+
+
+   
+	  <?php  
+}	
+}
+
+global $plug_wookook;
+$plug_wookook = new plug_wookook($this);		
+	$this->dagsopt['plug_wookook'] = $plug_wookook;
+	
+}
+
+
+
+
+
+

+ 2 - 2
plugin.php

@@ -4,7 +4,7 @@
  Plugin URI: https://git.tum.dk/tum.dk/dagsplug/
  Description: Tools 
  Author: iskedk
- Version: 0.0.34
+ Version: 0.0.35
  Date: 2021-01-14
  Author URI: https://iske.dk/
  Text Domain: dagsopt
@@ -17,7 +17,7 @@ function wppluginspage() {
 $wp_dagsopt = new dagsopt ( );
 
 class dagsopt {
-	var $version = "0.0.34";
+	var $version = "0.0.35";
 	var $publish_date = "2021-01-14";
 	var $pluginname;
 	var $plugintitle;