Files
roi-theme/wp-content/plugins/wp-marketing-automations/includes/api/recipe/class-bwfan-api-get-recipes.php
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

42 lines
1004 B
PHP
Executable File

<?php
class BWFAN_API_Get_Recipes extends BWFAN_API_Base {
public static $ins;
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public $total_count = 0;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::READABLE;
$this->route = '/recipes';
}
public function default_args_values() {
$args = [];
return $args;
}
public function process_api_call() {
$recipe_sync = $this->get_sanitized_arg( 'sync' );
$all_recipes = BWFAN_Recipe_Loader::get_recipes_array( $recipe_sync == 'true' ? true : false );
$this->response_code = 200;
$this->total_count = is_array( $all_recipes ) ? count( $all_recipes ) : 0;
return $this->success_response( $all_recipes, __( 'Recipes found', 'wp-marketing-automations' ) );
}
public function get_result_total_count() {
return $this->total_count;
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Get_Recipes' );