示例#1
0
function ap_scripts_front()
{
    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-form', array('jquery'), false);
    wp_enqueue_script('ap-functions-js', ANSPRESS_URL . 'assets/prod/ap-functions.min.js', array('jquery', 'jquery-form'));
    wp_enqueue_script('ap-anspress_script', ANSPRESS_URL . 'assets/prod/anspress_site.min.js', array('jquery', 'jquery-form'), AP_VERSION);
    wp_enqueue_script('peity-js', ap_get_theme_url('js/jquery.peity.min.js'), 'jquery', AP_VERSION);
    wp_enqueue_script('ap-initial.js', ap_get_theme_url('js/initial.min.js'), 'jquery', AP_VERSION);
    wp_enqueue_script('ap-scrollbar.js', ap_get_theme_url('js/jquery.scrollbar.min.js'), 'jquery', AP_VERSION);
    wp_enqueue_script('ap-js', ap_get_theme_url('prod/ap.min.js'), array('jquery', 'jquery-form'), AP_VERSION);
    wp_enqueue_style('ap-style', ap_get_theme_url('css/main.css'), array(), AP_VERSION);
    $custom_css = '
        #anspress .ap-q-cells{
                margin-left: ' . (ap_opt('avatar_size_qquestion') + 10) . 'px;
        }
        #anspress .ap-a-cells{
                margin-left: ' . (ap_opt('avatar_size_qanswer') + 10) . 'px;
        }#anspress .ap-comment-content{
                margin-left: ' . (ap_opt('avatar_size_qcomment') + 15) . 'px;
        }';
    wp_add_inline_style('ap-style', $custom_css);
    wp_enqueue_style('ap-fonts', ap_get_theme_url('fonts/style.css'), array(), AP_VERSION);
    do_action('ap_enqueue');
    wp_enqueue_style('ap-responsive', ap_get_theme_url('css/responsive.css'), array(), AP_VERSION);
    wp_enqueue_style('ap-overrides', ap_get_theme_url('css/overrides.css'), array(), AP_VERSION);
    echo '<script type="text/javascript">';
    echo 'var ajaxurl = "' . admin_url('admin-ajax.php') . '",';
    echo 'ap_nonce 	= "' . wp_create_nonce('ap_ajax_nonce') . '",';
    echo 'ap_max_tags = "' . ap_opt('max_tags') . '",';
    echo 'disable_hover_card = "' . (ap_opt('disable_hover_card') ? true : false) . '"';
    echo '</script>';
    wp_localize_script('ap-anspress_script', 'aplang', array('password_field_not_macthing' => __('Password not matching', 'ap'), 'password_length_less' => __('Password length must be 6 or higher', 'ap'), 'not_valid_email' => __('Not a valid email', 'ap'), 'username_less' => __('Username length must be 4 or higher', 'ap'), 'username_not_avilable' => __('Username not available', 'ap'), 'email_already_in_use' => sprintf(__('Email already in use. %sDo you want to reset your password?%s', 'ap'), '<a href="' . wp_lostpassword_url() . '">', '</a>'), 'loading' => __('Loading', 'ap'), 'sending' => __('Sending request', 'ap'), 'adding_to_fav' => __('Adding question to your favorites', 'ap'), 'voting_on_post' => __('Sending your vote', 'ap'), 'requesting_for_closing' => __('Requesting for closing this question', 'ap'), 'sending_request' => __('Submitting request', 'ap'), 'loading_comment_form' => __('Loading comment form', 'ap'), 'submitting_your_question' => __('Sending your question', 'ap'), 'submitting_your_answer' => __('Sending your answer', 'ap'), 'submitting_your_comment' => __('Sending your comment', 'ap'), 'deleting_comment' => __('Deleting comment', 'ap'), 'updating_comment' => __('Updating comment', 'ap'), 'loading_form' => __('Loading form', 'ap'), 'saving_labels' => __('Saving labels', 'ap'), 'loading_suggestions' => __('Loading suggestions', 'ap'), 'uploading_cover' => __('Uploading cover', 'ap'), 'saving_profile' => __('Saving profile', 'ap'), 'sending_message' => __('Sending message', 'ap'), 'loading_conversation' => __('Loading conversation', 'ap'), 'loading_new_message_form' => __('Loading new message form', 'ap'), 'loading_more_conversations' => __('Loading more conversations', 'ap'), 'searching_conversations' => __('Searching conversations', 'ap'), 'loading_message_edit_form' => __('Loading message form', 'ap'), 'updating_message' => __('Updating message', 'ap'), 'deleting_message' => __('Deleting message', 'ap'), 'uploading' => __('Uploading', 'ap'), 'error' => ap_icon('error'), 'warning' => ap_icon('warning'), 'success' => ap_icon('success'), 'not_valid_response' => __('Something went wrong in server side, not a valid response.', 'ap')));
    wp_localize_script('ap-site-js', 'apoptions', array('ajaxlogin' => ap_opt('ajax_login')));
}
示例#2
0
function init_scripts_front()
{
    if (is_anspress()) {
        wp_enqueue_script('jquery');
        wp_enqueue_script('tagsinput', ap_get_theme_url('js/bootstrap-tagsinput.min.js'), 'jquery', AP_VERSION);
        wp_enqueue_script('jquery-form', array('jquery'), false, true);
        wp_enqueue_script('ap-site-js', ANSPRESS_URL . 'assets/ap-site.js', 'jquery', AP_VERSION);
        wp_enqueue_script('tooltipster', ap_get_theme_url('js/jquery.tooltipster.min.js'), 'jquery', AP_VERSION);
        wp_enqueue_script('jstorage', ap_get_theme_url('js/jstorage.js'), 'jquery', AP_VERSION);
        //wp_enqueue_script( 'perfect-scrollbar', ap_get_theme_url('js/perfect-scrollbar.min.js'), 'jquery', AP_VERSION);
        wp_enqueue_script('ap-js', ap_get_theme_url('js/ap.js'), 'jquery', AP_VERSION);
        wp_enqueue_style('tagsinput', ap_get_theme_url('css/bootstrap-tagsinput.css'), array(), AP_VERSION);
        wp_enqueue_style('tooltipster', ap_get_theme_url('css/tooltipster.css'), array(), AP_VERSION);
        //wp_enqueue_style( 'perfect-scrollbar', ap_get_theme_url('css/perfect-scrollbar.min.css'), array(), AP_VERSION);
        wp_enqueue_style('ap-style', ap_get_theme_url('css/ap.css'), array(), AP_VERSION);
        wp_enqueue_style('ap-fonts', ap_get_theme_url('fonts/style.css'), array(), AP_VERSION);
        do_action('ap_enqueue');
        wp_enqueue_style('ap-overrides', ap_get_theme_url('css/overrides.css'), array(), AP_VERSION);
        ?>
			<script type="text/javascript">
				var ajaxurl = '<?php 
        echo admin_url('admin-ajax.php');
        ?>
',
				    ap_max_tags = '<?php 
        echo ap_opt('max_tags');
        ?>
';
			</script>
		<?php 
        wp_localize_script('ap-site-js', 'aplang', array('password_field_not_macthing' => __('Password not matching', 'ap'), 'password_length_less' => __('Password length must be 6 or higher', 'ap'), 'not_valid_email' => __('Not a valid email', 'ap'), 'username_less' => __('Username length must be 4 or higher', 'ap'), 'username_not_avilable' => __('Username not available', 'ap'), 'email_already_in_use' => __('Email already in use', 'ap'), 'loading' => __('Loading', 'ap'), 'sending' => __('Sending request', 'ap'), 'adding_to_fav' => __('Adding question to your favorites', 'ap'), 'voting_on_post' => __('Sending your vote', 'ap'), 'requesting_for_closing' => __('Requesting for closing this question', 'ap'), 'sending_request' => __('Submitting request', 'ap'), 'loading_comment_form' => __('Loading comment form', 'ap'), 'submitting_your_question' => __('Sending your question', 'ap'), 'submitting_your_answer' => __('Sending your answer', 'ap'), 'submitting_your_comment' => __('Sending your comment', 'ap'), 'deleting_comment' => __('Deleting comment', 'ap'), 'updating_comment' => __('Updating comment', 'ap'), 'loading_form' => __('Loading form', 'ap'), 'saving_labels' => __('Saving labels', 'ap'), 'loading_suggestions' => __('Loading suggestions', 'ap'), 'uploading_cover' => __('Uploading cover', 'ap'), 'saving_profile' => __('Saving profile', 'ap'), 'sending_message' => __('Sending message', 'ap'), 'loading_conversation' => __('Loading conversation', 'ap'), 'loading_new_message_form' => __('Loading new message form', 'ap'), 'loading_more_conversations' => __('Loading more conversations', 'ap'), 'searching_conversations' => __('Searching conversations', 'ap'), 'loading_message_edit_form' => __('Loading message form', 'ap'), 'updating_message' => __('Updating message', 'ap'), 'deleting_message' => __('Deleting message', 'ap'), 'uploading' => __('Uploading', 'ap')));
    }
}
示例#3
0
 /**
  * Create wp_editor field
  * @param  array  $field
  * @return void
  * @since 2.0.1
  */
 private function editor_field($field = array())
 {
     if (isset($field['label'])) {
         $this->label();
     }
     if ($field['settings']['tinymce'] !== false) {
         $field['settings']['tinymce'] = array('content_css' => ap_get_theme_url('css/editor.css'), 'wp_autoresize_on' => true);
     }
     /**
      * FILTER: ap_pre_editor_settings
      * Can be used to mody wp_editor settings
      * @var array
      * @since 2.0.1
      */
     $settings = apply_filters('ap_pre_editor_settings', $field['settings']);
     $this->output .= '<div class="ap-form-fields-in">';
     // Turn on the output buffer
     ob_start();
     echo '<div class="ap-editor">';
     wp_editor($field['value'], $field['name'], $settings);
     echo '</div>';
     $this->output .= ob_get_clean();
     $this->error_messages();
     if (!$this->field['show_desc_tip']) {
         $this->desc();
     }
     $this->output .= '</div>';
 }
 /**
  * Enqueue scripts
  * @since 1.0
  */
 public function ap_enqueue()
 {
     wp_enqueue_style('categories_for_anspress_css', ap_get_theme_url('css/categories.css', CATEGORIES_FOR_ANSPRESS_URL));
 }
