[ Index ]

PHP Cross Reference of PageLines DMS

title

Body

[close]

/includes/ -> class.objects.php (source)

   1  <?php
   2  /**
   3   *
   4   *
   5   *  PageLines Color Calculations and Handling
   6   *
   7   *
   8   *  @package PageLines DMS
   9   *  @subpackage Post Types
  10   *  @since 2.0.b6
  11   *
  12   */
  13  class PLObject {
  14  
  15  
  16      /**
  17      *
  18      * @TODO document
  19      *
  20      */
  21  	function __contruct(){}
  22  
  23  
  24      /**
  25      *
  26      * @TODO document
  27      *
  28      */
  29  	function button( $text = '&nbsp;', $type = 'button', $color = 'grey', $args ){
  30  
  31          $defaults = array(
  32              'size'        => 'normal',
  33              'align'        => 'left',
  34              'display'    => null,
  35              'style'        => '',
  36              'action'    => '',
  37              'pid'        => 0,
  38              'class'        => null,
  39              'clear'        => false,
  40          );
  41  
  42          $a = wp_parse_args( $args, $defaults );
  43  
  44          $color_class = 'bl-'.$color;
  45          $size_class = 'bl-size-'.$a['size'];
  46          $position = 'bl-align-'.$a['align'];
  47  
  48          $classes = join(' ', array( $color_class, $size_class, $position, $a['class'] ) );
  49  
  50          $display = (isset($a['display'])) ?  'display: '.$a['display'] : '';
  51  
  52          $post_link = get_edit_post_link( $a['pid']);
  53  
  54          if($type == 'edit_post'){
  55  
  56              $element = 'a';
  57              $classes .= ' post-edit-link';
  58              $action = sprintf('href="%s"', $post_link );
  59          }elseif( $type = 'link'){
  60              $element = 'a';
  61              $action = sprintf('href="%s"', $a['action'] );
  62          }else{
  63              $element = 'span';
  64              $action = '';
  65          }
  66  
  67          $clear = ($a['clear']) ? '<div class="p fix">' : '';
  68          $clear_end = ($a['clear']) ? '</div>' : '';
  69  
  70  
  71          $button = sprintf( '<%1$s class="blink" %3$s><span class="blink-pad">%2$s</span></%1$s>', $element, $text, $action);
  72  
  73          $output = sprintf('%s<div class="%s blink-wrap" style="%s">%s</div>%s', $clear, $classes, $display, $button, $clear_end);
  74  
  75  
  76          if( $type == 'edit_post' && !isset($post_link) )
  77              return '';
  78          else
  79              return apply_filters('pagelines_button', $output, $a);
  80  
  81      }
  82  
  83  }
  84  
  85  /**
  86  *
  87  * @TODO do
  88  *
  89  */
  90  function blink($text = '&nbsp;', $type = 'button', $color = 'grey', $args){
  91      return PLObject::button($text, $type, $color, $args);
  92  }
  93  
  94  /**
  95  *
  96  * @TODO do
  97  *
  98  */
  99  function blink_edit( $post_id = '', $color = 'grey', $args = array()){
 100  
 101      if($post_id == ''){
 102          global $post;
 103          $post_id = $post->ID;
 104      }
 105  
 106      $args['pid'] = $post_id;
 107      $args['align'] = (isset($args['align'])) ? $args['align'] : 'right';
 108  
 109      return PLObject::button(__('Edit', 'pagelines'), 'edit_post', $color, $args);
 110  }
 111  


Generated: Sun Dec 1 19:43:16 2013 Cross-referenced by PHPXref 0.7.1