Beispiel #1
0
 /**
  * Implements hook_node_load().
  */
 private static function doNodeLoad($nodes, $types)
 {
     // Only deal with node types that have the Node expire feature enabled.
     $ntypes = variable_get('node_expire_ntypes', array());
     $node_expire_enabled = array();
     // Check if node_expire are enabled for each node.
     // If node_expires are not enabled, do nothing.
     foreach ($nodes as $node) {
         // Store whether node_expires are enabled for this node.
         if (isset($ntypes[$node->type]) and $ntypes = $ntypes[$node->type]) {
             $node_expire_enabled[] = $node->nid;
         }
     }
     // For nodes with node_expire enabled, fetch information from the database.
     if (!empty($node_expire_enabled)) {
         $handle_content_expiry = ConfigHandler::getHandleContentExpiry();
         $result = DbHandler::selectForNodeLoad($node_expire_enabled);
         foreach ($result as $record) {
             if ($handle_content_expiry == 0) {
                 $nodes[$record->nid]->expire = $record->expire;
             } else {
                 $ntype = isset($ntypes[$record->type]) ? $ntypes[$record->type] : NULL;
                 $nodes[$record->nid]->expire = TimestampUtils::dateDbToStr($record->expire, $ntype);
             }
             $nodes[$record->nid]->expired = $record->expired;
             $nodes[$record->nid]->lastnotify = $record->lastnotify;
         }
     }
 }