示例#5
0
 /**
  * Enqueue scripts
  * @since 1.0
  */
 public function ap_enqueue()
 {
     wp_enqueue_script('tagsinput', ap_get_theme_url('js/bootstrap-tagsinput.min.js', TAGS_FOR_ANSPRESS_URL));
     wp_enqueue_script('tags_js', ap_get_theme_url('js/tags_js.js', TAGS_FOR_ANSPRESS_URL));
     wp_enqueue_style('tagsinput_css', ap_get_theme_url('css/bootstrap-tagsinput.css', TAGS_FOR_ANSPRESS_URL));
     wp_enqueue_style('tags_css', ap_get_theme_url('css/tags.css', TAGS_FOR_ANSPRESS_URL));
 }
示例#6
0
function ap_user_cover_style($userid, $small = false)
{
    $image = ap_get_user_cover($userid);
    if ($small) {
        if ($image) {
            echo 'style="background-image:url(' . ap_get_user_cover($userid, true) . ')"';
        } else {
            echo 'style="background-image:url(' . ap_get_theme_url('images/default_cover_s.jpg') . ')"';
        }
    } else {
        if ($image) {
            echo 'style="background-image:url(' . ap_get_user_cover($userid) . ')"';
        } else {
            echo 'style="background-image:url(' . ap_get_theme_url('images/default_cover.jpg') . ')"';
        }
    }
}
示例#7
0
 /**
  * Register and enqueue admin-specific JavaScript.
  */
 public function enqueue_admin_scripts()
 {
     global $typenow, $pagenow;
     $dir = ap_env_dev() ? 'js' : 'min';
     $min = ap_env_dev() ? '' : '.min';
     if (in_array($pagenow, array('admin.php')) && (isset($_GET['page']) && 'anspress' == $_GET['page'])) {
         wp_enqueue_script('masonry');
     }
     wp_enqueue_script('jquery-form', array('jquery'), false, true);
     wp_enqueue_script('ap-initial.js', ap_get_theme_url('js/initial.min.js'), 'jquery', AP_VERSION);
     wp_enqueue_script('ap-admin-js', ANSPRESS_URL . 'assets/' . $dir . '/ap-admin' . $min . '.js', array('wp-color-picker'));
 }
