Más cambios

git-svn-id: https://192.168.0.254/svn/Proyectos.AdemasProyectosSolidarios_Web/trunk@3 dac18aa3-6f68-5b46-b19f-13bb96c8fe2c
This commit is contained in:
David Arranz 2011-05-30 08:57:49 +00:00
parent 19a5917d45
commit e8b0edfddd
130 changed files with 1336 additions and 189 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
[fundal.jpg]
backuphash=53945
[Numen.jpg]
backuphash=53945
[sonrisasbombay.jpg]
backuphash=39066
[Ciudad de la Esperanza y la Alegría.jpg]
backuphash=39066
[tambien.jpg]
backuphash=39066
[Educación-Activa.jpg]
backuphash=39066
[newlightindia.jpg]
backuphash=27692

View File

@ -0,0 +1,49 @@
[fundal.jpg]
filters=crop64=1,5c7b5933a333a9b2;
crop=rect64(5c7b5933a333a9b2)
moddate=f9cebae4111ecc01
width=800
height=706
textactive=0
[Numen.jpg]
filters=crop64=1,5bd75a1ca47aa740;
crop=rect64(5bd75a1ca47aa740)
moddate=901fd6e4111ecc01
width=800
height=750
textactive=0
[sonrisasbombay.jpg]
filters=crop64=1,473d31b8b77acbcf;
crop=rect64(473d31b8b77acbcf)
moddate=213fe3e4111ecc01
width=999
height=726
textactive=0
[Ciudad de la Esperanza y la Alegría.jpg]
filters=crop64=1,583e5054a771af4b;
crop=rect64(583e5054a771af4b)
moddate=3797f1e4111ecc01
width=821
height=682
textactive=0
[tambien.jpg]
filters=crop64=1,51f14416ae0ebbe9;
crop=rect64(51f14416ae0ebbe9)
moddate=5b5bfbe4111ecc01
width=856
height=658
textactive=0
[Educación-Activa.jpg]
filters=crop64=1,1666199aec28ef5b;
crop=rect64(1666199aec28ef5b)
moddate=914605e5111ecc01
width=400
height=400
textactive=0
[newlightindia.jpg]
filters=crop64=1,6333624aa428a272;
crop=rect64(6333624aa428a272)
moddate=9f662630121ecc01
width=800
height=810
textactive=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -0,0 +1,5 @@
copy.src.files=false
copy.src.target=
index.file=index.php
run.as=LOCAL
url=http://localhost/ademas/

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View File

@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_5
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=true
web.root=.

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>Ademas</name>
</data>
</configuration>
</project>

View File

@ -0,0 +1,32 @@
<?php
define('DOING_AJAX', true);
define('WP_ADMIN', true);
require_once(dirname(__FILE__) . '/../../../../wp-load.php');
require_once(ABSPATH . '/wp-admin/includes/admin.php');
require_once('../dcw-common.php');
@header('Content-Type: text/json; charset=' . get_option('blog_charset'));
send_nosniff_header();
$q = strtolower($_REQUEST["q"]);
if (!$q) return;
$q = urldecode($q);
function write_result($rows) {
$status = 'OK';
if (sizeof($rows) > 1) {
$status = 'TOO_MANY_FOUND';
}
echo '{"status" : "' . $status . '", "id" : "' . $rows[0]->ID . '", "title" : "'. $rows[0]->post_title .'"}';
}
$results = dcw_find_content_id($q);
if (sizeof($results) > 0) {
write_result($results);
} else {
echo '{"status" : "NOT_FOUND"}';
}
?>

View File

@ -0,0 +1,22 @@
.error {
border-style: solid;
border-width: 1px;
border-color: red;
}
.errormessage {
font-size: 10px;
color: red;
}
.warning {
border-style: solid;
border-width: 1px;
border-color: orange;
}
.warningmessage {
font-size: 10px;
color: orange;
}

View File

