Skip to content

Releases: gueff/myMVC

3.4.0

19 Nov 13:06
Compare
Choose a tag to compare

added

  • \MVC\Config::set_MVC_SESSION_NAMESPACE: allows setting session namespace via Config class, too - as it also writes back to Session object
  • The new 2nd parameter $oDTEventContext is now passed to executed Closures in Event::bind() which provides various information about the context of the event. Example:
    • Event::bind('foo.bar', function ($mPackage, DTEventContext $oDTEventContext){..});
      • $oDTEventContext->get_sEvent(): event name bonded to
      • $oDTEventContext->get_sEventOrigin(): original event name if bonded with a wildcard event name (e.g. foo.*)
      • $oDTEventContext->get_mRunPackage(): contains optional data passing by run; equal to parameter $mPackage
      • $oDTEventContext->get_aBonded(): array with bonded listeners to the current event
      • $oDTEventContext->get_sBondedBy(): key (of array $oDTEventContext->get_aBonded()) of concrete listener
      • $oDTEventContext->get_sCalledIn(): where was the event called (file, lineNumber)
      • $oDTEventContext->get_oCallback(): callback closure of concrete listener
      • $oDTEventContext->get_sCallbackDumped(): dumped (readable) callback closure of concrete listener
      • $oDTEventContext->get_sMessage(): message string with all details of the running event
  • functions
    • display(): shorthand for Debug::display() on userland
    • info(): shorthand for Debug::info() on userland
  • \MVC\Debug::info & \MVC\Debug::display: optional 2nd parameter $aDebugBacktrace
  • Datatype class application/library/MVC/DataType/DTEventContext.php for usage in Event Context
  • application/library/MVC/Generator/DataType.php: DataType Generation has new option createEvents (true|false): enable creation of events in datatype methods
  • config var
    • MVC_VIEW_TEMPLATE_DIR, \MVC\Config::get_MVC_VIEW_TEMPLATE_DIR: replacement for config var MVC_VIEW_TEMPLATES
    • MVC_EVENT_ENABLE_WILDCARD (true|false); default=true: allow declaring listeners with wildcard, e.g.: Event::bind('foo.bar.*', ... ); matches to event 'foo.bar.baz': Event::run('foo.bar.baz'); mandatory: asterisk * at the end (+ \MVC\Config::get_MVC_EVENT_ENABLE_WILDCARD, \MVC\Config::set_MVC_EVENT_ENABLE_WILDCARD); https://trello.com/c/K7mb4ooB
    • MVC_EVENT_LOG_RUN (true|false); default=false: logging each running event into MVC_LOG_FILE_EVENT (+ \MVC\Config::get_MVC_EVENT_LOG_RUN, \MVC\Config::set_MVC_EVENT_LOG_RUN)
  • \MVC\Event::listen: alternative writing to Event::bind()
  • \MVC\Event::getListeners: alternative writing to Event::getBonded()
  • \MVC\Event::getBonded: returns array with bonded Listeners of all Events (default), or of a certain event $sEvent
  • \MVC\Registry::delete: deletes a variable in registry
  • \MVC\Dir::recursiveCopy: copies a directory recursively
  • \MVC\Dir::isEmpty: checks if a directory is empty
  • \MVC\Dir::remove: removes a directory
  • \MVC\Dir::make: creates a directory
  • \MVC\Dir::exists: checks if a directory exists
  • application/library/MVC/DataType/DTKeyValue.php: events before/after in creator, getter and setter
  • config vars MVC_MODULE_PRIMARY_* for primary module
  • config var MVC_MODULE_PRIMARY_ESSENTIAL: if a module has the file it is a primary one
  • parameter types in methods
  • Frontend: public/site.webmanifest, various favicons
  • \MVC\Strings::isMarkup: checks whether a string contains markup
  • \MVC\Strings::ulli: creates a markup <ul>/<li> list on given data (string|array)
  • \MVC\Strings::cutOff: cuts off a string at given limit, appends a custom string if string to cut off is longer than limit, can purify broken markup string before return
  • \MVC\Strings::highlight_html: returns <code>-encapsulated, highlighted html markup
  • Smarty modifier
    • smarty_modifier_gtext: helps instantly translating Strings into other Languages using the PHP Extension gettext (usage: {'Frontend'|gtext:backend})
    • smarty_modifier_highlight_html: highlights html markup (usage: {'some text'|highlight_html})
    • smarty_modifier_parsedown: renders markdown to markup using parsedown (usage {'# title'|parsedown})
    • smarty_modifier_listArray: creates a markup <ul>/<li> list using \MVC\Strings::ulli (usage: {$aData|listArray})
  • a Warning is shown if there is more than one primary module

