Plugin Directory

Changeset 1222872


Ignore:
Timestamp:
08/17/2015 04:59:12 PM (11 years ago)
Author:
Aptivate
Message:

v1.0.3

Location:
server-side-google-search/trunk
Files:
5 added
5 edited

Legend:

Unmodified
Added
Removed
  • server-side-google-search/trunk/readme.txt

    r1172931 r1222872  
    33Tags: Server-Side Google Search, Google Search, Google Custom Search, Google, SCE, GCSE, Wordpress Google Search
    44Requires at least: 3.7
    5 Tested up to: 4.0
    6 Stable tag: 1.0.2
     5Tested up to: 4.3
     6Stable tag: 1.0.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7272== Changelog ==
    7373
     74= 1.0.3 =
     75* Removed deprecation warnings for WordPress 4.3
     76* Fixed potential bug where sort argument wasn't being preserved in links
     77* Updated test infrastructure to use wp-cli
     78* Documentation updates
     79
    7480= 1.0.2 =
    7581* Added filter to allow custom metadata in search results
     
    8692= 1.0.0 =
    8793* First version
     94
     95
     96== Development ==
     97
     98This plugin uses [wp-cli](http://wp-cli.org/) and [PHPUnit](https://phpunit.de/) for testing.
     99The tests require [runkit](https://github.com/zenovich/runkit) for mocking functions.
     100
     101* Grab the latest source from github:
     102
     103`
     104$ git clone git@github.com:aptivate/server-side-google-search.git
     105`
     106
     107* Install [wp-cli](http://wp-cli.org/#install)
     108* Install [PHPUnit](https://phpunit.de/)
     109* Set up runkit:
     110
     111`
     112$ git clone https://github.com/zenovich/runkit.git
     113$ cd runkit
     114$ phpize
     115$ ./configure
     116$ sudo make install
     117`
     118
     119Add the following lines to `/etc/php5/cli/php.ini`:
     120
     121`
     122extension=runkit.so
     123runkit.internal_override=1
     124`
     125
     126* Install the test WordPress environment:
     127
     128`
     129cd server-side-google-search
     130bash bin/install-wp-tests.sh test_db_name db_user 'db_password' db_host version
     131`
     132
     133where:
     134** `test_db_name` is the name for your **temporary** test WordPress database
     135** `db_user` is the database user name
     136** `db_password` is the password
     137** `db_host` is the database host (eg `localhost`)
     138** `version` is the version of WordPress (eg `4.2.2` or `latest`)
     139
     140* Run the tests
     141`phpunit`
  • server-side-google-search/trunk/ssgs-google-search.php

    r1172931 r1222872  
    44  Plugin URI: https://github.com/aptivate/server-side-google-search
    55  Description: Google Custom Search for your site, without JavaScript
    6   Version: 1.0.2
     6  Version: 1.0.3
    77  Author: Aptivate
    88  Author URI: http://www.aptivate.org/
     
    1111  Domain Path: /languages/
    1212  Requires at least: 3.7
    13   Tested up to: 4.0
     13  Tested up to: 4.3
    1414*/
    1515
  • server-side-google-search/trunk/ssgs-widget.php

    r1172931 r1222872  
    55
    66    public function __construct() {
    7         parent::WP_Widget( false, $name = __( 'Server-Side Google Search (SSGS)','ssgs' ) );
     7        parent::__construct( false, __( 'Server-Side Google Search (SSGS)','ssgs' ) );
    88    }
    99
     
    1111        $this->options = get_option( 'ssgs_general_settings' );
    1212        $this->sanitize_parameters();
    13 
    14         global $ssgs;
    1513
    1614        echo $args['before_widget'];
     
    8078            $this->parameters['s'] = trim( $this->parameters['s'] );
    8179        }
    82 
    83         $this->extra_parameters = array_diff_assoc( $this->parameters, $defaults );
    8480    }
    8581
     
    10298            if ( ! preg_match( '/^[a-z_]+$/',
    10399                    $this->parameters[ $name ] ) ) {
    104                 $this->parameters[ $name ] = false;
     100                $this->parameters[ $name ] = '';
    105101            }
    106102        }
     
    121117        $total_items = $this->get_total_items( $result );
    122118        if ( $total_items <= 0 ) {
    123             $content = '<p><strong>' . __( 'Sorry, there were no results', 'ssgs' ) ."</strong></p>\n";
    124         }else {
    125             $content = $this->get_results_content( $result );
    126 
    127         } // End else -- $total_items <= 0
    128 
    129         return $content;
     119            return '<p><strong>' . __( 'Sorry, there were no results', 'ssgs' ) ."</strong></p>\n";
     120        }
     121
     122        return $this->get_results_content( $result );
    130123    }
    131124
     
    146139
    147140    private function get_other_pages_content( $result ) {
     141        $content = '';
     142
    148143        $page_length = $this->get_page_length();
    149144        $start = $this->get_page_start();
     
    259254
    260255    private function get_result_list( $items ) {
    261         $content .= '<ul class="ssgs-result-list">';
     256        $content = '<ul class="ssgs-result-list">';
    262257
    263258        foreach ( $items as $item ) {
     
    429424
    430425        $parsed_url = parse_url( home_url( add_query_arg( array(), $wp->request ) ) );
    431         $query_args = array_merge( $this->extra_parameters, $query_args );
     426
     427        $query_args = array_merge( $this->parameters, $query_args );
    432428
    433429        return htmlentities( $this->build_url( $parsed_url, $query_args ) );
  • server-side-google-search/trunk/tests/SSGSWidgetTestBase.php

    r1172931 r1222872  
    11<?php
    2 class SSGSWidgetTestBase extends PHPUnit_Framework_TestCase
     2abstract class SSGSWidgetTestBase extends WP_UnitTestCase
    33{
    44    protected function get_html_element_from_output( $output, $path )
  • server-side-google-search/trunk/tests/mock-option.php

    r1172931 r1222872  
    1313                'edition' => '',
    1414                'default_search_image_url' => '',
     15                'show_urls' => 'yes',
    1516            );
    1617
     
    2526
    2627        default:
    27             throw new Exception( "Unexpected option: '$option'" );
     28            return "Mock option: $option";
    2829    }
    2930}
Note: See TracChangeset for help on using the changeset viewer.