Esempio n. 1
0
 /**
  * Set up the enqueue for the CSS & JavaScript files.
  *
  * @since 0.0.1
  */
 public function admin_load()
 {
     get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.') . '</p>' . '<p>' . __('To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.') . '</p>' . '<p>' . __('You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.') . '</p>' . '<p>' . __('Don&#8217;t forget to click on the Save Changes button when you are finished.') . '</p>'));
     get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
     hq_enqueue_media();
     hq_enqueue_script('custom-background');
     hq_enqueue_style('hq-color-picker');
 }
Esempio n. 2
0
            do_action('after_mu_upgrade', $response);
            unset($response);
        }
        unset($c);
    }
}
require_once ABSPATH . 'hq-admin/includes/admin.php';
auth_redirect();
// Schedule trash collection
if (!hq_next_scheduled('hq_scheduled_delete') && !defined('HQ_INSTALLING')) {
    hq_schedule_event(time(), 'daily', 'hq_scheduled_delete');
}
set_screen_options();
$date_format = get_option('date_format');
$time_format = get_option('time_format');
hq_enqueue_script('common');
/**
 * $pagenow is set in vars.php
 * $hq_importers is sometimes set in hq-admin/includes/import.php
 * The remaining variables are imported as globals elsewhere, declared as globals here
 *
 * @global string $pagenow
 * @global array  $hq_importers
 * @global string $hook_suffix
 * @global string $plugin_page
 * @global string $typenow
 * @global string $taxnow
 */
global $pagenow, $hq_importers, $hook_suffix, $plugin_page, $typenow, $taxnow;
$page_hook = null;
$editing = false;
Esempio n. 3
0
 /**
  * Initializes the new feature pointers.
  *
  * @since 0.0.1
  *
  * All pointers can be disabled using the following:
  *     remove_action( 'admin_enqueue_scripts', array( 'HQ_Internal_Pointers', 'enqueue_scripts' ) );
  *
  * Individual pointers (e.g. hq390_widgets) can be disabled using the following:
  *     remove_action( 'admin_print_footer_scripts', array( 'HQ_Internal_Pointers', 'pointer_hq390_widgets' ) );
  *
  * @static
  *
  * @param string $hook_suffix The current admin page.
  */
 public static function enqueue_scripts($hook_suffix)
 {
     /*
      * Register feature pointers
      *
      * Format:
      *     array(
      *         hook_suffix => pointer callback
      *     )
      *
      * Example:
      *     array(
      *         'themes.php' => 'hq390_widgets'
      *     )
      */
     $registered_pointers = array();
     // Check if screen related pointer is registered
     if (empty($registered_pointers[$hook_suffix])) {
         return;
     }
     $pointers = (array) $registered_pointers[$hook_suffix];
     /*
      * Specify required capabilities for feature pointers
      *
      * Format:
      *     array(
      *         pointer callback => Array of required capabilities
      *     )
      *
      * Example:
      *     array(
      *         'hq390_widgets' => array( 'edit_theme_options' )
      *     )
      */
     $caps_required = array();
     // Get dismissed pointers
     $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_hq_pointers', true));
     $got_pointers = false;
     foreach (array_diff($pointers, $dismissed) as $pointer) {
         if (isset($caps_required[$pointer])) {
             foreach ($caps_required[$pointer] as $cap) {
                 if (!current_user_can($cap)) {
                     continue 2;
                 }
             }
         }
         // Bind pointer print function
         add_action('admin_print_footer_scripts', array('HQ_Internal_Pointers', 'pointer_' . $pointer));
         $got_pointers = true;
     }
     if (!$got_pointers) {
         return;
     }
     // Add pointers script and style to queue
     hq_enqueue_style('hq-pointer');
     hq_enqueue_script('hq-pointer');
 }
