Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding cap, and action_jackson plugin
- Loading branch information
Showing
18 changed files
with
853 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | ||
|
||
# Uncomment if you are using Rails' asset pipeline | ||
# load 'deploy/assets' | ||
|
||
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | ||
|
||
load 'config/deploy' # remove this line to skip loading any of the default tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
set :application, "set your application name here" | ||
set :repository, "set your repository location here" | ||
|
||
set :scm, :subversion | ||
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` | ||
|
||
role :web, "your web-server here" # Your HTTP server, Apache/etc | ||
role :app, "your app-server here" # This may be the same as your `Web` server | ||
role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run | ||
role :db, "your slave db-server here" | ||
|
||
# if you're still using the script/reaper helper you will need | ||
# these http://github.com/rails/irs_process_scripts | ||
|
||
# If you are using Passenger mod_rails uncomment this: | ||
# namespace :deploy do | ||
# task :start do ; end | ||
# task :stop do ; end | ||
# task :restart, :roles => :app, :except => { :no_release => true } do | ||
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | ||
# end | ||
# end |
115 changes: 115 additions & 0 deletions
115
wordpress/wp-content/plugins/action_jackson/action_jackson.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
/* | ||
Plugin Name: UserActions | ||
Plugin URL: http://wordpress.org/ | ||
Description: Tracking of all User Actions | ||
Author: Sebastian Frohm | ||
Version: 0.1 | ||
*/ | ||
|
||
//include base definitions | ||
//include('globals/USERACTIONS.constants.php'); | ||
@define('ACTIONJACSON_BASE_DIR', 'action_jackson/'); | ||
|
||
@define('ACTIONJACSON_ACTIONS_DIR', 'base/'); | ||
@define('ACTIONJACSON_INSTANCES_DIR', 'controllers/instances/'); | ||
@define('ACTIONJACSON_VIEWS_DIR', 'views/'); | ||
|
||
//include(USERACTIONS_ACTIONS_DIR.'UserActionsViews.actions.php'); | ||
//include(USERACTIONS_ACTIONS_DIR.'UserActionsAdmin.actions.php'); | ||
include('base/action_jackson_query.php'); | ||
include('models/post_action.php'); | ||
include('models/user_action.php'); | ||
|
||
function get_actions() { | ||
global $current_user; | ||
get_currentuserinfo(); | ||
|
||
$ajQuery = new ActionJacksonQuery(); | ||
|
||
$ajQuery->getUserActions('posts', 'ID', $current_user->ID); | ||
//$ajQuery->getUserActions('term', 'term_id', $current_user->ID, null, null, null, 'category'); | ||
//$ajQuery->addUserAction(4, 'term', 'upvote', 'something', 1); | ||
} | ||
|
||
// add_action('init', 'get_actions'); | ||
|
||
add_filter('posts_results', 'getUserActions'); | ||
//add_filter('pre_get_posts', 'dont_suppress_filters'); | ||
|
||
function getUserActions($posts) { | ||
global $current_user; | ||
|
||
$existingIds = array(); | ||
$userId = (is_user_logged_in()) ? $current_user->ID : '1'; | ||
|
||
/** | ||
* Check to see if there is anything in the $_GET | ||
*/ | ||
$actionType = (isset($_GET['action']) && !empty($_GET['action'])) ? $_GET['action'] : null; | ||
$page = (isset($_GET['paged']) && !empty($_GET['paged'])) ? $_GET['paged'] : 1; | ||
|
||
foreach($posts as $post) { | ||
$ids[] = $post->ID; | ||
|
||
//$actions[] = new UserActionPost($post); | ||
} | ||
// public function getPostAction($object_type, $object_id, $post_action_id=null, $object_sub_type=null, $action_type=null, $limit=10, $page=1) { | ||
$ajQuery = new ActionJacksonQuery(); | ||
$postActions = $ajQuery->getPostAction('posts', $ids, null, null, null, null, null, false); | ||
|
||
$ids = array(); | ||
|
||
foreach($postActions as $postAction) { | ||
$ids[] = $postAction->post_action_id; | ||
|
||
$actions[] = new PostAction($postAction); | ||
} | ||
|
||
$userActions = $ajQuery->getUserActions($ids, $userId, $page, 10); | ||
|
||
foreach($userActions as $userAction) { | ||
foreach($actions as $action) { | ||
if($action->id == $userAction->object_id) { | ||
$action->user = $userAction; | ||
$action->user = new UserAction($userAction); | ||
} | ||
} | ||
} | ||
|
||
foreach($posts as $post) { | ||
foreach($actions as $action) { | ||
if($action->objectId == $post->ID) { | ||
$post->actions[] = $action; | ||
} | ||
} | ||
} | ||
|
||
return $posts; | ||
} | ||
|
||
function dont_suppress_filters($query){ | ||
$query->query_vars['suppress_filters'] = false; | ||
return $query; | ||
} | ||
|
||
function addUserAction() { | ||
$ajQuery = new ActionJacksonQuery(); | ||
$result = $ajQuery->addUserAction((int)$_POST['id'], $_POST['type'], $_POST['userAction'], $_POST['subtype'], (int)$_POST['user']); | ||
|
||
echo json_encode($result); | ||
exit; | ||
} | ||
|
||
add_action('wp_ajax_add_user_action', 'addUserAction'); | ||
add_action('wp_ajax_nopriv_add_user_action', 'addUserAction'); | ||
|
||
|
||
function asdf($user) { | ||
echo 'in asdf <pre>'; | ||
var_dump($user); | ||
exit; | ||
} | ||
|
||
add_filter('pre_user_query', 'asdf'); | ||
|
67 changes: 67 additions & 0 deletions
67
wordpress/wp-content/plugins/action_jackson/base/action_jackson_admin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
class FitStudioAdminActions { | ||
public $views; | ||
|
||
public function __construct() { | ||
$this->views = new FitStudioViewActions(); | ||
|
||
add_action('admin_menu', array(&$this, 'initializeSideMenu')); | ||
add_action('admin_init', array(&$this, 'setOptions')); | ||
} | ||
|
||
public function initializeSideMenu() { | ||
add_options_page('UserActions', 'User Actions', 'manage_options', 'manage-fitstudio-hf', array(&$this, 'createForm')); | ||
} | ||
|
||
public function createForm() { | ||
$data = array('me' => 'sebastian'); | ||
|
||
$this->views->openView('form', $data); | ||
} | ||
|
||
public function setOptions() { | ||
register_setting('fitStudioOptions', 'fitStudioOptions-apiKey'); | ||
register_setting('fitStudioOptions', 'fitStudioOptions-visibility'); | ||
register_setting('fitStudioOptions', 'fitStudioOptions-apiUrl'); | ||
register_setting('fitStudioOptions', 'fitStudioOptions-siteSection'); | ||
|
||
add_settings_section('infoSection', 'Use this plugin to turn on the header/footer for FitStudio', array(&$this,'printVisibility'), 'manage-fitstudio-hf'); | ||
add_settings_field('apiUrl', '', array(&$this,'printApiUrl'), 'manage-fitstudio-hf', 'infoSection'); | ||
add_settings_field('apiKey', '', array(&$this,'printApiKey'), 'manage-fitstudio-hf', 'infoSection'); | ||
add_settings_field('toggleVisibility', '', array(&$this,'printVisibilityToggle'), 'manage-fitstudio-hf', 'infoSection'); | ||
add_settings_field('siteSection', '', array(&$this,'printSiteSection'), 'manage-fitstudio-hf', 'infoSection'); | ||
} | ||
|
||
public function getOption($name) { | ||
return get_option($name); | ||
} | ||
|
||
public function printVisibility() { | ||
$this->views->openField(); | ||
} | ||
|
||
public function printApiKey() { | ||
$data = array('value' => $this->getOption('fitStudioOptions-apiKey')); | ||
|
||
$this->views->openField('fields/keys', $data); | ||
} | ||
|
||
public function printVisibilityToggle() { | ||
$data = array('value' => $this->getOption('fitStudioOptions-visibility')); | ||
|
||
$this->views->openField('fields/visibility', $data); | ||
} | ||
|
||
public function printApiUrl() { | ||
$data = array('value' => $this->getOption('fitStudioOptions-apiUrl')); | ||
|
||
$this->views->openField('fields/url', $data); | ||
} | ||
|
||
public function printSiteSection() { | ||
$data = array('value' => $this->getOption('fitStudioOptions-siteSection')); | ||
|
||
$this->views->openField('fields/section', $data); | ||
} | ||
} | ||
?> |
11 changes: 11 additions & 0 deletions
11
wordpress/wp-content/plugins/action_jackson/base/action_jackson_public.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
class UserActions extends UserActionQuery { | ||
private $_active; | ||
private $_apiKey; | ||
private $_url; | ||
private $_siteSection; | ||
|
||
public function __construct() { | ||
|
||
} | ||
} |
Oops, something went wrong.