-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed: moved start.php to Bootstrap and elgg-plugin.php
- Loading branch information
Showing
5 changed files
with
79 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace ColdTrick\TargetBlank; | ||
|
||
use Elgg\DefaultPluginBootstrap; | ||
|
||
class Bootstrap extends DefaultPluginBootstrap { | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function init() { | ||
elgg_require_js('target_blank/target_blank'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace ColdTrick\TargetBlank; | ||
|
||
class Javascript { | ||
|
||
/** | ||
* Add the link suffix to the global JS data | ||
* | ||
* @param \Elgg\Hook $hook 'elgg.data', 'page' | ||
* | ||
* @return array | ||
*/ | ||
public function setLinkSuffix(\Elgg\Hook $hook) { | ||
$result = $hook->getValue(); | ||
|
||
$result['target_blank']['link_suffix'] = elgg_get_plugin_setting('link_suffix', 'target_blank'); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace ColdTrick\TargetBlank; | ||
|
||
class PluginSettings { | ||
|
||
/** | ||
* Save the unfilterd input of the link suffix input | ||
* | ||
* @param \Elgg\Hook $hook 'setting', 'plugin' | ||
* | ||
* @return void|string | ||
*/ | ||
public static function saveLinkSuffix(\Elgg\Hook $hook) { | ||
if ($hook->getParam('plugin_id') !== 'target_blank') { | ||
return; | ||
} | ||
|
||
if ($hook->getParam('name') !== 'link_suffix') { | ||
return; | ||
} | ||
|
||
// get unfiltered input | ||
$params = (array) get_input('params', [], false); | ||
|
||
return elgg_extract('link_suffix', $params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters