-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repositorio criado e arquivos adicionados
- Loading branch information
0 parents
commit 2317bb9
Showing
5 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
global $meta_boxes_oquegd; | ||
$prefix = 'wp_oquegd_'; | ||
$meta_boxes_oquegd = array(); | ||
$meta_boxes_oquegd[] = array( | ||
'id' => $prefix.'info_geral', | ||
'title' => 'Informações Gerais', | ||
'pages' => array('oquegd_oque'), | ||
'context'=> 'normal', | ||
'priority'=> 'high', | ||
'fields' => array( | ||
array( | ||
'name' => 'Screenshots (plupload)', | ||
'desc' => 'Screenshots of problems, warnings, etc.', | ||
'id' => $prefix . 'screenshot2', | ||
'type' => 'plupload_image', | ||
'max_file_uploads' => 4, | ||
), | ||
array( | ||
'name' => 'Screenshots (thickbox upload)', | ||
'desc' => 'Screenshots of problems, warnings, etc.', | ||
'id' => $prefix . 'screenshot3', | ||
'type' => 'thickbox_image', | ||
) | ||
) | ||
); | ||
function wp_oquegd_register_meta_boxes() | ||
{ | ||
global $meta_boxes_oquegd; | ||
if ( class_exists( 'RW_Meta_Box' ) ) | ||
{ | ||
foreach ( $meta_boxes_oquegd as $meta_box ) | ||
{ | ||
new RW_Meta_Box( $meta_box ); | ||
} | ||
} | ||
} | ||
add_action('admin_init', 'wp_oquegd_register_meta_boxes' ); | ||
*/ | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
function wp_oquegd_oque() { | ||
$labels = array( | ||
'name' => _x( 'O que é?', 'oque' ), | ||
'singular_name' => _x( 'Documento', 'oque' ), | ||
'add_new' => _x( 'Novo Documento', 'oque' ), | ||
'all_items' => _x('Documentos', 'oque'), | ||
'add_new_item' => _x( 'Adicionar Novo Documento', 'oque' ), | ||
'edit_item' => _x( 'Editar Documento', 'oque' ), | ||
'new_item' => _x( 'Novo Documento', 'oque' ), | ||
'view_item' => _x( 'Visualizar Documento', 'oque' ), | ||
'search_items' => _x( 'Pesquisar Documento', 'oque' ), | ||
'not_found' => _x( 'Nenhum documento encontrado', 'oque' ), | ||
'not_found_in_trash' => _x( 'Nenhum documento encontrado na lixeira', 'oque' ), | ||
'parent_item_colon' => _x( 'Documento pai:', 'oque' ), | ||
'menu_name' => _x( 'O que é?', 'oque'), | ||
); | ||
$args = array( | ||
'labels' => $labels, | ||
'hierarchical' => false, | ||
'supports' => array( 'title', 'editor', 'author', 'comments', 'revisions'), | ||
'public' => true, | ||
'show_ui' => true, | ||
'show_in_menu' => true, | ||
'menu_position' => 80, | ||
'show_in_nav_menus' => true, | ||
'publicly_queryable' => true, | ||
'exclude_from_search' => false, | ||
'has_archive' => true, | ||
'query_var' => true, | ||
'can_export' => true, | ||
'rewrite' => true, | ||
'capability_type' => 'post' | ||
); | ||
register_post_type( 'oquegd_oque', $args ); | ||
} | ||
|
||
add_action( 'init', 'wp_oquegd_oque' ); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/* | ||
Plugin Name: WP O que e? GD | ||
Plugin URI: http://www.procergs.rs.gov.br | ||
Description: Plugin Wordpress O que e? GD, desenvolvido pela PROCERGS. | ||
Version: 1.0.0 | ||
Author: Cristiane | Felipe | Leo | ||
Author URI: http://www.procergs.rs.gov.br | ||
*/ | ||
|
||
/* Copyright 2012 | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License, version 2, as | ||
published by the Free Software Foundation. | ||
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 WPOqueGD{ | ||
|
||
public function ativar(){ | ||
add_option('wp_oquegd', ''); | ||
} | ||
public function desativar(){ | ||
delete_option('wp_oquegd'); | ||
} | ||
} | ||
|
||
$prefix = 'wp_oquegd_'; | ||
|
||
$pathPlugin = substr(strrchr(dirname(__FILE__),DIRECTORY_SEPARATOR),1).DIRECTORY_SEPARATOR.basename(__FILE__); | ||
|
||
// Função ativar | ||
register_activation_hook( $pathPlugin, array('WPOqueGD','ativar')); | ||
|
||
// Função desativar | ||
register_deactivation_hook( $pathPlugin, array('WPOqueGD','desativar')); | ||
|
||
include_once('wp-oquegd-custom_post.php'); | ||
include_once('wp-oquegd-custom_taxonomy.php'); | ||
include_once('wp-oquegd-custom_metabox.php'); | ||
include_once('wp-oquegd-widget.php'); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<?php | ||
|
||
class OqueListaWidget extends WP_Widget | ||
{ | ||
function OqueListaWidget() | ||
{ | ||
$widget_ops = array('classname' => 'OqueListaWidget', 'description' => 'O que é? Gabinete Digital. Lista de documentos O que é?' ); | ||
$this->WP_Widget('OqueListaWidget', 'Gabinete Digital - O que é?', $widget_ops); | ||
} | ||
|
||
function form($instance) | ||
{ | ||
$instance = wp_parse_args( (array) $instance, array( 'titulo' => '', 'colunas' => '3', 'qtd' => '5', 'css_class' => '' ) ); | ||
$titulo = $instance['titulo']; | ||
$colunas = $instance['colunas']; | ||
$qtd = $instance['qtd']; | ||
$css_class = $instance['css_class']; | ||
|
||
?> | ||
<p><label for="<?php echo $this->get_field_id('titulo'); ?>">Titulo: <input class="widefat" id="<?php echo $this->get_field_id('titulo'); ?>" name="<?php echo $this->get_field_name('titulo'); ?>" type="text" value="<?php echo attribute_escape($titulo); ?>" /></label></p> | ||
<p><label for="<?php echo $this->get_field_id('qtd'); ?>">Quantidade: <input class="widefat" id="<?php echo $this->get_field_id('qtd'); ?>" name="<?php echo $this->get_field_name('qtd'); ?>" type="text" value="<?php echo attribute_escape($qtd); ?>" /></label></p> | ||
<p><label for="<?php echo $this->get_field_id('colunas'); ?>">Colunas: <input class="widefat" id="<?php echo $this->get_field_id('colunas'); ?>" name="<?php echo $this->get_field_name('colunas'); ?>" type="text" value="<?php echo attribute_escape($colunas); ?>" /></label></p> | ||
<p><label for="<?php echo $this->get_field_id('css_class'); ?>">Classe CSS: <input class="widefat" id="<?php echo $this->get_field_id('css_class'); ?>" name="<?php echo $this->get_field_name('css_class'); ?>" type="text" value="<?php echo attribute_escape($css_class); ?>" /></label></p> | ||
<?php | ||
} | ||
|
||
function update($new_instance, $old_instance) | ||
{ | ||
$instance = $old_instance; | ||
$instance['titulo'] = $new_instance['titulo']; | ||
$instance['colunas'] = $new_instance['colunas']; | ||
$instance['qtd'] = $new_instance['qtd']; | ||
$instance['css_class'] = $new_instance['css_class']; | ||
return $instance; | ||
} | ||
|
||
function widget($args, $instance) | ||
{ | ||
extract($args, EXTR_SKIP); | ||
|
||
$args_query_post = ''; | ||
|
||
$titulo = empty($instance['titulo']) ? ' ' : apply_filters('widget_titulo', $instance['titulo']); | ||
$colunas = $instance['colunas']; | ||
$qtd = $instance['qtd']; | ||
$custom_post = 'oquegd_oque'; | ||
|
||
echo "<li class='span".$instance['colunas']."'><div class='thumbnail oque_lista ".$instance['css_class']."'>"; | ||
|
||
echo $before_title . $titulo . $after_title;; | ||
|
||
if (!empty($qtd)) | ||
$args_query_post = $args_query_post . "posts_per_page=" . $qtd; | ||
|
||
if (!empty($custom_post)) | ||
{ | ||
if ($args_query_post == '') | ||
$args_query_post = $args_query_post . "post_type=" . $custom_post; | ||
else | ||
$args_query_post = $args_query_post . "&post_type=" . $custom_post; | ||
} | ||
|
||
query_posts($args_query_post); | ||
if (have_posts()) : | ||
echo "<ul>"; | ||
while (have_posts()) : the_post(); | ||
echo "<li><a href='".get_permalink()."'>".get_the_title()."</a><br>" . get_the_excerpt(). "</li>"; | ||
|
||
endwhile; | ||
echo "</ul>"; | ||
endif; | ||
wp_reset_query(); | ||
|
||
echo "</div></li>"; | ||
} | ||
|
||
} | ||
add_action( 'widgets_init', create_function('', 'return register_widget("OqueListaWidget");') ); | ||
|
||
|
||
class OqueWidget extends WP_Widget | ||
{ | ||
function OqueWidget() | ||
{ | ||
$widget_ops = array('classname' => 'OqueWidget', 'description' => 'O que é? Gabinete Digital. Documento unico O que é?' ); | ||
$this->WP_Widget('OqueWidget', 'Gabinete Digital - O que é?', $widget_ops); | ||
} | ||
|
||
function form($instance) | ||
{ | ||
$instance = wp_parse_args( (array) $instance, array( 'titulo' => '', 'post_id' => '', 'colunas' => '3', 'css_class' => '' ) ); | ||
$titulo = $instance['titulo']; | ||
$post_id = $instance['post_id']; | ||
$colunas = $instance['colunas']; | ||
$css_class = $instance['css_class']; | ||
|
||
?> | ||
<p><label for="<?php echo $this->get_field_id('titulo'); ?>">Titulo: <input class="widefat" id="<?php echo $this->get_field_id('titulo'); ?>" name="<?php echo $this->get_field_name('titulo'); ?>" type="text" value="<?php echo attribute_escape($titulo); ?>" /></label></p> | ||
<p><label for="<?php echo $this->get_field_id('post_id'); ?>">ID: <input class="widefat" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo attribute_escape($post_id); ?>" /></label></p> | ||
<p><label for="<?php echo $this->get_field_id('colunas'); ?>">Colunas: <input class="widefat" id="<?php echo $this->get_field_id('colunas'); ?>" name="<?php echo $this->get_field_name('colunas'); ?>" type="text" value="<?php echo attribute_escape($colunas); ?>" /></label></p> | ||
<p><label for="<?php echo $this->get_field_id('css_class'); ?>">Classe CSS: <input class="widefat" id="<?php echo $this->get_field_id('css_class'); ?>" name="<?php echo $this->get_field_name('css_class'); ?>" type="text" value="<?php echo attribute_escape($css_class); ?>" /></label></p> | ||
<?php | ||
} | ||
|
||
function update($new_instance, $old_instance) | ||
{ | ||
$instance = $old_instance; | ||
$instance['titulo'] = $new_instance['titulo']; | ||
$instance['post_id'] = $new_instance['post_id']; | ||
$instance['colunas'] = $new_instance['colunas']; | ||
$instance['css_class'] = $new_instance['css_class']; | ||
return $instance; | ||
} | ||
|
||
function widget($args, $instance) | ||
{ | ||
extract($args, EXTR_SKIP); | ||
|
||
$args_query_post = ''; | ||
|
||
$titulo = empty($instance['titulo']) ? ' ' : apply_filters('widget_titulo', $instance['titulo']); | ||
$post_id = $instance['post_id']; | ||
$colunas = $instance['colunas']; | ||
$custom_post = 'oquegd_oque'; | ||
|
||
echo "<li class='span".$instance['colunas']."'><div class='thumbnail oque_lista ".$instance['css_class']."'>"; | ||
|
||
echo $before_title . $titulo . $after_title;; | ||
|
||
if (!empty($post_id)) | ||
$args_query_post = $args_query_post . "p=" . $post_id; | ||
|
||
if (!empty($custom_post)) | ||
{ | ||
if ($args_query_post == '') | ||
$args_query_post = $args_query_post . "post_type=" . $custom_post; | ||
else | ||
$args_query_post = $args_query_post . "&post_type=" . $custom_post; | ||
} | ||
|
||
query_posts($args_query_post); | ||
if (have_posts()) : | ||
echo "<ul>"; | ||
while (have_posts()) : the_post(); | ||
echo "<li><a href='".get_permalink()."'>".get_the_title()."</a><br>" . get_the_excerpt(). "</li>"; | ||
|
||
endwhile; | ||
echo "</ul>"; | ||
endif; | ||
wp_reset_query(); | ||
|
||
echo "</div></li>"; | ||
} | ||
|
||
} | ||
add_action( 'widgets_init', create_function('', 'return register_widget("OqueWidget");') ); | ||
|
||
|
||
?> |