Changeset 608822
- Timestamp:
- 10/06/2012 07:38:11 AM (13 years ago)
- Location:
- edge-suite/trunk
- Files:
-
- 3 edited
-
admin/options.php (modified) (1 diff)
-
edge-suite.php (modified) (5 diffs)
-
includes/edge-suite-comp.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
edge-suite/trunk/admin/options.php
r602441 r608822 48 48 49 49 <tr valign="top"> 50 <th scope="row">Widget shortcode</th> 51 <td> 52 <?php 53 $selected = intval(get_option('edge_suite_widget_shortcode')) == 1 ? 'checked="checked"' : ''; 54 ?> 55 <p><input type="checkbox" name="edge_suite_widget_shortcode" value="1" <?php echo $selected; ?>"/> 56 Enable usage of shortcodes in widgets</p> 57 </td> 58 </tr> 59 60 <tr valign="top"> 50 61 <th scope="row">Deactivation deletion</th> 51 62 <td> -
edge-suite/trunk/edge-suite.php
r608323 r608822 89 89 add_option('edge_suite_comp_homepage', 0); 90 90 add_option('edge_suite_deactivation_delete', 0); 91 add_option('edge_suite_widget_shortcode', 0); 91 92 92 93 // Create main edge suite directory. … … 115 116 delete_option('edge_suite_comp_homepage'); 116 117 delete_option('edge_suite_deactivation_delete'); 118 delete_option('edge_suite_widget_shortcode'); 117 119 } 118 120 } … … 130 132 register_setting('edge_suite_options', 'edge_suite_comp_homepage'); 131 133 register_setting('edge_suite_options', 'edge_suite_deactivation_delete'); 134 register_setting('edge_suite_options', 'edge_suite_widget_shortcode'); 132 135 } 133 136 … … 344 347 $options = array(); 345 348 foreach ($definitions as $definition) { 346 $options[$definition->definition_id] = $definition-> project_name . ' ' . $definition->composition_id;349 $options[$definition->definition_id] = $definition->definition_id . ' - ' . $definition->project_name . ' ' . $definition->composition_id; 347 350 } 348 351 … … 367 370 } 368 371 372 /** 373 * Shortcode implementation for 'edge_animation' 374 */ 375 function edge_suite_shortcode_edge_animation( $atts ) { 376 $id = -1; 377 extract( shortcode_atts( array( 378 'id' => '-1', 379 'left' => null, 380 'top' => null, 381 ), $atts ) ); 382 383 $styles = ''; 384 385 // Add left position offset to style. 386 if(isset($left)){ 387 if($left == 'auto'){ 388 $styles .= 'margin: 0px auto;'; 389 } 390 else if(intval($left) != 0){ 391 $styles .= 'margin-left:' . $left . 'px;'; 392 } 393 } 394 395 //Add top position offset to style. 396 if(isset($top) && intval($top) != 0){ 397 $styles .= 'margin-top:' . $top . 'px;'; 398 } 399 400 $definition_id = $id; 401 $definition_res = edge_suite_comp_render($definition_id, $styles); 402 403 $stage = $scripts = ''; 404 405 if($definition_res != NULL){ 406 // Todo: Placing scripts inline in the content really isn't pretty, but so far there 407 // doesn't seem to be an easy way around this, otherwise we need to handle shortcode 408 // before header fuctions get called. 409 $scripts = implode("\n", $definition_res['scripts']); 410 411 $stage = $definition_res['stage']; 412 } 413 414 return "\n" . $scripts . "\n" . $stage ."\n"; 415 416 } 417 add_shortcode('edge_animation', 'edge_suite_shortcode_edge_animation'); 418 if(get_option('edge_suite_widget_shortcode') == 1){ 419 add_filter('widget_text', 'do_shortcode'); 420 } -
edge-suite/trunk/includes/edge-suite-comp.inc
r602441 r608822 219 219 * Array with stage content and header scripts. 220 220 */ 221 function edge_suite_comp_render($definition_id ) {221 function edge_suite_comp_render($definition_id, $styles = '') { 222 222 $scripts = array(); 223 223 $stage = ''; 224 224 if ($definition_id > 0) { 225 226 225 $definition = edge_suite_comp_load_definition($definition_id); 226 227 if(!isset($definition->project_name)){ 228 return null; 229 } 227 230 228 231 $edge_lib_path = EDGE_SUITE_PUBLIC_DIR_REL; … … 258 261 259 262 // Put everything together. 260 $stage = '<div id="' . $div_id . '" style="' . $height . $width . '" class="' . $definition->composition_id . '">' . '</div>';263 $stage = '<div id="' . $div_id . '" style="' . $height . $width . $styles . '" class="' . $definition->composition_id . '">' . '</div>'; 261 264 262 265 }
Note: See TracChangeset
for help on using the changeset viewer.