@@ -10,45 +10,45 @@ |
||
| 10 | 10 | |
| 11 | 11 | class SmartTip |
| 12 | 12 | { |
| 13 | - public $id; |
|
| 14 | - public $caption; |
|
| 15 | - public $message; |
|
| 16 | - public $visible; |
|
| 17 | - public $_tpl; |
|
| 13 | + public $id; |
|
| 14 | + public $caption; |
|
| 15 | + public $message; |
|
| 16 | + public $visible; |
|
| 17 | + public $_tpl; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * SmartTip constructor. |
|
| 21 | - * @param $id |
|
| 22 | - * @param $caption |
|
| 23 | - * @param $message |
|
| 24 | - * @param bool $visible |
|
| 25 | - */ |
|
| 26 | - public function __construct($id, $caption, $message, $visible = false) |
|
| 27 | - { |
|
| 28 | - $this->id = $id; |
|
| 29 | - $this->caption = $caption; |
|
| 30 | - $this->message = $message; |
|
| 31 | - $this->visible = $visible; |
|
| 32 | - $this->_tpl = new XoopsTpl(); |
|
| 33 | - } |
|
| 19 | + /** |
|
| 20 | + * SmartTip constructor. |
|
| 21 | + * @param $id |
|
| 22 | + * @param $caption |
|
| 23 | + * @param $message |
|
| 24 | + * @param bool $visible |
|
| 25 | + */ |
|
| 26 | + public function __construct($id, $caption, $message, $visible = false) |
|
| 27 | + { |
|
| 28 | + $this->id = $id; |
|
| 29 | + $this->caption = $caption; |
|
| 30 | + $this->message = $message; |
|
| 31 | + $this->visible = $visible; |
|
| 32 | + $this->_tpl = new XoopsTpl(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param bool $outputNow |
|
| 37 | - * @return mixed|string|void |
|
| 38 | - */ |
|
| 39 | - public function render($outputNow = true) |
|
| 40 | - { |
|
| 41 | - $aTip = array( |
|
| 42 | - 'id' => $this->id, |
|
| 43 | - 'caption' => $this->caption, |
|
| 44 | - 'message' => $this->message, |
|
| 45 | - 'visible' => $this->visible ? 'block' : 'none' |
|
| 46 | - ); |
|
| 47 | - $this->_tpl->assign('tip', $aTip); |
|
| 48 | - if ($outputNow) { |
|
| 49 | - $this->_tpl->display('db:smartobject_tip.tpl'); |
|
| 50 | - } else { |
|
| 51 | - return $this->_tpl->fetch('db:smartobject_tip.tpl'); |
|
| 52 | - } |
|
| 53 | - } |
|
| 35 | + /** |
|
| 36 | + * @param bool $outputNow |
|
| 37 | + * @return mixed|string|void |
|
| 38 | + */ |
|
| 39 | + public function render($outputNow = true) |
|
| 40 | + { |
|
| 41 | + $aTip = array( |
|
| 42 | + 'id' => $this->id, |
|
| 43 | + 'caption' => $this->caption, |
|
| 44 | + 'message' => $this->message, |
|
| 45 | + 'visible' => $this->visible ? 'block' : 'none' |
|
| 46 | + ); |
|
| 47 | + $this->_tpl->assign('tip', $aTip); |
|
| 48 | + if ($outputNow) { |
|
| 49 | + $this->_tpl->display('db:smartobject_tip.tpl'); |
|
| 50 | + } else { |
|
| 51 | + return $this->_tpl->fetch('db:smartobject_tip.tpl'); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -19,164 +19,164 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class SmartobjectAbout |
| 21 | 21 | { |
| 22 | - public $_lang_aboutTitle; |
|
| 23 | - public $_lang_author_info; |
|
| 24 | - public $_lang_developer_lead; |
|
| 25 | - public $_lang_developer_contributor; |
|
| 26 | - public $_lang_developer_website; |
|
| 27 | - public $_lang_developer_email; |
|
| 28 | - public $_lang_developer_credits; |
|
| 29 | - public $_lang_module_info; |
|
| 30 | - public $_lang_module_status; |
|
| 31 | - public $_lang_module_release_date; |
|
| 32 | - public $_lang_module_demo; |
|
| 33 | - public $_lang_module_support; |
|
| 34 | - public $_lang_module_bug; |
|
| 35 | - public $_lang_module_submit_bug; |
|
| 36 | - public $_lang_module_feature; |
|
| 37 | - public $_lang_module_submit_feature; |
|
| 38 | - public $_lang_module_disclaimer; |
|
| 39 | - public $_lang_author_word; |
|
| 40 | - public $_lang_version_history; |
|
| 41 | - public $_lang_by; |
|
| 42 | - public $_tpl; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * SmartobjectAbout constructor. |
|
| 46 | - * @param string $aboutTitle |
|
| 47 | - */ |
|
| 48 | - public function __construct($aboutTitle = 'About') |
|
| 49 | - { |
|
| 50 | - global $xoopsModule, $xoopsConfig; |
|
| 51 | - |
|
| 52 | - $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
| 53 | - if (file_exists($fileName)) { |
|
| 54 | - include_once $fileName; |
|
| 55 | - } else { |
|
| 56 | - include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
| 57 | - } |
|
| 58 | - $this->_aboutTitle = $aboutTitle; |
|
| 59 | - |
|
| 60 | - $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR; |
|
| 61 | - $this->_lang_developer_website = _CO_SOBJECT_DEVELOPER_WEBSITE; |
|
| 62 | - $this->_lang_developer_email = _CO_SOBJECT_DEVELOPER_EMAIL; |
|
| 63 | - $this->_lang_developer_credits = _CO_SOBJECT_DEVELOPER_CREDITS; |
|
| 64 | - $this->_lang_module_info = _CO_SOBJECT_MODULE_INFO; |
|
| 65 | - $this->_lang_module_status = _CO_SOBJECT_MODULE_STATUS; |
|
| 66 | - $this->_lang_module_release_date = _CO_SOBJECT_MODULE_RELEASE_DATE; |
|
| 67 | - $this->_lang_module_demo = _CO_SOBJECT_MODULE_DEMO; |
|
| 68 | - $this->_lang_module_support = _CO_SOBJECT_MODULE_SUPPORT; |
|
| 69 | - $this->_lang_module_bug = _CO_SOBJECT_MODULE_BUG; |
|
| 70 | - $this->_lang_module_submit_bug = _CO_SOBJECT_MODULE_SUBMIT_BUG; |
|
| 71 | - $this->_lang_module_feature = _CO_SOBJECT_MODULE_FEATURE; |
|
| 72 | - $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE; |
|
| 73 | - $this->_lang_module_disclaimer = _CO_SOBJECT_MODULE_DISCLAIMER; |
|
| 74 | - $this->_lang_author_word = _CO_SOBJECT_AUTHOR_WORD; |
|
| 75 | - $this->_lang_version_history = _CO_SOBJECT_VERSION_HISTORY; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @param $value |
|
| 80 | - * @return mixed |
|
| 81 | - */ |
|
| 82 | - public function sanitize($value) |
|
| 83 | - { |
|
| 84 | - $myts = MyTextSanitizer::getInstance(); |
|
| 85 | - |
|
| 86 | - return $myts->displayTarea($value, 1); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public function render() |
|
| 90 | - { |
|
| 91 | - /** |
|
| 92 | - * @todo move the output to a template |
|
| 93 | - * @todo make the output XHTML compliant |
|
| 94 | - */ |
|
| 95 | - |
|
| 96 | - $myts = MyTextSanitizer::getInstance(); |
|
| 97 | - |
|
| 98 | - global $xoopsModule; |
|
| 99 | - |
|
| 100 | - smart_xoops_cp_header(); |
|
| 101 | - |
|
| 102 | - $moduleHandler = xoops_getHandler('module'); |
|
| 103 | - $versioninfo = &$moduleHandler->get($xoopsModule->getVar('mid')); |
|
| 104 | - |
|
| 105 | - //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
|
| 106 | - |
|
| 107 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 108 | - |
|
| 109 | - // --- |
|
| 110 | - // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
| 111 | - // $this->_tpl =& new XoopsTpl(); |
|
| 112 | - $this->_tpl = new XoopsTpl(); |
|
| 113 | - // --- |
|
| 114 | - |
|
| 115 | - $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
| 116 | - $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
|
| 117 | - $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
|
| 118 | - $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
|
| 119 | - $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); |
|
| 120 | - |
|
| 121 | - // Left headings... |
|
| 122 | - if ($versioninfo->getInfo('author_realname') != '') { |
|
| 123 | - $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
| 124 | - } else { |
|
| 125 | - $author_name = $versioninfo->getInfo('author'); |
|
| 126 | - } |
|
| 127 | - $this->_tpl->assign('module_author_name', $author_name); |
|
| 128 | - |
|
| 129 | - $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); |
|
| 130 | - |
|
| 131 | - $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); |
|
| 132 | - |
|
| 133 | - // Developers Information |
|
| 134 | - $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); |
|
| 135 | - $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); |
|
| 136 | - $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); |
|
| 137 | - $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); |
|
| 138 | - $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); |
|
| 139 | - |
|
| 140 | - $people = $versioninfo->getInfo('people'); |
|
| 141 | - if ($people) { |
|
| 142 | - $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map(array($this, 'sanitize'), $people['developers']) : false); |
|
| 143 | - $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map(array($this, 'sanitize'), $people['testers']) : false); |
|
| 144 | - $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map(array($this, 'sanitize'), $people['translators']) : false); |
|
| 145 | - $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map(array($this, 'sanitize'), $people['documenters']) : false); |
|
| 146 | - $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map(array($this, 'sanitize'), $people['other']) : false); |
|
| 147 | - } |
|
| 148 | - //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); |
|
| 149 | - |
|
| 150 | - // Module Development information |
|
| 151 | - $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); |
|
| 152 | - $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); |
|
| 153 | - $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); |
|
| 154 | - $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); |
|
| 155 | - $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); |
|
| 156 | - $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); |
|
| 157 | - $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); |
|
| 158 | - $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); |
|
| 159 | - |
|
| 160 | - // Warning |
|
| 161 | - $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); |
|
| 162 | - |
|
| 163 | - // Author's note |
|
| 164 | - $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); |
|
| 165 | - |
|
| 166 | - // For changelog thanks to 3Dev |
|
| 167 | - global $xoopsModule; |
|
| 168 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
| 169 | - if (is_file($filename)) { |
|
| 170 | - $filesize = filesize($filename); |
|
| 171 | - $handle = fopen($filename, 'r'); |
|
| 172 | - $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true)); |
|
| 173 | - fclose($handle); |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - $this->_tpl->display('db:smartobject_about.tpl'); |
|
| 177 | - |
|
| 178 | - smart_modFooter(); |
|
| 179 | - |
|
| 180 | - xoops_cp_footer(); |
|
| 181 | - } |
|
| 22 | + public $_lang_aboutTitle; |
|
| 23 | + public $_lang_author_info; |
|
| 24 | + public $_lang_developer_lead; |
|
| 25 | + public $_lang_developer_contributor; |
|
| 26 | + public $_lang_developer_website; |
|
| 27 | + public $_lang_developer_email; |
|
| 28 | + public $_lang_developer_credits; |
|
| 29 | + public $_lang_module_info; |
|
| 30 | + public $_lang_module_status; |
|
| 31 | + public $_lang_module_release_date; |
|
| 32 | + public $_lang_module_demo; |
|
| 33 | + public $_lang_module_support; |
|
| 34 | + public $_lang_module_bug; |
|
| 35 | + public $_lang_module_submit_bug; |
|
| 36 | + public $_lang_module_feature; |
|
| 37 | + public $_lang_module_submit_feature; |
|
| 38 | + public $_lang_module_disclaimer; |
|
| 39 | + public $_lang_author_word; |
|
| 40 | + public $_lang_version_history; |
|
| 41 | + public $_lang_by; |
|
| 42 | + public $_tpl; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * SmartobjectAbout constructor. |
|
| 46 | + * @param string $aboutTitle |
|
| 47 | + */ |
|
| 48 | + public function __construct($aboutTitle = 'About') |
|
| 49 | + { |
|
| 50 | + global $xoopsModule, $xoopsConfig; |
|
| 51 | + |
|
| 52 | + $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
| 53 | + if (file_exists($fileName)) { |
|
| 54 | + include_once $fileName; |
|
| 55 | + } else { |
|
| 56 | + include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
| 57 | + } |
|
| 58 | + $this->_aboutTitle = $aboutTitle; |
|
| 59 | + |
|
| 60 | + $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR; |
|
| 61 | + $this->_lang_developer_website = _CO_SOBJECT_DEVELOPER_WEBSITE; |
|
| 62 | + $this->_lang_developer_email = _CO_SOBJECT_DEVELOPER_EMAIL; |
|
| 63 | + $this->_lang_developer_credits = _CO_SOBJECT_DEVELOPER_CREDITS; |
|
| 64 | + $this->_lang_module_info = _CO_SOBJECT_MODULE_INFO; |
|
| 65 | + $this->_lang_module_status = _CO_SOBJECT_MODULE_STATUS; |
|
| 66 | + $this->_lang_module_release_date = _CO_SOBJECT_MODULE_RELEASE_DATE; |
|
| 67 | + $this->_lang_module_demo = _CO_SOBJECT_MODULE_DEMO; |
|
| 68 | + $this->_lang_module_support = _CO_SOBJECT_MODULE_SUPPORT; |
|
| 69 | + $this->_lang_module_bug = _CO_SOBJECT_MODULE_BUG; |
|
| 70 | + $this->_lang_module_submit_bug = _CO_SOBJECT_MODULE_SUBMIT_BUG; |
|
| 71 | + $this->_lang_module_feature = _CO_SOBJECT_MODULE_FEATURE; |
|
| 72 | + $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE; |
|
| 73 | + $this->_lang_module_disclaimer = _CO_SOBJECT_MODULE_DISCLAIMER; |
|
| 74 | + $this->_lang_author_word = _CO_SOBJECT_AUTHOR_WORD; |
|
| 75 | + $this->_lang_version_history = _CO_SOBJECT_VERSION_HISTORY; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @param $value |
|
| 80 | + * @return mixed |
|
| 81 | + */ |
|
| 82 | + public function sanitize($value) |
|
| 83 | + { |
|
| 84 | + $myts = MyTextSanitizer::getInstance(); |
|
| 85 | + |
|
| 86 | + return $myts->displayTarea($value, 1); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + public function render() |
|
| 90 | + { |
|
| 91 | + /** |
|
| 92 | + * @todo move the output to a template |
|
| 93 | + * @todo make the output XHTML compliant |
|
| 94 | + */ |
|
| 95 | + |
|
| 96 | + $myts = MyTextSanitizer::getInstance(); |
|
| 97 | + |
|
| 98 | + global $xoopsModule; |
|
| 99 | + |
|
| 100 | + smart_xoops_cp_header(); |
|
| 101 | + |
|
| 102 | + $moduleHandler = xoops_getHandler('module'); |
|
| 103 | + $versioninfo = &$moduleHandler->get($xoopsModule->getVar('mid')); |
|
| 104 | + |
|
| 105 | + //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
|
| 106 | + |
|
| 107 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 108 | + |
|
| 109 | + // --- |
|
| 110 | + // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
| 111 | + // $this->_tpl =& new XoopsTpl(); |
|
| 112 | + $this->_tpl = new XoopsTpl(); |
|
| 113 | + // --- |
|
| 114 | + |
|
| 115 | + $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
| 116 | + $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
|
| 117 | + $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
|
| 118 | + $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
|
| 119 | + $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); |
|
| 120 | + |
|
| 121 | + // Left headings... |
|
| 122 | + if ($versioninfo->getInfo('author_realname') != '') { |
|
| 123 | + $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
| 124 | + } else { |
|
| 125 | + $author_name = $versioninfo->getInfo('author'); |
|
| 126 | + } |
|
| 127 | + $this->_tpl->assign('module_author_name', $author_name); |
|
| 128 | + |
|
| 129 | + $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); |
|
| 130 | + |
|
| 131 | + $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); |
|
| 132 | + |
|
| 133 | + // Developers Information |
|
| 134 | + $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); |
|
| 135 | + $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); |
|
| 136 | + $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); |
|
| 137 | + $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); |
|
| 138 | + $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); |
|
| 139 | + |
|
| 140 | + $people = $versioninfo->getInfo('people'); |
|
| 141 | + if ($people) { |
|
| 142 | + $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map(array($this, 'sanitize'), $people['developers']) : false); |
|
| 143 | + $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map(array($this, 'sanitize'), $people['testers']) : false); |
|
| 144 | + $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map(array($this, 'sanitize'), $people['translators']) : false); |
|
| 145 | + $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map(array($this, 'sanitize'), $people['documenters']) : false); |
|
| 146 | + $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map(array($this, 'sanitize'), $people['other']) : false); |
|
| 147 | + } |
|
| 148 | + //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); |
|
| 149 | + |
|
| 150 | + // Module Development information |
|
| 151 | + $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); |
|
| 152 | + $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); |
|
| 153 | + $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); |
|
| 154 | + $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); |
|
| 155 | + $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); |
|
| 156 | + $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); |
|
| 157 | + $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); |
|
| 158 | + $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); |
|
| 159 | + |
|
| 160 | + // Warning |
|
| 161 | + $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); |
|
| 162 | + |
|
| 163 | + // Author's note |
|
| 164 | + $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); |
|
| 165 | + |
|
| 166 | + // For changelog thanks to 3Dev |
|
| 167 | + global $xoopsModule; |
|
| 168 | + $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
| 169 | + if (is_file($filename)) { |
|
| 170 | + $filesize = filesize($filename); |
|
| 171 | + $handle = fopen($filename, 'r'); |
|
| 172 | + $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true)); |
|
| 173 | + fclose($handle); |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + $this->_tpl->display('db:smartobject_about.tpl'); |
|
| 177 | + |
|
| 178 | + smart_modFooter(); |
|
| 179 | + |
|
| 180 | + xoops_cp_footer(); |
|
| 181 | + } |
|
| 182 | 182 | } |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | smart_xoops_cp_header(); |
| 101 | 101 | |
| 102 | 102 | $moduleHandler = xoops_getHandler('module'); |
| 103 | - $versioninfo = &$moduleHandler->get($xoopsModule->getVar('mid')); |
|
| 103 | + $versioninfo = &$moduleHandler->get($xoopsModule->getVar('mid')); |
|
| 104 | 104 | |
| 105 | 105 | //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
| 106 | 106 | |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class SmartObjectTree extends XoopsObjectTree |
| 11 | 11 | { |
| 12 | - public function _initialize() |
|
| 13 | - { |
|
| 14 | - foreach (array_keys($this->_objects) as $i) { |
|
| 15 | - $key1 = $this->_objects[$i]->getVar($this->_myId); |
|
| 16 | - $this->_tree[$key1]['obj'] = $this->_objects[$i]; |
|
| 17 | - $key2 = $this->_objects[$i]->getVar($this->_parentId, 'e'); |
|
| 18 | - $this->_tree[$key1]['parent'] = $key2; |
|
| 19 | - $this->_tree[$key2]['child'][] = $key1; |
|
| 20 | - if (isset($this->_rootId)) { |
|
| 21 | - $this->_tree[$key1]['root'] = $this->_objects[$i]->getVar($this->_rootId); |
|
| 22 | - } |
|
| 23 | - } |
|
| 24 | - } |
|
| 12 | + public function _initialize() |
|
| 13 | + { |
|
| 14 | + foreach (array_keys($this->_objects) as $i) { |
|
| 15 | + $key1 = $this->_objects[$i]->getVar($this->_myId); |
|
| 16 | + $this->_tree[$key1]['obj'] = $this->_objects[$i]; |
|
| 17 | + $key2 = $this->_objects[$i]->getVar($this->_parentId, 'e'); |
|
| 18 | + $this->_tree[$key1]['parent'] = $key2; |
|
| 19 | + $this->_tree[$key2]['child'][] = $key1; |
|
| 20 | + if (isset($this->_rootId)) { |
|
| 21 | + $this->_tree[$key1]['root'] = $this->_objects[$i]->getVar($this->_rootId); |
|
| 22 | + } |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file contains the keyhighlighter class that highlight the chosen keyword in the current output buffer. |
|
| 4 | - * |
|
| 5 | - * @package keyhighlighter |
|
| 6 | - */ |
|
| 3 | + * This file contains the keyhighlighter class that highlight the chosen keyword in the current output buffer. |
|
| 4 | + * |
|
| 5 | + * @package keyhighlighter |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * keyhighlighter class |
@@ -19,96 +19,96 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class SmartHighlighter |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @access private |
|
| 24 | - */ |
|
| 25 | - public $preg_keywords = ''; |
|
| 26 | - /** |
|
| 27 | - * @access private |
|
| 28 | - */ |
|
| 29 | - public $keywords = ''; |
|
| 30 | - /** |
|
| 31 | - * @access private |
|
| 32 | - */ |
|
| 33 | - public $singlewords = false; |
|
| 34 | - /** |
|
| 35 | - * @access private |
|
| 36 | - */ |
|
| 37 | - public $replace_callback = null; |
|
| 22 | + /** |
|
| 23 | + * @access private |
|
| 24 | + */ |
|
| 25 | + public $preg_keywords = ''; |
|
| 26 | + /** |
|
| 27 | + * @access private |
|
| 28 | + */ |
|
| 29 | + public $keywords = ''; |
|
| 30 | + /** |
|
| 31 | + * @access private |
|
| 32 | + */ |
|
| 33 | + public $singlewords = false; |
|
| 34 | + /** |
|
| 35 | + * @access private |
|
| 36 | + */ |
|
| 37 | + public $replace_callback = null; |
|
| 38 | 38 | |
| 39 | - public $content; |
|
| 39 | + public $content; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Main constructor |
|
| 43 | - * |
|
| 44 | - * This is the main constructor of keyhighlighter class. <br /> |
|
| 45 | - * It's the only public method of the class. |
|
| 46 | - * @param string $keywords the keywords you want to highlight |
|
| 47 | - * @param boolean $singlewords specify if it has to highlight also the single words. |
|
| 48 | - * @param callback $replace_callback a custom callback for keyword highlight. |
|
| 49 | - * <code> |
|
| 50 | - * <?php |
|
| 51 | - * require ('keyhighlighter.class.php'); |
|
| 52 | - * |
|
| 53 | - * function my_highlighter ($matches) { |
|
| 54 | - * return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>'; |
|
| 55 | - * } |
|
| 56 | - * |
|
| 57 | - * new keyhighlighter ('W3C', false, 'my_highlighter'); |
|
| 58 | - * readfile ('http://www.w3c.org/'); |
|
| 59 | - * ?> |
|
| 60 | - * </code> |
|
| 61 | - */ |
|
| 62 | - // public function __construct () |
|
| 63 | - public function __construct($keywords, $singlewords = false, $replace_callback = null) |
|
| 64 | - { |
|
| 65 | - $this->keywords = $keywords; |
|
| 66 | - $this->singlewords = $singlewords; |
|
| 67 | - $this->replace_callback = $replace_callback; |
|
| 68 | - } |
|
| 41 | + /** |
|
| 42 | + * Main constructor |
|
| 43 | + * |
|
| 44 | + * This is the main constructor of keyhighlighter class. <br /> |
|
| 45 | + * It's the only public method of the class. |
|
| 46 | + * @param string $keywords the keywords you want to highlight |
|
| 47 | + * @param boolean $singlewords specify if it has to highlight also the single words. |
|
| 48 | + * @param callback $replace_callback a custom callback for keyword highlight. |
|
| 49 | + * <code> |
|
| 50 | + * <?php |
|
| 51 | + * require ('keyhighlighter.class.php'); |
|
| 52 | + * |
|
| 53 | + * function my_highlighter ($matches) { |
|
| 54 | + * return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>'; |
|
| 55 | + * } |
|
| 56 | + * |
|
| 57 | + * new keyhighlighter ('W3C', false, 'my_highlighter'); |
|
| 58 | + * readfile ('http://www.w3c.org/'); |
|
| 59 | + * ?> |
|
| 60 | + * </code> |
|
| 61 | + */ |
|
| 62 | + // public function __construct () |
|
| 63 | + public function __construct($keywords, $singlewords = false, $replace_callback = null) |
|
| 64 | + { |
|
| 65 | + $this->keywords = $keywords; |
|
| 66 | + $this->singlewords = $singlewords; |
|
| 67 | + $this->replace_callback = $replace_callback; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @access private |
|
| 72 | - * @param $replace_matches |
|
| 73 | - * @return mixed |
|
| 74 | - */ |
|
| 75 | - public function replace($replace_matches) |
|
| 76 | - { |
|
| 77 | - $patterns = array(); |
|
| 78 | - if ($this->singlewords) { |
|
| 79 | - $keywords = explode(' ', $this->preg_keywords); |
|
| 80 | - foreach ($keywords as $keyword) { |
|
| 81 | - $patterns[] = '/(?' . '>' . $keyword . '+)/si'; |
|
| 82 | - } |
|
| 83 | - } else { |
|
| 84 | - $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si'; |
|
| 85 | - } |
|
| 70 | + /** |
|
| 71 | + * @access private |
|
| 72 | + * @param $replace_matches |
|
| 73 | + * @return mixed |
|
| 74 | + */ |
|
| 75 | + public function replace($replace_matches) |
|
| 76 | + { |
|
| 77 | + $patterns = array(); |
|
| 78 | + if ($this->singlewords) { |
|
| 79 | + $keywords = explode(' ', $this->preg_keywords); |
|
| 80 | + foreach ($keywords as $keyword) { |
|
| 81 | + $patterns[] = '/(?' . '>' . $keyword . '+)/si'; |
|
| 82 | + } |
|
| 83 | + } else { |
|
| 84 | + $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si'; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - $result = $replace_matches[0]; |
|
| 87 | + $result = $replace_matches[0]; |
|
| 88 | 88 | |
| 89 | - foreach ($patterns as $pattern) { |
|
| 90 | - if (null !== ($this->replace_callback)) { |
|
| 91 | - $result = preg_replace_callback($pattern, $this->replace_callback, $result); |
|
| 92 | - } else { |
|
| 93 | - $result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result); |
|
| 94 | - } |
|
| 95 | - } |
|
| 89 | + foreach ($patterns as $pattern) { |
|
| 90 | + if (null !== ($this->replace_callback)) { |
|
| 91 | + $result = preg_replace_callback($pattern, $this->replace_callback, $result); |
|
| 92 | + } else { |
|
| 93 | + $result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result); |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - return $result; |
|
| 98 | - } |
|
| 97 | + return $result; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * @access private |
|
| 102 | - * @param $buffer |
|
| 103 | - * @return mixed|string |
|
| 104 | - */ |
|
| 105 | - public function highlight($buffer) |
|
| 106 | - { |
|
| 107 | - $buffer = '>' . $buffer . '<'; |
|
| 108 | - $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords); |
|
| 109 | - $buffer = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
| 110 | - $buffer = substr($buffer, 1, -1); |
|
| 100 | + /** |
|
| 101 | + * @access private |
|
| 102 | + * @param $buffer |
|
| 103 | + * @return mixed|string |
|
| 104 | + */ |
|
| 105 | + public function highlight($buffer) |
|
| 106 | + { |
|
| 107 | + $buffer = '>' . $buffer . '<'; |
|
| 108 | + $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords); |
|
| 109 | + $buffer = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
| 110 | + $buffer = substr($buffer, 1, -1); |
|
| 111 | 111 | |
| 112 | - return $buffer; |
|
| 113 | - } |
|
| 112 | + return $buffer; |
|
| 113 | + } |
|
| 114 | 114 | } |
@@ -35,19 +35,19 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | class SmartobjectTag extends SmartMlObject |
| 37 | 37 | { |
| 38 | - /** |
|
| 39 | - * SmartobjectTag constructor. |
|
| 40 | - */ |
|
| 41 | - public function __construct() |
|
| 42 | - { |
|
| 43 | - $this->initVar('tagid', XOBJ_DTYPE_INT, '', true); |
|
| 44 | - $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true); |
|
| 45 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC); |
|
| 46 | - $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC); |
|
| 38 | + /** |
|
| 39 | + * SmartobjectTag constructor. |
|
| 40 | + */ |
|
| 41 | + public function __construct() |
|
| 42 | + { |
|
| 43 | + $this->initVar('tagid', XOBJ_DTYPE_INT, '', true); |
|
| 44 | + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true); |
|
| 45 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC); |
|
| 46 | + $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC); |
|
| 47 | 47 | |
| 48 | - // call parent constructor to get Multilanguage field initiated |
|
| 49 | - $this->SmartMlObject(); |
|
| 50 | - } |
|
| 48 | + // call parent constructor to get Multilanguage field initiated |
|
| 49 | + $this->SmartMlObject(); |
|
| 50 | + } |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -55,27 +55,27 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | class SmartobjectTagHandler extends SmartPersistableMlObjectHandler |
| 57 | 57 | { |
| 58 | - /** |
|
| 59 | - * SmartobjectTagHandler constructor. |
|
| 60 | - * @param object|XoopsDatabase $db |
|
| 61 | - */ |
|
| 62 | - public function __construct($db) |
|
| 63 | - { |
|
| 64 | - parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
| 65 | - } |
|
| 58 | + /** |
|
| 59 | + * SmartobjectTagHandler constructor. |
|
| 60 | + * @param object|XoopsDatabase $db |
|
| 61 | + */ |
|
| 62 | + public function __construct($db) |
|
| 63 | + { |
|
| 64 | + parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @return mixed |
|
| 69 | - */ |
|
| 70 | - public function getLanguages() |
|
| 71 | - { |
|
| 72 | - include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 73 | - $aLanguages = XoopsLists::getLangList(); |
|
| 74 | - $ret['default'] = _CO_SOBJECT_ALL; |
|
| 75 | - foreach ($aLanguages as $lang) { |
|
| 76 | - $ret[$lang] = $lang; |
|
| 77 | - } |
|
| 67 | + /** |
|
| 68 | + * @return mixed |
|
| 69 | + */ |
|
| 70 | + public function getLanguages() |
|
| 71 | + { |
|
| 72 | + include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 73 | + $aLanguages = XoopsLists::getLangList(); |
|
| 74 | + $ret['default'] = _CO_SOBJECT_ALL; |
|
| 75 | + foreach ($aLanguages as $lang) { |
|
| 76 | + $ret[$lang] = $lang; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - return $ret; |
|
| 80 | - } |
|
| 79 | + return $ret; |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -24,44 +24,44 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class SmartSeoObject extends SmartObject |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * SmartSeoObject constructor. |
|
| 29 | - */ |
|
| 30 | - public function __construct() |
|
| 31 | - { |
|
| 32 | - $this->initCommonVar('meta_keywords'); |
|
| 33 | - $this->initCommonVar('meta_description'); |
|
| 34 | - $this->initCommonVar('short_url'); |
|
| 35 | - $this->seoEnabled = true; |
|
| 36 | - } |
|
| 27 | + /** |
|
| 28 | + * SmartSeoObject constructor. |
|
| 29 | + */ |
|
| 30 | + public function __construct() |
|
| 31 | + { |
|
| 32 | + $this->initCommonVar('meta_keywords'); |
|
| 33 | + $this->initCommonVar('meta_description'); |
|
| 34 | + $this->initCommonVar('short_url'); |
|
| 35 | + $this->seoEnabled = true; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Return the value of the short_url field of this object |
|
| 40 | - * |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function short_url() |
|
| 44 | - { |
|
| 45 | - return $this->getVar('short_url'); |
|
| 46 | - } |
|
| 38 | + /** |
|
| 39 | + * Return the value of the short_url field of this object |
|
| 40 | + * |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function short_url() |
|
| 44 | + { |
|
| 45 | + return $this->getVar('short_url'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Return the value of the meta_keywords field of this object |
|
| 50 | - * |
|
| 51 | - * @return string |
|
| 52 | - */ |
|
| 53 | - public function meta_keywords() |
|
| 54 | - { |
|
| 55 | - return $this->getVar('meta_keywords'); |
|
| 56 | - } |
|
| 48 | + /** |
|
| 49 | + * Return the value of the meta_keywords field of this object |
|
| 50 | + * |
|
| 51 | + * @return string |
|
| 52 | + */ |
|
| 53 | + public function meta_keywords() |
|
| 54 | + { |
|
| 55 | + return $this->getVar('meta_keywords'); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Return the value of the meta_description field of this object |
|
| 60 | - * |
|
| 61 | - * @return string |
|
| 62 | - */ |
|
| 63 | - public function meta_description() |
|
| 64 | - { |
|
| 65 | - return $this->getVar('meta_description'); |
|
| 66 | - } |
|
| 58 | + /** |
|
| 59 | + * Return the value of the meta_description field of this object |
|
| 60 | + * |
|
| 61 | + * @return string |
|
| 62 | + */ |
|
| 63 | + public function meta_description() |
|
| 64 | + { |
|
| 65 | + return $this->getVar('meta_description'); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -36,10 +36,10 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class SmartJax extends Projax |
| 38 | 38 | { |
| 39 | - public function initiateFromUserside() |
|
| 40 | - { |
|
| 41 | - global $xoTheme; |
|
| 42 | - $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js'); |
|
| 43 | - $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js'); |
|
| 44 | - } |
|
| 39 | + public function initiateFromUserside() |
|
| 40 | + { |
|
| 41 | + global $xoTheme; |
|
| 42 | + $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js'); |
|
| 43 | + $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js'); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -24,82 +24,82 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class SmartMlObject extends SmartObject |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * SmartMlObject constructor. |
|
| 29 | - */ |
|
| 30 | - public function __construct() |
|
| 31 | - { |
|
| 32 | - $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
| 33 | - $this->setControl('language', 'language'); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * If object is not new, change the control of the not-multilanguage fields |
|
| 38 | - * |
|
| 39 | - * We need to intercept this function from SmartObject because if the object is not new... |
|
| 40 | - */ |
|
| 41 | - // function getForm() { |
|
| 42 | - |
|
| 43 | - //} |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Strip Multilanguage Fields |
|
| 47 | - * |
|
| 48 | - * Get rid of all the multilanguage fields to have an object with only global fields. |
|
| 49 | - * This will be usefull when creating the ML object for the first time. Then we will be able |
|
| 50 | - * to create translations. |
|
| 51 | - */ |
|
| 52 | - public function stripMultilanguageFields() |
|
| 53 | - { |
|
| 54 | - $objectVars =& $this->getVars(); |
|
| 55 | - $newObjectVars = array(); |
|
| 56 | - foreach ($objectVars as $key => $var) { |
|
| 57 | - if (!$var['multilingual']) { |
|
| 58 | - $newObjectVars[$key] = $var; |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - $this->vars = $newObjectVars; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - public function stripNonMultilanguageFields() |
|
| 65 | - { |
|
| 66 | - $objectVars =& $this->getVars(); |
|
| 67 | - $newObjectVars = array(); |
|
| 68 | - foreach ($objectVars as $key => $var) { |
|
| 69 | - if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
| 70 | - $newObjectVars[$key] = $var; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - $this->vars = $newObjectVars; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Make non multilanguage fields read only |
|
| 78 | - * |
|
| 79 | - * This is used when we are creating/editing a translation. |
|
| 80 | - * We only want to edit the multilanguag fields, not the global one. |
|
| 81 | - */ |
|
| 82 | - public function makeNonMLFieldReadOnly() |
|
| 83 | - { |
|
| 84 | - foreach ($this->getVars() as $key => $var) { |
|
| 85 | - //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
| 86 | - if (!$var['multilingual'] && $key <> $this->handler->keyName) { |
|
| 87 | - $this->setControl($key, 'label'); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * @param bool $onlyUrl |
|
| 94 | - * @param bool $withimage |
|
| 95 | - * @return string |
|
| 96 | - */ |
|
| 97 | - public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
| 98 | - { |
|
| 99 | - $controller = new SmartObjectController($this->handler); |
|
| 100 | - |
|
| 101 | - return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
| 102 | - } |
|
| 27 | + /** |
|
| 28 | + * SmartMlObject constructor. |
|
| 29 | + */ |
|
| 30 | + public function __construct() |
|
| 31 | + { |
|
| 32 | + $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
| 33 | + $this->setControl('language', 'language'); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * If object is not new, change the control of the not-multilanguage fields |
|
| 38 | + * |
|
| 39 | + * We need to intercept this function from SmartObject because if the object is not new... |
|
| 40 | + */ |
|
| 41 | + // function getForm() { |
|
| 42 | + |
|
| 43 | + //} |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Strip Multilanguage Fields |
|
| 47 | + * |
|
| 48 | + * Get rid of all the multilanguage fields to have an object with only global fields. |
|
| 49 | + * This will be usefull when creating the ML object for the first time. Then we will be able |
|
| 50 | + * to create translations. |
|
| 51 | + */ |
|
| 52 | + public function stripMultilanguageFields() |
|
| 53 | + { |
|
| 54 | + $objectVars =& $this->getVars(); |
|
| 55 | + $newObjectVars = array(); |
|
| 56 | + foreach ($objectVars as $key => $var) { |
|
| 57 | + if (!$var['multilingual']) { |
|
| 58 | + $newObjectVars[$key] = $var; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + $this->vars = $newObjectVars; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + public function stripNonMultilanguageFields() |
|
| 65 | + { |
|
| 66 | + $objectVars =& $this->getVars(); |
|
| 67 | + $newObjectVars = array(); |
|
| 68 | + foreach ($objectVars as $key => $var) { |
|
| 69 | + if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
| 70 | + $newObjectVars[$key] = $var; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + $this->vars = $newObjectVars; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Make non multilanguage fields read only |
|
| 78 | + * |
|
| 79 | + * This is used when we are creating/editing a translation. |
|
| 80 | + * We only want to edit the multilanguag fields, not the global one. |
|
| 81 | + */ |
|
| 82 | + public function makeNonMLFieldReadOnly() |
|
| 83 | + { |
|
| 84 | + foreach ($this->getVars() as $key => $var) { |
|
| 85 | + //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
| 86 | + if (!$var['multilingual'] && $key <> $this->handler->keyName) { |
|
| 87 | + $this->setControl($key, 'label'); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * @param bool $onlyUrl |
|
| 94 | + * @param bool $withimage |
|
| 95 | + * @return string |
|
| 96 | + */ |
|
| 97 | + public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
| 98 | + { |
|
| 99 | + $controller = new SmartObjectController($this->handler); |
|
| 100 | + |
|
| 101 | + return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,55 +107,55 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | class SmartPersistableMlObjectHandler extends SmartPersistableObjectHandler |
| 109 | 109 | { |
| 110 | - /** |
|
| 111 | - * @param null $criteria |
|
| 112 | - * @param bool $id_as_key |
|
| 113 | - * @param bool $as_object |
|
| 114 | - * @param bool $debug |
|
| 115 | - * @param bool $language |
|
| 116 | - * @return array |
|
| 117 | - */ |
|
| 118 | - public function getObjects($criteria = null, $id_as_key = false, $as_object = true, $debug = false, $language = false) |
|
| 119 | - { |
|
| 120 | - // Create the first part of the SQL query to join the "_text" table |
|
| 121 | - $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName; |
|
| 122 | - |
|
| 123 | - if ($language) { |
|
| 124 | - // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
| 125 | - |
|
| 126 | - // if no criteria was previously created, let's create it |
|
| 127 | - if (!$criteria) { |
|
| 128 | - $criteria = new CriteriaCompo(); |
|
| 129 | - } |
|
| 130 | - $criteria->add(new Criteria('language', $language)); |
|
| 131 | - |
|
| 132 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * @param mixed $id |
|
| 140 | - * @param bool $language |
|
| 141 | - * @param bool $as_object |
|
| 142 | - * @param bool $debug |
|
| 143 | - * @return mixed |
|
| 144 | - */ |
|
| 145 | - public function &get($id, $language = false, $as_object = true, $debug = false) |
|
| 146 | - { |
|
| 147 | - if (!$language) { |
|
| 148 | - return parent::get($id, $as_object, $debug); |
|
| 149 | - } else { |
|
| 150 | - $criteria = new CriteriaCompo(); |
|
| 151 | - $criteria->add(new Criteria('language', $language)); |
|
| 152 | - |
|
| 153 | - return parent::get($id, $as_object, $debug, $criteria); |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - public function changeTableNameForML() |
|
| 158 | - { |
|
| 159 | - $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
| 160 | - } |
|
| 110 | + /** |
|
| 111 | + * @param null $criteria |
|
| 112 | + * @param bool $id_as_key |
|
| 113 | + * @param bool $as_object |
|
| 114 | + * @param bool $debug |
|
| 115 | + * @param bool $language |
|
| 116 | + * @return array |
|
| 117 | + */ |
|
| 118 | + public function getObjects($criteria = null, $id_as_key = false, $as_object = true, $debug = false, $language = false) |
|
| 119 | + { |
|
| 120 | + // Create the first part of the SQL query to join the "_text" table |
|
| 121 | + $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName; |
|
| 122 | + |
|
| 123 | + if ($language) { |
|
| 124 | + // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
| 125 | + |
|
| 126 | + // if no criteria was previously created, let's create it |
|
| 127 | + if (!$criteria) { |
|
| 128 | + $criteria = new CriteriaCompo(); |
|
| 129 | + } |
|
| 130 | + $criteria->add(new Criteria('language', $language)); |
|
| 131 | + |
|
| 132 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * @param mixed $id |
|
| 140 | + * @param bool $language |
|
| 141 | + * @param bool $as_object |
|
| 142 | + * @param bool $debug |
|
| 143 | + * @return mixed |
|
| 144 | + */ |
|
| 145 | + public function &get($id, $language = false, $as_object = true, $debug = false) |
|
| 146 | + { |
|
| 147 | + if (!$language) { |
|
| 148 | + return parent::get($id, $as_object, $debug); |
|
| 149 | + } else { |
|
| 150 | + $criteria = new CriteriaCompo(); |
|
| 151 | + $criteria->add(new Criteria('language', $language)); |
|
| 152 | + |
|
| 153 | + return parent::get($id, $as_object, $debug, $criteria); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + public function changeTableNameForML() |
|
| 158 | + { |
|
| 159 | + $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
| 160 | + } |
|
| 161 | 161 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function stripMultilanguageFields() |
| 53 | 53 | { |
| 54 | - $objectVars =& $this->getVars(); |
|
| 54 | + $objectVars = & $this->getVars(); |
|
| 55 | 55 | $newObjectVars = array(); |
| 56 | 56 | foreach ($objectVars as $key => $var) { |
| 57 | 57 | if (!$var['multilingual']) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function stripNonMultilanguageFields() |
| 65 | 65 | { |
| 66 | - $objectVars =& $this->getVars(); |
|
| 66 | + $objectVars = & $this->getVars(); |
|
| 67 | 67 | $newObjectVars = array(); |
| 68 | 68 | foreach ($objectVars as $key => $var) { |
| 69 | 69 | if ($var['multilingual'] || $key == $this->handler->keyName) { |
@@ -11,31 +11,31 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormUrlLinkElement extends XoopsFormElementTray |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormUrlLinkElement constructor. |
|
| 16 | - * @param string $form_caption |
|
| 17 | - * @param string $key |
|
| 18 | - * @param string $object |
|
| 19 | - */ |
|
| 20 | - public function __construct($form_caption, $key, $object) |
|
| 21 | - { |
|
| 22 | - parent::__construct($form_caption, ' '); |
|
| 14 | + /** |
|
| 15 | + * SmartFormUrlLinkElement constructor. |
|
| 16 | + * @param string $form_caption |
|
| 17 | + * @param string $key |
|
| 18 | + * @param string $object |
|
| 19 | + */ |
|
| 20 | + public function __construct($form_caption, $key, $object) |
|
| 21 | + { |
|
| 22 | + parent::__construct($form_caption, ' '); |
|
| 23 | 23 | |
| 24 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_URL)); |
|
| 25 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 24 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_URL)); |
|
| 25 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 26 | 26 | |
| 27 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION)); |
|
| 28 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 27 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION)); |
|
| 28 | + $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 29 | 29 | |
| 30 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>')); |
|
| 31 | - $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 30 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>')); |
|
| 31 | + $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 32 | 32 | |
| 33 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
| 34 | - $targ_val = $object->getVar('target'); |
|
| 35 | - $targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val != '' ? $targ_val : '_blank'); |
|
| 36 | - $control = $object->getControl('target'); |
|
| 37 | - $targetRadio->addOptionArray($control['options']); |
|
| 33 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
| 34 | + $targ_val = $object->getVar('target'); |
|
| 35 | + $targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val != '' ? $targ_val : '_blank'); |
|
| 36 | + $control = $object->getControl('target'); |
|
| 37 | + $targetRadio->addOptionArray($control['options']); |
|
| 38 | 38 | |
| 39 | - $this->addElement($targetRadio); |
|
| 40 | - } |
|
| 39 | + $this->addElement($targetRadio); |
|
| 40 | + } |
|
| 41 | 41 | } |