changed

  • \Emvicy\Emvicy::update: also tries now to update modules source code via git pull if available
  • function \whereis: returns always string and does not exit runtime; empty if nothing was found. Throws a warning level Exception if requested program was not found
  • a primary module needs to have the file .primary ion its root folder
  • secondary module configs are loaded first; primary module configs are loaded last (before load order was by module name)
  • config vars MVC_MODULE_CURRENT_* => MVC_MODULE_PRIMARY_*
  • config var MVC_LOG_FILE_FOLDER => MVC_LOG_FILE_DIR
  • config var MVC_MODULE_PRIMARY_NAME: auto taken from foldername of module
  • event mvc.view.renderString.before: value passed is $sTemplateString (before it was object DTArrayObject)
  • event mvc.view.renderString.after: value passed is $sRendered (before it was object DTArrayObject)
  • \MVC\Debug::info & \MVC\Debug::display: return a singleton instance of Debug, allows to chain different debug outputs. Example: Debug::display(__LINE__)::display(__DIR__)::info($GLOBALS['aConfig'])::stop();
  • \MVC\Config::get_MVC_SESSION_NAMESPACE: returns value from its global $aConfig as fallback
  • Session Behaviour: once a namespace is set via Session::is('foo') or Session::is()->setNamespace('foo') or \MVC\Config::set_MVC_SESSION_NAMESPACE('foo'), all further session operations are using that namespace until changed again
    • \MVC\Session::setNamespace: writes namespace back to Registry and also global $aConfig via new \MVC\Config::set_MVC_SESSION_NAMESPACE
    • \MVC\Session::kill: update also its config var Config::set_MVC_SESSION()
  • \MVC\Debug::info comes with syntax highlighting and style improvements
  • \MVC\Event::addToRegistry:
  • event mvc.controller.init.after: value passed is (bool) $bSuccess (before it was object DTArrayObject)
  • event mvc.controller.init.before: no value is passed (before it was an empty object DTArrayObject)
  • Events are passing given parameter
    • \MVC\Generator\DataType::createStaticCreator
    • \MVC\Generator\DataType::createConstructor
    • application/library/MVC/DataType/DTClass.php
    • application/library/MVC/DataType/DTConfig.php
    • application/library/MVC/DataType/DTConstant.php
    • application/library/MVC/DataType/DTFileinfo.php
    • application/library/MVC/DataType/DTProperty.php
    • application/library/MVC/DataType/DTRequestCurrent.php
    • application/library/MVC/DataType/DTRoute.php
    • application/library/MVC/DataType/DTArrayObject.php
    • application/init/skeleton/Module/DataType/DTRoutingAdditional.phtml
  • config var MVC_LOG_FORCE_LINEBREAK: its default value in skeleton is true
  • application/library/MVC/Generator/DataType.php: Events in getter passing classvar; https://trello.com/c/sDu24FdE
  • application/library/MVC/Generator/DataType.php: Events in setter passing parameter $mValue; https://trello.com/c/cKALAnVj
  • application/library/MVC/Generator/DataType.php rename '$aValue' => '$mValue'
  • InfoToolbar
    • \MVC\InfoTool::buildMarkupListTree: returns given $aData if not array
    • Event methods names, styling, highlighting at view templates
  • required libraries: "symfony/var-dumper": "@stable", "symfony/http-kernel": "@stable", "symfony/http-foundation": "@stable", "ext-ctype": "*","ext-curl": "*","ext-date": "*","ext-dom": "*","ext-fileinfo": "*","ext-filter": "*","ext-iconv": "*","ext-intl": "*","ext-json": "*","ext-libxml": "*","ext-mbstring": "*","ext-phar": "*","ext-posix": "*","ext-reflection": "*","ext-session": "*","ext-simplexml": "*","ext-spl": "*","ext-zip": "*","erusev/parsedown":"1.7.*"
  • Frontend
    • bootstrap: bootstrap-5.3.2-dist (was 4.6.2)
    • font awesome: fontawesome-free-6.4.2-web (was 4.7.0)
    • jquery: 3.7.1 (was 3.7.0)
    • favicon

