123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- if (!class_exists("plug_usermanager")) {
- class plug_usermanager {
- function plug_usermanager($ns) {
- $this->title = __("plug_usermanager","dagsopt");
- $this->pluginname = $ns->pluginname;
- $this->file = $ns->file;
- $this->ns = $ns;
- }
- function start() {
- // register_setting("section", "demo-file", array(&this,"handle_file_upload"));
-
- }
- function handle_file_upload($option)
- {
- if(!empty($_FILES["demo-file"]["tmp_name"]))
- {
- $urls = wp_handle_upload($_FILES["demo-file"], array('test_form' => FALSE));
- $temp = $urls["url"];
- return $temp;
- }
- return $option;
- }
-
- function help(){
- ?>
- plug_usermanager
- <?php
- }
- function Option($pre){
- $nonce = $_REQUEST['_wpnonce'];
- if ( ! wp_verify_nonce( $nonce, 'filen-nonce' ) ) {
- // This nonce is not valid.
- die( __( 'Security check', 'textdomain' ) );
- } else {
- // The nonce was valid.
- // Do stuff here.
- if(isset($_FILES) && !empty($_FILES)){
- if($_FILES['filen']){
- $upload = wp_upload_dir();
- $upload_dir = $upload['basedir'];
- $upload_dir = $upload_dir . '/assets';
-
- move_uploaded_file($_FILES['filen']['tmp_name'], $upload_dir."/users.csv");
- }
- }
- }
-
- }
- /*<input id="link_image" value="test">
- <img src="" id="background_image">
- <a id="upload_image_button" href="#"><?php _e('Set image', 'dagsopt'); ?></a>
- */
- function admin_line($pre){
- ?>
- <?php
- $nonce = wp_create_nonce( 'filen-nonce' );
- $upload = wp_upload_dir();
- $upload_dir = $upload['basedir'];
- $upload_dir = $upload_dir . '/assets';
- $data = file_get_contents($upload_dir."/users.csv");
- ?>
- <textarea><?php echo($data); ?></textarea>
-
- <input type="file" name="filen">
- <input type="hidden" name="_wpnonce" value="<?php echo $nonce ?>">
- <?php
- }
- }
- global $plug_usermanager;
- $plug_usermanager = new plug_usermanager($this);
- $this->dagsopt['plug_usermanager'] = $plug_usermanager;
-
- }
|