This is an old revision of the document!


Changes to functions and methods

With this page we want to help plugin developers to stay compatible with the changes that were made in the Admidio core and that could affect plugins. During the development of Admidio we try to not change our existing methods and functions but sometimes it's necessary and could break your working plugin. Here you will find a list of methods and functions that we changed in a specific Admidio version with a notice how you could fix this in your plugin if you have used that method or function.

New database class

Within Admidio 3.1 we changed the database class. This was necessary because PHP7 knocks at the door and in this PHP version our used database functions were no longer supported. So we have rewritten the whole class and now use the PHP class PDO for database access. This is a powerful class that will also allow us to integrate some more database engines in the future much easier. Admidio has a new well documented implementation of the his Database class. The Admidio database object $gDb is still available now with the new class. We also try to implement some compatibility methods for often used methods so there should be not much problems for existing code.

Some methods must be removed because they are no longer necessary or there is another (better) way to find a solution. Please check if you use some of them and find a way to replace them with the new methods.

  • $gDb→data_seek()
  • $gDb→fetch_assoc() - can be implemented with PdoStatement object
  • $gDb→field_name()
  • $gDb→free_result() - can be removed without new implementation
  • $gDb→num_fields()
  • $gDb→select_db() - can be removed without new implementation
  • $gDb→server_info()
  • $gDb→setCurrentDB() - can be removed without new implementation

Some methods are marked as deprecated. You can still use them but should switch to the new methods if there is time. Within our class documentation you will find hints how to implement the new methods:

  • $gDb→fetch_array()
  • $gDb→fetch_object()
  • $gDb→num_rows()
  • $gDb→insert_id()

New syntax in language files

Within this version we use a new format for our translation files. Before it was an Admidio specific xml format. Now its the Android String Resource. Version 3.1 will be still compatible to the old Admidio format but we encourage you to use the new format. There is also a small How to for plugin developers. We also changed the style of the placeholders within the strings. Please have a look at Multilingualism for a detailed description of the new syntax.

Changes to DatetimeExtended class

Since our requirements for PHP are changed to 5.3 we could use a lot of methods of the PHP class DateTime. Therefore we have removed methods from DatetimeExtended that were redundant. There are only 4 methods left:

  • isValid()
  • getAge()
  • getWeekdays($weekday = 0)
  • getDateFormatForDatepicker($format = 'Y-m-d')

If you have used other methods please change your script to use the official DateTime methods.

Other changes

The functions admFuncGetFilenameExtension and admFuncGetFilenameWithoutExtension are marked as deprecated and will be removed in future versions.

Changes/Deprecations

Every usage of a deprecated function/class/property now gets logged. So it is easy to see if you still use a deprecated feature.

Class TableUsers has been marked as deprecated. You should use the existing class Users. All methods of TableUsers have been moved to Users. The class TableUsers will be removed in future versions.

Method isWebmaster() of the class User is marked as deprecated and will be removed in future versions. Use method isAdministrator() instead.

The functions admFuncGetFilenameExtension and admFuncGetFilenameWithoutExtension were marked as deprecated in version 3.1 and are now removed in this version.

The config property $g_root_path is deprecated and replaced with new constant ADMIDIO_URL. There are some more new helpful constants defined:

Under construction. Not finished yet.

Bootstrapping

Simplified the bootstrapping (initialization of the common Admidio stuff). Most stuff got extracted in separate bootstrap.php. Autoload is in it's own autoload.php. Now it could be enough to require only the bootstrap.php if you don't need a database connection.

New

Constants
  • SCHEME: 'http' or 'https'
  • COOKIE_PREFIX: Unique prefix for cookies
  • DB_ENGINE: 'mysql' or 'pgsql'
  • DB_HOST: 'localhost' or '127.0.0.1'
  • DB_PORT: null or port number
  • DB_NAME: the database name
  • DB_USERNAME: the database user
  • DB_PASSWORD: the database user password
Classes
  • PhpIniUtils: Manages most of php-ini stuff
  • FileSystemUtils: Manages nearly all FileSystem stuff like copy, move, …
  • SettingsManager: Manages the organization settings

Changes/Deprecations

Classes
  • Folder: Use FileSystemUtils instead
  • MyFiles: Use FileSystemUtils instead
Class methods
  • Email→adminNotfication(): 'Email→adminNotification()'
  • Email::getMaxAttachementSize(): 'Email::getMaxAttachmentSize()'
  • Language→addLanguageData(): 'new Language()'
  • Language→addLanguagePath(): 'Language→addLanguageFolderPath()'
  • Language→getCountryByCode(): 'Language→getCountryName()'
  • Language→getCountryByName(): 'Language→getCountryIsoCode()'
  • LanguageData→addLanguagePath(): 'LanguageData→addLanguageFolderPath()'
  • LanguageData→getLanguagePaths(): 'LanguageData→getLanguageFolderPaths()'
  • LanguageData→getCountriesArray(): 'LanguageData→getCountries()'
  • LanguageData→setCountriesArray(): 'LanguageData→setCountries()'
  • Message→showInModaleWindow(): 'Message→showInModalWindow()'
  • Organization→getPreferences(): 'Organization→getSettingsManager()→getAll()'
  • Organization→setPreferences(): 'Organization→getSettingsManager()→setMulti()'
  • PhpIniUtils→isSafeModeEnabled(): no replacement
  • TableFile→getCompletePathOfFile(): 'TableFile→getFullFilePath()'
  • TableFolder→getCompletePathOfFolder(): 'TableFolder→getFolderPath()'
  • User→columnsValueChanged(): 'User→hasColumnsValueChanged()'
Class method params
  • new AdmException('MSG', 'PARAM1', 'PARAM2'): 'new AdmException('MSG', array('PARAM1', 'PARAM2'))'
  • AdmException→setNewMessage('ID', 'PARAM1', 'PARAM2'): 'AdmException→setNewMessage('ID', array('PARAM1', 'PARAM2'))'
  • Language→get('ID', 'PARAM1', 'PARAM2'): 'Language→get('ID', array('PARAM1', 'PARAM2'))'
  • Language→getLanguage(true): 'LanguageData::REFERENCE_LANGUAGE'
  • Language→getLanguageIsoCode(true): 'LanguageData::REFERENCE_LANGUAGE'
  • LanguageData→getLanguage(true): 'LanguageData::REFERENCE_LANGUAGE'
Functions
  • admFuncMaxUploadSize(): 'PhpIniUtils::getUploadMaxSize()'
  • admFuncGetBytesFromSize(): 'FileSystemUtils::getHumanReadableBytes()'
  • admReadTemplateFile(): 'FileSystemUtils::readFile()'
  • en/entwickler/changes_to_functions_and_methods.1518997688.txt.gz
  • Last modified: 2018/02/19 00:48
  • by ximex