summaryrefslogtreecommitdiff
path: root/plugins/wordpress/wordpress.module
blob: c84db9e2753bdfa4584fa0f2cad8ffa908903bb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

function wordpress_init($config) {
  require_once $config['root_path'] . 'wp-load.php';
  require_once $config['root_path'] . 'wp-includes/user.php';
  ob_end_clean(); // Basically voodoo.

  // Load the plugin.
  require_once __DIR__ . '/BridgeWordpress.php';
  return new BridgeWordpress();
}

function wordpress_session($config) {
  require_once $config['root_path'] . 'wp-load.php';
  require_once $config['root_path'] . 'wp-includes/user.php';

  $id = wp_validate_logged_in_cookie(NULL);
  if ($id) return (new WP_User($id))->user_login;
}