forked from k0a1a/hotglue2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_transform.inc.php
101 lines (81 loc) · 2.37 KB
/
module_transform.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* module_transform.inc.php
* Module for performing css transformations on objects
*
* Copyright Gottfried Haider, Danja Vasiliev 2010.
* This source code is licensed under the GNU General Public License.
* See the file COPYING for more details.
*/
@require_once('config.inc.php');
require_once('html.inc.php');
require_once('html_parse.inc.php');
require_once('modules.inc.php');
// module glue gets loaded on demand
// module_image.inc.php has more information on what's going on inside modules
// (they can be easier than that one though)
function transform_alter_render_early($args)
{
$elem = &$args['elem'];
$obj = $args['obj'];
if (!elem_has_class($elem, 'object')) {
return false;
}
if (!empty($obj['transform-flip'])) {
$all_transform = $obj['transform-flip'];
elem_css($elem, 'transform', $all_transform);
elem_css($elem, '-webkit-transform', $all_transform);
elem_css($elem, '-moz-transform', $all_transform);
elem_css($elem, '-o-transform', $all_transform);
elem_css($elem, '-ms-transform', $all_transform);
}
return true;
}
function transform_alter_save($args)
{
$elem = $args['elem'];
$obj = &$args['obj'];
if (!elem_has_class($elem, 'object')) {
return false;
}
if (elem_css($elem, '-webkit-transform') !== NULL) {
$obj['transform-flip'] = elem_css($elem, '-webkit-transform');
}
else if (elem_css($elem, 'transform') !== NULL) {
$moz_transform = elem_css($elem, 'transform');
$moz_transform = str_replace("px", "", $moz_transform);
$moz_transform = str_replace("pt", "", $moz_transform);
$obj['transform-flip'] = $moz_transform;
} else {
unset($obj['transform-flip']);
}
return true;
}
function transform_render_object($args)
{
$elem = &$args['elem'];
$obj = &$args['obj'];
if (!elem_has_class($elem, 'object')) {
return false;
}
if (!empty($obj['transform-flip'])) {
elem_css($elem, '-webkit-transform', $obj['transform-flip']);
elem_css($elem, '-moz-transform', $obj['transform-flip']);
}
}
function transform_render_page_early($args)
{
if ($args['edit']) {
if (USE_MIN_FILES) {
html_add_js(base_url().'modules/transform/transform.min.js');
} else {
html_add_js(base_url().'modules/transform/transform.js');
}
// html_add_css(base_url().'modules/transform/transform.css');
// html_add_js(base_url().'modules/transform/jquery.transform-0.9.3.min.js');
return true;
} else {
return false;
}
}
?>