コード例 #1
0
 public function render()
 {
     if (self::$first_time) {
         self::$first_time = false;
     } else {
         return false;
     }
     // Quick error checking (to avoid notices)
     $thisPage = isset(self::$pointers[$this->page]) && is_array(self::$pointers[$this->page]) ? self::$pointers[$this->page] : array();
     $allPages = isset(self::$pointers['all']) && is_array(self::$pointers['all']) ? self::$pointers['all'] : array();
     // select pointers assigned as 'all' and for current page
     $pointers = array_merge((array) $allPages, (array) $thisPage);
     // generating javascript
     $javascript = '';
     // $javascript .= '<script type="text/javascript">';
     $javascript .= 'jQuery(document).ready(function () {';
     $javascript .= 'if(typeof(jQuery().pointer) != "undefined") {';
     foreach ($pointers as $pointer) {
         // check if this pointer already declined by user
         if (!in_array($pointer['name'], explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true)))) {
             // add pointer
             $javascript .= 'jQuery("' . $pointer['target'] . '").pointer({';
             if (is_array($pointer['content'])) {
                 $javascript .= 'content: "<h3>' . $pointer['content']['title'] . '</h3>' . $pointer['content']['body'] . '"';
             } else {
                 $javascript .= 'content: "' . $pointer['content'] . '"';
             }
             // set pointer position options
             if (isset($pointer['position'])) {
                 $javascript .= ', position: { ';
                 $javascript .= $pointer['position'];
                 $javascript .= ' }, ';
             }
             // set pointer dismiss call
             $javascript .= 'close: function() {';
             $javascript .= 'jQuery.post( ajaxurl, {';
             $javascript .= 'pointer: "' . $pointer['name'] . '",';
             $javascript .= 'action: "dismiss-wp-pointer"';
             $javascript .= '})';
             $javascript .= '}}).pointer("open");';
         }
     }
     $javascript .= '}});';
     // $javascript .= '</script>';
     // render script
     echo '<script type="text/javascript">' . $javascript . '</script>';
 }
コード例 #2
0
 function title_button_edit_page($title)
 {
     global $page_options, $developerMode;
     // Get the current page info
     $alias = $_GET['page'];
     $current = isset($page_options[$alias]) ? $page_options[$alias] : '';
     $template = get_template();
     // The parent theme
     // If this is a child theme and $page_options[$alias] exists...
     // - Only when still working on child thme, could later test against a "developer mode" variable.
     if ($template == 'runway-framework' && $current) {
         // Append the button ot the title
         $title .= ' <a href="' . admin_url('admin.php?page=options-builder&navigation=edit-page&page_id=' . $current['id']) . '" title="' . __('Edit this page', 'framework') . '" class="add-new-h2">' . __('Edit Page', 'framework') . '</a>';
     }
     if (IS_CHILD && $developerMode && $current) {
         // Reset defaults
         $title .= ' <a href="' . esc_url(admin_url('admin.php?page=options-builder&navigation=reset-fields-page&page_id=' . $current['id'])) . '" onclick="return confirm(\'' . __('This will delete all saved settings on this page.\\nAre you sure you want to to continue?', 'framework') . '\')" title="' . __('Reset all fields to defaults values.', 'framework') . '" class="add-new-h2">' . __('Reset Defaults', 'framework') . '</a>';
         // Toggle Developer Info
         $title .= ' <a href="#" title="' . __('Show or hide the developer information.', 'framework') . '" class="add-new-h2" id="ToggleDevMode">' . __('Toggle Developer Info', 'framework') . '</a>';
         // Add a pointer describing the function of the developer toggle
         WP_Pointers::add_pointer('all', '#ToggleDevMode', array('title' => __('Developer Functions', 'framework'), 'body' => '<p>' . __('Show PHP references used to output options in theme files', 'framework') . '.</p>'), 'edge: "top", align: "left"');
     }
     return $title;
 }
コード例 #3
0
ファイル: load.php プロジェクト: ArnaudGuillou/SiteESBVolley
        if (get_template() == 'runway-framework') {
            add_submenu_page('current-theme', 'Add Options Page', '+ Add Options Page', 'administrator', 'admin.php?page=options-builder&navigation=new-page');
        }
    }
    add_action('admin_menu', 'add_child_theme_submenu', 11);
    // lower priority, 11, forces item to end of sub-menu
    function clear_submenu()
    {
        global $submenu;
        unset($submenu['framework-options'][0]);
        unset($submenu['downloads'][0]);
        unset($submenu['current-theme'][0]);
    }
    add_action('admin_menu', 'clear_submenu', 100);
    //-----------------------------------------------------------------
    // WP-Pointers (temporary location)
    //-----------------------------------------------------------------
    // Dashboard "Getting Started"
    if (is_admin() && isset($_GET['page']) && $_GET['page'] !== 'dashboard' && !isset($_GET['activate-default'])) {
        WP_Pointers::add_pointer('all', 'a.wp-first-item[href=\'admin.php?page=dashboard\']', array('title' => 'Start Here', 'body' => '<p>Visit the dashboard and learn how Runway works to start making awesome themes today.</p>'), 'edge: "left", align: "center"');
    }
} else {
    // This is no good. The PHP version needs to be higher. :(
    // ----------------------------------------------------------------
    add_action('admin_notices', 'php_version_warning_message');
    function php_version_warning_message()
    {
        global $current_screen;
        echo '<div id="message" class="error">', '<h3><strong>You must have PHP v5.3.1 or later to use this theme.</strong></h3>', '<p>You can try adding the following to the top of to your .htaccess file in the WordPress root directory:</p>', '<p><code style="font-size: 14px; font-weight: 800;">AddType application/x-httpd-php53 .php</code></p>', '<p>If that does not work, contact your host and ask them to update your PHP version. The theme will not be functional until this issue is corrected.</p>', '</div>';
    }
}