@ -0,0 +1,146 @@
<?php
/*
* Common functions for dynamic content widget
* @since 0.1
*
* Copyright (C) 2011 Dikhoff Software
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
function dcw_get_ID_by_slug($page_slug) {
global $wpdb;
$querystr = "SELECT wposts.*
FROM $wpdb->posts wposts
WHERE wposts.post_status = 'publish'
AND wposts.post_name = '$page_slug'
AND (wposts.post_type = 'post'
OR wposts.post_type = 'page')
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
$page = $pageposts[0];
if ($page) {
return $page->ID;
} else {
return null;
}
}
function dcw_get_subtemplate_description( $file ) {
global $st_file_descriptions;
if ( isset( $st_file_descriptions[basename( $file )] ) ) {
return $st_file_descriptions[basename( $file )];
}
elseif ( file_exists( $file ) && is_file( $file ) ) {
$template_data = implode( '', file( $file ) );
if ( preg_match( '|Subtemplate:(.*)$|mi', $template_data, $name )||
preg_match( '|Subtemplate Name:(.*)$|mi', $template_data, $name ))
return _cleanup_header_comment($name[1]);
}
return null;
}
function dcw_get_template_sysname($file) {
$bname = basename($file);
$parts = split("\.", $bname);
return $parts[0];
}
function dcw_get_subtemplates() {
global $dcw_subtemplates;
if (isset($dcw_subtemplates)) {
return $dcw_subtemplates;
}
$st_subtemplates = Array();
$themes = get_themes();
$theme = get_current_theme();
foreach ( $themes[$theme]['Template Files'] as $template_file ) {
$desc = dcw_get_subtemplate_description($template_file);
if ($desc) {
$st_subtemplates[dcw_get_template_sysname($template_file)] = $desc;
}
}
return $st_subtemplates;
}
function dcw_write_subtemplates($widget, $instance) {
$subtemplates = dcw_get_subtemplates();
$sid = $widget->get_field_id( 'subtemplate' );
?>
<p>
<label for="<?php echo $sid; ?>"><?php _e('Subtemplate:', 'subtemplate'); ?></label>
<select id="<?php echo $sid; ?>" name="<?php echo $widget->get_field_name( 'subtemplate' ); ?>">
<option value="">None</option>
<?php
foreach ( $subtemplates as $file => $desc ) {
$sel = '';
if ($instance['subtemplate'] == $file) {
$sel = ' selected="selected"';
}
echo '<option value="'. $file .'"' . $sel . ' >' . $desc . '</option>';
}
?>
</select>
</p>
<?php
}
function _dcw_find_content_id($field, $q) {
global $wpdb;
$dbquery = $wpdb->prepare("
SELECT ID, post_title, post_name FROM $wpdb->posts
WHERE post_status = 'publish'
AND post_type NOT IN ('nav_menu_item', 'revision')
AND $field = '%s'", $q);
$results = $wpdb->get_results($dbquery);
return $results;
}
function dcw_find_content_id($q) {
$parts = split(':', $q);
if (is_numeric($parts[0])) {
$results = _dcw_find_content_id("ID", $parts[0]);
if (sizeof($results) > 0) {
return $results;
}
}
$results = _dcw_find_content_id("post_title", $q);
if (sizeof($results) > 0) {
return $results;
}
$results = _dcw_find_content_id("post_name", $q);
if (sizeof($results) > 0) {
return $results;
}
}
?>

View File

@ -0,0 +1,182 @@
<?php
/**
* Dynamic Content Widget class.
*
* @since 0.1
*
* Copyright (C) 2011 Dikhoff Software
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
require_once("dcw-common.php");
class dcw_Dynamic_Content_Widget extends WP_Widget {
/**
* Widget constructor.
*/
function dcw_Dynamic_Content_Widget() {
/* Widget settings. */
$widget_ops = array( 'classname' => 'Dynamic Content Widget', 'description' => __('A widget that renders content with a template.', 'dynamic content') );
/* Widget control settings. */
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'dcw-dynamic-content-widget' );
/* Create the widget. */
$this->WP_Widget( 'dcw-dynamic-content-widget', __('Dynamic Content Widget', 'dynamic content'), $widget_ops, $control_ops );
}
/**
* Display widget in area.
* @see WP_Widget::widget()
*/
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title'] );
$dcw_slug = $instance['slug'];
$dcw_template = $instance['subtemplate'];
$dcw_id = $instance['id'];
echo $before_widget;
if ( $title ) {
echo $before_title . $title . $after_title;
}
// if no id, try finding the content by the slug
if (!$dcw_id) {
if ($dcw_slug) {
$rows = dcw_find_content_id($dcw_slug);
$dcw_id = $rows[0]->ID;
$instance['id'] = $dcw_id;
}
}
if (!$dcw_id) {
echo "No content found with id '$dcw_id' or identifier '$dcw_slug'.";
}
$content = new WP_Query();
$content->query('p=' . $dcw_id . '&post_type=any');
if (!$content->have_posts()) {
echo "No content found with id '$dcw_id'.";
}
if ($dcw_template == '') {
echo "Error: No subtemplate selected";
}
while ($content->have_posts()) {
$content->the_post();
get_template_part($dcw_template);
}
echo $after_widget;
}
/**
* Update fields.
* @see WP_Widget::update()
*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['slug'] = strip_tags( $new_instance['slug'] );
$instance['subtemplate'] = strip_tags( $new_instance['subtemplate'] );
$instance['id'] = strip_tags( $new_instance['id'] );
return $instance;
}
/**
* Display form.
* @see WP_Widget::form()
*/
function form( $instance ) {
$defaults = array( 'title' => __('Dynamic content', 'dynamic content'),
'slug' => __('about', 'about'),
'subtemplate' => '',
'id' => ''
);
$instance = wp_parse_args( (array) $instance, $defaults );
?>
<script type="text/javascript">
checkField('<?php echo $this->get_field_id( 'slug' ); ?>', '<?php echo $this->get_field_id( 'id' ); ?>');
</script>
<input id="<?php echo $this->get_field_id( 'id' ); ?>"
type="hidden"
name="<?php echo $this->get_field_name( 'id' ); ?>"
value="<?php echo $instance['id']; ?>"
/>
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?></label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>"
name="<?php echo $this->get_field_name( 'title' ); ?>"
value="<?php echo $instance['title']; ?>" style="width: 100%;" /></p>
<p><label for="<?php echo $this->get_field_id( 'slug' ); ?>"><?php _e('Slug or id:', 'slug'); ?></label>
<input id="<?php echo $this->get_field_id( 'slug' ); ?>"
name="<?php echo $this->get_field_name( 'slug' ); ?>"
value="<?php echo $instance['slug']; ?>" style="width: 275px;"
onblur="checkField('<?php echo $this->get_field_id( 'slug' ); ?>', '<?php echo $this->get_field_id( 'id' ); ?>');"
/><span style="float:right;padding:4px 0 0 0;" id="<?php echo $this->get_field_id( 'slug' ); ?>-result">&nbsp;</span>
</p>
<?php dcw_write_subtemplates($this, $instance); ?>
<?php
}
} // class
/**
* Register widgets.
* @since 0.1
*/
function dcw_load_widget() {
register_widget( 'dcw_Dynamic_Content_Widget' );
}
/**
* Load CSS.
*/
function dcw_add_css() {
global $pagenow;
if (is_admin() && $pagenow == 'widgets.php') {
$cssurl = plugins_url('/css/dynamic-content-widget.css', __FILE__ );
wp_register_style("dcw_css", $cssurl);
wp_enqueue_style("dcw_css");
}
}
/**
* Load scripts.
*/
function dcw_print_scripts() {
global $pagenow;
if (is_admin() && $pagenow == 'widgets.php') {
$scripturl = plugins_url('/js/dynamic-content-widget.js', __FILE__ );
wp_enqueue_script("dcw_scripts", $scripturl, Array("suggest"));
}
}
add_action( 'widgets_init', 'dcw_load_widget' );
add_action( 'admin_print_scripts', 'dcw_print_scripts');
add_action( 'admin_init', 'dcw_add_css');
?>

