コード例 #1
0
 public function Search($param)
 {
     //echo "hello";
     import('SC.Search.Search');
     $searchInfo = new Search($param);
     $result = $searchInfo->run();
     echo $result;
 }
コード例 #2
0
ファイル: subsonic_api.class.php プロジェクト: bl00m/ampache
 /**
  * getLyrics
  * Searches and returns lyrics for a given song.
  * Takes the optional artist and title in parameters.
  */
 public static function getlyrics($input)
 {
     self::check_version($input, "1.2.0");
     $artist = $input['artist'];
     $title = $input['title'];
     if (!$artist && !$title) {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_MISSINGPARAM);
     } else {
         $search = array();
         $search['limit'] = 1;
         $search['offset'] = 0;
         $search['type'] = "song";
         $i = 0;
         if ($artist) {
             $search['rule_' . $i . '_input'] = $artist;
             $search['rule_' . $i . '_operator'] = 5;
             $search['rule_' . $i . ''] = "artist";
             ++$i;
         }
         if ($title) {
             $search['rule_' . $i . '_input'] = $title;
             $search['rule_' . $i . '_operator'] = 5;
             $search['rule_' . $i . ''] = "title";
             ++$i;
         }
         $query = new Search(null, 'song');
         $songs = $query->run($search);
         $r = Subsonic_XML_Data::createSuccessResponse();
         if (count($songs) > 0) {
             Subsonic_XML_Data::addLyrics($r, $artist, $title, $songs[0]);
         }
     }
     self::apiOutput($input, $r);
 }
