예제 #1
0
 public function test_load()
 {
     global $twig, $apps;
     // Register and load test_app
     \mtv\register_app('test_app', dirname(__FILE__) . '/test_app');
     $apps = array('test_app');
     \mtv\load($apps);
     // Make sure test_app home view function is loaded
     $this->assertTrue(function_exists('test_app\\views\\home'));
     // Make sure test_app TestModel class is loaded
     $this->assertTrue(class_exists('test_app\\models\\TestModel'));
     // Make sure Twig was reinitialized
     $this->assertTrue(!empty($twig));
 }
예제 #2
0
 *     ...
 * }
 * </code>
 *
 * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
/**
 * MTV refactor
 **/
# Configure MTV
if (function_exists('mtv\\register_app')) {
    mtv\register_app('twentyeleven_theme', __DIR__);
}
# Setup enabled apps
global $apps;
$apps = array('twentyeleven_theme', 'wp');
/**
 * Set the content width based on the theme's design and stylesheet.
 */
if (!isset($content_width)) {
    $content_width = 584;
}
/**
 * Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run.
 */
add_action('after_setup_theme', 'twentyeleven_setup');
if (!function_exists('twentyeleven_setup')) {
예제 #3
0
<?php

/* 
* Our PHP functions. Any functions we want to register 
* with Twig can go in templatetags/functions.php 
*/
/*
* Configure MTV
*
* This makes MTV aware of an app. This function doesn't 
* load the app; it simply names the app for later reference.
* All we need to provide is the theme’s name and the path it’s on. 
*/
if (function_exists('mtv\\register_app')) {
    mtv\register_app('mtv_theme', __DIR__);
}
/* 
* Set up enabled apps
* 
* Declares a global variable that contains an array of all our 
* installed apps. The order of items in the array matters. 
* When rendering a template, Twig uses this order to look 
* for templates that match. The wp app that is included 
* with the MTV plugin registers a lot of WordPress functions 
* for you to use in your templates.
*/
global $apps;
$apps = array('mtv_theme', 'wp');
# Widgetize our sidebar
if (function_exists('register_sidebar')) {
    register_sidebar('sidebar-1');
예제 #4
0
 */
/*
Plugin Name: Wordpress MTV
Plugin URI: http://blog.apps.chicagotribune.com
Description: A simple framework for building custom apps and features
    on top of wordpress
Author: Ryan Mark, Ryan Nagle
Version: 1.0
*/
include 'mtv.php';
use mtv\shortcuts;
/**
 * Initialize the MTV framework
 **/
# MTV comes with an App for WordPressy stuff
mtv\register_app('wp', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wp');
/**
 * Register javascript libraries
 **/
$js_runtime_settings = array('ajaxurl' => admin_url('admin-ajax.php'), 'current_blog_id' => get_current_blog_id(), 'DEBUG' => false);
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
    wp_register_script('mtv-all', plugins_url('/mtv/devjs/mtv.js'), array('jquery'), MTV_VERSION);
    $js_runtime_settings['DEBUG'] = true;
} else {
    wp_register_script('mtv-all', plugins_url('/mtv/mtv.min.js'), array('jquery'), MTV_VERSION);
}
wp_localize_script('mtv-all', 'WordPress', $js_runtime_settings);
unset($js_runtime_settings);
/**
 * Use the URL resolver for ajax calls
 **/