-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Real time Weekend Box Office results on wordpress websites
- Loading branch information
Showing
10 changed files
with
998 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,75 @@ | ||
# top-box-office | ||
Top Box office provides real time ranking of the box office and always keep users upto date with latest box office results. The data updates automatically every week, no need to do any extra work. | ||
# Top Box Office | ||
|
||
Real time Weekend Box Office results on your blog. | ||
|
||
Top Box office provides real time ranking of the weekend box office and always keep users upto date with latest box office results. The data updates automatically every week, no need to do any extra work. | ||
|
||
## It has | ||
|
||
* Real time Box Office result. | ||
* Customization options | ||
* Ready shortcode for post, pages or other post type and for wordpress theme | ||
* Ready widget | ||
* Bollywood Box Office (shortcode and widget) | ||
|
||
## Required settings | ||
|
||
* After plugin installation, go to `Wordpress Dashboard > Settings > XTCZ Box Office` and save required configuration here. | ||
**Rottentomatoes Key** is required to work this plugin. You can Register Rottentomatoes key from [here](http://developer.rottentomatoes.com/member/register). | ||
* For Bollywood box office no any configration required. And **Rottentomatoes Key** is not required for bollywood box office resutls. | ||
|
||
## ShortCode | ||
|
||
* Use `[xtcz_topboxoffice]` shortcode to display top box office in post, pages or other custom post type. | ||
* Use `<?php echo do_shortcode('[xtcz_topboxoffice]'); ?>` php code to display top box office movie list into wordpress theme file. | ||
* Use `[xtcz_bollywood_boxoffice]` shortcode for bollywood box office. | ||
|
||
## Optional parameters | ||
|
||
You can also use optional parameters to override saved setting options. | ||
|
||
For example: | ||
`[xtcz_topboxoffice theme="standard" img_width="25"]` | ||
|
||
### List of optional parameters | ||
|
||
* `theme` : 'fullview' or 'standard' . | ||
* `limit` : Numeric value to show number of movies in the top box office list. | ||
* `img` : Boolean value ( 1 or 0 ) to show/hide thumbnail image. | ||
* `img_width` : Numeric value ( 1 or 0 ) to set width of thumbnail image. | ||
* `mpaa_rating` : Boolean value ( 1 or 0 ) to show/hide movie's Mpaa rating. | ||
* `audience_score` : Boolean value ( 1 or 0 ) to show/hide movie's Audience Score. | ||
* `release_dates` : Boolean value ( 1 or 0 ) to show/hide movie's Release dates. | ||
* `runtime` : Boolean value ( 1 or 0 ) to show/hide movie's Runtime. | ||
* `cast` : Boolean value ( 1 or 0 ) to show/hide movie's Cast. | ||
* `synopsis` : Boolean value ( 1 or 0 ) to show/hide movie's synopsis. | ||
|
||
## Installation | ||
|
||
1. Download " Top Box Office" plugin. | ||
1. Upload the 'top-box-office' directory to your '/wp-content/plugins/' directory, using your favorite method (ftp, sftp, scp, etc...) | ||
1. Activate " Top Box Office" from your Plugins page. | ||
|
||
## Extra | ||
|
||
1. Visit 'Settings > Top Box Office' and adjust your configuration & settings. | ||
1. Use `[xtcz_topboxoffice]` shortcode or `<?php echo do_shortcode('[xtcz_topboxoffice]'); ?>` in your theme. | ||
1. Use `[xtcz_bollywood_boxoffice]` shortcode or `<?php echo do_shortcode('[xtcz_bollywood_boxoffice]'); ?>` for bollywood box office results. | ||
|
||
## Frequently asked questions | ||
|
||
**How can I call box office list into template** | ||
|
||
Place `<?php echo do_shortcode('[xtcz_topboxoffice]'); ?>` in your templates | ||
|
||
**How can I override saved settings in shortcode** | ||
|
||
You can use optional parameters to override saved setting. Example: `[xtcz_topboxoffice theme="standard" img_width="25"]` | ||
|
||
**Does optional parameters will work for bollywood box office resutls** | ||
|
||
No, optional parameters will not work for bollywood box office results. | ||
|
||
**Does 'Rottentomatoes Key' required for bollywood box office** | ||
|
||
No, Rottentomatoes Key is not required in case of bollywood box office |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
|
||
|
||
add_shortcode( 'xtcz_bollywood_boxoffice', function($atts) { | ||
|
||
|
||
if ( $bollywoodboxOfficeList = xtcz_get_bollywood_box_office_list() ) : | ||
|
||
$bollywoodboxOfficeListArr = json_decode( $bollywoodboxOfficeList ); | ||
if ( isset( $bollywoodboxOfficeListArr->error ) ) : | ||
return $bollywoodboxOfficeListArr->error; | ||
else : | ||
|
||
return xtcz_bollywoodview( $bollywoodboxOfficeListArr, $atts ); | ||
|
||
endif; | ||
|
||
else: | ||
noBoxofficeResultFound(); | ||
endif; | ||
} ); | ||
|
||
|
||
function xtcz_bollywoodview( $bollywoodboxOfficeListArr ) { | ||
|
||
|
||
$data = "<table class='xtcz-top-box-office-list'>"; | ||
$data .= "<tr class='xtcz-heading'>"; | ||
$data .= "<th colspan='2' class='xtcz-movie-title'>Top Five Bollywood Weekend Box Office</th>"; | ||
|
||
$data .= "</tr>"; | ||
|
||
$oddEven = 'even'; $count = 0; | ||
|
||
$bollywoodboxOfficeListArr = arrayFromObject($bollywoodboxOfficeListArr); | ||
|
||
foreach ( $bollywoodboxOfficeListArr as $movieInfo ) : | ||
|
||
$oddEven = ($oddEven == 'odd') ? 'even' : 'odd'; | ||
$data .= "<tr class='" . $oddEven . "'>"; | ||
|
||
$data .= "<td>"; | ||
|
||
//Movie Rank | ||
$data .= ++$count . ". "; | ||
|
||
//Movie Title | ||
$data .= "<strong>" . $movieInfo[1] . "</strong>"; | ||
|
||
$data .= "</td>"; | ||
|
||
//Movie Total Earning | ||
$data .= "<td>" . $movieInfo[3] . "</td>"; | ||
|
||
|
||
$data .= "</tr>"; | ||
endforeach; | ||
|
||
$data .= "</table>". imp34342dfd(); | ||
return $data; | ||
} | ||
|
||
|
||
|
||
|
||
function xtcz_get_bollywood_box_office_list( $transient_key = 'bollywood-box-office' ) { | ||
|
||
$data = get_transient($transient_key); | ||
if( !$data ) { | ||
$data = xtcz_get_bollywood_box_office_list_from_api( $transient_key); | ||
} | ||
if(isset($data->response)) { | ||
return $data->response; | ||
} else { | ||
return FALSE; | ||
} | ||
} | ||
|
||
|
||
function xtcz_get_bollywood_box_office_list_from_api( $transient_key = 'bollywood-box-office' ) { | ||
|
||
$url = "http://www.koimoi.com/wp-content/plugins/BO/BO_data.txt"; | ||
$response = wp_remote_get( $url ); | ||
if ( is_array( $response ) ) { | ||
|
||
$data = new stdClass(); | ||
$data->response = $response['body']; | ||
set_transient($transient_key, $data , 60 * 24); | ||
return $data; | ||
} else { | ||
return FALSE; | ||
} | ||
|
||
} | ||
|
||
function arrayFromObject($d) { | ||
if (is_object($d)) { | ||
// Gets the properties of the given object | ||
// with get_object_vars function | ||
$d = get_object_vars($d); | ||
} | ||
|
||
if (is_array($d)) { | ||
/* | ||
* Return array converted to object | ||
* Using __FUNCTION__ (Magic constant) | ||
* for recursive call | ||
*/ | ||
return array_map(__FUNCTION__, $d); | ||
} else { | ||
return $d; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
jQuery( document ).ready(function($){ | ||
|
||
var idsTohandle = '#xtcz_plugin_options-mpaa_rating-true'; | ||
idsTohandle += ', #xtcz_plugin_options-mpaa_rating-false'; | ||
idsTohandle += ', #xtcz_plugin_options-runtime-true'; | ||
idsTohandle += ', #xtcz_plugin_options-runtime-false'; | ||
idsTohandle += ', #xtcz_plugin_options-cast-true'; | ||
idsTohandle += ', #xtcz_plugin_options-cast-false'; | ||
idsTohandle += ', #xtcz_plugin_options-synopsis-true'; | ||
idsTohandle += ', #xtcz_plugin_options-synopsis-false'; | ||
|
||
var selected = $("input[type='radio'][name='xtcz_plugin_options[theme]']:checked"); | ||
if (selected.length > 0) { | ||
selectedVal = selected.val(); | ||
if(selectedVal == 'standard') { | ||
$(idsTohandle).attr('disabled',true); | ||
} | ||
} | ||
|
||
$("input[type='radio'][name='xtcz_plugin_options[theme]']").change(function(){ | ||
if($(this).val() == 'standard') { | ||
$(idsTohandle).attr('disabled',true); | ||
} else { | ||
$(idsTohandle).attr('disabled',false); | ||
} | ||
}); | ||
|
||
}); |
Oops, something went wrong.