예제 #1
0
 public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new HRM_File();
     }
     return self::$_instance;
 }
예제 #2
0
 function ajax_upload()
 {
     check_ajax_referer('hrm_nonce');
     $response = HRM_File::getInstance()->file_upload();
     if ($response['success']) {
         $file = HRM_File::getInstance()->get_file($response['file_id']);
         $delete = sprintf('<a href="#" data-id="%d" class="hrm-delete-file button">%s</a>', $file['id'], __('Delete File', 'hrm'));
         $hidden = sprintf('<input type="hidden" name="hrm_attachment[]" value="%d" />', $file['id']);
         $file_url = sprintf('<a href="%1$s" target="_blank"><img src="%2$s" alt="%3$s" /></a>', $file['url'], $file['thumb'], esc_attr($file['name']));
         $html = '<div class="hrm-uploaded-item">' . $file_url . ' ' . $delete . $hidden . '</div>';
         echo json_encode(array('success' => true, 'content' => $html));
         exit;
     }
     echo json_encode(array('success' => false, 'error' => $response['error']));
     exit;
 }
예제 #3
0
}
$share_files = HRM_File::getInstance()->get_share_files();
$posts = $file_posts->posts;
$files = $share_files->posts;
$total = $file_posts->found_posts;
$add_permission = true;
$delete_permission = true;
foreach ($posts as $key => $post) {
    $file_url = '';
    foreach ($files as $key => $file) {
        if ($file->post_parent == $post->ID) {
            $file_info = HRM_File::getInstance()->get_file($file->ID);
            $file_url .= sprintf('<a href="%1$s" target="_blank"><img class="hrm-file-tag" src="%2$s" alt="%3$s" /></a>', $file_info['url'], $file_info['thumb'], esc_attr($file_info['name']));
        }
    }
    $assign_to = HRM_File::getInstance()->get_assing_user($post->ID);
    if ($add_permission) {
        $post_title = '<a href="#" class="hrm-file-edit"  data-id=' . $post->ID . '>' . $post->post_title . '<a>';
    } else {
        $post_title = $post->post_title;
    }
    if ($delete_permission) {
        $del_checkbox = '<input name="hrm_check[' . $post->ID . ']" value="" type="checkbox">';
    } else {
        $del_checkbox = '';
    }
    $body[] = array($del_checkbox, $file_url, $assign_to, $post_title, $post->post_content);
    $td_attr[] = array('class="check-column"');
}
$table = array();
$del_checkbox = $delete_permission ? '<input type="checkbox">' : '';