Changeset 1105291
- Timestamp:
- 03/04/2015 05:44:02 PM (11 years ago)
- Location:
- twigify/trunk
- Files:
-
- 6 edited
-
lib/ContentTemplates/Query.php (modified) (1 diff)
-
lib/ContentTemplates/User.php (modified) (2 diffs)
-
lib/ContentTemplates/View.php (modified) (2 diffs)
-
lib/meta-boxes.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
twigify.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
twigify/trunk/lib/ContentTemplates/Query.php
r1058659 r1105291 8 8 global $wpdb; 9 9 $foundposts = new WP_Query($query_string); 10 //print_r($foundposts->query_vars);11 10 if ( $foundposts->have_posts() ) { 12 11 return $foundposts->get_posts(); -
twigify/trunk/lib/ContentTemplates/User.php
r1091590 r1105291 9 9 public $user; 10 10 11 public function field($field = "*") {11 public function __construct() { 12 12 if (!$this->user) { 13 13 $this->user = wp_get_current_user(); 14 14 } 15 } 16 17 public function field($field = "*") { 15 18 if ($field === "*") { 16 19 echo "<pre>"; … … 22 25 return false; 23 26 } 27 28 public function meta($key, $single=true) { 29 return get_user_meta($this->user->ID, $key, $single); 30 } 24 31 25 32 } -
twigify/trunk/lib/ContentTemplates/View.php
r1058659 r1105291 4 4 use \ContentTemplates\Rules; 5 5 use \ContentTemplatesPlugin as Plugin; 6 use \ContentTemplates\Terms; 7 use \ContentTemplates\Post; 8 use \ContentTemplates\Functions; 9 use \ContentTemplates\User; 6 10 use \Twig_Autoloader, 7 11 Twig_Loader_String, 8 12 Twig_Loader_Filesystem, 9 Twig_Environment; 10 use \ContentTemplates\Terms; 11 use \ContentTemplates\Post; 12 use \ContentTemplates\Functions; 13 Twig_Environment, 14 Twig_SimpleFunction; 13 15 14 16 class View { … … 60 62 $this->env->addGLobal( 'query', new Query() ); 61 63 $this->env->addGlobal( 'function', new Functions() ); 64 $this->env->addFunction( new Twig_SimpleFunction( 'is_user_logged_in', function() { return is_user_logged_in(); } ) ); 65 $this->env->addFunction( new Twig_SimpleFunction( 'current_user_can', function($privilege) { return current_user_can($privilege); } ) ); 66 $this->env->addGlobal( 'user', new User() ); 67 $this->env->addGlobal( 'post', new Post() ); 62 68 } 63 69 -
twigify/trunk/lib/meta-boxes.php
r1043611 r1105291 36 36 37 37 $meta_boxes['ct_post_metabox'] = array( 38 'id' => ' ContentTemplate',39 'title' => __( ' ContentTemplate', 'content-templates' ),38 'id' => 'Twigify Template', 39 'title' => __( 'Twigify Template', 'content-templates' ), 40 40 'desc' => 'You can set up global rules under the Content Templates >> Rules menu, or override for this template here', 41 41 'pages' => apply_filters("ct_available_post_types", $post_types), … … 46 46 'fields' => array( 47 47 array( 48 'name' => __( 'Override', 'cmb' ), 49 'desc' => __( 'Override content template to use', 'cmb' ), 48 'desc' => __( 'Select template to use for this post/page.', 'cmb' ), 50 49 'id' => "{$prefix}override_template", 51 50 'type' => 'select', -
twigify/trunk/readme.txt
r1089532 r1105291 5 5 Requires at least: 4.0.1 6 6 Tested up to: 4.1 7 Stable tag: 1. 1.2-beta7 Stable tag: 1.2.0-beta 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 62 62 = 1.1.2-beta = 63 63 * lowercase self for compatibility with php 5.4 64 65 = 1.2.0-beta = 66 * Adds global user/post capability. Also adds the is_user_logged_in() and current_user_can() functions. Cleans up some fields -
twigify/trunk/twigify.php
r1089532 r1105291 5 5 Description: Allows you to create content templates that will conditionally override the content of a post or page or customer post type 6 6 Author: Mike Van Winkle 7 Version: 1. 1.2-beta7 Version: 1.2.0-beta 8 8 Author URI: http://mikevanwinkle.com 9 9 Text Domain: twigify
Note: See TracChangeset
for help on using the changeset viewer.