diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7bc444a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+nbproject/*
+src/nbproject/*
diff --git a/README b/README
old mode 100644
new mode 100755
diff --git a/bin/empty b/bin/empty
old mode 100644
new mode 100755
diff --git a/doc/empty b/doc/empty
old mode 100644
new mode 100755
diff --git a/src/destaque-home/destaque.php b/src/destaque-home/destaque.php
old mode 100644
new mode 100755
diff --git a/src/destaque-home/plugin-destaque-home.php b/src/destaque-home/plugin-destaque-home.php
old mode 100644
new mode 100755
diff --git a/src/destaque-home/sources/imagens/destaque-home.png b/src/destaque-home/sources/imagens/destaque-home.png
old mode 100644
new mode 100755
diff --git a/src/destaque-home/sources/imagens/plugin-icon.png b/src/destaque-home/sources/imagens/plugin-icon.png
old mode 100644
new mode 100755
diff --git a/src/destaque-home/sources/theme-pages/index.php b/src/destaque-home/sources/theme-pages/index.php
old mode 100644
new mode 100755
diff --git a/src/faq/changelog b/src/faq/changelog
old mode 100644
new mode 100755
index 39f00fd..f72a664
--- a/src/faq/changelog
+++ b/src/faq/changelog
@@ -6,6 +6,11 @@
/---------------------------------------------------------/
+
+2.0
+22/07/2013
+Refeito todo o plugin
+
1.0
04/10/2012
Criada a primeira versão do plugin
diff --git a/src/faq/nova-pergunta.php b/src/faq/nova-pergunta.php
old mode 100644
new mode 100755
index 9b188f8..b267628
--- a/src/faq/nova-pergunta.php
+++ b/src/faq/nova-pergunta.php
@@ -1,65 +1,80 @@
Bem vindo(a) ao cadastro de perguntas e respostas.';
$botao = 'Gravar';
-if(!empty($_GET['id_faq']) && is_numeric($_GET['id_faq']))
-{
- $cabecalho = '
Alterando Pergunta com ID '.(int)$_GET['id_faq'].'
';
+if (!empty($_GET['id_faq']) && is_numeric($_GET['id_faq'])) {
+ $cabecalho = 'Alterando Pergunta com ID ' . (int) $_GET['id_faq'] . '
';
$botao = 'Gravar alterações';
}
-$idFaq = isset($_GET['id_faq']) ? (int)$_GET['id_faq'] : '' ;
+$id_faq = isset($_GET['id_faq']) ? (int) $_GET['id_faq'] : '';
+$dados_faq = null;
-$Faq = new Faq();
+if ( !empty($id_faq) ) {
+ $dados_faq = get_post($id_faq);
+}
+
+if (isset($_POST['pergunta']) && !empty($_POST['pergunta']) && isset($_POST['solucao']) && !empty($_POST['pergunta'])) {
-$dadosFaq = $Faq->detalhesFaq($idFaq);
+ $post = array(
+ 'menu_order' => '0',
+ 'comment_status' => 'closed',
+ 'ping_status' => 'open',
+ 'post_author' => $current_user->ID,
+ 'post_content' => sanitize_text_field($_POST['solucao']),
+ 'post_excerpt' => substr(sanitize_text_field($_POST['solucao']), 0, 200),
+ 'post_name' => sanitize_title($_POST['pergunta']),
+ 'post_status' => 'publish',
+ 'post_title' => $_POST['pergunta'],
+ 'post_type' => 'faq',
+ );
-if(isset($_POST['solucao']) && isset($_POST['pergunta']))
-{
- $dadosFaq->pergunta = addslashes(isset($_POST['pergunta']) ? $_POST['pergunta'] : '');
- $dadosFaq->solucao = addslashes(isset($_POST['solucao']) ? $_POST['solucao'] : '');
- $dadosFaq->idFaq = addslashes(isset($_POST['id_faq']) ? $_POST['id_faq'] : '');
+ if ( isset($_POST['id_faq']) && !empty($_POST['id_faq']) ) {
+ $post['ID'] = (int) $_POST['id_faq'];
+ }
- if( $Faq->verificaExistenciaFaq($dadosFaq) )
- {
- echo "Dados do FAQ gravados com sucesso!
";
+ if ( wp_update_post($post) ) {
+ echo '';
}
- else
- {
- echo "Não foi possível salvar os dados do FAQ, por favor preencha os campos obrigatórios
";
+ if (wp_insert_post($post)) {
+ echo '';
}
+
}
?>
+
+
+
+
+ |
+
+
+
+
+
+
+ Pergunta
+
+
+
+ Solução
+
+
+
+
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/faq/perguntas.php b/src/faq/perguntas.php
old mode 100644
new mode 100755
index a254211..a28336d
--- a/src/faq/perguntas.php
+++ b/src/faq/perguntas.php
@@ -1,104 +1,48 @@
remover($idRemover) )
- {
- ?>
-
- alert("Faq removido com sucesso!"); window.location.href="?page=faq/perguntas.php";';
}
}
-$ordenacaoBusca->campo = 'id';
-$ordenacaoBusca->ordem = 'desc';
-
-if( $dadosFaq = $Faq->obterListaFaq($ordenacaoBusca) )
-{
-?>
+if ($dadosFaq = get_posts(array('post_type' => 'faq'))) : ?>
-Listando as Perguntas e respostas (FAQ) já cadastradas
-
+ Listando as Perguntas e respostas (FAQ) já cadastradas
+
-
-
-
- ID
- |
-
- Pergunta
- |
-
- Solução
- |
-
- Ações
- |
-
-
-
- imagem != '' )
- {
- $imagem = 'wp-content/uploads/faq/'.$dadosFaq->imagem;
- }
- ?>
+
+
+ Pergunta |
+ Solução |
+ Ações |
+
+
+
+
- id ; ?>
+ post_title; ?>
|
- pergunta ; ?>
+ post_content; ?>
|
- solucao ; ?>
+ Editar |
+ Remover
|
-
-
- Editar |
- Remover
- |
-
-
-
-
-No momento não há Perguntas e respostas (FAQ) cadastradas";
-}
-?>
-
+
+
+
+
+ No momento não há Perguntas e respostas (FAQ) cadastradas";
+ endif;
diff --git a/src/faq/plugin-faq.php b/src/faq/plugin-faq.php
old mode 100644
new mode 100755
index 3b1664b..772829c
--- a/src/faq/plugin-faq.php
+++ b/src/faq/plugin-faq.php
@@ -1,32 +1,62 @@
- true, 'label' => 'Faq');
+ register_post_type('faq', $args);
}
-// adding menu
-add_action('admin_menu', 'menuFAQ');
+add_action('init', 'codex_custom_init');
-include_once 'sources/schemas/default-schema-for-faq.php';
-$url = get_bloginfo('url');
-$themePath = str_replace($url,'..',get_bloginfo('template_url'));
-
-if(!file_exists($themePath.'/page-faq.php'))
+/**
+ * @#since 2.0
+ */
+function faq()
{
- @copy('../wp-content/plugins/faq/theme-pages/page-faq.php',$themePath.'/page-faq.php');
+ show_faq();
}
-?>
\ No newline at end of file
+add_shortcode('faq', 'faq');
+
+
+/**
+ * @since 2.0
+ */
+function show_faq()
+{
+ $faqs = get_posts(array('post_type' => 'faq', 'orderby' => 'post_date', 'order' => 'ASC'));
+
+ if (!empty($faqs)) :
+ ?>
+
+
+
+ Não há perguntas e respostas cadastradas
+
+
-$dadosFaq = $Faq->obterListaFaq();
+
-get_header(); ?>
-
-
-
-
Perguntas e respostas
-
-
-
-
-
-
pergunta); ?>
-
- solucao; ?>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+