示例#8
0
文件: user.php 项目: Byrlyne/anspress
function ap_get_cover_src($user_id = false, $small = false)
{
    if ($user_id === false) {
        $user_id = ap_get_displayed_user_id();
    }
    $cover = get_user_meta($user_id, '_ap_cover', true);
    if (is_array($cover) && !empty($cover)) {
        if ($small && file_exists($cover['small_file'])) {
            return esc_url($cover['small_url']);
        }
        if (file_exists($cover['file'])) {
            return esc_url($cover['url']);
        }
    } else {
        if ($small) {
            return ap_get_theme_url('images/small_cover.jpg');
        } else {
            return ap_get_theme_url('images/cover.jpg');
        }
    }
}
 /**
  * Register and enqueue admin-specific JavaScript.
  * @return    null    Return early if no settings page is registered.
  */
 public function enqueue_admin_scripts()
 {
     global $typenow, $pagenow;
     if (in_array($pagenow, array('admin.php')) && (isset($_GET['page']) && $_GET['page'] == 'anspress')) {
         wp_enqueue_script('masonry');
     }
     wp_enqueue_script('jquery-form', array('jquery'), false, true);
     wp_enqueue_script('ap-initial.js', ap_get_theme_url('js/initial.min.js'), 'jquery', AP_VERSION);
     wp_enqueue_script('ap-admin-js', ANSPRESS_URL . 'assets/prod/ap-admin.min.js');
 }