コード例 #3
0
    {
        $subs = array('contributions' => array($queryUser, "View {$queryUser}'s contributions"), 'repositories' => array($queryUser . '?tab=repositories', "View {$queryUser}'s repositories", 'repo'), 'activity' => array($queryUser . '?tab=activity', "View {$queryUser}'s public activity"), 'stars' => array('stars/' . $queryUser, "View {$queryUser}'s stars"));
        $prio = count($subs) + 1;
        foreach ($subs as $key => $sub) {
            Workflow::addItem(Item::create()->prefix('@', false)->title($queryUser . ' ' . $key)->subtitle($sub[1])->icon(isset($sub[2]) ? $sub[2] : $key)->arg('https://github.com/' . $sub[0])->prio($prio--));
        }
        Workflow::addItem(Item::create()->prefix('@', false)->title($queryUser . ' gists')->subtitle("View {$queryUser}'s' gists")->icon('gists')->arg('https://gist.github.com/' . $queryUser)->prio(1));
    }
    private static function addMyCommands()
    {
        $myPages = array('dashboard' => array('', 'View your dashboard'), 'pulls' => array('pulls', 'View your pull requests', 'pull-request'), 'issues' => array('issues', 'View your issues', 'issue'), 'stars' => array('stars', 'View your starred repositories'), 'profile' => array(self::$user->login, 'View your public user profile', 'user'), 'settings' => array('settings', 'View or edit your account settings'), 'notifications' => array('notifications', 'View all your notifications'));
        foreach ($myPages as $key => $my) {
            Workflow::addItem(Item::create()->title('my ' . $key)->subtitle($my[1])->icon(isset($my[2]) ? $my[2] : $key)->arg('https://github.com/' . $my[0])->prio(1));
        }
        Workflow::addItem(Item::create()->title('my gists')->subtitle('View your gists')->icon('gists')->arg('https://gist.github.com/' . self::$user->login)->prio(1));
    }
    private static function addSystemCommands()
    {
        $cmds = array('delete cache' => 'Delete GitHub Cache', 'logout' => 'Log out this workflow', 'update' => 'Update this Alfred workflow');
        if (Workflow::getConfig('autoupdate', true)) {
            $cmds['deactivate autoupdate'] = 'Deactivate auto updating this Alfred Workflow';
        } else {
            $cmds['activate autoupdate'] = 'Activate auto updating this Alfred Workflow';
        }
        foreach ($cmds as $cmd => $desc) {
            Workflow::addItem(Item::create()->prefix('gh ')->title('> ' . $cmd)->subtitle($desc)->icon($cmd)->arg('> ' . str_replace(' ', '-', $cmd)));
        }
    }
}
print Search::run(ltrim($argv[1]));
コード例 #4
0
ファイル: search.php プロジェクト: rfoxfa/local-files
            }
            return;
        }
        $myPages = array('dashboard' => array('', 'View your dashboard'), 'pulls ' => array('pulls', 'View your pull requests', 'pull-request'), 'issues ' => array('issues', 'View your issues', 'issue'), 'stars' => array('stars', 'View your starred repositories'), 'profile' => array(self::$user->login, 'View your public user profile', 'user'), 'settings' => array('settings', 'View or edit your account settings'), 'notifications' => array('notifications', 'View all your notifications'));
        foreach ($myPages as $key => $my) {
            Workflow::addItem(Item::create()->title('my ' . $key)->subtitle($my[1])->icon(isset($my[2]) ? $my[2] : rtrim($key))->arg('/' . $my[0])->prio(1));
        }
        Workflow::addItem(Item::create()->title('my gists')->subtitle('View your gists')->icon('gists')->arg(Workflow::getGistUrl() . '/' . self::$user->login)->prio(1));
    }
    private static function addSystemCommands()
    {
        $cmds = array('delete cache' => 'Delete GitHub Cache', 'logout' => 'Log out this workflow', 'update' => 'Update this Alfred workflow');
        if (Workflow::getConfig('autoupdate', true)) {
            $cmds['deactivate autoupdate'] = 'Deactivate auto updating this Alfred Workflow';
        } else {
            $cmds['activate autoupdate'] = 'Activate auto updating this Alfred Workflow';
        }
        if (self::$enterprise) {
            $cmds['enterprise reset'] = 'Reset the GitHub Enterprise URL';
        }
        foreach ($cmds as $cmd => $desc) {
            Workflow::addItem(Item::create()->title('> ' . $cmd)->subtitle($desc)->icon($cmd)->arg('> ' . str_replace(' ', '-', $cmd)));
        }
        $cmds = array('help' => 'readme', 'changelog' => 'changelog');
        foreach ($cmds as $cmd => $file) {
            Workflow::addItem(Item::create()->title('> ' . $cmd)->subtitle('View the ' . $file)->icon('file')->arg('https://github.com/gharlan/alfred-github-workflow/blob/master/' . strtoupper($file) . '.md'));
        }
    }
}
print Search::run($argv[1], $argv[2]);
コード例 #5
0
ファイル: search.ajax.php プロジェクト: nioc/ampache
            foreach ($sres as $r) {
                $results[] = array('type' => T_('Missing Artists'), 'link' => AmpConfig::get('web_path') . '/artists.php?action=show_missing&mbid=' . $r['mbid'], 'label' => $r['name'], 'value' => $r['name'], 'rels' => '', 'image' => '');
                $i++;
                if ($i >= $limit) {
                    break;
                }
            }
        }
        if ($target == 'user' && AmpConfig::get('sociable')) {
            $searchreq = array('limit' => $limit, 'type' => 'user', 'rule_1_input' => $search, 'rule_1_operator' => '2', 'rule_1' => 'username');
            $sres = Search::run($searchreq);
            // Litmit not reach, new search with another operator
            if (count($sres) < $limit) {
                $searchreq['limit'] = $limit - count($sres);
                $searchreq['rule_1_operator'] = '0';
                $sres = array_unique(array_merge($sres, Search::run($searchreq)));
            }
            foreach ($sres as $id) {
                $user = new User($id);
                $user->format();
                $avatar = $user->get_avatar();
                $results[] = array('type' => T_('Users'), 'link' => '', 'label' => $user->username, 'value' => $user->username, 'rels' => '', 'image' => $avatar['url'] ?: '');
            }
        }
        break;
    default:
        $results['rfc3514'] = '0x1';
        break;
}
// switch on action;
// We always do this
コード例 #6
0
ファイル: api.class.php プロジェクト: axelsimon/ampache
 /**
  * search_songs
  * This searches the songs and returns... songs
  */
 public static function search_songs($input)
 {
     $array = array();
     $array['type'] = 'song';
     $array['rule_1'] = 'anywhere';
     $array['rule_1_input'] = $input['filter'];
     $array['rule_1_operator'] = 0;
     ob_end_clean();
     XML_Data::set_offset($input['offset']);
     XML_Data::set_limit($input['limit']);
     $results = Search::run($array);
     echo XML_Data::songs($results);
 }
