Plugin Directory

Changeset 352789


Ignore:
Timestamp:
02/28/2011 12:44:00 AM (15 years ago)
Author:
karunanidhi
Message:
  • Adding excerpt functionality.
  • Adding tabs to option page so that the setting page is more user friendly
Location:
auto-post-images-api/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • auto-post-images-api/trunk/auto-post-images.php

    r326840 r352789  
    33Plugin Name: Auto Post Images (API)
    44Plugin URI: http://www.karthikeyankarunanidhi.com
    5 Version: 3.0.2
     5Version: 3.1
    66Author: <a href="http://www.karthikeyankarunanidhi.com">Karthikeyan Karunanidhi</a>
    77Description: Automatically adds images to posts without having to edit the post.
     
    5454
    5555            /**
    56             * The directory path to the images folder. Make sure you put the plugin files in /wp-content/plugins/auto-post-images-api/
     56            * The directory path to the images folder.
    5757            */
    5858            var $sImageDirPath = '';
    5959
    6060            /**
    61             * The directory path to the images folder. Make sure you put the plugin files in /wp-content/plugins/auto-post-images-api/
     61            * The directory path to the images folder.
    6262            */
    6363            var $sImageThumbnailDirPath = '';
    6464
    6565            /**
    66             * The directory path to the images folder. Make sure you put the plugin files in /wp-content/plugins/auto-post-images-api/
     66            * The directory path to the images folder.
    6767            */
    6868            var $sImageCacheDir = '';
    6969
    7070            /**
    71             * The URL to the images folder. Make sure you put the plugin files in /wp-content/plugins/auto-post-images-api/
     71            * The URL to the images folder.
    7272            */
    7373            var $sImageDirUrl = '';
    7474
    7575            /**
    76             * The URL to the thumbnail images folder. Make sure you put the plugin files in /wp-content/plugins/auto-post-images-api/
     76            * The URL to the thumbnail images folder.
    7777            */
    7878            var $sImageThumbnailDirUrl = '';
     
    118118            var $iRandomCount = 1;
    119119
     120            /**
     121            * The length of the excerpt text
     122            */
     123            var $iExcerptLength = 255;
     124
     125            /**
     126            * Text to use to link to the full article when excerpt more is enabled
     127            */
     128            var $sExcerptLinkText = 'more...';
     129
     130            /**
     131            * Remove html tags from the post content when generating excerpts
     132            */
     133            var $bExcerptStripTags = 'NO';
     134
     135            /**
     136            * Enable for disable excerpt generation
     137            */
     138            var $bEnableExcerpt = 'NO';
    120139
    121140            /**
     
    137156                                            "iThumbnailWidth" => 100,
    138157                                            "iSearchType" => API_POSTID,
    139                                             "iRandomCount" => 1
     158                                            "iRandomCount" => 1,
     159                                            "iExcerptLength" => 255,
     160                                            "sExcerptLinkText" => 'more...',
     161                                            "bExcerptStripTags" => 'NO',
     162                                            "bEnableExcerpt" => 'NO'
    140163                                        );
    141164            /**
     
    203226                $this->iSearchType = $this->aAdminOptions['iSearchType'];
    204227                $this->iRandomCount = $this->aAdminOptions['iRandomCount'];
     228
     229
     230                $this->iExcerptLength = ( empty($this->aAdminOptions['iExcerptLength']) ) ? 255 : $this->aAdminOptions['iExcerptLength'];
     231                $this->sExcerptLinkText = ( empty($this->aAdminOptions['sExcerptLinkText']) ) ? 'more...' : $this->aAdminOptions['sExcerptLinkText'];
     232                $this->bExcerptStripTags = ( empty($this->aAdminOptions['bExcerptStripTags']) ) ? 'more...' : $this->aAdminOptions['bExcerptStripTags'];
     233                $this->bEnableExcerpt = ( empty($this->aAdminOptions['bEnableExcerpt']) ) ? 'more...' : $this->aAdminOptions['bEnableExcerpt'];
    205234
    206235                //echo '<pre>'.print_r($this, TRUE).'</pre>';
     
    248277            */
    249278            function showImagesByPostId ($sContent) {
     279
     280                $bAPIExcerpt = FALSE;
     281
     282                if(!is_single() && !is_page()) {
     283
     284                    $bAPIExcerpt = TRUE;
     285                }
    250286
    251287                // If it is not a post then return the contents unmodified
     
    419455                $sHtml .= '</div>';
    420456
     457                if ($bAPIExcerpt === TRUE && $this->bEnableExcerpt == 'YES') {
     458
     459                    $iLength = $this->iExcerptLength;
     460
     461                    if ($this->bExcerptStripTags == 'NO') {
     462
     463                        $iHtmlLen = strlen($sContent);
     464                        $iTextLen = strlen(strip_tags($sContent));
     465                        $iNewLen = $iHtmlLen - $iTextLen;
     466                        $iLength += $iNewLen;
     467
     468                        $sContent = substr($sContent,0,$iLength);
     469
     470                    } else {
     471
     472                        $sContent = substr(strip_tags($sContent),0,$iLength);
     473                    }
     474
     475                    if ( !empty($this->sExcerptLinkText)) {
     476
     477                        $sLink = get_permalink();
     478                        $sTitle = get_the_title($this->iPostId);
     479
     480                        $sContent .= " <a href=\"{$sLink}\" title=\"{$sTitle}\" >{$this->sExcerptLinkText}</a>";
     481                    }
     482                }
     483
    421484                return $sHtml . $sContent;
    422485            }
     
    435498            function includeAdminCSS() {
    436499                echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/auto-post-images-api/css/kkapiadmin.css" />' . "\n";
     500                echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/auto-post-images-api/css/kkapitabs.css" />' . "\n";
    437501            }
    438502
     
    444508                echo '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/auto-post-images-api/js/ibox.js"></script>' . "\n";
    445509                echo '<script type="text/javascript">iBox.setPath("js/");</script>' . "\n";
     510            }
     511
     512            /**
     513            * Hooked into 'admin_head' and inserts the script <script> tag intoAPI plugin settings page <head>
     514            */
     515            function includeAdminJS () {
     516
     517                echo '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/auto-post-images-api/js/tabs.js"></script>' . "\n";
    446518            }
    447519
     
    801873
    802874                        $aAdminOptions['iRandomCount'] = $_POST['AutoPostImagesRandomCount'];
     875                    }
     876
     877                    if (isset($_POST['AutoPostImagesImgUrl'])) {
     878
     879                        $aAdminOptions['iExcerptLength'] = ( !empty($_POST['AutoPostImagesExcerptLength']) ) ? $_POST['AutoPostImagesExcerptLength'] : $aAdminOptions['iExcerptLength'];
     880                    }
     881
     882                    if (isset($_POST['AutoPostImagesImgUrl'])) {
     883
     884                        $aAdminOptions['sExcerptLinkText'] = ( !empty($_POST['AutoPostImagesExcerptLinkText']) ) ? $_POST['AutoPostImagesExcerptLinkText'] : $aAdminOptions['sExcerptLinkText'];
     885                    }
     886
     887                    if (isset($_POST['AutoPostImagesExcerptStripTags'])) {
     888
     889                        $aAdminOptions['bExcerptStripTags'] = ( $_POST['AutoPostImagesExcerptStripTags'] == 'YES' ) ? 'YES' : 'NO';
     890                    }
     891
     892                    if (isset($_POST['AutoPostImagesEnableExcerpt'])) {
     893
     894                        $aAdminOptions['bEnableExcerpt'] = ( $_POST['AutoPostImagesEnableExcerpt'] == 'YES' ) ? 'YES' : 'NO';
    803895                    }
    804896
     
    9371029                }
    9381030
     1031                if ( $aAdminOptions['bExcerptStripTags'] == 'YES' ) {
     1032
     1033                    $sExcerptStripTagsYesRadio = __(' checked="checked" ', 'KKAutoPostImages');
     1034                    $sExcerptStripTagsNoRadio = '';
     1035
     1036                } else {
     1037
     1038                    $sExcerptStripTagsYesRadio = '';
     1039                    $sExcerptStripTagsNoRadio = __(' checked="checked" ', 'KKAutoPostImages');
     1040                }
     1041
     1042                if ( $aAdminOptions['bEnableExcerpt'] == 'YES' ) {
     1043
     1044                    $sEnableExcerptYesRadio = __(' checked="checked" ', 'KKAutoPostImages');
     1045                    $sEnableExcerptNoRadio = '';
     1046
     1047                } else {
     1048
     1049                    $sEnableExcerptYesRadio = '';
     1050                    $sEnableExcerptNoRadio = __(' checked="checked" ', 'KKAutoPostImages');
     1051                }
     1052
    9391053
    9401054                if( strstr($aAdminOptions['sImageDirPath'], 'plugins\auto-post-images-api') || strstr($aAdminOptions['sImageDirPath'], 'plugins/auto-post-images-api') ) {
     
    9681082                                {$sImageDirAlert1}
    9691083
    970                                 <fieldset class=\"kkfieldset\">
    971                                     <legend>Search Settings</legend>
     1084                                <div class=\"submit\">
     1085                                    <input type=\"submit\" name=\"updateAutoPostImagesSettings\" value=\"{$sUpdateAutoPostImagesSubmitButton}\" />
     1086                                </div>
     1087
     1088                                <div class=\"tabber\" style=\"width:90%;\">
     1089
     1090                                <div class=\"tabbertab\">
     1091                                    <h2>Search Settings</h2>
    9721092
    9731093                                    <h3>How do you want to attach images to a POST?</h3>
     
    10501170                                    </table>
    10511171
    1052                                 </fieldset>
     1172                                </div>
     1173
     1174
     1175                                <div class=\"tabbertab\">
     1176                                    <h2>General Settings</h2>
     1177
     1178                                    <h3>Display default image if not image is found?</h3>
     1179
     1180                                    <p>
     1181                                        <input type=\"radio\" id=\"AutoPostImagesDisplayDefaultImages_yes\" name=\"AutoPostImagesDisplayDefaultImages\" value=\"YES\" {$sDisplayDefaultImageYesRadio} /> <label for=\"AutoPostImagesDisplayDefaultImages_yes\">Yes</label>
     1182                                        <input type=\"radio\" id=\"AutoPostImagesDisplayDefaultImages_no\" name=\"AutoPostImagesDisplayDefaultImages\" value=\"NO\" {$sDisplayDefaultImageNoRadio} /> <label for=\"AutoPostImagesDisplayDefaultImages_no\">No</label>
     1183                                    </p>
     1184
     1185                                    <p>Selecting &quot;No&quot; will hide the default &quot;Image coming soon&quot; image if no images are found for the post.</p>
     1186
     1187                                    <h3>Use thumbnails to link to full size images?</h3>
     1188
     1189                                    <p>
     1190                                        <input type=\"radio\" id=\"AutoPostImagesUseThumbnails_yes\" name=\"AutoPostImagesUseThumbnails\" value=\"YES\" {$sUseThumbnailsYesRadio} /> <label for=\"AutoPostImagesUseThumbnails_yes\">Yes</label>
     1191                                        <input type=\"radio\" id=\"AutoPostImagesUseThumbnails_no\" name=\"AutoPostImagesUseThumbnails\" value=\"NO\" {$sUseThumbnailsNoRadio} /> <label for=\"AutoPostImagesUseThumbnails_no\">No</label>
     1192                                    </p>
     1193
     1194                                    <p>Selecting &quot;Yes&quot; will use thumbnail images in the post to link to full size images.</p>
     1195
     1196                                    <h3>Show only one image when post is displayed as part of a list?</h3>
     1197
     1198                                    <p>
     1199                                        <input type=\"radio\" id=\"AutoPostImagesSummaryView_yes\" name=\"AutoPostImagesSummaryView\" value=\"YES\" {$sSummaryViewYesRadio} /> <label for=\"AutoPostImagesSummaryView_yes\">Yes</label>
     1200                                        <input type=\"radio\" id=\"AutoPostImagesSummaryView_no\" name=\"AutoPostImagesSummaryView\" value=\"NO\" {$sSummaryViewNoRadio} /> <label for=\"AutoPostImagesSummaryView_no\">No</label>
     1201                                    </p>
     1202
     1203                                    <p>Selecting &quot;Yes&quot; will show only the first image when the post is part of a list of Posts on the front page, Category page, etc.</p>
     1204
     1205                                    <h3>Customize appearance</h3>
     1206
     1207                                    <p>
     1208                                        <label class=\"kklabel\">Container style class: </label><input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesContainerClass\" name=\"AutoPostImagesContainerClass\" value=\"$aAdminOptions[sContainerClass]\" /> (Class names specified here is applied to the <em>div</em> that contains the images.)
     1209                                    </p>
     1210
     1211                                    <p>
     1212                                        <label class=\"kklabel\">Image style class: </label><input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesImageClass\" name=\"AutoPostImagesImageClass\" value=\"$aAdminOptions[sImageClass]\" /> (Class names specified here is applied to the images.)
     1213                                    </p>
     1214
     1215                                    <p>
     1216                                        <label class=\"kklabel\">Thumbnail width (px): </label><input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesThumbnailWidth\" name=\"AutoPostImagesThumbnailWidth\" value=\"$aAdminOptions[iThumbnailWidth]\" /> (Width of the thumbnails generated. The height is automatically calculated to maintain the aspect ratio. Changes are applied to any new thumbnails generated. If you wish to apply the new width to existing thumbnails then enable Maintenance functions at the end of this page.)
     1217                                    </p>
     1218
     1219                                    <h3>Image search Regular Expression?</h3>
     1220
     1221                                    <p>
     1222                                        <input type=\"text\" size=\"75\" id=\"AutoPostImagesRegEx\" name=\"AutoPostImagesRegEx\" value=\"$aAdminOptions[sRegEx]\" /> (Regular expression to use when searching for images associated with a post. Do not change this if you are not familiar with PHP regular expressions. If you do change it then it must have &quot;<span class=\"kkimptxt\">__POSTID__[^0-9]+</span>&quot; somewhere in the expression which will be replaced with the actual post id before searching for images. The default value here specifies that your images must be named as apiXXXZZZ.jpg where XXX is the POSTID of the post that you want to associate the image with and ZZZ is can be any character other than numbers and the extension of the image can be jpg or any valid image extension)
     1223                                    </p>
     1224
     1225                                    <p>
     1226                                        <strong class=\"kkimptxt\">Note: </strong>Thi is used only if you choose <em>&quot;Post ID&quot;</em> option to search for images in &quot;<em>Search Settings</em>&quot; section at the top of the page.
     1227                                    </p>
     1228
     1229                                    <p>
     1230                                        <strong>Note: </strong>If <em>Rename images for SEO</em> (below) is enabled then continue naming the images according to the regular expression specified here (apiXXXZZZ.jpg). The plugin will automatically rename images for SEO.
     1231                                    </p>
     1232
     1233                                    <h3>Rename images for SEO?</h3>
     1234
     1235                                    <p>
     1236                                        <input type=\"radio\" id=\"AutoPostImagesOptmizeImagesForSearch_yes\" name=\"AutoPostImagesOptmizeImagesForSearch\" value=\"YES\" {$sOptmizeImagesForSearchYesRadio} onClick=\"javascript:alert('Ensure that images uploaded are named according to the regular expression specified in Image search Regular Expression (above). The plugin will automatically rename images for SEO.')\" /> <label for=\"AutoPostImagesOptmizeImagesForSearch_yes\">Yes</label>
     1237                                        <input type=\"radio\" id=\"AutoPostImagesOptmizeImagesForSearch_no\" name=\"AutoPostImagesOptmizeImagesForSearch\" value=\"NO\" {$sOptmizeImagesForSearchNoRadio} /> <label for=\"AutoPostImagesOptmizeImagesForSearch_no\">No</label>
     1238                                    </p>
     1239
     1240                                    <p>Selecting &quot;Yes&quot; will rename the images using the POST title so that the images names are optimized for indexing by search engines.</p>
     1241
     1242                                    <p>
     1243                                        <strong class=\"kkimptxt\">Note: </strong>Used only if you choose <em>&quot;Post ID&quot;</em> option to search for images in &quot;<em>Search Settings</em>&quot; section at the top of the page.
     1244                                    </p>
     1245
     1246                                    <p>
     1247                                        <strong>Note: </strong>Ensure that images uploaded are named according to the regular expression specified in <em>Image search Regular Expression</em> (above). The plugin will automatically rename images for SEO. For example: If <em>Image search Regular Expression</em> is set to \"^api__POSTID__[^.]*.[a-zA-Z]+$\" then you will upload images for POST #3 as <em>api3.jpg</em> and the SEO process will rename it as <em>sapi3_the-title-of-the-post_0.jpg</em> and the thumbnail will be named <em>thumb_sapi3_the-title-of-the-post_0.jpg</em>
     1248                                    </p>
     1249
     1250                                </div>
     1251
     1252
     1253                                <div class=\"tabbertab\">
     1254                                    <h2>Path and Url Settings</h2>
     1255
     1256                                    <h3>Image directory?</h3>
     1257
     1258                                    {$sImageDirAlert1}
     1259                                    {$sImageDirAlert2}
     1260
     1261                                    <p>This is the location where you will be putting all the images. You should change this from the default to a folder outside the plugin directory.</p>
     1262
     1263                                    <p>
     1264                                        <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesImgDir\" name=\"AutoPostImagesImgDir\" value=\"$aAdminOptions[sImageDirPath]\" />
     1265                                    </p>
     1266
     1267                                    <h3>Thumbnail directory?</h3>
     1268
     1269                                    {$sThumbnailDirAlert}
     1270
     1271                                    <p>This is where the thumbnails generated by the plugin are stored. You should change this from the default to a folder outside the plugin directory.</p>
     1272
     1273                                    <p>
     1274                                        <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesThumbDir\" name=\"AutoPostImagesThumbDir\" value=\"$aAdminOptions[sImageThumbnailDirPath]\" />
     1275                                    </p>
     1276
     1277                                    <h3>Cache directory? (Used by the thumbnail creator)</h3>
     1278
     1279                                    {$sCacheDirAlert}
     1280
     1281                                    <p>This is the directory used by the plugin as cache location when generating thumbnails. Ensure that the plugin has write permissions for this folder.</p>
     1282
     1283                                    <p>
     1284                                        <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesCacheDir\" name=\"AutoPostImagesCacheDir\" value=\"$aAdminOptions[sImageCacheDir]\" />
     1285                                    </p>
     1286
     1287                                    <h3>Image directory URL?</h3>
     1288
     1289                                    <p>This the url to the directory where the images are stored.</p>
     1290
     1291                                    <p>
     1292                                        <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesImgUrl\" name=\"AutoPostImagesImgUrl\" value=\"$aAdminOptions[sImageDirUrl]\" />
     1293                                    </p>
     1294
     1295                                    <h3>Thumbnail directory URL?</h3>
     1296
     1297                                    <p>This is the url to the directory where the thumbnails are stored.</p>
     1298
     1299                                    <p>
     1300                                        <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesThumbUrl\" name=\"AutoPostImagesThumbUrl\" value=\"$aAdminOptions[sImageThumbnailDirUrl]\" />
     1301                                    </p>
     1302
     1303                                </div>
     1304
     1305
     1306                                <div class=\"tabbertab\">
     1307                                    <h2>Maintenance</h2>
     1308
     1309                                    <h3>Rerun image maintenence functions?</h3>
     1310
     1311                                    <p>
     1312                                        <input type=\"checkbox\" id=\"AutoPostImagesRerun\" value=\"rerun\" name=\"AutoPostImagesRerun\" value=\"$aAdminOptions[bRerun]\" /> Yes! Re-generate thumbnails &amp; SEO renaming (if enabled).
     1313                                    </p>
     1314
     1315                                    <p>
     1316                                        <strong>Note:</strong> If checked the plugin will delete &amp; re-generate all thumbnails folder, rename all images for SEO (if enabled). Use this to clean-up the thumbnails and ensure that all the images are named appropriately.
     1317                                    </p>
     1318                                </div>
     1319
     1320
     1321                                <div class=\"tabbertab\">
     1322                                    <h2>Excerpt</h2>
     1323
     1324                                    <h3>Enable Excerpt?</h3>
     1325
     1326                                    <p>
     1327                                        <input type=\"radio\" id=\"AutoPostImagesEnableExcerpt_yes\" name=\"AutoPostImagesEnableExcerpt\" value=\"YES\" {$sEnableExcerptYesRadio} /> <label for=\"AutoPostImagesEnableExcerpt_yes\">Yes</label>
     1328                                        <input type=\"radio\" id=\"AutoPostImagesEnableExcerpt_no\" name=\"AutoPostImagesEnableExcerpt\" value=\"NO\" {$sEnableExcerptNoRadio} /> <label for=\"AutoPostImagesEnableExcerpt_no\">No</label>
     1329                                        <span style=\"margin-left:30px;\">(Default is &quot;No&quot;)</span>
     1330                                    </p>
     1331
     1332                                    <h3>Excerpt length</h3>
     1333
     1334                                    <p>Length of the excerpt. The length excludes all html tags even if you answer &quot;No&quot; for the next question.</p>
     1335
     1336                                    <p>
     1337                                        <input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesExcerptLength\" name=\"AutoPostImagesExcerptLength\" value=\"$aAdminOptions[iExcerptLength]\" />
     1338                                    </p>
     1339
     1340                                    <h3>Strip html tags?</h3>
     1341
     1342                                    <p>Select &quot;Yes&quot; if you want all html tags to be removed from the excerpt. Default is &quot;No&quot;.</p>
     1343
     1344                                    <p>
     1345                                        <input type=\"radio\" id=\"AutoPostImagesExcerptStripTags_yes\" name=\"AutoPostImagesExcerptStripTags\" value=\"YES\" {$sExcerptStripTagsYesRadio} /> <label for=\"AutoPostImagesExcerptStripTags_yes\">Yes</label>
     1346                                        <input type=\"radio\" id=\"AutoPostImagesExcerptStripTags_no\" name=\"AutoPostImagesExcerptStripTags\" value=\"NO\" {$sExcerptStripTagsNoRadio} /> <label for=\"AutoPostImagesExcerptStripTags_no\">No</label>
     1347                                    </p>
     1348
     1349                                    <h3>Text to use for link to full post</h3>
     1350
     1351                                    <p>Default is &quot;more...&quot;</p>
     1352
     1353                                    <p>
     1354                                        <input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesExcerptLinkText\" name=\"AutoPostImagesExcerptLinkText\" value=\"$aAdminOptions[sExcerptLinkText]\" />
     1355                                    </p>
     1356
     1357                                </div>
     1358
    10531359
    10541360                                <div class=\"submit\">
     
    10561362                                </div>
    10571363
    1058                                 <hr class=\"kkadminseparator\" />
    1059 
    1060                                 <fieldset class=\"kkfieldset\">
    1061                                     <legend>General Settings</legend>
    1062 
    1063                                     <h3>Display default image if not image is found?</h3>
    1064 
    1065                                     <p>
    1066                                         <input type=\"radio\" id=\"AutoPostImagesDisplayDefaultImages_yes\" name=\"AutoPostImagesDisplayDefaultImages\" value=\"YES\" {$sDisplayDefaultImageYesRadio} /> <label for=\"AutoPostImagesDisplayDefaultImages_yes\">Yes</label>
    1067                                         <input type=\"radio\" id=\"AutoPostImagesDisplayDefaultImages_no\" name=\"AutoPostImagesDisplayDefaultImages\" value=\"NO\" {$sDisplayDefaultImageNoRadio} /> <label for=\"AutoPostImagesDisplayDefaultImages_no\">No</label>
    1068                                     </p>
    1069 
    1070                                     <p>Selecting &quot;No&quot; will hide the default &quot;Image coming soon&quot; image if no images are found for the post.</p>
    1071 
    1072                                     <h3>Use thumbnails to link to full size images?</h3>
    1073 
    1074                                     <p>
    1075                                         <input type=\"radio\" id=\"AutoPostImagesUseThumbnails_yes\" name=\"AutoPostImagesUseThumbnails\" value=\"YES\" {$sUseThumbnailsYesRadio} /> <label for=\"AutoPostImagesUseThumbnails_yes\">Yes</label>
    1076                                         <input type=\"radio\" id=\"AutoPostImagesUseThumbnails_no\" name=\"AutoPostImagesUseThumbnails\" value=\"NO\" {$sUseThumbnailsNoRadio} /> <label for=\"AutoPostImagesUseThumbnails_no\">No</label>
    1077                                     </p>
    1078 
    1079                                     <p>Selecting &quot;Yes&quot; will use thumbnail images in the post to link to full size images.</p>
    1080 
    1081                                     <h3>Show only one image when post is displayed as part of a list?</h3>
    1082 
    1083                                     <p>
    1084                                         <input type=\"radio\" id=\"AutoPostImagesSummaryView_yes\" name=\"AutoPostImagesSummaryView\" value=\"YES\" {$sSummaryViewYesRadio} /> <label for=\"AutoPostImagesSummaryView_yes\">Yes</label>
    1085                                         <input type=\"radio\" id=\"AutoPostImagesSummaryView_no\" name=\"AutoPostImagesSummaryView\" value=\"NO\" {$sSummaryViewNoRadio} /> <label for=\"AutoPostImagesSummaryView_no\">No</label>
    1086                                     </p>
    1087 
    1088                                     <p>Selecting &quot;Yes&quot; will show only the first image when the post is part of a list of Posts on the front page, Category page, etc.</p>
    1089 
    1090                                     <h3>Customize appearance</h3>
    1091 
    1092                                     <p>
    1093                                         <label class=\"kklabel\">Container style class: </label><input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesContainerClass\" name=\"AutoPostImagesContainerClass\" value=\"$aAdminOptions[sContainerClass]\" /> (Class names specified here is applied to the <em>div</em> that contains the images.)
    1094                                     </p>
    1095 
    1096                                     <p>
    1097                                         <label class=\"kklabel\">Image style class: </label><input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesImageClass\" name=\"AutoPostImagesImageClass\" value=\"$aAdminOptions[sImageClass]\" /> (Class names specified here is applied to the images.)
    1098                                     </p>
    1099 
    1100                                     <p>
    1101                                         <label class=\"kklabel\">Thumbnail width (px): </label><input type=\"text\" class=\"kkwidth20\" id=\"AutoPostImagesThumbnailWidth\" name=\"AutoPostImagesThumbnailWidth\" value=\"$aAdminOptions[iThumbnailWidth]\" /> (Width of the thumbnails generated. The height is automatically calculated to maintain the aspect ratio. Changes are applied to any new thumbnails generated. If you wish to apply the new width to existing thumbnails then enable Maintenance functions at the end of this page.)
    1102                                     </p>
    1103 
    1104                                     <h3>Image search Regular Expression?</h3>
    1105 
    1106                                     <p>
    1107                                         <input type=\"text\" size=\"75\" id=\"AutoPostImagesRegEx\" name=\"AutoPostImagesRegEx\" value=\"$aAdminOptions[sRegEx]\" /> (Regular expression to use when searching for images associated with a post. Do not change this if you are not familiar with PHP regular expressions. If you do change it then it must have &quot;<span class=\"kkimptxt\">__POSTID__[^0-9]+</span>&quot; somewhere in the expression which will be replaced with the actual post id before searching for images. The default value here specifies that your images must be named as apiXXXZZZ.jpg where XXX is the POSTID of the post that you want to associate the image with and ZZZ is can be any character other than numbers and the extension of the image can be jpg or any valid image extension)
    1108                                     </p>
    1109 
    1110                                     <p>
    1111                                         <strong class=\"kkimptxt\">Note: </strong>Thi is used only if you choose <em>&quot;Post ID&quot;</em> option to search for images in &quot;<em>Search Settings</em>&quot; section at the top of the page.
    1112                                     </p>
    1113 
    1114                                     <p>
    1115                                         <strong>Note: </strong>If <em>Rename images for SEO</em> (below) is enabled then continue naming the images according to the regular expression specified here (apiXXXZZZ.jpg). The plugin will automatically rename images for SEO.
    1116                                     </p>
    1117 
    1118                                     <h3>Rename images for SEO?</h3>
    1119 
    1120                                     <p>
    1121                                         <input type=\"radio\" id=\"AutoPostImagesOptmizeImagesForSearch_yes\" name=\"AutoPostImagesOptmizeImagesForSearch\" value=\"YES\" {$sOptmizeImagesForSearchYesRadio} onClick=\"javascript:alert('Ensure that images uploaded are named according to the regular expression specified in Image search Regular Expression (above). The plugin will automatically rename images for SEO.')\" /> <label for=\"AutoPostImagesOptmizeImagesForSearch_yes\">Yes</label>
    1122                                         <input type=\"radio\" id=\"AutoPostImagesOptmizeImagesForSearch_no\" name=\"AutoPostImagesOptmizeImagesForSearch\" value=\"NO\" {$sOptmizeImagesForSearchNoRadio} /> <label for=\"AutoPostImagesOptmizeImagesForSearch_no\">No</label>
    1123                                     </p>
    1124 
    1125                                     <p>Selecting &quot;Yes&quot; will rename the images using the POST title so that the images names are optimized for indexing by search engines.</p>
    1126 
    1127                                     <p>
    1128                                         <strong class=\"kkimptxt\">Note: </strong>Used only if you choose <em>&quot;Post ID&quot;</em> option to search for images in &quot;<em>Search Settings</em>&quot; section at the top of the page.
    1129                                     </p>
    1130 
    1131                                     <p>
    1132                                         <strong>Note: </strong>Ensure that images uploaded are named according to the regular expression specified in <em>Image search Regular Expression</em> (above). The plugin will automatically rename images for SEO. For example: If <em>Image search Regular Expression</em> is set to \"^api__POSTID__[^.]*.[a-zA-Z]+$\" then you will upload images for POST #3 as <em>api3.jpg</em> and the SEO process will rename it as <em>sapi3_the-title-of-the-post_0.jpg</em> and the thumbnail will be named <em>thumb_sapi3_the-title-of-the-post_0.jpg</em>
    1133                                     </p>
    1134 
    1135                                 </fieldset>
    1136 
    1137                                 <div class=\"submit\">
    1138                                     <input type=\"submit\" name=\"updateAutoPostImagesSettings\" value=\"{$sUpdateAutoPostImagesSubmitButton}\" />
    1139                                 </div>
    1140 
    1141                                 <hr class=\"kkadminseparator\" />
    1142 
    1143                                 <fieldset class=\"kkfieldset\">
    1144                                     <legend>Path &amp;Url Settings</legend>
    1145 
    1146                                     <h3>Image directory?</h3>
    1147 
    1148                                     {$sImageDirAlert1}
    1149                                     {$sImageDirAlert2}
    1150 
    1151                                     <p>This is the location where you will be putting all the images. You should change this from the default to a folder outside the plugin directory.</p>
    1152 
    1153                                     <p>
    1154                                         <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesImgDir\" name=\"AutoPostImagesImgDir\" value=\"$aAdminOptions[sImageDirPath]\" />
    1155                                     </p>
    1156 
    1157                                     <h3>Thumbnail directory?</h3>
    1158 
    1159                                     {$sThumbnailDirAlert}
    1160 
    1161                                     <p>This is where the thumbnails generated by the plugin are stored. You should change this from the default to a folder outside the plugin directory.</p>
    1162 
    1163                                     <p>
    1164                                         <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesThumbDir\" name=\"AutoPostImagesThumbDir\" value=\"$aAdminOptions[sImageThumbnailDirPath]\" />
    1165                                     </p>
    1166 
    1167                                     <h3>Cache directory? (Used by the thumbnail creator)</h3>
    1168 
    1169                                     {$sCacheDirAlert}
    1170 
    1171                                     <p>This is the directory used by the plugin as cache location when generating thumbnails. Ensure that the plugin has write permissions for this folder.</p>
    1172 
    1173                                     <p>
    1174                                         <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesCacheDir\" name=\"AutoPostImagesCacheDir\" value=\"$aAdminOptions[sImageCacheDir]\" />
    1175                                     </p>
    1176 
    1177                                     <h3>Image directory URL?</h3>
    1178 
    1179                                     <p>This the url to the directory where the images are stored.</p>
    1180 
    1181                                     <p>
    1182                                         <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesImgUrl\" name=\"AutoPostImagesImgUrl\" value=\"$aAdminOptions[sImageDirUrl]\" />
    1183                                     </p>
    1184 
    1185                                     <h3>Thumbnail directory URL?</h3>
    1186 
    1187                                     <p>This is the url to the directory where the thumbnails are stored.</p>
    1188 
    1189                                     <p>
    1190                                         <input type=\"text\" class=\"kkwidth90\" id=\"AutoPostImagesThumbUrl\" name=\"AutoPostImagesThumbUrl\" value=\"$aAdminOptions[sImageThumbnailDirUrl]\" />
    1191                                     </p>
    1192 
    1193                                 </fieldset>
    1194 
    1195                                 <div class=\"submit\">
    1196                                     <input type=\"submit\" name=\"updateAutoPostImagesSettings\" value=\"{$sUpdateAutoPostImagesSubmitButton}\" />
    1197                                 </div>
    1198 
    1199                                 <hr class=\"kkadminseparator\" />
    1200 
    1201                                 <fieldset class=\"kkfieldset\">
    1202                                     <legend>Maintenance</legend>
    1203 
    1204                                     <h3>Rerun image maintenence functions?</h3>
    1205 
    1206                                     <p>
    1207                                         <input type=\"checkbox\" id=\"AutoPostImagesRerun\" value=\"rerun\" name=\"AutoPostImagesRerun\" value=\"$aAdminOptions[bRerun]\" /> Yes! Re-generate thumbnails &amp; SEO renaming (if enabled).
    1208                                     </p>
    1209 
    1210                                     <p>
    1211                                         <strong>Note:</strong> If checked the plugin will delete &amp; re-generate all thumbnails folder, rename all images for SEO (if enabled). Use this to clean-up the thumbnails and ensure that all the images are named appropriately.
    1212                                     </p>
    1213                                 </fieldset>
    1214 
    1215                                 <div class=\"submit\">
    1216                                     <input type=\"submit\" name=\"updateAutoPostImagesSettings\" value=\"{$sUpdateAutoPostImagesSubmitButton}\" />
    1217                                 </div>
     1364                            </div>
    12181365                            </form>
    12191366                        </div>
     
    14171564
    14181565                add_action( "admin_print_scripts-$mypage", array(&$oKKAutoPostImages, 'includeAdminCSS'), 1);
     1566                add_action( "admin_print_scripts-$mypage", array(&$oKKAutoPostImages, 'includeAdminJS'), 1);
    14191567            }
    14201568        }
     
    14591607        // Add the image to the post content
    14601608        //
    1461         add_filter('the_content', array(&$oKKAutoPostImages, 'showImagesByPostId'));
     1609        add_filter('the_content', array(&$oKKAutoPostImages, 'showImagesByPostId'), 1);
    14621610    }
    14631611
  • auto-post-images-api/trunk/readme.txt

    r331100 r352789  
    66Tested on: 2.6.2, 2.7, 2.7.1, 2.8.4,2.8.6,2.9,3.0,3.0.1,3.0.3
    77Tested up to: 3.1
    8 Stable tag: 3.0.2
     8Stable tag: 3.1
    99
    1010Automatically insert images to posts without having to edit the post. Supports renaming images for search engine optimization (SEO).
Note: See TracChangeset for help on using the changeset viewer.