Skip to content

Commit

Permalink
fix bugs with admin
Browse files Browse the repository at this point in the history
  • Loading branch information
parisholley committed Apr 27, 2016
1 parent 321a99a commit 4529a68
Show file tree
Hide file tree
Showing 25 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion docs/class-elasticsearch.Config.html
Expand Up @@ -102,7 +102,7 @@ <h1>Class Config</h1>
<b>Author:</b>
Paris Holley <a href="&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;">&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;</a><br>
<b>Version:</b>
4.0.0<br>
4.0.1<br>
<b>Located at</b> <a href="source-class-elasticsearch.Config.html#4-192" title="Go to source code">Config.php</a>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/class-elasticsearch.Defaults.html
Expand Up @@ -102,7 +102,7 @@ <h1>Class Defaults</h1>
<b>Author:</b>
Paris Holley <a href="&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;">&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;</a><br>
<b>Version:</b>
4.0.0<br>
4.0.1<br>
<b>Located at</b> <a href="source-class-elasticsearch.Defaults.html#4-77" title="Go to source code">Defaults.php</a>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/class-elasticsearch.Faceting.html
Expand Up @@ -102,7 +102,7 @@ <h1>Class Faceting</h1>
<b>Author:</b>
Paris Holley <a href="&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;">&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;</a><br>
<b>Version:</b>
4.0.0<br>
4.0.1<br>
<b>Located at</b> <a href="source-class-elasticsearch.Faceting.html#4-383" title="Go to source code">Faceting.php</a>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/class-elasticsearch.Indexer.html
Expand Up @@ -102,7 +102,7 @@ <h1>Class Indexer</h1>
<b>Author:</b>
Paris Holley <a href="&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;">&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;</a><br>
<b>Version:</b>
4.0.0<br>
4.0.1<br>
<b>Located at</b> <a href="source-class-elasticsearch.Indexer.html#4-357" title="Go to source code">Indexer.php</a>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/class-elasticsearch.Searcher.html
Expand Up @@ -102,7 +102,7 @@ <h1>Class Searcher</h1>
<b>Author:</b>
Paris Holley <a href="&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;">&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;</a><br>
<b>Version:</b>
4.0.0<br>
4.0.1<br>
<b>Located at</b> <a href="source-class-elasticsearch.Searcher.html#4-338" title="Go to source code">Searcher.php</a>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/class-elasticsearch.Theme.html
Expand Up @@ -102,7 +102,7 @@ <h1>Class Theme</h1>
<b>Author:</b>
Paris Holley <a href="&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;">&#x6d;&#97;&#x69;&#x6c;&#64;&#x70;a&#114;&#x69;&#115;&#104;&#x6f;&#108;&#x6c;&#x65;&#121;&#x2e;&#x63;&#111;&#x6d;</a><br>
<b>Version:</b>
4.0.0<br>
4.0.1<br>
<b>Located at</b> <a href="source-class-elasticsearch.Theme.html#4-53" title="Go to source code">Theme.php</a>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/source-class-elasticsearch.Config.html
Expand Up @@ -83,7 +83,7 @@ <h3>Classes</h3>
</span></span><span id="6" class="l"><a href="#6"> 6: </a><span class="php-comment">*
</span></span><span id="7" class="l"><a href="#7"> 7: </a><span class="php-comment">* @license http://opensource.org/licenses/MIT
</span></span><span id="8" class="l"><a href="#8"> 8: </a><span class="php-comment">* @author Paris Holley &lt;mail@parisholley.com&gt;
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.0
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.1
</span></span><span id="10" class="l"><a href="#10"> 10: </a><span class="php-comment">**/</span>
</span><span id="11" class="l"><a href="#11"> 11: </a><span class="php-keyword1">class</span> Config{
</span><span id="12" class="l"><a href="#12"> 12: </a> <span class="php-keyword1">static</span> <span class="php-var">$options</span> = <span class="php-keyword1">null</span>;
Expand Down
2 changes: 1 addition & 1 deletion docs/source-class-elasticsearch.Defaults.html
Expand Up @@ -83,7 +83,7 @@ <h3>Classes</h3>
</span></span><span id="6" class="l"><a href="#6"> 6: </a><span class="php-comment">*
</span></span><span id="7" class="l"><a href="#7"> 7: </a><span class="php-comment">* @license http://opensource.org/licenses/MIT
</span></span><span id="8" class="l"><a href="#8"> 8: </a><span class="php-comment">* @author Paris Holley &lt;mail@parisholley.com&gt;
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.0
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.1
</span></span><span id="10" class="l"><a href="#10">10: </a><span class="php-comment">**/</span>
</span><span id="11" class="l"><a href="#11">11: </a><span class="php-keyword1">class</span> Defaults{
</span><span id="12" class="l"><a href="#12">12: </a> <span class="php-comment">/**
Expand Down
2 changes: 1 addition & 1 deletion docs/source-class-elasticsearch.Faceting.html
Expand Up @@ -83,7 +83,7 @@ <h3>Classes</h3>
</span></span><span id="6" class="l"><a href="#6"> 6: </a><span class="php-comment">*
</span></span><span id="7" class="l"><a href="#7"> 7: </a><span class="php-comment">* @license http://opensource.org/licenses/MIT
</span></span><span id="8" class="l"><a href="#8"> 8: </a><span class="php-comment">* @author Paris Holley &lt;mail@parisholley.com&gt;
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.0
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.1
</span></span><span id="10" class="l"><a href="#10"> 10: </a><span class="php-comment">**/</span>
</span><span id="11" class="l"><a href="#11"> 11: </a><span class="php-keyword1">class</span> Faceting{
</span><span id="12" class="l"><a href="#12"> 12: </a> <span class="php-comment">/**
Expand Down
2 changes: 1 addition & 1 deletion docs/source-class-elasticsearch.Indexer.html
Expand Up @@ -83,7 +83,7 @@ <h3>Classes</h3>
</span></span><span id="6" class="l"><a href="#6"> 6: </a><span class="php-comment"> *
</span></span><span id="7" class="l"><a href="#7"> 7: </a><span class="php-comment"> * @license http://opensource.org/licenses/MIT
</span></span><span id="8" class="l"><a href="#8"> 8: </a><span class="php-comment"> * @author Paris Holley &lt;mail@parisholley.com&gt;
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment"> * @version 4.0.0
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment"> * @version 4.0.1
</span></span><span id="10" class="l"><a href="#10"> 10: </a><span class="php-comment"> **/</span>
</span><span id="11" class="l"><a href="#11"> 11: </a><span class="php-keyword1">class</span> Indexer
</span><span id="12" class="l"><a href="#12"> 12: </a>{
Expand Down
2 changes: 1 addition & 1 deletion docs/source-class-elasticsearch.Searcher.html
Expand Up @@ -83,7 +83,7 @@ <h3>Classes</h3>
</span></span><span id="6" class="l"><a href="#6"> 6: </a><span class="php-comment"> *
</span></span><span id="7" class="l"><a href="#7"> 7: </a><span class="php-comment"> * @license http://opensource.org/licenses/MIT
</span></span><span id="8" class="l"><a href="#8"> 8: </a><span class="php-comment"> * @author Paris Holley &lt;mail@parisholley.com&gt;
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment"> * @version 4.0.0
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment"> * @version 4.0.1
</span></span><span id="10" class="l"><a href="#10"> 10: </a><span class="php-comment"> **/</span>
</span><span id="11" class="l"><a href="#11"> 11: </a><span class="php-keyword1">class</span> Searcher
</span><span id="12" class="l"><a href="#12"> 12: </a>{
Expand Down
2 changes: 1 addition & 1 deletion docs/source-class-elasticsearch.Theme.html
Expand Up @@ -83,7 +83,7 @@ <h3>Classes</h3>
</span></span><span id="6" class="l"><a href="#6"> 6: </a><span class="php-comment">*
</span></span><span id="7" class="l"><a href="#7"> 7: </a><span class="php-comment">* @license http://opensource.org/licenses/MIT
</span></span><span id="8" class="l"><a href="#8"> 8: </a><span class="php-comment">* @author Paris Holley &lt;mail@parisholley.com&gt;
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.0
</span></span><span id="9" class="l"><a href="#9"> 9: </a><span class="php-comment">* @version 4.0.1
</span></span><span id="10" class="l"><a href="#10">10: </a><span class="php-comment">**/</span>
</span><span id="11" class="l"><a href="#11">11: </a><span class="php-keyword1">class</span> Theme{
</span><span id="12" class="l"><a href="#12">12: </a> <span class="php-keyword1">private</span> <span class="php-keyword1">static</span> <span class="php-var">$selector</span>;
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch.php
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Fantastic ElasticSearch
Plugin URI: http://wordpress.org/extend/plugins/fantastic-elasticsearch/
Description: Improve wordpress search performance and accuracy by leveraging an ElasticSearch server.
Version: 4.0.0
Version: 4.0.1
Author: Paris Holley
Author URI: http://www.linkedin.com/in/parisholley
Author Email: mail@parisholley.com
Expand Down
4 changes: 2 additions & 2 deletions precommit.sh
@@ -1,4 +1,4 @@
VERSION=4\\.0\\.0
VERSION=4\\.0\\.1

echo "-- Updating dependencies"

Expand All @@ -23,7 +23,7 @@ if [ $? -eq 0 ]; then

docker run -v $(pwd):/app herloct/php-apigen generate -s /app/src/elasticsearch/ -d /app/docs

echo "-- It is safe to commit! Make sure to commit the docs directory first."
echo "-- It is safe to push."
else
echo "-- THE TESTS FAILED, DO NOT COMMIT!"
fi
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch/Config.php
Expand Up @@ -6,7 +6,7 @@
*
* @license http://opensource.org/licenses/MIT
* @author Paris Holley <mail@parisholley.com>
* @version 4.0.0
* @version 4.0.1
**/
class Config{
static $options = null;
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch/Defaults.php
Expand Up @@ -6,7 +6,7 @@
*
* @license http://opensource.org/licenses/MIT
* @author Paris Holley <mail@parisholley.com>
* @version 4.0.0
* @version 4.0.1
**/
class Defaults{
/**
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch/Faceting.php
Expand Up @@ -6,7 +6,7 @@
*
* @license http://opensource.org/licenses/MIT
* @author Paris Holley <mail@parisholley.com>
* @version 4.0.0
* @version 4.0.1
**/
class Faceting{
/**
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch/Indexer.php
Expand Up @@ -6,7 +6,7 @@
*
* @license http://opensource.org/licenses/MIT
* @author Paris Holley <mail@parisholley.com>
* @version 4.0.0
* @version 4.0.1
**/
class Indexer
{
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch/Searcher.php
Expand Up @@ -6,7 +6,7 @@
*
* @license http://opensource.org/licenses/MIT
* @author Paris Holley <mail@parisholley.com>
* @version 4.0.0
* @version 4.0.1
**/
class Searcher
{
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch/Theme.php
Expand Up @@ -6,7 +6,7 @@
*
* @license http://opensource.org/licenses/MIT
* @author Paris Holley <mail@parisholley.com>
* @version 4.0.0
* @version 4.0.1
**/
class Theme{
private static $selector;
Expand Down
4 changes: 4 additions & 0 deletions tests/unit-tests/bootstrap.php
Expand Up @@ -88,6 +88,10 @@ function checked(){
return false;
}

function add_option(){

}

function add_settings_field($arg1, $arg2, $callback, $arg4, $arg5, $field){
return call_user_func_array($callback, array($field));
}
Expand Down
13 changes: 13 additions & 0 deletions wp/admin/hooks.php
Expand Up @@ -5,6 +5,7 @@ class Hooks
{
function __construct()
{
add_action('wp_ajax_esreindex', array(&$this, 'reindex'));
add_action('save_post', array(&$this, 'save_post'));
add_action('delete_post', array(&$this, 'delete_post'));
add_action('trash_post', array(&$this, 'delete_post'));
Expand Down Expand Up @@ -51,6 +52,18 @@ function delete_post($post_id)

Indexer::delete($post);
}

function reindex(){
try{
echo Indexer::reindex($_POST['page']);
}catch(\Exception $ex){
header("HTTP/1.0 500 Internal Server Error");

echo $ex->getMessage();
}

die();
}
}

new Hooks();
Expand Down
12 changes: 0 additions & 12 deletions wp/admin/sections/manage-index.php
@@ -1,18 +1,6 @@
<?php
namespace elasticsearch;

add_action('wp_ajax_esreindex', function(){
try{
echo Indexer::reindex($_POST['page']);
}catch(\Exception $ex){
header("HTTP/1.0 500 Internal Server Error");

echo $ex->getMessage();
}

die();
});

add_action('admin_head-toplevel_page_elastic_search', function(){
wp_enqueue_script('es-indexing', plugins_url( '/manage-index.js', __FILE__ ), array('jquery'));

Expand Down
2 changes: 1 addition & 1 deletion wp/admin/sections/server-settings.php
Expand Up @@ -16,7 +16,7 @@
try{
$index = $client->getIndex($new['server_index']);

$status = $index->getStatus()->getResponse()->getData();
$status = $index->getStats()->getData();
} catch(\Elastica\Exception\ResponseException $ex){
// This kind usually means there was an issue with the index not existing, so we'll associate the message to that field.
$field = $NHP_Options->sections['server']['fields']['server_index'];
Expand Down
4 changes: 2 additions & 2 deletions wp/lib/nhp/options/options.php
Expand Up @@ -75,10 +75,10 @@ function __construct($sections = array(), $args = array(), $extra_tabs = array()
$this->extra_tabs = apply_filters('nhp-opts-extra-tabs-'.$this->args['opt_name'], $extra_tabs);

//set option with defaults
add_action('init', array(&$this, '_set_default_options'));
$this->_set_default_options();

//options page
add_action('admin_menu', array(&$this, '_options_page'));
$this->_options_page();

//register setting
add_action('admin_init', array(&$this, '_register_setting'));
Expand Down

0 comments on commit 4529a68

Please sign in to comment.