@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | // show debug information |
| 5 | 5 | if(isset($enable_debug) && $enable_debug==true) { |
| 6 | - ?> |
|
| 6 | + ?> |
|
| 7 | 7 | <script language="javascript"> |
| 8 | 8 | //document.onload = removeDebug(); |
| 9 | 9 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | </style> |
| 35 | 35 | <?php |
| 36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
| 37 | - ?> |
|
| 36 | + $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
| 37 | + ?> |
|
| 38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
| 39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
| 40 | 40 | <tr> |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | // show debug information |
| 7 | -if(isset($enable_debug) && $enable_debug==true) { |
|
| 7 | +if (isset($enable_debug) && $enable_debug == true) { |
|
| 8 | 8 | ?> |
| 9 | 9 | <script language="javascript"> |
| 10 | 10 | //document.onload = removeDebug(); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | </style> |
| 37 | 37 | <?php |
| 38 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
| 38 | + $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
| 39 | 39 | ?> |
| 40 | 40 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
| 41 | 41 | <table border="0" cellspacing="0" cellpadding="0"> |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | </tr> |
| 45 | 45 | <tr> |
| 46 | 46 | <td width="70">Time taken</td> |
| 47 | - <td width="80"><?php echo printf ("%6.5f s", $totaltime); ?></td> |
|
| 47 | + <td width="80"><?php echo printf("%6.5f s", $totaltime); ?></td> |
|
| 48 | 48 | </tr> |
| 49 | 49 | </table> |
| 50 | 50 | </div> |
@@ -69,4 +69,4 @@ |
||
| 69 | 69 | cm.style.visibility = 'hidden'; |
| 70 | 70 | } |
| 71 | 71 | </script> |
| 72 | -BLOCK; |
|
| 72 | +block; |
|
@@ -4,71 +4,71 @@ |
||
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | 6 | class ContextMenu { |
| 7 | - public $id; |
|
| 7 | + public $id; |
|
| 8 | 8 | /** |
| 9 | 9 | * @var string |
| 10 | 10 | */ |
| 11 | - public $html = ''; |
|
| 11 | + public $html = ''; |
|
| 12 | 12 | /** |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $visible = false; |
|
| 15 | + public $visible = false; |
|
| 16 | 16 | /** |
| 17 | 17 | * @var int |
| 18 | 18 | */ |
| 19 | - public $width = 120; |
|
| 19 | + public $width = 120; |
|
| 20 | 20 | |
| 21 | 21 | public function __construct($id = '', $width = 120, $visible = false) { |
| 22 | - global $ContextMenuCnt; |
|
| 23 | - $ContextMenuCnt++; |
|
| 24 | - $this->html = ""; |
|
| 25 | - $this->visible = $visible ? $visible : false; |
|
| 26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 28 | - } |
|
| 22 | + global $ContextMenuCnt; |
|
| 23 | + $ContextMenuCnt++; |
|
| 24 | + $this->html = ""; |
|
| 25 | + $this->visible = $visible ? $visible : false; |
|
| 26 | + $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | + $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | public function addItem($text, $action = "", $img = "", $disabled = 0) { |
| 31 | - global $base_url, $_style; |
|
| 31 | + global $base_url, $_style; |
|
| 32 | 32 | if($disabled) { |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | - if(!$img) { |
|
| 36 | - $img = $base_url . $_style['tx']; |
|
| 37 | - } |
|
| 38 | - if(substr($action, 0, 3) == "js:") { |
|
| 39 | - $action = substr($action, 3); |
|
| 40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 42 | - } else { |
|
| 43 | - $action = "window.location.href='" . $action . "'"; |
|
| 44 | - } |
|
| 45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 35 | + if(!$img) { |
|
| 36 | + $img = $base_url . $_style['tx']; |
|
| 37 | + } |
|
| 38 | + if(substr($action, 0, 3) == "js:") { |
|
| 39 | + $action = substr($action, 3); |
|
| 40 | + } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | + $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 42 | + } else { |
|
| 43 | + $action = "window.location.href='" . $action . "'"; |
|
| 44 | + } |
|
| 45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | + $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 47 | 47 | if(substr($img, 0, 5) == 'fa fa') { |
| 48 | 48 | $img = '<i class="' . $img . '"></i>'; |
| 49 | 49 | } else if(substr($img, 0, 1) != '<') { |
| 50 | 50 | $img = '<img src="' . $img . '" />'; |
| 51 | 51 | } |
| 52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
| 53 | - } |
|
| 52 | + $this->html .= $img . ' ' . $text . '</div>'; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | public function addSeparator() { |
| 56 | - $this->html .= " |
|
| 56 | + $this->html .= " |
|
| 57 | 57 | <div class='cntxMnuSeparator'></div> |
| 58 | 58 | "; |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | public function render() { |
| 62 | - global $ContextMenuScript; |
|
| 62 | + global $ContextMenuScript; |
|
| 63 | 63 | |
| 64 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 65 | - $ContextMenuScript = ""; // reset css |
|
| 66 | - return $html; |
|
| 67 | - } |
|
| 64 | + $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 65 | + $ContextMenuScript = ""; // reset css |
|
| 66 | + return $html; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | public function getClientScriptObject() { |
| 70 | - return "getCntxMenu('" . $this->id . "')"; |
|
| 71 | - } |
|
| 70 | + return "getCntxMenu('" . $this->id . "')"; |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $ContextMenuScript = <<<BLOCK |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | global $ContextMenuCnt; |
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | -class ContextMenu { |
|
| 6 | +class ContextMenu{ |
|
| 7 | 7 | public $id; |
| 8 | 8 | /** |
| 9 | 9 | * @var string |
@@ -18,56 +18,56 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public $width = 120; |
| 20 | 20 | |
| 21 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
| 21 | + public function __construct($id = '', $width = 120, $visible = false){ |
|
| 22 | 22 | global $ContextMenuCnt; |
| 23 | 23 | $ContextMenuCnt++; |
| 24 | 24 | $this->html = ""; |
| 25 | 25 | $this->visible = $visible ? $visible : false; |
| 26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 26 | + $this->width = is_numeric($width) ? (int) $width : 120; |
|
| 27 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 30 | + public function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
| 31 | 31 | global $base_url, $_style; |
| 32 | - if($disabled) { |
|
| 32 | + if ($disabled) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | - if(!$img) { |
|
| 36 | - $img = $base_url . $_style['tx']; |
|
| 35 | + if (!$img) { |
|
| 36 | + $img = $base_url.$_style['tx']; |
|
| 37 | 37 | } |
| 38 | - if(substr($action, 0, 3) == "js:") { |
|
| 38 | + if (substr($action, 0, 3) == "js:") { |
|
| 39 | 39 | $action = substr($action, 3); |
| 40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 40 | + } else if (substr($action, 0, 3) == "hl:") { |
|
| 41 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
| 42 | 42 | } else { |
| 43 | - $action = "window.location.href='" . $action . "'"; |
|
| 43 | + $action = "window.location.href='".$action."'"; |
|
| 44 | 44 | } |
| 45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 47 | - if(substr($img, 0, 5) == 'fa fa') { |
|
| 48 | - $img = '<i class="' . $img . '"></i>'; |
|
| 49 | - } else if(substr($img, 0, 1) != '<') { |
|
| 50 | - $img = '<img src="' . $img . '" />'; |
|
| 45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
| 46 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
| 47 | + if (substr($img, 0, 5) == 'fa fa') { |
|
| 48 | + $img = '<i class="'.$img.'"></i>'; |
|
| 49 | + } else if (substr($img, 0, 1) != '<') { |
|
| 50 | + $img = '<img src="'.$img.'" />'; |
|
| 51 | 51 | } |
| 52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
| 52 | + $this->html .= $img.' '.$text.'</div>'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addSeparator() { |
|
| 55 | + public function addSeparator(){ |
|
| 56 | 56 | $this->html .= " |
| 57 | 57 | <div class='cntxMnuSeparator'></div> |
| 58 | 58 | "; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function render() { |
|
| 61 | + public function render(){ |
|
| 62 | 62 | global $ContextMenuScript; |
| 63 | 63 | |
| 64 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 64 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
| 65 | 65 | $ContextMenuScript = ""; // reset css |
| 66 | 66 | return $html; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function getClientScriptObject() { |
|
| 70 | - return "getCntxMenu('" . $this->id . "')"; |
|
| 69 | + public function getClientScriptObject(){ |
|
| 70 | + return "getCntxMenu('".$this->id."')"; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -3,7 +3,8 @@ discard block |
||
| 3 | 3 | global $ContextMenuCnt; |
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | -class ContextMenu { |
|
| 6 | +class ContextMenu |
|
| 7 | +{ |
|
| 7 | 8 | public $id; |
| 8 | 9 | /** |
| 9 | 10 | * @var string |
@@ -18,7 +19,8 @@ discard block |
||
| 18 | 19 | */ |
| 19 | 20 | public $width = 120; |
| 20 | 21 | |
| 21 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
| 22 | + public function __construct($id = '', $width = 120, $visible = false) |
|
| 23 | + { |
|
| 22 | 24 | global $ContextMenuCnt; |
| 23 | 25 | $ContextMenuCnt++; |
| 24 | 26 | $this->html = ""; |
@@ -27,7 +29,8 @@ discard block |
||
| 27 | 29 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
| 32 | + public function addItem($text, $action = "", $img = "", $disabled = 0) |
|
| 33 | + { |
|
| 31 | 34 | global $base_url, $_style; |
| 32 | 35 | if($disabled) { |
| 33 | 36 | return; |
@@ -52,13 +55,15 @@ discard block |
||
| 52 | 55 | $this->html .= $img . ' ' . $text . '</div>'; |
| 53 | 56 | } |
| 54 | 57 | |
| 55 | - public function addSeparator() { |
|
| 58 | + public function addSeparator() |
|
| 59 | + { |
|
| 56 | 60 | $this->html .= " |
| 57 | 61 | <div class='cntxMnuSeparator'></div> |
| 58 | 62 | "; |
| 59 | 63 | } |
| 60 | 64 | |
| 61 | - public function render() { |
|
| 65 | + public function render() |
|
| 66 | + { |
|
| 62 | 67 | global $ContextMenuScript; |
| 63 | 68 | |
| 64 | 69 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -66,7 +71,8 @@ discard block |
||
| 66 | 71 | return $html; |
| 67 | 72 | } |
| 68 | 73 | |
| 69 | - public function getClientScriptObject() { |
|
| 74 | + public function getClientScriptObject() |
|
| 75 | + { |
|
| 70 | 76 | return "getCntxMenu('" . $this->id . "')"; |
| 71 | 77 | } |
| 72 | 78 | } |
@@ -128,10 +128,10 @@ |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return base64_encode( |
| 131 | - 'user=' . |
|
| 132 | - $this->oauthUserEmail . |
|
| 133 | - "\001auth=Bearer " . |
|
| 134 | - $this->oauthToken . |
|
| 131 | + 'user='. |
|
| 132 | + $this->oauthUserEmail. |
|
| 133 | + "\001auth=Bearer ". |
|
| 134 | + $this->oauthToken. |
|
| 135 | 135 | "\001\001" |
| 136 | 136 | ); |
| 137 | 137 | } |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function errorMessage() |
| 36 | 36 | { |
| 37 | - return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n"; |
|
| 37 | + return '<strong>'.htmlspecialchars($this->getMessage())."</strong><br />\n"; |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -5,10 +5,10 @@ |
||
| 5 | 5 | $settings = array(); |
| 6 | 6 | if ($modx && count($modx->config)>0) $settings = $modx->config; |
| 7 | 7 | else{ |
| 8 | - $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('system_settings')); |
|
| 9 | - while ($row = $modx->db->getRow($rs)) { |
|
| 10 | - $settings[$row['setting_name']] = $row['setting_value']; |
|
| 11 | - } |
|
| 8 | + $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('system_settings')); |
|
| 9 | + while ($row = $modx->db->getRow($rs)) { |
|
| 10 | + $settings[$row['setting_name']] = $row['setting_value']; |
|
| 11 | + } |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | extract($settings, EXTR_OVERWRITE); |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | // get the settings from the database. |
| 7 | 7 | $settings = array(); |
| 8 | -if ($modx && count($modx->config)>0) $settings = $modx->config; |
|
| 9 | -else{ |
|
| 8 | +if ($modx && count($modx->config) > 0) $settings = $modx->config; |
|
| 9 | +else { |
|
| 10 | 10 | $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('system_settings')); |
| 11 | 11 | while ($row = $modx->db->getRow($rs)) { |
| 12 | 12 | $settings[$row['setting_name']] = $row['setting_value']; |
@@ -16,4 +16,4 @@ discard block |
||
| 16 | 16 | extract($settings, EXTR_OVERWRITE); |
| 17 | 17 | |
| 18 | 18 | // setup default site id - new installation should generate a unique id for the site. |
| 19 | -if(!isset($site_id)) $site_id = "MzGeQ2faT4Dw06+U49x3"; |
|
| 19 | +if (!isset($site_id)) $site_id = "MzGeQ2faT4Dw06+U49x3"; |
|
@@ -5,8 +5,9 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | // get the settings from the database. |
| 7 | 7 | $settings = array(); |
| 8 | -if ($modx && count($modx->config)>0) $settings = $modx->config; |
|
| 9 | -else{ |
|
| 8 | +if ($modx && count($modx->config)>0) { |
|
| 9 | + $settings = $modx->config; |
|
| 10 | +} else { |
|
| 10 | 11 | $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('system_settings')); |
| 11 | 12 | while ($row = $modx->db->getRow($rs)) { |
| 12 | 13 | $settings[$row['setting_name']] = $row['setting_value']; |
@@ -16,4 +17,6 @@ discard block |
||
| 16 | 17 | extract($settings, EXTR_OVERWRITE); |
| 17 | 18 | |
| 18 | 19 | // setup default site id - new installation should generate a unique id for the site. |
| 19 | -if(!isset($site_id)) $site_id = "MzGeQ2faT4Dw06+U49x3"; |
|
| 20 | +if(!isset($site_id)) { |
|
| 21 | + $site_id = "MzGeQ2faT4Dw06+U49x3"; |
|
| 22 | +} |
|
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
| 13 | 13 | $ok = false; |
| 14 | 14 | if(isset($_SESSION['mgrToken']) && $_GET['tok'] == $_SESSION['mgrToken']) { |
| 15 | - $ok = true; |
|
| 16 | - $modx->updateValidatedUserSession(); |
|
| 15 | + $ok = true; |
|
| 16 | + $modx->updateValidatedUserSession(); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | header('Content-type: application/json'); |
| 20 | 20 | if($ok) { |
| 21 | 21 | echo '{"status":"ok"}'; |
| 22 | 22 | } else { |
| 23 | - echo '{"status":"null"}'; |
|
| 23 | + echo '{"status":"null"}'; |
|
| 24 | 24 | } |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | $modx->getSettings(); |
| 12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
| 13 | 13 | $ok = false; |
| 14 | -if(isset($_SESSION['mgrToken']) && $_GET['tok'] == $_SESSION['mgrToken']) { |
|
| 14 | +if (isset($_SESSION['mgrToken']) && $_GET['tok'] == $_SESSION['mgrToken']) { |
|
| 15 | 15 | $ok = true; |
| 16 | 16 | $modx->updateValidatedUserSession(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | header('Content-type: application/json'); |
| 20 | -if($ok) { |
|
| 20 | +if ($ok) { |
|
| 21 | 21 | echo '{"status":"ok"}'; |
| 22 | 22 | } else { |
| 23 | 23 | echo '{"status":"null"}'; |
@@ -363,10 +363,10 @@ |
||
| 363 | 363 | stopWorker(); |
| 364 | 364 | |
| 365 | 365 | <?php |
| 366 | - if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
|
|
| 367 | - echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
|
|
| 368 | - } |
|
| 369 | - ?> |
|
| 366 | + if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
|
|
| 367 | + echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
|
|
| 368 | + } |
|
| 369 | + ?> |
|
| 370 | 370 | |
| 371 | 371 | var actionButtons = document.getElementById('actions'), actionSelect = document.getElementById('stay');
|
| 372 | 372 | if (actionButtons !== null && actionSelect !== null) {
|
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
@@ -17,31 +17,31 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if (!empty($_COOKIE['MODX_themeColor'])) {
|
| 20 | - $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
|
| 20 | + $body_class .= ' '.$_COOKIE['MODX_themeColor']; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
|
| 23 | +$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime; |
|
| 24 | 24 | |
| 25 | 25 | if ($modx->config['manager_theme'] == 'default') {
|
| 26 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
|
|
| 27 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
| 26 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
|
|
| 27 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
| 28 | 28 | $minifier = new Formatter\CSSMinify(); |
| 29 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
| 30 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
| 31 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
| 32 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
| 33 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
| 34 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
| 35 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
| 36 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
| 37 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
| 38 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
| 39 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
| 29 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
| 30 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
| 31 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
| 32 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
| 33 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
| 34 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
| 35 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
| 36 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
| 37 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
| 38 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
| 39 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
| 40 | 40 | $css = $minifier->minify(); |
| 41 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
| 41 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
| 42 | 42 | } |
| 43 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 44 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
| 43 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
|
|
| 44 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 57 | 57 | <link rel="stylesheet" type="text/css" href="<?= $css ?>" /> |
| 58 | 58 | <script type="text/javascript" src="media/script/tabpane.js"></script> |
| 59 | - <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?>
|
|
| 59 | + <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?>
|
|
| 60 | 60 | <?php if ($modx->config['show_picker'] != "0") { ?>
|
| 61 | 61 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js" type="text/javascript"></script> |
| 62 | 62 | <?php } ?> |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | <?php } ?> |
| 69 | 69 | |
| 70 | 70 | <!-- OnManagerMainFrameHeaderHTMLBlock --> |
| 71 | - <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?> |
|
| 71 | + <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?> |
|
| 72 | 72 | |
| 73 | 73 | <script type="text/javascript"> |
| 74 | 74 | /* <![CDATA[ */ |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | <?php |
| 366 | 366 | if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
|
| 367 | - echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
|
|
| 367 | + echo 'doRefresh('.$_REQUEST['r'].");\n";
|
|
| 368 | 368 | } |
| 369 | 369 | ?> |
| 370 | 370 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
|
|
| 2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
@@ -9,21 +9,21 @@ discard block |
||
| 9 | 9 | $modx_textdir = isset($modx_textdir) ? $modx_textdir : null; |
| 10 | 10 | $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : '';
|
| 11 | 11 | $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr'; |
| 12 | -if (!isset($modx->config['mgr_jquery_path'])) {
|
|
| 12 | +if (!isset($modx->config['mgr_jquery_path'])) { |
|
| 13 | 13 | $modx->config['mgr_jquery_path'] = 'media/script/jquery/jquery.min.js'; |
| 14 | 14 | } |
| 15 | -if (!isset($modx->config['mgr_date_picker_path'])) {
|
|
| 15 | +if (!isset($modx->config['mgr_date_picker_path'])) { |
|
| 16 | 16 | $modx->config['mgr_date_picker_path'] = 'media/script/air-datepicker/datepicker.inc.php'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if (!empty($_COOKIE['MODX_themeColor'])) {
|
|
| 19 | +if (!empty($_COOKIE['MODX_themeColor'])) { |
|
| 20 | 20 | $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
| 24 | 24 | |
| 25 | -if ($modx->config['manager_theme'] == 'default') {
|
|
| 26 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
|
|
| 25 | +if ($modx->config['manager_theme'] == 'default') { |
|
| 26 | + if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
| 27 | 27 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
| 28 | 28 | $minifier = new Formatter\CSSMinify(); |
| 29 | 29 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $css = $minifier->minify(); |
| 41 | 41 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
| 42 | 42 | } |
| 43 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
|
|
| 43 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
| 44 | 44 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | stopWorker(); |
| 364 | 364 | |
| 365 | 365 | <?php |
| 366 | - if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
|
|
| 366 | + if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
| 367 | 367 | echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
|
| 368 | 368 | } |
| 369 | 369 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$modx_version = '1.5.0-beta'; // Current version number |
|
| 3 | -$modx_release_date = 'Jan 26, 2018'; // Date of release |
|
| 4 | -$modx_branch = 'Evolution'; // Codebase name |
|
| 2 | +$modx_version = '1.5.0-beta'; // Current version number |
|
| 3 | +$modx_release_date = 'Jan 26, 2018'; // Date of release |
|
| 4 | +$modx_branch = 'Evolution'; // Codebase name |
|
| 5 | 5 | $modx_full_appname = "{$modx_branch} {$modx_version} ({$modx_release_date})"; |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // DISPLAY FORM ELEMENTS |
| 3 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
| 3 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){ |
|
| 4 | 4 | global $modx; |
| 5 | 5 | global $_style; |
| 6 | 6 | global $_lang; |
| 7 | 7 | global $content; |
| 8 | 8 | global $which_browser; |
| 9 | 9 | |
| 10 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
| 10 | + if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
| 11 | 11 | $eval_str = trim(substr($default_text, 7)); |
| 12 | 12 | $default_text = eval($eval_str); |
| 13 | 13 | $field_value = $default_text; |
@@ -15,74 +15,74 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | $field_html = ''; |
| 17 | 17 | $cimode = strpos($field_type, ':'); |
| 18 | - if($cimode === false) { |
|
| 19 | - switch($field_type) { |
|
| 18 | + if ($cimode === false) { |
|
| 19 | + switch ($field_type) { |
|
| 20 | 20 | |
| 21 | 21 | case "text": // handler for regular text boxes |
| 22 | 22 | case "rawtext"; // non-htmlentity converted text boxes |
| 23 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
| 23 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
| 24 | 24 | break; |
| 25 | 25 | case "email": // handles email input fields |
| 26 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
| 26 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
| 27 | 27 | break; |
| 28 | 28 | case "number": // handles the input of numbers |
| 29 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
| 29 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
| 30 | 30 | break; |
| 31 | 31 | case "textareamini": // handler for textarea mini boxes |
| 32 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 32 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
| 33 | 33 | break; |
| 34 | 34 | case "textarea": // handler for textarea boxes |
| 35 | 35 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
| 36 | 36 | case "htmlarea": // handler for textarea boxes (deprecated) |
| 37 | 37 | case "richtext": // handler for textarea boxes |
| 38 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 38 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
| 39 | 39 | break; |
| 40 | 40 | case "date": |
| 41 | 41 | $field_id = str_replace(array( |
| 42 | 42 | '-', |
| 43 | 43 | '.' |
| 44 | 44 | ), '_', urldecode($field_id)); |
| 45 | - if($field_value == '') { |
|
| 45 | + if ($field_value == '') { |
|
| 46 | 46 | $field_value = 0; |
| 47 | 47 | } |
| 48 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
| 49 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
| 48 | + $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />'; |
|
| 49 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>'; |
|
| 50 | 50 | |
| 51 | 51 | break; |
| 52 | 52 | case "dropdown": // handler for select boxes |
| 53 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
| 53 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
| 54 | 54 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
| 55 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 55 | + while (list($item, $itemvalue) = each($index_list)) { |
|
| 56 | 56 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
| 57 | - if(strlen($itemvalue) == 0) { |
|
| 57 | + if (strlen($itemvalue) == 0) { |
|
| 58 | 58 | $itemvalue = $item; |
| 59 | 59 | } |
| 60 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 60 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
| 61 | 61 | } |
| 62 | 62 | $field_html .= "</select>"; |
| 63 | 63 | break; |
| 64 | 64 | case "listbox": // handler for select boxes |
| 65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
| 65 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
| 66 | 66 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
| 67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 67 | + while (list($item, $itemvalue) = each($index_list)) { |
|
| 68 | 68 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
| 69 | - if(strlen($itemvalue) == 0) { |
|
| 69 | + if (strlen($itemvalue) == 0) { |
|
| 70 | 70 | $itemvalue = $item; |
| 71 | 71 | } |
| 72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 72 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
| 73 | 73 | } |
| 74 | 74 | $field_html .= "</select>"; |
| 75 | 75 | break; |
| 76 | 76 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
| 77 | 77 | $field_value = explode("||", $field_value); |
| 78 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
| 78 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
| 79 | 79 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
| 80 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 80 | + while (list($item, $itemvalue) = each($index_list)) { |
|
| 81 | 81 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
| 82 | - if(strlen($itemvalue) == 0) { |
|
| 82 | + if (strlen($itemvalue) == 0) { |
|
| 83 | 83 | $itemvalue = $item; |
| 84 | 84 | } |
| 85 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 85 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
| 86 | 86 | } |
| 87 | 87 | $field_html .= "</select>"; |
| 88 | 88 | break; |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | 'ftp://' => 'ftp://', |
| 95 | 95 | 'mailto:' => 'mailto:' |
| 96 | 96 | ); |
| 97 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
| 98 | - foreach($urls as $k => $v) { |
|
| 99 | - if(strpos($field_value, $v) === false) { |
|
| 100 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
| 97 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">'; |
|
| 98 | + foreach ($urls as $k => $v) { |
|
| 99 | + if (strpos($field_value, $v) === false) { |
|
| 100 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
| 101 | 101 | } else { |
| 102 | 102 | $field_value = str_replace($v, '', $field_value); |
| 103 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
| 103 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | $field_html .= '</select></td><td>'; |
| 107 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
| 107 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
| 108 | 108 | break; |
| 109 | 109 | case 'checkbox': // handles check boxes |
| 110 | 110 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
| 113 | 113 | static $i = 0; |
| 114 | 114 | $_ = array(); |
| 115 | - foreach($index_list as $c => $item) { |
|
| 116 | - if(is_array($item)) { |
|
| 115 | + foreach ($index_list as $c => $item) { |
|
| 116 | + if (is_array($item)) { |
|
| 117 | 117 | $name = trim($item[0]); |
| 118 | 118 | $value = isset($item[1]) ? $item[1] : $name; |
| 119 | 119 | } else { |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | case "option": // handles radio buttons |
| 140 | 140 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
| 141 | 141 | static $i = 0; |
| 142 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 142 | + while (list($item, $itemvalue) = each($index_list)) { |
|
| 143 | 143 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
| 144 | - if(strlen($itemvalue) == 0) { |
|
| 144 | + if (strlen($itemvalue) == 0) { |
|
| 145 | 145 | $itemvalue = $item; |
| 146 | 146 | } |
| 147 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
| 147 | + $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />'; |
|
| 148 | 148 | $i++; |
| 149 | 149 | } |
| 150 | 150 | break; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | global $_lang; |
| 153 | 153 | global $ResourceManagerLoaded; |
| 154 | 154 | global $content, $use_editor, $which_editor; |
| 155 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 155 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 156 | 156 | $field_html .= " |
| 157 | 157 | <script type=\"text/javascript\"> |
| 158 | 158 | /* <![CDATA[ */ |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | lastImageCtrl = ctrl; |
| 175 | 175 | var w = screen.width * 0.5; |
| 176 | 176 | var h = screen.height * 0.5; |
| 177 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
| 177 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
| 178 | 178 | } |
| 179 | 179 | function BrowseFileServer(ctrl) { |
| 180 | 180 | lastFileCtrl = ctrl; |
| 181 | 181 | var w = screen.width * 0.5; |
| 182 | 182 | var h = screen.height * 0.5; |
| 183 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
| 183 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
| 184 | 184 | } |
| 185 | 185 | function SetUrlChange(el) { |
| 186 | 186 | if ('createEvent' in document) { |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | </script>"; |
| 215 | 215 | $ResourceManagerLoaded = true; |
| 216 | 216 | } |
| 217 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
| 217 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />'; |
|
| 218 | 218 | break; |
| 219 | 219 | case "file": // handles the input of file uploads |
| 220 | 220 | /* Modified by Timon for use with resource browser */ |
| 221 | 221 | global $_lang; |
| 222 | 222 | global $ResourceManagerLoaded; |
| 223 | 223 | global $content, $use_editor, $which_editor; |
| 224 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 224 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 225 | 225 | /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
| 226 | 226 | $field_html .= " |
| 227 | 227 | <script type=\"text/javascript\"> |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | lastImageCtrl = ctrl; |
| 245 | 245 | var w = screen.width * 0.5; |
| 246 | 246 | var h = screen.height * 0.5; |
| 247 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
| 247 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
| 248 | 248 | } |
| 249 | 249 | function BrowseFileServer(ctrl) { |
| 250 | 250 | lastFileCtrl = ctrl; |
| 251 | 251 | var w = screen.width * 0.5; |
| 252 | 252 | var h = screen.height * 0.5; |
| 253 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
| 253 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
| 254 | 254 | } |
| 255 | 255 | function SetUrlChange(el) { |
| 256 | 256 | if ('createEvent' in document) { |
@@ -284,39 +284,39 @@ discard block |
||
| 284 | 284 | </script>"; |
| 285 | 285 | $ResourceManagerLoaded = true; |
| 286 | 286 | } |
| 287 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
| 287 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />'; |
|
| 288 | 288 | |
| 289 | 289 | break; |
| 290 | 290 | |
| 291 | 291 | case 'custom_tv': |
| 292 | 292 | $custom_output = ''; |
| 293 | 293 | /* If we are loading a file */ |
| 294 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
| 295 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
| 296 | - if(!file_exists($file_name)) { |
|
| 297 | - $custom_output = $file_name . ' does not exist'; |
|
| 294 | + if (substr($field_elements, 0, 5) == "@FILE") { |
|
| 295 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
| 296 | + if (!file_exists($file_name)) { |
|
| 297 | + $custom_output = $file_name.' does not exist'; |
|
| 298 | 298 | } else { |
| 299 | 299 | $custom_output = file_get_contents($file_name); |
| 300 | 300 | } |
| 301 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
| 302 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
| 303 | - if(!file_exists($file_name)) { |
|
| 304 | - $custom_output = $file_name . ' does not exist'; |
|
| 301 | + } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
|
| 302 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
| 303 | + if (!file_exists($file_name)) { |
|
| 304 | + $custom_output = $file_name.' does not exist'; |
|
| 305 | 305 | } else { |
| 306 | 306 | ob_start(); |
| 307 | 307 | include $file_name; |
| 308 | 308 | $custom_output = ob_get_contents(); |
| 309 | 309 | ob_end_clean(); |
| 310 | 310 | } |
| 311 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
| 311 | + } elseif (substr($field_elements, 0, 6) == "@CHUNK") { |
|
| 312 | 312 | $chunk_name = trim(substr($field_elements, 7)); |
| 313 | 313 | $chunk_body = $modx->getChunk($chunk_name); |
| 314 | - if($chunk_body == false) { |
|
| 315 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
| 314 | + if ($chunk_body == false) { |
|
| 315 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
| 316 | 316 | } else { |
| 317 | 317 | $custom_output = $chunk_body; |
| 318 | 318 | } |
| 319 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
| 319 | + } elseif (substr($field_elements, 0, 5) == "@EVAL") { |
|
| 320 | 320 | $eval_str = trim(substr($field_elements, 6)); |
| 321 | 321 | $custom_output = eval($eval_str); |
| 322 | 322 | } else { |
@@ -337,15 +337,15 @@ discard block |
||
| 337 | 337 | break; |
| 338 | 338 | |
| 339 | 339 | default: // the default handler -- for errors, mostly |
| 340 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
| 340 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
| 341 | 341 | |
| 342 | 342 | } // end switch statement |
| 343 | 343 | } else { |
| 344 | 344 | $custom = explode(":", $field_type); |
| 345 | 345 | $custom_output = ''; |
| 346 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
| 347 | - if(!file_exists($file_name)) { |
|
| 348 | - $custom_output = $file_name . ' does not exist'; |
|
| 346 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
| 347 | + if (!file_exists($file_name)) { |
|
| 348 | + $custom_output = $file_name.' does not exist'; |
|
| 349 | 349 | } else { |
| 350 | 350 | ob_start(); |
| 351 | 351 | include $file_name; |
@@ -368,13 +368,13 @@ discard block |
||
| 368 | 368 | return $field_html; |
| 369 | 369 | } // end renderFormElement function |
| 370 | 370 | |
| 371 | -function ParseIntputOptions($v) { |
|
| 371 | +function ParseIntputOptions($v){ |
|
| 372 | 372 | global $modx; |
| 373 | 373 | $a = array(); |
| 374 | - if(is_array($v)) { |
|
| 374 | + if (is_array($v)) { |
|
| 375 | 375 | return $v; |
| 376 | - } else if($modx->db->isResult($v)) { |
|
| 377 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 376 | + } else if ($modx->db->isResult($v)) { |
|
| 377 | + while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 378 | 378 | } else { |
| 379 | 379 | $a = explode("||", $v); |
| 380 | 380 | } |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // DISPLAY FORM ELEMENTS |
| 3 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
| 3 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) |
|
| 4 | +{ |
|
| 4 | 5 | global $modx; |
| 5 | 6 | global $_style; |
| 6 | 7 | global $_lang; |
@@ -368,13 +369,16 @@ discard block |
||
| 368 | 369 | return $field_html; |
| 369 | 370 | } // end renderFormElement function |
| 370 | 371 | |
| 371 | -function ParseIntputOptions($v) { |
|
| 372 | +function ParseIntputOptions($v) |
|
| 373 | +{ |
|
| 372 | 374 | global $modx; |
| 373 | 375 | $a = array(); |
| 374 | 376 | if(is_array($v)) { |
| 375 | 377 | return $v; |
| 376 | 378 | } else if($modx->db->isResult($v)) { |
| 377 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 379 | + while($cols = $modx->db->getRow($v, 'num')) { |
|
| 380 | + $a[] = $cols; |
|
| 381 | + } |
|
| 378 | 382 | } else { |
| 379 | 383 | $a = explode("||", $v); |
| 380 | 384 | } |
@@ -1,159 +1,159 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // DISPLAY FORM ELEMENTS |
| 3 | 3 | function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
| 4 | - global $modx; |
|
| 5 | - global $_style; |
|
| 6 | - global $_lang; |
|
| 7 | - global $content; |
|
| 8 | - global $which_browser; |
|
| 4 | + global $modx; |
|
| 5 | + global $_style; |
|
| 6 | + global $_lang; |
|
| 7 | + global $content; |
|
| 8 | + global $which_browser; |
|
| 9 | 9 | |
| 10 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
| 11 | - $eval_str = trim(substr($default_text, 7)); |
|
| 12 | - $default_text = eval($eval_str); |
|
| 13 | - $field_value = $default_text; |
|
| 14 | - } |
|
| 10 | + if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
| 11 | + $eval_str = trim(substr($default_text, 7)); |
|
| 12 | + $default_text = eval($eval_str); |
|
| 13 | + $field_value = $default_text; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - $field_html = ''; |
|
| 17 | - $cimode = strpos($field_type, ':'); |
|
| 18 | - if($cimode === false) { |
|
| 19 | - switch($field_type) { |
|
| 16 | + $field_html = ''; |
|
| 17 | + $cimode = strpos($field_type, ':'); |
|
| 18 | + if($cimode === false) { |
|
| 19 | + switch($field_type) { |
|
| 20 | 20 | |
| 21 | - case "text": // handler for regular text boxes |
|
| 22 | - case "rawtext"; // non-htmlentity converted text boxes |
|
| 23 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
| 24 | - break; |
|
| 25 | - case "email": // handles email input fields |
|
| 26 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
| 27 | - break; |
|
| 28 | - case "number": // handles the input of numbers |
|
| 29 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
| 30 | - break; |
|
| 31 | - case "textareamini": // handler for textarea mini boxes |
|
| 32 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 33 | - break; |
|
| 34 | - case "textarea": // handler for textarea boxes |
|
| 35 | - case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
| 36 | - case "htmlarea": // handler for textarea boxes (deprecated) |
|
| 37 | - case "richtext": // handler for textarea boxes |
|
| 38 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 39 | - break; |
|
| 40 | - case "date": |
|
| 41 | - $field_id = str_replace(array( |
|
| 42 | - '-', |
|
| 43 | - '.' |
|
| 44 | - ), '_', urldecode($field_id)); |
|
| 45 | - if($field_value == '') { |
|
| 46 | - $field_value = 0; |
|
| 47 | - } |
|
| 48 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
| 49 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
| 21 | + case "text": // handler for regular text boxes |
|
| 22 | + case "rawtext"; // non-htmlentity converted text boxes |
|
| 23 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
| 24 | + break; |
|
| 25 | + case "email": // handles email input fields |
|
| 26 | + $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
| 27 | + break; |
|
| 28 | + case "number": // handles the input of numbers |
|
| 29 | + $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
| 30 | + break; |
|
| 31 | + case "textareamini": // handler for textarea mini boxes |
|
| 32 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 33 | + break; |
|
| 34 | + case "textarea": // handler for textarea boxes |
|
| 35 | + case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
| 36 | + case "htmlarea": // handler for textarea boxes (deprecated) |
|
| 37 | + case "richtext": // handler for textarea boxes |
|
| 38 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
| 39 | + break; |
|
| 40 | + case "date": |
|
| 41 | + $field_id = str_replace(array( |
|
| 42 | + '-', |
|
| 43 | + '.' |
|
| 44 | + ), '_', urldecode($field_id)); |
|
| 45 | + if($field_value == '') { |
|
| 46 | + $field_value = 0; |
|
| 47 | + } |
|
| 48 | + $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
| 49 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
| 50 | 50 | |
| 51 | - break; |
|
| 52 | - case "dropdown": // handler for select boxes |
|
| 53 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
| 54 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 55 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 56 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 57 | - if(strlen($itemvalue) == 0) { |
|
| 58 | - $itemvalue = $item; |
|
| 59 | - } |
|
| 60 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 61 | - } |
|
| 62 | - $field_html .= "</select>"; |
|
| 63 | - break; |
|
| 64 | - case "listbox": // handler for select boxes |
|
| 65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
| 66 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 68 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 69 | - if(strlen($itemvalue) == 0) { |
|
| 70 | - $itemvalue = $item; |
|
| 71 | - } |
|
| 72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 73 | - } |
|
| 74 | - $field_html .= "</select>"; |
|
| 75 | - break; |
|
| 76 | - case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
| 77 | - $field_value = explode("||", $field_value); |
|
| 78 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
| 79 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 80 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 81 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 82 | - if(strlen($itemvalue) == 0) { |
|
| 83 | - $itemvalue = $item; |
|
| 84 | - } |
|
| 85 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 86 | - } |
|
| 87 | - $field_html .= "</select>"; |
|
| 88 | - break; |
|
| 89 | - case "url": // handles url input fields |
|
| 90 | - $urls = array( |
|
| 91 | - '' => '--', |
|
| 92 | - 'http://' => 'http://', |
|
| 93 | - 'https://' => 'https://', |
|
| 94 | - 'ftp://' => 'ftp://', |
|
| 95 | - 'mailto:' => 'mailto:' |
|
| 96 | - ); |
|
| 97 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
| 98 | - foreach($urls as $k => $v) { |
|
| 99 | - if(strpos($field_value, $v) === false) { |
|
| 100 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
| 101 | - } else { |
|
| 102 | - $field_value = str_replace($v, '', $field_value); |
|
| 103 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - $field_html .= '</select></td><td>'; |
|
| 107 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
| 108 | - break; |
|
| 109 | - case 'checkbox': // handles check boxes |
|
| 110 | - $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
| 111 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 112 | - $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
| 113 | - static $i = 0; |
|
| 114 | - $_ = array(); |
|
| 115 | - foreach($index_list as $c => $item) { |
|
| 116 | - if(is_array($item)) { |
|
| 117 | - $name = trim($item[0]); |
|
| 118 | - $value = isset($item[1]) ? $item[1] : $name; |
|
| 119 | - } else { |
|
| 120 | - $item = trim($item); |
|
| 121 | - list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
| 122 | - $item, |
|
| 123 | - $item |
|
| 124 | - ); |
|
| 125 | - } |
|
| 126 | - $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
| 127 | - $param = array( |
|
| 128 | - $modx->htmlspecialchars($value), |
|
| 129 | - $i, |
|
| 130 | - $field_id, |
|
| 131 | - $checked, |
|
| 132 | - $modx->htmlspecialchars($name) |
|
| 133 | - ); |
|
| 134 | - $_[] = vsprintf($tpl, $param); |
|
| 135 | - $i++; |
|
| 136 | - } |
|
| 137 | - $field_html = implode("\n", $_); |
|
| 138 | - break; |
|
| 139 | - case "option": // handles radio buttons |
|
| 140 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 141 | - static $i = 0; |
|
| 142 | - while(list($item, $itemvalue) = each($index_list)) { |
|
| 143 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 144 | - if(strlen($itemvalue) == 0) { |
|
| 145 | - $itemvalue = $item; |
|
| 146 | - } |
|
| 147 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
| 148 | - $i++; |
|
| 149 | - } |
|
| 150 | - break; |
|
| 151 | - case "image": // handles image fields using htmlarea image manager |
|
| 152 | - global $_lang; |
|
| 153 | - global $ResourceManagerLoaded; |
|
| 154 | - global $content, $use_editor, $which_editor; |
|
| 155 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 156 | - $field_html .= " |
|
| 51 | + break; |
|
| 52 | + case "dropdown": // handler for select boxes |
|
| 53 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
| 54 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 55 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 56 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 57 | + if(strlen($itemvalue) == 0) { |
|
| 58 | + $itemvalue = $item; |
|
| 59 | + } |
|
| 60 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 61 | + } |
|
| 62 | + $field_html .= "</select>"; |
|
| 63 | + break; |
|
| 64 | + case "listbox": // handler for select boxes |
|
| 65 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
| 66 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 67 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 68 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 69 | + if(strlen($itemvalue) == 0) { |
|
| 70 | + $itemvalue = $item; |
|
| 71 | + } |
|
| 72 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 73 | + } |
|
| 74 | + $field_html .= "</select>"; |
|
| 75 | + break; |
|
| 76 | + case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
| 77 | + $field_value = explode("||", $field_value); |
|
| 78 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
| 79 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 80 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 81 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 82 | + if(strlen($itemvalue) == 0) { |
|
| 83 | + $itemvalue = $item; |
|
| 84 | + } |
|
| 85 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
| 86 | + } |
|
| 87 | + $field_html .= "</select>"; |
|
| 88 | + break; |
|
| 89 | + case "url": // handles url input fields |
|
| 90 | + $urls = array( |
|
| 91 | + '' => '--', |
|
| 92 | + 'http://' => 'http://', |
|
| 93 | + 'https://' => 'https://', |
|
| 94 | + 'ftp://' => 'ftp://', |
|
| 95 | + 'mailto:' => 'mailto:' |
|
| 96 | + ); |
|
| 97 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
| 98 | + foreach($urls as $k => $v) { |
|
| 99 | + if(strpos($field_value, $v) === false) { |
|
| 100 | + $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
| 101 | + } else { |
|
| 102 | + $field_value = str_replace($v, '', $field_value); |
|
| 103 | + $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + $field_html .= '</select></td><td>'; |
|
| 107 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
| 108 | + break; |
|
| 109 | + case 'checkbox': // handles check boxes |
|
| 110 | + $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
| 111 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 112 | + $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
| 113 | + static $i = 0; |
|
| 114 | + $_ = array(); |
|
| 115 | + foreach($index_list as $c => $item) { |
|
| 116 | + if(is_array($item)) { |
|
| 117 | + $name = trim($item[0]); |
|
| 118 | + $value = isset($item[1]) ? $item[1] : $name; |
|
| 119 | + } else { |
|
| 120 | + $item = trim($item); |
|
| 121 | + list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
| 122 | + $item, |
|
| 123 | + $item |
|
| 124 | + ); |
|
| 125 | + } |
|
| 126 | + $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
| 127 | + $param = array( |
|
| 128 | + $modx->htmlspecialchars($value), |
|
| 129 | + $i, |
|
| 130 | + $field_id, |
|
| 131 | + $checked, |
|
| 132 | + $modx->htmlspecialchars($name) |
|
| 133 | + ); |
|
| 134 | + $_[] = vsprintf($tpl, $param); |
|
| 135 | + $i++; |
|
| 136 | + } |
|
| 137 | + $field_html = implode("\n", $_); |
|
| 138 | + break; |
|
| 139 | + case "option": // handles radio buttons |
|
| 140 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
| 141 | + static $i = 0; |
|
| 142 | + while(list($item, $itemvalue) = each($index_list)) { |
|
| 143 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
| 144 | + if(strlen($itemvalue) == 0) { |
|
| 145 | + $itemvalue = $item; |
|
| 146 | + } |
|
| 147 | + $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
| 148 | + $i++; |
|
| 149 | + } |
|
| 150 | + break; |
|
| 151 | + case "image": // handles image fields using htmlarea image manager |
|
| 152 | + global $_lang; |
|
| 153 | + global $ResourceManagerLoaded; |
|
| 154 | + global $content, $use_editor, $which_editor; |
|
| 155 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 156 | + $field_html .= " |
|
| 157 | 157 | <script type=\"text/javascript\"> |
| 158 | 158 | /* <![CDATA[ */ |
| 159 | 159 | var lastImageCtrl; |
@@ -212,18 +212,18 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | /* ]]> */ |
| 214 | 214 | </script>"; |
| 215 | - $ResourceManagerLoaded = true; |
|
| 216 | - } |
|
| 217 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
| 218 | - break; |
|
| 219 | - case "file": // handles the input of file uploads |
|
| 220 | - /* Modified by Timon for use with resource browser */ |
|
| 221 | - global $_lang; |
|
| 222 | - global $ResourceManagerLoaded; |
|
| 223 | - global $content, $use_editor, $which_editor; |
|
| 224 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 225 | - /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
| 226 | - $field_html .= " |
|
| 215 | + $ResourceManagerLoaded = true; |
|
| 216 | + } |
|
| 217 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
| 218 | + break; |
|
| 219 | + case "file": // handles the input of file uploads |
|
| 220 | + /* Modified by Timon for use with resource browser */ |
|
| 221 | + global $_lang; |
|
| 222 | + global $ResourceManagerLoaded; |
|
| 223 | + global $content, $use_editor, $which_editor; |
|
| 224 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
| 225 | + /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
| 226 | + $field_html .= " |
|
| 227 | 227 | <script type=\"text/javascript\"> |
| 228 | 228 | /* <![CDATA[ */ |
| 229 | 229 | var lastImageCtrl; |
@@ -282,101 +282,101 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | /* ]]> */ |
| 284 | 284 | </script>"; |
| 285 | - $ResourceManagerLoaded = true; |
|
| 286 | - } |
|
| 287 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
| 285 | + $ResourceManagerLoaded = true; |
|
| 286 | + } |
|
| 287 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
| 288 | 288 | |
| 289 | - break; |
|
| 289 | + break; |
|
| 290 | 290 | |
| 291 | - case 'custom_tv': |
|
| 292 | - $custom_output = ''; |
|
| 293 | - /* If we are loading a file */ |
|
| 294 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
| 295 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
| 296 | - if(!file_exists($file_name)) { |
|
| 297 | - $custom_output = $file_name . ' does not exist'; |
|
| 298 | - } else { |
|
| 299 | - $custom_output = file_get_contents($file_name); |
|
| 300 | - } |
|
| 301 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
| 302 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
| 303 | - if(!file_exists($file_name)) { |
|
| 304 | - $custom_output = $file_name . ' does not exist'; |
|
| 305 | - } else { |
|
| 306 | - ob_start(); |
|
| 307 | - include $file_name; |
|
| 308 | - $custom_output = ob_get_contents(); |
|
| 309 | - ob_end_clean(); |
|
| 310 | - } |
|
| 311 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
| 312 | - $chunk_name = trim(substr($field_elements, 7)); |
|
| 313 | - $chunk_body = $modx->getChunk($chunk_name); |
|
| 314 | - if($chunk_body == false) { |
|
| 315 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
| 316 | - } else { |
|
| 317 | - $custom_output = $chunk_body; |
|
| 318 | - } |
|
| 319 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
| 320 | - $eval_str = trim(substr($field_elements, 6)); |
|
| 321 | - $custom_output = eval($eval_str); |
|
| 322 | - } else { |
|
| 323 | - $custom_output = $field_elements; |
|
| 324 | - } |
|
| 325 | - $replacements = array( |
|
| 326 | - '[+field_type+]' => $field_type, |
|
| 327 | - '[+field_id+]' => $field_id, |
|
| 328 | - '[+default_text+]' => $default_text, |
|
| 329 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 330 | - '[+field_style+]' => $field_style, |
|
| 331 | - ); |
|
| 332 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 333 | - $modx->documentObject = $content; |
|
| 334 | - $modx->documentIdentifier = $content['id']; |
|
| 335 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 336 | - $field_html .= $custom_output; |
|
| 337 | - break; |
|
| 291 | + case 'custom_tv': |
|
| 292 | + $custom_output = ''; |
|
| 293 | + /* If we are loading a file */ |
|
| 294 | + if(substr($field_elements, 0, 5) == "@FILE") { |
|
| 295 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
| 296 | + if(!file_exists($file_name)) { |
|
| 297 | + $custom_output = $file_name . ' does not exist'; |
|
| 298 | + } else { |
|
| 299 | + $custom_output = file_get_contents($file_name); |
|
| 300 | + } |
|
| 301 | + } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
| 302 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
| 303 | + if(!file_exists($file_name)) { |
|
| 304 | + $custom_output = $file_name . ' does not exist'; |
|
| 305 | + } else { |
|
| 306 | + ob_start(); |
|
| 307 | + include $file_name; |
|
| 308 | + $custom_output = ob_get_contents(); |
|
| 309 | + ob_end_clean(); |
|
| 310 | + } |
|
| 311 | + } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
| 312 | + $chunk_name = trim(substr($field_elements, 7)); |
|
| 313 | + $chunk_body = $modx->getChunk($chunk_name); |
|
| 314 | + if($chunk_body == false) { |
|
| 315 | + $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
| 316 | + } else { |
|
| 317 | + $custom_output = $chunk_body; |
|
| 318 | + } |
|
| 319 | + } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
| 320 | + $eval_str = trim(substr($field_elements, 6)); |
|
| 321 | + $custom_output = eval($eval_str); |
|
| 322 | + } else { |
|
| 323 | + $custom_output = $field_elements; |
|
| 324 | + } |
|
| 325 | + $replacements = array( |
|
| 326 | + '[+field_type+]' => $field_type, |
|
| 327 | + '[+field_id+]' => $field_id, |
|
| 328 | + '[+default_text+]' => $default_text, |
|
| 329 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 330 | + '[+field_style+]' => $field_style, |
|
| 331 | + ); |
|
| 332 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 333 | + $modx->documentObject = $content; |
|
| 334 | + $modx->documentIdentifier = $content['id']; |
|
| 335 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 336 | + $field_html .= $custom_output; |
|
| 337 | + break; |
|
| 338 | 338 | |
| 339 | - default: // the default handler -- for errors, mostly |
|
| 340 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
| 339 | + default: // the default handler -- for errors, mostly |
|
| 340 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
| 341 | 341 | |
| 342 | - } // end switch statement |
|
| 343 | - } else { |
|
| 344 | - $custom = explode(":", $field_type); |
|
| 345 | - $custom_output = ''; |
|
| 346 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
| 347 | - if(!file_exists($file_name)) { |
|
| 348 | - $custom_output = $file_name . ' does not exist'; |
|
| 349 | - } else { |
|
| 350 | - ob_start(); |
|
| 351 | - include $file_name; |
|
| 352 | - $custom_output = ob_get_contents(); |
|
| 353 | - ob_end_clean(); |
|
| 354 | - } |
|
| 355 | - $replacements = array( |
|
| 356 | - '[+field_type+]' => $field_type, |
|
| 357 | - '[+field_id+]' => $field_id, |
|
| 358 | - '[+default_text+]' => $default_text, |
|
| 359 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 360 | - '[+field_style+]' => $field_style, |
|
| 361 | - ); |
|
| 362 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 363 | - $modx->documentObject = $content; |
|
| 364 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 365 | - $field_html .= $custom_output; |
|
| 366 | - } |
|
| 342 | + } // end switch statement |
|
| 343 | + } else { |
|
| 344 | + $custom = explode(":", $field_type); |
|
| 345 | + $custom_output = ''; |
|
| 346 | + $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
| 347 | + if(!file_exists($file_name)) { |
|
| 348 | + $custom_output = $file_name . ' does not exist'; |
|
| 349 | + } else { |
|
| 350 | + ob_start(); |
|
| 351 | + include $file_name; |
|
| 352 | + $custom_output = ob_get_contents(); |
|
| 353 | + ob_end_clean(); |
|
| 354 | + } |
|
| 355 | + $replacements = array( |
|
| 356 | + '[+field_type+]' => $field_type, |
|
| 357 | + '[+field_id+]' => $field_id, |
|
| 358 | + '[+default_text+]' => $default_text, |
|
| 359 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
| 360 | + '[+field_style+]' => $field_style, |
|
| 361 | + ); |
|
| 362 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
| 363 | + $modx->documentObject = $content; |
|
| 364 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
| 365 | + $field_html .= $custom_output; |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | - return $field_html; |
|
| 368 | + return $field_html; |
|
| 369 | 369 | } // end renderFormElement function |
| 370 | 370 | |
| 371 | 371 | function ParseIntputOptions($v) { |
| 372 | - global $modx; |
|
| 373 | - $a = array(); |
|
| 374 | - if(is_array($v)) { |
|
| 375 | - return $v; |
|
| 376 | - } else if($modx->db->isResult($v)) { |
|
| 377 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 378 | - } else { |
|
| 379 | - $a = explode("||", $v); |
|
| 380 | - } |
|
| 381 | - return $a; |
|
| 372 | + global $modx; |
|
| 373 | + $a = array(); |
|
| 374 | + if(is_array($v)) { |
|
| 375 | + return $v; |
|
| 376 | + } else if($modx->db->isResult($v)) { |
|
| 377 | + while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
| 378 | + } else { |
|
| 379 | + $a = explode("||", $v); |
|
| 380 | + } |
|
| 381 | + return $a; |
|
| 382 | 382 | } |