View File

@ -0,0 +1,32 @@
<?php
/**
* Plugin Name: Dynamic Content Widget
* Plugin URI: http://dikhoffsoftware.com/dynamic-content-widget
* Description: A widget that can render a post or a page, using a template in your theme.
* Plugin URI: http://dikhoffsoftware.com/dynamic-content-widget/
* Description: A Swiss Army Knife for Wordpress developers. Enter a slug or id, select a template you created, and it will render the content with your template.
* Version: 0.5
* Author: Dikhoff Software
* Author URI: http://dikhoffsoftware.com
*
* Copyright (C) 2011 Dikhoff Software
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
require_once("dcw-dynamic-content-widget.php");
?>

View File

@ -0,0 +1,43 @@
function checkField(id, hiddenid) {
setTimeout(function() {
var field = jQuery("#" + id);
var hiddenField = jQuery("#" + hiddenid);
var resultField = jQuery("#" + id + "-result");
var q = field.val();
resultField.html('<img src="../wp-admin/images/loading.gif" alt="Checking" />');
jQuery.getJSON(
"../wp-content/plugins/dynamic-content-widget/ajax/findcontentid.php",
{q: field.val()},
function(json) {
var result = '<img src="../wp-admin/images/no.png" alt="Unknown error" />';
if (json.status == 'NOT_FOUND') {
field.addClass("error");
result = '<img src="../wp-admin/images/no.png" alt="No content found" />';
} else {
var innerResult = json.id + ": " + json.title;
hiddenField.val(json.id);
if (json.status == 'TOO_MANY_FOUND') {
field.addClass("warning");
result = '<img src="../wp-admin/images/yes.png" alt="Warning: more than one item found" />';
} else if (json.status == 'OK') {
field.removeClass("error");
field.removeClass("warning");
result = '<img src="../wp-admin/images/yes.png" alt="Content found" />'
}
}
resultField.html(result);
}
);
}, 500);
}
jQuery.ajaxSetup ({
cache: false
});

View File

@ -0,0 +1,78 @@
=== Dynamic Content Widget ===
Contributors: DikhoffSoftware
Donate link: http://unicef.com/
Tags: widget, dynamic content, homepage, pinning, sticky, sticky a page, pinning a page, sticky pages, pinning pages, dynamic
Requires at least: 3.0
Tested up to: 3.1.1
Stable tag: 0.5
A Swiss Army Knife for Wordpress developers. Enter a slug or id, select a template you created, and it will render the content with your template.
== Description ==
A Swiss Army Knife for Wordpress developers. With this WordPress widget, you can enter a slug or id, select a
template you created, and the widget will render the content, in a local loop, according to your selected template.
Very handy for things like:
* Pinning content (pages and posts) to the homepage.
* Rendering arbitrary content (pages and posts) in a sidebar or other widget area.
* Define Wordpress widget areas with sidebars, write subtemplates with your own HTML, render content any way you want.
* Many more uses.
Very simple, but also very powerful and versatile. Also may be difficult to use for people who are not into template
hacking, so if you're not used to php or html, this widget probably isn't for you.
== Upcoming changes ==
* Create example and pro subtemplates from the widget.
* Subtemplate editor to modify templates on the fly.
Version 0.5 is confirmed compatible with Wordpress 3.1.1.
Learn how to use this widget by reading these use cases:
* [Pinning content to the homepage](http://dikhoffsoftware.com/dynamic-content-widget/use-case-pinning/ "Pinning content to the homepage")
* [Custom Featured Content Gallery](http://dikhoffsoftware.com/dynamic-content-widget/use-case-gallery/ "Custom Featured Content Gallery")
Go to [the homepage](http://dikhoffsoftware.com/dynamic-content-widget/ "Dynamic Content Widget homepage") for instructions and screenshots.
== Installation ==
1. Upload `dynamic-content-widget.0.4.zip` to the `/wp-content/plugins/` directory and unzip
1. Activate the plugin through the 'Plugins' menu in WordPress
1. For further instructions, go to the [instructions page](http://dikhoffsoftware.com/dynamic-content-widget/ "Dynamic Content Widget instructions").
== Frequently Asked Questions ==
= I don't know much about php or template hacking. Should I try this plugin? =
This is a plugin that's meant for advanced users, so probably not, unless you want to learn.
== Screenshots ==
1. This is what you'll see when you place the widget. Title is the same as other widgets, I usually leave it
empty. Slug or id is the identifier of the page or post you want your template applied to. The slug is the last part
of the url of the page or post. Subtemplate is the template you have created according to the instructions
available on the [instructions page](http://dikhoffsoftware.com/dynamic-content-widget/ "Dynamic Content Widget instructions").
2. Since version 0.4, the widget will detect if you've entered a slug that doesn't exist.
== Changelog ==
= 0.3 =
First version
= 0.31 =
Fixed content for wordpress.org
= 0.32 =
Fixed fatal widget-breaking bug
= 0.4 =
Added automatic slug checking
= 0.5 =
Checked for compatibility and minor addition
== Upgrade Notice ==
= 0.3 =
First version
= 0.32 =
Fixed fatal widget-breaking bug
= 0.4 =
This version has automatic slug checking

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -0,0 +1,25 @@
<?php
/**
* @package DynamicContentWidget
* Subtemplate: Dynamic content example
*
* The widget generates a local loop, so you can call all of the
* regular Wordpress functions from within this template.
*
*/
?>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<p>
<?php the_content(); ?>
</p>
<?php
if ($post->post_type == 'page') {
?>
<span class="category">Page</span>
<?php
} else {
?>
<span class="category">Blog</span>
<?php
}
?>

