Skip to content

Commit

Permalink
#11: Initial 'true' plugin implementation
Browse files Browse the repository at this point in the history
... still need documentation updates!
  • Loading branch information
lat9 committed Feb 10, 2019
1 parent 7ceb820 commit 6d74e7c
Show file tree
Hide file tree
Showing 14 changed files with 1,032 additions and 266 deletions.
25 changes: 15 additions & 10 deletions YOUR_ADMIN/includes/auto_loaders/config.usu.php
@@ -1,7 +1,8 @@
<?php
/**
* Part of Ultimate URLs for Zen Cart.
* Part of Ultimate URLs for Zen Cart, v3.0.0+.
*
* @copyright Copyright 2019 Cindy Merkin (vinosdefrutastropicales.com)
* @copyright Copyright 2013 - 2015 Andrew Ballanger
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL V3.0
*/
Expand All @@ -10,14 +11,18 @@
die('Illegal Access');
}

$autoLoadConfig[0][] = array(
'autoType'=>'class',
'loadFile'=>'usu.php'
$autoLoadConfig[200][] = array(
'autoType' => 'init_script',
'loadFile' => 'init_usu_admin.php'
);

// must be 110 since 100 is where messageStack is instantiated
$autoLoadConfig[120][] = array(
'autoType'=>'classInstantiate',
'className'=>'usu',
'objectName'=>'altURLs'

$autoLoadConfig[200][] = array(
'autoType' => 'class',
'loadFile' => 'observers/UsuAdminObserver.php',
'classPath' => DIR_WS_CLASSES
);
$autoLoadConfig[200][] = array(
'autoType' => 'classInstantiate',
'className' => 'UsuAdminObserver',
'objectName' => 'usuAdmin'
);
56 changes: 56 additions & 0 deletions YOUR_ADMIN/includes/classes/observers/UsuAdminObserver.php
@@ -0,0 +1,56 @@
<?php
/**
* Part of Ultimate URLs for Zen Cart.
*
* @copyright Copyright 2019 Cindy Merkin (vinosdefrutastropicales.com)
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL V3.0
*/
if (!defined('IS_ADMIN_FLAG') || IS_ADMIN_FLAG !== true) {
die('Illegal Access');
}

class UsuAdminObserver extends base
{
public function __construct()
{
$this->enabled = (defined('USU_ENABLED') && USU_ENABLED == 'true');
if ($this->enabled) {
$this->attach (
$this,
array(
/* From /admin/includes/functions/html_output.php */
'NOTIFY_SEFU_INTERCEPT_ADMCATHREF',
)
);

if (!class_exists('usu')) {
require DIR_FS_CATALOG . DIR_WS_CLASSES . 'usu.php';
}
$this->usu = new usu();
}
}

public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5, &$p6, &$p7, &$p8)
{
switch ($eventID) {
// -----
// Issued at the top of the zen_catalog_href_link function to allow us to override the href-link
// returned.
//
// On entry:
//
// $p1 ... n/a
// $p2 ... A reference to the to-be-returned $link; set this to a non-null value to override.
// $p3 ... A reference to the page associated with the to-be-generated link
// $p4 ... A reference to the parameters associated with the to-be-generated link
// $p5 ... A reference to the (input) connection type (either 'SSL' or 'NONSSL') to be used for the link
//
case 'NOTIFY_SEFU_INTERCEPT_ADMCATHREF':
$p2 = $this->usu->href_link($p3, $p4, $p5);
break;

default:
break;
}
}
}
6 changes: 4 additions & 2 deletions YOUR_ADMIN/includes/extra_datafiles/usu.php
@@ -1,9 +1,11 @@
<?php
/**
* Part of Ultimate URLs for Zen Cart.
* Part of Ultimate URLs for Zen Cart, v3.0.0+.
*
* @copyright Copyright 2019 Cindy Merkin (vinosdefrutastropicales.com)
* @copyright Copyright 2013 - 2015 Andrew Ballanger
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL V3.0
*/

define('TABLE_USU_CACHE', DB_PREFIX . 'usu_cache');

define('FILENAME_USU_UNINSTALL', 'usu_uninstall');

0 comments on commit 6d74e7c

Please sign in to comment.