00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 @require_once('config.inc.php');
00013 require_once('common.inc.php');
00014 require_once('html.inc.php');
00015 require_once('util.inc.php');
00016
00017
00018
00019
00020
00021
00022 function object_alter_render_early($args)
00023 {
00024 $elem = &$args['elem'];
00025 $obj = $args['obj'];
00026 if (!elem_has_class($elem, 'object')) {
00027 return false;
00028 }
00029
00030 if (!empty($obj['object-height'])) {
00031 elem_css($elem, 'height', $obj['object-height']);
00032 }
00033 if (!empty($obj['object-left'])) {
00034 elem_css($elem, 'left', $obj['object-left']);
00035 }
00036 if (!empty($obj['object-opacity'])) {
00037 elem_css($elem, 'opacity', $obj['object-opacity']);
00038 }
00039 elem_css($elem, 'position', 'absolute');
00040 if (!empty($obj['object-top'])) {
00041 elem_css($elem, 'top', $obj['object-top']);
00042 }
00043 if (!empty($obj['object-width'])) {
00044 elem_css($elem, 'width', $obj['object-width']);
00045 }
00046 if (!empty($obj['object-zindex'])) {
00047 elem_css($elem, 'z-index', $obj['object-zindex']);
00048 }
00049
00050 return true;
00051 }
00052
00053
00054 function object_alter_render_late($args)
00055 {
00056 $elem = $args['elem'];
00057 $html = &$args['html'];
00058 $obj = $args['obj'];
00059 if (!elem_has_class($args['elem'], 'object')) {
00060 return false;
00061 }
00062
00063 if (!$args['edit']) {
00064
00065 if (!empty($obj['object-link'])) {
00066 $link = $obj['object-link'];
00067
00068 $link = resolve_aliases($link, $obj['name']);
00069 if (!is_url($link) && substr($link, 0, 1) != '#') {
00070
00071 if (SHORT_URLS) {
00072 $link = base_url().urlencode($link);
00073 } else {
00074 $link = base_url().'?'.urlencode($link);
00075 }
00076 }
00077
00078 if (substr($html, -1) == "\n") {
00079 $html = substr($html, 0, -1);
00080 }
00081 $html = '<a href="'.htmlspecialchars($link, ENT_COMPAT, 'UTF-8').'">'."\n\t".str_replace("\n", "\n\t", $html)."\n".'</a>'."\n";
00082 return true;
00083 }
00084 }
00085 return false;
00086 }
00087
00088
00089 function object_alter_save($args)
00090 {
00091 $elem = $args['elem'];
00092 $obj = &$args['obj'];
00093 if (!elem_has_class($elem, 'object')) {
00094 return false;
00095 }
00096
00097 if (elem_css($elem, 'height') !== NULL) {
00098 $obj['object-height'] = elem_css($elem, 'height');
00099 } else {
00100 unset($obj['object-height']);
00101 }
00102 if (elem_css($elem, 'left') !== NULL) {
00103 $obj['object-left'] = elem_css($elem, 'left');
00104 } else {
00105 unset($obj['object-left']);
00106 }
00107 if (elem_css($elem, 'opacity') !== NULL) {
00108 $obj['object-opacity'] = elem_css($elem, 'opacity');
00109 } else {
00110 unset($obj['object-opacity']);
00111 }
00112 if (elem_css($elem, 'top') !== NULL) {
00113 $obj['object-top'] = elem_css($elem, 'top');
00114 } else {
00115 unset($obj['object-top']);
00116 }
00117 if (elem_css($elem, 'width') !== NULL) {
00118 $obj['object-width'] = elem_css($elem, 'width');
00119 } else {
00120 unset($obj['object-width']);
00121 }
00122 if (elem_css($elem, 'z-index') !== NULL) {
00123 $obj['object-zindex'] = elem_css($elem, 'z-index');
00124 } else {
00125 unset($obj['object-zindex']);
00126 }
00127
00128 return true;
00129 }
00130
00131
00132 function object_render_page_early($args)
00133 {
00134 if ($args['edit']) {
00135 if (USE_MIN_FILES) {
00136 html_add_js(base_url().'modules/object/object-edit.min.js');
00137 } else {
00138 html_add_js(base_url().'modules/object/object-edit.js');
00139 }
00140
00141
00142 html_add_js_var('$.glue.conf.object.default_colors', expl(' ', OBJECT_DEFAULT_COLORS));
00143 }
00144 }