コード例 #7
0
ファイル: catalog.class.php プロジェクト: bl00m/ampache
 public static function search_childrens($name, $catalog_id = 0)
 {
     $search = array();
     $search['type'] = "artist";
     $search['rule_0_input'] = $name;
     $search['rule_0_operator'] = 4;
     $search['rule_0'] = "name";
     if ($catalog_id > 0) {
         $search['rule_1_input'] = $catalog_id;
         $search['rule_1_operator'] = 0;
         $search['rule_1'] = "catalog";
     }
     $artists = Search::run($search);
     $childrens = array();
     foreach ($artists as $artist) {
         $childrens[] = array('object_type' => 'artist', 'object_id' => $artist);
     }
     return $childrens;
 }
コード例 #8
0
 /**
  * search2
  * Get albums, artists and songs matching the given criteria.
  * Takes query with optional artist count, artist offset, album count, album offset, song count and song offset in parameters.
  */
 public static function search2($input, $elementName = "searchResult2")
 {
     self::check_version($input, "1.2.0");
     $query = self::check_parameter($input, 'query');
     $artistCount = $input['artistCount'];
     $artistOffset = $input['artistOffset'];
     $albumCount = $input['albumCount'];
     $albumOffset = $input['albumOffset'];
     $songCount = $input['songCount'];
     $songOffset = $input['songOffset'];
     $sartist = array();
     $sartist['limit'] = $artistCount;
     if ($artistOffset) {
         $sartist['offset'] = $artistOffset;
     }
     $sartist['rule_1_input'] = $query;
     $sartist['rule_1_operator'] = 0;
     $sartist['rule_1'] = "name";
     $sartist['type'] = "artist";
     $artists = Search::run($sartist);
     $salbum = array();
     $salbum['limit'] = $albumCount;
     if ($albumOffset) {
         $salbum['offset'] = $albumOffset;
     }
     $salbum['rule_1_input'] = $query;
     $salbum['rule_1_operator'] = 0;
     $salbum['rule_1'] = "title";
     $salbum['type'] = "album";
     $albums = Search::run($salbum);
     $ssong = array();
     $ssong['limit'] = $songCount;
     if ($songOffset) {
         $ssong['offset'] = $songOffset;
     }
     $ssong['rule_1_input'] = $query;
     $ssong['rule_1_operator'] = 0;
     $ssong['rule_1'] = "anywhere";
     $ssong['type'] = "song";
     $songs = Search::run($ssong);
     $r = Subsonic_XML_Data::createSuccessResponse();
     Subsonic_XML_Data::addSearchResult($r, $artists, $albums, $songs, $elementName);
     self::apiOutput($input, $r);
 }
コード例 #9
0
            Workflow::addItem(Item::create()->prefix('@', false)->title($queryUser . ' ' . $key)->subtitle($sub[1])->icon(isset($sub[2]) ? $sub[2] : $key)->arg('/' . $sub[0])->prio($prio--));
        }
        Workflow::addItem(Item::create()->prefix('@', false)->title($queryUser . ' gists')->subtitle("View {$queryUser}'s' gists")->icon('gists')->arg(Workflow::getGistUrl() . '/' . $queryUser)->prio(1));
    }
    private static function addMyCommands()
    {
        $myPages = array('dashboard' => array('', 'View your dashboard'), 'pulls' => array('pulls', 'View your pull requests', 'pull-request'), 'issues' => array('issues', 'View your issues', 'issue'), 'stars' => array('stars', 'View your starred repositories'), 'profile' => array(self::$user->login, 'View your public user profile', 'user'), 'settings' => array('settings', 'View or edit your account settings'), 'notifications' => array('notifications', 'View all your notifications'));
        foreach ($myPages as $key => $my) {
            Workflow::addItem(Item::create()->title('my ' . $key)->subtitle($my[1])->icon(isset($my[2]) ? $my[2] : $key)->arg('/' . $my[0])->prio(1));
        }
        Workflow::addItem(Item::create()->title('my gists')->subtitle('View your gists')->icon('gists')->arg(Workflow::getGistUrl() . '/' . self::$user->login)->prio(1));
    }
    private static function addSystemCommands()
    {
        $cmds = array('delete cache' => 'Delete GitHub Cache', 'logout' => 'Log out this workflow', 'update' => 'Update this Alfred workflow');
        if (Workflow::getConfig('autoupdate', true)) {
            $cmds['deactivate autoupdate'] = 'Deactivate auto updating this Alfred Workflow';
        } else {
            $cmds['activate autoupdate'] = 'Activate auto updating this Alfred Workflow';
        }
        if (self::$enterprise) {
            $cmds['enterprise reset'] = 'Reset the GitHub Enterprise URL';
        }
        foreach ($cmds as $cmd => $desc) {
            Workflow::addItem(Item::create()->title('> ' . $cmd)->subtitle($desc)->icon($cmd)->arg('> ' . str_replace(' ', '-', $cmd)));
        }
        Workflow::addItem(Item::create()->title('> changelog')->subtitle('View the changelog')->icon('file')->arg('https://github.com/gharlan/alfred-github-workflow/blob/master/CHANGELOG.md'));
    }
}
print Search::run($argv[1]);
コード例 #10
0
ファイル: label.class.php プロジェクト: cheese1/ampache
 public function search_childrens($name)
 {
     $search['type'] = "artist";
     $search['rule_0_input'] = $name;
     $search['rule_0_operator'] = 4;
     $search['rule_0'] = "title";
     $artists = Search::run($search);
     $childrens = array();
     foreach ($artists as $artist) {
         $childrens[] = array('object_type' => 'artist', 'object_id' => $artist);
     }
     return $childrens;
 }