deprecated

  • \MVC\Event::bind: 3rd parameter $oObject
  • \MVC\Config::get_MVC_VIEW_TEMPLATES
  • \Emvicy\Install::recursiveCopy
  • \MVC\Event::getEventArray
  • \MVC\Generator\DataType::createGetDataTypeConfigJSON

removed

  • config vars MVC_MODULE_CURRENT_*: replaced by config vars MVC_MODULE_PRIMARY_*
  • \MVC\DataType\DTArrayObject::getDataTypeConfigJSON
  • \MVC\DataType\DTKeyValue::getDataTypeConfigJSON
  • \MVC\DataType\DTConstant::getDataTypeConfigJSON
  • \MVC\DataType\DTConfig::getDataTypeConfigJSON
  • \MVC\DataType\DTClass::getDataTypeConfigJSON
  • \MVC\Generator\DataType::$iPhpVersion; https://trello.com/c/4uz9wNsf
  • /application/smartyPlugins/insert.myplugin.php
  • \MVC\Config::get_MVC_VIEW_TEMPLATES
  • $aConfig['MVC_VIEW_TEMPLATES']

fixed

  • various "problems" (unused Expressions, missing return types, missing statements)
  • application/library/MVC/DataType/DTRequestCurrent.php: wrong type for protected $path;

3.3.2

19 Nov 12:58
Compare
Choose a tag to compare

fixed

  • application/library/MVC/DataType/DTRequestCurrent.php: wrong type for protected $path;

3.3.1

21 Oct 11:20
Compare
Choose a tag to compare

added

  • application/init/skeleton/Module/_install.sh: update environment
  • \MVC\File::info includes mimetype info of file
  • \MVC\File::getMimeType returns mimetype of a given file
  • config var MVC_LOG_FORCE_LINEBREAK (\MVC\Config::get_MVC_LOG_FORCE_LINEBREAK, \MVC\Config::set_MVC_LOG_FORCE_LINEBREAK): force logging with linebreaks no matter what
  • in addition to =, php emvicy is excepting params also separated via :

fixed

  • application/init/skeleton/Module/_install.sh: wrong path to .env
  • php emvicy clearcache: deletion of non-empty folder fails on dotfiles
  • php emvicy.php update: suggests to update root if no composer.json found in module config folder

3.3.0

25 Jul 15:40
Compare
Choose a tag to compare