View File

@ -0,0 +1,179 @@
<?php
/*
Plugin Name: Frontpage category filter
Plugin URI: http://wordpress.phpanswer.com/wpplugins/wp-filter-post-categories/
Description: This plugin allows you to choose which post categories youe site will show on the homepage. Just go to settings and deselect the categories that you want to hide.
Version: 1.0.0
Author: Cristian Merli
Author URI: http://wordpress.phpanswer.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; version 2 of the License.
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
*/
class MerlicFilterCategoryLite {
/**
* Set show all categories by default
*/
public function init() {
$all_categories = get_categories('hide_empty=0');
if (count($all_categories) > 0) {
foreach ($all_categories as $category) {
$cat_ID[] = $category->cat_ID;
}
add_option('merlic_filtercategory_allowed', implode(',', $cat_ID));
}
}
/**
* Filter categories from homepage, showing only posts that belong to selected categories
* @param object $query
* @return object $query
*/
public function filter( $query ) {
$featured_category_id = get_option('merlic_filtercategory_allowed', true);
if ( $query->is_home AND $query->get('post_type') == 'post' ) {
$query->set('category__in', explode(',', $featured_category_id));
//$query->set('posts_per_page', get_option('merlic_filtercategory_postslimit'));
}
return $query;
}
/**
* Callback function for admin_menu action
*/
public function settings_menu() {
add_options_page("Frontpage category filter", "Frontpage category filter", 'manage_options', 'merlic_filtercategory_admin', array('MerlicFilterCategoryLite', 'draw_settings'));
}
/**
* Draws the settings page and manages the stored options
*/
public function draw_settings() {
$all_categories = get_categories('hide_empty=0');
$homepage = get_page(get_option('page_on_front'));
//check if the form has been submitted
if ($_POST['merlic_filtercategory_save']) {
//save page meta data here
if (count($_POST['merlic_filtercategory_allowed']) > 0) update_option('merlic_filtercategory_allowed', implode(',', $_POST['merlic_filtercategory_allowed']));
else
delete_option('merlic_filtercategory_allowed');
//save page meta data here
if (count($_POST['shortcode']) > 0) {
$shortcode = '[wp_filter_posts cat="'.implode(',', $_POST['shortcode']).'"'.(is_int($_POST['posts_limit']) ? ' limit="'.$_POST['posts_limit'].'"' : '').' title_style="'.$_POST['title_style'].'"]';
}
else
$shortcode = '';
update_option('merlic_filtercategory_show_as', $_POST['merlic_filtercategory_show_as']);
$save_message = __('Changes have been saved');
}
//display the form
$output = '
<div class="wrap">
<h2>'.__('Frontpage category filter settings').'</h2>
<p>Uncheck the categories that you want to hide from your posts page</p>
';
$output .= '
<form method="POST" accept-charset="utf-8" target="_self" action="'.$_SERVER['REQUEST_URI'].'">
<table class="form-table">
<tr valign="top"><th scope="row"><label><b>'.__('Page').'</b></label></th><td><b>'.__('Categories').'</b></td></tr>
<tr valign="top">
<th scope="row"><label>'.__('Default Post Page').'</label></th>
<td>'.self::draw_categories($all_categories).'</td>
</tr>
<tr valign="top">
<th scope="row"><label>'.__('Other pages').'</label></th>
<td>To show posts from certain categories on other pages you need to upgrade to the <a href="http://wordpress.phpanswer.com/wp-filter-post-categories/">full version</a>.</td>
</tr>
';
$output .= '<tr><td>&nbsp;</td><td><i>'.$save_message.'</i></td></tr>'."\n";
$output .= '<tr><td>&nbsp;</td><td><input class="button-primary" type="submit" name="merlic_filtercategory_save" value="'.__('Save Changes').'" /></td></tr>'."\n";
$output .= '</table>'."\n";
$output .= '</form>'."\n";
$output .= '<br /><h4>More plugins from the same author</h4>';
$output .= 'Please visit <a href="http://wordpress.phpanswer.com">Wordpress Plugins Store</a> for more plugins.';
$output .= '
</div>
';
echo $output;
}
/**
*
* @param object $page The page object
* @param array $categories The category objects
* @return string A list of checkboxes, one for each category
*/
private function draw_categories( $categories ) {
if (count($categories) > 0) {
foreach ($categories as $category) {
//get the allowed categories for this page that have been previously saved
$allowed_categories = get_option('merlic_filtercategory_allowed', true);
$allowed_categories_array = explode(',', $allowed_categories);
if (in_array($category->cat_ID, $allowed_categories_array)) $checked = 'checked = "checked"';
else
$checked = '';
//draw the checkbox
$checkboxes .= '<input type="checkbox" name="merlic_filtercategory_allowed[]" value="'.$category->cat_ID.'" '.$checked.'> '.$category->name.'<br/>';
}
}
return $checkboxes;
}
private function println( $text ) {
if (is_array($text) or is_object($text)) {
echo '<pre>';
print_r($text);
echo '</pre>';
}
else {
echo '<pre>';
echo $text;
echo '</pre>';
}
echo '<br />'."\n";
}
}
add_action('pre_get_posts', array('MerlicFilterCategoryLite', 'filter'), 1);
add_action('admin_menu', array('MerlicFilterCategoryLite', 'settings_menu'));
add_action('init', array('MerlicFilterCategoryLite', 'init'));
?>