Esempio n. 4
0
/** Load HiveQueen dashboard API */
require_once ABSPATH . 'hq-admin/includes/dashboard.php';
hq_dashboard_setup();
hq_enqueue_script('dashboard');
if (current_user_can('edit_theme_options')) {
    hq_enqueue_script('customize-loader');
}
if (current_user_can('install_plugins')) {
    hq_enqueue_script('plugin-install');
}
if (current_user_can('upload_files')) {
    hq_enqueue_script('media-upload');
}
add_thickbox();
if (hq_is_mobile()) {
    hq_enqueue_script('jquery-touch-punch');
}
$title = __('Dashboard');
$parent_file = 'index.php';
$help = '<p>' . __('Welcome to your HiveQueen Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of HiveQueen. You can get help for any screen by clicking the Help tab in the upper corner.') . '</p>';
// Not using chaining here, so as to be parseable by PHP4.
$screen = get_current_screen();
$screen->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => $help));
// Help tabs
$help = '<p>' . __('The left-hand navigation menu provides links to all of the HiveQueen administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>';
$help .= '<p>' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful HiveQueen information.') . '</p>';
$screen->add_help_tab(array('id' => 'help-navigation', 'title' => __('Navigation'), 'content' => $help));
$help = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>';
$help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show.') . '</p>';
$help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
$help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
Esempio n. 5
0
/**
 * Enqueues all scripts, styles, settings, and templates necessary to use
 * all media JS APIs.
 *
 * @since 0.0.1
 *
 * @global int       $content_width
 * @global hqdb      $hqdb
 * @global HQ_Locale $hq_locale
 *
 * @param array $args {
 *     Arguments for enqueuing media scripts.
 *
 *     @type int|HQ_Post A post object or ID.
 * }
 */
function hq_enqueue_media($args = array())
{
    // Enqueue me just once per page, please.
    if (did_action('hq_enqueue_media')) {
        return;
    }
    global $content_width, $hqdb, $hq_locale;
    $defaults = array('post' => null);
    $args = hq_parse_args($args, $defaults);
    // We're going to pass the old thickbox media tabs to `media_upload_tabs`
    // to ensure plugins will work. We will then unset those tabs.
    $tabs = array('type' => '', 'type_url' => '', 'gallery' => '', 'library' => '');
    /** This filter is documented in hq-admin/includes/media.php */
    $tabs = apply_filters('media_upload_tabs', $tabs);
    unset($tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library']);
    $props = array('link' => get_option('image_default_link_type'), 'align' => get_option('image_default_align'), 'size' => get_option('image_default_size'));
    $exts = array_merge(hq_get_audio_extensions(), hq_get_video_extensions());
    $mimes = get_allowed_mime_types();
    $ext_mimes = array();
    foreach ($exts as $ext) {
        foreach ($mimes as $ext_preg => $mime_match) {
            if (preg_match('#' . $ext . '#i', $ext_preg)) {
                $ext_mimes[$ext] = $mime_match;
                break;
            }
        }
    }
    $has_audio = $hqdb->get_var("\n\t\tSELECT ID\n\t\tFROM {$hqdb->posts}\n\t\tWHERE post_type = 'attachment'\n\t\tAND post_mime_type LIKE 'audio%'\n\t\tLIMIT 1\n\t");
    $has_video = $hqdb->get_var("\n\t\tSELECT ID\n\t\tFROM {$hqdb->posts}\n\t\tWHERE post_type = 'attachment'\n\t\tAND post_mime_type LIKE 'video%'\n\t\tLIMIT 1\n\t");
    $months = $hqdb->get_results($hqdb->prepare("\n\t\tSELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month\n\t\tFROM {$hqdb->posts}\n\t\tWHERE post_type = %s\n\t\tORDER BY post_date DESC\n\t", 'attachment'));
    foreach ($months as $month_year) {
        $month_year->text = sprintf(__('%1$s %2$d'), $hq_locale->get_month($month_year->month), $month_year->year);
    }
    $settings = array('tabs' => $tabs, 'tabUrl' => add_query_arg(array('chromeless' => true), admin_url('media-upload.php')), 'mimeTypes' => hq_list_pluck(get_post_mime_types(), 0), 'captions' => !apply_filters('disable_captions', ''), 'nonce' => array('sendToEditor' => hq_create_nonce('media-send-to-editor')), 'post' => array('id' => 0), 'defaultProps' => $props, 'attachmentCounts' => array('audio' => $has_audio ? 1 : 0, 'video' => $has_video ? 1 : 0), 'embedExts' => $exts, 'embedMimes' => $ext_mimes, 'contentWidth' => $content_width, 'months' => $months, 'mediaTrash' => MEDIA_TRASH ? 1 : 0);
    $post = null;
    if (isset($args['post'])) {
        $post = get_post($args['post']);
        $settings['post'] = array('id' => $post->ID, 'nonce' => hq_create_nonce('update-post_' . $post->ID));
        $thumbnail_support = current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail');
        if (!$thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type) {
            if (hq_attachment_is('audio', $post)) {
                $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
            } elseif (hq_attachment_is('video', $post)) {
                $thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
            }
        }
        if ($thumbnail_support) {
            $featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
            $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
        }
    }
    $hier = $post && is_post_type_hierarchical($post->post_type);
    if ($post) {
        $post_type_object = get_post_type_object($post->post_type);
    } else {
        $post_type_object = get_post_type_object('post');
    }
    $strings = array('url' => __('URL'), 'addMedia' => __('Add Media'), 'search' => __('Search'), 'select' => __('Select'), 'cancel' => __('Cancel'), 'update' => __('Update'), 'replace' => __('Replace'), 'remove' => __('Remove'), 'back' => __('Back'), 'selected' => __('%d selected'), 'dragInfo' => __('Drag and drop to reorder media files.'), 'uploadFilesTitle' => __('Upload Files'), 'uploadImagesTitle' => __('Upload Images'), 'mediaLibraryTitle' => __('Media Library'), 'insertMediaTitle' => __('Insert Media'), 'createNewGallery' => __('Create a new gallery'), 'createNewPlaylist' => __('Create a new playlist'), 'createNewVideoPlaylist' => __('Create a new video playlist'), 'returnToLibrary' => __('&#8592; Return to library'), 'allMediaItems' => __('All media items'), 'allDates' => __('All dates'), 'noItemsFound' => __('No items found.'), 'insertIntoPost' => $hier ? __('Insert into page') : __('Insert into post'), 'unattached' => __('Unattached'), 'trash' => _x('Trash', 'noun'), 'uploadedToThisPost' => $hier ? __('Uploaded to this page') : __('Uploaded to this post'), 'warnDelete' => __("You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete."), 'warnBulkDelete' => __("You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete."), 'warnBulkTrash' => __("You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete."), 'bulkSelect' => __('Bulk Select'), 'cancelSelection' => __('Cancel Selection'), 'trashSelected' => __('Trash Selected'), 'untrashSelected' => __('Untrash Selected'), 'deleteSelected' => __('Delete Selected'), 'deletePermanently' => __('Delete Permanently'), 'apply' => __('Apply'), 'filterByDate' => __('Filter by date'), 'filterByType' => __('Filter by type'), 'searchMediaLabel' => __('Search Media'), 'noMedia' => __('No media attachments found.'), 'attachmentDetails' => __('Attachment Details'), 'insertFromUrlTitle' => __('Insert from URL'), 'setFeaturedImageTitle' => $post_type_object->labels->featured_image, 'setFeaturedImage' => $post_type_object->labels->set_featured_image, 'createGalleryTitle' => __('Create Gallery'), 'editGalleryTitle' => __('Edit Gallery'), 'cancelGalleryTitle' => __('&#8592; Cancel Gallery'), 'insertGallery' => __('Insert gallery'), 'updateGallery' => __('Update gallery'), 'addToGallery' => __('Add to gallery'), 'addToGalleryTitle' => __('Add to Gallery'), 'reverseOrder' => __('Reverse order'), 'imageDetailsTitle' => __('Image Details'), 'imageReplaceTitle' => __('Replace Image'), 'imageDetailsCancel' => __('Cancel Edit'), 'editImage' => __('Edit Image'), 'chooseImage' => __('Choose Image'), 'selectAndCrop' => __('Select and Crop'), 'skipCropping' => __('Skip Cropping'), 'cropImage' => __('Crop Image'), 'cropYourImage' => __('Crop your image'), 'cropping' => __('Cropping&hellip;'), 'suggestedDimensions' => __('Suggested image dimensions:'), 'cropError' => __('There has been an error cropping your image.'), 'audioDetailsTitle' => __('Audio Details'), 'audioReplaceTitle' => __('Replace Audio'), 'audioAddSourceTitle' => __('Add Audio Source'), 'audioDetailsCancel' => __('Cancel Edit'), 'videoDetailsTitle' => __('Video Details'), 'videoReplaceTitle' => __('Replace Video'), 'videoAddSourceTitle' => __('Add Video Source'), 'videoDetailsCancel' => __('Cancel Edit'), 'videoSelectPosterImageTitle' => __('Select Poster Image'), 'videoAddTrackTitle' => __('Add Subtitles'), 'playlistDragInfo' => __('Drag and drop to reorder tracks.'), 'createPlaylistTitle' => __('Create Audio Playlist'), 'editPlaylistTitle' => __('Edit Audio Playlist'), 'cancelPlaylistTitle' => __('&#8592; Cancel Audio Playlist'), 'insertPlaylist' => __('Insert audio playlist'), 'updatePlaylist' => __('Update audio playlist'), 'addToPlaylist' => __('Add to audio playlist'), 'addToPlaylistTitle' => __('Add to Audio Playlist'), 'videoPlaylistDragInfo' => __('Drag and drop to reorder videos.'), 'createVideoPlaylistTitle' => __('Create Video Playlist'), 'editVideoPlaylistTitle' => __('Edit Video Playlist'), 'cancelVideoPlaylistTitle' => __('&#8592; Cancel Video Playlist'), 'insertVideoPlaylist' => __('Insert video playlist'), 'updateVideoPlaylist' => __('Update video playlist'), 'addToVideoPlaylist' => __('Add to video playlist'), 'addToVideoPlaylistTitle' => __('Add to Video Playlist'));
    /**
     * Filter the media view settings.
     *
     * @since 0.0.1
     *
     * @param array   $settings List of media view settings.
     * @param HQ_Post $post     Post object.
     */
    $settings = apply_filters('media_view_settings', $settings, $post);
    /**
     * Filter the media view strings.
     *
     * @since 0.0.1
     *
     * @param array   $strings List of media view strings.
     * @param HQ_Post $post    Post object.
     */
    $strings = apply_filters('media_view_strings', $strings, $post);
    $strings['settings'] = $settings;
    // Ensure we enqueue media-editor first, that way media-views is
    // registered internally before we try to localize it. see #24724.
    hq_enqueue_script('media-editor');
    hq_localize_script('media-views', '_hqMediaViewsL10n', $strings);
    hq_enqueue_script('media-audiovideo');
    hq_enqueue_style('media-views');
    if (is_admin()) {
        hq_enqueue_script('mce-view');
        hq_enqueue_script('image-edit');
    }
    hq_enqueue_style('imgareaselect');
    hq_plupload_default_settings();
    require_once ABSPATH . HQINC . '/media-template.php';
    add_action('admin_footer', 'hq_print_media_templates');
    add_action('hq_footer', 'hq_print_media_templates');
    add_action('customize_controls_print_footer_scripts', 'hq_print_media_templates');
    /**
     * Fires at the conclusion of hq_enqueue_media().
     *
     * @since 0.0.1
     */
    do_action('hq_enqueue_media');
}
Esempio n. 6
0
/**
 * Enqueues the default ThickBox js and css.
 *
 * If any of the settings need to be changed, this can be done with another js
 * file similar to media-upload.js. That file should
 * require array('thickbox') to ensure it is loaded after.
 *
 * @since 0.0.1
 */
function add_thickbox()
{
    hq_enqueue_script('thickbox');
    hq_enqueue_style('thickbox');
    if (is_network_admin()) {
        add_action('admin_head', '_thickbox_path_admin_subfolder');
    }
}
Esempio n. 7
0
bloginfo('pingback_url');
?>
" />
<!--[if lt IE 9]>
<script src="<?php 
echo get_template_directory_uri();
?>
/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php 
/*
 * We add some JavaScript to pages with the comment form
 * to support sites with threaded comments (when in use).
 */
if (is_singular() && get_option('thread_comments')) {
    hq_enqueue_script('comment-reply');
}
/*
 * Always have hq_head() just before the closing </head>
 * tag of your theme, or you will break many plugins, which
 * generally use this hook to add elements to <head> such
 * as styles, scripts, and meta tags.
 */
hq_head();
?>
</head>

<!-- TODO: !!! 
<body <?php 
//body_class();
?>
Esempio n. 8
0
/**
 * Bind JS handlers to make Customizer preview reload changes asynchronously.
 *
 * Used with blogname and blogdescription.
 *
 * @since HiveQueen Theme 0.1
 */
function hivequeen_customize_preview_js()
{
    hq_enqueue_script('hivequeen-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array('customize-preview'), '20150401', true);
}
Esempio n. 9
0
 /**
  * Set up the enqueue for the JavaScript files.
  *
  * @since 0.0.1
  */
 public function js_includes()
 {
     $step = $this->step();
     if (1 == $step || 3 == $step) {
         hq_enqueue_media();
         hq_enqueue_script('custom-header');
         if (current_theme_supports('custom-header', 'header-text')) {
             hq_enqueue_script('hq-color-picker');
         }
     } elseif (2 == $step) {
         hq_enqueue_script('imgareaselect');
     }
 }
Esempio n. 10
0
/**
 * @since 0.0.1
 */
function enqueue_comment_hotkeys_js()
{
    if ('true' == get_user_option('comment_shortcuts')) {
        hq_enqueue_script('jquery-table-hotkeys');
    }
}
Esempio n. 11
0
        ?>
"><?php 
        _e('Lost your password?');
        ?>
</a>
</p>

<?php 
        login_footer('user_login');
        break;
    case 'login':
    default:
        $secure_cookie = '';
        $customize_login = isset($_REQUEST['customize-login']);
        if ($customize_login) {
            hq_enqueue_script('customize-base');
        }
        // If the user wants ssl but the session is not ssl, force a secure cookie.
        if (!empty($_POST['log']) && !force_ssl_admin()) {
            $user_name = sanitize_user($_POST['log']);
            if ($user = get_user_by('login', $user_name)) {
                if (get_user_option('use_ssl', $user->ID)) {
                    $secure_cookie = true;
                    force_ssl_admin(true);
                }
            }
        }
        if (isset($_REQUEST['redirect_to'])) {
            $redirect_to = $_REQUEST['redirect_to'];
            // Redirect to https if user wants ssl
            if ($secure_cookie && false !== strpos($redirect_to, 'hq-admin')) {