Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Wordpress - ignore core, configuration, examples, uploads and logs.
# https://github.com/github/gitignore/blob/main/WordPress.gitignore

# Core
#
# Note: if you want to stage/commit WP core files
# you can delete this whole section/until Configuration.
/wp-admin/
/wp-content/index.php
/wp-content/languages
/wp-content/plugins/akismet
/wp-content/plugins/hello.php
/wp-content/plugins/index.php
/wp-content/themes/index.php
/wp-includes/
/index.php
/license.txt
/readme.html
/wp-*.php
/xmlrpc.php

# Configuration
wp-config.php

# docker
docker-compose.yml

# Example themes
/wp-content/themes/twenty*/

# Example plugin
/wp-content/plugins/hello.php

# Uploads
/wp-content/uploads/

# Log files
*.log

# htaccess
/.htaccess

# All plugins
#
# Note: If you wish to whitelist plugins,
# uncomment the next line
#/wp-content/plugins

# All themes
#
# Note: If you wish to whitelist themes,
# uncomment the next line
#/wp-content/themes
123 changes: 123 additions & 0 deletions Apiki.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"info": {
"_postman_id": "36fe6f32-50e4-408c-bc17-a4df3359024d",
"name": "Apiki",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "38156146"
},
"item": [
{
"name": "Login Teste APIKI",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Parseia a resposta como JSON",
"var jsonData = pm.response.json();",
"",
"// Verifica se o campo \"token\" existe na resposta",
"if (jsonData.token) {",
" // Define a variável global \"auth_token\" com o valor do token",
" pm.globals.set(\"auth_token\", jsonData.token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"user_login\": \"mateus\",\n \"user_password\": \"$fnzFI&w%H2PtUkjnQ\"\n}"
},
"url": {
"raw": "http://localhost:8000/wp-json/api/login",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"wp-json",
"api",
"login"
]
}
},
"response": []
},
{
"name": "Favoritar Post",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"post_id\": 1\n}"
},
"url": {
"raw": "http://localhost:8000/wp-json/api/favorite",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"wp-json",
"api",
"favorite"
]
}
},
"response": []
},
{
"name": "Logout Teste APIKI",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"user_login\": \"mateus\",\n \"user_password\": \"$fnzFI&w%H2PtUkjnQ\"\n}"
},
"url": {
"raw": "http://localhost:8000/wp-json/api/logoff",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"wp-json",
"api",
"logoff"
]
}
},
"response": []
}
]
}
Binary file added wp-content/.DS_Store
Binary file not shown.
Binary file added wp-content/plugins/.DS_Store
Binary file not shown.
Binary file added wp-content/plugins/mateus-avila-isidoro.zip
Binary file not shown.
123 changes: 123 additions & 0 deletions wp-content/plugins/mateus-avila-isidoro/Apiki.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"info": {
"_postman_id": "36fe6f32-50e4-408c-bc17-a4df3359024d",
"name": "Apiki",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "38156146"
},
"item": [
{
"name": "Login Teste APIKI",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Parseia a resposta como JSON",
"var jsonData = pm.response.json();",
"",
"// Verifica se o campo \"token\" existe na resposta",
"if (jsonData.token) {",
" // Define a variável global \"auth_token\" com o valor do token",
" pm.globals.set(\"auth_token\", jsonData.token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"user_login\": \"mateus\",\n \"user_password\": \"$fnzFI&w%H2PtUkjnQ\"\n}"
},
"url": {
"raw": "http://localhost:8000/wp-json/api/login",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"wp-json",
"api",
"login"
]
}
},
"response": []
},
{
"name": "Favoritar Post",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"post_id\": 1\n}"
},
"url": {
"raw": "http://localhost:8000/wp-json/api/favorite",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"wp-json",
"api",
"favorite"
]
}
},
"response": []
},
{
"name": "Logout Teste APIKI",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"user_login\": \"mateus\",\n \"user_password\": \"$fnzFI&w%H2PtUkjnQ\"\n}"
},
"url": {
"raw": "http://localhost:8000/wp-json/api/logoff",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"wp-json",
"api",
"logoff"
]
}
},
"response": []
}
]
}
48 changes: 48 additions & 0 deletions wp-content/plugins/mateus-avila-isidoro/classes/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Arquivo da classe InstallWordpressPlugin
*
* PHP version 8.3.7
*
* @category InstallWordpressPlugin
* @package Mateus Ávila Isidoro
* @author Mateus Ávila Isidoro <[email protected]>
* @license http://opensource.org/licenses/MIT MIT
* @link https://www.linkedin.com/in/mateusavilaisidoro
*/

namespace MateusAvila;

class InstallWordpressPlugin
{
public function __construct()
{
// Usa o hook correto para ativação
register_activation_hook( MAINDIR . '/mateus-avila-isidoro.php', [ 'MateusAvila\InstallWordpressPlugin', 'create_table' ] );
}

/**
* Create new table when the user activates the plugin
*
* @return void apenas cria o banco
*/
public static function create_table()
{
global $wpdb;
$table = $wpdb->prefix . "favorite";
$charset = $wpdb->get_charset_collate();

$sql = "CREATE TABLE IF NOT EXISTS $table (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
post_id BIGINT(20) NOT NULL,
user_id BIGINT(20) NOT NULL,
fav_date DATETIME NOT NULL,
PRIMARY KEY (id)
) $charset;";

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
}
}

$app = new InstallWordpressPlugin();
Loading