ver. 0.279: Newsletter frontend migration, Languages facade elimination, bug fix newsletter_unsubscribe
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,14 +53,21 @@ class Site
|
||||
if ( $category )
|
||||
return \front\view\ShopCategory::category_view( $category, $lang_id, \S::get( 'bs' ) );
|
||||
|
||||
// stare klasy
|
||||
$class = '\front\controls\\';
|
||||
|
||||
$results = explode( '_', \S::get( 'module' ) );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
$class .= ucfirst( $row );
|
||||
|
||||
// nowe kontrolery z DI
|
||||
$module = \S::get( 'module' );
|
||||
$action = \S::get( 'action' );
|
||||
$controllerFactories = self::getControllerFactories();
|
||||
|
||||
$moduleName = implode( '', array_map( 'ucfirst', explode( '_', $module ) ) );
|
||||
if ( isset( $controllerFactories[$moduleName] ) and $action )
|
||||
{
|
||||
$controller = $controllerFactories[$moduleName]();
|
||||
if ( method_exists( $controller, $action ) )
|
||||
return $controller->$action();
|
||||
}
|
||||
|
||||
// stare klasy
|
||||
$class = '\front\controls\\' . $moduleName;
|
||||
|
||||
if ( class_exists( $class ) and method_exists( new $class, $action ) )
|
||||
return call_user_func_array( array( $class, $action ), array() );
|
||||
@@ -132,5 +139,17 @@ class Site
|
||||
if ( file_exists( 'modules/actions.php' ) )
|
||||
include 'modules/actions.php';
|
||||
}
|
||||
|
||||
public static function getControllerFactories()
|
||||
{
|
||||
return [
|
||||
'Newsletter' => function() {
|
||||
global $mdb;
|
||||
return new \front\Controllers\NewsletterController(
|
||||
new \Domain\Newsletter\NewsletterRepository( $mdb )
|
||||
);
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user