Plugin Directory

Changeset 640080


Ignore:
Timestamp:
12/16/2012 04:41:13 PM (13 years ago)
Author:
phill_brown
Message:

1.1 release

Location:
context-manager
Files:
53 added
5 edited

Legend:

Unmodified
Added
Removed
  • context-manager/trunk/plugin.php

    r640003 r640080  
    22/*
    33Plugin Name: Context Manager
    4 Description: Context-based rules for menus, widgets and the body class.
     4Description: Make your site react to users' context by changing your theme's CSS and JavaScript files, navigation menus, sidebars and the HTML body tag.
    55Author: Phill Brown
    66Author URI: http://pbweb.co.uk
    7 Version: 1.0.2
     7Version: 1.1
    88
    99Copyright 2012 Phill Brown (email: wp@pbweb.co.uk)
     
    3939        // Setup reactions
    4040        require_once dirname( __FILE__ ) . '/reactions/base.php';
    41         foreach ( array( 'Menu', 'Widgets', 'Body_Class' ) as $reaction ) {
     41        foreach ( array( 'Assets', 'Menu', 'Widgets', 'Body_Class' ) as $reaction ) {
    4242
    4343            // Include reaction
     
    4646            // Instantiate reactions
    4747            $class_name = 'Context_Manager_Reaction_' . $reaction;
    48             $reactions[ $class_name ] = new $class_name( &$this );
     48            $reactions[ $class_name ] = new $class_name( $this );
    4949        }
    5050
     
    5555        if ( is_admin() ) {
    5656            require_once dirname( __FILE__ ) . '/admin/admin.php';
    57             $admin = new Context_Manager_Admin( &$this );
     57            $admin = new Context_Manager_Admin( $this );
    5858        }
    5959
     
    7575        $this->meta_boxes = array(
    7676            'conditions' => new Context_Manager_Meta_Box_Conditions(),
    77             'reactions' => new Context_Manager_Meta_Box_Reactions( &$this ),
     77            'reactions' => new Context_Manager_Meta_Box_Reactions( $this ),
    7878        );
    7979
  • context-manager/trunk/reactions/base.php

    r640002 r640080  
    2323
    2424        // No form registered
    25         if ( ! $this->form() ) return;
     25        if ( ! $this->form( false ) ) return;
    2626
    2727        // Setup meta query conditions
    2828        $meta_queries = array();
    29         foreach( $this->form() as $field_name => $field_data ) {
     29        foreach( $this->form( false ) as $field_name => $field_data ) {
    3030            $meta_queries[] = array(
    3131                'key' => $this->field_prefix() . $field_name,
     
    3434            );
    3535        }
    36 
     36       
    3737        // Get context rules
    3838        return get_posts( array(
    3939            'post_type' => $this->plugin->post_type,
    4040            'numberposts' => -1,
    41             'meta_query' => array_merge( array( 'condition' => 'OR' ), $meta_queries ),
     41            'meta_query' => array_merge( array( 'relation' => 'OR' ), $meta_queries ),
    4242        ) );
    4343    }
  • context-manager/trunk/reactions/menu.php

    r639694 r640080  
    5454            'rules' => array(
    5555                'title' => __( 'Apply this rule:' , 'context-manager' ),
    56                 'type' => 'radio',
     56                'type' => 'select',
    5757                'value' => array_combine(
    5858                    array_keys( $this->handlers ),
     
    110110
    111111                // Let the menu handler do the magic
    112                 call_user_func( array( $this->handlers[ $applied_handler ], 'handler' ), $context_rule_data, &$this );
     112                call_user_func_array( array( $this->handlers[ $applied_handler ], 'handler' ), array( $context_rule_data, &$this ) );
    113113            }
    114114        }
  • context-manager/trunk/reactions/widgets.php

    r640003 r640080  
    1111    }
    1212
    13     function form() {
     13    function form( $preprocess = true ) {
    1414
    1515        // Hack to stop wp_get_sidebars_widgets() getting in an infinite loop
    16         if ( ! $this->form_skip_get_values ) {
     16        if ( $preprocess ) {
    1717            // Map widgets and sidebars
    1818            foreach( wp_get_sidebars_widgets() as $sidebar_id => $sidebar_widgets ) {
     
    5353    function hide_widgets( $sidebars_widgets ) {
    5454
    55         // As we're calling wp_get_sidebars_widgets() in form() - we need a hack to stop PHP getting into an infinite loop
    56         $this->form_skip_get_values = true;
    5755        if ( ! $context_rules = $this->get_rules() ) return $sidebars_widgets;
    58         $this->form_skip_get_values = false;
    59 
    6056        foreach ( $context_rules as $context_rule ) {
    6157            if ( ! $this->plugin->conditions_match( $context_rule ) ) continue;
  • context-manager/trunk/readme.txt

    r640003 r640080  
    22Contributors: phill_brown
    33Donate link: http://pbweb.co.uk/donate
    4 Tags:  context, rules, widget logic, menu rules, body class, widgets, parent menu, active menu
     4Tags:  context, wp_enqueue_styles, wp_enqueue_scripts, rules, widget logic, menu rules, body class, widgets, parent menu, active menu
    55Requires at least: 3.2
    66Tested up to: 3.5
    7 Stable tag: 1.0.2
     7Stable tag: 1.1
    88
    9 Make your site react to contextual conditions using a point and click interface
     9Make your site react to users' context by changing your theme's CSS and JavaScript files, navigation menus, sidebars and the HTML body tag.
    1010
    1111== Description ==
    1212
    13 Context Manager lets you apply your own context rules and reactions to the menu system, your theme's sidebars and the HTML body tag.
     13Context Manager makes your site behave differently depending on the current user's context. Using the simple point-and-click admin pages, there are four different ways your site can react:
     14
     151. Include and exclude CSS and JavaScript files
     161. Changing the behaviour of menu items
     171. Hiding widgets in sidebars
     181. Adding extra classes to the `<body>` tag.
    1419
    1520The plugin supersedes [Menu Rules](http://wordpress.org/extend/plugins/menu-rules/)
     
    2126A user visits 'shop' and the menu item becomes 'active', but when they click through to an individual product, the menu item loses its state. The user becomes lost.
    2227
    23 On the product page, there are irrelevant widgets that distract the user from making a purchase.
    24 
    25 The whole shop section requires its own colour scheme, but there's no common class that ties all the pages together.
    26 
    27 Context Manager can fix all of these things.
    28 
    29281. [Install](http://wordpress.org/extend/plugins/context-manager/installation/) the Context Manager plugin
    30291. Add a new context rule
     
    33321. Choose *Emulate current page as a child but do not create a menu item.* as the menu rule
    34331. Find your products page in the menu dropdown
    35 1. Hide irrelevant widgets under the *widgets* reaction
    36 1. Enter a meaningful class name in the *body class* reaction
    37 1. Hit publish
    3834
    39 See a [screenshot](http://wordpress.org/extend/plugins/context-manager/screenshots/) of the above setup.
     35On the product page, there are irrelevant widgets that distract the user from making a purchase.
     36
     37* Hide irrelevant widgets under the *widgets* reaction
     38
     39The whole shop section requires its own colour scheme, but there's no common class that ties all the pages together.
     40
     41* Enter `shop-section` class name in the *body class* reaction. Or alternatively, register another stylesheet using [`wp_register_style()`](http://codex.wordpress.org/Function_Reference/wp_register_style) in you theme's `functions.php`.
     42* Create
     43
     44Remember to click publish when you're ready to save.
     45
     46Have a look at [screenshots](http://wordpress.org/extend/plugins/context-manager/screenshots/) to see the above setup in action.
    4047
    4148= Support =
     
    5360
    54611. An example setup for a products section in a online shop
     622. CSS and JavaScript reactions
    5563
    5664== Changelog ==
     65
     66= 1.1 =
     67* [Added]: Assets reaction
     68* [Bugfix]: get_rules() using incorrect meta_query parameter
     69* [Bugfix]: PHP 5.4 fatal errors
    5770
    5871= 1.0.2 =
Note: See TracChangeset for help on using the changeset viewer.