Skip to content

Commit

Permalink
Merge pull request #2 from mprins/scrutinizer-patch-1
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
mprins committed Sep 12, 2016
2 parents 4ff427a + 5fe9bc3 commit 0973603
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 28 deletions.
25 changes: 15 additions & 10 deletions action.php
Expand Up @@ -14,12 +14,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (!defined('DOKU_INC'))
die ();
if (!defined('DOKU_PLUGIN'))
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
if (!defined('DOKU_LF'))
define('DOKU_LF', "\n");
if (!defined('DOKU_INC')) {
die ();
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}
if (!defined('DOKU_LF')) {
define('DOKU_LF', "\n");
}
require_once (DOKU_PLUGIN . 'action.php');

/**
Expand Down Expand Up @@ -166,8 +169,9 @@ function handle_sitemap_generate_after(Doku_Event $event, $param) {
* not used
*/
function handle_action_act_preprocess(Doku_Event $event, $param) {
if ($event->data != 'findnearby')
return;
if ($event->data != 'findnearby') {
return;
}
$event->preventDefault();
}

Expand All @@ -181,8 +185,9 @@ function handle_action_act_preprocess(Doku_Event $event, $param) {
* 'format'=> HTML | JSON
*/
function _findnearby(Doku_Event & $event, $param) {
if ($event->data != 'findnearby')
return;
if ($event->data != 'findnearby') {
return;
}
$event->preventDefault();

global $INPUT;
Expand Down
6 changes: 4 additions & 2 deletions admin/purge.php
Expand Up @@ -14,10 +14,12 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (!defined('DOKU_INC'))
if (!defined('DOKU_INC')) {
die ();
if (!defined('DOKU_PLUGIN'))
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}
require_once DOKU_PLUGIN . 'admin.php';
/**
* DokuWiki Plugin spatialhelper (Admin Component).
Expand Down
21 changes: 14 additions & 7 deletions helper/index.php
Expand Up @@ -14,8 +14,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (!defined('DOKU_INC'))
if (!defined('DOKU_INC')) {
die ();
}

/**
* DokuWiki Plugin spatialhelper (index component).
Expand Down Expand Up @@ -75,8 +76,12 @@ function __construct() {
*/
function updateSpatialIndex($id) {
$geotags = p_get_metadata($id, 'geo');
if (empty ($geotags)) return false;
if (empty ($geotags ['lon']) || empty ($geotags ['lat'])) return false;
if (empty ($geotags)) {
return false;
}
if (empty ($geotags ['lon']) || empty ($geotags ['lat'])) {
return false;
}
// dbglog ( $geotags, "Geo metadata found for page $id" );
$geometry = new Point($geotags ['lon'], $geotags ['lat']);
$geohash = $geometry->out('geohash');
Expand Down Expand Up @@ -112,8 +117,9 @@ function findHashesForId($id, $index) {
function deleteFromIndex($id) {
// check the index for document
$knownHashes = $this->findHashesForId($id, $this->spatial_idx);
if (empty ($knownHashes))
return;
if (empty ($knownHashes)) {
return;
}

// TODO shortcut, need to make sure there is only one element, if not the index is corrupt
$knownHash = $knownHashes [0];
Expand Down Expand Up @@ -153,8 +159,9 @@ function generateSpatialIndex() {
$media = array();
search($media, $conf ['mediadir'], 'search_media', array());
foreach ($media as $medium) {
if ($medium ['isimg'])
$this->indexImage($medium);
if ($medium ['isimg']) {
$this->indexImage($medium);
}
}
return true;
}
Expand Down
6 changes: 4 additions & 2 deletions helper/search.php
Expand Up @@ -14,10 +14,12 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (!defined('DOKU_INC'))
if (!defined('DOKU_INC')) {
die ();
if (!defined('DOKU_PLUGIN'))
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}

/**
* DokuWiki Plugin spatialhelper (Search component).
Expand Down
9 changes: 6 additions & 3 deletions helper/sitemap.php
Expand Up @@ -14,12 +14,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (!defined('DOKU_INC'))
if (!defined('DOKU_INC')) {
die ();
if (!defined('DOKU_PLUGIN'))
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
if (!defined('DOKU_LF'))
}
if (!defined('DOKU_LF')) {
define('DOKU_LF', "\n");
}

/**
* DokuWiki Plugin spatialhelper (sitemap Component).
Expand Down
10 changes: 6 additions & 4 deletions syntax/findnearby.php
Expand Up @@ -14,10 +14,12 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
if (!defined('DOKU_INC'))
die ();
if (!defined('DOKU_PLUGIN'))
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
if (!defined('DOKU_INC')) {
die ();
}
if (!defined('DOKU_PLUGIN')) {
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
}
require_once (DOKU_PLUGIN . 'syntax.php');

/**
Expand Down

0 comments on commit 0973603

Please sign in to comment.