Changeset 2302481
- Timestamp:
- 05/11/2020 09:27:47 AM (6 years ago)
- Location:
- news-search-engine/trunk
- Files:
-
- 3 added
- 6 edited
-
assets/admin.js (modified) (1 diff)
-
assets/admin.min.css (added)
-
assets/admin.min.js (added)
-
includes/NewsSearchEngineAdmin.php (modified) (4 diffs)
-
includes/NewsSearchEngineModel.php (added)
-
includes/NewsSearchEngineRespose.php (modified) (4 diffs)
-
news-search-engine.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
views/admin-form.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
news-search-engine/trunk/assets/admin.js
r2279997 r2302481 82 82 } 83 83 84 85 84 var hideForm = function () { 86 85 -
news-search-engine/trunk/includes/NewsSearchEngineAdmin.php
r2280064 r2302481 3 3 4 4 class NewsSearchEngineAdmin { 5 6 private $model; 5 7 6 8 public function __construct(){ … … 12 14 add_action( 'admin_notices', array( $this, 'adminError' ) ); 13 15 } 16 17 $this->model = new NewsSearchEngineModel; 14 18 } 15 19 … … 64 68 // check if the post is comming from setting page 65 69 if(sanitize_text_field( $_POST['submit'] ) == 'Save Settings'){ 66 update_option( 'news-search-engine-api-key', sanitize_text_field( $_POST['news-search-engine-api-key'] ) ); 67 update_option( 'news-search-engine-default-page-size', sanitize_text_field( $_POST['news-search-engine-default-page-size'] ) ); 68 update_option( 'news-search-engine-http', sanitize_text_field( $_POST['news-search-engine-http'] ) ); 70 $this->model->setData($_POST); 69 71 70 72 // save api key 71 73 if($_POST['news-search-engine-api-key']){ 72 update_option( 'news-search-engine-settings-message','Settings saved.');74 $this->model->setMessage('Settings saved.'); 73 75 $this->adminRedirect(); 74 76 return true; 75 77 } 76 78 77 update_option( 'news-search-engine-settings-message','Please insert API key.');79 $this->model->setMessage('Please insert API key.'); 78 80 $this->adminRedirect(); 79 81 return false; … … 102 104 // import CSS and JS 103 105 public function adminStyle() { 104 wp_enqueue_script('news-search-engine-admin', PLUGIN_NSE_URL . 'assets/admin. js');105 wp_enqueue_style('news-search-engine-admin', PLUGIN_NSE_URL . 'assets/admin. css', array(), null, 'all' );106 wp_enqueue_script('news-search-engine-admin', PLUGIN_NSE_URL . 'assets/admin.min.js', array( 'jquery' ), '1.0.0', true ); 107 wp_enqueue_style('news-search-engine-admin', PLUGIN_NSE_URL . 'assets/admin.min.css', array(), null, 'all' ); 106 108 } 107 109 -
news-search-engine/trunk/includes/NewsSearchEngineRespose.php
r2279997 r2302481 8 8 private $APIData; 9 9 private $totalRow; 10 private $pagination; 10 11 11 12 // write the response and route the response to part of the class … … 13 14 14 15 if($response->status == 'ok'){ 15 if($response->sources) 16 if($response->sources){ 16 17 $this->prepareTable($response->sources); 17 18 $this->totalRow = count($response->sources); 18 if($response->articles){ 19 $this->pagination = false; 20 } 21 elseif($response->articles){ 19 22 $this->prepareTable($response->articles); 20 23 $this->totalRow = $response->totalResults; 24 $this->pagination = true; 21 25 } 22 26 return true; … … 82 86 public function display_table(){ 83 87 echo '<div class="wrap" id="table-result-wrap">'; 84 85 if($this->totalRow ){88 89 if($this->totalRow && $this->pagination){ 86 90 echo '<h3>Total Resutls ' . $this->totalRow . ' - Total Pages ' . (intval($this->totalRow / sanitize_text_field( $_POST['news-search-engine-page-size'] )) + 1 ). '</h3>'; 87 91 $this->display_pagination(); 92 } 93 elseif($this->totalRow){ 94 echo '<h3>Total Resutls ' . $this->totalRow . ' - Total Pages 1 </h3>'; 88 95 } 89 96 … … 91 98 $this->display(); 92 99 93 if($this->totalRow ){100 if($this->totalRow && $this->pagination){ 94 101 $this->display_pagination(); 95 102 } -
news-search-engine/trunk/news-search-engine.php
r2280050 r2302481 4 4 * Plugin URI: https://github.com/webmarcello8080/news-search-engine 5 5 * Description: News Search Engine is a Wordpress plugin that create a new section on the Wordpress Dashboard and it gives the possibility to search news through Google news API. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Requires at least: 4.5.13 8 8 * Requires PHP: 7.0 -
news-search-engine/trunk/readme.txt
r2280066 r2302481 80 80 == Changelog == 81 81 82 = 1.0.1 = 83 * JS and CSS minified 84 * bug fixed in pagination for source serach type 85 82 86 = 1.0.0 = 83 87 * Creating settings from -
news-search-engine/trunk/views/admin-form.php
r2279997 r2302481 179 179 // render output 180 180 if($response->renderResponse($result)){ 181 $response->prepare_items();182 181 $response->display_table(); 183 182 }
Note: See TracChangeset
for help on using the changeset viewer.