Skip to content

Commit

Permalink
Merge pull request #9669 from jdalsem/undefined_variables
Browse files Browse the repository at this point in the history
Undefined variables
  • Loading branch information
jdalsem committed Apr 13, 2016
2 parents 09776fa + f345911 commit 8402486
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 21 deletions.
26 changes: 20 additions & 6 deletions engine/classes/Elgg/Debug/Inspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,22 @@ public function getActions() {
* @return array [views]
*/
public function getSimpleCache() {
global $CONFIG;

$tree = array();
foreach ($CONFIG->views->simplecache as $view => $foo) {
$tree[$view] = "";

$simplecache = elgg_extract('simplecache', $this->getViewsData(), []);
$locations = elgg_extract('locations', $this->getViewsData(), []);

$tree = [];
foreach ($simplecache as $view => $foo) {
$tree[$view] = '';
}

// add all static views
foreach ($locations as $viewtype) {
foreach ($viewtype as $view => $location) {
if (pathinfo($location, PATHINFO_EXTENSION) !== 'php') {
$tree[$view] = '';
}
}
}

ksort($tree);
Expand All @@ -189,7 +200,7 @@ public function getWebServices() {

$tree = array();
foreach ($API_METHODS as $method => $info) {
$params = implode(', ', array_keys($info['parameters']));
$params = implode(', ', array_keys(elgg_extract('parameters', $info, [])));
if (!$params) {
$params = 'none';
}
Expand Down Expand Up @@ -253,6 +264,9 @@ public function getMenus() {
// this does not work because you cannot set a guid on an entity
$params['entity'] = $widget;
break;
case 'longtext':
$params['id'] = rand();
break;
default:
break;
}
Expand Down
9 changes: 5 additions & 4 deletions engine/classes/Elgg/ViewsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public function __construct(\Elgg\PluginHooksService $hooks, \Elgg\Logger $logge

/**
* Takes a view name and returns the canonical name for that view.
*
*
* @param string $alias The possibly non-canonical view name.
*
*
* @return string The canonical view name.
*/
public function canonicalizeViewName(/*string*/ $alias) /*: string*/ {
Expand Down Expand Up @@ -189,7 +189,7 @@ private function findViewFile($view, $viewtype) {
* @param string $view Name of the view
* @param string $location Full path to the view file
* @param string $viewtype The viewtype to register this under
*
*
* @access private
*/
public function setViewDir($view, $location, $viewtype = '') {
Expand Down Expand Up @@ -360,7 +360,7 @@ private function handlePageSetup($view) {

/**
* Includes view PHP or static file
*
*
* @param string $view The view name
* @param array $vars Variables passed to view
* @param string $viewtype The viewtype
Expand Down Expand Up @@ -617,6 +617,7 @@ public function getInspectorData() {
'locations' => $this->locations,
'overrides' => $overrides,
'extensions' => $this->views->extensions,
'simplecache' => $this->views->simplecache,
];
}

Expand Down
7 changes: 6 additions & 1 deletion mod/ckeditor/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ function ckeditor_init() {

function ckeditor_longtext_menu($hook, $type, $items, $vars) {

$id = elgg_extract('id', $vars);
if ($id === null) {
return;
}

$items[] = ElggMenuItem::factory(array(
'name' => 'ckeditor_toggler',
'link_class' => 'ckeditor-toggle-editor elgg-longtext-control hidden',
'href' => "#{$vars['id']}",
'href' => "#{$id}",
'text' => elgg_echo('ckeditor:html'),
));

Expand Down
13 changes: 9 additions & 4 deletions mod/embed/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ function embed_longtext_menu($hook, $type, $items, $vars) {
if (elgg_get_context() == 'embed') {
return $items;
}

$id = elgg_extract('id', $vars);
if ($id === null) {
return;
}

$url = 'embed';

Expand Down Expand Up @@ -85,8 +90,8 @@ function embed_longtext_menu($hook, $type, $items, $vars) {
'href' => elgg_normalize_url($url),
]),
'text' => $text,
'rel' => "embed-lightbox-{$vars['id']}",
'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$vars['id']}",
'rel' => "embed-lightbox-{$id}",
'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$id}",
'priority' => 10,
));

Expand Down Expand Up @@ -136,7 +141,7 @@ function embed_page_handler($page) {
}
}

set_input('page', $page[1]);
set_input('page', $page[1]);

echo elgg_view('embed/layout');

Expand All @@ -147,7 +152,7 @@ function embed_page_handler($page) {
/**
* A special listing function for selectable content
*
* This calls a custom list view for entities.
* This calls a custom list view for entities.
*
* @param array $entities Array of ElggEntity objects
* @param array $vars Display parameters
Expand Down
6 changes: 3 additions & 3 deletions mod/pages/lib/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function pages_prepare_parent_breadcrumbs($page) {

/**
* Produce the navigation tree
*
*
* @param ElggEntity $container Container entity for the pages
*
* @return array
Expand Down Expand Up @@ -134,7 +134,7 @@ function pages_get_navigation_tree($container) {

/**
* Register the navigation menu
*
*
* @param ElggEntity $container Container entity for the pages
*/
function pages_register_navigation_tree($container) {
Expand All @@ -145,7 +145,7 @@ function pages_register_navigation_tree($container) {
'name' => $page['guid'],
'text' => $page['title'],
'href' => $page['url'],
'parent_name' => $page['parent_guid'],
'parent_name' => elgg_extract('parent_guid', $page),
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion views/default/forms/admin/site/advanced/caching.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$params['class'] = 'elgg-state-disabled';
$params['label_class'] = 'elgg-state-disabled';
}
$simple_cache_input .= elgg_view("input/checkbox", $params);
$simple_cache_input = elgg_view("input/checkbox", $params);
$simple_cache_warning = '';

if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) {
Expand Down
4 changes: 2 additions & 2 deletions views/default/input/checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* to make sure something is sent to the server. The default value is 0.
* If using JS, be specific to avoid selecting the hidden default value:
* $('input[type=checkbox][name=name]')
*
*
* @warning Passing integers as labels does not currently work due to a
* deprecated hack that will be removed in Elgg 1.9. To use integer labels,
* the labels must be character codes: 1 would be 1
Expand Down Expand Up @@ -68,7 +68,7 @@

// include a default value so if nothing is checked 0 will be passed.
if ($vars['name'] && $vars['default'] !== false) {
echo elgg_view('input/hidden', ['name' => $vars['name'], 'value' => $default]);
echo elgg_view('input/hidden', ['name' => $vars['name'], 'value' => $vars['default']]);
}

$checkboxes = '';
Expand Down

0 comments on commit 8402486

Please sign in to comment.