Plugin Directory

Changeset 2987229


Ignore:
Timestamp:
11/01/2023 07:42:12 AM (2 years ago)
Author:
Dudo
Message:

version 1.2.3

Location:
yet-another-movie/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • yet-another-movie/trunk/admin/editor/movieHelperEditor.php

    r2848387 r2987229  
    3838    public function addMetaboxes () {
    3939        //Default post type where display metabox
    40         $post_types = array('post', 'page');
     40        $post_types = ['post', 'page'];
    4141
    4242        //get the custom post type
  • yet-another-movie/trunk/admin/js/editor.js

    r2848387 r2987229  
    199199    let targetBlank   = '';
    200200
    201     if(JSON.parse(movieHelperCommonData.tmdb.target_blank) === true) {
     201    if(JSON.parse(movieHelperCommonData.target_blank) === true) {
    202202        targetBlank = 'target="_blank"';
    203203    }
     
    281281
    282282/**
    283 * When button insert is clicked, create a core/paragrapgh block and insert blockMovieList.innerHTML
     283* When button insert is clicked, create a core/paragraph block and insert blockMovieList.innerHTML
    284284*
    285285* @param event
     
    292292
    293293/**
    294  * Return the Year from a date, ora the string N/A if date is not set
     294 * Return the Year from a date, or the string N/A if date is not set
    295295 *
    296296 * @param date {string}
  • yet-another-movie/trunk/admin/movie-helper-settings-misc.php

    r2848387 r2987229  
    2323
    2424function movie_helper_customize_links_description () {
    25     $name        = esc_html__('Customize links', 'movie-helper');
     25    $name        = esc_html__('Customize content', 'movie-helper');
    2626
    2727    $div_desc     = '<div class="moviehelper-settings-description">';
    28     $description  = esc_html__('Custom text to show after a link','movie-helper');
     28    //$description  = esc_html__('Custom text to show after a link','movie-helper');
    2929    $end_div      = '.</div>';
    3030
    31     return $name . $div_desc . $description . $end_div;
     31    return $name . $div_desc . $end_div;
    3232}
  • yet-another-movie/trunk/admin/movieHelper.php

    r2905485 r2987229  
    224224
    225225        //define mh settings
    226         define('MOVIEHELPER_TEXT_AFTER_LINKS', $mh_options['txt_after_links']);
     226        define('MOVIEHELPER_TEXT_AFTER_LINKS',  $mh_options['txt_after_links']);
     227        define('MOVIEHELPER_TARGET_BLANK', $mh_options['target_blank']);
     228
    227229    }
    228230
     
    237239
    238240        //define tmdb settings
    239         define('MOVIEHELPER_TMDB_TARGET_BLANK',  $tmdb_options['target_blank']);
    240241        define('MOVIEHELPER_TMDB_ADULT',         $tmdb_options['include_adult']);
    241242        define('MOVIEHELPER_TMDB_CUSTOM_APIKEY', $tmdb_options['api_key']);
     
    261262                $error = $valid_api;
    262263            }
    263             $transient_value = array(
     264            $transient_value = [
    264265                'error'   => true,
    265266                'message' => $error
    266             );
     267            ];
    267268            set_transient('tmdb_api_key', $transient_value, DAY_IN_SECONDS);
    268269            return $error;
    269270        }
    270271
    271         $transient_value = array(
     272        $transient_value = [
    272273            'error'   => false,
    273274            'api_key' => $api_key
    274         );
     275        ];
    275276
    276277        set_transient('tmdb_api_key', $transient_value, DAY_IN_SECONDS);
     
    325326     */
    326327    public static function getCustomPostTypes() {
    327         $args = array(
     328        $args = [
    328329            'public'   => true,
    329330            '_builtin' => false
    330         );
     331        ];
    331332
    332333        $output   = 'names'; // names or objects, note names is the default
  • yet-another-movie/trunk/admin/movieHelperGetSettings.php

    r2905485 r2987229  
    1717     */
    1818    public function mh () {
    19         $mh_settings    = get_option('moviehelper_settings', array());
     19        $mh_settings = get_option('moviehelper_settings', []);
    2020
    2121        if(!isset($mh_settings['txt_after_links'])) {
     
    2323        }
    2424
     25        $mh_settings['target_blank']  = $this->mhGetTarget($mh_settings);
     26
    2527        return $mh_settings;
    26     }
    27 
    28     /**
    29      * Return a cleaned array of tmdb options
    30      *
    31      * @author Dario Curvino <@dudo>
    32      * @since  1.1.2
    33      * @return array|mixed
    34      */
    35     public function tmdb () {
    36         $tmdb_options = get_option('moviehelper_tmdb_settings', array());
    37 
    38         $tmdb_options['target_blank']  = $this->tmdbGetTarget($tmdb_options);
    39         $tmdb_options['include_adult'] = $this->includeAdult($tmdb_options);
    40 
    41         //If apy_key is not set, initialize it on false
    42         if(!isset($tmdb_options['api_key'])) {
    43             $tmdb_options['api_key'] = false;
    44         }
    45 
    46         return $tmdb_options;
    4728    }
    4829
     
    5839     * @return bool
    5940     */
    60     private function tmdbGetTarget($options) {
     41    private function mhGetTarget($options) {
    6142        $target_blank  = false;
    6243
     
    6748
    6849        return $target_blank;
     50    }
     51
     52    /**
     53     * Return a cleaned array of tmdb options
     54     *
     55     * @author Dario Curvino <@dudo>
     56     * @since  1.1.2
     57     * @return array|mixed
     58     */
     59    public function tmdb () {
     60        $tmdb_options = get_option('moviehelper_tmdb_settings', []);
     61
     62        $tmdb_options['include_adult'] = $this->includeAdult($tmdb_options);
     63
     64        //If apy_key is not set, initialize it on false
     65        if(!isset($tmdb_options['api_key'])) {
     66            $tmdb_options['api_key'] = false;
     67        }
     68
     69        return $tmdb_options;
    6970    }
    7071
  • yet-another-movie/trunk/admin/movieHelperScripts.php

    r2905485 r2987229  
    6565                'moviehelper-editor',
    6666                MOVIEHELPER_JS_DIR . 'editor.js',
    67                 array('themoviedb', 'wp-i18n'),
     67                ['themoviedb', 'wp-i18n'],
    6868                MOVIEHELPER_VERSION_NUM,
    6969                true
     
    9595
    9696            $mh_common_data = json_encode(
    97                 array(
     97                [
    9898                    'guten_page'         => movieHelper::isGutenPage(),
    9999                    'img_dir'            => MOVIEHELPER_IMG_DIR,
    100100                    'lang'               => str_replace('_', '-', get_locale()),
    101101                    'custom_text_link'   => json_encode(wp_kses_post(MOVIEHELPER_TEXT_AFTER_LINKS)),
    102                     'tmdb' => array(
    103                         'target_blank'  => json_encode(MOVIEHELPER_TMDB_TARGET_BLANK),
     102                    'target_blank'  => json_encode(MOVIEHELPER_TARGET_BLANK),
     103                    'tmdb' => [
    104104                        'include_adult' => MOVIEHELPER_TMDB_ADULT, //leave this as a string
    105105                        'api_key'       => MOVIEHELPER_TMDB_CUSTOM_APIKEY
    106                     )
    107                 )
     106                    ]
     107                ]
    108108            );
    109109
  • yet-another-movie/trunk/admin/movieHelperSettingsPage.php

    r2848387 r2987229  
    127127        );
    128128
    129 
    130129        add_settings_field(
    131130            'moviehelper_customize_links',
     
    188187        ?>
    189188        <div class="moviehelper-general-settings">
     189            <label for="moviehelper-custom-links">
     190                <strong>
     191                    <?php echo esc_html__('Customize links', 'movie-helper') ?>
     192                </strong>
     193            </label>
     194            <p></p>
    190195            <input
    191196                type="text"
     
    195200                placeholder="<?php echo esc_html__('(%vote_average%), %year% ')?>"
    196201            >
    197             <label for="moviehelper-custom-links">
    198             </label>
    199202            <p></p>
    200             <div class="moviehelper-element-description" style="margin-top: 10px">
    201                 <span><strong>Allowed Variables:</strong></span>
    202                 <p>
     203            <div class="moviehelper-element-description" style="margin-top: 10px;">
     204                <span>Custom text to show after a link, allowed variables:</span>
     205                <p style="margin-left: 10px;">
    203206                    <strong>%year%</strong> - Display the year <br />
    204207                    <strong>%vote_average%</strong> - Display the vote average <br />
     
    207210            </div>
    208211
     212            <div>
     213                <strong><?php esc_html_e('Open link in new tab?', 'movie-helper') ?></strong>
     214                <p></p>
     215                <div class="moviehelper-onoffswitch-big">
     216                    <input type="checkbox" name="moviehelper_settings[target_blank]"
     217                        <?php if (MOVIEHELPER_TARGET_BLANK === true){ echo 'checked="checked"'; }?>
     218                           value="true"
     219                           class="moviehelper-onoffswitch-checkbox"
     220                           id="moviehelper-target-blank"
     221                    />
     222                    <label class="moviehelper-onoffswitch-label" for="moviehelper-target-blank">
     223                        <span class="moviehelper-onoffswitch-inner"></span>
     224                        <span class="moviehelper-onoffswitch-switch"></span>
     225                    </label>
     226                </div>
     227            </div>
     228
    209229        </div>
    210230
     
    218238    public function tmdbSettingsFilterAdult() {
    219239        ?>
    220 
    221         <div>
    222             <strong><?php esc_html_e('Open link in new tab?', 'movie-helper') ?></strong>
    223             <p></p>
    224             <div class="moviehelper-onoffswitch-big">
    225                 <input type="checkbox" name="moviehelper_tmdb_settings[target_blank]"
    226                     <?php if (MOVIEHELPER_TMDB_TARGET_BLANK === true){ echo 'checked="checked"'; }?>
    227                        value="true"
    228                        class="moviehelper-onoffswitch-checkbox"
    229                        id="moviehelper-target-blank"
    230                 />
    231                 <label class="moviehelper-onoffswitch-label" for="moviehelper-target-blank">
    232                     <span class="moviehelper-onoffswitch-inner"></span>
    233                     <span class="moviehelper-onoffswitch-switch"></span>
    234                 </label>
    235             </div>
    236         </div>
    237 
    238         <p>&nbsp;</p>
    239240        <div>
    240241            <strong><?php esc_html_e('Include adult content?', 'movie-helper') ?></strong>
     
    313314    public function sanitizeTMDBSettings($options) {
    314315        // Create our array for storing the validated options
    315         $output = array();
     316        $output = [];
    316317
    317318        // Loop through each of the incoming options
     
    403404        $text .= '<div class="moviehelper-donate-title">' . __('You may also like...', 'movie-helper') .'</div>';
    404405        $text .= '<div class="moviehelper-donate-content">';
    405         $text .= $this->yasr();
    406         $text .= '</p><hr />';
    407406        $text .= $this->cnrt();
    408407        $text .= '</div>'; //second div
     
    413412
    414413    /**
    415      * Yasr Box
     414     * CNRT box
    416415     *
    417416     * @author Dario Curvino <@dudo>
     
    419418     * @return string
    420419     */
    421     private function yasr() {
    422         $url = add_query_arg(
    423             array(
    424                 'tab'       => 'plugin-information',
    425                 'plugin'    => 'yet-another-stars-rating',
    426                 'TB_iframe' => 'true',
    427                 'width'     => '772',
    428                 'height'    => '670'
    429             ),
    430             network_admin_url( 'plugin-install.php' )
    431         );
    432         $text  = '<h4>Yet Another Stars Rating</h4>';
    433         $text .= '<div style="margin-top: 15px;">';
    434         $text .= esc_html__('Boost the way people interact with your site with an easy WordPress stars rating system!
    435         With Schema.org rich snippets YASR will improve your SEO!', 'movie-helper');
    436         $text .= '</div>';
    437         $text .= '<div style="margin-top: 15px;">
    438                     <a href="'. esc_url( $url ).'" class="install-now button thickbox open-plugin-details-modal" target="_blank">'
    439                     . __( 'Install', 'movie-helper' ).'</a>';
    440         $text .= '</div>';
    441 
    442         return $text;
    443     }
    444 
    445     /**
    446      * CNRT box
    447      *
    448      * @author Dario Curvino <@dudo>
    449      * @since 1.0.2
    450      * @return string
    451      */
    452420    private function cnrt() {
    453421        $url = add_query_arg(
    454             array(
     422            [
    455423                'tab'       => 'plugin-information',
    456424                'plugin'    => 'comments-not-replied-to',
     
    458426                'width'     => '772',
    459427                'height'    => '670'
    460             ),
     428            ],
    461429            network_admin_url( 'plugin-install.php' )
    462430        );
  • yet-another-movie/trunk/movie-helper.php

    r2905485 r2987229  
    55 * Plugin URI: https://dariocurvino.it
    66 * Description: Movie Helper allows you to easily add links to movie and tv shows, just by searching them while you're writing your content. Search, click, done!
    7  * Version: 1.2.2
     7 * Version: 1.2.3
    88 * Requires at least: 5.0
    99 * Requires PHP: 5.4
     
    3939
    4040if(is_admin()) {
    41     define('MOVIEHELPER_VERSION_NUM', '1.2.2');
     41    define('MOVIEHELPER_VERSION_NUM', '1.2.3');
    4242
    4343    require 'admin/movieHelper.php';
     
    4747}
    4848
    49 //this add a link under the plugin name, must be in the main plugin file
     49//this adds a link under the plugin name, must be in the main plugin file
    5050add_filter('plugin_action_links_' . plugin_basename( __FILE__ ), static function ($links){
    5151    $settings_link='<a href="' . admin_url( 'options-general.php?page=moviehelper_settings_page' ) . '">General Settings</a>';
    5252
    53     //array_unshit adds to the begin of array
     53    //array_unshift adds to the beginning of array
    5454    array_unshift($links, $settings_link);
    5555
  • yet-another-movie/trunk/readme.md

    r2956755 r2987229  
    55Requires at least: 5.0 
    66Contributors: Dudo 
    7 Tested up to: 6.3
    8 Stable tag: 1.2.2  
     7Tested up to: 6.4
     8Stable tag: 1.2.3 
    99License: GPL2   
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333## Video Tutorial
    3434
    35 [youtube https://www.youtube.com/watch?v=d3PI8si-fS4]
     35[youtube https://www.youtube.com/watch?v=QOdCeV7-TR4]
    3636
    3737Follow development on [GitHub](https://github.com/Dudo1985/Movie-Helper)
     
    4040
    41411. Navigate to Dashboard -> Plugins -> Add New and search for Movie Helper
    42 2. Click on "Install Now" and than "Activate"
     422. Click on "Install Now" and then "Activate"
    4343
    4444## Frequently Asked Questions
     
    6969## Changelog
    7070
     71= 1.2.3 =
     72* Minor changes
     73
    7174= 1.2.2 =
    7275* TWEAKED: Minor Changes
Note: See TracChangeset for help on using the changeset viewer.