private function check_for_results($query)
 {
     $url_base = Lss_Tools_Option::get_option('url') ?: 'http://admin.localsitesubmit.com';
     $api_url = $url_base . '/?func=widget/remote&method=search';
     // Load results from API
     $data = wp_remote_post($api_url, array('timeout' => 60, 'body' => array("params" => json_encode(array("query" => $query)))));
     $data = json_decode(wp_remote_retrieve_body($data), true);
     if (isset($data['data'])) {
         return $data;
     }
     return array();
 }
Ejemplo n.º 2
0
 public function add_custom_css()
 {
     if (Lss_Tools_Option::get_option('style') == 'custom') {
         wp_register_style('lssdc-custom-css', get_bloginfo('url') . '?display_custom_css=css');
         wp_enqueue_style('lssdc-custom-css');
     }
 }
 /**
  * Rich Editor Callback
  *
  * Renders rich editor fields.
  *
  * @since 	0.6.5
  * @param 	array $args Arguments passed by the setting
  * @global 	$wp_version WordPress Version
  */
 public function rich_editor_callback($args)
 {
     global $wp_version;
     $value = Lss_Tools_Option::get_option($args['id']);
     if ($wp_version >= 3.3 && function_exists('wp_editor')) {
         ob_start();
         wp_editor(stripslashes($value), 'lss_tools_settings_' . $args['id'], array('textarea_name' => 'lss_tools_settings[' . $args['id'] . ']'));
         $html = ob_get_clean();
     } else {
         $html = '<textarea' . $this->get_id_and_name_attrubutes($args['id']) . 'class="' . $args['size'] . '-text" rows="10" >' . esc_textarea(stripslashes($value)) . '</textarea>';
     }
     $html .= '<br/>';
     $html .= $this->get_label_for($args['id'], $args['desc']);
     $html .= '<br/>';
     echo $html;
 }
/**
 * Provide a public-facing view for the plugin
 *
 * This file is used to markup the public-facing aspects of the plugin.
 *
 * @link       http://www.localsitesubmit.com/
 * @since      1.0.0
 *
 * @package    Lss_Tools
 * @subpackage Lss_Tools/public/partials
 */
$nonce = wp_create_nonce("LSS_Tools_Widget");
echo "<!-- Begin {$this->plugin_name} --> <div id=\"LSSW_wrap\">";
if (!isset($s)) {
    echo '<p class="LSSW_Init_Copy">' . Lss_Tools_Option::get_option('init_copy') . '</p>';
    echo '<p class="LSSW_Init_Copy" style="font-weight: bold;">' . Lss_Tools_Option::get_option('run_title') . '</p>';
}
?>
	<form action="<?php 
echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
?>
" id="LSSW_form" method="post" role="form">
		<input type="hidden" name="LSSW_s" id="LSSW_s" value="<?php 
echo $nonce;
?>
">
		<div class="LSSW_fields">
			<span id="LSSW_query_wrap">
				<input type="text" id="LSSW_field_query" name="LSSW_field_query"
				       value="<?php 
echo isset($query) ? $query : '';