web/wp-content/plugins/exec-php/includes/usermeta.php
changeset 136 bde1974c263b
equal deleted inserted replaced
135:53cff4b4a802 136:bde1974c263b
       
     1 <?php
       
     2 
       
     3 require_once(dirname(__FILE__).'/const.php');
       
     4 
       
     5 // -----------------------------------------------------------------------------
       
     6 // the ExecPhp_UserMeta class handles the loading and storing of the
       
     7 // plugin settings for each individual article including all needed conversion
       
     8 // routines
       
     9 // -----------------------------------------------------------------------------
       
    10 
       
    11 if (!class_exists('ExecPhp_UserMeta')) :
       
    12 
       
    13 define('ExecPhp_META_WYSIWYG_WARNING', 'execphp_wysiwyg_warning');
       
    14 
       
    15 class ExecPhp_UserMeta
       
    16 {
       
    17 	var $m_user_id = -1;
       
    18 	var $m_hide_wysiwyg_warning = false;
       
    19 
       
    20 	// ---------------------------------------------------------------------------
       
    21 	// init
       
    22 	// ---------------------------------------------------------------------------
       
    23 
       
    24 	function ExecPhp_UserMeta($user_id)
       
    25 	{
       
    26 		$this->m_user_id = $user_id;
       
    27 		$this->load();
       
    28 	}
       
    29 
       
    30 	function save()
       
    31 	{
       
    32 		update_usermeta($this->m_user_id, ExecPhp_META_WYSIWYG_WARNING,
       
    33 			$this->m_hide_wysiwyg_warning);
       
    34 	}
       
    35 
       
    36 	function load()
       
    37 	{
       
    38 		if ($this->m_user_id > 0)
       
    39 		{
       
    40 			$this->m_hide_wysiwyg_warning =
       
    41 				get_usermeta($this->m_user_id, ExecPhp_META_WYSIWYG_WARNING);
       
    42 		}
       
    43 	}
       
    44 
       
    45 	// ---------------------------------------------------------------------------
       
    46 	// access
       
    47 	// ---------------------------------------------------------------------------
       
    48 
       
    49 	function set_from_POST()
       
    50 	{
       
    51 		$this->m_hide_wysiwyg_warning
       
    52 			= isset($_POST[ExecPhp_POST_WYSIWYG_WARNING]);
       
    53 	}
       
    54 
       
    55 	function hide_wysiwyg_warning()
       
    56 	{
       
    57 		return $this->m_hide_wysiwyg_warning;
       
    58 	}
       
    59 }
       
    60 endif;
       
    61 
       
    62 ?>