Пример #1
0
/**
 * Conditionally enqueues the scripts used in the admin.
 *
 * Includes Thickbox, theme preview and a Genesis script (actually enqueued
 * in genesis_load_admin_js()).
 *
 * @since 0.2.3
 *
 * @uses genesis_load_admin_js()
 * @uses genesis_is_menu_page()
 * @uses genesis_update_check()
 * @uses genesis_seo_disabled()
 *
 * @global stdClass $post Post object
 *
 * @param string $hook_suffix Admin page identifier.
 */
function genesis_load_admin_scripts($hook_suffix)
{
    /** Only add thickbox/preview if there is an update to Genesis available */
    if (genesis_update_check()) {
        add_thickbox();
        wp_enqueue_script('theme-preview');
        genesis_load_admin_js();
    }
    /** If we're on a Genesis admin screen */
    if (genesis_is_menu_page('genesis') || genesis_is_menu_page('seo-settings') || genesis_is_menu_page('design-settings')) {
        genesis_load_admin_js();
    }
    global $post;
    /** If we're viewing an edit post page, make sure we need Genesis SEO JS */
    if ('post-new.php' == $hook_suffix || 'post.php' == $hook_suffix) {
        if (!genesis_seo_disabled() && post_type_supports($post->post_type, 'genesis-seo')) {
            genesis_load_admin_js();
        }
    }
}
Пример #2
0
 /**
  * Load the necessary scripts for this admin page.
  *
  * @since 1.8.0
  *
  */
 function scripts()
 {
     /** Load parent scripts as well as Genesis admin scripts */
     parent::scripts();
     genesis_load_admin_js();
 }
/**
 * Conditionally enqueue the scripts used in the admin.
 *
 * Includes Thickbox, theme preview and a Genesis script (actually enqueued in genesis_load_admin_js()).
 *
 * @since 0.2.3
 *
 * @uses genesis_load_admin_js() Enqueues the custom script and localizations used in the admin.
 * @uses genesis_is_menu_page()  Check that we're targeting a specific Genesis admin page.
 * @uses genesis_update_check()  Ping http://api.genesistheme.com/ asking if a new version of this theme is available.
 * @uses genesis_seo_disabled()  Detect whether or not Genesis SEO has been disabled.
 *
 * @param string $hook_suffix Admin page identifier.
 */
function genesis_load_admin_scripts($hook_suffix)
{
    //* Only add thickbox/preview if there is an update to Genesis available
    if (genesis_update_check()) {
        add_thickbox();
        wp_enqueue_script('theme-preview');
        genesis_load_admin_js();
    }
    //* If we're on a Genesis admin screen
    if (genesis_is_menu_page('genesis') || genesis_is_menu_page('seo-settings') || genesis_is_menu_page('design-settings')) {
        genesis_load_admin_js();
    }
    //* If we're viewing an edit post page, make sure we need Genesis SEO JS
    if (in_array($hook_suffix, array('post-new.php', 'post.php'))) {
        if (!genesis_seo_disabled() && post_type_supports(get_post_type(), 'genesis-seo')) {
            genesis_load_admin_js();
        }
    }
}
Пример #4
0
/**
 * Helper function that outputs the form elements necessary to select a layout.
 *
 * You must manually wrap this in an HTML element with the class of
 * 'genesis-layout-selector' in order for the CSS and Javascript to apply properly.
 *
 * Supported $args keys are:
 *   name (default is ''),
 *   selected (default is ''),
 *   echo (default is true).
 *
 * The Genesis admin script is enqueued to ensure the layout selector behaviour
 * (amending label class to add border on selected layout) works.
 *
 * @since 1.7.0
 *
 * @uses genesis_get_layouts() Get all registered layouts
 *
 * @param array $args Optional. Function arguments. Default is empty array
 * @return string HTML markup of labels, images and radio inputs for layout selector
 */
function genesis_layout_selector($args = array())
{
    /** Enqueue the Javascript */
    genesis_load_admin_js();
    /** Merge defaults with user args */
    $args = wp_parse_args($args, array('name' => '', 'selected' => '', 'type' => '', 'echo' => true));
    $output = '';
    foreach (genesis_get_layouts($args['type']) as $id => $data) {
        $class = $id == $args['selected'] ? ' selected' : '';
        $output .= sprintf('<label title="%1$s" class="box%2$s"><img src="%3$s" alt="%1$s" /><br /> <input type="radio" name="%4$s" id="%5$s" value="%5$s" %6$s /></label>', esc_attr($data['label']), esc_attr($class), esc_url($data['img']), esc_attr($args['name']), esc_attr($id), checked($id, $args['selected'], false));
    }
    /** Echo or return output */
    if ($args['echo']) {
        echo $output;
    } else {
        return $output;
    }
}
Пример #5
0
 /** Load parent scripts as well as Genesis admin scripts **/
 function scripts()
 {
     parent::scripts();
     genesis_load_admin_js();
 }
Пример #6
0
 function scripts()
 {
     parent::scripts();
     genesis_load_admin_js();
     wp_enqueue_script('cuttz-admin-js', CHILD_URL . '/lib/js/cuttz-admin.js');
     wp_localize_script('cuttz-admin-js', 'cuttz-framework', array('pageHook' => $this->pagehook, 'firstTime' => !is_array(get_user_option('closedpostboxes_' . $this->pagehook)), 'confirmUpgrade' => __("Updating Cuttz will overwrite the core skins inside Cuttz.\nIf you haven't already done so, move them to cuttz-user&raquo;skins folder.\nAre you sure you ready to update Cuttz?. \"Cancel\" to stop, \"OK\" to update.", 'cuttz-framework')));
 }
 function scripts()
 {
     parent::scripts();
     genesis_load_admin_js();
     wp_enqueue_script('farbtastic');
     wp_enqueue_script('jquery');
     wp_enqueue_script('cuttz-chosen-js', CHILD_URL . '/lib/js/chosen.jquery.min.js');
     wp_enqueue_script('cuttz-admin-js', CHILD_URL . '/lib/js/cuttz-admin.js');
     wp_localize_script('cuttz-admin-js', 'cuttz-framework', array('pageHook' => $this->pagehook, 'firstTime' => !is_array(get_user_option('closedpostboxes_' . $this->pagehook)), 'cuttz_fonts' => json_encode($this->cuttz_fonts)));
 }