Plugin Directory

Changeset 2426919


Ignore:
Timestamp:
11/26/2020 09:40:27 PM (5 years ago)
Author:
springthistle
Message:

Updated code, fixed a bunch of PHP compatibility errors, tested with WP 5.6

Location:
aprils-call-posts
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • aprils-call-posts/trunk/ahs_callposts.php

    r1998295 r2426919  
    44Plugin URI: http://springthistle.com/wordpress/plugin_callposts
    55Description: Via shortcode, lets you call in a list of posts that are filtered, displayed and ordered based on criteria you provide. <a href="options-general.php?page=ahs_callposts_admin.php">Edit Settings</a>.
    6 Version: 2.0.14
     6Version: 2.1
    77Author: Aaron Hodge Silver
    88Author URI: http://springthistle.com/
    99License: GPL2
    1010
    11     Copyright 2011  Aaron Hodge Silver  (email : ahs@springthistle.com)
     11    Copyright 2011  Aaron Hodge Silver  (email : aaron@springthistle.com)
    1212
    1313    This program is free software; you can redistribute it and/or modify
  • aprils-call-posts/trunk/ahs_callposts_admin.php

    r1957759 r2426919  
    77    array("name" => "Title Style",
    88        "id" => "ahscp_titletype",
     9        'type' => 'text',
    910        'size'=>50,
    1011        'std'=>'h3',
     
    1920    array("name" => "Date Format",
    2021        "id" => "ahscp_dateformat",
     22        'type' => 'text',
     23        'std'=>'',
    2124        'size'=>100,
    2225        'help'=>'If you enter a date format here, it will be used to insert the post date for all posts on the site. You can override this default setting in any individual use of the shortcode by including the option <code>dateformat</code> and setting it to a different format or to empty.<br />A nice default is <code>F j</code>. See PHP.net\'s <a href="http://php.net/manual/en/function.date.php" target="_blank">Date Formatting Instructions</a> for more.'),
     
    3033    array("name" => "Styling",
    3134        "id" => "ahscp_css",
     35        'std'=>'',
    3236        'type'=>'textarea',
    3337        'help'=>'When you first install this plugin, this box will have the default css that I put in, mostly to style the 2-column and sidebox options. You can edit this css easily here.'),
     
    3539    array("name" => "Custom Field",
    3640        "id" => "ahscp_customfield",
     41        'type' => 'text',
     42        'std'=>'',
    3743        'size'=>150,
    3844        'help'=>'The shortcode automatically orders posts by most-recent-first. If you\'d like them to be ordered by a custom field, enter the name of the custom field here. You can override this default setting in any individual use of the shortcode by including the option <code>custom_field</code>. If you set a custom_field value here, but want it to NOT impact a particular shortcode instances, set its value to <code>false</code>.'),
     
    99105
    100106    // add hidden field to store last-used tab
    101     $ahscp_options[] = array('id'=>'ahscp_activetab','type'=>'hidden','divclass'=>'hidden','std'=>2);
    102 
    103     if ( $_GET['page'] == basename(__FILE__) ) {
    104         if ( 'save' == $_REQUEST['action'] ) {
     107    $ahscp_options[] = array('id'=>'ahscp_activetab', 'name'=>'activetab', 'type'=>'hidden','divclass'=>'hidden','std'=>2);
     108
     109    if ( isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) {
     110        if ( isset($_REQUEST['action']) && 'save' == $_REQUEST['action'] ) {
    105111                foreach ($ahscp_options as $value) {
    106112                    update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
     
    109115                header("Location: options-general.php?page=".basename(__FILE__)."&saved=true");
    110116                die;
    111         } else if ( 'reset' == $_REQUEST['action'] ) {
     117        } else if ( isset($_REQUEST['action']) && 'reset' == $_REQUEST['action'] ) {
    112118            foreach ($ahscp_options as $value) delete_option( $value['id'] );
    113119            header("Location: options-general.php?page=".basename(__FILE__)."&reset=true");
     
    115121        }
    116122    }
    117     add_submenu_page('options-general.php', 'April\'s Call Posts', 'April\'s Call Posts', 8, basename(__FILE__), 'ahscp_adminpage');
     123    add_submenu_page('options-general.php', 'April\'s Call Posts', 'April\'s Call Posts', 'edit_theme_options', basename(__FILE__), 'ahscp_adminpage');
    118124}
    119125
    120126function ahscp_adminpage() {
    121127    global $ahscp_options;
    122     if ( $_REQUEST['saved'] ) $msg = '<div class="updated" style="width: 785px;"><p>Call Posts settings saved.</p></div>';
    123     if ( $_REQUEST['reset'] ) $msg = '<div class="updated" style="width: 785px;"><p>Call Posts ssettings reset.</p></div>';
     128    if ( isset($_REQUEST['saved']) && $_REQUEST['saved'] ) $msg = '<div class="updated" style="width: 785px;"><p>Call Posts settings saved.</p></div>';
     129    if ( isset($_REQUEST['reset']) && $_REQUEST['reset'] ) $msg = '<div class="updated" style="width: 785px;"><p>Call Posts settings reset.</p></div>';
    124130?>
    125131<div class="wrap ahscp" id="backtotop" style="width: 800px;">
     
    148154        $tabs[$numtabs] = $value['name'];
    149155    }
     156    if (!isset($cards[$numtabs])) $cards[$numtabs] = '';
    150157    $cards[$numtabs] .= '<h'.$matches[1].'>'.$value['name'].'</h'.$matches[1].'>';
    151158    if (!empty($value['help'])) $cards[$numtabs] .=  $value['help'];
     
    165172                $cards[$numtabs] .= '<option value="'.$optid.'" ';
    166173                if (get_option($value['id']) == $optid) $cards[$numtabs] .= ' selected="selected"';
    167                 elseif ($option == $value['std']) $cards[$numtabs] .= ' selected="selected"';
     174                elseif (isset($value['std']) && $option == $value['std']) $cards[$numtabs] .= ' selected="selected"';
    168175                $cards[$numtabs] .= '>'.$option.'</option>';
    169176            }
     
    218225</div><!--/ tabs -->
    219226
    220 <p class="submit">
    221     <input name="save" type="submit" value="Save changes on all tabs" />
     227<div style="float:right;">
     228    <input name="save" type="submit" class="button button-primary" value="Save changes on all tabs" />
    222229    <input type="hidden" name="action" value="save" />
    223 </p>
     230</div>
    224231</form>
    225 <form method="post">
    226     <p class="submit" style="float:right;">
    227         <input name="reset" type="submit" value="<?php _e('Delete all Data and Reset to Default Settings'); ?>" />
    228         <input type="hidden" name="action" value="reset" />
    229     </p>
     232<form method="post" style="float:left;">
     233    <input name="reset" type="submit" class="button" value="<?php _e('Delete all Data and Reset to Default Settings'); ?>" />
     234    <input type="hidden" name="action" value="reset" />
    230235</form>
    231236
     
    234239    $('#tabs div.card').hide();
    235240    <?php
    236         if ($_REQUEST['saved']) {
     241        if (isset($_REQUEST['saved']) && $_REQUEST['saved']) {
    237242            $tmp = get_option('ahscp_activetab');
    238243        }
  • aprils-call-posts/trunk/ahscpstyle.css

    r1264200 r2426919  
    3333    padding: 7px 10px;
    3434    color: #666;
    35     font-family: Georgia;
    3635    font-size: 16px;
    3736}
     
    5958    font-size:20px;
    6059    margin-top: 0;
    61     color:#A66540;
     60    color:#a6866b;
    6261    font-weight:normal;
    6362    clear: both;
     
    6665    margin-bottom:5px;
    6766    font-size:14px;
    68     color:#A66540;
     67    color:#a6866b;
    6968    clear: both;
    7069    border-top: 2px solid #ddd;
  • aprils-call-posts/trunk/readme.txt

    r1957759 r2426919  
    22Contributors: springthistle
    33Tags: posts, shortcode
    4 Requires at least: 2.9.1
    5 Tested up to: 4.9.x
    6 Stable tag: 2.0.14
     4Requires at least: 5.0
     5Tested up to: 5.6.x
     6Stable tag: 2.1
    77
    88Via shortcode, lets you call in a list of posts that are filtered, ordered, and displayed based on criteria you provide.
     
    4040
    4141== Changelog ==
     42
     43= 2.1 =
     44* Cleaned up code, updated to be compatible with latest PHP and WordPress
     45* Updated compatibility version.
    4246
    4347= 2.0.14 =
Note: See TracChangeset for help on using the changeset viewer.