예제 #1
0
파일: anchors.php 프로젝트: rair/yacs
 /**
  * duplicate items related to one anchor
  *
  * This function is invoked  when some anchor is duplicated.
  *
  * Note: do not refer here to objects that will be duplicated through
  * overlays, such as Dates.
  *
  * The duplicate_related_to hook is used to invoke any software extension bound as follows:
  * - id: 'shared/anchors.php#duplicate_related_to'
  * - type: 'include'
  * - parameters: array of strings referencing origin and target anchors
  *
  * @param string reference of the source anchor (e.g., 'article:12')
  * @param string reference of the target anchor (e.g., 'article:12')
  */
 public static function duplicate_related_to($from_anchor, $to_anchor)
 {
     global $context;
     // duplicate related articles
     Articles::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related categories
     Categories::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related comments
     include_once $context['path_to_root'] . 'comments/comments.php';
     Comments::duplicate_for_anchor($from_anchor, $to_anchor);
     // do not duplicate related dates -- this will be done through overlays
     // duplicate related files
     Files::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related images
     include_once $context['path_to_root'] . 'images/images.php';
     Images::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related links
     include_once $context['path_to_root'] . 'links/links.php';
     Links::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related locations
     include_once $context['path_to_root'] . 'locations/locations.php';
     Locations::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related sections
     Sections::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate related tables
     include_once $context['path_to_root'] . 'tables/tables.php';
     Tables::duplicate_for_anchor($from_anchor, $to_anchor);
     // duplicate memberships for this anchor
     Members::duplicate_for($from_anchor, $to_anchor);
     // the duplicate_related_to hook
     if (is_callable(array('Hooks', 'include_scripts'))) {
         $context['text'] .= Hooks::include_scripts('shared/anchors.php#duplicate_related_to', array($from_anchor, $to_anchor));
     }
     // clear the cache as well
     Cache::clear();
 }