View File

@ -0,0 +1,17 @@
Filter Posts in Pages allows you show posts that belong only to selected categories on your homepage and other categorie on other pages
Copyright (C) 2010 Cristian Merli
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 Street, Fifth Floor, Boston, MA 02110-1301, USA.

View File

@ -0,0 +1,35 @@
=== Frontpage category filter ===
Contributors: Cristian Merli
Donate link: http://wordpress.phpanswer.com/
Tags: post,category,filter,frontpage,homepage
Requires at least: 3.1
Tested up to: 3.1
Stable tag: 1.0.0
Allows you to show on your frontpage only posts from the categories that you select.
== Description ==
This plugin allows you to choose which post categories youe site will show on your frontpage. Just go to settings and deselect the categories that you want to hide. To display posts from other categories on other pages you need to upgrade to the <a href="http://wordpress.phpanswer.com/wp-filter-post-categories/">FULL version</a>.
== Installation ==
1. Upload `frontpage-category-filter.zip` from the plugin panel or unzip the file and upload the folder `frontpage-category-filter` to the `/wp-content/plugins/` directory
2. Activate the plugin through the `Plugins` panel in WordPress
3. Go to `Settings->Frontpage category filter` to choose the categories to show/hide from the frontpage
If you get errors or it does not work, check the `frontpage-category-filter` plugin folder permissions. They should be 755.
Plugin requires php 5.2
== Frequently Asked Questions ==
= How do i limit the number of posts to show? =
Like you did before. Go to `Settings->Reading` and modify `Blog pages show at most`
== Screenshots ==
http://wordpress.phpanswer.com/wpplugins/wp-filter-post-categories/
== Changelog ==
= 1.0.0 =
First stable release

