- Filtro de palabrotas

- Revisión de alta de dedicatoria con usuario e email
- Comprobar en alta de dedicatoria si un email corresponde a un usuario
- Arreglos en los títulos largos
- Corrección del color gris en cabecera, dedicatoria y pie
- Centrado de las columnas del pie
- Problemas en ciertos casos con dedicatorias privadas
- Arreglo del pixelado en avatares de usuario


git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@30 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-07-24 20:45:57 +00:00
parent 04f8539624
commit 2d6ed87b55
22 changed files with 652 additions and 153 deletions

View File

@ -25,10 +25,12 @@ function bp_dedication_create_new_dedication() {
if (isset($_POST['friend_ids'])) {
$friend_ids = explode(',', $_POST['friend_ids']);
} else {
return false;
}
}
if (isset($_POST['friend_email'])) {
$friend_email = $_POST['friend_email'];
}
if (isset($_POST['video_url'])) {
$video_url = $_POST['video_url'];
} else {
@ -43,8 +45,8 @@ function bp_dedication_create_new_dedication() {
$song_name = $_POST['song_name'];
}
if (isset($_POST['private'])) {
if ($_POST['private']) {
if (isset($_POST['private_dedication'])) {
if ($_POST['private_dedication']) {
$post_status = 'private';
} else {
$post_status = 'publish';
@ -52,7 +54,19 @@ function bp_dedication_create_new_dedication() {
} else {
$post_status = 'publish';
}
// Para quien va el video ?
if (isset($friend_email) && (is_email($friend_email))) {
// Existe un usuario con ese email?
$user_email = get_user_by('email', $friend_email);
if ($user_email) {
$friend_ids = array(',');
$friend_ids[] = $user_email->ID;
} else {
$friend_ids = array();
}
}
$videoData = array();
$videoID = getVideoID($video_url);
@ -84,10 +98,16 @@ function bp_dedication_create_new_dedication() {
add_post_meta($post_id, 'ghostpool_dedication_song', $song_name);
add_post_meta($post_id, 'ghostpool_dedication_url', $videoData['videoURL']);
$friend_info = get_userdata($friend_ids[1]);
add_post_meta($post_id, 'ghostpool_destination_user_id', $friend_info->ID);
add_post_meta($post_id, 'ghostpool_destination_user_name', $friend_info->user_login);
add_post_meta($post_id, 'ghostpool_destination_user_email', $friend_info->user_email);
if (count($friend_ids) > 1) {
$friend_info = get_userdata($friend_ids[1]);
add_post_meta($post_id, 'ghostpool_destination_user_id', $friend_info->ID);
add_post_meta($post_id, 'ghostpool_destination_user_name', $friend_info->user_login);
add_post_meta($post_id, 'ghostpool_destination_user_email', $friend_info->user_email);
}
if (isset($friend_email) && (is_email($friend_email))) {
add_post_meta($post_id, 'ghostpool_destination_user_email', $friend_email);
}
$imageurl = $videoData['thumbnail'];
$imageurl = stripslashes($imageurl);

View File

@ -7,7 +7,7 @@ jQuery(document).ready(function(){
var idFriendVal = j("#friend_ids").val();
var eMailFriendVal = j("#friend_email").val();
var eMailRegExp = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (idFriendVal != "") {
result = true;
} else {
@ -28,6 +28,9 @@ jQuery(document).ready(function(){
validacionDestinatario : true
}
},
onkeyup: false,
onclick: false,
onfocusout: false,
ignore: [],
messages: {
dedicate_to_input: "Please choose one member name or enter a valid email"

View File

@ -190,8 +190,9 @@ class Top_Members extends WP_Widget {
$gravatar_detect = strpos($output,"%gravatar%");
if($gravatar_detect !== false){
$gravatar = get_avatar($user->ID, $gravatar_size);
$output = str_replace("%gravatar%",$gravatar,$output);
$gravatar = get_avatar($user->ID, $gravatar_size);
$gravatar = str_replace("bpthumb", "bpfull",$gravatar);
$output = str_replace("%gravatar%",$gravatar,$output);
}
if(($user_is_admin && $exclude_admin == "on") || ($post<1 && $exclude_zero=="on"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,134 @@
=== WP Content Filter ===
Contributors: dgwyer
Tags: filtered, keywords, options, profanity, swearing, post, admin
Requires at least: 2.7
Tested up to: 3.3.2
Stable tag: 2.31
Protect your site by filtering out profanity, swearing, abusive comments and other keywords of your choice. Flexible Plugin options available.
== Description ==
Update: Now filters bbPress titles and content!
With this Plugin you can block out all profanity, swearing, abusive comments and any other keywords of your choice specified on the Plugin options page. The Plugin now features advanced control over content such as flexible strict filtering options. For example, flagged keywords which are embedded in whole words can now be ignored.
i.e. 'competition' will now be ignored if you have 'pet' as a flagged keyword. Previously it would ALWAYS appear as 'com***ition'.
You can select which sections of your WordPress site to filter keywords from including:
* Posts (including recent posts sidebar widget)
* Post title
* Comments (including recent comments sidebar widget)
* Comment authors
* Tags
* Tag cloud
Keywords are replaced with wild card characters (set in the Plugin options). Further options retain the first letter of each filtered keyword, remove all letters (wild card characters only), or retain the first and last letter of the filtered keyword. For example, the keyword pluto would be replaced with either p****, *****, or p***o. Keywords can also be filtered using case insensitive, or case sensitive options.
There is also a setting to preserve current options if the Plugin is ever temporarily deactivated. When the Plugin is reactivated it will either reload the default settings or the previous options will remain. In the next version the option database entries for the Plugin will be removed only if the plugin files are deleted, and not just when the Plugin is simply deactivated which was the case with the pre 2.0 version.
Please rate it if you find it useful, thanks.
See our <a href="http://www.presscoders.com" target="_blank">WordPress development site</a> for more information.
== Installation ==
Instructions for installing the WP Content Filter Plugin.
1. Download and extract the Plugin zip file.
2. Upload the folder containing the Plugin files to your WordPress Plugins folder (usually ../wp-content/plugins/ folder).
3. Activate the Plugin via the 'Plugins' menu in WordPress.
4. Once activated you go to the Plugin options by clicking the 'WP Content Filter' link under the 'Settings' menu.
5. Enter your required filter keywords and configure other options and your site content will be protected automatically.
== Frequently Asked Questions ==
= How do I specify a character other than '*' to blank out swear words etc? =
As of version 1.1 you can now set this in the Plugin options page.
= Does the Plugin change the content in the WordPress database? =
No, the Plugin just filters content directly before it is displayed on the screen. No content in the database is ever altered.
== Screenshots ==
1. Plugin options available.
2. Example of the Plugin working on a live site, filtering post content, comments, and the comment author name!
3. Activated Plugin on the Manage Plugins page.
== Changelog ==
*2.31 update*
* Minor update to Plugin options page.
*2.3 update*
* Support for filtering of bbPress title and content.
* Plugin options page updated.
*2.28 update*
* New internal function pre-fix used due to clash with another Plugin(s).
* Tested with WordPress 3.2.1.
*2.27 update*
* Updated for WordPress 3.1.
*2.26 update*
* Minor changes to Plugin options page.
* Tested and updated to work with WordPress 3.0.
*2.25 update*
* Ammendments to the Plugin options page.
*2.20 update*
* Strict filtering issue now fixed! Flagged keywords which are embedded in whole words can now be ignored with new Plugin options.
* New Plugin support package available.
*2.11 update*
* Admin help information labels updated.
* Screenshots resized, and a third one added.
*2.1 update*
* Added new filter character option - Blank, which replaces flagged keywords with nothing. i.e. basically just deletes the keyword(s).
* Changed drop down text for other filter character options to be in line with newly added option.
* Small CSS changes to WP Content Filter options page, to be consistent with WordPress options pages.
*2.05 update*
* Options table entries now removed when Plugin is deleted via WordPress admin.
* Legacy options entries now checked for and removed by default.
*2.01 update*
* Small edit to the menu page code.
*2.0 update*
* Overhaul of the Plugin code base.
* New options engine used.
* Options page completely updated.
* Keywords textbox input now validated, and automatically strips out HMTL tags.
* New option to preserve settings or restore defaults if the Plugin is temporarily deactivated and then reactivated.
* Option to delete Option db entries upon deactivation removed. Instead, a future version will delete these entries automatically when the Plugin is deactivated AND deleted.
*1.2 update*
* Comment author field, now filtered for keywords.
* Larger input area for entering keywords to be filtered.
*1.1 update*
* New option to remove all Plugin database settings when Plugin is deactivated. This is useful if you wish to delete the Plugin; in this case the option will clean up the database automatically. Note: If this option is selected, and the Plugin deactivated/activated then the Plugin options will revert to their defaults (i.e. same effect as installing the Plugin for the first time). So if you wish to retain your settings between updgrades leave this option at its default setting (off).
* Existing admin controls swapped around a bit.
* Can now select the wildcard character used in blanking out keywords (previous was fixed to only an asterisk).
* Choice of letters to retain in filtered keywords, options include: retain first letter (default), retain first and last letter, blank out ALL characters.

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,350 @@
<?php
/*
Plugin Name: WP Content Filter
Plugin URI: http://www.presscoders.com/plugins/wp-content-filter/
Description: Filter out profanity, swearing, abusive comments and any other keywords from your site.
Version: 2.31
Author: David Gwyer
Author URI: http://www.presscoders.com
*/
/* Copyright 2009 David Gwyer (email : d.v.gwyer@presscoders.com)
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
*/
// @todo
//
// 1. Filter browser title.
// 2. Somehow flag/identify/segregate the posts and comments that have the offending content. That way the admin could deal with the offender, and modify the post or comment content as they see fit. As it stands now, the only way to find the bad content is to visually see it on the site.
// pccf_ prefix is derived from [p]ress [c]oders [c]ontent [f]ilter
register_activation_hook( __FILE__, 'pccf_add_defaults' );
register_uninstall_hook( __FILE__, 'pccf_delete_plugin_options' );
add_action( 'admin_init', 'pccf_init' );
add_action( 'admin_menu', 'pccf_add_options_page' );
add_action( 'plugins_loaded', 'pccf_contfilt' );
add_filter( 'plugin_action_links', 'pccf_plugin_action_links', 10, 2 );
add_action( 'activated_plugin','pccf_save_error' );
function pccf_save_error(){
update_option( 'pc_plugin_error', ob_get_contents() );
}
add_action( 'shutdown','pc_show_plugin_error' );
function pc_show_plugin_error(){
echo get_option('plugin_error');
}
// ***************************************
// *** START - Create Admin Options ***
// ***************************************
// delete options table entries ONLY when plugin deactivated AND deleted
function pccf_delete_plugin_options() {
delete_option('pccf_options');
}
// Define default option settings
function pccf_add_defaults() {
$tmp = get_option('pccf_options');
if( ( (isset($tmp['chk_default_options_db']) && $tmp['chk_default_options_db']=='1')) || (!is_array($tmp)) ) {
$arr = array("chk_post_title" => "1", "chk_post_content" => "1", "chk_comments" => "1", "txtar_keywords" => "Saturn, Jupiter, Pluto", "rdo_word" => "all", "drp_filter_char" => "star", "rdo_case" => "insen", "chk_default_options_db" => "", "rdo_strict_filtering" => "strict_on");
update_option('pccf_options', $arr);
}
}
// Init plugin options to white list our options
function pccf_init(){
// put the below into a function and add checks all sections (especially radio buttons) have a valid choice (i.e. no section is blank)
// this is primarily to check newly added options have correct initial values
$tmp = get_option('pccf_options');
if(!$tmp['rdo_strict_filtering'])
{ // check strict filtering option has a starting value
$tmp["rdo_strict_filtering"] = "strict_off";
update_option('pccf_options', $tmp);
}
register_setting( 'pccf_plugin_options', 'pccf_options', 'pccf_validate_options' );
}
// Add menu page
function pccf_add_options_page() {
add_options_page('WP Content Filter Options Page', 'WP Content Filter', 'manage_options', __FILE__, 'pccf_render_form');
}
// Draw the menu page itself
function pccf_render_form() {
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br></div>
<h2>WP Content Filter Options</h2>
<p>Configure the content filter Plugin options below.</p>
<form method="post" action="options.php">
<?php settings_fields('pccf_plugin_options'); ?>
<?php $options = get_option('pccf_options'); ?>
<table class="form-table">
<tr>
<th scope="row">Keywords to Remove</th>
<td>
<textarea name="pccf_options[txtar_keywords]" rows="7" cols="50" type='textarea'><?php echo $options['txtar_keywords']; ?></textarea><br /><span style="color:#888;margin-left:2px;font-style: italic;">Separate keywords with commas</span>
</td>
</tr>
<tr valign="top">
<th scope="row">Strict Filtering</th>
<td>
<label><input name="pccf_options[rdo_strict_filtering]" type="radio" value="strict_off" <?php checked('strict_off', $options['rdo_strict_filtering']); ?> /> Strict Filtering OFF <span style="color:#888;margin-left:119px;">['ass' => 'p***able']</span></label><br />
<label><input name="pccf_options[rdo_strict_filtering]" type="radio" value="strict_on" <?php checked('strict_on', $options['rdo_strict_filtering']); ?> /> Strict Filtering ON (recommended) <span style="color:#888;margin-left:32px;">['ass' => 'passable']</span></label><br /><span style="color:#888;font-style: italic;">Note: When strict filtering is ON, embedded keywords are no longer filtered.</span>
</td>
</tr>
<tr valign="top">
<th scope="row">Filter main content</th>
<td>
<label><input name="pccf_options[chk_post_content]" type="checkbox" value="1" <?php if (isset($options['chk_post_content'])) { checked('1', $options['chk_post_content']); } ?> /> Post Content<?php if (class_exists('bbPress')) { echo " (including bbPress content)"; } ?></label><br />
<label><input name="pccf_options[chk_post_title]" type="checkbox" value="1" <?php if (isset($options['chk_post_title'])) { checked('1', $options['chk_post_title']); } ?> /> Post Titles<?php if (class_exists('bbPress')) { echo " (including bbPress titles)"; } ?></label><br />
<label><input name="pccf_options[chk_comments]" type="checkbox" value="1" <?php if (isset($options['chk_comments'])) { checked('1', $options['chk_comments']); } ?> /> Comments (filters comment author names too)</label><br />
<label><input name="pccf_options[chk_tags]" type="checkbox" value="1" <?php if (isset($options['chk_tags'])) { checked('1', $options['chk_tags']); } ?> /> Tags</label><br />
<label><input name="pccf_options[chk_tag_cloud]" type="checkbox" value="1" <?php if (isset($options['chk_tag_cloud'])) { checked('1', $options['chk_tag_cloud']); } ?> /> Tag Cloud</label>
</td>
</tr>
<tr valign="top">
<th scope="row">Word Rendering</th>
<td>
<label><input name="pccf_options[rdo_word]" type="radio" value="first" <?php checked('first', $options['rdo_word']); ?> /> First letter retained <span style="color:#888;margin-left:39px;">[dog => d**]</span></label><br />
<label><input name="pccf_options[rdo_word]" type="radio" value="all" <?php checked('all', $options['rdo_word']); ?> /> All letters removed <span style="color:#888;margin-left:40px;">[dog => ***]</span></label><br />
<label><input name="pccf_options[rdo_word]" type="radio" value="firstlast" <?php checked('firstlast', $options['rdo_word']); ?> /> First/last letter retained <span style="color:#888;margin-left:16px;">[dog => d*g]</span></label>
</td>
</tr>
<tr>
<th scope="row">Filter Character</th>
<td>
<select name='pccf_options[drp_filter_char]'>
<option value='star' <?php selected('star', $options['drp_filter_char']); ?>>[*] Asterisk</option>
<option value='dollar' <?php selected('dollar', $options['drp_filter_char']); ?>>[$] Dollar</option>
<option value='question' <?php selected('question', $options['drp_filter_char']); ?>>[?] Question</option>
<option value='exclamation' <?php selected('exclamation', $options['drp_filter_char']); ?>>[!] Exclamation</option>
<option value='hyphen' <?php selected('hyphen', $options['drp_filter_char']); ?>>[-] Hyphen</option>
<option value='hash' <?php selected('hash', $options['drp_filter_char']); ?>>[#] Hash</option>
<option value='tilde' <?php selected('tilde', $options['drp_filter_char']); ?>>[~] Tilde</option>
<option value='blank' <?php selected('blank', $options['drp_filter_char']); ?>>[ ] Blank</option>
</select>
<span style="color:#888;margin-left:2px;font-style: italic;">[ ] Blank - completely removes the filtered keywords from view.</span>
</td>
</tr>
<tr valign="top">
<th scope="row">Case Matching</th>
<td>
<label><input name="pccf_options[rdo_case]" type="radio" value="sen" <?php checked('sen', $options['rdo_case']); ?> /> Case Sensitive</label><br />
<label><input name="pccf_options[rdo_case]" type="radio" value="insen" <?php checked('insen', $options['rdo_case']); ?> /> Case Insensitive (recommended)</label><br /><span style="color:#888;font-style: italic;">Note: 'Case Insensitive' matching type is better as it captures more words!</span>
</td>
</tr>
<tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
<tr valign="top" style="border-top:#dddddd 1px solid;">
<th scope="row">Database Options</th>
<td>
<label><input name="pccf_options[chk_default_options_db]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_db'])) { checked('1', $options['chk_default_options_db']); } ?> /> Restore defaults upon plugin deactivation/reactivation</label>
<br /><span style="color:#888;margin-left:2px;font-style: italic;">Only check this if you want to reset plugin settings upon reactivation</span>
</td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
<div style="margin-top:15px;">
<p style="margin-bottom:10px;">If you use this Plugin on your website <b><em>please</em></b> consider making a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9B8X2UGPKCLQ2" target="_blank">donation</a> to support continued development. Thanks.&nbsp;&nbsp;:-)</p>
</div>
<div style="clear:both;">
<p>
<a href="http://www.facebook.com/PressCoders" title="Our Facebook page" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/facebook.png" /></a><a href="http://www.twitter.com/dgwyer" title="Follow on Twitter" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/twitter.png" /></a>&nbsp;<input class="button" style="vertical-align:12px;" type="button" value="Visit Our Site" onClick="window.open('http://www.presscoders.com')">&nbsp;<input class="button" style="vertical-align:12px;" type="button" value="Free Responsive Theme!" onClick="window.open('http://www.presscoders.com/designfolio')">
</p>
</div>
</div>
<?php
}
// Sanitize and validate input. Accepts an array, return a sanitized array.
function pccf_validate_options($input) {
// strip html from textboxes
$input['txtar_keywords'] = wp_filter_nohtml_kses($input['txtar_keywords']);
return $input;
}
// ***************************************
// *** END - Create Admin Options ***
// ***************************************
// ---------------------------------------------------------------------------------
// ***************************************
// *** START - Plugin Core Functions ***
// ***************************************
function pccf_contfilt() {
$tmp = get_option('pccf_options');
if (isset($tmp['chk_post_content'])) {
if($tmp['chk_post_content']=='1'){ add_filter('the_content', 'pccf_filter'); }
/* bbPress specific filtering (only if bbPress is present). */
if (class_exists('bbPress')) {
add_filter('bbp_get_topic_content', 'pccf_filter');
add_filter('bbp_get_reply_content', 'pccf_filter');
}
}
if (isset($tmp['chk_post_title'])) {
if($tmp['chk_post_title']=='1'){ add_filter('the_title', 'pccf_filter'); }
}
if (isset($tmp['chk_comments'])) {
if($tmp['chk_comments']=='1'){ add_filter('comment_text','pccf_filter'); }
}
if (isset($tmp['chk_comments'])) {
if($tmp['chk_comments']=='1'){ add_filter('get_comment_author', 'pccf_filter'); }
}
if (isset($tmp['chk_tags'])) {
if($tmp['chk_tags']=='1'){ add_filter('term_links-post_tag', 'pccf_filter' ); }
}
if (isset($tmp['chk_cloud'])) {
if($tmp['chk_cloud']=='1'){ add_filter('wp_tag_cloud', 'pccf_filter'); }
}
}
function pccf_filter($text) {
$tmp = get_option('pccf_options');
$wildcard_filter_type = $tmp['rdo_word'];
$wildcard_char = $tmp['drp_filter_char'];
if($wildcard_char == 'star'){
$wildcard = '*';
} else if($wildcard_char == 'dollar') {
$wildcard = '$';
} else if($wildcard_char == 'question') {
$wildcard = '?';
} else if($wildcard_char == 'exclamation') {
$wildcard = '!';
} else if($wildcard_char == 'hyphen') {
$wildcard = '-';
} else if($wildcard_char == 'hash') {
$wildcard = '#';
} else if($wildcard_char == 'tilde') {
$wildcard = '~';
} else {
$wildcard = '';
}
$filter_type = $tmp['rdo_case'];
$db_search_string = $tmp['txtar_keywords'];
$search = explode(",", $db_search_string);
$search = array_unique($search); // get rid of duplicates in the keywords textbox
if($tmp['rdo_strict_filtering']=='strict_off')
{
// If strict filtering is OFF - use the standard str_ireplace, and str_ireplace functions
foreach($search as $sub_search)
{
$sub_search = trim($sub_search); // remove whitespace chars from start/end of string
if(strlen($sub_search) > 2)
{
if($wildcard_filter_type == 'first')
{
$tmp_search = substr($sub_search, 0, 1).str_repeat($wildcard, strlen(substr($sub_search, 1)));
}
else if($wildcard_filter_type == 'all')
{
$tmp_search = str_repeat($wildcard, strlen(substr($sub_search, 0)));
}
else
{
$tmp_search = substr($sub_search, 0, 1).str_repeat($wildcard, strlen(substr($sub_search, 2))).substr($sub_search, -1, 1);
}
if($filter_type == "insen")
{
$text = str_ireplace($sub_search, $tmp_search, $text);
}
else
{ $text = str_replace($sub_search, $tmp_search, $text); }
}
}
}
else
{
// If strict filtering is ON - use regular expressions for more powerful seach and replace
foreach($search as $sub_search)
{
$sub_search = trim($sub_search); // remove whitespace chars from start/end of string
if(strlen($sub_search) > 2)
{
if($wildcard_filter_type == 'first')
{
$tmp_search = substr($sub_search, 0, 1).str_repeat($wildcard, strlen(substr($sub_search, 1)));
}
else if($wildcard_filter_type == 'all')
{
$tmp_search = str_repeat($wildcard, strlen(substr($sub_search, 0)));
}
else
{
$tmp_search = substr($sub_search, 0, 1).str_repeat($wildcard, strlen(substr($sub_search, 2))).substr($sub_search, -1, 1);
}
if($filter_type == "insen")
{
$text = str_replace_word_i($sub_search, $tmp_search, $text);
}
else
{ $text = str_replace_word($sub_search, $tmp_search, $text); }
}
}
}
return $text;
}
// case insensitive
function str_replace_word_i($needle,$replacement,$haystack){
$needle = str_replace('/','\\/', preg_quote($needle)); // allow '/' in keywords
$pattern = "/\b$needle\b/i";
$haystack = preg_replace($pattern, $replacement, $haystack);
return $haystack;
}
// case sensitive
function str_replace_word($needle,$replacement,$haystack){
$needle = str_replace('/','\\/',preg_quote($needle)); // allow '/' in keywords
$pattern = "/\b$needle\b/";
$haystack = preg_replace($pattern, $replacement, $haystack);
return $haystack;
}
// Display a Settings link on the main Plugins page
function pccf_plugin_action_links( $links, $file ) {
if ( $file == plugin_basename( __FILE__ ) ) {
$posk_links = '<a href="'.get_admin_url().'options-general.php?page=wp-content-filter/wp-content-filter.php">'.__('Settings').'</a>';
// make the 'Settings' link appear first
array_unshift( $links, $posk_links );
}
return $links;
}
// ***************************************
// *** END - Plugin Core Functions ***
// ***************************************

View File

@ -7,6 +7,7 @@
<?php global $bp, $post, $gp_settings; ?>
<?php get_header( 'buddypress' ); ?>
<?php if ( !bp_is_current_action( 'new-dedication' ) ) : ?>
<?php locate_template( array( 'video-slider.php' ), true ); ?>
<?php endif; ?>

View File

@ -60,7 +60,7 @@ global $bp;
<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.
<input name="private_dedication" type="checkbox" />This dedication is private.
</li>
<li>
<label for="video_url">Video for dedication</label>

View File

@ -535,4 +535,55 @@ function the_url( $url ) {
}
add_filter( 'login_headerurl', 'the_url' );
/* ************************* Other functions ************************** */
function htmlwrap(&$str, $maxLength, $char='<br />'){
$count = 0;
$newStr = '';
$openTag = false;
$lenstr = strlen($str);
for($i=0; $i<$lenstr; $i++){
$newStr .= $str{$i};
if($str{$i} == '<'){
$openTag = true;
continue;
}
if(($openTag) && ($str{$i} == '>')){
$openTag = false;
continue;
}
if(!$openTag){
if($str{$i} == ' '){
if ($count == 0) {
$newStr = substr($newStr,0, -1);
continue;
} else {
$lastspace = $count + 1;
}
}
$count++;
if($count==$maxLength){
if ($str{$i+1} != ' ' && $lastspace && ($lastspace < $count)) {
$tmp = ($count - $lastspace)* -1;
$newStr = substr($newStr,0, $tmp) . $char . substr($newStr,$tmp);
$count = $tmp * -1;
} else {
$newStr .= $char;
$count = 0;
}
$lastspace = 0;
}
}
}
return $newStr;
}
function cutstr($str, $length, $ellipsis=''){
$cut = (array)explode('\n\n', htmlwrap($str, $length, '\n\n'));
return $cut[0].((strlen($cut)<strlen($str))?$ellipsis:'');
}
?>

View File

@ -78,7 +78,7 @@
<?php if($theme_search_form == "0") { ?>
<div id="search-panel" class="columns onethird last">
<div id="search-box">
<?php get_search_form(); ?>
<?php get_search_form(); ?>
</div>
</div>
<?php } ?>
@ -99,6 +99,7 @@
<!--End Header-->
<?php if( (is_user_logged_in()) && (is_home() || is_front_page())) { ?>
<?php if (!in_array(bp_current_component(), array("members", "groups"))) { ?>
<?php require('video-slider.php'); ?>
<div id="precontent-wrapper">
<div id="dedicationComments_container" class="columns two first text-left">&nbsp;</div>
@ -108,7 +109,7 @@
<div class="clear"></div>
</div>
<div class="clear"></div>
<?php } ?>
<?php } ?>
<?php /*if(is_home() && $theme_slider == "0") { require('slider.php'); }*/ ?>

View File

@ -6,15 +6,34 @@ global $gp_settings;
<?php
$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged&posts_per_page=".$gp_settings['posts_per_page'];
$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged";
query_posts($args);
$contador = 0;
?>
<div id="content"<?php if($gp_settings['dropdown_filter'] == "0") { ?> class="shift-down"<?php } ?>>
<?php if (have_posts()) : while (have_posts()) : the_post(); include('loop-data.php'); ?>
<?php
if ($contador == $gp_settings['posts_per_page']) {
break;
}
$from_user_id = get_the_author_meta('ID');
$to_user_id = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);
$to_user = get_user_by('id', $to_user_id);
$to_user_email = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);
$displayed_id = bp_displayed_user_id();
// Usuario actual puede ver la dedicatoria?
if ($post->post_status == 'private') {
if (($current_user->ID != $from_user_id) && ($current_user->ID != $to_user_id)) {
continue; // me salto esta dedicatoria
}
}
$contador += 1;
?>
<div <?php post_class('post-loop'); ?>>

View File

@ -14,54 +14,6 @@ class SidebarPosts extends WP_Widget {
$this->WP_Widget('sidebar-posts-widget', __('GP Sidebar Posts', 'gp_lang'), $widget_ops);
}
function htmlwrap(&$str, $maxLength, $char='<br />'){
$count = 0;
$newStr = '';
$openTag = false;
$lenstr = strlen($str);
for($i=0; $i<$lenstr; $i++){
$newStr .= $str{$i};
if($str{$i} == '<'){
$openTag = true;
continue;
}
if(($openTag) && ($str{$i} == '>')){
$openTag = false;
continue;
}
if(!$openTag){
if($str{$i} == ' '){
if ($count == 0) {
$newStr = substr($newStr,0, -1);
continue;
} else {
$lastspace = $count + 1;
}
}
$count++;
if($count==$maxLength){
if ($str{$i+1} != ' ' && $lastspace && ($lastspace < $count)) {
$tmp = ($count - $lastspace)* -1;
$newStr = substr($newStr,0, $tmp) . $char . substr($newStr,$tmp);
$count = $tmp * -1;
} else {
$newStr .= $char;
$count = 0;
}
$lastspace = 0;
}
}
}
return $newStr;
}
function cutstr($str, $length, $ellipsis=''){
$cut = (array)explode('\n\n', $this->htmlwrap($str, $length, '\n\n'));
return $cut[0].((strlen($cut)<strlen($str))?$ellipsis:'');
}
function widget($args, $instance) {
global $gp_settings, $post, $wp_query, $paged;
extract($args);
@ -153,7 +105,7 @@ class SidebarPosts extends WP_Widget {
$song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
$artist_song = $artist . '. ' . $song;
$artist_song_span = '<span>'.$artist.'</span>'.'. '.$song;
$new_name = $this->cutstr($artist_song_span, 30, '...');
$new_name = cutstr($artist_song_span, 30, '...');
?>
<a href="<?php the_permalink(); ?>" class="post-artist-song" title="<?php echo $artist_song; ?>"><?php echo $new_name; ?></a>

View File

@ -102,54 +102,6 @@ jQuery(document).ready(function(){
});
/*************************** Review Tabs ***************************/
jQuery(document).ready(function(){
var panelContainer = jQuery('#review-panels');
var panelLocation = location.hash.slice(1);
if(panelLocation == '1'){
var panelNum = panelLocation;
} else if(panelLocation == '2'){
var panelNum = panelLocation;
} else if(panelLocation == '3'){
var panelNum = panelLocation;
} else if(panelLocation == '4'){
var panelNum = panelLocation;
} else if(panelLocation == '5'){
var panelNum = panelLocation;
} else if(panelLocation == '6'){
var panelNum = panelLocation;
} else if(panelLocation == '7'){
var panelNum = panelLocation;
} else if(panelLocation == '8'){
var panelNum = panelLocation;
} else if(panelLocation == '9'){
var panelNum = panelLocation;
} else if(panelLocation == '10'){
var panelNum = panelLocation;
} else{
var panelNum = '1';
}
panelContainer.find('.review-panel').hide();
panelContainer.find('.review-panel:nth-child(' + panelNum + ')').fadeIn('slow');
jQuery('#review-links ul').find('li.tab-link.tab:nth-child(' + panelNum + ')').removeClass('tab').addClass('tab-active');
jQuery('#review-links ul').find('li.tab-link').each(function(n){
jQuery(this).click(function(){
panelContainer.find('.review-panel').hide();
panelContainer.find('.review-panel:nth-child(' + (n+1) + ')').fadeIn('slow');
jQuery(this).parent().find('li.tab-link').removeClass('tab-active').addClass('tab');
jQuery(this).removeClass('tab').addClass('tab-active');
});
});
});
/*************************** Gallery Shortcode Lightbox Support ***************************/
jQuery(document).ready(function(){
@ -252,33 +204,6 @@ jQuery(document).ready(function(){
});
/*************************** Contact Form ***************************/
jQuery(document).ready(function(){
jQuery('#contact-form').submit(function() {
jQuery('.contact-error').remove();
var hasError = false;
jQuery('.requiredFieldContact').each(function() {
if(jQuery.trim(jQuery(this).val()) == '') {
jQuery(this).addClass('input-error');
hasError = true;
} else if(jQuery(this).hasClass('email')) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if(!emailReg.test(jQuery.trim(jQuery(this).val()))) {
jQuery(this).addClass('input-error');
hasError = true;
}
}
});
});
jQuery('#contact-form .contact-submit').click(function() {
jQuery('.loader').css({display:"block"});
});
});
</script>

View File

@ -39,7 +39,7 @@
<li>
<div class="item-avatar">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar('type=full'); ?></a>
</div>
<div class="item">

View File

@ -16,14 +16,39 @@
</h1>
<?php } ?>
<?php query_posts("$query_string&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged&posts_per_page=".$gp_settings['posts_per_page']); ?>
<?php $post_status = 'publish'; ?>
<?php query_posts("$query_string&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged&post_status=$post_status&posts_per_page=".$gp_settings['posts_per_page']); ?>
<div id="content" class="fullwidth<?php if($gp_settings['dropdown_filter'] == "0") { ?> shift-down<?php } ?>">
<?php if (have_posts()) : while (have_posts()) : the_post(); include('loop-dedication-data.php'); ?>
<?php
$from_user_id = get_the_author_meta('ID');
$to_user_id = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);
$to_user = get_user_by('id', $to_user_id);
$to_user_email = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);
$displayed_id = bp_displayed_user_id();
// Usuario actual puede ver la dedicatoria?
if ($post->post_status == 'private') {
if (($current_user->ID != $from_user_id) && ($current_user->ID != $to_user_id)) {
continue; // me salto esta dedicatoria
}
}
$contador += 1;
$artist = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
$song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
$artist_song = $artist . '. ' . $song;
$artist_song_span = '<span>'.$artist.'</span>'.'. '.$song;
$new_name = cutstr($artist_song_span, 38, '');
if ($new_name != $artist_song_span) {
$new_name .= '...';
}
?>
<div <?php post_class('post-loop'); ?>>
<!--Begin Image-->
@ -39,7 +64,7 @@
<!--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>.&nbsp;<?php echo $gp_settings['song']; ?></a></h2>
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $artist_song; ?>"><?php echo $new_name; ?></a></h2>
<?php echo $gp_settings['to_flag']; ?>
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div>

View File

@ -369,7 +369,7 @@ ul.navmenu li a.profile:hover {
height: 650px;
width: 100%;
border: 1px solid #349bbc;
background: #f5f1f0;
background: #E7E7E7;
}
#slider-wrapper .error {
@ -482,6 +482,12 @@ ul.navmenu li a.profile:hover {
margin-top: 15px;
}
.footer-third {
width: 200px;
}
/* Footer Widgets */
#footer-widgets {
@ -493,6 +499,10 @@ ul.navmenu li a.profile:hover {
color: #576a7b;
}
#footer-widgets > div:first-child {
margin-left: 180px;
}
#footer-widgets h3 {
border: 0px;
margin-bottom: 0px;
@ -808,6 +818,7 @@ ul.navmenu li a.profile:hover {
}
/*************************** Others ***************************/
input[type="submit"], input[type="reset"], input[type="button"], button,
#content-wrapper .widget input[type="button"],
#content-wrapper .widget input[type="submit"],
#content-wrapper .widget input[type="reset"],
@ -844,6 +855,7 @@ a.button {
border: 1px outset #34404b;
}
input[type="submit"]:hover, input[type="reset"]:hover, input[type="button"]:hover, button:hover,
.bp-wrapper #content-wrapper .button:hover,
.bp-wrapper #content-wrapper .button.submit:hover,
.bp-wrapper #content-wrapper ul.button-nav li a:hover,
@ -866,6 +878,7 @@ a.button:hover {
border: 1px outset #7CB9D0;
}
input[type="submit"]:active, input[type="reset"]:active, input[type="button"]:active, button:active,
.bp-wrapper #content-wrapper .button:active,
.bp-wrapper #content-wrapper .button.submit:active,
.bp-wrapper #content-wrapper ul.button-nav li a:active,
@ -943,6 +956,7 @@ h3.comments {
padding: 0;
border: none;
color: #576A7B;
overflow: hidden;
}
.comment-meta {
@ -1006,6 +1020,13 @@ h3.comments {
margin: 0;
padding: 0;
padding-right: 1%;
overflow: hidden;
}
.category-dedication.post-loop .post-text {
width: 95%;
white-space: nowrap;
overflow: hidden;
}
.home-page .post-loop {
@ -1030,6 +1051,7 @@ h3.comments {
.post-text h2 {
font-weight: normal;
white-space: nowrap;
}
.post-text h2 span {

View File

@ -67,11 +67,6 @@ if (have_posts()) {
$to_user_email = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);
$displayed_id = bp_displayed_user_id();
/*echo "post->ID => " . $post->ID;
echo "from_user_id => " . $from_user_id;
echo "to_user_id => " . $to_user_id;
echo "displayed_id " . $displayed_id;*/
// En el perfil del usuario sólo mostrar las dedicadas por él y para él. El resto se descartan.
if ( $bp->current_component == 'dedications' ) {
if (($displayed_id != $from_user_id) && ($displayed_id != $to_user_id)) {
@ -80,7 +75,7 @@ if (have_posts()) {
}
// Usuario actual puede ver la dedicatoria?
if (get_post_status($post-ID) == 'private') {
if ($post->post_status == 'private') {
if (($current_user->ID != $from_user_id) && ($current_user->ID != $to_user_id)) {
continue; // me salto esta dedicatoria
}