* * Copyright 2013-2015 by Thomas Jakobi <*****@*****.**> * * @package ajaxupload * @subpackage snippet */ $ajaxuploadCorePath = $modx->getOption('ajaxupload.core_path', null, $modx->getOption('core_path') . 'components/ajaxupload/'); $ajaxuploadAssetsPath = $modx->getOption('ajaxupload.assets_path', null, $modx->getOption('assets_path') . 'components/ajaxupload/'); $ajaxuploadAssetsUrl = $modx->getOption('ajaxupload.assets_url', null, $modx->getOption('assets_url') . 'components/ajaxupload/'); $debug = $modx->getOption('debug', $scriptProperties, $modx->getOption('ajaxupload.debug', null, false)); if (!$modx->loadClass('AjaxUpload', $ajaxuploadCorePath . 'model/ajaxupload/', true, true)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not load AjaxUpload class.', '', 'AjaxUpload'); if ($debug) { return 'Could not load AjaxUpload class.'; } else { return ''; } } $scriptProperties['ajaxupload.core_path'] = $ajaxuploadCorePath; $scriptProperties['ajaxupload.assets_path'] = $ajaxuploadAssetsPath; $scriptProperties['ajaxupload.assets_url'] = $ajaxuploadAssetsUrl; $ajaxUpload = new AjaxUpload($modx, $scriptProperties); if (!$ajaxUpload->initialize($scriptProperties)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not initialize AjaxUpload class.', '', 'AjaxUpload'); if ($debug) { return 'Could not load initialize AjaxUpload class.'; } else { return ''; } } return $ajaxUpload->output() . $ajaxUpload->debugOutput();
$ajaxuploadCorePath = $modx->getOption('ajaxupload.core_path', NULL, $modx->getOption('core_path') . 'components/ajaxupload/'); $ajaxuploadFieldname = $modx->getOption('ajaxuploadFieldname', $scriptProperties, ''); $ajaxuploadFieldformat = $modx->getOption('ajaxuploadFieldformat', $scriptProperties, 'csv'); $ajaxuploadTarget = $modx->getOption('ajaxuploadTarget', $scriptProperties, ''); $scriptProperties['debug'] = $modx->getOption('ajaxuploadDebug', $scriptProperties, $modx->getOption('ajaxupload.debug', NULL, FALSE)); $scriptProperties['uid'] = $modx->getOption('ajaxuploadUid', $scriptProperties, ''); $debug = $scriptProperties['debug']; if (!$modx->loadClass('AjaxUpload', $ajaxuploadCorePath . 'model/ajaxupload/', TRUE, TRUE)) { $modx->log(modX::LOG_LEVEL_ERROR, '[AjaxUpload] Could not load modPhpThumb class.'); if ($debug) { return 'Could not load AjaxUpload class.'; } else { return ''; } } $ajaxUpload = new AjaxUpload($modx, $scriptProperties); if (!$ajaxUpload->initialize()) { $modx->log(modX::LOG_LEVEL_ERROR, '[AjaxUpload] Could not initialize AjaxUpload class.'); if ($debug) { return 'Could not load initialize AjaxUpload class.'; } else { return ''; } } $success = TRUE; switch (TRUE) { case empty($ajaxuploadFieldname): $hook->addError('message', 'Missing parameter ajaxuploadTarget.'); $success = FALSE; break; case empty($ajaxuploadTarget):
$ajaxuploadTarget = $modx->getOption('ajaxuploadTarget', $scriptProperties, ''); $scriptProperties['debug'] = $modx->getOption('ajaxuploadDebug', $scriptProperties, $modx->getOption('ajaxupload.debug', null, false)); $scriptProperties['uid'] = $modx->getOption('ajaxuploadUid', $scriptProperties, ''); $debug = $scriptProperties['debug']; if (!$modx->loadClass('AjaxUpload', $ajaxuploadCorePath . 'model/ajaxupload/', true, true)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not load AjaxUpload class.', '', 'AjaxUpload2Formit'); if ($debug) { return 'Could not load AjaxUpload class.'; } else { return ''; } } $scriptProperties['ajaxupload.core_path'] = $ajaxuploadCorePath; $scriptProperties['ajaxupload.assets_path'] = $ajaxuploadAssetsPath; $scriptProperties['ajaxupload.assets_url'] = $ajaxuploadAssetsUrl; $ajaxUpload = new AjaxUpload($modx, $scriptProperties); if (!$ajaxUpload->initialize()) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not initialize AjaxUpload class.', '', 'AjaxUpload2Formit'); if ($debug) { return 'Could not load initialize AjaxUpload class.'; } else { return ''; } } $success = true; switch (true) { case empty($ajaxuploadFieldname): $hook->addError($scriptProperties['uid'], 'Missing parameter ajaxuploadFieldname.'); $modx->log(modX::LOG_LEVEL_ERROR, 'Missing parameter ajaxuploadFieldname.', '', 'AjaxUpload2Formit'); $success = false; break;
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * AjaxUpload; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @package ajaxupload * @subpackage snippet */ $ajaxuploadCorePath = $modx->getOption('ajaxupload.core_path', NULL, $modx->getOption('core_path') . 'components/ajaxupload/'); $debug = $modx->getOption('debug', $scriptProperties, $modx->getOption('ajaxupload.debug', NULL, FALSE)); if (!$modx->loadClass('AjaxUpload', $ajaxuploadCorePath . 'model/ajaxupload/', TRUE, TRUE)) { $modx->log(modX::LOG_LEVEL_ERROR, '[AjaxUpload] Could not load modPhpThumb class.'); if ($debug) { return 'Could not load AjaxUpload class.'; } else { return ''; } } $ajaxUpload = new AjaxUpload($modx, $scriptProperties); if (!$ajaxUpload->initialize()) { $modx->log(modX::LOG_LEVEL_ERROR, '[AjaxUpload] Could not initialize AjaxUpload class.'); if ($debug) { return 'Could not load initialize AjaxUpload class.'; } else { return ''; } } return $ajaxUpload->output() . $ajaxUpload->debugOutput();