View File

@ -81,7 +81,7 @@ Tags: multilingual, multi, language, admin, tinymce, qTranslate, Polyglot, bilin
// qTranslate Editor will only activated for the given version of Wordpress.
// Can be changed to use with other versions but might cause problems and/or data loss!
define('QT_SUPPORTED_WP_VERSION', '3.1.2');
define('QT_SUPPORTED_WP_VERSION', '3.1.3');
define('QT_STRING', 1);
define('QT_BOOLEAN', 2);
define('QT_INTEGER', 3);

View File

@ -1,4 +1,7 @@
/* Background */
* {
text-shadow: none !important;
}
body {
color: #807c79;
@ -144,9 +147,16 @@ a:hover {
background: none repeat scroll 0 0 rgba(255, 255, 255, 0.5);
}
#slides.slides .slide-content .slide-title {
color: #474747;
font-size: 30px;
color: #6E963D;
text-shadow: 0 1px 0 #fff;
}
#slides.slides .slide-content .slide-entry {
font-size: 20px;
color: #474747;
line-height: 1.3em;
}
#slide-navigator {
background: none repeat scroll 0 0 rgba(218, 229, 137, 0.6);
}
@ -399,7 +409,7 @@ body.gecko #slides.slides { margin-left: 0px; }
#slides.slides .slide-image { float: left; width: 480px; margin: 30px 0; }*/
.layout-left-content #slides.slides .slide-content,
.layout-right-content #slides.slides .slide-content {
width: 303px;
width: 303px;
}
.layout-left-content #slides.slides .slide-content {
float: right;
@ -502,6 +512,8 @@ body.admin-bar #scrolling-images.slides {
}
.entry img.alignleft.woo-image {
display: block;
}

