Changeset 1591202
- Timestamp:
- 02/07/2017 05:04:37 PM (9 years ago)
- Location:
- wp-repo-tracker/trunk
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
src/plugin/RepoTrackerPlugin.php (modified) (2 diffs)
-
src/utils/CurlRequest.php (modified) (1 diff)
-
src/utils/PostTypeModel.php (modified) (3 diffs)
-
wp-repo-tracker.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-repo-tracker/trunk
- Property svn:ignore
-
old new 1 1 .git 2 2 .gitmodules 3 .gitignore 3 4 submodule
-
- Property svn:ignore
-
wp-repo-tracker/trunk/src/plugin/RepoTrackerPlugin.php
r1583266 r1591202 18 18 register_uninstall_hook($pluginFileName,array($this,"uninstall")); 19 19 20 //register_deactivation_hook($pluginFileName,array($this,"uninstall"));20 IssueFilter::register(); 21 21 22 IssueFilter::register(); 22 add_filter("register_kpis",array($this,"registerKpis")); 23 add_filter("measure_kpis",array($this,"measureKpis")); 23 24 } 24 25 … … 44 45 } 45 46 47 /** 48 * Register kpis for the wp-data-kpis plugin. 49 */ 50 public function registerKpis($kpis) { 51 $issueFitlers=IssueFilter::getAllPublished(); 52 53 foreach ($issueFitlers as $issueFilter) { 54 $kpis[$issueFilter->getPost()->post_name]=array( 55 "title"=>$issueFilter->getPost()->post_title 56 ); 57 } 58 59 return $kpis; 60 } 61 62 /** 63 * Measure the current kpis for the benefit of the wp-data-kpis plugin. 64 */ 65 public function measureKpis($kpis) { 66 $issueFitlers=IssueFilter::getAllPublished(); 67 68 foreach ($issueFitlers as $issueFilter) { 69 $kpis[$issueFilter->getPost()->post_name]= 70 $issueFilter->getNumIssues(); 71 } 72 73 return $kpis; 74 } 46 75 } -
wp-repo-tracker/trunk/src/utils/CurlRequest.php
r1583266 r1591202 93 93 )); 94 94 95 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 96 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 97 95 98 curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE); 96 99 curl_setopt($curl,CURLOPT_FOLLOWLOCATION,TRUE); -
wp-repo-tracker/trunk/src/utils/PostTypeModel.php
r1583266 r1591202 2 2 3 3 namespace repotracker; 4 5 use \WP_Query; 6 use \Exception; 4 7 5 8 /** … … 17 20 private final function __construct($post) { 18 21 $this->post=$post; 22 } 23 24 /** 25 * Get underlying post. 26 */ 27 public function getPost() { 28 return $this->post; 19 29 } 20 30 … … 72 82 73 83 /** 84 * Get all published posts of this posttype. 85 */ 86 public static function getAllPublished() { 87 if (!static::$posttype) 88 throw new Exception("Post type not set in subclass"); 89 90 $q=new WP_Query(array( 91 "post_type"=>static::$posttype, 92 "post_status"=>"publish", 93 "posts_per_page"=>-1 94 )); 95 96 $all=array(); 97 foreach ($q->get_posts() as $post) 98 $all[]=new static($post); 99 100 return $all; 101 } 102 103 /** 74 104 * Called when a post is saved. 75 105 * Override in subclass. -
wp-repo-tracker/trunk/wp-repo-tracker.php
r1583266 r1591202 5 5 GitHub Plugin URI: https://bitbucket.org/tunapanda/wp-repo-tracker 6 6 Description: Track issues from a code repository, and show them on your WordPress site. 7 Version: 0.0. 17 Version: 0.0.2 8 8 */ 9 9
Note: See TracChangeset
for help on using the changeset viewer.