Example #1
0
 public function url($args = array()) {
   
   global $wf;
   
   $r = wp_parse_args( 
     $args,
     array(
       "root_relative" => false
     )
   );
   
   if (!isset($r["protocol"])) {
     $r["protocol"] = ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on") ? "https://" : "http://";
   }
   
   $url = $r["protocol"].$this->full_path();
   
   if ($r["root_relative"]) {
     $url = WOOF::root_relative_url($url);
   }
   
   return apply_filters("woof_permalink", $url."/");
   
 }
Example #2
0
 function url($root_relative = false) {
   global $wf;
   
   $u = $this->url;
   
   if ($root_relative) {
     return WOOF::root_relative_url($u);
   } else {
     return $wf->purl($u);
   }
 }
Example #3
0
  public function url($root_relative = true) {
    $url = get_author_posts_url($this->id());
    
    if ($root_relative) {
      return WOOF::root_relative_url($url);
    }

    return $url;
    
  }
Example #4
0
 public function url() {
   return WOOF::root_relative_url( $this->permalink() );
 }
Example #5
0
 function site_url($root_relative = false) {
   $url = get_bloginfo("url");
   
   if ($root_relative) {
     return WOOF::root_relative_url($url);
   }
   
   return $url;
 }
Example #6
0
  static function combine_type_scripts() {
    
    $files = array();
    
    $type_keys = MPFT::type_keys();

    // files to merge
    
    foreach (MPFT::type_keys() as $type) {
      $base = WOOF::root_relative_url( MPU::type_file_url($type, "") );
      $file = MPU::type_file_path($type, "mpft-$type.js");
      
      if (file_exists($file)) {
        $files[] = array("base" => $base, "file" => $file);
      }
    }
    
    $image_base = WOOF::root_relative_url( MASTERPRESS_IMAGES_URL );
    // we'll be able to kick this off with an AJAX action in the MasterPress overview
    // the dev guide for field types must point the "REBUILD" process out to developers!
    // we can also run this on install and upgrade, so that if field types change, the files would be rebuilt 
    
    // get code from archive folder if it exists, otherwise grab latest files, merge and save in archive folder
    
    if (file_exists(MASTERPRESS_CONTENT_MPFT_CACHE_DIR) && is_writable ( MASTERPRESS_CONTENT_MPFT_CACHE_DIR ) ) {

      // get and merge code

      $content = '';

      foreach ($files as $file) {
         $content .= file_get_contents($file["file"]);
      }

      MPU::incl_lib("jsminplus.php");
      $content = JSMinPlus::minify($content);
      
      $handle = fopen(MASTERPRESS_CONTENT_MPFT_CACHE_DIR."mpft-all.js", 'w');

      if ($handle) {
        if (flock($handle, LOCK_EX)) {
          fwrite($handle, $content);
          flock($handle, LOCK_UN);
        }
    
        fclose($handle);
      }
      
    }

  }
Example #7
0
 function edit_url($root_relative = true) {
   $url = admin_url("post.php?post=".$this->id()."&action=edit");
   
   if ($root_relative) {
     return WOOF::root_relative_url( $url );
   } 
   
   return $url;
 }