View File

@ -3,9 +3,10 @@
$slides = array();
if ( is_home() || is_front_page() ) {
$slides = get_posts( 'suppress_filters=0&post_type=slide&showposts=' . $woo_options[ 'woo_slider_entries' ] );
}
$slides = get_posts( 'suppress_filters=0&post_type=slide&showposts=' . $woo_options[ 'woo_slider_entries' ] );
//$slides = get_posts(array('suppress_filters' => 0, 'post_type' => 'slide', 'category' => 0));
}
// Remove any slides that don't have images.
if ( ! empty( $slides ) ) {
foreach ( $slides as $k => $post ) {
@ -47,8 +48,7 @@
<div id="donate" class="col-full">
<?php
/* Main Slider
--------------------------------------------------*/
--------------------------------------------------*/
if ( ! empty( $slides ) ) {
$html = '';

View File

@ -184,7 +184,7 @@ function woo_add_slides()
'hierarchical' => false,
'menu_icon' => get_template_directory_uri() .'/functions/images/option-icon-slider.png',
'menu_position' => null,
'supports' => array('title','editor','thumbnail'/*'author','thumbnail','excerpt','comments'*/)
'supports' => array('title','editor'/*,'author','thumbnail','excerpt','comments'*/)
);
register_post_type('slide',$args);
}

View File

@ -19,37 +19,48 @@ Template Name: Image Gallery
<h1 class="title"><?php the_title(); ?></h1>
<div class="entry">
<?php
if ( have_posts() ) { the_post();
if ( have_posts() ) {
the_post();
the_content();
}
?>
<?php
$query = 'showposts=60&orderby=title&order=ASC';
<?php
$custom_fields = get_post_custom($post_id);
if (array_key_exists('id_category', $custom_fields)) {
$query .= '&cat=';
$query .= $custom_fields['id_category'][0];
$categories = get_categories(array('child_of' => $custom_fields['id_category'][0]));
} else {
$categories = get_categories();
}
query_posts( $query );
?>
<?php if ( have_posts() ) { while ( have_posts() ) { the_post(); ?>
<?php $wp_query->is_home = false; ?>
<?php woo_image( 'single=true&class=thumbnail alignleft' ); ?>
<?php
} // End WHILE Loop
} // End IF Statement
foreach ($categories as $category) {?>
<div class="entry">
<h2><?php echo $category->cat_name; ?></h2>
<?php
$query = 'showposts=60&orderby=title&order=ASC';
$query .= '&cat=' . $category->cat_ID;
query_posts( $query );
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
$wp_query->is_home = false;
woo_image( 'single=true&class=thumbnail alignleft' );
} // End WHILE Loop
?>
</div><!-- /.entry -->
<div class="fix"></div>
<?php
} // End IF Statement
} // End FOREACH Loop
?>
</div>
</div><!-- /.post -->
<div class="fix"></div>
</div><!-- /#main -->