コード例 #11
0
	protected function get_additional_team_bio_page_info( $team )
	{
		/* code to get testimonials ordered by date new to old */
 		loadModel( "/entities/testimonials/EntityTestimonial" );
		//$testimonials = EntityTestimonial::GetEntityTeamTestimonialsWithSubTestimonials( $team  );
		$testimonials = EntityTestimonial::GetEntityTestimonialsOrderByOrder( $team );
		$testimonial_dicts = array();
		foreach( $testimonials as $testimonial ) {
			$testimonial_dicts[] = $testimonial->getAsDictionary();
		}
		
		/* get team listings */
		loadModel( "/search/Search" );
		$properties = array();
		$search = new Search();
		$search->addTerm( 'realtor', $team->rebrand_code );
		$search->addOrderBy( 'list_price', false);
		$props = $search->run( 0, 7 );
		$tmp_properties = Property::GetPropertiesFromIdArray($props, PropertyLoadLevel::IDX_SUMMARY, true);
		foreach( $props as $prop ) {
			try{
				$property = $tmp_properties[$prop];
				// add open house
				// $property->open_house = $property->getAllDates( true );
				$temp_pic = $property->get_first_pic();
				if ( is_object( $temp_pic ) ){
					$property->photo = $temp_pic->getUrl();
				} else {
					$property->photo = false;
				}
				$properties[] = $property;
			}
			catch( Exception $e ) {}
		}
		unset($tmp_properties);
		

		/* get team sold listings */
		$sold_properties = array();
		$sold_search = new Search();
		$sold_search->addTerm( 'buyer_seller', $team->rebrand_code );
		$sold_search->addFilter( SearchFilter::SOLD );
		$sold_search->addOrderBy( 'list_price', false);
		$sold_props = $sold_search->run( 0, 3);
		//set idx view to the sold table to get the sold prop info
		IDX::Set_IDX_View_Name( IDX::SOLD );
		$tmp_properties = Property::GetPropertiesFromIdArray($sold_props, PropertyLoadLevel::IDX_SUMMARY, true);

		foreach( $sold_props as $sold_prop ) {
			try{
				$property = $tmp_properties[$sold_prop];
				$temp_pic = $property->get_first_pic();
				if ( is_object( $temp_pic ) ){
					$property->photo = $temp_pic->getUrl();
				} else {
					$property->photo = false;
				}
				$sold_properties[] = $property;
			}
			catch( Exception $e ) {}
		}
		unset($tmp_properties);

		//reset back to normal idx view
		IDX::Set_IDX_View_Name( IDX::MATERIALIZED );

		$tpl_args = array(
			'testimonials' => $testimonial_dicts,
			'properties' => $properties,
			'sold_properties' => $sold_properties,
		);
		return $tpl_args;
 	}
コード例 #12
0
ファイル: search.php プロジェクト: nioc/ampache
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
require_once 'lib/init.php';
UI::show_header();
/**
 * action switch
 */
