Esempio n. 1
0
 /**
  * Direct index.php to the appropriate function
  * 
  * @return bool
  **/
 public static function direct()
 {
     //If viewing the visual editor, stop the template loading and show the visual editor.
     if (self::is_visual_editor()) {
         //If user is logged in and can't visually edit, loop them back to normal template.
         if (is_user_logged_in() && !HeadwayCapabilities::can_user_visually_edit()) {
             wp_die('You have insufficient permissions to use the Headway Visual Editor.<br /><br /><a href="' . home_url() . '">Return to Home</a>');
             return false;
             //If the user isn't logged in at all, log 'em in and loop back to visual editor as long as debug mode isn't active
         } elseif (!is_user_logged_in() && !HeadwayOption::get('debug-mode')) {
             return auth_redirect();
         }
         HeadwayVisualEditor::display();
         die;
         //Theme Preview
     } elseif (self::is_theme_preview()) {
         return wp_die('Headway and Headway Child Themes cannot be previewed.  Please activate the theme if you wish to see how it looks.');
     } elseif (self::is_grid()) {
         Headway::load('visual-editor/iframe-grid');
         HeadwayVisualEditorIframeGrid::show();
         die;
     }
 }