added

  • emvicy command: php emvicy.php version: prints myMVC version
  • emvicy command: php emvicy.php log id={id}: aggregates a unique log extract on STDOUT from all existing logfiles (*.log) on given logId
  • emvicy command: php emvicy.php update: updates myMVC Framework and its vendor installed libraries (requires: git installed)
  • optional 3rd parameter $bNewline for \MVC\Log::write: linebreak true|false; default=true
  • PSR4 autoloader
  • function whereis() returns absolute path to the requested linux binary if exists
  • function pr(), dumps data using print_r
  • Event mvc.event.init.after: this is now the earliest event to listen for
  • \MVC\Config::set_MVC_UNIQUE_ID
  • \MVC\Config::get_MVC_APPLICATION_INIT_DIR
  • config var MVC_LOG_FILE_EVENT: contains abs path to event logfile
  • config var MVC_LOG_FILE_POLICY: contains abs path to policy logfile
  • config MVC_LOG_DETAIL: control log details; (\MVC\Config::get_MVC_LOG_DETAIL, \MVC\Config::set_MVC_LOG_DETAIL)
  • auto-create /.env file if missing, setting MVC_ENV=develop
  • \MyMVCInstaller::checkOnModulesInstalled: checking on existing primary module installed
  • \MyMVCInstaller::getEnvironmentOfRequest: returns origin of requesting environment

changed

  • config var MVC_APPLICATION_CONFIG_DIR => MVC_APPLICATION_INIT_DIR
  • /application/config/ => /application/init/
  • php emvicy create: rename files from *.phtml to *.php using mv command (not using rename anymore)
  • Error|Event|Lock Logs come per default with no linebreaks (replaced by string \n)
  • when set a variable via Config class set_-method, also set its explicitely $GLOBALS equivalent (which is still PHP 8.1.0 ff. compatible)
  • \MVC\Request::setServerVarsForCli: fallback $_SERVER['REMOTE_ADDR'] set to 0.0.0.0
  • application/library/MVC/InfoTool.php: replaced mb_convert_encoding (deprecated) by mb_encode_numericentity
  • move /public/.env to /.env
  • refactored application/config/util/bootstrap.php
  • required: php >=8.0
  • MVC_UNIQUE_ID: now as combination of Ymd + uniqid()
  • infotool: more discreet error message
  • default template: link to online documentation; removed pseudo menu entries
  • public assets: jquery 3.7.0, bootstrap 4.6.2

removed

  • \MVC\Config::get_MVC_APPLICATION_CONFIG_DIR()
  • config var MVC_BIN_RENAME; \MVC\Config::get_MVC_BIN_RENAME()
  • using of linux rename function
  • phpFunctionsRequired utf8_decode
  • preloading MVC_CLASSES
  • PSR0 autoloader
  • Event mvc.event.init
  • \MVC\Request::sanitize
  • Event mvc.controller.construct.after
  • Event mvc.route.init
  • Event mvc.runTargetClassPreconstruct.after
  • myMVC.phar
  • \MVC\Event::getEventReport
  • \MVC\Event::unbind
  • Emvicy::whereis()
  • public assets: jquery 3.4.1, bootstrap 4.4.1

fixed

  • infoToolbar toggle width detection may be faulty
  • bootstrap.php, Line: 152, Message: Failed opening required 'Standard/Index.php' on sending a request via cli when there is no module
  • Event.php, Line: 48, Message: RecursiveDirectoryIterator::__construct(/event): Failed to open directory on sending a request via cli when there is no module
  • Policy.php, Line: 37, Message: RecursiveDirectoryIterator::__construct(/policy): Failed to open directory on sending a request via cli when there is no module
  • Route.php, Line: 41, Message: RecursiveDirectoryIterator::__construct(/routing): Failed to open directory on sending a request via cli when there is no module

3.2.9

29 Jun 12:28
Compare
Choose a tag to compare

added

  • emvicy.php: replacement for myMVC.phar

changed

  • \Event\Index::enableSession moved to \Model\Index::enableSession
  • application/library/MVC/Reflex.php: lead Error message to \MVC\Error::error
  • application/config/skeleton: Restructuring

deprecated

  • myMVC.phar

removed

  • myMVC.phar: utf8_encode
  • Event folder; when generating a new module via myMVC.phar

fixed

  • myMVC.phar: trim on null
  • smaller typo fixes

3.2.8

