Code Duplication    Length = 86-89 lines in 2 locations

htdocs/class/xoopseditor/tinymce/tinymce.php 1 location

@@ 102-187 (lines=86) @@
99
        $this->setting["plugins"] = implode(",", $this->loadPlugins());
100
        $configured[] = "plugins";
101
102
        if ( $this->setting["theme"] !== "simple" ) {
103
            if (empty($this->config["buttons"])) {
104
                $this->config["buttons"][] = array(
105
                    "before"    => "",
106
                    "add"       => "",
107
                    );
108
                $this->config["buttons"][] = array(
109
                    "before"    => "",
110
                    "add"       => "",
111
                    );
112
                $this->config["buttons"][] = array(
113
                    "before"    => "",
114
                    "add"       => "",
115
                    );
116
            }
117
            $i = 0;
118
            foreach ($this->config["buttons"] as $button) {
119
                $i++;
120
                if (isset($button["before"])) {
121
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}_add_before"] = $button["before"];
122
                }
123
                if (isset($button["add"])) {
124
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}_add"] = $button["add"];
125
                }
126
                if (isset($button[""])) {
127
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] = $button[""];
128
                }
129
            }
130
            $configured[] = "buttons";
131
132
            if (isset($this->config["toolbar_location"])) {
133
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_location"] = $this->config["toolbar_location"];
134
                $configured[] = "toolbar_location";
135
            } else {
136
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_location"] = "top";
137
            }
138
139
            if (isset($this->config["toolbar_align"])) {
140
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_align"] = $this->config["toolbar_align"];
141
                $configured[] = "toolbar_align";
142
            } else {
143
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_align"] = "left";
144
            }
145
146
            if (isset($this->config["statusbar_location"])) {
147
                $this->setting["theme_" . $this->setting["theme"] . "_statusbar_location"] = $this->config["statusbar_location"];
148
                $configured[] = "statusbar_location";
149
            }
150
151
            if (isset($this->config["path_location"])) {
152
                $this->setting["theme_" . $this->setting["theme"] . "_path_location"] = $this->config["path_location"];
153
                $configured[] = "path_location";
154
            }
155
156
            if (isset($this->config["resize_horizontal"])) {
157
                $this->setting["theme_" . $this->setting["theme"] . "_resize_horizontal"] = $this->config["resize_horizontal"];
158
                $configured[] = "resize_horizontal";
159
            }
160
161
            if (isset($this->config["resizing"])) {
162
                $this->setting["theme_" . $this->setting["theme"] . "_resizing"] = $this->config["resizing"];
163
                $configured[] = "resizing";
164
            }
165
166
            if (!empty($this->config["fonts"])) {
167
                $this->setting["theme_" . $this->setting["theme"] . "_fonts"] = $this->config["fonts"];
168
                $configured[] = "fonts";
169
            }
170
171
            for ($i=1 ; $i <= 4 ; $i++ ) {
172
                $buttons = array();
173
                if ( isset($this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"]) ) {
174
                    $checklist = explode(",", $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] );
175
                    foreach ( $checklist as $plugin ) {
176
                        if ( strpos( strtolower($plugin), "xoops") !== false ) {
177
                            if ( in_array( $plugin, $this->xoopsPlugins ) ) {
178
                                $buttons[] = $plugin;
179
                            }
180
                        } else {
181
                            $buttons[] = $plugin;
182
                        }
183
                    }
184
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] = implode(",", $buttons);
185
                }
186
            }
187
        }
188
189
        $configured = array_unique($configured);
190
        foreach ($this->config as $key => $val) {

htdocs/class/xoopseditor/tinymce4/tinymce.php 1 location

@@ 111-199 (lines=89) @@
108
        $this->setting["plugins"] = implode(",", $this->loadPlugins());
109
        $configured[] = "plugins";
110
111
        if ($this->setting["theme"] !== "simple") {
112
            if (empty($this->config["buttons"])) {
113
                $this->config["buttons"][] = array(
114
                    "before"    => "",
115
                    "add"       => "",
116
                    );
117
                $this->config["buttons"][] = array(
118
                    "before"    => "",
119
                    "add"       => "",
120
                    );
121
                $this->config["buttons"][] = array(
122
                    "before"    => "",
123
                    "add"       => "",
124
                    );
125
            }
126
            $i = 0;
127
            foreach ($this->config["buttons"] as $button) {
128
                $i++;
129
                if (isset($button["before"])) {
130
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}_add_before"] = $button["before"];
131
                }
132
                if (isset($button["add"])) {
133
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}_add"] = $button["add"];
134
                }
135
                if (isset($button[""])) {
136
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] = $button[""];
137
                }
138
            }
139
            $configured[] = "buttons";
140
141
            if (isset($this->config["toolbar_location"])) {
142
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_location"]
143
                    = $this->config["toolbar_location"];
144
                $configured[] = "toolbar_location";
145
            } else {
146
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_location"] = "top";
147
            }
148
149
            if (isset($this->config["toolbar_align"])) {
150
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_align"] = $this->config["toolbar_align"];
151
                $configured[] = "toolbar_align";
152
            } else {
153
                $this->setting["theme_" . $this->setting["theme"] . "_toolbar_align"] = "left";
154
            }
155
156
            if (isset($this->config["statusbar_location"])) {
157
                $this->setting["theme_" . $this->setting["theme"] . "_statusbar_location"]
158
                    = $this->config["statusbar_location"];
159
                $configured[] = "statusbar_location";
160
            }
161
162
            if (isset($this->config["path_location"])) {
163
                $this->setting["theme_" . $this->setting["theme"] . "_path_location"] = $this->config["path_location"];
164
                $configured[] = "path_location";
165
            }
166
167
            if (isset($this->config["resize_horizontal"])) {
168
                $this->setting["theme_" . $this->setting["theme"] . "_resize_horizontal"]
169
                    = $this->config["resize_horizontal"];
170
                $configured[] = "resize_horizontal";
171
            }
172
173
            if (isset($this->config["resizing"])) {
174
                $this->setting["theme_" . $this->setting["theme"] . "_resizing"] = $this->config["resizing"];
175
                $configured[] = "resizing";
176
            }
177
178
            if (!empty($this->config["fonts"])) {
179
                $this->setting["theme_" . $this->setting["theme"] . "_fonts"] = $this->config["fonts"];
180
                $configured[] = "fonts";
181
            }
182
183
            for ($i=1; $i <= 4; $i++) {
184
                $buttons = array();
185
                if (isset($this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"])) {
186
                    $checklist = explode(",", $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"]);
187
                    foreach ($checklist as $plugin) {
188
                        if (strpos(strtolower($plugin), "xoops") !== false) {
189
                            if (in_array($plugin, $this->xoopsPlugins)) {
190
                                $buttons[] = $plugin;
191
                            }
192
                        } else {
193
                            $buttons[] = $plugin;
194
                        }
195
                    }
196
                    $this->setting["theme_" . $this->setting["theme"] . "_buttons{$i}"] = implode(",", $buttons);
197
                }
198
            }
199
        }
200
201
        $configured = array_unique($configured);
202
        foreach ($this->config as $key => $val) {