git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@5 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
@ -2,28 +2,28 @@
|
||||
|
||||
function bp_dedication_add_js() {
|
||||
global $bp;
|
||||
|
||||
if ($bp->current_action == BP_DEDICATION_SLUG || ( isset($bp->action_variables[1]) && $bp->action_variables[1] == BP_DEDICATION_SLUG )) {
|
||||
if (bp_is_dedication_component() && bp_is_current_action('new-dedication')) {
|
||||
wp_enqueue_script('jquery-validate-js', plugins_url("includes/js/jquery.validate.min.js", __FILE__), array('jquery'));
|
||||
wp_enqueue_script('jquery-autocomplete-js', plugins_url("includes/js/jquery.autocomplete-min.js", __FILE__), array('jquery'));
|
||||
/* wp_enqueue_script('invite-anyone-autocomplete-js', WP_PLUGIN_URL . '/invite-anyone/group-invites/jquery.autocomplete/jquery.autocomplete-min.js', array('jquery'));
|
||||
wp_register_script('invite-anyone-js', WP_PLUGIN_URL . '/invite-anyone/group-invites/group-invites-js.js', array('invite-anyone-autocomplete-js'));
|
||||
wp_enqueue_script('invite-anyone-js'); */
|
||||
wp_enqueue_script('jquery-jyoutube-js', plugins_url("includes/js/jquery.jyoutube.js", __FILE__), array('jquery'));
|
||||
wp_register_script('dedication-js', plugins_url("includes/js/dedication-script.js", __FILE__), array('jquery-autocomplete-js', 'jquery-jyoutube-js'));
|
||||
|
||||
wp_localize_script('dedication-js', 'script_vars', array(
|
||||
'source_url' => plugins_url("includes/bp-dedication-search-members.php", __FILE__)
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_script('dedication-js');
|
||||
}
|
||||
}
|
||||
|
||||
add_action('wp_head', 'bp_dedication_add_js', 1);
|
||||
|
||||
function bp_dedication_css() {
|
||||
function bp_dedication_add_css() {
|
||||
global $bp;
|
||||
|
||||
if ($bp->current_action == BP_DEDICATION_SLUG || ( isset($bp->action_variables[1]) && $bp->action_variables[1] == BP_DEDICATION_SLUG )) {
|
||||
/* $style_url = WP_PLUGIN_URL . '/invite-anyone/group-invites/group-invites-css.css';
|
||||
$style_file = WP_PLUGIN_DIR . '/invite-anyone/group-invites/group-invites-css.css';
|
||||
|
||||
if (file_exists($style_file)) {
|
||||
wp_register_style('invite-anyone-group-invites-style', $style_url);
|
||||
wp_enqueue_style('invite-anyone-group-invites-style');
|
||||
} */
|
||||
if (bp_is_dedication_component() && bp_is_current_action('new-dedication')) {
|
||||
wp_register_style('bp-dedication-style', plugins_url("includes/css/bp-dedication.css", __FILE__));
|
||||
wp_enqueue_style('bp-dedication-style');
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,12 +82,14 @@ class BP_Dedication extends BP_Component {
|
||||
|
||||
// Files to include
|
||||
$includes = array(
|
||||
'includes/create-dedication.php',
|
||||
'includes/bp-dedication-create-dedication.php',
|
||||
'includes/bp-dedication-screens.php',
|
||||
'includes/bp-dedication-activity.php',
|
||||
'includes/bp-example-functions.php',
|
||||
'includes/bp-dedication-functions.php',
|
||||
'includes/bp-dedication-classes.php',
|
||||
'includes/bp-dedication-ajax.php',
|
||||
/* 'includes/bp-example-filters.php',
|
||||
'includes/bp-example-classes.php',
|
||||
|
||||
|
||||
'includes/bp-example-template.php',
|
||||
|
||||
@ -113,7 +115,7 @@ class BP_Dedication extends BP_Component {
|
||||
'default_subnav_slug' => 'my-dedications'
|
||||
);
|
||||
|
||||
$dedication_link = trailingslashit(bp_loggedin_user_domain() . bp_get_dedication_slug());
|
||||
$dedication_link = trailingslashit(bp_displayed_user_domain() . bp_get_dedication_slug());
|
||||
|
||||
// Add a few subnav items under the main Example tab
|
||||
$sub_nav[] = array(
|
||||
@ -135,7 +137,7 @@ class BP_Dedication extends BP_Component {
|
||||
'position' => 20
|
||||
);
|
||||
|
||||
// Add the subnav items to the friends nav item
|
||||
if (bp_displayed_user_id() == bp_loggedin_user_id()) {
|
||||
$sub_nav[] = array(
|
||||
'name' => __('New dedication', 'bp-dedication'),
|
||||
'slug' => 'new-dedication',
|
||||
@ -144,6 +146,7 @@ class BP_Dedication extends BP_Component {
|
||||
'screen_function' => 'bp_dedication_new_dedication',
|
||||
'position' => 30
|
||||
);
|
||||
}
|
||||
|
||||
parent::setup_nav($main_nav, $sub_nav);
|
||||
//parent::setup_nav( $main_nav );
|
||||
|
||||
@ -18,7 +18,7 @@ function bp_dedication_get_dedications_from_user( $user_id ) {
|
||||
|
||||
$args = array(
|
||||
'numberposts' => -1,
|
||||
'category' => 'dedication',
|
||||
'category' => get_cat_id('dedication'),
|
||||
'author' => $user_id
|
||||
);
|
||||
$posts_array = get_posts( $args );
|
||||
|
||||
109
wp-content/plugins/bp-dedication/includes/bp-dedication-ajax.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
function bp_dedication_ajax_autocomplete_results() {
|
||||
global $bp;
|
||||
|
||||
$return = array(
|
||||
'query' => $_REQUEST['query'],
|
||||
'data' => array(),
|
||||
'suggestions' => array()
|
||||
);
|
||||
|
||||
$users = bp_dedication_members_query( $_REQUEST['query'] );
|
||||
|
||||
if ( $users ) {
|
||||
$suggestions = array();
|
||||
$data = array();
|
||||
|
||||
foreach ( $users as $user ) {
|
||||
$suggestions[] = $user->display_name . ' (' . $user->user_login . ')';
|
||||
$data[] = $user->ID;
|
||||
}
|
||||
|
||||
$return['suggestions'] = $suggestions;
|
||||
$return['data'] = $data;
|
||||
}
|
||||
|
||||
echo json_encode( $return );
|
||||
}
|
||||
add_action( 'wp_ajax_bp_dedication_autocomplete_ajax_handler', 'bp_dedication_ajax_autocomplete_results' );
|
||||
|
||||
|
||||
function bp_dedication_ajax_add_user() {
|
||||
global $bp;
|
||||
|
||||
//check_ajax_referer( 'groups_invite_uninvite_user' );
|
||||
|
||||
if ( !$_POST['friend_id'] || !$_POST['friend_action'] )
|
||||
return false;
|
||||
|
||||
if ( 'add' == $_POST['friend_action'] ) {
|
||||
|
||||
$user = new BP_Core_User( $_POST['friend_id'] );
|
||||
|
||||
echo '<li id="uid-' . $user->id . '">';
|
||||
echo bp_core_fetch_avatar( array( 'item_id' => $user->id ) );
|
||||
echo '<h4>' . bp_core_get_userlink( $user->id ) . '</h4>';
|
||||
echo '<div class="action">
|
||||
<a class="remove" href="' . wp_nonce_url( $bp->loggedin_user->domain . $group_slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '" id="uid-' . esc_html( $user->id ) . '">' . __( 'Remove', 'bp_dedication' ) . '</a>
|
||||
</div>';
|
||||
echo '</li>';
|
||||
|
||||
} else if ( 'delete' == $_POST['friend_action'] ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
add_action( 'wp_ajax_bp_dedication_add_user_ajax_handler', 'bp_dedication_ajax_add_user' );
|
||||
|
||||
|
||||
function bp_dedication_members_query( $search_terms = false ) {
|
||||
// Get a list of group members to be excluded from the main query
|
||||
$group_members = array();
|
||||
$args = array(
|
||||
'exclude_admins_mods' => false
|
||||
);
|
||||
if ( $search_terms )
|
||||
$args['search'] = $search_terms;
|
||||
|
||||
$group_members[] = bp_loggedin_user_id();
|
||||
|
||||
// Now do a user query
|
||||
// Pass a null blog id so that the capabilities check is skipped. For BP blog_id doesn't
|
||||
// matter anyway
|
||||
$user_query = new Bp_Dedication_User_Query( array( 'blog_id' => NULL, 'exclude' => $group_members, 'search' => $search_terms ) );
|
||||
|
||||
return $user_query->results;
|
||||
}
|
||||
|
||||
//$oldURL = dirname(__FILE__);
|
||||
//$newURL = str_replace(DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'dedication-from-site', '', $oldURL);
|
||||
//
|
||||
//require_once( $newURL . DIRECTORY_SEPARATOR . 'wp-load.php');
|
||||
//global $wpdb;
|
||||
//
|
||||
//var_dump($_REQUEST);
|
||||
//
|
||||
//// if the 'term' variable is not sent with the request, exit
|
||||
//if (!isset($_REQUEST['term']))
|
||||
// exit;
|
||||
//
|
||||
//$data = array();
|
||||
//
|
||||
//$wp_user_search = $wpdb->get_results("SELECT ID, display_name, user_email FROM $wpdb->users ORDER BY ID");
|
||||
//foreach ($wp_user_search as $userid) {
|
||||
// $user_id = (int) $userid->ID;
|
||||
// $display_name = stripslashes($userid->display_name);
|
||||
// $user_email = stripslashes($userid->user_email);
|
||||
//
|
||||
// $data[] = array(
|
||||
// 'label' => $display_name . ' (' . $user_email . ')',
|
||||
// 'value' => $user_id
|
||||
// );
|
||||
//}
|
||||
//// jQuery wants JSON data
|
||||
//echo json_encode($data);
|
||||
//flush();
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
class Bp_Dedication_User_Query extends WP_User_Query {
|
||||
|
||||
function __construct($query = null) {
|
||||
add_action('pre_user_query', array(&$this, 'filter_registered_users_only'));
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* BuddyPress has different user statuses. We need to filter the user list so only registered users are shown.
|
||||
*/
|
||||
function filter_registered_users_only($query) {
|
||||
$query->query_where .= ' AND user_status = 0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WP_User_Query::get_search_sql()
|
||||
*/
|
||||
function get_search_sql($string, $cols, $wild = false) {
|
||||
$string = esc_sql($string);
|
||||
|
||||
// Always search all columns
|
||||
$cols = array(
|
||||
'user_email',
|
||||
'user_login',
|
||||
'user_nicename',
|
||||
'user_url',
|
||||
'display_name'
|
||||
);
|
||||
|
||||
// Always do 'both' for trailing_wild
|
||||
$wild = 'both';
|
||||
|
||||
$searches = array();
|
||||
$leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : '';
|
||||
$trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : '';
|
||||
foreach ($cols as $col) {
|
||||
if ('ID' == $col)
|
||||
$searches[] = "$col = '$string'";
|
||||
else
|
||||
$searches[] = "$col LIKE '$leading_wild" . like_escape($string) . "$trailing_wild'";
|
||||
}
|
||||
|
||||
return ' AND (' . implode(' OR ', $searches) . ') AND user_status = 0';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
|
||||
|
||||
function bp_dedication_create_new_dedication() {
|
||||
@ -11,25 +12,35 @@ function bp_dedication_create_new_dedication() {
|
||||
*/
|
||||
check_admin_referer('bp_dedication_create_new_dedication');
|
||||
|
||||
if (empty($_POST) || !wp_verify_nonce($_POST['_wpnonce_new_dedication'], 'new_dedication')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do some minor form validation to make sure there is content
|
||||
if (isset($_POST['dedication-text'])) {
|
||||
$title = $_POST['dedication-text'];
|
||||
if (isset($_POST['dedication_text'])) {
|
||||
$title = $_POST['dedication_text'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['video-url'])) {
|
||||
$video_url = $_POST['video-url'];
|
||||
if (isset($_POST['friend_ids'])) {
|
||||
$friend_ids = $_POST['friend_ids'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['artist-name'])) {
|
||||
$artist_name = $_POST['artist-name'];
|
||||
if (isset($_POST['video_url'])) {
|
||||
$video_url = $_POST['video_url'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_POST['song-name'])) {
|
||||
$song_name = $_POST['song-name'];
|
||||
if (isset($_POST['artist_name'])) {
|
||||
$artist_name = $_POST['artist_name'];
|
||||
}
|
||||
|
||||
if (isset($_POST['song_name'])) {
|
||||
$song_name = $_POST['song_name'];
|
||||
}
|
||||
|
||||
if (isset($_POST['private'])) {
|
||||
@ -21,42 +21,27 @@ function bp_dedication_my_dedications() {
|
||||
|
||||
add_action( 'bp_template_title', 'bp_dedication_my_dedications_title' );
|
||||
add_action( 'bp_template_content', 'bp_dedication_my_dedications_content' );
|
||||
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
||||
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'dedications/index' ) );
|
||||
}
|
||||
|
||||
function bp_dedication_my_dedications_title() {
|
||||
_e( 'My dedications', 'bp-dedication' );
|
||||
?>
|
||||
<h4><?php _e( 'My dedications', 'bp-dedication' ); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
function bp_dedication_my_dedications_content() {
|
||||
global $bp;
|
||||
|
||||
$dedications = bp_dedication_get_dedications_from_user( $bp->displayed_user->id );
|
||||
if (!locate_template( 'dedications/single/my-dedications.php', true )) {
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* For security reasons, we MUST use the wp_nonce_url() function on any actions.
|
||||
* This will stop naughty people from tricking users into performing actions without their
|
||||
* knowledge or intent.
|
||||
*/
|
||||
$send_link = wp_nonce_url( $bp->displayed_user->domain . $bp->current_component . '/screen-one/send-h5', 'bp_example_send_high_five' );
|
||||
?>
|
||||
<h4><?php _e( 'Welcome to Screen One', 'bp-example' ) ?></h4>
|
||||
<p><?php printf( __( 'Send %s a <a href="%s" title="Send high-five!">high-five!</a>', 'bp-example' ), $bp->displayed_user->fullname, $send_link ) ?></p>
|
||||
|
||||
<?php if ( $dedications ) : ?>
|
||||
<h4><?php _e( 'Received High Fives!', 'bp-example' ) ?></h4>
|
||||
|
||||
<table id="high-fives">
|
||||
<?php foreach ( $dedications as $dedication ) : ?>
|
||||
<tr>
|
||||
<td width="1%"></td>
|
||||
<td> <a href="<?php echo get_post_permalink($dedication->ID); ?>"><?php echo apply_filters( 'the_title', $dedication->post_title, $dedication->ID ); ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
//$send_link = wp_nonce_url( $bp->displayed_user->domain . $bp->current_component . '/screen-one/send-h5', 'bp_example_send_high_five' );
|
||||
}
|
||||
|
||||
|
||||
function bp_dedication_dedications_to_me() {
|
||||
@ -66,42 +51,20 @@ function bp_dedication_dedications_to_me() {
|
||||
|
||||
add_action( 'bp_template_title', 'bp_dedication_dedications_to_me_title' );
|
||||
add_action( 'bp_template_content', 'bp_dedication_dedications_to_me_content' );
|
||||
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
||||
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'dedications/index' ) );
|
||||
}
|
||||
|
||||
function bp_dedication_dedications_to_me_title() {
|
||||
_e( 'Dedicated 2u', 'bp-dedication' );
|
||||
?>
|
||||
<h4><?php _e( 'Dedicated 2u', 'bp-dedication' ); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
function bp_dedication_dedications_to_me_content() {
|
||||
global $bp;
|
||||
|
||||
$dedications = bp_dedication_get_dedications_to_user( $bp->displayed_user->id );
|
||||
|
||||
/**
|
||||
* For security reasons, we MUST use the wp_nonce_url() function on any actions.
|
||||
* This will stop naughty people from tricking users into performing actions without their
|
||||
* knowledge or intent.
|
||||
*/
|
||||
$send_link = wp_nonce_url( $bp->displayed_user->domain . $bp->current_component . '/screen-one/send-h5', 'bp_example_send_high_five' );
|
||||
?>
|
||||
<h4><?php _e( 'Welcome to Screen One', 'bp-example' ) ?></h4>
|
||||
<p><?php printf( __( 'Send %s a <a href="%s" title="Send high-five!">high-five!</a>', 'bp-example' ), $bp->displayed_user->fullname, $send_link ) ?></p>
|
||||
|
||||
<?php if ( $dedications ) : ?>
|
||||
<h4><?php _e( 'Received High Fives!', 'bp-dedication' ) ?></h4>
|
||||
|
||||
<table id="high-fives">
|
||||
<?php foreach ( $dedications as $dedication ) : ?>
|
||||
<tr>
|
||||
<td width="1%"></td>
|
||||
<td> <a href="<?php echo get_post_permalink($dedication->ID); ?>"><?php echo apply_filters( 'the_title', $dedication->post_title, $dedication->ID ); ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
if (!locate_template( 'dedications/single/dedicated-2-me.php', true )) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
function bp_dedication_new_dedication() {
|
||||
global $bp;
|
||||
@ -119,72 +82,19 @@ function bp_dedication_new_dedication() {
|
||||
|
||||
add_action( 'bp_template_title', 'bp_dedication_new_dedication_title' );
|
||||
add_action( 'bp_template_content', 'bp_dedication_new_dedication_content' );
|
||||
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
||||
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'dedications/index' ) );
|
||||
}
|
||||
|
||||
function bp_dedication_new_dedication_title() {
|
||||
_e( 'New dedication', 'bp-dedication' );
|
||||
?>
|
||||
<h4><?php _e( 'New dedication', 'bp-dedication' ); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
function bp_dedication_new_dedication_content() {
|
||||
locate_template( 'dedication/new-dedication.php', true );
|
||||
locate_template( 'dedications/single/new-dedication.php', true );
|
||||
}
|
||||
|
||||
//function bp_example_screen_two() {
|
||||
// global $bp;
|
||||
//
|
||||
// /**
|
||||
// * On the output for this second screen, as an example, there are terms and conditions with an
|
||||
// * "Accept" link (directs to http://example.org/members/andy/example/screen-two/accept)
|
||||
// * and a "Reject" link (directs to http://example.org/members/andy/example/screen-two/reject)
|
||||
// */
|
||||
//
|
||||
// if ( bp_is_example_component() && bp_is_current_action( 'screen-two' ) && bp_is_action_variable( 'accept', 0 ) ) {
|
||||
// if ( bp_example_accept_terms() ) {
|
||||
// /* Add a success message, that will be displayed in the template on the next page load */
|
||||
// bp_core_add_message( __( 'Terms were accepted!', 'bp-example' ) );
|
||||
// } else {
|
||||
// /* Add a failure message if there was a problem */
|
||||
// bp_core_add_message( __( 'Terms could not be accepted.', 'bp-example' ), 'error' );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Now redirect back to the page without any actions set, so the user can't carry out actions multiple times
|
||||
// * just by refreshing the browser.
|
||||
// */
|
||||
// bp_core_redirect( bp_loggedin_user_domain() . bp_get_example_slug() );
|
||||
// }
|
||||
//
|
||||
// if ( bp_is_example_component() && bp_is_current_action( 'screen-two' ) && bp_is_action_variable( 'reject', 0 ) ) {
|
||||
// if ( bp_example_reject_terms() ) {
|
||||
// /* Add a success message, that will be displayed in the template on the next page load */
|
||||
// bp_core_add_message( __( 'Terms were rejected!', 'bp-example' ) );
|
||||
// } else {
|
||||
// /* Add a failure message if there was a problem */
|
||||
// bp_core_add_message( __( 'Terms could not be rejected.', 'bp-example' ), 'error' );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Now redirect back to the page without any actions set, so the user can't carry out actions multiple times
|
||||
// * just by refreshing the browser.
|
||||
// */
|
||||
// bp_core_redirect( bp_loggedin_user_domain() . bp_get_example_slug() );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * If the user has not Accepted or Rejected anything, then the code above will not run,
|
||||
// * we can continue and load the template.
|
||||
// */
|
||||
// do_action( 'bp_example_screen_two' );
|
||||
//
|
||||
// add_action( 'bp_template_title', 'bp_example_screen_two_title' );
|
||||
// add_action( 'bp_template_content', 'bp_example_screen_two_content' );
|
||||
//
|
||||
// /* Finally load the plugin template file. */
|
||||
// bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
||||
//}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The following screen functions are called when the Settings subpanel for this component is viewed
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
form.standard-form textarea.dedication_text {
|
||||
width: 100% !important;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
form.standard-form .video_url,
|
||||
form.standard-form .artist_name,
|
||||
form.standard-form .song_name,
|
||||
form.standard-form .dedicate_to_input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
form.standard-form ul.acfb-holder li {
|
||||
list-style: none;
|
||||
margin-left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#thumbs {
|
||||
float: right;
|
||||
background: #ccc url(img/thumbnail.jpg) center no-repeat;
|
||||
width: 320px;
|
||||
height: 240px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#thumbs img {
|
||||
width: 320px;
|
||||
height: 240px;
|
||||
}
|
||||
|
||||
form.standard-form .loading {
|
||||
background:url('img/loading.gif') left no-repeat;
|
||||
}
|
||||
|
||||
.autocomplete-w1 { background:url(img/shadow.png) no-repeat bottom right; position:absolute; top:0px; left:0px; margin:8px 0 0 6px; /* IE6 fix: */ _background:none; _margin:0; }
|
||||
.autocomplete { border:1px solid #999; background:#FFF; cursor:default; text-align:left; max-height:350px; overflow:auto; margin:-6px 6px 6px -6px; /* IE6 specific: */ _height:350px; _margin:0; _overflow-x:hidden; }
|
||||
.autocomplete .selected { background:#F0F0F0; }
|
||||
.autocomplete div { padding:2px 5px; white-space:nowrap; }
|
||||
.autocomplete strong { font-weight:normal; color:#3399FF; }
|
||||
|
||||
#user-list {
|
||||
float: right;
|
||||
width: 310px;
|
||||
display: inline-block;
|
||||
margin-top: 30px;
|
||||
height: 275px;
|
||||
overflow: auto;
|
||||
border: 1px solid #ccc;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
padding: 5px;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
#user-list li {
|
||||
border-top: none;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#user-list li .avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
|
||||
}
|
||||
|
||||
.error {
|
||||
font-style: italic;
|
||||
color: #900;
|
||||
font-weight: normal;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
BIN
wp-content/plugins/bp-dedication/includes/css/img/loading.gif
Normal file
|
After Width: | Height: | Size: 673 B |
BIN
wp-content/plugins/bp-dedication/includes/css/img/shadow.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
wp-content/plugins/bp-dedication/includes/css/img/thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,102 @@
|
||||
jQuery(document).ready(function(){
|
||||
|
||||
var j = jQuery;
|
||||
|
||||
// validate signup form on keyup and submit
|
||||
j("#new-dedication-form").validate({
|
||||
ignore: [],
|
||||
messages: {
|
||||
friend_ids: "Please enter at least one member."
|
||||
}
|
||||
});
|
||||
|
||||
var onAutocompleteSelect = function(value, data) {
|
||||
j('#selection').html('<img src="\/global\/flags\/small\/' + data + '.png" alt="" \/> ' + value);
|
||||
alert(data);
|
||||
}
|
||||
|
||||
var options = {
|
||||
minLength: 1,
|
||||
serviceUrl: ajaxurl,
|
||||
width: 300,
|
||||
delimiter: /(,|;)\s*/,
|
||||
onSelect: ia_on_autocomplete_select,
|
||||
deferRequestBy: 0, //miliseconds
|
||||
params: {
|
||||
action: 'bp_dedication_autocomplete_ajax_handler'
|
||||
},
|
||||
noCache: true //set to true, to disable caching
|
||||
};
|
||||
|
||||
j("#dedicate_to_input").autocomplete(options);
|
||||
|
||||
var url = '';
|
||||
|
||||
j('#video_url').change(function(){
|
||||
// Check for empty input field
|
||||
if(j('#video_url').val() != ''){
|
||||
// Get youtube video's thumbnail url
|
||||
// using jYoutube jQuery plugin
|
||||
url = j.jYoutube(j('#video_url').val());
|
||||
|
||||
// Now append this image to <div id="thumbs">
|
||||
j('#thumbs').html(j('<img src="'+url+'" />'));
|
||||
}
|
||||
});
|
||||
|
||||
j("#user-list li a.remove").live("click", function() {
|
||||
var friend_id = j(this).prop('id');
|
||||
|
||||
friend_id = friend_id.split('-');
|
||||
friend_id = friend_id[1];
|
||||
|
||||
j.post( ajaxurl, {
|
||||
action: 'bp_dedication_add_user_ajax_handler',
|
||||
'friend_action': 'remove',
|
||||
'cookie': encodeURIComponent(document.cookie),
|
||||
//'_wpnonce': j("input#_wpnonce_invite_uninvite_user").val(),
|
||||
'friend_id': friend_id
|
||||
},
|
||||
function(response)
|
||||
{
|
||||
friendIDs = j('#friend_ids').val().split(',');
|
||||
friendIDs.splice(j.inArray(friend_id, friendIDs),1);
|
||||
j('#friend_ids').val(friendIDs.toString());
|
||||
|
||||
j('#user-list li#uid-' + friend_id).remove();
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function ia_on_autocomplete_select( value, data ) {
|
||||
var j = jQuery;
|
||||
var friendIDs;
|
||||
|
||||
// Check the right checkbox
|
||||
//j('#invite-anyone-member-list input#f-' + data).prop('checked',true);
|
||||
|
||||
j('#dedicate_to_input').addClass('loading');
|
||||
|
||||
j.post( ajaxurl, {
|
||||
action: 'bp_dedication_add_user_ajax_handler',
|
||||
'friend_action': 'add',
|
||||
'cookie': encodeURIComponent(document.cookie),
|
||||
//'_wpnonce': j("input#_wpnonce_invite_uninvite_user").val(),
|
||||
'friend_id': data
|
||||
},
|
||||
function(response)
|
||||
{
|
||||
friendIDs = j('#friend_ids').val().split(',');
|
||||
friendIDs.push(data);
|
||||
j('#friend_ids').val(friendIDs.toString());
|
||||
|
||||
j('#user-list').append(response);
|
||||
j('#dedicate_to_input').removeClass('loading');
|
||||
});
|
||||
|
||||
// Remove the value from the send-to-input box
|
||||
j('#dedicate_to_input').val('');
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* jYoutube 1.0 - YouTube video image getter plugin for jQuery
|
||||
*
|
||||
* Copyright (c) 2009 jQuery Howto
|
||||
*
|
||||
* Licensed under the GPL license:
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Plugin home & Author URL:
|
||||
* http://jquery-howto.blogspot.com
|
||||
*
|
||||
*/
|
||||
(function($){
|
||||
$.extend({
|
||||
jYoutube: function( url, size ){
|
||||
if(url === null){ return ""; }
|
||||
|
||||
size = (size === null) ? "big" : size;
|
||||
var vid;
|
||||
var results;
|
||||
|
||||
results = url.match("[\\?&]v=([^&#]*)");
|
||||
|
||||
vid = ( results === null ) ? url : results[1];
|
||||
|
||||
if(size == "small"){
|
||||
return "http://img.youtube.com/vi/"+vid+"/2.jpg";
|
||||
}else {
|
||||
return "http://img.youtube.com/vi/"+vid+"/0.jpg";
|
||||
}
|
||||
}
|
||||
})
|
||||
})(jQuery);
|
||||
51
wp-content/plugins/bp-dedication/includes/js/jquery.validate.min.js
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* jQuery Validation Plugin 1.9.0
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
||||
* http://docs.jquery.com/Plugins/Validation
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 Jörn Zaefferer
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;this.attr("novalidate","novalidate");b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){a=this.find("input, button");a.filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&a.filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
|
||||
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
|
||||
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
|
||||
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
|
||||
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
|
||||
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
|
||||
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,
|
||||
a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),
|
||||
minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator"),g="on"+e.type.replace(/^validate/,
|
||||
"");f.settings[g]&&f.settings[g].call(f,this[0],e)}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=
|
||||
this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",a).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",
|
||||
a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement=
|
||||
a=this.validationTargetFor(this.clean(a));this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors?
|
||||
this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()==
|
||||
0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
|
||||
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
|
||||
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.validationTargetFor(this.clean(a));var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+
|
||||
a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==undefined)return arguments[a]},defaultMessage:function(a,
|
||||
b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]=
|
||||
d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);
|
||||
if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
|
||||
d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=
|
||||
this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];return a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,
|
||||
e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
|
||||
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
|
||||
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
|
||||
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e;if(e=d==="required"&&typeof c.fn.prop==="function"?a.prop(d):a.attr(d))b[d]=e;else if(a[0].getAttribute("type")===d)b[d]=true}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};
|
||||
var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?
|
||||
e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;
|
||||
return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,
|
||||
b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,
|
||||
mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,
|
||||
b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)},
|
||||
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
|
||||
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 -]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
|
||||
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
|
||||
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
|
||||
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
|
||||
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);
|
||||
@ -0,0 +1,515 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Dedication From Site
|
||||
* Plugin URI:
|
||||
* Description:
|
||||
* Author:
|
||||
* Version:
|
||||
* Date:
|
||||
* Author URI:
|
||||
*/
|
||||
|
||||
/* We need the admin functions to use wp_create_category(). */
|
||||
require_once(ABSPATH . 'wp-admin' . "/includes/admin.php");
|
||||
require_once('pfs-widget.php');
|
||||
|
||||
class DedicationFromSite {
|
||||
/* global variables */
|
||||
protected $linktext = '';
|
||||
protected $popup = true;
|
||||
protected $cat = '';
|
||||
protected $form_id = 0;
|
||||
|
||||
public function __construct($id = 0, $linktext = '', $popup = true, $cat = '') {
|
||||
$this->form_id = $id;
|
||||
$this->linktext = $linktext;
|
||||
$this->popup = $popup;
|
||||
$this->cat = $cat;
|
||||
|
||||
register_activation_hook( __FILE__, array($this,'install') );
|
||||
|
||||
// add pfs_domain for translation
|
||||
load_plugin_textdomain('pfs_domain');
|
||||
|
||||
// add pfs_options group & apply validation filter, add settings fields & section
|
||||
add_action('admin_init', array($this, 'admin_init') );
|
||||
|
||||
// add js & css
|
||||
add_action( 'get_header', array($this,'includes') );
|
||||
|
||||
// add admin page & options
|
||||
add_action( 'admin_menu', array($this, 'show_settings') );
|
||||
|
||||
// add shortcode support
|
||||
add_shortcode( 'post-from-site', array($this, 'shortcode') );
|
||||
|
||||
// add admin menu item. Probably not going to happen.
|
||||
//add_action( 'admin_bar_menu', array($this, 'add_admin_link'), 1000 );
|
||||
}
|
||||
|
||||
public function install(){
|
||||
//nothing here yet, as there's really nothing to 'install' that isn't covered by __construct
|
||||
}
|
||||
|
||||
/**
|
||||
* Add options to databases with defaults
|
||||
*/
|
||||
public function show_settings() {
|
||||
add_options_page('Dedication From Site', 'Dedication From Site', 'manage_options', 'pfs', array($this, 'settings') );
|
||||
|
||||
if (!get_option("pfs_options")) {
|
||||
$options= array( 0 => array() );
|
||||
$options[0]['default_author'] = '';
|
||||
$options[0]['allow_image'] = true;
|
||||
$options[0]['wp_image_size'] = 'medium';
|
||||
|
||||
$options[0]['post_status'] = 'publish';
|
||||
$options[0]['post_type'] = 'post';
|
||||
$options[0]['comment_status'] = 'open';
|
||||
$options[0]['post_category'] = '';
|
||||
$options[0]['taxonomy'] = array();
|
||||
|
||||
$options[0]['enable_captcha'] = false;
|
||||
$options[0]['allow_anon'] = false;
|
||||
$options['recaptcha_public_key'] = '';
|
||||
$options['recaptcha_private_key'] = '';
|
||||
add_option ("pfs_options", $options) ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* What to display in the admin menu
|
||||
*/
|
||||
public function settings() { ?>
|
||||
<div class="wrap pfs">
|
||||
<h2><?php _e('Dedication From Site Settings','pfs_domain'); ?></h2>
|
||||
|
||||
<form method="post" action="options.php" id="options">
|
||||
<?php settings_fields('pfs_options'); ?>
|
||||
|
||||
<?php do_settings_sections('pfs'); ?>
|
||||
|
||||
<?php submit_button(); ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function admin_init(){
|
||||
register_setting( 'pfs_options', 'pfs_options', array($this, 'validate') );
|
||||
add_settings_section('pfs_users', 'User Settings', array($this, 'setting_section_users'), 'pfs');
|
||||
add_settings_field('pfs_allow_anon', 'Allow anonymous (not logged in) users to create posts?', array($this, 'setting_allow_anon'), 'pfs', 'pfs_users');
|
||||
add_settings_field('pfs_default_user', 'Posts by anonymous users should be created by this author:<br /><small><a href="user-new.php">Create new user?</a></small>', array($this, 'setting_default_author'), 'pfs', 'pfs_users');
|
||||
add_settings_field('pfs_enable_captcha', 'Enable <a href="http://www.google.com/recaptcha">Recaptcha</a> for not logged in users? (recommended)', array($this, 'setting_enable_captcha'), 'pfs', 'pfs_users');
|
||||
add_settings_field('pfs_recaptcha_public_key', '<a href="http://www.google.com/recaptcha">Recaptcha API</a> public key:', array($this, 'setting_recaptcha_public_key'), 'pfs', 'pfs_users');
|
||||
add_settings_field('pfs_recaptcha_private_key', '<a href="http://www.google.com/recaptcha">Recaptcha API</a> private key:', array($this, 'setting_recaptcha_private_key'), 'pfs', 'pfs_users');
|
||||
|
||||
add_settings_section('pfs_post', 'Post Creation Settings', array($this, 'setting_section_post'), 'pfs');
|
||||
add_settings_field('pfs_post_status', 'Post status:', array($this, 'setting_post_status'), 'pfs', 'pfs_post');
|
||||
add_settings_field('pfs_post_type', 'Post type:<br /><small><a href="http://codex.wordpress.org/Custom_Post_Types">Custom Post Types</a> supported!</small>', array($this, 'setting_post_type'), 'pfs', 'pfs_post');
|
||||
add_settings_field('pfs_comment_status', 'Comment status:', array($this, 'setting_comment_status'), 'pfs', 'pfs_post');
|
||||
add_settings_field('pfs_taxonomy', 'Allowed taxonomies:', array($this, 'setting_taxonomy'), 'pfs', 'pfs_post');
|
||||
add_settings_field('pfs_post_category', 'Post category:', array($this, 'setting_category'), 'pfs', 'pfs_post');
|
||||
|
||||
add_settings_section('pfs_image', 'Image Upload Settings', array($this, 'setting_section_image'), 'pfs');
|
||||
add_settings_field('pfs_allow_image', 'Allow users to upload an image?', array($this, 'setting_allow_image'), 'pfs', 'pfs_image');
|
||||
add_settings_field('pfs_wp_image_size', 'Image size setting to use:', array($this, 'setting_wp_image_size'), 'pfs', 'pfs_image');
|
||||
|
||||
|
||||
}
|
||||
function setting_section_users() {
|
||||
echo '<p>By default, all logged-in users can use the post-from-site interface to create a post.</p>';
|
||||
}
|
||||
function setting_allow_anon() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
echo "<input id='pfs_allow_anon' name='pfs_options[0][allow_anon]' size='40' type='checkbox' value='1' ";
|
||||
if ( $options['allow_anon'] == true ) echo "checked='checked'";
|
||||
echo "/>";
|
||||
}
|
||||
function setting_default_author() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
/* listing of authors */
|
||||
wp_dropdown_users( array(
|
||||
'blog_id' => get_current_blog_id(),
|
||||
'name' => 'pfs_options[0][default_author]',
|
||||
'id' => 'pfs_default_author',
|
||||
'selected' => $options['default_author']
|
||||
) );
|
||||
}
|
||||
function setting_enable_captcha() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
echo "<input id='pfs_enable_captcha' name='pfs_options[0][enable_captcha]' size='40' type='checkbox' value='1' ";
|
||||
if ( $options['enable_captcha'] == true ) echo "checked='checked'";
|
||||
echo "/>";
|
||||
}
|
||||
function setting_recaptcha_public_key() {
|
||||
$options = get_option('pfs_options');
|
||||
echo "<input id='pfs_recaptcha_public_key' name='pfs_options[recaptcha_public_key]' size='40' type='text' value='{$options['recaptcha_public_key']}' />";
|
||||
}
|
||||
function setting_recaptcha_private_key() {
|
||||
$options = get_option('pfs_options');
|
||||
echo "<input id='pfs_recaptcha_private_key' name='pfs_options[recaptcha_private_key]' size='40' type='text' value='{$options['recaptcha_private_key']}' />";
|
||||
}
|
||||
|
||||
function setting_section_post() {
|
||||
echo '<p>Settings for posts created by Post From Site. Defaults to a published Post with comments open, and no taxonomies.</p>';
|
||||
}
|
||||
function setting_post_status() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
echo "<select name='pfs_options[0][post_status]'>";
|
||||
echo "<option value='draft' ";
|
||||
echo ('draft' == $options['post_status']) ? 'selected' : '' ;
|
||||
echo ">". __('Draft','pfs_domain')."</option>";
|
||||
echo "<option value='pending' ";
|
||||
echo ('pending' == $options['post_status']) ? 'selected' : '' ;
|
||||
echo ">".__('Pending','pfs_domain')."</option>";
|
||||
echo "<option value='publish' ";
|
||||
echo ('publish' == $options['post_status']) ? 'selected' : '' ;
|
||||
echo ">". __('Publish','pfs_domain')."</option>";
|
||||
echo "</select>";
|
||||
}
|
||||
function setting_post_type() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
echo "<select id='pfs_post_type' name='pfs_options[0][post_type]'>";
|
||||
$post_types = get_post_types(array('public'=>true),'object');
|
||||
foreach ($post_types as $post_type ) {
|
||||
if ("attachment" == $post_type->name) continue;
|
||||
if ($post_type->name == $options['post_type']) {
|
||||
echo '<option value="'.$post_type->name.'" selected>'.$post_type->labels->singular_name.'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$post_type->name.'">'.$post_type->labels->singular_name.'</option>';
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
}
|
||||
function setting_comment_status() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
echo "<select id='pfs_comment_status' name='pfs_options[0][comment_status]'>";
|
||||
echo "<option value='closed' ";
|
||||
echo ('closed' == $options['comment_status']) ? 'selected' : '' ;
|
||||
echo ">".__('Closed','pfs_domain')."</option>";
|
||||
echo "<option value='open' ";
|
||||
echo ('open' == $options['comment_status']) ? 'selected' : '' ;
|
||||
echo ">".__('Open','pfs_domain')."</option>";
|
||||
echo "</select>";
|
||||
}
|
||||
function setting_taxonomy() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
$taxonomies = get_taxonomies(array( 'public' => true ),'object');
|
||||
echo "<ul>";
|
||||
foreach ($taxonomies as $taxonomy ) {
|
||||
echo '<li><label><input type="checkbox" name="pfs_options[0][taxonomy][]" value="'.$taxonomy->name.'" ';
|
||||
if ( array_key_exists('taxonomy',$options) && is_array($options['taxonomy']) && in_array($taxonomy->name, $options['taxonomy']) ) echo ' checked="checked"';
|
||||
echo '/> '. $taxonomy->labels->name. '</label></li>';
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
function setting_category() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
$categories = get_categories(array( 'public' => true ),'object');
|
||||
|
||||
echo "<select id='pfs_post_category' name='pfs_options[0][post_category]'>";
|
||||
foreach ($categories as $category ) {
|
||||
if ($category->name == $options['post_category']) {
|
||||
echo '<option value="'.$category->term_id.'" selected>'.$category->name.'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$category->term_id.'">'.$category->name.'</option>';
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
}
|
||||
|
||||
function setting_section_image() {
|
||||
echo '<p>Main description of this section here.</p>';
|
||||
}
|
||||
function setting_allow_image() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
echo "<input id='pfs_allow_image' name='pfs_options[0][allow_image]' size='40' type='checkbox' value='1' ";
|
||||
if ( $options['allow_image'] == 1 ) echo "checked='checked'";
|
||||
echo "/>";
|
||||
}
|
||||
function setting_wp_image_size() {
|
||||
$options = get_option('pfs_options');
|
||||
$options = $options[0];
|
||||
$sizes = get_intermediate_image_sizes();
|
||||
echo "<select id='pfs_wp_image_size' name='pfs_options[0][wp_image_size]'>";
|
||||
foreach ($sizes as $size ) {
|
||||
if ($size == $options['wp_image_size']) {
|
||||
echo '<option value="'.$size.'" selected>'.$size.'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$size.'">'.$size.'</option>';
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize and validate input.
|
||||
* @param array $input an array to sanitize
|
||||
* @return array a valid array.
|
||||
*/
|
||||
public function validate($input) {
|
||||
$ok = array('publish','pending','draft');
|
||||
$users = array();
|
||||
$user_objs = get_users( array(
|
||||
'blog_id' => $GLOBALS['blog_id'],
|
||||
'fields' => array( 'ID', 'user_login' )
|
||||
) );
|
||||
foreach ( $user_objs as $u ){
|
||||
$users[] = $u->ID;
|
||||
}
|
||||
|
||||
foreach ($input as $i => $val) {
|
||||
if (is_array($val)){
|
||||
$input[$i]['allow_anon'] = array_key_exists('allow_anon',$val);
|
||||
$input[$i]['default_author'] = (in_array($val['default_author'], $users)) ? $val['default_author'] : 'anon' ;
|
||||
$input[$i]['enable_captcha'] = array_key_exists('enable_captcha',$val);
|
||||
|
||||
$input[$i]['post_status'] = (in_array($val['post_status'],$ok) ? $val['post_status'] : 'pending');
|
||||
$input[$i]['post_type'] = (post_type_exists($val['post_type']) ? $val['post_type'] : 'post');
|
||||
$input[$i]['comment_status'] = ($val['comment_status'] == 'open' ? 'open' : 'closed');
|
||||
if ( array_key_exists('taxonomy',$val) ){
|
||||
foreach ( $input[$i]['taxonomy'] as $j => $tax) {
|
||||
if (!taxonomy_exists($tax)) {
|
||||
unset($input[$i]['taxonomy'][$j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$input[$i]['allow_image'] = array_key_exists('allow_image', $val);
|
||||
$input[$i]['wp_image_size'] = (in_array($val['wp_image_size'],get_intermediate_image_sizes())) ? $val['wp_image_size'] : 'medium';
|
||||
}
|
||||
}
|
||||
$input['recaptcha_public_key'] = urlencode($input['recaptcha_public_key']);
|
||||
$input['recaptcha_private_key'] = urlencode($input['recaptcha_private_key']);
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add javascript and css to header files.
|
||||
*/
|
||||
public function includes(){
|
||||
if (is_page(array(1054, 'new-dedication'))) {
|
||||
wp_enqueue_script( 'jquery-autocomplete-js', plugins_url("includes/jquery.autocomplete-min.js",__FILE__), array( 'jquery' ) );
|
||||
wp_enqueue_script( 'jquery-multi-upload', plugins_url("includes/jquery.MultiFile.pack.js",__FILE__), array('jquery','jquery-form') );
|
||||
wp_enqueue_script( 'pfs-script', plugins_url("includes/pfs-script.js",__FILE__) );
|
||||
|
||||
wp_localize_script('pfs-script', 'pfs_script_vars', array(
|
||||
'source_url' => plugins_url("search.php",__FILE__)
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_style( 'pfs-min-style', plugins_url("includes/minimal.css",__FILE__) );
|
||||
$theme_css = apply_filters( 'pfs_theme_css', plugins_url("includes/twentyeleven.css",__FILE__) );
|
||||
wp_enqueue_style( 'pfs-style', $theme_css );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add shortcode support.
|
||||
* @param $atts shortcode attributes, cat, link, and popup
|
||||
* cat is the category to post to, link is the display text of the link,
|
||||
* and popup decides whether it's an inline form (false) or a popup box (true).
|
||||
*/
|
||||
function shortcode($atts, $content=null, $code="") {
|
||||
$a = shortcode_atts( array(
|
||||
'link' => 'quick post',
|
||||
'popup' => false,
|
||||
'cat' => ''
|
||||
), $atts );
|
||||
$pfs = new DedicationFromSite(0, $a['link'], $a['popup'], $a['cat']);
|
||||
return $pfs->get_form();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a link to show the form from the admin bar
|
||||
function add_admin_link() {
|
||||
global $wp_admin_bar, $wpdb;
|
||||
if ( !is_super_admin() || !is_admin_bar_showing() )
|
||||
return;
|
||||
$this->popup = false;
|
||||
$form = "</a>".$this->get_form();
|
||||
/ * Add the main siteadmin menu item * /
|
||||
$wp_admin_bar->add_menu( array( 'id' => 'post_from_site', 'title' => __( 'Write a Post', 'pfs_domain' ), 'href' => FALSE ) );
|
||||
$wp_admin_bar->add_menu( array( 'parent' => 'post_from_site', 'title' => $form, 'href' => FALSE ) );
|
||||
} */
|
||||
|
||||
/**
|
||||
* Creates link and postbox (initially hidden with display:none), calls pfs_submit on form-submission. Echos the form.
|
||||
* @param string $cat Category ID for posting specifically to one category. Default is '', which allows user to choose from allowed categories.
|
||||
* @param string $linktext Link text for post link. Default is set in admin settings, any text here will override that.
|
||||
* @param bool $popup Whether the box should be a 'modal-style' popup or always display
|
||||
*/
|
||||
public function form(){
|
||||
echo $this->get_form();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates link and postbox (initially hidden with display:none), calls pfs_submit on form-submission. Returns the form.
|
||||
* @param string $cat Category ID for posting specifically to one category. Default is '', which allows user to choose from allowed categories.
|
||||
* @param string $linktext Link text for post link. Default is set in admin settings, any text here will override that.
|
||||
* @param bool $popup Whether the box should be a 'modal-style' popup or always display
|
||||
*/
|
||||
public function get_form(){
|
||||
$linktext = $this->linktext;
|
||||
$cat = $this->cat;
|
||||
$popup = $this->popup;
|
||||
$id = $this->form_id;
|
||||
$pfs_options = get_option('pfs_options');
|
||||
$options = $pfs_options[0];
|
||||
|
||||
|
||||
/*$from_user_link = bp_get_loggedin_user_link();
|
||||
$from_user_username = bp_loggedin_user_username();
|
||||
bp_loggedin_user_fullname()*/
|
||||
$from_flag = gp_get_the_flag(bp_loggedin_user_id());
|
||||
|
||||
|
||||
if (''==$linktext) $linktext = apply_filters( 'pfs_default_link_text', __('Click to post.','pfs_domain') );
|
||||
$idtext = $cat.sanitize_html_class($linktext);
|
||||
|
||||
$out = '';
|
||||
|
||||
$out .= "<div id='pfs-post-box-$idtext' ";
|
||||
$out .= "class='pfs-post-box pfs_postform'";
|
||||
$out .= ">\n";
|
||||
|
||||
if (current_user_can('publish_posts') || $options['allow_anon']) {
|
||||
$out .= "<div id='pfs-alert' style='display:none;'></div>\n";
|
||||
$out .= apply_filters( 'pfs_before_form', '', $idtext );
|
||||
$out .= "<form class='pfs' id='pfs_form' method='post' action='".plugins_url("pfs-submit.php",__FILE__). "' enctype='multipart/form-data'>\n";
|
||||
$out .= "<input type='hidden' name='MAX_FILE_SIZE' value='" .apply_filters('pfs_maxfilesize',3000000). "' />\n";
|
||||
$out .= "<input type='hidden' name='pfs_category' value='" .$options['post_category']. "' />\n";
|
||||
$out .= "<input type='hidden' name='postcontent' value='' />\n";
|
||||
$out .= apply_filters( 'pfs_form_start', '', $idtext );
|
||||
|
||||
// from
|
||||
$out .= "<label for='pfs_from'>". __('From:','pfs_domain'). "</label>";
|
||||
$out .= "<div class='input-text' style='display:block'>" . $from_flag . "<span>" . bp_get_loggedin_user_username() . "</span></div>";
|
||||
//$out .= "<input name='from' id='pfs_from' value='" . bp_get_loggedin_user_username() . "' type='text' class='input-text' />\n";
|
||||
|
||||
// to
|
||||
$out .= "<label for='pfs_to'>". __('To:','pfs_domain'). "</label>";
|
||||
$out .= "<input name='to' id='pfs_to' value='' type='text' class='input-text' />\n";
|
||||
|
||||
$out .= "<label for='pfs_title'>". __('Text:','pfs_domain'). "</label> <input name='title' id='pfs_title' value='' type='text' class='input-text' />\n";
|
||||
|
||||
if (!current_user_can('publish_posts') && $options['allow_anon']){ //if not logged in/able to publish posts, and anon posting allowed, show name/email
|
||||
$out .= "<label for='pfs_name'>".__('Name:','pfs_domain')."</label> <input name='name' id='pfs_name' class='input-text' value='' type='text' />";
|
||||
$out .= "<label for='pfs_email'>".__('Email:','pfs_domain')."</label> <input name='email' id='pfs_email' class='input-text' value='' type='email' />\n";
|
||||
}
|
||||
//$out .= "<label for='postcontent'>". __('Content:','pfs_domain'). "</label><textarea id='postcontent' name='postcontent' rows='12' cols='50'></textarea>\n";
|
||||
|
||||
if ( array_key_exists('taxonomy',$options) ){
|
||||
foreach ($options['taxonomy'] as $i => $tax){
|
||||
//if ($tax != 'category' || empty($cat)){
|
||||
$out .= $this->get_taxonomy_list($tax);
|
||||
//}
|
||||
}
|
||||
}
|
||||
if ($options['allow_image']) {
|
||||
$out .= "<label for='pfs_imgdiv$idtext'>". __('Image:','pfs_domain') ."</label>";
|
||||
/*$out .= "<script>function ".$idtext."pfs_auto_browse(){ inputs = document.getElementsByName(\"".$idtext."-image[]\"); inputs[inputs.length-1].click(); }</script>";
|
||||
$out .= "<input type='button' name='not-image' value='".__('Upload an image','pfs_domain')."' onclick='".$idtext."pfs_auto_browse();' />";*/
|
||||
$out .= "<div id='pfs-imgdiv'><input id ='pfs-imgdiv-input' type='file' class='multi' name='image[]' accept='png|gif|jpg|jpeg'/></div>\n";
|
||||
}
|
||||
$out .= "<div class='clear'></div>\n";
|
||||
if ($options['enable_captcha'] && !current_user_can('publish_posts') && $options['allow_anon'] ){
|
||||
if ( !empty($pfs_options['recaptcha_public_key']) ) {
|
||||
require_once('recaptchalib.php');
|
||||
$publickey = $pfs_options['recaptcha_public_key']; // you got this from the signup page
|
||||
$out .= recaptcha_get_html($publickey);
|
||||
} else {
|
||||
return "<div id='pfs-alert' style='display:none;'>Need recaptcha</div>";
|
||||
}
|
||||
}
|
||||
$out .= apply_filters( 'pfs_before_submit', '', $idtext );
|
||||
$out .= "<input type='submit' id='post' class='submit' name='post' value='".__("Post","pfs_domain")."' />\n";
|
||||
$out .= apply_filters( 'pfs_form_end', '', $idtext );
|
||||
$out .= "</form>\n<div class='clear'></div>\n";
|
||||
$out .= apply_filters( 'pfs_after_form', '', $idtext );
|
||||
} else {
|
||||
$out .= apply_filters( 'pfs_alert_login', "<p>You must be logged in to post.</p>" );
|
||||
}
|
||||
$out .= "</div>\n\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the categories
|
||||
* @param string $excluded Categories which are excluded
|
||||
*/
|
||||
public function get_taxonomy_list( $taxonomy ){
|
||||
$terms = get_terms($taxonomy, array(
|
||||
'hide_empty' => 0
|
||||
));
|
||||
if (!$terms || empty($terms)) return '';
|
||||
//preg_match_all('/\s*<option class="(\S*)" value="(\S*)">(.*)<\/option>\s*/', $terms, $matches, PREG_SET_ORDER);
|
||||
$out = apply_filters( 'pfs_taxonomy_label', "<label for='terms_$taxonomy'>$taxonomy</label>", $taxonomy );
|
||||
$out .= "<select id='terms_$taxonomy' name='terms[$taxonomy][]' size='4' multiple='multiple'>";
|
||||
foreach ($terms as $term){
|
||||
if (is_taxonomy_hierarchical($taxonomy))
|
||||
$out .= "<option value='{$term->term_taxonomy_id}'>{$term->name}</option>";
|
||||
else
|
||||
$out .= "<option value='{$term->name}'>{$term->name}</option>";
|
||||
}
|
||||
$out .= "</select><br />\n";
|
||||
return apply_filters("pfs_{$taxonomy}_list",$out);
|
||||
}
|
||||
|
||||
}
|
||||
$pfs = new DedicationFromSite();
|
||||
|
||||
/** === === HELPER FUNCTIONS === === **/
|
||||
/** unused, but left in, 'just in case' **/
|
||||
/**
|
||||
* Convert number in bytes into human readable format (KB, MB etc)
|
||||
* @param int $filesize number in bytes to be converted
|
||||
* @return string bytes in human readable form
|
||||
*/
|
||||
function display_filesize($filesize){
|
||||
if(is_numeric($filesize)) {
|
||||
$decr = 1024; $step = 0;
|
||||
$prefix = array('B','KB','MB','GB','TB','PB');
|
||||
while(($filesize / $decr) > 0.9){
|
||||
$filesize = $filesize / $decr;
|
||||
$step++;
|
||||
}
|
||||
return round($filesize,2).$prefix[$step];
|
||||
} else {
|
||||
return 'NaN';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string filesize in KB (or MB etc) into integer bytes
|
||||
* @param string $filesize size to be converted
|
||||
* @return int filesize in bytes
|
||||
*/
|
||||
function filesize_bytes($filesize){
|
||||
$prefix = array('B'=>0,'KB'=>1,'MB'=>2,'GB'=>3,'TB'=>4);
|
||||
preg_match('/([0-9]*{\.[0-9]*}?)([KMGT]?B)/', strtoupper($filesize), $match);
|
||||
if ('' != $match[0]) {
|
||||
$size = $match[1];
|
||||
for ($i = 0; $i < $prefix[$match[2]]; $i++) $size *= 1000;
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backwards compatibility
|
||||
*/
|
||||
function post_from_site($cat = '', $linktext = ''){
|
||||
$pfs = new DedicationFromSite(0, $linktext, true, $cat);
|
||||
$pfs->form();
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
/*
|
||||
### jQuery Multiple File Upload Plugin v1.47 - 2010-03-26 ###
|
||||
* Home: http://www.fyneworks.com/jquery/multiple-file-upload/
|
||||
* Code: http://code.google.com/p/jquery-multifile-plugin/
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
###
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';3(X.1M)(6($){$.7.2=6(h){3(5.Q==0)8 5;3(R U[0]==\'1f\'){3(5.Q>1){l i=U;8 5.N(6(){$.7.2.14($(5),i)})};$.7.2[U[0]].14(5,$.27(U).26(1)||[]);8 5};l h=$.L({},$.7.2.D,h||{});$(\'21\').1D(\'2-S\').V(\'2-S\').1i($.7.2.15);3($.7.2.D.12){$.7.2.1s($.7.2.D.12);$.7.2.D.12=11};5.1D(\'.2-1a\').V(\'2-1a\').N(6(){X.2=(X.2||0)+1;l e=X.2;l g={e:5,E:$(5),P:$(5).P()};3(R h==\'1W\')h={m:h};l o=$.L({},$.7.2.D,h||{},($.1p?g.E.1p():($.2t?g.E.Z():11))||{},{});3(!(o.m>0)){o.m=g.E.K(\'2e\');3(!(o.m>0)){o.m=(u(g.e.1o.B(/\\b(m|2a)\\-([0-9]+)\\b/q)||[\'\']).B(/[0-9]+/q)||[\'\'])[0];3(!(o.m>0))o.m=-1;1Z o.m=u(o.m).B(/[0-9]+/q)[0]}};o.m=18 1X(o.m);o.j=o.j||g.E.K(\'j\')||\'\';3(!o.j){o.j=(g.e.1o.B(/\\b(j\\-[\\w\\|]+)\\b/q))||\'\';o.j=18 u(o.j).t(/^(j|1e)\\-/i,\'\')};$.L(g,o||{});g.A=$.L({},$.7.2.D.A,g.A);$.L(g,{n:0,J:[],2c:[],19:g.e.I||\'2\'+u(e),1k:6(z){8 g.19+(z>0?\'1U\'+u(z):\'\')},G:6(a,b){l c=g[a],k=$(b).K(\'k\');3(c){l d=c(b,k,g);3(d!=11)8 d}8 1h}});3(u(g.j).Q>1){g.j=g.j.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');g.1w=18 2h(\'\\\\.(\'+(g.j?g.j:\'\')+\')$\',\'q\')};g.M=g.19+\'25\';g.E.1j(\'<O T="2-1j" I="\'+g.M+\'"></O>\');g.1l=$(\'#\'+g.M+\'\');g.e.H=g.e.H||\'p\'+e+\'[]\';3(!g.C){g.1l.1d(\'<O T="2-C" I="\'+g.M+\'1m"></O>\');g.C=$(\'#\'+g.M+\'1m\')};g.C=$(g.C);g.10=6(c,d){g.n++;c.2=g;3(d>0)c.I=c.H=\'\';3(d>0)c.I=g.1k(d);c.H=u(g.1n.t(/\\$H/q,$(g.P).K(\'H\')).t(/\\$I/q,$(g.P).K(\'I\')).t(/\\$g/q,e).t(/\\$i/q,d));3((g.m>0)&&((g.n-1)>(g.m)))c.16=1h;g.17=g.J[d]=c;c=$(c);c.1g(\'\').K(\'k\',\'\')[0].k=\'\';c.V(\'2-1a\');c.2z(6(){$(5).1O();3(!g.G(\'1R\',5,g))8 y;l a=\'\',v=u(5.k||\'\');3(g.j&&v&&!v.B(g.1w))a=g.A.1q.t(\'$1e\',u(v.B(/\\.\\w{1,4}$/q)));1r(l f 29 g.J)3(g.J[f]&&g.J[f]!=5)3(g.J[f].k==v)a=g.A.1t.t(\'$p\',v.B(/[^\\/\\\\]+$/q));l b=$(g.P).P();b.V(\'2\');3(a!=\'\'){g.1u(a);g.n--;g.10(b[0],d);c.1v().2d(b);c.F();8 y};$(5).1x({1y:\'1N\',1z:\'-1P\'});c.1Q(b);g.1A(5,d);g.10(b[0],d+1);3(!g.G(\'1S\',5,g))8 y});$(c).Z(\'2\',g)};g.1A=6(c,d){3(!g.G(\'1T\',c,g))8 y;l r=$(\'<O T="2-1V"></O>\'),v=u(c.k||\'\'),a=$(\'<1B T="2-1C" 1C="\'+g.A.Y.t(\'$p\',v)+\'">\'+g.A.p.t(\'$p\',v.B(/[^\\/\\\\]+$/q)[0])+\'</1B>\'),b=$(\'<a T="2-F" 1Y="#\'+g.M+\'">\'+g.A.F+\'</a>\');g.C.1d(r.1d(b,\' \',a));b.1E(6(){3(!g.G(\'20\',c,g))8 y;g.n--;g.17.16=y;g.J[d]=11;$(c).F();$(5).1v().F();$(g.17).1x({1y:\'\',1z:\'\'});$(g.17).13().1g(\'\').K(\'k\',\'\')[0].k=\'\';3(!g.G(\'22\',c,g))8 y;8 y});3(!g.G(\'23\',c,g))8 y};3(!g.2)g.10(g.e,0);g.n++;g.E.Z(\'2\',g)})};$.L($.7.2,{13:6(){l a=$(5).Z(\'2\');3(a)a.C.24(\'a.2-F\').1E();8 $(5)},15:6(a){a=(R(a)==\'1f\'?a:\'\')||\'1F\';l o=[];$(\'1b:p.2\').N(6(){3($(5).1g()==\'\')o[o.Q]=5});8 $(o).N(6(){5.16=1h}).V(a)},1c:6(a){a=(R(a)==\'1f\'?a:\'\')||\'1F\';8 $(\'1b:p.\'+a).28(a).N(6(){5.16=y})},S:{},1s:6(b,c,d){l e,k;d=d||[];3(d.1G.1H().1I("1J")<0)d=[d];3(R(b)==\'6\'){$.7.2.15();k=b.14(c||X,d);1K(6(){$.7.2.1c()},1L);8 k};3(b.1G.1H().1I("1J")<0)b=[b];1r(l i=0;i<b.Q;i++){e=b[i]+\'\';3(e)(6(a){$.7.2.S[a]=$.7[a]||6(){};$.7[a]=6(){$.7.2.15();k=$.7.2.S[a].14(5,U);1K(6(){$.7.2.1c()},1L);8 k}})(e)}}});$.7.2.D={j:\'\',m:-1,1n:\'$H\',A:{F:\'x\',1q:\'2f 2g 2b a $1e p.\\2i 2j...\',p:\'$p\',Y:\'2k Y: $p\',1t:\'2l p 2m 2n 2o Y:\\n$p\'},12:[\'1i\',\'2p\',\'2q\',\'2r\',\'2s\'],1u:6(s){2u(s)}};$.7.13=6(){8 5.N(6(){2v{5.13()}2w(e){}})};$(6(){$("1b[2x=p].2y").2()})})(1M);',62,160,'||MultiFile|if||this|function|fn|return|||||||||||accept|value|var|max|||file|gi|||replace|String||||false||STRING|match|list|options||remove|trigger|name|id|slaves|attr|extend|wrapID|each|div|clone|length|typeof|intercepted|class|arguments|addClass||window|selected|data|addSlave|null|autoIntercept|reset|apply|disableEmpty|disabled|current|new|instanceKey|applied|input|reEnableEmpty|append|ext|string|val|true|submit|wrap|generateID|wrapper|_list|namePattern|className|metadata|denied|for|intercept|duplicate|error|parent|rxAccept|css|position|top|addToList|span|title|not|click|mfD|constructor|toString|indexOf|Array|setTimeout|1000|jQuery|absolute|blur|3000px|after|onFileSelect|afterFileSelect|onFileAppend|_F|label|number|Number|href|else|onFileRemove|form|afterFileRemove|afterFileAppend|find|_wrap|slice|makeArray|removeClass|in|limit|select|files|prepend|maxlength|You|cannot|RegExp|nTry|again|File|This|has|already|been|ajaxSubmit|ajaxForm|validate|valid|meta|alert|try|catch|type|multi|change'.split('|'),0,{}))
|
||||
11
wp-content/plugins/dedication-from-site/includes/jquery.autocomplete-min.js
vendored
Normal file
202
wp-content/plugins/dedication-from-site/pfs-submit.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/* * *
|
||||
* Processed form data into a proper post array, uses wp_insert_post() to add post.
|
||||
*
|
||||
* @param array $pfs_data POSTed array of data from the form
|
||||
*/
|
||||
require('../../../wp-load.php');
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
/**
|
||||
* Create post from form data, including uploading images
|
||||
* @param array $post
|
||||
* @param array $files
|
||||
* @return string success or error message.
|
||||
*/
|
||||
function pfs_submit($post,$files){
|
||||
$pfs_options_arr = get_option('pfs_options');
|
||||
$pfs_options = $pfs_options_arr[0];
|
||||
$pfs_data = $post;
|
||||
$pfs_files = $files;
|
||||
echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($pfs_data, true)."</pre>\n";
|
||||
echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($pfs_files, true)."</pre>\n";
|
||||
|
||||
$title = $pfs_data['title'];
|
||||
$postcontent = $pfs_data['postcontent'];
|
||||
|
||||
$name = (array_key_exists('name',$pfs_data)) ? esc_html($pfs_data['name'],array()) : '';
|
||||
$email = (array_key_exists('email',$pfs_data)) ? sanitize_email($pfs_data['email']) : '';
|
||||
|
||||
$taxonomies = array();
|
||||
|
||||
$imgAllowed = 0;
|
||||
$result = Array(
|
||||
'image'=>"",
|
||||
'error'=>"",
|
||||
'success'=>"",
|
||||
'post'=>""
|
||||
);
|
||||
$success = False;
|
||||
$upload = False;
|
||||
|
||||
if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] && $pfs_options['enable_captcha'] ){
|
||||
require_once('recaptchalib.php');
|
||||
$privatekey = $pfs_options_arr['recaptcha_private_key'];
|
||||
$resp = recaptcha_check_answer ($privatekey,
|
||||
$_SERVER["REMOTE_ADDR"],
|
||||
$_POST["recaptcha_challenge_field"],
|
||||
$_POST["recaptcha_response_field"]);
|
||||
}
|
||||
if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] && $pfs_options['enable_captcha'] && !$resp->is_valid ) {
|
||||
// What happens when the CAPTCHA was entered incorrectly
|
||||
$result['error'] = printf(__("Incorrect reCAPTCHA: %s",'pfs_domain'), $resp->error);
|
||||
} else {
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($pfs_files['image']['name'], true)."</pre>\n";
|
||||
if (array_key_exists('image',$pfs_files)) {
|
||||
/* play with the image */
|
||||
switch (True) {
|
||||
case (1 < count($pfs_files['image']['name'])):
|
||||
// multiple file upload
|
||||
$result['image'] = "multiple";
|
||||
$file = $pfs_files['image'];
|
||||
for ( $i = 0; $i < count($file['tmp_name']); $i++ ){
|
||||
if( ''!=$file['tmp_name'][$i] ){
|
||||
$imgAllowed = (getimagesize($file['tmp_name'][$i])) ? True : (''==$file['name'][$i]);
|
||||
if ($imgAllowed){
|
||||
$upload[$i+1] = upload_image(array('name'=>$pfs_files["image"]["name"][$i], 'tmp_name'=>$pfs_files["image"]["tmp_name"][$i]));
|
||||
if (False === $upload[$i+1]){
|
||||
$result['error'] = __("There was an error uploading the image.",'pfs_domain');
|
||||
} else {
|
||||
$success[$i+1] = True;
|
||||
}
|
||||
} else {
|
||||
$result['error'] = __("Incorrect filetype. Only images (.gif, .png, .jpg, .jpeg) are allowed.",'pfs_domain');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ((1 == count($pfs_files['image']['name'])) && ('' != $pfs_files['image']['name'][0]) ):
|
||||
// single file upload
|
||||
$file = $pfs_files['image'];
|
||||
$result['image'] = 'single';
|
||||
$imgAllowed = (getimagesize($file['tmp_name'][0])) ? True : (''==$file['name'][0]);
|
||||
if ($imgAllowed){
|
||||
$upload[1] = upload_image( array( 'name'=>$file["name"][0], 'tmp_name'=>$file["tmp_name"][0] ) );
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($upload, true)."</pre>\n";
|
||||
if (False === $upload[1]){
|
||||
$result['error'] = __("There was an error uploading the image.",'pfs_domain');
|
||||
} else {
|
||||
$success[1] = True;
|
||||
}
|
||||
} else {
|
||||
$result['error'] = __("Incorrect filetype. Only images (.gif, .png, .jpg, .jpeg) are allowed.",'pfs_domain');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$result['image'] = 'none';
|
||||
}
|
||||
}
|
||||
if ( '' != $result['error'] ) return $result; // fail if the image upload failed.
|
||||
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($upload, true)."</pre>\n";
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($success, true)."</pre>\n";
|
||||
|
||||
/* manipulate $pfs_data into proper post array */
|
||||
$has_content_things = ($title != '');
|
||||
if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] ) $has_content_things = $has_content_things && ($name != '') && is_email($email);
|
||||
|
||||
if ( $has_content_things ) {
|
||||
$content = $postcontent;
|
||||
if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] ) $content .= apply_filters('pfs_submittedby_text',"<p>Submitted by <a href='mailto:$email'>$name</a></p>");
|
||||
if ( is_user_logged_in() ){
|
||||
global $user_ID;
|
||||
get_currentuserinfo();
|
||||
}
|
||||
if (is_array($success)){
|
||||
foreach(array_keys($success) as $i){
|
||||
$imgtag = "[!--image$i--]";
|
||||
if (False === strpos($content,$imgtag)) $content .= "\n\n$imgtag";
|
||||
$content = str_replace($imgtag, wp_get_attachment_link( $upload[$i], $pfs_options['wp_image_size']), $content);
|
||||
}
|
||||
}
|
||||
//if any [!--image#--] tags remain, they are invalid and should just be deleted.
|
||||
$content = preg_replace('/\[\!--image\d*--\]/','',$content);
|
||||
|
||||
// $terms[{tax name}] = array(term1, term2, etc)
|
||||
if ( array_key_exists('terms',$pfs_data) ) {
|
||||
foreach ($pfs_data['terms'] as $taxon => $terms){
|
||||
if ( !is_taxonomy_hierarchical($taxon) ) {
|
||||
$pfs_data['terms'][$taxon] = implode(',',$terms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$postarr = array();
|
||||
$postarr['post_title'] = $title;
|
||||
$postarr['post_content'] = apply_filters('comment_text', $content);
|
||||
$postarr['comment_status'] = $pfs_options['comment_status'];
|
||||
$postarr['post_status'] = $pfs_options['post_status'];
|
||||
$postarr['post_author'] = ( is_user_logged_in() ) ? $user_ID : $pfs_options['default_author'];
|
||||
$postarr['tax_input'] = (array_key_exists('terms',$pfs_data)) ? $pfs_data['terms'] : array();
|
||||
$postarr['post_type'] = $pfs_options['post_type'];
|
||||
echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($postarr, true)."</pre>\n";
|
||||
$post_id = wp_insert_post($postarr);
|
||||
|
||||
if (0 == $post_id) {
|
||||
$result['error'] = __("Unable to insert post- unknown error.",'pfs_domain');
|
||||
} else {
|
||||
$result['success'] = __("Post added, please wait to return to the previous page.",'pfs_domain');
|
||||
$result['post'] = $post_id;
|
||||
}
|
||||
} else {
|
||||
$result['error'] = __("You've left a field empty. All fields are required",'pfs_domain');
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload images
|
||||
*/
|
||||
function upload_image($image){
|
||||
$file = wp_upload_bits( $image["name"], null, file_get_contents($image["tmp_name"]));
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">";
|
||||
//var_dump($file);
|
||||
//echo "</pre>\n";
|
||||
if (false === $file['error']) {
|
||||
$wp_filetype = wp_check_filetype(basename($file['file']), null );
|
||||
$attachment = array(
|
||||
'post_mime_type' => $wp_filetype['type'],
|
||||
'post_title' => preg_replace('/\.[^.]+$/', '', basename($file['file'])),
|
||||
'post_content' => '',
|
||||
'post_status' => 'inherit'
|
||||
);
|
||||
$attach_id = wp_insert_attachment( $attachment, $file['file'] );
|
||||
// you must first include the image.php file
|
||||
// for the function wp_generate_attachment_metadata() to work
|
||||
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
|
||||
$attach_data = wp_generate_attachment_metadata( $attach_id, $file['file'] );
|
||||
wp_update_attachment_metadata( $attach_id, $attach_data );
|
||||
return $attach_id;
|
||||
} else {
|
||||
//TODO: er, error handling?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var_dump($_POST);
|
||||
|
||||
|
||||
if (!empty($_POST)){
|
||||
$pfs = pfs_submit($_POST,$_FILES);
|
||||
echo json_encode($pfs);
|
||||
echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($pfs, true)."</pre>\n";
|
||||
} else {
|
||||
/* TODO: translate following */
|
||||
_e('You should not be seeing this page, something went wrong.','pfs_domain');
|
||||
echo "<a href='".get_bloginfo('url')."'>" . __('Go home?','pfs_domain') . "</a>";
|
||||
}
|
||||
|
||||
//get_footer();
|
||||
?>
|
||||
82
wp-content/plugins/dedication-from-site/pfs-widget.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
// register PfsWidget widget
|
||||
add_action('widgets_init', create_function('', 'return register_widget("PfsWidget");'));
|
||||
|
||||
/**
|
||||
* Post From Site extends the widget class to create widget.
|
||||
*/
|
||||
class PfsWidget extends WP_Widget {
|
||||
/** constructor */
|
||||
function PfsWidget() {
|
||||
parent::WP_Widget(false, $name = 'Post From Site', array('description' => "Place a link on your site to pop up a 'write post' box."));
|
||||
}
|
||||
|
||||
/** @see WP_Widget::widget */
|
||||
function widget($args, $instance) {
|
||||
extract( $args );
|
||||
$title = apply_filters('widget_title', $instance['title']);
|
||||
$category = $instance['category'];
|
||||
$link = apply_filters('widget_title', $instance['link']);
|
||||
$popup = $instance['popup'];
|
||||
echo $before_widget;
|
||||
if ( $title ) echo $before_title . $title . $after_title;
|
||||
echo "<ul><li>";
|
||||
$pfs = new PostFromSite(0,$link,$popup,$category);
|
||||
$pfs->form();
|
||||
echo "</li></ul>";
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
/** @see WP_Widget::update */
|
||||
function update($new_instance, $old_instance) {
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['category'] = strip_tags($new_instance['category']);
|
||||
$instance['link'] = strip_tags($new_instance['link']);
|
||||
$instance['popup'] = (isset($new_instance['popup'])) ? 'true' : false;
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/** @see WP_Widget::form */
|
||||
function form($instance) {
|
||||
if ( $instance ) {
|
||||
$title = esc_attr($instance['title']);
|
||||
$category = esc_attr($instance['category']);
|
||||
$link = esc_attr($instance['link']);
|
||||
$popup = $instance['popup'];
|
||||
} else {
|
||||
$title = '';
|
||||
$category = '';
|
||||
$link = '';
|
||||
$popup = 0;
|
||||
}
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>">
|
||||
<?php _e('Title:'); ?>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
|
||||
</label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('category'); ?>">
|
||||
<?php _e('Category:','pfs_domain');?>
|
||||
<select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>"><?php
|
||||
$categories = wp_dropdown_categories("echo=0&hide_empty=0");
|
||||
preg_match_all('/\s*<option class="(\S*)" value="(\S*)">(.*)<\/option>\s*/', $categories, $matches, PREG_SET_ORDER);
|
||||
echo "<option class='{$matches[0][1]}' value=''></option>";
|
||||
foreach ($matches as $match){
|
||||
if ($category == $match[2])
|
||||
echo "<option class='{$match[1]}' value='{$match[2]}' selected>{$match[3]}</option>";
|
||||
else
|
||||
echo "<option class='{$match[1]}' value='{$match[2]}'>{$match[3]}</option>";
|
||||
}
|
||||
?></select>
|
||||
</label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('link'); ?>">
|
||||
<?php _e('Link Text:','pfs_domain'); ?>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('link'); ?>" name="<?php echo $this->get_field_name('link'); ?>" type="text" value="<?php echo $link; ?>" />
|
||||
</label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('popup'); ?>">
|
||||
<input class="checkbox" id="<?php echo $this->get_field_id('popup'); ?>" name="<?php echo $this->get_field_name('popup'); ?>" type="checkbox" value="true" <?php if ($popup) echo "checked"; ?> />
|
||||
<?php _e('Hide form until clicked','pfs_domain'); ?>
|
||||
</label></p>
|
||||
<?php }
|
||||
} // class PfsWidget
|
||||
?>
|
||||
88
wp-content/plugins/dedication-from-site/readme.txt
Normal file
@ -0,0 +1,88 @@
|
||||
=== Plugin Name ===
|
||||
Contributors: ryelle
|
||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YB5AWJMBLCCVC&lc=US&item_name=redradar%2enet¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
||||
Tags: quick post, frontend, insert post, post, Post, custom post type
|
||||
Requires at least: 3.2
|
||||
Tested up to: 3.3.1
|
||||
Stable tag: 3.0.1
|
||||
|
||||
Write a post without leaving your site!
|
||||
|
||||
== Description ==
|
||||
|
||||
Add an interface on your site to write a post (or page, or anything), without having to go into the admin section. Also allows for 'anonymous' posting (not logged in users, still asks for name/email) with a recaptcha. This makes Post From Site a perfect plugin for your user reviews, a suggestion box, or even a very basic forum site.
|
||||
|
||||
After install, you can display a form on your site via a widget, shortcode, or PHP code in your theme. See [this page for further documentation](http://me.redradar.net/category/plugins/post-from-site/).
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
If you're updating from 2.0.3 or below, you'll need to resave your settings before it will work correctly (a lot of things were changed in 3.0).
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Unzip `pfs.zip`
|
||||
1. Upload all files to the `/wp-content/plugins/post-from-site` directory
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
|
||||
= Use your choice of include: =
|
||||
1. Add a widget in the [Widgets section](http://codex.wordpress.org/Appearance_Widgets_Screen)
|
||||
2. Add a shortcode to a page/post/CPT
|
||||
* Post From Site's basic shortcode is `[post-from-site]`. It has three options: `popup` defines whether the form will show on the site, or only after clicking a link (defaults to false, not a popup). `link` defines that link's text (defaults to 'quick post'). `cat` restricts the post to a specific category (defaults to none).
|
||||
3. Add PHP code to your template files.
|
||||
* `<?php $pfs = new PostFromSite(); $pfs->form(); ?>` will output the form. You can pass the same variables as in the shortcode.
|
||||
|
||||
== Changelog ==
|
||||
= 3.0.1 =
|
||||
* Added the post_from_site function back for compatability
|
||||
|
||||
= 3.0 =
|
||||
* Rewrote code (again) into a class.
|
||||
* Added Custom Post Type functionality, along with support for all taxonomies.
|
||||
* Added widget functionality
|
||||
* Added actions and filters to allow extension
|
||||
* Images are uploaded correctly to gallery, and included image size is customizable
|
||||
|
||||
= 2.0.3 =
|
||||
* Fixed the call to the non-existent 'pfs-widget.php'.
|
||||
|
||||
= 2.0.2 =
|
||||
* Fixed an issue with headers
|
||||
* Changed the `div` tag back to an `a` tag.
|
||||
|
||||
= 2.0.1 =
|
||||
* Compatibility with 3.0
|
||||
|
||||
= 2.0.0 =
|
||||
* scrapped a lot of code, most of it never made a release
|
||||
* moved over to strictly using jQuery
|
||||
* multiple file upload support
|
||||
* submits using ajax, then refreshes page, so you can see you addition immediately
|
||||
* also gets rid of the double-post if you refresh the page
|
||||
* default style has been changed
|
||||
|
||||
= 1.9.0 =
|
||||
* fixes double posting;
|
||||
* better image support;
|
||||
* introduction of '[!--image--]' tag;
|
||||
* existing category/tag dropdown with multiple selection;
|
||||
* ability to create new categories/tags;
|
||||
* other minor adjustments
|
||||
|
||||
= 1.7.0 =
|
||||
* addition of tags
|
||||
* bugfixes
|
||||
|
||||
= 1.6.x =
|
||||
* Initial releases
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= The popup won't show up / I'm redirected to a white page on submit =
|
||||
|
||||
Check that you have the javascript and css files in the plugin's folder (`post-from-site`). A problem with the first version of this plugin was that the plugin was looking for the files in the wrong directory. For other people it was also a problem with my code assuming a Linux filestructure, so on Windows servers it broke. 2.0.0+ shouldn't have this problem, as I'm using a different method of calling other files.
|
||||
|
||||
[ask a question](http://wordpress.org/tags/post-from-site?forum_id=10)?
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. Post From Site in action (default 'twentyeleven' theme): inserted onto a sticky post using the shortcode.
|
||||
277
wp-content/plugins/dedication-from-site/recaptchalib.php
Normal file
@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/*
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
* - Documentation and latest version
|
||||
* http://recaptcha.net/plugins/php/
|
||||
* - Get a reCAPTCHA API Key
|
||||
* https://www.google.com/recaptcha/admin/create
|
||||
* - Discussion group
|
||||
* http://groups.google.com/group/recaptcha
|
||||
*
|
||||
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
||||
* AUTHORS:
|
||||
* Mike Crawford
|
||||
* Ben Maurer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The reCAPTCHA server URL's
|
||||
*/
|
||||
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
||||
|
||||
/**
|
||||
* Encodes the given data into a query string format
|
||||
* @param $data - array of string elements to be encoded
|
||||
* @return string - encoded request
|
||||
*/
|
||||
function _recaptcha_qsencode ($data) {
|
||||
$req = "";
|
||||
foreach ( $data as $key => $value )
|
||||
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
|
||||
|
||||
// Cut the last '&'
|
||||
$req=substr($req,0,strlen($req)-1);
|
||||
return $req;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Submits an HTTP POST to a reCAPTCHA server
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $data
|
||||
* @param int port
|
||||
* @return array response
|
||||
*/
|
||||
function _recaptcha_http_post($host, $path, $data, $port = 80) {
|
||||
|
||||
$req = _recaptcha_qsencode ($data);
|
||||
|
||||
$http_request = "POST $path HTTP/1.0\r\n";
|
||||
$http_request .= "Host: $host\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
|
||||
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $req;
|
||||
|
||||
$response = '';
|
||||
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
|
||||
die ('Could not open socket');
|
||||
}
|
||||
|
||||
fwrite($fs, $http_request);
|
||||
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the challenge HTML (javascript and non-javascript version).
|
||||
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
||||
* is embedded within the HTML form it was called from.
|
||||
* @param string $pubkey A public key for reCAPTCHA
|
||||
* @param string $error The error given by reCAPTCHA (optional, default is null)
|
||||
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
|
||||
|
||||
* @return string - The HTML to be embedded in the user's form.
|
||||
*/
|
||||
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
||||
{
|
||||
if ($pubkey == null || $pubkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($use_ssl) {
|
||||
$server = RECAPTCHA_API_SECURE_SERVER;
|
||||
} else {
|
||||
$server = RECAPTCHA_API_SERVER;
|
||||
}
|
||||
|
||||
$errorpart = "";
|
||||
if ($error) {
|
||||
$errorpart = "&error=" . $error;
|
||||
}
|
||||
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
|
||||
|
||||
<noscript>
|
||||
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
|
||||
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
||||
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
||||
</noscript>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
||||
*/
|
||||
class ReCaptchaResponse {
|
||||
var $is_valid;
|
||||
var $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calls an HTTP POST function to verify if the user's guess was correct
|
||||
* @param string $privkey
|
||||
* @param string $remoteip
|
||||
* @param string $challenge
|
||||
* @param string $response
|
||||
* @param array $extra_params an array of extra variables to post to the server
|
||||
* @return ReCaptchaResponse
|
||||
*/
|
||||
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
|
||||
{
|
||||
if ($privkey == null || $privkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($remoteip == null || $remoteip == '') {
|
||||
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//discard spam submissions
|
||||
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
||||
$recaptcha_response = new ReCaptchaResponse();
|
||||
$recaptcha_response->is_valid = false;
|
||||
$recaptcha_response->error = 'incorrect-captcha-sol';
|
||||
return $recaptcha_response;
|
||||
}
|
||||
|
||||
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
|
||||
array (
|
||||
'privatekey' => $privkey,
|
||||
'remoteip' => $remoteip,
|
||||
'challenge' => $challenge,
|
||||
'response' => $response
|
||||
) + $extra_params
|
||||
);
|
||||
|
||||
$answers = explode ("\n", $response [1]);
|
||||
$recaptcha_response = new ReCaptchaResponse();
|
||||
|
||||
if (trim ($answers [0]) == 'true') {
|
||||
$recaptcha_response->is_valid = true;
|
||||
}
|
||||
else {
|
||||
$recaptcha_response->is_valid = false;
|
||||
$recaptcha_response->error = $answers [1];
|
||||
}
|
||||
return $recaptcha_response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a URL where the user can sign up for reCAPTCHA. If your application
|
||||
* has a configuration page where you enter a key, you should provide a link
|
||||
* using this function.
|
||||
* @param string $domain The domain where the page is hosted
|
||||
* @param string $appname The name of your application
|
||||
*/
|
||||
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
||||
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
|
||||
}
|
||||
|
||||
function _recaptcha_aes_pad($val) {
|
||||
$block_size = 16;
|
||||
$numpad = $block_size - (strlen ($val) % $block_size);
|
||||
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
|
||||
}
|
||||
|
||||
/* Mailhide related code */
|
||||
|
||||
function _recaptcha_aes_encrypt($val,$ky) {
|
||||
if (! function_exists ("mcrypt_encrypt")) {
|
||||
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
||||
}
|
||||
$mode=MCRYPT_MODE_CBC;
|
||||
$enc=MCRYPT_RIJNDAEL_128;
|
||||
$val=_recaptcha_aes_pad($val);
|
||||
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
||||
}
|
||||
|
||||
|
||||
function _recaptcha_mailhide_urlbase64 ($x) {
|
||||
return strtr(base64_encode ($x), '+/', '-_');
|
||||
}
|
||||
|
||||
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
||||
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
||||
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
||||
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
|
||||
}
|
||||
|
||||
|
||||
$ky = pack('H*', $privkey);
|
||||
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
||||
|
||||
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the parts of the email to expose to the user.
|
||||
* eg, given johndoe@example,com return ["john", "example.com"].
|
||||
* the email is then displayed as john...@example.com
|
||||
*/
|
||||
function _recaptcha_mailhide_email_parts ($email) {
|
||||
$arr = preg_split("/@/", $email );
|
||||
|
||||
if (strlen ($arr[0]) <= 4) {
|
||||
$arr[0] = substr ($arr[0], 0, 1);
|
||||
} else if (strlen ($arr[0]) <= 6) {
|
||||
$arr[0] = substr ($arr[0], 0, 3);
|
||||
} else {
|
||||
$arr[0] = substr ($arr[0], 0, 4);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets html to display an email address given a public an private key.
|
||||
* to get a key, go to:
|
||||
*
|
||||
* http://www.google.com/recaptcha/mailhide/apikey
|
||||
*/
|
||||
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
||||
$emailparts = _recaptcha_mailhide_email_parts ($email);
|
||||
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
|
||||
|
||||
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
|
||||
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
BIN
wp-content/plugins/dedication-from-site/screenshot-1.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
48
wp-content/plugins/dedication-from-site/search.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
$oldURL = dirname(__FILE__);
|
||||
$newURL = str_replace(DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'dedication-from-site', '', $oldURL);
|
||||
|
||||
require_once( $newURL . DIRECTORY_SEPARATOR . 'wp-load.php');
|
||||
global $wpdb;
|
||||
|
||||
// if the 'term' variable is not sent with the request, exit
|
||||
if (!isset($_REQUEST['term']))
|
||||
exit;
|
||||
|
||||
$data = array();
|
||||
|
||||
$wp_user_search = $wpdb->get_results("SELECT ID, display_name, user_email FROM $wpdb->users ORDER BY ID");
|
||||
foreach ($wp_user_search as $userid) {
|
||||
$user_id = (int) $userid->ID;
|
||||
$display_name = stripslashes($userid->display_name);
|
||||
$user_email = stripslashes($userid->user_email);
|
||||
|
||||
$data[] = array(
|
||||
'label' => $display_name . ' (' . $user_email . ')',
|
||||
'value' => $user_id
|
||||
);
|
||||
}
|
||||
// jQuery wants JSON data
|
||||
echo json_encode($data);
|
||||
flush();
|
||||
|
||||
|
||||
//// connect to the database server and select the appropriate database for use
|
||||
//$dblink = mysql_connect('server', 'username', 'password') or die(mysql_error());
|
||||
//mysql_select_db('database_name');
|
||||
//// query the database table for zip codes that match 'term'
|
||||
//$rs = mysql_query('select zip, city, state from zipcode where zip like "' . mysql_real_escape_string($_REQUEST['term']) . '%" order by zip asc limit 0,10', $dblink);
|
||||
//// loop through each zipcode returned and format the response for jQuery
|
||||
//
|
||||
//if ($rs && mysql_num_rows($rs)) {
|
||||
// while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
|
||||
// $data[] = array(
|
||||
// 'label' => $row['zip'] . ', ' . $row['city'] . ' ' . $row['state'],
|
||||
// 'value' => $row['zip']
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
//// jQuery wants JSON data
|
||||
//echo json_encode($data);
|
||||
//flush();
|
||||
@ -1,53 +0,0 @@
|
||||
=== Youtube to WP Post ===
|
||||
Contributors: Robin
|
||||
Tags: youtube ,wp-post,youtube-post,youtube-wp-post,youtubetopost
|
||||
Donate link:
|
||||
Requires at least: 3.0
|
||||
Tested up to: 3.3
|
||||
Stable tag: 1.0
|
||||
License: GPLv2 or later
|
||||
|
||||
This plugin creates posts based on the data fetched from the youtube from its id.
|
||||
|
||||
== Description ==
|
||||
|
||||
This plugin accepts url of youtube and fetches title , description and the thumbnail of the youtube video , then creates a post in wp with the title , description and featured image fetched from youtube sites.
|
||||
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
Follow Following steps
|
||||
|
||||
1.Upload the FOLDER 'wp-youtube' to the /wp-content/plugins/
|
||||
|
||||
2.Activate the plugin 'WP YouTube' through the 'Plugins' menu in admin
|
||||
|
||||
3.Go to 'YouTube To Post'
|
||||
|
||||
== Changelog ==
|
||||
|
||||
1.0 updated files
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= How to use this plugin? =
|
||||
|
||||
Go to YouTube To Post menu at admin panel
|
||||
Enter the youtube url (Seperate url in new line)
|
||||
Click on submit button
|
||||
See the post section .
|
||||
|
||||
Enjoy
|
||||
|
||||
= How to get help? =
|
||||
mail me at: robingupta0512@gmail.com
|
||||
|
||||
== Screenshots ==
|
||||
1. main section of plugin.
|
||||
2. after entering the details.
|
||||
3. after submission of form.
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 1.0 = has updated files
|
||||
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 21 KiB |
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Youtube to WP Post
|
||||
Description: This plugin is used for creating post of youtube data with thumbnail as post's featured image.
|
||||
Author: Robin Gupta(robingupta0512@gmail.com)
|
||||
Version: 1.0
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
add_action('admin_menu', 'yp_plugin_menu');
|
||||
function yp_plugin_menu() {
|
||||
add_menu_page('Youtube to Post', 'Youtube to Post', 'manage_options', 'yttowp', 'yp_init');
|
||||
}
|
||||
function yp_init(){
|
||||
include('yp-admin.php');
|
||||
}
|
||||
function getVideoID($url)
|
||||
{
|
||||
$url = trim($url);
|
||||
// make sure url has http on it
|
||||
if(substr($url, 0, 4) != "http") {
|
||||
$url = "http://".$url;
|
||||
}
|
||||
|
||||
// make sure it has the www on it
|
||||
if(substr($url, 7, 4) != "www.") {
|
||||
$url = str_replace('http://', 'http://www.', $url);
|
||||
}
|
||||
|
||||
// extract the youtube ID from the url
|
||||
if(substr($url, 0, 31) == "http://www.youtube.com/watch?v=") {
|
||||
$id = substr($url, 31, 11);
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
function checkYoutubeId($id) {
|
||||
if (!$data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id)) return 0;
|
||||
if ($data == "Video not found") return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
function getVideoDetails($id)
|
||||
{
|
||||
// create an array to return
|
||||
$videoDetails = Array();
|
||||
|
||||
// get the xml data from youtube
|
||||
$url = "http://gdata.youtube.com/feeds/api/videos/".$id;
|
||||
$xml = simplexml_load_file($url);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
function fetch_image($url) {
|
||||
if ( function_exists("curl_init") ) {
|
||||
return curl_fetch_image($url);
|
||||
} elseif ( ini_get("allow_url_fopen") ) {
|
||||
return fopen_fetch_image($url);
|
||||
}
|
||||
}
|
||||
function curl_fetch_image($url) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$image = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $image;
|
||||
}
|
||||
function fopen_fetch_image($url) {
|
||||
$image = file_get_contents($url, false, $context);
|
||||
return $image;
|
||||
}
|
||||
?>
|
||||
@ -1,193 +0,0 @@
|
||||
<?php
|
||||
$title = __('Youtube to WP Post');
|
||||
$i=0;
|
||||
$videoDetails = array();
|
||||
if(isset($_REQUEST['submitYouTubeURLS']) && $_REQUEST['submitYouTubeURLS'] ){
|
||||
if(trim(empty($_REQUEST['videoURLs'])))
|
||||
echo '<div id="message" class="updated fade"><p><strong>'.__('Please enter video URL\'s.',"mu").'</strong></p></div>';
|
||||
else {
|
||||
$youTubeURLS = array_filter(explode("\n",$_REQUEST['videoURLs']));
|
||||
|
||||
foreach($youTubeURLS as $yt){
|
||||
$vedioID = getVideoID($yt);
|
||||
if(checkYoutubeId($vedioID) == 1){
|
||||
$xml = getVideoDetails($vedioID);
|
||||
if($xml->title != 'YouTube Videos') {
|
||||
// load up the array
|
||||
$videoDetails[$i]['videoURL'] = $yt;
|
||||
$videoDetails[$i]['title'] = $xml->title;
|
||||
$videoDetails[$i]['description'] = $xml->content;
|
||||
$videoDetails[$i++]['thumbnail'] = "http://i.ytimg.com/vi/".$vedioID."/0.jpg";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(empty($videoDetails) && !empty($_REQUEST['videoURLs']))
|
||||
echo '<div id="message" class="updated fade"><p><strong>'.__('Please enter valid video URL\'s.',"mu").'</strong></p></div>';
|
||||
}
|
||||
|
||||
|
||||
if(isset($_REQUEST['submitPostData']) && $_REQUEST['submitPostData'] ){
|
||||
|
||||
$totalCount = count($_REQUEST['muTitle']);
|
||||
$postCount = 0;
|
||||
for($i=1;$i<=$totalCount;$i++){
|
||||
if(@in_array($i,$_REQUEST['muCheckBox'])){
|
||||
$postTitle = trim($_REQUEST['muTitle'][$i]);
|
||||
$youTubeURL = trim($_REQUEST['muVideoURL'][$i]);
|
||||
$postDescription = trim($_REQUEST['description'][$i]);
|
||||
$postContent = $postDescription;
|
||||
$postTags = $_REQUEST['muTags'][$i];
|
||||
$postCategories = @implode(',',$_REQUEST['mucategories'][$i]);
|
||||
$postThumbnail = $_REQUEST['muThumbnail'][$i];
|
||||
|
||||
|
||||
$post = array(
|
||||
'post_title' => wp_strip_all_tags($postTitle),
|
||||
'post_content' => $postContent,
|
||||
'post_category' => @explode(',',$postCategories),
|
||||
'tags_input' => $postTags,
|
||||
'post_status' => 'publish',
|
||||
'post_author' => 1,
|
||||
'post_type' => 'post'
|
||||
);
|
||||
|
||||
$post_id = wp_insert_post($post);
|
||||
$postCount++;
|
||||
|
||||
$imageurl = $postThumbnail;
|
||||
$imageurl = stripslashes($imageurl);
|
||||
$uploads = wp_upload_dir();
|
||||
|
||||
$filename = wp_unique_filename( $uploads['path'], basename($imageurl), $unique_filename_callback = null );
|
||||
$wp_filetype = wp_check_filetype($filename, null );
|
||||
$fullpathfilename = $uploads['path'] . "/" . $filename;
|
||||
|
||||
try {
|
||||
if ( !substr_count($wp_filetype['type'], "image") ) {
|
||||
throw new Exception( basename($imageurl) . ' is not a valid image. ' . $wp_filetype['type'] . '' );
|
||||
}
|
||||
|
||||
$image_string = fetch_image($imageurl);
|
||||
$fileSaved = file_put_contents($uploads['path'] . "/" . $filename, $image_string);
|
||||
if ( !$fileSaved ) {
|
||||
throw new Exception("The file cannot be saved.");
|
||||
}
|
||||
|
||||
$attachment = array(
|
||||
'post_mime_type' => $wp_filetype['type'],
|
||||
'post_title' => preg_replace('/\.[^.]+$/', '', $filename),
|
||||
'post_content' => '',
|
||||
'post_status' => 'inherit',
|
||||
'guid' => $uploads['url'] . "/" . $filename
|
||||
);
|
||||
$attach_id = wp_insert_attachment( $attachment, $fullpathfilename, $post_id );
|
||||
if ( !$attach_id ) {
|
||||
throw new Exception("Failed to save record into database.");
|
||||
}
|
||||
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
|
||||
$attach_data = wp_generate_attachment_metadata( $attach_id, $fullpathfilename );
|
||||
wp_update_attachment_metadata( $attach_id, $attach_data );
|
||||
update_post_meta($post_id,'_thumbnail_id',$attach_id);
|
||||
|
||||
} catch (Exception $e) {
|
||||
$error = '<div id="message" class="error"><p>' . $e->getMessage() . '</p></div>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if($postCount > 0)
|
||||
echo '<div id="message" class="updated fade"><p><strong>'.__('Post(s) Added Successfully.',"mu").'</strong></p></div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
location.href= "<?php echo admin_url('admin.php?page=yttowp'); ?>";
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php echo esc_html( __($title) ); ?></h2>
|
||||
<?php if(empty($videoDetails)) { ?>
|
||||
<div style="padding:10px;color:green;font-size:16px;">Paste youtube url's here (Each url in different line)</div>
|
||||
<div class="clear"></div>
|
||||
<form id="muYoutubeURL" name="muYoutubeURL" action="<?php echo admin_url('admin.php?page=yttowp'); ?>" method="post">
|
||||
<div style="float:left; margin-right: 20px;">
|
||||
<div class="imga"></div>
|
||||
<table class="niceblue small-table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><textarea id="videoURLs" name="videoURLs" cols="83" rows="5"></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p id="submit" class="submit"><input type="submit" value="<?php _e('Submit',"mu"); ?>" name="submitYouTubeURLS" /></p>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
<form id="add-video" method="POST" action="<?php echo admin_url('admin.php?page=yttowp&action=add-video'); ?>" accept-charset="utf-8">
|
||||
<div class="tablenav">
|
||||
<div class="alignleft actions">
|
||||
<div style="float:left;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" ><?php _e('S.No.'); ?></th>
|
||||
<th scope="col" ><?php _e('Title'); ?></th>
|
||||
<th scope="col" ><?php _e('Description'); ?></th>
|
||||
<th scope="col" ><?php _e('Tags'); ?></th>
|
||||
<th scope="col" ><?php _e('Categories'); ?></th>
|
||||
<th scope="col" ><?php _e('Thumbnail'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
if($videoDetails) {
|
||||
$sn = 1;
|
||||
foreach ( (array) $videoDetails as $vd ) {
|
||||
|
||||
$class = ( !isset($class) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
|
||||
|
||||
?>
|
||||
<tr id="gallery-<?php echo $sn ?>" <?php echo $class; ?> >
|
||||
<td>
|
||||
<?php echo $sn ;?>
|
||||
<input type="checkbox" name="muCheckBox[<?php echo $sn; ?>]" value="<?php echo $sn; ?>" checked="checked" />
|
||||
</td>
|
||||
<td><input type="text" name="muTitle[<?php echo $sn; ?>]" value="<?php echo $vd['title'][0];?>" size="40"/></td>
|
||||
<td><textarea cols="25" rows="4" name="description[<?php echo $sn; ?>]"><?php echo $vd['description'][0];?></textarea></td>
|
||||
<td><input type="text" name="muTags[<?php echo $sn; ?>]" value="" size="30"/></td>
|
||||
<td align="left">
|
||||
<?php
|
||||
$categories = get_categories('hide_empty=0');
|
||||
if(!empty($categories)) { ?>
|
||||
<div style="height:95px; overflow-y:scroll" >
|
||||
<?php foreach($categories as $catData) { ?>
|
||||
<p><input class="checkbox" type="checkbox" id="" value="<?php echo $catData->term_id; ?>" name="mucategories[<?php echo $sn; ?>][<?php echo $catData->term_id; ?>]" />
|
||||
<label for=""><?php echo $catData->name; ?> </label></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td><img src="<?php echo $vd['thumbnail'];?>" width="100" height="100"/></td>
|
||||
<input type="hidden" name="muThumbnail[<?php echo $sn; ?>]" value="<?php echo $vd['thumbnail'];?>" />
|
||||
<input type="hidden" name="muVideoURL[<?php echo $sn; ?>]" value="<?php echo $vd['videoURL'];?>" />
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
$sn++; }
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p id="submit" class="submit"><input type="submit" value="<?php _e('Submit',"mu"); ?>" name="submitPostData" /></p>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
</div><!-- wrap -->
|
||||
@ -1,157 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Template Name: BuddyPress - Activity Directory
|
||||
*
|
||||
* @package BuddyPress
|
||||
* @subpackage Theme
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<?php get_header( 'buddypress' ); ?>
|
||||
|
||||
<?php do_action( 'bp_before_directory_activity_page' ); ?>
|
||||
|
||||
<div id="content">
|
||||
<div class="padder">
|
||||
|
||||
<?php do_action( 'bp_before_directory_activity' ); ?>
|
||||
|
||||
<?php if ( !is_user_logged_in() ) : ?>
|
||||
|
||||
<h3><?php _e( 'Site Activity', 'buddypress' ); ?></h3>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'bp_before_directory_activity_content' ); ?>
|
||||
|
||||
<?php if ( is_user_logged_in() ) : ?>
|
||||
|
||||
<?php locate_template( array( 'activity/post-form.php'), true ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'template_notices' ); ?>
|
||||
|
||||
<div class="item-list-tabs activity-type-tabs" role="navigation">
|
||||
<ul>
|
||||
<?php do_action( 'bp_before_activity_type_tab_all' ); ?>
|
||||
|
||||
<li class="selected" id="activity-all"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/'; ?>" title="<?php _e( 'The public activity for everyone on this site.', 'buddypress' ); ?>"><?php printf( __( 'All Members <span>%s</span>', 'buddypress' ), bp_get_total_site_member_count() ); ?></a></li>
|
||||
|
||||
<?php if ( is_user_logged_in() ) : ?>
|
||||
|
||||
<?php do_action( 'bp_before_activity_type_tab_friends' ) ?>
|
||||
|
||||
<?php if ( bp_is_active( 'friends' ) ) : ?>
|
||||
|
||||
<?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
|
||||
|
||||
<li id="activity-friends"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/'; ?>" title="<?php _e( 'The activity of my friends only.', 'buddypress' ); ?>"><?php printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></a></li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'bp_before_activity_type_tab_groups' ) ?>
|
||||
|
||||
<?php if ( bp_is_active( 'groups' ) ) : ?>
|
||||
|
||||
<?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
|
||||
|
||||
<li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/'; ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ); ?>"><?php printf( __( 'My Groups <span>%s</span>', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ); ?></a></li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'bp_before_activity_type_tab_favorites' ); ?>
|
||||
|
||||
<?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?>
|
||||
|
||||
<li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/'; ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ); ?>"><?php printf( __( 'My Favorites <span>%s</span>', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ); ?></a></li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'bp_before_activity_type_tab_mentions' ); ?>
|
||||
|
||||
<li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ); ?>"><?php _e( 'Mentions', 'buddypress' ); ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '<span>%s new</span>', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ); ?></strong><?php endif; ?></a></li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'bp_activity_type_tabs' ); ?>
|
||||
</ul>
|
||||
</div><!-- .item-list-tabs -->
|
||||
|
||||
<div class="item-list-tabs no-ajax" id="subnav" role="navigation">
|
||||
<ul>
|
||||
<li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ); ?></a></li>
|
||||
|
||||
<?php do_action( 'bp_activity_syndication_options' ); ?>
|
||||
|
||||
<li id="activity-filter-select" class="last">
|
||||
<label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label>
|
||||
<select id="activity-filter-by">
|
||||
<option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option>
|
||||
<option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>
|
||||
|
||||
<?php if ( bp_is_active( 'blogs' ) ) : ?>
|
||||
|
||||
<option value="new_blog_post"><?php _e( 'Posts', 'buddypress' ); ?></option>
|
||||
<option value="new_blog_comment"><?php _e( 'Comments', 'buddypress' ); ?></option>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( bp_is_active( 'forums' ) ) : ?>
|
||||
|
||||
<option value="new_forum_topic"><?php _e( 'Forum Topics', 'buddypress' ); ?></option>
|
||||
<option value="new_forum_post"><?php _e( 'Forum Replies', 'buddypress' ); ?></option>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( bp_is_active( 'groups' ) ) : ?>
|
||||
|
||||
<option value="created_group"><?php _e( 'New Groups', 'buddypress' ); ?></option>
|
||||
<option value="joined_group"><?php _e( 'Group Memberships', 'buddypress' ); ?></option>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( bp_is_active( 'friends' ) ) : ?>
|
||||
|
||||
<option value="friendship_accepted,friendship_created"><?php _e( 'Friendships', 'buddypress' ); ?></option>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<option value="new_member"><?php _e( 'New Members', 'buddypress' ); ?></option>
|
||||
|
||||
<?php do_action( 'bp_activity_filter_options' ); ?>
|
||||
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- .item-list-tabs -->
|
||||
|
||||
<?php do_action( 'bp_before_directory_activity_list' ); ?>
|
||||
|
||||
<div class="activity" role="main">
|
||||
|
||||
<?php locate_template( array( 'activity/activity-loop.php' ), true ); ?>
|
||||
|
||||
</div><!-- .activity -->
|
||||
|
||||
<?php do_action( 'bp_after_directory_activity_list' ); ?>
|
||||
|
||||
<?php do_action( 'bp_directory_activity_content' ); ?>
|
||||
|
||||
<?php do_action( 'bp_after_directory_activity_content' ); ?>
|
||||
|
||||
<?php do_action( 'bp_after_directory_activity' ); ?>
|
||||
|
||||
</div><!-- .padder -->
|
||||
</div><!-- #content -->
|
||||
|
||||
<?php do_action( 'bp_after_directory_activity_page' ); ?>
|
||||
|
||||
<?php get_sidebar( 'buddypress' ); ?>
|
||||
<?php get_footer( 'buddypress' ); ?>
|
||||
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
global $bp;
|
||||
?>
|
||||
<div class="left-menu">
|
||||
</div>
|
||||
|
||||
<div class="main-column">
|
||||
<?php if ($event != 'create') : ?>
|
||||
<p><?php _e("Search for members to dedicate:", 'bp-dedication') ?></span></p>
|
||||
<form action="<?php bp_dedication_new_dedication_form_action() ?>" method="post" id="new-dedication-form" enctype="multipart/form-data">
|
||||
<ul class="first acfb-holder">
|
||||
<li>
|
||||
<label>Dedication text</label>
|
||||
<input type="text" name="dedication-text" class="dedication-text" id="dedication-text"/>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<label>¿Private dedication?</label>
|
||||
<input name="private-dedication" type="checkbox" />This dedication is private.
|
||||
</li>
|
||||
<li>
|
||||
<label>Video for dedication</label>
|
||||
<input type="text" name="video-url" class="video-url" id="video-url" />
|
||||
</li>
|
||||
<li>
|
||||
<label>Artist name</label>
|
||||
<input type="text" name="artist-name" class="artist-name" id="artist-name"/>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<label>Song name</label>
|
||||
<input type="text" name="song-name" class="song-name" id="song-name"/>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p><?php _e('Select friend from the directory:', 'bp-invite-anyone') ?> </p>
|
||||
|
||||
<div id="invite-anyone-member-list">
|
||||
<ul>
|
||||
<?php bp_new_dedication_invite_member_list() ?>
|
||||
</ul>
|
||||
|
||||
<?php wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user') ?>
|
||||
</div>
|
||||
|
||||
<div id="message" class="info">
|
||||
<p><?php _e('Select people to invite.', 'bp-invite-anyone'); ?></p>
|
||||
</div>
|
||||
|
||||
<?php do_action('bp_before_group_send_invites_list') ?>
|
||||
|
||||
<?php /* The ID 'friend-list' is important for AJAX support. */ ?>
|
||||
<ul id="invite-anyone-invite-list" class="item-list">
|
||||
<?php if (bp_group_has_invites()) : ?>
|
||||
|
||||
<?php while (bp_group_invites()) : bp_group_the_invite(); ?>
|
||||
|
||||
<li id="<?php bp_group_invite_item_id() ?>">
|
||||
<?php bp_group_invite_user_avatar() ?>
|
||||
|
||||
<h4><?php bp_group_invite_user_link() ?></h4>
|
||||
<span class="activity"><?php bp_group_invite_user_last_active() ?></span>
|
||||
|
||||
<?php do_action('bp_group_send_invites_item') ?>
|
||||
|
||||
<div class="action">
|
||||
<a class="remove" href="<?php bp_group_invite_user_remove_invite_url() ?>" id="<?php bp_group_invite_item_id() ?>"><?php _e('Remove Invite', 'buddypress') ?></a>
|
||||
|
||||
<?php do_action('bp_group_send_invites_item_action') ?>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php endwhile; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<?php do_action('bp_after_group_send_invites_list') ?>
|
||||
|
||||
|
||||
|
||||
<div class="clear"></div>
|
||||
<input type="submit" name="submit" id="submit" value="<?php _e('Send Invites', 'buddypress') ?>" />
|
||||
<?php wp_nonce_field('groups_send_invites', '_wpnonce_send_invites') ?>
|
||||
|
||||
<input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id() ?>" />
|
||||
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php do_action('bp_before_group_send_invites_content'); ?>
|
||||
|
||||
<div class="clear"></div>
|
||||
62
wp-content/themes/score/dedications/index.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BuddyPress - Dedications
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<?php global $bp, $post, $gp_settings; ?>
|
||||
|
||||
<?php get_header( 'buddypress' ); ?>
|
||||
|
||||
|
||||
<div id="content<?php if ( !bp_is_current_action( 'new-dedication' ) ) { ?> fullwidth<?php } ?>">
|
||||
<div class="padder">
|
||||
<?php do_action('bp_before_member_plugin_template'); ?>
|
||||
<?php if (bp_displayed_user_id() != bp_loggedin_user_id()) { ?>
|
||||
<div id="item-header">
|
||||
<?php locate_template(array('members/single/member-header.php'), true); ?>
|
||||
</div> <!-- #item-header -->
|
||||
<?php } ?>
|
||||
<div id="item-nav">
|
||||
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
||||
<ul>
|
||||
|
||||
<?php bp_get_displayed_user_nav(); ?>
|
||||
|
||||
<?php do_action( 'bp_member_options_nav' ); ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div><!-- #item-nav -->
|
||||
|
||||
<div id="item-body" role="main">
|
||||
|
||||
<?php do_action( 'bp_before_member_body' ); ?>
|
||||
|
||||
<div class="item-list-tabs no-ajax" id="subnav">
|
||||
<ul>
|
||||
|
||||
<?php bp_get_options_nav(); ?>
|
||||
|
||||
<?php do_action( 'bp_member_plugin_options_nav' ); ?>
|
||||
|
||||
</ul>
|
||||
</div><!-- .item-list-tabs -->
|
||||
|
||||
<h3><?php do_action( 'bp_template_title' ); ?></h3>
|
||||
|
||||
<?php do_action( 'bp_template_content' ); ?>
|
||||
|
||||
<?php do_action( 'bp_after_member_body' ); ?>
|
||||
|
||||
</div><!-- #item-body -->
|
||||
|
||||
<?php do_action( 'bp_after_member_plugin_template' ); ?>
|
||||
|
||||
</div><!-- .padder -->
|
||||
</div><!-- #content -->
|
||||
|
||||
<?php get_sidebar( 'buddypress' ); ?>
|
||||
<?php get_footer( 'buddypress' ); ?>
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
global $bp, $post, $gp_settings;
|
||||
require(ghostpool_inc . 'options.php');
|
||||
$dedications = bp_dedication_get_dedications_to_user( $bp->displayed_user->id );
|
||||
?>
|
||||
|
||||
<?php foreach ($dedications as $post) : ?>
|
||||
<?php setup_postdata($post); ?>
|
||||
<?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?>
|
||||
|
||||
<?php $gp_settings['image_width'] = 280; ?>
|
||||
|
||||
<div <?php post_class('post-loop'); ?>>
|
||||
<!--Begin Image-->
|
||||
<?php if (has_post_thumbnail()) { ?>
|
||||
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
|
||||
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
|
||||
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], false); ?>
|
||||
<img src="<?php echo $image[url]; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
|
||||
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
|
||||
} else {
|
||||
echo get_the_title();
|
||||
} ?>" />
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!--End Image-->
|
||||
|
||||
<!--Begin Post Text-->
|
||||
<div class="post-text">
|
||||
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><span><?php echo $gp_settings['artist']; ?></span>. <?php echo $gp_settings['song']; ?></a></h2>
|
||||
<?php echo $gp_settings['to_flag']; ?>
|
||||
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
|
||||
</div>
|
||||
<!--End Post Text-->
|
||||
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
global $bp, $post, $gp_settings;
|
||||
require(ghostpool_inc . 'options.php');
|
||||
$dedications = bp_dedication_get_dedications_from_user($bp->displayed_user->id);
|
||||
?>
|
||||
|
||||
<?php foreach ($dedications as $post) : ?>
|
||||
<?php setup_postdata($post); ?>
|
||||
<?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?>
|
||||
|
||||
<?php $gp_settings['image_width'] = 280; ?>
|
||||
|
||||
<div <?php post_class('post-loop'); ?>>
|
||||
<!--Begin Image-->
|
||||
<?php if (has_post_thumbnail()) { ?>
|
||||
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
|
||||
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
|
||||
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], false); ?>
|
||||
<img src="<?php echo $image[url]; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
|
||||
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
|
||||
} else {
|
||||
echo get_the_title();
|
||||
} ?>" />
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!--End Image-->
|
||||
|
||||
<!--Begin Post Text-->
|
||||
<div class="post-text">
|
||||
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><span><?php echo $gp_settings['artist']; ?></span>. <?php echo $gp_settings['song']; ?></a></h2>
|
||||
<?php echo $gp_settings['to_flag']; ?>
|
||||
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
|
||||
</div>
|
||||
<!--End Post Text-->
|
||||
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
global $bp;
|
||||
?>
|
||||
|
||||
|
||||
<?php if ($event != 'create') : ?>
|
||||
<p id="welcome-message"><?php _e("Create your dedication by following these steps:", 'bp-dedication'); ?></p>
|
||||
<form action="<?php bp_dedication_new_dedication_form_action() ?>" method="post" id="new-dedication-form" enctype="multipart/form-data" class="standard-form">
|
||||
|
||||
<div class="columns two first blank text-left">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="dedication_text">Dedication text</label>
|
||||
<textarea name="dedication_text" class="dedication_text required" id="dedication_text"></textarea>
|
||||
<input name="private-dedication" type="checkbox" />This dedication is private.
|
||||
</li>
|
||||
<li>
|
||||
<label for="dedicate_to_input"><?php _e("Search for members to dedicate:", 'bp-dedication') ?></label>
|
||||
|
||||
<ul class="first acfb-holder">
|
||||
<li>
|
||||
<input type="text" name="dedicate_to_input" class="dedicate_to_input" id="dedicate_to_input" />
|
||||
<input type="hidden" name="friend_ids" id="friend_ids" class="required" value="" />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<label for="video_url">Video for dedication</label>
|
||||
<input type="text" name="video_url" class="video_url required url" id="video_url" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="artist_name">Artist name</label>
|
||||
<input type="text" name="artist_name" class="artist_name required" id="artist_name"/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="song_name">Song name</label>
|
||||
<input type="text" name="song_name" class="song_name required" id="song_name"/>
|
||||
</li>
|
||||
<?php /*
|
||||
<li>
|
||||
<label>< ? php _e('Select friend from the directory:', 'bp-dedication') ? > </label>
|
||||
|
||||
<div id="invite-anyone-member-list">
|
||||
<ul>
|
||||
< ? php bp_new_dedication_invite_member_list() ? >
|
||||
</ul>
|
||||
|
||||
< ? php wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user') ? >
|
||||
</div>
|
||||
</li>*/
|
||||
?>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="columns two last blank text-left">
|
||||
<div id="thumbs">
|
||||
</div>
|
||||
<ul id="user-list" class="item-list"></ul>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="submit">
|
||||
<input type="submit" id="submit" name="submit" value="<?php _e('Create dedication', 'bp-dedication') ?>">
|
||||
</div>
|
||||
<?php wp_nonce_field('new_dedication', '_wpnonce_new_dedication') ?>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action('bp_before_group_send_invites_content'); ?>
|
||||
|
||||
<div class="clear"></div>
|
||||
@ -184,9 +184,9 @@ function gp_enqueue_scripts() {
|
||||
if (!is_admin()) {
|
||||
|
||||
wp_enqueue_script('jquery');
|
||||
//wp_enqueue_script('jqueryui');
|
||||
wp_enqueue_script('jqueryui');
|
||||
|
||||
wp_enqueue_script('jqueryui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js', array('jquery'));
|
||||
//wp_enqueue_script('jqueryui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js', array('jquery'));
|
||||
|
||||
if (is_singular())
|
||||
wp_enqueue_script('comment-reply');
|
||||
|
||||
@ -57,9 +57,9 @@
|
||||
<!--End Nav-->
|
||||
<?php } ?>
|
||||
<ul class="navmenu">
|
||||
<li><a class="friends" href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() ?>"><span><?php printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></span></a></li>
|
||||
<li><a class="groups " href="<?php echo bp_loggedin_user_domain() . bp_get_groups_slug() ?>"><span><?php printf( __( 'My Groups <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></span></a></li>
|
||||
<li><a class="dedications" href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() ?>"><span><?php printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></span></a></li>
|
||||
<li><a class="friends" href="<?php echo bp_get_members_directory_permalink(); ?>"><span><?php __( 'Members', 'buddypress' ); ?></span></a></li>
|
||||
<li><a class="groups " href="<?php echo bp_get_groups_directory_permalink(); ?>"><span><?php __( 'Groups', 'buddypress' ); ?></span></a></li>
|
||||
<li><a class="dedications" href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>"><span><?php printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></span></a></li>
|
||||
<li><a class="profile" href="<?php if(function_exists('bp_is_active')) { echo $bp->loggedin_user->domain; } else { echo get_author_posts_url(get_the_author_id()); } ?>"><span><?php _e('Profile', 'gp_lang'); ?></span></a></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
@ -111,6 +111,5 @@
|
||||
|
||||
<?php /*require('social.php');*/ ?>
|
||||
|
||||
|
||||
<!--Begin Content Wrapper-->
|
||||
<div id="content-wrapper">
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $gp_settings;
|
||||
global $gp_settings, $post;
|
||||
|
||||
// Post Type
|
||||
$gp_settings['post_type'] = get_post_meta($post->ID, 'ghostpool_post_type', true);
|
||||
|
||||
@ -15,13 +15,11 @@
|
||||
<div class="padder">
|
||||
|
||||
<?php do_action( 'bp_before_member_home_content' ); ?>
|
||||
|
||||
<?php if (bp_displayed_user_id() != bp_loggedin_user_id()) { ?>
|
||||
<div id="item-header" role="complementary">
|
||||
|
||||
<?php locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
|
||||
</div><!-- #item-header -->
|
||||
|
||||
<?php } ?>
|
||||
<div id="item-nav">
|
||||
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
||||
<ul>
|
||||
|
||||
@ -15,17 +15,14 @@
|
||||
|
||||
<?php get_header( 'buddypress' ); ?>
|
||||
|
||||
<div id="content" class="fullwidth">
|
||||
<div id="content">
|
||||
<div class="padder">
|
||||
|
||||
<!-- <?php // do_action( 'bp_before_member_plugin_template' ); ?>
|
||||
|
||||
<?php do_action('bp_before_member_plugin_template'); ?>
|
||||
<?php if (bp_displayed_user_id() != bp_loggedin_user_id()) { ?>
|
||||
<div id="item-header">
|
||||
|
||||
<?php // locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
|
||||
</div> #item-header -->
|
||||
|
||||
<?php locate_template(array('members/single/member-header.php'), true); ?>
|
||||
</div> <!-- #item-header -->
|
||||
<?php } ?>
|
||||
<div id="item-nav">
|
||||
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
||||
<ul>
|
||||
|
||||
@ -12,14 +12,12 @@
|
||||
|
||||
<div id="content">
|
||||
<div class="padder">
|
||||
|
||||
<?php do_action( 'bp_before_member_settings_template' ); ?>
|
||||
|
||||
<?php if (bp_displayed_user_id() != bp_loggedin_user_id()) { ?>
|
||||
<div id="item-header">
|
||||
|
||||
<?php locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
|
||||
</div><!-- #item-header -->
|
||||
<?php } ?>
|
||||
|
||||
<div id="item-nav">
|
||||
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
||||
|
||||
@ -13,13 +13,12 @@
|
||||
<div id="content" class="fullwidth">
|
||||
<div class="padder">
|
||||
|
||||
<?php // do_action( 'bp_before_member_settings_template' ); ?>
|
||||
|
||||
<!-- <div id="item-header">
|
||||
|
||||
<?php // locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
|
||||
</div> #item-header -->
|
||||
<?php do_action( 'bp_before_member_settings_template' ); ?>
|
||||
<?php if (bp_displayed_user_id() != bp_loggedin_user_id()) { ?>
|
||||
<div id="item-header">
|
||||
<?php locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
</div> <!-- #item-header -->
|
||||
<?php } ?>
|
||||
|
||||
<div id="item-nav">
|
||||
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
||||
|
||||
@ -13,13 +13,12 @@
|
||||
<div id="content">
|
||||
<div class="padder">
|
||||
|
||||
<?php // do_action( 'bp_before_member_settings_template' ); ?>
|
||||
|
||||
<!-- <div id="item-header">
|
||||
|
||||
<?php // locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
|
||||
</div> #item-header -->
|
||||
<?php do_action( 'bp_before_member_settings_template' ); ?>
|
||||
<?php if (bp_displayed_user_id() != bp_loggedin_user_id()) { ?>
|
||||
<div id="item-header">
|
||||
<?php locate_template( array( 'members/single/member-header.php' ), true ); ?>
|
||||
</div> <!-- #item-header -->
|
||||
<?php } ?>
|
||||
|
||||
<div id="item-nav">
|
||||
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
<!--Begin Post Text-->
|
||||
<div class="post-text">
|
||||
<h2><a href="<?php the_permalink(); ?>" title="<?php $gp_settings['artist_song']; ?>"><span><?php echo $gp_settings['artist'];?></span>. <?php echo $gp_settings['song']; ?></a></h2>
|
||||
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><span><?php echo $gp_settings['artist'];?></span>. <?php echo $gp_settings['song']; ?></a></h2>
|
||||
<?php echo $gp_settings['to_flag']; ?>
|
||||
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
|
||||
</div>
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
<div id="sidebar">
|
||||
|
||||
<?php if(function_exists('bp_message_get_notices')) { ?>
|
||||
<?php if (function_exists('bp_message_get_notices')) { ?>
|
||||
<?php bp_message_get_notices(); ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (bp_is_current_action('new-dedication')) { ?>
|
||||
<?php dynamic_sidebar('new-dedication'); ?>
|
||||
<?php } else { ?>
|
||||
<?php dynamic_sidebar('buddypress'); ?>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -735,7 +735,9 @@ h3.comments {
|
||||
margin-left: 60px;
|
||||
}
|
||||
|
||||
/*REMOVE.forum a,
|
||||
|
||||
|
||||
REMOVE.forum a,
|
||||
.bbPress #content span.bbp-admin-links a,
|
||||
.bbPress #content .bbp-reply-permalink {
|
||||
color: #325670;
|
||||
@ -760,7 +762,9 @@ color: #077dc8;
|
||||
.bp-wrapper #content-wrapper #submit_topic_cancel,
|
||||
.bp-wrapper #content-wrapper .acomment-options a,
|
||||
.bp-wrapper #content-wrapper .activity-meta a:hover span {
|
||||
background: #2D5069;
|
||||
background: #2D5069;
|
||||
font-size: 14px;
|
||||
color: #fff !important;
|
||||
}
|
||||
.bp-wrapper #content-wrapper .button:hover,
|
||||
.bp-wrapper #content-wrapper .button.submit:hover,
|
||||
@ -773,6 +777,28 @@ background: #2D5069;
|
||||
.bp-wrapper #content-wrapper div.item-list-tabs ul li a:hover span,
|
||||
.bp-wrapper #content-wrapper .activity-meta a span {
|
||||
background: #273138;
|
||||
}*/
|
||||
}
|
||||
|
||||
#members-list li {
|
||||
width: 50%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.bp-wrapper div.pagination {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.bp-wrapper ul.item-list div.action {
|
||||
margin-left: 150px;
|
||||
position: relative;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.bp-wrapper div.item-list-tabs ul li a, .bp-wrapper div.item-list-tabs ul li span {
|
||||
padding: 10px 7px;
|
||||
color: #4B8CC6;
|
||||
}
|
||||
|
||||
.bp-wrapper div#subnav.item-list-tabs {
|
||||
margin: 15px 0 10px;
|
||||
}
|
||||
@ -3,8 +3,7 @@
|
||||
|
||||
if ( is_user_logged_in() ):
|
||||
|
||||
global $gp_settings, $current_user;
|
||||
|
||||
global $gp_settings, $current_user, $bp;
|
||||
get_currentuserinfo();
|
||||
|
||||
if (is_home() || is_front_page()) {
|
||||
@ -139,8 +138,10 @@ if (have_posts()) {
|
||||
<h4 id="dedicationSong"></h4>
|
||||
</div>
|
||||
<div class="columns two last">
|
||||
<a href="" class="button">Dedicate a song</a>
|
||||
<a href="" class="button">Dedicate this song</a>
|
||||
<?php if(function_exists('bp_is_active')) { ?>
|
||||
<a href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button">Dedicate a song</a>
|
||||
<a href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button">Dedicate this song</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
BIN
wp-content/uploads/2012/06/021-100x75.jpg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
wp-content/uploads/2012/06/031-100x75.jpg
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
BIN
wp-content/uploads/2012/07/0-100x75.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
wp-content/uploads/2012/07/08-150x100.jpg
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
wp-content/uploads/2012/07/08-150x150.jpg
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
wp-content/uploads/2012/07/08-200x200.jpg
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
wp-content/uploads/2012/07/08-300x225.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
wp-content/uploads/2012/07/08-400x300.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
wp-content/uploads/2012/07/08.jpg
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
wp-content/uploads/2012/07/09-100x75.jpg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
wp-content/uploads/2012/07/09-150x100.jpg
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
wp-content/uploads/2012/07/09-150x150.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
wp-content/uploads/2012/07/09-200x150.jpg
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
wp-content/uploads/2012/07/09-200x200.jpg
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
wp-content/uploads/2012/07/09-280x210.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
wp-content/uploads/2012/07/09-300x225.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
wp-content/uploads/2012/07/09-400x300.jpg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
wp-content/uploads/2012/07/09.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
wp-content/uploads/2012/07/177110469_6401-100x56.jpg
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
wp-content/uploads/2012/07/177110469_6401-200x112.jpg
Normal file
|
After Width: | Height: | Size: 7.0 KiB |