05 Jun 14:24
Compare
Choose a tag to compare

added

  • application/config/util/bootstrap.php: calling mvcConfigLoader() with parameter $aConfig.

fixed

  • application/library/MVC/Route.php: E_WARNING (2); Line: 343, 344; Message: Undefined array key X
  • missing array parameter at mvcConfigLoader() (application/config/util/functions.php)

3.2.7

31 May 11:29
Compare
Choose a tag to compare

added

  • new global functions mvcStoreEnv(), mvcConfigLoader()

changed

  • application/library/MVC/InfoTool.php: read MVC_ENV via gettenv()
  • application/config/util/bootstrap.php: using mvcStoreEnv(), mvcConfigLoader()

fixed

  • It can happen that with similarly structured routes which also contain variables, the correct route to the requested path is not determined.

3.2.6

17 May 08:59
Compare
Choose a tag to compare

added

  • \MVC\Strings::uuid4: returns a random uuid Version4 string

changed

  • php composer.phar self-update && php composer.phar update; Upgrading to version 2.5.5 (stable channel).
  • save errors type of E_WARNING, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING => warning.log
  • save errors type of E_NOTICE, E_USER_NOTICE, E_DEPRECATED, E_USER_DEPRECATED => notice.log

fixed

  • sTemplateRelative path may not be displayed in infotool

3.2.5

22 Apr 14:02
Compare
Choose a tag to compare

changed

  • smarty/smarty: v4.2.1 => 4.3.*
  • gueff/cachix: 1.0.1 => 1.0.2

3.2.4

15 Apr 13:21
Compare
Choose a tag to compare

added

  • \MVC\Event::delete: former method \MVC\Event::unbind is not accurate, because it does not unbind a closure to an event, but simply deletes the event.
  • \MVC\Controller::runTargetClassPreconstruct: Event mvc.controller.runTargetClassPreconstruct.after as replacement for mvc.runTargetClassPreconstruct.after
  • \MVC\Controller::init: Event mvc.controller.init.after as replacement for mvc.controller.construct.after
  • \MVC\Policy::apply: Event mvc.policy.apply.before: \MVC\Event::RUN('mvc.policy.apply.before', $aPolicy); containing Policies array due to current request
  • \MVC\Policy::unset: Event mvc.policy.unset.before: \MVC\Event::RUN('mvc.policy.unset.before', $aPolicy); containing Policies array read from Registry
  • \MVC\Policy::unset: Event mvc.policy.unset.after: \MVC\Event::RUN('mvc.policy.unset.after', $aPolicy); containing Policies array about to save back to Registry
  • \MVC\Policy::set: Event mvc.policy.set.before: \MVC\Event::RUN('mvc.policy.set.before', $aPolicy); containing Policies array read from Registry
  • \MVC\Policy::set: Event mvc.policy.set.after: \MVC\Event::RUN('mvc.policy.set.after', $aPolicy); containing Policies array about to save back to Registry
  • \MVC\Policy::init: Event mvc.policy.init.before
  • \MVC\Policy::init: Event mvc.policy.init.after
  • \MVC\DataType\DTArrayObject::flatten: returns a simple key/value array of key value pairs stored in current object. notice: it does only use "sKey" and "sValue" of the DTKeyValue Object
  • \MVC\Route::init: Event mvc.route.init.before
  • \MVC\Route::init: Event mvc.route.init.after

deprecated

  • \MVC\Event::unbind; use instead: \MVC\Event::delete
  • Event mvc.runTargetClassPreconstruct.after
  • Event mvc.runTargetClassPreconstruct.after
  • Event mvc.controller.construct.after
  • Event mvc.route.init

fixed

  • \MVC\Strings::seofy: german umlauts do not convert correctly (e.g. ü => ue). Fixed by adding transliterator_transliterate
  • \MVC\Minify.php: if different files got same content, only the first one found will be minified. Fixed by identify file not only by its content but also by its path.