我使用<?php
// Rename function to call old function later
rename_function('mkdir', 'old_mkdir');
// Override function mkdir
override_function('mkdir', '$pathname, $mode, $recursive, $context', 'return override_mkdir($string);');
// New mkdir function
function override_mkdir($pathname, $mode, $recursive, $context){
do_something();
// Call original mkdir function
return old_mkdir($pathname, $mode, $recursive, $context);
}
?>
wordpress插件它有一个函数wp-jalali
。我使用这个函数但是如果没有安装插件,这个函数是未定义的。
我将以下代码放在farsi_num
functions.php
但是当用户想要安装if(!function_exists('farsi_num'))
function farsi_num( $val ) {
return $val;
}
插件时,我们会出错!
致命错误:无法重新声明
wp-jalali
(之前已在声明中声明)farsi_num()
) 在
F:\xampp\htdocs\wordpress\wp-content\themes\khoshkhabar\functions.php:54
在第119行
F:\xampp\htdocs\wordpress\wp-content\plugins\wp-jalali\lib\deprecated_fns.php
中的
答案 0 :(得分:0)
我理解你的问题。文件deprecated_fns.php
中的错误不在functions.php
中。因为之前包含functions.php
。因此,您必须检查文件deprecated_fns.php
中的function_exits,或在functions.php
答案 1 :(得分:0)
尝试使用Sub aa()
Dim CellValue As Variant
Dim CellFormula As String
Dim CellPart() As String
Dim CellValueRow As Long
Dim CellValueCol As Long
Dim ColCrnt As Long
Dim ColLast As Long
Dim RowCrnt As Long
Dim RowLast As Long
With Worksheets("all") ' Replaced with name of your worksheet
RowLast = .Cells.Find("*", .Range("A1"), xlFormulas, , xlByRows, xlPrevious).Row
ColLast = .Cells.Find("*", .Range("A1"), xlFormulas, , xlByColumns, xlPrevious).Column
ReDim CellValue(1 To RowLast - 1, 1 To ColLast) 'max # of array rows based on last row of data available
CellValueRow = 1
For RowCrnt = 2 To RowLast
CellFormula = .Cells(RowCrnt, "D").Formula
If Left(CellFormula, 11) = "=HYPERLINK(" Then
CellFormula = Mid(CellFormula, 12) '=> "http://www.uniprot.org/uniprot/P42336","PIK3CA")
CellFormula = Mid(CellFormula, 1, Len(CellFormula) - 1) '=> "http://www.uniprot.org/uniprot/P42336","PIK3CA"
CellFormula = Replace(CellFormula, """", "") '=> http://www.uniprot.org/uniprot/P42336,PIK3CA
CellPart = Split(CellFormula, ",")
'Debug.Print CellPart(0) & " " & CellPart(1)
If CellPart(1) <> "Q61R" And CellPart(1) <> "I391M" And CellPart(1) <> "V600E" And _
CellPart(1) <> "PIC3CA" And CellPart(1) <> "BRAF" And CellPart(1) <> "EGFR" Then
CellValue(CellValueRow, ) = .Range(.Cells(RowCrnt, 1), .Cells(RowCrnt, ColLast)).Formula '===> need help here
CellValueRow = CellValueRow + 1
End If
End If
Next
'For RowCrnt = 1 To 10
'For ColCrnt = 1 To 10
'Debug.Print "[R" & RowCrnt & "C" & ColCrnt & "]" & CellValue(RowCrnt, ColCrnt);
'Next
'Debug.Print
'Next
End With
Worksheets("Access").Range("A2:AF" & RowLast).Value = Application.Index(CellValue, 0)
End Sub
:LINK
add_filter
中的
function.php
function pippin_show_fruits() {
$fruits = array(
'apples',
'oranges',
'kumkwats',
'dragon fruit',
'peaches',
'durians'
);
$list = '<ul>';
if(has_filter('pippin_add_fruits')) {
$fruits = apply_filters('pippin_add_fruits', $fruits);
}
foreach($fruits as $fruit) :
$list .= '<li>' . $fruit . '</li>';
endforeach;
$list .= '</ul>';
return $list;
}
echo apply_filter('pippin_show_fruits'); //CALL FUNCTION
中的
your plugin