| [ Index ] |
PHP Cross Reference of PageLines Framework |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Option Engine Class 4 * 5 * Sorts and Draws options based on the 'option array' 6 * Option array is loaded in config.option.php and through filters 7 * 8 * @package PageLines Framework 9 * @subpackage Options 10 * @since 1.0 11 * 12 * @version 2.2 - implement 'docstitle' setting ... see get_option_title() 13 */ 14 class OptEngine { 15 16 /** 17 * PHP5 Constructor 18 * 19 * @param null $settings_field 20 * @version 2.2 - alphabetized defaults listing; add 'docstitle' setting 21 */ 22 function __construct( $settings_field = null ) { 23 24 $this->settings_field = $settings_field; 25 26 $this->defaults = array( 27 'callback' => '', 28 'clone_id' => 1, 29 'count_number' => 10, 30 'css_prop' => '', 31 'default' => '', 32 'default_free' => null, 33 'disabled' => false, 34 'disabled_mode' => false, 35 'docslink' => null, 36 'docstitle' => '', 37 'exp' => '', 38 'fields' => array(), 39 'flag' => '', 40 'htabs' => array(), 41 'height' => '0px', 42 'imagepreview' => 200, 43 'inputlabel' => '', 44 'inputsize' => 'regular', 45 'layout' => 'normal', 46 'options' => array(), 47 'optionicon' => '', 48 'pid' => '', 49 'placeholder' => false, 50 'post_id' => '', 51 'pro_note' => false, 52 'section' => '', 53 'selectors' => '', 54 'selectvalues' => array(), 55 'scontrol' => '', 56 'shortexp' => '', 57 'setting' => '', 58 'showname' => false, 59 'special' => null, 60 'sprite' => '', 61 'type' => 'check', 62 'title' => '', 63 'version' => null, 64 'version_set_default' => 'free', 65 'vidlink' => null, 66 'vidtitle' => '', 67 'width' => '0px', 68 'wp_option' => false 69 ); 70 71 } 72 73 74 /** 75 * 76 * @TODO document 77 * 78 */ 79 function make_adjustments($o){ 80 81 if($o['type'] == 'color_multi' || $o['type'] == 'text_content' || $o['inputsize'] == 'big' || $o['type'] == 'multi_option'){ 82 $o['layout'] = 'full'; 83 } 84 85 if($o['type'] == 'text_content_reverse' ){ 86 $o['layout'] = 'interface'; 87 } 88 89 global $supported_elements; 90 91 92 $support = (isset($supported_elements['sections'][ $o['section'] ])) ? $supported_elements['sections'][ $o['section'] ] : false; 93 94 if( $support && $o['type'] == 'color_multi' && $support['disable_color'] ) 95 $o['disabled'] = true; 96 97 global $disabled_settings; 98 99 if( $o['disabled_mode'] && isset($disabled_settings[$o['disabled_mode']]) ) 100 $o['disabled'] = true; 101 102 return $o; 103 } 104 105 /** 106 * Option generation engine 107 * 108 * Flag needed for post id/profile id -- settings for special handling. 109 */ 110 function option_engine($oid, $o, $flag = null, $setting = null){ 111 112 $o = wp_parse_args( $o, $this->defaults ); 113 114 $o = $this->make_adjustments($o); 115 116 if($o['disabled']) 117 return; 118 119 $setting = (isset($this->settings_field)) ? $this->settings_field : PAGELINES_SETTINGS; 120 121 $oset = array( 'setting' => $setting ); 122 123 if($o['type'] == 'select_same'){ 124 125 $new = array_flip($o['selectvalues']); 126 127 foreach($new as $key => $val) 128 $new[$key] = array('name' => $key); 129 130 $o['selectvalues'] = $new; 131 132 } 133 134 135 if($this->settings_field == 'meta'){ 136 137 $oset['post_id'] = $flag; 138 139 $o['pid'] = $flag; 140 141 $o['input_id'] = get_pagelines_option_id( $oid ); 142 143 if( $o['type'] == 'check' && (bool) pldefault( $oid )){ 144 145 $o['val'] = plmeta($oid.'_reverse', $oset); 146 $o['input_name'] = $oid.'_reverse'; 147 $o['inputlabel'] = '(Turn Off) ' . $o['inputlabel']; 148 149 }else{ 150 $o['val'] = plmeta($oid, $oset); 151 $o['input_name'] = $oid; 152 } 153 154 // Check is difficult w/ defaults got to compensate 155 $o['placeholder'] = pldefault( $oid, $oset); 156 157 158 // Parse through multi-selects 159 if(!empty($o['selectvalues'])){ 160 foreach($o['selectvalues'] as $sid => $s){ 161 162 $o['selectvalues'][$sid]['val'] = plmeta($sid, $oset); 163 $o['selectvalues'][$sid]['input_id'] = get_pagelines_option_id( $oid, $sid ); 164 $o['selectvalues'][$sid]['input_name'] = $sid; 165 $o['selectvalues'][$sid]['placeholder'] = pldefault( $sid, $oset); 166 167 } 168 } 169 170 } elseif($this->settings_field == 'profile'){ 171 172 $user = $flag; 173 174 $o['val'] = pl_um($oid, $user->ID); 175 $o['input_name'] = $oid; 176 $o['input_id'] = get_pagelines_option_id( $oid ); 177 178 if(!empty($o['selectvalues'])){ 179 foreach($o['selectvalues'] as $sid => $s){ 180 181 $o['selectvalues'][$sid]['val'] = pl_um( $oid, $user->ID); 182 $o['selectvalues'][$sid]['input_id'] = get_pagelines_option_id( $sid ); 183 $o['selectvalues'][$sid]['input_name'] = $sid; 184 185 } 186 } 187 188 } elseif($this->settings_field == PAGELINES_SPECIAL){ 189 190 191 if( $o['special'] != 'default' && $o['type'] == 'check' && (bool) pldefault( $oid )){ 192 $oset['subkey'] = $oid.'_reverse'; 193 $o['inputlabel'] = '(Turn Off) ' . $o['inputlabel']; 194 195 }else{ 196 $oset['subkey'] = $oid; 197 } 198 199 $o['val'] = ploption( $o['special'], $oset ); 200 $o['input_name'] = plname($o['special'], $oset); 201 $o['input_id'] = plid( $o['special'], $oset); 202 203 $o['placeholder'] = pldefault( $oid, $oset); 204 205 // What a hassle. 206 // Allow global option for text content (no sub key) 207 // If 'hidden' then option will be nuked on save, so in class.sections.php 208 // there is an 'upop' that updates to global settings 209 if($o['type'] == 'text_content' || $o['type'] == 'text_content_reverse'){ 210 $oset['subkey'] = null; 211 $o['val'] = ploption( $oid, $oset ); 212 $o['input_name'] = plname( $oid, $oset ); 213 } 214 215 if(!empty($o['selectvalues'])){ 216 foreach($o['selectvalues'] as $sid => $s){ 217 $oset['subkey'] = $sid; 218 $oset['clone_id'] = $o['clone_id']; 219 220 $o['selectvalues'][$sid]['val'] = ploption( $o['special'], $oset); 221 $o['selectvalues'][$sid]['input_id'] = plid( $o['special'], $oset); 222 $o['selectvalues'][$sid]['input_name'] = plname( $o['special'], $oset); 223 $o['selectvalues'][$sid]['placeholder'] = pldefault( $sid, $oset); 224 225 } 226 } 227 228 } 229 else { 230 $o['val'] = ploption( $oid, $oset ); 231 $o['input_name'] = get_pagelines_option_name( $oid, null, null, $setting ); 232 $o['input_id'] = get_pagelines_option_id( $oid, null, null, $setting ); 233 234 if(!empty($o['selectvalues'])){ 235 foreach($o['selectvalues'] as $sid => $s){ 236 $o['selectvalues'][$sid]['val'] = ploption( $sid, $oset ); 237 $o['selectvalues'][$sid]['input_id'] = get_pagelines_option_id( $sid ); 238 $o['selectvalues'][$sid]['input_name'] = get_pagelines_option_name($sid, null, null, $setting); 239 } 240 } 241 } 242 243 $o['placeholder'] = pl_html($o['placeholder']); 244 245 if( $this->_do_the_option($oid, $o) ){ 246 247 printf('<div class="optionrow fix %s">', $this->_layout_class( $o )); 248 249 $this->get_option_title( $oid, $o ); 250 251 printf('<div class="optin fix"><div class="oinputs"><div class="oinputs-pad">'); 252 253 $this->option_breaker($oid, $o); 254 255 printf('</div></div>'); 256 257 echo $this->_get_explanation($oid, $o); 258 259 echo '<div class="clear"></div></div></div>'; 260 261 } 262 } 263 264 265 /** 266 * 267 * @TODO document 268 * 269 */ 270 function _get_explanation($oid, $o){ 271 272 $fullwidth = ($o['layout'] == 'full') ? true : false; 273 274 $show = ($o['exp'] && $o['type'] != 'text_content' && $o['layout'] != 'interface') ? true : false; 275 276 if($show){ 277 278 $toggle = ($fullwidth) ? '<div class="more_exp" onClick="jQuery(this).next().next().fadeToggle();">More Info →</div><div class="clear"></div>' : ''; 279 280 $text = sprintf('%s<p>%s</p>', (!$fullwidth) ? '<h5>More Info</h5>' :'', $o['exp']); 281 282 $pro_note = ($o['pro_note'] && !VPRO) ? sprintf('<p class="pro_note"><strong>Pro Version Note:</strong><br/>%s</p>', $o['pro_note']) : ''; 283 284 printf('<div class="oexp">%s<div class="oexp-effect"><div class="oexp-pad">%s %s</div></div></div>', $toggle, $text, $pro_note); 285 286 } 287 288 } 289 290 291 /** 292 * 293 * @TODO document 294 * 295 */ 296 function _layout_class( $o ){ 297 $layout_class = ''; 298 $layout_class .= ( isset( $o['layout'] ) && $o['layout']=='full' ) ? ' wideinputs' : ''; 299 $layout_class .= ( isset( $o['layout'] ) && $o['layout']=='interface' ) ? ' interface' : ''; 300 return $layout_class; 301 } 302 303 304 /** 305 * Get Option Title 306 * 307 * @param $oid - option ID (unused) 308 * @param $o - option class 309 */ 310 function get_option_title( $oid, $o ){ 311 if( $o['title'] ) : ?> 312 <div class="optiontitle fix"> 313 <div class="optiontitle-pad fix"> 314 <?php if( isset( $o['vidlink'] ) ) :?> 315 <a class="vidlink thickbox" title="<?php if( $o['vidtitle'] ) echo $o['vidtitle']; ?>" href="<?php echo $o['vidlink']; ?>?hd=1&KeepThis=true&height=450&width=700&TB_iframe=true"> 316 <img src="<?php echo PL_ADMIN_IMAGES . '/link-video.jpg'; ?>" class="docslink-video" alt="Video Tutorial" /> 317 </a> 318 <?php endif; 319 320 if( isset( $o['docslink'] ) ) 321 printf( '<a class="vidlink" title="%1$s" href="%2$s" target="_blank"><img src="%3$s" class="docslink-video" alt="%1$s" /></a>', ( $o['docstitle'] ? $o['docstitle'] : '' ), $o['docslink'], PL_ADMIN_IMAGES . '/link-docs.jpg' ); 322 323 $protag = ( $o['version'] == 'pro' ) ? '<span class="protag">Pro</span>' : ''; 324 325 printf( '<strong>%s %s</strong><br/><small>%s</small><br/>', $o['title'], $protag, $o['shortexp'] ); 326 327 ?> 328 </div> 329 </div> 330 <?php endif; 331 } 332 333 334 /** 335 * 336 * @TODO document 337 * 338 */ 339 function _do_the_option($oid, $o){ 340 341 $draw = (!isset( $o['version'] ) || ( isset($o['version']) && $o['version'] == 'free' && !VPRO) || (isset($o['version']) && $o['version'] == 'pro' && VPRO )) ? true : false; 342 return $draw; 343 } 344 345 /** 346 * 347 * Option Breaker 348 * Switches through an option array, generating the option handling and markup 349 * 350 */ 351 function option_breaker($oid, $o, $setting = '', $val = ''){ 352 353 switch ( $o['type'] ){ 354 355 case 'multi_option' : 356 $this->_get_multi_option($oid, $o); 357 break; 358 case 'select' : 359 $this->_get_select_option($oid, $o); 360 break; 361 case 'select_same' : 362 $this->_get_select_option($oid, $o); 363 break; 364 case 'radio' : 365 $this->_get_radio_option($oid, $o); 366 break; 367 case 'colorpicker' : 368 $this->_get_color_picker($oid, $o); 369 break; 370 case 'color_multi' : 371 $this->_get_color_multi($oid, $o); 372 break; 373 case 'count_select' : 374 $this->_get_count_select_option($oid, $o); 375 break; 376 case 'select_taxonomy' : 377 $this->_get_taxonomy_select($oid, $o); 378 break; 379 case 'textarea' : 380 $this->_get_textarea($oid, $o, $val); 381 break; 382 case 'code' : 383 $this->_get_textarea($oid, $o, $val); 384 break; 385 case 'textarea_big' : 386 $this->_get_textarea($oid, $o, $val); 387 break; 388 case 'text' : 389 $this->_get_text($oid, $o, $val); 390 break; 391 case 'text_small' : 392 $this->_get_text_small($oid, $o, $val); 393 break; 394 case 'text_multi' : 395 $this->_get_text_multi($oid, $o, $val); 396 break; 397 case 'check' : 398 $this->_get_check_option($oid, $o); 399 break; 400 case 'check_multi' : 401 $this->_get_check_multi($oid, $o, $val); 402 break; 403 case 'fonts' : 404 $this->_get_fonts_option($oid, $o); 405 break; 406 case 'typography' : 407 $this->_get_type_control($oid, $o); 408 break; 409 case 'select_menu' : 410 $this->_get_menu_select($oid, $o); 411 break; 412 case 'select_role' : 413 $this->_get_select_role($oid, $o); 414 break; 415 case 'image_upload' : 416 $this->_get_image_upload_option($oid, $o); 417 break; 418 case 'image_upload_multi' : 419 $this->_get_image_upload_multi($oid, $o); 420 break; 421 case 'background_image' : 422 $this->_get_background_image_control($oid, $o); 423 break; 424 case 'layout' : 425 $this->_get_layout_builder($oid, $o); 426 break; 427 case 'layout_select' : 428 $this->_get_layout_select($oid, $o); 429 break; 430 case 'templates' : 431 $this->do_template_builder($oid, $o); 432 break; 433 case 'section_control' : 434 $this->do_section_control($oid, $o); 435 break; 436 case 'text_content' : 437 $this->_get_text_content($oid, $o, $val); 438 break; 439 case 'text_content_reverse' : 440 $this->_get_text_content_reverse($oid, $o, $val); 441 break; 442 case 'reset' : 443 $this->_get_reset_option($oid, $o, $val); 444 break; 445 case 'email_capture' : 446 $this->_get_email_capture($oid, $o, $val); 447 break; 448 case 'account_signup' : 449 $this->_account_signup($oid, $o, $val); 450 break; 451 case 'horizontal_tabs' : 452 $this->get_horizontal_nav($oid, $o); 453 break; 454 case 'graphic_selector' : 455 $this->graphic_selector($oid, $o); 456 break; 457 case 'import_export' : 458 $this->import_export($oid, $o); 459 break; 460 case 'updates_setup' : 461 $this->updates_setup($oid, $o); 462 break; 463 case 'plus_welcome' : 464 $this->plus_welcome($oid, $o); 465 break; 466 case 'plus_support' : 467 $this->plus_support($oid, $o); 468 break; 469 default : 470 do_action( 'pagelines_options_' . $o['type'] , $oid, $o); 471 break; 472 473 } 474 475 } 476 477 478 479 /** 480 * 481 * Multiple Options Rendering.. 482 * 483 * @since 1.0.0 484 * @author Andrew Powers 485 * 486 */ 487 function _get_multi_option($oid, $o){ 488 489 global $post_ID; 490 491 $sub_option_engine = new OptEngine( $this->settings_field ); 492 493 $flag = ($this->settings_field == 'meta') ? $post_ID : null; 494 495 echo '<div class="multi_option">'; 496 foreach($o['selectvalues'] as $mid => $m){ 497 498 // Needed for saving on special pages 499 if(isset($o['special'])) 500 $m['special'] = $o['special']; 501 502 // Flag needed for post id/profile id -- settings for special handling. 503 $sub_option_engine->option_engine($mid, $m, $flag, $this->settings_field); 504 505 } 506 echo '</div>'; 507 } 508 509 510 /** 511 * 512 * Gets a menu selector for WP menus. Can be used in navigation, etc... 513 * 514 * @since 1.0.0 515 * @author Andrew Powers 516 * 517 */ 518 function _get_menu_select($oid, $o){ 519 520 echo $this->input_label($o['input_id'], $o['inputlabel']); 521 522 $menus = wp_get_nav_menus( array('orderby' => 'name') ); 523 $opts = ''; 524 foreach ( $menus as $menu ){ 525 $opts .= $this->input_option($menu->term_id, selected($menu->term_id, $o['val'], false), esc_html( $menu->name ) ); 526 } 527 528 529 if($opts != '') 530 echo $this->input_select($o['input_id'], $o['input_name'], $opts); 531 else 532 printf( __( "<div class='option_default_statement'>WP menus need to be created to use this option!<br/> Edit <a href='%s'>WordPress Menus</a></div>", 'pagelines' ), admin_url( 'nav-menus.php')); 533 534 } 535 536 537 /** 538 * 539 * @TODO document 540 * 541 */ 542 function _get_select_role($oid, $o){ 543 544 $opts = $this->input_option('', selected('', $o['val'], false), esc_html( 'Any Role' ) ); 545 ob_start(); 546 wp_dropdown_roles( $o['val'] ); 547 $opts .= ob_get_clean(); 548 549 550 echo $this->input_label($o['input_id'], $o['inputlabel']); 551 echo $this->input_select($o['input_id'], $o['input_name'], $opts); 552 } 553 554 /** 555 * 556 * Gets Fonts 557 * 558 * @since 1.0.0 559 * @author Andrew Powers 560 * 561 */ 562 function _get_fonts_option($oid, $o){ 563 564 $control = new PageLinesTypeUI(); 565 566 $control->fonts_option( $oid, $o ); 567 } 568 569 /** 570 * 571 * Gets Typography Control Panel 572 * 573 * @since 1.0.0 574 * @author Andrew Powers 575 * 576 */ 577 function _get_type_control($oid, $o){ 578 579 $control = new PageLinesTypeUI(); 580 581 $control->build_typography_control( $oid, $o ); 582 } 583 584 585 /** 586 * 587 * Standard Checkbox Option 588 * 589 * @since 1.0.0 590 * @author Andrew Powers 591 * 592 */ 593 function _get_check_option($oid, $o){ 594 595 $checked = checked((bool) $o['val'], true, false); 596 597 $input = $this->input_checkbox($o['input_id'], $o['input_name'], $checked); 598 599 echo $this->input_label_inline($o['input_id'], $input, $o['inputlabel']); 600 } 601 602 603 604 /** 605 * 606 * Multiple Checkbox Fields 607 * Shows several checkbox fields based on 'selectvalues' attr 608 * 609 * @since 1.0.0 610 * @author Andrew Powers 611 * 612 */ 613 function _get_check_multi($oid, $o, $val){ 614 615 foreach($o['selectvalues'] as $mid => $m){ 616 617 if(!VPRO && isset($m['version']) && $m['version'] == 'pro') 618 continue; 619 620 $value = checked((bool) $m['val'], true, false); 621 622 623 // Output 624 $input = $this->input_checkbox($m['input_id'], $m['input_name'], $value); 625 626 echo $this->input_label_inline($m['input_id'], $input, $m['inputlabel']); 627 628 } 629 630 } 631 632 633 /** 634 * 635 * Multiple Text Fields 636 * Shows several text fields based on 'selectvalues' attr 637 * 638 * @since 1.0.0 639 * @author Andrew Powers 640 * 641 */ 642 function _get_text_multi($oid, $o){ 643 644 foreach($o['selectvalues'] as $mid => $m){ 645 646 $attr = ( strpos( $mid, 'password' ) ) ? 'password' : 'text'; 647 648 $class = $o['inputsize'].'-text'; 649 650 $placeholder = (isset($m['placeholder'])) ? pl_html($m['placeholder']) : ''; 651 652 653 // Output 654 echo $this->input_label($m['input_id'], $m['inputlabel']); 655 echo $this->input_text($m['input_id'], $m['input_name'], pl_html($m['val']), $class, $attr, '', $placeholder); 656 657 } 658 } 659 660 661 /** 662 * 663 * Small Text Option Field 664 * Displays Small Text Option & Escapes HTML 665 * 666 * @since 1.0.0 667 * @author Andrew Powers 668 * 669 */ 670 function _get_text_small($oid, $o, $val){ 671 672 echo $this->input_label($o['input_id'], $o['inputlabel']); 673 echo $this->input_text($o['input_id'], $o['input_name'], pl_html($o['val']), 'small-text', 'text', '', $o['placeholder']); 674 } 675 676 /** 677 * 678 * Regular Text Field 679 * 680 * @since 1.0.0 681 * @author Andrew Powers 682 * 683 */ 684 function _get_text($oid, $o, $val){ 685 686 echo $this->input_label($o['input_id'], $o['inputlabel']); 687 echo $this->input_text($o['input_id'], $o['input_name'], pl_html($o['val']), 'regular-text', 'text', '', $o['placeholder'] ); 688 689 } 690 691 692 693 /** 694 * 695 * Regular Textarea 696 * 697 * @since 1.0.0 698 * @author Andrew Powers 699 * 700 */ 701 function _get_textarea($oid, $o, $val){ 702 703 $class = ($o['type']=='textarea_big') ? 'longtext' : ''; 704 $class .= ($o['type']=='code') ? 'code_textarea' : ''; 705 706 $extra = (isset($o['height']) && $o['height'] != '0px') ? sprintf( 'style="height: %s"', $o['height'] ) : ''; 707 708 // Output 709 echo $this->input_label($o['input_id'], $o['inputlabel']); 710 echo $this->input_textarea($o['input_id'], $o['input_name'], pl_html($o['val']), $class, $extra); 711 } 712 713 714 715 716 /** 717 * 718 * Text or Written Content. E.g. Welcome Screen 719 * 720 * @since 1.0.0 721 * @author Andrew Powers 722 * 723 */ 724 function _get_text_content($oid, $o, $val){ 725 726 $val = (bool) $o['val']; 727 728 $checked = checked($val, true, false); 729 730 $input = $this->input_checkbox($o['input_id'], $o['input_name'], $checked); 731 732 $label = ($o['inputlabel'] != '') ? $o['inputlabel'] : __('Hide This Overview', 'pagelines'); 733 734 $hide_checkbox = ($o['flag'] != 'hide_option') ? $this->input_label_inline($o['input_id'], $input, $o['inputlabel']) : ''; 735 736 printf('<div class="pl_help text_content fix">%s %s</div>', $o['exp'], $hide_checkbox); 737 738 739 } 740 741 /** 742 * 743 * Option to show text content after being hidden 744 * 745 * @since 1.0.0 746 * @author Andrew Powers 747 * 748 */ 749 function _get_text_content_reverse($oid, $o, $val){ 750 751 // @todo fix the handling of this on special pages 752 // unchecking the checkbox doesn't work because all panels have it 753 if($this->settings_field != PAGELINES_SPECIAL){ 754 755 756 $val = (bool) ploption( $oid ); 757 758 $checked = checked($val, true, false); 759 760 $input = $this->input_checkbox($o['input_id'], $o['input_name'], $checked); 761 762 $hide_checkbox = $this->input_label_inline($o['input_id'], $input, $o['inputlabel']); 763 764 printf('<div class="just_checkbox_option fix">%s %s</div>', $o['exp'], $hide_checkbox); 765 766 } 767 768 769 } 770 771 772 /** 773 * 774 * Prints a button that can be used to reset an option 775 * Works with 'pagelines_process_reset_options()' & a callback in the option array 776 * 777 * @since 1.0.0 778 * @author Andrew Powers 779 * 780 */ 781 function _get_reset_option($oid, $o, $val){ 782 783 $confirmID = 'Confirm'.$oid; 784 785 pl_action_confirm($confirmID, __( 'Are you sure?', 'pagelines' ) ); // print JS confirmation script 786 787 788 $extra = sprintf('onClick="return %s();"', $confirmID); 789 790 $input = $this->superlink($o['inputlabel'], 'grey', 'reset-options', 'submit', $extra, $o['input_name']); 791 792 printf('<div class="insidebox context fix">%s %s</div>', $input, $o['exp']); 793 794 795 } 796 797 798 /** 799 * 800 * @TODO document 801 * 802 */ 803 function _get_image_upload_multi( $oid, $o ){ 804 805 foreach($o['selectvalues'] as $mid => $m){ 806 807 $m = wp_parse_args( $m, $this->defaults ); 808 809 $this->_get_image_upload_option( $mid, $m ); 810 811 } 812 813 } 814 815 /** 816 * 817 * Creates An AJAX Image Uploader 818 * 819 * @since 1.0.0 820 * @author Andrew Powers 821 * 822 */ 823 function _get_image_upload_option( $oid, $o ){ 824 825 $up_url = $this->input_text($o['input_id'], $o['input_name'], esc_url($o['val']), 'regular-text uploaded_url', 'text', '', $o['placeholder']); 826 827 $button_id = (isset($o['special'])) ? $oid.'OID'.$o['special'] : $oid; 828 829 $up_button = $this->input_button( $button_id, __( 'Upload Image', 'pagelines' ), 'image_upload_button admin-blue', 'title="'.$this->settings_field.'"' ); 830 831 $reset_button = sprintf('<span title="%1$s" id="%2$s" class="image_reset_button button reset_%1$s">Remove</span>', $button_id, $this->settings_field); 832 833 $ajax_url = $this->input_hidden('', 'wp_ajax_action_url', admin_url("admin-ajax.php"), 'ajax_action_url'); 834 835 $preview_size = $this->input_hidden('', 'img_size_'.$oid, $o['imagepreview'], 'image_preview_size'); 836 837 ob_start(); 838 $image_library_url = get_upload_iframe_src( 'image', null, 'library' ); 839 $image_library_url = remove_query_arg( 'TB_iframe', $image_library_url ); 840 $image_library_url = add_query_arg( array('oid' => $o['input_id'], 'context' => 'pl-custom-attach', 'TB_iframe' => 1), $image_library_url ); 841 ?> 842 843 <a id="choose-from-library-link" class="button thickbox" href="<?php echo esc_url( $image_library_url ); ?>"> 844 <?php _e( 'Select From Library', 'pagelines' ); ?> 845 </a> 846 847 <?php 848 $media_lib = ob_get_clean(); 849 850 // Output 851 $label = $this->input_label($oid, $o['inputlabel']); 852 printf('<p>%s %s<br/> %s %s %s %s %s</p>',$label, $up_url, $up_button, $media_lib, $reset_button, $ajax_url, $preview_size); 853 854 $special_image_class = ''; 855 856 $select_class = sprintf('pre_%s', $o['input_id']); 857 858 if($o['val']) 859 $active_image_url = $o['val']; 860 elseif($o['placeholder']){ 861 $active_image_url = $o['placeholder']; 862 $special_image_class = 'default-image-preview'; 863 }else 864 $active_image_url = false; 865 866 printf( 867 '<img class="pagelines_image_preview %s %s" id="image_%s" src="%s" style="max-width:%spx; %s"/>', 868 $special_image_class, 869 $select_class, 870 $button_id, 871 $active_image_url, 872 $o['imagepreview'], 873 (!$active_image_url) ? 'display: none;' : '' 874 ); 875 876 } 877 878 879 880 881 /** 882 * 883 * Gets a select field based on a count parameter 884 * Starts at 0 or if a start value is given, starts there 885 * 886 * @param count_start = starting value 887 * @param count_number = ending value 888 * 889 * @since 1.0.0 890 * @author Andrew Powers 891 * 892 */ 893 function _get_count_select_option( $oid, $o ){ 894 895 896 $count_start = (isset($o['count_start'])) ? $o['count_start'] : 0; 897 898 $opts = ''; 899 for($i = $count_start; $i <= $o['count_number']; $i++) 900 $opts .= $this->input_option($i, selected($i, $o['val'], false), $i); 901 902 903 // Output 904 echo $this->input_label($o['input_id'], $o['inputlabel']); 905 echo $this->input_select($o['input_id'], $o['input_name'], $opts); 906 907 } 908 909 /** 910 * 911 * Get Radio Options 912 * 913 * @param selectvalues array a set of options to select from 914 * 915 * @since 1.0.0 916 * @author Andrew Powers 917 * 918 */ 919 function _get_radio_option( $oid, $o ){ 920 921 foreach($o['selectvalues'] as $sid => $s){ 922 923 $checked = checked($sid, $o['val'], false); 924 925 $input = $this->input_radio($s['input_id'], $o['input_name'], $sid, $checked); 926 echo $this->input_label_inline($s['input_id'], $input, $s['name']); 927 928 } 929 } 930 931 932 /** 933 * 934 * Get Select Option 935 * 'select_same' means both value and name are the same 936 * 937 * @param selectvalues array a set of options to select from 938 * 939 * @since 1.0.0 940 * @author Andrew Powers 941 * 942 */ 943 function _get_select_option( $oid, $o ){ 944 945 echo $this->input_label($o['input_id'], $o['inputlabel']); 946 947 $opts = ''; 948 949 foreach($o['selectvalues'] as $sval => $s){ 950 951 $opts .= $this->input_option($sval, selected($sval, $o['val'], false), $s['name']); 952 953 } 954 955 echo $this->input_select($o['input_id'], $o['input_name'], $opts); 956 957 } 958 959 /** 960 * 961 * Graphical Selector 962 * 963 * @param selectvalues array a set of options to select from 964 * 965 * @since 2.0.b3 966 * @author Andrew Powers 967 * 968 */ 969 function graphic_selector( $oid, $o ){ 970 971 972 ?> 973 <div id="graphic_selector_option" class="graphic_selector_wrap"> 974 <div class="graphic_selector fix"> 975 <div class="graphic_selector_pad fix"> 976 <label for="<?php echo $o['input_id'];?>" class="graphic_selector_overview"><?php echo $o['inputlabel'];?></label> 977 <?php 978 979 foreach( $o['selectvalues'] as $sid => $s ): 980 981 $css = sprintf('background: url(%s) no-repeat %s;', $o['sprite'], $s['offset']); 982 983 $size = sprintf('width: %s; height: %s;', $o['width'], $o['height']); 984 985 $line_height = sprintf('line-height: %s;', $o['height']); 986 987 $selected = ($sid == $o['val']) ? 'selectedgraphic' : ''; 988 989 $checked = checked($sid, $o['val'], false); 990 991 if(!VPRO && isset( $s['version']) && $s['version'] == 'pro'){ 992 993 $option_status = 'disabled_option'; 994 $graphic_content = 'pro'; 995 996 } else { 997 998 $option_status = 'enabled_option'; 999 $graphic_content = ' '; 1000 } 1001 1002 $graphic_classes = sprintf('%s %s', $selected, $option_status); 1003 ?> 1004 <span class="graphic_select_item"> 1005 <span class="graphic_select_border <?php echo $graphic_classes;?> fix"> 1006 <span class="graphic_select_image <?php echo $sid;?>" style="<?php echo $css . $size;?>"> 1007 <?php printf('<span class="graphic_fill" style="%s %s">%s</span>', $size, $line_height, $graphic_content); ?> 1008 </span> 1009 </span> 1010 <?php 1011 if($o['showname'] && isset($s['name'])) 1012 printf('<span class="graphic_title clear">%s</span>', $s['name']); 1013 1014 printf('<input type="radio" id="%s" class="graphic_select_input" name="%s" value="%s" %s />', $o['input_id'], $o['input_name'], $sid, $checked ); 1015 1016 ?> 1017 </span> 1018 1019 <?php 1020 endforeach; 1021 ?> 1022 1023 <?php if(isset($o['exp']) && $o['exp'] != ''):?> 1024 <div class="gselect_toggle" onclick="jQuery(this).parent().parent().next().slideToggle();"> 1025 <div class="gselect_toggle_pad">More Info ↓</div> 1026 </div> 1027 <?php endif;?> 1028 </div> 1029 1030 </div> 1031 <?php if(isset($o['exp']) && $o['exp'] != ''):?> 1032 <div class="exp_gselect" style="display: none"> 1033 <div class="exp_pad"> 1034 <?php echo $o['exp'];?> 1035 </div> 1036 </div> 1037 <?php endif;?> 1038 </div><div class="clear"></div><?php } 1039 1040 1041 /** 1042 * 1043 * Horizontal Navigation Option w/ Callbacks 1044 * 1045 * @since 1.0.0 1046 * @author Andrew Powers 1047 * 1048 */ 1049 function get_horizontal_nav( $menu, $oids){ 1050 $handle = 'htabs'.$menu; ?> 1051 <script type="text/javascript"> 1052 jQuery(document).ready(function() { 1053 var <?php echo $handle;?> = jQuery("#<?php echo $handle;?>").tabs({ cookie: { name: "<?php echo $menu;?>-tabs" } }); 1054 }); 1055 </script> 1056 <div id="<?php echo $handle;?>" class="htabs-menu" > 1057 <ul class="tabbed-list horizontal-tabs fix"> 1058 <?php foreach($oids['htabs'] as $key => $t){ 1059 $class = (isset($t['class'])) ? $t['class'] : 'left'; 1060 printf('<li class="ht-%s"><a href="#%s" >%s</a></li>', $class, $key, ui_key($key) ); 1061 } 1062 ?> 1063 </ul> 1064 <?php 1065 1066 1067 1068 foreach($oids['htabs'] as $key => $t){ 1069 1070 $callback = ( isset($t['type']) && $t['type'] == 'subtabs' ) ? self::get_horizontal_subtabs( $key, $t ) : $t['callback']; 1071 1072 printf('<div id="%s" class="htab-content"><div class="htab-content-pad"><h3 class="htab-title">%s</h3>%s</div></div>', $key, $t['title'], $callback); 1073 1074 } 1075 1076 1077 1078 ?> 1079 </div> 1080 <?php } 1081 1082 1083 /** 1084 * 1085 * @TODO document 1086 * 1087 */ 1088 function get_horizontal_subtabs( $key, $t ){ 1089 1090 $handle = 'subtabs_'.$key; 1091 1092 $thescript = self::get_tabs_script($handle, $key); 1093 1094 $list_items = ''; 1095 if(isset($t['type'])) unset($t['type']); 1096 if(isset($t['title'])) unset($t['title']); 1097 if(isset($t['class'])) unset($t['class']); 1098 1099 $wlist = (1 / count($t)) * 100; 1100 foreach( $t as $skey => $st){ 1101 1102 $list_items .= sprintf( 1103 '<li class="st-%s" style="width: %s%%"><a href="#%s" ><span class="st-pad">%s</span></a></li>', 1104 'subtab', 1105 $wlist, 1106 $skey, 1107 $st['title'] 1108 ); 1109 1110 } 1111 1112 $thelist = sprintf('<ul class="tabbed-list horizontal-tabs subtabs fix">%s</ul>', $list_items); 1113 1114 $stabs = ''; 1115 foreach($t as $skey => $st){ 1116 $stabs .= sprintf('<div id="%s" class="htab-sub"><div class="htab-content-pad"><h3 class="htab-title">%s</h3>%s</div></div>', $skey, $st['title'], $st['callback']); 1117 } 1118 1119 $thewrapper = sprintf('<div id="%s" class="subtabs-menu" >%s %s</div>%s', $handle, $thelist, $stabs, $thescript); 1120 1121 return $thewrapper; 1122 } 1123 1124 1125 /** 1126 * 1127 * @TODO document 1128 * 1129 */ 1130 function get_tabs_script($handle, $key){ 1131 1132 $thescript = sprintf('var %1$s = jQuery("#%1$s").tabs( { cookie: { name: "sub-tabs-%2$s" } } );', $handle, $key); 1133 1134 $wrapper = sprintf('<script type="text/javascript">jQuery(document).ready(function() { %s });</script>', $thescript); 1135 1136 return $wrapper; 1137 } 1138 1139 /** 1140 * 1141 * Get Taxonomy Selector 1142 * Based on all applied to a post type 1143 * 1144 * 1145 * @since 1.0.0 1146 * @author Andrew Powers 1147 * 1148 */ 1149 function _get_taxonomy_select( $oid, $o ){ 1150 1151 $terms_array = get_terms( $o['taxonomy_id']); 1152 1153 if(is_array($terms_array) && !empty($terms_array)){ 1154 1155 echo $this->input_label($o['input_id'], $o['inputlabel']); 1156 1157 $opts = ''; 1158 1159 if($o['taxonomy_id'] == 'category') 1160 $opts .= $this->input_option('', selected('', $o['val'], false), '*Show All*'); 1161 1162 foreach($terms_array as $term) 1163 $opts .= $this->input_option($term->slug, selected($term->slug, $o['val'], false), $term->name); 1164 1165 echo $this->input_select($o['input_id'], $o['input_name'], $opts); 1166 1167 } else 1168 printf('<div class="meta-message">%s</div>', __('No sets have been created and added to this post-type yet!', 'pagelines')); 1169 1170 } 1171 1172 1173 /** 1174 * 1175 * @TODO document 1176 * 1177 */ 1178 function _get_color_multi($oid, $o){ 1179 1180 $num_options = count($o['selectvalues']); 1181 1182 if($num_options == 4 || ($num_options % 4 == 0) ) 1183 $per_row = 4; 1184 else 1185 $per_row = 3; 1186 1187 $count = 1; 1188 foreach($o['selectvalues'] as $mid => $m){ 1189 1190 $end_row = ($count % $per_row == 0) ? true : false; 1191 1192 $last = (end($o['selectvalues']) == $m || $end_row) ? true : false; 1193 1194 if( !isset($m['version']) || (isset($m['version']) && $m['version'] != 'pro') || (isset($m['version']) && $m['version'] == 'pro' && VPRO )) 1195 $this->_get_color_picker($mid, $m, $per_row, $last); 1196 1197 $count++; 1198 } 1199 1200 } 1201 1202 1203 1204 /** 1205 * 1206 * @TODO document 1207 * 1208 */ 1209 function _get_color_picker($oid, $o, $per_row = 3, $last = false){ // Color Picker Template 1210 1211 $the_id = $o['input_id']; 1212 1213 $gen = do_color_math($the_id, $o, $o['val'], 'palette'); 1214 1215 $picker = sprintf('<div id="%s" class="colorSelector"><div></div></div> %s', $the_id.'_picker', $this->input_text($the_id, $o['input_name'], $o['val'], 'colorpickerclass')); 1216 1217 $pick_contain = sprintf('<div class="pick_contain">%s</div>', $picker); 1218 1219 printf('<div class="the_picker picker_row_%s %s"><div class="picker_panel"><div class="the_picker_pad">%s %s</div></div></div>', $per_row, ($last) ? 'p_end' : '', $this->input_label($the_id, $o['inputlabel']), $pick_contain); 1220 1221 printf('<script type="text/javascript">setColorPicker("%s", "%s");</script>', $the_id, $o['val']); 1222 } 1223 1224 1225 1226 /** 1227 * 1228 * @TODO document 1229 * 1230 */ 1231 function _get_background_image_control($oid, $o){ 1232 1233 $bg = $this->_background_image_array(); 1234 1235 $oset = array( 'post_id' => $o['pid'], 'setting' => $this->settings_field); 1236 1237 // set value, id, name 1238 foreach($bg as $k => $i){ 1239 1240 $bgid = $oid.$k; 1241 1242 if($this->settings_field == 'meta'){ 1243 $bg[$k]['val'] = plmeta($bgid, $oset); 1244 $bg[$k]['input_name'] = $bgid; 1245 $bg[$k]['input_id'] = get_pagelines_option_id( $bgid ); 1246 1247 } elseif($this->settings_field == PAGELINES_SPECIAL){ 1248 1249 $oset['subkey'] = $bgid; 1250 1251 $bg[$k]['val'] = ploption( $o['special'], $oset ); 1252 $bg[$k]['input_name'] = plname($o['special'], $oset); 1253 $bg[$k]['input_id'] = plid( $o['special'], $oset); 1254 1255 } else { 1256 1257 $bg[$k]['val'] = ploption( $bgid, $oset); 1258 $bg[$k]['input_id'] = plid( $bgid, $oset); 1259 $bg[$k]['input_name'] = plname( $bgid, $oset); 1260 } 1261 1262 $bg[$k] = wp_parse_args($bg[$k], $o); 1263 1264 } 1265 1266 1267 1268 $this->_get_image_upload_option($oid.'_url', $bg['_url']); 1269 $this->_get_select_option($oid.'_repeat', $bg['_repeat']); 1270 $this->_get_count_select_option( $oid.'_pos_vert', $bg['_pos_vert']); 1271 $this->_get_count_select_option( $oid.'_pos_hor', $bg['_pos_hor']); 1272 $this->_get_select_option($oid.'_attach', $bg['_attach']); 1273 1274 } 1275 1276 1277 /** 1278 * 1279 * @TODO document 1280 * 1281 */ 1282 function _background_image_array(){ 1283 return array( 1284 '_url' => array( 1285 'inputlabel' => __( 'Background Image', 'pagelines' ), 1286 'imagepreview' => 150 1287 ), 1288 '_repeat' => array( 1289 'inputlabel' => __( 'Set Background Image Repeat', 'pagelines' ), 1290 'type' => 'select', 1291 'selectvalues' => array( 1292 'no-repeat' => array('name' => __( 'Do Not Repeat', 'pagelines' )), 1293 'repeat' => array('name' => __( 'Tile', 'pagelines' )), 1294 'repeat-x' => array('name' => __( 'Repeat Horizontally', 'pagelines' )), 1295 'repeat-y' => array('name' => __( 'Repeat Vertically', 'pagelines' )) 1296 ) 1297 ), 1298 '_pos_vert' => array( 1299 'inputlabel' => __( 'Vertical Position In Percent', 'pagelines' ), 1300 'type' => __( 'count_select', 'pagelines' ), 1301 'count_start' => 0, 1302 'count_number' => 100, 1303 ), 1304 '_pos_hor' => array( 1305 'inputlabel' => __( 'Horizontal Position In Percent', 'pagelines' ), 1306 'type' => __( 'count_select', 'pagelines' ), 1307 'count_start' => 0, 1308 'count_number' => 100, 1309 ), 1310 '_attach' => array( 1311 'inputlabel' => __( 'Set Background Attachment', 'pagelines' ), 1312 'type' => 'select', 1313 'selectvalues' => array( 1314 'scroll' => array('name' => __( 'Scroll', 'pagelines' )), 1315 'fixed' => array('name' => __( 'Fixed', 'pagelines' )), 1316 ) 1317 ), 1318 1319 ); 1320 } 1321 1322 /** 1323 * Creates an email capture field that sends emails to PageLines.com 1324 */ 1325 function _get_email_capture($oid, $o){ ?> 1326 <div class="email_capture_container"> 1327 <?php 1328 echo $this->input_label($o['input_id'], $o['inputlabel']); 1329 echo $this->input_text('email_capture_input', '', get_option('pagelines_email_sent'), 'email_capture'); 1330 1331 ?> 1332 <input type="button" id="" class="button-secondary" onClick="sendEmailToMothership(jQuery('#email_capture_input').val(), '#email_capture_input');" value="Send" /> 1333 <div class="the_email_response"></div> 1334 </div> 1335 <?php } 1336 1337 /** 1338 * Creates an email capture field that sends emails to PageLines.com 1339 */ 1340 function _account_signup( $oid, $o ){ ?> 1341 <div class="account_signup fix"> 1342 <h3>PageLines Account</h3> 1343 <?php 1344 1345 $log = admin_url( 'admin.php?page='.PL_MAIN_DASH ); 1346 1347 echo $this->superlink( __( 'Login', 'pagelines' ), 'grey', '', $log ); 1348 echo '<span class="divor">or</span>'; 1349 echo $this->superlink( __( 'Register', 'pagelines' ), 'blue', '', PL_SIGNUP ); 1350 ?> 1351 </div> 1352 <?php } 1353 1354 1355 1356 /** 1357 * 1358 * @TODO document 1359 * 1360 */ 1361 function updates_setup($oid, $o){ 1362 1363 if ( pagelines_check_credentials() ) 1364 $updates_exp = sprintf( __( 'Successfully logged in as "%s" to PageLines%s.', 'pagelines' ), get_pagelines_credentials( 'user'), ( pagelines_check_credentials( 'ssl' ) ) ? ' with a secured connection' : '' ); 1365 else 1366 $updates_exp = sprintf( __( 'Could not connect to PageLines as user "%s".', 'pagelines' ), get_pagelines_credentials( 'user') ); 1367 1368 if ( pagelines_check_credentials( 'error' ) === 'creds' ) 1369 $updates_exp = sprintf( __( 'ERROR: %1$s<br />There was a problem logging in to PageLines.', 'pagelines' ), pagelines_check_credentials( 'message' ) ); 1370 1371 if ( pagelines_check_credentials( 'licence' ) === 'dev' ) 1372 $updates_exp .= __( '<br />Developer edition enabled.', 'pagelines' ); 1373 1374 if ( get_pagelines_credentials( 'user' ) === '' || get_pagelines_credentials( 'pass' ) === '' ) 1375 $updates_exp = sprintf( __( "Please set your PageLines login credentials.<br />No account yet? <a href='%s'>Get one now</a>.", 'pagelines' ), PL_SIGNUP ); 1376 1377 if ( pagelines_check_credentials( 'error' ) === 'licence' ) { 1378 $updates_exp .= sprintf( '<br /><br />%s', pagelines_check_credentials( 'message' ) ); 1379 } 1380 if ( 'true' === pagelines_check_credentials( 'plus' ) ) 1381 $updates_exp .= sprintf( '<br /><br />%s', __( 'Active Plus account.', 'pagelines') ); 1382 ?> 1383 <div class="pl_form"> 1384 <div class="pl_form_feedback"> 1385 <?php echo $updates_exp; ?> 1386 </div> 1387 1388 <form method="post" class="pl_account_info fix"> 1389 <div class="pl_account_info_pad"> 1390 1391 <div class="pl_account_form"> 1392 <?php if ( ! pagelines_check_credentials() ) : ?> 1393 <div class="plform_title"> 1394 <h2>PageLines Account Info</h2> 1395 </div> 1396 <?php endif; ?> 1397 <input type="hidden" name="form_submitted" value="plinfo" /> 1398 1399 <?php 1400 1401 if ( pagelines_check_credentials() ): 1402 1403 echo '<input type="hidden" name="creds_reset" value="yes" />'; 1404 echo $this->superlink(__( 'Reset Account Credentials →', 'pagelines' ), 'blue', 'updates-setup', 'submit'); 1405 else: 1406 1407 echo $this->input_label( 'lp_username', __( 'PageLines Username', 'pagelines' )); 1408 echo $this->input_text( 'lp_username', 'lp_username', get_pagelines_credentials( 'user' ), 'bigtext pluser'); 1409 echo $this->input_label( 'lp_password', __( 'PageLines Password', 'pagelines' )); 1410 echo $this->input_text( 'lp_password', 'lp_password', '', 'bigtext pluser', 'password'); 1411 1412 echo $this->superlink(__( 'Submit Credentials', 'pagelines' ), 'blue', 'updates-setup', 'submit'); 1413 endif; 1414 ?> 1415 </form> 1416 </div> 1417 <div class="clear"></div> 1418 </div> 1419 </div> 1420 1421 <?php } 1422 1423 1424 1425 /** 1426 * 1427 * @TODO document 1428 * 1429 */ 1430 function import_export($oid, $o){ 1431 1432 ?> 1433 <div class="pl_form"> 1434 <form method="post" class="pl_account_info fix"> 1435 <div class="pl_account_info_pad"> 1436 <div class="pl_account_form fix"> 1437 1438 <div class="plform_title"> 1439 <h2>PageLines Export Settings</h2> 1440 </div> 1441 <input type="hidden" name="form_submitted" value="export_settings_form" /> 1442 <?php echo $this->superlink(__( 'Export Settings File ↓', 'pagelines' ), 'blue', 'export_settings_form', 'submit'); ?> 1443 <div class="clear"></div> 1444 </div> 1445 </div> 1446 </form> 1447 <form method="post" enctype="multipart/form-data" class="pl_account_info fix"> 1448 1449 <div class="pl_account_info_pad"> 1450 1451 <div class="pl_account_form"> 1452 <div class="plform_title"> 1453 <h2>PageLines Import Settings</h2> 1454 </div> 1455 <input type="hidden" name="form_submitted" value="import_settings_form" /> 1456 <?php 1457 1458 $input = $this->input_checkbox('pagelines_templates', 'pagelines_templates', 'checked'); 1459 echo $this->input_label_inline('pagelines_templates', $input, __( 'Import Template Settings', 'pagelines' )); 1460 1461 $input = $this->input_checkbox('pagelines_settings', 'pagelines_settings', 'checked'); 1462 echo $this->input_label_inline('pagelines_settings', $input, __( 'Import Primary Settings', 'pagelines' )); 1463 1464 1465 $input = $this->input_checkbox('pagelines_special', 'pagelines_special', 'checked'); 1466 echo $this->input_label_inline('pagelines_special', $input, __( 'Import Special Meta Settings', 'pagelines' )); 1467 1468 $input = $this->input_checkbox('pagelines_layout', 'pagelines_layout', 'checked'); 1469 echo $this->input_label_inline('pagelines_layout', $input, __( 'Import Layout Configuration', 'pagelines' )); 1470 1471 echo '<input type="file" class="file_uploader text_input" name="file" id="settings-file" /><div class="clear"></div>'; 1472 1473 echo $this->superlink( __( 'Import Settings To Install ↑', 'pagelines' ), 'blue', 'import_settings_form', 'submit' , 'onClick="return ConfirmImportSettings();"'); 1474 pl_action_confirm('ConfirmImportSettings', __( 'Are you sure? This will overwrite your current settings and configurations with the information in this file!', 'pagelines' )); 1475 ?> 1476 </form> 1477 </div> 1478 <div class="clear"></div> 1479 1480 </div> 1481 </div> 1482 <?php 1483 } 1484 1485 1486 function plus_welcome( $oid, $o ) { 1487 1488 echo PageLines_Plus::plus_welcome(); 1489 } 1490 1491 function plus_support( $oid, $o ) { 1492 1493 echo PageLines_Plus::plus_support_page(); 1494 } 1495 1496 1497 /** 1498 * Layout Builder (Layout Drag & Drop) 1499 */ 1500 function _get_layout_builder($oid, $o){ 1501 1502 $builder = new PageLinesLayoutControl(); 1503 $builder->draw_layout_control( $oid, $o ); 1504 } 1505 1506 /** 1507 * Layout Select (Layout Selector) 1508 */ 1509 function _get_layout_select($oid, $o){ 1510 1511 $builder = new PageLinesLayoutControl(); 1512 $builder->get_layout_selector($oid, $o); 1513 } 1514 1515 /** 1516 * Template Drag and Drop (Sortable Sections) 1517 */ 1518 function do_template_builder($oid, $o){ 1519 1520 $builder = new PageLinesTemplateBuilder($oid, $o, $this->settings_field); 1521 $builder->draw_template_builder(); 1522 1523 } 1524 1525 /** 1526 * Template Drag and Drop (Sortable Sections) 1527 */ 1528 function do_section_control($oid, $o){ 1529 1530 $builder = new PageLinesTemplateBuilder($oid, $o, $this->settings_field); 1531 $builder->section_control_interface($oid, $o); 1532 1533 } 1534 1535 1536 1537 1538 1539 /** 1540 * INPUT HELPERS 1541 */ 1542 1543 1544 /** 1545 * 1546 * @TODO document 1547 * 1548 */ 1549 function superlink($text, $mode = 'grey', $class = '', $type = '', $extra='', $name = ''){ 1550 1551 if( false !== strpos($type, 'http') ) 1552 $att = 'a'; 1553 else 1554 $att = 'div'; 1555 1556 if ($type == 'submit') 1557 $button = sprintf('<input class="superlink supersave %s" type="submit" name="%s" value="%s" %s />', $class, $name, $text, $extra); 1558 else 1559 $button = sprintf('<%s id="%s" class="%s superlink" href="%s" %s ><span class="superlink-pad">%s</span></%s>', $att, $class, $class, $type, $extra, $text, $att); 1560 1561 if($mode == 'purchase' || $mode == 'activate' || $mode == 'install' || $mode == 'redirect') 1562 $color = 'blue'; 1563 else 1564 $color = $mode; 1565 1566 $wrap = sprintf('<div class="superlink-%s-wrap superlink-wrap sl-%s">%s</div>', $class, $color, $button); 1567 1568 return $wrap; 1569 } 1570 1571 1572 /** 1573 * 1574 * @TODO document 1575 * 1576 */ 1577 function input_hidden($id, $name, $value, $class = ''){ 1578 return sprintf('<input type="hidden" id="%s" name="%s" value="%s" class="%s" />', $id, $name, $value, $class); 1579 } 1580 1581 /** 1582 * 1583 * @TODO document 1584 * 1585 */ 1586 function input_textarea($id, $name, $value, $class = 'regular-text', $extra = '', $placeholder = '' ){ 1587 return sprintf('<textarea id="%s" name="%s" class="html-textarea %s" %s/>%s</textarea>', $id, $name, $class, $extra, $value ); 1588 } 1589 1590 1591 /** 1592 * 1593 * @TODO document 1594 * 1595 */ 1596 function input_text($id, $name, $value, $class = 'regular-text', $attr = 'text', $extra = '', $placeholder = ''){ 1597 return sprintf('<input type="%s" id="%s" name="%s" value="%s" class="%s" placeholder="%s" %s />', $attr, $id, $name, $value, $class, $placeholder, $extra); 1598 } 1599 1600 1601 /** 1602 * 1603 * @TODO document 1604 * 1605 */ 1606 function input_checkbox($id, $name, $value, $class = 'admin_checkbox'){ 1607 return sprintf('<input type="checkbox" id="%s" name="%s" class="%s" %s />', $id, $name, $class, $value); 1608 } 1609 1610 1611 /** 1612 * 1613 * @TODO document 1614 * 1615 */ 1616 function input_label_inline($id, $input, $text, $class = 'inln'){ 1617 return sprintf('<label for="%s" class="lbl %s">%s <span>%s</span></label>', $id, $class, $input, $text); 1618 } 1619 1620 1621 /** 1622 * 1623 * @TODO document 1624 * 1625 */ 1626 function input_radio($id, $name, $value, $checked, $class = ''){ 1627 return sprintf('<input type="radio" id="%s" name="%s" value="%s" class="%s" %s> ', $id, $name, $value, $class, $checked); 1628 } 1629 1630 1631 /** 1632 * 1633 * @TODO document 1634 * 1635 */ 1636 function input_label($id, $text, $class = 'context'){ 1637 return sprintf('<label for="%s" class="lbl %s">%s</label>', $id, $class, $text); 1638 } 1639 1640 1641 /** 1642 * 1643 * @TODO document 1644 * 1645 */ 1646 function input_select($id, $name, $opts, $class = '', $extra = ''){ 1647 return sprintf('<select id="%s" name="%s" class="%s" %s><option value="">—SELECT—</option>%s</select>', $id, $name, $class, $extra, $opts); 1648 } 1649 1650 1651 /** 1652 * 1653 * @TODO document 1654 * 1655 */ 1656 function input_option($value, $selected, $text, $id = '', $extra = ''){ 1657 return sprintf('<option id=\'%s\' value="%s" %s %s >%s</option>', $id, $value, $extra, $selected, $text); 1658 } 1659 1660 1661 /** 1662 * 1663 * @TODO document 1664 * 1665 */ 1666 function input_button($id, $text, $class = '', $extra = ''){ 1667 return sprintf('<span id=\'%s\' class="%s button" %s >%s</span>', $id, $class, $extra, $text); 1668 } 1669 1670 } // End of Class
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Apr 6 23:00:27 2013 | Cross-referenced by PHPXref 0.7.1 |