function theme_admin_page()
 {
     extract($this->theme_admin_controller());
     // get custom views
     ob_start();
     include WPHF::d_path(array(self::$admin_path, 'guide.php'));
     $output = ob_get_contents();
     if (WPHF::exists($links)) {
         foreach ($links as $name => $link) {
             extract($link);
             $patterns[] = "<a class=\"{$name}\"";
             $replacement = "<a class=\"{$name}\" href=\"{$url}\"";
             if (isset($tip)) {
                 $replacement .= " title\"{$tip}\"";
             }
             $replacements[] = $replacement;
         }
         // TODO - works for now, though would rather use preg_replace
         $output = str_replace($patterns, $replacements, $output);
     }
     ob_end_clean();
     echo $output;
 }
예제 #2
0
 function get_image($args)
 {
     $defaults = array('query' => array('post_parent' => $this->post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'output' => ARRAY_A), 'type' => NULL, 'size' => 'large', 'tip_key' => 'post_title', 'default_attachment_id' => 0, 'default_attachment_size' => '', 'filters' => array('image_location' => 1, 'image_number' => 1, 'stretch_width' => FALSE, 'stretch_height' => FALSE, 'no_background' => FALSE));
     extract(WPHF::md_wp_parse_args($args, $defaults));
     $type = WPHF::exists($type) ? $type : $size;
     // set up filters
     if ($filters['stretch_width']) {
         $min_width = !is_numeric($filters['stretch_width']) ? get_option($size) : $filters['stretch_width'];
     }
     if ($filters['stretch_height']) {
         $min_width = !is_numeric($filters['stretch_height']) ? get_option($size) : $filters['stretch_height'];
     }
     // get attachments
     $images = $this->query_images($query, $size, $type, $default_attachment_id, $default_attachment_size, $tip_key);
     if ($query['numberposts'] > 1 or $query['numberposts'] == -1) {
         return $images;
     } elseif (count($images) != 1 and $diff = array_diff_assoc($defaults['filters'], $filters) and empty($diff)) {
         $images = $this->find_images($filters, $images);
         if (count($images) > 0 and $filters['image_number'] > 1) {
             return $images;
         }
     }
     // just one image
     $images = array_shift($images);
     return $images;
 }