You are here

abstract class PurgePurgerBundle in Purge 7.2

Class definition for basic bundles.

Bundles are objects containing purposed set of properties and methods, depending on its subclass.

This is a basic parent class.

Hierarchy

Expanded class hierarchy of PurgePurgerBundle

File

includes/purge.class.inc, line 754
Contains all class and interface definitions for Purge.

View source
abstract class PurgePurgerBundle extends PurgePurger {
  public $type = array();

  /**
   * Override for parents sleep to make sure we include the bundled objects.
   */
  public function __sleep() {

    // First let call the parent function.
    $return_properties = parent::__sleep();

    // Add each type to the item array.
    foreach ($this->item as $type_name => $items) {
      if (!isset($return_properties[$type_name])) {
        $return_properties[] = $type_name;
      }
    }
    return $return_properties;
  }

  /**
   * Set the item objects linked in this bundle when waking up.
   */
  public function __wakeup() {

    // Each item in the item array.
    foreach ($this->item as $type_name => $items) {
      foreach ($this->{$type_name} as $bundle_item_name => $bundle_item) {

        // Check if the item contains items.
        if (isset($this->{$type_name}[$bundle_item_name]->item)) {
          foreach ($this->{$type_name}[$bundle_item_name]->item as $item_type => $item_names) {
            foreach ($item_names as $item_name) {

              // Set the item to the bundle item.
              // dprint_r($this->{$type_name}[$bundle_item_name]->{$item_type});
              // if$this->{$type_name}[$bundle_item_name]->{$item_type} = array();
              $this->{$type_name}[$bundle_item_name]->{$item_type}[$item_name] = $this->{$item_type}[$item_name];
            }
          }
        }
      }
    }
  }

  /**
   * Function to select data from the dataset.
   *
   * @return array $data
   */
  public function get_data() {

    // Get the data from the given dataset.
    $data = array();
    $data = variable_get('purge_config', NULL);
    return $data;
  }

  /**
   * Function to set the type objects.
   */
  public function set_types($data) {

    // Get the datastructure of the types up.
    foreach ($data['type'] as $type_name => $type_data) {

      // And create an object for each type
      $this->type[$type_name] = unserialize($type_data);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Purge::$access public property
Purge::$available public property
Purge::$depend public property
Purge::$description public property
Purge::$enabled public property
Purge::$item public property
Purge::$name public property
Purge::$option public property
Purge::validate public function Does basic dependency checks for builtin dependencies. 5
PurgePurger::$domain public property
PurgePurger::$handler public property
PurgePurger::$header public property
PurgePurger::$queue public property
PurgePurger::$target public property
PurgePurgerBundle::$type public property
PurgePurgerBundle::get_data public function Function to select data from the dataset.
PurgePurgerBundle::set_types public function Function to set the type objects.
PurgePurgerBundle::__sleep public function Override for parents sleep to make sure we include the bundled objects. Overrides Purge::__sleep
PurgePurgerBundle::__wakeup public function Set the item objects linked in this bundle when waking up.