View File

@ -743,12 +743,12 @@ function curl_write ($handle, $data) {
*/
function clean_source ($src) {
$host = str_replace ( 'www.', '', $_SERVER['HTTP_HOST']);
$host = str_replace ( 'www.', '', $_SERVER['HTTP_HOST']);
$regex = "/^(http(s|):\/\/)(www\.|)" . $host . "\//i";
$src = preg_replace ($regex, '', $src);
$src = strip_tags ($src);
$src = check_external ($src);
$src = check_external ($src);
// remove slash from start of string
if (strpos ($src, '/') === 0) {
@ -785,7 +785,7 @@ function clean_source ($src) {
* @return string
*/
function get_document_root ($src) {
// check for unix servers
if (file_exists ($_SERVER['DOCUMENT_ROOT'] . '/' . $src)) {
return $_SERVER['DOCUMENT_ROOT'];
@ -795,14 +795,14 @@ function get_document_root ($src) {
$parts = array_diff (explode ( '/', $_SERVER['SCRIPT_FILENAME']), explode ( '/', $_SERVER['DOCUMENT_ROOT']));
$path = $_SERVER['DOCUMENT_ROOT'];
foreach ($parts as $part) {
$path .= '/' . $part;
if (file_exists ($path . '/' . $src)) {
return $path;
}
}
// special check for microsoft servers
if (!isset ($_SERVER['DOCUMENT_ROOT'])) {
$path = str_replace ( "/", "\\", $_SERVER['ORIG_PATH_INFO']);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Some files were not shown because too many files have changed in this diff Show More