switch ($_REQUEST['action']) {
    case 'search':
        if ($_REQUEST['rule_1'] != 'missing_artist') {
            $browse = new Browse();
            require_once AmpConfig::get('prefix') . '/templates/show_search_form.inc.php';
            require_once AmpConfig::get('prefix') . '/templates/show_search_options.inc.php';
            $results = Search::run($_REQUEST);
            $browse->set_type($_REQUEST['type']);
            $browse->show_objects($results);
            $browse->store();
        } else {
            $wartists = Wanted::search_missing_artists($_REQUEST['rule_1_input']);
            require_once AmpConfig::get('prefix') . '/templates/show_missing_artists.inc.php';
            echo '<a href="http://musicbrainz.org/search?query=' . rawurlencode($_REQUEST['rule_1_input']) . '&type=artist&method=indexed" target="_blank">' . T_('View on MusicBrainz') . '</a><br />';
        }
        break;
    case 'save_as_smartplaylist':
        if (!Access::check('interface', 25)) {
            UI::access_denied();
            exit;
        }
        $playlist = new Search();
コード例 #13
0
ファイル: album.class.php プロジェクト: bl00m/ampache
 /**
  * Search for item childrens.
  * @param string $name
  * @return array
  */
 public function search_childrens($name)
 {
     $search['type'] = "song";
     $search['rule_0_input'] = $name;
     $search['rule_0_operator'] = 4;
     $search['rule_0'] = "title";
     $search['rule_1_input'] = $this->name;
     $search['rule_1_operator'] = 4;
     $search['rule_1'] = "album";
     $search['rule_2_input'] = $this->album_artist_name;
     $search['rule_2_operator'] = 4;
     $search['rule_2'] = "artist";
     $songs = Search::run($search);
     $childrens = array();
     foreach ($songs as $song) {
         $childrens[] = array('object_type' => 'song', 'object_id' => $song);
     }
     return $childrens;
 }
コード例 #14
0
ファイル: api.class.php プロジェクト: cheese1/ampache
 /**
  * advanced_search
  * Perform an advanced search given passed rules
  * @param array $input
  */
 public static function advanced_search($input)
 {
     ob_end_clean();
     XML_Data::set_offset($input['offset']);
     XML_Data::set_limit($input['limit']);
     $results = Search::run($input);
     $type = 'song';
     if (isset($input['type'])) {
         $type = $input['type'];
     }
     switch ($type) {
         case 'artist':
             echo XML_Data::artists($results);
             break;
         case 'album':
             echo XML_Data::albums($results);
             break;
         default:
             echo XML_Data::songs($results);
             break;
     }
 }
コード例 #15
0
ファイル: search.php プロジェクト: jessefurmanek/dotfiles
            }
            return;
        }
        $myPages = array('dashboard' => array('', 'View your dashboard'), 'pulls ' => array('pulls', 'View your pull requests', 'pull-request'), 'issues ' => array('issues', 'View your issues', 'issue'), 'stars' => array('stars', 'View your starred repositories'), 'profile' => array(self::$user->login, 'View your public user profile', 'user'), 'settings' => array('settings', 'View or edit your account settings'), 'notifications' => array('notifications', 'View all your notifications'));
        foreach ($myPages as $key => $my) {
            Workflow::addItem(Item::create()->title('my ' . $key)->subtitle($my[1])->icon(isset($my[2]) ? $my[2] : rtrim($key))->arg('/' . $my[0])->prio(1));
        }
        Workflow::addItem(Item::create()->title('my gists')->subtitle('View your gists')->icon('gists')->arg(Workflow::getGistUrl() . '/' . self::$user->login)->prio(1));
    }
    private static function addSystemCommands()
    {
        $cmds = array('delete cache' => 'Delete GitHub Cache', 'logout' => 'Log out this workflow', 'update' => 'Update this Alfred workflow');
        if (Workflow::getConfig('autoupdate', true)) {
            $cmds['deactivate autoupdate'] = 'Deactivate auto updating this Alfred Workflow';
        } else {
            $cmds['activate autoupdate'] = 'Activate auto updating this Alfred Workflow';
        }
        if (self::$enterprise) {
            $cmds['enterprise reset'] = 'Reset the GitHub Enterprise URL';
        }
        foreach ($cmds as $cmd => $desc) {
            Workflow::addItem(Item::create()->title('> ' . $cmd)->subtitle($desc)->icon($cmd)->arg('> ' . str_replace(' ', '-', $cmd)));
        }
        $cmds = array('help' => 'readme', 'changelog' => 'changelog');
        foreach ($cmds as $cmd => $file) {
            Workflow::addItem(Item::create()->title('> ' . $cmd)->subtitle('View the ' . $file)->icon('file')->arg('https://github.com/gharlan/alfred-github-workflow/blob/master/' . strtoupper($file) . '.md'));
        }
    }
}
print Search::run($argv[1], $argv[2], getenv('hotkey'));